@akinon/next 1.26.0-rc.8 → 1.26.0-rc.9

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,33 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.26.0-rc.9
4
+
5
+ ### Minor Changes
6
+
7
+ - 6d4aadb: ZERO-2476: Auto install recommendenent extension
8
+ - a7e432f: ZERO-2534: Fix for recapthca regex for replacing the special chars.
9
+ - 02fa342: ZERO-2507: Add web vitals endpoint
10
+ - 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
11
+ - f0c23bc: ZERO-2135: add custom not found page
12
+ - 1289982: ZERO-2521: Add x-forwarded-for header to requests
13
+ - 3690d3b: ZERO-2485: Check ESLint peerDependency version
14
+ - 40ad73e: ZERO-2504: add cookie filter to api client request
15
+ - b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
16
+ - b2da5e4: Revert ZERO-2435
17
+ - f76f079: ZERO-2493: Add redirect util function
18
+ - d6d2533: ZERO-2560: Add installment count to masterpass payment forms
19
+ - ff89630: ZERO-2498: Add script for env control
20
+
21
+ ### Patch Changes
22
+
23
+ - da1e501: ZERO-2296: Fix ROUTES import
24
+ - 073fbd2: ZERO-2503: Add check changeset control script
25
+ - 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
26
+ - 183674f: BRDG-9158: Handle locale prefix
27
+ - 8c7f5bc: ZERO-2440: Pipeline test
28
+ - Updated dependencies [073fbd2]
29
+ - @akinon/eslint-plugin-projectzero@1.26.0-rc.9
30
+
3
31
  ## 1.26.0-rc.8
4
32
 
5
33
  ### Minor Changes
@@ -0,0 +1,15 @@
1
+ import { NextResponse } from 'next/server';
2
+ import { trace, context } from '@opentelemetry/api';
3
+
4
+ export async function POST(req: Request) {
5
+ const { name, value, rating, page, pathname } = await req.json();
6
+ const span = trace.getSpan(context.active());
7
+
8
+ span?.setAttribute('page', page);
9
+ span?.setAttribute(name, value);
10
+ span?.setAttribute('rating', rating);
11
+ span?.setAttribute('pathname', pathname);
12
+ span?.end();
13
+
14
+ return NextResponse.json({ success: true });
15
+ }
@@ -2,6 +2,7 @@ import 'server-only';
2
2
  import ClientRoot from './client-root';
3
3
  import { cookies } from 'next/headers';
4
4
  import PzProviders from './pz-providers';
5
+ import { WebVitals } from './web-vitals';
5
6
 
6
7
  export default function PzRoot({
7
8
  translations,
@@ -15,6 +16,7 @@ export default function PzRoot({
15
16
 
16
17
  return (
17
18
  <PzProviders translations={translations}>
19
+ <WebVitals />
18
20
  <ClientRoot sessionId={sessionid}>{children}</ClientRoot>
19
21
  </PzProviders>
20
22
  );
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+
3
+ import { useReportWebVitals } from 'next/web-vitals';
4
+ import { useSelectedLayoutSegment } from 'next/navigation';
5
+ import { usePathname } from 'next/navigation';
6
+
7
+ export function WebVitals() {
8
+ let layoutSegment = useSelectedLayoutSegment();
9
+ const pathname = usePathname();
10
+
11
+ if (pathname === '/' && layoutSegment === null) {
12
+ layoutSegment = 'home';
13
+ }
14
+
15
+ useReportWebVitals((metric) => {
16
+ if (process.env.NODE_ENV !== 'development') {
17
+ return;
18
+ }
19
+
20
+ const { name, value, rating } = metric;
21
+ const page = layoutSegment || 'unknown';
22
+
23
+ fetch(`${process.env.NEXT_PUBLIC_URL}/api/web-vitals`, {
24
+ method: 'POST',
25
+ headers: {
26
+ 'Content-Type': 'application/json'
27
+ },
28
+ body: JSON.stringify({ name, value, rating, page, pathname })
29
+ });
30
+ });
31
+
32
+ return null;
33
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.26.0-rc.8",
4
+ "version": "1.26.0-rc.9",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {