@kameleoon/javascript-sdk-core 4.0.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/clientConfiguration/clientConfiguration.d.ts +5 -2
  3. package/dist/clientConfiguration/clientConfiguration.js +1 -1
  4. package/dist/clientConfiguration/clientConfiguration.js.map +1 -1
  5. package/dist/clientConfiguration/constants.d.ts +3 -2
  6. package/dist/clientConfiguration/constants.js +1 -1
  7. package/dist/clientConfiguration/constants.js.map +1 -1
  8. package/dist/clientConfiguration/index.d.ts +1 -1
  9. package/dist/clientConfiguration/index.js +1 -1
  10. package/dist/clientConfiguration/index.js.map +1 -1
  11. package/dist/clientConfiguration/types.d.ts +1 -0
  12. package/dist/clientConfiguration/types.js.map +1 -1
  13. package/dist/constants.js +1 -1
  14. package/dist/constants.js.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/kameleoonClient.d.ts +7 -3
  19. package/dist/kameleoonClient.js +1 -1
  20. package/dist/kameleoonClient.js.map +1 -1
  21. package/dist/kameleoonClientInterface.d.ts +38 -3
  22. package/dist/kameleoonClientInterface.js.map +1 -1
  23. package/dist/kameleoonData/applicationVersion.d.ts +0 -9
  24. package/dist/kameleoonData/applicationVersion.js.map +1 -1
  25. package/dist/kameleoonData/browser.d.ts +3 -12
  26. package/dist/kameleoonData/browser.js +1 -1
  27. package/dist/kameleoonData/browser.js.map +1 -1
  28. package/dist/kameleoonData/conversion.d.ts +11 -13
  29. package/dist/kameleoonData/conversion.js +1 -1
  30. package/dist/kameleoonData/conversion.js.map +1 -1
  31. package/dist/kameleoonData/cookie.d.ts +0 -9
  32. package/dist/kameleoonData/cookie.js.map +1 -1
  33. package/dist/kameleoonData/customData.d.ts +3 -13
  34. package/dist/kameleoonData/customData.js +1 -1
  35. package/dist/kameleoonData/customData.js.map +1 -1
  36. package/dist/kameleoonData/dataManager.d.ts +11 -5
  37. package/dist/kameleoonData/dataManager.js +1 -1
  38. package/dist/kameleoonData/dataManager.js.map +1 -1
  39. package/dist/kameleoonData/dataProcessor.d.ts +13 -6
  40. package/dist/kameleoonData/dataProcessor.js +1 -1
  41. package/dist/kameleoonData/dataProcessor.js.map +1 -1
  42. package/dist/kameleoonData/device.d.ts +3 -12
  43. package/dist/kameleoonData/device.js +1 -1
  44. package/dist/kameleoonData/device.js.map +1 -1
  45. package/dist/kameleoonData/geolocation.d.ts +3 -12
  46. package/dist/kameleoonData/geolocation.js +1 -1
  47. package/dist/kameleoonData/geolocation.js.map +1 -1
  48. package/dist/kameleoonData/index.d.ts +1 -0
  49. package/dist/kameleoonData/index.js +1 -1
  50. package/dist/kameleoonData/index.js.map +1 -1
  51. package/dist/kameleoonData/kameleoonConversionScore.d.ts +15 -0
  52. package/dist/kameleoonData/kameleoonConversionScore.js +2 -0
  53. package/dist/kameleoonData/kameleoonConversionScore.js.map +1 -0
  54. package/dist/kameleoonData/operatingSystem.d.ts +3 -12
  55. package/dist/kameleoonData/operatingSystem.js +1 -1
  56. package/dist/kameleoonData/operatingSystem.js.map +1 -1
  57. package/dist/kameleoonData/pageView.d.ts +4 -13
  58. package/dist/kameleoonData/pageView.js +1 -1
  59. package/dist/kameleoonData/pageView.js.map +1 -1
  60. package/dist/kameleoonData/types.d.ts +54 -11
  61. package/dist/kameleoonData/types.js +1 -1
  62. package/dist/kameleoonData/types.js.map +1 -1
  63. package/dist/kameleoonData/userAgent.d.ts +0 -9
  64. package/dist/kameleoonData/userAgent.js.map +1 -1
  65. package/dist/kameleoonData/visitProcessor.d.ts +34 -0
  66. package/dist/kameleoonData/visitProcessor.js +2 -0
  67. package/dist/kameleoonData/visitProcessor.js.map +1 -0
  68. package/dist/kameleoonData/visitsData.d.ts +7 -21
  69. package/dist/kameleoonData/visitsData.js +1 -1
  70. package/dist/kameleoonData/visitsData.js.map +1 -1
  71. package/dist/requester/constants.js +1 -1
  72. package/dist/requester/constants.js.map +1 -1
  73. package/dist/requester/requester.d.ts +2 -3
  74. package/dist/requester/requester.js +1 -1
  75. package/dist/requester/requester.js.map +1 -1
  76. package/dist/requester/types.d.ts +15 -3
  77. package/dist/requester/types.js +1 -1
  78. package/dist/requester/types.js.map +1 -1
  79. package/dist/requester/urlProvider.d.ts +2 -3
  80. package/dist/requester/urlProvider.js +1 -1
  81. package/dist/requester/urlProvider.js.map +1 -1
  82. package/dist/storage/storage.js +1 -1
  83. package/dist/storage/types.d.ts +1 -1
  84. package/dist/storage/types.js.map +1 -1
  85. package/dist/targeting/conditions/browser.js +1 -1
  86. package/dist/targeting/conditions/browser.js.map +1 -1
  87. package/dist/targeting/conditions/conditionFactory.js +1 -1
  88. package/dist/targeting/conditions/conditionFactory.js.map +1 -1
  89. package/dist/targeting/conditions/conversionLikelihood.d.ts +12 -0
  90. package/dist/targeting/conditions/conversionLikelihood.js +2 -0
  91. package/dist/targeting/conditions/conversionLikelihood.js.map +1 -0
  92. package/dist/targeting/conditions/firstVisit.js +1 -1
  93. package/dist/targeting/conditions/firstVisit.js.map +1 -1
  94. package/dist/targeting/conditions/geolocation.js +1 -1
  95. package/dist/targeting/conditions/geolocation.js.map +1 -1
  96. package/dist/targeting/conditions/index.d.ts +1 -0
  97. package/dist/targeting/conditions/index.js +1 -1
  98. package/dist/targeting/conditions/index.js.map +1 -1
  99. package/dist/targeting/conditions/lastVisit.js +1 -1
  100. package/dist/targeting/conditions/lastVisit.js.map +1 -1
  101. package/dist/targeting/conditions/newVisitor.js +1 -1
  102. package/dist/targeting/conditions/newVisitor.js.map +1 -1
  103. package/dist/targeting/conditions/pageUrl.js.map +1 -1
  104. package/dist/targeting/conditions/previousPage.js +1 -1
  105. package/dist/targeting/conditions/previousPage.js.map +1 -1
  106. package/dist/targeting/conditions/sameDayVisits.js +1 -1
  107. package/dist/targeting/conditions/sameDayVisits.js.map +1 -1
  108. package/dist/targeting/conditions/targetFeatureFlag.js +1 -1
  109. package/dist/targeting/conditions/types.d.ts +3 -0
  110. package/dist/targeting/conditions/types.js.map +1 -1
  111. package/dist/targeting/conditions/visits.js +1 -1
  112. package/dist/targeting/conditions/visits.js.map +1 -1
  113. package/dist/targeting/index.d.ts +2 -2
  114. package/dist/targeting/index.js +1 -1
  115. package/dist/targeting/index.js.map +1 -1
  116. package/dist/targeting/types.d.ts +4 -0
  117. package/dist/targeting/types.js.map +1 -1
  118. package/dist/types.d.ts +26 -2
  119. package/dist/types.js.map +1 -1
  120. package/dist/utilities/types.d.ts +6 -1
  121. package/dist/utilities/types.js.map +1 -1
  122. package/dist/utilities/utilities.d.ts +1 -1
  123. package/dist/utilities/utilities.js +1 -1
  124. package/dist/utilities/utilities.js.map +1 -1
  125. package/dist/variationConfiguration/types.d.ts +1 -1
  126. package/dist/variationConfiguration/types.js.map +1 -1
  127. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeolocationData=void 0;var _requester=require("../requester"),_types=require("./types");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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class GeolocationData{constructor(a){let{country:b,region:c,city:d,postalCode:e,coordinates:f}=a;_defineProperty(this,"country",void 0),_defineProperty(this,"region",void 0),_defineProperty(this,"city",void 0),_defineProperty(this,"postalCode",void 0),_defineProperty(this,"coordinates",void 0),_defineProperty(this,"sent",void 0),this.country=b,this.region=c,this.city=d,this.postalCode=e,this.coordinates=f,this.sent=!1}get url(){const a=this.region?_requester.UrlParameter.Region+encodeURIComponent(this.region):"",b=this.city?_requester.UrlParameter.City+encodeURIComponent(this.city):"",c=this.postalCode?_requester.UrlParameter.PostalCode+encodeURIComponent(this.postalCode):"",d=this.coordinates?_requester.UrlParameter.Latitude+this.coordinates[0]+_requester.UrlParameter.Longitude+this.coordinates[1]:"";return _requester.UrlEventType.Geolocation+_requester.UrlParameter.Country+encodeURIComponent(this.country)+a+b+c+d}get data(){return{type:_types.KameleoonData.GeolocationData,country:this.country,region:this.region,city:this.city,postalCode:this.postalCode,coordinates:this.coordinates,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _fromVisits(a){let b;for(let c=a.length-1;0<=c;c--){const d=a[c];if(!d.geolocationEvents)continue;const e=d.geolocationEvents;for(const a of e){const{data:c}=a;c.country&&(b=c)}}const{country:c,region:d,city:e}=b||{};if(c)return d&&e?new GeolocationData({country:c,region:d,city:e}):d?new GeolocationData({country:c,region:d}):new GeolocationData({country:c})}}exports.GeolocationData=GeolocationData;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeolocationData=void 0;var _requester=require("../requester"),_types=require("./types");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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class GeolocationData{constructor(a){let{country:b,region:c,city:d,postalCode:e,coordinates:f}=a;_defineProperty(this,"country",void 0),_defineProperty(this,"region",void 0),_defineProperty(this,"city",void 0),_defineProperty(this,"postalCode",void 0),_defineProperty(this,"coordinates",void 0),_defineProperty(this,"sent",void 0),this.country=b,this.region=c,this.city=d,this.postalCode=e,this.coordinates=f,this.sent=!1}get url(){const a=this.region?_requester.UrlParameter.Region+encodeURIComponent(this.region):"",b=this.city?_requester.UrlParameter.City+encodeURIComponent(this.city):"",c=this.postalCode?_requester.UrlParameter.PostalCode+encodeURIComponent(this.postalCode):"",d=this.coordinates?_requester.UrlParameter.Latitude+this.coordinates[0]+_requester.UrlParameter.Longitude+this.coordinates[1]:"";return _requester.UrlEventType.Geolocation+_requester.UrlParameter.Country+encodeURIComponent(this.country)+a+b+c+d}get data(){return{type:_types.KameleoonData.GeolocationData,country:this.country,region:this.region,city:this.city,postalCode:this.postalCode,coordinates:this.coordinates,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _fromVisit(a){var b;if(!(null!==(b=a.geolocationEvents)&&void 0!==b&&b.length))return;let c;for(const b of a.geolocationEvents){const{data:a}=b;a.country&&(c=a)}const{country:d,region:e,city:f}=c||{};if(d)return e&&f?new GeolocationData({country:d,region:e,city:f}):e?new GeolocationData({country:d,region:e}):new GeolocationData({country:d})}}exports.GeolocationData=GeolocationData;
2
2
  //# sourceMappingURL=geolocation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.js","names":["GeolocationData","constructor","a","country","region","city","postalCode","coordinates","_defineProperty","sent","url","UrlParameter","Region","encodeURIComponent","City","PostalCode","Latitude","Longitude","UrlEventType","Geolocation","Country","data","type","KameleoonData","isSent","value","_fromVisits","visits","geolocationData","i","length","visit","geolocationEvents","geolocationEvent","exports"],"sources":["../../src/kameleoonData/geolocation.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { GeolocationEventType } from 'src/requester/types';\nimport {\n IKameleoonData,\n KameleoonData,\n GeolocationInfoType,\n GeolocationDataType,\n} from './types';\n\n/**\n * @class\n * Geolocation - a class for creating an instance for geolocation data\n * */\nexport class GeolocationData implements IKameleoonData {\n private country: string;\n private region?: string;\n private city?: string;\n private postalCode?: string;\n private coordinates?: [number, number];\n private sent: boolean;\n\n /**\n * @param {GeolocationInfoType} geolocationInfo - an object containing information about geolocation of a visitor\n * @example\n * ```ts\n * // Visitor is located at Triumph Arch in Paris, France\n * const location: GeolocationDataType = {\n * country: 'France',\n * region: 'Île-de-France',\n * city: 'Paris',\n * postalCode: '75008',\n * coordinates: [48.8738, 2.295]\n * };\n *\n * const geolocation = new GeolocationData(location);\n * ```\n *\n * */\n constructor({\n country,\n region,\n city,\n postalCode,\n coordinates,\n }: GeolocationInfoType) {\n this.country = country;\n this.region = region;\n this.city = city;\n this.postalCode = postalCode;\n this.coordinates = coordinates;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n const region = this.region\n ? UrlParameter.Region + encodeURIComponent(this.region)\n : '';\n const city = this.city\n ? UrlParameter.City + encodeURIComponent(this.city)\n : '';\n const postalCode = this.postalCode\n ? UrlParameter.PostalCode + encodeURIComponent(this.postalCode)\n : '';\n const coordinates = this.coordinates\n ? UrlParameter.Latitude +\n this.coordinates[0] +\n UrlParameter.Longitude +\n this.coordinates[1]\n : '';\n\n return (\n UrlEventType.Geolocation +\n UrlParameter.Country +\n encodeURIComponent(this.country) +\n region +\n city +\n postalCode +\n coordinates\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): GeolocationDataType {\n return {\n type: KameleoonData.GeolocationData,\n country: this.country,\n region: this.region,\n city: this.city,\n postalCode: this.postalCode,\n coordinates: this.coordinates,\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 * @private\n * @method _fromVisits - an internal method for creating an instance of GeolocationData class from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {GeolocationData | undefined} an instance of GeolocationData class or undefined if geolocation can not be found among visits\n * */\n public static _fromVisits(visits: VisitType[]): GeolocationData | undefined {\n let geolocationData: GeolocationEventType['data'] | undefined = undefined;\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.geolocationEvents) {\n continue;\n }\n\n const geolocationEvents = visit.geolocationEvents;\n\n for (const geolocationEvent of geolocationEvents) {\n const { data } = geolocationEvent;\n\n if (data.country) {\n geolocationData = data;\n }\n }\n }\n\n // --- Note ---\n // We only take `country`, `region`, and `city` from geolocation event ignoring other fields\n // as they are not participating in targeting, and visits data won't be tracked again\n const { country, region, city } = geolocationData || {};\n\n if (country) {\n if (region && city) {\n return new GeolocationData({ country, region, city });\n } else if (region) {\n return new GeolocationData({ country, region });\n } else {\n return new GeolocationData({ country });\n }\n }\n }\n}\n"],"mappings":"uqBAaO,KAAM,CAAAA,eAA0C,CAyBrDC,WAAWA,CAAAC,CAAA,CAMa,IANZ,CACVC,OAAO,CAAPA,CAAO,CACPC,MAAM,CAANA,CAAM,CACNC,IAAI,CAAJA,CAAI,CACJC,UAAU,CAAVA,CAAU,CACVC,WAAW,CAAXA,CACmB,CAAC,CAAAL,CAAA,CAAAM,eAAA,wBAAAA,eAAA,uBAAAA,eAAA,qBAAAA,eAAA,2BAAAA,eAAA,4BAAAA,eAAA,qBACpB,IAAI,CAACL,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,MAAM,CAAGA,CAAM,CACpB,IAAI,CAACC,IAAI,CAAGA,CAAI,CAChB,IAAI,CAACC,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,WAAW,CAAGA,CAAW,CAC9B,IAAI,CAACE,IAAI,GACX,CAKA,GAAI,CAAAC,GAAGA,CAAA,CAAW,MACV,CAAAN,CAAM,CAAG,IAAI,CAACA,MAAM,CACtBO,uBAAY,CAACC,MAAM,CAAGC,kBAAkB,CAAC,IAAI,CAACT,MAAM,CAAC,CACrD,EAAE,CACAC,CAAI,CAAG,IAAI,CAACA,IAAI,CAClBM,uBAAY,CAACG,IAAI,CAAGD,kBAAkB,CAAC,IAAI,CAACR,IAAI,CAAC,CACjD,EAAE,CACAC,CAAU,CAAG,IAAI,CA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,CAAiB,CAAGD,CAAK,CAACC,iBAAiB,CAEjD,IAAK,KAAM,CAAAC,CAAgB,GAAI,CAAAD,CAAiB,CAAE,CAChD,KAAM,CAAEX,IAAI,CAAJA,CAAK,CAAC,CAAGY,CAAgB,CAE7BZ,CAAI,CAAClB,OAAO,GACdyB,CAAe,CAAGP,CAAI,CAE1B,CACF,CAKA,KAAM,CAAElB,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAM,CAAEC,IAAI,CAAJA,CAAK,CAAC,CAAGuB,CAAe,EAAI,CAAC,CAAC,CAEvD,GAAIzB,CAAO,OACL,CAAAC,CAAM,EAAIC,CAAI,CACT,GAAI,CAAAL,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAM,CAAEC,IAAI,CAAJA,CAAK,CAAC,CAAC,CAC5CD,CAAM,CACR,GAAI,CAAAJ,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAO,CAAC,CAAC,CAExC,GAAI,CAAAJ,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAQ,CAAC,CAG5C,CACF,CAAC+B,OAAA,CAAAlC,eAAA,CAAAA,eAAA"}
1
+ {"version":3,"file":"geolocation.js","names":["GeolocationData","constructor","a","country","region","city","postalCode","coordinates","_defineProperty","sent","url","UrlParameter","Region","encodeURIComponent","City","PostalCode","Latitude","Longitude","UrlEventType","Geolocation","Country","data","type","KameleoonData","isSent","value","_fromVisit","visit","b","geolocationEvents","length","geolocationData","geolocationEvent","exports"],"sources":["../../src/kameleoonData/geolocation.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { GeolocationEventType } from 'src/requester/types';\nimport {\n IKameleoonData,\n KameleoonData,\n GeolocationInfoType,\n GeolocationDataType,\n} from './types';\n\n/**\n * @class\n * Geolocation - a class for creating an instance for geolocation data\n * */\nexport class GeolocationData implements IKameleoonData {\n private country: string;\n private region?: string;\n private city?: string;\n private postalCode?: string;\n private coordinates?: [number, number];\n private sent: boolean;\n\n /**\n * @param {GeolocationInfoType} geolocationInfo - an object containing information about geolocation of a visitor\n * @example\n * ```ts\n * // Visitor is located at Triumph Arch in Paris, France\n * const location: GeolocationDataType = {\n * country: 'France',\n * region: 'Île-de-France',\n * city: 'Paris',\n * postalCode: '75008',\n * coordinates: [48.8738, 2.295]\n * };\n *\n * const geolocation = new GeolocationData(location);\n * ```\n *\n * */\n constructor({\n country,\n region,\n city,\n postalCode,\n coordinates,\n }: GeolocationInfoType) {\n this.country = country;\n this.region = region;\n this.city = city;\n this.postalCode = postalCode;\n this.coordinates = coordinates;\n this.sent = false;\n }\n\n get url(): string {\n const region = this.region\n ? UrlParameter.Region + encodeURIComponent(this.region)\n : '';\n const city = this.city\n ? UrlParameter.City + encodeURIComponent(this.city)\n : '';\n const postalCode = this.postalCode\n ? UrlParameter.PostalCode + encodeURIComponent(this.postalCode)\n : '';\n const coordinates = this.coordinates\n ? UrlParameter.Latitude +\n this.coordinates[0] +\n UrlParameter.Longitude +\n this.coordinates[1]\n : '';\n\n return (\n UrlEventType.Geolocation +\n UrlParameter.Country +\n encodeURIComponent(this.country) +\n region +\n city +\n postalCode +\n coordinates\n );\n }\n\n get data(): GeolocationDataType {\n return {\n type: KameleoonData.GeolocationData,\n country: this.country,\n region: this.region,\n city: this.city,\n postalCode: this.postalCode,\n coordinates: this.coordinates,\n sent: this.sent,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @private\n * @method _fromVisit - an internal method for creating an instance of GeolocationData class from a visit\n * @param {VisitType} visit - a visit\n * @returns {GeolocationData | undefined} an instance of GeolocationData class or undefined if geolocation can not be found among visits\n * */\n public static _fromVisit(visit: VisitType): GeolocationData | undefined {\n if (!visit.geolocationEvents?.length) {\n return undefined;\n }\n\n let geolocationData: GeolocationEventType['data'] | undefined = undefined;\n\n for (const geolocationEvent of visit.geolocationEvents) {\n const { data } = geolocationEvent;\n\n if (data.country) {\n geolocationData = data;\n }\n }\n\n // --- Note ---\n // We only take `country`, `region`, and `city` from geolocation event ignoring other fields\n // as they are not participating in targeting, and visits data won't be tracked again\n const { country, region, city } = geolocationData || {};\n\n if (country) {\n if (region && city) {\n return new GeolocationData({ country, region, city });\n } else if (region) {\n return new GeolocationData({ country, region });\n } else {\n return new GeolocationData({ country });\n }\n }\n }\n}\n"],"mappings":"uqBAaO,KAAM,CAAAA,eAA0C,CAyBrDC,WAAWA,CAAAC,CAAA,CAMa,IANZ,CACVC,OAAO,CAAPA,CAAO,CACPC,MAAM,CAANA,CAAM,CACNC,IAAI,CAAJA,CAAI,CACJC,UAAU,CAAVA,CAAU,CACVC,WAAW,CAAXA,CACmB,CAAC,CAAAL,CAAA,CAAAM,eAAA,wBAAAA,eAAA,uBAAAA,eAAA,qBAAAA,eAAA,2BAAAA,eAAA,4BAAAA,eAAA,qBACpB,IAAI,CAACL,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,MAAM,CAAGA,CAAM,CACpB,IAAI,CAACC,IAAI,CAAGA,CAAI,CAChB,IAAI,CAACC,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,WAAW,CAAGA,CAAW,CAC9B,IAAI,CAACE,IAAI,GACX,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,MACV,CAAAN,CAAM,CAAG,IAAI,CAACA,MAAM,CACtBO,uBAAY,CAACC,MAAM,CAAGC,kBAAkB,CAAC,IAAI,CAACT,MAAM,CAAC,CACrD,EAAE,CACAC,CAAI,CAAG,IAAI,CAACA,IAAI,CAClBM,uBAAY,CAACG,IAAI,CAAGD,kBAAkB,CAAC,IAAI,CAACR,IAAI,CAAC,CACjD,EAAE,CACAC,CAAU,CAAG,IAAI,CAACA,UAAU,CAC9BK,uBAAY,CAACI,UAAU,CAAGF,kBAAkB,CAAC,IAAI,CAACP,UAAU,CAAC,CAC7D,EAAE,CACAC,CAAW,CAAG,IAAI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CAAM,CAAEC,IAAI,CAAJA,CAAK,CAAC,CAAG0B,CAAe,EAAI,CAAC,CAAC,CAEvD,GAAI5B,CAAO,OACL,CAAAC,CAAM,EAAIC,CAAI,CACT,GAAI,CAAAL,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAM,CAAEC,IAAI,CAAJA,CAAK,CAAC,CAAC,CAC5CD,CAAM,CACR,GAAI,CAAAJ,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAO,CAAC,CAAC,CAExC,GAAI,CAAAJ,eAAe,CAAC,CAAEG,OAAO,CAAPA,CAAQ,CAAC,CAG5C,CACF,CAAC8B,OAAA,CAAAjC,eAAA,CAAAA,eAAA"}
@@ -9,6 +9,7 @@ export { GeolocationData } from './geolocation';
9
9
  export { OperatingSystem } from './operatingSystem';
10
10
  export { ApplicationVersion } from './applicationVersion';
11
11
  export { VisitsData } from './visitsData';
12
+ export { KameleoonConversionScore } from './kameleoonConversionScore';
12
13
  export { DEFAULT_CLEANUP_INTERVAL } from './constants';
13
14
  export { DeviceType, CookieType, VisitsDataType, BrowserType, KameleoonData, DeviceDataType, CustomDataType, BrowserDataType, BrowserIndexMap, PageViewDataType, KameleoonDataType, UserAgentDataType, ConversionDataType, OperatingSystemType, GeolocationInfoType, KameleoonDataItemType, PageViewParametersType, ConversionParametersType, ApplicationVersionDataType, } from './types';
14
15
  export { DataManager } from './dataManager';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _applicationVersion.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _types.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"BrowserDataType",{enumerable:!0,get:function(){return _types.BrowserDataType}}),Object.defineProperty(exports,"BrowserIndexMap",{enumerable:!0,get:function(){return _types.BrowserIndexMap}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _types.BrowserType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"ConversionDataType",{enumerable:!0,get:function(){return _types.ConversionDataType}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _types.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _types.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"CustomDataType",{enumerable:!0,get:function(){return _types.CustomDataType}}),Object.defineProperty(exports,"DEFAULT_CLEANUP_INTERVAL",{enumerable:!0,get:function(){return _constants.DEFAULT_CLEANUP_INTERVAL}}),Object.defineProperty(exports,"DataManager",{enumerable:!0,get:function(){return _dataManager.DataManager}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _device.Device}}),Object.defineProperty(exports,"DeviceDataType",{enumerable:!0,get:function(){return _types.DeviceDataType}}),Object.defineProperty(exports,"DeviceType",{enumerable:!0,get:function(){return _types.DeviceType}}),Object.defineProperty(exports,"GeolocationData",{enumerable:!0,get:function(){return _geolocation.GeolocationData}}),Object.defineProperty(exports,"GeolocationInfoType",{enumerable:!0,get:function(){return _types.GeolocationInfoType}}),Object.defineProperty(exports,"KameleoonData",{enumerable:!0,get:function(){return _types.KameleoonData}}),Object.defineProperty(exports,"KameleoonDataItemType",{enumerable:!0,get:function(){return _types.KameleoonDataItemType}}),Object.defineProperty(exports,"KameleoonDataType",{enumerable:!0,get:function(){return _types.KameleoonDataType}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _operatingSystem.OperatingSystem}}),Object.defineProperty(exports,"OperatingSystemType",{enumerable:!0,get:function(){return _types.OperatingSystemType}}),Object.defineProperty(exports,"PageView",{enumerable:!0,get:function(){return _pageView.PageView}}),Object.defineProperty(exports,"PageViewDataType",{enumerable:!0,get:function(){return _types.PageViewDataType}}),Object.defineProperty(exports,"PageViewParametersType",{enumerable:!0,get:function(){return _types.PageViewParametersType}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return _userAgent.UserAgent}}),Object.defineProperty(exports,"UserAgentDataType",{enumerable:!0,get:function(){return _types.UserAgentDataType}}),Object.defineProperty(exports,"VisitsData",{enumerable:!0,get:function(){return _visitsData.VisitsData}}),Object.defineProperty(exports,"VisitsDataType",{enumerable:!0,get:function(){return _types.VisitsDataType}});var _device=require("./device"),_cookie=require("./cookie"),_browser=require("./browser"),_pageView=require("./pageView"),_userAgent=require("./userAgent"),_customData=require("./customData"),_conversion=require("./conversion"),_geolocation=require("./geolocation"),_operatingSystem=require("./operatingSystem"),_applicationVersion=require("./applicationVersion"),_visitsData=require("./visitsData"),_constants=require("./constants"),_types=require("./types"),_dataManager=require("./dataManager");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _applicationVersion.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _types.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"BrowserDataType",{enumerable:!0,get:function(){return _types.BrowserDataType}}),Object.defineProperty(exports,"BrowserIndexMap",{enumerable:!0,get:function(){return _types.BrowserIndexMap}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _types.BrowserType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"ConversionDataType",{enumerable:!0,get:function(){return _types.ConversionDataType}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _types.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _types.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"CustomDataType",{enumerable:!0,get:function(){return _types.CustomDataType}}),Object.defineProperty(exports,"DEFAULT_CLEANUP_INTERVAL",{enumerable:!0,get:function(){return _constants.DEFAULT_CLEANUP_INTERVAL}}),Object.defineProperty(exports,"DataManager",{enumerable:!0,get:function(){return _dataManager.DataManager}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _device.Device}}),Object.defineProperty(exports,"DeviceDataType",{enumerable:!0,get:function(){return _types.DeviceDataType}}),Object.defineProperty(exports,"DeviceType",{enumerable:!0,get:function(){return _types.DeviceType}}),Object.defineProperty(exports,"GeolocationData",{enumerable:!0,get:function(){return _geolocation.GeolocationData}}),Object.defineProperty(exports,"GeolocationInfoType",{enumerable:!0,get:function(){return _types.GeolocationInfoType}}),Object.defineProperty(exports,"KameleoonConversionScore",{enumerable:!0,get:function(){return _kameleoonConversionScore.KameleoonConversionScore}}),Object.defineProperty(exports,"KameleoonData",{enumerable:!0,get:function(){return _types.KameleoonData}}),Object.defineProperty(exports,"KameleoonDataItemType",{enumerable:!0,get:function(){return _types.KameleoonDataItemType}}),Object.defineProperty(exports,"KameleoonDataType",{enumerable:!0,get:function(){return _types.KameleoonDataType}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _operatingSystem.OperatingSystem}}),Object.defineProperty(exports,"OperatingSystemType",{enumerable:!0,get:function(){return _types.OperatingSystemType}}),Object.defineProperty(exports,"PageView",{enumerable:!0,get:function(){return _pageView.PageView}}),Object.defineProperty(exports,"PageViewDataType",{enumerable:!0,get:function(){return _types.PageViewDataType}}),Object.defineProperty(exports,"PageViewParametersType",{enumerable:!0,get:function(){return _types.PageViewParametersType}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return _userAgent.UserAgent}}),Object.defineProperty(exports,"UserAgentDataType",{enumerable:!0,get:function(){return _types.UserAgentDataType}}),Object.defineProperty(exports,"VisitsData",{enumerable:!0,get:function(){return _visitsData.VisitsData}}),Object.defineProperty(exports,"VisitsDataType",{enumerable:!0,get:function(){return _types.VisitsDataType}});var _device=require("./device"),_cookie=require("./cookie"),_browser=require("./browser"),_pageView=require("./pageView"),_userAgent=require("./userAgent"),_customData=require("./customData"),_conversion=require("./conversion"),_geolocation=require("./geolocation"),_operatingSystem=require("./operatingSystem"),_applicationVersion=require("./applicationVersion"),_visitsData=require("./visitsData"),_kameleoonConversionScore=require("./kameleoonConversionScore"),_constants=require("./constants"),_types=require("./types"),_dataManager=require("./dataManager");
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/kameleoonData/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { Cookie } from './cookie';\nexport { Browser } from './browser';\nexport { PageView } from './pageView';\nexport { UserAgent } from './userAgent';\nexport { CustomData } from './customData';\nexport { Conversion } from './conversion';\nexport { GeolocationData } from './geolocation';\nexport { OperatingSystem } from './operatingSystem';\nexport { ApplicationVersion } from './applicationVersion';\nexport { VisitsData } from './visitsData';\nexport { DEFAULT_CLEANUP_INTERVAL } from './constants';\nexport {\n DeviceType,\n CookieType,\n VisitsDataType,\n BrowserType,\n KameleoonData,\n DeviceDataType,\n CustomDataType,\n BrowserDataType,\n BrowserIndexMap,\n PageViewDataType,\n KameleoonDataType,\n UserAgentDataType,\n ConversionDataType,\n OperatingSystemType,\n GeolocationInfoType,\n KameleoonDataItemType,\n PageViewParametersType,\n ConversionParametersType,\n ApplicationVersionDataType,\n} from './types';\nexport { DataManager } from './dataManager';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/kameleoonData/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { Cookie } from './cookie';\nexport { Browser } from './browser';\nexport { PageView } from './pageView';\nexport { UserAgent } from './userAgent';\nexport { CustomData } from './customData';\nexport { Conversion } from './conversion';\nexport { GeolocationData } from './geolocation';\nexport { OperatingSystem } from './operatingSystem';\nexport { ApplicationVersion } from './applicationVersion';\nexport { VisitsData } from './visitsData';\nexport { KameleoonConversionScore } from './kameleoonConversionScore';\nexport { DEFAULT_CLEANUP_INTERVAL } from './constants';\nexport {\n DeviceType,\n CookieType,\n VisitsDataType,\n BrowserType,\n KameleoonData,\n DeviceDataType,\n CustomDataType,\n BrowserDataType,\n BrowserIndexMap,\n PageViewDataType,\n KameleoonDataType,\n UserAgentDataType,\n ConversionDataType,\n OperatingSystemType,\n GeolocationInfoType,\n KameleoonDataItemType,\n PageViewParametersType,\n ConversionParametersType,\n ApplicationVersionDataType,\n} from './types';\nexport { DataManager } from './dataManager';\n"],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { IKameleoonData, KCSType, KCSDataType } from './types';
2
+ /**
3
+ * @class
4
+ * KameleoonConversionScore - a class for creating an KCS Heat Range data
5
+ * */
6
+ export declare class KameleoonConversionScore implements IKameleoonData {
7
+ private kcs;
8
+ /**
9
+ * @param {KCSType} kcs - Kameleoon Conversion Score nested object
10
+ * */
11
+ constructor(kcs: KCSType);
12
+ get url(): string;
13
+ get data(): KCSDataType;
14
+ get isSent(): boolean;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";var _types=require("./types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonConversionScore=void 0;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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class KameleoonConversionScore{constructor(a){_defineProperty(this,"kcs",void 0),this.kcs=a}get url(){return""}get data(){return{kcs:this.kcs,type:_types.KameleoonData.KameleoonConversionScore,sent:!0}}get isSent(){return!0}}exports.KameleoonConversionScore=KameleoonConversionScore;
2
+ //# sourceMappingURL=kameleoonConversionScore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kameleoonConversionScore.js","names":["_types","require","Object","defineProperty","exports","value","KameleoonConversionScore","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","kcs","url","data","type","KameleoonData","sent","isSent"],"sources":["../../src/kameleoonData/kameleoonConversionScore.ts"],"sourcesContent":["import { IKameleoonData, KCSType, KCSDataType, KameleoonData } from './types';\n\n/**\n * @class\n * KameleoonConversionScore - a class for creating an KCS Heat Range data\n * */\nexport class KameleoonConversionScore implements IKameleoonData {\n private kcs: KCSType;\n\n /**\n * @param {KCSType} kcs - Kameleoon Conversion Score nested object\n * */\n constructor(kcs: KCSType) {\n this.kcs = kcs;\n }\n\n get url(): string {\n return '';\n }\n\n get data(): KCSDataType {\n return {\n kcs: this.kcs,\n type: KameleoonData.KameleoonConversionScore,\n sent: true,\n };\n }\n\n get isSent(): boolean {\n return true;\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,YAA8EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,wBAAA,iBAAAC,gBAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,CAAAE,cAAA,CAAAF,CAAA,EAAAA,CAAA,IAAAD,CAAA,CAAAN,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAC,CAAA,EAAAJ,KAAA,CAAAK,CAAA,CAAAE,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAN,CAAA,CAAAC,CAAA,EAAAC,CAAA,CAAAF,CAAA,UAAAG,eAAAH,CAAA,MAAAC,CAAA,CAAAM,YAAA,CAAAP,CAAA,kCAAAC,CAAA,CAAAA,CAAA,CAAAA,CAAA,aAAAM,aAAAP,CAAA,CAAAC,CAAA,sBAAAD,CAAA,GAAAA,CAAA,QAAAA,CAAA,KAAAE,CAAA,CAAAF,CAAA,CAAAQ,MAAA,CAAAC,WAAA,cAAAP,CAAA,MAAAQ,CAAA,CAAAR,CAAA,CAAAS,IAAA,CAAAX,CAAA,CAAAC,CAAA,iCAAAS,CAAA,QAAAA,CAAA,WAAAE,SAAA,mEAAAX,CAAA,CAAAY,MAAA,CAAAC,MAAA,EAAAd,CAAA,EAMvE,KAAM,CAAAF,wBAAmD,CAM9DiB,WAAWA,CAACC,CAAY,CAAE,CAAAjB,eAAA,oBACxB,IAAI,CAACiB,GAAG,CAAGA,CACb,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,CAChB,MAAO,EACT,CAEA,GAAI,CAAAC,IAAIA,CAAA,CAAgB,CACtB,MAAO,CACLF,GAAG,CAAE,IAAI,CAACA,GAAG,CACbG,IAAI,CAAEC,oBAAa,CAACtB,wBAAwB,CAC5CuB,IAAI,GACN,CACF,CAEA,GAAI,CAAAC,MAAMA,CAAA,CAAY,CACpB,QACF,CACF,CAAC1B,OAAA,CAAAE,wBAAA,CAAAA,wBAAA"}
@@ -11,24 +11,15 @@ export declare class OperatingSystem implements IKameleoonData {
11
11
  * @param {OperatingSystemType} operatingSystem - one of the available operating system types from `OperatingSystemType` enum
12
12
  * */
13
13
  constructor(operatingSystem: OperatingSystemType);
14
- /**
15
- * @property url - url for the current data type used for events tracking
16
- * */
17
14
  get url(): string;
18
- /**
19
- * @property data - data of the current class instance
20
- * */
21
15
  get data(): OperatingSystemDataType;
22
- /**
23
- * @property isSent - signifying if the data was sent already tracked
24
- * */
25
16
  get isSent(): boolean;
26
17
  set isSent(value: boolean);
27
18
  /**
28
19
  * @private
29
- * @method _fromVisits - a static method for creating an instance of OperatingSystem class from a list of visits
30
- * @param {VisitType[]} visits - a list of visits
20
+ * @method _fromVisit - a static method for creating an instance of OperatingSystem class from a visit
21
+ * @param {VisitType} visit - a visit
31
22
  * @returns {OperatingSystem | undefined} an instance of OperatingSystem class or undefined
32
23
  * */
33
- static _fromVisits(visits: VisitType[]): OperatingSystem | undefined;
24
+ static _fromVisit(visit: VisitType): OperatingSystem | undefined;
34
25
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperatingSystem=void 0;var _requester=require("../requester"),_types=require("./types");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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class OperatingSystem{constructor(a){_defineProperty(this,"operatingSystem",void 0),_defineProperty(this,"sent",void 0),this.operatingSystem=a,this.sent=!1}get url(){return this.operatingSystem?_requester.UrlEventType.StaticData+_requester.UrlParameter.Os+this.operatingSystem+_requester.UrlParameter.OsIndex+_types.OperatingSystemIndexMap[this.operatingSystem]:""}get data(){return{operatingSystem:this.operatingSystem,type:_types.KameleoonData.OperatingSystem,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _fromVisits(a){let b={};for(let c=a.length-1;0<=c;c--){const d=a[c];if(!d.staticDataEvent)continue;const{os:e,osIndex:f}=d.staticDataEvent.data;(e||null!==f)&&(b={operatingSystemType:e,osIndex:f})}const{operatingSystemType:c,osIndex:d}=b;if(c||"number"==typeof d){const a=c||_types.OperatingSystemTypeMap[d];return new OperatingSystem(a)}}}exports.OperatingSystem=OperatingSystem;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperatingSystem=void 0;var _requester=require("../requester"),_types=require("./types");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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class OperatingSystem{constructor(a){_defineProperty(this,"operatingSystem",void 0),_defineProperty(this,"sent",void 0),this.operatingSystem=a,this.sent=!1}get url(){return this.operatingSystem?_requester.UrlEventType.StaticData+_requester.UrlParameter.Os+this.operatingSystem+_requester.UrlParameter.OsIndex+_types.OperatingSystemIndexMap[this.operatingSystem]:""}get data(){return{operatingSystem:this.operatingSystem,type:_types.KameleoonData.OperatingSystem,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _fromVisit(a){if(a.staticDataEvent){const{os:b,osIndex:c}=a.staticDataEvent.data;if(b||"number"==typeof c){const a=null!==b&&void 0!==b?b:_types.OperatingSystemTypeMap[c];return new OperatingSystem(a)}}}}exports.OperatingSystem=OperatingSystem;
2
2
  //# sourceMappingURL=operatingSystem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operatingSystem.js","names":["OperatingSystem","constructor","operatingSystem","_defineProperty","sent","url","UrlEventType","StaticData","UrlParameter","Os","OsIndex","OperatingSystemIndexMap","data","type","KameleoonData","isSent","value","_fromVisits","visits","operatingSystemData","i","length","visit","staticDataEvent","os","operatingSystemType","osIndex","OperatingSystemTypeMap","exports"],"sources":["../../src/kameleoonData/operatingSystem.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport {\n IKameleoonData,\n KameleoonData,\n OperatingSystemDataType,\n OperatingSystemIndexMap,\n OperatingSystemType,\n OperatingSystemTypeMap,\n} from './types';\n\n/**\n * @class\n * OperatingSystem - a class for creating an instance for Operating System of a certain type\n * */\nexport class OperatingSystem implements IKameleoonData {\n private operatingSystem: OperatingSystemType;\n private sent: boolean;\n\n /**\n * @param {OperatingSystemType} operatingSystem - one of the available operating system types from `OperatingSystemType` enum\n * */\n constructor(operatingSystem: OperatingSystemType) {\n this.operatingSystem = operatingSystem;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.operatingSystem) {\n return '';\n }\n\n return (\n UrlEventType.StaticData +\n UrlParameter.Os +\n this.operatingSystem +\n UrlParameter.OsIndex +\n OperatingSystemIndexMap[this.operatingSystem]\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): OperatingSystemDataType {\n return {\n operatingSystem: this.operatingSystem,\n type: KameleoonData.OperatingSystem,\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 * @private\n * @method _fromVisits - a static method for creating an instance of OperatingSystem class from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {OperatingSystem | undefined} an instance of OperatingSystem class or undefined\n * */\n public static _fromVisits(visits: VisitType[]): OperatingSystem | undefined {\n let operatingSystemData: {\n operatingSystemType?: OperatingSystemType | null;\n osIndex?: number | null;\n } = {};\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.staticDataEvent) {\n continue;\n }\n\n const { os: operatingSystemType, osIndex } = visit.staticDataEvent.data;\n\n if (operatingSystemType || osIndex !== null) {\n operatingSystemData = { operatingSystemType, osIndex };\n }\n }\n\n const { operatingSystemType, osIndex } = operatingSystemData;\n\n if (operatingSystemType || typeof osIndex === 'number') {\n const operatingSystem =\n operatingSystemType || OperatingSystemTypeMap[osIndex as number];\n\n return new OperatingSystem(operatingSystem);\n }\n }\n}\n"],"mappings":"uqBAcO,KAAM,CAAAA,eAA0C,CAOrDC,WAAWA,CAACC,CAAoC,CAAE,CAAAC,eAAA,gCAAAA,eAAA,qBAChD,IAAI,CAACD,eAAe,CAAGA,CAAe,CACtC,IAAI,CAACE,IAAI,GACX,CAKA,GAAI,CAAAC,GAAGA,CAAA,CAAW,OAIX,KAAI,CAACH,eAAe,CAKvBI,uBAAY,CAACC,UAAU,CACvBC,uBAAY,CAACC,EAAE,CACf,IAAI,CAACP,eAAe,CACpBM,uBAAY,CAACE,OAAO,CACpBC,8BAAuB,CAAC,IAAI,CAACT,eAAe,CAAC,CARtC,EAUX,CAKA,GAAI,CAAAU,IAAIA,CAAA,CAA4B,CAClC,MAAO,CACLV,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCW,IAAI,CAAEC,oBAAa,CAACd,eAAe,CACnCI,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAKA,GAAI,CAAAW,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACX,IACd,CAEA,GAAI,CAAAW,MAAMA,CAACC,CAAc,CAAE,CACzB,IAAI,CAACZ,IAAI,CAAGY,CACd,CAQA,MAAc,CAAAC,WAAWA,CAACC,CAAmB,CAA+B,CAC1E,GAAI,CAAAC,CAGH,CAAG,CAAC,CAAC,CAIN,IAAK,GAAI,CAAAC,CAAC,CAAGF,CAAM,CAACG,MAAM,CAAG,CAAC,CAAO,CAAC,EAAND,CAAM,CAAEA,CAAC,EAAE,CAAE,CAC3C,KAAM,CAAAE,CAAK,CAAGJ,CAAM,CAACE,CAAC,CAAC,CAEvB,GAAI,CAACE,CAAK,CAACC,eAAe,CACxB,SAGF,KAAM,CAAEC,EAAE,CAAEC,CAAmB,CAAEC,OAAO,CAAPA,CAAQ,CAAC,CAAGJ,CAAK,CAACC,eAAe,CAACX,IAAI,CAAC,CAEpEa,CAAmB,EAAgB,IAAI,GAAhBC,CAAgB,IACzCP,CAAmB,CAAG,CAAEM,mBAAmB,CAAnBA,CAAmB,CAAEC,OAAO,CAAPA,CAAQ,CAAC,CAE1D,CAEA,KAAM,CAAED,mBAAmB,CAAnBA,CAAmB,CAAEC,OAAO,CAAPA,CAAQ,CAAC,CAAGP,CAAmB,CAE5D,GAAIM,CAAmB,EAAuB,QAAQ,EAA3B,MAAO,CAAAC,CAAoB,CAAE,CACtD,KAAM,CAAAxB,CAAe,CACnBuB,CAAmB,EAAIE,6BAAsB,CAACD,CAAO,CAAW,CAElE,MAAO,IAAI,CAAA1B,eAAe,CAACE,CAAe,CAC5C,CACF,CACF,CAAC0B,OAAA,CAAA5B,eAAA,CAAAA,eAAA"}
1
+ {"version":3,"file":"operatingSystem.js","names":["OperatingSystem","constructor","operatingSystem","_defineProperty","sent","url","UrlEventType","StaticData","UrlParameter","Os","OsIndex","OperatingSystemIndexMap","data","type","KameleoonData","isSent","value","_fromVisit","visit","staticDataEvent","os","operatingSystemType","osIndex","OperatingSystemTypeMap","exports"],"sources":["../../src/kameleoonData/operatingSystem.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport {\n IKameleoonData,\n KameleoonData,\n OperatingSystemDataType,\n OperatingSystemIndexMap,\n OperatingSystemType,\n OperatingSystemTypeMap,\n} from './types';\n\n/**\n * @class\n * OperatingSystem - a class for creating an instance for Operating System of a certain type\n * */\nexport class OperatingSystem implements IKameleoonData {\n private operatingSystem: OperatingSystemType;\n private sent: boolean;\n\n /**\n * @param {OperatingSystemType} operatingSystem - one of the available operating system types from `OperatingSystemType` enum\n * */\n constructor(operatingSystem: OperatingSystemType) {\n this.operatingSystem = operatingSystem;\n this.sent = false;\n }\n\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.operatingSystem) {\n return '';\n }\n\n return (\n UrlEventType.StaticData +\n UrlParameter.Os +\n this.operatingSystem +\n UrlParameter.OsIndex +\n OperatingSystemIndexMap[this.operatingSystem]\n );\n }\n\n get data(): OperatingSystemDataType {\n return {\n operatingSystem: this.operatingSystem,\n type: KameleoonData.OperatingSystem,\n sent: this.sent,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @private\n * @method _fromVisit - a static method for creating an instance of OperatingSystem class from a visit\n * @param {VisitType} visit - a visit\n * @returns {OperatingSystem | undefined} an instance of OperatingSystem class or undefined\n * */\n public static _fromVisit(visit: VisitType): OperatingSystem | undefined {\n if (!visit.staticDataEvent) {\n return undefined;\n }\n\n const { os: operatingSystemType, osIndex } = visit.staticDataEvent.data;\n\n if (operatingSystemType || typeof osIndex === 'number') {\n const operatingSystem =\n operatingSystemType ?? OperatingSystemTypeMap[osIndex as number];\n\n return new OperatingSystem(operatingSystem);\n }\n\n return undefined;\n }\n}\n"],"mappings":"uqBAcO,KAAM,CAAAA,eAA0C,CAOrDC,WAAWA,CAACC,CAAoC,CAAE,CAAAC,eAAA,gCAAAA,eAAA,qBAChD,IAAI,CAACD,eAAe,CAAGA,CAAe,CACtC,IAAI,CAACE,IAAI,GACX,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,OAIX,KAAI,CAACH,eAAe,CAKvBI,uBAAY,CAACC,UAAU,CACvBC,uBAAY,CAACC,EAAE,CACf,IAAI,CAACP,eAAe,CACpBM,uBAAY,CAACE,OAAO,CACpBC,8BAAuB,CAAC,IAAI,CAACT,eAAe,CAAC,CARtC,EAUX,CAEA,GAAI,CAAAU,IAAIA,CAAA,CAA4B,CAClC,MAAO,CACLV,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCW,IAAI,CAAEC,oBAAa,CAACd,eAAe,CACnCI,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAEA,GAAI,CAAAW,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACX,IACd,CAEA,GAAI,CAAAW,MAAMA,CAACC,CAAc,CAAE,CACzB,IAAI,CAACZ,IAAI,CAAGY,CACd,CAQA,MAAc,CAAAC,UAAUA,CAACC,CAAgB,CAA+B,CACtE,GAAKA,CAAK,CAACC,eAAe,EAI1B,KAAM,CAAEC,EAAE,CAAEC,CAAmB,CAAEC,OAAO,CAAPA,CAAQ,CAAC,CAAGJ,CAAK,CAACC,eAAe,CAACP,IAAI,CAEvE,GAAIS,CAAmB,EAAuB,QAAQ,EAA3B,MAAO,CAAAC,CAAoB,CAAE,CACtD,KAAM,CAAApB,CAAe,QACnBmB,CAAmB,WAAnBA,CAAmB,CAAnBA,CAAmB,CAAIE,6BAAsB,CAACD,CAAO,CAAW,CAElE,MAAO,IAAI,CAAAtB,eAAe,CAACE,CAAe,CAC5C,CAAC,CAGH,CACF,CAACsB,OAAA,CAAAxB,eAAA,CAAAA,eAAA"}
@@ -14,17 +14,8 @@ export declare class PageView implements IKameleoonData {
14
14
  * @param {PageViewParametersType} pageViewParameters - an object with page view parameters
15
15
  * */
16
16
  constructor({ urlAddress, title, referrers }: PageViewParametersType);
17
- /**
18
- * @property url - url for the current data type used for events tracking
19
- * */
20
17
  get url(): string;
21
- /**
22
- * @property data - data of the current class instance
23
- * */
24
18
  get data(): PageViewDataType;
25
- /**
26
- * @property isSent - signifying if the data was sent already tracked
27
- * */
28
19
  get isSent(): boolean;
29
20
  set isSent(value: boolean);
30
21
  /**
@@ -34,9 +25,9 @@ export declare class PageView implements IKameleoonData {
34
25
  set timestamps(value: number[]);
35
26
  /**
36
27
  * @private
37
- * @method _listFromVisits - an internal method for creating a list of page view data from a list of visits
38
- * @param {VisitType[]} visits - a list of visits
39
- * @returns {PageView[]} a list of PageView instances
28
+ * @method _updateFromVisit - an internal method for updating a list of page view data from a visit
29
+ * @param {VisitType} visit - a visit
30
+ * @param {Map<string, PageView>} dataMap - a map of page view data where we collect data
40
31
  * */
41
- static _listFromVisits(visits: VisitType[]): PageView[];
32
+ static _updateFromVisit(visit: VisitType, dataMap: Map<string, PageView>): void;
42
33
  }
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageView=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("./types");function _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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class PageView{constructor(a){let{urlAddress:b,title:c,referrers:d}=a;_defineProperty(this,"urlAddress",void 0),_defineProperty(this,"title",void 0),_defineProperty(this,"referrers",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"timestampList",[]),this.urlAddress=b,this.title=c,this.referrers=d,this.sent=!1}get url(){var a;if(!this.urlAddress)return"";const b=this.title?_requester.UrlParameter.Title+encodeURIComponent(this.title):"",c=null!==(a=this.referrers)&&void 0!==a&&a.length?_requester.UrlParameter.ReferrersIndices+JSON.stringify(this.referrers):"";return _requester.UrlEventType.Page+_requester.UrlParameter.Href+encodeURIComponent(this.urlAddress)+b+c}get data(){return{urlAddress:this.urlAddress,title:this.title,referrers:this.referrers,type:_types2.KameleoonData.PageView,sent:this.sent,timestamps:this.timestampList}}get isSent(){return this.sent}set isSent(a){this.sent=a}get timestamps(){return this.timestampList}set timestamps(a){const b=new Set(a);this.timestampList.length?b.forEach(a=>{_utilities.Utilities.insertInOrderedListMutably({list:this.timestampList,element:a,order:_types.Order.Ascending})}):this.timestampList=[...b]}static _listFromVisits(a){const b=[],c=new Map;for(let b=a.length-1;0<=b;b--){const d=a[b];if(!d.pageEvents)continue;const e=d.pageEvents;for(const a of e){let b=[];const{time:d}=a,{href:e,title:f,referrersIndices:g}=a.data;"number"==typeof g[0]&&(b=g);let h;if(c.has(e)){const a=c.get(e).timestamps;h=new PageView({urlAddress:e,title:f,referrers:b}),h.timestamps=[...a,d]}else h=new PageView({urlAddress:e,title:f,referrers:b}),h.timestamps=[d];c.set(e,h)}}return c.forEach(a=>{a.isSent=!0,b.push(a)}),b}}exports.PageView=PageView;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PageView=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("./types");function _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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class PageView{constructor(a){let{urlAddress:b,title:c,referrers:d}=a;_defineProperty(this,"urlAddress",void 0),_defineProperty(this,"title",void 0),_defineProperty(this,"referrers",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"timestampList",[]),this.urlAddress=b,this.title=c,this.referrers=d,this.sent=!1}get url(){var a;if(!this.urlAddress)return"";const b=this.title?_requester.UrlParameter.Title+encodeURIComponent(this.title):"",c=null!==(a=this.referrers)&&void 0!==a&&a.length?_requester.UrlParameter.ReferrersIndices+JSON.stringify(this.referrers):"";return _requester.UrlEventType.Page+_requester.UrlParameter.Href+encodeURIComponent(this.urlAddress)+b+c}get data(){return{urlAddress:this.urlAddress,title:this.title,referrers:this.referrers,type:_types2.KameleoonData.PageView,sent:this.sent,timestamps:this.timestampList}}get isSent(){return this.sent}set isSent(a){this.sent=a}get timestamps(){return this.timestampList}set timestamps(a){const b=new Set(a);this.timestampList.length?b.forEach(a=>{_utilities.Utilities.insertInOrderedListMutably({list:this.timestampList,element:a,order:_types.Order.Ascending})}):this.timestampList=[...b]}static _updateFromVisit(a,b){const c=a.pageEvents;if(c)for(const a of c){let c=[];const{time:d}=a,{href:e,title:f,referrersIndices:g}=a.data;"number"==typeof g[0]&&(c=g);let h;if(b.has(e)){const a=b.get(e).timestamps;h=new PageView({urlAddress:e,title:f,referrers:c}),h.timestamps=[...a,d]}else h=new PageView({urlAddress:e,title:f,referrers:c}),h.timestamps=[d];h.isSent=!0,b.set(e,h)}}}exports.PageView=PageView;
2
2
  //# sourceMappingURL=pageView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pageView.js","names":["PageView","constructor","a","urlAddress","title","referrers","_defineProperty","sent","url","titleParameter","UrlParameter","Title","encodeURIComponent","referrersParameter","length","ReferrersIndices","JSON","stringify","UrlEventType","Page","Href","data","type","KameleoonData","timestamps","timestampList","isSent","value","uniqueValues","Set","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","_listFromVisits","visits","resultData","pageViewMap","Map","i","visit","pageEvents","pageEvent","time","href","referrersIndices","pageView","has","existingTimestamps","get","set","push","exports"],"sources":["../../src/kameleoonData/pageView.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport {\n IKameleoonData,\n KameleoonData,\n PageViewDataType,\n PageViewParametersType,\n} from './types';\n\n/**\n * @class\n * PageView - a class for creating an instance of a page view data\n * */\nexport class PageView implements IKameleoonData {\n private urlAddress: string;\n private title: string;\n private referrers?: number[];\n private sent: boolean;\n // --- Note ---\n // Ascending order\n private timestampList: number[] = [];\n\n /**\n * @param {PageViewParametersType} pageViewParameters - an object with page view parameters\n * */\n constructor({ urlAddress, title, referrers }: PageViewParametersType) {\n this.urlAddress = urlAddress;\n this.title = title;\n this.referrers = referrers;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.urlAddress) {\n return '';\n }\n\n const titleParameter = this.title\n ? UrlParameter.Title + encodeURIComponent(this.title)\n : '';\n\n const referrersParameter = this.referrers?.length\n ? UrlParameter.ReferrersIndices + JSON.stringify(this.referrers)\n : '';\n\n return (\n UrlEventType.Page +\n UrlParameter.Href +\n encodeURIComponent(this.urlAddress) +\n titleParameter +\n referrersParameter\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): PageViewDataType {\n return {\n urlAddress: this.urlAddress,\n title: this.title,\n referrers: this.referrers,\n type: KameleoonData.PageView,\n sent: this.sent,\n timestamps: this.timestampList,\n };\n }\n\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @property timestamps - a list of timestamps for the current data type\n * */\n get timestamps(): number[] {\n return this.timestampList;\n }\n\n set timestamps(value: number[]) {\n const uniqueValues = new Set<number>(value);\n\n if (this.timestampList.length) {\n // --- Note ---\n // We want to keep the list in ascending order\n uniqueValues.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: this.timestampList,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n } else {\n this.timestampList = [...uniqueValues];\n }\n }\n\n /**\n * @private\n * @method _listFromVisits - an internal method for creating a list of page view data from a list of visits\n * @param {VisitType[]} visits - a list of visits\n * @returns {PageView[]} a list of PageView instances\n * */\n public static _listFromVisits(visits: VisitType[]): PageView[] {\n const resultData: PageView[] = [];\n const pageViewMap = new Map<string, PageView>();\n\n // --- Note ---\n // Going backwards to get the latest visit data\n for (let i = visits.length - 1; i >= 0; i--) {\n const visit = visits[i];\n\n if (!visit.pageEvents) {\n continue;\n }\n\n const pageEvents = visit.pageEvents;\n\n for (const pageEvent of pageEvents) {\n let referrers: number[] = [];\n\n const { time } = pageEvent;\n const { href, title, referrersIndices } = pageEvent.data;\n\n if (typeof referrersIndices[0] === 'number') {\n referrers = referrersIndices as number[];\n }\n\n let pageView: PageView;\n\n if (pageViewMap.has(href)) {\n const existingTimestamps = pageViewMap.get(href)!.timestamps;\n\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [...existingTimestamps, time];\n } else {\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [time];\n }\n\n pageViewMap.set(href, pageView);\n }\n }\n\n pageViewMap.forEach((value) => {\n // --- Note ---\n // We don't want to track collected pages again\n value.isSent = true;\n resultData.push(value);\n });\n\n return resultData;\n }\n}\n"],"mappings":"yuBAcO,KAAM,CAAAA,QAAmC,CAY9CC,WAAWA,CAAAC,CAAA,CAA2D,IAA1D,CAAEC,UAAU,CAAVA,CAAU,CAAEC,KAAK,CAALA,CAAK,CAAEC,SAAS,CAATA,CAAkC,CAAC,CAAAH,CAAA,CAAAI,eAAA,2BAAAA,eAAA,sBAAAA,eAAA,0BAAAA,eAAA,qBAAAA,eAAA,sBALlC,EAAE,EAMlC,IAAI,CAACH,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACC,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACE,IAAI,GACX,CAKA,GAAI,CAAAC,GAAGA,CAAA,CAAW,KAAAN,CAAA,CAIhB,GAAI,CAAC,IAAI,CAACC,UAAU,CAClB,MAAO,EAAE,CACV,KAEK,CAAAM,CAAc,CAAG,IAAI,CAACL,KAAK,CAC7BM,uBAAY,CAACC,KAAK,CAAGC,kBAAkB,CAAC,IAAI,CAACR,KAAK,CAAC,CACnD,EAAE,CAEAS,CAAkB,CAAG,QAAAX,CAAA,KAAI,CAACG,SAAS,YAAAH,CAAA,EAAdA,CAAA,CAAgBY,MAAM,CAC7CJ,uBAAY,CAACK,gBAAgB,CAAGC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACZ,SAAS,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,CAACN,CAAI,CAAEE,CAAQ,CAChC,CACF,CASA,MAPA,CAAAT,CAAW,CAACZ,OAAO,CAAEH,CAAK,EAAK,CAG7BA,CAAK,CAACD,MAAM,GAAO,CACnBe,CAAU,CAACe,IAAI,CAAC7B,CAAK,CACvB,CAAC,CAAC,CAEKc,CACT,CACF,CAACgB,OAAA,CAAAzD,QAAA,CAAAA,QAAA"}
1
+ {"version":3,"file":"pageView.js","names":["PageView","constructor","a","urlAddress","title","referrers","_defineProperty","sent","url","titleParameter","UrlParameter","Title","encodeURIComponent","referrersParameter","length","ReferrersIndices","JSON","stringify","UrlEventType","Page","Href","data","type","KameleoonData","timestamps","timestampList","isSent","value","uniqueValues","Set","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","_updateFromVisit","visit","dataMap","pageEvents","pageEvent","time","href","referrersIndices","pageView","has","existingTimestamps","get","set","exports"],"sources":["../../src/kameleoonData/pageView.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport {\n IKameleoonData,\n KameleoonData,\n PageViewDataType,\n PageViewParametersType,\n} from './types';\n\n/**\n * @class\n * PageView - a class for creating an instance of a page view data\n * */\nexport class PageView implements IKameleoonData {\n private urlAddress: string;\n private title: string;\n private referrers?: number[];\n private sent: boolean;\n // --- Note ---\n // Ascending order\n private timestampList: number[] = [];\n\n /**\n * @param {PageViewParametersType} pageViewParameters - an object with page view parameters\n * */\n constructor({ urlAddress, title, referrers }: PageViewParametersType) {\n this.urlAddress = urlAddress;\n this.title = title;\n this.referrers = referrers;\n this.sent = false;\n }\n\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.urlAddress) {\n return '';\n }\n\n const titleParameter = this.title\n ? UrlParameter.Title + encodeURIComponent(this.title)\n : '';\n\n const referrersParameter = this.referrers?.length\n ? UrlParameter.ReferrersIndices + JSON.stringify(this.referrers)\n : '';\n\n return (\n UrlEventType.Page +\n UrlParameter.Href +\n encodeURIComponent(this.urlAddress) +\n titleParameter +\n referrersParameter\n );\n }\n\n get data(): PageViewDataType {\n return {\n urlAddress: this.urlAddress,\n title: this.title,\n referrers: this.referrers,\n type: KameleoonData.PageView,\n sent: this.sent,\n timestamps: this.timestampList,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @property timestamps - a list of timestamps for the current data type\n * */\n get timestamps(): number[] {\n return this.timestampList;\n }\n\n set timestamps(value: number[]) {\n const uniqueValues = new Set<number>(value);\n\n if (this.timestampList.length) {\n // --- Note ---\n // We want to keep the list in ascending order\n uniqueValues.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: this.timestampList,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n } else {\n this.timestampList = [...uniqueValues];\n }\n }\n\n /**\n * @private\n * @method _updateFromVisit - an internal method for updating a list of page view data from a visit\n * @param {VisitType} visit - a visit\n * @param {Map<string, PageView>} dataMap - a map of page view data where we collect data\n * */\n public static _updateFromVisit(\n visit: VisitType,\n dataMap: Map<string, PageView>,\n ): void {\n const pageEvents = visit.pageEvents;\n\n if (pageEvents) {\n for (const pageEvent of pageEvents) {\n let referrers: number[] = [];\n\n const { time } = pageEvent;\n const { href, title, referrersIndices } = pageEvent.data;\n\n if (typeof referrersIndices[0] === 'number') {\n referrers = referrersIndices as number[];\n }\n\n let pageView: PageView;\n\n if (dataMap.has(href)) {\n const existingTimestamps = dataMap.get(href)!.timestamps;\n\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [...existingTimestamps, time];\n } else {\n pageView = new PageView({\n urlAddress: href,\n title,\n referrers,\n });\n\n pageView.timestamps = [time];\n }\n\n // --- Note ---\n // We don't want to track collected pages again\n pageView.isSent = true;\n dataMap.set(href, pageView);\n }\n }\n }\n}\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GAAG,CAACH,CAAI,CAAC,CAAE,CACrB,KAAM,CAAAI,CAAkB,CAAGR,CAAO,CAACS,GAAG,CAACL,CAAI,CAAC,CAAErB,UAAU,CAExDuB,CAAQ,CAAG,GAAI,CAAA/C,QAAQ,CAAC,CACtBG,UAAU,CAAE0C,CAAI,CAChBzC,KAAK,CAALA,CAAK,CACLC,SAAS,CAATA,CACF,CAAC,CAAC,CAEF0C,CAAQ,CAACvB,UAAU,CAAG,CAAC,GAAGyB,CAAkB,CAAEL,CAAI,CACpD,CAAC,IACC,CAAAG,CAAQ,CAAG,GAAI,CAAA/C,QAAQ,CAAC,CACtBG,UAAU,CAAE0C,CAAI,CAChBzC,KAAK,CAALA,CAAK,CACLC,SAAS,CAATA,CACF,CAAC,CAAC,CAEF0C,CAAQ,CAACvB,UAAU,CAAG,CAACoB,CAAI,CAAC,CAK9BG,CAAQ,CAACrB,MAAM,GAAO,CACtBe,CAAO,CAACU,GAAG,CAACN,CAAI,CAAEE,CAAQ,CAC5B,CAEJ,CACF,CAACK,OAAA,CAAApD,QAAA,CAAAA,QAAA"}
@@ -1,6 +1,6 @@
1
- import { TargetingDataType } from '../targeting';
2
- import { IStorage } from '../storage';
3
- import { Browser, Conversion, Cookie, CustomData, Device, GeolocationData, OperatingSystem, PageView, UserAgent, ApplicationVersion, VisitsData } from '../kameleoonData';
1
+ import { DereferencedTargetingDataType, TargetingDataType } from '../targeting';
2
+ import { FeatureFlagVariationsType, IStorage } from '../storage';
3
+ import { Browser, Conversion, Cookie, CustomData, Device, GeolocationData, OperatingSystem, PageView, UserAgent, ApplicationVersion, VisitsData, KameleoonConversionScore } from '../kameleoonData';
4
4
  export type UnsentVisitorTargetingDataType = Map<KameleoonData | number, KameleoonDataType | KameleoonDataType[]>;
5
5
  export type UnsentTargetingDataType = {
6
6
  [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;
@@ -9,41 +9,54 @@ export type FieldParametersType = {
9
9
  visitorCode: string;
10
10
  key: KameleoonData;
11
11
  value: BrowserDataType | CookieDataType | DeviceDataType | GeolocationDataType | OperatingSystemDataType | UserAgentDataType | VisitsDataType;
12
- data: TargetingDataType;
12
+ data: DereferencedTargetingDataType;
13
13
  };
14
14
  export type ArrayFieldParametersType = {
15
15
  visitorCode: string;
16
16
  key: KameleoonData;
17
17
  value: ConversionDataType;
18
- data: TargetingDataType;
18
+ data: DereferencedTargetingDataType;
19
19
  };
20
20
  export type NestedFieldParametersType = {
21
21
  visitorCode: string;
22
22
  key: KameleoonData.CustomData | KameleoonData.PageView;
23
23
  nestedKey: string;
24
24
  value: CustomDataType | PageViewDataType;
25
- data: TargetingDataType;
25
+ data: DereferencedTargetingDataType;
26
+ };
27
+ export type DereferenceTargetingDataResultType = {
28
+ data: KameleoonVisitorDataType;
29
+ visitorReference: string;
26
30
  };
27
31
  export type DataManagerParametersType = {
28
32
  targetingCleanupInterval?: number;
29
33
  storage: IStorage<TargetingDataType>;
30
34
  };
31
- export type KameleoonDataItemType = BrowserDataType | ConversionDataType | CustomDataType | DeviceDataType | PageViewDataType | UserAgentDataType | CookieDataType | GeolocationDataType | OperatingSystemDataType | ApplicationVersionDataType | VisitsDataType;
35
+ export type KameleoonDataItemType = BrowserDataType | ConversionDataType | CustomDataType | DeviceDataType | PageViewDataType | UserAgentDataType | CookieDataType | GeolocationDataType | OperatingSystemDataType | ApplicationVersionDataType | KCSDataType | VisitsDataType;
32
36
  /**
33
37
  * @interface an interface of KameleoonData
34
38
  * each class instance will have url getter method
35
39
  * for handling url of different data types
36
40
  * */
37
41
  export interface IKameleoonData {
42
+ /**
43
+ * @property url - url for the current data type used for events tracking
44
+ * */
38
45
  readonly url: string;
46
+ /**
47
+ * @property data - data of the current class instance
48
+ * */
39
49
  readonly data: KameleoonDataItemType;
50
+ /**
51
+ * @property isSent - signifying if the data was sent already tracked
52
+ * */
40
53
  isSent: boolean;
41
54
  }
42
55
  /**
43
56
  * @type a tuple of each possible type of data for `addData` method
44
57
  * of KameleoonClient
45
58
  * */
46
- export type KameleoonDataType = Browser | Conversion | CustomData | Device | PageView | UserAgent | VisitsData | GeolocationData | OperatingSystem | Cookie | ApplicationVersion;
59
+ export type KameleoonDataType = Browser | Conversion | CustomData | Device | PageView | UserAgent | VisitsData | GeolocationData | OperatingSystem | Cookie | ApplicationVersion | KameleoonConversionScore;
47
60
  export type ActivityTimePropertyType = {
48
61
  lastActivityTime: number;
49
62
  };
@@ -67,6 +80,7 @@ export type KameleoonVisitorDataType<T = ActivityTimePropertyType> = {
67
80
  [KameleoonData.Browser]?: BrowserDataType & T;
68
81
  [KameleoonData.Device]?: DeviceDataType & T;
69
82
  [KameleoonData.Cookie]?: CookieDataType & T;
83
+ [KameleoonData.KameleoonConversionScore]?: KCSDataType & T;
70
84
  [KameleoonData.OperatingSystem]?: OperatingSystemDataType & T;
71
85
  [KameleoonData.ApplicationVersion]?: ApplicationVersionDataType & T;
72
86
  [KameleoonData.VisitsData]?: VisitsDataType & T;
@@ -82,7 +96,8 @@ export declare enum KameleoonData {
82
96
  OperatingSystem = "operatingSystem",
83
97
  UserAgent = "userAgent",
84
98
  ApplicationVersion = "applicationVersion",
85
- VisitsData = "visitsData"
99
+ VisitsData = "visitsData",
100
+ KameleoonConversionScore = "kameleoonConversionScore"
86
101
  }
87
102
  type SharedDataPropertiesType = {
88
103
  type: KameleoonData;
@@ -105,9 +120,11 @@ export type CustomDataType = {
105
120
  export type DeviceDataType = {
106
121
  device: DeviceType;
107
122
  } & SharedDataPropertiesType;
123
+ export type KCSDataType = {
124
+ kcs: KCSType;
125
+ } & SharedDataPropertiesType;
108
126
  export type VisitsDataType = {
109
- previousVisits: number[];
110
- currentVisit: number | null;
127
+ visits: number[];
111
128
  } & SharedDataPropertiesType;
112
129
  export type OperatingSystemDataType = {
113
130
  operatingSystem: OperatingSystemType;
@@ -191,6 +208,14 @@ export type CookieType = {
191
208
  key: string;
192
209
  value: string;
193
210
  };
211
+ /**
212
+ * @type Nested object of key moments and goals with their respective scores
213
+ * */
214
+ export type KCSType = {
215
+ [keyMoment: string]: {
216
+ [goalId: string]: number;
217
+ };
218
+ };
194
219
  export type OptionalCookieType = Omit<CookieType, 'key'> & {
195
220
  key?: string;
196
221
  };
@@ -224,4 +249,22 @@ export declare const BrowserIndexMap: {
224
249
  readonly OTHER: 5;
225
250
  };
226
251
  export declare const BrowserTypeMap: Record<number, BrowserType>;
252
+ export type SingleDataType = {
253
+ [KameleoonData.Device]: Device | null;
254
+ [KameleoonData.Browser]: Browser | null;
255
+ [KameleoonData.GeolocationData]: GeolocationData | null;
256
+ [KameleoonData.OperatingSystem]: OperatingSystem | null;
257
+ [KameleoonData.KameleoonConversionScore]: KameleoonConversionScore | null;
258
+ };
259
+ export type MultipleDataType = {
260
+ [KameleoonData.CustomData]: Map<number, CustomData>;
261
+ [KameleoonData.PageView]: Map<string, PageView>;
262
+ [KameleoonData.Conversion]: Map<number, Conversion>;
263
+ };
264
+ export type VisitProcessorDataType = {
265
+ visitorData: KameleoonDataType[];
266
+ storageVisitorData: KameleoonDataType[];
267
+ visitsData: VisitsData;
268
+ experimentData: FeatureFlagVariationsType;
269
+ };
227
270
  export {};
@@ -1,2 +1,2 @@
1
- "use strict";var _helpers=require("./helpers");Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperatingSystemTypeMap=exports.OperatingSystemType=exports.OperatingSystemIndexMap=exports.KameleoonData=exports.DeviceType=exports.BrowserTypeMap=exports.BrowserType=exports.BrowserIndexMap=void 0;let KameleoonData=exports.KameleoonData=function(a){return a.CustomData="customData",a.PageView="pageView",a.GeolocationData="geolocation",a.Browser="browser",a.Conversion="conversion",a.Cookie="cookie",a.Device="device",a.OperatingSystem="operatingSystem",a.UserAgent="userAgent",a.ApplicationVersion="applicationVersion",a.VisitsData="visitsData",a}({}),DeviceType=exports.DeviceType=function(a){return a.Phone="PHONE",a.Tablet="TABLET",a.Desktop="DESKTOP",a}({}),OperatingSystemType=exports.OperatingSystemType=function(a){return a.WindowsPhone="WINDOWS_PHONE",a.Windows="WINDOWS",a.Android="ANDROID",a.Linux="LINUX",a.Mac="MAC",a.IOS="IOS",a}({}),BrowserType=exports.BrowserType=function(a){return a.Chrome="CHROME",a.InternetExplorer="IE",a.Firefox="FIREFOX",a.Safari="SAFARI",a.Opera="OPERA",a.Other="OTHER",a}({});const OperatingSystemIndexMap=exports.OperatingSystemIndexMap={[OperatingSystemType.Windows]:0,[OperatingSystemType.Mac]:1,[OperatingSystemType.IOS]:2,[OperatingSystemType.Linux]:3,[OperatingSystemType.Android]:4,[OperatingSystemType.WindowsPhone]:5},OperatingSystemTypeMap=exports.OperatingSystemTypeMap=(0,_helpers.constructTypeMap)(OperatingSystemIndexMap),BrowserIndexMap=exports.BrowserIndexMap={[BrowserType.Chrome]:0,[BrowserType.InternetExplorer]:1,[BrowserType.Firefox]:2,[BrowserType.Safari]:3,[BrowserType.Opera]:4,[BrowserType.Other]:5},BrowserTypeMap=exports.BrowserTypeMap=(0,_helpers.constructTypeMap)(BrowserIndexMap);
1
+ "use strict";var _helpers=require("./helpers");Object.defineProperty(exports,"__esModule",{value:!0}),exports.OperatingSystemTypeMap=exports.OperatingSystemType=exports.OperatingSystemIndexMap=exports.KameleoonData=exports.DeviceType=exports.BrowserTypeMap=exports.BrowserType=exports.BrowserIndexMap=void 0;let KameleoonData=exports.KameleoonData=function(a){return a.CustomData="customData",a.PageView="pageView",a.GeolocationData="geolocation",a.Browser="browser",a.Conversion="conversion",a.Cookie="cookie",a.Device="device",a.OperatingSystem="operatingSystem",a.UserAgent="userAgent",a.ApplicationVersion="applicationVersion",a.VisitsData="visitsData",a.KameleoonConversionScore="kameleoonConversionScore",a}({}),DeviceType=exports.DeviceType=function(a){return a.Phone="PHONE",a.Tablet="TABLET",a.Desktop="DESKTOP",a}({}),OperatingSystemType=exports.OperatingSystemType=function(a){return a.WindowsPhone="WINDOWS_PHONE",a.Windows="WINDOWS",a.Android="ANDROID",a.Linux="LINUX",a.Mac="MAC",a.IOS="IOS",a}({}),BrowserType=exports.BrowserType=function(a){return a.Chrome="CHROME",a.InternetExplorer="IE",a.Firefox="FIREFOX",a.Safari="SAFARI",a.Opera="OPERA",a.Other="OTHER",a}({});const OperatingSystemIndexMap=exports.OperatingSystemIndexMap={[OperatingSystemType.Windows]:0,[OperatingSystemType.Mac]:1,[OperatingSystemType.IOS]:2,[OperatingSystemType.Linux]:3,[OperatingSystemType.Android]:4,[OperatingSystemType.WindowsPhone]:5},OperatingSystemTypeMap=exports.OperatingSystemTypeMap=(0,_helpers.constructTypeMap)(OperatingSystemIndexMap),BrowserIndexMap=exports.BrowserIndexMap={[BrowserType.Chrome]:0,[BrowserType.InternetExplorer]:1,[BrowserType.Firefox]:2,[BrowserType.Safari]:3,[BrowserType.Opera]:4,[BrowserType.Other]:5},BrowserTypeMap=exports.BrowserTypeMap=(0,_helpers.constructTypeMap)(BrowserIndexMap);
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["_helpers","require","Object","defineProperty","exports","value","OperatingSystemTypeMap","OperatingSystemType","OperatingSystemIndexMap","KameleoonData","DeviceType","BrowserTypeMap","BrowserType","BrowserIndexMap","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","Phone","Tablet","Desktop","WindowsPhone","Windows","Android","Linux","Mac","IOS","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","constructTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import { TargetingDataType } from 'src/targeting';\nimport { IStorage } 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: IStorage<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":"aAeA,IAAAA,QAAA,CAAAC,OAAA,cAA6CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,sBAAA,CAAAF,OAAA,CAAAG,mBAAA,CAAAH,OAAA,CAAAI,uBAAA,CAAAJ,OAAA,CAAAK,aAAA,CAAAL,OAAA,CAAAM,UAAA,CAAAN,OAAA,CAAAO,cAAA,CAAAP,OAAA,CAAAQ,WAAA,CAAAR,OAAA,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,mBAAmB,CAAC0B,GAAG,EAAG,CAAC,CAC5B,CAAC1B,mBAAmB,CAACwB,KAAK,EAAG,CAAC,CAC9B,CAACxB,mBAAmB,CAACuB,OAAO,EAAG,CAAC,CAChC,CAACvB,mBAAmB,CAACqB,YAAY,EAAG,CACtC,CAAU,CAEGtB,sBAAsB,CAAAF,OAAA,CAAAE,sBAAA,CAAG,GAAAkC,yBAAgB,EACpDhC,uBACF,CAAC,CAEYK,eAAe,CAAAT,OAAA,CAAAS,eAAA,CAAG,CAC7B,CAACD,WAAW,CAACsB,MAAM,EAAG,CAAC,CACvB,CAACtB,WAAW,CAACuB,gBAAgB,EAAG,CAAC,CACjC,CAACvB,WAAW,CAACwB,OAAO,EAAG,CAAC,CACxB,CAACxB,WAAW,CAACyB,MAAM,EAAG,CAAC,CACvB,CAACzB,WAAW,CAAC0B,KAAK,EAAG,CAAC,CACtB,CAAC1B,WAAW,CAAC2B,KAAK,EAAG,CACvB,CAAU,CAEG5B,cAAc,CAAAP,OAAA,CAAAO,cAAA,CAAG,GAAA6B,yBAAgB,EAAc3B,eAAe,CAAC"}
1
+ {"version":3,"file":"types.js","names":["_helpers","require","Object","defineProperty","exports","value","OperatingSystemTypeMap","OperatingSystemType","OperatingSystemIndexMap","KameleoonData","DeviceType","BrowserTypeMap","BrowserType","BrowserIndexMap","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","KameleoonConversionScore","Phone","Tablet","Desktop","WindowsPhone","Windows","Android","Linux","Mac","IOS","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","constructTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import {\n DereferencedTargetingDataType,\n TargetingDataType,\n} from 'src/targeting';\nimport { FeatureFlagVariationsType, IStorage } 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 KameleoonConversionScore,\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: DereferencedTargetingDataType;\n};\n\nexport type ArrayFieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value: ConversionDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type NestedFieldParametersType = {\n visitorCode: string;\n key: KameleoonData.CustomData | KameleoonData.PageView;\n nestedKey: string;\n value: CustomDataType | PageViewDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type DereferenceTargetingDataResultType = {\n data: KameleoonVisitorDataType;\n visitorReference: string;\n};\n\nexport type DataManagerParametersType = {\n targetingCleanupInterval?: number;\n storage: IStorage<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 | KCSDataType\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 /**\n * @property url - url for the current data type used for events tracking\n * */\n readonly url: string;\n /**\n * @property data - data of the current class instance\n * */\n readonly data: KameleoonDataItemType;\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\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 | KameleoonConversionScore;\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.KameleoonConversionScore]?: KCSDataType & 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 KameleoonConversionScore = 'kameleoonConversionScore',\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 KCSDataType = {\n kcs: KCSType;\n} & SharedDataPropertiesType;\n\nexport type VisitsDataType = {\n visits: number[];\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\n/**\n * @type Nested object of key moments and goals with their respective scores\n * */\nexport type KCSType = {\n [keyMoment: string]: {\n [goalId: string]: number;\n };\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\nexport type SingleDataType = {\n [KameleoonData.Device]: Device | null;\n [KameleoonData.Browser]: Browser | null;\n [KameleoonData.GeolocationData]: GeolocationData | null;\n [KameleoonData.OperatingSystem]: OperatingSystem | null;\n [KameleoonData.KameleoonConversionScore]: KameleoonConversionScore | null;\n};\n\nexport type MultipleDataType = {\n [KameleoonData.CustomData]: Map<number, CustomData>;\n [KameleoonData.PageView]: Map<string, PageView>;\n [KameleoonData.Conversion]: Map<number, Conversion>;\n};\n\nexport type VisitProcessorDataType = {\n visitorData: KameleoonDataType[];\n storageVisitorData: KameleoonDataType[];\n visitsData: VisitsData;\n experimentData: FeatureFlagVariationsType;\n};\n"],"mappings":"aAmBA,IAAAA,QAAA,CAAAC,OAAA,cAA6CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,sBAAA,CAAAF,OAAA,CAAAG,mBAAA,CAAAH,OAAA,CAAAI,uBAAA,CAAAJ,OAAA,CAAAK,aAAA,CAAAL,OAAA,CAAAM,UAAA,CAAAN,OAAA,CAAAO,cAAA,CAAAP,OAAA,CAAAQ,WAAA,CAAAR,OAAA,CAAAS,eAAA,WAyJjC,CAAAJ,aAAa,CAAAL,OAAA,CAAAK,aAAA,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAK,UAAA,cAAbL,CAAa,CAAAM,QAAA,YAAbN,CAAa,CAAAO,eAAA,eAAbP,CAAa,CAAAQ,OAAA,WAAbR,CAAa,CAAAS,UAAA,cAAbT,CAAa,CAAAU,MAA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CAAAF,OAAA,CAAAE,sBAAA,CAAG,GAAAmC,yBAAgB,EACpDjC,uBACF,CAAC,CAEYK,eAAe,CAAAT,OAAA,CAAAS,eAAA,CAAG,CAC7B,CAACD,WAAW,CAACuB,MAAM,EAAG,CAAC,CACvB,CAACvB,WAAW,CAACwB,gBAAgB,EAAG,CAAC,CACjC,CAACxB,WAAW,CAACyB,OAAO,EAAG,CAAC,CACxB,CAACzB,WAAW,CAAC0B,MAAM,EAAG,CAAC,CACvB,CAAC1B,WAAW,CAAC2B,KAAK,EAAG,CAAC,CACtB,CAAC3B,WAAW,CAAC4B,KAAK,EAAG,CACvB,CAAU,CAEG7B,cAAc,CAAAP,OAAA,CAAAO,cAAA,CAAG,GAAA8B,yBAAgB,EAAc5B,eAAe,CAAC"}
@@ -7,17 +7,8 @@ export declare class UserAgent implements IKameleoonData {
7
7
  private value;
8
8
  private sent;
9
9
  constructor(value: string);
10
- /**
11
- * @property url - url for the current data type used for events tracking
12
- * */
13
10
  get url(): string;
14
- /**
15
- * @property data - data of the current class instance
16
- * */
17
11
  get data(): UserAgentDataType;
18
- /**
19
- * @property isSent - signifying if the data was sent already tracked
20
- * */
21
12
  get isSent(): boolean;
22
13
  set isSent(value: boolean);
23
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"userAgent.js","names":["_types","require","Object","defineProperty","exports","value","UserAgent","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","sent","url","data","type","KameleoonData","isSent"],"sources":["../../src/kameleoonData/userAgent.ts"],"sourcesContent":["import { UserAgentDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * UserAgent - a class for creating an instance for user agent\n * */\nexport class UserAgent implements IKameleoonData {\n private value: string;\n private sent: boolean;\n\n constructor(value: string) {\n this.value = value;\n this.sent = false;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return '';\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): UserAgentDataType {\n return {\n value: this.value,\n type: KameleoonData.UserAgent,\n 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"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,YAA2EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,SAAA,iBAAAC,gBAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,CAAAE,cAAA,CAAAF,CAAA,EAAAA,CAAA,IAAAD,CAAA,CAAAN,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAC,CAAA,EAAAJ,KAAA,CAAAK,CAAA,CAAAE,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAN,CAAA,CAAAC,CAAA,EAAAC,CAAA,CAAAF,CAAA,UAAAG,eAAAH,CAAA,MAAAC,CAAA,CAAAM,YAAA,CAAAP,CAAA,kCAAAC,CAAA,CAAAA,CAAA,CAAAA,CAAA,aAAAM,aAAAP,CAAA,CAAAC,CAAA,sBAAAD,CAAA,GAAAA,CAAA,QAAAA,CAAA,KAAAE,CAAA,CAAAF,CAAA,CAAAQ,MAAA,CAAAC,WAAA,cAAAP,CAAA,MAAAQ,CAAA,CAAAR,CAAA,CAAAS,IAAA,CAAAX,CAAA,CAAAC,CAAA,iCAAAS,CAAA,QAAAA,CAAA,WAAAE,SAAA,mEAAAX,CAAA,CAAAY,MAAA,CAAAC,MAAA,EAAAd,CAAA,EAMpE,KAAM,CAAAF,SAAoC,CAI/CiB,WAAWA,CAAClB,CAAa,CAAE,CAAAE,eAAA,sBAAAA,eAAA,qBACzB,IAAI,CAACF,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACmB,IAAI,GACX,CAKA,GAAI,CAAAC,GAAGA,CAAA,CAAW,CAChB,MAAO,EACT,CAKA,GAAI,CAAAC,IAAIA,CAAA,CAAsB,CAC5B,MAAO,CACLrB,KAAK,CAAE,IAAI,CAACA,KAAK,CACjBsB,IAAI,CAAEC,oBAAa,CAACtB,SAAS,CAC7BkB,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAKA,GAAI,CAAAK,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACL,IACd,CAEA,GAAI,CAAAK,MAAMA,CAACxB,CAAc,CAAE,CACzB,IAAI,CAACmB,IAAI,CAAGnB,CACd,CACF,CAACD,OAAA,CAAAE,SAAA,CAAAA,SAAA"}
1
+ {"version":3,"file":"userAgent.js","names":["_types","require","Object","defineProperty","exports","value","UserAgent","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","sent","url","data","type","KameleoonData","isSent"],"sources":["../../src/kameleoonData/userAgent.ts"],"sourcesContent":["import { UserAgentDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * UserAgent - a class for creating an instance for user agent\n * */\nexport class UserAgent implements IKameleoonData {\n private value: string;\n private sent: boolean;\n\n constructor(value: string) {\n this.value = value;\n this.sent = false;\n }\n\n get url(): string {\n return '';\n }\n\n get data(): UserAgentDataType {\n return {\n value: this.value,\n type: KameleoonData.UserAgent,\n sent: this.sent,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,YAA2EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,SAAA,iBAAAC,gBAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,CAAAE,cAAA,CAAAF,CAAA,EAAAA,CAAA,IAAAD,CAAA,CAAAN,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAC,CAAA,EAAAJ,KAAA,CAAAK,CAAA,CAAAE,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAN,CAAA,CAAAC,CAAA,EAAAC,CAAA,CAAAF,CAAA,UAAAG,eAAAH,CAAA,MAAAC,CAAA,CAAAM,YAAA,CAAAP,CAAA,kCAAAC,CAAA,CAAAA,CAAA,CAAAA,CAAA,aAAAM,aAAAP,CAAA,CAAAC,CAAA,sBAAAD,CAAA,GAAAA,CAAA,QAAAA,CAAA,KAAAE,CAAA,CAAAF,CAAA,CAAAQ,MAAA,CAAAC,WAAA,cAAAP,CAAA,MAAAQ,CAAA,CAAAR,CAAA,CAAAS,IAAA,CAAAX,CAAA,CAAAC,CAAA,iCAAAS,CAAA,QAAAA,CAAA,WAAAE,SAAA,mEAAAX,CAAA,CAAAY,MAAA,CAAAC,MAAA,EAAAd,CAAA,EAMpE,KAAM,CAAAF,SAAoC,CAI/CiB,WAAWA,CAAClB,CAAa,CAAE,CAAAE,eAAA,sBAAAA,eAAA,qBACzB,IAAI,CAACF,KAAK,CAAGA,CAAK,CAClB,IAAI,CAACmB,IAAI,GACX,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,CAChB,MAAO,EACT,CAEA,GAAI,CAAAC,IAAIA,CAAA,CAAsB,CAC5B,MAAO,CACLrB,KAAK,CAAE,IAAI,CAACA,KAAK,CACjBsB,IAAI,CAAEC,oBAAa,CAACtB,SAAS,CAC7BkB,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAEA,GAAI,CAAAK,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACL,IACd,CAEA,GAAI,CAAAK,MAAMA,CAACxB,CAAc,CAAE,CACzB,IAAI,CAACmB,IAAI,CAAGnB,CACd,CACF,CAACD,OAAA,CAAAE,SAAA,CAAAA,SAAA"}
@@ -0,0 +1,34 @@
1
+ import { VisitType } from '../requester';
2
+ import { VisitorDataFiltersType } from '../utilities/types';
3
+ import { VisitProcessorDataType, KCSType } from './types';
4
+ import { DataManager } from './dataManager';
5
+ interface IVisitProcessor {
6
+ processVisit(visit: VisitType): void;
7
+ processKcs(kcsData?: KCSType): void;
8
+ processMultipleDataTypes(): void;
9
+ }
10
+ export declare class VisitProcessor implements IVisitProcessor {
11
+ private visitsData;
12
+ private visitorData;
13
+ private storageVisitorData;
14
+ private experimentData;
15
+ private filters;
16
+ private dataManager;
17
+ private singleDataTypes;
18
+ private multipleDataTypes;
19
+ constructor(filters: VisitorDataFiltersType, dataManager: DataManager);
20
+ get data(): VisitProcessorDataType;
21
+ processVisit(visit: VisitType): void;
22
+ processMultipleDataTypes(): void;
23
+ processKcs(kcsData?: KCSType): void;
24
+ private processBrowser;
25
+ private processDevice;
26
+ private processOperatingSystem;
27
+ private processGeolocationData;
28
+ private processCustomData;
29
+ private processConversion;
30
+ private processPageView;
31
+ private processExperiments;
32
+ private processVisitsData;
33
+ }
34
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VisitProcessor=void 0;var _pageView=require("./pageView"),_types=require("./types"),_customData=require("./customData"),_conversion=require("./conversion"),_browser=require("./browser"),_device=require("./device"),_operatingSystem=require("./operatingSystem"),_geolocation=require("./geolocation"),_visitsData=require("./visitsData"),_kameleoonConversionScore=require("./kameleoonConversionScore");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||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){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)}class VisitProcessor{constructor(a,b){_defineProperty(this,"visitsData",new _visitsData.VisitsData([])),_defineProperty(this,"visitorData",[]),_defineProperty(this,"storageVisitorData",[]),_defineProperty(this,"experimentData",{}),_defineProperty(this,"filters",{}),_defineProperty(this,"dataManager",void 0),_defineProperty(this,"singleDataTypes",{[_types.KameleoonData.Device]:null,[_types.KameleoonData.Browser]:null,[_types.KameleoonData.GeolocationData]:null,[_types.KameleoonData.OperatingSystem]:null,[_types.KameleoonData.KameleoonConversionScore]:null}),_defineProperty(this,"multipleDataTypes",{[_types.KameleoonData.CustomData]:new Map,[_types.KameleoonData.PageView]:new Map,[_types.KameleoonData.Conversion]:new Map}),this.filters=a,this.dataManager=b}get data(){return{visitorData:this.visitorData,storageVisitorData:this.storageVisitorData,visitsData:this.visitsData,experimentData:this.experimentData}}processVisit(a){this.processBrowser(a),this.processDevice(a),this.processOperatingSystem(a),this.processGeolocationData(a),this.processCustomData(a),this.processConversion(a),this.processPageView(a),this.processExperiments(a),this.processVisitsData(a)}processMultipleDataTypes(){for(const[a,b]of Object.entries(this.multipleDataTypes))if(b.size)switch(a){case _types.KameleoonData.PageView:{this.visitorData.push(...b.values()),this.storageVisitorData.push(...b.values());break}case _types.KameleoonData.Conversion:{this.storageVisitorData.push(...b.values());break}case _types.KameleoonData.CustomData:{b.forEach(a=>{this.visitorData.push(a),this.dataManager.storedCustomDataIndexes.has(a.data.index)||this.storageVisitorData.push(a)});break}}}processKcs(a){if(this.filters.kcs&&a){const b=new _kameleoonConversionScore.KameleoonConversionScore(a);this.storageVisitorData.push(b)}}processBrowser(a){if(this.filters.browser&&!this.singleDataTypes[_types.KameleoonData.Browser]){const b=_browser.Browser._fromVisit(a);b&&(!this.dataManager.storedDataTypes.has(_types.KameleoonData.Browser)&&this.storageVisitorData.push(b),this.visitorData.push(b),this.singleDataTypes[_types.KameleoonData.Browser]=b)}}processDevice(a){if(this.filters.device&&!this.singleDataTypes[_types.KameleoonData.Device]){const b=_device.Device._fromVisit(a);b&&(!this.dataManager.storedDataTypes.has(_types.KameleoonData.Device)&&this.storageVisitorData.push(b),this.visitorData.push(b),this.singleDataTypes[_types.KameleoonData.Device]=b)}}processOperatingSystem(a){if(this.filters.operatingSystem&&!this.singleDataTypes[_types.KameleoonData.OperatingSystem]){const b=_operatingSystem.OperatingSystem._fromVisit(a);b&&(!this.dataManager.storedDataTypes.has(_types.KameleoonData.OperatingSystem)&&this.storageVisitorData.push(b),this.visitorData.push(b),this.singleDataTypes[_types.KameleoonData.OperatingSystem]=b)}}processGeolocationData(a){if(this.filters.geolocation&&!this.singleDataTypes[_types.KameleoonData.GeolocationData]){const b=_geolocation.GeolocationData._fromVisit(a);b&&(!this.dataManager.storedDataTypes.has(_types.KameleoonData.GeolocationData)&&this.storageVisitorData.push(b),this.visitorData.push(b),this.singleDataTypes[_types.KameleoonData.GeolocationData]=b)}}processCustomData(a){this.filters.customData&&_customData.CustomData._updateFromVisit(a,this.multipleDataTypes[_types.KameleoonData.CustomData])}processConversion(a){if(this.filters.conversions){_conversion.Conversion._updateFromVisit(a,this.multipleDataTypes[_types.KameleoonData.Conversion]);const b=_conversion.Conversion._listFromVisit(a);b.length&&this.visitorData.push(...b)}}processPageView(a){this.filters.pageViews&&_pageView.PageView._updateFromVisit(a,this.multipleDataTypes[_types.KameleoonData.PageView])}processExperiments(a){if(this.filters.experiments&&a.experimentEvents)for(const b of a.experimentEvents){const{id:a,variationId:c}=b.data;this.experimentData[a]={variationId:c,isTargetedRule:!1,isSent:!1}}}processVisitsData(a){this.visitsData.timestamp=a.timeStarted}}exports.VisitProcessor=VisitProcessor;
2
+ //# sourceMappingURL=visitProcessor.js.map