@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.ConditionFactory=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../../kameleoonError"),_types=require("../types"),_browser=require("./browser"),_conversion=require("./conversion"),_customData=require("./customData"),_device=require("./device"),_exclusiveCampaign=require("./exclusiveCampaign"),_pageTitle=require("./pageTitle"),_pageUrl=require("./pageUrl"),_sdkLanguage=require("./sdkLanguage"),_visitorCode=require("./visitorCode"),_cookie=require("./cookie"),_operatingSystem=require("./operatingSystem"),_geolocation=require("./geolocation"),_segment=require("./segment"),_targetFeatureFlag=require("./targetFeatureFlag"),_previousPage=require("./previousPage"),_visitedPages=require("./visitedPages"),_firstVisit=require("./firstVisit"),_lastVisit=require("./lastVisit"),_sameDayVisits=require("./sameDayVisits"),_visits=require("./visits"),_newVisitor=require("./newVisitor"),_applicationVersion=require("./applicationVersion");class ConditionFactory{static createCondition(a){const{targetingType:b}=a;return b===_types.TargetingType.CUSTOM_DATUM?(0,_tsRes.Ok)(new _customData.CustomData(a)):b===_types.TargetingType.EXCLUSIVE_EXPERIMENT||b===_types.TargetingType.EXCLUSIVE_FEATURE_FLAG?(0,_tsRes.Ok)(new _exclusiveCampaign.ExclusiveCampaign):b===_types.TargetingType.TARGET_FEATURE_FLAG?(0,_tsRes.Ok)(new _targetFeatureFlag.TargetFeatureFlag(a)):b===_types.TargetingType.DEVICE_TYPE?(0,_tsRes.Ok)(new _device.Device(a)):b===_types.TargetingType.BROWSER?(0,_tsRes.Ok)(new _browser.Browser(a)):b===_types.TargetingType.PAGE_URL?(0,_tsRes.Ok)(new _pageUrl.PageUrl(a)):b===_types.TargetingType.PAGE_TITLE?(0,_tsRes.Ok)(new _pageTitle.PageTitle(a)):b===_types.TargetingType.CONVERSIONS?(0,_tsRes.Ok)(new _conversion.Conversion(a)):b===_types.TargetingType.VISITOR_CODE?(0,_tsRes.Ok)(new _visitorCode.VisitorCode(a)):b===_types.TargetingType.SDK_LANGUAGE?(0,_tsRes.Ok)(new _sdkLanguage.SdkLanguage(a)):b===_types.TargetingType.COOKIE?(0,_tsRes.Ok)(new _cookie.Cookie(a)):b===_types.TargetingType.OPERATING_SYSTEM?(0,_tsRes.Ok)(new _operatingSystem.OperatingSystem(a)):b===_types.TargetingType.GEOLOCATION?(0,_tsRes.Ok)(new _geolocation.GeolocationCondition(a)):b===_types.TargetingType.SEGMENT?(0,_tsRes.Ok)(new _segment.Segment(a)):b===_types.TargetingType.APPLICATION_VERSION?(0,_tsRes.Ok)(new _applicationVersion.ApplicationVersion(a)):b===_types.TargetingType.PREVIOUS_PAGE?(0,_tsRes.Ok)(new _previousPage.PreviousPage(a)):b===_types.TargetingType.NUMBER_OF_VISITED_PAGES?(0,_tsRes.Ok)(new _visitedPages.VisitedPages(a)):b===_types.TargetingType.LAST_VISIT?(0,_tsRes.Ok)(new _lastVisit.LastVisit(a)):b===_types.TargetingType.FIRST_VISIT?(0,_tsRes.Ok)(new _firstVisit.FirstVisit(a)):b===_types.TargetingType.SAME_DAY_VISITS?(0,_tsRes.Ok)(new _sameDayVisits.SameDayVisits(a)):b===_types.TargetingType.VISITS?(0,_tsRes.Ok)(new _visits.Visits(a)):b===_types.TargetingType.NEW_VISITORS?(0,_tsRes.Ok)(new _newVisitor.NewVisitor(a)):(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.TargetingCondition,b))}}exports.ConditionFactory=ConditionFactory;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConditionFactory=void 0;var _tsRes=require("ts-res"),_kameleoonError=require("../../kameleoonError"),_types=require("../types"),_browser=require("./browser"),_conversion=require("./conversion"),_customData=require("./customData"),_device=require("./device"),_exclusiveCampaign=require("./exclusiveCampaign"),_pageTitle=require("./pageTitle"),_pageUrl=require("./pageUrl"),_sdkLanguage=require("./sdkLanguage"),_visitorCode=require("./visitorCode"),_cookie=require("./cookie"),_operatingSystem=require("./operatingSystem"),_geolocation=require("./geolocation"),_segment=require("./segment"),_targetFeatureFlag=require("./targetFeatureFlag"),_previousPage=require("./previousPage"),_visitedPages=require("./visitedPages"),_firstVisit=require("./firstVisit"),_lastVisit=require("./lastVisit"),_sameDayVisits=require("./sameDayVisits"),_visits=require("./visits"),_newVisitor=require("./newVisitor"),_applicationVersion=require("./applicationVersion"),_conversionLikelihood=require("./conversionLikelihood");class ConditionFactory{static createCondition(a){const{targetingType:b}=a;return b===_types.TargetingType.CUSTOM_DATUM?(0,_tsRes.Ok)(new _customData.CustomData(a)):b===_types.TargetingType.EXCLUSIVE_EXPERIMENT||b===_types.TargetingType.EXCLUSIVE_FEATURE_FLAG?(0,_tsRes.Ok)(new _exclusiveCampaign.ExclusiveCampaign):b===_types.TargetingType.TARGET_FEATURE_FLAG?(0,_tsRes.Ok)(new _targetFeatureFlag.TargetFeatureFlag(a)):b===_types.TargetingType.DEVICE_TYPE?(0,_tsRes.Ok)(new _device.Device(a)):b===_types.TargetingType.BROWSER?(0,_tsRes.Ok)(new _browser.Browser(a)):b===_types.TargetingType.PAGE_URL?(0,_tsRes.Ok)(new _pageUrl.PageUrl(a)):b===_types.TargetingType.PAGE_TITLE?(0,_tsRes.Ok)(new _pageTitle.PageTitle(a)):b===_types.TargetingType.CONVERSIONS?(0,_tsRes.Ok)(new _conversion.Conversion(a)):b===_types.TargetingType.VISITOR_CODE?(0,_tsRes.Ok)(new _visitorCode.VisitorCode(a)):b===_types.TargetingType.SDK_LANGUAGE?(0,_tsRes.Ok)(new _sdkLanguage.SdkLanguage(a)):b===_types.TargetingType.COOKIE?(0,_tsRes.Ok)(new _cookie.Cookie(a)):b===_types.TargetingType.OPERATING_SYSTEM?(0,_tsRes.Ok)(new _operatingSystem.OperatingSystem(a)):b===_types.TargetingType.GEOLOCATION?(0,_tsRes.Ok)(new _geolocation.GeolocationCondition(a)):b===_types.TargetingType.SEGMENT?(0,_tsRes.Ok)(new _segment.Segment(a)):b===_types.TargetingType.APPLICATION_VERSION?(0,_tsRes.Ok)(new _applicationVersion.ApplicationVersion(a)):b===_types.TargetingType.PREVIOUS_PAGE?(0,_tsRes.Ok)(new _previousPage.PreviousPage(a)):b===_types.TargetingType.NUMBER_OF_VISITED_PAGES?(0,_tsRes.Ok)(new _visitedPages.VisitedPages(a)):b===_types.TargetingType.LAST_VISIT?(0,_tsRes.Ok)(new _lastVisit.LastVisit(a)):b===_types.TargetingType.FIRST_VISIT?(0,_tsRes.Ok)(new _firstVisit.FirstVisit(a)):b===_types.TargetingType.SAME_DAY_VISITS?(0,_tsRes.Ok)(new _sameDayVisits.SameDayVisits(a)):b===_types.TargetingType.VISITS?(0,_tsRes.Ok)(new _visits.Visits(a)):b===_types.TargetingType.NEW_VISITORS?(0,_tsRes.Ok)(new _newVisitor.NewVisitor(a)):b===_types.TargetingType.HEAT_SLICE?(0,_tsRes.Ok)(new _conversionLikelihood.ConversionLikelihood(a)):(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.TargetingCondition,b))}}exports.ConditionFactory=ConditionFactory;
2
2
  //# sourceMappingURL=conditionFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditionFactory.js","names":["ConditionFactory","createCondition","data","targetingType","TargetingType","CUSTOM_DATUM","Ok","CustomData","EXCLUSIVE_EXPERIMENT","EXCLUSIVE_FEATURE_FLAG","ExclusiveCampaign","TARGET_FEATURE_FLAG","TargetFeatureFlag","DEVICE_TYPE","Device","BROWSER","Browser","PAGE_URL","PageUrl","PAGE_TITLE","PageTitle","CONVERSIONS","Conversion","VISITOR_CODE","VisitorCode","SDK_LANGUAGE","SdkLanguage","COOKIE","Cookie","OPERATING_SYSTEM","OperatingSystem","GEOLOCATION","GeolocationCondition","SEGMENT","Segment","APPLICATION_VERSION","ApplicationVersion","PREVIOUS_PAGE","PreviousPage","NUMBER_OF_VISITED_PAGES","VisitedPages","LAST_VISIT","LastVisit","FIRST_VISIT","FirstVisit","SAME_DAY_VISITS","SameDayVisits","VISITS","Visits","NEW_VISITORS","NewVisitor","Err","KameleoonError","KameleoonException","TargetingCondition","exports"],"sources":["../../../src/targeting/conditions/conditionFactory.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { KameleoonError, KameleoonException } from 'src/kameleoonError';\nimport { TargetingType } from 'src/targeting/types';\nimport { Browser } from './browser';\nimport { Conversion } from './conversion';\nimport { CustomData } from './customData';\nimport { Device } from './device';\nimport { ExclusiveCampaign } from './exclusiveCampaign';\nimport { PageTitle } from './pageTitle';\nimport { PageUrl } from './pageUrl';\nimport { SdkLanguage } from './sdkLanguage';\nimport { ConditionDataType, ConditionType } from './types';\nimport { VisitorCode } from './visitorCode';\nimport { Cookie } from './cookie';\nimport { OperatingSystem } from './operatingSystem';\nimport { GeolocationCondition } from './geolocation';\nimport { Segment } from './segment';\nimport { TargetFeatureFlag } from './targetFeatureFlag';\nimport { PreviousPage } from './previousPage';\nimport { VisitedPages } from './visitedPages';\nimport { FirstVisit } from './firstVisit';\nimport { LastVisit } from './lastVisit';\nimport { SameDayVisits } from './sameDayVisits';\nimport { Visits } from './visits';\nimport { NewVisitor } from './newVisitor';\nimport { ApplicationVersion } from './applicationVersion';\n\nexport class ConditionFactory {\n static createCondition(\n data: ConditionDataType,\n ): Result<ConditionType, KameleoonError> {\n const { targetingType } = data;\n\n switch (targetingType) {\n case TargetingType.CUSTOM_DATUM:\n return Ok(new CustomData(data));\n case TargetingType.EXCLUSIVE_EXPERIMENT:\n case TargetingType.EXCLUSIVE_FEATURE_FLAG:\n return Ok(new ExclusiveCampaign());\n case TargetingType.TARGET_FEATURE_FLAG:\n return Ok(new TargetFeatureFlag(data));\n case TargetingType.DEVICE_TYPE:\n return Ok(new Device(data));\n case TargetingType.BROWSER:\n return Ok(new Browser(data));\n case TargetingType.PAGE_URL:\n return Ok(new PageUrl(data));\n case TargetingType.PAGE_TITLE:\n return Ok(new PageTitle(data));\n case TargetingType.CONVERSIONS:\n return Ok(new Conversion(data));\n case TargetingType.VISITOR_CODE:\n return Ok(new VisitorCode(data));\n case TargetingType.SDK_LANGUAGE:\n return Ok(new SdkLanguage(data));\n case TargetingType.COOKIE:\n return Ok(new Cookie(data));\n case TargetingType.OPERATING_SYSTEM:\n return Ok(new OperatingSystem(data));\n case TargetingType.GEOLOCATION:\n return Ok(new GeolocationCondition(data));\n case TargetingType.SEGMENT:\n return Ok(new Segment(data));\n case TargetingType.APPLICATION_VERSION:\n return Ok(new ApplicationVersion(data));\n case TargetingType.PREVIOUS_PAGE:\n return Ok(new PreviousPage(data));\n case TargetingType.NUMBER_OF_VISITED_PAGES:\n return Ok(new VisitedPages(data));\n case TargetingType.LAST_VISIT:\n return Ok(new LastVisit(data));\n case TargetingType.FIRST_VISIT:\n return Ok(new FirstVisit(data));\n case TargetingType.SAME_DAY_VISITS:\n return Ok(new SameDayVisits(data));\n case TargetingType.VISITS:\n return Ok(new Visits(data));\n case TargetingType.NEW_VISITORS:\n return Ok(new NewVisitor(data));\n default:\n return Err(\n new KameleoonError(\n KameleoonException.TargetingCondition,\n targetingType,\n ),\n );\n }\n }\n}\n"],"mapp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AI,CAAAwC,4BAAa,CAAC5C,CAAI,CAAC,CAAC,CAzC9BC,CAAa,GA0CdC,oBAAa,CAAC2C,MAAM,CAChB,GAAAzC,SAAE,EAAC,GAAI,CAAA0C,cAAM,CAAC9C,CAAI,CAAC,CAAC,CA3CvBC,CAAa,GA4CdC,oBAAa,CAAC6C,YAAY,CACtB,GAAA3C,SAAE,EAAC,GAAI,CAAA4C,sBAAU,CAAChD,CAAI,CAAC,CAAC,CAExB,GAAAiD,UAAG,EACR,GAAI,CAAAC,8BAAc,CAChBC,kCAAkB,CAACC,kBAAkB,CACrCnD,CACF,CACF,CAEN,CACF,CAACoD,OAAA,CAAAvD,gBAAA,CAAAA,gBAAA"}
