vialink-react-native-sdk 3.3.11 → 3.3.12
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.ko.md +158 -0
- package/README.md +43 -41
- package/package.json +3 -2
- package/vialink-react-native-sdk.podspec +1 -1
package/README.ko.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# ViaLink React Native SDK
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **한국어**
|
|
4
|
+
|
|
5
|
+
ViaLink 딥링크 인프라 서비스를 위한 React Native SDK입니다.
|
|
6
|
+
v2.0부터 네이티브 브릿지 방식(Android .aar + iOS .xcframework)으로 동작합니다.
|
|
7
|
+
|
|
8
|
+
## 특징
|
|
9
|
+
|
|
10
|
+
- **딥링크 라우팅** — App Links / Universal Links 자동 처리
|
|
11
|
+
- **디퍼드 딥링킹** — 앱 설치 후 첫 실행 시 핑거프린트 기반 매칭
|
|
12
|
+
- **이벤트 추적** — 커스텀 이벤트 배치 전송
|
|
13
|
+
- **결제 어트리뷰션** — 결제 시도 기록 + 자동 link_id 첨부
|
|
14
|
+
- **링크 생성** — 앱 내에서 딥링크 생성 (static/dynamic)
|
|
15
|
+
|
|
16
|
+
## 요구사항
|
|
17
|
+
|
|
18
|
+
- React Native 0.73+
|
|
19
|
+
- Android: minSdk 24, compileSdk 34
|
|
20
|
+
- iOS: 15.0+, Swift 5.9+
|
|
21
|
+
|
|
22
|
+
## 설치
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install vialink-react-native-sdk
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### iOS 추가 설정
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cd ios && pod install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Android 추가 설정
|
|
35
|
+
|
|
36
|
+
`android/app/build.gradle`에서 설정 확인:
|
|
37
|
+
|
|
38
|
+
```groovy
|
|
39
|
+
android {
|
|
40
|
+
compileSdkVersion 34
|
|
41
|
+
defaultConfig {
|
|
42
|
+
minSdkVersion 24
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`MainApplication.kt` (또는 `.java`)에 패키지 등록:
|
|
48
|
+
|
|
49
|
+
```kotlin
|
|
50
|
+
import com.vialink.reactnative.ViaLinkPackage
|
|
51
|
+
|
|
52
|
+
override fun getPackages(): List<ReactPackage> {
|
|
53
|
+
val packages = PackageList(this).packages.toMutableList()
|
|
54
|
+
packages.add(ViaLinkPackage())
|
|
55
|
+
return packages
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 사용법
|
|
60
|
+
|
|
61
|
+
### 1. 초기화
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { ViaLinkSDK } from 'vialink-react-native-sdk';
|
|
65
|
+
|
|
66
|
+
// App.tsx 최상위에서 호출
|
|
67
|
+
await ViaLinkSDK.shared.configure('YOUR_API_KEY');
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. 딥링크 콜백
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
// App Links / Universal Links 수신
|
|
74
|
+
ViaLinkSDK.shared.onDeepLink((data) => {
|
|
75
|
+
console.log('딥링크:', data.path, data.params);
|
|
76
|
+
navigation.navigate(data.path, data.params);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// 디퍼드 딥링크 (앱 첫 실행 시 매칭, 5초 데드라인)
|
|
80
|
+
ViaLinkSDK.shared.onDeferredDeepLink((data, error) => {
|
|
81
|
+
if (error) {
|
|
82
|
+
// 매칭 실패 (timeout/network/server_error 등) — 일반 진입
|
|
83
|
+
console.log('매칭 실패:', error.code, error.message);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!data) {
|
|
87
|
+
// organic install — 일반 진입
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// 매칭 성공 — 딥링크 경로로 이동
|
|
91
|
+
navigation.navigate(data.path, data.params);
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. Pull API
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// 동기 (캐시된 값 즉시 반환)
|
|
99
|
+
const deepLink = await ViaLinkSDK.shared.getDeepLinkData();
|
|
100
|
+
const deferred = await ViaLinkSDK.shared.getDeferredLinkData();
|
|
101
|
+
|
|
102
|
+
// 비동기 (결과 도착까지 대기)
|
|
103
|
+
const deepLinkAsync = await ViaLinkSDK.shared.awaitDeepLinkData(); // 3초 타임아웃
|
|
104
|
+
const deferredAsync = await ViaLinkSDK.shared.awaitDeferredLinkData(); // 결과까지 대기
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 4. 이벤트 추적
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
ViaLinkSDK.shared.track('purchase', {
|
|
111
|
+
product_id: '12345',
|
|
112
|
+
revenue: 29900,
|
|
113
|
+
currency: 'KRW',
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 5. 결제 추적
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const result = await ViaLinkSDK.shared.payment.initiated({
|
|
121
|
+
orderId: 'ORD-2026-0001',
|
|
122
|
+
amount: 19900,
|
|
123
|
+
currency: 'KRW',
|
|
124
|
+
paymentMethod: 'card',
|
|
125
|
+
});
|
|
126
|
+
console.log('success:', result.success, 'id:', result.paymentEventId);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 6. 링크 생성
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
const url = await ViaLinkSDK.shared.createLink(
|
|
133
|
+
'/product/123',
|
|
134
|
+
{ promo_code: 'FRIEND_SHARE' },
|
|
135
|
+
'referral',
|
|
136
|
+
'dynamic', // 클릭 추적 필요 시
|
|
137
|
+
);
|
|
138
|
+
console.log('생성된 링크:', url);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 7. 정리
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// 앱 종료 또는 unmount 시
|
|
145
|
+
ViaLinkSDK.shared.destroy();
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 샘플 프로젝트
|
|
149
|
+
|
|
150
|
+
`sample/` 디렉토리에서 실행 가능한 샘플 앱을 확인하세요.
|
|
151
|
+
|
|
152
|
+
## 문서
|
|
153
|
+
|
|
154
|
+
- [SDK 가이드](https://docs.vialink.app/sdk/react-native)
|
|
155
|
+
|
|
156
|
+
## 라이선스
|
|
157
|
+
|
|
158
|
+
MIT License — Aresjoy Inc.
|
package/README.md
CHANGED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
# ViaLink React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
v2.0부터 네이티브 브릿지 방식(Android .aar + iOS .xcframework)으로 동작합니다.
|
|
3
|
+
**English** | [한국어](README.ko.md)
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
React Native SDK for the ViaLink deep link infrastructure service.
|
|
6
|
+
Since v2.0 it runs through a native bridge (Android .aar + iOS .xcframework).
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- **디퍼드 딥링킹** — 앱 설치 후 첫 실행 시 핑거프린트 기반 매칭
|
|
10
|
-
- **이벤트 추적** — 커스텀 이벤트 배치 전송
|
|
11
|
-
- **결제 어트리뷰션** — 결제 시도 기록 + 자동 link_id 첨부
|
|
12
|
-
- **링크 생성** — 앱 내에서 딥링크 생성 (static/dynamic)
|
|
8
|
+
## Features
|
|
13
9
|
|
|
14
|
-
|
|
10
|
+
- **Deep link routing** — automatic handling of App Links / Universal Links
|
|
11
|
+
- **Deferred deep linking** — fingerprint-based matching on the first launch after install
|
|
12
|
+
- **Event tracking** — batched delivery of custom events
|
|
13
|
+
- **Payment attribution** — records payment attempts and automatically attaches `link_id`
|
|
14
|
+
- **Link creation** — generate deep links from within the app (static/dynamic)
|
|
15
|
+
|
|
16
|
+
## Requirements
|
|
15
17
|
|
|
16
18
|
- React Native 0.73+
|
|
17
19
|
- Android: minSdk 24, compileSdk 34
|
|
18
20
|
- iOS: 15.0+, Swift 5.9+
|
|
19
21
|
|
|
20
|
-
##
|
|
22
|
+
## Installation
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
25
|
npm install vialink-react-native-sdk
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
### iOS
|
|
28
|
+
### iOS additional setup
|
|
27
29
|
|
|
28
30
|
```bash
|
|
29
31
|
cd ios && pod install
|
|
30
32
|
```
|
|
31
33
|
|
|
32
|
-
### Android
|
|
34
|
+
### Android additional setup
|
|
33
35
|
|
|
34
|
-
`android/app/build.gradle
|
|
36
|
+
Verify the configuration in `android/app/build.gradle`:
|
|
35
37
|
|
|
36
38
|
```groovy
|
|
37
39
|
android {
|
|
@@ -42,7 +44,7 @@ android {
|
|
|
42
44
|
}
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
`MainApplication.kt` (
|
|
47
|
+
Register the package in `MainApplication.kt` (or `.java`):
|
|
46
48
|
|
|
47
49
|
```kotlin
|
|
48
50
|
import com.vialink.reactnative.ViaLinkPackage
|
|
@@ -54,38 +56,38 @@ override fun getPackages(): List<ReactPackage> {
|
|
|
54
56
|
}
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
##
|
|
59
|
+
## Usage
|
|
58
60
|
|
|
59
|
-
### 1.
|
|
61
|
+
### 1. Initialization
|
|
60
62
|
|
|
61
63
|
```typescript
|
|
62
64
|
import { ViaLinkSDK } from 'vialink-react-native-sdk';
|
|
63
65
|
|
|
64
|
-
// App.tsx
|
|
66
|
+
// Call at the top level of App.tsx
|
|
65
67
|
await ViaLinkSDK.shared.configure('YOUR_API_KEY');
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
### 2.
|
|
70
|
+
### 2. Deep link callbacks
|
|
69
71
|
|
|
70
72
|
```typescript
|
|
71
|
-
// App Links / Universal Links
|
|
73
|
+
// Receive App Links / Universal Links
|
|
72
74
|
ViaLinkSDK.shared.onDeepLink((data) => {
|
|
73
|
-
console.log('
|
|
75
|
+
console.log('deep link:', data.path, data.params);
|
|
74
76
|
navigation.navigate(data.path, data.params);
|
|
75
77
|
});
|
|
76
78
|
|
|
77
|
-
//
|
|
79
|
+
// Deferred deep link (matched on first app launch, 5-second deadline)
|
|
78
80
|
ViaLinkSDK.shared.onDeferredDeepLink((data, error) => {
|
|
79
81
|
if (error) {
|
|
80
|
-
//
|
|
81
|
-
console.log('
|
|
82
|
+
// match failed (timeout/network/server_error, etc.) — normal entry
|
|
83
|
+
console.log('match failed:', error.code, error.message);
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
86
|
if (!data) {
|
|
85
|
-
// organic install —
|
|
87
|
+
// organic install — normal entry
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
|
-
//
|
|
90
|
+
// match succeeded — navigate to the deep link path
|
|
89
91
|
navigation.navigate(data.path, data.params);
|
|
90
92
|
});
|
|
91
93
|
```
|
|
@@ -93,16 +95,16 @@ ViaLinkSDK.shared.onDeferredDeepLink((data, error) => {
|
|
|
93
95
|
### 3. Pull API
|
|
94
96
|
|
|
95
97
|
```typescript
|
|
96
|
-
//
|
|
98
|
+
// Synchronous (returns the cached value immediately)
|
|
97
99
|
const deepLink = await ViaLinkSDK.shared.getDeepLinkData();
|
|
98
100
|
const deferred = await ViaLinkSDK.shared.getDeferredLinkData();
|
|
99
101
|
|
|
100
|
-
//
|
|
101
|
-
const deepLinkAsync = await ViaLinkSDK.shared.awaitDeepLinkData(); // 3
|
|
102
|
-
const deferredAsync = await ViaLinkSDK.shared.awaitDeferredLinkData(); //
|
|
102
|
+
// Asynchronous (waits until the result arrives)
|
|
103
|
+
const deepLinkAsync = await ViaLinkSDK.shared.awaitDeepLinkData(); // 3-second timeout
|
|
104
|
+
const deferredAsync = await ViaLinkSDK.shared.awaitDeferredLinkData(); // waits until the result
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
### 4.
|
|
107
|
+
### 4. Event tracking
|
|
106
108
|
|
|
107
109
|
```typescript
|
|
108
110
|
ViaLinkSDK.shared.track('purchase', {
|
|
@@ -112,7 +114,7 @@ ViaLinkSDK.shared.track('purchase', {
|
|
|
112
114
|
});
|
|
113
115
|
```
|
|
114
116
|
|
|
115
|
-
### 5.
|
|
117
|
+
### 5. Payment tracking
|
|
116
118
|
|
|
117
119
|
```typescript
|
|
118
120
|
const result = await ViaLinkSDK.shared.payment.initiated({
|
|
@@ -124,33 +126,33 @@ const result = await ViaLinkSDK.shared.payment.initiated({
|
|
|
124
126
|
console.log('success:', result.success, 'id:', result.paymentEventId);
|
|
125
127
|
```
|
|
126
128
|
|
|
127
|
-
### 6.
|
|
129
|
+
### 6. Link creation
|
|
128
130
|
|
|
129
131
|
```typescript
|
|
130
132
|
const url = await ViaLinkSDK.shared.createLink(
|
|
131
133
|
'/product/123',
|
|
132
134
|
{ promo_code: 'FRIEND_SHARE' },
|
|
133
135
|
'referral',
|
|
134
|
-
'dynamic', //
|
|
136
|
+
'dynamic', // when click tracking is needed
|
|
135
137
|
);
|
|
136
|
-
console.log('
|
|
138
|
+
console.log('created link:', url);
|
|
137
139
|
```
|
|
138
140
|
|
|
139
|
-
### 7.
|
|
141
|
+
### 7. Cleanup
|
|
140
142
|
|
|
141
143
|
```typescript
|
|
142
|
-
//
|
|
144
|
+
// On app shutdown or unmount
|
|
143
145
|
ViaLinkSDK.shared.destroy();
|
|
144
146
|
```
|
|
145
147
|
|
|
146
|
-
##
|
|
148
|
+
## Sample project
|
|
147
149
|
|
|
148
|
-
|
|
150
|
+
See the runnable sample app in the `sample/` directory.
|
|
149
151
|
|
|
150
|
-
##
|
|
152
|
+
## Documentation
|
|
151
153
|
|
|
152
|
-
- [SDK
|
|
154
|
+
- [SDK Guide](https://docs.vialink.app/sdk/react-native)
|
|
153
155
|
|
|
154
|
-
##
|
|
156
|
+
## License
|
|
155
157
|
|
|
156
158
|
MIT License — Aresjoy Inc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vialink-react-native-sdk",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.12",
|
|
4
4
|
"description": "ViaLink 딥링크 SDK for React Native (네이티브 브릿지)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"dist/",
|
|
22
22
|
"android/",
|
|
23
23
|
"ios/",
|
|
24
|
-
"vialink-react-native-sdk.podspec"
|
|
24
|
+
"vialink-react-native-sdk.podspec",
|
|
25
|
+
"README.ko.md"
|
|
25
26
|
],
|
|
26
27
|
"repository": {
|
|
27
28
|
"type": "git",
|