@formo/analytics-react-native 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +302 -0
  2. package/lib/commonjs/FormoAnalytics.js +526 -0
  3. package/lib/commonjs/FormoAnalytics.js.map +1 -0
  4. package/lib/commonjs/FormoAnalyticsProvider.js +265 -0
  5. package/lib/commonjs/FormoAnalyticsProvider.js.map +1 -0
  6. package/lib/commonjs/constants/config.js +69 -0
  7. package/lib/commonjs/constants/config.js.map +1 -0
  8. package/lib/commonjs/constants/events.js +30 -0
  9. package/lib/commonjs/constants/events.js.map +1 -0
  10. package/lib/commonjs/constants/index.js +39 -0
  11. package/lib/commonjs/constants/index.js.map +1 -0
  12. package/lib/commonjs/constants/storage.js +23 -0
  13. package/lib/commonjs/constants/storage.js.map +1 -0
  14. package/lib/commonjs/index.js +65 -0
  15. package/lib/commonjs/index.js.map +1 -0
  16. package/lib/commonjs/lib/consent/index.js +56 -0
  17. package/lib/commonjs/lib/consent/index.js.map +1 -0
  18. package/lib/commonjs/lib/event/EventFactory.js +493 -0
  19. package/lib/commonjs/lib/event/EventFactory.js.map +1 -0
  20. package/lib/commonjs/lib/event/EventManager.js +46 -0
  21. package/lib/commonjs/lib/event/EventManager.js.map +1 -0
  22. package/lib/commonjs/lib/event/EventQueue.js +290 -0
  23. package/lib/commonjs/lib/event/EventQueue.js.map +1 -0
  24. package/lib/commonjs/lib/event/index.js +50 -0
  25. package/lib/commonjs/lib/event/index.js.map +1 -0
  26. package/lib/commonjs/lib/event/types.js +6 -0
  27. package/lib/commonjs/lib/event/types.js.map +1 -0
  28. package/lib/commonjs/lib/lifecycle/index.js +196 -0
  29. package/lib/commonjs/lib/lifecycle/index.js.map +1 -0
  30. package/lib/commonjs/lib/logger/index.js +48 -0
  31. package/lib/commonjs/lib/logger/index.js.map +1 -0
  32. package/lib/commonjs/lib/session/index.js +109 -0
  33. package/lib/commonjs/lib/session/index.js.map +1 -0
  34. package/lib/commonjs/lib/storage/AsyncStorageAdapter.js +164 -0
  35. package/lib/commonjs/lib/storage/AsyncStorageAdapter.js.map +1 -0
  36. package/lib/commonjs/lib/storage/MemoryStorage.js +41 -0
  37. package/lib/commonjs/lib/storage/MemoryStorage.js.map +1 -0
  38. package/lib/commonjs/lib/storage/StorageBlueprint.js +24 -0
  39. package/lib/commonjs/lib/storage/StorageBlueprint.js.map +1 -0
  40. package/lib/commonjs/lib/storage/StorageManager.js +126 -0
  41. package/lib/commonjs/lib/storage/StorageManager.js.map +1 -0
  42. package/lib/commonjs/lib/storage/index.js +49 -0
  43. package/lib/commonjs/lib/storage/index.js.map +1 -0
  44. package/lib/commonjs/lib/storage/types.js +2 -0
  45. package/lib/commonjs/lib/storage/types.js.map +1 -0
  46. package/lib/commonjs/lib/wagmi/WagmiEventHandler.js +445 -0
  47. package/lib/commonjs/lib/wagmi/WagmiEventHandler.js.map +1 -0
  48. package/lib/commonjs/lib/wagmi/index.js +28 -0
  49. package/lib/commonjs/lib/wagmi/index.js.map +1 -0
  50. package/lib/commonjs/lib/wagmi/types.js +2 -0
  51. package/lib/commonjs/lib/wagmi/types.js.map +1 -0
  52. package/lib/commonjs/types/base.js +6 -0
  53. package/lib/commonjs/types/base.js.map +1 -0
  54. package/lib/commonjs/types/events.js +22 -0
  55. package/lib/commonjs/types/events.js.map +1 -0
  56. package/lib/commonjs/types/index.js +28 -0
  57. package/lib/commonjs/types/index.js.map +1 -0
  58. package/lib/commonjs/utils/address.js +82 -0
  59. package/lib/commonjs/utils/address.js.map +1 -0
  60. package/lib/commonjs/utils/hash.js +30 -0
  61. package/lib/commonjs/utils/hash.js.map +1 -0
  62. package/lib/commonjs/utils/helpers.js +116 -0
  63. package/lib/commonjs/utils/helpers.js.map +1 -0
  64. package/lib/commonjs/utils/index.js +61 -0
  65. package/lib/commonjs/utils/index.js.map +1 -0
  66. package/lib/commonjs/utils/timestamp.js +34 -0
  67. package/lib/commonjs/utils/timestamp.js.map +1 -0
  68. package/lib/commonjs/utils/trafficSource.js +147 -0
  69. package/lib/commonjs/utils/trafficSource.js.map +1 -0
  70. package/lib/commonjs/version.js +10 -0
  71. package/lib/commonjs/version.js.map +1 -0
  72. package/lib/module/FormoAnalytics.js +519 -0
  73. package/lib/module/FormoAnalytics.js.map +1 -0
  74. package/lib/module/FormoAnalyticsProvider.js +256 -0
  75. package/lib/module/FormoAnalyticsProvider.js.map +1 -0
  76. package/lib/module/constants/config.js +62 -0
  77. package/lib/module/constants/config.js.map +1 -0
  78. package/lib/module/constants/events.js +24 -0
  79. package/lib/module/constants/events.js.map +1 -0
  80. package/lib/module/constants/index.js +4 -0
  81. package/lib/module/constants/index.js.map +1 -0
  82. package/lib/module/constants/storage.js +17 -0
  83. package/lib/module/constants/storage.js.map +1 -0
  84. package/lib/module/index.js +51 -0
  85. package/lib/module/index.js.map +1 -0
  86. package/lib/module/lib/consent/index.js +49 -0
  87. package/lib/module/lib/consent/index.js.map +1 -0
  88. package/lib/module/lib/event/EventFactory.js +488 -0
  89. package/lib/module/lib/event/EventFactory.js.map +1 -0
  90. package/lib/module/lib/event/EventManager.js +41 -0
  91. package/lib/module/lib/event/EventManager.js.map +1 -0
  92. package/lib/module/lib/event/EventQueue.js +283 -0
  93. package/lib/module/lib/event/EventQueue.js.map +1 -0
  94. package/lib/module/lib/event/index.js +5 -0
  95. package/lib/module/lib/event/index.js.map +1 -0
  96. package/lib/module/lib/event/types.js +2 -0
  97. package/lib/module/lib/event/types.js.map +1 -0
  98. package/lib/module/lib/lifecycle/index.js +190 -0
  99. package/lib/module/lib/lifecycle/index.js.map +1 -0
  100. package/lib/module/lib/logger/index.js +42 -0
  101. package/lib/module/lib/logger/index.js.map +1 -0
  102. package/lib/module/lib/session/index.js +92 -0
  103. package/lib/module/lib/session/index.js.map +1 -0
  104. package/lib/module/lib/storage/AsyncStorageAdapter.js +158 -0
  105. package/lib/module/lib/storage/AsyncStorageAdapter.js.map +1 -0
  106. package/lib/module/lib/storage/MemoryStorage.js +35 -0
  107. package/lib/module/lib/storage/MemoryStorage.js.map +1 -0
  108. package/lib/module/lib/storage/StorageBlueprint.js +18 -0
  109. package/lib/module/lib/storage/StorageBlueprint.js.map +1 -0
  110. package/lib/module/lib/storage/StorageManager.js +115 -0
  111. package/lib/module/lib/storage/StorageManager.js.map +1 -0
  112. package/lib/module/lib/storage/index.js +5 -0
  113. package/lib/module/lib/storage/index.js.map +1 -0
  114. package/lib/module/lib/storage/types.js +2 -0
  115. package/lib/module/lib/storage/types.js.map +1 -0
  116. package/lib/module/lib/wagmi/WagmiEventHandler.js +439 -0
  117. package/lib/module/lib/wagmi/WagmiEventHandler.js.map +1 -0
  118. package/lib/module/lib/wagmi/index.js +3 -0
  119. package/lib/module/lib/wagmi/index.js.map +1 -0
  120. package/lib/module/lib/wagmi/types.js +2 -0
  121. package/lib/module/lib/wagmi/types.js.map +1 -0
  122. package/lib/module/types/base.js +2 -0
  123. package/lib/module/types/base.js.map +1 -0
  124. package/lib/module/types/events.js +17 -0
  125. package/lib/module/types/events.js.map +1 -0
  126. package/lib/module/types/index.js +3 -0
  127. package/lib/module/types/index.js.map +1 -0
  128. package/lib/module/utils/address.js +74 -0
  129. package/lib/module/utils/address.js.map +1 -0
  130. package/lib/module/utils/hash.js +24 -0
  131. package/lib/module/utils/hash.js.map +1 -0
  132. package/lib/module/utils/helpers.js +105 -0
  133. package/lib/module/utils/helpers.js.map +1 -0
  134. package/lib/module/utils/index.js +6 -0
  135. package/lib/module/utils/index.js.map +1 -0
  136. package/lib/module/utils/timestamp.js +26 -0
  137. package/lib/module/utils/timestamp.js.map +1 -0
  138. package/lib/module/utils/trafficSource.js +137 -0
  139. package/lib/module/utils/trafficSource.js.map +1 -0
  140. package/lib/module/version.js +4 -0
  141. package/lib/module/version.js.map +1 -0
  142. package/lib/typescript/FormoAnalytics.d.ts +163 -0
  143. package/lib/typescript/FormoAnalytics.d.ts.map +1 -0
  144. package/lib/typescript/FormoAnalyticsProvider.d.ts +29 -0
  145. package/lib/typescript/FormoAnalyticsProvider.d.ts.map +1 -0
  146. package/lib/typescript/constants/config.d.ts +8 -0
  147. package/lib/typescript/constants/config.d.ts.map +1 -0
  148. package/lib/typescript/constants/events.d.ts +23 -0
  149. package/lib/typescript/constants/events.d.ts.map +1 -0
  150. package/lib/typescript/constants/index.d.ts +4 -0
  151. package/lib/typescript/constants/index.d.ts.map +1 -0
  152. package/lib/typescript/constants/storage.d.ts +10 -0
  153. package/lib/typescript/constants/storage.d.ts.map +1 -0
  154. package/lib/typescript/index.d.ts +44 -0
  155. package/lib/typescript/index.d.ts.map +1 -0
  156. package/lib/typescript/lib/consent/index.d.ts +13 -0
  157. package/lib/typescript/lib/consent/index.d.ts.map +1 -0
  158. package/lib/typescript/lib/event/EventFactory.d.ts +61 -0
  159. package/lib/typescript/lib/event/EventFactory.d.ts.map +1 -0
  160. package/lib/typescript/lib/event/EventManager.d.ts +17 -0
  161. package/lib/typescript/lib/event/EventManager.d.ts.map +1 -0
  162. package/lib/typescript/lib/event/EventQueue.d.ts +74 -0
  163. package/lib/typescript/lib/event/EventQueue.d.ts.map +1 -0
  164. package/lib/typescript/lib/event/index.d.ts +5 -0
  165. package/lib/typescript/lib/event/index.d.ts.map +1 -0
  166. package/lib/typescript/lib/event/types.d.ts +23 -0
  167. package/lib/typescript/lib/event/types.d.ts.map +1 -0
  168. package/lib/typescript/lib/lifecycle/index.d.ts +46 -0
  169. package/lib/typescript/lib/lifecycle/index.d.ts.map +1 -0
  170. package/lib/typescript/lib/logger/index.d.ts +19 -0
  171. package/lib/typescript/lib/logger/index.d.ts.map +1 -0
  172. package/lib/typescript/lib/session/index.d.ts +41 -0
  173. package/lib/typescript/lib/session/index.d.ts.map +1 -0
  174. package/lib/typescript/lib/storage/AsyncStorageAdapter.d.ts +48 -0
  175. package/lib/typescript/lib/storage/AsyncStorageAdapter.d.ts.map +1 -0
  176. package/lib/typescript/lib/storage/MemoryStorage.d.ts +18 -0
  177. package/lib/typescript/lib/storage/MemoryStorage.d.ts.map +1 -0
  178. package/lib/typescript/lib/storage/StorageBlueprint.d.ts +21 -0
  179. package/lib/typescript/lib/storage/StorageBlueprint.d.ts.map +1 -0
  180. package/lib/typescript/lib/storage/StorageManager.d.ts +45 -0
  181. package/lib/typescript/lib/storage/StorageManager.d.ts.map +1 -0
  182. package/lib/typescript/lib/storage/index.d.ts +5 -0
  183. package/lib/typescript/lib/storage/index.d.ts.map +1 -0
  184. package/lib/typescript/lib/storage/types.d.ts +22 -0
  185. package/lib/typescript/lib/storage/types.d.ts.map +1 -0
  186. package/lib/typescript/lib/wagmi/WagmiEventHandler.d.ts +104 -0
  187. package/lib/typescript/lib/wagmi/WagmiEventHandler.d.ts.map +1 -0
  188. package/lib/typescript/lib/wagmi/index.d.ts +3 -0
  189. package/lib/typescript/lib/wagmi/index.d.ts.map +1 -0
  190. package/lib/typescript/lib/wagmi/types.d.ts +54 -0
  191. package/lib/typescript/lib/wagmi/types.d.ts.map +1 -0
  192. package/lib/typescript/types/base.d.ts +219 -0
  193. package/lib/typescript/types/base.d.ts.map +1 -0
  194. package/lib/typescript/types/events.d.ts +111 -0
  195. package/lib/typescript/types/events.d.ts.map +1 -0
  196. package/lib/typescript/types/index.d.ts +3 -0
  197. package/lib/typescript/types/index.d.ts.map +1 -0
  198. package/lib/typescript/utils/address.d.ts +25 -0
  199. package/lib/typescript/utils/address.d.ts.map +1 -0
  200. package/lib/typescript/utils/hash.d.ts +10 -0
  201. package/lib/typescript/utils/hash.d.ts.map +1 -0
  202. package/lib/typescript/utils/helpers.d.ts +26 -0
  203. package/lib/typescript/utils/helpers.d.ts.map +1 -0
  204. package/lib/typescript/utils/index.d.ts +6 -0
  205. package/lib/typescript/utils/index.d.ts.map +1 -0
  206. package/lib/typescript/utils/timestamp.d.ts +13 -0
  207. package/lib/typescript/utils/timestamp.d.ts.map +1 -0
  208. package/lib/typescript/utils/trafficSource.d.ts +30 -0
  209. package/lib/typescript/utils/trafficSource.d.ts.map +1 -0
  210. package/lib/typescript/version.d.ts +2 -0
  211. package/lib/typescript/version.d.ts.map +1 -0
  212. package/package.json +143 -0
  213. package/src/FormoAnalytics.ts +685 -0
  214. package/src/FormoAnalyticsProvider.tsx +296 -0
  215. package/src/constants/config.ts +62 -0
  216. package/src/constants/events.ts +26 -0
  217. package/src/constants/index.ts +3 -0
  218. package/src/constants/storage.ts +16 -0
  219. package/src/index.ts +55 -0
  220. package/src/lib/consent/index.ts +52 -0
  221. package/src/lib/event/EventFactory.ts +682 -0
  222. package/src/lib/event/EventManager.ts +50 -0
  223. package/src/lib/event/EventQueue.ts +371 -0
  224. package/src/lib/event/index.ts +4 -0
  225. package/src/lib/event/types.ts +107 -0
  226. package/src/lib/lifecycle/index.ts +215 -0
  227. package/src/lib/logger/index.ts +56 -0
  228. package/src/lib/session/index.ts +103 -0
  229. package/src/lib/storage/AsyncStorageAdapter.ts +173 -0
  230. package/src/lib/storage/MemoryStorage.ts +43 -0
  231. package/src/lib/storage/StorageBlueprint.ts +30 -0
  232. package/src/lib/storage/StorageManager.ts +121 -0
  233. package/src/lib/storage/index.ts +4 -0
  234. package/src/lib/storage/types.ts +23 -0
  235. package/src/lib/wagmi/WagmiEventHandler.ts +574 -0
  236. package/src/lib/wagmi/index.ts +2 -0
  237. package/src/lib/wagmi/types.ts +71 -0
  238. package/src/types/base.ts +287 -0
  239. package/src/types/events.ts +140 -0
  240. package/src/types/index.ts +2 -0
  241. package/src/utils/address.ts +84 -0
  242. package/src/utils/hash.ts +23 -0
  243. package/src/utils/helpers.ts +139 -0
  244. package/src/utils/index.ts +5 -0
  245. package/src/utils/timestamp.ts +25 -0
  246. package/src/utils/trafficSource.ts +153 -0
  247. package/src/version.ts +3 -0
