@inkronik/browser-sdk 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/client.d.ts +3 -1
- package/dist/constants.d.ts +1 -1
- package/dist/index-z0hb108t.js +864 -0
- package/dist/index-z0hb108t.js.map +18 -0
- package/dist/index.js +7 -841
- package/dist/index.js.map +3 -12
- package/dist/next/index.d.ts +3 -0
- package/dist/next/index.js +18 -0
- package/dist/next/index.js.map +10 -0
- package/dist/next/types.d.ts +8 -0
- package/dist/types.d.ts +17 -0
- package/package.json +14 -4
- /package/dist/{instrumentation.d.ts → browser-instrumentation.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -58,6 +58,27 @@ The public key is a revocable source identifier, not a secret. It can send only
|
|
|
58
58
|
The required `environment` option identifies the deployment sending each batch. The same application-scoped public key may therefore be used by
|
|
59
59
|
multiple exact origins while development, staging, and production telemetry remain separate.
|
|
60
60
|
|
|
61
|
+
## Next.js
|
|
62
|
+
|
|
63
|
+
Next.js 15.3 and newer can initialize browser telemetry before hydration through `instrumentation-client.ts`. The dedicated entrypoint also uses
|
|
64
|
+
Next.js' router transition hook instead of patching History, so each client-side route change creates one navigation view:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
// instrumentation-client.ts
|
|
68
|
+
import { createInkronikNext } from '@inkronik/browser-sdk/next'
|
|
69
|
+
|
|
70
|
+
export const { client: inkronik, onRouterTransitionStart } = createInkronikNext({
|
|
71
|
+
publicKey: process.env.NEXT_PUBLIC_INKRONIK_PUBLIC_KEY!,
|
|
72
|
+
collectorUrl: process.env.NEXT_PUBLIC_INKRONIK_COLLECTOR_URL!,
|
|
73
|
+
environment: process.env.NEXT_PUBLIC_INKRONIK_ENVIRONMENT ?? 'development',
|
|
74
|
+
tracePropagationOrigins: ['https://api.example.com'],
|
|
75
|
+
})
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Create the integration only after the application's consent policy permits telemetry. Values prefixed with `NEXT_PUBLIC_` are bundled for the
|
|
79
|
+
browser: use only the Browser Source public key here, never the server ingest API key. The root package remains appropriate for older Next.js
|
|
80
|
+
versions and other SPA routers; its History integration ignores `pushState` and `replaceState` calls that do not change the URL.
|
|
81
|
+
|
|
61
82
|
## Identity and privacy
|
|
62
83
|
|
|
63
84
|
Use one stable, opaque user ID across the browser and backend, ideally the authentication `sub` or UUID. Matching identifiers let RUM, product
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CaptureErrorOptions, CaptureEventInput, CreateInkronikBrowserOptions, SetUserInput } from './types.js';
|
|
1
|
+
import type { CaptureBrowserNavigationInput, CaptureErrorOptions, CaptureEventInput, CreateInkronikBrowserOptions, SetUserInput } from './types.js';
|
|
2
2
|
export declare class InkronikBrowserClient {
|
|
3
3
|
private readonly publicKey;
|
|
4
4
|
private readonly collectorUrl;
|
|
@@ -13,6 +13,7 @@ export declare class InkronikBrowserClient {
|
|
|
13
13
|
private readonly getRoute;
|
|
14
14
|
private readonly sanitizeUrl;
|
|
15
15
|
private readonly enableFetchTracing;
|
|
16
|
+
private readonly enableNavigationTracking;
|
|
16
17
|
private readonly tracePropagationOrigins;
|
|
17
18
|
private readonly environment;
|
|
18
19
|
private readonly session;
|
|
@@ -31,6 +32,7 @@ export declare class InkronikBrowserClient {
|
|
|
31
32
|
captureError(error: unknown, options: CaptureErrorOptions): void;
|
|
32
33
|
setUser(input: SetUserInput): void;
|
|
33
34
|
clearUser(): void;
|
|
35
|
+
captureNavigation(input: CaptureBrowserNavigationInput): void;
|
|
34
36
|
flush(): Promise<void>;
|
|
35
37
|
shutdown(): Promise<void>;
|
|
36
38
|
private beginView;
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const DEFAULT_MAX_RETRIES = 2;
|
|
|
5
5
|
export declare const DEFAULT_RETRY_BASE_MS = 250;
|
|
6
6
|
export declare const DEFAULT_SAMPLE_RATE = 1;
|
|
7
7
|
export declare const SDK_NAME = "@inkronik/browser-sdk";
|
|
8
|
-
export declare const SDK_VERSION = "2.
|
|
8
|
+
export declare const SDK_VERSION = "2.1.0";
|
|
9
9
|
export declare const DEFAULT_SESSION_INACTIVITY_MS: number;
|
|
10
10
|
export declare const DEFAULT_SESSION_MAX_DURATION_MS: number;
|
|
11
11
|
export declare const BROWSER_SESSION_STORAGE_KEY = "inkronik.browser.session";
|