@kameleoon/javascript-sdk-core 3.0.0 → 3.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 (71) hide show
  1. package/dist/clientConfiguration/clientConfiguration.d.ts +4 -1
  2. package/dist/clientConfiguration/clientConfiguration.js +1 -1
  3. package/dist/clientConfiguration/clientConfiguration.js.map +1 -1
  4. package/dist/clientConfiguration/constants.js +1 -1
  5. package/dist/clientConfiguration/constants.js.map +1 -1
  6. package/dist/clientConfiguration/index.d.ts +1 -1
  7. package/dist/clientConfiguration/index.js +1 -1
  8. package/dist/clientConfiguration/index.js.map +1 -1
  9. package/dist/clientConfiguration/types.d.ts +12 -4
  10. package/dist/clientConfiguration/types.js +1 -1
  11. package/dist/clientConfiguration/types.js.map +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/constants.js.map +1 -1
  14. package/dist/cookieManager/cookieManager.d.ts +16 -0
  15. package/dist/cookieManager/cookieManager.js +2 -0
  16. package/dist/cookieManager/cookieManager.js.map +1 -0
  17. package/dist/cookieManager/index.d.ts +1 -0
  18. package/dist/cookieManager/index.js +2 -0
  19. package/dist/cookieManager/index.js.map +1 -0
  20. package/dist/index.d.ts +4 -3
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/kameleoonClient.d.ts +32 -1
  24. package/dist/kameleoonClient.js +1 -1
  25. package/dist/kameleoonClient.js.map +1 -1
  26. package/dist/kameleoonData/dataManager.d.ts +2 -1
  27. package/dist/kameleoonData/dataManager.js +1 -1
  28. package/dist/kameleoonData/dataManager.js.map +1 -1
  29. package/dist/kameleoonData/pageView.js +1 -1
  30. package/dist/kameleoonData/pageView.js.map +1 -1
  31. package/dist/kameleoonError/constants.d.ts +1 -0
  32. package/dist/kameleoonError/constants.js +1 -1
  33. package/dist/kameleoonError/constants.js.map +1 -1
  34. package/dist/kameleoonError/kameleoonError.d.ts +2 -1
  35. package/dist/kameleoonError/kameleoonError.js +1 -1
  36. package/dist/kameleoonError/kameleoonError.js.map +1 -1
  37. package/dist/kameleoonError/types.d.ts +1 -0
  38. package/dist/kameleoonError/types.js +1 -1
  39. package/dist/kameleoonError/types.js.map +1 -1
  40. package/dist/kameleoonUtils.d.ts +0 -6
  41. package/dist/kameleoonUtils.js +1 -1
  42. package/dist/kameleoonUtils.js.map +1 -1
  43. package/dist/requester/constants.d.ts +3 -2
  44. package/dist/requester/constants.js +1 -1
  45. package/dist/requester/constants.js.map +1 -1
  46. package/dist/requester/index.d.ts +2 -2
  47. package/dist/requester/index.js +1 -1
  48. package/dist/requester/index.js.map +1 -1
  49. package/dist/requester/requester.d.ts +5 -5
  50. package/dist/requester/requester.js +1 -1
  51. package/dist/requester/requester.js.map +1 -1
  52. package/dist/requester/types.d.ts +8 -6
  53. package/dist/requester/types.js +1 -1
  54. package/dist/requester/types.js.map +1 -1
  55. package/dist/storage/constants.d.ts +2 -1
  56. package/dist/storage/constants.js +1 -1
  57. package/dist/storage/constants.js.map +1 -1
  58. package/dist/storage/types.d.ts +10 -1
  59. package/dist/storage/types.js.map +1 -1
  60. package/dist/types.d.ts +46 -14
  61. package/dist/types.js.map +1 -1
  62. package/dist/utilities/types.d.ts +12 -2
  63. package/dist/utilities/types.js.map +1 -1
  64. package/dist/utilities/utilities.d.ts +10 -4
  65. package/dist/utilities/utilities.js +1 -1
  66. package/dist/utilities/utilities.js.map +1 -1
  67. package/dist/variationConfiguration/types.d.ts +1 -0
  68. package/dist/variationConfiguration/types.js.map +1 -1
  69. package/dist/variationConfiguration/variationConfiguration.js +1 -1
  70. package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
  71. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageView=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var PageView=function(){function a(b){var c=b.urlAddress,d=b.title,e=b.referrers;_classCallCheck(this,a),_defineProperty(this,"urlAddress",void 0),_defineProperty(this,"title",void 0),_defineProperty(this,"referrers",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"timestampList",[]),this.urlAddress=c,this.title=d,this.referrers=e,this.sent=!1}return _createClass(a,[{key:"url",get:function get(){var a;if(!this.urlAddress)return"";var b=this.title?_requester.UrlParameter.Title+encodeURIComponent(this.title):"",c=null!==(a=this.referrers)&&void 0!==a&&a.length?_requester.UrlParameter.ReferrersIndices+JSON.stringify(this.referrers):"";return _requester.UrlEventType.Page+_requester.UrlParameter.Href+encodeURIComponent(this.urlAddress)+b+c}},{key:"data",get:function get(){return{urlAddress:this.urlAddress,title:this.title,referrers:this.referrers,type:_types2.KameleoonData.PageView,sent:this.sent,timestamps:this.timestampList}}},{key:"isSent",get:function get(){return this.sent},set:function set(a){this.sent=a}},{key:"timestamps",get:function get(){return this.timestampList},set:function set(a){var b=this;this.timestampList.length?a.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:b.timestampList,element:a,order:_types.Order.Ascending})}):this.timestampList=a}}],[{key:"_listFromVisits",value:function _listFromVisits(b){for(var c,d=[],e=new Map,f=b.length-1;0<=f;f--)if(c=b[f],!!c.pageEvents){var g,h=c.pageEvents,j=_createForOfIteratorHelper(h);try{for(j.s();!(g=j.n()).done;){var k=g.value,l=[],m=k.time,n=k.data,o=n.href,p=n.title,q=n.referrersIndices;"number"==typeof q[0]&&(l=q);var r=void 0;if(e.has(o)){var s=e.get(o).timestamps;r=new a({urlAddress:o,title:p,referrers:l}),r.timestamps=[].concat(_toConsumableArray(s),[m])}else r=new a({urlAddress:o,title:p,referrers:l}),r.timestamps=[m];e.set(o,r)}}catch(a){j.e(a)}finally{j.f()}}return e.forEach(function(a){a.isSent=!0,d.push(a)}),d}}]),a}();exports.PageView=PageView;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageView=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var PageView=function(){function a(b){var c=b.urlAddress,d=b.title,e=b.referrers;_classCallCheck(this,a),_defineProperty(this,"urlAddress",void 0),_defineProperty(this,"title",void 0),_defineProperty(this,"referrers",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"timestampList",[]),this.urlAddress=c,this.title=d,this.referrers=e,this.sent=!1}return _createClass(a,[{key:"url",get:function get(){var a;if(!this.urlAddress)return"";var b=this.title?_requester.UrlParameter.Title+encodeURIComponent(this.title):"",c=null!==(a=this.referrers)&&void 0!==a&&a.length?_requester.UrlParameter.ReferrersIndices+JSON.stringify(this.referrers):"";return _requester.UrlEventType.Page+_requester.UrlParameter.Href+encodeURIComponent(this.urlAddress)+b+c}},{key:"data",get:function get(){return{urlAddress:this.urlAddress,title:this.title,referrers:this.referrers,type:_types2.KameleoonData.PageView,sent:this.sent,timestamps:this.timestampList}}},{key:"isSent",get:function get(){return this.sent},set:function set(a){this.sent=a}},{key:"timestamps",get:function get(){return this.timestampList},set:function set(a){var b=this,c=new Set(a);this.timestampList.length?c.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:b.timestampList,element:a,order:_types.Order.Ascending})}):this.timestampList=_toConsumableArray(c)}}],[{key:"_listFromVisits",value:function _listFromVisits(b){for(var c,d=[],e=new Map,f=b.length-1;0<=f;f--)if(c=b[f],!!c.pageEvents){var g,h=c.pageEvents,j=_createForOfIteratorHelper(h);try{for(j.s();!(g=j.n()).done;){var k=g.value,l=[],m=k.time,n=k.data,o=n.href,p=n.title,q=n.referrersIndices;"number"==typeof q[0]&&(l=q);var r=void 0;if(e.has(o)){var s=e.get(o).timestamps;r=new a({urlAddress:o,title:p,referrers:l}),r.timestamps=[].concat(_toConsumableArray(s),[m])}else r=new a({urlAddress:o,title:p,referrers:l}),r.timestamps=[m];e.set(o,r)}}catch(a){j.e(a)}finally{j.f()}}return e.forEach(function(a){a.isSent=!0,d.push(a)}),d}}]),a}();exports.PageView=PageView;
2
2
  //# sourceMappingURL=pageView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageView.js","names":["PageView","a","b","urlAddress","title","referrers","_classCallCheck","_defineProperty","sent","_createClass","key","get","titleParameter","UrlParameter","Title","encodeURIComponent","referrersParameter","length","ReferrersIndices","JSON","stringify","UrlEventType","Page","Href","type","KameleoonData","timestamps","timestampList","set","value","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","_listFromVisits","visits","visit","resultData","pageViewMap","Map","i","pageEvents","g","j","_createForOfIteratorHelper","s","n","done","pageEvent","time","data","href","referrersIndices","pageView","has","existingTimestamps","concat","_toConsumableArray","e","f","isSent","push","exports"],"sources":["../../src/kameleoonData/pageView.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\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 implements IKameleoonData {\n private urlAddress: string;\n private title: string;\n private referrers?: number[];\n private sent: boolean;\n // --- Note ---\n // Ascending order\n private timestampList: number[] = [];\n\n /**\n * @param {PageViewParametersType} pageViewParameters - an object with page view parameters\n * */\n constructor({ urlAddress, title, referrers }: PageViewParametersType) {\n this.urlAddress = urlAddress;\n this.title = title;\n this.referrers = referrers;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.urlAddress) {\n return '';\n }\n\n const titleParameter = this.title\n ? UrlParameter.Title + encodeURIComponent(this.title)\n : '';\n\n const referrersParameter = this.referrers?.length\n ? UrlParameter.ReferrersIndices + JSON.stringify(this.referrers)\n : '';\n\n return (\n UrlEventType.Page +\n UrlParameter.Href +\n encodeURIComponent(this.urlAddress) +\n titleParameter +\n referrersParameter\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 sent: this.sent,\n timestamps: this.timestampList,\n };\n }\n\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @property timestamps - a list of timestamps for the current data type\n * */\n get timestamps(): number[] {\n return this.timestampList;\n }\n\n set timestamps(value: number[]) {\n if (this.timestampList.length) {\n // --- Note ---\n // We want to keep the list in ascending order\n value.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: this.timestampList,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n } else {\n this.timestampList = value;\n }\n }\n\n /**\n * @private\n * @method _listFromVisits - an internal method for creating a list of page view data from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {PageView[]} a list of PageView instances\n * */\n public static _listFromVisits(visits: VisitType[]): PageView[] {\n const resultData: PageView[] = [];\n const pageViewMap = new Map<string, PageView>();\n\n // --- Note ---\n // Going backwards to get the latest visit data\n for (let i = visits.length - 1; i >= 0; i--) {\n const visit = visits[i];\n\n if (!visit.pageEvents) {\n continue;\n }\n\n const pageEvents = visit.pageEvents;\n\n for (const pageEvent of pageEvents) {\n let referrers: number[] = [];\n\n const { time } = pageEvent;\n const { href, title, referrersIndices } = pageEvent.data;\n\n if (typeof referrersIndices[0] === 'number') {\n referrers = referrersIndices as number[];\n }\n\n let pageView: PageView;\n\n if (pageViewMap.has(href)) {\n const existingTimestamps = pageViewMap.get(href)!.timestamps;\n\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [...existingTimestamps, time];\n } else {\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [time];\n }\n\n pageViewMap.set(href, pageView);\n }\n }\n\n pageViewMap.forEach((value) => {\n // --- Note ---\n // We don't want to track collected pages again\n value.isSent = true;\n resultData.push(value);\n });\n\n return resultData;\n }\n}\n"],"mappings":"knGAca,CAAAA,QAAQ,YAYnB,SAAAC,EAAAC,CAAA,CAAsE,IAAxD,CAAAC,CAAU,CAAAD,CAAA,CAAVC,UAAU,CAAEC,CAAK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C,CAAC,CAEKa,CACT,CAAC,IAAAzC,CAAA,IAAAkE,OAAA,CAAAnE,QAAA,CAAAA,QAAA"}
