This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
VOOLocalytics.ios.js
99 lines (81 loc) · 2.69 KB
/
VOOLocalytics.ios.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
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
/**
* @providesModule react-native-localytics
* @flow
*/
import ReactNative from 'react-native';
import invariant from 'fbjs/lib/invariant';
const { NativeModules } = ReactNative;
const VOOLocalytics = NativeModules.VOOLocalytics;
import type {
CustomerParams,
ItemParams,
CheckoutParams,
Coordinates,
ContentParams,
SearchParams,
ShareParams,
RatingParams,
InvitationParams,
} from './VOOLocalyticsTypes';
export function tagPurchased(params: ItemParams = {}): void {
VOOLocalytics.tagPurchased(params);
}
export function tagAddedToCard(params: ItemParams = {}): void {
VOOLocalytics.tagAddedToCard(params);
}
export function tagStartedCheckout(params: CheckoutParams = {}): void {
VOOLocalytics.tagStartedCheckout(params);
}
export function tagCompletedCheckout(params: CheckoutParams = {}): void {
VOOLocalytics.tagCompletedCheckout(params);
}
export function tagCustomerRegistered(params: CustomerParams = {}): void {
VOOLocalytics.tagCustomerRegistered(params);
}
export function tagCustomerLoggedIn(params: CustomerParams = {}): void {
VOOLocalytics.tagCustomerLoggedIn(params);
}
export function tagCustomerLoggedOut(params?: Object = {}): void {
VOOLocalytics.tagCustomerLoggedOut(params);
}
export function tagEvent(eventName: string, attributes?: Object): void {
invariant(typeof eventName === 'string' && eventName.trim(), 'Event Name has to be specified');
VOOLocalytics.tagEvent({ eventName, attributes });
}
export function setCustomerId(id: string): void {
VOOLocalytics.setCustomerId(id);
}
export function setCustomerFirstName(name: string): void {
VOOLocalytics.setCustomerFirstName(name);
}
export function setCustomerLastName(name: string): void {
VOOLocalytics.setCustomerLastName(name);
}
export function setCustomerFullName(name: string): void {
VOOLocalytics.setCustomerFullName(name);
}
export function setCustomerEmail(email: string): void {
VOOLocalytics.setCustomerEmail(email);
}
export function setLocation(coords: Coordinates): void {
invariant(
coords && coords.hasOwnProperty('lng') && coords.hasOwnProperty('lat'),
'Coordinates has to contain lng and lat'
);
VOOLocalytics.setLocation(coords);
}
export function tagContentViewed(content: ContentParams = {}): void {
VOOLocalytics.tagContentViewed(content);
}
export function tagSearched(search: SearchParams = {}): void {
VOOLocalytics.tagSearched(search);
}
export function tagShared(share: ShareParams = {}): void {
VOOLocalytics.tagShared(share);
}
export function tagContentRated(rating: RatingParams = {}): void {
VOOLocalytics.tagContentRated(rating);
}
export function tagInvited(method:string, attributes?: Object): void {
VOOLocalytics.tagInvited({method, attributes});
}