@li-nk.me/react-native-sdk 0.1.1 → 0.2.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/README.md +15 -88
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,103 +1,30 @@
|
|
|
1
1
|
# LinkMe React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React Native SDK for LinkMe — deep linking and attribution.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
- Example app: See `example-expo/` directory
|
|
9
|
-
- Android troubleshooting: See [Android Troubleshooting](https://li-nk.me/resources/developer/setup/android#troubleshooting) section in Android setup docs
|
|
5
|
+
- **Main Site**: [li-nk.me](https://li-nk.me)
|
|
6
|
+
- **Documentation**: [React Native Setup](https://li-nk.me/docs/developer/setup/react-native)
|
|
7
|
+
- **Package**: [npm](https://www.npmjs.com/package/@linkme/react-native-sdk)
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
13
11
|
```bash
|
|
14
|
-
npm install @
|
|
12
|
+
npm install @linkme/react-native-sdk
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## Basic Usage
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
```ts
|
|
18
|
+
import { configure } from '@linkme/react-native-sdk';
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
When installed, the SDK will automatically check the iOS pasteboard for a li-nk.me URL before falling back to fingerprint matching. Pasteboard must also be enabled in the Portal (App Settings → iOS).
|
|
26
|
-
|
|
27
|
-
### Expo Configuration
|
|
28
|
-
|
|
29
|
-
Add the config plugin to your `app.json` or `app.config.js`:
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
{
|
|
33
|
-
"expo": {
|
|
34
|
-
"plugins": [
|
|
35
|
-
[
|
|
36
|
-
"@li-nk.me/react-native-sdk/plugin/app.plugin.js",
|
|
37
|
-
{
|
|
38
|
-
"hosts": ["link.example.com"],
|
|
39
|
-
"associatedDomains": ["applinks:link.example.com"],
|
|
40
|
-
"schemes": ["com.example.app"]
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Usage
|
|
49
|
-
|
|
50
|
-
Initialize the SDK in your root layout (e.g., `app/_layout.tsx`):
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { configure, onLink, getInitialLink, claimDeferredIfAvailable, track } from '@li-nk.me/react-native-sdk';
|
|
54
|
-
|
|
55
|
-
// ... inside your component
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
configure({
|
|
58
|
-
appId: 'your-app-id',
|
|
59
|
-
appKey: 'your-app-key',
|
|
60
|
-
// ... other options
|
|
61
|
-
}).then(() => {
|
|
62
|
-
// 1. Listen for deep links (foreground)
|
|
63
|
-
onLink((payload) => handlePayload(payload));
|
|
64
|
-
|
|
65
|
-
// 2. Check for initial link (cold start)
|
|
66
|
-
getInitialLink().then((payload) => {
|
|
67
|
-
if (payload) handlePayload(payload);
|
|
68
|
-
else {
|
|
69
|
-
// 3. Check for deferred link (first install)
|
|
70
|
-
claimDeferredIfAvailable().then((payload) => {
|
|
71
|
-
if (payload) handlePayload(payload);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// 4. Track open
|
|
77
|
-
track('open');
|
|
78
|
-
});
|
|
79
|
-
}, []);
|
|
20
|
+
await configure({
|
|
21
|
+
appId: 'your_app_id',
|
|
22
|
+
appKey: 'your_app_key',
|
|
23
|
+
});
|
|
80
24
|
```
|
|
81
25
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
LinkMe automatically normalizes UTM parameters from deep links and deferred links. You can map these to your analytics provider (e.g., Firebase):
|
|
85
|
-
|
|
86
|
-
```typescript
|
|
87
|
-
function handlePayload(payload: LinkMePayload) {
|
|
88
|
-
if (payload.utm) {
|
|
89
|
-
// Example: Map to Firebase Analytics
|
|
90
|
-
// analytics().logEvent('campaign_details', {
|
|
91
|
-
// source: payload.utm.source,
|
|
92
|
-
// medium: payload.utm.medium,
|
|
93
|
-
// campaign: payload.utm.campaign,
|
|
94
|
-
// term: payload.utm.term,
|
|
95
|
-
// content: payload.utm.content,
|
|
96
|
-
// });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
26
|
+
For full documentation, guides, and API reference, please visit our [Help Center](https://li-nk.me/docs/help).
|
|
100
27
|
|
|
101
|
-
|
|
28
|
+
## License
|
|
102
29
|
|
|
103
|
-
|
|
30
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@li-nk.me/react-native-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pure TypeScript React Native SDK for LinkMe deep and deferred links.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"sdk"
|
|
25
25
|
],
|
|
26
26
|
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/r-dev-limited/li-nk.me-react-native-sdk"
|
|
30
|
+
},
|
|
27
31
|
"peerDependencies": {
|
|
28
32
|
"react": ">=18",
|
|
29
33
|
"react-native": ">=0.72.0",
|