@kameleoon/javascript-sdk-core 4.2.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +0 -2
- package/dist/clientConfiguration/clientConfiguration.d.ts +3 -5
- package/dist/clientConfiguration/clientConfiguration.js +1 -1
- package/dist/clientConfiguration/clientConfiguration.js.map +1 -1
- package/dist/clientConfiguration/constants.js +1 -1
- package/dist/clientConfiguration/constants.js.map +1 -1
- package/dist/clientConfiguration/types.d.ts +3 -2
- package/dist/clientConfiguration/types.js.map +1 -1
- package/dist/clientSettings/clientSettings.d.ts +11 -1
- package/dist/clientSettings/clientSettings.js +1 -1
- package/dist/clientSettings/clientSettings.js.map +1 -1
- package/dist/clientSettings/types.d.ts +5 -1
- package/dist/clientSettings/types.js.map +1 -1
- package/dist/eventManager/eventManager.d.ts +11 -0
- package/dist/eventManager/eventManager.js +2 -0
- package/dist/eventManager/eventManager.js.map +1 -0
- package/dist/eventManager/index.d.ts +2 -0
- package/dist/eventManager/index.js +2 -0
- package/dist/eventManager/index.js.map +1 -0
- package/dist/eventManager/types.d.ts +36 -0
- package/dist/eventManager/types.js +2 -0
- package/dist/eventManager/types.js.map +1 -0
- package/dist/eventSource/eventSource.js +1 -1
- package/dist/eventSource/eventSource.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kameleoonClient.d.ts +10 -2
- package/dist/kameleoonClient.js +1 -1
- package/dist/kameleoonClient.js.map +1 -1
- package/dist/kameleoonClientInterface.d.ts +26 -0
- package/dist/kameleoonClientInterface.js.map +1 -1
- package/dist/kameleoonData/dataManager.d.ts +2 -2
- package/dist/kameleoonData/dataManager.js +1 -1
- package/dist/kameleoonData/dataManager.js.map +1 -1
- package/dist/kameleoonData/dataProcessor.d.ts +2 -2
- package/dist/kameleoonData/dataProcessor.js +1 -1
- package/dist/kameleoonData/dataProcessor.js.map +1 -1
- package/dist/kameleoonData/index.d.ts +0 -1
- package/dist/kameleoonData/index.js +1 -1
- package/dist/kameleoonData/index.js.map +1 -1
- package/dist/kameleoonData/types.d.ts +1 -1
- package/dist/kameleoonData/types.js.map +1 -1
- package/dist/kameleoonError/constants.d.ts +1 -0
- package/dist/kameleoonError/constants.js +1 -1
- package/dist/kameleoonError/constants.js.map +1 -1
- package/dist/kameleoonError/kameleoonError.d.ts +1 -0
- package/dist/kameleoonError/kameleoonError.js +1 -1
- package/dist/kameleoonError/kameleoonError.js.map +1 -1
- package/dist/kameleoonError/types.d.ts +1 -0
- package/dist/kameleoonError/types.js +1 -1
- package/dist/kameleoonError/types.js.map +1 -1
- package/dist/kameleoonUtils.d.ts +29 -5
- package/dist/kameleoonUtils.js +1 -1
- package/dist/kameleoonUtils.js.map +1 -1
- package/dist/requester/constants.d.ts +1 -8
- package/dist/requester/constants.js +1 -1
- package/dist/requester/constants.js.map +1 -1
- package/dist/requester/index.d.ts +2 -2
- package/dist/requester/index.js +1 -1
- package/dist/requester/index.js.map +1 -1
- package/dist/requester/requester.d.ts +6 -2
- package/dist/requester/requester.js +1 -1
- package/dist/requester/requester.js.map +1 -1
- package/dist/requester/types.d.ts +96 -19
- package/dist/requester/types.js +1 -1
- package/dist/requester/types.js.map +1 -1
- package/dist/requester/urlProvider.d.ts +8 -5
- package/dist/requester/urlProvider.js +1 -1
- package/dist/requester/urlProvider.js.map +1 -1
- package/dist/targeting/conditions/customData.d.ts +4 -2
- package/dist/targeting/conditions/customData.js +1 -1
- package/dist/targeting/conditions/customData.js.map +1 -1
- package/dist/targeting/conditions/types.d.ts +1 -0
- package/dist/targeting/conditions/types.js.map +1 -1
- package/dist/targeting/types.d.ts +2 -1
- package/dist/targeting/types.js +1 -1
- package/dist/targeting/types.js.map +1 -1
- package/dist/types.d.ts +17 -5
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/constants.d.ts +1 -0
- package/dist/utilities/constants.js +1 -1
- package/dist/utilities/constants.js.map +1 -1
- package/dist/utilities/utilities.js +1 -1
- package/dist/utilities/utilities.js.map +1 -1
- package/dist/visitorCodeManager/visitorCodeManager.js +1 -1
- package/dist/visitorCodeManager/visitorCodeManager.js.map +1 -1
- package/package.json +2 -2
- package/dist/kameleoonData/constants.d.ts +0 -4
- package/dist/kameleoonData/constants.js +0 -2
- package/dist/kameleoonData/constants.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataManager.js","names":["DataManager","constructor","a","storage","targetingCleanupInterval","_defineProperty","Map","Set","dataProcessor","DataProcessor","unsentData","cleanupInterval","cleanupCallback","cleanupOutdatedTargetingData","sentPageViewTimestamps","clear","targetingDataIntervalId","setInterval","Milliseconds","Minute","err","clearInterval","addData","visitorCode","b","arguments","length","kameleoonData","Array","d","dataItem","updateData","data","type","KameleoonData","CustomData","customData","mappingIdentifierCustomDataIndex","index","_isMappingIdentifier","value","createReference","localCustomDataIndexes","has","isSent","set","PageView","storedData","getTargetingData","or","storedVisitorData","pageView","urlAddress","timestamp","timestamps","Conversion","existingConversions","get","push","Ok","getTree","segment","targetingTrees","id","targetingTree","Tree","clearTrees","getUnsentData","clearUnsentData","dataItems","values","persistentCustomDataIndexes","size","persistentCustomData","isArray","isPersistentCustomData","clearUnsentDataByKey","key","visitorData","dataKey","entries","delete","keys","Utilities","isCustomData","getLinkedVisitor","getVisitorIdentifier","targetingData","customDataValue","trees","unsentDataVisitors","Object","identifierCustomDataIndex","storedDataTypes","storedDataTypeList","storedCustomDataIndexes","storedCustomDataIndexList","customDataIndexes","customDataLocalOnlyIndexes","forEach","localOnly","scope","CustomDataScope","Visitor","isMappingIdentifier","exports"],"sources":["../../src/kameleoonData/dataManager.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { SegmentType, Tree } from 'src/targeting';\nimport { DataProcessor } from './dataProcessor';\nimport { Utilities } from 'src/utilities';\nimport {\n CustomDataConfigurationType,\n CustomDataScope,\n} from 'src/clientConfiguration';\nimport { Milliseconds } from 'src/types';\nimport { CustomData } from './customData';\nimport {\n DataManagerParametersType,\n ExistingPageViewDataType,\n KameleoonData,\n KameleoonDataType,\n KameleoonVisitorDataType,\n PageViewDataType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n} from './types';\n\ninterface IDataManager {\n addData(visitorCode: string, ...kameleoonData: KameleoonDataType[]): void;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n getTree(segment: SegmentType): Tree;\n clearTrees(): void;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n getLinkedVisitor: (visitorCode: string) => string | null;\n getTargetingData: (\n visitorCode: string,\n ) => KameleoonVisitorDataType | undefined;\n readonly trees: Map<string, Tree>;\n readonly unsentDataVisitors: string[];\n readonly identifierCustomDataIndex: number | null;\n}\n\nexport class DataManager implements IDataManager {\n private targetingTrees: Map<string, Tree> = new Map();\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n private mappingIdentifierCustomDataIndex: number | null = null;\n private targetingDataIntervalId: NodeJS.Timer | null = null;\n private dataProcessor: DataProcessor;\n private unsentData: UnsentTargetingDataType;\n private sentPageViewTimestamps: Map<number, boolean> = new Map();\n\n constructor({\n storage,\n targetingCleanupInterval,\n }: DataManagerParametersType) {\n this.dataProcessor = new DataProcessor(storage);\n this.unsentData = {};\n\n if (targetingCleanupInterval) {\n const cleanupInterval =\n targetingCleanupInterval < 0 ? 1 : targetingCleanupInterval;\n\n const cleanupCallback = () => {\n this.dataProcessor.cleanupOutdatedTargetingData(\n targetingCleanupInterval,\n );\n this.sentPageViewTimestamps.clear();\n };\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.targetingDataIntervalId = setInterval(\n cleanupCallback,\n cleanupInterval * Milliseconds.Minute,\n );\n } catch (err) {\n if (this.targetingDataIntervalId) {\n clearInterval(this.targetingDataIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public addData(\n visitorCode: string,\n ...kameleoonData: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always presents further\n if (!this.unsentData[visitorCode]) {\n this.unsentData[visitorCode] = new Map();\n }\n\n for (const dataItem of kameleoonData) {\n // TODO: this can be optimized to be updated altogether\n // instead of updating each data item separately\n this.dataProcessor.updateData(visitorCode, dataItem);\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const customData = dataItem as CustomData;\n const data = customData.data;\n\n // --- Bug ---\n // - There's a known issue here: `mappingIdentifier` won't be updated\n // in the storage because the data is written before `unsentData` update\n // and we get `mappingIdentifier` only by checking CC here\n // - It doesn't affect the functionality, as stored data is\n // only used for condition evaluation and `Visitor` scoped CD is never removed from `unsentData`\n // still it should be fixed with some `.updateData` refactor\n if (this.mappingIdentifierCustomDataIndex === data.index) {\n customData._isMappingIdentifier = true;\n\n if (visitorCode !== data.value[0]) {\n // --- Note ---\n // Associate linked visitor codes\n this.dataProcessor.createReference(visitorCode, data.value[0]);\n }\n }\n\n if (\n !this.localCustomDataIndexes.has(data.index) &&\n !dataItem.isSent\n ) {\n this.unsentData[visitorCode]!.set(data.index, customData);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // `PageViews` can only be processed during storage update as they\n // can't create and merge referrers/titles/timestamps on their own\n // So we have to extract them from storage to update `unsentData` correctly\n const storedData = this.dataProcessor\n .getTargetingData(visitorCode)\n .or({});\n\n if (storedData) {\n const storedVisitorData = storedData[KameleoonData.PageView];\n const pageView = (storedVisitorData as ExistingPageViewDataType)[\n data.urlAddress\n ];\n\n // --- Note ---\n // A case for newly created page view\n if (!dataItem.isSent) {\n for (const timestamp of pageView.timestamps) {\n // --- Note ---\n // As we don't keep `sent` status for each timestamp, we have to\n // check if it was already sent to avoid duplicates\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.unsentData[visitorCode]!.set(timestamp, dataItem);\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n // --- Note ---\n // A case for `getRemoteVisitorData` pre-loaded pages that shouldn't be sent again\n } else {\n for (const timestamp of pageView.timestamps) {\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n }\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const unsentData = this.unsentData[visitorCode]!;\n\n if (!dataItem.isSent) {\n if (unsentData.has(KameleoonData.Conversion)) {\n const existingConversions = unsentData.get(\n KameleoonData.Conversion,\n ) as KameleoonDataType[];\n\n existingConversions.push(dataItem);\n\n unsentData.set(KameleoonData.Conversion, existingConversions);\n } else {\n unsentData.set(KameleoonData.Conversion, [dataItem]);\n }\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n\n if (!dataItem.isSent) {\n this.unsentData[visitorCode]!.set(data.type, dataItem);\n }\n }\n }\n }\n\n return Ok();\n }\n\n public getTree(segment: SegmentType): Tree {\n if (this.targetingTrees.has(segment.id)) {\n return this.targetingTrees.get(segment.id)!;\n }\n\n const targetingTree = new Tree(segment);\n this.targetingTrees.set(segment.id, targetingTree);\n\n return targetingTree;\n }\n\n public clearTrees(): void {\n this.targetingTrees.clear();\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (!Array.isArray(dataItem) && this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentData[visitorCode];\n }\n\n public clearUnsentDataByKey(visitorCode: string, key: KameleoonData): void {\n const visitorData = this.unsentData[visitorCode];\n\n if (!visitorData) {\n return;\n }\n\n if (\n key === KameleoonData.CustomData &&\n this.persistentCustomDataIndexes.size\n ) {\n for (const [dataKey, dataItem] of visitorData.entries()) {\n if (this.isPersistentCustomData(dataItem as KameleoonDataType)) {\n continue;\n }\n\n if (dataKey === key) {\n visitorData.delete(dataKey);\n }\n }\n } else if (key === KameleoonData.PageView) {\n for (const dataKey of visitorData.keys()) {\n if (typeof dataKey === 'number') {\n visitorData.delete(dataKey);\n }\n }\n } else {\n visitorData.delete(key);\n }\n\n if (!visitorData.size) {\n delete this.unsentData[visitorCode];\n }\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n public getLinkedVisitor(visitorCode: string): string | null {\n return this.dataProcessor.getLinkedVisitor(\n visitorCode,\n this.mappingIdentifierCustomDataIndex,\n );\n }\n\n public getVisitorIdentifier(visitorCode: string): string {\n const targetingData = this.getTargetingData(visitorCode);\n\n if (!targetingData) {\n return visitorCode;\n }\n\n const customData = targetingData[KameleoonData.CustomData];\n\n if (!customData || this.mappingIdentifierCustomDataIndex === null) {\n return visitorCode;\n }\n\n const customDataValue = customData[this.mappingIdentifierCustomDataIndex];\n\n if (customDataValue) {\n return customDataValue.value[0];\n }\n\n return visitorCode;\n }\n\n public getTargetingData(\n visitorCode: string,\n ): KameleoonVisitorDataType | undefined {\n const targetingData = this.dataProcessor\n .getTargetingData(visitorCode)\n .or(null);\n\n if (!targetingData) {\n return undefined;\n }\n\n return targetingData;\n }\n\n get trees(): Map<string, Tree> {\n return this.targetingTrees;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentData);\n }\n\n get identifierCustomDataIndex(): number | null {\n return this.mappingIdentifierCustomDataIndex;\n }\n\n get storedDataTypes(): Set<KameleoonData> {\n return this.dataProcessor.storedDataTypeList;\n }\n\n get storedCustomDataIndexes(): Set<number> {\n return this.dataProcessor.storedCustomDataIndexList;\n }\n\n set customDataIndexes(customData: CustomDataConfigurationType[]) {\n const [customDataLocalOnlyIndexes, persistentCustomDataIndexes]: Array<\n number[]\n > = [[], []];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n\n if (customData.isMappingIdentifier) {\n this.mappingIdentifierCustomDataIndex = customData.index;\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(persistentCustomDataIndexes);\n }\n }\n}\n"],"mappings":"41BAwCO,KAAM,CAAAA,WAAoC,CAU/CC,WAAWA,CAAAC,CAAA,CAGmB,IAHlB,CACVC,OAAO,CAAPA,CAAO,CACPC,wBAAwB,CAAxBA,CACyB,CAAC,CAAAF,CAAA,CAI1B,GAAAG,eAAA,uBAhB0C,GAAI,CAAAC,GAAK,EAAAD,eAAA,+BACP,GAAI,CAAAE,GAAK,EAAAF,eAAA,oCACJ,GAAI,CAAAE,GAAK,EAAAF,eAAA,yCACF,IAAI,EAAAA,eAAA,gCACP,IAAI,EAAAA,eAAA,8BAAAA,eAAA,2BAAAA,eAAA,+BAGJ,GAAI,CAAAC,GAAK,EAM9D,IAAI,CAACE,aAAa,CAAG,GAAI,CAAAC,4BAAa,CAACN,CAAO,CAAC,CAC/C,IAAI,CAACO,UAAU,CAAG,CAAC,CAAC,CAEhBN,CAAwB,CAAE,MACtB,CAAAO,CAAe,CACQ,CAAC,CAA5BP,CAA4B,CAAG,CAAC,CAAGA,CAA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CAE3E,CACF,CAACkC,OAAA,CAAAzG,WAAA,CAAAA,WAAA"}
|
|
1
|
+
{"version":3,"file":"dataManager.js","names":["DataManager","constructor","a","storage","cleanupInterval","_defineProperty","Map","Set","dataProcessor","DataProcessor","unsentData","cleanupCallback","cleanupTargetingData","sentPageViewTimestamps","clear","cleanupIntervalId","setInterval","err","clearInterval","addData","visitorCode","b","arguments","length","kameleoonData","Array","d","dataItem","updateData","data","type","KameleoonData","CustomData","customData","mappingIdentifierCustomDataIndex","index","_isMappingIdentifier","value","createReference","localCustomDataIndexes","has","isSent","set","PageView","storedData","getTargetingData","or","storedVisitorData","pageView","urlAddress","timestamp","timestamps","Conversion","existingConversions","get","push","Ok","getTree","segment","targetingTrees","id","targetingTree","Tree","clearTrees","getUnsentData","clearUnsentData","dataItems","values","persistentCustomDataIndexes","size","persistentCustomData","isArray","isPersistentCustomData","clearUnsentDataByKey","key","visitorData","dataKey","entries","delete","keys","Utilities","isCustomData","getLinkedVisitor","getVisitorIdentifier","targetingData","customDataValue","trees","unsentDataVisitors","Object","identifierCustomDataIndex","storedDataTypes","storedDataTypeList","storedCustomDataIndexes","storedCustomDataIndexList","customDataIndexes","customDataLocalOnlyIndexes","forEach","localOnly","scope","CustomDataScope","Visitor","isMappingIdentifier","exports"],"sources":["../../src/kameleoonData/dataManager.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { SegmentType, Tree } from 'src/targeting';\nimport { DataProcessor } from './dataProcessor';\nimport { Utilities } from 'src/utilities';\nimport {\n CustomDataConfigurationType,\n CustomDataScope,\n} from 'src/clientConfiguration';\nimport { CustomData } from './customData';\nimport {\n DataManagerParametersType,\n ExistingPageViewDataType,\n KameleoonData,\n KameleoonDataType,\n KameleoonVisitorDataType,\n PageViewDataType,\n UnsentTargetingDataType,\n UnsentVisitorTargetingDataType,\n} from './types';\n\ninterface IDataManager {\n addData(visitorCode: string, ...kameleoonData: KameleoonDataType[]): void;\n getUnsentData: (\n visitorCode: string,\n ) => UnsentTargetingDataType[string] | undefined;\n getTree(segment: SegmentType): Tree;\n clearTrees(): void;\n clearUnsentData: (visitorCode: string) => void;\n isPersistentCustomData: (dataItem: KameleoonDataType) => boolean;\n getLinkedVisitor: (visitorCode: string) => string | null;\n getTargetingData: (\n visitorCode: string,\n ) => KameleoonVisitorDataType | undefined;\n readonly trees: Map<string, Tree>;\n readonly unsentDataVisitors: string[];\n readonly identifierCustomDataIndex: number | null;\n}\n\nexport class DataManager implements IDataManager {\n private targetingTrees: Map<string, Tree> = new Map();\n private localCustomDataIndexes: Set<number> = new Set();\n private persistentCustomDataIndexes: Set<number> = new Set();\n private mappingIdentifierCustomDataIndex: number | null = null;\n private cleanupIntervalId: NodeJS.Timer | null = null;\n private dataProcessor: DataProcessor;\n private unsentData: UnsentTargetingDataType;\n private sentPageViewTimestamps: Map<number, boolean> = new Map();\n\n constructor({ storage, cleanupInterval }: DataManagerParametersType) {\n this.dataProcessor = new DataProcessor(storage);\n this.unsentData = {};\n\n if (cleanupInterval) {\n const cleanupCallback = () => {\n this.dataProcessor.cleanupTargetingData(cleanupInterval);\n this.sentPageViewTimestamps.clear();\n };\n\n // --- Note ---\n // We can not make delayed code execution recoverable, as it might lead\n // to targeting data storage size overflow\n try {\n this.cleanupIntervalId = setInterval(cleanupCallback, cleanupInterval);\n } catch (err) {\n if (this.cleanupIntervalId) {\n clearInterval(this.cleanupIntervalId);\n }\n\n throw err;\n }\n }\n }\n\n public addData(\n visitorCode: string,\n ...kameleoonData: KameleoonDataType[]\n ): Result<void, KameleoonError> {\n // --- Note ---\n // We assume `this.unsentTargetingData[visitorCode]` is always presents further\n if (!this.unsentData[visitorCode]) {\n this.unsentData[visitorCode] = new Map();\n }\n\n for (const dataItem of kameleoonData) {\n // TODO: this can be optimized to be updated altogether\n // instead of updating each data item separately\n this.dataProcessor.updateData(visitorCode, dataItem);\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const customData = dataItem as CustomData;\n const data = customData.data;\n\n // --- Bug ---\n // - There's a known issue here: `mappingIdentifier` won't be updated\n // in the storage because the data is written before `unsentData` update\n // and we get `mappingIdentifier` only by checking CC here\n // - It doesn't affect the functionality, as stored data is\n // only used for condition evaluation and `Visitor` scoped CD is never removed from `unsentData`\n // still it should be fixed with some `.updateData` refactor\n if (this.mappingIdentifierCustomDataIndex === data.index) {\n customData._isMappingIdentifier = true;\n\n if (visitorCode !== data.value[0]) {\n // --- Note ---\n // Associate linked visitor codes\n this.dataProcessor.createReference(visitorCode, data.value[0]);\n }\n }\n\n if (\n !this.localCustomDataIndexes.has(data.index) &&\n !dataItem.isSent\n ) {\n this.unsentData[visitorCode]!.set(data.index, customData);\n }\n\n break;\n }\n case KameleoonData.PageView: {\n const data = dataItem.data as PageViewDataType;\n\n // --- Note ---\n // `PageViews` can only be processed during storage update as they\n // can't create and merge referrers/titles/timestamps on their own\n // So we have to extract them from storage to update `unsentData` correctly\n const storedData = this.dataProcessor\n .getTargetingData(visitorCode)\n .or({});\n\n if (storedData) {\n const storedVisitorData = storedData[KameleoonData.PageView];\n const pageView = (storedVisitorData as ExistingPageViewDataType)[\n data.urlAddress\n ];\n\n // --- Note ---\n // A case for newly created page view\n if (!dataItem.isSent) {\n for (const timestamp of pageView.timestamps) {\n // --- Note ---\n // As we don't keep `sent` status for each timestamp, we have to\n // check if it was already sent to avoid duplicates\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.unsentData[visitorCode]!.set(timestamp, dataItem);\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n // --- Note ---\n // A case for `getRemoteVisitorData` pre-loaded pages that shouldn't be sent again\n } else {\n for (const timestamp of pageView.timestamps) {\n if (!this.sentPageViewTimestamps.has(timestamp)) {\n this.sentPageViewTimestamps.set(timestamp, true);\n }\n }\n }\n }\n\n break;\n }\n case KameleoonData.Conversion: {\n const unsentData = this.unsentData[visitorCode]!;\n\n if (!dataItem.isSent) {\n if (unsentData.has(KameleoonData.Conversion)) {\n const existingConversions = unsentData.get(\n KameleoonData.Conversion,\n ) as KameleoonDataType[];\n\n existingConversions.push(dataItem);\n\n unsentData.set(KameleoonData.Conversion, existingConversions);\n } else {\n unsentData.set(KameleoonData.Conversion, [dataItem]);\n }\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n\n if (!dataItem.isSent) {\n this.unsentData[visitorCode]!.set(data.type, dataItem);\n }\n }\n }\n }\n\n return Ok();\n }\n\n public getTree(segment: SegmentType): Tree {\n if (this.targetingTrees.has(segment.id)) {\n return this.targetingTrees.get(segment.id)!;\n }\n\n const targetingTree = new Tree(segment);\n this.targetingTrees.set(segment.id, targetingTree);\n\n return targetingTree;\n }\n\n public clearTrees(): void {\n this.targetingTrees.clear();\n }\n\n public getUnsentData(\n visitorCode: string,\n ): UnsentTargetingDataType[string] | undefined {\n return this.unsentData[visitorCode];\n }\n\n public clearUnsentData(visitorCode: string): void {\n const dataItems = this.unsentData[visitorCode]?.values();\n\n if (dataItems && this.persistentCustomDataIndexes.size) {\n const persistentCustomData: UnsentVisitorTargetingDataType = new Map();\n\n for (const dataItem of dataItems) {\n if (!Array.isArray(dataItem) && this.isPersistentCustomData(dataItem)) {\n persistentCustomData.set(dataItem.data.index, dataItem);\n }\n }\n\n if (persistentCustomData.size) {\n this.unsentData[visitorCode] = persistentCustomData;\n return;\n }\n }\n\n delete this.unsentData[visitorCode];\n }\n\n public clearUnsentDataByKey(visitorCode: string, key: KameleoonData): void {\n const visitorData = this.unsentData[visitorCode];\n\n if (!visitorData) {\n return;\n }\n\n if (\n key === KameleoonData.CustomData &&\n this.persistentCustomDataIndexes.size\n ) {\n for (const [dataKey, dataItem] of visitorData.entries()) {\n if (this.isPersistentCustomData(dataItem as KameleoonDataType)) {\n continue;\n }\n\n if (dataKey === key) {\n visitorData.delete(dataKey);\n }\n }\n } else if (key === KameleoonData.PageView) {\n for (const dataKey of visitorData.keys()) {\n if (typeof dataKey === 'number') {\n visitorData.delete(dataKey);\n }\n }\n } else {\n visitorData.delete(key);\n }\n\n if (!visitorData.size) {\n delete this.unsentData[visitorCode];\n }\n }\n\n public isPersistentCustomData(\n dataItem: KameleoonDataType,\n ): dataItem is CustomData {\n if (!this.persistentCustomDataIndexes.size) {\n return false;\n }\n\n if (Utilities.isCustomData(dataItem)) {\n return this.persistentCustomDataIndexes.has(dataItem.data.index);\n }\n\n return false;\n }\n\n public getLinkedVisitor(visitorCode: string): string | null {\n return this.dataProcessor.getLinkedVisitor(\n visitorCode,\n this.mappingIdentifierCustomDataIndex,\n );\n }\n\n public getVisitorIdentifier(visitorCode: string): string {\n const targetingData = this.getTargetingData(visitorCode);\n\n if (!targetingData) {\n return visitorCode;\n }\n\n const customData = targetingData[KameleoonData.CustomData];\n\n if (!customData || this.mappingIdentifierCustomDataIndex === null) {\n return visitorCode;\n }\n\n const customDataValue = customData[this.mappingIdentifierCustomDataIndex];\n\n if (customDataValue) {\n return customDataValue.value[0];\n }\n\n return visitorCode;\n }\n\n public getTargetingData(\n visitorCode: string,\n ): KameleoonVisitorDataType | undefined {\n const targetingData = this.dataProcessor\n .getTargetingData(visitorCode)\n .or(null);\n\n if (!targetingData) {\n return undefined;\n }\n\n return targetingData;\n }\n\n get trees(): Map<string, Tree> {\n return this.targetingTrees;\n }\n\n get unsentDataVisitors(): string[] {\n return Object.keys(this.unsentData);\n }\n\n get identifierCustomDataIndex(): number | null {\n return this.mappingIdentifierCustomDataIndex;\n }\n\n get storedDataTypes(): Set<KameleoonData> {\n return this.dataProcessor.storedDataTypeList;\n }\n\n get storedCustomDataIndexes(): Set<number> {\n return this.dataProcessor.storedCustomDataIndexList;\n }\n\n set customDataIndexes(customData: CustomDataConfigurationType[]) {\n const [customDataLocalOnlyIndexes, persistentCustomDataIndexes]: Array<\n number[]\n > = [[], []];\n\n customData.forEach((customData) => {\n if (customData.localOnly) {\n customDataLocalOnlyIndexes.push(customData.index);\n }\n\n if (customData.scope === CustomDataScope.Visitor) {\n persistentCustomDataIndexes.push(customData.index);\n }\n\n if (customData.isMappingIdentifier) {\n this.mappingIdentifierCustomDataIndex = customData.index;\n }\n });\n\n if (customDataLocalOnlyIndexes.length) {\n this.localCustomDataIndexes = new Set(customDataLocalOnlyIndexes);\n }\n\n if (persistentCustomDataIndexes.length) {\n this.persistentCustomDataIndexes = new Set(persistentCustomDataIndexes);\n }\n }\n}\n"],"mappings":"g0BAuCO,KAAM,CAAAA,WAAoC,CAU/CC,WAAWA,CAAAC,CAAA,CAA0D,IAAzD,CAAEC,OAAO,CAAPA,CAAO,CAAEC,eAAe,CAAfA,CAA2C,CAAC,CAAAF,CAAA,CAIjE,GAAAG,eAAA,uBAb0C,GAAI,CAAAC,GAAK,EAAAD,eAAA,+BACP,GAAI,CAAAE,GAAK,EAAAF,eAAA,oCACJ,GAAI,CAAAE,GAAK,EAAAF,eAAA,yCACF,IAAI,EAAAA,eAAA,0BACb,IAAI,EAAAA,eAAA,8BAAAA,eAAA,2BAAAA,eAAA,+BAGE,GAAI,CAAAC,GAAK,EAG9D,IAAI,CAACE,aAAa,CAAG,GAAI,CAAAC,4BAAa,CAACN,CAAO,CAAC,CAC/C,IAAI,CAACO,UAAU,CAAG,CAAC,CAAC,CAEhBN,CAAe,CAAE,CACnB,KAAM,CAAAO,CAAe,CAAGA,CAAA,GAAM,CAC5B,IAAI,CAACH,aAAa,CAACI,oBAAoB,CAACR,CAAe,CAAC,CACxD,IAAI,CAACS,sBAAsB,CAACC,KAAK,CAAC,CACpC,CAAC,CAKD,GAAI,CACF,IAAI,CAACC,iBAAiB,CAAGC,WAAW,CAACL,CAAe,CAAEP,CAAe,CACvE,CAAE,MAAOa,CAAG,CAAE,CAKZ,KAJI,KAAI,CAACF,iBAAiB,EACxBG,aAAa,CAAC,IAAI,CAACH,iBAAiB,CAAC,CAGjCE,CACR,CACF,CACF,CAEOE,OAAOA,CACZC,CAAmB,CAEW,CAGzB,IAAI,CAACV,UAAU,CAACU,CAAW,CAAC,GAC/B,IAAI,CAACV,UAAU,CAACU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AAI,CAACpF,aAAa,CAACqF,yBAC5B,CAEA,GAAI,CAAAC,iBAAiBA,CAAC7D,CAAyC,CAAE,CAC/D,KAAM,CAAC8D,CAA0B,CAAE3B,CAA2B,CAE7D,CAAG,CAAC,EAAE,CAAE,EAAE,CAAC,CAEZnC,CAAU,CAAC+D,OAAO,CAAE/D,CAAU,EAAK,CAC7BA,CAAU,CAACgE,SAAS,EACtBF,CAA0B,CAACxC,IAAI,CAACtB,CAAU,CAACE,KAAK,CAAC,CAG/CF,CAAU,CAACiE,KAAK,GAAKC,oCAAe,CAACC,OAAO,EAC9ChC,CAA2B,CAACb,IAAI,CAACtB,CAAU,CAACE,KAAK,CAAC,CAGhDF,CAAU,CAACoE,mBAAmB,GAChC,IAAI,CAACnE,gCAAgC,CAAGD,CAAU,CAACE,KAAK,CAE5D,CAAC,CAAC,CAEE4D,CAA0B,CAACxE,MAAM,GACnC,IAAI,CAACgB,sBAAsB,CAAG,GAAI,CAAAhC,GAAG,CAACwF,CAA0B,CAAC,EAG/D3B,CAA2B,CAAC7C,MAAM,GACpC,IAAI,CAAC6C,2BAA2B,CAAG,GAAI,CAAA7D,GAAG,CAAC6D,CAA2B,CAAC,CAE3E,CACF,CAACkC,OAAA,CAAAtG,WAAA,CAAAA,WAAA"}
|
|
@@ -6,7 +6,7 @@ import { KameleoonData, KameleoonDataType, KameleoonVisitorDataType } from './ty
|
|
|
6
6
|
interface IDataProcessor {
|
|
7
7
|
updateData(visitorCode: string, dataItem: KameleoonDataType): Result<void, KameleoonError>;
|
|
8
8
|
createReference(visitorCode: string, linkedVisitor: VisitorReference): void;
|
|
9
|
-
|
|
9
|
+
cleanupTargetingData(targetingCleanupInterval?: number): void;
|
|
10
10
|
getTargetingData(visitorCode: string): Result<KameleoonVisitorDataType | null, KameleoonError>;
|
|
11
11
|
getLinkedVisitor(visitorCode: string, index: number): string | null;
|
|
12
12
|
}
|
|
@@ -18,7 +18,7 @@ export declare class DataProcessor implements IDataProcessor {
|
|
|
18
18
|
updateData(visitorCode: string, dataItem: KameleoonDataType): Result<void, KameleoonError>;
|
|
19
19
|
createReference(visitorCode: string, linkedVisitor: VisitorReference): void;
|
|
20
20
|
getLinkedVisitor(visitorCode: string, index: number | null): string | null;
|
|
21
|
-
|
|
21
|
+
cleanupTargetingData(cleanupInterval: number): void;
|
|
22
22
|
getTargetingData(visitorCode: string): Result<KameleoonVisitorDataType | null, KameleoonError>;
|
|
23
23
|
private dereferenceTargetingData;
|
|
24
24
|
get storedDataTypeList(): Set<KameleoonData>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const _excluded=["customData","pageView","conversion"];Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataProcessor=void 0;var _tsRes=require("ts-res"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("
|
|
1
|
+
"use strict";const _excluded=["customData","pageView","conversion"];Object.defineProperty(exports,"__esModule",{value:!0}),exports.DataProcessor=void 0;var _tsRes=require("ts-res"),_utilities=require("../utilities"),_types=require("../utilities/types"),_types2=require("./types");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 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 _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class DataProcessor{constructor(a){_defineProperty(this,"storage",void 0),_defineProperty(this,"storedDataTypes",new Set([])),_defineProperty(this,"storedCustomDataIndexes",new Set([])),this.storage=a}updateData(a,b){const c=this.storage.read().or({}),d=this.dereferenceTargetingData(c,a),e=(null===d||void 0===d?void 0:d.visitorReference)||a;switch(b.data.type){case _types2.KameleoonData.CustomData:{const a=b.data,f=d&&_types2.KameleoonData.CustomData in d.data,g={visitorCode:e,data:c,key:_types2.KameleoonData.CustomData,nestedKey:a.index.toString(),value:a};f?this.updateNestedField(g):this.createNestedField(g),this.storedCustomDataIndexes.add(a.index);break}case _types2.KameleoonData.PageView:{var f;const a=b.data;a.timestamps.length||(a.timestamps=[Date.now()]);const g=d&&_types2.KameleoonData.PageView in d.data&&(null===(f=d.data[a.type])||void 0===f?void 0:f[a.urlAddress]),h={visitorCode:e,data:c,key:_types2.KameleoonData.PageView,nestedKey:a.urlAddress,value:a};g?(a.timestamps.forEach(a=>{_utilities.Utilities.insertInOrderedListMutably({list:g.timestamps,element:a,order:_types.Order.Ascending})}),[g.referrers,g.title]=[a.referrers,a.title],this.updateNestedField(_objectSpread(_objectSpread({},h),{},{value:g}))):this.createNestedField(h);break}case _types2.KameleoonData.Conversion:{const a=b.data,f=d&&_types2.KameleoonData.Conversion in d.data,g={visitorCode:e,data:c,key:_types2.KameleoonData.Conversion,value:a};f?this.updateArrayField(g):this.createArrayField(g);break}case _types2.KameleoonData.VisitsData:{const a=b.data,f=d&&_types2.KameleoonData.VisitsData in d.data,g={visitorCode:e,data:c,key:_types2.KameleoonData.VisitsData,value:a};if(f){const b=d.data[a.type];b.visits.forEach(b=>{_utilities.Utilities.insertInOrderedListMutably({list:a.visits,element:b,order:_types.Order.Ascending})}),this.updateField(_objectSpread(_objectSpread({},g),{},{value:_objectSpread(_objectSpread({},a),{},{visits:a.visits})}))}else this.createField(g);break}default:{const{data:a}=b,f=d&&a.type in d.data,g={visitorCode:e,data:c,key:a.type,value:a};f?this.updateField(g):this.createField(g),this.storedDataTypes.add(a.type)}}return this.storage.write(c)}createReference(a,b){const c=this.storage.read();c.ok&&(c.data[b]=a,this.storage.write(c.data))}getLinkedVisitor(a,b){const c=this.storage.read();if(!c.ok)return null;if("string"==typeof c.data[a])return c.data[a];if(null===b)return null;const d=c.data[a];if(!d)return null;const e=d[_types2.KameleoonData.CustomData];return e&&e[b]?e[b].value[0]:null}cleanupTargetingData(a){const b=this.storage.read();if(!b.ok)return;const c=b.data,d=Date.now();if(Object.keys(c).length){for(const[b,e]of Object.entries(c)){if("string"==typeof e){delete c[b];continue}const f=e,{customData:g,pageView:h,conversion:i}=f,j=_objectWithoutProperties(f,_excluded);if(g)for(const[b,e]of Object.entries(g))if(e){const g=e.lastActivityTime+a<d,h=f[_types2.KameleoonData.CustomData];g&&h&&(this.storedCustomDataIndexes.delete(+b),delete h[+b]),h&&!Object.keys(h).length&&(this.storedCustomDataIndexes.clear(),delete c[_types2.KameleoonData.CustomData])}if(h)for(const[b,c]of Object.entries(h)){const e=c.lastActivityTime+a<d,g=f[_types2.KameleoonData.PageView];e&&g&&delete g[b],g&&!Object.keys(g).length&&delete f[_types2.KameleoonData.PageView]}if(i)for(const b of i){const c=b.lastActivityTime+a<d,e=f[_types2.KameleoonData.Conversion];c&&e&&e.splice(e.indexOf(b),1),e&&!e.length&&delete f[_types2.KameleoonData.Conversion]}for(const[b,c]of Object.entries(j)){const e=c.lastActivityTime+a<d;e&&(delete f[b],this.storedDataTypes.delete(b))}Object.keys(c[b]).length||(this.storedDataTypes.clear(),this.storedCustomDataIndexes.clear(),delete c[b])}this.storage.write(c)}}getTargetingData(a){const b=this.storage.read();if(!b.ok)return(0,_tsRes.Err)(b.error);const c=this.dereferenceTargetingData(b.data,a);return c?(0,_tsRes.Ok)(c.data):(0,_tsRes.Ok)(null)}dereferenceTargetingData(a,b){if(!a[b])return null;if("string"==typeof a[b]){const c=a[b];return{data:a[c],visitorReference:c}}return{data:a[b],visitorReference:b}}get storedDataTypeList(){return this.storedDataTypes}get storedCustomDataIndexList(){return this.storedCustomDataIndexes}updateField(a){let{visitorCode:b,key:c,value:d,data:e}=a;e[b][c]=_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})}createField(a){let{visitorCode:b,key:c,value:d,data:e}=a;e[b]=_objectSpread(_objectSpread({},e[b]),{},{[c]:_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})})}updateArrayField(a){let{visitorCode:b,key:c,value:d,data:e}=a;e[b][c].push(_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()}))}createArrayField(a){let{visitorCode:b,key:c,value:d,data:e}=a;e[b]=_objectSpread(_objectSpread({},e[b]),{},{[c]:[_objectSpread(_objectSpread({},d),{},{lastActivityTime:Date.now()})]})}updateNestedField(a){let{visitorCode:b,key:c,nestedKey:d,value:e,data:f}=a;f[b][c][d]=_objectSpread(_objectSpread({},e),{},{lastActivityTime:Date.now()})}createNestedField(a){var b;let{visitorCode:c,key:d,nestedKey:e,value:f,data:g}=a;g[c]=null!==(b=g[c])&&void 0!==b&&b[d]?_objectSpread(_objectSpread({},g[c]),{},{[d]:_objectSpread(_objectSpread({},g[c][d]),{},{[e]:_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()})})}):_objectSpread(_objectSpread({},g[c]),{},{[d]:{[e]:_objectSpread(_objectSpread({},f),{},{lastActivityTime:Date.now()})}})}}exports.DataProcessor=DataProcessor;
|
|
2
2
|
//# sourceMappingURL=dataProcessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataProcessor.js","names":["DataProcessor","constructor","storage","_defineProperty","Set","updateData","visitorCode","dataItem","storageData","read","or","dereferencedData","dereferenceTargetingData","visitorReference","data","type","KameleoonData","CustomData","hasCustomDataKey","parameters","key","nestedKey","index","toString","value","updateNestedField","createNestedField","storedCustomDataIndexes","add","PageView","f","timestamps","length","Date","now","existingData","urlAddress","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","referrers","title","_objectSpread","Conversion","hasConversionDataKey","updateArrayField","createArrayField","VisitsData","hasVisitsKey","existingVisits","visits","visit","updateField","createField","hasDataKey","storedDataTypes","write","createReference","linkedVisitor","ok","getLinkedVisitor","visitorData","customData","cleanupOutdatedTargetingData","targetingCleanupInterval","targetingData","targetingDataLifetime","Milliseconds","Minute","DEFAULT_CLEANUP_INTERVAL","currentTime","Object","keys","kameleoonVisitorData","entries","pageView","conversion","rest","_objectWithoutProperties","_excluded","isDataExpired","lastActivityTime","delete","clear","url","splice","indexOf","getTargetingData","Err","error","Ok","referredVisitorCode","storedDataTypeList","storedCustomDataIndexList","a","push","b","exports"],"sources":["../../src/kameleoonData/dataProcessor.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { IStorage } from 'src/storage';\nimport {\n DereferencedTargetingDataType,\n TargetingDataType,\n VisitorReference,\n} from 'src/targeting';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport { Milliseconds } from 'src/types';\nimport { DEFAULT_CLEANUP_INTERVAL } from './constants';\nimport {\n ArrayFieldParametersType,\n ConversionDataType,\n CustomDataType,\n DereferenceTargetingDataResultType,\n ExistingArrayDataType,\n ExistingDataType,\n ExistingNestedDataType,\n ExistingPageViewDataType,\n ExistingVisitsDataType,\n FieldParametersType,\n KameleoonData,\n KameleoonDataType,\n KameleoonVisitorDataType,\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 createReference(visitorCode: string, linkedVisitor: VisitorReference): void;\n cleanupOutdatedTargetingData(targetingCleanupInterval?: number): void;\n getTargetingData(\n visitorCode: string,\n ): Result<KameleoonVisitorDataType | null, KameleoonError>;\n getLinkedVisitor(visitorCode: string, index: number): string | null;\n}\n\nexport class DataProcessor implements IDataProcessor {\n private storage: IStorage<TargetingDataType>;\n private storedDataTypes: Set<KameleoonData> = new Set([]);\n private storedCustomDataIndexes: Set<number> = new Set([]);\n\n constructor(storage: IStorage<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 storageData = this.storage.read().or({});\n const dereferencedData = this.dereferenceTargetingData(\n storageData,\n visitorCode,\n );\n const visitorReference = dereferencedData?.visitorReference || visitorCode;\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const data = dataItem.data as CustomDataType;\n const hasCustomDataKey =\n dereferencedData && KameleoonData.CustomData in dereferencedData.data;\n const parameters: NestedFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 // --- Note ---\n // Here we add CustomData index to storedCustomDataIndexes to later track if it is added to storage\n this.storedCustomDataIndexes.add(data.index);\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 dereferencedData &&\n KameleoonData.PageView in dereferencedData.data &&\n (dereferencedData.data[data.type] as ExistingPageViewDataType)?.[\n data.urlAddress\n ];\n\n const parameters: NestedFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 dereferencedData && KameleoonData.Conversion in dereferencedData.data;\n const parameters: ArrayFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 dereferencedData && KameleoonData.VisitsData in dereferencedData.data;\n const parameters: FieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\n key: KameleoonData.VisitsData,\n value: data,\n };\n\n // -- Change directly if `[key]` exists\n if (hasVisitsKey) {\n const existingVisits = dereferencedData.data[\n data.type\n ] as ExistingVisitsDataType;\n\n // --- Note ---\n // We are preserving the order of visits\n existingVisits.visits.forEach((visit) => {\n Utilities.insertInOrderedListMutably({\n list: data.visits,\n element: visit,\n order: Order.Ascending,\n });\n });\n\n this.updateField({\n ...parameters,\n value: {\n ...data,\n visits: data.visits,\n },\n });\n } else {\n this.createField(parameters);\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n const hasDataKey =\n dereferencedData && data.type in dereferencedData.data;\n const parameters: FieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 // --- Note ---\n // Here we add Browser, Device, Geolocation, OperatingSystem, KameleoonConversionScore to storedDataTypes\n // Later track if it is added to storage\n this.storedDataTypes.add(data.type);\n }\n }\n\n return this.storage.write(storageData);\n }\n\n public createReference(\n visitorCode: string,\n linkedVisitor: VisitorReference,\n ): void {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return;\n }\n\n // --- Note ---\n // Provided(linked) visitor is now pointing to the visitor code\n storageData.data[linkedVisitor] = visitorCode;\n\n this.storage.write(storageData.data);\n }\n\n public getLinkedVisitor(\n visitorCode: string,\n index: number | null,\n ): string | null {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return null;\n }\n\n if (typeof storageData.data[visitorCode] === 'string') {\n return storageData.data[visitorCode] as string;\n }\n\n if (index === null) {\n return null;\n }\n\n const visitorData = storageData.data[\n visitorCode\n ] as KameleoonVisitorDataType;\n\n if (!visitorData) {\n return null;\n }\n\n const customData = visitorData[KameleoonData.CustomData];\n\n if (customData && customData[index]) {\n return (customData[index] as CustomDataType).value[0];\n }\n\n return null;\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 if (typeof kameleoonVisitorData === 'string') {\n delete targetingData[visitorCode];\n continue;\n }\n\n const visitorData = kameleoonVisitorData;\n\n const { customData, pageView, conversion, ...rest } = visitorData;\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 = visitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n this.storedCustomDataIndexes.delete(Number(index));\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n this.storedCustomDataIndexes.clear();\n delete targetingData[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 = visitorData[KameleoonData.PageView];\n\n if (isDataExpired && existingData) {\n delete existingData[url];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete visitorData[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 = visitorData[KameleoonData.Conversion];\n\n if (isDataExpired && existingData) {\n existingData.splice(existingData.indexOf(dataItem), 1);\n }\n\n if (existingData && !existingData.length) {\n delete visitorData[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 visitorData[key as KameleoonData];\n this.storedDataTypes.delete(key as KameleoonData);\n }\n }\n\n if (!Object.keys(targetingData[visitorCode]).length) {\n this.storedDataTypes.clear();\n this.storedCustomDataIndexes.clear();\n delete targetingData[visitorCode];\n }\n }\n\n this.storage.write(targetingData);\n }\n\n public getTargetingData(\n visitorCode: string,\n ): Result<KameleoonVisitorDataType | null, KameleoonError> {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return Err(storageData.error);\n }\n\n const dereferencedData = this.dereferenceTargetingData(\n storageData.data,\n visitorCode,\n );\n\n if (!dereferencedData) {\n return Ok(null);\n }\n\n return Ok(dereferencedData.data);\n }\n\n private dereferenceTargetingData(\n data: TargetingDataType,\n visitorCode: string,\n ): DereferenceTargetingDataResultType | null {\n if (!data[visitorCode]) {\n return null;\n }\n\n // --- Note ---\n // Visitor reference can not refer to another visitor reference\n if (typeof data[visitorCode] === 'string') {\n const referredVisitorCode = data[visitorCode] as VisitorReference;\n\n return {\n data: data[referredVisitorCode] as KameleoonVisitorDataType,\n visitorReference: referredVisitorCode,\n };\n }\n\n return {\n data: data[visitorCode] as KameleoonVisitorDataType,\n visitorReference: visitorCode,\n };\n }\n\n get storedDataTypeList(): Set<KameleoonData> {\n return this.storedDataTypes;\n }\n\n get storedCustomDataIndexList(): Set<number> {\n return this.storedCustomDataIndexes;\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":"i4DA4CO,KAAM,CAAAA,aAAwC,CAKnDC,WAAWA,CAACC,CAAoC,CAAE,CAAAC,eAAA,wBAAAA,eAAA,wBAHJ,GAAI,CAAAC,GAAG,CAAC,EAAE,CAAC,EAAAD,eAAA,gCACV,GAAI,CAAAC,GAAG,CAAC,EAAE,CAAC,EAGxD,IAAI,CAACF,OAAO,CAAGA,CACjB,CAOOG,UAAUA,CACfC,CAAmB,CACnBC,CAA2B,CACG,MACxB,CAAAC,CAAW,CAAG,IAAI,CAACN,OAAO,CAACO,IAAI,CAAC,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,CACxCC,CAAgB,CAAG,IAAI,CAACC,wBAAwB,CACpDJ,CAAW,CACXF,CACF,CAAC,CACKO,CAAgB,CAAG,QAAAF,CAAgB,WAAhBA,CAAgB,QAAhBA,CAAgB,CAAEE,gBAAgB,GAAIP,CAAW,CAE1E,OAAQC,CAAQ,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CAAAA,aAAA,IAAQxB,CAAK,MAAE+D,gBAAgB,CAAEtD,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE,EACxD,GAAAc,aAAA,CAAAA,aAAA,IAXElC,CAAI,CAACR,CAAW,CAAC,MACpB,CAACc,CAAG,EAAG,CACL,CAACC,CAAS,EAAA2B,aAAA,CAAAA,aAAA,IAAQxB,CAAK,MAAE+D,gBAAgB,CAAEtD,IAAI,CAACC,GAAG,CAAC,CAAC,EACvD,CAAC,EAWP,CACF,CAACqE,OAAA,CAAAvG,aAAA,CAAAA,aAAA"}
|
|
1
|
+
{"version":3,"file":"dataProcessor.js","names":["DataProcessor","constructor","storage","_defineProperty","Set","updateData","visitorCode","dataItem","storageData","read","or","dereferencedData","dereferenceTargetingData","visitorReference","data","type","KameleoonData","CustomData","hasCustomDataKey","parameters","key","nestedKey","index","toString","value","updateNestedField","createNestedField","storedCustomDataIndexes","add","PageView","f","timestamps","length","Date","now","existingData","urlAddress","forEach","timestamp","Utilities","insertInOrderedListMutably","list","element","order","Order","Ascending","referrers","title","_objectSpread","Conversion","hasConversionDataKey","updateArrayField","createArrayField","VisitsData","hasVisitsKey","existingVisits","visits","visit","updateField","createField","hasDataKey","storedDataTypes","write","createReference","linkedVisitor","ok","getLinkedVisitor","visitorData","customData","cleanupTargetingData","cleanupInterval","targetingData","currentTime","Object","keys","kameleoonVisitorData","entries","pageView","conversion","rest","_objectWithoutProperties","_excluded","isDataExpired","lastActivityTime","delete","clear","url","splice","indexOf","getTargetingData","Err","error","Ok","referredVisitorCode","storedDataTypeList","storedCustomDataIndexList","a","push","b","exports"],"sources":["../../src/kameleoonData/dataProcessor.ts"],"sourcesContent":["import { Err, Ok, Result } from 'ts-res';\nimport { IStorage } from 'src/storage';\nimport {\n DereferencedTargetingDataType,\n TargetingDataType,\n VisitorReference,\n} from 'src/targeting';\nimport { KameleoonError } from 'src/kameleoonError';\nimport { Utilities } from 'src/utilities';\nimport { Order } from 'src/utilities/types';\nimport {\n ArrayFieldParametersType,\n ConversionDataType,\n CustomDataType,\n DereferenceTargetingDataResultType,\n ExistingArrayDataType,\n ExistingDataType,\n ExistingNestedDataType,\n ExistingPageViewDataType,\n ExistingVisitsDataType,\n FieldParametersType,\n KameleoonData,\n KameleoonDataType,\n KameleoonVisitorDataType,\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 createReference(visitorCode: string, linkedVisitor: VisitorReference): void;\n cleanupTargetingData(targetingCleanupInterval?: number): void;\n getTargetingData(\n visitorCode: string,\n ): Result<KameleoonVisitorDataType | null, KameleoonError>;\n getLinkedVisitor(visitorCode: string, index: number): string | null;\n}\n\nexport class DataProcessor implements IDataProcessor {\n private storage: IStorage<TargetingDataType>;\n private storedDataTypes: Set<KameleoonData> = new Set([]);\n private storedCustomDataIndexes: Set<number> = new Set([]);\n\n constructor(storage: IStorage<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 storageData = this.storage.read().or({});\n const dereferencedData = this.dereferenceTargetingData(\n storageData,\n visitorCode,\n );\n const visitorReference = dereferencedData?.visitorReference || visitorCode;\n\n switch (dataItem.data.type) {\n case KameleoonData.CustomData: {\n const data = dataItem.data as CustomDataType;\n const hasCustomDataKey =\n dereferencedData && KameleoonData.CustomData in dereferencedData.data;\n const parameters: NestedFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 // --- Note ---\n // Here we add CustomData index to storedCustomDataIndexes to later track if it is added to storage\n this.storedCustomDataIndexes.add(data.index);\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 dereferencedData &&\n KameleoonData.PageView in dereferencedData.data &&\n (dereferencedData.data[data.type] as ExistingPageViewDataType)?.[\n data.urlAddress\n ];\n\n const parameters: NestedFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 dereferencedData && KameleoonData.Conversion in dereferencedData.data;\n const parameters: ArrayFieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 dereferencedData && KameleoonData.VisitsData in dereferencedData.data;\n const parameters: FieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\n key: KameleoonData.VisitsData,\n value: data,\n };\n\n // -- Change directly if `[key]` exists\n if (hasVisitsKey) {\n const existingVisits = dereferencedData.data[\n data.type\n ] as ExistingVisitsDataType;\n\n // --- Note ---\n // We are preserving the order of visits\n existingVisits.visits.forEach((visit) => {\n Utilities.insertInOrderedListMutably({\n list: data.visits,\n element: visit,\n order: Order.Ascending,\n });\n });\n\n this.updateField({\n ...parameters,\n value: {\n ...data,\n visits: data.visits,\n },\n });\n } else {\n this.createField(parameters);\n }\n\n break;\n }\n default: {\n const { data } = dataItem;\n const hasDataKey =\n dereferencedData && data.type in dereferencedData.data;\n const parameters: FieldParametersType = {\n visitorCode: visitorReference,\n data: storageData as DereferencedTargetingDataType,\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 // --- Note ---\n // Here we add Browser, Device, Geolocation, OperatingSystem, KameleoonConversionScore to storedDataTypes\n // Later track if it is added to storage\n this.storedDataTypes.add(data.type);\n }\n }\n\n return this.storage.write(storageData);\n }\n\n public createReference(\n visitorCode: string,\n linkedVisitor: VisitorReference,\n ): void {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return;\n }\n\n // --- Note ---\n // Provided(linked) visitor is now pointing to the visitor code\n storageData.data[linkedVisitor] = visitorCode;\n\n this.storage.write(storageData.data);\n }\n\n public getLinkedVisitor(\n visitorCode: string,\n index: number | null,\n ): string | null {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return null;\n }\n\n if (typeof storageData.data[visitorCode] === 'string') {\n return storageData.data[visitorCode] as string;\n }\n\n if (index === null) {\n return null;\n }\n\n const visitorData = storageData.data[\n visitorCode\n ] as KameleoonVisitorDataType;\n\n if (!visitorData) {\n return null;\n }\n\n const customData = visitorData[KameleoonData.CustomData];\n\n if (customData && customData[index]) {\n return (customData[index] as CustomDataType).value[0];\n }\n\n return null;\n }\n\n public cleanupTargetingData(cleanupInterval: number): void {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return;\n }\n\n const targetingData = storageData.data;\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 if (typeof kameleoonVisitorData === 'string') {\n delete targetingData[visitorCode];\n continue;\n }\n\n const visitorData = kameleoonVisitorData;\n\n const { customData, pageView, conversion, ...rest } = visitorData;\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 + cleanupInterval < currentTime;\n const existingData = visitorData[KameleoonData.CustomData];\n\n if (isDataExpired && existingData) {\n this.storedCustomDataIndexes.delete(Number(index));\n delete existingData[Number(index)];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n this.storedCustomDataIndexes.clear();\n delete targetingData[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 + cleanupInterval < currentTime;\n const existingData = visitorData[KameleoonData.PageView];\n\n if (isDataExpired && existingData) {\n delete existingData[url];\n }\n\n if (existingData && !Object.keys(existingData).length) {\n delete visitorData[KameleoonData.PageView];\n }\n }\n }\n\n if (conversion) {\n for (const dataItem of conversion) {\n const isDataExpired =\n dataItem.lastActivityTime + cleanupInterval < currentTime;\n const existingData = visitorData[KameleoonData.Conversion];\n\n if (isDataExpired && existingData) {\n existingData.splice(existingData.indexOf(dataItem), 1);\n }\n\n if (existingData && !existingData.length) {\n delete visitorData[KameleoonData.Conversion];\n }\n }\n }\n\n for (const [key, dataItem] of Object.entries(rest)) {\n const isDataExpired =\n dataItem.lastActivityTime + cleanupInterval < currentTime;\n\n if (isDataExpired) {\n delete visitorData[key as KameleoonData];\n this.storedDataTypes.delete(key as KameleoonData);\n }\n }\n\n if (!Object.keys(targetingData[visitorCode]).length) {\n this.storedDataTypes.clear();\n this.storedCustomDataIndexes.clear();\n delete targetingData[visitorCode];\n }\n }\n\n this.storage.write(targetingData);\n }\n\n public getTargetingData(\n visitorCode: string,\n ): Result<KameleoonVisitorDataType | null, KameleoonError> {\n const storageData = this.storage.read();\n\n if (!storageData.ok) {\n return Err(storageData.error);\n }\n\n // TODO: when visitor session is introduced:\n // We can do extra cleanup here to avoid too long data lifetime\n // For now it's too expensive to check each data item on\n // ech data read\n\n const dereferencedData = this.dereferenceTargetingData(\n storageData.data,\n visitorCode,\n );\n\n if (!dereferencedData) {\n return Ok(null);\n }\n\n return Ok(dereferencedData.data);\n }\n\n private dereferenceTargetingData(\n data: TargetingDataType,\n visitorCode: string,\n ): DereferenceTargetingDataResultType | null {\n if (!data[visitorCode]) {\n return null;\n }\n\n // --- Note ---\n // Visitor reference can not refer to another visitor reference\n if (typeof data[visitorCode] === 'string') {\n const referredVisitorCode = data[visitorCode] as VisitorReference;\n\n return {\n data: data[referredVisitorCode] as KameleoonVisitorDataType,\n visitorReference: referredVisitorCode,\n };\n }\n\n return {\n data: data[visitorCode] as KameleoonVisitorDataType,\n visitorReference: visitorCode,\n };\n }\n\n get storedDataTypeList(): Set<KameleoonData> {\n return this.storedDataTypes;\n }\n\n get storedCustomDataIndexList(): Set<number> {\n return this.storedCustomDataIndexes;\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":"m0DA0CO,KAAM,CAAAA,aAAwC,CAKnDC,WAAWA,CAACC,CAAoC,CAAE,CAAAC,eAAA,wBAAAA,eAAA,wBAHJ,GAAI,CAAAC,GAAG,CAAC,EAAE,CAAC,EAAAD,eAAA,gCACV,GAAI,CAAAC,GAAG,CAAC,EAAE,CAAC,EAGxD,IAAI,CAACF,OAAO,CAAGA,CACjB,CAOOG,UAAUA,CACfC,CAAmB,CACnBC,CAA2B,CACG,MACxB,CAAAC,CAAW,CAAG,IAAI,CAACN,OAAO,CAACO,IAAI,CAAC,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,CACxCC,CAAgB,CAAG,IAAI,CAACC,wBAAwB,CACpDJ,CAAW,CACXF,CACF,CAAC,CACKO,CAAgB,CAAG,QAAAF,CAAgB,WAAhBA,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ACC,GAAG,CAAC,CAAC,EAAE,EACxD,GAAAc,aAAA,CAAAA,aAAA,IAXElC,CAAI,CAACR,CAAW,CAAC,MACpB,CAACc,CAAG,EAAG,CACL,CAACC,CAAS,EAAA2B,aAAA,CAAAA,aAAA,IAAQxB,CAAK,MAAE2D,gBAAgB,CAAElD,IAAI,CAACC,GAAG,CAAC,CAAC,EACvD,CAAC,EAWP,CACF,CAACiE,OAAA,CAAAnG,aAAA,CAAAA,aAAA"}
|
|
@@ -10,6 +10,5 @@ export { OperatingSystem } from './operatingSystem';
|
|
|
10
10
|
export { ApplicationVersion } from './applicationVersion';
|
|
11
11
|
export { VisitsData } from './visitsData';
|
|
12
12
|
export { KameleoonConversionScore } from './kameleoonConversionScore';
|
|
13
|
-
export { DEFAULT_CLEANUP_INTERVAL } from './constants';
|
|
14
13
|
export { DeviceType, CookieType, VisitsDataType, BrowserType, KameleoonData, DeviceDataType, CustomDataType, BrowserDataType, BrowserIndexMap, PageViewDataType, KameleoonDataType, UserAgentDataType, ConversionDataType, OperatingSystemType, GeolocationInfoType, KameleoonDataItemType, PageViewParametersType, ConversionParametersType, ApplicationVersionDataType, } from './types';
|
|
15
14
|
export { DataManager } from './dataManager';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _applicationVersion.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _types.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"BrowserDataType",{enumerable:!0,get:function(){return _types.BrowserDataType}}),Object.defineProperty(exports,"BrowserIndexMap",{enumerable:!0,get:function(){return _types.BrowserIndexMap}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _types.BrowserType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"ConversionDataType",{enumerable:!0,get:function(){return _types.ConversionDataType}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _types.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _types.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"CustomDataType",{enumerable:!0,get:function(){return _types.CustomDataType}}),Object.defineProperty(exports,"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _applicationVersion.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _types.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _browser.Browser}}),Object.defineProperty(exports,"BrowserDataType",{enumerable:!0,get:function(){return _types.BrowserDataType}}),Object.defineProperty(exports,"BrowserIndexMap",{enumerable:!0,get:function(){return _types.BrowserIndexMap}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _types.BrowserType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _conversion.Conversion}}),Object.defineProperty(exports,"ConversionDataType",{enumerable:!0,get:function(){return _types.ConversionDataType}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _types.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _cookie.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _types.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _customData.CustomData}}),Object.defineProperty(exports,"CustomDataType",{enumerable:!0,get:function(){return _types.CustomDataType}}),Object.defineProperty(exports,"DataManager",{enumerable:!0,get:function(){return _dataManager.DataManager}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _device.Device}}),Object.defineProperty(exports,"DeviceDataType",{enumerable:!0,get:function(){return _types.DeviceDataType}}),Object.defineProperty(exports,"DeviceType",{enumerable:!0,get:function(){return _types.DeviceType}}),Object.defineProperty(exports,"GeolocationData",{enumerable:!0,get:function(){return _geolocation.GeolocationData}}),Object.defineProperty(exports,"GeolocationInfoType",{enumerable:!0,get:function(){return _types.GeolocationInfoType}}),Object.defineProperty(exports,"KameleoonConversionScore",{enumerable:!0,get:function(){return _kameleoonConversionScore.KameleoonConversionScore}}),Object.defineProperty(exports,"KameleoonData",{enumerable:!0,get:function(){return _types.KameleoonData}}),Object.defineProperty(exports,"KameleoonDataItemType",{enumerable:!0,get:function(){return _types.KameleoonDataItemType}}),Object.defineProperty(exports,"KameleoonDataType",{enumerable:!0,get:function(){return _types.KameleoonDataType}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _operatingSystem.OperatingSystem}}),Object.defineProperty(exports,"OperatingSystemType",{enumerable:!0,get:function(){return _types.OperatingSystemType}}),Object.defineProperty(exports,"PageView",{enumerable:!0,get:function(){return _pageView.PageView}}),Object.defineProperty(exports,"PageViewDataType",{enumerable:!0,get:function(){return _types.PageViewDataType}}),Object.defineProperty(exports,"PageViewParametersType",{enumerable:!0,get:function(){return _types.PageViewParametersType}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return _userAgent.UserAgent}}),Object.defineProperty(exports,"UserAgentDataType",{enumerable:!0,get:function(){return _types.UserAgentDataType}}),Object.defineProperty(exports,"VisitsData",{enumerable:!0,get:function(){return _visitsData.VisitsData}}),Object.defineProperty(exports,"VisitsDataType",{enumerable:!0,get:function(){return _types.VisitsDataType}});var _device=require("./device"),_cookie=require("./cookie"),_browser=require("./browser"),_pageView=require("./pageView"),_userAgent=require("./userAgent"),_customData=require("./customData"),_conversion=require("./conversion"),_geolocation=require("./geolocation"),_operatingSystem=require("./operatingSystem"),_applicationVersion=require("./applicationVersion"),_visitsData=require("./visitsData"),_kameleoonConversionScore=require("./kameleoonConversionScore"),_types=require("./types"),_dataManager=require("./dataManager");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/kameleoonData/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { Cookie } from './cookie';\nexport { Browser } from './browser';\nexport { PageView } from './pageView';\nexport { UserAgent } from './userAgent';\nexport { CustomData } from './customData';\nexport { Conversion } from './conversion';\nexport { GeolocationData } from './geolocation';\nexport { OperatingSystem } from './operatingSystem';\nexport { ApplicationVersion } from './applicationVersion';\nexport { VisitsData } from './visitsData';\nexport { KameleoonConversionScore } from './kameleoonConversionScore';\nexport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/kameleoonData/index.ts"],"sourcesContent":["export { Device } from './device';\nexport { Cookie } from './cookie';\nexport { Browser } from './browser';\nexport { PageView } from './pageView';\nexport { UserAgent } from './userAgent';\nexport { CustomData } from './customData';\nexport { Conversion } from './conversion';\nexport { GeolocationData } from './geolocation';\nexport { OperatingSystem } from './operatingSystem';\nexport { ApplicationVersion } from './applicationVersion';\nexport { VisitsData } from './visitsData';\nexport { KameleoonConversionScore } from './kameleoonConversionScore';\nexport {\n DeviceType,\n CookieType,\n VisitsDataType,\n BrowserType,\n KameleoonData,\n DeviceDataType,\n CustomDataType,\n BrowserDataType,\n BrowserIndexMap,\n PageViewDataType,\n KameleoonDataType,\n UserAgentDataType,\n ConversionDataType,\n OperatingSystemType,\n GeolocationInfoType,\n KameleoonDataItemType,\n PageViewParametersType,\n ConversionParametersType,\n ApplicationVersionDataType,\n} from './types';\nexport { DataManager } from './dataManager';\n"],"mappings":""}
|
|
@@ -29,7 +29,7 @@ export type DereferenceTargetingDataResultType = {
|
|
|
29
29
|
visitorReference: string;
|
|
30
30
|
};
|
|
31
31
|
export type DataManagerParametersType = {
|
|
32
|
-
|
|
32
|
+
cleanupInterval: number | null;
|
|
33
33
|
storage: IStorage<TargetingDataType>;
|
|
34
34
|
};
|
|
35
35
|
export type KameleoonDataItemType = BrowserDataType | ConversionDataType | CustomDataType | DeviceDataType | PageViewDataType | UserAgentDataType | CookieDataType | GeolocationDataType | OperatingSystemDataType | ApplicationVersionDataType | KCSDataType | VisitsDataType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["_helpers","require","Object","defineProperty","exports","value","OperatingSystemTypeMap","OperatingSystemType","OperatingSystemIndexMap","KameleoonData","DeviceType","BrowserTypeMap","BrowserType","BrowserIndexMap","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","KameleoonConversionScore","Phone","Tablet","Desktop","WindowsPhone","Windows","Android","Linux","Mac","IOS","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","constructTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import {\n DereferencedTargetingDataType,\n TargetingDataType,\n} from 'src/targeting';\nimport { FeatureFlagVariationsType, IStorage } from 'src/storage';\nimport {\n Browser,\n Conversion,\n Cookie,\n CustomData,\n Device,\n GeolocationData,\n OperatingSystem,\n PageView,\n UserAgent,\n ApplicationVersion,\n VisitsData,\n KameleoonConversionScore,\n} from 'src/kameleoonData';\nimport { constructTypeMap } from './helpers';\n\n// --- Note ---\n// -- `Conversion`s are stored by `KameleoonData.Conversion` key in a form of an `KameleoonDataType[]` array\n// -- `PageView`s are store by `timestamp` (number) key in a form of `KameleoonDataType`\n// -- All the other unsent data types are stored in a form of `KameleoonData` key and `KameleoonDataType` value\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType | KameleoonDataType[]\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type FieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value:\n | BrowserDataType\n | CookieDataType\n | DeviceDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | UserAgentDataType\n | VisitsDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type ArrayFieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value: ConversionDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type NestedFieldParametersType = {\n visitorCode: string;\n key: KameleoonData.CustomData | KameleoonData.PageView;\n nestedKey: string;\n value: CustomDataType | PageViewDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type DereferenceTargetingDataResultType = {\n data: KameleoonVisitorDataType;\n visitorReference: string;\n};\n\nexport type DataManagerParametersType = {\n targetingCleanupInterval?: number;\n storage: IStorage<TargetingDataType>;\n};\n\nexport type KameleoonDataItemType =\n | BrowserDataType\n | ConversionDataType\n | CustomDataType\n | DeviceDataType\n | PageViewDataType\n | UserAgentDataType\n | CookieDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | ApplicationVersionDataType\n | KCSDataType\n | VisitsDataType;\n\n/**\n * @interface an interface of KameleoonData\n * each class instance will have url getter method\n * for handling url of different data types\n * */\nexport interface IKameleoonData {\n /**\n * @property url - url for the current data type used for events tracking\n * */\n readonly url: string;\n /**\n * @property data - data of the current class instance\n * */\n readonly data: KameleoonDataItemType;\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\n isSent: boolean;\n}\n\n/**\n * @type a tuple of each possible type of data for `addData` method\n * of KameleoonClient\n * */\nexport type KameleoonDataType =\n | Browser\n | Conversion\n | CustomData\n | Device\n | PageView\n | UserAgent\n | VisitsData\n | GeolocationData\n | OperatingSystem\n | Cookie\n | ApplicationVersion\n | KameleoonConversionScore;\n\nexport type ActivityTimePropertyType = {\n lastActivityTime: number;\n};\n\nexport type ExistingCustomDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.CustomData]\n>;\n\nexport type ExistingPageViewDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.PageView]\n>;\n\nexport type ExistingNestedDataType =\n | ExistingCustomDataType\n | ExistingPageViewDataType;\n\nexport type ExistingArrayDataType = ExistingConversionDataType;\n\nexport type ExistingConversionDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.Conversion]\n>;\n\nexport type ExistingVisitsDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.VisitsData]\n>;\n\nexport type ExistingDataType<T extends KameleoonData> = NonNullable<\n KameleoonVisitorDataType[T]\n>;\n\nexport type KameleoonVisitorDataType<T = ActivityTimePropertyType> = {\n [KameleoonData.CustomData]?: {\n [index: string]: (CustomDataType & T) | undefined;\n };\n [KameleoonData.Conversion]?: (ConversionDataType & T)[];\n [KameleoonData.GeolocationData]?: GeolocationDataType & T;\n [KameleoonData.UserAgent]?: UserAgentDataType & T;\n [KameleoonData.PageView]?: { [url: string]: PageViewDataType & T };\n [KameleoonData.Browser]?: BrowserDataType & T;\n [KameleoonData.Device]?: DeviceDataType & T;\n [KameleoonData.Cookie]?: CookieDataType & T;\n [KameleoonData.KameleoonConversionScore]?: KCSDataType & T;\n [KameleoonData.OperatingSystem]?: OperatingSystemDataType & T;\n [KameleoonData.ApplicationVersion]?: ApplicationVersionDataType & T;\n [KameleoonData.VisitsData]?: VisitsDataType & T;\n};\n\nexport enum KameleoonData {\n CustomData = 'customData',\n PageView = 'pageView',\n GeolocationData = 'geolocation',\n Browser = 'browser',\n Conversion = 'conversion',\n Cookie = 'cookie',\n Device = 'device',\n OperatingSystem = 'operatingSystem',\n UserAgent = 'userAgent',\n ApplicationVersion = 'applicationVersion',\n VisitsData = 'visitsData',\n KameleoonConversionScore = 'kameleoonConversionScore',\n}\n\ntype SharedDataPropertiesType = {\n type: KameleoonData;\n sent: boolean;\n};\n\nexport type BrowserDataType = {\n browser: BrowserType;\n version?: number;\n} & SharedDataPropertiesType;\n\nexport type ConversionDataType = {\n goalId: number;\n revenue: number;\n negative: boolean;\n} & SharedDataPropertiesType;\n\nexport type CustomDataType = {\n index: number;\n value: string[];\n isIdentifier: boolean;\n} & SharedDataPropertiesType;\n\nexport type DeviceDataType = {\n device: DeviceType;\n} & SharedDataPropertiesType;\n\nexport type KCSDataType = {\n kcs: KCSType;\n} & SharedDataPropertiesType;\n\nexport type VisitsDataType = {\n visits: number[];\n} & SharedDataPropertiesType;\n\nexport type OperatingSystemDataType = {\n operatingSystem: OperatingSystemType;\n} & SharedDataPropertiesType;\n\nexport type CookieDataType = {\n cookie: CookieType[];\n} & SharedDataPropertiesType;\n\nexport type GeolocationDataType = GeolocationInfoType &\n SharedDataPropertiesType;\n\nexport type PageViewDataType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n timestamps: number[];\n} & SharedDataPropertiesType;\n\nexport type UserAgentDataType = {\n value: string;\n} & SharedDataPropertiesType;\n\nexport type ApplicationVersionDataType = {\n version: string;\n} & SharedDataPropertiesType;\n\n/**\n * @param {number} goalId - an id of a goal to track\n * @param {number | undefined} revenue - an optional parameter for revenue, default value is `0`\n * @param {boolean | undefined} negative - an optional parameter identifying whether the conversion should be removed, default value is `false`\n * */\nexport type ConversionParametersType = {\n goalId: number;\n revenue?: number;\n negative?: boolean;\n};\n\n/**\n * @param {string} urlAddress - url address of the page to track\n * @param {string} title - title of the web page\n * @param {number[] | undefined} referrers - an optional parameter containing a list of referrersIndices, has no default value\n * */\nexport type PageViewParametersType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for device type\n * */\nexport enum DeviceType {\n Phone = 'PHONE',\n Tablet = 'TABLET',\n Desktop = 'DESKTOP',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for operating system type\n * */\nexport enum OperatingSystemType {\n WindowsPhone = 'WINDOWS_PHONE',\n Windows = 'WINDOWS',\n Android = 'ANDROID',\n Linux = 'LINUX',\n Mac = 'MAC',\n IOS = 'IOS',\n}\n\n/**\n * @param {string} country - a country of a visitor\n * @param {string | undefined} region - an optional parameter containing a region of a visitor, has no default value\n * @param {string | undefined} city - an optional parameter containing a city of a visitor, has no default value\n * @param {string | undefined} postalCode - an optional parameter containing a postal code of a visitor, has no default value\n * @param {[number, number] | undefined} coordinates - an optional parameter containing a pair of coordinates (longitude and latitude) of a visitor, has no default value. Coordinate `number` represents decimal degrees (double that can be negative)\n * */\nexport type GeolocationInfoType = {\n country: string;\n region?: string;\n city?: string;\n postalCode?: string;\n coordinates?: [number, number];\n};\n\n/**\n * @param {string} key - a key of a cookie\n * @param {string} value - a value of a cookie\n * */\nexport type CookieType = {\n key: string;\n value: string;\n};\n\n/**\n * @type Nested object of key moments and goals with their respective scores\n * */\nexport type KCSType = {\n [keyMoment: string]: {\n [goalId: string]: number;\n };\n};\n\nexport type OptionalCookieType = Omit<CookieType, 'key'> & {\n key?: string;\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for browser type\n * */\nexport enum BrowserType {\n Chrome = 'CHROME',\n InternetExplorer = 'IE',\n Firefox = 'FIREFOX',\n Safari = 'SAFARI',\n Opera = 'OPERA',\n Other = 'OTHER',\n}\n\nexport const OperatingSystemIndexMap = {\n [OperatingSystemType.Windows]: 0,\n [OperatingSystemType.Mac]: 1,\n [OperatingSystemType.IOS]: 2,\n [OperatingSystemType.Linux]: 3,\n [OperatingSystemType.Android]: 4,\n [OperatingSystemType.WindowsPhone]: 5,\n} as const;\n\nexport const OperatingSystemTypeMap = constructTypeMap<OperatingSystemType>(\n OperatingSystemIndexMap,\n);\n\nexport const BrowserIndexMap = {\n [BrowserType.Chrome]: 0,\n [BrowserType.InternetExplorer]: 1,\n [BrowserType.Firefox]: 2,\n [BrowserType.Safari]: 3,\n [BrowserType.Opera]: 4,\n [BrowserType.Other]: 5,\n} as const;\n\nexport const BrowserTypeMap = constructTypeMap<BrowserType>(BrowserIndexMap);\n\nexport type SingleDataType = {\n [KameleoonData.Device]: Device | null;\n [KameleoonData.Browser]: Browser | null;\n [KameleoonData.GeolocationData]: GeolocationData | null;\n [KameleoonData.OperatingSystem]: OperatingSystem | null;\n [KameleoonData.KameleoonConversionScore]: KameleoonConversionScore | null;\n};\n\nexport type MultipleDataType = {\n [KameleoonData.CustomData]: Map<number, CustomData>;\n [KameleoonData.PageView]: Map<string, PageView>;\n [KameleoonData.Conversion]: Map<number, Conversion>;\n};\n\nexport type VisitProcessorDataType = {\n visitorData: KameleoonDataType[];\n storageVisitorData: KameleoonDataType[];\n visitsData: VisitsData;\n experimentData: FeatureFlagVariationsType;\n};\n"],"mappings":"aAmBA,IAAAA,QAAA,CAAAC,OAAA,cAA6CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,sBAAA,CAAAF,OAAA,CAAAG,mBAAA,CAAAH,OAAA,CAAAI,uBAAA,CAAAJ,OAAA,CAAAK,aAAA,CAAAL,OAAA,CAAAM,UAAA,CAAAN,OAAA,CAAAO,cAAA,CAAAP,OAAA,CAAAQ,WAAA,CAAAR,OAAA,CAAAS,eAAA,WAyJjC,CAAAJ,aAAa,CAAAL,OAAA,CAAAK,aAAA,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAK,UAAA,cAAbL,CAAa,CAAAM,QAAA,YAAbN,CAAa,CAAAO,eAAA,eAAbP,CAAa,CAAAQ,OAAA,WAAbR,CAAa,CAAAS,UAAA,cAAbT,CAAa,CAAAU,MAAA,UAAbV,CAAa,CAAAW,MAAA,UAAbX,CAAa,CAAAY,eAAA,mBAAbZ,CAAa,CAAAa,SAAA,aAAbb,CAAa,CAAAc,kBAAA,sBAAbd,CAAa,CAAAe,UAAA,cAAbf,CAAa,CAAAgB,wBAAA,4BAAbhB,CAAa,MAqGbC,UAAU,CAAAN,OAAA,CAAAM,UAAA,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAAgB,KAAA,SAAVhB,CAAU,CAAAiB,MAAA,UAAVjB,CAAU,CAAAkB,OAAA,WAAVlB,CAAU,MAUVH,mBAAmB,CAAAH,OAAA,CAAAG,mBAAA,UAAnBA,CAAmB,QAAnB,CAAAA,CAAmB,CAAAsB,YAAA,iBAAnBtB,C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B,yBAAgB,EAAc5B,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["_helpers","require","Object","defineProperty","exports","value","OperatingSystemTypeMap","OperatingSystemType","OperatingSystemIndexMap","KameleoonData","DeviceType","BrowserTypeMap","BrowserType","BrowserIndexMap","CustomData","PageView","GeolocationData","Browser","Conversion","Cookie","Device","OperatingSystem","UserAgent","ApplicationVersion","VisitsData","KameleoonConversionScore","Phone","Tablet","Desktop","WindowsPhone","Windows","Android","Linux","Mac","IOS","Chrome","InternetExplorer","Firefox","Safari","Opera","Other","constructTypeMap"],"sources":["../../src/kameleoonData/types.ts"],"sourcesContent":["import {\n DereferencedTargetingDataType,\n TargetingDataType,\n} from 'src/targeting';\nimport { FeatureFlagVariationsType, IStorage } from 'src/storage';\nimport {\n Browser,\n Conversion,\n Cookie,\n CustomData,\n Device,\n GeolocationData,\n OperatingSystem,\n PageView,\n UserAgent,\n ApplicationVersion,\n VisitsData,\n KameleoonConversionScore,\n} from 'src/kameleoonData';\nimport { constructTypeMap } from './helpers';\n\n// --- Note ---\n// -- `Conversion`s are stored by `KameleoonData.Conversion` key in a form of an `KameleoonDataType[]` array\n// -- `PageView`s are store by `timestamp` (number) key in a form of `KameleoonDataType`\n// -- All the other unsent data types are stored in a form of `KameleoonData` key and `KameleoonDataType` value\nexport type UnsentVisitorTargetingDataType = Map<\n KameleoonData | number,\n KameleoonDataType | KameleoonDataType[]\n>;\n\nexport type UnsentTargetingDataType = {\n [visitorCode: string]: UnsentVisitorTargetingDataType | undefined;\n};\n\nexport type FieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value:\n | BrowserDataType\n | CookieDataType\n | DeviceDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | UserAgentDataType\n | VisitsDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type ArrayFieldParametersType = {\n visitorCode: string;\n key: KameleoonData;\n value: ConversionDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type NestedFieldParametersType = {\n visitorCode: string;\n key: KameleoonData.CustomData | KameleoonData.PageView;\n nestedKey: string;\n value: CustomDataType | PageViewDataType;\n data: DereferencedTargetingDataType;\n};\n\nexport type DereferenceTargetingDataResultType = {\n data: KameleoonVisitorDataType;\n visitorReference: string;\n};\n\nexport type DataManagerParametersType = {\n cleanupInterval: number | null;\n storage: IStorage<TargetingDataType>;\n};\n\nexport type KameleoonDataItemType =\n | BrowserDataType\n | ConversionDataType\n | CustomDataType\n | DeviceDataType\n | PageViewDataType\n | UserAgentDataType\n | CookieDataType\n | GeolocationDataType\n | OperatingSystemDataType\n | ApplicationVersionDataType\n | KCSDataType\n | VisitsDataType;\n\n/**\n * @interface an interface of KameleoonData\n * each class instance will have url getter method\n * for handling url of different data types\n * */\nexport interface IKameleoonData {\n /**\n * @property url - url for the current data type used for events tracking\n * */\n readonly url: string;\n /**\n * @property data - data of the current class instance\n * */\n readonly data: KameleoonDataItemType;\n /**\n * @property isSent - signifying if the data was sent already tracked\n * */\n isSent: boolean;\n}\n\n/**\n * @type a tuple of each possible type of data for `addData` method\n * of KameleoonClient\n * */\nexport type KameleoonDataType =\n | Browser\n | Conversion\n | CustomData\n | Device\n | PageView\n | UserAgent\n | VisitsData\n | GeolocationData\n | OperatingSystem\n | Cookie\n | ApplicationVersion\n | KameleoonConversionScore;\n\nexport type ActivityTimePropertyType = {\n lastActivityTime: number;\n};\n\nexport type ExistingCustomDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.CustomData]\n>;\n\nexport type ExistingPageViewDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.PageView]\n>;\n\nexport type ExistingNestedDataType =\n | ExistingCustomDataType\n | ExistingPageViewDataType;\n\nexport type ExistingArrayDataType = ExistingConversionDataType;\n\nexport type ExistingConversionDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.Conversion]\n>;\n\nexport type ExistingVisitsDataType = NonNullable<\n KameleoonVisitorDataType[KameleoonData.VisitsData]\n>;\n\nexport type ExistingDataType<T extends KameleoonData> = NonNullable<\n KameleoonVisitorDataType[T]\n>;\n\nexport type KameleoonVisitorDataType<T = ActivityTimePropertyType> = {\n [KameleoonData.CustomData]?: {\n [index: string]: (CustomDataType & T) | undefined;\n };\n [KameleoonData.Conversion]?: (ConversionDataType & T)[];\n [KameleoonData.GeolocationData]?: GeolocationDataType & T;\n [KameleoonData.UserAgent]?: UserAgentDataType & T;\n [KameleoonData.PageView]?: { [url: string]: PageViewDataType & T };\n [KameleoonData.Browser]?: BrowserDataType & T;\n [KameleoonData.Device]?: DeviceDataType & T;\n [KameleoonData.Cookie]?: CookieDataType & T;\n [KameleoonData.KameleoonConversionScore]?: KCSDataType & T;\n [KameleoonData.OperatingSystem]?: OperatingSystemDataType & T;\n [KameleoonData.ApplicationVersion]?: ApplicationVersionDataType & T;\n [KameleoonData.VisitsData]?: VisitsDataType & T;\n};\n\nexport enum KameleoonData {\n CustomData = 'customData',\n PageView = 'pageView',\n GeolocationData = 'geolocation',\n Browser = 'browser',\n Conversion = 'conversion',\n Cookie = 'cookie',\n Device = 'device',\n OperatingSystem = 'operatingSystem',\n UserAgent = 'userAgent',\n ApplicationVersion = 'applicationVersion',\n VisitsData = 'visitsData',\n KameleoonConversionScore = 'kameleoonConversionScore',\n}\n\ntype SharedDataPropertiesType = {\n type: KameleoonData;\n sent: boolean;\n};\n\nexport type BrowserDataType = {\n browser: BrowserType;\n version?: number;\n} & SharedDataPropertiesType;\n\nexport type ConversionDataType = {\n goalId: number;\n revenue: number;\n negative: boolean;\n} & SharedDataPropertiesType;\n\nexport type CustomDataType = {\n index: number;\n value: string[];\n isIdentifier: boolean;\n} & SharedDataPropertiesType;\n\nexport type DeviceDataType = {\n device: DeviceType;\n} & SharedDataPropertiesType;\n\nexport type KCSDataType = {\n kcs: KCSType;\n} & SharedDataPropertiesType;\n\nexport type VisitsDataType = {\n visits: number[];\n} & SharedDataPropertiesType;\n\nexport type OperatingSystemDataType = {\n operatingSystem: OperatingSystemType;\n} & SharedDataPropertiesType;\n\nexport type CookieDataType = {\n cookie: CookieType[];\n} & SharedDataPropertiesType;\n\nexport type GeolocationDataType = GeolocationInfoType &\n SharedDataPropertiesType;\n\nexport type PageViewDataType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n timestamps: number[];\n} & SharedDataPropertiesType;\n\nexport type UserAgentDataType = {\n value: string;\n} & SharedDataPropertiesType;\n\nexport type ApplicationVersionDataType = {\n version: string;\n} & SharedDataPropertiesType;\n\n/**\n * @param {number} goalId - an id of a goal to track\n * @param {number | undefined} revenue - an optional parameter for revenue, default value is `0`\n * @param {boolean | undefined} negative - an optional parameter identifying whether the conversion should be removed, default value is `false`\n * */\nexport type ConversionParametersType = {\n goalId: number;\n revenue?: number;\n negative?: boolean;\n};\n\n/**\n * @param {string} urlAddress - url address of the page to track\n * @param {string} title - title of the web page\n * @param {number[] | undefined} referrers - an optional parameter containing a list of referrersIndices, has no default value\n * */\nexport type PageViewParametersType = {\n urlAddress: string;\n title: string;\n referrers?: number[];\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for device type\n * */\nexport enum DeviceType {\n Phone = 'PHONE',\n Tablet = 'TABLET',\n Desktop = 'DESKTOP',\n}\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for operating system type\n * */\nexport enum OperatingSystemType {\n WindowsPhone = 'WINDOWS_PHONE',\n Windows = 'WINDOWS',\n Android = 'ANDROID',\n Linux = 'LINUX',\n Mac = 'MAC',\n IOS = 'IOS',\n}\n\n/**\n * @param {string} country - a country of a visitor\n * @param {string | undefined} region - an optional parameter containing a region of a visitor, has no default value\n * @param {string | undefined} city - an optional parameter containing a city of a visitor, has no default value\n * @param {string | undefined} postalCode - an optional parameter containing a postal code of a visitor, has no default value\n * @param {[number, number] | undefined} coordinates - an optional parameter containing a pair of coordinates (longitude and latitude) of a visitor, has no default value. Coordinate `number` represents decimal degrees (double that can be negative)\n * */\nexport type GeolocationInfoType = {\n country: string;\n region?: string;\n city?: string;\n postalCode?: string;\n coordinates?: [number, number];\n};\n\n/**\n * @param {string} key - a key of a cookie\n * @param {string} value - a value of a cookie\n * */\nexport type CookieType = {\n key: string;\n value: string;\n};\n\n/**\n * @type Nested object of key moments and goals with their respective scores\n * */\nexport type KCSType = {\n [keyMoment: string]: {\n [goalId: string]: number;\n };\n};\n\nexport type OptionalCookieType = Omit<CookieType, 'key'> & {\n key?: string;\n};\n\n/**\n * @readonly\n * @enum {string} an Enum containing all possible variants for browser type\n * */\nexport enum BrowserType {\n Chrome = 'CHROME',\n InternetExplorer = 'IE',\n Firefox = 'FIREFOX',\n Safari = 'SAFARI',\n Opera = 'OPERA',\n Other = 'OTHER',\n}\n\nexport const OperatingSystemIndexMap = {\n [OperatingSystemType.Windows]: 0,\n [OperatingSystemType.Mac]: 1,\n [OperatingSystemType.IOS]: 2,\n [OperatingSystemType.Linux]: 3,\n [OperatingSystemType.Android]: 4,\n [OperatingSystemType.WindowsPhone]: 5,\n} as const;\n\nexport const OperatingSystemTypeMap = constructTypeMap<OperatingSystemType>(\n OperatingSystemIndexMap,\n);\n\nexport const BrowserIndexMap = {\n [BrowserType.Chrome]: 0,\n [BrowserType.InternetExplorer]: 1,\n [BrowserType.Firefox]: 2,\n [BrowserType.Safari]: 3,\n [BrowserType.Opera]: 4,\n [BrowserType.Other]: 5,\n} as const;\n\nexport const BrowserTypeMap = constructTypeMap<BrowserType>(BrowserIndexMap);\n\nexport type SingleDataType = {\n [KameleoonData.Device]: Device | null;\n [KameleoonData.Browser]: Browser | null;\n [KameleoonData.GeolocationData]: GeolocationData | null;\n [KameleoonData.OperatingSystem]: OperatingSystem | null;\n [KameleoonData.KameleoonConversionScore]: KameleoonConversionScore | null;\n};\n\nexport type MultipleDataType = {\n [KameleoonData.CustomData]: Map<number, CustomData>;\n [KameleoonData.PageView]: Map<string, PageView>;\n [KameleoonData.Conversion]: Map<number, Conversion>;\n};\n\nexport type VisitProcessorDataType = {\n visitorData: KameleoonDataType[];\n storageVisitorData: KameleoonDataType[];\n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Q,WAAA,UAAXA,CAAW,QAAX,CAAAA,CAAW,CAAAuB,MAAA,UAAXvB,CAAW,CAAAwB,gBAAA,MAAXxB,CAAW,CAAAyB,OAAA,WAAXzB,CAAW,CAAA0B,MAAA,UAAX1B,CAAW,CAAA2B,KAAA,SAAX3B,CAAW,CAAA4B,KAAA,SAAX5B,CAAW,WASV,CAAAJ,uBAAuB,CAAAJ,OAAA,CAAAI,uBAAA,CAAG,CACrC,CAACD,mBAAmB,CAACuB,OAAO,EAAG,CAAC,CAChC,CAACvB,mBAAmB,CAAC0B,GAAG,EAAG,CAAC,CAC5B,CAAC1B,mBAAmB,CAAC2B,GAAG,EAAG,CAAC,CAC5B,CAAC3B,mBAAmB,CAACyB,KAAK,EAAG,CAAC,CAC9B,CAACzB,mBAAmB,CAACwB,OAAO,EAAG,CAAC,CAChC,CAACxB,mBAAmB,CAACsB,YAAY,EAAG,CACtC,CAAU,CAEGvB,sBAAsB,CAAAF,OAAA,CAAAE,sBAAA,CAAG,GAAAmC,yBAAgB,EACpDjC,uBACF,CAAC,CAEYK,eAAe,CAAAT,OAAA,CAAAS,eAAA,CAAG,CAC7B,CAACD,WAAW,CAACuB,MAAM,EAAG,CAAC,CACvB,CAACvB,WAAW,CAACwB,gBAAgB,EAAG,CAAC,CACjC,CAACxB,WAAW,CAACyB,OAAO,EAAG,CAAC,CACxB,CAACzB,WAAW,CAAC0B,MAAM,EAAG,CAAC,CACvB,CAAC1B,WAAW,CAAC2B,KAAK,EAAG,CAAC,CACtB,CAAC3B,WAAW,CAAC4B,KAAK,EAAG,CACvB,CAAU,CAEG7B,cAAc,CAAAP,OAAA,CAAAO,cAAA,CAAG,GAAA8B,yBAAgB,EAAc5B,eAAe,CAAC"}
|
|
@@ -25,6 +25,7 @@ export declare const ERROR_MESSAGES: {
|
|
|
25
25
|
ClientConfiguration: () => string;
|
|
26
26
|
TargetingCondition: (targetingType: TargetingType) => string;
|
|
27
27
|
AmongValuesCheck: (err: unknown, value: string) => string;
|
|
28
|
+
RangeCheck: (value?: number[] | null) => string;
|
|
28
29
|
RemoteData: () => string;
|
|
29
30
|
MaximumRetriesReached: () => string;
|
|
30
31
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _types=require("./types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;const ERROR_MESSAGES=exports.ERROR_MESSAGES={[_types.KameleoonException.CookieParse]:a=>"Couldn't parse cookie string: ".concat(a),[_types.KameleoonException.JSONParse]:a=>"Couldn't parse JSON variable: ".concat(a),[_types.KameleoonException.NumberParse]:a=>"It's not possible to parse value ".concat(a," to Number"),[_types.KameleoonException.VersionParse]:a=>"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x"),[_types.KameleoonException.SemanticVersionParse]:a=>"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x"),[_types.KameleoonException.Initialization]:()=>"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods",[_types.KameleoonException.Credentials]:()=>"KameleoonClient can not be created without credentials",[_types.KameleoonException.StorageInitialization]:()=>"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed",[_types.KameleoonException.EventSourceInitialization]:()=>"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed",[_types.KameleoonException.FeatureFlagConfigurationNotFound]:a=>"No feature flag with key ".concat(a," was found."),[_types.KameleoonException.FeatureFlagEnvironmentDisabled]:(a,b)=>"Feature flag with key ".concat(a," is disabled in ").concat(b," environment."),[_types.KameleoonException.FeatureFlagVariableNotFound]:(a,b)=>"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode."),[_types.KameleoonException.FeatureFlagVariationNotFound]:(a,b)=>"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode."),[_types.KameleoonException.NotTargeted]:a=>"Visitor code ".concat(a," is not targeted"),[_types.KameleoonException.VisitAmount]:()=>"Visit amount must be a number between 1 and 25",[_types.KameleoonException.VisitorCodeMaxLength]:()=>"Visitor code can not be more than 255 characters long",[_types.KameleoonException.VisitorCodeEmpty]:()=>"Visitor code can not be empty",[_types.KameleoonException.StorageWrite]:a=>"Couldn't update storage for kameleoonClient: ".concat(a),[_types.KameleoonException.StorageRead]:a=>"No data found in storage under ".concat(a," key"),[_types.KameleoonException.StorageEmpty]:()=>"No data found in storage",[_types.KameleoonException.StorageParse]:(a,b)=>"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a),[_types.KameleoonException.ClientConfiguration]:()=>"Couldn't retrieve client configuration from Kameleoon Api",[_types.KameleoonException.TargetingCondition]:a=>"".concat(a," targeting condition is not yet supported."),[_types.KameleoonException.AmongValuesCheck]:(a,b)=>"Couldn't parse value \"".concat(b,"\": ").concat(a),[_types.KameleoonException.RemoteData]:()=>"Couldn't retrieve data from Kameleoon server",[_types.KameleoonException.MaximumRetriesReached]:()=>"Maximum retries reached, request failed"};
|
|
1
|
+
"use strict";var _types=require("./types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ERROR_MESSAGES=void 0;const ERROR_MESSAGES=exports.ERROR_MESSAGES={[_types.KameleoonException.CookieParse]:a=>"Couldn't parse cookie string: ".concat(a),[_types.KameleoonException.JSONParse]:a=>"Couldn't parse JSON variable: ".concat(a),[_types.KameleoonException.NumberParse]:a=>"It's not possible to parse value ".concat(a," to Number"),[_types.KameleoonException.VersionParse]:a=>"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x"),[_types.KameleoonException.SemanticVersionParse]:a=>"It's not possible to parse a version value ".concat(a," to Number, version should be in format x.x.x"),[_types.KameleoonException.Initialization]:()=>"It seems that the client wasn't properly initialized, make sure to run `initialize` method before invoking other methods",[_types.KameleoonException.Credentials]:()=>"KameleoonClient can not be created without credentials",[_types.KameleoonException.StorageInitialization]:()=>"There was an error while initializing React Native SDK storage, it seems that the storage library dependency wasn't installed",[_types.KameleoonException.EventSourceInitialization]:()=>"There was an error while initializing Real Time Update service, it seems that the event source library dependency wasn't installed",[_types.KameleoonException.FeatureFlagConfigurationNotFound]:a=>"No feature flag with key ".concat(a," was found."),[_types.KameleoonException.FeatureFlagEnvironmentDisabled]:(a,b)=>"Feature flag with key ".concat(a," is disabled in ").concat(b," environment."),[_types.KameleoonException.FeatureFlagVariableNotFound]:(a,b)=>"No feature flag variable with key ".concat(a," was found for ").concat(b," visitorCode."),[_types.KameleoonException.FeatureFlagVariationNotFound]:(a,b)=>"No feature flag variation with key ".concat(a," was found for ").concat(b," visitorCode."),[_types.KameleoonException.NotTargeted]:a=>"Visitor code ".concat(a," is not targeted"),[_types.KameleoonException.VisitAmount]:()=>"Visit amount must be a number between 1 and 25",[_types.KameleoonException.VisitorCodeMaxLength]:()=>"Visitor code can not be more than 255 characters long",[_types.KameleoonException.VisitorCodeEmpty]:()=>"Visitor code can not be empty",[_types.KameleoonException.StorageWrite]:a=>"Couldn't update storage for kameleoonClient: ".concat(a),[_types.KameleoonException.StorageRead]:a=>"No data found in storage under ".concat(a," key"),[_types.KameleoonException.StorageEmpty]:()=>"No data found in storage",[_types.KameleoonException.StorageParse]:(a,b)=>"Couldn't parse ".concat(b," storage data, the data may be corrupted. Error: ").concat(a),[_types.KameleoonException.ClientConfiguration]:()=>"Couldn't retrieve client configuration from Kameleoon Api",[_types.KameleoonException.TargetingCondition]:a=>"".concat(a," targeting condition is not yet supported."),[_types.KameleoonException.AmongValuesCheck]:(a,b)=>"Couldn't parse value \"".concat(b,"\": ").concat(a),[_types.KameleoonException.RangeCheck]:a=>"Couldn't parse value \"".concat(a,"\" as a range, value should be in format [x: number, y: number]"),[_types.KameleoonException.RemoteData]:()=>"Couldn't retrieve data from Kameleoon server",[_types.KameleoonException.MaximumRetriesReached]:()=>"Maximum retries reached, request failed"};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["_types","require","Object","defineProperty","exports","value","ERROR_MESSAGES","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageEmpty","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RemoteData","MaximumRetriesReached"],"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.StorageEmpty]: () => 'No data found in storage',\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":"aAEA,IAAAA,MAAA,CAAAC,OAAA,YAA6CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,cAAA,QAEtC,KAAM,CAAAA,cAAc,CAAAF,OAAA,CAAAE,cAAA,CAAG,CAC5B,CAACC,yBAAkB,CAACC,WAAW,EAAIC,CAAc,mCAAAC,MAAA,CACdD,CAAM,CAAE,CAC3C,CAACF,yBAAkB,CAACI,SA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BAAkB,CAACyB,gBAAgB,EAAG,IAAM,+BAA+B,CAC5E,CAACzB,yBAAkB,CAAC0B,YAAY,EAAIrB,CAAY,kDAAAF,MAAA,CACEE,CAAG,CAAE,CACvD,CAACL,yBAAkB,CAAC2B,WAAW,EAAIC,CAAwB,oCAAAzB,MAAA,CACvByB,CAAG,QAAM,CAC7C,CAAC5B,yBAAkB,CAAC6B,YAAY,EAAG,IAAM,0BAA0B,CACnE,CAAC7B,yBAAkB,CAAC8B,YAAY,EAAG,CAACzB,CAAY,CAAEuB,CAAwB,qBAAAzB,MAAA,CACtDyB,CAAG,sDAAAzB,MAAA,CAAoDE,CAAG,CAAE,CAChF,CAACL,yBAAkB,CAAC+B,mBAAmB,EAAG,IACxC,2DAA2D,CAC7D,CAAC/B,yBAAkB,CAACgC,kBAAkB,EAAIC,CAA4B,KAAA9B,MAAA,CACjE8B,CAAa,8CAA4C,CAC9D,CAACjC,yBAAkB,CAACkC,gBAAgB,EAAG,CAAC7B,CAAY,CAAEP,CAAa,6BAAAK,MAAA,CACxCL,CAAK,SAAAK,MAAA,CAAME,CAAG,CAAE,CAC3C,CAACL,yBAAkB,CAACmC,UAAU,EAAG,kDACe,CAChD,
|
|
1
|
+
{"version":3,"file":"constants.js","names":["_types","require","Object","defineProperty","exports","value","ERROR_MESSAGES","KameleoonException","CookieParse","reason","concat","JSONParse","err","NumberParse","VersionParse","SemanticVersionParse","Initialization","Credentials","StorageInitialization","EventSourceInitialization","FeatureFlagConfigurationNotFound","featureKey","FeatureFlagEnvironmentDisabled","environment","FeatureFlagVariableNotFound","variableKey","visitorCode","FeatureFlagVariationNotFound","variationKey","NotTargeted","VisitAmount","VisitorCodeMaxLength","VisitorCodeEmpty","StorageWrite","StorageRead","key","StorageEmpty","StorageParse","ClientConfiguration","TargetingCondition","targetingType","AmongValuesCheck","RangeCheck","RemoteData","MaximumRetriesReached"],"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.StorageEmpty]: () => 'No data found in storage',\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.RangeCheck]: (value?: number[] | null) =>\n `Couldn't parse value \"${value}\" as a range, value should be in format [x: number, y: number]`,\n [KameleoonException.RemoteData]: () =>\n `Couldn't retrieve data from Kameleoon server`,\n [KameleoonException.MaximumRetriesReached]: () =>\n `Maximum retries reached, request failed`,\n};\n"],"mappings":"aAEA,IAAAA,MAAA,CAAAC,OAAA,YAA6CC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,cAAA,QAEtC,KAAM,CAAAA,cAAc,CAAAF,OAAA,CAAAE,cAAA,CAAG,CAC5B,CAACC,yBAAkB,CAACC,WAAW,EAAIC,CAAc,mCAAAC,MAAA,CACdD,CAAM,CAAE,CAC3C,CAACF,yBAAkB,CAACI,SAAS,EAAIC,CAAY,mCAAAF,MAAA,CACVE,CAAG,CAAE,CACxC,CAACL,yBAAkB,CAACM,WAAW,EAAIR,CAAa,sCAAAK,MAAA,CACVL,CAAK,cAAY,CACvD,CAACE,yBAAkB,CAACO,YAAY,EAAIT,CAAa,gDAAAK,MAAA,CACDL,CAAK,+CAA6C,CAClG,CAACE,yBAAkB,CAACQ,oBAAoB,EAAIV,CAAa,gDAAAK,MAAA,CACTL,CAAK,i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yBAAkB,CAAC8B,YAAY,EAAG,CAACzB,CAAY,CAAEuB,CAAwB,qBAAAzB,MAAA,CACtDyB,CAAG,sDAAAzB,MAAA,CAAoDE,CAAG,CAAE,CAChF,CAACL,yBAAkB,CAAC+B,mBAAmB,EAAG,IACxC,2DAA2D,CAC7D,CAAC/B,yBAAkB,CAACgC,kBAAkB,EAAIC,CAA4B,KAAA9B,MAAA,CACjE8B,CAAa,8CAA4C,CAC9D,CAACjC,yBAAkB,CAACkC,gBAAgB,EAAG,CAAC7B,CAAY,CAAEP,CAAa,6BAAAK,MAAA,CACxCL,CAAK,SAAAK,MAAA,CAAME,CAAG,CAAE,CAC3C,CAACL,yBAAkB,CAACmC,UAAU,EAAIrC,CAAuB,4BAAAK,MAAA,CAC9BL,CAAK,mEAAgE,CAChG,CAACE,yBAAkB,CAACoC,UAAU,EAAG,kDACe,CAChD,CAACpC,yBAAkB,CAACqC,qBAAqB,EAAG,6CAE9C,CAAC"}
|
|
@@ -22,6 +22,7 @@ export declare class KameleoonError extends Error {
|
|
|
22
22
|
constructor(type: KameleoonException.StorageParse, err: unknown, key: KameleoonStorageKey);
|
|
23
23
|
constructor(type: KameleoonException.TargetingCondition, targetingType: TargetingType);
|
|
24
24
|
constructor(type: KameleoonException.AmongValuesCheck, err: unknown, value: string);
|
|
25
|
+
constructor(type: KameleoonException.RangeCheck, value?: number[] | null);
|
|
25
26
|
constructor(type: KameleoonException.NumberParse | KameleoonException.VersionParse | KameleoonException.SemanticVersionParse, value: string);
|
|
26
27
|
get type(): KameleoonException;
|
|
27
28
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonError=void 0;var _constants=require("./constants"),_helpers=require("./helpers"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class KameleoonError extends Error{constructor(a,b,c){super("Error: ".concat(a)),_defineProperty(this,"errorType",void 0),this.name="KameleoonError",this.errorType=a;a===_types.KameleoonException.Initialization||a===_types.KameleoonException.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached||a===_types.KameleoonException.StorageEmpty?this.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse||a===_types.KameleoonException.NotTargeted||a===_types.KameleoonException.FeatureFlagConfigurationNotFound||a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagEnvironmentDisabled||a===_types.KameleoonException.FeatureFlagVariableNotFound?this.message=_constants.ERROR_MESSAGES[a](b,c):a===_types.KameleoonException.StorageWrite||a===_types.KameleoonException.JSONParse?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.StorageRead?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.StorageParse?this.message=_constants.ERROR_MESSAGES[a](b,c):a===_types.KameleoonException.TargetingCondition?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.AmongValuesCheck?this.message=_constants.ERROR_MESSAGES[a](b,c):(0,_helpers.exhaustCheck)(a)}get type(){return this.errorType}}exports.KameleoonError=KameleoonError;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonError=void 0;var _constants=require("./constants"),_helpers=require("./helpers"),_types=require("./types");function _defineProperty(a,b,c){return b=_toPropertyKey(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==typeof b?b:b+""}function _toPrimitive(a,b){if("object"!=typeof a||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=typeof d)return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}class KameleoonError extends Error{constructor(a,b,c){super("Error: ".concat(a)),_defineProperty(this,"errorType",void 0),this.name="KameleoonError",this.errorType=a;a===_types.KameleoonException.Initialization||a===_types.KameleoonException.Credentials||a===_types.KameleoonException.ClientConfiguration||a===_types.KameleoonException.VisitorCodeMaxLength||a===_types.KameleoonException.VisitorCodeEmpty||a===_types.KameleoonException.StorageInitialization||a===_types.KameleoonException.VisitAmount||a===_types.KameleoonException.EventSourceInitialization||a===_types.KameleoonException.RemoteData||a===_types.KameleoonException.MaximumRetriesReached||a===_types.KameleoonException.StorageEmpty?this.message=_constants.ERROR_MESSAGES[a]():a===_types.KameleoonException.CookieParse||a===_types.KameleoonException.NotTargeted||a===_types.KameleoonException.FeatureFlagConfigurationNotFound||a===_types.KameleoonException.NumberParse||a===_types.KameleoonException.VersionParse||a===_types.KameleoonException.SemanticVersionParse?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.FeatureFlagVariationNotFound||a===_types.KameleoonException.FeatureFlagEnvironmentDisabled||a===_types.KameleoonException.FeatureFlagVariableNotFound?this.message=_constants.ERROR_MESSAGES[a](b,c):a===_types.KameleoonException.StorageWrite||a===_types.KameleoonException.JSONParse?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.StorageRead?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.StorageParse?this.message=_constants.ERROR_MESSAGES[a](b,c):a===_types.KameleoonException.TargetingCondition?this.message=_constants.ERROR_MESSAGES[a](b):a===_types.KameleoonException.AmongValuesCheck?this.message=_constants.ERROR_MESSAGES[a](b,c):a===_types.KameleoonException.RangeCheck?this.message=_constants.ERROR_MESSAGES[a](b):(0,_helpers.exhaustCheck)(a)}get type(){return this.errorType}}exports.KameleoonError=KameleoonError;
|
|
2
2
|
//# sourceMappingURL=kameleoonError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kameleoonError.js","names":["KameleoonError","Error","constructor","type","secondParam","thirdParam","concat","_defineProperty","name","errorType","KameleoonException","Initialization","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","StorageEmpty","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","NumberParse","VersionParse","SemanticVersionParse","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","AmongValuesCheck","exhaustCheck","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { ERROR_MESSAGES } from './constants';\nimport { exhaustCheck } from './helpers';\nimport { KameleoonException } from './types';\n\n/**\n * @class\n * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`\n * */\nexport class KameleoonError extends Error {\n private errorType: KameleoonException;\n\n /**\n * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum\n * */\n constructor(\n type:\n | KameleoonException.Initialization\n | KameleoonException.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached\n | KameleoonException.StorageEmpty,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n environment: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\n constructor(\n type: KameleoonException.StorageWrite | KameleoonException.JSONParse,\n err: unknown,\n );\n constructor(type: KameleoonException.StorageRead, storageKey: string);\n constructor(\n type: KameleoonException.StorageParse,\n err: unknown,\n key: KameleoonStorageKey,\n );\n constructor(\n type: KameleoonException.TargetingCondition,\n targetingType: TargetingType,\n );\n constructor(\n type: KameleoonException.AmongValuesCheck,\n err: unknown,\n value: string,\n );\n constructor(\n type:\n | KameleoonException.NumberParse\n | KameleoonException.VersionParse\n | KameleoonException.SemanticVersionParse,\n value: string,\n );\n constructor(\n type: KameleoonException,\n secondParam?:\n | number\n | string\n | unknown\n | KameleoonStorageKey\n | TargetingType,\n thirdParam?: string | KameleoonStorageKey,\n ) {\n super(`Error: ${type}`);\n\n this.name = 'KameleoonError';\n this.errorType = type;\n\n switch (type) {\n case KameleoonException.Initialization:\n case KameleoonException.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n case KameleoonException.StorageEmpty:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n case KameleoonException.NotTargeted:\n case KameleoonException.FeatureFlagConfigurationNotFound:\n case KameleoonException.NumberParse:\n case KameleoonException.VersionParse:\n case KameleoonException.SemanticVersionParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagEnvironmentDisabled:\n case KameleoonException.FeatureFlagVariableNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as string,\n thirdParam as string,\n );\n break;\n case KameleoonException.StorageWrite:\n case KameleoonException.JSONParse:\n this.message = ERROR_MESSAGES[type](secondParam);\n break;\n case KameleoonException.StorageRead:\n this.message = ERROR_MESSAGES[type](secondParam as KameleoonStorageKey);\n break;\n case KameleoonException.StorageParse:\n this.message = ERROR_MESSAGES[type](\n secondParam,\n thirdParam as KameleoonStorageKey,\n );\n break;\n case KameleoonException.TargetingCondition:\n this.message = ERROR_MESSAGES[type](secondParam as TargetingType);\n break;\n case KameleoonException.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): KameleoonException {\n return this.errorType;\n }\n}\n"],"mappings":"msBAUO,KAAM,CAAAA,cAAc,QAAS,CAAAC,KAAM,
|
|
1
|
+
{"version":3,"file":"kameleoonError.js","names":["KameleoonError","Error","constructor","type","secondParam","thirdParam","concat","_defineProperty","name","errorType","KameleoonException","Initialization","Credentials","ClientConfiguration","VisitorCodeMaxLength","VisitorCodeEmpty","StorageInitialization","VisitAmount","EventSourceInitialization","RemoteData","MaximumRetriesReached","StorageEmpty","message","ERROR_MESSAGES","CookieParse","NotTargeted","FeatureFlagConfigurationNotFound","NumberParse","VersionParse","SemanticVersionParse","FeatureFlagVariationNotFound","FeatureFlagEnvironmentDisabled","FeatureFlagVariableNotFound","StorageWrite","JSONParse","StorageRead","StorageParse","TargetingCondition","AmongValuesCheck","RangeCheck","exhaustCheck","exports"],"sources":["../../src/kameleoonError/kameleoonError.ts"],"sourcesContent":["import { KameleoonStorageKey } from 'src/storage';\nimport { TargetingType } from 'src/targeting';\nimport { ERROR_MESSAGES } from './constants';\nimport { exhaustCheck } from './helpers';\nimport { KameleoonException } from './types';\n\n/**\n * @class\n * KameleoonError - extends standard `Error` by adding custom `type` property with the type of `KameleoonException`\n * */\nexport class KameleoonError extends Error {\n private errorType: KameleoonException;\n\n /**\n * @param {KameleoonException} type - type of KameleoonError represented by `KameleoonException` enum\n * */\n constructor(\n type:\n | KameleoonException.Initialization\n | KameleoonException.Credentials\n | KameleoonException.ClientConfiguration\n | KameleoonException.VisitorCodeMaxLength\n | KameleoonException.VisitorCodeEmpty\n | KameleoonException.VisitAmount\n | KameleoonException.StorageInitialization\n | KameleoonException.EventSourceInitialization\n | KameleoonException.RemoteData\n | KameleoonException.MaximumRetriesReached\n | KameleoonException.StorageEmpty,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n );\n constructor(\n type:\n | KameleoonException.FeatureFlagConfigurationNotFound\n | KameleoonException.FeatureFlagEnvironmentDisabled,\n featureKey: string,\n environment: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariableNotFound,\n variableKey: string,\n visitorCode: string,\n );\n constructor(\n type: KameleoonException.FeatureFlagVariationNotFound,\n variationKey: string,\n visitorCode: string,\n );\n constructor(type: KameleoonException.NotTargeted, visitorCode: string);\n constructor(type: KameleoonException.CookieParse, message: string);\n constructor(\n type: KameleoonException.StorageWrite | KameleoonException.JSONParse,\n err: unknown,\n );\n constructor(type: KameleoonException.StorageRead, storageKey: string);\n constructor(\n type: KameleoonException.StorageParse,\n err: unknown,\n key: KameleoonStorageKey,\n );\n constructor(\n type: KameleoonException.TargetingCondition,\n targetingType: TargetingType,\n );\n constructor(\n type: KameleoonException.AmongValuesCheck,\n err: unknown,\n value: string,\n );\n constructor(type: KameleoonException.RangeCheck, value?: number[] | null);\n constructor(\n type:\n | KameleoonException.NumberParse\n | KameleoonException.VersionParse\n | KameleoonException.SemanticVersionParse,\n value: string,\n );\n constructor(\n type: KameleoonException,\n secondParam?:\n | number\n | string\n | unknown\n | KameleoonStorageKey\n | TargetingType,\n thirdParam?: string | KameleoonStorageKey,\n ) {\n super(`Error: ${type}`);\n\n this.name = 'KameleoonError';\n this.errorType = type;\n\n switch (type) {\n case KameleoonException.Initialization:\n case KameleoonException.Credentials:\n case KameleoonException.ClientConfiguration:\n case KameleoonException.VisitorCodeMaxLength:\n case KameleoonException.VisitorCodeEmpty:\n case KameleoonException.StorageInitialization:\n case KameleoonException.VisitAmount:\n case KameleoonException.EventSourceInitialization:\n case KameleoonException.RemoteData:\n case KameleoonException.MaximumRetriesReached:\n case KameleoonException.StorageEmpty:\n this.message = ERROR_MESSAGES[type]();\n break;\n case KameleoonException.CookieParse:\n case KameleoonException.NotTargeted:\n case KameleoonException.FeatureFlagConfigurationNotFound:\n case KameleoonException.NumberParse:\n case KameleoonException.VersionParse:\n case KameleoonException.SemanticVersionParse:\n this.message = ERROR_MESSAGES[type](secondParam as string);\n break;\n case KameleoonException.FeatureFlagVariationNotFound:\n case KameleoonException.FeatureFlagEnvironmentDisabled:\n case KameleoonException.FeatureFlagVariableNotFound:\n this.message = ERROR_MESSAGES[type](\n secondParam as string,\n thirdParam as string,\n );\n break;\n case KameleoonException.StorageWrite:\n case KameleoonException.JSONParse:\n this.message = ERROR_MESSAGES[type](secondParam);\n break;\n case KameleoonException.StorageRead:\n this.message = ERROR_MESSAGES[type](secondParam as KameleoonStorageKey);\n break;\n case KameleoonException.StorageParse:\n this.message = ERROR_MESSAGES[type](\n secondParam,\n thirdParam as KameleoonStorageKey,\n );\n break;\n case KameleoonException.TargetingCondition:\n this.message = ERROR_MESSAGES[type](secondParam as TargetingType);\n break;\n case KameleoonException.AmongValuesCheck:\n this.message = ERROR_MESSAGES[type](secondParam, thirdParam as string);\n break;\n case KameleoonException.RangeCheck:\n this.message = ERROR_MESSAGES[type](\n secondParam as number[] | null | undefined,\n );\n break;\n default:\n exhaustCheck(type);\n }\n }\n\n get type(): KameleoonException {\n return this.errorType;\n }\n}\n"],"mappings":"msBAUO,KAAM,CAAAA,cAAc,QAAS,CAAAC,KAAM,CAwExCC,WAAWA,CACTC,CAAwB,CACxBC,CAKiB,CACjBC,CAAyC,CACzC,CACA,KAAK,WAAAC,MAAA,CAAWH,CAAI,CAAE,CAAC,CAAAI,eAAA,0BAEvB,IAAI,CAACC,IAAI,CAAG,gBAAgB,CAC5B,IAAI,CAACC,SAAS,CAAGN,CAAI,CAEbA,CAAI,GACLO,yBAAkB,CAACC,cAAc,EADhCR,CAAI,GAELO,yBAAkB,CAACE,WAAW,EAF7BT,CAAI,GAGLO,yBAAkB,CAACG,mBAAmB,EAHrCV,CAAI,GAILO,yBAAkB,CAACI,oBAAoB,EAJtCX,CAAI,GAKLO,yBAAkB,CAACK,gBAAgB,EALlCZ,CAAI,GAMLO,yBAAkB,CAACM,qBAAqB,EANvCb,CAAI,GAOLO,yBAAkB,CAACO,WAAW,EAP7Bd,CAAI,GAQLO,yBAAkB,CAACQ,yBAAyB,EAR3Cf,CAAI,GASLO,yBAAkB,CAACS,UAAU,EAT5BhB,CAAI,GAULO,yBAAkB,CAACU,qBAAqB,EAVvCjB,CAAI,GAWLO,yBAAkB,CAACW,YAAY,CAClC,IAAI,CAACC,OAAO,CAAGC,yBAAc,CAACpB,CAAI,CAAC,CAAC,CAAC,CAZjCA,CAAI,GAcLO,yBAAkB,CAACc,WAAW,EAd7BrB,CAAI,GAeLO,yBAAkB,CAACe,WAAW,EAf7BtB,CAAI,GAgBLO,yBAAkB,CAACgB,gCAAgC,EAhBlDvB,CAAI,GAiBLO,yBAAkB,CAACiB,WAAW,EAjB7BxB,CAAI,GAkBLO,yBAAkB,CAACkB,YAAY,EAlB9BzB,CAAI,GAmBLO,yBAAkB,CAACmB,oBAAoB,CAC1C,IAAI,CAACP,OAAO,CAAG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zC,cAAA,CAAAA,cAAA"}
|
|
@@ -21,6 +21,7 @@ export declare enum KameleoonException {
|
|
|
21
21
|
ClientConfiguration = "ClientConfiguration",
|
|
22
22
|
TargetingCondition = "TargetingCondition",
|
|
23
23
|
AmongValuesCheck = "AmongValuesCheck",
|
|
24
|
+
RangeCheck = "RangeCheck",
|
|
24
25
|
Initialization = "Initialization",
|
|
25
26
|
JSONParse = "JSONParse",
|
|
26
27
|
NumberParse = "NumberParse",
|