@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.
Files changed (180) hide show
  1. package/AdShiftReactNativePlugin.podspec +11 -7
  2. package/CHANGELOG.md +122 -0
  3. package/README.md +506 -542
  4. package/android/build.gradle +17 -3
  5. package/android/consumer-rules.pro +21 -0
  6. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +786 -229
  7. package/android/src/test/java/com/adshift/reactnativeplugin/ConsentSnapshotTest.kt +180 -0
  8. package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +146 -0
  9. package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +111 -0
  10. package/android/src/test/java/com/adshift/reactnativeplugin/IntentLinkDedupTest.kt +168 -0
  11. package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +106 -0
  12. package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +167 -0
  13. package/android/src/test/java/com/adshift/reactnativeplugin/StartVerdictTest.kt +164 -0
  14. package/ios/AdShiftReactNativePlugin.h +7 -7
  15. package/ios/AdShiftReactNativePlugin.mm +200 -181
  16. package/ios/AdShiftReactNativePluginHelper.swift +584 -286
  17. package/ios/Core/BridgeRules.swift +82 -0
  18. package/lib/commonjs/Adshift.js +1135 -0
  19. package/lib/commonjs/Adshift.js.map +1 -0
  20. package/lib/commonjs/NativeAdShiftReactNativePlugin.js +22 -0
  21. package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -0
  22. package/lib/commonjs/index.js +94 -0
  23. package/lib/commonjs/index.js.map +1 -0
  24. package/lib/commonjs/jest/index.js +164 -0
  25. package/lib/commonjs/jest/index.js.map +1 -0
  26. package/lib/commonjs/nativeSdkVersions.js +17 -0
  27. package/lib/commonjs/nativeSdkVersions.js.map +1 -0
  28. package/lib/commonjs/package.json +1 -0
  29. package/lib/commonjs/types/AdshiftAdRevenue.js +47 -0
  30. package/lib/commonjs/types/AdshiftAdRevenue.js.map +1 -0
  31. package/lib/commonjs/types/AdshiftConfig.js +45 -0
  32. package/lib/commonjs/types/AdshiftConfig.js.map +1 -0
  33. package/lib/commonjs/types/AdshiftConsent.js +113 -0
  34. package/lib/commonjs/types/AdshiftConsent.js.map +1 -0
  35. package/lib/commonjs/types/AdshiftConsentSnapshot.js +69 -0
  36. package/lib/commonjs/types/AdshiftConsentSnapshot.js.map +1 -0
  37. package/lib/commonjs/types/AdshiftDeepLink.js +154 -0
  38. package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -0
  39. package/lib/commonjs/types/AdshiftError.js +91 -0
  40. package/lib/commonjs/types/AdshiftError.js.map +1 -0
  41. package/lib/commonjs/types/AdshiftEventParam.js +140 -0
  42. package/lib/commonjs/types/AdshiftEventParam.js.map +1 -0
  43. package/lib/commonjs/types/AdshiftEventType.js +88 -0
  44. package/lib/commonjs/types/AdshiftEventType.js.map +1 -0
  45. package/lib/commonjs/types/AdshiftThirdPartySharing.js +70 -0
  46. package/lib/commonjs/types/AdshiftThirdPartySharing.js.map +1 -0
  47. package/lib/commonjs/types/index.js +123 -0
  48. package/lib/commonjs/types/index.js.map +1 -0
  49. package/lib/commonjs/version.js +9 -0
  50. package/lib/commonjs/version.js.map +1 -0
  51. package/lib/module/Adshift.js +959 -296
  52. package/lib/module/Adshift.js.map +1 -1
  53. package/lib/module/NativeAdShiftReactNativePlugin.js +10 -7
  54. package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
  55. package/lib/module/index.js +26 -25
  56. package/lib/module/index.js.map +1 -1
  57. package/lib/module/jest/index.js +144 -0
  58. package/lib/module/jest/index.js.map +1 -0
  59. package/lib/module/nativeSdkVersions.js +13 -0
  60. package/lib/module/nativeSdkVersions.js.map +1 -0
  61. package/lib/module/types/AdshiftAdRevenue.js +43 -0
  62. package/lib/module/types/AdshiftAdRevenue.js.map +1 -0
  63. package/lib/module/types/AdshiftConfig.js +23 -26
  64. package/lib/module/types/AdshiftConfig.js.map +1 -1
  65. package/lib/module/types/AdshiftConsent.js +57 -50
  66. package/lib/module/types/AdshiftConsent.js.map +1 -1
  67. package/lib/module/types/AdshiftConsentSnapshot.js +65 -0
  68. package/lib/module/types/AdshiftConsentSnapshot.js.map +1 -0
  69. package/lib/module/types/AdshiftDeepLink.js +97 -67
  70. package/lib/module/types/AdshiftDeepLink.js.map +1 -1
  71. package/lib/module/types/AdshiftError.js +87 -0
  72. package/lib/module/types/AdshiftError.js.map +1 -0
  73. package/lib/module/types/AdshiftEventParam.js +135 -0
  74. package/lib/module/types/AdshiftEventParam.js.map +1 -0
  75. package/lib/module/types/AdshiftEventType.js +11 -36
  76. package/lib/module/types/AdshiftEventType.js.map +1 -1
  77. package/lib/module/types/AdshiftThirdPartySharing.js +65 -0
  78. package/lib/module/types/AdshiftThirdPartySharing.js.map +1 -0
  79. package/lib/module/types/index.js +9 -7
  80. package/lib/module/types/index.js.map +1 -1
  81. package/lib/module/version.js +5 -0
  82. package/lib/module/version.js.map +1 -0
  83. package/lib/typescript/commonjs/package.json +1 -0
  84. package/lib/typescript/commonjs/src/Adshift.d.ts +311 -0
  85. package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -0
  86. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
  87. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/src/index.d.ts +51 -0
  89. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/src/jest/index.d.ts +103 -0
  91. package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +11 -0
  93. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts +56 -0
  95. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +104 -0
  97. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts +76 -0
  99. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts.map +1 -0
  100. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts +56 -0
  101. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
  102. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +89 -0
  103. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -0
  104. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts +57 -0
  105. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts.map +1 -0
  106. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts +111 -0
  107. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts.map +1 -0
  108. package/lib/typescript/{src → commonjs/src}/types/AdshiftEventType.d.ts +12 -35
  109. package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts.map +1 -0
  110. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts +53 -0
  111. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
  112. package/lib/typescript/commonjs/src/types/index.d.ts +17 -0
  113. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -0
  114. package/lib/typescript/commonjs/src/version.d.ts +2 -0
  115. package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
  116. package/lib/typescript/module/src/Adshift.d.ts +311 -0
  117. package/lib/typescript/module/src/Adshift.d.ts.map +1 -0
  118. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +102 -0
  119. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -0
  120. package/lib/typescript/module/src/index.d.ts +51 -0
  121. package/lib/typescript/module/src/index.d.ts.map +1 -0
  122. package/lib/typescript/module/src/jest/index.d.ts +103 -0
  123. package/lib/typescript/module/src/jest/index.d.ts.map +1 -0
  124. package/lib/typescript/module/src/nativeSdkVersions.d.ts +11 -0
  125. package/lib/typescript/module/src/nativeSdkVersions.d.ts.map +1 -0
  126. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts +56 -0
  127. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts.map +1 -0
  128. package/lib/typescript/module/src/types/AdshiftConfig.d.ts +104 -0
  129. package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -0
  130. package/lib/typescript/module/src/types/AdshiftConsent.d.ts +76 -0
  131. package/lib/typescript/module/src/types/AdshiftConsent.d.ts.map +1 -0
  132. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts +56 -0
  133. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts.map +1 -0
  134. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +89 -0
  135. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -0
  136. package/lib/typescript/module/src/types/AdshiftError.d.ts +57 -0
  137. package/lib/typescript/module/src/types/AdshiftError.d.ts.map +1 -0
  138. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts +111 -0
  139. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts.map +1 -0
  140. package/lib/typescript/module/src/types/AdshiftEventType.d.ts +64 -0
  141. package/lib/typescript/module/src/types/AdshiftEventType.d.ts.map +1 -0
  142. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts +53 -0
  143. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts.map +1 -0
  144. package/lib/typescript/module/src/types/index.d.ts +17 -0
  145. package/lib/typescript/module/src/types/index.d.ts.map +1 -0
  146. package/lib/typescript/module/src/version.d.ts +2 -0
  147. package/lib/typescript/module/src/version.d.ts.map +1 -0
  148. package/package.json +49 -10
  149. package/src/Adshift.ts +1273 -342
  150. package/src/NativeAdShiftReactNativePlugin.ts +81 -115
  151. package/src/index.tsx +40 -25
  152. package/src/jest/index.ts +224 -0
  153. package/src/nativeSdkVersions.ts +10 -0
  154. package/src/types/AdshiftAdRevenue.ts +58 -0
  155. package/src/types/AdshiftConfig.ts +101 -53
  156. package/src/types/AdshiftConsent.ts +75 -72
  157. package/src/types/AdshiftConsentSnapshot.ts +103 -0
  158. package/src/types/AdshiftDeepLink.ts +123 -102
  159. package/src/types/AdshiftError.ts +107 -0
  160. package/src/types/AdshiftEventParam.ts +216 -0
  161. package/src/types/AdshiftEventType.ts +13 -35
  162. package/src/types/AdshiftThirdPartySharing.ts +63 -0
  163. package/src/types/index.ts +38 -6
  164. package/src/version.ts +2 -0
  165. package/lib/typescript/src/Adshift.d.ts +0 -335
  166. package/lib/typescript/src/Adshift.d.ts.map +0 -1
  167. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts +0 -143
  168. package/lib/typescript/src/NativeAdShiftReactNativePlugin.d.ts.map +0 -1
  169. package/lib/typescript/src/index.d.ts +0 -47
  170. package/lib/typescript/src/index.d.ts.map +0 -1
  171. package/lib/typescript/src/types/AdshiftConfig.d.ts +0 -74
  172. package/lib/typescript/src/types/AdshiftConfig.d.ts.map +0 -1
  173. package/lib/typescript/src/types/AdshiftConsent.d.ts +0 -88
  174. package/lib/typescript/src/types/AdshiftConsent.d.ts.map +0 -1
  175. package/lib/typescript/src/types/AdshiftDeepLink.d.ts +0 -93
  176. package/lib/typescript/src/types/AdshiftDeepLink.d.ts.map +0 -1
  177. package/lib/typescript/src/types/AdshiftEventType.d.ts.map +0 -1
  178. package/lib/typescript/src/types/index.d.ts +0 -5
  179. package/lib/typescript/src/types/index.d.ts.map +0 -1
  180. /package/lib/typescript/{package.json → module/package.json} +0 -0
