-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
185 lines (168 loc) · 4.18 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
declare module '@idopterlabs/rn-zendesk' {
/**
* Initialize the SDK
* @param initializationOptions Startup and Access Settings
*
* @example
* ```ts
* RNZendesk.init({
* key: 'ip1MZws0A17aDjg8wjfs2sfQ8AeUJFe5',
* appId: 'd89309417eb165b6b5041234371c16a5bsjfc2f49a027b4c',
* clientId: 'mobile_sdk_client_9326b42367cca4c2d2f',
* url: 'https://MY_ZENDESK.zendesk.com',
* isEnabledLoggable: false,
* });
* ```
*/
export function init(initializationOptions: InitOptions): void;
/**
* Open the chat
* @param chatOptions Chat settings
*
* @example
* ```ts
* RNZendesk.startChat({});
* ```
*/
export function startChat(chatOptions: ChatOptions): void;
/**
* Open the ticket form
* @example
* ```ts
* RNZendesk.startTicket();
* ```
*/
export function startTicket(): void;
/**
* Open the page with all user tickets
* @example
* ```ts
* RNZendesk.showTicketList();
* ```
*/
export function showTicketList(): void;
/**
* Display chat if you have online agent or ticket form
* @param chatOptions Chat settings
*
* @example
* ```ts
* RNZendesk.startChatOrTicket({});
* ```
*/
export function startChatOrTicket(chatOptions: ChatOptions): void;
// Callback interface to request the generation of a new token in chat
export type CallbackRequestNewToken = () => void;
/**
* Set user identity for authentication when you want to use chat or ticket sdk
* @param chatOptions Chat settings
*
* @example
* ```ts
* RNZendesk.setUserIdentity({
* token: '1234567890abcdef',
* isEnabledJwtAuthenticator: true
* }, async () => {
* RNZendesk.updateUserToken('1234567890abcdef');
* });
* ```
*/
export function setUserIdentity(identity: Identity, onRequestNewToken: CallbackRequestNewToken): void;
/**
* Set a new token for the chat
* @param newToken Token string
*
* @example
* ```ts
* RNZendesk.updateUserToken('1234567890abcdef');
* ```
*/
export function updateUserToken(newToken: string): void;
/**
* Set primary color code for the chat theme
* @param color HEX Color String
*
* @example
* ```ts
* RNZendesk.setPrimaryColor('#3762ff');
* ```
*/
export function setPrimaryColor(color: string): void;
/**
* Open the help center
* @param chatOptions Chat settings
*
* @example
* ```ts
* RNZendesk.showHelpCenter({});
* ```
*/
export function showHelpCenter(chatOptions: ChatOptions): void;
/**
* Set visitor info in chat
* @param visitorInfo User info
*
* @example
* ```ts
* RNZendesk.setVisitorInfo({});
* ```
*/
export function setVisitorInfo(visitorInfo: UserInfo): void;
/**
* Register notifications token with zendesk
* @param token Token string
*
* @example
* ```ts
* RNZendesk.setNotificationToken('123456');
* ```
*/
export function setNotificationToken(token: string): void;
export interface ChatOptions {
// Name bot
botName?: string
// Show only chat without support, answer bot
chatOnly?: boolean
// Sent in help center function only to show help center with chat
withChat?: boolean
// Disable ticket creation in help center
disableTicketCreation?: boolean
}
export interface InitOptions {
// Chat key of zendesk account to init chat
key: string,
// AppId of your zendesk account
appId: string,
// ClientId of your zendesk account
clientId: string,
// Support url of zendesk account
url: string,
// Enable debug mode of zendesk sdk
isEnabledLoggable?: boolean,
}
export interface IdentityUser {
// User name
name: string,
// User email
email: string,
}
export interface IdentityJwt {
// JWT token
token: string,
// Enabled jwt authentication in chat
isEnabledJwtAuthenticator?: boolean,
}
export interface UserInfo {
// User's name
name?: string
// User's email
email?: string
// User's phone
phone?: number
// Department to redirect the chat
department?: string
// Tags for chat
tags?: Array<string>
}
export type Identity = IdentityJwt | IdentityUser;
}