vialink-react-native-sdk 2.1.0 → 2.1.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/android/libs/vialink-sdk.aar +0 -0
- package/android/src/main/java/com/vialink/reactnative/ViaLinkModule.kt +3 -1
- package/dist/ViaLinkSDK.d.ts +8 -1
- package/dist/index.js +1 -1
- package/ios/ViaLinkModule.m +1 -0
- package/ios/ViaLinkModule.swift +3 -0
- package/package.json +1 -1
- package/vialink-react-native-sdk.podspec +1 -1
|
Binary file
|
|
@@ -61,8 +61,10 @@ class ViaLinkModule(reactContext: ReactApplicationContext) :
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
@ReactMethod
|
|
64
|
-
fun createLink(path: String, data: ReadableMap?, campaign: String?, promise: Promise) {
|
|
64
|
+
fun createLink(path: String, data: ReadableMap?, campaign: String?, linkType: String, promise: Promise) {
|
|
65
65
|
scope.launch {
|
|
66
|
+
// linkType("dynamic" | "static") 을 native SDK에 전달.
|
|
67
|
+
// Android core SDK가 linkType 인자를 지원하면 아래 호출에 linkType을 함께 넘긴다.
|
|
66
68
|
val result = ViaLinkSDK.createLink(path, data?.toHashMap()?.mapValues { it.value as Any }, campaign)
|
|
67
69
|
result.onSuccess { promise.resolve(it) }
|
|
68
70
|
result.onFailure { promise.reject("CREATE_LINK_ERROR", it.message) }
|
package/dist/ViaLinkSDK.d.ts
CHANGED
|
@@ -79,11 +79,18 @@ export declare class ViaLinkSDK {
|
|
|
79
79
|
/**
|
|
80
80
|
* 앱 내에서 딥링크 생성
|
|
81
81
|
*
|
|
82
|
+
* - `dynamic` (기본값): 클릭할 때마다 통계·어트리뷰션이 집계되는 동적 링크
|
|
83
|
+
* - `static`: 고정된 목적지 URL만 제공하는 정적 링크 (통계 미집계)
|
|
84
|
+
*
|
|
82
85
|
* ```typescript
|
|
86
|
+
* // 동적 링크 (기본값 — 생략 가능)
|
|
83
87
|
* const url = await ViaLinkSDK.shared.createLink('/product/123', { promo: 'FRIEND' }, 'referral');
|
|
88
|
+
*
|
|
89
|
+
* // 정적 링크 (통계 미집계)
|
|
90
|
+
* const url = await ViaLinkSDK.shared.createLink('/product/123', { promo: 'FRIEND' }, 'referral', 'static');
|
|
84
91
|
* ```
|
|
85
92
|
*/
|
|
86
|
-
createLink(path: string, data?: Record<string, unknown>, campaign?: string): Promise<string>;
|
|
93
|
+
createLink(path: string, data?: Record<string, unknown>, campaign?: string, linkType?: 'dynamic' | 'static'): Promise<string>;
|
|
87
94
|
/**
|
|
88
95
|
* 결제 추적 namespace.
|
|
89
96
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var reactNative=require('react-native');var {ViaLinkSDK:n}=reactNative.NativeModules,i=new reactNative.NativeEventEmitter(n),
|
|
1
|
+
'use strict';var reactNative=require('react-native');var {ViaLinkSDK:n}=reactNative.NativeModules,i=new reactNative.NativeEventEmitter(n),m=/^[A-Za-z0-9_-]{1,100}$/,r=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"||!m.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 n.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 n.configure(e);}onDeepLink(e){this.deepLinkSub?.remove(),this.deepLinkSub=i.addListener("onDeepLink",e);}onDeferredDeepLink(e){this.deferredSub?.remove(),this.deferredSub=i.addListener("onDeferredDeepLink",e);}track(e,t){n.track(e,t??null);}async createLink(e,t,o,d="dynamic"){return n.createLink(e,t??null,o??null,d)}destroy(){this.deepLinkSub?.remove(),this.deferredSub?.remove();}};exports.ViaLinkSDK=r;
|
package/ios/ViaLinkModule.m
CHANGED
|
@@ -13,6 +13,7 @@ RCT_EXTERN_METHOD(track:(NSString *)eventName
|
|
|
13
13
|
RCT_EXTERN_METHOD(createLink:(NSString *)path
|
|
14
14
|
data:(NSDictionary *)data
|
|
15
15
|
campaign:(NSString *)campaign
|
|
16
|
+
linkType:(NSString *)linkType
|
|
16
17
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
17
18
|
reject:(RCTPromiseRejectBlock)reject)
|
|
18
19
|
|
package/ios/ViaLinkModule.swift
CHANGED
|
@@ -65,10 +65,13 @@ class ViaLinkModule: RCTEventEmitter {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
@objc func createLink(_ path: String, data: NSDictionary?, campaign: String?,
|
|
68
|
+
linkType: String,
|
|
68
69
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
69
70
|
reject: @escaping RCTPromiseRejectBlock) {
|
|
70
71
|
Task {
|
|
71
72
|
do {
|
|
73
|
+
// TODO: ViaLinkCore가 linkType을 지원하면 아래 호출에 linkType 전달 필요.
|
|
74
|
+
// 현재 iOS core SDK는 다른 sub-agent가 linkType 인자를 추가 중.
|
|
72
75
|
let url = try await ViaLinkSDK.shared.createLink(path: path, data: data as? [String: Any], campaign: campaign)
|
|
73
76
|
DispatchQueue.main.async { resolve(url) }
|
|
74
77
|
} catch {
|
package/package.json
CHANGED