@layers/react-native 3.2.13 → 3.3.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.
@@ -937,7 +937,7 @@ function hostAppIsRegisteredOn(rn) {
937
937
  }
938
938
  }
939
939
  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'.";
940
- const SDK_VERSION = "3.2.13";
940
+ const SDK_VERSION = "3.3.0";
941
941
  var LayersReactNative = class LayersReactNative {
942
942
  core;
943
943
  eagerPersistence;
@@ -1504,7 +1504,9 @@ var LayersReactNative = class LayersReactNative {
1504
1504
  * After the user responds, this method automatically:
1505
1505
  * - Collects IDFA if authorized
1506
1506
  * - Updates device info with IDFA and ATT status
1507
- * - Sets advertising consent based on ATT result
1507
+ *
1508
+ * ATT controls IDFA availability only. This method does not change Layers
1509
+ * consent; use setConsent() explicitly when the app wants to do that.
1508
1510
  *
1509
1511
  * Returns the ATT status string.
1510
1512
  */
@@ -1532,14 +1534,13 @@ var LayersReactNative = class LayersReactNative {
1532
1534
  ...this.core.getDeviceContext(),
1533
1535
  attStatus: status
1534
1536
  };
1537
+ delete updates.idfa;
1535
1538
  if (status === "authorized") try {
1536
1539
  const idfa = await require_att.getAdvertisingId();
1537
1540
  if (idfa) updates.idfa = idfa;
1538
1541
  } catch {}
1539
1542
  this.core.setDeviceContext(updates);
1540
- const advertisingAllowed = status === "authorized";
1541
- this.core.setConsent({ advertising: advertisingAllowed });
1542
- if (this.enableDebug) console.log(`[Layers] ATT status: ${status}, advertising consent: ${String(advertisingAllowed)}`);
1543
+ if (this.enableDebug) console.log(`[Layers] ATT status: ${status}; Layers consent unchanged.`);
1543
1544
  return status;
1544
1545
  }
1545
1546
  /**
@@ -1600,11 +1601,13 @@ var LayersReactNative = class LayersReactNative {
1600
1601
  return this.core.getConsentState();
1601
1602
  }
1602
1603
  setDeviceInfo(deviceInfo) {
1603
- const current = this.core.getDeviceContext();
1604
- this.core.setDeviceContext({
1605
- ...current,
1606
- ...deviceInfo
1607
- });
1604
+ const next = { ...this.core.getDeviceContext() };
1605
+ for (const key of Object.keys(deviceInfo)) {
1606
+ const value = deviceInfo[key];
1607
+ if (value === void 0) delete next[key];
1608
+ else Object.assign(next, { [key]: value });
1609
+ }
1610
+ this.core.setDeviceContext(next);
1608
1611
  }
1609
1612
  async flush() {
1610
1613
  try {
@@ -0,0 +1,20 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(LayersATT, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(getTrackingAuthorizationStatus:(RCTPromiseResolveBlock)resolve
6
+ rejecter:(RCTPromiseRejectBlock)reject)
7
+
8
+ RCT_EXTERN_METHOD(requestTrackingAuthorization:(RCTPromiseResolveBlock)resolve
9
+ rejecter:(RCTPromiseRejectBlock)reject)
10
+
11
+ RCT_EXTERN_METHOD(isATTAvailable:(RCTPromiseResolveBlock)resolve
12
+ rejecter:(RCTPromiseRejectBlock)reject)
13
+
14
+ RCT_EXTERN_METHOD(getAdvertisingId:(RCTPromiseResolveBlock)resolve
15
+ rejecter:(RCTPromiseRejectBlock)reject)
16
+
17
+ RCT_EXTERN_METHOD(getVendorId:(RCTPromiseResolveBlock)resolve
18
+ rejecter:(RCTPromiseRejectBlock)reject)
19
+
20
+ @end
@@ -0,0 +1,144 @@
1
+ import AdSupport
2
+ import AppTrackingTransparency
3
+ import Foundation
4
+ import React
5
+ import UIKit
6
+
7
+ @objc(LayersATT)
8
+ class LayersATT: NSObject {
9
+
10
+ private static let missingUsageDescriptionCode = "ATT_USAGE_DESCRIPTION_MISSING"
11
+ private static let zeroAdvertisingIdentifier = "00000000-0000-0000-0000-000000000000"
12
+
13
+ private static var hasTrackingUsageDescription: Bool {
14
+ guard
15
+ let value = Bundle.main.object(
16
+ forInfoDictionaryKey: "NSUserTrackingUsageDescription"
17
+ ) as? String
18
+ else {
19
+ return false
20
+ }
21
+ return !value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
22
+ }
23
+
24
+ @available(iOS 14.0, *)
25
+ private static func statusString(
26
+ _ status: ATTrackingManager.AuthorizationStatus
27
+ ) -> String {
28
+ switch status {
29
+ case .notDetermined:
30
+ return "not_determined"
31
+ case .restricted:
32
+ return "restricted"
33
+ case .denied:
34
+ return "denied"
35
+ case .authorized:
36
+ return "authorized"
37
+ @unknown default:
38
+ return "not_determined"
39
+ }
40
+ }
41
+
42
+ private static func onMain(_ work: @escaping () -> Void) {
43
+ if Thread.isMainThread {
44
+ work()
45
+ } else {
46
+ DispatchQueue.main.async(execute: work)
47
+ }
48
+ }
49
+
50
+ @objc
51
+ func getTrackingAuthorizationStatus(
52
+ _ resolve: @escaping (Any?) -> Void,
53
+ rejecter reject: @escaping (String?, String?, Error?) -> Void
54
+ ) {
55
+ Self.onMain {
56
+ guard #available(iOS 14.0, *) else {
57
+ resolve("not_determined")
58
+ return
59
+ }
60
+ resolve(Self.statusString(ATTrackingManager.trackingAuthorizationStatus))
61
+ }
62
+ }
63
+
64
+ @objc
65
+ func requestTrackingAuthorization(
66
+ _ resolve: @escaping (Any?) -> Void,
67
+ rejecter reject: @escaping (String?, String?, Error?) -> Void
68
+ ) {
69
+ Self.onMain {
70
+ guard #available(iOS 14.0, *) else {
71
+ resolve("not_determined")
72
+ return
73
+ }
74
+
75
+ let current = ATTrackingManager.trackingAuthorizationStatus
76
+ guard current == .notDetermined else {
77
+ resolve(Self.statusString(current))
78
+ return
79
+ }
80
+
81
+ guard Self.hasTrackingUsageDescription else {
82
+ reject(
83
+ Self.missingUsageDescriptionCode,
84
+ "Cannot request App Tracking Transparency authorization because " +
85
+ "NSUserTrackingUsageDescription is missing or empty in the app's Info.plist.",
86
+ nil
87
+ )
88
+ return
89
+ }
90
+
91
+ ATTrackingManager.requestTrackingAuthorization { status in
92
+ resolve(Self.statusString(status))
93
+ }
94
+ }
95
+ }
96
+
97
+ @objc
98
+ func isATTAvailable(
99
+ _ resolve: @escaping (Any?) -> Void,
100
+ rejecter reject: @escaping (String?, String?, Error?) -> Void
101
+ ) {
102
+ Self.onMain {
103
+ if #available(iOS 14.0, *) {
104
+ resolve(true)
105
+ } else {
106
+ resolve(false)
107
+ }
108
+ }
109
+ }
110
+
111
+ @objc
112
+ func getAdvertisingId(
113
+ _ resolve: @escaping (Any?) -> Void,
114
+ rejecter reject: @escaping (String?, String?, Error?) -> Void
115
+ ) {
116
+ Self.onMain {
117
+ guard
118
+ #available(iOS 14.0, *),
119
+ ATTrackingManager.trackingAuthorizationStatus == .authorized
120
+ else {
121
+ resolve(nil)
122
+ return
123
+ }
124
+
125
+ let identifier = ASIdentifierManager.shared().advertisingIdentifier.uuidString
126
+ resolve(identifier == Self.zeroAdvertisingIdentifier ? nil : identifier)
127
+ }
128
+ }
129
+
130
+ @objc
131
+ func getVendorId(
132
+ _ resolve: @escaping (Any?) -> Void,
133
+ rejecter reject: @escaping (String?, String?, Error?) -> Void
134
+ ) {
135
+ Self.onMain {
136
+ resolve(UIDevice.current.identifierForVendor?.uuidString)
137
+ }
138
+ }
139
+
140
+ @objc
141
+ static func requiresMainQueueSetup() -> Bool {
142
+ return false
143
+ }
144
+ }
@@ -2,142 +2,6 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
- <!--
6
- Layers React Native SDK Privacy Manifest (iOS pod)
7
-
8
- Added 2026-08-17. Until this file existed the `layers-react-native`
9
- pod shipped `ios/LayersDeviceInfo.swift`, which reads a file
10
- creation date — a required-reason API — with NO privacy manifest
11
- anywhere in the pod. Apple has rejected uploads for that since
12
- 1 May 2024:
13
-
14
- ITMS-91053: Missing API declaration — your app's code, or the
15
- code of an SDK it uses, references one or more APIs that require
16
- reasons, including NSPrivacyAccessedAPICategoryFileTimestamp.
17
-
18
- Every sibling SDK in this repo already carried a manifest
19
- (swift/Sources/Layers/, flutter/ios/, unity/Plugins/iOS/); the RN
20
- pod was the one that did not, so `@layers/react-native` and
21
- `@layers/expo` were the only Layers SDKs that could not be
22
- submitted to the App Store. Keep this file in sync with what the
23
- pod's Swift/ObjC actually does — scripts/check-tarballs.mjs greps
24
- the shipped sources and fails on any undeclared usage.
25
-
26
- NSPrivacyTracking is false, matching the sibling manifests: the SDK
27
- does not send data to an ATT-defined tracking endpoint. Flipping it
28
- to true (with a dedicated tracking domain in
29
- NSPrivacyTrackingDomains) is a pending product decision blocked on
30
- infra — see the audit record. NSPrivacyTrackingDomains stays EMPTY
31
- on purpose: iOS blocks connections to declared tracking domains
32
- when the user has not granted ATT authorization, and in.layers.com
33
- is the event ingest endpoint. Listing it would silently drop all
34
- delivery for every non-authorized user.
35
- -->
36
-
37
- <key>NSPrivacyTracking</key>
38
- <false/>
39
- <key>NSPrivacyTrackingDomains</key>
40
- <array/>
41
-
42
- <!--
43
- Data types this SDK collects.
44
-
45
- Deliberately NOT a copy of the Swift/Unity manifests. Those SDKs
46
- declare CrashData and (Swift) PerformanceData because they ship
47
- crash/exception capture — swift/Sources/Layers/ExceptionModule.swift
48
- and MetricKitModule.swift, unity/Runtime/ExceptionModule.cs. The
49
- React Native SDK installs no global error handler and captures no
50
- crashes, so declaring CrashData here would push a data type the SDK
51
- never collects into every host app's privacy nutrition label.
52
- -->
53
- <key>NSPrivacyCollectedDataTypes</key>
54
- <array>
55
- <!-- install_id (AsyncStorage), IDFV/IDFA via the ATT module
56
- (src/att.ts), GAID via the Android module. -->
57
- <dict>
58
- <key>NSPrivacyCollectedDataType</key>
59
- <string>NSPrivacyCollectedDataTypeDeviceID</string>
60
- <key>NSPrivacyCollectedDataTypeLinked</key>
61
- <false/>
62
- <key>NSPrivacyCollectedDataTypeTracking</key>
63
- <false/>
64
- <key>NSPrivacyCollectedDataTypePurposes</key>
65
- <array>
66
- <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
67
- </array>
68
- </dict>
69
- <!-- track()/screen() events, app_open, deep links, session data. -->
70
- <dict>
71
- <key>NSPrivacyCollectedDataType</key>
72
- <string>NSPrivacyCollectedDataTypeProductInteraction</string>
73
- <key>NSPrivacyCollectedDataTypeLinked</key>
74
- <false/>
75
- <key>NSPrivacyCollectedDataTypeTracking</key>
76
- <false/>
77
- <key>NSPrivacyCollectedDataTypePurposes</key>
78
- <array>
79
- <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
80
- </array>
81
- </dict>
82
- <!-- trackPurchase / trackPurchaseFailed and the RevenueCat and
83
- Superwall bridges send purchase/subscription events
84
- (revenue, product_id). -->
85
- <dict>
86
- <key>NSPrivacyCollectedDataType</key>
87
- <string>NSPrivacyCollectedDataTypePurchaseHistory</string>
88
- <key>NSPrivacyCollectedDataTypeLinked</key>
89
- <false/>
90
- <key>NSPrivacyCollectedDataTypeTracking</key>
91
- <false/>
92
- <key>NSPrivacyCollectedDataTypePurposes</key>
93
- <array>
94
- <string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
95
- </array>
96
- </dict>
97
- </array>
98
-
99
- <!--
100
- Required-reason APIs this POD touches.
101
-
102
- Scope note: the declaration covers the code Apple actually scans —
103
- the compiled pod, i.e. ios/*.{h,m,swift}. React Native runs the JS
104
- engine (packages/wasm/src/core.ts), so unlike the Swift, Flutter,
105
- and Unity SDKs there is no Rust core linked into this pod. That is
106
- why three categories the sibling manifests declare are absent here:
107
-
108
- - UserDefaults (CA92.1): the pod contains no NSUserDefaults
109
- usage. RN persistence is AsyncStorage, a separate pod that
110
- ships its own manifest.
111
- - SystemBootTime (35F9.1): declared by the others because Rust's
112
- std::time::Instant reads the boot clock. No Rust here; the JS
113
- engine uses Date.now() and JS timers.
114
- - DiskSpace (E174.1) / ActiveKeyboards (3EC4.1): unused.
115
-
116
- Audited usage:
117
- - File timestamps — ios/LayersDeviceInfo.swift getFirstInstallTime()
118
- calls FileManager.attributesOfItem(atPath:) and reads
119
- .creationDate (NSFileCreationDate) on the app's OWN Documents
120
- directory, to date the install and suppress a false
121
- `is_first_launch` when the SDK is added to an already-installed
122
- app.
123
-
124
- Reason C617.1 — "Access the timestamps, size, or other metadata
125
- of files inside the app container, app group container, or the
126
- app's CloudKit container." The Documents directory is the app
127
- container, which is what makes C617.1 the honest code, and the
128
- only fitting one:
129
-
130
- * DDA9.1 is for displaying timestamps to the person using the
131
- device and forbids sending the information or anything
132
- derived from it off-device. This value is not displayed, and
133
- a boolean derived from it gates an event that is sent — so
134
- DDA9.1 would be wrong twice.
135
- * 3B52.1 requires files the user granted access to explicitly
136
- (e.g. a document picker). There is no picker.
137
- * 0A2A.1 is for an SDK wrapping a file-timestamp API on behalf
138
- of a calling app and only while that app calls the wrapper.
139
- The SDK reads this on its own initiative during init.
140
- -->
141
5
  <key>NSPrivacyAccessedAPITypes</key>
142
6
  <array>
143
7
  <dict>
@@ -31,7 +31,9 @@ Pod::Spec.new do |s|
31
31
 
32
32
  # Strong-linked frameworks
33
33
  # - StoreKit: SKAdNetwork conversion updates
34
- s.frameworks = "StoreKit"
34
+ # - AppTrackingTransparency: ATT status and authorization prompt
35
+ # - AdSupport: IDFA after ATT authorization
36
+ s.frameworks = "StoreKit", "AppTrackingTransparency", "AdSupport"
35
37
 
36
38
  # Weakly-linked frameworks
37
39
  # - AdServices (iOS 14.3+): attribution token via AAAttribution. Without
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@layers/react-native",
3
- "version": "3.2.13",
3
+ "version": "3.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -67,7 +67,7 @@
67
67
  "mobile"
68
68
  ],
69
69
  "dependencies": {
70
- "@layers/core-wasm": "3.2.13"
70
+ "@layers/core-wasm": "3.3.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "@react-native-async-storage/async-storage": ">=1.21.0",