-
Notifications
You must be signed in to change notification settings - Fork 56
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
Adding Messenger provider and component #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FateXRebirth thanks so much for creating this PR!
I'm not very familiar with Messenger but I've had a look through the PR and it looks close, we just need to tidy a few things up and look into some additional customisation options.
You said you've tested this in a Storybook, do you have a developer page you'd be willing to add details for in an implementation in the Storybook file? If not, would you mind adding the implementation with dummy keys, then other developers can update the keys to test it out.
@michaeldijkstra thanks so much for taking your time to review this PR and giving so many advices, I have adjusted some code and documentation, adding customization as well, please check it, thanks ! |
@FateXRebirth Thanks for updating. I've been testing this myself with a Facebook page and have noted a few things:
Snippet``` <script> window.fbAsyncInit = function() { FB.init({ xfbml : true, version : 'v6.0' }); };
|
@michaeldijkstra thanks for reminding, the following is the answer to your questions.
|
@FateXRebirth Ok Great! Let's update the |
@michaeldijkstra I have updated code and documentation, please inform me if you have other concern, thank you! |
@FateXRebirth I'm seeing the following error when loading messenger:
Do you see that too? |
@michaeldijkstra it seems like something wrong in the preload phase, no any other informations? it shouldn't occur when everything is set up, Did you test it with your FB app and page? There is a config in FB app or page about whitelist host, if you test it in storybook, the host will be I have that problem as well, But I test it in our website, it works perfectly. There are some configurations about FB app or page that user must adjust it by themself, which we can't set up for them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FateXRebirth Okay, I got this working! I had to configure the domain in Facebook and turn my adblocker off 🤦♂
I've suggested two additional changes. I'm happy to refactor createCustomerChat
into Messenger
if you don't have time, just let me know
Thanks again for all your work on this!
greetingDialogDelay = '', | ||
}) => { | ||
if(!document.querySelector('.fb-customerchat')) { | ||
const chat = window.document.createElement('div'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given this is a react plugin, and we've got the Messenger
component, what do you think about moving this to be output to JSX inside Messenger.js
?
This would involve creating a new hook to get the required props but I think it'd be a cleaner implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do it, your suggestion is great, I think you finish this would be better than me.
} | ||
|
||
const open = () => { | ||
window.FB.CustomerChat.show(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
window.FB.CustomerChat.show(false); | |
window.FB.CustomerChat.show(true); |
I believe this should be true
so that when a user clicks on the placeholder before it has loaded, we expand the chat widget once it has loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, please help me adjust this, thanks 👍
@michaeldijkstra Just an mention, I found that Thanks again for all your helps! |
@all-contributors please add @FateXRebirth for code |
I've put up a pull request to add @FateXRebirth! 🎉 |
Description
Related Issue
Related to issue #5
Motivation and Context
Since our project needs to use customer chat SDK for business purpose, but the version official provides make our website slow, so we want to create a proper provider and component using a mechanism like requestIdleCallback.
How Has This Been Tested?
Use storybook to test if it works properly
Screenshots (if appropriate):
Types of changes
Checklist: