@adshift/react-native-plugin 2.1.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/AdShiftReactNativePlugin.podspec +20 -4
  2. package/CHANGELOG.md +57 -8
  3. package/README.md +131 -74
  4. package/android/build.gradle +3 -2
  5. package/android/consumer-rules.pro +2 -21
  6. package/android/src/main/AndroidManifest.xml +14 -1
  7. package/android/src/main/java/com/adshift/reactnativeplugin/ActivityIntents.kt +307 -0
  8. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +90 -153
  9. package/android/src/test/java/com/adshift/reactnativeplugin/ConsentSnapshotTest.kt +0 -20
  10. package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +40 -7
  11. package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +51 -5
  12. package/android/src/test/java/com/adshift/reactnativeplugin/IntentLinkDedupTest.kt +0 -5
  13. package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +21 -11
  14. package/android/src/test/java/com/adshift/reactnativeplugin/LaunchLinkRecordTest.kt +420 -0
  15. package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +97 -25
  16. package/android/src/test/java/com/adshift/reactnativeplugin/StartVerdictTest.kt +0 -4
  17. package/ios/AdShiftReactNativePlugin.h +0 -12
  18. package/ios/AdShiftReactNativePlugin.mm +7 -14
  19. package/ios/AdShiftReactNativePluginHelper.swift +38 -73
  20. package/ios/Core/BridgeRules.swift +42 -30
  21. package/lib/commonjs/Adshift.js +100 -284
  22. package/lib/commonjs/Adshift.js.map +1 -1
  23. package/lib/commonjs/NativeAdShiftReactNativePlugin.js +2 -11
  24. package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -1
  25. package/lib/commonjs/index.js +6 -0
  26. package/lib/commonjs/index.js.map +1 -1
  27. package/lib/commonjs/jest/index.js +6 -18
  28. package/lib/commonjs/jest/index.js.map +1 -1
  29. package/lib/commonjs/nativeSdkVersions.js +4 -6
  30. package/lib/commonjs/nativeSdkVersions.js.map +1 -1
  31. package/lib/commonjs/types/AdshiftAdRevenue.js +0 -24
  32. package/lib/commonjs/types/AdshiftAdRevenue.js.map +1 -1
  33. package/lib/commonjs/types/AdshiftConfig.js +11 -23
  34. package/lib/commonjs/types/AdshiftConfig.js.map +1 -1
  35. package/lib/commonjs/types/AdshiftConsent.js +9 -45
  36. package/lib/commonjs/types/AdshiftConsent.js.map +1 -1
  37. package/lib/commonjs/types/AdshiftConsentSnapshot.js +5 -24
  38. package/lib/commonjs/types/AdshiftConsentSnapshot.js.map +1 -1
  39. package/lib/commonjs/types/AdshiftDeepLink.js +50 -33
  40. package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -1
  41. package/lib/commonjs/types/AdshiftError.js +7 -27
  42. package/lib/commonjs/types/AdshiftError.js.map +1 -1
  43. package/lib/commonjs/types/AdshiftEventParam.js +4 -38
  44. package/lib/commonjs/types/AdshiftEventParam.js.map +1 -1
  45. package/lib/commonjs/types/AdshiftEventType.js +1 -39
  46. package/lib/commonjs/types/AdshiftEventType.js.map +1 -1
  47. package/lib/commonjs/types/AdshiftThirdPartySharing.js +7 -38
  48. package/lib/commonjs/types/AdshiftThirdPartySharing.js.map +1 -1
  49. package/lib/commonjs/types/index.js +12 -0
  50. package/lib/commonjs/types/index.js.map +1 -1
  51. package/lib/commonjs/version.js +1 -1
  52. package/lib/module/Adshift.js +101 -285
  53. package/lib/module/Adshift.js.map +1 -1
  54. package/lib/module/NativeAdShiftReactNativePlugin.js +2 -12
  55. package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
  56. package/lib/module/index.js +2 -47
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/jest/index.js +7 -19
  59. package/lib/module/jest/index.js.map +1 -1
  60. package/lib/module/nativeSdkVersions.js +4 -6
  61. package/lib/module/nativeSdkVersions.js.map +1 -1
  62. package/lib/module/types/AdshiftAdRevenue.js +0 -24
  63. package/lib/module/types/AdshiftAdRevenue.js.map +1 -1
  64. package/lib/module/types/AdshiftConfig.js +10 -23
  65. package/lib/module/types/AdshiftConfig.js.map +1 -1
  66. package/lib/module/types/AdshiftConsent.js +9 -45
  67. package/lib/module/types/AdshiftConsent.js.map +1 -1
  68. package/lib/module/types/AdshiftConsentSnapshot.js +5 -24
  69. package/lib/module/types/AdshiftConsentSnapshot.js.map +1 -1
  70. package/lib/module/types/AdshiftDeepLink.js +49 -32
  71. package/lib/module/types/AdshiftDeepLink.js.map +1 -1
  72. package/lib/module/types/AdshiftError.js +7 -28
  73. package/lib/module/types/AdshiftError.js.map +1 -1
  74. package/lib/module/types/AdshiftEventParam.js +4 -38
  75. package/lib/module/types/AdshiftEventParam.js.map +1 -1
  76. package/lib/module/types/AdshiftEventType.js +1 -39
  77. package/lib/module/types/AdshiftEventType.js.map +1 -1
  78. package/lib/module/types/AdshiftThirdPartySharing.js +7 -38
  79. package/lib/module/types/AdshiftThirdPartySharing.js.map +1 -1
  80. package/lib/module/types/index.js +2 -2
  81. package/lib/module/types/index.js.map +1 -1
  82. package/lib/module/version.js +1 -1
  83. package/lib/typescript/commonjs/src/Adshift.d.ts +68 -184
  84. package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +18 -35
  86. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
  87. package/lib/typescript/commonjs/src/index.d.ts +2 -34
  88. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/src/jest/index.d.ts +9 -21
  90. package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +4 -6
  92. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts +0 -24
  94. package/lib/typescript/commonjs/src/types/AdshiftAdRevenue.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +35 -39
  96. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts +9 -49
  98. package/lib/typescript/commonjs/src/types/AdshiftConsent.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts +10 -28
  100. package/lib/typescript/commonjs/src/types/AdshiftConsentSnapshot.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +55 -39
  102. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts +7 -26
  104. package/lib/typescript/commonjs/src/types/AdshiftError.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts +3 -19
  106. package/lib/typescript/commonjs/src/types/AdshiftEventParam.d.ts.map +1 -1
  107. package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts +1 -23
  108. package/lib/typescript/commonjs/src/types/AdshiftEventType.d.ts.map +1 -1
  109. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts +7 -38
  110. package/lib/typescript/commonjs/src/types/AdshiftThirdPartySharing.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/src/types/index.d.ts +3 -3
  112. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
  113. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  114. package/lib/typescript/module/src/Adshift.d.ts +68 -184
  115. package/lib/typescript/module/src/Adshift.d.ts.map +1 -1
  116. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +18 -35
  117. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
  118. package/lib/typescript/module/src/index.d.ts +2 -34
  119. package/lib/typescript/module/src/index.d.ts.map +1 -1
  120. package/lib/typescript/module/src/jest/index.d.ts +9 -21
  121. package/lib/typescript/module/src/jest/index.d.ts.map +1 -1
  122. package/lib/typescript/module/src/nativeSdkVersions.d.ts +4 -6
  123. package/lib/typescript/module/src/nativeSdkVersions.d.ts.map +1 -1
  124. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts +0 -24
  125. package/lib/typescript/module/src/types/AdshiftAdRevenue.d.ts.map +1 -1
  126. package/lib/typescript/module/src/types/AdshiftConfig.d.ts +35 -39
  127. package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -1
  128. package/lib/typescript/module/src/types/AdshiftConsent.d.ts +9 -49
  129. package/lib/typescript/module/src/types/AdshiftConsent.d.ts.map +1 -1
  130. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts +10 -28
  131. package/lib/typescript/module/src/types/AdshiftConsentSnapshot.d.ts.map +1 -1
  132. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +55 -39
  133. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -1
  134. package/lib/typescript/module/src/types/AdshiftError.d.ts +7 -26
  135. package/lib/typescript/module/src/types/AdshiftError.d.ts.map +1 -1
  136. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts +3 -19
  137. package/lib/typescript/module/src/types/AdshiftEventParam.d.ts.map +1 -1
  138. package/lib/typescript/module/src/types/AdshiftEventType.d.ts +1 -23
  139. package/lib/typescript/module/src/types/AdshiftEventType.d.ts.map +1 -1
  140. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts +7 -38
  141. package/lib/typescript/module/src/types/AdshiftThirdPartySharing.d.ts.map +1 -1
  142. package/lib/typescript/module/src/types/index.d.ts +3 -3
  143. package/lib/typescript/module/src/types/index.d.ts.map +1 -1
  144. package/lib/typescript/module/src/version.d.ts +1 -1
  145. package/package.json +11 -1
  146. package/src/Adshift.ts +118 -285
  147. package/src/NativeAdShiftReactNativePlugin.ts +19 -47
  148. package/src/index.tsx +7 -46
  149. package/src/jest/index.ts +11 -20
  150. package/src/nativeSdkVersions.ts +4 -6
  151. package/src/types/AdshiftAdRevenue.ts +0 -24
  152. package/src/types/AdshiftConfig.ts +48 -55
  153. package/src/types/AdshiftConsent.ts +9 -49
  154. package/src/types/AdshiftConsentSnapshot.ts +11 -38
  155. package/src/types/AdshiftDeepLink.ts +87 -39
  156. package/src/types/AdshiftError.ts +7 -26
  157. package/src/types/AdshiftEventParam.ts +4 -38
  158. package/src/types/AdshiftEventType.ts +1 -39
  159. package/src/types/AdshiftThirdPartySharing.ts +7 -38
  160. package/src/types/index.ts +9 -2
  161. package/src/version.ts +1 -1
  162. package/vendor/ios/AdshiftSDK.files.json +30 -0
  163. package/vendor/ios/AdshiftSDK.xcframework/Info.plist +44 -0
  164. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/AdshiftSDK +0 -0
  165. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Headers/AdshiftSDK-Swift.h +315 -0
  166. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Info.plist +0 -0
  167. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.abi.json +18729 -0
  168. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +414 -0
  169. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  170. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios.swiftinterface +414 -0
  171. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/Modules/module.modulemap +4 -0
  172. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64/AdshiftSDK.framework/PrivacyInfo.xcprivacy +132 -0
  173. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/AdshiftSDK +0 -0
  174. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Headers/AdshiftSDK-Swift.h +626 -0
  175. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Info.plist +0 -0
  176. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +18729 -0
  177. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +414 -0
  178. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  179. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +414 -0
  180. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +18729 -0
  181. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +414 -0
  182. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  183. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/AdshiftSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +414 -0
  184. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/Modules/module.modulemap +4 -0
  185. package/vendor/ios/AdshiftSDK.xcframework/ios-arm64_x86_64-simulator/AdshiftSDK.framework/PrivacyInfo.xcprivacy +132 -0
