@kameleoon/javascript-sdk-core 3.2.0 → 3.3.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.
Files changed (58) hide show
  1. package/dist/clientConfiguration/clientConfiguration.d.ts +2 -2
  2. package/dist/clientConfiguration/clientConfiguration.js +1 -1
  3. package/dist/clientConfiguration/clientConfiguration.js.map +1 -1
  4. package/dist/clientConfiguration/types.d.ts +2 -2
  5. package/dist/clientConfiguration/types.js.map +1 -1
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/kameleoonClient.d.ts +11 -23
  10. package/dist/kameleoonClient.js +1 -1
  11. package/dist/kameleoonClient.js.map +1 -1
  12. package/dist/kameleoonData/dataProcessor.js +1 -1
  13. package/dist/kameleoonData/dataProcessor.js.map +1 -1
  14. package/dist/kameleoonError/constants.js +1 -1
  15. package/dist/kameleoonError/constants.js.map +1 -1
  16. package/dist/kameleoonUtils.js +1 -1
  17. package/dist/kameleoonUtils.js.map +1 -1
  18. package/dist/requester/constants.d.ts +3 -1
  19. package/dist/requester/constants.js +1 -1
  20. package/dist/requester/constants.js.map +1 -1
  21. package/dist/requester/index.d.ts +2 -2
  22. package/dist/requester/index.js +1 -1
  23. package/dist/requester/index.js.map +1 -1
  24. package/dist/requester/requester.d.ts +4 -4
  25. package/dist/requester/requester.js +1 -1
  26. package/dist/requester/requester.js.map +1 -1
  27. package/dist/requester/types.d.ts +11 -7
  28. package/dist/requester/types.js +1 -1
  29. package/dist/requester/types.js.map +1 -1
  30. package/dist/storage/types.d.ts +5 -1
  31. package/dist/storage/types.js.map +1 -1
  32. package/dist/targeting/conditions/targetFeatureFlag.js +1 -1
  33. package/dist/targeting/conditions/targetFeatureFlag.js.map +1 -1
  34. package/dist/types.d.ts +17 -47
  35. package/dist/types.js.map +1 -1
  36. package/dist/utilities/types.d.ts +12 -1
  37. package/dist/utilities/types.js.map +1 -1
  38. package/dist/utilities/utilities.d.ts +6 -10
  39. package/dist/utilities/utilities.js +1 -1
  40. package/dist/utilities/utilities.js.map +1 -1
  41. package/dist/variationConfiguration/types.d.ts +6 -1
  42. package/dist/variationConfiguration/types.js.map +1 -1
  43. package/dist/variationConfiguration/variationConfiguration.d.ts +11 -1
  44. package/dist/variationConfiguration/variationConfiguration.js +1 -1
  45. package/dist/variationConfiguration/variationConfiguration.js.map +1 -1
  46. package/dist/visitorCodeManager/index.d.ts +1 -0
  47. package/dist/visitorCodeManager/index.js +2 -0
  48. package/dist/visitorCodeManager/index.js.map +1 -0
  49. package/dist/visitorCodeManager/visitorCodeManager.d.ts +14 -0
  50. package/dist/visitorCodeManager/visitorCodeManager.js +2 -0
  51. package/dist/visitorCodeManager/visitorCodeManager.js.map +1 -0
  52. package/package.json +1 -1
  53. package/dist/cookieManager/cookieManager.d.ts +0 -16
  54. package/dist/cookieManager/cookieManager.js +0 -2
  55. package/dist/cookieManager/cookieManager.js.map +0 -1
  56. package/dist/cookieManager/index.d.ts +0 -1
  57. package/dist/cookieManager/index.js +0 -2
  58. package/dist/cookieManager/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","a","b","siteCode","configuration","internalConfiguration","_classCallCheck","_defineProperty","f","ClientSettings","clientSettings","settings","environment","externalStorage","externalEventSource","externalPackageInfo","externalCookieManager","externalRequestDispatcher","externalClientConfiguration","requester","Requester","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","initialize","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","cookieManager","_createClass","key","value","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","useCache","c","wrap","d","prev","next","result","sent","throw","isOfflineModeOn","initialized","abrupt","ok","stop","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","length","data","Array","e","concat","g","h","i","j","k","l","m","n","o","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","VisitAmount","getVisitorData","visitorData","parseVisitorData","_createForOfIteratorHelper","s","done","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","Conversion","flush","trackData","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","getVisitorFeatureFlags","resultFeatureFlags","targetingData","storedTargetingData","visitorIdentifier","getVisitorIdentifier","featureFlag","variationData","getVariation","variationKey","OFF_VARIATION_KEY","environmentEnabled","featureFlagId","push","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","find","item","FeatureFlagConfigurationNotFound","variable","variations","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","type","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","_construct","CustomData","_toConsumableArray","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","getVisitorCode","params","setLegalConsent","consent","update","isServerEnvironment","setCookie","response","getConsentRequired","isConsentRequired","consentDataResult","read","Err","Environment","Production","withAssignment","experimentId","variationId","updateCache","cacheManager","trackFeatureExperiment","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { ClientConfiguration, JSONType } from './clientConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n DEFAULT_VISITOR_DATA_FILTERS,\n OFF_VARIATION_KEY,\n} from './constants';\nimport {\n Conversion,\n CustomData,\n DataManager,\n KameleoonDataType,\n} from './kameleoonData';\nimport { WAREHOUSE_AUDIENCE_KEY } from './constants';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport {\n TrackConversionParamsType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n RemoteVisitorDataParamsType,\n GetVisitorWarehouseAudienceParamsType,\n Environment,\n ServerGetVisitorCodeParametersType,\n ClientGetVisitorCodeParametersType,\n ServerSetLegalConsentParametersType,\n ClientSetLegalConsentParametersType,\n} from './types';\nimport { CookieManager } from './cookieManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport {\n ConsentDataType,\n IExternalStorage,\n OfflineTracking,\n} from './storage/types';\nimport { TargetingDataType } from './targeting';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving KameleoonData from Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getRemoteVisitorData: ({\n visitorCode,\n shouldAddData,\n filters,\n }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType) => void;\n /**\n * @method flush - takes visitor associated kameleoon data and sends the data tracking request with collected data,\n * sent data is removed from `KameleoonClient` instance but not from the storage for correct targeting checks. If no visitor is passed,\n * then data for all visitors is sent and removed from `KameleoonClient` instance. Moreover, regardless of visitor code input\n * the method first attempts to send all previously failed tracking requests which were stored locally during the offline mode.\n * @param {string | undefined} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n flush: (visitorCode: string) => void;\n /**\n * @method getFeatureFlags - returns a list of feature flags stored in the client configuration\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getFeatureFlags: () => FeatureFlagType[];\n /**\n * @method getVisitorFeatureFlags - returns a list of feature flags that the visitor with `visitorCode` that is targeted by and that are *active* for the visitor (visitor will have one of the variations allocated).\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {FeatureFlagType[]} a list of all feature flags items with `id` and `key` fields\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before `initialize` was done for `kameleoonClient`\n * - `KameleoonException.StorageRead` - Couldn't read storage data\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getVisitorFeatureFlags: (visitorCode: string) => FeatureFlagType[];\n /**\n * @method isFeatureFlagActive - returns a boolean indicating whether the visitor with `visitorCode` has `featureKey` active for him, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {boolean} a boolean indicator of whether the feature flag with `featureKey` is active for visitor with `visitorCode`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.DataInconsistency` - Allocated variation was found but there is no feature flag with according `featureKey`.\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n isFeatureFlagActive: (visitorCode: string, featureKey: string) => boolean;\n /**\n * @method getFeatureFlagVariationKey - returns variation key for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {string} featureKey - a unique key for feature flag\n * @returns {string} a string containing variable key for the allocated feature flag variation for the provided visitor\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n */\n getFeatureFlagVariationKey: (\n visitorCode: string,\n featureKey: string,\n ) => string;\n /**\n * @method getFeatureFlagVariable - returns a variable for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {GetFeatureFlagVariableParamsType} parameters - an object with parameters of a type `GetFeatureFlagVariableParamsType`, see the type for details.\n * @returns {FeatureVariableResultType} a variable object containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getFeatureFlagVariables - returns a list of variables for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - a unique visitor identifier, shouldn't exceed 255 characters\n * @param {string} featureKey - a unique key for feature flag\n * @returns {FeatureVariableResultType[]} a list of variable objects containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariables: (\n visitorCode: string,\n featureKey: string,\n ) => FeatureVariableResultType[];\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getVisitorWarehouseAudience - an async method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences\n * which is stored for specified visitorCode on a remote Kameleoon server.\n * Retrieved data will be added to storage under the specified `customDataIndex`\n * @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details.\n * @returns {Promise<CustomData | null>} `Promise` containing an instance of `CustomData` containing data associated with a visitor's warehouse audiences or `null` if the data was retrieved successfully but nothing was found under the specified `warehouseKey`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` - The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getVisitorWarehouseAudience: ({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method getVisitorCode - obtains visitor code from cookie or storage, if the visitor code doesn't yet exist generates a random visitor code (or uses a provided default)\n * @param { ServerGetVisitorCodeParametersType | ClientGetVisitorCodeParametersType } params - an object of type `ServerGetVisitorCodeParametersType` or `ClientGetVisitorCodeParametersType`\n * @returns {string} result visitor code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getVisitorCode: (\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ) => string;\n /**\n * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status\n * @param {ServerSetLegalConsentParametersType | ClientSetLegalConsentParametersType} params - an object of type `ServerSetLegalConsentParametersType` or `ClientSetLegalConsentParametersType`\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n setLegalConsent: (\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ) => void;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration: VariationConfiguration;\n private clientConfiguration: ClientConfiguration;\n private dataManager: DataManager;\n private offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n private consentDataStorage: IExternalStorage<ConsentDataType>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n private initialized: boolean = false;\n private environment?: Environment;\n private cookieManager: CookieManager;\n\n /**\n * @param {SDKCoreParameters} sdkCoreParameters - parameters for initializing sdk core\n */\n constructor({\n siteCode,\n configuration,\n internalConfiguration,\n }: SDKCoreParameters) {\n const { settings: clientSettings } = new ClientSettings(\n siteCode,\n configuration,\n );\n this.environment = clientSettings.environment;\n const {\n externalStorage,\n externalEventSource,\n externalPackageInfo,\n externalCookieManager,\n externalRequestDispatcher,\n externalClientConfiguration,\n } = internalConfiguration;\n const requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = externalStorage.initialize<ClientDataType>(\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = externalStorage.initialize<TargetingDataType>(\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = externalStorage.initialize<VariationDataType>(\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = externalStorage.initialize<OfflineTracking>(\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = externalStorage.initialize<ConsentDataType>(\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n externalEventSource,\n externalCookieManager,\n });\n\n const variationConfiguration = new VariationConfiguration(\n variationDataStorage,\n );\n\n this.variationConfiguration = variationConfiguration;\n this.requester = requester;\n this.trackingCache = trackingCache;\n this.dataManager = dataManager;\n this.clientConfiguration = clientConfiguration;\n this.externalPackageInfo = externalPackageInfo;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.consentDataStorage = consentDataStorage;\n this.cookieManager = externalCookieManager;\n }\n\n public async initialize(useCache?: boolean): Promise<boolean> {\n const result = await this.clientConfiguration.initialize(useCache);\n result.throw();\n\n this.isOfflineModeOn = useCache;\n this.initialized = true;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.dataManager.addData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData({\n visitorCode,\n shouldAddData = true,\n filters = DEFAULT_VISITOR_DATA_FILTERS,\n }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]> {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { previousVisitAmount } = filters;\n\n if (\n typeof previousVisitAmount === 'number' &&\n (previousVisitAmount < 1 || previousVisitAmount > 25)\n ) {\n throw new KameleoonError(KameleoonException.VisitAmount);\n }\n\n const result = await this.requester.getVisitorData(visitorCode, filters);\n const data = result.throw();\n\n const visitorData = Utilities.parseVisitorData({\n data,\n filters,\n visitorCode,\n variationConfiguration: this.variationConfiguration,\n });\n\n for (const dataItem of visitorData) {\n if (shouldAddData || this.dataManager.isPersistentCustomData(dataItem)) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n return visitorData;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n }: TrackConversionParamsType): void {\n this.addData(visitorCode, new Conversion({ goalId, revenue }));\n this.flush(visitorCode);\n }\n\n public flush(visitorCode?: string): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n if (typeof visitorCode === 'string') {\n Utilities.validateVisitorCode(visitorCode).throw();\n }\n\n if (visitorCode) {\n Utilities.trackData({\n visitorCode,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n return;\n }\n\n // --- Note ---\n // `Utilities.trackData` executes `Utilities.sendOfflineTracking` asynchronously at first, but\n // we need to execute `Utilities.sendOfflineTracking` even if calling `Utilities.trackData` is skipped\n // due to lack of unsent data\n if (!this.dataManager.unsentDataVisitors.length) {\n Utilities.sendOfflineTracking({\n requester: this.requester,\n storage: this.offlineTrackingStorage,\n });\n return;\n }\n\n for (const visitorCodeKey of this.dataManager.unsentDataVisitors) {\n Utilities.trackData({\n visitorCode: visitorCodeKey,\n dataManager: this.dataManager,\n requester: this.requester,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCodeKey),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n }\n }\n\n public getFeatureFlags(): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.clientConfiguration.featureFlags.map(({ id, featureKey }) => ({\n id,\n key: featureKey,\n }));\n }\n\n public getVisitorFeatureFlags(visitorCode: string): FeatureFlagType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const resultFeatureFlags: FeatureFlagType[] = [];\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n const visitorIdentifier =\n this.dataManager.getVisitorIdentifier(visitorCode);\n\n for (const featureFlag of featureFlags) {\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n visitorIdentifier,\n targetingData,\n featureFlag,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n if (\n variationData.variationKey !== OFF_VARIATION_KEY &&\n featureFlag.environmentEnabled\n ) {\n const { featureFlagId, featureKey } = variationData;\n\n resultFeatureFlags.push({ id: featureFlagId, key: featureKey });\n }\n }\n\n return resultFeatureFlags;\n }\n\n public getFeatureFlagVariationKey(\n visitorCode: string,\n featureKey: string,\n ): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n return variationKey;\n }\n\n public getFeatureFlagVariable({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public getFeatureFlagVariables(\n visitorCode: string,\n featureKey: string,\n ): FeatureVariableResultType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variation = featureFlag.variations.find(\n (item) => item.key === variationKey,\n );\n\n if (!variation) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariationNotFound,\n variationKey,\n visitorCode,\n );\n }\n\n const variables: FeatureVariableResultType[] = [];\n\n for (const variable of variation.variables) {\n const parsedVariable = Utilities.parseFeatureVariable(variable).throw();\n variables.push(parsedVariable);\n }\n\n return variables;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n try {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n } catch (err) {\n if (\n err instanceof KameleoonError &&\n err.type === KameleoonException.FeatureFlagEnvironmentDisabled\n ) {\n return false;\n }\n\n throw err;\n }\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public async getVisitorWarehouseAudience({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType): Promise<CustomData | null> {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const data = await this.getRemoteData(warehouseKey || visitorCode);\n\n if (!data) {\n throw new KameleoonError(KameleoonException.RemoteData);\n }\n\n if (\n !data[WAREHOUSE_AUDIENCE_KEY] ||\n Object.keys(data[WAREHOUSE_AUDIENCE_KEY]).length === 0\n ) {\n return null;\n }\n\n const customData = new CustomData(\n customDataIndex,\n ...Object.keys(data[WAREHOUSE_AUDIENCE_KEY]),\n );\n\n this.dataManager.addData(visitorCode, customData);\n\n return customData;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.clientConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n public getVisitorCode(\n params:\n | ServerGetVisitorCodeParametersType\n | ClientGetVisitorCodeParametersType,\n ): string {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n return this.cookieManager.getVisitorCode(params);\n }\n\n public setLegalConsent(\n params:\n | ServerSetLegalConsentParametersType\n | ClientSetLegalConsentParametersType,\n ): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n const { visitorCode, consent } = params;\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n this.consentDataStorage.update({ [visitorCode]: consent });\n\n if (consent) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: params.visitorCode,\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: params.visitorCode });\n }\n } else {\n if (this.cookieManager.getConsentRequired()) {\n if (Utilities.isServerEnvironment(params)) {\n this.cookieManager.setCookie({\n visitorCode: '',\n response: params.response,\n });\n } else {\n this.cookieManager.setCookie({ visitorCode: '' });\n }\n }\n }\n }\n\n private _isConsentProvided(visitorCode: string): boolean {\n const { isConsentRequired } = this.clientConfiguration;\n const consentDataResult = this.consentDataStorage.read();\n\n return (\n !isConsentRequired ||\n (consentDataResult.ok && consentDataResult.data[visitorCode])\n );\n }\n\n private _getFeatureFlagVariation(\n visitorCode: string,\n featureKey: string,\n ): Result<FeatureFlagVariationType, KameleoonError> {\n if (!this.initialized) {\n return Err(new KameleoonError(KameleoonException.Initialization));\n }\n\n const featureFlags = this.clientConfiguration.featureFlags;\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n ),\n );\n }\n\n if (!featureFlag.environmentEnabled) {\n return Err(\n new KameleoonError(\n KameleoonException.FeatureFlagEnvironmentDisabled,\n featureFlag.featureKey,\n this.environment || Environment.Production,\n ),\n );\n }\n\n const targetingData = this.dataManager.storedTargetingData[visitorCode];\n const visitorIdentifier =\n this.dataManager.getVisitorIdentifier(visitorCode);\n\n const variationData = this.variationConfiguration\n .getVariation({\n visitorCode,\n visitorIdentifier,\n featureFlag,\n targetingData,\n withAssignment: true,\n clientConfiguration: this.clientConfiguration,\n dataManager: this.dataManager,\n packageInfo: this.externalPackageInfo,\n })\n .throw();\n\n const { experimentId, variationId } = variationData;\n\n if (typeof variationId === 'number' && typeof experimentId === 'number') {\n Utilities.updateCache({\n cacheManager: this.trackingCache,\n visitorCode,\n experimentId,\n variationId,\n });\n }\n\n Utilities.trackFeatureExperiment({\n visitorCode,\n requester: this.requester,\n featureFlagVariation: variationData,\n dataManager: this.dataManager,\n isOfflineModeOn: this.isOfflineModeOn,\n isConsentProvided: this._isConsentProvided(visitorCode),\n offlineTrackingStorage: this.offlineTrackingStorage,\n });\n\n return Ok(variationData);\n }\n}\n"],"mappings":"qgWAiTa,CAAAA,eAAe,YAiB1B,SAAAC,EAAAC,CAAA,CAIsB,IAHpB,CAAAC,CAAQ,CAAAD,CAAA,CAARC,QAAQ,CACRC,CAAa,CAAAF,CAAA,CAAbE,aAAa,CACbC,CAAqB,CAAAH,CAAA,CAArBG,qBAAqB,CAAAC,eAAA,MAAAL,CAAA,EAAAM,eAAA,uCAAAA,eAAA,oCAAAA,eAAA,4BAAAA,eAAA,uCAAAA,eAAA,mCAAAA,eAAA,8BAAAA,eAAA,0BAAAA,eAAA,oCAAAA,eAAA,gCAAAA,eAAA,wBAAAA,eAAA,4BAAAA,eAAA,8BAErB,IAAAC,CAAA,CAAqC,GAAI,CAAAC,8BAAc,CACrDN,CAAQ,CACRC,CAAa,CACd,CAHiBM,CAAc,CAAAF,CAAA,CAAxBG,QAAQ,CAIhB,IAAI,CAACC,WAAW,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,CAAEC,CAAW,CAAK7D,CAAa,CAA7B6D,WAAW,CAqBjC,MAnB2B,QAAQ,EAA/B,MAAO,CAAAA,CAAwB,EAA4B,QAAQ,EAAhC,MAAO,CAAAD,CAAyB,EACrEnH,oBAAS,CAACqH,WAAW,CAAC,CACpBC,YAAY,CAAE,IAAI,CAACvK,aAAa,CAChCgD,WAAW,CAAXA,CAAW,CACXoH,YAAY,CAAZA,CAAY,CACZC,WAAW,CAAXA,CACF,CAAC,CAAC,CAGJpH,oBAAS,CAACuH,sBAAsB,CAAC,CAC/BxH,WAAW,CAAXA,CAAW,CACXpD,SAAS,CAAE,IAAI,CAACA,SAAS,CACzB6K,oBAAoB,CAAEjE,CAAa,CACnCzF,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7B2B,eAAe,CAAE,IAAI,CAACA,eAAe,CACrC6C,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAACxC,CAAW,CAAC,CACvDrC,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAA+J,SAAE,EAAClE,CAAa,CACzB,CAAC,IAAA9H,CAAA,IAAAiM,OAAA,CAAAlM,eAAA,CAAAA,eAAA"}
1
+ {"version":3,"file":"kameleoonClient.js","names":["KameleoonClient","a","b","siteCode","configuration","internalConfiguration","_classCallCheck","_defineProperty","f","ClientSettings","clientSettings","settings","environment","externalStorage","externalEventSource","externalPackageInfo","externalVisitorCodeManager","externalRequestDispatcher","externalClientConfiguration","requester","Requester","packageInfo","requestDispatcher","trackingCache","CacheManager","CACHE_CLEANUP_TIMEOUT","clientDataStorage","initialize","KameleoonStorageKey","ClientData","targetingDataStorage","TargetingData","variationDataStorage","VariationData","offlineTrackingStorage","OfflineTracking","consentDataStorage","ConsentData","dataManager","DataManager","storage","targetingCleanupInterval","targetingDataCleanupInterval","clientConfiguration","ClientConfiguration","variationConfiguration","VariationConfiguration","visitorCodeManager","_createClass","key","value","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","useCache","c","wrap","d","prev","next","result","sent","throw","isOfflineModeOn","initialized","abrupt","ok","stop","addData","visitorCode","Utilities","validateVisitorCode","KameleoonError","KameleoonException","Initialization","length","data","Array","e","concat","g","h","i","j","k","l","m","n","o","p","q","shouldAddData","filters","DEFAULT_VISITOR_DATA_FILTERS","previousVisitAmount","VisitAmount","getVisitorData","parseVisitorData","visitorData","visitsData","_createForOfIteratorHelper","s","done","dataItem","isPersistentCustomData","trackConversion","goalId","revenue","isUniqueIdentifier","Conversion","flush","trackData","isMappingIdentifier","isConsentProvided","_isConsentProvided","unsentDataVisitors","sendOfflineTracking","visitorCodeKey","getFeatureFlags","featureFlags","map","id","featureKey","getVisitorFeatureFlags","resultFeatureFlags","targetingData","storedTargetingData","visitorIdentifier","getVisitorIdentifier","featureFlag","variationData","getVariation","variationKey","OFF_VARIATION_KEY","environmentEnabled","featureFlagId","push","getFeatureFlagVariationKey","_getFeatureFlagVariation","getFeatureFlagVariable","variableKey","find","item","FeatureFlagConfigurationNotFound","variable","variations","variables","FeatureFlagVariableNotFound","featureVariable","parseFeatureVariable","getFeatureFlagVariables","variation","FeatureFlagVariationNotFound","parsedVariable","isFeatureFlagActive","err","type","FeatureFlagEnvironmentDisabled","getRemoteData","remoteData","customDataIndex","warehouseKey","RemoteData","WAREHOUSE_AUDIENCE_KEY","Object","keys","customData","_construct","CustomData","_toConsumableArray","onConfigurationUpdate","callback","getEngineTrackingCode","getTrackingCode","setUserConsent","consent","setData","update","getConsentRequired","isConsentRequired","consentDataResult","read","Err","Environment","Production","withAssignment","experimentId","variationId","updateCache","cacheManager","trackFeatureExperiment","featureFlagVariation","Ok","exports"],"sources":["../src/kameleoonClient.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { CacheManager } from './cacheManager';\nimport { ClientConfiguration, JSONType } from './clientConfiguration';\nimport { ClientSettings } from './clientSettings';\nimport {\n CACHE_CLEANUP_TIMEOUT,\n DEFAULT_VISITOR_DATA_FILTERS,\n OFF_VARIATION_KEY,\n} from './constants';\nimport {\n Conversion,\n CustomData,\n DataManager,\n KameleoonDataType,\n} from './kameleoonData';\nimport { WAREHOUSE_AUDIENCE_KEY } from './constants';\nimport { KameleoonError, KameleoonException } from './kameleoonError';\nimport { Requester } from './requester';\nimport {\n ClientDataType,\n KameleoonStorageKey,\n VariationDataType,\n} from './storage';\nimport {\n TrackConversionParamsType,\n FeatureFlagType,\n GetFeatureFlagVariableParamsType,\n FeatureVariableResultType,\n SDKCoreParameters,\n TrackingCacheItemType,\n ExternalPackageInfoType,\n RemoteVisitorDataParamsType,\n GetVisitorWarehouseAudienceParamsType,\n Environment,\n SetUserConsentParametersType,\n} from './types';\nimport { VisitorCodeManager } from './visitorCodeManager';\nimport { Utilities } from './utilities';\nimport {\n FeatureFlagVariationType,\n VariationConfiguration,\n} from './variationConfiguration';\nimport {\n ConsentDataType,\n IExternalStorage,\n OfflineTracking,\n} from './storage/types';\nimport { TargetingDataType } from './targeting';\n\n/**\n * @interface an interface of KameleoonClient instance\n */\nexport interface IKameleoonClient {\n /**\n * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached\n * @param {boolean | undefined} useCache - optional parameter for activating SDK offline mode, if `true` is passed failed polls will not return error and will use cached data if such data is available, default value is `false`. Note: if offline mode is on, SDK will still try to retrieve the latest data.\n * @returns {Promise<boolean>} Promise resolved into boolean field indicating success or fail\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api\n * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed\n */\n initialize(useCache?: boolean): Promise<boolean>;\n initialize(): Promise<boolean>;\n /**\n * @method addData - method for adding targeting data to the storage so that other methods could decide whether the current visitor is targeted or not. Note: userAgent data will not be stored in storage like other data, and it will be sent with every tracking request for bot filtration.\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @param {KameleoonDataType[]} kameleoonData - number of instances of any type of `KameleoonData`, can be added solely in array or as a sequential arguments\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n addData: (visitorCode: string, ...data: KameleoonDataType[]) => void;\n /**\n * @method getRemoteVisitorData - an asynchronous method for retrieving KameleoonData from Data API and optionally adding it to the storage so that other methods could decide whether the current visitor is targeted or not.\n * @param {RemoteVisitorDataParamsType} remoteVisitorDataParameters - `visitorCode`, `shouldAddData` and `filters` parameters\n * @returns {KameleoonDataType[]} promise resolved to an array of `KameleoonData` instances, only includes custom data\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n * - `KameleoonException.VisitAmount` - Visit amount must be a number between 1 and 25\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n getRemoteVisitorData: ({\n visitorCode,\n shouldAddData,\n filters,\n }: RemoteVisitorDataParamsType) => Promise<KameleoonDataType[]>;\n /**\n * @method trackConversion - creates and adds `Conversion` data to the visitor with specified parameters and executes `flush`. Note: it's a helper method for the quick and convenient conversion tracking, however creating and adding `Conversion` manually allows more flexible `Conversion` with `negative` parameter\n * @param {TrackConversionParamsType} conversionParameters - `visitorCode`, `goalId` and `revenue` parameters for data tracking\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.StorageWrite` Couldn't update storage data\n */\n trackConversion: ({\n visitorCode,\n goalId,\n revenue,\n 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 {FeatureVariableResultType} a variable object containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariableNotFound` - No feature variable was found for provided `visitorCode` and `variableKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.NotTargeted` - Current visitor is not targeted\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariable: ({\n visitorCode,\n featureKey,\n variableKey,\n }: GetFeatureFlagVariableParamsType) => FeatureVariableResultType;\n /**\n * @method getFeatureFlagVariables - returns a list of variables for the visitor under `visitorCode` in the found feature flag, this method includes targeting check, finding the according variation exposed to the visitor and saving it to storage along with sending tracking request\n * @param {string} visitorCode - a unique visitor identifier, shouldn't exceed 255 characters\n * @param {string} featureKey - a unique key for feature flag\n * @returns {FeatureVariableResultType[]} a list of variable objects containing `type` and `value` fields. You can check the `type` field against `FeatureVariableType` enum. For example, if the `type` is `FeatureVariableType.BOOLEAN` then `value` will be a `boolean` type.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n * - `KameleoonException.FeatureFlagConfigurationNotFound` - No feature flag was found for provided `featureKey`\n * - `KameleoonException.FeatureFlagVariationNotFound` - No feature variation was found for provided `visitorCode` and `variationKey`\n * - `KameleoonException.FeatureFlagEnvironmentDisabled` - The feature flag is disabled for the current environment\n * - `KameleoonException.JSONParse` - Couldn't parse JSON value\n * - `KameleoonException.NumberParse` - Couldn't parse Number value\n */\n getFeatureFlagVariables: (\n visitorCode: string,\n featureKey: string,\n ) => FeatureVariableResultType[];\n /**\n * @method getRemoteData - returns a data which is stored for specified siteCode on a remote Kameleoon server.\n * @param {string} key - unique key that the data you try to get is associated with.\n * @returns {JSONType} - promise with retrieving data for specific key.\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getRemoteData: (key: string) => Promise<JSONType>;\n /**\n * @method getVisitorWarehouseAudience - an async method that returns a `CustomData` instance, containing data associated with a visitor's warehouse audiences\n * which is stored for specified visitorCode on a remote Kameleoon server.\n * Retrieved data will be added to storage under the specified `customDataIndex`\n * @param {GetVisitorWarehouseAudienceParamsType} parameters - an object with parameters of a type `GetVisitorWarehouseAudienceParamsType`, see the type for details.\n * @returns {Promise<CustomData | null>} `Promise` containing an instance of `CustomData` containing data associated with a visitor's warehouse audiences or `null` if the data was retrieved successfully but nothing was found under the specified `warehouseKey`\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` - The visitor code is empty\n * - `KameleoonException.RemoteData` - Couldn't retrieve data from Kameleoon server\n */\n getVisitorWarehouseAudience: ({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType) => Promise<CustomData | null>;\n /**\n * @method getEngineTrackingCode - returns Kameleoon tracking code for the current visitor. Tracking code is built of the experiments that were triggered and feature flag variations that were assigned during the last 5 seconds\n * See [Kameleoon Automation API](https://developers.kameleoon.com/apis/activation-api-js/api-reference#trigger-1) for the details\n * @param {string} visitorCode - unique visitor identification string, can't exceed 255 characters length\n * @returns {string} Kameleoon tracking code\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded\n * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty\n */\n getEngineTrackingCode: (visitorCode: string) => string;\n /**\n * @method setUserConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status\n * @param {SetUserConsentParametersType} params - an object of type `SetUserConsentParametersType`, see the type for details.\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 */\n setUserConsent: (params: SetUserConsentParametersType) => void;\n /**\n * @method onConfigurationUpdate - fires a callback on client configuration update. Note: this method only works for server sent events of real time update.\n * @param {() => void} callback - callback function with no parameters that will be called upon configuration update\n * @returns {void}\n * @throws `KameleoonError` with one of the following `type` s:\n *\n * - `KameleoonException.Initialization` - Method was executed before the `kameleoonClient` completed it's `initialize` call\n */\n onConfigurationUpdate: (callback: () => void) => void;\n}\n\n/**\n * @class\n * KameleoonClient - a class for creating kameleoon client instance\n * for communicating with Kameleoon JavaScript SDK Core, when new instance is created\n */\nexport class KameleoonClient implements IKameleoonClient {\n private variationConfiguration: VariationConfiguration;\n private clientConfiguration: ClientConfiguration;\n private dataManager: DataManager;\n private offlineTrackingStorage: IExternalStorage<OfflineTracking>;\n private consentDataStorage: IExternalStorage<ConsentDataType>;\n private trackingCache: CacheManager<TrackingCacheItemType>;\n private requester: Requester;\n private externalPackageInfo: ExternalPackageInfoType;\n private isOfflineModeOn?: boolean;\n private initialized: boolean = false;\n private environment?: Environment;\n private visitorCodeManager: VisitorCodeManager;\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 requester = new Requester({\n siteCode,\n environment: clientSettings.environment,\n packageInfo: externalPackageInfo,\n requestDispatcher: externalRequestDispatcher,\n });\n const trackingCache = new CacheManager<TrackingCacheItemType>(\n CACHE_CLEANUP_TIMEOUT,\n );\n\n const clientDataStorage = externalStorage.initialize<ClientDataType>(\n KameleoonStorageKey.ClientData,\n );\n const targetingDataStorage = externalStorage.initialize<TargetingDataType>(\n KameleoonStorageKey.TargetingData,\n );\n const variationDataStorage = externalStorage.initialize<VariationDataType>(\n KameleoonStorageKey.VariationData,\n );\n const offlineTrackingStorage = externalStorage.initialize<OfflineTracking>(\n KameleoonStorageKey.OfflineTracking,\n );\n const consentDataStorage = externalStorage.initialize<ConsentDataType>(\n KameleoonStorageKey.ConsentData,\n );\n\n const dataManager = new DataManager({\n storage: targetingDataStorage,\n targetingCleanupInterval: configuration?.targetingDataCleanupInterval,\n });\n\n const clientConfiguration = new ClientConfiguration({\n settings: clientSettings,\n storage: clientDataStorage,\n dataManager,\n requester,\n externalClientConfiguration,\n offlineTrackingStorage,\n externalEventSource,\n 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(useCache);\n result.throw();\n\n this.isOfflineModeOn = useCache;\n this.initialized = true;\n\n return result.ok;\n }\n\n public addData(visitorCode: string, ...data: KameleoonDataType[]): void {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.dataManager.addData(visitorCode, ...data).throw();\n }\n\n public async getRemoteVisitorData({\n visitorCode,\n shouldAddData = true,\n filters = DEFAULT_VISITOR_DATA_FILTERS,\n }: RemoteVisitorDataParamsType): Promise<KameleoonDataType[]> {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { previousVisitAmount } = filters;\n\n if (\n typeof previousVisitAmount === 'number' &&\n (previousVisitAmount < 1 || previousVisitAmount > 25)\n ) {\n throw new KameleoonError(KameleoonException.VisitAmount);\n }\n\n const result = await this.requester.getVisitorData(visitorCode, filters);\n const data = result.throw();\n\n const { visitorData, visitsData } = Utilities.parseVisitorData({\n data,\n filters,\n visitorCode,\n variationConfiguration: this.variationConfiguration,\n });\n\n for (const dataItem of visitorData) {\n if (shouldAddData || this.dataManager.isPersistentCustomData(dataItem)) {\n this.addData(visitorCode, dataItem);\n }\n }\n\n // --- Note ---\n // Data on visits amount and time stamps is not returned to a user\n if (visitsData && shouldAddData) {\n this.addData(visitorCode, visitsData);\n }\n\n return visitorData;\n }\n\n public trackConversion({\n visitorCode,\n goalId,\n revenue,\n 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): FeatureVariableResultType {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variable = featureFlag.variations\n .find((item) => item.key === variationKey)\n ?.variables.find((item) => item.key === variableKey);\n\n if (!variable) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariableNotFound,\n variableKey,\n visitorCode,\n );\n }\n\n const featureVariable = Utilities.parseFeatureVariable(variable).throw();\n\n return featureVariable;\n }\n\n public getFeatureFlagVariables(\n visitorCode: string,\n featureKey: string,\n ): FeatureVariableResultType[] {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const { variationKey } = this._getFeatureFlagVariation(\n visitorCode,\n featureKey,\n ).throw();\n\n const featureFlags = this.clientConfiguration.featureFlags;\n\n const featureFlag = featureFlags.find(\n (item) => item.featureKey === featureKey,\n );\n\n if (!featureFlag) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagConfigurationNotFound,\n featureKey,\n );\n }\n\n const variation = featureFlag.variations.find(\n (item) => item.key === variationKey,\n );\n\n if (!variation) {\n throw new KameleoonError(\n KameleoonException.FeatureFlagVariationNotFound,\n variationKey,\n visitorCode,\n );\n }\n\n const variables: FeatureVariableResultType[] = [];\n\n for (const variable of variation.variables) {\n const parsedVariable = Utilities.parseFeatureVariable(variable).throw();\n variables.push(parsedVariable);\n }\n\n return variables;\n }\n\n public isFeatureFlagActive(visitorCode: string, featureKey: string): boolean {\n try {\n const variationKey = this.getFeatureFlagVariationKey(\n visitorCode,\n featureKey,\n );\n\n return variationKey !== OFF_VARIATION_KEY;\n } catch (err) {\n if (\n err instanceof KameleoonError &&\n err.type === KameleoonException.FeatureFlagEnvironmentDisabled\n ) {\n return false;\n }\n\n throw err;\n }\n }\n\n public async getRemoteData(key: string): Promise<JSONType> {\n const remoteData = await this.requester.getRemoteData(key);\n\n return remoteData.throw();\n }\n\n public async getVisitorWarehouseAudience({\n visitorCode,\n customDataIndex,\n warehouseKey,\n }: GetVisitorWarehouseAudienceParamsType): Promise<CustomData | null> {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n const data = await this.getRemoteData(warehouseKey || visitorCode);\n\n if (!data) {\n throw new KameleoonError(KameleoonException.RemoteData);\n }\n\n if (\n !data[WAREHOUSE_AUDIENCE_KEY] ||\n Object.keys(data[WAREHOUSE_AUDIENCE_KEY]).length === 0\n ) {\n return null;\n }\n\n const customData = new CustomData(\n customDataIndex,\n ...Object.keys(data[WAREHOUSE_AUDIENCE_KEY]),\n );\n\n this.dataManager.addData(visitorCode, customData);\n\n return customData;\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n if (!this.initialized) {\n throw new KameleoonError(KameleoonException.Initialization);\n }\n\n this.clientConfiguration.onConfigurationUpdate(callback);\n }\n\n public getEngineTrackingCode(visitorCode: string): string {\n Utilities.validateVisitorCode(visitorCode).throw();\n\n return Utilities.getTrackingCode(this.trackingCache, visitorCode);\n }\n\n public 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(visitorCode);\n } else {\n if (this.visitorCodeManager.getConsentRequired()) {\n setData('');\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":"qgWA4Ra,CAAAA,eAAe,Y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iD,KAAK,EAAE,CAEF4H,CAAY,CAAkBxD,CAAa,CAA3CwD,YAAY,CAAEC,CAAW,CAAKzD,CAAa,CAA7ByD,WAAW,CAsBjC,MApB2B,QAAQ,EAA/B,MAAO,CAAAA,CAAwB,EAA4B,QAAQ,EAAhC,MAAO,CAAAD,CAAyB,EACrEpH,oBAAS,CAACsH,WAAW,CAAC,CACpBC,YAAY,CAAE,IAAI,CAACxK,aAAa,CAChCgD,WAAW,CAAXA,CAAW,CACXqH,YAAY,CAAZA,CAAY,CACZC,WAAW,CAAXA,CACF,CAAC,CAAC,CAGJrH,oBAAS,CAACwH,sBAAsB,CAAC,CAC/BzH,WAAW,CAAXA,CAAW,CACXpD,SAAS,CAAE,IAAI,CAACA,SAAS,CACzB8K,oBAAoB,CAAE7D,CAAa,CACnC9F,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7B2B,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCkD,iBAAiB,CAAE,IAAI,CAACC,kBAAkB,CAAC7C,CAAW,CAAC,CACvDrC,sBAAsB,CAAE,IAAI,CAACA,sBAAsB,CACnDW,sBAAsB,CAAE,IAAI,CAACA,sBAC/B,CAAC,CAAC,CAEK,GAAAqJ,SAAE,EAAC9D,CAAa,CACzB,CAAC,IAAAnI,CAAA,IAAAkM,OAAA,CAAAnM,eAAA,CAAAA,eAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataProcessor=void 0;var _tsRes=require("ts-res"),_utilities=require("../utilities"),_types=require("../utilities/types"),_visitsData=require("./visitsData"),_types2=require("../types"),_constants=require("./constants"),_types3=require("./types"),_excluded=["customData","pageView","conversion"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var DataProcessor=function(){function a(b){_classCallCheck(this,a),_defineProperty(this,"storage",void 0),this.storage=b}return _createClass(a,[{key:"updateData",value:function updateData(a,b){var c=this.storage.read().or({}),d={visitorCode:a,data:c};switch(b.data.type){case _types3.KameleoonData.CustomData:{var e=b.data,f=c[a]&&_types3.KameleoonData.CustomData in c[a],g=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.CustomData,nestedKey:e.index.toString(),value:e});f?this.updateNestedField(g):this.createNestedField(g);break}case _types3.KameleoonData.PageView:{var h,i=b.data;i.timestamps.length||(i.timestamps=[Date.now()]);var j=c[a]&&_types3.KameleoonData.PageView in c[a]&&(null===(h=c[a][i.type])||void 0===h?void 0:h[i.urlAddress]),k=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.PageView,nestedKey:i.urlAddress,value:i});if(j){i.timestamps.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:j.timestamps,element:a,order:_types.Order.Ascending})});var l=[i.referrers,i.title];j.referrers=l[0],j.title=l[1],this.updateNestedField(_objectSpread(_objectSpread({},k),{},{value:j}))}else this.createNestedField(k);break}case _types3.KameleoonData.Conversion:{var m=b.data,n=c[a]&&_types3.KameleoonData.Conversion in c[a],o=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.Conversion,value:m});n?this.updateArrayField(o):this.createArrayField(o);break}case _types3.KameleoonData.VisitsData:{var p=b.data,q=c[a]&&_types3.KameleoonData.VisitsData in c[a],r=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.VisitsData,value:p});if(q){var s=c[a][p.type];s.previousVisits.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:p.previousVisits,element:a,order:_types.Order.Ascending})});var t=s.currentVisit;(!t&&p.currentVisit||t&&p.currentVisit&&t<p.currentVisit)&&(t=p.currentVisit),this.updateField(_objectSpread(_objectSpread({},r),{},{value:_objectSpread(_objectSpread({},p),{},{previousVisits:p.previousVisits,currentVisit:t})}))}else this.createField(r);break}default:{var u=b.data,v=c[a]&&u.type in c[a],w=_objectSpread(_objectSpread({},d),{},{key:u.type,value:u});v?this.updateField(w):this.createField(w)}}return this.storage.write(c)}},{key:"createVisit",value:function createVisit(a){var b,c=this.storage.read();if(!c.ok)return(0,_tsRes.Err)(c.error);var d=c.data;return null!==(b=d[a])&&void 0!==b&&b[_types3.KameleoonData.VisitsData]||this.updateField({visitorCode:a,key:_types3.KameleoonData.VisitsData,value:new _visitsData.VisitsData(Date.now(),[]).data,data:d}),this.storage.write(d)}},{key:"cleanupOutdatedTargetingData",value:function cleanupOutdatedTargetingData(a){var b=this.storage.read();if(b.ok){for(var c=b.data,d=a?a*_types2.Milliseconds.Minute:_constants.DEFAULT_CLEANUP_INTERVAL*_types2.Milliseconds.Minute,e=Date.now(),f=0,g=Object.entries(c);f<(void 0).length;f++){var h=_slicedToArray((void 0)[f],2),i=h[0],j=h[1],k=j.customData,l=j.pageView,m=j.conversion,n=_objectWithoutProperties(j,_excluded);if(k)for(var o=0,p=Object.entries(k);o<p.length;o++){var q=_slicedToArray(p[o],2),r=q[0],s=q[1];if(s){var t=s.lastActivityTime+d<e,u=j[_types3.KameleoonData.CustomData];t&&u&&delete u[+r],u&&!Object.keys(u).length&&delete j[_types3.KameleoonData.CustomData]}}if(l)for(var v=0,w=Object.entries(l);v<w.length;v++){var x=_slicedToArray(w[v],2),y=x[0],z=x[1],A=z.lastActivityTime+d<e,B=j[_types3.KameleoonData.PageView];A&&B&&delete B[y],B&&!Object.keys(B).length&&delete j[_types3.KameleoonData.PageView]}if(m){var C,D=_createForOfIteratorHelper(m);try{for(D.s();!(C=D.n()).done;){var E=C.value,F=E.lastActivityTime+d<e,G=j[_types3.KameleoonData.Conversion];F&&G&&G.splice(G.indexOf(E),1),G&&!G.length&&delete j[_types3.KameleoonData.Conversion]}}catch(a){D.e(a)}finally{D.f()}}for(var H=0,I=Object.entries(n);H<I.length;H++){var J=_slicedToArray(I[H],2),K=J[0],L=J[1],M=L.lastActivityTime+d<e;M&&delete j[K]}Object.keys(c[i]).length||delete c[i]}this.storage.write(c)}}},{key:"storedTargetingData",get:function get(){return this.storage.read()}},{key:"updateField",value:function updateField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b][c]=_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})}},{key:"createField",value:function createField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b]=_objectSpread(_objectSpread({},e[b]),{},_defineProperty({},c,_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})))}},{key:"updateArrayField",value:function updateArrayField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b][c].push(_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()}))}},{key:"createArrayField",value:function createArrayField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b]=_objectSpread(_objectSpread({},e[b]),{},_defineProperty({},c,[_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})]))}},{key:"updateNestedField",value:function updateNestedField(a){var b=a.visitorCode,c=a.key,d=a.nestedKey,e=a.value,f=a.data;f[b][c][d]=_objectSpread(_objectSpread({},e),{},{lastActivityTime:Date.now()})}},{key:"createNestedField",value:function createNestedField(a){var b,c=a.visitorCode,d=a.key,e=a.nestedKey,f=a.value,g=a.data;g[c]=null!==(b=g[c])&&void 0!==b&&b[d]?_objectSpread(_objectSpread({},g[c]),{},_defineProperty({},d,_objectSpread(_objectSpread({},g[c][d]),{},_defineProperty({},e,_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()}))))):_objectSpread(_objectSpread({},g[c]),{},_defineProperty({},d,_defineProperty({},e,_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()}))))}}]),a}();exports.DataProcessor=DataProcessor;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataProcessor=void 0;var _tsRes=require("ts-res"),_utilities=require("../utilities"),_types=require("../utilities/types"),_visitsData=require("./visitsData"),_types2=require("../types"),_constants=require("./constants"),_types3=require("./types"),_excluded=["customData","pageView","conversion"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _createForOfIteratorHelper(a,b){var c="undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(!c){if(Array.isArray(a)||(c=_unsupportedIterableToArray(a))||b&&a&&"number"==typeof a.length){c&&(a=c);var d=0,e=function(){};return{s:e,n:function n(){return d>=a.length?{done:!0}:{done:!1,value:a[d++]}},e:function e(a){throw a},f:e}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,g=!0,h=!1;return{s:function s(){c=c.call(a)},n:function n(){var a=c.next();return g=a.done,a},e:function e(a){h=!0,f=a},f:function f(){try{g||null==c.return||c.return()}finally{if(h)throw f}}}}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||Object.prototype.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c,d,e={},f=Object.keys(a);for(d=0;d<f.length;d++)c=f[d],0<=b.indexOf(c)||(e[c]=a[c]);return e}function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){var c=null==a?null:"undefined"!=typeof Symbol&&a[Symbol.iterator]||a["@@iterator"];if(null!=c){var d,e,f,g,h=[],i=!0,j=!1;try{if(f=(c=c.call(a)).next,0===b){if(Object(c)!==c)return;i=!1}else for(;!(i=(d=f.call(c)).done)&&(h.push(d.value),h.length!==b);i=!0);}catch(a){j=!0,e=a}finally{try{if(!i&&null!=c.return&&(g=c.return(),Object(g)!==g))return}finally{if(j)throw e}}return h}}function _arrayWithHoles(a){if(Array.isArray(a))return a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var DataProcessor=function(){function a(b){_classCallCheck(this,a),_defineProperty(this,"storage",void 0),this.storage=b}return _createClass(a,[{key:"updateData",value:function updateData(a,b){var c=this.storage.read().or({}),d={visitorCode:a,data:c};switch(b.data.type){case _types3.KameleoonData.CustomData:{var e=b.data,f=c[a]&&_types3.KameleoonData.CustomData in c[a],g=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.CustomData,nestedKey:e.index.toString(),value:e});f?this.updateNestedField(g):this.createNestedField(g);break}case _types3.KameleoonData.PageView:{var h,i=b.data;i.timestamps.length||(i.timestamps=[Date.now()]);var j=c[a]&&_types3.KameleoonData.PageView in c[a]&&(null===(h=c[a][i.type])||void 0===h?void 0:h[i.urlAddress]),k=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.PageView,nestedKey:i.urlAddress,value:i});if(j){i.timestamps.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:j.timestamps,element:a,order:_types.Order.Ascending})});var l=[i.referrers,i.title];j.referrers=l[0],j.title=l[1],this.updateNestedField(_objectSpread(_objectSpread({},k),{},{value:j}))}else this.createNestedField(k);break}case _types3.KameleoonData.Conversion:{var m=b.data,n=c[a]&&_types3.KameleoonData.Conversion in c[a],o=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.Conversion,value:m});n?this.updateArrayField(o):this.createArrayField(o);break}case _types3.KameleoonData.VisitsData:{var p=b.data,q=c[a]&&_types3.KameleoonData.VisitsData in c[a],r=_objectSpread(_objectSpread({},d),{},{key:_types3.KameleoonData.VisitsData,value:p});if(q){var s=c[a][p.type];s.previousVisits.forEach(function(a){_utilities.Utilities.insertInOrderedListMutably({list:p.previousVisits,element:a,order:_types.Order.Ascending})});var t=s.currentVisit;(!t&&p.currentVisit||t&&p.currentVisit&&t<p.currentVisit)&&(t=p.currentVisit),this.updateField(_objectSpread(_objectSpread({},r),{},{value:_objectSpread(_objectSpread({},p),{},{previousVisits:p.previousVisits,currentVisit:t})}))}else this.createField(r);break}default:{var u=b.data,v=c[a]&&u.type in c[a],w=_objectSpread(_objectSpread({},d),{},{key:u.type,value:u});v?this.updateField(w):this.createField(w)}}return this.storage.write(c)}},{key:"createVisit",value:function createVisit(a){var b,c=this.storage.read();if(!c.ok)return(0,_tsRes.Err)(c.error);var d=c.data;return null!==(b=d[a])&&void 0!==b&&b[_types3.KameleoonData.VisitsData]||this.updateField({visitorCode:a,key:_types3.KameleoonData.VisitsData,value:new _visitsData.VisitsData(Date.now(),[]).data,data:d}),this.storage.write(d)}},{key:"cleanupOutdatedTargetingData",value:function cleanupOutdatedTargetingData(a){var b=this.storage.read();if(b.ok){var c=b.data,d=a?a*_types2.Milliseconds.Minute:_constants.DEFAULT_CLEANUP_INTERVAL*_types2.Milliseconds.Minute,e=Date.now();if(Object.keys(c).length){for(var f=0,g=Object.entries(c);f<g.length;f++){var h=_slicedToArray(g[f],2),i=h[0],j=h[1],k=j.customData,l=j.pageView,m=j.conversion,n=_objectWithoutProperties(j,_excluded);if(k)for(var o=0,p=Object.entries(k);o<p.length;o++){var q=_slicedToArray(p[o],2),r=q[0],s=q[1];if(s){var t=s.lastActivityTime+d<e,u=j[_types3.KameleoonData.CustomData];t&&u&&delete u[+r],u&&!Object.keys(u).length&&delete j[_types3.KameleoonData.CustomData]}}if(l)for(var v=0,w=Object.entries(l);v<w.length;v++){var x=_slicedToArray(w[v],2),y=x[0],z=x[1],A=z.lastActivityTime+d<e,B=j[_types3.KameleoonData.PageView];A&&B&&delete B[y],B&&!Object.keys(B).length&&delete j[_types3.KameleoonData.PageView]}if(m){var C,D=_createForOfIteratorHelper(m);try{for(D.s();!(C=D.n()).done;){var E=C.value,F=E.lastActivityTime+d<e,G=j[_types3.KameleoonData.Conversion];F&&G&&G.splice(G.indexOf(E),1),G&&!G.length&&delete j[_types3.KameleoonData.Conversion]}}catch(a){D.e(a)}finally{D.f()}}for(var H=0,I=Object.entries(n);H<I.length;H++){var J=_slicedToArray(I[H],2),K=J[0],L=J[1],M=L.lastActivityTime+d<e;M&&delete j[K]}Object.keys(c[i]).length||delete c[i]}this.storage.write(c)}}}},{key:"storedTargetingData",get:function get(){return this.storage.read()}},{key:"updateField",value:function updateField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b][c]=_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})}},{key:"createField",value:function createField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b]=_objectSpread(_objectSpread({},e[b]),{},_defineProperty({},c,_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})))}},{key:"updateArrayField",value:function updateArrayField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b][c].push(_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()}))}},{key:"createArrayField",value:function createArrayField(a){var b=a.visitorCode,c=a.key,d=a.value,e=a.data;e[b]=_objectSpread(_objectSpread({},e[b]),{},_defineProperty({},c,[_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})]))}},{key:"updateNestedField",value:function updateNestedField(a){var b=a.visitorCode,c=a.key,d=a.nestedKey,e=a.value,f=a.data;f[b][c][d]=_objectSpread(_objectSpread({},e),{},{lastActivityTime:Date.now()})}},{key:"createNestedField",value:function createNestedField(a){var b,c=a.visitorCode,d=a.key,e=a.nestedKey,f=a.value,g=a.data;g[c]=null!==(b=g[c])&&void 0!==b&&b[d]?_objectSpread(_objectSpread({},g[c]),{},_defineProperty({},d,_objectSpread(_objectSpread({},g[c][d]),{},_defineProperty({},e,_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()}))))):_objectSpread(_objectSpread({},g[c]),{},_defineProperty({},d,_defineProperty({},e,_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()}))))}}]),a}();exports.DataProcessor=DataProcessor;
2
2
  //# sourceMappingURL=dataProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataProcessor.js","names":["DataProcessor","a","storage","_classCallCheck","_defineProperty","_createClass","key","value","updateData","visitorCode","dataItem","targetingData","read","or","commonParameters","data","type","KameleoonData","CustomData","hasCustomDataKey","parameters","_objectSpread","nestedKey","index","toString","updateNestedField","createNestedField","PageView","h","timestamps","length","Date","now","existingData","urlAddress","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","l","referrers","title","Conversion","hasConversionDataKey","updateArrayField","createArrayField","VisitsData","hasVisitsKey","existingVisits","previousVisits","visit","currentVisit","updateField","createField","hasDataKey","write","createVisit","b","storageData","ok","Err","error","cleanupOutdatedTargetingData","targetingCleanupInterval","targetingDataLifetime","Milliseconds","Minute","DEFAULT_CLEANUP_INTERVAL","currentTime","f","g","Object","entries","_slicedToArray","kameleoonVisitorData","customData","pageView","conversion","rest","_objectWithoutProperties","_excluded","o","p","q","isDataExpired","lastActivityTime","keys","v","w","x","url","C","D","_createForOfIteratorHelper","s","n","done","splice","indexOf","e","H","I","J","get","push","exports"],"sources":["../../src/kameleoonData/dataProcessor.ts"],"sourcesContent":["import { Err, Result } from 'ts-res';\nimport { IExternalStorage } from 'src/storage';\nimport { TargetingDataType } from 'src/targeting';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport { VisitsData } from './visitsData';\nimport { Milliseconds } from 'src/types';\nimport { DEFAULT_CLEANUP_INTERVAL } from './constants';\nimport {\n ArrayFieldParametersType,\n ConversionDataType,\n CustomDataType,\n ExistingArrayDataType,\n ExistingDataType,\n ExistingNestedDataType,\n ExistingPageViewDataType,\n ExistingVisitsDataType,\n FieldParametersType,\n KameleoonData,\n KameleoonDataType,\n NestedFieldParametersType,\n PageViewDataType,\n VisitsDataType,\n} from './types';\n\ninterface IDataProcessor {\n updateData(\n visitorCode: string,\n dataItem: KameleoonDataType,\n ): Result<void, KameleoonError>;\n createVisit(visitorCode: string): void;\n cleanupOutdatedTargetingData(targetingCleanupInterval?: number): void;\n readonly storedTargetingData: Result<TargetingDataType, KameleoonError>;\n}\n\nexport class DataProcessor implements IDataProcessor {\n private storage: IExternalStorage<TargetingDataType>;\n\n constructor(storage: IExternalStorage<TargetingDataType>) {\n this.storage = storage;\n }\n\n // --- Note ---\n // Following code is optimized for performance:\n // - We don't want to copy the whole object every time we add new data\n // - So we are manually checking the keys existence and mutating targeting data directly\n // - Numerous type casts are required because we can't narrow down nested `targetingData` types by using assertion functions\n public updateData(\n visitorCode: string,\n dataItem: KameleoonDataType,\n ): Result<void, KameleoonError> {\n const targetingData = this.storage.read().or({});\n const commonParameters: Pick<FieldParametersType, 'visitorCode' | 'data'> =\n {\n visitorCode,\n data: targetingData,\n };\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const data = dataItem.data as CustomDataType;\n const hasCustomDataKey =\n targetingData[visitorCode] &&\n KameleoonData.CustomData in targetingData[visitorCode];\n const parameters: NestedFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.CustomData,\n nestedKey: data.index.toString(),\n value: data,\n };\n\n if (hasCustomDataKey) {\n this.updateNestedField(parameters);\n } else {\n this.createNestedField(parameters);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // We assign `timestamps` to `Date.now()` if it's empty\n // Not upon data item creation because it makes no sense in terms\n // of data flow to have some indication of data activity before it was added\n if (!data.timestamps.length) {\n data.timestamps = [Date.now()];\n }\n\n const existingData =\n targetingData[visitorCode] &&\n KameleoonData.PageView in targetingData[visitorCode] &&\n (targetingData[visitorCode][data.type] as ExistingPageViewDataType)?.[\n data.urlAddress\n ];\n\n const parameters: NestedFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.PageView,\n nestedKey: data.urlAddress,\n value: data,\n };\n\n if (existingData) {\n // --- Note ---\n // Updating existing `PageView` properties by pushing new timestamps\n // and potentially changing referrers and title\n data.timestamps.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: existingData.timestamps,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n\n [existingData.referrers, existingData.title] = [\n data.referrers,\n data.title,\n ];\n\n this.updateNestedField({ ...parameters, value: existingData });\n } else {\n this.createNestedField(parameters);\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const data = dataItem.data as ConversionDataType;\n const hasConversionDataKey =\n targetingData[visitorCode] &&\n KameleoonData.Conversion in targetingData[visitorCode];\n const parameters: ArrayFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.Conversion,\n value: data,\n };\n\n if (hasConversionDataKey) {\n this.updateArrayField(parameters);\n } else {\n this.createArrayField(parameters);\n }\n\n break;\n }\n case KameleoonData.VisitsData: {\n const data = dataItem.data as VisitsDataType;\n const hasVisitsKey =\n targetingData[visitorCode] &&\n KameleoonData.VisitsData in targetingData[visitorCode];\n const parameters: FieldParametersType = {\n ...commonParameters,\n key: KameleoonData.VisitsData,\n value: data,\n };\n\n // -- Change directly if `[key]` exists\n if (hasVisitsKey) {\n const existingVisits = targetingData[visitorCode][\n data.type\n ] as ExistingVisitsDataType;\n\n // --- Note ---\n // We are preserving the order of visits\n existingVisits.previousVisits.forEach((visit) => {\n Utilities.insertInOrderedListMutably({\n list: data.previousVisits,\n element: visit,\n order: Order.Ascending,\n });\n });\n\n let currentVisit = existingVisits.currentVisit;\n\n // --- Note ---\n // We are using new current visit in two cases:\n // 1. If there is no current visit in existing data\n // 2. If existing current visit is older than new current visit\n if (\n (!currentVisit && data.currentVisit) ||\n (currentVisit &&\n data.currentVisit &&\n currentVisit < data.currentVisit)\n ) {\n currentVisit = data.currentVisit;\n }\n\n this.updateField({\n ...parameters,\n value: {\n ...data,\n previousVisits: data.previousVisits,\n currentVisit,\n },\n });\n } else {\n this.createField(parameters);\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n const hasDataKey =\n targetingData[visitorCode] && data.type in targetingData[visitorCode];\n const parameters: FieldParametersType = {\n ...commonParameters,\n key: data.type,\n // --- Note ---\n // At this point TypeScript can not infer that value is subset of only\n // what is left for `default` case\n value: data as FieldParametersType['value'],\n };\n\n if (hasDataKey) {\n this.updateField(parameters);\n } else {\n this.createField(parameters);\n }\n }\n }\n\n return this.storage.write(targetingData);\n }\n\n public createVisit(visitorCode: string): Result<void, KameleoonError> {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return Err(storageData.error);\n }\n\n const targetingData = storageData.data;\n\n // --- Note ---\n // Create new visit only if it doesn't exist\n if (!targetingData[visitorCode]?.[KameleoonData.VisitsData]) {\n this.updateField({\n visitorCode,\n key: KameleoonData.VisitsData,\n value: new VisitsData(Date.now(), []).data,\n data: targetingData,\n });\n }\n\n return this.storage.write(targetingData);\n }\n\n public cleanupOutdatedTargetingData(targetingCleanupInterval?: number): void {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return;\n }\n\n const targetingData = storageData.data;\n const targetingDataLifetime = targetingCleanupInterval\n ? targetingCleanupInterval * Milliseconds.Minute\n : DEFAULT_CLEANUP_INTERVAL * Milliseconds.Minute;\n\n const currentTime = Date.now();\n\n for (const [visitorCode, kameleoonVisitorData] of Object.entries(\n targetingData,\n )) {\n const { customData, pageView, conversion, ...rest } =\n kameleoonVisitorData;\n\n // TODO: This way of cleaning up data is not optimal\n // And will be changed when sessions are introduced\n if (customData) {\n for (const [index, dataItem] of Object.entries(customData)) {\n if (dataItem) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.CustomData];\n }\n }\n }\n }\n\n if (pageView) {\n for (const [url, dataItem] of Object.entries(pageView)) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.PageView];\n\n if (isDataExpired && existingData) {\n delete existingData[url];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.PageView];\n }\n }\n }\n\n if (conversion) {\n for (const dataItem of conversion) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.Conversion];\n\n if (isDataExpired && existingData) {\n existingData.splice(existingData.indexOf(dataItem), 1);\n }\n\n if (existingData && !existingData.length) {\n delete kameleoonVisitorData[KameleoonData.Conversion];\n }\n }\n }\n\n for (const [key, dataItem] of Object.entries(rest)) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n\n if (isDataExpired) {\n delete kameleoonVisitorData[key as KameleoonData];\n }\n }\n\n if (!Object.keys(targetingData[visitorCode]).length) {\n delete targetingData[visitorCode];\n }\n }\n\n this.storage.write(targetingData);\n }\n\n get storedTargetingData(): Result<TargetingDataType, KameleoonError> {\n return this.storage.read();\n }\n\n private updateField({\n visitorCode,\n key,\n value,\n data,\n }: FieldParametersType): void {\n (data[visitorCode][key] as ExistingDataType<typeof key>) = {\n ...value,\n lastActivityTime: Date.now(),\n };\n }\n\n private createField({\n visitorCode,\n key,\n value,\n data,\n }: FieldParametersType): void {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: { ...value, lastActivityTime: Date.now() },\n };\n }\n\n private updateArrayField({\n visitorCode,\n key,\n value,\n data,\n }: ArrayFieldParametersType): void {\n (data[visitorCode][key] as ExistingArrayDataType).push({\n ...value,\n lastActivityTime: Date.now(),\n });\n }\n\n private createArrayField({\n visitorCode,\n key,\n value,\n data,\n }: ArrayFieldParametersType): void {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: [{ ...value, lastActivityTime: Date.now() }],\n };\n }\n\n private updateNestedField({\n visitorCode,\n key,\n nestedKey,\n value,\n data,\n }: NestedFieldParametersType): void {\n (data[visitorCode][key] as ExistingNestedDataType)[nestedKey] = {\n ...value,\n lastActivityTime: Date.now(),\n };\n }\n\n private createNestedField({\n visitorCode,\n key,\n nestedKey,\n value,\n data,\n }: NestedFieldParametersType): void {\n if (!data[visitorCode]?.[key]) {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: {\n [nestedKey]: { ...value, lastActivityTime: Date.now() },\n },\n };\n } else {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: {\n ...data[visitorCode][key],\n [nestedKey]: { ...value, lastActivityTime: Date.now() },\n },\n };\n }\n }\n}\n"],"mappings":"sjJAoCa,CAAAA,aAAa,YAGxB,SAAAC,EAAYC,CAA4C,CAAE,CAAAC,eAAA,MAAAF,CAAA,EAAAG,eAAA,wBACxD,IAAI,CAACF,OAAO,CAAGA,CACjB,CAAC,OAAAG,YAAA,CAAAJ,CAAA,GAAAK,GAAA,cAAAC,KAAA,CAOD,SAAAC,WACEC,CAAmB,CACnBC,CAA2B,CACG,IACxB,CAAAC,CAAa,CAAG,IAAI,CAACT,OAAO,CAACU,IAAI,EAAE,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1CC,CAAmE,CACvE,CACEL,WAAW,CAAXA,CAAW,CACXM,IAAI,CAAEJ,CACR,CAAC,CAEH,OAAQD,CAAQ,CAACK,IAAI,CAACC,IAAI,EACxB,IAAK,CAAAC,qBAAa,CAACC,UAAU,CAAE,IACvB,CAAAH,CAAI,CAAGL,CAAQ,CAACK,IAAsB,CACtCI,CAAgB,CACpBR,CAAa,CAACF,CAAW,CAAC,EAC1BQ,qBAAa,CAACC,UAAU,GAAI,CAAAP,CAAa,CAACF,CAAW,CAAC,CAClDW,CAAqC,CAAAC,aAAA,CAAAA,aAAA,IACtCP,CAAgB,MACnBR,GAAG,CAAEW,qBAAa,CAACC,UAAU,CAC7BI,SAAS,CAAEP,CAAI,CAAC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AAmB,kBAAAzB,CAAA,CAMoC,KAAA6D,CAAA,CALlCrD,CAAW,CAAAR,CAAA,CAAXQ,WAAW,CACXH,CAAG,CAAAL,CAAA,CAAHK,GAAG,CACHgB,CAAS,CAAArB,CAAA,CAATqB,SAAS,CACTf,CAAK,CAAAN,CAAA,CAALM,KAAK,CACLQ,CAAI,CAAAd,CAAA,CAAJc,IAAI,CAUFA,CAAI,CAACN,CAAW,CAAC,SAAAqD,CAAA,CARd/C,CAAI,CAACN,CAAW,CAAC,YAAAqD,CAAA,EAAjBA,CAAA,CAAoBxD,CAAG,CAAC,CAAAe,aAAA,CAAAA,aAAA,IAStBN,CAAI,CAACN,CAAW,CAAC,KAAAL,eAAA,IACnBE,CAAG,CAAAe,aAAA,CAAAA,aAAA,IACCN,CAAI,CAACN,CAAW,CAAC,CAACH,CAAG,CAAC,KAAAF,eAAA,IACxBkB,CAAS,CAAAD,aAAA,CAAAA,aAAA,IAAQd,CAAK,MAAEmF,gBAAgB,CAAE3D,IAAI,CAACC,GAAG,EAAE,OAAAX,aAAA,CAAAA,aAAA,IAVpDN,CAAI,CAACN,CAAW,CAAC,KAAAL,eAAA,IACnBE,CAAG,CAAAF,eAAA,IACDkB,CAAS,CAAAD,aAAA,CAAAA,aAAA,IAAQd,CAAK,MAAEmF,gBAAgB,CAAE3D,IAAI,CAACC,GAAG,EAAE,KAY7D,CAAC,IAAA/B,CAAA,IAAA6G,OAAA,CAAA9G,aAAA,CAAAA,aAAA"}
