forked from CleverTap/clevertap-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
400 lines (350 loc) · 11.8 KB
/
index.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
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
/*******************
* Personalization
******************/
/**
* Personalization
* Enables the Personalization API
*/
export function enablePersonalization(): void;
/**
* Enables tracking opt out for the currently active user.
* @param optOut {boolean}
*/
export function setOptOut(optOut: boolean): void;
/**
* Enables the reporting of device network related information, including IP address. This reporting is disabled by default.
* @param enable {boolean}
*/
export function enableDeviceNetworkInfoReporting(enable: boolean): void;
/*******************
* Push
******************/
/**
* Registers for push notifications
*/
export function registerPush(): void;
/**
* Sets the device's push token
* @param token {string}
*/
export function setPushToken(token: string): void;
/**
* Create Notification Channel for Android O+
* @param channelID {string}
* @param channelName {string}
* @param channelDescription {string}
* @param importance {number}
* @param showBadge {boolean}
*/
export function createNotificationChannel(
channelID: string,
channelName: string,
channelDescription: string,
importance: number,
showBadge: boolean
): void;
/**
* Create Notification Channel for Android O+
* @param channelID {string}
* @param channelName {string}
* @param channelDescription {string}
* @param importance {number}
* @param showBadge {boolean}
* @param sound {string}
*/
export function createNotificationChannelWithSound(
channelID: string,
channelName: string,
channelDescription: string,
importance: number,
showBadge: boolean,
sound: string
): void;
/**
* Create Notification Channel with Group ID for Android O+
* @param channelID {string}
* @param channelName {string}
* @param channelDescription {string}
* @param importance {number}
* @param groupId {string}
* @param showBadge {boolean}
* @param sound {string}
*/
export function createNotificationChannelWithGroupId(
channelID: string,
channelName: string,
channelDescription: string,
importance: number,
groupId: string,
showBadge: boolean
): void;
/**
* Create Notification Channel with Group ID for Android O+
* @param channelID {string}
* @param channelName {string}
* @param channelDescription {string}
* @param importance {number}
* @param groupId {string}
* @param showBadge {boolean}
*/
export function createNotificationChannelWithGroupIdAndSound(
channelID: string,
channelName: string,
channelDescription: string,
importance: number,
groupId: string,
showBadge: boolean,
sound: string
): void;
/**
* Create Notification Channel Group for Android O+
* @param groupID {string}
* @param groupName {string}
*/
export function createNotificationChannelGroup(
groupID: string,
groupName: string
): void;
/**
* Delete Notification Channel for Android O+
* @param channelID {string}
*/
export function deleteNotificationChannel(channelID: string): void;
/**
* Delete Notification Group for Android O+
* @param groupID {string}
*/
export function deleteNotificationChannelGroup(groupID: string): void;
/*******************
* Events
******************/
/**
* Record Screen View
* @param screenName {string}
*/
export function recordScreenView(screenName: string): void;
/**
* Record Event with Name and Event properties
* @param eventName {string}
* @param eventProps {any}
*/
export function recordEvent(
eventName: string,
eventProps: any
): void;
/**
* Record Charged Event with Details and Items
* @param details {any} object with transaction details
* @param items {any} array of items purchased
*/
export function recordChargedEvent(
details: any,
items: any
): void;
/**
* Get Event First Time
* @param eventName {string}
* callback returns epoch seconds or -1
*/
export function eventGetFirstTime(eventName: string): void;
/**
* Get Event Last Time
* @param eventName {string}
* callback returns epoch seconds or -1
*/
export function eventGetLastTime(eventName: string): void;
/**
* Get Event Number of Occurrences
* @param eventName {string}
* calls back with int or -1
*/
export function eventGetOccurrences(eventName: string): void;
/**
* Get Event Details
* @param eventName {string}
* calls back with object {"eventName": <string>, "firstTime":<epoch seconds>, "lastTime": <epoch seconds>, "count": <int>} or empty object
*/
export function eventGetDetails(eventName: string): void;
/**
* Get Event History
* calls back with object {"eventName1":<event1 details object>, "eventName2":<event2 details object>}
*/
export function getEventHistory(): void;
/*******************
* Profiles
******************/
/**
* Get the device location if available.
* On iOS:
* Calling this will prompt the user location permissions dialog.
* Please be sure to include the NSLocationWhenInUseUsageDescription key in your Info.plist.
* Uses desired accuracy of kCLLocationAccuracyHundredMeters.
* If you need background location updates or finer accuracy please implement your own location handling.
* On Android:
* Requires Location Permission in AndroidManifest e.g. "android.permission.ACCESS_COARSE_LOCATION"
* You can use location to pass it to CleverTap via the setLocation API
* for, among other things, more fine-grained geo-targeting and segmentation purposes.
* Note: on iOS the call to CleverTapSDK must be made on the main thread due to LocationManager restrictions, but the CleverTapSDK method itself is non-blocking.
* calls back with {lat:lat, lon:lon} lat and lon are floats
*/
export function getLocation(): void;
/**
* Set location
* @param lat {number}
* @param lon {number}
*/
export function setLocation(lat: number, lon: number): void;
/**
* Creates a separate and distinct user profile identified by one or more of Identity, Email, FBID or GPID values,
* and populated with the key-values included in the profile dictionary.
* If your app is used by multiple users, you can use this method to assign them each a unique profile to track them separately.
* If instead you wish to assign multiple Identity, Email, FBID and/or GPID values to the same user profile,
* use profileSet rather than this method.
* If none of Identity, Email, FBID or GPID is included in the profile dictionary,
* all properties values will be associated with the current user profile.
* When initially installed on this device, your app is assigned an "anonymous" profile.
* The first time you identify a user on this device (whether via onUserLogin or profileSet),
* the "anonymous" history on the device will be associated with the newly identified user.
* Then, use this method to switch between subsequent separate identified users.
* Please note that switching from one identified user to another is a costly operation
* in that the current session for the previous user is automatically closed
* and data relating to the old user removed, and a new session is started
* for the new user and data for that user refreshed via a network call to CleverTap.
* In addition, any global frequency caps are reset as part of the switch.
* @param profile {any} object
*/
export function onUserLogin(profile: any): void;
/**
* Set profile attributes
* @param profile {any} object
*/
export function profileSet(profile: any): void;
/**
* Set profile attributes from facebook user
* @param profile {any} facebook graph user object
*/
export function profileSetGraphUser(profile: any): void;
/**
* Set profile attributes rom google plus user
* @param profile {any} google plus user object
*/
export function profileGooglePlusUser(profile: any): void;
/**
* Get User Profile Property
* @param propertyName {string}
* calls back with value of propertyName or false
*/
export function profileGetProperty(propertyName: string): void;
/**
* Get a unique CleverTap identifier suitable for use with install attribution providers.
* calls back with unique CleverTap attribution identifier
*/
export function profileGetCleverTapAttributionIdentifier(callback: Callback): void;
/**
* Get User Profile CleverTapID
* calls back with CleverTapID or false
*/
export function profileGetCleverTapID(callback: Callback): void;
/**
* Remove the property specified by key from the user profile
* @param key {string}
*/
export function profileRemoveValueForKey(key: string): void;
/**
* Method for setting a multi-value user profile property
* @param key {string}
* @param values {any} array of strings
*/
export function profileSetMultiValuesForKey(values: any, key: string): void;
/**
* Method for adding a value to a multi-value user profile property
* @param key {string}
* @param value {string}
*/
export function profileAddMultiValueForKey(value: string, key: string): void;
/**
* Method for adding values to a multi-value user profile property
* @param key {string}
* @param values {any} array of strings
*/
export function profileAddMultiValuesForKey(values: any, key: string): void;
/**
* Method for removing a value from a multi-value user profile property
* @param key {string}
* @param value {string}
*/
export function profileRemoveMultiValueForKey(value: string, key: string): void;
/**
* Method for removing a value from a multi-value user profile property
* @param key {string}
* @param values {any} array of strings
*/
export function profileRemoveMultiValuesForKey(values: any, key: string): void;
/*******************
* Session
******************/
/**
* Get Session Elapsed Time
* calls back with seconds
*/
export function sessionGetTimeElapsed(callback: Callback): void;
/**
* Get Session Total Visits
* calls back with with int or -1
*/
export function sessionGetTotalVisits(callback: Callback): void;
/**
* Get Session Screen Count
* calls back with with int
*/
export function sessionGetScreenCount(callback: Callback): void;
/**
* Get Session Previous Visit Time
* calls back with with epoch seconds or -1
*/
export function sessionGetPreviousVisitTime(callback: Callback): void;
/**
* Get Sesssion Referrer UTM details
* object {"source": <string>, "medium": <string>, "campaign": <string>} or empty object
*/
export function sessionGetUTMDetails(callback: Callback): void;
/**
* Call this to manually track the utm details for an incoming install referrer
* @param source {string}
* @param medium {string}
* @param campaign {string}
*/
export function pushInstallReferrer(
source: string,
medium: string,
campaign: string
): void;
/****************************
* Notification Inbox methods
****************************/
/**
* Call this method to initialize the App Inbox
*/
export function initializeInbox(): void;
/**
* Call this method to get the count of unread Inbox messages
*/
export function getInboxMessageUnreadCount(callback: Callback): void;
/**
* Call this method to get the count of total Inbox messages
*/
export function getInboxMessageCount(callback: Callback): void;
/**
* Call this method to open the App Inbox
* @param styleConfig : any or empty object
*/
export function showInbox(styleConfig: any): void;
/*******************
* Developer Options
******************/
/**
* 0 is off, 1 is info, 2 is debug, default is 1
* @param level {number}
*/
export function setDebugLevel(level: number): void;
type Callback = (err: object, res: object) => void;