@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,16 +1,10 @@
1
1
  /**
2
- * Where the current consent state comes from.
3
- *
4
- * - `manual`: set through `Adshift.setConsentData()`
5
- * - `tcf`: read from an IAB TCF v2.2 CMP
6
- * - `gpp`: read from an IAB GPP string written by the CMP
7
- * - `none`: no consent information available
2
+ * `manual`: from `Adshift.setConsentData()`; `tcf`: an IAB TCF v2.2 CMP;
3
+ * `gpp`: an IAB GPP string written by the CMP; `none`: no consent information.
8
4
  */
9
5
  export type ConsentSource = 'manual' | 'tcf' | 'gpp' | 'none';
10
6
 
11
- /**
12
- * Consent state as seen by the SDK, returned by `Adshift.refreshConsent()`.
13
- */
7
+ /** Consent as the SDK applies it. */
14
8
  export interface ConsentSnapshot {
15
9
  source: ConsentSource;
16
10
  /** IAB `gdprApplies` value when known (0 or 1). */
@@ -20,14 +14,9 @@ export interface ConsentSnapshot {
20
14
  /** Whether a GPP string is present on the device. */
21
15
  gppPresent?: boolean;
22
16
  /**
23
- * Whether a CMP has run on this device, judged by the keys a CMP writes when
24
- * it starts rather than by a consent payload being readable.
25
- *
26
- * This is the field that separates the two cases the flags above cannot: a CMP
27
- * installed but not yet answered looks identical to no CMP at all, and the two
28
- * are fixed by opposite actions. `false` while you expect a CMP means it never
29
- * ran or was never wired up; `true` with `source: 'none'` means it ran and the
30
- * user has not answered yet, which resolves itself once they do.
17
+ * Whether a CMP has run on this device. `false` while you expect one: it
18
+ * never ran or is not wired up. `true` with `source: 'none'`: it ran and the
19
+ * user has not answered yet.
31
20
  */
32
21
  cmpDetected: boolean;
33
22
  /** Ad user data flag, when decided. */
@@ -39,37 +28,21 @@ export interface ConsentSnapshot {
39
28
  /** When the snapshot was applied, in milliseconds since epoch. */
40
29
  appliedAtMillis: number;
41
30
  /**
42
- * Whether consent lets the SDK attach the platform advertising identifier
43
- * (GAID or OAID on Android, IDFA on iOS) to what it reports. The
44
- * `adshift_device_id` is never affected.
45
- *
46
- * Each platform answers with the rule it applies to the flags above, and
47
- * those rules differ, so read this instead of comparing the flags yourself.
31
+ * Whether consent lets the SDK attach the advertising id (GAID or OAID on
32
+ * Android, IDFA on iOS); `adshift_device_id` is never affected. The platforms
33
+ * judge the flags by different rules, so read this, not the flags.
48
34
  */
49
35
  adIdentifiersAllowed: boolean;
50
36
  }
51
37
 
52
38
  const SOURCES: ReadonlySet<string> = new Set(['manual', 'tcf', 'gpp', 'none']);
53
39
 
54
- /**
55
- * The platforms name the GPP source differently: Android reports `gpp_us_nat`,
56
- * iOS reports `gpp`. Both mean the same axis, so they are reported as one value
57
- * rather than leaving one platform to fall through to `none`.
58
- *
59
- * `gpp` is the name reported here because `gpp_us_nat` is one section of the
60
- * framework — the US national one. A CMP writing a state section instead would
61
- * make that name wrong, and the section actually read is a separate fact the
62
- * backend already records. Naming the axis after the framework survives that.
63
- */
40
+ /** Android reports the GPP source as `gpp_us_nat`, iOS as `gpp`. */
64
41
  const SOURCE_ALIASES: Readonly<Record<string, ConsentSource>> = Object.freeze({
65
42
  gpp_us_nat: 'gpp',
66
43
  });
67
44
 
68
- /**
69
- * Builds a `ConsentSnapshot` from a native bridge object.
70
- *
71
- * @internal
72
- */
45
+ /** @internal */
73
46
  export function consentSnapshotFromMap(
74
47
  map: Record<string, unknown>
75
48
  ): ConsentSnapshot {
@@ -1,42 +1,61 @@
1
- /**
2
- * Status of a deep link result.
3
- */
4
1
  export enum AdshiftDeepLinkStatus {
5
- /** The link was processed and delivered. */
2
+ /** A RightLink link, or a deferred deep link with a value. Navigate on this. */
6
3
  Found = 'found',
7
4
 
8
- /** No deep link was found (e.g. organic install, deferred lookup empty). */
5
+ /** Not a RightLink link, a deleted one, or no deferred deep link. */
9
6
  NotFound = 'notFound',
10
7
 
11
- /** An error occurred while resolving the deep link. */
8
+ /** Not resolved yet; the same link can still arrive as `found`. */
12
9
  Error = 'error',
13
10
  }
14
11
 
12
+ export enum AdshiftDeepLinkSource {
13
+ /** A Universal Link, or a link the app passed in itself. iOS. */
14
+ UniversalLink = 'ul',
15
+
16
+ /** An App Link, or a link the app passed in itself. Android. */
17
+ AppLink = 'app_link',
18
+
19
+ /** The app's own scheme; `found` only when it wraps a RightLink link in `as_rl`. */
20
+ Scheme = 'scheme',
21
+
22
+ /** The open-in-app button of a RightLink page. */
23
+ Cta = 'cta',
24
+
25
+ /** A push notification. */
26
+ Push = 'push',
27
+
28
+ /** An AdAttributionKit re-engagement open. iOS. */
29
+ AdAttributionKit = 'aak',
30
+
31
+ /** A link opened by a Meta app that is not a RightLink link. Android. */
32
+ MetaAppLink = 'meta_applink',
33
+
34
+ /** The lookup on the first launch after install. */
35
+ Deferred = 'deferred',
36
+
37
+ /** A web link that is not a RightLink link. */
38
+ Foreign = 'foreign',
39
+ }
40
+
15
41
  /**
16
- * Deep link delivered through `Adshift.onDeepLink()`.
17
- *
18
- * Every link that enters the app and reaches the SDK produces a result with
19
- * `status: 'found'`. Route on `deepLinkValue`, `params` or the URL itself.
20
- *
21
- * @example
22
- * ```typescript
23
- * Adshift.onDeepLink((deepLink) => {
24
- * if (deepLink.status === AdshiftDeepLinkStatus.Found) {
25
- * const productId = deepLink.params?.product_id;
26
- * }
27
- * });
28
- * ```
42
+ * Navigate only on `status: 'found'`, and validate `deepLinkValue` first:
43
+ * anyone can write a link. Any other URL comes back `notFound` with the URL
44
+ * in `deepLink`. Treat `error` as "not yet".
29
45
  */
30
46
  export interface AdshiftDeepLink {
47
+ /**
48
+ * The link as opened, a short link expanded. On iOS a deferred result has
49
+ * none: route on `deepLinkValue`.
50
+ */
31
51
  deepLink?: string;
32
52
 
33
- /** Standardized routing value (`deep_link_value`). */
53
+ /** Routing value, `deep_link_value`. */
34
54
  deepLinkValue?: string;
35
55
 
36
56
  /**
37
- * Query parameters of the link. On Android `deep_link_sub1` … `sub5` also
38
- * appear here; on iOS they are only available as the `deepLinkSubN` fields
39
- * below, which both platforms fill.
57
+ * Query parameters of a RightLink link, your own keys included. Absent for
58
+ * any other URL.
40
59
  */
41
60
  params?: Record<string, string>;
42
61
 
@@ -45,12 +64,28 @@ export interface AdshiftDeepLink {
45
64
 
46
65
  status: AdshiftDeepLinkStatus;
47
66
 
48
- /** Error message when `status` is `error`. */
67
+ /** Error message when `status` is `error`; wording differs per platform. */
49
68
  errorMessage?: string;
50
69
 
70
+ /** How the link reached the app. */
71
+ source?: AdshiftDeepLinkSource;
72
+
73
+ /**
74
+ * Id of the click this open was attributed to. Absent for a deferred result
75
+ * and when no click was recorded.
76
+ */
77
+ clickId?: string;
78
+
51
79
  /**
52
- * Whether the result belongs to the first session after install. Android
53
- * reports it for every result, deferred or not; undefined on iOS.
80
+ * `false` when a deferred result is not certain to belong to this user: route
81
+ * them, but do not sign them in or grant a reward because of it.
82
+ * @platform ios
83
+ */
84
+ matchGuaranteed?: boolean;
85
+
86
+ /**
87
+ * Whether the result came in the first session after install. `isDeferred`
88
+ * alone does not mean a new user.
54
89
  */
55
90
  isFirstSession?: boolean;
56
91
 
@@ -70,6 +105,8 @@ export interface AdshiftDeepLink {
70
105
  deepLinkSub5?: string;
71
106
  }
72
107
 
108
+ const SOURCES = new Set<string>(Object.values(AdshiftDeepLinkSource));
109
+
73
110
  const SUB_KEYS = [
74
111
  'deepLinkSub1',
75
112
  'deepLinkSub2',
@@ -78,9 +115,7 @@ const SUB_KEYS = [
78
115
  'deepLinkSub5',
79
116
  ] as const;
80
117
 
81
- /**
82
- * Helper functions for creating `AdshiftDeepLink` objects.
83
- */
118
+ /** Builds `AdshiftDeepLink` values. */
84
119
  export const AdshiftDeepLink = {
85
120
  found(options: {
86
121
  deepLink: string;
@@ -88,6 +123,9 @@ export const AdshiftDeepLink = {
88
123
  params?: Record<string, string>;
89
124
  isDeferred?: boolean;
90
125
  isFirstSession?: boolean;
126
+ source?: AdshiftDeepLinkSource;
127
+ clickId?: string;
128
+ matchGuaranteed?: boolean;
91
129
  deepLinkSub1?: string;
92
130
  deepLinkSub2?: string;
93
131
  deepLinkSub3?: string;
@@ -108,6 +146,15 @@ export const AdshiftDeepLink = {
108
146
  if (options.isFirstSession !== undefined) {
109
147
  result.isFirstSession = options.isFirstSession;
110
148
  }
149
+ if (options.source !== undefined) {
150
+ result.source = options.source;
151
+ }
152
+ if (options.clickId !== undefined) {
153
+ result.clickId = options.clickId;
154
+ }
155
+ if (options.matchGuaranteed !== undefined) {
156
+ result.matchGuaranteed = options.matchGuaranteed;
157
+ }
111
158
  for (const key of SUB_KEYS) {
112
159
  const value = options[key];
113
160
  if (value !== undefined) {
@@ -132,11 +179,7 @@ export const AdshiftDeepLink = {
132
179
  };
133
180
  },
134
181
 
135
- /**
136
- * Creates a deep link from a native bridge object.
137
- *
138
- * @internal
139
- */
182
+ /** @internal */
140
183
  fromMap(map: Record<string, unknown>): AdshiftDeepLink {
141
184
  const params = readParams(map.params);
142
185
  const result: AdshiftDeepLink = {
@@ -159,6 +202,15 @@ export const AdshiftDeepLink = {
159
202
  if (typeof map.isFirstSession === 'boolean') {
160
203
  result.isFirstSession = map.isFirstSession;
161
204
  }
205
+ if (typeof map.source === 'string' && SOURCES.has(map.source)) {
206
+ result.source = map.source as AdshiftDeepLinkSource;
207
+ }
208
+ if (typeof map.clickId === 'string' && map.clickId.length > 0) {
209
+ result.clickId = map.clickId;
210
+ }
211
+ if (typeof map.matchGuaranteed === 'boolean') {
212
+ result.matchGuaranteed = map.matchGuaranteed;
213
+ }
162
214
  SUB_KEYS.forEach((key, index) => {
163
215
  const sub = map[key] ?? params?.[`deep_link_sub${index + 1}`];
164
216
  if (typeof sub === 'string') {
@@ -194,11 +246,7 @@ function readParams(value: unknown): Record<string, string> | undefined {
194
246
  return count > 0 ? out : undefined;
195
247
  }
196
248
 
197
- /**
198
- * Converts `AdshiftDeepLink` to a plain object.
199
- *
200
- * @internal
201
- */
249
+ /** @internal */
202
250
  export function deepLinkToMap(
203
251
  deepLink: AdshiftDeepLink
204
252
  ): Record<string, unknown> {
@@ -1,7 +1,4 @@
1
- /**
2
- * Platform-neutral error codes used by every rejected promise and by
3
- * `StartResult.errorCode`.
4
- */
1
+ /** Codes of every rejected promise and of `StartResult.errorCode`. */
5
2
  export enum AdshiftErrorCode {
6
3
  /** `Adshift.initialize()` has not been called. */
7
4
  NotInitialized = 'NOT_INITIALIZED',
@@ -9,9 +6,9 @@ export enum AdshiftErrorCode {
9
6
  NotStarted = 'NOT_STARTED',
10
7
  /** The API key was rejected by the AdShift backend. */
11
8
  InvalidApiKey = 'INVALID_API_KEY',
12
- /** Tracking is disabled for this app on the AdShift side. */
9
+ /** Tracking is turned off for this device. */
13
10
  OptedOut = 'OPTED_OUT',
14
- /** The event queue is full; the call was not accepted. */
11
+ /** Too many calls are queued; this one was not accepted. */
15
12
  QueueFull = 'QUEUE_FULL',
16
13
  /** A parameter failed validation. */
17
14
  InvalidArgument = 'INVALID_ARGUMENT',
@@ -19,9 +16,6 @@ export enum AdshiftErrorCode {
19
16
  Unknown = 'UNKNOWN',
20
17
  }
21
18
 
22
- /**
23
- * Platform-specific details attached to an `AdshiftError`.
24
- */
25
19
  export interface AdshiftErrorInfo {
26
20
  /** Raw code reported by the native SDK, when available. */
27
21
  nativeCode?: number | string;
@@ -29,12 +23,7 @@ export interface AdshiftErrorInfo {
29
23
  nativeDomain?: string;
30
24
  }
31
25
 
32
- /**
33
- * Error thrown or rejected by the AdShift plugin.
34
- *
35
- * `code` is always one of `AdshiftErrorCode`; the original native code, when
36
- * there is one, is available in `userInfo.nativeCode`.
37
- */
26
+ /** `code` is always an `AdshiftErrorCode`; a native code is in `userInfo`. */
38
27
  export interface AdshiftError extends Error {
39
28
  code: AdshiftErrorCode;
40
29
  userInfo: AdshiftErrorInfo;
@@ -42,9 +31,6 @@ export interface AdshiftError extends Error {
42
31
 
43
32
  const CODES = new Set<string>(Object.values(AdshiftErrorCode));
44
33
 
45
- /**
46
- * Type guard for errors produced by the plugin.
47
- */
48
34
  export function isAdshiftError(error: unknown): error is AdshiftError {
49
35
  return (
50
36
  typeof error === 'object' &&
@@ -54,11 +40,7 @@ export function isAdshiftError(error: unknown): error is AdshiftError {
54
40
  );
55
41
  }
56
42
 
57
- /**
58
- * Builds an `AdshiftError` from a code and message.
59
- *
60
- * @internal
61
- */
43
+ /** @internal */
62
44
  export function createAdshiftError(
63
45
  code: AdshiftErrorCode,
64
46
  message: string,
@@ -72,9 +54,8 @@ export function createAdshiftError(
72
54
  }
73
55
 
74
56
  /**
75
- * Normalises a promise rejection coming from the native module into an
76
- * `AdshiftError`. Native modules reject with `{ code, message, userInfo }`.
77
- *
57
+ * Native modules reject with `{ code, message, userInfo }`; a code outside
58
+ * `AdshiftErrorCode` becomes `UNKNOWN`, kept as `nativeCode`.
78
59
  * @internal
79
60
  */
80
61
  export function toAdshiftError(error: unknown): AdshiftError {
@@ -1,24 +1,9 @@
1
1
  /**
2
- * Standard parameter names for the `values` passed to `Adshift.trackEvent()`.
3
- *
4
- * Reports aggregate these names. Any other key is kept with the event as a
5
- * custom parameter, so a misspelled or invented name is stored but never
6
- * counted — use the constants for anything a report has to add up, revenue
7
- * above all.
8
- *
9
- * @example
10
- * ```typescript
11
- * await Adshift.trackEvent(AdshiftEventType.Purchase, {
12
- * [AdshiftEventParam.Revenue]: 9.99,
13
- * [AdshiftEventParam.Currency]: 'USD',
14
- * [AdshiftEventParam.ContentId]: 'SKU123',
15
- * size: 'XL', // custom parameters are fine alongside them
16
- * });
17
- * ```
2
+ * Standard names for `trackEvent()` values. Reports add up only these; any
3
+ * other key is kept as a custom parameter and never counted, so use the
4
+ * constants for revenue above all.
18
5
  */
19
6
  export const AdshiftEventParam = {
20
- // ============ Commerce ============
21
-
22
7
  Price: 'as_price',
23
8
 
24
9
  /** The number reports read as revenue. Always pair it with `Currency`. */
@@ -43,8 +28,6 @@ export const AdshiftEventParam = {
43
28
 
44
29
  Validated: 'as_validated',
45
30
 
46
- // ============ Content ============
47
-
48
31
  ContentType: 'as_content_type',
49
32
 
50
33
  ContentId: 'as_content_id',
@@ -59,16 +42,12 @@ export const AdshiftEventParam = {
59
42
 
60
43
  SearchString: 'as_search_string',
61
44
 
62
- // ============ Ratings and reviews ============
63
-
64
45
  RatingValue: 'as_rating_value',
65
46
 
66
47
  MaxRatingValue: 'as_max_rating_value',
67
48
 
68
49
  ReviewText: 'as_review_text',
69
50
 
70
- // ============ User and progress ============
71
-
72
51
  CustomerUserId: 'as_customer_user_id',
73
52
 
74
53
  RegistrationMethod: 'as_registration_method',
@@ -85,8 +64,6 @@ export const AdshiftEventParam = {
85
64
 
86
65
  VirtualCurrencyName: 'as_virtual_currency_name',
87
66
 
88
- // ============ App and links ============
89
-
90
67
  DeepLink: 'as_deep_link',
91
68
 
92
69
  OldVersion: 'as_old_version',
@@ -97,8 +74,6 @@ export const AdshiftEventParam = {
97
74
 
98
75
  TouchObj: 'as_touch_obj',
99
76
 
100
- // ============ Dates and places ============
101
-
102
77
  DateA: 'as_date_a',
103
78
 
104
79
  DateB: 'as_date_b',
@@ -123,8 +98,6 @@ export const AdshiftEventParam = {
123
98
 
124
99
  DestinationList: 'as_destination_list',
125
100
 
126
- // ============ Travel ============
127
-
128
101
  DepartingDepartureDate: 'as_departing_departure_date',
129
102
 
130
103
  ReturningDepartureDate: 'as_returning_departure_date',
@@ -161,8 +134,6 @@ export const AdshiftEventParam = {
161
134
 
162
135
  PreferredNumStops: 'as_preferred_num_stops',
163
136
 
164
- // ============ Free-form slots ============
165
-
166
137
  Param1: 'as_param_1',
167
138
 
168
139
  Param2: 'as_param_2',
@@ -183,10 +154,8 @@ export const AdshiftEventParam = {
183
154
 
184
155
  Param10: 'as_param_10',
185
156
 
186
- // ============ Ad revenue ============
187
157
  // `logAdRevenue()` fills Revenue, Currency, AdRevenueSource and
188
- // AdRevenueNetworkName from its own arguments and drops them from
189
- // `additionalParameters`. The rest below are yours to pass.
158
+ // AdRevenueNetworkName itself and drops them from `additionalParameters`.
190
159
 
191
160
  AdRevenueSource: 'as_adrev_source',
192
161
 
@@ -208,9 +177,6 @@ export const AdshiftEventParam = {
208
177
  export type AdshiftEventParamValue =
209
178
  (typeof AdshiftEventParam)[keyof typeof AdshiftEventParam];
210
179
 
211
- /**
212
- * Returns all standard parameter names as an array.
213
- */
214
180
  export function getAllEventParams(): AdshiftEventParamValue[] {
215
181
  return Object.values(AdshiftEventParam);
216
182
  }
@@ -1,26 +1,5 @@
1
- /**
2
- * Predefined event types for AdShift SDK.
3
- *
4
- * Use these constants for consistent event naming across your app.
5
- *
6
- * Pair them with `AdshiftEventParam` for the values.
7
- *
8
- * @example
9
- * ```typescript
10
- * await Adshift.trackEvent(AdshiftEventType.AddToCart, {
11
- * [AdshiftEventParam.ContentId]: 'SKU123',
12
- * [AdshiftEventParam.Price]: 29.99,
13
- * });
14
- * ```
15
- *
16
- * You can also use custom event names as strings:
17
- * ```typescript
18
- * await Adshift.trackEvent('custom_event_name');
19
- * ```
20
- */
1
+ /** Standard event names; any other name is tracked as a custom event. */
21
2
  export const AdshiftEventType = {
22
- // ============ E-commerce Events ============
23
-
24
3
  AddToCart: 'as_add_to_cart',
25
4
 
26
5
  AddToWishList: 'as_add_to_wishlist',
@@ -37,8 +16,6 @@ export const AdshiftEventType = {
37
16
 
38
17
  Search: 'as_search',
39
18
 
40
- // ============ User Lifecycle Events ============
41
-
42
19
  CompleteRegistration: 'as_complete_registration',
43
20
 
44
21
  Login: 'as_login',
@@ -49,8 +26,6 @@ export const AdshiftEventType = {
49
26
 
50
27
  StartTrial: 'as_start_trial',
51
28
 
52
- // ============ Gaming Events ============
53
-
54
29
  LevelAchieved: 'as_level_achieved',
55
30
 
56
31
  AchievementUnlocked: 'as_achievement_unlocked',
@@ -58,8 +33,6 @@ export const AdshiftEventType = {
58
33
  /** Note the plural in the value; the key is singular for compatibility. */
59
34
  SpentCredit: 'as_spent_credits',
60
35
 
61
- // ============ Engagement Events ============
62
-
63
36
  Rate: 'as_rate',
64
37
 
65
38
  Share: 'as_share',
@@ -72,12 +45,8 @@ export const AdshiftEventType = {
72
45
 
73
46
  OpenedFromPushNotification: 'as_opened_from_push_notification',
74
47
 
75
- // ============ Travel Events ============
76
-
77
48
  TravelBooking: 'as_travel_booking',
78
49
 
79
- // ============ Ad Events ============
80
-
81
50
  AdClick: 'as_ad_click',
82
51
 
83
52
  AdView: 'as_ad_view',
@@ -85,16 +54,12 @@ export const AdshiftEventType = {
85
54
  /** Ad revenue impression. Prefer `Adshift.logAdRevenue()`. */
86
55
  AdRevenue: 'as_ad_revenue',
87
56
 
88
- // ============ Location Events ============
89
-
90
57
  /** Region or place the user moved to, as your own values. */
91
58
  LocationChanged: 'as_location_changed',
92
59
 
93
60
  /** Latitude and longitude. Send only what your privacy notice covers. */
94
61
  LocationCoordinates: 'as_location_coordinates',
95
62
 
96
- // ============ Other Events ============
97
-
98
63
  /** Your order identifier, for matching purchases with your own records. */
99
64
  OrderId: 'as_order_id',
100
65
 
@@ -105,9 +70,6 @@ export const AdshiftEventType = {
105
70
  export type AdshiftEventTypeValue =
106
71
  (typeof AdshiftEventType)[keyof typeof AdshiftEventType];
107
72
 
108
- /**
109
- * Returns all predefined event types as an array.
110
- */
111
73
  export function getAllEventTypes(): AdshiftEventTypeValue[] {
112
74
  return Object.values(AdshiftEventType);
113
75
  }
@@ -1,37 +1,14 @@
1
1
  /**
2
- * What the app says about passing this user's data on to someone else.
3
- *
4
- * A separate question from {@link AdshiftConsent}, and one with the opposite
5
- * default. Consent under GDPR must be affirmative, so a flag nobody set counts
6
- * as no consent. Here nothing said means sharing is allowed — which is why this
7
- * is not a fourth flag on the consent object: folding the two together would
8
- * make one of them wrong.
9
- *
10
- * The three states live in the calls rather than in a nullable field. Never
11
- * calling `Adshift.setThirdPartySharing()` leaves the question unanswered,
12
- * `Adshift.clearThirdPartySharing()` returns to unanswered, and the value here
13
- * is the answer itself.
14
- *
15
- * An object rather than a bare `boolean` so a field can be added later without
16
- * breaking callers.
17
- *
18
- * @example
19
- * ```typescript
20
- * // The user asked not to have their data passed on
21
- * Adshift.setThirdPartySharing(AdshiftThirdPartySharing.optedOut());
22
- *
23
- * // The user was asked and did not opt out
24
- * Adshift.setThirdPartySharing(AdshiftThirdPartySharing.allowed());
25
- * ```
2
+ * The user's answer on passing their data on to advertising partners. Unlike
3
+ * consent, no answer means allowed. Until `Adshift.setThirdPartySharing()` is
4
+ * called, or after `clearThirdPartySharing()`, the question is unanswered.
26
5
  */
27
6
  export interface AdshiftThirdPartySharing {
28
7
  /** `true` withholds this user's data from advertising partners. */
29
8
  optOut: boolean;
30
9
  }
31
10
 
32
- /**
33
- * Helper functions for creating `AdshiftThirdPartySharing` objects.
34
- */
11
+ /** Builds `AdshiftThirdPartySharing` values. */
35
12
  export const AdshiftThirdPartySharing = {
36
13
  /** The user asked not to have their data passed on. */
37
14
  optedOut(): AdshiftThirdPartySharing {
@@ -39,23 +16,15 @@ export const AdshiftThirdPartySharing = {
39
16
  },
40
17
 
41
18
  /**
42
- * The user did not ask to be excluded.
43
- *
44
- * Only worth sending when the app has actually asked. Setting this at startup
45
- * as a default is the one mistake to avoid here: a CMP answer arriving later
46
- * cannot be undone for events already sent, and the declaration is recorded
47
- * as the app's own rather than as the absence of one.
19
+ * The user was asked and did not opt out. Not a default for startup: a later
20
+ * answer cannot correct events already sent.
48
21
  */
49
22
  allowed(): AdshiftThirdPartySharing {
50
23
  return { optOut: false };
51
24
  },
52
25
  };
53
26
 
54
- /**
55
- * Converts `AdshiftThirdPartySharing` to a plain object for the native bridge.
56
- *
57
- * @internal
58
- */
27
+ /** @internal */
59
28
  export function thirdPartySharingToMap(
60
29
  sharing: AdshiftThirdPartySharing
61
30
  ): Record<string, boolean> {
@@ -1,5 +1,11 @@
1
- export type { AdshiftConfig } from './AdshiftConfig';
2
- export { configToMap } from './AdshiftConfig';
1
+ export type {
2
+ AdshiftConfig,
3
+ AdshiftDeferredDeepLinkClipboard,
4
+ } from './AdshiftConfig';
5
+ export {
6
+ configToMap,
7
+ DEFERRED_DEEP_LINK_CLIPBOARD_MODES,
8
+ } from './AdshiftConfig';
3
9
 
4
10
  export type { ConsentFlag } from './AdshiftConsent';
5
11
  export { AdshiftConsent, consentToMap } from './AdshiftConsent';
@@ -14,6 +20,7 @@ export {
14
20
 
15
21
  export {
16
22
  AdshiftDeepLinkStatus,
23
+ AdshiftDeepLinkSource,
17
24
  AdshiftDeepLink,
18
25
  deepLinkToMap,
19
26
  } from './AdshiftDeepLink';
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/write-version.js from package.json. Do not edit.
2
- export const PLUGIN_VERSION = '2.1.0';
2
+ export const PLUGIN_VERSION = '3.1.0';