vialink-react-native-sdk 3.0.0 → 3.3.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/android/libs/vialink-sdk.aar +0 -0
- package/android/src/main/java/com/vialink/reactnative/ViaLinkModule.kt +16 -6
- package/dist/ViaLinkSDK.d.ts +23 -8
- package/dist/index.js +1 -1
- package/ios/Frameworks/ViaLinkCore.xcframework/Info.plist +44 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Info.plist +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios.abi.json +3473 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios.package.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios.private.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64/ViaLinkCore.framework/ViaLinkCore +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Info.plist +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios-simulator.abi.json +3473 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/x86_64-apple-ios-simulator.abi.json +3473 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/ViaLinkCore.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +107 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/Modules/module.modulemap +4 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/ViaLinkCore +0 -0
- package/ios/Frameworks/ViaLinkCore.xcframework/ios-arm64_x86_64-simulator/ViaLinkCore.framework/_CodeSignature/CodeResources +101 -0
- package/ios/ViaLinkModule.swift +14 -5
- package/package.json +1 -1
- package/vialink-react-native-sdk.podspec +1 -1
|
Binary file
|
|
@@ -13,11 +13,15 @@ class ViaLinkModule(reactContext: ReactApplicationContext) :
|
|
|
13
13
|
ActivityEventListener {
|
|
14
14
|
|
|
15
15
|
companion object {
|
|
16
|
-
const val WRAPPER_VERSION = "
|
|
16
|
+
const val WRAPPER_VERSION = "3.1.0"
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
|
20
|
+
/// onDeepLink가 listenerCount==0 시점에 호출된 경우의 캐시.
|
|
21
|
+
/// 3.1.0부터 일반 진입에서도 콜백이 호출되므로, link 진입(map != null) / 일반 진입(map == null)을
|
|
22
|
+
/// 구분하기 위해 별도 플래그(`hasPendingDeepLink`)를 둔다.
|
|
20
23
|
private var pendingDeepLink: WritableMap? = null
|
|
24
|
+
private var hasPendingDeepLink: Boolean = false
|
|
21
25
|
private var pendingDeferred: WritableMap? = null
|
|
22
26
|
private var listenerCount = 0
|
|
23
27
|
|
|
@@ -40,10 +44,15 @@ class ViaLinkModule(reactContext: ReactApplicationContext) :
|
|
|
40
44
|
ViaLinkSDK.setWrapper("react-native/$WRAPPER_VERSION")
|
|
41
45
|
ViaLinkSDK.init(context, apiKey)
|
|
42
46
|
|
|
47
|
+
// 딥링크 콜백 — SDK 3.1.0+: data == null이면 일반 진입을 의미한다.
|
|
48
|
+
// JS 측 emitter는 null payload를 그대로 전달받아 `data: null`로 콜백을 호출한다.
|
|
43
49
|
ViaLinkSDK.onDeepLink { data ->
|
|
44
|
-
val map = data
|
|
50
|
+
val map: WritableMap? = data?.toWritableMap()
|
|
45
51
|
if (listenerCount > 0) sendEvent("onDeepLink", map)
|
|
46
|
-
else
|
|
52
|
+
else {
|
|
53
|
+
pendingDeepLink = map
|
|
54
|
+
hasPendingDeepLink = true
|
|
55
|
+
}
|
|
47
56
|
}
|
|
48
57
|
// 디퍼드 콜백: SDK 3.0+ 시그니처 (data, error) — 항상 1회 호출
|
|
49
58
|
// JS 측 emit 페이로드는 `{data, error}` 객체로 전달한다.
|
|
@@ -166,10 +175,11 @@ class ViaLinkModule(reactContext: ReactApplicationContext) :
|
|
|
166
175
|
@ReactMethod
|
|
167
176
|
fun addListener(eventName: String) {
|
|
168
177
|
listenerCount++
|
|
169
|
-
// pending 이벤트 flush
|
|
170
|
-
if (eventName == "onDeepLink") {
|
|
171
|
-
|
|
178
|
+
// pending 이벤트 flush — 3.1.0부터 일반 진입(null payload)도 flush해야 한다.
|
|
179
|
+
if (eventName == "onDeepLink" && hasPendingDeepLink) {
|
|
180
|
+
sendEvent("onDeepLink", pendingDeepLink) // null payload도 그대로 전달
|
|
172
181
|
pendingDeepLink = null
|
|
182
|
+
hasPendingDeepLink = false
|
|
173
183
|
}
|
|
174
184
|
if (eventName == "onDeferredDeepLink") {
|
|
175
185
|
pendingDeferred?.let { sendEvent("onDeferredDeepLink", it) }
|
package/dist/ViaLinkSDK.d.ts
CHANGED
|
@@ -92,15 +92,29 @@ export declare class ViaLinkSDK {
|
|
|
92
92
|
*/
|
|
93
93
|
configure(apiKey: string): Promise<void>;
|
|
94
94
|
/**
|
|
95
|
-
* 딥링크 수신 콜백 등록
|
|
96
|
-
*
|
|
95
|
+
* 딥링크 수신 콜백 등록 (3.1.0+).
|
|
96
|
+
*
|
|
97
|
+
* 네이티브 SDK가 진입 알림(`handleIntent`/`handleUniversalLink`/`notifyAppLaunch`)을 처리할 때 항상 1회 호출됩니다.
|
|
98
|
+
* - App Links / Universal Links 진입이면 매칭된 [DeepLinkData]가 전달됩니다.
|
|
99
|
+
* - 일반 진입(아이콘 탭 등)이면 `null`이 전달됩니다.
|
|
100
|
+
*
|
|
101
|
+
* ```typescript
|
|
102
|
+
* ViaLinkSDK.shared.onDeepLink((data) => {
|
|
103
|
+
* if (!data) {
|
|
104
|
+
* // 일반 진입 — 기본 라우트 유지
|
|
105
|
+
* return;
|
|
106
|
+
* }
|
|
107
|
+
* navigation.navigate(data.path, data.params);
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
97
110
|
*/
|
|
98
|
-
onDeepLink(callback: (data: DeepLinkData) => void): void;
|
|
111
|
+
onDeepLink(callback: (data: DeepLinkData | null) => void): void;
|
|
99
112
|
/**
|
|
100
113
|
* 디퍼드 딥링크 콜백 등록
|
|
101
114
|
*
|
|
102
|
-
* 앱
|
|
103
|
-
* 5초 안에 결과가 결정되지 않으면 `error.code === 'timeout'
|
|
115
|
+
* 앱 진입 시 매번 1회 호출됩니다 (3.2.0+).
|
|
116
|
+
* - 첫 실행: `/v1/open` 매칭 결과 결정 즉시 호출. 5초 안에 결과가 결정되지 않으면 `error.code === 'timeout'`.
|
|
117
|
+
* - 비첫 실행: `/v1/open` 호출 없이 즉시 `(null, null)` (organic install과 동일 의미).
|
|
104
118
|
*
|
|
105
119
|
* ```typescript
|
|
106
120
|
* ViaLinkSDK.shared.onDeferredDeepLink((data, error) => {
|
|
@@ -109,15 +123,16 @@ export declare class ViaLinkSDK {
|
|
|
109
123
|
* return;
|
|
110
124
|
* }
|
|
111
125
|
* if (!data) {
|
|
112
|
-
* // organic install — 일반 진입
|
|
126
|
+
* // organic install 또는 비첫 실행 — 일반 진입
|
|
113
127
|
* return;
|
|
114
128
|
* }
|
|
115
129
|
* navigation.navigate(data.path, data.params);
|
|
116
130
|
* });
|
|
117
131
|
* ```
|
|
118
132
|
*
|
|
119
|
-
* 콜백은 멱등성을 보장합니다 (총 1회 호출).
|
|
120
|
-
* `error.retryable
|
|
133
|
+
* 콜백은 멱등성을 보장합니다 (앱 프로세스당 총 1회 호출).
|
|
134
|
+
* 첫 실행에서 `error.retryable === true` 인 실패가 나오면 다음 앱 실행에서 자동 재시도되며,
|
|
135
|
+
* 그 경우 사용자가 앱을 사용 중일 때 콜백이 도착할 수 있습니다.
|
|
121
136
|
*/
|
|
122
137
|
onDeferredDeepLink(callback: (data: DeepLinkData | null, error: DeferredError | null) => void): void;
|
|
123
138
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var reactNative=require('react-native');var {ViaLinkSDK:r}=reactNative.NativeModules,i=new reactNative.NativeEventEmitter(r),l=/^[A-Za-z0-9_-]{1,100}$/,n=class a{constructor(){this.payment={initiated:async e=>{if(!e||typeof e!="object")throw new Error("args\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.");if(typeof e.orderId!="string"||!l.test(e.orderId))throw new Error("order_id \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (1~100\uC790, \uC601\uBB38/\uC22B\uC790/\uD558\uC774\uD508/\uC5B8\uB354\uC2A4\uCF54\uC5B4).");if(typeof e.amount!="number"||!Number.isFinite(e.amount)||e.amount<=0)throw new Error("amount\uB294 0\uBCF4\uB2E4 \uD070 \uC22B\uC790\uC5EC\uC57C \uD569\uB2C8\uB2E4.");if(typeof e.currency!="string"||e.currency.trim().length===0)throw new Error("currency\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.");let t=await r.paymentInitiated({orderId:e.orderId,amount:e.amount,currency:e.currency.trim().toUpperCase(),linkId:e.linkId??null,paymentMethod:e.paymentMethod??null,metadata:e.metadata??null});return {success:!!t?.success,paymentEventId:String(t?.paymentEventId??"")}}};}static get shared(){return this._instance||(this._instance=new a),this._instance}async configure(e){await r.configure(e);}onDeepLink(e){this.deepLinkSub?.remove(),this.deepLinkSub=i.addListener("onDeepLink",e);}onDeferredDeepLink(e){this.deferredSub?.remove(),this.deferredSub=i.addListener("onDeferredDeepLink",t=>{e(t?.data??null,t?.error??null);});}track(e,t){r.track(e,t??null);}async createLink(e,t,o,
|
|
1
|
+
'use strict';var reactNative=require('react-native');var {ViaLinkSDK:r}=reactNative.NativeModules,i=new reactNative.NativeEventEmitter(r),l=/^[A-Za-z0-9_-]{1,100}$/,n=class a{constructor(){this.payment={initiated:async e=>{if(!e||typeof e!="object")throw new Error("args\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.");if(typeof e.orderId!="string"||!l.test(e.orderId))throw new Error("order_id \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (1~100\uC790, \uC601\uBB38/\uC22B\uC790/\uD558\uC774\uD508/\uC5B8\uB354\uC2A4\uCF54\uC5B4).");if(typeof e.amount!="number"||!Number.isFinite(e.amount)||e.amount<=0)throw new Error("amount\uB294 0\uBCF4\uB2E4 \uD070 \uC22B\uC790\uC5EC\uC57C \uD569\uB2C8\uB2E4.");if(typeof e.currency!="string"||e.currency.trim().length===0)throw new Error("currency\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4.");let t=await r.paymentInitiated({orderId:e.orderId,amount:e.amount,currency:e.currency.trim().toUpperCase(),linkId:e.linkId??null,paymentMethod:e.paymentMethod??null,metadata:e.metadata??null});return {success:!!t?.success,paymentEventId:String(t?.paymentEventId??"")}}};}static get shared(){return this._instance||(this._instance=new a),this._instance}async configure(e){await r.configure(e);}onDeepLink(e){this.deepLinkSub?.remove(),this.deepLinkSub=i.addListener("onDeepLink",t=>{e(t??null);});}onDeferredDeepLink(e){this.deferredSub?.remove(),this.deferredSub=i.addListener("onDeferredDeepLink",t=>{e(t?.data??null,t?.error??null);});}track(e,t){r.track(e,t??null);}async createLink(e,t,o,d="static",s){return r.createLink(e,t??null,o??null,d,s??null)}destroy(){this.deepLinkSub?.remove(),this.deferredSub?.remove();}};exports.ViaLinkSDK=n;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>AvailableLibraries</key>
|
|
6
|
+
<array>
|
|
7
|
+
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>ViaLinkCore.framework/ViaLinkCore</string>
|
|
10
|
+
<key>LibraryIdentifier</key>
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
12
|
+
<key>LibraryPath</key>
|
|
13
|
+
<string>ViaLinkCore.framework</string>
|
|
14
|
+
<key>SupportedArchitectures</key>
|
|
15
|
+
<array>
|
|
16
|
+
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
18
|
+
</array>
|
|
19
|
+
<key>SupportedPlatform</key>
|
|
20
|
+
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
23
|
+
</dict>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>BinaryPath</key>
|
|
26
|
+
<string>ViaLinkCore.framework/ViaLinkCore</string>
|
|
27
|
+
<key>LibraryIdentifier</key>
|
|
28
|
+
<string>ios-arm64</string>
|
|
29
|
+
<key>LibraryPath</key>
|
|
30
|
+
<string>ViaLinkCore.framework</string>
|
|
31
|
+
<key>SupportedArchitectures</key>
|
|
32
|
+
<array>
|
|
33
|
+
<string>arm64</string>
|
|
34
|
+
</array>
|
|
35
|
+
<key>SupportedPlatform</key>
|
|
36
|
+
<string>ios</string>
|
|
37
|
+
</dict>
|
|
38
|
+
</array>
|
|
39
|
+
<key>CFBundlePackageType</key>
|
|
40
|
+
<string>XFWK</string>
|
|
41
|
+
<key>XCFrameworkFormatVersion</key>
|
|
42
|
+
<string>1.0</string>
|
|
43
|
+
</dict>
|
|
44
|
+
</plist>
|
|
Binary file
|