forked from flurry/react-native-flurry-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
346 lines (317 loc) · 13.4 KB
/
index.d.ts
File metadata and controls
346 lines (317 loc) · 13.4 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
declare module 'react-native-flurry-sdk' {
/**
* A React Native plugin for Flurry SDK.
* The Flurry agent allows you to track the usage and behavior of your application
* on users' devices for viewing in the Flurry Analytics system.
* Set of methods that allow developers to capture detailed, aggregate information
* regarding the use of their app by end users.
*/
interface FlurryStatic {
/**
* Initialize the Flurry SDK.
*
* There are two overloads,
* e.g. Flurry.init('FLURRY_API_KEY'); Flurry.init('FLURRY_ANDROID_API_KEY', 'FLURRY_IOS_API_KEY');
* - init(apikey)
* - init(apikeyAndroid, apikeyIos)
*
* @param apiKey1 Android User API Key.
* @param apiKey2 iOS User API Key.
* @deprecated Please use Flurry.Builder instead.
*/
init(apiKey1: string, apiKey2?: string): void;
/**
* True to enable or false to disable the ability to catch all uncaught exceptions
* and have them reported back to Flurry.
*
* @param crashReporting true to enable, false to disable.
*
* Method must be called prior to invoking init, e.g. Flurry.withCrashReporting(true);
* @deprecated Please use Flurry.Builder instead.
*/
withCrashReporting(crashReporting?: boolean): void;
/**
* Set the timeout for expiring a Flurry session.
*
* @param sessionMillis The time in milliseconds to set the session timeout to. Minimum value of 5000.
*
* Method must be called prior to invoking init, e.g. Flurry.withContinueSessionMillis(6000);
* @deprecated Please use Flurry.Builder instead.
*/
withContinueSessionMillis(sessionMillis?: number): void;
/**
* True if this session should be added to total sessions/DAUs when applicationstate is inactive or background.
*
* @param includeBackgroundSessionsInMetrics if background and inactive session should be counted toward dau
*
* Method must be called prior to invoking init, e.g. Flurry.withIncludeBackgroundSessionsInMetrics(true);
* @deprecated Please use Flurry.Builder instead.
*/
withIncludeBackgroundSessionsInMetrics(includeBackgroundSessionsInMetrics?: boolean): void;
/**
* True to enable or false to disable the internal logging for the Flurry SDK.
*
* @param enableLog true to enable logging, false to disable it.
*
* Method must be called prior to invoking init, e.g. Flurry.withLogEnabled(true);
* @deprecated Please use Flurry.Builder instead.
*/
withLogEnabled(enableLog?: boolean): void;
/**
* Set the log level of the internal Flurry SDK logging.
* Android (2:VERBOSE, 3:DEBUG, 4:INFO, 5:WARN, 6:ERROR, 7:ASSERT), iOS (2:All, 3-5:Debug, 6-7:Critical)
*
* @param logLevel The level to set it to.
*
* Method must be called prior to invoking init, e.g. Flurry.withLogLevel(5);
* @deprecated Please use Flurry.Builder instead.
*/
withLogLevel(logLevel?: number): void;
/**
* Sets the age of the user at the time of this session.
*
* e.g. Flurry.setAge(36);
*
* @param age valid values are 0-110
*/
setAge(age: number): void;
/**
* Sets the gender of the user.
*
* e.g. Flurry.setGender('f');
*
* @param gender one of 'f' or 'm'
*/
setGender(gender: string): void;
/**
* Set whether Flurry should record location via GPS.
*
* e.g. Flurry.setReportLocation('reportLocation');
*
* @param reportLocation True to allow Flurry to record location via GPS, false otherwise
*/
setReportLocation(reportLocation: boolean): void;
/**
* This method allows you to specify session origin and deep link for each session.
*
* e.g. Flurry.setSessionOrigin('originName', 'deepLink');
*
* @param originName Name of the origin.
* @param deepLink Url of the deep Link.
*/
setSessionOrigin(originName: string, deepLink: string): void;
/**
* Sets the Flurry userId for this session.
*
* e.g. Flurry.setUserId(userId);
*
* @param userId Unique user id for session.
*/
setUserId(userId: string): void;
/**
* Set the version name of the app.
*
* e.g. Flurry.setVersionName('versionName');
*
* @param versionName The version of the app.
*/
setVersionName(versionName?: string): void;
/**
* Sets the iOS In-App Purchase reporting enabled.
*
* e.g. Flurry.setIAPReportingEnabled(true);
*
* @param enableIAP True to enable iOS In-App Purchase reporting, false otherwise
*/
setIAPReportingEnabled(enableIAP?: boolean): void;
/**
* Add origin attribution.
*
* There are two overloads,
* e.g. Flurry.addOrigin('name', 'version'); Flurry.addOrigin('name', 'version'), {param: 'true'});
* - addOrigin(originName, originVersion)
* - addOrigin(originName, originVersion, originParameters)
*
* @param originName The name/id of the origin you wish to attribute.
* @param originVersion The version of the origin you wish to attribute.
*/
addOrigin(originName: string, originVersion: string, originParameters?: any): void;
/**
* This method allows you to associate parameters with an session.
*
* e.g. Flurry.addSessionProperty('name', 'value');
*
* @param name Property name.
* @param value Property value.
*/
addSessionProperty(name: string, value: string): void;
/**
* Get the version of the Flurry SDK.
*
* There are two overloads,
* e.g. 3 ways to call
*
* Flurry.getVersions(
* (msg) => {
* console.error(msg);
* },
* (agentVersion, releaseVersion, sessionId) => {
* console.log("Versions: " + agentVersion + " : " + releaseVersion + " : " + sessionId);
* }
* );
*
* OR
*
* (async () => {
* var versions = await Flurry.getVersions();
* console.log("Versions: " + versions.agentVersion + " : " + versions.releaseVersion + " : " + versions.sessionId);
* })();
*
* OR
*
* Flurry.getVersions().then(
* (versions) => {
* console.log("Versions: " + versions.agentVersion + " : " + versions.releaseVersion + " : " + versions.sessionId);
* },
* (msg) => {
* console.error(msg);
* }
* );
*
* @param errorCallback error callback.
* @param successCallback success callback.
* @return the Promise object if called without callbacks specified.
*/
getVersions(errorCallback?: any, successCallback?: any): Promise<object>;
/**
* Logs the breadcrumb.
*
* e.g. Flurry.logBreadcrumb('crashBreadcrumb');
*
* @param crashBreadcrumb crash breadcrumb
*/
logBreadcrumb(crashBreadcrumb: string): void;
/**
* Log an event.
*
* There are four overloads,
* e.g. Flurry.logEvent('eventId'); Flurry.logEvent('eventId', {param: 'true'}, true);
* - logEvent(eventId)
* - logEvent(eventId, timed)
* - logEvent(eventId, parameters)
* - logEvent(eventId, parameters, timed)
*
* @param eventId The name/id of the event.
* @param parameters A {@code Map<String, String>} of parameters to log with this event.
* @param timed True if this event is timed, false otherwise.
*/
logEvent(eventId: string, parameters?: any, timed?: boolean): void;
/**
* Log a payment.
*
* e.g. Flurry.logPayment('productName', 'productId', 6, 36, 'currency', 'transactionId', {param: 'true'});
*
* @param productName The name of the product purchased.
* @param productId The id of the product purchased.
* @param quantity The number of products purchased.
* @param price The price of the the products purchased in the given currency.
* @param currency The currency for the price argument.
* @param transactionId A unique identifier for the transaction used to make the purchase.
* @param parameters A {@code Map<String, String>} of the parameters which should be submitted
* with this event.
*/
logPayment(productName: string, productId: string, quantity: number, price: number,
currency: string, transactionId: string, parameters: any): void;
/**
* End a timed event.
*
* There are two overloads,
* e.g. Flurry.endTimedEvent('eventId'); Flurry.endTimedEvent('eventId', {param: 'true'});
* - endTimedEvent(eventId)
* - endTimedEvent(eventId, parameters)
*
* @param eventId The name/id of the event.
* @param parameters A {@code Map<String, String>} of parameters to log with this event.
*/
endTimedEvent(eventId: string, parameters?: any): void;
/**
* Report errors that your app catches.
*
* There are two overloads,
* e.g. Flurry.onError('errorId', 'message', 'errorClass', {param: 'true'});
* - onError(errorId, message, errorClass)
* - onError(errorId, message, errorClass, errorParams)
*
* @param errorId Unique ID for reported error.
* @param message Message for the error reported.
* @param errorClass Class in which the error is reported.
* @param errorParams A {@code Map<String, String>} of parameters to log with this report.
*/
onError(errorId: string, message: string, errorClass: string, errorParams?: any): void;
/**
* Log a page view.
*
* e.g. Flurry.onPageView();
*/
onPageView(): void;
/**
* Add a listener to receive messaging events, and handle the notification.
* Message type: 'NotificationReceived': a notification has been received.
* 'NotificationClicked': a notification has been clicked.
* 'NotificationCancelled': a notification has been cancelled. (Android only)
* 'TokenRefresh': push notification token has been changed. (Android only)
* Message.Title: message title
* Message.Body: message body
* Message.Data: message data (Map)
* Message.ClickAction: click action (Android only)
*
* Please call required Flurry.willHandleMessage(boolean) when received event types of
* 'NotificationReceived' or 'NotificationClicked' as soon as possible to avoid delay.
* (Android only) If you would like to handle the notification yourself, return true to notify Flurry
* you've handled it, and Flurry will not show the notification ('NotificationReceived'),
* or Flurry will not launch the app or "click_action" activity ('NotificationClicked').
*
* e.g.
* Flurry.addMessagingListener((message) => {
* if (message.Type === 'NotificationReceived') {
* Flurry.willHandleMessage(false);
* } else if (message.Type === 'NotificationClicked') {
* Flurry.willHandleMessage(false);
* }
*
* Flurry.printMessage(message);
* });
*
* @param callback messaging event callback.
*/
addMessagingListener(callback: any):void;
/**
* Remove a messaging events listener.
*
* @param callback messaging event callback.
*/
removeMessagingListener(callback: any): void;
/**
* If you would like to handle the notification yourself, return true to notify Flurry
* you've handled it, and Flurry will not show the notification ('NotificationReceived'),
* or Flurry will not launch the app or "click_action" activity ('NotificationClicked').
*
* Required: Even it is supported by Android only, it is required to notify Flurry
* when received event types of 'NotificationReceived' or 'NotificationClicked'.
*
* e.g. Flurry.willHandleMessage(true);
*
* @param handled True if you've handled the notification.
* False if you haven't and want Flurry to handle it.
*/
willHandleMessage(handled: boolean): void;
/**
* A helper function to print the message.
*
* @param message the message received.
*/
printMessage(message: any): void;
}
const Flurry: FlurryStatic;
export default Flurry;
}