@sentry/browser 9.20.0 → 9.22.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 +45 -112
- 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 +47 -113
- 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
|
@@ -68,37 +68,6 @@ function dropTopLevelUndefinedKeys(obj) {
|
|
|
68
68
|
return mutatetedObj;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function shouldShowBrowserExtensionError() {
|
|
72
|
-
const windowWithMaybeExtension =
|
|
73
|
-
typeof helpers.WINDOW.window !== 'undefined' && (helpers.WINDOW );
|
|
74
|
-
if (!windowWithMaybeExtension) {
|
|
75
|
-
// No need to show the error if we're not in a browser window environment (e.g. service workers)
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';
|
|
80
|
-
const extensionObject = windowWithMaybeExtension[extensionKey];
|
|
81
|
-
|
|
82
|
-
const runtimeId = extensionObject?.runtime?.id;
|
|
83
|
-
const href = core.getLocationHref() || '';
|
|
84
|
-
|
|
85
|
-
const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];
|
|
86
|
-
|
|
87
|
-
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
|
|
88
|
-
const isDedicatedExtensionPage =
|
|
89
|
-
!!runtimeId && helpers.WINDOW === helpers.WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));
|
|
90
|
-
|
|
91
|
-
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
|
|
92
|
-
// see: https://github.com/getsentry/sentry-javascript/issues/12668
|
|
93
|
-
const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';
|
|
94
|
-
|
|
95
|
-
return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* A magic string that build tooling can leverage in order to inject a release value into the SDK.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
71
|
/**
|
|
103
72
|
* The Sentry Browser SDK Client.
|
|
104
73
|
*
|
|
@@ -146,25 +115,11 @@ function shouldShowBrowserExtensionError() {
|
|
|
146
115
|
* @see {@link BrowserOptions} for documentation on configuration options.
|
|
147
116
|
*/
|
|
148
117
|
function init(browserOptions = {}) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {
|
|
152
|
-
if (debugBuild.DEBUG_BUILD) {
|
|
153
|
-
core.consoleSandbox(() => {
|
|
154
|
-
// eslint-disable-next-line no-console
|
|
155
|
-
console.error(
|
|
156
|
-
'[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',
|
|
157
|
-
);
|
|
158
|
-
});
|
|
159
|
-
}
|
|
118
|
+
if (!browserOptions.skipBrowserExtensionCheck && _checkForBrowserExtension()) {
|
|
160
119
|
return;
|
|
161
120
|
}
|
|
162
121
|
|
|
163
|
-
|
|
164
|
-
core.logger.warn(
|
|
165
|
-
'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',
|
|
166
|
-
);
|
|
167
|
-
}
|
|
122
|
+
const options = applyDefaultOptions(browserOptions);
|
|
168
123
|
const clientOptions = {
|
|
169
124
|
...options,
|
|
170
125
|
stackParser: core.stackParserFromStackParserOptions(options.stackParser || stackParsers.defaultStackParser),
|
|
@@ -176,85 +131,64 @@ function init(browserOptions = {}) {
|
|
|
176
131
|
}
|
|
177
132
|
|
|
178
133
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
134
|
+
* This function is here to be API compatible with the loader.
|
|
135
|
+
* @hidden
|
|
182
136
|
*/
|
|
183
|
-
function
|
|
184
|
-
//
|
|
185
|
-
|
|
186
|
-
debugBuild.DEBUG_BUILD && core.logger.error('Global document not defined in showReportDialog call');
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
137
|
+
function forceLoad() {
|
|
138
|
+
// Noop
|
|
139
|
+
}
|
|
189
140
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
141
|
+
/**
|
|
142
|
+
* This function is here to be API compatible with the loader.
|
|
143
|
+
* @hidden
|
|
144
|
+
*/
|
|
145
|
+
function onLoad(callback) {
|
|
146
|
+
callback();
|
|
147
|
+
}
|
|
193
148
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
149
|
+
function _isEmbeddedBrowserExtension() {
|
|
150
|
+
if (typeof helpers.WINDOW.window === 'undefined') {
|
|
151
|
+
// No need to show the error if we're not in a browser window environment (e.g. service workers)
|
|
152
|
+
return false;
|
|
197
153
|
}
|
|
198
154
|
|
|
199
|
-
|
|
200
|
-
options.user = {
|
|
201
|
-
...scope.getUser(),
|
|
202
|
-
...options.user,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
155
|
+
const _window = helpers.WINDOW ;
|
|
205
156
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
157
|
+
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
|
|
158
|
+
// see: https://github.com/getsentry/sentry-javascript/issues/12668
|
|
159
|
+
if (_window.nw) {
|
|
160
|
+
return false;
|
|
211
161
|
}
|
|
212
162
|
|
|
213
|
-
const
|
|
214
|
-
script.async = true;
|
|
215
|
-
script.crossOrigin = 'anonymous';
|
|
216
|
-
script.src = core.getReportDialogEndpoint(dsn, options);
|
|
163
|
+
const extensionObject = _window['chrome'] || _window['browser'];
|
|
217
164
|
|
|
218
|
-
if (
|
|
219
|
-
|
|
165
|
+
if (!extensionObject?.runtime?.id) {
|
|
166
|
+
return false;
|
|
220
167
|
}
|
|
221
168
|
|
|
222
|
-
const
|
|
223
|
-
|
|
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
|
-
}
|
|
169
|
+
const href = core.getLocationHref();
|
|
170
|
+
const extensionProtocols = ['chrome-extension', 'moz-extension', 'ms-browser-extension', 'safari-web-extension'];
|
|
235
171
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
} else {
|
|
240
|
-
debugBuild.DEBUG_BUILD && core.logger.error('Not injecting report dialog. No injection point found in HTML');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
172
|
+
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
|
|
173
|
+
const isDedicatedExtensionPage =
|
|
174
|
+
helpers.WINDOW === helpers.WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}://`));
|
|
243
175
|
|
|
244
|
-
|
|
245
|
-
* This function is here to be API compatible with the loader.
|
|
246
|
-
* @hidden
|
|
247
|
-
*/
|
|
248
|
-
function forceLoad() {
|
|
249
|
-
// Noop
|
|
176
|
+
return !isDedicatedExtensionPage;
|
|
250
177
|
}
|
|
251
178
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
179
|
+
function _checkForBrowserExtension() {
|
|
180
|
+
if (_isEmbeddedBrowserExtension()) {
|
|
181
|
+
if (debugBuild.DEBUG_BUILD) {
|
|
182
|
+
core.consoleSandbox(() => {
|
|
183
|
+
// eslint-disable-next-line no-console
|
|
184
|
+
console.error(
|
|
185
|
+
'[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
258
192
|
}
|
|
259
193
|
|
|
260
194
|
exports.applyDefaultOptions = applyDefaultOptions;
|
|
@@ -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,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,UAAUC,cAAM,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,MAAM,YAAY,GAAe,EAAE;;AAErC,EAAE,KAAK,MAAM,CAAE,IAAG,MAAM,CAAC,mBAAmB,CAA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,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 stackParserFromStackParserOptions,\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\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\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/** 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\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 if (!browserOptions.skipBrowserExtensionCheck && _checkForBrowserExtension()) {\n return;\n }\n\n const options = applyDefaultOptions(browserOptions);\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\nfunction _isEmbeddedBrowserExtension(): boolean {\n if (typeof WINDOW.window === 'undefined') {\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 _window = WINDOW as typeof WINDOW & ExtensionProperties;\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 if (_window.nw) {\n return false;\n }\n\n const extensionObject = _window['chrome'] || _window['browser'];\n\n if (!extensionObject?.runtime?.id) {\n return false;\n }\n\n const href = getLocationHref();\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 WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}://`));\n\n return !isDedicatedExtensionPage;\n}\n\nfunction _checkForBrowserExtension(): true | void {\n if (_isEmbeddedBrowserExtension()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n\n return true;\n }\n}\n"],"names":["inboundFiltersIntegration","functionToStringIntegration","browserApiErrorsIntegration","breadcrumbsIntegration","globalHandlersIntegration","linkedErrorsIntegration","dedupeIntegration","httpContextIntegration","browserSessionIntegration","WINDOW","stackParserFromStackParserOptions","defaultStackParser","getIntegrationsToSetup","makeFetchTransport","initAndBind","BrowserClient","getLocationHref","DEBUG_BUILD","consoleSandbox"],"mappings":";;;;;;;;;;;;;;;AAwCA;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,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,UAAUC,cAAM,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,MAAM,YAAY,GAAe,EAAE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AC,MAAO,KAAI,WAAW,EAAE;AAC5C;AACA,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,OAAQ,GAAEA,cAAO;;AAEzB;AACA;AACA,EAAE,IAAI,OAAO,CAAC,EAAE,EAAE;AAClB,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,eAAgB,GAAE,OAAO,CAAC,QAAQ,CAAA,IAAK,OAAO,CAAC,SAAS,CAAC;;AAEjE,EAAE,IAAI,CAAC,eAAe,EAAE,OAAO,EAAE,EAAE,EAAE;AACrC,IAAI,OAAO,KAAK;AAChB;;AAEA,EAAE,MAAM,IAAA,GAAOO,oBAAe,EAAE;AAChC,EAAE,MAAM,kBAAmB,GAAE,CAAC,kBAAkB,EAAE,eAAe,EAAE,sBAAsB,EAAE,sBAAsB,CAAC;;AAElH;AACA,EAAE,MAAM,wBAAyB;AACjC,IAAIP,mBAAWA,cAAM,CAAC,GAAA,IAAO,kBAAkB,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,UAAU,CAAC,CAAC,EAAA,QAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,CAAA,wBAAA;AACA;;AAEA,SAAA,yBAAA,GAAA;AACA,EAAA,IAAA,2BAAA,EAAA,EAAA;AACA,IAAA,IAAAQ,sBAAA,EAAA;AACA,MAAAC,mBAAA,CAAA,MAAA;AACA;AACA,QAAA,OAAA,CAAA,KAAA;AACA,UAAA,mJAAA;AACA,SAAA;AACA,OAAA,CAAA;AACA;;AAEA,IAAA,OAAA,IAAA;AACA;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.22.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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m/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration,
|
|
1
|
+
import { inboundFiltersIntegration, functionToStringIntegration, dedupeIntegration, getIntegrationsToSetup, stackParserFromStackParserOptions, initAndBind, consoleSandbox, 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';
|
|
@@ -66,37 +66,6 @@ function dropTopLevelUndefinedKeys(obj) {
|
|
|
66
66
|
return mutatetedObj;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function shouldShowBrowserExtensionError() {
|
|
70
|
-
const windowWithMaybeExtension =
|
|
71
|
-
typeof WINDOW.window !== 'undefined' && (WINDOW );
|
|
72
|
-
if (!windowWithMaybeExtension) {
|
|
73
|
-
// No need to show the error if we're not in a browser window environment (e.g. service workers)
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const extensionKey = windowWithMaybeExtension.chrome ? 'chrome' : 'browser';
|
|
78
|
-
const extensionObject = windowWithMaybeExtension[extensionKey];
|
|
79
|
-
|
|
80
|
-
const runtimeId = extensionObject?.runtime?.id;
|
|
81
|
-
const href = getLocationHref() || '';
|
|
82
|
-
|
|
83
|
-
const extensionProtocols = ['chrome-extension:', 'moz-extension:', 'ms-browser-extension:', 'safari-web-extension:'];
|
|
84
|
-
|
|
85
|
-
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
|
|
86
|
-
const isDedicatedExtensionPage =
|
|
87
|
-
!!runtimeId && WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}//`));
|
|
88
|
-
|
|
89
|
-
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
|
|
90
|
-
// see: https://github.com/getsentry/sentry-javascript/issues/12668
|
|
91
|
-
const isNWjs = typeof windowWithMaybeExtension.nw !== 'undefined';
|
|
92
|
-
|
|
93
|
-
return !!runtimeId && !isDedicatedExtensionPage && !isNWjs;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* A magic string that build tooling can leverage in order to inject a release value into the SDK.
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
69
|
/**
|
|
101
70
|
* The Sentry Browser SDK Client.
|
|
102
71
|
*
|
|
@@ -144,25 +113,11 @@ function shouldShowBrowserExtensionError() {
|
|
|
144
113
|
* @see {@link BrowserOptions} for documentation on configuration options.
|
|
145
114
|
*/
|
|
146
115
|
function init(browserOptions = {}) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (!options.skipBrowserExtensionCheck && shouldShowBrowserExtensionError()) {
|
|
150
|
-
if (DEBUG_BUILD) {
|
|
151
|
-
consoleSandbox(() => {
|
|
152
|
-
// eslint-disable-next-line no-console
|
|
153
|
-
console.error(
|
|
154
|
-
'[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
116
|
+
if (!browserOptions.skipBrowserExtensionCheck && _checkForBrowserExtension()) {
|
|
158
117
|
return;
|
|
159
118
|
}
|
|
160
119
|
|
|
161
|
-
|
|
162
|
-
logger.warn(
|
|
163
|
-
'No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.',
|
|
164
|
-
);
|
|
165
|
-
}
|
|
120
|
+
const options = applyDefaultOptions(browserOptions);
|
|
166
121
|
const clientOptions = {
|
|
167
122
|
...options,
|
|
168
123
|
stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
|
|
@@ -174,86 +129,65 @@ function init(browserOptions = {}) {
|
|
|
174
129
|
}
|
|
175
130
|
|
|
176
131
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* @param options Everything is optional, we try to fetch all info need from the global scope.
|
|
132
|
+
* This function is here to be API compatible with the loader.
|
|
133
|
+
* @hidden
|
|
180
134
|
*/
|
|
181
|
-
function
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
DEBUG_BUILD && logger.error('Global document not defined in showReportDialog call');
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
135
|
+
function forceLoad() {
|
|
136
|
+
// Noop
|
|
137
|
+
}
|
|
187
138
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
139
|
+
/**
|
|
140
|
+
* This function is here to be API compatible with the loader.
|
|
141
|
+
* @hidden
|
|
142
|
+
*/
|
|
143
|
+
function onLoad(callback) {
|
|
144
|
+
callback();
|
|
145
|
+
}
|
|
191
146
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
147
|
+
function _isEmbeddedBrowserExtension() {
|
|
148
|
+
if (typeof WINDOW.window === 'undefined') {
|
|
149
|
+
// No need to show the error if we're not in a browser window environment (e.g. service workers)
|
|
150
|
+
return false;
|
|
195
151
|
}
|
|
196
152
|
|
|
197
|
-
|
|
198
|
-
options.user = {
|
|
199
|
-
...scope.getUser(),
|
|
200
|
-
...options.user,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
153
|
+
const _window = WINDOW ;
|
|
203
154
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
155
|
+
// Running the SDK in NW.js, which appears like a browser extension but isn't, is also fine
|
|
156
|
+
// see: https://github.com/getsentry/sentry-javascript/issues/12668
|
|
157
|
+
if (_window.nw) {
|
|
158
|
+
return false;
|
|
209
159
|
}
|
|
210
160
|
|
|
211
|
-
const
|
|
212
|
-
script.async = true;
|
|
213
|
-
script.crossOrigin = 'anonymous';
|
|
214
|
-
script.src = getReportDialogEndpoint(dsn, options);
|
|
161
|
+
const extensionObject = _window['chrome'] || _window['browser'];
|
|
215
162
|
|
|
216
|
-
if (
|
|
217
|
-
|
|
163
|
+
if (!extensionObject?.runtime?.id) {
|
|
164
|
+
return false;
|
|
218
165
|
}
|
|
219
166
|
|
|
220
|
-
const
|
|
221
|
-
|
|
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
|
-
}
|
|
167
|
+
const href = getLocationHref();
|
|
168
|
+
const extensionProtocols = ['chrome-extension', 'moz-extension', 'ms-browser-extension', 'safari-web-extension'];
|
|
233
169
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
} else {
|
|
238
|
-
DEBUG_BUILD && logger.error('Not injecting report dialog. No injection point found in HTML');
|
|
239
|
-
}
|
|
240
|
-
}
|
|
170
|
+
// Running the SDK in a dedicated extension page and calling Sentry.init is fine; no risk of data leakage
|
|
171
|
+
const isDedicatedExtensionPage =
|
|
172
|
+
WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}://`));
|
|
241
173
|
|
|
242
|
-
|
|
243
|
-
* This function is here to be API compatible with the loader.
|
|
244
|
-
* @hidden
|
|
245
|
-
*/
|
|
246
|
-
function forceLoad() {
|
|
247
|
-
// Noop
|
|
174
|
+
return !isDedicatedExtensionPage;
|
|
248
175
|
}
|
|
249
176
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
177
|
+
function _checkForBrowserExtension() {
|
|
178
|
+
if (_isEmbeddedBrowserExtension()) {
|
|
179
|
+
if (DEBUG_BUILD) {
|
|
180
|
+
consoleSandbox(() => {
|
|
181
|
+
// eslint-disable-next-line no-console
|
|
182
|
+
console.error(
|
|
183
|
+
'[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
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,sBA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+
{"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 stackParserFromStackParserOptions,\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\ntype ExtensionProperties = {\n chrome?: Runtime;\n browser?: Runtime;\n nw?: unknown;\n};\ntype Runtime = {\n runtime?: {\n id?: string;\n };\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/** 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\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 if (!browserOptions.skipBrowserExtensionCheck && _checkForBrowserExtension()) {\n return;\n }\n\n const options = applyDefaultOptions(browserOptions);\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\nfunction _isEmbeddedBrowserExtension(): boolean {\n if (typeof WINDOW.window === 'undefined') {\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 _window = WINDOW as typeof WINDOW & ExtensionProperties;\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 if (_window.nw) {\n return false;\n }\n\n const extensionObject = _window['chrome'] || _window['browser'];\n\n if (!extensionObject?.runtime?.id) {\n return false;\n }\n\n const href = getLocationHref();\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 WINDOW === WINDOW.top && extensionProtocols.some(protocol => href.startsWith(`${protocol}://`));\n\n return !isDedicatedExtensionPage;\n}\n\nfunction _checkForBrowserExtension(): true | void {\n if (_isEmbeddedBrowserExtension()) {\n if (DEBUG_BUILD) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.error(\n '[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/',\n );\n });\n }\n\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwCA;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;AA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AA,GAAA,CAAA,CAAA,CAAA;;AAEA,EAAA,OAAA,CAAA,wBAAA;AACA;;AAEA,SAAA,yBAAA,GAAA;AACA,EAAA,IAAA,2BAAA,EAAA,EAAA;AACA,IAAA,IAAA,WAAA,EAAA;AACA,MAAA,cAAA,CAAA,MAAA;AACA;AACA,QAAA,OAAA,CAAA,KAAA;AACA,UAAA,mJAAA;AACA,SAAA;AACA,OAAA,CAAA;AACA;;AAEA,IAAA,OAAA,IAAA;AACA;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,KA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C;AAC5D,OAAO,EAAE,sBAAsB,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,EAAE,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;AAWjE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,UAAU,CAAC;AA6BrE,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;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,IAAI,CAAC,cAAc,GAAE,cAAmB,GAAG,MAAM,GAAG,SAAS,CAc5E;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.22.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.22.0",
|
|
43
|
+
"@sentry-internal/feedback": "9.22.0",
|
|
44
|
+
"@sentry-internal/replay": "9.22.0",
|
|
45
|
+
"@sentry-internal/replay-canvas": "9.22.0",
|
|
46
|
+
"@sentry/core": "9.22.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@sentry-internal/integration-shims": "9.
|
|
49
|
+
"@sentry-internal/integration-shims": "9.22.0",
|
|
50
50
|
"fake-indexeddb": "^4.0.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|