@kameleoon/javascript-sdk-core 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clientConfiguration/types.d.ts +1 -0
- package/dist/clientConfiguration/types.js.map +1 -1
- package/dist/hasher/hasher.d.ts +1 -1
- package/dist/hasher/hasher.js +1 -1
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/types.d.ts +1 -1
- package/dist/hasher/types.js.map +1 -1
- package/dist/kameleoonClient.js +1 -1
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/customData.d.ts +6 -0
- package/dist/kameleoonData/customData.js +1 -1
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/dataManager.d.ts +2 -0
- package/dist/kameleoonData/dataManager.js +1 -1
- package/dist/kameleoonData/dataManager.js.map +1 -1
- package/dist/kameleoonData/types.d.ts +1 -0
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/requester/constants.js +1 -1
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/types.d.ts +1 -1
- package/dist/requester/types.js +1 -1
- package/dist/requester/types.js.map +1 -1
- package/dist/utilities/types.d.ts +5 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +2 -2
- package/dist/utilities/utilities.js +1 -1
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/types.d.ts +1 -0
- package/dist/variationConfiguration/types.js.map +1 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +1 -1
- package/dist/variationConfiguration/variationConfiguration.js +1 -1
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customData.js","names":["CustomData","a","index","_classCallCheck","_defineProperty","c","arguments","length","value","Array","e","sent","_createClass","key","get","uniqueValues","_toConsumableArray","Set","resultValue","forEach","Object","keys","
|
|
1
|
+
{"version":3,"file":"customData.js","names":["CustomData","a","index","_classCallCheck","_defineProperty","c","arguments","length","value","Array","e","sent","isIdentifier","_createClass","key","get","uniqueValues","_toConsumableArray","Set","resultValue","forEach","Object","keys","identifierParameter","UrlParameter","MappingIdentifier","UrlEventType","Index","ValuesCountMap","encodeURIComponent","JSON","stringify","Overwrite","type","KameleoonData","set","_listFromVisits","visits","visit","resultData","customDataMap","Map","i","customDataEvents","g","j","_createForOfIteratorHelper","s","n","done","customDataEvent","l","data","valuesCountMap","f","o","p","q","_slicedToArray","push","_construct","concat","exports"],"sources":["../../src/kameleoonData/customData.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { CustomDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * CustomData - a class for creating an instance for user's custom data\n * */\nexport class CustomData implements IKameleoonData {\n private index: number;\n private value: string[];\n private sent: boolean;\n private isIdentifier: boolean;\n\n /**\n * @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application\n * @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows\n * @example\n * ```ts\n * // - Single value\n * const customData = new CustomData(0, 'value_1');\n * // - Variadic number of values\n * const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');\n * // - Array of values\n * const values = ['value_1', 'value_2', 'value_3'];\n * const customData = new CustomData(0, ...values);\n * ```\n * */\n constructor(index: number, ...value: string[]) {\n this.index = index;\n this.value = value;\n this.sent = false;\n this.isIdentifier = 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 (typeof this.index !== 'number') {\n return '';\n }\n\n const uniqueValues = [...new Set(this.value)];\n let resultValue: Record<string, 1> = {};\n\n // --- Note ---\n // Final value should look like this `{ \"value_1\": 1, \"value_2\": 1, \"value_3\": 1}`\n // With no duplicates\n uniqueValues.forEach((value) => {\n resultValue[value] = 1;\n });\n\n if (!Object.keys(resultValue).length) {\n return '';\n }\n\n let identifierParameter = '';\n\n if (this.isIdentifier) {\n identifierParameter = UrlParameter.MappingIdentifier + String(true);\n }\n\n return (\n UrlEventType.CustomData +\n UrlParameter.Index +\n this.index +\n UrlParameter.ValuesCountMap +\n encodeURIComponent(JSON.stringify(resultValue)) +\n UrlParameter.Overwrite +\n String(true) +\n identifierParameter\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): CustomDataType {\n return {\n index: this.index,\n value: this.value,\n type: KameleoonData.CustomData,\n isIdentifier: this.isIdentifier,\n sent: this.sent,\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 isMappingIdentifier - signifying if the data is a mapping identifier\n * @private\n * */\n set _isMappingIdentifier(value: boolean) {\n this.isIdentifier = value;\n }\n\n /**\n * @private\n * @method _listFromVisits - an internal method for creating a list of custom data from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {CustomData[]} a list of custom data\n * */\n public static _listFromVisits(visits: VisitType[]): CustomData[] {\n const resultData: CustomData[] = [];\n const customDataMap = new Map<number, string[]>();\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.customDataEvents) {\n continue;\n }\n\n const customDataEvents = visit.customDataEvents;\n\n for (const customDataEvent of customDataEvents) {\n const { index, valuesCountMap } = customDataEvent.data;\n\n customDataMap.set(index, Object.keys(valuesCountMap));\n }\n }\n\n for (const [index, data] of customDataMap) {\n resultData.push(new CustomData(index, ...data));\n }\n\n return resultData;\n }\n}\n"],"mappings":"kgJAOa,CAAAA,UAAU,YAoBrB,SAAAC,EAAYC,CAAa,CAAsB,CAAAC,eAAA,MAAAF,CAAA,EAAAG,eAAA,sBAAAA,eAAA,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bb,CAAa,CAACL,GAAG,CAACjC,CAAK,CAAEmB,MAAM,CAACC,IAAI,CAAC+B,CAAc,CAAC,CACtD,CAAC,OAAApD,CAAA,EAAA4C,CAAA,CAAAnC,CAAA,CAAAT,CAAA,UAAA4C,CAAA,CAAAS,CAAA,IACF,IAAAC,CAAA,CAAAC,CAAA,CAAAV,0BAAA,CAE2BN,CAAa,MAAzC,IAAAgB,CAAA,CAAAT,CAAA,KAAAQ,CAAA,CAAAC,CAAA,CAAAR,CAAA,IAAAC,IAAA,EAA2C,KAAAQ,CAAA,CAAAC,cAAA,CAAAH,CAAA,CAAA/C,KAAA,IAA/BN,CAAK,CAAAuD,CAAA,IAAEL,CAAI,CAAAK,CAAA,IACrBlB,CAAU,CAACoB,IAAI,CAAAC,UAAA,CAAK5D,CAAU,EAACE,CAAK,EAAA2D,MAAA,CAAA5C,kBAAA,CAAKmC,CAAI,IAC/C,CAAC,OAAAnD,CAAA,EAAAuD,CAAA,CAAA9C,CAAA,CAAAT,CAAA,UAAAuD,CAAA,CAAAF,CAAA,GAED,MAAO,CAAAf,CACT,CAAC,IAAAtC,CAAA,IAAA6D,OAAA,CAAA9D,UAAA,CAAAA,UAAA"}
|
|
@@ -19,6 +19,7 @@ export declare class DataManager implements IDataManager {
|
|
|
19
19
|
private targetingTrees;
|
|
20
20
|
private localCustomDataIndexes;
|
|
21
21
|
private persistentCustomDataIndexes;
|
|
22
|
+
private mappingIdentifierCustomDataIndexes;
|
|
22
23
|
private targetingDataIntervalId;
|
|
23
24
|
private dataProcessor;
|
|
24
25
|
private unsentData;
|
|
@@ -31,6 +32,7 @@ export declare class DataManager implements IDataManager {
|
|
|
31
32
|
clearUnsentData(visitorCode: string): void;
|
|
32
33
|
clearUnsentDataByKey(visitorCode: string, key: KameleoonData): void;
|
|
33
34
|
isPersistentCustomData(dataItem: KameleoonDataType): dataItem is CustomData;
|
|
35
|
+
getVisitorIdentifier(visitorCode: string): string;
|
|
34
36
|
get trees(): Map<string, Tree>;
|
|
35
37
|
get unsentDataVisitors(): string[];
|
|
36
38
|
get storedTargetingData(): TargetingDataType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataManager=void 0;var _targeting=require("../targeting"),_dataProcessor=require("./dataProcessor"),_utilities=require("../utilities"),_clientConfiguration=require("../clientConfiguration"),_types=require("../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 _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 _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 _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 DataManager=function(){function a(b){var c=this,d=b.storage,e=b.targetingCleanupInterval;if(_classCallCheck(this,a),_defineProperty(this,"targetingTrees",new Map),_defineProperty(this,"localCustomDataIndexes",new Set),_defineProperty(this,"persistentCustomDataIndexes",new Set),_defineProperty(this,"targetingDataIntervalId",null),_defineProperty(this,"dataProcessor",void 0),_defineProperty(this,"unsentData",void 0),_defineProperty(this,"sentPageViewTimestamps",new Map),this.dataProcessor=new _dataProcessor.DataProcessor(d),this.unsentData={},e){var f=0>e?1:e,g=function(){c.dataProcessor.cleanupOutdatedTargetingData(e),c.sentPageViewTimestamps.clear()};try{this.targetingDataIntervalId=setInterval(g,f*_types.Milliseconds.Minute)}catch(a){throw this.targetingDataIntervalId&&clearInterval(this.targetingDataIntervalId),a}}}return _createClass(a,[{key:"addData",value:function addData(a){this.unsentData[a]||(this.unsentData[a]=new Map);for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];for(var e,f=0,g=c;f<g.length;f++)switch(e=g[f],this.dataProcessor.updateData(a,e),e.data.type){case _types2.KameleoonData.CustomData:{var h=e.data;this.localCustomDataIndexes.has(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataManager=void 0;var _targeting=require("../targeting"),_dataProcessor=require("./dataProcessor"),_utilities=require("../utilities"),_clientConfiguration=require("../clientConfiguration"),_types=require("../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 _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 _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 _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 DataManager=function(){function a(b){var c=this,d=b.storage,e=b.targetingCleanupInterval;if(_classCallCheck(this,a),_defineProperty(this,"targetingTrees",new Map),_defineProperty(this,"localCustomDataIndexes",new Set),_defineProperty(this,"persistentCustomDataIndexes",new Set),_defineProperty(this,"mappingIdentifierCustomDataIndexes",new Set),_defineProperty(this,"targetingDataIntervalId",null),_defineProperty(this,"dataProcessor",void 0),_defineProperty(this,"unsentData",void 0),_defineProperty(this,"sentPageViewTimestamps",new Map),this.dataProcessor=new _dataProcessor.DataProcessor(d),this.unsentData={},e){var f=0>e?1:e,g=function(){c.dataProcessor.cleanupOutdatedTargetingData(e),c.sentPageViewTimestamps.clear()};try{this.targetingDataIntervalId=setInterval(g,f*_types.Milliseconds.Minute)}catch(a){throw this.targetingDataIntervalId&&clearInterval(this.targetingDataIntervalId),a}}}return _createClass(a,[{key:"addData",value:function addData(a){this.unsentData[a]||(this.unsentData[a]=new Map);for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];for(var e,f=0,g=c;f<g.length;f++)switch(e=g[f],this.dataProcessor.updateData(a,e),e.data.type){case _types2.KameleoonData.CustomData:{var h=e,i=h.data;this.mappingIdentifierCustomDataIndexes.has(i.index)&&(i.isIdentifier=!0),this.localCustomDataIndexes.has(i.index)||e.isSent||this.unsentData[a].set(i.index,h);break}case _types2.KameleoonData.PageView:{var j=e.data,k=this.dataProcessor.storedTargetingData.or({}),l=k[a][_types2.KameleoonData.PageView];if(l){var m=l[j.urlAddress];if(!e.isSent){var n,o=_createForOfIteratorHelper(m.timestamps);try{for(o.s();!(n=o.n()).done;){var p=n.value;this.sentPageViewTimestamps.has(p)||(this.unsentData[a].set(p,e),this.sentPageViewTimestamps.set(p,!0))}}catch(a){o.e(a)}finally{o.f()}}else{var q,r=_createForOfIteratorHelper(m.timestamps);try{for(r.s();!(q=r.n()).done;){var s=q.value;this.sentPageViewTimestamps.has(s)||this.sentPageViewTimestamps.set(s,!0)}}catch(a){r.e(a)}finally{r.f()}}}break}case _types2.KameleoonData.Conversion:{var t=this.unsentData[a];if(!e.isSent)if(t.has(_types2.KameleoonData.Conversion)){var u=t.get(_types2.KameleoonData.Conversion);u.push(e),t.set(_types2.KameleoonData.Conversion,u)}else t.set(_types2.KameleoonData.Conversion,[e]);break}default:{var v=e.data;e.isSent||this.unsentData[a].set(v.type,e)}}return this.dataProcessor.createVisit(a)}},{key:"getTree",value:function getTree(a){if(!this.targetingTrees.has(a.id)){var b=new _targeting.Tree(a);return this.targetingTrees.set(a.id,new _targeting.Tree(a)),b}return this.targetingTrees.get(a.id)}},{key:"clearTrees",value:function clearTrees(){this.targetingTrees.clear()}},{key:"getUnsentData",value:function getUnsentData(a){return this.unsentData[a]}},{key:"clearUnsentData",value:function clearUnsentData(a){var b,c=null===(b=this.unsentData[a])||void 0===b?void 0:b.values();if(c&&this.persistentCustomDataIndexes.size){var d,e=new Map,f=_createForOfIteratorHelper(c);try{for(f.s();!(d=f.n()).done;){var g=d.value;!Array.isArray(g)&&this.isPersistentCustomData(g)&&e.set(g.data.index,g)}}catch(a){f.e(a)}finally{f.f()}if(e.size)return void(this.unsentData[a]=e)}delete this.unsentData[a]}},{key:"clearUnsentDataByKey",value:function clearUnsentDataByKey(a,b){var c=this.unsentData[a];if(c){if(b===_types2.KameleoonData.CustomData&&this.persistentCustomDataIndexes.size){var d,e=_createForOfIteratorHelper(c.entries());try{for(e.s();!(d=e.n()).done;){var f=_slicedToArray(d.value,2),g=f[0],h=f[1];this.isPersistentCustomData(h)||g===b&&c.delete(g)}}catch(a){e.e(a)}finally{e.f()}}else if(b===_types2.KameleoonData.PageView){var i,j=_createForOfIteratorHelper(c.keys());try{for(j.s();!(i=j.n()).done;){var k=i.value;"number"==typeof k&&c.delete(k)}}catch(a){j.e(a)}finally{j.f()}}else c.delete(b);c.size||delete this.unsentData[a]}}},{key:"isPersistentCustomData",value:function isPersistentCustomData(a){return!!this.persistentCustomDataIndexes.size&&!!_utilities.Utilities.isCustomData(a)&&this.persistentCustomDataIndexes.has(a.data.index)}},{key:"getVisitorIdentifier",value:function getVisitorIdentifier(a){var b=this.storedTargetingData;if(!b[a])return a;var c=b[a][_types2.KameleoonData.CustomData];if(!c)return a;for(var d=0,e=Object.entries(c);d<e.length;d++){var f=_slicedToArray(e[d],2),g=f[0],h=f[1];if(this.mappingIdentifierCustomDataIndexes.has(parseInt(g))&&h)return h.value[0]}return a}},{key:"trees",get:function get(){return this.targetingTrees}},{key:"unsentDataVisitors",get:function get(){return Object.keys(this.unsentData)}},{key:"storedTargetingData",get:function get(){return this.dataProcessor.storedTargetingData.or({})}},{key:"customDataIndexes",set:function set(a){var b=[],c=[],d=[];a.forEach(function(a){a.localOnly&&b.push(a.index),a.scope===_clientConfiguration.CustomDataScope.Visitor&&c.push(a.index),a.isMappingIdentifier&&d.push(a.index)}),b.length&&(this.localCustomDataIndexes=new Set(b)),c.length&&(this.persistentCustomDataIndexes=new Set(c)),d.length&&(this.mappingIdentifierCustomDataIndexes=new Set(d))}}]),a}();exports.DataManager=DataManager;
|
|
2
2
|
//# sourceMappingURL=dataManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataManager.js","names":["DataManager","a","b","c","storage","targetingCleanupInterval","_classCallCheck","_defineProperty","Map","Set","dataProcessor","DataProcessor","unsentData","cleanupInterval","cleanupCallback","cleanupOutdatedTargetingData","sentPageViewTimestamps","clear","targetingDataIntervalId","setInterval","Milliseconds","Minute","err","clearInterval","_createClass","key","value","addData","visitorCode","arguments","length","kameleoonData","Array","d","dataItem","f","g","updateData","data","type","KameleoonData","CustomData","localCustomDataIndexes","has","index","isSent","set","PageView","storedData","storedTargetingData","or","storedVisitorData","pageView","urlAddress","m","n","_createForOfIteratorHelper","timestamps","s","done","timestamp","e","p","q","Conversion","existingConversions","get","push","createVisit","getTree","segment","targetingTrees","id","targetingTree","Tree","clearTrees","getUnsentData","clearUnsentData","dataItems","values","persistentCustomDataIndexes","size","persistentCustomData","isArray","isPersistentCustomData","clearUnsentDataByKey","visitorData","entries","_slicedToArray","dataKey","delete","i","j","keys","Utilities","isCustomData","Object","customData","customDataLocalOnlyIndexes","forEach","localOnly","scope","CustomDataScope","Visitor","exports"],"sources":["../../src/kameleoonData/dataManager.ts"],"sourcesContent":["import { Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { SegmentType, TargetingDataType, Tree } from 'src/targeting';\nimport { DataProcessor } from './dataProcessor';\nimport { Utilities } from 'src/utilities';\nimport {\n CustomDataConfigurationType,\n CustomDataScope,\n} from 'src/clientConfiguration';\nimport { Milliseconds } from 'src/types';\nimport { CustomData } from './customData';\nimport {\n CustomDataType,\n DataManagerParametersType,\n ExistingPageViewDataType,\n KameleoonData,\n KameleoonDataType,\n PageViewDataType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n} from './types';\n\ninterface IDataManager {\n addData(visitorCode: string, ...kameleoonData: KameleoonDataType[]): void;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n getTree(segment: SegmentType): Tree;\n clearTrees(): void;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n readonly trees: Map<string, Tree>;\n readonly storedTargetingData: TargetingDataType;\n readonly unsentDataVisitors: string[];\n}\n\nexport class DataManager implements IDataManager {\n private targetingTrees: Map<string, Tree> = new Map();\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n private targetingDataIntervalId: NodeJS.Timer | null = null;\n private dataProcessor: DataProcessor;\n private unsentData: UnsentTargetingDataType;\n private sentPageViewTimestamps: Map<number, boolean> = new Map();\n\n constructor({\n storage,\n targetingCleanupInterval,\n }: DataManagerParametersType) {\n this.dataProcessor = new DataProcessor(storage);\n this.unsentData = {};\n\n if (targetingCleanupInterval) {\n const cleanupInterval =\n targetingCleanupInterval < 0 ? 1 : targetingCleanupInterval;\n\n const cleanupCallback = () => {\n this.dataProcessor.cleanupOutdatedTargetingData(\n targetingCleanupInterval,\n );\n this.sentPageViewTimestamps.clear();\n };\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.targetingDataIntervalId = setInterval(\n cleanupCallback,\n cleanupInterval * Milliseconds.Minute,\n );\n } catch (err) {\n if (this.targetingDataIntervalId) {\n clearInterval(this.targetingDataIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public addData(\n visitorCode: string,\n ...kameleoonData: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always presents further\n if (!this.unsentData[visitorCode]) {\n this.unsentData[visitorCode] = new Map();\n }\n\n for (const dataItem of kameleoonData) {\n this.dataProcessor.updateData(visitorCode, dataItem);\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const data = dataItem.data as CustomDataType;\n\n if (\n !this.localCustomDataIndexes.has(data.index) &&\n !dataItem.isSent\n ) {\n this.unsentData[visitorCode]!.set(data.index, dataItem);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // `PageViews` can only be processed during storage update as they\n // can't create and merge referrers/titles/timestamps on their own\n // So we have to extract them from storage to update `unsentData` correctly\n const storedData = this.dataProcessor.storedTargetingData.or({});\n const storedVisitorData =\n storedData[visitorCode][KameleoonData.PageView];\n\n if (storedVisitorData) {\n const pageView = (storedVisitorData as ExistingPageViewDataType)[\n data.urlAddress\n ];\n\n // --- Note ---\n // A case for newly created page view\n if (!dataItem.isSent) {\n for (const timestamp of pageView.timestamps) {\n // --- Note ---\n // As we don't keep `sent` status for each timestamp, we have to\n // check if it was already sent to avoid duplicates\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.unsentData[visitorCode]!.set(timestamp, dataItem);\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n // --- Note ---\n // A case for `getRemoteVisitorData` pre-loaded pages that shouldn't be sent again\n } else {\n for (const timestamp of pageView.timestamps) {\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n }\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const unsentData = this.unsentData[visitorCode]!;\n\n if (!dataItem.isSent) {\n if (unsentData.has(KameleoonData.Conversion)) {\n const existingConversions = unsentData.get(\n KameleoonData.Conversion,\n ) as KameleoonDataType[];\n\n existingConversions.push(dataItem);\n\n unsentData.set(KameleoonData.Conversion, existingConversions);\n } else {\n unsentData.set(KameleoonData.Conversion, [dataItem]);\n }\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n\n if (!dataItem.isSent) {\n this.unsentData[visitorCode]!.set(data.type, dataItem);\n }\n }\n }\n }\n\n return this.dataProcessor.createVisit(visitorCode);\n }\n\n public getTree(segment: SegmentType): Tree {\n if (!this.targetingTrees.has(segment.id)) {\n const targetingTree = new Tree(segment);\n\n this.targetingTrees.set(segment.id, new Tree(segment));\n\n return targetingTree;\n }\n\n return this.targetingTrees.get(segment.id) as Tree;\n }\n\n public clearTrees(): void {\n this.targetingTrees.clear();\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (!Array.isArray(dataItem) && this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentData[visitorCode];\n }\n\n public clearUnsentDataByKey(visitorCode: string, key: KameleoonData): void {\n const visitorData = this.unsentData[visitorCode];\n\n if (!visitorData) {\n return;\n }\n\n if (\n key === KameleoonData.CustomData &&\n this.persistentCustomDataIndexes.size\n ) {\n for (const [dataKey, dataItem] of visitorData.entries()) {\n if (this.isPersistentCustomData(dataItem as KameleoonDataType)) {\n continue;\n }\n\n if (dataKey === key) {\n visitorData.delete(dataKey);\n }\n }\n } else if (key === KameleoonData.PageView) {\n for (const dataKey of visitorData.keys()) {\n if (typeof dataKey === 'number') {\n visitorData.delete(dataKey);\n }\n }\n } else {\n visitorData.delete(key);\n }\n\n if (!visitorData.size) {\n delete this.unsentData[visitorCode];\n }\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n get trees() {\n return this.targetingTrees;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentData);\n }\n\n get storedTargetingData(): TargetingDataType {\n return this.dataProcessor.storedTargetingData.or({});\n }\n\n set customDataIndexes(customData: CustomDataConfigurationType[]) {\n const customDataLocalOnlyIndexes: number[] = [];\n const persistentCustomDataIndexes: number[] = [];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(persistentCustomDataIndexes);\n }\n }\n}\n"],"mappings":"09GAoCa,CAAAA,WAAW,YAStB,SAAAC,EAAAC,CAAA,CAG8B,KAAAC,CAAA,MA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AInE,CAAC,GAAAnB,GAAA,SAAAyC,GAAA,CAED,SAAAA,IAAA,CAAY,CACV,MAAO,KAAI,CAACK,cACd,CAAC,GAAA9C,GAAA,sBAAAyC,GAAA,CAED,SAAAA,IAAA,CAAmC,CACjC,MAAO,CAAA8B,MAAM,CAACH,IAAI,CAAC,IAAI,CAACjF,UAAU,CACpC,CAAC,GAAAa,GAAA,uBAAAyC,GAAA,CAED,SAAAA,IAAA,CAA6C,CAC3C,MAAO,KAAI,CAACxD,aAAa,CAACuC,mBAAmB,CAACC,EAAE,CAAC,CAAC,CAAC,CACrD,CAAC,GAAAzB,GAAA,qBAAAqB,GAAA,CAED,SAAAA,IAAsBmD,CAAyC,CAAE,IACzD,CAAAC,CAAoC,CAAG,EAAE,CACzClB,CAAqC,CAAG,EAAE,CAEhDiB,CAAU,CAACE,OAAO,CAAC,SAACF,CAAU,CAAK,CAC7BA,CAAU,CAACG,SAAS,EACtBF,CAA0B,CAAC/B,IAAI,CAAC8B,CAAU,CAACrD,KAAK,CAAC,CAG/CqD,CAAU,CAACI,KAAK,GAAKC,oCAAe,CAACC,OAAO,EAC9CvB,CAA2B,CAACb,IAAI,CAAC8B,CAAU,CAACrD,KAAK,CAErD,CAAC,CAAC,CAEEsD,CAA0B,CAACpE,MAAM,GACnC,IAAI,CAACY,sBAAsB,CAAG,GAAI,CAAAjC,GAAG,CAACyF,CAA0B,CAAC,EAG/DlB,CAA2B,CAAClD,MAAM,GACpC,IAAI,CAACkD,2BAA2B,CAAG,GAAI,CAAAvE,GAAG,CAACuE,CAA2B,CAAC,CAE3E,CAAC,IAAA/E,CAAA,IAAAuG,OAAA,CAAAxG,WAAA,CAAAA,WAAA"}
|
|
1
|
+
{"version":3,"file":"dataManager.js","names":["DataManager","a","b","c","storage","targetingCleanupInterval","_classCallCheck","_defineProperty","Map","Set","dataProcessor","DataProcessor","unsentData","cleanupInterval","cleanupCallback","cleanupOutdatedTargetingData","sentPageViewTimestamps","clear","targetingDataIntervalId","setInterval","Milliseconds","Minute","err","clearInterval","_createClass","key","value","addData","visitorCode","arguments","length","kameleoonData","Array","d","dataItem","f","g","updateData","data","type","KameleoonData","CustomData","customData","mappingIdentifierCustomDataIndexes","has","index","isIdentifier","localCustomDataIndexes","isSent","set","PageView","storedData","storedTargetingData","or","storedVisitorData","pageView","urlAddress","n","o","_createForOfIteratorHelper","timestamps","s","done","timestamp","e","q","r","Conversion","existingConversions","get","push","createVisit","getTree","segment","targetingTrees","id","targetingTree","Tree","clearTrees","getUnsentData","clearUnsentData","dataItems","values","persistentCustomDataIndexes","size","persistentCustomData","isArray","isPersistentCustomData","clearUnsentDataByKey","visitorData","entries","_slicedToArray","dataKey","delete","i","j","keys","Utilities","isCustomData","getVisitorIdentifier","targetingData","Object","parseInt","customDataLocalOnlyIndexes","forEach","localOnly","scope","CustomDataScope","Visitor","isMappingIdentifier","exports"],"sources":["../../src/kameleoonData/dataManager.ts"],"sourcesContent":["import { Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { SegmentType, TargetingDataType, Tree } from 'src/targeting';\nimport { DataProcessor } from './dataProcessor';\nimport { Utilities } from 'src/utilities';\nimport {\n CustomDataConfigurationType,\n CustomDataScope,\n} from 'src/clientConfiguration';\nimport { Milliseconds } from 'src/types';\nimport { CustomData } from './customData';\nimport {\n DataManagerParametersType,\n ExistingPageViewDataType,\n KameleoonData,\n KameleoonDataType,\n PageViewDataType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n} from './types';\n\ninterface IDataManager {\n addData(visitorCode: string, ...kameleoonData: KameleoonDataType[]): void;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n getTree(segment: SegmentType): Tree;\n clearTrees(): void;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n readonly trees: Map<string, Tree>;\n readonly storedTargetingData: TargetingDataType;\n readonly unsentDataVisitors: string[];\n}\n\nexport class DataManager implements IDataManager {\n private targetingTrees: Map<string, Tree> = new Map();\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n private mappingIdentifierCustomDataIndexes: Set<number> = new Set();\n private targetingDataIntervalId: NodeJS.Timer | null = null;\n private dataProcessor: DataProcessor;\n private unsentData: UnsentTargetingDataType;\n private sentPageViewTimestamps: Map<number, boolean> = new Map();\n\n constructor({\n storage,\n targetingCleanupInterval,\n }: DataManagerParametersType) {\n this.dataProcessor = new DataProcessor(storage);\n this.unsentData = {};\n\n if (targetingCleanupInterval) {\n const cleanupInterval =\n targetingCleanupInterval < 0 ? 1 : targetingCleanupInterval;\n\n const cleanupCallback = () => {\n this.dataProcessor.cleanupOutdatedTargetingData(\n targetingCleanupInterval,\n );\n this.sentPageViewTimestamps.clear();\n };\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.targetingDataIntervalId = setInterval(\n cleanupCallback,\n cleanupInterval * Milliseconds.Minute,\n );\n } catch (err) {\n if (this.targetingDataIntervalId) {\n clearInterval(this.targetingDataIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public addData(\n visitorCode: string,\n ...kameleoonData: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always presents further\n if (!this.unsentData[visitorCode]) {\n this.unsentData[visitorCode] = new Map();\n }\n\n for (const dataItem of kameleoonData) {\n this.dataProcessor.updateData(visitorCode, dataItem);\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const customData = dataItem as CustomData;\n const data = customData.data;\n\n // --- Bug ---\n // - There's a known issue here: `mappingIdentifier` won't be updated\n // in the storage because the data is written before `unsentData` update\n // and we get `mappingIdentifier` only by checking CC here\n // - It doesn't affect the functionality, as stored data is\n // only used for condition evaluation and `Visitor` scoped CD is never removed from `unsentData`\n // still it should be fixed with some `.updateData` refactor\n if (this.mappingIdentifierCustomDataIndexes.has(data.index)) {\n data.isIdentifier = true;\n }\n\n if (\n !this.localCustomDataIndexes.has(data.index) &&\n !dataItem.isSent\n ) {\n this.unsentData[visitorCode]!.set(data.index, customData);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // `PageViews` can only be processed during storage update as they\n // can't create and merge referrers/titles/timestamps on their own\n // So we have to extract them from storage to update `unsentData` correctly\n const storedData = this.dataProcessor.storedTargetingData.or({});\n const storedVisitorData =\n storedData[visitorCode][KameleoonData.PageView];\n\n if (storedVisitorData) {\n const pageView = (storedVisitorData as ExistingPageViewDataType)[\n data.urlAddress\n ];\n\n // --- Note ---\n // A case for newly created page view\n if (!dataItem.isSent) {\n for (const timestamp of pageView.timestamps) {\n // --- Note ---\n // As we don't keep `sent` status for each timestamp, we have to\n // check if it was already sent to avoid duplicates\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.unsentData[visitorCode]!.set(timestamp, dataItem);\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n // --- Note ---\n // A case for `getRemoteVisitorData` pre-loaded pages that shouldn't be sent again\n } else {\n for (const timestamp of pageView.timestamps) {\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n }\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const unsentData = this.unsentData[visitorCode]!;\n\n if (!dataItem.isSent) {\n if (unsentData.has(KameleoonData.Conversion)) {\n const existingConversions = unsentData.get(\n KameleoonData.Conversion,\n ) as KameleoonDataType[];\n\n existingConversions.push(dataItem);\n\n unsentData.set(KameleoonData.Conversion, existingConversions);\n } else {\n unsentData.set(KameleoonData.Conversion, [dataItem]);\n }\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n\n if (!dataItem.isSent) {\n this.unsentData[visitorCode]!.set(data.type, dataItem);\n }\n }\n }\n }\n\n return this.dataProcessor.createVisit(visitorCode);\n }\n\n public getTree(segment: SegmentType): Tree {\n if (!this.targetingTrees.has(segment.id)) {\n const targetingTree = new Tree(segment);\n\n this.targetingTrees.set(segment.id, new Tree(segment));\n\n return targetingTree;\n }\n\n return this.targetingTrees.get(segment.id) as Tree;\n }\n\n public clearTrees(): void {\n this.targetingTrees.clear();\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (!Array.isArray(dataItem) && this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentData[visitorCode];\n }\n\n public clearUnsentDataByKey(visitorCode: string, key: KameleoonData): void {\n const visitorData = this.unsentData[visitorCode];\n\n if (!visitorData) {\n return;\n }\n\n if (\n key === KameleoonData.CustomData &&\n this.persistentCustomDataIndexes.size\n ) {\n for (const [dataKey, dataItem] of visitorData.entries()) {\n if (this.isPersistentCustomData(dataItem as KameleoonDataType)) {\n continue;\n }\n\n if (dataKey === key) {\n visitorData.delete(dataKey);\n }\n }\n } else if (key === KameleoonData.PageView) {\n for (const dataKey of visitorData.keys()) {\n if (typeof dataKey === 'number') {\n visitorData.delete(dataKey);\n }\n }\n } else {\n visitorData.delete(key);\n }\n\n if (!visitorData.size) {\n delete this.unsentData[visitorCode];\n }\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n public getVisitorIdentifier(visitorCode: string): string {\n const targetingData = this.storedTargetingData;\n\n if (!targetingData[visitorCode]) {\n return visitorCode;\n }\n\n const customData = targetingData[visitorCode][KameleoonData.CustomData];\n\n if (!customData) {\n return visitorCode;\n }\n\n for (const [index, dataItem] of Object.entries(customData)) {\n if (\n this.mappingIdentifierCustomDataIndexes.has(parseInt(index)) &&\n dataItem\n ) {\n return dataItem.value[0];\n }\n }\n\n return visitorCode;\n }\n\n get trees() {\n return this.targetingTrees;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentData);\n }\n\n get storedTargetingData(): TargetingDataType {\n return this.dataProcessor.storedTargetingData.or({});\n }\n\n set customDataIndexes(customData: CustomDataConfigurationType[]) {\n const [\n customDataLocalOnlyIndexes,\n persistentCustomDataIndexes,\n mappingIdentifierCustomDataIndexes,\n ]: Array<number[]> = [[], [], []];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n\n if (customData.isMappingIdentifier) {\n mappingIdentifierCustomDataIndexes.push(customData.index);\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(persistentCustomDataIndexes);\n }\n\n if (mappingIdentifierCustomDataIndexes.length) {\n this.mappingIdentifierCustomDataIndexes = new Set(\n mappingIdentifierCustomDataIndexes,\n );\n }\n }\n}\n"],"mappings":"09GAmCa,CAAAA,WAAW,YAUtB,SAAAC,EAAAC,CAAA,CAG8B,KAAAC,CAAA,MAF5BC,CAAO,CAAAF,CAAA,CAAPE,OAAO,CACPC,CAAwB,CAAAH,CAAA,CAAxBG,wBAAwB,CAKxB,GAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,uBAhB0C,GAAI,CAAAC,GAAK,EAAAD,eAAA,+BACP,GAAI,CAAAE,GAAK,EAAAF,eAAA,oCACJ,GAAI,C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D1BxC,CAAkC,CACN,EAAE,CAEhCD,CAAU,CAAC8D,OAAO,CAAC,SAAC9D,CAAU,CAAK,CAC7BA,CAAU,CAAC+D,SAAS,EACtBF,CAA0B,CAACjC,IAAI,CAAC5B,CAAU,CAACG,KAAK,CAAC,CAG/CH,CAAU,CAACgE,KAAK,GAAKC,oCAAe,CAACC,OAAO,EAC9CzB,CAA2B,CAACb,IAAI,CAAC5B,CAAU,CAACG,KAAK,CAAC,CAGhDH,CAAU,CAACmE,mBAAmB,EAChClE,CAAkC,CAAC2B,IAAI,CAAC5B,CAAU,CAACG,KAAK,CAE5D,CAAC,CAAC,CAEE0D,CAA0B,CAACzE,MAAM,GACnC,IAAI,CAACiB,sBAAsB,CAAG,GAAI,CAAAtC,GAAG,CAAC8F,CAA0B,CAAC,EAG/DpB,CAA2B,CAACrD,MAAM,GACpC,IAAI,CAACqD,2BAA2B,CAAG,GAAI,CAAA1E,GAAG,CAAC0E,CAA2B,CAAC,EAGrExC,CAAkC,CAACb,MAAM,GAC3C,IAAI,CAACa,kCAAkC,CAAG,GAAI,CAAAlC,GAAG,CAC/CkC,CAAkC,CACnC,CAEL,CAAC,IAAA1C,CAAA,IAAA6G,OAAA,CAAA9G,WAAA,CAAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["KameleoonData","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","exports","DeviceType","Phone","Tablet","Desktop","OperatingSystemType","WindowsPhone","Windows","Android","Linux","Mac","IOS","BrowserType","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","OperatingSystemIndexMap","_OperatingSystemIndex","_defineProperty","OperatingSystemTypeMap","constructTypeMap","BrowserIndexMap","_BrowserIndexMap","BrowserTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import { TargetingDataType } from 'src/targeting';\nimport { IExternalStorage } from 'src/storage';\nimport {\n Browser,\n Conversion,\n Cookie,\n CustomData,\n Device,\n GeolocationData,\n OperatingSystem,\n PageView,\n UserAgent,\n ApplicationVersion,\n VisitsData,\n} from 'src/kameleoonData';\nimport { constructTypeMap } from './helpers';\n\n// --- Note ---\n// -- `Conversion`s are stored by `KameleoonData.Conversion` key in a form of an `KameleoonDataType[]` array\n// -- `PageView`s are store by `timestamp` (number) key in a form of `KameleoonDataType`\n// -- All the other unsent data types are stored in a form of `KameleoonData` key and `KameleoonDataType` value\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType | KameleoonDataType[]\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type FieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value:\n | BrowserDataType\n | CookieDataType\n | DeviceDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | UserAgentDataType\n | VisitsDataType;\n data: TargetingDataType;\n};\n\nexport type ArrayFieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value: ConversionDataType;\n data: TargetingDataType;\n};\nexport type NestedFieldParametersType = {\n visitorCode: string;\n key: KameleoonData.CustomData | KameleoonData.PageView;\n nestedKey: string;\n value: CustomDataType | PageViewDataType;\n data: TargetingDataType;\n};\n\nexport type DataManagerParametersType = {\n targetingCleanupInterval?: number;\n storage: IExternalStorage<TargetingDataType>;\n};\n\nexport type KameleoonDataItemType =\n | BrowserDataType\n | ConversionDataType\n | CustomDataType\n | DeviceDataType\n | PageViewDataType\n | UserAgentDataType\n | CookieDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | ApplicationVersionDataType\n | VisitsDataType;\n\n/**\n * @interface an interface of KameleoonData\n * each class instance will have url getter method\n * for handling url of different data types\n * */\nexport interface IKameleoonData {\n readonly url: string;\n readonly data: KameleoonDataItemType;\n isSent: boolean;\n}\n\n/**\n * @type a tuple of each possible type of data for `addData` method\n * of KameleoonClient\n * */\nexport type KameleoonDataType =\n | Browser\n | Conversion\n | CustomData\n | Device\n | PageView\n | UserAgent\n | VisitsData\n | GeolocationData\n | OperatingSystem\n | Cookie\n | ApplicationVersion;\n\nexport type ActivityTimePropertyType = {\n lastActivityTime: number;\n};\n\nexport type ExistingCustomDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.CustomData]\n>;\n\nexport type ExistingPageViewDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.PageView]\n>;\n\nexport type ExistingNestedDataType =\n | ExistingCustomDataType\n | ExistingPageViewDataType;\n\nexport type ExistingArrayDataType = ExistingConversionDataType;\n\nexport type ExistingConversionDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.Conversion]\n>;\n\nexport type ExistingVisitsDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.VisitsData]\n>;\n\nexport type ExistingDataType<T extends KameleoonData> = NonNullable<\n KameleoonVisitorDataType[T]\n>;\n\nexport type KameleoonVisitorDataType<T = ActivityTimePropertyType> = {\n [KameleoonData.CustomData]?: {\n [index: string]: (CustomDataType & T) | undefined;\n };\n [KameleoonData.Conversion]?: (ConversionDataType & T)[];\n [KameleoonData.GeolocationData]?: GeolocationDataType & T;\n [KameleoonData.UserAgent]?: UserAgentDataType & T;\n [KameleoonData.PageView]?: { [url: string]: PageViewDataType & T };\n [KameleoonData.Browser]?: BrowserDataType & T;\n [KameleoonData.Device]?: DeviceDataType & T;\n [KameleoonData.Cookie]?: CookieDataType & T;\n [KameleoonData.OperatingSystem]?: OperatingSystemDataType & T;\n [KameleoonData.ApplicationVersion]?: ApplicationVersionDataType & T;\n [KameleoonData.VisitsData]?: VisitsDataType & T;\n};\n\nexport enum KameleoonData {\n CustomData = 'customData',\n PageView = 'pageView',\n GeolocationData = 'geolocation',\n Browser = 'browser',\n Conversion = 'conversion',\n Cookie = 'cookie',\n Device = 'device',\n OperatingSystem = 'operatingSystem',\n UserAgent = 'userAgent',\n ApplicationVersion = 'applicationVersion',\n VisitsData = 'visitsData',\n}\n\ntype SharedDataPropertiesType = {\n type: KameleoonData;\n sent: boolean;\n};\n\nexport type BrowserDataType = {\n browser: BrowserType;\n version?: number;\n} & SharedDataPropertiesType;\n\nexport type ConversionDataType = {\n goalId: number;\n revenue: number;\n negative: boolean;\n} & SharedDataPropertiesType;\n\nexport type CustomDataType = {\n index: number;\n value: string[];\n} & SharedDataPropertiesType;\n\nexport type DeviceDataType = {\n device: DeviceType;\n} & SharedDataPropertiesType;\n\nexport type VisitsDataType = {\n previousVisits: number[];\n currentVisit: number | null;\n} & SharedDataPropertiesType;\n\nexport type OperatingSystemDataType = {\n operatingSystem: OperatingSystemType;\n} & SharedDataPropertiesType;\n\nexport type CookieDataType = {\n cookie: CookieType[];\n} & SharedDataPropertiesType;\n\nexport type GeolocationDataType = GeolocationInfoType &\n SharedDataPropertiesType;\n\nexport type PageViewDataType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n timestamps: number[];\n} & SharedDataPropertiesType;\n\nexport type UserAgentDataType = {\n value: string;\n} & SharedDataPropertiesType;\n\nexport type ApplicationVersionDataType = {\n version: string;\n} & SharedDataPropertiesType;\n\n/**\n * @param {number} goalId - an id of a goal to track\n * @param {number | undefined} revenue - an optional parameter for revenue, default value is `0`\n * @param {boolean | undefined} negative - an optional parameter identifying whether the conversion should be removed, default value is `false`\n * */\nexport type ConversionParametersType = {\n goalId: number;\n revenue?: number;\n negative?: boolean;\n};\n\n/**\n * @param {string} urlAddress - url address of the page to track\n * @param {string} title - title of the web page\n * @param {number[] | undefined} referrers - an optional parameter containing a list of referrersIndices, has no default value\n * */\nexport type PageViewParametersType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for device type\n * */\nexport enum DeviceType {\n Phone = 'PHONE',\n Tablet = 'TABLET',\n Desktop = 'DESKTOP',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for operating system type\n * */\nexport enum OperatingSystemType {\n WindowsPhone = 'WINDOWS_PHONE',\n Windows = 'WINDOWS',\n Android = 'ANDROID',\n Linux = 'LINUX',\n Mac = 'MAC',\n IOS = 'IOS',\n}\n\n/**\n * @param {string} country - a country of a visitor\n * @param {string | undefined} region - an optional parameter containing a region of a visitor, has no default value\n * @param {string | undefined} city - an optional parameter containing a city of a visitor, has no default value\n * @param {string | undefined} postalCode - an optional parameter containing a postal code of a visitor, has no default value\n * @param {[number, number] | undefined} coordinates - an optional parameter containing a pair of coordinates (longitude and latitude) of a visitor, has no default value. Coordinate `number` represents decimal degrees (double that can be negative)\n * */\nexport type GeolocationInfoType = {\n country: string;\n region?: string;\n city?: string;\n postalCode?: string;\n coordinates?: [number, number];\n};\n\n/**\n * @param {string} key - a key of a cookie\n * @param {string} value - a value of a cookie\n * */\nexport type CookieType = {\n key: string;\n value: string;\n};\n\nexport type OptionalCookieType = Omit<CookieType, 'key'> & {\n key?: string;\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for browser type\n * */\nexport enum BrowserType {\n Chrome = 'CHROME',\n InternetExplorer = 'IE',\n Firefox = 'FIREFOX',\n Safari = 'SAFARI',\n Opera = 'OPERA',\n Other = 'OTHER',\n}\n\nexport const OperatingSystemIndexMap = {\n [OperatingSystemType.Windows]: 0,\n [OperatingSystemType.Mac]: 1,\n [OperatingSystemType.IOS]: 2,\n [OperatingSystemType.Linux]: 3,\n [OperatingSystemType.Android]: 4,\n [OperatingSystemType.WindowsPhone]: 5,\n} as const;\n\nexport const OperatingSystemTypeMap = constructTypeMap<OperatingSystemType>(\n OperatingSystemIndexMap,\n);\n\nexport const BrowserIndexMap = {\n [BrowserType.Chrome]: 0,\n [BrowserType.InternetExplorer]: 1,\n [BrowserType.Firefox]: 2,\n [BrowserType.Safari]: 3,\n [BrowserType.Opera]: 4,\n [BrowserType.Other]: 5,\n} as const;\n\nexport const BrowserTypeMap = constructTypeMap<BrowserType>(BrowserIndexMap);\n"],"mappings":"koCAsJY,CAAAA,aAAa,UAAbA,CAAa,QAAb,CAAAA,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AW,eAAA,CAAAD,qBAAA,CAC3Bf,mBAAmB,CAACM,GAAG,CAAG,CAAC,EAAAU,eAAA,CAAAD,qBAAA,CAC3Bf,mBAAmB,CAACI,KAAK,CAAG,CAAC,EAAAY,eAAA,CAAAD,qBAAA,CAC7Bf,mBAAmB,CAACG,OAAO,CAAG,CAAC,EAAAa,eAAA,CAAAD,qBAAA,CAC/Bf,mBAAmB,CAACC,YAAY,CAAG,CAAC,EAAAc,qBAAA,CAC7B,CAACpB,OAAA,CAAAmB,uBAAA,CAAAA,uBAAA,CAEJ,GAAM,CAAAG,sBAAsB,CAAG,GAAAC,yBAAgB,EACpDJ,uBAAuB,CACxB,CAACnB,OAAA,CAAAsB,sBAAA,CAAAA,sBAAA,CAEK,GAAM,CAAAE,eAAe,EAAAC,gBAAA,IAAAJ,eAAA,CAAAI,gBAAA,CACzBb,WAAW,CAACC,MAAM,CAAG,CAAC,EAAAQ,eAAA,CAAAI,gBAAA,CACtBb,WAAW,CAACE,gBAAgB,CAAG,CAAC,EAAAO,eAAA,CAAAI,gBAAA,CAChCb,WAAW,CAACG,OAAO,CAAG,CAAC,EAAAM,eAAA,CAAAI,gBAAA,CACvBb,WAAW,CAACI,MAAM,CAAG,CAAC,EAAAK,eAAA,CAAAI,gBAAA,CACtBb,WAAW,CAACK,KAAK,CAAG,CAAC,EAAAI,eAAA,CAAAI,gBAAA,CACrBb,WAAW,CAACM,KAAK,CAAG,CAAC,EAAAO,gBAAA,CACd,CAACzB,OAAA,CAAAwB,eAAA,CAAAA,eAAA,CAEJ,GAAM,CAAAE,cAAc,CAAG,GAAAH,yBAAgB,EAAcC,eAAe,CAAC,CAACxB,OAAA,CAAA0B,cAAA,CAAAA,cAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["KameleoonData","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","exports","DeviceType","Phone","Tablet","Desktop","OperatingSystemType","WindowsPhone","Windows","Android","Linux","Mac","IOS","BrowserType","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","OperatingSystemIndexMap","_OperatingSystemIndex","_defineProperty","OperatingSystemTypeMap","constructTypeMap","BrowserIndexMap","_BrowserIndexMap","BrowserTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import { TargetingDataType } from 'src/targeting';\nimport { IExternalStorage } from 'src/storage';\nimport {\n Browser,\n Conversion,\n Cookie,\n CustomData,\n Device,\n GeolocationData,\n OperatingSystem,\n PageView,\n UserAgent,\n ApplicationVersion,\n VisitsData,\n} from 'src/kameleoonData';\nimport { constructTypeMap } from './helpers';\n\n// --- Note ---\n// -- `Conversion`s are stored by `KameleoonData.Conversion` key in a form of an `KameleoonDataType[]` array\n// -- `PageView`s are store by `timestamp` (number) key in a form of `KameleoonDataType`\n// -- All the other unsent data types are stored in a form of `KameleoonData` key and `KameleoonDataType` value\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType | KameleoonDataType[]\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type FieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value:\n | BrowserDataType\n | CookieDataType\n | DeviceDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | UserAgentDataType\n | VisitsDataType;\n data: TargetingDataType;\n};\n\nexport type ArrayFieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value: ConversionDataType;\n data: TargetingDataType;\n};\nexport type NestedFieldParametersType = {\n visitorCode: string;\n key: KameleoonData.CustomData | KameleoonData.PageView;\n nestedKey: string;\n value: CustomDataType | PageViewDataType;\n data: TargetingDataType;\n};\n\nexport type DataManagerParametersType = {\n targetingCleanupInterval?: number;\n storage: IExternalStorage<TargetingDataType>;\n};\n\nexport type KameleoonDataItemType =\n | BrowserDataType\n | ConversionDataType\n | CustomDataType\n | DeviceDataType\n | PageViewDataType\n | UserAgentDataType\n | CookieDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | ApplicationVersionDataType\n | VisitsDataType;\n\n/**\n * @interface an interface of KameleoonData\n * each class instance will have url getter method\n * for handling url of different data types\n * */\nexport interface IKameleoonData {\n readonly url: string;\n readonly data: KameleoonDataItemType;\n isSent: boolean;\n}\n\n/**\n * @type a tuple of each possible type of data for `addData` method\n * of KameleoonClient\n * */\nexport type KameleoonDataType =\n | Browser\n | Conversion\n | CustomData\n | Device\n | PageView\n | UserAgent\n | VisitsData\n | GeolocationData\n | OperatingSystem\n | Cookie\n | ApplicationVersion;\n\nexport type ActivityTimePropertyType = {\n lastActivityTime: number;\n};\n\nexport type ExistingCustomDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.CustomData]\n>;\n\nexport type ExistingPageViewDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.PageView]\n>;\n\nexport type ExistingNestedDataType =\n | ExistingCustomDataType\n | ExistingPageViewDataType;\n\nexport type ExistingArrayDataType = ExistingConversionDataType;\n\nexport type ExistingConversionDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.Conversion]\n>;\n\nexport type ExistingVisitsDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.VisitsData]\n>;\n\nexport type ExistingDataType<T extends KameleoonData> = NonNullable<\n KameleoonVisitorDataType[T]\n>;\n\nexport type KameleoonVisitorDataType<T = ActivityTimePropertyType> = {\n [KameleoonData.CustomData]?: {\n [index: string]: (CustomDataType & T) | undefined;\n };\n [KameleoonData.Conversion]?: (ConversionDataType & T)[];\n [KameleoonData.GeolocationData]?: GeolocationDataType & T;\n [KameleoonData.UserAgent]?: UserAgentDataType & T;\n [KameleoonData.PageView]?: { [url: string]: PageViewDataType & T };\n [KameleoonData.Browser]?: BrowserDataType & T;\n [KameleoonData.Device]?: DeviceDataType & T;\n [KameleoonData.Cookie]?: CookieDataType & T;\n [KameleoonData.OperatingSystem]?: OperatingSystemDataType & T;\n [KameleoonData.ApplicationVersion]?: ApplicationVersionDataType & T;\n [KameleoonData.VisitsData]?: VisitsDataType & T;\n};\n\nexport enum KameleoonData {\n CustomData = 'customData',\n PageView = 'pageView',\n GeolocationData = 'geolocation',\n Browser = 'browser',\n Conversion = 'conversion',\n Cookie = 'cookie',\n Device = 'device',\n OperatingSystem = 'operatingSystem',\n UserAgent = 'userAgent',\n ApplicationVersion = 'applicationVersion',\n VisitsData = 'visitsData',\n}\n\ntype SharedDataPropertiesType = {\n type: KameleoonData;\n sent: boolean;\n};\n\nexport type BrowserDataType = {\n browser: BrowserType;\n version?: number;\n} & SharedDataPropertiesType;\n\nexport type ConversionDataType = {\n goalId: number;\n revenue: number;\n negative: boolean;\n} & SharedDataPropertiesType;\n\nexport type CustomDataType = {\n index: number;\n value: string[];\n isIdentifier: boolean;\n} & SharedDataPropertiesType;\n\nexport type DeviceDataType = {\n device: DeviceType;\n} & SharedDataPropertiesType;\n\nexport type VisitsDataType = {\n previousVisits: number[];\n currentVisit: number | null;\n} & SharedDataPropertiesType;\n\nexport type OperatingSystemDataType = {\n operatingSystem: OperatingSystemType;\n} & SharedDataPropertiesType;\n\nexport type CookieDataType = {\n cookie: CookieType[];\n} & SharedDataPropertiesType;\n\nexport type GeolocationDataType = GeolocationInfoType &\n SharedDataPropertiesType;\n\nexport type PageViewDataType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n timestamps: number[];\n} & SharedDataPropertiesType;\n\nexport type UserAgentDataType = {\n value: string;\n} & SharedDataPropertiesType;\n\nexport type ApplicationVersionDataType = {\n version: string;\n} & SharedDataPropertiesType;\n\n/**\n * @param {number} goalId - an id of a goal to track\n * @param {number | undefined} revenue - an optional parameter for revenue, default value is `0`\n * @param {boolean | undefined} negative - an optional parameter identifying whether the conversion should be removed, default value is `false`\n * */\nexport type ConversionParametersType = {\n goalId: number;\n revenue?: number;\n negative?: boolean;\n};\n\n/**\n * @param {string} urlAddress - url address of the page to track\n * @param {string} title - title of the web page\n * @param {number[] | undefined} referrers - an optional parameter containing a list of referrersIndices, has no default value\n * */\nexport type PageViewParametersType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for device type\n * */\nexport enum DeviceType {\n Phone = 'PHONE',\n Tablet = 'TABLET',\n Desktop = 'DESKTOP',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for operating system type\n * */\nexport enum OperatingSystemType {\n WindowsPhone = 'WINDOWS_PHONE',\n Windows = 'WINDOWS',\n Android = 'ANDROID',\n Linux = 'LINUX',\n Mac = 'MAC',\n IOS = 'IOS',\n}\n\n/**\n * @param {string} country - a country of a visitor\n * @param {string | undefined} region - an optional parameter containing a region of a visitor, has no default value\n * @param {string | undefined} city - an optional parameter containing a city of a visitor, has no default value\n * @param {string | undefined} postalCode - an optional parameter containing a postal code of a visitor, has no default value\n * @param {[number, number] | undefined} coordinates - an optional parameter containing a pair of coordinates (longitude and latitude) of a visitor, has no default value. Coordinate `number` represents decimal degrees (double that can be negative)\n * */\nexport type GeolocationInfoType = {\n country: string;\n region?: string;\n city?: string;\n postalCode?: string;\n coordinates?: [number, number];\n};\n\n/**\n * @param {string} key - a key of a cookie\n * @param {string} value - a value of a cookie\n * */\nexport type CookieType = {\n key: string;\n value: string;\n};\n\nexport type OptionalCookieType = Omit<CookieType, 'key'> & {\n key?: string;\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for browser type\n * */\nexport enum BrowserType {\n Chrome = 'CHROME',\n InternetExplorer = 'IE',\n Firefox = 'FIREFOX',\n Safari = 'SAFARI',\n Opera = 'OPERA',\n Other = 'OTHER',\n}\n\nexport const OperatingSystemIndexMap = {\n [OperatingSystemType.Windows]: 0,\n [OperatingSystemType.Mac]: 1,\n [OperatingSystemType.IOS]: 2,\n [OperatingSystemType.Linux]: 3,\n [OperatingSystemType.Android]: 4,\n [OperatingSystemType.WindowsPhone]: 5,\n} as const;\n\nexport const OperatingSystemTypeMap = constructTypeMap<OperatingSystemType>(\n OperatingSystemIndexMap,\n);\n\nexport const BrowserIndexMap = {\n [BrowserType.Chrome]: 0,\n [BrowserType.InternetExplorer]: 1,\n [BrowserType.Firefox]: 2,\n [BrowserType.Safari]: 3,\n [BrowserType.Opera]: 4,\n [BrowserType.Other]: 5,\n} as const;\n\nexport const BrowserTypeMap = constructTypeMap<BrowserType>(BrowserIndexMap);\n"],"mappings":"koCAsJY,CAAAA,aAAa,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,UAAA,cAAbD,CAAa,CAAAE,QAAA,YAAbF,CAAa,CAAAG,eAAA,eAAbH,CAAa,CAAAI,OAAA,WAAbJ,CAAa,CAAAK,UAAA,cAAbL,CAAa,CAAAM,MAAA,UAAbN,CAAa,CAAAO,MAAA,UAAbP,CAAa,CAAAQ,eAAA,mBAAbR,CAAa,CAAAS,SAAA,aAAbT,CAAa,CAAAU,kBAAA,sBAAbV,CAAa,CAAAW,UAAA,cAAbX,CAAa,MAAAY,OAAA,CAAAZ,aAAA,CAAAA,aAAA,IAiGb,CAAAa,UAAU,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAAC,KAAA,SAAVD,CAAU,CAAAE,MAAA,UAAVF,CAAU,CAAAG,OAAA,WAAVH,CAAU,MAAAD,OAAA,CAAAC,UAAA,CAAAA,UAAA,IAUV,CAAAI,mBAAmB,UAAnBA,CAAmB,QAAnB,CAAAA,CAAmB,CAAAC,YAAA,iBAAnBD,CAAmB,CAAAE,OAAA,WAAnBF,CAAmB,CAAAG,OAAA,WAAnBH,CAAmB,CAAAI,KAAA,SAAnBJ,CAAmB,CAAAK,GAAA,OAAnBL,CAAmB,CAAAM,GAAA,OAAnBN,CAAmB,MAAAL,OAAA,CAAAK,mBAAA,CAAAA,mBAAA,IAyCnB,CAAAO,WAAW,UAAXA,CAAW,QAAX,CAAAA,CAAW,CAAAC,MAAA,UAAXD,CAAW,CAAAE,gBAAA,MAAXF,CAAW,CAAAG,OAAA,WAAXH,CAAW,CAAAI,MAAA,UAAXJ,CA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CAEJ,GAAM,CAAAE,cAAc,CAAG,GAAAH,yBAAgB,EAAcC,eAAe,CAAC,CAACxB,OAAA,CAAA0B,cAAA,CAAAA,cAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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:"¤tVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"®ion=",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")}
|
|
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:"¤tVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"®ion=",Latitude:"&latitude=",Longitude:"&longitude=",PostalCode:"&postalCode=",Conversion:"&conversion=",StaticData:"&staticData=",Geolocation:"&geolocation=",Page:"&page=",Experiment:"&experiment=",Browser:"&browser=",Environment:"&environment=",MappingIdentifier:"&mappingIdentifier="};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=",MappingIdentifier:"?mappingIdentifier="};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","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: '¤tVisit=',\n MaxNumberPreviousVisits: '&maxNumberPreviousVisits=',\n Os: '&os=',\n OsIndex: '&osIndex=',\n Country: '&country=',\n City: '&city=',\n Region: '®ion=',\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 `https://${siteCode}.kameleoon.eu/sdk-config`;\n}\n"],"mappings":"8QAYY,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,CAOX,GAAM,CAAAM,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,CAACR,OAAA,CAAAC,YAAA,CAAAA,YAAA,CACK,GAAM,CAAAQ,YAAkD,CAAG,CAChEC,KAAK,CAAE,SAAS,CAChBC,gBAAgB,CAAE,oBAAoB,CACtCC,QAAQ,CAAE,YAAY,CACtBC,OAAO,CAAE,WAAW,CACpBC,SAAS,CAAE,aAAa,CACxBC,KAAK,CAAE,SAAS,CAChBC,YAAY,CAAE,gBAAgB,CAC9BC,cAAc,CAAE,kBAAkB,CAClCC,IAAI,CAAE,QAAQ,CACdC,UAAU,CAAE,cAAc,CAC1BC,QAAQ,CAAE,YAAY,CACtBC,MAAM,CAAE,UAAU,CAClBC,WAAW,CAAE,eAAe,CAC5BC,WAAW,CAAE,eAAe,CAC5BC,EAAE,CAAE,MAAM,CACVC,GAAG,CAAE,OAAO,CACZC,OAAO,CAAE,WAAW,CACpBC,UAAU,CAAE,cAAc,CAC1BC,cAAc,CAAE,kBAAkB,CAClCC,KAAK,CAAE,SAAS,CAChBC,EAAE,CAAE,MAAM,CACV5B,UAAU,CAAE,cAAc,CAC1B6B,YAAY,CAAE,gBAAgB,CAC9BC,uBAAuB,CAAE,2BAA2B,CACpDC,EAAE,CAAE,MAAM,CACVC,OAAO,CAAE,WAAW,CACpBC,OAAO,CAAE,WAAW,CACpBC,IAAI,CAAE,QAAQ,CACdC,MAAM,CAAE,UAAU,CAClBC,QAAQ,CAAE,YAAY,CACtBC,SAAS,CAAE,aAAa,CACxBC,UAAU,CAAE,cAAc,CAC1BnC,UAAU,CAAE,cAAc,CAC1BF,UAAU,CAAE,cAAc,CAC1BK,WAAW,CAAE,eAAe,CAC5BJ,IAAI,CAAE,QAAQ,CACdG,UAAU,CAAE,cAAc,CAC1BkC,OAAO,CAAE,WAAW,CACpBC,WAAW,CAAE,
|
|
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","MappingIdentifier","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: '¤tVisit=',\n MaxNumberPreviousVisits: '&maxNumberPreviousVisits=',\n Os: '&os=',\n OsIndex: '&osIndex=',\n Country: '&country=',\n City: '&city=',\n Region: '®ion=',\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 MappingIdentifier: '&mappingIdentifier=',\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 MappingIdentifier: '?mappingIdentifier=',\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 `https://${siteCode}.kameleoon.eu/sdk-config`;\n}\n"],"mappings":"8QAYY,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,CAOX,GAAM,CAAAM,YAA8C,CAAG,CAC5DC,UAAU,CAAE,sBAAsB,CAClCC,UAAU,CAAE,sBAAsB,CAClCC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CAAAC,QAAsC,CAAG,CACpDC,GAAG,CAAE,eAAe,CACpBC,GAAG,CAAE,eAAe,CACpBC,MAAM,CAAE,kBAAkB,CAC1BC,OAAO,CAAE,mBACX,CAAC,CAACjD,OAAA,CAAA6C,QAAA,CAAAA,QAAA,CACK,GAAM,CAAAK,WAA+C,CAAG,CAC7DC,KAAK,CAAE,QAAQ,CACfJ,GAAG,CAAE,MACP,CAAC,CAAC/C,OAAA,CAAAkD,WAAA,CAAAA,WAAA,IAEI,CAAAE,cAAc,CAA6C,IAAI,CAE/DC,YAAY,2BAAAC,MAAA,MAA6C,CAElDC,GAAG,CAAG,CACjBC,kBAAkB,CAAE,oCAAoC,CACxDC,WAAW,IAAAH,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIJ,WAAW,CAACC,KAAK,CAAGN,QAAQ,CAACG,MAAM,CAAE,CACrEU,UAAU,IAAAJ,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIJ,WAAW,CAACC,KAAK,CAAGN,QAAQ,CAACI,OAAO,CAAE,CACrEU,QAAQ,IAAAL,MAAA,CAAKD,YAAY,MAAAC,MAAA,CAAIJ,WAAW,CAACH,GAAG,CAAGF,QAAQ,CAACE,GAAG,CAC7D,CAAC,CAAA/C,OAAA,CAAAuD,GAAA,CAAAA,GAAA,CAEM,QAAS,CAAAK,yBAAyBA,CAACC,CAAgB,CAAU,CAClE,iBAAAP,MAAA,CAAkBO,CAAQ,4BAC5B"}
|
|
@@ -117,7 +117,7 @@ export declare enum HttpMethod {
|
|
|
117
117
|
Post = "POST"
|
|
118
118
|
}
|
|
119
119
|
declare const EVENT_TYPE_KEYS: readonly ["customData", "staticData", "page", "conversion", "geolocation", "activity", "experiment"];
|
|
120
|
-
declare const PARAMETER_KEYS: readonly ["valuesCountMap", "id", "nonce", "country", "environment", "city", "region", "latitude", "geolocation", "longitude", "postalCode", "sdkName", "sdkVersion", "browserIndex", "browserVersion", "siteCode", "visitorCode", "currentVisit", "maxNumberPreviousVisits", "customData", "negative", "revenue", "title", "os", "conversion", "staticData", "osIndex", "browser", "referrersIndices", "overwrite", "index", "href", "experiment", "page", "variationId", "deviceType", "goalId", "ts", "key"];
|
|
120
|
+
declare const PARAMETER_KEYS: readonly ["valuesCountMap", "id", "nonce", "country", "environment", "city", "region", "latitude", "geolocation", "longitude", "mappingIdentifier", "postalCode", "sdkName", "sdkVersion", "browserIndex", "browserVersion", "siteCode", "visitorCode", "currentVisit", "maxNumberPreviousVisits", "customData", "negative", "revenue", "title", "os", "conversion", "staticData", "osIndex", "browser", "referrersIndices", "overwrite", "index", "href", "experiment", "page", "variationId", "deviceType", "goalId", "ts", "key"];
|
|
121
121
|
declare const TRACKING_KEYS: readonly ["visit", "map"];
|
|
122
122
|
declare const QUERY_KEYS: readonly ["sse", "visitor", "map", "events"];
|
|
123
123
|
export type TrackingType = Record<Capitalize<(typeof TRACKING_KEYS)[number]>, string>;
|
package/dist/requester/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpMethod=void 0;var HttpMethod=function(a){return a.Get="GET",a.Post="POST",a}({});exports.HttpMethod=HttpMethod;var EVENT_TYPE_KEYS=["customData","staticData","page","conversion","geolocation","activity","experiment"],PARAMETER_KEYS=["valuesCountMap","id","nonce","country","environment","city","region","latitude","geolocation","longitude","postalCode","sdkName","sdkVersion","browserIndex","browserVersion","siteCode","visitorCode","currentVisit","maxNumberPreviousVisits","customData","negative","revenue","title","os","conversion","staticData","osIndex","browser","referrersIndices","overwrite","index","href","experiment","page","variationId","deviceType","goalId","ts","key"],TRACKING_KEYS=["visit","map"],QUERY_KEYS=["sse","visitor","map","events"];
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpMethod=void 0;var HttpMethod=function(a){return a.Get="GET",a.Post="POST",a}({});exports.HttpMethod=HttpMethod;var EVENT_TYPE_KEYS=["customData","staticData","page","conversion","geolocation","activity","experiment"],PARAMETER_KEYS=["valuesCountMap","id","nonce","country","environment","city","region","latitude","geolocation","longitude","mappingIdentifier","postalCode","sdkName","sdkVersion","browserIndex","browserVersion","siteCode","visitorCode","currentVisit","maxNumberPreviousVisits","customData","negative","revenue","title","os","conversion","staticData","osIndex","browser","referrersIndices","overwrite","index","href","experiment","page","variationId","deviceType","goalId","ts","key"],TRACKING_KEYS=["visit","map"],QUERY_KEYS=["sse","visitor","map","events"];
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["HttpMethod","Get","Post","exports","EVENT_TYPE_KEYS","PARAMETER_KEYS","TRACKING_KEYS","QUERY_KEYS"],"sources":["../../src/requester/types.ts"],"sourcesContent":["import { JSONType } from 'src/clientConfiguration';\nimport { Environment, ExternalPackageInfoType } from 'src/types';\nimport {\n BrowserIndexMap,\n BrowserType,\n OperatingSystemType,\n} from 'src/kameleoonData';\nimport { Header } from './constants';\nimport { DeviceType, OperatingSystemIndexMap } from 'src/kameleoonData/types';\n\nexport type RequesterParamsType = {\n siteCode: string;\n environment?: Environment;\n packageInfo: ExternalPackageInfoType;\n requestDispatcher: IExternalRequestDispatcher;\n};\n\nexport type TrackExperimentParamsType = {\n body: string;\n variationId: number;\n visitorCode: string;\n experimentId: number;\n isUnallocated: boolean;\n isConsentProvided: boolean;\n userAgent?: string;\n isTargetedRule?: boolean;\n};\n\nexport type TrackDataParamsType = {\n visitorCode: string;\n body: string;\n userAgent?: string;\n};\n\ntype EventDataType = {\n sdk?: {\n name: string;\n version: string;\n };\n itp: boolean;\n time: number;\n};\n\ntype CustomDataEventType = {\n data: {\n index: number;\n valuesCountMap: {\n [value: string]: number;\n };\n overwrite: boolean;\n mappingIdentifier: boolean;\n };\n} & EventDataType;\n\ntype ExperimentEventType = {\n data: {\n id: number;\n variationId: number;\n };\n} & EventDataType;\n\ntype ConversionEventType = {\n data: {\n goalId: number;\n revenue: number;\n negative: boolean;\n };\n} & EventDataType;\n\ntype BrowserIndexType = (typeof BrowserIndexMap)[BrowserType];\ntype OperatingSystemIndexType =\n (typeof OperatingSystemIndexMap)[OperatingSystemType];\n\nexport type PageEventType = {\n data: {\n href: string;\n canonicalHref: string | null;\n title: string;\n keyPagesIndices: number[] | [null];\n referrerHref: string | null;\n referrersIndices: number[] | [null];\n };\n} & EventDataType;\n\nexport type GeolocationEventType = {\n data: {\n country: string;\n region: string | null;\n city: string | null;\n postalCode: string | null;\n latitude: number | null;\n longitude: number | null;\n };\n} & EventDataType;\n\nexport type StaticDataEventType = {\n data: {\n visitNumber: number;\n timeSincePreviousVisit: number;\n firstReferrerHref: string | null;\n browser: BrowserType | null;\n browserIndex: BrowserIndexType | null;\n browserVersion: number | null;\n os: OperatingSystemType | null;\n osIndex: OperatingSystemIndexType | null;\n windowWidth: number | null;\n windowHeight: number | null;\n screenWidth: number | null;\n screenHeight: number | null;\n timeZoneId: string | null;\n localeLanguageTag: string | null;\n deviceType: DeviceType | null;\n mappingIdentifier: string | null;\n };\n} & EventDataType;\n\nexport type VisitType = {\n siteCode: string;\n visitorCode: string;\n timeStarted: number;\n customDataEvents?: CustomDataEventType[];\n experimentEvents?: ExperimentEventType[];\n conversionEvents?: ConversionEventType[];\n geolocationEvents?: GeolocationEventType[];\n staticDataEvent?: StaticDataEventType;\n pageEvents?: PageEventType[];\n};\n\nexport type GetVisitorDataResultType = {\n previousVisits?: VisitType[];\n currentVisit?: VisitType;\n};\n\nexport enum HttpMethod {\n Get = 'GET',\n Post = 'POST',\n}\n\nconst EVENT_TYPE_KEYS = [\n 'customData',\n 'staticData',\n 'page',\n 'conversion',\n 'geolocation',\n 'activity',\n 'experiment',\n] as const;\nconst PARAMETER_KEYS = [\n 'valuesCountMap',\n 'id',\n 'nonce',\n 'country',\n 'environment',\n 'city',\n 'region',\n 'latitude',\n 'geolocation',\n 'longitude',\n 'postalCode',\n 'sdkName',\n 'sdkVersion',\n 'browserIndex',\n 'browserVersion',\n 'siteCode',\n 'visitorCode',\n 'currentVisit',\n 'maxNumberPreviousVisits',\n 'customData',\n 'negative',\n 'revenue',\n 'title',\n 'os',\n 'conversion',\n 'staticData',\n 'osIndex',\n 'browser',\n 'referrersIndices',\n 'overwrite',\n 'index',\n 'href',\n 'experiment',\n 'page',\n 'variationId',\n 'deviceType',\n 'goalId',\n 'ts',\n 'key',\n] as const;\nconst TRACKING_KEYS = ['visit', 'map'] as const;\nconst QUERY_KEYS = ['sse', 'visitor', 'map', 'events'] as const;\n\nexport type TrackingType = Record<\n Capitalize<(typeof TRACKING_KEYS)[number]>,\n string\n>;\nexport type QueryType = Record<Capitalize<(typeof QUERY_KEYS)[number]>, string>;\nexport type ParameterType = Record<\n Capitalize<(typeof PARAMETER_KEYS)[number]>,\n string\n>;\nexport type EventType = Record<\n Capitalize<(typeof EVENT_TYPE_KEYS)[number]>,\n string\n>;\n\nexport type StrictTrackingRecord<T> = {\n [K in keyof T]: `${Uncapitalize<K & string>}/`;\n};\nexport type StrictQueryRecord<T> = {\n [K in keyof T]: `${Uncapitalize<K & string>}?siteCode=`;\n};\nexport type StrictEventTypeRecord<T> = {\n [K in keyof T]: `eventType=${Uncapitalize<K & string>}`;\n};\nexport type StrictParameterRecord<T> = {\n [K in keyof T]: `&${Uncapitalize<K & string>}=`;\n};\nexport type StrictFirstParameterRecord<T> = {\n [K in keyof T]: `?${Uncapitalize<K & string>}=`;\n};\n\nexport type TrackParametersType = {\n url: string;\n headers?: Partial<Record<Header, string>>;\n body: string;\n};\n\n/**\n * @interface an interface of External Request Dispatcher which will be used to perform requests.\n * */\nexport interface IExternalRequestDispatcher {\n /**\n * @method track - send a track request\n * @param {TrackParametersType} parameters - track parameters\n * */\n track: (params: TrackParametersType) => Promise<boolean>;\n /**\n * @method getClientConfiguration - get client configuration\n * @param {string} url - url address\n * */\n getClientConfiguration: (url: string) => Promise<JSONType>;\n /**\n * @method getRemoteData - get data from remote server of Kameleoon\n * @param {string} url - url address\n * */\n getRemoteData: (url: string) => Promise<JSONType>;\n}\n"],"mappings":"iGAqIY,CAAAA,UAAU,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAAC,GAAA,OAAVD,CAAU,CAAAE,IAAA,QAAVF,CAAU,MAAAG,OAAA,CAAAH,UAAA,CAAAA,UAAA,IAKhB,CAAAI,eAAe,CAAG,CACtB,YAAY,CACZ,YAAY,CACZ,MAAM,CACN,YAAY,CACZ,aAAa,CACb,UAAU,CACV,YAAY,CACJ,CACJC,cAAc,CAAG,CACrB,gBAAgB,CAChB,IAAI,CACJ,OAAO,CACP,SAAS,CACT,aAAa,CACb,MAAM,CACN,QAAQ,CACR,UAAU,CACV,aAAa,CACb,WAAW,CACX,YAAY,CACZ,SAAS,CACT,YAAY,CACZ,cAAc,CACd,gBAAgB,CAChB,UAAU,CACV,aAAa,CACb,cAAc,CACd,yBAAyB,CACzB,YAAY,CACZ,UAAU,CACV,SAAS,CACT,OAAO,CACP,IAAI,CACJ,YAAY,CACZ,YAAY,CACZ,SAAS,CACT,SAAS,CACT,kBAAkB,CAClB,WAAW,CACX,OAAO,CACP,MAAM,CACN,YAAY,CACZ,MAAM,CACN,aAAa,CACb,YAAY,CACZ,QAAQ,CACR,IAAI,CACJ,KAAK,CACG,CACJC,aAAa,CAAG,CAAC,OAAO,CAAE,KAAK,CAAU,CACzCC,UAAU,CAAG,CAAC,KAAK,CAAE,SAAS,CAAE,KAAK,CAAE,QAAQ,CAAU"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["HttpMethod","Get","Post","exports","EVENT_TYPE_KEYS","PARAMETER_KEYS","TRACKING_KEYS","QUERY_KEYS"],"sources":["../../src/requester/types.ts"],"sourcesContent":["import { JSONType } from 'src/clientConfiguration';\nimport { Environment, ExternalPackageInfoType } from 'src/types';\nimport {\n BrowserIndexMap,\n BrowserType,\n OperatingSystemType,\n} from 'src/kameleoonData';\nimport { Header } from './constants';\nimport { DeviceType, OperatingSystemIndexMap } from 'src/kameleoonData/types';\n\nexport type RequesterParamsType = {\n siteCode: string;\n environment?: Environment;\n packageInfo: ExternalPackageInfoType;\n requestDispatcher: IExternalRequestDispatcher;\n};\n\nexport type TrackExperimentParamsType = {\n body: string;\n variationId: number;\n visitorCode: string;\n experimentId: number;\n isUnallocated: boolean;\n isConsentProvided: boolean;\n userAgent?: string;\n isTargetedRule?: boolean;\n};\n\nexport type TrackDataParamsType = {\n visitorCode: string;\n body: string;\n userAgent?: string;\n};\n\ntype EventDataType = {\n sdk?: {\n name: string;\n version: string;\n };\n itp: boolean;\n time: number;\n};\n\ntype CustomDataEventType = {\n data: {\n index: number;\n valuesCountMap: {\n [value: string]: number;\n };\n overwrite: boolean;\n mappingIdentifier: boolean;\n };\n} & EventDataType;\n\ntype ExperimentEventType = {\n data: {\n id: number;\n variationId: number;\n };\n} & EventDataType;\n\ntype ConversionEventType = {\n data: {\n goalId: number;\n revenue: number;\n negative: boolean;\n };\n} & EventDataType;\n\ntype BrowserIndexType = (typeof BrowserIndexMap)[BrowserType];\ntype OperatingSystemIndexType =\n (typeof OperatingSystemIndexMap)[OperatingSystemType];\n\nexport type PageEventType = {\n data: {\n href: string;\n canonicalHref: string | null;\n title: string;\n keyPagesIndices: number[] | [null];\n referrerHref: string | null;\n referrersIndices: number[] | [null];\n };\n} & EventDataType;\n\nexport type GeolocationEventType = {\n data: {\n country: string;\n region: string | null;\n city: string | null;\n postalCode: string | null;\n latitude: number | null;\n longitude: number | null;\n };\n} & EventDataType;\n\nexport type StaticDataEventType = {\n data: {\n visitNumber: number;\n timeSincePreviousVisit: number;\n firstReferrerHref: string | null;\n browser: BrowserType | null;\n browserIndex: BrowserIndexType | null;\n browserVersion: number | null;\n os: OperatingSystemType | null;\n osIndex: OperatingSystemIndexType | null;\n windowWidth: number | null;\n windowHeight: number | null;\n screenWidth: number | null;\n screenHeight: number | null;\n timeZoneId: string | null;\n localeLanguageTag: string | null;\n deviceType: DeviceType | null;\n mappingIdentifier: string | null;\n };\n} & EventDataType;\n\nexport type VisitType = {\n siteCode: string;\n visitorCode: string;\n timeStarted: number;\n customDataEvents?: CustomDataEventType[];\n experimentEvents?: ExperimentEventType[];\n conversionEvents?: ConversionEventType[];\n geolocationEvents?: GeolocationEventType[];\n staticDataEvent?: StaticDataEventType;\n pageEvents?: PageEventType[];\n};\n\nexport type GetVisitorDataResultType = {\n previousVisits?: VisitType[];\n currentVisit?: VisitType;\n};\n\nexport enum HttpMethod {\n Get = 'GET',\n Post = 'POST',\n}\n\nconst EVENT_TYPE_KEYS = [\n 'customData',\n 'staticData',\n 'page',\n 'conversion',\n 'geolocation',\n 'activity',\n 'experiment',\n] as const;\nconst PARAMETER_KEYS = [\n 'valuesCountMap',\n 'id',\n 'nonce',\n 'country',\n 'environment',\n 'city',\n 'region',\n 'latitude',\n 'geolocation',\n 'longitude',\n 'mappingIdentifier',\n 'postalCode',\n 'sdkName',\n 'sdkVersion',\n 'browserIndex',\n 'browserVersion',\n 'siteCode',\n 'visitorCode',\n 'currentVisit',\n 'maxNumberPreviousVisits',\n 'customData',\n 'negative',\n 'revenue',\n 'title',\n 'os',\n 'conversion',\n 'staticData',\n 'osIndex',\n 'browser',\n 'referrersIndices',\n 'overwrite',\n 'index',\n 'href',\n 'experiment',\n 'page',\n 'variationId',\n 'deviceType',\n 'goalId',\n 'ts',\n 'key',\n] as const;\nconst TRACKING_KEYS = ['visit', 'map'] as const;\nconst QUERY_KEYS = ['sse', 'visitor', 'map', 'events'] as const;\n\nexport type TrackingType = Record<\n Capitalize<(typeof TRACKING_KEYS)[number]>,\n string\n>;\nexport type QueryType = Record<Capitalize<(typeof QUERY_KEYS)[number]>, string>;\nexport type ParameterType = Record<\n Capitalize<(typeof PARAMETER_KEYS)[number]>,\n string\n>;\nexport type EventType = Record<\n Capitalize<(typeof EVENT_TYPE_KEYS)[number]>,\n string\n>;\n\nexport type StrictTrackingRecord<T> = {\n [K in keyof T]: `${Uncapitalize<K & string>}/`;\n};\nexport type StrictQueryRecord<T> = {\n [K in keyof T]: `${Uncapitalize<K & string>}?siteCode=`;\n};\nexport type StrictEventTypeRecord<T> = {\n [K in keyof T]: `eventType=${Uncapitalize<K & string>}`;\n};\nexport type StrictParameterRecord<T> = {\n [K in keyof T]: `&${Uncapitalize<K & string>}=`;\n};\nexport type StrictFirstParameterRecord<T> = {\n [K in keyof T]: `?${Uncapitalize<K & string>}=`;\n};\n\nexport type TrackParametersType = {\n url: string;\n headers?: Partial<Record<Header, string>>;\n body: string;\n};\n\n/**\n * @interface an interface of External Request Dispatcher which will be used to perform requests.\n * */\nexport interface IExternalRequestDispatcher {\n /**\n * @method track - send a track request\n * @param {TrackParametersType} parameters - track parameters\n * */\n track: (params: TrackParametersType) => Promise<boolean>;\n /**\n * @method getClientConfiguration - get client configuration\n * @param {string} url - url address\n * */\n getClientConfiguration: (url: string) => Promise<JSONType>;\n /**\n * @method getRemoteData - get data from remote server of Kameleoon\n * @param {string} url - url address\n * */\n getRemoteData: (url: string) => Promise<JSONType>;\n}\n"],"mappings":"iGAqIY,CAAAA,UAAU,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAAC,GAAA,OAAVD,CAAU,CAAAE,IAAA,QAAVF,CAAU,MAAAG,OAAA,CAAAH,UAAA,CAAAA,UAAA,IAKhB,CAAAI,eAAe,CAAG,CACtB,YAAY,CACZ,YAAY,CACZ,MAAM,CACN,YAAY,CACZ,aAAa,CACb,UAAU,CACV,YAAY,CACJ,CACJC,cAAc,CAAG,CACrB,gBAAgB,CAChB,IAAI,CACJ,OAAO,CACP,SAAS,CACT,aAAa,CACb,MAAM,CACN,QAAQ,CACR,UAAU,CACV,aAAa,CACb,WAAW,CACX,mBAAmB,CACnB,YAAY,CACZ,SAAS,CACT,YAAY,CACZ,cAAc,CACd,gBAAgB,CAChB,UAAU,CACV,aAAa,CACb,cAAc,CACd,yBAAyB,CACzB,YAAY,CACZ,UAAU,CACV,SAAS,CACT,OAAO,CACP,IAAI,CACJ,YAAY,CACZ,YAAY,CACZ,SAAS,CACT,SAAS,CACT,kBAAkB,CAClB,WAAW,CACX,OAAO,CACP,MAAM,CACN,YAAY,CACZ,MAAM,CACN,aAAa,CACb,YAAY,CACZ,QAAQ,CACR,IAAI,CACJ,KAAK,CACG,CACJC,aAAa,CAAG,CAAC,OAAO,CAAE,KAAK,CAAU,CACzCC,UAAU,CAAG,CAAC,KAAK,CAAE,SAAS,CAAE,KAAK,CAAE,QAAQ,CAAU"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CacheManager } from '../cacheManager';
|
|
2
2
|
import { ClientConfiguration } from '../clientConfiguration';
|
|
3
3
|
import { DataManager } from '../kameleoonData';
|
|
4
|
-
import { KameleoonVisitorDataType } from '../kameleoonData/types';
|
|
4
|
+
import { KameleoonDataType, KameleoonVisitorDataType } from '../kameleoonData/types';
|
|
5
5
|
import { Requester } from '../requester';
|
|
6
6
|
import { GetVisitorDataResultType, TrackDataParamsType, TrackExperimentParamsType } from '../requester/types';
|
|
7
7
|
import { IExternalStorage, OfflineTracking } from '../storage/types';
|
|
@@ -40,6 +40,10 @@ export type ParseVisitorDataParametersType = {
|
|
|
40
40
|
visitorCode: string;
|
|
41
41
|
variationConfiguration: VariationConfiguration;
|
|
42
42
|
};
|
|
43
|
+
export type ParseVisitorDataResultType = {
|
|
44
|
+
visitorData: KameleoonDataType[];
|
|
45
|
+
visitsData?: KameleoonDataType;
|
|
46
|
+
};
|
|
43
47
|
export type TrackRuleParametersType = {
|
|
44
48
|
featureFlagVariation: FeatureFlagVariationType;
|
|
45
49
|
dataManager: DataManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["TimeUnit","Minute","Hour","Day","Week","Month","exports","Order","Ascending","Descending"],"sources":["../../src/utilities/types.ts"],"sourcesContent":["import { CacheManager } from 'src/cacheManager';\nimport { ClientConfiguration } from 'src/clientConfiguration';\nimport { DataManager } from 'src/kameleoonData';\nimport {
|
|
1
|
+
{"version":3,"file":"types.js","names":["TimeUnit","Minute","Hour","Day","Week","Month","exports","Order","Ascending","Descending"],"sources":["../../src/utilities/types.ts"],"sourcesContent":["import { CacheManager } from 'src/cacheManager';\nimport { ClientConfiguration } from 'src/clientConfiguration';\nimport { DataManager } from 'src/kameleoonData';\nimport {\n KameleoonDataType,\n KameleoonVisitorDataType,\n} from 'src/kameleoonData/types';\nimport { Requester } from 'src/requester';\nimport {\n GetVisitorDataResultType,\n TrackDataParamsType,\n TrackExperimentParamsType,\n} from 'src/requester/types';\nimport { IExternalStorage, OfflineTracking } from 'src/storage/types';\nimport { SegmentType } from 'src/targeting';\nimport { ExternalPackageInfoType, TrackingCacheItemType } from 'src/types';\nimport {\n VariationConfiguration,\n FeatureFlagVariationType,\n} from 'src/variationConfiguration';\n\nexport type CheckTargetingParametersType = {\n segment: SegmentType | null;\n experimentId: number | null;\n visitorCode: string;\n packageInfo: ExternalPackageInfoType;\n targetingData: KameleoonVisitorDataType;\n clientConfiguration: ClientConfiguration;\n variationConfiguration?: VariationConfiguration;\n dataManager: DataManager;\n};\n\nexport enum TimeUnit {\n Minute = 'MINUTE',\n Hour = 'HOUR',\n Day = 'DAY',\n Week = 'WEEK',\n Month = 'MONTH',\n}\n\nexport enum Order {\n Ascending = 'asc',\n Descending = 'desc',\n}\n\nexport type InsertInOrderedListParametersType = {\n list: number[];\n element: number;\n order: Order;\n};\n\nexport type ParseVisitorDataParametersType = {\n data: GetVisitorDataResultType;\n filters: VisitorDataFiltersType;\n visitorCode: string;\n variationConfiguration: VariationConfiguration;\n};\n\nexport type ParseVisitorDataResultType = {\n visitorData: KameleoonDataType[];\n visitsData?: KameleoonDataType;\n};\n\nexport type TrackRuleParametersType = {\n featureFlagVariation: FeatureFlagVariationType;\n dataManager: DataManager;\n visitorCode: string;\n requester: Requester;\n isConsentProvided: boolean;\n userAgent?: string;\n isOfflineModeOn?: boolean;\n offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n};\n\nexport type ManageCacheParametersType = {\n cacheManager: CacheManager<TrackingCacheItemType>;\n visitorCode: string;\n experimentId: number;\n variationId: number;\n};\n\nexport type TrackDataParametersType = {\n visitorCode: string;\n dataManager: DataManager;\n requester: Requester;\n isConsentProvided: boolean;\n isOfflineModeOn?: boolean;\n offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n};\n\nexport type TrackExperimentParametersType = {\n clientConfiguration: ClientConfiguration;\n visitorCode: string;\n requester: Requester;\n variationId: number;\n experimentId: number;\n isUnallocated: boolean;\n isOfflineModeOn?: boolean;\n offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n};\n\nexport type AddToOfflineTrackingParametersType = {\n item: TrackExperimentParamsType | TrackDataParamsType;\n isExperiment: boolean;\n storage: IExternalStorage<OfflineTracking>;\n onSuccess?: () => void;\n};\n\nexport type SendOfflineTrackingParametersType = {\n storage: IExternalStorage<OfflineTracking>;\n requester: Requester;\n};\n\nexport type DeleteFromOfflineTrackingParametersType = {\n timestamps: number[];\n storage: IExternalStorage<OfflineTracking>;\n};\n\nexport type GetDataUrlParametersType = {\n visitorCode: string;\n dataManager: DataManager;\n isConsentProvided: boolean;\n};\n\n/**\n * @param {number} previousVisitAmount - Number of previous visits to retrieve data from. Number between `1` and `25`\n * *Default*: `1`.\n * @param {number} currentVisit - If true, current visit data will be retrieved.\n * *Default*: `true`.\n * @param {boolean} customData - If true, custom data will be retrieved.\n * *Default*: `true`.\n * @param {boolean} pageViews - If true, page data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} geolocation - If true, geolocation data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} device - If true, device data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} browser - If true, browser data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} operatingSystem - If true, operating system data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} conversions - If true, conversion data will be retrieved.\n * *Default*: `false`.\n * @param {boolean} experiments - If true, experiment data will be retrieved.\n * *Default*: `false`.\n * */\nexport type VisitorDataFiltersType = {\n previousVisitAmount?: number;\n currentVisit?: boolean;\n pageViews?: boolean;\n geolocation?: boolean;\n device?: boolean;\n browser?: boolean;\n operatingSystem?: boolean;\n customData?: boolean;\n conversions?: boolean;\n experiments?: boolean;\n};\n"],"mappings":"6GAgCY,CAAAA,QAAQ,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,MAAA,UAARD,CAAQ,CAAAE,IAAA,QAARF,CAAQ,CAAAG,GAAA,OAARH,CAAQ,CAAAI,IAAA,QAARJ,CAAQ,CAAAK,KAAA,SAARL,CAAQ,MAAAM,OAAA,CAAAN,QAAA,CAAAA,QAAA,IAQR,CAAAO,KAAK,UAALA,CAAK,QAAL,CAAAA,CAAK,CAAAC,SAAA,OAALD,CAAK,CAAAE,UAAA,QAALF,CAAK,MAAAD,OAAA,CAAAC,KAAA,CAAAA,KAAA"}
|
|
@@ -7,7 +7,7 @@ import { FeatureVariableType } from '../clientConfiguration';
|
|
|
7
7
|
import { CustomData, DataManager, KameleoonDataType } from '../kameleoonData';
|
|
8
8
|
import { CacheManager } from '../cacheManager';
|
|
9
9
|
import { VersionMatchType } from '../targeting';
|
|
10
|
-
import { CheckTargetingParametersType, ManageCacheParametersType, TrackDataParametersType, TrackRuleParametersType, SendOfflineTrackingParametersType, ParseVisitorDataParametersType, InsertInOrderedListParametersType, TimeUnit, GetDataUrlParametersType } from './types';
|
|
10
|
+
import { CheckTargetingParametersType, ManageCacheParametersType, TrackDataParametersType, TrackRuleParametersType, SendOfflineTrackingParametersType, ParseVisitorDataParametersType, InsertInOrderedListParametersType, TimeUnit, GetDataUrlParametersType, ParseVisitorDataResultType } from './types';
|
|
11
11
|
export declare class Utilities {
|
|
12
12
|
static checkTargeting({ segment, visitorCode, targetingData, experimentId, variationConfiguration, clientConfiguration, packageInfo, dataManager, }: CheckTargetingParametersType): Result<boolean, KameleoonError>;
|
|
13
13
|
static validateVisitorCode(visitorCode: string): Result<void, KameleoonError>;
|
|
@@ -15,7 +15,7 @@ export declare class Utilities {
|
|
|
15
15
|
static trackFeatureExperiment({ featureFlagVariation, dataManager, visitorCode, requester, isOfflineModeOn, isConsentProvided, offlineTrackingStorage, }: TrackRuleParametersType): Promise<void>;
|
|
16
16
|
static convertTimeUnit(time: number, timeUnit: TimeUnit): number;
|
|
17
17
|
static parseFeatureVariable(variable: FeatureVariableType): Result<FeatureVariableResultType, KameleoonError>;
|
|
18
|
-
static parseVisitorData({ data, filters, visitorCode, variationConfiguration, }: ParseVisitorDataParametersType):
|
|
18
|
+
static parseVisitorData({ data, filters, visitorCode, variationConfiguration, }: ParseVisitorDataParametersType): ParseVisitorDataResultType;
|
|
19
19
|
static parseRegExp(value: string): RegExp;
|
|
20
20
|
static getUserAgent(visitorCode: string, dataManager: DataManager): string | undefined;
|
|
21
21
|
static isCustomData(dataItem: KameleoonDataType): dataItem is CustomData;
|