Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ninetailed/experience.js-utils-contentful

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ninetailed/experience.js-utils-contentful - npm Package Compare versions

Comparing version 2.0.0-beta.4 to 2.0.0-beta.5

2

package.json
{
"name": "@ninetailed/experience.js-utils-contentful",
"version": "2.0.0-beta.4",
"version": "2.0.0-beta.5",
"type": "commonjs",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -8,9 +8,10 @@ import { Baseline, Variant, ExperienceConfiguration } from '@ninetailed/experience.js';

};
declare type MapBaseline<BT = Entry<unknown>> = (baseline: BT) => Baseline;
declare type MapExperienceOptions<BT = Entry<unknown>> = {
mapBaseline?: MapBaseline<BT>;
mapVariant?: (variant: unknown, options: MapVariantOptions) => Variant;
declare type MapBaseline<BaselineType = Entry<unknown>> = (baseline: BaselineType) => Baseline;
declare type MapVariant<VariantType = Entry<unknown>> = (variant: VariantType, options: MapVariantOptions) => Variant;
declare type MapExperienceOptions<BaselineType = Entry<unknown>, VariantType = Entry<unknown>> = {
mapBaseline?: MapBaseline<BaselineType>;
mapVariant?: MapVariant<VariantType>;
};
export declare class ExperienceMapper {
static mapExperience<BT = Entry<unknown>>(entry: ExperienceEntry, baseline: BT, options?: MapExperienceOptions<BT>): ExperienceConfiguration;
static mapExperience<BaselineType = Entry<unknown>>(entry: ExperienceEntry, baseline: BaselineType, options?: MapExperienceOptions<BaselineType>): ExperienceConfiguration;
static mapExperiment(entry: ExperienceEntry): ExperienceConfiguration;

@@ -17,0 +18,0 @@ static mapBaselineWithExperiences(entry: BaselineWithExperiencesEntry): ExperienceConfiguration[];

@@ -11,2 +11,9 @@ "use strict";

((_variant, { hidden }) => (Object.assign(Object.assign({}, _variant), { id: _variant.sys.id, hidden: hidden })));
const config = Object.assign({ traffic: 0, scatteredDistribution: [{ index: 0, start: 0, end: 1 }], components: [
{
baseline: { id: '' },
variants: [{ id: '', hidden: false }],
},
] }, entry.fields.nt_config);
const variantReferences = (entry.fields.nt_variants || []).filter((variantReference) => !!variantReference);
return Object.assign(Object.assign({ id: entry.sys.id, type: entry.fields.nt_type }, (entry.fields.nt_audience

@@ -16,3 +23,3 @@ ? {

}
: {})), { trafficAllocation: entry.fields.nt_config.traffic, distribution: entry.fields.nt_config.scatteredDistribution, components: entry.fields.nt_config.components.map((component) => {
: {})), { trafficAllocation: config.traffic, distribution: config.scatteredDistribution, components: config.components.map((component) => {
return {

@@ -22,3 +29,3 @@ baseline: _mapBaseline(baseline),

.map((variant) => {
const matchingVariant = entry.fields.nt_variants.find((variantReference) => variantReference.sys.id === variant.id);
const matchingVariant = variantReferences.find((variantReference) => variantReference.sys.id === variant.id);
if (!matchingVariant) {

@@ -25,0 +32,0 @@ return null;

@@ -9,3 +9,3 @@ import { Distribution, BaselineWithVariants } from '@ninetailed/experience.js';

};
declare type Experiencefields<VariantEntryTypes extends Entry<unknown> = Entry<unknown>> = {
declare type ExperienceFields<VariantEntry extends Entry<unknown> = Entry<unknown>> = {
/**

@@ -22,3 +22,3 @@ * The name of the experience (Short Text)

*/
nt_config: EntryFields.Object<Config>;
nt_config?: EntryFields.Object<Config>;
/**

@@ -31,5 +31,5 @@ * The audience of the experience (Audience)

*/
nt_variants: VariantEntryTypes[];
nt_variants?: VariantEntry[];
};
export declare type ExperienceEntry = Entry<Experiencefields>;
export declare type ExperienceEntry = Entry<ExperienceFields>;
export {};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc