File tree Expand file tree Collapse file tree 6 files changed +71
-0
lines changed
libs/storybook-host/.storybook Expand file tree Collapse file tree 6 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { FC , useEffect } from 'react' ;
2
+ import { useStorybookState } from '@storybook/manager-api' ;
3
+ import { pageview } from '@vercel/analytics' ;
4
+
5
+ export const VercelAnalyticsAddon : FC = ( ) => {
6
+ const { path } = useStorybookState ( ) ;
7
+
8
+ useEffect ( ( ) => {
9
+ pageview ( {
10
+ path,
11
+ } ) ;
12
+ } , [ path ] ) ;
13
+
14
+ return null ;
15
+ } ;
Original file line number Diff line number Diff line change
1
+ export * from './VercelAnalyticsAddon' ;
2
+ export * from './vercel-analytics.consts' ;
Original file line number Diff line number Diff line change
1
+ export const VERCEL_ANALYTICS_ADDON_ID = 'storybook/vercel-analytics' ;
2
+ export const VERCEL_ANALYTICS_TOOL_ID = `${ VERCEL_ANALYTICS_ADDON_ID } /listener` ;
3
+ export const VERCEL_ANALYTICS_ADDON_NAME = 'Vercel Analytics' ;
Original file line number Diff line number Diff line change
1
+ import { addons , types } from '@storybook/manager-api' ;
2
+ import { inject } from '@vercel/analytics' ;
3
+ import {
4
+ VERCEL_ANALYTICS_ADDON_ID ,
5
+ VERCEL_ANALYTICS_ADDON_NAME ,
6
+ VERCEL_ANALYTICS_TOOL_ID ,
7
+ VercelAnalyticsAddon ,
8
+ } from './addons/vercel-analytics' ;
9
+
10
+ addons . register ( VERCEL_ANALYTICS_ADDON_ID , ( ) => {
11
+ inject ( {
12
+ disableAutoTrack : true ,
13
+ } ) ;
14
+ addons . add ( VERCEL_ANALYTICS_TOOL_ID , {
15
+ type : types . TOOLEXTRA ,
16
+ render : VercelAnalyticsAddon ,
17
+ title : VERCEL_ANALYTICS_ADDON_NAME ,
18
+ } ) ;
19
+ } ) ;
Original file line number Diff line number Diff line change 15
15
"@emotion/react" : " ^11.13.3" ,
16
16
"@emotion/styled" : " ^11.13.0" ,
17
17
"@mui/material" : " ^5.16.7" ,
18
+ "@vercel/analytics" : " ^1.5.0" ,
18
19
"notistack" : " ^3.0.1" ,
19
20
"react" : " 18.3.1" ,
20
21
"react-dom" : " 18.3.1" ,
Original file line number Diff line number Diff line change @@ -7891,6 +7891,36 @@ __metadata:
7891
7891
languageName: node
7892
7892
linkType: hard
7893
7893
7894
+ "@vercel/analytics@npm:^1.5.0":
7895
+ version: 1.5.0
7896
+ resolution: "@vercel/analytics@npm:1.5.0"
7897
+ peerDependencies:
7898
+ "@remix-run/react": ^2
7899
+ "@sveltejs/kit": ^1 || ^2
7900
+ next: ">= 13"
7901
+ react: ^18 || ^19 || ^19.0.0-rc
7902
+ svelte: ">= 4"
7903
+ vue: ^3
7904
+ vue-router: ^4
7905
+ peerDependenciesMeta:
7906
+ "@remix-run/react":
7907
+ optional: true
7908
+ "@sveltejs/kit":
7909
+ optional: true
7910
+ next:
7911
+ optional: true
7912
+ react:
7913
+ optional: true
7914
+ svelte:
7915
+ optional: true
7916
+ vue:
7917
+ optional: true
7918
+ vue-router:
7919
+ optional: true
7920
+ checksum: 10c0/43d33ea83b32f5203fec21b7f43c399e398f0c37d2dd341d522969e0e6ee23fd652a2766a4203a3ce573f711beee5ee1ab7d36316f767a4901160e3e96ee31e5
7921
+ languageName: node
7922
+ linkType: hard
7923
+
7894
7924
"@vitejs/plugin-react@npm:4.3.1":
7895
7925
version: 4.3.1
7896
7926
resolution: "@vitejs/plugin-react@npm:4.3.1"
@@ -18248,6 +18278,7 @@ __metadata:
18248
18278
"@types/yargs": "npm:^17.0.24"
18249
18279
"@typescript-eslint/eslint-plugin": "npm:7.18.0"
18250
18280
"@typescript-eslint/parser": "npm:7.18.0"
18281
+ "@vercel/analytics": "npm:^1.5.0"
18251
18282
"@vitejs/plugin-react": "npm:4.3.1"
18252
18283
"@vitest/coverage-v8": "npm:1.6.0"
18253
18284
"@vitest/ui": "npm:1.6.0"
You can’t perform that action at this time.
0 commit comments