@honeybadger-io/js 6.10.0 → 6.10.1

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.
@@ -1162,7 +1162,7 @@
1162
1162
  this.__notifier = {
1163
1163
  name: '@honeybadger-io/core',
1164
1164
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
1165
- version: '6.10.0'
1165
+ version: '6.10.1'
1166
1166
  };
1167
1167
  this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
1168
1168
  this.__initStore();
@@ -2366,8 +2366,34 @@
2366
2366
  this.scriptUrl = scriptUrl;
2367
2367
  }
2368
2368
  /* ROLLUP_STRIP_CODE_CHROME_EXTENSION_START */
2369
+ BrowserFeedbackForm.prototype.appendUserFeedbackTag = function (window, options) {
2370
+ if (options === void 0) { options = {}; }
2371
+ var script = window.document.createElement('script');
2372
+ script.setAttribute('src', this.scriptUrl);
2373
+ script.setAttribute('async', 'true');
2374
+ if (options.onLoad) {
2375
+ script.onload = options.onLoad;
2376
+ }
2377
+ (commonjsGlobal.document.head || commonjsGlobal.document.body).appendChild(script);
2378
+ };
2379
+ BrowserFeedbackForm.prototype.isUserFeedbackUrlAlreadyVisible = function () {
2380
+ var global = globalThisOrWindow();
2381
+ var feedbackScriptUrl = this.scriptUrl;
2382
+ for (var i = 0; i < global.document.scripts.length; i++) {
2383
+ var script = global.document.scripts[i];
2384
+ if (script.src === feedbackScriptUrl) {
2385
+ return true;
2386
+ }
2387
+ }
2388
+ return false;
2389
+ };
2390
+ /* ROLLUP_STRIP_CODE_CHROME_EXTENSION_END */
2369
2391
  BrowserFeedbackForm.prototype.show = function (lastNoticeId, options) {
2370
2392
  if (options === void 0) { options = {}; }
2393
+ if (typeof (this.appendUserFeedbackTag) !== 'function') {
2394
+ this.logger.debug('Feedback form is not available in this environment');
2395
+ return;
2396
+ }
2371
2397
  if (!this.config || !this.config.apiKey) {
2372
2398
  this.logger.debug('Client not initialized');
2373
2399
  return;
@@ -2381,33 +2407,12 @@
2381
2407
  this.logger.debug('global.document is undefined. Cannot attach script');
2382
2408
  return;
2383
2409
  }
2384
- if (this.isUserFeedbackScriptUrlAlreadyVisible()) {
2410
+ if (this.isUserFeedbackUrlAlreadyVisible()) {
2385
2411
  this.logger.debug('User feedback form is already visible');
2386
2412
  return;
2387
2413
  }
2388
2414
  global['honeybadgerUserFeedbackOptions'] = __assign(__assign({}, options), { apiKey: this.config.apiKey, endpoint: this.config.userFeedbackEndpoint, noticeId: lastNoticeId });
2389
- this.appendUserFeedbackScriptTag(global, options);
2390
- };
2391
- BrowserFeedbackForm.prototype.appendUserFeedbackScriptTag = function (window, options) {
2392
- if (options === void 0) { options = {}; }
2393
- var script = window.document.createElement('script');
2394
- script.setAttribute('src', this.scriptUrl);
2395
- script.setAttribute('async', 'true');
2396
- if (options.onLoad) {
2397
- script.onload = options.onLoad;
2398
- }
2399
- (commonjsGlobal.document.head || commonjsGlobal.document.body).appendChild(script);
2400
- };
2401
- BrowserFeedbackForm.prototype.isUserFeedbackScriptUrlAlreadyVisible = function () {
2402
- var global = globalThisOrWindow();
2403
- var feedbackScriptUrl = this.scriptUrl;
2404
- for (var i = 0; i < global.document.scripts.length; i++) {
2405
- var script = global.document.scripts[i];
2406
- if (script.src === feedbackScriptUrl) {
2407
- return true;
2408
- }
2409
- }
2410
- return false;
2415
+ this.appendUserFeedbackTag(global, options);
2411
2416
  };
2412
2417
  return BrowserFeedbackForm;
2413
2418
  }());
@@ -2671,7 +2676,7 @@
2671
2676
  var NOTIFIER = {
2672
2677
  name: '@honeybadger-io/js',
2673
2678
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
2674
- version: '6.10.0'
2679
+ version: '6.10.1'
2675
2680
  };
2676
2681
  var userAgent = function () {
2677
2682
  if (typeof navigator !== 'undefined') {