@adshift/react-native-plugin 1.0.0 → 2.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/AdShiftReactNativePlugin.podspec +11 -7
- package/CHANGELOG.md +122 -0
- package/README.md +506 -542
- package/android/build.gradle +17 -3
- package/android/consumer-rules.pro +21 -0
- package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +786 -229
- package/android/src/test/java/com/adshift/reactnativeplugin/ConsentSnapshotTest.kt +180 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +146 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +111 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/IntentLinkDedupTest.kt +168 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +106 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +167 -0
- package/android/src/test/java/com/adshift/reactnativeplugin/StartVerdictTest.kt +164 -0
- package/ios/AdShiftReactNativePlugin.h +7 -7
- package/ios/AdShiftReactNativePlugin.mm +200 -181
- package/ios/AdShiftReactNativePluginHelper.swift +584 -286
- package/ios/Core/BridgeRules.swift +82 -0
- package/lib/commonjs/Adshift.js +1135 -0
- package/lib/commonjs/Adshift.js.map +1 -0
- package/lib/commonjs/NativeAdShiftReactNativePlugin.js +22 -0
- package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -0
- package/lib/commonjs/index.js +94 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/jest/index.js +164 -0
- package/lib/commonjs/jest/index.js.map +1 -0
- package/lib/commonjs/nativeSdkVersions.js +17 -0
- package/lib/commonjs/nativeSdkVersions.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types/AdshiftAdRevenue.js +47 -0
- package/lib/commonjs/types/AdshiftAdRevenue.js.map +1 -0
- package/lib/commonjs/types/AdshiftConfig.js +45 -0
- package/lib/commonjs/types/AdshiftConfig.js.map +1 -0
- package/lib/commonjs/types/AdshiftConsent.js +113 -0
- package/lib/commonjs/types/AdshiftConsent.js.map +1 -0
- package/lib/commonjs/types/AdshiftConsentSnapshot.js +69 -0
- package/lib/commonjs/types/AdshiftConsentSnapshot.js.map +1 -0
- package/lib/commonjs/types/AdshiftDeepLink.js +154 -0
- package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -0
- package/lib/commonjs/types/AdshiftError.js +91 -0
- package/lib/commonjs/types/AdshiftError.js.map +1 -0
- package/lib/commonjs/types/AdshiftEventParam.js +140 -0
- package/lib/commonjs/types/AdshiftEventParam.js.map +1 -0
- package/lib/commonjs/types/AdshiftEventType.js +88 -0
- package/lib/commonjs/types/AdshiftEventType.js.map +1 -0
- package/lib/commonjs/types/AdshiftThirdPartySharing.js +70 -0
- package/lib/commonjs/types/AdshiftThirdPartySharing.js.map +1 -0
- package/lib/commonjs/types/index.js +123 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/Adshift.js +959 -296
- package/lib/module/Adshift.js.map +1 -1
- package/lib/module/NativeAdShiftReactNativePlugin.js +10 -7
- package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
- package/lib/module/index.js +26 -25
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest/index.js +144 -0
- package/lib/module/jest/index.js.map +1 -0
- package/lib/module/nativeSdkVersions.js +13 -0
- package/lib/module/nativeSdkVersions.js.map +1 -0
- package/lib/module/types/AdshiftAdRevenue.js +43 -0
- package/lib/module/types/AdshiftAdRevenue.js.map +1 -0
- package/lib/module/types/AdshiftConfig.js +23 -26
- package/lib/module/types/AdshiftConfig.js.map +1 -1
- package/lib/module/types/AdshiftConsent.js +57 -50
- package/lib/module/types/AdshiftConsent.js.map +1 -1
- package/lib/module/types/AdshiftConsentSnapshot.js +65 -0
- package/lib/module/types/AdshiftConsentSnapshot.js.map +1 -0
- package/lib/module/types/AdshiftDeepLink.js +97 -67
- package/lib/module/types/AdshiftDeepLink.js.map +1 -1
- package/lib/module/types/AdshiftError.js +87 -0
- package/lib/module/types/AdshiftError.js.map +1 -0
- package/lib/module/types/AdshiftEventParam.js +135 -0
- package/lib/module/types/AdshiftEventParam.js.map +1 -0
- package/lib/module/types/AdshiftEventType.js +11 -36
- package/lib/module/types/AdshiftEventType.js.map +1 -1
- package/lib/module/types/AdshiftThirdPartySharing.js +65 -0
- package/lib/module/types/AdshiftThirdPartySharing.js.map +1 -0
- package/lib/module/types/index.js +9 -7
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +5 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/Adshift.d.ts +311 -0
- package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
- package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +51 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/jest/index.d.ts +103 -0
- package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +11 -0
- package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts +56 -0
- package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +104 -0
- package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts +76 -0
- package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts +56 -0
- package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +89 -0
- package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftError.d.ts +57 -0
- package/lib/typescript/commonjs/src/types/AdshiftError.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts +111 -0
- package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/types/AdshiftEventType.d.ts +12 -35
- package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts +53 -0
- package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/index.d.ts +17 -0
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +2 -0
- package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
- package/lib/typescript/module/src/Adshift.d.ts +311 -0
- package/lib/typescript/module/src/Adshift.d.ts.map +1 -0
- package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
- package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +51 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/jest/index.d.ts +103 -0
- package/lib/typescript/module/src/jest/index.d.ts.map +1 -0
- package/lib/typescript/module/src/nativeSdkVersions.d.ts +11 -0
- package/lib/typescript/module/src/nativeSdkVersions.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts +56 -0
- package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftConfig.d.ts +104 -0
- package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftConsent.d.ts +76 -0
- package/lib/typescript/module/src/types/AdshiftConsent.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts +56 -0
- package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +89 -0
- package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftError.d.ts +57 -0
- package/lib/typescript/module/src/types/AdshiftError.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftEventParam.d.ts +111 -0
- package/lib/typescript/module/src/types/AdshiftEventParam.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftEventType.d.ts +64 -0
- package/lib/typescript/module/src/types/AdshiftEventType.d.ts.map +1 -0
- package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts +53 -0
- package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
- package/lib/typescript/module/src/types/index.d.ts +17 -0
- package/lib/typescript/module/src/types/index.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +2 -0
- package/lib/typescript/module/src/version.d.ts.map +1 -0
- package/package.json +49 -10
- package/src/Adshift.ts +1273 -342
- package/src/NativeAdShiftReactNativePlugin.ts +81 -115
- package/src/index.tsx +40 -25
- package/src/jest/index.ts +224 -0
- package/src/nativeSdkVersions.ts +10 -0
- package/src/types/AdshiftAdRevenue.ts +58 -0
- package/src/types/AdshiftConfig.ts +101 -53
- package/src/types/AdshiftConsent.ts +75 -72
- package/src/types/AdshiftConsentSnapshot.ts +103 -0
- package/src/types/AdshiftDeepLink.ts +123 -102
- package/src/types/AdshiftError.ts +107 -0
- package/src/types/AdshiftEventParam.ts +216 -0
- package/src/types/AdshiftEventType.ts +13 -35
- package/src/types/AdshiftThirdPartySharing.ts +63 -0
- package/src/types/index.ts +38 -6
- package/src/version.ts +2 -0
- package/lib/typescript/src/Adshift.d.ts +0 -335
- package/lib/typescript/src/Adshift.d.ts.map +0 -1
- package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts +0 -143
- package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -47
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/types/AdshiftConfig.d.ts +0 -74
- package/lib/typescript/src/types/AdshiftConfig.d.ts.map +0 -1
- package/lib/typescript/src/types/AdshiftConsent.d.ts +0 -88
- package/lib/typescript/src/types/AdshiftConsent.d.ts.map +0 -1
- package/lib/typescript/src/types/AdshiftDeepLink.d.ts +0 -93
- package/lib/typescript/src/types/AdshiftDeepLink.d.ts.map +0 -1
- package/lib/typescript/src/types/AdshiftEventType.d.ts.map +0 -1
- package/lib/typescript/src/types/index.d.ts +0 -5
- package/lib/typescript/src/types/index.d.ts.map +0 -1
- /package/lib/typescript/{package.json → module/package.json} +0 -0
|
@@ -1,132 +1,103 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TurboModule, CodegenTypes } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Deep link result as emitted by the native module.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* Every field except `params`, `isDeferred` and `status` is optional.
|
|
8
|
+
* `params` is always present (possibly empty).
|
|
9
|
+
*/
|
|
10
|
+
export type NativeDeepLinkPayload = {
|
|
11
|
+
deepLink?: string;
|
|
12
|
+
deepLinkValue?: string;
|
|
13
|
+
params: { [key: string]: string };
|
|
14
|
+
isDeferred: boolean;
|
|
15
|
+
status: string;
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
deepLinkSub1?: string;
|
|
18
|
+
deepLinkSub2?: string;
|
|
19
|
+
deepLinkSub3?: string;
|
|
20
|
+
deepLinkSub4?: string;
|
|
21
|
+
deepLinkSub5?: string;
|
|
22
|
+
isFirstSession?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* TurboModule contract between JavaScript and native code.
|
|
10
27
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
28
|
+
* Complex inputs travel as `Object`; the JS layer (`Adshift.ts`) owns
|
|
29
|
+
* validation and typing. Results of deep link processing are delivered
|
|
30
|
+
* exclusively through `onDeepLink`.
|
|
13
31
|
*/
|
|
14
32
|
export interface Spec extends TurboModule {
|
|
15
33
|
// ============ Lifecycle ============
|
|
16
34
|
|
|
17
35
|
/**
|
|
18
|
-
* Initializes the SDK
|
|
19
|
-
* Must be called before start().
|
|
36
|
+
* Initializes the SDK.
|
|
20
37
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* - waitForATTBeforeStart?: boolean (iOS only)
|
|
27
|
-
* - attTimeoutMs?: number (iOS only)
|
|
28
|
-
* - collectOaid?: boolean (Android only)
|
|
38
|
+
* Config keys (all optional except `apiKey`): `apiKey`, `isDebug`,
|
|
39
|
+
* `appOpenDebounceMs`, `brandedDomains: string[]`, `metaAppId` (Android),
|
|
40
|
+
* `pushDeepLinkPaths: string[][]`, `autoHandleDeepLinks`,
|
|
41
|
+
* `disableSKAN` / `waitForATTBeforeStart` / `attTimeoutMs` (iOS),
|
|
42
|
+
* `collectOaid` (Android). Keys that are absent leave SDK defaults untouched.
|
|
29
43
|
*/
|
|
30
44
|
initialize(config: Object): void;
|
|
31
45
|
|
|
32
46
|
/**
|
|
33
|
-
* Starts the SDK.
|
|
34
|
-
* Validates API key, sends install event (if first launch), and begins tracking.
|
|
47
|
+
* Starts the SDK. Resolves once the SDK has started locally.
|
|
35
48
|
*
|
|
36
|
-
*
|
|
49
|
+
* Result keys: `success: boolean`, `apiKeyValidationStatus?: string`
|
|
50
|
+
* (`pending` | `valid` | `invalid`), `errorCode?: string`,
|
|
51
|
+
* `errorMessage?: string`, `nativeCode?: number | string`.
|
|
37
52
|
*/
|
|
38
53
|
start(): Promise<Object>;
|
|
39
54
|
|
|
40
|
-
/**
|
|
41
|
-
* Stops the SDK.
|
|
42
|
-
* Pauses all tracking. Can be restarted with start().
|
|
43
|
-
*/
|
|
55
|
+
/** Suspends delivery. Can be resumed with `start()`. */
|
|
44
56
|
stop(): void;
|
|
45
57
|
|
|
46
|
-
/**
|
|
47
|
-
* Checks if SDK is currently started.
|
|
48
|
-
*
|
|
49
|
-
* @returns true if SDK is running
|
|
50
|
-
*/
|
|
51
|
-
isStarted(): boolean;
|
|
52
|
-
|
|
53
58
|
// ============ Configuration ============
|
|
54
59
|
|
|
55
|
-
/**
|
|
56
|
-
* Sets custom user identifier for attribution.
|
|
57
|
-
* Can be called before or after start().
|
|
58
|
-
*
|
|
59
|
-
* @param userId - Your user identifier
|
|
60
|
-
*/
|
|
61
60
|
setCustomerUserId(userId: string): void;
|
|
62
61
|
|
|
63
|
-
/**
|
|
64
|
-
* Enables/disables debug logging at runtime.
|
|
65
|
-
*
|
|
66
|
-
* @param enabled - true to enable debug logs
|
|
67
|
-
*/
|
|
68
62
|
setDebugEnabled(enabled: boolean): void;
|
|
69
63
|
|
|
70
|
-
/**
|
|
71
|
-
* Sets app open debounce time in milliseconds.
|
|
72
|
-
* Used to deduplicate rapid app open events.
|
|
73
|
-
*
|
|
74
|
-
* @param ms - Debounce time in milliseconds
|
|
75
|
-
*/
|
|
76
64
|
setAppOpenDebounceMs(ms: number): void;
|
|
77
65
|
|
|
66
|
+
/** Branded attribution domains. Must precede `start()`. */
|
|
67
|
+
setBrandedDomains(domains: string[]): void;
|
|
68
|
+
|
|
69
|
+
/** Meta app id for Meta deep link parsing. Android only; no-op on iOS. */
|
|
70
|
+
setMetaAppId(appId: string): void;
|
|
71
|
+
|
|
72
|
+
/** OAID read by the app itself. Android only; no-op on iOS. */
|
|
73
|
+
setOaidData(oaid: string): void;
|
|
74
|
+
|
|
78
75
|
// ============ Consent (GDPR/DMA) ============
|
|
79
76
|
|
|
80
77
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* @param consent - Consent object containing:
|
|
85
|
-
* - isUserSubjectToGDPR: boolean
|
|
86
|
-
* - hasConsentForDataUsage: boolean
|
|
87
|
-
* - hasConsentForAdsPersonalization: boolean
|
|
88
|
-
* - hasConsentForAdStorage: boolean
|
|
78
|
+
* Consent keys: `isUserSubjectToGDPR: boolean`,
|
|
79
|
+
* `hasConsentForDataUsage` / `hasConsentForAdsPersonalization` /
|
|
80
|
+
* `hasConsentForAdStorage`: `boolean | null` (null = not decided).
|
|
89
81
|
*/
|
|
90
82
|
setConsentData(consent: Object): void;
|
|
91
83
|
|
|
92
|
-
/**
|
|
93
|
-
* Enables/disables automatic TCF v2.2 data collection from CMP.
|
|
94
|
-
* Call BEFORE start() to enable consent collection from CMPs
|
|
95
|
-
* (Google Funding Choices, Didomi, etc.)
|
|
96
|
-
*
|
|
97
|
-
* @param enabled - true to enable TCF collection
|
|
98
|
-
*/
|
|
99
84
|
enableTCFDataCollection(enabled: boolean): void;
|
|
100
85
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
enableGPPDataCollection(enabled: boolean): void;
|
|
87
|
+
|
|
88
|
+
/** Sharing key: `optOut: boolean`. */
|
|
89
|
+
setThirdPartySharing(sharing: Object): void;
|
|
90
|
+
|
|
91
|
+
clearThirdPartySharing(): void;
|
|
92
|
+
|
|
93
|
+
/** Resolves to a consent snapshot object. */
|
|
107
94
|
refreshConsent(): Promise<Object>;
|
|
108
95
|
|
|
109
96
|
// ============ Event Tracking ============
|
|
110
97
|
|
|
111
|
-
/**
|
|
112
|
-
* Tracks an in-app event with optional parameters.
|
|
113
|
-
* Events are queued until SDK is started.
|
|
114
|
-
*
|
|
115
|
-
* @param eventName - Event name (use AdshiftEventType constants or custom string)
|
|
116
|
-
* @param values - Optional event parameters (nullable)
|
|
117
|
-
* @returns Promise resolving on success or rejecting with error
|
|
118
|
-
*/
|
|
98
|
+
/** Resolves once the event has been accepted by the SDK queue. */
|
|
119
99
|
trackEvent(eventName: string, values: Object | null): Promise<void>;
|
|
120
100
|
|
|
121
|
-
/**
|
|
122
|
-
* Tracks a purchase event with standardized parameters.
|
|
123
|
-
*
|
|
124
|
-
* @param productId - Product identifier
|
|
125
|
-
* @param price - Purchase amount
|
|
126
|
-
* @param currency - ISO currency code (e.g., "USD")
|
|
127
|
-
* @param token - Purchase token/receipt
|
|
128
|
-
* @returns Promise resolving on success or rejecting with error
|
|
129
|
-
*/
|
|
130
101
|
trackPurchase(
|
|
131
102
|
productId: string,
|
|
132
103
|
price: number,
|
|
@@ -134,42 +105,37 @@ export interface Spec extends TurboModule {
|
|
|
134
105
|
token: string
|
|
135
106
|
): Promise<void>;
|
|
136
107
|
|
|
137
|
-
// ============ Deep Links ============
|
|
138
|
-
|
|
139
108
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* @param url - Deep link URL string
|
|
144
|
-
* @returns Promise resolving to deep link response object containing:
|
|
145
|
-
* - deepLink?: string
|
|
146
|
-
* - deepLinkValue?: string
|
|
147
|
-
* - params?: Object
|
|
148
|
-
* - isDeferred: boolean
|
|
149
|
-
* - status: 'found' | 'notFound' | 'error'
|
|
150
|
-
* - errorMessage?: string
|
|
151
|
-
* - deepLinkSub1-5?: string
|
|
109
|
+
* Ad revenue keys: `monetizationNetwork`, `mediationNetwork`, `currency`,
|
|
110
|
+
* `revenue`, optional `adUnitId`, `precision`, `additionalParameters`.
|
|
152
111
|
*/
|
|
153
|
-
|
|
112
|
+
logAdRevenue(data: Object): Promise<void>;
|
|
154
113
|
|
|
155
|
-
// ============
|
|
156
|
-
// Required for NativeEventEmitter to receive deep link events from native
|
|
114
|
+
// ============ Identity ============
|
|
157
115
|
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
* @param eventType - Event name to listen for
|
|
163
|
-
*/
|
|
164
|
-
addListener(eventType: string): void;
|
|
116
|
+
/** Resolves to the AdShift device id, or null before initialization. */
|
|
117
|
+
getAdShiftDeviceId(): Promise<string | null>;
|
|
118
|
+
|
|
119
|
+
// ============ Deep Links ============
|
|
165
120
|
|
|
166
121
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
122
|
+
* Passes a URL to the SDK. Resolves once processing has completed;
|
|
123
|
+
* the result arrives through `onDeepLink`.
|
|
169
124
|
*
|
|
170
|
-
*
|
|
125
|
+
* `fromLaunch` marks the URL that opened the app, as opposed to one opened
|
|
126
|
+
* while the app was running. Launch URLs are remembered for the lifetime of
|
|
127
|
+
* the process, so reloading JavaScript cannot book the same link twice,
|
|
128
|
+
* while a genuine second tap on the same link is still forwarded.
|
|
171
129
|
*/
|
|
172
|
-
|
|
130
|
+
handleDeepLink(url: string, fromLaunch: boolean): Promise<void>;
|
|
131
|
+
|
|
132
|
+
/** Registers a push payload key path that carries a deep link. */
|
|
133
|
+
addPushNotificationDeepLinkPath(path: string[]): void;
|
|
134
|
+
|
|
135
|
+
/** Resolves to true when the payload was recognised as an AdShift push. */
|
|
136
|
+
handlePushNotification(payload: Object): Promise<boolean>;
|
|
137
|
+
|
|
138
|
+
readonly onDeepLink: CodegenTypes.EventEmitter<NativeDeepLinkPayload>;
|
|
173
139
|
}
|
|
174
140
|
|
|
175
141
|
export default TurboModuleRegistry.getEnforcing<Spec>(
|
package/src/index.tsx
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AdShift React Native Plugin
|
|
3
3
|
*
|
|
4
|
-
* Mobile
|
|
5
|
-
*
|
|
4
|
+
* Mobile attribution, event tracking, SKAdNetwork, deep linking and
|
|
5
|
+
* GDPR/TCF 2.2 consent.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
9
|
* import {
|
|
10
10
|
* Adshift,
|
|
11
|
+
* AdshiftEventParam,
|
|
11
12
|
* AdshiftEventType,
|
|
12
13
|
* AdshiftConsent,
|
|
13
14
|
* AdshiftDeepLinkStatus,
|
|
14
15
|
* } from '@adshift/react-native-plugin';
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
* Adshift.initialize({ apiKey: 'your-api-key', isDebug: __DEV__ });
|
|
18
|
-
*
|
|
19
|
-
* // 2. Start tracking
|
|
20
|
-
* await Adshift.start();
|
|
21
|
-
*
|
|
22
|
-
* // 3. Track events
|
|
23
|
-
* await Adshift.trackEvent(AdshiftEventType.Purchase, { price: 9.99 });
|
|
24
|
-
*
|
|
25
|
-
* // 4. Handle deep links
|
|
26
|
-
* const subscription = Adshift.onDeepLink((deepLink) => {
|
|
17
|
+
* Adshift.onDeepLink((deepLink) => {
|
|
27
18
|
* if (deepLink.status === AdshiftDeepLinkStatus.Found) {
|
|
28
|
-
* //
|
|
19
|
+
* // route on deepLink.deepLinkValue / deepLink.params
|
|
29
20
|
* }
|
|
30
21
|
* });
|
|
22
|
+
*
|
|
23
|
+
* Adshift.initialize({ apiKey: 'your-api-key', isDebug: __DEV__ });
|
|
24
|
+
* await Adshift.start();
|
|
25
|
+
* await Adshift.trackEvent(AdshiftEventType.Purchase, {
|
|
26
|
+
* [AdshiftEventParam.Revenue]: 9.99,
|
|
27
|
+
* [AdshiftEventParam.Currency]: 'USD',
|
|
28
|
+
* });
|
|
31
29
|
* ```
|
|
32
30
|
*
|
|
33
31
|
* @packageDocumentation
|
|
@@ -36,33 +34,50 @@
|
|
|
36
34
|
// ============ Main SDK API ============
|
|
37
35
|
export { Adshift, default } from './Adshift';
|
|
38
36
|
|
|
39
|
-
// ============ Types from Adshift.ts ============
|
|
40
37
|
export type {
|
|
41
38
|
StartResult,
|
|
42
39
|
EventValues,
|
|
43
40
|
PurchaseParams,
|
|
44
41
|
DeepLinkSubscription,
|
|
45
42
|
DeepLinkCallback,
|
|
43
|
+
NativeSdkVersions,
|
|
44
|
+
AdshiftInfo,
|
|
46
45
|
} from './Adshift';
|
|
47
46
|
|
|
48
47
|
// ============ Config ============
|
|
49
48
|
export type { AdshiftConfig } from './types';
|
|
50
|
-
export { configToMap } from './types';
|
|
51
49
|
|
|
52
50
|
// ============ Consent ============
|
|
53
|
-
//
|
|
54
|
-
export { AdshiftConsent
|
|
55
|
-
export type {
|
|
51
|
+
// AdshiftConsent is both a type (interface) and a value (helper object).
|
|
52
|
+
export { AdshiftConsent } from './types';
|
|
53
|
+
export type {
|
|
54
|
+
AdshiftConsent as AdshiftConsentType,
|
|
55
|
+
ConsentFlag,
|
|
56
|
+
ConsentSnapshot,
|
|
57
|
+
ConsentSource,
|
|
58
|
+
} from './types';
|
|
59
|
+
// AdshiftThirdPartySharing is both a type (interface) and a value (helper object).
|
|
60
|
+
export { AdshiftThirdPartySharing } from './types';
|
|
61
|
+
export type { AdshiftThirdPartySharing as AdshiftThirdPartySharingType } from './types';
|
|
56
62
|
|
|
57
63
|
// ============ Deep Link ============
|
|
58
|
-
//
|
|
59
|
-
export { AdshiftDeepLinkStatus, AdshiftDeepLink
|
|
64
|
+
// AdshiftDeepLink is both a type (interface) and a value (helper object).
|
|
65
|
+
export { AdshiftDeepLinkStatus, AdshiftDeepLink } from './types';
|
|
60
66
|
export type { AdshiftDeepLink as AdshiftDeepLinkType } from './types';
|
|
61
67
|
|
|
62
|
-
// ============
|
|
68
|
+
// ============ Events ============
|
|
63
69
|
export { AdshiftEventType, getAllEventTypes } from './types';
|
|
64
70
|
export type { AdshiftEventTypeValue } from './types';
|
|
71
|
+
export { AdshiftEventParam, getAllEventParams } from './types';
|
|
72
|
+
export type { AdshiftEventParamValue } from './types';
|
|
73
|
+
|
|
74
|
+
// ============ Ad Revenue ============
|
|
75
|
+
export { AdshiftMediationNetwork } from './types';
|
|
76
|
+
export type { AdshiftMediationNetworkValue, AdRevenueParams } from './types';
|
|
77
|
+
|
|
78
|
+
// ============ Errors ============
|
|
79
|
+
export { AdshiftErrorCode, isAdshiftError } from './types';
|
|
80
|
+
export type { AdshiftError, AdshiftErrorInfo } from './types';
|
|
65
81
|
|
|
66
|
-
// ============
|
|
67
|
-
export {
|
|
68
|
-
export type { Spec as AdShiftNativeSpec } from './NativeAdShiftReactNativePlugin';
|
|
82
|
+
// ============ Version ============
|
|
83
|
+
export { PLUGIN_VERSION } from './version';
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jest support for apps that use `@adshift/react-native-plugin`.
|
|
3
|
+
*
|
|
4
|
+
* The plugin resolves its native module at import time, which fails in a
|
|
5
|
+
* plain Jest environment. Register this mock in your Jest setup file:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* // jest.setup.js
|
|
9
|
+
* jest.mock('@adshift/react-native-plugin', () =>
|
|
10
|
+
* require('@adshift/react-native-plugin/jest').createAdshiftMock()
|
|
11
|
+
* );
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Every method is a `jest.fn()` with a resolved default so tests can assert
|
|
15
|
+
* calls or override behaviour per test.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { Platform } from 'react-native';
|
|
19
|
+
|
|
20
|
+
import type { AdshiftConfig } from '../types/AdshiftConfig';
|
|
21
|
+
import type { AdshiftConsent as AdshiftConsentType } from '../types/AdshiftConsent';
|
|
22
|
+
import { AdshiftConsent } from '../types/AdshiftConsent';
|
|
23
|
+
import type { AdshiftThirdPartySharing as AdshiftThirdPartySharingType } from '../types/AdshiftThirdPartySharing';
|
|
24
|
+
import { AdshiftThirdPartySharing } from '../types/AdshiftThirdPartySharing';
|
|
25
|
+
import type { AdshiftDeepLink as AdshiftDeepLinkType } from '../types/AdshiftDeepLink';
|
|
26
|
+
import {
|
|
27
|
+
AdshiftDeepLink,
|
|
28
|
+
AdshiftDeepLinkStatus,
|
|
29
|
+
} from '../types/AdshiftDeepLink';
|
|
30
|
+
import { AdshiftEventType, getAllEventTypes } from '../types/AdshiftEventType';
|
|
31
|
+
import {
|
|
32
|
+
AdshiftEventParam,
|
|
33
|
+
getAllEventParams,
|
|
34
|
+
} from '../types/AdshiftEventParam';
|
|
35
|
+
import { AdshiftMediationNetwork } from '../types/AdshiftAdRevenue';
|
|
36
|
+
import { NATIVE_SDK_VERSIONS } from '../nativeSdkVersions';
|
|
37
|
+
import {
|
|
38
|
+
AdshiftErrorCode,
|
|
39
|
+
createAdshiftError,
|
|
40
|
+
isAdshiftError,
|
|
41
|
+
} from '../types/AdshiftError';
|
|
42
|
+
import { PLUGIN_VERSION } from '../version';
|
|
43
|
+
|
|
44
|
+
type MockFn<T extends (...args: never[]) => unknown> = jest.Mock<
|
|
45
|
+
ReturnType<T>,
|
|
46
|
+
Parameters<T>
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
type Listener = (deepLink: AdshiftDeepLinkType) => void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Mocked `Adshift` object with test helpers.
|
|
53
|
+
*/
|
|
54
|
+
export interface AdshiftMock {
|
|
55
|
+
initialize: MockFn<(config: AdshiftConfig) => void>;
|
|
56
|
+
start: MockFn<() => Promise<{ success: boolean }>>;
|
|
57
|
+
stop: MockFn<() => void>;
|
|
58
|
+
isStarted: MockFn<() => boolean>;
|
|
59
|
+
setCustomerUserId: MockFn<(userId: string) => void>;
|
|
60
|
+
setDebugEnabled: MockFn<(enabled: boolean) => void>;
|
|
61
|
+
setAppOpenDebounceMs: MockFn<(ms: number) => void>;
|
|
62
|
+
setBrandedDomains: MockFn<(domains: string[]) => void>;
|
|
63
|
+
setMetaAppId: MockFn<(appId: string) => void>;
|
|
64
|
+
setOaidData: MockFn<(oaid: string) => void>;
|
|
65
|
+
setConsentData: MockFn<(consent: AdshiftConsentType) => void>;
|
|
66
|
+
enableTCFDataCollection: MockFn<(enabled: boolean) => void>;
|
|
67
|
+
enableGPPDataCollection: MockFn<(enabled: boolean) => void>;
|
|
68
|
+
setThirdPartySharing: MockFn<(sharing: AdshiftThirdPartySharingType) => void>;
|
|
69
|
+
clearThirdPartySharing: MockFn<() => void>;
|
|
70
|
+
refreshConsent: MockFn<() => Promise<Record<string, unknown>>>;
|
|
71
|
+
trackEvent: MockFn<
|
|
72
|
+
(eventName: string, values?: Record<string, unknown>) => Promise<void>
|
|
73
|
+
>;
|
|
74
|
+
trackPurchase: MockFn<(params: Record<string, unknown>) => Promise<void>>;
|
|
75
|
+
logAdRevenue: MockFn<(params: Record<string, unknown>) => Promise<void>>;
|
|
76
|
+
getAdShiftDeviceId: MockFn<() => Promise<string | null>>;
|
|
77
|
+
handleDeepLink: MockFn<(url: string) => Promise<void>>;
|
|
78
|
+
addPushNotificationDeepLinkPath: MockFn<(path: string[]) => void>;
|
|
79
|
+
handlePushNotification: MockFn<
|
|
80
|
+
(payload: Record<string, unknown>) => Promise<boolean>
|
|
81
|
+
>;
|
|
82
|
+
onDeepLink: MockFn<(callback: Listener) => { remove: () => void }>;
|
|
83
|
+
getInfo: MockFn<
|
|
84
|
+
() => {
|
|
85
|
+
platform: string;
|
|
86
|
+
version: string;
|
|
87
|
+
nativeSdkVersions: { android: string; ios: string };
|
|
88
|
+
}
|
|
89
|
+
>;
|
|
90
|
+
|
|
91
|
+
/** Test helper: delivers a deep link to every registered listener. */
|
|
92
|
+
__emitDeepLink(deepLink: AdshiftDeepLinkType): void;
|
|
93
|
+
/**
|
|
94
|
+
* Test helper: returns the mock to the state it had when it was created —
|
|
95
|
+
* listeners gone, started flag down, recorded calls and any per-test
|
|
96
|
+
* behaviour dropped, default answers back in place.
|
|
97
|
+
*/
|
|
98
|
+
__reset(): void;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Shape returned by `createAdshiftMock()`; mirrors the package exports.
|
|
103
|
+
*/
|
|
104
|
+
export interface AdshiftModuleMock {
|
|
105
|
+
Adshift: AdshiftMock;
|
|
106
|
+
default: AdshiftMock;
|
|
107
|
+
AdshiftConsent: typeof AdshiftConsent;
|
|
108
|
+
AdshiftThirdPartySharing: typeof AdshiftThirdPartySharing;
|
|
109
|
+
AdshiftDeepLink: typeof AdshiftDeepLink;
|
|
110
|
+
AdshiftDeepLinkStatus: typeof AdshiftDeepLinkStatus;
|
|
111
|
+
AdshiftEventType: typeof AdshiftEventType;
|
|
112
|
+
getAllEventTypes: typeof getAllEventTypes;
|
|
113
|
+
AdshiftEventParam: typeof AdshiftEventParam;
|
|
114
|
+
getAllEventParams: typeof getAllEventParams;
|
|
115
|
+
AdshiftMediationNetwork: typeof AdshiftMediationNetwork;
|
|
116
|
+
AdshiftErrorCode: typeof AdshiftErrorCode;
|
|
117
|
+
isAdshiftError: typeof isAdshiftError;
|
|
118
|
+
PLUGIN_VERSION: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Creates a fresh mock of the package. Call inside `jest.mock()`.
|
|
123
|
+
*/
|
|
124
|
+
export function createAdshiftMock(): AdshiftModuleMock {
|
|
125
|
+
const listeners = new Set<Listener>();
|
|
126
|
+
let started = false;
|
|
127
|
+
|
|
128
|
+
const mock = {
|
|
129
|
+
initialize: jest.fn(),
|
|
130
|
+
start: jest.fn(async () => {
|
|
131
|
+
started = true;
|
|
132
|
+
return { success: true, apiKeyValidationStatus: 'pending' as const };
|
|
133
|
+
}),
|
|
134
|
+
stop: jest.fn(() => {
|
|
135
|
+
started = false;
|
|
136
|
+
}),
|
|
137
|
+
isStarted: jest.fn(() => started),
|
|
138
|
+
setCustomerUserId: jest.fn(),
|
|
139
|
+
setDebugEnabled: jest.fn(),
|
|
140
|
+
setAppOpenDebounceMs: jest.fn(),
|
|
141
|
+
setBrandedDomains: jest.fn(),
|
|
142
|
+
setMetaAppId: jest.fn(),
|
|
143
|
+
setOaidData: jest.fn(),
|
|
144
|
+
setConsentData: jest.fn(),
|
|
145
|
+
enableTCFDataCollection: jest.fn(),
|
|
146
|
+
enableGPPDataCollection: jest.fn(),
|
|
147
|
+
setThirdPartySharing: jest.fn(),
|
|
148
|
+
clearThirdPartySharing: jest.fn(),
|
|
149
|
+
refreshConsent: jest.fn(async () => ({
|
|
150
|
+
source: 'none',
|
|
151
|
+
tcStringPresent: false,
|
|
152
|
+
cmpDetected: false,
|
|
153
|
+
appliedAtMillis: 0,
|
|
154
|
+
adIdentifiersAllowed: true,
|
|
155
|
+
})),
|
|
156
|
+
trackEvent: jest.fn(async () => undefined),
|
|
157
|
+
trackPurchase: jest.fn(async () => undefined),
|
|
158
|
+
logAdRevenue: jest.fn(async () => undefined),
|
|
159
|
+
getAdShiftDeviceId: jest.fn(async () => 'mock-device-id'),
|
|
160
|
+
handleDeepLink: jest.fn(async () => undefined),
|
|
161
|
+
addPushNotificationDeepLinkPath: jest.fn(),
|
|
162
|
+
handlePushNotification: jest.fn(async () => false),
|
|
163
|
+
onDeepLink: jest.fn((callback: Listener) => {
|
|
164
|
+
listeners.add(callback);
|
|
165
|
+
return {
|
|
166
|
+
remove: () => {
|
|
167
|
+
listeners.delete(callback);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}),
|
|
171
|
+
getInfo: jest.fn(() => ({
|
|
172
|
+
platform: Platform.OS,
|
|
173
|
+
version: PLUGIN_VERSION,
|
|
174
|
+
nativeSdkVersions: { ...NATIVE_SDK_VERSIONS },
|
|
175
|
+
})),
|
|
176
|
+
__emitDeepLink(deepLink: AdshiftDeepLinkType) {
|
|
177
|
+
for (const listener of Array.from(listeners)) {
|
|
178
|
+
listener(deepLink);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
__reset() {
|
|
182
|
+
listeners.clear();
|
|
183
|
+
started = false;
|
|
184
|
+
restoreDefaults();
|
|
185
|
+
},
|
|
186
|
+
} as unknown as AdshiftMock;
|
|
187
|
+
|
|
188
|
+
// Held so `__reset()` can drop what a test recorded or overrode without
|
|
189
|
+
// taking the default answers with it.
|
|
190
|
+
const defaults = new Map<jest.Mock, (...args: never[]) => unknown>();
|
|
191
|
+
for (const value of Object.values(mock)) {
|
|
192
|
+
if (jest.isMockFunction(value)) {
|
|
193
|
+
defaults.set(value, value.getMockImplementation() as never);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function restoreDefaults(): void {
|
|
198
|
+
for (const [fn, implementation] of defaults) {
|
|
199
|
+
fn.mockReset();
|
|
200
|
+
if (implementation) {
|
|
201
|
+
fn.mockImplementation(implementation);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
Adshift: mock,
|
|
208
|
+
default: mock,
|
|
209
|
+
AdshiftConsent,
|
|
210
|
+
AdshiftThirdPartySharing,
|
|
211
|
+
AdshiftDeepLink,
|
|
212
|
+
AdshiftDeepLinkStatus,
|
|
213
|
+
AdshiftEventType,
|
|
214
|
+
getAllEventTypes,
|
|
215
|
+
AdshiftEventParam,
|
|
216
|
+
getAllEventParams,
|
|
217
|
+
AdshiftMediationNetwork,
|
|
218
|
+
AdshiftErrorCode,
|
|
219
|
+
isAdshiftError,
|
|
220
|
+
PLUGIN_VERSION,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export { AdshiftErrorCode, createAdshiftError, isAdshiftError };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native SDK versions this plugin is pinned to.
|
|
3
|
+
*
|
|
4
|
+
* Kept in its own module so the Jest mock can report the same values without
|
|
5
|
+
* loading the native module, and so a release bumps them in one place.
|
|
6
|
+
*/
|
|
7
|
+
export const NATIVE_SDK_VERSIONS = Object.freeze({
|
|
8
|
+
android: '3.1.0',
|
|
9
|
+
ios: '2.2.0',
|
|
10
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mediation platform that reported the ad impression.
|
|
3
|
+
*
|
|
4
|
+
* Values are the identifiers used on the wire by the native SDKs.
|
|
5
|
+
*/
|
|
6
|
+
export const AdshiftMediationNetwork = {
|
|
7
|
+
AppLovinMAX: 'applovin_max',
|
|
8
|
+
GoogleAdMob: 'google_admob',
|
|
9
|
+
IronSource: 'ironsource',
|
|
10
|
+
Chartboost: 'chartboost',
|
|
11
|
+
TopOn: 'topon',
|
|
12
|
+
TradPlus: 'tradplus',
|
|
13
|
+
AdMost: 'admost',
|
|
14
|
+
Appodeal: 'appodeal',
|
|
15
|
+
Fyber: 'fyber',
|
|
16
|
+
Unity: 'unity',
|
|
17
|
+
Yandex: 'yandex',
|
|
18
|
+
CustomMediation: 'custom_mediation',
|
|
19
|
+
DirectMonetization: 'direct_monetization_network',
|
|
20
|
+
Other: 'other',
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Type of all mediation network values.
|
|
25
|
+
*/
|
|
26
|
+
export type AdshiftMediationNetworkValue =
|
|
27
|
+
(typeof AdshiftMediationNetwork)[keyof typeof AdshiftMediationNetwork];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parameters for `Adshift.logAdRevenue()`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* await Adshift.logAdRevenue({
|
|
35
|
+
* monetizationNetwork: 'admob',
|
|
36
|
+
* mediationNetwork: AdshiftMediationNetwork.GoogleAdMob,
|
|
37
|
+
* currency: 'USD',
|
|
38
|
+
* revenue: 0.0125,
|
|
39
|
+
* adUnitId: 'ca-app-pub-1234/5678',
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export interface AdRevenueParams {
|
|
44
|
+
/** Ad network that served the impression, e.g. `admob`, `meta`. */
|
|
45
|
+
monetizationNetwork: string;
|
|
46
|
+
/** Mediation platform that reported the impression. */
|
|
47
|
+
mediationNetwork: AdshiftMediationNetworkValue;
|
|
48
|
+
/** ISO 4217 currency code, e.g. `USD`. */
|
|
49
|
+
currency: string;
|
|
50
|
+
/** Revenue of the single impression in `currency`. Must be positive. */
|
|
51
|
+
revenue: number;
|
|
52
|
+
/** Ad unit identifier, when available. */
|
|
53
|
+
adUnitId?: string;
|
|
54
|
+
/** Revenue precision reported by the network, e.g. `exact`, `estimated`. */
|
|
55
|
+
precision?: string;
|
|
56
|
+
/** Extra parameters attached to the event. */
|
|
57
|
+
additionalParameters?: Record<string, string | number | boolean>;
|
|
58
|
+
}
|