@layers/react-native 3.4.0 → 3.5.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.
@@ -1123,7 +1123,7 @@ function hostAppIsRegisteredOn(rn) {
1123
1123
  }
1124
1124
  }
1125
1125
  const DUPLICATE_REACT_NATIVE_MESSAGE = "[Layers] The SDK resolved a SECOND copy of react-native, not the one your app runs. React Native delivers native lifecycle events to a single copy, so this listener can never fire: $app_background and $app_foreground will not be emitted and the background crash-safety snapshot will not run, which loses every event queued since the last flush on any launch that ends in a kill. Fix the duplicate in your bundler — in a Metro monorepo set `resolver.disableHierarchicalLookup = true` and list every workspace node_modules in `resolver.nodeModulesPaths` — or hand the SDK your app's module: `new LayersReactNative({ ..., appState: AppState })` with AppState imported from 'react-native'.";
1126
- const SDK_VERSION = "3.4.0";
1126
+ const SDK_VERSION = "3.5.0";
1127
1127
  var LayersReactNative = class LayersReactNative {
1128
1128
  core;
1129
1129
  eager;
@@ -1142,6 +1142,7 @@ var LayersReactNative = class LayersReactNative {
1142
1142
  netInfoUnsubscribe = null;
1143
1143
  config;
1144
1144
  userIdLocked = false;
1145
+ attStatusProvider;
1145
1146
  errorListeners = /* @__PURE__ */ new Set();
1146
1147
  _skanManager = null;
1147
1148
  _skanArmed = false;
@@ -1184,6 +1185,10 @@ var LayersReactNative = class LayersReactNative {
1184
1185
  this.enableDebug = config.enableDebug ?? false;
1185
1186
  this.appUserId = config.appUserId;
1186
1187
  this.config = config;
1188
+ try {
1189
+ const { Platform } = require("react-native");
1190
+ if (Platform.OS === "ios") this.attStatusProvider = require_att.getATTStatus;
1191
+ } catch {}
1187
1192
  const httpClient = new __layers_core_wasm.FetchHttpClient();
1188
1193
  this.eager = createEagerPersistence(config.appId);
1189
1194
  this.core = __layers_core_wasm.LayersCore.init({
@@ -1191,6 +1196,7 @@ var LayersReactNative = class LayersReactNative {
1191
1196
  appId: config.appId,
1192
1197
  environment: config.environment,
1193
1198
  ...config.baseUrl != null && { baseUrl: config.baseUrl },
1199
+ ...config.trackingBaseUrl != null && { trackingBaseUrl: config.trackingBaseUrl },
1194
1200
  ...config.enableDebug != null && { enableDebug: config.enableDebug },
1195
1201
  ...config.flushIntervalMs != null && { flushIntervalMs: config.flushIntervalMs },
1196
1202
  ...config.flushThreshold != null && { flushThreshold: config.flushThreshold },
@@ -1199,7 +1205,8 @@ var LayersReactNative = class LayersReactNative {
1199
1205
  ...config.bootstrap != null && { bootstrap: config.bootstrap }
1200
1206
  },
1201
1207
  httpClient,
1202
- persistence: this.eagerPersistence
1208
+ persistence: this.eagerPersistence,
1209
+ ...this.attStatusProvider && { attStatusProvider: this.attStatusProvider }
1203
1210
  });
1204
1211
  require_skan.setSkanCore(this.core);
1205
1212
  this.applyEagerDeviceContext();
@@ -1361,6 +1368,7 @@ var LayersReactNative = class LayersReactNative {
1361
1368
  appId: this.config.appId,
1362
1369
  environment: this.config.environment,
1363
1370
  ...this.config.baseUrl != null && { baseUrl: this.config.baseUrl },
1371
+ ...this.config.trackingBaseUrl != null && { trackingBaseUrl: this.config.trackingBaseUrl },
1364
1372
  ...this.config.enableDebug != null && { enableDebug: this.config.enableDebug },
1365
1373
  ...this.config.debug != null && { debug: this.config.debug },
1366
1374
  ...this.config.flushIntervalMs != null && { flushIntervalMs: this.config.flushIntervalMs },
@@ -1371,6 +1379,7 @@ var LayersReactNative = class LayersReactNative {
1371
1379
  },
1372
1380
  httpClient,
1373
1381
  persistence,
1382
+ ...this.attStatusProvider && { attStatusProvider: this.attStatusProvider },
1374
1383
  migration: migrationState
1375
1384
  });
1376
1385
  this._runtimeGeneration = generation;
@@ -1,5 +1,5 @@
1
1
  import { t as __require } from "./chunk-COTuXS2J.mjs";
2
- import { a as requestTrackingAuthorization, n as getAdvertisingId, r as getVendorId } from "./att-CnlG_CuV.mjs";
2
+ import { a as requestTrackingAuthorization, n as getAdvertisingId, r as getVendorId, t as getATTStatus } from "./att-CnlG_CuV.mjs";
3
3
  import { r as setSkanCore, t as SKANManager } from "./skan-DO7MLv2w.mjs";
4
4
  import { FetchHttpClient, LayersCore, LayersError as LayersError$1, LayersEvent, addToCartEvent as buildAddToCartEvent, beginCheckoutEvent as buildBeginCheckoutEvent, initWasm, onboardingCompleteEvent as buildOnboardingCompleteEvent, onboardingStartEvent as buildOnboardingStartEvent, paywallShowEvent as buildPaywallShowEvent, purchaseEvent as buildPurchaseEvent, refundEvent as buildRefundEvent, startTrialEvent as buildStartTrialEvent, subscribeEvent as buildSubscribeEvent, viewItemEvent as buildViewItemEvent } from "@layers/core-wasm";
5
5
 
@@ -1122,7 +1122,7 @@ function hostAppIsRegisteredOn(rn) {
1122
1122
  }
1123
1123
  }
1124
1124
  const DUPLICATE_REACT_NATIVE_MESSAGE = "[Layers] The SDK resolved a SECOND copy of react-native, not the one your app runs. React Native delivers native lifecycle events to a single copy, so this listener can never fire: $app_background and $app_foreground will not be emitted and the background crash-safety snapshot will not run, which loses every event queued since the last flush on any launch that ends in a kill. Fix the duplicate in your bundler — in a Metro monorepo set `resolver.disableHierarchicalLookup = true` and list every workspace node_modules in `resolver.nodeModulesPaths` — or hand the SDK your app's module: `new LayersReactNative({ ..., appState: AppState })` with AppState imported from 'react-native'.";
1125
- const SDK_VERSION = "3.4.0";
1125
+ const SDK_VERSION = "3.5.0";
1126
1126
  var LayersReactNative = class LayersReactNative {
1127
1127
  core;
1128
1128
  eager;
@@ -1141,6 +1141,7 @@ var LayersReactNative = class LayersReactNative {
1141
1141
  netInfoUnsubscribe = null;
1142
1142
  config;
1143
1143
  userIdLocked = false;
1144
+ attStatusProvider;
1144
1145
  errorListeners = /* @__PURE__ */ new Set();
1145
1146
  _skanManager = null;
1146
1147
  _skanArmed = false;
@@ -1183,6 +1184,10 @@ var LayersReactNative = class LayersReactNative {
1183
1184
  this.enableDebug = config.enableDebug ?? false;
1184
1185
  this.appUserId = config.appUserId;
1185
1186
  this.config = config;
1187
+ try {
1188
+ const { Platform } = __require("react-native");
1189
+ if (Platform.OS === "ios") this.attStatusProvider = getATTStatus;
1190
+ } catch {}
1186
1191
  const httpClient = new FetchHttpClient();
1187
1192
  this.eager = createEagerPersistence(config.appId);
1188
1193
  this.core = LayersCore.init({
@@ -1190,6 +1195,7 @@ var LayersReactNative = class LayersReactNative {
1190
1195
  appId: config.appId,
1191
1196
  environment: config.environment,
1192
1197
  ...config.baseUrl != null && { baseUrl: config.baseUrl },
1198
+ ...config.trackingBaseUrl != null && { trackingBaseUrl: config.trackingBaseUrl },
1193
1199
  ...config.enableDebug != null && { enableDebug: config.enableDebug },
1194
1200
  ...config.flushIntervalMs != null && { flushIntervalMs: config.flushIntervalMs },
1195
1201
  ...config.flushThreshold != null && { flushThreshold: config.flushThreshold },
@@ -1198,7 +1204,8 @@ var LayersReactNative = class LayersReactNative {
1198
1204
  ...config.bootstrap != null && { bootstrap: config.bootstrap }
1199
1205
  },
1200
1206
  httpClient,
1201
- persistence: this.eagerPersistence
1207
+ persistence: this.eagerPersistence,
1208
+ ...this.attStatusProvider && { attStatusProvider: this.attStatusProvider }
1202
1209
  });
1203
1210
  setSkanCore(this.core);
1204
1211
  this.applyEagerDeviceContext();
@@ -1360,6 +1367,7 @@ var LayersReactNative = class LayersReactNative {
1360
1367
  appId: this.config.appId,
1361
1368
  environment: this.config.environment,
1362
1369
  ...this.config.baseUrl != null && { baseUrl: this.config.baseUrl },
1370
+ ...this.config.trackingBaseUrl != null && { trackingBaseUrl: this.config.trackingBaseUrl },
1363
1371
  ...this.config.enableDebug != null && { enableDebug: this.config.enableDebug },
1364
1372
  ...this.config.debug != null && { debug: this.config.debug },
1365
1373
  ...this.config.flushIntervalMs != null && { flushIntervalMs: this.config.flushIntervalMs },
@@ -1370,6 +1378,7 @@ var LayersReactNative = class LayersReactNative {
1370
1378
  },
1371
1379
  httpClient,
1372
1380
  persistence,
1381
+ ...this.attStatusProvider && { attStatusProvider: this.attStatusProvider },
1373
1382
  migration: migrationState
1374
1383
  });
1375
1384
  this._runtimeGeneration = generation;
@@ -3685,4 +3694,4 @@ function useLayersExpoRouterTracking(sdkInstance, usePathname, useGlobalSearchPa
3685
3694
 
3686
3695
  //#endregion
3687
3696
  export { superwallTrackPurchase as $, resolveActiveRoute as A, trackRevenueCatPurchase as B, parseInstallReferrerUrl as C, buildExceptionProperties as Ct, useLayersExpoRouterTracking as D, shouldTreatAsNewInstall as E, registerExpoBackgroundFlush as F, trackPurchaseFailed as G, trackBeginCheckout as H, connectRevenueCat as I, trackSubscription as J, trackRefund as K, isRevenueCatConnected as L, BACKGROUND_FLUSH_MIN_INTERVAL_MINUTES as M, BACKGROUND_FLUSH_TASK_NAME as N, SurveysModule as O, createBackgroundFlushHandler as P, superwallTrackPresentation as Q, resetRevenueCatForTesting as R, parseInstallReferrerDeepLink as S, viewItemEvent as St, setupDeepLinkListener as T, trackOrder as U, trackAddToCart as V, trackPurchase as W, superwallOnEvent as X, trackViewProduct as Y, superwallTrackDismiss as Z, getFirstInstallTime as _, signUpEvent as _t, buildBeginCheckoutEvent as a, initiateCheckoutEvent as at, getOrSetInstallId as b, tutorialCompleteEvent as bt, buildOnboardingStartEvent as c, loginEvent as ct, buildRefundEvent as d, paywallShowEvent as dt, superwallTrackSkip as et, buildStartTrialEvent as f, purchaseEvent as ft, getAdServicesToken as g, shareEvent as gt, formatFbc as h, searchEvent as ht, buildAddToCartEvent as i, addToWishlistEvent as it, useLayersNavigationTracking as j, createNavigationListener as k, buildPaywallShowEvent as l, onboardingCompleteEvent as lt, buildViewItemEvent as m, screenViewEvent as mt, LayersEvent as n, StandardEvents as nt, buildInstallReferrerProperties as o, levelCompleteEvent as ot, buildSubscribeEvent as p, registerEvent as pt, trackRemoveFromCart as q, LayersReactNative as r, addToCartEvent as rt, buildOnboardingCompleteEvent as s, levelStartEvent as st, LayersError$1 as t, superwallUserAttributes as tt, buildPurchaseEvent as u, onboardingStartEvent as ut, getGoogleAdvertisingId as v, startTrialEvent as vt, readClipboardAttribution as w, installExceptionAutoCapture as wt, parseDeepLink as x, viewContentEvent as xt, getInstallReferrer as y, subscribeEvent as yt, syncRevenueCatAttributes as z };
3688
- //# sourceMappingURL=src-bqgkPFIj.mjs.map
3697
+ //# sourceMappingURL=src-CKoz6JUg.mjs.map