Skip to content

Commit 6ca9022

Browse files
authored
Release-v0.2.0: #Adding typescript support to the package
1 parent 239358d commit 6ca9022

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

index.d.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
declare module 'react-native-zendesk-v2' {
2+
3+
// function to display chat box
4+
export function startChat(chatOptions: ChatOptions): void;
5+
6+
// normal init function when you want to use all of the sdks
7+
export function init(initializationOptins: InitOptions): void;
8+
9+
// init function when you just want to use chat sdk
10+
export function initChat(accountKey: string): void;
11+
12+
// function to set primary color code for the chat theme, pass hex code of the color here
13+
export function setPrimaryColor(color: string): void;
14+
15+
// function to display help center UI
16+
export function showHelpCenter(chatOptions: ChatOptions): void;
17+
18+
// function to set visitor info in chat
19+
export function setVisitorInfo(visitorInfo: UserInfo): void;
20+
21+
interface ChatOptions extends UserInfo {
22+
botName?: string
23+
// boolean value if you want just chat sdk or want to use all the sdk like support, answer bot and chat
24+
// true value means just chat sdk
25+
chatOnly?: boolean
26+
// hex code color to set on chat
27+
color?: string
28+
/* help center specific props only */
29+
// sent in help center function only to show help center with/without chat
30+
withChat?: boolean
31+
// to enable/disable ticket creation in help center
32+
disableTicketCreation?: boolean
33+
}
34+
35+
interface InitOptions {
36+
// chat key of zendesk account to init chat
37+
key: string,
38+
// appId of your zendesk account
39+
appId: string,
40+
// clientId of your zendesk account
41+
clientId: string,
42+
// support url of zendesk account
43+
url: string,
44+
}
45+
46+
interface UserInfo {
47+
// user's name
48+
name: string
49+
// user's email
50+
email: string
51+
// user's phone
52+
phone?: number
53+
// department to redirect the chat
54+
department?: string
55+
// tags for chat
56+
tags?: Array<string>
57+
}
58+
59+
}

0 commit comments

Comments
 (0)