Integrate Feedback Widget Using Vue
To integrate an Olvy widget in your application you will need to do the following:
Project setup
Install @olvyhq/widget-vue
npm install @olvyhq/widget-vue
Getting Started
On main.js
import { createApp } from 'vue'
import App from './App.vue'
import olvyWidget from '@olvyhq/widget-vue'
const app =createApp(App)
app.use(olvyWidget)
app.mount('#app')How to use
<olvy-widget :config="<Configuration>" >
<div id="Target-Element-Id"> </div>
</olvy-widget>Replace Target-Element-Id with your target element id and with your configuration.
Example:
<olvy-widget :config="{workspaceAlias: 'olvysdktest'}" >
<div id="olvy-whats-new">Announcement Widget</div>
</olvy-widget>Customize Configuration
{
widgetId:"", // (optional)
workspaceAlias:"" //(required)
}Configuration
{ widgetId:"", // (optional) workspaceAlias:"" //(required)}
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
Integrate with Nuxt 3
If you're looking to integrate the widget with Nuxt 3, we have a codesandbox demo that you can check out.
As the widget is for vue, you can refer the vue-plugin section of the docs for more information.
Methods
To show widget
showWidget(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To hide widget
hideWidget(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To set user
setUser(workspaceAlias, userObject)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| userObject | string | Required. |
To set feedback meta info
setFeedbackMetaInfo (workspaceAlias, metaInfo)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| metaInfo | string | Required. |
To refresh unread count
refreshUnreadCount(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To show unread releases count
getUnreadReleasesCount(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To remove unread indicator element
removeUnreadIndicatorElement(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To add unread indicator element
addUnreadIndicatorElement(workspaceAlias,widgetAliasOrID, count)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To get last opened timestamp
getLastOpenedTimestamp(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To refresh the widget
refresh(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To teardown the widget
teardown(workspaceAlias,widgetAliasOrID)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| widgetAliasOrID | string | Required. widget Id or alias ( you can find it on widget details page in olvy dashbaord ) |
To create feedback
createFeedback(workspaceAlias,params)
| Parameter | Type | Description |
|---|---|---|
| workspaceAlias | string | Required. Your subdomain |
| params | object | Required. |
Note: In case you have to unmount & mount the widget component for some reason, you will have to call the refresh method of the widget to re-initialize it.
Demo
Here's a link to the codesandbox demo so you can see a quick implementation.
That's it. That's how you can integrate Olvy in your Vue app. If you face any issues while integrating feel free to reach out to us on support@olvy.co and we will help you integrate Olvy into your application.