Skip to content

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