@adshift/react-native-plugin 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/AdShiftReactNativePlugin.podspec +1 -1
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +90 -41
  4. package/android/build.gradle +3 -1
  5. package/android/src/main/AndroidManifest.xml +14 -1
  6. package/android/src/main/java/com/adshift/reactnativeplugin/AdShiftReactNativePluginModule.kt +12 -1
  7. package/android/src/main/java/com/adshift/reactnativeplugin/RestoredIntents.kt +64 -0
  8. package/android/src/test/java/com/adshift/reactnativeplugin/DeepLinkDeliveryTest.kt +40 -3
  9. package/android/src/test/java/com/adshift/reactnativeplugin/InitializeOrderingTest.kt +14 -0
  10. package/android/src/test/java/com/adshift/reactnativeplugin/LaunchIntentForwardingTest.kt +30 -1
  11. package/android/src/test/java/com/adshift/reactnativeplugin/ModuleTestSupport.kt +13 -0
  12. package/ios/AdShiftReactNativePlugin.mm +5 -0
  13. package/ios/AdShiftReactNativePluginHelper.swift +25 -1
  14. package/ios/Core/BridgeRules.swift +18 -1
  15. package/lib/commonjs/Adshift.js +25 -2
  16. package/lib/commonjs/Adshift.js.map +1 -1
  17. package/lib/commonjs/NativeAdShiftReactNativePlugin.js.map +1 -1
  18. package/lib/commonjs/index.js +6 -0
  19. package/lib/commonjs/index.js.map +1 -1
  20. package/lib/commonjs/jest/index.js +2 -0
  21. package/lib/commonjs/jest/index.js.map +1 -1
  22. package/lib/commonjs/nativeSdkVersions.js +2 -2
  23. package/lib/commonjs/types/AdshiftConfig.js +10 -1
  24. package/lib/commonjs/types/AdshiftConfig.js.map +1 -1
  25. package/lib/commonjs/types/AdshiftDeepLink.js +50 -6
  26. package/lib/commonjs/types/AdshiftDeepLink.js.map +1 -1
  27. package/lib/commonjs/types/index.js +12 -0
  28. package/lib/commonjs/types/index.js.map +1 -1
  29. package/lib/commonjs/version.js +1 -1
  30. package/lib/module/Adshift.js +26 -3
  31. package/lib/module/Adshift.js.map +1 -1
  32. package/lib/module/NativeAdShiftReactNativePlugin.js.map +1 -1
  33. package/lib/module/index.js +1 -1
  34. package/lib/module/index.js.map +1 -1
  35. package/lib/module/jest/index.js +3 -1
  36. package/lib/module/jest/index.js.map +1 -1
  37. package/lib/module/nativeSdkVersions.js +2 -2
  38. package/lib/module/types/AdshiftConfig.js +9 -1
  39. package/lib/module/types/AdshiftConfig.js.map +1 -1
  40. package/lib/module/types/AdshiftDeepLink.js +50 -5
  41. package/lib/module/types/AdshiftDeepLink.js.map +1 -1
  42. package/lib/module/types/index.js +2 -2
  43. package/lib/module/types/index.js.map +1 -1
  44. package/lib/module/version.js +1 -1
  45. package/lib/typescript/commonjs/src/Adshift.d.ts +9 -1
  46. package/lib/typescript/commonjs/src/Adshift.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts +13 -4
  48. package/lib/typescript/commonjs/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/src/index.d.ts +2 -2
  50. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/jest/index.d.ts +3 -1
  52. package/lib/typescript/commonjs/src/jest/index.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/nativeSdkVersions.d.ts +2 -2
  54. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts +25 -2
  55. package/lib/typescript/commonjs/src/types/AdshiftConfig.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts +55 -11
  57. package/lib/typescript/commonjs/src/types/AdshiftDeepLink.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/src/types/index.d.ts +3 -3
  59. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/src/version.d.ts +1 -1
  61. package/lib/typescript/module/src/Adshift.d.ts +9 -1
  62. package/lib/typescript/module/src/Adshift.d.ts.map +1 -1
  63. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts +13 -4
  64. package/lib/typescript/module/src/NativeAdShiftReactNativePlugin.d.ts.map +1 -1
  65. package/lib/typescript/module/src/index.d.ts +2 -2
  66. package/lib/typescript/module/src/index.d.ts.map +1 -1
  67. package/lib/typescript/module/src/jest/index.d.ts +3 -1
  68. package/lib/typescript/module/src/jest/index.d.ts.map +1 -1
  69. package/lib/typescript/module/src/nativeSdkVersions.d.ts +2 -2
  70. package/lib/typescript/module/src/types/AdshiftConfig.d.ts +25 -2
  71. package/lib/typescript/module/src/types/AdshiftConfig.d.ts.map +1 -1
  72. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts +55 -11
  73. package/lib/typescript/module/src/types/AdshiftDeepLink.d.ts.map +1 -1
  74. package/lib/typescript/module/src/types/index.d.ts +3 -3
  75. package/lib/typescript/module/src/types/index.d.ts.map +1 -1
  76. package/lib/typescript/module/src/version.d.ts +1 -1
  77. package/package.json +1 -1
  78. package/src/Adshift.ts +39 -2
  79. package/src/NativeAdShiftReactNativePlugin.ts +14 -4
  80. package/src/index.tsx +6 -2
  81. package/src/jest/index.ts +5 -0
  82. package/src/nativeSdkVersions.ts +2 -2
  83. package/src/types/AdshiftConfig.ts +38 -2
  84. package/src/types/AdshiftDeepLink.ts +87 -11
  85. package/src/types/index.ts +9 -2
  86. package/src/version.ts +1 -1
@@ -5,7 +5,7 @@
5
5
  * loading the native module, and so a release bumps them in one place.
6
6
  */
7
7
  export declare const NATIVE_SDK_VERSIONS: Readonly<{
8
- android: "3.2.0";
9
- ios: "2.4.0";
8
+ android: "4.1.0";
9
+ ios: "3.0.0";
10
10
  }>;
11
11
  //# sourceMappingURL=nativeSdkVersions.d.ts.map
@@ -1,4 +1,11 @@
1
1
  import type { AdshiftError } from './AdshiftError';
2
+ /**
3
+ * Whether the first launch on iOS reads the deferred deep link a RightLink
4
+ * page copied to the clipboard.
5
+ */
6
+ export type AdshiftDeferredDeepLinkClipboard = 'disabled' | 'prompt' | 'pasteControl';
7
+ /** @internal */
8
+ export declare const DEFERRED_DEEP_LINK_CLIPBOARD_MODES: ReadonlySet<string>;
2
9
  /**
3
10
  * Configuration for initializing the AdShift SDK.
4
11
  *
@@ -30,10 +37,16 @@ export interface AdshiftConfig {
30
37
  */
31
38
  appOpenDebounceMs?: number;
32
39
  /**
33
- * Branded (custom) attribution domains, e.g. `links.example.com`.
34
- * Links on these hosts are treated as attribution links.
40
+ * Your own link domains, e.g. `links.example.com`. Without this a link on
41
+ * such a domain comes back `notFound` and is not counted as a click.
35
42
  */
36
43
  brandedDomains?: string[];
44
+ /**
45
+ * Mark every click and event as test traffic, which is kept out of
46
+ * reports, postbacks and billing. A debug build does not turn it on.
47
+ * @default false
48
+ */
49
+ testMode?: boolean;
37
50
  /**
38
51
  * Meta app id used to parse Meta App Links.
39
52
  * @platform android
@@ -75,6 +88,16 @@ export interface AdshiftConfig {
75
88
  * @platform ios
76
89
  */
77
90
  attTimeoutMs?: number;
91
+ /**
92
+ * Read the deferred deep link from the clipboard on the first launch, for
93
+ * RightLink templates with the clipboard option. `prompt`: iOS asks the
94
+ * user to allow the paste, once per install. `pasteControl`: your
95
+ * onboarding shows `UIPasteControl` and passes the result to
96
+ * `Adshift.handlePastedDeepLink()`.
97
+ * @default 'disabled'
98
+ * @platform ios
99
+ */
100
+ deferredDeepLinkClipboard?: AdshiftDeferredDeepLinkClipboard;
78
101
  /**
79
102
  * Enable OAID collection on devices without Google Play services.
80
103
  * @default true
@@ -1 +1 @@
1
- {"version":3,"file":"AdshiftConfig.d.ts","sourceRoot":"","sources":["../../../../../src/types/AdshiftConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,OA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CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IAE/B;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAI9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;OAQG;IACH,yBAAyB,CAAC,EAAE,gCAAgC,CAAC;IAI7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CACzC;AA6BD,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAS1E"}
@@ -2,18 +2,42 @@
2
2
  * Status of a deep link result.
3
3
  */
4
4
  export declare enum AdshiftDeepLinkStatus {
5
- /** The link was processed and delivered. */
5
+ /** A RightLink link, or a deferred deep link with a value. Navigate on this. */
6
6
  Found = "found",
7
- /** No deep link was found (e.g. organic install, deferred lookup empty). */
7
+ /** Not a RightLink link, a deleted one, or no deferred deep link. */
8
8
  NotFound = "notFound",
9
- /** An error occurred while resolving the deep link. */
9
+ /** Not resolved yet; the same link can still arrive as `found`. */
10
10
  Error = "error"
11
11
  }
