@advenue/react-native 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -7
- package/android/src/main/java/expo/modules/advenue/AdvenueAndroidModule.kt +118 -347
- package/android/src/main/kotlin/io/advenue/Advenue.kt +549 -0
- package/android/src/main/kotlin/io/advenue/AdvenueConfig.kt +114 -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 +186 -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 +414 -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 +47 -0
- package/android/src/main/kotlin/io/advenue/core/MetaReferrer.kt +80 -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 +149 -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 +91 -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 +183 -655
- package/dist/index.d.cts +199 -331
- package/dist/index.d.ts +199 -331
- package/dist/index.js +182 -661
- package/ios/AdvenueIosModule.swift +144 -432
- package/ios/vendor/Advenue/Advenue.swift +596 -0
- package/ios/vendor/Advenue/AdvenueConfig.swift +77 -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 +587 -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/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 +65 -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 +143 -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 +9 -11
- 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 +267 -803
- package/src/native-types.ts +74 -171
- package/src/native.ts +0 -23
- package/src/types.ts +81 -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,226 +1,152 @@
|
|
|
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
|
-
|
|
54
|
+
interface AdvenueConfig {
|
|
55
|
+
apiKey: string;
|
|
56
|
+
endpoint?: string;
|
|
57
|
+
platform?: 'ios' | 'android' | 'web' | string;
|
|
58
|
+
appVersion?: string;
|
|
59
|
+
osVersion?: string;
|
|
60
|
+
/** Gates every event on `setTrackingConsent(true)`. */
|
|
61
|
+
requireConsent?: boolean;
|
|
62
|
+
/** Events per request. */
|
|
63
|
+
batchSize?: number;
|
|
64
|
+
/** Auto-flush period in milliseconds; 0 disables the timer. */
|
|
65
|
+
flushIntervalMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Per-key HMAC secret. The signature provides integrity and replay
|
|
68
|
+
* protection, not authentication: anything inside an app binary can be
|
|
69
|
+
* extracted from it.
|
|
70
|
+
*/
|
|
71
|
+
signingSecret?: string;
|
|
72
|
+
disableAutoSessions?: boolean;
|
|
73
|
+
/** Called when the SDK swallows a best-effort failure. Never receives PII. */
|
|
74
|
+
onError?: (context: string, cause: unknown) => void;
|
|
75
|
+
debug?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type TrackingAuthorizationStatus = 'authorized' | 'denied' | 'restricted' | 'notDetermined' | 'unavailable';
|
|
79
|
+
/** What `bridgeInitialize` accepts. Anything absent takes the native default. */
|
|
80
|
+
interface BridgeInitOptions {
|
|
81
|
+
apiKey: string;
|
|
82
|
+
endpoint?: string;
|
|
83
|
+
appVersion?: string;
|
|
84
|
+
requireConsent: boolean;
|
|
85
|
+
batchSize?: number;
|
|
86
|
+
flushIntervalMs?: number;
|
|
87
|
+
signingSecret?: string;
|
|
88
|
+
/** Meta app id, for the Meta install referrer. Android only. */
|
|
89
|
+
fbAppId?: string;
|
|
90
|
+
autoTrackInstall: boolean;
|
|
91
|
+
/** Stamped by this package, never by the host app. */
|
|
92
|
+
sdkVersion: string;
|
|
57
93
|
}
|
|
58
94
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* `
|
|
95
|
+
* One diagnostic the SDK swallowed, on its way back to JavaScript.
|
|
96
|
+
*
|
|
97
|
+
* `context` is a stable dot-path identifier of the step that failed
|
|
98
|
+
* (`identity.deferred`, `track.rejected:name_too_long`, `flush.transport`), not
|
|
99
|
+
* a message to show a user. Never carries PII.
|
|
63
100
|
*/
|
|
64
|
-
interface
|
|
65
|
-
|
|
66
|
-
|
|
101
|
+
interface NativeErrorEvent {
|
|
102
|
+
context: string;
|
|
103
|
+
message: string;
|
|
67
104
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* Rejects when:
|
|
91
|
-
* - ECONFIG: `io.advenue.INTEGRITY_CLOUD_PROJECT_NUMBER` meta-data is absent.
|
|
92
|
-
* - EUNSUPPORTED: Play Services unavailable or provider warming failed.
|
|
93
|
-
* - EINTEGRITY: Play returned an API-level error (network, quota, etc.).
|
|
94
|
-
*
|
|
95
|
-
* The JS bridge treats any rejection as "no attestation" and omits the token
|
|
96
|
-
* from the install event — rejection must never block the install track call.
|
|
97
|
-
*/
|
|
98
|
-
getIntegrityToken(requestHash: string): Promise<string>;
|
|
99
|
-
/**
|
|
100
|
-
* Device metadata (model, locale, screen, cpu, storage, timezone) used to
|
|
101
|
-
* populate Meta CAPI `extinfo` (Task 3n). Synchronous, best-effort — the JS
|
|
102
|
-
* facade (`collectDeviceInfo`) treats a thrown error as "unavailable" and
|
|
103
|
-
* degrades to `{}` rather than blocking anything.
|
|
104
|
-
*/
|
|
105
|
-
getDeviceInfo(): AdvenueDeviceInfo;
|
|
106
|
-
/**
|
|
107
|
-
* Built-in SDK storage (SharedPreferences `io.advenue.sdk`, MODE_PRIVATE) —
|
|
108
|
-
* the durable offline buffer + SDK state, so the app never supplies storage.
|
|
109
|
-
* Optional: absent on native builds predating this capability; the RN facade
|
|
110
|
-
* feature-detects and falls back to in-memory buffering. (No secure variant:
|
|
111
|
-
* Android has no reinstall-durable store — a reinstall legitimately re-fires
|
|
112
|
-
* the install, which the backend per-device window deduplicates.)
|
|
113
|
-
*/
|
|
114
|
-
storageGetItem?(key: string): string | null;
|
|
115
|
-
storageSetItem?(key: string, value: string): void;
|
|
116
|
-
storageRemoveItem?(key: string): void;
|
|
117
|
-
/**
|
|
118
|
-
* Android SSAID (Settings.Secure.ANDROID_ID) — signing-key-scoped, stable
|
|
119
|
-
* across reinstalls. The RN facade reads it ONLY when no usable GAID exists
|
|
120
|
-
* (Adjust-style fallback) and it is used strictly as a first-party
|
|
121
|
-
* fraud/dedup + reinstall-detection signal, never for ad attribution (Play
|
|
122
|
-
* policy). Optional: absent on older native builds; feature-detected.
|
|
123
|
-
*/
|
|
124
|
-
getAndroidId?(): string | null;
|
|
125
|
-
/**
|
|
126
|
-
* IAB TCF v2 CMP data, null when no CMP has written TCF keys. Optional:
|
|
127
|
-
* older native builds lack it — callers feature-detect (getAndroidId
|
|
128
|
-
* precedent).
|
|
129
|
-
*/
|
|
130
|
-
getTcfData?(): NativeTcfData | null;
|
|
105
|
+
/** The methods both native modules implement. */
|
|
106
|
+
interface AdvenueBridge {
|
|
107
|
+
/** Expo's event subscription, used for `onAdvenueError`. */
|
|
108
|
+
addListener?(name: 'onAdvenueError', handler: (event: NativeErrorEvent) => void): {
|
|
109
|
+
remove(): void;
|
|
110
|
+
};
|
|
111
|
+
bridgeInitialize(options: BridgeInitOptions): void;
|
|
112
|
+
bridgeTrack(name: string, properties: Record<string, unknown> | null): void;
|
|
113
|
+
bridgeFlush(): void;
|
|
114
|
+
bridgeSetUserId(id: string | null): void;
|
|
115
|
+
bridgeSetConsent(granted: boolean): void;
|
|
116
|
+
/** Reads the persisted value; the JavaScript consent cache is seeded from it. */
|
|
117
|
+
bridgeGetConsent(): boolean;
|
|
118
|
+
bridgeSetConsentData(consent: Consent): void;
|
|
119
|
+
bridgeGetConsentData(): Consent | null;
|
|
120
|
+
bridgeSetAppInstanceId(id: string | null): void;
|
|
121
|
+
bridgeSetPushToken(token: string | null, provider: string | null): void;
|
|
122
|
+
bridgeProcessDeepLink(url: string): void;
|
|
123
|
+
bridgeForgetMe(): void;
|
|
124
|
+
bridgeShutdown(): void;
|
|
125
|
+
bridgeResolvedAppId(): string | null;
|
|
126
|
+
bridgeResolveDeferredDeepLink(): Promise<DeepLink | null>;
|
|
131
127
|
}
|
|
132
|
-
|
|
133
|
-
interface AdvenueIosNativeModule {
|
|
134
|
-
registerAppForAttribution(): void;
|
|
128
|
+
interface AdvenueIosNativeModule extends AdvenueBridge {
|
|
135
129
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
130
|
+
* The app's price string ("9.99"), not micros. The conversion to exact
|
|
131
|
+
* micros happens natively: a money computation in JavaScript is the thing
|
|
132
|
+
* this release removed.
|
|
138
133
|
*/
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
|
|
134
|
+
bridgeRecordSkanRevenue(amount: string, currency: string): void;
|
|
135
|
+
/** Resolves synchronously on the native side; a Promise across the bridge. */
|
|
136
|
+
bridgeDeviceId(): Promise<string | null>;
|
|
142
137
|
/**
|
|
143
138
|
* Shows the ATT consent prompt; requires NSUserTrackingUsageDescription in
|
|
144
139
|
* the app's Info.plist. Resolves with the resulting status.
|
|
140
|
+
*
|
|
141
|
+
* Still a capability rather than a bridge call because the app chooses when
|
|
142
|
+
* to prompt, and that decision belongs to the app's UX, not the SDK.
|
|
145
143
|
*/
|
|
146
144
|
requestTrackingAuthorization(): Promise<TrackingAuthorizationStatus>;
|
|
147
|
-
getTrackingAuthorizationStatus(): TrackingAuthorizationStatus;
|
|
148
|
-
getAdvertisingId(): Promise<string | null>;
|
|
149
|
-
/** Vendor-scoped device id (IDFV) — available without ATT; a fallback anchor. */
|
|
150
|
-
getIdentifierForVendor(): string | null;
|
|
151
|
-
/**
|
|
152
|
-
* G3.2n — App Attest. Generates (or reuses a keychain-cached) DCAppAttest
|
|
153
|
-
* key, computes clientDataHash = SHA-256(challenge), and calls
|
|
154
|
-
* DCAppAttestService.attestKey. Resolves { keyId, attestationObject } where
|
|
155
|
-
* attestationObject is a base64-encoded CBOR attestation for the server.
|
|
156
|
-
* Rejects with code EUNSUPPORTED on simulators (isSupported == false).
|
|
157
|
-
*/
|
|
158
|
-
attestKey(challenge: string): Promise<{
|
|
159
|
-
keyId: string;
|
|
160
|
-
attestationObject: string;
|
|
161
|
-
}>;
|
|
162
|
-
/**
|
|
163
|
-
* G3.3n — DeviceCheck. Calls DCDevice.current.generateToken to obtain the
|
|
164
|
-
* opaque base64 token that identifies this physical device to the Apple
|
|
165
|
-
* DeviceCheck API. The server queries/updates the persistent 2-bit per-device
|
|
166
|
-
* flag to detect reinstall abuse. Rejects with code EUNSUPPORTED on devices
|
|
167
|
-
* where DCDevice.current.isSupported is false (simulator, Catalyst, etc.).
|
|
168
|
-
*/
|
|
169
|
-
getDeviceCheckToken(): Promise<string>;
|
|
170
|
-
/**
|
|
171
|
-
* Device metadata (model, locale, screen, cpu, storage, timezone) used to
|
|
172
|
-
* populate Meta CAPI `extinfo` (Task 3n). Synchronous, best-effort — the JS
|
|
173
|
-
* facade (`collectDeviceInfo`) treats a thrown error as "unavailable" and
|
|
174
|
-
* degrades to `{}` rather than blocking anything.
|
|
175
|
-
*/
|
|
176
|
-
getDeviceInfo(): AdvenueDeviceInfo;
|
|
177
|
-
/**
|
|
178
|
-
* Built-in SDK storage (UserDefaults suite `io.advenue.sdk`) — the durable
|
|
179
|
-
* offline buffer + SDK state, so the app never supplies storage. Optional:
|
|
180
|
-
* absent on native builds predating this capability; the RN facade
|
|
181
|
-
* feature-detects and falls back to in-memory buffering.
|
|
182
|
-
*/
|
|
183
|
-
storageGetItem?(key: string): string | null;
|
|
184
|
-
storageSetItem?(key: string, value: string): void;
|
|
185
|
-
storageRemoveItem?(key: string): void;
|
|
186
|
-
/**
|
|
187
|
-
* Built-in secure storage (Keychain, kSecAttrAccessibleAfterFirstUnlock,
|
|
188
|
-
* ThisDeviceOnly) — survives app reinstall, which is what makes the device
|
|
189
|
-
* identity and the install guard reinstall-resilient (Adjust-style).
|
|
190
|
-
* Optional: absent on older native builds; feature-detected.
|
|
191
|
-
*/
|
|
192
|
-
secureGetItem?(key: string): string | null;
|
|
193
|
-
secureSetItem?(key: string, value: string): void;
|
|
194
|
-
secureRemoveItem?(key: string): void;
|
|
195
|
-
/**
|
|
196
|
-
* IAB TCF v2 CMP data, null when no CMP has written TCF keys. Optional:
|
|
197
|
-
* older native builds lack it — callers feature-detect (getAndroidId
|
|
198
|
-
* precedent).
|
|
199
|
-
*/
|
|
200
|
-
getTcfData?(): NativeTcfData | null;
|
|
201
145
|
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
|
|
205
|
-
* locally so this package needs no expo types at compile time — the app passes
|
|
206
|
-
* the module (`import * as SecureStore from 'expo-secure-store'`) at runtime.
|
|
207
|
-
*/
|
|
208
|
-
interface SecureStoreLike {
|
|
209
|
-
getItemAsync(key: string): Promise<string | null>;
|
|
210
|
-
setItemAsync(key: string, value: string): Promise<void>;
|
|
211
|
-
/** Optional — forwarded so GDPR erasure can wipe the durable entries. */
|
|
212
|
-
deleteItemAsync?(key: string): Promise<void>;
|
|
146
|
+
interface AdvenueAndroidNativeModule extends AdvenueBridge {
|
|
147
|
+
/** Synchronous on Android: the identity is resolved before start returns. */
|
|
148
|
+
bridgeDeviceId(): string | null;
|
|
213
149
|
}
|
|
214
|
-
/** Wraps expo-secure-store as an Advenue SecureStorageAdapter (async, durable). */
|
|
215
|
-
declare function createSecureStore(secureStore: SecureStoreLike): SecureStorageAdapter;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Parses an OS-delivered link (Universal Link, App Link, or custom scheme) into
|
|
219
|
-
* the unified {@link DeepLink} shape. The `deepLinkValue` is a best-effort path
|
|
220
|
-
* (host + path for custom schemes, path for http(s)); the raw `url` is always
|
|
221
|
-
* provided so the host app can parse it itself when needed.
|
|
222
|
-
*/
|
|
223
|
-
declare function parseDirectLink(url: string): DeepLink;
|
|
224
150
|
|
|
225
151
|
/**
|
|
226
152
|
* Lazy access to the native modules that ship inside this package (ios/ and
|
|
@@ -231,152 +157,94 @@ declare function parseDirectLink(url: string): DeepLink;
|
|
|
231
157
|
*/
|
|
232
158
|
declare function getIosNative(): AdvenueIosNativeModule | null;
|
|
233
159
|
declare function getAndroidNative(): AdvenueAndroidNativeModule | null;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Resolves the device advertising id (IDFA on iOS, GAID on Android), gates it
|
|
237
|
-
* on ATT authorization status (iOS) / limitAdTracking flag (Android), and on
|
|
238
|
-
* DMA consent when the user is subject to GDPR. Pushes the result — or an
|
|
239
|
-
* empty object to clear — into the active client via `setAdvertisingId`.
|
|
240
|
-
*
|
|
241
|
-
* Fire-and-forget at call sites; errors are suppressed internally.
|
|
242
|
-
*/
|
|
243
|
-
declare function resolveAdvertisingId(): Promise<void>;
|
|
244
160
|
/**
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* set manually this session, the native module or its getter is absent, no
|
|
249
|
-
* TCF data exists, or the freshly-mapped consent is identical to what the
|
|
250
|
-
* client already has (skip-if-unchanged: avoids re-persisting to storage and
|
|
251
|
-
* re-firing the ad-id resolve on every foreground when nothing changed):
|
|
252
|
-
* absent/unchanged consent must stay untouched, never fabricated or re-churned.
|
|
253
|
-
*
|
|
254
|
-
* Must be called after `Advenue.initialize()` — like every facade method, it
|
|
255
|
-
* throws via the uninitialized guard otherwise.
|
|
161
|
+
* Lazy access to React Native's Platform.OS ('ios' | 'android' | 'web' |
|
|
162
|
+
* 'windows' | 'macos'). Returns null when react-native isn't resolvable, so
|
|
163
|
+
* callers can require an explicit platform instead of guessing.
|
|
256
164
|
*/
|
|
257
|
-
declare function
|
|
165
|
+
declare function getPlatformOS(): string | null;
|
|
166
|
+
|
|
258
167
|
/**
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* Go, or an older native build predating this method). Never throws — any
|
|
264
|
-
* native-side error degrades to an empty object so callers can unconditionally
|
|
265
|
-
* pass the result through.
|
|
168
|
+
* Parses an OS-delivered link (Universal Link, App Link, or custom scheme) into
|
|
169
|
+
* the unified {@link DeepLink} shape. The `deepLinkValue` is a best-effort path
|
|
170
|
+
* (host + path for custom schemes, path for http(s)); the raw `url` is always
|
|
171
|
+
* provided so the host app can parse it itself when needed.
|
|
266
172
|
*/
|
|
267
|
-
declare function
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
173
|
+
declare function parseDirectLink(url: string): DeepLink;
|
|
174
|
+
|
|
175
|
+
interface RNAdvenueConfig extends AdvenueConfig {
|
|
176
|
+
/** Meta app id, for the Meta install referrer on Android. */
|
|
177
|
+
fbAppId?: string;
|
|
178
|
+
/** Fires automatically unless set to false. */
|
|
179
|
+
autoTrackInstall?: boolean;
|
|
180
|
+
/** Called when a link resolves, deferred or direct. */
|
|
181
|
+
onDeepLink?: (link: DeepLink) => void;
|
|
182
|
+
/** Firebase App Instance ID, if the app has Firebase Analytics. */
|
|
183
|
+
appInstanceIdProvider?: () => Promise<string | null>;
|
|
184
|
+
/** Accepted and ignored — the native SDKs own storage. */
|
|
185
|
+
mmkv?: unknown;
|
|
186
|
+
secureStore?: unknown;
|
|
187
|
+
sdkConfigFetcher?: unknown;
|
|
188
|
+
tcfDataCollection?: boolean;
|
|
189
|
+
}
|
|
190
|
+
declare const Advenue: {
|
|
284
191
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* supply storage. When set, it replaces the built-in native storage.
|
|
192
|
+
* Starts the SDK. Safe to call from the app's entry point, and safe to call
|
|
193
|
+
* twice: the native side replaces its previous instance.
|
|
288
194
|
*/
|
|
289
|
-
|
|
195
|
+
initialize(config: RNAdvenueConfig): Promise<void>;
|
|
196
|
+
track(name: string, properties?: Record<string, unknown>): void;
|
|
197
|
+
/** Adds exact local revenue to Apple's conversion-value state. iOS only. */
|
|
198
|
+
recordSkanRevenue(input: {
|
|
199
|
+
amount: string;
|
|
200
|
+
currency: string;
|
|
201
|
+
}): Promise<void>;
|
|
202
|
+
setAppInstanceId(id: string | null): void;
|
|
290
203
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* Your app's Advenue appId (the UUID in Settings → API Keys). When set on
|
|
294
|
-
* Android, the automatic install obtains a Play Integrity Standard token and
|
|
295
|
-
* attaches it to the install event. The requestHash is computed as
|
|
296
|
-
* `sha256Hex("<appId>:<deviceId>")`, matching the server's verification
|
|
297
|
-
* formula exactly (see `makeDecodeAndroid` in the worker).
|
|
204
|
+
* Cross-device linking: associates subsequent events with your user id.
|
|
205
|
+
* Pass null to clear.
|
|
298
206
|
*
|
|
299
|
-
*
|
|
207
|
+
* New on this object. The previous release reached it through the client
|
|
208
|
+
* `initialize()` resolved to, and that client no longer exists — so it is
|
|
209
|
+
* promoted here rather than dropped, which is what an app following the
|
|
210
|
+
* documented cross-device recipe would otherwise hit at runtime.
|
|
300
211
|
*/
|
|
301
|
-
|
|
212
|
+
setUserId(id: string | null): void;
|
|
302
213
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* the
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Unified deep-link callback (AppsFlyer UDL style). Fires for both direct
|
|
311
|
-
* Universal/App Links (the OS opened the app via a link) and deferred deep
|
|
312
|
-
* links (resolved after an attributed install). The SDK never navigates — the
|
|
313
|
-
* host app reads `link.deepLinkValue` and routes. Inspect `link.isDeferred`
|
|
314
|
-
* to distinguish the two. Omit to disable deep-link handling entirely.
|
|
315
|
-
*/
|
|
316
|
-
onDeepLink?: (link: DeepLink) => void;
|
|
317
|
-
/**
|
|
318
|
-
* @internal Test hook — disables the automatic install fired by
|
|
319
|
-
* `initialize()`. Install tracking is always automatic in production (there
|
|
320
|
-
* is no public `trackInstall`); tests turn it off to exercise the internal
|
|
321
|
-
* install path deterministically.
|
|
214
|
+
* Registers the device's push token for uninstall measurement.
|
|
215
|
+
*
|
|
216
|
+
* Advenue never requests the notification permission and never displays
|
|
217
|
+
* anything: pass the token your push library already produced, on every
|
|
218
|
+
* launch and from its refresh listener. A stale token is the one thing that
|
|
219
|
+
* makes uninstall measurement report churn that did not happen.
|
|
322
220
|
*/
|
|
323
|
-
|
|
221
|
+
setPushToken(token: string | null, provider?: "apns" | "fcm"): void;
|
|
324
222
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* foreground, so a CMP decision made after startup lands on later events.
|
|
329
|
-
* A manual `setConsentData()` call always wins. Default false.
|
|
330
|
-
*/
|
|
331
|
-
tcfDataCollection?: boolean;
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Maps a React Native AppState status to the client's session lifecycle hooks.
|
|
335
|
-
* Exported for testing. 'inactive' (transient on iOS) is intentionally ignored
|
|
336
|
-
* so brief interruptions (Control Center, incoming call) don't end the session.
|
|
337
|
-
*/
|
|
338
|
-
declare function applyAppState(client: Pick<AdvenueClient, 'notifyAppActive' | 'notifyAppBackground'>, status: string): void;
|
|
339
|
-
/**
|
|
340
|
-
* React Native entry point. Wires MMKV-backed offline buffering automatically
|
|
341
|
-
* and re-exports the same track surface as the core SDK.
|
|
342
|
-
*/
|
|
343
|
-
declare const Advenue: {
|
|
344
|
-
initialize(config: RNAdvenueConfig): Promise<AdvenueClient>;
|
|
345
|
-
track: (name: string, properties?: Record<string, unknown>, opts?: TrackOptions) => void;
|
|
346
|
-
/**
|
|
347
|
-
* Shows the iOS ATT prompt (resolves 'authorized' immediately on Android/web,
|
|
348
|
-
* where ATT doesn't exist) and forwards the result to the consent gate.
|
|
223
|
+
* Shows the iOS ATT prompt. Where ATT does not exist (non-iOS, or the iOS
|
|
224
|
+
* module is absent) there is no prompt to show and no signal to read, so
|
|
225
|
+
* consent is left untouched and the call resolves 'unavailable'.
|
|
349
226
|
*/
|
|
350
227
|
requestTrackingAuthorization(): Promise<TrackingAuthorizationStatus>;
|
|
351
228
|
setTrackingConsent(granted: boolean): void;
|
|
352
229
|
getTrackingConsent: () => boolean;
|
|
353
|
-
/** GDPR/CCPA erasure: stop tracking and wipe local identifiers/queue. */
|
|
354
|
-
forgetMe(): void;
|
|
355
230
|
setConsentData(consent: Consent): void;
|
|
356
|
-
getConsentData: () =>
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
231
|
+
getConsentData: () => Consent | null;
|
|
232
|
+
/** GDPR/CCPA erasure: stops tracking and wipes local identifiers and queue. */
|
|
233
|
+
forgetMe(): void;
|
|
234
|
+
flush(): void;
|
|
235
|
+
getDeviceId: () => Promise<string | null>;
|
|
236
|
+
/** The Advenue ID — alias of `getDeviceId`. */
|
|
237
|
+
getAdvenueId: () => Promise<string | null>;
|
|
238
|
+
/** Which app the server resolved this API key to; null until a batch lands. */
|
|
239
|
+
getResolvedAppId: () => string | null;
|
|
240
|
+
/**
|
|
241
|
+
* Resolves the deferred deep link for this install, or null for an organic
|
|
242
|
+
* one — which is most of them.
|
|
243
|
+
*/
|
|
244
|
+
resolveDeferredDeepLink(): Promise<DeepLink | null>;
|
|
366
245
|
shutdown(): void;
|
|
367
246
|
};
|
|
368
|
-
/**
|
|
369
|
-
|
|
370
|
-
* install referrers on Android, SKAdNetwork registration on iOS. Fired
|
|
371
|
-
* automatically by `initialize()` (or its consent deferral); when a
|
|
372
|
-
* `secureStore` is wired it fires at most once per device (reinstall-resilient
|
|
373
|
-
* on iOS via Keychain; Android re-fires after a reinstall, which is
|
|
374
|
-
* unavoidable post-GAID).
|
|
375
|
-
*
|
|
376
|
-
* @internal Exported for tests only — install tracking is automatic and this
|
|
377
|
-
* function is deliberately NOT on the `Advenue` facade. Do not call it from
|
|
378
|
-
* app code.
|
|
379
|
-
*/
|
|
380
|
-
declare function trackInstall(): Promise<void>;
|
|
247
|
+
/** The platform this build reports, for diagnostics. */
|
|
248
|
+
declare const platform: typeof getPlatformOS;
|
|
381
249
|
|
|
382
|
-
export { Advenue, type AdvenueAndroidNativeModule, type
|
|
250
|
+
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 };
|