@layers/react-native 1.4.11 → 2.1.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.
@@ -1,187 +0,0 @@
1
- import { t as ATTStatus } from "./att-BFy6dcWE.js";
2
- import { n as SKANManager } from "./skan-DupmPyTn.js";
3
- import { ConsentState, ConsentState as ConsentState$1, DeviceContext, DeviceContext as DeviceContext$1, Environment, Environment as Environment$1, EventProperties, EventProperties as EventProperties$1, LayersError, UserProperties, UserProperties as UserProperties$1 } from "@layers/core-wasm";
4
-
5
- //#region src/index.d.ts
6
-
7
- interface LayersRNConfig {
8
- appId: string;
9
- environment: Environment;
10
- appUserId?: string;
11
- enableDebug?: boolean;
12
- baseUrl?: string;
13
- flushIntervalMs?: number;
14
- flushThreshold?: number;
15
- maxQueueSize?: number;
16
- /**
17
- * Whether to automatically fire an `app_open` event during init().
18
- * Set to `false` if you want to fire the event manually.
19
- * @default true
20
- */
21
- autoTrackAppOpen?: boolean;
22
- /**
23
- * Whether to automatically track `deep_link_opened` events when a deep link
24
- * is received. The tracked event includes the parsed URL components and all
25
- * query parameters (UTM params, click IDs like fbclid/gclid/ttclid, etc.)
26
- * as flat top-level properties.
27
- *
28
- * This listener runs in addition to any consumer-registered listener via
29
- * `setupDeepLinkListener()` -- it does not replace it.
30
- *
31
- * @default true
32
- */
33
- autoTrackDeepLinks?: boolean;
34
- }
35
- type ErrorListener = (error: Error) => void;
36
- declare class LayersReactNative {
37
- private core;
38
- private appUserId;
39
- private isOnline;
40
- private readonly enableDebug;
41
- private appStateSubscription;
42
- private netInfoUnsubscribe;
43
- private readonly config;
44
- private userIdLocked;
45
- private readonly errorListeners;
46
- private _skanManager;
47
- private _lastSkanConfigStr;
48
- private deepLinkUnsubscribe;
49
- private _configPollTimer;
50
- private static readonly CONFIG_POLL_INTERVAL_MS;
51
- private _adServicesToken;
52
- private _installReferrer;
53
- constructor(config: LayersRNConfig);
54
- init(): Promise<void>;
55
- track(eventName: string, properties?: EventProperties): void;
56
- screen(screenName: string, properties?: EventProperties): void;
57
- setUserProperties(properties: UserProperties): Promise<void>;
58
- setUserPropertiesOnce(properties: UserProperties): Promise<void>;
59
- setConsent(consent: ConsentState): Promise<void>;
60
- /**
61
- * Request App Tracking Transparency authorization (iOS only).
62
- * After the user responds, this method automatically:
63
- * - Collects IDFA if authorized
64
- * - Updates device info with IDFA and ATT status
65
- * - Sets advertising consent based on ATT result
66
- *
67
- * Returns the ATT status string.
68
- */
69
- requestTrackingPermission(): Promise<ATTStatus>;
70
- /**
71
- * Set the app user ID. Uses set-user-once semantics:
72
- * once set, subsequent calls are ignored until clearAppUserId() is called.
73
- */
74
- setAppUserId(appUserId: string): void;
75
- clearAppUserId(): void;
76
- /**
77
- * Reset the SDK state: clears the user ID, unlocks set-user-once,
78
- * clears user properties, and starts a new session.
79
- *
80
- * After reset(), the SDK behaves as if no user has been identified.
81
- * A new anonymous session is started. Events tracked after reset()
82
- * will not carry the previous user's identity.
83
- */
84
- reset(): void;
85
- getAppUserId(): string | undefined;
86
- getSessionId(): string;
87
- getConsentState(): ConsentState;
88
- setDeviceInfo(deviceInfo: DeviceContext): void;
89
- flush(): Promise<void>;
90
- /**
91
- * Flush all queued events synchronously (blocking).
92
- *
93
- * Drains all batches from the queue and sends them via HTTP, awaiting
94
- * each batch before proceeding. Does not return until all batches have
95
- * been sent or failed.
96
- *
97
- * This is useful for AppState background transitions where the app may
98
- * be suspended shortly after the call returns.
99
- */
100
- flushBlocking(): Promise<void>;
101
- /**
102
- * Register an error listener. Errors from track/screen/flush
103
- * that would otherwise be silently dropped are forwarded here.
104
- */
105
- on(event: 'error', listener: ErrorListener): this;
106
- /**
107
- * Remove a previously registered error listener.
108
- */
109
- off(event: 'error', listener: ErrorListener): this;
110
- /**
111
- * Returns the AdServices attribution token (iOS only), or null if not
112
- * available. Collected automatically during init() on iOS 14.3+.
113
- * Does NOT require ATT consent.
114
- */
115
- getAdServicesToken(): string | null;
116
- /**
117
- * Returns the Google Play install referrer data (Android only), or null
118
- * if not available. Collected automatically during init() on Android.
119
- */
120
- getInstallReferrer(): InstallReferrerData | null;
121
- /**
122
- * Returns the auto-configured SKANManager instance, or null if SKAN was not
123
- * configured by the server's remote config.
124
- * On iOS, when remote config contains a `skan` section with `preset` or
125
- * `customRules`, the SDK automatically creates and configures a SKANManager.
126
- * Every `track()` call is automatically forwarded to SKAN rule evaluation.
127
- */
128
- getSkanManager(): SKANManager | null;
129
- private emitError;
130
- shutdown(): void;
131
- private _trackedDeepLinkUrls;
132
- private setupDeepLinkAutoTracking;
133
- private initializeDeviceInfo;
134
- private setupAppStateListener;
135
- private configureSkanFromRemoteConfig;
136
- private startConfigPolling;
137
- private stopConfigPolling;
138
- private pollRemoteConfig;
139
- private setupNetInfoListener;
140
- }
141
- declare function getOrSetInstallId(): Promise<string>;
142
- interface ClipboardAttribution {
143
- clickUrl: string;
144
- clickId: string;
145
- }
146
- declare function readClipboardAttribution(): Promise<ClipboardAttribution | null>;
147
- interface GoogleAdvertisingInfo {
148
- id: string;
149
- isLimitAdTrackingEnabled: boolean;
150
- }
151
- /**
152
- * Fetch the Google Advertising ID (GAID) on Android via NativeModules.
153
- * Returns null on iOS or when the native module is not available.
154
- */
155
- declare function getGoogleAdvertisingId(): Promise<GoogleAdvertisingInfo | null>;
156
- /**
157
- * Request the AdServices attribution token on iOS 14.3+.
158
- * Uses the LayersAdServices native module which calls AAAttribution.attributionToken().
159
- * Does NOT require ATT consent.
160
- * Returns null on Android or when the native module is not available.
161
- */
162
- declare function getAdServicesToken(): Promise<string | null>;
163
- interface InstallReferrerData {
164
- referrerUrl: string;
165
- referrerClickTimestamp?: number;
166
- installBeginTimestamp?: number;
167
- }
168
- /**
169
- * Fetch the Google Play install referrer on Android via NativeModules.
170
- * Requires the `com.android.installreferrer` library on the native side.
171
- * Returns null on iOS or when the native module is not available.
172
- */
173
- declare function getInstallReferrer(): Promise<InstallReferrerData | null>;
174
- interface DeepLinkData {
175
- url: string;
176
- scheme: string;
177
- host: string;
178
- path: string;
179
- queryParams: Record<string, string>;
180
- timestamp: number;
181
- }
182
- declare function setupDeepLinkListener(onDeepLink: (data: DeepLinkData) => void): () => void;
183
- declare function parseDeepLink(url: string): DeepLinkData | null;
184
- declare function useLayersExpoRouterTracking(layersInstance: LayersReactNative, usePathname: () => string, useGlobalSearchParams: () => Record<string, string | string[]>): void;
185
- //#endregion
186
- export { getOrSetInstallId as _, Environment$1 as a, setupDeepLinkListener as b, GoogleAdvertisingInfo as c, LayersRNConfig as d, LayersReactNative as f, getInstallReferrer as g, getGoogleAdvertisingId as h, DeviceContext$1 as i, InstallReferrerData as l, getAdServicesToken as m, ConsentState$1 as n, ErrorListener as o, UserProperties$1 as p, DeepLinkData as r, EventProperties$1 as s, ClipboardAttribution as t, LayersError as u, parseDeepLink as v, useLayersExpoRouterTracking as x, readClipboardAttribution as y };
187
- //# sourceMappingURL=index-DtN6DP29.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DtN6DP29.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAmJgB,UAlGC,cAAA,CAkGD;EA4GwB,KAAA,EAAA,MAAA;EAoBE,WAAA,EAhO3B,WAgO2B;EAaJ,SAAA,CAAA,EAAA,MAAA;EAAiB,WAAA,CAAA,EAAA,OAAA;EAIb,OAAA,CAAA,EAAA,MAAA;EAAiB,eAAA,CAAA,EAAA,MAAA;EAI/B,cAAA,CAAA,EAAA,MAAA;EAAe,YAAA,CAAA,EAAA,MAAA;EAaE;;;;;EA0IpB,gBAAA,CAAA,EAAA,OAAA;EAoBM;;;;;AA2gB/B;AA6BA;AAOA;AA2FA;AASA;AAwBA;EAgBiB,kBAAA,CAAA,EAAA,OAAmB;AAWpC;AAkBiB,KAzlCL,aAAA,GAylCiB,CAAA,KAKd,EA9lCqB,KA8lCf,EAAA,GAAA,IAAA;AAIL,cAhmCH,iBAAA,CAgmCwB;EA6BrB,QAAA,IAAA;EAs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