@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
@@ -1,106 +1,38 @@
1
1
  "use strict";
2
2
 
3
- /**
4
- * AdShift SDK for React Native.
5
- *
6
- * @example
7
- * ```typescript
8
- * import {
9
- * Adshift,
10
- * AdshiftEventParam,
11
- * AdshiftEventType,
12
- * } from '@adshift/react-native-plugin';
13
- *
14
- * // 1. Register the deep link listener (safe to do before initialize)
15
- * const subscription = Adshift.onDeepLink((deepLink) => {
16
- * // route on deepLink.deepLinkValue / deepLink.params
17
- * });
18
- *
19
- * // 2. Initialize
20
- * Adshift.initialize({ apiKey: 'your-api-key', isDebug: __DEV__ });
21
- *
22
- * // 3. Start
23
- * const result = await Adshift.start();
24
- *
25
- * // 4. Track
26
- * await Adshift.trackEvent(AdshiftEventType.Purchase, {
27
- * [AdshiftEventParam.Revenue]: 9.99,
28
- * [AdshiftEventParam.Currency]: 'USD',
29
- * });
30
- *
31
- * // Later: subscription.remove();
32
- * ```
33
- */
34
-
35
3
  import { Linking, Platform } from 'react-native';
36
4
  import NativeAdShiftReactNativePlugin from "./NativeAdShiftReactNativePlugin.js";
37
5
  import { NATIVE_SDK_VERSIONS } from "./nativeSdkVersions.js";
38
- import { AdshiftDeepLink as AdshiftDeepLinkHelpers, AdshiftErrorCode, AdshiftEventParam, AdshiftMediationNetwork, configToMap, getAllEventParams, consentSnapshotFromMap, consentToMap, createAdshiftError, thirdPartySharingToMap, toAdshiftError } from "./types/index.js";
6
+ import { AdshiftDeepLink as AdshiftDeepLinkHelpers, AdshiftErrorCode, AdshiftEventParam, AdshiftMediationNetwork, configToMap, DEFERRED_DEEP_LINK_CLIPBOARD_MODES, getAllEventParams, consentSnapshotFromMap, consentToMap, createAdshiftError, thirdPartySharingToMap, toAdshiftError } from "./types/index.js";
39
7
  import { PLUGIN_VERSION } from "./version.js";
40
8
 
41
- // ============ Public types ============
42
-
43
9
  /**
44
- * Result of `Adshift.start()`.
45
- *
46
- * `success` reports whether the SDK started locally. The API key is checked
47
- * with the backend in the background: `apiKeyValidationStatus` is the verdict
48
- * at the time `start()` resolved, and `config.onError` reports
49
- * `INVALID_API_KEY` when that verdict is `invalid`. On iOS the verdict usually
50
- * arrives after `start()` resolved and is reported by the next `start()`; on
51
- * Android `start()` waits up to 5 s for it.
10
+ * `success` says whether the SDK started on the device. The API key is checked
11
+ * in the background; an `invalid` verdict is also reported through
12
+ * `config.onError` as `INVALID_API_KEY`. Android waits up to 5 s for the
13
+ * verdict; on iOS it usually arrives later and shows in a later `start()`.
52
14
  */
53
15
 
54
16
  /** How far the API key check had got when `start()` resolved. */
55
17
 
56
- /**
57
- * Parameters for `Adshift.trackPurchase()`.
58
- */
59
-
60
- /**
61
- * Subscription returned by `Adshift.onDeepLink()`.
62
- */
63
-
64
- /**
65
- * Native SDK versions bundled with this plugin release.
66
- */
67
-
68
- /**
69
- * Plugin information returned by `Adshift.getInfo()`.
70
- */
71
-
72
- // ============ Constants ============
73
-
74
18
  const DEEP_LINK_BUFFER_LIMIT = 20;
75
19
  const PENDING_CALL_LIMIT = 100;
76
20
  /** Bounds how long `start()` waits for the URL the app was opened with. */
77
21
  const INITIAL_URL_WAIT_MS = 3000;
78
22
  /** How long one URL counts as the same link, whoever passed it in first. */
79
23
  const AUTO_FORWARD_DEDUP_MS = 2000;
80
- /**
81
- * Mirrors a limit the SDK applies, so the warning below can name it. Raising it
82
- * there without raising it here makes the warning wrong, not the behaviour.
83
- */
24
+ /** For the warning only; on iOS it applies to amounts in USD, hence the check. */
84
25
  const MAX_AD_REVENUE_PER_IMPRESSION = 10;
