1 | import { __assign, __extends } from "tslib";
|
2 | import { BaseClient, SDK_VERSION } from '@sentry/core';
|
3 | import { getGlobalObject, logger } from '@sentry/utils';
|
4 | import { BrowserBackend } from './backend';
|
5 | import { injectReportDialog } from './helpers';
|
6 | import { Breadcrumbs } from './integrations';
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var BrowserClient = (function (_super) {
|
14 | __extends(BrowserClient, _super);
|
15 | |
16 |
|
17 |
|
18 |
|
19 |
|
20 | function BrowserClient(options) {
|
21 | if (options === void 0) { options = {}; }
|
22 | var _this = this;
|
23 | options._metadata = options._metadata || {};
|
24 | options._metadata.sdk = options._metadata.sdk || {
|
25 | name: 'sentry.javascript.browser',
|
26 | packages: [
|
27 | {
|
28 | name: 'npm:@sentry/browser',
|
29 | version: SDK_VERSION,
|
30 | },
|
31 | ],
|
32 | version: SDK_VERSION,
|
33 | };
|
34 | _this = _super.call(this, BrowserBackend, options) || this;
|
35 | return _this;
|
36 | }
|
37 | |
38 |
|
39 |
|
40 |
|
41 |
|
42 | BrowserClient.prototype.showReportDialog = function (options) {
|
43 | if (options === void 0) { options = {}; }
|
44 |
|
45 | var document = getGlobalObject().document;
|
46 | if (!document) {
|
47 | return;
|
48 | }
|
49 | if (!this._isEnabled()) {
|
50 | logger.error('Trying to call showReportDialog with Sentry Client disabled');
|
51 | return;
|
52 | }
|
53 | injectReportDialog(__assign(__assign({}, options), { dsn: options.dsn || this.getDsn() }));
|
54 | };
|
55 | |
56 |
|
57 |
|
58 | BrowserClient.prototype._prepareEvent = function (event, scope, hint) {
|
59 | event.platform = event.platform || 'javascript';
|
60 | return _super.prototype._prepareEvent.call(this, event, scope, hint);
|
61 | };
|
62 | |
63 |
|
64 |
|
65 | BrowserClient.prototype._sendEvent = function (event) {
|
66 | var integration = this.getIntegration(Breadcrumbs);
|
67 | if (integration) {
|
68 | integration.addSentryBreadcrumb(event);
|
69 | }
|
70 | _super.prototype._sendEvent.call(this, event);
|
71 | };
|
72 | return BrowserClient;
|
73 | }(BaseClient));
|
74 | export { BrowserClient };
|
75 |
|
\ | No newline at end of file |