mixpanel-react-native 2.4.0 → 3.0.0-beta.1

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 (42) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/CHANGELOG.md +31 -0
  3. package/README.md +2 -2
  4. package/Samples/MixpanelExpo/App.js +340 -0
  5. package/Samples/MixpanelExpo/app.json +30 -0
  6. package/Samples/MixpanelExpo/assets/adaptive-icon.png +0 -0
  7. package/Samples/MixpanelExpo/assets/favicon.png +0 -0
  8. package/Samples/MixpanelExpo/assets/icon.png +0 -0
  9. package/Samples/MixpanelExpo/assets/splash.png +0 -0
  10. package/Samples/MixpanelExpo/babel.config.js +6 -0
  11. package/Samples/MixpanelExpo/package.json +25 -0
  12. package/__mocks__/@react-native-async-storage/async-storage.js +1 -0
  13. package/__tests__/core.test.js +135 -0
  14. package/__tests__/index.test.js +257 -106
  15. package/__tests__/jest_setup.js +23 -4
  16. package/__tests__/main.test.js +788 -0
  17. package/__tests__/network.test.js +72 -0
  18. package/__tests__/persistent.test.js +161 -0
  19. package/__tests__/queue.test.js +65 -0
  20. package/android/bin/.settings/org.eclipse.buildship.core.prefs +1 -1
  21. package/android/bin/build.gradle +8 -1
  22. package/docs/Mixpanel.html +42 -44
  23. package/docs/MixpanelGroup.html +7 -7
  24. package/docs/People.html +12 -12
  25. package/docs/index.html +3 -3
  26. package/docs/index.js.html +873 -791
  27. package/index.d.ts +53 -53
  28. package/index.js +917 -835
  29. package/javascript/mixpanel-config.js +102 -0
  30. package/javascript/mixpanel-constants.js +22 -0
  31. package/javascript/mixpanel-core.js +164 -0
  32. package/javascript/mixpanel-logger.js +35 -0
  33. package/javascript/mixpanel-main.js +548 -0
  34. package/javascript/mixpanel-network.js +86 -0
  35. package/javascript/mixpanel-persistent.js +297 -0
  36. package/javascript/mixpanel-queue.js +65 -0
  37. package/javascript/mixpanel-storage.js +43 -0
  38. package/javascript/mixpanel-utils.js +38 -0
  39. package/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json +49 -0
  40. package/logs/.c366df74eeb671df60a57a2075ae40a3dae2af25-audit.json +49 -0
  41. package/package.json +61 -56
  42. package/release.py +2 -1