85
26
  const MEDIATION_NETWORKS = new Set(Object.values(AdshiftMediationNetwork));
86
- /**
87
- * Event names the SDK sends on its own. Sending them by hand would mix
88
- * hand-made records into install and session counts, which cannot be undone
89
- * once they are reported.
90
- */
27
+ /** Sent by the SDK itself. */
91
28
  const RESERVED_EVENT_NAMES = new Set(['app_install', 'app_open']);
92
29
 
93
- /**
94
- * Configuration received before `initialize()`. Each entry holds the latest
95
- * value for one setter, so the memory is bounded by the number of setters.
96
- */
97
-
98
- // ============ Internal state ============
30
+ /** Setters called before `initialize()`: each last value, all push paths. */
99
31
 
100
32
  let state = 'uninitialized';
101
33
  let frozenConfig = null;
102
34
  let startInFlight = null;
103
- /** Incremented per start attempt so a superseded attempt cannot touch the state. */
35
+ /** One per start attempt, so a superseded attempt cannot touch the state. */
104
36
  let startEpoch = 0;
105
37
  let nativeSubscription = null;
106
38
  const listeners = new Set();
@@ -116,9 +48,6 @@ let pendingSettings = {
116
48
  let errorHandler = null;
117
49
  /** Kept so `start()` can answer with the reason `initialize()` was refused. */
118
50
  let configError = null;
119
-
120
- // ============ Logging ============
121
-
122
51
  function devWarn(message) {
123
52
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
124
53
  console.warn(`[AdShift] ${message}`);
@@ -126,12 +55,8 @@ function devWarn(message) {
126
55
  }
127
56
 
128
57
  /**
129
- * Reports a call the plugin declined to make.
130
- *
131
- * Public methods that return nothing have no channel to answer through, so
132
- * they never raise: raising would unwind a stack the caller did not choose,
133
- * and React Native treats an error escaping an event handler or a native
134
- * callback as fatal. The call is skipped and reported here instead.
58
+ * Methods that return nothing report a declined call here instead of raising:
59
+ * React Native treats an error escaping an event handler as fatal.
135
60
  */
136
61
  function reportDeclined(error) {
137
62
  devWarn(`${error.message} (${error.code})`);
@@ -142,9 +67,6 @@ function reportDeclined(error) {
142
67
  devWarn('config.onError threw; ignoring it.');
143
68
  }
144
69
  }
145
-
146
- // ============ Errors ============
147
-
148
70
  function notInitializedError() {
149
71
  return createAdshiftError(AdshiftErrorCode.NotInitialized, 'AdShift SDK is not initialized. Call Adshift.initialize(config) first.');
150
72
  }
@@ -167,11 +89,7 @@ function isStringArray(value) {
167
89
  return Array.isArray(value) && value.every(isNonEmptyString);
168
90
  }
169
91
 
170
- /**
171
- * Plain names a caller is likely to invent, mapped onto the standard constant
172
- * that carries the same meaning. Built from the constants so there is one list
173
- * to keep, not two.
174
- */
92
+ /** Plain names a caller is likely to use instead of a standard parameter. */
175
93
  const STANDARD_PARAM_BY_PLAIN_NAME = (() => {
176
94
  const index = new Map();
177
95
  const standard = new Set(getAllEventParams());
@@ -188,10 +106,7 @@ const STANDARD_PARAM_BY_PLAIN_NAME = (() => {
188
106
  })();
189
107
  const reportedPlainParamNames = new Set();
190
108
 
191
- /**
192
- * Warns once per name when a value carries a plain name instead of the
193
- * standard one. Sending it is allowed — it just stays a custom parameter.
194
- */
109
+ /** Warns once per name; the value is still sent, as a custom parameter. */
195
110
  function warnAboutPlainParamNames(values) {
196
111
  if (values === undefined) return;
197
112
  for (const key of Object.keys(values)) {
@@ -217,15 +132,9 @@ function validateEventValues(values, name) {
217
132
  }
218
133
  }
219
134
 
220
- // ============ Configuration received before initialize() ============
221
-
222
135
  /**
223
- * Folds settings received before `initialize()` into the config.
224
- *
225
- * The config wins for anything it states, because it is the later and more
226
- * explicit declaration. Push key paths are additive, so they are merged.
227
- * Settings that reach the SDK through a setter only are applied by
228
- * `applyPendingSettings()` right after the native module is initialized.
136
+ * The config wins over a value set before `initialize()`; push paths from both
137
+ * are kept. Values without a config option go through `applyPendingSettings()`.
229
138
  */
230
139
  function withPendingSettings(config) {
231
140
  const merged = {
@@ -277,9 +186,6 @@ function applyPendingSettings() {
277
186
  }
278
187
  }
279
188
  }
280
-
281
- // ============ Deep link delivery ============
282
-
283
189
  function ensureNativeSubscription() {
284
190
  if (nativeSubscription) return;
285
191
  nativeSubscription = NativeAdShiftReactNativePlugin.onDeepLink(payload => {
@@ -287,9 +193,7 @@ function ensureNativeSubscription() {
287
193
  });
288
194
  }
289
195
  function dispatchDeepLink(deepLink) {
290
- // A result must never overtake one already waiting in the buffer: a deferred
291
- // link delivered after a link tapped later would attribute the install to
292
- // the wrong click.
196
+ // A result must not overtake one still waiting in the buffer.
293
197
  if (listeners.size === 0 || deepLinkBuffer.length > 0) {
294
198
  bufferDeepLink(deepLink);
295
199
  scheduleReplay();
@@ -333,9 +237,6 @@ function scheduleReplay() {
333
237
  }
334
238
  });
335
239
  }
336
-
337
- // ============ Automatic URL forwarding (iOS) ============
338
-
339
240
  function autoForwardEnabled() {
340
241
  return Platform.OS === 'ios' && frozenConfig !== null && frozenConfig.autoHandleDeepLinks !== false;
341
242
  }
@@ -345,16 +246,13 @@ function startLinkingAutoForward() {
345
246
  url
346
247
  }) => {
347
248
  if (state === 'uninitialized' || !autoForwardEnabled()) return;
348
- // An app that handles `url` itself and calls handleDeepLink() sees the same
349
- // event here, and the two are indistinguishable from a second tap. The
350
- // short window treats them as one link; a tap that comes later is a
351
- // separate click and is forwarded.
249
+ // An app that also passes this event to handleDeepLink() must not count the
250
+ // link twice; a tap after the short window is a new click.
352
251
  if (wasAutoForwardedRecently(url)) return;
353
252
  forwardUrl(url, false).catch(() => undefined);
354
253
  });
355
- // The launch URL is read on every initialize(), so it comes back after a
356
- // JavaScript reload as well. It is marked as such, and the native side keeps
357
- // it for the lifetime of the process, so the link is booked once.
254
+ // getInitialURL() returns the launch URL again after a JavaScript reload;
255
+ // marked as the launch URL, native forwards it once per process.
358
256
  initialUrlForward = Linking.getInitialURL().then(url => url ? forwardUrl(url, true) : undefined).catch(() => undefined).finally(() => {
359
257
  initialUrlForward = null;
360
258
  });
@@ -397,9 +295,6 @@ async function waitForInitialUrlForward() {
397
295
  if (timer !== undefined) clearTimeout(timer);
398
296
  }
399
297
  }
400
-
401
- // ============ Start gating ============
402
-
403
298
  function runWhenStarted(run) {
404
299
  switch (state) {
405
300
  case 'uninitialized':
@@ -440,11 +335,7 @@ function rejectPendingCalls(error) {
440
335
  }
441
336
  }
442
337
 
443
- /**
444
- * Warns when the native SDK on the device is not the one this release was built
445
- * against. Only iOS reports its version, so on Android the pin is guarded by a
446
- * build-time test instead.
447
- */
338
+ /** Only iOS reports its SDK version; on Android a build test guards the pin. */
448
339
  function checkNativeSdkVersion(reported) {
449
340
  if (typeof reported !== 'string' || reported.length === 0) return;
450
341
  const expected = Platform.OS === 'ios' ? NATIVE_SDK_VERSIONS.ios : Platform.OS === 'android' ? NATIVE_SDK_VERSIONS.android : null;
@@ -483,8 +374,7 @@ async function performStart() {
483
374
  await waitForInitialUrlForward();
484
375
  const result = readStartResult(await NativeAdShiftReactNativePlugin.start());
485
376
  if (epoch !== startEpoch) {
486
- // A newer start() owns the lifecycle now; report what native said and
487
- // leave the state to the newer attempt.
377
+ // A newer start() owns the state now.
488
378
  return result;
489
379
  }
490
380
  if (state !== 'starting') {
@@ -503,7 +393,6 @@ async function performStart() {
503
393
  state = 'started';
504
394
  flushPendingCalls();
505
395
  if (result.apiKeyValidationStatus === 'invalid') {
506
- // The SDK started locally, but nothing it sends will be accepted.
507
396
  reportDeclined(createAdshiftError(AdshiftErrorCode.InvalidApiKey, 'AdShift SDK: the backend rejected this API key; no data will be reported.'));
508
397
  }
509
398
  return result;
@@ -525,8 +414,6 @@ async function performStart() {
525
414
  errorCode: mapped.code,
526
415
  errorMessage: mapped.message
527
416
  };
528
- // What the platform said travels with the result, the same way it does
529
- // when the native side answers with a failure instead of rejecting.
530
417
  if (mapped.userInfo.nativeCode !== undefined) {
531
418
  result.nativeCode = mapped.userInfo.nativeCode;
532
419
  }
@@ -538,31 +425,17 @@ async function performStart() {
538
425
  }
539
426
 
540
427
  /**
541
- * Whether a failed start rules out the calls waiting for it.
542
- *
543
- * A rejected key, an excluded device and a missing configuration cannot be
544
- * fixed by trying again, so the waiting calls are answered. Anything else can
545
- * be, and holding the calls is worth more than answering them quickly: the
546
- * data survives until the app starts the SDK again.
428
+ * Failures a retry cannot fix, which reject the calls waiting for `start()`.
429
+ * After any other failure they wait for the next attempt.
547
430
  */
548
431
  function isTerminalStartFailure(code) {
549
432
  return code === AdshiftErrorCode.InvalidApiKey || code === AdshiftErrorCode.OptedOut || code === AdshiftErrorCode.NotInitialized;
550
433
  }
551
-
552
- // ============ Main SDK API ============
553
-
554
434
  export const Adshift = {
555
- // ============ Lifecycle ============
556
-
557
435
  /**
558
- * Initializes the SDK.
559
- *
560
- * Call once, as early as possible (e.g. at module scope of `App.tsx`).
561
- * The configuration is fixed on the first call; later calls are ignored.
562
- *
563
- * Never raises, because it is meant to run at module scope, where an error
564
- * would stop the bundle from evaluating. An unusable config is reported
565
- * through `config.onError` and answered by `start()`.
436
+ * Call once, as early as possible, for example at module scope. The first
437
+ * config is kept; later calls are ignored. Never raises: an unusable config
438
+ * is reported through `config.onError` and returned by `start()`.
566
439
  */
567
440
  initialize(config) {
568
441
  if (state !== 'uninitialized') {
@@ -586,6 +459,10 @@ export const Adshift = {
586
459
  refuse('AdShift SDK: pushDeepLinkPaths must be an array of string arrays');
587
460
  return;
588
461
  }
462
+ if (config.deferredDeepLinkClipboard !== undefined && !DEFERRED_DEEP_LINK_CLIPBOARD_MODES.has(config.deferredDeepLinkClipboard)) {
463
+ refuse("AdShift SDK: deferredDeepLinkClipboard must be 'disabled', 'prompt' or 'pasteControl'");
464
+ return;
465
+ }
589
466
  configError = null;
590
467
  frozenConfig = Object.freeze(withPendingSettings(config));
591
468
  try {
@@ -605,14 +482,9 @@ export const Adshift = {
605
482
  }
606
483
  },
607
484
  /**
608
- * Starts the SDK.
609
- *
610
- * Resolves once the SDK has started locally. Never rejects; inspect
611
- * `result.success` and `result.errorCode`. Calls to `trackEvent`,
612
- * `trackPurchase` and `logAdRevenue` made before this resolves are queued
613
- * and dispatched afterwards. A start that fails with a reason retrying
614
- * cannot fix rejects them instead; any other failure keeps them waiting for
615
- * the next attempt.
485
+ * Never rejects; check `result.success`. `trackEvent`, `trackPurchase` and
486
+ * `logAdRevenue` calls made before it succeeds wait for it. A failure that
487
+ * retrying cannot fix rejects them; otherwise they wait for the next try.
616
488
  */
617
489
  start() {
618
490
  if (state === 'uninitialized') {
@@ -640,11 +512,8 @@ export const Adshift = {
640
512
  return attempt;
641
513
  },
642
514
  /**
643
- * Stops the SDK. Tracking calls reject with `NOT_STARTED` until the next
644
- * successful `start()`.
645
- *
646
- * Before `initialize()` there is nothing to stop: the call is reported and
647
- * skipped.
515
+ * Tracking calls reject with `NOT_STARTED` until the next successful
516
+ * `start()`. Before `initialize()` the call is reported and skipped.
648
517
  */
649
518
  stop() {
650
519
  if (state === 'uninitialized') {
@@ -664,13 +533,9 @@ export const Adshift = {
664
533
  isStarted() {
665
534
  return state === 'started';
666
535
  },
667
- // ============ Configuration ============
668
-
669
536
  /**
670
- * Sets your own user identifier. Can be called before or after `start()`.
671
- *
672
- * Called before `initialize()`, the value is kept and applied afterwards.
673
- * An empty identifier is reported and skipped; nothing is raised.
537
+ * Your own user id; may be set at any time. Before `initialize()` it is kept
538
+ * and applied afterwards. An empty id is reported and skipped.
674
539
  */
675
540
  setCustomerUserId(userId) {
676
541
  if (!isNonEmptyString(userId)) {
@@ -684,9 +549,8 @@ export const Adshift = {
684
549
  NativeAdShiftReactNativePlugin.setCustomerUserId(userId);
685
550
  },
686
551
  /**
687
- * Enables or disables verbose SDK logging at runtime.
688
- *
689
- * Called before `initialize()`, the value is kept and applied afterwards.
552
+ * Verbose SDK logging. Before `initialize()` the value is kept and applied
553
+ * afterwards.
690
554
  */
691
555
  setDebugEnabled(enabled) {
692
556
  if (state === 'uninitialized') {
@@ -696,10 +560,9 @@ export const Adshift = {
696
560
  NativeAdShiftReactNativePlugin.setDebugEnabled(enabled === true);
697
561
  },
698
562
  /**
699
- * Sets the debounce interval for automatic `app_open` events.
700
- *
701
- * Called before `initialize()`, the value is kept and applied afterwards.
702
- * A negative interval is reported and skipped; nothing is raised.
563
+ * Debounce interval for automatic `app_open` events. Before `initialize()`
564
+ * the value is kept and applied afterwards. A negative value is reported and
565
+ * skipped.
703
566
  */
704
567
  setAppOpenDebounceMs(ms) {
705
568
  if (!isFiniteNumber(ms) || ms < 0) {
@@ -713,10 +576,8 @@ export const Adshift = {
713
576
  NativeAdShiftReactNativePlugin.setAppOpenDebounceMs(ms);
714
577
  },
715
578
  /**
716
- * Sets branded attribution domains. Must be called before `start()`.
717
- *
718
- * Called before `initialize()`, the domains are kept and applied with the
719
- * config, so they are in place before the first link is processed.
579
+ * Your own link domains; set them before `start()`. Before `initialize()`
580
+ * they are kept and passed with the config.
720
581
  */
721
582
  setBrandedDomains(domains) {
722
583
  if (!isStringArray(domains)) {
@@ -730,9 +591,8 @@ export const Adshift = {
730
591
  NativeAdShiftReactNativePlugin.setBrandedDomains(domains);
731
592
  },
732
593
  /**
733
- * Sets the Meta app id used to parse Meta App Links. No-op on iOS.
734
- *
735
- * Called before `initialize()`, the value is kept and applied afterwards.
594
+ * Meta app id used to parse Meta App Links; no-op on iOS. Before
595
+ * `initialize()` the value is kept and applied afterwards.
736
596
  */
737
597
  setMetaAppId(appId) {
738
598
  if (!isNonEmptyString(appId)) {
@@ -746,11 +606,9 @@ export const Adshift = {
746
606
  NativeAdShiftReactNativePlugin.setMetaAppId(appId);
747
607
  },
748
608
  /**
749
- * Hands over an OAID the app obtained itself, for Android devices without
750
- * Google Play services. Set `collectOaid: false` when you supply it this
751
- * way. No-op on iOS.
752
- *
753
- * Called before `initialize()`, the value is kept and applied afterwards.
609
+ * An OAID the app obtained itself, for Android devices without Google Play
610
+ * services; set `collectOaid: false` as well. No-op on iOS. Before
611
+ * `initialize()` the value is kept and applied afterwards.
754
612
  */
755
613
  setOaidData(oaid) {
756
614
  if (!isNonEmptyString(oaid)) {
@@ -763,13 +621,9 @@ export const Adshift = {
763
621
  }
764
622
  NativeAdShiftReactNativePlugin.setOaidData(oaid);
765
623
  },
766
- // ============ Consent (GDPR/DMA) ============
767
-
768
624
  /**
769
- * Sets consent collected by your own UI. Use `AdshiftConsent.forGDPRUser()`
770
- * or `AdshiftConsent.forNonGDPRUser()`.
771
- *
772
- * Called before `initialize()`, the consent is kept and applied afterwards.
625
+ * Consent collected by your own UI: `AdshiftConsent.forGDPRUser()` or
626
+ * `forNonGDPRUser()`. Before `initialize()` it is kept and applied later.
773
627
  */
774
628
  setConsentData(consent) {
775
629
  if (!isPlainObject(consent) || typeof consent.isUserSubjectToGDPR !== 'boolean') {
@@ -783,10 +637,8 @@ export const Adshift = {
783
637
  NativeAdShiftReactNativePlugin.setConsentData(consentToMap(consent));
784
638
  },
785
639
  /**
786
- * Enables or disables reading IAB TCF v2.2 consent from the CMP on device.
787
- * Call before `start()`.
788
- *
789
- * Called before `initialize()`, the value is kept and applied afterwards.
640
+ * Reading IAB TCF v2.2 consent from the CMP on the device. Call before
641
+ * `start()`; before `initialize()` the value is kept and applied afterwards.
790
642
  */
791
643
  enableTCFDataCollection(enabled) {
792
644
  if (state === 'uninitialized') {
@@ -796,14 +648,9 @@ export const Adshift = {
796
648
  NativeAdShiftReactNativePlugin.enableTCFDataCollection(enabled === true);
797
649
  },
798
650
  /**
799
- * Enables reading an IAB GPP string written by the CMP on device, used for US
800
- * state privacy signals. Off until called with `true`.
801
- *
802
- * The GPP string rides on its own axis: it is forwarded alongside whatever
803
- * decides the GDPR axis, including a consent set through `setConsentData()`,
804
- * and it does not gate the advertising identifier on the device.
805
- *
806
- * Call before `start()`. Called before `initialize()`, the value is kept and
651
+ * Reading an IAB GPP string written by the CMP, for US state privacy
652
+ * signals; off until called with `true`. It does not gate the advertising
653
+ * id. Call before `start()`; before `initialize()` the value is kept and
807
654
  * applied afterwards.
808
655
  */
809
656
  enableGPPDataCollection(enabled) {
@@ -814,20 +661,10 @@ export const Adshift = {
814
661
  NativeAdShiftReactNativePlugin.enableGPPDataCollection(enabled === true);
815
662
  },
816
663
  /**
817
- * States what the app collected about passing this user's data on to
818
- * advertising partners. Use `AdshiftThirdPartySharing.optedOut()` or
819
- * `AdshiftThirdPartySharing.allowed()`.
820
- *
821
- * This is the answer to a different question than `setConsentData()`, and it
822
- * has the opposite default: nothing said here means sharing is allowed, so
823
- * only call it once the user has actually been asked. Setting `allowed()` at
824
- * startup as a default records a declaration the user never made, and events
825
- * already sent cannot be recalled when a real answer arrives.
826
- *
827
- * Nothing is gated on the device either way — this travels with the events for
828
- * the backend to act on.
829
- *
830
- * Called before `initialize()`, the answer is kept and applied afterwards.
664
+ * The user's answer on sharing their data with advertising partners:
665
+ * `AdshiftThirdPartySharing.optedOut()` or `allowed()`. Unlike consent,
666
+ * saying nothing means allowed, so call it only once the user was asked;
667
+ * events already sent are not recalled. Kept if called before `initialize()`.
831
668
  */
832
669
  setThirdPartySharing(sharing) {
833
670
  if (!isPlainObject(sharing) || typeof sharing.optOut !== 'boolean') {
@@ -841,15 +678,9 @@ export const Adshift = {
841
678
  NativeAdShiftReactNativePlugin.setThirdPartySharing(thirdPartySharingToMap(sharing));
842
679
  },
843
680
  /**
844
- * Withdraws the answer set by `setThirdPartySharing()`.
845
- *
846
- * Subsequent events state nothing on this axis, which is not the same as
847
- * stating that sharing is allowed: the first leaves the decision to your
848
- * dashboard configuration, the second is the app's own declaration and is
849
- * recorded as such.
850
- *
851
- * Called before `initialize()`, this cancels a `setThirdPartySharing()` that
852
- * was also queued.
681
+ * Withdraws `setThirdPartySharing()`: later events say nothing about sharing,
682
+ * which is not the same as `allowed()`. Before `initialize()` it cancels a
683
+ * queued `setThirdPartySharing()`.
853
684
  */
854
685
  clearThirdPartySharing() {
855
686
  if (state === 'uninitialized') {
@@ -875,21 +706,11 @@ export const Adshift = {
875
706
  throw toAdshiftError(error);
876
707
  }
877
708
  },
878
- // ============ Event Tracking ============
879
-
880
709
  /**
881
- * Tracks an in-app event.
882
- *
883
- * `app_install` and `app_open` are reserved: the SDK sends them itself and
884
- * passing them here rejects with `INVALID_ARGUMENT`.
885
- *
886
- * Resolves once the SDK has accepted the event. A call made between
887
- * `initialize()` and a successful `start()` waits for the start: it is sent
888
- * when the SDK starts, and rejects when the start fails for a reason
889
- * retrying cannot fix (rejected key, excluded device) or after `stop()`.
890
- * A start that failed for any other reason keeps the call waiting for the
891
- * next attempt, so `start()` belongs on every launch path.
892
- *
710
+ * `app_install` and `app_open` are reserved. A call made before a successful
711
+ * `start()` waits for it, so call `start()` on every launch path; it rejects
712
+ * after `stop()` or a start failure retrying cannot fix (rejected key,
713
+ * excluded device).
893
714
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`, `NOT_STARTED`,
894
715
  * `INVALID_API_KEY`, `OPTED_OUT`, `QUEUE_FULL`, `INVALID_ARGUMENT`).
895
716
  */
@@ -908,11 +729,7 @@ export const Adshift = {
908
729
  warnAboutPlainParamNames(values);
909
730
  return runWhenStarted(() => NativeAdShiftReactNativePlugin.trackEvent(eventName, values ?? null));
910
731
  },
911
- /**
912
- * Tracks a purchase.
913
- *
914
- * @returns Rejects with `AdshiftError` (see `trackEvent`).
915
- */
732
+ /** Waits for `start()` and rejects like `trackEvent()`. */
916
733
  trackPurchase(params) {
917
734
  if (!isPlainObject(params)) {
918
735
  return Promise.reject(invalidArgument('AdShift SDK: params must be an object'));
@@ -938,9 +755,8 @@ export const Adshift = {
938
755
  return runWhenStarted(() => NativeAdShiftReactNativePlugin.trackPurchase(productId, revenue, currency, transactionId));
939
756
  },
940
757
  /**
941
- * Logs ad revenue for a single impression.
942
- *
943
- * @returns Rejects with `AdshiftError` (see `trackEvent`).
758
+ * Revenue of a single impression, not an aggregate. Waits for `start()` and
759
+ * rejects like `trackEvent()`.
944
760
  */
945
761
  logAdRevenue(params) {
946
762
  if (!isPlainObject(params)) {
@@ -970,7 +786,7 @@ export const Adshift = {
970
786
  if (!isFiniteNumber(revenue) || revenue <= 0) {
971
787
  return Promise.reject(invalidArgument('AdShift SDK: revenue must be a positive number'));
972
788
  }
973
- if (revenue > MAX_AD_REVENUE_PER_IMPRESSION) {
789
+ if (revenue > MAX_AD_REVENUE_PER_IMPRESSION && (Platform.OS === 'android' || currency.toUpperCase() === 'USD')) {
974
790
  devWarn(`logAdRevenue: revenue above ${MAX_AD_REVENUE_PER_IMPRESSION} is not recorded. ` + 'Pass the revenue of a single impression, not an aggregate.');
975
791
  }
976
792
  if (adUnitId !== undefined && typeof adUnitId !== 'string') {
@@ -998,11 +814,7 @@ export const Adshift = {
998
814
  }
999
815
  return runWhenStarted(() => NativeAdShiftReactNativePlugin.logAdRevenue(data));
1000
816
  },
1001
- // ============ Identity ============
1002
-
1003
- /**
1004
- * Returns the AdShift device id, or `null` before `initialize()`.
1005
- */
817
+ /** `null` before `initialize()`. */
1006
818
  async getAdShiftDeviceId() {
1007
819
  if (state === 'uninitialized') {
1008
820
  return null;
@@ -1014,15 +826,9 @@ export const Adshift = {
1014
826
  throw toAdshiftError(error);
1015
827
  }
1016
828
  },
1017
- // ============ Deep Links ============
1018
-
1019
829
  /**
1020
- * Passes a URL to the SDK.
1021
- *
1022
- * Not needed when `autoHandleDeepLinks` is on (the default). The result is
1023
- * delivered through `onDeepLink()`; the promise resolves once the SDK has
1024
- * finished processing the URL.
1025
- *
830
+ * Passes a URL to the SDK; not needed with `autoHandleDeepLinks` on (the
831
+ * default). The result arrives through `onDeepLink()`.
1026
832
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
1027
833
  * `INVALID_ARGUMENT`).
1028
834
  */
@@ -1051,11 +857,27 @@ export const Adshift = {
1051
857
  }
1052
858
  },
1053
859
  /**
1054
- * Adds a key path inside push payloads that carries an AdShift deep link.
1055
- *
1056
- * Called before `initialize()`, the path is kept and registered afterwards.
1057
- * The first path you register takes over from the top-level `as_push_link`
1058
- * the SDK reads on its own, so register that key too if you still need it.
860
+ * With `deferredDeepLinkClipboard: 'pasteControl'`, passes what the user
861
+ * pasted with `UIPasteControl`, or `null` when they skipped it. Call it on
862
+ * every way out of onboarding: the first launch's deferred deep link waits
863
+ * for it. No-op on Android.
864
+ */
865
+ handlePastedDeepLink(url) {
866
+ if (url !== null && typeof url !== 'string') {
867
+ reportDeclined(invalidArgument('AdShift SDK: url must be a string or null'));
868
+ return;
869
+ }
870
+ if (state === 'uninitialized') {
871
+ reportDeclined(notInitializedError());
872
+ return;
873
+ }
874
+ NativeAdShiftReactNativePlugin.handlePastedDeepLink(isNonEmptyString(url) ? url : null);
875
+ },
876
+ /**
877
+ * A key path inside push payloads that carries an AdShift deep link. The
878
+ * first path replaces the top-level `as_push_link` the SDK reads by default,
879
+ * so add that one too if you still use it. Kept if called before
880
+ * `initialize()`.
1059
881
  */
1060
882
  addPushNotificationDeepLinkPath(path) {
1061
883
  if (!isStringArray(path) || path.length === 0) {
@@ -1069,10 +891,8 @@ export const Adshift = {
1069
891
  NativeAdShiftReactNativePlugin.addPushNotificationDeepLinkPath(path);
1070
892
  },
1071
893
  /**
1072
- * Passes a push notification payload to the SDK. Resolves to `true` when
1073
- * the payload carried an AdShift deep link; the result then arrives
1074
- * through `onDeepLink()`.
1075
- *
894
+ * Resolves to `true` when the payload carried an AdShift deep link; the
895
+ * result then arrives through `onDeepLink()`.
1076
896
  * @returns Rejects with `AdshiftError` (`NOT_INITIALIZED`,
1077
897
  * `INVALID_ARGUMENT`).
1078
898
  */
@@ -1090,11 +910,9 @@ export const Adshift = {
1090
910
  }
1091
911
  },
1092
912
  /**
1093
- * Registers a deep link listener.
1094
- *
1095
- * Safe to call before `initialize()`. Results that arrive while no
1096
- * listener is registered are buffered and delivered to the first listener.
1097
- * Every link that reaches the SDK (direct, deferred, push) is delivered.
913
+ * Safe to call before `initialize()`. Results that arrive while no listener
914
+ * is registered are buffered for the first one. Every link that reaches the
915
+ * SDK (direct, deferred, push) is delivered once.
1098
916
  */
1099
917
  onDeepLink(callback) {
1100
918
  if (typeof callback !== 'function') {
@@ -1117,8 +935,6 @@ export const Adshift = {
1117
935
  }
1118
936
  };
1119
937
  },
1120
- // ============ Info ============
1121
-
1122
938
  getInfo() {
1123
939
  return {
1124
940
  platform: Platform.OS,