0.0.9 • Published 6 years ago
@smiledev/react-web-feedback v0.0.9
Using React
Installation
- Install from NPM
npm install @smiledev/react-web-feedback@latestUsage
- Import FeedbackButton and handlers (optional) in your project. Prop
tokenis provided by Smile.
import FeedbackButton from "@smiledev/react-web-feedback/dist/FeedbackButton"
<FeedbackButton token={'******'} />Handlers
You can interact with Smile Feedback with the following handlers
showModal
Shows the Feedback modal.
import { showModal } from "@smiledev/react-web-feedback/dist/FeedbackButton";
showModal(); // Open modalhideModal
Hides the Feedback modal.
import { hideModal } from "@smiledev/react-web-feedback/dist/FeedbackButton";
hideModal(); // Hide modalgetUserContext
Returns the user context currently known by Feedback Button.
import { getUserContext } from "@smiledev/react-web-feedback/dist/FeedbackButton";
getUserContext(); // { ... }setUserContext
Updates the user context to Feedback Button.
import { setUserContext } from "@smiledev/react-web-feedback/dist/FeedbackButton";
setUserContext({
id: 1,
first_name: 'Bruce',
last_name: 'Wayne'
});