{"size": 862, "ext": "js", "max_stars_repo_path": "lib/index.js", "max_stars_repo_name": "segment-integrations/analytics.js-integration-bugherd", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/index.js", "max_issues_repo_name": "segment-integrations/analytics.js-integration-bugherd", "max_issues_repo_issues_event_min_datetime": "2017-04-05T17:26:51.000Z", "max_issues_repo_issues_event_max_datetime": "2017-04-10T18:10:36.000Z", "max_forks_repo_path": "lib/index.js", "max_forks_repo_name": "segment-integrations/analytics.js-integration-bugherd", "max_forks_repo_forks_event_min_datetime": "2016-09-20T21:49:06.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-15T10:03:35.000Z"}
{"max_stars_count": null, "max_issues_count": 2, "max_forks_count": 3, "avg_line_length": 17.9583333333, "max_line_length": 79, "alphanum_fraction": 0.6415313225}
'use strict';

/**
 * Module dependencies.
 */

var integration = require('@segment/analytics.js-integration');
var tick = require('next-tick');

/**
 * Expose `BugHerd` integration.
 */

var BugHerd = module.exports = integration('BugHerd')
  .assumesPageview()
  .global('BugHerdConfig')
  .global('_bugHerd')
  .option('apiKey', '')
  .option('showFeedbackTab', true)
  .tag('<script src="//www.bugherd.com/sidebarv2.js?apikey={{ apiKey }}">');

/**
 * Initialize.
 *
 * http://support.bugherd.com/home
 *
 * @api public
 */

BugHerd.prototype.initialize = function() {
  window.BugHerdConfig = { feedback: { hide: !this.options.showFeedbackTab } };
  var ready = this.ready;
  this.load(function() {
    tick(ready);
  });
};

/**
 * Loaded?
 *
 * @api private
 * @return {boolean}
 */

BugHerd.prototype.loaded = function() {
  return !!window._bugHerd;
};
