@adshift/react-native-plugin 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.
Files changed (54) hide show
  1. package/AdShiftReactNativePlugin.podspec +30 -0
  2. package/LICENSE +45 -0
  3. package/README.md +810 -0
  4. package/android/build.gradle +80 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +420 -0
  8. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginPackage.kt +33 -0
  9. package/ios/AdShiftReactNativePlugin.h +24 -0
  10. package/ios/AdShiftReactNativePlugin.mm +258 -0
  11. package/ios/AdShiftReactNativePluginHelper.swift +413 -0
  12. package/lib/module/Adshift.js +468 -0
  13. package/lib/module/Adshift.js.map +1 -0
  14. package/lib/module/NativeAdShiftReactNativePlugin.js +18 -0
  15. package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -0
  16. package/lib/module/index.js +57 -0
  17. package/lib/module/index.js.map +1 -0
  18. package/lib/module/package.json +1 -0
  19. package/lib/module/types/AdshiftConfig.js +44 -0
  20. package/lib/module/types/AdshiftConfig.js.map +1 -0
  21. package/lib/module/types/AdshiftConsent.js +101 -0
  22. package/lib/module/types/AdshiftConsent.js.map +1 -0
  23. package/lib/module/types/AdshiftDeepLink.js +121 -0
  24. package/lib/module/types/AdshiftDeepLink.js.map +1 -0
  25. package/lib/module/types/AdshiftEventType.js +108 -0
  26. package/lib/module/types/AdshiftEventType.js.map +1 -0
  27. package/lib/module/types/index.js +10 -0
  28. package/lib/module/types/index.js.map +1 -0
  29. package/lib/typescript/package.json +1 -0
  30. package/lib/typescript/src/Adshift.d.ts +335 -0
  31. package/lib/typescript/src/Adshift.d.ts.map +1 -0
  32. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts +143 -0
  33. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
  34. package/lib/typescript/src/index.d.ts +47 -0
  35. package/lib/typescript/src/index.d.ts.map +1 -0
  36. package/lib/typescript/src/types/AdshiftConfig.d.ts +74 -0
  37. package/lib/typescript/src/types/AdshiftConfig.d.ts.map +1 -0
  38. package/lib/typescript/src/types/AdshiftConsent.d.ts +88 -0
  39. package/lib/typescript/src/types/AdshiftConsent.d.ts.map +1 -0
  40. package/lib/typescript/src/types/AdshiftDeepLink.d.ts +93 -0
  41. package/lib/typescript/src/types/AdshiftDeepLink.d.ts.map +1 -0
  42. package/lib/typescript/src/types/AdshiftEventType.d.ts +87 -0
  43. package/lib/typescript/src/types/AdshiftEventType.d.ts.map +1 -0
  44. package/lib/typescript/src/types/index.d.ts +5 -0
  45. package/lib/typescript/src/types/index.d.ts.map +1 -0
  46. package/package.json +143 -0
  47. package/src/Adshift.ts +539 -0
  48. package/src/NativeAdShiftReactNativePlugin.ts +177 -0
  49. package/src/index.tsx +68 -0
  50. package/src/types/AdshiftConfig.ts +108 -0
  51. package/src/types/AdshiftConsent.ts +127 -0
  52. package/src/types/AdshiftDeepLink.ts +194 -0
  53. package/src/types/AdshiftEventType.ts +135 -0
  54. package/src/types/index.ts +7 -0
