@kameleoon/javascript-sdk-core 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clientConfiguration/types.d.ts +1 -0
- package/dist/clientConfiguration/types.js.map +1 -1
- package/dist/hasher/hasher.d.ts +1 -1
- package/dist/hasher/hasher.js +1 -1
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/types.d.ts +1 -1
- package/dist/hasher/types.js.map +1 -1
- package/dist/kameleoonClient.js +1 -1
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/customData.d.ts +6 -0
- package/dist/kameleoonData/customData.js +1 -1
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/dataManager.d.ts +2 -0
- package/dist/kameleoonData/dataManager.js +1 -1
- package/dist/kameleoonData/dataManager.js.map +1 -1
- package/dist/kameleoonData/types.d.ts +1 -0
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/requester/constants.js +1 -1
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/types.d.ts +1 -1
- package/dist/requester/types.js +1 -1
- package/dist/requester/types.js.map +1 -1
- package/dist/utilities/types.d.ts +5 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +2 -2
- package/dist/utilities/utilities.js +1 -1
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/types.d.ts +1 -0
- package/dist/variationConfiguration/types.js.map +1 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +1 -1
- package/dist/variationConfiguration/variationConfiguration.js +1 -1
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["UpdateType","Polling","RealTime","Idle","exports","RuleType","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ConsentType","Required","NotRequired"],"sources":["../../src/clientConfiguration/types.ts"],"sourcesContent":["import { ClientSettingsType } from 'src/clientSettings';\nimport { IExternalEventSourceConstructor } from 'src/eventSource';\nimport { DataManager } from 'src/kameleoonData';\nimport { Requester } from 'src/requester';\nimport { CookieManager } from 'src/cookieManager';\nimport { ClientDataType, IExternalStorage } from 'src/storage';\nimport { OfflineTracking } from 'src/storage/types';\nimport { SegmentType } from 'src/targeting';\nimport { VariableType } from 'src/types';\n\nexport type UpdateClientConfigurationParameters = {\n timestamp?: number;\n useCache?: boolean;\n};\n\nexport type ScheduleType = {\n dateStart: string;\n dateEnd: string;\n};\n\nexport enum UpdateType {\n Polling,\n RealTime,\n Idle,\n}\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | JSONValue[];\n\nexport type JSONType = Record<string | number | symbol, JSONValue> | null;\n\nexport enum RuleType {\n TARGETED_DELIVERY = 'TARGETED_DELIVERY',\n EXPERIMENTATION = 'EXPERIMENTATION',\n}\n\nexport enum FeatureFlagSdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACTJS = 'REACTJS',\n}\n\nexport enum FeatureStatus {\n ACTIVATED = 'ACTIVATED',\n DEACTIVATED = 'DEACTIVATED',\n SCHEDULED = 'SCHEDULED',\n}\n\nexport enum CustomDataScope {\n Visit = 'VISIT',\n Visitor = 'VISITOR',\n Page = 'Page',\n}\n\nexport enum ConsentType {\n Required = 'REQUIRED',\n NotRequired = 'NOT_REQUIRED',\n}\n\nexport type DeviationType = {\n variationId: string;\n value: number;\n};\n\nexport type FeatureFlagType = {\n id: number;\n featureKey: string;\n environmentEnabled: boolean;\n variations: FeatureVariationType[];\n defaultVariationKey: string;\n rules: RuleItemType[];\n};\n\nexport type FeatureVariationType = {\n key: string;\n variables: FeatureVariableType[];\n};\n\nexport type FeatureVariableType = {\n key: string;\n type: VariableType;\n value: string | number | boolean;\n};\n\nexport type RuleItemType = {\n type: RuleType;\n id: number;\n respoolTime: number | null;\n order: number;\n exposition: number;\n experimentId: number;\n variationByExposition: VariationByExpositionType[];\n segment: SegmentType | null;\n};\n\nexport type MappedRuleType = {\n experimentId: number;\n featureId: number;\n // --- Note ---\n // Map<variationKey, variationId>\n variations: Map<string, number>;\n};\n\nexport type VariationByExpositionType = {\n variationKey: string;\n variationId: number;\n exposition: number;\n};\n\nexport type ConfigurationDataType = {\n featureFlags: FeatureFlagType[];\n configuration: ConfigurationType;\n customData: CustomDataConfigurationType[];\n};\n\nexport type CustomDataConfigurationType = {\n index: number;\n localOnly: boolean;\n scope: CustomDataScope;\n};\n\nexport type ConfigurationType = {\n realTimeUpdate: boolean;\n projectEnabled: boolean;\n consentType: ConsentType;\n};\n\nexport type ClientConfigurationParametersType = {\n settings: ClientSettingsType;\n storage: IExternalStorage<ClientDataType>;\n dataManager: DataManager;\n requester: Requester;\n offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n externalClientConfiguration?: ConfigurationDataType;\n externalEventSource: IExternalEventSourceConstructor;\n externalCookieManager: CookieManager;\n};\n"],"mappings":"uNAoBY,CAAAA,UAAU,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAVA,CAAU,CAAAC,OAAA,cAAVD,CAAU,CAAVA,CAAU,CAAAE,QAAA,eAAVF,CAAU,CAAVA,CAAU,CAAAG,IAAA,WAAVH,CAAU,MAAAI,OAAA,CAAAJ,UAAA,CAAAA,UAAA,IAeV,CAAAK,QAAQ,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,iBAAA,qBAARD,CAAQ,CAAAE,eAAA,mBAARF,CAAQ,MAAAD,OAAA,CAAAC,QAAA,CAAAA,QAAA,IAKR,CAAAG,0BAA0B,UAA1BA,CAA0B,QAA1B,CAAAA,CAA0B,CAAAC,OAAA,WAA1BD,CAA0B,CAAAE,KAAA,SAA1BF,CAA0B,CAAAG,IAAA,QAA1BH,CAA0B,CAAAI,MAAA,UAA1BJ,CAA0B,CAAAK,MAAA,UAA1BL,CAA0B,CAAAM,GAAA,OAA1BN,CAA0B,CAAAO,IAAA,QAA1BP,CAA0B,CAAAQ,EAAA,MAA1BR,CAA0B,CAAAS,OAAA,WAA1BT,CAA0B,CAAAU,OAAA,WAA1BV,CAA0B,MAAAJ,OAAA,CAAAI,0BAAA,CAAAA,0BAAA,IAa1B,CAAAW,aAAa,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,SAAA,aAAbD,CAAa,CAAAE,WAAA,eAAbF,CAAa,CAAAG,SAAA,aAAbH,CAAa,MAAAf,OAAA,CAAAe,aAAA,CAAAA,aAAA,IAMb,CAAAI,eAAe,UAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,KAAA,SAAfD,CAAe,CAAAE,OAAA,WAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,MAAAnB,OAAA,CAAAmB,eAAA,CAAAA,eAAA,IAMf,CAAAI,WAAW,UAAXA,CAAW,QAAX,CAAAA,CAAW,CAAAC,QAAA,YAAXD,CAAW,CAAAE,WAAA,gBAAXF,CAAW,MAAAvB,OAAA,CAAAuB,WAAA,CAAAA,WAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["UpdateType","Polling","RealTime","Idle","exports","RuleType","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ConsentType","Required","NotRequired"],"sources":["../../src/clientConfiguration/types.ts"],"sourcesContent":["import { ClientSettingsType } from 'src/clientSettings';\nimport { IExternalEventSourceConstructor } from 'src/eventSource';\nimport { DataManager } from 'src/kameleoonData';\nimport { Requester } from 'src/requester';\nimport { CookieManager } from 'src/cookieManager';\nimport { ClientDataType, IExternalStorage } from 'src/storage';\nimport { OfflineTracking } from 'src/storage/types';\nimport { SegmentType } from 'src/targeting';\nimport { VariableType } from 'src/types';\n\nexport type UpdateClientConfigurationParameters = {\n timestamp?: number;\n useCache?: boolean;\n};\n\nexport type ScheduleType = {\n dateStart: string;\n dateEnd: string;\n};\n\nexport enum UpdateType {\n Polling,\n RealTime,\n Idle,\n}\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | JSONValue[];\n\nexport type JSONType = Record<string | number | symbol, JSONValue> | null;\n\nexport enum RuleType {\n TARGETED_DELIVERY = 'TARGETED_DELIVERY',\n EXPERIMENTATION = 'EXPERIMENTATION',\n}\n\nexport enum FeatureFlagSdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACTJS = 'REACTJS',\n}\n\nexport enum FeatureStatus {\n ACTIVATED = 'ACTIVATED',\n DEACTIVATED = 'DEACTIVATED',\n SCHEDULED = 'SCHEDULED',\n}\n\nexport enum CustomDataScope {\n Visit = 'VISIT',\n Visitor = 'VISITOR',\n Page = 'Page',\n}\n\nexport enum ConsentType {\n Required = 'REQUIRED',\n NotRequired = 'NOT_REQUIRED',\n}\n\nexport type DeviationType = {\n variationId: string;\n value: number;\n};\n\nexport type FeatureFlagType = {\n id: number;\n featureKey: string;\n environmentEnabled: boolean;\n variations: FeatureVariationType[];\n defaultVariationKey: string;\n rules: RuleItemType[];\n};\n\nexport type FeatureVariationType = {\n key: string;\n variables: FeatureVariableType[];\n};\n\nexport type FeatureVariableType = {\n key: string;\n type: VariableType;\n value: string | number | boolean;\n};\n\nexport type RuleItemType = {\n type: RuleType;\n id: number;\n respoolTime: number | null;\n order: number;\n exposition: number;\n experimentId: number;\n variationByExposition: VariationByExpositionType[];\n segment: SegmentType | null;\n};\n\nexport type MappedRuleType = {\n experimentId: number;\n featureId: number;\n // --- Note ---\n // Map<variationKey, variationId>\n variations: Map<string, number>;\n};\n\nexport type VariationByExpositionType = {\n variationKey: string;\n variationId: number;\n exposition: number;\n};\n\nexport type ConfigurationDataType = {\n featureFlags: FeatureFlagType[];\n configuration: ConfigurationType;\n customData: CustomDataConfigurationType[];\n};\n\nexport type CustomDataConfigurationType = {\n index: number;\n localOnly: boolean;\n isMappingIdentifier: boolean;\n scope: CustomDataScope;\n};\n\nexport type ConfigurationType = {\n realTimeUpdate: boolean;\n projectEnabled: boolean;\n consentType: ConsentType;\n};\n\nexport type ClientConfigurationParametersType = {\n settings: ClientSettingsType;\n storage: IExternalStorage<ClientDataType>;\n dataManager: DataManager;\n requester: Requester;\n offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n externalClientConfiguration?: ConfigurationDataType;\n externalEventSource: IExternalEventSourceConstructor;\n externalCookieManager: CookieManager;\n};\n"],"mappings":"uNAoBY,CAAAA,UAAU,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAVA,CAAU,CAAAC,OAAA,cAAVD,CAAU,CAAVA,CAAU,CAAAE,QAAA,eAAVF,CAAU,CAAVA,CAAU,CAAAG,IAAA,WAAVH,CAAU,MAAAI,OAAA,CAAAJ,UAAA,CAAAA,UAAA,IAeV,CAAAK,QAAQ,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,iBAAA,qBAARD,CAAQ,CAAAE,eAAA,mBAARF,CAAQ,MAAAD,OAAA,CAAAC,QAAA,CAAAA,QAAA,IAKR,CAAAG,0BAA0B,UAA1BA,CAA0B,QAA1B,CAAAA,CAA0B,CAAAC,OAAA,WAA1BD,CAA0B,CAAAE,KAAA,SAA1BF,CAA0B,CAAAG,IAAA,QAA1BH,CAA0B,CAAAI,MAAA,UAA1BJ,CAA0B,CAAAK,MAAA,UAA1BL,CAA0B,CAAAM,GAAA,OAA1BN,CAA0B,CAAAO,IAAA,QAA1BP,CAA0B,CAAAQ,EAAA,MAA1BR,CAA0B,CAAAS,OAAA,WAA1BT,CAA0B,CAAAU,OAAA,WAA1BV,CAA0B,MAAAJ,OAAA,CAAAI,0BAAA,CAAAA,0BAAA,IAa1B,CAAAW,aAAa,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,SAAA,aAAbD,CAAa,CAAAE,WAAA,eAAbF,CAAa,CAAAG,SAAA,aAAbH,CAAa,MAAAf,OAAA,CAAAe,aAAA,CAAAA,aAAA,IAMb,CAAAI,eAAe,UAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,KAAA,SAAfD,CAAe,CAAAE,OAAA,WAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,MAAAnB,OAAA,CAAAmB,eAAA,CAAAA,eAAA,IAMf,CAAAI,WAAW,UAAXA,CAAW,QAAX,CAAAA,CAAW,CAAAC,QAAA,YAAXD,CAAW,CAAAE,WAAA,gBAAXF,CAAW,MAAAvB,OAAA,CAAAuB,WAAA,CAAAA,WAAA"}
|
package/dist/hasher/hasher.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetHashDoubleParamsType } from './types';
|
|
2
2
|
export declare class Hasher {
|
|
3
|
-
static getHashDouble({
|
|
3
|
+
static getHashDouble({ visitorIdentifier, id, respoolTime, }: GetHashDoubleParamsType): number;
|
|
4
4
|
static calculateHash(seed: string): number;
|
|
5
5
|
}
|
package/dist/hasher/hasher.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _sha=_interopRequireDefault(require("crypto-js/sha256"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.Hasher=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}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 _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 Hasher=function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"getHashDouble",value:function getHashDouble(a){var b=a.
|
|
1
|
+
"use strict";var _sha=_interopRequireDefault(require("crypto-js/sha256"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.Hasher=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}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 _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 Hasher=function(){function a(){_classCallCheck(this,a)}return _createClass(a,null,[{key:"getHashDouble",value:function getHashDouble(a){var b=a.visitorIdentifier,c=a.id,d=a.respoolTime,e="";return d&&(e+=d+""),this.calculateHash(b+c+e)}},{key:"calculateHash",value:function calculateHash(a){var b=(0,_sha.default)(a).toString();return parseInt(b,16)/Math.pow(2,256)}}]),a}();exports.Hasher=Hasher;
|
|
2
2
|
//# sourceMappingURL=hasher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasher.js","names":["_sha","_interopRequireDefault","require","Object","defineProperty","exports","value","Hasher","a","__esModule","default","_typeof","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","getHashDouble","
|
|
1
|
+
{"version":3,"file":"hasher.js","names":["_sha","_interopRequireDefault","require","Object","defineProperty","exports","value","Hasher","a","__esModule","default","_typeof","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","getHashDouble","visitorIdentifier","id","respoolTime","suffix","calculateHash","seed","hashDigest","sha256","toString","parseInt","Math","pow"],"sources":["../../src/hasher/hasher.ts"],"sourcesContent":["import sha256 from 'crypto-js/sha256';\nimport { GetHashDoubleParamsType } from './types';\n\nexport class Hasher {\n static getHashDouble({\n visitorIdentifier,\n id,\n respoolTime,\n }: GetHashDoubleParamsType): number {\n let suffix = '';\n\n if (respoolTime) {\n suffix += String(respoolTime);\n }\n\n return this.calculateHash(visitorIdentifier + id + suffix);\n }\n\n // --- Note ---\n // `hashDouble` is a seeded pseudo-random number between 0 and 1\n // used for deciding what variation to assign\n // `calculateHash` algorithm is consistent between every SDK\n // and will always provide same pseudo-random value for the same input parameters\n static calculateHash(seed: string): number {\n const hashDigest = sha256(seed).toString();\n\n return parseInt(hashDigest, 16) / Math.pow(2, 256);\n }\n}\n"],"mappings":"aAAA,IAAAA,IAAA,CAAAC,sBAAA,CAAAC,OAAA,sBAAsCC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,MAAA,iBAAAN,uBAAAO,CAAA,SAAAA,CAAA,EAAAA,CAAA,CAAAC,UAAA,CAAAD,CAAA,EAAAE,OAAA,CAAAF,CAAA,WAAAG,QAAAH,CAAA,mCAAAG,OAAA,oBAAAC,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAL,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAI,MAAA,EAAAJ,CAAA,CAAAM,WAAA,GAAAF,MAAA,EAAAJ,CAAA,GAAAI,MAAA,CAAAG,SAAA,iBAAAP,CAAA,EAAAG,OAAA,CAAAH,CAAA,WAAAQ,gBAAAR,CAAA,CAAAS,CAAA,OAAAT,CAAA,YAAAS,CAAA,YAAAC,SAAA,+CAAAC,kBAAAX,CAAA,CAAAS,CAAA,UAAAG,CAAA,CAAAC,CAAA,GAAAA,CAAA,CAAAJ,CAAA,CAAAK,MAAA,CAAAD,CAAA,GAAAD,CAAA,CAAAH,CAAA,CAAAI,CAAA,EAAAD,CAAA,CAAAG,UAAA,CAAAH,CAAA,CAAAG,UAAA,KAAAH,CAAA,CAAAI,YAAA,cAAAJ,CAAA,GAAAA,CAAA,CAAAK,QAAA,KAAAtB,MAAA,CAAAC,cAAA,CAAAI,CAAA,CAAAkB,cAAA,CAAAN,CAAA,CAAAO,GAAA,EAAAP,CAAA,WAAAQ,aAAApB,CAAA,CAAAS,CAAA,CAAAG,CAAA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Q,EAAE,CAE1C,MAAO,CAAAC,QAAQ,CAACH,CAAU,CAAE,EAAE,CAAC,CAAGI,IAAI,CAACC,GAAG,CAAC,CAAC,CAAE,GAAG,CACnD,CAAC,IAAAtC,CAAA,IAAAH,OAAA,CAAAE,MAAA,CAAAA,MAAA"}
|
package/dist/hasher/types.d.ts
CHANGED
package/dist/hasher/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/hasher/types.ts"],"sourcesContent":["export type GetHashDoubleParamsType = {\n respoolTime: number | null;\n
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/hasher/types.ts"],"sourcesContent":["export type GetHashDoubleParamsType = {\n respoolTime: number | null;\n visitorIdentifier: string;\n id: string;\n};\n"],"mappings":""}
|
package/dist/kameleoonClient.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonClient=void 0;var _tsRes=require("ts-res"),_cacheManager=require("./cacheManager"),_clientConfiguration=require("./clientConfiguration"),_clientSettings=require("./clientSettings"),_constants=require("./constants"),_kameleoonData=require("./kameleoonData"),_kameleoonError=require("./kameleoonError"),_requester=require("./requester"),_storage=require("./storage"),_types=require("./types"),_utilities=require("./utilities"),_variationConfiguration=require("./variationConfiguration");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 _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}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 KameleoonClient=function(){function a(b){var c=b.siteCode,d=b.configuration,e=b.internalConfiguration;_classCallCheck(this,a),_defineProperty(this,"variationConfiguration",void 0),_defineProperty(this,"clientConfiguration",void 0),_defineProperty(this,"dataManager",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"consentDataStorage",void 0),_defineProperty(this,"trackingCache",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"externalPackageInfo",void 0),_defineProperty(this,"isOfflineModeOn",void 0),_defineProperty(this,"initialized",!1),_defineProperty(this,"environment",void 0),_defineProperty(this,"cookieManager",void 0);var f=new _clientSettings.ClientSettings(c,d),g=f.settings;this.environment=g.environment;var h=e.externalStorage,i=e.externalEventSource,j=e.externalPackageInfo,k=e.externalCookieManager,l=e.externalRequestDispatcher,m=e.externalClientConfiguration,n=new _requester.Requester({siteCode:c,environment:g.environment,packageInfo:j,requestDispatcher:l}),o=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),p=h.initialize(_storage.KameleoonStorageKey.ClientData),q=h.initialize(_storage.KameleoonStorageKey.TargetingData),r=h.initialize(_storage.KameleoonStorageKey.VariationData),s=h.initialize(_storage.KameleoonStorageKey.OfflineTracking),t=h.initialize(_storage.KameleoonStorageKey.ConsentData),u=new _kameleoonData.DataManager({storage:q,targetingCleanupInterval:null===d||void 0===d?void 0:d.targetingDataCleanupInterval}),v=new _clientConfiguration.ClientConfiguration({settings:g,storage:p,dataManager:u,requester:n,externalClientConfiguration:m,offlineTrackingStorage:s,externalEventSource:i,externalCookieManager:k}),w=new _variationConfiguration.VariationConfiguration(r);this.variationConfiguration=w,this.requester=n,this.trackingCache=o,this.dataManager=u,this.clientConfiguration=v,this.externalPackageInfo=j,this.offlineTrackingStorage=s,this.consentDataStorage=t,this.cookieManager=k}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.clientConfiguration.initialize(a);case 2:return c=b.sent,c.throw(),this.isOfflineModeOn=a,this.initialized=!0,b.abrupt("return",c.ok);case 7:case"end":return b.stop();}},b,this)}));return a}()},{key:"addData",value:function addData(a){var b;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];(b=this.dataManager).addData.apply(b,[a].concat(d)).throw()}},{key:"getRemoteVisitorData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m,n;return _regeneratorRuntime().wrap(function o(b){for(;1;)switch(b.prev=b.next){case 0:if(c=a.visitorCode,d=a.shouldAddData,e=void 0===d||d,f=a.filters,g=void 0===f?_constants.DEFAULT_VISITOR_DATA_FILTERS:f,this.initialized){b.next=3;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);case 3:if(_utilities.Utilities.validateVisitorCode(c).throw(),h=g.previousVisitAmount,!("number"==typeof h&&(1>h||25<h))){b.next=7;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.VisitAmount);case 7:return b.next=9,this.requester.getVisitorData(c,g);case 9:i=b.sent,j=i.throw(),k=_utilities.Utilities.parseVisitorData({data:j,filters:g,visitorCode:c,variationConfiguration:this.variationConfiguration}),l=_createForOfIteratorHelper(k);try{for(l.s();!(m=l.n()).done;)n=m.value,(e||this.dataManager.isPersistentCustomData(n))&&this.addData(c,n)}catch(a){l.e(a)}finally{l.f()}return b.abrupt("return",k);case 15:case"end":return b.stop();}},b,this)}));return a}()},{key:"trackConversion",value:function trackConversion(a){var b=a.visitorCode,c=a.goalId,d=a.revenue;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b)}},{key:"flush",value:function flush(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);if("string"==typeof a&&_utilities.Utilities.validateVisitorCode(a).throw(),a)return void _utilities.Utilities.trackData({visitorCode:a,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(a),offlineTrackingStorage:this.offlineTrackingStorage});if(!this.dataManager.unsentDataVisitors.length)return void _utilities.Utilities.sendOfflineTracking({requester:this.requester,storage:this.offlineTrackingStorage});var b,c=_createForOfIteratorHelper(this.dataManager.unsentDataVisitors);try{for(c.s();!(b=c.n()).done;){var d=b.value;_utilities.Utilities.trackData({visitorCode:d,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(d),offlineTrackingStorage:this.offlineTrackingStorage})}}catch(a){c.e(a)}finally{c.f()}}},{key:"getFeatureFlags",value:function getFeatureFlags(){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.clientConfiguration.featureFlags.map(function(a){var b=a.id,c=a.featureKey;return{id:b,key:c}})}},{key:"getVisitorFeatureFlags",value:function getVisitorFeatureFlags(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var b,c=this.clientConfiguration.featureFlags,d=[],e=this.dataManager.storedTargetingData[a],f=_createForOfIteratorHelper(c);try{for(f.s();!(b=f.n()).done;){var g=b.value,h=this.variationConfiguration.getVariation({visitorCode:a,targetingData:e,featureFlag:g,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw();if(h.variationKey!==_constants.OFF_VARIATION_KEY&&g.environmentEnabled){var i=h.featureFlagId,j=h.featureKey;d.push({id:i,key:j})}}}catch(a){f.e(a)}finally{f.f()}return d}},{key:"getFeatureFlagVariationKey",value:function getFeatureFlagVariationKey(a,b){_utilities.Utilities.validateVisitorCode(a).throw();var c=this._getFeatureFlagVariation(a,b).throw(),d=c.variationKey;return d}},{key:"getFeatureFlagVariable",value:function getFeatureFlagVariable(a){var b,c=a.visitorCode,d=a.featureKey,e=a.variableKey;_utilities.Utilities.validateVisitorCode(c).throw();var f=this._getFeatureFlagVariation(c,d).throw(),g=f.variationKey,h=this.clientConfiguration.featureFlags,i=h.find(function(a){return a.featureKey===d});if(!i)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,d);var j=null===(b=i.variations.find(function(a){return a.key===g}))||void 0===b?void 0:b.variables.find(function(a){return a.key===e});if(!j)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariableNotFound,e,c);var k=_utilities.Utilities.parseFeatureVariable(j).throw();return k}},{key:"getFeatureFlagVariables",value:function getFeatureFlagVariables(a,b){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(a).throw();var c=this._getFeatureFlagVariation(a,b).throw(),d=c.variationKey,e=this.clientConfiguration.featureFlags,f=e.find(function(a){return a.featureKey===b});if(!f)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b);var g=f.variations.find(function(a){return a.key===d});if(!g)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariationNotFound,d,a);var h,i=[],j=_createForOfIteratorHelper(g.variables);try{for(j.s();!(h=j.n()).done;){var k=h.value,l=_utilities.Utilities.parseFeatureVariable(k).throw();i.push(l)}}catch(a){j.e(a)}finally{j.f()}return i}},{key:"isFeatureFlagActive",value:function isFeatureFlagActive(a,b){try{var c=this.getFeatureFlagVariationKey(a,b);return c!==_constants.OFF_VARIATION_KEY}catch(a){if(a instanceof _kameleoonError.KameleoonError&&a.type===_kameleoonError.KameleoonException.FeatureFlagEnvironmentDisabled)return!1;throw a}}},{key:"getRemoteData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.requester.getRemoteData(a);case 2:return c=b.sent,b.abrupt("return",c.throw());case 4:case"end":return b.stop();}},b,this)}));return a}()},{key:"getVisitorWarehouseAudience",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g;return _regeneratorRuntime().wrap(function h(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.customDataIndex,e=a.warehouseKey,_utilities.Utilities.validateVisitorCode(c).throw(),b.next=4,this.getRemoteData(e||c);case 4:if(f=b.sent,f){b.next=7;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.RemoteData);case 7:if(f[_constants.WAREHOUSE_AUDIENCE_KEY]&&0!==Object.keys(f[_constants.WAREHOUSE_AUDIENCE_KEY]).length){b.next=9;break}return b.abrupt("return",null);case 9:return g=_construct(_kameleoonData.CustomData,[d].concat(_toConsumableArray(Object.keys(f[_constants.WAREHOUSE_AUDIENCE_KEY])))),this.dataManager.addData(c,g),b.abrupt("return",g);case 12:case"end":return b.stop();}},b,this)}));return a}()},{key:"onConfigurationUpdate",value:function onConfigurationUpdate(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);this.clientConfiguration.onConfigurationUpdate(a)}},{key:"getEngineTrackingCode",value:function getEngineTrackingCode(a){return _utilities.Utilities.validateVisitorCode(a).throw(),_utilities.Utilities.getTrackingCode(this.trackingCache,a)}},{key:"getVisitorCode",value:function getVisitorCode(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.cookieManager.getVisitorCode(a)}},{key:"setLegalConsent",value:function setLegalConsent(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var b=a.visitorCode,c=a.consent;_utilities.Utilities.validateVisitorCode(b).throw(),this.consentDataStorage.update(_defineProperty({},b,c)),c?_utilities.Utilities.isServerEnvironment(a)?this.cookieManager.setCookie({visitorCode:a.visitorCode,response:a.response}):this.cookieManager.setCookie({visitorCode:a.visitorCode}):this.cookieManager.getConsentRequired()&&(_utilities.Utilities.isServerEnvironment(a)?this.cookieManager.setCookie({visitorCode:"",response:a.response}):this.cookieManager.setCookie({visitorCode:""}))}},{key:"_isConsentProvided",value:function _isConsentProvided(a){var b=this.clientConfiguration.isConsentRequired,c=this.consentDataStorage.read();return!b||c.ok&&c.data[a]}},{key:"_getFeatureFlagVariation",value:function _getFeatureFlagVariation(a,b){if(!this.initialized)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization));var c=this.clientConfiguration.featureFlags,d=c.find(function(a){return a.featureKey===b});if(!d)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b));if(!d.environmentEnabled)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagEnvironmentDisabled,d.featureKey,this.environment||_types.Environment.Production));var e=this.dataManager.storedTargetingData[a],f=this.variationConfiguration.getVariation({visitorCode:a,featureFlag:d,targetingData:e,withAssignment:!0,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw(),g=f.experimentId,h=f.variationId;return"number"==typeof h&&"number"==typeof g&&_utilities.Utilities.updateCache({cacheManager:this.trackingCache,visitorCode:a,experimentId:g,variationId:h}),_utilities.Utilities.trackFeatureExperiment({visitorCode:a,requester:this.requester,featureFlagVariation:f,dataManager:this.dataManager,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(a),offlineTrackingStorage:this.offlineTrackingStorage}),(0,_tsRes.Ok)(f)}}]),a}();exports.KameleoonClient=KameleoonClient;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonClient=void 0;var _tsRes=require("ts-res"),_cacheManager=require("./cacheManager"),_clientConfiguration=require("./clientConfiguration"),_clientSettings=require("./clientSettings"),_constants=require("./constants"),_kameleoonData=require("./kameleoonData"),_kameleoonError=require("./kameleoonError"),_requester=require("./requester"),_storage=require("./storage"),_types=require("./types"),_utilities=require("./utilities"),_variationConfiguration=require("./variationConfiguration");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 _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _regeneratorRuntime(){"use strict";function a(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function b(a,b,c,e){var f=b&&b.prototype instanceof d?b:d,g=Object.create(f.prototype),h=new m(e||[]);return s(g,"_invoke",{value:i(a,c,h)}),g}function c(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function d(){}function e(){}function f(){}function g(b){["next","throw","return"].forEach(function(c){a(b,c,function(a){return this._invoke(c,a)})})}function h(a,b){function d(e,f,g,h){var i=c(a[e],a,f);if("throw"!==i.type){var j=i.arg,k=j.value;return k&&"object"==_typeof(k)&&r.call(k,"__await")?b.resolve(k.__await).then(function(a){d("next",a,g,h)},function(a){d("throw",a,g,h)}):b.resolve(k).then(function(a){j.value=a,g(j)},function(a){return d("throw",a,g,h)})}h(i.arg)}var e;s(this,"_invoke",{value:function value(a,c){function f(){return new b(function(b,e){d(a,c,b,e)})}return e=e?e.then(f,f):f()}})}function i(a,b,d){var e="suspendedStart";return function(f,g){if("executing"==e)throw new Error("Generator is already running");if("completed"==e){if("throw"===f)throw g;return o()}for(d.method=f,d.arg=g;;){var h=d.delegate;if(h){var i=j(h,d);if(i){if(i===x)continue;return i}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if("suspendedStart"==e)throw e="completed",d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);e="executing";var k=c(a,b,d);if("normal"===k.type){if(e=d.done?"completed":"suspendedYield",k.arg===x)continue;return{value:k.arg,done:d.done}}"throw"===k.type&&(e="completed",d.method="throw",d.arg=k.arg)}}}function j(a,b){var d=b.method,e=a.iterator[d];if(void 0===e)return b.delegate=null,"throw"===d&&a.iterator.return&&(b.method="return",b.arg=void 0,j(a,b),"throw"===b.method)||"return"!==d&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+d+"' method")),x;var f=c(e,a.iterator,b.arg);if("throw"===f.type)return b.method="throw",b.arg=f.arg,b.delegate=null,x;var g=f.arg;return g?g.done?(b[a.resultName]=g.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,x):g:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,x)}function k(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function l(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function m(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(k,this),this.reset(!0)}function n(a){if(a){var b=a[u];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var c=-1,d=function b(){for(;++c<a.length;)if(r.call(a,c))return b.value=a[c],b.done=!1,b;return b.value=void 0,b.done=!0,b};return d.next=d}}return{next:o}}function o(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return p};var p={},q=Object.prototype,r=q.hasOwnProperty,s=Object.defineProperty||function(a,b,c){a[b]=c.value},t="function"==typeof Symbol?Symbol:{},u=t.iterator||"@@iterator",v=t.asyncIterator||"@@asyncIterator",w=t.toStringTag||"@@toStringTag";try{a({},"")}catch(b){a=function(a,b,c){return a[b]=c}}p.wrap=b;var x={},y={};a(y,u,function(){return this});var z=Object.getPrototypeOf,A=z&&z(z(n([])));A&&A!==q&&r.call(A,u)&&(y=A);var B=f.prototype=d.prototype=Object.create(y);return e.prototype=f,s(B,"constructor",{value:f,configurable:!0}),s(f,"constructor",{value:e,configurable:!0}),e.displayName=a(f,w,"GeneratorFunction"),p.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===e||"GeneratorFunction"===(b.displayName||b.name))},p.mark=function(b){return Object.setPrototypeOf?Object.setPrototypeOf(b,f):(b.__proto__=f,a(b,w,"GeneratorFunction")),b.prototype=Object.create(B),b},p.awrap=function(a){return{__await:a}},g(h.prototype),a(h.prototype,v,function(){return this}),p.AsyncIterator=h,p.async=function(a,c,d,e,f){void 0===f&&(f=Promise);var g=new h(b(a,c,d,e),f);return p.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},g(B),a(B,w,"Generator"),a(B,u,function(){return this}),a(B,"toString",function(){return"[object Generator]"}),p.keys=function(a){var b=Object(a),c=[];for(var d in b)c.push(d);return c.reverse(),function a(){for(;c.length;){var d=c.pop();if(d in b)return a.value=d,a.done=!1,a}return a.done=!0,a}},p.values=n,m.prototype={constructor:m,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(l),!a)for(var b in this)"t"===b.charAt(0)&&r.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function b(b,d){return f.type="throw",f.arg=a,c.next=b,d&&(c.method="next",c.arg=void 0),!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var g=r.call(e,"catchLoc"),h=r.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(this.prev<e.catchLoc)return b(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var c,d=this.tryEntries.length-1;0<=d;--d)if(c=this.tryEntries[d],c.tryLoc<=this.prev&&r.call(c,"finallyLoc")&&this.prev<c.finallyLoc){var e=c;break}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);var f=e?e.completion:{};return f.type=a,f.arg=b,e?(this.method="next",this.next=e.finallyLoc,x):this.complete(f)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),x},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),l(b),x},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;l(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:n(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),x}},p}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}var h=a.apply(b,c);f(void 0)})}}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 KameleoonClient=function(){function a(b){var c=b.siteCode,d=b.configuration,e=b.internalConfiguration;_classCallCheck(this,a),_defineProperty(this,"variationConfiguration",void 0),_defineProperty(this,"clientConfiguration",void 0),_defineProperty(this,"dataManager",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"consentDataStorage",void 0),_defineProperty(this,"trackingCache",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"externalPackageInfo",void 0),_defineProperty(this,"isOfflineModeOn",void 0),_defineProperty(this,"initialized",!1),_defineProperty(this,"environment",void 0),_defineProperty(this,"cookieManager",void 0);var f=new _clientSettings.ClientSettings(c,d),g=f.settings;this.environment=g.environment;var h=e.externalStorage,i=e.externalEventSource,j=e.externalPackageInfo,k=e.externalCookieManager,l=e.externalRequestDispatcher,m=e.externalClientConfiguration,n=new _requester.Requester({siteCode:c,environment:g.environment,packageInfo:j,requestDispatcher:l}),o=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),p=h.initialize(_storage.KameleoonStorageKey.ClientData),q=h.initialize(_storage.KameleoonStorageKey.TargetingData),r=h.initialize(_storage.KameleoonStorageKey.VariationData),s=h.initialize(_storage.KameleoonStorageKey.OfflineTracking),t=h.initialize(_storage.KameleoonStorageKey.ConsentData),u=new _kameleoonData.DataManager({storage:q,targetingCleanupInterval:null===d||void 0===d?void 0:d.targetingDataCleanupInterval}),v=new _clientConfiguration.ClientConfiguration({settings:g,storage:p,dataManager:u,requester:n,externalClientConfiguration:m,offlineTrackingStorage:s,externalEventSource:i,externalCookieManager:k}),w=new _variationConfiguration.VariationConfiguration(r);this.variationConfiguration=w,this.requester=n,this.trackingCache=o,this.dataManager=u,this.clientConfiguration=v,this.externalPackageInfo=j,this.offlineTrackingStorage=s,this.consentDataStorage=t,this.cookieManager=k}return _createClass(a,[{key:"initialize",value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.clientConfiguration.initialize(a);case 2:return c=b.sent,c.throw(),this.isOfflineModeOn=a,this.initialized=!0,b.abrupt("return",c.ok);case 7:case"end":return b.stop();}},b,this)}));return a}()},{key:"addData",value:function addData(a){var b;if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];(b=this.dataManager).addData.apply(b,[a].concat(d)).throw()}},{key:"getRemoteVisitorData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g,h,i,j,k,l,m,n,o,p;return _regeneratorRuntime().wrap(function q(b){for(;1;)switch(b.prev=b.next){case 0:if(c=a.visitorCode,d=a.shouldAddData,e=void 0===d||d,f=a.filters,g=void 0===f?_constants.DEFAULT_VISITOR_DATA_FILTERS:f,this.initialized){b.next=3;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);case 3:if(_utilities.Utilities.validateVisitorCode(c).throw(),h=g.previousVisitAmount,!("number"==typeof h&&(1>h||25<h))){b.next=7;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.VisitAmount);case 7:return b.next=9,this.requester.getVisitorData(c,g);case 9:i=b.sent,j=i.throw(),k=_utilities.Utilities.parseVisitorData({data:j,filters:g,visitorCode:c,variationConfiguration:this.variationConfiguration}),l=k.visitorData,m=k.visitsData,n=_createForOfIteratorHelper(l);try{for(n.s();!(o=n.n()).done;)p=o.value,(e||this.dataManager.isPersistentCustomData(p))&&this.addData(c,p)}catch(a){n.e(a)}finally{n.f()}return m&&e&&this.addData(c,m),b.abrupt("return",l);case 16:case"end":return b.stop();}},b,this)}));return a}()},{key:"trackConversion",value:function trackConversion(a){var b=a.visitorCode,c=a.goalId,d=a.revenue;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b)}},{key:"flush",value:function flush(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);if("string"==typeof a&&_utilities.Utilities.validateVisitorCode(a).throw(),a)return void _utilities.Utilities.trackData({visitorCode:a,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(a),offlineTrackingStorage:this.offlineTrackingStorage});if(!this.dataManager.unsentDataVisitors.length)return void _utilities.Utilities.sendOfflineTracking({requester:this.requester,storage:this.offlineTrackingStorage});var b,c=_createForOfIteratorHelper(this.dataManager.unsentDataVisitors);try{for(c.s();!(b=c.n()).done;){var d=b.value;_utilities.Utilities.trackData({visitorCode:d,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(d),offlineTrackingStorage:this.offlineTrackingStorage})}}catch(a){c.e(a)}finally{c.f()}}},{key:"getFeatureFlags",value:function getFeatureFlags(){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.clientConfiguration.featureFlags.map(function(a){var b=a.id,c=a.featureKey;return{id:b,key:c}})}},{key:"getVisitorFeatureFlags",value:function getVisitorFeatureFlags(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var b,c=this.clientConfiguration.featureFlags,d=[],e=this.dataManager.storedTargetingData[a],f=this.dataManager.getVisitorIdentifier(a),g=_createForOfIteratorHelper(c);try{for(g.s();!(b=g.n()).done;){var h=b.value,i=this.variationConfiguration.getVariation({visitorCode:a,visitorIdentifier:f,targetingData:e,featureFlag:h,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw();if(i.variationKey!==_constants.OFF_VARIATION_KEY&&h.environmentEnabled){var j=i.featureFlagId,k=i.featureKey;d.push({id:j,key:k})}}}catch(a){g.e(a)}finally{g.f()}return d}},{key:"getFeatureFlagVariationKey",value:function getFeatureFlagVariationKey(a,b){_utilities.Utilities.validateVisitorCode(a).throw();var c=this._getFeatureFlagVariation(a,b).throw(),d=c.variationKey;return d}},{key:"getFeatureFlagVariable",value:function getFeatureFlagVariable(a){var b,c=a.visitorCode,d=a.featureKey,e=a.variableKey;_utilities.Utilities.validateVisitorCode(c).throw();var f=this._getFeatureFlagVariation(c,d).throw(),g=f.variationKey,h=this.clientConfiguration.featureFlags,i=h.find(function(a){return a.featureKey===d});if(!i)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,d);var j=null===(b=i.variations.find(function(a){return a.key===g}))||void 0===b?void 0:b.variables.find(function(a){return a.key===e});if(!j)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariableNotFound,e,c);var k=_utilities.Utilities.parseFeatureVariable(j).throw();return k}},{key:"getFeatureFlagVariables",value:function getFeatureFlagVariables(a,b){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(a).throw();var c=this._getFeatureFlagVariation(a,b).throw(),d=c.variationKey,e=this.clientConfiguration.featureFlags,f=e.find(function(a){return a.featureKey===b});if(!f)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b);var g=f.variations.find(function(a){return a.key===d});if(!g)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariationNotFound,d,a);var h,i=[],j=_createForOfIteratorHelper(g.variables);try{for(j.s();!(h=j.n()).done;){var k=h.value,l=_utilities.Utilities.parseFeatureVariable(k).throw();i.push(l)}}catch(a){j.e(a)}finally{j.f()}return i}},{key:"isFeatureFlagActive",value:function isFeatureFlagActive(a,b){try{var c=this.getFeatureFlagVariationKey(a,b);return c!==_constants.OFF_VARIATION_KEY}catch(a){if(a instanceof _kameleoonError.KameleoonError&&a.type===_kameleoonError.KameleoonException.FeatureFlagEnvironmentDisabled)return!1;throw a}}},{key:"getRemoteData",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c;return _regeneratorRuntime().wrap(function d(b){for(;1;)switch(b.prev=b.next){case 0:return b.next=2,this.requester.getRemoteData(a);case 2:return c=b.sent,b.abrupt("return",c.throw());case 4:case"end":return b.stop();}},b,this)}));return a}()},{key:"getVisitorWarehouseAudience",value:function(){function a(a){return b.apply(this,arguments)}var b=_asyncToGenerator(_regeneratorRuntime().mark(function b(a){var c,d,e,f,g;return _regeneratorRuntime().wrap(function h(b){for(;1;)switch(b.prev=b.next){case 0:return c=a.visitorCode,d=a.customDataIndex,e=a.warehouseKey,_utilities.Utilities.validateVisitorCode(c).throw(),b.next=4,this.getRemoteData(e||c);case 4:if(f=b.sent,f){b.next=7;break}throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.RemoteData);case 7:if(f[_constants.WAREHOUSE_AUDIENCE_KEY]&&0!==Object.keys(f[_constants.WAREHOUSE_AUDIENCE_KEY]).length){b.next=9;break}return b.abrupt("return",null);case 9:return g=_construct(_kameleoonData.CustomData,[d].concat(_toConsumableArray(Object.keys(f[_constants.WAREHOUSE_AUDIENCE_KEY])))),this.dataManager.addData(c,g),b.abrupt("return",g);case 12:case"end":return b.stop();}},b,this)}));return a}()},{key:"onConfigurationUpdate",value:function onConfigurationUpdate(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);this.clientConfiguration.onConfigurationUpdate(a)}},{key:"getEngineTrackingCode",value:function getEngineTrackingCode(a){return _utilities.Utilities.validateVisitorCode(a).throw(),_utilities.Utilities.getTrackingCode(this.trackingCache,a)}},{key:"getVisitorCode",value:function getVisitorCode(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.cookieManager.getVisitorCode(a)}},{key:"setLegalConsent",value:function setLegalConsent(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);var b=a.visitorCode,c=a.consent;_utilities.Utilities.validateVisitorCode(b).throw(),this.consentDataStorage.update(_defineProperty({},b,c)),c?_utilities.Utilities.isServerEnvironment(a)?this.cookieManager.setCookie({visitorCode:a.visitorCode,response:a.response}):this.cookieManager.setCookie({visitorCode:a.visitorCode}):this.cookieManager.getConsentRequired()&&(_utilities.Utilities.isServerEnvironment(a)?this.cookieManager.setCookie({visitorCode:"",response:a.response}):this.cookieManager.setCookie({visitorCode:""}))}},{key:"_isConsentProvided",value:function _isConsentProvided(a){var b=this.clientConfiguration.isConsentRequired,c=this.consentDataStorage.read();return!b||c.ok&&c.data[a]}},{key:"_getFeatureFlagVariation",value:function _getFeatureFlagVariation(a,b){if(!this.initialized)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization));var c=this.clientConfiguration.featureFlags,d=c.find(function(a){return a.featureKey===b});if(!d)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b));if(!d.environmentEnabled)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagEnvironmentDisabled,d.featureKey,this.environment||_types.Environment.Production));var e=this.dataManager.storedTargetingData[a],f=this.dataManager.getVisitorIdentifier(a),g=this.variationConfiguration.getVariation({visitorCode:a,visitorIdentifier:f,featureFlag:d,targetingData:e,withAssignment:!0,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw(),h=g.experimentId,i=g.variationId;return"number"==typeof i&&"number"==typeof h&&_utilities.Utilities.updateCache({cacheManager:this.trackingCache,visitorCode:a,experimentId:h,variationId:i}),_utilities.Utilities.trackFeatureExperiment({visitorCode:a,requester:this.requester,featureFlagVariation:g,dataManager:this.dataManager,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(a),offlineTrackingStorage:this.offlineTrackingStorage}),(0,_tsRes.Ok)(g)}}]),a}();exports.KameleoonClient=KameleoonClient;
|
|
2
2
|
//# sourceMappingURL=kameleoonClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","a","b","siteCode","configuration","internalConfiguration","_classCallCheck","_defineProperty","f","ClientSettings","clientSettings","settings","environment","externalStorage","externalEventSource","externalPackageInfo","externalCookieManager","externalRequestDispatcher","externalClientConfiguration","requester","Requester","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","initialize","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","cookieManager","_createClass","key","value","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","useCache","c","wrap","d","prev","next","result","sent","throw","isOfflineModeOn","initialized","abrupt","ok","stop","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","length","data","Array","e","concat","g","h","i","j","k","l","m","n","o","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","VisitAmount","getVisitorData","visitorData","parseVisitorData","_createForOfIteratorHelper","s","done","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","Conversion","flush","trackData","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","getVisitorFeatureFlags","resultFeatureFlags","targetingData","storedTargetingData","featureFlag","variationData","getVariation","variationKey","OFF_VARIATION_KEY","environmentEnabled","featureFlagId","push","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","find","item","FeatureFlagConfigurationNotFound","variable","variations","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","type","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","_construct","CustomData","_toConsumableArray","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","getVisitorCode","params","setLegalConsent","consent","update","isServerEnvironment","setCookie","response","getConsentRequired","isConsentRequired","consentDataResult","read","Err","Environment","Production","withAssignment","experimentId","variationId","updateCache","cacheManager","trackFeatureExperiment","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { ClientConfiguration, JSONType } from './clientConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n DEFAULT_VISITOR_DATA_FILTERS,\n OFF_VARIATION_KEY,\n} from './constants';\nimport {\n Conversion,\n CustomData,\n DataManager,\n KameleoonDataType,\n} from './kameleoonData';\nimport { WAREHOUSE_AUDIENCE_KEY } from './constants';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport {\n TrackConversionParamsType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n RemoteVisitorDataParamsType,\n GetVisitorWarehouseAudienceParamsType,\n Environment,\n ServerGetVisitorCodeParametersType,\n ClientGetVisitorCodeParametersType,\n ServerSetLegalConsentParametersType,\n ClientSetLegalConsentParametersType,\n} from './types';\nimport { CookieManager } from './cookieManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport {\n ConsentDataType,\n IExternalStorage,\n OfflineTracking,\n} from './storage/types';\nimport { TargetingDataType } from './targeting';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving KameleoonData from Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getRemoteVisitorData: ({\n visitorCode,\n shouldAddData,\n filters,\n }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,\n * sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,\n * then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * the method first attempts to send all previously failed tracking requests which were stored locally during the offline mode.\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n flush: (visitorCode: string) => void;\n /**\n * @method getFeatureFlags - returns a list of feature flags stored in the client configuration\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getFeatureFlags: () => FeatureFlagType[];\n /**\n * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.StorageRead` - Couldn't read storage data\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n /**\n * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n /**\n * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getFeatureFlagVariables - returns a list of variables for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - a unique visitor identifier, shouldn't exceed 255 characters\n * @param {string} featureKey - a unique key for feature flag\n * @returns {FeatureVariableResultType[]} a list of variable objects containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariables: (\n visitorCode: string,\n featureKey: string,\n ) => FeatureVariableResultType[];\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getVisitorWarehouseAudience - an async method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences\n * which is stored for specified visitorCode on a remote Kameleoon server.\n * Retrieved data will be added to storage under the specified `customDataIndex`\n * @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details.\n * @returns {Promise<CustomData | null>} `Promise` containing an instance of `CustomData` containing data associated with a visitor's warehouse audiences or `null` if the data was retrieved successfully but nothing was found under the specified `warehouseKey`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` - The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getVisitorWarehouseAudience: ({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method getVisitorCode - obtains visitor code from cookie or storage, if the visitor code doesn't yet exist generates a random visitor code (or uses a provided default)\n * @param { ServerGetVisitorCodeParametersType | ClientGetVisitorCodeParametersType } params - an object of type `ServerGetVisitorCodeParametersType` or `ClientGetVisitorCodeParametersType`\n * @returns {string} result visitor code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getVisitorCode: (\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ) => string;\n /**\n * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status\n * @param {ServerSetLegalConsentParametersType | ClientSetLegalConsentParametersType} params - an object of type `ServerSetLegalConsentParametersType` or `ClientSetLegalConsentParametersType`\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n setLegalConsent: (\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ) => void;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration: VariationConfiguration;\n private clientConfiguration: ClientConfiguration;\n private dataManager: DataManager;\n private offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n private consentDataStorage: IExternalStorage<ConsentDataType>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n private initialized: boolean = false;\n private environment?: Environment;\n private cookieManager: CookieManager;\n\n /**\n * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core\n */\n constructor({\n siteCode,\n configuration,\n internalConfiguration,\n }: SDKCoreParameters) {\n const { settings: clientSettings } = new ClientSettings(\n siteCode,\n configuration,\n );\n this.environment = clientSettings.environment;\n const {\n externalStorage,\n externalEventSource,\n externalPackageInfo,\n externalCookieManager,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = externalStorage.initialize<ClientDataType>(\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = externalStorage.initialize<TargetingDataType>(\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = externalStorage.initialize<VariationDataType>(\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = externalStorage.initialize<OfflineTracking>(\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = externalStorage.initialize<ConsentDataType>(\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n externalEventSource,\n externalCookieManager,\n });\n\n const variationConfiguration = new VariationConfiguration(\n variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n this.requester = requester;\n this.trackingCache = trackingCache;\n this.dataManager = dataManager;\n this.clientConfiguration = clientConfiguration;\n this.externalPackageInfo = externalPackageInfo;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.consentDataStorage = consentDataStorage;\n this.cookieManager = externalCookieManager;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.clientConfiguration.initialize(useCache);\n result.throw();\n\n this.isOfflineModeOn = useCache;\n this.initialized = true;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.dataManager.addData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData({\n visitorCode,\n shouldAddData = true,\n filters = DEFAULT_VISITOR_DATA_FILTERS,\n }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]> {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { previousVisitAmount } = filters;\n\n if (\n typeof previousVisitAmount === 'number' &&\n (previousVisitAmount < 1 || previousVisitAmount > 25)\n ) {\n throw new KameleoonError(KameleoonException.VisitAmount);\n }\n\n const result = await this.requester.getVisitorData(visitorCode, filters);\n const data = result.throw();\n\n const visitorData = Utilities.parseVisitorData({\n data,\n filters,\n visitorCode,\n variationConfiguration: this.variationConfiguration,\n });\n\n for (const dataItem of visitorData) {\n if (shouldAddData || this.dataManager.isPersistentCustomData(dataItem)) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n return visitorData;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode);\n }\n\n public flush(visitorCode?: string): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n if (typeof visitorCode === 'string') {\n Utilities.validateVisitorCode(visitorCode).throw();\n }\n\n if (visitorCode) {\n Utilities.trackData({\n visitorCode,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n return;\n }\n\n // --- Note ---\n // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but\n // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped\n // due to lack of unsent data\n if (!this.dataManager.unsentDataVisitors.length) {\n Utilities.sendOfflineTracking({\n requester: this.requester,\n storage: this.offlineTrackingStorage,\n });\n return;\n }\n\n for (const visitorCodeKey of this.dataManager.unsentDataVisitors) {\n Utilities.trackData({\n visitorCode: visitorCodeKey,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCodeKey),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n }\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.clientConfiguration.featureFlags.map(({ id, featureKey }) => ({\n id,\n key: featureKey,\n }));\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n targetingData,\n featureFlag,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n if (\n variationData.variationKey !== OFF_VARIATION_KEY &&\n featureFlag.environmentEnabled\n ) {\n const { featureFlagId, featureKey } = variationData;\n\n resultFeatureFlags.push({ id: featureFlagId, key: featureKey });\n }\n }\n\n return resultFeatureFlags;\n }\n\n public getFeatureFlagVariationKey(\n visitorCode: string,\n featureKey: string,\n ): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public getFeatureFlagVariables(\n visitorCode: string,\n featureKey: string,\n ): FeatureVariableResultType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variation = featureFlag.variations.find(\n (item) => item.key === variationKey,\n );\n\n if (!variation) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariationNotFound,\n variationKey,\n visitorCode,\n );\n }\n\n const variables: FeatureVariableResultType[] = [];\n\n for (const variable of variation.variables) {\n const parsedVariable = Utilities.parseFeatureVariable(variable).throw();\n variables.push(parsedVariable);\n }\n\n return variables;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n try {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n } catch (err) {\n if (\n err instanceof KameleoonError &&\n err.type === KameleoonException.FeatureFlagEnvironmentDisabled\n ) {\n return false;\n }\n\n throw err;\n }\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public async getVisitorWarehouseAudience({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType): Promise<CustomData | null> {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const data = await this.getRemoteData(warehouseKey || visitorCode);\n\n if (!data) {\n throw new KameleoonError(KameleoonException.RemoteData);\n }\n\n if (\n !data[WAREHOUSE_AUDIENCE_KEY] ||\n Object.keys(data[WAREHOUSE_AUDIENCE_KEY]).length === 0\n ) {\n return null;\n }\n\n const customData = new CustomData(\n customDataIndex,\n ...Object.keys(data[WAREHOUSE_AUDIENCE_KEY]),\n );\n\n this.dataManager.addData(visitorCode, customData);\n\n return customData;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.clientConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n public getVisitorCode(\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ): string {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.cookieManager.getVisitorCode(params);\n }\n\n public setLegalConsent(\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const { visitorCode, consent } = params;\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n this.consentDataStorage.update({ [visitorCode]: consent });\n\n if (consent) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: params.visitorCode,\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: params.visitorCode });\n }\n } else {\n if (this.cookieManager.getConsentRequired()) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: '',\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: '' });\n }\n }\n }\n }\n\n private _isConsentProvided(visitorCode: string): boolean {\n const { isConsentRequired } = this.clientConfiguration;\n const consentDataResult = this.consentDataStorage.read();\n\n return (\n !isConsentRequired ||\n (consentDataResult.ok && consentDataResult.data[visitorCode])\n );\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.initialized) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n ),\n );\n }\n\n if (!featureFlag.environmentEnabled) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagEnvironmentDisabled,\n featureFlag.featureKey,\n this.environment || Environment.Production,\n ),\n );\n }\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n featureFlag,\n targetingData,\n withAssignment: true,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n const { experimentId, variationId } = variationData;\n\n if (typeof variationId === 'number' && typeof experimentId === 'number') {\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n }\n\n Utilities.trackFeatureExperiment({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n dataManager: this.dataManager,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"qgWAiTa,CAAAA,eAAe,YAiB1B,SAAAC,EAAAC,CAAA,CAIsB,IAHpB,CAAAC,CAAQ,CAAAD,CAAA,CAARC,QAAQ,CACRC,CAAa,CAAAF,CAAA,CAAbE,aAAa,CACbC,CAAqB,CAAAH,CAAA,CAArBG,qBAAqB,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,uCAAAA,eAAA,oCAAAA,eAAA,4BAAAA,eAAA,uCAAAA,eAAA,mCAAAA,eAAA,8BAAAA,eAAA,0BAAAA,eAAA,oCAAAA,eAAA,gCAAAA,eAAA,wBAAAA,eAAA,4BAAAA,eAAA,8BAErB,IAAAC,CAAA,CAAqC,GAAI,CAAAC,8BAAc,CACrDN,CAAQ,CACRC,CAAa,CACd,CAHiBM,CAAc,CAAAF,CAAA,CAAxBG,QAAQ,CAIhB,IAAI,CAACC,WAAW,CAAGF,CAAc,CAACE,WAAW,IAE3C,CAAAC,CAAe,CAMbR,CAAqB,CANvBQ,eAAe,CACfC,CAAmB,CAKjBT,CAAqB,CALvBS,mBAAmB,CACnBC,CAAmB,CAIjBV,CAAqB,CAJvBU,mBAAmB,CACnBC,CAAqB,C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,CACzB2K,oBAAoB,CAAEjE,CAAa,CACnCvF,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7B2B,eAAe,CAAE,IAAI,CAACA,eAAe,CACrC6C,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAACxC,CAAW,CAAC,CACvDrC,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAA6J,SAAE,EAAClE,CAAa,CACzB,CAAC,IAAA5H,CAAA,IAAA+L,OAAA,CAAAhM,eAAA,CAAAA,eAAA"}
|
|
1
|
+
{"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","a","b","siteCode","configuration","internalConfiguration","_classCallCheck","_defineProperty","f","ClientSettings","clientSettings","settings","environment","externalStorage","externalEventSource","externalPackageInfo","externalCookieManager","externalRequestDispatcher","externalClientConfiguration","requester","Requester","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","initialize","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","cookieManager","_createClass","key","value","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","useCache","c","wrap","d","prev","next","result","sent","throw","isOfflineModeOn","initialized","abrupt","ok","stop","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","length","data","Array","e","concat","g","h","i","j","k","l","m","n","o","p","q","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","VisitAmount","getVisitorData","parseVisitorData","visitorData","visitsData","_createForOfIteratorHelper","s","done","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","Conversion","flush","trackData","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","getVisitorFeatureFlags","resultFeatureFlags","targetingData","storedTargetingData","visitorIdentifier","getVisitorIdentifier","featureFlag","variationData","getVariation","variationKey","OFF_VARIATION_KEY","environmentEnabled","featureFlagId","push","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","find","item","FeatureFlagConfigurationNotFound","variable","variations","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","type","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","_construct","CustomData","_toConsumableArray","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","getVisitorCode","params","setLegalConsent","consent","update","isServerEnvironment","setCookie","response","getConsentRequired","isConsentRequired","consentDataResult","read","Err","Environment","Production","withAssignment","experimentId","variationId","updateCache","cacheManager","trackFeatureExperiment","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { ClientConfiguration, JSONType } from './clientConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n DEFAULT_VISITOR_DATA_FILTERS,\n OFF_VARIATION_KEY,\n} from './constants';\nimport {\n Conversion,\n CustomData,\n DataManager,\n KameleoonDataType,\n} from './kameleoonData';\nimport { WAREHOUSE_AUDIENCE_KEY } from './constants';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport {\n TrackConversionParamsType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n RemoteVisitorDataParamsType,\n GetVisitorWarehouseAudienceParamsType,\n Environment,\n ServerGetVisitorCodeParametersType,\n ClientGetVisitorCodeParametersType,\n ServerSetLegalConsentParametersType,\n ClientSetLegalConsentParametersType,\n} from './types';\nimport { CookieManager } from './cookieManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport {\n ConsentDataType,\n IExternalStorage,\n OfflineTracking,\n} from './storage/types';\nimport { TargetingDataType } from './targeting';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving KameleoonData from Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getRemoteVisitorData: ({\n visitorCode,\n shouldAddData,\n filters,\n }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,\n * sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,\n * then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * the method first attempts to send all previously failed tracking requests which were stored locally during the offline mode.\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n flush: (visitorCode: string) => void;\n /**\n * @method getFeatureFlags - returns a list of feature flags stored in the client configuration\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getFeatureFlags: () => FeatureFlagType[];\n /**\n * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.StorageRead` - Couldn't read storage data\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n /**\n * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n /**\n * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getFeatureFlagVariables - returns a list of variables for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - a unique visitor identifier, shouldn't exceed 255 characters\n * @param {string} featureKey - a unique key for feature flag\n * @returns {FeatureVariableResultType[]} a list of variable objects containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariables: (\n visitorCode: string,\n featureKey: string,\n ) => FeatureVariableResultType[];\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getVisitorWarehouseAudience - an async method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences\n * which is stored for specified visitorCode on a remote Kameleoon server.\n * Retrieved data will be added to storage under the specified `customDataIndex`\n * @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details.\n * @returns {Promise<CustomData | null>} `Promise` containing an instance of `CustomData` containing data associated with a visitor's warehouse audiences or `null` if the data was retrieved successfully but nothing was found under the specified `warehouseKey`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` - The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getVisitorWarehouseAudience: ({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method getVisitorCode - obtains visitor code from cookie or storage, if the visitor code doesn't yet exist generates a random visitor code (or uses a provided default)\n * @param { ServerGetVisitorCodeParametersType | ClientGetVisitorCodeParametersType } params - an object of type `ServerGetVisitorCodeParametersType` or `ClientGetVisitorCodeParametersType`\n * @returns {string} result visitor code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getVisitorCode: (\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ) => string;\n /**\n * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status\n * @param {ServerSetLegalConsentParametersType | ClientSetLegalConsentParametersType} params - an object of type `ServerSetLegalConsentParametersType` or `ClientSetLegalConsentParametersType`\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n setLegalConsent: (\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ) => void;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration: VariationConfiguration;\n private clientConfiguration: ClientConfiguration;\n private dataManager: DataManager;\n private offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n private consentDataStorage: IExternalStorage<ConsentDataType>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n private initialized: boolean = false;\n private environment?: Environment;\n private cookieManager: CookieManager;\n\n /**\n * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core\n */\n constructor({\n siteCode,\n configuration,\n internalConfiguration,\n }: SDKCoreParameters) {\n const { settings: clientSettings } = new ClientSettings(\n siteCode,\n configuration,\n );\n this.environment = clientSettings.environment;\n const {\n externalStorage,\n externalEventSource,\n externalPackageInfo,\n externalCookieManager,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = externalStorage.initialize<ClientDataType>(\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = externalStorage.initialize<TargetingDataType>(\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = externalStorage.initialize<VariationDataType>(\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = externalStorage.initialize<OfflineTracking>(\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = externalStorage.initialize<ConsentDataType>(\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n externalEventSource,\n externalCookieManager,\n });\n\n const variationConfiguration = new VariationConfiguration(\n variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n this.requester = requester;\n this.trackingCache = trackingCache;\n this.dataManager = dataManager;\n this.clientConfiguration = clientConfiguration;\n this.externalPackageInfo = externalPackageInfo;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.consentDataStorage = consentDataStorage;\n this.cookieManager = externalCookieManager;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.clientConfiguration.initialize(useCache);\n result.throw();\n\n this.isOfflineModeOn = useCache;\n this.initialized = true;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.dataManager.addData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData({\n visitorCode,\n shouldAddData = true,\n filters = DEFAULT_VISITOR_DATA_FILTERS,\n }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]> {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { previousVisitAmount } = filters;\n\n if (\n typeof previousVisitAmount === 'number' &&\n (previousVisitAmount < 1 || previousVisitAmount > 25)\n ) {\n throw new KameleoonError(KameleoonException.VisitAmount);\n }\n\n const result = await this.requester.getVisitorData(visitorCode, filters);\n const data = result.throw();\n\n const { visitorData, visitsData } = Utilities.parseVisitorData({\n data,\n filters,\n visitorCode,\n variationConfiguration: this.variationConfiguration,\n });\n\n for (const dataItem of visitorData) {\n if (shouldAddData || this.dataManager.isPersistentCustomData(dataItem)) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n // --- Note ---\n // Data on visits amount and time stamps is not returned to a user\n if (visitsData && shouldAddData) {\n this.addData(visitorCode, visitsData);\n }\n\n return visitorData;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode);\n }\n\n public flush(visitorCode?: string): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n if (typeof visitorCode === 'string') {\n Utilities.validateVisitorCode(visitorCode).throw();\n }\n\n if (visitorCode) {\n Utilities.trackData({\n visitorCode,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n return;\n }\n\n // --- Note ---\n // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but\n // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped\n // due to lack of unsent data\n if (!this.dataManager.unsentDataVisitors.length) {\n Utilities.sendOfflineTracking({\n requester: this.requester,\n storage: this.offlineTrackingStorage,\n });\n return;\n }\n\n for (const visitorCodeKey of this.dataManager.unsentDataVisitors) {\n Utilities.trackData({\n visitorCode: visitorCodeKey,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCodeKey),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n }\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.clientConfiguration.featureFlags.map(({ id, featureKey }) => ({\n id,\n key: featureKey,\n }));\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n const visitorIdentifier =\n this.dataManager.getVisitorIdentifier(visitorCode);\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n visitorIdentifier,\n targetingData,\n featureFlag,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n if (\n variationData.variationKey !== OFF_VARIATION_KEY &&\n featureFlag.environmentEnabled\n ) {\n const { featureFlagId, featureKey } = variationData;\n\n resultFeatureFlags.push({ id: featureFlagId, key: featureKey });\n }\n }\n\n return resultFeatureFlags;\n }\n\n public getFeatureFlagVariationKey(\n visitorCode: string,\n featureKey: string,\n ): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public getFeatureFlagVariables(\n visitorCode: string,\n featureKey: string,\n ): FeatureVariableResultType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variation = featureFlag.variations.find(\n (item) => item.key === variationKey,\n );\n\n if (!variation) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariationNotFound,\n variationKey,\n visitorCode,\n );\n }\n\n const variables: FeatureVariableResultType[] = [];\n\n for (const variable of variation.variables) {\n const parsedVariable = Utilities.parseFeatureVariable(variable).throw();\n variables.push(parsedVariable);\n }\n\n return variables;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n try {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n } catch (err) {\n if (\n err instanceof KameleoonError &&\n err.type === KameleoonException.FeatureFlagEnvironmentDisabled\n ) {\n return false;\n }\n\n throw err;\n }\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public async getVisitorWarehouseAudience({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType): Promise<CustomData | null> {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const data = await this.getRemoteData(warehouseKey || visitorCode);\n\n if (!data) {\n throw new KameleoonError(KameleoonException.RemoteData);\n }\n\n if (\n !data[WAREHOUSE_AUDIENCE_KEY] ||\n Object.keys(data[WAREHOUSE_AUDIENCE_KEY]).length === 0\n ) {\n return null;\n }\n\n const customData = new CustomData(\n customDataIndex,\n ...Object.keys(data[WAREHOUSE_AUDIENCE_KEY]),\n );\n\n this.dataManager.addData(visitorCode, customData);\n\n return customData;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.clientConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n public getVisitorCode(\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ): string {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.cookieManager.getVisitorCode(params);\n }\n\n public setLegalConsent(\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const { visitorCode, consent } = params;\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n this.consentDataStorage.update({ [visitorCode]: consent });\n\n if (consent) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: params.visitorCode,\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: params.visitorCode });\n }\n } else {\n if (this.cookieManager.getConsentRequired()) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: '',\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: '' });\n }\n }\n }\n }\n\n private _isConsentProvided(visitorCode: string): boolean {\n const { isConsentRequired } = this.clientConfiguration;\n const consentDataResult = this.consentDataStorage.read();\n\n return (\n !isConsentRequired ||\n (consentDataResult.ok && consentDataResult.data[visitorCode])\n );\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.initialized) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n ),\n );\n }\n\n if (!featureFlag.environmentEnabled) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagEnvironmentDisabled,\n featureFlag.featureKey,\n this.environment || Environment.Production,\n ),\n );\n }\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n const visitorIdentifier =\n this.dataManager.getVisitorIdentifier(visitorCode);\n\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n visitorIdentifier,\n featureFlag,\n targetingData,\n withAssignment: true,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n const { experimentId, variationId } = variationData;\n\n if (typeof variationId === 'number' && typeof experimentId === 'number') {\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n }\n\n Utilities.trackFeatureExperiment({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n dataManager: this.dataManager,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"qgWAiTa,CAAAA,eAAe,YAiB1B,SAAAC,EAAAC,CAAA,CAIsB,IAHpB,CAAAC,CAAQ,CAAAD,CAAA,CAARC,QAAQ,CACRC,CAAa,CAAAF,CAAA,CAAbE,aAAa,CACbC,CAAqB,CAAAH,CAAA,CAArBG,qBAAqB,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,uCAAAA,eAAA,oCAAAA,eAAA,4BAAAA,eAAA,uCAAAA,eAAA,mCAAAA,eAAA,8BAAAA,eAAA,0BAAAA,eAAA,oCAAAA,eAAA,gCAAAA,eAAA,wBAAAA,eAAA,4BAAAA,eAAA,8BAErB,IAAAC,CAAA,CAAqC,GAAI,CAAAC,8BAAc,CACrDN,CAAQ,CACRC,CAAa,CACd,CAHiBM,CAAc,CAAAF,CAAA,CAAxBG,QAAQ,CAIhB,IAAI,CAACC,WAAW,CAAGF,CAAc,CAACE,WAAW,IAE3C,CAAAC,CAAe,CAMbR,CAAqB,CANvBQ,eAAe,CACfC,CAAmB,CAKjBT,CAAqB,CALvBS,mBAAmB,CACnBC,CAAmB,CAIjBV,CAAqB,CAJvBU,mBAAmB,CACnBC,CAAqB,CAGnBX,CAAqB,CAHvBW,qBAAqB,CACrBC,CAAyB,CAEvBZ,CAAqB,CAFvBY,yBAAyB,CACzBC,CAA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C,MAnB2B,QAAQ,EAA/B,MAAO,CAAAA,CAAwB,EAA4B,QAAQ,EAAhC,MAAO,CAAAD,CAAyB,EACrEtH,oBAAS,CAACwH,WAAW,CAAC,CACpBC,YAAY,CAAE,IAAI,CAAC1K,aAAa,CAChCgD,WAAW,CAAXA,CAAW,CACXuH,YAAY,CAAZA,CAAY,CACZC,WAAW,CAAXA,CACF,CAAC,CAAC,CAGJvH,oBAAS,CAAC0H,sBAAsB,CAAC,CAC/B3H,WAAW,CAAXA,CAAW,CACXpD,SAAS,CAAE,IAAI,CAACA,SAAS,CACzBgL,oBAAoB,CAAEjE,CAAa,CACnC5F,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7B2B,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCgD,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAAC3C,CAAW,CAAC,CACvDrC,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAkK,SAAE,EAAClE,CAAa,CACzB,CAAC,IAAAjI,CAAA,IAAAoM,OAAA,CAAArM,eAAA,CAAAA,eAAA"}
|
|
@@ -8,6 +8,7 @@ export declare class CustomData implements IKameleoonData {
|
|
|
8
8
|
private index;
|
|
9
9
|
private value;
|
|
10
10
|
private sent;
|
|
11
|
+
private isIdentifier;
|
|
11
12
|
/**
|
|
12
13
|
* @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application
|
|
13
14
|
* @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows
|
|
@@ -36,6 +37,11 @@ export declare class CustomData implements IKameleoonData {
|
|
|
36
37
|
* */
|
|
37
38
|
get isSent(): boolean;
|
|
38
39
|
set isSent(value: boolean);
|
|
40
|
+
/**
|
|
41
|
+
* @property isMappingIdentifier - signifying if the data is a mapping identifier
|
|
42
|
+
* @private
|
|
43
|
+
* */
|
|
44
|
+
set _isMappingIdentifier(value: boolean);
|
|
39
45
|
/**
|
|
40
46
|
* @private
|
|
41
47
|
* @method _listFromVisits - an internal method for creating a list of custom data from a list of visits
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomData=void 0;var _requester=require("../requester"),_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 _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var CustomData=function(){function a(b){_classCallCheck(this,a),_defineProperty(this,"index",void 0),_defineProperty(this,"value",void 0),_defineProperty(this,"sent",void 0),this.index=b;for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];this.value=d,this.sent=!1}return _createClass(a,[{key:"url",get:function get(){if("number"!=typeof this.index)return"";var a=_toConsumableArray(new Set(this.value)),b={};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CustomData=void 0;var _requester=require("../requester"),_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 _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(a){return!1}}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var CustomData=function(){function a(b){_classCallCheck(this,a),_defineProperty(this,"index",void 0),_defineProperty(this,"value",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"isIdentifier",void 0),this.index=b;for(var c=arguments.length,d=Array(1<c?c-1:0),e=1;e<c;e++)d[e-1]=arguments[e];this.value=d,this.sent=!1,this.isIdentifier=!1}return _createClass(a,[{key:"url",get:function get(){if("number"!=typeof this.index)return"";var a=_toConsumableArray(new Set(this.value)),b={};if(a.forEach(function(a){b[a]=1}),!Object.keys(b).length)return"";var c="";return this.isIdentifier&&(c=_requester.UrlParameter.MappingIdentifier+"true"),_requester.UrlEventType.CustomData+_requester.UrlParameter.Index+this.index+_requester.UrlParameter.ValuesCountMap+encodeURIComponent(JSON.stringify(b))+_requester.UrlParameter.Overwrite+"true"+c}},{key:"data",get:function get(){return{index:this.index,value:this.value,type:_types.KameleoonData.CustomData,isIdentifier:this.isIdentifier,sent:this.sent}}},{key:"isSent",get:function get(){return this.sent},set:function set(a){this.sent=a}},{key:"_isMappingIdentifier",set:function set(a){this.isIdentifier=a}}],[{key:"_listFromVisits",value:function _listFromVisits(b){for(var c,d=[],e=new Map,f=b.length-1;0<=f;f--)if(c=b[f],!!c.customDataEvents){var g,h=c.customDataEvents,j=_createForOfIteratorHelper(h);try{for(j.s();!(g=j.n()).done;){var k=g.value,l=k.data,m=l.index,n=l.valuesCountMap;e.set(m,Object.keys(n))}}catch(a){j.e(a)}finally{j.f()}}var o,p=_createForOfIteratorHelper(e);try{for(p.s();!(o=p.n()).done;){var q=_slicedToArray(o.value,2),r=q[0],s=q[1];d.push(_construct(a,[r].concat(_toConsumableArray(s))))}}catch(a){p.e(a)}finally{p.f()}return d}}]),a}();exports.CustomData=CustomData;
|
|
2
2
|
//# sourceMappingURL=customData.js.map
|