@ninetailed/experience.js-plugin-preview 4.0.0-beta.6 → 4.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs +12 -6
  2. package/index.js +12 -6
  3. package/package.json +7 -7
package/index.cjs CHANGED
@@ -3186,6 +3186,9 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3186
3186
  console.log(`You cannot activate an unkown audience (id: ${id}).`);
3187
3187
  return;
3188
3188
  }
3189
+ this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3190
+ [id]: true
3191
+ });
3189
3192
  // When a audience is activated, they should show their natural state
3190
3193
  this.experiences.filter(experience => {
3191
3194
  var _b;
@@ -3193,9 +3196,6 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3193
3196
  }).forEach(experience => {
3194
3197
  this.resetExperience(experience.id);
3195
3198
  });
3196
- this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3197
- [id]: true
3198
- });
3199
3199
  this.onChange();
3200
3200
  }
3201
3201
  deactivateAudience(id) {
@@ -3325,7 +3325,9 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3325
3325
  return {};
3326
3326
  }
3327
3327
  const experiments = this.experiences.filter(experience => experience.type === 'nt_experiment');
3328
- const activeExperiments = experience_js.selectActiveExperiments(experiments, profile);
3328
+ const activeExperiments = experience_js.selectActiveExperiments(experiments, Object.assign(Object.assign({}, profile), {
3329
+ audiences: this.activeAudiences
3330
+ }));
3329
3331
  const eligibleExperiences = experience_js.selectEligibleExperiences({
3330
3332
  experiences: this.experiences,
3331
3333
  activeExperiments
@@ -3333,12 +3335,16 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3333
3335
  const matchedExperiences = eligibleExperiences.filter(experience => experience_js.isExperienceMatch({
3334
3336
  experience,
3335
3337
  activeExperiments,
3336
- profile
3338
+ profile: Object.assign(Object.assign({}, profile), {
3339
+ audiences: this.activeAudiences
3340
+ })
3337
3341
  }));
3338
3342
  return matchedExperiences.reduce((acc, experience) => {
3339
3343
  const distribution = experience_js.selectDistribution({
3340
3344
  experience,
3341
- profile
3345
+ profile: Object.assign(Object.assign({}, profile), {
3346
+ audiences: this.activeAudiences
3347
+ })
3342
3348
  });
3343
3349
  return Object.assign(Object.assign({}, acc), {
3344
3350
  [experience.id]: distribution.index
package/index.js CHANGED
@@ -3164,6 +3164,9 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3164
3164
  console.log(`You cannot activate an unkown audience (id: ${id}).`);
3165
3165
  return;
3166
3166
  }
3167
+ this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3168
+ [id]: true
3169
+ });
3167
3170
  // When a audience is activated, they should show their natural state
3168
3171
  this.experiences.filter(experience => {
3169
3172
  var _b;
@@ -3171,9 +3174,6 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3171
3174
  }).forEach(experience => {
3172
3175
  this.resetExperience(experience.id);
3173
3176
  });
3174
- this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3175
- [id]: true
3176
- });
3177
3177
  this.onChange();
3178
3178
  }
3179
3179
  deactivateAudience(id) {
@@ -3303,7 +3303,9 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3303
3303
  return {};
3304
3304
  }
3305
3305
  const experiments = this.experiences.filter(experience => experience.type === 'nt_experiment');
3306
- const activeExperiments = selectActiveExperiments(experiments, profile);
3306
+ const activeExperiments = selectActiveExperiments(experiments, Object.assign(Object.assign({}, profile), {
3307
+ audiences: this.activeAudiences
3308
+ }));
3307
3309
  const eligibleExperiences = selectEligibleExperiences({
3308
3310
  experiences: this.experiences,
3309
3311
  activeExperiments
@@ -3311,12 +3313,16 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3311
3313
  const matchedExperiences = eligibleExperiences.filter(experience => isExperienceMatch({
3312
3314
  experience,
3313
3315
  activeExperiments,
3314
- profile
3316
+ profile: Object.assign(Object.assign({}, profile), {
3317
+ audiences: this.activeAudiences
3318
+ })
3315
3319
  }));
3316
3320
  return matchedExperiences.reduce((acc, experience) => {
3317
3321
  const distribution = selectDistribution({
3318
3322
  experience,
3319
- profile
3323
+ profile: Object.assign(Object.assign({}, profile), {
3324
+ audiences: this.activeAudiences
3325
+ })
3320
3326
  });
3321
3327
  return Object.assign(Object.assign({}, acc), {
3322
3328
  [experience.id]: distribution.index
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-plugin-preview",
3
- "version": "4.0.0-beta.6",
3
+ "version": "4.0.0-beta.8",
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": "4.0.0-beta.6",
10
- "@ninetailed/experience.js": "4.0.0-beta.6",
11
- "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.6",
12
- "@ninetailed/experience.js-utils": "4.0.0-beta.5",
13
- "@ninetailed/experience.js-react": "4.0.0-beta.6",
14
- "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.6",
9
+ "@ninetailed/experience.js-shared": "4.0.0-beta.8",
10
+ "@ninetailed/experience.js": "4.0.0-beta.8",
11
+ "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.8",
12
+ "@ninetailed/experience.js-utils": "4.0.0-beta.7",
13
+ "@ninetailed/experience.js-react": "4.0.0-beta.8",
14
+ "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.8",
15
15
  "react": "18.2.0",
16
16
  "uuid": "9.0.0"
17
17
  },