Skip to content

Commit 4b02f0d

Browse files
author
Peng.Cao
committed
typescript support
1 parent 3dde3a7 commit 4b02f0d

File tree

2 files changed

+338
-0
lines changed

2 files changed

+338
-0
lines changed

index.d.ts

Lines changed: 337 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
declare module "instabug-reactnative" {
2+
type InvocationEventKey =
3+
| "none"
4+
| "shake"
5+
| "screenshot"
6+
| "twoFingersSwipe"
7+
| "floatingButton";
8+
type InvocationEvent = any;
9+
type InvocationEventEnum = { [key in InvocationEventKey]: InvocationEvent };
10+
const invocationEvent: InvocationEventEnum;
11+
12+
type ReproStepsModeKey = "enabled" | "disabled" | "enabledWithNoScreenshots";
13+
type ReproStepsMode = any;
14+
type ReproStepsModeEnum = { [key in ReproStepsModeKey]: ReproStepsMode };
15+
const reproStepsMode: ReproStepsModeEnum;
16+
17+
type DismissTypeKey = "submit" | "cancel" | "addAttachment";
18+
type DismissType = any;
19+
type DismissTypeEnum = { [key in DismissTypeKey]: DismissType };
20+
const dismissType: DismissTypeEnum;
21+
22+
type ReportTypeKey = "bug" | "feedback";
23+
type ReportType = any;
24+
type ReportTypeEnum = { [key in ReportTypeKey]: ReportType };
25+
const reportType: ReportTypeEnum;
26+
27+
type InvocationModeKey =
28+
| "NA"
29+
| "newBug"
30+
| "newFeedback"
31+
| "newChat"
32+
| "chatsList";
33+
type InvocationMode = any;
34+
type InvocationModeEnum = { [key in InvocationModeKey]: InvocationMode };
35+
const invocationMode: InvocationModeEnum;
36+
37+
type ExtendedBugReportModeKey =
38+
| "enabledWithRequiredFields"
39+
| "enabledWithOptionalFields"
40+
| "disabled";
41+
type ExtendedBugReportMode = any;
42+
type ExtendedBugReportModeEnum = {
43+
[key in ExtendedBugReportModeKey]: ExtendedBugReportMode
44+
};
45+
const extendedBugReportMode: ExtendedBugReportModeEnum;
46+
47+
type LocaleKey =
48+
| "arabic"
49+
| "chineseSimplified"
50+
| "chineseTraditional"
51+
| "czech"
52+
| "danish"
53+
| "dutch"
54+
| "english"
55+
| "french"
56+
| "german"
57+
| "italian"
58+
| "japanese"
59+
| "polish"
60+
| "portugueseBrazil"
61+
| "russian"
62+
| "spanish"
63+
| "swedish"
64+
| "turkish";
65+
type Locale = any;
66+
type LocaleEnum = { [key in LocaleKey]: Locale };
67+
const locale: LocaleEnum;
68+
69+
type ColorThemeKey = "light" | "dark";
70+
type ColorTheme = any;
71+
type ColorThemeEnum = { [key in ColorThemeKey]: ColorTheme };
72+
const colorTheme: ColorThemeEnum;
73+
74+
type FloatingButtonEdgeKey = "left" | "right";
75+
type FloatingButtonEdge = any;
76+
type FloatingButtonEdgeEnum = {
77+
[key in FloatingButtonEdgeKey]: FloatingButtonEdge
78+
};
79+
const floatingButtonEdge: FloatingButtonEdgeEnum;
80+
81+
type IBGPositionKey = "bottomRight" | "topRight" | "bottomLeft" | "topLeft";
82+
type IBGPosition = any;
83+
type IBGPositionEnum = { [key in IBGPositionKey]: IBGPosition };
84+
const IBGPosition: IBGPositionEnum;
85+
86+
type ActionTypesKey =
87+
| "allActions"
88+
| "reportBug"
89+
| "requestNewFeature"
90+
| "addCommentToFeature";
91+
type ActionTypes = any;
92+
type ActionTypesEnum = { [key in ActionTypesKey]: ActionTypes };
93+
const actionTypes: ActionTypesEnum;
94+
95+
type StringsKey =
96+
| "shakeHint"
97+
| "swipeHint"
98+
| "edgeSwipeStartHint"
99+
| "startAlertText"
100+
| "invalidEmailMessage"
101+
| "invalidEmailTitle"
102+
| "invalidCommentMessage"
103+
| "invalidCommentTitle"
104+
| "invocationHeader"
105+
| "talkToUs"
106+
| "reportBug"
107+
| "reportFeedback"
108+
| "emailFieldHint"
109+
| "commentFieldHintForBugReport"
110+
| "commentFieldHintForFeedback"
111+
| "addVideoMessage"
112+
| "addVoiceMessage"
113+
| "addImageFromGallery"
114+
| "addExtraScreenshot"
115+
| "audioRecordingPermissionDeniedTitle"
116+
| "audioRecordingPermissionDeniedMessage"
117+
| "microphonePermissionAlertSettingsButtonText"
118+
| "recordingMessageToHoldText"
119+
| "recordingMessageToReleaseText"
120+
| "conversationsHeaderTitle"
121+
| "screenshotHeaderTitle"
122+
| "chatsNoConversationsHeadlineText"
123+
| "doneButtonText"
124+
| "okButtonText"
125+
| "cancelButtonText"
126+
| "thankYouText"
127+
| "audio"
128+
| "video"
129+
| "image"
130+
| "chatsHeaderTitle"
131+
| "team"
132+
| "messageNotification"
133+
| "messagesNotificationAndOthers"
134+
| "conversationTextFieldHint"
135+
| "collectingDataText"
136+
| "thankYouAlertText";
137+
type Strings = any;
138+
type StringsEnum = { [key in StringsKey]: Strings };
139+
const strings: StringsEnum;
140+
141+
function startWithToken(
142+
token: string,
143+
invocationEvent: InvocationEvent
144+
): void;
145+
146+
function invoke(): void;
147+
148+
function invokeWithInvocationMode(invocationMode: InvocationMode): void;
149+
150+
function dismiss(): void;
151+
152+
function setUserData(userData: string): void;
153+
154+
function setAutoScreenRecordingEnabled(
155+
autoScreenRecordingEnabled: boolean
156+
): void;
157+
158+
function setAutoScreenRecordingMaxDuration(
159+
autoScreenRecordingMaxDuration: number
160+
): void;
161+
162+
function IBGLog(log: string): void;
163+
164+
function setUserStepsEnabled(isUserStepsEnabled: boolean): void;
165+
166+
function setCrashReportingEnabled(enableCrashReporter: boolean): void;
167+
168+
function setPreSendingHandler(preSendingHandler: Function): void;
169+
170+
function showSurveyWithToken(surveyToken: string): void;
171+
172+
function hasRespondedToSurveyWithToken(
173+
surveyToken: string,
174+
surveyTokenCallback: Function
175+
): void;
176+
177+
function setSessionProfilerEnabled(sessionProfilerEnabled: boolean): void;
178+
179+
function setPreInvocationHandler(preInvocationHandler: Function): void;
180+
181+
function setPostInvocationHandler(postInvocationHandler: Function): void;
182+
183+
function showIntroMessage(): void;
184+
185+
function setUserEmail(userEmail: string): void;
186+
187+
function setUserName(userName: string): void;
188+
189+
function setWillSkipScreenshotAnnotation(
190+
willSkipScreenshotAnnotation: boolean
191+
): void;
192+
193+
function getUnreadMessagesCount(messageCountCallback: Function): void;
194+
195+
function setInvocationEvent(invocationEvent: InvocationEvent): void;
196+
197+
function setPushNotificationsEnabled(
198+
isPushNotificationEnabled: boolean
199+
): void;
200+
201+
function setEmailFieldRequired(isEmailFieldRequired: boolean): void;
202+
203+
function setEmailFieldRequiredForActions(
204+
isEmailFieldRequired: boolean,
205+
actionTypes: Partial<ActionTypes>
206+
): void;
207+
208+
function setCommentFieldRequired(isCommentFieldRequired: boolean): void;
209+
210+
function setShakingThresholdForIPhone(
211+
iPhoneShakingThreshold: number,
212+
iPadShakingThreshold: number
213+
): void;
214+
215+
function setShakingThresholdForAndroid(androidThreshold: number): void;
216+
217+
function setFloatingButtonEdge(
218+
floatingButtonEdge: FloatingButtonEdge,
219+
offsetFromTop: number
220+
): void;
221+
222+
function setLocale(locale: Locale): void;
223+
224+
function setIntroMessageEnabled(isIntroMessageEnabled: boolean): void;
225+
226+
function setColorTheme(colorTheme: ColorTheme): void;
227+
228+
function setPrimaryColor(primaryColor: string): void;
229+
230+
function appendTags(tags: string[]): void;
231+
232+
function resetTags(): void;
233+
234+
function getTags(tagsCallback: Function): void;
235+
236+
function setStringToKey(string: string, key: Strings): void;
237+
238+
function setAttachmentTypesEnabled(
239+
screenshot: boolean,
240+
extraScreenshot: boolean,
241+
galleryImage: boolean,
242+
voiceNote: boolean,
243+
screenRecording: boolean
244+
): void;
245+
246+
function setEnabledAttachmentTypes(
247+
screenshot: boolean,
248+
extraScreenshot: boolean,
249+
galleryImage: boolean,
250+
voiceNote: boolean,
251+
screenRecording: boolean
252+
): void;
253+
254+
function setChatNotificationEnabled(isChatNotificationEnabled: boolean): void;
255+
256+
function setOnNewMessageHandler(onNewMessageHandler: Function): void;
257+
258+
function isInstabugNotification(
259+
dict: Object,
260+
isInstabugNotificationCallback: Function
261+
): void;
262+
263+
function identifyUserWithEmail(email: string, name: string): void;
264+
265+
function logOut(): void;
266+
267+
function setReportCategories(titles: any[]): void;
268+
269+
function setExtendedBugReportMode(
270+
extendedBugReportMode: ExtendedBugReportMode
271+
): void;
272+
273+
function logUserEventWithName(name: string): void;
274+
275+
function logUserEventWithNameAndParams(name: string, params: Object): void;
276+
277+
function logVerbose(message: string): void;
278+
279+
function logInfo(message: string): void;
280+
281+
function logDebug(message: string): void;
282+
283+
function logError(message: string): void;
284+
285+
function logWarn(message: string): void;
286+
287+
function setReproStepsMode(reproStepsMode: ReproStepsMode): void;
288+
289+
function setUserAttribute(key: string, value: string): void;
290+
291+
function getUserAttribute(key: string, userAttributeCallback: Function): void;
292+
293+
function removeUserAttribute(key: string): void;
294+
295+
function getAllUserAttributes(userAttributesCallback: Function): void;
296+
297+
function clearAllUserAttributes(): void;
298+
299+
function setViewHierarchyEnabled(viewHierarchyEnabled: boolean): void;
300+
301+
function setSurveysEnabled(surveysEnabled: boolean): void;
302+
303+
function showSurveysIfAvailable(): void;
304+
305+
function setWillShowSurveyHandler(willShowSurveyHandler: Function): void;
306+
307+
function setDidDismissSurveyHandler(didDismissSurveyHandler: Function): void;
308+
309+
function setPromptOptionsEnabled(chat: boolean, bug: boolean, feedback: boolean): void;
310+
311+
function setDebugEnabled(isDebugEnabled: boolean): void;
312+
313+
function enable(): void;
314+
315+
function disable(): void;
316+
317+
function isRunningLive(runningLiveCallBack: Function): void;
318+
319+
function setSuccessDialogEnabled(enabled: boolean): void;
320+
321+
function setEnableInAppNotificationSound(shouldPlaySound: boolean): void;
322+
323+
function reportJSException(errorObject: Object): void;
324+
325+
function setVideoRecordingFloatingButtonPosition(position: IBGPosition): void;
326+
327+
function setThresholdForReshowingSurveyAfterDismiss(
328+
sessionCount: number,
329+
daysCount: number
330+
): void;
331+
332+
function setAutoShowingSurveysEnabled(autoShowingSurveysEnabled: boolean): void;
333+
334+
function showFeatureRequests(): void;
335+
336+
function setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen: boolean): void;
337+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "8.0.18",
44
"description": "React Native plugin for integrating the Instabug SDK",
55
"main": "index.js",
6+
"type": "index.d.ts",
67
"repository": {
78
"type": "git",
89
"url": "git+https://github.com/Instabug/instabug-reactnative.git"

0 commit comments

Comments
 (0)