@kameleoon/javascript-sdk-core 1.1.1 → 2.0.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/dist/campaignConfiguration/campaignConfiguration.d.ts +2 -1
- package/dist/campaignConfiguration/campaignConfiguration.js +239 -197
- package/dist/campaignConfiguration/campaignConfiguration.js.map +1 -1
- package/dist/campaignConfiguration/constants.js +20 -14
- package/dist/campaignConfiguration/constants.js.map +1 -1
- package/dist/campaignConfiguration/index.js +78 -6
- package/dist/campaignConfiguration/index.js.map +1 -1
- package/dist/campaignConfiguration/types.d.ts +3 -2
- package/dist/campaignConfiguration/types.js +53 -45
- package/dist/campaignConfiguration/types.js.map +1 -1
- package/dist/clientSettings/clientSettings.d.ts +1 -1
- package/dist/clientSettings/clientSettings.js +28 -21
- package/dist/clientSettings/clientSettings.js.map +1 -1
- package/dist/clientSettings/index.js +18 -4
- package/dist/clientSettings/index.js.map +1 -1
- package/dist/clientSettings/types.d.ts +1 -1
- package/dist/clientSettings/types.js +4 -1
- package/dist/clientSettings/types.js.map +1 -1
- package/dist/constants.js +22 -14
- package/dist/constants.js.map +1 -1
- package/dist/eventSource/constants.js +6 -2
- package/dist/eventSource/constants.js.map +1 -1
- package/dist/eventSource/externalEventSource.js +28 -20
- package/dist/eventSource/externalEventSource.js.map +1 -1
- package/dist/eventSource/index.js +49 -6
- package/dist/eventSource/index.js.map +1 -1
- package/dist/eventSource/types.d.ts +1 -1
- package/dist/eventSource/types.js +4 -1
- package/dist/eventSource/types.js.map +1 -1
- package/dist/hasher/constants.js +6 -2
- package/dist/hasher/constants.js.map +1 -1
- package/dist/hasher/hasher.js +35 -24
- package/dist/hasher/hasher.js.map +1 -1
- package/dist/hasher/index.js +11 -4
- package/dist/hasher/index.js.map +1 -1
- package/dist/hasher/types.js +4 -1
- package/dist/hasher/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +297 -28
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +16 -16
- package/dist/kameleoonClient.js +307 -236
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonData/browser.js +37 -32
- package/dist/kameleoonData/browser.js.map +1 -1
- package/dist/kameleoonData/constants.js +6 -2
- package/dist/kameleoonData/constants.js.map +1 -1
- package/dist/kameleoonData/conversion.js +47 -40
- package/dist/kameleoonData/conversion.js.map +1 -1
- package/dist/kameleoonData/customData.js +62 -58
- package/dist/kameleoonData/customData.js.map +1 -1
- package/dist/kameleoonData/device.js +37 -32
- package/dist/kameleoonData/device.js.map +1 -1
- package/dist/kameleoonData/index.js +101 -18
- package/dist/kameleoonData/index.js.map +1 -1
- package/dist/kameleoonData/nonce.js +25 -13
- package/dist/kameleoonData/nonce.js.map +1 -1
- package/dist/kameleoonData/pageView.js +52 -44
- package/dist/kameleoonData/pageView.js.map +1 -1
- package/dist/kameleoonData/types.js +41 -26
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/kameleoonData/userAgent.js +33 -24
- package/dist/kameleoonData/userAgent.js.map +1 -1
- package/dist/kameleoonError/constants.js +25 -21
- package/dist/kameleoonError/constants.js.map +1 -1
- package/dist/kameleoonError/helpers.js +6 -4
- package/dist/kameleoonError/helpers.js.map +1 -1
- package/dist/kameleoonError/index.js +25 -8
- package/dist/kameleoonError/index.js.map +1 -1
- package/dist/kameleoonError/kameleoonError.js +64 -53
- package/dist/kameleoonError/kameleoonError.js.map +1 -1
- package/dist/kameleoonError/types.js +26 -22
- package/dist/kameleoonError/types.js.map +1 -1
- package/dist/kameleoonUtils.js +34 -33
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/requester/constants.d.ts +6 -7
- package/dist/requester/constants.js +58 -45
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/index.d.ts +2 -2
- package/dist/requester/index.js +67 -8
- package/dist/requester/index.js.map +1 -1
- package/dist/requester/requester.d.ts +7 -7
- package/dist/requester/requester.js +100 -113
- package/dist/requester/requester.js.map +1 -1
- package/dist/requester/types.d.ts +38 -10
- package/dist/requester/types.js +14 -36
- package/dist/requester/types.js.map +1 -1
- package/dist/storage/constants.js +11 -7
- package/dist/storage/constants.js.map +1 -1
- package/dist/storage/externalStorage.js +33 -26
- package/dist/storage/externalStorage.js.map +1 -1
- package/dist/storage/index.js +55 -6
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/types.js +4 -1
- package/dist/storage/types.js.map +1 -1
- package/dist/targeting/conditions/conditionFactory.js +24 -19
- package/dist/targeting/conditions/conditionFactory.js.map +1 -1
- package/dist/targeting/conditions/customDataCondition.js +99 -88
- package/dist/targeting/conditions/customDataCondition.js.map +1 -1
- package/dist/targeting/conditions/exclusiveExperimentCondition.js +27 -15
- package/dist/targeting/conditions/exclusiveExperimentCondition.js.map +1 -1
- package/dist/targeting/conditions/index.js +45 -10
- package/dist/targeting/conditions/index.js.map +1 -1
- package/dist/targeting/conditions/targetExperimentCondition.js +54 -32
- package/dist/targeting/conditions/targetExperimentCondition.js.map +1 -1
- package/dist/targeting/conditions/types.js +4 -1
- package/dist/targeting/conditions/types.js.map +1 -1
- package/dist/targeting/index.js +79 -13
- package/dist/targeting/index.js.map +1 -1
- package/dist/targeting/targetingNode.js +41 -33
- package/dist/targeting/targetingNode.js.map +1 -1
- package/dist/targeting/targetingTree.js +125 -104
- package/dist/targeting/targetingTree.js.map +1 -1
- package/dist/targeting/types.js +99 -91
- package/dist/targeting/types.js.map +1 -1
- package/dist/types.d.ts +17 -2
- package/dist/types.js +50 -21
- package/dist/types.js.map +1 -1
- package/dist/utilities/constants.js +6 -2
- package/dist/utilities/constants.js.map +1 -1
- package/dist/utilities/index.js +11 -4
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/types.d.ts +1 -1
- package/dist/utilities/types.js +4 -1
- package/dist/utilities/types.js.map +1 -1
- package/dist/utilities/utilities.d.ts +2 -2
- package/dist/utilities/utilities.js +117 -105
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/variationConfiguration/index.js +24 -4
- package/dist/variationConfiguration/index.js.map +1 -1
- package/dist/variationConfiguration/types.js +4 -1
- package/dist/variationConfiguration/types.js.map +1 -1
- package/dist/variationConfiguration/variation.js +35 -28
- package/dist/variationConfiguration/variation.js.map +1 -1
- package/dist/variationConfiguration/variationConfiguration.d.ts +5 -5
- package/dist/variationConfiguration/variationConfiguration.js +270 -228
- package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonClient.js","sourceRoot":"","sources":["../src/kameleoonClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAyC;AACzC,mEAIiC;AACjC,qDAAsE;AACtE,2CAA0E;AAC1E,mDAAgE;AAChE,qDAAsE;AACtE,2CAAmE;AACnE,uCAImB;AACnB,+DAA4D;AAU5D,2CAAwC;AACxC,qEAGkC;AA8KlC;;;;KAIK;AACL,MAAa,eAAe;IAO1B;;OAEG;IACH,YAAY,EACV,QAAQ,EACR,aAAa,EACb,qBAAqB,GACH;QAClB,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,+BAAc,CACrD,QAAQ,EACR,aAAa,CACd,CAAC;QACF,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;QAEtE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QAC/B,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;IAEY,UAAU;;YACrB,MAAM,EAAE,eAAe,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,qBAAqB,CAAC;YAE5E,MAAM,iBAAiB,GAAG,IAAI,iCAAe,CAC3C,eAAe,CAAC,UAAU,CAAC,6BAAmB,CAAC,UAAU,CAAC,CAC3D,CAAC;YACF,MAAM,oBAAoB,GAAG,IAAI,iCAAe,CAC9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AAC,qBAAqB,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAE9D,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB;aAC9C,uBAAuB,CAAC;YACvB,WAAW;YACX,WAAW;YACX,aAAa;YACb,cAAc,EAAE,IAAI;SACrB,CAAC;aACD,KAAK,EAAE,CAAC;QAEX,IAAI,CAAA,MAAA,aAAa,CAAC,IAAI,0CAAE,IAAI,MAAK,gCAAQ,CAAC,eAAe,EAAE;YACzD,MAAM,SAAS,GAAG,qBAAS,CAAC,YAAY,CACtC,WAAW,EACX,IAAI,CAAC,qBAAqB,CAC3B,CAAC;YAEF,qBAAS,CAAC,wBAAwB,CAAC;gBACjC,WAAW;gBACX,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,oBAAoB,EAAE,aAAa;gBACnC,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;gBACjD,SAAS;aACV,CAAC,CAAC;SACJ;QAED,OAAO,IAAA,WAAE,EAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;CACF;AAvZD,0CAuZC"}
|
|
1
|
+
{"version":3,"file":"kameleoonClient.js","names":["_tsRes","require","_campaignConfiguration","_clientSettings","_constants","_kameleoonData","_kameleoonError","_requester","_storage","_externalStorage","_utilities","_variationConfiguration","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","KameleoonClient","constructor","siteCode","configuration","internalConfiguration","settings","clientSettings","ClientSettings","externalPackageInfo","externalRequestDispatcher","requester","Requester","environment","packageInfo","requestDispatcher","initialize","externalStorage","externalEventSource","externalClientConfiguration","clientDataStorage","ExternalStorage","KameleoonStorageKey","ClientData","variationDataStorage","VariationData","campaignConfiguration","CampaignConfiguration","storage","result","throw","variationConfiguration","VariationConfiguration","experiments","ok","addData","visitorCode","data","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","addTargetingData","triggerExperiment","experimentId","experiment","find","item","id","ExperimentConfigurationNotFound","targetingData","storedTargetingData","targetingResult","checkTargeting","segment","NotTargeted","dataUrl","getDataUrl","trackingParameters","body","userAgent","getUserAgent","variationId","getAssociatedVariationId","else","error","type","NotAllocated","trackExperiment","UNALLOCATED_VARIATION_ID","isUnallocated","trackConversion","goalId","revenue","Conversion","flushData","trackData","getExperiments","map","name","getVisitorExperiments","isActive","experimentVariations","getAssignedVariations","experimentVariation","variationResult","getExperimentVariation","getFeatureFlags","featureFlags","featureKey","getVisitorFeatureFlags","resultFeatureFlags","featureFlag","variationData","getFeatureFlagVariation","variationKey","OFF_VARIATION_KEY","featureFlagId","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","variable","variations","variables","FeatureFlagConfigurationNotFound","featureVariable","parseFeatureVariable","isFeatureFlagActive","getRemoteData","remoteData","onConfigurationUpdate","callback","Err","withAssignment","rule","trackRule","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CampaignConfiguration, JSONType } from './campaignConfiguration';\nimport { ClientSettings, ClientSettingsType } from './clientSettings';\nimport { OFF_VARIATION_KEY, UNALLOCATED_VARIATION_ID } from './constants';\nimport { Conversion, KameleoonDataType } from './kameleoonData';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester, TrackExperimentParamsType } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport { ExternalStorage } from './storage/externalStorage';\nimport {\n TrackConversionParamsType,\n ExperimentType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n InternalSDKConfigurationType,\n SDKCoreParameters,\n} from './types';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\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 * @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 */\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.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method triggerExperiment - triggers experiment by assigning the variation to the user with `visitorCode`, if the variation is already assigned just returns it's id. Note: returned id `0` indicates default variation. At the same time executes `flushData` without sending extra request.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {number} experimentId - id of experiment running for the current visitor\n * @returns {number} associated variationId which is successfully searched/assigned\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.ExperimentConfigurationNotFound` No configuration found for provided `experimentId`\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.StorageRead` Couldn't find associated experiment by provided `experimentId` and `visitorCode` inside the storage\n * - `KameleoonException.NotTargeted` Current visitor is not targeted\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n triggerExperiment: (visitorCode: string, experimentId: number) => number;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flushData`. 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.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flushData - 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\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n flushData: (visitorCode: string) => void;\n /**\n * @method getExperiments - returns a list of experiments stored in the client configuration\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getExperiments: () => ExperimentType[];\n /**\n * @method getVisitorExperiments - returns a list of experiments that the visitor with `visitorCode` is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated if the experiment will be triggered).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {boolean | undefined} isAllocated - boolean value indicating that only experiments *allocated* for visitor will be returned. Default value is `true`\n * @returns {ExperimentType[]} a list of all experiments items with `id` and `name` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n */\n getVisitorExperiments: (\n visitorCode: string,\n isAllocated?: boolean,\n ) => ExperimentType[];\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 `initialize` was done for `kameleoonClient`\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.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\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 if the feature rollout rule was of type of `Experimentation`\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.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `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 if the feature rollout rule was of type of `Experimentation`\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.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\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 if the feature rollout rule was of type of `Experimentation`\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields, `type` can be checked against `FeatureVariableType` enum, if the `type` is `FeatureVariableType.BOOLEAN` then the `value` type will be `boolean` and so on.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `visitorCode` and `featureKey`\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't pass JSON value\n * - `KameleoonException.NumberParse` - Couldn't pass Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => 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 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 `initialize` was done for `kameleoonClient`\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private internalConfiguration: InternalSDKConfigurationType;\n private variationConfiguration?: VariationConfiguration;\n private campaignConfiguration?: CampaignConfiguration;\n private settings: ClientSettingsType;\n private requester: Requester;\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 const { externalPackageInfo, externalRequestDispatcher } =\n internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n\n this.requester = requester;\n this.settings = clientSettings;\n this.internalConfiguration = internalConfiguration;\n }\n\n public async initialize(): Promise<boolean> {\n const { externalStorage, externalEventSource, externalClientConfiguration } =\n this.internalConfiguration;\n\n const clientDataStorage = new ExternalStorage<ClientDataType>(\n externalStorage.initialize(KameleoonStorageKey.ClientData),\n );\n const variationDataStorage = new ExternalStorage<VariationDataType>(\n externalStorage.initialize(KameleoonStorageKey.VariationData),\n );\n\n const campaignConfiguration = new CampaignConfiguration({\n settings: this.settings,\n storage: clientDataStorage,\n requester: this.requester,\n externalClientConfiguration,\n });\n\n const result = await campaignConfiguration.initialize(externalEventSource);\n result.throw();\n\n const variationConfiguration = new VariationConfiguration(\n campaignConfiguration.experiments,\n variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n this.campaignConfiguration = campaignConfiguration;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.addTargetingData(visitorCode, ...data).throw();\n }\n\n public triggerExperiment(visitorCode: string, experimentId: number): number {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.campaignConfiguration || !this.variationConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const experiment = this.campaignConfiguration.experiments.find(\n (item) => item.id === String(experimentId),\n );\n\n if (!experiment) {\n throw new KameleoonError(\n KameleoonException.ExperimentConfigurationNotFound,\n experimentId,\n visitorCode,\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n const targetingResult = Utilities.checkTargeting({\n visitorCode,\n experimentId,\n targetingData,\n segment: experiment.segment,\n variationConfiguration: this.variationConfiguration,\n }).throw();\n\n if (!targetingResult) {\n throw new KameleoonError(KameleoonException.NotTargeted, visitorCode);\n }\n\n const dataUrl = Utilities.getDataUrl(\n visitorCode,\n this.campaignConfiguration,\n );\n\n const trackingParameters: Omit<\n TrackExperimentParamsType,\n 'variationId' | 'isUnallocated'\n > = {\n body: dataUrl,\n visitorCode,\n experimentId,\n };\n\n const userAgent = Utilities.getUserAgent(\n visitorCode,\n this.campaignConfiguration,\n );\n\n const variationId = this.variationConfiguration\n .getAssociatedVariationId(visitorCode, experimentId)\n .else((error) => {\n if (error.type === KameleoonException.NotAllocated) {\n this.requester.trackExperiment({\n variationId: UNALLOCATED_VARIATION_ID,\n isUnallocated: true,\n userAgent,\n ...trackingParameters,\n });\n\n return UNALLOCATED_VARIATION_ID;\n }\n\n throw error;\n });\n\n this.requester.trackExperiment({\n variationId,\n isUnallocated: false,\n userAgent,\n ...trackingParameters,\n });\n\n return variationId;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flushData(visitorCode);\n }\n\n public flushData(visitorCode: string): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const dataUrl = Utilities.getDataUrl(\n visitorCode,\n this.campaignConfiguration,\n );\n\n const userAgent = Utilities.getUserAgent(\n visitorCode,\n this.campaignConfiguration,\n );\n\n this.requester.trackData({ visitorCode, body: dataUrl, userAgent });\n }\n\n public getExperiments(): ExperimentType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.experiments.map(({ id, name }) => ({\n id: Number(id),\n name,\n }));\n }\n\n public getVisitorExperiments(\n visitorCode: string,\n isActive = true,\n ): ExperimentType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const experiments = this.campaignConfiguration.experiments;\n const result: ExperimentType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const experiment of experiments) {\n const { id, name, segment } = experiment;\n\n const targetingResult = Utilities.checkTargeting({\n targetingData,\n visitorCode,\n segment,\n variationConfiguration: this.variationConfiguration,\n experimentId: Number(id),\n }).throw();\n\n if (!targetingResult) {\n continue;\n }\n\n // -- If `isActive=false` then return every experiment\n if (!isActive) {\n result.push({ id: Number(id), name });\n continue;\n }\n\n // -- Else first check if there are saved variations for the experiment\n // if there is at least one than it's active\n const experimentVariations =\n this.variationConfiguration.getAssignedVariations(visitorCode);\n\n if (experimentVariations.ok) {\n const experimentVariation = experimentVariations.data[experiment.id];\n\n if (experimentVariation) {\n result.push({ id: Number(id), name });\n continue;\n }\n }\n\n // -- Second check if the experiment will have an allocated variation upon triggering\n // if yes than it's active\n const variationResult =\n this.variationConfiguration.getExperimentVariation(\n visitorCode,\n experiment,\n );\n\n if (variationResult.ok) {\n result.push({ id: Number(id), name });\n }\n }\n\n return result;\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.campaignConfiguration.featureFlags.map(\n ({ id, featureKey }) => ({ id, key: featureKey }),\n );\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.campaignConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n targetingData,\n featureFlag,\n })\n .throw();\n\n if (variationData.variationKey !== OFF_VARIATION_KEY) {\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 const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n // --- Note ---\n // `_getFeatureFlagVariation` already checks `campaignConfiguration` initialization\n const featureFlags = (this.campaignConfiguration as CampaignConfiguration)\n .featureFlags;\n\n const variable = featureFlags\n .find((item) => item.featureKey === featureKey)\n ?.variations.find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\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 onConfigurationUpdate(callback: () => void): void {\n if (!this.campaignConfiguration) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.campaignConfiguration.onConfigurationUpdate(callback);\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.variationConfiguration || !this.campaignConfiguration) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.campaignConfiguration.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 visitorCode,\n ),\n );\n }\n\n const targetingData =\n this.campaignConfiguration.storedTargetingData[visitorCode];\n\n const variationData = this.variationConfiguration\n .getFeatureFlagVariation({\n visitorCode,\n featureFlag,\n targetingData,\n withAssignment: true,\n })\n .throw();\n\n const userAgent = Utilities.getUserAgent(\n visitorCode,\n this.campaignConfiguration,\n );\n\n if (variationData.rule) {\n Utilities.trackRule({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n campaignConfiguration: this.campaignConfiguration,\n userAgent,\n });\n }\n\n return Ok(variationData);\n }\n}\n"],"mappings":";;;;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AA,eAAA"}
|
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.Browser = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var _nonce = require("./nonce");
|
|
8
|
+
var _requester = require("../requester");
|
|
9
|
+
var _types = require("./types");
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
/**
|
|
8
14
|
* @class
|
|
9
15
|
* Browser - a class for creating an instance for browser of a certain type
|
|
10
16
|
* */
|
|
11
|
-
class Browser extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
17
|
+
class Browser extends _nonce.Nonce {
|
|
18
|
+
/**
|
|
19
|
+
* @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`
|
|
20
|
+
* */
|
|
21
|
+
constructor(browser) {
|
|
22
|
+
super();
|
|
23
|
+
_defineProperty(this, "browser", void 0);
|
|
24
|
+
this.browser = browser;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @property url - url for the current data type used for events tracking
|
|
29
|
+
* */
|
|
30
|
+
get url() {
|
|
31
|
+
return _requester.UrlEventType.StaticData + _requester.UrlParameter.BrowserIndex + this.browser + _requester.UrlParameter.Nonce + this.nonce;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @property data - data of the current class instance
|
|
36
|
+
* */
|
|
37
|
+
get data() {
|
|
38
|
+
return {
|
|
39
|
+
browser: this.browser,
|
|
40
|
+
type: _types.KameleoonData.Browser,
|
|
41
|
+
nonce: this.nonce
|
|
42
|
+
};
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
exports.Browser = Browser;
|
|
41
46
|
//# sourceMappingURL=browser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","
|
|
1
|
+
{"version":3,"file":"browser.js","names":["_nonce","require","_requester","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Browser","Nonce","constructor","browser","url","UrlEventType","StaticData","UrlParameter","BrowserIndex","nonce","data","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/browser.ts"],"sourcesContent":["import { Nonce } from './nonce';\nimport { UrlEventType, UrlParameter } from '../requester';\nimport {\n BrowserDataType,\n BrowserType,\n IKameleoonData,\n KameleoonData,\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 extends Nonce implements IKameleoonData {\n private browser: BrowserType;\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 * */\n constructor(browser: BrowserType) {\n super();\n\n this.browser = browser;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return (\n UrlEventType.StaticData +\n UrlParameter.BrowserIndex +\n this.browser +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): BrowserDataType {\n return {\n browser: this.browser,\n type: KameleoonData.Browser,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKiB,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAEjB;AACA;AACA;AACA;AACO,MAAMU,OAAO,SAASC,YAAK,CAA2B;EAG3D;AACF;AACA;EACEC,WAAWA,CAACC,OAAoB,EAAE;IAChC,KAAK,EAAE;IAAC1B,eAAA;IAER,IAAI,CAAC0B,OAAO,GAAGA,OAAO;EACxB;;EAEA;AACF;AACA;EACE,IAAIC,GAAGA,CAAA,EAAW;IAChB,OACEC,uBAAY,CAACC,UAAU,GACvBC,uBAAY,CAACC,YAAY,GACzB,IAAI,CAACL,OAAO,GACZI,uBAAY,CAACN,KAAK,GAClB,IAAI,CAACQ,KAAK;EAEd;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAoB;IAC1B,OAAO;MACLP,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBQ,IAAI,EAAEC,oBAAa,CAACZ,OAAO;MAC3BS,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF;AAACI,OAAA,CAAAb,OAAA,GAAAA,OAAA"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.HEX_CHARACTERS = void 0;
|
|
4
|
-
|
|
7
|
+
const HEX_CHARACTERS = '0123456789ABCDEF';
|
|
8
|
+
exports.HEX_CHARACTERS = HEX_CHARACTERS;
|
|
5
9
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","
|
|
1
|
+
{"version":3,"file":"constants.js","names":["HEX_CHARACTERS","exports"],"sources":["../../src/kameleoonData/constants.ts"],"sourcesContent":["export const HEX_CHARACTERS = '0123456789ABCDEF';\n"],"mappings":";;;;;;AAAO,MAAMA,cAAc,GAAG,kBAAkB;AAACC,OAAA,CAAAD,cAAA,GAAAA,cAAA"}
|
|
@@ -1,49 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.Conversion = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var _requester = require("../requester");
|
|
8
|
+
var _nonce = require("./nonce");
|
|
9
|
+
var _types = require("./types");
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
/**
|
|
8
14
|
* @class
|
|
9
15
|
* Conversion - a class for creating an instance for conversion tracking
|
|
10
16
|
* */
|
|
11
|
-
class Conversion extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
17
|
+
class Conversion extends _nonce.Nonce {
|
|
18
|
+
/**
|
|
19
|
+
* @param {ConversionParametersType} converstionParameters - an object with conversion parameters
|
|
20
|
+
* */
|
|
21
|
+
constructor({
|
|
22
|
+
goalId,
|
|
23
|
+
revenue = 0,
|
|
24
|
+
negative = false
|
|
25
|
+
}) {
|
|
26
|
+
super();
|
|
27
|
+
_defineProperty(this, "goalId", void 0);
|
|
28
|
+
_defineProperty(this, "revenue", void 0);
|
|
29
|
+
_defineProperty(this, "negative", void 0);
|
|
30
|
+
this.goalId = goalId;
|
|
31
|
+
this.revenue = revenue;
|
|
32
|
+
this.negative = negative;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @property url - url for the current data type used for events tracking
|
|
37
|
+
* */
|
|
38
|
+
get url() {
|
|
39
|
+
return _requester.UrlEventType.Conversion + _requester.UrlParameter.GoalId + String(this.goalId) + _requester.UrlParameter.Revenue + String(this.revenue) + _requester.UrlParameter.Negative + String(this.negative) + _requester.UrlParameter.Nonce + this.nonce;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @property data - data of the current class instance
|
|
44
|
+
* */
|
|
45
|
+
get data() {
|
|
46
|
+
return {
|
|
47
|
+
goalId: this.goalId,
|
|
48
|
+
revenue: this.revenue,
|
|
49
|
+
negative: this.negative,
|
|
50
|
+
type: _types.KameleoonData.Conversion,
|
|
51
|
+
nonce: this.nonce
|
|
52
|
+
};
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
exports.Conversion = Conversion;
|
|
49
56
|
//# sourceMappingURL=conversion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.js","
|
|
1
|
+
{"version":3,"file":"conversion.js","names":["_requester","require","_nonce","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Conversion","Nonce","constructor","goalId","revenue","negative","url","UrlEventType","UrlParameter","GoalId","Revenue","Negative","nonce","data","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/conversion.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from '../requester';\nimport { Nonce } from './nonce';\nimport {\n ConversionDataType,\n ConversionParametersType,\n IKameleoonData,\n KameleoonData,\n} from './types';\n\n/**\n * @class\n * Conversion - a class for creating an instance for conversion tracking\n * */\nexport class Conversion extends Nonce implements IKameleoonData {\n private goalId: number;\n private revenue: number;\n private negative: boolean;\n\n /**\n * @param {ConversionParametersType} converstionParameters - an object with conversion parameters\n * */\n constructor({\n goalId,\n revenue = 0,\n negative = false,\n }: ConversionParametersType) {\n super();\n\n this.goalId = goalId;\n this.revenue = revenue;\n this.negative = negative;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return (\n UrlEventType.Conversion +\n UrlParameter.GoalId +\n String(this.goalId) +\n UrlParameter.Revenue +\n String(this.revenue) +\n UrlParameter.Negative +\n String(this.negative) +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): ConversionDataType {\n return {\n goalId: this.goalId,\n revenue: this.revenue,\n negative: this.negative,\n type: KameleoonData.Conversion,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKiB,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GA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A,UAAA"}
|
|
@@ -1,68 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.CustomData = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var _requester = require("../requester");
|
|
8
|
+
var _nonce = require("./nonce");
|
|
9
|
+
var _types = require("./types");
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
/**
|
|
8
14
|
* @class
|
|
9
15
|
* CustomData - a class for creating an instance for user's custom data
|
|
10
16
|
* */
|
|
11
|
-
class CustomData extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
encodeURIComponent(JSON.stringify(resultValue)) +
|
|
50
|
-
requester_1.UrlParameter.Overwrite +
|
|
51
|
-
String(true) +
|
|
52
|
-
requester_1.UrlParameter.Nonce +
|
|
53
|
-
this.nonce);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @property data - data of the current class instance
|
|
57
|
-
* */
|
|
58
|
-
get data() {
|
|
59
|
-
return {
|
|
60
|
-
index: this.index,
|
|
61
|
-
value: this.value,
|
|
62
|
-
type: types_1.KameleoonData.CustomData,
|
|
63
|
-
nonce: this.nonce,
|
|
64
|
-
};
|
|
17
|
+
class CustomData extends _nonce.Nonce {
|
|
18
|
+
/**
|
|
19
|
+
* @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application
|
|
20
|
+
* @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* // - Single value
|
|
24
|
+
* const customData = new CustomData(0, 'value_1');
|
|
25
|
+
* // - Variadic number of values
|
|
26
|
+
* const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');
|
|
27
|
+
* // - Array of values
|
|
28
|
+
* const values = ['value_1', 'value_2', 'value_3'];
|
|
29
|
+
* const customData = new CustomData(0, ...values);
|
|
30
|
+
* ```
|
|
31
|
+
* */
|
|
32
|
+
constructor(index, ...value) {
|
|
33
|
+
super();
|
|
34
|
+
_defineProperty(this, "index", void 0);
|
|
35
|
+
_defineProperty(this, "value", void 0);
|
|
36
|
+
this.index = index;
|
|
37
|
+
this.value = value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @property url - url for the current data type used for events tracking
|
|
42
|
+
* */
|
|
43
|
+
get url() {
|
|
44
|
+
const uniqueValues = [...new Set(this.value)];
|
|
45
|
+
let resultValue = {};
|
|
46
|
+
|
|
47
|
+
// --- Note ---
|
|
48
|
+
// Final value should look like this `{ value_1: 1, value_2: 1, value_3: 1}`
|
|
49
|
+
// With no duplicates
|
|
50
|
+
uniqueValues.forEach(value => {
|
|
51
|
+
resultValue[value] = 1;
|
|
52
|
+
});
|
|
53
|
+
if (!Object.keys(resultValue).length) {
|
|
54
|
+
return '';
|
|
65
55
|
}
|
|
56
|
+
return _requester.UrlEventType.CustomData + _requester.UrlParameter.Index + this.index + _requester.UrlParameter.ValuesCountMap + encodeURIComponent(JSON.stringify(resultValue)) + _requester.UrlParameter.Overwrite + String(true) + _requester.UrlParameter.Nonce + this.nonce;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @property data - data of the current class instance
|
|
61
|
+
* */
|
|
62
|
+
get data() {
|
|
63
|
+
return {
|
|
64
|
+
index: this.index,
|
|
65
|
+
value: this.value,
|
|
66
|
+
type: _types.KameleoonData.CustomData,
|
|
67
|
+
nonce: this.nonce
|
|
68
|
+
};
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
71
|
exports.CustomData = CustomData;
|
|
68
72
|
//# sourceMappingURL=customData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customData.js","
|
|
1
|
+
{"version":3,"file":"customData.js","names":["_requester","require","_nonce","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","CustomData","Nonce","constructor","index","url","uniqueValues","Set","resultValue","forEach","keys","length","UrlEventType","UrlParameter","Index","ValuesCountMap","encodeURIComponent","JSON","stringify","Overwrite","nonce","data","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/customData.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from '../requester';\nimport { Nonce } from './nonce';\nimport { CustomDataType, IKameleoonData, KameleoonData } from './types';\n\n/**\n * @class\n * CustomData - a class for creating an instance for user's custom data\n * */\nexport class CustomData extends Nonce implements IKameleoonData {\n private index: number;\n private value: string[];\n\n /**\n * @param {number} index - an index of custom data to be stored under in a state, an index of custom data can be specified in `Advanced Tools` section of Kameleoon Application\n * @param {string[]} value - custom value to store under the specified id, value can be anything but has to be stringified to match the `string` type. *Note* value is variadic parameter and can be used as follows\n * @example\n * ```ts\n * // - Single value\n * const customData = new CustomData(0, 'value_1');\n * // - Variadic number of values\n * const customData = new CustomData(0, 'value_1', 'value_2', 'value_3');\n * // - Array of values\n * const values = ['value_1', 'value_2', 'value_3'];\n * const customData = new CustomData(0, ...values);\n * ```\n * */\n constructor(index: number, ...value: string[]) {\n super();\n\n this.index = index;\n this.value = value;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n const uniqueValues = [...new Set(this.value)];\n let resultValue: Record<string, 1> = {};\n\n // --- Note ---\n // Final value should look like this `{ value_1: 1, value_2: 1, value_3: 1}`\n // With no duplicates\n uniqueValues.forEach((value) => {\n resultValue[value] = 1;\n });\n\n if (!Object.keys(resultValue).length) {\n return '';\n }\n\n return (\n UrlEventType.CustomData +\n UrlParameter.Index +\n this.index +\n UrlParameter.ValuesCountMap +\n encodeURIComponent(JSON.stringify(resultValue)) +\n UrlParameter.Overwrite +\n String(true) +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): CustomDataType {\n return {\n index: this.index,\n value: this.value,\n type: KameleoonData.CustomData,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAwE,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAA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IACX;IAEA,OACEC,uBAAY,CAACX,UAAU,GACvBY,uBAAY,CAACC,KAAK,GAClB,IAAI,CAACV,KAAK,GACVS,uBAAY,CAACE,cAAc,GAC3BC,kBAAkB,CAACC,IAAI,CAACC,SAAS,CAACV,WAAW,CAAC,CAAC,GAC/CK,uBAAY,CAACM,SAAS,GACtB7B,MAAM,CAAC,IAAI,CAAC,GACZuB,uBAAY,CAACX,KAAK,GAClB,IAAI,CAACkB,KAAK;EAEd;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAmB;IACzB,OAAO;MACLjB,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBvB,KAAK,EAAE,IAAI,CAACA,KAAK;MACjByC,IAAI,EAAEC,oBAAa,CAACtB,UAAU;MAC9BmB,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF;AAACI,OAAA,CAAAvB,UAAA,GAAAA,UAAA"}
|
|
@@ -1,41 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
3
6
|
exports.Device = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var _requester = require("../requester");
|
|
8
|
+
var _nonce = require("./nonce");
|
|
9
|
+
var _types = require("./types");
|
|
10
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
13
|
/**
|
|
8
14
|
* @class
|
|
9
15
|
* Device - a class for creating an instance for device of a certain type
|
|
10
16
|
* */
|
|
11
|
-
class Device extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
17
|
+
class Device extends _nonce.Nonce {
|
|
18
|
+
/**
|
|
19
|
+
* @param {DeviceType} device - one of the available device types from `DeviceType` enum
|
|
20
|
+
* */
|
|
21
|
+
constructor(device) {
|
|
22
|
+
super();
|
|
23
|
+
_defineProperty(this, "device", void 0);
|
|
24
|
+
this.device = device;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @property url - url for the current data type used for events tracking
|
|
29
|
+
* */
|
|
30
|
+
get url() {
|
|
31
|
+
return _requester.UrlEventType.StaticData + _requester.UrlParameter.DeviceType + this.device + _requester.UrlParameter.Nonce + this.nonce;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @property data - data of the current class instance
|
|
36
|
+
* */
|
|
37
|
+
get data() {
|
|
38
|
+
return {
|
|
39
|
+
device: this.device,
|
|
40
|
+
type: _types.KameleoonData.Device,
|
|
41
|
+
nonce: this.nonce
|
|
42
|
+
};
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
exports.Device = Device;
|
|
41
46
|
//# sourceMappingURL=device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","
|
|
1
|
+
{"version":3,"file":"device.js","names":["_requester","require","_nonce","_types","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","Device","Nonce","constructor","device","url","UrlEventType","StaticData","UrlParameter","DeviceType","nonce","data","type","KameleoonData","exports"],"sources":["../../src/kameleoonData/device.ts"],"sourcesContent":["import { UrlEventType, UrlParameter } from '../requester';\nimport { Nonce } from './nonce';\nimport {\n DeviceDataType,\n DeviceType,\n IKameleoonData,\n KameleoonData,\n} from './types';\n\n/**\n * @class\n * Device - a class for creating an instance for device of a certain type\n * */\nexport class Device extends Nonce implements IKameleoonData {\n private device: DeviceType;\n\n /**\n * @param {DeviceType} device - one of the available device types from `DeviceType` enum\n * */\n constructor(device: DeviceType) {\n super();\n\n this.device = device;\n }\n\n /**\n * @property url - url for the current data type used for events tracking\n * */\n get url(): string {\n return (\n UrlEventType.StaticData +\n UrlParameter.DeviceType +\n this.device +\n UrlParameter.Nonce +\n this.nonce\n );\n }\n\n /**\n * @property data - data of the current class instance\n * */\n get data(): DeviceDataType {\n return {\n device: this.device,\n type: KameleoonData.Device,\n nonce: this.nonce,\n };\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKiB,SAAAG,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,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