package/README.md ADDED
@@ -0,0 +1,302 @@
1
+ # @formo/analytics-react-native
2
+
3
+ Formo Analytics SDK for React Native - Track wallet events and user analytics in mobile dApps.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @formo/analytics-react-native @react-native-async-storage/async-storage
9
+
10
+ # or with yarn
11
+ yarn add @formo/analytics-react-native @react-native-async-storage/async-storage
12
+
13
+ # or with pnpm
14
+ pnpm add @formo/analytics-react-native @react-native-async-storage/async-storage
15
+ ```
16
+
17
+ ### iOS Setup
18
+
19
+ ```bash
20
+ cd ios && pod install
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ### 1. Wrap your app with the provider
26
+
27
+ ```tsx
28
+ import AsyncStorage from '@react-native-async-storage/async-storage';
29
+ import { FormoAnalyticsProvider } from '@formo/analytics-react-native';
30
+
31
+ function App() {
32
+ return (
33
+ <FormoAnalyticsProvider
34
+ writeKey="your-write-key"
35
+ asyncStorage={AsyncStorage}
36
+ options={{
37
+ app: {
38
+ name: 'MyApp',
39
+ version: '1.0.0',
40
+ },
41
+ }}
42
+ >
43
+ <YourApp />
44
+ </FormoAnalyticsProvider>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### 2. Use the hook in your components
50
+
51
+ ```tsx
52
+ import { useFormo } from '@formo/analytics-react-native';
53
+ import { useEffect } from 'react';
54
+
55
+ function HomeScreen() {
56
+ const formo = useFormo();
57
+
58
+ useEffect(() => {
59
+ // Track screen view
60
+ formo.screen('Home');
61
+ }, []);
62
+
63
+ const handleSignUp = () => {
64
+ // Track custom event
65
+ formo.track('Sign Up Button Pressed', {
66
+ screen: 'Home',
67
+ });
68
+ };
69
+
70
+ return <Button onPress={handleSignUp}>Sign Up</Button>;
71
+ }
72
+ ```
73
+
74
+ ## Wagmi Integration
75
+
76
+ For dApps using Wagmi for wallet connections, you can enable automatic wallet event tracking:
77
+
78
+ ```tsx
79
+ import { QueryClient } from '@tanstack/react-query';
80
+ import { createConfig } from 'wagmi';
81
+ import AsyncStorage from '@react-native-async-storage/async-storage';
82
+ import { FormoAnalyticsProvider } from '@formo/analytics-react-native';
83
+
84
+ const queryClient = new QueryClient();
85
+ const wagmiConfig = createConfig({
86
+ // your wagmi config
87
+ });
88
+
89
+ function App() {
90
+ return (
91
+ <FormoAnalyticsProvider
92
+ writeKey="your-write-key"
93
+ asyncStorage={AsyncStorage}
94
+ options={{
95
+ wagmi: {
96
+ config: wagmiConfig,
97
+ queryClient: queryClient,
98
+ },
99
+ }}
100
+ >
101
+ <YourApp />
102
+ </FormoAnalyticsProvider>
103
+ );
104
+ }
105
+ ```
106
+
107
+ This automatically tracks:
108
+ - Wallet connections and disconnections
109
+ - Chain changes
110
+ - Signature requests (with QueryClient)
111
+ - Transaction events (with QueryClient)
112
+
113
+ ## API Reference
114
+
115
+ ### FormoAnalyticsProvider Props
116
+
117
+ | Prop | Type | Required | Description |
118
+ |------|------|----------|-------------|
119
+ | `writeKey` | `string` | Yes | Your Formo write key |
120
+ | `asyncStorage` | `AsyncStorageInterface` | Yes | AsyncStorage instance |
121
+ | `options` | `Options` | No | Configuration options |
122
+ | `disabled` | `boolean` | No | Disable analytics |
123
+
124
+ ### Options
125
+
126
+ ```typescript
127
+ interface Options {
128
+ // Wagmi integration
129
+ wagmi?: {
130
+ config: any; // Wagmi config from createConfig()
131
+ queryClient?: any; // TanStack QueryClient for mutation tracking
132
+ };
133
+
134
+ // App information
135
+ app?: {
136
+ name?: string;
137
+ version?: string;
138
+ build?: string;
139
+ bundleId?: string;
140
+ };
141
+
142
+ // Event batching
143
+ flushAt?: number; // Batch size (default: 20)
144
+ flushInterval?: number; // Flush interval in ms (default: 30000)
145
+ retryCount?: number; // Retry count (default: 3)
146
+ maxQueueSize?: number; // Max queue size in bytes (default: 500KB)
147
+
148
+ // Autocapture control
149
+ autocapture?: boolean | {
150
+ connect?: boolean;
151
+ disconnect?: boolean;
152
+ signature?: boolean;
153
+ transaction?: boolean;
154
+ chain?: boolean;
155
+ };
156
+
157
+ // Tracking control
158
+ tracking?: boolean | {
159
+ excludeChains?: number[];
160
+ };
161
+
162
+ // Logging
163
+ logger?: {
164
+ enabled?: boolean;
165
+ levels?: ('debug' | 'info' | 'warn' | 'error' | 'log')[];
166
+ };
167
+
168
+ // Custom API host
169
+ apiHost?: string;
170
+
171
+ // Ready callback
172
+ ready?: (formo: IFormoAnalytics) => void;
173
+ }
174
+ ```
175
+
176
+ ### useFormo Hook Methods
177
+
178
+ #### `screen(name, properties?, context?, callback?)`
179
+ Track a screen view.
180
+
181
+ ```typescript
182
+ formo.screen('Profile', { userId: '123' });
183
+ ```
184
+
185
+ #### `track(event, properties?, context?, callback?)`
186
+ Track a custom event.
187
+
188
+ ```typescript
189
+ formo.track('Purchase Completed', {
190
+ revenue: 99.99,
191
+ currency: 'USD',
192
+ productId: 'nft-001',
193
+ });
194
+ ```
195
+
196
+ #### `identify(params, properties?, context?, callback?)`
197
+ Identify a user by their wallet address.
198
+
199
+ ```typescript
200
+ formo.identify({
201
+ address: '0x1234...',
202
+ userId: 'user-123',
203
+ providerName: 'MetaMask',
204
+ rdns: 'io.metamask',
205
+ });
206
+ ```
207
+
208
+ #### `connect(params, properties?, context?, callback?)`
209
+ Track wallet connection.
210
+
211
+ ```typescript
212
+ formo.connect({
213
+ chainId: 1,
214
+ address: '0x1234...',
215
+ });
216
+ ```
217
+
218
+ #### `disconnect(params?, properties?, context?, callback?)`
219
+ Track wallet disconnection.
220
+
221
+ ```typescript
222
+ formo.disconnect({
223
+ chainId: 1,
224
+ address: '0x1234...',
225
+ });
226
+ ```
227
+
228
+ #### `chain(params, properties?, context?, callback?)`
229
+ Track chain change.
230
+
231
+ ```typescript
232
+ formo.chain({
233
+ chainId: 137,
234
+ address: '0x1234...',
235
+ });
236
+ ```
237
+
238
+ #### `signature(params, properties?, context?, callback?)`
239
+ Track signature event.
240
+
241
+ ```typescript
242
+ import { SignatureStatus } from '@formo/analytics-react-native';
243
+
244
+ formo.signature({
245
+ status: SignatureStatus.CONFIRMED,
246
+ chainId: 1,
247
+ address: '0x1234...',
248
+ message: 'Sign this message',
249
+ signatureHash: '0xabcd...',
250
+ });
251
+ ```
252
+
253
+ #### `transaction(params, properties?, context?, callback?)`
254
+ Track transaction event.
255
+
256
+ ```typescript
257
+ import { TransactionStatus } from '@formo/analytics-react-native';
258
+
259
+ formo.transaction({
260
+ status: TransactionStatus.BROADCASTED,
261
+ chainId: 1,
262
+ address: '0x1234...',
263
+ to: '0x5678...',
264
+ value: '1000000000000000000',
265
+ transactionHash: '0xdef...',
266
+ });
267
+ ```
268
+
269
+ #### Consent Management
270
+
271
+ ```typescript
272
+ // Opt out of tracking (GDPR compliance)
273
+ formo.optOutTracking();
274
+
275
+ // Check opt-out status
276
+ const isOptedOut = formo.hasOptedOutTracking();
277
+
278
+ // Opt back in
279
+ formo.optInTracking();
280
+ ```
281
+
282
+ ## Event Types
283
+
284
+ The SDK automatically enriches events with mobile-specific context:
285
+
286
+ - Device information (OS, version, model)
287
+ - Screen dimensions and density
288
+ - Locale and timezone
289
+ - App information (if provided)
290
+ - Anonymous ID (persistent across sessions)
291
+
292
+ ## Offline Support
293
+
294
+ Events are queued locally and sent when the device has network connectivity. Events are automatically flushed when:
295
+
296
+ - The batch size is reached (default: 20 events)
297
+ - The flush interval passes (default: 30 seconds)
298
+ - The app goes to background
299
+
300
+ ## License
301
+
302
+ MIT