1
+ {"version":3,"file":"conditionFactory.js","names":["ConditionFactory","createCondition","data","targetingType","TargetingType","CUSTOM_DATUM","Ok","CustomData","EXCLUSIVE_EXPERIMENT","EXCLUSIVE_FEATURE_FLAG","ExclusiveCampaign","TARGET_FEATURE_FLAG","TargetFeatureFlag","DEVICE_TYPE","Device","BROWSER","Browser","PAGE_URL","PageUrl","PAGE_TITLE","PageTitle","CONVERSIONS","Conversion","VISITOR_CODE","VisitorCode","SDK_LANGUAGE","SdkLanguage","COOKIE","Cookie","OPERATING_SYSTEM","OperatingSystem","GEOLOCATION","GeolocationCondition","SEGMENT","Segment","APPLICATION_VERSION","ApplicationVersion","PREVIOUS_PAGE","PreviousPage","NUMBER_OF_VISITED_PAGES","VisitedPages","LAST_VISIT","LastVisit","FIRST_VISIT","FirstVisit","SAME_DAY_VISITS","SameDayVisits","VISITS","Visits","NEW_VISITORS","NewVisitor","HEAT_SLICE","ConversionLikelihood","Err","KameleoonError","KameleoonException","TargetingCondition","exports"],"sources":["../../../src/targeting/conditions/conditionFactory.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { KameleoonError, KameleoonException } from 'src/kameleoonError';\nimport { TargetingType } from 'src/targeting/types';\nimport { Browser } from './browser';\nimport { Conversion } from './conversion';\nimport { CustomData } from './customData';\nimport { Device } from './device';\nimport { ExclusiveCampaign } from './exclusiveCampaign';\nimport { PageTitle } from './pageTitle';\nimport { PageUrl } from './pageUrl';\nimport { SdkLanguage } from './sdkLanguage';\nimport { ConditionDataType, ConditionType } from './types';\nimport { VisitorCode } from './visitorCode';\nimport { Cookie } from './cookie';\nimport { OperatingSystem } from './operatingSystem';\nimport { GeolocationCondition } from './geolocation';\nimport { Segment } from './segment';\nimport { TargetFeatureFlag } from './targetFeatureFlag';\nimport { PreviousPage } from './previousPage';\nimport { VisitedPages } from './visitedPages';\nimport { FirstVisit } from './firstVisit';\nimport { LastVisit } from './lastVisit';\nimport { SameDayVisits } from './sameDayVisits';\nimport { Visits } from './visits';\nimport { NewVisitor } from './newVisitor';\nimport { ApplicationVersion } from './applicationVersion';\nimport { ConversionLikelihood } from './conversionLikelihood';\n\nexport class ConditionFactory {\n static createCondition(\n data: ConditionDataType,\n ): Result<ConditionType, KameleoonError> {\n const { targetingType } = data;\n\n switch (targetingType) {\n case TargetingType.CUSTOM_DATUM:\n return Ok(new CustomData(data));\n case TargetingType.EXCLUSIVE_EXPERIMENT:\n case TargetingType.EXCLUSIVE_FEATURE_FLAG:\n return Ok(new ExclusiveCampaign());\n case TargetingType.TARGET_FEATURE_FLAG:\n return Ok(new TargetFeatureFlag(data));\n case TargetingType.DEVICE_TYPE:\n return Ok(new Device(data));\n case TargetingType.BROWSER:\n return Ok(new Browser(data));\n case TargetingType.PAGE_URL:\n return Ok(new PageUrl(data));\n case TargetingType.PAGE_TITLE:\n return Ok(new PageTitle(data));\n case TargetingType.CONVERSIONS:\n return Ok(new Conversion(data));\n case TargetingType.VISITOR_CODE:\n return Ok(new VisitorCode(data));\n case TargetingType.SDK_LANGUAGE:\n return Ok(new SdkLanguage(data));\n case TargetingType.COOKIE:\n return Ok(new Cookie(data));\n case TargetingType.OPERATING_SYSTEM:\n return Ok(new OperatingSystem(data));\n case TargetingType.GEOLOCATION:\n return Ok(new GeolocationCondition(data));\n case TargetingType.SEGMENT:\n return Ok(new Segment(data));\n case TargetingType.APPLICATION_VERSION:\n return Ok(new ApplicationVersion(data));\n case TargetingType.PREVIOUS_PAGE:\n return Ok(new PreviousPage(data));\n case TargetingType.NUMBER_OF_VISITED_PAGES:\n return Ok(new VisitedPages(data));\n case TargetingType.LAST_VISIT:\n return Ok(new LastVisit(data));\n case TargetingType.FIRST_VISIT:\n return Ok(new FirstVisit(data));\n case TargetingType.SAME_DAY_VISITS:\n return Ok(new SameDayVisits(data));\n case TargetingType.VISITS:\n return Ok(new Visits(data));\n case TargetingType.NEW_VISITORS:\n return Ok(new NewVisitor(data));\n case TargetingType.HEAT_SLICE:\n return Ok(new ConversionLikelihood(data));\n default:\n return Err(\n new KameleoonError(\n KameleoonException.TargetingCondition,\n targetingType,\n ),\n );\n }\n }\n}\n"],"mappings":"wjCA4BO,KAAM,CAAAA,gBAAiB,CAC5B,MAAO,CAAAC,eAAeA,CACpBC,CAAuB,CACgB,CACvC,KAAM,CAAEC,aAAa,CAAbA,CAAc,CAAC,CAAGD,CAAI,CAAC,MAEvB,CAAAC,CAAa,GACdC,oBAAa,CAACC,YAAY,CACtB,GAAAC,SAAE,EAAC,GAAI,CAAAC,sBAAU,CAACL,CAAI,CAAC,CAAC,CAF3BC,CAAa,GAGdC,oBAAa,CAACI,oBAAoB,EAHjCL,CAAa,GAIdC,oBAAa,CAACK,sBAAsB,CAChC,GAAAH,SAAE,EAAC,GAAI,CAAAI,oCAAmB,CAAC,CAL9BP,CAAa,GAMdC,oBAAa,CAACO,mBAAmB,CAC7B,GAAAL,SAAE,EAAC,GAAI,CAAAM,oCAAiB,CAACV,CAAI,CAAC,CAAC,CAPlCC,CAAa,GAQdC,oBAAa,CAACS,WAAW,CACrB,GAAAP,SAAE,EAAC,GAAI,CAAAQ,cAAM,CAACZ,CAAI,CAAC,CAAC,CATvBC,CAAa,GAUdC,oBAAa,CAACW,OAAO,CACjB,GAAAT,SAAE,EAAC,GAAI,CAAAU,gBAAO,C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,CAACiC,aAAa,CACvB,GAAA/B,SAAE,EAAC,GAAI,CAAAgC,0BAAY,CAACpC,CAAI,CAAC,CAAC,CAjC7BC,CAAa,GAkCdC,oBAAa,CAACmC,uBAAuB,CACjC,GAAAjC,SAAE,EAAC,GAAI,CAAAkC,0BAAY,CAACtC,CAAI,CAAC,CAAC,CAnC7BC,CAAa,GAoCdC,oBAAa,CAACqC,UAAU,CACpB,GAAAnC,SAAE,EAAC,GAAI,CAAAoC,oBAAS,CAACxC,CAAI,CAAC,CAAC,CArC1BC,CAAa,GAsCdC,oBAAa,CAACuC,WAAW,CACrB,GAAArC,SAAE,EAAC,GAAI,CAAAsC,sBAAU,CAAC1C,CAAI,CAAC,CAAC,CAvC3BC,CAAa,GAwCdC,oBAAa,CAACyC,eAAe,CACzB,GAAAvC,SAAE,EAAC,GAAI,CAAAwC,4BAAa,CAAC5C,CAAI,CAAC,CAAC,CAzC9BC,CAAa,GA0CdC,oBAAa,CAAC2C,MAAM,CAChB,GAAAzC,SAAE,EAAC,GAAI,CAAA0C,cAAM,CAAC9C,CAAI,CAAC,CAAC,CA3CvBC,CAAa,GA4CdC,oBAAa,CAAC6C,YAAY,CACtB,GAAA3C,SAAE,EAAC,GAAI,CAAA4C,sBAAU,CAAChD,CAAI,CAAC,CAAC,CA7C3BC,CAAa,GA8CdC,oBAAa,CAAC+C,UAAU,CACpB,GAAA7C,SAAE,EAAC,GAAI,CAAA8C,0CAAoB,CAAClD,CAAI,CAAC,CAAC,CAElC,GAAAmD,UAAG,EACR,GAAI,CAAAC,8BAAc,CAChBC,kCAAkB,CAACC,kBAAkB,CACrCrD,CACF,CACF,CAEN,CACF,CAACsD,OAAA,CAAAzD,gBAAA,CAAAA,gBAAA"}
@@ -0,0 +1,12 @@
1
+ import { Result } from 'ts-res';
2
+ import { KameleoonError } from '../../kameleoonError';
3
+ import { EvaluationDataType } from '../../targeting/types';
4
+ import { ConditionDataType, ICondition } from './types';
5
+ export declare class ConversionLikelihood implements ICondition {
6
+ private lowerBound?;
7
+ private upperBound?;
8
+ private keyMomentId?;
9
+ private goalId?;
10
+ constructor({ lowerBound, upperBound, keyMomentId, goalId, }: ConditionDataType);
11
+ evaluate({ targetingData, }: EvaluationDataType): Result<boolean, KameleoonError>;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConversionLikelihood=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData");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 ConversionLikelihood{constructor(a){let{lowerBound:b,upperBound:c,keyMomentId:d,goalId:e}=a;_defineProperty(this,"lowerBound",void 0),_defineProperty(this,"upperBound",void 0),_defineProperty(this,"keyMomentId",void 0),_defineProperty(this,"goalId",void 0),this.lowerBound=b,this.upperBound=c,this.keyMomentId=d,this.goalId=e}evaluate(a){var b;let{targetingData:c}=a;const d=null===c||void 0===c?void 0:c[_kameleoonData.KameleoonData.KameleoonConversionScore];if("number"!=typeof this.keyMomentId||"number"!=typeof this.goalId||"number"!=typeof this.lowerBound||"number"!=typeof this.upperBound||!d)return(0,_tsRes.Ok)(!1);const e=null===(b=d.kcs[this.keyMomentId.toString()])||void 0===b?void 0:b[this.goalId.toString()];return"number"==typeof e?(0,_tsRes.Ok)(e>=this.lowerBound&&e<=this.upperBound):(0,_tsRes.Ok)(!1)}}exports.ConversionLikelihood=ConversionLikelihood;
2
+ //# sourceMappingURL=conversionLikelihood.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversionLikelihood.js","names":["ConversionLikelihood","constructor","a","lowerBound","upperBound","keyMomentId","goalId","_defineProperty","evaluate","b","targetingData","kcsData","KameleoonData","KameleoonConversionScore","Ok","score","kcs","toString","exports"],"sources":["../../../src/targeting/conditions/conversionLikelihood.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class ConversionLikelihood implements ICondition {\n private lowerBound?: number;\n private upperBound?: number;\n private keyMomentId?: number;\n private goalId?: number | null;\n\n constructor({\n lowerBound,\n upperBound,\n keyMomentId,\n goalId,\n }: ConditionDataType) {\n this.lowerBound = lowerBound;\n this.upperBound = upperBound;\n this.keyMomentId = keyMomentId;\n this.goalId = goalId;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const kcsData = targetingData?.[KameleoonData.KameleoonConversionScore];\n\n if (\n typeof this.keyMomentId !== 'number' ||\n typeof this.goalId !== 'number' ||\n typeof this.lowerBound !== 'number' ||\n typeof this.upperBound !== 'number' ||\n !kcsData\n ) {\n return Ok(false);\n }\n\n const score: number | undefined =\n kcsData.kcs[this.keyMomentId.toString()]?.[this.goalId.toString()];\n\n if (typeof score !== 'number') {\n return Ok(false);\n }\n\n return Ok(score >= this.lowerBound && score <= this.upperBound);\n }\n}\n"],"mappings":"srBAMO,KAAM,CAAAA,oBAA2C,CAMtDC,WAAWA,CAAAC,CAAA,CAKW,IALV,CACVC,UAAU,CAAVA,CAAU,CACVC,UAAU,CAAVA,CAAU,CACVC,WAAW,CAAXA,CAAW,CACXC,MAAM,CAANA,CACiB,CAAC,CAAAJ,CAAA,CAAAK,eAAA,2BAAAA,eAAA,2BAAAA,eAAA,4BAAAA,eAAA,uBAClB,IAAI,CAACJ,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,UAAU,CAAGA,CAAU,CAC5B,IAAI,CAACC,WAAW,CAAGA,CAAW,CAC9B,IAAI,CAACC,MAAM,CAAGA,CAChB,CAEOE,QAAQA,CAAAN,CAAA,CAEyC,KAAAO,CAAA,IAFxC,CACdC,aAAa,CAAbA,CACkB,CAAC,CAAAR,CAAA,CACnB,KAAM,CAAAS,CAAO,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,wBAAwB,CAAC,CAEvE,GAC8B,QAAQ,EAApC,MAAO,KAAI,CAACR,WAAwB,EACb,QAAQ,EAA/B,MAAO,KAAI,CAACC,MAAmB,EACJ,QAAQ,EAAnC,MAAO,KAAI,CAACH,UAAuB,EACR,QAAQ,EAAnC,MAAO,KAAI,CAACC,UAAuB,EACnC,CAACO,CAAO,CAER,MAAO,GAAAG,SAAE,IAAM,CAAC,CAGlB,KAAM,CAAAC,CAAyB,SAAAN,CAAA,CAC7BE,CAAO,CAACK,GAAG,CAAC,IAAI,CAACX,WAAW,CAACY,QAAQ,CAAC,CAAC,CAAC,YAAAR,CAAA,QAAxCA,CAAA,CAA2C,IAAI,CAACH,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC,CAAC,MAEhD,QAAQ,EAAzB,MAAO,CAAAF,CAAkB,CAItB,GAAAD,SAAE,EAACC,CAAK,EAAI,IAAI,CAACZ,UAAU,EAAIY,CAAK,EAAI,IAAI,CAACX,UAAU,CAAC,CAHtD,GAAAU,SAAE,IAAM,CAInB,CACF,CAACI,OAAA,CAAAlB,oBAAA,CAAAA,oBAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirstVisit=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_utilities=require("../../utilities"),_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 FirstVisit{constructor(a){let{matchType:b,count:c,unitOfTime:d}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"timeUnit",void 0),this.matchType=b,this.conditionValue=c,this.timeUnit=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);const{currentVisit:d,previousVisits:e}=c,f=e.length?e[0]:d;return"number"==typeof f?(0,_tsRes.Ok)(this.checkCondition(f)):(0,_tsRes.Ok)(!1)}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue||!this.timeUnit)return!1;const b=Date.now()-a,c=_utilities.Utilities.convertTimeUnit(b,this.timeUnit);switch(this.matchType){case _types.MatchType.GREATER:return c>this.conditionValue;case _types.MatchType.LOWER:return c<this.conditionValue;default:return!1}}}exports.FirstVisit=FirstVisit;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirstVisit=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_utilities=require("../../utilities"),_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 FirstVisit{constructor(a){let{matchType:b,count:c,unitOfTime:d}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"timeUnit",void 0),this.matchType=b,this.conditionValue=c,this.timeUnit=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!(null!==c&&void 0!==c&&c.visits.length))return(0,_tsRes.Ok)(!1);const d=c.visits[0];return(0,_tsRes.Ok)(this.checkCondition(d))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue||!this.timeUnit)return!1;const b=Date.now()-a,c=_utilities.Utilities.convertTimeUnit(b,this.timeUnit);switch(this.matchType){case _types.MatchType.GREATER:return c>this.conditionValue;case _types.MatchType.LOWER:return c<this.conditionValue;default:return!1}}}exports.FirstVisit=FirstVisit;
2
2
  //# sourceMappingURL=firstVisit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firstVisit.js","names":["FirstVisit","constructor","a","matchType","count","unitOfTime","_defineProperty","conditionValue","timeUnit","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","currentVisit","previousVisits","firstVisitTimestamp","length","checkCondition","elapsedTimeMilliseconds","Date","now","elapsedTimeUnit","Utilities","convertTimeUnit","MatchType","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/firstVisit.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities, TimeUnit } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class FirstVisit implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n private timeUnit?: TimeUnit | null;\n\n constructor({ matchType, count, unitOfTime }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = count;\n this.timeUnit = unitOfTime;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n const { currentVisit, previousVisits } = visitsData;\n\n const firstVisitTimestamp = previousVisits.length\n ? previousVisits[0]\n : currentVisit;\n\n if (typeof firstVisitTimestamp !== 'number') {\n return Ok(false);\n }\n\n return Ok(this.checkCondition(firstVisitTimestamp));\n }\n\n private checkCondition(firstVisitTimestamp: number): boolean {\n if (\n !this.matchType ||\n typeof this.conditionValue !== 'number' ||\n !this.timeUnit\n ) {\n return false;\n }\n\n const elapsedTimeMilliseconds = Date.now() - firstVisitTimestamp;\n const elapsedTimeUnit = Utilities.convertTimeUnit(\n elapsedTimeMilliseconds,\n this.timeUnit,\n );\n\n switch (this.matchType) {\n case MatchType.GREATER:\n return elapsedTimeUnit > this.conditionValue;\n case MatchType.LOWER:\n return elapsedTimeUnit < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"6uBAOO,KAAM,CAAAA,UAAiC,CAK5CC,WAAWA,CAAAC,CAAA,CAAsD,IAArD,CAAEC,SAAS,CAATA,CAAS,CAAEC,KAAK,CAALA,CAAK,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAH,CAAA,CAAAI,eAAA,0BAAAA,eAAA,+BAAAA,eAAA,yBAC7D,IAAI,CAACH,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACI,cAAc,CAAGH,CAAK,CAC3B,IAAI,CAACI,QAAQ,CAAGH,CAClB,CAEOI,QAAQA,CAAAP,CAAA,CAEyC,IAFxC,CACdQ,aAAa,CAAbA,CACkB,CAAC,CAAAR,CAAA,CACnB,KAAM,CAAAS,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,CAACF,CAAU,CACb,MAAO,GAAAG,SAAE,IAAM,CAAC,CACjB,KAEK,CAAEC,YAAY,CAAZA,CAAY,CAAEC,cAAc,CAAdA,CAAe,CAAC,CAAGL,CAAU,CAE7CM,CAAmB,CAAGD,CAAc,CAACE,MAAM,CAC7CF,CAAc,CAAC,CAAC,CAAC,CACjBD,CAAY,OAEmB,QAAQ,EAAvC,MAAO,CAAAE,CAAgC,CAIpC,GAAAH,SAAE,EAAC,IAAI,CAACK,cAAc,CAACF,CAAmB,CAAC,CAAC,CAH1C,GAAAH,SAAE,IAAM,CAInB,CAEQK,cAAcA,CAACF,CAA2B,CAAW,CAC3D,GACE,CAAC,IAAI,CAACd,SAAS,EACgB,QAAQ,EAAvC,MAAO,KAAI,CAACI,cAA2B,EACvC,CAAC,IAAI,CAACC,QAAQ,CAEd,SACD,KAEK,CAAAY,CAAuB,CAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAGL,CAAmB,CAC1DM,CAAe,CAAGC,oBAAS,CAACC,eAAe,CAC/CL,CAAuB,CACvB,IAAI,CAACZ,QACP,CAAC,CAED,OAAQ,IAAI,CAACL,SAAS,EACpB,IAAK,CAAAuB,gBAAS,CAACC,OAAO,CACpB,MAAO,CAAAJ,CAAe,CAAG,IAAI,CAAChB,cAAc,CAC9C,IAAK,CAAAmB,gBAAS,CAACE,KAAK,CAClB,MAAO,CAAAL,CAAe,CAAG,IAAI,CAAChB,cAAc,CAC9C,QACE,QACJ,CACF,CACF,CAACsB,OAAA,CAAA7B,UAAA,CAAAA,UAAA"}
1
+ {"version":3,"file":"firstVisit.js","names":["FirstVisit","constructor","a","matchType","count","unitOfTime","_defineProperty","conditionValue","timeUnit","evaluate","targetingData","visitsData","KameleoonData","VisitsData","visits","length","Ok","firstVisitTimestamp","checkCondition","elapsedTimeMilliseconds","Date","now","elapsedTimeUnit","Utilities","convertTimeUnit","MatchType","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/firstVisit.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities, TimeUnit } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class FirstVisit implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n private timeUnit?: TimeUnit | null;\n\n constructor({ matchType, count, unitOfTime }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = count;\n this.timeUnit = unitOfTime;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData?.visits.length) {\n return Ok(false);\n }\n\n const firstVisitTimestamp = visitsData.visits[0];\n\n return Ok(this.checkCondition(firstVisitTimestamp));\n }\n\n private checkCondition(firstVisitTimestamp: number): boolean {\n if (\n !this.matchType ||\n typeof this.conditionValue !== 'number' ||\n !this.timeUnit\n ) {\n return false;\n }\n\n const elapsedTimeMilliseconds = Date.now() - firstVisitTimestamp;\n const elapsedTimeUnit = Utilities.convertTimeUnit(\n elapsedTimeMilliseconds,\n this.timeUnit,\n );\n\n switch (this.matchType) {\n case MatchType.GREATER:\n return elapsedTimeUnit > this.conditionValue;\n case MatchType.LOWER:\n return elapsedTimeUnit < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"6uBAOO,KAAM,CAAAA,UAAiC,CAK5CC,WAAWA,CAAAC,CAAA,CAAsD,IAArD,CAAEC,SAAS,CAATA,CAAS,CAAEC,KAAK,CAALA,CAAK,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAH,CAAA,CAAAI,eAAA,0BAAAA,eAAA,+BAAAA,eAAA,yBAC7D,IAAI,CAACH,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACI,cAAc,CAAGH,CAAK,CAC3B,IAAI,CAACI,QAAQ,CAAGH,CAClB,CAEOI,QAAQA,CAAAP,CAAA,CAEyC,IAFxC,CACdQ,aAAa,CAAbA,CACkB,CAAC,CAAAR,CAAA,CACnB,KAAM,CAAAS,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,SAACF,CAAU,WAAVA,CAAU,EAAVA,CAAU,CAAEG,MAAM,CAACC,MAAM,EAC5B,MAAO,GAAAC,SAAE,IAAM,CAAC,CAGlB,KAAM,CAAAC,CAAmB,CAAGN,CAAU,CAACG,MAAM,CAAC,CAAC,CAAC,CAEhD,MAAO,GAAAE,SAAE,EAAC,IAAI,CAACE,cAAc,CAACD,CAAmB,CAAC,CACpD,CAEQC,cAAcA,CAACD,CAA2B,CAAW,CAC3D,GACE,CAAC,IAAI,CAACd,SAAS,EACgB,QAAQ,EAAvC,MAAO,KAAI,CAACI,cAA2B,EACvC,CAAC,IAAI,CAACC,QAAQ,CAEd,SACD,KAEK,CAAAW,CAAuB,CAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,CAAGJ,CAAmB,CAC1DK,CAAe,CAAGC,oBAAS,CAACC,eAAe,CAC/CL,CAAuB,CACvB,IAAI,CAACX,QACP,CAAC,CAED,OAAQ,IAAI,CAACL,SAAS,EACpB,IAAK,CAAAsB,gBAAS,CAACC,OAAO,CACpB,MAAO,CAAAJ,CAAe,CAAG,IAAI,CAACf,cAAc,CAC9C,IAAK,CAAAkB,gBAAS,CAACE,KAAK,CAClB,MAAO,CAAAL,CAAe,CAAG,IAAI,CAACf,cAAc,CAC9C,QACE,QACJ,CACF,CACF,CAACqB,OAAA,CAAA5B,UAAA,CAAAA,UAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeolocationCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData");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 GeolocationCondition{constructor(a){let{country:b,region:c,city:d}=a;_defineProperty(this,"country",void 0),_defineProperty(this,"region",void 0),_defineProperty(this,"city",void 0),this.country=b,this.region=c,this.city=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.GeolocationData];if(c){const{country:a,region:b,city:d}=c,[e,f,g]=[this.country,this.region,this.city];if(!e||!a)return(0,_tsRes.Ok)(!1);return(0,_tsRes.Ok)(a===e&&(!f||b===f)&&(!g||d===g))}return(0,_tsRes.Ok)(!1)}}exports.GeolocationCondition=GeolocationCondition;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GeolocationCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData");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 GeolocationCondition{constructor(a){let{country:b,region:c,city:d}=a;_defineProperty(this,"country",void 0),_defineProperty(this,"region",void 0),_defineProperty(this,"city",void 0),this.country=b,this.region=c,this.city=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.GeolocationData];if(c){const{country:a,region:b,city:d}=c,[e,f,g]=[this.country,this.region,this.city];if(!e||!a)return(0,_tsRes.Ok)(!1);const h=a.toLowerCase()===e.toLowerCase()&&(!f||(null===b||void 0===b?void 0:b.toLowerCase())===f.toLowerCase())&&(!g||(null===d||void 0===d?void 0:d.toLowerCase())===g.toLowerCase());return(0,_tsRes.Ok)(h)}return(0,_tsRes.Ok)(!1)}}exports.GeolocationCondition=GeolocationCondition;
2
2
  //# sourceMappingURL=geolocation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"geolocation.js","names":["GeolocationCondition","constructor","a","country","region","city","_defineProperty","evaluate","targetingData","geolocationData","KameleoonData","GeolocationData","dataCountry","dataRegion","dataCity","conditionCountry","conditionRegion","conditionCity","Ok","exports"],"sources":["../../../src/targeting/conditions/geolocation.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\n// --- Note ---\n// `GeolocationCondition` uses `Condition` in the naming to avoid confusion with\n// native `Geolocation` API\nexport class GeolocationCondition implements ICondition {\n private country?: string | null;\n private region?: string | null;\n private city?: string | null;\n\n constructor({ country, region, city }: ConditionDataType) {\n this.country = country;\n this.region = region;\n this.city = city;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const geolocationData = targetingData?.[KameleoonData.GeolocationData];\n\n if (geolocationData) {\n const {\n country: dataCountry,\n region: dataRegion,\n city: dataCity,\n } = geolocationData;\n const [conditionCountry, conditionRegion, conditionCity] = [\n this.country,\n this.region,\n this.city,\n ];\n\n if (!conditionCountry || !dataCountry) {\n return Ok(false);\n }\n\n const result =\n dataCountry === conditionCountry &&\n (!conditionRegion || dataRegion === conditionRegion) &&\n (!conditionCity || dataCity === conditionCity);\n\n return Ok(result);\n }\n\n return Ok(false);\n }\n}\n"],"mappings":"srBASO,KAAM,CAAAA,oBAA2C,CAKtDC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAM,CAAEC,IAAI,CAAJA,CAAwB,CAAC,CAAAH,CAAA,CAAAI,eAAA,wBAAAA,eAAA,uBAAAA,eAAA,qBACtD,IAAI,CAACH,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,MAAM,CAAGA,CAAM,CACpB,IAAI,CAACC,IAAI,CAAGA,CACd,CAEOE,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAe,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,eAAe,CAAC,CAEtE,GAAIF,CAAe,CAAE,MACb,CACJN,OAAO,CAAES,CAAW,CACpBR,MAAM,CAAES,CAAU,CAClBR,IAAI,CAAES,CACR,CAAC,CAAGL,CAAe,CACb,CAACM,CAAgB,CAAEC,CAAe,CAAEC,CAAa,CAAC,CAAG,CACzD,IAAI,CAACd,OAAO,CACZ,IAAI,CAACC,MAAM,CACX,IAAI,CAACC,IAAI,CACV,CAED,GAAI,CAACU,CAAgB,EAAI,CAACH,CAAW,CACnC,MAAO,GAAAM,SAAE,IAAM,CAAC,CAQlB,MAAO,GAAAA,SAAE,EAJPN,CAAW,GAAKG,CAAgB,GAC/B,CAACC,CAAe,EAAIH,CAAU,GAAKG,CAAe,CAAC,GACnD,CAACC,CAAa,EAAIH,CAAQ,GAAKG,CAAa,CAE/B,CAClB,CAEA,MAAO,GAAAC,SAAE,IAAM,CACjB,CACF,CAACC,OAAA,CAAAnB,oBAAA,CAAAA,oBAAA"}
1
+ {"version":3,"file":"geolocation.js","names":["GeolocationCondition","constructor","a","country","region","city","_defineProperty","evaluate","targetingData","geolocationData","KameleoonData","GeolocationData","dataCountry","dataRegion","dataCity","conditionCountry","conditionRegion","conditionCity","Ok","result","toLowerCase","exports"],"sources":["../../../src/targeting/conditions/geolocation.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\n// --- Note ---\n// `GeolocationCondition` uses `Condition` in the naming to avoid confusion with\n// native `Geolocation` API\nexport class GeolocationCondition implements ICondition {\n private country?: string | null;\n private region?: string | null;\n private city?: string | null;\n\n constructor({ country, region, city }: ConditionDataType) {\n this.country = country;\n this.region = region;\n this.city = city;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const geolocationData = targetingData?.[KameleoonData.GeolocationData];\n\n if (geolocationData) {\n const {\n country: dataCountry,\n region: dataRegion,\n city: dataCity,\n } = geolocationData;\n const [conditionCountry, conditionRegion, conditionCity] = [\n this.country,\n this.region,\n this.city,\n ];\n\n if (!conditionCountry || !dataCountry) {\n return Ok(false);\n }\n\n const result =\n dataCountry.toLowerCase() === conditionCountry.toLowerCase() &&\n (!conditionRegion ||\n dataRegion?.toLowerCase() === conditionRegion.toLowerCase()) &&\n (!conditionCity ||\n dataCity?.toLowerCase() === conditionCity.toLowerCase());\n\n return Ok(result);\n }\n\n return Ok(false);\n }\n}\n"],"mappings":"srBASO,KAAM,CAAAA,oBAA2C,CAKtDC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,OAAO,CAAPA,CAAO,CAAEC,MAAM,CAANA,CAAM,CAAEC,IAAI,CAAJA,CAAwB,CAAC,CAAAH,CAAA,CAAAI,eAAA,wBAAAA,eAAA,uBAAAA,eAAA,qBACtD,IAAI,CAACH,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,MAAM,CAAGA,CAAM,CACpB,IAAI,CAACC,IAAI,CAAGA,CACd,CAEOE,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAe,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,eAAe,CAAC,CAEtE,GAAIF,CAAe,CAAE,MACb,CACJN,OAAO,CAAES,CAAW,CACpBR,MAAM,CAAES,CAAU,CAClBR,IAAI,CAAES,CACR,CAAC,CAAGL,CAAe,CACb,CAACM,CAAgB,CAAEC,CAAe,CAAEC,CAAa,CAAC,CAAG,CACzD,IAAI,CAACd,OAAO,CACZ,IAAI,CAACC,MAAM,CACX,IAAI,CAACC,IAAI,CACV,CAED,GAAI,CAACU,CAAgB,EAAI,CAACH,CAAW,CACnC,MAAO,GAAAM,SAAE,IAAM,CAAC,CAGlB,KAAM,CAAAC,CAAM,CACVP,CAAW,CAACQ,WAAW,CAAC,CAAC,GAAKL,CAAgB,CAACK,WAAW,CAAC,CAAC,GAC3D,CAACJ,CAAe,EACf,QAAAH,CAAU,WAAVA,CAAU,QAAVA,CAAU,CAAEO,WAAW,CAAC,CAAC,IAAKJ,CAAe,CAACI,WAAW,CAAC,CAAC,CAAC,GAC7D,CAACH,CAAa,EACb,QAAAH,CAAQ,WAARA,CAAQ,QAARA,CAAQ,CAAEM,WAAW,CAAC,CAAC,IAAKH,CAAa,CAACG,WAAW,CAAC,CAAC,CAAC,CAE5D,MAAO,GAAAF,SAAE,EAACC,CAAM,CAClB,CAEA,MAAO,GAAAD,SAAE,IAAM,CACjB,CACF,CAACG,OAAA,CAAArB,oBAAA,CAAAA,oBAAA"}
@@ -22,3 +22,4 @@ export { Visits } from './visits';
22
22
  export { SameDayVisits } from './sameDayVisits';
23
23
  export { NewVisitor } from './newVisitor';
24
24
  export { ApplicationVersion } from './applicationVersion';
25
+ export { ConversionLikelihood } from './conversionLikelihood';
@@ -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,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"ConditionDataType",{enumerable:!0,get:function(){return _types.ConditionDataType}}),Object.defineProperty(exports,"ConditionFactory",{enumerable:!0,get:function(){return _conditionFactory.ConditionFactory}}),Object.defineProperty(exports,"ConditionType",{enumerable:!0,get:function(){return _types.ConditionType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _device.Device}}),Object.defineProperty(exports,"ExclusiveCampaign",{enumerable:!0,get:function(){return _exclusiveCampaign.ExclusiveCampaign}}),Object.defineProperty(exports,"FirstVisit",{enumerable:!0,get:function(){return _firstVisit.FirstVisit}}),Object.defineProperty(exports,"GeolocationCondition",{enumerable:!0,get:function(){return _geolocation.GeolocationCondition}}),Object.defineProperty(exports,"LastVisit",{enumerable:!0,get:function(){return _lastVisit.LastVisit}}),Object.defineProperty(exports,"NewVisitor",{enumerable:!0,get:function(){return _newVisitor.NewVisitor}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _operatingSystem.OperatingSystem}}),Object.defineProperty(exports,"PageTitle",{enumerable:!0,get:function(){return _pageTitle.PageTitle}}),Object.defineProperty(exports,"PageUrl",{enumerable:!0,get:function(){return _pageUrl.PageUrl}}),Object.defineProperty(exports,"PreviousPage",{enumerable:!0,get:function(){return _previousPage.PreviousPage}}),Object.defineProperty(exports,"SameDayVisits",{enumerable:!0,get:function(){return _sameDayVisits.SameDayVisits}}),Object.defineProperty(exports,"SdkLanguage",{enumerable:!0,get:function(){return _sdkLanguage.SdkLanguage}}),Object.defineProperty(exports,"Segment",{enumerable:!0,get:function(){return _segment.Segment}}),Object.defineProperty(exports,"TargetFeatureFlag",{enumerable:!0,get:function(){return _targetFeatureFlag.TargetFeatureFlag}}),Object.defineProperty(exports,"VisitedPages",{enumerable:!0,get:function(){return _visitedPages.VisitedPages}}),Object.defineProperty(exports,"VisitorCode",{enumerable:!0,get:function(){return _visitorCode.VisitorCode}}),Object.defineProperty(exports,"Visits",{enumerable:!0,get:function(){return _visits.Visits}});var _device=require("./device"),_conditionFactory=require("./conditionFactory"),_types=require("./types"),_customData=require("./customData"),_exclusiveCampaign=require("./exclusiveCampaign"),_browser=require("./browser"),_pageUrl=require("./pageUrl"),_pageTitle=require("./pageTitle"),_conversion=require("./conversion"),_visitorCode=require("./visitorCode"),_sdkLanguage=require("./sdkLanguage"),_targetFeatureFlag=require("./targetFeatureFlag"),_cookie=require("./cookie"),_operatingSystem=require("./operatingSystem"),_geolocation=require("./geolocation"),_segment=require("./segment"),_previousPage=require("./previousPage"),_visitedPages=require("./visitedPages"),_firstVisit=require("./firstVisit"),_lastVisit=require("./lastVisit"),_visits=require("./visits"),_sameDayVisits=require("./sameDayVisits"),_newVisitor=require("./newVisitor"),_applicationVersion=require("./applicationVersion");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _applicationVersion.ApplicationVersion}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"ConditionDataType",{enumerable:!0,get:function(){return _types.ConditionDataType}}),Object.defineProperty(exports,"ConditionFactory",{enumerable:!0,get:function(){return _conditionFactory.ConditionFactory}}),Object.defineProperty(exports,"ConditionType",{enumerable:!0,get:function(){return _types.ConditionType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"ConversionLikelihood",{enumerable:!0,get:function(){return _conversionLikelihood.ConversionLikelihood}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _device.Device}}),Object.defineProperty(exports,"ExclusiveCampaign",{enumerable:!0,get:function(){return _exclusiveCampaign.ExclusiveCampaign}}),Object.defineProperty(exports,"FirstVisit",{enumerable:!0,get:function(){return _firstVisit.FirstVisit}}),Object.defineProperty(exports,"GeolocationCondition",{enumerable:!0,get:function(){return _geolocation.GeolocationCondition}}),Object.defineProperty(exports,"LastVisit",{enumerable:!0,get:function(){return _lastVisit.LastVisit}}),Object.defineProperty(exports,"NewVisitor",{enumerable:!0,get:function(){return _newVisitor.NewVisitor}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _operatingSystem.OperatingSystem}}),Object.defineProperty(exports,"PageTitle",{enumerable:!0,get:function(){return _pageTitle.PageTitle}}),Object.defineProperty(exports,"PageUrl",{enumerable:!0,get:function(){return _pageUrl.PageUrl}}),Object.defineProperty(exports,"PreviousPage",{enumerable:!0,get:function(){return _previousPage.PreviousPage}}),Object.defineProperty(exports,"SameDayVisits",{enumerable:!0,get:function(){return _sameDayVisits.SameDayVisits}}),Object.defineProperty(exports,"SdkLanguage",{enumerable:!0,get:function(){return _sdkLanguage.SdkLanguage}}),Object.defineProperty(exports,"Segment",{enumerable:!0,get:function(){return _segment.Segment}}),Object.defineProperty(exports,"TargetFeatureFlag",{enumerable:!0,get:function(){return _targetFeatureFlag.TargetFeatureFlag}}),Object.defineProperty(exports,"VisitedPages",{enumerable:!0,get:function(){return _visitedPages.VisitedPages}}),Object.defineProperty(exports,"VisitorCode",{enumerable:!0,get:function(){return _visitorCode.VisitorCode}}),Object.defineProperty(exports,"Visits",{enumerable:!0,get:function(){return _visits.Visits}});var _device=require("./device"),_conditionFactory=require("./conditionFactory"),_types=require("./types"),_customData=require("./customData"),_exclusiveCampaign=require("./exclusiveCampaign"),_browser=require("./browser"),_pageUrl=require("./pageUrl"),_pageTitle=require("./pageTitle"),_conversion=require("./conversion"),_visitorCode=require("./visitorCode"),_sdkLanguage=require("./sdkLanguage"),_targetFeatureFlag=require("./targetFeatureFlag"),_cookie=require("./cookie"),_operatingSystem=require("./operatingSystem"),_geolocation=require("./geolocation"),_segment=require("./segment"),_previousPage=require("./previousPage"),_visitedPages=require("./visitedPages"),_firstVisit=require("./firstVisit"),_lastVisit=require("./lastVisit"),_visits=require("./visits"),_sameDayVisits=require("./sameDayVisits"),_newVisitor=require("./newVisitor"),_applicationVersion=require("./applicationVersion"),_conversionLikelihood=require("./conversionLikelihood");
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/targeting/conditions/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { ConditionFactory } from './conditionFactory';\nexport { ConditionDataType, ConditionType } from './types';\nexport { CustomData } from './customData';\nexport { ExclusiveCampaign } from './exclusiveCampaign';\nexport { Browser } from './browser';\nexport { PageUrl } from './pageUrl';\nexport { PageTitle } from './pageTitle';\nexport { Conversion } from './conversion';\nexport { VisitorCode } from './visitorCode';\nexport { SdkLanguage } from './sdkLanguage';\nexport { TargetFeatureFlag } from './targetFeatureFlag';\nexport { Cookie } from './cookie';\nexport { OperatingSystem } from './operatingSystem';\nexport { GeolocationCondition } from './geolocation';\nexport { Segment } from './segment';\nexport { PreviousPage } from './previousPage';\nexport { VisitedPages } from './visitedPages';\nexport { FirstVisit } from './firstVisit';\nexport { LastVisit } from './lastVisit';\nexport { Visits } from './visits';\nexport { SameDayVisits } from './sameDayVisits';\nexport { NewVisitor } from './newVisitor';\nexport { ApplicationVersion } from './applicationVersion';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/targeting/conditions/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { ConditionFactory } from './conditionFactory';\nexport { ConditionDataType, ConditionType } from './types';\nexport { CustomData } from './customData';\nexport { ExclusiveCampaign } from './exclusiveCampaign';\nexport { Browser } from './browser';\nexport { PageUrl } from './pageUrl';\nexport { PageTitle } from './pageTitle';\nexport { Conversion } from './conversion';\nexport { VisitorCode } from './visitorCode';\nexport { SdkLanguage } from './sdkLanguage';\nexport { TargetFeatureFlag } from './targetFeatureFlag';\nexport { Cookie } from './cookie';\nexport { OperatingSystem } from './operatingSystem';\nexport { GeolocationCondition } from './geolocation';\nexport { Segment } from './segment';\nexport { PreviousPage } from './previousPage';\nexport { VisitedPages } from './visitedPages';\nexport { FirstVisit } from './firstVisit';\nexport { LastVisit } from './lastVisit';\nexport { Visits } from './visits';\nexport { SameDayVisits } from './sameDayVisits';\nexport { NewVisitor } from './newVisitor';\nexport { ApplicationVersion } from './applicationVersion';\nexport { ConversionLikelihood } from './conversionLikelihood';\n"],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LastVisit=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_utilities=require("../../utilities"),_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 LastVisit{constructor(a){let{matchType:b,count:c,unitOfTime:d}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"timeUnit",void 0),this.matchType=b,this.conditionValue=c,this.timeUnit=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);const{currentVisit:d,previousVisits:e}=c,f=d?d:e[e.length-1];return"number"==typeof f?(0,_tsRes.Ok)(this.checkCondition(f)):(0,_tsRes.Ok)(!1)}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue||!this.timeUnit)return!1;const b=Date.now()-a,c=_utilities.Utilities.convertTimeUnit(b,this.timeUnit);switch(this.matchType){case _types.MatchType.GREATER:return c>this.conditionValue;case _types.MatchType.LOWER:return c<this.conditionValue;default:return!1}}}exports.LastVisit=LastVisit;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LastVisit=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_utilities=require("../../utilities"),_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 LastVisit{constructor(a){let{matchType:b,count:c,unitOfTime:d}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"timeUnit",void 0),this.matchType=b,this.conditionValue=c,this.timeUnit=d}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!(null!==c&&void 0!==c&&c.visits.length))return(0,_tsRes.Ok)(!1);const{visits:d}=c,e=d[d.length-1];return(0,_tsRes.Ok)(this.checkCondition(e))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue||!this.timeUnit)return!1;const b=Date.now()-a,c=_utilities.Utilities.convertTimeUnit(b,this.timeUnit);switch(this.matchType){case _types.MatchType.GREATER:return c>this.conditionValue;case _types.MatchType.LOWER:return c<this.conditionValue;default:return!1}}}exports.LastVisit=LastVisit;
2
2
  //# sourceMappingURL=lastVisit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lastVisit.js","names":["LastVisit","constructor","a","matchType","count","unitOfTime","_defineProperty","conditionValue","timeUnit","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","currentVisit","previousVisits","lastVisitTimestamp","length","checkCondition","elapsedTimeMilliseconds","Date","now","elapsedTimeUnit","Utilities","convertTimeUnit","MatchType","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/lastVisit.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities, TimeUnit } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class LastVisit implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n private timeUnit?: TimeUnit | null;\n\n constructor({ matchType, count, unitOfTime }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = count;\n this.timeUnit = unitOfTime;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n const { currentVisit, previousVisits } = visitsData;\n\n const lastVisitTimestamp = currentVisit\n ? currentVisit\n : previousVisits[previousVisits.length - 1];\n\n if (typeof lastVisitTimestamp !== 'number') {\n return Ok(false);\n }\n\n return Ok(this.checkCondition(lastVisitTimestamp));\n }\n\n private checkCondition(lastVisitTimestamp: number): boolean {\n if (\n !this.matchType ||\n typeof this.conditionValue !== 'number' ||\n !this.timeUnit\n ) {\n return false;\n }\n\n const elapsedTimeMilliseconds = Date.now() - lastVisitTimestamp;\n const elapsedTimeUnit = Utilities.convertTimeUnit(\n elapsedTimeMilliseconds,\n this.timeUnit,\n );\n\n switch (this.matchType) {\n case MatchType.GREATER:\n return elapsedTimeUnit > this.conditionValue;\n case MatchType.LOWER:\n return elapsedTimeUnit < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"4uBAOO,KAAM,CAAAA,SAAgC,CAK3CC,WAAWA,CAAAC,CAAA,CAAsD,IAArD,CAAEC,SAAS,CAATA,CAAS,CAAEC,KAAK,CAALA,CAAK,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAH,CAAA,CAAAI,eAAA,0BAAAA,eAAA,+BAAAA,eAAA,yBAC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,CACF,CAACsB,OAAA,CAAA7B,SAAA,CAAAA,SAAA"}
