...
 
Commits (4)
## Changelog
#### 0.3.1
- use same version of guzzle as SearchEngineKeywordsPerformance
#### 0.3.0
- don't ship whole node_modules directory
- update sentry SDKs
#### 0.2.3
don't load current plugin
......
......@@ -63,7 +63,7 @@ class SentryLogger extends \Piwik\Plugin
}
public function getJavaScriptFiles(&$jsFiles) {
$jsFiles[] = 'plugins/SentryLogger/node_modules/@sentry/browser/build/bundle.min.js';
$jsFiles[] = 'plugins/SentryLogger/libs/bundle.min.js';
$jsFiles[] = 'plugins/SentryLogger/javascripts/init.js';
}
......
This diff is collapsed.
#!/bin/bash
set -x
set -e
rm -r node_modules
mkdir -p tmp
cp package.json tmp/
cp yarn.lock tmp/
cd tmp
yarn install
cp node_modules/@sentry/browser/build/bundle.min.js ../libs/
This diff is collapsed.
{
"systemParams": "linux-x64-64",
"modulesFolders": [
"node_modules"
],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [
"@sentry/browser@5.0.5"
],
"lockfileEntries": {
"@sentry/browser@5.0.5": "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.0.5.tgz#6ef7a9a53aa28081d3b7dcab211de317dac0072e",
"@sentry/core@5.0.5": "https://registry.yarnpkg.com/@sentry/core/-/core-5.0.5.tgz#415f61c2d0ef442e5cce1e1ab60321d115daea40",
"@sentry/hub@5.0.5": "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.0.5.tgz#a6697d0b303ee10908514d16b2930b22bd27f08e",
"@sentry/minimal@5.0.5": "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.0.5.tgz#cf0141c92244daf1083122750fa10170b20c1ce1",
"@sentry/types@5.0.5": "https://registry.yarnpkg.com/@sentry/types/-/types-5.0.5.tgz#03a7e2db3b187262433982174614e116dcc958c4",
"@sentry/utils@5.0.5": "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.0.5.tgz#0623b4df088e96c3d48fb0ec6cb8b44a89a22529",
"tslib@^1.9.3": "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
},
"files": [],
"artifacts": {}
}
\ No newline at end of file
BSD 3-Clause License
Copyright (c) 2019, Sentry
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<p align="center">
<a href="https://sentry.io" target="_blank" align="center">
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" width="280">
</a>
<br />
</p>
# Official Sentry SDK for Browsers
[![Sauce Test Status](https://saucelabs.com/buildstatus/sentryio)](https://saucelabs.com/u/sentryio)
[![npm version](https://img.shields.io/npm/v/@sentry/browser.svg)](https://www.npmjs.com/package/@sentry/browser)
[![npm dm](https://img.shields.io/npm/dm/@sentry/browser.svg)](https://www.npmjs.com/package/@sentry/browser)
[![npm dt](https://img.shields.io/npm/dt/@sentry/browser.svg)](https://www.npmjs.com/package/@sentry/browser)
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/)
## Links
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)
## Usage
To use this SDK, call `Sentry.init(options)` as early as possible after loading the page. This will initialize the SDK
and hook into the environment. Note that you can turn off almost all side effects using the respective options.
```javascript
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: '__DSN__',
// ...
});
```
To set context information or send manual events, use the exported functions of `@sentry/browser`. Note that these
functions will not perform any action before you have called `Sentry.init()`:
```javascript
import * as Sentry from '@sentry/browser';
// Set user information, as well as tags and further extras
Sentry.configureScope(scope => {
scope.setExtra('battery', 0.7);
scope.setTag('user_mode', 'admin');
scope.setUser({ id: '4711' });
// scope.clear();
});
// Add a breadcrumb for future events
Sentry.addBreadcrumb({
message: 'My Breadcrumb',
// ...
});
// Capture exceptions, messages or manual events
Sentry.captureMessage('Hello, world!');
Sentry.captureException(new Error('Good bye'));
Sentry.captureEvent({
message: 'Manual',
stacktrace: [
// ...
],
});
```
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
import { BaseBackend } from '@sentry/core';
import { Event, EventHint, Options, Severity, Transport } from '@sentry/types';
import { SyncPromise } from '@sentry/utils/syncpromise';
/**
* Configuration options for the Sentry Browser SDK.
* @see BrowserClient for more information.
*/
export interface BrowserOptions extends Options {
/**
* A pattern for error URLs which should not be sent to Sentry.
* To whitelist certain errors instead, use {@link Options.whitelistUrls}.
* By default, all errors will be sent.
*/
blacklistUrls?: Array<string | RegExp>;
/**
* A pattern for error URLs which should exclusively be sent to Sentry.
* This is the opposite of {@link Options.blacklistUrls}.
* By default, all errors will be sent.
*/
whitelistUrls?: Array<string | RegExp>;
}
/**
* The Sentry Browser SDK Backend.
* @hidden
*/
export declare class BrowserBackend extends BaseBackend<BrowserOptions> {
/**
* @inheritDoc
*/
protected _setupTransport(): Transport;
/**
* @inheritDoc
*/
eventFromException(exception: any, hint?: EventHint): SyncPromise<Event>;
/**
* This is an internal helper function that creates an event.
*/
private _buildEvent;
/**
* @inheritDoc
*/
eventFromMessage(message: string, level?: Severity, hint?: EventHint): SyncPromise<Event>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var types_1 = require("@sentry/types");
var is_1 = require("@sentry/utils/is");
var misc_1 = require("@sentry/utils/misc");
var supports_1 = require("@sentry/utils/supports");
var syncpromise_1 = require("@sentry/utils/syncpromise");
var parsers_1 = require("./parsers");
var tracekit_1 = require("./tracekit");
var transports_1 = require("./transports");
/**
* The Sentry Browser SDK Backend.
* @hidden
*/
var BrowserBackend = /** @class */ (function (_super) {
tslib_1.__extends(BrowserBackend, _super);
function BrowserBackend() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @inheritDoc
*/
BrowserBackend.prototype._setupTransport = function () {
if (!this._options.dsn) {
// We return the noop transport here in case there is no Dsn.
return _super.prototype._setupTransport.call(this);
}
var transportOptions = this._options.transportOptions
? this._options.transportOptions
: { dsn: this._options.dsn };
if (this._options.transport) {
return new this._options.transport(transportOptions);
}
if (supports_1.supportsFetch()) {
return new transports_1.FetchTransport(transportOptions);
}
return new transports_1.XHRTransport(transportOptions);
};
/**
* @inheritDoc
*/
BrowserBackend.prototype.eventFromException = function (exception, hint) {
var _this = this;
var event;
if (is_1.isErrorEvent(exception) && exception.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
var errorEvent = exception;
exception = errorEvent.error; // tslint:disable-line:no-parameter-reassignment
event = parsers_1.eventFromStacktrace(tracekit_1.computeStackTrace(exception));
return syncpromise_1.SyncPromise.resolve(this._buildEvent(event, hint));
}
if (is_1.isDOMError(exception) || is_1.isDOMException(exception)) {
// If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)
// then we just extract the name and message, as they don't provide anything else
// https://developer.mozilla.org/en-US/docs/Web/API/DOMError
// https://developer.mozilla.org/en-US/docs/Web/API/DOMException
var domException = exception;
var name_1 = domException.name || (is_1.isDOMError(domException) ? 'DOMError' : 'DOMException');
var message_1 = domException.message ? name_1 + ": " + domException.message : name_1;
return this.eventFromMessage(message_1, types_1.Severity.Error, hint).then(function (messageEvent) {
misc_1.addExceptionTypeValue(messageEvent, message_1);
return syncpromise_1.SyncPromise.resolve(_this._buildEvent(messageEvent, hint));
});
}
if (is_1.isError(exception)) {
// we have a real Error object, do nothing
event = parsers_1.eventFromStacktrace(tracekit_1.computeStackTrace(exception));
return syncpromise_1.SyncPromise.resolve(this._buildEvent(event, hint));
}
if (is_1.isPlainObject(exception) && hint && hint.syntheticException) {
// If it is plain Object, serialize it manually and extract options
// This will allow us to group events based on top-level keys
// which is much better than creating new group when any key/value change
var objectException = exception;
event = parsers_1.eventFromPlainObject(objectException, hint.syntheticException);
misc_1.addExceptionTypeValue(event, 'Custom Object', undefined, {
handled: true,
synthetic: true,
type: 'generic',
});
event.level = types_1.Severity.Error;
return syncpromise_1.SyncPromise.resolve(this._buildEvent(event, hint));
}
// If none of previous checks were valid, then it means that
// it's not a DOMError/DOMException
// it's not a plain Object
// it's not a valid ErrorEvent (one with an error property)
// it's not an Error
// So bail out and capture it as a simple message:
var stringException = exception;
return this.eventFromMessage(stringException, undefined, hint).then(function (messageEvent) {
misc_1.addExceptionTypeValue(messageEvent, "" + stringException, undefined, {
handled: true,
synthetic: true,
type: 'generic',
});
messageEvent.level = types_1.Severity.Error;
return syncpromise_1.SyncPromise.resolve(_this._buildEvent(messageEvent, hint));
});
};
/**
* This is an internal helper function that creates an event.
*/
BrowserBackend.prototype._buildEvent = function (event, hint) {
return tslib_1.__assign({}, event, { event_id: hint && hint.event_id });
};
/**
* @inheritDoc
*/
BrowserBackend.prototype.eventFromMessage = function (message, level, hint) {
if (level === void 0) { level = types_1.Severity.Info; }
var event = {
event_id: hint && hint.event_id,
level: level,
message: message,
};
if (this._options.attachStacktrace && hint && hint.syntheticException) {
var stacktrace = tracekit_1.computeStackTrace(hint.syntheticException);
var frames_1 = parsers_1.prepareFramesForEvent(stacktrace.stack);
event.stacktrace = {
frames: frames_1,
};
}
return syncpromise_1.SyncPromise.resolve(event);
};
return BrowserBackend;
}(core_1.BaseBackend));
exports.BrowserBackend = BrowserBackend;
//# sourceMappingURL=backend.js.map
\ No newline at end of file
{"version":3,"file":"backend.js","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAC3C,uCAA+E;AAC/E,uCAAoG;AACpG,2CAA2D;AAC3D,mDAAuD;AACvD,yDAAwD;AAExD,qCAA6F;AAC7F,uCAA+C;AAC/C,2CAA4D;AAsB5D;;;GAGG;AACH;IAAoC,0CAA2B;IAA/D;;IAsHA,CAAC;IArHC;;OAEG;IACO,wCAAe,GAAzB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;YACtB,6DAA6D;YAC7D,OAAO,iBAAM,eAAe,WAAE,CAAC;SAChC;QAED,IAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB;YACrD,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB;YAChC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;QAE/B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;YAC3B,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;SACtD;QACD,IAAI,wBAAa,EAAE,EAAE;YACnB,OAAO,IAAI,2BAAc,CAAC,gBAAg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CAAC,KAAK,GAAG,gBAAQ,CAAC,KAAK,CAAC;YACpC,OAAO,yBAAW,CAAC,OAAO,CAAC,KAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACK,oCAAW,GAAnB,UAAoB,KAAY,EAAE,IAAgB;QAChD,4BACK,KAAK,IACR,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,QAAQ,IAC/B;IACJ,CAAC;IAED;;OAEG;IACI,yCAAgB,GAAvB,UAAwB,OAAe,EAAE,KAA+B,EAAE,IAAgB;QAAjD,sBAAA,EAAA,QAAkB,gBAAQ,CAAC,IAAI;QACtE,IAAM,KAAK,GAAU;YACnB,QAAQ,EAAE,IAAI,IAAI,IAAI,CAAC,QAAQ;YAC/B,KAAK,OAAA;YACL,OAAO,SAAA;SACR,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,CAAC,gBAAgB,IAAI,IAAI,IAAI,IAAI,CAAC,kBAAkB,EAAE;YACrE,IAAM,UAAU,GAAG,4BAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC9D,IAAM,QAAM,GAAG,+BAAqB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACvD,KAAK,CAAC,UAAU,GAAG;gBACjB,MAAM,UAAA;aACP,CAAC;SACH;QAED,OAAO,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IACH,qBAAC;AAAD,CAAC,AAtHD,CAAoC,kBAAW,GAsH9C;AAtHY,wCAAc","sourcesContent":["import { BaseBackend } from '@sentry/core';\nimport { Event, EventHint, Options, Severity, Transport } from '@sentry/types';\nimport { isDOMError, isDOMException, isError, isErrorEvent, isPlainObject } from '@sentry/utils/is';\nimport { addExceptionTypeValue } from '@sentry/utils/misc';\nimport { supportsFetch } from '@sentry/utils/supports';\nimport { SyncPromise } from '@sentry/utils/syncpromise';\n\nimport { eventFromPlainObject, eventFromStacktrace, prepareFramesForEvent } from './parsers';\nimport { computeStackTrace } from './tracekit';\nimport { FetchTransport, XHRTransport } from './transports';\n\n/**\n * Configuration options for the Sentry Browser SDK.\n * @see BrowserClient for more information.\n */\nexport interface BrowserOptions extends Options {\n /**\n * A pattern for error URLs which should not be sent to Sentry.\n * To whitelist certain errors instead, use {@link Options.whitelistUrls}.\n * By default, all errors will be sent.\n */\n blacklistUrls?: Array<string | RegExp>;\n\n /**\n * A pattern for error URLs which should exclusively be sent to Sentry.\n * This is the opposite of {@link Options.blacklistUrls}.\n * By default, all errors will be sent.\n */\n whitelistUrls?: Array<string | RegExp>;\n}\n\n/**\n * The Sentry Browser SDK Backend.\n * @hidden\n */\nexport class BrowserBackend extends BaseBackend<BrowserOptions> {\n /**\n * @inheritDoc\n */\n protected _setupTransport(): Transport {\n if (!this._options.dsn) {\n // We return the noop transport here in case there is no Dsn.\n return super._setupTransport();\n }\n\n const transportOptions = this._options.transportOptions\n ? this._options.transportOptions\n : { dsn: this._options.dsn };\n\n if (this._options.transport) {\n return new this._options.transport(transportOptions);\n }\n if (supportsFetch()) {\n return new FetchTransport(transportOptions);\n }\n return new XHRTransport(transportOptions);\n }\n\n /**\n * @inheritDoc\n */\n public eventFromException(exception: any, hint?: EventHint): SyncPromise<Event> {\n let event: Event;\n\n if (isErrorEvent(exception as ErrorEvent) && (exception as ErrorEvent).error) {\n // If it is an ErrorEvent with `error` property, extract it to get actual Error\n const errorEvent = exception as ErrorEvent;\n exception = errorEvent.error; // tslint:disable-line:no-parameter-reassignment\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return SyncPromise.resolve(this._buildEvent(event, hint));\n }\n if (isDOMError(exception as DOMError) || isDOMException(exception as DOMException)) {\n // If it is a DOMError or DOMException (which are legacy APIs, but still supported in some browsers)\n // then we just extract the name and message, as they don't provide anything else\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMError\n // https://developer.mozilla.org/en-US/docs/Web/API/DOMException\n const domException = exception as DOMException;\n const name = domException.name || (isDOMError(domException) ? 'DOMError' : 'DOMException');\n const message = domException.message ? `${name}: ${domException.message}` : name;\n\n return this.eventFromMessage(message, Severity.Error, hint).then(messageEvent => {\n addExceptionTypeValue(messageEvent, message);\n return SyncPromise.resolve(this._buildEvent(messageEvent, hint));\n });\n }\n if (isError(exception as Error)) {\n // we have a real Error object, do nothing\n event = eventFromStacktrace(computeStackTrace(exception as Error));\n return SyncPromise.resolve(this._buildEvent(event, hint));\n }\n if (isPlainObject(exception as {}) && hint && hint.syntheticException) {\n // If it is plain Object, serialize it manually and extract options\n // This will allow us to group events based on top-level keys\n // which is much better than creating new group when any key/value change\n const objectException = exception as {};\n event = eventFromPlainObject(objectException, hint.syntheticException);\n addExceptionTypeValue(event, 'Custom Object', undefined, {\n handled: true,\n synthetic: true,\n type: 'generic',\n });\n event.level = Severity.Error;\n return SyncPromise.resolve(this._buildEvent(event, hint));\n }\n\n // If none of previous checks were valid, then it means that\n // it's not a DOMError/DOMException\n // it's not a plain Object\n // it's not a valid ErrorEvent (one with an error property)\n // it's not an Error\n // So bail out and capture it as a simple message:\n const stringException = exception as string;\n return this.eventFromMessage(stringException, undefined, hint).then(messageEvent => {\n addExceptionTypeValue(messageEvent, `${stringException}`, undefined, {\n handled: true,\n synthetic: true,\n type: 'generic',\n });\n messageEvent.level = Severity.Error;\n return SyncPromise.resolve(this._buildEvent(messageEvent, hint));\n });\n }\n\n /**\n * This is an internal helper function that creates an event.\n */\n private _buildEvent(event: Event, hint?: EventHint): Event {\n return {\n ...event,\n event_id: hint && hint.event_id,\n };\n }\n\n /**\n * @inheritDoc\n */\n public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): SyncPromise<Event> {\n const event: Event = {\n event_id: hint && hint.event_id,\n level,\n message,\n };\n\n if (this._options.attachStacktrace && hint && hint.syntheticException) {\n const stacktrace = computeStackTrace(hint.syntheticException);\n const frames = prepareFramesForEvent(stacktrace.stack);\n event.stacktrace = {\n frames,\n };\n }\n\n return SyncPromise.resolve(event);\n }\n}\n"]}
\ No newline at end of file
import { BaseClient, Scope } from '@sentry/core';
import { DsnLike, Event, EventHint } from '@sentry/types';
import { SyncPromise } from '@sentry/utils/syncpromise';
import { BrowserBackend, BrowserOptions } from './backend';
/**
* All properties the report dialog supports
*/
export interface ReportDialogOptions {
[key: string]: any;
eventId?: string;
dsn?: DsnLike;
user?: {
email?: string;
name?: string;
};
lang?: string;
title?: string;
subtitle?: string;
subtitle2?: string;
labelName?: string;
labelEmail?: string;
labelComments?: string;
labelClose?: string;
labelSubmit?: string;
errorGeneric?: string;
errorFormEntry?: string;
successMessage?: string;
}
/**
* The Sentry Browser SDK Client.
*
* @see BrowserOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
export declare class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {
/**
* Creates a new Browser SDK instance.
*
* @param options Configuration options for this SDK.
*/
constructor(options?: BrowserOptions);
/**
* @inheritDoc
*/
protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): SyncPromise<Event | null>;
/**
* Show a report dialog to the user to send feedback to a specific event.
*
* @param options Set individual options for the dialog
*/
showReportDialog(options?: ReportDialogOptions): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var core_1 = require("@sentry/core");
var logger_1 = require("@sentry/utils/logger");
var misc_1 = require("@sentry/utils/misc");
var backend_1 = require("./backend");
var version_1 = require("./version");
/**
* The Sentry Browser SDK Client.
*
* @see BrowserOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
var BrowserClient = /** @class */ (function (_super) {
tslib_1.__extends(BrowserClient, _super);
/**
* Creates a new Browser SDK instance.
*
* @param options Configuration options for this SDK.
*/
function BrowserClient(options) {
if (options === void 0) { options = {}; }
return _super.call(this, backend_1.BrowserBackend, options) || this;
}
/**
* @inheritDoc
*/
BrowserClient.prototype._prepareEvent = function (event, scope, hint) {
event.platform = event.platform || 'javascript';
event.sdk = tslib_1.__assign({}, event.sdk, { name: version_1.SDK_NAME, packages: tslib_1.__spread(((event.sdk && event.sdk.packages) || []), [
{
name: 'npm:@sentry/browser',
version: version_1.SDK_VERSION,
},
]), version: version_1.SDK_VERSION });
return _super.prototype._prepareEvent.call(this, event, scope, hint);
};
/**
* Show a report dialog to the user to send feedback to a specific event.
*
* @param options Set individual options for the dialog
*/
BrowserClient.prototype.showReportDialog = function (options) {
if (options === void 0) { options = {}; }
// doesn't work without a document (React Native)
var document = misc_1.getGlobalObject().document;
if (!document) {
return;
}
if (!this._isEnabled()) {
logger_1.logger.error('Trying to call showReportDialog with Sentry Client is disabled');
return;
}
var dsn = options.dsn || this.getDsn();
if (!options.eventId) {
logger_1.logger.error('Missing `eventId` option in showReportDialog call');
return;
}
if (!dsn) {
logger_1.logger.error('Missing `Dsn` option in showReportDialog call');
return;
}
var script = document.createElement('script');
script.async = true;
script.src = new core_1.API(dsn).getReportDialogEndpoint(options);
(document.head || document.body).appendChild(script);
};
return BrowserClient;
}(core_1.BaseClient));
exports.BrowserClient = BrowserClient;
//# sourceMappingURL=client.js.map
\ No newline at end of file
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AAEtD,+CAA8C;AAC9C,2CAAqD;AAGrD,qCAA2D;AAC3D,qCAAkD;AA2BlD;;;;;GAKG;AACH;IAAmC,yCAA0C;IAC3E;;;;OAIG;IACH,uBAAmB,OAA4B;QAA5B,wBAAA,EAAA,YAA4B;eAC7C,kBAAM,wBAAc,EAAE,OAAO,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,qCAAa,GAAvB,UAAwB,KAAY,EAAE,KAAa,EAAE,IAAgB;QACnE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,YAAY,CAAC;QAChD,KAAK,CAAC,GAAG,wBACJ,KAAK,CAAC,GAAG,IACZ,IAAI,EAAE,kBAAQ,EACd,QAAQ,mBACH,CAAC,CAAC,KAAK,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5C;AAjEY,sCAAa","sourcesContent":["import { API, BaseClient, Scope } from '@sentry/core';\nimport { DsnLike, Event, EventHint } from '@sentry/types';\nimport { logger } from '@sentry/utils/logger';\nimport { getGlobalObject } from '@sentry/utils/misc';\nimport { SyncPromise } from '@sentry/utils/syncpromise';\n\nimport { BrowserBackend, BrowserOptions } from './backend';\nimport { SDK_NAME, SDK_VERSION } from './version';\n\n/**\n * All properties the report dialog supports\n */\nexport interface ReportDialogOptions {\n [key: string]: any;\n eventId?: string;\n dsn?: DsnLike;\n user?: {\n email?: string;\n name?: string;\n };\n lang?: string;\n title?: string;\n subtitle?: string;\n subtitle2?: string;\n labelName?: string;\n labelEmail?: string;\n labelComments?: string;\n labelClose?: string;\n labelSubmit?: string;\n errorGeneric?: string;\n errorFormEntry?: string;\n successMessage?: string;\n}\n\n/**\n * The Sentry Browser SDK Client.\n *\n * @see BrowserOptions for documentation on configuration options.\n * @see SentryClient for usage documentation.\n */\nexport class BrowserClient extends BaseClient<BrowserBackend, BrowserOptions> {\n /**\n * Creates a new Browser SDK instance.\n *\n * @param options Configuration options for this SDK.\n */\n public constructor(options: BrowserOptions = {}) {\n super(BrowserBackend, options);\n }\n\n /**\n * @inheritDoc\n */\n protected _prepareEvent(event: Event, scope?: Scope, hint?: EventHint): SyncPromise<Event | null> {\n event.platform = event.platform || 'javascript';\n event.sdk = {\n ...event.sdk,\n name: SDK_NAME,\n packages: [\n ...((event.sdk && event.sdk.packages) || []),\n {\n name: 'npm:@sentry/browser',\n version: SDK_VERSION,\n },\n ],\n version: SDK_VERSION,\n };\n\n return super._prepareEvent(event, scope, hint);\n }\n\n /**\n * Show a report dialog to the user to send feedback to a specific event.\n *\n * @param options Set individual options for the dialog\n */\n public showReportDialog(options: ReportDialogOptions = {}): void {\n // doesn't work without a document (React Native)\n const document = getGlobalObject<Window>().document;\n if (!document) {\n return;\n }\n\n if (!this._isEnabled()) {\n logger.error('Trying to call showReportDialog with Sentry Client is disabled');\n return;\n }\n\n const dsn = options.dsn || this.getDsn();\n\n if (!options.eventId) {\n logger.error('Missing `eventId` option in showReportDialog call');\n return;\n }\n\n if (!dsn) {\n logger.error('Missing `Dsn` option in showReportDialog call');\n return;\n }\n\n const script = document.createElement('script');\n script.async = true;\n script.src = new API(dsn).getReportDialogEndpoint(options);\n (document.head || document.body).appendChild(script);\n }\n}\n"]}
\ No newline at end of file
export { Breadcrumb, Request, SdkInfo, Event, Exception, Response, Severity, StackFrame, Stacktrace, Status, Thread, User, } from '@sentry/types';
export { addGlobalEventProcessor, addBreadcrumb, captureException, captureEvent, captureMessage, configureScope, withScope, getHubFromCarrier, getCurrentHub, Hub, Scope, } from '@sentry/core';
export { BrowserOptions } from './backend';
export { BrowserClient, ReportDialogOptions } from './client';
export { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close } from './sdk';
export { SDK_NAME, SDK_VERSION } from './version';
import { Integrations as CoreIntegrations } from '@sentry/core';
import * as BrowserIntegrations from './integrations';
import * as Transports from './transports';
declare const INTEGRATIONS: {
GlobalHandlers: typeof BrowserIntegrations.GlobalHandlers;
TryCatch: typeof BrowserIntegrations.TryCatch;
Breadcrumbs: typeof BrowserIntegrations.Breadcrumbs;
LinkedErrors: typeof BrowserIntegrations.LinkedErrors;
UserAgent: typeof BrowserIntegrations.UserAgent;
FunctionToString: typeof CoreIntegrations.FunctionToString;
InboundFilters: typeof CoreIntegrations.InboundFilters;
};
export { INTEGRATIONS as Integrations, Transports };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var types_1 = require("@sentry/types");
exports.Severity = types_1.Severity;
exports.Status = types_1.Status;
var core_1 = require("@sentry/core");
exports.addGlobalEventProcessor = core_1.addGlobalEventProcessor;
exports.addBreadcrumb = core_1.addBreadcrumb;
exports.captureException = core_1.captureException;
exports.captureEvent = core_1.captureEvent;
exports.captureMessage = core_1.captureMessage;
exports.configureScope = core_1.configureScope;
exports.withScope = core_1.withScope;
exports.getHubFromCarrier = core_1.getHubFromCarrier;
exports.getCurrentHub = core_1.getCurrentHub;
exports.Hub = core_1.Hub;
exports.Scope = core_1.Scope;
var client_1 = require("./client");
exports.BrowserClient = client_1.BrowserClient;
var sdk_1 = require("./sdk");
exports.defaultIntegrations = sdk_1.defaultIntegrations;
exports.forceLoad = sdk_1.forceLoad;
exports.init = sdk_1.init;
exports.lastEventId = sdk_1.lastEventId;
exports.onLoad = sdk_1.onLoad;
exports.showReportDialog = sdk_1.showReportDialog;
exports.flush = sdk_1.flush;
exports.close = sdk_1.close;
var version_1 = require("./version");
exports.SDK_NAME = version_1.SDK_NAME;
exports.SDK_VERSION = version_1.SDK_VERSION;
var core_2 = require("@sentry/core");
var misc_1 = require("@sentry/utils/misc");
var BrowserIntegrations = require("./integrations");
var Transports = require("./transports");
exports.Transports = Transports;
var windowIntegrations = {};
// tslint:disable: no-unsafe-any
var _window = misc_1.getGlobalObject();
if (_window.Sentry && _window.Sentry.Integrations) {
windowIntegrations = _window.Sentry.Integrations;
}
// tslint:enable: no-unsafe-any
var INTEGRATIONS = tslib_1.__assign({}, windowIntegrations, core_2.Integrations, BrowserIntegrations);
exports.Integrations = INTEGRATIONS;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uCAauB;AANrB,2BAAA,QAAQ,CAAA;AAGR,yBAAA,MAAM,CAAA;AAKR,qCAYsB;AAXpB,yCAAA,uBAAuB,CAAA;AACvB,+BAAA,aAAa,CAAA;AACb,kCAAA,gBAAgB,CAAA;AAChB,8BAAA,YAAY,CAAA;AACZ,gCAAA,cAAc,CAAA;AACd,gCAAA,cAAc,CAAA;AACd,2BAAA,SAAS,CAAA;AACT,mCAAA,iBAAiB,CAAA;AACjB,+BAAA,aAAa,CAAA;AACb,qBAAA,GAAG,CAAA;AACH,uBAAA,KAAK,CAAA;AAIP,mCAA8D;AAArD,iCAAA,aAAa,CAAA;AACtB,6BAAkH;AAAzG,oCAAA,mBAAmB,CAAA;AAAE,0BAAA,SAAS,CAAA;AAAE,qBAAA,IAAI,CAAA;AAAE,4BAAA,WAAW,CAAA;AAAE,uBAAA,MAAM,CAAA;AAAE,iCAAA,gBAAgB,CAAA;AAAE,sBAAA,KAAK,CAAA;AAAE,sBAAA,KAAK,CAAA;AAClG,qCAAkD;AAAzC,6BAAA,QAAQ,CAAA;AAAE,gCAAA,WAAW,CAAA;AAE9B,qCAAgE;AAChE,2CAAqD;AAErD,oDAAsD;AACtD,yCAA2C;AAiBJ,gCAAU;AAfjD,IAAI,kBAAkB,GAAG,EAAE,CAAC;AAE5B,gCAAgC;AAChC,IAAM,OAAO,GAAG,sBAAe,EAAiB,CAAC;AACjD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;IACjD,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC;CAClD;AACD,+BAA+B;AAE/B,IAAM,YAAY,wBACb,kBAAkB,EAClB,mBAAgB,EAChB,mBAAmB,CACvB,CAAC;AAEuB,oCAAY","sourcesContent":["export {\n Breadcrumb,\n Request,\n SdkInfo,\n Event,\n Exception,\n Response,\n Severity,\n StackFrame,\n Stacktrace,\n Status,\n Thread,\n User,\n} from '@sentry/types';\n\nexport {\n addGlobalEventProcessor,\n addBreadcrumb,\n captureException,\n captureEvent,\n captureMessage,\n configureScope,\n withScope,\n getHubFromCarrier,\n getCurrentHub,\n Hub,\n Scope,\n} from '@sentry/core';\n\nexport { BrowserOptions } from './backend';\nexport { BrowserClient, ReportDialogOptions } from './client';\nexport { defaultIntegrations, forceLoad, init, lastEventId, onLoad, showReportDialog, flush, close } from './sdk';\nexport { SDK_NAME, SDK_VERSION } from './version';\n\nimport { Integrations as CoreIntegrations } from '@sentry/core';\nimport { getGlobalObject } from '@sentry/utils/misc';\n\nimport * as BrowserIntegrations from './integrations';\nimport * as Transports from './transports';\n\nlet windowIntegrations = {};\n\n// tslint:disable: no-unsafe-any\nconst _window = getGlobalObject<Window>() as any;\nif (_window.Sentry && _window.Sentry.Integrations) {\n windowIntegrations = _window.Sentry.Integrations;\n}\n// tslint:enable: no-unsafe-any\n\nconst INTEGRATIONS = {\n ...windowIntegrations,\n ...CoreIntegrations,\n ...BrowserIntegrations,\n};\n\nexport { INTEGRATIONS as Integrations, Transports };\n"]}
\ No newline at end of file
import { Breadcrumb, BreadcrumbHint, Integration } from '@sentry/types';
/**
* @hidden
*/
export interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
[key: string]: any;
__sentry_xhr__?: {
method?: string;
url?: string;
status_code?: number;
};
}
/** JSDoc */
interface BreadcrumbIntegrations {
console?: boolean;
dom?: boolean;
fetch?: boolean;
history?: boolean;
sentry?: boolean;
xhr?: boolean;
}
/** Default Breadcrumbs instrumentations */
export declare class Breadcrumbs implements Integration {
/**
* @inheritDoc
*/
name: string;
/**
* @inheritDoc
*/
static id: string;
/** JSDoc */
private readonly _options;
/**
* @inheritDoc
*/
constructor(options?: BreadcrumbIntegrations);
/** JSDoc */
private _instrumentConsole;
/** JSDoc */
private _instrumentDOM;
/** JSDoc */
private _instrumentFetch;
/** JSDoc */
private _instrumentHistory;
/** JSDoc */
private _instrumentXHR;
/**
* Helper that checks if integration is enabled on the client.