@ninetailed/experience.js 3.5.0-beta.1 → 3.5.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/index.cjs CHANGED
@@ -2590,6 +2590,7 @@ const PROFILE_FALLBACK_CACHE = '__nt_profile__';
2590
2590
  const PROFILE_CHANGE = 'profile-change';
2591
2591
  const PROFILE_RESET = 'profile-reset';
2592
2592
  const CONSENT = '__nt-consent__';
2593
+ const SET_ENABLED_FEATURES = 'set-enabled-features';
2593
2594
  const EMPTY_MERGE_ID = 'nt:empty-merge-id';
2594
2595
 
2595
2596
  const PLUGIN_NAME = 'ninetailed';
@@ -2602,6 +2603,7 @@ const ninetailedPlugin = ({
2602
2603
  }) => {
2603
2604
  let _instance;
2604
2605
  let queue = [];
2606
+ let enabledFeatures = Object.values(experience_jsShared.FEATURES);
2605
2607
  const flush = () => __awaiter(void 0, void 0, void 0, function* () {
2606
2608
  const events = Object.assign([], queue);
2607
2609
  experience_jsShared.logger.info('Start flushing events.');
@@ -2618,7 +2620,7 @@ const ninetailedPlugin = ({
2618
2620
  events
2619
2621
  }, {
2620
2622
  locale,
2621
- enabledFeatures: Object.values(experience_jsShared.FEATURES)
2623
+ enabledFeatures
2622
2624
  });
2623
2625
  _instance.storage.setItem(ANONYMOUS_ID, profile.id);
2624
2626
  _instance.storage.setItem(PROFILE_FALLBACK_CACHE, profile);
@@ -2690,6 +2692,12 @@ const ninetailedPlugin = ({
2690
2692
  if (profile) {
2691
2693
  instance.storage.setItem(ANONYMOUS_ID, profile.id);
2692
2694
  }
2695
+ instance.on(SET_ENABLED_FEATURES, ({
2696
+ payload
2697
+ }) => {
2698
+ console.log('setEnabledFeatues');
2699
+ enabledFeatures = payload.features || [];
2700
+ });
2693
2701
  experience_jsShared.logger.debug('Ninetailed Core plugin initialized.');
2694
2702
  },
2695
2703
  flush: asyncThrottle(flush),
@@ -4333,6 +4341,7 @@ exports.PLUGIN_NAME = PLUGIN_NAME;
4333
4341
  exports.PROFILE_CHANGE = PROFILE_CHANGE;
4334
4342
  exports.PROFILE_FALLBACK_CACHE = PROFILE_FALLBACK_CACHE;
4335
4343
  exports.PROFILE_RESET = PROFILE_RESET;
4344
+ exports.SET_ENABLED_FEATURES = SET_ENABLED_FEATURES;
4336
4345
  exports.decodeExperienceVariantsMap = decodeExperienceVariantsMap;
4337
4346
  exports.isExperienceMatch = isExperienceMatch;
4338
4347
  exports.ninetailedPlugin = ninetailedPlugin;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import unionBy from 'lodash/unionBy';
2
- import { logger, ConsoleLogSink, buildPageEvent, buildTrackEvent, buildIdentifyEvent, FEATURES, NinetailedApiClient, OnLogLogSink, OnErrorLogSink, PageviewProperties, Properties, Traits } from '@ninetailed/experience.js-shared';
2
+ import { FEATURES, logger, ConsoleLogSink, buildPageEvent, buildTrackEvent, buildIdentifyEvent, NinetailedApiClient, OnLogLogSink, OnErrorLogSink, PageviewProperties, Properties, Traits } from '@ninetailed/experience.js-shared';
3
3
  import Analytics from 'analytics';
4
4
  import { HAS_SEEN_EXPERIENCE, HAS_SEEN_COMPONENT } from '@ninetailed/experience.js-plugin-analytics';
5
5
  import flatten from 'lodash/flatten';
@@ -2577,6 +2577,7 @@ const PROFILE_FALLBACK_CACHE = '__nt_profile__';
2577
2577
  const PROFILE_CHANGE = 'profile-change';
2578
2578
  const PROFILE_RESET = 'profile-reset';
2579
2579
  const CONSENT = '__nt-consent__';
2580
+ const SET_ENABLED_FEATURES = 'set-enabled-features';
2580
2581
  const EMPTY_MERGE_ID = 'nt:empty-merge-id';
2581
2582
 
2582
2583
  const PLUGIN_NAME = 'ninetailed';
@@ -2589,6 +2590,7 @@ const ninetailedPlugin = ({
2589
2590
  }) => {
2590
2591
  let _instance;
2591
2592
  let queue = [];
2593
+ let enabledFeatures = Object.values(FEATURES);
2592
2594
  const flush = () => __awaiter(void 0, void 0, void 0, function* () {
2593
2595
  const events = Object.assign([], queue);
2594
2596
  logger.info('Start flushing events.');
@@ -2605,7 +2607,7 @@ const ninetailedPlugin = ({
2605
2607
  events
2606
2608
  }, {
2607
2609
  locale,
2608
- enabledFeatures: Object.values(FEATURES)
2610
+ enabledFeatures
2609
2611
  });
2610
2612
  _instance.storage.setItem(ANONYMOUS_ID, profile.id);
2611
2613
  _instance.storage.setItem(PROFILE_FALLBACK_CACHE, profile);
@@ -2677,6 +2679,12 @@ const ninetailedPlugin = ({
2677
2679
  if (profile) {
2678
2680
  instance.storage.setItem(ANONYMOUS_ID, profile.id);
2679
2681
  }
2682
+ instance.on(SET_ENABLED_FEATURES, ({
2683
+ payload
2684
+ }) => {
2685
+ console.log('setEnabledFeatues');
2686
+ enabledFeatures = payload.features || [];
2687
+ });
2680
2688
  logger.debug('Ninetailed Core plugin initialized.');
2681
2689
  },
2682
2690
  flush: asyncThrottle(flush),
@@ -4309,4 +4317,4 @@ const decodeExperienceVariantsMap = encodedExperienceVariantsMap => {
4309
4317
  }), {});
4310
4318
  };
4311
4319
 
4312
- export { ANONYMOUS_ID, CONSENT, DEBUG_FLAG, EMPTY_MERGE_ID, EXPERIENCE_TRAIT_PREFIX, LEGACY_ANONYMOUS_ID, Ninetailed, PLUGIN_NAME, PROFILE_CHANGE, PROFILE_FALLBACK_CACHE, PROFILE_RESET, decodeExperienceVariantsMap, isExperienceMatch, ninetailedPlugin, selectActiveExperiments, selectDistribution, selectEligibleExperiences, selectExperience, selectBaselineWithVariants as selectExperienceBaselineWithVariants, selectVariant as selectExperienceVariant, selectVariants as selectExperienceVariants, selectHasVariants as selectHasExperienceVariants, selectVariant$1 as selectVariant };
4320
+ export { ANONYMOUS_ID, CONSENT, DEBUG_FLAG, EMPTY_MERGE_ID, EXPERIENCE_TRAIT_PREFIX, LEGACY_ANONYMOUS_ID, Ninetailed, PLUGIN_NAME, PROFILE_CHANGE, PROFILE_FALLBACK_CACHE, PROFILE_RESET, SET_ENABLED_FEATURES, decodeExperienceVariantsMap, isExperienceMatch, ninetailedPlugin, selectActiveExperiments, selectDistribution, selectEligibleExperiences, selectExperience, selectBaselineWithVariants as selectExperienceBaselineWithVariants, selectVariant as selectExperienceVariant, selectVariants as selectExperienceVariants, selectHasVariants as selectHasExperienceVariants, selectVariant$1 as selectVariant };
@@ -5,4 +5,5 @@ export declare const PROFILE_FALLBACK_CACHE = "__nt_profile__";
5
5
  export declare const PROFILE_CHANGE = "profile-change";
6
6
  export declare const PROFILE_RESET = "profile-reset";
7
7
  export declare const CONSENT = "__nt-consent__";
8
+ export declare const SET_ENABLED_FEATURES = "set-enabled-features";
8
9
  export declare const EMPTY_MERGE_ID = "nt:empty-merge-id";
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "3.5.0-beta.1",
3
+ "version": "3.5.0",
4
4
  "module": "./index.js",
5
5
  "main": "./index.cjs",
6
6
  "type": "module",
7
7
  "types": "./index.d.ts",
8
8
  "dependencies": {
9
- "@ninetailed/experience.js-shared": "3.5.0-beta.1",
9
+ "@ninetailed/experience.js-shared": "3.5.0",
10
10
  "analytics": "0.8.1",
11
11
  "lodash": "4.17.21",
12
12
  "murmurhash-js": "1.0.0",
13
- "@ninetailed/experience.js-plugin-analytics": "3.5.0-beta.1"
13
+ "@ninetailed/experience.js-plugin-analytics": "3.5.0"
14
14
  },
15
15
  "peerDependencies": {}
16
16
  }