Version Description
(2019.05.07) = - Implement faster navigation - Fix signup url - Use i18n on PHP
Download this release
Release Info
Developer | leadin |
Plugin | HubSpot – Free Marketing Plugin for WordPress |
Version | 7.4.1 |
Comparing to | |
See all releases |
Code changes from version 7.4.0 to 7.4.1
- admin/leadin-admin.php +23 -8
- changelog.txt +5 -0
- inc/leadin-functions.php +17 -1
- leadin.php +5 -2
- package.json +0 -28
- readme.txt +9 -4
- scripts/leadin.js +114 -11
- scripts/raven.min.js +3 -0
admin/leadin-admin.php
CHANGED
@@ -20,7 +20,7 @@ function action_required_notice(){
|
|
20 |
$current_screen = get_current_screen();
|
21 |
if ( $current_screen->parent_base !== 'leadin' ) {
|
22 |
$leadin_icon = LEADIN_PATH . '/images/sprocket.svg';
|
23 |
-
echo '<div class="notice notice-warning is-dismissible"><p><img src="' . $leadin_icon . '" height="16" style="margin-bottom: -3px" /> The HubSpot plugin isn’t connected right now. To use HubSpot tools on your WordPress site, <a href="admin.php?page=leadin">connect the plugin now</a
|
24 |
}
|
25 |
}
|
26 |
|
@@ -129,12 +129,12 @@ class WPLeadInAdmin {
|
|
129 |
add_action('admin_notices', 'action_required_notice');
|
130 |
}
|
131 |
|
132 |
-
add_menu_page( 'HubSpot', 'HubSpot'.$notificationIcon, $capability, 'leadin', array( $this, 'leadin_build_app' ), 'dashicons-sprocket', '25.100713' );
|
133 |
|
134 |
$portal_id = get_option('leadin_portalId');
|
135 |
if ( !empty( $portal_id ) ) {
|
136 |
-
add_submenu_page('leadin', 'Forms', 'Forms', 'activate_plugins', 'leadin_forms', array($this, 'leadin_build_app'));
|
137 |
-
add_submenu_page('leadin', 'Settings', 'Settings', 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app'));
|
138 |
remove_submenu_page('leadin','leadin');
|
139 |
}
|
140 |
}
|
@@ -156,7 +156,7 @@ class WPLeadInAdmin {
|
|
156 |
$page = "leadin";
|
157 |
}
|
158 |
$url = get_admin_url( get_current_blog_id(), "admin.php?page=$page" );
|
159 |
-
$settings_link = '<a href="' . $url . '">Settings</a>';
|
160 |
array_unshift( $links, $settings_link );
|
161 |
return $links;
|
162 |
}
|
@@ -172,9 +172,18 @@ class WPLeadInAdmin {
|
|
172 |
$error_message = "";
|
173 |
|
174 |
if ( version_compare( phpversion(), LEADIN_REQUIRED_PHP_VERSION, '<' ) ) {
|
175 |
-
$error_message =
|
|
|
|
|
|
|
|
|
|
|
176 |
} else if ( version_compare( $wp_version, LEADIN_REQUIRED_WP_VERSION, '<' ) ) {
|
177 |
-
$error_message =
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
if ($error_message) {
|
@@ -236,9 +245,15 @@ class WPLeadInAdmin {
|
|
236 |
'wpUserEmail' => $wpUser->user_email,
|
237 |
);
|
238 |
|
|
|
|
|
|
|
|
|
|
|
239 |
wp_register_style( 'leadin-bridge-css', LEADIN_PATH.'/style/leadin-bridge.css' );
|
240 |
-
wp_register_script( 'leadin-js', LEADIN_PATH.'/scripts/leadin.js', array( 'underscore' ), false, true );
|
241 |
wp_localize_script( 'leadin-js', 'leadin_config', $leadin_config );
|
|
|
242 |
wp_enqueue_script( 'leadin-js' );
|
243 |
}
|
244 |
|
20 |
$current_screen = get_current_screen();
|
21 |
if ( $current_screen->parent_base !== 'leadin' ) {
|
22 |
$leadin_icon = LEADIN_PATH . '/images/sprocket.svg';
|
23 |
+
echo '<div class="notice notice-warning is-dismissible"><p><img src="' . $leadin_icon . '" height="16" style="margin-bottom: -3px" /> ' . __('The HubSpot plugin isn’t connected right now. To use HubSpot tools on your WordPress site, <a href="admin.php?page=leadin">connect the plugin now</a>.', 'leadin') . '</p></div>';
|
24 |
}
|
25 |
}
|
26 |
|
129 |
add_action('admin_notices', 'action_required_notice');
|
130 |
}
|
131 |
|
132 |
+
add_menu_page( __('HubSpot', 'leadin'), __('HubSpot', 'leadin').$notificationIcon, $capability, 'leadin', array( $this, 'leadin_build_app' ), 'dashicons-sprocket', '25.100713' );
|
133 |
|
134 |
$portal_id = get_option('leadin_portalId');
|
135 |
if ( !empty( $portal_id ) ) {
|
136 |
+
add_submenu_page('leadin', __('Forms', 'leadin'), __('Forms', 'leadin'), 'activate_plugins', 'leadin_forms', array($this, 'leadin_build_app'));
|
137 |
+
add_submenu_page('leadin', __('Settings', 'leadin'), __('Settings', 'leadin'), 'activate_plugins', 'leadin_settings', array($this, 'leadin_build_app'));
|
138 |
remove_submenu_page('leadin','leadin');
|
139 |
}
|
140 |
}
|
156 |
$page = "leadin";
|
157 |
}
|
158 |
$url = get_admin_url( get_current_blog_id(), "admin.php?page=$page" );
|
159 |
+
$settings_link = '<a href="' . $url . '">' . __( 'Settings', 'leadin' ) . '</a>';
|
160 |
array_unshift( $links, $settings_link );
|
161 |
return $links;
|
162 |
}
|
172 |
$error_message = "";
|
173 |
|
174 |
if ( version_compare( phpversion(), LEADIN_REQUIRED_PHP_VERSION, '<' ) ) {
|
175 |
+
$error_message = sprintf(
|
176 |
+
__( 'HubSpot All-In-One Marketing %1$s requires PHP %2$s or higher. Please upgrade WordPress first.', 'leadin' ),
|
177 |
+
LEADIN_PLUGIN_VERSION,
|
178 |
+
LEADIN_REQUIRED_PHP_VERSION
|
179 |
+
);
|
180 |
+
|
181 |
} else if ( version_compare( $wp_version, LEADIN_REQUIRED_WP_VERSION, '<' ) ) {
|
182 |
+
$error_message = sprintf(
|
183 |
+
__( 'HubSpot All-In-One Marketing %1$s requires PHP %2$s or higher. Please upgrade WordPress first.', 'leadin' ),
|
184 |
+
LEADIN_PLUGIN_VERSION,
|
185 |
+
LEADIN_REQUIRED_WP_VERSION
|
186 |
+
);
|
187 |
}
|
188 |
|
189 |
if ($error_message) {
|
245 |
'wpUserEmail' => $wpUser->user_email,
|
246 |
);
|
247 |
|
248 |
+
$leadin_i18n = array(
|
249 |
+
'chatflows' => __( 'Chatflows', 'leadin' ),
|
250 |
+
);
|
251 |
+
|
252 |
+
wp_register_script( 'leadin-raven-js', LEADIN_PATH.'/scripts/raven.min.js' );
|
253 |
wp_register_style( 'leadin-bridge-css', LEADIN_PATH.'/style/leadin-bridge.css' );
|
254 |
+
wp_register_script( 'leadin-js', LEADIN_PATH.'/scripts/leadin.js', array( 'underscore', 'leadin-raven-js' ), false, true );
|
255 |
wp_localize_script( 'leadin-js', 'leadin_config', $leadin_config );
|
256 |
+
wp_localize_script( 'leadin-js', 'leadin_i18n', $leadin_i18n );
|
257 |
wp_enqueue_script( 'leadin-js' );
|
258 |
}
|
259 |
|
changelog.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 7.4.0 (2019.04.30) =
|
2 |
- Improve performances
|
3 |
- Remove dependencies from HubSpot's CDN
|
1 |
+
= 7.4.1 (2019.05.07) =
|
2 |
+
- Implement faster navigation
|
3 |
+
- Fix signup url
|
4 |
+
- Use i18n on PHP
|
5 |
+
|
6 |
= 7.4.0 (2019.04.30) =
|
7 |
- Improve performances
|
8 |
- Remove dependencies from HubSpot's CDN
|
inc/leadin-functions.php
CHANGED
@@ -108,6 +108,22 @@ function leadin_get_user_role() {
|
|
108 |
return $user_role;
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
/**
|
112 |
* Returns the right iframe src
|
113 |
* The src will be `/hubspot-plugin/{portalId}/{path}`,
|
@@ -124,7 +140,7 @@ function leadin_get_iframe_src() {
|
|
124 |
}
|
125 |
|
126 |
if ( empty( $portal_id ) ) {
|
127 |
-
return
|
128 |
}
|
129 |
|
130 |
$pathname = preg_replace( $regex, "", $page );
|
108 |
return $user_role;
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Return the signup url based on the site options
|
113 |
+
*/
|
114 |
+
function leadin_get_signup_url() {
|
115 |
+
$acquisition_option = get_option( 'hubspot_acquisition_attribution', '' );
|
116 |
+
$affiliate_code = get_option( 'hubspot_affiliate_code' );
|
117 |
+
$signup_url = LEADIN_BASE_URL . "/signup/wordpress?$acquisition_option";
|
118 |
+
|
119 |
+
if ($affiliate_code) {
|
120 |
+
$destination_url = rawurlencode($signup_url);
|
121 |
+
return "https://mbsy.co/$affiliate_code?url=$destination_url";
|
122 |
+
}
|
123 |
+
|
124 |
+
return "$signup_url&utm_source=wordpress-plugin&utm_medium=marketplaces";
|
125 |
+
}
|
126 |
+
|
127 |
/**
|
128 |
* Returns the right iframe src
|
129 |
* The src will be `/hubspot-plugin/{portalId}/{path}`,
|
140 |
}
|
141 |
|
142 |
if ( empty( $portal_id ) ) {
|
143 |
+
return leadin_get_signup_url();
|
144 |
}
|
145 |
|
146 |
$pathname = preg_replace( $regex, "", $page );
|
leadin.php
CHANGED
@@ -3,10 +3,12 @@
|
|
3 |
* Plugin Name: HubSpot All-In-One Marketing - Forms, Popups, Live Chat
|
4 |
* Plugin URI: http://www.hubspot.com/integrations/wordpress
|
5 |
* Description: HubSpot’s official WordPress plugin allows you to add forms, popups, and live chat to your website and integrate with the best WordPress CRM.
|
6 |
-
* Version: 7.4.
|
7 |
* Author: HubSpot
|
8 |
* Author URI: http://www.hubspot.com
|
9 |
* License: GPL v3
|
|
|
|
|
10 |
*
|
11 |
* This program is free software: you can redistribute it and/or modify
|
12 |
* it under the terms of the GNU General Public License as published by
|
@@ -58,7 +60,7 @@ if ( ! defined( 'LEADIN_DB_VERSION' ) ) {
|
|
58 |
}
|
59 |
|
60 |
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
61 |
-
define( 'LEADIN_PLUGIN_VERSION', '7.4.
|
62 |
}
|
63 |
|
64 |
if ( ! defined( 'LEADIN_SOURCE' ) ) {
|
@@ -284,6 +286,7 @@ function addHubspotShortcode($attributes) {
|
|
284 |
*/
|
285 |
function leadin_init()
|
286 |
{
|
|
|
287 |
$leadin_wp = new WPLeadIn();
|
288 |
add_shortcode('hubspot', 'addHubspotShortcode');
|
289 |
}
|
3 |
* Plugin Name: HubSpot All-In-One Marketing - Forms, Popups, Live Chat
|
4 |
* Plugin URI: http://www.hubspot.com/integrations/wordpress
|
5 |
* Description: HubSpot’s official WordPress plugin allows you to add forms, popups, and live chat to your website and integrate with the best WordPress CRM.
|
6 |
+
* Version: 7.4.1
|
7 |
* Author: HubSpot
|
8 |
* Author URI: http://www.hubspot.com
|
9 |
* License: GPL v3
|
10 |
+
* Text Domain: leadin
|
11 |
+
* Domain Path: /languages/
|
12 |
*
|
13 |
* This program is free software: you can redistribute it and/or modify
|
14 |
* it under the terms of the GNU General Public License as published by
|
60 |
}
|
61 |
|
62 |
if ( ! defined( 'LEADIN_PLUGIN_VERSION' ) ) {
|
63 |
+
define( 'LEADIN_PLUGIN_VERSION', '7.4.1' );
|
64 |
}
|
65 |
|
66 |
if ( ! defined( 'LEADIN_SOURCE' ) ) {
|
286 |
*/
|
287 |
function leadin_init()
|
288 |
{
|
289 |
+
load_plugin_textdomain( 'leadin', false, '/leadin/languages' );
|
290 |
$leadin_wp = new WPLeadIn();
|
291 |
add_shortcode('hubspot', 'addHubspotShortcode');
|
292 |
}
|
package.json
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "leadin",
|
3 |
-
"version": "1.0.0",
|
4 |
-
"devDependencies": {
|
5 |
-
"grunt": "^0.4.5",
|
6 |
-
"grunt-contrib-compass": "^1.0.1",
|
7 |
-
"grunt-contrib-clean": "^0.6.0",
|
8 |
-
"grunt-contrib-concat": "~0.4.0",
|
9 |
-
"grunt-contrib-uglify": "~0.4.0",
|
10 |
-
"grunt-contrib-watch": "~0.6.1"
|
11 |
-
},
|
12 |
-
"description": "=== LeadIn === Contributors: andygcook, nelsonjoyce Tags: lead tracking, visitor tracking, analytics, crm, marketing automation, inbound marketing, subscription, marketing, lead generation, mailchimp Requires at least: 3.7 Tested up to: 3.9.1 Stable tag: 1.0.0",
|
13 |
-
"main": "gruntfile.js",
|
14 |
-
"dependencies": {},
|
15 |
-
"scripts": {
|
16 |
-
"test": "echo \"Error: no test specified\" && exit 1"
|
17 |
-
},
|
18 |
-
"repository": {
|
19 |
-
"type": "git",
|
20 |
-
"url": "https://github.com/LeadIn/leadin.git"
|
21 |
-
},
|
22 |
-
"author": "",
|
23 |
-
"license": "ISC",
|
24 |
-
"bugs": {
|
25 |
-
"url": "https://github.com/LeadIn/leadin/issues"
|
26 |
-
},
|
27 |
-
"homepage": "https://github.com/LeadIn/leadin"
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ License: GPLv3
|
|
4 |
License URI: http://www.gnu.org/licenses/gpl.html
|
5 |
Tags: forms, popup, live chat, contact form, crm, newsletter, marketing, lead generation, hubspot, mailchimp, constant contact
|
6 |
Requires at least: 4.0
|
7 |
-
Tested up to: 5.
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 7.4.
|
10 |
|
11 |
HubSpot All-In-One Marketing, is a free all-in-one marketing plugin that allows you to easily use HubSpot forms, popups, and live chat on your WordPress site. If you’re already a HubSpot user, the plugin lets you connect your HubSpot account to your website without any code.
|
12 |
|
@@ -164,8 +164,13 @@ Please <a href="https://community.hubspot.com?utm_source=wordpress-plugin-listin
|
|
164 |
|
165 |
== Changelog ==
|
166 |
|
167 |
-
- Current version: 7.4.
|
168 |
-
- Current version release: 2019-
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
= 7.4.0 (2019.04.30) =
|
171 |
- Improve performances
|
4 |
License URI: http://www.gnu.org/licenses/gpl.html
|
5 |
Tags: forms, popup, live chat, contact form, crm, newsletter, marketing, lead generation, hubspot, mailchimp, constant contact
|
6 |
Requires at least: 4.0
|
7 |
+
Tested up to: 5.2
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 7.4.1
|
10 |
|
11 |
HubSpot All-In-One Marketing, is a free all-in-one marketing plugin that allows you to easily use HubSpot forms, popups, and live chat on your WordPress site. If you’re already a HubSpot user, the plugin lets you connect your HubSpot account to your website without any code.
|
12 |
|
164 |
|
165 |
== Changelog ==
|
166 |
|
167 |
+
- Current version: 7.4.1
|
168 |
+
- Current version release: 2019-05-07
|
169 |
+
|
170 |
+
= 7.4.1 (2019.05.07) =
|
171 |
+
- Implement faster navigation
|
172 |
+
- Fix signup url
|
173 |
+
- Use i18n on PHP
|
174 |
|
175 |
= 7.4.0 (2019.04.30) =
|
176 |
- Improve performances
|
scripts/leadin.js
CHANGED
@@ -2,25 +2,105 @@
|
|
2 |
'use strict';
|
3 |
// HubSpot Env
|
4 |
var leadinConfig = window.leadin_config || {};
|
|
|
5 |
var hubspotBaseUrl = leadinConfig.hubspotBaseUrl;
|
6 |
var portalId = leadinConfig.portalId;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
/**
|
9 |
* DOM
|
10 |
*/
|
11 |
var domElements = {
|
12 |
iframe: document.getElementById('leadin-iframe'),
|
|
|
|
|
|
|
|
|
13 |
};
|
14 |
|
15 |
/**
|
16 |
-
*
|
|
|
|
|
17 |
*/
|
18 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
var leadinMenu = document.getElementById('toplevel_page_leadin');
|
20 |
var firstSubMenu = leadinMenu && leadinMenu.querySelector('.wp-first-item');
|
21 |
var chatflowsUrl = hubspotBaseUrl + '/chatflows/' + portalId;
|
22 |
var chatflowsHtml =
|
23 |
-
'<li><a href="' +
|
|
|
|
|
|
|
|
|
24 |
if (firstSubMenu) {
|
25 |
firstSubMenu.insertAdjacentHTML('afterend', chatflowsHtml);
|
26 |
}
|
@@ -30,7 +110,7 @@
|
|
30 |
* Interframe
|
31 |
*/
|
32 |
var Interframe = (function() {
|
33 |
-
var eventBus =
|
34 |
|
35 |
function handleMessage(message) {
|
36 |
eventBus.trigger('message', message);
|
@@ -80,8 +160,13 @@
|
|
80 |
Interframe.postMessage({ leadin_config: leadinConfig });
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
83 |
var api = {
|
84 |
setConfig: setConfig,
|
|
|
85 |
};
|
86 |
|
87 |
return api;
|
@@ -93,18 +178,29 @@
|
|
93 |
* All incoming messages are handled here
|
94 |
*/
|
95 |
var MessagesHandlers = (function() {
|
96 |
-
var eventBus =
|
97 |
|
98 |
eventBus.on('leadin_parent_ajax', function(event, payload, reply) {
|
99 |
var ajaxPayload = Object.assign(
|
100 |
{
|
101 |
-
complete: function(jqXHR, textStatus) {
|
102 |
var response = Object.assign({ textStatus: textStatus }, jqXHR);
|
103 |
reply(response);
|
104 |
-
},
|
105 |
-
error: function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
// TODO: sentry
|
107 |
-
},
|
108 |
},
|
109 |
payload
|
110 |
);
|
@@ -152,8 +248,15 @@
|
|
152 |
function main() {
|
153 |
MessagesHandlers.start();
|
154 |
Interframe.init();
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
|
158 |
-
|
|
|
159 |
})(jQuery);
|
2 |
'use strict';
|
3 |
// HubSpot Env
|
4 |
var leadinConfig = window.leadin_config || {};
|
5 |
+
var i18n = window.leadin_i18n || {};
|
6 |
var hubspotBaseUrl = leadinConfig.hubspotBaseUrl;
|
7 |
var portalId = leadinConfig.portalId;
|
8 |
|
9 |
+
/**
|
10 |
+
* Raven
|
11 |
+
*/
|
12 |
+
function configureRaven() {
|
13 |
+
if (leadinConfig.env !== 'prod') {
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
Raven.config(
|
18 |
+
'https://e9b8f382cdd130c0d415cd977d2be56f@exceptions.hubspot.com/1'
|
19 |
+
).install();
|
20 |
+
|
21 |
+
Raven.setUserContext({
|
22 |
+
hub: leadinConfig.portalId,
|
23 |
+
wp: leadinConfig.wpVersion,
|
24 |
+
php: leadinConfig.phpVersion,
|
25 |
+
v: leadinConfig.leadinPluginVersion,
|
26 |
+
plugins: Object.keys(leadinConfig.plugins)
|
27 |
+
.map(function(name, index) {
|
28 |
+
return name + '#' + leadinConfig.plugins[name].Version;
|
29 |
+
})
|
30 |
+
.join(','),
|
31 |
+
});
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Event Bus
|
36 |
+
*/
|
37 |
+
function EventBus() {
|
38 |
+
var bus = $({});
|
39 |
+
|
40 |
+
return {
|
41 |
+
trigger: function() {
|
42 |
+
bus.trigger.apply(bus, arguments);
|
43 |
+
},
|
44 |
+
on: function(event, callback) {
|
45 |
+
bus.on(event, Raven.wrap(callback));
|
46 |
+
},
|
47 |
+
};
|
48 |
+
}
|
49 |
+
|
50 |
/**
|
51 |
* DOM
|
52 |
*/
|
53 |
var domElements = {
|
54 |
iframe: document.getElementById('leadin-iframe'),
|
55 |
+
allMenuButtons: $(
|
56 |
+
'.toplevel_page_leadin > a, .toplevel_page_leadin > ul > li > a'
|
57 |
+
),
|
58 |
+
subMenuButtons: $('.toplevel_page_leadin > ul > li'),
|
59 |
};
|
60 |
|
61 |
/**
|
62 |
+
* Sidebar navigation
|
63 |
+
*
|
64 |
+
* Prevent page reloads when navigating from inside the plugin
|
65 |
*/
|
66 |
+
function initNavigation() {
|
67 |
+
function setSelectedMenuItem() {
|
68 |
+
domElements.subMenuButtons.removeClass('current');
|
69 |
+
const pageParam = window.location.search.match(/\?page=leadin_?\w*/)[0]; // filter page query param
|
70 |
+
const selectedElement = $('a[href="admin.php' + pageParam + '"]');
|
71 |
+
selectedElement.parent().addClass('current');
|
72 |
+
}
|
73 |
+
|
74 |
+
function handleNavigation() {
|
75 |
+
const appRoute = window.location.search.match(/page=leadin_?(\w*)/)[1];
|
76 |
+
HubspotPluginAPI.changeRoute(appRoute);
|
77 |
+
setSelectedMenuItem();
|
78 |
+
}
|
79 |
+
|
80 |
+
// Browser back and forward events navigation
|
81 |
+
window.addEventListener('popstate', handleNavigation);
|
82 |
+
|
83 |
+
// Menu Navigation
|
84 |
+
domElements.allMenuButtons.click(function(event) {
|
85 |
+
event.preventDefault();
|
86 |
+
window.history.pushState(null, null, $(this).attr('href'));
|
87 |
+
handleNavigation();
|
88 |
+
});
|
89 |
+
}
|
90 |
+
|
91 |
+
/**
|
92 |
+
* Chatflows Menu Button
|
93 |
+
*/
|
94 |
+
function initChatflows() {
|
95 |
var leadinMenu = document.getElementById('toplevel_page_leadin');
|
96 |
var firstSubMenu = leadinMenu && leadinMenu.querySelector('.wp-first-item');
|
97 |
var chatflowsUrl = hubspotBaseUrl + '/chatflows/' + portalId;
|
98 |
var chatflowsHtml =
|
99 |
+
'<li><a href="' +
|
100 |
+
chatflowsUrl +
|
101 |
+
'" target="_blank">' +
|
102 |
+
i18n.chatflows +
|
103 |
+
'</a></li>';
|
104 |
if (firstSubMenu) {
|
105 |
firstSubMenu.insertAdjacentHTML('afterend', chatflowsHtml);
|
106 |
}
|
110 |
* Interframe
|
111 |
*/
|
112 |
var Interframe = (function() {
|
113 |
+
var eventBus = new EventBus();
|
114 |
|
115 |
function handleMessage(message) {
|
116 |
eventBus.trigger('message', message);
|
160 |
Interframe.postMessage({ leadin_config: leadinConfig });
|
161 |
}
|
162 |
|
163 |
+
function changeRoute(route) {
|
164 |
+
Interframe.postMessage({ leadin_change_route: route });
|
165 |
+
}
|
166 |
+
|
167 |
var api = {
|
168 |
setConfig: setConfig,
|
169 |
+
changeRoute: changeRoute,
|
170 |
};
|
171 |
|
172 |
return api;
|
178 |
* All incoming messages are handled here
|
179 |
*/
|
180 |
var MessagesHandlers = (function() {
|
181 |
+
var eventBus = new EventBus();
|
182 |
|
183 |
eventBus.on('leadin_parent_ajax', function(event, payload, reply) {
|
184 |
var ajaxPayload = Object.assign(
|
185 |
{
|
186 |
+
complete: Raven.wrap(function(jqXHR, textStatus) {
|
187 |
var response = Object.assign({ textStatus: textStatus }, jqXHR);
|
188 |
reply(response);
|
189 |
+
}),
|
190 |
+
error: Raven.wrap(function(jqXHR) {
|
191 |
+
var message;
|
192 |
+
|
193 |
+
try {
|
194 |
+
message = JSON.parse(jqXHR.responseText).error;
|
195 |
+
} catch (e) {
|
196 |
+
message = jqXHR.responseText;
|
197 |
+
}
|
198 |
+
|
199 |
+
Raven.captureMessage(
|
200 |
+
'AJAX request failed with code ' + jqXHR.status + ': ' + message
|
201 |
+
);
|
202 |
// TODO: sentry
|
203 |
+
}),
|
204 |
},
|
205 |
payload
|
206 |
);
|
248 |
function main() {
|
249 |
MessagesHandlers.start();
|
250 |
Interframe.init();
|
251 |
+
|
252 |
+
// Enable App Navigation only when viewing the plugin
|
253 |
+
if (window.location.search.indexOf('page=leadin') !== -1) {
|
254 |
+
initNavigation();
|
255 |
+
}
|
256 |
+
|
257 |
+
initChatflows();
|
258 |
}
|
259 |
|
260 |
+
configureRaven();
|
261 |
+
Raven.context(main);
|
262 |
})(jQuery);
|
scripts/raven.min.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/*! Raven.js 3.19.1 (aa94a44) | github.com/getsentry/raven-js */
|
2 |
+
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Raven=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){this.name="RavenConfigError",this.message=a}d.prototype=new Error,d.prototype.constructor=d,b.exports=d},{}],2:[function(a,b,c){var d=function(a,b,c){var d=a[b],e=a;if(b in a){var f="warn"===b?"warning":b;a[b]=function(){var a=[].slice.call(arguments),g=""+a.join(" "),h={level:f,logger:"console",extra:{arguments:a}};"assert"===b?a[0]===!1&&(g="Assertion failed: "+(a.slice(1).join(" ")||"console.assert"),h.extra.arguments=a.slice(1),c&&c(g,h)):c&&c(g,h),d&&Function.prototype.apply.call(d,e,a)}}};b.exports={wrapMethod:d}},{}],3:[function(a,b,c){(function(c){function d(){return+new Date}function e(a,b){return o(b)?function(c){return b(c,a)}:b}function f(){this.a=!("object"!=typeof JSON||!JSON.stringify),this.b=!n(I),this.c=!n(J),this.d=null,this.e=null,this.f=null,this.g=null,this.h=null,this.i=null,this.j={},this.k={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],collectWindowErrors:!0,maxMessageLength:0,maxUrlLength:250,stackTraceLimit:50,autoBreadcrumbs:!0,instrument:!0,sampleRate:1},this.l=0,this.m=!1,this.n=Error.stackTraceLimit,this.o=H.console||{},this.p={},this.q=[],this.r=d(),this.s=[],this.t=[],this.u=null,this.v=H.location,this.w=this.v&&this.v.href,this.x();for(var a in this.o)this.p[a]=this.o[a]}var g=a(6),h=a(7),i=a(1),j=a(5),k=j.isError,l=j.isObject,l=j.isObject,m=j.isErrorEvent,n=j.isUndefined,o=j.isFunction,p=j.isString,q=j.isEmptyObject,r=j.each,s=j.objectMerge,t=j.truncate,u=j.objectFrozen,v=j.hasKey,w=j.joinRegExp,x=j.urlencode,y=j.uuid4,z=j.htmlTreeAsString,A=j.isSameException,B=j.isSameStacktrace,C=j.parseUrl,D=j.fill,E=a(2).wrapMethod,F="source protocol user pass host port path".split(" "),G=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/,H="undefined"!=typeof window?window:"undefined"!=typeof c?c:"undefined"!=typeof self?self:{},I=H.document,J=H.navigator;f.prototype={VERSION:"3.19.1",debug:!1,TraceKit:g,config:function(a,b){var c=this;if(c.g)return this.y("error","Error: Raven has already been configured"),c;if(!a)return c;var d=c.k;b&&r(b,function(a,b){"tags"===a||"extra"===a||"user"===a?c.j[a]=b:d[a]=b}),c.setDSN(a),d.ignoreErrors.push(/^Script error\.?$/),d.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),d.ignoreErrors=w(d.ignoreErrors),d.ignoreUrls=!!d.ignoreUrls.length&&w(d.ignoreUrls),d.whitelistUrls=!!d.whitelistUrls.length&&w(d.whitelistUrls),d.includePaths=w(d.includePaths),d.maxBreadcrumbs=Math.max(0,Math.min(d.maxBreadcrumbs||100,100));var e={xhr:!0,console:!0,dom:!0,location:!0},f=d.autoBreadcrumbs;"[object Object]"==={}.toString.call(f)?f=s(e,f):f!==!1&&(f=e),d.autoBreadcrumbs=f;var h={tryCatch:!0},i=d.instrument;return"[object Object]"==={}.toString.call(i)?i=s(h,i):i!==!1&&(i=h),d.instrument=i,g.collectWindowErrors=!!d.collectWindowErrors,c},install:function(){var a=this;return a.isSetup()&&!a.m&&(g.report.subscribe(function(){a.z.apply(a,arguments)}),a.k.instrument&&a.k.instrument.tryCatch&&a.A(),a.k.autoBreadcrumbs&&a.B(),a.C(),a.m=!0),Error.stackTraceLimit=a.k.stackTraceLimit,this},setDSN:function(a){var b=this,c=b.D(a),d=c.path.lastIndexOf("/"),e=c.path.substr(1,d);b.E=a,b.h=c.user,b.F=c.pass&&c.pass.substr(1),b.i=c.path.substr(d+1),b.g=b.G(c),b.H=b.g+"/"+e+"api/"+b.i+"/store/",this.x()},context:function(a,b,c){return o(a)&&(c=b||[],b=a,a=void 0),this.wrap(a,b).apply(this,c)},wrap:function(a,b,c){function d(){var d=[],f=arguments.length,g=!a||a&&a.deep!==!1;for(c&&o(c)&&c.apply(this,arguments);f--;)d[f]=g?e.wrap(a,arguments[f]):arguments[f];try{return b.apply(this,d)}catch(h){throw e.I(),e.captureException(h,a),h}}var e=this;if(n(b)&&!o(a))return a;if(o(a)&&(b=a,a=void 0),!o(b))return b;try{if(b.J)return b;if(b.K)return b.K}catch(f){return b}for(var g in b)v(b,g)&&(d[g]=b[g]);return d.prototype=b.prototype,b.K=d,d.J=!0,d.L=b,d},uninstall:function(){return g.report.uninstall(),this.M(),Error.stackTraceLimit=this.n,this.m=!1,this},captureException:function(a,b){var c=!k(a),d=!m(a),e=m(a)&&!a.error;if(c&&d||e)return this.captureMessage(a,s({trimHeadFrames:1,stacktrace:!0},b));m(a)&&(a=a.error),this.d=a;try{var f=g.computeStackTrace(a);this.N(f,b)}catch(h){if(a!==h)throw h}return this},captureMessage:function(a,b){if(!this.k.ignoreErrors.test||!this.k.ignoreErrors.test(a)){b=b||{};var c,d=s({message:a+""},b);try{throw new Error(a)}catch(e){c=e}c.name=null;var f=g.computeStackTrace(c),h=f.stack[1],i=h&&h.url||"";if((!this.k.ignoreUrls.test||!this.k.ignoreUrls.test(i))&&(!this.k.whitelistUrls.test||this.k.whitelistUrls.test(i))){if(this.k.stacktrace||b&&b.stacktrace){b=s({fingerprint:a,trimHeadFrames:(b.trimHeadFrames||0)+1},b);var j=this.O(f,b);d.stacktrace={frames:j.reverse()}}return this.P(d),this}}},captureBreadcrumb:function(a){var b=s({timestamp:d()/1e3},a);if(o(this.k.breadcrumbCallback)){var c=this.k.breadcrumbCallback(b);if(l(c)&&!q(c))b=c;else if(c===!1)return this}return this.t.push(b),this.t.length>this.k.maxBreadcrumbs&&this.t.shift(),this},addPlugin:function(a){var b=[].slice.call(arguments,1);return this.q.push([a,b]),this.m&&this.C(),this},setUserContext:function(a){return this.j.user=a,this},setExtraContext:function(a){return this.Q("extra",a),this},setTagsContext:function(a){return this.Q("tags",a),this},clearContext:function(){return this.j={},this},getContext:function(){return JSON.parse(h(this.j))},setEnvironment:function(a){return this.k.environment=a,this},setRelease:function(a){return this.k.release=a,this},setDataCallback:function(a){var b=this.k.dataCallback;return this.k.dataCallback=e(b,a),this},setBreadcrumbCallback:function(a){var b=this.k.breadcrumbCallback;return this.k.breadcrumbCallback=e(b,a),this},setShouldSendCallback:function(a){var b=this.k.shouldSendCallback;return this.k.shouldSendCallback=e(b,a),this},setTransport:function(a){return this.k.transport=a,this},lastException:function(){return this.d},lastEventId:function(){return this.f},isSetup:function(){return!!this.a&&(!!this.g||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this.y("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var a=H.RavenConfig;a&&this.config(a.dsn,a.config).install()},showReportDialog:function(a){if(I){a=a||{};var b=a.eventId||this.lastEventId();if(!b)throw new i("Missing eventId");var c=a.dsn||this.E;if(!c)throw new i("Missing DSN");var d=encodeURIComponent,e="";e+="?eventId="+d(b),e+="&dsn="+d(c);var f=a.user||this.j.user;f&&(f.name&&(e+="&name="+d(f.name)),f.email&&(e+="&email="+d(f.email)));var g=this.G(this.D(c)),h=I.createElement("script");h.async=!0,h.src=g+"/api/embed/error-page/"+e,(I.head||I.body).appendChild(h)}},I:function(){var a=this;this.l+=1,setTimeout(function(){a.l-=1})},R:function(a,b){var c,d;if(this.b){b=b||{},a="raven"+a.substr(0,1).toUpperCase()+a.substr(1),I.createEvent?(c=I.createEvent("HTMLEvents"),c.initEvent(a,!0,!0)):(c=I.createEventObject(),c.eventType=a);for(d in b)v(b,d)&&(c[d]=b[d]);if(I.createEvent)I.dispatchEvent(c);else try{I.fireEvent("on"+c.eventType.toLowerCase(),c)}catch(e){}}},S:function(a){var b=this;return function(c){if(b.T=null,b.u!==c){b.u=c;var d;try{d=z(c.target)}catch(e){d="<unknown>"}b.captureBreadcrumb({category:"ui."+a,message:d})}}},U:function(){var a=this,b=1e3;return function(c){var d;try{d=c.target}catch(e){return}var f=d&&d.tagName;if(f&&("INPUT"===f||"TEXTAREA"===f||d.isContentEditable)){var g=a.T;g||a.S("input")(c),clearTimeout(g),a.T=setTimeout(function(){a.T=null},b)}}},V:function(a,b){var c=C(this.v.href),d=C(b),e=C(a);this.w=b,c.protocol===d.protocol&&c.host===d.host&&(b=d.relative),c.protocol===e.protocol&&c.host===e.host&&(a=e.relative),this.captureBreadcrumb({category:"navigation",data:{to:b,from:a}})},A:function(){function a(a){return function(b,d){for(var e=new Array(arguments.length),f=0;f<e.length;++f)e[f]=arguments[f];var g=e[0];return o(g)&&(e[0]=c.wrap(g)),a.apply?a.apply(this,e):a(e[0],e[1])}}function b(a){var b=H[a]&&H[a].prototype;b&&b.hasOwnProperty&&b.hasOwnProperty("addEventListener")&&(D(b,"addEventListener",function(b){return function(d,f,g,h){try{f&&f.handleEvent&&(f.handleEvent=c.wrap(f.handleEvent))}catch(i){}var j,k,l;return e&&e.dom&&("EventTarget"===a||"Node"===a)&&(k=c.S("click"),l=c.U(),j=function(a){if(a){var b;try{b=a.type}catch(c){return}return"click"===b?k(a):"keypress"===b?l(a):void 0}}),b.call(this,d,c.wrap(f,void 0,j),g,h)}},d),D(b,"removeEventListener",function(a){return function(b,c,d,e){try{c=c&&(c.K?c.K:c)}catch(f){}return a.call(this,b,c,d,e)}},d))}var c=this,d=c.s,e=this.k.autoBreadcrumbs;D(H,"setTimeout",a,d),D(H,"setInterval",a,d),H.requestAnimationFrame&&D(H,"requestAnimationFrame",function(a){return function(b){return a(c.wrap(b))}},d);for(var f=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],g=0;g<f.length;g++)b(f[g])},B:function(){function a(a,c){a in c&&o(c[a])&&D(c,a,function(a){return b.wrap(a)})}var b=this,c=this.k.autoBreadcrumbs,d=b.s;if(c.xhr&&"XMLHttpRequest"in H){var e=XMLHttpRequest.prototype;D(e,"open",function(a){return function(c,d){return p(d)&&d.indexOf(b.h)===-1&&(this.W={method:c,url:d,status_code:null}),a.apply(this,arguments)}},d),D(e,"send",function(c){return function(d){function e(){if(f.W&&4===f.readyState){try{f.W.status_code=f.status}catch(a){}b.captureBreadcrumb({type:"http",category:"xhr",data:f.W})}}for(var f=this,g=["onload","onerror","onprogress"],h=0;h<g.length;h++)a(g[h],f);return"onreadystatechange"in f&&o(f.onreadystatechange)?D(f,"onreadystatechange",function(a){return b.wrap(a,void 0,e)}):f.onreadystatechange=e,c.apply(this,arguments)}},d)}c.xhr&&"fetch"in H&&D(H,"fetch",function(a){return function(c,d){for(var e=new Array(arguments.length),f=0;f<e.length;++f)e[f]=arguments[f];var g,h=e[0],i="GET";"string"==typeof h?g=h:"Request"in H&&h instanceof H.Request?(g=h.url,h.method&&(i=h.method)):g=""+h,e[1]&&e[1].method&&(i=e[1].method);var j={method:i,url:g,status_code:null};return b.captureBreadcrumb({type:"http",category:"fetch",data:j}),a.apply(this,e).then(function(a){return j.status_code=a.status,a})}},d),c.dom&&this.b&&(I.addEventListener?(I.addEventListener("click",b.S("click"),!1),I.addEventListener("keypress",b.U(),!1)):(I.attachEvent("onclick",b.S("click")),I.attachEvent("onkeypress",b.U())));var f=H.chrome,g=f&&f.app&&f.app.runtime,h=!g&&H.history&&history.pushState&&history.replaceState;if(c.location&&h){var i=H.onpopstate;H.onpopstate=function(){var a=b.v.href;if(b.V(b.w,a),i)return i.apply(this,arguments)};var j=function(a){return function(){var c=arguments.length>2?arguments[2]:void 0;return c&&b.V(b.w,c+""),a.apply(this,arguments)}};D(history,"pushState",j,d),D(history,"replaceState",j,d)}if(c.console&&"console"in H&&console.log){var k=function(a,c){b.captureBreadcrumb({message:a,level:c.level,category:"console"})};r(["debug","info","warn","error","log"],function(a,b){E(console,b,k)})}},M:function(){for(var a;this.s.length;){a=this.s.shift();var b=a[0],c=a[1],d=a[2];b[c]=d}},C:function(){var a=this;r(this.q,function(b,c){var d=c[0],e=c[1];d.apply(a,[a].concat(e))})},D:function(a){var b=G.exec(a),c={},d=7;try{for(;d--;)c[F[d]]=b[d]||""}catch(e){throw new i("Invalid DSN: "+a)}if(c.pass&&!this.k.allowSecretKey)throw new i("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return c},G:function(a){var b="//"+a.host+(a.port?":"+a.port:"");return a.protocol&&(b=a.protocol+":"+b),b},z:function(){this.l||this.N.apply(this,arguments)},N:function(a,b){var c=this.O(a,b);this.R("handle",{stackInfo:a,options:b}),this.X(a.name,a.message,a.url,a.lineno,c,b)},O:function(a,b){var c=this,d=[];if(a.stack&&a.stack.length&&(r(a.stack,function(b,e){var f=c.Y(e,a.url);f&&d.push(f)}),b&&b.trimHeadFrames))for(var e=0;e<b.trimHeadFrames&&e<d.length;e++)d[e].in_app=!1;return d=d.slice(0,this.k.stackTraceLimit)},Y:function(a,b){var c={filename:a.url,lineno:a.line,colno:a.column,"function":a.func||"?"};return a.url||(c.filename=b),c.in_app=!(this.k.includePaths.test&&!this.k.includePaths.test(c.filename)||/(Raven|TraceKit)\./.test(c["function"])||/raven\.(min\.)?js$/.test(c.filename)),c},X:function(a,b,c,d,e,f){var g=(a?a+": ":"")+(b||"");if(!this.k.ignoreErrors.test||!this.k.ignoreErrors.test(b)&&!this.k.ignoreErrors.test(g)){var h;if(e&&e.length?(c=e[0].filename||c,e.reverse(),h={frames:e}):c&&(h={frames:[{filename:c,lineno:d,in_app:!0}]}),(!this.k.ignoreUrls.test||!this.k.ignoreUrls.test(c))&&(!this.k.whitelistUrls.test||this.k.whitelistUrls.test(c))){var i=s({exception:{values:[{type:a,value:b,stacktrace:h}]},culprit:c},f);this.P(i)}}},Z:function(a){var b=this.k.maxMessageLength;if(a.message&&(a.message=t(a.message,b)),a.exception){var c=a.exception.values[0];c.value=t(c.value,b)}var d=a.request;return d&&(d.url&&(d.url=t(d.url,this.k.maxUrlLength)),d.Referer&&(d.Referer=t(d.Referer,this.k.maxUrlLength))),a.breadcrumbs&&a.breadcrumbs.values&&this.$(a.breadcrumbs),a},$:function(a){for(var b,c,d,e=["to","from","url"],f=0;f<a.values.length;++f)if(c=a.values[f],c.hasOwnProperty("data")&&l(c.data)&&!u(c.data)){d=s({},c.data);for(var g=0;g<e.length;++g)b=e[g],d.hasOwnProperty(b)&&d[b]&&(d[b]=t(d[b],this.k.maxUrlLength));a.values[f].data=d}},_:function(){if(this.c||this.b){var a={};return this.c&&J.userAgent&&(a.headers={"User-Agent":navigator.userAgent}),this.b&&(I.location&&I.location.href&&(a.url=I.location.href),I.referrer&&(a.headers||(a.headers={}),a.headers.Referer=I.referrer)),a}},x:function(){this.aa=0,this.ba=null},ca:function(){return this.aa&&d()-this.ba<this.aa},da:function(a){var b=this.e;return!(!b||a.message!==b.message||a.culprit!==b.culprit)&&(a.stacktrace||b.stacktrace?B(a.stacktrace,b.stacktrace):!a.exception&&!b.exception||A(a.exception,b.exception))},ea:function(a){if(!this.ca()){var b=a.status;if(400===b||401===b||429===b){var c;try{c=a.getResponseHeader("Retry-After"),c=1e3*parseInt(c,10)}catch(e){}this.aa=c?c:2*this.aa||1e3,this.ba=d()}}},P:function(a){var b=this.k,c={project:this.i,logger:b.logger,platform:"javascript"},e=this._();if(e&&(c.request=e),a.trimHeadFrames&&delete a.trimHeadFrames,a=s(c,a),a.tags=s(s({},this.j.tags),a.tags),a.extra=s(s({},this.j.extra),a.extra),a.extra["session:duration"]=d()-this.r,this.t&&this.t.length>0&&(a.breadcrumbs={values:[].slice.call(this.t,0)}),q(a.tags)&&delete a.tags,this.j.user&&(a.user=this.j.user),b.environment&&(a.environment=b.environment),b.release&&(a.release=b.release),b.serverName&&(a.server_name=b.serverName),o(b.dataCallback)&&(a=b.dataCallback(a)||a),a&&!q(a)&&(!o(b.shouldSendCallback)||b.shouldSendCallback(a)))return this.ca()?void this.y("warn","Raven dropped error due to backoff: ",a):void("number"==typeof b.sampleRate?Math.random()<b.sampleRate&&this.fa(a):this.fa(a))},ga:function(){return y()},fa:function(a,b){var c=this,d=this.k;if(this.isSetup()){if(a=this.Z(a),!this.k.allowDuplicates&&this.da(a))return void this.y("warn","Raven dropped repeat event: ",a);this.f=a.event_id||(a.event_id=this.ga()),this.e=a,this.y("debug","Raven about to send:",a);var e={sentry_version:"7",sentry_client:"raven-js/"+this.VERSION,sentry_key:this.h};this.F&&(e.sentry_secret=this.F);var f=a.exception&&a.exception.values[0];this.captureBreadcrumb({category:"sentry",message:f?(f.type?f.type+": ":"")+f.value:a.message,event_id:a.event_id,level:a.level||"error"});var g=this.H;(d.transport||this.ha).call(this,{url:g,auth:e,data:a,options:d,onSuccess:function(){c.x(),c.R("success",{data:a,src:g}),b&&b()},onError:function(d){c.y("error","Raven transport failed to send: ",d),d.request&&c.ea(d.request),c.R("failure",{data:a,src:g}),d=d||new Error("Raven send failed (no additional details provided)"),b&&b(d)}})}},ha:function(a){var b=H.XMLHttpRequest&&new H.XMLHttpRequest;if(b){var c="withCredentials"in b||"undefined"!=typeof XDomainRequest;if(c){var d=a.url;"withCredentials"in b?b.onreadystatechange=function(){if(4===b.readyState)if(200===b.status)a.onSuccess&&a.onSuccess();else if(a.onError){var c=new Error("Sentry error code: "+b.status);c.request=b,a.onError(c)}}:(b=new XDomainRequest,d=d.replace(/^https?:/,""),a.onSuccess&&(b.onload=a.onSuccess),a.onError&&(b.onerror=function(){var c=new Error("Sentry error code: XDomainRequest");c.request=b,a.onError(c)})),b.open("POST",d+"?"+x(a.auth)),b.send(h(a.data))}}},y:function(a){this.p[a]&&this.debug&&Function.prototype.apply.call(this.p[a],this.o,[].slice.call(arguments,1))},Q:function(a,b){n(b)?delete this.j[a]:this.j[a]=s(this.j[a]||{},b)}},f.prototype.setUser=f.prototype.setUserContext,f.prototype.setReleaseContext=f.prototype.setRelease,b.exports=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{1:1,2:2,5:5,6:6,7:7}],4:[function(a,b,c){(function(c){var d=a(3),e="undefined"!=typeof window?window:"undefined"!=typeof c?c:"undefined"!=typeof self?self:{},f=e.Raven,g=new d;g.noConflict=function(){return e.Raven=f,g},g.afterLoad(),b.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{3:3}],5:[function(a,b,c){(function(a){function c(a){return"object"==typeof a&&null!==a}function d(a){switch({}.toString.call(a)){case"[object Error]":return!0;case"[object Exception]":return!0;case"[object DOMException]":return!0;default:return a instanceof Error}}function e(a){return j()&&"[object ErrorEvent]"==={}.toString.call(a)}function f(a){return void 0===a}function g(a){return"function"==typeof a}function h(a){return"[object String]"===Object.prototype.toString.call(a)}function i(a){for(var b in a)return!1;return!0}function j(){try{return new ErrorEvent(""),!0}catch(a){return!1}}function k(a){function b(b,c){var d=a(b)||b;return c?c(d)||d:d}return b}function l(a,b){var c,d;if(f(a.length))for(c in a)p(a,c)&&b.call(null,c,a[c]);else if(d=a.length)for(c=0;c<d;c++)b.call(null,c,a[c])}function m(a,b){return b?(l(b,function(b,c){a[b]=c}),a):a}function n(a){return!!Object.isFrozen&&Object.isFrozen(a)}function o(a,b){return!b||a.length<=b?a:a.substr(0,b)+"…"}function p(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function q(a){for(var b,c=[],d=0,e=a.length;d<e;d++)b=a[d],h(b)?c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):b&&b.source&&c.push(b.source);return new RegExp(c.join("|"),"i")}function r(a){var b=[];return l(a,function(a,c){b.push(encodeURIComponent(a)+"="+encodeURIComponent(c))}),b.join("&")}function s(a){var b=a.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!b)return{};var c=b[6]||"",d=b[8]||"";return{protocol:b[2],host:b[4],path:b[5],relative:b[5]+c+d}}function t(){var a=A.crypto||A.msCrypto;if(!f(a)&&a.getRandomValues){var b=new Uint16Array(8);a.getRandomValues(b),b[3]=4095&b[3]|16384,b[4]=16383&b[4]|32768;var c=function(a){for(var b=a.toString(16);b.length<4;)b="0"+b;return b};return c(b[0])+c(b[1])+c(b[2])+c(b[3])+c(b[4])+c(b[5])+c(b[6])+c(b[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}function u(a){for(var b,c=5,d=80,e=[],f=0,g=0,h=" > ",i=h.length;a&&f++<c&&(b=v(a),!("html"===b||f>1&&g+e.length*i+b.length>=d));)e.push(b),g+=b.length,a=a.parentNode;return e.reverse().join(h)}function v(a){var b,c,d,e,f,g=[];if(!a||!a.tagName)return"";if(g.push(a.tagName.toLowerCase()),a.id&&g.push("#"+a.id),b=a.className,b&&h(b))for(c=b.split(/\s+/),f=0;f<c.length;f++)g.push("."+c[f]);var i=["type","name","title","alt"];for(f=0;f<i.length;f++)d=i[f],e=a.getAttribute(d),e&&g.push("["+d+'="'+e+'"]');return g.join("")}function w(a,b){return!!(!!a^!!b)}function x(a,b){return!w(a,b)&&(a=a.values[0],b=b.values[0],a.type===b.type&&a.value===b.value&&y(a.stacktrace,b.stacktrace))}function y(a,b){if(w(a,b))return!1;var c=a.frames,d=b.frames;if(c.length!==d.length)return!1;for(var e,f,g=0;g<c.length;g++)if(e=c[g],f=d[g],e.filename!==f.filename||e.lineno!==f.lineno||e.colno!==f.colno||e["function"]!==f["function"])return!1;return!0}function z(a,b,c,d){var e=a[b];a[b]=c(e),d&&d.push([a,b,e])}var A="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{};b.exports={isObject:c,isError:d,isErrorEvent:e,isUndefined:f,isFunction:g,isString:h,isEmptyObject:i,supportsErrorEvent:j,wrappedCallback:k,each:l,objectMerge:m,truncate:o,objectFrozen:n,hasKey:p,joinRegExp:q,urlencode:r,uuid4:t,htmlTreeAsString:u,htmlElementAsString:v,isSameException:x,isSameStacktrace:y,parseUrl:s,fill:z}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(a,b,c){(function(c){function d(){return"undefined"==typeof document||null==document.location?"":document.location.href}var e=a(5),f={collectWindowErrors:!0,debug:!1},g="undefined"!=typeof window?window:"undefined"!=typeof c?c:"undefined"!=typeof self?self:{},h=[].slice,i="?",j=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;f.report=function(){function a(a){m(),s.push(a)}function b(a){for(var b=s.length-1;b>=0;--b)s[b]===a&&s.splice(b,1)}function c(){n(),s=[]}function k(a,b){var c=null;if(!b||f.collectWindowErrors){for(var d in s)if(s.hasOwnProperty(d))try{s[d].apply(null,[a].concat(h.call(arguments,2)))}catch(e){c=e}if(c)throw c}}function l(a,b,c,g,h){var l=null;if(v)f.computeStackTrace.augmentStackTraceWithInitialElement(v,b,c,a),o();else if(h&&e.isError(h))l=f.computeStackTrace(h),k(l,!0);else{var m,n={url:b,line:c,column:g},p=void 0,r=a;if("[object String]"==={}.toString.call(a)){var m=a.match(j);m&&(p=m[1],r=m[2])}n.func=i,l={name:p,message:r,url:d(),stack:[n]},k(l,!0)}return!!q&&q.apply(this,arguments)}function m(){r||(q=g.onerror,g.onerror=l,r=!0)}function n(){r&&(g.onerror=q,r=!1,q=void 0)}function o(){var a=v,b=t;t=null,v=null,u=null,k.apply(null,[a,!1].concat(b))}function p(a,b){var c=h.call(arguments,1);if(v){if(u===a)return;o()}var d=f.computeStackTrace(a);if(v=d,u=a,t=c,setTimeout(function(){u===a&&o()},d.incomplete?2e3:0),b!==!1)throw a}var q,r,s=[],t=null,u=null,v=null;return p.subscribe=a,p.unsubscribe=b,p.uninstall=c,p}(),f.computeStackTrace=function(){function a(a){if("undefined"!=typeof a.stack&&a.stack){for(var b,c,e,f=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,g=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,h=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,j=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,k=/\((\S*)(?::(\d+))(?::(\d+))\)/,l=a.stack.split("\n"),m=[],n=(/^(.*) is undefined$/.exec(a.message),0),o=l.length;n<o;++n){if(c=f.exec(l[n])){var p=c[2]&&0===c[2].indexOf("native"),q=c[2]&&0===c[2].indexOf("eval");q&&(b=k.exec(c[2]))&&(c[2]=b[1],c[3]=b[2],c[4]=b[3]),e={url:p?null:c[2],func:c[1]||i,args:p?[c[2]]:[],line:c[3]?+c[3]:null,column:c[4]?+c[4]:null}}else if(c=h.exec(l[n]))e={url:c[2],func:c[1]||i,args:[],line:+c[3],column:c[4]?+c[4]:null};else{if(!(c=g.exec(l[n])))continue;var q=c[3]&&c[3].indexOf(" > eval")>-1;q&&(b=j.exec(c[3]))?(c[3]=b[1],c[4]=b[2],c[5]=null):0!==n||c[5]||"undefined"==typeof a.columnNumber||(m[0].column=a.columnNumber+1),e={url:c[3],func:c[1]||i,args:c[2]?c[2].split(","):[],line:c[4]?+c[4]:null,column:c[5]?+c[5]:null}}!e.func&&e.line&&(e.func=i),m.push(e)}return m.length?{name:a.name,message:a.message,url:d(),stack:m}:null}}function b(a,b,c,d){var e={url:b,line:c};if(e.url&&e.line){if(a.incomplete=!1,e.func||(e.func=i),a.stack.length>0&&a.stack[0].url===e.url){if(a.stack[0].line===e.line)return!1;if(!a.stack[0].line&&a.stack[0].func===e.func)return a.stack[0].line=e.line,!1}return a.stack.unshift(e),a.partial=!0,!0}return a.incomplete=!0,!1}function c(a,g){for(var h,j,k=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,l=[],m={},n=!1,o=c.caller;o&&!n;o=o.caller)if(o!==e&&o!==f.report){if(j={url:null,func:i,line:null,column:null},o.name?j.func=o.name:(h=k.exec(o.toString()))&&(j.func=h[1]),"undefined"==typeof j.func)try{j.func=h.input.substring(0,h.input.indexOf("{"))}catch(p){}m[""+o]?n=!0:m[""+o]=!0,l.push(j)}g&&l.splice(0,g);var q={name:a.name,message:a.message,url:d(),stack:l};return b(q,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),q}function e(b,e){var g=null;e=null==e?0:+e;try{if(g=a(b))return g}catch(h){if(f.debug)throw h}try{if(g=c(b,e+1))return g}catch(h){if(f.debug)throw h}return{name:b.name,message:b.message,url:d()}}return e.augmentStackTraceWithInitialElement=b,e.computeStackTraceFromStackProp=a,e}(),b.exports=f}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{5:5}],7:[function(a,b,c){function d(a,b){for(var c=0;c<a.length;++c)if(a[c]===b)return c;return-1}function e(a,b,c,d){return JSON.stringify(a,g(b,d),c)}function f(a){var b={stack:a.stack,message:a.message,name:a.name};for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b}function g(a,b){var c=[],e=[];return null==b&&(b=function(a,b){return c[0]===b?"[Circular ~]":"[Circular ~."+e.slice(0,d(c,b)).join(".")+"]"}),function(g,h){if(c.length>0){var i=d(c,this);~i?c.splice(i+1):c.push(this),~i?e.splice(i,1/0,g):e.push(g),~d(c,h)&&(h=b.call(this,g,h))}else c.push(h);return null==a?h instanceof Error?f(h):h:a.call(this,g,h)}}c=b.exports=e,c.getSerialize=g},{}]},{},[4])(4)});
|
3 |
+
//# sourceMappingURL=raven.min.js.map
|