Skip to content

Commit d0baaeb

Browse files
authored
Merge pull request #526 from Instabug/feature/typescript-validation
[MOB-4605] Typescript Definition Validation
2 parents b4eb79f + a201005 commit d0baaeb

File tree

8 files changed

+319
-28
lines changed

8 files changed

+319
-28
lines changed

.circleci/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616

1717
- run: yarn
1818

19+
- run:
20+
name: Typescript Definitions Validation
21+
command: node typescript_validator.js
22+
1923
- run:
2024
name: jest tests
2125
command: |

index.d.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,24 @@ export namespace BugReporting {
77
function setEnabled(isEnabled: boolean): void;
88
function setInvocationEvents(invocationEvents: invocationEvent[]): void;
99
function setInvocationOptions(invocationOptions: invocationOptions[]): void;
10+
function setOptions(options: invocationOptions[]): void;
1011
function onInvokeHandler(handler: () => void): void;
11-
function onReportSubmitHandler(preSendingHandler: () => void): void;
1212
function onSDKDismissedHandler(
1313
handler: (dismiss: dismissType, report: reportType) => void
1414
): void;
1515
function setDidSelectPromptOptionHandler(
1616
didSelectPromptOptionHandler: () => void
1717
): void;
18+
function setFloatingButtonEdge(
19+
floatingButtonEdge: number,
20+
offsetFromTop: number
21+
): void;
22+
function setEnabledAttachmentTypes(
23+
screenshot: boolean,
24+
extraScreenshot: boolean,
25+
galleryImage: boolean,
26+
screenRecording: boolean
27+
): void;
1828
function setShakingThresholdForiPhone(iPhoneShakingThreshold: number): void;
1929
function setShakingThresholdForiPad(iPadShakingThreshold: number): void;
2030
function setShakingThresholdForAndroid(androidThreshold: number): void;
@@ -24,8 +34,11 @@ export namespace BugReporting {
2434
function setReportTypes(types: reportType[]): void;
2535
function showWithOptions(type: reportType, options: option[]): void;
2636
function show(type: reportType, options: option[]): void;
27-
function setAutoScreenRecordingEnabled(isEnabled: boolean): void;
28-
function setViewHierarchyEnabled(isEnabled: boolean): void;
37+
function setAutoScreenRecordingEnabled(autoScreenRecordingEnabled: boolean): void;
38+
function setAutoScreenRecordingMaxDuration(
39+
autoScreenRecordingMaxDuration: number
40+
): void;
41+
function setViewHierarchyEnabled(viewHierarchyEnabled: boolean): void;
2942
enum invocationEvent {
3043
none,
3144
shake,
@@ -62,7 +75,7 @@ export namespace Chats {
6275
}
6376
export namespace CrashReporting {
6477
function setEnabled(isEnabled: boolean): void;
65-
function reportJSException(Exception: object): void;
78+
function reportJSException(errorObject: object): void;
6679
}
6780
export namespace FeatureRequests {
6881
function setEmailFieldRequired(
@@ -72,8 +85,6 @@ export namespace FeatureRequests {
7285
function setEnabled(isEnabled: boolean): void;
7386
function show(): void;
7487
enum actionTypes {
75-
allActions,
76-
reportBug,
7788
requestNewFeature,
7889
addCommentToFeature
7990
}
@@ -146,6 +157,14 @@ export namespace APM {
146157
function startUITrace(name: string): void;
147158
function endUITrace(): void;
148159
function setLogLevel(logLevel: logLevel): void;
160+
enum logLevel {
161+
none,
162+
error,
163+
warning,
164+
info,
165+
debug,
166+
verbose,
167+
}
149168
}
150169
export function startWithToken(
151170
token: string,
@@ -229,7 +248,7 @@ export function setDebugEnabled(isDebugEnabled: boolean): void;
229248
export function enable(): void;
230249
export function disable(): void;
231250
export function setEnableInAppNotificationSound(shouldPlaySound: boolean): void;
232-
export function reportJSException(Exception: object): void;
251+
export function reportJSException(errorObject: object): void;
233252
export function isRunningLive(runningLiveCallBack: () => void): void;
234253
export function setVideoRecordingFloatingButtonPosition(
235254
position: IBGPosition
@@ -293,14 +312,6 @@ export enum sdkDebugLogsLevel {
293312
sdkDebugLogsLevelError,
294313
sdkDebugLogsLevelNone,
295314
}
296-
export enum logLevel {
297-
none,
298-
error,
299-
warning,
300-
info,
301-
debug,
302-
verbose,
303-
}
304315
export enum extendedBugReportMode {
305316
enabledWithRequiredFields,
306317
enabledWithOptionalFields,
@@ -362,7 +373,7 @@ export enum strings {
362373
invalidCommentMessage,
363374
invalidCommentTitle,
364375
invocationHeader,
365-
talkToUs,
376+
startChats,
366377
reportQuestion,
367378
reportBug,
368379
reportFeedback,

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ const InstabugModule = {
251251
* Sets the color of UI elements indicating interactivity or call to action.
252252
* To use, import processColor and pass to it with argument the color hex
253253
* as argument.
254-
* @param {color} primaryColor A color to set the UI elements of the SDK to.
254+
* @param {color} color A color to set the UI elements of the SDK to.
255255
*/
256-
setPrimaryColor(primaryColor) {
257-
Instabug.setPrimaryColor(processColor(primaryColor));
256+
setPrimaryColor(color) {
257+
Instabug.setPrimaryColor(processColor(color));
258258
},
259259

260260
/**
@@ -646,7 +646,7 @@ const InstabugModule = {
646646
* @deprecated use {@link CrashReporting.reportJSException}
647647
* Send handled JS error object
648648
*
649-
* @param errorObject Error object to be sent to Instabug's servers
649+
* @param errorObject Error object to be sent to Instabug's servers
650650
*/
651651

652652
reportJSException(errorObject) {

modules/APM.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default {
3333
* logLevelInfo will include logLevelInfo logs as well as logLevelWarning
3434
* and logLevelError logs.
3535
36-
* @param {logLevel} the printed logs priority.
36+
* @param {logLevel} logLevel the printed logs priority.
3737
*/
3838
setLogLevel(logLevel) {
3939
IBGAPM.setLogLevel(logLevel);

modules/CrashReporting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default {
2121
/**
2222
* Send handled JS error object
2323
*
24-
* @param errorObject Error object to be sent to Instabug's servers
24+
* @param errorObject Error object to be sent to Instabug's servers
2525
*/
2626
reportJSException: function(errorObject) {
2727
let jsStackTrace = InstabugUtils.parseErrorStack(errorObject);

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
"react": "^16.8.6",
4141
"react-native": "^0.59.8",
4242
"sinon": "^7.3.2",
43-
"wait-for-expect": "^1.2.0"
43+
"wait-for-expect": "^1.2.0",
44+
"esprima": "^4.0.1",
45+
"typescript": "^4.0.3"
4446
},
4547
"jest": {
4648
"preset": "react-native",

0 commit comments

Comments
 (0)