@kameleoon/javascript-sdk-core
Advanced tools
Comparing version 2.8.1 to 2.8.2
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_utilities=require("../../utilities"),_types=require("../types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var CustomDataCondition=/*#__PURE__*/function(){function a(b){var c=b.customDataIndex,d=b.valueMatchType,e=b.value;_classCallCheck(this,a),_defineProperty(this,"customDataIndex",void 0),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"error",void 0),this.customDataIndex=c?+c:null,this.matchType=d,this.conditionValue=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData;if(this.customDataIndex){var c,d=null===b||void 0===b||null===(c=b[_kameleoonData.KameleoonData.CustomData])||void 0===c?void 0:c[this.customDataIndex];if(d){var e=d.value,f=this.checkCondition(e);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(f)}}return(0,_tsRes.Ok)(this.matchType===_types.MatchTypeCustomData.UNDEFINED)}},{key:"checkCondition",value:function checkCondition(a){var b=this;if("string"!=typeof this.conditionValue&&this.matchType!==_types.MatchTypeCustomData.TRUE&&this.matchType!==_types.MatchTypeCustomData.FALSE)return!1;// --- Note --- | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomDataCondition=void 0;var _tsRes=require("ts-res"),_kameleoonData=require("../../kameleoonData"),_kameleoonError=require("../../kameleoonError"),_utilities=require("../../utilities"),_types=require("../types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var CustomDataCondition=/*#__PURE__*/function(){function a(b){var c=b.customDataIndex,d=b.valueMatchType,e=b.value;_classCallCheck(this,a),_defineProperty(this,"customDataIndex",void 0),_defineProperty(this,"matchType",void 0),_defineProperty(this,"conditionValue",void 0),_defineProperty(this,"error",void 0),this.customDataIndex=c?+c:null,this.matchType=d,this.conditionValue=e}return _createClass(a,[{key:"evaluate",value:function evaluate(a){var b=a.targetingData;if("number"==typeof this.customDataIndex){var c,d=null===b||void 0===b||null===(c=b[_kameleoonData.KameleoonData.CustomData])||void 0===c?void 0:c[this.customDataIndex];if(d){var e=d.value,f=this.checkCondition(e);return this.error?(0,_tsRes.Err)(this.error):(0,_tsRes.Ok)(f)}}return(0,_tsRes.Ok)(this.matchType===_types.MatchTypeCustomData.UNDEFINED)}},{key:"checkCondition",value:function checkCondition(a){var b=this;if("string"!=typeof this.conditionValue&&this.matchType!==_types.MatchTypeCustomData.TRUE&&this.matchType!==_types.MatchTypeCustomData.FALSE)return!1;// --- Note --- | ||
// `MatchTypeCustomData.TRUE` and `MatchTypeCustomData.FALSE` do not use condition value | ||
@@ -3,0 +3,0 @@ // so we can safely assume that `this.conditionValue` is a string at this point |
{ | ||
"name": "@kameleoon/javascript-sdk-core", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"description": "Kameleoon JS SDK Core", | ||
@@ -47,5 +47,5 @@ "main": "dist/index.js", | ||
"@types/node": "^14.17.5", | ||
"@types/node-fetch": "^2.6.2", | ||
"@types/node-fetch": "^2.6.4", | ||
"jest": "^27.3.1", | ||
"node-fetch": "2.6.1", | ||
"node-fetch": "2.7.0", | ||
"ts-jest": "^27.0.7", | ||
@@ -52,0 +52,0 @@ "tsc-alias": "^1.8.7" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
703823