1.1.1 • Published 1 year ago

vue-papercups v1.1.1

Weekly downloads
31
License
MIT
Repository
github
Last release
1 year ago

vue-papercups

A Papercups chat widget component for Vue 3.

Installation

Install using NPM.

$ npm install --save vue-papercups

Add the vue-papercups component globally to your Vue 3 app.

// main.js
import VuePapercups from "vue-papercups";

app.use(VuePapercups);

Use in your component templates.

// App.vue

<vue-papercups account-id="your-papercups-account-id" />

Props

These are the props you can pass into your <vue-papercups /> component:

PropTypeValueDefault
accountIdstringYour Papercups account tokenN/A
titlestringThe title in the header of your chat widgetWelcome!
subtitlestringThe subtitle in the header of your chat widgetHow can we help you?
newMessagePlaceholderstringThe placeholder text in the new message inputStart typing...
emailInputPlaceholderstringThe placeholder text in the optional email inputEnter your email
newMessagesNotificationTextstringThe notification text when new messages arrive and the chat window is closedView new messages
primaryColorstringThe theme color of your chat widget1890ff
greetingstringAn optional initial message to greet your customers withN/A
showAgentAvailabilitybooleanIf you want to show whether you (or your agents) are online or notfalse
agentAvailableTextstringThe text shown when you (or your agents) are onlineWe're online right now!
agentUnavailableTextstringThe text shown when you (and your agents) are offlineWe're away at the moment.
customerobjectIdentifying information for the customer, including name, email, external_id, and metadata (for any custom fields)N/A
baseUrlstringThe base URL of your API if you're self-hosting Papercupshttps://app.papercups.io
iframeUrlOverridestringAn override of the iframe URL we use to render the chat, if you chose to self-host that as wellhttps://chat-widget.papercups.io
requireEmailUpfrontbooleanIf you want to require unidentified customers to provide their email before they can message youfalse
defaultIsOpenbooleanIf you want the chat widget to open as soon as it loadsfalse
customIconUrlstringA link to a custom icon image URLN/A

Events

EventTypeValueDefault
chatLoaded() => voidCallback fired when chat is loadedN/A
chatOpened() => voidCallback fired when chat is openedN/A
chatClosed() => voidCallback fired when chat is closedN/A
messageSent(message: Message) => voidCallback fired when message is sentN/A
messageReceived(message: Message) => voidCallback fired when message is receivedN/A
scriptLoaded(message: Message) => voidCallback fired when Papercups widget script loadsN/A
scriptError(message: Message) => voidCallback fired on Papercups widget script load errorN/A

For example:

// App.vue
<vue-papercups
  account-id="your-papercups-account-id"
  @chatLoaded="yourCallbackMethod"
/>

Global API

Use the global $papercups object to interact with the chat widget or get its current config in your Vue components.

// open chat
this.$papercups.open();

// close chat
this.$papercups.close();

// toggle chat
this.$papercups.toggle();

// show widget
this.$papercups.show();

// hide widget
this.$papercups.hide();

// create widget - call destroy first to avoid loading the widget script multiple times
this.$papercups.create();

// destroy widget
this.$papercups.destroy();

// get current config
const config = this.$papercups.config();

Used in

Tracknack

Relevant links

Papercups

Papercups chat widget repository

License

MIT © Viesturs Marnauza

Twitter

1.1.1

1 year ago

1.1.0

1 year ago

1.0.6

1 year ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago