PageSourceSearch

https://vaadin.com/vaadincom/haas-service/v1/intercom.js

js vaadin.com collected 2026-09-24 08:40:11 UTC 4,057 bytes, 149 lines download raw bytes

1window.haas.intercom = window.haas.intercom||{};
2
3window.haas.intercom.util = (function() {
4
5	var _debounce = (func, wait, immediate) => {
6		let timeout;
7		return function () {
8			const context = this, args = arguments;
9			const later = function () {
10				timeout = null;
11				if (!immediate) func.apply(context, args);
12			};
13			const callNow = immediate && !timeout;
14			clearTimeout(timeout);
15			timeout = setTimeout(later, wait);
16			if (callNow) func.apply(context, args);
17		};
18	};
19
20	/**
21	 * Public API
22	 */
23	return {
24		// Borrowed from: https://davidwalsh.name/essential-javascript-functions
25		// Returns a function, that, as long as it continues to be invoked, will not
26		// be triggered. The function will be called after it stops being called for
27		// N milliseconds. If `immediate` is passed, trigger the function on the
28		// leading edge, instead of the trailing.
29		initResponsiveIntercomLauncher: () => {
30			const hideDefaultBelowWidth = 480; /* $break-sm-min */
31
32			/* When the page loads the Intercom Launcher is hidden (that's defined in com.vaadin.site.component.common.IntercomChat). */
33			setTimeout(() => {
34				if (typeof window.haas.intercom.util.icResizeListener === 'undefined') {
35					let isCurrentlyHidden;
36					window.haas.intercom.util.icResizeListener = () => {
37						window.requestAnimationFrame(() => {
38							if (!window.Intercom) return;
39							const wouldHide = window.innerWidth < hideDefaultBelowWidth;
40							if (typeof isCurrentlyHidden === 'undefined' || isCurrentlyHidden !== wouldHide) {
41								isCurrentlyHidden = wouldHide;
42								window.Intercom('update', {hide_default_launcher: wouldHide});
43							}
44						});
45					};
46					window.addEventListener('resize', _debounce(haas.intercom.util.icResizeListener, 66));
47				}
48
49				window.haas.intercom.util.icResizeListener();
50			}, 1 * 1000);
51		}
52	};
53})();
54
55window.haas.intercom.session = (function() {
56	/**
57	 * Public API
58	 */
59	return {
60		/**
61		 * Stops a running session. Shut be done when user logs out.
62		 */
63		close: function() {
64			if (window.Intercom) {
65				window.Intercom('shutdown');
66			}
67		},
68
69		/**
70		 * Creates a new session
71		 */
72		open: function() {
73			setTimeout(() => {
74				var intercomSettings = {
75					'app_id': 't599ix3y',
76					'custom_launcher_selector': '.intercom-launcher__link',
77					'hide_default_launcher': false
78				};
79				
80
81				var ic = window.Intercom;
82				if (typeof ic === "function") {
83					ic('reattach_activator');
84					ic('update', intercomSettings);
85				} else {
86					var i = function() {
87						i.c(arguments)
88					};
89					i.q = [];
90					i.c = function(args) {
91						i.q.push(args)
92					};
93					window.Intercom = i;
94
95					function l() {
96						var s = document.createElement('script');
97						s.type = 'text/javascript';
98						s.async = true;
99						s.src = 'https://widget.intercom.io/widget/t599ix3y';
100						var x = document.getElementsByTagName('script')[0];
101						x.parentNode.insertBefore(s, x);
102					}
103					if (document.readyState === 'complete') {
104						l();
105					} else if (window.attachEvent) {
106						window.attachEvent('onload', l);
107					} else {
108						window.addEventListener('load', l, false);
109					}
110				}
111
112				window.Intercom('boot', intercomSettings);
113				if (haas.intercom.util && haas.intercom.util.icResizeListener) haas.intercom.util.icResizeListener();
114			}, 5000);
115		},
116
117		update: function() {
118			if (window.Intercom) {
119			
120			
121				window.Intercom('update', {
122					last_request_at: parseInt((new Date()).getTime()/1000)
123				});
124			
125			}
126		}
127	};
128})();
129
130/**
131 * Initializes the menu when DOM is loaded and container div should be available.
132 */
133if(document.readyState === 'interactive') {
134    haas.intercom.util.initResponsiveIntercomLauncher();
135} else {
136  window.addEventListener("DOMContentLoaded", function() {
137    haas.intercom.util.initResponsiveIntercomLauncher();
138  }, {once: true});
139}
140
141/**
142 * Open a new Intercom session immediately
143 */
144haas.intercom.session.open();
145
146/**
147 * Update session when navigating in SPAs
148 */
149window.addEventListener('on-location-change', (event) => haas.intercom.session.update(), false);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.