Skip to content

Commit 2709b40

Browse files
committed
Manually add a TypeScript Types Definition File
1 parent 86dea1f commit 2709b40

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

RNZendeskChat.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
declare module "react-native-zendesk-chat" {
2+
interface VisitorInfoOptions {
3+
name?: string;
4+
email?: string;
5+
phone?: string;
6+
7+
/** only implemented on iOS */
8+
shouldPersist?: boolean;
9+
}
10+
interface StartChatOptions_iOS extends VisitorInfoOptions {
11+
department?: string;
12+
tags?: string[];
13+
14+
// Flags to disable some fields collected by default.
15+
emailNotRequired?: boolean;
16+
phoneNotRequired?: boolean;
17+
departmentNotRequired?: boolean;
18+
messageNotRequired?: boolean;
19+
}
20+
type StartChatOptions_Android = VisitorInfoOptions;
21+
type StartChatOptions = StartChatOptions_iOS & StartChatOptions_Android;
22+
23+
class RNZendeskChatModuleImpl {
24+
init: (zendeskAccountKey: string) => void;
25+
26+
setVisitorInfo: (options: VisitorInfoOptions) => void;
27+
28+
startChat: (options: StartChatOptions) => void;
29+
}
30+
31+
const RNZendeskChatModule: RNZendeskChatModuleImpl;
32+
33+
export default RNZendeskChatModule;
34+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.3.1",
44
"description": "React Native Wrapper around Zopim Zendesk Chat",
55
"main": "index.js",
6+
"types": "RNZendeskChat.d.ts",
67
"repository": {
78
"type": "git",
89
"url": "https://github.com/taskrabbit/react-native-zendesk-chat"

0 commit comments

Comments
 (0)