@posted-sdk/react-native 1.0.1 → 1.0.3
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/README.md +8 -41
- package/android/build.gradle +24 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/postedsdk/PostedSdkModule.java +54 -0
- package/android/src/main/java/com/postedsdk/PostedSdkPackage.java +25 -0
- package/ios/PostedSdk.m +36 -0
- package/lib/module/reportInstall.js +5 -0
- package/lib/module/reportInstall.js.map +1 -1
- package/lib/module/utils/installSource.js +14 -0
- package/lib/module/utils/installSource.js.map +1 -0
- package/lib/module/utils/optionalModules.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/reportInstall.d.ts.map +1 -1
- package/lib/typescript/src/utils/installSource.d.ts +7 -0
- package/lib/typescript/src/utils/installSource.d.ts.map +1 -0
- package/lib/typescript/src/utils/optionalModules.d.ts +1 -0
- package/lib/typescript/src/utils/optionalModules.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +2 -2
- package/package.json +5 -1
- package/react-native-posted-sdk.podspec +16 -0
- package/src/reportInstall.ts +3 -0
- package/src/utils/installSource.ts +15 -0
- package/src/utils/optionalModules.ts +1 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# posted-sdk React Native
|
|
2
2
|
|
|
3
|
-
`@posted-sdk/react-native` reports app installs to Posted.
|
|
3
|
+
`@posted-sdk/react-native` reports app installs to Posted. Posted attributes each install to your ad campaign and reports the conversion to the ad network.
|
|
4
4
|
|
|
5
5
|
The SDK has one function, `reportInstall()`. Call it on every app launch. It sends the report once per install.
|
|
6
6
|
|
|
@@ -12,8 +12,7 @@ The SDK reports installs only. It does not report purchases, signups or other in
|
|
|
12
12
|
- [2. Report the install](#2-report-the-install)
|
|
13
13
|
- [3. Verify the integration](#3-verify-the-integration)
|
|
14
14
|
- [Configuration](#configuration)
|
|
15
|
-
- [
|
|
16
|
-
- [Privacy and App Store](#privacy-and-app-store)
|
|
15
|
+
- [Privacy](#privacy)
|
|
17
16
|
- [Troubleshooting](#troubleshooting)
|
|
18
17
|
- [Support](#support)
|
|
19
18
|
|
|
@@ -34,11 +33,9 @@ Pass these as `appID` and `apiKey` to `reportInstall()`. One API key works for a
|
|
|
34
33
|
## 1. Install
|
|
35
34
|
|
|
36
35
|
```sh
|
|
37
|
-
npm install @posted-sdk/react-native@^1.0.
|
|
36
|
+
npm install @posted-sdk/react-native@^1.0.2
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
The SDK reads device data through packages your app may already have. These are optional peer dependencies, so install the ones that match your project.
|
|
41
|
-
|
|
42
39
|
### Expo
|
|
43
40
|
|
|
44
41
|
```sh
|
|
@@ -56,16 +53,6 @@ cd ios && pod install
|
|
|
56
53
|
|
|
57
54
|
Then rebuild the native app.
|
|
58
55
|
|
|
59
|
-
### What each package is for
|
|
60
|
-
|
|
61
|
-
| Package | Used for | If missing |
|
|
62
|
-
| ---------------------------------------------------- | ------------------------------------------------- | ----------------------------------------------------------- |
|
|
63
|
-
| `expo-device` **or** `react-native-device-info` | Device model, manufacturer, OS version | **Required.** The install isn't reported. |
|
|
64
|
-
| `@react-native-async-storage/async-storage` | Remembering that the install was reported | Required unless you pass your own `storage`. |
|
|
65
|
-
| `expo-application` **or** `react-native-device-info` | Android Play install referrer (exact click match) | Android installs are matched without the referrer click ID. |
|
|
66
|
-
| `expo-constants` **or** `react-native-device-info` | User agent | User agent is sent as `unknown`. |
|
|
67
|
-
| `expo-localization` | Locale and timezone | Read from `Intl` instead. |
|
|
68
|
-
|
|
69
56
|
## 2. Report the install
|
|
70
57
|
|
|
71
58
|
Call `reportInstall()` once per launch, as early as possible: in your entry file, or in your root component.
|
|
@@ -84,7 +71,7 @@ You don't need to `await` it. It never throws, and it doesn't block app startup.
|
|
|
84
71
|
|
|
85
72
|
## 3. Verify the integration
|
|
86
73
|
|
|
87
|
-
1. Use a **real device** and a build installed from the App Store, TestFlight or Google Play (internal testing is fine). Simulators, emulators and Expo Go are not
|
|
74
|
+
1. Use a **real device** and a build installed from the App Store, TestFlight or Google Play (internal testing is fine). Simulators, emulators and Expo Go are not attributed.
|
|
88
75
|
2. Run the app with a **fresh install**. Uninstalling clears the SDK's storage, so a reinstall reports again.
|
|
89
76
|
3. Watch the logs. Nothing is logged on success. On failure, you'll see a line starting with `🔗[Posted:INSTALL_ERROR]` (see [Troubleshooting](#troubleshooting)).
|
|
90
77
|
|
|
@@ -132,30 +119,10 @@ reportInstall({
|
|
|
132
119
|
|
|
133
120
|
The SDK stores two keys, both prefixed with `Posted_`: the "install reported" flag and a device ID. If storage is cleared, the install is reported again.
|
|
134
121
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
| Field | Source |
|
|
140
|
-
| ---------------------------------------- | ------------------------------------------------------------------------------- |
|
|
141
|
-
| `platform` | `ios` or `android` |
|
|
142
|
-
| `model`, `manufacturer`, `systemVersion` | `expo-device` or `react-native-device-info` |
|
|
143
|
-
| `screenWidth`, `screenHeight`, `scale` | `Dimensions` and `PixelRatio` |
|
|
144
|
-
| `locale`, `timezone` | `expo-localization`, or `Intl` when it isn't installed |
|
|
145
|
-
| `userAgent` | `expo-constants` or `react-native-device-info`, `unknown` when neither is there |
|
|
146
|
-
| `timestamp` | Current time in milliseconds |
|
|
147
|
-
| `device_id` | A random UUID generated once per install and kept in storage |
|
|
148
|
-
| `clickId` | Android only: `click_id` from the Play install referrer, when present |
|
|
149
|
-
|
|
150
|
-
## Privacy and App Store
|
|
151
|
-
|
|
152
|
-
- **No tracking.** The SDK does not perform tracking as defined by Apple's App Tracking Transparency framework. It does not collect the IDFA or the Android advertising ID, does not link install data with data from other companies' apps or websites, and does not share data with data brokers. No ATT prompt is required.
|
|
153
|
-
- **No clipboard access.** The SDK never reads the clipboard.
|
|
154
|
-
- **`device_id`** is a random UUID generated once per install. It is not linked to a person and is not shared across apps.
|
|
155
|
-
- **Privacy manifest.** The SDK has no native code and calls no required-reason API itself. Device data comes from `expo-device`, `expo-application`, `react-native-device-info` and AsyncStorage, which ship their own `PrivacyInfo.xcprivacy`.
|
|
156
|
-
- **App Store privacy labels.** In App Store Connect, declare **Device ID** (Identifiers) and **Other diagnostic data** (Diagnostics) as collected for Analytics, not linked to the user, not used for tracking. The SDK collects nothing under Location, Contact info, Purchases or Usage data.
|
|
157
|
-
- **SKAdNetwork.** The SDK does not use SKAdNetwork and does not conflict with it.
|
|
158
|
-
- **Android.** The Play install referrer is read once, on the first launch. In the Play Data safety form, declare **Device or other IDs** as collected, not shared, used for Analytics.
|
|
122
|
+
|
|
123
|
+
## Privacy
|
|
124
|
+
|
|
125
|
+
The SDK does not use the IDFA or the Android advertising ID, does not read the clipboard, and requires no App Tracking Transparency prompt.
|
|
159
126
|
|
|
160
127
|
## Troubleshooting
|
|
161
128
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
apply plugin: "com.android.library"
|
|
2
|
+
|
|
3
|
+
def safeExtGet(prop, fallback) {
|
|
4
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
android {
|
|
8
|
+
namespace "com.postedsdk"
|
|
9
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
10
|
+
|
|
11
|
+
defaultConfig {
|
|
12
|
+
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
13
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
repositories {
|
|
18
|
+
google()
|
|
19
|
+
mavenCentral()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependencies {
|
|
23
|
+
implementation "com.facebook.react:react-native:+"
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
package com.postedsdk;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.content.pm.ApplicationInfo;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.os.Build;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.NonNull;
|
|
9
|
+
import androidx.annotation.Nullable;
|
|
10
|
+
|
|
11
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
12
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
13
|
+
|
|
14
|
+
import java.util.HashMap;
|
|
15
|
+
import java.util.Map;
|
|
16
|
+
|
|
17
|
+
public class PostedSdkModule extends ReactContextBaseJavaModule {
|
|
18
|
+
PostedSdkModule(ReactApplicationContext context) {
|
|
19
|
+
super(context);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@NonNull
|
|
23
|
+
@Override
|
|
24
|
+
public String getName() {
|
|
25
|
+
return "PostedSdk";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Override
|
|
29
|
+
public Map<String, Object> getConstants() {
|
|
30
|
+
Map<String, Object> constants = new HashMap<>();
|
|
31
|
+
String installSource = installSource();
|
|
32
|
+
if (installSource != null) constants.put("installSource", installSource);
|
|
33
|
+
return constants;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Nullable
|
|
37
|
+
private String installSource() {
|
|
38
|
+
Context context = getReactApplicationContext();
|
|
39
|
+
if ((context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
|
40
|
+
return "development";
|
|
41
|
+
}
|
|
42
|
+
String installer;
|
|
43
|
+
try {
|
|
44
|
+
PackageManager packageManager = context.getPackageManager();
|
|
45
|
+
String packageName = context.getPackageName();
|
|
46
|
+
installer = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
|
|
47
|
+
? packageManager.getInstallSourceInfo(packageName).getInstallingPackageName()
|
|
48
|
+
: packageManager.getInstallerPackageName(packageName);
|
|
49
|
+
} catch (Exception e) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return "com.android.vending".equals(installer) ? "store" : "development";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
package com.postedsdk;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.ReactPackage;
|
|
6
|
+
import com.facebook.react.bridge.NativeModule;
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
+
|
|
10
|
+
import java.util.Collections;
|
|
11
|
+
import java.util.List;
|
|
12
|
+
|
|
13
|
+
public class PostedSdkPackage implements ReactPackage {
|
|
14
|
+
@NonNull
|
|
15
|
+
@Override
|
|
16
|
+
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext context) {
|
|
17
|
+
return Collections.singletonList(new PostedSdkModule(context));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@NonNull
|
|
21
|
+
@Override
|
|
22
|
+
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext context) {
|
|
23
|
+
return Collections.emptyList();
|
|
24
|
+
}
|
|
25
|
+
}
|
package/ios/PostedSdk.m
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
|
|
3
|
+
@interface PostedSdk : NSObject <RCTBridgeModule>
|
|
4
|
+
@end
|
|
5
|
+
|
|
6
|
+
@implementation PostedSdk
|
|
7
|
+
|
|
8
|
+
RCT_EXPORT_MODULE()
|
|
9
|
+
|
|
10
|
+
+ (BOOL)requiresMainQueueSetup
|
|
11
|
+
{
|
|
12
|
+
return NO;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
- (NSDictionary *)constantsToExport
|
|
16
|
+
{
|
|
17
|
+
return @{@"installSource" : [self installSource]};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Development, ad hoc and enterprise builds embed a provisioning profile;
|
|
21
|
+
// TestFlight builds carry a sandbox receipt.
|
|
22
|
+
- (NSString *)installSource
|
|
23
|
+
{
|
|
24
|
+
#if TARGET_OS_SIMULATOR
|
|
25
|
+
return @"development";
|
|
26
|
+
#else
|
|
27
|
+
NSBundle *bundle = [NSBundle mainBundle];
|
|
28
|
+
if ([bundle pathForResource:@"embedded" ofType:@"mobileprovision"] ||
|
|
29
|
+
[bundle.appStoreReceiptURL.lastPathComponent isEqualToString:@"sandboxReceipt"]) {
|
|
30
|
+
return @"development";
|
|
31
|
+
}
|
|
32
|
+
return @"store";
|
|
33
|
+
#endif
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { prepareDeviceIdForApi } from "./utils/deviceId.js";
|
|
4
4
|
import { getInstallContext } from "./utils/installContext.js";
|
|
5
5
|
import { getInstallReferrerClickId } from "./utils/installReferrer.js";
|
|
6
|
+
import { getInstallSource } from "./utils/installSource.js";
|
|
6
7
|
import { StorageKeys, resolveStorage } from "./utils/storage.js";
|
|
7
8
|
import { SDK_HEADER_VALUE } from "./version.js";
|
|
8
9
|
const INSTALL_API_URL = "https://attr.postedapp.com/api/install";
|
|
@@ -21,6 +22,7 @@ const send = async ({
|
|
|
21
22
|
try {
|
|
22
23
|
const storage = resolveStorage(userStorage);
|
|
23
24
|
if (await storage.getItem(StorageKeys.INSTALL_REPORTED_FLAG_KEY)) return;
|
|
25
|
+
const installSource = getInstallSource();
|
|
24
26
|
const [clickId, installContext, deviceId] = await Promise.all([getInstallReferrerClickId(), getInstallContext(), prepareDeviceIdForApi(storage)]);
|
|
25
27
|
const response = await fetch(INSTALL_API_URL, {
|
|
26
28
|
method: "POST",
|
|
@@ -35,6 +37,9 @@ const send = async ({
|
|
|
35
37
|
device_id: deviceId,
|
|
36
38
|
...(clickId ? {
|
|
37
39
|
clickId
|
|
40
|
+
} : {}),
|
|
41
|
+
...(installSource ? {
|
|
42
|
+
installSource
|
|
38
43
|
} : {})
|
|
39
44
|
})
|
|
40
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareDeviceIdForApi","getInstallContext","getInstallReferrerClickId","StorageKeys","resolveStorage","SDK_HEADER_VALUE","INSTALL_API_URL","inFlight","reportInstall","config","send","finally","apiKey","appID","storage","userStorage","getItem","INSTALL_REPORTED_FLAG_KEY","clickId","installContext","deviceId","Promise","all","response","fetch","method","headers","Authorization","body","JSON","stringify","device_id","ok","console","warn","status","setItem","error"],"sourceRoot":"../../src","sources":["reportInstall.ts"],"mappings":";;AACA,SAASA,qBAAqB,QAAQ,qBAAkB;AACxD,SAASC,iBAAiB,QAAQ,2BAAwB;AAC1D,SAASC,yBAAyB,QAAQ,4BAAyB;AACnE,SAASC,WAAW,EAAEC,cAAc,QAAQ,oBAAiB;AAC7D,SAASC,gBAAgB,QAAQ,cAAW;AAE5C,MAAMC,eAAe,GAAG,wCAAwC;AAEhE,IAAIC,QAA8B,GAAG,IAAI;AAEzC,OAAO,MAAMC,aAAa,GAAIC,MAAc,IAAoB;EAC9DF,QAAQ,KAAKG,IAAI,CAACD,MAAM,CAAC,CAACE,OAAO,CAAC,MAAM;IACtCJ,QAAQ,GAAG,IAAI;EACjB,CAAC,CAAC;EACF,OAAOA,QAAQ;AACjB,CAAC;AAED,MAAMG,IAAI,GAAG,MAAAA,CAAO;EAAEE,MAAM;EAAEC,KAAK;EAAEC,OAAO,EAAEC;AAAoB,CAAC,KAAK;EACtE,IAAI;IACF,MAAMD,OAAO,GAAGV,cAAc,CAACW,WAAW,CAAC;IAC3C,IAAI,MAAMD,OAAO,CAACE,OAAO,CAACb,WAAW,CAACc,yBAAyB,CAAC,EAAE;IAElE,MAAM,
|
|
1
|
+
{"version":3,"names":["prepareDeviceIdForApi","getInstallContext","getInstallReferrerClickId","getInstallSource","StorageKeys","resolveStorage","SDK_HEADER_VALUE","INSTALL_API_URL","inFlight","reportInstall","config","send","finally","apiKey","appID","storage","userStorage","getItem","INSTALL_REPORTED_FLAG_KEY","installSource","clickId","installContext","deviceId","Promise","all","response","fetch","method","headers","Authorization","body","JSON","stringify","device_id","ok","console","warn","status","setItem","error"],"sourceRoot":"../../src","sources":["reportInstall.ts"],"mappings":";;AACA,SAASA,qBAAqB,QAAQ,qBAAkB;AACxD,SAASC,iBAAiB,QAAQ,2BAAwB;AAC1D,SAASC,yBAAyB,QAAQ,4BAAyB;AACnE,SAASC,gBAAgB,QAAQ,0BAAuB;AACxD,SAASC,WAAW,EAAEC,cAAc,QAAQ,oBAAiB;AAC7D,SAASC,gBAAgB,QAAQ,cAAW;AAE5C,MAAMC,eAAe,GAAG,wCAAwC;AAEhE,IAAIC,QAA8B,GAAG,IAAI;AAEzC,OAAO,MAAMC,aAAa,GAAIC,MAAc,IAAoB;EAC9DF,QAAQ,KAAKG,IAAI,CAACD,MAAM,CAAC,CAACE,OAAO,CAAC,MAAM;IACtCJ,QAAQ,GAAG,IAAI;EACjB,CAAC,CAAC;EACF,OAAOA,QAAQ;AACjB,CAAC;AAED,MAAMG,IAAI,GAAG,MAAAA,CAAO;EAAEE,MAAM;EAAEC,KAAK;EAAEC,OAAO,EAAEC;AAAoB,CAAC,KAAK;EACtE,IAAI;IACF,MAAMD,OAAO,GAAGV,cAAc,CAACW,WAAW,CAAC;IAC3C,IAAI,MAAMD,OAAO,CAACE,OAAO,CAACb,WAAW,CAACc,yBAAyB,CAAC,EAAE;IAElE,MAAMC,aAAa,GAAGhB,gBAAgB,CAAC,CAAC;IACxC,MAAM,CAACiB,OAAO,EAAEC,cAAc,EAAEC,QAAQ,CAAC,GAAG,MAAMC,OAAO,CAACC,GAAG,CAAC,CAC5DtB,yBAAyB,CAAC,CAAC,EAC3BD,iBAAiB,CAAC,CAAC,EACnBD,qBAAqB,CAACe,OAAO,CAAC,CAC/B,CAAC;IAEF,MAAMU,QAAQ,GAAG,MAAMC,KAAK,CAACnB,eAAe,EAAE;MAC5CoB,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE,kBAAkB;QAClCC,aAAa,EAAE,UAAUhB,MAAM,EAAE;QACjC,UAAU,EAAEC,KAAK;QACjB,OAAO,EAAER;MACX,CAAC;MACDwB,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACnB,GAAGX,cAAc;QACjBY,SAAS,EAAEX,QAAQ;QACnB,IAAIF,OAAO,GAAG;UAAEA;QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,IAAID,aAAa,GAAG;UAAEA;QAAc,CAAC,GAAG,CAAC,CAAC;MAC5C,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAACM,QAAQ,CAACS,EAAE,EAAE;MAChBC,OAAO,CAACC,IAAI,CAAC,sDAAsDX,QAAQ,CAACY,MAAM,EAAE,CAAC;MACrF;IACF;IACA,MAAMtB,OAAO,CAACuB,OAAO,CAAClC,WAAW,CAACc,yBAAyB,EAAE,MAAM,CAAC;EACtE,CAAC,CAAC,OAAOqB,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mDAAmD,EAAEA,KAAK,CAAC;EAC3E;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeModules } from "react-native";
|
|
4
|
+
import { expoConstants } from "./optionalModules.js";
|
|
5
|
+
/**
|
|
6
|
+
* Whether this build came from the App Store / Google Play. Null when the
|
|
7
|
+
* native module isn't linked, e.g. new JS shipped over the air to an older binary.
|
|
8
|
+
*/
|
|
9
|
+
export const getInstallSource = () => {
|
|
10
|
+
if (__DEV__ || expoConstants?.executionEnvironment === "storeClient") return "development";
|
|
11
|
+
const source = NativeModules?.PostedSdk?.installSource;
|
|
12
|
+
return source === "store" || source === "development" ? source : null;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=installSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","expoConstants","getInstallSource","__DEV__","executionEnvironment","source","PostedSdk","installSource"],"sourceRoot":"../../../src","sources":["utils/installSource.ts"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,SAASC,aAAa,QAAQ,sBAAmB;AAIjD;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAA4B;EAC1D,IAAIC,OAAO,IAAIF,aAAa,EAAEG,oBAAoB,KAAK,aAAa,EAAE,OAAO,aAAa;EAC1F,MAAMC,MAAe,GAAGL,aAAa,EAAEM,SAAS,EAAEC,aAAa;EAC/D,OAAOF,MAAM,KAAK,OAAO,IAAIA,MAAM,KAAK,aAAa,GAAGA,MAAM,GAAG,IAAI;AACvE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["expoDevice","require","reactNativeDeviceInfo","module","default","expoConstants","expoLocalization","expoApplication"],"sourceRoot":"../../../src","sources":["utils/optionalModules.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["expoDevice","require","reactNativeDeviceInfo","module","default","expoConstants","expoLocalization","expoApplication"],"sourceRoot":"../../../src","sources":["utils/optionalModules.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+BA,OAAO,MAAMA,UAAU,GAAG,CAAC,MAAM;EAC/B,IAAI;IACF,OAAOC,OAAO,CAAC,aAAa,CAAC;EAC/B,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC;AAEJ,OAAO,MAAMC,qBAAqB,GAAG,CAAC,MAAM;EAC1C,IAAI;IACF,MAAMC,MAAM,GAAGF,OAAO,CAAC,0BAA0B,CAAC;IAClD,OAAQE,MAAM,CAACC,OAAO,IAAID,MAAM;EAClC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC;AAEJ,OAAO,MAAME,aAAa,GAAG,CAAC,MAAM;EAClC,IAAI;IACF,MAAMF,MAAM,GAAGF,OAAO,CAAC,gBAAgB,CAAC;IACxC,OAAQE,MAAM,CAACC,OAAO,IAAID,MAAM;EAClC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC;AAEJ,OAAO,MAAMG,gBAAgB,GAAG,CAAC,MAAM;EACrC,IAAI;IACF,OAAOL,OAAO,CAAC,mBAAmB,CAAC;EACrC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC;AAEJ,OAAO,MAAMM,eAAe,GAAG,CAAC,MAAM;EACpC,IAAI;IACF,OAAON,OAAO,CAAC,kBAAkB,CAAC;EACpC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const version = "1.0.
|
|
3
|
+
export const version = "1.0.3"; // This line will is updated automatically by releasing script
|
|
4
4
|
export const SDK_HEADER_VALUE = `react-native/${version}`;
|
|
5
5
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reportInstall.d.ts","sourceRoot":"","sources":["../../../src/reportInstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"reportInstall.d.ts","sourceRoot":"","sources":["../../../src/reportInstall.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAYtC,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAK1D,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type InstallSource = "store" | "development";
|
|
2
|
+
/**
|
|
3
|
+
* Whether this build came from the App Store / Google Play. Null when the
|
|
4
|
+
* native module isn't linked, e.g. new JS shipped over the air to an older binary.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getInstallSource: () => InstallSource | null;
|
|
7
|
+
//# sourceMappingURL=installSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installSource.d.ts","sourceRoot":"","sources":["../../../../src/utils/installSource.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,aAAa,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,aAAa,GAAG,IAInD,CAAC"}
|
|
@@ -19,6 +19,7 @@ export type ReactNativeDeviceInfoModule = {
|
|
|
19
19
|
getInstallReferrer?: () => Promise<string>;
|
|
20
20
|
};
|
|
21
21
|
type ExpoConstantsModule = {
|
|
22
|
+
executionEnvironment?: string;
|
|
22
23
|
getWebViewUserAgentAsync?: () => Promise<string | null>;
|
|
23
24
|
};
|
|
24
25
|
type ExpoLocalizationModule = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optionalModules.d.ts","sourceRoot":"","sources":["../../../../src/utils/optionalModules.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,MAAM,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACzD,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,MAAM;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,YAAY,EAAE,MAAM;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CACpD,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,uBAAuB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,UAAU,yBAMnB,CAAC;AAEL,eAAO,MAAM,qBAAqB,oCAO9B,CAAC;AAEL,eAAO,MAAM,aAAa,4BAOtB,CAAC;AAEL,eAAO,MAAM,gBAAgB,+BAMzB,CAAC;AAEL,eAAO,MAAM,eAAe,8BAMxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"optionalModules.d.ts","sourceRoot":"","sources":["../../../../src/utils/optionalModules.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,MAAM,CAAC;IACnC,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACzD,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,UAAU,EAAE,MAAM;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,YAAY,EAAE,MAAM;QAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,EAAE,CAAC;CACpD,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,uBAAuB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,UAAU,yBAMnB,CAAC;AAEL,eAAO,MAAM,qBAAqB,oCAO9B,CAAC;AAEL,eAAO,MAAM,aAAa,4BAOtB,CAAC;AAEL,eAAO,MAAM,gBAAgB,+BAMzB,CAAC;AAEL,eAAO,MAAM,eAAe,8BAMxB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
2
|
-
export declare const SDK_HEADER_VALUE = "react-native/1.0.
|
|
1
|
+
export declare const version = "1.0.3";
|
|
2
|
+
export declare const SDK_HEADER_VALUE = "react-native/1.0.3";
|
|
3
3
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posted-sdk/react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Reports app installs to Posted for ad attribution. React Native package.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"src",
|
|
18
18
|
"lib",
|
|
19
|
+
"android",
|
|
20
|
+
"ios",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"!android/build",
|
|
19
23
|
"!**/__tests__",
|
|
20
24
|
"!**/__fixtures__",
|
|
21
25
|
"!**/__mocks__",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-posted-sdk"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.authors = package["author"]
|
|
11
|
+
s.platforms = { :ios => "13.4" }
|
|
12
|
+
s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
|
|
13
|
+
s.source_files = "ios/**/*.{h,m}"
|
|
14
|
+
|
|
15
|
+
s.dependency "React-Core"
|
|
16
|
+
end
|
package/src/reportInstall.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Config } from "./types";
|
|
|
2
2
|
import { prepareDeviceIdForApi } from "./utils/deviceId";
|
|
3
3
|
import { getInstallContext } from "./utils/installContext";
|
|
4
4
|
import { getInstallReferrerClickId } from "./utils/installReferrer";
|
|
5
|
+
import { getInstallSource } from "./utils/installSource";
|
|
5
6
|
import { StorageKeys, resolveStorage } from "./utils/storage";
|
|
6
7
|
import { SDK_HEADER_VALUE } from "./version";
|
|
7
8
|
|
|
@@ -21,6 +22,7 @@ const send = async ({ apiKey, appID, storage: userStorage }: Config) => {
|
|
|
21
22
|
const storage = resolveStorage(userStorage);
|
|
22
23
|
if (await storage.getItem(StorageKeys.INSTALL_REPORTED_FLAG_KEY)) return;
|
|
23
24
|
|
|
25
|
+
const installSource = getInstallSource();
|
|
24
26
|
const [clickId, installContext, deviceId] = await Promise.all([
|
|
25
27
|
getInstallReferrerClickId(),
|
|
26
28
|
getInstallContext(),
|
|
@@ -39,6 +41,7 @@ const send = async ({ apiKey, appID, storage: userStorage }: Config) => {
|
|
|
39
41
|
...installContext,
|
|
40
42
|
device_id: deviceId,
|
|
41
43
|
...(clickId ? { clickId } : {}),
|
|
44
|
+
...(installSource ? { installSource } : {}),
|
|
42
45
|
}),
|
|
43
46
|
});
|
|
44
47
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NativeModules } from "react-native";
|
|
2
|
+
|
|
3
|
+
import { expoConstants } from "./optionalModules";
|
|
4
|
+
|
|
5
|
+
export type InstallSource = "store" | "development";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether this build came from the App Store / Google Play. Null when the
|
|
9
|
+
* native module isn't linked, e.g. new JS shipped over the air to an older binary.
|
|
10
|
+
*/
|
|
11
|
+
export const getInstallSource = (): InstallSource | null => {
|
|
12
|
+
if (__DEV__ || expoConstants?.executionEnvironment === "storeClient") return "development";
|
|
13
|
+
const source: unknown = NativeModules?.PostedSdk?.installSource;
|
|
14
|
+
return source === "store" || source === "development" ? source : null;
|
|
15
|
+
};
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
1
|
+
export const version = "1.0.3"; // This line will is updated automatically by releasing script
|
|
2
2
|
export const SDK_HEADER_VALUE = `react-native/${version}`;
|