1
+ {"version":3,"file":"lastVisit.js","names":["LastVisit","constructor","a","matchType","count","unitOfTime","_defineProperty","conditionValue","timeUnit","evaluate","targetingData","visitsData","KameleoonData","VisitsData","visits","length","Ok","latestPreviousVisitTimestamp","checkCondition","lastVisitTimestamp","elapsedTimeMilliseconds","Date","now","elapsedTimeUnit","Utilities","convertTimeUnit","MatchType","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/lastVisit.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities, TimeUnit } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class LastVisit implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n private timeUnit?: TimeUnit | null;\n\n constructor({ matchType, count, unitOfTime }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = count;\n this.timeUnit = unitOfTime;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData?.visits.length) {\n return Ok(false);\n }\n\n const { visits } = visitsData;\n\n // --- Note ---\n // Takes the timestamp of latest previous visit\n const latestPreviousVisitTimestamp =\n visits[visits.length - 1];\n\n return Ok(this.checkCondition(latestPreviousVisitTimestamp));\n }\n\n private checkCondition(lastVisitTimestamp: number): boolean {\n if (\n !this.matchType ||\n typeof this.conditionValue !== 'number' ||\n !this.timeUnit\n ) {\n return false;\n }\n\n const elapsedTimeMilliseconds = Date.now() - lastVisitTimestamp;\n const elapsedTimeUnit = Utilities.convertTimeUnit(\n elapsedTimeMilliseconds,\n this.timeUnit,\n );\n\n switch (this.matchType) {\n case MatchType.GREATER:\n return elapsedTimeUnit > this.conditionValue;\n case MatchType.LOWER:\n return elap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S,EACpB,IAAK,CAAAuB,gBAAS,CAACC,OAAO,CACpB,MAAO,CAAAJ,CAAe,CAAG,IAAI,CAAChB,cAAc,CAC9C,IAAK,CAAAmB,gBAAS,CAACE,KAAK,CAClB,MAAO,CAAAL,CAAe,CAAG,IAAI,CAAChB,cAAc,CAC9C,QACE,QACJ,CACF,CACF,CAACsB,OAAA,CAAA7B,SAAA,CAAAA,SAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewVisitor=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_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 NewVisitor{constructor(a){let{visitorType:b}=a;_defineProperty(this,"visitorType",void 0),this.visitorType=b}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c||!this.visitorType)return(0,_tsRes.Ok)(!1);const{currentVisit:d,previousVisits:e}=c,f=d&&!e.length||!d&&!e.length;switch(this.visitorType){case _types.VisitorType.NEW:return(0,_tsRes.Ok)(f);case _types.VisitorType.RETURNING:return(0,_tsRes.Ok)(!f);default:(0,_kameleoonError.exhaustCheck)(this.visitorType)}}}exports.NewVisitor=NewVisitor;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NewVisitor=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_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 NewVisitor{constructor(a){let{visitorType:b}=a;_defineProperty(this,"visitorType",void 0),this.visitorType=b}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c||!this.visitorType)return(0,_tsRes.Ok)(!1);const{visits:d}=c,e=!d.length;switch(this.visitorType){case _types.VisitorType.NEW:return(0,_tsRes.Ok)(e);case _types.VisitorType.RETURNING:return(0,_tsRes.Ok)(!e);default:(0,_kameleoonError.exhaustCheck)(this.visitorType)}}}exports.NewVisitor=NewVisitor;
2
2
  //# sourceMappingURL=newVisitor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"newVisitor.js","names":["NewVisitor","constructor","a","visitorType","_defineProperty","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","currentVisit","previousVisits","isNewVisitor","length","VisitorType","NEW","RETURNING","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/newVisitor.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, VisitorType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class NewVisitor implements ICondition {\n private visitorType?: VisitorType | null;\n\n constructor({ visitorType }: ConditionDataType) {\n this.visitorType = visitorType;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData || !this.visitorType) {\n return Ok(false);\n }\n\n const { currentVisit, previousVisits } = visitsData;\n\n // --- Note ---\n // Second case handles situation when user didn't use `addData` that\n // creates new current visit\n const isNewVisitor =\n (currentVisit && !previousVisits.length) ||\n (!currentVisit && !previousVisits.length);\n\n switch (this.visitorType) {\n case VisitorType.NEW:\n return Ok(isNewVisitor);\n case VisitorType.RETURNING:\n return Ok(!isNewVisitor);\n default:\n exhaustCheck(this.visitorType);\n }\n }\n}\n"],"mappings":"uvBAMO,KAAM,CAAAA,UAAiC,CAG5CC,WAAWA,CAAAC,CAAA,CAAqC,IAApC,CAAEC,WAAW,CAAXA,CAA+B,CAAC,CAAAD,CAAA,CAAAE,eAAA,4BAC5C,IAAI,CAACD,WAAW,CAAGA,CACrB,CAEOE,QAAQA,CAAAH,CAAA,CAEyC,IAFxC,CACdI,aAAa,CAAbA,CACkB,CAAC,CAAAJ,CAAA,CACnB,KAAM,CAAAK,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,CAACF,CAAU,EAAI,CAAC,IAAI,CAACJ,WAAW,CAClC,MAAO,GAAAO,SAAE,IAAM,CAAC,CACjB,KAEK,CAAEC,YAAY,CAAZA,CAAY,CAAEC,cAAc,CAAdA,CAAe,CAAC,CAAGL,CAAU,CAK7CM,CAAY,CACfF,CAAY,EAAI,CAACC,CAAc,CAACE,MAAM,EACtC,CAACH,CAAY,EAAI,CAACC,CAAc,CAACE,MAAO,CAE3C,OAAQ,IAAI,CAACX,WAAW,EACtB,IAAK,CAAAY,kBAAW,CAACC,GAAG,CAClB,MAAO,GAAAN,SAAE,EAACG,CAAY,CAAC,CACzB,IAAK,CAAAE,kBAAW,CAACE,SAAS,CACxB,MAAO,GAAAP,SAAE,EAAC,CAACG,CAAY,CAAC,CAC1B,QACE,GAAAK,4BAAY,EAAC,IAAI,CAACf,WAAW,CACjC,CACF,CACF,CAACgB,OAAA,CAAAnB,UAAA,CAAAA,UAAA"}
1
+ {"version":3,"file":"newVisitor.js","names":["NewVisitor","constructor","a","visitorType","_defineProperty","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","visits","isNewVisitor","length","VisitorType","NEW","RETURNING","exhaustCheck","exports"],"sources":["../../../src/targeting/conditions/newVisitor.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, VisitorType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class NewVisitor implements ICondition {\n private visitorType?: VisitorType | null;\n\n constructor({ visitorType }: ConditionDataType) {\n this.visitorType = visitorType;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData || !this.visitorType) {\n return Ok(false);\n }\n\n const { visits } = visitsData;\n\n // --- Note ---\n // Second case handles situation when user didn't use `addData` that\n // creates new current visit\n const isNewVisitor = !visits.length;\n\n switch (this.visitorType) {\n case VisitorType.NEW:\n return Ok(isNewVisitor);\n case VisitorType.RETURNING:\n return Ok(!isNewVisitor);\n default:\n exhaustCheck(this.visitorType);\n }\n }\n}\n"],"mappings":"uvBAMO,KAAM,CAAAA,UAAiC,CAG5CC,WAAWA,CAAAC,CAAA,CAAqC,IAApC,CAAEC,WAAW,CAAXA,CAA+B,CAAC,CAAAD,CAAA,CAAAE,eAAA,4BAC5C,IAAI,CAACD,WAAW,CAAGA,CACrB,CAEOE,QAAQA,CAAAH,CAAA,CAEyC,IAFxC,CACdI,aAAa,CAAbA,CACkB,CAAC,CAAAJ,CAAA,CACnB,KAAM,CAAAK,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,CAACF,CAAU,EAAI,CAAC,IAAI,CAACJ,WAAW,CAClC,MAAO,GAAAO,SAAE,IAAM,CAAC,CACjB,KAEK,CAAEC,MAAM,CAANA,CAAO,CAAC,CAAGJ,CAAU,CAKvBK,CAAY,CAAG,CAACD,CAAM,CAACE,MAAM,CAEnC,OAAQ,IAAI,CAACV,WAAW,EACtB,IAAK,CAAAW,kBAAW,CAACC,GAAG,CAClB,MAAO,GAAAL,SAAE,EAACE,CAAY,CAAC,CACzB,IAAK,CAAAE,kBAAW,CAACE,SAAS,CACxB,MAAO,GAAAN,SAAE,EAAC,CAACE,CAAY,CAAC,CAC1B,QACE,GAAAK,4BAAY,EAAC,IAAI,CAACd,WAAW,CACjC,CACF,CACF,CAACe,OAAA,CAAAlB,UAAA,CAAAA,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"pageUrl.js","names":["PageUrl","constructor","a","matchType","url","_defineProperty","conditionValue","evaluate","targetingData","pageViewData","KameleoonData","PageView","Ok","Object","keys","some","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","exports"],"sources":["../../../src/targeting/conditions/pageUrl.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { exhaustCheck, KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PageUrl implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: string | null;\n\n constructor({ matchType, url }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = url;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewData = targetingData?.[KameleoonData.PageView];\n\n if (pageViewData) {\n return Ok(\n Object.keys(pageViewData).some((url) => this.checkCondition(url)),\n );\n }\n\n return Ok(false);\n }\n\n private checkCondition(url: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return url.includes(this.conditionValue);\n case MatchType.EXACT:\n return url === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(url);\n default:\n return false;\n }\n }\n}\n"],"mappings":"0uBAOO,KAAM,CAAAA,OAA8B,CAIzCC,WAAWA,CAAAC,CAAA,CAAwC,IAAvC,CAAEC,SAAS,CAATA,CAAS,CAAEC,GAAG,CAAHA,CAAuB,CAAC,CAAAF,CAAA,CAAAG,eAAA,0BAAAA,eAAA,+BAC/C,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGF,CACxB,CAEOG,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAY,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,QAAQ,CAAC,CAAC,MAEzD,CAAAF,CAAY,CACP,GAAAG,SAAE,EACPC,MAAM,CAACC,IAAI,CAACL,CAAY,CAAC,CAACM,IAAI,CAAEX,CAAG,EAAK,IAAI,CAACY,cAAc,CAACZ,CAAG,CAAC,CAClE,CAAC,CAGI,GAAAQ,SAAE,IAAM,CACjB,CAEQI,cAAcA,CAACZ,CAAW,CAAW,CAC3C,GAAI,CAAC,IAAI,CAACD,SAAS,EAAI,CAAC,IAAI,CAACG,cAAc,CACzC,SAGF,OAAQ,IAAI,CAACH,SAAS,EACpB,IAAK,CAAAc,gBAAS,CAACC,QAAQ,CACrB,MAAO,CAAAd,CAAG,CAACe,QAAQ,CAAC,IAAI,CAACb,cAAc,CAAC,CAC1C,IAAK,CAAAW,gBAAS,CAACG,KAAK,CAClB,MAAO,CAAAhB,CAAG,GAAK,IAAI,CAACE,cAAc,CACpC,IAAK,CAAAW,gBAAS,CAACI,kBAAkB,CAC/B,MAAO,CAAAC,oBAAS,CAACC,WAAW,CAAC,IAAI,CAACjB,cAAc,CAAC,CAACkB,IAAI,CAACpB,CAAG,CAAC,CAC7D,QACE,QACJ,CACF,CACF,CAACqB,OAAA,CAAAzB,OAAA,CAAAA,OAAA"}
1
+ {"version":3,"file":"pageUrl.js","names":["PageUrl","constructor","a","matchType","url","_defineProperty","conditionValue","evaluate","targetingData","pageViewData","KameleoonData","PageView","Ok","Object","keys","some","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","exports"],"sources":["../../../src/targeting/conditions/pageUrl.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PageUrl implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: string | null;\n\n constructor({ matchType, url }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = url;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewData = targetingData?.[KameleoonData.PageView];\n\n if (pageViewData) {\n return Ok(\n Object.keys(pageViewData).some((url) => this.checkCondition(url)),\n );\n }\n\n return Ok(false);\n }\n\n private checkCondition(url: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return url.includes(this.conditionValue);\n case MatchType.EXACT:\n return url === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(url);\n default:\n return false;\n }\n }\n}\n"],"mappings":"0uBAOO,KAAM,CAAAA,OAA8B,CAIzCC,WAAWA,CAAAC,CAAA,CAAwC,IAAvC,CAAEC,SAAS,CAATA,CAAS,CAAEC,GAAG,CAAHA,CAAuB,CAAC,CAAAF,CAAA,CAAAG,eAAA,0BAAAA,eAAA,+BAC/C,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGF,CACxB,CAEOG,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAY,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,QAAQ,CAAC,CAAC,MAEzD,CAAAF,CAAY,CACP,GAAAG,SAAE,EACPC,MAAM,CAACC,IAAI,CAACL,CAAY,CAAC,CAACM,IAAI,CAAEX,CAAG,EAAK,IAAI,CAACY,cAAc,CAACZ,CAAG,CAAC,CAClE,CAAC,CAGI,GAAAQ,SAAE,IAAM,CACjB,CAEQI,cAAcA,CAACZ,CAAW,CAAW,CAC3C,GAAI,CAAC,IAAI,CAACD,SAAS,EAAI,CAAC,IAAI,CAACG,cAAc,CACzC,SAGF,OAAQ,IAAI,CAACH,SAAS,EACpB,IAAK,CAAAc,gBAAS,CAACC,QAAQ,CACrB,MAAO,CAAAd,CAAG,CAACe,QAAQ,CAAC,IAAI,CAACb,cAAc,CAAC,CAC1C,IAAK,CAAAW,gBAAS,CAACG,KAAK,CAClB,MAAO,CAAAhB,CAAG,GAAK,IAAI,CAACE,cAAc,CACpC,IAAK,CAAAW,gBAAS,CAACI,kBAAkB,CAC/B,MAAO,CAAAC,oBAAS,CAACC,WAAW,CAAC,IAAI,CAACjB,cAAc,CAAC,CAACkB,IAAI,CAACpB,CAAG,CAAC,CAC7D,QACE,QACJ,CACF,CACF,CAACqB,OAAA,CAAAzB,OAAA,CAAAA,OAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviousPage=void 0;var _tsRes=require("ts-res"),_utilities=require("../../utilities"),_kameleoonData=require("../../kameleoonData"),_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 PreviousPage{constructor(a){let{matchType:b,url:c}=a;_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"matchType",void 0),this.conditionValue=c,this.matchType=b}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.PageView];if(!c)return(0,_tsRes.Ok)(!1);const d=this.getSecondLatestPageView(Object.values(c));if(!d)return(0,_tsRes.Ok)(!1);const e=d.urlAddress;return(0,_tsRes.Ok)(this.checkCondition(e))}checkCondition(a){if(!this.matchType||!this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.CONTAINS:return a.includes(this.conditionValue);case _types.MatchType.EXACT:return a===this.conditionValue;case _types.MatchType.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(this.conditionValue).test(a);default:return!1}}getSecondLatestPageView(a){if(2>a.length)return;let b,c;return a.forEach(a=>{var d,e;const f=a.timestamps[a.timestamps.length-1],g=a.timestamps[a.timestamps.length-2];if(!b&&!c)return b=a,void(g&&(c=a));const h=null!==(d=b.timestamps[b.timestamps.length-1])&&void 0!==d?d:0;if(f>h){var i,j;c=b,b=a;const d=null===(i=c)||void 0===i?void 0:i.timestamps[(null===(j=c)||void 0===j?void 0:j.timestamps.length)-1];return void(g&&g>d&&(c=a))}let k;if(b.urlAddress===(null===(e=c)||void 0===e?void 0:e.urlAddress))k=c.timestamps[c.timestamps.length-2];else{var l,m,n;k=null!==(l=null===(m=c)||void 0===m?void 0:m.timestamps[(null===(n=c)||void 0===n?void 0:n.timestamps.length)-1])&&void 0!==l?l:0}f&&f>k&&(c=a)}),c}}exports.PreviousPage=PreviousPage;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PreviousPage=void 0;var _tsRes=require("ts-res"),_utilities=require("../../utilities"),_kameleoonData=require("../../kameleoonData"),_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 PreviousPage{constructor(a){let{matchType:b,url:c}=a;_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"matchType",void 0),this.conditionValue=c,this.matchType=b}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.PageView];if(!c)return(0,_tsRes.Ok)(!1);const d=this.getSecondLatestPageView(Object.values(c));if(!d)return(0,_tsRes.Ok)(!1);const e=d.urlAddress;return(0,_tsRes.Ok)(this.checkCondition(e))}checkCondition(a){if(!this.matchType||!this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.CONTAINS:return a.includes(this.conditionValue);case _types.MatchType.EXACT:return a===this.conditionValue;case _types.MatchType.REGULAR_EXPRESSION:return _utilities.Utilities.parseRegExp(this.conditionValue).test(a);default:return!1}}getSecondLatestPageView(a){if(2>a.length)return;let b,c;return a.forEach(a=>{const d=a.timestamps[a.timestamps.length-1];if(!b)return void(b=a);const e=b.timestamps[b.timestamps.length-1];if(d>e)return c=b,void(b=a);const f=c?c.timestamps[c.timestamps.length-1]:0;d>f&&(c=a)}),c}}exports.PreviousPage=PreviousPage;
2
2
  //# sourceMappingURL=previousPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"previousPage.js","names":["PreviousPage","constructor","a","matchType","url","_defineProperty","conditionValue","evaluate","targetingData","pageViewsData","KameleoonData","PageView","Ok","secondLatestPageView","getSecondLatestPageView","Object","values","urlAddress","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","length","latestPV","secondPV","forEach","currentPV","d","e","currentLatestTs","timestamps","currentSecondTs","latestTs","i","j","secondTs","l","m","n","exports"],"sources":["../../../src/targeting/conditions/previousPage.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { Utilities } from 'src/utilities';\nimport { KameleoonData, PageViewDataType } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PreviousPage implements ICondition {\n private conditionValue?: string | null;\n private matchType?: MatchType | null;\n\n constructor({ matchType, url }: ConditionDataType) {\n this.conditionValue = url;\n this.matchType = matchType;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewsData = targetingData?.[KameleoonData.PageView];\n\n if (!pageViewsData) {\n return Ok(false);\n }\n\n // --- Note ---\n // There is more concise way to find previous latest page, but it's less performant,\n // here we only ever check two latest timestamps of page and use one loop\n const secondLatestPageView = this.getSecondLatestPageView(\n Object.values(pageViewsData),\n );\n\n if (!secondLatestPageView) {\n return Ok(false);\n }\n\n const url = secondLatestPageView.urlAddress;\n\n return Ok(this.checkCondition(url));\n }\n\n private checkCondition(url: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return url.includes(this.conditionValue);\n case MatchType.EXACT:\n return url === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(url);\n default:\n return false;\n }\n }\n\n private getSecondLatestPageView(\n pageViewsData: PageViewDataType[],\n ): PageViewDataType | undefined {\n if (pageViewsData.length < 2) {\n return undefined;\n }\n\n // --- Note ---\n // Arguments and variables named with abbreviations for better readability\n // `second` in this context is `second to latest`\n let latestPV: PageViewDataType | undefined;\n let secondPV: PageViewDataType | undefined;\n\n pageViewsData.forEach((currentPV) => {\n const currentLatestTs =\n currentPV.timestamps[currentPV.timestamps.length - 1];\n const currentSecondTs =\n currentPV.timestamps[currentPV.timestamps.length - 2];\n\n // -- Initial check\n if (!latestPV && !secondPV) {\n latestPV = currentPV;\n\n if (currentSecondTs) {\n secondPV = currentPV;\n }\n\n return;\n }\n\n const latestTs =\n latestPV!.timestamps[latestPV!.timestamps.length - 1] ?? 0;\n\n // -- Covering a case where latest needs to be updated\n if (currentLatestTs > latestTs) {\n secondPV = latestPV;\n latestPV = currentPV;\n\n const secondTs = secondPV?.timestamps[secondPV?.timestamps.length - 1];\n\n // -- Second may need to be updated after latest\n if (currentSecondTs && currentSecondTs > secondTs!) {\n secondPV = currentPV;\n }\n\n return;\n }\n\n // -- Covering a case where only second needs to be updated\n let secondTs: number;\n\n // -- Second and latest can be the same page\n if (latestPV!.urlAddress === secondPV?.urlAddress) {\n // --- Note ---\n // If latest is equal to second, there are at least two timestamps in array\n secondTs = secondPV.timestamps[secondPV.timestamps.length - 2];\n } else {\n secondTs = secondPV?.timestamps[secondPV?.timestamps.length - 1] ?? 0;\n }\n\n // -- Second may need to be updated\n if (currentLatestTs && currentLatestTs > secondTs!) {\n secondPV = currentPV;\n }\n });\n\n return secondPV;\n }\n}\n"],"mappings":"+uBAOO,KAAM,CAAAA,YAAmC,CAI9CC,WAAWA,CAAAC,CAAA,CAAwC,IAAvC,CAAEC,SAAS,CAATA,CAAS,CAAEC,GAAG,CAAHA,CAAuB,CAAC,CAAAF,CAAA,CAAAG,eAAA,+BAAAA,eAAA,0BAC/C,IAAI,CAACC,cAAc,CAAGF,CAAG,CACzB,IAAI,CAACD,SAAS,CAAGA,CACnB,CAEOI,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAa,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CA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EAAG,CAAC,CAAC,YAAAc,CAAA,CAAAA,CAAA,CAAI,CACtE,CAGIP,CAAe,EAAIA,CAAe,CAAGM,CAAS,GAChDX,CAAQ,CAAGE,CAAS,CAExB,CAAC,CAAC,CAEKF,CACT,CACF,CAACe,OAAA,CAAA5C,YAAA,CAAAA,YAAA"}
1
+ {"version":3,"file":"previousPage.js","names":["PreviousPage","constructor","a","matchType","url","_defineProperty","conditionValue","evaluate","targetingData","pageViewsData","KameleoonData","PageView","Ok","secondLatestPageView","getSecondLatestPageView","Object","values","urlAddress","checkCondition","MatchType","CONTAINS","includes","EXACT","REGULAR_EXPRESSION","Utilities","parseRegExp","test","length","latestPV","secondPV","forEach","currentPV","currentLatestTs","timestamps","latestTs","secondTs","exports"],"sources":["../../../src/targeting/conditions/previousPage.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { Utilities } from 'src/utilities';\nimport { KameleoonData, PageViewDataType } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class PreviousPage implements ICondition {\n private conditionValue?: string | null;\n private matchType?: MatchType | null;\n\n constructor({ matchType, url }: ConditionDataType) {\n this.conditionValue = url;\n this.matchType = matchType;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const pageViewsData = targetingData?.[KameleoonData.PageView];\n\n if (!pageViewsData) {\n return Ok(false);\n }\n\n // --- Note ---\n // There is more concise way to find previous latest page, but it's less performant,\n // here we only ever check two latest timestamps of page and use one loop\n // The second latest can't be equal to the latest\n const secondLatestPageView = this.getSecondLatestPageView(\n Object.values(pageViewsData),\n );\n\n if (!secondLatestPageView) {\n return Ok(false);\n }\n\n const url = secondLatestPageView.urlAddress;\n\n return Ok(this.checkCondition(url));\n }\n\n private checkCondition(url: string): boolean {\n if (!this.matchType || !this.conditionValue) {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.CONTAINS:\n return url.includes(this.conditionValue);\n case MatchType.EXACT:\n return url === this.conditionValue;\n case MatchType.REGULAR_EXPRESSION:\n return Utilities.parseRegExp(this.conditionValue).test(url);\n default:\n return false;\n }\n }\n\n private getSecondLatestPageView(\n pageViewsData: PageViewDataType[],\n ): PageViewDataType | undefined {\n if (pageViewsData.length < 2) {\n return undefined;\n }\n\n // --- Note ---\n // Arguments and variables named with abbreviations for better readability\n // `second` in this context is `second to latest`\n let latestPV: PageViewDataType | undefined;\n let secondPV: PageViewDataType | undefined;\n\n pageViewsData.forEach((currentPV) => {\n const currentLatestTs =\n currentPV.timestamps[currentPV.timestamps.length - 1];\n\n // -- Initial check\n if (!latestPV) {\n latestPV = currentPV;\n return;\n }\n\n const latestTs = latestPV.timestamps[latestPV!.timestamps.length - 1];\n\n // -- Covering a case where latest needs to be updated\n if (currentLatestTs > latestTs) {\n secondPV = latestPV;\n latestPV = currentPV;\n\n return;\n }\n\n // -- Covering a case where only second needs to be updated\n const secondTs = secondPV\n ? secondPV.timestamps[secondPV.timestamps.length - 1]\n : 0;\n\n // -- Second may need to be updated\n if (currentLatestTs > secondTs) {\n secondPV = currentPV;\n }\n });\n\n return secondPV;\n }\n}\n"],"mappings":"+uBAOO,KAAM,CAAAA,YAAmC,CAI9CC,WAAWA,CAAAC,CAAA,CAAwC,IAAvC,CAAEC,SAAS,CAATA,CAAS,CAAEC,GAAG,CAAHA,CAAuB,CAAC,CAAAF,CAAA,CAAAG,eAAA,+BAAAA,eAAA,0BAC/C,IAAI,CAACC,cAAc,CAAGF,CAAG,CACzB,IAAI,CAACD,SAAS,CAAGA,CACnB,CAEOI,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAa,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,QAAQ,CAAC,CAE7D,GAAI,CAACF,CAAa,CAChB,M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K,UAAU,CAACL,CAAQ,CAAEK,UAAU,CAACN,MAAM,CAAG,CAAC,CAAC,CAGrE,GAAIK,CAAe,CAAGE,CAAQ,CAI5B,MAHA,CAAAL,CAAQ,CAAGD,CAAQ,MACnBA,CAAQ,CAAGG,CAAS,EAMtB,KAAM,CAAAI,CAAQ,CAAGN,CAAQ,CACrBA,CAAQ,CAACI,UAAU,CAACJ,CAAQ,CAACI,UAAU,CAACN,MAAM,CAAG,CAAC,CAAC,CACnD,CAAC,CAGDK,CAAe,CAAGG,CAAQ,GAC5BN,CAAQ,CAAGE,CAAS,CAExB,CAAC,CAAC,CAEKF,CACT,CACF,CAACO,OAAA,CAAApC,YAAA,CAAAA,YAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SameDayVisits=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_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 SameDayVisits{constructor(a){let{matchType:b,visitCount:c}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=b,this.conditionValue=c}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);let d=0;const e=new Date().setHours(0,0,0,0),{previousVisits:f,currentVisit:g}=c;return f.forEach(a=>{a>e&&d++}),g&&g>e&&d++,(0,_tsRes.Ok)(this.checkCondition(d))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.EQUAL:return a===this.conditionValue;case _types.MatchType.GREATER:return a>this.conditionValue;case _types.MatchType.LOWER:return a<this.conditionValue;default:return!1}}}exports.SameDayVisits=SameDayVisits;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SameDayVisits=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_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 SameDayVisits{constructor(a){let{matchType:b,visitCount:c}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=b,this.conditionValue=c}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);let d=0;const e=new Date().setHours(0,0,0,0),{visits:f}=c;return f.forEach(a=>{a>e&&d++}),d+=1,(0,_tsRes.Ok)(this.checkCondition(d))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.EQUAL:return a===this.conditionValue;case _types.MatchType.GREATER:return a>this.conditionValue;case _types.MatchType.LOWER:return a<this.conditionValue;default:return!1}}}exports.SameDayVisits=SameDayVisits;
2
2
  //# sourceMappingURL=sameDayVisits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sameDayVisits.js","names":["SameDayVisits","constructor","a","matchType","visitCount","_defineProperty","conditionValue","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","todayVisits","todayTimestamp","Date","setHours","previousVisits","currentVisit","forEach","timestamp","checkCondition","todayVisitsAmount","MatchType","EQUAL","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/sameDayVisits.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class SameDayVisits implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n\n constructor({ matchType, visitCount }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = visitCount;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n let todayVisits = 0;\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0);\n const { previousVisits, currentVisit } = visitsData;\n\n previousVisits.forEach((timestamp) => {\n if (timestamp > todayTimestamp) {\n todayVisits++;\n }\n });\n\n if (currentVisit && currentVisit > todayTimestamp) {\n todayVisits++;\n }\n\n return Ok(this.checkCondition(todayVisits));\n }\n\n private checkCondition(todayVisitsAmount: number): boolean {\n if (!this.matchType || typeof this.conditionValue !== 'number') {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.EQUAL:\n return todayVisitsAmount === this.conditionValue;\n case MatchType.GREATER:\n return todayVisitsAmount > this.conditionValue;\n case MatchType.LOWER:\n return todayVisitsAmount < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"0sBAMO,KAAM,CAAAA,aAAoC,CAI/CC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,SAAS,CAATA,CAAS,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAF,CAAA,CAAAG,eAAA,0BAAAA,eAAA,+BACtD,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGF,C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CAAAA,aAAA"}
1
+ {"version":3,"file":"sameDayVisits.js","names":["SameDayVisits","constructor","a","matchType","visitCount","_defineProperty","conditionValue","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","todayVisits","todayTimestamp","Date","setHours","visits","forEach","timestamp","checkCondition","todayVisitsAmount","MatchType","EQUAL","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/sameDayVisits.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class SameDayVisits implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n\n constructor({ matchType, visitCount }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = visitCount;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n let todayVisits = 0;\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0);\n const { visits } = visitsData;\n\n visits.forEach((timestamp) => {\n if (timestamp > todayTimestamp) {\n todayVisits++;\n }\n });\n\n // --- Note ---\n // +1 is current visit\n todayVisits += 1;\n\n return Ok(this.checkCondition(todayVisits));\n }\n\n private checkCondition(todayVisitsAmount: number): boolean {\n if (!this.matchType || typeof this.conditionValue !== 'number') {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.EQUAL:\n return todayVisitsAmount === this.conditionValue;\n case MatchType.GREATER:\n return todayVisitsAmount > this.conditionValue;\n case MatchType.LOWER:\n return todayVisitsAmount < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"0sBAMO,KAAM,CAAAA,aAAoC,CAI/CC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,SAAS,CAATA,CAAS,CAAEC,UAAU,CAAVA,CAA8B,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D,QACE,QACJ,CACF,CACF,CAACoB,OAAA,CAAA1B,aAAA,CAAAA,aAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";var _tsRes=require("ts-res");Object.defineProperty(exports,"__esModule",{value:!0}),exports.TargetFeatureFlag=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 TargetFeatureFlag{constructor(a){let{featureFlagId:b,variationKey:c,ruleId:d}=a;_defineProperty(this,"featureId",void 0),_defineProperty(this,"ruleId",void 0),_defineProperty(this,"variationKey",void 0),this.featureId=b,this.ruleId=d,this.variationKey=c}evaluate(a){let{variationData:b,ruleMap:c}=a;if(!this.featureId||!c)return(0,_tsRes.Ok)(!1);if(this.featureId&&!this.ruleId&&!this.variationKey){for(const[a,e]of c){var d;const{featureId:a,experimentId:c}=e;if(a===this.featureId&&"number"==typeof(null===(d=b[c])||void 0===d?void 0:d.variationId))return(0,_tsRes.Ok)(!0)}return(0,_tsRes.Ok)(!1)}if(this.featureId&&this.ruleId){var e;const a=c.get(this.ruleId);if(!a)return(0,_tsRes.Ok)(!1);const{experimentId:d,variations:g}=a;if(this.variationKey){var f;const a=g.get(this.variationKey);return(0,_tsRes.Ok)(!!a&&(null===(f=b[d])||void 0===f?void 0:f.variationId)===a)}return(0,_tsRes.Ok)(null!==(e=b[a.experimentId])&&void 0!==e&&e.variationId)}if(this.featureId&&!this.ruleId&&this.variationKey)for(const[a,d]of c){const{featureId:a,experimentId:c,variations:e}=d;if(a===this.featureId&&e.has(this.variationKey)){var g;const a=e.get(this.variationKey);return(0,_tsRes.Ok)(!!a&&(null===(g=b[c])||void 0===g?void 0:g.variationId)===a)}}return(0,_tsRes.Ok)(!1)}}exports.TargetFeatureFlag=TargetFeatureFlag;
1
+ "use strict";var _tsRes=require("ts-res");Object.defineProperty(exports,"__esModule",{value:!0}),exports.TargetFeatureFlag=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 TargetFeatureFlag{constructor(a){let{featureFlagId:b,variationKey:c,ruleId:d}=a;_defineProperty(this,"featureId",void 0),_defineProperty(this,"ruleId",void 0),_defineProperty(this,"variationKey",void 0),this.featureId=b,this.ruleId=d,this.variationKey=c}evaluate(a){let{variationData:b,ruleMap:c}=a;if(!this.featureId||!c)return(0,_tsRes.Ok)(!1);if(this.featureId&&!this.ruleId&&!this.variationKey){for(const[_,a]of c){var d;const{featureId:c,experimentId:e}=a;if(c===this.featureId&&"number"==typeof(null===(d=b[e])||void 0===d?void 0:d.variationId))return(0,_tsRes.Ok)(!0)}return(0,_tsRes.Ok)(!1)}if(this.featureId&&this.ruleId){var e;const a=c.get(this.ruleId);if(!a)return(0,_tsRes.Ok)(!1);const{experimentId:d,variations:g}=a;if(this.variationKey){var f;const a=g.get(this.variationKey);return(0,_tsRes.Ok)(!!a&&(null===(f=b[d])||void 0===f?void 0:f.variationId)===a)}return(0,_tsRes.Ok)(null!==(e=b[a.experimentId])&&void 0!==e&&e.variationId)}if(this.featureId&&!this.ruleId&&this.variationKey)for(const[_,a]of c){const{featureId:c,experimentId:d,variations:e}=a;if(c===this.featureId&&e.has(this.variationKey)){var g;const a=e.get(this.variationKey);return(0,_tsRes.Ok)(!!a&&(null===(g=b[d])||void 0===g?void 0:g.variationId)===a)}}return(0,_tsRes.Ok)(!1)}}exports.TargetFeatureFlag=TargetFeatureFlag;
2
2
  //# sourceMappingURL=targetFeatureFlag.js.map
@@ -46,4 +46,7 @@ export type ConditionDataType = {
46
46
  goalId?: number | null;
47
47
  sdkLanguage?: SdkLanguageType | null;
48
48
  visitorCode?: string | null;
49
+ lowerBound?: number;
50
+ upperBound?: number;
51
+ keyMomentId?: number;
49
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/targeting/conditions/types.ts"],"sourcesContent":["import { Result } from 'ts-res';\nimport { SdkLanguageType } from 'src/constants';\nimport { BrowserType, DeviceType } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport {\n EvaluationDataType,\n MatchType,\n MatchTypeTest,\n MatchTypeVariation,\n NameMatchType,\n TargetingType,\n ValueMatchType,\n VersionMatchType,\n VisitorType,\n} from 'src/targeting/types';\nimport { OperatingSystemType } from 'src/kameleoonData/types';\nimport { TimeUnit } from 'src/utilities';\n\nexport interface ICondition {\n evaluate: (data: EvaluationDataType) => Result<boolean, KameleoonError>;\n}\n\nexport type ConditionType = ICondition;\n\nexport type ConditionDataType = {\n id: number;\n targetingType: TargetingType;\n isInclude: boolean | null;\n weight: number;\n customDataIndex?: string | null;\n pageCount?: number | null;\n value?: string | null;\n valueMatchType?: ValueMatchType | null;\n experiment?: number | null;\n variation?: number | null;\n visitCount?: number | null;\n variationKey?: string | null;\n featureFlagId?: number | null;\n ruleId?: number | null;\n variationMatchType?: MatchTypeVariation | null;\n testMatchType?: MatchTypeTest | null;\n matchType?: MatchType | null;\n device?: DeviceType | null;\n browser?: BrowserType | null;\n os?: OperatingSystemType | null;\n name?: string | null;\n nameMatchType?: NameMatchType | null;\n country?: string | null;\n region?: string | null;\n city?: string | null;\n segmentId?: number | null;\n version?: string | null;\n versionMatchType?: VersionMatchType | null;\n visitorType?: VisitorType | null;\n count?: number | null;\n unitOfTime?: TimeUnit | null;\n title?: string | null;\n url?: string | null;\n goalId?: number | null;\n sdkLanguage?: SdkLanguageType | null;\n visitorCode?: string | null;\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/targeting/conditions/types.ts"],"sourcesContent":["import { Result } from 'ts-res';\nimport { SdkLanguageType } from 'src/constants';\nimport { BrowserType, DeviceType } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport {\n EvaluationDataType,\n MatchType,\n MatchTypeTest,\n MatchTypeVariation,\n NameMatchType,\n TargetingType,\n ValueMatchType,\n VersionMatchType,\n VisitorType,\n} from 'src/targeting/types';\nimport { OperatingSystemType } from 'src/kameleoonData/types';\nimport { TimeUnit } from 'src/utilities';\n\nexport interface ICondition {\n evaluate: (data: EvaluationDataType) => Result<boolean, KameleoonError>;\n}\n\nexport type ConditionType = ICondition;\n\nexport type ConditionDataType = {\n id: number;\n targetingType: TargetingType;\n isInclude: boolean | null;\n weight: number;\n customDataIndex?: string | null;\n pageCount?: number | null;\n value?: string | null;\n valueMatchType?: ValueMatchType | null;\n experiment?: number | null;\n variation?: number | null;\n visitCount?: number | null;\n variationKey?: string | null;\n featureFlagId?: number | null;\n ruleId?: number | null;\n variationMatchType?: MatchTypeVariation | null;\n testMatchType?: MatchTypeTest | null;\n matchType?: MatchType | null;\n device?: DeviceType | null;\n browser?: BrowserType | null;\n os?: OperatingSystemType | null;\n name?: string | null;\n nameMatchType?: NameMatchType | null;\n country?: string | null;\n region?: string | null;\n city?: string | null;\n segmentId?: number | null;\n version?: string | null;\n versionMatchType?: VersionMatchType | null;\n visitorType?: VisitorType | null;\n count?: number | null;\n unitOfTime?: TimeUnit | null;\n title?: string | null;\n url?: string | null;\n goalId?: number | null;\n sdkLanguage?: SdkLanguageType | null;\n visitorCode?: string | null;\n lowerBound?: number;\n upperBound?: number;\n keyMomentId?: number;\n};\n"],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Visits=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_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 Visits{constructor(a){let{matchType:b,visitCount:c}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=b,this.conditionValue=c}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);let d=0;const{previousVisits:e,currentVisit:f}=c;return d+=e.length,f&&d++,(0,_tsRes.Ok)(this.checkCondition(d))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.EQUAL:return a===this.conditionValue;case _types.MatchType.GREATER:return a>this.conditionValue;case _types.MatchType.LOWER:return a<this.conditionValue;default:return!1}}}exports.Visits=Visits;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Visits=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_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 Visits{constructor(a){let{matchType:b,visitCount:c}=a;_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),this.matchType=b,this.conditionValue=c}evaluate(a){let{targetingData:b}=a;const c=null===b||void 0===b?void 0:b[_kameleoonData.KameleoonData.VisitsData];if(!c)return(0,_tsRes.Ok)(!1);const d=c.visits.length+1;return(0,_tsRes.Ok)(this.checkCondition(d))}checkCondition(a){if(!this.matchType||"number"!=typeof this.conditionValue)return!1;switch(this.matchType){case _types.MatchType.EQUAL:return a===this.conditionValue;case _types.MatchType.GREATER:return a>this.conditionValue;case _types.MatchType.LOWER:return a<this.conditionValue;default:return!1}}}exports.Visits=Visits;
2
2
  //# sourceMappingURL=visits.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"visits.js","names":["Visits","constructor","a","matchType","visitCount","_defineProperty","conditionValue","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","visits","previousVisits","currentVisit","length","checkCondition","visitsAmount","MatchType","EQUAL","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/visits.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class Visits implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n\n constructor({ matchType, visitCount }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = visitCount;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n let visits = 0;\n\n const { previousVisits, currentVisit } = visitsData;\n\n visits += previousVisits.length;\n\n if (currentVisit) {\n visits++;\n }\n\n return Ok(this.checkCondition(visits));\n }\n\n private checkCondition(visitsAmount: number): boolean {\n if (!this.matchType || typeof this.conditionValue !== 'number') {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.EQUAL:\n return visitsAmount === this.conditionValue;\n case MatchType.GREATER:\n return visitsAmount > this.conditionValue;\n case MatchType.LOWER:\n return visitsAmount < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"msBAMO,KAAM,CAAAA,MAA6B,CAIxCC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,SAAS,CAATA,CAAS,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAF,CAAA,CAAAG,eAAA,0BAAAA,eAAA,+BACtD,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGF,CACxB,CAEOG,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,CAACF,CAAU,CACb,MAAO,GAAAG,SAAE,IAAM,CAAC,CAGlB,GAAI,CAAAC,CAAM,CAAG,CAAC,CAEd,KAAM,CAAEC,cAAc,CAAdA,CAAc,CAAEC,YAAY,CAAZA,CAAa,CAAC,CAAGN,CAAU,CAQnD,MANA,CAAAI,CAAM,EAAIC,CAAc,CAACE,MAAM,CAE3BD,CAAY,EACdF,CAAM,EAAE,CAGH,GAAAD,SAAE,EAAC,IAAI,CAACK,cAAc,CAACJ,CAAM,CAAC,CACvC,CAEQI,cAAcA,CAACC,CAAoB,CAAW,CACpD,GAAI,CAAC,IAAI,CAACf,SAAS,EAAmC,QAAQ,EAAvC,MAAO,KAAI,CAACG,cAA2B,CAC5D,SAGF,OAAQ,IAAI,CAACH,SAAS,EACpB,IAAK,CAAAgB,gBAAS,CAACC,KAAK,CAClB,MAAO,CAAAF,CAAY,GAAK,IAAI,CAACZ,cAAc,CAC7C,IAAK,CAAAa,gBAAS,CAACE,OAAO,CACpB,MAAO,CAAAH,CAAY,CAAG,IAAI,CAACZ,cAAc,CAC3C,IAAK,CAAAa,gBAAS,CAACG,KAAK,CAClB,MAAO,CAAAJ,CAAY,CAAG,IAAI,CAACZ,cAAc,CAC3C,QACE,QACJ,CACF,CACF,CAACiB,OAAA,CAAAvB,MAAA,CAAAA,MAAA"}
1
+ {"version":3,"file":"visits.js","names":["Visits","constructor","a","matchType","visitCount","_defineProperty","conditionValue","evaluate","targetingData","visitsData","KameleoonData","VisitsData","Ok","visits","length","checkCondition","visitsAmount","MatchType","EQUAL","GREATER","LOWER","exports"],"sources":["../../../src/targeting/conditions/visits.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonData } from 'src/kameleoonData';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { EvaluationDataType, MatchType } from 'src/targeting/types';\nimport { ConditionDataType, ICondition } from './types';\n\nexport class Visits implements ICondition {\n private matchType?: MatchType | null;\n private conditionValue?: number | null;\n\n constructor({ matchType, visitCount }: ConditionDataType) {\n this.matchType = matchType;\n this.conditionValue = visitCount;\n }\n\n public evaluate({\n targetingData,\n }: EvaluationDataType): Result<boolean, KameleoonError> {\n const visitsData = targetingData?.[KameleoonData.VisitsData];\n\n if (!visitsData) {\n return Ok(false);\n }\n\n // --- Note ---\n // +1 is current visit\n const visits = visitsData.visits.length + 1;\n\n return Ok(this.checkCondition(visits));\n }\n\n private checkCondition(visitsAmount: number): boolean {\n if (!this.matchType || typeof this.conditionValue !== 'number') {\n return false;\n }\n\n switch (this.matchType) {\n case MatchType.EQUAL:\n return visitsAmount === this.conditionValue;\n case MatchType.GREATER:\n return visitsAmount > this.conditionValue;\n case MatchType.LOWER:\n return visitsAmount < this.conditionValue;\n default:\n return false;\n }\n }\n}\n"],"mappings":"msBAMO,KAAM,CAAAA,MAA6B,CAIxCC,WAAWA,CAAAC,CAAA,CAA+C,IAA9C,CAAEC,SAAS,CAATA,CAAS,CAAEC,UAAU,CAAVA,CAA8B,CAAC,CAAAF,CAAA,CAAAG,eAAA,0BAAAA,eAAA,+BACtD,IAAI,CAACF,SAAS,CAAGA,CAAS,CAC1B,IAAI,CAACG,cAAc,CAAGF,CACxB,CAEOG,QAAQA,CAAAL,CAAA,CAEyC,IAFxC,CACdM,aAAa,CAAbA,CACkB,CAAC,CAAAN,CAAA,CACnB,KAAM,CAAAO,CAAU,QAAGD,CAAa,WAAbA,CAAa,QAAbA,CAAa,CAAGE,4BAAa,CAACC,UAAU,CAAC,CAE5D,GAAI,CAACF,CAAU,CACb,MAAO,GAAAG,SAAE,IAAM,CAAC,CAKlB,KAAM,CAAAC,CAAM,CAAGJ,CAAU,CAACI,MAAM,CAACC,MAAM,CAAG,CAAC,CAE3C,MAAO,GAAAF,SAAE,EAAC,IAAI,CAACG,cAAc,CAACF,CAAM,CAAC,CACvC,CAEQE,cAAcA,CAACC,CAAoB,CAAW,CACpD,GAAI,CAAC,IAAI,CAACb,SAAS,EAAmC,QAAQ,EAAvC,MAAO,KAAI,CAACG,cAA2B,CAC5D,SAGF,OAAQ,IAAI,CAACH,SAAS,EACpB,IAAK,CAAAc,gBAAS,CAACC,KAAK,CAClB,MAAO,CAAAF,CAAY,GAAK,IAAI,CAACV,cAAc,CAC7C,IAAK,CAAAW,gBAAS,CAACE,OAAO,CACpB,MAAO,CAAAH,CAAY,CAAG,IAAI,CAACV,cAAc,CAC3C,IAAK,CAAAW,gBAAS,CAACG,KAAK,CAClB,MAAO,CAAAJ,CAAY,CAAG,IAAI,CAACV,cAAc,CAC3C,QACE,QACJ,CACF,CACF,CAACe,OAAA,CAAArB,MAAA,CAAAA,MAAA"}
@@ -1,3 +1,3 @@
1
1
  export { Tree } from './tree';
2
- export { Operator, TargetingType, SegmentType, TargetingDataType, EvaluationDataType, ValueMatchType, MatchTypeVariation, MatchType, VersionMatchType, } from './types';
3
- export { CustomData, ExclusiveCampaign, Browser, PageUrl, PageTitle, Conversion, VisitorCode, SdkLanguage, Device, PreviousPage, VisitedPages, ConditionFactory, TargetFeatureFlag, Cookie, GeolocationCondition, OperatingSystem, Segment, FirstVisit, LastVisit, SameDayVisits, Visits, NewVisitor, } from './conditions';
2
+ export { Operator, TargetingType, SegmentType, TargetingDataType, EvaluationDataType, ValueMatchType, MatchTypeVariation, MatchType, VersionMatchType, VisitorReference, DereferencedTargetingDataType, } from './types';
3
+ export { CustomData, ExclusiveCampaign, Browser, PageUrl, PageTitle, Conversion, VisitorCode, SdkLanguage, Device, PreviousPage, VisitedPages, ConditionFactory, TargetFeatureFlag, Cookie, GeolocationCondition, OperatingSystem, Segment, FirstVisit, LastVisit, SameDayVisits, Visits, ConversionLikelihood, NewVisitor, } from './conditions';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _conditions.Browser}}),Object.defineProperty(exports,"ConditionFactory",{enumerable:!0,get:function(){return _conditions.ConditionFactory}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conditions.Conversion}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _conditions.Cookie}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _conditions.CustomData}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _conditions.Device}}),Object.defineProperty(exports,"EvaluationDataType",{enumerable:!0,get:function(){return _types.EvaluationDataType}}),Object.defineProperty(exports,"ExclusiveCampaign",{enumerable:!0,get:function(){return _conditions.ExclusiveCampaign}}),Object.defineProperty(exports,"FirstVisit",{enumerable:!0,get:function(){return _conditions.FirstVisit}}),Object.defineProperty(exports,"GeolocationCondition",{enumerable:!0,get:function(){return _conditions.GeolocationCondition}}),Object.defineProperty(exports,"LastVisit",{enumerable:!0,get:function(){return _conditions.LastVisit}}),Object.defineProperty(exports,"MatchType",{enumerable:!0,get:function(){return _types.MatchType}}),Object.defineProperty(exports,"MatchTypeVariation",{enumerable:!0,get:function(){return _types.MatchTypeVariation}}),Object.defineProperty(exports,"NewVisitor",{enumerable:!0,get:function(){return _conditions.NewVisitor}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _conditions.OperatingSystem}}),Object.defineProperty(exports,"Operator",{enumerable:!0,get:function(){return _types.Operator}}),Object.defineProperty(exports,"PageTitle",{enumerable:!0,get:function(){return _conditions.PageTitle}}),Object.defineProperty(exports,"PageUrl",{enumerable:!0,get:function(){return _conditions.PageUrl}}),Object.defineProperty(exports,"PreviousPage",{enumerable:!0,get:function(){return _conditions.PreviousPage}}),Object.defineProperty(exports,"SameDayVisits",{enumerable:!0,get:function(){return _conditions.SameDayVisits}}),Object.defineProperty(exports,"SdkLanguage",{enumerable:!0,get:function(){return _conditions.SdkLanguage}}),Object.defineProperty(exports,"Segment",{enumerable:!0,get:function(){return _conditions.Segment}}),Object.defineProperty(exports,"SegmentType",{enumerable:!0,get:function(){return _types.SegmentType}}),Object.defineProperty(exports,"TargetFeatureFlag",{enumerable:!0,get:function(){return _conditions.TargetFeatureFlag}}),Object.defineProperty(exports,"TargetingDataType",{enumerable:!0,get:function(){return _types.TargetingDataType}}),Object.defineProperty(exports,"TargetingType",{enumerable:!0,get:function(){return _types.TargetingType}}),Object.defineProperty(exports,"Tree",{enumerable:!0,get:function(){return _tree.Tree}}),Object.defineProperty(exports,"ValueMatchType",{enumerable:!0,get:function(){return _types.ValueMatchType}}),Object.defineProperty(exports,"VersionMatchType",{enumerable:!0,get:function(){return _types.VersionMatchType}}),Object.defineProperty(exports,"VisitedPages",{enumerable:!0,get:function(){return _conditions.VisitedPages}}),Object.defineProperty(exports,"VisitorCode",{enumerable:!0,get:function(){return _conditions.VisitorCode}}),Object.defineProperty(exports,"Visits",{enumerable:!0,get:function(){return _conditions.Visits}});var _tree=require("./tree"),_types=require("./types"),_conditions=require("./conditions");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _conditions.Browser}}),Object.defineProperty(exports,"ConditionFactory",{enumerable:!0,get:function(){return _conditions.ConditionFactory}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conditions.Conversion}}),Object.defineProperty(exports,"ConversionLikelihood",{enumerable:!0,get:function(){return _conditions.ConversionLikelihood}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _conditions.Cookie}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _conditions.CustomData}}),Object.defineProperty(exports,"DereferencedTargetingDataType",{enumerable:!0,get:function(){return _types.DereferencedTargetingDataType}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _conditions.Device}}),Object.defineProperty(exports,"EvaluationDataType",{enumerable:!0,get:function(){return _types.EvaluationDataType}}),Object.defineProperty(exports,"ExclusiveCampaign",{enumerable:!0,get:function(){return _conditions.ExclusiveCampaign}}),Object.defineProperty(exports,"FirstVisit",{enumerable:!0,get:function(){return _conditions.FirstVisit}}),Object.defineProperty(exports,"GeolocationCondition",{enumerable:!0,get:function(){return _conditions.GeolocationCondition}}),Object.defineProperty(exports,"LastVisit",{enumerable:!0,get:function(){return _conditions.LastVisit}}),Object.defineProperty(exports,"MatchType",{enumerable:!0,get:function(){return _types.MatchType}}),Object.defineProperty(exports,"MatchTypeVariation",{enumerable:!0,get:function(){return _types.MatchTypeVariation}}),Object.defineProperty(exports,"NewVisitor",{enumerable:!0,get:function(){return _conditions.NewVisitor}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _conditions.OperatingSystem}}),Object.defineProperty(exports,"Operator",{enumerable:!0,get:function(){return _types.Operator}}),Object.defineProperty(exports,"PageTitle",{enumerable:!0,get:function(){return _conditions.PageTitle}}),Object.defineProperty(exports,"PageUrl",{enumerable:!0,get:function(){return _conditions.PageUrl}}),Object.defineProperty(exports,"PreviousPage",{enumerable:!0,get:function(){return _conditions.PreviousPage}}),Object.defineProperty(exports,"SameDayVisits",{enumerable:!0,get:function(){return _conditions.SameDayVisits}}),Object.defineProperty(exports,"SdkLanguage",{enumerable:!0,get:function(){return _conditions.SdkLanguage}}),Object.defineProperty(exports,"Segment",{enumerable:!0,get:function(){return _conditions.Segment}}),Object.defineProperty(exports,"SegmentType",{enumerable:!0,get:function(){return _types.SegmentType}}),Object.defineProperty(exports,"TargetFeatureFlag",{enumerable:!0,get:function(){return _conditions.TargetFeatureFlag}}),Object.defineProperty(exports,"TargetingDataType",{enumerable:!0,get:function(){return _types.TargetingDataType}}),Object.defineProperty(exports,"TargetingType",{enumerable:!0,get:function(){return _types.TargetingType}}),Object.defineProperty(exports,"Tree",{enumerable:!0,get:function(){return _tree.Tree}}),Object.defineProperty(exports,"ValueMatchType",{enumerable:!0,get:function(){return _types.ValueMatchType}}),Object.defineProperty(exports,"VersionMatchType",{enumerable:!0,get:function(){return _types.VersionMatchType}}),Object.defineProperty(exports,"VisitedPages",{enumerable:!0,get:function(){return _conditions.VisitedPages}}),Object.defineProperty(exports,"VisitorCode",{enumerable:!0,get:function(){return _conditions.VisitorCode}}),Object.defineProperty(exports,"VisitorReference",{enumerable:!0,get:function(){return _types.VisitorReference}}),Object.defineProperty(exports,"Visits",{enumerable:!0,get:function(){return _conditions.Visits}});var _tree=require("./tree"),_types=require("./types"),_conditions=require("./conditions");
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/targeting/index.ts"],"sourcesContent":["export { Tree } from './tree';\nexport {\n Operator,\n TargetingType,\n SegmentType,\n TargetingDataType,\n EvaluationDataType,\n ValueMatchType,\n MatchTypeVariation,\n MatchType,\n VersionMatchType,\n} from './types';\nexport {\n CustomData,\n ExclusiveCampaign,\n Browser,\n PageUrl,\n PageTitle,\n Conversion,\n VisitorCode,\n SdkLanguage,\n Device,\n PreviousPage,\n VisitedPages,\n ConditionFactory,\n TargetFeatureFlag,\n Cookie,\n GeolocationCondition,\n OperatingSystem,\n Segment,\n FirstVisit,\n LastVisit,\n SameDayVisits,\n Visits,\n NewVisitor,\n} from './conditions';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/targeting/index.ts"],"sourcesContent":["export { Tree } from './tree';\nexport {\n Operator,\n TargetingType,\n SegmentType,\n TargetingDataType,\n EvaluationDataType,\n ValueMatchType,\n MatchTypeVariation,\n MatchType,\n VersionMatchType,\n VisitorReference,\n DereferencedTargetingDataType,\n} from './types';\nexport {\n CustomData,\n ExclusiveCampaign,\n Browser,\n PageUrl,\n PageTitle,\n Conversion,\n VisitorCode,\n SdkLanguage,\n Device,\n PreviousPage,\n VisitedPages,\n ConditionFactory,\n TargetFeatureFlag,\n Cookie,\n GeolocationCondition,\n OperatingSystem,\n Segment,\n FirstVisit,\n LastVisit,\n SameDayVisits,\n Visits,\n ConversionLikelihood,\n NewVisitor,\n} from './conditions';\n"],"mappings":""}
@@ -40,7 +40,11 @@ export type GroupedSegmentsType = {
40
40
  topLevelOperators: Operator[];
41
41
  nestedConditions: NestedConditionGroupType[];
42
42
  };
