UNPKG

3.32 kBTypeScriptView Raw
1import type { Hub } from '@sentry/core';
2import type { Integration, Options, UserFeedback } from '@sentry/types';
3import type { BrowserOptions } from './client';
4import type { ReportDialogOptions } from './helpers';
5/** @deprecated Use `getDefaultIntegrations(options)` instead. */
6export declare const defaultIntegrations: import("@sentry/types").IntegrationFnResult[];
7/** Get the default integrations for the browser SDK. */
8export declare function getDefaultIntegrations(_options: Options): Integration[];
9/**
10 * The Sentry Browser SDK Client.
11 *
12 * To use this SDK, call the {@link init} function as early as possible when
13 * loading the web page. To set context information or send manual events, use
14 * the provided methods.
15 *
16 * @example
17 *
18 * ```
19 *
20 * import { init } from '@sentry/browser';
21 *
22 * init({
23 * dsn: '__DSN__',
24 * // ...
25 * });
26 * ```
27 *
28 * @example
29 * ```
30 *
31 * import { configureScope } from '@sentry/browser';
32 * configureScope((scope: Scope) => {
33 * scope.setExtra({ battery: 0.7 });
34 * scope.setTag({ user_mode: 'admin' });
35 * scope.setUser({ id: '4711' });
36 * });
37 * ```
38 *
39 * @example
40 * ```
41 *
42 * import { addBreadcrumb } from '@sentry/browser';
43 * addBreadcrumb({
44 * message: 'My Breadcrumb',
45 * // ...
46 * });
47 * ```
48 *
49 * @example
50 *
51 * ```
52 *
53 * import * as Sentry from '@sentry/browser';
54 * Sentry.captureMessage('Hello, world!');
55 * Sentry.captureException(new Error('Good bye'));
56 * Sentry.captureEvent({
57 * message: 'Manual',
58 * stacktrace: [
59 * // ...
60 * ],
61 * });
62 * ```
63 *
64 * @see {@link BrowserOptions} for documentation on configuration options.
65 */
66export declare function init(options?: BrowserOptions): void;
67type NewReportDialogOptions = ReportDialogOptions & {
68 eventId: string;
69};
70interface ShowReportDialogFunction {
71 /**
72 * Present the user with a report dialog.
73 *
74 * @param options Everything is optional, we try to fetch all info need from the global scope.
75 */
76 (options: NewReportDialogOptions): void;
77 /**
78 * Present the user with a report dialog.
79 *
80 * @param options Everything is optional, we try to fetch all info need from the global scope.
81 *
82 * @deprecated Please always pass an `options` argument with `eventId`. The `hub` argument will not be used in the next version of the SDK.
83 */
84 (options?: ReportDialogOptions, hub?: Hub): void;
85}
86export declare const showReportDialog: ShowReportDialogFunction;
87/**
88 * This function is here to be API compatible with the loader.
89 * @hidden
90 */
91export declare function forceLoad(): void;
92/**
93 * This function is here to be API compatible with the loader.
94 * @hidden
95 */
96export declare function onLoad(callback: () => void): void;
97/**
98 * Wrap code within a try/catch block so the SDK is able to capture errors.
99 *
100 * @deprecated This function will be removed in v8.
101 * It is not part of Sentry's official API and it's easily replaceable by using a try/catch block
102 * and calling Sentry.captureException.
103 *
104 * @param fn A function to wrap.
105 *
106 * @returns The result of wrapped function call.
107 */
108export declare function wrap(fn: (...args: any) => any): any;
109/**
110 * Captures user feedback and sends it to Sentry.
111 */
112export declare function captureUserFeedback(feedback: UserFeedback): void;
113export {};
114//# sourceMappingURL=sdk.d.ts.map
\No newline at end of file