All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.build.npm.esm.client.js.map Maven / Gradle / Ivy

There is a newer version: 8.30.0
Show newest version
{"version":3,"file":"client.js","sources":["../../../src/client.ts"],"sourcesContent":["import type { Scope } from '@sentry/core';\nimport { applySdkMetadata } from '@sentry/core';\nimport { BaseClient } from '@sentry/core';\nimport type {\n  BrowserClientProfilingOptions,\n  BrowserClientReplayOptions,\n  ClientOptions,\n  Event,\n  EventHint,\n  Options,\n  ParameterizedString,\n  SeverityLevel,\n  UserFeedback,\n} from '@sentry/types';\nimport { getSDKSource, logger } from '@sentry/utils';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { eventFromException, eventFromMessage } from './eventbuilder';\nimport { WINDOW } from './helpers';\nimport type { BrowserTransportOptions } from './transports/types';\nimport { createUserFeedbackEnvelope } from './userfeedback';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see @sentry/types Options for more information.\n */\nexport type BrowserOptions = Options &\n  BrowserClientReplayOptions &\n  BrowserClientProfilingOptions;\n\n/**\n * Configuration options for the Sentry Browser SDK Client class\n * @see BrowserClient for more information.\n */\nexport type BrowserClientOptions = ClientOptions &\n  BrowserClientReplayOptions &\n  BrowserClientProfilingOptions & {\n    /** If configured, this URL will be used as base URL for lazy loading integration. */\n    cdnBaseUrl?: string;\n  };\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient {\n  /**\n   * Creates a new Browser SDK instance.\n   *\n   * @param options Configuration options for this SDK.\n   */\n  public constructor(options: BrowserClientOptions) {\n    const opts = {\n      // We default this to true, as it is the safer scenario\n      parentSpanIsAlwaysRootSpan: true,\n      ...options,\n    };\n    const sdkSource = WINDOW.SENTRY_SDK_SOURCE || getSDKSource();\n    applySdkMetadata(opts, 'browser', ['browser'], sdkSource);\n\n    super(opts);\n\n    if (opts.sendClientReports && WINDOW.document) {\n      WINDOW.document.addEventListener('visibilitychange', () => {\n        if (WINDOW.document.visibilityState === 'hidden') {\n          this._flushOutcomes();\n        }\n      });\n    }\n  }\n\n  /**\n   * @inheritDoc\n   */\n  public eventFromException(exception: unknown, hint?: EventHint): PromiseLike {\n    return eventFromException(this._options.stackParser, exception, hint, this._options.attachStacktrace);\n  }\n\n  /**\n   * @inheritDoc\n   */\n  public eventFromMessage(\n    message: ParameterizedString,\n    level: SeverityLevel = 'info',\n    hint?: EventHint,\n  ): PromiseLike {\n    return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);\n  }\n\n  /**\n   * Sends user feedback to Sentry.\n   *\n   * @deprecated Use `captureFeedback` instead.\n   */\n  public captureUserFeedback(feedback: UserFeedback): void {\n    if (!this._isEnabled()) {\n      DEBUG_BUILD && logger.warn('SDK not enabled, will not capture user feedback.');\n      return;\n    }\n\n    const envelope = createUserFeedbackEnvelope(feedback, {\n      metadata: this.getSdkMetadata(),\n      dsn: this.getDsn(),\n      tunnel: this.getOptions().tunnel,\n    });\n\n    // sendEnvelope should not throw\n    // eslint-disable-next-line @typescript-eslint/no-floating-promises\n    this.sendEnvelope(envelope);\n  }\n\n  /**\n   * @inheritDoc\n   */\n  protected _prepareEvent(event: Event, hint: EventHint, scope?: Scope): PromiseLike {\n    event.platform = event.platform || 'javascript';\n    return super._prepareEvent(event, hint, scope);\n  }\n}\n"],"names":[],"mappings":";;;;;;;AAsBA;AACA;AACA;AACA;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,aAAA,SAAsB,UAAU,CAAuB;AACpE;AACA;AACA;AACA;AACA;AACA,GAAS,WAAW,CAAC,OAAO,EAAwB;AACpD,IAAI,MAAM,OAAO;AACjB;AACA,MAAM,0BAA0B,EAAE,IAAI;AACtC,MAAM,GAAG,OAAO;AAChB,KAAK,CAAA;AACL,IAAI,MAAM,YAAY,MAAM,CAAC,iBAAkB,IAAG,YAAY,EAAE,CAAA;AAChE,IAAI,gBAAgB,CAAC,IAAI,EAAE,S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