@ninetailed/experience.js-plugin-preview 7.5.0 → 7.6.0-beta.1
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 +6 -6
- package/index.js +6 -6
- package/package.json +4 -4
- package/src/lib/plugin/NinetailedPreviewPlugin.d.ts +3 -3
package/index.cjs
CHANGED
|
@@ -262,7 +262,7 @@ class NinetailedPreviewPlugin extends experience_js.NinetailedPlugin {
|
|
|
262
262
|
}
|
|
263
263
|
activateAudience(id) {
|
|
264
264
|
if (!this.isKnownAudience(id)) {
|
|
265
|
-
|
|
265
|
+
experience_jsShared.logger.warn(`You cannot activate an unknown audience (id: ${id}).`);
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
268
|
this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
|
|
@@ -280,7 +280,7 @@ class NinetailedPreviewPlugin extends experience_js.NinetailedPlugin {
|
|
|
280
280
|
}
|
|
281
281
|
deactivateAudience(id) {
|
|
282
282
|
if (!this.isKnownAudience(id)) {
|
|
283
|
-
|
|
283
|
+
experience_jsShared.logger.warn(`You cannot deactivate an unkown audience (id: ${id}). How did you get it in the first place?`);
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
this.experienceVariantIndexOverwrites = Object.entries(this.experienceVariantIndexOverwrites).filter(([key, _]) => {
|
|
@@ -313,7 +313,7 @@ class NinetailedPreviewPlugin extends experience_js.NinetailedPlugin {
|
|
|
313
313
|
}
|
|
314
314
|
resetAudience(id) {
|
|
315
315
|
if (!this.isKnownAudience(id)) {
|
|
316
|
-
|
|
316
|
+
experience_jsShared.logger.warn(`You cannot reset an unknown audience (id: ${id}). How did you get it in the first place?`);
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
319
|
const _b = this.audienceOverwrites,
|
|
@@ -329,19 +329,19 @@ class NinetailedPreviewPlugin extends experience_js.NinetailedPlugin {
|
|
|
329
329
|
}) {
|
|
330
330
|
const experience = this.experiences.find(experience => experience.id === experienceId);
|
|
331
331
|
if (!experience) {
|
|
332
|
-
|
|
332
|
+
experience_jsShared.logger.warn(`You cannot active a variant for an unknown experience (id: ${experienceId})`);
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
335
|
if (experience.audience && !this.activeAudiences.some(id => {
|
|
336
336
|
var _b;
|
|
337
337
|
return id === ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id);
|
|
338
338
|
})) {
|
|
339
|
-
|
|
339
|
+
experience_jsShared.logger.warn(`You cannot active a variant for an experience (id: ${experienceId}), which is not in the active audiences.`);
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
const isValidIndex = experience.components.map(component => component.variants.length + 1).every(length => length > variantIndex);
|
|
343
343
|
if (!isValidIndex) {
|
|
344
|
-
|
|
344
|
+
experience_jsShared.logger.warn(`You activated a variant at index ${variantIndex} for the experience (id: ${experienceId}). Not all components have that many variants, you may see the baseline for some.`);
|
|
345
345
|
}
|
|
346
346
|
this.experienceVariantIndexOverwrites = Object.assign(Object.assign({}, this.experienceVariantIndexOverwrites), {
|
|
347
347
|
[experienceId]: variantIndex
|
package/index.js
CHANGED
|
@@ -240,7 +240,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
240
240
|
}
|
|
241
241
|
activateAudience(id) {
|
|
242
242
|
if (!this.isKnownAudience(id)) {
|
|
243
|
-
|
|
243
|
+
logger.warn(`You cannot activate an unknown audience (id: ${id}).`);
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
246
|
this.audienceOverwrites = Object.assign(Object.assign({}, this.audienceOverwrites), {
|
|
@@ -258,7 +258,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
258
258
|
}
|
|
259
259
|
deactivateAudience(id) {
|
|
260
260
|
if (!this.isKnownAudience(id)) {
|
|
261
|
-
|
|
261
|
+
logger.warn(`You cannot deactivate an unkown audience (id: ${id}). How did you get it in the first place?`);
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
this.experienceVariantIndexOverwrites = Object.entries(this.experienceVariantIndexOverwrites).filter(([key, _]) => {
|
|
@@ -291,7 +291,7 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
291
291
|
}
|
|
292
292
|
resetAudience(id) {
|
|
293
293
|
if (!this.isKnownAudience(id)) {
|
|
294
|
-
|
|
294
|
+
logger.warn(`You cannot reset an unknown audience (id: ${id}). How did you get it in the first place?`);
|
|
295
295
|
return;
|
|
296
296
|
}
|
|
297
297
|
const _b = this.audienceOverwrites,
|
|
@@ -307,19 +307,19 @@ class NinetailedPreviewPlugin extends NinetailedPlugin {
|
|
|
307
307
|
}) {
|
|
308
308
|
const experience = this.experiences.find(experience => experience.id === experienceId);
|
|
309
309
|
if (!experience) {
|
|
310
|
-
|
|
310
|
+
logger.warn(`You cannot active a variant for an unknown experience (id: ${experienceId})`);
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
if (experience.audience && !this.activeAudiences.some(id => {
|
|
314
314
|
var _b;
|
|
315
315
|
return id === ((_b = experience.audience) === null || _b === void 0 ? void 0 : _b.id);
|
|
316
316
|
})) {
|
|
317
|
-
|
|
317
|
+
logger.warn(`You cannot active a variant for an experience (id: ${experienceId}), which is not in the active audiences.`);
|
|
318
318
|
return;
|
|
319
319
|
}
|
|
320
320
|
const isValidIndex = experience.components.map(component => component.variants.length + 1).every(length => length > variantIndex);
|
|
321
321
|
if (!isValidIndex) {
|
|
322
|
-
|
|
322
|
+
logger.warn(`You activated a variant at index ${variantIndex} for the experience (id: ${experienceId}). Not all components have that many variants, you may see the baseline for some.`);
|
|
323
323
|
}
|
|
324
324
|
this.experienceVariantIndexOverwrites = Object.assign(Object.assign({}, this.experienceVariantIndexOverwrites), {
|
|
325
325
|
[experienceId]: variantIndex
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-plugin-preview",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.6.0-beta.1",
|
|
4
4
|
"license": "BSL-1.1",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"main": "./index.cjs",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./src/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@ninetailed/experience.js": "7.
|
|
11
|
-
"@ninetailed/experience.js-preview-bridge": "7.
|
|
12
|
-
"@ninetailed/experience.js-shared": "7.
|
|
10
|
+
"@ninetailed/experience.js": "7.6.0-beta.1",
|
|
11
|
+
"@ninetailed/experience.js-preview-bridge": "7.6.0-beta.1",
|
|
12
|
+
"@ninetailed/experience.js-shared": "7.6.0-beta.1"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {}
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reference } from '@ninetailed/experience.js-shared';
|
|
2
|
-
import { ExperienceConfiguration, PROFILE_CHANGE, HasExperienceSelectionMiddleware,
|
|
2
|
+
import { ExperienceConfiguration, PROFILE_CHANGE, HasExperienceSelectionMiddleware, BuildExperienceSelectionMiddleware, NinetailedPlugin } from '@ninetailed/experience.js';
|
|
3
3
|
import type { ExposedAudienceDefinition } from '@ninetailed/experience.js-preview-bridge';
|
|
4
4
|
export declare const NINETAILED_PREVIEW_EVENTS: {
|
|
5
5
|
previewAudiences: string;
|
|
@@ -17,7 +17,7 @@ type NinetailedPreviewPluginOptions = {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
export declare class NinetailedPreviewPlugin extends NinetailedPlugin implements HasExperienceSelectionMiddleware<Reference> {
|
|
20
|
+
export declare class NinetailedPreviewPlugin extends NinetailedPlugin implements HasExperienceSelectionMiddleware<Reference, Reference> {
|
|
21
21
|
private readonly options;
|
|
22
22
|
name: string;
|
|
23
23
|
private isOpen;
|
|
@@ -51,7 +51,7 @@ export declare class NinetailedPreviewPlugin extends NinetailedPlugin implements
|
|
|
51
51
|
}): void;
|
|
52
52
|
resetExperience(experienceId: string): void;
|
|
53
53
|
reset(): void;
|
|
54
|
-
getExperienceSelectionMiddleware:
|
|
54
|
+
getExperienceSelectionMiddleware: BuildExperienceSelectionMiddleware<Reference, Reference>;
|
|
55
55
|
openExperienceEditor(experience: ExperienceConfiguration): void;
|
|
56
56
|
openExperienceAnalytics(experience: ExperienceConfiguration): void;
|
|
57
57
|
openAudienceEditor(audience: ExposedAudienceDefinition): void;
|