forked from corymsmith/react-native-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Answers.js
68 lines (52 loc) · 2.56 KB
/
Answers.js
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
/**
* @providesModule Answers
*/
'use strict';
var { NativeModules, Platform } = require('react-native');
var SMXAnswers = NativeModules.SMXAnswers;
module.exports = {
logCustom: function (eventName:string, customAttributes) {
SMXAnswers.logCustom(eventName, customAttributes);
},
logAddToCart: function (itemPrice:number, currency:string, itemName:string, itemType:string, itemId:string, customAttributes) {
SMXAnswers.logAddToCart(getAsStringOrNull(itemPrice), currency, itemName, itemType, itemId, customAttributes);
},
logContentView: function (contentName:string, contentType:string, contentId:string, customAttributes) {
SMXAnswers.logContentView(contentName, contentType, contentId, customAttributes);
},
logInvite: function (method:string, customAttributes) {
SMXAnswers.logInvite(method, customAttributes);
},
logLevelStart: function (levelName:string, customAttributes) {
SMXAnswers.logLevelStart(levelName, customAttributes);
},
logLevelEnd: function (levelName:string, score:number, success:boolean, customAttributes) {
SMXAnswers.logLevelEnd(levelName, getAsStringOrNull(score), success, customAttributes);
},
logLogin: function (method:string, success:boolean, customAttributes) {
SMXAnswers.logLogin(method, success, customAttributes);
},
logPurchase: function (itemPrice:number, currency:string, success:boolean, itemName:string, itemType:string, itemId:string, customAttributes) {
SMXAnswers.logPurchase(getAsStringOrNull(itemPrice), currency, success, itemName, itemType, itemId, customAttributes);
},
logRating: function (rating:number, contentId:string, contentType:string, contentName:string, customAttributes) {
SMXAnswers.logRating(getAsStringOrNull(rating), contentId, contentType, contentName, customAttributes);
},
logSearch: function (query:string, customAttributes) {
SMXAnswers.logSearch(query, customAttributes);
},
logShare: function (method:string, contentName:string, contentType:string, contentId:string, customAttributes) {
SMXAnswers.logShare(method, contentName, contentType, contentId, customAttributes);
},
logSignUp: function (method:string, success:boolean, customAttributes) {
SMXAnswers.logSignUp(method, success, customAttributes);
},
logStartCheckout: function (totalPrice:number, count:number, currency:string, customAttributes) {
SMXAnswers.logStartCheckout(getAsStringOrNull(totalPrice), getAsStringOrNull(count), currency, customAttributes);
}
};
function getAsStringOrNull(value:number) {
if (value == null)
return value;
return value + "";
}