1
+ {"version":3,"file":"pageView.js","names":["PageView","a","b","urlAddress","title","referrers","_classCallCheck","_defineProperty","sent","_createClass","key","get","titleParameter","UrlParameter","Title","encodeURIComponent","referrersParameter","length","ReferrersIndices","JSON","stringify","UrlEventType","Page","Href","type","KameleoonData","timestamps","timestampList","set","value","uniqueValues","Set","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","_toConsumableArray","_listFromVisits","visits","visit","resultData","pageViewMap","Map","i","pageEvents","g","j","_createForOfIteratorHelper","s","n","done","pageEvent","time","data","href","referrersIndices","pageView","has","existingTimestamps","concat","e","f","isSent","push","exports"],"sources":["../../src/kameleoonData/pageView.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\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 implements IKameleoonData {\n private urlAddress: string;\n private title: string;\n private referrers?: number[];\n private sent: boolean;\n // --- Note ---\n // Ascending order\n private timestampList: number[] = [];\n\n /**\n * @param {PageViewParametersType} pageViewParameters - an object with page view parameters\n * */\n constructor({ urlAddress, title, referrers }: PageViewParametersType) {\n this.urlAddress = urlAddress;\n this.title = title;\n this.referrers = referrers;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.urlAddress) {\n return '';\n }\n\n const titleParameter = this.title\n ? UrlParameter.Title + encodeURIComponent(this.title)\n : '';\n\n const referrersParameter = this.referrers?.length\n ? UrlParameter.ReferrersIndices + JSON.stringify(this.referrers)\n : '';\n\n return (\n UrlEventType.Page +\n UrlParameter.Href +\n encodeURIComponent(this.urlAddress) +\n titleParameter +\n referrersParameter\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 sent: this.sent,\n timestamps: this.timestampList,\n };\n }\n\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @property timestamps - a list of timestamps for the current data type\n * */\n get timestamps(): number[] {\n return this.timestampList;\n }\n\n set timestamps(value: number[]) {\n const uniqueValues = new Set<number>(value);\n\n if (this.timestampList.length) {\n // --- Note ---\n // We want to keep the list in ascending order\n uniqueValues.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: this.timestampList,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n } else {\n this.timestampList = [...uniqueValues];\n }\n }\n\n /**\n * @private\n * @method _listFromVisits - an internal method for creating a list of page view data from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {PageView[]} a list of PageView instances\n * */\n public static _listFromVisits(visits: VisitType[]): PageView[] {\n const resultData: PageView[] = [];\n const pageViewMap = new Map<string, PageView>();\n\n // --- Note ---\n // Going backwards to get the latest visit data\n for (let i = visits.length - 1; i >= 0; i--) {\n const visit = visits[i];\n\n if (!visit.pageEvents) {\n continue;\n }\n\n const pageEvents = visit.pageEvents;\n\n for (const pageEvent of pageEvents) {\n let referrers: number[] = [];\n\n const { time } = pageEvent;\n const { href, title, referrersIndices } = pageEvent.data;\n\n if (typeof referrersIndices[0] === 'number') {\n referrers = referrersIndices as number[];\n }\n\n let pageView: PageView;\n\n if (pageViewMap.has(href)) {\n const existingTimestamps = pageViewMap.get(href)!.timestamps;\n\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [...existingTimestamps, time];\n } else {\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [time];\n }\n\n pageViewMap.set(href, pageView);\n }\n }\n\n pageViewMap.forEach((value) => {\n // --- Note ---\n // We don't want to track collected pages again\n value.isSent = true;\n resultData.push(value);\n });\n\n return resultData;\n }\n}\n"],"mappings":"knGAca,CAAAA,QAAQ,YAYnB,SAAAC,EAAAC,CAAA,CAAsE,IAAxD,CAAAC,CAAU,CAAAD,CAAA,CAAVC,UAAU,CAAEC,CAAK,CAAAF,CAAA,CAALE,KAAK,CAAEC,CAAS,CAAAH,CAAA,CAATG,SAAS,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,2BAAAA,eAAA,sBAAAA,eAAA,0BAAAA,eAAA,qBAAAA,eAAA,sBALR,EAAE,EAMlC,IAAI,CAACJ,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACC,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,IAAI,GACX,CAAC,OAAAC,YAAA,CAAAR,CAAA,GAAAS,GAAA,OAAAC,GAAA,CAKD,SAAAA,IAAA,CAAkB,KAAAV,CAAA,CAIhB,GAAI,CAAC,IAAI,CAACE,UAAU,CAClB,MAAO,EAAE,CACV,GAEK,CAAAS,CAAc,CAAG,IAAI,CAACR,KAAK,CAC7BS,uBAAY,CAACC,KAAK,CAAGC,kBAAkB,CAAC,IAAI,CAACX,KAAK,CAAC,CACnD,EAAE,CAEAY,CAAkB,CAAG,QAAAf,CAAA,KAAI,CAACI,SAAS,YAAAJ,CAAA,EAAdA,CAAA,CAAgBgB,MAAM,CAC7CJ,uBAAY,CAACK,gBAAgB,CAAGC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACf,SAAS,CAAC,CAC9D,EAAE,CAEN,MACE,CAAAgB,uBAAY,CAACC,IAAI,CACjBT,uBAAY,CAACU,IAAI,CACjBR,kBAAkB,CAAC,IAAI,CAACZ,UAAU,CAAC,CACnCS,CAAc,CAC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AATA,CACF,CAAC,CAAC,CAEFwD,CAAQ,CAACnC,UAAU,CAAG,CAAC+B,CAAI,CAAC,CAG9BX,CAAW,CAAClB,GAAG,CAAC+B,CAAI,CAAEE,CAAQ,CAChC,CAAC,OAAA5D,CAAA,EAAAkD,CAAA,CAAAc,CAAA,CAAAhE,CAAA,UAAAkD,CAAA,CAAAe,CAAA,IAUH,MAPA,CAAApB,CAAW,CAACd,OAAO,CAAC,SAACH,CAAK,CAAK,CAG7BA,CAAK,CAACsC,MAAM,GAAO,CACnBtB,CAAU,CAACuB,IAAI,CAACvC,CAAK,CACvB,CAAC,CAAC,CAEKgB,CACT,CAAC,IAAA5C,CAAA,IAAAoE,OAAA,CAAArE,QAAA,CAAAA,QAAA"}
@@ -11,6 +11,7 @@ export declare const ERROR_MESSAGES: {
11
11
  StorageInitialization: () => string;
12
12
  EventSourceInitialization: () => string;
13
13
  FeatureFlagConfigurationNotFound: (featureKey: string) => string;
14
+ FeatureFlagEnvironmentDisabled: (featureKey: string, environment: string) => string;
14
15
  FeatureFlagVariableNotFound: (variableKey: string, visitorCode: string) => string;
15
16
  FeatureFlagVariationNotFound: (variationKey: string, visitorCode: string) => string;
16
17
  NotTargeted: (visitorCode: string) => string;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;var _ERROR_MESSAGES,_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ERROR_MESSAGES=(_ERROR_MESSAGES={},_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.JSONParse,function(a){return"Couldn't parse JSON variable: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NumberParse,function(a){return"It's not possible to parse value ".concat(a," to Number")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.SemanticVersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Initialization,function(){return"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageInitialization,function(){return"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.EventSourceInitialization,function(){return"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariableNotFound,function(a,b){return"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotTargeted,function(a){return"Visitor code ".concat(a," is not targeted")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeMaxLength,function(){return"Visitor code can not be more than 255 characters long"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeEmpty,function(){return"Visitor code can not be empty"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageWrite,function(a){return"Couldn't update storage for kameleoonClient: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageRead,function(a){return"No data found in storage under ".concat(a," key")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageParse,function(a,b){return"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ClientConfiguration,function(){return"Couldn't retrieve client configuration from Kameleoon Api"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.TargetingCondition,function(a){return"".concat(a," targeting condition is not yet supported.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.AmongValuesCheck,function(a,b){return"Couldn't parse value \"".concat(b,"\": ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.RemoteData,function(){return"Couldn't retrieve data from Kameleoon server"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.MaximumRetriesReached,function(){return"Maximum retries reached, request failed"}),_ERROR_MESSAGES);exports.ERROR_MESSAGES=ERROR_MESSAGES;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;var _ERROR_MESSAGES,_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ERROR_MESSAGES=(_ERROR_MESSAGES={},_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.JSONParse,function(a){return"Couldn't parse JSON variable: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NumberParse,function(a){return"It's not possible to parse value ".concat(a," to Number")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.SemanticVersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Initialization,function(){return"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageInitialization,function(){return"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.EventSourceInitialization,function(){return"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagEnvironmentDisabled,function(a,b){return"Environment of feature flag with key ".concat(a," is disabled in ").concat(b," environment.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariableNotFound,function(a,b){return"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotTargeted,function(a){return"Visitor code ".concat(a," is not targeted")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeMaxLength,function(){return"Visitor code can not be more than 255 characters long"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeEmpty,function(){return"Visitor code can not be empty"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageWrite,function(a){return"Couldn't update storage for kameleoonClient: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageRead,function(a){return"No data found in storage under ".concat(a," key")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageParse,function(a,b){return"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ClientConfiguration,function(){return"Couldn't retrieve client configuration from Kameleoon Api"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.TargetingCondition,function(a){return"".concat(a," targeting condition is not yet supported.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.AmongValuesCheck,function(a,b){return"Couldn't parse value \"".concat(b,"\": ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.RemoteData,function(){return"Couldn't retrieve data from Kameleoon server"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.MaximumRetriesReached,function(){return"Maximum retries reached, request failed"}),_ERROR_MESSAGES);exports.ERROR_MESSAGES=ERROR_MESSAGES;
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\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.VersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x`,\n [KameleoonException.SemanticVersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x.x`,\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.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\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.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\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 [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":"o7BAIO,GAAM,CAAAA,cAAc,EAAAC,eAAA,IAAAC,eAAA,CAAAD,eAAA,CACxBE,yBAAkB,CAACC,WAAW,CAAG,SAACC,CAAc,yCAAAC,MAAA,CACdD,CAAM,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACI,SAAS,CAAG,SAACC,CAA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perty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\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.VersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x`,\n [KameleoonException.SemanticVersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x.x`,\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.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\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.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagEnvironmentDisabled]: (\n featureKey: string,\n environment: string,\n ) =>\n `Environment of feature flag with key ${featureKey} is disabled in ${environment} environment.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\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 [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":"o7BAIO,GAAM,CAAAA,cAAc,EAAAC,eAAA,IAAAC,eAAA,CAAAD,eAAA,CACxBE,yBAAkB,CAACC,WAAW,CAAG,SAACC,CAAc,yCAAAC,MAAA,CACdD,CAAM,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACI,SAAS,CAAG,SAACC,CAAY,yCAAAF,MAAA,CACVE,CAAG,EAAE,EAAAN,eAAA,CAAAD,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CAC5C,CAACuC,OAAA,CAAAxC,cAAA,CAAAA,cAAA"}
@@ -11,7 +11,8 @@ export declare class KameleoonError extends Error {
11
11
  * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum
12
12
  * */
13
13
  constructor(type: KameleoonException.Initialization | KameleoonException.Credentials | KameleoonException.ClientConfiguration | KameleoonException.VisitorCodeMaxLength | KameleoonException.VisitorCodeEmpty | KameleoonException.VisitAmount | KameleoonException.StorageInitialization | KameleoonException.EventSourceInitialization | KameleoonException.RemoteData | KameleoonException.MaximumRetriesReached);
14
- constructor(type: KameleoonException.FeatureFlagConfigurationNotFound, featureKey: string);
14
+ constructor(type: KameleoonException.FeatureFlagConfigurationNotFound | KameleoonException.FeatureFlagEnvironmentDisabled, featureKey: string);
15
+ constructor(type: KameleoonException.FeatureFlagConfigurationNotFound | KameleoonException.FeatureFlagEnvironmentDisabled, featureKey: string, environment: string);
15
16
  constructor(type: KameleoonException.FeatureFlagVariableNotFound, variableKey: string, visitorCode: string);
16
17
  constructor(type: KameleoonException.FeatureFlagVariationNotFound, variationKey: string, visitorCode: string);
17
18
  constructor(type: KameleoonException.NotTargeted, visitorCode: string);
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonError=void 0;var _constants=require("./constants"),_helpers=require("./helpers"),_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _wrapNativeSuper(a){var b="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(a){function c(){return _construct(a,arguments,_getPrototypeOf(this).constructor)}if(null===a||!_isNativeFunction(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,a)},_wrapNativeSuper(a)}function _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _isNativeFunction(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonError=function(a){function b(a,d,e){var f;return _classCallCheck(this,b),f=c.call(this,"Error: ".concat(a)),_defineProperty(_assertThisInitialized(f),"errorType",void 0),f.name="KameleoonError",f.errorType=a,(a===_types.KameleoonException.Initialization||a===_types.KameleoonException.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached?f.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.NotTargeted?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.FeatureFlagConfigurationNotFound?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagVariableNotFound?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.StorageWrite||a===_types.KameleoonException.JSONParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageRead?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageParse?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.TargetingCondition?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.AmongValuesCheck?f.message=_constants.ERROR_MESSAGES[a](d,e):(0,_helpers.exhaustCheck)(a),f)}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"type",get:function get(){return this.errorType}}]),b}(_wrapNativeSuper(Error));exports.KameleoonError=KameleoonError;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonError=void 0;var _constants=require("./constants"),_helpers=require("./helpers"),_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),b&&_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){if(b&&("object"===_typeof(b)||"function"==typeof b))return b;if(void 0!==b)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _wrapNativeSuper(a){var b="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(a){function c(){return _construct(a,arguments,_getPrototypeOf(this).constructor)}if(null===a||!_isNativeFunction(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,a)},_wrapNativeSuper(a)}function _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _isNativeFunction(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonError=function(a){function b(a,d,e){var f;return _classCallCheck(this,b),f=c.call(this,"Error: ".concat(a)),_defineProperty(_assertThisInitialized(f),"errorType",void 0),f.name="KameleoonError",f.errorType=a,(a===_types.KameleoonException.Initialization||a===_types.KameleoonException.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached?f.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse||a===_types.KameleoonException.NotTargeted||a===_types.KameleoonException.FeatureFlagConfigurationNotFound||a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagEnvironmentDisabled||a===_types.KameleoonException.FeatureFlagVariableNotFound?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.StorageWrite||a===_types.KameleoonException.JSONParse?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageRead?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.StorageParse?f.message=_constants.ERROR_MESSAGES[a](d,e):a===_types.KameleoonException.TargetingCondition?f.message=_constants.ERROR_MESSAGES[a](d):a===_types.KameleoonException.AmongValuesCheck?f.message=_constants.ERROR_MESSAGES[a](d,e):(0,_helpers.exhaustCheck)(a),f)}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"type",get:function get(){return this.errorType}}]),b}(_wrapNativeSuper(Error));exports.KameleoonError=KameleoonError;
2
2
  //# sourceMappingURL=kameleoonError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonError.js","names":["KameleoonError","a","b","type","secondParam","thirdParam","f","_classCallCheck","c","call","concat","_defineProperty","_assertThisInitialized","name","errorType","KameleoonException","Initialization","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","FeatureFlagVariationNotFound","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","NumberParse","VersionParse","SemanticVersionParse","AmongValuesCheck","exhaustCheck","_inherits","_createSuper","_createClass","key","get","_wrapNativeSuper","Error","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { ERROR_MESSAGES } from './constants';\nimport { exhaustCheck } from './helpers';\nimport { KameleoonException } from './types';\n\n/**\n * @class\n * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`\n * */\nexport class KameleoonError extends Error {\n private errorType: KameleoonException;\n\n /**\n * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum\n * */\n constructor(\n type:\n | KameleoonException.Initialization\n | KameleoonException.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached,\n );\n constructor(\n type: KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\n constructor(\n type: KameleoonException.StorageWrite | KameleoonException.JSONParse,\n err: unknown,\n );\n constructor(type: KameleoonException.StorageRead, storageKey: string);\n constructor(\n type: KameleoonException.StorageParse,\n err: unknown,\n key: KameleoonStorageKey,\n );\n constructor(\n type: KameleoonException.TargetingCondition,\n targetingType: TargetingType,\n );\n constructor(\n type: KameleoonException.AmongValuesCheck,\n err: unknown,\n value: string,\n );\n constructor(\n type:\n | KameleoonException.NumberParse\n | KameleoonException.VersionParse\n | KameleoonException.SemanticVersionParse,\n value: string,\n );\n constructor(\n type: KameleoonException,\n secondParam?:\n | number\n | string\n | unknown\n | KameleoonStorageKey\n | TargetingType,\n thirdParam?: string | KameleoonStorageKey,\n ) {\n super(`Error: ${type}`);\n\n this.name = 'KameleoonError';\n this.errorType = type;\n\n switch (type) {\n case KameleoonException.Initialization:\n case KameleoonException.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.NotTargeted:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.FeatureFlagConfigurationNotFound:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagVariableNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as string,\n thirdParam as string,\n );\n break;\n case KameleoonException.StorageWrite:\n case KameleoonException.JSONParse:\n this.message = ERROR_MESSAGES[type](secondParam);\n break;\n case KameleoonException.StorageRead:\n this.message = ERROR_MESSAGES[type](secondParam as KameleoonStorageKey);\n break;\n case KameleoonException.StorageParse:\n this.message = ERROR_MESSAGES[type](\n secondParam,\n thirdParam as KameleoonStorageKey,\n );\n break;\n case KameleoonException.TargetingCondition:\n this.message = ERROR_MESSAGES[type](secondParam as TargetingType);\n break;\n case KameleoonException.NumberParse:\n case KameleoonException.VersionParse:\n case KameleoonException.SemanticVersionParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): KameleoonException {\n return this.errorType;\n }\n}\n"],"mappings":"4zHAUa,CAAAA,cAAc,UAAAC,CAAA,EA6DzB,SAAAC,EACEC,CAAwB,CACxBC,CAKiB,CACjBC,CAAyC,CACzC,KAAAC,CAAA,QAAAC,eAAA,MAAAL,CAAA,EAAAI,CAAA,CAAAE,CAAA,CAAAC,IAAA,gBAAAC,MAAA,CACgBP,CAAI,GAAAQ,eAAA,CAAAC,sBAAA,CAAAN,CAAA,sBAEpBA,CAAA,CAAKO,IAAI,CAAG,gBAAgB,CAC5BP,CAAA,CAAKQ,SAAS,CAAGX,CAAI,EAEbA,CAAI,GACLY,yBAAkB,CAACC,cAAc,EADhCb,CAAI,GAELY,yBAAkB,CAACE,WAAW,EAF7Bd,CAAI,GAGLY,yBAAkB,CAACG,mBAAmB,EAHrCf,CAAI,GAILY,yBAAkB,CAACI,oBAAoB,EAJtChB,CAAI,GAKLY,yBAAkB,CAACK,gBAAgB,EALlCjB,CAAI,GAMLY,yBAAkB,CAACM,qBAAqB,EANvClB,CAAI,GAOLY,yBAAkB,CAACO,WAAW,EAP7BnB,CAAI,GAQLY,yBAAkB,CAACQ,yBAAyB,EAR3CpB,CAAI,GASLY,yBAAkB,CAACS,UAAU,EAT5BrB,CAAI,GAULY,yBAAkB,CAACU,qBAAqB,CAC3CnB,CAAA,CAAKoB,OAAO,CAAGC,yBAAc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kB,CAACwB,YAAY,EA9C9BpC,CAAI,GA+CLY,yBAAkB,CAACyB,oBAAoB,CAC1ClC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAW,CAhDtDD,CAAI,GAkDLY,yBAAkB,CAAC0B,gBAAgB,CACtCnC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAEC,CAAU,CAAW,CAGtE,GAAAqC,qBAAY,EAACvC,CAAI,CAAC,CAAAG,CAAA,CAExB,CAACqC,SAAA,CAAAzC,CAAA,CAAAD,CAAA,MAAAO,CAAA,CAAAoC,YAAA,CAAA1C,CAAA,SAAA2C,YAAA,CAAA3C,CAAA,GAAA4C,GAAA,QAAAC,GAAA,CAED,SAAAA,IAAA,CAA+B,CAC7B,MAAO,KAAI,CAACjC,SACd,CAAC,IAAAZ,CAAA,EAAA8C,gBAAA,CAxIiCC,KAAK,GAAAC,OAAA,CAAAlD,cAAA,CAAAA,cAAA"}
1
+ {"version":3,"file":"kameleoonError.js","names":["KameleoonError","a","b","type","secondParam","thirdParam","f","_classCallCheck","c","call","concat","_defineProperty","_assertThisInitialized","name","errorType","KameleoonException","Initialization","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","NumberParse","VersionParse","SemanticVersionParse","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","AmongValuesCheck","exhaustCheck","_inherits","_createSuper","_createClass","key","get","_wrapNativeSuper","Error","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { ERROR_MESSAGES } from './constants';\nimport { exhaustCheck } from './helpers';\nimport { KameleoonException } from './types';\n\n/**\n * @class\n * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`\n * */\nexport class KameleoonError extends Error {\n private errorType: KameleoonException;\n\n /**\n * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum\n * */\n constructor(\n type:\n | KameleoonException.Initialization\n | KameleoonException.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n environment: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\n constructor(\n type: KameleoonException.StorageWrite | KameleoonException.JSONParse,\n err: unknown,\n );\n constructor(type: KameleoonException.StorageRead, storageKey: string);\n constructor(\n type: KameleoonException.StorageParse,\n err: unknown,\n key: KameleoonStorageKey,\n );\n constructor(\n type: KameleoonException.TargetingCondition,\n targetingType: TargetingType,\n );\n constructor(\n type: KameleoonException.AmongValuesCheck,\n err: unknown,\n value: string,\n );\n constructor(\n type:\n | KameleoonException.NumberParse\n | KameleoonException.VersionParse\n | KameleoonException.SemanticVersionParse,\n value: string,\n );\n constructor(\n type: KameleoonException,\n secondParam?:\n | number\n | string\n | unknown\n | KameleoonStorageKey\n | TargetingType,\n thirdParam?: string | KameleoonStorageKey,\n ) {\n super(`Error: ${type}`);\n\n this.name = 'KameleoonError';\n this.errorType = type;\n\n switch (type) {\n case KameleoonException.Initialization:\n case KameleoonException.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n case KameleoonException.NotTargeted:\n case KameleoonException.FeatureFlagConfigurationNotFound:\n case KameleoonException.NumberParse:\n case KameleoonException.VersionParse:\n case KameleoonException.SemanticVersionParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagEnvironmentDisabled:\n case KameleoonException.FeatureFlagVariableNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as string,\n thirdParam as string,\n );\n break;\n case KameleoonException.StorageWrite:\n case KameleoonException.JSONParse:\n this.message = ERROR_MESSAGES[type](secondParam);\n break;\n case KameleoonException.StorageRead:\n this.message = ERROR_MESSAGES[type](secondParam as KameleoonStorageKey);\n break;\n case KameleoonException.StorageParse:\n this.message = ERROR_MESSAGES[type](\n secondParam,\n thirdParam as KameleoonStorageKey,\n );\n break;\n case KameleoonException.TargetingCondition:\n this.message = ERROR_MESSAGES[type](secondParam as TargetingType);\n break;\n case KameleoonException.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): KameleoonException {\n return this.errorType;\n }\n}\n"],"mappings":"4zHAUa,CAAAA,cAAc,UAAAC,CAAA,EAsEzB,SAAAC,EACEC,CAAwB,CACxBC,CAKiB,CACjBC,CAAyC,CACzC,KAAAC,CAAA,QAAAC,eAAA,MAAAL,CAAA,EAAAI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,CAACxB,CAAI,CAAC,CACjCC,CAAW,CACXC,CAAU,CACX,CA3BGF,CAAI,GA6BLY,yBAAkB,CAACsB,YAAY,EA7B9BlC,CAAI,GA8BLY,yBAAkB,CAACuB,SAAS,CAC/BhC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAC,CA/B5CD,CAAI,GAiCLY,yBAAkB,CAACwB,WAAW,CACjCjC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAwB,CAlCnED,CAAI,GAoCLY,yBAAkB,CAACyB,YAAY,CAClClC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CACjCC,CAAW,CACXC,CAAU,CACX,CAxCGF,CAAI,GA0CLY,yBAAkB,CAAC0B,kBAAkB,CACxCnC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAkB,CA3C7DD,CAAI,GA6CLY,yBAAkB,CAAC2B,gBAAgB,CACtCpC,CAAA,CAAKoB,OAAO,CAAGC,yBAAc,CAACxB,CAAI,CAAC,CAACC,CAAW,CAAEC,CAAU,CAAW,CAGtE,GAAAsC,qBAAY,EAACxC,CAAI,CAAC,CAAAG,CAAA,CAExB,CAACsC,SAAA,CAAA1C,CAAA,CAAAD,CAAA,MAAAO,CAAA,CAAAqC,YAAA,CAAA3C,CAAA,SAAA4C,YAAA,CAAA5C,CAAA,GAAA6C,GAAA,QAAAC,GAAA,CAED,SAAAA,IAAA,CAA+B,CAC7B,MAAO,KAAI,CAAClC,SACd,CAAC,IAAAZ,CAAA,EAAA+C,gBAAA,CA5IiCC,KAAK,GAAAC,OAAA,CAAAnD,cAAA,CAAAA,cAAA"}
@@ -8,6 +8,7 @@ export declare enum KameleoonException {
8
8
  FeatureFlagConfigurationNotFound = "FeatureFlagConfigurationNotFound",
9
9
  FeatureFlagVariableNotFound = "FeatureFlagVariableNotFound",
10
10
  FeatureFlagVariationNotFound = "FeatureFlagVariationNotFound",
11
+ FeatureFlagEnvironmentDisabled = "FeatureFlagEnvironmentDisabled",
11
12
  NotTargeted = "NotTargeted",
12
13
  VisitAmount = "VisitAmount",
13
14
  VisitorCodeMaxLength = "VisitorCodeMaxLength",
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonException=void 0;var KameleoonException=function(a){return a.Credentials="Credentials",a.EventSourceInitialization="EventSourceInitialization",a.FeatureFlagConfigurationNotFound="FeatureFlagConfigurationNotFound",a.FeatureFlagVariableNotFound="FeatureFlagVariableNotFound",a.FeatureFlagVariationNotFound="FeatureFlagVariationNotFound",a.NotTargeted="NotTargeted",a.VisitAmount="VisitAmount",a.VisitorCodeMaxLength="VisitorCodeMaxLength",a.VisitorCodeEmpty="VisitorCodeEmpty",a.StorageInitialization="StorageInitialization",a.StorageWrite="StorageWrite",a.StorageRead="StorageRead",a.StorageParse="StorageParse",a.ClientConfiguration="ClientConfiguration",a.TargetingCondition="TargetingCondition",a.AmongValuesCheck="AmongValuesCheck",a.Initialization="Initialization",a.JSONParse="JSONParse",a.NumberParse="NumberParse",a.VersionParse="VersionParse",a.CookieParse="CookieParse",a.SemanticVersionParse="SemanticVersionParse",a.RemoteData="RemoteData",a.MaximumRetriesReached="MaximumRetriesReached",a}({});exports.KameleoonException=KameleoonException;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonException=void 0;var KameleoonException=function(a){return a.Credentials="Credentials",a.EventSourceInitialization="EventSourceInitialization",a.FeatureFlagConfigurationNotFound="FeatureFlagConfigurationNotFound",a.FeatureFlagVariableNotFound="FeatureFlagVariableNotFound",a.FeatureFlagVariationNotFound="FeatureFlagVariationNotFound",a.FeatureFlagEnvironmentDisabled="FeatureFlagEnvironmentDisabled",a.NotTargeted="NotTargeted",a.VisitAmount="VisitAmount",a.VisitorCodeMaxLength="VisitorCodeMaxLength",a.VisitorCodeEmpty="VisitorCodeEmpty",a.StorageInitialization="StorageInitialization",a.StorageWrite="StorageWrite",a.StorageRead="StorageRead",a.StorageParse="StorageParse",a.ClientConfiguration="ClientConfiguration",a.TargetingCondition="TargetingCondition",a.AmongValuesCheck="AmongValuesCheck",a.Initialization="Initialization",a.JSONParse="JSONParse",a.NumberParse="NumberParse",a.VersionParse="VersionParse",a.CookieParse="CookieParse",a.SemanticVersionParse="SemanticVersionParse",a.RemoteData="RemoteData",a.MaximumRetriesReached="MaximumRetriesReached",a}({});exports.KameleoonException=KameleoonException;
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["KameleoonException","Credentials","EventSourceInitialization","FeatureFlagConfigurationNotFound","FeatureFlagVariableNotFound","FeatureFlagVariationNotFound","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","StorageWrite","StorageRead","StorageParse","ClientConfiguration","TargetingCondition","AmongValuesCheck","Initialization","JSONParse","NumberParse","VersionParse","CookieParse","SemanticVersionParse","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of exception types `KameleoonError`\n * */\nexport enum KameleoonException {\n Credentials = 'Credentials',\n EventSourceInitialization = 'EventSourceInitialization',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n FeatureFlagVariationNotFound = 'FeatureFlagVariationNotFound',\n NotTargeted = 'NotTargeted',\n VisitAmount = 'VisitAmount',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n VisitorCodeEmpty = 'VisitorCodeEmpty',\n StorageInitialization = 'StorageInitialization',\n StorageWrite = 'StorageWrite',\n StorageRead = 'StorageRead',\n StorageParse = 'StorageParse',\n ClientConfiguration = 'ClientConfiguration',\n TargetingCondition = 'TargetingCondition',\n AmongValuesCheck = 'AmongValuesCheck',\n Initialization = 'Initialization',\n JSONParse = 'JSONParse',\n NumberParse = 'NumberParse',\n VersionParse = 'VersionParse',\n CookieParse = 'CookieParse',\n SemanticVersionParse = 'SemanticVersionParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\n}\n"],"mappings":"yGAIY,CAAAA,kBAAkB,UAAlBA,CAAkB,QAAlB,CAAAA,CAAkB,CAAAC,WAAA,eAAlBD,CAAkB,CAAAE,yBAAA,6BAAlBF,CAAkB,CAAAG,gCAAA,oCAAlBH,CAAkB,CAAAI,2BAAA,+BAAlBJ,CAAkB,CAAAK,4BAAA,gCAAlBL,CAAkB,CAAAM,WAAA,eAAlBN,CAAkB,CAAAO,WAAA,eAAlBP,CAAkB,CAAAQ,oBAAA,wBAAlBR,CAAkB,CAAAS,gBAAA,oBAAlBT,CAAkB,CAAAU,qBAAA,yBAAlBV,CAAkB,CAAAW,YAAA,gBAAlBX,CAAkB,CAAAY,WAAA,eAAlBZ,CAAkB,CAAAa,YAAA,gBAAlBb,CAAkB,CAAAc,mBAAA,uBAAlBd,CAAkB,CAAAe,kBAAA,sBAAlBf,CAAkB,CAAAgB,gBAAA,oBAAlBhB,CAAkB,CAAAiB,cAAA,kBAAlBjB,CAAkB,CAAAkB,SAAA,aAAlBlB,CAAkB,CAAAmB,WAAA,eAAlBnB,CAAkB,CAAAoB,YAAA,gBAAlBpB,CAAkB,CAAAqB,WAAA,eAAlBrB,CAAkB,CAAAsB,oBAAA,wBAAlBtB,CAAkB,CAAAuB,UAAA,cAAlBvB,CAAkB,CAAAwB,qBAAA,yBAAlBxB,CAAkB,MAAAyB,OAAA,CAAAzB,kBAAA,CAAAA,kBAAA"}
1
+ {"version":3,"file":"types.js","names":["KameleoonException","Credentials","EventSourceInitialization","FeatureFlagConfigurationNotFound","FeatureFlagVariableNotFound","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","StorageWrite","StorageRead","StorageParse","ClientConfiguration","TargetingCondition","AmongValuesCheck","Initialization","JSONParse","NumberParse","VersionParse","CookieParse","SemanticVersionParse","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/types.ts"],"sourcesContent":["/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of exception types `KameleoonError`\n * */\nexport enum KameleoonException {\n Credentials = 'Credentials',\n EventSourceInitialization = 'EventSourceInitialization',\n FeatureFlagConfigurationNotFound = 'FeatureFlagConfigurationNotFound',\n FeatureFlagVariableNotFound = 'FeatureFlagVariableNotFound',\n FeatureFlagVariationNotFound = 'FeatureFlagVariationNotFound',\n FeatureFlagEnvironmentDisabled = 'FeatureFlagEnvironmentDisabled',\n NotTargeted = 'NotTargeted',\n VisitAmount = 'VisitAmount',\n VisitorCodeMaxLength = 'VisitorCodeMaxLength',\n VisitorCodeEmpty = 'VisitorCodeEmpty',\n StorageInitialization = 'StorageInitialization',\n StorageWrite = 'StorageWrite',\n StorageRead = 'StorageRead',\n StorageParse = 'StorageParse',\n ClientConfiguration = 'ClientConfiguration',\n TargetingCondition = 'TargetingCondition',\n AmongValuesCheck = 'AmongValuesCheck',\n Initialization = 'Initialization',\n JSONParse = 'JSONParse',\n NumberParse = 'NumberParse',\n VersionParse = 'VersionParse',\n CookieParse = 'CookieParse',\n SemanticVersionParse = 'SemanticVersionParse',\n RemoteData = 'RemoteData',\n MaximumRetriesReached = 'MaximumRetriesReached',\n}\n"],"mappings":"yGAIY,CAAAA,kBAAkB,UAAlBA,CAAkB,QAAlB,CAAAA,CAAkB,CAAAC,WAAA,eAAlBD,CAAkB,CAAAE,yBAAA,6BAAlBF,CAAkB,CAAAG,gCAAA,oCAAlBH,CAAkB,CAAAI,2BAAA,+BAAlBJ,CAAkB,CAAAK,4BAAA,gCAAlBL,CAAkB,CAAAM,8BAAA,kCAAlBN,CAAkB,CAAAO,WAAA,eAAlBP,CAAkB,CAAAQ,WAAA,eAAlBR,CAAkB,CAAAS,oBAAA,wBAAlBT,CAAkB,CAAAU,gBAAA,oBAAlBV,CAAkB,CAAAW,qBAAA,yBAAlBX,CAAkB,CAAAY,YAAA,gBAAlBZ,CAAkB,CAAAa,WAAA,eAAlBb,CAAkB,CAAAc,YAAA,gBAAlBd,CAAkB,CAAAe,mBAAA,uBAAlBf,CAAkB,CAAAgB,kBAAA,sBAAlBhB,CAAkB,CAAAiB,gBAAA,oBAAlBjB,CAAkB,CAAAkB,cAAA,kBAAlBlB,CAAkB,CAAAmB,SAAA,aAAlBnB,CAAkB,CAAAoB,WAAA,eAAlBpB,CAAkB,CAAAqB,YAAA,gBAAlBrB,CAAkB,CAAAsB,WAAA,eAAlBtB,CAAkB,CAAAuB,oBAAA,wBAAlBvB,CAAkB,CAAAwB,UAAA,cAAlBxB,CAAkB,CAAAyB,qBAAA,yBAAlBzB,CAAkB,MAAA0B,OAAA,CAAA1B,kBAAA,CAAAA,kBAAA"}
@@ -1,13 +1,7 @@
1
- import { Result } from 'ts-res';
2
- import { GetResultCookieParametersType, ClientGetVisitorCodeParametersType, ServerGetVisitorCodeParametersType, MobileGetVisitorCodeParametersType } from './types';
3
1
  /**
4
2
  * @abstract
5
3
  * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures
6
4
  * */
7
5
  export declare abstract class KameleoonUtils {
8
- abstract getVisitorCode(param: ClientGetVisitorCodeParametersType | ServerGetVisitorCodeParametersType | MobileGetVisitorCodeParametersType): string;
9
- protected generateRandomString(length: number): string;
10
- protected getCookieVisitorCode(cookie: string): Result<string, void>;
11
- protected getResultCookie({ domain, visitorCode, }: GetResultCookieParametersType): string;
12
6
  protected getClientConfigurationUrl(siteCode: string): string;
13
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonUtils=void 0;var _tsRes=require("ts-res"),_requester=require("./requester"),_constants=require("./constants");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonUtils=function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"generateRandomString",value:function generateRandomString(a){var b="";if(0>a)return b;for(var c=0;c<a;c++)b+="abcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(36*Math.random())];return b}},{key:"getCookieVisitorCode",value:function getCookieVisitorCode(a){var b=a.split(_constants.CookieParameter.PairsDelimiter),c=b.find(function(a){var b=a.split(_constants.CookieParameter.KeyValueDelimiter),c=_slicedToArray(b,2),d=c[0],e=c[1];return d===_constants.KAMELEOON_COOKIE_KEY});if(c){var d=c.split(_constants.CookieParameter.KeyValueDelimiter),e=_slicedToArray(d,2),f=e[0],g=e[1];return(0,_tsRes.Ok)(g)}return(0,_tsRes.Err)()}},{key:"getResultCookie",value:function getResultCookie(a){var b=a.domain,c=a.visitorCode,d=[_constants.KAMELEOON_COOKIE_KEY+_constants.CookieParameter.KeyValueDelimiter+c,_constants.CookieParameter.MaxAge+_constants.CookieParameter.KeyValueDelimiter+31536000,_constants.CookieParameter.Path+_constants.CookieParameter.KeyValueDelimiter+"/",_constants.CookieParameter.Domain+_constants.CookieParameter.KeyValueDelimiter+b];return d.join(_constants.CookieParameter.PairsDelimiter)}},{key:"getClientConfigurationUrl",value:function getClientConfigurationUrl(a){return _requester.URL.CLIENT_CONFIGURATION+_requester.UrlQuery.Mobile+a}}]),a}();exports.KameleoonUtils=KameleoonUtils;
1
+ "use strict";var _requester=require("./requester");Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonUtils=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonUtils=function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"getClientConfigurationUrl",value:function getClientConfigurationUrl(a){return(0,_requester.getClientConfigurationUrl)(a)}}]),a}();exports.KameleoonUtils=KameleoonUtils;
2
2
  //# sourceMappingURL=kameleoonUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonUtils.js","names":["KameleoonUtils","a","_classCallCheck","_createClass","key","value","generateRandomString","length","randomString","i","Math","floor","random","getCookieVisitorCode","cookie","pairs","split","Cookie","PairsDelimiter","pair","find","b","KeyValueDelimiter","c","_slicedToArray","_","KAMELEOON_COOKIE_KEY","d","e","Ok","Err","getResultCookie","domain","visitorCode","cookieArray","MaxAge","Path","Domain","join","getClientConfigurationUrl","siteCode","URL","CLIENT_CONFIGURATION","UrlQuery","Mobile","exports"],"sources":["../src/kameleoonUtils.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { URL, UrlQuery } from './requester';\nimport { CookieParameter as Cookie, KAMELEOON_COOKIE_KEY } from './constants';\nimport {\n GetResultCookieParametersType,\n ClientGetVisitorCodeParametersType,\n ServerGetVisitorCodeParametersType,\n MobileGetVisitorCodeParametersType,\n} from './types';\n\n/**\n * @abstract\n * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures\n * */\nexport abstract class KameleoonUtils {\n abstract getVisitorCode(\n param:\n | ClientGetVisitorCodeParametersType\n | ServerGetVisitorCodeParametersType\n | MobileGetVisitorCodeParametersType,\n ): string;\n\n protected generateRandomString(length: number): string {\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';\n let randomString = '';\n\n if (length < 0) {\n return randomString;\n }\n\n for (let i = 0; i < length; i++) {\n randomString += characters[Math.floor(Math.random() * characters.length)];\n }\n\n return randomString;\n }\n\n protected getCookieVisitorCode(cookie: string): Result<string, void> {\n const pairs = cookie.split(Cookie.PairsDelimiter);\n const pair = pairs.find((pair) => {\n const [key, _] = pair.split(Cookie.KeyValueDelimiter) as [string, string];\n\n return key === KAMELEOON_COOKIE_KEY;\n });\n\n if (pair) {\n const [_, value] = pair.split(Cookie.KeyValueDelimiter);\n\n return Ok(value);\n }\n\n return Err();\n }\n\n protected getResultCookie({\n domain,\n visitorCode,\n }: GetResultCookieParametersType): string {\n const yearSeconds = 60 * 60 * 24 * 365;\n const cookieArray = [\n KAMELEOON_COOKIE_KEY + Cookie.KeyValueDelimiter + visitorCode,\n Cookie.MaxAge + Cookie.KeyValueDelimiter + yearSeconds,\n Cookie.Path + Cookie.KeyValueDelimiter + '/',\n Cookie.Domain + Cookie.KeyValueDelimiter + domain,\n ];\n\n return cookieArray.join(Cookie.PairsDelimiter);\n }\n\n protected getClientConfigurationUrl(siteCode: string): string {\n return URL.CLIENT_CONFIGURATION + UrlQuery.Mobile + siteCode;\n }\n}\n"],"mappings":"kgFAcsB,CAAAA,cAAc,qBAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,SAAAE,YAAA,CAAAF,CAAA,GAAAG,GAAA,wBAAAC,KAAA,CAQlC,SAAAC,qBAA+BC,CAAc,CAAU,IAEjD,CAAAC,CAAY,CAAG,EAAE,CAErB,GAAa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BAAM,CAACkB,MAAM,CAAGlB,0BAAM,CAACK,iBAAiB,SAAc,CACtDL,0BAAM,CAACmB,IAAI,CAAGnB,0BAAM,CAACK,iBAAiB,CAAG,GAAG,CAC5CL,0BAAM,CAACoB,MAAM,CAAGpB,0BAAM,CAACK,iBAAiB,CAAGU,CAAM,CAClD,CAED,MAAO,CAAAE,CAAW,CAACI,IAAI,CAACrB,0BAAM,CAACC,cAAc,CAC/C,CAAC,GAAAd,GAAA,6BAAAC,KAAA,CAED,SAAAkC,0BAAoCC,CAAgB,CAAU,CAC5D,MAAO,CAAAC,cAAG,CAACC,oBAAoB,CAAGC,mBAAQ,CAACC,MAAM,CAAGJ,CACtD,CAAC,IAAAvC,CAAA,IAAA4C,OAAA,CAAA7C,cAAA,CAAAA,cAAA"}
1
+ {"version":3,"file":"kameleoonUtils.js","names":["_requester","require","Object","defineProperty","exports","value","KameleoonUtils","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","getClientConfigurationUrl","siteCode"],"sources":["../src/kameleoonUtils.ts"],"sourcesContent":["import { getClientConfigurationUrl } from './requester';\n\n/**\n * @abstract\n * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures\n * */\nexport abstract class KameleoonUtils {\n protected getClientConfigurationUrl(siteCode: string): string {\n return getClientConfigurationUrl(siteCode);\n }\n}\n"],"mappings":"aAAA,IAAAA,UAAA,CAAAC,OAAA,gBAAwDC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,cAAA,iBAAAC,QAAAC,CAAA,mCAAAD,OAAA,oBAAAE,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAF,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAC,MAAA,EAAAD,CAAA,CAAAG,WAAA,GAAAF,MAAA,EAAAD,CA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AA,EAAAK,eAAA,MAAAL,CAAA,SAAAiB,YAAA,CAAAjB,CAAA,GAAAgB,GAAA,6BAAAnB,KAAA,CAClC,SAAA0B,0BAAoCC,CAAgB,CAAU,CAC5D,MAAO,GAAAD,oCAAyB,EAACC,CAAQ,CAC3C,CAAC,IAAAxB,CAAA,IAAAJ,OAAA,CAAAE,cAAA,CAAAA,cAAA"}
@@ -1,4 +1,4 @@
1
- import { EventType, ParameterType, QueryType, StrictEventTypeRecord, StrictParameterRecord, StrictQueryRecord, StrictTrackingRecord, TrackingType } from './types';
1
+ import { EventType, ParameterType, QueryType, StrictEventTypeRecord, StrictFirstParameterRecord, StrictParameterRecord, StrictQueryRecord, StrictTrackingRecord, TrackingType } from './types';
2
2
  export declare enum Header {
3
3
  UserAgent = "User-Agent",
4
4
  ContentType = "Content-Type",
@@ -7,12 +7,13 @@ export declare enum Header {
7
7
  }
8
8
  export declare const UrlEventType: StrictEventTypeRecord<EventType>;
9
9
  export declare const UrlParameter: StrictParameterRecord<ParameterType>;
10
+ export declare const UrlFirstParameter: StrictFirstParameterRecord<ParameterType>;
10
11
  export declare const UrlQuery: StrictQueryRecord<QueryType>;
11
12
  export declare const UrlTracking: StrictTrackingRecord<TrackingType>;
12
13
  export declare const URL: {
13
14
  SERVER_SENT_EVENTS: string;
14
- CLIENT_CONFIGURATION: string;
15
15
  VISIT_EVENT: string;
16
16
  VISIT_DATA: string;
17
17
  DATA_MAP: string;
18
18
  };
19
+ export declare function getClientConfigurationUrl(siteCode: string): string;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlTracking=exports.UrlQuery=exports.UrlParameter=exports.UrlEventType=exports.URL=exports.Header=void 0;var Header=function(a){return a.UserAgent="User-Agent",a.ContentType="Content-Type",a.Authorization="Authorization",a.AcceptEncoding="Accept-Encoding",a}({});exports.Header=Header;var topLevelDomain="com",dataTopLevelDomain="io",UrlEventType={CustomData:"eventType=customData",StaticData:"eventType=staticData",Page:"eventType=page",Conversion:"eventType=conversion",Activity:"eventType=activity",Experiment:"eventType=experiment",Geolocation:"eventType=geolocation"};exports.UrlEventType=UrlEventType;var UrlParameter={Title:"&title=",ReferrersIndices:"&referrersIndices=",Negative:"&negative=",Revenue:"&revenue=",Overwrite:"&overwrite=",Index:"&index=",BrowserIndex:"&browserIndex=",BrowserVersion:"&browserVersion=",Href:"&href=",DeviceType:"&deviceType=",SiteCode:"&siteCode=",GoalId:"&goalId=",VisitorCode:"&visitorCode=",Environment:"&environment=",VariationId:"&variationId=",Ts:"&ts=",Key:"&key=",SdkName:"&sdkName=",SdkVersion:"&sdkVersion=",ValuesCountMap:"&valuesCountMap=",Nonce:"&nonce=",Id:"&id=",CustomData:"&customData=",CurrentVisit:"&currentVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"&region=",Latitude:"&latitude=",Longitude:"&longitude=",PostalCode:"&postalCode=",Conversion:"&conversion=",StaticData:"&staticData=",Geolocation:"&geolocation=",Page:"&page=",Experiment:"&experiment=",Browser:"&browser="};exports.UrlParameter=UrlParameter;var UrlQuery={Sse:"sse?siteCode=",Mobile:"mobile?siteCode=",Map:"map?siteCode=",Events:"events?siteCode=",Visitor:"visitor?siteCode="};exports.UrlQuery=UrlQuery;var UrlTracking={Visit:"visit/",Map:"map/"};exports.UrlTracking=UrlTracking;var URL_DATA_API="https://data.kameleoon.".concat(dataTopLevelDomain),URL={SERVER_SENT_EVENTS:"https://events.kameleoon.".concat("com",":8110/"),CLIENT_CONFIGURATION:"https://client-config.kameleoon.".concat("com","/"),VISIT_EVENT:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Events),VISIT_DATA:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Visitor),DATA_MAP:"".concat(URL_DATA_API,"/").concat(UrlTracking.Map+UrlQuery.Map)};exports.URL=URL;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlTracking=exports.UrlQuery=exports.UrlParameter=exports.UrlFirstParameter=exports.UrlEventType=exports.URL=exports.Header=void 0,exports.getClientConfigurationUrl=getClientConfigurationUrl;var Header=function(a){return a.UserAgent="User-Agent",a.ContentType="Content-Type",a.Authorization="Authorization",a.AcceptEncoding="Accept-Encoding",a}({});exports.Header=Header;var UrlEventType={CustomData:"eventType=customData",StaticData:"eventType=staticData",Page:"eventType=page",Conversion:"eventType=conversion",Activity:"eventType=activity",Experiment:"eventType=experiment",Geolocation:"eventType=geolocation"};exports.UrlEventType=UrlEventType;var UrlParameter={Title:"&title=",ReferrersIndices:"&referrersIndices=",Negative:"&negative=",Revenue:"&revenue=",Overwrite:"&overwrite=",Index:"&index=",BrowserIndex:"&browserIndex=",BrowserVersion:"&browserVersion=",Href:"&href=",DeviceType:"&deviceType=",SiteCode:"&siteCode=",GoalId:"&goalId=",VisitorCode:"&visitorCode=",VariationId:"&variationId=",Ts:"&ts=",Key:"&key=",SdkName:"&sdkName=",SdkVersion:"&sdkVersion=",ValuesCountMap:"&valuesCountMap=",Nonce:"&nonce=",Id:"&id=",CustomData:"&customData=",CurrentVisit:"&currentVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"&region=",Latitude:"&latitude=",Longitude:"&longitude=",PostalCode:"&postalCode=",Conversion:"&conversion=",StaticData:"&staticData=",Geolocation:"&geolocation=",Page:"&page=",Experiment:"&experiment=",Browser:"&browser=",Environment:"&environment="};exports.UrlParameter=UrlParameter;var UrlFirstParameter={CustomData:"?customData=",StaticData:"?staticData=",Page:"?page=",Conversion:"?conversion=",Geolocation:"?geolocation=",Experiment:"?experiment=",ValuesCountMap:"?valuesCountMap=",Id:"?id=",Nonce:"?nonce=",Country:"?country=",Environment:"?environment=",City:"?city=",Region:"?region=",Latitude:"?latitude=",Longitude:"?longitude=",PostalCode:"?postalCode=",SdkName:"?sdkName=",SdkVersion:"?sdkVersion=",BrowserIndex:"?browserIndex=",BrowserVersion:"?browserVersion=",SiteCode:"?siteCode=",VisitorCode:"?visitorCode=",CurrentVisit:"?currentVisit=",MaxNumberPreviousVisits:"?maxNumberPreviousVisits=",Negative:"?negative=",Revenue:"?revenue=",Title:"?title=",Os:"?os=",OsIndex:"?osIndex=",Browser:"?browser=",ReferrersIndices:"?referrersIndices=",Overwrite:"?overwrite=",Index:"?index=",Href:"?href=",VariationId:"?variationId=",DeviceType:"?deviceType=",GoalId:"?goalId=",Ts:"?ts=",Key:"?key="};exports.UrlFirstParameter=UrlFirstParameter;var UrlQuery={Sse:"sse?siteCode=",Map:"map?siteCode=",Events:"events?siteCode=",Visitor:"visitor?siteCode="};exports.UrlQuery=UrlQuery;var UrlTracking={Visit:"visit/",Map:"map/"};exports.UrlTracking=UrlTracking;var topLevelDomain="io",URL_DATA_API="https://data.kameleoon.".concat("io"),URL={SERVER_SENT_EVENTS:"https://events.kameleoon.com:8110/",VISIT_EVENT:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Events),VISIT_DATA:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Visitor),DATA_MAP:"".concat(URL_DATA_API,"/").concat(UrlTracking.Map+UrlQuery.Map)};exports.URL=URL;function getClientConfigurationUrl(a){return"https://".concat(a,".kameleoon.eu/sdk-config")}
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["Header","UserAgent","ContentType","Authorization","AcceptEncoding","exports","topLevelDomain","dataTopLevelDomain","UrlEventType","CustomData","StaticData","Page","Conversion","Activity","Experiment","Geolocation","UrlParameter","Title","ReferrersIndices","Negative","Revenue","Overwrite","Index","BrowserIndex","BrowserVersion","Href","DeviceType","SiteCode","GoalId","VisitorCode","Environment","VariationId","Ts","Key","SdkName","SdkVersion","ValuesCountMap","Nonce","Id","CurrentVisit","MaxNumberPreviousVisits","Os","OsIndex","Country","City","Region","Latitude","Longitude","PostalCode","Browser","UrlQuery","Sse","Mobile","Map","Events","Visitor","UrlTracking","Visit","URL_DATA_API","concat","URL","SERVER_SENT_EVENTS","CLIENT_CONFIGURATION","VISIT_EVENT","VISIT_DATA","DATA_MAP"],"sources":["../../src/requester/constants.ts"],"sourcesContent":["import {\n EventType,\n ParameterType,\n QueryType,\n StrictEventTypeRecord,\n StrictParameterRecord,\n StrictQueryRecord,\n StrictTrackingRecord,\n TrackingType,\n} from './types';\n\nexport enum Header {\n UserAgent = 'User-Agent',\n ContentType = 'Content-Type',\n Authorization = 'Authorization',\n AcceptEncoding = 'Accept-Encoding',\n}\n\nconst topLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'com';\nconst dataTopLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'io';\n\nexport const UrlEventType: StrictEventTypeRecord<EventType> = {\n CustomData: 'eventType=customData',\n StaticData: 'eventType=staticData',\n Page: 'eventType=page',\n Conversion: 'eventType=conversion',\n Activity: 'eventType=activity',\n Experiment: 'eventType=experiment',\n Geolocation: 'eventType=geolocation',\n};\nexport const UrlParameter: StrictParameterRecord<ParameterType> = {\n Title: '&title=',\n ReferrersIndices: '&referrersIndices=',\n Negative: '&negative=',\n Revenue: '&revenue=',\n Overwrite: '&overwrite=',\n Index: '&index=',\n BrowserIndex: '&browserIndex=',\n BrowserVersion: '&browserVersion=',\n Href: '&href=',\n DeviceType: '&deviceType=',\n SiteCode: '&siteCode=',\n GoalId: '&goalId=',\n VisitorCode: '&visitorCode=',\n Environment: '&environment=',\n VariationId: '&variationId=',\n Ts: '&ts=',\n Key: '&key=',\n SdkName: '&sdkName=',\n SdkVersion: '&sdkVersion=',\n ValuesCountMap: '&valuesCountMap=',\n Nonce: '&nonce=',\n Id: '&id=',\n CustomData: '&customData=',\n CurrentVisit: '&currentVisit=',\n MaxNumberPreviousVisits: '&maxNumberPreviousVisits=',\n Os: '&os=',\n OsIndex: '&osIndex=',\n Country: '&country=',\n City: '&city=',\n Region: '&region=',\n Latitude: '&latitude=',\n Longitude: '&longitude=',\n PostalCode: '&postalCode=',\n Conversion: '&conversion=',\n StaticData: '&staticData=',\n Geolocation: '&geolocation=',\n Page: '&page=',\n Experiment: '&experiment=',\n Browser: '&browser=',\n};\nexport const UrlQuery: StrictQueryRecord<QueryType> = {\n Sse: 'sse?siteCode=',\n Mobile: 'mobile?siteCode=',\n Map: 'map?siteCode=',\n Events: 'events?siteCode=',\n Visitor: 'visitor?siteCode=',\n};\nexport const UrlTracking: StrictTrackingRecord<TrackingType> = {\n Visit: 'visit/',\n Map: 'map/',\n};\n\nconst URL_DATA_API = `https://data.kameleoon.${dataTopLevelDomain}`;\n\nexport const URL = {\n SERVER_SENT_EVENTS: `https://events.kameleoon.${topLevelDomain}:8110/`,\n CLIENT_CONFIGURATION: `https://client-config.kameleoon.${topLevelDomain}/`,\n VISIT_EVENT: `${URL_DATA_API}/${UrlTracking.Visit + UrlQuery.Events}`,\n VISIT_DATA: `${URL_DATA_API}/${UrlTracking.Visit + UrlQuery.Visitor}`,\n DATA_MAP: `${URL_DATA_API}/${UrlTracking.Map + UrlQuery.Map}`,\n};\n"],"mappings":"wLAWY,CAAAA,MAAM,UAANA,CAAM,QAAN,CAAAA,CAAM,CAAAC,SAAA,cAAND,CAAM,CAAAE,WAAA,gBAANF,CAAM,CAAAG,aAAA,iBAANH,CAAM,CAAAI,cAAA,mBAANJ,CAAM,MAAAK,OAAA,CAAAL,MAAA,CAAAA,MAAA,IAOZ,CAAAM,cAAc,CAA6C,KAAK,CAChEC,kBAAkB,CAA6C,IAAI,CAE5DC,YAA8C,CAAG,CAC5DC,UAAU,CAAE,sBAAsB,CAClCC,UAAU,CAAE,sBAAsB,CAClCC,IAAI,CAAE,gBAAgB,CACtBC,UAAU,CAAE,sBAAsB,CAClCC,QAAQ,CAAE,oBAAoB,CAC9BC,UAAU,CAAE,sBAAsB,CAClCC,WAAW,CAAE,uBACf,CAAC,CAAAV,OAAA,CA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,eAAe,CACpBC,MAAM,CAAE,kBAAkB,CAC1BC,OAAO,CAAE,mBACX,CAAC,CAAClD,OAAA,CAAA6C,QAAA,CAAAA,QAAA,CACK,GAAM,CAAAM,WAA+C,CAAG,CAC7DC,KAAK,CAAE,QAAQ,CACfJ,GAAG,CAAE,MACP,CAAC,CAAChD,OAAA,CAAAmD,WAAA,CAAAA,WAAA,IAEI,CAAAE,YAAY,2BAAAC,MAAA,CAA6BpD,kBAAkB,CAAE,CAEtDqD,GAAG,CAAG,CACjBC,kBAAkB,6BAAAF,MAAA,gBAAoD,CACtEG,oBAAoB,oCAAAH,MAAA,WAAsD,CAC1EI,WAAW,IAAAJ,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIH,WAAW,CAACC,KAAK,CAAGP,QAAQ,CAACI,MAAM,CAAE,CACrEU,UAAU,IAAAL,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIH,WAAW,CAACC,KAAK,CAAGP,QAAQ,CAACK,OAAO,CAAE,CACrEU,QAAQ,IAAAN,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIH,WAAW,CAACH,GAAG,CAAGH,QAAQ,CAACG,GAAG,CAC7D,CAAC,CAAAhD,OAAA,CAAAuD,GAAA,CAAAA,GAAA"}
1
+ {"version":3,"file":"constants.js","names":["Header","UserAgent","ContentType","Authorization","AcceptEncoding","exports","UrlEventType","CustomData","StaticData","Page","Conversion","Activity","Experiment","Geolocation","UrlParameter","Title","ReferrersIndices","Negative","Revenue","Overwrite","Index","BrowserIndex","BrowserVersion","Href","DeviceType","SiteCode","GoalId","VisitorCode","VariationId","Ts","Key","SdkName","SdkVersion","ValuesCountMap","Nonce","Id","CurrentVisit","MaxNumberPreviousVisits","Os","OsIndex","Country","City","Region","Latitude","Longitude","PostalCode","Browser","Environment","UrlFirstParameter","UrlQuery","Sse","Map","Events","Visitor","UrlTracking","Visit","topLevelDomain","URL_DATA_API","concat","URL","SERVER_SENT_EVENTS","VISIT_EVENT","VISIT_DATA","DATA_MAP","getClientConfigurationUrl","siteCode"],"sources":["../../src/requester/constants.ts"],"sourcesContent":["import {\n EventType,\n ParameterType,\n QueryType,\n StrictEventTypeRecord,\n StrictFirstParameterRecord,\n StrictParameterRecord,\n StrictQueryRecord,\n StrictTrackingRecord,\n TrackingType,\n} from './types';\n\nexport enum Header {\n UserAgent = 'User-Agent',\n ContentType = 'Content-Type',\n Authorization = 'Authorization',\n AcceptEncoding = 'Accept-Encoding',\n}\n\nexport const UrlEventType: StrictEventTypeRecord<EventType> = {\n CustomData: 'eventType=customData',\n StaticData: 'eventType=staticData',\n Page: 'eventType=page',\n Conversion: 'eventType=conversion',\n Activity: 'eventType=activity',\n Experiment: 'eventType=experiment',\n Geolocation: 'eventType=geolocation',\n};\nexport const UrlParameter: StrictParameterRecord<ParameterType> = {\n Title: '&title=',\n ReferrersIndices: '&referrersIndices=',\n Negative: '&negative=',\n Revenue: '&revenue=',\n Overwrite: '&overwrite=',\n Index: '&index=',\n BrowserIndex: '&browserIndex=',\n BrowserVersion: '&browserVersion=',\n Href: '&href=',\n DeviceType: '&deviceType=',\n SiteCode: '&siteCode=',\n GoalId: '&goalId=',\n VisitorCode: '&visitorCode=',\n VariationId: '&variationId=',\n Ts: '&ts=',\n Key: '&key=',\n SdkName: '&sdkName=',\n SdkVersion: '&sdkVersion=',\n ValuesCountMap: '&valuesCountMap=',\n Nonce: '&nonce=',\n Id: '&id=',\n CustomData: '&customData=',\n CurrentVisit: '&currentVisit=',\n MaxNumberPreviousVisits: '&maxNumberPreviousVisits=',\n Os: '&os=',\n OsIndex: '&osIndex=',\n Country: '&country=',\n City: '&city=',\n Region: '&region=',\n Latitude: '&latitude=',\n Longitude: '&longitude=',\n PostalCode: '&postalCode=',\n Conversion: '&conversion=',\n StaticData: '&staticData=',\n Geolocation: '&geolocation=',\n Page: '&page=',\n Experiment: '&experiment=',\n Browser: '&browser=',\n Environment: '&environment=',\n};\nexport const UrlFirstParameter: StrictFirstParameterRecord<ParameterType> = {\n CustomData: '?customData=',\n StaticData: '?staticData=',\n Page: '?page=',\n Conversion: '?conversion=',\n Geolocation: '?geolocation=',\n Experiment: '?experiment=',\n ValuesCountMap: '?valuesCountMap=',\n Id: '?id=',\n Nonce: '?nonce=',\n Country: '?country=',\n Environment: '?environment=',\n City: '?city=',\n Region: '?region=',\n Latitude: '?latitude=',\n Longitude: '?longitude=',\n PostalCode: '?postalCode=',\n SdkName: '?sdkName=',\n SdkVersion: '?sdkVersion=',\n BrowserIndex: '?browserIndex=',\n BrowserVersion: '?browserVersion=',\n SiteCode: '?siteCode=',\n VisitorCode: '?visitorCode=',\n CurrentVisit: '?currentVisit=',\n MaxNumberPreviousVisits: '?maxNumberPreviousVisits=',\n Negative: '?negative=',\n Revenue: '?revenue=',\n Title: '?title=',\n Os: '?os=',\n OsIndex: '?osIndex=',\n Browser: '?browser=',\n ReferrersIndices: '?referrersIndices=',\n Overwrite: '?overwrite=',\n Index: '?index=',\n Href: '?href=',\n VariationId: '?variationId=',\n DeviceType: '?deviceType=',\n GoalId: '?goalId=',\n Ts: '?ts=',\n Key: '?key=',\n};\nexport const UrlQuery: StrictQueryRecord<QueryType> = {\n Sse: 'sse?siteCode=',\n Map: 'map?siteCode=',\n Events: 'events?siteCode=',\n Visitor: 'visitor?siteCode=',\n};\nexport const UrlTracking: StrictTrackingRecord<TrackingType> = {\n Visit: 'visit/',\n Map: 'map/',\n};\n\nconst topLevelDomain = process.env.NODE_ENV === 'test' ? 'net' : 'io';\n\nconst URL_DATA_API = `https://data.kameleoon.${topLevelDomain}`;\n\nexport const URL = {\n SERVER_SENT_EVENTS: 'https://events.kameleoon.com:8110/',\n VISIT_EVENT: `${URL_DATA_API}/${UrlTracking.Visit + UrlQuery.Events}`,\n VISIT_DATA: `${URL_DATA_API}/${UrlTracking.Visit + UrlQuery.Visitor}`,\n DATA_MAP: `${URL_DATA_API}/${UrlTracking.Map + UrlQuery.Map}`,\n};\n\nexport function getClientConfigurationUrl(siteCode: string): string {\n return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lQuery, UrlEventType, UrlParameter, Header } from './constants';
3
- export { HttpMethod, VisitType, TrackParametersType, StaticDataEventType, TrackExperimentParamsType, TrackDataParamsType, IExternalRequestDispatcher, GetVisitorDataResultType, GetClientConfigurationResultType, } from './types';
2
+ export { URL, UrlQuery, UrlEventType, UrlParameter, Header, getClientConfigurationUrl, } from './constants';
3
+ export { HttpMethod, VisitType, TrackParametersType, StaticDataEventType, TrackExperimentParamsType, TrackDataParamsType, IExternalRequestDispatcher, GetVisitorDataResultType, } from './types';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GetClientConfigurationResultType",{enumerable:!0,get:function get(){return _types.GetClientConfigurationResultType}}),Object.defineProperty(exports,"GetVisitorDataResultType",{enumerable:!0,get:function get(){return _types.GetVisitorDataResultType}}),Object.defineProperty(exports,"Header",{enumerable:!0,get:function get(){return _constants.Header}}),Object.defineProperty(exports,"HttpMethod",{enumerable:!0,get:function get(){return _types.HttpMethod}}),Object.defineProperty(exports,"IExternalRequestDispatcher",{enumerable:!0,get:function get(){return _types.IExternalRequestDispatcher}}),Object.defineProperty(exports,"Requester",{enumerable:!0,get:function get(){return _requester.Requester}}),Object.defineProperty(exports,"StaticDataEventType",{enumerable:!0,get:function get(){return _types.StaticDataEventType}}),Object.defineProperty(exports,"TrackDataParamsType",{enumerable:!0,get:function get(){return _types.TrackDataParamsType}}),Object.defineProperty(exports,"TrackExperimentParamsType",{enumerable:!0,get:function get(){return _types.TrackExperimentParamsType}}),Object.defineProperty(exports,"TrackParametersType",{enumerable:!0,get:function get(){return _types.TrackParametersType}}),Object.defineProperty(exports,"URL",{enumerable:!0,get:function get(){return _constants.URL}}),Object.defineProperty(exports,"UrlEventType",{enumerable:!0,get:function get(){return _constants.UrlEventType}}),Object.defineProperty(exports,"UrlParameter",{enumerable:!0,get:function get(){return _constants.UrlParameter}}),Object.defineProperty(exports,"UrlQuery",{enumerable:!0,get:function get(){return _constants.UrlQuery}}),Object.defineProperty(exports,"VisitType",{enumerable:!0,get:function get(){return _types.VisitType}});var _requester=require("./requester"),_constants=require("./constants"),_types=require("./types");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GetVisitorDataResultType",{enumerable:!0,get:function get(){return _types.GetVisitorDataResultType}}),Object.defineProperty(exports,"Header",{enumerable:!0,get:function get(){return _constants.Header}}),Object.defineProperty(exports,"HttpMethod",{enumerable:!0,get:function get(){return _types.HttpMethod}}),Object.defineProperty(exports,"IExternalRequestDispatcher",{enumerable:!0,get:function get(){return _types.IExternalRequestDispatcher}}),Object.defineProperty(exports,"Requester",{enumerable:!0,get:function get(){return _requester.Requester}}),Object.defineProperty(exports,"StaticDataEventType",{enumerable:!0,get:function get(){return _types.StaticDataEventType}}),Object.defineProperty(exports,"TrackDataParamsType",{enumerable:!0,get:function get(){return _types.TrackDataParamsType}}),Object.defineProperty(exports,"TrackExperimentParamsType",{enumerable:!0,get:function get(){return _types.TrackExperimentParamsType}}),Object.defineProperty(exports,"TrackParametersType",{enumerable:!0,get:function get(){return _types.TrackParametersType}}),Object.defineProperty(exports,"URL",{enumerable:!0,get:function get(){return _constants.URL}}),Object.defineProperty(exports,"UrlEventType",{enumerable:!0,get:function get(){return _constants.UrlEventType}}),Object.defineProperty(exports,"UrlParameter",{enumerable:!0,get:function get(){return _constants.UrlParameter}}),Object.defineProperty(exports,"UrlQuery",{enumerable:!0,get:function get(){return _constants.UrlQuery}}),Object.defineProperty(exports,"VisitType",{enumerable:!0,get:function get(){return _types.VisitType}}),Object.defineProperty(exports,"getClientConfigurationUrl",{enumerable:!0,get:function get(){return _constants.getClientConfigurationUrl}});var _requester=require("./requester"),_constants=require("./constants"),_types=require("./types");
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/requester/index.ts"],"sourcesContent":["export { Requester } from './requester';\nexport { URL, UrlQuery, UrlEventType, UrlParameter, Header } from './constants';\nexport {\n HttpMethod,\n VisitType,\n TrackParametersType,\n StaticDataEventType,\n TrackExperimentParamsType,\n TrackDataParamsType,\n IExternalRequestDispatcher,\n GetVisitorDataResultType,\n GetClientConfigurationResultType,\n} from './types';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/requester/index.ts"],"sourcesContent":["export { Requester } from './requester';\nexport {\n URL,\n UrlQuery,\n UrlEventType,\n UrlParameter,\n Header,\n getClientConfigurationUrl,\n} from './constants';\nexport {\n HttpMethod,\n VisitType,\n TrackParametersType,\n StaticDataEventType,\n TrackExperimentParamsType,\n TrackDataParamsType,\n IExternalRequestDispatcher,\n GetVisitorDataResultType,\n} from './types';\n"],"mappings":""}
@@ -1,10 +1,10 @@
1
1
  import { Result } from 'ts-res';
2
2
  import { KameleoonError } from '../kameleoonError';
3
- import { JSONType } from '../clientConfiguration';
3
+ import { ConfigurationDataType, JSONType } from '../clientConfiguration';
4
4
  import { VisitorDataFiltersType } from '../utilities';
5
- import { GetClientConfigurationResultType, RequesterParamsType, TrackDataParamsType, GetVisitorDataResultType, TrackExperimentParamsType } from './types';
5
+ import { RequesterParamsType, TrackDataParamsType, GetVisitorDataResultType, TrackExperimentParamsType } from './types';
6
6
  export interface IRequester {
7
- getClientConfiguration: () => Promise<Result<GetClientConfigurationResultType, KameleoonError>>;
7
+ getClientConfiguration: () => Promise<Result<ConfigurationDataType, KameleoonError>>;
8
8
  getRemoteData: (key: string) => Promise<Result<JSONType, KameleoonError>>;
9
9
  trackData: ({ visitorCode, body, }: TrackDataParamsType) => Promise<Result<boolean, KameleoonError>>;
10
10
  trackExperiment: ({ variationId, visitorCode, experimentId, isUnallocated, body, }: TrackExperimentParamsType) => Promise<Result<boolean, KameleoonError>>;
@@ -15,10 +15,10 @@ export declare class Requester implements IRequester {
15
15
  private requestDispatcher;
16
16
  private packageInfo;
17
17
  constructor({ siteCode, environment, packageInfo, requestDispatcher, }: RequesterParamsType);
18
- getClientConfiguration(timeStamp?: number): Promise<Result<GetClientConfigurationResultType, KameleoonError>>;
18
+ getClientConfiguration(timeStamp?: number): Promise<Result<ConfigurationDataType, KameleoonError>>;
19
19
  getRemoteData(key: string): Promise<Result<JSONType, KameleoonError>>;
20
20
  getVisitorData(visitorCode: string, filters: VisitorDataFiltersType): Promise<Result<GetVisitorDataResultType, KameleoonError>>;
21
- trackExperiment({ variationId, visitorCode, experimentId, isUnallocated, body, userAgent, }: TrackExperimentParamsType): Promise<Result<boolean, KameleoonError>>;
21
+ trackExperiment({ variationId, visitorCode, experimentId, isUnallocated, body, userAgent, isTargetedRule, isConsentProvided, }: TrackExperimentParamsType): Promise<Result<boolean, KameleoonError>>;
22
22
  trackData({ visitorCode, body, userAgent, }: TrackDataParamsType): Promise<Result<boolean, KameleoonError>>;
23
23
  private getTrackingUrl;
24
24
  }