Skip to content

Commit

Permalink
test: add intercom integration
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Oct 19, 2021
1 parent 88d8ff8 commit f47ee51
Show file tree
Hide file tree
Showing 7 changed files with 1,230 additions and 16 deletions.
15 changes: 0 additions & 15 deletions tests/integrations/hubspot/forms-standard.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Partytown Test Page" />
<title>Hubspot Forms (Standard)</title>
<script>
partytown = {
debug: true,
forward: [],
logCalls: true,
logGetters: true,
logSetters: true,
logImageRequests: true,
logSendBeaconRequests: true,
logStackTraces: false,
logScriptExecution: true,
};
localStorage.setItem('LEADIN_DEBUG', 'true');
</script>
<script src="/~partytown/debug/partytown-snippet.js"></script>
<link
rel="icon"
id="favicon"
Expand Down
3 changes: 2 additions & 1 deletion tests/integrations/hubspot/forms.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
logScriptExecution: true,
};
</script>
<script src="/~partytown/debug/partytown-snippet.js"></script>
<!-- prettier-ignore -->
<script>!function(n,t){var r=n.partytown||{},e=r.forward||[],p=t.createElement("script");function u(t){return function(){(n._ptf=n._ptf||[]).push(t,arguments)}}e.map((t=>{n[t[0]]=1===t[1]?function(n,t){return(t=[]).push=u(n),t}(t):u(t)})),p.async=p.defer=!0,p.src=(r.lib||"/~partytown/")+(r.debug?"debug/":"")+"partytown.js",t.head.appendChild(p)}(window,document);</script>
<link
rel="icon"
id="favicon"
Expand Down
53 changes: 53 additions & 0 deletions tests/integrations/intercom/frame-modern.123a8fdf.js

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions tests/integrations/intercom/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Partytown Test Page" />
<title>Partytown Intercom 🎉</title>
<link
rel="icon"
id="favicon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎉</text></svg>"
/>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,
Apple Color Emoji, Segoe UI Emoji;
font-size: 12px;
}
h1 {
margin: 0 0 15px 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
a {
display: block;
padding: 16px 8px;
}
a:link,
a:visited {
text-decoration: none;
color: blue;
}
a:hover {
background-color: #eee;
}
li {
display: flex;
margin: 15px 0;
}
li strong,
li code,
li button {
white-space: nowrap;
flex: 1;
margin: 0 5px;
}
</style>
<script>
partytown = {
debug: true,
forward: [],
logCalls: true,
logGetters: true,
logSetters: true,
logImageRequests: true,
logSendBeaconRequests: true,
logStackTraces: false,
logScriptExecution: true,
};
</script>
<!-- prettier-ignore -->
<script>!function(n,t){var r=n.partytown||{},e=r.forward||[],p=t.createElement("script");function u(t){return function(){(n._ptf=n._ptf||[]).push(t,arguments)}}e.map((t=>{n[t[0]]=1===t[1]?function(n,t){return(t=[]).push=u(n),t}(t):u(t)})),p.async=p.defer=!0,p.src=(r.lib||"/~partytown/")+(r.debug?"debug/":"")+"partytown.js",t.head.appendChild(p)}(window,document);</script>
</head>
<body>
<h1>Partytown Intercom 🎉</h1>

<script type="text/partytown">
//Set your APP_ID
var APP_ID = 'fyq3wodw';
var HACK_URL = 'shim.latest.js';

window.intercomSettings = {
app_id: APP_ID,
};
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
ic('update', w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = HACK_URL;
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === 'complete') {
l();
} else if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
}
})();
</script>

<hr />
<p><a href="./intercom.html">Standard Intercom</a></p>
<p><a href="/">All Tests</a></p>
</body>
</html>
112 changes: 112 additions & 0 deletions tests/integrations/intercom/intercom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Partytown Test Page" />
<title>Standard Intercom</title>
<link
rel="icon"
id="favicon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🎉</text></svg>"
/>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,
Apple Color Emoji, Segoe UI Emoji;
font-size: 12px;
}
h1 {
margin: 0 0 15px 0;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
a {
display: block;
padding: 16px 8px;
}
a:link,
a:visited {
text-decoration: none;
color: blue;
}
a:hover {
background-color: #eee;
}
li {
display: flex;
margin: 15px 0;
}
li strong,
li code,
li button {
white-space: nowrap;
flex: 1;
margin: 0 5px;
}
</style>
</head>
<body>
<h1>Standard Intercom</h1>

<script>
//Set your APP_ID
var APP_ID = 'fyq3wodw';

window.intercomSettings = {
app_id: APP_ID,
};
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === 'function') {
ic('reattach_activator');
ic('update', w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/' + APP_ID;
var x = d.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === 'complete') {
l();
} else if (w.attachEvent) {
w.attachEvent('onload', l);
} else {
w.addEventListener('load', l, false);
}
}
})();
</script>

<hr />
<p><a href="/integrations/intercom/">Partytown Intercom</a></p>
<p><a href="/">All Tests</a></p>

<script>
partytown = {
logCalls: true,
logGetters: true,
logSetters: true,
logStackTraces: false,
logScriptExecution: true,
};
</script>
<script src="/~partytown/partytown.debug.js" async defer></script>
</body>
</html>
Loading

1 comment on commit f47ee51

@vercel
Copy link

@vercel vercel bot commented on f47ee51 Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.