@se-studio/ab-testing 18.1.0 → 18.2.0
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/CHANGELOG.md +6 -0
- package/README.md +13 -1
- package/dist/buildNavLeafOverridesBySlug.d.ts +13 -0
- package/dist/buildNavLeafOverridesBySlug.d.ts.map +1 -0
- package/dist/buildNavLeafOverridesBySlug.js +24 -0
- package/dist/buildNavLeafOverridesBySlug.js.map +1 -0
- package/dist/components/AbTestStickyNavScript.d.ts +25 -0
- package/dist/components/AbTestStickyNavScript.d.ts.map +1 -0
- package/dist/components/AbTestStickyNavScript.js +93 -0
- package/dist/components/AbTestStickyNavScript.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/docs/llms.md +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @se-studio/ab-testing
|
|
2
2
|
|
|
3
|
+
## 18.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3177455: AbTestStickyNavScript: beforeInteractive DOM patch for sticky nav CTA leaves (data-ab-sticky-cta), plus buildNavLeafOverridesBySlug helper — same early-apply pattern as AbTestUtmScript.
|
|
8
|
+
|
|
3
9
|
## 18.1.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -209,7 +209,19 @@ const overrides = useAbTestStickyNavOverrides({ testsByPath });
|
|
|
209
209
|
const cta = applyNavLeafOverride(ssrCta, findNavLeafOverride(overrides, ctaPath));
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
Editor pattern: clone the Navigation, change the CTA item, link it on `pageVariant.menu`. After deploy, that CTA follows the visitor site-wide for the assigned bucket.
|
|
212
|
+
Editor pattern: clone the Navigation, change the CTA item, link it on `pageVariant.menu`. After deploy, that CTA follows the visitor site-wide for the assigned bucket.
|
|
213
|
+
|
|
214
|
+
Optional early paint (same pattern as `AbTestUtmScript`): mark CTA hosts with `data-ab-sticky-cta="{indexPath}"` and mount in the root layout:
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { AbTestStickyNavScript } from '@se-studio/ab-testing/components';
|
|
218
|
+
import { testsByPath } from '@/generated/abTests';
|
|
219
|
+
|
|
220
|
+
// root layout <head>:
|
|
221
|
+
<AbTestStickyNavScript testsByPath={testsByPath} />
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Keep the React hook path so HubSpot click props match after hydration. Brief control→variant flash is still possible if the script is omitted.
|
|
213
225
|
|
|
214
226
|
### 5. Create Your Analytics Reporter (Project-Specific)
|
|
215
227
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CachedAbTest } from './middleware/types.js';
|
|
2
|
+
import type { NavLeafOverride } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collapse baked `navLeafOverrides` across all tests into a slug → leaves map
|
|
5
|
+
* for {@link AbTestStickyNavScript} (beforeInteractive DOM patch).
|
|
6
|
+
*
|
|
7
|
+
* Later tests win on duplicate paths within the same slug; callers that need
|
|
8
|
+
* assignment-scoped merges should keep using {@link useAbTestStickyNavOverrides}.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildNavLeafOverridesBySlug(testsByPath: Record<string, CachedAbTest[]>): Record<string, NavLeafOverride[]>;
|
|
11
|
+
/** DOM attribute sites put on sticky CTA hosts for {@link AbTestStickyNavScript}. */
|
|
12
|
+
export declare const STICKY_NAV_CTA_ATTR = "data-ab-sticky-cta";
|
|
13
|
+
//# sourceMappingURL=buildNavLeafOverridesBySlug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildNavLeafOverridesBySlug.d.ts","sourceRoot":"","sources":["../src/buildNavLeafOverridesBySlug.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,GAC1C,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAYnC;AAED,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapse baked `navLeafOverrides` across all tests into a slug → leaves map
|
|
3
|
+
* for {@link AbTestStickyNavScript} (beforeInteractive DOM patch).
|
|
4
|
+
*
|
|
5
|
+
* Later tests win on duplicate paths within the same slug; callers that need
|
|
6
|
+
* assignment-scoped merges should keep using {@link useAbTestStickyNavOverrides}.
|
|
7
|
+
*/
|
|
8
|
+
export function buildNavLeafOverridesBySlug(testsByPath) {
|
|
9
|
+
const overridesBySlug = {};
|
|
10
|
+
for (const tests of Object.values(testsByPath)) {
|
|
11
|
+
for (const test of tests) {
|
|
12
|
+
if (!test.navLeafOverrides)
|
|
13
|
+
continue;
|
|
14
|
+
for (const [slug, leaves] of Object.entries(test.navLeafOverrides)) {
|
|
15
|
+
const existing = overridesBySlug[slug] ?? [];
|
|
16
|
+
overridesBySlug[slug] = [...existing, ...leaves];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return overridesBySlug;
|
|
21
|
+
}
|
|
22
|
+
/** DOM attribute sites put on sticky CTA hosts for {@link AbTestStickyNavScript}. */
|
|
23
|
+
export const STICKY_NAV_CTA_ATTR = 'data-ab-sticky-cta';
|
|
24
|
+
//# sourceMappingURL=buildNavLeafOverridesBySlug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildNavLeafOverridesBySlug.js","sourceRoot":"","sources":["../src/buildNavLeafOverridesBySlug.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,WAA2C;IAE3C,MAAM,eAAe,GAAsC,EAAE,CAAC;IAC9D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,gBAAgB;gBAAE,SAAS;YACrC,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACnE,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAC7C,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,MAAM,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CachedAbTest } from '../middleware/types.js';
|
|
2
|
+
export interface AbTestStickyNavScriptProps {
|
|
3
|
+
/**
|
|
4
|
+
* Baked testsByPath map from generate-ab-tests (same as the sticky hook).
|
|
5
|
+
*/
|
|
6
|
+
testsByPath: Record<string, CachedAbTest[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Cookie name to read assignments from.
|
|
9
|
+
* @default "ab-test-info"
|
|
10
|
+
*/
|
|
11
|
+
cookieName?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Inline script that patches sticky nav CTA leaves from the assignment cookie
|
|
15
|
+
* as early as possible (before React hydration), matching {@link AbTestUtmScript}.
|
|
16
|
+
*
|
|
17
|
+
* Sites mark CTA hosts with `data-ab-sticky-cta="{indexPath}"` (see
|
|
18
|
+
* {@link STICKY_NAV_CTA_ATTR}). Keep {@link useAbTestStickyNavOverrides} in the
|
|
19
|
+
* nav client so React props (and HubSpot click text) match after hydration.
|
|
20
|
+
*
|
|
21
|
+
* Must be rendered in the root layout only — Next.js requires
|
|
22
|
+
* `strategy="beforeInteractive"` scripts to live in the root layout.
|
|
23
|
+
*/
|
|
24
|
+
export declare function AbTestStickyNavScript({ testsByPath, cookieName, }: AbTestStickyNavScriptProps): import("react").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=AbTestStickyNavScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbTestStickyNavScript.d.ts","sourceRoot":"","sources":["../../src/components/AbTestStickyNavScript.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,UAA2B,GAC5B,EAAE,0BAA0B,+BAgF5B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Script from 'next/script';
|
|
3
|
+
import { buildNavLeafOverridesBySlug, STICKY_NAV_CTA_ATTR, } from '../buildNavLeafOverridesBySlug.js';
|
|
4
|
+
/**
|
|
5
|
+
* Inline script that patches sticky nav CTA leaves from the assignment cookie
|
|
6
|
+
* as early as possible (before React hydration), matching {@link AbTestUtmScript}.
|
|
7
|
+
*
|
|
8
|
+
* Sites mark CTA hosts with `data-ab-sticky-cta="{indexPath}"` (see
|
|
9
|
+
* {@link STICKY_NAV_CTA_ATTR}). Keep {@link useAbTestStickyNavOverrides} in the
|
|
10
|
+
* nav client so React props (and HubSpot click text) match after hydration.
|
|
11
|
+
*
|
|
12
|
+
* Must be rendered in the root layout only — Next.js requires
|
|
13
|
+
* `strategy="beforeInteractive"` scripts to live in the root layout.
|
|
14
|
+
*/
|
|
15
|
+
export function AbTestStickyNavScript({ testsByPath, cookieName = 'ab-test-info', }) {
|
|
16
|
+
const overridesBySlug = buildNavLeafOverridesBySlug(testsByPath);
|
|
17
|
+
const payload = JSON.stringify(overridesBySlug);
|
|
18
|
+
const attr = STICKY_NAV_CTA_ATTR;
|
|
19
|
+
return (_jsx(Script, { id: "ab-test-sticky-nav", strategy: "beforeInteractive", children: `
|
|
20
|
+
(function() {
|
|
21
|
+
try {
|
|
22
|
+
var overridesBySlug = ${payload};
|
|
23
|
+
var cookieName = ${JSON.stringify(cookieName)};
|
|
24
|
+
var attr = ${JSON.stringify(attr)};
|
|
25
|
+
function readLeaves() {
|
|
26
|
+
var m = document.cookie.match(new RegExp('(?:^| )' + cookieName + '=([^;]+)'));
|
|
27
|
+
if (!m) return [];
|
|
28
|
+
var assignments = JSON.parse(decodeURIComponent(m[1]));
|
|
29
|
+
var leaves = [];
|
|
30
|
+
var seen = {};
|
|
31
|
+
for (var testId in assignments) {
|
|
32
|
+
if (!Object.prototype.hasOwnProperty.call(assignments, testId)) continue;
|
|
33
|
+
var slug = assignments[testId] && assignments[testId].variant_slug;
|
|
34
|
+
if (!slug || slug === 'control') continue;
|
|
35
|
+
var list = overridesBySlug[slug];
|
|
36
|
+
if (!list || !list.length) continue;
|
|
37
|
+
for (var i = 0; i < list.length; i++) {
|
|
38
|
+
var leaf = list[i];
|
|
39
|
+
if (!leaf || !leaf.path || seen[leaf.path]) continue;
|
|
40
|
+
seen[leaf.path] = true;
|
|
41
|
+
leaves.push(leaf);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return leaves;
|
|
45
|
+
}
|
|
46
|
+
var applying = false;
|
|
47
|
+
function applyLeaves(leaves) {
|
|
48
|
+
if (!leaves.length || applying) return;
|
|
49
|
+
applying = true;
|
|
50
|
+
try {
|
|
51
|
+
var nodes = document.querySelectorAll('[' + attr + ']');
|
|
52
|
+
for (var n = 0; n < nodes.length; n++) {
|
|
53
|
+
var host = nodes[n];
|
|
54
|
+
var path = host.getAttribute(attr);
|
|
55
|
+
if (!path) continue;
|
|
56
|
+
var el =
|
|
57
|
+
host.tagName === 'A' || host.tagName === 'BUTTON'
|
|
58
|
+
? host
|
|
59
|
+
: host.querySelector('a,button');
|
|
60
|
+
if (!el) continue;
|
|
61
|
+
for (var i = 0; i < leaves.length; i++) {
|
|
62
|
+
if (leaves[i].path !== path) continue;
|
|
63
|
+
if (leaves[i].label && el.textContent !== leaves[i].label) {
|
|
64
|
+
el.textContent = leaves[i].label;
|
|
65
|
+
}
|
|
66
|
+
if (
|
|
67
|
+
leaves[i].href != null &&
|
|
68
|
+
el.tagName === 'A' &&
|
|
69
|
+
el.getAttribute('href') !== leaves[i].href
|
|
70
|
+
) {
|
|
71
|
+
el.setAttribute('href', leaves[i].href);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} finally {
|
|
77
|
+
applying = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function run() {
|
|
81
|
+
if (applying) return;
|
|
82
|
+
applyLeaves(readLeaves());
|
|
83
|
+
}
|
|
84
|
+
run();
|
|
85
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
86
|
+
var obs = new MutationObserver(run);
|
|
87
|
+
obs.observe(document.documentElement, { childList: true, subtree: true });
|
|
88
|
+
}
|
|
89
|
+
} catch (e) {}
|
|
90
|
+
})();
|
|
91
|
+
` }));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=AbTestStickyNavScript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbTestStickyNavScript.js","sourceRoot":"","sources":["../../src/components/AbTestStickyNavScript.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAe3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,WAAW,EACX,UAAU,GAAG,cAAc,GACA;IAC3B,MAAM,eAAe,GAAG,2BAA2B,CAAC,WAAW,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,mBAAmB,CAAC;IAEjC,OAAO,CACL,KAAC,MAAM,IAAC,EAAE,EAAC,oBAAoB,EAAC,QAAQ,EAAC,mBAAmB,YAAE;;;4BAGtC,OAAO;uBACZ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;iBAChC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmEhC,GAAU,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { AbTestReporter } from './AbTestReporter';
|
|
2
|
+
export type { AbTestStickyNavScriptProps } from './AbTestStickyNavScript';
|
|
3
|
+
export { AbTestStickyNavScript } from './AbTestStickyNavScript';
|
|
2
4
|
export { AbTestUtmScript } from './AbTestUtmScript';
|
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
+
export { buildNavLeafOverridesBySlug, STICKY_NAV_CTA_ATTR, } from './buildNavLeafOverridesBySlug.js';
|
|
8
9
|
export type { ActiveAbTestAssignment, UseAbTestAssignmentsOptions, UseAbTestStickyNavOverridesOptions, } from './hooks/index.js';
|
|
9
10
|
export { applyNavLeafOverride, findNavLeafOverride, useAbTestAssignments, useAbTestStickyNavOverrides, } from './hooks/index.js';
|
|
10
11
|
export type { AbTestMiddlewareConfig, AbTestResult, CachedAbTest, StaticAbTestMiddlewareOptions, TestsCache, } from './middleware/index.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACV,sBAAsB,EACtB,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,6BAA6B,EAC7B,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAErF,YAAY,EACV,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChG,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @packageDocumentation
|
|
7
7
|
*/
|
|
8
|
+
// Sticky nav leaf helpers (codegen + sites)
|
|
9
|
+
export { buildNavLeafOverridesBySlug, STICKY_NAV_CTA_ATTR, } from './buildNavLeafOverridesBySlug.js';
|
|
8
10
|
// Re-export hooks
|
|
9
11
|
export { applyNavLeafOverride, findNavLeafOverride, useAbTestAssignments, useAbTestStickyNavOverrides, } from './hooks/index.js';
|
|
10
12
|
// Re-export middleware utilities
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4CAA4C;AAC5C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAM1C,kBAAkB;AAClB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC;AAQ1B,iCAAiC;AACjC,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AAWrF,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAMhG,8BAA8B;AAC9B,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/docs/llms.md
CHANGED
|
@@ -87,6 +87,7 @@ const cta = applyNavLeafOverride(ssrCta, findNavLeafOverride(overrides, ctaPath)
|
|
|
87
87
|
- Control bucket → empty overrides (SSR default nav).
|
|
88
88
|
- Shape mismatch / missing menu → codegen skips sticky nav for that variant (warns, does not fail build).
|
|
89
89
|
- `experiment_impression` stays path-scoped via `useAbTestAssignments`; sticky chrome does not re-fire exposure.
|
|
90
|
+
- Optional early DOM patch: `AbTestStickyNavScript` from `@se-studio/ab-testing/components` with `testsByPath`, plus `data-ab-sticky-cta` markers on CTA hosts (`STICKY_NAV_CTA_ATTR`). Mount next to `AbTestUtmScript` in the root layout. Keep the hook so React/HubSpot props stay aligned after hydration.
|
|
90
91
|
|
|
91
92
|
## Webhook Handler (Contentful → update test cache)
|
|
92
93
|
|