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

fix: relay IntercomAPI secondary arguments (2.0) #77

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

nikparo
Copy link

@nikparo nikparo commented Oct 25, 2019

Currently the secondary arguments of IntercomAPI in 2.0 get passed through as an array, meaning that e.g. onShow and onHide won't work. I.e.

window.Intercom.apply(null, [method, args]);

Should be:

window.Intercom.apply(null, [method, ...args]);

However, with the above fix npm run build throws an error:

Error: '__spreadArrays' is not exported by tslib

This may be solvable by updating the correct packages. Alternatively, the code can be written as it is in this pull request or something like:

export default function(method: string, ...args: Array<any>) {
  if (window.Intercom) {
    args.unshift(method);
    window.Intercom.apply(null, args);
  } else {
    console.warn('Intercom not initialized yet');
  }
}

@nikparo nikparo changed the title fix: relay IntecomAPI secondary arguments fix: relay IntercomAPI secondary arguments Oct 25, 2019
@nikparo nikparo changed the title fix: relay IntercomAPI secondary arguments fix: relay IntercomAPI secondary arguments (2.0) Oct 28, 2019
@nikparo nikparo mentioned this pull request Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant