@kameleoon/javascript-sdk-core
Advanced tools
Comparing version 4.4.1 to 4.4.2
# Change Log | ||
## 4.4.2 (2024-07-16) | ||
### Patch Changes | ||
- [`getVisitorCode`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#getvisitorcode) now sets the visitor code to cookie correctly, when the visitor code was initially retrieved from it | ||
## 4.4.1 (2024-07-12) | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VisitorCodeManager=void 0;var _constants=require("../constants"),_storage=require("../storage"),_utilities=require("../utilities"),_constants2=require("./constants");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 VisitorCodeManager{constructor(){_defineProperty(this,"isConsentRequired",!1),_defineProperty(this,"setDataCallback",void 0),_defineProperty(this,"getDataCallback",void 0)}set consentRequired(a){this.isConsentRequired=a}get consentRequired(){return this.isConsentRequired}set getData(a){this.getDataCallback=a}set setData(a){this.setDataCallback=a}get setData(){if(this.setDataCallback)return this.setDataCallback;throw new Error("Missing setDataCallback!")}getVisitorCode(a){if(!this.getDataCallback||!this.setDataCallback)throw new Error("Missing getDataCallback or setDataCallback methods in getVisitorCode!");const b=this.getDataCallback(_storage.KameleoonStorageKey.VisitorCode);if(b)return b;let c=a;return c?_utilities.Utilities.validateVisitorCode(c).throw():c=_utilities.Utilities.generateRandomString(_constants.VISITOR_CODE_LENGTH),this.isConsentRequired||this.setDataCallback({visitorCode:c,key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_constants2.DEFAULT_MAX_AGE,path:_constants2.PATH}),c}}exports.VisitorCodeManager=VisitorCodeManager; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VisitorCodeManager=void 0;var _constants=require("../constants"),_storage=require("../storage"),_utilities=require("../utilities"),_constants2=require("./constants");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 VisitorCodeManager{constructor(){_defineProperty(this,"isConsentRequired",!1),_defineProperty(this,"setDataCallback",void 0),_defineProperty(this,"getDataCallback",void 0)}set consentRequired(a){this.isConsentRequired=a}get consentRequired(){return this.isConsentRequired}set getData(a){this.getDataCallback=a}set setData(a){this.setDataCallback=a}get setData(){if(this.setDataCallback)return this.setDataCallback;throw new Error("Missing setDataCallback!")}getVisitorCode(a){if(!this.getDataCallback||!this.setDataCallback)throw new Error("Missing getDataCallback or setDataCallback methods in getVisitorCode!");let b;const c=this.getDataCallback(_storage.KameleoonStorageKey.VisitorCode);return c&&(b=c),b||(a?(_utilities.Utilities.validateVisitorCode(a).throw(),b=a):b=_utilities.Utilities.generateRandomString(_constants.VISITOR_CODE_LENGTH)),this.isConsentRequired||this.setDataCallback({visitorCode:b,key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_constants2.DEFAULT_MAX_AGE,path:_constants2.PATH}),b}}exports.VisitorCodeManager=VisitorCodeManager; | ||
//# sourceMappingURL=visitorCodeManager.js.map |
{ | ||
"name": "@kameleoon/javascript-sdk-core", | ||
"version": "4.4.1", | ||
"version": "4.4.2", | ||
"description": "Kameleoon JS SDK Core", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
881026