-
Notifications
You must be signed in to change notification settings - Fork 128
/
RNZendeskChat.d.ts
110 lines (97 loc) · 3.47 KB
/
RNZendeskChat.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
declare module "react-native-zendesk-chat" {
interface VisitorInfoOptions {
name?: string;
email?: string;
phone?: string;
}
interface MessagingOptionsCommon {
/** Set this to set the bot's displayName */
botName?: string;
}
interface MessagingOptions_iOS extends MessagingOptionsCommon {
/** Will be loaded using [UIImage imageWithName:…] ) */
botAvatarName?: string;
/** Will be loaded using [UIImage imageWithData:[NSData dataWithContentsOfUrl:…]] */
botAvatarUrl?: string;
}
interface MessagingOptions_Android extends MessagingOptionsCommon {
/** Will be loaded from your native asset resources */
botAvatarDrawableId?: number;
}
/** Current default is "optional" */
type PreChatFormFieldOptionVisibility = "hidden" | "optional" | "required";
interface StartChatOptions extends VisitorInfoOptions {
department?: string;
tags?: string[];
behaviorFlags?: {
/**
* if omitted, the form is enabled
*
* @warning Android: If you enable preChat form with `required` or `optional` for keys
* Then any visitor info you provide statically as VisitorInfoOptions will be ignored.
* This is documented upstream here: https://support.zendesk.com/hc/en-us/articles/360055343673
*/
showPreChatForm?: boolean;
/** if omitted, the prompt is enabled */
showChatTranscriptPrompt?: boolean;
/** if omitted, the form is enabled */
showOfflineForm?: boolean;
/** if omitted, the agent availability message is enabled */
showAgentAvailability?: boolean;
};
/**
* If omitted, the preChatForm will be left as default in Zendesk, be explicit if you want control.
*
* @warning Android: If you provide the preChat form with `required` or `optional` for keys
* Then any visitor info you provide statically as VisitorInfoOptions will be ignored.
* This is documented upstream here: https://support.zendesk.com/hc/en-us/articles/360055343673
*/
preChatFormOptions?: {
/** Should we ask the user for a contact email? */
email?: PreChatFormFieldOptionVisibility;
/** Should we ask the user their name? */
name?: PreChatFormFieldOptionVisibility;
/** Should we ask the user for their phone number? */
phone?: PreChatFormFieldOptionVisibility;
/** Should we ask the user which department? */
department?: PreChatFormFieldOptionVisibility;
};
/**
* Configure the Chat-Bot (if any)
*/
messagingOptions?: MessagingOptions_iOS & MessagingOptions_Android;
/**
* If not provided, this will be "Close" -- not localized!
*
* -- iOS Only (Android: shows just a Back Button)
*/
localizedDismissButtonTitle?: string;
}
class RNZendeskChatModuleImpl {
/**
* Must be called before calling startChat/setVisitorInfo
* - (Advanced users may configure this natively instead of calling this from JS)
*/
init: (zendeskAccountKey: string, appId?: string) => void;
/**
* Presents the Zendesk Chat User Interface
*/
startChat: (options: StartChatOptions) => void;
/**
* Backwards Compatibility!
* - You can pass all these parameters to RNZendeskChatModule.startChat
* - So you should probably prefer that method
*/
setVisitorInfo: (options: VisitorInfoOptions) => void;
/**
* Configure the token to start receiving Push Notifications
*/
registerPushToken: (token: string) => void;
/**
* Check if there are available agents
*/
areAgentsOnline: () => Promise<Boolean>;
}
const RNZendeskChatModule: RNZendeskChatModuleImpl;
export default RNZendeskChatModule;
}