@obtrace/browser 1.0.0 → 2.0.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.
@@ -4,9 +4,10 @@ export class ObtraceClient {
4
4
  active = true;
5
5
  replayTimer = null;
6
6
  constructor(config) {
7
- if (!config.apiKey || !config.ingestBaseUrl || !config.serviceName) {
8
- throw new Error("apiKey, ingestBaseUrl and serviceName are required");
7
+ if (!config.apiKey || !config.serviceName) {
8
+ throw new Error("apiKey and serviceName are required");
9
9
  }
10
+ config.ingestBaseUrl = config.ingestBaseUrl || "https://ingest.obtrace.ai";
10
11
  this.config = {
11
12
  requestTimeoutMs: 5000,
12
13
  defaultHeaders: {},
@@ -13,7 +13,7 @@ import { UserInteractionInstrumentation } from "@opentelemetry/instrumentation-u
13
13
  import { ZoneContextManager } from "@opentelemetry/context-zone";
14
14
  import { registerInstrumentations } from "@opentelemetry/instrumentation";
15
15
  export function setupOtelWeb(config) {
16
- const baseUrl = config.ingestBaseUrl.replace(/\/$/, "");
16
+ const baseUrl = (config.ingestBaseUrl || "https://ingest.obtrace.ai").replace(/\/$/, "");
17
17
  const authHeaders = {
18
18
  Authorization: `Bearer ${config.apiKey}`,
19
19
  ...(config.appId ? { "X-Obtrace-App-ID": config.appId } : {}),
@@ -1,5 +1,5 @@
1
1
  export async function uploadSourceMaps(options) {
2
- const baseUrl = options.ingestBaseUrl.replace(/\/$/, "");
2
+ const baseUrl = (options.ingestBaseUrl || "https://ingest.obtrace.ai").replace(/\/$/, "");
3
3
  const errors = [];
4
4
  let uploaded = 0;
5
5
  for (const file of options.files) {
@@ -13,7 +13,7 @@ export interface ObtraceResource {
13
13
  }
14
14
  export interface ObtraceSDKConfig {
15
15
  apiKey: string;
16
- ingestBaseUrl: string;
16
+ ingestBaseUrl?: string;
17
17
  tenantId?: string;
18
18
  projectId?: string;
19
19
  appId?: string;
@@ -1,6 +1,6 @@
1
1
  export interface SourceMapUploadOptions {
2
2
  apiKey: string;
3
- ingestBaseUrl: string;
3
+ ingestBaseUrl?: string;
4
4
  release: string;
5
5
  files: Array<{
6
6
  url: string;
@@ -1,5 +1,5 @@
1
1
  import type { ObtraceSDKConfig } from "../../shared/types";
2
2
  export declare function initViteBrowserSDK(config: ObtraceSDKConfig): import("./react").BrowserSDK;
3
- export declare function createViteConfigFromImportMetaEnv(env: Record<string, string | undefined>, base: Omit<ObtraceSDKConfig, "apiKey" | "ingestBaseUrl" | "serviceName"> & {
3
+ export declare function createViteConfigFromImportMetaEnv(env: Record<string, string | undefined>, base: Omit<ObtraceSDKConfig, "apiKey" | "serviceName"> & {
4
4
  serviceName?: string;
5
5
  }): ObtraceSDKConfig;
@@ -4,7 +4,7 @@ export function initViteBrowserSDK(config) {
4
4
  }
5
5
  export function createViteConfigFromImportMetaEnv(env, base) {
6
6
  const apiKey = env.VITE_OBTRACE_API_KEY ?? "";
7
- const ingestBaseUrl = env.VITE_OBTRACE_INGEST_BASE_URL ?? "";
7
+ const ingestBaseUrl = env.VITE_OBTRACE_INGEST_BASE_URL || "https://ingest.obtrace.ai";
8
8
  const serviceName = base.serviceName ?? env.VITE_OBTRACE_SERVICE_NAME ?? "vite-app";
9
9
  return {
10
10
  ...base,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obtrace/browser",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Obtrace Browser SDK with frontend wrappers",
5
5
  "type": "module",
6
6
  "license": "MIT",