@ninetailed/experience.js-utils 4.4.0-beta.1 → 4.4.0-beta.3
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 +2 -0
- package/index.js +2 -0
- package/package.json +3 -3
- package/types/Config.d.ts +3 -0
package/index.cjs
CHANGED
|
@@ -14,6 +14,7 @@ const Audience = zod.z.object({
|
|
|
14
14
|
const Config = zod.z.object({
|
|
15
15
|
distribution: zod.z.array(zod.z.number()).optional().default([0.5, 0.5]),
|
|
16
16
|
traffic: zod.z.number().optional().default(0),
|
|
17
|
+
isSticky: zod.z.boolean().optional().default(false),
|
|
17
18
|
components: zod.z.array(zod.z.object({
|
|
18
19
|
baseline: zod.z.object({
|
|
19
20
|
id: zod.z.string().default('')
|
|
@@ -179,6 +180,7 @@ class ExperienceMapper {
|
|
|
179
180
|
start: config.distribution.slice(0, index).reduce((a, b) => a + b, 0),
|
|
180
181
|
end: config.distribution.slice(0, index + 1).reduce((a, b) => a + b, 0)
|
|
181
182
|
})),
|
|
183
|
+
isSticky: config.isSticky,
|
|
182
184
|
components: components.map(component => ({
|
|
183
185
|
baseline: component.baseline,
|
|
184
186
|
variants: component.variants.map(variantRef => {
|
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const Audience = z.object({
|
|
|
10
10
|
const Config = z.object({
|
|
11
11
|
distribution: z.array(z.number()).optional().default([0.5, 0.5]),
|
|
12
12
|
traffic: z.number().optional().default(0),
|
|
13
|
+
isSticky: z.boolean().optional().default(false),
|
|
13
14
|
components: z.array(z.object({
|
|
14
15
|
baseline: z.object({
|
|
15
16
|
id: z.string().default('')
|
|
@@ -175,6 +176,7 @@ class ExperienceMapper {
|
|
|
175
176
|
start: config.distribution.slice(0, index).reduce((a, b) => a + b, 0),
|
|
176
177
|
end: config.distribution.slice(0, index + 1).reduce((a, b) => a + b, 0)
|
|
177
178
|
})),
|
|
179
|
+
isSticky: config.isSticky,
|
|
178
180
|
components: components.map(component => ({
|
|
179
181
|
baseline: component.baseline,
|
|
180
182
|
variants: component.variants.map(variantRef => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ninetailed/experience.js-utils",
|
|
3
|
-
"version": "4.4.0-beta.
|
|
3
|
+
"version": "4.4.0-beta.3",
|
|
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": "4.4.0-beta.
|
|
10
|
-
"@ninetailed/experience.js-shared": "4.4.0-beta.
|
|
9
|
+
"@ninetailed/experience.js": "4.4.0-beta.3",
|
|
10
|
+
"@ninetailed/experience.js-shared": "4.4.0-beta.3",
|
|
11
11
|
"zod": "3.21.4"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {}
|
package/types/Config.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
export declare const Config: z.ZodObject<{
|
|
4
4
|
distribution: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>>;
|
|
5
5
|
traffic: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
isSticky: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
6
7
|
components: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7
8
|
baseline: z.ZodObject<{
|
|
8
9
|
id: z.ZodDefault<z.ZodString>;
|
|
@@ -41,6 +42,7 @@ export declare const Config: z.ZodObject<{
|
|
|
41
42
|
}, "strip", z.ZodTypeAny, {
|
|
42
43
|
distribution: number[];
|
|
43
44
|
traffic: number;
|
|
45
|
+
isSticky: boolean;
|
|
44
46
|
components: {
|
|
45
47
|
baseline: {
|
|
46
48
|
id: string;
|
|
@@ -53,6 +55,7 @@ export declare const Config: z.ZodObject<{
|
|
|
53
55
|
}, {
|
|
54
56
|
distribution?: number[] | undefined;
|
|
55
57
|
traffic?: number | undefined;
|
|
58
|
+
isSticky?: boolean | undefined;
|
|
56
59
|
components?: {
|
|
57
60
|
baseline: {
|
|
58
61
|
id?: string | undefined;
|