@sentry/browser 9.20.0 → 9.21.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/build/npm/cjs/index.js +2 -1
- package/build/npm/cjs/index.js.map +1 -1
- package/build/npm/cjs/report-dialog.js +68 -0
- package/build/npm/cjs/report-dialog.js.map +1 -0
- package/build/npm/cjs/sdk.js +0 -67
- package/build/npm/cjs/sdk.js.map +1 -1
- package/build/npm/esm/index.js +2 -1
- package/build/npm/esm/index.js.map +1 -1
- package/build/npm/esm/package.json +1 -1
- package/build/npm/esm/report-dialog.js +66 -0
- package/build/npm/esm/report-dialog.js.map +1 -0
- package/build/npm/esm/sdk.js +2 -68
- package/build/npm/esm/sdk.js.map +1 -1
- package/build/npm/types/exports.d.ts +2 -1
- package/build/npm/types/exports.d.ts.map +1 -1
- package/build/npm/types/report-dialog.d.ts +8 -0
- package/build/npm/types/report-dialog.d.ts.map +1 -0
- package/build/npm/types/sdk.d.ts +1 -7
- package/build/npm/types/sdk.d.ts.map +1 -1
- package/build/npm/types-ts3.8/exports.d.ts +2 -1
- package/build/npm/types-ts3.8/report-dialog.d.ts +8 -0
- package/build/npm/types-ts3.8/sdk.d.ts +1 -7
- package/package.json +7 -7
package/build/npm/cjs/index.js
CHANGED
|
@@ -11,6 +11,7 @@ const stackParsers = require('./stack-parsers.js');
|
|
|
11
11
|
const eventbuilder = require('./eventbuilder.js');
|
|
12
12
|
const userfeedback = require('./userfeedback.js');
|
|
13
13
|
const sdk = require('./sdk.js');
|
|
14
|
+
const reportDialog = require('./report-dialog.js');
|
|
14
15
|
const breadcrumbs = require('./integrations/breadcrumbs.js');
|
|
15
16
|
const globalhandlers = require('./integrations/globalhandlers.js');
|
|
16
17
|
const httpcontext = require('./integrations/httpcontext.js');
|
|
@@ -128,7 +129,7 @@ exports.forceLoad = sdk.forceLoad;
|
|
|
128
129
|
exports.getDefaultIntegrations = sdk.getDefaultIntegrations;
|
|
129
130
|
exports.init = sdk.init;
|
|
130
131
|
exports.onLoad = sdk.onLoad;
|
|
131
|
-
exports.showReportDialog =
|
|
132
|
+
exports.showReportDialog = reportDialog.showReportDialog;
|
|
132
133
|
exports.breadcrumbsIntegration = breadcrumbs.breadcrumbsIntegration;
|
|
133
134
|
exports.globalHandlersIntegration = globalhandlers.globalHandlersIntegration;
|
|
134
135
|
exports.httpContextIntegration = httpcontext.httpContextIntegration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const debugBuild = require('./debug-build.js');
|
|
5
|
+
const helpers = require('./helpers.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Present the user with a report dialog.
|
|
9
|
+
*
|
|
10
|
+
* @param options Everything is optional, we try to fetch all info need from the current scope.
|
|
11
|
+
*/
|
|
12
|
+
function showReportDialog(options = {}) {
|
|
13
|
+
const optionalDocument = helpers.WINDOW.document ;
|
|
14
|
+
const injectionPoint = optionalDocument?.head || optionalDocument?.body;
|
|
15
|
+
|
|
16
|
+
// doesn't work without a document (React Native)
|
|
17
|
+
if (!injectionPoint) {
|
|
18
|
+
debugBuild.DEBUG_BUILD && core.logger.error('[showReportDialog] Global document not defined');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const scope = core.getCurrentScope();
|
|
23
|
+
const client = core.getClient();
|
|
24
|
+
const dsn = client?.getDsn();
|
|
25
|
+
|
|
26
|
+
if (!dsn) {
|
|
27
|
+
debugBuild.DEBUG_BUILD && core.logger.error('[showReportDialog] DSN not configured');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const mergedOptions = {
|
|
32
|
+
...options,
|
|
33
|
+
user: {
|
|
34
|
+
...scope.getUser(),
|
|
35
|
+
...options.user,
|
|
36
|
+
},
|
|
37
|
+
eventId: options.eventId || core.lastEventId(),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const script = helpers.WINDOW.document.createElement('script');
|
|
41
|
+
script.async = true;
|
|
42
|
+
script.crossOrigin = 'anonymous';
|
|
43
|
+
script.src = core.getReportDialogEndpoint(dsn, mergedOptions);
|
|
44
|
+
|
|
45
|
+
const { onLoad, onClose } = mergedOptions;
|
|
46
|
+
|
|
47
|
+
if (onLoad) {
|
|
48
|
+
script.onload = onLoad;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (onClose) {
|
|
52
|
+
const reportDialogClosedMessageHandler = (event) => {
|
|
53
|
+
if (event.data === '__sentry_reportdialog_closed__') {
|
|
54
|
+
try {
|
|
55
|
+
onClose();
|
|
56
|
+
} finally {
|
|
57
|
+
helpers.WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
helpers.WINDOW.addEventListener('message', reportDialogClosedMessageHandler);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
injectionPoint.appendChild(script);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.showReportDialog = showReportDialog;
|
|
68
|
+
//# sourceMappingURL=report-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-dialog.js","sources":["../../../src/report-dialog.ts"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/core';\nimport { getClient, getCurrentScope, getReportDialogEndpoint, lastEventId, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n const optionalDocument = WINDOW.document as Document | undefined;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && logger.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n"],"names":["WINDOW","DEBUG_BUILD","logger","getCurrentScope","getClient","lastEventId","getReportDialogEndpoint"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,OAAO,GAAwB,EAAE,EAAQ;AAC1E,EAAE,MAAM,gBAAA,GAAmBA,cAAM,CAAC,QAAS;AAC3C,EAAE,MAAM,iBAAiB,gBAAgB,EAAE,IAAK,IAAG,gBAAgB,EAAE,IAAI;;AAEzE;AACA,EAAE,IAAI,CAAC,cAAc,EAA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ACA;AACA,KAAK;AACL,IAAIA,cAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,gCAAgC,CAAC;AACxE;;AAEA,EAAE,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC;AACpC;;;;"}
|
package/build/npm/cjs/sdk.js
CHANGED
|
@@ -175,72 +175,6 @@ function init(browserOptions = {}) {
|
|
|
175
175
|
return core.initAndBind(client.BrowserClient, clientOptions);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
/**
|
|
179
|
-
* Present the user with a report dialog.
|
|
180
|
-
*
|
|
181
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
182
|
-
*/
|
|
183
|
-
function showReportDialog(options = {}) {
|
|
184
|
-
// doesn't work without a document (React Native)
|
|
185
|
-
if (!helpers.WINDOW.document) {
|
|
186
|
-
debugBuild.DEBUG_BUILD && core.logger.error('Global document not defined in showReportDialog call');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const scope = core.getCurrentScope();
|
|
191
|
-
const client = scope.getClient();
|
|
192
|
-
const dsn = client?.getDsn();
|
|
193
|
-
|
|
194
|
-
if (!dsn) {
|
|
195
|
-
debugBuild.DEBUG_BUILD && core.logger.error('DSN not configured for showReportDialog call');
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (scope) {
|
|
200
|
-
options.user = {
|
|
201
|
-
...scope.getUser(),
|
|
202
|
-
...options.user,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (!options.eventId) {
|
|
207
|
-
const eventId = core.lastEventId();
|
|
208
|
-
if (eventId) {
|
|
209
|
-
options.eventId = eventId;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const script = helpers.WINDOW.document.createElement('script');
|
|
214
|
-
script.async = true;
|
|
215
|
-
script.crossOrigin = 'anonymous';
|
|
216
|
-
script.src = core.getReportDialogEndpoint(dsn, options);
|
|
217
|
-
|
|
218
|
-
if (options.onLoad) {
|
|
219
|
-
script.onload = options.onLoad;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const { onClose } = options;
|
|
223
|
-
if (onClose) {
|
|
224
|
-
const reportDialogClosedMessageHandler = (event) => {
|
|
225
|
-
if (event.data === '__sentry_reportdialog_closed__') {
|
|
226
|
-
try {
|
|
227
|
-
onClose();
|
|
228
|
-
} finally {
|
|
229
|
-
helpers.WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
helpers.WINDOW.addEventListener('message', reportDialogClosedMessageHandler);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const injectionPoint = helpers.WINDOW.document.head || helpers.WINDOW.document.body;
|
|
237
|
-
if (injectionPoint) {
|
|
238
|
-
injectionPoint.appendChild(script);
|
|
239
|
-
} else {
|
|
240
|
-
debugBuild.DEBUG_BUILD && core.logger.error('Not injecting report dialog. No injection point found in HTML');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
178
|
/**
|
|
245
179
|
* This function is here to be API compatible with the loader.
|
|
246
180
|
* @hidden
|
|
@@ -262,5 +196,4 @@ exports.forceLoad = forceLoad;
|
|
|
262
196
|
exports.getDefaultIntegrations = getDefaultIntegrations;
|
|
263
197
|
exports.init = init;
|
|
264
198
|
exports.onLoad = onLoad;
|
|
265
|
-
exports.showReportDialog = showReportDialog;
|
|
266
199
|
//# sourceMappingURL=sdk.js.map
|
package/build/npm/cjs/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options, ReportDialogOptions } from '@sentry/core';\nimport {\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getCurrentScope,\n getIntegrationsToSetup,\n getLocationHref,\n getReportDialogEndpoint,\n inboundFiltersIntegration,\n initAndBind,\n lastEventId,\n logger,\n stackParserFromStackParserOptions,\n supportsFetch,\n} from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line deprecation/deprecation\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n };\n\n return {\n ...defaultOptions,\n ...dropTopLevelUndefinedKeys(optionsArg),\n };\n}\n\n/**\n * In contrast to the regular `dropUndefinedKeys` method,\n * this one does not deep-drop keys, but only on the top level.\n */\nfunction dropTopLevelUndefinedKeys<T extends object>(obj: T): Partial<T> {\n const mutatetedObj: Partial<T> = {};\n\n for (const k of Object.getOwnPropertyNames(obj)) {\n const key = k as keyof T;\n if (obj[key] !== undefined) {\n mutatetedObj[key] = obj[key];\n }\n }\n\n return mutatetedObj;\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject?.runtime?.id;\n const href = getLocationHref() || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n return;\n }\n\n if (DEBUG_BUILD && !supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n if (!WINDOW.document) {\n DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');\n return;\n }\n\n const scope = getCurrentScope();\n const client = scope.getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user,\n };\n }\n\n if (!options.eventId) {\n const eventId = lastEventId();\n if (eventId) {\n options.eventId = eventId;\n }\n }\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n\n const { onClose } = options;\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n const injectionPoint = WINDOW.document.head || WINDOW.document.body;\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n } else {\n DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');\n }\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":["inboundFiltersIntegration","functionToStringIntegration","browserApiErrorsIntegration","breadcrumbsIntegration","globalHandlersIntegration","linkedErrorsIntegration","dedupeIntegration","httpContextIntegration","browserSessionIntegration","WINDOW","getLocationHref","DEBUG_BUILD","consoleSandbox","supportsFetch","logger","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeFetchTransport","initAndBind","BrowserClient","getCurrentScope","lastEventId","getReportDialogEndpoint"],"mappings":";;;;;;;;;;;;;;;AA6BA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE;AACA;AACA;AACA;AACA,EAAE,OAAO;AACT;AACA;AACA,IAAIA,8BAAyB,EAAE;AAC/B,IAAIC,gCAA2B,EAAE;AACjC,IAAIC,4CAA2B,EAAE;AACjC,IAAIC,kCAAsB,EAAE;AAC5B,IAAIC,wCAAyB,EAAE;AAC/B,IAAIC,oCAAuB,EAAE;AAC7B,IAAIC,sBAAiB,EAAE;AACvB,IAAIC,kCAAsB,EAAE;AAC5B,IAAIC,wCAAyB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,EAAA,MAAA,CAAA,GAAA,GAAAc,4BAAA,CAAA,GAAA,EAAA,OAAA,CAAA;;AAEA,EAAA,IAAA,OAAA,CAAA,MAAA,EAAA;AACA,IAAA,MAAA,CAAA,MAAA,GAAA,OAAA,CAAA,MAAA;AACA;;AAEA,EAAA,MAAA,EAAA,OAAA,EAAA,GAAA,OAAA;AACA,EAAA,IAAA,OAAA,EAAA;AACA,IAAA,MAAA,gCAAA,GAAA,CAAA,KAAA,KAAA;AACA,MAAA,IAAA,KAAA,CAAA,IAAA,KAAA,gCAAA,EAAA;AACA,QAAA,IAAA;AACA,UAAA,OAAA,EAAA;AACA,SAAA,SAAA;AACA,UAAAd,cAAA,CAAA,mBAAA,CAAA,SAAA,EAAA,gCAAA,CAAA;AACA;AACA;AACA,KAAA;AACA,IAAAA,cAAA,CAAA,gBAAA,CAAA,SAAA,EAAA,gCAAA,CAAA;AACA;;AAEA,EAAA,MAAA,cAAA,GAAAA,cAAA,CAAA,QAAA,CAAA,IAAA,IAAAA,cAAA,CAAA,QAAA,CAAA,IAAA;AACA,EAAA,IAAA,cAAA,EAAA;AACA,IAAA,cAAA,CAAA,WAAA,CAAA,MAAA,CAAA;AACA,GAAA,MAAA;AACA,IAAAE,sBAAA,IAAAG,WAAA,CAAA,KAAA,CAAA,+DAAA,CAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,SAAA,GAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,MAAA,CAAA,QAAA,EAAA;AACA,EAAA,QAAA,EAAA;AACA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n getLocationHref,\n inboundFiltersIntegration,\n initAndBind,\n logger,\n stackParserFromStackParserOptions,\n supportsFetch,\n} from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line deprecation/deprecation\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n };\n\n return {\n ...defaultOptions,\n ...dropTopLevelUndefinedKeys(optionsArg),\n };\n}\n\n/**\n * In contrast to the regular `dropUndefinedKeys` method,\n * this one does not deep-drop keys, but only on the top level.\n */\nfunction dropTopLevelUndefinedKeys<T extends object>(obj: T): Partial<T> {\n const mutatetedObj: Partial<T> = {};\n\n for (const k of Object.getOwnPropertyNames(obj)) {\n const key = k as keyof T;\n if (obj[key] !== undefined) {\n mutatetedObj[key] = obj[key];\n }\n }\n\n return mutatetedObj;\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject?.runtime?.id;\n const href = getLocationHref() || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n return;\n }\n\n if (DEBUG_BUILD && !supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":["inboundFiltersIntegration","functionToStringIntegration","browserApiErrorsIntegration","breadcrumbsIntegration","globalHandlersIntegration","linkedErrorsIntegration","dedupeIntegration","httpContextIntegration","browserSessionIntegration","WINDOW","getLocationHref","DEBUG_BUILD","consoleSandbox","supportsFetch","logger","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeFetchTransport","initAndBind","BrowserClient"],"mappings":";;;;;;;;;;;;;;;AA0BA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE;AACA;AACA;AACA;AACA,EAAE,OAAO;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OAAA,CAAA,KAAA;AACA,UAAA,uJAAA;AACA,SAAA;AACA,OAAA,CAAA;AACA;AACA,IAAA;AACA;;AAEA,EAAA,IAAAD,sBAAA,IAAA,CAAAE,kBAAA,EAAA,EAAA;AACA,IAAAC,WAAA,CAAA,IAAA;AACA,MAAA,oIAAA;AACA,KAAA;AACA;AACA,EAAA,MAAA,aAAA,GAAA;AACA,IAAA,GAAA,OAAA;AACA,IAAA,WAAA,EAAAC,sCAAA,CAAA,OAAA,CAAA,WAAA,IAAAC,+BAAA,CAAA;AACA,IAAA,YAAA,EAAAC,2BAAA,CAAA,OAAA,CAAA;AACA,IAAA,SAAA,EAAA,OAAA,CAAA,SAAA,IAAAC,wBAAA;AACA,GAAA;;AAEA,EAAA,OAAAC,gBAAA,CAAAC,oBAAA,EAAA,aAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,SAAA,GAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,MAAA,CAAA,QAAA,EAAA;AACA,EAAA,QAAA,EAAA;AACA;;;;;;;;"}
|
package/build/npm/esm/index.js
CHANGED
|
@@ -9,7 +9,8 @@ export { makeFetchTransport } from './transports/fetch.js';
|
|
|
9
9
|
export { chromeStackLineParser, defaultStackLineParsers, defaultStackParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser } from './stack-parsers.js';
|
|
10
10
|
export { eventFromException, eventFromMessage, exceptionFromError } from './eventbuilder.js';
|
|
11
11
|
export { createUserFeedbackEnvelope } from './userfeedback.js';
|
|
12
|
-
export { forceLoad, getDefaultIntegrations, init, onLoad
|
|
12
|
+
export { forceLoad, getDefaultIntegrations, init, onLoad } from './sdk.js';
|
|
13
|
+
export { showReportDialog } from './report-dialog.js';
|
|
13
14
|
export { breadcrumbsIntegration } from './integrations/breadcrumbs.js';
|
|
14
15
|
export { globalHandlersIntegration } from './integrations/globalhandlers.js';
|
|
15
16
|
export { httpContextIntegration } from './integrations/httpcontext.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"9.
|
|
1
|
+
{"type":"module","version":"9.21.0","sideEffects":false}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { logger, getCurrentScope, getClient, lastEventId, getReportDialogEndpoint } from '@sentry/core';
|
|
2
|
+
import { DEBUG_BUILD } from './debug-build.js';
|
|
3
|
+
import { WINDOW } from './helpers.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Present the user with a report dialog.
|
|
7
|
+
*
|
|
8
|
+
* @param options Everything is optional, we try to fetch all info need from the current scope.
|
|
9
|
+
*/
|
|
10
|
+
function showReportDialog(options = {}) {
|
|
11
|
+
const optionalDocument = WINDOW.document ;
|
|
12
|
+
const injectionPoint = optionalDocument?.head || optionalDocument?.body;
|
|
13
|
+
|
|
14
|
+
// doesn't work without a document (React Native)
|
|
15
|
+
if (!injectionPoint) {
|
|
16
|
+
DEBUG_BUILD && logger.error('[showReportDialog] Global document not defined');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const scope = getCurrentScope();
|
|
21
|
+
const client = getClient();
|
|
22
|
+
const dsn = client?.getDsn();
|
|
23
|
+
|
|
24
|
+
if (!dsn) {
|
|
25
|
+
DEBUG_BUILD && logger.error('[showReportDialog] DSN not configured');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const mergedOptions = {
|
|
30
|
+
...options,
|
|
31
|
+
user: {
|
|
32
|
+
...scope.getUser(),
|
|
33
|
+
...options.user,
|
|
34
|
+
},
|
|
35
|
+
eventId: options.eventId || lastEventId(),
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const script = WINDOW.document.createElement('script');
|
|
39
|
+
script.async = true;
|
|
40
|
+
script.crossOrigin = 'anonymous';
|
|
41
|
+
script.src = getReportDialogEndpoint(dsn, mergedOptions);
|
|
42
|
+
|
|
43
|
+
const { onLoad, onClose } = mergedOptions;
|
|
44
|
+
|
|
45
|
+
if (onLoad) {
|
|
46
|
+
script.onload = onLoad;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (onClose) {
|
|
50
|
+
const reportDialogClosedMessageHandler = (event) => {
|
|
51
|
+
if (event.data === '__sentry_reportdialog_closed__') {
|
|
52
|
+
try {
|
|
53
|
+
onClose();
|
|
54
|
+
} finally {
|
|
55
|
+
WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
WINDOW.addEventListener('message', reportDialogClosedMessageHandler);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
injectionPoint.appendChild(script);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { showReportDialog };
|
|
66
|
+
//# sourceMappingURL=report-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-dialog.js","sources":["../../../src/report-dialog.ts"],"sourcesContent":["import type { ReportDialogOptions } from '@sentry/core';\nimport { getClient, getCurrentScope, getReportDialogEndpoint, lastEventId, logger } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the current scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n const optionalDocument = WINDOW.document as Document | undefined;\n const injectionPoint = optionalDocument?.head || optionalDocument?.body;\n\n // doesn't work without a document (React Native)\n if (!injectionPoint) {\n DEBUG_BUILD && logger.error('[showReportDialog] Global document not defined');\n return;\n }\n\n const scope = getCurrentScope();\n const client = getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('[showReportDialog] DSN not configured');\n return;\n }\n\n const mergedOptions = {\n ...options,\n user: {\n ...scope.getUser(),\n ...options.user,\n },\n eventId: options.eventId || lastEventId(),\n };\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, mergedOptions);\n\n const { onLoad, onClose } = mergedOptions;\n\n if (onLoad) {\n script.onload = onLoad;\n }\n\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n injectionPoint.appendChild(script);\n}\n"],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,OAAO,GAAwB,EAAE,EAAQ;AAC1E,EAAE,MAAM,gBAAA,GAAmB,MAAM,CAAC,QAAS;AAC3C,EAAE,MAAM,iBAAiB,gBAAgB,EAAE,IAAK,IAAG,gBAAgB,EAAE,IAAI;;AAEzE;AACA,EAAE,IAAI,CAAC,cAAc,EAAE;AACvB,IAAI,eAAe,MAAM,CAAC,KAAK,CAAC,gDAAgD,CAAC;AACjF,IAAI;AACJ;;AAEA,EAAE,MAAM,KAAA,GAAQ,eAAe,EAAE;AACjC,EAAE,MAAM,MAAA,GAAS,SAAS,EAAE;AAC5B,EAAE,MAAM,GAAI,GAAE,MAAM,EAAE,MAAM,EAAE;;AAE9B,EAAE,IAAI,CAAC,GAAG,EAAE;AACZ,IAAI,eAAe,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC;AACxE,IAAI;AACJ;;AAEA,EAAE,MAAM,gBAAgB;AACxB,IAAI,GAAG,OAAO;AACd,IAAI,IAAI,EAAE;AACV,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE;AACxB,MAAM,GAAG,OAAO,CAAC,IAAI;AACrB,KAAK;AACL,IAAI,OAAO,EAAE,OAAO,CAAC,WAAW,WAAW,EAAE;AAC7C,GAAG;;AAEH,EAAE,MAAM,MAAO,GAAE,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACxD,EAAE,MAAM,CAAC,KAAM,GAAE,IAAI;AACrB,EAAE,MAAM,CAAC,WAAY,GAAE,WAAW;AAClC,EAAE,MAAM,CAAC,GAAI,GAAE,uBAAuB,CAAC,GAAG,EAAE,aAAa,CAAC;;AAE1D,EAAE,MAAM,EAAE,MAAM,EAAE,OAAQ,EAAA,GAAI,aAAa;;AAE3C,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,MAAM,CAAC,MAAO,GAAE,MAAM;AAC1B;;AAEA,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,MAAM,gCAAA,GAAmC,CAAC,KAAK,KAAyB;AAC5E,MAAM,IAAI,KAAK,CAAC,IAAK,KAAI,gCAAgC,EAAE;AAC3D,QAAQ,IAAI;AACZ,UAAU,OAAO,EAAE;AACnB,kBAAkB;AAClB,UAAU,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,gCAAgC,CAAC;AACjF;AACA;AACA,KAAK;AACL,IAAI,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,gCAAgC,CAAC;AACxE;;AAEA,EAAE,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC;AACpC;;;;"}
|
package/build/npm/esm/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, consoleSandbox, supportsFetch, logger, getIntegrationsToSetup, stackParserFromStackParserOptions, initAndBind,
|
|
1
|
+
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, consoleSandbox, supportsFetch, logger, getIntegrationsToSetup, stackParserFromStackParserOptions, initAndBind, getLocationHref } from '@sentry/core';
|
|
2
2
|
import { BrowserClient } from './client.js';
|
|
3
3
|
import { DEBUG_BUILD } from './debug-build.js';
|
|
4
4
|
import { WINDOW } from './helpers.js';
|
|
@@ -173,72 +173,6 @@ function init(browserOptions = {}) {
|
|
|
173
173
|
return initAndBind(BrowserClient, clientOptions);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
/**
|
|
177
|
-
* Present the user with a report dialog.
|
|
178
|
-
*
|
|
179
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
180
|
-
*/
|
|
181
|
-
function showReportDialog(options = {}) {
|
|
182
|
-
// doesn't work without a document (React Native)
|
|
183
|
-
if (!WINDOW.document) {
|
|
184
|
-
DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const scope = getCurrentScope();
|
|
189
|
-
const client = scope.getClient();
|
|
190
|
-
const dsn = client?.getDsn();
|
|
191
|
-
|
|
192
|
-
if (!dsn) {
|
|
193
|
-
DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (scope) {
|
|
198
|
-
options.user = {
|
|
199
|
-
...scope.getUser(),
|
|
200
|
-
...options.user,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (!options.eventId) {
|
|
205
|
-
const eventId = lastEventId();
|
|
206
|
-
if (eventId) {
|
|
207
|
-
options.eventId = eventId;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const script = WINDOW.document.createElement('script');
|
|
212
|
-
script.async = true;
|
|
213
|
-
script.crossOrigin = 'anonymous';
|
|
214
|
-
script.src = getReportDialogEndpoint(dsn, options);
|
|
215
|
-
|
|
216
|
-
if (options.onLoad) {
|
|
217
|
-
script.onload = options.onLoad;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const { onClose } = options;
|
|
221
|
-
if (onClose) {
|
|
222
|
-
const reportDialogClosedMessageHandler = (event) => {
|
|
223
|
-
if (event.data === '__sentry_reportdialog_closed__') {
|
|
224
|
-
try {
|
|
225
|
-
onClose();
|
|
226
|
-
} finally {
|
|
227
|
-
WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
WINDOW.addEventListener('message', reportDialogClosedMessageHandler);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
const injectionPoint = WINDOW.document.head || WINDOW.document.body;
|
|
235
|
-
if (injectionPoint) {
|
|
236
|
-
injectionPoint.appendChild(script);
|
|
237
|
-
} else {
|
|
238
|
-
DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
176
|
/**
|
|
243
177
|
* This function is here to be API compatible with the loader.
|
|
244
178
|
* @hidden
|
|
@@ -255,5 +189,5 @@ function onLoad(callback) {
|
|
|
255
189
|
callback();
|
|
256
190
|
}
|
|
257
191
|
|
|
258
|
-
export { applyDefaultOptions, forceLoad, getDefaultIntegrations, init, onLoad
|
|
192
|
+
export { applyDefaultOptions, forceLoad, getDefaultIntegrations, init, onLoad };
|
|
259
193
|
//# sourceMappingURL=sdk.js.map
|
package/build/npm/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options, ReportDialogOptions } from '@sentry/core';\nimport {\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getCurrentScope,\n getIntegrationsToSetup,\n getLocationHref,\n getReportDialogEndpoint,\n inboundFiltersIntegration,\n initAndBind,\n lastEventId,\n logger,\n stackParserFromStackParserOptions,\n supportsFetch,\n} from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line deprecation/deprecation\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n };\n\n return {\n ...defaultOptions,\n ...dropTopLevelUndefinedKeys(optionsArg),\n };\n}\n\n/**\n * In contrast to the regular `dropUndefinedKeys` method,\n * this one does not deep-drop keys, but only on the top level.\n */\nfunction dropTopLevelUndefinedKeys<T extends object>(obj: T): Partial<T> {\n const mutatetedObj: Partial<T> = {};\n\n for (const k of Object.getOwnPropertyNames(obj)) {\n const key = k as keyof T;\n if (obj[key] !== undefined) {\n mutatetedObj[key] = obj[key];\n }\n }\n\n return mutatetedObj;\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject?.runtime?.id;\n const href = getLocationHref() || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n return;\n }\n\n if (DEBUG_BUILD && !supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * Present the user with a report dialog.\n *\n * @param options Everything is optional, we try to fetch all info need from the global scope.\n */\nexport function showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n if (!WINDOW.document) {\n DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');\n return;\n }\n\n const scope = getCurrentScope();\n const client = scope.getClient();\n const dsn = client?.getDsn();\n\n if (!dsn) {\n DEBUG_BUILD && logger.error('DSN not configured for showReportDialog call');\n return;\n }\n\n if (scope) {\n options.user = {\n ...scope.getUser(),\n ...options.user,\n };\n }\n\n if (!options.eventId) {\n const eventId = lastEventId();\n if (eventId) {\n options.eventId = eventId;\n }\n }\n\n const script = WINDOW.document.createElement('script');\n script.async = true;\n script.crossOrigin = 'anonymous';\n script.src = getReportDialogEndpoint(dsn, options);\n\n if (options.onLoad) {\n script.onload = options.onLoad;\n }\n\n const { onClose } = options;\n if (onClose) {\n const reportDialogClosedMessageHandler = (event: MessageEvent): void => {\n if (event.data === '__sentry_reportdialog_closed__') {\n try {\n onClose();\n } finally {\n WINDOW.removeEventListener('message', reportDialogClosedMessageHandler);\n }\n }\n };\n WINDOW.addEventListener('message', reportDialogClosedMessageHandler);\n }\n\n const injectionPoint = WINDOW.document.head || WINDOW.document.body;\n if (injectionPoint) {\n injectionPoint.appendChild(script);\n } else {\n DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');\n }\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA6BA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE;AACA;AACA;AACA;AACA,EAAE,OAAO;AACT;AACA;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,2BAA2B,EAAE;AACjC,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,iBAAiB,EAAE;AACvB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,GAAG;AACH;;AAEA;AACO,SAAS,mBAAmB,CAAC,UAAU,GAAmB,EAAE,EAAkB;AACrF,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,mBAAmB,EAAE,sBAAsB,CAAW,CAAC;AAC3D,IAAI,OAAO;AACX,MAAM,OAAO,uBAAuB,QAAA;AACpC,UAAU;AACV,UAAU,MAAM,CAAC,cAAc,EAAE,EAAE;AACnC,IAAI,iBAAiB,EAAE,IAAI;AAC3B,GAAG;;AAEH,EAAE,OAAO;AACT,IAAI,GAAG,cAAc;AACrB,IAAI,GAAG,yBAAyB,CAAC,UAAU,CAAC;AAC5C,GAAG;AACH;;AAEA;AACA;AACA;A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A,KAAA;AACA,IAAA,MAAA,CAAA,gBAAA,CAAA,SAAA,EAAA,gCAAA,CAAA;AACA;;AAEA,EAAA,MAAA,cAAA,GAAA,MAAA,CAAA,QAAA,CAAA,IAAA,IAAA,MAAA,CAAA,QAAA,CAAA,IAAA;AACA,EAAA,IAAA,cAAA,EAAA;AACA,IAAA,cAAA,CAAA,WAAA,CAAA,MAAA,CAAA;AACA,GAAA,MAAA;AACA,IAAA,WAAA,IAAA,MAAA,CAAA,KAAA,CAAA,+DAAA,CAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,SAAA,GAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,MAAA,CAAA,QAAA,EAAA;AACA,EAAA,QAAA,EAAA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../../src/sdk.ts"],"sourcesContent":["import type { Client, Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dedupeIntegration,\n functionToStringIntegration,\n getIntegrationsToSetup,\n getLocationHref,\n inboundFiltersIntegration,\n initAndBind,\n logger,\n stackParserFromStackParserOptions,\n supportsFetch,\n} from '@sentry/core';\nimport type { BrowserClientOptions, BrowserOptions } from './client';\nimport { BrowserClient } from './client';\nimport { DEBUG_BUILD } from './debug-build';\nimport { WINDOW } from './helpers';\nimport { breadcrumbsIntegration } from './integrations/breadcrumbs';\nimport { browserApiErrorsIntegration } from './integrations/browserapierrors';\nimport { browserSessionIntegration } from './integrations/browsersession';\nimport { globalHandlersIntegration } from './integrations/globalhandlers';\nimport { httpContextIntegration } from './integrations/httpcontext';\nimport { linkedErrorsIntegration } from './integrations/linkederrors';\nimport { defaultStackParser } from './stack-parsers';\nimport { makeFetchTransport } from './transports/fetch';\n\n/** Get the default integrations for the browser SDK. */\nexport function getDefaultIntegrations(_options: Options): Integration[] {\n /**\n * Note: Please make sure this stays in sync with Angular SDK, which re-exports\n * `getDefaultIntegrations` but with an adjusted set of integrations.\n */\n return [\n // TODO(v10): Replace with `eventFiltersIntegration` once we remove the deprecated `inboundFiltersIntegration`\n // eslint-disable-next-line deprecation/deprecation\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n browserApiErrorsIntegration(),\n breadcrumbsIntegration(),\n globalHandlersIntegration(),\n linkedErrorsIntegration(),\n dedupeIntegration(),\n httpContextIntegration(),\n browserSessionIntegration(),\n ];\n}\n\n/** Exported only for tests. */\nexport function applyDefaultOptions(optionsArg: BrowserOptions = {}): BrowserOptions {\n const defaultOptions: BrowserOptions = {\n defaultIntegrations: getDefaultIntegrations(optionsArg),\n release:\n typeof __SENTRY_RELEASE__ === 'string' // This allows build tooling to find-and-replace __SENTRY_RELEASE__ to inject a release value\n ? __SENTRY_RELEASE__\n : WINDOW.SENTRY_RELEASE?.id, // This supports the variable that sentry-webpack-plugin injects\n sendClientReports: true,\n };\n\n return {\n ...defaultOptions,\n ...dropTopLevelUndefinedKeys(optionsArg),\n };\n}\n\n/**\n * In contrast to the regular `dropUndefinedKeys` method,\n * this one does not deep-drop keys, but only on the top level.\n */\nfunction dropTopLevelUndefinedKeys<T extends object>(obj: T): Partial<T> {\n const mutatetedObj: Partial<T> = {};\n\n for (const k of Object.getOwnPropertyNames(obj)) {\n const key = k as keyof T;\n if (obj[key] !== undefined) {\n mutatetedObj[key] = obj[key];\n }\n }\n\n return mutatetedObj;\n}\n\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\n};\n\nfunction shouldShowBrowserExtensionError(): boolean {\n const windowWithMaybeExtension =\n typeof WINDOW.window !== 'undefined' && (WINDOW as typeof WINDOW & ExtensionProperties);\n if (!windowWithMaybeExtension) {\n // No need to show the error if we're not in a browser window environment (e.g. service workers)\n return false;\n }\n\n const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';\n const extensionObject = windowWithMaybeExtension[extensionKey];\n\n const runtimeId = extensionObject?.runtime?.id;\n const href = getLocationHref() || '';\n\n const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];\n\n // Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage\n const isDedicatedExtensionPage =\n !!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));\n\n // Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine\n // see: https://github.com/getsentry/sentry-javascript/issues/12668\n const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';\n\n return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;\n}\n\n/**\n * A magic string that build tooling can leverage in order to inject a release value into the SDK.\n */\ndeclare const __SENTRY_RELEASE__: string | undefined;\n\n/**\n * The Sentry Browser SDK Client.\n *\n * To use this SDK, call the {@link init} function as early as possible when\n * loading the web page. To set context information or send manual events, use\n * the provided methods.\n *\n * @example\n *\n * ```\n *\n * import { init } from '@sentry/browser';\n *\n * init({\n * dsn: '__DSN__',\n * // ...\n * });\n * ```\n *\n * @example\n * ```\n *\n * import { addBreadcrumb } from '@sentry/browser';\n * addBreadcrumb({\n * message: 'My Breadcrumb',\n * // ...\n * });\n * ```\n *\n * @example\n *\n * ```\n *\n * import * as Sentry from '@sentry/browser';\n * Sentry.captureMessage('Hello, world!');\n * Sentry.captureException(new Error('Good bye'));\n * Sentry.captureEvent({\n * message: 'Manual',\n * stacktrace: [\n * // ...\n * ],\n * });\n * ```\n *\n * @see {@link BrowserOptions} for documentation on configuration options.\n */\nexport function init(browserOptions: BrowserOptions = {}): Client | undefined {\n const options = applyDefaultOptions(browserOptions);\n\n if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n return;\n }\n\n if (DEBUG_BUILD && !supportsFetch()) {\n logger.warn(\n 'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',\n );\n }\n const clientOptions: BrowserClientOptions = {\n ...options,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup(options),\n transport: options.transport || makeFetchTransport,\n };\n\n return initAndBind(BrowserClient, clientOptions);\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function forceLoad(): void {\n // Noop\n}\n\n/**\n * This function is here to be API compatible with the loader.\n * @hidden\n */\nexport function onLoad(callback: () => void): void {\n callback();\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0BA;AACO,SAAS,sBAAsB,CAAC,QAAQ,EAA0B;AACzE;AACA;AACA;AACA;AACA,EAAE,OAAO;AACT;AACA;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE;AACjC,IAAI,2BAA2B,EAAE;AACjC,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,IAAI,uBAAuB,EAAE;AAC7B,IAAI,iBAAiB,EAAE;AACvB,IAAI,sBAAsB,EAAE;AAC5B,IAAI,yBAAyB,EAAE;AAC/B,GAAG;AACH;;AAEA;AACO,SAAS,mBAAmB,CAAC,UAAU,GAAmB,EAAE,EAAkB;AACrF,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,mBAAmB,EAAE,sBAAsB,CAAW,CAAC;AAC3D,IAAI,OAAO;AACX,MAAM,OAAO,uBAAuB,QAAA;AACpC,UAAU;AACV,UAAU,MAAM,CAAC,cAAc,EAAE,EAAE;AACnC,IAAI,iBAAiB,EAAE,IAAI;AAC3B,GAAG;;AAEH,EAAE,OAAO;AACT,IAAI,GAAG,cAAc;AACrB,IAAI,GAAG,yBAAyB,CAAC,UAAU,CAAC;AAC5C,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA,SAAS,yBAAyB,CAAmB,GAAG,EAAiB;AACzE,EAAE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AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,IAAA,CAAA,cAAA,GAAA,EAAA,EAAA;AACA,EAAA,MAAA,OAAA,GAAA,mBAAA,CAAA,cAAA,CAAA;;AAEA,EAAA,IAAA,CAAA,OAAA,CAAA,yBAAA,IAAA,+BAAA,EAAA,EAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,cAAA,CAAA,MAAA;AACA;AACA,QAAA,OAAA,CAAA,KAAA;AACA,UAAA,uJAAA;AACA,SAAA;AACA,OAAA,CAAA;AACA;AACA,IAAA;AACA;;AAEA,EAAA,IAAA,WAAA,IAAA,CAAA,aAAA,EAAA,EAAA;AACA,IAAA,MAAA,CAAA,IAAA;AACA,MAAA,oIAAA;AACA,KAAA;AACA;AACA,EAAA,MAAA,aAAA,GAAA;AACA,IAAA,GAAA,OAAA;AACA,IAAA,WAAA,EAAA,iCAAA,CAAA,OAAA,CAAA,WAAA,IAAA,kBAAA,CAAA;AACA,IAAA,YAAA,EAAA,sBAAA,CAAA,OAAA,CAAA;AACA,IAAA,SAAA,EAAA,OAAA,CAAA,SAAA,IAAA,kBAAA;AACA,GAAA;;AAEA,EAAA,OAAA,WAAA,CAAA,aAAA,EAAA,aAAA,CAAA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,SAAA,GAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAA,MAAA,CAAA,QAAA,EAAA;AACA,EAAA,QAAA,EAAA;AACA;;;;"}
|
|
@@ -8,7 +8,8 @@ export { makeFetchTransport } from './transports/fetch';
|
|
|
8
8
|
export { defaultStackParser, defaultStackLineParsers, chromeStackLineParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser, } from './stack-parsers';
|
|
9
9
|
export { eventFromException, eventFromMessage, exceptionFromError } from './eventbuilder';
|
|
10
10
|
export { createUserFeedbackEnvelope } from './userfeedback';
|
|
11
|
-
export { getDefaultIntegrations, forceLoad, init, onLoad
|
|
11
|
+
export { getDefaultIntegrations, forceLoad, init, onLoad } from './sdk';
|
|
12
|
+
export { showReportDialog } from './report-dialog';
|
|
12
13
|
export { breadcrumbsIntegration } from './integrations/breadcrumbs';
|
|
13
14
|
export { globalHandlersIntegration } from './integrations/globalhandlers';
|
|
14
15
|
export { httpContextIntegration } from './integrations/httpcontext';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,OAAO,EACP,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,2BAA2B,EAE3B,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,EACJ,OAAO,EACP,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,eAAe,EACf,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,aAAa,E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AAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReportDialogOptions } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* Present the user with a report dialog.
|
|
4
|
+
*
|
|
5
|
+
* @param options Everything is optional, we try to fetch all info need from the current scope.
|
|
6
|
+
*/
|
|
7
|
+
export declare function showReportDialog(options?: ReportDialogOptions): void;
|
|
8
|
+
//# sourceMappingURL=report-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-dialog.d.ts","sourceRoot":"","sources":["../../../src/report-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKxD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,mBAAwB,GAAG,IAAI,CAqDxE"}
|
package/build/npm/types/sdk.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Client, Integration, Options
|
|
1
|
+
import type { Client, Integration, Options } from '@sentry/core';
|
|
2
2
|
import type { BrowserOptions } from './client';
|
|
3
3
|
/** Get the default integrations for the browser SDK. */
|
|
4
4
|
export declare function getDefaultIntegrations(_options: Options): Integration[];
|
|
@@ -51,12 +51,6 @@ export declare function applyDefaultOptions(optionsArg?: BrowserOptions): Browse
|
|
|
51
51
|
* @see {@link BrowserOptions} for documentation on configuration options.
|
|
52
52
|
*/
|
|
53
53
|
export declare function init(browserOptions?: BrowserOptions): Client | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Present the user with a report dialog.
|
|
56
|
-
*
|
|
57
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
58
|
-
*/
|
|
59
|
-
export declare function showReportDialog(options?: ReportDialogOptions): void;
|
|
60
54
|
/**
|
|
61
55
|
* This function is here to be API compatible with the loader.
|
|
62
56
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAajE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,UAAU,CAAC;AAarE,wDAAwD;AACxD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,EAAE,CAkBvE;AAED,+BAA+B;AAC/B,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,cAAmB,GAAG,cAAc,CAcnF;AA8DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,IAAI,CAAC,cAAc,GAAE,cAAmB,GAAG,MAAM,GAAG,SAAS,CA4B5E;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAEhC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEjD"}
|
|
@@ -8,7 +8,8 @@ export { makeFetchTransport } from './transports/fetch';
|
|
|
8
8
|
export { defaultStackParser, defaultStackLineParsers, chromeStackLineParser, geckoStackLineParser, opera10StackLineParser, opera11StackLineParser, winjsStackLineParser, } from './stack-parsers';
|
|
9
9
|
export { eventFromException, eventFromMessage, exceptionFromError } from './eventbuilder';
|
|
10
10
|
export { createUserFeedbackEnvelope } from './userfeedback';
|
|
11
|
-
export { getDefaultIntegrations, forceLoad, init, onLoad
|
|
11
|
+
export { getDefaultIntegrations, forceLoad, init, onLoad } from './sdk';
|
|
12
|
+
export { showReportDialog } from './report-dialog';
|
|
12
13
|
export { breadcrumbsIntegration } from './integrations/breadcrumbs';
|
|
13
14
|
export { globalHandlersIntegration } from './integrations/globalhandlers';
|
|
14
15
|
export { httpContextIntegration } from './integrations/httpcontext';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReportDialogOptions } from '@sentry/core';
|
|
2
|
+
/**
|
|
3
|
+
* Present the user with a report dialog.
|
|
4
|
+
*
|
|
5
|
+
* @param options Everything is optional, we try to fetch all info need from the current scope.
|
|
6
|
+
*/
|
|
7
|
+
export declare function showReportDialog(options?: ReportDialogOptions): void;
|
|
8
|
+
//# sourceMappingURL=report-dialog.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Client, Integration, Options
|
|
1
|
+
import { Client, Integration, Options } from '@sentry/core';
|
|
2
2
|
import { BrowserOptions } from './client';
|
|
3
3
|
/** Get the default integrations for the browser SDK. */
|
|
4
4
|
export declare function getDefaultIntegrations(_options: Options): Integration[];
|
|
@@ -51,12 +51,6 @@ export declare function applyDefaultOptions(optionsArg?: BrowserOptions): Browse
|
|
|
51
51
|
* @see {@link BrowserOptions} for documentation on configuration options.
|
|
52
52
|
*/
|
|
53
53
|
export declare function init(browserOptions?: BrowserOptions): Client | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Present the user with a report dialog.
|
|
56
|
-
*
|
|
57
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
58
|
-
*/
|
|
59
|
-
export declare function showReportDialog(options?: ReportDialogOptions): void;
|
|
60
54
|
/**
|
|
61
55
|
* This function is here to be API compatible with the loader.
|
|
62
56
|
* @hidden
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/browser",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.21.0",
|
|
4
4
|
"description": "Official Sentry SDK for browsers",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/browser",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@sentry-internal/browser-utils": "9.
|
|
43
|
-
"@sentry-internal/feedback": "9.
|
|
44
|
-
"@sentry-internal/replay": "9.
|
|
45
|
-
"@sentry-internal/replay-canvas": "9.
|
|
46
|
-
"@sentry/core": "9.
|
|
42
|
+
"@sentry-internal/browser-utils": "9.21.0",
|
|
43
|
+
"@sentry-internal/feedback": "9.21.0",
|
|
44
|
+
"@sentry-internal/replay": "9.21.0",
|
|
45
|
+
"@sentry-internal/replay-canvas": "9.21.0",
|
|
46
|
+
"@sentry/core": "9.21.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@sentry-internal/integration-shims": "9.
|
|
49
|
+
"@sentry-internal/integration-shims": "9.21.0",
|
|
50
50
|
"fake-indexeddb": "^4.0.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|