1
+ {"version":3,"file":"dataProcessor.js","names":["DataProcessor","a","storage","_classCallCheck","_defineProperty","_createClass","key","value","updateData","visitorCode","dataItem","targetingData","read","or","commonParameters","data","type","KameleoonData","CustomData","hasCustomDataKey","parameters","_objectSpread","nestedKey","index","toString","updateNestedField","createNestedField","PageView","h","timestamps","length","Date","now","existingData","urlAddress","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","l","referrers","title","Conversion","hasConversionDataKey","updateArrayField","createArrayField","VisitsData","hasVisitsKey","existingVisits","previousVisits","visit","currentVisit","updateField","createField","hasDataKey","write","createVisit","b","storageData","ok","Err","error","cleanupOutdatedTargetingData","targetingCleanupInterval","targetingDataLifetime","Milliseconds","Minute","DEFAULT_CLEANUP_INTERVAL","currentTime","Object","keys","f","g","entries","_slicedToArray","kameleoonVisitorData","customData","pageView","conversion","rest","_objectWithoutProperties","_excluded","o","p","q","isDataExpired","lastActivityTime","v","w","x","url","C","D","_createForOfIteratorHelper","s","n","done","splice","indexOf","e","H","I","J","get","push","exports"],"sources":["../../src/kameleoonData/dataProcessor.ts"],"sourcesContent":["import { Err, Result } from 'ts-res';\nimport { IExternalStorage } from 'src/storage';\nimport { TargetingDataType } from 'src/targeting';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport { VisitsData } from './visitsData';\nimport { Milliseconds } from 'src/types';\nimport { DEFAULT_CLEANUP_INTERVAL } from './constants';\nimport {\n ArrayFieldParametersType,\n ConversionDataType,\n CustomDataType,\n ExistingArrayDataType,\n ExistingDataType,\n ExistingNestedDataType,\n ExistingPageViewDataType,\n ExistingVisitsDataType,\n FieldParametersType,\n KameleoonData,\n KameleoonDataType,\n NestedFieldParametersType,\n PageViewDataType,\n VisitsDataType,\n} from './types';\n\ninterface IDataProcessor {\n updateData(\n visitorCode: string,\n dataItem: KameleoonDataType,\n ): Result<void, KameleoonError>;\n createVisit(visitorCode: string): void;\n cleanupOutdatedTargetingData(targetingCleanupInterval?: number): void;\n readonly storedTargetingData: Result<TargetingDataType, KameleoonError>;\n}\n\nexport class DataProcessor implements IDataProcessor {\n private storage: IExternalStorage<TargetingDataType>;\n\n constructor(storage: IExternalStorage<TargetingDataType>) {\n this.storage = storage;\n }\n\n // --- Note ---\n // Following code is optimized for performance:\n // - We don't want to copy the whole object every time we add new data\n // - So we are manually checking the keys existence and mutating targeting data directly\n // - Numerous type casts are required because we can't narrow down nested `targetingData` types by using assertion functions\n public updateData(\n visitorCode: string,\n dataItem: KameleoonDataType,\n ): Result<void, KameleoonError> {\n const targetingData = this.storage.read().or({});\n const commonParameters: Pick<FieldParametersType, 'visitorCode' | 'data'> =\n {\n visitorCode,\n data: targetingData,\n };\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const data = dataItem.data as CustomDataType;\n const hasCustomDataKey =\n targetingData[visitorCode] &&\n KameleoonData.CustomData in targetingData[visitorCode];\n const parameters: NestedFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.CustomData,\n nestedKey: data.index.toString(),\n value: data,\n };\n\n if (hasCustomDataKey) {\n this.updateNestedField(parameters);\n } else {\n this.createNestedField(parameters);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // We assign `timestamps` to `Date.now()` if it's empty\n // Not upon data item creation because it makes no sense in terms\n // of data flow to have some indication of data activity before it was added\n if (!data.timestamps.length) {\n data.timestamps = [Date.now()];\n }\n\n const existingData =\n targetingData[visitorCode] &&\n KameleoonData.PageView in targetingData[visitorCode] &&\n (targetingData[visitorCode][data.type] as ExistingPageViewDataType)?.[\n data.urlAddress\n ];\n\n const parameters: NestedFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.PageView,\n nestedKey: data.urlAddress,\n value: data,\n };\n\n if (existingData) {\n // --- Note ---\n // Updating existing `PageView` properties by pushing new timestamps\n // and potentially changing referrers and title\n data.timestamps.forEach((timestamp) => {\n Utilities.insertInOrderedListMutably({\n list: existingData.timestamps,\n element: timestamp,\n order: Order.Ascending,\n });\n });\n\n [existingData.referrers, existingData.title] = [\n data.referrers,\n data.title,\n ];\n\n this.updateNestedField({ ...parameters, value: existingData });\n } else {\n this.createNestedField(parameters);\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const data = dataItem.data as ConversionDataType;\n const hasConversionDataKey =\n targetingData[visitorCode] &&\n KameleoonData.Conversion in targetingData[visitorCode];\n const parameters: ArrayFieldParametersType = {\n ...commonParameters,\n key: KameleoonData.Conversion,\n value: data,\n };\n\n if (hasConversionDataKey) {\n this.updateArrayField(parameters);\n } else {\n this.createArrayField(parameters);\n }\n\n break;\n }\n case KameleoonData.VisitsData: {\n const data = dataItem.data as VisitsDataType;\n const hasVisitsKey =\n targetingData[visitorCode] &&\n KameleoonData.VisitsData in targetingData[visitorCode];\n const parameters: FieldParametersType = {\n ...commonParameters,\n key: KameleoonData.VisitsData,\n value: data,\n };\n\n // -- Change directly if `[key]` exists\n if (hasVisitsKey) {\n const existingVisits = targetingData[visitorCode][\n data.type\n ] as ExistingVisitsDataType;\n\n // --- Note ---\n // We are preserving the order of visits\n existingVisits.previousVisits.forEach((visit) => {\n Utilities.insertInOrderedListMutably({\n list: data.previousVisits,\n element: visit,\n order: Order.Ascending,\n });\n });\n\n let currentVisit = existingVisits.currentVisit;\n\n // --- Note ---\n // We are using new current visit in two cases:\n // 1. If there is no current visit in existing data\n // 2. If existing current visit is older than new current visit\n if (\n (!currentVisit && data.currentVisit) ||\n (currentVisit &&\n data.currentVisit &&\n currentVisit < data.currentVisit)\n ) {\n currentVisit = data.currentVisit;\n }\n\n this.updateField({\n ...parameters,\n value: {\n ...data,\n previousVisits: data.previousVisits,\n currentVisit,\n },\n });\n } else {\n this.createField(parameters);\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n const hasDataKey =\n targetingData[visitorCode] && data.type in targetingData[visitorCode];\n const parameters: FieldParametersType = {\n ...commonParameters,\n key: data.type,\n // --- Note ---\n // At this point TypeScript can not infer that value is subset of only\n // what is left for `default` case\n value: data as FieldParametersType['value'],\n };\n\n if (hasDataKey) {\n this.updateField(parameters);\n } else {\n this.createField(parameters);\n }\n }\n }\n\n return this.storage.write(targetingData);\n }\n\n public createVisit(visitorCode: string): Result<void, KameleoonError> {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return Err(storageData.error);\n }\n\n const targetingData = storageData.data;\n\n // --- Note ---\n // Create new visit only if it doesn't exist\n if (!targetingData[visitorCode]?.[KameleoonData.VisitsData]) {\n this.updateField({\n visitorCode,\n key: KameleoonData.VisitsData,\n value: new VisitsData(Date.now(), []).data,\n data: targetingData,\n });\n }\n\n return this.storage.write(targetingData);\n }\n\n public cleanupOutdatedTargetingData(targetingCleanupInterval?: number): void {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return;\n }\n\n const targetingData = storageData.data;\n const targetingDataLifetime = targetingCleanupInterval\n ? targetingCleanupInterval * Milliseconds.Minute\n : DEFAULT_CLEANUP_INTERVAL * Milliseconds.Minute;\n\n const currentTime = Date.now();\n\n // --- Note (Weird Thing) ---\n // Generally the check is not needed\n // If the `targetingData` is empty the loop will not be executed\n // But here something weird happens and we'are getting `TypeError` here\n // Even logging `Object.keys().length` or `Object.entries().length` solves the issue somehow\n // You can see the issue by commenting the following `if` statement and waiting for a data cleanup\n // TODO: investigate it later (probably related to object copying?)\n if (!Object.keys(targetingData).length) {\n return;\n }\n\n for (const [visitorCode, kameleoonVisitorData] of Object.entries(\n targetingData,\n )) {\n const { customData, pageView, conversion, ...rest } =\n kameleoonVisitorData;\n\n // TODO: This way of cleaning up data is not optimal\n // And will be changed when sessions are introduced\n if (customData) {\n for (const [index, dataItem] of Object.entries(customData)) {\n if (dataItem) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.CustomData];\n }\n }\n }\n }\n\n if (pageView) {\n for (const [url, dataItem] of Object.entries(pageView)) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.PageView];\n\n if (isDataExpired && existingData) {\n delete existingData[url];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete kameleoonVisitorData[KameleoonData.PageView];\n }\n }\n }\n\n if (conversion) {\n for (const dataItem of conversion) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n const existingData = kameleoonVisitorData[KameleoonData.Conversion];\n\n if (isDataExpired && existingData) {\n existingData.splice(existingData.indexOf(dataItem), 1);\n }\n\n if (existingData && !existingData.length) {\n delete kameleoonVisitorData[KameleoonData.Conversion];\n }\n }\n }\n\n for (const [key, dataItem] of Object.entries(rest)) {\n const isDataExpired =\n dataItem.lastActivityTime + targetingDataLifetime < currentTime;\n\n if (isDataExpired) {\n delete kameleoonVisitorData[key as KameleoonData];\n }\n }\n\n if (!Object.keys(targetingData[visitorCode]).length) {\n delete targetingData[visitorCode];\n }\n }\n\n this.storage.write(targetingData);\n }\n\n get storedTargetingData(): Result<TargetingDataType, KameleoonError> {\n return this.storage.read();\n }\n\n private updateField({\n visitorCode,\n key,\n value,\n data,\n }: FieldParametersType): void {\n (data[visitorCode][key] as ExistingDataType<typeof key>) = {\n ...value,\n lastActivityTime: Date.now(),\n };\n }\n\n private createField({\n visitorCode,\n key,\n value,\n data,\n }: FieldParametersType): void {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: { ...value, lastActivityTime: Date.now() },\n };\n }\n\n private updateArrayField({\n visitorCode,\n key,\n value,\n data,\n }: ArrayFieldParametersType): void {\n (data[visitorCode][key] as ExistingArrayDataType).push({\n ...value,\n lastActivityTime: Date.now(),\n });\n }\n\n private createArrayField({\n visitorCode,\n key,\n value,\n data,\n }: ArrayFieldParametersType): void {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: [{ ...value, lastActivityTime: Date.now() }],\n };\n }\n\n private updateNestedField({\n visitorCode,\n key,\n nestedKey,\n value,\n data,\n }: NestedFieldParametersType): void {\n (data[visitorCode][key] as ExistingNestedDataType)[nestedKey] = {\n ...value,\n lastActivityTime: Date.now(),\n };\n }\n\n private createNestedField({\n visitorCode,\n key,\n nestedKey,\n value,\n data,\n }: NestedFieldParametersType): void {\n if (!data[visitorCode]?.[key]) {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: {\n [nestedKey]: { ...value, lastActivityTime: Date.now() },\n },\n };\n } else {\n data[visitorCode] = {\n ...data[visitorCode],\n [key]: {\n ...data[visitorCode][key],\n [nestedKey]: { ...value, lastActivityTime: Date.now() },\n },\n };\n }\n }\n}\n"],"mappings":"sjJAoCa,CAAAA,aAAa,YAGxB,SAAAC,EAAYC,CAA4C,CAAE,CAAAC,eAAA,MAAAF,CAAA,EAAAG,eAAA,wBACxD,IAAI,CAACF,OAAO,CAAGA,CACjB,CAAC,OAAAG,YAAA,CAAAJ,CAAA,GAAAK,GAAA,cAAAC,KAAA,CAOD,SAAAC,WACEC,CAAmB,CACnBC,CAA2B,CACG,IACxB,CAAAC,CAAa,CAAG,IAAI,CAACT,OAAO,CAACU,IAAI,EAAE,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,CAC1CC,CAAmE,CACvE,CACEL,WAAW,CAAXA,CAAW,CACXM,IAAI,CAAEJ,CACR,CAAC,CAEH,OAAQD,CAAQ,CAACK,IAAI,CAACC,IAAI,EACxB,IAAK,CAAAC,qBAAa,CAACC,UAAU,CAAE,IACvB,CAAAH,CAAI,CAAGL,CAAQ,CAACK,IAAsB,CACtCI,CAAgB,CACpBR,CAAa,CAACF,CAAW,CAAC,EAC1BQ,qBAAa,CAACC,UAAU,GAAI,CAAAP,CAAa,CAACF,CAAW,CAAC,CAClDW,CAAqC,CAAAC,aAAA,CAAAA,aAAA,IACtCP,CAAgB,MACnBR,GAAG,CAAEW,qBAAa,CAACC,UAAU,CAC7BI,SAAS,CAAEP,CAAI,CAACQ,KAAK,CAACC,QAAQ,EAAE,CAChCjB,KAAK,CAAEQ,CAAI,EACZ,CAEGI,CAAgB,CAClB,IAAI,CAACM,iBAAiB,CAACL,CAAU,CAAC,CAElC,IAAI,CAACM,iBAAiB,CAACN,CAAU,CAAC,CAGpC,KACF,CACA,IAAK,CAAAH,qBAAa,CAACU,QAAQ,CAAE,KAAAC,CAAA,CACrBb,CAAI,C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B,SAAS,CACTf,CAAK,CAAAN,CAAA,CAALM,KAAK,CACLQ,CAAI,CAAAd,CAAA,CAAJc,IAAI,CAUFA,CAAI,CAACN,CAAW,CAAC,SAAAqD,CAAA,CARd/C,CAAI,CAACN,CAAW,CAAC,YAAAqD,CAAA,EAAjBA,CAAA,CAAoBxD,CAAG,CAAC,CAAAe,aAAA,CAAAA,aAAA,IAStBN,CAAI,CAACN,CAAW,CAAC,KAAAL,eAAA,IACnBE,CAAG,CAAAe,aAAA,CAAAA,aAAA,IACCN,CAAI,CAACN,CAAW,CAAC,CAACH,CAAG,CAAC,KAAAF,eAAA,IACxBkB,CAAS,CAAAD,aAAA,CAAAA,aAAA,IAAQd,CAAK,MAAEoF,gBAAgB,CAAE5D,IAAI,CAACC,GAAG,EAAE,OAAAX,aAAA,CAAAA,aAAA,IAVpDN,CAAI,CAACN,CAAW,CAAC,KAAAL,eAAA,IACnBE,CAAG,CAAAF,eAAA,IACDkB,CAAS,CAAAD,aAAA,CAAAA,aAAA,IAAQd,CAAK,MAAEoF,gBAAgB,CAAE5D,IAAI,CAACC,GAAG,EAAE,KAY7D,CAAC,IAAA/B,CAAA,IAAA6G,OAAA,CAAA9G,aAAA,CAAAA,aAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;var _ERROR_MESSAGES,_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ERROR_MESSAGES=(_ERROR_MESSAGES={},_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.JSONParse,function(a){return"Couldn't parse JSON variable: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NumberParse,function(a){return"It's not possible to parse value ".concat(a," to Number")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.SemanticVersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Initialization,function(){return"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageInitialization,function(){return"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.EventSourceInitialization,function(){return"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagEnvironmentDisabled,function(a,b){return"Environment of feature flag with key ".concat(a," is disabled in ").concat(b," environment.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariableNotFound,function(a,b){return"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotTargeted,function(a){return"Visitor code ".concat(a," is not targeted")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeMaxLength,function(){return"Visitor code can not be more than 255 characters long"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeEmpty,function(){return"Visitor code can not be empty"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageWrite,function(a){return"Couldn't update storage for kameleoonClient: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageRead,function(a){return"No data found in storage under ".concat(a," key")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageParse,function(a,b){return"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ClientConfiguration,function(){return"Couldn't retrieve client configuration from Kameleoon Api"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.TargetingCondition,function(a){return"".concat(a," targeting condition is not yet supported.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.AmongValuesCheck,function(a,b){return"Couldn't parse value \"".concat(b,"\": ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.RemoteData,function(){return"Couldn't retrieve data from Kameleoon server"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.MaximumRetriesReached,function(){return"Maximum retries reached, request failed"}),_ERROR_MESSAGES);exports.ERROR_MESSAGES=ERROR_MESSAGES;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;var _ERROR_MESSAGES,_types=require("./types");function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var ERROR_MESSAGES=(_ERROR_MESSAGES={},_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.CookieParse,function(a){return"Couldn't parse cookie string: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.JSONParse,function(a){return"Couldn't parse JSON variable: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NumberParse,function(a){return"It's not possible to parse value ".concat(a," to Number")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.SemanticVersionParse,function(a){return"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Initialization,function(){return"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.Credentials,function(){return"KameleoonClient can not be created without credentials"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageInitialization,function(){return"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.EventSourceInitialization,function(){return"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagConfigurationNotFound,function(a){return"No feature flag with key ".concat(a," was found.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagEnvironmentDisabled,function(a,b){return"Feature flag with key ".concat(a," is disabled in ").concat(b," environment.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariableNotFound,function(a,b){return"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.FeatureFlagVariationNotFound,function(a,b){return"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.NotTargeted,function(a){return"Visitor code ".concat(a," is not targeted")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitAmount,function(){return"Visit amount must be a number between 1 and 25"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeMaxLength,function(){return"Visitor code can not be more than 255 characters long"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.VisitorCodeEmpty,function(){return"Visitor code can not be empty"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageWrite,function(a){return"Couldn't update storage for kameleoonClient: ".concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageRead,function(a){return"No data found in storage under ".concat(a," key")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.StorageParse,function(a,b){return"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.ClientConfiguration,function(){return"Couldn't retrieve client configuration from Kameleoon Api"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.TargetingCondition,function(a){return"".concat(a," targeting condition is not yet supported.")}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.AmongValuesCheck,function(a,b){return"Couldn't parse value \"".concat(b,"\": ").concat(a)}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.RemoteData,function(){return"Couldn't retrieve data from Kameleoon server"}),_defineProperty(_ERROR_MESSAGES,_types.KameleoonException.MaximumRetriesReached,function(){return"Maximum retries reached, request failed"}),_ERROR_MESSAGES);exports.ERROR_MESSAGES=ERROR_MESSAGES;
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\n [KameleoonException.JSONParse]: (err: unknown) =>\n `Couldn't parse JSON variable: ${err}`,\n [KameleoonException.NumberParse]: (value: string) =>\n `It's not possible to parse value ${value} to Number`,\n [KameleoonException.VersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x`,\n [KameleoonException.SemanticVersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x.x`,\n [KameleoonException.Initialization]: () =>\n \"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods\",\n [KameleoonException.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\n [KameleoonException.StorageInitialization]: () =>\n \"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed\",\n [KameleoonException.EventSourceInitialization]: () =>\n \"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed\",\n [KameleoonException.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagEnvironmentDisabled]: (\n featureKey: string,\n environment: string,\n ) =>\n `Environment of feature flag with key ${featureKey} is disabled in ${environment} environment.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\n [KameleoonException.StorageWrite]: (err: unknown) =>\n `Couldn't update storage for kameleoonClient: ${err}`,\n [KameleoonException.StorageRead]: (key: KameleoonStorageKey) =>\n `No data found in storage under ${key} key`,\n [KameleoonException.StorageParse]: (err: unknown, key: KameleoonStorageKey) =>\n `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,\n [KameleoonException.ClientConfiguration]: () =>\n \"Couldn't retrieve client configuration from Kameleoon Api\",\n [KameleoonException.TargetingCondition]: (targetingType: TargetingType) =>\n `${targetingType} targeting condition is not yet supported.`,\n [KameleoonException.AmongValuesCheck]: (err: unknown, value: string) =>\n `Couldn't parse value \"${value}\": ${err}`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request fail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AD,eAAA,CAC7DE,yBAAkB,CAACkC,gBAAgB,CAAG,SAAC7B,CAAY,CAAEE,CAAa,kCAAAJ,MAAA,CACxCI,CAAK,SAAAJ,MAAA,CAAME,CAAG,EAAE,EAAAN,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACmC,UAAU,CAAG,gEACe,EAAApC,eAAA,CAAAD,eAAA,CAC/CE,yBAAkB,CAACoC,qBAAqB,CAAG,2DACD,EAAAtC,eAAA,CAC5C,CAACuC,OAAA,CAAAxC,cAAA,CAAAA,cAAA"}
1
+ {"version":3,"file":"constants.js","names":["ERROR_MESSAGES","_ERROR_MESSAGES","_defineProperty","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","value","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached","exports"],"sources":["../../src/kameleoonError/constants.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { KameleoonException } from './types';\n\nexport const ERROR_MESSAGES = {\n [KameleoonException.CookieParse]: (reason: string) =>\n `Couldn't parse cookie string: ${reason}`,\n [KameleoonException.JSONParse]: (err: unknown) =>\n `Couldn't parse JSON variable: ${err}`,\n [KameleoonException.NumberParse]: (value: string) =>\n `It's not possible to parse value ${value} to Number`,\n [KameleoonException.VersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x`,\n [KameleoonException.SemanticVersionParse]: (value: string) =>\n `It's not possible to parse a version value ${value} to Number, version should be in format x.x.x`,\n [KameleoonException.Initialization]: () =>\n \"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods\",\n [KameleoonException.Credentials]: () =>\n 'KameleoonClient can not be created without credentials',\n [KameleoonException.StorageInitialization]: () =>\n \"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed\",\n [KameleoonException.EventSourceInitialization]: () =>\n \"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed\",\n [KameleoonException.FeatureFlagConfigurationNotFound]: (featureKey: string) =>\n `No feature flag with key ${featureKey} was found.`,\n [KameleoonException.FeatureFlagEnvironmentDisabled]: (\n featureKey: string,\n environment: string,\n ) =>\n `Feature flag with key ${featureKey} is disabled in ${environment} environment.`,\n [KameleoonException.FeatureFlagVariableNotFound]: (\n variableKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variable with key ${variableKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.FeatureFlagVariationNotFound]: (\n variationKey: string,\n visitorCode: string,\n ) =>\n `No feature flag variation with key ${variationKey} was found for ${visitorCode} visitorCode.`,\n [KameleoonException.NotTargeted]: (visitorCode: string) =>\n `Visitor code ${visitorCode} is not targeted`,\n [KameleoonException.VisitAmount]: () =>\n 'Visit amount must be a number between 1 and 25',\n [KameleoonException.VisitorCodeMaxLength]: () =>\n 'Visitor code can not be more than 255 characters long',\n [KameleoonException.VisitorCodeEmpty]: () => 'Visitor code can not be empty',\n [KameleoonException.StorageWrite]: (err: unknown) =>\n `Couldn't update storage for kameleoonClient: ${err}`,\n [KameleoonException.StorageRead]: (key: KameleoonStorageKey) =>\n `No data found in storage under ${key} key`,\n [KameleoonException.StorageParse]: (err: unknown, key: KameleoonStorageKey) =>\n `Couldn't parse ${key} storage data, the data may be corrupted. Error: ${err}`,\n [KameleoonException.ClientConfiguration]: () =>\n \"Couldn't retrieve client configuration from Kameleoon Api\",\n [KameleoonException.TargetingCondition]: (targetingType: TargetingType) =>\n `${targetingType} targeting condition is not yet supported.`,\n [KameleoonException.AmongValuesCheck]: (err: unknown, value: string) =>\n `Couldn't parse value \"${value}\": ${err}`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":"o7BAIO,GAAM,CAAAA,cAAc,EAAAC,eAAA,IAAAC,eAAA,CAAAD,eAAA,CACxBE,yBAAkB,CAACC,WAAW,CAAG,SAACC,CAAc,yCAAAC,MAAA,CACdD,CAAM,EAAE,EAAAH,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACI,SAAS,CAAG,SAACC,CAAY,yCAAAF,MAAA,CACVE,CAAG,EAAE,EAAAN,eAAA,CAAAD,eAAA,CACvCE,yBAAkB,CAACM,WAAW,CAAG,SAACC,CAAa,4CAAAJ,MAAA,CACVI,CAAK,eAAY,EAAAR,eAAA,CAAAD,eAAA,CACtDE,yBAAkB,CAACQ,YAAY,CAAG,SAACD,CAAa,sDAAAJ,MAAA,CACDI,CAAK,gDAA6C,EAAAR,eAAA,CAAAD,eAAA,CACjGE,yBAAkB,CAACS,oBAAoB,CAAG,SAACF,CAAa,sDAAAJ,MAAA,CACTI,CAAK,kDAA+C,EAAAR,eAAA,CAAAD,eAAA,CACnGE,yBAAkB,CAACU,cAAc,CAAG,iBACnC,0HAA0H,GAAAX,eAAA,CAAAD,eAAA,CAC3HE,yBAAkB,CAACW,WAAW,CAAG,iBAChC,wDAAwD,GAAAZ,eAAA,CAAAD,eAAA,CACzDE,yBAAkB,CAACY,qBAAqB,CAAG,iBAC1C,+HAA+H,GAAAb,eAAA,CAAAD,eAAA,CAChIE,yBAAkB,CAACa,yBAAyB,CAAG,iBAC9C,oIAAoI,GAAAd,eAAA,CAAAD,eAAA,CACrIE,yBAAkB,CAACc,gCAAgC,CAAG,SAACC,CAAkB,oCAAAZ,MAAA,CAC5CY,CAAU,gBAAa,EAAAhB,eAAA,CAAAD,eAAA,CACpDE,yBAAkB,CAACgB,8BAA8B,CAAG,SACnDD,CAAkB,CAClBE,CAAmB,iCAAAd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CAC5DE,yBAAkB,CAACgC,kBAAkB,CAAG,SAACC,CAA4B,WAAA9B,MAAA,CACjE8B,CAAa,+CAA4C,EAAAlC,eAAA,CAAAD,eAAA,CAC7DE,yBAAkB,CAACkC,gBAAgB,CAAG,SAAC7B,CAAY,CAAEE,CAAa,kCAAAJ,MAAA,CACxCI,CAAK,SAAAJ,MAAA,CAAME,CAAG,EAAE,EAAAN,eAAA,CAAAD,eAAA,CAC1CE,yBAAkB,CAACmC,UAAU,CAAG,gEACe,EAAApC,eAAA,CAAAD,eAAA,CAC/CE,yBAAkB,CAACoC,qBAAqB,CAAG,2DACD,EAAAtC,eAAA,CAC5C,CAACuC,OAAA,CAAAxC,cAAA,CAAAA,cAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";var _requester=require("./requester");Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonUtils=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonUtils=function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"getClientConfigurationUrl",value:function getClientConfigurationUrl(a){return(0,_requester.getClientConfigurationUrl)(a)}}]),a}();exports.KameleoonUtils=KameleoonUtils;
1
+ "use strict";var _requester=require("./requester");Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonUtils=void 0;function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"===_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!==_typeof(a)||null===a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var d=c.call(a,b||"default");if("object"!==_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}var KameleoonUtils=function(){function a(){_classCallCheck(this,a)}return _createClass(a,[{key:"getClientConfigurationUrl",value:function getClientConfigurationUrl(a){return _requester.URL.CLIENT_CONFIGURATION+a}}]),a}();exports.KameleoonUtils=KameleoonUtils;
2
2
  //# sourceMappingURL=kameleoonUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kameleoonUtils.js","names":["_requester","require","Object","defineProperty","exports","value","KameleoonUtils","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","getClientConfigurationUrl","siteCode"],"sources":["../src/kameleoonUtils.ts"],"sourcesContent":["import { getClientConfigurationUrl } from './requester';\n\n/**\n * @abstract\n * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures\n * */\nexport abstract class KameleoonUtils {\n protected getClientConfigurationUrl(siteCode: string): string {\n return getClientConfigurationUrl(siteCode);\n }\n}\n"],"mappings":"aAAA,IAAAA,UAAA,CAAAC,OAAA,gBAAwDC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,cAAA,iBAAAC,QAAAC,CAAA,mCAAAD,OAAA,oBAAAE,MAAA,mBAAAA,MAAA,CAAAC,QAAA,UAAAF,CAAA,gBAAAA,CAAA,WAAAA,CAAA,SAAAA,CAAA,qBAAAC,MAAA,EAAAD,CAAA,CAAAG,WAAA,GAAAF,MAAA,EAAAD,CAAA,GAAAC,MAAA,CAAAG,SAAA,iBAAAJ,CAAA,EAAAD,OAAA,CAAAC,CAAA,WAAAK,gBAAAL,CAAA,CAAAM,CAAA,OAAAN,CAAA,YAAAM,CAAA,YAAAC,SAAA,+CAAAC,kBAAAR,CAAA,CAAAM,CAAA,UAAAG,CAAA,CAAAC,CAAA,GAAAA,CAAA,CAAAJ,CAAA,CAAAK,MAAA,CAAAD,CAAA,GAAAD,CAAA,CAAAH,CAAA,CAAAI,CAAA,EAAAD,CAAA,CAAAG,UAAA,CAAAH,CAAA,CAAAG,UAAA,KAAAH,CAAA,CAAAI,YAAA,cAAAJ,CAAA,GAAAA,CAAA,CAAAK,QAAA,KAAApB,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAe,cAAA,CAAAN,CAAA,CAAAO,GAAA,EAAAP,CAAA,WAAAQ,aAAAjB,CAAA,CAAAM,CAAA,CAAAG,CAAA,SAAAH,CAAA,EAAAE,iBAAA,CAAAR,CAAA,CAAAI,SAAA,CAAAE,CAAA,EAAAG,CAAA,EAAAD,iBAAA,CAAAR,CAAA,CAAAS,CAAA,EAAAf,MAAA,CAAAC,cAAA,CAAAK,CAAA,cAAAc,QAAA,MAAAd,CAAA,UAAAe,eAAAf,CAAA,MAAAM,CAAA,CAAAY,YAAA,CAAAlB,CAAA,4BAAAD,OAAA,CAAAO,CAAA,EAAAA,CAAA,CAAAA,CAAA,aAAAY,aAAAlB,CAAA,CAAAM,CAAA,gBAAAP,OAAA,CAAAC,CAAA,UAAAA,CAAA,QAAAA,CAAA,KAAAS,CAAA,CAAAT,CAAA,CAAAC,MAAA,CAAAkB,WAAA,KAAAV,CAAA,eAAAC,CAAA,CAAAD,CAAA,CAAAW,IAAA,CAAApB,CAAA,CAAAM,CAAA,2BAAAP,OAAA,CAAAW,CAAA,SAAAA,CAAA,WAAAH,SAAA,mEAAAD,CAAA,CAAAe,MAAA,CAAAC,MAAA,EAAAtB,CAAA,KAMlC,CAAAF,cAAc,qBAAAE,EAAA,EAAAK,eAAA,MAAAL,CAAA,SAAAiB,YAAA,CAAAjB,CAAA,GAAAgB,GAAA,6BAAAnB,KAAA,CAClC,SAAA0B,0BAAoCC,CAAgB,CAAU,CAC5D,MAAO,GAAAD,oCAAyB,EAACC,CAAQ,CAC3C,CAAC,IAAAxB,CAAA,IAAAJ,OAAA,CAAAE,cAAA,CAAAA,cAAA"}
1
+ {"version":3,"file":"kameleoonUtils.js","names":["_requester","require","Object","defineProperty","exports","value","KameleoonUtils","_typeof","a","Symbol","iterator","constructor","prototype","_classCallCheck","b","TypeError","_defineProperties","c","d","length","enumerable","configurable","writable","_toPropertyKey","key","_createClass","_toPrimitive","toPrimitive","call","String","Number","getClientConfigurationUrl","siteCode","URL","CLIENT_CONFIGURATION"],"sources":["../src/kameleoonUtils.ts"],"sourcesContent":["import { URL } from './requester';\n\n/**\n * @abstract\n * KameleoonUtils - an abstract class for extending kameleoon utils with pre-defined method signatures\n * */\nexport abstract class KameleoonUtils {\n protected getClientConfigurationUrl(siteCode: string): string {\n return URL.CLIENT_CONFIGURATION + siteCode;\n }\n}\n"],"mappings":"aAAA,IAAAA,UAAA,CAAAC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AAA,CAAA,KAAAS,CAAA,CAAAT,CAAA,CAAAC,MAAA,CAAAkB,WAAA,KAAAV,CAAA,eAAAC,CAAA,CAAAD,CAAA,CAAAW,IAAA,CAAApB,CAAA,CAAAM,CAAA,2BAAAP,OAAA,CAAAW,CAAA,SAAAA,CAAA,WAAAH,SAAA,mEAAAD,CAAA,CAAAe,MAAA,CAAAC,MAAA,EAAAtB,CAAA,KAMZ,CAAAF,cAAc,qBAAAE,EAAA,EAAAK,eAAA,MAAAL,CAAA,SAAAiB,YAAA,CAAAjB,CAAA,GAAAgB,GAAA,6BAAAnB,KAAA,CAClC,SAAA0B,0BAAoCC,CAAgB,CAAU,CAC5D,MAAO,CAAAC,cAAG,CAACC,oBAAoB,CAAGF,CACpC,CAAC,IAAAxB,CAAA,IAAAJ,OAAA,CAAAE,cAAA,CAAAA,cAAA"}
@@ -2,6 +2,8 @@ import { EventType, ParameterType, QueryType, StrictEventTypeRecord, StrictFirst
2
2
  export declare enum Header {
3
3
  UserAgent = "User-Agent",
4
4
  ContentType = "Content-Type",
5
+ SdkVersion = "X-Kameleoon-SDK-Version",
6
+ SdkType = "X-Kameleoon-SDK-Type",
5
7
  Authorization = "Authorization",
6
8
  AcceptEncoding = "Accept-Encoding"
7
9
  }
@@ -12,8 +14,8 @@ export declare const UrlQuery: StrictQueryRecord<QueryType>;
12
14
  export declare const UrlTracking: StrictTrackingRecord<TrackingType>;
13
15
  export declare const URL: {
14
16
  SERVER_SENT_EVENTS: string;
17
+ CLIENT_CONFIGURATION: string;
15
18
  VISIT_EVENT: string;
16
19
  VISIT_DATA: string;
17
20
  DATA_MAP: string;
18
21
  };
19
- export declare function getClientConfigurationUrl(siteCode: string): string;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlTracking=exports.UrlQuery=exports.UrlParameter=exports.UrlFirstParameter=exports.UrlEventType=exports.URL=exports.Header=void 0,exports.getClientConfigurationUrl=getClientConfigurationUrl;var Header=function(a){return a.UserAgent="User-Agent",a.ContentType="Content-Type",a.Authorization="Authorization",a.AcceptEncoding="Accept-Encoding",a}({});exports.Header=Header;var UrlEventType={CustomData:"eventType=customData",StaticData:"eventType=staticData",Page:"eventType=page",Conversion:"eventType=conversion",Activity:"eventType=activity",Experiment:"eventType=experiment",Geolocation:"eventType=geolocation"};exports.UrlEventType=UrlEventType;var UrlParameter={Title:"&title=",ReferrersIndices:"&referrersIndices=",Negative:"&negative=",Revenue:"&revenue=",Overwrite:"&overwrite=",Index:"&index=",BrowserIndex:"&browserIndex=",BrowserVersion:"&browserVersion=",Href:"&href=",DeviceType:"&deviceType=",SiteCode:"&siteCode=",GoalId:"&goalId=",VisitorCode:"&visitorCode=",VariationId:"&variationId=",Ts:"&ts=",Key:"&key=",SdkName:"&sdkName=",SdkVersion:"&sdkVersion=",ValuesCountMap:"&valuesCountMap=",Nonce:"&nonce=",Id:"&id=",CustomData:"&customData=",CurrentVisit:"&currentVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"&region=",Latitude:"&latitude=",Longitude:"&longitude=",PostalCode:"&postalCode=",Conversion:"&conversion=",StaticData:"&staticData=",Geolocation:"&geolocation=",Page:"&page=",Experiment:"&experiment=",Browser:"&browser=",Environment:"&environment=",MappingIdentifier:"&mappingIdentifier="};exports.UrlParameter=UrlParameter;var UrlFirstParameter={CustomData:"?customData=",StaticData:"?staticData=",Page:"?page=",Conversion:"?conversion=",Geolocation:"?geolocation=",Experiment:"?experiment=",ValuesCountMap:"?valuesCountMap=",Id:"?id=",Nonce:"?nonce=",Country:"?country=",Environment:"?environment=",City:"?city=",Region:"?region=",Latitude:"?latitude=",Longitude:"?longitude=",PostalCode:"?postalCode=",SdkName:"?sdkName=",SdkVersion:"?sdkVersion=",BrowserIndex:"?browserIndex=",BrowserVersion:"?browserVersion=",SiteCode:"?siteCode=",VisitorCode:"?visitorCode=",CurrentVisit:"?currentVisit=",MaxNumberPreviousVisits:"?maxNumberPreviousVisits=",Negative:"?negative=",Revenue:"?revenue=",Title:"?title=",Os:"?os=",OsIndex:"?osIndex=",Browser:"?browser=",ReferrersIndices:"?referrersIndices=",Overwrite:"?overwrite=",Index:"?index=",Href:"?href=",VariationId:"?variationId=",DeviceType:"?deviceType=",GoalId:"?goalId=",Ts:"?ts=",Key:"?key=",MappingIdentifier:"?mappingIdentifier="};exports.UrlFirstParameter=UrlFirstParameter;var UrlQuery={Sse:"sse?siteCode=",Map:"map?siteCode=",Events:"events?siteCode=",Visitor:"visitor?siteCode="};exports.UrlQuery=UrlQuery;var UrlTracking={Visit:"visit/",Map:"map/"};exports.UrlTracking=UrlTracking;var topLevelDomain="io",URL_DATA_API="https://data.kameleoon.".concat("io"),URL={SERVER_SENT_EVENTS:"https://events.kameleoon.com:8110/",VISIT_EVENT:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Events),VISIT_DATA:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Visitor),DATA_MAP:"".concat(URL_DATA_API,"/").concat(UrlTracking.Map+UrlQuery.Map)};exports.URL=URL;function getClientConfigurationUrl(a){return"https://".concat(a,".kameleoon.eu/sdk-config")}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlTracking=exports.UrlQuery=exports.UrlParameter=exports.UrlFirstParameter=exports.UrlEventType=exports.URL=exports.Header=void 0;var Header=function(a){return a.UserAgent="User-Agent",a.ContentType="Content-Type",a.SdkVersion="X-Kameleoon-SDK-Version",a.SdkType="X-Kameleoon-SDK-Type",a.Authorization="Authorization",a.AcceptEncoding="Accept-Encoding",a}({});exports.Header=Header;var UrlEventType={CustomData:"eventType=customData",StaticData:"eventType=staticData",Page:"eventType=page",Conversion:"eventType=conversion",Activity:"eventType=activity",Experiment:"eventType=experiment",Geolocation:"eventType=geolocation"};exports.UrlEventType=UrlEventType;var UrlParameter={Title:"&title=",ReferrersIndices:"&referrersIndices=",Negative:"&negative=",Revenue:"&revenue=",Overwrite:"&overwrite=",Index:"&index=",BrowserIndex:"&browserIndex=",BrowserVersion:"&browserVersion=",Href:"&href=",DeviceType:"&deviceType=",SiteCode:"&siteCode=",GoalId:"&goalId=",VisitorCode:"&visitorCode=",VariationId:"&variationId=",Ts:"&ts=",Key:"&key=",SdkName:"&sdkName=",SdkVersion:"&sdkVersion=",ValuesCountMap:"&valuesCountMap=",Nonce:"&nonce=",Id:"&id=",CustomData:"&customData=",CurrentVisit:"&currentVisit=",MaxNumberPreviousVisits:"&maxNumberPreviousVisits=",Os:"&os=",OsIndex:"&osIndex=",Country:"&country=",City:"&city=",Region:"&region=",Latitude:"&latitude=",Longitude:"&longitude=",PostalCode:"&postalCode=",Conversion:"&conversion=",StaticData:"&staticData=",Geolocation:"&geolocation=",Page:"&page=",Experiment:"&experiment=",Browser:"&browser=",Environment:"&environment=",MappingIdentifier:"&mappingIdentifier=",MappingValue:"&mappingValue="};exports.UrlParameter=UrlParameter;var UrlFirstParameter={CustomData:"?customData=",StaticData:"?staticData=",Page:"?page=",Conversion:"?conversion=",Geolocation:"?geolocation=",Experiment:"?experiment=",ValuesCountMap:"?valuesCountMap=",Id:"?id=",Nonce:"?nonce=",Country:"?country=",Environment:"?environment=",City:"?city=",Region:"?region=",Latitude:"?latitude=",Longitude:"?longitude=",PostalCode:"?postalCode=",SdkName:"?sdkName=",SdkVersion:"?sdkVersion=",BrowserIndex:"?browserIndex=",BrowserVersion:"?browserVersion=",SiteCode:"?siteCode=",VisitorCode:"?visitorCode=",CurrentVisit:"?currentVisit=",MaxNumberPreviousVisits:"?maxNumberPreviousVisits=",Negative:"?negative=",Revenue:"?revenue=",Title:"?title=",Os:"?os=",OsIndex:"?osIndex=",Browser:"?browser=",ReferrersIndices:"?referrersIndices=",Overwrite:"?overwrite=",Index:"?index=",Href:"?href=",VariationId:"?variationId=",DeviceType:"?deviceType=",GoalId:"?goalId=",Ts:"?ts=",Key:"?key=",MappingIdentifier:"?mappingIdentifier=",MappingValue:"?mappingValue="};exports.UrlFirstParameter=UrlFirstParameter;var UrlQuery={Sse:"sse?siteCode=",Map:"map?siteCode=",Events:"events?siteCode=",Visitor:"visitor?siteCode="};exports.UrlQuery=UrlQuery;var UrlTracking={Visit:"visit/",Map:"map/"};exports.UrlTracking=UrlTracking;var topLevelDomain="io",URL_DATA_API="https://data.kameleoon.".concat("io"),URL={SERVER_SENT_EVENTS:"https://events.kameleoon.com:8110/",CLIENT_CONFIGURATION:"https://sdk-config.kameleoon.eu/",VISIT_EVENT:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Events),VISIT_DATA:"".concat(URL_DATA_API,"/").concat(UrlTracking.Visit+UrlQuery.Visitor),DATA_MAP:"".concat(URL_DATA_API,"/").concat(UrlTracking.Map+UrlQuery.Map)};exports.URL=URL;
2
2
  //# sourceMappingURL=constants.js.map