@snowplow/react-native-tracker 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/RNSnowplowTracker.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java +1 -1
- package/dist/index.js +399 -23
- package/dist/index.js.map +1 -1
- package/ios/RNSnowplowTracker.h +2 -2
- package/ios/RNSnowplowTracker.m +2 -2
- package/ios/Util/NSDictionary+RNSP_TypeMethods.h +2 -2
- package/ios/Util/NSDictionary+RNSP_TypeMethods.m +2 -2
- package/ios/Util/RNConfigUtils.h +2 -2
- package/ios/Util/RNConfigUtils.m +2 -2
- package/ios/Util/RNTrackerVersion.h +2 -2
- package/ios/Util/RNTrackerVersion.m +3 -3
- package/ios/Util/RNUtilities.h +2 -2
- package/ios/Util/RNUtilities.m +2 -2
- package/package.json +6 -1
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright (c) 2020-
|
|
190
|
+
Copyright (c) 2020-2023 Snowplow Analytics Ltd, 2019 DataCamp.
|
|
191
191
|
All rights reserved.
|
|
192
192
|
|
|
193
193
|
Licensed under the Apache License, Version 2.0 (the "License");
|
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ Feedback and contributions are welcome - if you have identified a bug, please lo
|
|
|
199
199
|
|
|
200
200
|
## Copyright and license
|
|
201
201
|
|
|
202
|
-
The Snowplow React Native Tracker is copyright 2020-
|
|
202
|
+
The Snowplow React Native Tracker is copyright 2020-2023 Snowplow Analytics Ltd, 2019 DataCamp.
|
|
203
203
|
|
|
204
204
|
Licensed under the **[Apache License, Version 2.0][license]** (the "License");
|
|
205
205
|
you may not use this software except in compliance with the License.
|
package/android/build.gradle
CHANGED
|
@@ -50,5 +50,5 @@ dependencies {
|
|
|
50
50
|
// Required Dependency for the Tracker
|
|
51
51
|
implementation "com.squareup.okhttp3:okhttp:4.9.3"
|
|
52
52
|
implementation "com.facebook.react:react-native:+"
|
|
53
|
-
implementation 'com.snowplowanalytics:snowplow-android-tracker:4.
|
|
53
|
+
implementation 'com.snowplowanalytics:snowplow-android-tracker:4.1.+'
|
|
54
54
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
|
+
import { trackerCore, buildSelfDescribingEvent, buildStructEvent, buildPageView, buildConsentGranted, buildConsentWithdrawn, buildEcommerceTransactionItem, buildEcommerceTransaction } from '@snowplow/tracker-core';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
2
4
|
|
|
3
5
|
/*
|
|
4
|
-
* Copyright (c) 2020-
|
|
5
|
-
*
|
|
6
|
-
* This program is licensed to you under the Apache License Version 2.0,
|
|
7
|
-
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
8
|
-
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing,
|
|
11
|
-
* software distributed under the Apache License Version 2.0 is distributed on an
|
|
12
|
-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
|
|
14
|
-
*/
|
|
15
|
-
const { RNSnowplowTracker } = NativeModules;
|
|
16
|
-
|
|
17
|
-
/*
|
|
18
|
-
* Copyright (c) 2020-2022 Snowplow Analytics Ltd. All rights reserved.
|
|
6
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
19
7
|
*
|
|
20
8
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
21
9
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -81,7 +69,7 @@ function isObject(x) {
|
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
/*
|
|
84
|
-
* Copyright (c) 2020-
|
|
72
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
85
73
|
*
|
|
86
74
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
87
75
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -148,9 +136,397 @@ const logMessages = {
|
|
|
148
136
|
setColorDepth: 'setColorDepth: colorDepth can only be a number(integer) or null',
|
|
149
137
|
setSubjectData: 'setSubjectData:',
|
|
150
138
|
};
|
|
139
|
+
const schemas = {
|
|
140
|
+
payloadData: 'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4',
|
|
141
|
+
timingSchema: 'iglu:com.snowplowanalytics.snowplow/timing/jsonschema/1-0-0',
|
|
142
|
+
deepLinkReceivedSchema: 'iglu:com.snowplowanalytics.mobile/deep_link_received/jsonschema/1-0-0',
|
|
143
|
+
messageNotificationSchema: 'iglu:com.snowplowanalytics.mobile/message_notification/jsonschema/1-0-0',
|
|
144
|
+
screenViewSchema: 'iglu:com.snowplowanalytics.mobile/screen_view/jsonschema/1-0-0',
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
149
|
+
*
|
|
150
|
+
* This program is licensed to you under the Apache License Version 2.0,
|
|
151
|
+
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
152
|
+
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
|
|
153
|
+
*
|
|
154
|
+
* Unless required by applicable law or agreed to in writing,
|
|
155
|
+
* software distributed under the Apache License Version 2.0 is distributed on an
|
|
156
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
157
|
+
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
|
|
158
|
+
*/
|
|
159
|
+
// Tracker version added to the events
|
|
160
|
+
const trackerVersion = 'rn-1.4.0';
|
|
161
|
+
let trackers = {};
|
|
162
|
+
function preparePayload(payload) {
|
|
163
|
+
const stringifiedPayload = {};
|
|
164
|
+
payload['stm'] = new Date().getTime().toString();
|
|
165
|
+
for (const key in payload) {
|
|
166
|
+
if (Object.prototype.hasOwnProperty.call(payload, key)) {
|
|
167
|
+
stringifiedPayload[key] = String(payload[key]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return stringifiedPayload;
|
|
171
|
+
}
|
|
172
|
+
function createEmitCallback(networkConfig) {
|
|
173
|
+
return (e) => {
|
|
174
|
+
const postJson = {
|
|
175
|
+
schema: schemas.payloadData,
|
|
176
|
+
data: [preparePayload(e)],
|
|
177
|
+
};
|
|
178
|
+
const endpoint = networkConfig.endpoint;
|
|
179
|
+
const postPath = networkConfig.customPostPath ?? '/com.snowplowanalytics.snowplow/tp2';
|
|
180
|
+
const headers = networkConfig.requestHeaders ?? {};
|
|
181
|
+
fetch(endpoint + postPath, {
|
|
182
|
+
method: 'POST',
|
|
183
|
+
body: JSON.stringify(postJson),
|
|
184
|
+
headers: {
|
|
185
|
+
'Content-Type': 'application/json',
|
|
186
|
+
...headers,
|
|
187
|
+
},
|
|
188
|
+
}).catch(errorHandler);
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function updateTrackerProperties(tracker, configuration) {
|
|
192
|
+
tracker.setPlatform(configuration.trackerConfig?.devicePlatform ?? 'mob');
|
|
193
|
+
tracker.setTrackerVersion(trackerVersion);
|
|
194
|
+
tracker.setTrackerNamespace(configuration.namespace);
|
|
195
|
+
if (configuration.trackerConfig?.appId != null) {
|
|
196
|
+
tracker.setAppId(configuration.trackerConfig.appId);
|
|
197
|
+
}
|
|
198
|
+
if (configuration.subjectConfig?.colorDepth != null) {
|
|
199
|
+
tracker.setColorDepth(String(configuration.subjectConfig.colorDepth));
|
|
200
|
+
}
|
|
201
|
+
if (configuration.subjectConfig?.domainUserId != null) {
|
|
202
|
+
tracker.setDomainUserId(configuration.subjectConfig.domainUserId);
|
|
203
|
+
}
|
|
204
|
+
if (configuration.subjectConfig?.ipAddress != null) {
|
|
205
|
+
tracker.setIpAddress(configuration.subjectConfig.ipAddress);
|
|
206
|
+
}
|
|
207
|
+
if (configuration.subjectConfig?.language != null) {
|
|
208
|
+
tracker.setLang(configuration.subjectConfig.language);
|
|
209
|
+
}
|
|
210
|
+
if (configuration.subjectConfig?.screenResolution != null) {
|
|
211
|
+
tracker.setScreenResolution(String(configuration.subjectConfig.screenResolution[0]), String(configuration.subjectConfig.screenResolution[1]));
|
|
212
|
+
}
|
|
213
|
+
if (configuration.subjectConfig?.screenViewport != null) {
|
|
214
|
+
tracker.setViewport(String(configuration.subjectConfig.screenViewport[0]), String(configuration.subjectConfig.screenViewport[1]));
|
|
215
|
+
}
|
|
216
|
+
if (configuration.subjectConfig?.timezone != null) {
|
|
217
|
+
tracker.setTimezone(configuration.subjectConfig.timezone);
|
|
218
|
+
}
|
|
219
|
+
if (configuration.subjectConfig?.userId != null) {
|
|
220
|
+
tracker.setUserId(configuration.subjectConfig.userId);
|
|
221
|
+
}
|
|
222
|
+
if (configuration.subjectConfig?.useragent != null) {
|
|
223
|
+
tracker.setUseragent(configuration.subjectConfig.useragent);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function createTracker$2(configuration, emitCallback) {
|
|
227
|
+
// create an emit callback if not given
|
|
228
|
+
const emitter = emitCallback ?? createEmitCallback(configuration.networkConfig);
|
|
229
|
+
// the tracker core does not provide an option to set the duid, so we need to add custom
|
|
230
|
+
let domainUserId;
|
|
231
|
+
const setDomainUserId = (userId) => {
|
|
232
|
+
domainUserId = userId;
|
|
233
|
+
};
|
|
234
|
+
let networkUserId;
|
|
235
|
+
const setNetworkUserId = (userId) => {
|
|
236
|
+
networkUserId = userId;
|
|
237
|
+
};
|
|
238
|
+
// initialize the tracker core
|
|
239
|
+
const core = trackerCore({
|
|
240
|
+
base64: configuration.trackerConfig?.base64Encoding ?? true,
|
|
241
|
+
callback: (payload) => {
|
|
242
|
+
if (domainUserId != null) {
|
|
243
|
+
payload.add('duid', domainUserId);
|
|
244
|
+
}
|
|
245
|
+
if (networkUserId != null) {
|
|
246
|
+
payload.add('tnuid', networkUserId);
|
|
247
|
+
}
|
|
248
|
+
const builtPayload = payload.build();
|
|
249
|
+
emitter(builtPayload);
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
const tracker = { ...core, setDomainUserId, setNetworkUserId };
|
|
253
|
+
trackers[configuration.namespace] = tracker;
|
|
254
|
+
// update tracker properties to reflect subject and tracker info
|
|
255
|
+
updateTrackerProperties(tracker, configuration);
|
|
256
|
+
return Promise.resolve();
|
|
257
|
+
}
|
|
258
|
+
function removeTracker$2(details) {
|
|
259
|
+
delete trackers[details.tracker];
|
|
260
|
+
return Promise.resolve(true);
|
|
261
|
+
}
|
|
262
|
+
function removeAllTrackers$2() {
|
|
263
|
+
trackers = {};
|
|
264
|
+
return Promise.resolve(true);
|
|
265
|
+
}
|
|
266
|
+
function forTracker(namespace, callback) {
|
|
267
|
+
const tracker = namespace != null ? trackers[namespace] : Object.values(trackers)[0];
|
|
268
|
+
if (tracker) {
|
|
269
|
+
callback(tracker);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
errorHandler(new Error('No such tracker found.'));
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function trackSelfDescribingEvent$2(details) {
|
|
276
|
+
forTracker(details.tracker, (tracker) => {
|
|
277
|
+
tracker.track(buildSelfDescribingEvent({
|
|
278
|
+
event: details.eventData,
|
|
279
|
+
}), details.contexts);
|
|
280
|
+
});
|
|
281
|
+
return Promise.resolve();
|
|
282
|
+
}
|
|
283
|
+
function trackStructuredEvent$2(details) {
|
|
284
|
+
forTracker(details.tracker, (tracker) => {
|
|
285
|
+
tracker.track(buildStructEvent(details.eventData), details.contexts);
|
|
286
|
+
});
|
|
287
|
+
return Promise.resolve();
|
|
288
|
+
}
|
|
289
|
+
function trackScreenViewEvent$2(details) {
|
|
290
|
+
const data = {
|
|
291
|
+
name: details.eventData.name,
|
|
292
|
+
id: details.eventData.id ?? v4()
|
|
293
|
+
};
|
|
294
|
+
if (details.eventData.type != null) {
|
|
295
|
+
data.type = details.eventData.type;
|
|
296
|
+
}
|
|
297
|
+
if (details.eventData.previousName != null) {
|
|
298
|
+
data.previousName = details.eventData.previousName;
|
|
299
|
+
}
|
|
300
|
+
if (details.eventData.previousId != null) {
|
|
301
|
+
data.previousId = details.eventData.previousId;
|
|
302
|
+
}
|
|
303
|
+
if (details.eventData.previousType != null) {
|
|
304
|
+
data.previousType = details.eventData.previousType;
|
|
305
|
+
}
|
|
306
|
+
if (details.eventData.transitionType != null) {
|
|
307
|
+
data.transitionType = details.eventData.transitionType;
|
|
308
|
+
}
|
|
309
|
+
return trackSelfDescribingEvent$2({
|
|
310
|
+
tracker: details.tracker,
|
|
311
|
+
eventData: {
|
|
312
|
+
schema: schemas.screenViewSchema,
|
|
313
|
+
data: data
|
|
314
|
+
},
|
|
315
|
+
contexts: details.contexts,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function trackPageViewEvent$2(details) {
|
|
319
|
+
forTracker(details.tracker, (tracker) => {
|
|
320
|
+
tracker.track(buildPageView(details.eventData), details.contexts);
|
|
321
|
+
});
|
|
322
|
+
return Promise.resolve();
|
|
323
|
+
}
|
|
324
|
+
function trackTimingEvent$2(details) {
|
|
325
|
+
return trackSelfDescribingEvent$2({
|
|
326
|
+
tracker: details.tracker,
|
|
327
|
+
eventData: {
|
|
328
|
+
schema: schemas.timingSchema,
|
|
329
|
+
data: details.eventData,
|
|
330
|
+
},
|
|
331
|
+
contexts: details.contexts,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function trackConsentGrantedEvent$2(details) {
|
|
335
|
+
forTracker(details.tracker, (tracker) => {
|
|
336
|
+
const built = buildConsentGranted({
|
|
337
|
+
id: details.eventData.documentId,
|
|
338
|
+
version: details.eventData.version,
|
|
339
|
+
name: details.eventData.name,
|
|
340
|
+
description: details.eventData.documentDescription,
|
|
341
|
+
expiry: details.eventData.expiry,
|
|
342
|
+
});
|
|
343
|
+
tracker.track(built.event, details.contexts.concat(built.context));
|
|
344
|
+
});
|
|
345
|
+
return Promise.resolve();
|
|
346
|
+
}
|
|
347
|
+
function trackConsentWithdrawnEvent$2(details) {
|
|
348
|
+
forTracker(details.tracker, (tracker) => {
|
|
349
|
+
const built = buildConsentWithdrawn({
|
|
350
|
+
all: details.eventData.all,
|
|
351
|
+
id: details.eventData.documentId,
|
|
352
|
+
version: details.eventData.version,
|
|
353
|
+
name: details.eventData.name,
|
|
354
|
+
description: details.eventData.documentDescription,
|
|
355
|
+
});
|
|
356
|
+
tracker.track(built.event, details.contexts.concat(built.context));
|
|
357
|
+
});
|
|
358
|
+
return Promise.resolve();
|
|
359
|
+
}
|
|
360
|
+
function trackEcommerceTransactionEvent$2(details) {
|
|
361
|
+
forTracker(details.tracker, (tracker) => {
|
|
362
|
+
details.eventData.items.forEach(item => {
|
|
363
|
+
tracker.track(buildEcommerceTransactionItem({
|
|
364
|
+
...item,
|
|
365
|
+
orderId: details.eventData.orderId
|
|
366
|
+
}), details.contexts);
|
|
367
|
+
});
|
|
368
|
+
tracker.track(buildEcommerceTransaction({
|
|
369
|
+
orderId: details.eventData.orderId,
|
|
370
|
+
total: details.eventData.totalValue,
|
|
371
|
+
affiliation: details.eventData.affiliation,
|
|
372
|
+
tax: details.eventData.taxValue,
|
|
373
|
+
shipping: details.eventData.shipping,
|
|
374
|
+
city: details.eventData.city,
|
|
375
|
+
state: details.eventData.state,
|
|
376
|
+
country: details.eventData.country,
|
|
377
|
+
currency: details.eventData.currency,
|
|
378
|
+
}), details.contexts);
|
|
379
|
+
});
|
|
380
|
+
return Promise.resolve();
|
|
381
|
+
}
|
|
382
|
+
function trackDeepLinkReceivedEvent$2(details) {
|
|
383
|
+
return trackSelfDescribingEvent$2({
|
|
384
|
+
tracker: details.tracker,
|
|
385
|
+
eventData: {
|
|
386
|
+
schema: schemas.deepLinkReceivedSchema,
|
|
387
|
+
data: details.eventData,
|
|
388
|
+
},
|
|
389
|
+
contexts: details.contexts,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
function trackMessageNotificationEvent$2(details) {
|
|
393
|
+
return trackSelfDescribingEvent$2({
|
|
394
|
+
tracker: details.tracker,
|
|
395
|
+
eventData: {
|
|
396
|
+
schema: schemas.messageNotificationSchema,
|
|
397
|
+
data: details.eventData,
|
|
398
|
+
},
|
|
399
|
+
contexts: details.contexts,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function removeGlobalContexts$1() {
|
|
403
|
+
return Promise.reject(new Error('Not implemented'));
|
|
404
|
+
}
|
|
405
|
+
function addGlobalContexts$1() {
|
|
406
|
+
return Promise.reject(new Error('Not implemented'));
|
|
407
|
+
}
|
|
408
|
+
function setUserId$2(details) {
|
|
409
|
+
trackers[details.tracker]?.setUserId(details.userId ?? '');
|
|
410
|
+
return Promise.resolve();
|
|
411
|
+
}
|
|
412
|
+
function setNetworkUserId$2(details) {
|
|
413
|
+
trackers[details.tracker]?.setNetworkUserId(details.networkUserId ?? '');
|
|
414
|
+
return Promise.resolve();
|
|
415
|
+
}
|
|
416
|
+
function setDomainUserId$2(details) {
|
|
417
|
+
trackers[details.tracker]?.setDomainUserId(details.domainUserId ?? '');
|
|
418
|
+
return Promise.resolve();
|
|
419
|
+
}
|
|
420
|
+
function setIpAddress$2(details) {
|
|
421
|
+
trackers[details.tracker]?.setIpAddress(details.ipAddress ?? '');
|
|
422
|
+
return Promise.resolve();
|
|
423
|
+
}
|
|
424
|
+
function setUseragent$2(details) {
|
|
425
|
+
trackers[details.tracker]?.setUseragent(details.useragent ?? '');
|
|
426
|
+
return Promise.resolve();
|
|
427
|
+
}
|
|
428
|
+
function setTimezone$2(details) {
|
|
429
|
+
trackers[details.tracker]?.setTimezone(details.timezone ?? '');
|
|
430
|
+
return Promise.resolve();
|
|
431
|
+
}
|
|
432
|
+
function setLanguage$2(details) {
|
|
433
|
+
trackers[details.tracker]?.setLang(details.language ?? '');
|
|
434
|
+
return Promise.resolve();
|
|
435
|
+
}
|
|
436
|
+
function setScreenResolution$2(details) {
|
|
437
|
+
if (details.screenResolution) {
|
|
438
|
+
trackers[details.tracker]?.setScreenResolution(String(details.screenResolution[0]), String(details.screenResolution[1]));
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
trackers[details.tracker]?.addPayloadPair('res', '');
|
|
442
|
+
}
|
|
443
|
+
return Promise.resolve();
|
|
444
|
+
}
|
|
445
|
+
function setScreenViewport$2(details) {
|
|
446
|
+
if (details.screenViewport) {
|
|
447
|
+
trackers[details.tracker]?.setViewport(String(details.screenViewport[0]), String(details.screenViewport[1]));
|
|
448
|
+
}
|
|
449
|
+
else {
|
|
450
|
+
trackers[details.tracker]?.addPayloadPair('vp', '');
|
|
451
|
+
}
|
|
452
|
+
return Promise.resolve();
|
|
453
|
+
}
|
|
454
|
+
function setColorDepth$2(details) {
|
|
455
|
+
trackers[details.tracker]?.setColorDepth(String(details.colorDepth ?? ''));
|
|
456
|
+
return Promise.resolve();
|
|
457
|
+
}
|
|
458
|
+
function getSessionUserId$1() {
|
|
459
|
+
return Promise.reject(new Error('Not implemented'));
|
|
460
|
+
}
|
|
461
|
+
function getSessionId$1() {
|
|
462
|
+
return Promise.reject(new Error('Not implemented'));
|
|
463
|
+
}
|
|
464
|
+
function getSessionIndex$1() {
|
|
465
|
+
return Promise.reject(new Error('Not implemented'));
|
|
466
|
+
}
|
|
467
|
+
function getIsInBackground$1() {
|
|
468
|
+
return Promise.reject(new Error('Not implemented'));
|
|
469
|
+
}
|
|
470
|
+
function getBackgroundIndex$1() {
|
|
471
|
+
return Promise.reject(new Error('Not implemented'));
|
|
472
|
+
}
|
|
473
|
+
function getForegroundIndex$1() {
|
|
474
|
+
return Promise.reject(new Error('Not implemented'));
|
|
475
|
+
}
|
|
476
|
+
const JSSnowplowTracker = Object.freeze({
|
|
477
|
+
createTracker: createTracker$2,
|
|
478
|
+
removeTracker: removeTracker$2,
|
|
479
|
+
removeAllTrackers: removeAllTrackers$2,
|
|
480
|
+
trackSelfDescribingEvent: trackSelfDescribingEvent$2,
|
|
481
|
+
trackStructuredEvent: trackStructuredEvent$2,
|
|
482
|
+
trackScreenViewEvent: trackScreenViewEvent$2,
|
|
483
|
+
trackPageViewEvent: trackPageViewEvent$2,
|
|
484
|
+
trackTimingEvent: trackTimingEvent$2,
|
|
485
|
+
trackConsentGrantedEvent: trackConsentGrantedEvent$2,
|
|
486
|
+
trackConsentWithdrawnEvent: trackConsentWithdrawnEvent$2,
|
|
487
|
+
trackEcommerceTransactionEvent: trackEcommerceTransactionEvent$2,
|
|
488
|
+
trackDeepLinkReceivedEvent: trackDeepLinkReceivedEvent$2,
|
|
489
|
+
trackMessageNotificationEvent: trackMessageNotificationEvent$2,
|
|
490
|
+
removeGlobalContexts: removeGlobalContexts$1,
|
|
491
|
+
addGlobalContexts: addGlobalContexts$1,
|
|
492
|
+
setUserId: setUserId$2,
|
|
493
|
+
setNetworkUserId: setNetworkUserId$2,
|
|
494
|
+
setDomainUserId: setDomainUserId$2,
|
|
495
|
+
setIpAddress: setIpAddress$2,
|
|
496
|
+
setUseragent: setUseragent$2,
|
|
497
|
+
setTimezone: setTimezone$2,
|
|
498
|
+
setLanguage: setLanguage$2,
|
|
499
|
+
setScreenResolution: setScreenResolution$2,
|
|
500
|
+
setScreenViewport: setScreenViewport$2,
|
|
501
|
+
setColorDepth: setColorDepth$2,
|
|
502
|
+
getSessionUserId: getSessionUserId$1,
|
|
503
|
+
getSessionId: getSessionId$1,
|
|
504
|
+
getSessionIndex: getSessionIndex$1,
|
|
505
|
+
getIsInBackground: getIsInBackground$1,
|
|
506
|
+
getBackgroundIndex: getBackgroundIndex$1,
|
|
507
|
+
getForegroundIndex: getForegroundIndex$1,
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
/*
|
|
511
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
512
|
+
*
|
|
513
|
+
* This program is licensed to you under the Apache License Version 2.0,
|
|
514
|
+
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
515
|
+
* You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
|
|
516
|
+
*
|
|
517
|
+
* Unless required by applicable law or agreed to in writing,
|
|
518
|
+
* software distributed under the Apache License Version 2.0 is distributed on an
|
|
519
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
520
|
+
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
|
|
521
|
+
*/
|
|
522
|
+
const isAvailable = NativeModules.RNSnowplowTracker != null;
|
|
523
|
+
if (!isAvailable) {
|
|
524
|
+
errorHandler(new Error('Unable to access the native iOS/Android Snowplow tracker, a tracker implementation with very limited functionality is used.'));
|
|
525
|
+
}
|
|
526
|
+
const RNSnowplowTracker = isAvailable ? NativeModules.RNSnowplowTracker : JSSnowplowTracker;
|
|
151
527
|
|
|
152
528
|
/*
|
|
153
|
-
* Copyright (c) 2020-
|
|
529
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
154
530
|
*
|
|
155
531
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
156
532
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -394,7 +770,7 @@ function validateEcommerceTransaction(argmap) {
|
|
|
394
770
|
}
|
|
395
771
|
|
|
396
772
|
/*
|
|
397
|
-
* Copyright (c) 2020-
|
|
773
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
398
774
|
*
|
|
399
775
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
400
776
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -648,7 +1024,7 @@ function initValidate(init) {
|
|
|
648
1024
|
}
|
|
649
1025
|
|
|
650
1026
|
/*
|
|
651
|
-
* Copyright (c) 2020-
|
|
1027
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
652
1028
|
*
|
|
653
1029
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
654
1030
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -861,7 +1237,7 @@ function trackMessageNotificationEvent$1(namespace, argmap, contexts = []) {
|
|
|
861
1237
|
}
|
|
862
1238
|
|
|
863
1239
|
/*
|
|
864
|
-
* Copyright (c) 2020-
|
|
1240
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
865
1241
|
*
|
|
866
1242
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
867
1243
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -1084,7 +1460,7 @@ function setSubjectData$1(namespace, config) {
|
|
|
1084
1460
|
}
|
|
1085
1461
|
|
|
1086
1462
|
/*
|
|
1087
|
-
* Copyright (c) 2020-
|
|
1463
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
1088
1464
|
*
|
|
1089
1465
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
1090
1466
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -1461,7 +1837,7 @@ function getForegroundIndex(namespace) {
|
|
|
1461
1837
|
}
|
|
1462
1838
|
|
|
1463
1839
|
/*
|
|
1464
|
-
* Copyright (c) 2020-
|
|
1840
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
1465
1841
|
*
|
|
1466
1842
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
1467
1843
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|
|
@@ -1531,7 +1907,7 @@ function getWebViewCallback() {
|
|
|
1531
1907
|
}
|
|
1532
1908
|
|
|
1533
1909
|
/*
|
|
1534
|
-
* Copyright (c) 2020-
|
|
1910
|
+
* Copyright (c) 2020-2023 Snowplow Analytics Ltd. All rights reserved.
|
|
1535
1911
|
*
|
|
1536
1912
|
* This program is licensed to you under the Apache License Version 2.0,
|
|
1537
1913
|
* and you may not use this file except in compliance with the Apache License Version 2.0.
|