MCPcopy Create free account
hub / github.com/Iterable/react-native-sdk / handleClick

Function handleClick

example/src/components/Commerce/Commerce.tsx:10–33  ·  view source on GitHub ↗
(item: CommerceItem)

Source from the content-addressed store, hash-verified

8
9export const Commerce = () => {
10 const handleClick = (item: CommerceItem) => {
11 const purchasedItem = new IterableCommerceItem(
12 item.id,
13 item.name,
14 item.price,
15 1
16 );
17 const totalPrice = item.price;
18 const purchaseItems = [purchasedItem];
19 const dataFields = null;
20
21 Iterable.trackPurchase(totalPrice, purchaseItems, dataFields);
22
23 console.group('Purchase tracked with the following arguments:');
24 console.log('Total price:', totalPrice);
25 console.log('Purchase items:', [...purchaseItems]);
26 console.log('Data fields:', dataFields);
27 console.groupEnd();
28
29 Alert.alert(
30 `Tracked purchase: ${item.name}, $${item.price}`,
31 'Check logs for output'
32 );
33 };
34
35 return (
36 <SafeAreaView>

Callers 1

CommerceFunction · 0.85

Calls 2

logMethod · 0.80
trackPurchaseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…