@kameleoon/javascript-sdk-core 4.0.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/kameleoonClient.d.ts +2 -1
- package/dist/kameleoonClient.js +1 -1
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonClientInterface.d.ts +2 -2
- package/dist/kameleoonClientInterface.js.map +1 -1
- package/dist/kameleoonData/applicationVersion.d.ts +0 -9
- package/dist/kameleoonData/applicationVersion.js.map +1 -1
- package/dist/kameleoonData/browser.d.ts +3 -12
- package/dist/kameleoonData/browser.js +1 -1
- package/dist/kameleoonData/browser.js.map +1 -1
- package/dist/kameleoonData/conversion.d.ts +11 -13
- package/dist/kameleoonData/conversion.js +1 -1
- package/dist/kameleoonData/conversion.js.map +1 -1
- package/dist/kameleoonData/cookie.d.ts +0 -9
- package/dist/kameleoonData/cookie.js.map +1 -1
- package/dist/kameleoonData/customData.d.ts +3 -13
- package/dist/kameleoonData/customData.js +1 -1
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/dataManager.d.ts +11 -5
- package/dist/kameleoonData/dataManager.js +1 -1
- package/dist/kameleoonData/dataManager.js.map +1 -1
- package/dist/kameleoonData/dataProcessor.d.ts +13 -6
- package/dist/kameleoonData/dataProcessor.js +1 -1
- package/dist/kameleoonData/dataProcessor.js.map +1 -1
- package/dist/kameleoonData/device.d.ts +3 -12
- package/dist/kameleoonData/device.js +1 -1
- package/dist/kameleoonData/device.js.map +1 -1
- package/dist/kameleoonData/geolocation.d.ts +3 -12
- package/dist/kameleoonData/geolocation.js +1 -1
- package/dist/kameleoonData/geolocation.js.map +1 -1
- package/dist/kameleoonData/index.d.ts +1 -0
- package/dist/kameleoonData/index.js +1 -1
- package/dist/kameleoonData/index.js.map +1 -1
- package/dist/kameleoonData/kameleoonConversionScore.d.ts +15 -0
- package/dist/kameleoonData/kameleoonConversionScore.js +2 -0
- package/dist/kameleoonData/kameleoonConversionScore.js.map +1 -0
- package/dist/kameleoonData/operatingSystem.d.ts +3 -12
- package/dist/kameleoonData/operatingSystem.js +1 -1
- package/dist/kameleoonData/operatingSystem.js.map +1 -1
- package/dist/kameleoonData/pageView.d.ts +4 -13
- package/dist/kameleoonData/pageView.js +1 -1
- package/dist/kameleoonData/pageView.js.map +1 -1
- package/dist/kameleoonData/types.d.ts +54 -11
- package/dist/kameleoonData/types.js +1 -1
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/kameleoonData/userAgent.d.ts +0 -9
- package/dist/kameleoonData/userAgent.js.map +1 -1
- package/dist/kameleoonData/visitProcessor.d.ts +34 -0
- package/dist/kameleoonData/visitProcessor.js +2 -0
- package/dist/kameleoonData/visitProcessor.js.map +1 -0
- package/dist/kameleoonData/visitsData.d.ts +7 -21
- package/dist/kameleoonData/visitsData.js +1 -1
- package/dist/kameleoonData/visitsData.js.map +1 -1
- package/dist/requester/constants.js +1 -1
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/requester.d.ts +2 -3
- package/dist/requester/requester.js +1 -1
- package/dist/requester/requester.js.map +1 -1
- package/dist/requester/types.d.ts +14 -2
- package/dist/requester/types.js +1 -1
- package/dist/requester/types.js.map +1 -1
- package/dist/requester/urlProvider.d.ts +2 -3
- package/dist/requester/urlProvider.js +1 -1
- package/dist/requester/urlProvider.js.map +1 -1
- package/dist/storage/storage.js +1 -1
- package/dist/targeting/conditions/browser.js +1 -1
- package/dist/targeting/conditions/browser.js.map +1 -1
- package/dist/targeting/conditions/conditionFactory.js +1 -1
- package/dist/targeting/conditions/conditionFactory.js.map +1 -1
- package/dist/targeting/conditions/conversionLikelihood.d.ts +12 -0
- package/dist/targeting/conditions/conversionLikelihood.js +2 -0
- package/dist/targeting/conditions/conversionLikelihood.js.map +1 -0
- package/dist/targeting/conditions/firstVisit.js +1 -1
- package/dist/targeting/conditions/firstVisit.js.map +1 -1
- package/dist/targeting/conditions/geolocation.js +1 -1
- package/dist/targeting/conditions/geolocation.js.map +1 -1
- package/dist/targeting/conditions/index.d.ts +1 -0
- package/dist/targeting/conditions/index.js +1 -1
- package/dist/targeting/conditions/index.js.map +1 -1
- package/dist/targeting/conditions/lastVisit.js +1 -1
- package/dist/targeting/conditions/lastVisit.js.map +1 -1
- package/dist/targeting/conditions/newVisitor.js +1 -1
- package/dist/targeting/conditions/newVisitor.js.map +1 -1
- package/dist/targeting/conditions/sameDayVisits.js +1 -1
- package/dist/targeting/conditions/sameDayVisits.js.map +1 -1
- package/dist/targeting/conditions/targetFeatureFlag.js +1 -1
- package/dist/targeting/conditions/types.d.ts +3 -0
- package/dist/targeting/conditions/types.js.map +1 -1
- package/dist/targeting/conditions/visits.js +1 -1
- package/dist/targeting/conditions/visits.js.map +1 -1
- package/dist/targeting/index.d.ts +2 -2
- package/dist/targeting/index.js +1 -1
- package/dist/targeting/index.js.map +1 -1
- package/dist/targeting/types.d.ts +4 -0
- package/dist/targeting/types.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.js.map +1 -1
- package/dist/utilities/types.d.ts +6 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +1 -1
- package/dist/utilities/utilities.js +1 -1
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/types.d.ts +1 -1
- package/dist/variationConfiguration/types.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.1.0 (2024-04-19)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- New [Likelihood to Convert](https://developers.kameleoon.com/feature-management-and-experimentation/using-visit-history-in-feature-flags-and-experiments/#predefined-targeting-conditions) targeting condition.
|
|
8
|
+
- [`getRemoteVisitorData`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#getremotevisitordata) method now accepts new boolean parameter `isUniqueIdentifier` to obtain all linked visitors data when working with [Cross-device experimentation](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#cross-device-experimentation)
|
|
9
|
+
- Miscellaneous [Cross-device experimentation](https://developers.kameleoon.com/core-concepts/cross-device-experimentation) improvements
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fixed the issue with when `_` variable was transformed to duplicate identifier `a` causing `TypeError`
|
|
14
|
+
- Improved visits data collection logic
|
|
15
|
+
- `Browser` condition could throw an error when the browser version wasn't specified on Kameleoon Platform
|
|
16
|
+
- `Geolocation` condition is now case insensitive
|
|
17
|
+
- SDK Core version is no more sent with tracking
|
|
18
|
+
|
|
3
19
|
## 4.0.1 (2024-02-21)
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WAREHOUSE_AUDIENCE_KEY=exports.VISITOR_CODE_LENGTH=exports.SdkLanguageType=exports.OFF_VARIATION_KEY=exports.DEFAULT_VISITOR_DATA_FILTERS=exports.CACHE_ITEM_LIFETIME=exports.CACHE_CLEANUP_TIMEOUT=void 0;const OFF_VARIATION_KEY=exports.OFF_VARIATION_KEY="off",WAREHOUSE_AUDIENCE_KEY=exports.WAREHOUSE_AUDIENCE_KEY="warehouseAudiences",VISITOR_CODE_LENGTH=exports.VISITOR_CODE_LENGTH=16,CACHE_CLEANUP_TIMEOUT=exports.CACHE_CLEANUP_TIMEOUT=10,CACHE_ITEM_LIFETIME=exports.CACHE_ITEM_LIFETIME=5;let SdkLanguageType=exports.SdkLanguageType=function(a){return a.ANDROID="ANDROID",a.IOS="IOS",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACT="REACT",a.PYTHON="PYTHON",a.JAVASCRIPT="JAVASCRIPT",a.RUST="RUST",a}({});const DEFAULT_VISITOR_DATA_FILTERS=exports.DEFAULT_VISITOR_DATA_FILTERS={previousVisitAmount:1,currentVisit:!0,customData:!0,pageViews:!1,geolocation:!1,device:!1,browser:!1,operatingSystem:!1,conversions:!1,experiments:!1};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.WAREHOUSE_AUDIENCE_KEY=exports.VISITOR_CODE_LENGTH=exports.SdkLanguageType=exports.OFF_VARIATION_KEY=exports.DEFAULT_VISITOR_DATA_FILTERS=exports.CACHE_ITEM_LIFETIME=exports.CACHE_CLEANUP_TIMEOUT=void 0;const OFF_VARIATION_KEY=exports.OFF_VARIATION_KEY="off",WAREHOUSE_AUDIENCE_KEY=exports.WAREHOUSE_AUDIENCE_KEY="warehouseAudiences",VISITOR_CODE_LENGTH=exports.VISITOR_CODE_LENGTH=16,CACHE_CLEANUP_TIMEOUT=exports.CACHE_CLEANUP_TIMEOUT=10,CACHE_ITEM_LIFETIME=exports.CACHE_ITEM_LIFETIME=5;let SdkLanguageType=exports.SdkLanguageType=function(a){return a.ANDROID="ANDROID",a.IOS="IOS",a.JAVA="JAVA",a.CSHARP="CSHARP",a.NODEJS="NODEJS",a.PHP="PHP",a.RUBY="RUBY",a.GO="GO",a.FLUTTER="FLUTTER",a.REACT="REACT",a.PYTHON="PYTHON",a.JAVASCRIPT="JAVASCRIPT",a.RUST="RUST",a}({});const DEFAULT_VISITOR_DATA_FILTERS=exports.DEFAULT_VISITOR_DATA_FILTERS={previousVisitAmount:1,currentVisit:!0,customData:!0,pageViews:!1,geolocation:!1,device:!1,browser:!1,operatingSystem:!1,conversions:!1,experiments:!1,kcs:!1};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["OFF_VARIATION_KEY","exports","WAREHOUSE_AUDIENCE_KEY","VISITOR_CODE_LENGTH","CACHE_CLEANUP_TIMEOUT","CACHE_ITEM_LIFETIME","SdkLanguageType","ANDROID","IOS","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACT","PYTHON","JAVASCRIPT","RUST","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","currentVisit","customData","pageViews","geolocation","device","browser","operatingSystem","conversions","experiments"],"sources":["../src/constants.ts"],"sourcesContent":["import { VisitorDataFiltersType } from './utilities/types';\n\nexport const OFF_VARIATION_KEY = 'off';\nexport const WAREHOUSE_AUDIENCE_KEY = 'warehouseAudiences';\nexport const VISITOR_CODE_LENGTH = 16;\nexport const CACHE_CLEANUP_TIMEOUT = 10;\nexport const CACHE_ITEM_LIFETIME = 5;\n\n/**\n * @readonly\n * @enum {string} an Enum of all the possible Kameleoon SDK types\n * */\nexport enum SdkLanguageType {\n ANDROID = 'ANDROID',\n IOS = 'IOS',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACT = 'REACT',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n RUST = 'RUST',\n}\n\nexport const DEFAULT_VISITOR_DATA_FILTERS: VisitorDataFiltersType = {\n previousVisitAmount: 1,\n currentVisit: true,\n customData: true,\n pageViews: false,\n geolocation: false,\n device: false,\n browser: false,\n operatingSystem: false,\n conversions: false,\n experiments: false,\n};\n"],"mappings":"4RAEa,CAAAA,iBAAiB,CAAAC,OAAA,CAAAD,iBAAA,CAAG,KAAK,CACzBE,sBAAsB,CAAAD,OAAA,CAAAC,sBAAA,CAAG,oBAAoB,CAC7CC,mBAAmB,CAAAF,OAAA,CAAAE,mBAAA,CAAG,EAAE,CACxBC,qBAAqB,CAAAH,OAAA,CAAAG,qBAAA,CAAG,EAAE,CAC1BC,mBAAmB,CAAAJ,OAAA,CAAAI,mBAAA,CAAG,CAAC,IAMxB,CAAAC,eAAe,CAAAL,OAAA,CAAAK,eAAA,UAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,OAAA,WAAfD,CAAe,CAAAE,GAAA,OAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,CAAAI,MAAA,UAAfJ,CAAe,CAAAK,MAAA,UAAfL,CAAe,CAAAM,GAAA,OAAfN,CAAe,CAAAO,IAAA,QAAfP,CAAe,CAAAQ,EAAA,MAAfR,CAAe,CAAAS,OAAA,WAAfT,CAAe,CAAAU,KAAA,SAAfV,CAAe,CAAAW,MAAA,UAAfX,CAAe,CAAAY,UAAA,cAAfZ,CAAe,CAAAa,IAAA,QAAfb,CAAe,MAgBpB,KAAM,CAAAc,4BAAoD,CAAAnB,OAAA,CAAAmB,4BAAA,CAAG,CAClEC,mBAAmB,CAAE,CAAC,CACtBC,YAAY,GAAM,CAClBC,UAAU,GAAM,CAChBC,SAAS,GAAO,CAChBC,WAAW,GAAO,CAClBC,MAAM,GAAO,CACbC,OAAO,GAAO,CACdC,eAAe,GAAO,CACtBC,WAAW,GAAO,CAClBC,WAAW,
|
|
1
|
+
{"version":3,"file":"constants.js","names":["OFF_VARIATION_KEY","exports","WAREHOUSE_AUDIENCE_KEY","VISITOR_CODE_LENGTH","CACHE_CLEANUP_TIMEOUT","CACHE_ITEM_LIFETIME","SdkLanguageType","ANDROID","IOS","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACT","PYTHON","JAVASCRIPT","RUST","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","currentVisit","customData","pageViews","geolocation","device","browser","operatingSystem","conversions","experiments","kcs"],"sources":["../src/constants.ts"],"sourcesContent":["import { VisitorDataFiltersType } from './utilities/types';\n\nexport const OFF_VARIATION_KEY = 'off';\nexport const WAREHOUSE_AUDIENCE_KEY = 'warehouseAudiences';\nexport const VISITOR_CODE_LENGTH = 16;\nexport const CACHE_CLEANUP_TIMEOUT = 10;\nexport const CACHE_ITEM_LIFETIME = 5;\n\n/**\n * @readonly\n * @enum {string} an Enum of all the possible Kameleoon SDK types\n * */\nexport enum SdkLanguageType {\n ANDROID = 'ANDROID',\n IOS = 'IOS',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACT = 'REACT',\n PYTHON = 'PYTHON',\n JAVASCRIPT = 'JAVASCRIPT',\n RUST = 'RUST',\n}\n\nexport const DEFAULT_VISITOR_DATA_FILTERS: VisitorDataFiltersType = {\n previousVisitAmount: 1,\n currentVisit: true,\n customData: true,\n pageViews: false,\n geolocation: false,\n device: false,\n browser: false,\n operatingSystem: false,\n conversions: false,\n experiments: false,\n kcs: false,\n};\n"],"mappings":"4RAEa,CAAAA,iBAAiB,CAAAC,OAAA,CAAAD,iBAAA,CAAG,KAAK,CACzBE,sBAAsB,CAAAD,OAAA,CAAAC,sBAAA,CAAG,oBAAoB,CAC7CC,mBAAmB,CAAAF,OAAA,CAAAE,mBAAA,CAAG,EAAE,CACxBC,qBAAqB,CAAAH,OAAA,CAAAG,qBAAA,CAAG,EAAE,CAC1BC,mBAAmB,CAAAJ,OAAA,CAAAI,mBAAA,CAAG,CAAC,IAMxB,CAAAC,eAAe,CAAAL,OAAA,CAAAK,eAAA,UAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,OAAA,WAAfD,CAAe,CAAAE,GAAA,OAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,CAAAI,MAAA,UAAfJ,CAAe,CAAAK,MAAA,UAAfL,CAAe,CAAAM,GAAA,OAAfN,CAAe,CAAAO,IAAA,QAAfP,CAAe,CAAAQ,EAAA,MAAfR,CAAe,CAAAS,OAAA,WAAfT,CAAe,CAAAU,KAAA,SAAfV,CAAe,CAAAW,MAAA,UAAfX,CAAe,CAAAY,UAAA,cAAfZ,CAAe,CAAAa,IAAA,QAAfb,CAAe,MAgBpB,KAAM,CAAAc,4BAAoD,CAAAnB,OAAA,CAAAmB,4BAAA,CAAG,CAClEC,mBAAmB,CAAE,CAAC,CACtBC,YAAY,GAAM,CAClBC,UAAU,GAAM,CAChBC,SAAS,GAAO,CAChBC,WAAW,GAAO,CAClBC,MAAM,GAAO,CACbC,OAAO,GAAO,CACdC,eAAe,GAAO,CACtBC,WAAW,GAAO,CAClBC,WAAW,GAAO,CAClBC,GAAG,GACL,CAAC"}
|
|
@@ -26,7 +26,7 @@ export declare class KameleoonClient implements IKameleoonClient {
|
|
|
26
26
|
constructor({ siteCode, configuration, internalConfiguration, }: SDKCoreParameters);
|
|
27
27
|
initialize(useCache?: boolean): Promise<boolean>;
|
|
28
28
|
addData(visitorCode: string, ...data: KameleoonDataType[]): void;
|
|
29
|
-
getRemoteVisitorData({ visitorCode, shouldAddData, filters, }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]>;
|
|
29
|
+
getRemoteVisitorData({ visitorCode, shouldAddData, filters, isUniqueIdentifier, }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]>;
|
|
30
30
|
trackConversion({ visitorCode, goalId, revenue, isUniqueIdentifier, }: TrackConversionParamsType): void;
|
|
31
31
|
flush(visitorCode?: string, isUniqueIdentifier?: boolean): void;
|
|
32
32
|
getFeatureFlags(): FeatureFlagType[];
|
|
@@ -39,6 +39,7 @@ export declare class KameleoonClient implements IKameleoonClient {
|
|
|
39
39
|
getVisitorWarehouseAudience({ visitorCode, customDataIndex, warehouseKey, }: GetVisitorWarehouseAudienceParamsType): Promise<CustomData | null>;
|
|
40
40
|
onConfigurationUpdate(callback: () => void): void;
|
|
41
41
|
getEngineTrackingCode(visitorCode: string): string;
|
|
42
|
+
isInitialized(): boolean;
|
|
42
43
|
protected setUserConsent({ visitorCode, consent, setData, }: SetUserConsentParametersType): void;
|
|
43
44
|
private _isConsentProvided;
|
|
44
45
|
private _getFeatureFlagVariation;
|
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"),_eventSource=require("./eventSource"),_visitorCodeManager=require("./visitorCodeManager");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class KameleoonClient{constructor(a){let{siteCode:b,configuration:c,internalConfiguration:d}=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,"visitorCodeManager",void 0);const{settings:e}=new _clientSettings.ClientSettings(b,c);this.environment=e.environment;const{externalStorage:f,externalEventSource:g,externalPackageInfo:h,externalVisitorCodeManager:i,externalRequestDispatcher:j,externalClientConfiguration:k}=d,l=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),m=new _storage.DataStorage(f,_storage.KameleoonStorageKey.ClientData),n=new _storage.DataStorage(f,_storage.KameleoonStorageKey.TargetingData),o=new _storage.DataStorage(f,_storage.KameleoonStorageKey.VariationData),p=new _storage.DataStorage(f,_storage.KameleoonStorageKey.OfflineTracking),q=new _storage.DataStorage(f,_storage.KameleoonStorageKey.ConsentData),r=new _kameleoonData.DataManager({storage:n,targetingCleanupInterval:null===c||void 0===c?void 0:c.targetingDataCleanupInterval}),s=new _eventSource.KameleoonEventSource(e.siteCode,g),t=new _requester.Requester({siteCode:b,environment:e.environment,packageInfo:h,requestDispatcher:j}),u=new _clientConfiguration.ClientConfiguration({settings:e,storage:m,dataManager:r,requester:t,externalClientConfiguration:k,offlineTrackingStorage:p,eventSource:s,externalVisitorCodeManager:i}),v=new _variationConfiguration.VariationConfiguration(o);this.variationConfiguration=v,this.requester=t,this.trackingCache=l,this.dataManager=r,this.clientConfiguration=u,this.externalPackageInfo=h,this.offlineTrackingStorage=p,this.consentDataStorage=q,this.visitorCodeManager=i}async initialize(a){const b=await this.clientConfiguration.initialize();return b.throw(),this.isOfflineModeOn=a,this.initialized=!0,b.ok}addData(a){if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];this.dataManager.addData(a,...c).throw()}async getRemoteVisitorData(a){let{visitorCode:b,shouldAddData:c=!0,filters:d=_constants.DEFAULT_VISITOR_DATA_FILTERS}=a;if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(b).throw();const{previousVisitAmount:e}=d;if("number"==typeof e&&(1>e||25<e))throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.VisitAmount);const f=await this.requester.getVisitorData(b,d),g=f.throw(),{visitorData:h,visitsData:i}=_utilities.Utilities.parseVisitorData({data:g,filters:d,visitorCode:b,variationConfiguration:this.variationConfiguration});for(const d of h)(c||this.dataManager.isPersistentCustomData(d))&&this.addData(b,d);return i&&c&&this.addData(b,i),h}trackConversion(a){let{visitorCode:b,goalId:c,revenue:d,isUniqueIdentifier:e}=a;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b,e)}flush(a,b){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,isMappingIdentifier:b,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});for(const c of this.dataManager.unsentDataVisitors)_utilities.Utilities.trackData({visitorCode:c,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(c),offlineTrackingStorage:this.offlineTrackingStorage})}getFeatureFlags(){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.clientConfiguration.featureFlags.map(a=>{let{id:b,featureKey:c}=a;return{id:b,key:c}})}getVisitorFeatureFlags(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);const b=this.clientConfiguration.featureFlags,c=[],d=this.dataManager.storedTargetingData[a],e=this.dataManager.getVisitorIdentifier(a);for(const f of b){const b=this.variationConfiguration.getVariation({visitorCode:a,visitorIdentifier:e,targetingData:d,featureFlag:f,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw();if(b.variationKey!==_constants.OFF_VARIATION_KEY&&f.environmentEnabled){const{featureFlagId:a,featureKey:d}=b;c.push({id:a,key:d})}}return c}getFeatureFlagVariationKey(a,b){_utilities.Utilities.validateVisitorCode(a).throw();const{variationKey:c}=this._getFeatureFlagVariation(a,b).throw();return c}getFeatureFlagVariable(a){var b;let{visitorCode:c,featureKey:d,variableKey:e}=a;_utilities.Utilities.validateVisitorCode(c).throw();const{variationKey:f}=this._getFeatureFlagVariation(c,d).throw(),g=this.clientConfiguration.featureFlags,h=g.find(a=>a.featureKey===d);if(!h)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,d);const i=null===(b=h.variations.find(a=>a.key===f))||void 0===b?void 0:b.variables.find(a=>a.key===e);if(!i)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariableNotFound,e,c);const{type:j,value:k}=_utilities.Utilities.parseFeatureVariable(i).throw();return{type:j,value:k}}getFeatureFlagVariables(a,b){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(a).throw();const{variationKey:c}=this._getFeatureFlagVariation(a,b).throw(),d=this.clientConfiguration.featureFlags,e=d.find(a=>a.featureKey===b);if(!e)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b);const f=e.variations.find(a=>a.key===c);if(!f)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariationNotFound,c,a);const g=[];for(const c of f.variables){const a=_utilities.Utilities.parseFeatureVariable(c).throw();g.push(a)}return g}isFeatureFlagActive(a,b){try{const 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}}async getRemoteData(a){const b=await this.requester.getRemoteData(a);return b.throw()}async getVisitorWarehouseAudience(a){let{visitorCode:b,customDataIndex:c,warehouseKey:d}=a;_utilities.Utilities.validateVisitorCode(b).throw();const e=await this.getRemoteData(d||b);if(!e)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.RemoteData);if(!e[_constants.WAREHOUSE_AUDIENCE_KEY]||0===Object.keys(e[_constants.WAREHOUSE_AUDIENCE_KEY]).length)return null;const f=new _kameleoonData.CustomData(c,...Object.keys(e[_constants.WAREHOUSE_AUDIENCE_KEY]));return this.dataManager.addData(b,f),f}onConfigurationUpdate(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);this.clientConfiguration.onConfigurationUpdate(a)}getEngineTrackingCode(a){return _utilities.Utilities.validateVisitorCode(a).throw(),_utilities.Utilities.getTrackingCode(this.trackingCache,a)}setUserConsent(a){let{visitorCode:b,consent:c,setData:d}=a;_utilities.Utilities.validateVisitorCode(b).throw(),this.consentDataStorage.update({[b]:c}),c?d({visitorCode:b,key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_visitorCodeManager.DEFAULT_MAX_AGE,path:_visitorCodeManager.PATH}):this.visitorCodeManager.consentRequired&&d({visitorCode:"",key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_visitorCodeManager.ZERO_MAX_AGE,path:_visitorCodeManager.PATH})}_isConsentProvided(a){const{isConsentRequired:b}=this.clientConfiguration,c=this.consentDataStorage.read();return!b||c.ok&&c.data[a]}_getFeatureFlagVariation(a,b){if(!this.initialized)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization));const c=this.clientConfiguration.featureFlags,d=c.find(a=>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));const 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(),{experimentId:h,variationId:i}=g;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,variationConfiguration:this.variationConfiguration}),(0,_tsRes.Ok)(g)}}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"),_eventSource=require("./eventSource"),_visitorCodeManager=require("./visitorCodeManager");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class KameleoonClient{constructor(a){let{siteCode:b,configuration:c,internalConfiguration:d}=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,"visitorCodeManager",void 0);const{settings:e}=new _clientSettings.ClientSettings(b,c);this.environment=e.environment;const{externalStorage:f,externalEventSource:g,externalPackageInfo:h,externalVisitorCodeManager:i,externalRequestDispatcher:j,externalClientConfiguration:k}=d,l=new _cacheManager.CacheManager(_constants.CACHE_CLEANUP_TIMEOUT),m=new _storage.DataStorage(f,_storage.KameleoonStorageKey.ClientData),n=new _storage.DataStorage(f,_storage.KameleoonStorageKey.TargetingData),o=new _storage.DataStorage(f,_storage.KameleoonStorageKey.VariationData),p=new _storage.DataStorage(f,_storage.KameleoonStorageKey.OfflineTracking),q=new _storage.DataStorage(f,_storage.KameleoonStorageKey.ConsentData),r=new _kameleoonData.DataManager({storage:n,targetingCleanupInterval:null===c||void 0===c?void 0:c.targetingDataCleanupInterval}),s=new _eventSource.KameleoonEventSource(e.siteCode,g),t=new _requester.Requester({siteCode:b,environment:e.environment,packageInfo:h,requestDispatcher:j}),u=new _clientConfiguration.ClientConfiguration({settings:e,storage:m,dataManager:r,requester:t,externalClientConfiguration:k,offlineTrackingStorage:p,eventSource:s,externalVisitorCodeManager:i}),v=new _variationConfiguration.VariationConfiguration(o);this.variationConfiguration=v,this.requester=t,this.trackingCache=l,this.dataManager=r,this.clientConfiguration=u,this.externalPackageInfo=h,this.offlineTrackingStorage=p,this.consentDataStorage=q,this.visitorCodeManager=i}async initialize(a){const b=await this.clientConfiguration.initialize();return b.throw(),this.isOfflineModeOn=a,this.initialized=!0,b.ok}addData(a){if(_utilities.Utilities.validateVisitorCode(a).throw(),!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];this.dataManager.addData(a,...c).throw()}async getRemoteVisitorData(a){let{visitorCode:b,shouldAddData:c=!0,filters:d=_constants.DEFAULT_VISITOR_DATA_FILTERS,isUniqueIdentifier:e=!1}=a;if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(b).throw();const{previousVisitAmount:f}=d;if("number"==typeof f&&(1>f||25<f))throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.VisitAmount);const g=await this.requester.getVisitorData({visitorCode:b,filters:d,isMappingIdentifier:e}),h=g.throw(),{visitorData:i,storageVisitorData:j,visitsData:k}=_utilities.Utilities.parseVisitorData({data:h,filters:d,visitorCode:b,dataManager:this.dataManager,variationConfiguration:this.variationConfiguration});for(const d of j)(c||this.dataManager.isPersistentCustomData(d))&&this.addData(b,d);return k&&c&&this.addData(b,k),i}trackConversion(a){let{visitorCode:b,goalId:c,revenue:d,isUniqueIdentifier:e}=a;this.addData(b,new _kameleoonData.Conversion({goalId:c,revenue:d})),this.flush(b,e)}flush(a,b){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);if("string"==typeof a&&_utilities.Utilities.validateVisitorCode(a).throw(),a){let c=!1;if(b){const b=this.dataManager.getLinkedVisitor(a),d=this.dataManager.identifierCustomDataIndex;b||"number"!=typeof d?c=!0:this.dataManager.addData(a,new _kameleoonData.CustomData(d,a))}return void _utilities.Utilities.trackData({visitorCode:a,isMappingIdentifier:c,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});for(const c of this.dataManager.unsentDataVisitors)_utilities.Utilities.trackData({visitorCode:c,dataManager:this.dataManager,requester:this.requester,isOfflineModeOn:this.isOfflineModeOn,isConsentProvided:this._isConsentProvided(c),offlineTrackingStorage:this.offlineTrackingStorage})}getFeatureFlags(){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);return this.clientConfiguration.featureFlags.map(a=>{let{id:b,featureKey:c}=a;return{id:b,key:c}})}getVisitorFeatureFlags(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);const b=this.clientConfiguration.featureFlags,c=[],d=this.dataManager.getTargetingData(a),e=this.dataManager.getVisitorIdentifier(a);for(const f of b){const b=this.variationConfiguration.getVariation({visitorCode:a,visitorIdentifier:e,targetingData:d,featureFlag:f,clientConfiguration:this.clientConfiguration,dataManager:this.dataManager,packageInfo:this.externalPackageInfo}).throw();if(b.variationKey!==_constants.OFF_VARIATION_KEY&&f.environmentEnabled){const{featureFlagId:a,featureKey:d}=b;c.push({id:a,key:d})}}return c}getFeatureFlagVariationKey(a,b){_utilities.Utilities.validateVisitorCode(a).throw();const{variationKey:c}=this._getFeatureFlagVariation(a,b).throw();return c}getFeatureFlagVariable(a){var b;let{visitorCode:c,featureKey:d,variableKey:e}=a;_utilities.Utilities.validateVisitorCode(c).throw();const{variationKey:f}=this._getFeatureFlagVariation(c,d).throw(),g=this.clientConfiguration.featureFlags,h=g.find(a=>a.featureKey===d);if(!h)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,d);const i=null===(b=h.variations.find(a=>a.key===f))||void 0===b?void 0:b.variables.find(a=>a.key===e);if(!i)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariableNotFound,e,c);const{type:j,value:k}=_utilities.Utilities.parseFeatureVariable(i).throw();return{type:j,value:k}}getFeatureFlagVariables(a,b){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);_utilities.Utilities.validateVisitorCode(a).throw();const{variationKey:c}=this._getFeatureFlagVariation(a,b).throw(),d=this.clientConfiguration.featureFlags,e=d.find(a=>a.featureKey===b);if(!e)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagConfigurationNotFound,b);const f=e.variations.find(a=>a.key===c);if(!f)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.FeatureFlagVariationNotFound,c,a);const g=[];for(const c of f.variables){const a=_utilities.Utilities.parseFeatureVariable(c).throw();g.push(a)}return g}isFeatureFlagActive(a,b){try{const 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}}async getRemoteData(a){const b=await this.requester.getRemoteData(a);return b.throw()}async getVisitorWarehouseAudience(a){let{visitorCode:b,customDataIndex:c,warehouseKey:d}=a;_utilities.Utilities.validateVisitorCode(b).throw();const e=await this.getRemoteData(d||b);if(!e)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.RemoteData);if(!e[_constants.WAREHOUSE_AUDIENCE_KEY]||0===Object.keys(e[_constants.WAREHOUSE_AUDIENCE_KEY]).length)return null;const f=new _kameleoonData.CustomData(c,...Object.keys(e[_constants.WAREHOUSE_AUDIENCE_KEY]));return this.dataManager.addData(b,f),f}onConfigurationUpdate(a){if(!this.initialized)throw new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization);this.clientConfiguration.onConfigurationUpdate(a)}getEngineTrackingCode(a){return _utilities.Utilities.validateVisitorCode(a).throw(),_utilities.Utilities.getTrackingCode(this.trackingCache,a)}isInitialized(){return this.initialized}setUserConsent(a){let{visitorCode:b,consent:c,setData:d}=a;_utilities.Utilities.validateVisitorCode(b).throw(),this.consentDataStorage.update({[b]:c}),c?d({visitorCode:b,key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_visitorCodeManager.DEFAULT_MAX_AGE,path:_visitorCodeManager.PATH}):this.visitorCodeManager.consentRequired&&d({visitorCode:"",key:_storage.KameleoonStorageKey.VisitorCode,maxAge:_visitorCodeManager.ZERO_MAX_AGE,path:_visitorCodeManager.PATH})}_isConsentProvided(a){const{isConsentRequired:b}=this.clientConfiguration,c=this.consentDataStorage.read();return!b||c.ok&&c.data[a]}_getFeatureFlagVariation(a,b){if(!this.initialized)return(0,_tsRes.Err)(new _kameleoonError.KameleoonError(_kameleoonError.KameleoonException.Initialization));const c=this.clientConfiguration.featureFlags,d=c.find(a=>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));const e=this.dataManager.getTargetingData(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(),{experimentId:h,variationId:i}=g;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,variationConfiguration:this.variationConfiguration}),(0,_tsRes.Ok)(g)}}exports.KameleoonClient=KameleoonClient;
|
|
2
2
|
//# sourceMappingURL=kameleoonClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","constructor","a","siteCode","configuration","internalConfiguration","_defineProperty","settings","clientSettings","ClientSettings","environment","externalStorage","externalEventSource","externalPackageInfo","externalVisitorCodeManager","externalRequestDispatcher","externalClientConfiguration","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","DataStorage","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","eventSource","KameleoonEventSource","requester","Requester","packageInfo","requestDispatcher","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","visitorCodeManager","initialize","useCache","result","throw","isOfflineModeOn","initialized","ok","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","b","arguments","length","data","Array","d","getRemoteVisitorData","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","VisitAmount","getVisitorData","visitorData","visitsData","parseVisitorData","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","isUniqueIdentifier","Conversion","flush","trackData","isMappingIdentifier","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","key","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","type","value","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","getVisitorWarehouseAudience","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","CustomData","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","setUserConsent","consent","setData","update","VisitorCode","maxAge","DEFAULT_MAX_AGE","path","PATH","consentRequired","ZERO_MAX_AGE","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 DataStorage,\n ConsentDataType,\n IStorage,\n OfflineTracking,\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 SetUserConsentParametersType,\n FeatureFlagVariableType,\n} from './types';\nimport { IVisitorCodeManager } from './visitorCodeManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport { TargetingDataType } from './targeting';\nimport { KameleoonEventSource } from './eventSource';\nimport { IKameleoonClient } from './kameleoonClientInterface';\nimport { DEFAULT_MAX_AGE, PATH, ZERO_MAX_AGE } from './visitorCodeManager';\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: IStorage<OfflineTracking>;\n private consentDataStorage: IStorage<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 visitorCodeManager: IVisitorCodeManager;\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 externalVisitorCodeManager,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = new DataStorage<ClientDataType>(\n externalStorage,\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = new DataStorage<TargetingDataType>(\n externalStorage,\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = new DataStorage<VariationDataType>(\n externalStorage,\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = new DataStorage<OfflineTracking>(\n externalStorage,\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = new DataStorage<ConsentDataType>(\n externalStorage,\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const eventSource = new KameleoonEventSource(\n clientSettings.siteCode,\n externalEventSource,\n );\n\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n eventSource,\n externalVisitorCodeManager,\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.visitorCodeManager = externalVisitorCodeManager;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.clientConfiguration.initialize();\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 isUniqueIdentifier,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode, isUniqueIdentifier);\n }\n\n public flush(visitorCode?: string, isUniqueIdentifier?: boolean): 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 isMappingIdentifier: isUniqueIdentifier,\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): FeatureFlagVariableType {\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 { type, value } = Utilities.parseFeatureVariable(variable).throw();\n\n return { type, value } as FeatureFlagVariableType;\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 protected setUserConsent({\n visitorCode,\n consent,\n setData,\n }: SetUserConsentParametersType): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n this.consentDataStorage.update({ [visitorCode]: consent });\n\n if (consent) {\n setData({\n visitorCode,\n key: KameleoonStorageKey.VisitorCode,\n maxAge: DEFAULT_MAX_AGE,\n path: PATH,\n });\n } else {\n if (this.visitorCodeManager.consentRequired) {\n setData({\n visitorCode: '',\n key: KameleoonStorageKey.VisitorCode,\n maxAge: ZERO_MAX_AGE,\n path: PATH,\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 variationConfiguration: this.variationConfiguration,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"upCAyDO,KAAM,CAAAA,eAA4C,CAiBvDC,WAAWA,CAAAC,CAAA,CAIW,IAJV,CACVC,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,qBAAqB,CAArBA,CACiB,CAAC,CAAAH,CAAA,CAAAI,eAAA,uCAAAA,eAAA,oCAAAA,eAAA,4BAAAA,eAAA,uCAAAA,eAAA,mCAAAA,eAAA,8BAAAA,eAAA,0BAAAA,eAAA,oCAAAA,eAAA,gCAAAA,eAAA,wBAAAA,eAAA,4BAAAA,eAAA,mCAClB,KAAM,CAAEC,QAAQ,CAAEC,CAAe,CAAC,CAAG,GAAI,CAAAC,8BAAc,CACrDN,CAAQ,CACRC,CACF,CAAC,CACD,IAAI,CAACM,WAAW,CAAGF,CAAc,CAACE,WAAW,MACvC,CACJC,eAAe,CAAfA,CAAe,CACfC,mBAAmB,CAAnBA,CAAmB,CACnBC,mBAAmB,CAAnBA,CAAmB,CACnBC,0BAA0B,CAA1BA,CAA0B,CAC1BC,yBAAyB,CAAzBA,CAAyB,CACzBC,2BAA2B,CAA3BA,CACF,CAAC,CAAGX,CAAqB,CACnBY,CAAa,CAAG,GAAI,CAAAC,0BAAY,CACpCC,gCACF,CAAC,CAEKC,CAAiB,CAAG,GAAI,CAAAC,oBAAW,CACvCV,CAAe,CACfW,4BAAmB,CAACC,UACtB,CAAC,CACKC,CAAoB,CAAG,GAAI,CAAAH,oBAAW,CAC1CV,CAAe,CACfW,4BAAmB,CAACG,aACtB,CAAC,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AE,IAAI,CAACA,SAAS,CACzBqI,oBAAoB,CAAElE,CAAa,CACnC1E,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7BoB,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCoC,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAACjC,CAAW,CAAC,CACvD5B,sBAAsB,CAAE,IAAI,CAACA,sBAAsB,CACnDiB,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAgI,SAAE,EAACnE,CAAa,CACzB,CACF,CAACoE,OAAA,CAAA9K,eAAA,CAAAA,eAAA"}
|
|
1
|
+
{"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","constructor","a","siteCode","configuration","internalConfiguration","_defineProperty","settings","clientSettings","ClientSettings","environment","externalStorage","externalEventSource","externalPackageInfo","externalVisitorCodeManager","externalRequestDispatcher","externalClientConfiguration","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","DataStorage","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","eventSource","KameleoonEventSource","requester","Requester","packageInfo","requestDispatcher","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","visitorCodeManager","initialize","useCache","result","throw","isOfflineModeOn","initialized","ok","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","b","arguments","length","data","Array","d","getRemoteVisitorData","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","isUniqueIdentifier","previousVisitAmount","VisitAmount","getVisitorData","isMappingIdentifier","visitorData","storageVisitorData","visitsData","parseVisitorData","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","Conversion","flush","linkedVisitor","getLinkedVisitor","index","identifierCustomDataIndex","CustomData","trackData","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","key","getVisitorFeatureFlags","resultFeatureFlags","targetingData","getTargetingData","visitorIdentifier","getVisitorIdentifier","featureFlag","variationData","getVariation","variationKey","OFF_VARIATION_KEY","environmentEnabled","featureFlagId","push","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","find","item","FeatureFlagConfigurationNotFound","variable","variations","variables","FeatureFlagVariableNotFound","type","value","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","getVisitorWarehouseAudience","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","isInitialized","setUserConsent","consent","setData","update","VisitorCode","maxAge","DEFAULT_MAX_AGE","path","PATH","consentRequired","ZERO_MAX_AGE","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 DataStorage,\n ConsentDataType,\n IStorage,\n OfflineTracking,\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 SetUserConsentParametersType,\n FeatureFlagVariableType,\n} from './types';\nimport { IVisitorCodeManager } from './visitorCodeManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport { TargetingDataType } from './targeting';\nimport { KameleoonEventSource } from './eventSource';\nimport { IKameleoonClient } from './kameleoonClientInterface';\nimport { DEFAULT_MAX_AGE, PATH, ZERO_MAX_AGE } from './visitorCodeManager';\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: IStorage<OfflineTracking>;\n private consentDataStorage: IStorage<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 visitorCodeManager: IVisitorCodeManager;\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 externalVisitorCodeManager,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = new DataStorage<ClientDataType>(\n externalStorage,\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = new DataStorage<TargetingDataType>(\n externalStorage,\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = new DataStorage<VariationDataType>(\n externalStorage,\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = new DataStorage<OfflineTracking>(\n externalStorage,\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = new DataStorage<ConsentDataType>(\n externalStorage,\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const eventSource = new KameleoonEventSource(\n clientSettings.siteCode,\n externalEventSource,\n );\n\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n eventSource,\n externalVisitorCodeManager,\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.visitorCodeManager = externalVisitorCodeManager;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.clientConfiguration.initialize();\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 isUniqueIdentifier = false,\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({\n visitorCode,\n filters,\n isMappingIdentifier: isUniqueIdentifier,\n });\n const data = result.throw();\n\n const { visitorData, storageVisitorData, visitsData } =\n Utilities.parseVisitorData({\n data,\n filters,\n visitorCode,\n dataManager: this.dataManager,\n variationConfiguration: this.variationConfiguration,\n });\n\n for (const dataItem of storageVisitorData) {\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 isUniqueIdentifier,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode, isUniqueIdentifier);\n }\n\n public flush(visitorCode?: string, isUniqueIdentifier?: boolean): 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 let isMappingIdentifier = false;\n\n // --- Note ---\n // This part is a workaround for Data API\n // If there's is no unique identifier for the visitor\n // We do reconciliation for visitor with himself\n if (isUniqueIdentifier) {\n const linkedVisitor = this.dataManager.getLinkedVisitor(visitorCode);\n const index = this.dataManager.identifierCustomDataIndex;\n\n if (!linkedVisitor && typeof index === 'number') {\n this.dataManager.addData(\n visitorCode,\n new CustomData(index, visitorCode),\n );\n } else {\n isMappingIdentifier = true;\n }\n }\n\n Utilities.trackData({\n visitorCode,\n isMappingIdentifier,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\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.getTargetingData(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): FeatureFlagVariableType {\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 { type, value } = Utilities.parseFeatureVariable(variable).throw();\n\n return { type, value } as FeatureFlagVariableType;\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 isInitialized(): boolean {\n return this.initialized;\n }\n\n protected setUserConsent({\n visitorCode,\n consent,\n setData,\n }: SetUserConsentParametersType): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n this.consentDataStorage.update({ [visitorCode]: consent });\n\n if (consent) {\n setData({\n visitorCode,\n key: KameleoonStorageKey.VisitorCode,\n maxAge: DEFAULT_MAX_AGE,\n path: PATH,\n });\n } else {\n if (this.visitorCodeManager.consentRequired) {\n setData({\n visitorCode: '',\n key: KameleoonStorageKey.VisitorCode,\n maxAge: ZERO_MAX_AGE,\n path: PATH,\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.getTargetingData(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 variationConfiguration: this.variationConfiguration,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"upCAyDO,KAAM,CAAAA,eAA4C,CAiBvDC,WAAWA,CAAAC,CAAA,CAIW,IAJV,CACVC,QAAQ,CAARA,CAAQ,CACRC,aAAa,CAAbA,CAAa,CACbC,qBAAqB,CAArBA,CACiB,CAAC,CAAAH,CAAA,CAAAI,eAAA,uCAAAA,eAAA,oCAAAA,eAAA,4BAAAA,eAAA,uCAAAA,eAAA,mCAAAA,eAAA,8BAAAA,eAAA,0BAAAA,eAAA,oCAAAA,eAAA,gCAAAA,eAAA,wBAAAA,eAAA,4BAAAA,eAAA,mCAClB,KAAM,CAAEC,QAAQ,CAAEC,CAAe,CAAC,CAAG,GAAI,CAAAC,8BAAc,CACrDN,CAAQ,CACRC,CACF,CAAC,CACD,IAAI,CAACM,WAAW,CAAGF,CAAc,CAACE,WAAW,MACvC,CACJC,eAAe,CAAfA,CAAe,CACfC,mBAAmB,CAAnBA,CAAmB,CACnBC,mBAAmB,CAAnBA,CAAmB,CACnBC,0BAA0B,CAA1BA,CAA0B,CAC1BC,yBAAyB,CAAzBA,CAAyB,CACzBC,2BAA2B,CAA3BA,CACF,CAAC,CAAGX,CAAqB,CACnBY,CAAa,CAAG,GAAI,CAAAC,0BAAY,CACpCC,gCACF,CAAC,CAEKC,CAAiB,CAAG,GAAI,CAAAC,oBAAW,CACvCV,CAAe,CACfW,4BAAmB,CAACC,UACtB,CAAC,CACKC,CAAoB,CAAG,GAAI,CAAAH,oBAAW,CAC1CV,CAAe,CACfW,4BAAmB,CAACG,aACtB,CAAC,CACKC,CAAoB,CAAG,GAAI,CAAAL,oBAAW,CAC1CV,CAAe,CACfW,4BAAmB,CAACK,aACtB,CAAC,CACKC,CAAsB,CAAG,GAAI,CAAAP,oBAAW,CAC5CV,C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E,IAAI,CAAC5B,mBACpB,CAAC,CAAC,CACDsC,KAAK,CAAC,CAAC,CAEJ,CAAE0H,YAAY,CAAZA,CAAY,CAAEC,WAAW,CAAXA,CAAY,CAAC,CAAG9D,CAAa,CAsBnD,MApB2B,QAAQ,EAA/B,MAAO,CAAA8D,CAAwB,EAA4B,QAAQ,EAAhC,MAAO,CAAAD,CAAyB,EACrEpH,oBAAS,CAACsH,WAAW,CAAC,CACpBC,YAAY,CAAE,IAAI,CAAC/J,aAAa,CAChCuC,WAAW,CAAXA,CAAW,CACXqH,YAAY,CAAZA,CAAY,CACZC,WAAW,CAAXA,CACF,CAAC,CAAC,CAGJrH,oBAAS,CAACwH,sBAAsB,CAAC,CAC/BzH,WAAW,CAAXA,CAAW,CACXjB,SAAS,CAAE,IAAI,CAACA,SAAS,CACzB2I,oBAAoB,CAAElE,CAAa,CACnChF,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7BoB,eAAe,CAAE,IAAI,CAACA,eAAe,CACrC0C,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAACvC,CAAW,CAAC,CACvD5B,sBAAsB,CAAE,IAAI,CAACA,sBAAsB,CACnDiB,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAsI,SAAE,EAACnE,CAAa,CACzB,CACF,CAACoE,OAAA,CAAApL,eAAA,CAAAA,eAAA"}
|
|
@@ -32,7 +32,7 @@ export interface IKameleoonClient {
|
|
|
32
32
|
addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;
|
|
33
33
|
/**
|
|
34
34
|
* @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.
|
|
35
|
-
* @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `
|
|
35
|
+
* @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData`, `filters` and `isUniqueIdentifier` parameters
|
|
36
36
|
* @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data
|
|
37
37
|
* @throws `KameleoonError` with one of the following `type` s:
|
|
38
38
|
*
|
|
@@ -42,7 +42,7 @@ export interface IKameleoonClient {
|
|
|
42
42
|
* - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25
|
|
43
43
|
* - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call
|
|
44
44
|
*/
|
|
45
|
-
getRemoteVisitorData: ({ visitorCode, shouldAddData, filters, }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;
|
|
45
|
+
getRemoteVisitorData: ({ visitorCode, shouldAddData, filters, isUniqueIdentifier, }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;
|
|
46
46
|
/**
|
|
47
47
|
* @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
|
|
48
48
|
* @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClientInterface.js","names":[],"sources":["../src/kameleoonClientInterface.ts"],"sourcesContent":["import { JSONType } from './clientConfiguration';\nimport { CustomData, KameleoonDataType } from './kameleoonData';\nimport {\n FeatureFlagType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n GetFeatureFlagVariableParamsType,\n GetVisitorWarehouseAudienceParamsType,\n RemoteVisitorDataParamsType,\n TrackConversionParamsType,\n} from './types';\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 isUniqueIdentifier,\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 * @param {boolean | undefined} isUniqueIdentifier - an optional parameter for specifying if the visitorCode is a unique identifier, default value is `false`\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, isUniqueIdentifier?: boolean) => 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 {FeatureFlagVariableType} a variable object containing `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.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) => FeatureFlagVariableType;\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 `key`, `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.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 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"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"kameleoonClientInterface.js","names":[],"sources":["../src/kameleoonClientInterface.ts"],"sourcesContent":["import { JSONType } from './clientConfiguration';\nimport { CustomData, KameleoonDataType } from './kameleoonData';\nimport {\n FeatureFlagType,\n FeatureFlagVariableType,\n FeatureVariableResultType,\n GetFeatureFlagVariableParamsType,\n GetVisitorWarehouseAudienceParamsType,\n RemoteVisitorDataParamsType,\n TrackConversionParamsType,\n} from './types';\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`, `filters` and `isUniqueIdentifier` 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 isUniqueIdentifier,\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 isUniqueIdentifier,\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 * @param {boolean | undefined} isUniqueIdentifier - an optional parameter for specifying if the visitorCode is a unique identifier, default value is `false`\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, isUniqueIdentifier?: boolean) => 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 {FeatureFlagVariableType} a variable object containing `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.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) => FeatureFlagVariableType;\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 `key`, `type` and `value` fields. You can check the `type` field against `VariableType` enum. For example, if the `type` is `VariableType.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 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"],"mappings":""}
|
|
@@ -10,17 +10,8 @@ export declare class ApplicationVersion implements IKameleoonData {
|
|
|
10
10
|
* @param {string} version - version of mobile application
|
|
11
11
|
* */
|
|
12
12
|
constructor(version: string);
|
|
13
|
-
/**
|
|
14
|
-
* @property url - url for the current data type used for events tracking
|
|
15
|
-
* */
|
|
16
13
|
get url(): string;
|
|
17
|
-
/**
|
|
18
|
-
* @property data - data of the current class instance
|
|
19
|
-
* */
|
|
20
14
|
get data(): ApplicationVersionDataType;
|
|
21
|
-
/**
|
|
22
|
-
* @property isSent - signifying if the data was sent already tracked
|
|
23
|
-
* */
|
|
24
15
|
get isSent(): boolean;
|
|
25
16
|
set isSent(value: boolean);
|
|
26
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationVersion.js","names":["_types","require","Object","defineProperty","exports","value","ApplicationVersion","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","version","sent","url","data","type","KameleoonData","isSent"],"sources":["../../src/kameleoonData/applicationVersion.ts"],"sourcesContent":["import {\n IKameleoonData,\n KameleoonData,\n ApplicationVersionDataType,\n} from './types';\n\n/**\n * @class\n * ApplicationVersion - a class for creating an instance for app version\n * */\nexport class ApplicationVersion implements IKameleoonData {\n private version: string;\n private sent: boolean;\n\n /**\n * @param {string} version - version of mobile application\n * */\n constructor(version: string) {\n this.version = version;\n this.sent = false;\n }\n\n
|
|
1
|
+
{"version":3,"file":"applicationVersion.js","names":["_types","require","Object","defineProperty","exports","value","ApplicationVersion","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","version","sent","url","data","type","KameleoonData","isSent"],"sources":["../../src/kameleoonData/applicationVersion.ts"],"sourcesContent":["import {\n IKameleoonData,\n KameleoonData,\n ApplicationVersionDataType,\n} from './types';\n\n/**\n * @class\n * ApplicationVersion - a class for creating an instance for app version\n * */\nexport class ApplicationVersion implements IKameleoonData {\n private version: string;\n private sent: boolean;\n\n /**\n * @param {string} version - version of mobile application\n * */\n constructor(version: string) {\n this.version = version;\n this.sent = false;\n }\n\n get url(): string {\n return '';\n }\n\n get data(): ApplicationVersionDataType {\n return {\n version: this.version,\n type: KameleoonData.ApplicationVersion,\n sent: this.sent,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,YAIiBC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,kBAAA,iBAAAC,gBAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,CAAAE,cAAA,CAAAF,CAAA,EAAAA,CAAA,IAAAD,CAAA,CAAAN,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAC,CAAA,EAAAJ,KAAA,CAAAK,CAAA,CAAAE,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAN,CAAA,CAAAC,CAAA,EAAAC,CAAA,CAAAF,CAAA,UAAAG,eAAAH,CAAA,MAAAC,CAAA,CAAAM,YAAA,CAAAP,CAAA,kCAAAC,CAAA,CAAAA,CAAA,CAAAA,CAAA,aAAAM,aAAAP,CAAA,CAAAC,CAAA,sBAAAD,CAAA,GAAAA,CAAA,QAAAA,CAAA,KAAAE,CAAA,CAAAF,CAAA,CAAAQ,MAAA,CAAAC,WAAA,cAAAP,CAAA,MAAAQ,CAAA,CAAAR,CAAA,CAAAS,IAAA,CAAAX,CAAA,CAAAC,CAAA,iCAAAS,CAAA,QAAAA,CAAA,WAAAE,SAAA,mEAAAX,CAAA,CAAAY,MAAA,CAAAC,MAAA,EAAAd,CAAA,EAMV,KAAM,CAAAF,kBAA6C,CAOxDiB,WAAWA,CAACC,CAAe,CAAE,CAAAjB,eAAA,wBAAAA,eAAA,qBAC3B,IAAI,CAACiB,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,IAAI,GACX,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,CAChB,MAAO,EACT,CAEA,GAAI,CAAAC,IAAIA,CAAA,CAA+B,CACrC,MAAO,CACLH,OAAO,CAAE,IAAI,CAACA,OAAO,CACrBI,IAAI,CAAEC,oBAAa,CAACvB,kBAAkB,CACtCmB,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAEA,GAAI,CAAAK,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACL,IACd,CAEA,GAAI,CAAAK,MAAMA,CAACzB,CAAc,CAAE,CACzB,IAAI,CAACoB,IAAI,CAAGpB,CACd,CACF,CAACD,OAAA,CAAAE,kBAAA,CAAAA,kBAAA"}
|
|
@@ -18,24 +18,15 @@ export declare class Browser implements IKameleoonData {
|
|
|
18
18
|
* ```
|
|
19
19
|
* */
|
|
20
20
|
constructor(browser: BrowserType, version?: number);
|
|
21
|
-
/**
|
|
22
|
-
* @property url - url for the current data type used for events tracking
|
|
23
|
-
* */
|
|
24
21
|
get url(): string;
|
|
25
|
-
/**
|
|
26
|
-
* @property data - data of the current class instance
|
|
27
|
-
* */
|
|
28
22
|
get data(): BrowserDataType;
|
|
29
|
-
/**
|
|
30
|
-
* @property isSent - signifying if the data was sent already tracked
|
|
31
|
-
* */
|
|
32
23
|
get isSent(): boolean;
|
|
33
24
|
set isSent(value: boolean);
|
|
34
25
|
/**
|
|
35
26
|
* @private
|
|
36
|
-
* @method
|
|
37
|
-
* @param {VisitType
|
|
27
|
+
* @method _fromVisit - an internal method for creating an instance of Browser class from a visit
|
|
28
|
+
* @param {VisitType} visit - a visit
|
|
38
29
|
* @returns {Browser | undefined} an instance of Browser class or undefined if browser can not be found among visits
|
|
39
30
|
* */
|
|
40
|
-
static
|
|
31
|
+
static _fromVisit(visit: VisitType): Browser | undefined;
|
|
41
32
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Browser=void 0;var _requester=require("../requester"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class Browser{constructor(a,b){_defineProperty(this,"browser",void 0),_defineProperty(this,"version",void 0),_defineProperty(this,"sent",void 0),this.browser=a,this.version=b,this.sent=!1}get url(){if(!this.browser)return"";const a=this.version?_requester.UrlParameter.BrowserVersion+this.version:"";return _requester.UrlEventType.StaticData+_requester.UrlParameter.Browser+this.browser+_requester.UrlParameter.BrowserIndex+_types.BrowserIndexMap[this.browser]+a}get data(){return{browser:this.browser,type:_types.KameleoonData.Browser,version:this.version,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Browser=void 0;var _requester=require("../requester"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class Browser{constructor(a,b){_defineProperty(this,"browser",void 0),_defineProperty(this,"version",void 0),_defineProperty(this,"sent",void 0),this.browser=a,this.version=b,this.sent=!1}get url(){if(!this.browser)return"";const a=this.version?_requester.UrlParameter.BrowserVersion+this.version:"";return _requester.UrlEventType.StaticData+_requester.UrlParameter.Browser+this.browser+_requester.UrlParameter.BrowserIndex+_types.BrowserIndexMap[this.browser]+a}get data(){return{browser:this.browser,type:_types.KameleoonData.Browser,version:this.version,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _fromVisit(a){if(a.staticDataEvent){const{browser:b,browserIndex:c,browserVersion:d}=a.staticDataEvent.data;if(b||"number"==typeof c){const a=null!==b&&void 0!==b?b:_types.BrowserTypeMap[c];return d?new Browser(a,d):new Browser(a)}}}}exports.Browser=Browser;
|
|
2
2
|
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","names":["Browser","constructor","browser","version","_defineProperty","sent","url","browserVersion","UrlParameter","BrowserVersion","UrlEventType","StaticData","BrowserIndex","BrowserIndexMap","data","type","KameleoonData","isSent","value","
|
|
1
|
+
{"version":3,"file":"browser.js","names":["Browser","constructor","browser","version","_defineProperty","sent","url","browserVersion","UrlParameter","BrowserVersion","UrlEventType","StaticData","BrowserIndex","BrowserIndexMap","data","type","KameleoonData","isSent","value","_fromVisit","visit","staticDataEvent","browserType","browserIndex","BrowserTypeMap","exports"],"sources":["../../src/kameleoonData/browser.ts"],"sourcesContent":["import { UrlEventType, UrlParameter, VisitType } from 'src/requester';\nimport {\n BrowserDataType,\n BrowserType,\n BrowserIndexMap,\n IKameleoonData,\n KameleoonData,\n BrowserTypeMap,\n} from './types';\n\n/**\n * @class\n * Browser - a class for creating an instance for browser of a certain type\n * */\nexport class Browser implements IKameleoonData {\n private browser: BrowserType;\n private version?: number;\n private sent: boolean;\n\n /**\n * @param {BrowserType} browser - one of the browser types available for data, if browser can not be found in a list, it can be marked as `BrowserType.Other`\n * @param {number | undefined} version - version of the browser, floating point number represents major and minor version of the browser\n * @example\n * ```ts\n * const browser = new Browser(BrowserType.Chrome, 86);\n * const browser = new Browser(BrowserType.Safari, 14.1);\n * ```\n * */\n constructor(browser: BrowserType, version?: number) {\n this.browser = browser;\n this.version = version;\n this.sent = false;\n }\n\n get url(): string {\n // --- Note ---\n // If SDK is used in vanilla JS codebase, then you're also able to create an instance\n // with no required data, we don't want send anything to tracking in that case\n if (!this.browser) {\n return '';\n }\n\n const browserVersion = this.version\n ? UrlParameter.BrowserVersion + this.version\n : '';\n\n return (\n UrlEventType.StaticData +\n UrlParameter.Browser +\n this.browser +\n UrlParameter.BrowserIndex +\n BrowserIndexMap[this.browser] +\n browserVersion\n );\n }\n\n get data(): BrowserDataType {\n return {\n browser: this.browser,\n type: KameleoonData.Browser,\n version: this.version,\n sent: this.sent,\n };\n }\n\n get isSent(): boolean {\n return this.sent;\n }\n\n set isSent(value: boolean) {\n this.sent = value;\n }\n\n /**\n * @private\n * @method _fromVisit - an internal method for creating an instance of Browser class from a visit\n * @param {VisitType} visit - a visit\n * @returns {Browser | undefined} an instance of Browser class or undefined if browser can not be found among visits\n * */\n public static _fromVisit(visit: VisitType): Browser | undefined {\n if (!visit.staticDataEvent) {\n return undefined;\n }\n\n const {\n browser: browserType,\n browserIndex,\n browserVersion,\n } = visit.staticDataEvent.data;\n\n if (browserType || typeof browserIndex === 'number') {\n const browser = browserType ?? BrowserTypeMap[browserIndex as number];\n\n if (browserVersion) {\n return new Browser(browser, browserVersion);\n } else {\n return new Browser(browser);\n }\n }\n\n return undefined;\n }\n}\n"],"mappings":"+pBAcO,KAAM,CAAAA,OAAkC,CAc7CC,WAAWA,CAACC,CAAoB,CAAEC,CAAgB,CAAE,CAAAC,eAAA,wBAAAA,eAAA,wBAAAA,eAAA,qBAClD,IAAI,CAACF,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACC,OAAO,CAAGA,CAAO,CACtB,IAAI,CAACE,IAAI,GACX,CAEA,GAAI,CAAAC,GAAGA,CAAA,CAAW,CAIhB,GAAI,CAAC,IAAI,CAACJ,OAAO,CACf,MAAO,EAAE,CAGX,KAAM,CAAAK,CAAc,CAAG,IAAI,CAACJ,OAAO,CAC/BK,uBAAY,CAACC,cAAc,CAAG,IAAI,CAACN,OAAO,CAC1C,EAAE,CAEN,MACE,CAAAO,uBAAY,CAACC,UAAU,CACvBH,uBAAY,CAACR,OAAO,CACpB,IAAI,CAACE,OAAO,CACZM,uBAAY,CAACI,YAAY,CACzBC,sBAAe,CAAC,IAAI,CAACX,OAAO,CAAC,CAC7BK,CAEJ,CAEA,GAAI,CAAAO,IAAIA,CAAA,CAAoB,CAC1B,MAAO,CACLZ,OAAO,CAAE,IAAI,CAACA,OAAO,CACrBa,IAAI,CAAEC,oBAAa,CAAChB,OAAO,CAC3BG,OAAO,CAAE,IAAI,CAACA,OAAO,CACrBE,IAAI,CAAE,IAAI,CAACA,IACb,CACF,CAEA,GAAI,CAAAY,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACZ,IACd,CAEA,GAAI,CAAAY,MAAMA,CAACC,CAAc,CAAE,CACzB,IAAI,CAACb,IAAI,CAAGa,CACd,CAQA,MAAc,CAAAC,UAAUA,CAACC,CAAgB,CAAuB,CAC9D,GAAKA,CAAK,CAACC,eAAe,EAI1B,KAAM,CACJnB,OAAO,CAAEoB,CAAW,CACpBC,YAAY,CAAZA,CAAY,CACZhB,cAAc,CAAdA,CACF,CAAC,CAAGa,CAAK,CAACC,eAAe,CAACP,IAAI,CAE9B,GAAIQ,CAAW,EAA4B,QAAQ,EAAhC,MAAO,CAAAC,CAAyB,CAAE,CACnD,KAAM,CAAArB,CAAO,QAAGoB,CAAW,WAAXA,CAAW,CAAXA,CAAW,CAAIE,qBAAc,CAACD,CAAY,CAAW,CAAC,MAElE,CAAAhB,CAAc,CACT,GAAI,CAAAP,OAAO,CAACE,CAAO,CAAEK,CAAc,CAAC,CAEpC,GAAI,CAAAP,OAAO,CAACE,CAAO,CAE9B,CAAC,CAGH,CACF,CAACuB,OAAA,CAAAzB,OAAA,CAAAA,OAAA"}
|
|
@@ -14,24 +14,22 @@ export declare class Conversion implements IKameleoonData {
|
|
|
14
14
|
* @param {ConversionParametersType} conversionParameters - an object with conversion parameters
|
|
15
15
|
* */
|
|
16
16
|
constructor({ goalId, revenue, negative, }: ConversionParametersType);
|
|
17
|
-
/**
|
|
18
|
-
* @property url - url for the current data type used for events tracking
|
|
19
|
-
* */
|
|
20
17
|
get url(): string;
|
|
21
|
-
/**
|
|
22
|
-
* @property data - data of the current class instance
|
|
23
|
-
* */
|
|
24
18
|
get data(): ConversionDataType;
|
|
25
|
-
/**
|
|
26
|
-
* @property isSent - signifying if the data was sent already tracked
|
|
27
|
-
* */
|
|
28
19
|
get isSent(): boolean;
|
|
29
20
|
set isSent(value: boolean);
|
|
30
21
|
/**
|
|
31
22
|
* @private
|
|
32
|
-
* @method
|
|
33
|
-
* @param {VisitType
|
|
34
|
-
* @
|
|
23
|
+
* @method _listFromVisit - an internal method for returning a list of all Conversion instances
|
|
24
|
+
* @param {VisitType} visit - a visits
|
|
25
|
+
* @return {Conversion[]} - a list of Conversion instances
|
|
26
|
+
* */
|
|
27
|
+
static _listFromVisit(visit: VisitType): Conversion[];
|
|
28
|
+
/**
|
|
29
|
+
* @private
|
|
30
|
+
* @method _updateFromVisit - an internal method for updating a list of Conversion instances with only goalId
|
|
31
|
+
* @param {VisitType} visit - a visits
|
|
32
|
+
* @param {Map<number, Conversion>} dataMap - a map of Conversion instances
|
|
35
33
|
* */
|
|
36
|
-
static
|
|
34
|
+
static _updateFromVisit(visit: VisitType, dataMap: Map<number, Conversion>): void;
|
|
37
35
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Conversion=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class Conversion{constructor(a){let{goalId:b,revenue:c=0,negative:d=!1}=a;_defineProperty(this,"goalId",void 0),_defineProperty(this,"revenue",void 0),_defineProperty(this,"negative",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"nonce",void 0),this.goalId=b,this.revenue=c,this.negative=d,this.sent=!1,this.nonce=_utilities.Utilities.getNonce()}get url(){return this.goalId?_requester.UrlEventType.Conversion+_requester.UrlParameter.GoalId+(this.goalId+"")+_requester.UrlParameter.Revenue+(this.revenue+"")+_requester.UrlParameter.Negative+(this.negative+"")+_requester.UrlParameter.Nonce+this.nonce:""}get data(){return{goalId:this.goalId,revenue:this.revenue,negative:this.negative,type:_types.KameleoonData.Conversion,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Conversion=void 0;var _requester=require("../requester"),_utilities=require("../utilities"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class Conversion{constructor(a){let{goalId:b,revenue:c=0,negative:d=!1}=a;_defineProperty(this,"goalId",void 0),_defineProperty(this,"revenue",void 0),_defineProperty(this,"negative",void 0),_defineProperty(this,"sent",void 0),_defineProperty(this,"nonce",void 0),this.goalId=b,this.revenue=c,this.negative=d,this.sent=!1,this.nonce=_utilities.Utilities.getNonce()}get url(){return this.goalId?_requester.UrlEventType.Conversion+_requester.UrlParameter.GoalId+(this.goalId+"")+_requester.UrlParameter.Revenue+(this.revenue+"")+_requester.UrlParameter.Negative+(this.negative+"")+_requester.UrlParameter.Nonce+this.nonce:""}get data(){return{goalId:this.goalId,revenue:this.revenue,negative:this.negative,type:_types.KameleoonData.Conversion,sent:this.sent}}get isSent(){return this.sent}set isSent(a){this.sent=a}static _listFromVisit(a){var b,c;const d=[];if(!(null!==(b=a.conversionEvents)&&void 0!==b&&b.length))return[];if(null!==(c=a.conversionEvents)&&void 0!==c&&c.length)for(const b of a.conversionEvents){const{goalId:a,revenue:c,negative:e}=b.data,f=new Conversion({goalId:a,revenue:c,negative:e});f.isSent=!0,d.push(f)}return d}static _updateFromVisit(a,b){var c;if(null!==(c=a.conversionEvents)&&void 0!==c&&c.length)for(const c of a.conversionEvents){const{goalId:a}=c.data;if(!b.has(a)){const c=new Conversion({goalId:a});c.isSent=!0,b.set(a,c)}}}}exports.Conversion=Conversion;
|
|
2
2
|
//# sourceMappingURL=conversion.js.map
|