12
+ /**
13
+ * How the link of a result reached the app.
14
+ */
15
+ export declare enum AdshiftDeepLinkSource {
16
+ /** A Universal Link, or a link the app passed in itself. iOS. */
17
+ UniversalLink = "ul",
18
+ /** An App Link, or a link the app passed in itself. Android. */
19
+ AppLink = "app_link",
20
+ /** The app's own scheme; `found` only when it wraps a RightLink link in `as_rl`. */
21
+ Scheme = "scheme",
22
+ /** The open-in-app button of a RightLink page. */
23
+ Cta = "cta",
24
+ /** A push notification. */
25
+ Push = "push",
26
+ /** An AdAttributionKit re-engagement open. iOS. */
27
+ AdAttributionKit = "aak",
28
+ /** A link opened by a Meta app that is not a RightLink link. Android. */
29
+ MetaAppLink = "meta_applink",
30
+ /** The lookup on the first launch after install. */
31
+ Deferred = "deferred",
32
+ /** A web link that is not a RightLink link. */
33
+ Foreign = "foreign"
34
+ }
12
35
  /**
13
36
  * Deep link delivered through `Adshift.onDeepLink()`.
14
37
  *
15
- * Every link that enters the app and reaches the SDK produces a result with
16
- * `status: 'found'`. Route on `deepLinkValue`, `params` or the URL itself.
38
+ * Navigate only on `status: 'found'`, and validate `deepLinkValue` first:
39
+ * anyone can write a link. Any other URL comes back `notFound` with the URL
40
+ * in `deepLink`. Treat `error` as "not yet".
17
41
  *
18
42
  * @example
19
43
  * ```typescript
@@ -25,23 +49,40 @@ export declare enum AdshiftDeepLinkStatus {
25
49
  * ```
26
50
  */
