Skip to content

Commit 2c8d398

Browse files
fix: add guard for navigator for use in envs that do no support navigator (#36)
1 parent bdf94a7 commit 2c8d398

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/analyticsConnector/src/applicationContextProvider.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export interface ApplicationContextProvider {
1616
export class ApplicationContextProviderImpl
1717
implements ApplicationContextProvider
1818
{
19-
private readonly ua = new UAParser(navigator.userAgent).getResult();
19+
private readonly ua = new UAParser(
20+
typeof navigator !== 'undefined' ? navigator.userAgent : null,
21+
).getResult();
2022
public versionName: string;
2123
getApplicationContext(): ApplicationContext {
2224
return {

0 commit comments

Comments
 (0)