rhanb / nativescript-zendesk-chat-ui

Apache License 2.0
2 stars 0 forks source link

NativeScript Zendesk Chat UI

Exposes Zendesk Chat SDK for iOS and Android.

Installation

Describe your plugin installation steps. Ideally it would be something like:

tns plugin add nativescript-zendesk-chat-ui

Usage

ZendeskChatUi.initialize(key); // your key here
ZendeskChatUi.startChat(); // start a chat

API

ZendeskChatUi

Method Default Description
startChat(chatConfig?: ChatConfig) null Start a chat with a chat configuration.
initialize(accountKey: string) null your zendesk chat account key. required.
trackEvent(eventDescription: string) null track event.
Property Default Description
visitorInfo: VisitorInfo null set user's the email, name, phone number, note.
chatOverlayEnabled: boolean true hide the chat overlay. iOS only

VisitorInfo

export interface VisitorInfo {
  name?: string;
  email?: string;
  phoneNumber?: string;
  note?: string;
}

ChatConfig

export interface ChatConfig {
  department?: string;
  tags?: string[];
  uploadAttachmentsEnabled?: boolean; // ios only
  preChatDataRequirements?: { // required fields the user will have to fill
    department: PreChatDataRequirement;
    email: PreChatDataRequirement;
    message: PreChatDataRequirement;
    name: PreChatDataRequirement;
    phone: PreChatDataRequirement;
  };
}

PreChatDataRequirement

export enum PreChatDataRequirement {
  NotRequired = 0,
  Optional = 1,
  Required = 2,
  OptionalEditable = 3,
  RequiredEditable = 4
}

Customization

For customization, please refer to the iOS and Android documentation.

License

Apache License Version 2.0, January 2004