@advenue/react-native 0.9.0 → 1.0.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/README.md +8 -7
- package/android/src/main/java/expo/modules/advenue/AdvenueAndroidModule.kt +117 -368
- package/android/src/main/kotlin/io/advenue/Advenue.kt +574 -0
- package/android/src/main/kotlin/io/advenue/AdvenueConfig.kt +141 -0
- package/android/src/main/kotlin/io/advenue/core/Backoff.kt +28 -0
- package/android/src/main/kotlin/io/advenue/core/ClientEvent.kt +136 -0
- package/android/src/main/kotlin/io/advenue/core/CommandPipe.kt +193 -0
- package/android/src/main/kotlin/io/advenue/core/Consent.kt +52 -0
- package/android/src/main/kotlin/io/advenue/core/Contracts.kt +80 -0
- package/android/src/main/kotlin/io/advenue/core/Conversion.kt +69 -0
- package/android/src/main/kotlin/io/advenue/core/Engine.kt +436 -0
- package/android/src/main/kotlin/io/advenue/core/EventQueue.kt +89 -0
- package/android/src/main/kotlin/io/advenue/core/HmacSigner.kt +31 -0
- package/android/src/main/kotlin/io/advenue/core/InstallReferrer.kt +146 -0
- package/android/src/main/kotlin/io/advenue/core/Json.kt +272 -0
- package/android/src/main/kotlin/io/advenue/core/Limits.kt +50 -0
- package/android/src/main/kotlin/io/advenue/core/MetaReferrer.kt +80 -0
- package/android/src/main/kotlin/io/advenue/core/PiiScrub.kt +77 -0
- package/android/src/main/kotlin/io/advenue/core/SessionTracker.kt +189 -0
- package/android/src/main/kotlin/io/advenue/core/SystemServices.kt +58 -0
- package/android/src/main/kotlin/io/advenue/core/Tcf.kt +48 -0
- package/android/src/main/kotlin/io/advenue/core/Time.kt +56 -0
- package/android/src/main/kotlin/io/advenue/platform/Collectors.kt +163 -0
- package/android/src/main/kotlin/io/advenue/platform/CompositeStore.kt +33 -0
- package/android/src/main/kotlin/io/advenue/platform/ConversionFetcher.kt +68 -0
- package/android/src/main/kotlin/io/advenue/platform/ForegroundTracker.kt +90 -0
- package/android/src/main/kotlin/io/advenue/platform/HttpUrlTransport.kt +101 -0
- package/android/src/main/kotlin/io/advenue/platform/Identity.kt +79 -0
- package/android/src/main/kotlin/io/advenue/platform/InstallEnrichment.kt +197 -0
- package/android/src/main/kotlin/io/advenue/platform/InstallScopedStore.kt +96 -0
- package/android/src/main/kotlin/io/advenue/platform/LifecycleBridge.kt +72 -0
- package/android/src/main/kotlin/io/advenue/platform/PreferencesStore.kt +32 -0
- package/android/src/main/kotlin/io/advenue/plugin/Contracts.kt +67 -0
- package/android/src/main/kotlin/io/advenue/plugin/FirebaseAppInstanceIdSource.kt +73 -0
- package/android/src/main/kotlin/io/advenue/plugin/PlayAdvertisingIdSource.kt +47 -0
- package/android/src/main/kotlin/io/advenue/plugin/PlayInstallReferrerSource.kt +85 -0
- package/android/src/main/kotlin/io/advenue/plugin/PlayIntegritySource.kt +86 -0
- package/android/src/main/kotlin/io/advenue/plugin/PluginRegistry.kt +61 -0
- package/dist/index.cjs +188 -675
- package/dist/index.d.cts +203 -336
- package/dist/index.d.ts +203 -336
- package/dist/index.js +187 -681
- package/ios/AdvenueIosModule.swift +143 -446
- package/ios/vendor/Advenue/Advenue.swift +632 -0
- package/ios/vendor/Advenue/AdvenueConfig.swift +89 -0
- package/ios/vendor/AdvenueCore/AdvenueValue.swift +103 -0
- package/ios/vendor/AdvenueCore/Attestation.swift +52 -0
- package/ios/vendor/AdvenueCore/Backoff.swift +28 -0
- package/ios/vendor/AdvenueCore/ClientEvent.swift +154 -0
- package/ios/vendor/AdvenueCore/Consent.swift +40 -0
- package/ios/vendor/AdvenueCore/Contracts.swift +59 -0
- package/ios/vendor/AdvenueCore/Conversion.swift +74 -0
- package/ios/vendor/AdvenueCore/ConversionValue.swift +217 -0
- package/ios/vendor/AdvenueCore/Engine.swift +607 -0
- package/ios/vendor/AdvenueCore/EventQueue.swift +89 -0
- package/ios/vendor/AdvenueCore/Limits.swift +41 -0
- package/ios/vendor/AdvenueCore/PIIScrub.swift +102 -0
- package/ios/vendor/AdvenueCore/SessionTracker.swift +139 -0
- package/ios/vendor/AdvenueCore/SkanConfig.swift +76 -0
- package/ios/vendor/AdvenueCore/SkanReporter.swift +25 -0
- package/ios/vendor/AdvenueCore/SkanState.swift +258 -0
- package/ios/vendor/AdvenueCore/Tcf.swift +48 -0
- package/ios/vendor/AdvenueCore/Transport.swift +14 -0
- package/ios/vendor/AdvenueFirebase/FirebaseAppInstanceId.swift +33 -0
- package/ios/vendor/AdvenuePlatform/AdvertisingIdentity.swift +87 -0
- package/ios/vendor/AdvenuePlatform/CacheFileStore.swift +90 -0
- package/ios/vendor/AdvenuePlatform/ChallengeFetcher.swift +42 -0
- package/ios/vendor/AdvenuePlatform/ConversionFetcher.swift +63 -0
- package/ios/vendor/AdvenuePlatform/CryptoKitSigner.swift +19 -0
- package/ios/vendor/AdvenuePlatform/DeviceCheckAttestation.swift +91 -0
- package/ios/vendor/AdvenuePlatform/DeviceInfo.swift +77 -0
- package/ios/vendor/AdvenuePlatform/ForegroundTracker.swift +55 -0
- package/ios/vendor/AdvenuePlatform/HttpTransport.swift +96 -0
- package/ios/vendor/AdvenuePlatform/Identity.swift +52 -0
- package/ios/vendor/AdvenuePlatform/InstallEnrichment.swift +155 -0
- package/ios/vendor/AdvenuePlatform/KeychainStore.swift +95 -0
- package/ios/vendor/AdvenuePlatform/SearchAdsToken.swift +76 -0
- package/ios/vendor/AdvenuePlatform/SkanConfigFetcher.swift +70 -0
- package/ios/vendor/AdvenuePlatform/StoreKitSkanReporter.swift +140 -0
- package/ios/vendor/AdvenuePlatform/SystemServices.swift +55 -0
- package/ios/vendor/AdvenuePlatform/TcfReader.swift +18 -0
- package/ios/vendor/AdvenuePlatform/UserDefaultsStore.swift +26 -0
- package/package.json +13 -15
- package/scripts/check-dist.mjs +17 -0
- package/scripts/check-vendored-swift.mjs +148 -0
- package/scripts/vendor-natives.mjs +149 -0
- package/scripts/vendor-natives.test.mjs +112 -0
- package/src/deep-links.ts +19 -1
- package/src/index.ts +273 -830
- package/src/native-types.ts +73 -181
- package/src/native.ts +0 -23
- package/src/types.ts +86 -0
- package/src/aem.ts +0 -33
- package/src/mmkv-storage.ts +0 -21
- package/src/native-storage.ts +0 -63
- package/src/secure-store.ts +0 -26
package/dist/index.d.ts
CHANGED
|
@@ -1,236 +1,156 @@
|
|
|
1
|
-
import { StorageAdapter, SecureStorageAdapter, DeepLink, AdvenueConfig, AdvenueClient, TrackOptions, Consent, DeviceInfo } from '@advenue/sdk-core';
|
|
2
|
-
export { AdvenueConfig, Consent, DeepLink, TrackOptions } from '@advenue/sdk-core';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* The types the package used to re-export from the retired TypeScript core.
|
|
3
|
+
*
|
|
4
|
+
* They live here now because the TypeScript core is retired and the native
|
|
5
|
+
* SDKs own the behaviour — but they are still the shapes apps destructure, so
|
|
6
|
+
* they must keep their names and fields exactly.
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/** Granular ad-platform consent (Google DMA). */
|
|
9
|
+
interface Consent {
|
|
10
|
+
/** Whether GDPR/EEA rules apply to this user. → Google `gdpr_applies` */
|
|
11
|
+
isUserSubjectToGDPR: boolean;
|
|
12
|
+
/** Consent to use data for advertising purposes. → Google `ad_user_data` */
|
|
13
|
+
hasConsentForDataUsage?: boolean;
|
|
14
|
+
/** Consent for personalized advertising. → Google `ad_personalization` */
|
|
15
|
+
hasConsentForAdsPersonalization?: boolean;
|
|
16
|
+
/** Consent for ad storage. → Google `ad_storage` */
|
|
17
|
+
hasConsentForAdStorage?: boolean;
|
|
13
18
|
}
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/** Server-clock: installBeginTimestampServerSeconds. 0 = unverified. */
|
|
29
|
-
installServerTimestamp?: number;
|
|
30
|
-
googlePlayInstant: boolean;
|
|
19
|
+
/** A resolved deep link, deferred or direct. */
|
|
20
|
+
interface DeepLink {
|
|
21
|
+
/** In-app destination, e.g. "product/123". Absent for an attributed install with no link. */
|
|
22
|
+
deepLinkValue?: string;
|
|
23
|
+
campaign?: string;
|
|
24
|
+
network?: string;
|
|
25
|
+
influencerId?: string;
|
|
26
|
+
params?: Record<string, unknown>;
|
|
27
|
+
/** Raw opening URL for direct (OS-delivered) links; absent for deferred. */
|
|
28
|
+
url?: string;
|
|
29
|
+
/** True when the link survived an install rather than arriving on an open. */
|
|
30
|
+
isDeferred: boolean;
|
|
31
|
+
/** True when this is the device's first-launch attribution (always true for deferred). */
|
|
32
|
+
isFirstLaunch: boolean;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The event types a client SDK may emit. Revenue-bearing subscription events
|
|
36
|
+
* are deliberately absent: those originate only from verified S2S sources, and
|
|
37
|
+
* the server rejects a batch that claims one.
|
|
38
|
+
*/
|
|
39
|
+
type ClientEventType = 'install' | 'session' | 'custom';
|
|
40
|
+
/** Per-event options. Most apps never pass any of these. */
|
|
41
|
+
interface TrackOptions {
|
|
42
|
+
type?: ClientEventType;
|
|
43
|
+
network?: string;
|
|
44
|
+
campaign?: string;
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
47
|
+
* SDK configuration.
|
|
48
|
+
*
|
|
49
|
+
* Several options that used to shape the TypeScript core are now decided
|
|
50
|
+
* natively and are accepted but ignored — see `initialize`, which reports each
|
|
51
|
+
* one through `onError` rather than dropping it silently. Passing storage to an
|
|
52
|
+
* SDK that owns its own storage should not look like it worked.
|
|
45
53
|
*/
|
|
46
|
-
interface
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
interface AdvenueConfig {
|
|
55
|
+
apiKey: string;
|
|
56
|
+
endpoint?: string;
|
|
57
|
+
platform?: 'ios' | 'android' | 'web' | string;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated Ignored: the native SDK resolves the app version from the
|
|
60
|
+
* package/bundle. Passing it reports `config.ignored:appVersion` via
|
|
61
|
+
* `onError`. Removed in the next major.
|
|
62
|
+
*/
|
|
63
|
+
appVersion?: string;
|
|
64
|
+
osVersion?: string;
|
|
65
|
+
/** Gates every event on `setTrackingConsent(true)`. */
|
|
66
|
+
requireConsent?: boolean;
|
|
67
|
+
/** Events per request. */
|
|
68
|
+
batchSize?: number;
|
|
69
|
+
/** Auto-flush period in milliseconds; 0 disables the timer. */
|
|
70
|
+
flushIntervalMs?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Per-key HMAC secret. The signature provides integrity and replay
|
|
73
|
+
* protection, not authentication: anything inside an app binary can be
|
|
74
|
+
* extracted from it.
|
|
75
|
+
*/
|
|
76
|
+
signingSecret?: string;
|
|
77
|
+
disableAutoSessions?: boolean;
|
|
78
|
+
/** Called when the SDK swallows a best-effort failure. Never receives PII. */
|
|
79
|
+
onError?: (context: string, cause: unknown) => void;
|
|
80
|
+
debug?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type TrackingAuthorizationStatus = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';
|
|
84
|
+
/** What `bridgeInitialize` accepts. Anything absent takes the native default. */
|
|
85
|
+
interface BridgeInitOptions {
|
|
86
|
+
apiKey: string;
|
|
87
|
+
endpoint?: string;
|
|
88
|
+
requireConsent: boolean;
|
|
89
|
+
batchSize?: number;
|
|
90
|
+
flushIntervalMs?: number;
|
|
91
|
+
signingSecret?: string;
|
|
92
|
+
/** Meta app id, for the Meta install referrer. Android only. */
|
|
93
|
+
fbAppId?: string;
|
|
94
|
+
autoTrackInstall: boolean;
|
|
95
|
+
/** Stamped by this package, never by the host app. */
|
|
96
|
+
sdkVersion: string;
|
|
65
97
|
}
|
|
66
98
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* `
|
|
99
|
+
* One diagnostic the SDK swallowed, on its way back to JavaScript.
|
|
100
|
+
*
|
|
101
|
+
* `context` is a stable dot-path identifier of the step that failed
|
|
102
|
+
* (`identity.deferred`, `track.rejected:name_too_long`, `flush.transport`), not
|
|
103
|
+
* a message to show a user. Never carries PII.
|
|
71
104
|
*/
|
|
72
|
-
interface
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
interface NativeErrorEvent {
|
|
106
|
+
context: string;
|
|
107
|
+
message: string;
|
|
75
108
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* the app already.
|
|
99
|
-
*
|
|
100
|
-
* Rejects when:
|
|
101
|
-
* - ECONFIG: `io.advenue.INTEGRITY_CLOUD_PROJECT_NUMBER` meta-data is absent.
|
|
102
|
-
* - EUNSUPPORTED: Play Services unavailable or provider warming failed.
|
|
103
|
-
* - EINTEGRITY: Play returned an API-level error (network, quota, etc.).
|
|
104
|
-
*
|
|
105
|
-
* The JS bridge treats any rejection as "no attestation" and omits the token
|
|
106
|
-
* from the install event — rejection must never block the install track call.
|
|
107
|
-
*/
|
|
108
|
-
getIntegrityToken(requestHash: string): Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Device metadata (model, locale, screen, cpu, storage, timezone) used to
|
|
111
|
-
* populate Meta CAPI `extinfo` (Task 3n). Synchronous, best-effort — the JS
|
|
112
|
-
* facade (`collectDeviceInfo`) treats a thrown error as "unavailable" and
|
|
113
|
-
* degrades to `{}` rather than blocking anything.
|
|
114
|
-
*/
|
|
115
|
-
getDeviceInfo(): AdvenueDeviceInfo;
|
|
116
|
-
/**
|
|
117
|
-
* Built-in SDK storage (SharedPreferences `io.advenue.sdk`, MODE_PRIVATE) —
|
|
118
|
-
* the durable offline buffer + SDK state, so the app never supplies storage.
|
|
119
|
-
* Optional: absent on native builds predating this capability; the RN facade
|
|
120
|
-
* feature-detects and falls back to in-memory buffering. (No secure variant:
|
|
121
|
-
* Android has no reinstall-durable store — a reinstall legitimately re-fires
|
|
122
|
-
* the install, which the backend per-device window deduplicates.)
|
|
123
|
-
*/
|
|
124
|
-
storageGetItem?(key: string): string | null;
|
|
125
|
-
storageSetItem?(key: string, value: string): void;
|
|
126
|
-
storageRemoveItem?(key: string): void;
|
|
127
|
-
/**
|
|
128
|
-
* Android SSAID (Settings.Secure.ANDROID_ID) — signing-key-scoped, stable
|
|
129
|
-
* across reinstalls. The RN facade reads it ONLY when no usable GAID exists
|
|
130
|
-
* (Adjust-style fallback) and it is used strictly as a first-party
|
|
131
|
-
* fraud/dedup + reinstall-detection signal, never for ad attribution (Play
|
|
132
|
-
* policy). Optional: absent on older native builds; feature-detected.
|
|
133
|
-
*/
|
|
134
|
-
getAndroidId?(): string | null;
|
|
135
|
-
/**
|
|
136
|
-
* IAB TCF v2 CMP data, null when no CMP has written TCF keys. Optional:
|
|
137
|
-
* older native builds lack it — callers feature-detect (getAndroidId
|
|
138
|
-
* precedent).
|
|
139
|
-
*/
|
|
140
|
-
getTcfData?(): NativeTcfData | null;
|
|
109
|
+
/** The methods both native modules implement. */
|
|
110
|
+
interface AdvenueBridge {
|
|
111
|
+
/** Expo's event subscription, used for `onAdvenueError`. */
|
|
112
|
+
addListener?(name: 'onAdvenueError', handler: (event: NativeErrorEvent) => void): {
|
|
113
|
+
remove(): void;
|
|
114
|
+
};
|
|
115
|
+
bridgeInitialize(options: BridgeInitOptions): void;
|
|
116
|
+
bridgeTrack(name: string, properties: Record<string, unknown> | null): void;
|
|
117
|
+
bridgeFlush(): void;
|
|
118
|
+
bridgeSetUserId(id: string | null): void;
|
|
119
|
+
bridgeSetConsent(granted: boolean): void;
|
|
120
|
+
/** Reads the persisted value; the JavaScript consent cache is seeded from it. */
|
|
121
|
+
bridgeGetConsent(): boolean;
|
|
122
|
+
bridgeSetConsentData(consent: Consent): void;
|
|
123
|
+
bridgeGetConsentData(): Consent | null;
|
|
124
|
+
bridgeSetAppInstanceId(id: string | null): void;
|
|
125
|
+
bridgeSetPushToken(token: string | null, provider: string | null): void;
|
|
126
|
+
bridgeProcessDeepLink(url: string): void;
|
|
127
|
+
bridgeForgetMe(): void;
|
|
128
|
+
bridgeShutdown(): void;
|
|
129
|
+
bridgeResolvedAppId(): string | null;
|
|
130
|
+
bridgeResolveDeferredDeepLink(): Promise<DeepLink | null>;
|
|
141
131
|
}
|
|
142
|
-
|
|
143
|
-
interface AdvenueIosNativeModule {
|
|
144
|
-
registerAppForAttribution(): void;
|
|
132
|
+
interface AdvenueIosNativeModule extends AdvenueBridge {
|
|
145
133
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
134
|
+
* The app's price string ("9.99"), not micros. The conversion to exact
|
|
135
|
+
* micros happens natively: a money computation in JavaScript is the thing
|
|
136
|
+
* this release removed.
|
|
148
137
|
*/
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
|
|
138
|
+
bridgeRecordSkanRevenue(amount: string, currency: string): void;
|
|
139
|
+
/** Resolves synchronously on the native side; a Promise across the bridge. */
|
|
140
|
+
bridgeDeviceId(): Promise<string | null>;
|
|
152
141
|
/**
|
|
153
142
|
* Shows the ATT consent prompt; requires NSUserTrackingUsageDescription in
|
|
154
143
|
* the app's Info.plist. Resolves with the resulting status.
|
|
144
|
+
*
|
|
145
|
+
* Still a capability rather than a bridge call because the app chooses when
|
|
146
|
+
* to prompt, and that decision belongs to the app's UX, not the SDK.
|
|
155
147
|
*/
|
|
156
148
|
requestTrackingAuthorization(): Promise<TrackingAuthorizationStatus>;
|
|
157
|
-
getTrackingAuthorizationStatus(): TrackingAuthorizationStatus;
|
|
158
|
-
getAdvertisingId(): Promise<string | null>;
|
|
159
|
-
/** Vendor-scoped device id (IDFV) — available without ATT; a fallback anchor. */
|
|
160
|
-
getIdentifierForVendor(): string | null;
|
|
161
|
-
/**
|
|
162
|
-
* G3.2n — App Attest. Generates (or reuses a keychain-cached) DCAppAttest
|
|
163
|
-
* key, computes clientDataHash = SHA-256(challenge), and calls
|
|
164
|
-
* DCAppAttestService.attestKey. Resolves { keyId, attestationObject } where
|
|
165
|
-
* attestationObject is a base64-encoded CBOR attestation for the server.
|
|
166
|
-
* Rejects with code EUNSUPPORTED on simulators (isSupported == false).
|
|
167
|
-
*/
|
|
168
|
-
attestKey(challenge: string): Promise<{
|
|
169
|
-
keyId: string;
|
|
170
|
-
attestationObject: string;
|
|
171
|
-
}>;
|
|
172
|
-
/**
|
|
173
|
-
* G3.3n — DeviceCheck. Calls DCDevice.current.generateToken to obtain the
|
|
174
|
-
* opaque base64 token that identifies this physical device to the Apple
|
|
175
|
-
* DeviceCheck API. The server queries/updates the persistent 2-bit per-device
|
|
176
|
-
* flag to detect reinstall abuse. Rejects with code EUNSUPPORTED on devices
|
|
177
|
-
* where DCDevice.current.isSupported is false (simulator, Catalyst, etc.).
|
|
178
|
-
*/
|
|
179
|
-
getDeviceCheckToken(): Promise<string>;
|
|
180
|
-
/**
|
|
181
|
-
* Device metadata (model, locale, screen, cpu, storage, timezone) used to
|
|
182
|
-
* populate Meta CAPI `extinfo` (Task 3n). Synchronous, best-effort — the JS
|
|
183
|
-
* facade (`collectDeviceInfo`) treats a thrown error as "unavailable" and
|
|
184
|
-
* degrades to `{}` rather than blocking anything.
|
|
185
|
-
*/
|
|
186
|
-
getDeviceInfo(): AdvenueDeviceInfo;
|
|
187
|
-
/**
|
|
188
|
-
* Built-in SDK storage (UserDefaults suite `io.advenue.sdk`) — the durable
|
|
189
|
-
* offline buffer + SDK state, so the app never supplies storage. Optional:
|
|
190
|
-
* absent on native builds predating this capability; the RN facade
|
|
191
|
-
* feature-detects and falls back to in-memory buffering.
|
|
192
|
-
*/
|
|
193
|
-
storageGetItem?(key: string): string | null;
|
|
194
|
-
storageSetItem?(key: string, value: string): void;
|
|
195
|
-
storageRemoveItem?(key: string): void;
|
|
196
|
-
/**
|
|
197
|
-
* Built-in secure storage (Keychain, kSecAttrAccessibleAfterFirstUnlock,
|
|
198
|
-
* ThisDeviceOnly) — survives app reinstall, which is what makes the device
|
|
199
|
-
* identity and the install guard reinstall-resilient (Adjust-style).
|
|
200
|
-
* Optional: absent on older native builds; feature-detected.
|
|
201
|
-
*/
|
|
202
|
-
secureGetItem?(key: string): string | null;
|
|
203
|
-
secureSetItem?(key: string, value: string): void;
|
|
204
|
-
secureRemoveItem?(key: string): void;
|
|
205
|
-
/**
|
|
206
|
-
* IAB TCF v2 CMP data, null when no CMP has written TCF keys. Optional:
|
|
207
|
-
* older native builds lack it — callers feature-detect (getAndroidId
|
|
208
|
-
* precedent).
|
|
209
|
-
*/
|
|
210
|
-
getTcfData?(): NativeTcfData | null;
|
|
211
149
|
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
|
|
215
|
-
* locally so this package needs no expo types at compile time — the app passes
|
|
216
|
-
* the module (`import * as SecureStore from 'expo-secure-store'`) at runtime.
|
|
217
|
-
*/
|
|
218
|
-
interface SecureStoreLike {
|
|
219
|
-
getItemAsync(key: string): Promise<string | null>;
|
|
220
|
-
setItemAsync(key: string, value: string): Promise<void>;
|
|
221
|
-
/** Optional — forwarded so GDPR erasure can wipe the durable entries. */
|
|
222
|
-
deleteItemAsync?(key: string): Promise<void>;
|
|
150
|
+
interface AdvenueAndroidNativeModule extends AdvenueBridge {
|
|
151
|
+
/** Synchronous on Android: the identity is resolved before start returns. */
|
|
152
|
+
bridgeDeviceId(): string | null;
|
|
223
153
|
}
|
|
224
|
-
/** Wraps expo-secure-store as an Advenue SecureStorageAdapter (async, durable). */
|
|
225
|
-
declare function createSecureStore(secureStore: SecureStoreLike): SecureStorageAdapter;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Parses an OS-delivered link (Universal Link, App Link, or custom scheme) into
|
|
229
|
-
* the unified {@link DeepLink} shape. The `deepLinkValue` is a best-effort path
|
|
230
|
-
* (host + path for custom schemes, path for http(s)); the raw `url` is always
|
|
231
|
-
* provided so the host app can parse it itself when needed.
|
|
232
|
-
*/
|
|
233
|
-
declare function parseDirectLink(url: string): DeepLink;
|
|
234
154
|
|
|
235
155
|
/**
|
|
236
156
|
* Lazy access to the native modules that ship inside this package (ios/ and
|
|
@@ -241,147 +161,94 @@ declare function parseDirectLink(url: string): DeepLink;
|
|
|
241
161
|
*/
|
|
242
162
|
declare function getIosNative(): AdvenueIosNativeModule | null;
|
|
243
163
|
declare function getAndroidNative(): AdvenueAndroidNativeModule | null;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Resolves the device advertising id (IDFA on iOS, GAID on Android), gates it
|
|
247
|
-
* on ATT authorization status (iOS) / limitAdTracking flag (Android), and on
|
|
248
|
-
* DMA consent when the user is subject to GDPR. Pushes the result — or an
|
|
249
|
-
* empty object to clear — into the active client via `setAdvertisingId`.
|
|
250
|
-
*
|
|
251
|
-
* Fire-and-forget at call sites; errors are suppressed internally.
|
|
252
|
-
*/
|
|
253
|
-
declare function resolveAdvertisingId(): Promise<void>;
|
|
254
164
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* set manually this session, the native module or its getter is absent, no
|
|
259
|
-
* TCF data exists, or the freshly-mapped consent is identical to what the
|
|
260
|
-
* client already has (skip-if-unchanged: avoids re-persisting to storage and
|
|
261
|
-
* re-firing the ad-id resolve on every foreground when nothing changed):
|
|
262
|
-
* absent/unchanged consent must stay untouched, never fabricated or re-churned.
|
|
263
|
-
*
|
|
264
|
-
* Must be called after `Advenue.initialize()` — like every facade method, it
|
|
265
|
-
* throws via the uninitialized guard otherwise.
|
|
165
|
+
* Lazy access to React Native's Platform.OS ('ios' | 'android' | 'web' |
|
|
166
|
+
* 'windows' | 'macos'). Returns null when react-native isn't resolvable, so
|
|
167
|
+
* callers can require an explicit platform instead of guessing.
|
|
266
168
|
*/
|
|
267
|
-
declare function
|
|
169
|
+
declare function getPlatformOS(): string | null;
|
|
170
|
+
|
|
268
171
|
/**
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* Go, or an older native build predating this method). Never throws — any
|
|
274
|
-
* native-side error degrades to an empty object so callers can unconditionally
|
|
275
|
-
* pass the result through.
|
|
172
|
+
* Parses an OS-delivered link (Universal Link, App Link, or custom scheme) into
|
|
173
|
+
* the unified {@link DeepLink} shape. The `deepLinkValue` is a best-effort path
|
|
174
|
+
* (host + path for custom schemes, path for http(s)); the raw `url` is always
|
|
175
|
+
* provided so the host app can parse it itself when needed.
|
|
276
176
|
*/
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
* `web`.
|
|
296
|
-
*/
|
|
297
|
-
platform?: AdvenueConfig['platform'];
|
|
298
|
-
/**
|
|
299
|
-
* @internal Storage override (tests / custom embeddings). The SDK persists
|
|
300
|
-
* via its own native modules (UserDefaults/SharedPreferences) — apps never
|
|
301
|
-
* supply storage. When set, it replaces the built-in native storage.
|
|
302
|
-
*/
|
|
303
|
-
mmkv?: MMKVLike;
|
|
304
|
-
/**
|
|
305
|
-
* @internal Secure-store override (tests / custom embeddings). The SDK uses
|
|
306
|
-
* its own Keychain-backed native storage on iOS for the reinstall-resilient
|
|
307
|
-
* device identity — apps never supply a secure store. When set, it replaces
|
|
308
|
-
* the built-in Keychain adapter.
|
|
309
|
-
*/
|
|
310
|
-
secureStore?: SecureStoreLike;
|
|
177
|
+
declare function parseDirectLink(url: string): DeepLink;
|
|
178
|
+
|
|
179
|
+
interface RNAdvenueConfig extends AdvenueConfig {
|
|
180
|
+
/** Meta app id, for the Meta install referrer on Android. */
|
|
181
|
+
fbAppId?: string;
|
|
182
|
+
/** Fires automatically unless set to false. */
|
|
183
|
+
autoTrackInstall?: boolean;
|
|
184
|
+
/** Called when a link resolves, deferred or direct. */
|
|
185
|
+
onDeepLink?: (link: DeepLink) => void;
|
|
186
|
+
/** Firebase App Instance ID, if the app has Firebase Analytics. */
|
|
187
|
+
appInstanceIdProvider?: () => Promise<string | null>;
|
|
188
|
+
/** Accepted and ignored — the native SDKs own storage. */
|
|
189
|
+
mmkv?: unknown;
|
|
190
|
+
secureStore?: unknown;
|
|
191
|
+
sdkConfigFetcher?: unknown;
|
|
192
|
+
tcfDataCollection?: boolean;
|
|
193
|
+
}
|
|
194
|
+
declare const Advenue: {
|
|
311
195
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
* links (resolved after an attributed install). The SDK never navigates — the
|
|
315
|
-
* host app reads `link.deepLinkValue` and routes. Inspect `link.isDeferred`
|
|
316
|
-
* to distinguish the two. Omit to disable deep-link handling entirely.
|
|
196
|
+
* Starts the SDK. Safe to call from the app's entry point, and safe to call
|
|
197
|
+
* twice: the native side replaces its previous instance.
|
|
317
198
|
*/
|
|
318
|
-
|
|
199
|
+
initialize(config: RNAdvenueConfig): Promise<void>;
|
|
200
|
+
track(name: string, properties?: Record<string, unknown>): void;
|
|
201
|
+
/** Adds exact local revenue to Apple's conversion-value state. iOS only. */
|
|
202
|
+
recordSkanRevenue(input: {
|
|
203
|
+
amount: string;
|
|
204
|
+
currency: string;
|
|
205
|
+
}): Promise<void>;
|
|
206
|
+
setAppInstanceId(id: string | null): void;
|
|
319
207
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
208
|
+
* Cross-device linking: associates subsequent events with your user id.
|
|
209
|
+
* Pass null to clear.
|
|
210
|
+
*
|
|
211
|
+
* New on this object. The previous release reached it through the client
|
|
212
|
+
* `initialize()` resolved to, and that client no longer exists — so it is
|
|
213
|
+
* promoted here rather than dropped, which is what an app following the
|
|
214
|
+
* documented cross-device recipe would otherwise hit at runtime.
|
|
324
215
|
*/
|
|
325
|
-
|
|
216
|
+
setUserId(id: string | null): void;
|
|
326
217
|
/**
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
218
|
+
* Registers the device's push token for uninstall measurement.
|
|
219
|
+
*
|
|
220
|
+
* Advenue never requests the notification permission and never displays
|
|
221
|
+
* anything: pass the token your push library already produced, on every
|
|
222
|
+
* launch and from its refresh listener. A stale token is the one thing that
|
|
223
|
+
* makes uninstall measurement report churn that did not happen.
|
|
332
224
|
*/
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Maps a React Native AppState status to the client's session lifecycle hooks.
|
|
337
|
-
* Exported for testing. 'inactive' (transient on iOS) is intentionally ignored
|
|
338
|
-
* so brief interruptions (Control Center, incoming call) don't end the session.
|
|
339
|
-
*/
|
|
340
|
-
declare function applyAppState(client: Pick<AdvenueClient, 'notifyAppActive' | 'notifyAppBackground'>, status: string): void;
|
|
341
|
-
/**
|
|
342
|
-
* React Native entry point. Wires MMKV-backed offline buffering automatically
|
|
343
|
-
* and re-exports the same track surface as the core SDK.
|
|
344
|
-
*/
|
|
345
|
-
declare const Advenue: {
|
|
346
|
-
initialize(config: RNAdvenueConfig): Promise<AdvenueClient>;
|
|
347
|
-
track: (name: string, properties?: Record<string, unknown>, opts?: TrackOptions) => void;
|
|
225
|
+
setPushToken(token: string | null, provider?: "apns" | "fcm"): void;
|
|
348
226
|
/**
|
|
349
|
-
* Shows the iOS ATT prompt
|
|
350
|
-
*
|
|
227
|
+
* Shows the iOS ATT prompt. Where ATT does not exist (non-iOS, or the iOS
|
|
228
|
+
* module is absent) there is no prompt to show and no signal to read, so
|
|
229
|
+
* consent is left untouched and the call resolves 'unavailable'.
|
|
351
230
|
*/
|
|
352
231
|
requestTrackingAuthorization(): Promise<TrackingAuthorizationStatus>;
|
|
353
232
|
setTrackingConsent(granted: boolean): void;
|
|
354
233
|
getTrackingConsent: () => boolean;
|
|
355
|
-
/** GDPR/CCPA erasure: stop tracking and wipe local identifiers/queue. */
|
|
356
|
-
forgetMe(): void;
|
|
357
234
|
setConsentData(consent: Consent): void;
|
|
358
|
-
getConsentData: () =>
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
/** The Advenue ID — alias of getDeviceId (see AdvenueClient.getAdvenueId). */
|
|
367
|
-
getAdvenueId: () => string;
|
|
368
|
-
/** Which app the server resolved this API key to; null until a batch lands
|
|
369
|
-
* (see AdvenueClient.getResolvedAppId). */
|
|
235
|
+
getConsentData: () => Consent | null;
|
|
236
|
+
/** GDPR/CCPA erasure: stops tracking and wipes local identifiers and queue. */
|
|
237
|
+
forgetMe(): void;
|
|
238
|
+
flush(): void;
|
|
239
|
+
getDeviceId: () => Promise<string | null>;
|
|
240
|
+
/** The Advenue ID — alias of `getDeviceId`. */
|
|
241
|
+
getAdvenueId: () => Promise<string | null>;
|
|
242
|
+
/** Which app the server resolved this API key to; null until a batch lands. */
|
|
370
243
|
getResolvedAppId: () => string | null;
|
|
244
|
+
/**
|
|
245
|
+
* Resolves the deferred deep link for this install, or null for an organic
|
|
246
|
+
* one — which is most of them.
|
|
247
|
+
*/
|
|
248
|
+
resolveDeferredDeepLink(): Promise<DeepLink | null>;
|
|
371
249
|
shutdown(): void;
|
|
372
250
|
};
|
|
373
|
-
/**
|
|
374
|
-
|
|
375
|
-
* install referrers on Android, SKAdNetwork registration on iOS. Fired
|
|
376
|
-
* automatically by `initialize()` (or its consent deferral); when a
|
|
377
|
-
* `secureStore` is wired it fires at most once per device (reinstall-resilient
|
|
378
|
-
* on iOS via Keychain; Android re-fires after a reinstall, which is
|
|
379
|
-
* unavoidable post-GAID).
|
|
380
|
-
*
|
|
381
|
-
* @internal Exported for tests only — install tracking is automatic and this
|
|
382
|
-
* function is deliberately NOT on the `Advenue` facade. Do not call it from
|
|
383
|
-
* app code.
|
|
384
|
-
*/
|
|
385
|
-
declare function trackInstall(): Promise<void>;
|
|
251
|
+
/** The platform this build reports, for diagnostics. */
|
|
252
|
+
declare const platform: typeof getPlatformOS;
|
|
386
253
|
|
|
387
|
-
export { Advenue, type AdvenueAndroidNativeModule, type
|
|
254
|
+
export { Advenue, type AdvenueAndroidNativeModule, type AdvenueBridge, type AdvenueConfig, type AdvenueIosNativeModule, type BridgeInitOptions, type ClientEventType, type Consent, type DeepLink, type RNAdvenueConfig, type TrackOptions, type TrackingAuthorizationStatus, getAndroidNative, getIosNative, parseDirectLink, platform };
|