@@ -0,0 +1,468 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * AdShift SDK for React Native
5
+ *
6
+ * Main SDK interface providing type-safe access to native AdShift functionality.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { Adshift, AdshiftEventType } from '@adshift/react-native-plugin';
11
+ *
12
+ * // 1. Initialize
13
+ * Adshift.initialize({ apiKey: 'your-api-key', isDebug: true });
14
+ *
15
+ * // 2. Start tracking
16
+ * await Adshift.start();
17
+ *
18
+ * // 3. Track events
19
+ * await Adshift.trackEvent(AdshiftEventType.Purchase, { price: 9.99 });
20
+ *
21
+ * // 4. Listen for deep links
22
+ * const subscription = Adshift.onDeepLink((deepLink) => {
23
+ * console.log('Deep link received:', deepLink);
24
+ * });
25
+ * // Later: subscription.remove();
26
+ * ```
27
+ */
28
+
29
+ import { NativeEventEmitter, Platform } from 'react-native';
30
+ import NativeAdShiftReactNativePlugin from "./NativeAdShiftReactNativePlugin.js";
31
+ import { configToMap, consentToMap, AdshiftDeepLink as AdshiftDeepLinkHelpers } from "./types/index.js";
32
+
33
+ // ============ Types ============
34
+
35
+ /**
36
+ * Result returned from Adshift.start()
37
+ */
38
+
39
+ /**
40
+ * Values that can be passed to trackEvent
41
+ */
42
+
43
+ /**
44
+ * Parameters for trackPurchase
45
+ */
46
+
47
+ /**
48
+ * Subscription returned from onDeepLink
49
+ */
50
+
51
+ /**
52
+ * Callback for deep link events
53
+ */
54
+
55
+ // ============ Internal State ============
56
+
57
+ let _isInitialized = false;
58
+ let _eventEmitter = null;
59
+
60
+ // ============ Internal Helpers ============
61
+
62
+ function ensureInitialized() {
63
+ if (!_isInitialized) {
64
+ throw new Error('AdShift SDK not initialized. Call Adshift.initialize(config) first.');
65
+ }
66
+ }
67
+ function getEventEmitter() {
68
+ if (!_eventEmitter) {
69
+ _eventEmitter = new NativeEventEmitter(NativeAdShiftReactNativePlugin);
70
+ }
71
+ return _eventEmitter;
72
+ }
73
+
74
+ // ============ Main SDK API ============
75
+
76
+ /**
77
+ * AdShift SDK main interface.
78
+ *
79
+ * Provides type-safe access to all SDK functionality.
80
+ */
81
+ export const Adshift = {
82
+ // ============ Lifecycle ============
83
+
84
+ /**
85
+ * Initializes the SDK with configuration.
86
+ *
87
+ * Must be called before any other SDK methods.
88
+ * Call this early in your app's lifecycle (e.g., in App.tsx or index.js).
89
+ *
90
+ * @param config - SDK configuration
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * Adshift.initialize({
95
+ * apiKey: 'your-api-key',
96
+ * isDebug: __DEV__,
97
+ * // iOS only
98
+ * waitForATTBeforeStart: true,
99
+ * // Android only
100
+ * collectOaid: true,
101
+ * });
102
+ * ```
103
+ */
104
+ initialize(config) {
105
+ if (!config.apiKey) {
106
+ throw new Error('AdShift SDK: apiKey is required in config');
107
+ }
108
+ const configMap = configToMap(config);
109
+ NativeAdShiftReactNativePlugin.initialize(configMap);
110
+ _isInitialized = true;
111
+ },
112
+ /**
113
+ * Starts the SDK.
114
+ *
115
+ * Validates API key, sends install event (if first launch), and begins tracking.
116
+ * Call this after initialize().
117
+ *
118
+ * @returns Promise resolving to start result
119
+ *
120
+ * @example
121
+ * ```typescript
122
+ * try {
123
+ * const result = await Adshift.start();
124
+ * console.log('SDK started:', result);
125
+ * } catch (error) {
126
+ * console.error('SDK start failed:', error);
127
+ * }
128
+ * ```
129
+ */
130
+ async start() {
131
+ ensureInitialized();
132
+ try {
133
+ const result = await NativeAdShiftReactNativePlugin.start();
134
+ return {
135
+ success: true,
136
+ message: result?.message
137
+ };
138
+ } catch (error) {
139
+ const message = error instanceof Error ? error.message : 'Unknown error';
140
+ return {
141
+ success: false,
142
+ message
143
+ };
144
+ }
145
+ },
146
+ /**
147
+ * Stops the SDK.
148
+ *
149
+ * Pauses all tracking. Can be restarted with start().
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * Adshift.stop();
154
+ * ```
155
+ */
156
+ stop() {
157
+ ensureInitialized();
158
+ NativeAdShiftReactNativePlugin.stop();
159
+ },
160
+ /**
161
+ * Checks if SDK is currently started.
162
+ *
163
+ * @returns true if SDK is running
164
+ *
165
+ * @example
166
+ * ```typescript
167
+ * if (Adshift.isStarted()) {
168
+ * // SDK is tracking
169
+ * }
170
+ * ```
171
+ */
172
+ isStarted() {
173
+ ensureInitialized();
174
+ return NativeAdShiftReactNativePlugin.isStarted();
175
+ },
176
+ // ============ Configuration ============
177
+
178
+ /**
179
+ * Sets custom user identifier for attribution.
180
+ *
181
+ * Associate events with your own user ID. Can be called before or after start().
182
+ *
183
+ * @param userId - Your user identifier
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * Adshift.setCustomerUserId('user_123');
188
+ * ```
189
+ */
190
+ setCustomerUserId(userId) {
191
+ ensureInitialized();
192
+ if (!userId || typeof userId !== 'string') {
193
+ throw new Error('AdShift SDK: userId must be a non-empty string');
194
+ }
195
+ NativeAdShiftReactNativePlugin.setCustomerUserId(userId);
196
+ },
197
+ /**
198
+ * Enables/disables debug logging at runtime.
199
+ *
200
+ * Note: Can also be set via config.isDebug during initialize().
201
+ *
202
+ * @param enabled - true to enable debug logs
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * // Enable debug in production for troubleshooting
207
+ * Adshift.setDebugEnabled(true);
208
+ * ```
209
+ */
210
+ setDebugEnabled(enabled) {
211
+ ensureInitialized();
212
+ NativeAdShiftReactNativePlugin.setDebugEnabled(enabled);
213
+ },
214
+ /**
215
+ * Sets app open debounce time in milliseconds.
216
+ *
217
+ * Used to deduplicate rapid app open events.
218
+ * Note: Can also be set via config.appOpenDebounceMs during initialize().
219
+ *
220
+ * @param ms - Debounce time in milliseconds (e.g., 5000 for 5 seconds)
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * Adshift.setAppOpenDebounceMs(5000);
225
+ * ```
226
+ */
227
+ setAppOpenDebounceMs(ms) {
228
+ ensureInitialized();
229
+ if (typeof ms !== 'number' || ms < 0) {
230
+ throw new Error('AdShift SDK: ms must be a non-negative number');
231
+ }
232
+ NativeAdShiftReactNativePlugin.setAppOpenDebounceMs(ms);
233
+ },
234
+ // ============ Consent (GDPR/DMA) ============
235
+
236
+ /**
237
+ * Sets user consent data manually.
238
+ *
239
+ * Use this for manual consent collection (not CMP).
240
+ * Use AdshiftConsent.forGDPRUser() or AdshiftConsent.forNonGDPRUser() helpers.
241
+ *
242
+ * @param consent - Consent data
243
+ *
244
+ * @example
245
+ * ```typescript
246
+ * // GDPR user who accepted all
247
+ * Adshift.setConsentData(
248
+ * AdshiftConsent.forGDPRUser({
249
+ * hasConsentForDataUsage: true,
250
+ * hasConsentForAdsPersonalization: true,
251
+ * hasConsentForAdStorage: true,
252
+ * })
253
+ * );
254
+ *
255
+ * // Non-GDPR user
256
+ * Adshift.setConsentData(AdshiftConsent.forNonGDPRUser());
257
+ * ```
258
+ */
259
+ setConsentData(consent) {
260
+ ensureInitialized();
261
+ const consentMap = consentToMap(consent);
262
+ NativeAdShiftReactNativePlugin.setConsentData(consentMap);
263
+ },
264
+ /**
265
+ * Enables/disables automatic TCF v2.2 data collection from CMP.
266
+ *
267
+ * When enabled, SDK reads IAB TCF consent strings from device storage
268
+ * (set by CMPs like Google Funding Choices, Didomi, etc.)
269
+ *
270
+ * Call this BEFORE start().
271
+ *
272
+ * @param enabled - true to enable TCF collection
273
+ *
274
+ * @example
275
+ * ```typescript
276
+ * Adshift.enableTCFDataCollection(true);
277
+ * await Adshift.start();
278
+ * ```
279
+ */
280
+ enableTCFDataCollection(enabled) {
281
+ ensureInitialized();
282
+ NativeAdShiftReactNativePlugin.enableTCFDataCollection(enabled);
283
+ },
284
+ /**
285
+ * Refreshes consent state from TCF/CMP or manual sources.
286
+ *
287
+ * Call this after CMP dialog closes to pick up updated consent.
288
+ * Priority: Manual > TCF > None
289
+ *
290
+ * @returns Promise resolving to consent snapshot
291
+ *
292
+ * @example
293
+ * ```typescript
294
+ * // After CMP dialog closes
295
+ * const snapshot = await Adshift.refreshConsent();
296
+ * console.log('Consent source:', snapshot.source);
297
+ * ```
298
+ */
299
+ async refreshConsent() {
300
+ ensureInitialized();
301
+ const result = await NativeAdShiftReactNativePlugin.refreshConsent();
302
+ return result;
303
+ },
304
+ // ============ Event Tracking ============
305
+
306
+ /**
307
+ * Tracks an in-app event.
308
+ *
309
+ * Use AdshiftEventType constants for predefined events, or custom strings.
310
+ * Events are queued until SDK is started.
311
+ *
312
+ * @param eventName - Event name (use AdshiftEventType or custom string)
313
+ * @param values - Optional event parameters
314
+ * @returns Promise resolving on success
315
+ *
316
+ * @example
317
+ * ```typescript
318
+ * // Predefined event
319
+ * await Adshift.trackEvent(AdshiftEventType.AddToCart, {
320
+ * product_id: 'SKU123',
321
+ * price: 29.99,
322
+ * });
323
+ *
324
+ * // Custom event
325
+ * await Adshift.trackEvent('custom_event', { key: 'value' });
326
+ * ```
327
+ */
328
+ async trackEvent(eventName, values) {
329
+ ensureInitialized();
330
+ if (!eventName || typeof eventName !== 'string') {
331
+ throw new Error('AdShift SDK: eventName must be a non-empty string');
332
+ }
333
+ await NativeAdShiftReactNativePlugin.trackEvent(eventName, values ?? null);
334
+ },
335
+ /**
336
+ * Tracks a purchase event.
337
+ *
338
+ * Use for revenue tracking and SKAdNetwork conversion value calculation.
339
+ *
340
+ * @param params - Purchase parameters
341
+ * @returns Promise resolving on success
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * await Adshift.trackPurchase({
346
+ * productId: 'premium_subscription',
347
+ * revenue: 9.99,
348
+ * currency: 'USD',
349
+ * transactionId: 'TXN_123456',
350
+ * });
351
+ * ```
352
+ */
353
+ async trackPurchase(params) {
354
+ ensureInitialized();
355
+ const {
356
+ productId,
357
+ revenue,
358
+ currency,
359
+ transactionId
360
+ } = params;
361
+ if (!productId) {
362
+ throw new Error('AdShift SDK: productId is required');
363
+ }
364
+ if (typeof revenue !== 'number' || revenue < 0) {
365
+ throw new Error('AdShift SDK: revenue must be a non-negative number');
366
+ }
367
+ if (!currency) {
368
+ throw new Error('AdShift SDK: currency is required');
369
+ }
370
+ if (!transactionId) {
371
+ throw new Error('AdShift SDK: transactionId is required');
372
+ }
373
+
374
+ // Native SDK uses price/token naming internally
375
+ await NativeAdShiftReactNativePlugin.trackPurchase(productId, revenue, currency, transactionId);
376
+ },
377
+ // ============ Deep Links ============
378
+
379
+ /**
380
+ * Handles a deep link URL.
381
+ *
382
+ * Call this when your app receives a deep link (e.g., from Linking API).
383
+ * Extracts campaign parameters for attribution.
384
+ *
385
+ * @param url - Deep link URL string
386
+ * @returns Promise resolving to deep link response
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * import { Linking } from 'react-native';
391
+ *
392
+ * Linking.addEventListener('url', async ({ url }) => {
393
+ * const deepLink = await Adshift.handleDeepLink(url);
394
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
395
+ * // Navigate based on deepLink.params
396
+ * }
397
+ * });
398
+ * ```
399
+ */
400
+ async handleDeepLink(url) {
401
+ ensureInitialized();
402
+ if (!url || typeof url !== 'string') {
403
+ return AdshiftDeepLinkHelpers.error('Invalid URL');
404
+ }
405
+ try {
406
+ const result = await NativeAdShiftReactNativePlugin.handleDeepLink(url);
407
+ return AdshiftDeepLinkHelpers.fromMap(result);
408
+ } catch (error) {
409
+ const message = error instanceof Error ? error.message : 'Unknown error';
410
+ return AdshiftDeepLinkHelpers.error(message);
411
+ }
412
+ },
413
+ /**
414
+ * Registers a listener for deep link events.
415
+ *
416
+ * Called when:
417
+ * - Deferred deep links are resolved (after first install)
418
+ * - App links are received while app is running
419
+ *
420
+ * If a deep link was received before listener was set (cold start),
421
+ * the callback is called immediately with the cached deep link.
422
+ *
423
+ * @param callback - Function called when deep link is received
424
+ * @returns Subscription object with remove() method
425
+ *
426
+ * @example
427
+ * ```typescript
428
+ * useEffect(() => {
429
+ * const subscription = Adshift.onDeepLink((deepLink) => {
430
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
431
+ * console.log('Deep link:', deepLink.deepLink);
432
+ * console.log('Params:', deepLink.params);
433
+ * // Navigate to appropriate screen
434
+ * }
435
+ * });
436
+ *
437
+ * return () => subscription.remove();
438
+ * }, []);
439
+ * ```
440
+ */
441
+ onDeepLink(callback) {
442
+ ensureInitialized();
443
+ const eventEmitter = getEventEmitter();
444
+ const subscription = eventEmitter.addListener('onDeepLink', event => {
445
+ const deepLink = AdshiftDeepLinkHelpers.fromMap(event);
446
+ callback(deepLink);
447
+ });
448
+ return {
449
+ remove: () => {
450
+ subscription.remove();
451
+ }
452
+ };
453
+ },
454
+ // ============ Debug ============
455
+
456
+ /**
457
+ * Returns SDK version and platform info.
458
+ * Useful for debugging.
459
+ */
460
+ getInfo() {
461
+ return {
462
+ platform: Platform.OS,
463
+ version: '1.0.0' // TODO: Get from package.json
464
+ };
465
+ }
466
+ };
467
+ export default Adshift;
468
+ //# sourceMappingURL=Adshift.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeEventEmitter","Platform","NativeAdShiftReactNativePlugin","configToMap","consentToMap","AdshiftDeepLink","AdshiftDeepLinkHelpers","_isInitialized","_eventEmitter","ensureInitialized","Error","getEventEmitter","Adshift","initialize","config","apiKey","configMap","start","result","success","message","error","stop","isStarted","setCustomerUserId","userId","setDebugEnabled","enabled","setAppOpenDebounceMs","ms","setConsentData","consent","consentMap","enableTCFDataCollection","refreshConsent","trackEvent","eventName","values","trackPurchase","params","productId","revenue","currency","transactionId","handleDeepLink","url","fromMap","onDeepLink","callback","eventEmitter","subscription","addListener","event","deepLink","remove","getInfo","platform","OS","version"],"sourceRoot":"../../src","sources":["Adshift.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,EAAEC,QAAQ,QAAQ,cAAc;AAC3D,OAAOC,8BAA8B,MAAM,qCAAkC;AAE7E,SACEC,WAAW,EACXC,YAAY,EACZC,eAAe,IAAIC,sBAAsB,QACpC,kBAAS;;AAEhB;;AAEA;AACA;AACA;;AAQA;AACA;AACA;;AAGA;AACA;AACA;;AAYA;AACA;AACA;;AAMA;AACA;AACA;;AAGA;;AAEA,IAAIC,cAAc,GAAG,KAAK;AAC1B,IAAIC,aAAwC,GAAG,IAAI;;AAEnD;;AAEA,SAASC,iBAAiBA,CAAA,EAAS;EACjC,IAAI,CAACF,cAAc,EAAE;IACnB,MAAM,IAAIG,KAAK,CACb,qEACF,CAAC;EACH;AACF;AAEA,SAASC,eAAeA,CAAA,EAAuB;EAC7C,IAAI,CAACH,aAAa,EAAE;IAClBA,aAAa,GAAG,IAAIR,kBAAkB,CAACE,8BAA8B,CAAC;EACxE;EACA,OAAOM,aAAa;AACtB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,OA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,QAAQ,CAAC;IACpB,CACF,CAAC;IAED,OAAO;MACLC,MAAM,EAAEA,CAAA,KAAM;QACZJ,YAAY,CAACI,MAAM,CAAC,CAAC;MACvB;IACF,CAAC;EACH,CAAC;EAED;;EAEA;AACF;AACA;AACA;EACEC,OAAOA,CAAA,EAA0C;IAC/C,OAAO;MACLC,QAAQ,EAAEvD,QAAQ,CAACwD,EAAE;MACrBC,OAAO,EAAE,OAAO,CAAE;IACpB,CAAC;EACH;AACF,CAAC;AAED,eAAe9C,OAAO","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ /**
6
+ * AdShift React Native Plugin - Turbo Module Specification
7
+ *
8
+ * This interface defines the contract between JavaScript and native code.
9
+ * Codegen generates native interfaces from this spec:
10
+ * - iOS: NativeAdShiftReactNativePluginSpecJSI (C++)
11
+ * - Android: NativeAdShiftReactNativePluginSpec (Kotlin)
12
+ *
13
+ * Note: Custom types (AdshiftConfig, etc.) are not supported in Turbo Module Spec.
14
+ * We use `Object` here and add type safety in the wrapper layer (Adshift.ts).
15
+ */
16
+
17
+ export default TurboModuleRegistry.getEnforcing('AdShiftReactNativePlugin');
18
+ //# sourceMappingURL=NativeAdShiftReactNativePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeAdShiftReactNativePlugin.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkKA,eAAeA,mBAAmB,CAACC,YAAY,CAC7C,0BACF,CAAC","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * AdShift React Native Plugin
5
+ *
6
+ * Mobile Attribution, Event Tracking, SKAdNetwork 4.0+, Deep Linking
7
+ * and GDPR/TCF 2.2 Compliance.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import {
12
+ * Adshift,
13
+ * AdshiftEventType,
14
+ * AdshiftConsent,
15
+ * AdshiftDeepLinkStatus,
16
+ * } from '@adshift/react-native-plugin';
17
+ *
18
+ * // 1. Initialize
19
+ * Adshift.initialize({ apiKey: 'your-api-key', isDebug: __DEV__ });
20
+ *
21
+ * // 2. Start tracking
22
+ * await Adshift.start();
23
+ *
24
+ * // 3. Track events
25
+ * await Adshift.trackEvent(AdshiftEventType.Purchase, { price: 9.99 });
26
+ *
27
+ * // 4. Handle deep links
28
+ * const subscription = Adshift.onDeepLink((deepLink) => {
29
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
30
+ * // Navigate based on deep link
31
+ * }
32
+ * });
33
+ * ```
34
+ *
35
+ * @packageDocumentation
36
+ */
37
+
38
+ // ============ Main SDK API ============
39
+ export { Adshift, default } from "./Adshift.js";
40
+
41
+ // ============ Types from Adshift.ts ============
42
+
43
+ // ============ Config ============
44
+
45
+ export { configToMap } from "./types/index.js";
46
+
47
+ // ============ Consent ============
48
+ // Note: AdshiftConsent is both a type (interface) and value (helper object)
49
+ export { AdshiftConsent, consentToMap } from "./types/index.js";
50
+ // ============ Deep Link ============
51
+ // Note: AdshiftDeepLink is both a type (interface) and value (helper object)
52
+ export { AdshiftDeepLinkStatus, AdshiftDeepLink, deepLinkToMap } from "./types/index.js";
53
+ // ============ Event Types ============
54
+ export { AdshiftEventType, getAllEventTypes } from "./types/index.js";
55
+ // ============ Native Module (Advanced Usage) ============
56
+ export { default as NativeAdShiftReactNativePlugin } from "./NativeAdShiftReactNativePlugin.js";
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Adshift","default","configToMap","AdshiftConsent","consentToMap","AdshiftDeepLinkStatus","AdshiftDeepLink","deepLinkToMap","AdshiftEventType","getAllEventTypes","NativeAdShiftReactNativePlugin"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAASA,OAAO,EAAEC,OAAO,QAAQ,cAAW;;AAE5C;;AASA;;AAEA,SAASC,WAAW,QAAQ,kBAAS;;AAErC;AACA;AACA,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAS;AAGtD;AACA;AACA,SAASC,qBAAqB,EAAEC,eAAe,EAAEC,aAAa,QAAQ,kBAAS;AAG/E;AACA,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,kBAAS;AAG5D;AACA,SAASR,OAAO,IAAIS,8BAA8B,QAAQ,qCAAkC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Configuration for initializing the AdShift SDK.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * const config: AdshiftConfig = {
9
+ * apiKey: 'your-api-key',
10
+ * isDebug: true,
11
+ * };
12
+ * await Adshift.initialize(config);
13
+ * ```
14
+ */
15
+
16
+ /**
17
+ * Converts AdshiftConfig to a plain object for native bridge communication.
18
+ * Filters out undefined values.
19
+ */
20
+ export function configToMap(config) {
21
+ const map = {
22
+ apiKey: config.apiKey,
23
+ isDebug: config.isDebug ?? false,
24
+ appOpenDebounceMs: config.appOpenDebounceMs ?? 10000
25
+ };
26
+
27
+ // iOS only
28
+ if (config.disableSKAN !== undefined) {
29
+ map.disableSKAN = config.disableSKAN;
30
+ }
31
+ if (config.waitForATTBeforeStart !== undefined) {
32
+ map.waitForATTBeforeStart = config.waitForATTBeforeStart;
33
+ }
34
+ if (config.attTimeoutMs !== undefined) {
35
+ map.attTimeoutMs = config.attTimeoutMs;
36
+ }
37
+
38
+ // Android only
39
+ if (config.collectOaid !== undefined) {
40
+ map.collectOaid = config.collectOaid;
41
+ }
42
+ return map;
43
+ }
44
+ //# sourceMappingURL=AdshiftConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["configToMap","config","map","apiKey","isDebug","appOpenDebounceMs","disableSKAN","undefined","waitForATTBeforeStart","attTimeoutMs","collectOaid"],"sourceRoot":"../../../src","sources":["types/AdshiftConfig.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoEA;AACA;AACA;AACA;AACA,OAAO,SAASA,WAAWA,CAACC,MAAqB,EAA2B;EAC1E,MAAMC,GAA4B,GAAG;IACnCC,MAAM,EAAEF,MAAM,CAACE,MAAM;IACrBC,OAAO,EAAEH,MAAM,CAACG,OAAO,IAAI,KAAK;IAChCC,iBAAiB,EAAEJ,MAAM,CAACI,iBAAiB,IAAI;EACjD,CAAC;;EAED;EACA,IAAIJ,MAAM,CAACK,WAAW,KAAKC,SAAS,EAAE;IACpCL,GAAG,CAACI,WAAW,GAAGL,MAAM,CAACK,WAAW;EACtC;EACA,IAAIL,MAAM,CAACO,qBAAqB,KAAKD,SAAS,EAAE;IAC9CL,GAAG,CAACM,qBAAqB,GAAGP,MAAM,CAACO,qBAAqB;EAC1D;EACA,IAAIP,MAAM,CAACQ,YAAY,KAAKF,SAAS,EAAE;IACrCL,GAAG,CAACO,YAAY,GAAGR,MAAM,CAACQ,YAAY;EACxC;;EAEA;EACA,IAAIR,MAAM,CAACS,WAAW,KAAKH,SAAS,EAAE;IACpCL,GAAG,CAACQ,WAAW,GAAGT,MAAM,CAACS,WAAW;EACtC;EAEA,OAAOR,GAAG;AACZ","ignoreList":[]}