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