Closed hassanasad closed 6 years ago
Currently, this is synchronous, so it can be statically analyzed by the compiler. If you have another suggestion of how to implement it, I'd be open to a PR.
How about we make the appId
optional in the .forRoot
method and instead pick it up from Intercom.boot({config})
? Can that work?
@wbhob Would it be possible that way ?
Actually I realized that even Intercom's regular code requires you to pass in an ID to the loading script. I can't think of a good way to do this. I don't really understand why you'd load the ID from the server, though. Even if someone does get your ID, you can just whitelist your app's domain and they can't get in.
@wbhob Thanks for looking into this.
I was wondering if we use the loadIntercom
function when you call intercom.boot()
method. Wont that work?
The benefit of getting appId
from API is that you do not need to hardcode it in your client side app. (I know that you can set it in environment and then use its build but if we can somehow capture it later in program life-cycle, it would be much more beneficial)
So you mean, defer loadIntercom until you (the consumer) calls it?
It's just that the config in forRoot doesn't just loadIntercom, but it is used by the Intercom provider and the directives to function properly, which is why it's hard to go outside of the module context. The way I have it in my apps is I just use environment variables. It's the fastest, most statically-analyzable way.
Yes. Call loadIntercom when user calls the intercom.boot method. Just a suggestion though. On Sun, Jan 21, 2018 at 9:31 PM Wilson Hobbs notifications@github.com wrote:
So you mean, defer loadIntercom until you (the consumer) calls it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CaliStyle/angular2-intercom/issues/28#issuecomment-359260931, or mute the thread https://github.com/notifications/unsubscribe-auth/AHOp0LNsh5mFWY5cIlhfBYJPk7iDJvK2ks5tM2ZkgaJpZM4RhDXv .
Perhaps in that case you bind a dummy Intercom object to window and on boot fire an event to trigger and essential stuff you do on loadintercom. On Sun, Jan 21, 2018 at 9:33 PM Hassan Asad hassanasad01@gmail.com wrote:
Yes. Call loadIntercom when user calls the intercom.boot method. Just a suggestion though. On Sun, Jan 21, 2018 at 9:31 PM Wilson Hobbs notifications@github.com wrote:
So you mean, defer loadIntercom until you (the consumer) calls it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CaliStyle/angular2-intercom/issues/28#issuecomment-359260931, or mute the thread https://github.com/notifications/unsubscribe-auth/AHOp0LNsh5mFWY5cIlhfBYJPk7iDJvK2ks5tM2ZkgaJpZM4RhDXv .
I know you want this too if you think it's possible to do. I read in a blog post for the inspiration behind this package 😊 On Sun, Jan 21, 2018 at 9:36 PM Hassan Asad hassanasad01@gmail.com wrote:
Perhaps in that case you bind a dummy Intercom object to window and on boot fire an event to trigger and essential stuff you do on loadintercom. On Sun, Jan 21, 2018 at 9:33 PM Hassan Asad hassanasad01@gmail.com wrote:
Yes. Call loadIntercom when user calls the intercom.boot method. Just a suggestion though. On Sun, Jan 21, 2018 at 9:31 PM Wilson Hobbs notifications@github.com wrote:
So you mean, defer loadIntercom until you (the consumer) calls it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CaliStyle/angular2-intercom/issues/28#issuecomment-359260931, or mute the thread https://github.com/notifications/unsubscribe-auth/AHOp0LNsh5mFWY5cIlhfBYJPk7iDJvK2ks5tM2ZkgaJpZM4RhDXv .
I'd be open to seeing a PR for this, but unfortunately, I don't really have time for this functionality. This seems like a pretty edge use case for simply hardcoding it in, which is the way everyone uses Intercom.
If you have multiple apps, you can check out this fork of our project: https://www.npmjs.com/package/ng-intercom-multi
This is available in the Intercom.id property. Closing
Is it possible to provide the {app_id} for intercom at a later stage? I have to pull that using an API call so its not available at boot time.
For that reason i dont have app_id to put here: