We have lots of javascript code that blindly invokes window.Intercom(...) expecting that it's a function. The assumption that window.Intercom is always a function breaks down, when IntercomRails::AutoInclude::Filter is evaluated to exclude javascript, which results in JS runtime error.
How?
This PR adds a configurable callback method on a controller for case when IntercomRails::AutoInclude::Filter excludes javascript. Within the controller callback, a shim can be added to ensure that window.Intercom is indeed a function.
Why?
We have lots of javascript code that blindly invokes
window.Intercom(...)
expecting that it's a function. The assumption thatwindow.Intercom
is always a function breaks down, whenIntercomRails::AutoInclude::Filter
is evaluated to exclude javascript, which results in JS runtime error.How?
This PR adds a configurable callback method on a controller for case when
IntercomRails::AutoInclude::Filter
excludes javascript. Within the controller callback, a shim can be added to ensure thatwindow.Intercom
is indeed a function.