43
+ export type VisitorReference = string;
43
44
  export type TargetingDataType = {
45
+ [visitorCode: string]: KameleoonVisitorDataType | VisitorReference;
46
+ };
47
+ export type DereferencedTargetingDataType = {
44
48
  [visitorCode: string]: KameleoonVisitorDataType;
45
49
  };
46
50
  export type EvaluationDataType = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["Operator","exports","And","Or","ValueMatchType","TRUE","FALSE","EXACT","CONTAINS","REGULAR_EXPRESSION","EQUAL","LOWER","GREATER","UNDEFINED","AMONG_VALUES","VisitorType","NEW","RETURNING","MatchTypeVariation","ANY","MatchTypeTest","ALL","TEST","PERSO","MatchType","VersionMatchType","NameMatchType","OPTIONAL","TargetingType","PAGE_URL","PAGE_TITLE","LANDING_PAGE","ORIGIN","ORIGIN_TYPE","REFERRERS","NEW_VISITORS","INTERESTS","BROWSER_LANGUAGE","GEOLOCATION","DEVICE_TYPE","SCREEN_DIMENSION","VISITOR_IP","AD_BLOCKER","PREVIOUS_PAGE","KEY_PAGES","PAGE_VIEWS","FIRST_VISIT","LAST_VISIT","ACTIVE_SESSION","TIME_SINCE_PAGE_LOAD","SAME_DAY_VISITS","VISITS","VISITS_BY_PAGE","VISITOR_CODE","SDK_LANGUAGE","INTERNAL_SEARCH_KEYWORDS","TABS_ON_SITE","CONVERSION_PROBABILITY","HEAT_SLICE","SKY_STATUS","TEMPERATURE","DAY_NIGHT","FORECAST_SKY_STATUS","FORECAST_TEMPERATURE","DAY_OF_WEEK","TIME_RANGE","HOUR_MINUTE_RANGE","JS_CODE","COOKIE","EVENT","BROWSER","OPERATING_SYSTEM","DOM_ELEMENT","MOUSE_OUT","TARGET_EXPERIMENT","TARGET_FEATURE_FLAG","TARGET_PERSONALIZATION","EXCLUSIVE_EXPERIMENT","EXCLUSIVE_FEATURE_FLAG","CONVERSIONS","CUSTOM_DATUM","YSANCE_SEGMENT","SEGMENT","YSANCE_ATTRIBUT","TEALIUM_BADGE","TEALIUM_AUDIENCE","PRICE_OF_DISPLAYED_PAGE","NUMBER_OF_VISITED_PAGES","VISITED_PAGES","CUSTOM","EXPLICIT_TRIGGER","APPLICATION_VERSION"],"sources":["../../src/targeting/types.ts"],"sourcesContent":["import { MappedRuleType } from 'src/clientConfiguration/types';\nimport { KameleoonVisitorDataType } from 'src/kameleoonData/types';\nimport { FeatureFlagVariationsType } from 'src/storage/types';\nimport { ExternalPackageInfoType } from 'src/types';\nimport { ConditionDataType, ConditionType } from './conditions';\nimport { Node } from './node';\nimport { Tree } from './tree';\n\nexport enum Operator {\n And = 'AND',\n Or = 'OR',\n}\n\nexport type NonLeafNodeType = {\n left: Node;\n right: Node;\n value: Operator;\n};\n\nexport type LeafNodeType = {\n left: undefined;\n right: undefined;\n value: ConditionType;\n};\n\nexport type NodeValueType = ConditionType | Operator;\n\nexport type ConditionLevelType = {\n orOperators: boolean[];\n conditions: ConditionDataType[];\n};\n\nexport type SegmentType = {\n id: string;\n name: string;\n conditionsData: {\n firstLevelOrOperators: boolean[];\n firstLevel: ConditionLevelType[];\n };\n};\n\nexport type NestedConditionGroupType = {\n operators: Operator[];\n conditions: ConditionDataType[];\n};\n\nexport type GroupedSegmentsType = {\n topLevelOperators: Operator[];\n nestedConditions: NestedConditionGroupType[];\n};\n\nexport type TargetingDataType = {\n [visitorCode: string]: KameleoonVisitorDataType;\n};\n\nexport type EvaluationDataType = {\n targetingData?: KameleoonVisitorDataType;\n variationData: FeatureFlagVariationsType;\n ruleMap?: Map<number, MappedRuleType>;\n sdkInfo: ExternalPackageInfoType;\n experimentId: number | null;\n visitorCode: string;\n segments?: Map<string, SegmentType>;\n trees?: Map<string, Tree>;\n};\n\nexport enum ValueMatchType {\n TRUE = 'TRUE',\n FALSE = 'FALSE',\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n GREATER = 'GREATER',\n UNDEFINED = 'UNDEFINED',\n AMONG_VALUES = 'AMONG_VALUES',\n}\n\nexport enum VisitorType {\n NEW = 'NEW',\n RETURNING = 'RETURNING',\n}\n\nexport enum MatchTypeVariation {\n ANY = 'ANY',\n EXACT = 'EXACT',\n}\n\nexport enum MatchTypeTest {\n ALL = 'ALL',\n TEST = 'TEST',\n PERSO = 'PERSO',\n}\n\n// --- Note ---\n// Starting the merge of `matchType` with the release of new conditions\n// Now it contains a couple of sub types, in future API version all match types\n// will be accumulated in this enum\nexport enum MatchType {\n // -- Sub Type One\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n // -- Sub Type Two\n GREATER = 'GREATER',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n}\n\nexport enum VersionMatchType {\n GREATER = 'GREATER',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n}\n\nexport enum NameMatchType {\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n OPTIONAL = 'OPTIONAL',\n}\n\nexport enum TargetingType {\n PAGE_URL = 'PAGE_URL',\n PAGE_TITLE = 'PAGE_TITLE',\n LANDING_PAGE = 'LANDING_PAGE',\n ORIGIN = 'ORIGIN',\n ORIGIN_TYPE = 'ORIGIN_TYPE',\n REFERRERS = 'REFERRERS',\n NEW_VISITORS = 'NEW_VISITORS',\n INTERESTS = 'INTERESTS',\n BROWSER_LANGUAGE = 'BROWSER_LANGUAGE',\n GEOLOCATION = 'GEOLOCATION',\n DEVICE_TYPE = 'DEVICE_TYPE',\n SCREEN_DIMENSION = 'SCREEN_DIMENSION',\n VISITOR_IP = 'VISITOR_IP',\n AD_BLOCKER = 'AD_BLOCKER',\n PREVIOUS_PAGE = 'PREVIOUS_PAGE',\n KEY_PAGES = 'KEY_PAGES',\n PAGE_VIEWS = 'PAGE_VIEWS',\n FIRST_VISIT = 'FIRST_VISIT',\n LAST_VISIT = 'LAST_VISIT',\n ACTIVE_SESSION = 'ACTIVE_SESSION',\n TIME_SINCE_PAGE_LOAD = 'TIME_SINCE_PAGE_LOAD',\n SAME_DAY_VISITS = 'SAME_DAY_VISITS',\n VISITS = 'VISITS',\n VISITS_BY_PAGE = 'VISITS_BY_PAGE',\n VISITOR_CODE = 'VISITOR_CODE',\n SDK_LANGUAGE = 'SDK_LANGUAGE',\n INTERNAL_SEARCH_KEYWORDS = 'INTERNAL_SEARCH_KEYWORDS',\n TABS_ON_SITE = 'TABS_ON_SITE',\n CONVERSION_PROBABILITY = 'CONVERSION_PROBABILITY',\n HEAT_SLICE = 'HEAT_SLICE',\n SKY_STATUS = 'SKY_STATUS',\n TEMPERATURE = 'TEMPERATURE',\n DAY_NIGHT = 'DAY_NIGHT',\n FORECAST_SKY_STATUS = 'FORECAST_SKY_STATUS',\n FORECAST_TEMPERATURE = 'FORECAST_TEMPERATURE',\n DAY_OF_WEEK = 'DAY_OF_WEEK',\n TIME_RANGE = 'TIME_RANGE',\n HOUR_MINUTE_RANGE = 'HOUR_MINUTE_RANGE',\n JS_CODE = 'JS_CODE',\n COOKIE = 'COOKIE',\n EVENT = 'EVENT',\n BROWSER = 'BROWSER',\n OPERATING_SYSTEM = 'OPERATING_SYSTEM',\n DOM_ELEMENT = 'DOM_ELEMENT',\n MOUSE_OUT = 'MOUSE_OUT',\n TARGET_EXPERIMENT = 'TARGET_EXPERIMENT',\n TARGET_FEATURE_FLAG = 'TARGET_FEATURE_FLAG',\n TARGET_PERSONALIZATION = 'TARGET_PERSONALIZATION',\n EXCLUSIVE_EXPERIMENT = 'EXCLUSIVE_EXPERIMENT',\n EXCLUSIVE_FEATURE_FLAG = 'EXCLUSIVE_FEATURE_FLAG',\n CONVERSIONS = 'CONVERSIONS',\n CUSTOM_DATUM = 'CUSTOM_DATUM',\n YSANCE_SEGMENT = 'YSANCE_SEGMENT',\n SEGMENT = 'SEGMENT',\n YSANCE_ATTRIBUT = 'YSANCE_ATTRIBUT',\n TEALIUM_BADGE = 'TEALIUM_BADGE',\n TEALIUM_AUDIENCE = 'TEALIUM_AUDIENCE',\n PRICE_OF_DISPLAYED_PAGE = 'PRICE_OF_DISPLAYED_PAGE',\n NUMBER_OF_VISITED_PAGES = 'NUMBER_OF_VISITED_PAGES',\n VISITED_PAGES = 'VISITED_PAGES',\n CUSTOM = 'CUSTOM',\n EXPLICIT_TRIGGER = 'EXPLICIT_TRIGGER',\n APPLICATION_VERSION = 'APPLICATION_VERSION',\n}\n"],"mappings":"kRAQY,CAAAA,QAAQ,CAAAC,OAAA,CAAAD,QAAA,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAE,GAAA,OAARF,CAAQ,CAAAG,EAAA,MAARH,CAAQ,MA0DRI,cAAc,CAAAH,OAAA,CAAAG,cAAA,UAAdA,CAAc,QAAd,CAAAA,CAAc,CAAAC,IAAA,QAAdD,CAAc,CAAAE,KAAA,SAAdF,CAAc,CAAAG,KAAA,SAAdH,CAAc,CAA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AAA,WAAb1C,CAAa,CAAA2C,gBAAA,oBAAb3C,CAAa,CAAA4C,WAAA,eAAb5C,CAAa,CAAA6C,SAAA,aAAb7C,CAAa,CAAA8C,iBAAA,qBAAb9C,CAAa,CAAA+C,mBAAA,uBAAb/C,CAAa,CAAAgD,sBAAA,0BAAbhD,CAAa,CAAAiD,oBAAA,wBAAbjD,CAAa,CAAAkD,sBAAA,0BAAblD,CAAa,CAAAmD,WAAA,eAAbnD,CAAa,CAAAoD,YAAA,gBAAbpD,CAAa,CAAAqD,cAAA,kBAAbrD,CAAa,CAAAsD,OAAA,WAAbtD,CAAa,CAAAuD,eAAA,mBAAbvD,CAAa,CAAAwD,aAAA,iBAAbxD,CAAa,CAAAyD,gBAAA,oBAAbzD,CAAa,CAAA0D,uBAAA,2BAAb1D,CAAa,CAAA2D,uBAAA,2BAAb3D,CAAa,CAAA4D,aAAA,iBAAb5D,CAAa,CAAA6D,MAAA,UAAb7D,CAAa,CAAA8D,gBAAA,oBAAb9D,CAAa,CAAA+D,mBAAA,uBAAb/D,CAAa"}
