mixpanel-react-native 2.4.1 → 3.0.0-beta.2

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 (40) hide show
  1. package/.vscode/settings.json +4 -0
  2. package/CHANGELOG.md +84 -51
  3. package/README.md +9 -3
  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-lock.json +22551 -0
  12. package/Samples/MixpanelExpo/package.json +25 -0
  13. package/__mocks__/@react-native-async-storage/async-storage.js +1 -0
  14. package/__tests__/core.test.js +135 -0
  15. package/__tests__/index.test.js +74 -42
  16. package/__tests__/jest_setup.js +23 -4
  17. package/__tests__/main.test.js +788 -0
  18. package/__tests__/network.test.js +72 -0
  19. package/__tests__/queue.test.js +65 -0
  20. package/docs/Mixpanel.html +42 -44
  21. package/docs/MixpanelGroup.html +7 -7
  22. package/docs/People.html +12 -12
  23. package/docs/index.html +5 -4
  24. package/docs/index.js.html +888 -793
  25. package/index.d.ts +75 -53
  26. package/index.js +89 -57
  27. package/javascript/mixpanel-config.js +102 -0
  28. package/javascript/mixpanel-constants.js +22 -0
  29. package/javascript/mixpanel-core.js +163 -0
  30. package/javascript/mixpanel-logger.js +35 -0
  31. package/javascript/mixpanel-main.js +550 -0
  32. package/javascript/mixpanel-network.js +86 -0
  33. package/javascript/mixpanel-persistent.js +312 -0
  34. package/javascript/mixpanel-queue.js +65 -0
  35. package/javascript/mixpanel-storage.js +36 -0
  36. package/javascript/mixpanel-utils.js +38 -0
  37. package/logs/.b11bf985d66a037ca5688a574653f3bf76a28dfa-audit.json +19 -0
  38. package/logs/.c366df74eeb671df60a57a2075ae40a3dae2af25-audit.json +19 -0
  39. package/package.json +11 -6
  40. package/release.py +5 -4
@@ -28,40 +28,36 @@
28
28
  <article>
29
29
  <pre class="prettyprint source linenums"><code>"use strict";
30
30
 
31
- import { Platform, NativeModules } from "react-native";
31
+ import {Platform, NativeModules} from "react-native";
32
32
  import packageJson from "./package.json";
33
- const { MixpanelReactNative } = NativeModules;
34
-
35
- if (!MixpanelReactNative) {
36
- throw new Error(`mixpanel-react-native: MixpanelReactNative is null.
37
- Please follow the guide on the Github repository: https://github.com/mixpanel/mixpanel-react-native.`);
38
- }
33
+ const {MixpanelReactNative} = NativeModules;
34
+ import MixpanelMain from "mixpanel-react-native/javascript/mixpanel-main";
39
35
 
40
36
  const DevicePlatform = {
41
- Unknown: "Unknown",
42
- Android: "android",
43
- iOS: "ios"
44
- }
37
+ Unknown: "Unknown",
38
+ Android: "android",
39
+ iOS: "ios",
40
+ };
45
41
 
46
42
  const ERROR_MESSAGE = {
47
- INVALID_OBJECT: " is not a valid json object",
48
- INVALID_STRING: " is not a valid string",
49
- REQUIRED_DOUBLE: " is not a valid number"
50
- }
43
+ INVALID_OBJECT: " is not a valid json object",
44
+ INVALID_STRING: " is not a valid string",
45
+ REQUIRED_DOUBLE: " is not a valid number",
46
+ };
51
47
 
52
48
  const PARAMS = {
53
- TOKEN: "token",
54
- DISTINCT_ID: "distinctId",
55
- ALIAS: "alias",
56
- EVENT_NAME: "eventName",
57
- GROUP_KEY: "groupKey",
58
- PROPERTIES: "properties",
59
- PROPERTY_NAME: "propertyName",
60
- PROP: "prop",
61
- NAME: "name",
62
- CHARGE: "charge",
63
- PROPERTY_VALUE: "property value"
64
- }
49
+ TOKEN: "token",
50
+ DISTINCT_ID: "distinctId",
51
+ ALIAS: "alias",
52
+ EVENT_NAME: "eventName",
53
+ GROUP_KEY: "groupKey",
54
+ PROPERTIES: "properties",
55
+ PROPERTY_NAME: "propertyName",
56
+ PROP: "prop",
57
+ NAME: "name",
58
+ CHARGE: "charge",
59
+ PROPERTY_VALUE: "property value",
60
+ };
65
61
 
66
62
  const DEFAULT_OPT_OUT = false;
67
63
 
@@ -69,493 +65,561 @@ const DEFAULT_OPT_OUT = false;
69
65
  * The primary class for integrating Mixpanel with your app.
70
66
  */