@@ -0,0 +1,311 @@
1
+ /**
2
+ * AdShift SDK for React Native.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * import {
7
+ * Adshift,
8
+ * AdshiftEventParam,
9
+ * AdshiftEventType,
10
+ * } from '@adshift/react-native-plugin';
11
+ *
12
+ * // 1. Register the deep link listener (safe to do before initialize)
13
+ * const subscription = Adshift.onDeepLink((deepLink) => {
14
+ * // route on deepLink.deepLinkValue / deepLink.params
15
+ * });
16
+ *
17
+ * // 2. Initialize
18
+ * Adshift.initialize({ apiKey: 'your-api-key', isDebug: __DEV__ });
19
+ *
20
+ * // 3. Start
21
+ * const result = await Adshift.start();
22
+ *
23
+ * // 4. Track
24
+ * await Adshift.trackEvent(AdshiftEventType.Purchase, {
25
+ * [AdshiftEventParam.Revenue]: 9.99,
26
+ * [AdshiftEventParam.Currency]: 'USD',
27
+ * });
28
+ *
29
+ * // Later: subscription.remove();
30
+ * ```
31
+ */
32
+ import type { AdRevenueParams, AdshiftConfig, AdshiftConsent, AdshiftDeepLink, AdshiftEventTypeValue, AdshiftThirdPartySharing, ConsentSnapshot } from './types';
33
+ import { AdshiftErrorCode } from './types';
34
+ /**
35
+ * Result of `Adshift.start()`.
36
+ *
37
+ * `success` reports whether the SDK started locally. Backend validation of
38
+ * the API key continues in the background; a rejected key is reported through
39
+ * `config.onError` as `INVALID_API_KEY`.
40
+ */
41
+ export interface StartResult {
42
+ success: boolean;
43
+ /**
44
+ * Outcome of the API key check at the time `start()` resolved.
45
+ * `pending` means the answer had not arrived yet when `start()` resolved; it
46
+ * changes nothing you have to do, since the SDK keeps the data either way.
47
+ */
48
+ apiKeyValidationStatus?: ApiKeyValidationStatus;
49
+ /** Platform error number behind `errorCode`, for support requests. */
50
+ nativeCode?: number | string;
51
+ /** Platform error domain behind `errorCode`. @platform ios */
52
+ nativeDomain?: string;
53
+ /** Set when `success` is false. */
54
+ errorCode?: AdshiftErrorCode;
55
+ /** Set when `success` is false. */
56
+ errorMessage?: string;
57
+ }
58
+ /** How far the API key check had got when `start()` resolved. */
59
+ export type ApiKeyValidationStatus = 'pending' | 'valid' | 'invalid';
60
+ export type EventValues = Record<string, string | number | boolean>;
61
+ /**
62
+ * Parameters for `Adshift.trackPurchase()`.
63
+ */
64
+ export interface PurchaseParams {
65
+ /** Product identifier. */
66
+ productId: string;
67
+ /** Purchase amount in `currency`. */
68
+ revenue: number;
69
+ /** ISO 4217 currency code, e.g. `USD`. */
70
+ currency: string;
71
+ /** Transaction id or purchase token. */
72
+ transactionId: string;
73
+ }
74
+ /**
75
+ * Subscription returned by `Adshift.onDeepLink()`.
76
+ */
77
+ export interface DeepLinkSubscription {
78
+ /** Removes the listener. Safe to call more than once. */
79
+ remove(): void;
80
+ }
81
+ export type DeepLinkCallback = (deepLink: AdshiftDeepLink) => void;
82
+ /**
83
+ * Native SDK versions bundled with this plugin release.
84
+ */
85
+ export interface NativeSdkVersions {
86
+ android: string;
87
+ ios: string;
88
+ }
89
+ /**
90
+ * Plugin information returned by `Adshift.getInfo()`.
91
+ */
92
+ export interface AdshiftInfo {
93
+ /** `Platform.OS`; the SDK only supports `ios` and `android`. */
94
+ platform: 'ios' | 'android' | (string & {});
95
+ /** Plugin version. */
96
+ version: string;
97
+ /** Native SDK versions this plugin depends on. */
98
+ nativeSdkVersions: NativeSdkVersions;
99
+ }
100
+ export declare const Adshift: {
101
+ /**
102
+ * Initializes the SDK.
103
+ *
104
+ * Call once, as early as possible (e.g. at module scope of `App.tsx`).
105
+ * The configuration is fixed on the first call; later calls are ignored.
106
+ *
107
+ * Never raises, because it is meant to run at module scope, where an error
108
+ * would stop the bundle from evaluating. An unusable config is reported
109
+ * through `config.onError` and answered by `start()`.
110
+ */
111
+ readonly initialize: (config: AdshiftConfig) => void;
112
+ /**
113
+ * Starts the SDK.
114
+ *
115
+ * Resolves once the SDK has started locally. Never rejects; inspect
116
+ * `result.success` and `result.errorCode`. Calls to `trackEvent`,
117
+ * `trackPurchase` and `logAdRevenue` made before this resolves are queued
118
+ * and dispatched afterwards. A start that fails with a reason retrying
119
+ * cannot fix rejects them instead; any other failure keeps them waiting for
120
+ * the next attempt.
121
+ */
122
+ readonly start: () => Promise<StartResult>;
123
+ /**
124
+ * Stops the SDK. Tracking calls reject with `NOT_STARTED` until the next
125
+ * successful `start()`.
126
+ *
127
+ * Before `initialize()` there is nothing to stop: the call is reported and
128
+ * skipped.
129
+ */
130
+ readonly stop: () => void;
131
+ /**
132
+ * Whether `start()` has completed successfully and `stop()` has not been
133
+ * called since. Safe to call before `initialize()`.
134
+ */
135
+ readonly isStarted: () => boolean;
136
+ /**
137
+ * Sets your own user identifier. Can be called before or after `start()`.
138
+ *
139
+ * Called before `initialize()`, the value is kept and applied afterwards.
140
+ * An empty identifier is reported and skipped; nothing is raised.
141
+ */
142
+ readonly setCustomerUserId: (userId: string) => void;
143
+ /**
144
+ * Enables or disables verbose SDK logging at runtime.
145
+ *
146
+ * Called before `initialize()`, the value is kept and applied afterwards.
147
+ */
148
+ readonly setDebugEnabled: (enabled: boolean) => void;
149
+ /**
150
+ * Sets the debounce interval for automatic `app_open` events.
151
+ *
152
+ * Called before `initialize()`, the value is kept and applied afterwards.
153
+ * A negative interval is reported and skipped; nothing is raised.
154
+ */
155
+ readonly setAppOpenDebounceMs: (ms: number) => void;
156
+ /**
157
+ * Sets branded attribution domains. Must be called before `start()`.
158
+ *
159
+ * Called before `initialize()`, the domains are kept and applied with the
160
+ * config, so they are in place before the first link is processed.
161
+ */
162
+ readonly setBrandedDomains: (domains: string[]) => void;
163
+ /**
164
+ * Sets the Meta app id used to parse Meta App Links. No-op on iOS.
165
+ *
166
+ * Called before `initialize()`, the value is kept and applied afterwards.
167
+ */
168
+ readonly setMetaAppId: (appId: string) => void;
169
+ /**
170
+ * Hands over an OAID the app obtained itself, for Android devices without
171
+ * Google Play services. Set `collectOaid: false` when you supply it this
172
+ * way. No-op on iOS.
173
+ *
174
+ * Called before `initialize()`, the value is kept and applied afterwards.
175
+ */
176
+ readonly setOaidData: (oaid: string) => void;
177
+ /**
178
+ * Sets consent collected by your own UI. Use `AdshiftConsent.forGDPRUser()`
179
+ * or `AdshiftConsent.forNonGDPRUser()`.
180
+ *
181
+ * Called before `initialize()`, the consent is kept and applied afterwards.
182
+ */
183
+ readonly setConsentData: (consent: AdshiftConsent) => void;
184
+ /**
185
+ * Enables or disables reading IAB TCF v2.2 consent from the CMP on device.
186
+ * Call before `start()`.
187
+ *
188
+ * Called before `initialize()`, the value is kept and applied afterwards.
189
+ */
190
+ readonly enableTCFDataCollection: (enabled: boolean) => void;
191
+ /**
192
+ * Enables reading an IAB GPP string written by the CMP on device, used for US
193
+ * state privacy signals. Off until called with `true`.
194
+ *
195
+ * The GPP string rides on its own axis: it is forwarded alongside whatever
196
+ * decides the GDPR axis, including a consent set through `setConsentData()`,
197
+ * and it does not gate the advertising identifier on the device.
198
+ *
199
+ * Call before `start()`. Called before `initialize()`, the value is kept and
200
+ * applied afterwards.
201
+ */
202
+ readonly enableGPPDataCollection: (enabled: boolean) => void;
203
+ /**
204
+ * States what the app collected about passing this user's data on to
205
+ * advertising partners. Use `AdshiftThirdPartySharing.optedOut()` or
206
+ * `AdshiftThirdPartySharing.allowed()`.
207
+ *
208
+ * This is the answer to a different question than `setConsentData()`, and it
209
+ * has the opposite default: nothing said here means sharing is allowed, so
210
+ * only call it once the user has actually been asked. Setting `allowed()` at
211
+ * startup as a default records a declaration the user never made, and events
212
+ * already sent cannot be recalled when a real answer arrives.
213
+ *
214
+ * Nothing is gated on the device either way — this travels with the events for
215
+ * the backend to act on.
216
+ *
217
+ * Called before `initialize()`, the answer is kept and applied afterwards.
218
+ */
219
+ readonly setThirdPartySharing: (sharing: AdshiftThirdPartySharing) => void;
220
+ /**
221
+ * Withdraws the answer set by `setThirdPartySharing()`.
222
+ *
223
+ * Subsequent events state nothing on this axis, which is not the same as
224
+ * stating that sharing is allowed: the first leaves the decision to your
225
+ * dashboard configuration, the second is the app's own declaration and is
226
+ * recorded as such.
227
+ *
228
+ * Called before `initialize()`, this cancels a `setThirdPartySharing()` that
229
+ * was also queued.
230
+ */
231
+ readonly clearThirdPartySharing: () => void;
232
+ /**
233
+ * Re-reads consent from the CMP or manual source and returns the snapshot.
234
+ * Call after the CMP dialog closes.
235
+ *
236
+ * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`).
237
+ */
238
+ readonly refreshConsent: () => Promise<ConsentSnapshot>;
239
+ /**
240
+ * Tracks an in-app event.
241
+ *
242
+ * `app_install` and `app_open` are reserved: the SDK sends them itself and
243
+ * passing them here rejects with `INVALID_ARGUMENT`.
244
+ *
245
+ * Resolves once the SDK has accepted the event. A call made between
246
+ * `initialize()` and a successful `start()` waits for the start: it is sent
247
+ * when the SDK starts, and rejects when the start fails for a reason
248
+ * retrying cannot fix (rejected key, excluded device) or after `stop()`.
249
+ * A start that failed for any other reason keeps the call waiting for the
250
+ * next attempt, so `start()` belongs on every launch path.
251
+ *
252
+ * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`, `NOT_STARTED`,
253
+ * `INVALID_API_KEY`, `OPTED_OUT`, `QUEUE_FULL`, `INVALID_ARGUMENT`).
254
+ */
255
+ readonly trackEvent: (eventName: AdshiftEventTypeValue | (string & {}), values?: EventValues) => Promise<void>;
256
+ /**
257
+ * Tracks a purchase.
258
+ *
259
+ * @returns Rejects with `AdshiftError` (see `trackEvent`).
260
+ */
261
+ readonly trackPurchase: (params: PurchaseParams) => Promise<void>;
262
+ /**
263
+ * Logs ad revenue for a single impression.
264
+ *
265
+ * @returns Rejects with `AdshiftError` (see `trackEvent`).
266
+ */
267
+ readonly logAdRevenue: (params: AdRevenueParams) => Promise<void>;
268
+ /**
269
+ * Returns the AdShift device id, or `null` before `initialize()`.
270
+ */
271
+ readonly getAdShiftDeviceId: () => Promise<string | null>;
272
+ /**
273
+ * Passes a URL to the SDK.
274
+ *
275
+ * Not needed when `autoHandleDeepLinks` is on (the default). The result is
276
+ * delivered through `onDeepLink()`; the promise resolves once the SDK has
277
+ * finished processing the URL.
278
+ *
279
+ * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
280
+ * `INVALID_ARGUMENT`).
281
+ */
282
+ readonly handleDeepLink: (url: string) => Promise<void>;
283
+ /**
284
+ * Adds a key path inside push payloads that carries an AdShift deep link.
285
+ *
286
+ * Called before `initialize()`, the path is kept and registered afterwards.
287
+ * The first path you register takes over from the top-level `as_push_link`
288
+ * the SDK reads on its own, so register that key too if you still need it.
289
+ */
290
+ readonly addPushNotificationDeepLinkPath: (path: string[]) => void;
291
+ /**
292
+ * Passes a push notification payload to the SDK. Resolves to `true` when
293
+ * the payload carried an AdShift deep link; the result then arrives
294
+ * through `onDeepLink()`.
295
+ *
296
+ * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
297
+ * `INVALID_ARGUMENT`).
298
+ */
299
+ readonly handlePushNotification: (payload: Record<string, unknown>) => Promise<boolean>;
300
+ /**
301
+ * Registers a deep link listener.
302
+ *
303
+ * Safe to call before `initialize()`. Results that arrive while no
304
+ * listener is registered are buffered and delivered to the first listener.
305
+ * Every link that reaches the SDK (direct, deferred, push) is delivered.
306
+ */
307
+ readonly onDeepLink: (callback: DeepLinkCallback) => DeepLinkSubscription;
308
+ readonly getInfo: () => AdshiftInfo;
309
+ };
310
+ export default Adshift;
311
+ //# sourceMappingURL=Adshift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Adshift.d.ts","sourceRoot":"","sources":["../../../../src/Adshift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAOH,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EAEf,qBAAqB,EACrB,wBAAwB,EACxB,eAAe,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,gBAAgB,EAUjB,MAAM,SAAS,CAAC;AAKjB;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAA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CodegenTypes } from 'react-native';
2
+ /**
3
+ * Deep link result as emitted by the native module.
4
+ *
5
+ * Every field except `params`, `isDeferred` and `status` is optional.
6
+ * `params` is always present (possibly empty).
7
+ */
8
+ export type NativeDeepLinkPayload = {
9
+ deepLink?: string;
10
+ deepLinkValue?: string;
11
+ params: {
12
+ [key: string]: string;
13
+ };
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
+ * TurboModule contract between JavaScript and native code.
26
+ *
27
+ * Complex inputs travel as `Object`; the JS layer (`Adshift.ts`) owns
28
+ * validation and typing. Results of deep link processing are delivered
29
+ * exclusively through `onDeepLink`.
30
+ */
31
+ export interface Spec extends TurboModule {
32
+ /**
33
+ * Initializes the SDK.
34
+ *
35
+ * Config keys (all optional except `apiKey`): `apiKey`, `isDebug`,
36
+ * `appOpenDebounceMs`, `brandedDomains: string[]`, `metaAppId` (Android),
37
+ * `pushDeepLinkPaths: string[][]`, `autoHandleDeepLinks`,
38
+ * `disableSKAN` / `waitForATTBeforeStart` / `attTimeoutMs` (iOS),
39
+ * `collectOaid` (Android). Keys that are absent leave SDK defaults untouched.
40
+ */
41
+ initialize(config: Object): void;
42
+ /**
43
+ * Starts the SDK. Resolves once the SDK has started locally.
44
+ *
45
+ * Result keys: `success: boolean`, `apiKeyValidationStatus?: string`
46
+ * (`pending` | `valid` | `invalid`), `errorCode?: string`,
47
+ * `errorMessage?: string`, `nativeCode?: number | string`.
48
+ */
49
+ start(): Promise<Object>;
50
+ /** Suspends delivery. Can be resumed with `start()`. */
51
+ stop(): void;
52
+ setCustomerUserId(userId: string): void;
53
+ setDebugEnabled(enabled: boolean): void;
54
+ setAppOpenDebounceMs(ms: number): void;
55
+ /** Branded attribution domains. Must precede `start()`. */
56
+ setBrandedDomains(domains: string[]): void;
57
+ /** Meta app id for Meta deep link parsing. Android only; no-op on iOS. */
58
+ setMetaAppId(appId: string): void;
59
+ /** OAID read by the app itself. Android only; no-op on iOS. */
60
+ setOaidData(oaid: string): void;
61
+ /**
62
+ * Consent keys: `isUserSubjectToGDPR: boolean`,
63
+ * `hasConsentForDataUsage` / `hasConsentForAdsPersonalization` /
64
+ * `hasConsentForAdStorage`: `boolean | null` (null = not decided).
65
+ */
66
+ setConsentData(consent: Object): void;
67
+ enableTCFDataCollection(enabled: boolean): void;
68
+ enableGPPDataCollection(enabled: boolean): void;
69
+ /** Sharing key: `optOut: boolean`. */
70
+ setThirdPartySharing(sharing: Object): void;
71
+ clearThirdPartySharing(): void;
72
+ /** Resolves to a consent snapshot object. */
73
+ refreshConsent(): Promise<Object>;
74
+ /** Resolves once the event has been accepted by the SDK queue. */
75
+ trackEvent(eventName: string, values: Object | null): Promise<void>;
76
+ trackPurchase(productId: string, price: number, currency: string, token: string): Promise<void>;
77
+ /**
78
+ * Ad revenue keys: `monetizationNetwork`, `mediationNetwork`, `currency`,
79
+ * `revenue`, optional `adUnitId`, `precision`, `additionalParameters`.
80
+ */
81
+ logAdRevenue(data: Object): Promise<void>;
82
+ /** Resolves to the AdShift device id, or null before initialization. */
83
+ getAdShiftDeviceId(): Promise<string | null>;
84
+ /**
85
+ * Passes a URL to the SDK. Resolves once processing has completed;
86
+ * the result arrives through `onDeepLink`.
87
+ *
88
+ * `fromLaunch` marks the URL that opened the app, as opposed to one opened
89
+ * while the app was running. Launch URLs are remembered for the lifetime of
90
+ * the process, so reloading JavaScript cannot book the same link twice,
91
+ * while a genuine second tap on the same link is still forwarded.
92
+ */
93
+ handleDeepLink(url: string, fromLaunch: boolean): Promise<void>;
94
+ /** Registers a push payload key path that carries a deep link. */
95
+ addPushNotificationDeepLinkPath(path: string[]): void;
96
+ /** Resolves to true when the payload was recognised as an AdShift push. */
97
+ handlePushNotification(payload: Object): Promise<boolean>;
98
+ readonly onDeepLink: CodegenTypes.EventEmitter<NativeDeepLinkPayload>;
99
+ }
100
+ declare const _default: Spec;
101
+ export default _default;
102
+ //# sourceMappingURL=NativeAdShiftReactNativePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeAdShiftReactNativePlugin.d.ts","sourceRoot":"","sources":["../../../../src/NativeAdShiftReactNativePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG9D;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,IAAK,SAAQ,WAAW;IAGvC;;;;;;;;OAQG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;;;;;OAMG;IACH,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEzB,wDAAwD;IACxD,IAAI,IAAI,IAAI,CAAC;IAIb,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAExC,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,IA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C3E,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;CACvE;;AAED,wBAEE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * AdShift React Native Plugin
3
+ *
4
+ * Mobile attribution, event tracking, SKAdNetwork, deep linking and
5
+ * GDPR/TCF 2.2 consent.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import {
10
+ * Adshift,
11
+ * AdshiftEventParam,
12
+ * AdshiftEventType,
13
+ * AdshiftConsent,
14
+ * AdshiftDeepLinkStatus,
15
+ * } from '@adshift/react-native-plugin';
16
+ *
17
+ * Adshift.onDeepLink((deepLink) => {
18
+ * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
19
+ * // route on deepLink.deepLinkValue / deepLink.params
20
+ * }
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
+ * });
29
+ * ```
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+ export { Adshift, default } from './Adshift';
34
+ export type { StartResult, EventValues, PurchaseParams, DeepLinkSubscription, DeepLinkCallback, NativeSdkVersions, AdshiftInfo, } from './Adshift';
35
+ export type { AdshiftConfig } from './types';
36
+ export { AdshiftConsent } from './types';
37
+ export type { AdshiftConsent as AdshiftConsentType, ConsentFlag, ConsentSnapshot, ConsentSource, } from './types';
38
+ export { AdshiftThirdPartySharing } from './types';
39
+ export type { AdshiftThirdPartySharing as AdshiftThirdPartySharingType } from './types';
40
+ export { AdshiftDeepLinkStatus, AdshiftDeepLink } from './types';
41
+ export type { AdshiftDeepLink as AdshiftDeepLinkType } from './types';
42
+ export { AdshiftEventType, getAllEventTypes } from './types';
43
+ export type { AdshiftEventTypeValue } from './types';
44
+ export { AdshiftEventParam, getAllEventParams } from './types';
45
+ export type { AdshiftEventParamValue } from './types';
46
+ export { AdshiftMediationNetwork } from './types';
47
+ export type { AdshiftMediationNetworkValue, AdRevenueParams } from './types';
48
+ export { AdshiftErrorCode, isAdshiftError } from './types';
49
+ export type { AdshiftError, AdshiftErrorInfo } from './types';
50
+ export { PLUGIN_VERSION } from './version';
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,YAAY,EACV,WAAW,EACX,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,WAAW,CAAC;AAGnB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EACV,cAAc,IAAI,kBAAkB,EACpC,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AACnD,YAAY,EAAE,wBAAwB,IAAI,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAIxF,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjE,YAAY,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC7D,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3D,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,103 @@
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
+ import type { AdshiftConfig } from '../types/AdshiftConfig';
18
+ import type { AdshiftConsent as AdshiftConsentType } from '../types/AdshiftConsent';
19
+ import { AdshiftConsent } from '../types/AdshiftConsent';
20
+ import type { AdshiftThirdPartySharing as AdshiftThirdPartySharingType } from '../types/AdshiftThirdPartySharing';
21
+ import { AdshiftThirdPartySharing } from '../types/AdshiftThirdPartySharing';
22
+ import type { AdshiftDeepLink as AdshiftDeepLinkType } from '../types/AdshiftDeepLink';
23
+ import { AdshiftDeepLink, AdshiftDeepLinkStatus } from '../types/AdshiftDeepLink';
24
+ import { AdshiftEventType, getAllEventTypes } from '../types/AdshiftEventType';
25
+ import { AdshiftEventParam, getAllEventParams } from '../types/AdshiftEventParam';
26
+ import { AdshiftMediationNetwork } from '../types/AdshiftAdRevenue';
27
+ import { AdshiftErrorCode, createAdshiftError, isAdshiftError } from '../types/AdshiftError';
28
+ type MockFn<T extends (...args: never[]) => unknown> = jest.Mock<ReturnType<T>, Parameters<T>>;
29
+ type Listener = (deepLink: AdshiftDeepLinkType) => void;
30
+ /**
31
+ * Mocked `Adshift` object with test helpers.
32
+ */
33
+ export interface AdshiftMock {
34
+ initialize: MockFn<(config: AdshiftConfig) => void>;
35
+ start: MockFn<() => Promise<{
36
+ success: boolean;
37
+ }>>;
38
+ stop: MockFn<() => void>;
39
+ isStarted: MockFn<() => boolean>;
40
+ setCustomerUserId: MockFn<(userId: string) => void>;
41
+ setDebugEnabled: MockFn<(enabled: boolean) => void>;
42
+ setAppOpenDebounceMs: MockFn<(ms: number) => void>;
43
+ setBrandedDomains: MockFn<(domains: string[]) => void>;
44
+ setMetaAppId: MockFn<(appId: string) => void>;
45
+ setOaidData: MockFn<(oaid: string) => void>;
46
+ setConsentData: MockFn<(consent: AdshiftConsentType) => void>;
47
+ enableTCFDataCollection: MockFn<(enabled: boolean) => void>;
48
+ enableGPPDataCollection: MockFn<(enabled: boolean) => void>;
49
+ setThirdPartySharing: MockFn<(sharing: AdshiftThirdPartySharingType) => void>;
50
+ clearThirdPartySharing: MockFn<() => void>;
51
+ refreshConsent: MockFn<() => Promise<Record<string, unknown>>>;
52
+ trackEvent: MockFn<(eventName: string, values?: Record<string, unknown>) => Promise<void>>;
53
+ trackPurchase: MockFn<(params: Record<string, unknown>) => Promise<void>>;
54
+ logAdRevenue: MockFn<(params: Record<string, unknown>) => Promise<void>>;
55
+ getAdShiftDeviceId: MockFn<() => Promise<string | null>>;
56
+ handleDeepLink: MockFn<(url: string) => Promise<void>>;
57
+ addPushNotificationDeepLinkPath: MockFn<(path: string[]) => void>;
58
+ handlePushNotification: MockFn<(payload: Record<string, unknown>) => Promise<boolean>>;
59
+ onDeepLink: MockFn<(callback: Listener) => {
60
+ remove: () => void;
61
+ }>;
62
+ getInfo: MockFn<() => {
63
+ platform: string;
64
+ version: string;
65
+ nativeSdkVersions: {
66
+ android: string;
67
+ ios: string;
68
+ };
69
+ }>;
70
+ /** Test helper: delivers a deep link to every registered listener. */
71
+ __emitDeepLink(deepLink: AdshiftDeepLinkType): void;
72
+ /**
73
+ * Test helper: returns the mock to the state it had when it was created —
74
+ * listeners gone, started flag down, recorded calls and any per-test
75
+ * behaviour dropped, default answers back in place.
76
+ */
77
+ __reset(): void;
78
+ }
79
+ /**
80
+ * Shape returned by `createAdshiftMock()`; mirrors the package exports.
81
+ */
82
+ export interface AdshiftModuleMock {
83
+ Adshift: AdshiftMock;
84
+ default: AdshiftMock;
85
+ AdshiftConsent: typeof AdshiftConsent;
86
+ AdshiftThirdPartySharing: typeof AdshiftThirdPartySharing;
87
+ AdshiftDeepLink: typeof AdshiftDeepLink;
88
+ AdshiftDeepLinkStatus: typeof AdshiftDeepLinkStatus;
89
+ AdshiftEventType: typeof AdshiftEventType;
90
+ getAllEventTypes: typeof getAllEventTypes;
91
+ AdshiftEventParam: typeof AdshiftEventParam;
92
+ getAllEventParams: typeof getAllEventParams;
93
+ AdshiftMediationNetwork: typeof AdshiftMediationNetwork;
94
+ AdshiftErrorCode: typeof AdshiftErrorCode;
95
+ isAdshiftError: typeof isAdshiftError;
96
+ PLUGIN_VERSION: string;
97
+ }
98
+ /**
99
+ * Creates a fresh mock of the package. Call inside `jest.mock()`.
100
+ */
101
+ export declare function createAdshiftMock(): AdshiftModuleMock;
102
+ export { AdshiftErrorCode, createAdshiftError, isAdshiftError };
103
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/jest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,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C;IAC5C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,iBAAiB,CAkGrD;AAED,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,11 @@
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 declare const NATIVE_SDK_VERSIONS: Readonly<{
8
+ android: "3.1.0";
9
+ ios: "2.2.0";
10
+ }>;
11
+ //# sourceMappingURL=nativeSdkVersions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nativeSdkVersions.d.ts","sourceRoot":"","sources":["../../../../src/nativeSdkVersions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC"}
@@ -0,0 +1,56 @@
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 declare const AdshiftMediationNetwork: {
7
+ readonly AppLovinMAX: "applovin_max";
8
+ readonly GoogleAdMob: "google_admob";
9
+ readonly IronSource: "ironsource";
10
+ readonly Chartboost: "chartboost";
11
+ readonly TopOn: "topon";
12
+ readonly TradPlus: "tradplus";
13
+ readonly AdMost: "admost";
14
+ readonly Appodeal: "appodeal";
15
+ readonly Fyber: "fyber";
16
+ readonly Unity: "unity";
17
+ readonly Yandex: "yandex";
18
+ readonly CustomMediation: "custom_mediation";
19
+ readonly DirectMonetization: "direct_monetization_network";
20
+ readonly Other: "other";
21
+ };
22
+ /**
23
+ * Type of all mediation network values.
24
+ */
25
+ export type AdshiftMediationNetworkValue = (typeof AdshiftMediationNetwork)[keyof typeof AdshiftMediationNetwork];
26
+ /**
27
+ * Parameters for `Adshift.logAdRevenue()`.
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * await Adshift.logAdRevenue({
32
+ * monetizationNetwork: 'admob',
33
+ * mediationNetwork: AdshiftMediationNetwork.GoogleAdMob,
34
+ * currency: 'USD',
35
+ * revenue: 0.0125,
36
+ * adUnitId: 'ca-app-pub-1234/5678',
37
+ * });
38
+ * ```
39
+ */
40
+ export interface AdRevenueParams {
41
+ /** Ad network that served the impression, e.g. `admob`, `meta`. */
42
+ monetizationNetwork: string;
43
+ /** Mediation platform that reported the impression. */
44
+ mediationNetwork: AdshiftMediationNetworkValue;
45
+ /** ISO 4217 currency code, e.g. `USD`. */
46
+ currency: string;
47
+ /** Revenue of the single impression in `currency`. Must be positive. */
48
+ revenue: number;
49
+ /** Ad unit identifier, when available. */
50
+ adUnitId?: string;
51
+ /** Revenue precision reported by the network, e.g. `exact`, `estimated`. */
52
+ precision?: string;
53
+ /** Extra parameters attached to the event. */
54
+ additionalParameters?: Record<string, string | number | boolean>;
55
+ }
56
+ //# sourceMappingURL=AdshiftAdRevenue.d.ts.map