27
51
  export interface AdshiftDeepLink {
52
+ /**
53
+ * The link as opened, a short link expanded. On iOS a deferred result has
54
+ * none: route on `deepLinkValue`.
55
+ */
28
56
  deepLink?: string;
29
57
  /** Standardized routing value (`deep_link_value`). */
30
58
  deepLinkValue?: string;
31
59
  /**
32
- * Query parameters of the link. On Android `deep_link_sub1` … `sub5` also
33
- * appear here; on iOS they are only available as the `deepLinkSubN` fields
34
- * below, which both platforms fill.
60
+ * Query parameters of a RightLink link, your own keys included. Absent for
61
+ * any other URL.
35
62
  */
36
63
  params?: Record<string, string>;
37
64
  /** Whether this result comes from deferred deep linking (first launch). */
38
65
  isDeferred: boolean;
39
66
  status: AdshiftDeepLinkStatus;
40
- /** Error message when `status` is `error`. */
67
+ /** Error message when `status` is `error`; wording differs per platform. */
41
68
  errorMessage?: string;
69
+ /** How the link reached the app. */
70
+ source?: AdshiftDeepLinkSource;
71
+ /**
72
+ * Id of the click this open was attributed to. Absent for a deferred result
73
+ * and when no click was recorded.
74
+ */
75
+ clickId?: string;
76
+ /**
77
+ * `false` for a deferred result matched without a clipboard token or an
78
+ * advertising identifier: route the user, but do not sign them in or grant
79
+ * a reward because of it.
80
+ * @platform ios
81
+ */
82
+ matchGuaranteed?: boolean;
42
83
  /**
43
- * Whether the result belongs to the first session after install. Android
44
- * reports it for every result, deferred or not; undefined on iOS.
84
+ * Whether the result came in the first session after install. `isDeferred`
85
+ * alone does not mean a new user.
45
86
  */
46
87
  isFirstSession?: boolean;
47
88
  /** Custom sub-parameter 1 (`deep_link_sub1`). */
@@ -65,6 +106,9 @@ export declare const AdshiftDeepLink: {
65
106
  params?: Record<string, string>;
66
107
  isDeferred?: boolean;
67
108
  isFirstSession?: boolean;
109
+ source?: AdshiftDeepLinkSource;
110
+ clickId?: string;
111
+ matchGuaranteed?: boolean;
68
112
  deepLinkSub1?: string;
69
113
  deepLinkSub2?: string;
70
114
  deepLinkSub3?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"AdshiftDeepLink.d.ts","sourceRoot":"","sources":["../../../../../src/types/AdshiftDeepLink.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,4CAA4C;IAC5C,KAAK,UAAU;IAEf,4EAA4E;IAC5E,QAAQ,aAAa;IAErB,uDAAuD;IACvD,KAAK,UAAU;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,2EAA2E;IAC3E,UAAU,EAAE,OAAO,CAAC;IAEpB,MAAM,EAAE,qBAAqB,CAAC;IAE9B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MA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Ae;mBACX;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,MAAM,CAAC,EAAE,qBAAqB,CAAC;QAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,eAAe;gBAiCP,eAAe;mBAOZ,MAAM,GAAG,eAAe;IAQvC;;;;OAIG;iBACU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe;CAuCvD,CAAC;AA2BF;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,eAAe,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB"}
@@ -1,11 +1,11 @@
1
- export type { AdshiftConfig } from './AdshiftConfig';
2
- export { configToMap } from './AdshiftConfig';
1
+ export type { AdshiftConfig, AdshiftDeferredDeepLinkClipboard, } from './AdshiftConfig';
2
+ export { configToMap, DEFERRED_DEEP_LINK_CLIPBOARD_MODES, } from './AdshiftConfig';
3
3
  export type { ConsentFlag } from './AdshiftConsent';
4
4
  export { AdshiftConsent, consentToMap } from './AdshiftConsent';
5
5
  export type { ConsentSnapshot, ConsentSource } from './AdshiftConsentSnapshot';
6
6
  export { consentSnapshotFromMap } from './AdshiftConsentSnapshot';
7
7
  export { AdshiftThirdPartySharing, thirdPartySharingToMap, } from './AdshiftThirdPartySharing';
8
- export { AdshiftDeepLinkStatus, AdshiftDeepLink, deepLinkToMap, } from './AdshiftDeepLink';
8
+ export { AdshiftDeepLinkStatus, AdshiftDeepLinkSource, AdshiftDeepLink, deepLinkToMap, } from './AdshiftDeepLink';
9
9
  export { AdshiftEventType, getAllEventTypes } from './AdshiftEventType';
10
10
  export type { AdshiftEventTypeValue } from './AdshiftEventType';
11
11
  export { AdshiftEventParam, getAllEventParams } from './AdshiftEventParam';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,YAAY,EACV,4BAA4B,EAC5B,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,aAAa,EACb,gCAAgC,GACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,WAAW,EACX,kCAAkC,GACnC,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,YAAY,EACV,4BAA4B,EAC5B,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const PLUGIN_VERSION = "2.1.0";
1
+ export declare const PLUGIN_VERSION = "3.0.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adshift/react-native-plugin",
3
- "version": "2.1.0",
3
+ "version": "3.0.0",
4
4
  "description": "AdShift SDK for React Native - Mobile Attribution, Event Tracking, SKAdNetwork 4.0+, Deep Linking and GDPR/TCF 2.2 Compliance",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "types": "./lib/typescript/commonjs/src/index.d.ts",
package/src/Adshift.ts CHANGED
@@ -51,6 +51,7 @@ import {
51
51
  AdshiftEventParam,
52
52
  AdshiftMediationNetwork,
53
53
  configToMap,
54
+ DEFERRED_DEEP_LINK_CLIPBOARD_MODES,
54
55
  getAllEventParams,
55
56
  consentSnapshotFromMap,
56
57
  consentToMap,
@@ -150,6 +151,7 @@ const AUTO_FORWARD_DEDUP_MS = 2000;
150
151
  /**
151
152
  * Mirrors a limit the SDK applies, so the warning below can name it. Raising it
152
153
  * there without raising it here makes the warning wrong, not the behaviour.
154
+ * Android compares the amount as given; iOS converts it to USD first.
153
155
  */
154
156
  const MAX_AD_REVENUE_PER_IMPRESSION = 10;
155
157
  const MEDIATION_NETWORKS: ReadonlySet<string> = new Set(
@@ -820,6 +822,15 @@ export const Adshift = {
820
822
  );
821
823
  return;
822
824
  }
825
+ if (
826
+ config.deferredDeepLinkClipboard !== undefined &&
827
+ !DEFERRED_DEEP_LINK_CLIPBOARD_MODES.has(config.deferredDeepLinkClipboard)
828
+ ) {
829
+ refuse(
830
+ "AdShift SDK: deferredDeepLinkClipboard must be 'disabled', 'prompt' or 'pasteControl'"
831
+ );
832
+ return;
833
+ }
823
834
 
824
835
  configError = null;
825
836
  frozenConfig = Object.freeze(withPendingSettings(config));
@@ -1287,7 +1298,10 @@ export const Adshift = {
1287
1298
  invalidArgument('AdShift SDK: revenue must be a positive number')
1288
1299
  );
1289
1300
  }
1290
- if (revenue > MAX_AD_REVENUE_PER_IMPRESSION) {
1301
+ if (
1302
+ revenue > MAX_AD_REVENUE_PER_IMPRESSION &&
1303
+ (Platform.OS === 'android' || currency.toUpperCase() === 'USD')
1304
+ ) {
1291
1305
  devWarn(
1292
1306
  `logAdRevenue: revenue above ${MAX_AD_REVENUE_PER_IMPRESSION} is not recorded. ` +
1293
1307
  'Pass the revenue of a single impression, not an aggregate.'
@@ -1379,6 +1393,28 @@ export const Adshift = {
1379
1393
  }
1380
1394
  },
1381
1395
 
1396
+ /**
1397
+ * With `deferredDeepLinkClipboard: 'pasteControl'`, passes what the user
1398
+ * pasted with `UIPasteControl`, or `null` when they skipped it. Call it on
1399
+ * every way out of onboarding: the first launch's deferred deep link waits
1400
+ * for it. No-op on Android.
1401
+ */
1402
+ handlePastedDeepLink(url: string | null): void {
1403
+ if (url !== null && typeof url !== 'string') {
1404
+ reportDeclined(
1405
+ invalidArgument('AdShift SDK: url must be a string or null')
1406
+ );
1407
+ return;
1408
+ }
1409
+ if (state === 'uninitialized') {
1410
+ reportDeclined(notInitializedError());
1411
+ return;
1412
+ }
1413
+ NativeAdShiftReactNativePlugin.handlePastedDeepLink(
1414
+ isNonEmptyString(url) ? url : null
1415
+ );
1416
+ },
1417
+
1382
1418
  /**
1383
1419
  * Adds a key path inside push payloads that carries an AdShift deep link.
1384
1420
  *
@@ -1435,7 +1471,8 @@ export const Adshift = {
1435
1471
  *
1436
1472
  * Safe to call before `initialize()`. Results that arrive while no
1437
1473
  * listener is registered are buffered and delivered to the first listener.
1438
- * Every link that reaches the SDK (direct, deferred, push) is delivered.
1474
+ * Every link that reaches the SDK (direct, deferred, push) is delivered,
1475
+ * each result once.
1439
1476
  */
1440
1477
  onDeepLink(callback: DeepLinkCallback): DeepLinkSubscription {
1441
1478
  if (typeof callback !== 'function') {
@@ -20,6 +20,9 @@ export type NativeDeepLinkPayload = {
20
20
  deepLinkSub4?: string;
21
21
  deepLinkSub5?: string;
22
22
  isFirstSession?: boolean;
23
+ source?: string;
24
+ clickId?: string;
25
+ matchGuaranteed?: boolean;
23
26
  };
24
27
 
25
28
  /**
@@ -36,10 +39,11 @@ export interface Spec extends TurboModule {
36
39
  * Initializes the SDK.
37
40
  *
38
41
  * Config keys (all optional except `apiKey`): `apiKey`, `isDebug`,
39
- * `appOpenDebounceMs`, `brandedDomains: string[]`, `metaAppId` (Android),
40
- * `pushDeepLinkPaths: string[][]`, `autoHandleDeepLinks`,
41
- * `disableSKAN` / `waitForATTBeforeStart` / `attTimeoutMs` (iOS),
42
- * `collectOaid` (Android). Keys that are absent leave SDK defaults untouched.
42
+ * `appOpenDebounceMs`, `brandedDomains: string[]`, `testMode`,
43
+ * `metaAppId` (Android), `pushDeepLinkPaths: string[][]`,
44
+ * `autoHandleDeepLinks`, `disableSKAN` / `waitForATTBeforeStart` /
45
+ * `attTimeoutMs` / `deferredDeepLinkClipboard` (iOS), `collectOaid`
46
+ * (Android). Keys that are absent leave SDK defaults untouched.
43
47
  */
44
48
  initialize(config: Object): void;
45
49
 
@@ -129,6 +133,12 @@ export interface Spec extends TurboModule {
129
133
  */
130
134
  handleDeepLink(url: string, fromLaunch: boolean): Promise<void>;
131
135
 
136
+ /**
137
+ * Passes what the user pasted with `UIPasteControl`, or null when they
138
+ * skipped it. iOS only; no-op on Android.
139
+ */
140
+ handlePastedDeepLink(url: string | null): void;
141
+
132
142
  /** Registers a push payload key path that carries a deep link. */
133
143
  addPushNotificationDeepLinkPath(path: string[]): void;
134
144
 
package/src/index.tsx CHANGED
@@ -45,7 +45,7 @@ export type {
45
45
  } from './Adshift';
46
46
 
47
47
  // ============ Config ============
48
- export type { AdshiftConfig } from './types';
48
+ export type { AdshiftConfig, AdshiftDeferredDeepLinkClipboard } from './types';
49
49
 
50
50
  // ============ Consent ============
51
51
  // AdshiftConsent is both a type (interface) and a value (helper object).
@@ -62,7 +62,11 @@ export type { AdshiftThirdPartySharing as AdshiftThirdPartySharingType } from '.
62
62
 
63
63
  // ============ Deep Link ============
64
64
  // AdshiftDeepLink is both a type (interface) and a value (helper object).
65
- export { AdshiftDeepLinkStatus, AdshiftDeepLink } from './types';
65
+ export {
66
+ AdshiftDeepLinkStatus,
67
+ AdshiftDeepLinkSource,
68
+ AdshiftDeepLink,
69
+ } from './types';
66
70
  export type { AdshiftDeepLink as AdshiftDeepLinkType } from './types';
67
71
 
68
72
  // ============ Events ============
package/src/jest/index.ts CHANGED
@@ -25,6 +25,7 @@ import { AdshiftThirdPartySharing } from '../types/AdshiftThirdPartySharing';
25
25
  import type { AdshiftDeepLink as AdshiftDeepLinkType } from '../types/AdshiftDeepLink';
26
26
  import {
27
27
  AdshiftDeepLink,
28
+ AdshiftDeepLinkSource,
28
29
  AdshiftDeepLinkStatus,
29
30
  } from '../types/AdshiftDeepLink';
30
31
  import { AdshiftEventType, getAllEventTypes } from '../types/AdshiftEventType';
@@ -75,6 +76,7 @@ export interface AdshiftMock {
75
76
  logAdRevenue: MockFn<(params: Record<string, unknown>) => Promise<void>>;
76
77
  getAdShiftDeviceId: MockFn<() => Promise<string | null>>;
77
78
  handleDeepLink: MockFn<(url: string) => Promise<void>>;
79
+ handlePastedDeepLink: MockFn<(url: string | null) => void>;
78
80
  addPushNotificationDeepLinkPath: MockFn<(path: string[]) => void>;
79
81
  handlePushNotification: MockFn<
80
82
  (payload: Record<string, unknown>) => Promise<boolean>
@@ -108,6 +110,7 @@ export interface AdshiftModuleMock {
108
110
  AdshiftThirdPartySharing: typeof AdshiftThirdPartySharing;
109
111
  AdshiftDeepLink: typeof AdshiftDeepLink;
110
112
  AdshiftDeepLinkStatus: typeof AdshiftDeepLinkStatus;
113
+ AdshiftDeepLinkSource: typeof AdshiftDeepLinkSource;
111
114
  AdshiftEventType: typeof AdshiftEventType;
112
115
  getAllEventTypes: typeof getAllEventTypes;
113
116
  AdshiftEventParam: typeof AdshiftEventParam;
@@ -158,6 +161,7 @@ export function createAdshiftMock(): AdshiftModuleMock {
158
161
  logAdRevenue: jest.fn(async () => undefined),
159
162
  getAdShiftDeviceId: jest.fn(async () => 'mock-device-id'),
160
163
  handleDeepLink: jest.fn(async () => undefined),
164
+ handlePastedDeepLink: jest.fn(),
161
165
  addPushNotificationDeepLinkPath: jest.fn(),
162
166
  handlePushNotification: jest.fn(async () => false),
163
167
  onDeepLink: jest.fn((callback: Listener) => {
@@ -210,6 +214,7 @@ export function createAdshiftMock(): AdshiftModuleMock {
210
214
  AdshiftThirdPartySharing,
211
215
  AdshiftDeepLink,
212
216
  AdshiftDeepLinkStatus,
217
+ AdshiftDeepLinkSource,
213
218
  AdshiftEventType,
214
219
  getAllEventTypes,
215
220
  AdshiftEventParam,
@@ -5,6 +5,6 @@
5
5
  * loading the native module, and so a release bumps them in one place.
6
6
  */
7
7
  export const NATIVE_SDK_VERSIONS = Object.freeze({
8
- android: '3.2.0',
9
- ios: '2.4.0',
8
+ android: '4.1.0',
9
+ ios: '3.0.0',
10
10
  });
@@ -1,5 +1,21 @@
1
1
  import type { AdshiftError } from './AdshiftError';
2
2
 
3
+ /**
4
+ * Whether the first launch on iOS reads the deferred deep link a RightLink
5
+ * page copied to the clipboard.
6
+ */
7
+ export type AdshiftDeferredDeepLinkClipboard =
8
+ | 'disabled'
9
+ | 'prompt'
10
+ | 'pasteControl';
11
+
12
+ /** @internal */
13
+ export const DEFERRED_DEEP_LINK_CLIPBOARD_MODES: ReadonlySet<string> = new Set([
14
+ 'disabled',
15
+ 'prompt',
16
+ 'pasteControl',
17
+ ]);
18
+
3
19
  /**
4
20
  * Configuration for initializing the AdShift SDK.
5
21
  *
@@ -34,11 +50,18 @@ export interface AdshiftConfig {
34
50
  appOpenDebounceMs?: number;
35
51
 
36
52
  /**
37
- * Branded (custom) attribution domains, e.g. `links.example.com`.
38
- * Links on these hosts are treated as attribution links.
53
+ * Your own link domains, e.g. `links.example.com`. Without this a link on
54
+ * such a domain comes back `notFound` and is not counted as a click.
39
55
  */
40
56
  brandedDomains?: string[];
41
57
 
58
+ /**
59
+ * Mark every click and event as test traffic, which is kept out of
60
+ * reports, postbacks and billing. A debug build does not turn it on.
61
+ * @default false
62
+ */
63
+ testMode?: boolean;
64
+
42
65
  /**
43
66
  * Meta app id used to parse Meta App Links.
44
67
  * @platform android
@@ -88,6 +111,17 @@ export interface AdshiftConfig {
88
111
  */
89
112
  attTimeoutMs?: number;
90
113
 
114
+ /**
115
+ * Read the deferred deep link from the clipboard on the first launch, for
116
+ * RightLink templates with the clipboard option. `prompt`: iOS asks the
117
+ * user to allow the paste, once per install. `pasteControl`: your
118
+ * onboarding shows `UIPasteControl` and passes the result to
119
+ * `Adshift.handlePastedDeepLink()`.
120
+ * @default 'disabled'
121
+ * @platform ios
122
+ */
123
+ deferredDeepLinkClipboard?: AdshiftDeferredDeepLinkClipboard;
124
+
91
125
  // ============ Android-only options ============
92
126
 
93
127
  /**
@@ -135,12 +169,14 @@ const BRIDGED_KEYS = [
135
169
  'isDebug',
136
170
  'appOpenDebounceMs',
137
171
  'brandedDomains',
172
+ 'testMode',
138
173
  'metaAppId',
139
174
  'pushDeepLinkPaths',
140
175
  'autoHandleDeepLinks',
141
176
  'disableSKAN',
142
177
  'waitForATTBeforeStart',
143
178
  'attTimeoutMs',
179
+ 'deferredDeepLinkClipboard',
144
180
  'collectOaid',
145
181
  ] as const satisfies ReadonlyArray<keyof AdshiftConfig>;
146
182
 
@@ -2,21 +2,54 @@
2
2
  * Status of a deep link result.
3
3
  */
4
4
  export enum AdshiftDeepLinkStatus {
5
- /** The link was processed and delivered. */
5
+ /** A RightLink link, or a deferred deep link with a value. Navigate on this. */
6
6
  Found = 'found',
7
7
 
8
- /** No deep link was found (e.g. organic install, deferred lookup empty). */
8
+ /** Not a RightLink link, a deleted one, or no deferred deep link. */
9
9
  NotFound = 'notFound',
10
10
 
11
- /** An error occurred while resolving the deep link. */
11
+ /** Not resolved yet; the same link can still arrive as `found`. */
12
12
  Error = 'error',
13
13
  }
14
14
 
15
+ /**
16
+ * How the link of a result reached the app.
17
+ */
18
+ export enum AdshiftDeepLinkSource {
19
+ /** A Universal Link, or a link the app passed in itself. iOS. */
20
+ UniversalLink = 'ul',
21
+
22
+ /** An App Link, or a link the app passed in itself. Android. */
23
+ AppLink = 'app_link',
24
+
25
+ /** The app's own scheme; `found` only when it wraps a RightLink link in `as_rl`. */
26
+ Scheme = 'scheme',
27
+
28
+ /** The open-in-app button of a RightLink page. */
29
+ Cta = 'cta',
30
+
31
+ /** A push notification. */
32
+ Push = 'push',
33
+
34
+ /** An AdAttributionKit re-engagement open. iOS. */
35
+ AdAttributionKit = 'aak',
36
+
37
+ /** A link opened by a Meta app that is not a RightLink link. Android. */
38
+ MetaAppLink = 'meta_applink',
39
+
40
+ /** The lookup on the first launch after install. */
41
+ Deferred = 'deferred',
42
+
43
+ /** A web link that is not a RightLink link. */
44
+ Foreign = 'foreign',
45
+ }
46
+
15
47
  /**
16
48
  * Deep link delivered through `Adshift.onDeepLink()`.
17
49
  *
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.
50
+ * Navigate only on `status: 'found'`, and validate `deepLinkValue` first:
51
+ * anyone can write a link. Any other URL comes back `notFound` with the URL
52
+ * in `deepLink`. Treat `error` as "not yet".
20
53
  *
21
54
  * @example
22
55
  * ```typescript
@@ -28,15 +61,18 @@ export enum AdshiftDeepLinkStatus {
28
61
  * ```
29
62
  */
30
63
  export interface AdshiftDeepLink {
64
+ /**
65
+ * The link as opened, a short link expanded. On iOS a deferred result has
66
+ * none: route on `deepLinkValue`.
67
+ */
31
68
  deepLink?: string;
32
69
 
33
70
  /** Standardized routing value (`deep_link_value`). */
34
71
  deepLinkValue?: string;
35
72
 
36
73
  /**
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.
74
+ * Query parameters of a RightLink link, your own keys included. Absent for
75
+ * any other URL.
40
76
  */
41
77
  params?: Record<string, string>;
42
78
 
@@ -45,12 +81,29 @@ export interface AdshiftDeepLink {
45
81
 
46
82
  status: AdshiftDeepLinkStatus;
47
83
 
48
- /** Error message when `status` is `error`. */
84
+ /** Error message when `status` is `error`; wording differs per platform. */
49
85
  errorMessage?: string;
50
86
 
87
+ /** How the link reached the app. */
88
+ source?: AdshiftDeepLinkSource;
89
+
90
+ /**
91
+ * Id of the click this open was attributed to. Absent for a deferred result
92
+ * and when no click was recorded.
93
+ */
94
+ clickId?: string;
95
+
96
+ /**
97
+ * `false` for a deferred result matched without a clipboard token or an
98
+ * advertising identifier: route the user, but do not sign them in or grant
99
+ * a reward because of it.
100
+ * @platform ios
101
+ */
102
+ matchGuaranteed?: boolean;
103
+
51
104
  /**
52
- * Whether the result belongs to the first session after install. Android
53
- * reports it for every result, deferred or not; undefined on iOS.
105
+ * Whether the result came in the first session after install. `isDeferred`
106
+ * alone does not mean a new user.
54
107
  */
55
108
  isFirstSession?: boolean;
56
109
 
@@ -70,6 +123,8 @@ export interface AdshiftDeepLink {
70
123
  deepLinkSub5?: string;
71
124
  }
72
125
 
126
+ const SOURCES = new Set<string>(Object.values(AdshiftDeepLinkSource));
127
+
73
128
  const SUB_KEYS = [
74
129
  'deepLinkSub1',
75
130
  'deepLinkSub2',
@@ -88,6 +143,9 @@ export const AdshiftDeepLink = {
88
143
  params?: Record<string, string>;
89
144
  isDeferred?: boolean;
90
145
  isFirstSession?: boolean;
146
+ source?: AdshiftDeepLinkSource;
147
+ clickId?: string;
148
+ matchGuaranteed?: boolean;
91
149
  deepLinkSub1?: string;
92
150
  deepLinkSub2?: string;
93
151
  deepLinkSub3?: string;
@@ -108,6 +166,15 @@ export const AdshiftDeepLink = {
108
166
  if (options.isFirstSession !== undefined) {
109
167
  result.isFirstSession = options.isFirstSession;
110
168
  }
169
+ if (options.source !== undefined) {
170
+ result.source = options.source;
171
+ }
172
+ if (options.clickId !== undefined) {
173
+ result.clickId = options.clickId;
174
+ }
175
+ if (options.matchGuaranteed !== undefined) {
176
+ result.matchGuaranteed = options.matchGuaranteed;
177
+ }
111
178
  for (const key of SUB_KEYS) {
112
179
  const value = options[key];
113
180
  if (value !== undefined) {
@@ -159,6 +226,15 @@ export const AdshiftDeepLink = {
159
226
  if (typeof map.isFirstSession === 'boolean') {
160
227
  result.isFirstSession = map.isFirstSession;
161
228
  }
229
+ if (typeof map.source === 'string' && SOURCES.has(map.source)) {
230
+ result.source = map.source as AdshiftDeepLinkSource;
231
+ }
232
+ if (typeof map.clickId === 'string' && map.clickId.length > 0) {
233
+ result.clickId = map.clickId;
234
+ }
235
+ if (typeof map.matchGuaranteed === 'boolean') {
236
+ result.matchGuaranteed = map.matchGuaranteed;
237
+ }
162
238
  SUB_KEYS.forEach((key, index) => {
163
239
  const sub = map[key] ?? params?.[`deep_link_sub${index + 1}`];
164
240
  if (typeof sub === 'string') {