@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.4.0 (2024-06-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Added new [`networkDomain`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#1-initializing-the-kameleoon-client) parameter in `SDKConfigurationType` for configuring custom network domain for all outgoing requests.
|
|
8
|
+
- [`SDKConfigurationType`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#1-initializing-the-kameleoon-client) parameter `domain` was deprecated and will be removed in the next major version. Instead new `cookieDomain` is available.
|
|
9
|
+
- Added new optional [External Dependency](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#external-dependencies) - [Requester](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#requester) for implementing custom network request handler
|
|
10
|
+
- Added new `KameleoonUtils` methods:
|
|
11
|
+
- [`getCookieValue`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#getcookievalue) for extracting cookie value from cookie string
|
|
12
|
+
- [`simulateSuccessRequest`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk#simulatesuccessrequest) for mocking successful network requests when implementing custom `Requester`
|
|
13
|
+
|
|
14
|
+
## 4.3.0 (2024-05-24)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- Added new [`onEvent`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#onevent) method to handle SDK events with a callback.
|
|
19
|
+
- Method [`onConfigurationUpdate`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#onConfigurationUpdate) is now marked as `deprecated` and will be removed in the next major release. Use [`onEvent(EventType.ConfigurationUpdate, callback)`](https://developers.kameleoon.com/feature-management-and-experimentation/web-sdks/js-sdk/#onevent) instead.
|
|
20
|
+
- Added support of range match type for numeric Custom Data values.
|
|
21
|
+
|
|
3
22
|
## 4.2.0 (2024-05-07)
|
|
4
23
|
|
|
5
24
|
### Features
|
package/README.md
CHANGED
|
@@ -4,21 +4,19 @@ import { SegmentType } from '../targeting';
|
|
|
4
4
|
import { ClientConfigurationParametersType, ConfigurationType, FeatureFlagType, MappedRuleType } from './types';
|
|
5
5
|
interface IClientConfiguration {
|
|
6
6
|
initialize: (useCache?: boolean) => Promise<Result<void, KameleoonError>>;
|
|
7
|
-
onConfigurationUpdate: (callback: () => void) => void;
|
|
8
7
|
readonly featureFlags: Map<string, FeatureFlagType>;
|
|
9
8
|
readonly configuration: ConfigurationType;
|
|
10
9
|
readonly segments: Map<string, SegmentType>;
|
|
11
10
|
readonly ruleMap: Map<number, MappedRuleType>;
|
|
12
11
|
}
|
|
13
12
|
export declare class ClientConfiguration implements IClientConfiguration {
|
|
14
|
-
private configurationUpdateCallback?;
|
|
15
13
|
private updateConfigurationIntervalId;
|
|
16
14
|
private updateType;
|
|
17
15
|
private configurationData;
|
|
18
16
|
private featureFlagsData;
|
|
19
17
|
private isTargetedDeliveryRule;
|
|
20
18
|
private segmentsData;
|
|
21
|
-
private
|
|
19
|
+
private updateInterval;
|
|
22
20
|
private lastUpdate;
|
|
23
21
|
private storage;
|
|
24
22
|
private offlineTrackingStorage;
|
|
@@ -28,13 +26,13 @@ export declare class ClientConfiguration implements IClientConfiguration {
|
|
|
28
26
|
private mappedRules;
|
|
29
27
|
private dataManager;
|
|
30
28
|
private visitorCodeManager;
|
|
31
|
-
|
|
29
|
+
private eventManager;
|
|
30
|
+
constructor({ updateInterval, storage, requester, dataManager, externalClientConfiguration, offlineTrackingStorage, eventSource, externalVisitorCodeManager, eventManager, }: ClientConfigurationParametersType);
|
|
32
31
|
initialize(): Promise<Result<void, KameleoonError>>;
|
|
33
32
|
private cleanupHandlers;
|
|
34
33
|
private handleExternalUpdates;
|
|
35
34
|
private handleRealTimeUpdates;
|
|
36
35
|
private handlePollingUpdates;
|
|
37
|
-
onConfigurationUpdate(callback: () => void): void;
|
|
38
36
|
get featureFlags(): Map<string, FeatureFlagType>;
|
|
39
37
|
get configuration(): ConfigurationType;
|
|
40
38
|
get segments(): Map<string, SegmentType>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClientConfiguration=void 0;var _tsRes=require("ts-res"),_constants=require("./constants"),_types=require("./types"),_utilities=require("../utilities"),_urlProvider=require("../requester/urlProvider");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 ClientConfiguration{constructor(a){let{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClientConfiguration=void 0;var _tsRes=require("ts-res"),_constants=require("./constants"),_types=require("./types"),_utilities=require("../utilities"),_eventManager=require("../eventManager"),_urlProvider=require("../requester/urlProvider");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 ClientConfiguration{constructor(a){let{updateInterval:b,storage:c,requester:d,dataManager:e,externalClientConfiguration:f,offlineTrackingStorage:g,eventSource:h,externalVisitorCodeManager:i,eventManager:j}=a;_defineProperty(this,"updateConfigurationIntervalId",null),_defineProperty(this,"updateType",_types.UpdateType.Idle),_defineProperty(this,"configurationData",_constants.DEFAULT_CONFIGURATION_DATA),_defineProperty(this,"featureFlagsData",new Map),_defineProperty(this,"isTargetedDeliveryRule",null),_defineProperty(this,"segmentsData",null),_defineProperty(this,"updateInterval",void 0),_defineProperty(this,"lastUpdate",void 0),_defineProperty(this,"storage",void 0),_defineProperty(this,"offlineTrackingStorage",void 0),_defineProperty(this,"requester",void 0),_defineProperty(this,"eventSource",void 0),_defineProperty(this,"externalClientConfiguration",void 0),_defineProperty(this,"mappedRules",null),_defineProperty(this,"dataManager",void 0),_defineProperty(this,"visitorCodeManager",void 0),_defineProperty(this,"eventManager",void 0),this.requester=d,this.updateInterval=b,this.lastUpdate=new Date,this.storage=c,this.dataManager=e,this.eventManager=j,this.externalClientConfiguration=f,this.offlineTrackingStorage=g,this.visitorCodeManager=i,this.eventSource=h}async initialize(){this.readStorageData();const a=!!this.externalClientConfiguration,b=this.checkShouldUpdate(a);if(b){const a=await this.updateClientConfiguration();if(!a.ok)return a;const b=a.data;if(b)return(0,_tsRes.Ok)()}return a?(this.handleExternalUpdates(),(0,_tsRes.Ok)()):this.updateType!==_types.UpdateType.RealTime||this.eventSource.isOpen?(this.updateType===_types.UpdateType.Polling&&this.handlePollingUpdates(),(0,_tsRes.Ok)()):(this.updateType=_types.UpdateType.Idle,this.handleRealTimeUpdates(),(0,_tsRes.Ok)())}cleanupHandlers(){this.eventSource.isOpen&&this.eventSource.close(),this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId)}handleExternalUpdates(){this.cleanupHandlers();const{customData:a,configuration:b,featureFlags:c}=this.externalClientConfiguration;this.configurationData={customData:a,configuration:b};for(const a of c)this.featureFlagsData.set(a.featureKey,a)}handleRealTimeUpdates(){this.cleanupHandlers();const a=a=>{this.updateClientConfiguration(a).then(b=>{b.ok&&this.eventManager.fireEvent(_eventManager.EventType.ConfigurationUpdate,{timestamp:a})})};this.eventSource.open(a)}handlePollingUpdates(){this.cleanupHandlers();try{this.updateConfigurationIntervalId=setInterval(this.updateClientConfiguration.bind(this),this.updateInterval)}catch(a){throw this.updateConfigurationIntervalId&&clearInterval(this.updateConfigurationIntervalId),a}}get featureFlags(){return this.featureFlagsData}get configuration(){return this.configurationData.configuration}get segments(){if(this.segmentsData)return this.segmentsData;const a=new Map;return this.featureFlagsData.forEach(b=>{b.rules.forEach(b=>{b.segment&&!a.has(b.segment.id)&&a.set(b.segment.id,b.segment)})}),this.segmentsData=a,a}get ruleMap(){if(this.mappedRules)return this.mappedRules;const a=new Map;for(const b of this.featureFlags.values())for(const c of b.rules){const{id:d,experimentId:e,variationByExposition:f}=c,g=new Map;f.forEach(a=>{let{variationKey:b,variationId:c}=a;"number"==typeof c&&g.set(b,c)}),a.set(d,{featureId:b.id,experimentId:e,variations:g})}return this.mappedRules=a,a}get isConsentRequired(){return this.configuration.consentType===_types.ConsentType.Required}get hasAnyTargetedDeliveryRule(){if(null!==this.isTargetedDeliveryRule)return this.isTargetedDeliveryRule;for(const a of this.featureFlags.values())if(a.environmentEnabled&&a.rules.some(a=>a.type===_types.RuleType.TARGETED_DELIVERY))return!0;return!1}checkIntegrity(a){if(!a)return!1;const b=Object.keys(a);if(!b.length)return!1;const c=Object.keys(_constants.DEFAULT_CLIENT_CONFIGURATION);return b.sort().join()===c.sort().join()}checkShouldUpdate(){let a=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0];const{configuration:b}=this.configurationData;if(a)return this.updateType=_types.UpdateType.Idle,!1;if(this.updateType=b.realTimeUpdate?_types.UpdateType.RealTime:_types.UpdateType.Polling,!this.featureFlags.size)return!0;const c=this.lastUpdate.getTime(),d=Date.now()-this.updateInterval;return c<d}readStorageData(){const a=this.storage.read();if(a.ok){const{data:b,lastUpdate:c}=a.data,d=this.checkIntegrity(b);if(!d){_urlProvider.UrlProvider.setDataApiDomain(_constants.DEFAULT_CONFIGURATION_DATA.configuration.dataApiDomain);const a=_objectSpread(_objectSpread({},_constants.DEFAULT_CONFIGURATION_DATA),{},{featureFlags:[]});this.storage.write({data:a,lastUpdate:this.lastUpdate.toString()}),this.configurationData=_constants.DEFAULT_CONFIGURATION_DATA}else{_urlProvider.UrlProvider.setDataApiDomain(b.configuration.dataApiDomain);const{featureFlags:a}=b;for(const b of a)this.featureFlagsData.set(b.featureKey,b);this.configurationData=b,this.lastUpdate=new Date(Date.parse(c))}}}async updateClientConfiguration(a){var b;const c=await this.requester.getClientConfiguration(a);if(!c.ok)return this.featureFlags.size?(0,_tsRes.Ok)(!0):c;_utilities.Utilities.sendOfflineTracking({storage:this.offlineTrackingStorage,requester:this.requester});const{configuration:d,customData:e,featureFlags:f}=c.data;this.configurationData={configuration:d,customData:e};for(const b of f)this.featureFlagsData.set(b.featureKey,b);null!==e&&void 0!==e&&e.length&&(this.dataManager.customDataIndexes=e),this.dataManager.clearTrees(),null===(b=this.mappedRules)||void 0===b?void 0:b.clear(),this.isTargetedDeliveryRule=null,this.segmentsData=null;const g=this.updateStorageData();if(!g.ok)return g;const h=d.realTimeUpdate?_types.UpdateType.RealTime:_types.UpdateType.Polling,i=h!==this.updateType;i&&(this.updateType=h,await this.initialize());const j=this.isConsentRequired&&!this.hasAnyTargetedDeliveryRule;return this.visitorCodeManager.consentRequired=j,(0,_tsRes.Ok)(i)}updateStorageData(){this.lastUpdate=new Date;const a=_objectSpread(_objectSpread({},this.configurationData),{},{featureFlags:Array.from(this.featureFlags.values())}),b={data:a,lastUpdate:this.lastUpdate.toString()};return _urlProvider.UrlProvider.setDataApiDomain(this.configurationData.configuration.dataApiDomain),this.storage.write(b)}}exports.ClientConfiguration=ClientConfiguration;
|
|
2
2
|
//# sourceMappingURL=clientConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientConfiguration.js","names":["ClientConfiguration","constructor","a","settings","storage","requester","dataManager","externalClientConfiguration","offlineTrackingStorage","eventSource","externalVisitorCodeManager","_defineProperty","UpdateType","Idle","DEFAULT_CONFIGURATION_DATA","Map","lastUpdate","Date","visitorCodeManager","initialize","readStorageData","isExternalConfiguration","shouldUpdate","checkShouldUpdate","updateResult","updateClientConfiguration","ok","isUpdateTypeToggled","data","Ok","handleExternalUpdates","updateType","RealTime","isOpen","Polling","handlePollingUpdates","handleRealTimeUpdates","cleanupHandlers","close","updateConfigurationIntervalId","clearInterval","customData","configuration","configurationData","featureFlag","featureFlags","values","featureFlagsData","set","featureKey","updateEventCallback","timestamp","then","configurationUpdateCallback","open","setInterval","bind","updateInterval","err","onConfigurationUpdate","callback","segments","segmentsData","forEach","flag","rules","rule","segment","has","id","ruleMap","mappedRules","experimentId","variationByExposition","variationMap","variationKey","variationId","featureId","variations","isConsentRequired","consentType","ConsentType","Required","hasAnyTargetedDeliveryRule","isTargetedDeliveryRule","environmentEnabled","some","type","RuleType","TARGETED_DELIVERY","checkIntegrity","fields","Object","keys","length","requiredFields","DEFAULT_CLIENT_CONFIGURATION","sort","join","skipChecks","arguments","realTimeUpdate","size","lastUpdateTime","getTime","updateWindowEdge","now","result","read","isStorageValid","UrlProvider","setDataApiDomain","dataApiDomain","_objectSpread","write","toString","parse","b","clientConfigurationResult","getClientConfiguration","Utilities","sendOfflineTracking","customDataIndexes","clearTrees","clear","updateStorageData","toggleUpdateType","consentRequired","Array","from","exports"],"sources":["../../src/clientConfiguration/clientConfiguration.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError/kameleoonError';\nimport { ClientSettingsType } from 'src/clientSettings/types';\nimport { DataManager } from 'src/kameleoonData';\nimport { Requester } from 'src/requester';\nimport { SegmentType } from 'src/targeting';\nimport { ClientDataType } from 'src/storage';\nimport { IEventSource } from 'src/eventSource';\nimport {\n DEFAULT_CLIENT_CONFIGURATION,\n DEFAULT_CONFIGURATION_DATA,\n} from './constants';\nimport {\n ClientConfigurationDataType,\n ClientConfigurationParametersType,\n ConfigurationDataType,\n ConfigurationType,\n ConsentType,\n FeatureFlagType,\n MappedRuleType,\n RuleType,\n UpdateType,\n} from './types';\nimport { Utilities } from 'src/utilities';\nimport { IStorage, OfflineTracking } from 'src/storage/types';\nimport { IVisitorCodeManager } from 'src/visitorCodeManager';\nimport { UrlProvider } from 'src/requester/urlProvider';\n\ninterface IClientConfiguration {\n initialize: (useCache?: boolean) => Promise<Result<void, KameleoonError>>;\n onConfigurationUpdate: (callback: () => void) => void;\n readonly featureFlags: Map<string, FeatureFlagType>;\n readonly configuration: ConfigurationType;\n readonly segments: Map<string, SegmentType>;\n readonly ruleMap: Map<number, MappedRuleType>;\n}\n\nexport class ClientConfiguration implements IClientConfiguration {\n private configurationUpdateCallback?: () => void;\n private updateConfigurationIntervalId: NodeJS.Timer | null = null;\n private updateType: UpdateType = UpdateType.Idle;\n private configurationData: ClientConfigurationDataType =\n DEFAULT_CONFIGURATION_DATA;\n private featureFlagsData: Map<string, FeatureFlagType> = new Map();\n private isTargetedDeliveryRule: boolean | null = null;\n private segmentsData: Map<string, SegmentType> | null = null;\n private settings: ClientSettingsType;\n private lastUpdate: Date;\n private storage: IStorage<ClientDataType>;\n private offlineTrackingStorage: IStorage<OfflineTracking>;\n private requester: Requester;\n private eventSource: IEventSource;\n private externalClientConfiguration?: ConfigurationDataType;\n private mappedRules: Map<number, MappedRuleType> | null = null;\n private dataManager: DataManager;\n private visitorCodeManager: IVisitorCodeManager;\n\n constructor({\n settings,\n storage,\n requester,\n dataManager,\n externalClientConfiguration,\n offlineTrackingStorage,\n eventSource,\n externalVisitorCodeManager,\n }: ClientConfigurationParametersType) {\n this.requester = requester;\n this.settings = settings;\n this.lastUpdate = new Date();\n this.storage = storage;\n this.dataManager = dataManager;\n this.externalClientConfiguration = externalClientConfiguration;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.visitorCodeManager = externalVisitorCodeManager;\n this.eventSource = eventSource;\n }\n\n public async initialize(): Promise<Result<void, KameleoonError>> {\n this.readStorageData();\n\n const isExternalConfiguration = Boolean(this.externalClientConfiguration);\n const shouldUpdate = this.checkShouldUpdate(isExternalConfiguration);\n\n if (shouldUpdate) {\n const updateResult = await this.updateClientConfiguration();\n\n if (!updateResult.ok) {\n return updateResult;\n }\n\n // --- Note ---\n // If update type is being toggled `initialize` will be called again\n // so we don't need to continue execution here\n const isUpdateTypeToggled = updateResult.data;\n\n if (isUpdateTypeToggled) {\n return Ok();\n }\n }\n\n if (isExternalConfiguration) {\n this.handleExternalUpdates();\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.RealTime && !this.eventSource.isOpen) {\n this.updateType = UpdateType.Idle;\n this.handleRealTimeUpdates();\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.Polling) {\n this.handlePollingUpdates();\n }\n\n return Ok();\n }\n\n private cleanupHandlers(): void {\n if (this.eventSource.isOpen) {\n this.eventSource.close();\n }\n\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n }\n\n private handleExternalUpdates(): void {\n this.cleanupHandlers();\n\n const { customData, configuration } = this.externalClientConfiguration!;\n this.configurationData = { customData, configuration };\n\n for (const featureFlag of this.featureFlags.values()) {\n this.featureFlagsData.set(featureFlag.featureKey, featureFlag);\n }\n }\n\n private handleRealTimeUpdates(): void {\n this.cleanupHandlers();\n\n const updateEventCallback = (timestamp: number) => {\n this.updateClientConfiguration(timestamp).then((updateResult) => {\n if (updateResult.ok && this.configurationUpdateCallback) {\n this.configurationUpdateCallback();\n }\n });\n };\n\n this.eventSource.open(updateEventCallback);\n }\n\n private handlePollingUpdates(): void {\n // --- Note ---\n // If `initialize` is called again the interval will be cleared\n // so theoretically we will constantly defer config update\n // but `this.lastUpdate` with `checkShouldUpdate` will prevent that\n this.cleanupHandlers();\n\n // --- Note ---\n // Error Handling is for `setInterval` emergency cleanup\n try {\n this.updateConfigurationIntervalId = setInterval(\n this.updateClientConfiguration.bind(this),\n this.settings.updateInterval,\n );\n } catch (err) {\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n throw err;\n }\n }\n\n public onConfigurationUpdate(callback: () => void): void {\n this.configurationUpdateCallback = callback;\n }\n\n get featureFlags(): Map<string, FeatureFlagType> {\n return this.featureFlagsData;\n }\n\n get configuration(): ConfigurationType {\n return this.configurationData.configuration;\n }\n\n get segments(): Map<string, SegmentType> {\n if (this.segmentsData) {\n return this.segmentsData;\n }\n\n const segmentsData = new Map<string, SegmentType>();\n\n this.featureFlagsData.forEach((flag) => {\n flag.rules.forEach((rule) => {\n if (rule.segment && !segmentsData.has(rule.segment.id)) {\n segmentsData.set(rule.segment.id, rule.segment);\n }\n });\n });\n\n this.segmentsData = segmentsData;\n\n return segmentsData;\n }\n\n get ruleMap(): Map<number, MappedRuleType> {\n if (this.mappedRules) {\n return this.mappedRules;\n }\n\n const mappedRules = new Map<number, MappedRuleType>();\n\n for (const featureFlag of this.featureFlags.values()) {\n for (const rule of featureFlag.rules) {\n const { id, experimentId, variationByExposition } = rule;\n const variationMap = new Map<string, number>();\n\n variationByExposition.forEach(({ variationKey, variationId }) => {\n if (typeof variationId === 'number') {\n variationMap.set(variationKey, variationId);\n }\n });\n\n mappedRules.set(id, {\n featureId: featureFlag.id,\n experimentId,\n variations: variationMap,\n });\n }\n }\n\n this.mappedRules = mappedRules;\n\n return mappedRules;\n }\n\n get isConsentRequired(): boolean {\n return this.configuration.consentType === ConsentType.Required;\n }\n\n get hasAnyTargetedDeliveryRule(): boolean {\n if (this.isTargetedDeliveryRule !== null) {\n return this.isTargetedDeliveryRule;\n }\n\n for (const featureFlag of this.featureFlags.values()) {\n if (\n featureFlag.environmentEnabled &&\n featureFlag.rules.some(\n (rule) => rule.type === RuleType.TARGETED_DELIVERY,\n )\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n // --- Note ---\n // Integrity check covers most of the migration scenarios\n // however in the future it will be changed to a dedicate migration\n // block that can handle all versions migrations\n private checkIntegrity(data: ConfigurationDataType | undefined): boolean {\n if (!data) {\n return false;\n }\n\n const fields = Object.keys(data);\n\n if (!fields.length) {\n return false;\n }\n\n const requiredFields = Object.keys(DEFAULT_CLIENT_CONFIGURATION);\n\n return fields.sort().join() === requiredFields.sort().join();\n }\n\n private checkShouldUpdate(skipChecks = false): boolean {\n const { configuration } = this.configurationData;\n const { updateInterval } = this.settings;\n\n // --- Note ---\n // Following `updateType` logic is done for client side\n // edge cases where we have previous campaigns on storage already, but we still want\n // to initialize SSE/Polling after page reload\n if (skipChecks) {\n this.updateType = UpdateType.Idle;\n\n return false;\n }\n\n this.updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n if (!this.featureFlags.size) {\n return true;\n }\n\n const lastUpdateTime = this.lastUpdate.getTime();\n const updateWindowEdge = Date.now() - updateInterval;\n\n return lastUpdateTime < updateWindowEdge;\n }\n\n private readStorageData(): void {\n const result = this.storage.read();\n\n if (result.ok) {\n const { data, lastUpdate } = result.data;\n\n const isStorageValid = this.checkIntegrity(data);\n\n // --- Note ---\n // Cleaning up storage if it's not valid for migration purposes\n if (!isStorageValid) {\n UrlProvider.setDataApiDomain(\n DEFAULT_CONFIGURATION_DATA.configuration.dataApiDomain,\n );\n\n const data = {\n ...DEFAULT_CONFIGURATION_DATA,\n featureFlags: [],\n };\n\n this.storage.write({\n data,\n lastUpdate: this.lastUpdate.toString(),\n });\n\n this.configurationData = DEFAULT_CONFIGURATION_DATA;\n } else {\n UrlProvider.setDataApiDomain(data.configuration.dataApiDomain);\n\n this.configurationData = data;\n this.lastUpdate = new Date(Date.parse(lastUpdate));\n }\n }\n }\n\n /**\n * Updates client configuration\n *\n * @param timeStamp - timestamp for real-time configuration update\n *\n * @returns `true` if current update type should be toggled (SSE/Polling)\n */\n private async updateClientConfiguration(\n timestamp?: number,\n ): Promise<Result<boolean, KameleoonError>> {\n const clientConfigurationResult =\n await this.requester.getClientConfiguration(timestamp);\n\n if (!clientConfigurationResult.ok) {\n if (this.featureFlags.size) {\n // TODO: the case of silent fail should be logged when logging is implemented\n return Ok(true);\n }\n\n return clientConfigurationResult;\n }\n\n Utilities.sendOfflineTracking({\n storage: this.offlineTrackingStorage,\n requester: this.requester,\n });\n\n const { configuration, customData, featureFlags } =\n clientConfigurationResult.data;\n\n this.configurationData = { configuration, customData };\n\n for (const featureFlag of featureFlags) {\n this.featureFlagsData.set(featureFlag.featureKey, featureFlag);\n }\n\n if (customData?.length) {\n this.dataManager.customDataIndexes = customData;\n }\n\n this.dataManager.clearTrees();\n this.mappedRules?.clear();\n this.isTargetedDeliveryRule = null;\n this.segmentsData = null;\n\n const result = this.updateStorageData();\n\n if (!result.ok) {\n return result;\n }\n\n const updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n const toggleUpdateType = updateType !== this.updateType;\n\n if (toggleUpdateType) {\n this.updateType = updateType;\n await this.initialize();\n }\n\n // --- Note ---\n // Regarding GDPR policy we should set visitorCode if legal consent isn't required\n // or we have at least one Targeted Delivery rule in configuration\n const consentRequired =\n this.isConsentRequired && !this.hasAnyTargetedDeliveryRule;\n this.visitorCodeManager.consentRequired = consentRequired;\n\n return Ok(toggleUpdateType);\n }\n\n private updateStorageData(): Result<void, KameleoonError> {\n this.lastUpdate = new Date();\n\n const configurationData = {\n ...this.configurationData,\n featureFlags: Array.from(this.featureFlags.values()),\n };\n\n const data: ClientDataType = {\n data: configurationData,\n lastUpdate: this.lastUpdate.toString(),\n };\n\n UrlProvider.setDataApiDomain(\n this.configurationData.configuration.dataApiDomain,\n );\n\n return this.storage.write(data);\n }\n}\n"],"mappings":"y3CAqCO,KAAM,CAAAA,mBAAoD,CAoB/DC,WAAWA,CAAAC,CAAA,CAS2B,IAT1B,CACVC,QAAQ,CAARA,CAAQ,CACRC,OAAO,CAAPA,CAAO,CACPC,SAAS,CAATA,CAAS,CACTC,WAAW,CAAXA,CAAW,CACXC,2BAA2B,CAA3BA,CAA2B,CAC3BC,sBAAsB,CAAtBA,CAAsB,CACtBC,WAAW,CAAXA,CAAW,CACXC,0BAA0B,CAA1BA,CACiC,CAAC,CAAAR,CAAA,CAAAS,eAAA,4CAAAA,eAAA,sCA3ByB,IAAI,EAAAA,eAAA,mBAChCC,iBAAU,CAACC,IAAI,EAAAF,eAAA,0BAE9CG,qCAA0B,EAAAH,eAAA,yBAC6B,GAAI,CAAAI,GAAK,EAAAJ,eA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AAe,CAAGA,CAAe,CAElD,GAAAlG,SAAE,EAACiG,CAAgB,CAC5B,CAEQD,iBAAiBA,CAAA,CAAiC,CACxD,IAAI,CAAC7G,UAAU,CAAG,GAAI,CAAAC,IAAM,MAEtB,CAAA0B,CAAiB,CAAAsE,aAAA,CAAAA,aAAA,IAClB,IAAI,CAACtE,iBAAiB,MACzBE,YAAY,CAAEmF,KAAK,CAACC,IAAI,CAAC,IAAI,CAACpF,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC,EACrD,CAEKlB,CAAoB,CAAG,CAC3BA,IAAI,CAAEe,CAAiB,CACvB3B,UAAU,CAAE,IAAI,CAACA,UAAU,CAACmG,QAAQ,CAAC,CACvC,CAAC,CAMD,MAJA,CAAAL,wBAAW,CAACC,gBAAgB,CAC1B,IAAI,CAACpE,iBAAiB,CAACD,aAAa,CAACsE,aACvC,CAAC,CAEM,IAAI,CAAC5G,OAAO,CAAC8G,KAAK,CAACtF,CAAI,CAChC,CACF,CAACsG,OAAA,CAAAlI,mBAAA,CAAAA,mBAAA"}
|
|
1
|
+
{"version":3,"file":"clientConfiguration.js","names":["ClientConfiguration","constructor","a","updateInterval","storage","requester","dataManager","externalClientConfiguration","offlineTrackingStorage","eventSource","externalVisitorCodeManager","eventManager","_defineProperty","UpdateType","Idle","DEFAULT_CONFIGURATION_DATA","Map","lastUpdate","Date","visitorCodeManager","initialize","readStorageData","isExternalConfiguration","shouldUpdate","checkShouldUpdate","updateResult","updateClientConfiguration","ok","isUpdateTypeToggled","data","Ok","handleExternalUpdates","updateType","RealTime","isOpen","Polling","handlePollingUpdates","handleRealTimeUpdates","cleanupHandlers","close","updateConfigurationIntervalId","clearInterval","customData","configuration","featureFlags","configurationData","featureFlag","featureFlagsData","set","featureKey","updateEventCallback","timestamp","then","fireEvent","EventType","ConfigurationUpdate","open","setInterval","bind","err","segments","segmentsData","forEach","flag","rules","rule","segment","has","id","ruleMap","mappedRules","values","experimentId","variationByExposition","variationMap","variationKey","variationId","featureId","variations","isConsentRequired","consentType","ConsentType","Required","hasAnyTargetedDeliveryRule","isTargetedDeliveryRule","environmentEnabled","some","type","RuleType","TARGETED_DELIVERY","checkIntegrity","fields","Object","keys","length","requiredFields","DEFAULT_CLIENT_CONFIGURATION","sort","join","skipChecks","arguments","realTimeUpdate","size","lastUpdateTime","getTime","updateWindowEdge","now","result","read","isStorageValid","UrlProvider","setDataApiDomain","dataApiDomain","_objectSpread","write","toString","parse","b","clientConfigurationResult","getClientConfiguration","Utilities","sendOfflineTracking","customDataIndexes","clearTrees","clear","updateStorageData","toggleUpdateType","consentRequired","Array","from","exports"],"sources":["../../src/clientConfiguration/clientConfiguration.ts"],"sourcesContent":["import { Ok, Result } from 'ts-res';\nimport { KameleoonError } from 'src/kameleoonError/kameleoonError';\nimport { DataManager } from 'src/kameleoonData';\nimport { Requester } from 'src/requester';\nimport { SegmentType } from 'src/targeting';\nimport { ClientDataType } from 'src/storage';\nimport { IEventSource } from 'src/eventSource';\nimport {\n DEFAULT_CLIENT_CONFIGURATION,\n DEFAULT_CONFIGURATION_DATA,\n} from './constants';\nimport {\n ClientConfigurationDataType,\n ClientConfigurationParametersType,\n ConfigurationDataType,\n ConfigurationType,\n ConsentType,\n FeatureFlagType,\n MappedRuleType,\n RuleType,\n UpdateType,\n} from './types';\nimport { Utilities } from 'src/utilities';\nimport { IStorage, OfflineTracking } from 'src/storage/types';\nimport { IVisitorCodeManager } from 'src/visitorCodeManager';\nimport { EventManager, EventType } from 'src/eventManager';\nimport { UrlProvider } from 'src/requester/urlProvider';\n\ninterface IClientConfiguration {\n initialize: (useCache?: boolean) => Promise<Result<void, KameleoonError>>;\n readonly featureFlags: Map<string, FeatureFlagType>;\n readonly configuration: ConfigurationType;\n readonly segments: Map<string, SegmentType>;\n readonly ruleMap: Map<number, MappedRuleType>;\n}\n\nexport class ClientConfiguration implements IClientConfiguration {\n private updateConfigurationIntervalId: NodeJS.Timer | null = null;\n private updateType: UpdateType = UpdateType.Idle;\n private configurationData: ClientConfigurationDataType =\n DEFAULT_CONFIGURATION_DATA;\n private featureFlagsData: Map<string, FeatureFlagType> = new Map();\n private isTargetedDeliveryRule: boolean | null = null;\n private segmentsData: Map<string, SegmentType> | null = null;\n private updateInterval: number;\n private lastUpdate: Date;\n private storage: IStorage<ClientDataType>;\n private offlineTrackingStorage: IStorage<OfflineTracking>;\n private requester: Requester;\n private eventSource: IEventSource;\n private externalClientConfiguration?: ConfigurationDataType;\n private mappedRules: Map<number, MappedRuleType> | null = null;\n private dataManager: DataManager;\n private visitorCodeManager: IVisitorCodeManager;\n private eventManager: EventManager;\n\n constructor({\n updateInterval,\n storage,\n requester,\n dataManager,\n externalClientConfiguration,\n offlineTrackingStorage,\n eventSource,\n externalVisitorCodeManager,\n eventManager,\n }: ClientConfigurationParametersType) {\n this.requester = requester;\n this.updateInterval = updateInterval;\n this.lastUpdate = new Date();\n this.storage = storage;\n this.dataManager = dataManager;\n this.eventManager = eventManager;\n this.externalClientConfiguration = externalClientConfiguration;\n this.offlineTrackingStorage = offlineTrackingStorage;\n this.visitorCodeManager = externalVisitorCodeManager;\n this.eventSource = eventSource;\n }\n\n public async initialize(): Promise<Result<void, KameleoonError>> {\n this.readStorageData();\n\n const isExternalConfiguration = Boolean(this.externalClientConfiguration);\n const shouldUpdate = this.checkShouldUpdate(isExternalConfiguration);\n\n if (shouldUpdate) {\n const updateResult = await this.updateClientConfiguration();\n\n if (!updateResult.ok) {\n return updateResult;\n }\n\n // --- Note ---\n // If update type is being toggled `initialize` will be called again\n // so we don't need to continue execution here\n const isUpdateTypeToggled = updateResult.data;\n\n if (isUpdateTypeToggled) {\n return Ok();\n }\n }\n\n if (isExternalConfiguration) {\n this.handleExternalUpdates();\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.RealTime && !this.eventSource.isOpen) {\n this.updateType = UpdateType.Idle;\n this.handleRealTimeUpdates();\n\n return Ok();\n }\n\n if (this.updateType === UpdateType.Polling) {\n this.handlePollingUpdates();\n }\n\n return Ok();\n }\n\n private cleanupHandlers(): void {\n if (this.eventSource.isOpen) {\n this.eventSource.close();\n }\n\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n }\n\n private handleExternalUpdates(): void {\n this.cleanupHandlers();\n\n const { customData, configuration, featureFlags } =\n this.externalClientConfiguration!;\n this.configurationData = { customData, configuration };\n\n for (const featureFlag of featureFlags) {\n this.featureFlagsData.set(featureFlag.featureKey, featureFlag);\n }\n }\n\n private handleRealTimeUpdates(): void {\n this.cleanupHandlers();\n\n const updateEventCallback = (timestamp: number) => {\n this.updateClientConfiguration(timestamp).then((updateResult) => {\n if (updateResult.ok) {\n this.eventManager.fireEvent(EventType.ConfigurationUpdate, {\n timestamp,\n });\n }\n });\n };\n\n this.eventSource.open(updateEventCallback);\n }\n\n private handlePollingUpdates(): void {\n // --- Note ---\n // If `initialize` is called again the interval will be cleared\n // so theoretically we will constantly defer config update\n // but `this.lastUpdate` with `checkShouldUpdate` will prevent that\n this.cleanupHandlers();\n\n // --- Note ---\n // Error Handling is for `setInterval` emergency cleanup\n try {\n this.updateConfigurationIntervalId = setInterval(\n this.updateClientConfiguration.bind(this),\n this.updateInterval,\n );\n } catch (err) {\n if (this.updateConfigurationIntervalId) {\n clearInterval(this.updateConfigurationIntervalId);\n }\n\n throw err;\n }\n }\n\n get featureFlags(): Map<string, FeatureFlagType> {\n return this.featureFlagsData;\n }\n\n get configuration(): ConfigurationType {\n return this.configurationData.configuration;\n }\n\n get segments(): Map<string, SegmentType> {\n if (this.segmentsData) {\n return this.segmentsData;\n }\n\n const segmentsData = new Map<string, SegmentType>();\n\n this.featureFlagsData.forEach((flag) => {\n flag.rules.forEach((rule) => {\n if (rule.segment && !segmentsData.has(rule.segment.id)) {\n segmentsData.set(rule.segment.id, rule.segment);\n }\n });\n });\n\n this.segmentsData = segmentsData;\n\n return segmentsData;\n }\n\n get ruleMap(): Map<number, MappedRuleType> {\n if (this.mappedRules) {\n return this.mappedRules;\n }\n\n const mappedRules = new Map<number, MappedRuleType>();\n\n for (const featureFlag of this.featureFlags.values()) {\n for (const rule of featureFlag.rules) {\n const { id, experimentId, variationByExposition } = rule;\n const variationMap = new Map<string, number>();\n\n variationByExposition.forEach(({ variationKey, variationId }) => {\n if (typeof variationId === 'number') {\n variationMap.set(variationKey, variationId);\n }\n });\n\n mappedRules.set(id, {\n featureId: featureFlag.id,\n experimentId,\n variations: variationMap,\n });\n }\n }\n\n this.mappedRules = mappedRules;\n\n return mappedRules;\n }\n\n get isConsentRequired(): boolean {\n return this.configuration.consentType === ConsentType.Required;\n }\n\n get hasAnyTargetedDeliveryRule(): boolean {\n if (this.isTargetedDeliveryRule !== null) {\n return this.isTargetedDeliveryRule;\n }\n\n for (const featureFlag of this.featureFlags.values()) {\n if (\n featureFlag.environmentEnabled &&\n featureFlag.rules.some(\n (rule) => rule.type === RuleType.TARGETED_DELIVERY,\n )\n ) {\n return true;\n }\n }\n\n return false;\n }\n\n // --- Note ---\n // Integrity check covers most of the migration scenarios\n // however in the future it will be changed to a dedicate migration\n // block that can handle all versions migrations\n private checkIntegrity(data: ConfigurationDataType | undefined): boolean {\n if (!data) {\n return false;\n }\n\n const fields = Object.keys(data);\n\n if (!fields.length) {\n return false;\n }\n\n const requiredFields = Object.keys(DEFAULT_CLIENT_CONFIGURATION);\n\n return fields.sort().join() === requiredFields.sort().join();\n }\n\n private checkShouldUpdate(skipChecks = false): boolean {\n const { configuration } = this.configurationData;\n\n // --- Note ---\n // Following `updateType` logic is done for client side\n // edge cases where we have previous campaigns on storage already, but we still want\n // to initialize SSE/Polling after page reload\n if (skipChecks) {\n this.updateType = UpdateType.Idle;\n\n return false;\n }\n\n this.updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n if (!this.featureFlags.size) {\n return true;\n }\n\n const lastUpdateTime = this.lastUpdate.getTime();\n const updateWindowEdge = Date.now() - this.updateInterval;\n\n return lastUpdateTime < updateWindowEdge;\n }\n\n private readStorageData(): void {\n const result = this.storage.read();\n\n if (result.ok) {\n const { data, lastUpdate } = result.data;\n\n const isStorageValid = this.checkIntegrity(data);\n\n // --- Note ---\n // Cleaning up storage if it's not valid for migration purposes\n if (!isStorageValid) {\n UrlProvider.setDataApiDomain(\n DEFAULT_CONFIGURATION_DATA.configuration.dataApiDomain,\n );\n\n const data = {\n ...DEFAULT_CONFIGURATION_DATA,\n featureFlags: [],\n };\n\n this.storage.write({\n data,\n lastUpdate: this.lastUpdate.toString(),\n });\n\n this.configurationData = DEFAULT_CONFIGURATION_DATA;\n } else {\n UrlProvider.setDataApiDomain(data.configuration.dataApiDomain);\n\n const { featureFlags } = data;\n\n for (const featureFlag of featureFlags) {\n this.featureFlagsData.set(featureFlag.featureKey, featureFlag);\n }\n\n this.configurationData = data;\n this.lastUpdate = new Date(Date.parse(lastUpdate));\n }\n }\n }\n\n /**\n * Updates client configuration\n *\n * @param timeStamp - timestamp for real-time configuration update\n *\n * @returns `true` if current update type should be toggled (SSE/Polling)\n */\n private async updateClientConfiguration(\n timestamp?: number,\n ): Promise<Result<boolean, KameleoonError>> {\n const clientConfigurationResult =\n await this.requester.getClientConfiguration(timestamp);\n\n if (!clientConfigurationResult.ok) {\n if (this.featureFlags.size) {\n // TODO: the case of silent fail should be logged when logging is implemented\n return Ok(true);\n }\n\n return clientConfigurationResult;\n }\n\n Utilities.sendOfflineTracking({\n storage: this.offlineTrackingStorage,\n requester: this.requester,\n });\n\n const { configuration, customData, featureFlags } =\n clientConfigurationResult.data;\n\n this.configurationData = { configuration, customData };\n\n for (const featureFlag of featureFlags) {\n this.featureFlagsData.set(featureFlag.featureKey, featureFlag);\n }\n\n if (customData?.length) {\n this.dataManager.customDataIndexes = customData;\n }\n\n this.dataManager.clearTrees();\n this.mappedRules?.clear();\n this.isTargetedDeliveryRule = null;\n this.segmentsData = null;\n\n const result = this.updateStorageData();\n\n if (!result.ok) {\n return result;\n }\n\n const updateType = configuration.realTimeUpdate\n ? UpdateType.RealTime\n : UpdateType.Polling;\n\n const toggleUpdateType = updateType !== this.updateType;\n\n if (toggleUpdateType) {\n this.updateType = updateType;\n await this.initialize();\n }\n\n // --- Note ---\n // Regarding GDPR policy we should set visitorCode if legal consent isn't required\n // or we have at least one Targeted Delivery rule in configuration\n const consentRequired =\n this.isConsentRequired && !this.hasAnyTargetedDeliveryRule;\n this.visitorCodeManager.consentRequired = consentRequired;\n\n return Ok(toggleUpdateType);\n }\n\n private updateStorageData(): Result<void, KameleoonError> {\n this.lastUpdate = new Date();\n\n const configurationData = {\n ...this.configurationData,\n featureFlags: Array.from(this.featureFlags.values()),\n };\n\n const data: ClientDataType = {\n data: configurationData,\n lastUpdate: this.lastUpdate.toString(),\n };\n\n UrlProvider.setDataApiDomain(\n this.configurationData.configuration.dataApiDomain,\n );\n\n return this.storage.write(data);\n }\n}\n"],"mappings":"k6CAoCO,KAAM,CAAAA,mBAAoD,CAoB/DC,WAAWA,CAAAC,CAAA,CAU2B,IAV1B,CACVC,cAAc,CAAdA,CAAc,CACdC,OAAO,CAAPA,CAAO,CACPC,SAAS,CAATA,CAAS,CACTC,WAAW,CAAXA,CAAW,CACXC,2BAA2B,CAA3BA,CAA2B,CAC3BC,sBAAsB,CAAtBA,CAAsB,CACtBC,WAAW,CAAXA,CAAW,CACXC,0BAA0B,CAA1BA,CAA0B,CAC1BC,YAAY,CAAZA,CACiC,CAAC,CAAAT,CAAA,CAAAU,eAAA,sCA7ByB,IAAI,EAAAA,eAAA,mBAChCC,iBAAU,CAACC,IAAI,EAAAF,eAAA,0BAE9CG,qCAA0B,EAAAH,eAAA,yBAC6B,GAAI,CAAAI,GAAK,EAAAJ,eAAA,+BACjB,IAAI,EAAAA,eAAA,qBACG,IAAI,EAAAA,eAAA,+BAAAA,eAAA,2BAAAA,eAAA,wBAAAA,eAAA,uCAAAA,eAAA,0BAAAA,eAAA,4BAAAA,eAAA,4CAAAA,eAAA,oBAQF,IAAI,EAAAA,eAAA,4BAAAA,eAAA,mCAAAA,eAAA,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5B,CAEQD,iBAAiBA,CAAA,CAAiC,CACxD,IAAI,CAAC5G,UAAU,CAAG,GAAI,CAAAC,IAAM,MAEtB,CAAA2B,CAAiB,CAAAoE,aAAA,CAAAA,aAAA,IAClB,IAAI,CAACpE,iBAAiB,MACzBD,YAAY,CAAEoF,KAAK,CAACC,IAAI,CAAC,IAAI,CAACrF,YAAY,CAAC2B,MAAM,CAAC,CAAC,CAAC,EACrD,CAEK1C,CAAoB,CAAG,CAC3BA,IAAI,CAAEgB,CAAiB,CACvB5B,UAAU,CAAE,IAAI,CAACA,UAAU,CAACkG,QAAQ,CAAC,CACvC,CAAC,CAMD,MAJA,CAAAL,wBAAW,CAACC,gBAAgB,CAC1B,IAAI,CAAClE,iBAAiB,CAACF,aAAa,CAACqE,aACvC,CAAC,CAEM,IAAI,CAAC5G,OAAO,CAAC8G,KAAK,CAACrF,CAAI,CAChC,CACF,CAACqG,OAAA,CAAAlI,mBAAA,CAAAA,mBAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIGURATION_DATA=exports.DEFAULT_CLIENT_CONFIGURATION=void 0;
|
|
1
|
+
"use strict";var _types=require("./types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIGURATION_DATA=exports.DEFAULT_CLIENT_CONFIGURATION=void 0;const DEFAULT_CONFIGURATION_DATA=exports.DEFAULT_CONFIGURATION_DATA={customData:[],configuration:{realTimeUpdate:!1,consentType:_types.ConsentType.NotRequired,dataApiDomain:"data.kameleoon.io"}},DEFAULT_CLIENT_CONFIGURATION=exports.DEFAULT_CLIENT_CONFIGURATION={customData:[],featureFlags:[],configuration:{realTimeUpdate:!1,consentType:_types.ConsentType.NotRequired,dataApiDomain:"data.kameleoon.io"}};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":["_types","require","Object","defineProperty","exports","value","DEFAULT_CONFIGURATION_DATA","DEFAULT_CLIENT_CONFIGURATION","customData","configuration","realTimeUpdate","consentType","ConsentType","NotRequired","dataApiDomain","featureFlags"],"sources":["../../src/clientConfiguration/constants.ts"],"sourcesContent":["import {\n ClientConfigurationDataType,\n ConfigurationDataType,\n} from 'src/clientConfiguration';\nimport { ConsentType } from './types';\n\nexport const DEFAULT_CONFIGURATION_DATA: ClientConfigurationDataType = {\n customData: [],\n configuration: {\n realTimeUpdate: false,\n consentType: ConsentType.NotRequired,\n dataApiDomain: 'data.kameleoon.io',\n },\n};\n\nexport const DEFAULT_CLIENT_CONFIGURATION: ConfigurationDataType = {\n customData: [],\n featureFlags: [],\n configuration: {\n realTimeUpdate: false,\n consentType: ConsentType.NotRequired,\n dataApiDomain: 'data.kameleoon.io',\n },\n};\n"],"mappings":"aAIA,IAAAA,MAAA,CAAAC,OAAA,YAAsCC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,0BAAA,CAAAF,OAAA,CAAAG,4BAAA,aAEzB,CAAAD,0BAAuD,CAAAF,OAAA,CAAAE,0BAAA,CAAG,CACrEE,UAAU,CAAE,EAAE,CACdC,aAAa,CAAE,CACbC,cAAc,GAAO,CACrBC,WAAW,CAAEC,kBAAW,CAACC,WAAW,CACpCC,aAAa,CAAE,mBACjB,CACF,CAAC,CAEYP,4BAAmD,CAAAH,OAAA,CAAAG,4BAAA,CAAG,CACjEC,UAAU,CAAE,EAAE,CACdO,YAAY,CAAE,EAAE,CAChBN,aAAa,CAAE,CACbC,cAAc,GAAO,CACrBC,WAAW,CAAEC,kBAAW,CAACC,WAAW,CACpCC,aAAa,CAAE,mBACjB,CACF,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ClientSettingsType } from '../clientSettings';
|
|
2
1
|
import { IEventSource } from '../eventSource';
|
|
3
2
|
import { DataManager } from '../kameleoonData';
|
|
4
3
|
import { Requester } from '../requester';
|
|
@@ -6,6 +5,7 @@ import { IVisitorCodeManager } from '../visitorCodeManager';
|
|
|
6
5
|
import { ClientDataType, IStorage, OfflineTracking } from '../storage';
|
|
7
6
|
import { SegmentType } from '../targeting';
|
|
8
7
|
import { VariableType } from '../types';
|
|
8
|
+
import { EventManager } from '../eventManager';
|
|
9
9
|
export type ScheduleType = {
|
|
10
10
|
dateStart: string;
|
|
11
11
|
dateEnd: string;
|
|
@@ -108,11 +108,12 @@ export type ConfigurationType = {
|
|
|
108
108
|
dataApiDomain: string;
|
|
109
109
|
};
|
|
110
110
|
export type ClientConfigurationParametersType = {
|
|
111
|
-
|
|
111
|
+
updateInterval: number;
|
|
112
112
|
storage: IStorage<ClientDataType>;
|
|
113
113
|
dataManager: DataManager;
|
|
114
114
|
requester: Requester;
|
|
115
115
|
eventSource: IEventSource;
|
|
116
|
+
eventManager: EventManager;
|
|
116
117
|
offlineTrackingStorage: IStorage<OfflineTracking>;
|
|
117
118
|
externalClientConfiguration?: ConfigurationDataType;
|
|
118
119
|
externalVisitorCodeManager: IVisitorCodeManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["UpdateType","exports","Polling","RealTime","Idle","RuleType","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ConsentType","Required","NotRequired"],"sources":["../../src/clientConfiguration/types.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","names":["UpdateType","exports","Polling","RealTime","Idle","RuleType","TARGETED_DELIVERY","EXPERIMENTATION","FeatureFlagSdkLanguageType","ANDROID","SWIFT","JAVA","CSHARP","NODEJS","PHP","RUBY","GO","FLUTTER","REACTJS","FeatureStatus","ACTIVATED","DEACTIVATED","SCHEDULED","CustomDataScope","Visit","Visitor","Page","ConsentType","Required","NotRequired"],"sources":["../../src/clientConfiguration/types.ts"],"sourcesContent":["import { IEventSource } from 'src/eventSource';\nimport { DataManager } from 'src/kameleoonData';\nimport { Requester } from 'src/requester';\nimport { IVisitorCodeManager } from 'src/visitorCodeManager';\nimport { ClientDataType, IStorage, OfflineTracking } from 'src/storage';\nimport { SegmentType } from 'src/targeting';\nimport { VariableType } from 'src/types';\nimport { EventManager } from 'src/eventManager';\n\nexport type ScheduleType = {\n dateStart: string;\n dateEnd: string;\n};\n\nexport enum UpdateType {\n Polling,\n RealTime,\n Idle,\n}\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | JSONValue[];\n\nexport type JSONType = Record<string | number | symbol, JSONValue> | null;\n\nexport enum RuleType {\n TARGETED_DELIVERY = 'TARGETED_DELIVERY',\n EXPERIMENTATION = 'EXPERIMENTATION',\n}\n\nexport enum FeatureFlagSdkLanguageType {\n ANDROID = 'ANDROID',\n SWIFT = 'SWIFT',\n JAVA = 'JAVA',\n CSHARP = 'CSHARP',\n NODEJS = 'NODEJS',\n PHP = 'PHP',\n RUBY = 'RUBY',\n GO = 'GO',\n FLUTTER = 'FLUTTER',\n REACTJS = 'REACTJS',\n}\n\nexport enum FeatureStatus {\n ACTIVATED = 'ACTIVATED',\n DEACTIVATED = 'DEACTIVATED',\n SCHEDULED = 'SCHEDULED',\n}\n\nexport enum CustomDataScope {\n Visit = 'VISIT',\n Visitor = 'VISITOR',\n Page = 'Page',\n}\n\nexport enum ConsentType {\n Required = 'REQUIRED',\n NotRequired = 'NOT_REQUIRED',\n}\n\nexport type DeviationType = {\n variationId: string;\n value: number;\n};\n\nexport type FeatureFlagType = {\n id: number;\n featureKey: string;\n environmentEnabled: boolean;\n variations: FeatureVariationType[];\n defaultVariationKey: string;\n rules: RuleItemType[];\n};\n\nexport type FeatureVariationType = {\n key: string;\n variables: FeatureVariableType[];\n};\n\nexport type FeatureVariableType = {\n key: string;\n type: VariableType;\n value: string | number | boolean;\n};\n\nexport type RuleItemType = {\n type: RuleType;\n id: number;\n respoolTime: number | null;\n order: number;\n exposition: number;\n experimentId: number;\n variationByExposition: VariationByExpositionType[];\n segment: SegmentType | null;\n};\n\nexport type MappedRuleType = {\n experimentId: number;\n featureId: number;\n // --- Note ---\n // Map<variationKey, variationId>\n variations: Map<string, number>;\n};\n\nexport type VariationByExpositionType = {\n variationKey: string;\n variationId: number;\n exposition: number;\n};\n\nexport type ConfigurationDataType = {\n featureFlags: FeatureFlagType[];\n configuration: ConfigurationType;\n customData: CustomDataConfigurationType[];\n};\n\nexport type ClientConfigurationDataType = Omit<\n ConfigurationDataType,\n 'featureFlags'\n>;\n\nexport type CustomDataConfigurationType = {\n index: number;\n localOnly: boolean;\n isMappingIdentifier: boolean;\n scope: CustomDataScope;\n};\n\nexport type ConfigurationType = {\n realTimeUpdate: boolean;\n consentType: ConsentType;\n dataApiDomain: string;\n};\n\nexport type ClientConfigurationParametersType = {\n updateInterval: number;\n storage: IStorage<ClientDataType>;\n dataManager: DataManager;\n requester: Requester;\n eventSource: IEventSource;\n eventManager: EventManager;\n offlineTrackingStorage: IStorage<OfflineTracking>;\n externalClientConfiguration?: ConfigurationDataType;\n externalVisitorCodeManager: IVisitorCodeManager;\n};\n"],"mappings":"uNAcY,CAAAA,UAAU,CAAAC,OAAA,CAAAD,UAAA,UAAVA,CAAU,QAAV,CAAAA,CAAU,CAAVA,CAAU,CAAAE,OAAA,cAAVF,CAAU,CAAVA,CAAU,CAAAG,QAAA,eAAVH,CAAU,CAAVA,CAAU,CAAAI,IAAA,WAAVJ,CAAU,MAeVK,QAAQ,CAAAJ,OAAA,CAAAI,QAAA,UAARA,CAAQ,QAAR,CAAAA,CAAQ,CAAAC,iBAAA,qBAARD,CAAQ,CAAAE,eAAA,mBAARF,CAAQ,MAKRG,0BAA0B,CAAAP,OAAA,CAAAO,0BAAA,UAA1BA,CAA0B,QAA1B,CAAAA,CAA0B,CAAAC,OAAA,WAA1BD,CAA0B,CAAAE,KAAA,SAA1BF,CAA0B,CAAAG,IAAA,QAA1BH,CAA0B,CAAAI,MAAA,UAA1BJ,CAA0B,CAAAK,MAAA,UAA1BL,CAA0B,CAAAM,GAAA,OAA1BN,CAA0B,CAAAO,IAAA,QAA1BP,CAA0B,CAAAQ,EAAA,MAA1BR,CAA0B,CAAAS,OAAA,WAA1BT,CAA0B,CAAAU,OAAA,WAA1BV,CAA0B,MAa1BW,aAAa,CAAAlB,OAAA,CAAAkB,aAAA,UAAbA,CAAa,QAAb,CAAAA,CAAa,CAAAC,SAAA,aAAbD,CAAa,CAAAE,WAAA,eAAbF,CAAa,CAAAG,SAAA,aAAbH,CAAa,MAMbI,eAAe,CAAAtB,OAAA,CAAAsB,eAAA,UAAfA,CAAe,QAAf,CAAAA,CAAe,CAAAC,KAAA,SAAfD,CAAe,CAAAE,OAAA,WAAfF,CAAe,CAAAG,IAAA,QAAfH,CAAe,MAMfI,WAAW,CAAA1B,OAAA,CAAA0B,WAAA,UAAXA,CAAW,QAAX,CAAAA,CAAW,CAAAC,QAAA,YAAXD,CAAW,CAAAE,WAAA,gBAAXF,CAAW"}
|
|
@@ -5,8 +5,18 @@ export interface IClientSettings {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class ClientSettings implements IClientSettings {
|
|
7
7
|
private updateInterval;
|
|
8
|
-
private environment
|
|
8
|
+
private environment;
|
|
9
|
+
private networkDomain;
|
|
10
|
+
private requestTimeout;
|
|
9
11
|
private siteCode;
|
|
12
|
+
private cleanupInterval;
|
|
13
|
+
private configuration?;
|
|
14
|
+
private trackRetryDelay;
|
|
10
15
|
constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>);
|
|
16
|
+
private getEnvironment;
|
|
17
|
+
private getCleanupInterval;
|
|
18
|
+
private getUpdateInterval;
|
|
19
|
+
private getNetworkDomain;
|
|
20
|
+
private getRequestTimeout;
|
|
11
21
|
get settings(): ClientSettingsType;
|
|
12
22
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var _types=require("../types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClientSettings=void 0;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 ClientSettings{constructor(a,b){_defineProperty(this,"updateInterval",
|
|
1
|
+
"use strict";var _types=require("../types");Object.defineProperty(exports,"__esModule",{value:!0}),exports.ClientSettings=void 0;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 ClientSettings{constructor(a,b){_defineProperty(this,"updateInterval",void 0),_defineProperty(this,"environment",void 0),_defineProperty(this,"networkDomain",void 0),_defineProperty(this,"requestTimeout",void 0),_defineProperty(this,"siteCode",void 0),_defineProperty(this,"cleanupInterval",void 0),_defineProperty(this,"configuration",void 0),_defineProperty(this,"trackRetryDelay",void 0),this.siteCode=a,this.configuration=b,this.environment=this.getEnvironment(),this.networkDomain=this.getNetworkDomain(),this.updateInterval=this.getUpdateInterval(),this.cleanupInterval=this.getCleanupInterval(),this.requestTimeout=this.getRequestTimeout(),this.trackRetryDelay=5*_types.Milliseconds.Second}getEnvironment(){var a;return null!==(a=this.configuration)&&void 0!==a&&a.environment?this.configuration.environment:_types.Environment.Production}getCleanupInterval(){var a;return"number"==typeof(null===(a=this.configuration)||void 0===a?void 0:a.targetingDataCleanupInterval)?1>this.configuration.targetingDataCleanupInterval?1*_types.Milliseconds.Minute:this.configuration.targetingDataCleanupInterval*_types.Milliseconds.Minute:null}getUpdateInterval(){var a;return"number"==typeof(null===(a=this.configuration)||void 0===a?void 0:a.updateInterval)?1>this.configuration.updateInterval?1*_types.Milliseconds.Minute:this.configuration.updateInterval*_types.Milliseconds.Minute:60*_types.Milliseconds.Minute}getNetworkDomain(){var a;if(null!==(a=this.configuration)&&void 0!==a&&a.networkDomain){const a=this.configuration.networkDomain.split(".");return 2===a.length?this.configuration.networkDomain:null}return null}getRequestTimeout(){var a;return"number"==typeof(null===(a=this.configuration)||void 0===a?void 0:a.requestTimeout)?this.configuration.requestTimeout:10*_types.Milliseconds.Second}get settings(){return{trackRetryDelay:this.trackRetryDelay,cleanupInterval:this.cleanupInterval,updateInterval:this.updateInterval,requestTimeout:this.requestTimeout,networkDomain:this.networkDomain,environment:this.environment,siteCode:this.siteCode}}}exports.ClientSettings=ClientSettings;
|
|
2
2
|
//# sourceMappingURL=clientSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientSettings.js","names":["_types","require","Object","defineProperty","exports","value","ClientSettings","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","siteCode","configuration","Milliseconds","Minute","
|
|
1
|
+
{"version":3,"file":"clientSettings.js","names":["_types","require","Object","defineProperty","exports","value","ClientSettings","_defineProperty","a","b","c","_toPropertyKey","enumerable","configurable","writable","_toPrimitive","Symbol","toPrimitive","d","call","TypeError","String","Number","constructor","siteCode","configuration","environment","getEnvironment","networkDomain","getNetworkDomain","updateInterval","getUpdateInterval","cleanupInterval","getCleanupInterval","requestTimeout","getRequestTimeout","trackRetryDelay","Milliseconds","Second","Environment","Production","targetingDataCleanupInterval","Minute","parts","split","length","settings"],"sources":["../../src/clientSettings/clientSettings.ts"],"sourcesContent":["import { Environment, Milliseconds, SDKConfigurationType } from 'src/types';\nimport { ClientSettingsType } from './types';\n\nexport interface IClientSettings {\n readonly settings: ClientSettingsType;\n}\n\nexport class ClientSettings implements IClientSettings {\n private updateInterval: number;\n private environment: Environment;\n private networkDomain: string | null;\n private requestTimeout: number;\n private siteCode: string;\n private cleanupInterval: number | null;\n private configuration?: Partial<SDKConfigurationType>;\n private trackRetryDelay: number;\n\n constructor(siteCode: string, configuration?: Partial<SDKConfigurationType>) {\n this.siteCode = siteCode;\n this.configuration = configuration;\n\n this.environment = this.getEnvironment();\n this.networkDomain = this.getNetworkDomain();\n this.updateInterval = this.getUpdateInterval();\n this.cleanupInterval = this.getCleanupInterval();\n this.requestTimeout = this.getRequestTimeout();\n\n this.trackRetryDelay = 5 * Milliseconds.Second;\n }\n\n private getEnvironment(): Environment {\n if (this.configuration?.environment) {\n return this.configuration.environment;\n }\n\n return Environment.Production;\n }\n\n private getCleanupInterval(): number | null {\n if (typeof this.configuration?.targetingDataCleanupInterval === 'number') {\n if (this.configuration.targetingDataCleanupInterval < 1) {\n return 1 * Milliseconds.Minute;\n }\n\n return (\n this.configuration.targetingDataCleanupInterval * Milliseconds.Minute\n );\n }\n\n return null;\n }\n\n private getUpdateInterval(): number {\n if (typeof this.configuration?.updateInterval === 'number') {\n if (this.configuration.updateInterval < 1) {\n return 1 * Milliseconds.Minute;\n }\n\n return this.configuration.updateInterval * Milliseconds.Minute;\n }\n\n return 60 * Milliseconds.Minute;\n }\n\n private getNetworkDomain(): string | null {\n if (this.configuration?.networkDomain) {\n const parts = this.configuration.networkDomain.split('.');\n\n if (parts.length !== 2) {\n return null;\n }\n\n return this.configuration.networkDomain;\n }\n\n return null;\n }\n\n private getRequestTimeout(): number {\n if (typeof this.configuration?.requestTimeout === 'number') {\n return this.configuration.requestTimeout;\n }\n\n return 10 * Milliseconds.Second;\n }\n\n get settings(): ClientSettingsType {\n return {\n trackRetryDelay: this.trackRetryDelay,\n cleanupInterval: this.cleanupInterval,\n updateInterval: this.updateInterval,\n requestTimeout: this.requestTimeout,\n networkDomain: this.networkDomain,\n environment: this.environment,\n siteCode: this.siteCode,\n };\n }\n}\n"],"mappings":"aAAA,IAAAA,MAAA,CAAAC,OAAA,aAA4EC,MAAA,CAAAC,cAAA,CAAAC,OAAA,eAAAC,KAAA,MAAAD,OAAA,CAAAE,cAAA,iBAAAC,gBAAAC,CAAA,CAAAC,CAAA,CAAAC,CAAA,SAAAD,CAAA,CAAAE,cAAA,CAAAF,CAAA,EAAAA,CAAA,IAAAD,CAAA,CAAAN,MAAA,CAAAC,cAAA,CAAAK,CAAA,CAAAC,CAAA,EAAAJ,KAAA,CAAAK,CAAA,CAAAE,UAAA,IAAAC,YAAA,IAAAC,QAAA,MAAAN,CAAA,CAAAC,CAAA,EAAAC,CAAA,CAAAF,CAAA,UAAAG,eAAAH,CAAA,MAAAC,CAAA,CAAAM,YAAA,CAAAP,CAAA,kCAAAC,CAAA,CAAAA,CAAA,CAAAA,CAAA,aAAAM,aAAAP,CAAA,CAAAC,CAAA,sBAAAD,CAAA,GAAAA,CAAA,QAAAA,CAAA,KAAAE,CAAA,CAAAF,CAAA,CAAAQ,MAAA,CAAAC,WAAA,cAAAP,CAAA,MAAAQ,CAAA,CAAAR,CAAA,CAAAS,IAAA,CAAAX,CAAA,CAAAC,CAAA,iCAAAS,CAAA,QAAAA,CAAA,WAAAE,SAAA,mEAAAX,CAAA,CAAAY,MAAA,CAAAC,MAAA,EAAAd,CAAA,EAOrE,KAAM,CAAAF,cAA0C,CAUrDiB,WAAWA,CAACC,CAAgB,CAAEC,CAA6C,CAAE,CAAAlB,eAAA,+BAAAA,eAAA,4BAAAA,eAAA,8BAAAA,eAAA,+BAAAA,eAAA,yBAAAA,eAAA,gCAAAA,eAAA,8BAAAA,eAAA,gCAC3E,IAAI,CAACiB,QAAQ,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CAAGO,mBAAY,CAACK,MAAM,CAGzD,EAAE,CAAGL,mBAAY,CAACK,MAC3B,CAEQb,gBAAgBA,CAAA,CAAkB,KAAArB,CAAA,CACxC,WAAAA,CAAA,CAAI,IAAI,CAACiB,aAAa,YAAAjB,CAAA,EAAlBA,CAAA,CAAoBoB,aAAa,CAAE,CACrC,KAAM,CAAAe,CAAK,CAAG,IAAI,CAAClB,aAAa,CAACG,aAAa,CAACgB,KAAK,CAAC,GAAG,CAAC,CAAC,MAErC,EAAC,GAAlBD,CAAK,CAACE,MAAY,CAIf,IAAI,CAACpB,aAAa,CAACG,aAAa,CAH9B,IAIX,CAEA,MAAO,KACT,CAEQO,iBAAiBA,CAAA,CAAW,KAAA3B,CAAA,OACgB,QAAQ,EAAtD,eAAAA,CAAA,CAAO,IAAI,CAACiB,aAAa,YAAAjB,CAAA,QAAlBA,CAAA,CAAoB0B,cAAc,CAAa,CACjD,IAAI,CAACT,aAAa,CAACS,cAAc,CAGnC,EAAE,CAAGG,mBAAY,CAACC,MAC3B,CAEA,GAAI,CAAAQ,QAAQA,CAAA,CAAuB,CACjC,MAAO,CACLV,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCJ,eAAe,CAAE,IAAI,CAACA,eAAe,CACrCF,cAAc,CAAE,IAAI,CAACA,cAAc,CACnCI,cAAc,CAAE,IAAI,CAACA,cAAc,CACnCN,aAAa,CAAE,IAAI,CAACA,aAAa,CACjCF,WAAW,CAAE,IAAI,CAACA,WAAW,CAC7BF,QAAQ,CAAE,IAAI,CAACA,QACjB,CACF,CACF,CAACpB,OAAA,CAAAE,cAAA,CAAAA,cAAA"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Environment } from '../types';
|
|
2
2
|
export type ClientSettingsType = {
|
|
3
3
|
updateInterval: number;
|
|
4
|
-
environment
|
|
4
|
+
environment: Environment;
|
|
5
5
|
siteCode: string;
|
|
6
|
+
cleanupInterval: number | null;
|
|
7
|
+
networkDomain: string | null;
|
|
8
|
+
requestTimeout: number;
|
|
9
|
+
trackRetryDelay: number;
|
|
6
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/clientSettings/types.ts"],"sourcesContent":["import { Environment } from 'src/types';\n\nexport type ClientSettingsType = {\n updateInterval: number;\n environment
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/clientSettings/types.ts"],"sourcesContent":["import { Environment } from 'src/types';\n\nexport type ClientSettingsType = {\n updateInterval: number;\n environment: Environment;\n siteCode: string;\n cleanupInterval: number | null;\n networkDomain: string | null;\n requestTimeout: number;\n trackRetryDelay: number;\n};\n"],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EventCallbackType, EventDataType, EventType } from './types';
|
|
2
|
+
interface IEventManager<E extends EventType = EventType> {
|
|
3
|
+
addEventHandler(eventType: E, callback: EventCallbackType<E>): void;
|
|
4
|
+
fireEvent(eventType: E, data: EventDataType[E]): void;
|
|
5
|
+
}
|
|
6
|
+
export declare class EventManager implements IEventManager {
|
|
7
|
+
private eventHandlers?;
|
|
8
|
+
addEventHandler<E extends EventType>(eventType: E, callback: EventCallbackType<E>): void;
|
|
9
|
+
fireEvent<E extends EventType>(eventType: E, data: EventDataType[E]): void;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventManager=void 0;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 EventManager{constructor(){_defineProperty(this,"eventHandlers",void 0)}addEventHandler(a,b){this.eventHandlers||(this.eventHandlers=new Map),this.eventHandlers.set(a,b)}fireEvent(a,b){var c;const d=null===(c=this.eventHandlers)||void 0===c?void 0:c.get(a);d&&b&&d(b)}}exports.EventManager=EventManager;
|
|
2
|
+
//# sourceMappingURL=eventManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventManager.js","names":["EventManager","constructor","_defineProperty","addEventHandler","eventType","callback","eventHandlers","Map","set","fireEvent","data","c","eventHandler","get","exports"],"sources":["../../src/eventManager/eventManager.ts"],"sourcesContent":["import { EventCallbackType, EventDataType, EventType } from './types';\n\ninterface IEventManager<E extends EventType = EventType> {\n addEventHandler(eventType: E, callback: EventCallbackType<E>): void;\n fireEvent(eventType: E, data: EventDataType[E]): void;\n}\n\nexport class EventManager implements IEventManager {\n private eventHandlers?: Map<EventType, EventCallbackType<EventType>>;\n\n public addEventHandler<E extends EventType>(\n eventType: E,\n callback: EventCallbackType<E>,\n ): void {\n if (!this.eventHandlers) {\n this.eventHandlers = new Map();\n }\n\n this.eventHandlers.set(eventType, callback as EventCallbackType<EventType>);\n }\n\n public fireEvent<E extends EventType>(\n eventType: E,\n data: EventDataType[E],\n ): void {\n const eventHandler = this.eventHandlers?.get(eventType);\n\n if (eventHandler && data) {\n eventHandler(data);\n }\n }\n}\n"],"mappings":"mmBAOO,KAAM,CAAAA,YAAsC,CAAAC,YAAA,EAAAC,eAAA,8BAG1CC,eAAeA,CACpBC,CAAY,CACZC,CAA8B,CACxB,CACD,IAAI,CAACC,aAAa,GACrB,IAAI,CAACA,aAAa,CAAG,GAAI,CAAAC,GAAK,EAGhC,IAAI,CAACD,aAAa,CAACE,GAAG,CAACJ,CAAS,CAAEC,CAAwC,CAC5E,CAEOI,SAASA,CACdL,CAAY,CACZM,CAAsB,CAChB,KAAAC,CAAA,CACN,KAAM,CAAAC,CAAY,SAAAD,CAAA,CAAG,IAAI,CAACL,aAAa,YAAAK,CAAA,QAAlBA,CAAA,CAAoBE,GAAG,CAACT,CAAS,CAAC,CAEnDQ,CAAY,EAAIF,CAAI,EACtBE,CAAY,CAACF,CAAI,CAErB,CACF,CAACI,OAAA,CAAAd,YAAA,CAAAA,YAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ConfigurationUpdateEventDataType",{enumerable:!0,get:function(){return _types.ConfigurationUpdateEventDataType}}),Object.defineProperty(exports,"EvaluationEventDataType",{enumerable:!0,get:function(){return _types.EvaluationEventDataType}}),Object.defineProperty(exports,"EventCallbackType",{enumerable:!0,get:function(){return _types.EventCallbackType}}),Object.defineProperty(exports,"EventDataType",{enumerable:!0,get:function(){return _types.EventDataType}}),Object.defineProperty(exports,"EventManager",{enumerable:!0,get:function(){return _eventManager.EventManager}}),Object.defineProperty(exports,"EventType",{enumerable:!0,get:function(){return _types.EventType}});var _eventManager=require("./eventManager"),_types=require("./types");
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/eventManager/index.ts"],"sourcesContent":["export { EventManager } from './eventManager';\nexport {\n EventType,\n EventDataType,\n EventCallbackType,\n EvaluationEventDataType,\n ConfigurationUpdateEventDataType,\n} from './types';\n"],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @readonly
|
|
3
|
+
* @enum {string} an Enum containing all possible variants of event types
|
|
4
|
+
* */
|
|
5
|
+
export declare enum EventType {
|
|
6
|
+
Evaluation = "evaluation",
|
|
7
|
+
ConfigurationUpdate = "configurationUpdate"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @type EvaluationEventDataType - object containing information about the evaluation event data
|
|
11
|
+
* */
|
|
12
|
+
export type EvaluationEventDataType = {
|
|
13
|
+
featureKey: string;
|
|
14
|
+
variation: {
|
|
15
|
+
experimentId: number | null;
|
|
16
|
+
id: number | null;
|
|
17
|
+
key: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @type ConfigurationUpdateEventDataType - object containing information about the configuration update event data
|
|
22
|
+
* */
|
|
23
|
+
export type ConfigurationUpdateEventDataType = {
|
|
24
|
+
timestamp: number;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @type EventDataType - mapped type containing the link between `EventType` and the corresponding data type
|
|
28
|
+
* */
|
|
29
|
+
export type EventDataType = {
|
|
30
|
+
[EventType.Evaluation]: EvaluationEventDataType;
|
|
31
|
+
[EventType.ConfigurationUpdate]: ConfigurationUpdateEventDataType;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* @type EventCallbackType - a function that takes `EventDataType<EventType>` as an argument and returns `void`
|
|
35
|
+
* */
|
|
36
|
+
export type EventCallbackType<E extends EventType> = (eventData: EventDataType[E]) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["EventType","exports","Evaluation","ConfigurationUpdate"],"sources":["../../src/eventManager/types.ts"],"sourcesContent":["/**\n * @readonly\n * @enum {string} an Enum containing all possible variants of event types\n * */\nexport enum EventType {\n Evaluation = 'evaluation',\n ConfigurationUpdate = 'configurationUpdate',\n}\n\n/**\n * @type EvaluationEventDataType - object containing information about the evaluation event data\n * */\nexport type EvaluationEventDataType = {\n featureKey: string;\n variation: {\n experimentId: number | null;\n id: number | null;\n key: string;\n };\n};\n\n/**\n * @type ConfigurationUpdateEventDataType - object containing information about the configuration update event data\n * */\nexport type ConfigurationUpdateEventDataType = {\n timestamp: number;\n};\n\n/**\n * @type EventDataType - mapped type containing the link between `EventType` and the corresponding data type\n * */\nexport type EventDataType = {\n [EventType.Evaluation]: EvaluationEventDataType;\n [EventType.ConfigurationUpdate]: ConfigurationUpdateEventDataType;\n};\n\n/**\n * @type EventCallbackType - a function that takes `EventDataType<EventType>` as an argument and returns `void`\n * */\nexport type EventCallbackType<E extends EventType> = (\n eventData: EventDataType[E],\n) => void;\n"],"mappings":"gGAIY,CAAAA,SAAS,CAAAC,OAAA,CAAAD,SAAA,UAATA,CAAS,QAAT,CAAAA,CAAS,CAAAE,UAAA,cAATF,CAAS,CAAAG,mBAAA,uBAATH,CAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonEventSource=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KameleoonEventSource=void 0;var _urlProvider=require("../requester/urlProvider"),_constants=require("./constants");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 KameleoonEventSource{constructor(a,b){_defineProperty(this,"eventSource",void 0),_defineProperty(this,"siteCode",void 0),_defineProperty(this,"url",void 0),_defineProperty(this,"isConnectionOpen",void 0),this.url=_urlProvider.UrlProvider.getEventSourceUrl(),this.siteCode=a,this.eventSource=b,this.isConnectionOpen=!1}get isOpen(){return this.isConnectionOpen}open(a){this.eventSource.open({onEvent:this.handleMessage(a),url:this.url,eventType:_constants.REAL_TIME_EVENT}),this.isConnectionOpen=!0}close(){this.eventSource.close(),this.isConnectionOpen=!1}handleMessage(a){const b=b=>{const c=JSON.parse(b.data),{siteCode:d,ts:e}=c;this.siteCode===d&&a(e)};return b}}exports.KameleoonEventSource=KameleoonEventSource;
|
|
2
2
|
//# sourceMappingURL=eventSource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventSource.js","names":["KameleoonEventSource","constructor","siteCode","externalEventSource","_defineProperty","url","
|
|
1
|
+
{"version":3,"file":"eventSource.js","names":["KameleoonEventSource","constructor","siteCode","externalEventSource","_defineProperty","url","UrlProvider","getEventSourceUrl","eventSource","isConnectionOpen","isOpen","open","onEvent","handleMessage","eventType","REAL_TIME_EVENT","close","onMessage","message","event","JSON","parse","data","eventSiteCode","ts","exports"],"sources":["../../src/eventSource/eventSource.ts"],"sourcesContent":["import { UrlProvider } from 'src/requester/urlProvider';\nimport { REAL_TIME_EVENT } from './constants';\nimport {\n EventHandlerType,\n IExternalEventSource,\n RealTimeEventType,\n} from './types';\n\nexport interface IEventSource {\n readonly isOpen: boolean;\n open: (onEvent: EventHandlerType) => void;\n close: () => void;\n}\n\n// --- Note ---\n// Named `KameleoonEventSource` to avoid collision with native `EventSource`\nexport class KameleoonEventSource implements IEventSource {\n private eventSource: IExternalEventSource;\n private siteCode: string;\n private url: string;\n private isConnectionOpen: boolean;\n\n constructor(siteCode: string, externalEventSource: IExternalEventSource) {\n this.url = UrlProvider.getEventSourceUrl();\n this.siteCode = siteCode;\n this.eventSource = externalEventSource;\n this.isConnectionOpen = false;\n }\n\n get isOpen(): boolean {\n return this.isConnectionOpen;\n }\n\n public open(onEvent: EventHandlerType): void {\n this.eventSource.open({\n onEvent: this.handleMessage(onEvent),\n url: this.url,\n eventType: REAL_TIME_EVENT,\n });\n this.isConnectionOpen = true;\n }\n\n public close(): void {\n this.eventSource.close();\n this.isConnectionOpen = false;\n }\n\n private handleMessage(\n onEvent: EventHandlerType,\n ): (message: MessageEvent) => void {\n const onMessage = (message: MessageEvent): void => {\n const event: RealTimeEventType = JSON.parse(message.data);\n const { siteCode: eventSiteCode, ts } = event;\n\n if (this.siteCode === eventSiteCode) {\n onEvent(ts);\n }\n };\n\n return onMessage;\n }\n}\n"],"mappings":"ksBAgBO,KAAM,CAAAA,oBAA6C,CAMxDC,WAAWA,CAACC,CAAgB,CAAEC,CAAyC,CAAE,CAAAC,eAAA,4BAAAA,eAAA,yBAAAA,eAAA,oBAAAA,eAAA,iCACvE,IAAI,CAACC,GAAG,CAAGC,wBAAW,CAACC,iBAAiB,CAAC,CAAC,CAC1C,IAAI,CAACL,QAAQ,CAAGA,CAAQ,CACxB,IAAI,CAACM,WAAW,CAAGL,CAAmB,CACtC,IAAI,CAACM,gBAAgB,GACvB,CAEA,GAAI,CAAAC,MAAMA,CAAA,CAAY,CACpB,MAAO,KAAI,CAACD,gBACd,CAEOE,IAAIA,CAACC,CAAyB,CAAQ,CAC3C,IAAI,CAACJ,WAAW,CAACG,IAAI,CAAC,CACpBC,OAAO,CAAE,IAAI,CAACC,aAAa,CAACD,CAAO,CAAC,CACpCP,GAAG,CAAE,IAAI,CAACA,GAAG,CACbS,SAAS,CAAEC,0BACb,CAAC,CAAC,CACF,IAAI,CAACN,gBAAgB,GACvB,CAEOO,KAAKA,CAAA,CAAS,CACnB,IAAI,CAACR,WAAW,CAACQ,KAAK,CAAC,CAAC,CACxB,IAAI,CAACP,gBAAgB,GACvB,CAEQI,aAAaA,CACnBD,CAAyB,CACQ,CACjC,KAAM,CAAAK,CAAS,CAAIC,CAAqB,EAAW,MAC3C,CAAAC,CAAwB,CAAGC,IAAI,CAACC,KAAK,CAACH,CAAO,CAACI,IAAI,CAAC,CACnD,CAAEpB,QAAQ,CAAEqB,CAAa,CAAEC,EAAE,CAAFA,CAAG,CAAC,CAAGL,CAAK,CAEzC,IAAI,CAACjB,QAAQ,GAAKqB,CAAa,EACjCX,CAAO,CAACY,CAAE,CAEd,CAAC,CAED,MAAO,CAAAP,CACT,CACF,CAACQ,OAAA,CAAAzB,oBAAA,CAAAA,oBAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { Ok, Result, Err } from 'ts-res';
|
|
2
2
|
export { KameleoonClient as KameleoonCore } from './kameleoonClient';
|
|
3
3
|
export { IKameleoonClient as IKameleoonCore } from './kameleoonClientInterface';
|
|
4
|
-
export { KameleoonUtils
|
|
4
|
+
export { KameleoonUtils } from './kameleoonUtils';
|
|
5
5
|
export { KameleoonException, KameleoonError } from './kameleoonError';
|
|
6
6
|
export { VisitorDataFiltersType } from './utilities';
|
|
7
7
|
export { FeatureFlagVariationsType, KameleoonStorageKey, StorageDataType, IExternalStorage, } from './storage';
|
|
8
|
+
export { EventCallbackType, EventDataType, EventType, EvaluationEventDataType, ConfigurationUpdateEventDataType, } from './eventManager';
|
|
8
9
|
export { VisitorCodeManager, IVisitorCodeManager } from './visitorCodeManager';
|
|
9
10
|
export { VISITOR_CODE_LENGTH, SdkLanguageType } from './constants';
|
|
10
11
|
export { JSONType, ConfigurationDataType } from './clientConfiguration';
|
|
11
|
-
export { Environment, VariableType, FeatureFlagType, SDKCoreParameters, SDKConfigurationType, KameleoonVariationType, ExternalPackageInfoType, FeatureFlagVariableType, TrackConversionParamsType, FeatureVariableResultType, RemoteVisitorDataParamsType, InternalSDKConfigurationType, SetDataCallbackParametersType, GetFeatureFlagVariableParamsType, GetVisitorWarehouseAudienceParamsType, Milliseconds, } from './types';
|
|
12
|
-
export { DEFAULT_CLEANUP_INTERVAL } from './kameleoonData';
|
|
12
|
+
export { Environment, VariableType, FeatureFlagType, SDKCoreParameters, SDKConfigurationType, KameleoonVariationType, ExternalPackageInfoType, FeatureFlagVariableType, TrackConversionParamsType, FeatureVariableResultType, RemoteVisitorDataParamsType, InternalSDKConfigurationType, SetDataCallbackParametersType, GetFeatureFlagVariableParamsType, GetVisitorWarehouseAudienceParamsType, SimulateRequestDataType, Milliseconds, } from './types';
|
|
13
13
|
export { ApplicationVersion, CustomData, Conversion, Device, Cookie, Browser, UserAgent, DeviceType, CookieType, GeolocationData, GeolocationInfoType, OperatingSystemType, OperatingSystem, BrowserType, PageView, KameleoonData, KameleoonDataType, PageViewParametersType, ConversionParametersType, ApplicationVersionDataType, } from './kameleoonData';
|
|
14
14
|
export { IExternalEventSource, EventSourceOpenParametersType, } from './eventSource';
|
|
15
|
-
export { Header, HeadersType, HttpMethod, TrackParametersType,
|
|
15
|
+
export { Header, HeadersType, HttpMethod, TrackParametersType, IExternalRequester, RequestParametersType, RequestType, RetryCountType, KameleoonResponseType, SendRequestParametersType, NUMBER_OF_RETRIES, } from './requester';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _kameleoonData.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _kameleoonData.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _kameleoonData.Browser}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _kameleoonData.BrowserType}}),Object.defineProperty(exports,"ConfigurationDataType",{enumerable:!0,get:function(){return _clientConfiguration.ConfigurationDataType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _kameleoonData.Conversion}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _kameleoonData.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _kameleoonData.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _kameleoonData.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _kameleoonData.CustomData}}),Object.defineProperty(exports,"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ApplicationVersion",{enumerable:!0,get:function(){return _kameleoonData.ApplicationVersion}}),Object.defineProperty(exports,"ApplicationVersionDataType",{enumerable:!0,get:function(){return _kameleoonData.ApplicationVersionDataType}}),Object.defineProperty(exports,"Browser",{enumerable:!0,get:function(){return _kameleoonData.Browser}}),Object.defineProperty(exports,"BrowserType",{enumerable:!0,get:function(){return _kameleoonData.BrowserType}}),Object.defineProperty(exports,"ConfigurationDataType",{enumerable:!0,get:function(){return _clientConfiguration.ConfigurationDataType}}),Object.defineProperty(exports,"ConfigurationUpdateEventDataType",{enumerable:!0,get:function(){return _eventManager.ConfigurationUpdateEventDataType}}),Object.defineProperty(exports,"Conversion",{enumerable:!0,get:function(){return _kameleoonData.Conversion}}),Object.defineProperty(exports,"ConversionParametersType",{enumerable:!0,get:function(){return _kameleoonData.ConversionParametersType}}),Object.defineProperty(exports,"Cookie",{enumerable:!0,get:function(){return _kameleoonData.Cookie}}),Object.defineProperty(exports,"CookieType",{enumerable:!0,get:function(){return _kameleoonData.CookieType}}),Object.defineProperty(exports,"CustomData",{enumerable:!0,get:function(){return _kameleoonData.CustomData}}),Object.defineProperty(exports,"Device",{enumerable:!0,get:function(){return _kameleoonData.Device}}),Object.defineProperty(exports,"DeviceType",{enumerable:!0,get:function(){return _kameleoonData.DeviceType}}),Object.defineProperty(exports,"Environment",{enumerable:!0,get:function(){return _types.Environment}}),Object.defineProperty(exports,"Err",{enumerable:!0,get:function(){return _tsRes.Err}}),Object.defineProperty(exports,"EvaluationEventDataType",{enumerable:!0,get:function(){return _eventManager.EvaluationEventDataType}}),Object.defineProperty(exports,"EventCallbackType",{enumerable:!0,get:function(){return _eventManager.EventCallbackType}}),Object.defineProperty(exports,"EventDataType",{enumerable:!0,get:function(){return _eventManager.EventDataType}}),Object.defineProperty(exports,"EventSourceOpenParametersType",{enumerable:!0,get:function(){return _eventSource.EventSourceOpenParametersType}}),Object.defineProperty(exports,"EventType",{enumerable:!0,get:function(){return _eventManager.EventType}}),Object.defineProperty(exports,"ExternalPackageInfoType",{enumerable:!0,get:function(){return _types.ExternalPackageInfoType}}),Object.defineProperty(exports,"FeatureFlagType",{enumerable:!0,get:function(){return _types.FeatureFlagType}}),Object.defineProperty(exports,"FeatureFlagVariableType",{enumerable:!0,get:function(){return _types.FeatureFlagVariableType}}),Object.defineProperty(exports,"FeatureFlagVariationsType",{enumerable:!0,get:function(){return _storage.FeatureFlagVariationsType}}),Object.defineProperty(exports,"FeatureVariableResultType",{enumerable:!0,get:function(){return _types.FeatureVariableResultType}}),Object.defineProperty(exports,"GeolocationData",{enumerable:!0,get:function(){return _kameleoonData.GeolocationData}}),Object.defineProperty(exports,"GeolocationInfoType",{enumerable:!0,get:function(){return _kameleoonData.GeolocationInfoType}}),Object.defineProperty(exports,"GetFeatureFlagVariableParamsType",{enumerable:!0,get:function(){return _types.GetFeatureFlagVariableParamsType}}),Object.defineProperty(exports,"GetVisitorWarehouseAudienceParamsType",{enumerable:!0,get:function(){return _types.GetVisitorWarehouseAudienceParamsType}}),Object.defineProperty(exports,"Header",{enumerable:!0,get:function(){return _requester.Header}}),Object.defineProperty(exports,"HeadersType",{enumerable:!0,get:function(){return _requester.HeadersType}}),Object.defineProperty(exports,"HttpMethod",{enumerable:!0,get:function(){return _requester.HttpMethod}}),Object.defineProperty(exports,"IExternalEventSource",{enumerable:!0,get:function(){return _eventSource.IExternalEventSource}}),Object.defineProperty(exports,"IExternalRequester",{enumerable:!0,get:function(){return _requester.IExternalRequester}}),Object.defineProperty(exports,"IExternalStorage",{enumerable:!0,get:function(){return _storage.IExternalStorage}}),Object.defineProperty(exports,"IKameleoonCore",{enumerable:!0,get:function(){return _kameleoonClientInterface.IKameleoonClient}}),Object.defineProperty(exports,"IVisitorCodeManager",{enumerable:!0,get:function(){return _visitorCodeManager.IVisitorCodeManager}}),Object.defineProperty(exports,"InternalSDKConfigurationType",{enumerable:!0,get:function(){return _types.InternalSDKConfigurationType}}),Object.defineProperty(exports,"JSONType",{enumerable:!0,get:function(){return _clientConfiguration.JSONType}}),Object.defineProperty(exports,"KameleoonCore",{enumerable:!0,get:function(){return _kameleoonClient.KameleoonClient}}),Object.defineProperty(exports,"KameleoonData",{enumerable:!0,get:function(){return _kameleoonData.KameleoonData}}),Object.defineProperty(exports,"KameleoonDataType",{enumerable:!0,get:function(){return _kameleoonData.KameleoonDataType}}),Object.defineProperty(exports,"KameleoonError",{enumerable:!0,get:function(){return _kameleoonError.KameleoonError}}),Object.defineProperty(exports,"KameleoonException",{enumerable:!0,get:function(){return _kameleoonError.KameleoonException}}),Object.defineProperty(exports,"KameleoonResponseType",{enumerable:!0,get:function(){return _requester.KameleoonResponseType}}),Object.defineProperty(exports,"KameleoonStorageKey",{enumerable:!0,get:function(){return _storage.KameleoonStorageKey}}),Object.defineProperty(exports,"KameleoonUtils",{enumerable:!0,get:function(){return _kameleoonUtils.KameleoonUtils}}),Object.defineProperty(exports,"KameleoonVariationType",{enumerable:!0,get:function(){return _types.KameleoonVariationType}}),Object.defineProperty(exports,"Milliseconds",{enumerable:!0,get:function(){return _types.Milliseconds}}),Object.defineProperty(exports,"NUMBER_OF_RETRIES",{enumerable:!0,get:function(){return _requester.NUMBER_OF_RETRIES}}),Object.defineProperty(exports,"Ok",{enumerable:!0,get:function(){return _tsRes.Ok}}),Object.defineProperty(exports,"OperatingSystem",{enumerable:!0,get:function(){return _kameleoonData.OperatingSystem}}),Object.defineProperty(exports,"OperatingSystemType",{enumerable:!0,get:function(){return _kameleoonData.OperatingSystemType}}),Object.defineProperty(exports,"PageView",{enumerable:!0,get:function(){return _kameleoonData.PageView}}),Object.defineProperty(exports,"PageViewParametersType",{enumerable:!0,get:function(){return _kameleoonData.PageViewParametersType}}),Object.defineProperty(exports,"RemoteVisitorDataParamsType",{enumerable:!0,get:function(){return _types.RemoteVisitorDataParamsType}}),Object.defineProperty(exports,"RequestParametersType",{enumerable:!0,get:function(){return _requester.RequestParametersType}}),Object.defineProperty(exports,"RequestType",{enumerable:!0,get:function(){return _requester.RequestType}}),Object.defineProperty(exports,"Result",{enumerable:!0,get:function(){return _tsRes.Result}}),Object.defineProperty(exports,"RetryCountType",{enumerable:!0,get:function(){return _requester.RetryCountType}}),Object.defineProperty(exports,"SDKConfigurationType",{enumerable:!0,get:function(){return _types.SDKConfigurationType}}),Object.defineProperty(exports,"SDKCoreParameters",{enumerable:!0,get:function(){return _types.SDKCoreParameters}}),Object.defineProperty(exports,"SdkLanguageType",{enumerable:!0,get:function(){return _constants.SdkLanguageType}}),Object.defineProperty(exports,"SendRequestParametersType",{enumerable:!0,get:function(){return _requester.SendRequestParametersType}}),Object.defineProperty(exports,"SetDataCallbackParametersType",{enumerable:!0,get:function(){return _types.SetDataCallbackParametersType}}),Object.defineProperty(exports,"SimulateRequestDataType",{enumerable:!0,get:function(){return _types.SimulateRequestDataType}}),Object.defineProperty(exports,"StorageDataType",{enumerable:!0,get:function(){return _storage.StorageDataType}}),Object.defineProperty(exports,"TrackConversionParamsType",{enumerable:!0,get:function(){return _types.TrackConversionParamsType}}),Object.defineProperty(exports,"TrackParametersType",{enumerable:!0,get:function(){return _requester.TrackParametersType}}),Object.defineProperty(exports,"UserAgent",{enumerable:!0,get:function(){return _kameleoonData.UserAgent}}),Object.defineProperty(exports,"VISITOR_CODE_LENGTH",{enumerable:!0,get:function(){return _constants.VISITOR_CODE_LENGTH}}),Object.defineProperty(exports,"VariableType",{enumerable:!0,get:function(){return _types.VariableType}}),Object.defineProperty(exports,"VisitorCodeManager",{enumerable:!0,get:function(){return _visitorCodeManager.VisitorCodeManager}}),Object.defineProperty(exports,"VisitorDataFiltersType",{enumerable:!0,get:function(){return _utilities.VisitorDataFiltersType}});var _tsRes=require("ts-res"),_kameleoonClient=require("./kameleoonClient"),_kameleoonClientInterface=require("./kameleoonClientInterface"),_kameleoonUtils=require("./kameleoonUtils"),_kameleoonError=require("./kameleoonError"),_utilities=require("./utilities"),_storage=require("./storage"),_eventManager=require("./eventManager"),_visitorCodeManager=require("./visitorCodeManager"),_constants=require("./constants"),_clientConfiguration=require("./clientConfiguration"),_types=require("./types"),_kameleoonData=require("./kameleoonData"),_eventSource=require("./eventSource"),_requester=require("./requester");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|