@squiz/dx-page-contents-lib 2.0.0 → 2.0.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.
@@ -6,82 +6,132 @@ const crypto_1 = require("crypto");
6
6
  * Creates a variant resolver which resolves a single variant node that matches the provided options.
7
7
  */
8
8
  const createVariantResolver = (options) => {
9
+ var _a, _b, _c;
9
10
  const variantInterrogationResult = {
10
11
  segments: [],
11
12
  experiments: [],
12
13
  };
14
+ // Experiment variant "A" is the control. It has no variant node of its own (it means "no experiment condition"), so a
15
+ // visitor in A is resolved like a visitor with a segment only. The segment + experiment search is for variants such as B.
16
+ const filteredExperiments = (_b = (_a = options.experiments) === null || _a === void 0 ? void 0 : _a.filter((exp) => exp.variant !== 'A')) !== null && _b !== void 0 ? _b : [];
17
+ const requiresSegmentAndExperiment = !!((_c = options.segments) === null || _c === void 0 ? void 0 : _c.length) && !!filteredExperiments.length;
18
+ // Record the segment in the interrogation result.
19
+ //
20
+ // Every segment that is checked is recorded, even if the visitor is not in it. This is intentional.
21
+ // The cache learns what a page depends on from `x-dxp-cache-access`, and builds each visitor's cache key from it.
22
+ // If a visitor outside the segment (who sees the default) didn't report it, the cache could store that default page
23
+ // as if the segment didn't matter, and later serve it to visitors who are in the segment.
24
+ const recordSegment = (segment) => {
25
+ if (!variantInterrogationResult.segments.includes(segment.code)) {
26
+ variantInterrogationResult.segments.push(segment.code);
27
+ }
28
+ };
29
+ // Record the user's experiment variant in the interrogation result.
30
+ const recordExperiment = (experiment) => {
31
+ var _a;
32
+ const matchedExperiment = (_a = options.experiments) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === experiment.id);
33
+ const hasInterrogationItem = variantInterrogationResult.experiments.find((item) => item.id === experiment.id);
34
+ if (matchedExperiment && !hasInterrogationItem) {
35
+ // push the variant in the session to the interrogation result rather than the variant in the content.
36
+ // this is to avoid a limitation in the CF cache key generation where the id+variant become
37
+ // dis-associated. the id+variant are not considered as a composite value when evaluating the
38
+ // intersection between session/cache access. rather the values are handled independently and can
39
+ // create the same cache keys (particularly when multiple experiments are running concurrently).
40
+ //
41
+ // means slightly worse cache hit rates, eg. "A" + default content will hit separate caches.
42
+ //
43
+ // per thread: https://squiz.slack.com/archives/C054L4Y89T4/p1707384416480379
44
+ variantInterrogationResult.experiments.push({
45
+ id: matchedExperiment.id,
46
+ variant: matchedExperiment.variant,
47
+ });
48
+ }
49
+ };
50
+ // Check if the variant's segment matches the provided option(s). Also records the segment as interrogated.
51
+ const isSegmentMatched = (segment) => {
52
+ var _a, _b;
53
+ recordSegment(segment);
54
+ return (_b = (_a = options.segments) === null || _a === void 0 ? void 0 : _a.includes(segment.code)) !== null && _b !== void 0 ? _b : false;
55
+ };
56
+ // Check if the variant's experiment matches the provided option(s). Also records the experiment as interrogated.
57
+ const isExperimentMatched = (experiment) => {
58
+ var _a, _b;
59
+ recordExperiment(experiment);
60
+ return ((_b = (_a = options.experiments) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === experiment.id)) === null || _b === void 0 ? void 0 : _b.variant) === experiment.variant;
61
+ };
62
+ // Find the fully matched variant to the provided option(s)
63
+ const findMatchedVariant = (node) => node.variants.find((variant) => {
64
+ const { segment, experiment } = variant.conditions;
65
+ // If true, need to validate against both segment and experiment.
66
+ // Otherwise skip this check.
67
+ if (requiresSegmentAndExperiment) {
68
+ return !!segment && !!experiment && isSegmentMatched(segment) && isExperimentMatched(experiment);
69
+ }
70
+ // Check if the variant conditions' segment is included in the provided options
71
+ if (segment && !isSegmentMatched(segment)) {
72
+ return false;
73
+ }
74
+ // Check if the variant conditions' experiment is included in the provided options
75
+ if (experiment && !isExperimentMatched(experiment)) {
76
+ return false;
77
+ }
78
+ return true;
79
+ });
80
+ // Find the segment-only matched variant to the provided option(s) as fallback
81
+ const findSegmentMatchedFallbackVariant = (node) => node.variants.find(({ conditions }) => {
82
+ const { segment, experiment } = conditions;
83
+ return segment && !experiment && isSegmentMatched(segment);
84
+ });
85
+ // Find the experiment-only matched variant to the provided option(s) as fallback
86
+ const findExperimentMatchedFallbackVariant = (node) => node.variants.find(({ conditions }) => {
87
+ const { segment, experiment } = conditions;
88
+ return experiment && !segment && isExperimentMatched(experiment);
89
+ });
90
+ /**
91
+ * Records experiments nested inside a segment (a variant with both a segment and an experiment condition).
92
+ *
93
+ * Why: for a visitor in that segment, experiment variant B is shown the "segment + experiment" variant, but
94
+ * experiment variant A (the control) is shown the plain "segment only" variant. Control A is never stored as its own
95
+ * variant node (it means "no experiment condition"). So the same page differs by experiment variant, and the
96
+ * experiment must be recorded for both A and B.
97
+ * Recording feeds the `x-dxp-optimize` header and the experiment cache key.
98
+ *
99
+ * Without this pass, an experiment variant A visitor matches the "segment only" variant first and the search stops, so the
100
+ * "segment + experiment" variant is never looked at and A is never recorded.
101
+ */
102
+ const recordNestedExperiments = (node) => node.variants.forEach(({ conditions: { segment, experiment } }) => {
103
+ var _a;
104
+ if (segment && experiment && ((_a = options.segments) === null || _a === void 0 ? void 0 : _a.includes(segment.code))) {
105
+ recordExperiment(experiment);
106
+ }
107
+ });
13
108
  return {
14
109
  variantResolver: async (node, resolve) => {
15
- var _a, _b, _c, _d, _e, _f;
16
- // Filter out default experiments (variant 'A'),
17
- // and should only check both when segments and experiments (variant 'B') are available in options
18
- const filteredExperiments = (_b = (_a = options.experiments) === null || _a === void 0 ? void 0 : _a.filter((exp) => exp.variant !== 'A')) !== null && _b !== void 0 ? _b : [];
19
- const requiresSegmentAndExperiment = !!((_c = options.segments) === null || _c === void 0 ? void 0 : _c.length) && !!filteredExperiments.length;
110
+ var _a, _b, _c;
20
111
  const defaultVariant = node.default;
21
- // Check if the variant's segment matches the provided option(s)
22
- const isSegmentMatched = (segment) => {
23
- var _a, _b;
24
- if (!variantInterrogationResult.segments.includes(segment.code)) {
25
- variantInterrogationResult.segments.push(segment.code);
26
- }
27
- return (_b = (_a = options.segments) === null || _a === void 0 ? void 0 : _a.includes(segment.code)) !== null && _b !== void 0 ? _b : false;
28
- };
29
- // Check if the variant's experiment matches the provided option(s)
30
- const isExperimentMatched = (experiment) => {
31
- var _a;
32
- const matchedExperiment = (_a = options.experiments) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === experiment.id);
33
- const hasInterrogationItem = variantInterrogationResult.experiments.find((item) => item.id === experiment.id);
34
- if (matchedExperiment && !hasInterrogationItem) {
35
- // push the variant in the session to the interrogation result rather than the variant in the content.
36
- // this is to avoid a limitation in the CF cache key generation where the id+variant become
37
- // dis-associated. the id+variant are not considered as a composite value when evaluating the
38
- // intersection between session/cache access. rather the values are handled independently and can
39
- // create the same cache keys (particularly when multiple experiments are running concurrently).
40
- //
41
- // means slightly worse cache hit rates, eg. "A" + default content will hit separate caches.
42
- //
43
- // per thread: https://squiz.slack.com/archives/C054L4Y89T4/p1707384416480379
44
- variantInterrogationResult.experiments.push({
45
- id: matchedExperiment.id,
46
- variant: matchedExperiment.variant,
47
- });
48
- }
49
- return (matchedExperiment === null || matchedExperiment === void 0 ? void 0 : matchedExperiment.variant) === experiment.variant;
50
- };
51
- // Find the fully matched variant to the provided option(s)
52
- const findMatchedVariant = (node) => node.variants.find((variant) => {
53
- const { segment, experiment } = variant.conditions;
54
- // If true, need to validate against both segment and experiment.
55
- // Otherwise skip this check.
56
- if (requiresSegmentAndExperiment) {
57
- return !!segment && !!experiment && isSegmentMatched(segment) && isExperimentMatched(experiment);
58
- }
59
- // Check if the variant conditions' segment is included in the provided options
60
- if (segment && !isSegmentMatched(segment)) {
61
- return false;
62
- }
63
- // Check if the variant conditions' experiment is included in the provided options
64
- if (experiment && !isExperimentMatched(experiment)) {
65
- return false;
66
- }
67
- return true;
68
- });
69
- // Find the segment-only matched variant to the provided option(s) as fallback
70
- const findSegmentMatchedFallbackVariant = (node) => node.variants.find(({ conditions }) => {
71
- const { segment, experiment } = conditions;
72
- return segment && !experiment && isSegmentMatched(segment);
73
- });
74
- // Find the experiment-only matched variant to the provided option(s) as fallback
75
- const findExperimentMatchedFallbackVariant = (node) => node.variants.find(({ conditions }) => {
76
- const { segment, experiment } = conditions;
77
- return experiment && !segment && isExperimentMatched(experiment);
78
- });
79
- // Determine the best matching variant based on provided segments and experiments.
80
- // 1. First, try to find a fully matched variant (both segment & experiment if required).
81
- // 2. If no match and `requiresSegmentAndExperiment` is true, attempt a segment-only fallback.
82
- // 3. If still no match and `requiresSegmentAndExperiment` is true, attempt an experiment-only fallback.
83
- // 4. If still no match, fall back to the default variant.
84
- const variant = (_f = (_e = (_d = findMatchedVariant(node)) !== null && _d !== void 0 ? _d : (requiresSegmentAndExperiment ? findSegmentMatchedFallbackVariant(node) : null)) !== null && _e !== void 0 ? _e : (requiresSegmentAndExperiment ? findExperimentMatchedFallbackVariant(node) : null)) !== null && _f !== void 0 ? _f : defaultVariant;
112
+ // Record the user's experiment variant for all nested experiments.
113
+ recordNestedExperiments(node);
114
+ /**
115
+ * Determine the best matching variant.
116
+ *
117
+ * - In a segment AND in an experiment variant such as B (`requiresSegmentAndExperiment`):
118
+ * the best kind of variant wins, regardless of list order:
119
+ * 1. "segment + experiment"
120
+ * 2. "segment only" (fallback)
121
+ * 3. "experiment only" (fallback)
122
+ * 4. the default variant
123
+ *
124
+ * - In a segment only (no experiment): the first "segment only" variant in the list that matches, else the default.
125
+ *
126
+ * - In an experiment variant only (no segment), such as B: the first "experiment only" variant in the list that
127
+ * matches, else the default.
128
+ *
129
+ * - In a segment AND in experiment variant A (the control): A has no variant node of its own ("segment only" is what A sees), so this is
130
+ * the same as "segment only" above.
131
+ *
132
+ * - In neither: the default.
133
+ */
134
+ const variant = (_c = (_b = (_a = findMatchedVariant(node)) !== null && _a !== void 0 ? _a : (requiresSegmentAndExperiment ? findSegmentMatchedFallbackVariant(node) : null)) !== null && _b !== void 0 ? _b : (requiresSegmentAndExperiment ? findExperimentMatchedFallbackVariant(node) : null)) !== null && _c !== void 0 ? _c : defaultVariant;
85
135
  // If no node, return undefined unless we're in preview mode, return an empty text node.
86
136
  // This is to keep block indexes correct for the `data-sq-block-index` when rendering previews.
87
137
  return variant.node
@@ -1 +1 @@
1
- {"version":3,"file":"create-variant-resolver.js","sourceRoot":"","sources":["../../src/resolvers/create-variant-resolver.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AAoBpC;;GAEG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAA+B,EAA+B,EAAE;IACpG,MAAM,0BAA0B,GAA+B;QAC7D,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,EAAE;KAChB,CAAC;IAEF,OAAO;QACL,eAAe,EAAE,KAAK,EAAE,IAAyB,EAAE,OAAqB,EAAsC,EAAE;;YAC9G,gDAAgD;YAChD,kGAAkG;YAClG,MAAM,mBAAmB,GAAG,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC,mCAAI,EAAE,CAAC;YAC5F,MAAM,4BAA4B,GAAG,CAAC,CAAC,CAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC;YAEhG,MAAM,cAAc,GAAG,IAAI,CAAC,OAAwB,CAAC;YAErD,gEAAgE;YAChE,MAAM,gBAAgB,GAAG,CAAC,OAAyB,EAAE,EAAE;;gBACrD,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;oBAChE,0BAA0B,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACzD,CAAC;gBAED,OAAO,MAAA,MAAA,OAAO,CAAC,QAAQ,0CAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,mCAAI,KAAK,CAAC;YAC3D,CAAC,CAAC;YAEF,mEAAmE;YACnE,MAAM,mBAAmB,GAAG,CAAC,UAA2C,EAAE,EAAE;;gBAC1E,MAAM,iBAAiB,GAAG,MAAA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