@lifeaz/lors-helper 1.1.0 → 1.1.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/README.md +1 -1
- package/dist/main.d.ts +129 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +191 -9
- package/package.json +3 -3
- package/src/main.ts +374 -11
package/README.md
CHANGED
package/dist/main.d.ts
CHANGED
|
@@ -818,8 +818,8 @@ export type MvtDevice = '_Mobile_' | '_Tablet_' | '_Desktop_';
|
|
|
818
818
|
export declare const MvtDeviceSchema: z.ZodUnion<readonly [z.ZodLiteral<"_Mobile_">, z.ZodLiteral<"_Tablet_">, z.ZodLiteral<"_Desktop_">]>;
|
|
819
819
|
export type MvtNodeKind = '_And_' | '_Or_' | '_Not_' | '_Leaf_';
|
|
820
820
|
export declare const MvtNodeKindSchema: z.ZodUnion<readonly [z.ZodLiteral<"_And_">, z.ZodLiteral<"_Or_">, z.ZodLiteral<"_Not_">, z.ZodLiteral<"_Leaf_">]>;
|
|
821
|
-
export type MvtOperator = '_Device_In_' | '_Lang_In_' | '_Country_In_' | '_Profile_In_' | '_Partner_In_' | '_Partner_Absent_' | '_Campaign_Seen_' | '_Campaign_Not_Seen_' | '_Visitor_Is_New_' | '_Visitor_Is_Returning_' | '_Utm_Source_In_' | '_Utm_Medium_In_' | '_Utm_Campaign_In_' | '_Referrer_Matches_' | '_Path_Matches_' | '_Has_Cart_' | '_Hour_Of_Day_Between_' | '_Day_Of_Week_In_';
|
|
822
|
-
export declare const MvtOperatorSchema: z.ZodUnion<readonly [z.ZodLiteral<"_Device_In_">, z.ZodLiteral<"_Lang_In_">, z.ZodLiteral<"_Country_In_">, z.ZodLiteral<"_Profile_In_">, z.ZodLiteral<"_Partner_In_">, z.ZodLiteral<"_Partner_Absent_">, z.ZodLiteral<"_Campaign_Seen_">, z.ZodLiteral<"_Campaign_Not_Seen_">, z.ZodLiteral<"_Visitor_Is_New_">, z.ZodLiteral<"_Visitor_Is_Returning_">, z.ZodLiteral<"_Utm_Source_In_">, z.ZodLiteral<"_Utm_Medium_In_">, z.ZodLiteral<"_Utm_Campaign_In_">, z.ZodLiteral<"_Referrer_Matches_">, z.ZodLiteral<"_Path_Matches_">, z.ZodLiteral<"_Has_Cart_">, z.ZodLiteral<"_Hour_Of_Day_Between_">, z.ZodLiteral<"_Day_Of_Week_In_">]>;
|
|
821
|
+
export type MvtOperator = '_Device_In_' | '_Lang_In_' | '_Country_In_' | '_Profile_In_' | '_Partner_In_' | '_Partner_Absent_' | '_Campaign_Seen_' | '_Campaign_Not_Seen_' | '_Visitor_Is_New_' | '_Visitor_Is_Returning_' | '_Utm_Source_In_' | '_Utm_Medium_In_' | '_Utm_Campaign_In_' | '_Referrer_Matches_' | '_Path_Matches_' | '_Has_Cart_' | '_Hour_Of_Day_Between_' | '_Day_Of_Week_In_' | '_Query_Param_Matches_' | '_Screen_Width_Between_' | '_Visits_At_Least_' | '_Logged_In_' | '_Logged_Out_' | '_Is_Weekend_' | '_Date_Between_';
|
|
822
|
+
export declare const MvtOperatorSchema: z.ZodUnion<readonly [z.ZodLiteral<"_Device_In_">, z.ZodLiteral<"_Lang_In_">, z.ZodLiteral<"_Country_In_">, z.ZodLiteral<"_Profile_In_">, z.ZodLiteral<"_Partner_In_">, z.ZodLiteral<"_Partner_Absent_">, z.ZodLiteral<"_Campaign_Seen_">, z.ZodLiteral<"_Campaign_Not_Seen_">, z.ZodLiteral<"_Visitor_Is_New_">, z.ZodLiteral<"_Visitor_Is_Returning_">, z.ZodLiteral<"_Utm_Source_In_">, z.ZodLiteral<"_Utm_Medium_In_">, z.ZodLiteral<"_Utm_Campaign_In_">, z.ZodLiteral<"_Referrer_Matches_">, z.ZodLiteral<"_Path_Matches_">, z.ZodLiteral<"_Has_Cart_">, z.ZodLiteral<"_Hour_Of_Day_Between_">, z.ZodLiteral<"_Day_Of_Week_In_">, z.ZodLiteral<"_Query_Param_Matches_">, z.ZodLiteral<"_Screen_Width_Between_">, z.ZodLiteral<"_Visits_At_Least_">, z.ZodLiteral<"_Logged_In_">, z.ZodLiteral<"_Logged_Out_">, z.ZodLiteral<"_Is_Weekend_">, z.ZodLiteral<"_Date_Between_">]>;
|
|
823
823
|
export declare const MVT_NULLARY_OPERATORS: readonly MvtOperator[];
|
|
824
824
|
export type MvtOverrideOp = 'set' | 'merge' | 'remove' | 'reorder' | 'insert' | 'patch';
|
|
825
825
|
export declare const MvtOverrideOpSchema: z.ZodUnion<readonly [z.ZodLiteral<"set">, z.ZodLiteral<"merge">, z.ZodLiteral<"remove">, z.ZodLiteral<"reorder">, z.ZodLiteral<"insert">, z.ZodLiteral<"patch">]>;
|
|
@@ -857,8 +857,19 @@ export declare const MvtVariantSchema: z.ZodObject<{
|
|
|
857
857
|
equals: z.ZodString;
|
|
858
858
|
}, z.core.$strip>>;
|
|
859
859
|
}, z.core.$strip>>;
|
|
860
|
+
audience: z.ZodDefault<z.ZodNullable<z.ZodType<MvtAudienceNode, unknown, z.core.$ZodTypeInternals<MvtAudienceNode, unknown>>>>;
|
|
861
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
862
|
+
color: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
863
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
860
864
|
}, z.core.$strip>;
|
|
861
865
|
export type MvtVariant = z.infer<typeof MvtVariantSchema>;
|
|
866
|
+
export type MvtAllocationMode = '_Targeted_' | '_Weighted_' | '_Unreachable_';
|
|
867
|
+
export interface MvtAllocationRow {
|
|
868
|
+
key: string;
|
|
869
|
+
mode: MvtAllocationMode;
|
|
870
|
+
weight: number;
|
|
871
|
+
sharePct: number;
|
|
872
|
+
}
|
|
862
873
|
export declare const MvtExperimentSchema: z.ZodObject<{
|
|
863
874
|
id: z.ZodCustom<UUID, UUID>;
|
|
864
875
|
key: z.ZodString;
|
|
@@ -891,6 +902,10 @@ export declare const MvtExperimentSchema: z.ZodObject<{
|
|
|
891
902
|
equals: z.ZodString;
|
|
892
903
|
}, z.core.$strip>>;
|
|
893
904
|
}, z.core.$strip>>;
|
|
905
|
+
audience: z.ZodDefault<z.ZodNullable<z.ZodType<MvtAudienceNode, unknown, z.core.$ZodTypeInternals<MvtAudienceNode, unknown>>>>;
|
|
906
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
907
|
+
color: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
908
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
894
909
|
}, z.core.$strip>>;
|
|
895
910
|
}, z.core.$strip>;
|
|
896
911
|
export type MvtExperiment = z.infer<typeof MvtExperimentSchema>;
|
|
@@ -929,6 +944,10 @@ export declare const MvtConfigSchema: z.ZodObject<{
|
|
|
929
944
|
equals: z.ZodString;
|
|
930
945
|
}, z.core.$strip>>;
|
|
931
946
|
}, z.core.$strip>>;
|
|
947
|
+
audience: z.ZodDefault<z.ZodNullable<z.ZodType<MvtAudienceNode, unknown, z.core.$ZodTypeInternals<MvtAudienceNode, unknown>>>>;
|
|
948
|
+
order: z.ZodDefault<z.ZodNumber>;
|
|
949
|
+
color: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
950
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
932
951
|
}, z.core.$strip>>;
|
|
933
952
|
}, z.core.$strip>>;
|
|
934
953
|
}, z.core.$strip>;
|
|
@@ -951,7 +970,14 @@ export interface MvtContext {
|
|
|
951
970
|
hasCart: boolean;
|
|
952
971
|
firstSeenAt: number;
|
|
953
972
|
now: number;
|
|
973
|
+
query: Record<string, string>;
|
|
974
|
+
screenWidth: number;
|
|
975
|
+
visits: number;
|
|
976
|
+
loggedIn: boolean;
|
|
954
977
|
}
|
|
978
|
+
export declare function mvtNormalizeContext(context: Partial<MvtContext> & {
|
|
979
|
+
unitId: string;
|
|
980
|
+
}): MvtContext;
|
|
955
981
|
export interface MvtDecision {
|
|
956
982
|
experimentKey: string;
|
|
957
983
|
experimentId: UUID;
|
|
@@ -963,7 +989,8 @@ export interface MvtDecision {
|
|
|
963
989
|
export declare function mvtHash(input: string): number;
|
|
964
990
|
export declare function mvtBucket(salt: string, unitId: string, namespace?: string): number;
|
|
965
991
|
export declare function mvtIsEligibleForTraffic(experiment: MvtExperiment, unitId: string): boolean;
|
|
966
|
-
export declare function mvtPickVariant(experiment: MvtExperiment, unitId: string): MvtVariant | null;
|
|
992
|
+
export declare function mvtPickVariant(experiment: MvtExperiment, unitId: string, context?: MvtContext): MvtVariant | null;
|
|
993
|
+
export declare function mvtDistribution(variants: readonly MvtVariant[]): MvtAllocationRow[];
|
|
967
994
|
export declare function mvtEvaluateAudience(node: MvtAudienceNode | null, context: MvtContext): boolean;
|
|
968
995
|
export declare function mvtIsWithinWindow(experiment: MvtExperiment, now: number): boolean;
|
|
969
996
|
export declare function mvtIsLive(experiment: MvtExperiment, now: number): boolean;
|
|
@@ -989,6 +1016,37 @@ export interface MvtSlotDefinition {
|
|
|
989
1016
|
itemKey?: string;
|
|
990
1017
|
schema: z.ZodType<unknown>;
|
|
991
1018
|
}
|
|
1019
|
+
export declare const MvtAnchorPatchSchema: z.ZodObject<{
|
|
1020
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
1021
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
1022
|
+
text: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"fr">, z.ZodLiteral<"en">, z.ZodLiteral<"nl">, z.ZodLiteral<"de">, z.ZodLiteral<"it">, z.ZodLiteral<"es">, z.ZodLiteral<"pt">, z.ZodLiteral<"pl">]> & z.core.$partial, z.ZodString>>;
|
|
1023
|
+
href: z.ZodOptional<z.ZodString>;
|
|
1024
|
+
route: z.ZodOptional<z.ZodString>;
|
|
1025
|
+
image: z.ZodOptional<z.ZodString>;
|
|
1026
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
1027
|
+
background: z.ZodOptional<z.ZodString>;
|
|
1028
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1029
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
1030
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
1031
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
1032
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
1033
|
+
300: "300";
|
|
1034
|
+
400: "400";
|
|
1035
|
+
500: "500";
|
|
1036
|
+
600: "600";
|
|
1037
|
+
700: "700";
|
|
1038
|
+
800: "800";
|
|
1039
|
+
}>>;
|
|
1040
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
1041
|
+
left: "left";
|
|
1042
|
+
center: "center";
|
|
1043
|
+
right: "right";
|
|
1044
|
+
}>>;
|
|
1045
|
+
paddingY: z.ZodOptional<z.ZodNumber>;
|
|
1046
|
+
paddingX: z.ZodOptional<z.ZodNumber>;
|
|
1047
|
+
}, z.core.$strip>>;
|
|
1048
|
+
}, z.core.$strip>;
|
|
1049
|
+
export type MvtAnchorPatch = z.infer<typeof MvtAnchorPatchSchema>;
|
|
992
1050
|
export declare const MVT_SLOTS: readonly MvtSlotDefinition[];
|
|
993
1051
|
export declare function mvtSlot(key: string): MvtSlotDefinition | null;
|
|
994
1052
|
export declare function mvtSlotsForScope(scope: MvtScope): MvtSlotDefinition[];
|
|
@@ -999,4 +1057,72 @@ export interface MvtOverrideIssue {
|
|
|
999
1057
|
}
|
|
1000
1058
|
export declare function mvtValidateOverrides(overrides: MvtOverride[]): MvtOverrideIssue[];
|
|
1001
1059
|
export declare function mvtApplyOverride<T>(base: T, override: MvtOverride): T;
|
|
1060
|
+
export declare const MVT_ANCHOR_ATTRIBUTE = "data-mvt-anchor";
|
|
1061
|
+
export declare function mvtAnchorsSlot(scope: MvtScope): string;
|
|
1062
|
+
export declare function mvtMergeAnchorPatch(base: MvtAnchorPatch | undefined, next: MvtAnchorPatch | undefined): MvtAnchorPatch;
|
|
1063
|
+
export declare function mvtAnchorStyle(patch: MvtAnchorPatch | null | undefined): Record<string, string>;
|
|
1064
|
+
export declare const MVT_STUDIO_PROTOCOL = 1;
|
|
1065
|
+
export type MvtStudioAnchorRole = 'section' | 'cta' | 'text' | 'image' | 'block';
|
|
1066
|
+
export interface MvtStudioAnchor {
|
|
1067
|
+
id: string;
|
|
1068
|
+
label: string;
|
|
1069
|
+
role: MvtStudioAnchorRole;
|
|
1070
|
+
parentId: string | null;
|
|
1071
|
+
order: number;
|
|
1072
|
+
text: string | null;
|
|
1073
|
+
movable: boolean;
|
|
1074
|
+
hideable: boolean;
|
|
1075
|
+
rect: {
|
|
1076
|
+
top: number;
|
|
1077
|
+
left: number;
|
|
1078
|
+
width: number;
|
|
1079
|
+
height: number;
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
export type MvtStudioRequest = {
|
|
1083
|
+
protocol: number;
|
|
1084
|
+
type: 'studio:hello';
|
|
1085
|
+
} | {
|
|
1086
|
+
protocol: number;
|
|
1087
|
+
type: 'studio:scan';
|
|
1088
|
+
} | {
|
|
1089
|
+
protocol: number;
|
|
1090
|
+
type: 'studio:select';
|
|
1091
|
+
anchorId: string | null;
|
|
1092
|
+
} | {
|
|
1093
|
+
protocol: number;
|
|
1094
|
+
type: 'studio:apply';
|
|
1095
|
+
anchors: Record<string, MvtAnchorPatch>;
|
|
1096
|
+
lang: string;
|
|
1097
|
+
} | {
|
|
1098
|
+
protocol: number;
|
|
1099
|
+
type: 'studio:mode';
|
|
1100
|
+
picking: boolean;
|
|
1101
|
+
} | {
|
|
1102
|
+
protocol: number;
|
|
1103
|
+
type: 'studio:navigate';
|
|
1104
|
+
path: string;
|
|
1105
|
+
};
|
|
1106
|
+
export type MvtStudioEvent = {
|
|
1107
|
+
protocol: number;
|
|
1108
|
+
type: 'studio:ready';
|
|
1109
|
+
scope: MvtScope;
|
|
1110
|
+
path: string;
|
|
1111
|
+
langs: string[];
|
|
1112
|
+
} | {
|
|
1113
|
+
protocol: number;
|
|
1114
|
+
type: 'studio:anchors';
|
|
1115
|
+
anchors: MvtStudioAnchor[];
|
|
1116
|
+
path: string;
|
|
1117
|
+
} | {
|
|
1118
|
+
protocol: number;
|
|
1119
|
+
type: 'studio:picked';
|
|
1120
|
+
anchor: MvtStudioAnchor;
|
|
1121
|
+
} | {
|
|
1122
|
+
protocol: number;
|
|
1123
|
+
type: 'studio:navigated';
|
|
1124
|
+
path: string;
|
|
1125
|
+
};
|
|
1126
|
+
export declare function mvtIsStudioEvent(data: unknown): data is MvtStudioEvent;
|
|
1127
|
+
export declare function mvtIsStudioRequest(data: unknown): data is MvtStudioRequest;
|
|
1002
1128
|
//# sourceMappingURL=main.d.ts.map
|
package/dist/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAKnC,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AACzE,eAAO,MAAM,UAAU,uLAAoJ,CAAC;AAE5K,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,kBAAkB,GAAG,WAAW,CAAC;AAC5E,eAAO,MAAM,iBAAiB,kHAA8F,CAAC;AAE7H,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAC7G,eAAO,MAAM,cAAc,6LAAgK,CAAC;AAE5L,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC;AAC5F,eAAO,MAAM,gBAAgB,6JAAmI,CAA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eAAe,CAAA;CAAE,GACpE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,cAAc,CAMtE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,gBAAgB,CAE1E"}
|
package/dist/main.js
CHANGED
|
@@ -493,12 +493,22 @@ export const MvtOperatorSchema = z.union([
|
|
|
493
493
|
z.literal('_Has_Cart_'),
|
|
494
494
|
z.literal('_Hour_Of_Day_Between_'),
|
|
495
495
|
z.literal('_Day_Of_Week_In_'),
|
|
496
|
+
z.literal('_Query_Param_Matches_'),
|
|
497
|
+
z.literal('_Screen_Width_Between_'),
|
|
498
|
+
z.literal('_Visits_At_Least_'),
|
|
499
|
+
z.literal('_Logged_In_'),
|
|
500
|
+
z.literal('_Logged_Out_'),
|
|
501
|
+
z.literal('_Is_Weekend_'),
|
|
502
|
+
z.literal('_Date_Between_'),
|
|
496
503
|
]);
|
|
497
504
|
export const MVT_NULLARY_OPERATORS = [
|
|
498
505
|
'_Partner_Absent_',
|
|
499
506
|
'_Visitor_Is_New_',
|
|
500
507
|
'_Visitor_Is_Returning_',
|
|
501
508
|
'_Has_Cart_',
|
|
509
|
+
'_Logged_In_',
|
|
510
|
+
'_Logged_Out_',
|
|
511
|
+
'_Is_Weekend_',
|
|
502
512
|
];
|
|
503
513
|
export const MvtOverrideOpSchema = z.union([z.literal('set'), z.literal('merge'), z.literal('remove'), z.literal('reorder'), z.literal('insert'), z.literal('patch')]);
|
|
504
514
|
export const MvtOverrideSchema = z.object({
|
|
@@ -521,6 +531,10 @@ export const MvtVariantSchema = z.object({
|
|
|
521
531
|
weight: z.number().int().nonnegative(),
|
|
522
532
|
control: z.boolean(),
|
|
523
533
|
overrides: z.array(MvtOverrideSchema),
|
|
534
|
+
audience: MvtAudienceNodeSchema.nullable().default(null),
|
|
535
|
+
order: z.number().int().default(0),
|
|
536
|
+
color: z.string().nullable().default(null),
|
|
537
|
+
description: z.string().nullable().default(null),
|
|
524
538
|
});
|
|
525
539
|
export const MvtExperimentSchema = z.object({
|
|
526
540
|
id: uuidSchema,
|
|
@@ -545,6 +559,27 @@ export const MvtConfigSchema = z.object({
|
|
|
545
559
|
enabled: z.boolean(),
|
|
546
560
|
experiments: z.array(MvtExperimentSchema),
|
|
547
561
|
});
|
|
562
|
+
export function mvtNormalizeContext(context) {
|
|
563
|
+
return {
|
|
564
|
+
device: '_Desktop_',
|
|
565
|
+
lang: 'fr',
|
|
566
|
+
country: null,
|
|
567
|
+
profile: null,
|
|
568
|
+
partner: null,
|
|
569
|
+
seen: {},
|
|
570
|
+
utm: { source: null, medium: null, campaign: null },
|
|
571
|
+
referrer: null,
|
|
572
|
+
path: '/',
|
|
573
|
+
hasCart: false,
|
|
574
|
+
firstSeenAt: Date.now(),
|
|
575
|
+
now: Date.now(),
|
|
576
|
+
query: {},
|
|
577
|
+
screenWidth: 0,
|
|
578
|
+
visits: 1,
|
|
579
|
+
loggedIn: false,
|
|
580
|
+
...context,
|
|
581
|
+
};
|
|
582
|
+
}
|
|
548
583
|
const MVT_RETURNING_AFTER_MS = 30 * 60 * 1000;
|
|
549
584
|
export function mvtHash(input) {
|
|
550
585
|
let hash = 0x811c9dc5;
|
|
@@ -564,19 +599,42 @@ export function mvtIsEligibleForTraffic(experiment, unitId) {
|
|
|
564
599
|
return false;
|
|
565
600
|
return mvtBucket(experiment.salt, unitId, 'traffic') < experiment.trafficPct * 100;
|
|
566
601
|
}
|
|
567
|
-
export function mvtPickVariant(experiment, unitId) {
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
602
|
+
export function mvtPickVariant(experiment, unitId, context) {
|
|
603
|
+
const targeted = experiment.variants
|
|
604
|
+
.filter(variant => !!variant.audience)
|
|
605
|
+
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0) || a.key.localeCompare(b.key));
|
|
606
|
+
if (context)
|
|
607
|
+
for (const variant of targeted)
|
|
608
|
+
if (mvtEvaluateAudience(variant.audience ?? null, context))
|
|
609
|
+
return variant;
|
|
610
|
+
const pool = experiment.variants.filter(variant => !variant.audience).sort((a, b) => a.key.localeCompare(b.key));
|
|
611
|
+
const total = pool.reduce((sum, v) => sum + Math.max(v.weight, 0), 0);
|
|
612
|
+
if (!pool.length || total <= 0)
|
|
571
613
|
return null;
|
|
572
614
|
const target = (mvtBucket(experiment.salt, unitId) / 10000) * total;
|
|
573
615
|
let cursor = 0;
|
|
574
|
-
for (const variant of
|
|
616
|
+
for (const variant of pool) {
|
|
575
617
|
cursor += Math.max(variant.weight, 0);
|
|
576
618
|
if (target < cursor)
|
|
577
619
|
return variant;
|
|
578
620
|
}
|
|
579
|
-
return
|
|
621
|
+
return pool[pool.length - 1];
|
|
622
|
+
}
|
|
623
|
+
export function mvtDistribution(variants) {
|
|
624
|
+
const pool = variants.filter(variant => !variant.audience);
|
|
625
|
+
const total = pool.reduce((sum, v) => sum + Math.max(v.weight, 0), 0);
|
|
626
|
+
return variants.map(variant => {
|
|
627
|
+
if (variant.audience)
|
|
628
|
+
return { key: variant.key, mode: '_Targeted_', weight: variant.weight, sharePct: 0 };
|
|
629
|
+
if (total <= 0 || variant.weight <= 0)
|
|
630
|
+
return { key: variant.key, mode: '_Unreachable_', weight: variant.weight, sharePct: 0 };
|
|
631
|
+
return {
|
|
632
|
+
key: variant.key,
|
|
633
|
+
mode: '_Weighted_',
|
|
634
|
+
weight: variant.weight,
|
|
635
|
+
sharePct: Math.round((Math.max(variant.weight, 0) / total) * 1000) / 10,
|
|
636
|
+
};
|
|
637
|
+
});
|
|
580
638
|
}
|
|
581
639
|
function mvtMatchesPattern(value, patterns) {
|
|
582
640
|
if (value === null)
|
|
@@ -621,6 +679,35 @@ function mvtEvaluateLeaf(operator, values, context) {
|
|
|
621
679
|
return from <= to ? hour >= from && hour <= to : hour >= from || hour <= to;
|
|
622
680
|
}
|
|
623
681
|
case '_Day_Of_Week_In_': return values.map(Number).includes(new Date(context.now).getDay());
|
|
682
|
+
case '_Logged_In_': return context.loggedIn;
|
|
683
|
+
case '_Logged_Out_': return !context.loggedIn;
|
|
684
|
+
case '_Is_Weekend_': return [0, 6].includes(new Date(context.now).getDay());
|
|
685
|
+
case '_Visits_At_Least_': return context.visits >= Number(values[0] ?? 1);
|
|
686
|
+
case '_Query_Param_Matches_': {
|
|
687
|
+
return values.some(raw => {
|
|
688
|
+
const separator = raw.indexOf('=');
|
|
689
|
+
const name = (separator < 0 ? raw : raw.slice(0, separator)).trim().toLowerCase();
|
|
690
|
+
const expected = separator < 0 ? null : raw.slice(separator + 1);
|
|
691
|
+
const actual = context.query[name];
|
|
692
|
+
if (actual === undefined)
|
|
693
|
+
return false;
|
|
694
|
+
if (expected === null)
|
|
695
|
+
return true;
|
|
696
|
+
return mvtMatchesPattern(actual, [expected]);
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
case '_Screen_Width_Between_': {
|
|
700
|
+
const from = Number(values[0] ?? 0);
|
|
701
|
+
const to = Number(values[1] ?? Number.MAX_SAFE_INTEGER);
|
|
702
|
+
return context.screenWidth >= from && context.screenWidth <= to;
|
|
703
|
+
}
|
|
704
|
+
case '_Date_Between_': {
|
|
705
|
+
const from = values[0] ? Date.parse(values[0]) : Number.NEGATIVE_INFINITY;
|
|
706
|
+
const to = values[1] ? Date.parse(values[1]) : Number.POSITIVE_INFINITY;
|
|
707
|
+
if (Number.isNaN(from) || Number.isNaN(to))
|
|
708
|
+
return false;
|
|
709
|
+
return context.now >= from && context.now <= to;
|
|
710
|
+
}
|
|
624
711
|
default: return false;
|
|
625
712
|
}
|
|
626
713
|
}
|
|
@@ -667,7 +754,7 @@ export function mvtResolve(config, context, forced = {}) {
|
|
|
667
754
|
continue;
|
|
668
755
|
if (!mvtIsEligibleForTraffic(experiment, context.unitId))
|
|
669
756
|
continue;
|
|
670
|
-
const variant = mvtPickVariant(experiment, context.unitId);
|
|
757
|
+
const variant = mvtPickVariant(experiment, context.unitId, context);
|
|
671
758
|
if (!variant)
|
|
672
759
|
continue;
|
|
673
760
|
if (experiment.exclusionGroup)
|
|
@@ -686,8 +773,36 @@ function mvtToDecision(experiment, variant) {
|
|
|
686
773
|
overrides: variant.overrides,
|
|
687
774
|
};
|
|
688
775
|
}
|
|
689
|
-
const i18nTextSchema = z.
|
|
776
|
+
const i18nTextSchema = z.partialRecord(LangSchema, z.string());
|
|
690
777
|
const colorSchema = z.string().regex(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
|
|
778
|
+
export const MvtAnchorPatchSchema = z.object({
|
|
779
|
+
hidden: z.boolean().optional(),
|
|
780
|
+
order: z.number().int().min(-999).max(999).optional(),
|
|
781
|
+
text: i18nTextSchema.optional(),
|
|
782
|
+
href: z.string().max(2048).optional(),
|
|
783
|
+
route: z.string().max(512).optional(),
|
|
784
|
+
image: z.string().max(2048).optional(),
|
|
785
|
+
style: z.object({
|
|
786
|
+
background: colorSchema.optional(),
|
|
787
|
+
color: colorSchema.optional(),
|
|
788
|
+
borderColor: colorSchema.optional(),
|
|
789
|
+
borderRadius: z.number().int().min(0).max(96).optional(),
|
|
790
|
+
fontSize: z.number().int().min(8).max(96).optional(),
|
|
791
|
+
fontWeight: z.enum(['300', '400', '500', '600', '700', '800']).optional(),
|
|
792
|
+
align: z.enum(['left', 'center', 'right']).optional(),
|
|
793
|
+
paddingY: z.number().int().min(0).max(160).optional(),
|
|
794
|
+
paddingX: z.number().int().min(0).max(160).optional(),
|
|
795
|
+
}).optional(),
|
|
796
|
+
});
|
|
797
|
+
const anchorsSchema = z.record(z.string(), MvtAnchorPatchSchema);
|
|
798
|
+
const ANCHOR_FIELDS = [
|
|
799
|
+
{ key: 'hidden', label: 'Hidden', kind: 'boolean' },
|
|
800
|
+
{ key: 'order', label: 'Position', kind: 'number' },
|
|
801
|
+
{ key: 'text', label: 'Text', kind: 'i18n' },
|
|
802
|
+
{ key: 'href', label: 'External link', kind: 'text' },
|
|
803
|
+
{ key: 'route', label: 'Internal route', kind: 'text' },
|
|
804
|
+
{ key: 'image', label: 'Image', kind: 'image' },
|
|
805
|
+
];
|
|
691
806
|
function slot(definition) {
|
|
692
807
|
return definition;
|
|
693
808
|
}
|
|
@@ -809,6 +924,18 @@ export const MVT_SLOTS = [
|
|
|
809
924
|
],
|
|
810
925
|
schema: z.object({ mobile: z.boolean().optional(), tablet: z.boolean().optional(), desktop: z.boolean().optional() }),
|
|
811
926
|
}),
|
|
927
|
+
slot({
|
|
928
|
+
key: 'storefront.anchors', scope: '_Storefront_', area: 'Studio', label: 'Anchored elements',
|
|
929
|
+
hint: 'Everything the visual editor writes: elements hidden, moved, reworded or restyled by clicking on the page itself.',
|
|
930
|
+
kind: 'record', entryKind: 'object', ops: ['merge', 'set'], fields: ANCHOR_FIELDS, itemKey: 'anchor',
|
|
931
|
+
schema: anchorsSchema,
|
|
932
|
+
}),
|
|
933
|
+
slot({
|
|
934
|
+
key: 'checkout.anchors', scope: '_Checkout_', area: 'Studio', label: 'Anchored elements',
|
|
935
|
+
hint: 'Everything the visual editor writes: elements hidden, moved, reworded or restyled by clicking on the page itself.',
|
|
936
|
+
kind: 'record', entryKind: 'object', ops: ['merge', 'set'], fields: ANCHOR_FIELDS, itemKey: 'anchor',
|
|
937
|
+
schema: anchorsSchema,
|
|
938
|
+
}),
|
|
812
939
|
];
|
|
813
940
|
const MVT_SLOTS_BY_KEY = new Map(MVT_SLOTS.map(s => [s.key, s]));
|
|
814
941
|
export function mvtSlot(key) {
|
|
@@ -832,8 +959,12 @@ export function mvtValidateOverrides(overrides) {
|
|
|
832
959
|
if (override.op === 'remove' || override.op === 'reorder')
|
|
833
960
|
return;
|
|
834
961
|
if (override.op === 'merge' || override.op === 'patch' || override.op === 'insert') {
|
|
835
|
-
if (override.value === undefined)
|
|
962
|
+
if (override.value === undefined) {
|
|
836
963
|
issues.push({ index, slot: override.slot, reason: 'missing_value' });
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
if (definition.kind === 'record' && !definition.schema.safeParse(override.value).success)
|
|
967
|
+
issues.push({ index, slot: override.slot, reason: 'invalid_value' });
|
|
837
968
|
return;
|
|
838
969
|
}
|
|
839
970
|
if (!definition.schema.safeParse(override.value).success)
|
|
@@ -898,3 +1029,54 @@ export function mvtApplyOverride(base, override) {
|
|
|
898
1029
|
return base;
|
|
899
1030
|
}
|
|
900
1031
|
}
|
|
1032
|
+
export const MVT_ANCHOR_ATTRIBUTE = 'data-mvt-anchor';
|
|
1033
|
+
export function mvtAnchorsSlot(scope) {
|
|
1034
|
+
return scope === '_Checkout_' ? 'checkout.anchors' : 'storefront.anchors';
|
|
1035
|
+
}
|
|
1036
|
+
export function mvtMergeAnchorPatch(base, next) {
|
|
1037
|
+
if (!base)
|
|
1038
|
+
return next ?? {};
|
|
1039
|
+
if (!next)
|
|
1040
|
+
return base;
|
|
1041
|
+
return {
|
|
1042
|
+
...base,
|
|
1043
|
+
...next,
|
|
1044
|
+
text: next.text || base.text ? { ...(base.text ?? {}), ...(next.text ?? {}) } : undefined,
|
|
1045
|
+
style: next.style || base.style ? { ...(base.style ?? {}), ...(next.style ?? {}) } : undefined,
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
export function mvtAnchorStyle(patch) {
|
|
1049
|
+
const style = patch?.style;
|
|
1050
|
+
if (!style)
|
|
1051
|
+
return {};
|
|
1052
|
+
const out = {};
|
|
1053
|
+
if (style.background)
|
|
1054
|
+
out['background-color'] = style.background;
|
|
1055
|
+
if (style.color)
|
|
1056
|
+
out['color'] = style.color;
|
|
1057
|
+
if (style.borderColor)
|
|
1058
|
+
out['border-color'] = style.borderColor;
|
|
1059
|
+
if (style.borderRadius !== undefined)
|
|
1060
|
+
out['border-radius'] = `${style.borderRadius}px`;
|
|
1061
|
+
if (style.fontSize !== undefined)
|
|
1062
|
+
out['font-size'] = `${style.fontSize}px`;
|
|
1063
|
+
if (style.fontWeight)
|
|
1064
|
+
out['font-weight'] = style.fontWeight;
|
|
1065
|
+
if (style.align)
|
|
1066
|
+
out['text-align'] = style.align;
|
|
1067
|
+
if (style.paddingY !== undefined)
|
|
1068
|
+
out['padding-block'] = `${style.paddingY}px`;
|
|
1069
|
+
if (style.paddingX !== undefined)
|
|
1070
|
+
out['padding-inline'] = `${style.paddingX}px`;
|
|
1071
|
+
return out;
|
|
1072
|
+
}
|
|
1073
|
+
export const MVT_STUDIO_PROTOCOL = 1;
|
|
1074
|
+
export function mvtIsStudioEvent(data) {
|
|
1075
|
+
if (!data || typeof data !== 'object')
|
|
1076
|
+
return false;
|
|
1077
|
+
const message = data;
|
|
1078
|
+
return message.protocol === MVT_STUDIO_PROTOCOL && typeof message.type === 'string' && message.type.startsWith('studio:');
|
|
1079
|
+
}
|
|
1080
|
+
export function mvtIsStudioRequest(data) {
|
|
1081
|
+
return mvtIsStudioEvent(data);
|
|
1082
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifeaz/lors-helper",
|
|
3
3
|
"description": "Lifeaz Online Retail Storefront Helper",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"lifeaz": {
|
|
52
52
|
"version": {
|
|
53
53
|
"short": 1,
|
|
54
|
-
"full": "1.1.
|
|
55
|
-
"code": "
|
|
54
|
+
"full": "1.1.1-b36",
|
|
55
|
+
"code": "101010036"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/main.ts
CHANGED
|
@@ -696,7 +696,14 @@ export type MvtOperator =
|
|
|
696
696
|
| '_Path_Matches_'
|
|
697
697
|
| '_Has_Cart_'
|
|
698
698
|
| '_Hour_Of_Day_Between_'
|
|
699
|
-
| '_Day_Of_Week_In_'
|
|
699
|
+
| '_Day_Of_Week_In_'
|
|
700
|
+
| '_Query_Param_Matches_'
|
|
701
|
+
| '_Screen_Width_Between_'
|
|
702
|
+
| '_Visits_At_Least_'
|
|
703
|
+
| '_Logged_In_'
|
|
704
|
+
| '_Logged_Out_'
|
|
705
|
+
| '_Is_Weekend_'
|
|
706
|
+
| '_Date_Between_';
|
|
700
707
|
|
|
701
708
|
export const MvtOperatorSchema = z.union([
|
|
702
709
|
z.literal('_Device_In_'),
|
|
@@ -717,6 +724,13 @@ export const MvtOperatorSchema = z.union([
|
|
|
717
724
|
z.literal('_Has_Cart_'),
|
|
718
725
|
z.literal('_Hour_Of_Day_Between_'),
|
|
719
726
|
z.literal('_Day_Of_Week_In_'),
|
|
727
|
+
z.literal('_Query_Param_Matches_'),
|
|
728
|
+
z.literal('_Screen_Width_Between_'),
|
|
729
|
+
z.literal('_Visits_At_Least_'),
|
|
730
|
+
z.literal('_Logged_In_'),
|
|
731
|
+
z.literal('_Logged_Out_'),
|
|
732
|
+
z.literal('_Is_Weekend_'),
|
|
733
|
+
z.literal('_Date_Between_'),
|
|
720
734
|
]);
|
|
721
735
|
|
|
722
736
|
/**
|
|
@@ -729,6 +743,9 @@ export const MVT_NULLARY_OPERATORS: readonly MvtOperator[] = [
|
|
|
729
743
|
'_Visitor_Is_New_',
|
|
730
744
|
'_Visitor_Is_Returning_',
|
|
731
745
|
'_Has_Cart_',
|
|
746
|
+
'_Logged_In_',
|
|
747
|
+
'_Logged_Out_',
|
|
748
|
+
'_Is_Weekend_',
|
|
732
749
|
];
|
|
733
750
|
|
|
734
751
|
export type MvtOverrideOp = 'set' | 'merge' | 'remove' | 'reorder' | 'insert' | 'patch';
|
|
@@ -764,9 +781,36 @@ export const MvtVariantSchema = z.object({
|
|
|
764
781
|
weight: z.number().int().nonnegative(),
|
|
765
782
|
control: z.boolean(),
|
|
766
783
|
overrides: z.array(MvtOverrideSchema),
|
|
784
|
+
/**
|
|
785
|
+
* Optional sub-targeting. A variant carrying one stops being a share of the split and becomes
|
|
786
|
+
* a rule: every unit matching it lands here, whatever the weights say. See mvtPickVariant.
|
|
787
|
+
*/
|
|
788
|
+
audience: MvtAudienceNodeSchema.nullable().default(null),
|
|
789
|
+
/** Evaluation order of the targeted variants. The first match wins, so this is the tie-break. */
|
|
790
|
+
order: z.number().int().default(0),
|
|
791
|
+
/** Purely cosmetic, so one arm keeps the same colour across the split bar, the studio and the results. */
|
|
792
|
+
color: z.string().nullable().default(null),
|
|
793
|
+
description: z.string().nullable().default(null),
|
|
767
794
|
});
|
|
768
795
|
export type MvtVariant = z.infer<typeof MvtVariantSchema>;
|
|
769
796
|
|
|
797
|
+
/**
|
|
798
|
+
* How one variant ends up receiving traffic, resolved from the variant set as a whole.
|
|
799
|
+
*
|
|
800
|
+
* `_Targeted_` variants are claimed by their own conditions and take no part in the weighted
|
|
801
|
+
* draw; `_Weighted_` ones share whatever is left. Computed in one place because the operator is
|
|
802
|
+
* shown this and the evaluator obeys it, and the two disagreeing would be the worst outcome.
|
|
803
|
+
*/
|
|
804
|
+
export type MvtAllocationMode = '_Targeted_' | '_Weighted_' | '_Unreachable_';
|
|
805
|
+
|
|
806
|
+
export interface MvtAllocationRow {
|
|
807
|
+
key: string;
|
|
808
|
+
mode: MvtAllocationMode;
|
|
809
|
+
weight: number;
|
|
810
|
+
/** Share of the units that reach the weighted draw. Zero for a targeted variant, whose share depends on the audience rather than on a number. */
|
|
811
|
+
sharePct: number;
|
|
812
|
+
}
|
|
813
|
+
|
|
770
814
|
export const MvtExperimentSchema = z.object({
|
|
771
815
|
id: uuidSchema,
|
|
772
816
|
key: z.string().min(1),
|
|
@@ -815,6 +859,42 @@ export interface MvtContext {
|
|
|
815
859
|
hasCart: boolean;
|
|
816
860
|
firstSeenAt: number;
|
|
817
861
|
now: number;
|
|
862
|
+
/** Query string of the landing URL, lowercased keys. Reads as a targeting dimension of its own so an ad link can pin an arm without an UTM convention. */
|
|
863
|
+
query: Record<string, string>;
|
|
864
|
+
/** Viewport width in CSS pixels. Coarser than the device buckets, for the tests where the breakpoint itself is the subject. */
|
|
865
|
+
screenWidth: number;
|
|
866
|
+
/** Sessions this unit has opened, this one included. */
|
|
867
|
+
visits: number;
|
|
868
|
+
loggedIn: boolean;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Fill in the dimensions an older caller does not provide.
|
|
873
|
+
*
|
|
874
|
+
* The context grew, and a front built against the previous shape must not start failing every
|
|
875
|
+
* leaf that reads a new field. Defaults are chosen so an absent dimension excludes rather than
|
|
876
|
+
* includes: a condition on something the caller cannot observe should not match everybody.
|
|
877
|
+
*/
|
|
878
|
+
export function mvtNormalizeContext(context: Partial<MvtContext> & { unitId: string }): MvtContext {
|
|
879
|
+
return {
|
|
880
|
+
device: '_Desktop_',
|
|
881
|
+
lang: 'fr',
|
|
882
|
+
country: null,
|
|
883
|
+
profile: null,
|
|
884
|
+
partner: null,
|
|
885
|
+
seen: {},
|
|
886
|
+
utm: { source: null, medium: null, campaign: null },
|
|
887
|
+
referrer: null,
|
|
888
|
+
path: '/',
|
|
889
|
+
hasCart: false,
|
|
890
|
+
firstSeenAt: Date.now(),
|
|
891
|
+
now: Date.now(),
|
|
892
|
+
query: {},
|
|
893
|
+
screenWidth: 0,
|
|
894
|
+
visits: 1,
|
|
895
|
+
loggedIn: false,
|
|
896
|
+
...context,
|
|
897
|
+
};
|
|
818
898
|
}
|
|
819
899
|
|
|
820
900
|
export interface MvtDecision {
|
|
@@ -866,22 +946,61 @@ export function mvtIsEligibleForTraffic(experiment: MvtExperiment, unitId: strin
|
|
|
866
946
|
* so that the mapping from bucket range to variant depends only on the weights themselves and not
|
|
867
947
|
* on the order rows happened to come back from the database.
|
|
868
948
|
*/
|
|
869
|
-
export function mvtPickVariant(experiment: MvtExperiment, unitId: string): MvtVariant | null {
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
949
|
+
export function mvtPickVariant(experiment: MvtExperiment, unitId: string, context?: MvtContext): MvtVariant | null {
|
|
950
|
+
const targeted = experiment.variants
|
|
951
|
+
.filter(variant => !!variant.audience)
|
|
952
|
+
.sort((a, b) => (a.order ?? 0) - (b.order ?? 0) || a.key.localeCompare(b.key));
|
|
953
|
+
|
|
954
|
+
// Targeted arms are rules, not shares: the first whose own conditions hold claims the unit
|
|
955
|
+
// outright. Evaluated before the draw so that "everyone on mobile sees B" means exactly that
|
|
956
|
+
// rather than "mobile visitors have a better chance of seeing B", which is what a weight
|
|
957
|
+
// nudged by hand would have produced and what an operator would have had to verify by eye.
|
|
958
|
+
if (context)
|
|
959
|
+
for (const variant of targeted)
|
|
960
|
+
if (mvtEvaluateAudience(variant.audience ?? null, context)) return variant;
|
|
961
|
+
|
|
962
|
+
const pool = experiment.variants.filter(variant => !variant.audience).sort((a, b) => a.key.localeCompare(b.key));
|
|
963
|
+
const total = pool.reduce((sum, v) => sum + Math.max(v.weight, 0), 0);
|
|
964
|
+
|
|
965
|
+
// Every arm targeted and none of them matching leaves nobody to fall back on. The unit is
|
|
966
|
+
// left out of the experiment entirely rather than pushed onto an arm whose conditions it
|
|
967
|
+
// failed, which would silently make the targeting a lie.
|
|
968
|
+
if (!pool.length || total <= 0) return null;
|
|
874
969
|
|
|
875
970
|
const target = (mvtBucket(experiment.salt, unitId) / 10000) * total;
|
|
876
971
|
let cursor = 0;
|
|
877
972
|
|
|
878
|
-
for (const variant of
|
|
973
|
+
for (const variant of pool) {
|
|
879
974
|
cursor += Math.max(variant.weight, 0);
|
|
880
975
|
|
|
881
976
|
if (target < cursor) return variant;
|
|
882
977
|
}
|
|
883
978
|
|
|
884
|
-
return
|
|
979
|
+
return pool[pool.length - 1];
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* How the split actually resolves, for the operator rather than the evaluator.
|
|
984
|
+
*
|
|
985
|
+
* Weights are relative and targeted arms are outside the draw entirely, so the number an operator
|
|
986
|
+
* typed and the share it buys are rarely the same. Computing that here, from the same rules the
|
|
987
|
+
* bucketing obeys, is what lets the interface show a split bar that cannot drift from the truth.
|
|
988
|
+
*/
|
|
989
|
+
export function mvtDistribution(variants: readonly MvtVariant[]): MvtAllocationRow[] {
|
|
990
|
+
const pool = variants.filter(variant => !variant.audience);
|
|
991
|
+
const total = pool.reduce((sum, v) => sum + Math.max(v.weight, 0), 0);
|
|
992
|
+
|
|
993
|
+
return variants.map(variant => {
|
|
994
|
+
if (variant.audience) return { key: variant.key, mode: '_Targeted_' as const, weight: variant.weight, sharePct: 0 };
|
|
995
|
+
if (total <= 0 || variant.weight <= 0) return { key: variant.key, mode: '_Unreachable_' as const, weight: variant.weight, sharePct: 0 };
|
|
996
|
+
|
|
997
|
+
return {
|
|
998
|
+
key: variant.key,
|
|
999
|
+
mode: '_Weighted_' as const,
|
|
1000
|
+
weight: variant.weight,
|
|
1001
|
+
sharePct: Math.round((Math.max(variant.weight, 0) / total) * 1000) / 10,
|
|
1002
|
+
};
|
|
1003
|
+
});
|
|
885
1004
|
}
|
|
886
1005
|
|
|
887
1006
|
function mvtMatchesPattern(value: string | null, patterns: string[]): boolean {
|
|
@@ -929,6 +1048,47 @@ function mvtEvaluateLeaf(operator: MvtOperator, values: string[], context: MvtCo
|
|
|
929
1048
|
return from <= to ? hour >= from && hour <= to : hour >= from || hour <= to;
|
|
930
1049
|
}
|
|
931
1050
|
case '_Day_Of_Week_In_': return values.map(Number).includes(new Date(context.now).getDay());
|
|
1051
|
+
case '_Logged_In_': return context.loggedIn;
|
|
1052
|
+
case '_Logged_Out_': return !context.loggedIn;
|
|
1053
|
+
case '_Is_Weekend_': return [0, 6].includes(new Date(context.now).getDay());
|
|
1054
|
+
case '_Visits_At_Least_': return context.visits >= Number(values[0] ?? 1);
|
|
1055
|
+
|
|
1056
|
+
// Written "name=value", or "name" on its own to test for presence. The value side goes
|
|
1057
|
+
// through the same wildcard matcher as the UTM leaves, so utm-like conventions carried in
|
|
1058
|
+
// a bespoke parameter behave the way an operator already expects them to.
|
|
1059
|
+
case '_Query_Param_Matches_': {
|
|
1060
|
+
return values.some(raw => {
|
|
1061
|
+
const separator = raw.indexOf('=');
|
|
1062
|
+
const name = (separator < 0 ? raw : raw.slice(0, separator)).trim().toLowerCase();
|
|
1063
|
+
const expected = separator < 0 ? null : raw.slice(separator + 1);
|
|
1064
|
+
const actual = context.query[name];
|
|
1065
|
+
|
|
1066
|
+
if (actual === undefined) return false;
|
|
1067
|
+
if (expected === null) return true;
|
|
1068
|
+
|
|
1069
|
+
return mvtMatchesPattern(actual, [expected]);
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
case '_Screen_Width_Between_': {
|
|
1074
|
+
const from = Number(values[0] ?? 0);
|
|
1075
|
+
const to = Number(values[1] ?? Number.MAX_SAFE_INTEGER);
|
|
1076
|
+
|
|
1077
|
+
return context.screenWidth >= from && context.screenWidth <= to;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// Bounds are wall-clock dates, and either may be left out for an open-ended window. This
|
|
1081
|
+
// is not the experiment's own schedule: it is for the tests whose point is a date, such
|
|
1082
|
+
// as a variant that only exists over a sale weekend.
|
|
1083
|
+
case '_Date_Between_': {
|
|
1084
|
+
const from = values[0] ? Date.parse(values[0]) : Number.NEGATIVE_INFINITY;
|
|
1085
|
+
const to = values[1] ? Date.parse(values[1]) : Number.POSITIVE_INFINITY;
|
|
1086
|
+
|
|
1087
|
+
if (Number.isNaN(from) || Number.isNaN(to)) return false;
|
|
1088
|
+
|
|
1089
|
+
return context.now >= from && context.now <= to;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
932
1092
|
default: return false;
|
|
933
1093
|
}
|
|
934
1094
|
}
|
|
@@ -995,7 +1155,7 @@ export function mvtResolve(config: MvtConfig, context: MvtContext, forced: Recor
|
|
|
995
1155
|
if (!mvtEvaluateAudience(experiment.audience, context)) continue;
|
|
996
1156
|
if (!mvtIsEligibleForTraffic(experiment, context.unitId)) continue;
|
|
997
1157
|
|
|
998
|
-
const variant = mvtPickVariant(experiment, context.unitId);
|
|
1158
|
+
const variant = mvtPickVariant(experiment, context.unitId, context);
|
|
999
1159
|
|
|
1000
1160
|
if (!variant) continue;
|
|
1001
1161
|
if (experiment.exclusionGroup) claimed.add(experiment.exclusionGroup);
|
|
@@ -1058,9 +1218,62 @@ export interface MvtSlotDefinition {
|
|
|
1058
1218
|
schema: z.ZodType<unknown>;
|
|
1059
1219
|
}
|
|
1060
1220
|
|
|
1061
|
-
|
|
1221
|
+
/**
|
|
1222
|
+
* A piece of copy, written in whichever languages the operator filled in.
|
|
1223
|
+
*
|
|
1224
|
+
* Partial on purpose, and it has to be said in the schema rather than left to convention: zod
|
|
1225
|
+
* treats a record keyed by a closed set as exhaustive, so `z.record` here would refuse a French-
|
|
1226
|
+
* only override at write time - which is the normal case, since a language left empty is
|
|
1227
|
+
* documented everywhere as keeping the untouched original rather than blanking it.
|
|
1228
|
+
*/
|
|
1229
|
+
const i18nTextSchema = z.partialRecord(LangSchema, z.string());
|
|
1062
1230
|
const colorSchema = z.string().regex(/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i);
|
|
1063
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* What a test may do to one anchored element.
|
|
1234
|
+
*
|
|
1235
|
+
* This is the whole vocabulary of the visual editor, and it is deliberately short. Hide it, move
|
|
1236
|
+
* it, reword it, repoint it, restyle it within a closed set of properties. Nothing here can
|
|
1237
|
+
* inject markup or a script, so an override authored by clicking around a page carries the same
|
|
1238
|
+
* blast radius as one typed into the registry editor, which is what makes the studio safe to
|
|
1239
|
+
* hand to somebody who is not going to read a diff.
|
|
1240
|
+
*
|
|
1241
|
+
* Every field is optional and absence means untouched, so the patches stay small and two editing
|
|
1242
|
+
* sessions on the same element compose instead of overwriting one another.
|
|
1243
|
+
*/
|
|
1244
|
+
export const MvtAnchorPatchSchema = z.object({
|
|
1245
|
+
hidden: z.boolean().optional(),
|
|
1246
|
+
/** Position among its siblings. Lower comes first; anchors without one keep their place. */
|
|
1247
|
+
order: z.number().int().min(-999).max(999).optional(),
|
|
1248
|
+
text: i18nTextSchema.optional(),
|
|
1249
|
+
href: z.string().max(2048).optional(),
|
|
1250
|
+
route: z.string().max(512).optional(),
|
|
1251
|
+
image: z.string().max(2048).optional(),
|
|
1252
|
+
style: z.object({
|
|
1253
|
+
background: colorSchema.optional(),
|
|
1254
|
+
color: colorSchema.optional(),
|
|
1255
|
+
borderColor: colorSchema.optional(),
|
|
1256
|
+
borderRadius: z.number().int().min(0).max(96).optional(),
|
|
1257
|
+
fontSize: z.number().int().min(8).max(96).optional(),
|
|
1258
|
+
fontWeight: z.enum(['300', '400', '500', '600', '700', '800']).optional(),
|
|
1259
|
+
align: z.enum(['left', 'center', 'right']).optional(),
|
|
1260
|
+
paddingY: z.number().int().min(0).max(160).optional(),
|
|
1261
|
+
paddingX: z.number().int().min(0).max(160).optional(),
|
|
1262
|
+
}).optional(),
|
|
1263
|
+
});
|
|
1264
|
+
export type MvtAnchorPatch = z.infer<typeof MvtAnchorPatchSchema>;
|
|
1265
|
+
|
|
1266
|
+
const anchorsSchema = z.record(z.string(), MvtAnchorPatchSchema);
|
|
1267
|
+
|
|
1268
|
+
const ANCHOR_FIELDS: readonly MvtSlotField[] = [
|
|
1269
|
+
{ key: 'hidden', label: 'Hidden', kind: 'boolean' },
|
|
1270
|
+
{ key: 'order', label: 'Position', kind: 'number' },
|
|
1271
|
+
{ key: 'text', label: 'Text', kind: 'i18n' },
|
|
1272
|
+
{ key: 'href', label: 'External link', kind: 'text' },
|
|
1273
|
+
{ key: 'route', label: 'Internal route', kind: 'text' },
|
|
1274
|
+
{ key: 'image', label: 'Image', kind: 'image' },
|
|
1275
|
+
];
|
|
1276
|
+
|
|
1064
1277
|
function slot(definition: MvtSlotDefinition): MvtSlotDefinition {
|
|
1065
1278
|
return definition;
|
|
1066
1279
|
}
|
|
@@ -1200,6 +1413,19 @@ export const MVT_SLOTS: readonly MvtSlotDefinition[] = [
|
|
|
1200
1413
|
],
|
|
1201
1414
|
schema: z.object({ mobile: z.boolean().optional(), tablet: z.boolean().optional(), desktop: z.boolean().optional() }),
|
|
1202
1415
|
}),
|
|
1416
|
+
|
|
1417
|
+
slot({
|
|
1418
|
+
key: 'storefront.anchors', scope: '_Storefront_', area: 'Studio', label: 'Anchored elements',
|
|
1419
|
+
hint: 'Everything the visual editor writes: elements hidden, moved, reworded or restyled by clicking on the page itself.',
|
|
1420
|
+
kind: 'record', entryKind: 'object', ops: ['merge', 'set'], fields: ANCHOR_FIELDS, itemKey: 'anchor',
|
|
1421
|
+
schema: anchorsSchema,
|
|
1422
|
+
}),
|
|
1423
|
+
slot({
|
|
1424
|
+
key: 'checkout.anchors', scope: '_Checkout_', area: 'Studio', label: 'Anchored elements',
|
|
1425
|
+
hint: 'Everything the visual editor writes: elements hidden, moved, reworded or restyled by clicking on the page itself.',
|
|
1426
|
+
kind: 'record', entryKind: 'object', ops: ['merge', 'set'], fields: ANCHOR_FIELDS, itemKey: 'anchor',
|
|
1427
|
+
schema: anchorsSchema,
|
|
1428
|
+
}),
|
|
1203
1429
|
] as const;
|
|
1204
1430
|
|
|
1205
1431
|
const MVT_SLOTS_BY_KEY: ReadonlyMap<string, MvtSlotDefinition> = new Map(MVT_SLOTS.map(s => [s.key, s]));
|
|
@@ -1246,7 +1472,18 @@ export function mvtValidateOverrides(overrides: MvtOverride[]): MvtOverrideIssue
|
|
|
1246
1472
|
if (override.op === 'remove' || override.op === 'reorder') return;
|
|
1247
1473
|
|
|
1248
1474
|
if (override.op === 'merge' || override.op === 'patch' || override.op === 'insert') {
|
|
1249
|
-
if (override.value === undefined)
|
|
1475
|
+
if (override.value === undefined) {
|
|
1476
|
+
issues.push({ index, slot: override.slot, reason: 'missing_value' });
|
|
1477
|
+
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1481
|
+
// A merge onto a record is still a record of the same entries, so the full schema
|
|
1482
|
+
// applies and catches a malformed anchor patch here rather than in a customer's
|
|
1483
|
+
// browser. A merge onto a fixed-shape object is a partial by definition, and running
|
|
1484
|
+
// the whole schema over it would refuse every legitimate single-field edit.
|
|
1485
|
+
if (definition.kind === 'record' && !definition.schema.safeParse(override.value).success)
|
|
1486
|
+
issues.push({ index, slot: override.slot, reason: 'invalid_value' });
|
|
1250
1487
|
|
|
1251
1488
|
return;
|
|
1252
1489
|
}
|
|
@@ -1331,3 +1568,129 @@ export function mvtApplyOverride<T>(base: T, override: MvtOverride): T {
|
|
|
1331
1568
|
return base;
|
|
1332
1569
|
}
|
|
1333
1570
|
}
|
|
1571
|
+
|
|
1572
|
+
// -----------------------------------------------------------------------------
|
|
1573
|
+
// Anchors
|
|
1574
|
+
// -----------------------------------------------------------------------------
|
|
1575
|
+
|
|
1576
|
+
export const MVT_ANCHOR_ATTRIBUTE = 'data-mvt-anchor';
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* The anchors slot for one scope.
|
|
1580
|
+
*
|
|
1581
|
+
* Kept as a lookup rather than a naming convention the call sites repeat, because the studio, the
|
|
1582
|
+
* API validator and the two fronts all have to agree on it, and a typo in any of the four would
|
|
1583
|
+
* produce an override that validates and does nothing.
|
|
1584
|
+
*/
|
|
1585
|
+
export function mvtAnchorsSlot(scope: MvtScope): string {
|
|
1586
|
+
return scope === '_Checkout_' ? 'checkout.anchors' : 'storefront.anchors';
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* Fold a stack of anchor patches into one.
|
|
1591
|
+
*
|
|
1592
|
+
* Later patches win field by field rather than wholesale: two overrides touching the same element,
|
|
1593
|
+
* one hiding it and one rewording it, both have to survive, or the operator has to remember which
|
|
1594
|
+
* of their own edits cancelled which.
|
|
1595
|
+
*/
|
|
1596
|
+
export function mvtMergeAnchorPatch(base: MvtAnchorPatch | undefined, next: MvtAnchorPatch | undefined): MvtAnchorPatch {
|
|
1597
|
+
if (!base) return next ?? {};
|
|
1598
|
+
if (!next) return base;
|
|
1599
|
+
|
|
1600
|
+
return {
|
|
1601
|
+
...base,
|
|
1602
|
+
...next,
|
|
1603
|
+
text: next.text || base.text ? { ...(base.text ?? {}), ...(next.text ?? {}) } : undefined,
|
|
1604
|
+
style: next.style || base.style ? { ...(base.style ?? {}), ...(next.style ?? {}) } : undefined,
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* The inline style an anchor patch asks for, as a plain property bag.
|
|
1610
|
+
*
|
|
1611
|
+
* Only the closed set the patch schema allows can come out of here, which is the point: a front
|
|
1612
|
+
* applying this is not evaluating anything an operator wrote, it is reading a handful of numbers
|
|
1613
|
+
* and colours that have already been validated twice.
|
|
1614
|
+
*/
|
|
1615
|
+
export function mvtAnchorStyle(patch: MvtAnchorPatch | null | undefined): Record<string, string> {
|
|
1616
|
+
const style = patch?.style;
|
|
1617
|
+
|
|
1618
|
+
if (!style) return {};
|
|
1619
|
+
|
|
1620
|
+
const out: Record<string, string> = {};
|
|
1621
|
+
|
|
1622
|
+
if (style.background) out['background-color'] = style.background;
|
|
1623
|
+
if (style.color) out['color'] = style.color;
|
|
1624
|
+
if (style.borderColor) out['border-color'] = style.borderColor;
|
|
1625
|
+
if (style.borderRadius !== undefined) out['border-radius'] = `${style.borderRadius}px`;
|
|
1626
|
+
if (style.fontSize !== undefined) out['font-size'] = `${style.fontSize}px`;
|
|
1627
|
+
if (style.fontWeight) out['font-weight'] = style.fontWeight;
|
|
1628
|
+
if (style.align) out['text-align'] = style.align;
|
|
1629
|
+
if (style.paddingY !== undefined) out['padding-block'] = `${style.paddingY}px`;
|
|
1630
|
+
if (style.paddingX !== undefined) out['padding-inline'] = `${style.paddingX}px`;
|
|
1631
|
+
|
|
1632
|
+
return out;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
// -----------------------------------------------------------------------------
|
|
1636
|
+
// Studio bridge
|
|
1637
|
+
// -----------------------------------------------------------------------------
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* The message vocabulary between the Tools studio and the front rendered inside its frame.
|
|
1641
|
+
*
|
|
1642
|
+
* A separate protocol rather than a preview link with more query parameters, because the studio
|
|
1643
|
+
* has to do two things a link cannot: read back what is actually on the page - the anchors, their
|
|
1644
|
+
* labels, their nesting - and apply an edit without a reload, so that changing a colour is a
|
|
1645
|
+
* colour changing rather than a page blinking.
|
|
1646
|
+
*
|
|
1647
|
+
* Every message carries the protocol version. A front and a Tools release drift apart eventually,
|
|
1648
|
+
* and a version mismatch has to degrade to a plain preview rather than to an editor whose clicks
|
|
1649
|
+
* quietly do nothing.
|
|
1650
|
+
*/
|
|
1651
|
+
export const MVT_STUDIO_PROTOCOL = 1;
|
|
1652
|
+
|
|
1653
|
+
export type MvtStudioAnchorRole = 'section' | 'cta' | 'text' | 'image' | 'block';
|
|
1654
|
+
|
|
1655
|
+
export interface MvtStudioAnchor {
|
|
1656
|
+
/** Stable identifier written into the markup by the front, never derived from the DOM position. */
|
|
1657
|
+
id: string;
|
|
1658
|
+
label: string;
|
|
1659
|
+
role: MvtStudioAnchorRole;
|
|
1660
|
+
/** The anchor this one sits inside, for the studio's tree. Null at the top level. */
|
|
1661
|
+
parentId: string | null;
|
|
1662
|
+
order: number;
|
|
1663
|
+
/** What the untouched page shows today, so the editor opens on the real copy rather than an empty field. */
|
|
1664
|
+
text: string | null;
|
|
1665
|
+
movable: boolean;
|
|
1666
|
+
hideable: boolean;
|
|
1667
|
+
rect: { top: number; left: number; width: number; height: number };
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
/** Tools to front. */
|
|
1671
|
+
export type MvtStudioRequest =
|
|
1672
|
+
| { protocol: number; type: 'studio:hello' }
|
|
1673
|
+
| { protocol: number; type: 'studio:scan' }
|
|
1674
|
+
| { protocol: number; type: 'studio:select'; anchorId: string | null }
|
|
1675
|
+
| { protocol: number; type: 'studio:apply'; anchors: Record<string, MvtAnchorPatch>; lang: string }
|
|
1676
|
+
| { protocol: number; type: 'studio:mode'; picking: boolean }
|
|
1677
|
+
| { protocol: number; type: 'studio:navigate'; path: string };
|
|
1678
|
+
|
|
1679
|
+
/** Front to Tools. */
|
|
1680
|
+
export type MvtStudioEvent =
|
|
1681
|
+
| { protocol: number; type: 'studio:ready'; scope: MvtScope; path: string; langs: string[] }
|
|
1682
|
+
| { protocol: number; type: 'studio:anchors'; anchors: MvtStudioAnchor[]; path: string }
|
|
1683
|
+
| { protocol: number; type: 'studio:picked'; anchor: MvtStudioAnchor }
|
|
1684
|
+
| { protocol: number; type: 'studio:navigated'; path: string };
|
|
1685
|
+
|
|
1686
|
+
export function mvtIsStudioEvent(data: unknown): data is MvtStudioEvent {
|
|
1687
|
+
if (!data || typeof data !== 'object') return false;
|
|
1688
|
+
|
|
1689
|
+
const message = data as Partial<MvtStudioEvent>;
|
|
1690
|
+
|
|
1691
|
+
return message.protocol === MVT_STUDIO_PROTOCOL && typeof message.type === 'string' && message.type.startsWith('studio:');
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
export function mvtIsStudioRequest(data: unknown): data is MvtStudioRequest {
|
|
1695
|
+
return mvtIsStudioEvent(data);
|
|
1696
|
+
}
|