@akinon/next 1.71.0-rc.2 → 1.71.0-rc.4

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,13 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.71.0-rc.4
4
+
5
+ ## 1.71.0-rc.3
6
+
7
+ ### Minor Changes
8
+
9
+ - 3344bca: ZERO-3013: Enable web vitals tracking in settings.js
10
+
3
11
  ## 1.71.0-rc.2
4
12
 
5
13
  ### Minor Changes
@@ -3,24 +3,26 @@
3
3
  import { useReportWebVitals } from 'next/web-vitals';
4
4
  import { useSelectedLayoutSegment } from 'next/navigation';
5
5
  import { usePathname } from 'next/navigation';
6
+ import settings from 'settings';
6
7
 
7
8
  export function WebVitals() {
8
9
  let layoutSegment = useSelectedLayoutSegment();
9
10
  const pathname = usePathname();
11
+ const { enabled } = settings.webVitals || { enabled: false };
10
12
 
11
13
  if (pathname === '/' && layoutSegment === null) {
12
14
  layoutSegment = 'home';
13
15
  }
14
16
 
15
17
  useReportWebVitals((metric) => {
16
- if (process.env.NODE_ENV !== 'development') {
18
+ if (process.env.NODE_ENV !== 'development' || !enabled) {
17
19
  return;
18
20
  }
19
21
 
20
22
  const { name, value, rating } = metric;
21
23
  const page = layoutSegment || 'unknown';
22
24
 
23
- fetch(`${process.env.NEXT_PUBLIC_URL}/api/web-vitals`, {
25
+ fetch(`/api/web-vitals`, {
24
26
  method: 'POST',
25
27
  headers: {
26
28
  'Content-Type': 'application/json'
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.71.0-rc.2",
4
+ "version": "1.71.0-rc.4",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "set-cookie-parser": "2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@akinon/eslint-plugin-projectzero": "1.71.0-rc.2",
33
+ "@akinon/eslint-plugin-projectzero": "1.71.0-rc.4",
34
34
  "@types/react-redux": "7.1.30",
35
35
  "@types/set-cookie-parser": "2.4.7",
36
36
  "@typescript-eslint/eslint-plugin": "6.7.4",
package/types/index.ts CHANGED
@@ -78,6 +78,9 @@ export interface Currency {
78
78
  }
79
79
 
80
80
  export interface Settings {
81
+ webVitals?: {
82
+ enabled: boolean;
83
+ };
81
84
  usePrettyUrlRoute?: boolean;
82
85
  commerceUrl: string;
83
86
  redis: {