forked from CleverTap/clevertap-react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
779 lines (677 loc) · 26.1 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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
/*******************
* Listners & Deeplinks
******************/
/**
* Add a CleverTap event listener
* supported events are CleverTap.CleverTapProfileDidInitialize, CleverTap.CleverTapProfileSync and CleverTap.CleverTapInAppNotificationDismissed
* @param {string} eventName - the CleverTap event name
* @param {function(event)} your event handler
*/
export function addListener(
eventName: string,
handler: Function
): void;
/**
* Removes all of the registered listeners for given eventName.
*
* @param {string} eventName - name of the event whose registered listeners to remove
*/
export function removeListener(eventName: string): void;
/**
* Deprecated - Since version 5.0.0. Use removeListener(eventName) instead
* Remove all event listeners
*/
export function removeListeners(): void;
/**
* If an application is launched from a push notification click, returns the CleverTap deep link included in the push notification
* @param {function(err, res)} callback that return the url as string in res or a string error in err
*/
export function getInitialUrl(callback: Callback): void;
/*******************
* 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 registerForPush(): void;
/**
* Sets the device's push token
* @param token {string}
*/
export function setPushToken(token: string, type: 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;
/**
* Create Notification for Custom Handling Push Notifications
* @param extras {any}
*/
export function createNotification(extras: any): 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, callback: Callback): void;
/**
* Get Event Last Time
* @param eventName {string}
* callback returns epoch seconds or -1
*/
export function eventGetLastTime(eventName: string, callback: Callback): void;
/**
* Get Event Number of Occurrences
* @param eventName {string}
* calls back with int or -1
*/
export function eventGetOccurrences(eventName: string, callback: Callback): 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 eventGetDetail(eventName: string, callback: Callback): void;
/**
* Get Event History
* calls back with object {"eventName1":<event1 details object>, "eventName2":<event2 details object>}
*/
export function getEventHistory(callback: Callback): 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, callback: Callback): 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 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 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;
/**
* Call this method to get all inbox messages
*/
export function getAllInboxMessages(callback: Callback): void;
/**
* Call this method to get all unread inbox messages
*/
export function getUnreadInboxMessages(callback: Callback): void;
/**
* Call this method to get inbox message that belongs to the given message id
*/
export function getInboxMessageForId(messageId: string, callback: Callback): void;
/**
* Call this method to delete inbox message that belongs to the given message id
*/
export function deleteInboxMessageForId(messageId: string): void;
/**
* Call this method to mark inbox message as read
*/
export function markReadInboxMessageForId(messageId: string): void;
/**
* Call this method to push the Notification Clicked event for App Inbox to CleverTap
*/
export function pushInboxNotificationClickedEventForId(messageId: string): void;
/**
* Call this method to push the Notification Viewed event for App Inbox to CleverTap
*/
export function pushInboxNotificationViewedEventForId(messageId: string): void;
/****************************
* Native Display Methods
****************************/
/**
* Call this method to get all display units
*/
export function getAllDisplayUnits(callback: Callback): void;
/**
* Call this method to get display unit that belongs to the given unit id
*/
export function getDisplayUnitForId(unitID: string, callback: Callback): void;
/**
* Call this method to raise display unit viewed event
*/
export function pushDisplayUnitViewedEventForID(unitID: string): void;
/**
* Call this method to raise display unit clicked event
*/
export function pushDisplayUnitClickedEventForID(unitID: string): void;
/****************************
* AB Tests Methods
****************************/
/**
* Disables/Enables the ability to send Dynamic Variables to the CleverTap Dashboard
* Disabled by default
*/
export function setUIEditorConnectionEnabled(enabled: boolean): void;
/**
* Registers an ABTesting variable of type Boolean for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerBooleanVariable(name: string): void;
/**
* Registers an ABTesting variable of type Double for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerDoubleVariable(name: string): void;
/**
* Registers an ABTesting variable of type Integer for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerIntegerVariable(name: string): void;
/**
* Registers an ABTesting variable of type String for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerStringVariable(name: string): void;
/**
* Registers an ABTesting variable of type List of Boolean for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerListOfBooleanVariable(name: string): void;
/**
* Registers an ABTesting variable of type List of Double for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerListOfDoubleVariable(name: string): void;
/**
* Registers an ABTesting variable of type List of Integer for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerListOfIntegerVariable(name: string): void;
/**
* Registers an ABTesting variable of type List of String for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerListOfStringVariable(name: string): void;
/**
* Registers an ABTesting variable of type Map of Boolean for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerMapOfBooleanVariable(name: string): void;
/**
* Registers an ABTesting variable of type Map of Double for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerMapOfDoubleVariable(name: string): void;
/**
* Registers an ABTesting variable of type Map of Integer for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerMapOfIntegerVariable(name: string): void;
/**
* Registers an ABTesting variable of type Map of String for ease of editing on the CleverTap Dashboard
* @param name {string} name of the variable
*/
export function registerMapOfStringVariable(name: string): void;
/**
* Returns the Boolean value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with Boolean, the value set by the Experiment or the default value if unset
*/
export function getBooleanVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Double value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with Double, the value set by the Experiment or the default value if unset
*/
export function getDoubleVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Integer value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with Integer, the value set by the Experiment or the default value if unset
*/
export function getIntegerVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the String value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with string, the value set by the Experiment or the default value if unset
*/
export function getStringVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the List of Boolean value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with List of Boolean, the value set by the Experiment or the default value if unset
*/
export function getListOfBooleanVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the List of Double value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with List of Double, the value set by the Experiment or the default value if unset
*/
export function getListOfDoubleVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the List of Integer value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with List of Integer, the value set by the Experiment or the default value if unset
*/
export function getListOfIntegerVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the List of String value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with List of String, the value set by the Experiment or the default value if unset
*/
export function getListOfStringVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Map of Boolean value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with Map of Boolean, the value set by the Experiment or the default value if unset
*/
export function getMapOfBooleanVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Map of Double value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back with Map of Double, the value set by the Experiment or the default value if unset
*/
export function getMapOfDoubleVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Map of Integer value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back withMap of Integer, the value set by the Experiment or the default value if unset
*/
export function getMapOfIntegerVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/**
* Returns the Map of String value of the named variable set via an AB Testing Experiment or the default value if unset
* @param name - the name of the variable
* @param defaultValue - the default value to return if the value has not been set via an AB Testing Experiment
* calls back withMap of String, the value set by the Experiment or the default value if unset
*/
export function getMapOfStringVariable(
name: string,
defaultValue: any,
callback: Callback): void;
/*******************
* Product Configs
******************/
/**
* Sets default product config params using the given object.
* @param productConfigMap {any} key-value product config properties. keys are strings and values can be string, double, integer, boolean or json in string format.
*/
export function setDefaultsMap(productConfigMap: any): void;
/**
* Starts fetching product configs, adhering to the default minimum fetch interval.
*/
export function fetch(): void;
/**
* Starts fetching product configs, adhering to the default minimum fetch interval.
* @param intervalInSecs {number} minimum fetch interval in seconds.
*/
export function fetchWithMinimumIntervalInSeconds(intervalInSecs: number): void;
/**
* Activates the most recently fetched product configs, so that the fetched key value pairs take effect.
*/
export function activate(): void;
/**
* Asynchronously fetches and then activates the fetched product configs.
*/
export function fetchAndActivate(): void;
/**
* Sets the minimum interval in seconds between successive fetch calls.
* @param intervalInSecs {number} interval in seconds between successive fetch calls.
*/
export function setMinimumFetchIntervalInSeconds(intervalInSecs: number): void;
/**
* Deletes all activated, fetched and defaults configs as well as all Product Config settings.
*/
export function resetProductConfig(): void;
/**
* Returns the product config parameter value for the given key as a String.
* @param key {string} - the name of the key
* @param callback {Callback} - callback that returns a value of type string if present else blank
*/
export function getProductConfigString(
key: string,
callback: Callback): void;
/**
* Returns the product config parameter value for the given key as a boolean.
* @param key {string} - the name of the key
* @param callback {Callback} - callback that returns a value of type boolean if present else false
*/
export function getProductConfigBoolean(
key: string,
callback: Callback): void;
/**
* Returns the product config parameter value for the given key as a number.
* @param key {string} - the name of the key
* @param callback {Callback} - callback that returns a value of type number if present else 0
*/
export function getNumber(
key: string,
callback: Callback): void;
/**
* Returns the last fetched timestamp in millis.
* @param callback {Callback} - callback that returns value of timestamp in millis as a string.
*/
export function getLastFetchTimeStampInMillis(callback: Callback): void;
/*******************
* Feature Flags
******************/
/**
* Getter to return the feature flag configured at the dashboard
* @param key {string} - the name of the key
* @param defaultValue {boolean} - default value of the key, in case we don't find any feature flag with the key.
* @param callback {Callback} - callback that returns a feature flag value of type boolean if present else provided default value
*/
export function getFeatureFlag(
key: string,
defaultValue: boolean,
callback: Callback): 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;