71
67
  export class Mixpanel {
72
-
73
- constructor(token, trackAutomaticEvents) {
74
- if (!StringHelper.isValid(token)) {
75
- StringHelper.raiseError(PARAMS.TOKEN);
76
- }
77
- if (trackAutomaticEvents == null) {
78
- throw new Error(`trackAutomaticEvents is undefined`);
79
- }
80
- this.token = token;
81
- this.trackAutomaticEvents = trackAutomaticEvents;
82
- this.people = new People(this.token);
83
- }
84
-
85
- /**
86
- * Initializes Mixpanel
87
- *
88
- * @param {boolean} optOutTrackingDefault Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
89
- * @param {object} superProperties Optional A Map containing the key value pairs of the super properties to register
90
- * @param {string} serverURL Optional Set the base URL used for Mixpanel API requests. See setServerURL()
91
- *
92
- */
93
- async init(optOutTrackingDefault = DEFAULT_OPT_OUT, superProperties = {}, serverURL = "https://api.mixpanel.com") {
94
- let metadata = Helper.getMetaData();
95
- await MixpanelReactNative.initialize(this.token, this.trackAutomaticEvents, optOutTrackingDefault, {...metadata, ...superProperties}, serverURL);
96
- }
97
-
98
- /**
99
- * @deprecated since version 1.3.0. To initialize Mixpanel, please use the instance method `init` instead. See the example below:
100
- *
101
- * &lt;pre>&lt;code>
102
- * const trackAutomaticEvents = true;
103
- * const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
104
- * mixpanel.init();
105
- * &lt;/code>&lt;/pre>
106
- *
107
- * Initializes Mixpanel and return an instance of Mixpanel the given project token.
108
- *
109
- * @param {string} token your project token.
110
- * @param {boolean} trackAutomaticEvents Whether or not to automatically track common mobile events
111
- * @param {boolean} Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
112
- *
113
- */
114
- static async init(token, trackAutomaticEvents, optOutTrackingDefault = DEFAULT_OPT_OUT) {
115
- let metadata = Helper.getMetaData();
116
- await MixpanelReactNative.initialize(token, trackAutomaticEvents, optOutTrackingDefault, metadata, "https://api.mixpanel.com");
117
- return new Mixpanel(token, trackAutomaticEvents);
118
- }
119
-
120
- /**
121
- * Set the base URL used for Mixpanel API requests.
122
- * Useful if you need to proxy Mixpanel requests. Defaults to https://api.mixpanel.com.
123
- * To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com
124
- *
125
- * @param {string} serverURL the base URL used for Mixpanel API requests
126
- *
127
- */
128
- setServerURL(serverURL) {
129
- MixpanelReactNative.setServerURL(this.token, serverURL);
68
+ constructor(token, trackAutomaticEvents, useNative = true, storage) {
69
+ if (!StringHelper.isValid(token)) {
70
+ StringHelper.raiseError(PARAMS.TOKEN);
130
71
  }
131
-
132
- /**
133
- * This allows enabling or disabling of all Mixpanel logs at run time.
134
- * All logging is disabled by default. Usually, this is only required if
135
- * you are running into issues with the SDK that you want to debug
136
- *
137
- * @param {boolean} loggingEnabled whether to enable logging
138
- *
139
- */
140
- setLoggingEnabled(loggingEnabled) {
141
- MixpanelReactNative.setLoggingEnabled(this.token, loggingEnabled);
72
+ if (trackAutomaticEvents == null) {
73
+ throw new Error(`trackAutomaticEvents is undefined`);
142
74
  }
143
-
144
- /**
145
- * This allows enabling or disabling whether or not Mixpanel flushes events
146
- * when the app enters the background on iOS. This is set to true by default.
147
- *
148
- * @param {boolean} flushOnBackground whether to enable logging
149
- *
150
- */
151
- setFlushOnBackground(flushOnBackground) {
152
- if (Platform.OS === 'ios') {
153
- MixpanelReactNative.setFlushOnBackground(this.token, flushOnBackground);
154
- } else {
155
- console.warn('Mixpanel setFlushOnBackground was called and ignored because this method only works on iOS.')
156
- }
75
+ this.token = token;
76
+ this.trackAutomaticEvents = trackAutomaticEvents;
77
+ if (!useNative) {
78
+ this.mixpanelImpl = new MixpanelMain(
79
+ token,
80
+ trackAutomaticEvents,
81
+ storage
82
+ );
83
+ return;
157
84
  }
158
85
 
159
- /**
160
- * This controls whether to automatically send the client IP Address as part of event tracking.
161
- * With an IP address, geo-location is possible down to neighborhoods within a city,
162
- * although the Mixpanel Dashboard will just show you city level location specificity.
163
- *
164
- * @param {boolean} useIpAddressForGeolocation whether to automatically send the client IP Address.
165
- * Defaults to true.
166
- *
167
- */
168
- setUseIpAddressForGeolocation(useIpAddressForGeolocation) {
169
- MixpanelReactNative.setUseIpAddressForGeolocation(this.token, useIpAddressForGeolocation);
86
+ if (!MixpanelReactNative) {
87
+ console.warn(
88
+ "MixpanelReactNative is not available; using JavaScript mode. If you prefer not to use the JavaScript mode, please follow the guide in the GitHub repository: https://github.com/mixpanel/mixpanel-react-native."
89
+ );
90
+ this.mixpanelImpl = new MixpanelMain(
91
+ token,
92
+ trackAutomaticEvents,
93
+ storage
94
+ );
95
+ } else {
96
+ this.mixpanelImpl = MixpanelReactNative;
170
97
  }
171
-
172
- /**
173
- * Set the number of events sent in a single network request to the Mixpanel server.
174
- * By configuring this value, you can optimize network usage and manage the frequency of communication between the client and the server. The maximum size is 50; any value over 50 will default to 50.
175
- *
176
- * @param {integer} flushBatchSize whether to automatically send the client IP Address.
177
- * Defaults to true.
178
- *
179
- */
180
- setFlushBatchSize(flushBatchSize) {
181
- MixpanelReactNative.setFlushBatchSize(this.token, flushBatchSize);
98
+ }
99
+
100
+ /**
101
+ * Initializes Mixpanel
102
+ *
103
+ * @param {boolean} optOutTrackingDefault Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
104
+ * @param {object} superProperties Optional A Map containing the key value pairs of the super properties to register
105
+ * @param {string} serverURL Optional Set the base URL used for Mixpanel API requests. See setServerURL()
106
+ *
107
+ */
108
+ async init(
109
+ optOutTrackingDefault = DEFAULT_OPT_OUT,
110
+ superProperties = {},
111
+ serverURL = "https://api.mixpanel.com"
112
+ ) {
113
+ await MixpanelReactNative.initialize(
114
+ this.token,
115
+ this.trackAutomaticEvents,
116
+ optOutTrackingDefault,
117
+ {...Helper.getMetaData(), ...superProperties},
118
+ serverURL
119
+ );
120
+ }
121
+
122
+ /**
123
+ * @deprecated since version 1.3.0. To initialize Mixpanel, please use the instance method `init` instead. See the example below:
124
+ *
125
+ * &lt;pre>&lt;code>
126
+ * const trackAutomaticEvents = true;
127
+ * const mixpanel = new Mixpanel('your project token', trackAutomaticEvents);
128
+ * mixpanel.init();
129
+ * &lt;/code>&lt;/pre>
130
+ *
131
+ * Initializes Mixpanel and return an instance of Mixpanel the given project token.
132
+ *
133
+ * @param {string} token your project token.
134
+ * @param {boolean} trackAutomaticEvents Whether or not to automatically track common mobile events
135
+ * @param {boolean} Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
136
+ *
137
+ */
138
+ static async init(
139
+ token,
140
+ trackAutomaticEvents,
141
+ optOutTrackingDefault = DEFAULT_OPT_OUT
142
+ ) {
143
+ await MixpanelReactNative.initialize(
144
+ token,
145
+ trackAutomaticEvents,
146
+ optOutTrackingDefault,
147
+ Helper.getMetaData(),
148
+ "https://api.mixpanel.com"
149
+ );
150
+ return new Mixpanel(token, trackAutomaticEvents);
151
+ }
152
+
153
+ /**
154
+ * Set the base URL used for Mixpanel API requests.
155
+ * Useful if you need to proxy Mixpanel requests. Defaults to https://api.mixpanel.com.
156
+ * To route data to Mixpanel's EU servers, set to https://api-eu.mixpanel.com
157
+ *
158
+ * @param {string} serverURL the base URL used for Mixpanel API requests
159
+ *
160
+ */
161
+ setServerURL(serverURL) {
162
+ this.mixpanelImpl.setServerURL(this.token, serverURL);
163
+ }
164
+
165
+ /**
166
+ * This allows enabling or disabling of all Mixpanel logs at run time.
167
+ * All logging is disabled by default. Usually, this is only required if
168
+ * you are running into issues with the SDK that you want to debug
169
+ *
170
+ * @param {boolean} loggingEnabled whether to enable logging
171
+ *
172
+ */
173
+ setLoggingEnabled(loggingEnabled) {
174
+ this.mixpanelImpl.setLoggingEnabled(this.token, loggingEnabled);
175
+ }
176
+
177
+ /**
178
+ * This allows enabling or disabling whether or not Mixpanel flushes events
179
+ * when the app enters the background on iOS. This is set to true by default.
180
+ *
181
+ * @param {boolean} flushOnBackground whether to enable logging
182
+ *
183
+ */
184
+ setFlushOnBackground(flushOnBackground) {
185
+ if (Platform.OS === "ios") {
186
+ MixpanelReactNative.setFlushOnBackground(this.token, flushOnBackground);
187
+ } else {
188
+ console.warn(
189
+ "Mixpanel setFlushOnBackground was called and ignored because this method only works on iOS."
190
+ );
182
191
  }
183
-
184
-
185
- /**
186
- * Will return true if the user has opted out from tracking.
187
- *
188
- * @return {Promise&lt;boolean>} true if user has opted out from tracking. Defaults to false.
189
- */
190
- hasOptedOutTracking() {
191
- return MixpanelReactNative.hasOptedOutTracking(this.token);
192
+ }
193
+
194
+ /**
195
+ * This controls whether to automatically send the client IP Address as part of event tracking.
196
+ * With an IP address, geo-location is possible down to neighborhoods within a city,
197
+ * although the Mixpanel Dashboard will just show you city level location specificity.
198
+ *
199
+ * @param {boolean} useIpAddressForGeolocation whether to automatically send the client IP Address.
200
+ * Defaults to true.
201
+ *
202
+ */
203
+ setUseIpAddressForGeolocation(useIpAddressForGeolocation) {
204
+ this.mixpanelImpl.setUseIpAddressForGeolocation(
205
+ this.token,
206
+ useIpAddressForGeolocation
207
+ );
208
+ }
209
+
210
+ /**
211
+ * Set the number of events sent in a single network request to the Mixpanel server.
212
+ * By configuring this value, you can optimize network usage and manage the frequency of communication between the client and the server. The maximum size is 50; any value over 50 will default to 50.
213
+ *
214
+ * @param {integer} flushBatchSize whether to automatically send the client IP Address.
215
+ * Defaults to true.
216
+ *
217
+ */
218
+ setFlushBatchSize(flushBatchSize) {
219
+ this.mixpanelImpl.setFlushBatchSize(this.token, flushBatchSize);
220
+ }
221
+
222
+ /**
223
+ * Will return true if the user has opted out from tracking.
224
+ *
225
+ * @return {Promise&lt;boolean>} true if user has opted out from tracking. Defaults to false.
226
+ */
227
+ hasOptedOutTracking() {
228
+ return this.mixpanelImpl.hasOptedOutTracking(this.token);
229
+ }
230
+
231
+ /**
232
+ * Use this method to opt-in an already opted-out user from tracking. People updates and track
233
+ * calls will be sent to Mixpanel after using this method.
234
+ * This method will internally track an opt-in event to your project.
235
+ *
236
+ */
237
+ optInTracking() {
238
+ this.mixpanelImpl.optInTracking(this.token);
239
+ }
240
+
241
+ /**
242
+ * Use this method to opt-out a user from tracking. Events and people updates that haven't been
243
+ * flushed yet will be deleted. Use flush() before calling this method if you want
244
+ * to send all the queues to Mixpanel before.
245
+ *
246
+ * This method will also remove any user-related information from the device.
247
+ */
248
+ optOutTracking() {
249
+ this.mixpanelImpl.optOutTracking(this.token);
250
+ }
251
+
252
+ /**
253
+ * Associate all future calls to track() with the user identified by
254
+ * the given distinct id.
255
+ *
256
+ * &lt;p>Calls to track() made before corresponding calls to identify
257
+ * will use an anonymous locally generated distinct id, which means it is best to call identify
258
+ * early to ensure that your Mixpanel funnels and retention analytics can continue to track the
259
+ * user throughout their lifetime. We recommend calling identify when the user authenticates.
260
+ *
261
+ * &lt;p>Once identify is called, the local distinct id persists across restarts of
262
+ * your application.
263
+ *
264
+ * @param {string} distinctId a string uniquely identifying this user. Events sent to
265
+ * Mixpanel using the same disinct_id will be considered associated with the
266
+ * same visitor/customer for retention and funnel reporting, so be sure that the given
267
+ * value is globally unique for each individual user you intend to track.
268
+ * @returns {Promise} A promise that resolves when the identify is successful.
269
+ * It does not return any value.
270
+ *
271
+ */
272
+ identify(distinctId) {
273
+ return new Promise((resolve, reject) => {
274
+ if (!StringHelper.isValid(distinctId)) {
275
+ StringHelper.raiseError(PARAMS.DISTINCT_ID);
276
+ reject(new Error("Invalid distinctId"));
277
+ }
278
+ this.mixpanelImpl
279
+ .identify(this.token, distinctId)
280
+ .then(() => {
281
+ resolve();
282
+ })
283
+ .catch((err) => {
284
+ reject(err);
285
+ });
286
+ });
287
+ }
288
+
289
+ /**
290
+ * @deprecated The alias method creates an alias which Mixpanel will use to remap one id to another.
291
+ * Multiple aliases can point to the same identifier.
292
+ *
293
+ * `mixpane.alias("New ID", mixpane.distinctId)`
294
+ * `mixpane.alias("Newer ID", mixpane.distinctId)`
295
+ *
296
+ * &lt;p>This call does not identify the user after. You must still call identify()
297
+ * if you wish the new alias to be used for Events and People.
298
+ *
299
+ * @param {string} alias A unique identifier that you want to use as an identifier for this user.
300
+ * @param {string} distinctId the current distinct_id that alias will be mapped to.
301
+ */
302
+ alias(alias, distinctId) {
303
+ if (!StringHelper.isValid(alias)) {
304
+ StringHelper.raiseError(PARAMS.ALIAS);
192
305
  }
193
-
194
- /**
195
- * Use this method to opt-in an already opted-out user from tracking. People updates and track
196
- * calls will be sent to Mixpanel after using this method.
197
- * This method will internally track an opt-in event to your project.
198
- *
199
- */
200
- optInTracking() {
201
- MixpanelReactNative.optInTracking(this.token);
306
+ if (!StringHelper.isValid(distinctId)) {
307
+ StringHelper.raiseError(PARAMS.DISTINCT_ID);
202
308
  }
203
-
204
- /**
205
- * Use this method to opt-out a user from tracking. Events and people updates that haven't been
206
- * flushed yet will be deleted. Use flush() before calling this method if you want
207
- * to send all the queues to Mixpanel before.
208
- *
209
- * This method will also remove any user-related information from the device.
210
- */
211
- optOutTracking() {
212
- MixpanelReactNative.optOutTracking(this.token);
213
- }
214
-
215
- /**
216
- * Associate all future calls to track() with the user identified by
217
- * the given distinct id.
218
- *
219
- * &lt;p>Calls to track() made before corresponding calls to identify
220
- * will use an anonymous locally generated distinct id, which means it is best to call identify
221
- * early to ensure that your Mixpanel funnels and retention analytics can continue to track the
222
- * user throughout their lifetime. We recommend calling identify when the user authenticates.
223
- *
224
- * &lt;p>Once identify is called, the local distinct id persists across restarts of
225
- * your application.
226
- *
227
- * @param {string} distinctId a string uniquely identifying this user. Events sent to
228
- * Mixpanel using the same disinct_id will be considered associated with the
229
- * same visitor/customer for retention and funnel reporting, so be sure that the given
230
- * value is globally unique for each individual user you intend to track.
231
- * @returns {Promise} A promise that resolves when the identify is successful.
232
- * It does not return any value.
233
- *
234
- */
235
- identify(distinctId) {
236
- return new Promise((resolve, reject) => {
237
- if (!StringHelper.isValid(distinctId)) {
238
- StringHelper.raiseError(PARAMS.DISTINCT_ID);
239
- reject(new Error('Invalid distinctId'));
240
- }
241
- MixpanelReactNative.identify(this.token, distinctId)
242
- .then(() => {
243
- resolve();
244
- })
245
- .catch(err => {
246
- reject(err);
247
- });
248
- });
309
+ this.mixpanelImpl.alias(this.token, alias, distinctId);
310
+ }
311
+
312
+ /**
313
+ * Track an event.
314
+ *
315
+ * &lt;p>Every call to track eventually results in a data point sent to Mixpanel. These data points
316
+ * are what are measured, counted, and broken down to create your Mixpanel reports. Events
317
+ * have a string name, and an optional set of name/value pairs that describe the properties of
318
+ * that event.
319
+ *
320
+ * @param {string} eventName The name of the event to send
321
+ * @param {object} properties A Map containing the key value pairs of the properties to include in this event.
322
+ * Pass null if no extra properties exist.
323
+ */
324
+ track(eventName, properties) {
325
+ if (!StringHelper.isValid(eventName)) {
326
+ StringHelper.raiseError(PARAMS.EVENT_NAME);
249
327
  }
250
-
251
- /**
252
- * The alias method creates an alias which Mixpanel will use to remap one id to another.
253
- * Multiple aliases can point to the same identifier.
254
- *
255
- * `mixpane.alias("New ID", mixpane.distinctId)`
256
- * `mixpane.alias("Newer ID", mixpane.distinctId)`
257
- *
258
- * &lt;p>This call does not identify the user after. You must still call identify()
259
- * if you wish the new alias to be used for Events and People.
260
- *
261
- * @param {string} alias A unique identifier that you want to use as an identifier for this user.
262
- * @param {string} distinctId the current distinct_id that alias will be mapped to.
263
- */
264
- alias(alias, distinctId) {
265
- if (!StringHelper.isValid(alias)) {
266
- StringHelper.raiseError(PARAMS.ALIAS);
267
- }
268
- if (!StringHelper.isValid(distinctId)) {
269
- StringHelper.raiseError(PARAMS.DISTINCT_ID);
270
- }
271
- MixpanelReactNative.alias(this.token, alias, distinctId);
272
- }
273
-
274
- /**
275
- * Track an event.
276
- *
277
- * &lt;p>Every call to track eventually results in a data point sent to Mixpanel. These data points
278
- * are what are measured, counted, and broken down to create your Mixpanel reports. Events
279
- * have a string name, and an optional set of name/value pairs that describe the properties of
280
- * that event.
281
- *
282
- * @param {string} eventName The name of the event to send
283
- * @param {object} properties A Map containing the key value pairs of the properties to include in this event.
284
- * Pass null if no extra properties exist.
285
- */
286
- track(eventName, properties) {
287
- if (!StringHelper.isValid(eventName)) {
288
- StringHelper.raiseError(PARAMS.EVENT_NAME);
289
- }
290
- if (!ObjectHelper.isValidOrUndefined(properties)) {
291
- ObjectHelper.raiseError(PARAMS.PROPERTIES);
292
- }
293
- MixpanelReactNative.track(this.token, eventName, properties || {});
328
+ if (!ObjectHelper.isValidOrUndefined(properties)) {
329
+ ObjectHelper.raiseError(PARAMS.PROPERTIES);
294
330
  }
295
-
296
- /**
297
- * Returns a Mixpanel People object that can be used to set and increment
298
- * People Analytics properties.
299
- *
300
- * @return {People} an instance of People that you can use to update
301
- * records in Mixpanel People Analytics
302
- */
303
- getPeople() {
304
- return this.people;
305
- }
306
-
307
- /**
308
- * Track an event with specific groups.
309
- *
310
- * &lt;p>Every call to track eventually results in a data point sent to Mixpanel. These data points
311
- * are what are measured, counted, and broken down to create your Mixpanel reports. Events
312
- * have a string name, and an optional set of name/value pairs that describe the properties of
313
- * that event. Group key/value pairs are upserted into the property map before tracking.
314
- *
315
- * @param {string} eventName The name of the event to send
316
- * @param {object} properties A Map containing the key value pairs of the properties to include in this event.
317
- * Pass null if no extra properties exist.
318
- * @param {object} groups A Map containing the group key value pairs for this event.
319
- *
320
- */
321
- trackWithGroups(eventName, properties, groups) {
322
- if (!StringHelper.isValid(eventName)) {
323
- StringHelper.raiseError(PARAMS.EVENT_NAME);
324
- }
325
- if (!ObjectHelper.isValidOrUndefined(properties)) {
326
- ObjectHelper.raiseError(PARAMS.PROPERTIES);
327
- }
328
- MixpanelReactNative.trackWithGroups(this.token, eventName, properties || {}, groups);
331
+ MixpanelReactNative.track(this.token, eventName, {
332
+ ...Helper.getMetaData(),
333
+ ...properties,
334
+ });
335
+ }
336
+
337
+ /**
338
+ * Returns a Mixpanel People object that can be used to set and increment
339
+ * People Analytics properties.
340
+ *
341
+ * @return {People} an instance of People that you can use to update
342
+ * records in Mixpanel People Analytics
343
+ */
344
+ getPeople() {
345
+ if (this.people) {
346
+ return this.people;
347
+ } else {
348
+ this.people = new People(this.token, this.mixpanelImpl);
349
+ return this.people;
329
350
  }
330
-
331
- /**
332
- * Set the group this user belongs to.
333
- *
334
- * @param {string} groupKey The property name associated with this group type (must already have been set up).
335
- * @param {object} groupID The group the user belongs to.
336
- */
337
- setGroup(groupKey, groupID) {
338
- if (!StringHelper.isValid(groupKey)) {
339
- StringHelper.raiseError(PARAMS.GROUP_KEY);
340
- }
341
- MixpanelReactNative.setGroup(this.token, groupKey, groupID);
351
+ }
352
+
353
+ /**
354
+ * Track an event with specific groups.
355
+ *
356
+ * &lt;p>Every call to track eventually results in a data point sent to Mixpanel. These data points
357
+ * are what are measured, counted, and broken down to create your Mixpanel reports. Events
358
+ * have a string name, and an optional set of name/value pairs that describe the properties of
359
+ * that event. Group key/value pairs are upserted into the property map before tracking.
360
+ *
361
+ * @param {string} eventName The name of the event to send
362
+ * @param {object} properties A Map containing the key value pairs of the properties to include in this event.
363
+ * Pass null if no extra properties exist.
364
+ * @param {object} groups A Map containing the group key value pairs for this event.
365
+ *
366
+ */
367
+ trackWithGroups(eventName, properties, groups) {
368
+ if (!StringHelper.isValid(eventName)) {
369
+ StringHelper.raiseError(PARAMS.EVENT_NAME);
342
370
  }
343
-
344
- /**
345
- * Returns a MixpanelGroup object that can be used to set and increment
346
- * Group Analytics properties.
347
- *
348
- * @param {string} groupKey String identifying the type of group (must be already in use as a group key)
349
- * @param {object} groupID Object identifying the specific group
350
- * @return an instance of MixpanelGroup that you can use to update
351
- * records in Mixpanel Group Analytics
352
- */
353
- getGroup(groupKey, groupID) {
354
- return new MixpanelGroup(this.token, groupKey, groupID);
371
+ if (!ObjectHelper.isValidOrUndefined(properties)) {
372
+ ObjectHelper.raiseError(PARAMS.PROPERTIES);
355
373
  }
356
-
357
- /**
358
- * Add a group to this user's membership for a particular group key
359
- *
360
- * @param {string} groupKey The property name associated with this group type (must already have been set up).
361
- * @param {object} groupID The new group the user belongs to.
362
- */
363
- addGroup(groupKey, groupID) {
364
- if (!StringHelper.isValid(groupKey)) {
365
- StringHelper.raiseError(PARAMS.GROUP_KEY);
366
- }
367
- MixpanelReactNative.addGroup(this.token, groupKey, groupID);
374
+ MixpanelReactNative.trackWithGroups(
375
+ this.token,
376
+ eventName,
377
+ {
378
+ ...Helper.getMetaData(),
379
+ ...properties,
380
+ },
381
+ groups
382
+ );
383
+ }
384
+
385
+ /**
386
+ * Set the group this user belongs to.
387
+ *
388
+ * @param {string} groupKey The property name associated with this group type (must already have been set up).
389
+ * @param {object} groupID The group the user belongs to.
390
+ */
391
+ setGroup(groupKey, groupID) {
392
+ if (!StringHelper.isValid(groupKey)) {
393
+ StringHelper.raiseError(PARAMS.GROUP_KEY);
368
394
  }
369
-
370
- /**
371
- * Remove a group from this user's membership for a particular group key
372
- *
373
- * @param {string} groupKey The property name associated with this group type (must already have been set up).
374
- * @param {object} groupID The group value to remove.
375
- */
376
- removeGroup(groupKey, groupID) {
377
- if (!StringHelper.isValid(groupKey)) {
378
- StringHelper.raiseError(PARAMS.GROUP_KEY);
379
- }
380
- MixpanelReactNative.removeGroup(this.token, groupKey, groupID);
395
+ this.mixpanelImpl.setGroup(this.token, groupKey, groupID);
396
+ }
397
+
398
+ /**
399
+ * Returns a MixpanelGroup object that can be used to set and increment
400
+ * Group Analytics properties.
401
+ *
402
+ * @param {string} groupKey String identifying the type of group (must be already in use as a group key)
403
+ * @param {object} groupID Object identifying the specific group
404
+ * @return an instance of MixpanelGroup that you can use to update
405
+ * records in Mixpanel Group Analytics
406
+ */
407
+ getGroup(groupKey, groupID) {
408
+ if (this.group) {
409
+ return this.group;
410
+ } else {
411
+ this.group = new MixpanelGroup(
412
+ this.token,
413
+ groupKey,
414
+ groupID,
415
+ this.mixpanelImpl
416
+ );
417
+ return this.group;
381
418
  }
382
-
383
- /**
384
- * Permanently deletes this group's record from Group Analytics.
385
- *
386
- * @param {string} groupKey String identifying the type of group (must be already in use as a group key)
387
- * @param {object} groupID Object identifying the specific group
388
- * &lt;p>Calling deleteGroup deletes an entire record completely. Any future calls
389
- * to Group Analytics using the same group value will create and store new values.
390
- */
391
- deleteGroup(groupKey, groupID) {
392
- if (!StringHelper.isValid(groupKey)) {
393
- StringHelper.raiseError(PARAMS.GROUP_KEY);
394
- }
395
- MixpanelReactNative.deleteGroup(this.token, groupKey, groupID);
396
- }
397
-
398
- /**
399
- * Register properties that will be sent with every subsequent call to track().
400
- *
401
- * &lt;p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
402
- * and persist beyond the lifetime of your application.
403
- *
404
- * &lt;p>Setting a superProperty with registerSuperProperties will store a new superProperty,
405
- * possibly overwriting any existing superProperty with the same name (to set a
406
- * superProperty only if it is currently unset, use registerSuperPropertiesOnce())
407
- *
408
- * &lt;p>SuperProperties will persist even if your application is taken completely out of memory.
409
- * to remove a superProperty, call unregisterSuperProperty() or clearSuperProperties()
410
- *
411
- * @param {object} properties A Map containing super properties to register
412
- */
413
- registerSuperProperties(properties) {
414
- if (!ObjectHelper.isValidOrUndefined(properties)) {
415
- ObjectHelper.raiseError(PARAMS.PROPERTIES);
416
- }
417
- MixpanelReactNative.registerSuperProperties(this.token, properties || {});
419
+ }
420
+
421
+ /**
422
+ * Add a group to this user's membership for a particular group key
423
+ *
424
+ * @param {string} groupKey The property name associated with this group type (must already have been set up).
425
+ * @param {object} groupID The new group the user belongs to.
426
+ */
427
+ addGroup(groupKey, groupID) {
428
+ if (!StringHelper.isValid(groupKey)) {
429
+ StringHelper.raiseError(PARAMS.GROUP_KEY);
418
430
  }
419
-
420
- /**
421
- * Register super properties for events, only if no other super property with the
422
- * same names has already been registered.
423
- *
424
- * &lt;p>Calling registerSuperPropertiesOnce will never overwrite existing properties.
425
- *
426
- * @param {object} properties A Map containing the super properties to register.
427
- */
428
- registerSuperPropertiesOnce(properties) {
429
- if (!ObjectHelper.isValidOrUndefined(properties)) {
430
- ObjectHelper.raiseError(PARAMS.PROPERTIES);
431
- }
432
- MixpanelReactNative.registerSuperPropertiesOnce(this.token, properties || {});
431
+ this.mixpanelImpl.addGroup(this.token, groupKey, groupID);
432
+ }
433
+
434
+ /**
435
+ * Remove a group from this user's membership for a particular group key
436
+ *
437
+ * @param {string} groupKey The property name associated with this group type (must already have been set up).
438
+ * @param {object} groupID The group value to remove.
439
+ */
440
+ removeGroup(groupKey, groupID) {
441
+ if (!StringHelper.isValid(groupKey)) {
442
+ StringHelper.raiseError(PARAMS.GROUP_KEY);
433
443
  }
434
-
435
- /**
436
- * Remove a single superProperty, so that it will not be sent with future calls to track().
437
- *
438
- * &lt;p>If there is a superProperty registered with the given name, it will be permanently
439
- * removed from the existing superProperties.
440
- * To clear all superProperties, use clearSuperProperties()
441
- *
442
- * @param {string} propertyName name of the property to unregister
443
- */
444
- unregisterSuperProperty(propertyName) {
445
- if (!StringHelper.isValid(propertyName)) {
446
- StringHelper.raiseError(PARAMS.PROPERTY_NAME);
447
- }
448
- MixpanelReactNative.unregisterSuperProperty(this.token, propertyName);
444
+ this.mixpanelImpl.removeGroup(this.token, groupKey, groupID);
445
+ }
446
+
447
+ /**
448
+ * Permanently deletes this group's record from Group Analytics.
449
+ *
450
+ * @param {string} groupKey String identifying the type of group (must be already in use as a group key)
451
+ * @param {object} groupID Object identifying the specific group
452
+ * &lt;p>Calling deleteGroup deletes an entire record completely. Any future calls
453
+ * to Group Analytics using the same group value will create and store new values.
454
+ */
455
+ deleteGroup(groupKey, groupID) {
456
+ if (!StringHelper.isValid(groupKey)) {
457
+ StringHelper.raiseError(PARAMS.GROUP_KEY);
449
458
  }
450
-
451
- /**
452
- * Returns a json object of the user's current super properties
453
- *
454
- *&lt;p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
455
- * and persist beyond the lifetime of your application.
456
- *
457
- * @return {Promise&lt;object>} Super properties for this Mixpanel instance.
458
- */
459
- getSuperProperties() {
460
- return MixpanelReactNative.getSuperProperties(this.token);
459
+ this.mixpanelImpl.deleteGroup(this.token, groupKey, groupID);
460
+ }
461
+
462
+ /**
463
+ * Register properties that will be sent with every subsequent call to track().
464
+ *
465
+ * &lt;p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
466
+ * and persist beyond the lifetime of your application.
467
+ *
468
+ * &lt;p>Setting a superProperty with registerSuperProperties will store a new superProperty,
469
+ * possibly overwriting any existing superProperty with the same name (to set a
470
+ * superProperty only if it is currently unset, use registerSuperPropertiesOnce())
471
+ *
472
+ * &lt;p>SuperProperties will persist even if your application is taken completely out of memory.
473
+ * to remove a superProperty, call unregisterSuperProperty() or clearSuperProperties()
474
+ *
475
+ * @param {object} properties A Map containing super properties to register
476
+ */
477
+ registerSuperProperties(properties) {
478
+ if (!ObjectHelper.isValidOrUndefined(properties)) {
479
+ ObjectHelper.raiseError(PARAMS.PROPERTIES);
461
480
  }
462
-
463
- /**
464
- * Erase all currently registered superProperties.
465
- *
466
- * &lt;p>Future tracking calls to Mixpanel will not contain the specific
467
- * superProperties registered before the clearSuperProperties method was called.
468
- *
469
- * &lt;p>To remove a single superProperty, use unregisterSuperProperty()
470
- */
471
- clearSuperProperties() {
472
- MixpanelReactNative.clearSuperProperties(this.token);
481
+ this.mixpanelImpl.registerSuperProperties(this.token, properties || {});
482
+ }
483
+
484
+ /**
485
+ * Register super properties for events, only if no other super property with the
486
+ * same names has already been registered.
487
+ *
488
+ * &lt;p>Calling registerSuperPropertiesOnce will never overwrite existing properties.
489
+ *
490
+ * @param {object} properties A Map containing the super properties to register.
491
+ */
492
+ registerSuperPropertiesOnce(properties) {
493
+ if (!ObjectHelper.isValidOrUndefined(properties)) {
494
+ ObjectHelper.raiseError(PARAMS.PROPERTIES);
473
495
  }
474
-
475
- /**
476
- * Begin timing of an event. Calling timeEvent("Thing") will not send an event, but
477
- * when you eventually call track("Thing"), your tracked event will be sent with a "$duration"
478
- * property, representing the number of seconds between your calls.
479
- *
480
- * @param {string} eventName the name of the event to track with timing.
481
- */
482
- timeEvent(eventName) {
483
- if (!StringHelper.isValid(eventName)) {
484
- StringHelper.raiseError(PARAMS.EVENT_NAME);
485
- }
486
- MixpanelReactNative.timeEvent(this.token, eventName);
496
+ this.mixpanelImpl.registerSuperPropertiesOnce(this.token, properties || {});
497
+ }
498
+
499
+ /**
500
+ * Remove a single superProperty, so that it will not be sent with future calls to track().
501
+ *
502
+ * &lt;p>If there is a superProperty registered with the given name, it will be permanently
503
+ * removed from the existing superProperties.
504
+ * To clear all superProperties, use clearSuperProperties()
505
+ *
506
+ * @param {string} propertyName name of the property to unregister
507
+ */
508
+ unregisterSuperProperty(propertyName) {
509
+ if (!StringHelper.isValid(propertyName)) {
510
+ StringHelper.raiseError(PARAMS.PROPERTY_NAME);
487
511
  }
488
-
489
- /**
490
- * Retrieves the time elapsed for the named event since timeEvent() was called.
491
- *
492
- * @param {string} eventName the name of the event to be tracked that was previously called with timeEvent()
493
- *
494
- * @return {Promise&lt;number>} Time elapsed since timeEvent(String) was called for the given eventName.
495
- */
496
- eventElapsedTime(eventName) {
497
- if (!StringHelper.isValid(eventName)) {
498
- StringHelper.raiseError(PARAMS.EVENT_NAME);
499
- }
500
- return MixpanelReactNative.eventElapsedTime(this.token, eventName);
512
+ this.mixpanelImpl.unregisterSuperProperty(this.token, propertyName);
513
+ }
514
+
515
+ /**
516
+ * Returns a json object of the user's current super properties
517
+ *
518
+ *&lt;p>SuperProperties are a collection of properties that will be sent with every event to Mixpanel,
519
+ * and persist beyond the lifetime of your application.
520
+ *
521
+ * @return {Promise&lt;object>} Super properties for this Mixpanel instance.
522
+ */
523
+ getSuperProperties() {
524
+ return this.mixpanelImpl.getSuperProperties(this.token);
525
+ }
526
+
527
+ /**
528
+ * Erase all currently registered superProperties.
529
+ *
530
+ * &lt;p>Future tracking calls to Mixpanel will not contain the specific
531
+ * superProperties registered before the clearSuperProperties method was called.
532
+ *
533
+ * &lt;p>To remove a single superProperty, use unregisterSuperProperty()
534
+ */
535
+ clearSuperProperties() {
536
+ this.mixpanelImpl.clearSuperProperties(this.token);
537
+ }
538
+
539
+ /**
540
+ * Begin timing of an event. Calling timeEvent("Thing") will not send an event, but
541
+ * when you eventually call track("Thing"), your tracked event will be sent with a "$duration"
542
+ * property, representing the number of seconds between your calls.
543
+ *
544
+ * @param {string} eventName the name of the event to track with timing.
545
+ */
546
+ timeEvent(eventName) {
547
+ if (!StringHelper.isValid(eventName)) {
548
+ StringHelper.raiseError(PARAMS.EVENT_NAME);
501
549
  }
550
+ this.mixpanelImpl.timeEvent(this.token, eventName);
551
+ }
552
+
553
+ /**
554
+ * Retrieves the time elapsed for the named event since timeEvent() was called.
555
+ *
556
+ * @param {string} eventName the name of the event to be tracked that was previously called with timeEvent()
557
+ *
558
+ * @return {Promise&lt;number>} Time elapsed since timeEvent(String) was called for the given eventName.
559
+ */
560
+ eventElapsedTime(eventName) {
561
+ if (!StringHelper.isValid(eventName)) {
562
+ StringHelper.raiseError(PARAMS.EVENT_NAME);
563
+ }
564
+ return this.mixpanelImpl.eventElapsedTime(this.token, eventName);
565
+ }
502
566
 
503
- /**
567
+ /**
504
568
  Clear super properties and generates a new random distinctId for this instance.
505
569
  Useful for clearing data when a user logs out.
506
570
  */
507
- reset() {
508
- MixpanelReactNative.reset(this.token);
509
- }
510
-
511
- /**
512
- * Returns the current distinct id of the user.
513
- * This is either the id automatically generated by the library or the id that has been passed by a call to identify().
514
- *
515
- * example of usage:
516
- * &lt;pre>
517
- * &lt;code>
518
- * const distinctId = await mixpanel.getDistinctId();
519
- * &lt;/code>
520
- * &lt;/pre>
521
- *
522
- * @return {Promise&lt;string>} A Promise to the distinct id associated with Mixpanel event and People Analytics
523
- *
524
- */
525
- getDistinctId() {
526
- return MixpanelReactNative.getDistinctId(this.token);
527
- }
528
-
529
- /**
530
- * Returns the current device id of the device.
531
- * This id automatically generated by the library and regenerated when logout or reset is called.
532
- *
533
- * example of usage:
534
- * &lt;pre>
535
- * &lt;code>
536
- * const deviceId = await mixpanel.getDeviceId();
537
- * &lt;/code>
538
- * &lt;/pre>
539
- *
540
- * @return {Promise&lt;string>} A Promise to the device id
541
- *
542
- */
543
- getDeviceId() {
544
- return MixpanelReactNative.getDeviceId(this.token);
545
- }
546
-
547
- /**
548
- * Push all queued Mixpanel events and People Analytics changes to Mixpanel servers.
549
- *
550
- * &lt;p>Events and People messages are pushed gradually throughout
551
- * the lifetime of your application. This means that to ensure that all messages
552
- * are sent to Mixpanel when your application is shut down, you will
553
- * need to call flush() to let the Mixpanel library know it should
554
- * send all remaining messages to the server.
555
- */
556
- flush() {
557
- MixpanelReactNative.flush(this.token);
558
- }
571
+ reset() {
572
+ this.mixpanelImpl.reset(this.token);
573
+ }
574
+
575
+ /**
576
+ * Returns the current distinct id of the user.
577
+ * This is either the id automatically generated by the library or the id that has been passed by a call to identify().
578
+ *
579
+ * example of usage:
580
+ * &lt;pre>
581
+ * &lt;code>
582
+ * const distinctId = await mixpanel.getDistinctId();
583
+ * &lt;/code>
584
+ * &lt;/pre>
585
+ *
586
+ * @return {Promise&lt;string>} A Promise to the distinct id associated with Mixpanel event and People Analytics
587
+ *
588
+ */
589
+ getDistinctId() {
590
+ return this.mixpanelImpl.getDistinctId(this.token);
591
+ }
592
+
593
+ /**
594
+ * Returns the current device id of the device.
595
+ * This id automatically generated by the library and regenerated when logout or reset is called.
596
+ *
597
+ * example of usage:
598
+ * &lt;pre>
599
+ * &lt;code>
600
+ * const deviceId = await mixpanel.getDeviceId();
601
+ * &lt;/code>
602
+ * &lt;/pre>
603
+ *
604
+ * @return {Promise&lt;string>} A Promise to the device id
605
+ *
606
+ */
607
+ getDeviceId() {
608
+ return this.mixpanelImpl.getDeviceId(this.token);
609
+ }
610
+
611
+ /**
612
+ * Push all queued Mixpanel events and People Analytics changes to Mixpanel servers.
613
+ *
614
+ * &lt;p>Events and People messages are pushed gradually throughout
615
+ * the lifetime of your application. This means that to ensure that all messages
616
+ * are sent to Mixpanel when your application is shut down, you will
617
+ * need to call flush() to let the Mixpanel library know it should
618
+ * send all remaining messages to the server.
619
+ */
620
+ flush() {
621
+ this.mixpanelImpl.flush(this.token);
622
+ }
559
623
  }
560
624
 
561
625
  /**
@@ -570,199 +634,204 @@ export class Mixpanel {
570
634
  *
571
635
  */
572
636
  export class People {
573
-
574
- constructor(token) {
575
- if (!StringHelper.isValid(token)) {
576
- StringHelper.raiseError(PARAMS.TOKEN);
577
- }
578
- this.token = token;
637
+ constructor(token, mixpanelImpl) {
638
+ if (!StringHelper.isValid(token)) {
639
+ StringHelper.raiseError(PARAMS.TOKEN);
579
640
  }
580
-
581
- /**
582
- * Sets a single property with the given name and value for this user.
583
- * The given name and value will be assigned to the user in Mixpanel People Analytics,
584
- * possibly overwriting an existing property with the same name.
585
- *
586
- * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
587
- * @param {object} to The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
588
- */
589
- set(prop, to) {
590
- let properties = {};
591
- if (ObjectHelper.isValid(prop)) {
592
- properties = JSON.parse(JSON.stringify(prop || {}));
593
- } else {
594
- if (!StringHelper.isValid(prop)) {
595
- StringHelper.raiseError(PARAMS.PROP);
596
- }
597
- properties[prop] = to;
598
- }
599
- MixpanelReactNative.set(this.token, properties);
641
+ this.token = token;
642
+ this.mixpanelImpl = mixpanelImpl;
643
+ }
644
+
645
+ /**
646
+ * Sets a single property with the given name and value for this user.
647
+ * The given name and value will be assigned to the user in Mixpanel People Analytics,
648
+ * possibly overwriting an existing property with the same name.
649
+ *
650
+ * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
651
+ * @param {object} to The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
652
+ */
653
+ set(prop, to) {
654
+ let properties = {};
655
+ if (ObjectHelper.isValid(prop)) {
656
+ properties = JSON.parse(JSON.stringify(prop || {}));
657
+ } else {
658
+ if (!StringHelper.isValid(prop)) {
659
+ StringHelper.raiseError(PARAMS.PROP);
660
+ }
661
+ properties[prop] = to;
600
662
  }
601
-
602
- /**
603
- * Works just like set(), except it will not overwrite existing property values. This is useful for properties like "First login date".
604
- *
605
- * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
606
- * @param {object} to The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
607
- */
608
- setOnce(prop, to) {
609
- let properties = {};
610
- if (ObjectHelper.isValid(prop)) {
611
- prop = prop || {};
612
- properties = JSON.parse(JSON.stringify(prop));
613
- } else {
614
- if (!StringHelper.isValid(prop)) {
615
- StringHelper.raiseError(PARAMS.PROP);
616
- }
617
- properties[prop] = to;
618
- }
619
- MixpanelReactNative.setOnce(this.token, properties);
663
+ this.mixpanelImpl.set(this.token, properties);
664
+ }
665
+
666
+ /**
667
+ * Works just like set(), except it will not overwrite existing property values. This is useful for properties like "First login date".
668
+ *
669
+ * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
670
+ * @param {object} to The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"
671
+ */
672
+ setOnce(prop, to) {
673
+ let properties = {};
674
+ if (ObjectHelper.isValid(prop)) {
675
+ prop = prop || {};
676
+ properties = JSON.parse(JSON.stringify(prop));
677
+ } else {
678
+ if (!StringHelper.isValid(prop)) {
679
+ StringHelper.raiseError(PARAMS.PROP);
680
+ }
681
+ properties[prop] = to;
620
682
  }
621
-
622
- /**
623
- * Add the given amount to an existing property on the identified user. If the user does not already
624
- * have the associated property, the amount will be added to zero. To reduce a property,
625
- * provide a negative number for the value.
626
- *
627
- * @param {string} prop the People Analytics property that should have its value changed
628
- * @param {number} by the amount to be added to the current value of the named property
629
- *
630
- */
631
- increment(prop, by) {
632
- var add = {};
633
- if (ObjectHelper.isValid(prop)) {
634
- Object.keys(prop).forEach(function (key) {
635
- var val = prop[key];
636
- if (isNaN(parseFloat(val))) {
637
- throw new Error(`${PARAMS.PROPERTY_VALUE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`);
638
- }
639
- add[key] = val;
640
- });
641
- } else {
642
- by = by || 1;
643
- if (isNaN(parseFloat(by))) {
644
- throw new Error(`${PARAMS.PROPERTY_VALUE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`);
645
- }
646
-
647
- if (!StringHelper.isValid(prop)) {
648
- StringHelper.raiseError(PARAMS.NAME);
649
- }
650
-
651
- add[prop] = by;
683
+ this.mixpanelImpl.setOnce(this.token, properties);
684
+ }
685
+
686
+ /**
687
+ * Add the given amount to an existing property on the identified user. If the user does not already
688
+ * have the associated property, the amount will be added to zero. To reduce a property,
689
+ * provide a negative number for the value.
690
+ *
691
+ * @param {string} prop the People Analytics property that should have its value changed
692
+ * @param {number} by the amount to be added to the current value of the named property
693
+ *
694
+ */
695
+ increment(prop, by) {
696
+ var add = {};
697
+ if (ObjectHelper.isValid(prop)) {
698
+ Object.keys(prop).forEach(function (key) {
699
+ var val = prop[key];
700
+ if (isNaN(parseFloat(val))) {
701
+ throw new Error(
702
+ `${PARAMS.PROPERTY_VALUE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`
703
+ );
652
704
  }
653
- MixpanelReactNative.increment(this.token, add);
705
+ add[key] = val;
706
+ });
707
+ } else {
708
+ by = by || 1;
709
+ if (isNaN(parseFloat(by))) {
710
+ throw new Error(
711
+ `${PARAMS.PROPERTY_VALUE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`
712
+ );
713
+ }
714
+
715
+ if (!StringHelper.isValid(prop)) {
716
+ StringHelper.raiseError(PARAMS.NAME);
717
+ }
718
+
719
+ add[prop] = by;
654
720
  }
655
-
656
- /**
657
- * Appends a value to a list-valued property. If the property does not currently exist,
658
- * it will be created as a list of one element. If the property does exist and doesn't
659
- * currently have a list value, the append will be ignored.
660
- * @param {string} name the People Analytics property that should have it's value appended to
661
- * @param {object} value the new value that will appear at the end of the property's list
662
- */
663
- append(name, value) {
664
- let appendProp = {};
665
- if (!StringHelper.isValid(name)) {
666
- StringHelper.raiseError(PARAMS.NAME);
667
- } else {
668
- appendProp[name] = value;
669
- }
670
-
671
- if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
672
- MixpanelReactNative.append(this.token, appendProp);
673
- } else {
674
- MixpanelReactNative.append(this.token, name, value);
675
- }
721
+ this.mixpanelImpl.increment(this.token, add);
722
+ }
723
+
724
+ /**
725
+ * Appends a value to a list-valued property. If the property does not currently exist,
726
+ * it will be created as a list of one element. If the property does exist and doesn't
727
+ * currently have a list value, the append will be ignored.
728
+ * @param {string} name the People Analytics property that should have it's value appended to
729
+ * @param {object} value the new value that will appear at the end of the property's list
730
+ */
731
+ append(name, value) {
732
+ let appendProp = {};
733
+ if (!StringHelper.isValid(name)) {
734
+ StringHelper.raiseError(PARAMS.NAME);
735
+ } else {
736
+ appendProp[name] = value;
676
737
  }
677
738
 
678
- /**
679
- * Adds values to a list-valued property only if they are not already present in the list.
680
- * If the property does not currently exist, it will be created with the given list as it's value.
681
- * If the property exists and is not list-valued, the union will be ignored.
682
- *
683
- * @param {string} name name of the list-valued property to set or modify
684
- * @param {array} value an array of values to add to the property value if not already present
685
- */
686
- union(name, value) {
687
- if (!StringHelper.isValid(name)) {
688
- StringHelper.raiseError(PARAMS.NAME);
689
- }
690
-
691
- value = Array.isArray(value) ? value : [value];
692
-
693
- if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
694
- MixpanelReactNative.union(this.token, {[name]: value});
695
- } else {
696
- MixpanelReactNative.union(this.token, name, value);
697
- }
739
+ if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
740
+ this.mixpanelImpl.append(this.token, appendProp);
741
+ } else {
742
+ this.mixpanelImpl.append(this.token, name, value);
743
+ }
744
+ }
745
+
746
+ /**
747
+ * Adds values to a list-valued property only if they are not already present in the list.
748
+ * If the property does not currently exist, it will be created with the given list as it's value.
749
+ * If the property exists and is not list-valued, the union will be ignored.
750
+ *
751
+ * @param {string} name name of the list-valued property to set or modify
752
+ * @param {array} value an array of values to add to the property value if not already present
753
+ */
754
+ union(name, value) {
755
+ if (!StringHelper.isValid(name)) {
756
+ StringHelper.raiseError(PARAMS.NAME);
698
757
  }
699
758
 
700
- /**
701
- * Remove value from a list-valued property only if they are already present in the list.
702
- * If the property does not currently exist, the remove will be ignored.
703
- * If the property exists and is not list-valued, the remove will be ignored.
704
- * @param {string} name the People Analytics property that should have it's value removed from
705
- * @param {object} value the value that will be removed from the property's list
706
- */
707
- remove(name, value) {
708
- let removeProp = {};
709
- if (!StringHelper.isValid(name)) {
710
- StringHelper.raiseError(PARAMS.NAME);
711
- } else {
712
- removeProp[name] = value;
713
- }
759
+ value = Array.isArray(value) ? value : [value];
714
760
 
715
- if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
716
- MixpanelReactNative.remove(this.token, removeProp);
717
- } else {
718
- MixpanelReactNative.remove(this.token, name, value);
719
- }
761
+ if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
762
+ this.mixpanelImpl.union(this.token, {[name]: value});
763
+ this.mixpanelImpl.union(this.token, {[name]: value});
764
+ } else {
765
+ this.mixpanelImpl.union(this.token, name, value);
720
766
  }
721
-
722
- /**
723
- * permanently removes the property with the given name from the user's profile
724
- * @param {string} name name of a property to unset
725
- */
726
- unset(name) {
727
- if (!StringHelper.isValid(name)) {
728
- StringHelper.raiseError(PARAMS.PROPERTY_NAME);
729
- }
730
- MixpanelReactNative.unset(this.token, name);
767
+ }
768
+
769
+ /**
770
+ * Remove value from a list-valued property only if they are already present in the list.
771
+ * If the property does not currently exist, the remove will be ignored.
772
+ * If the property exists and is not list-valued, the remove will be ignored.
773
+ * @param {string} name the People Analytics property that should have it's value removed from
774
+ * @param {object} value the value that will be removed from the property's list
775
+ */
776
+ remove(name, value) {
777
+ let removeProp = {};
778
+ if (!StringHelper.isValid(name)) {
779
+ StringHelper.raiseError(PARAMS.NAME);
780
+ } else {
781
+ removeProp[name] = value;
731
782
  }
732
783
 
733
- /**
734
- * Track a revenue transaction for the identified people profile.
735
- *
736
- * @param {number} charge the amount of money exchanged. Positive amounts represent purchases or income from the customer, negative amounts represent refunds or payments to the customer.
737
- * @param {object} properties an optional collection of properties to associate with this transaction.
738
- */
739
- trackCharge(charge, properties) {
740
- if (isNaN(parseFloat(charge))) {
741
- throw new Error(`${PARAMS.CHARGE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`)
742
- }
743
-
744
- if (!ObjectHelper.isValidOrUndefined(properties)) {
745
- ObjectHelper.raiseError(PARAMS.PROPERTIES);
746
- }
747
- MixpanelReactNative.trackCharge(this.token, charge, properties || {});
784
+ if (DevicePlatform.iOS === Helper.getDevicePlatform()) {
785
+ this.mixpanelImpl.remove(this.token, removeProp);
786
+ } else {
787
+ this.mixpanelImpl.remove(this.token, name, value);
748
788
  }
749
-
750
- /**
751
- * Permanently clear the whole transaction history for the identified people profile.
752
- */
753
- clearCharges() {
754
- MixpanelReactNative.clearCharges(this.token);
789
+ }
790
+
791
+ /**
792
+ * permanently removes the property with the given name from the user's profile
793
+ * @param {string} name name of a property to unset
794
+ */
795
+ unset(name) {
796
+ if (!StringHelper.isValid(name)) {
797
+ StringHelper.raiseError(PARAMS.PROPERTY_NAME);
798
+ }
799
+ this.mixpanelImpl.unset(this.token, name);
800
+ }
801
+
802
+ /**
803
+ * Track a revenue transaction for the identified people profile.
804
+ *
805
+ * @param {number} charge the amount of money exchanged. Positive amounts represent purchases or income from the customer, negative amounts represent refunds or payments to the customer.
806
+ * @param {object} properties an optional collection of properties to associate with this transaction.
807
+ */
808
+ trackCharge(charge, properties) {
809
+ if (isNaN(parseFloat(charge))) {
810
+ throw new Error(`${PARAMS.CHARGE}${ERROR_MESSAGE.REQUIRED_DOUBLE}`);
755
811
  }
756
812
 
757
- /**
758
- * Permanently deletes the identified user's record from People Analytics.
759
- *
760
- * &lt;p>Calling deleteUser deletes an entire record completely. Any future calls
761
- * to People Analytics using the same distinct id will create and store new values.
762
- */
763
- deleteUser() {
764
- MixpanelReactNative.deleteUser(this.token);
813
+ if (!ObjectHelper.isValidOrUndefined(properties)) {
814
+ ObjectHelper.raiseError(PARAMS.PROPERTIES);
765
815
  }
816
+ this.mixpanelImpl.trackCharge(this.token, charge, properties || {});
817
+ }
818
+
819
+ /**
820
+ * Permanently clear the whole transaction history for the identified people profile.
821
+ */
822
+ clearCharges() {
823
+ this.mixpanelImpl.clearCharges(this.token);
824
+ }
825
+
826
+ /**
827
+ * Permanently deletes the identified user's record from People Analytics.
828
+ *
829
+ * &lt;p>Calling deleteUser deletes an entire record completely. Any future calls
830
+ * to People Analytics using the same distinct id will create and store new values.
831
+ */
832
+ deleteUser() {
833
+ this.mixpanelImpl.deleteUser(this.token);
834
+ }
766
835
  }
767
836
 
768
837
  /**
@@ -771,171 +840,197 @@ export class People {
771
840
  * &lt;p>The MixpanelGroup object is used to update properties in a group's Group Analytics record.
772
841
  */
773
842
  export class MixpanelGroup {
774
-
775
- constructor(token, groupKey, groupID) {
776
- if (!StringHelper.isValid(token)) {
777
- StringHelper.raiseError(PARAMS.TOKEN);
778
- }
779
- this.token = token;
780
- this.groupKey = groupKey;
781
- this.groupID = groupID;
782
- }
783
-
784
- /**
785
- * Sets a single property with the given name and value for this group.
786
- * The given name and value will be assigned to the user in Mixpanel Group Analytics,
787
- * possibly overwriting an existing property with the same name.
788
- *
789
- * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
790
- * @param {string} to The value to set on the given property name. For "Zip Code", this value might be the String "90210"
791
- */
792
- set(prop, to) {
793
- let properties = {};
794
- if (ObjectHelper.isValid(prop)) {
795
- properties = JSON.parse(JSON.stringify(prop || {}));
796
- } else {
797
- if (!StringHelper.isValid(prop)) {
798
- StringHelper.raiseError(PARAMS.PROP);
799
- }
800
- properties[prop] = to;
801
- }
802
- MixpanelReactNative.groupSetProperties(this.token, this.groupKey, this.groupID, properties);
843
+ constructor(token, groupKey, groupID, mixpanelImpl) {
844
+ if (!StringHelper.isValid(token)) {
845
+ StringHelper.raiseError(PARAMS.TOKEN);
803
846
  }
804
-
805
- /**
806
- * Works just like groupSet() except it will not overwrite existing property values. This is useful for properties like "First login date".
807
- *
808
- * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
809
- * @param {string} to The value to set on the given property name. For "Zip Code", this value might be the String "90210"
810
- */
811
- setOnce(prop, to) {
812
- let properties = {};
813
- if (ObjectHelper.isValid(prop)) {
814
- properties = JSON.parse(JSON.stringify(prop || {}));
815
- } else {
816
- if (!StringHelper.isValid(prop)) {
817
- StringHelper.raiseError(PARAMS.PROP);
818
- }
819
- properties[prop] = to;
820
- }
821
- MixpanelReactNative.groupSetPropertyOnce(this.token, this.groupKey, this.groupID, properties);
847
+ this.token = token;
848
+ this.groupKey = groupKey;
849
+ this.groupID = groupID;
850
+ this.mixpanelImpl = mixpanelImpl;
851
+ }
852
+
853
+ /**
854
+ * Sets a single property with the given name and value for this group.
855
+ * The given name and value will be assigned to the user in Mixpanel Group Analytics,
856
+ * possibly overwriting an existing property with the same name.
857
+ *
858
+ * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
859
+ * @param {string} to The value to set on the given property name. For "Zip Code", this value might be the String "90210"
860
+ */
861
+ set(prop, to) {
862
+ let properties = {};
863
+ if (ObjectHelper.isValid(prop)) {
864
+ properties = JSON.parse(JSON.stringify(prop || {}));
865
+ } else {
866
+ if (!StringHelper.isValid(prop)) {
867
+ StringHelper.raiseError(PARAMS.PROP);
868
+ }
869
+ properties[prop] = to;
822
870
  }
823
-
824
- /**
825
- * Permanently removes the property with the given name from the group's profile
826
- *
827
- * @param {string} prop name of a property to unset
828
- */
829
- unset(prop) {
830
- if (!StringHelper.isValid(prop)) {
831
- StringHelper.raiseError(PARAMS.PROPERTY_NAME);
832
- }
833
- MixpanelReactNative.groupUnsetProperty(this.token, this.groupKey, this.groupID, prop);
871
+ this.mixpanelImpl.groupSetProperties(
872
+ this.token,
873
+ this.groupKey,
874
+ this.groupID,
875
+ properties
876
+ );
877
+ }
878
+
879
+ /**
880
+ * Works just like groupSet() except it will not overwrite existing property values. This is useful for properties like "First login date".
881
+ *
882
+ * @param {string} prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
883
+ * @param {string} to The value to set on the given property name. For "Zip Code", this value might be the String "90210"
884
+ */
885
+ setOnce(prop, to) {
886
+ let properties = {};
887
+ if (ObjectHelper.isValid(prop)) {
888
+ properties = JSON.parse(JSON.stringify(prop || {}));
889
+ } else {
890
+ if (!StringHelper.isValid(prop)) {
891
+ StringHelper.raiseError(PARAMS.PROP);
892
+ }
893
+ properties[prop] = to;
834
894
  }
835
-
836
- /**
837
- * Remove value from a list-valued property only if it is already present in the list.
838
- * If the property does not currently exist, the remove will be ignored.
839
- * If the property exists and is not list-valued, the remove will be ignored.
840
- *
841
- * @param {string} name the Group Analytics list-valued property that should have a value removed
842
- * @param {any} value the value that will be removed from the list
843
- */
844
- remove(name, value) {
845
- if (!StringHelper.isValid(name)) {
846
- StringHelper.raiseError(PARAMS.PROPERTY_NAME);
847
- }
848
-
849
- MixpanelReactNative.groupRemovePropertyValue(this.token, this.groupKey, this.groupID, name, value);
895
+ this.mixpanelImpl.groupSetPropertyOnce(
896
+ this.token,
897
+ this.groupKey,
898
+ this.groupID,
899
+ properties
900
+ );
901
+ }
902
+
903
+ /**
904
+ * Permanently removes the property with the given name from the group's profile
905
+ *
906
+ * @param {string} prop name of a property to unset
907
+ */
908
+ unset(prop) {
909
+ if (!StringHelper.isValid(prop)) {
910
+ StringHelper.raiseError(PARAMS.PROPERTY_NAME);
850
911
  }
851
-
852
- /**
853
- * Adds values to a list-valued property only if they are not already present in the list.
854
- * If the property does not currently exist, it will be created with the given list as its value.
855
- * If the property exists and is not list-valued, the union will be ignored.
856
- *
857
- * @param {string} name name of the list-valued property to set or modify
858
- * @param {array} value an array of values to add to the property value if not already present
859
- */
860
- union(name, value) {
861
- if (!StringHelper.isValid(name)) {
862
- StringHelper.raiseError(PARAMS.PROPERTY_NAME);
863
- }
864
- value = Array.isArray(value) ? value : [value];
865
- MixpanelReactNative.groupUnionProperty(this.token, this.groupKey, this.groupID, name, value);
912
+ this.mixpanelImpl.groupUnsetProperty(
913
+ this.token,
914
+ this.groupKey,
915
+ this.groupID,
916
+ prop
917
+ );
918
+ }
919
+
920
+ /**
921
+ * Remove value from a list-valued property only if it is already present in the list.
922
+ * If the property does not currently exist, the remove will be ignored.
923
+ * If the property exists and is not list-valued, the remove will be ignored.
924
+ *
925
+ * @param {string} name the Group Analytics list-valued property that should have a value removed
926
+ * @param {any} value the value that will be removed from the list
927
+ */
928
+ remove(name, value) {
929
+ if (!StringHelper.isValid(name)) {
930
+ StringHelper.raiseError(PARAMS.PROPERTY_NAME);
866
931
  }
867
932
 
933
+ this.mixpanelImpl.groupRemovePropertyValue(
934
+ this.token,
935
+ this.groupKey,
936
+ this.groupID,
937
+ name,
938
+ value
939
+ );
940
+ }
941
+
942
+ /**
943
+ * Adds values to a list-valued property only if they are not already present in the list.
944
+ * If the property does not currently exist, it will be created with the given list as its value.
945
+ * If the property exists and is not list-valued, the union will be ignored.
946
+ *
947
+ * @param {string} name name of the list-valued property to set or modify
948
+ * @param {array} value an array of values to add to the property value if not already present
949
+ */
950
+ union(name, value) {
951
+ if (!StringHelper.isValid(name)) {
952
+ StringHelper.raiseError(PARAMS.PROPERTY_NAME);
953
+ }
954
+ value = Array.isArray(value) ? value : [value];
955
+ this.mixpanelImpl.groupUnionProperty(
956
+ this.token,
957
+ this.groupKey,
958
+ this.groupID,
959
+ name,
960
+ value
961
+ );
962
+ }
868
963
  }
869
964
 
870
965
  class Helper {
871
- /**
966
+ /**
872
967
  Get the library data from package.json file.
873
968
  */
874
- static getMetaData() {
875
- let metadata = JSON.parse(JSON.stringify(packageJson.metadata));
876
- metadata["$lib_version"] = packageJson.version;
877
- return metadata;
878
- }
969
+ static getMetaData() {
970
+ let metadata = JSON.parse(JSON.stringify(packageJson.metadata));
971
+ metadata["$lib_version"] = packageJson.version;
972
+ return metadata;
973
+ }
879
974
 
880
- /**
975
+ /**
881
976
  Get current device platform.
882
977
  */
883
- static getDevicePlatform() {
884
- switch (Platform.OS) {
885
- case "android":
886
- return DevicePlatform.Android;
887
- case "ios":
888
- return DevicePlatform.iOS;
889
- default:
890
- return DevicePlatform.Unknown;
891
- }
978
+ static getDevicePlatform() {
979
+ switch (Platform.OS) {
980
+ case "android":
981
+ return DevicePlatform.Android;
982
+ case "ios":
983
+ return DevicePlatform.iOS;
984
+ default:
985
+ return DevicePlatform.Unknown;
892
986
  }
987
+ }
893
988
  }
894
989
 
895
990
  class StringHelper {
896
- /**
991
+ /**
897
992
  Check whether the parameter is not a blank string.
898
993
  */
899
- static isValid(str) {
900
- return typeof str === "string" &amp;&amp; !(/^\s*$/).test(str);
901
- }
994
+ static isValid(str) {
995
+ return typeof str === "string" &amp;&amp; !/^\s*$/.test(str);
996
+ }
902
997
 
903
- /**
998
+ /**
904
999
  Check whether the parameter is undefined or not a blank string.
905
1000
  */
906
- static isValidOrUndefined(str) {
907
- return str === undefined || StringHelper.isValid(str);
908
- }
1001
+ static isValidOrUndefined(str) {
1002
+ return str === undefined || StringHelper.isValid(str);
1003
+ }
909
1004
 
910
- /**
1005
+ /**
911
1006
  Raise a string validation error.
912
1007
  */
913
- static raiseError(paramName) {
914
- throw new Error(`${paramName}${ERROR_MESSAGE.INVALID_STRING}`);
915
- }
1008
+ static raiseError(paramName) {
1009
+ throw new Error(`${paramName}${ERROR_MESSAGE.INVALID_STRING}`);
1010
+ }
916
1011
  }
917
1012
 
918
1013
  class ObjectHelper {
919
- /**
1014
+ /**
920
1015
  Check whether the parameter is an object.
921
1016
  */
922
- static isValid(obj) {
923
- return typeof obj === "object";
924
- }
1017
+ static isValid(obj) {
1018
+ return typeof obj === "object";
1019
+ }
925
1020
 
926
- /**
1021
+ /**
927
1022
  Check whether the parameter is undefined or an object.
928
1023
  */
929
- static isValidOrUndefined(obj) {
930
- return obj === undefined || ObjectHelper.isValid(obj);
931
- }
1024
+ static isValidOrUndefined(obj) {
1025
+ return obj === undefined || ObjectHelper.isValid(obj);
1026
+ }
932
1027
 
933
- /**
1028
+ /**
934
1029
  Raise an object validation error.
935
1030
  */
936
- static raiseError(paramName) {
937
- throw new Error(`${paramName}${ERROR_MESSAGE.INVALID_OBJECT}`);
938
- }
1031
+ static raiseError(paramName) {
1032
+ throw new Error(`${paramName}${ERROR_MESSAGE.INVALID_OBJECT}`);
1033
+ }
939
1034
  }
940
1035
  </code></pre>
941
1036
  </article>
@@ -953,7 +1048,7 @@ class ObjectHelper {
953
1048
  <br class="clear">
954
1049
 
955
1050
  <footer>
956
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Fri Dec 01 2023 16:27:57 GMT-0800 (Pacific Standard Time)
1051
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Tue Mar 05 2024 17:15:29 GMT-0800 (Pacific Standard Time)
957
1052
  </footer>
958
1053
 
959
1054
  <script> prettyPrint(); </script>