Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐞] Intercom does not work with party town #602

Open
dbelouslv opened this issue Jun 19, 2024 · 4 comments
Open

[🐞] Intercom does not work with party town #602

dbelouslv opened this issue Jun 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@dbelouslv
Copy link

dbelouslv commented Jun 19, 2024

Describe the bug

Good morning! I have a problem with Intercom and partytown. These lines from head. If I remove patrytown scripts and type="text/partytown" Intercom works.

 <script>
     partytown = {
         forward: ['Intercom']
     };
 </script>

 <script type="module" src="/~partytown/partytown.js"></script>
 
 <script type="text/partytown">
    window.intercomSettings = {
        api_base: "https://api-iam.intercom.io",
        app_id: "xxx",
    };
</script>

<script type="text/partytown">
    (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/xxx'; 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>

image

And vite.config.js example:

export default defineConfig({
    base: '/',
    plugins: [
        vue({
            template: {
                compilerOptions: {
                    whitespace: 'preserve'
                }
            }
        }),
        partytownVite({
            dest: fileURLToPath(new URL("./public/~partytown", import.meta.url)),
        })
    ]
});

Reproduction

''

Steps to reproduce

Open the website

Browser Info

Chrome last version, in Mozilla it works

Additional Information

Vite: 5.1.3
Vuejs 3.4.19

@dbelouslv dbelouslv added the bug Something isn't working label Jun 19, 2024
@corymharper
Copy link

Just ran into this myself, any workarounds?

@anoam99
Copy link

anoam99 commented Aug 26, 2024

Same here...
any updates?

@AnaIftimie
Copy link

AnaIftimie commented Sep 27, 2024

Confirm, I'm having the same problem, with Intercom:
image
I made a code pen here or a fiddle here while I was testing this issue using Intercom and Userway, but as @dbelouslv said changing the type to simple javascript and the widgets show. With the type to partytown nothing works. Any updates?

@adamkoch
Copy link

Did anyone get this working? I guess Intercom js updated and it's no longer compatible with partytown?

I am getting similar errors, the exact error is in the apply() here:

try {
  let target = environments[$winId$].$window$;
  let i = 0;
  let l = len($forward$);
  for (; i < l; i++) {
    i + 1 < l
      ? (target = target[$forward$[i]])
      : target[$forward$[i]].apply(
          target,
          deserializeFromMain(null, $winId$, [], $args$)
        );
  }
} catch (e) {
  console.error(e);
}

Error is:

TypeError: Cannot read properties of undefined (reading 'apply')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants