File tree Expand file tree Collapse file tree 6 files changed +38
-40
lines changed Expand file tree Collapse file tree 6 files changed +38
-40
lines changed Original file line number Diff line number Diff line change 6
6
7
7
import { AnyValueMap } from ' @opentelemetry/api-logs' ;
8
8
import { FirebaseApp } from ' @firebase/app' ;
9
+ import { Instrumentation } from ' next' ;
9
10
import { LoggerProvider } from ' @opentelemetry/sdk-logs' ;
10
11
11
12
// @public
@@ -17,13 +18,7 @@ export function flush(telemetry: Telemetry): Promise<void>;
17
18
// @public
18
19
export function getTelemetry(app ? : FirebaseApp ): Telemetry ;
19
20
20
- // @public (undocumented)
21
- export namespace Instrumentation {
22
- // Warning: (ae-forgotten-export) The symbol "InstrumentationOnRequestError" needs to be exported by the entry point index.d.ts
23
- //
24
- // (undocumented)
25
- export type onRequestError = InstrumentationOnRequestError ;
26
- }
21
+ export { Instrumentation }
27
22
28
23
// @public
29
24
export const nextOnRequestError: Instrumentation .onRequestError ;
Original file line number Diff line number Diff line change 7
7
"untrimmedFilePath" : " <projectFolder>/dist/<unscopedPackageName>.d.ts" ,
8
8
"betaTrimmedFilePath" : " <projectFolder>/dist/<unscopedPackageName>-public.d.ts"
9
9
},
10
- "bundledPackages" : [" next " ]
10
+ "bundledPackages" : [" react " ]
11
11
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"extends" : " ../../config/api-extractor.json" ,
3
- "mainEntryPointFilePath" : " <projectFolder>/dist/react/index.d.ts" ,
3
+ "mainEntryPointFilePath" : " <projectFolder>/dist/react/react/ index.d.ts" ,
4
4
"dtsRollup" : {
5
5
"enabled" : true ,
6
6
"untrimmedFilePath" : " <projectFolder>/dist/react/index.d.ts"
Original file line number Diff line number Diff line change 22
22
"./react" : {
23
23
"types" : " ./dist/react/index.d.ts" ,
24
24
"node" : {
25
- "import" : " ./dist/react-node-esm /index.node.esm.js" ,
26
- "default" : " ./dist/react.node.cjs.js"
25
+ "import" : " ./dist/react/index.node.esm.js" ,
26
+ "default" : " ./dist/react/index .node.cjs.js"
27
27
},
28
28
"browser" : {
29
- "require" : " ./dist/react.cjs.js" ,
30
- "import" : " ./dist/react.esm.js"
29
+ "require" : " ./dist/react/index .cjs.js" ,
30
+ "import" : " ./dist/react/index .esm.js"
31
31
},
32
- "default" : " ./dist/react.esm.js"
32
+ "default" : " ./dist/react/index .esm.js"
33
33
},
34
34
"./package.json" : " ./package.json"
35
35
},
Original file line number Diff line number Diff line change @@ -85,11 +85,7 @@ const reactBuilds = [
85
85
plugins : [
86
86
typescriptPlugin ( {
87
87
typescript,
88
- tsconfigOverride : {
89
- compilerOptions : {
90
- declarationDir : 'dist/react'
91
- }
92
- }
88
+ tsconfig : 'tsconfig.react.json'
93
89
} ) ,
94
90
json ( )
95
91
] ,
@@ -106,11 +102,7 @@ const reactBuilds = [
106
102
plugins : [
107
103
typescriptPlugin ( {
108
104
typescript,
109
- tsconfigOverride : {
110
- compilerOptions : {
111
- declarationDir : 'dist/react'
112
- }
113
- }
105
+ tsconfig : 'tsconfig.react.json'
114
106
} ) ,
115
107
json ( )
116
108
] ,
@@ -130,11 +122,7 @@ const reactNodeBuilds = [
130
122
plugins : [
131
123
typescriptPlugin ( {
132
124
typescript,
133
- tsconfigOverride : {
134
- compilerOptions : {
135
- declarationDir : 'dist/react'
136
- }
137
- }
125
+ tsconfig : 'tsconfig.react.json'
138
126
} ) ,
139
127
json ( )
140
128
] ,
@@ -151,11 +139,7 @@ const reactNodeBuilds = [
151
139
plugins : [
152
140
typescriptPlugin ( {
153
141
typescript,
154
- tsconfigOverride : {
155
- compilerOptions : {
156
- declarationDir : 'dist/react'
157
- }
158
- }
142
+ tsconfig : 'tsconfig.react.json'
159
143
} ) ,
160
144
json ( ) ,
161
145
emitModulePackageFile ( )
Original file line number Diff line number Diff line change 1
- import React from 'react' ;
1
+ import { getApp } from '@firebase/app' ;
2
+ import { captureError , getTelemetry } from '../api' ;
3
+ import { Component , ReactNode } from 'react' ;
2
4
3
5
export interface FirebaseTelemetryBoundaryProps {
4
- children : React . ReactNode ;
6
+ children : ReactNode ;
5
7
}
6
8
7
- export class FirebaseTelemetryBoundary extends React . Component < FirebaseTelemetryBoundaryProps > {
9
+ export class FirebaseTelemetryBoundary extends Component < FirebaseTelemetryBoundaryProps > {
8
10
constructor ( public props : FirebaseTelemetryBoundaryProps ) {
9
11
super ( props ) ;
12
+ }
13
+
14
+ componentDidMount ( ) : void {
15
+ if ( typeof window === 'undefined' ) {
16
+ return ;
17
+ }
18
+
19
+ // TODO: This will be obsolete once the SDK has a default endpoint
20
+ process . env . OTEL_ENDPOINT = window . location . origin ;
21
+
22
+ const telemetry = getTelemetry ( getApp ( ) ) ;
23
+
24
+ console . info ( telemetry ) ;
25
+
26
+ window . addEventListener ( 'error' , ( event : ErrorEvent ) => {
27
+ captureError ( telemetry , event . error , { 'example_attribute' : 'hello' } ) ;
28
+ } ) ;
29
+
30
+ // TODO: add listener for unhandledrejection
10
31
11
- console . info ( 'init firebase telemetry boundary' ) ;
12
32
}
13
33
14
- render ( ) : React . ReactNode {
15
- console . info ( 'abc' ) ;
34
+ render ( ) : ReactNode {
16
35
return this . props . children ;
17
36
}
18
37
}
You can’t perform that action at this time.
0 commit comments