@adshift/react-native-plugin 1.0.0 → 2.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.
- package/AdShiftReactNativePlugin.podspec +11 -7
- package/CHANGELOG.md +122 -0
- package/README.md +506 -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 +1135 -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 +959 -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 +311 -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 +311 -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 +49 -10
- package/src/Adshift.ts +1273 -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
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Use these constants for consistent event naming across your app.
|
|
5
5
|
*
|
|
6
|
+
* Pair them with `AdshiftEventParam` for the values.
|
|
7
|
+
*
|
|
6
8
|
* @example
|
|
7
9
|
* ```typescript
|
|
8
10
|
* await Adshift.trackEvent(AdshiftEventType.AddToCart, {
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
+
* [AdshiftEventParam.ContentId]: 'SKU123',
|
|
12
|
+
* [AdshiftEventParam.Price]: 29.99,
|
|
11
13
|
* });
|
|
12
14
|
* ```
|
|
13
15
|
*
|
|
@@ -19,117 +21,93 @@
|
|
|
19
21
|
export const AdshiftEventType = {
|
|
20
22
|
// ============ E-commerce Events ============
|
|
21
23
|
|
|
22
|
-
/** User added item to cart. */
|
|
23
24
|
AddToCart: 'as_add_to_cart',
|
|
24
25
|
|
|
25
|
-
/** User added item to wishlist. */
|
|
26
26
|
AddToWishList: 'as_add_to_wishlist',
|
|
27
27
|
|
|
28
|
-
/** User added payment info. */
|
|
29
28
|
AddPaymentInfo: 'as_add_payment_info',
|
|
30
29
|
|
|
31
|
-
/** User initiated checkout. */
|
|
32
30
|
InitiatedCheckout: 'as_initiated_checkout',
|
|
33
31
|
|
|
34
|
-
/** User completed a purchase. */
|
|
35
32
|
Purchase: 'as_purchase',
|
|
36
33
|
|
|
37
|
-
/** User viewed content/product. */
|
|
38
34
|
ContentView: 'as_content_view',
|
|
39
35
|
|
|
40
|
-
/** User viewed a list of items. */
|
|
41
36
|
ListView: 'as_list_view',
|
|
42
37
|
|
|
43
|
-
/** User searched. */
|
|
44
38
|
Search: 'as_search',
|
|
45
39
|
|
|
46
40
|
// ============ User Lifecycle Events ============
|
|
47
41
|
|
|
48
|
-
/** User completed registration. */
|
|
49
42
|
CompleteRegistration: 'as_complete_registration',
|
|
50
43
|
|
|
51
|
-
/** User logged in. */
|
|
52
44
|
Login: 'as_login',
|
|
53
45
|
|
|
54
|
-
/** User completed tutorial. */
|
|
55
46
|
TutorialCompletion: 'as_tutorial_completion',
|
|
56
47
|
|
|
57
|
-
/** User subscribed. */
|
|
58
48
|
Subscribe: 'as_subscribe',
|
|
59
49
|
|
|
60
|
-
/** User started a trial. */
|
|
61
50
|
StartTrial: 'as_start_trial',
|
|
62
51
|
|
|
63
52
|
// ============ Gaming Events ============
|
|
64
53
|
|
|
65
|
-
/** User achieved a level. */
|
|
66
54
|
LevelAchieved: 'as_level_achieved',
|
|
67
55
|
|
|
68
|
-
/** User unlocked an achievement. */
|
|
69
56
|
AchievementUnlocked: 'as_achievement_unlocked',
|
|
70
57
|
|
|
71
|
-
/**
|
|
58
|
+
/** Note the plural in the value; the key is singular for compatibility. */
|
|
72
59
|
SpentCredit: 'as_spent_credits',
|
|
73
60
|
|
|
74
61
|
// ============ Engagement Events ============
|
|
75
62
|
|
|
76
|
-
/** User rated the app/content. */
|
|
77
63
|
Rate: 'as_rate',
|
|
78
64
|
|
|
79
|
-
/** User shared content. */
|
|
80
65
|
Share: 'as_share',
|
|
81
66
|
|
|
82
|
-
/** User invited others. */
|
|
83
67
|
Invite: 'as_invite',
|
|
84
68
|
|
|
85
|
-
/** User re-engaged with the app. */
|
|
86
69
|
ReEngage: 'as_re_engage',
|
|
87
70
|
|
|
88
|
-
/** User updated the app. */
|
|
89
71
|
Update: 'as_update',
|
|
90
72
|
|
|
91
|
-
/** User opened from push notification. */
|
|
92
73
|
OpenedFromPushNotification: 'as_opened_from_push_notification',
|
|
93
74
|
|
|
94
75
|
// ============ Travel Events ============
|
|
95
76
|
|
|
96
|
-
/** User made a travel booking. */
|
|
97
77
|
TravelBooking: 'as_travel_booking',
|
|
98
78
|
|
|
99
79
|
// ============ Ad Events ============
|
|
100
80
|
|
|
101
|
-
/** User clicked an ad. */
|
|
102
81
|
AdClick: 'as_ad_click',
|
|
103
82
|
|
|
104
|
-
/** User viewed an ad. */
|
|
105
83
|
AdView: 'as_ad_view',
|
|
106
84
|
|
|
85
|
+
/** Ad revenue impression. Prefer `Adshift.logAdRevenue()`. */
|
|
86
|
+
AdRevenue: 'as_ad_revenue',
|
|
87
|
+
|
|
107
88
|
// ============ Location Events ============
|
|
108
89
|
|
|
109
|
-
/**
|
|
90
|
+
/** Region or place the user moved to, as your own values. */
|
|
110
91
|
LocationChanged: 'as_location_changed',
|
|
111
92
|
|
|
112
|
-
/**
|
|
93
|
+
/** Latitude and longitude. Send only what your privacy notice covers. */
|
|
113
94
|
LocationCoordinates: 'as_location_coordinates',
|
|
114
95
|
|
|
115
96
|
// ============ Other Events ============
|
|
116
97
|
|
|
117
|
-
/**
|
|
98
|
+
/** Your order identifier, for matching purchases with your own records. */
|
|
118
99
|
OrderId: 'as_order_id',
|
|
119
100
|
|
|
120
|
-
/**
|
|
101
|
+
/** Segment the user belongs to, for audience reporting. */
|
|
121
102
|
CustomerSegment: 'as_customer_segment',
|
|
122
103
|
} as const;
|
|
123
104
|
|
|
124
|
-
/**
|
|
125
|
-
* Type representing all predefined event type values.
|
|
126
|
-
*/
|
|
127
105
|
export type AdshiftEventTypeValue =
|
|
128
106
|
(typeof AdshiftEventType)[keyof typeof AdshiftEventType];
|
|
129
107
|
|
|
130
108
|
/**
|
|
131
109
|
* Returns all predefined event types as an array.
|
|
132
110
|
*/
|
|
133
|
-
export function getAllEventTypes():
|
|
111
|
+
export function getAllEventTypes(): AdshiftEventTypeValue[] {
|
|
134
112
|
return Object.values(AdshiftEventType);
|
|
135
113
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export interface AdshiftThirdPartySharing {
|
|
28
|
+
/** `true` withholds this user's data from advertising partners. */
|
|
29
|
+
optOut: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Helper functions for creating `AdshiftThirdPartySharing` objects.
|
|
34
|
+
*/
|
|
35
|
+
export const AdshiftThirdPartySharing = {
|
|
36
|
+
/** The user asked not to have their data passed on. */
|
|
37
|
+
optedOut(): AdshiftThirdPartySharing {
|
|
38
|
+
return { optOut: true };
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
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.
|
|
48
|
+
*/
|
|
49
|
+
allowed(): AdshiftThirdPartySharing {
|
|
50
|
+
return { optOut: false };
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Converts `AdshiftThirdPartySharing` to a plain object for the native bridge.
|
|
56
|
+
*
|
|
57
|
+
* @internal
|
|
58
|
+
*/
|
|
59
|
+
export function thirdPartySharingToMap(
|
|
60
|
+
sharing: AdshiftThirdPartySharing
|
|
61
|
+
): Record<string, boolean> {
|
|
62
|
+
return { optOut: sharing.optOut === true };
|
|
63
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export type { AdshiftConfig } from './AdshiftConfig';
|
|
2
|
+
export { configToMap } from './AdshiftConfig';
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
4
|
+
export type { ConsentFlag } from './AdshiftConsent';
|
|
5
|
+
export { AdshiftConsent, consentToMap } from './AdshiftConsent';
|
|
6
|
+
|
|
7
|
+
export type { ConsentSnapshot, ConsentSource } from './AdshiftConsentSnapshot';
|
|
8
|
+
export { consentSnapshotFromMap } from './AdshiftConsentSnapshot';
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
AdshiftThirdPartySharing,
|
|
12
|
+
thirdPartySharingToMap,
|
|
13
|
+
} from './AdshiftThirdPartySharing';
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
AdshiftDeepLinkStatus,
|
|
17
|
+
AdshiftDeepLink,
|
|
18
|
+
deepLinkToMap,
|
|
19
|
+
} from './AdshiftDeepLink';
|
|
20
|
+
|
|
21
|
+
export { AdshiftEventType, getAllEventTypes } from './AdshiftEventType';
|
|
22
|
+
export type { AdshiftEventTypeValue } from './AdshiftEventType';
|
|
23
|
+
|
|
24
|
+
export { AdshiftEventParam, getAllEventParams } from './AdshiftEventParam';
|
|
25
|
+
export type { AdshiftEventParamValue } from './AdshiftEventParam';
|
|
26
|
+
|
|
27
|
+
export { AdshiftMediationNetwork } from './AdshiftAdRevenue';
|
|
28
|
+
export type {
|
|
29
|
+
AdshiftMediationNetworkValue,
|
|
30
|
+
AdRevenueParams,
|
|
31
|
+
} from './AdshiftAdRevenue';
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
AdshiftErrorCode,
|
|
35
|
+
isAdshiftError,
|
|
36
|
+
createAdshiftError,
|
|
37
|
+
toAdshiftError,
|
|
38
|
+
} from './AdshiftError';
|
|
39
|
+
export type { AdshiftError, AdshiftErrorInfo } from './AdshiftError';
|
package/src/version.ts
ADDED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AdShift SDK for React Native
|
|
3
|
-
*
|
|
4
|
-
* Main SDK interface providing type-safe access to native AdShift functionality.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { Adshift, AdshiftEventType } from '@adshift/react-native-plugin';
|
|
9
|
-
*
|
|
10
|
-
* // 1. Initialize
|
|
11
|
-
* Adshift.initialize({ apiKey: 'your-api-key', isDebug: true });
|
|
12
|
-
*
|
|
13
|
-
* // 2. Start tracking
|
|
14
|
-
* await Adshift.start();
|
|
15
|
-
*
|
|
16
|
-
* // 3. Track events
|
|
17
|
-
* await Adshift.trackEvent(AdshiftEventType.Purchase, { price: 9.99 });
|
|
18
|
-
*
|
|
19
|
-
* // 4. Listen for deep links
|
|
20
|
-
* const subscription = Adshift.onDeepLink((deepLink) => {
|
|
21
|
-
* console.log('Deep link received:', deepLink);
|
|
22
|
-
* });
|
|
23
|
-
* // Later: subscription.remove();
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
import type { AdshiftConfig, AdshiftConsent, AdshiftDeepLink } from './types';
|
|
27
|
-
/**
|
|
28
|
-
* Result returned from Adshift.start()
|
|
29
|
-
*/
|
|
30
|
-
export interface StartResult {
|
|
31
|
-
/** Whether start was successful */
|
|
32
|
-
success: boolean;
|
|
33
|
-
/** Optional message from native SDK */
|
|
34
|
-
message?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Values that can be passed to trackEvent
|
|
38
|
-
*/
|
|
39
|
-
export type EventValues = Record<string, string | number | boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Parameters for trackPurchase
|
|
42
|
-
*/
|
|
43
|
-
export interface PurchaseParams {
|
|
44
|
-
/** Product identifier */
|
|
45
|
-
productId: string;
|
|
46
|
-
/** Purchase amount (revenue) */
|
|
47
|
-
revenue: number;
|
|
48
|
-
/** ISO currency code (e.g., "USD") */
|
|
49
|
-
currency: string;
|
|
50
|
-
/** Transaction ID / purchase receipt token */
|
|
51
|
-
transactionId: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Subscription returned from onDeepLink
|
|
55
|
-
*/
|
|
56
|
-
export interface DeepLinkSubscription {
|
|
57
|
-
/** Removes the deep link listener */
|
|
58
|
-
remove(): void;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Callback for deep link events
|
|
62
|
-
*/
|
|
63
|
-
export type DeepLinkCallback = (deepLink: AdshiftDeepLink) => void;
|
|
64
|
-
/**
|
|
65
|
-
* AdShift SDK main interface.
|
|
66
|
-
*
|
|
67
|
-
* Provides type-safe access to all SDK functionality.
|
|
68
|
-
*/
|
|
69
|
-
export declare const Adshift: {
|
|
70
|
-
/**
|
|
71
|
-
* Initializes the SDK with configuration.
|
|
72
|
-
*
|
|
73
|
-
* Must be called before any other SDK methods.
|
|
74
|
-
* Call this early in your app's lifecycle (e.g., in App.tsx or index.js).
|
|
75
|
-
*
|
|
76
|
-
* @param config - SDK configuration
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* Adshift.initialize({
|
|
81
|
-
* apiKey: 'your-api-key',
|
|
82
|
-
* isDebug: __DEV__,
|
|
83
|
-
* // iOS only
|
|
84
|
-
* waitForATTBeforeStart: true,
|
|
85
|
-
* // Android only
|
|
86
|
-
* collectOaid: true,
|
|
87
|
-
* });
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
initialize(config: AdshiftConfig): void;
|
|
91
|
-
/**
|
|
92
|
-
* Starts the SDK.
|
|
93
|
-
*
|
|
94
|
-
* Validates API key, sends install event (if first launch), and begins tracking.
|
|
95
|
-
* Call this after initialize().
|
|
96
|
-
*
|
|
97
|
-
* @returns Promise resolving to start result
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* try {
|
|
102
|
-
* const result = await Adshift.start();
|
|
103
|
-
* console.log('SDK started:', result);
|
|
104
|
-
* } catch (error) {
|
|
105
|
-
* console.error('SDK start failed:', error);
|
|
106
|
-
* }
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
start(): Promise<StartResult>;
|
|
110
|
-
/**
|
|
111
|
-
* Stops the SDK.
|
|
112
|
-
*
|
|
113
|
-
* Pauses all tracking. Can be restarted with start().
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```typescript
|
|
117
|
-
* Adshift.stop();
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
stop(): void;
|
|
121
|
-
/**
|
|
122
|
-
* Checks if SDK is currently started.
|
|
123
|
-
*
|
|
124
|
-
* @returns true if SDK is running
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* if (Adshift.isStarted()) {
|
|
129
|
-
* // SDK is tracking
|
|
130
|
-
* }
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
isStarted(): boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Sets custom user identifier for attribution.
|
|
136
|
-
*
|
|
137
|
-
* Associate events with your own user ID. Can be called before or after start().
|
|
138
|
-
*
|
|
139
|
-
* @param userId - Your user identifier
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```typescript
|
|
143
|
-
* Adshift.setCustomerUserId('user_123');
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
setCustomerUserId(userId: string): void;
|
|
147
|
-
/**
|
|
148
|
-
* Enables/disables debug logging at runtime.
|
|
149
|
-
*
|
|
150
|
-
* Note: Can also be set via config.isDebug during initialize().
|
|
151
|
-
*
|
|
152
|
-
* @param enabled - true to enable debug logs
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```typescript
|
|
156
|
-
* // Enable debug in production for troubleshooting
|
|
157
|
-
* Adshift.setDebugEnabled(true);
|
|
158
|
-
* ```
|
|
159
|
-
*/
|
|
160
|
-
setDebugEnabled(enabled: boolean): void;
|
|
161
|
-
/**
|
|
162
|
-
* Sets app open debounce time in milliseconds.
|
|
163
|
-
*
|
|
164
|
-
* Used to deduplicate rapid app open events.
|
|
165
|
-
* Note: Can also be set via config.appOpenDebounceMs during initialize().
|
|
166
|
-
*
|
|
167
|
-
* @param ms - Debounce time in milliseconds (e.g., 5000 for 5 seconds)
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```typescript
|
|
171
|
-
* Adshift.setAppOpenDebounceMs(5000);
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
setAppOpenDebounceMs(ms: number): void;
|
|
175
|
-
/**
|
|
176
|
-
* Sets user consent data manually.
|
|
177
|
-
*
|
|
178
|
-
* Use this for manual consent collection (not CMP).
|
|
179
|
-
* Use AdshiftConsent.forGDPRUser() or AdshiftConsent.forNonGDPRUser() helpers.
|
|
180
|
-
*
|
|
181
|
-
* @param consent - Consent data
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```typescript
|
|
185
|
-
* // GDPR user who accepted all
|
|
186
|
-
* Adshift.setConsentData(
|
|
187
|
-
* AdshiftConsent.forGDPRUser({
|
|
188
|
-
* hasConsentForDataUsage: true,
|
|
189
|
-
* hasConsentForAdsPersonalization: true,
|
|
190
|
-
* hasConsentForAdStorage: true,
|
|
191
|
-
* })
|
|
192
|
-
* );
|
|
193
|
-
*
|
|
194
|
-
* // Non-GDPR user
|
|
195
|
-
* Adshift.setConsentData(AdshiftConsent.forNonGDPRUser());
|
|
196
|
-
* ```
|
|
197
|
-
*/
|
|
198
|
-
setConsentData(consent: AdshiftConsent): void;
|
|
199
|
-
/**
|
|
200
|
-
* Enables/disables automatic TCF v2.2 data collection from CMP.
|
|
201
|
-
*
|
|
202
|
-
* When enabled, SDK reads IAB TCF consent strings from device storage
|
|
203
|
-
* (set by CMPs like Google Funding Choices, Didomi, etc.)
|
|
204
|
-
*
|
|
205
|
-
* Call this BEFORE start().
|
|
206
|
-
*
|
|
207
|
-
* @param enabled - true to enable TCF collection
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* ```typescript
|
|
211
|
-
* Adshift.enableTCFDataCollection(true);
|
|
212
|
-
* await Adshift.start();
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
|
-
enableTCFDataCollection(enabled: boolean): void;
|
|
216
|
-
/**
|
|
217
|
-
* Refreshes consent state from TCF/CMP or manual sources.
|
|
218
|
-
*
|
|
219
|
-
* Call this after CMP dialog closes to pick up updated consent.
|
|
220
|
-
* Priority: Manual > TCF > None
|
|
221
|
-
*
|
|
222
|
-
* @returns Promise resolving to consent snapshot
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* ```typescript
|
|
226
|
-
* // After CMP dialog closes
|
|
227
|
-
* const snapshot = await Adshift.refreshConsent();
|
|
228
|
-
* console.log('Consent source:', snapshot.source);
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
refreshConsent(): Promise<Record<string, unknown>>;
|
|
232
|
-
/**
|
|
233
|
-
* Tracks an in-app event.
|
|
234
|
-
*
|
|
235
|
-
* Use AdshiftEventType constants for predefined events, or custom strings.
|
|
236
|
-
* Events are queued until SDK is started.
|
|
237
|
-
*
|
|
238
|
-
* @param eventName - Event name (use AdshiftEventType or custom string)
|
|
239
|
-
* @param values - Optional event parameters
|
|
240
|
-
* @returns Promise resolving on success
|
|
241
|
-
*
|
|
242
|
-
* @example
|
|
243
|
-
* ```typescript
|
|
244
|
-
* // Predefined event
|
|
245
|
-
* await Adshift.trackEvent(AdshiftEventType.AddToCart, {
|
|
246
|
-
* product_id: 'SKU123',
|
|
247
|
-
* price: 29.99,
|
|
248
|
-
* });
|
|
249
|
-
*
|
|
250
|
-
* // Custom event
|
|
251
|
-
* await Adshift.trackEvent('custom_event', { key: 'value' });
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
trackEvent(eventName: string, values?: EventValues): Promise<void>;
|
|
255
|
-
/**
|
|
256
|
-
* Tracks a purchase event.
|
|
257
|
-
*
|
|
258
|
-
* Use for revenue tracking and SKAdNetwork conversion value calculation.
|
|
259
|
-
*
|
|
260
|
-
* @param params - Purchase parameters
|
|
261
|
-
* @returns Promise resolving on success
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* ```typescript
|
|
265
|
-
* await Adshift.trackPurchase({
|
|
266
|
-
* productId: 'premium_subscription',
|
|
267
|
-
* revenue: 9.99,
|
|
268
|
-
* currency: 'USD',
|
|
269
|
-
* transactionId: 'TXN_123456',
|
|
270
|
-
* });
|
|
271
|
-
* ```
|
|
272
|
-
*/
|
|
273
|
-
trackPurchase(params: PurchaseParams): Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
* Handles a deep link URL.
|
|
276
|
-
*
|
|
277
|
-
* Call this when your app receives a deep link (e.g., from Linking API).
|
|
278
|
-
* Extracts campaign parameters for attribution.
|
|
279
|
-
*
|
|
280
|
-
* @param url - Deep link URL string
|
|
281
|
-
* @returns Promise resolving to deep link response
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* ```typescript
|
|
285
|
-
* import { Linking } from 'react-native';
|
|
286
|
-
*
|
|
287
|
-
* Linking.addEventListener('url', async ({ url }) => {
|
|
288
|
-
* const deepLink = await Adshift.handleDeepLink(url);
|
|
289
|
-
* if (deepLink.status === AdshiftDeepLinkStatus.Found) {
|
|
290
|
-
* // Navigate based on deepLink.params
|
|
291
|
-
* }
|
|
292
|
-
* });
|
|
293
|
-
* ```
|
|
294
|
-
*/
|
|
295
|
-
handleDeepLink(url: string): Promise<AdshiftDeepLink>;
|
|
296
|
-
/**
|
|
297
|
-
* Registers a listener for deep link events.
|
|
298
|
-
*
|
|
299
|
-
* Called when:
|
|
300
|
-
* - Deferred deep links are resolved (after first install)
|
|
301
|
-
* - App links are received while app is running
|
|
302
|
-
*
|
|
303
|
-
* If a deep link was received before listener was set (cold start),
|
|
304
|
-
* the callback is called immediately with the cached deep link.
|
|
305
|
-
*
|
|
306
|
-
* @param callback - Function called when deep link is received
|
|
307
|
-
* @returns Subscription object with remove() method
|
|
308
|
-
*
|
|
309
|
-
* @example
|
|
310
|
-
* ```typescript
|
|
311
|
-
* useEffect(() => {
|
|
312
|
-
* const subscription = Adshift.onDeepLink((deepLink) => {
|
|
313
|
-
* if (deepLink.status === AdshiftDeepLinkStatus.Found) {
|
|
314
|
-
* console.log('Deep link:', deepLink.deepLink);
|
|
315
|
-
* console.log('Params:', deepLink.params);
|
|
316
|
-
* // Navigate to appropriate screen
|
|
317
|
-
* }
|
|
318
|
-
* });
|
|
319
|
-
*
|
|
320
|
-
* return () => subscription.remove();
|
|
321
|
-
* }, []);
|
|
322
|
-
* ```
|
|
323
|
-
*/
|
|
324
|
-
onDeepLink(callback: DeepLinkCallback): DeepLinkSubscription;
|
|
325
|
-
/**
|
|
326
|
-
* Returns SDK version and platform info.
|
|
327
|
-
* Useful for debugging.
|
|
328
|
-
*/
|
|
329
|
-
getInfo(): {
|
|
330
|
-
platform: string;
|
|
331
|
-
version: string;
|
|
332
|
-
};
|
|
333
|
-
};
|
|
334
|
-
export default Adshift;
|
|
335
|
-
//# sourceMappingURL=Adshift.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Adshift.d.ts","sourceRoot":"","sources":["../../../src/Adshift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAS9E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;AA0BnE;;;;GAIG;AACH,eAAO,MAAM,OAAO;IAGlB;;;;;;;;;;;;;;;;;;;OAmBG;uBACgB,aAAa,GAAG,IAAI;IAUvC;;;;;;;;;;;;;;;;;OAiBG;aACY,OAAO,CAAC,WAAW,CAAC;IAqBnC;;;;;;;;;OASG;YACK,IAAI;IAKZ;;;;;;;;;;;OAWG;iBACU,OAAO;IAOpB;;;;;;;;;;;OAWG;8BACuB,MAAM,GAAG,IAAI;IAUvC;;;;;;;;;;;;OAYG;6BACsB,OAAO,GAAG,IAAI;IAKvC;;;;;;;;;;;;OAYG;6BACsB,MAAM,GAAG,IAAI;IAYtC;;;;;;;;;;;;;;;;;;;;;;OAsBG;4BACqB,cAAc,GAAG,IAAI;IAM7C;;;;;;;;;;;;;;;OAeG;qCAC8B,OAAO,GAAG,IAAI;IAK/C;;;;;;;;;;;;;;OAcG;sBACqB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAYxD;;;;;;;;;;;;;;;;;;;;;OAqBG;0BACyB,MAAM,WAAW,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAUxE;;;;;;;;;;;;;;;;;OAiBG;0BACyB,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA6B1D;;;;;;;;;;;;;;;;;;;;OAoBG;wBACuB,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAkB3D;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;yBACkB,gBAAgB,GAAG,oBAAoB;IAwB5D;;;OAGG;eACQ;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAMjD,CAAC;AAEF,eAAe,OAAO,CAAC"}
|