@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,20 +1,103 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KameleoonData = exports.BrowserType = exports.DeviceType = exports.UserAgent = exports.PageView = exports.Browser = exports.Device = exports.Conversion = exports.CustomData = void 0;
4
- var customData_1 = require("./customData");
5
- Object.defineProperty(exports, "CustomData", { enumerable: true, get: function () { return customData_1.CustomData; } });
6
- var conversion_1 = require("./conversion");
7
- Object.defineProperty(exports, "Conversion", { enumerable: true, get: function () { return conversion_1.Conversion; } });
8
- var device_1 = require("./device");
9
- Object.defineProperty(exports, "Device", { enumerable: true, get: function () { return device_1.Device; } });
10
- var browser_1 = require("./browser");
11
- Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return browser_1.Browser; } });
12
- var pageView_1 = require("./pageView");
13
- Object.defineProperty(exports, "PageView", { enumerable: true, get: function () { return pageView_1.PageView; } });
14
- var userAgent_1 = require("./userAgent");
15
- Object.defineProperty(exports, "UserAgent", { enumerable: true, get: function () { return userAgent_1.UserAgent; } });
16
- var types_1 = require("./types");
17
- Object.defineProperty(exports, "DeviceType", { enumerable: true, get: function () { return types_1.DeviceType; } });
18
- Object.defineProperty(exports, "BrowserType", { enumerable: true, get: function () { return types_1.BrowserType; } });
19
- Object.defineProperty(exports, "KameleoonData", { enumerable: true, get: function () { return types_1.KameleoonData; } });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Browser", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _browser.Browser;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "BrowserType", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _types.BrowserType;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "Conversion", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _conversion.Conversion;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ConversionParametersType", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _types.ConversionParametersType;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "CustomData", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _customData.CustomData;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "CustomDataType", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _types.CustomDataType;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "Device", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _device.Device;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "DeviceType", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _types.DeviceType;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "KameleoonData", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _types.KameleoonData;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "KameleoonDataItemType", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _types.KameleoonDataItemType;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "KameleoonDataType", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _types.KameleoonDataType;
70
+ }
71
+ });
72
+ Object.defineProperty(exports, "PageView", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _pageView.PageView;
76
+ }
77
+ });
78
+ Object.defineProperty(exports, "PageViewParametersType", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _types.PageViewParametersType;
82
+ }
83
+ });
84
+ Object.defineProperty(exports, "UserAgent", {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _userAgent.UserAgent;
88
+ }
89
+ });
90
+ Object.defineProperty(exports, "UserAgentDataType", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _types.UserAgentDataType;
94
+ }
95
+ });
96
+ var _customData = require("./customData");
97
+ var _conversion = require("./conversion");
98
+ var _device = require("./device");
99
+ var _browser = require("./browser");
100
+ var _pageView = require("./pageView");
101
+ var _userAgent = require("./userAgent");
102
+ var _types = require("./types");
20
103
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/kameleoonData/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,iCAUiB;AATf,mGAAA,UAAU,OAAA;AACV,oGAAA,WAAW,OAAA;AAEX,sGAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_customData","require","_conversion","_device","_browser","_pageView","_userAgent","_types"],"sources":["../../src/kameleoonData/index.ts"],"sourcesContent":["export { CustomData } from './customData';\nexport { Conversion } from './conversion';\nexport { Device } from './device';\nexport { Browser } from './browser';\nexport { PageView } from './pageView';\nexport { UserAgent } from './userAgent';\nexport {\n DeviceType,\n BrowserType,\n CustomDataType,\n KameleoonData,\n KameleoonDataType,\n KameleoonDataItemType,\n PageViewParametersType,\n ConversionParametersType,\n UserAgentDataType,\n} from './types';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA"}
@@ -1,20 +1,32 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.Nonce = void 0;
4
- const constants_1 = require("./constants");
7
+ var _constants = require("./constants");
8
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
10
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
11
  class Nonce {
6
- constructor() {
7
- this.nonce = this.getNonce();
8
- }
9
- getNonce() {
10
- const hexLength = constants_1.HEX_CHARACTERS.length;
11
- let nonce = '';
12
- for (let i = 0; i < hexLength; i++) {
13
- const randomNumber = Math.floor(Math.random() * hexLength);
14
- nonce += constants_1.HEX_CHARACTERS.substring(randomNumber, randomNumber + 1);
15
- }
16
- return nonce;
12
+ // --- Note ---
13
+ // nonce «number that can only be used once»
14
+ // is a hex valid string for the one-time use, which helps
15
+ // tracking mechanism to differ one tracking event from another
16
+
17
+ constructor() {
18
+ _defineProperty(this, "nonce", void 0);
19
+ this.nonce = this.getNonce();
20
+ }
21
+ getNonce() {
22
+ const hexLength = _constants.HEX_CHARACTERS.length;
23
+ let nonce = '';
24
+ for (let i = 0; i < hexLength; i++) {
25
+ const randomNumber = Math.floor(Math.random() * hexLength);
26
+ nonce += _constants.HEX_CHARACTERS.substring(randomNumber, randomNumber + 1);
17
27
  }
28
+ return nonce;
29
+ }
18
30
  }
19
31
  exports.Nonce = Nonce;
20
32
  //# sourceMappingURL=nonce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nonce.js","sourceRoot":"","sources":["../../src/kameleoonData/nonce.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAE7C,MAAsB,KAAK;IAOzB;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAEO,QAAQ;QACd,MAAM,SAAS,GAAG,0BAAc,CAAC,MAAM,CAAC;QACxC,IAAI,KAAK,GAAW,EAAE,CAAC;QAEvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAClC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;YAC3D,KAAK,IAAI,0BAAc,CAAC,SAAS,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,CAAC;SACnE;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAtBD,sBAsBC"}
1
+ {"version":3,"file":"nonce.js","names":["_constants","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Nonce","constructor","nonce","getNonce","hexLength","HEX_CHARACTERS","length","i","randomNumber","Math","floor","random","substring","exports"],"sources":["../../src/kameleoonData/nonce.ts"],"sourcesContent":["import { HEX_CHARACTERS } from './constants';\n\nexport abstract class Nonce {\n // --- Note ---\n // nonce — «number that can only be used once»\n // is a hex valid string for the one-time use, which helps\n // tracking mechanism to differ one tracking event from another\n protected nonce: string;\n\n constructor() {\n this.nonce = this.getNonce();\n }\n\n private getNonce(): string {\n const hexLength = HEX_CHARACTERS.length;\n let nonce: string = '';\n\n for (let i = 0; i < hexLength; i++) {\n const randomNumber = Math.floor(Math.random() * hexLength);\n nonce += HEX_CHARACTERS.substring(randomNumber, randomNumber + 1);\n }\n\n return nonce;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAA6C,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,c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";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.PageView = void 0;
4
- const requester_1 = require("../requester");
5
- const nonce_1 = require("./nonce");
6
- const types_1 = require("./types");
7
+ var _requester = require("../requester");
8
+ var _nonce = require("./nonce");
9
+ var _types = require("./types");
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
13
  /**
8
14
  * @class
9
15
  * PageView - a class for creating an instance of a page view data
10
16
  * */
11
- class PageView extends nonce_1.Nonce {
12
- /**
13
- * @param {PageViewParametersType} pageViewParameters - an object with page view parameters
14
- * */
15
- constructor({ urlAddress, title, referrers }) {
16
- super();
17
- this.urlAddress = urlAddress;
18
- this.title = title;
19
- this.referrers = referrers;
20
- }
21
- /**
22
- * @property url - url for the current data type used for events tracking
23
- * */
24
- get url() {
25
- return (requester_1.UrlEventType.Page +
26
- requester_1.UrlParameter.Href +
27
- encodeURIComponent(this.urlAddress) +
28
- requester_1.UrlParameter.Title +
29
- encodeURIComponent(this.title) +
30
- this.getReferresParameter(this.referrers) +
31
- requester_1.UrlParameter.Nonce +
32
- this.nonce);
33
- }
34
- /**
35
- * @property data - data of the current class instance
36
- * */
37
- get data() {
38
- return {
39
- urlAddress: this.urlAddress,
40
- title: this.title,
41
- referrers: this.referrers,
42
- type: types_1.KameleoonData.PageView,
43
- nonce: this.nonce,
44
- };
45
- }
46
- getReferresParameter(referrers) {
47
- if (referrers) {
48
- return requester_1.UrlParameter.ReferrersIndices + JSON.stringify(referrers);
49
- }
50
- return '';
17
+ class PageView extends _nonce.Nonce {
18
+ /**
19
+ * @param {PageViewParametersType} pageViewParameters - an object with page view parameters
20
+ * */
21
+ constructor({
22
+ urlAddress,
23
+ title,
24
+ referrers
25
+ }) {
26
+ super();
27
+ _defineProperty(this, "urlAddress", void 0);
28
+ _defineProperty(this, "title", void 0);
29
+ _defineProperty(this, "referrers", void 0);
30
+ this.urlAddress = urlAddress;
31
+ this.title = title;
32
+ this.referrers = referrers;
33
+ }
34
+
35
+ /**
36
+ * @property url - url for the current data type used for events tracking
37
+ * */
38
+ get url() {
39
+ return _requester.UrlEventType.Page + _requester.UrlParameter.Href + encodeURIComponent(this.urlAddress) + _requester.UrlParameter.Title + encodeURIComponent(this.title) + this.getReferresParameter(this.referrers) + _requester.UrlParameter.Nonce + this.nonce;
40
+ }
41
+
42
+ /**
43
+ * @property data - data of the current class instance
44
+ * */
45
+ get data() {
46
+ return {
47
+ urlAddress: this.urlAddress,
48
+ title: this.title,
49
+ referrers: this.referrers,
50
+ type: _types.KameleoonData.PageView,
51
+ nonce: this.nonce
52
+ };
53
+ }
54
+ getReferresParameter(referrers) {
55
+ if (referrers) {
56
+ return _requester.UrlParameter.ReferrersIndices + JSON.stringify(referrers);
51
57
  }
58
+ return '';
59
+ }
52
60
  }
53
61
  exports.PageView = PageView;
54
62
  //# sourceMappingURL=pageView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageView.js","sourceRoot":"","sources":["../../src/kameleoonData/pageView.ts"],"names":[],"mappings":";;;AAAA,4CAA0D;AAC1D,mCAAgC;AAChC,mCAKiB;AAEjB;;;KAGK;AACL,MAAa,QAAS,SAAQ,aAAK;IAKjC;;SAEK;IACL,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAA0B;QAClE,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;SAEK;IACL,IAAI,GAAG;QACL,OAAO,CACL,wBAAY,CAAC,IAAI;YACjB,wBAAY,CAAC,IAAI;YACjB,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;YACnC,wBAAY,CAAC,KAAK;YAClB,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;YAC9B,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,CAAC;YACzC,wBAAY,CAAC,KAAK;YAClB,IAAI,CAAC,KAAK,CACX,CAAC;IACJ,CAAC;IAED;;SAEK;IACL,IAAI,IAAI;QACN,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,qBAAa,CAAC,QAAQ;YAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;IAEO,oBAAoB,CAC1B,SAA8C;QAE9C,IAAI,SAAS,EAAE;YACb,OAAO,wBAAY,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;SAClE;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAtDD,4BAsDC"}
1
+ {"version":3,"file":"pageView.js","names":["_requester","require","_nonce","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","PageView","Nonce","constructor","urlAddress","title","referrers","url","UrlEventType","Page","UrlParameter","Href","encodeURIComponent","Title","getReferresParameter","nonce","data","type","KameleoonData","ReferrersIndices","JSON","stringify","exports"],"sources":["../../src/kameleoonData/pageView.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from '../requester';\nimport { Nonce } from './nonce';\nimport {\n IKameleoonData,\n KameleoonData,\n PageViewDataType,\n PageViewParametersType,\n} from './types';\n\n/**\n * @class\n * PageView - a class for creating an instance of a page view data\n * */\nexport class PageView extends Nonce implements IKameleoonData {\n private urlAddress: string;\n private title: string;\n private referrers?: number[];\n\n /**\n * @param {PageViewParametersType} pageViewParameters - an object with page view parameters\n * */\n constructor({ urlAddress, title, referrers }: PageViewParametersType) {\n super();\n\n this.urlAddress = urlAddress;\n this.title = title;\n this.referrers = referrers;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return (\n UrlEventType.Page +\n UrlParameter.Href +\n encodeURIComponent(this.urlAddress) +\n UrlParameter.Title +\n encodeURIComponent(this.title) +\n this.getReferresParameter(this.referrers) +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): PageViewDataType {\n return {\n urlAddress: this.urlAddress,\n title: this.title,\n referrers: this.referrers,\n type: KameleoonData.PageView,\n nonce: this.nonce,\n };\n }\n\n private getReferresParameter(\n referrers: PageViewParametersType['referrers'],\n ): string {\n if (referrers) {\n return UrlParameter.ReferrersIndices + JSON.stringify(referrers);\n }\n\n return '';\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKiB,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA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oBAAa,CAACjB,QAAQ;MAC5Bc,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;EAEQD,oBAAoBA,CAC1BR,SAA8C,EACtC;IACR,IAAIA,SAAS,EAAE;MACb,OAAOI,uBAAY,CAACS,gBAAgB,GAAGC,IAAI,CAACC,SAAS,CAACf,SAAS,CAAC;IAClE;IAEA,OAAO,EAAE;EACX;AACF;AAACgB,OAAA,CAAArB,QAAA,GAAAA,QAAA"}
@@ -1,36 +1,51 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BrowserType = exports.DeviceType = exports.KameleoonData = void 0;
4
- var KameleoonData;
5
- (function (KameleoonData) {
6
- KameleoonData["CustomData"] = "customData";
7
- KameleoonData["PageView"] = "pageView";
8
- KameleoonData["Browser"] = "browser";
9
- KameleoonData["Conversion"] = "conversion";
10
- KameleoonData["Device"] = "device";
11
- KameleoonData["UserAgent"] = "userAgent";
12
- })(KameleoonData = exports.KameleoonData || (exports.KameleoonData = {}));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.KameleoonData = exports.DeviceType = exports.BrowserType = void 0;
7
+ /**
8
+ * @interface an interface of KameleoonData
9
+ * each class instance will have url getter method
10
+ * for handling url of different data types
11
+ * */
12
+ /**
13
+ * @type a tuple of each possible type of data for `addData` method
14
+ * of KameleoonClient
15
+ * */
16
+ let KameleoonData = /*#__PURE__*/function (KameleoonData) {
17
+ KameleoonData["CustomData"] = "customData";
18
+ KameleoonData["PageView"] = "pageView";
19
+ KameleoonData["Browser"] = "browser";
20
+ KameleoonData["Conversion"] = "conversion";
21
+ KameleoonData["Device"] = "device";
22
+ KameleoonData["UserAgent"] = "userAgent";
23
+ return KameleoonData;
24
+ }({});
25
+ exports.KameleoonData = KameleoonData;
13
26
  /**
14
27
  * @readonly
15
28
  * @enum {string} an Enum containing all possible variants for device type
16
29
  * */
17
- var DeviceType;
18
- (function (DeviceType) {
19
- DeviceType["Phone"] = "PHONE";
20
- DeviceType["Tablet"] = "TABLET";
21
- DeviceType["Desktop"] = "DESKTOP";
22
- })(DeviceType = exports.DeviceType || (exports.DeviceType = {}));
30
+ let DeviceType = /*#__PURE__*/function (DeviceType) {
31
+ DeviceType["Phone"] = "PHONE";
32
+ DeviceType["Tablet"] = "TABLET";
33
+ DeviceType["Desktop"] = "DESKTOP";
34
+ return DeviceType;
35
+ }({});
23
36
  /**
24
37
  * @readonly
25
38
  * @enum {number} an Enum containing all possible variants for browser type
26
39
  * */
27
- var BrowserType;
28
- (function (BrowserType) {
29
- BrowserType[BrowserType["Chrome"] = 0] = "Chrome";
30
- BrowserType[BrowserType["InternetExplorer"] = 1] = "InternetExplorer";
31
- BrowserType[BrowserType["Firefox"] = 2] = "Firefox";
32
- BrowserType[BrowserType["Safari"] = 3] = "Safari";
33
- BrowserType[BrowserType["Opera"] = 4] = "Opera";
34
- BrowserType[BrowserType["Other"] = 5] = "Other";
35
- })(BrowserType = exports.BrowserType || (exports.BrowserType = {}));
40
+ exports.DeviceType = DeviceType;
41
+ let BrowserType = /*#__PURE__*/function (BrowserType) {
42
+ BrowserType[BrowserType["Chrome"] = 0] = "Chrome";
43
+ BrowserType[BrowserType["InternetExplorer"] = 1] = "InternetExplorer";
44
+ BrowserType[BrowserType["Firefox"] = 2] = "Firefox";
45
+ BrowserType[BrowserType["Safari"] = 3] = "Safari";
46
+ BrowserType[BrowserType["Opera"] = 4] = "Opera";
47
+ BrowserType[BrowserType["Other"] = 5] = "Other";
48
+ return BrowserType;
49
+ }({});
50
+ exports.BrowserType = BrowserType;
36
51
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/kameleoonData/types.ts"],"names":[],"mappings":";;;AAuCA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,kCAAiB,CAAA;IACjB,wCAAuB,CAAA;AACzB,CAAC,EAPW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAOxB;AAiED;;;KAGK;AACL,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB;AAED;;;KAGK;AACL,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,iDAAM,CAAA;IACN,qEAAgB,CAAA;IAChB,mDAAO,CAAA;IACP,iDAAM,CAAA;IACN,+CAAK,CAAA;IACL,+CAAK,CAAA;AACP,CAAC,EAPW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAOtB"}
1
+ {"version":3,"file":"types.js","names":["KameleoonData","exports","DeviceType","BrowserType"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import {\n Browser,\n Conversion,\n CustomData,\n Device,\n PageView,\n UserAgent,\n} from './';\n\nexport type KameleoonDataItemType =\n | BrowserDataType\n | ConversionDataType\n | CustomDataType\n | DeviceDataType\n | PageViewDataType\n | UserAgentDataType;\n\n/**\n * @interface an interface of KameleoonData\n * each class instance will have url getter method\n * for handling url of different data types\n * */\nexport interface IKameleoonData {\n readonly url: string;\n readonly data: KameleoonDataItemType;\n}\n\n/**\n * @type a tuple of each possible type of data for `addData` method\n * of KameleoonClient\n * */\nexport type KameleoonDataType =\n | Browser\n | Conversion\n | CustomData\n | Device\n | PageView\n | UserAgent;\n\nexport enum KameleoonData {\n CustomData = 'customData',\n PageView = 'pageView',\n Browser = 'browser',\n Conversion = 'conversion',\n Device = 'device',\n UserAgent = 'userAgent',\n}\n\nexport type BrowserDataType = {\n browser: BrowserType;\n type: KameleoonData;\n nonce: string;\n};\n\nexport type ConversionDataType = {\n goalId: number;\n revenue: number;\n negative: boolean;\n type: KameleoonData;\n nonce: string;\n};\n\nexport type CustomDataType = {\n index: number;\n value: string | string[];\n type: KameleoonData;\n nonce: string;\n};\n\nexport type DeviceDataType = {\n device: DeviceType;\n type: KameleoonData;\n nonce: string;\n};\n\nexport type PageViewDataType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n type: KameleoonData;\n nonce: string;\n};\n\nexport type UserAgentDataType = {\n value: string;\n type: KameleoonData;\n nonce: string;\n};\n\n/**\n * @param {number} goalId - an id of a goal to trac\n * @param {number | undefined} revenue - an optional parameter for revenue, default value is `0`\n * @param {boolean | undefined} negative - an optional parameteridentifying whether the conversion should be removed, default value is `false`\n * */\nexport type ConversionParametersType = {\n goalId: number;\n revenue?: number;\n negative?: boolean;\n};\n\n/**\n * @param {string} urlAddress - url address of the page to track\n * @param {string} title - title of the web page\n * @param {number[] | undefined} referrers - an optional parameter containing a list of refferesIndices, has no default value\n * */\nexport type PageViewParametersType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for device type\n * */\nexport enum DeviceType {\n Phone = 'PHONE',\n Tablet = 'TABLET',\n Desktop = 'DESKTOP',\n}\n\n/**\n * @readonly\n * @enum {number} an Enum containing all possible variants for browser type\n * */\nexport enum BrowserType {\n Chrome,\n InternetExplorer,\n Firefox,\n Safari,\n Opera,\n Other,\n}\n"],"mappings":";;;;;;AAiBA;AACA;AACA;AACA;AACA;AAMA;AACA;AACA;AACA;AAHA,IAYYA,aAAa,0BAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAA,OAAbA,aAAa;AAAA;AAAAC,OAAA,CAAAD,aAAA,GAAAA,aAAA;AAwEzB;AACA;AACA;AACA;AAHA,IAIYE,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;AAMtB;AACA;AACA;AACA;AAHAD,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAAA,IAIYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;AAAAF,OAAA,CAAAE,WAAA,GAAAA,WAAA"}
@@ -1,33 +1,42 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.UserAgent = void 0;
4
- const nonce_1 = require("./nonce");
5
- const types_1 = require("./types");
7
+ var _nonce = require("./nonce");
8
+ var _types = require("./types");
9
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
12
  /**
7
13
  * @class
8
14
  * UserAgent - a class for creating an instance for user agent
9
15
  * */
10
- class UserAgent extends nonce_1.Nonce {
11
- constructor(value) {
12
- super();
13
- this.value = value;
14
- }
15
- /**
16
- * @property url - url for the current data type used for events tracking
17
- * */
18
- get url() {
19
- return '';
20
- }
21
- /**
22
- * @property data - data of the current class instance
23
- * */
24
- get data() {
25
- return {
26
- value: this.value,
27
- type: types_1.KameleoonData.UserAgent,
28
- nonce: this.nonce,
29
- };
30
- }
16
+ class UserAgent extends _nonce.Nonce {
17
+ constructor(value) {
18
+ super();
19
+ _defineProperty(this, "value", void 0);
20
+ this.value = value;
21
+ }
22
+
23
+ /**
24
+ * @property url - url for the current data type used for events tracking
25
+ * */
26
+ get url() {
27
+ return '';
28
+ }
29
+
30
+ /**
31
+ * @property data - data of the current class instance
32
+ * */
33
+ get data() {
34
+ return {
35
+ value: this.value,
36
+ type: _types.KameleoonData.UserAgent,
37
+ nonce: this.nonce
38
+ };
39
+ }
31
40
  }
32
41
  exports.UserAgent = UserAgent;
33
42
  //# sourceMappingURL=userAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.js","sourceRoot":"","sources":["../../src/kameleoonData/userAgent.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,mCAA2E;AAE3E;;;KAGK;AACL,MAAa,SAAU,SAAQ,aAAK;IAGlC,YAAY,KAAa;QACvB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;SAEK;IACL,IAAI,GAAG;QACL,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;SAEK;IACL,IAAI,IAAI;QACN,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,qBAAa,CAAC,SAAS;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF;AA1BD,8BA0BC"}
1
+ {"version":3,"file":"userAgent.js","names":["_nonce","require","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","UserAgent","Nonce","constructor","url","data","type","KameleoonData","nonce","exports"],"sources":["../../src/kameleoonData/userAgent.ts"],"sourcesContent":["import { Nonce } from './nonce';\nimport { UserAgentDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * UserAgent - a class for creating an instance for user agent\n * */\nexport class UserAgent extends Nonce implements IKameleoonData {\n private value: string;\n\n constructor(value: string) {\n super();\n\n this.value = value;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return '';\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): UserAgentDataType {\n return {\n value: this.value,\n type: KameleoonData.UserAgent,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA2E,SAAAE,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAE3E;AACA;AACA;AACA;AACO,MAAMU,SAAS,SAASC,YAAK,CAA2B;EAG7DC,WAAWA,CAACtB,KAAa,EAAE;IACzB,KAAK,EAAE;IAACH,eAAA;IAER,IAAI,CAACG,KAAK,GAAGA,KAAK;EACpB;;EAEA;AACF;AACA;EACE,IAAIuB,GAAGA,CAAA,EAAW;IAChB,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAsB;IAC5B,OAAO;MACLxB,KAAK,EAAE,IAAI,CAACA,KAAK;MACjByB,IAAI,EAAEC,oBAAa,CAACN,SAAS;MAC7BO,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF;AAACC,OAAA,CAAAR,SAAA,GAAAA,SAAA"}
@@ -6,7 +6,7 @@ export declare const ERROR_MESSAGES: {
6
6
  Initialization: () => string;
7
7
  StorageInitialization: () => string;
8
8
  EventSourceInitialization: () => string;
9
- DataInconsistency: () => string;
9
+ VariationNotFound: () => string;
10
10
  FeatureFlagConfigurationNotFound: (featureKey: string, visitorCode: string) => string;
11
11
  ExperimentConfigurationNotFound: (experimentId: number, visitorCode: string) => string;
12
12
  NotTargeted: (visitorCode: string) => string;
@@ -1,25 +1,29 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.ERROR_MESSAGES = void 0;
4
- const types_1 = require("./types");
5
- exports.ERROR_MESSAGES = {
6
- [types_1.KameleoonException.JSONParse]: (err) => `Couldn't parse JSON variable: ${err}`,
7
- [types_1.KameleoonException.NumberParse]: (value) => `It's not possible to parse value ${value} to Number`,
8
- [types_1.KameleoonException.Initialization]: () => "It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods",
9
- [types_1.KameleoonException.StorageInitialization]: () => "There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed",
10
- [types_1.KameleoonException.EventSourceInitialization]: () => "There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed",
11
- [types_1.KameleoonException.DataInconsistency]: () => "Variation was found in the storage, but the server data doesn't contain corresponding variation, try to reload the client",
12
- [types_1.KameleoonException.FeatureFlagConfigurationNotFound]: (featureKey, visitorCode) => `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,
13
- [types_1.KameleoonException.ExperimentConfigurationNotFound]: (experimentId, visitorCode) => `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,
14
- [types_1.KameleoonException.NotTargeted]: (visitorCode) => `Visitor code ${visitorCode} is not targeted`,
15
- [types_1.KameleoonException.NotAllocated]: (visitorCode) => `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,
16
- [types_1.KameleoonException.VisitorCodeMaxLength]: () => 'Visitor code can not be more than 255 characters long',
17
- [types_1.KameleoonException.StorageWrite]: (err) => `Couldn't update storage for kameleoonClient: ${err}`,
18
- [types_1.KameleoonException.StorageRead]: (key) => `No data found in storage under ${key} key`,
19
- [types_1.KameleoonException.StorageParse]: (err, key) => `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,
20
- [types_1.KameleoonException.ClientConfiguration]: () => "Couldn't retrieve client configuration from Kameleoon Api",
21
- [types_1.KameleoonException.TargetingCondition]: (targetingType) => `${targetingType} targeting condition is not yet supported.`,
22
- [types_1.KameleoonException.AmongValuesCheck]: (err, value) => `Couldn't parse value "${value}": ${err}`,
23
- [types_1.KameleoonException.RemoteData]: () => `Couldn't retrieve data from Kameleoon server`,
7
+ var _types = require("./types");
8
+ const ERROR_MESSAGES = {
9
+ [_types.KameleoonException.JSONParse]: err => `Couldn't parse JSON variable: ${err}`,
10
+ [_types.KameleoonException.NumberParse]: value => `It's not possible to parse value ${value} to Number`,
11
+ [_types.KameleoonException.Initialization]: () => "It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods",
12
+ [_types.KameleoonException.StorageInitialization]: () => "There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed",
13
+ [_types.KameleoonException.EventSourceInitialization]: () => "There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed",
14
+ [_types.KameleoonException.VariationNotFound]: () => "Couldn't find experiment variation",
15
+ [_types.KameleoonException.FeatureFlagConfigurationNotFound]: (featureKey, visitorCode) => `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,
16
+ [_types.KameleoonException.ExperimentConfigurationNotFound]: (experimentId, visitorCode) => `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,
17
+ [_types.KameleoonException.NotTargeted]: visitorCode => `Visitor code ${visitorCode} is not targeted`,
18
+ [_types.KameleoonException.NotAllocated]: visitorCode => `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,
19
+ [_types.KameleoonException.VisitorCodeMaxLength]: () => 'Visitor code can not be more than 255 characters long',
20
+ [_types.KameleoonException.StorageWrite]: err => `Couldn't update storage for kameleoonClient: ${err}`,
21
+ [_types.KameleoonException.StorageRead]: key => `No data found in storage under ${key} key`,
22
+ [_types.KameleoonException.StorageParse]: (err, key) => `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,
23
+ [_types.KameleoonException.ClientConfiguration]: () => "Couldn't retrieve client configuration from Kameleoon Api",
24
+ [_types.KameleoonException.TargetingCondition]: targetingType => `${targetingType} targeting condition is not yet supported.`,
25
+ [_types.KameleoonException.AmongValuesCheck]: (err, value) => `Couldn't parse value "${value}": ${err}`,
26
+ [_types.KameleoonException.RemoteData]: () => `Couldn't retrieve data from Kameleoon server`
24
27
  };
28
+ exports.ERROR_MESSAGES = ERROR_MESSAGES;
25
29
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/kameleoonError/constants.ts"],"names":[],"mappings":";;;AAEA,mCAA6C;AAEhC,QAAA,cAAc,GAAG;IAC5B,CAAC,0BAAkB,CAAC,SAAS,CAAC,EAAE,CAAC,GAAY,EAAE,EAAE,CAC/C,iCAAiC,GAAG,EAAE;IACxC,CAAC,0BAAkB,CAAC,WAAW,CAAC,EAAE,CAAC,KAAa,EAAE,EAAE,CAClD,oCAAoC,KAAK,YAAY;IACvD,CAAC,0BAAkB,CAAC,cAAc,CAAC,EAAE,GAAG,EAAE,CACxC,0HAA0H;IAC5H,CAAC,0BAAkB,CAAC,qBAAqB,CAAC,EAAE,GAAG,EAAE,CAC/C,+HAA+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E,KAAa,EAAE,EAAE,CACrE,yBAAyB,KAAK,MAAM,GAAG,EAAE;IAC3C,CAAC,0BAAkB,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CACpC,8CAA8C;CACjD,CAAC"}
1
+ {"version":3,"file":"constants.js","names":["_types","require","ERROR_MESSAGES","KameleoonException","JSONParse","err","NumberParse","value","Initialization","StorageInitialization","EventSourceInitialization","VariationNotFound","FeatureFlagConfigurationNotFound","featureKey","visitorCode","ExperimentConfigurationNotFound","experimentId","NotTargeted","NotAllocated","VisitorCodeMaxLength","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from '../storage';\nimport { TargetingType } from '../targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.JSONParse]: (err: unknown) =>\n `Couldn't parse JSON variable: ${err}`,\n [KameleoonException.NumberParse]: (value: string) =>\n `It's not possible to parse value ${value} to Number`,\n [KameleoonException.Initialization]: () =>\n \"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods\",\n [KameleoonException.StorageInitialization]: () =>\n \"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed\",\n [KameleoonException.EventSourceInitialization]: () =>\n \"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed\",\n [KameleoonException.VariationNotFound]: () =>\n \"Couldn't find experiment variation\",\n [KameleoonException.FeatureFlagConfigurationNotFound]: (\n featureKey: string,\n visitorCode: string,\n ) =>\n `No feature flag with key ${featureKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.ExperimentConfigurationNotFound]: (\n experimentId: number,\n visitorCode: string,\n ) =>\n `No experiment with id ${experimentId} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.NotAllocated]: (visitorCode: string) =>\n `Visitor with visitor code ${visitorCode} is in unallocated traffic, there is no variation id to be assigned to the visitor.`,\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.StorageWrite]: (err: unknown) =>\n `Couldn't update storage for kameleoonClient: ${err}`,\n [KameleoonException.StorageRead]: (key: KameleoonStorageKey) =>\n `No data found in storage under ${key} key`,\n [KameleoonException.StorageParse]: (err: unknown, key: KameleoonStorageKey) =>\n `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,\n [KameleoonException.ClientConfiguration]: () =>\n \"Couldn't retrieve client configuration from Kameleoon Api\",\n [KameleoonException.TargetingCondition]: (targetingType: TargetingType) =>\n `${targetingType} targeting condition is not yet supported.`,\n [KameleoonException.AmongValuesCheck]: (err: unknown, value: string) =>\n `Couldn't parse value \"${value}\": ${err}`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n};\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,cAAc,GAAG;EAC5B,CAACC,yBAAkB,CAACC,SAAS,GAAIC,GAAY,IAC1C,iCAAgCA,GAAI,EAAC;EACxC,CAACF,yBAAkB,CAACG,WAAW,GAAIC,KAAa,IAC7C,oCAAmCA,KAAM,YAAW;EACvD,CAACJ,yBAAkB,CAACK,cAAc,GAAG,MACnC,0HAA0H;EAC5H,CAACL,yBAAkB,CAACM,qBAAqB,GAAG,MAC1C,+HAA+H;EACjI,CAACN,yBAAkB,CAACO,yBAAyB,GAAG,MAC9C,oIAAoI;EACtI,CAACP,yBAAkB,CAACQ,iBAAiB,GAAG,MACtC,oCAAoC;EACtC,CAACR,yBAAkB,CAACS,gCAAgC,GAAG,CACrDC,UAAkB,EAClBC,WAAmB,KAElB,4BAA2BD,UAAW,kBAAiBC,WAAY,eAAc;EACpF,CAACX,yBAAkB,CAACY,+BAA+B,GAAG,CACpDC,YAAoB,EACpBF,WAAmB,KAElB,yBAAwBE,YAAa,kBAAiBF,WAAY,eAAc;EACnF,CAACX,yBAAkB,CAACc,WAAW,GAAIH,WAAmB,IACnD,gBAAeA,WAAY,kBAAiB;EAC/C,CAACX,yBAAkB,CAACe,YAAY,GAAIJ,WAAmB,IACpD,6BAA4BA,WAAY,qFAAoF;EAC/H,CAACX,yBAAkB,CAACgB,oBAAoB,GAAG,MACzC,uDAAuD;EACzD,CAAChB,yBAAkB,CAACiB,YAAY,GAAIf,GAAY,IAC7C,gDAA+CA,GAAI,EAAC;EACvD,CAACF,yBAAkB,CAACkB,WAAW,GAAIC,GAAwB,IACxD,kCAAiCA,GAAI,MAAK;EAC7C,CAACnB,yBAAkB,CAACoB,YAAY,GAAG,CAAClB,GAAY,EAAEiB,GAAwB,KACvE,kBAAiBA,GAAI,oDAAmDjB,GAAI,EAAC;EAChF,CAACF,yBAAkB,CAACqB,mBAAmB,GAAG,MACxC,2DAA2D;EAC7D,CAACrB,yBAAkB,CAACsB,kBAAkB,GAAIC,aAA4B,IACnE,GAAEA,aAAc,4CAA2C;EAC9D,CAACvB,yBAAkB,CAACwB,gBAAgB,GAAG,CAACtB,GAAY,EAAEE,KAAa,KAChE,yBAAwBA,KAAM,MAAKF,GAAI,EAAC;EAC3C,CAACF,yBAAkB,CAACyB,UAAU,GAAG,MAC9B;AACL,CAAC;AAACC,OAAA,CAAA3B,cAAA,GAAAA,cAAA"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exhaustCheck = void 0;
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.exhaustCheck = exhaustCheck;
4
7
  function exhaustCheck(option) {
5
- throw new Error(`Reaching an impossible state because of ${option}`);
8
+ throw new Error(`Reaching an impossible state because of ${option}`);
6
9
  }
7
- exports.exhaustCheck = exhaustCheck;
8
10
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/kameleoonError/helpers.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,MAAa;IACxC,MAAM,IAAI,KAAK,CAAC,2CAA2C,MAAM,EAAE,CAAC,CAAC;AACvE,CAAC;AAFD,oCAEC"}
1
+ {"version":3,"file":"helpers.js","names":["exhaustCheck","option","Error"],"sources":["../../src/kameleoonError/helpers.ts"],"sourcesContent":["export function exhaustCheck(option: never): never {\n throw new Error(`Reaching an impossible state because of ${option}`);\n}\n"],"mappings":";;;;;;AAAO,SAASA,YAAYA,CAACC,MAAa,EAAS;EACjD,MAAM,IAAIC,KAAK,CAAE,2CAA0CD,MAAO,EAAC,CAAC;AACtE"}