-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathclient.js
69 lines (69 loc) · 2.5 KB
/
client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { __assign, __extends, __read, __spread } from "tslib";
import { BaseClient } from '@sentry/core';
import { getGlobalObject, logger } from '@sentry/utils';
import { BrowserBackend } from './backend';
import { injectReportDialog } from './helpers';
import { Breadcrumbs } from './integrations';
import { SDK_NAME, SDK_VERSION } from './version';
/**
* The Sentry Browser SDK Client.
*
* @see BrowserOptions for documentation on configuration options.
* @see SentryClient for usage documentation.
*/
var BrowserClient = /** @class */ (function (_super) {
__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, BrowserBackend, options) || this;
}
/**
* 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 = getGlobalObject().document;
if (!document) {
return;
}
if (!this._isEnabled()) {
logger.error('Trying to call showReportDialog with Sentry Client disabled');
return;
}
injectReportDialog(__assign(__assign({}, options), { dsn: options.dsn || this.getDsn() }));
};
/**
* @inheritDoc
*/
BrowserClient.prototype._prepareEvent = function (event, scope, hint) {
event.platform = event.platform || 'javascript';
event.sdk = __assign(__assign({}, event.sdk), { name: SDK_NAME, packages: __spread(((event.sdk && event.sdk.packages) || []), [
{
name: 'npm:@sentry/browser',
version: SDK_VERSION,
},
]), version: SDK_VERSION });
return _super.prototype._prepareEvent.call(this, event, scope, hint);
};
/**
* @inheritDoc
*/
BrowserClient.prototype._sendEvent = function (event) {
var integration = this.getIntegration(Breadcrumbs);
if (integration) {
integration.addSentryBreadcrumb(event);
}
_super.prototype._sendEvent.call(this, event);
};
return BrowserClient;
}(BaseClient));
export { BrowserClient };
//# sourceMappingURL=client.js.map