Skip to content

Commit

Permalink
Add bundled analytics support in Inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
zikaari committed Oct 14, 2022
1 parent 503bea2 commit 63e412a
Show file tree
Hide file tree
Showing 4 changed files with 587 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-shirts-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@segment/analytics-next': minor
---

Bundled analytics support in Inspector
4 changes: 2 additions & 2 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"size-limit": [
{
"path": "dist/umd/index.js",
"limit": "26.02 KB"
"limit": "26.1 KB"
}
],
"dependencies": {
Expand All @@ -61,7 +61,7 @@
},
"devDependencies": {
"@internal/config": "0.0.0",
"@segment/inspector-webext": "^1.1.0",
"@segment/inspector-webext": "^2.0.3",
"@size-limit/preset-big-lib": "^7.0.8",
"@types/flat": "^5.0.1",
"@types/fs-extra": "^9.0.2",
Expand Down
3 changes: 3 additions & 0 deletions packages/browser/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
flushOn,
} from '../core/buffer'
import { popSnippetWindowBuffer } from '../core/buffer/snippet'
import { inspectorHost } from '../core/inspector'

export interface LegacyIntegrationConfiguration {
/* @deprecated - This does not indicate browser types anymore */
Expand Down Expand Up @@ -247,6 +248,8 @@ async function loadAnalytics(
const opts: InitOptions = { retryQueue, ...options }
const analytics = new Analytics(settings, opts)

inspectorHost.attach?.(analytics as any)

const plugins = settings.plugins ?? []
Context.initMetrics(legacySettings.metrics)

Expand Down
Loading

0 comments on commit 63e412a

Please sign in to comment.