in css/jetbrains-bundle/sales-chat.js [3496:3787]
url: responseURL()
}
var body = 'response' in xhr ? xhr.response : xhr.responseText
resolve(new Response(body, options))
}
xhr.onerror = function() {
reject(new TypeError('Network request failed'))
}
xhr.ontimeout = function() {
reject(new TypeError('Network request failed'))
}
xhr.open(request.method, request.url, true)
if (request.credentials === 'include') {
xhr.withCredentials = true
}
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob'
}
request.headers.forEach(function(value, name) {
xhr.setRequestHeader(name, value)
})
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
})
}
self.fetch.polyfill = true
})(typeof self !== 'undefined' ? self : this);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(128)))
/***/ },
/* 216 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var strictUriEncode = __webpack_require__(217);
exports.extract = function (str) {
return str.split('?')[1] || '';
};
exports.parse = function (str) {
if (typeof str !== 'string') {
return {};
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return {};
}
return str.split('&').reduce(function (ret, param) {
var parts = param.replace(/\+/g, ' ').split('=');
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts.shift();
var val = parts.length > 0 ? parts.join('=') : undefined;
key = decodeURIComponent(key);
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
if (!ret.hasOwnProperty(key)) {
ret[key] = val;
} else if (Array.isArray(ret[key])) {
ret[key].push(val);
} else {
ret[key] = [ret[key], val];
}
return ret;
}, {});
};
exports.stringify = function (obj) {
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (val === undefined) {
return '';
}
if (val === null) {
return key;
}
if (Array.isArray(val)) {
return val.slice().sort().map(function (val2) {
return strictUriEncode(key) + '=' + strictUriEncode(val2);
}).join('&');
}
return strictUriEncode(key) + '=' + strictUriEncode(val);
}).filter(function (x) {
return x.length > 0;
}).join('&') : '';
};
/***/ },
/* 217 */
/***/ function(module, exports) {
'use strict';
module.exports = function (str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
});
};
/***/ },
/* 218 */
/***/ function(module, exports) {
/**
* @typedef {Object} SalesDepartment
* @property {String} name Department name can be taken from Departments section of Zopim chat admin area
* {@see https://jbs.zendesk.com/agent/apps/zopim-chat}
*
* @property {String} lang Should be language name supported by Zopim chat
* {@see https://zopimsupport.zendesk.com/hc/en-us/articles/218953857#languages}
*
* @property {String} instanceDomain
*
* @property {Array<String>} countries List of ISO country codes
* {@see https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes}
* @property {Object} i18n
*/
/**
* @typedef {Object} SalesDepartmentsList
* @property {SalesDepartment} america
* @property {SalesDepartment} international
* @property {SalesDepartment} germany
* @property {SalesDepartment} cis
* @property {SalesDepartment} china
*/
var departments = {
international: {
name: 'International Sales',
lang: 'en',
instanceDomain: 'jbssales.zendesk.com',
countries: null // All Sales ROW countries
},
america: {
name: 'American Sales',
lang: 'en',
instanceDomain: 'jbssalesus.zendesk.com',
countries: [
// North America
'US', // USA
'CA', // Canada
// Latin America
'AR', // Argentina
'BO', // Bolivia
'BR', // Brazil
'CL', // Chile
'CO', // Colombia
'CR', // Costa Rica
'CU', // Cuba
'DO', // Dominican Republic
'EC', // Ecuador
'SV', // El Salvador
'GF', // French Guiana
'GP', // Guadeloupe
'GT', // Guatemala
'HT', // Haiti
'HN', // Honduras
'MQ', // Martinique
'MX', // Mexico
'NI', // Nicaragua
'PA', // Panama
'PY', // Paraguay
'PE', // Peru
'PR', // Puerto Rico
'BL', // Saint Barthélemy
'MF', // Saint Martin
'UY', // Uruguay
'VE' // Venezuela
]
},
germany: {
name: 'Sales Deutschland',
lang: 'de',
instanceDomain: 'jbssalesde.zendesk.com',
countries: ['DE']
},
cis: {
name: 'Российский отдел',
lang: 'ru',
instanceDomain: 'jbssales.zendesk.com',
countries: [
'AR', // Armenia
'AZ', // Azerbaijan
'BY', // Belarus
'KZ', // Kazakhstan
'KG', // Kyrgyzstan
'MD', // Moldova
'RU', // Russia
'TJ', // Tajikistan
'UZ', // Uzbekistan
'UA' //Ukraine
]
},
chinese: {
name: '中文销售代表',
lang: 'zh-cn',
instanceDomain: 'jbssalescn.zendesk.com',
countries: ['CN', 'HK', 'TW']
}
};
module.exports = departments;
/***/ },
/* 219 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Promise) {/**
* @param {SalesDepartmentsList} departments
* @param {String} [code]
* @returns {SalesDepartment}
*/
exports.getDepartmentByCountryCode = function(departments, code) {
if (!code) {
return departments.international;
}
var dept = null;
for (var name in departments) {
/** @type {SalesDepartment} */
var currentDept = departments[name];
if (currentDept.countries && currentDept.countries.indexOf(code) != -1) {
dept = currentDept;
break;
}
}
return dept ? dept : departments.international;
};
/**
* Promisify Zopim chat JS API loading.
* @param {String} instanceDomain Zendesk instance domain
* @returns {Promise}
*/
exports.loadZopimChatJSAPI = function(instanceDomain) {
// Zopim native initialization script
window.zEmbed||function(e,t){var n,o,d,i,s,a=[],r=document.createElement("iframe");
window.zEmbed=function(){a.push(arguments)},window.zE=window.zE||window.zEmbed,r.src="javascript:false",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="display: none",d=document.getElementsByTagName("script"),d=d[d.length-1],d.parentNode.insertBefore(r,d),i=r.contentWindow,s=i.document;try{o=s}catch(e){n=document.domain,r.src='javascript:var d=document.open();d.domain="'+n+'";void(0);',o=s}o.open()._l=function(){var o=this.createElement("script");n&&(this.domain=n),o.id="js-iframe-async",o.src=e,this.t=+new Date,this.zendeskHost=t,this.zEQueue=a,this.body.appendChild(o)},o.write('<body onload="document._l();">'),o.close()}("https://assets.zendesk.com/embeddable_framework/main.js","jbssales.zendesk.com")
return new Promise(function(resolve, reject) {
var interval = setInterval(function () {
if (typeof window.$zopim != 'undefined') {
clearInterval(interval);
resolve();
}
}, 100);
});
};
/**
* Resolves when Zopim chat iframes creates on the page.
* TODO: improve iframes detecting
* @returns {Promise<NodeList<HTMLIFrameElement>>}
*/
exports.whenZopimChatIframesCreated = function() {
return new Promise(function (resolve, reject) {
var interval = setInterval(function () {
var zopimIframes = document.querySelectorAll('.zopim iframe');
if (zopimIframes.length > 0) {
clearInterval(interval);
setTimeout(function() {