@ninetailed/experience.js-plugin-preview 4.0.0-beta.8 → 4.1.0-beta.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 +8 -14
- package/index.js +8 -14
- package/package.json +7 -7
package/index.cjs
CHANGED
|
@@ -3023,7 +3023,7 @@ class WidgetContainer {
|
|
|
3023
3023
|
}
|
|
3024
3024
|
|
|
3025
3025
|
const PreviewRenderPlugin = ctx => {
|
|
3026
|
-
const
|
|
3026
|
+
const PreviewRenderPlugin = props => {
|
|
3027
3027
|
const [pluginApi, setPluginApi] = react.useState(ctx.pluginApi);
|
|
3028
3028
|
const {
|
|
3029
3029
|
children,
|
|
@@ -3071,7 +3071,7 @@ const PreviewRenderPlugin = ctx => {
|
|
|
3071
3071
|
children: children
|
|
3072
3072
|
});
|
|
3073
3073
|
};
|
|
3074
|
-
return
|
|
3074
|
+
return PreviewRenderPlugin;
|
|
3075
3075
|
};
|
|
3076
3076
|
|
|
3077
3077
|
class PreviewRenderPluginContext {
|
|
@@ -3186,9 +3186,6 @@ 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
|
-
});
|
|
3192
3189
|
// When a audience is activated, they should show their natural state
|
|
3193
3190
|
this.experiences.filter(experience => {
|
|
3194
3191
|
var _b;
|
|
@@ -3196,6 +3193,9 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
|
|
|
3196
3193
|
}).forEach(experience => {
|
|
3197
3194
|
this.resetExperience(experience.id);
|
|
3198
3195
|
});
|
|
3196
|
+
this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
|
|
3197
|
+
[id]: true
|
|
3198
|
+
});
|
|
3199
3199
|
this.onChange();
|
|
3200
3200
|
}
|
|
3201
3201
|
deactivateAudience(id) {
|
|
@@ -3325,9 +3325,7 @@ 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,
|
|
3329
|
-
audiences: this.activeAudiences
|
|
3330
|
-
}));
|
|
3328
|
+
const activeExperiments = experience_js.selectActiveExperiments(experiments, profile);
|
|
3331
3329
|
const eligibleExperiences = experience_js.selectEligibleExperiences({
|
|
3332
3330
|
experiences: this.experiences,
|
|
3333
3331
|
activeExperiments
|
|
@@ -3335,16 +3333,12 @@ class NinetailedPreviewPlugin extends experience_jsPluginAnalytics.NinetailedPlu
|
|
|
3335
3333
|
const matchedExperiences = eligibleExperiences.filter(experience => experience_js.isExperienceMatch({
|
|
3336
3334
|
experience,
|
|
3337
3335
|
activeExperiments,
|
|
3338
|
-
profile
|
|
3339
|
-
audiences: this.activeAudiences
|
|
3340
|
-
})
|
|
3336
|
+
profile
|
|
3341
3337
|
}));
|
|
3342
3338
|
return matchedExperiences.reduce((acc, experience) => {
|
|
3343
3339
|
const distribution = experience_js.selectDistribution({
|
|
3344
3340
|
experience,
|
|
3345
|
-
profile
|
|
3346
|
-
audiences: this.activeAudiences
|
|
3347
|
-
})
|
|
3341
|
+
profile
|
|
3348
3342
|
});
|
|
3349
3343
|
return Object.assign(Object.assign({}, acc), {
|
|
3350
3344
|
[experience.id]: distribution.index
|
package/index.js
CHANGED
|
@@ -3001,7 +3001,7 @@ class WidgetContainer {
|
|
|
3001
3001
|
}
|
|
3002
3002
|
|
|
3003
3003
|
const PreviewRenderPlugin = ctx => {
|
|
3004
|
-
const
|
|
3004
|
+
const PreviewRenderPlugin = props => {
|
|
3005
3005
|
const [pluginApi, setPluginApi] = useState(ctx.pluginApi);
|
|
3006
3006
|
const {
|
|
3007
3007
|
children,
|
|
@@ -3049,7 +3049,7 @@ const PreviewRenderPlugin = ctx => {
|
|
|
3049
3049
|
children: children
|
|
3050
3050
|
});
|
|
3051
3051
|
};
|
|
3052
|
-
return
|
|
3052
|
+
return PreviewRenderPlugin;
|
|
3053
3053
|
};
|
|
3054
3054
|
|
|
3055
3055
|
class PreviewRenderPluginContext {
|
|
@@ -3164,9 +3164,6 @@ 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
|
-
});
|
|
3170
3167
|
// When a audience is activated, they should show their natural state
|
|
3171
3168
|
this.experiences.filter(experience => {
|
|
3172
3169
|
var _b;
|
|
@@ -3174,6 +3171,9 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
3174
3171
|
}).forEach(experience => {
|
|
3175
3172
|
this.resetExperience(experience.id);
|
|
3176
3173
|
});
|
|
3174
|
+
this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
|
|
3175
|
+
[id]: true
|
|
3176
|
+
});
|
|
3177
3177
|
this.onChange();
|
|
3178
3178
|
}
|
|
3179
3179
|
deactivateAudience(id) {
|
|
@@ -3303,9 +3303,7 @@ 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,
|
|
3307
|
-
audiences: this.activeAudiences
|
|
3308
|
-
}));
|
|
3306
|
+
const activeExperiments = selectActiveExperiments(experiments, profile);
|
|
3309
3307
|
const eligibleExperiences = selectEligibleExperiences({
|
|
3310
3308
|
experiences: this.experiences,
|
|
3311
3309
|
activeExperiments
|
|
@@ -3313,16 +3311,12 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
3313
3311
|
const matchedExperiences = eligibleExperiences.filter(experience => isExperienceMatch({
|
|
3314
3312
|
experience,
|
|
3315
3313
|
activeExperiments,
|
|
3316
|
-
profile
|
|
3317
|
-
audiences: this.activeAudiences
|
|
3318
|
-
})
|
|
3314
|
+
profile
|
|
3319
3315
|
}));
|
|
3320
3316
|
return matchedExperiences.reduce((acc, experience) => {
|
|
3321
3317
|
const distribution = selectDistribution({
|
|
3322
3318
|
experience,
|
|
3323
|
-
profile
|
|
3324
|
-
audiences: this.activeAudiences
|
|
3325
|
-
})
|
|
3319
|
+
profile
|
|
3326
3320
|
});
|
|
3327
3321
|
return Object.assign(Object.assign({}, acc), {
|
|
3328
3322
|
[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.
|
|
3
|
+
"version": "4.1.0-beta.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": "4.
|
|
10
|
-
"@ninetailed/experience.js": "4.
|
|
11
|
-
"@ninetailed/experience.js-plugin-analytics": "4.
|
|
12
|
-
"@ninetailed/experience.js-utils": "4.0.0-beta.
|
|
13
|
-
"@ninetailed/experience.js-react": "4.
|
|
14
|
-
"@ninetailed/experience.js-preview-bridge": "4.
|
|
9
|
+
"@ninetailed/experience.js-shared": "4.1.0-beta.0",
|
|
10
|
+
"@ninetailed/experience.js": "4.1.0-beta.0",
|
|
11
|
+
"@ninetailed/experience.js-plugin-analytics": "4.1.0-beta.0",
|
|
12
|
+
"@ninetailed/experience.js-utils": "4.0.0-beta.1",
|
|
13
|
+
"@ninetailed/experience.js-react": "4.1.0-beta.0",
|
|
14
|
+
"@ninetailed/experience.js-preview-bridge": "4.1.0-beta.0",
|
|
15
15
|
"react": "18.2.0",
|
|
16
16
|
"uuid": "9.0.0"
|
|
17
17
|
},
|