0.0.9 • Published 4 years ago
@smiledev/react-web-feedback v0.0.9
Using React
Installation
- Install from NPM
npm install @smiledev/react-web-feedback@latest
Usage
- Import FeedbackButton and handlers (optional) in your project. Prop
token
is 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 modal
hideModal
Hides the Feedback modal.
import { hideModal } from "@smiledev/react-web-feedback/dist/FeedbackButton";
hideModal(); // Hide modal
getUserContext
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'
});