@se-studio/ab-testing 1.0.107 → 2.0.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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @se-studio/ab-testing
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `@se-studio/hubspot` shared package for HubSpot tracking (`HubSpotAnalyticsAdapter`) and API-driven form rendering with CMS external component support.
8
+
9
+ Add `CompositeAnalyticsAdapter` and `AnalyticsPageTracker` to core-ui for multi-provider analytics (GTM + HubSpot SPA Mode B).
10
+
11
+ Update `AbTestReporter` to route experiment impressions through `useAnalytics`, including `hubspot_event` for HubSpot behavioural events.
12
+
13
+ - Updated dependencies
14
+ - @se-studio/core-ui@1.9.0
15
+
16
+ ## 1.1.0
17
+
18
+ ### Minor Changes
19
+
20
+ - Bulk version bump: minor for all packages
21
+
3
22
  ## 1.0.107
4
23
 
5
24
  ### Patch Changes
package/README.md CHANGED
@@ -157,6 +157,15 @@ export const config = {
157
157
  };
158
158
  ```
159
159
 
160
+ #### Page-test route (static rebuild pattern)
161
+
162
+ When using `createStaticAbTestMiddleware` with `variantPathPrefix: '/page-test'`, add a `/page-test/[...slugs]` route that rewrites serve variant content on the control URL. Use `findCanonicalPath(testsByPath, variantSlug)` to resolve the user-facing path, then call the paired handlers from `@se-studio/core-ui/server`:
163
+
164
+ - `generatePageTestMetadata` — control `indexed` and canonical path in `<head>`
165
+ - `generatePageTest` — variant body with control identity for breadcrumbs, `href`, and JSON-LD
166
+
167
+ See the `se-marketing-sites-create-page` skill for the full route template. Direct visits to a variant's own CMS URL (normal page route) should keep using `generatePage`.
168
+
160
169
  ### 3. Create the Webhook Handler
161
170
 
162
171
  ```typescript
@@ -1 +1 @@
1
- {"version":3,"file":"AbTestReporter.d.ts","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,SAgC7B"}
1
+ {"version":3,"file":"AbTestReporter.d.ts","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,SAuB7B"}
@@ -1,33 +1,26 @@
1
- /** biome-ignore-all lint/suspicious/noConsole: A/B test debug logging */
2
1
  'use client';
2
+ import { useAnalytics } from '@se-studio/core-ui';
3
3
  import { useEffect } from 'react';
4
4
  import { useAbTestAssignments } from '../hooks/useAbTestAssignments';
5
5
  export function AbTestReporter() {
6
6
  const assignments = useAbTestAssignments();
7
+ const { trackEvent } = useAnalytics();
7
8
  useEffect(() => {
8
- // null = not loaded yet, skip until cookie has been read
9
- if (assignments === null) {
10
- return;
11
- }
12
- if (assignments.length === 0) {
13
- console.log('[A/B reporter] No active tests on this page');
9
+ if (assignments === null || assignments.length === 0) {
14
10
  return;
15
11
  }
16
12
  for (const assignment of assignments) {
17
- console.log(`[A/B reporter] Test "${assignment.test_label}" (${assignment.testId})`, {
18
- variant: assignment.test_path,
19
- path: assignment.original_path,
20
- });
21
- // Push to GTM dataLayer
22
- window.dataLayer?.push({
23
- event: 'experiment_impression',
24
- experiment_id: assignment.testId,
25
- experiment_name: assignment.test_label,
26
- variant_id: assignment.test_path,
27
- utm_content: `${assignment.test_label}:${assignment.test_path}`,
13
+ trackEvent('experiment_impression', {
14
+ experimentId: assignment.testId,
15
+ experimentName: assignment.test_label,
16
+ variantId: assignment.test_path,
17
+ originalPath: assignment.original_path,
18
+ utmContent: `${assignment.test_label}:${assignment.test_path}`,
19
+ hubspotEvent: assignment.hubspot_event,
20
+ hubspot_event: assignment.hubspot_event,
28
21
  });
29
22
  }
30
- }, [assignments]);
23
+ }, [assignments, trackEvent]);
31
24
  return null;
32
25
  }
33
26
  //# sourceMappingURL=AbTestReporter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbTestReporter.js","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,YAAY,C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AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,UAAU,cAAc;IAC5B,MAAM,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO;QACT,CAAC;QAED,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,UAAU,CAAC,uBAAuB,EAAE;gBAClC,YAAY,EAAE,UAAU,CAAC,MAAM;gBAC/B,cAAc,EAAE,UAAU,CAAC,UAAU;gBACrC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,YAAY,EAAE,UAAU,CAAC,aAAa;gBACtC,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,SAAS,EAAE;gBAC9D,YAAY,EAAE,UAAU,CAAC,aAAa;gBACtC,aAAa,EAAE,UAAU,CAAC,aAAa;aACxC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IAE9B,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/ab-testing",
3
- "version": "1.0.107",
3
+ "version": "2.0.0",
4
4
  "description": "Server-side A/B testing framework for Next.js applications with Contentful CMS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -63,15 +63,17 @@
63
63
  "url": "https://github.com/Something-Else-Studio/se-core-product/issues"
64
64
  },
65
65
  "peerDependencies": {
66
- "next": ">=15.5.0",
67
- "react": "^19.0.0"
66
+ "next": ">=15.5.0 <16",
67
+ "react": "^19.0.0",
68
+ "@se-studio/core-ui": "1.9.0"
68
69
  },
69
70
  "devDependencies": {
70
- "@biomejs/biome": "^2.4.16",
71
- "@types/node": "^24.13.1",
71
+ "@biomejs/biome": "^2.5.0",
72
+ "@types/node": "^24.13.2",
72
73
  "@types/react": "^19.2.17",
73
74
  "next": "^15.5.19",
74
- "typescript": "^6.0.3"
75
+ "typescript": "^6.0.3",
76
+ "@se-studio/core-ui": "1.9.0"
75
77
  },
76
78
  "scripts": {
77
79
  "build": "tsc --project tsconfig.build.json",