@layers/react-native 2.2.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +62 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/io/layers/sdk/reactnative/LayersAdvertisingIdModule.java +70 -0
- package/android/src/main/java/io/layers/sdk/reactnative/LayersDeviceInfoModule.java +54 -0
- package/android/src/main/java/io/layers/sdk/reactnative/LayersInstallReferrerModule.java +116 -0
- package/android/src/main/java/io/layers/sdk/reactnative/LayersReactNativePackage.java +36 -0
- package/dist/att-BDPyE-Gs.d.mts.map +1 -1
- package/dist/debug-overlay.d.mts +3 -3
- package/dist/debug-overlay.d.mts.map +1 -1
- package/dist/debug-overlay.d.ts +3 -3
- package/dist/debug-overlay.d.ts.map +1 -1
- package/dist/debug-overlay.js +18 -18
- package/dist/debug-overlay.mjs +18 -18
- package/dist/debug-overlay.mjs.map +1 -1
- package/dist/{index-BlYXUV-h.d.mts → index-BqcbQZEP.d.mts} +323 -47
- package/dist/index-BqcbQZEP.d.mts.map +1 -0
- package/dist/{index-BaaQSCs5.d.ts → index-fU6euPnq.d.ts} +323 -47
- package/dist/index-fU6euPnq.d.ts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +54 -1
- package/dist/index.mjs +2 -2
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{src-8aNaNJz3.mjs → src-BNoj1E-e.mjs} +677 -90
- package/dist/src-BNoj1E-e.mjs.map +1 -0
- package/dist/{src-CP6aZ_iI.js → src-ym3bM4JE.js} +704 -87
- package/ios/LayersAdServices.m +8 -0
- package/ios/LayersAdServices.swift +41 -0
- package/ios/LayersDeviceInfo.m +14 -0
- package/ios/LayersDeviceInfo.swift +53 -0
- package/ios/LayersSKAN.m +45 -0
- package/ios/LayersSKAN.swift +188 -0
- package/ios/LayersSKANCompat.h +22 -0
- package/ios/LayersSKANCompat.m +118 -0
- package/layers-react-native.podspec +34 -0
- package/package.json +6 -3
- package/dist/index-BaaQSCs5.d.ts.map +0 -1
- package/dist/index-BlYXUV-h.d.mts.map +0 -1
- package/dist/src-8aNaNJz3.mjs.map +0 -1
|
@@ -216,27 +216,27 @@ function screenViewEvent(name, screenClass) {
|
|
|
216
216
|
*
|
|
217
217
|
* Superwall.instance.setDelegate({
|
|
218
218
|
* handleSuperwallEvent(eventInfo) {
|
|
219
|
-
* superwallOnEvent(
|
|
219
|
+
* superwallOnEvent(sdk, eventInfo);
|
|
220
220
|
* }
|
|
221
221
|
* });
|
|
222
222
|
* ```
|
|
223
223
|
*/
|
|
224
|
-
function superwallOnEvent(
|
|
224
|
+
function superwallOnEvent(sdk, eventInfo) {
|
|
225
225
|
try {
|
|
226
226
|
const eventName = eventInfo.event.rawName ?? eventInfo.event.type ?? "unknown";
|
|
227
227
|
const properties = { source: "superwall" };
|
|
228
228
|
if (eventInfo.params) Object.assign(properties, eventInfo.params);
|
|
229
|
-
|
|
229
|
+
sdk.track(`superwall_${eventName}`, properties);
|
|
230
230
|
} catch {}
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
233
233
|
* Track that a paywall was presented to the user.
|
|
234
234
|
*
|
|
235
235
|
* ```ts
|
|
236
|
-
* superwallTrackPresentation(
|
|
236
|
+
* superwallTrackPresentation(sdk, paywallInfo);
|
|
237
237
|
* ```
|
|
238
238
|
*/
|
|
239
|
-
function superwallTrackPresentation(
|
|
239
|
+
function superwallTrackPresentation(sdk, paywallInfo) {
|
|
240
240
|
try {
|
|
241
241
|
if (!paywallInfo) return;
|
|
242
242
|
const properties = {
|
|
@@ -249,20 +249,20 @@ function superwallTrackPresentation(layers, paywallInfo) {
|
|
|
249
249
|
id: paywallInfo.experiment.id,
|
|
250
250
|
variant: paywallInfo.experiment.variantId
|
|
251
251
|
};
|
|
252
|
-
|
|
252
|
+
sdk.track("paywall_show", properties);
|
|
253
253
|
} catch {}
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* Track that a paywall was dismissed.
|
|
257
257
|
*
|
|
258
258
|
* ```ts
|
|
259
|
-
* superwallTrackDismiss(
|
|
259
|
+
* superwallTrackDismiss(sdk, paywallInfo);
|
|
260
260
|
* ```
|
|
261
261
|
*/
|
|
262
|
-
function superwallTrackDismiss(
|
|
262
|
+
function superwallTrackDismiss(sdk, paywallInfo) {
|
|
263
263
|
try {
|
|
264
264
|
if (!paywallInfo) return;
|
|
265
|
-
|
|
265
|
+
sdk.track("paywall_dismiss", {
|
|
266
266
|
paywall_id: paywallInfo.identifier,
|
|
267
267
|
source: "superwall"
|
|
268
268
|
});
|
|
@@ -272,10 +272,10 @@ function superwallTrackDismiss(layers, paywallInfo) {
|
|
|
272
272
|
* Track a purchase initiated from a Superwall paywall.
|
|
273
273
|
*
|
|
274
274
|
* ```ts
|
|
275
|
-
* superwallTrackPurchase(
|
|
275
|
+
* superwallTrackPurchase(sdk, paywallInfo, product);
|
|
276
276
|
* ```
|
|
277
277
|
*/
|
|
278
|
-
function superwallTrackPurchase(
|
|
278
|
+
function superwallTrackPurchase(sdk, paywallInfo, product) {
|
|
279
279
|
try {
|
|
280
280
|
const properties = {
|
|
281
281
|
paywall_id: paywallInfo?.identifier ?? "unknown",
|
|
@@ -288,19 +288,19 @@ function superwallTrackPurchase(layers, paywallInfo, product) {
|
|
|
288
288
|
const currency = product.currencyCode ?? product.currency;
|
|
289
289
|
if (currency) properties.currency = currency;
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
sdk.track("paywall_purchase", properties);
|
|
292
292
|
} catch {}
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
295
|
* Track that a paywall was skipped (e.g. holdout, no rule match).
|
|
296
296
|
*
|
|
297
297
|
* ```ts
|
|
298
|
-
* superwallTrackSkip(
|
|
298
|
+
* superwallTrackSkip(sdk, paywallInfo, 'holdout');
|
|
299
299
|
* ```
|
|
300
300
|
*/
|
|
301
|
-
function superwallTrackSkip(
|
|
301
|
+
function superwallTrackSkip(sdk, paywallInfo, reason) {
|
|
302
302
|
try {
|
|
303
|
-
|
|
303
|
+
sdk.track("paywall_skip", {
|
|
304
304
|
paywall_id: paywallInfo?.identifier ?? "unknown",
|
|
305
305
|
reason,
|
|
306
306
|
source: "superwall"
|
|
@@ -312,16 +312,16 @@ function superwallTrackSkip(layers, paywallInfo, reason) {
|
|
|
312
312
|
*
|
|
313
313
|
* Pass the returned object to `Superwall.instance.setUserAttributes()`:
|
|
314
314
|
* ```ts
|
|
315
|
-
* const attrs = superwallUserAttributes(
|
|
315
|
+
* const attrs = superwallUserAttributes(sdk);
|
|
316
316
|
* Superwall.instance.setUserAttributes(attrs);
|
|
317
317
|
* ```
|
|
318
318
|
*/
|
|
319
|
-
function superwallUserAttributes(
|
|
319
|
+
function superwallUserAttributes(sdk) {
|
|
320
320
|
const attrs = {};
|
|
321
321
|
try {
|
|
322
|
-
const sessionId =
|
|
322
|
+
const sessionId = sdk.getSessionId();
|
|
323
323
|
if (sessionId) attrs.layers_session_id = sessionId;
|
|
324
|
-
const userId =
|
|
324
|
+
const userId = sdk.getAppUserId();
|
|
325
325
|
if (userId) attrs.layers_user_id = userId;
|
|
326
326
|
} catch {}
|
|
327
327
|
return attrs;
|
|
@@ -335,7 +335,7 @@ function superwallUserAttributes(layers) {
|
|
|
335
335
|
* ```ts
|
|
336
336
|
* import { trackPurchase } from '@layers/react-native';
|
|
337
337
|
*
|
|
338
|
-
* trackPurchase(
|
|
338
|
+
* trackPurchase(sdk, {
|
|
339
339
|
* productId: 'premium_monthly',
|
|
340
340
|
* price: 9.99,
|
|
341
341
|
* currency: 'USD',
|
|
@@ -343,7 +343,7 @@ function superwallUserAttributes(layers) {
|
|
|
343
343
|
* });
|
|
344
344
|
* ```
|
|
345
345
|
*/
|
|
346
|
-
function trackPurchase(
|
|
346
|
+
function trackPurchase(sdk, params) {
|
|
347
347
|
const quantity = params.quantity ?? 1;
|
|
348
348
|
const props = {
|
|
349
349
|
product_id: params.productId,
|
|
@@ -356,12 +356,12 @@ function trackPurchase(layers, params) {
|
|
|
356
356
|
if (params.transactionId !== void 0) props.transaction_id = params.transactionId;
|
|
357
357
|
if (params.isRestored !== void 0) props.is_restored = params.isRestored;
|
|
358
358
|
if (params.store !== void 0) props.store = params.store;
|
|
359
|
-
|
|
359
|
+
sdk.track("purchase_success", props);
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
362
362
|
* Track a failed purchase attempt.
|
|
363
363
|
*/
|
|
364
|
-
function trackPurchaseFailed(
|
|
364
|
+
function trackPurchaseFailed(sdk, params) {
|
|
365
365
|
const props = {
|
|
366
366
|
product_id: params.productId,
|
|
367
367
|
currency: params.currency,
|
|
@@ -369,7 +369,7 @@ function trackPurchaseFailed(layers, params) {
|
|
|
369
369
|
...params.properties
|
|
370
370
|
};
|
|
371
371
|
if (params.errorMessage !== void 0) props.error_message = params.errorMessage;
|
|
372
|
-
|
|
372
|
+
sdk.track("purchase_failed", props);
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Track a subscription purchase or renewal.
|
|
@@ -377,7 +377,7 @@ function trackPurchaseFailed(layers, params) {
|
|
|
377
377
|
* ```ts
|
|
378
378
|
* import { trackSubscription } from '@layers/react-native';
|
|
379
379
|
*
|
|
380
|
-
* trackSubscription(
|
|
380
|
+
* trackSubscription(sdk, {
|
|
381
381
|
* productId: 'pro_annual',
|
|
382
382
|
* price: 49.99,
|
|
383
383
|
* currency: 'USD',
|
|
@@ -385,7 +385,7 @@ function trackPurchaseFailed(layers, params) {
|
|
|
385
385
|
* });
|
|
386
386
|
* ```
|
|
387
387
|
*/
|
|
388
|
-
function trackSubscription(
|
|
388
|
+
function trackSubscription(sdk, params) {
|
|
389
389
|
const props = {
|
|
390
390
|
product_id: params.productId,
|
|
391
391
|
price: params.price,
|
|
@@ -400,12 +400,12 @@ function trackSubscription(layers, params) {
|
|
|
400
400
|
if (params.isTrial !== void 0) props.is_trial = params.isTrial;
|
|
401
401
|
if (params.subscriptionGroupId !== void 0) props.subscription_group_id = params.subscriptionGroupId;
|
|
402
402
|
if (params.originalTransactionId !== void 0) props.original_transaction_id = params.originalTransactionId;
|
|
403
|
-
|
|
403
|
+
sdk.track("subscribe", props);
|
|
404
404
|
}
|
|
405
405
|
/**
|
|
406
406
|
* Track a completed order with multiple line items.
|
|
407
407
|
*/
|
|
408
|
-
function trackOrder(
|
|
408
|
+
function trackOrder(sdk, params) {
|
|
409
409
|
const currency = params.currency ?? "USD";
|
|
410
410
|
let total = params.subtotal;
|
|
411
411
|
if (params.tax !== void 0) total += params.tax;
|
|
@@ -425,12 +425,12 @@ function trackOrder(layers, params) {
|
|
|
425
425
|
if (params.shipping !== void 0) props.shipping = params.shipping;
|
|
426
426
|
if (params.discount !== void 0) props.discount = params.discount;
|
|
427
427
|
if (params.couponCode !== void 0) props.coupon_code = params.couponCode;
|
|
428
|
-
|
|
428
|
+
sdk.track("purchase_success", props);
|
|
429
429
|
}
|
|
430
430
|
/**
|
|
431
431
|
* Track an item being added to the cart.
|
|
432
432
|
*/
|
|
433
|
-
function trackAddToCart(
|
|
433
|
+
function trackAddToCart(sdk, item, properties) {
|
|
434
434
|
const quantity = item.quantity ?? 1;
|
|
435
435
|
const props = {
|
|
436
436
|
product_id: item.productId,
|
|
@@ -441,12 +441,12 @@ function trackAddToCart(layers, item, properties) {
|
|
|
441
441
|
...properties
|
|
442
442
|
};
|
|
443
443
|
if (item.category !== void 0) props.category = item.category;
|
|
444
|
-
|
|
444
|
+
sdk.track("add_to_cart", props);
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
447
|
* Track an item being removed from the cart.
|
|
448
448
|
*/
|
|
449
|
-
function trackRemoveFromCart(
|
|
449
|
+
function trackRemoveFromCart(sdk, item, properties) {
|
|
450
450
|
const quantity = item.quantity ?? 1;
|
|
451
451
|
const props = {
|
|
452
452
|
product_id: item.productId,
|
|
@@ -456,12 +456,12 @@ function trackRemoveFromCart(layers, item, properties) {
|
|
|
456
456
|
...properties
|
|
457
457
|
};
|
|
458
458
|
if (item.category !== void 0) props.category = item.category;
|
|
459
|
-
|
|
459
|
+
sdk.track("remove_from_cart", props);
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
462
462
|
* Track beginning the checkout flow.
|
|
463
463
|
*/
|
|
464
|
-
function trackBeginCheckout(
|
|
464
|
+
function trackBeginCheckout(sdk, items, currency = "USD", properties) {
|
|
465
465
|
const total = items.reduce((sum, item) => sum + item.price * (item.quantity ?? 1), 0);
|
|
466
466
|
const props = {
|
|
467
467
|
item_count: items.length,
|
|
@@ -470,12 +470,12 @@ function trackBeginCheckout(layers, items, currency = "USD", properties) {
|
|
|
470
470
|
product_ids: items.map((i) => i.productId).join(","),
|
|
471
471
|
...properties
|
|
472
472
|
};
|
|
473
|
-
|
|
473
|
+
sdk.track("begin_checkout", props);
|
|
474
474
|
}
|
|
475
475
|
/**
|
|
476
476
|
* Track viewing a product detail page.
|
|
477
477
|
*/
|
|
478
|
-
function trackViewProduct(
|
|
478
|
+
function trackViewProduct(sdk, productId, name, price, currency = "USD", category, properties) {
|
|
479
479
|
const props = {
|
|
480
480
|
product_id: productId,
|
|
481
481
|
product_name: name,
|
|
@@ -484,12 +484,12 @@ function trackViewProduct(layers, productId, name, price, currency = "USD", cate
|
|
|
484
484
|
...properties
|
|
485
485
|
};
|
|
486
486
|
if (category !== void 0) props.category = category;
|
|
487
|
-
|
|
487
|
+
sdk.track("view_item", props);
|
|
488
488
|
}
|
|
489
489
|
/**
|
|
490
490
|
* Track a refund.
|
|
491
491
|
*/
|
|
492
|
-
function trackRefund(
|
|
492
|
+
function trackRefund(sdk, params) {
|
|
493
493
|
const props = {
|
|
494
494
|
transaction_id: params.transactionId,
|
|
495
495
|
amount: params.amount,
|
|
@@ -497,7 +497,7 @@ function trackRefund(layers, params) {
|
|
|
497
497
|
...params.properties
|
|
498
498
|
};
|
|
499
499
|
if (params.reason !== void 0) props.reason = params.reason;
|
|
500
|
-
|
|
500
|
+
sdk.track("refund", props);
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
//#endregion
|
|
@@ -505,7 +505,7 @@ function trackRefund(layers, params) {
|
|
|
505
505
|
let _isConnected = false;
|
|
506
506
|
let _activeSubscriptions = /* @__PURE__ */ new Set();
|
|
507
507
|
let _isInitialLoadDone = false;
|
|
508
|
-
let
|
|
508
|
+
let _connectedSDK = null;
|
|
509
509
|
/**
|
|
510
510
|
* Connect Layers to your existing RevenueCat Purchases instance.
|
|
511
511
|
*
|
|
@@ -517,16 +517,16 @@ let _connectedLayers = null;
|
|
|
517
517
|
* import Purchases from 'react-native-purchases';
|
|
518
518
|
* import { LayersReactNative, connectRevenueCat } from '@layers/react-native';
|
|
519
519
|
*
|
|
520
|
-
* const
|
|
520
|
+
* const sdk = new LayersReactNative();
|
|
521
521
|
* await layers.init({ appId: 'your-app-id', environment: 'production' });
|
|
522
522
|
*
|
|
523
523
|
* connectRevenueCat({
|
|
524
|
-
*
|
|
524
|
+
* sdk,
|
|
525
525
|
* purchases: Purchases,
|
|
526
526
|
* });
|
|
527
527
|
* ```
|
|
528
528
|
*
|
|
529
|
-
* @param config - Configuration including the
|
|
529
|
+
* @param config - Configuration including the SDK instance.
|
|
530
530
|
* @param purchases - The RevenueCat Purchases instance (duck-typed to avoid hard dependency).
|
|
531
531
|
*/
|
|
532
532
|
function connectRevenueCat(config, purchases) {
|
|
@@ -535,7 +535,7 @@ function connectRevenueCat(config, purchases) {
|
|
|
535
535
|
if (!purchases) return;
|
|
536
536
|
if (typeof purchases.addCustomerInfoUpdateListener !== "function") return;
|
|
537
537
|
if (typeof purchases.getCustomerInfo !== "function") return;
|
|
538
|
-
|
|
538
|
+
_connectedSDK = config.sdk;
|
|
539
539
|
purchases.addCustomerInfoUpdateListener((info) => {
|
|
540
540
|
handleCustomerInfoUpdate(config, info, false);
|
|
541
541
|
});
|
|
@@ -552,10 +552,10 @@ function connectRevenueCat(config, purchases) {
|
|
|
552
552
|
* ```ts
|
|
553
553
|
* const offerings = await Purchases.getOfferings();
|
|
554
554
|
* const pkg = offerings.current?.availablePackages[0];
|
|
555
|
-
* if (pkg) trackRevenueCatPurchase(
|
|
555
|
+
* if (pkg) trackRevenueCatPurchase(sdk, pkg);
|
|
556
556
|
* ```
|
|
557
557
|
*/
|
|
558
|
-
function trackRevenueCatPurchase(
|
|
558
|
+
function trackRevenueCatPurchase(sdk, rcPackage, store) {
|
|
559
559
|
try {
|
|
560
560
|
if (!rcPackage?.product) return;
|
|
561
561
|
let resolvedStore = store ?? "app_store";
|
|
@@ -563,7 +563,7 @@ function trackRevenueCatPurchase(layers, rcPackage, store) {
|
|
|
563
563
|
const { Platform } = require("react-native");
|
|
564
564
|
resolvedStore = Platform.OS === "ios" ? "app_store" : "play_store";
|
|
565
565
|
} catch {}
|
|
566
|
-
|
|
566
|
+
sdk.track("purchase_success", {
|
|
567
567
|
product_id: rcPackage.product.identifier ?? "",
|
|
568
568
|
price: rcPackage.product.price ?? 0,
|
|
569
569
|
currency: rcPackage.product.currencyCode ?? "USD",
|
|
@@ -578,11 +578,11 @@ function trackRevenueCatPurchase(layers, rcPackage, store) {
|
|
|
578
578
|
* This is called automatically when using `connectRevenueCat()`, but can also
|
|
579
579
|
* be called manually if needed.
|
|
580
580
|
*/
|
|
581
|
-
function syncRevenueCatAttributes(
|
|
581
|
+
function syncRevenueCatAttributes(sdk, customerInfo) {
|
|
582
582
|
try {
|
|
583
583
|
const userProps = { is_subscriber: Array.isArray(customerInfo.activeSubscriptions) && customerInfo.activeSubscriptions.length > 0 };
|
|
584
584
|
if (customerInfo.originalAppUserId) userProps.revenuecat_original_app_user_id = customerInfo.originalAppUserId;
|
|
585
|
-
|
|
585
|
+
sdk.setUserProperties(userProps);
|
|
586
586
|
} catch {}
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
@@ -592,7 +592,7 @@ function resetRevenueCatForTesting() {
|
|
|
592
592
|
_isConnected = false;
|
|
593
593
|
_activeSubscriptions = /* @__PURE__ */ new Set();
|
|
594
594
|
_isInitialLoadDone = false;
|
|
595
|
-
|
|
595
|
+
_connectedSDK = null;
|
|
596
596
|
}
|
|
597
597
|
/**
|
|
598
598
|
* Whether the RevenueCat integration is currently connected.
|
|
@@ -604,10 +604,10 @@ function handleCustomerInfoUpdate(config, info, isInitialLoad) {
|
|
|
604
604
|
try {
|
|
605
605
|
const currentSubs = new Set(Array.isArray(info.activeSubscriptions) ? info.activeSubscriptions : []);
|
|
606
606
|
if (isInitialLoad && _isInitialLoadDone) return;
|
|
607
|
-
if (!isInitialLoad && _isInitialLoadDone &&
|
|
607
|
+
if (!isInitialLoad && _isInitialLoadDone && _connectedSDK) {
|
|
608
608
|
for (const subId of currentSubs) if (!_activeSubscriptions.has(subId)) {
|
|
609
609
|
if (config.onSubscriptionStart !== null) if (config.onSubscriptionStart) config.onSubscriptionStart(subId);
|
|
610
|
-
else
|
|
610
|
+
else _connectedSDK.track("subscription_start", {
|
|
611
611
|
product_id: subId,
|
|
612
612
|
source: "revenuecat"
|
|
613
613
|
});
|
|
@@ -615,7 +615,7 @@ function handleCustomerInfoUpdate(config, info, isInitialLoad) {
|
|
|
615
615
|
}
|
|
616
616
|
_activeSubscriptions = currentSubs;
|
|
617
617
|
_isInitialLoadDone = true;
|
|
618
|
-
if (
|
|
618
|
+
if (_connectedSDK) syncRevenueCatAttributes(_connectedSDK, info);
|
|
619
619
|
} catch {}
|
|
620
620
|
}
|
|
621
621
|
|
|
@@ -642,21 +642,21 @@ const BACKGROUND_FLUSH_MIN_INTERVAL_MINUTES = 15;
|
|
|
642
642
|
* will flush any queued events via the Layers SDK. It is safe to call even
|
|
643
643
|
* if the SDK is not initialized (it will silently no-op).
|
|
644
644
|
*
|
|
645
|
-
* @param
|
|
645
|
+
* @param getSDK - A getter that returns the current LayersReactNative
|
|
646
646
|
* instance, or `null` if the SDK is not yet initialized.
|
|
647
647
|
* @returns An async handler suitable for use with background task libraries.
|
|
648
648
|
*
|
|
649
649
|
* @example
|
|
650
650
|
* ```typescript
|
|
651
|
-
* const handler = createBackgroundFlushHandler(() =>
|
|
651
|
+
* const handler = createBackgroundFlushHandler(() => mySDKInstance);
|
|
652
652
|
* ```
|
|
653
653
|
*/
|
|
654
|
-
function createBackgroundFlushHandler(
|
|
654
|
+
function createBackgroundFlushHandler(getSDK) {
|
|
655
655
|
return async () => {
|
|
656
|
-
const
|
|
657
|
-
if (!
|
|
656
|
+
const sdk = getSDK();
|
|
657
|
+
if (!sdk) return { success: false };
|
|
658
658
|
try {
|
|
659
|
-
await
|
|
659
|
+
await sdk.flush();
|
|
660
660
|
return { success: true };
|
|
661
661
|
} catch {
|
|
662
662
|
return { success: false };
|
|
@@ -670,7 +670,7 @@ function createBackgroundFlushHandler(getLayers) {
|
|
|
670
670
|
* `expo-task-manager` requires tasks to be defined before the app mounts.
|
|
671
671
|
*
|
|
672
672
|
* @param taskManager - The `expo-task-manager` module (import * as TaskManager from 'expo-task-manager').
|
|
673
|
-
* @param
|
|
673
|
+
* @param getSDK - A getter that returns the current LayersReactNative
|
|
674
674
|
* instance, or `null` if the SDK is not yet initialized.
|
|
675
675
|
*
|
|
676
676
|
* @example
|
|
@@ -678,21 +678,236 @@ function createBackgroundFlushHandler(getLayers) {
|
|
|
678
678
|
* import * as TaskManager from 'expo-task-manager';
|
|
679
679
|
* import { registerExpoBackgroundFlush } from '@layers/expo';
|
|
680
680
|
*
|
|
681
|
-
* let
|
|
682
|
-
* registerExpoBackgroundFlush(TaskManager, () =>
|
|
681
|
+
* let sdk: LayersReactNative | null = null;
|
|
682
|
+
* registerExpoBackgroundFlush(TaskManager, () => sdk);
|
|
683
683
|
*
|
|
684
684
|
* // Later, in your app initialization:
|
|
685
|
-
*
|
|
685
|
+
* sdk = new LayersReactNative({ appId: '...', environment: 'production' });
|
|
686
686
|
* await layers.init();
|
|
687
687
|
* ```
|
|
688
688
|
*/
|
|
689
|
-
function registerExpoBackgroundFlush(taskManager,
|
|
690
|
-
const handler = createBackgroundFlushHandler(
|
|
689
|
+
function registerExpoBackgroundFlush(taskManager, getSDK) {
|
|
690
|
+
const handler = createBackgroundFlushHandler(getSDK);
|
|
691
691
|
taskManager.defineTask(BACKGROUND_FLUSH_TASK_NAME, async () => {
|
|
692
692
|
await handler();
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region src/navigation-tracking.ts
|
|
698
|
+
/**
|
|
699
|
+
* Build a stateful listener that emits `$screen_view` whenever the active
|
|
700
|
+
* route changes. The returned function should be passed to React
|
|
701
|
+
* Navigation's `onStateChange` prop or `navigationRef.addListener('state',
|
|
702
|
+
* cb)`. It returns nothing — the SDK records the event side-effecting.
|
|
703
|
+
*
|
|
704
|
+
* The listener:
|
|
705
|
+
* - resolves the deepest active route via `getActiveRouteName()`
|
|
706
|
+
* semantics so nested stack/tab navigators correctly report the
|
|
707
|
+
* leaf screen
|
|
708
|
+
* - de-dupes consecutive identical names (some RN versions emit the
|
|
709
|
+
* same state twice on re-renders)
|
|
710
|
+
* - attaches route params + previous screen on the screen event
|
|
711
|
+
*/
|
|
712
|
+
function createNavigationListener(sdk) {
|
|
713
|
+
let previousScreen = null;
|
|
714
|
+
return function onStateChange(state) {
|
|
715
|
+
if (!state) return;
|
|
716
|
+
const currentRoute = resolveActiveRoute(state);
|
|
717
|
+
if (!currentRoute) return;
|
|
718
|
+
if (currentRoute.name === previousScreen) return;
|
|
719
|
+
const properties = {
|
|
720
|
+
...currentRoute.params ?? {},
|
|
721
|
+
screen_name: currentRoute.name
|
|
722
|
+
};
|
|
723
|
+
if (previousScreen) properties.previous_screen_name = previousScreen;
|
|
724
|
+
try {
|
|
725
|
+
sdk.screen(currentRoute.name, properties);
|
|
726
|
+
if (sdk.enableDebug) console.log(`[Layers] $screen_view: ${currentRoute.name}`);
|
|
727
|
+
} catch {}
|
|
728
|
+
previousScreen = currentRoute.name;
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* React hook that subscribes to a React Navigation NavigationContainerRef
|
|
733
|
+
* and emits a `$screen_view` for each route change. Pass the SDK instance
|
|
734
|
+
* and the same `navigationRef` you give to `<NavigationContainer ref={...}>`.
|
|
735
|
+
*
|
|
736
|
+
* ```tsx
|
|
737
|
+
* import { createNavigationContainerRef } from '@react-navigation/native';
|
|
738
|
+
* const navigationRef = createNavigationContainerRef();
|
|
739
|
+
*
|
|
740
|
+
* function Root() {
|
|
741
|
+
* useLayersNavigationTracking(layers, navigationRef);
|
|
742
|
+
* return <NavigationContainer ref={navigationRef}>...</NavigationContainer>;
|
|
743
|
+
* }
|
|
744
|
+
* ```
|
|
745
|
+
*
|
|
746
|
+
* The hook is implemented via a lazy `require('react')` so it only fails
|
|
747
|
+
* if React itself is unavailable — consumers without React Navigation can
|
|
748
|
+
* still call it and it will silently no-op.
|
|
749
|
+
*/
|
|
750
|
+
function useLayersNavigationTracking(sdk, navigationRef) {
|
|
751
|
+
let useEffect = null;
|
|
752
|
+
try {
|
|
753
|
+
useEffect = require("react").useEffect;
|
|
754
|
+
} catch {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (!useEffect) return;
|
|
758
|
+
useEffect(() => {
|
|
759
|
+
if (!navigationRef?.addListener) return void 0;
|
|
760
|
+
const listener = createNavigationListener(sdk);
|
|
761
|
+
const unsubscribe = navigationRef.addListener("state", (event) => {
|
|
762
|
+
listener((event?.data)?.state ?? event);
|
|
763
|
+
});
|
|
764
|
+
return () => {
|
|
765
|
+
try {
|
|
766
|
+
if (typeof unsubscribe === "function") unsubscribe();
|
|
767
|
+
} catch {}
|
|
768
|
+
};
|
|
769
|
+
}, [sdk, navigationRef]);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Walk a NavigationState tree and return the active leaf route. Mirrors
|
|
773
|
+
* React Navigation's own `getActiveRouteName()` helper without taking a
|
|
774
|
+
* peer-dep on `@react-navigation/native`.
|
|
775
|
+
*
|
|
776
|
+
* Exported for testing.
|
|
777
|
+
* @internal
|
|
778
|
+
*/
|
|
779
|
+
function resolveActiveRoute(state) {
|
|
780
|
+
if (!state || !Array.isArray(state.routes) || state.routes.length === 0) return null;
|
|
781
|
+
const idx = typeof state.index === "number" ? state.index : state.routes.length - 1;
|
|
782
|
+
const route = state.routes[idx];
|
|
783
|
+
if (!route) return null;
|
|
784
|
+
if (route.state) {
|
|
785
|
+
const inner = resolveActiveRoute(route.state);
|
|
786
|
+
if (inner) return inner;
|
|
787
|
+
}
|
|
788
|
+
return {
|
|
789
|
+
name: route.name,
|
|
790
|
+
...route.params != null && { params: route.params }
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region src/surveys.ts
|
|
796
|
+
const SHOW_HISTORY_STORAGE_KEY = "layers:surveys:show-history";
|
|
797
|
+
/**
|
|
798
|
+
* Public surveys API exposed via `LayersReactNative.surveys`.
|
|
799
|
+
*
|
|
800
|
+
* Render the actual chrome by mounting `<LayersSurveyModal />` from
|
|
801
|
+
* `@layers/react-native/surveys-component` somewhere in your app tree
|
|
802
|
+
* and binding it to the eligible survey via `surveys.getActive()`.
|
|
803
|
+
*/
|
|
804
|
+
var SurveysModule = class {
|
|
805
|
+
hydrated = false;
|
|
806
|
+
listeners = /* @__PURE__ */ new Set();
|
|
807
|
+
constructor(core, options = {}) {
|
|
808
|
+
this.core = core;
|
|
809
|
+
this.options = options;
|
|
810
|
+
if (this.options.persistence) this.hydrate();
|
|
811
|
+
else this.hydrated = true;
|
|
812
|
+
}
|
|
813
|
+
get enabled() {
|
|
814
|
+
return this.options.enabled !== false;
|
|
815
|
+
}
|
|
816
|
+
knownIds() {
|
|
817
|
+
return this.core.knownSurveyIds();
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Return surveys currently eligible to show. Builds the targeting context
|
|
821
|
+
* from caller-supplied person properties + feature flag values. URL
|
|
822
|
+
* targeting is web-only so it's omitted.
|
|
823
|
+
*/
|
|
824
|
+
getActive() {
|
|
825
|
+
if (!this.enabled) return [];
|
|
826
|
+
return this.core.getActiveSurveys(this.buildContext());
|
|
827
|
+
}
|
|
828
|
+
/** Mark a survey as shown — emits `survey shown` auto-event. */
|
|
829
|
+
markShown(surveyId) {
|
|
830
|
+
this.core.markSurveyShown(surveyId);
|
|
831
|
+
this.persistShowHistory();
|
|
832
|
+
this.notify();
|
|
833
|
+
}
|
|
834
|
+
/** Mark a survey as dismissed — emits `survey dismissed` auto-event. */
|
|
835
|
+
markDismissed(surveyId) {
|
|
836
|
+
this.core.markSurveyDismissed(surveyId);
|
|
837
|
+
this.notify();
|
|
838
|
+
}
|
|
839
|
+
/** Submit a survey response — emits `survey sent` auto-event. */
|
|
840
|
+
submit(surveyId, response) {
|
|
841
|
+
this.core.submitSurveyResponse(surveyId, response);
|
|
842
|
+
this.notify();
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Subscribe to changes in the eligible-surveys list. The callback fires
|
|
846
|
+
* after every show/dismiss/submit and after the show-history is hydrated
|
|
847
|
+
* from persistence on init.
|
|
848
|
+
*/
|
|
849
|
+
subscribe(listener) {
|
|
850
|
+
this.listeners.add(listener);
|
|
851
|
+
try {
|
|
852
|
+
listener(this.getActive());
|
|
853
|
+
} catch {}
|
|
854
|
+
return () => {
|
|
855
|
+
this.listeners.delete(listener);
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
configure(patch) {
|
|
859
|
+
Object.assign(this.options, patch);
|
|
860
|
+
this.notify();
|
|
861
|
+
}
|
|
862
|
+
buildContext() {
|
|
863
|
+
const featureFlagValues = {};
|
|
864
|
+
const resolver = this.options.resolveFeatureFlag;
|
|
865
|
+
if (resolver) for (const def of this.allDefinitions()) {
|
|
866
|
+
const flag = def?.targeting?.feature_flag;
|
|
867
|
+
if (flag) {
|
|
868
|
+
const v = resolver(flag);
|
|
869
|
+
if (typeof v === "boolean") featureFlagValues[flag] = v;
|
|
870
|
+
else if (typeof v === "string") featureFlagValues[flag] = v.length > 0 && v !== "false";
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return {
|
|
874
|
+
person_properties: this.options.personProperties ?? {},
|
|
875
|
+
feature_flag_values: featureFlagValues
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
allDefinitions() {
|
|
879
|
+
try {
|
|
880
|
+
return JSON.parse(this.core.surveyDefinitionsJson());
|
|
881
|
+
} catch {
|
|
882
|
+
return [];
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
async hydrate() {
|
|
886
|
+
if (this.hydrated) return;
|
|
887
|
+
try {
|
|
888
|
+
const raw = await this.options.persistence?.read(SHOW_HISTORY_STORAGE_KEY);
|
|
889
|
+
if (raw) this.core.seedSurveyShowHistory(raw);
|
|
890
|
+
} catch {} finally {
|
|
891
|
+
this.hydrated = true;
|
|
892
|
+
this.notify();
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
async persistShowHistory() {
|
|
896
|
+
if (!this.options.persistence) return;
|
|
897
|
+
try {
|
|
898
|
+
const json = this.core.surveyShowHistoryJson();
|
|
899
|
+
await this.options.persistence.write(SHOW_HISTORY_STORAGE_KEY, json);
|
|
900
|
+
} catch {}
|
|
901
|
+
}
|
|
902
|
+
notify() {
|
|
903
|
+
if (this.listeners.size === 0) return;
|
|
904
|
+
const actives = this.getActive();
|
|
905
|
+
for (const l of this.listeners) try {
|
|
906
|
+
l(actives);
|
|
907
|
+
} catch {}
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
|
|
696
911
|
//#endregion
|
|
697
912
|
//#region src/index.ts
|
|
698
913
|
const SDK_VERSION = typeof __LAYERS_RN_VERSION__ !== "undefined" ? __LAYERS_RN_VERSION__ : "0.1.0";
|
|
@@ -716,6 +931,7 @@ var LayersReactNative = class LayersReactNative {
|
|
|
716
931
|
static CONFIG_POLL_INTERVAL_MS = 3e5;
|
|
717
932
|
_adServicesToken = null;
|
|
718
933
|
_installReferrer = null;
|
|
934
|
+
_installReferrerParams = null;
|
|
719
935
|
_hadPriorSdkState = false;
|
|
720
936
|
_attributionDeeplinkId = null;
|
|
721
937
|
_attributionGclid = null;
|
|
@@ -744,7 +960,8 @@ var LayersReactNative = class LayersReactNative {
|
|
|
744
960
|
...config.flushIntervalMs != null && { flushIntervalMs: config.flushIntervalMs },
|
|
745
961
|
...config.flushThreshold != null && { flushThreshold: config.flushThreshold },
|
|
746
962
|
...config.maxQueueSize != null && { maxQueueSize: config.maxQueueSize },
|
|
747
|
-
sdkVersion: `react-native/${SDK_VERSION}
|
|
963
|
+
sdkVersion: `react-native/${SDK_VERSION}`,
|
|
964
|
+
...config.bootstrap != null && { bootstrap: config.bootstrap }
|
|
748
965
|
},
|
|
749
966
|
httpClient,
|
|
750
967
|
persistence: new __layers_core_wasm.MemoryPersistence()
|
|
@@ -766,21 +983,23 @@ var LayersReactNative = class LayersReactNative {
|
|
|
766
983
|
environment: this.config.environment,
|
|
767
984
|
...this.config.baseUrl != null && { baseUrl: this.config.baseUrl },
|
|
768
985
|
...this.config.enableDebug != null && { enableDebug: this.config.enableDebug },
|
|
986
|
+
...this.config.debug != null && { debug: this.config.debug },
|
|
769
987
|
...this.config.flushIntervalMs != null && { flushIntervalMs: this.config.flushIntervalMs },
|
|
770
988
|
...this.config.flushThreshold != null && { flushThreshold: this.config.flushThreshold },
|
|
771
989
|
...this.config.maxQueueSize != null && { maxQueueSize: this.config.maxQueueSize },
|
|
772
|
-
sdkVersion: `react-native/${SDK_VERSION}
|
|
990
|
+
sdkVersion: `react-native/${SDK_VERSION}`,
|
|
991
|
+
...this.config.bootstrap != null && { bootstrap: this.config.bootstrap }
|
|
773
992
|
},
|
|
774
993
|
httpClient,
|
|
775
994
|
persistence
|
|
776
995
|
});
|
|
777
996
|
if (this.appUserId) this.core.identify(this.appUserId);
|
|
778
997
|
} catch {}
|
|
998
|
+
await this.restoreAttributionData();
|
|
779
999
|
await this.initializeDeviceInfo();
|
|
780
1000
|
this.setupAppStateListener();
|
|
781
1001
|
this.setupNetInfoListener();
|
|
782
1002
|
const mainThreadDurationMs = Date.now() - initStartTime;
|
|
783
|
-
await this.restoreAttributionData();
|
|
784
1003
|
await this.core.fetchRemoteConfig().catch(() => {});
|
|
785
1004
|
await this.configureSkanFromRemoteConfig();
|
|
786
1005
|
this.startConfigPolling();
|
|
@@ -807,6 +1026,10 @@ var LayersReactNative = class LayersReactNative {
|
|
|
807
1026
|
} catch {}
|
|
808
1027
|
const isFirstLaunch = await shouldTreatAsNewInstall(isFirstLaunchByFlag, this._hadPriorSdkState, this.enableDebug);
|
|
809
1028
|
appOpenProps.is_first_launch = isFirstLaunch;
|
|
1029
|
+
let hasAttribution = this._attributionFbclid != null || this._attributionGclid != null || this._attributionTtclid != null || this._attributionMsclkid != null;
|
|
1030
|
+
if (isFirstLaunch && !hasAttribution) try {
|
|
1031
|
+
await this.resolveClickFromFingerprint();
|
|
1032
|
+
} catch {}
|
|
810
1033
|
if (isFirstLaunch) try {
|
|
811
1034
|
const AsyncStorage = await loadAsyncStorage();
|
|
812
1035
|
if (AsyncStorage) await AsyncStorage.setItem(FIRST_LAUNCH_TRACKED_KEY, "true");
|
|
@@ -821,8 +1044,25 @@ var LayersReactNative = class LayersReactNative {
|
|
|
821
1044
|
if (this._installReferrer.referrerClickTimestamp) appOpenProps.install_referrer_click_timestamp = this._installReferrer.referrerClickTimestamp;
|
|
822
1045
|
if (this._installReferrer.installBeginTimestamp) appOpenProps.install_referrer_install_timestamp = this._installReferrer.installBeginTimestamp;
|
|
823
1046
|
}
|
|
1047
|
+
if (this._installReferrerParams) {
|
|
1048
|
+
for (const [key, value] of Object.entries(this._installReferrerParams)) if (appOpenProps[key] === void 0) appOpenProps[key] = value;
|
|
1049
|
+
}
|
|
824
1050
|
if (isFirstLaunch) this.track("app_install", appOpenProps);
|
|
825
1051
|
this.track("app_open", appOpenProps);
|
|
1052
|
+
if (this.config.autoTrackAppUpdate !== false) try {
|
|
1053
|
+
const currentVersion = this.core.getDeviceContext().appVersion ?? appOpenProps.app_version;
|
|
1054
|
+
if (currentVersion && typeof currentVersion === "string") {
|
|
1055
|
+
const AsyncStorage = await loadAsyncStorage();
|
|
1056
|
+
if (AsyncStorage) {
|
|
1057
|
+
const previousVersion = await AsyncStorage.getItem(LAST_APP_VERSION_KEY);
|
|
1058
|
+
if (previousVersion && previousVersion !== currentVersion) this.track("$app_update", {
|
|
1059
|
+
previous_version: previousVersion,
|
|
1060
|
+
current_version: currentVersion
|
|
1061
|
+
});
|
|
1062
|
+
await AsyncStorage.setItem(LAST_APP_VERSION_KEY, currentVersion);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
} catch {}
|
|
826
1066
|
}
|
|
827
1067
|
if (this.config.autoTrackDeepLinks !== false) this.setupDeepLinkAutoTracking();
|
|
828
1068
|
this._isInitialized = true;
|
|
@@ -872,6 +1112,193 @@ var LayersReactNative = class LayersReactNative {
|
|
|
872
1112
|
async setConsent(consent) {
|
|
873
1113
|
this.core.setConsent(consent);
|
|
874
1114
|
}
|
|
1115
|
+
/** Evaluate a feature flag. Emits `$feature_flag_called` (deduped per session). */
|
|
1116
|
+
getFeatureFlag(flagKey) {
|
|
1117
|
+
return this.core.getFeatureFlag(flagKey);
|
|
1118
|
+
}
|
|
1119
|
+
/** Convenience: returns true iff `getFeatureFlag(flagKey)` is truthy. */
|
|
1120
|
+
isFeatureEnabled(flagKey) {
|
|
1121
|
+
return this.core.isFeatureEnabled(flagKey);
|
|
1122
|
+
}
|
|
1123
|
+
/** Look up the JSON payload attached to a flag. Does NOT emit exposure events. */
|
|
1124
|
+
getFeatureFlagPayload(flagKey) {
|
|
1125
|
+
return this.core.getFeatureFlagPayload(flagKey);
|
|
1126
|
+
}
|
|
1127
|
+
/** Snapshot every accessible flag's current value. */
|
|
1128
|
+
getAllFlags() {
|
|
1129
|
+
return this.core.getAllFlags();
|
|
1130
|
+
}
|
|
1131
|
+
/** Force a /config refresh and re-fire any registered listeners. */
|
|
1132
|
+
async reloadFeatureFlags() {
|
|
1133
|
+
return this.core.reloadFeatureFlags();
|
|
1134
|
+
}
|
|
1135
|
+
/** Override person properties used for flag evaluation only. */
|
|
1136
|
+
setPersonPropertiesForFlags(properties) {
|
|
1137
|
+
try {
|
|
1138
|
+
this.core.setPersonPropertiesForFlags(properties);
|
|
1139
|
+
} catch (e) {
|
|
1140
|
+
this.emitError(e);
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
/** Merge additional person properties into the flag-evaluation map. */
|
|
1144
|
+
mergePersonPropertiesForFlags(properties) {
|
|
1145
|
+
try {
|
|
1146
|
+
this.core.mergePersonPropertiesForFlags(properties);
|
|
1147
|
+
} catch (e) {
|
|
1148
|
+
this.emitError(e);
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
/** Subscribe to feature-flag refreshes. Returns an unsubscribe function. */
|
|
1152
|
+
onFeatureFlags(callback) {
|
|
1153
|
+
return this.core.onFeatureFlags(callback);
|
|
1154
|
+
}
|
|
1155
|
+
/** Seed bootstrap flag values + payloads after init. */
|
|
1156
|
+
setFeatureFlagBootstrap(bootstrap) {
|
|
1157
|
+
this.core.setFeatureFlagBootstrap(bootstrap);
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Register one or more super-properties — auto-merged into every track /
|
|
1161
|
+
* screen call until cleared. Super-properties carry app-wide context
|
|
1162
|
+
* (plan tier, region, experiment bucket).
|
|
1163
|
+
*/
|
|
1164
|
+
setSuperProperties(properties) {
|
|
1165
|
+
try {
|
|
1166
|
+
this.core.setSuperProperties(properties);
|
|
1167
|
+
} catch (e) {
|
|
1168
|
+
this.emitError(e);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
/** Register super-properties only if their keys have not been set before. */
|
|
1172
|
+
setSuperPropertiesOnce(properties) {
|
|
1173
|
+
try {
|
|
1174
|
+
this.core.setSuperPropertiesOnce(properties);
|
|
1175
|
+
} catch (e) {
|
|
1176
|
+
this.emitError(e);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
/** Remove a single super-property by key. */
|
|
1180
|
+
unregisterSuperProperty(key) {
|
|
1181
|
+
try {
|
|
1182
|
+
this.core.unregisterSuperProperty(key);
|
|
1183
|
+
} catch (e) {
|
|
1184
|
+
this.emitError(e);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
/** Clear all registered super-properties. */
|
|
1188
|
+
clearSuperProperties() {
|
|
1189
|
+
try {
|
|
1190
|
+
this.core.clearSuperProperties();
|
|
1191
|
+
} catch (e) {
|
|
1192
|
+
this.emitError(e);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
/** Snapshot the currently-registered super-properties. */
|
|
1196
|
+
getSuperProperties() {
|
|
1197
|
+
return this.core.getSuperProperties();
|
|
1198
|
+
}
|
|
1199
|
+
/** Start a duration timer for the next `track(name)` call. */
|
|
1200
|
+
timeEvent(eventName) {
|
|
1201
|
+
try {
|
|
1202
|
+
this.core.timeEvent(eventName);
|
|
1203
|
+
} catch (e) {
|
|
1204
|
+
this.emitError(e);
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
/** Cancel a timed event without emitting it. Returns elapsed ms (0 if none). */
|
|
1208
|
+
cancelTimedEvent(eventName) {
|
|
1209
|
+
try {
|
|
1210
|
+
return this.core.cancelTimedEvent(eventName);
|
|
1211
|
+
} catch (e) {
|
|
1212
|
+
this.emitError(e);
|
|
1213
|
+
return 0;
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
/** Set membership for a single group_type. Empty `groupId` removes the type. */
|
|
1217
|
+
setGroup(groupType, groupId) {
|
|
1218
|
+
try {
|
|
1219
|
+
this.core.setGroup(groupType, groupId);
|
|
1220
|
+
} catch (e) {
|
|
1221
|
+
this.emitError(e);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
/** Add a group membership without overwriting other types (alias for setGroup). */
|
|
1225
|
+
addGroup(groupType, groupId) {
|
|
1226
|
+
try {
|
|
1227
|
+
this.core.addGroup(groupType, groupId);
|
|
1228
|
+
} catch (e) {
|
|
1229
|
+
this.emitError(e);
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
/** Remove a group_type from the membership map. */
|
|
1233
|
+
removeGroup(groupType) {
|
|
1234
|
+
try {
|
|
1235
|
+
this.core.removeGroup(groupType);
|
|
1236
|
+
} catch (e) {
|
|
1237
|
+
this.emitError(e);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
/** Snapshot the current $groups membership map. */
|
|
1241
|
+
getGroups() {
|
|
1242
|
+
return this.core.getGroups();
|
|
1243
|
+
}
|
|
1244
|
+
/** Increment a numeric user property by `delta`. */
|
|
1245
|
+
increment(key, delta = 1) {
|
|
1246
|
+
try {
|
|
1247
|
+
this.core.increment(key, delta);
|
|
1248
|
+
} catch (e) {
|
|
1249
|
+
this.emitError(e);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
/** Append a single value to a list-typed user property. */
|
|
1253
|
+
append(key, value) {
|
|
1254
|
+
try {
|
|
1255
|
+
this.core.append(key, value);
|
|
1256
|
+
} catch (e) {
|
|
1257
|
+
this.emitError(e);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
/** Union (set-add) values into a list-typed user property. */
|
|
1261
|
+
union(key, values) {
|
|
1262
|
+
try {
|
|
1263
|
+
this.core.union(key, values);
|
|
1264
|
+
} catch (e) {
|
|
1265
|
+
this.emitError(e);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
/** Remove a user property by key. */
|
|
1269
|
+
unset(key) {
|
|
1270
|
+
try {
|
|
1271
|
+
this.core.unset(key);
|
|
1272
|
+
} catch (e) {
|
|
1273
|
+
this.emitError(e);
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
/** Returns the current anonymous ID, rotated on `reset()`. */
|
|
1277
|
+
getAnonymousId() {
|
|
1278
|
+
return this.core.getAnonymousId();
|
|
1279
|
+
}
|
|
1280
|
+
/** Returns the current device ID (stable per install, rotated on `reset()`). */
|
|
1281
|
+
getDeviceId() {
|
|
1282
|
+
return this.core.getDeviceId();
|
|
1283
|
+
}
|
|
1284
|
+
/** Returns the monotonically-increasing session number. */
|
|
1285
|
+
getSessionNumber() {
|
|
1286
|
+
return this.core.getSessionNumber();
|
|
1287
|
+
}
|
|
1288
|
+
/** Returns the SDK first-open RFC3339 timestamp, or null. */
|
|
1289
|
+
getFirstOpenTime() {
|
|
1290
|
+
return this.core.getFirstOpenTime();
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Register a synchronous filter callback called for every track / screen
|
|
1294
|
+
* before the event reaches the queue. Return `null` to drop, or a modified
|
|
1295
|
+
* `BeforeSendEvent` to forward.
|
|
1296
|
+
*
|
|
1297
|
+
* Pass `null` to clear the hook.
|
|
1298
|
+
*/
|
|
1299
|
+
setBeforeSend(hook) {
|
|
1300
|
+
this.core.setBeforeSend(hook);
|
|
1301
|
+
}
|
|
875
1302
|
/**
|
|
876
1303
|
* Request App Tracking Transparency authorization (iOS only).
|
|
877
1304
|
* After the user responds, this method automatically:
|
|
@@ -930,24 +1357,19 @@ var LayersReactNative = class LayersReactNative {
|
|
|
930
1357
|
this.userIdLocked = false;
|
|
931
1358
|
}
|
|
932
1359
|
/**
|
|
933
|
-
* Reset the SDK state: clears the user ID, unlocks set-user-once,
|
|
934
|
-
*
|
|
1360
|
+
* Reset the SDK state: clears the user ID, unlocks set-user-once, drops
|
|
1361
|
+
* super-properties + multi-group memberships, rotates device / anonymous
|
|
1362
|
+
* IDs, and starts a new session.
|
|
935
1363
|
*
|
|
936
|
-
* After reset(), the SDK behaves as if no user has been identified.
|
|
937
|
-
*
|
|
938
|
-
* will not carry the previous user's identity.
|
|
1364
|
+
* After reset(), the SDK behaves as if no user has been identified. Events
|
|
1365
|
+
* tracked after reset() will not carry the previous user's identity.
|
|
939
1366
|
*/
|
|
940
1367
|
reset() {
|
|
941
1368
|
if (this.enableDebug) console.log("[Layers] reset()");
|
|
942
1369
|
this.appUserId = void 0;
|
|
943
1370
|
this.userIdLocked = false;
|
|
944
1371
|
try {
|
|
945
|
-
this.core.
|
|
946
|
-
} catch (e) {
|
|
947
|
-
this.emitError(e);
|
|
948
|
-
}
|
|
949
|
-
try {
|
|
950
|
-
this.core.startNewSession();
|
|
1372
|
+
this.core.reset();
|
|
951
1373
|
} catch (e) {
|
|
952
1374
|
this.emitError(e);
|
|
953
1375
|
}
|
|
@@ -1075,6 +1497,17 @@ var LayersReactNative = class LayersReactNative {
|
|
|
1075
1497
|
getQueueDepth() {
|
|
1076
1498
|
return this.core.queueDepth();
|
|
1077
1499
|
}
|
|
1500
|
+
/**
|
|
1501
|
+
* Return the per-device DebugView token, or null if `debug` was not enabled
|
|
1502
|
+
* in the constructor config.
|
|
1503
|
+
*
|
|
1504
|
+
* When debug mode is on the SDK persists a stable UUID via AsyncStorage
|
|
1505
|
+
* and sends it in the `X-Debug-Token` header on every event upload. This
|
|
1506
|
+
* lets dashboard UIs filter the live tail to events from this device only.
|
|
1507
|
+
*/
|
|
1508
|
+
getDebugToken() {
|
|
1509
|
+
return this.core.getDebugToken();
|
|
1510
|
+
}
|
|
1078
1511
|
/** Current device context from the core. */
|
|
1079
1512
|
getDeviceContext() {
|
|
1080
1513
|
return this.core.getDeviceContext();
|
|
@@ -1095,6 +1528,72 @@ var LayersReactNative = class LayersReactNative {
|
|
|
1095
1528
|
return this._recentEvents;
|
|
1096
1529
|
}
|
|
1097
1530
|
/**
|
|
1531
|
+
* POST a device fingerprint to /clicks/resolve so the server can match this
|
|
1532
|
+
* first-launch install to a recent /c/:appId click captured in the browser
|
|
1533
|
+
* before the App Store / Play Store redirect. On a successful match, persist
|
|
1534
|
+
* the returned click IDs via setAttributionData so every subsequent event
|
|
1535
|
+
* (app_open, purchase_success, etc.) carries fbclid / gclid / ttclid / etc.
|
|
1536
|
+
*
|
|
1537
|
+
* This is the primary iOS web-to-app attribution path, since iOS has no
|
|
1538
|
+
* equivalent of Android's Play Install Referrer. Also serves as a fallback
|
|
1539
|
+
* for Android installs where the Install Referrer API returned nothing
|
|
1540
|
+
* (sideload, Amazon Appstore, testing).
|
|
1541
|
+
*
|
|
1542
|
+
* Best-effort: all errors are swallowed — this must never block app_open.
|
|
1543
|
+
*/
|
|
1544
|
+
async resolveClickFromFingerprint() {
|
|
1545
|
+
const baseUrl = (this.config.baseUrl ?? "https://in.layers.com").replace(/\/$/, "");
|
|
1546
|
+
const deviceContext = this.core.getDeviceContext();
|
|
1547
|
+
let platform;
|
|
1548
|
+
try {
|
|
1549
|
+
const { Platform } = require("react-native");
|
|
1550
|
+
platform = Platform.OS;
|
|
1551
|
+
} catch {
|
|
1552
|
+
platform = void 0;
|
|
1553
|
+
}
|
|
1554
|
+
const fingerprint = {
|
|
1555
|
+
app_id: this.config.appId,
|
|
1556
|
+
platform,
|
|
1557
|
+
device_model: deviceContext.deviceModel ?? null,
|
|
1558
|
+
os_version: deviceContext.osVersion ?? null,
|
|
1559
|
+
locale: deviceContext.locale ?? null,
|
|
1560
|
+
timezone: deviceContext.timezone ?? null,
|
|
1561
|
+
screen_size: deviceContext.screenSize ?? null
|
|
1562
|
+
};
|
|
1563
|
+
const controller = new AbortController();
|
|
1564
|
+
const timeoutId = setTimeout(() => controller.abort(), 3e3);
|
|
1565
|
+
let response;
|
|
1566
|
+
try {
|
|
1567
|
+
response = await fetch(`${baseUrl}/clicks/resolve`, {
|
|
1568
|
+
method: "POST",
|
|
1569
|
+
headers: {
|
|
1570
|
+
"Content-Type": "application/json",
|
|
1571
|
+
"X-App-Id": this.config.appId,
|
|
1572
|
+
"X-SDK-Version": `react-native/${SDK_VERSION}`
|
|
1573
|
+
},
|
|
1574
|
+
body: JSON.stringify(fingerprint),
|
|
1575
|
+
signal: controller.signal
|
|
1576
|
+
});
|
|
1577
|
+
} finally {
|
|
1578
|
+
clearTimeout(timeoutId);
|
|
1579
|
+
}
|
|
1580
|
+
if (!response.ok) {
|
|
1581
|
+
if (this.enableDebug) console.log(`[Layers] /clicks/resolve status=${response.status}`);
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
const body = await response.json();
|
|
1585
|
+
if (!body?.success || !body.data?.matched) {
|
|
1586
|
+
if (this.enableDebug) console.log("[Layers] /clicks/resolve no-match");
|
|
1587
|
+
return;
|
|
1588
|
+
}
|
|
1589
|
+
const { fbclid, gclid, ttclid, msclkid, method, confidence } = body.data;
|
|
1590
|
+
if (!fbclid && !gclid && !ttclid && !msclkid) return;
|
|
1591
|
+
try {
|
|
1592
|
+
await this.setAttributionData(this._attributionDeeplinkId, gclid ?? this._attributionGclid, fbclid ?? this._attributionFbclid, ttclid ?? this._attributionTtclid, msclkid ?? this._attributionMsclkid);
|
|
1593
|
+
if (this.enableDebug) console.log(`[Layers] /clicks/resolve matched method=${String(method)} confidence=${String(confidence)} fbclid=${String(fbclid)}`);
|
|
1594
|
+
} catch {}
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1098
1597
|
* Fire-and-forget POST to /users/properties.
|
|
1099
1598
|
* Best-effort: errors are silently swallowed.
|
|
1100
1599
|
*/
|
|
@@ -1378,6 +1877,7 @@ var LayersReactNative = class LayersReactNative {
|
|
|
1378
1877
|
} catch {}
|
|
1379
1878
|
this.core.setDeviceContext(context);
|
|
1380
1879
|
}
|
|
1880
|
+
this._installReferrerParams = null;
|
|
1381
1881
|
try {
|
|
1382
1882
|
const { Platform } = require("react-native");
|
|
1383
1883
|
if (Platform.OS === "ios") try {
|
|
@@ -1386,16 +1886,37 @@ var LayersReactNative = class LayersReactNative {
|
|
|
1386
1886
|
} catch {}
|
|
1387
1887
|
if (Platform.OS === "android") try {
|
|
1388
1888
|
const referrer = await getInstallReferrer();
|
|
1389
|
-
if (referrer)
|
|
1889
|
+
if (referrer) {
|
|
1890
|
+
this._installReferrer = referrer;
|
|
1891
|
+
const parsed = parseInstallReferrerUrl(referrer.referrerUrl);
|
|
1892
|
+
this._installReferrerParams = Object.keys(parsed).length > 0 ? parsed : null;
|
|
1893
|
+
if (parsed.fbclid || parsed.gclid || parsed.ttclid || parsed.msclkid) try {
|
|
1894
|
+
await this.setAttributionData(this._attributionDeeplinkId, parsed.gclid ?? this._attributionGclid, parsed.fbclid ?? this._attributionFbclid, parsed.ttclid ?? this._attributionTtclid, parsed.msclkid ?? this._attributionMsclkid);
|
|
1895
|
+
} catch {}
|
|
1896
|
+
}
|
|
1390
1897
|
} catch {}
|
|
1391
1898
|
} catch {}
|
|
1392
1899
|
}
|
|
1393
1900
|
setupAppStateListener() {
|
|
1394
1901
|
try {
|
|
1395
1902
|
const { AppState } = require("react-native");
|
|
1903
|
+
let lastEmittedState = null;
|
|
1396
1904
|
this.appStateSubscription = AppState.addEventListener("change", (nextAppState) => {
|
|
1397
|
-
if (nextAppState === "background" || nextAppState === "inactive")
|
|
1398
|
-
|
|
1905
|
+
if (nextAppState === "background" || nextAppState === "inactive") {
|
|
1906
|
+
if (this.config.autoTrackAppLifecycle !== false && lastEmittedState !== "background") try {
|
|
1907
|
+
this.track("$app_background");
|
|
1908
|
+
lastEmittedState = "background";
|
|
1909
|
+
} catch {}
|
|
1910
|
+
this.core.flush();
|
|
1911
|
+
}
|
|
1912
|
+
if (nextAppState === "active") {
|
|
1913
|
+
if (this.config.autoTrackAppLifecycle !== false && lastEmittedState !== null && lastEmittedState !== "active") try {
|
|
1914
|
+
this.track("$app_foreground");
|
|
1915
|
+
lastEmittedState = "active";
|
|
1916
|
+
} catch {}
|
|
1917
|
+
else if (lastEmittedState === null) lastEmittedState = "active";
|
|
1918
|
+
if (this.isOnline) this.core.flushAsync().catch(() => {});
|
|
1919
|
+
}
|
|
1399
1920
|
});
|
|
1400
1921
|
} catch {}
|
|
1401
1922
|
}
|
|
@@ -1463,9 +1984,9 @@ async function createAsyncStoragePersistence(appId) {
|
|
|
1463
1984
|
try {
|
|
1464
1985
|
const AsyncStorage = await loadAsyncStorage();
|
|
1465
1986
|
if (AsyncStorage) {
|
|
1466
|
-
const
|
|
1467
|
-
if (
|
|
1468
|
-
const pairs = await AsyncStorage.multiGet(
|
|
1987
|
+
const sdkKeys = (await AsyncStorage.getAllKeys()).filter((k) => k.startsWith(prefix));
|
|
1988
|
+
if (sdkKeys.length > 0) {
|
|
1989
|
+
const pairs = await AsyncStorage.multiGet(sdkKeys);
|
|
1469
1990
|
for (const [key, value] of pairs) if (value) {
|
|
1470
1991
|
const shortKey = key.slice(prefix.length);
|
|
1471
1992
|
memoryStore.set(shortKey, base64Decode(value));
|
|
@@ -1572,6 +2093,11 @@ function getLocale() {
|
|
|
1572
2093
|
const INSTALL_ID_KEY = "layers_install_id";
|
|
1573
2094
|
const FIRST_LAUNCH_TRACKED_KEY = "@layers/first_launch_tracked";
|
|
1574
2095
|
/**
|
|
2096
|
+
* Last-known app_version persisted across launches. Used to detect
|
|
2097
|
+
* `$app_update` (version increment) vs. `$first_open` (no prior value).
|
|
2098
|
+
*/
|
|
2099
|
+
const LAST_APP_VERSION_KEY = "@layers/last_app_version";
|
|
2100
|
+
/**
|
|
1575
2101
|
* Maximum age of an app installation (in milliseconds) for which the SDK
|
|
1576
2102
|
* will consider the first launch as a genuine new install. If the app was
|
|
1577
2103
|
* installed more than 24 hours ago AND no prior Layers SDK state exists,
|
|
@@ -1750,6 +2276,54 @@ async function getAdServicesToken() {
|
|
|
1750
2276
|
}
|
|
1751
2277
|
}
|
|
1752
2278
|
/**
|
|
2279
|
+
* Known attribution params extracted from the Play Install Referrer string.
|
|
2280
|
+
* Keep in sync with layers sdk-ingest routes/click.ts::buildAndroidReferrerUrl
|
|
2281
|
+
* and the parallel allowlists in kotlin / unity / flutter SDKs.
|
|
2282
|
+
*/
|
|
2283
|
+
const INSTALL_REFERRER_ATTRIBUTION_PARAMS = new Set([
|
|
2284
|
+
"utm_source",
|
|
2285
|
+
"utm_medium",
|
|
2286
|
+
"utm_campaign",
|
|
2287
|
+
"utm_content",
|
|
2288
|
+
"utm_term",
|
|
2289
|
+
"gclid",
|
|
2290
|
+
"gbraid",
|
|
2291
|
+
"wbraid",
|
|
2292
|
+
"fbclid",
|
|
2293
|
+
"ttclid",
|
|
2294
|
+
"twclid",
|
|
2295
|
+
"msclkid",
|
|
2296
|
+
"li_fat_id",
|
|
2297
|
+
"sclid",
|
|
2298
|
+
"rclid",
|
|
2299
|
+
"irclickid",
|
|
2300
|
+
"click_id"
|
|
2301
|
+
]);
|
|
2302
|
+
/**
|
|
2303
|
+
* Parse a raw Play Install Referrer string into a map of recognized attribution
|
|
2304
|
+
* params. Accepts either a bare query string (`a=1&b=2`) or a full URL.
|
|
2305
|
+
* Returns an empty object on parse failure.
|
|
2306
|
+
*/
|
|
2307
|
+
function parseInstallReferrerUrl(referrer) {
|
|
2308
|
+
const out = {};
|
|
2309
|
+
if (!referrer) return out;
|
|
2310
|
+
try {
|
|
2311
|
+
let qs = referrer;
|
|
2312
|
+
const qIdx = qs.indexOf("?");
|
|
2313
|
+
if (qIdx >= 0) qs = qs.slice(qIdx + 1);
|
|
2314
|
+
if (!qs.includes("=") && qs.includes("%3D")) qs = decodeURIComponent(qs);
|
|
2315
|
+
for (const pair of qs.split("&")) {
|
|
2316
|
+
const eq = pair.indexOf("=");
|
|
2317
|
+
if (eq >= 0) try {
|
|
2318
|
+
const key = decodeURIComponent(pair.slice(0, eq));
|
|
2319
|
+
const value = decodeURIComponent(pair.slice(eq + 1));
|
|
2320
|
+
if (value && INSTALL_REFERRER_ATTRIBUTION_PARAMS.has(key)) out[key] = value;
|
|
2321
|
+
} catch {}
|
|
2322
|
+
}
|
|
2323
|
+
} catch {}
|
|
2324
|
+
return out;
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
1753
2327
|
* Fetch the Google Play install referrer on Android via NativeModules.
|
|
1754
2328
|
* Requires the `com.android.installreferrer` library on the native side.
|
|
1755
2329
|
* Returns null on iOS or when the native module is not available.
|
|
@@ -1823,7 +2397,17 @@ function parseDeepLink(url) {
|
|
|
1823
2397
|
return null;
|
|
1824
2398
|
}
|
|
1825
2399
|
}
|
|
1826
|
-
|
|
2400
|
+
const _expoRouterPreviousPath = /* @__PURE__ */ new WeakMap();
|
|
2401
|
+
/**
|
|
2402
|
+
* Hook that emits `$screen_view` for every Expo Router pathname change.
|
|
2403
|
+
*
|
|
2404
|
+
* The hook also tracks the previous pathname so the emitted event carries
|
|
2405
|
+
* `previous_screen_name`, matching the React Navigation observer in
|
|
2406
|
+
* `useLayersNavigationTracking`. This makes funnel analysis trivial
|
|
2407
|
+
* server-side: every screen event has a self-contained pair `(from, to)`
|
|
2408
|
+
* — no need to join adjacent rows.
|
|
2409
|
+
*/
|
|
2410
|
+
function useLayersExpoRouterTracking(sdkInstance, usePathname, useGlobalSearchParams) {
|
|
1827
2411
|
const { useEffect } = require("react");
|
|
1828
2412
|
const pathname = usePathname();
|
|
1829
2413
|
const params = useGlobalSearchParams();
|
|
@@ -1833,7 +2417,10 @@ function useLayersExpoRouterTracking(layersInstance, usePathname, useGlobalSearc
|
|
|
1833
2417
|
Object.entries(params).forEach(([key, value]) => {
|
|
1834
2418
|
properties[key] = Array.isArray(value) ? value.join(",") : value;
|
|
1835
2419
|
});
|
|
1836
|
-
|
|
2420
|
+
const previous = _expoRouterPreviousPath.get(sdkInstance);
|
|
2421
|
+
if (previous && previous !== pathname) properties.previous_screen_name = previous;
|
|
2422
|
+
sdkInstance.screen(pathname, properties);
|
|
2423
|
+
_expoRouterPreviousPath.set(sdkInstance, pathname);
|
|
1837
2424
|
}
|
|
1838
2425
|
}, [pathname, JSON.stringify(params)]);
|
|
1839
2426
|
}
|
|
@@ -1863,6 +2450,12 @@ Object.defineProperty(exports, 'StandardEvents', {
|
|
|
1863
2450
|
return StandardEvents;
|
|
1864
2451
|
}
|
|
1865
2452
|
});
|
|
2453
|
+
Object.defineProperty(exports, 'SurveysModule', {
|
|
2454
|
+
enumerable: true,
|
|
2455
|
+
get: function () {
|
|
2456
|
+
return SurveysModule;
|
|
2457
|
+
}
|
|
2458
|
+
});
|
|
1866
2459
|
Object.defineProperty(exports, 'addToCartEvent', {
|
|
1867
2460
|
enumerable: true,
|
|
1868
2461
|
get: function () {
|
|
@@ -1887,6 +2480,12 @@ Object.defineProperty(exports, 'createBackgroundFlushHandler', {
|
|
|
1887
2480
|
return createBackgroundFlushHandler;
|
|
1888
2481
|
}
|
|
1889
2482
|
});
|
|
2483
|
+
Object.defineProperty(exports, 'createNavigationListener', {
|
|
2484
|
+
enumerable: true,
|
|
2485
|
+
get: function () {
|
|
2486
|
+
return createNavigationListener;
|
|
2487
|
+
}
|
|
2488
|
+
});
|
|
1890
2489
|
Object.defineProperty(exports, 'formatFbc', {
|
|
1891
2490
|
enumerable: true,
|
|
1892
2491
|
get: function () {
|
|
@@ -1959,6 +2558,12 @@ Object.defineProperty(exports, 'parseDeepLink', {
|
|
|
1959
2558
|
return parseDeepLink;
|
|
1960
2559
|
}
|
|
1961
2560
|
});
|
|
2561
|
+
Object.defineProperty(exports, 'parseInstallReferrerUrl', {
|
|
2562
|
+
enumerable: true,
|
|
2563
|
+
get: function () {
|
|
2564
|
+
return parseInstallReferrerUrl;
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
1962
2567
|
Object.defineProperty(exports, 'purchaseEvent', {
|
|
1963
2568
|
enumerable: true,
|
|
1964
2569
|
get: function () {
|
|
@@ -1989,6 +2594,12 @@ Object.defineProperty(exports, 'resetRevenueCatForTesting', {
|
|
|
1989
2594
|
return resetRevenueCatForTesting;
|
|
1990
2595
|
}
|
|
1991
2596
|
});
|
|
2597
|
+
Object.defineProperty(exports, 'resolveActiveRoute', {
|
|
2598
|
+
enumerable: true,
|
|
2599
|
+
get: function () {
|
|
2600
|
+
return resolveActiveRoute;
|
|
2601
|
+
}
|
|
2602
|
+
});
|
|
1992
2603
|
Object.defineProperty(exports, 'screenViewEvent', {
|
|
1993
2604
|
enumerable: true,
|
|
1994
2605
|
get: function () {
|
|
@@ -2151,6 +2762,12 @@ Object.defineProperty(exports, 'useLayersExpoRouterTracking', {
|
|
|
2151
2762
|
return useLayersExpoRouterTracking;
|
|
2152
2763
|
}
|
|
2153
2764
|
});
|
|
2765
|
+
Object.defineProperty(exports, 'useLayersNavigationTracking', {
|
|
2766
|
+
enumerable: true,
|
|
2767
|
+
get: function () {
|
|
2768
|
+
return useLayersNavigationTracking;
|
|
2769
|
+
}
|
|
2770
|
+
});
|
|
2154
2771
|
Object.defineProperty(exports, 'viewContentEvent', {
|
|
2155
2772
|
enumerable: true,
|
|
2156
2773
|
get: function () {
|