@ninetailed/experience.js-plugin-preview 4.0.0-beta.3 → 4.0.0-beta.5

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
@@ -3196,17 +3196,20 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3196
3196
  console.log(`You cannot deactivate an unkown audience (id: ${id}). How did you get it in the first place?`);
3197
3197
  return;
3198
3198
  }
3199
- this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3200
- [id]: false
3201
- });
3202
- this.onChange();
3203
3199
  // When a audience is deactivated, the normal state will be that the experience goes into the control
3204
3200
  this.experiences.filter(experience => {
3205
3201
  var _b;
3206
3202
  return ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id) === id;
3207
3203
  }).forEach(experience => {
3208
- this.resetExperience(experience.id);
3204
+ this.setExperienceVariant({
3205
+ experienceId: experience.id,
3206
+ variantIndex: 0
3207
+ });
3209
3208
  });
3209
+ this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3210
+ [id]: false
3211
+ });
3212
+ this.onChange();
3210
3213
  }
3211
3214
  resetAudience(id) {
3212
3215
  if (!this.isKnownAudience(id)) {
@@ -3220,7 +3223,7 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3220
3223
  this.audienceOverwrites = audienceOverwrites;
3221
3224
  this.onChange();
3222
3225
  }
3223
- selectVariant({
3226
+ setExperienceVariant({
3224
3227
  experienceId,
3225
3228
  variantIndex
3226
3229
  }) {
@@ -3274,7 +3277,7 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3274
3277
  apiAudiences: ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.audiences) || [],
3275
3278
  audienceOverwrites: this.audienceOverwrites,
3276
3279
  activeAudiences: this.activeAudiences,
3277
- setExperienceVariant: this.selectVariant.bind(this),
3280
+ setExperienceVariant: this.setExperienceVariant.bind(this),
3278
3281
  resetExperience: this.resetExperience.bind(this),
3279
3282
  experienceVariantIndexes: Object.assign(Object.assign({}, this.experienceVariantIndexes), this.experienceVariantIndexOverwrites),
3280
3283
  experienceVariantIndexOverwrites: this.experienceVariantIndexOverwrites,
@@ -3292,7 +3295,7 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3292
3295
  deactivateAudience: this.deactivateAudience.bind(this),
3293
3296
  resetAudience: this.resetAudience.bind(this),
3294
3297
  activeAudiences: this.activeAudiences,
3295
- setExperienceVariant: this.selectVariant.bind(this),
3298
+ setExperienceVariant: this.setExperienceVariant.bind(this),
3296
3299
  resetExperience: this.resetExperience.bind(this),
3297
3300
  experienceVariantIndexes: Object.assign(Object.assign({}, this.experienceVariantIndexes), this.experienceVariantIndexOverwrites)
3298
3301
  };
package/index.js CHANGED
@@ -3174,17 +3174,20 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3174
3174
  console.log(`You cannot deactivate an unkown audience (id: ${id}). How did you get it in the first place?`);
3175
3175
  return;
3176
3176
  }
3177
- this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3178
- [id]: false
3179
- });
3180
- this.onChange();
3181
3177
  // When a audience is deactivated, the normal state will be that the experience goes into the control
3182
3178
  this.experiences.filter(experience => {
3183
3179
  var _b;
3184
3180
  return ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id) === id;
3185
3181
  }).forEach(experience => {
3186
- this.resetExperience(experience.id);
3182
+ this.setExperienceVariant({
3183
+ experienceId: experience.id,
3184
+ variantIndex: 0
3185
+ });
3187
3186
  });
3187
+ this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
3188
+ [id]: false
3189
+ });
3190
+ this.onChange();
3188
3191
  }
3189
3192
  resetAudience(id) {
3190
3193
  if (!this.isKnownAudience(id)) {
@@ -3198,7 +3201,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3198
3201
  this.audienceOverwrites = audienceOverwrites;
3199
3202
  this.onChange();
3200
3203
  }
3201
- selectVariant({
3204
+ setExperienceVariant({
3202
3205
  experienceId,
3203
3206
  variantIndex
3204
3207
  }) {
@@ -3252,7 +3255,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3252
3255
  apiAudiences: ((_b = this.profile) === null || _b === void 0 ? void 0 : _b.audiences) || [],
3253
3256
  audienceOverwrites: this.audienceOverwrites,
3254
3257
  activeAudiences: this.activeAudiences,
3255
- setExperienceVariant: this.selectVariant.bind(this),
3258
+ setExperienceVariant: this.setExperienceVariant.bind(this),
3256
3259
  resetExperience: this.resetExperience.bind(this),
3257
3260
  experienceVariantIndexes: Object.assign(Object.assign({}, this.experienceVariantIndexes), this.experienceVariantIndexOverwrites),
3258
3261
  experienceVariantIndexOverwrites: this.experienceVariantIndexOverwrites,
@@ -3270,7 +3273,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3270
3273
  deactivateAudience: this.deactivateAudience.bind(this),
3271
3274
  resetAudience: this.resetAudience.bind(this),
3272
3275
  activeAudiences: this.activeAudiences,
3273
- setExperienceVariant: this.selectVariant.bind(this),
3276
+ setExperienceVariant: this.setExperienceVariant.bind(this),
3274
3277
  resetExperience: this.resetExperience.bind(this),
3275
3278
  experienceVariantIndexes: Object.assign(Object.assign({}, this.experienceVariantIndexes), this.experienceVariantIndexOverwrites)
3276
3279
  };
@@ -40,7 +40,7 @@ export declare class NinetailedPreviewPlugin extends NinetailedPlugin {
40
40
  activateAudience(id: string): void;
41
41
  deactivateAudience(id: string): void;
42
42
  resetAudience(id: string): void;
43
- selectVariant({ experienceId, variantIndex, }: {
43
+ setExperienceVariant({ experienceId, variantIndex, }: {
44
44
  experienceId: string;
45
45
  variantIndex: number;
46
46
  }): void;
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-plugin-preview",
3
- "version": "4.0.0-beta.3",
3
+ "version": "4.0.0-beta.5",
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.3",
10
- "@ninetailed/experience.js": "4.0.0-beta.3",
11
- "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.3",
12
- "@ninetailed/experience.js-utils": "4.0.0-beta.2",
13
- "@ninetailed/experience.js-react": "4.0.0-beta.3",
14
- "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.3",
9
+ "@ninetailed/experience.js-shared": "4.0.0-beta.5",
10
+ "@ninetailed/experience.js": "4.0.0-beta.5",
11
+ "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.5",
12
+ "@ninetailed/experience.js-utils": "4.0.0-beta.4",
13
+ "@ninetailed/experience.js-react": "4.0.0-beta.5",
14
+ "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.5",
15
15
  "react": "18.2.0",
16
16
  "uuid": "9.0.0"
17
17
  },