@ninetailed/experience.js-plugin-preview 4.0.0-beta.1 → 4.0.0-beta.2

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 +10 -0
  2. package/index.js +10 -0
  3. package/package.json +7 -7
package/index.cjs CHANGED
@@ -3046,16 +3046,19 @@ const PreviewRenderPlugin = ctx => {
3046
3046
  return overWrittenExperienceIds.includes(experience.id);
3047
3047
  });
3048
3048
  if (!overWrittenExperience) {
3049
+ setComponentProps({});
3049
3050
  return;
3050
3051
  }
3051
3052
  const baselineComponent = overWrittenExperience.components.find(component => component.baseline.id === baseline.id);
3052
3053
  if (!baselineComponent) {
3054
+ setComponentProps({});
3053
3055
  return;
3054
3056
  }
3055
3057
  const allVariants = [baseline, ...baselineComponent.variants];
3056
3058
  const variantIndex = pluginApi.experienceVariantIndexOverwrites[overWrittenExperience.id];
3057
3059
  const variant = allVariants[variantIndex];
3058
3060
  if (!variant) {
3061
+ setComponentProps({});
3059
3062
  return;
3060
3063
  }
3061
3064
  setComponentProps(Object.assign({}, variant));
@@ -3193,6 +3196,13 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
3193
3196
  [id]: false
3194
3197
  });
3195
3198
  this.onChange();
3199
+ // When a audience is deactivated, the normal state will be that the experience goes into the control
3200
+ this.experiences.filter(experience => {
3201
+ var _b;
3202
+ return ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id) === id;
3203
+ }).forEach(experience => {
3204
+ this.resetExperience(experience.id);
3205
+ });
3196
3206
  }
3197
3207
  resetAudience(id) {
3198
3208
  if (!this.isKnownAudience(id)) {
package/index.js CHANGED
@@ -3024,16 +3024,19 @@ const PreviewRenderPlugin = ctx => {
3024
3024
  return overWrittenExperienceIds.includes(experience.id);
3025
3025
  });
3026
3026
  if (!overWrittenExperience) {
3027
+ setComponentProps({});
3027
3028
  return;
3028
3029
  }
3029
3030
  const baselineComponent = overWrittenExperience.components.find(component => component.baseline.id === baseline.id);
3030
3031
  if (!baselineComponent) {
3032
+ setComponentProps({});
3031
3033
  return;
3032
3034
  }
3033
3035
  const allVariants = [baseline, ...baselineComponent.variants];
3034
3036
  const variantIndex = pluginApi.experienceVariantIndexOverwrites[overWrittenExperience.id];
3035
3037
  const variant = allVariants[variantIndex];
3036
3038
  if (!variant) {
3039
+ setComponentProps({});
3037
3040
  return;
3038
3041
  }
3039
3042
  setComponentProps(Object.assign({}, variant));
@@ -3171,6 +3174,13 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
3171
3174
  [id]: false
3172
3175
  });
3173
3176
  this.onChange();
3177
+ // When a audience is deactivated, the normal state will be that the experience goes into the control
3178
+ this.experiences.filter(experience => {
3179
+ var _b;
3180
+ return ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id) === id;
3181
+ }).forEach(experience => {
3182
+ this.resetExperience(experience.id);
3183
+ });
3174
3184
  }
3175
3185
  resetAudience(id) {
3176
3186
  if (!this.isKnownAudience(id)) {
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js-plugin-preview",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
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.1",
10
- "@ninetailed/experience.js": "4.0.0-beta.1",
11
- "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.1",
12
- "@ninetailed/experience.js-utils": "3.6.0",
13
- "@ninetailed/experience.js-react": "4.0.0-beta.1",
14
- "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.1",
9
+ "@ninetailed/experience.js-shared": "4.0.0-beta.2",
10
+ "@ninetailed/experience.js": "4.0.0-beta.2",
11
+ "@ninetailed/experience.js-plugin-analytics": "4.0.0-beta.2",
12
+ "@ninetailed/experience.js-utils": "4.0.0-beta.1",
13
+ "@ninetailed/experience.js-react": "4.0.0-beta.2",
14
+ "@ninetailed/experience.js-preview-bridge": "4.0.0-beta.2",
15
15
  "react": "18.2.0",
16
16
  "uuid": "9.0.0"
17
17
  },