package/src/Adshift.ts CHANGED
@@ -1,35 +1,3 @@
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
-
33
1
  import { Linking, Platform } from 'react-native';
34
2
  import type { EventSubscription } from 'react-native';
35
3
  import NativeAdShiftReactNativePlugin from './NativeAdShiftReactNativePlugin';
@@ -51,6 +19,7 @@ import {
51
19
  AdshiftEventParam,
52
20
  AdshiftMediationNetwork,
53
21
  configToMap,
22
+ DEFERRED_DEEP_LINK_CLIPBOARD_MODES,
54
23
  getAllEventParams,
55
24
  consentSnapshotFromMap,
56
25
  consentToMap,
@@ -60,25 +29,15 @@ import {
60
29
  } from './types';
61
30
  import { PLUGIN_VERSION } from './version';
62
31
 
63
- // ============ Public types ============
64
-
65
32
  /**
66
- * Result of `Adshift.start()`.
67
- *
68
- * `success` reports whether the SDK started locally. The API key is checked
69
- * with the backend in the background: `apiKeyValidationStatus` is the verdict
70
- * at the time `start()` resolved, and `config.onError` reports
71
- * `INVALID_API_KEY` when that verdict is `invalid`. On iOS the verdict usually
72
- * arrives after `start()` resolved and is reported by the next `start()`; on
73
- * Android `start()` waits up to 5 s for it.
33
+ * `success` says whether the SDK started on the device. The API key is checked
34
+ * in the background; an `invalid` verdict is also reported through
35
+ * `config.onError` as `INVALID_API_KEY`. Android waits up to 5 s for the
36
+ * verdict; on iOS it usually arrives later and shows in a later `start()`.
74
37
  */
75
38
  export interface StartResult {
76
39
  success: boolean;
77
- /**
78
- * Outcome of the API key check at the time `start()` resolved; `pending`
79
- * means the answer had not arrived yet. It changes nothing you have to do:
80
- * events tracked meanwhile stay queued on the device by the native SDK.
81
- */
40
+ /** The API key check when `start()` resolved; `pending` needs no action. */
82
41
  apiKeyValidationStatus?: ApiKeyValidationStatus;
83
42
  /** Platform error number behind `errorCode`, for support requests. */
84
43
  nativeCode?: number | string;
@@ -95,11 +54,7 @@ export type ApiKeyValidationStatus = 'pending' | 'valid' | 'invalid';
95
54
 
96
55
  export type EventValues = Record<string, string | number | boolean>;
97
56
 
98
- /**
99
- * Parameters for `Adshift.trackPurchase()`.
100
- */
101
57
  export interface PurchaseParams {
102
- /** Product identifier. */
103
58
  productId: string;
104
59
  /** Purchase amount in `currency`. */
105
60
  revenue: number;
@@ -109,27 +64,18 @@ export interface PurchaseParams {
109
64
  transactionId: string;
110
65
  }
111
66
 
112
- /**
113
- * Subscription returned by `Adshift.onDeepLink()`.
114
- */
115
67
  export interface DeepLinkSubscription {
116
- /** Removes the listener. Safe to call more than once. */
68
+ /** Removes the listener; safe to call more than once. */
117
69
  remove(): void;
118
70
  }
119
71
 
120
72
  export type DeepLinkCallback = (deepLink: AdshiftDeepLink) => void;
121
73
 
122
- /**
123
- * Native SDK versions bundled with this plugin release.
124
- */
125
74
  export interface NativeSdkVersions {
126
75
  android: string;
127
76
  ios: string;
128
77
  }
129
78
 
130
- /**
131
- * Plugin information returned by `Adshift.getInfo()`.
132
- */
133
79
  export interface AdshiftInfo {
134
80
  /** `Platform.OS`; the SDK only supports `ios` and `android`. */
135
81
  platform: 'ios' | 'android' | (string & {});
@@ -139,27 +85,18 @@ export interface AdshiftInfo {
139
85
  nativeSdkVersions: NativeSdkVersions;
140
86
  }
141
87
 
142
- // ============ Constants ============
143
-
144
88
  const DEEP_LINK_BUFFER_LIMIT = 20;
145
89
  const PENDING_CALL_LIMIT = 100;
146
90
  /** Bounds how long `start()` waits for the URL the app was opened with. */
147
91
  const INITIAL_URL_WAIT_MS = 3000;
148
92
  /** How long one URL counts as the same link, whoever passed it in first. */
149
93
  const AUTO_FORWARD_DEDUP_MS = 2000;
150
- /**
151
- * Mirrors a limit the SDK applies, so the warning below can name it. Raising it
152
- * there without raising it here makes the warning wrong, not the behaviour.
153
- */
94
+ /** For the warning only; on iOS it applies to amounts in USD, hence the check. */
154
95
  const MAX_AD_REVENUE_PER_IMPRESSION = 10;
155
96
  const MEDIATION_NETWORKS: ReadonlySet<string> = new Set(
156
97
  Object.values(AdshiftMediationNetwork)
157
98
  );
158
- /**
159
- * Event names the SDK sends on its own. Sending them by hand would mix
160
- * hand-made records into install and session counts, which cannot be undone
161
- * once they are reported.
162
- */
99
+ /** Sent by the SDK itself. */
163
100
  const RESERVED_EVENT_NAMES: ReadonlySet<string> = new Set([
164
101
  'app_install',
165
102
  'app_open',
@@ -182,10 +119,7 @@ interface PendingCall {
182
119
  reject: (error: AdshiftError) => void;
183
120
  }
184
121
 
185
- /**
186
- * Configuration received before `initialize()`. Each entry holds the latest
187
- * value for one setter, so the memory is bounded by the number of setters.
188
- */
122
+ /** Setters called before `initialize()`: each last value, all push paths. */
189
123
  interface PendingSettings {
190
124
  customerUserId?: string;
191
125
  debugEnabled?: boolean;
@@ -197,21 +131,17 @@ interface PendingSettings {
197
131
  tcfEnabled?: boolean;
198
132
  gppEnabled?: boolean;
199
133
  /**
200
- * Absent means neither sharing call was made; `null` means the last one was
201
- * `clearThirdPartySharing()`. Two calls share this slot, so the distinction
202
- * has to survive here or a clear before `initialize()` would be dropped and
203
- * the set it was meant to undo would still be applied.
134
+ * Absent: neither sharing call was made. `null`: the last one was
135
+ * `clearThirdPartySharing()`, which must still cancel an earlier set.
204
136
  */
205
137
  thirdPartySharing?: AdshiftThirdPartySharing | null;
206
138
  pushDeepLinkPaths: string[][];
207
139
  }
208
140
 
209
- // ============ Internal state ============
210
-
211
141
  let state: LifecycleState = 'uninitialized';
212
142
  let frozenConfig: Readonly<AdshiftConfig> | null = null;
213
143
  let startInFlight: Promise<StartResult> | null = null;
214
- /** Incremented per start attempt so a superseded attempt cannot touch the state. */
144
+ /** One per start attempt, so a superseded attempt cannot touch the state. */
215
145
  let startEpoch = 0;
216
146
 
217
147
  let nativeSubscription: EventSubscription | null = null;
@@ -230,8 +160,6 @@ let errorHandler: ((error: AdshiftError) => void) | null = null;
230
160
  /** Kept so `start()` can answer with the reason `initialize()` was refused. */
231
161
  let configError: AdshiftError | null = null;
232
162
 
233
- // ============ Logging ============
234
-
235
163
  function devWarn(message: string): void {
236
164
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
237
165
  console.warn(`[AdShift] ${message}`);
@@ -239,12 +167,8 @@ function devWarn(message: string): void {
239
167
  }
240
168
 
241
169
  /**
242
- * Reports a call the plugin declined to make.
243
- *
244
- * Public methods that return nothing have no channel to answer through, so
245
- * they never raise: raising would unwind a stack the caller did not choose,
246
- * and React Native treats an error escaping an event handler or a native
247
- * callback as fatal. The call is skipped and reported here instead.
170
+ * Methods that return nothing report a declined call here instead of raising:
171
+ * React Native treats an error escaping an event handler as fatal.
248
172
  */
249
173
  function reportDeclined(error: AdshiftError): void {
250
174
  devWarn(`${error.message} (${error.code})`);
@@ -256,8 +180,6 @@ function reportDeclined(error: AdshiftError): void {
256
180
  }
257
181
  }
258
182
 
259
- // ============ Errors ============
260
-
261
183
  function notInitializedError(): AdshiftError {
262
184
  return createAdshiftError(
263
185
  AdshiftErrorCode.NotInitialized,
@@ -292,11 +214,7 @@ function isStringArray(value: unknown): value is string[] {
292
214
  return Array.isArray(value) && value.every(isNonEmptyString);
293
215
  }
294
216
 
295
- /**
296
- * Plain names a caller is likely to invent, mapped onto the standard constant
297
- * that carries the same meaning. Built from the constants so there is one list
298
- * to keep, not two.
299
- */
217
+ /** Plain names a caller is likely to use instead of a standard parameter. */
300
218
  const STANDARD_PARAM_BY_PLAIN_NAME: ReadonlyMap<
301
219
  string,
302
220
  keyof typeof AdshiftEventParam
@@ -323,10 +241,7 @@ const STANDARD_PARAM_BY_PLAIN_NAME: ReadonlyMap<
323
241
 
324
242
  const reportedPlainParamNames = new Set<string>();
325
243
 
326
- /**
327
- * Warns once per name when a value carries a plain name instead of the
328
- * standard one. Sending it is allowed — it just stays a custom parameter.
329
- */
244
+ /** Warns once per name; the value is still sent, as a custom parameter. */
330
245
  function warnAboutPlainParamNames(values: EventValues | undefined): void {
331
246
  if (values === undefined) return;
332
247
  for (const key of Object.keys(values)) {
@@ -358,15 +273,9 @@ function validateEventValues(values: unknown, name: string): void {
358
273
  }
359
274
  }
360
275
 
361
- // ============ Configuration received before initialize() ============
362
-
363
276
  /**
364
- * Folds settings received before `initialize()` into the config.
365
- *
366
- * The config wins for anything it states, because it is the later and more
367
- * explicit declaration. Push key paths are additive, so they are merged.
368
- * Settings that reach the SDK through a setter only are applied by
369
- * `applyPendingSettings()` right after the native module is initialized.
277
+ * The config wins over a value set before `initialize()`; push paths from both
278
+ * are kept. Values without a config option go through `applyPendingSettings()`.
370
279
  */
371
280
  function withPendingSettings(config: AdshiftConfig): AdshiftConfig {
372
281
  const merged: AdshiftConfig = { ...config };
@@ -426,8 +335,6 @@ function applyPendingSettings(): void {
426
335
  }
427
336
  }
428
337
 
429
- // ============ Deep link delivery ============
430
-
431
338
  function ensureNativeSubscription(): void {
432
339
  if (nativeSubscription) return;
433
340
  nativeSubscription = NativeAdShiftReactNativePlugin.onDeepLink(
@@ -440,9 +347,7 @@ function ensureNativeSubscription(): void {
440
347
  }
441
348
 
442
349
  function dispatchDeepLink(deepLink: AdshiftDeepLink): void {
443
- // A result must never overtake one already waiting in the buffer: a deferred
444
- // link delivered after a link tapped later would attribute the install to
445
- // the wrong click.
350
+ // A result must not overtake one still waiting in the buffer.
446
351
  if (listeners.size === 0 || deepLinkBuffer.length > 0) {
447
352
  bufferDeepLink(deepLink);
448
353
  scheduleReplay();
@@ -494,8 +399,6 @@ function scheduleReplay(): void {
494
399
  });
495
400
  }
496
401
 
497
- // ============ Automatic URL forwarding (iOS) ============
498
-
499
402
  function autoForwardEnabled(): boolean {
500
403
  return (
501
404
  Platform.OS === 'ios' &&
@@ -508,16 +411,13 @@ function startLinkingAutoForward(): void {
508
411
  if (linkingSubscription) return;
509
412
  linkingSubscription = Linking.addEventListener('url', ({ url }) => {
510
413
  if (state === 'uninitialized' || !autoForwardEnabled()) return;
511
- // An app that handles `url` itself and calls handleDeepLink() sees the same
512
- // event here, and the two are indistinguishable from a second tap. The
513
- // short window treats them as one link; a tap that comes later is a
514
- // separate click and is forwarded.
414
+ // An app that also passes this event to handleDeepLink() must not count the
415
+ // link twice; a tap after the short window is a new click.
515
416
  if (wasAutoForwardedRecently(url)) return;
516
417
  forwardUrl(url, false).catch(() => undefined);
517
418
  });
518
- // The launch URL is read on every initialize(), so it comes back after a
519
- // JavaScript reload as well. It is marked as such, and the native side keeps
520
- // it for the lifetime of the process, so the link is booked once.
419
+ // getInitialURL() returns the launch URL again after a JavaScript reload;
420
+ // marked as the launch URL, native forwards it once per process.
521
421
  initialUrlForward = Linking.getInitialURL()
522
422
  .then((url) => (url ? forwardUrl(url, true) : undefined))
523
423
  .catch(() => undefined)
@@ -568,8 +468,6 @@ async function waitForInitialUrlForward(): Promise<void> {
568
468
  }
569
469
  }
570
470
 
571
- // ============ Start gating ============
572
-
573
471
  function runWhenStarted<T>(run: () => Promise<T>): Promise<T> {
574
472
  switch (state) {
575
473
  case 'uninitialized':
@@ -622,11 +520,7 @@ function rejectPendingCalls(error: AdshiftError): void {
622
520
  }
623
521
  }
624
522
 
625
- /**
626
- * Warns when the native SDK on the device is not the one this release was built
627
- * against. Only iOS reports its version, so on Android the pin is guarded by a
628
- * build-time test instead.
629
- */
523
+ /** Only iOS reports its SDK version; on Android a build test guards the pin. */
630
524
  function checkNativeSdkVersion(reported: unknown): void {
631
525
  if (typeof reported !== 'string' || reported.length === 0) return;
632
526
  const expected =
@@ -688,8 +582,7 @@ async function performStart(): Promise<StartResult> {
688
582
  await NativeAdShiftReactNativePlugin.start()
689
583
  );
690
584
  if (epoch !== startEpoch) {
691
- // A newer start() owns the lifecycle now; report what native said and
692
- // leave the state to the newer attempt.
585
+ // A newer start() owns the state now.
693
586
  return result;
694
587
  }
695
588
  if (state !== 'starting') {
@@ -708,7 +601,6 @@ async function performStart(): Promise<StartResult> {
708
601
  state = 'started';
709
602
  flushPendingCalls();
710
603
  if (result.apiKeyValidationStatus === 'invalid') {
711
- // The SDK started locally, but nothing it sends will be accepted.
712
604
  reportDeclined(
713
605
  createAdshiftError(
714
606
  AdshiftErrorCode.InvalidApiKey,
@@ -738,8 +630,6 @@ async function performStart(): Promise<StartResult> {
738
630
  errorCode: mapped.code,
739
631
  errorMessage: mapped.message,
740
632
  };
741
- // What the platform said travels with the result, the same way it does
742
- // when the native side answers with a failure instead of rejecting.
743
633
  if (mapped.userInfo.nativeCode !== undefined) {
744
634
  result.nativeCode = mapped.userInfo.nativeCode;
745
635
  }
@@ -751,12 +641,8 @@ async function performStart(): Promise<StartResult> {
751
641
  }
752
642
 
753
643
  /**
754
- * Whether a failed start rules out the calls waiting for it.
755
- *
756
- * A rejected key, an excluded device and a missing configuration cannot be
757
- * fixed by trying again, so the waiting calls are answered. Anything else can
758
- * be, and holding the calls is worth more than answering them quickly: the
759
- * data survives until the app starts the SDK again.
644
+ * Failures a retry cannot fix, which reject the calls waiting for `start()`.
645
+ * After any other failure they wait for the next attempt.
760
646
  */
761
647
  function isTerminalStartFailure(code: AdshiftErrorCode): boolean {
762
648
  return (
@@ -766,20 +652,11 @@ function isTerminalStartFailure(code: AdshiftErrorCode): boolean {
766
652
  );
767
653
  }
768
654
 
769
- // ============ Main SDK API ============
770
-
771
655
  export const Adshift = {
772
- // ============ Lifecycle ============
773
-
774
656
  /**
775
- * Initializes the SDK.
776
- *
777
- * Call once, as early as possible (e.g. at module scope of `App.tsx`).
778
- * The configuration is fixed on the first call; later calls are ignored.
779
- *
780
- * Never raises, because it is meant to run at module scope, where an error
781
- * would stop the bundle from evaluating. An unusable config is reported
782
- * through `config.onError` and answered by `start()`.
657
+ * Call once, as early as possible, for example at module scope. The first
658
+ * config is kept; later calls are ignored. Never raises: an unusable config
659
+ * is reported through `config.onError` and returned by `start()`.
783
660
  */
784
661
  initialize(config: AdshiftConfig): void {
785
662
  if (state !== 'uninitialized') {
@@ -820,6 +697,15 @@ export const Adshift = {
820
697
  );
821
698
  return;
822
699
  }
700
+ if (
701
+ config.deferredDeepLinkClipboard !== undefined &&
702
+ !DEFERRED_DEEP_LINK_CLIPBOARD_MODES.has(config.deferredDeepLinkClipboard)
703
+ ) {
704
+ refuse(
705
+ "AdShift SDK: deferredDeepLinkClipboard must be 'disabled', 'prompt' or 'pasteControl'"
706
+ );
707
+ return;
708
+ }
823
709
 
824
710
  configError = null;
825
711
  frozenConfig = Object.freeze(withPendingSettings(config));
@@ -842,14 +728,9 @@ export const Adshift = {
842
728
  },
843
729
 
844
730
  /**
845
- * Starts the SDK.
846
- *
847
- * Resolves once the SDK has started locally. Never rejects; inspect
848
- * `result.success` and `result.errorCode`. Calls to `trackEvent`,
849
- * `trackPurchase` and `logAdRevenue` made before this resolves are queued
850
- * and dispatched afterwards. A start that fails with a reason retrying
851
- * cannot fix rejects them instead; any other failure keeps them waiting for
852
- * the next attempt.
731
+ * Never rejects; check `result.success`. `trackEvent`, `trackPurchase` and
732
+ * `logAdRevenue` calls made before it succeeds wait for it. A failure that
733
+ * retrying cannot fix rejects them; otherwise they wait for the next try.
853
734
  */
854
735
  start(): Promise<StartResult> {
855
736
  if (state === 'uninitialized') {
@@ -876,11 +757,8 @@ export const Adshift = {
876
757
  },
877
758
 
878
759
  /**
879
- * Stops the SDK. Tracking calls reject with `NOT_STARTED` until the next
880
- * successful `start()`.
881
- *
882
- * Before `initialize()` there is nothing to stop: the call is reported and
883
- * skipped.
760
+ * Tracking calls reject with `NOT_STARTED` until the next successful
761
+ * `start()`. Before `initialize()` the call is reported and skipped.
884
762
  */
885
763
  stop(): void {
886
764
  if (state === 'uninitialized') {
@@ -902,13 +780,9 @@ export const Adshift = {
902
780
  return state === 'started';
903
781
  },
904
782
 
905
- // ============ Configuration ============
906
-
907
783
  /**
908
- * Sets your own user identifier. Can be called before or after `start()`.
909
- *
910
- * Called before `initialize()`, the value is kept and applied afterwards.
911
- * An empty identifier is reported and skipped; nothing is raised.
784
+ * Your own user id; may be set at any time. Before `initialize()` it is kept
785
+ * and applied afterwards. An empty id is reported and skipped.
912
786
  */
913
787
  setCustomerUserId(userId: string): void {
914
788
  if (!isNonEmptyString(userId)) {
@@ -925,9 +799,8 @@ export const Adshift = {
925
799
  },
926
800
 
927
801
  /**
928
- * Enables or disables verbose SDK logging at runtime.
929
- *
930
- * Called before `initialize()`, the value is kept and applied afterwards.
802
+ * Verbose SDK logging. Before `initialize()` the value is kept and applied
803
+ * afterwards.
931
804
  */
932
805
  setDebugEnabled(enabled: boolean): void {
933
806
  if (state === 'uninitialized') {
@@ -938,10 +811,9 @@ export const Adshift = {
938
811
  },
939
812
 
940
813
  /**
941
- * Sets the debounce interval for automatic `app_open` events.
942
- *
943
- * Called before `initialize()`, the value is kept and applied afterwards.
944
- * A negative interval is reported and skipped; nothing is raised.
814
+ * Debounce interval for automatic `app_open` events. Before `initialize()`
815
+ * the value is kept and applied afterwards. A negative value is reported and
816
+ * skipped.
945
817
  */
946
818
  setAppOpenDebounceMs(ms: number): void {
947
819
  if (!isFiniteNumber(ms) || ms < 0) {
@@ -958,10 +830,8 @@ export const Adshift = {
958
830
  },
959
831
 
960
832
  /**
961
- * Sets branded attribution domains. Must be called before `start()`.
962
- *
963
- * Called before `initialize()`, the domains are kept and applied with the
964
- * config, so they are in place before the first link is processed.
833
+ * Your own link domains; set them before `start()`. Before `initialize()`
834
+ * they are kept and passed with the config.
965
835
  */
966
836
  setBrandedDomains(domains: string[]): void {
967
837
  if (!isStringArray(domains)) {
@@ -980,9 +850,8 @@ export const Adshift = {
980
850
  },
981
851
 
982
852
  /**
983
- * Sets the Meta app id used to parse Meta App Links. No-op on iOS.
984
- *
985
- * Called before `initialize()`, the value is kept and applied afterwards.
853
+ * Meta app id used to parse Meta App Links; no-op on iOS. Before
854
+ * `initialize()` the value is kept and applied afterwards.
986
855
  */
987
856
  setMetaAppId(appId: string): void {
988
857
  if (!isNonEmptyString(appId)) {
@@ -999,11 +868,9 @@ export const Adshift = {
999
868
  },
1000
869
 
1001
870
  /**
1002
- * Hands over an OAID the app obtained itself, for Android devices without
1003
- * Google Play services. Set `collectOaid: false` when you supply it this
1004
- * way. No-op on iOS.
1005
- *
1006
- * Called before `initialize()`, the value is kept and applied afterwards.
871
+ * An OAID the app obtained itself, for Android devices without Google Play
872
+ * services; set `collectOaid: false` as well. No-op on iOS. Before
873
+ * `initialize()` the value is kept and applied afterwards.
1007
874
  */
1008
875
  setOaidData(oaid: string): void {
1009
876
  if (!isNonEmptyString(oaid)) {
@@ -1019,13 +886,9 @@ export const Adshift = {
1019
886
  NativeAdShiftReactNativePlugin.setOaidData(oaid);
1020
887
  },
1021
888
 
1022
- // ============ Consent (GDPR/DMA) ============
1023
-
1024
889
  /**
1025
- * Sets consent collected by your own UI. Use `AdshiftConsent.forGDPRUser()`
1026
- * or `AdshiftConsent.forNonGDPRUser()`.
1027
- *
1028
- * Called before `initialize()`, the consent is kept and applied afterwards.
890
+ * Consent collected by your own UI: `AdshiftConsent.forGDPRUser()` or
891
+ * `forNonGDPRUser()`. Before `initialize()` it is kept and applied later.
1029
892
  */
1030
893
  setConsentData(consent: AdshiftConsent): void {
1031
894
  if (
@@ -1047,10 +910,8 @@ export const Adshift = {
1047
910
  },
1048
911
 
1049
912
  /**
1050
- * Enables or disables reading IAB TCF v2.2 consent from the CMP on device.
1051
- * Call before `start()`.
1052
- *
1053
- * Called before `initialize()`, the value is kept and applied afterwards.
913
+ * Reading IAB TCF v2.2 consent from the CMP on the device. Call before
914
+ * `start()`; before `initialize()` the value is kept and applied afterwards.
1054
915
  */
1055
916
  enableTCFDataCollection(enabled: boolean): void {
1056
917
  if (state === 'uninitialized') {
@@ -1061,14 +922,9 @@ export const Adshift = {
1061
922
  },
1062
923
 
1063
924
  /**
1064
- * Enables reading an IAB GPP string written by the CMP on device, used for US
1065
- * state privacy signals. Off until called with `true`.
1066
- *
1067
- * The GPP string rides on its own axis: it is forwarded alongside whatever
1068
- * decides the GDPR axis, including a consent set through `setConsentData()`,
1069
- * and it does not gate the advertising identifier on the device.
1070
- *
1071
- * Call before `start()`. Called before `initialize()`, the value is kept and
925
+ * Reading an IAB GPP string written by the CMP, for US state privacy
926
+ * signals; off until called with `true`. It does not gate the advertising
927
+ * id. Call before `start()`; before `initialize()` the value is kept and
1072
928
  * applied afterwards.
1073
929
  */
1074
930
  enableGPPDataCollection(enabled: boolean): void {
@@ -1080,20 +936,10 @@ export const Adshift = {
1080
936
  },
1081
937
 
1082
938
  /**
1083
- * States what the app collected about passing this user's data on to
1084
- * advertising partners. Use `AdshiftThirdPartySharing.optedOut()` or
1085
- * `AdshiftThirdPartySharing.allowed()`.
1086
- *
1087
- * This is the answer to a different question than `setConsentData()`, and it
1088
- * has the opposite default: nothing said here means sharing is allowed, so
1089
- * only call it once the user has actually been asked. Setting `allowed()` at
1090
- * startup as a default records a declaration the user never made, and events
1091
- * already sent cannot be recalled when a real answer arrives.
1092
- *
1093
- * Nothing is gated on the device either way — this travels with the events for
1094
- * the backend to act on.
1095
- *
1096
- * Called before `initialize()`, the answer is kept and applied afterwards.
939
+ * The user's answer on sharing their data with advertising partners:
940
+ * `AdshiftThirdPartySharing.optedOut()` or `allowed()`. Unlike consent,
941
+ * saying nothing means allowed, so call it only once the user was asked;
942
+ * events already sent are not recalled. Kept if called before `initialize()`.
1097
943
  */
1098
944
  setThirdPartySharing(sharing: AdshiftThirdPartySharing): void {
1099
945
  if (!isPlainObject(sharing) || typeof sharing.optOut !== 'boolean') {
@@ -1112,15 +958,9 @@ export const Adshift = {
1112
958
  },
1113
959
 
1114
960
  /**
1115
- * Withdraws the answer set by `setThirdPartySharing()`.
1116
- *
1117
- * Subsequent events state nothing on this axis, which is not the same as
1118
- * stating that sharing is allowed: the first leaves the decision to your
1119
- * dashboard configuration, the second is the app's own declaration and is
1120
- * recorded as such.
1121
- *
1122
- * Called before `initialize()`, this cancels a `setThirdPartySharing()` that
1123
- * was also queued.
961
+ * Withdraws `setThirdPartySharing()`: later events say nothing about sharing,
962
+ * which is not the same as `allowed()`. Before `initialize()` it cancels a
963
+ * queued `setThirdPartySharing()`.
1124
964
  */
1125
965
  clearThirdPartySharing(): void {
1126
966
  if (state === 'uninitialized') {
@@ -1148,21 +988,11 @@ export const Adshift = {
1148
988
  }
1149
989
  },
1150
990
 
1151
- // ============ Event Tracking ============
1152
-
1153
991
  /**
1154
- * Tracks an in-app event.
1155
- *
1156
- * `app_install` and `app_open` are reserved: the SDK sends them itself and
1157
- * passing them here rejects with `INVALID_ARGUMENT`.
1158
- *
1159
- * Resolves once the SDK has accepted the event. A call made between
1160
- * `initialize()` and a successful `start()` waits for the start: it is sent
1161
- * when the SDK starts, and rejects when the start fails for a reason
1162
- * retrying cannot fix (rejected key, excluded device) or after `stop()`.
1163
- * A start that failed for any other reason keeps the call waiting for the
1164
- * next attempt, so `start()` belongs on every launch path.
1165
- *
992
+ * `app_install` and `app_open` are reserved. A call made before a successful
993
+ * `start()` waits for it, so call `start()` on every launch path; it rejects
994
+ * after `stop()` or a start failure retrying cannot fix (rejected key,
995
+ * excluded device).
1166
996
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`, `NOT_STARTED`,
1167
997
  * `INVALID_API_KEY`, `OPTED_OUT`, `QUEUE_FULL`, `INVALID_ARGUMENT`).
1168
998
  */
@@ -1193,11 +1023,7 @@ export const Adshift = {
1193
1023
  );
1194
1024
  },
1195
1025
 
1196
- /**
1197
- * Tracks a purchase.
1198
- *
1199
- * @returns Rejects with `AdshiftError` (see `trackEvent`).
1200
- */
1026
+ /** Waits for `start()` and rejects like `trackEvent()`. */
1201
1027
  trackPurchase(params: PurchaseParams): Promise<void> {
1202
1028
  if (!isPlainObject(params)) {
1203
1029
  return Promise.reject(
@@ -1236,9 +1062,8 @@ export const Adshift = {
1236
1062
  },
1237
1063
 
1238
1064
  /**
1239
- * Logs ad revenue for a single impression.
1240
- *
1241
- * @returns Rejects with `AdshiftError` (see `trackEvent`).
1065
+ * Revenue of a single impression, not an aggregate. Waits for `start()` and
1066
+ * rejects like `trackEvent()`.
1242
1067
  */
1243
1068
  logAdRevenue(params: AdRevenueParams): Promise<void> {
1244
1069
  if (!isPlainObject(params)) {
@@ -1287,7 +1112,10 @@ export const Adshift = {
1287
1112
  invalidArgument('AdShift SDK: revenue must be a positive number')
1288
1113
  );
1289
1114
  }
1290
- if (revenue > MAX_AD_REVENUE_PER_IMPRESSION) {
1115
+ if (
1116
+ revenue > MAX_AD_REVENUE_PER_IMPRESSION &&
1117
+ (Platform.OS === 'android' || currency.toUpperCase() === 'USD')
1118
+ ) {
1291
1119
  devWarn(
1292
1120
  `logAdRevenue: revenue above ${MAX_AD_REVENUE_PER_IMPRESSION} is not recorded. ` +
1293
1121
  'Pass the revenue of a single impression, not an aggregate.'
@@ -1325,11 +1153,7 @@ export const Adshift = {
1325
1153
  );
1326
1154
  },
1327
1155
 
1328
- // ============ Identity ============
1329
-
1330
- /**
1331
- * Returns the AdShift device id, or `null` before `initialize()`.
1332
- */
1156
+ /** `null` before `initialize()`. */
1333
1157
  async getAdShiftDeviceId(): Promise<string | null> {
1334
1158
  if (state === 'uninitialized') {
1335
1159
  return null;
@@ -1342,15 +1166,9 @@ export const Adshift = {
1342
1166
  }
1343
1167
  },
1344
1168
 
1345
- // ============ Deep Links ============
1346
-
1347
1169
  /**
1348
- * Passes a URL to the SDK.
1349
- *
1350
- * Not needed when `autoHandleDeepLinks` is on (the default). The result is
1351
- * delivered through `onDeepLink()`; the promise resolves once the SDK has
1352
- * finished processing the URL.
1353
- *
1170
+ * Passes a URL to the SDK; not needed with `autoHandleDeepLinks` on (the
1171
+ * default). The result arrives through `onDeepLink()`.
1354
1172
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
1355
1173
  * `INVALID_ARGUMENT`).
1356
1174
  */
@@ -1380,11 +1198,32 @@ export const Adshift = {
1380
1198
  },
1381
1199
 
1382
1200
  /**
1383
- * Adds a key path inside push payloads that carries an AdShift deep link.
1384
- *
1385
- * Called before `initialize()`, the path is kept and registered afterwards.
1386
- * The first path you register takes over from the top-level `as_push_link`
1387
- * the SDK reads on its own, so register that key too if you still need it.
1201
+ * With `deferredDeepLinkClipboard: 'pasteControl'`, passes what the user
1202
+ * pasted with `UIPasteControl`, or `null` when they skipped it. Call it on
1203
+ * every way out of onboarding: the first launch's deferred deep link waits
1204
+ * for it. No-op on Android.
1205
+ */
1206
+ handlePastedDeepLink(url: string | null): void {
1207
+ if (url !== null && typeof url !== 'string') {
1208
+ reportDeclined(
1209
+ invalidArgument('AdShift SDK: url must be a string or null')
1210
+ );
1211
+ return;
1212
+ }
1213
+ if (state === 'uninitialized') {
1214
+ reportDeclined(notInitializedError());
1215
+ return;
1216
+ }
1217
+ NativeAdShiftReactNativePlugin.handlePastedDeepLink(
1218
+ isNonEmptyString(url) ? url : null
1219
+ );
1220
+ },
1221
+
1222
+ /**
1223
+ * A key path inside push payloads that carries an AdShift deep link. The
1224
+ * first path replaces the top-level `as_push_link` the SDK reads by default,
1225
+ * so add that one too if you still use it. Kept if called before
1226
+ * `initialize()`.
1388
1227
  */
1389
1228
  addPushNotificationDeepLinkPath(path: string[]): void {
1390
1229
  if (!isStringArray(path) || path.length === 0) {
@@ -1403,10 +1242,8 @@ export const Adshift = {
1403
1242
  },
1404
1243
 
1405
1244
  /**
1406
- * Passes a push notification payload to the SDK. Resolves to `true` when
1407
- * the payload carried an AdShift deep link; the result then arrives
1408
- * through `onDeepLink()`.
1409
- *
1245
+ * Resolves to `true` when the payload carried an AdShift deep link; the
1246
+ * result then arrives through `onDeepLink()`.
1410
1247
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
1411
1248
  * `INVALID_ARGUMENT`).
1412
1249
  */
@@ -1431,11 +1268,9 @@ export const Adshift = {
1431
1268
  },
1432
1269
 
1433
1270
  /**
1434
- * Registers a deep link listener.
1435
- *
1436
- * Safe to call before `initialize()`. Results that arrive while no
1437
- * listener is registered are buffered and delivered to the first listener.
1438
- * Every link that reaches the SDK (direct, deferred, push) is delivered.
1271
+ * Safe to call before `initialize()`. Results that arrive while no listener
1272
+ * is registered are buffered for the first one. Every link that reaches the
1273
+ * SDK (direct, deferred, push) is delivered once.
1439
1274
  */
1440
1275
  onDeepLink(callback: DeepLinkCallback): DeepLinkSubscription {
1441
1276
  if (typeof callback !== 'function') {
@@ -1457,8 +1292,6 @@ export const Adshift = {
1457
1292
  };
1458
1293
  },
1459
1294
 
1460
- // ============ Info ============
1461
-
1462
1295
  getInfo(): AdshiftInfo {
1463
1296
  return {
1464
1297
  platform: Platform.OS,