@posted-sdk/react-native 1.0.0 → 1.0.1
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/LICENSE +21 -0
- package/README.md +49 -24
- package/lib/module/reportInstall.js +3 -3
- package/lib/module/reportInstall.js.map +1 -1
- package/lib/module/utils/{fingerprint.js → installContext.js} +2 -2
- package/lib/module/utils/installContext.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/utils/{fingerprint.d.ts → installContext.d.ts} +3 -3
- package/lib/typescript/src/utils/installContext.d.ts.map +1 -0
- package/lib/typescript/src/version.d.ts +2 -2
- package/package.json +5 -4
- package/src/reportInstall.ts +4 -4
- package/src/utils/{fingerprint.ts → installContext.ts} +2 -2
- package/src/version.ts +1 -1
- package/lib/module/utils/fingerprint.js.map +0 -1
- package/lib/typescript/src/utils/fingerprint.d.ts.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Posted
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# posted-sdk React Native
|
|
2
2
|
|
|
3
|
-
`@posted-sdk/react-native` reports app installs to
|
|
3
|
+
`@posted-sdk/react-native` reports app installs to Posted. The backend matches each install to the ad click that led to it and reports it back to the ad network as a conversion.
|
|
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
|
|
|
7
|
+
The SDK reports installs only. It does not report purchases, signups or other in-app events.
|
|
8
|
+
|
|
7
9
|
- [Requirements](#requirements)
|
|
10
|
+
- [Get your app ID and API key](#get-your-app-id-and-api-key)
|
|
8
11
|
- [1. Install](#1-install)
|
|
9
12
|
- [2. Report the install](#2-report-the-install)
|
|
10
13
|
- [3. Verify the integration](#3-verify-the-integration)
|
|
11
14
|
- [Configuration](#configuration)
|
|
12
15
|
- [Data collected](#data-collected)
|
|
16
|
+
- [Privacy and App Store](#privacy-and-app-store)
|
|
13
17
|
- [Troubleshooting](#troubleshooting)
|
|
14
18
|
- [Support](#support)
|
|
15
19
|
|
|
@@ -18,10 +22,19 @@ The SDK has one function, `reportInstall()`. Call it on every app launch. It sen
|
|
|
18
22
|
- React Native `>=0.72`
|
|
19
23
|
- Expo and bare React Native projects are both supported. Bare projects don't need Expo Modules.
|
|
20
24
|
|
|
25
|
+
## Get your app ID and API key
|
|
26
|
+
|
|
27
|
+
Both come from the Posted dashboard at [app.postedapp.com/dashboard/settings](https://app.postedapp.com/dashboard/settings), under **Posted SDK**.
|
|
28
|
+
|
|
29
|
+
1. Under **Apps**, click **Add app**, fill in the form and submit it. The dashboard generates the **app ID** (`app_…`) for the new app.
|
|
30
|
+
2. Under **API keys**, click **Create key**. Copy the key when it is shown; it is not displayed again.
|
|
31
|
+
|
|
32
|
+
Pass these as `appID` and `apiKey` to `reportInstall()`. One API key works for all apps in your account.
|
|
33
|
+
|
|
21
34
|
## 1. Install
|
|
22
35
|
|
|
23
36
|
```sh
|
|
24
|
-
npm install @posted-sdk/react-native
|
|
37
|
+
npm install @posted-sdk/react-native@^1.0.1
|
|
25
38
|
```
|
|
26
39
|
|
|
27
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.
|
|
@@ -45,13 +58,13 @@ Then rebuild the native app.
|
|
|
45
58
|
|
|
46
59
|
### What each package is for
|
|
47
60
|
|
|
48
|
-
| Package | Used for | If missing
|
|
49
|
-
| ---------------------------------------------------- | ------------------------------------------------- |
|
|
50
|
-
| `expo-device` **or** `react-native-device-info` | Device model, manufacturer, OS version | **Required.** The install isn't reported.
|
|
51
|
-
| `@react-native-async-storage/async-storage` | Remembering that the install was reported | Required unless you pass your own `storage`.
|
|
52
|
-
| `expo-application` **or** `react-native-device-info` | Android Play install referrer (exact click match) | Android installs are matched
|
|
53
|
-
| `expo-constants` **or** `react-native-device-info` | User agent | User agent is sent as `unknown`.
|
|
54
|
-
| `expo-localization` | Locale and timezone | Read from `Intl` instead.
|
|
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. |
|
|
55
68
|
|
|
56
69
|
## 2. Report the install
|
|
57
70
|
|
|
@@ -71,8 +84,9 @@ You don't need to `await` it. It never throws, and it doesn't block app startup.
|
|
|
71
84
|
|
|
72
85
|
## 3. Verify the integration
|
|
73
86
|
|
|
74
|
-
1.
|
|
75
|
-
2.
|
|
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 matched.
|
|
88
|
+
2. Run the app with a **fresh install**. Uninstalling clears the SDK's storage, so a reinstall reports again.
|
|
89
|
+
3. Watch the logs. Nothing is logged on success. On failure, you'll see a line starting with `🔗[Posted:INSTALL_ERROR]` (see [Troubleshooting](#troubleshooting)).
|
|
76
90
|
|
|
77
91
|
## Configuration
|
|
78
92
|
|
|
@@ -82,8 +96,8 @@ reportInstall(config: Config): Promise<void>
|
|
|
82
96
|
|
|
83
97
|
| Field | Type | Required | Description |
|
|
84
98
|
| --------- | --------------- | -------- | -------------------------------------------------------------------------------------- |
|
|
85
|
-
| `apiKey` | `string` | Yes |
|
|
86
|
-
| `appID` | `string` | Yes |
|
|
99
|
+
| `apiKey` | `string` | Yes | API key from the dashboard, **Posted SDK → API keys**. |
|
|
100
|
+
| `appID` | `string` | Yes | App ID from the dashboard, **Posted SDK → Apps**. |
|
|
87
101
|
| `storage` | `PostedStorage` | No | Persistent key-value storage. Defaults to `@react-native-async-storage/async-storage`. |
|
|
88
102
|
|
|
89
103
|
### Custom storage
|
|
@@ -120,17 +134,28 @@ The SDK stores two keys, both prefixed with `Posted_`: the "install reported" fl
|
|
|
120
134
|
|
|
121
135
|
## Data collected
|
|
122
136
|
|
|
123
|
-
The install report contains
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
137
|
+
The install report is one `POST` to `attr.postedapp.com/api/install`, sent once per install. It contains the fields below. They are used only to attribute installs of your app to your own ad campaigns.
|
|
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.
|
|
134
159
|
|
|
135
160
|
## Troubleshooting
|
|
136
161
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { prepareDeviceIdForApi } from "./utils/deviceId.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getInstallContext } from "./utils/installContext.js";
|
|
5
5
|
import { getInstallReferrerClickId } from "./utils/installReferrer.js";
|
|
6
6
|
import { StorageKeys, resolveStorage } from "./utils/storage.js";
|
|
7
7
|
import { SDK_HEADER_VALUE } from "./version.js";
|
|
@@ -21,7 +21,7 @@ const send = async ({
|
|
|
21
21
|
try {
|
|
22
22
|
const storage = resolveStorage(userStorage);
|
|
23
23
|
if (await storage.getItem(StorageKeys.INSTALL_REPORTED_FLAG_KEY)) return;
|
|
24
|
-
const [clickId,
|
|
24
|
+
const [clickId, installContext, deviceId] = await Promise.all([getInstallReferrerClickId(), getInstallContext(), prepareDeviceIdForApi(storage)]);
|
|
25
25
|
const response = await fetch(INSTALL_API_URL, {
|
|
26
26
|
method: "POST",
|
|
27
27
|
headers: {
|
|
@@ -31,7 +31,7 @@ const send = async ({
|
|
|
31
31
|
"X-SDK": SDK_HEADER_VALUE
|
|
32
32
|
},
|
|
33
33
|
body: JSON.stringify({
|
|
34
|
-
...
|
|
34
|
+
...installContext,
|
|
35
35
|
device_id: deviceId,
|
|
36
36
|
...(clickId ? {
|
|
37
37
|
clickId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["prepareDeviceIdForApi","
|
|
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,iBAA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C;IACH,CAAC,CAAC;IAEF,IAAI,CAACK,QAAQ,CAACS,EAAE,EAAE;MAChBC,OAAO,CAACC,IAAI,CAAC,sDAAsDX,QAAQ,CAACY,MAAM,EAAE,CAAC;MACrF;IACF;IACA,MAAMrB,OAAO,CAACsB,OAAO,CAACjC,WAAW,CAACc,yBAAyB,EAAE,MAAM,CAAC;EACtE,CAAC,CAAC,OAAOoB,KAAK,EAAE;IACdJ,OAAO,CAACI,KAAK,CAAC,mDAAmD,EAAEA,KAAK,CAAC;EAC3E;AACF,CAAC","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ const intlOptions = () => {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
// No clipboard read: it shows an iOS paste banner and install matching doesn't use it.
|
|
14
|
-
export const
|
|
14
|
+
export const getInstallContext = async () => {
|
|
15
15
|
const {
|
|
16
16
|
width,
|
|
17
17
|
height
|
|
@@ -41,4 +41,4 @@ export const getProbabilisticFingerprint = async () => {
|
|
|
41
41
|
timestamp: Date.now()
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
-
//# sourceMappingURL=
|
|
44
|
+
//# sourceMappingURL=installContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Dimensions","PixelRatio","Platform","getDeviceInfo","getUserAgent","expoLocalization","intlOptions","Intl","DateTimeFormat","resolvedOptions","getInstallContext","width","height","get","localeLanguageTags","getLocales","map","locale","languageTag","model","manufacturer","osVersion","systemVersion","userAgent","platform","OS","screenWidth","screenHeight","scale","timezone","getCalendars","timeZone","timestamp","Date","now"],"sourceRoot":"../../../src","sources":["utils/installContext.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAE/D,SAASC,aAAa,EAAEC,YAAY,QAAQ,iBAAc;AAC1D,SAASC,gBAAgB,QAAQ,sBAAmB;AAEpD,MAAMC,WAAW,GAAGA,CAAA,KAAiD;EACnE,IAAI;IACF,OAA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
-
export const version = "1.0.
|
|
3
|
+
export const version = "1.0.1"; // 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,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type InstallContext = {
|
|
2
2
|
platform: string;
|
|
3
3
|
model: string;
|
|
4
4
|
manufacturer: string;
|
|
@@ -13,5 +13,5 @@ export type ProbabilisticFingerprint = {
|
|
|
13
13
|
userAgent: string;
|
|
14
14
|
timestamp: number;
|
|
15
15
|
};
|
|
16
|
-
export declare const
|
|
17
|
-
//# sourceMappingURL=
|
|
16
|
+
export declare const getInstallContext: () => Promise<InstallContext>;
|
|
17
|
+
//# sourceMappingURL=installContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installContext.d.ts","sourceRoot":"","sources":["../../../../src/utils/installContext.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,cAAc,CAwBhE,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.1";
|
|
2
|
+
export declare const SDK_HEADER_VALUE = "react-native/1.0.1";
|
|
3
3
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posted-sdk/react-native",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Reports app installs to
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
7
7
|
"exports": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint": "eslint . --cache --cache-location .eslintcache",
|
|
29
29
|
"clean": "del-cli lib",
|
|
30
30
|
"prepare": "bob build",
|
|
31
|
-
"prepack": "cp ../../README.md README.md",
|
|
32
|
-
"postpack": "rm README.md",
|
|
31
|
+
"prepack": "cp ../../README.md README.md && cp ../../LICENSE LICENSE",
|
|
32
|
+
"postpack": "rm README.md LICENSE",
|
|
33
33
|
"release": "release-it"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"url": "https://github.com/thepostedapp/posted-sdk-react-native/issues"
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/thepostedapp/posted-sdk-react-native#readme",
|
|
50
|
+
"license": "MIT",
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public",
|
|
52
53
|
"registry": "https://registry.npmjs.org/"
|
package/src/reportInstall.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from "./types";
|
|
2
2
|
import { prepareDeviceIdForApi } from "./utils/deviceId";
|
|
3
|
-
import {
|
|
3
|
+
import { getInstallContext } from "./utils/installContext";
|
|
4
4
|
import { getInstallReferrerClickId } from "./utils/installReferrer";
|
|
5
5
|
import { StorageKeys, resolveStorage } from "./utils/storage";
|
|
6
6
|
import { SDK_HEADER_VALUE } from "./version";
|
|
@@ -21,9 +21,9 @@ const send = async ({ apiKey, appID, storage: userStorage }: Config) => {
|
|
|
21
21
|
const storage = resolveStorage(userStorage);
|
|
22
22
|
if (await storage.getItem(StorageKeys.INSTALL_REPORTED_FLAG_KEY)) return;
|
|
23
23
|
|
|
24
|
-
const [clickId,
|
|
24
|
+
const [clickId, installContext, deviceId] = await Promise.all([
|
|
25
25
|
getInstallReferrerClickId(),
|
|
26
|
-
|
|
26
|
+
getInstallContext(),
|
|
27
27
|
prepareDeviceIdForApi(storage),
|
|
28
28
|
]);
|
|
29
29
|
|
|
@@ -36,7 +36,7 @@ const send = async ({ apiKey, appID, storage: userStorage }: Config) => {
|
|
|
36
36
|
"X-SDK": SDK_HEADER_VALUE,
|
|
37
37
|
},
|
|
38
38
|
body: JSON.stringify({
|
|
39
|
-
...
|
|
39
|
+
...installContext,
|
|
40
40
|
device_id: deviceId,
|
|
41
41
|
...(clickId ? { clickId } : {}),
|
|
42
42
|
}),
|
|
@@ -11,7 +11,7 @@ const intlOptions = (): Intl.ResolvedDateTimeFormatOptions | null => {
|
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type InstallContext = {
|
|
15
15
|
platform: string;
|
|
16
16
|
model: string;
|
|
17
17
|
manufacturer: string;
|
|
@@ -26,7 +26,7 @@ export type ProbabilisticFingerprint = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// No clipboard read: it shows an iOS paste banner and install matching doesn't use it.
|
|
29
|
-
export const
|
|
29
|
+
export const getInstallContext = async (): Promise<InstallContext> => {
|
|
30
30
|
const { width, height } = Dimensions.get("screen");
|
|
31
31
|
const localeLanguageTags = expoLocalization
|
|
32
32
|
? expoLocalization.getLocales().map((locale) => ({ languageTag: locale.languageTag }))
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = "1.0.
|
|
1
|
+
export const version = "1.0.1"; // This line will is updated automatically by releasing script
|
|
2
2
|
export const SDK_HEADER_VALUE = `react-native/${version}`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Dimensions","PixelRatio","Platform","getDeviceInfo","getUserAgent","expoLocalization","intlOptions","Intl","DateTimeFormat","resolvedOptions","getProbabilisticFingerprint","width","height","get","localeLanguageTags","getLocales","map","locale","languageTag","model","manufacturer","osVersion","systemVersion","userAgent","platform","OS","screenWidth","screenHeight","scale","timezone","getCalendars","timeZone","timestamp","Date","now"],"sourceRoot":"../../../src","sources":["utils/fingerprint.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AAE/D,SAASC,aAAa,EAAEC,YAAY,QAAQ,iBAAc;AAC1D,SAASC,gBAAgB,QAAQ,sBAAmB;AAEpD,MAAMC,WAAW,GAAGA,CAAA,KAAiD;EACnE,IAAI;IACF,OAAOC,IAAI,CAACC,cAAc,CAAC,CAAC,CAACC,eAAe,CAAC,CAAC;EAChD,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC;AAgBD;AACA,OAAO,MAAMC,2BAA2B,GAAG,MAAAA,CAAA,KAA+C;EACxF,MAAM;IAAEC,KAAK;IAAEC;EAAO,CAAC,GAAGZ,UAAU,CAACa,GAAG,CAAC,QAAQ,CAAC;EAClD,MAAMC,kBAAkB,GAAGT,gBAAgB,GACvCA,gBAAgB,CAACU,UAAU,CAAC,CAAC,CAACC,GAAG,CAAEC,MAAM,KAAM;IAAEC,WAAW,EAAED,MAAM,CAACC;EAAY,CAAC,CAAC,CAAC,GACpF,CAAC;IAAEA,WAAW,EAAEZ,WAAW,CAAC,CAAC,EAAEW,MAAM,IAAI;EAAU,CAAC,CAAC;EAEzD,MAAM;IAAEE,KAAK;IAAEC,YAAY;IAAEC,SAAS,EAAEC;EAAc,CAAC,GAAG,MAAMnB,aAAa,CAAC,CAAC;EAC/E,MAAMoB,SAAS,GAAG,MAA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