This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
73 lines (70 loc) · 2.16 KB
/
App.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
import React from "react";
import {
StyleSheet,
Text,
View,
Button,
NativeModules,
Platform
} from "react-native";
export default class App extends React.Component {
showStandaloneCampaign = () => {
switch (Platform.OS) {
case "ios":
NativeModules.TalkableIOS.registerOriginStandalone({});
break;
case "android":
NativeModules.TalkableAndroid.registerOriginStandalone();
break;
}
};
showPostPurchaseCampaign = () => {
switch (Platform.OS) {
case "ios":
NativeModules.TalkableIOS.registerOriginPostPurchase({
purchase: {
order_number: +new Date(), // Unique order number. Example: '100011'
subtotal: "100", // Order subtotal (pre-tax, post-discount). Example: '23.97'
coupon_code: "", // Coupon code that was used at checkout (pass multiple as an array). Example: 'SAVE20'
shipping_zip: "1", // Optional - used for fraud protection by address. Example: '02222'
shipping_address: "1", // Full address of the order, make sure to strictly follow a format: 'Apt #, Street address, City, State, ZIP, Country'
email: "[email protected]" // Customer email address who issued a purchase. Example: '[email protected]'
}
});
break;
case "android":
NativeModules.TalkableAndroid.registerOriginPostPurchase(
"123456", // order_number
100, // subtotal
"123", // coupon_code
"[email protected]" // email
);
break;
}
};
render() {
return (
<View style={styles.container}>
<Text>Talkable</Text>
<View style={{ marginBottom: 20 }} />
<Button
title="Standalone Campaign"
onPress={this.showStandaloneCampaign}
/>
<View style={{ marginBottom: 10 }} />
<Button
title="Post Purchase Campaign"
onPress={this.showPostPurchaseCampaign}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center"
}
});