@@ -0,0 +1,297 @@
1
+ import {
2
+ getDeviceIdKey,
3
+ getDistinctIdKey,
4
+ getSuperPropertiesKey,
5
+ getTimeEventsKey,
6
+ getOptedOutKey as getOutedOutKey,
7
+ getQueueKey,
8
+ getUserIdKey,
9
+ getAppHasOpenedBeforeKey,
10
+ } from "./mixpanel-constants";
11
+
12
+ import {AsyncStorageAdapter} from "./mixpanel-storage";
13
+ import uuid from "uuid";
14
+ import {MixpanelLogger} from "mixpanel-react-native/javascript/mixpanel-logger";
15
+
16
+ export class MixpanelPersistent {
17
+ static instance;
18
+
19
+ static getInstance(storage = new AsyncStorageAdapter()) {
20
+ if (!MixpanelPersistent.instance) {
21
+ MixpanelPersistent.instance = new MixpanelPersistent(storage);
22
+ MixpanelPersistent.initializationCompletePromise = MixpanelPersistent.instance.initializationCompletePromise();
23
+ }
24
+ return MixpanelPersistent.instance;
25
+ }
26
+
27
+ constructor(storage) {
28
+ if (MixpanelPersistent.instance) {
29
+ throw new Error(`Use MixpanelPersistent.getInstance()`);
30
+ }
31
+
32
+ this.storage = storage;
33
+ this._superProperties = {};
34
+ this._timeEvents = {};
35
+ this._identity = {};
36
+ this._optedOut = {};
37
+ this._appHasOpenedBefore = {};
38
+ }
39
+
40
+ async initializationCompletePromise(token) {
41
+ Promise.all([
42
+ this.loadIdentity(token),
43
+ this.loadSuperProperties(token),
44
+ this.loadTimeEvents(token),
45
+ this.loadOptOut(token),
46
+ this.loadAppHasOpenedBefore(token),
47
+ ]);
48
+ }
49
+
50
+ async loadDeviceId(token) {
51
+ await this.storage.getItem(getDeviceIdKey(token)).then((deviceId) => {
52
+ if (!this._identity[token]) {
53
+ this._identity[token] = {};
54
+ }
55
+ this._identity[token].deviceId = deviceId;
56
+ });
57
+ if (!this._identity[token].deviceId) {
58
+ this._identity[token].deviceId = uuid.v4();
59
+ await this.storage.setItem(
60
+ getDeviceIdKey(token),
61
+ this._identity[token].deviceId
62
+ );
63
+ }
64
+ MixpanelLogger.log(token, "deviceId:", this._identity[token].deviceId);
65
+ }
66
+
67
+ async loadDistinctId(token) {
68
+ await this.storage.getItem(getDistinctIdKey(token)).then((distinctId) => {
69
+ if (!this._identity[token]) {
70
+ this._identity[token] = {};
71
+ }
72
+ this._identity[token].distinctId = distinctId;
73
+ });
74
+ if (!this._identity[token].distinctId) {
75
+ this._identity[token].distinctId =
76
+ "$device:" + this._identity[token].deviceId;
77
+ await this.storage.setItem(
78
+ getDistinctIdKey(token),
79
+ this._identity[token].distinctId
80
+ );
81
+ }
82
+ MixpanelLogger.log(token, "distinctId:", this._identity[token].distinctId);
83
+ }
84
+
85
+ async loadUserId(token) {
86
+ await this.storage.getItem(getUserIdKey(token)).then((userId) => {
87
+ if (!this._identity[token]) {
88
+ this._identity[token] = {};
89
+ }
90
+ this._identity[token].userId = userId;
91
+ });
92
+ MixpanelLogger.log(token, "userId:", this._identity[token].userId);
93
+ }
94
+
95
+ async loadIdentity(token) {
96
+ await this.loadDeviceId(token);
97
+ await this.loadDistinctId(token);
98
+ await this.loadUserId(token);
99
+ }
100
+
101
+ async persistIdentity(token) {
102
+ await this.persistDeviceId(token);
103
+ await this.persistDistinctId(token);
104
+ await this.persistUserId(token);
105
+ }
106
+
107
+ getDeviceId(token) {
108
+ if (!this._identity[token]) {
109
+ return null;
110
+ }
111
+ return this._identity[token].deviceId;
112
+ }
113
+
114
+ updateDeviceId(token, deviceId) {
115
+ this._identity[token].deviceId = deviceId;
116
+ }
117
+
118
+ async persistDeviceId(token) {
119
+ if (!this._identity[token] || this._identity[token].deviceId === null) {
120
+ return;
121
+ }
122
+ await this.storage.setItem(
123
+ getDeviceIdKey(token),
124
+ this._identity[token].deviceId
125
+ );
126
+ }
127
+
128
+ getDistinctId(token) {
129
+ if (!this._identity[token]) {
130
+ return null;
131
+ }
132
+ return this._identity[token].distinctId;
133
+ }
134
+
135
+ updateDistinctId(token, distinctId) {
136
+ this._identity[token].distinctId = distinctId;
137
+ }
138
+
139
+ async persistDistinctId(token) {
140
+ if (!this._identity[token] || this._identity[token].distinctId === null) {
141
+ return;
142
+ }
143
+ await this.storage.setItem(
144
+ getDistinctIdKey(token),
145
+ this._identity[token].distinctId
146
+ );
147
+ }
148
+
149
+ getUserId(token) {
150
+ if (!this._identity[token]) {
151
+ return null;
152
+ }
153
+ return this._identity[token].userId;
154
+ }
155
+
156
+ updateUserId(token, userId) {
157
+ this._identity[token].userId = userId;
158
+ }
159
+
160
+ async persistUserId(token) {
161
+ if (!this._identity[token] || this._identity[token].userId === null) {
162
+ return;
163
+ }
164
+ await this.storage.setItem(
165
+ getUserIdKey(token),
166
+ this._identity[token].userId
167
+ );
168
+ }
169
+
170
+ async loadSuperProperties(token) {
171
+ const superPropertiesString = await this.storage.getItem(
172
+ getSuperPropertiesKey(token)
173
+ );
174
+ this._superProperties[token] = superPropertiesString
175
+ ? JSON.parse(superPropertiesString)
176
+ : {};
177
+ }
178
+
179
+ getSuperProperties(token) {
180
+ return this._superProperties[token];
181
+ }
182
+
183
+ updateSuperProperties(token, superProperties) {
184
+ this._superProperties = {
185
+ ...this._superProperties,
186
+ [token]: {...superProperties},
187
+ };
188
+ }
189
+
190
+ async persistSuperProperties(token) {
191
+ if (this._superProperties[token] === null) {
192
+ return;
193
+ }
194
+ await this.storage.setItem(
195
+ getSuperPropertiesKey(token),
196
+ JSON.stringify(this._superProperties[token])
197
+ );
198
+ }
199
+
200
+ async loadTimeEvents(token) {
201
+ const timeEventsString = await this.storage.getItem(
202
+ getTimeEventsKey(token)
203
+ );
204
+ this._timeEvents[token] = timeEventsString
205
+ ? JSON.parse(timeEventsString)
206
+ : {};
207
+ }
208
+
209
+ getTimeEvents(token) {
210
+ return this._timeEvents[token];
211
+ }
212
+
213
+ updateTimeEvents(token, timeEvents) {
214
+ this._timeEvents = {...this._timeEvents, [token]: {...timeEvents}};
215
+ }
216
+
217
+ async persistTimeEvents(token) {
218
+ if (this._timeEvents[token] === null) {
219
+ return;
220
+ }
221
+ await this.storage.setItem(
222
+ getTimeEventsKey(token),
223
+ JSON.stringify(this._timeEvents[token])
224
+ );
225
+ }
226
+
227
+ async loadOptOut(token) {
228
+ const optOutString = await this.storage.getItem(getOutedOutKey(token));
229
+ this._optedOut[token] = optOutString === "true";
230
+ }
231
+
232
+ getOptedOut(token) {
233
+ return this._optedOut[token] === true;
234
+ }
235
+
236
+ updateOptedOut(token, optOut) {
237
+ this._optedOut = {...this._optedOut, [token]: optOut};
238
+ }
239
+
240
+ async persistOptedOut(token) {
241
+ if (this._optedOut[token] === null) {
242
+ return;
243
+ }
244
+ await this.storage.setItem(
245
+ getOutedOutKey(token),
246
+ this._optedOut[token].toString()
247
+ );
248
+ }
249
+
250
+ async loadQueue(token, type) {
251
+ const queueString = await this.storage.getItem(getQueueKey(token, type));
252
+ return queueString ? JSON.parse(queueString) : [];
253
+ }
254
+
255
+ async saveQueue(token, type, queue) {
256
+ await this.storage.setItem(getQueueKey(token, type), JSON.stringify(queue));
257
+ }
258
+
259
+ async loadAppHasOpenedBefore(token) {
260
+ const appHasOpenedBeforeString = await this.storage.getItem(
261
+ getAppHasOpenedBeforeKey(token)
262
+ );
263
+ this._appHasOpenedBefore[token] = appHasOpenedBeforeString === "true";
264
+ }
265
+
266
+ getAppHasOpenedBefore(token) {
267
+ return this._appHasOpenedBefore[token] === true;
268
+ }
269
+
270
+ updateAppHasOpenedBefore(token, appHasOpenedBefore) {
271
+ this._appHasOpenedBefore = {
272
+ ...this._appHasOpenedBefore,
273
+ [token]: appHasOpenedBefore,
274
+ };
275
+ }
276
+
277
+ async persistAppHasOpenedBefore(token) {
278
+ if (this._appHasOpenedBefore[token] === null) {
279
+ return;
280
+ }
281
+ await this.storage.setItem(
282
+ getAppHasOpenedBeforeKey(token),
283
+ this._appHasOpenedBefore[token].toString()
284
+ );
285
+ }
286
+
287
+ async reset(token) {
288
+ await this.storage.removeItem(getDeviceIdKey(token));
289
+ await this.storage.removeItem(getDistinctIdKey(token));
290
+ await this.storage.removeItem(getUserIdKey(token));
291
+ await this.storage.removeItem(getSuperPropertiesKey(token));
292
+ await this.storage.removeItem(getTimeEventsKey(token));
293
+ await this.loadIdentity(token);
294
+ await this.loadSuperProperties(token);
295
+ await this.loadTimeEvents(token);
296
+ }
297
+ }
@@ -0,0 +1,65 @@
1
+ import {MixpanelPersistent} from "./mixpanel-persistent";
2
+
3
+ export const MixpanelQueueManager = (() => {
4
+ let _queues = {};
5
+ const mixpanelPersistent = MixpanelPersistent.getInstance();
6
+
7
+ const initialize = async (token, type) => {
8
+ if (!_queues[token] || !_queues[token][type]) {
9
+ const queue = await mixpanelPersistent.loadQueue(token, type);
10
+ _queues[token] = {
11
+ ..._queues[token],
12
+ [type]: queue,
13
+ };
14
+ }
15
+ };
16
+
17
+ const updateQueueInStorage = async (token, type) => {
18
+ if (!_queues[token] || !_queues[token][type]) {
19
+ return;
20
+ }
21
+ await mixpanelPersistent.saveQueue(token, type, _queues[token][type]);
22
+ };
23
+
24
+ const enqueue = async (token, type, data) => {
25
+ if (!_queues[token] || !_queues[token][type]) {
26
+ _queues[token] = {
27
+ ..._queues[token],
28
+ [type]: [],
29
+ };
30
+ }
31
+ _queues[token][type].push(data);
32
+ await updateQueueInStorage(token, type);
33
+ };
34
+
35
+ const getQueue = (token, type) => {
36
+ if (!_queues[token] || !_queues[token][type]) {
37
+ return [];
38
+ }
39
+ return [..._queues[token][type]];
40
+ };
41
+
42
+ const spliceQueue = async (token, type, start, deleteCount) => {
43
+ if (!_queues[token] || !_queues[token][type]) {
44
+ return;
45
+ }
46
+ _queues[token][type].splice(start, deleteCount);
47
+ await updateQueueInStorage(token, type);
48
+ };
49
+
50
+ const clearQueue = async (token, type) => {
51
+ if (!_queues[token] || !_queues[token][type]) {
52
+ return;
53
+ }
54
+ _queues[token][type] = [];
55
+ await updateQueueInStorage(token, type);
56
+ };
57
+
58
+ return {
59
+ initialize,
60
+ enqueue,
61
+ getQueue,
62
+ spliceQueue,
63
+ clearQueue,
64
+ };
65
+ })();
@@ -0,0 +1,43 @@
1
+ import AsyncStorage from "@react-native-async-storage/async-storage";
2
+ import {MixpanelLogger} from "mixpanel-react-native/javascript/mixpanel-logger";
3
+
4
+ export class IMixpanelStorage {
5
+ async getItem(key) {
6
+ throw new Error(`getItem method not implemented`);
7
+ }
8
+
9
+ async setItem(key, value) {
10
+ throw new Error(`setItem method not implemented`);
11
+ }
12
+
13
+ async removeItem(key) {
14
+ throw new Error(`removeItem method not implemented`);
15
+ }
16
+ }
17
+
18
+ export class AsyncStorageAdapter extends IMixpanelStorage {
19
+ async getItem(key) {
20
+ try {
21
+ return await AsyncStorage.getItem(key);
22
+ } catch {
23
+ MixpanelLogger.error("error getting item from AsyncStorage");
24
+ return null;
25
+ }
26
+ }
27
+
28
+ async setItem(key, value) {
29
+ try {
30
+ await AsyncStorage.setItem(key, value);
31
+ } catch {
32
+ MixpanelLogger.error("error setting item in AsyncStorage");
33
+ }
34
+ }
35
+
36
+ async removeItem(key) {
37
+ try {
38
+ await AsyncStorage.removeItem(key);
39
+ } catch {
40
+ MixpanelLogger.error("error removing item in AsyncStorage");
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,38 @@
1
+ import {MixpanelType} from "mixpanel-react-native/javascript/mixpanel-constants";
2
+
3
+ export class SessionMetadata {
4
+ constructor(trackingQueue) {
5
+ this.eventsCounter = 0;
6
+ this.peopleCounter = 0;
7
+ this.sessionID = SessionMetadata.randomId();
8
+ this.sessionStartEpoch = Math.round(Date.now() / 1000);
9
+ this.trackingQueue = trackingQueue;
10
+ }
11
+
12
+ static randomId() {
13
+ return (
14
+ Math.floor(Math.random() * (1 << 30)).toString(16) +
15
+ Math.floor(Math.random() * (1 << 30)).toString(16)
16
+ ).padStart(16, "0");
17
+ }
18
+
19
+ toDict(type) {
20
+ const dict = {
21
+ $mp_metadata: {
22
+ $mp_event_id: SessionMetadata.randomId(),
23
+ $mp_session_id: this.sessionID,
24
+ $mp_session_seq_id:
25
+ type === MixpanelType.EVENTS
26
+ ? this.eventsCounter
27
+ : this.peopleCounter,
28
+ $mp_session_start_sec: this.sessionStartEpoch,
29
+ },
30
+ };
31
+ if (type === MixpanelType.EVENTS) {
32
+ this.eventsCounter += 1;
33
+ } else {
34
+ this.peopleCounter += 1;
35
+ }
36
+ return dict;
37
+ }
38
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "keep": {
3
+ "days": true,
4
+ "amount": 14
5
+ },
6
+ "auditLog": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json",
7
+ "files": [
8
+ {
9
+ "date": 1708031778058,
10
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-15.log",
11
+ "hash": "07532e7603268809e06ca6c5a3157f95"
12
+ },
13
+ {
14
+ "date": 1708369794950,
15
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-19.log",
16
+ "hash": "bf39dc72fcec172864c164cf355008c3"
17
+ },
18
+ {
19
+ "date": 1708589671798,
20
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-22.log",
21
+ "hash": "9c67450d70a05cf38c86a324a06a0bae"
22
+ },
23
+ {
24
+ "date": 1708729198685,
25
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-23.log",
26
+ "hash": "fcc68deaede843fa3054da7015219c86"
27
+ },
28
+ {
29
+ "date": 1708979065434,
30
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-26.log",
31
+ "hash": "2f802970076a00366648363c19b8b75a"
32
+ },
33
+ {
34
+ "date": 1709043115268,
35
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-27.log",
36
+ "hash": "efbf115b440548473f8e3c62c80e2f4a"
37
+ },
38
+ {
39
+ "date": 1709156035546,
40
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-28.log",
41
+ "hash": "fc37ffff09dc4e1e2af0b1d0a3c5767e"
42
+ },
43
+ {
44
+ "date": 1709222274317,
45
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/keplerCliNative-2024-02-29.log",
46
+ "hash": "546199186d8c0087b39f1ddc2e84a088"
47
+ }
48
+ ]
49
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "keep": {
3
+ "days": true,
4
+ "amount": 14
5
+ },
6
+ "auditLog": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/.c366df74eeb671df60a57a2075ae40a3dae2af25-audit.json",
7
+ "files": [
8
+ {
9
+ "date": 1708031778055,
10
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-15.log",
11
+ "hash": "92605562f5e88770140230df60700c47"
12
+ },
13
+ {
14
+ "date": 1708369794945,
15
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-19.log",
16
+ "hash": "80e6705fde5119423369ea171056ddf3"
17
+ },
18
+ {
19
+ "date": 1708589671787,
20
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-22.log",
21
+ "hash": "2b9570aca1dd8ae427021daf1ddb8c3b"
22
+ },
23
+ {
24
+ "date": 1708729198682,
25
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-23.log",
26
+ "hash": "c7c592d1ecfa32a939af0e02fb99bbe7"
27
+ },
28
+ {
29
+ "date": 1708979065426,
30
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-26.log",
31
+ "hash": "361e8d392ab3d6e7fe811fb693fae7ba"
32
+ },
33
+ {
34
+ "date": 1709043115264,
35
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-27.log",
36
+ "hash": "5bee5e0250e1176ab4c6a71041229054"
37
+ },
38
+ {
39
+ "date": 1709156035378,
40
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-28.log",
41
+ "hash": "079504a72e47e4ee908d8bb2c4f5debb"
42
+ },
43
+ {
44
+ "date": 1709222274311,
45
+ "name": "/Users/zihejia/Documents/Projects/Develop/mixpanel-react-native-original/logs/error-2024-02-29.log",
46
+ "hash": "084013dcbe1040f480161dba82d9e9c5"
47
+ }
48
+ ]
49
+ }
package/package.json CHANGED
@@ -1,60 +1,65 @@
1
1
  {
2
- "name": "mixpanel-react-native",
3
- "version": "2.4.0",
4
- "description": "Official React Native Tracking Library for Mixpanel Analytics",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "jest"
8
- },
9
- "author": "Mixpanel",
10
- "license": "Apache-2.0",
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/mixpanel/mixpanel-react-native.git"
14
- },
15
- "keywords": [
16
- "mixpanel",
17
- "react",
18
- "native",
19
- "ios",
20
- "android",
21
- "analytics",
22
- "tracking",
23
- "sdk"
2
+ "name": "mixpanel-react-native",
3
+ "version": "3.0.0-beta.1",
4
+ "description": "Official React Native Tracking Library for Mixpanel Analytics",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "jest"
8
+ },
9
+ "author": "Mixpanel",
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/mixpanel/mixpanel-react-native.git"
14
+ },
15
+ "keywords": [
16
+ "mixpanel",
17
+ "react",
18
+ "native",
19
+ "ios",
20
+ "android",
21
+ "analytics",
22
+ "tracking",
23
+ "sdk"
24
+ ],
25
+ "bugs": {
26
+ "url": "https://github.com/mixpanel/mixpanel-react-native/issues"
27
+ },
28
+ "TODO": "Change the git URL before publishing on npm",
29
+ "homepage": "https://github.com/mixpanel/mixpanel-react-native#readme",
30
+ "metadata": {
31
+ "mp_lib": "react-native"
32
+ },
33
+ "devDependencies": {
34
+ "@babel/core": "^7.12.3",
35
+ "@babel/runtime": "^7.12.1",
36
+ "@react-native-community/eslint-config": "^2.0.0",
37
+ "babel-jest": "^26.6.0",
38
+ "eslint": "^7.11.0",
39
+ "jest": "^26.6.3",
40
+ "jest-fetch-mock": "^3.0.3",
41
+ "metro-react-native-babel-preset": "^0.63.0",
42
+ "react-native": "^0.63.3",
43
+ "react-test-renderer": "16.13.1"
44
+ },
45
+ "jest": {
46
+ "modulePathIgnorePatterns": [
47
+ "<rootDir>/Samples/"
24
48
  ],
25
- "bugs": {
26
- "url": "https://github.com/mixpanel/mixpanel-react-native/issues"
27
- },
28
- "TODO": "Change the git URL before publishing on npm",
29
- "homepage": "https://github.com/mixpanel/mixpanel-react-native#readme",
30
- "metadata": {
31
- "mp_lib": "react-native"
32
- },
33
- "devDependencies": {
34
- "@babel/core": "^7.12.3",
35
- "@babel/runtime": "^7.12.1",
36
- "@react-native-community/eslint-config": "^2.0.0",
37
- "babel-jest": "^26.6.0",
38
- "eslint": "^7.11.0",
39
- "jest": "^26.6.0",
40
- "metro-react-native-babel-preset": "^0.63.0",
41
- "react-test-renderer": "16.13.1",
42
- "react-native": "^0.63.3"
43
- },
44
- "jest": {
45
- "modulePathIgnorePatterns": [
46
- "<rootDir>/MixpanelDemo/"
47
- ],
48
- "testMatch": [
49
- "<rootDir>/__tests__/index.test.js"
50
- ],
51
- "setupFiles": [
52
- "<rootDir>/__tests__/jest_setup.js"
53
- ],
54
- "verbose": true,
55
- "preset": "react-native",
56
- "transform": {
57
- "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
58
- }
49
+ "testMatch": [
50
+ "<rootDir>/__tests__/*.test.js"
51
+ ],
52
+ "setupFiles": [
53
+ "<rootDir>/__tests__/jest_setup.js"
54
+ ],
55
+ "verbose": true,
56
+ "preset": "react-native",
57
+ "transform": {
58
+ "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
59
59
  }
60
+ },
61
+ "dependencies": {
62
+ "@react-native-async-storage/async-storage": "^1.21.0",
63
+ "uuid": "3.3.2"
64
+ }
60
65
  }
package/release.py CHANGED
@@ -10,10 +10,11 @@ args = parser.parse_args()
10
10
 
11
11
  def bump_version():
12
12
  replace_version('package.json', "\"version\": \"" + args.old + "\"", "\"version\": \"" + args.new + "\"")
13
- replace_version('__tests__/index.test.js', "\"$lib_version\": \"" + args.old + "\"", "\"$lib_version\": \"" + args.new + "\"")
13
+ subprocess.call('rm -fr node_modules', shell=True)
14
14
  subprocess.call('cd Samples/MixpanelDemo;rm -fr node_modules;rm -fr android/app/build;rm -fr ios/Pods', shell=True)
15
15
  subprocess.call('cd Samples/SimpleMixpanel;rm -fr node_modules;rm -fr android/app/build;rm -fr ios/Pods', shell=True)
16
16
  subprocess.call('cd Samples/ContextAPIMixpanel;rm -fr node_modules;rm -fr android/app/build;rm -fr ios/Pods', shell=True)
17
+ subprocess.call('cd Samples/MixpanelExpo;rm -fr node_modules', shell=True)
17
18
  subprocess.call('git add package.json', shell=True)
18
19
  subprocess.call('git add __tests__/index.test.js', shell=True)
19
20