1
+ {"version":3,"file":"types.js","names":["Operator","exports","And","Or","ValueMatchType","TRUE","FALSE","EXACT","CONTAINS","REGULAR_EXPRESSION","EQUAL","LOWER","GREATER","UNDEFINED","AMONG_VALUES","VisitorType","NEW","RETURNING","MatchTypeVariation","ANY","MatchTypeTest","ALL","TEST","PERSO","MatchType","VersionMatchType","NameMatchType","OPTIONAL","TargetingType","PAGE_URL","PAGE_TITLE","LANDING_PAGE","ORIGIN","ORIGIN_TYPE","REFERRERS","NEW_VISITORS","INTERESTS","BROWSER_LANGUAGE","GEOLOCATION","DEVICE_TYPE","SCREEN_DIMENSION","VISITOR_IP","AD_BLOCKER","PREVIOUS_PAGE","KEY_PAGES","PAGE_VIEWS","FIRST_VISIT","LAST_VISIT","ACTIVE_SESSION","TIME_SINCE_PAGE_LOAD","SAME_DAY_VISITS","VISITS","VISITS_BY_PAGE","VISITOR_CODE","SDK_LANGUAGE","INTERNAL_SEARCH_KEYWORDS","TABS_ON_SITE","CONVERSION_PROBABILITY","HEAT_SLICE","SKY_STATUS","TEMPERATURE","DAY_NIGHT","FORECAST_SKY_STATUS","FORECAST_TEMPERATURE","DAY_OF_WEEK","TIME_RANGE","HOUR_MINUTE_RANGE","JS_CODE","COOKIE","EVENT","BROWSER","OPERATING_SYSTEM","DOM_ELEMENT","MOUSE_OUT","TARGET_EXPERIMENT","TARGET_FEATURE_FLAG","TARGET_PERSONALIZATION","EXCLUSIVE_EXPERIMENT","EXCLUSIVE_FEATURE_FLAG","CONVERSIONS","CUSTOM_DATUM","YSANCE_SEGMENT","SEGMENT","YSANCE_ATTRIBUT","TEALIUM_BADGE","TEALIUM_AUDIENCE","PRICE_OF_DISPLAYED_PAGE","NUMBER_OF_VISITED_PAGES","VISITED_PAGES","CUSTOM","EXPLICIT_TRIGGER","APPLICATION_VERSION"],"sources":["../../src/targeting/types.ts"],"sourcesContent":["import { MappedRuleType } from 'src/clientConfiguration/types';\nimport { KameleoonVisitorDataType } from 'src/kameleoonData/types';\nimport { FeatureFlagVariationsType } from 'src/storage/types';\nimport { ExternalPackageInfoType } from 'src/types';\nimport { ConditionDataType, ConditionType } from './conditions';\nimport { Node } from './node';\nimport { Tree } from './tree';\n\nexport enum Operator {\n And = 'AND',\n Or = 'OR',\n}\n\nexport type NonLeafNodeType = {\n left: Node;\n right: Node;\n value: Operator;\n};\n\nexport type LeafNodeType = {\n left: undefined;\n right: undefined;\n value: ConditionType;\n};\n\nexport type NodeValueType = ConditionType | Operator;\n\nexport type ConditionLevelType = {\n orOperators: boolean[];\n conditions: ConditionDataType[];\n};\n\nexport type SegmentType = {\n id: string;\n name: string;\n conditionsData: {\n firstLevelOrOperators: boolean[];\n firstLevel: ConditionLevelType[];\n };\n};\n\nexport type NestedConditionGroupType = {\n operators: Operator[];\n conditions: ConditionDataType[];\n};\n\nexport type GroupedSegmentsType = {\n topLevelOperators: Operator[];\n nestedConditions: NestedConditionGroupType[];\n};\n\nexport type VisitorReference = string;\n\nexport type TargetingDataType = {\n [visitorCode: string]: KameleoonVisitorDataType | VisitorReference;\n};\n\nexport type DereferencedTargetingDataType = {\n [visitorCode: string]: KameleoonVisitorDataType;\n};\n\nexport type EvaluationDataType = {\n targetingData?: KameleoonVisitorDataType;\n variationData: FeatureFlagVariationsType;\n ruleMap?: Map<number, MappedRuleType>;\n sdkInfo: ExternalPackageInfoType;\n experimentId: number | null;\n visitorCode: string;\n segments?: Map<string, SegmentType>;\n trees?: Map<string, Tree>;\n};\n\nexport enum ValueMatchType {\n TRUE = 'TRUE',\n FALSE = 'FALSE',\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n GREATER = 'GREATER',\n UNDEFINED = 'UNDEFINED',\n AMONG_VALUES = 'AMONG_VALUES',\n}\n\nexport enum VisitorType {\n NEW = 'NEW',\n RETURNING = 'RETURNING',\n}\n\nexport enum MatchTypeVariation {\n ANY = 'ANY',\n EXACT = 'EXACT',\n}\n\nexport enum MatchTypeTest {\n ALL = 'ALL',\n TEST = 'TEST',\n PERSO = 'PERSO',\n}\n\n// --- Note ---\n// Starting the merge of `matchType` with the release of new conditions\n// Now it contains a couple of sub types, in future API version all match types\n// will be accumulated in this enum\nexport enum MatchType {\n // -- Sub Type One\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n // -- Sub Type Two\n GREATER = 'GREATER',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n}\n\nexport enum VersionMatchType {\n GREATER = 'GREATER',\n EQUAL = 'EQUAL',\n LOWER = 'LOWER',\n}\n\nexport enum NameMatchType {\n EXACT = 'EXACT',\n CONTAINS = 'CONTAINS',\n REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',\n OPTIONAL = 'OPTIONAL',\n}\n\nexport enum TargetingType {\n PAGE_URL = 'PAGE_URL',\n PAGE_TITLE = 'PAGE_TITLE',\n LANDING_PAGE = 'LANDING_PAGE',\n ORIGIN = 'ORIGIN',\n ORIGIN_TYPE = 'ORIGIN_TYPE',\n REFERRERS = 'REFERRERS',\n NEW_VISITORS = 'NEW_VISITORS',\n INTERESTS = 'INTERESTS',\n BROWSER_LANGUAGE = 'BROWSER_LANGUAGE',\n GEOLOCATION = 'GEOLOCATION',\n DEVICE_TYPE = 'DEVICE_TYPE',\n SCREEN_DIMENSION = 'SCREEN_DIMENSION',\n VISITOR_IP = 'VISITOR_IP',\n AD_BLOCKER = 'AD_BLOCKER',\n PREVIOUS_PAGE = 'PREVIOUS_PAGE',\n KEY_PAGES = 'KEY_PAGES',\n PAGE_VIEWS = 'PAGE_VIEWS',\n FIRST_VISIT = 'FIRST_VISIT',\n LAST_VISIT = 'LAST_VISIT',\n ACTIVE_SESSION = 'ACTIVE_SESSION',\n TIME_SINCE_PAGE_LOAD = 'TIME_SINCE_PAGE_LOAD',\n SAME_DAY_VISITS = 'SAME_DAY_VISITS',\n VISITS = 'VISITS',\n VISITS_BY_PAGE = 'VISITS_BY_PAGE',\n VISITOR_CODE = 'VISITOR_CODE',\n SDK_LANGUAGE = 'SDK_LANGUAGE',\n INTERNAL_SEARCH_KEYWORDS = 'INTERNAL_SEARCH_KEYWORDS',\n TABS_ON_SITE = 'TABS_ON_SITE',\n CONVERSION_PROBABILITY = 'CONVERSION_PROBABILITY',\n HEAT_SLICE = 'HEAT_SLICE',\n SKY_STATUS = 'SKY_STATUS',\n TEMPERATURE = 'TEMPERATURE',\n DAY_NIGHT = 'DAY_NIGHT',\n FORECAST_SKY_STATUS = 'FORECAST_SKY_STATUS',\n FORECAST_TEMPERATURE = 'FORECAST_TEMPERATURE',\n DAY_OF_WEEK = 'DAY_OF_WEEK',\n TIME_RANGE = 'TIME_RANGE',\n HOUR_MINUTE_RANGE = 'HOUR_MINUTE_RANGE',\n JS_CODE = 'JS_CODE',\n COOKIE = 'COOKIE',\n EVENT = 'EVENT',\n BROWSER = 'BROWSER',\n OPERATING_SYSTEM = 'OPERATING_SYSTEM',\n DOM_ELEMENT = 'DOM_ELEMENT',\n MOUSE_OUT = 'MOUSE_OUT',\n TARGET_EXPERIMENT = 'TARGET_EXPERIMENT',\n TARGET_FEATURE_FLAG = 'TARGET_FEATURE_FLAG',\n TARGET_PERSONALIZATION = 'TARGET_PERSONALIZATION',\n EXCLUSIVE_EXPERIMENT = 'EXCLUSIVE_EXPERIMENT',\n EXCLUSIVE_FEATURE_FLAG = 'EXCLUSIVE_FEATURE_FLAG',\n CONVERSIONS = 'CONVERSIONS',\n CUSTOM_DATUM = 'CUSTOM_DATUM',\n YSANCE_SEGMENT = 'YSANCE_SEGMENT',\n SEGMENT = 'SEGMENT',\n YSANCE_ATTRIBUT = 'YSANCE_ATTRIBUT',\n TEALIUM_BADGE = 'TEALIUM_BADGE',\n TEALIUM_AUDIENCE = 'TEALIUM_AUDIENCE',\n PRICE_OF_DISPLAYED_PAGE = 'PRICE_OF_DISPLAYED_PAGE',\n NUMBER_OF_VISITED_PAGES = 'NUMBER_OF_VISITED_PAGES',\n VISITED_PAGES = 'VISITED_PAGES',\n CUSTOM = 'CUSTOM',\n EXPLICIT_TRIGGER = 'EXPLICIT_TRIGGER',\n APPLICATION_VERSION = 'APPLICATION_VERSION',\n}\n"],"mappings":"kRAQY,CAAAA,QAAQ,CAAAC,OAAA,CAAAD,QAAA,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAE,GAAA,OAARF,CAAQ,CAAAG,EAAA,MAARH,CAAQ,MAgERI,cAAc,CAAAH,OAAA,CAAAG,cAAA,UAAdA,CAAc,QAAd,CAAAA,CAAc,CAAAC,IAAA,QAAdD,CAAc,CAAAE,KAAA,SAAdF,CAAc,CAAAG,KAAA,SAAdH,CAAc,CAAAI,QAAA,YAAdJ,CAAc,CAAAK,kBAAA,sBAAdL,CAAc,CAAAM,KAAA,SAAdN,CAAc,CAAAO,KAAA,SAAdP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