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