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 66
77import { AnyValueMap } from ' @opentelemetry/api-logs' ;
88import { FirebaseApp } from ' @firebase/app' ;
9+ import { Instrumentation } from ' next' ;
910import { LoggerProvider } from ' @opentelemetry/sdk-logs' ;
1011
1112// @public
@@ -17,13 +18,7 @@ export function flush(telemetry: Telemetry): Promise<void>;
1718// @public
1819export function getTelemetry(app ? : FirebaseApp ): Telemetry ;
1920
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 }
2722
2823// @public
2924export const nextOnRequestError: Instrumentation .onRequestError ;
Original file line number Diff line number Diff line change 77 "untrimmedFilePath" : " <projectFolder>/dist/<unscopedPackageName>.d.ts" ,
88 "betaTrimmedFilePath" : " <projectFolder>/dist/<unscopedPackageName>-public.d.ts"
99 },
10- "bundledPackages" : [" next " ]
10+ "bundledPackages" : [" react " ]
1111}
Original file line number Diff line number Diff line change 11{
22 "extends" : " ../../config/api-extractor.json" ,
3- "mainEntryPointFilePath" : " <projectFolder>/dist/react/index.d.ts" ,
3+ "mainEntryPointFilePath" : " <projectFolder>/dist/react/react/ index.d.ts" ,
44 "dtsRollup" : {
55 "enabled" : true ,
66 "untrimmedFilePath" : " <projectFolder>/dist/react/index.d.ts"
Original file line number Diff line number Diff line change 2222 "./react" : {
2323 "types" : " ./dist/react/index.d.ts" ,
2424 "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"
2727 },
2828 "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"
3131 },
32- "default" : " ./dist/react.esm.js"
32+ "default" : " ./dist/react/index .esm.js"
3333 },
3434 "./package.json" : " ./package.json"
3535 },
Original file line number Diff line number Diff line change @@ -85,11 +85,7 @@ const reactBuilds = [
8585 plugins : [
8686 typescriptPlugin ( {
8787 typescript,
88- tsconfigOverride : {
89- compilerOptions : {
90- declarationDir : 'dist/react'
91- }
92- }
88+ tsconfig : 'tsconfig.react.json'
9389 } ) ,
9490 json ( )
9591 ] ,
@@ -106,11 +102,7 @@ const reactBuilds = [
106102 plugins : [
107103 typescriptPlugin ( {
108104 typescript,
109- tsconfigOverride : {
110- compilerOptions : {
111- declarationDir : 'dist/react'
112- }
113- }
105+ tsconfig : 'tsconfig.react.json'
114106 } ) ,
115107 json ( )
116108 ] ,
@@ -130,11 +122,7 @@ const reactNodeBuilds = [
130122 plugins : [
131123 typescriptPlugin ( {
132124 typescript,
133- tsconfigOverride : {
134- compilerOptions : {
135- declarationDir : 'dist/react'
136- }
137- }
125+ tsconfig : 'tsconfig.react.json'
138126 } ) ,
139127 json ( )
140128 ] ,
@@ -151,11 +139,7 @@ const reactNodeBuilds = [
151139 plugins : [
152140 typescriptPlugin ( {
153141 typescript,
154- tsconfigOverride : {
155- compilerOptions : {
156- declarationDir : 'dist/react'
157- }
158- }
142+ tsconfig : 'tsconfig.react.json'
159143 } ) ,
160144 json ( ) ,
161145 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' ;
24
35export interface FirebaseTelemetryBoundaryProps {
4- children : React . ReactNode ;
6+ children : ReactNode ;
57}
68
7- export class FirebaseTelemetryBoundary extends React . Component < FirebaseTelemetryBoundaryProps > {
9+ export class FirebaseTelemetryBoundary extends Component < FirebaseTelemetryBoundaryProps > {
810 constructor ( public props : FirebaseTelemetryBoundaryProps ) {
911 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
1031
11- console . info ( 'init firebase telemetry boundary' ) ;
1232 }
1333
14- render ( ) : React . ReactNode {
15- console . info ( 'abc' ) ;
34+ render ( ) : ReactNode {
1635 return this . props . children ;
1736 }
1837}
You can’t perform that action at this time.
0 commit comments