react-native-nami-sdk 3.1.14 → 3.1.17
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/build.gradle +1 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +2 -5
- package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +1 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiManagerBridge.kt +0 -2
- package/android/src/main/java/com/nami/reactlibrary/NamiPaywallManagerBridgeModule.kt +4 -48
- package/ios/Nami.m +1 -1
- package/ios/NamiPaywallManagerBridge.swift +8 -19
- package/package.json +1 -1
- package/react-native-nami-sdk.podspec +1 -1
- package/src/NamiPaywallManager.d.ts +0 -10
- package/src/types.ts +1 -11
package/android/build.gradle
CHANGED
|
@@ -84,7 +84,7 @@ dependencies {
|
|
|
84
84
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
85
85
|
|
|
86
86
|
implementation 'com.github.jeziellago:compose-markdown:0.3.0'
|
|
87
|
-
compileOnly "com.namiml:sdk-amazon:3.1.
|
|
87
|
+
compileOnly "com.namiml:sdk-amazon:3.1.17"
|
|
88
88
|
|
|
89
89
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
90
90
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.nami.reactlibrary
|
|
2
2
|
|
|
3
|
-
import android.app.Application
|
|
4
3
|
import android.content.Context
|
|
5
4
|
import android.util.Log
|
|
6
5
|
import com.facebook.react.bridge.Arguments
|
|
@@ -10,7 +9,6 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
10
9
|
import com.facebook.react.bridge.ReactMethod
|
|
11
10
|
import com.facebook.react.bridge.ReadableArray
|
|
12
11
|
import com.facebook.react.bridge.ReadableMap
|
|
13
|
-
import com.facebook.react.bridge.Promise
|
|
14
12
|
import com.namiml.Nami
|
|
15
13
|
import com.namiml.NamiConfiguration
|
|
16
14
|
import com.namiml.NamiLanguageCode
|
|
@@ -79,7 +77,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
79
77
|
false
|
|
80
78
|
}
|
|
81
79
|
if (developmentMode) {
|
|
82
|
-
|
|
80
|
+
Log.d(LOG_TAG, "NAMI: RN Bridge - development mode is $developmentMode")
|
|
83
81
|
builder.developmentMode = true
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -108,7 +106,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
108
106
|
} else {
|
|
109
107
|
Arguments.createArray()
|
|
110
108
|
}
|
|
111
|
-
val settingsList = mutableListOf("extendedClientInfo:react-native:3.1.
|
|
109
|
+
val settingsList = mutableListOf("extendedClientInfo:react-native:3.1.17")
|
|
112
110
|
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
|
|
113
111
|
settingsList.addAll(commandsFromReact)
|
|
114
112
|
}
|
|
@@ -132,7 +130,6 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
132
130
|
Log.d(LOG_TAG, "Nami Configuration object is $builtConfig")
|
|
133
131
|
|
|
134
132
|
reactApplicationContext.runOnUiQueueThread {
|
|
135
|
-
|
|
136
133
|
// Configure must be called on main thread
|
|
137
134
|
Nami.configure(builtConfig) { result ->
|
|
138
135
|
val resultMap = Arguments.createMap()
|
|
@@ -10,8 +10,8 @@ import com.namiml.billing.NamiPurchase
|
|
|
10
10
|
import com.namiml.campaign.LaunchCampaignResult
|
|
11
11
|
import com.namiml.campaign.NamiCampaign
|
|
12
12
|
import com.namiml.campaign.NamiCampaignManager
|
|
13
|
-
import com.namiml.paywall.model.PaywallLaunchContext
|
|
14
13
|
import com.namiml.paywall.model.NamiPaywallEvent
|
|
14
|
+
import com.namiml.paywall.model.PaywallLaunchContext
|
|
15
15
|
|
|
16
16
|
class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
17
17
|
ReactContextBaseJavaModule(reactContext), ActivityEventListener {
|
|
@@ -27,12 +27,6 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
27
27
|
var productId: String? = null
|
|
28
28
|
var skuRefId: String? = null
|
|
29
29
|
var typeString: String? = null
|
|
30
|
-
var purchaseSourceString: String? = null
|
|
31
|
-
var expiresDateInt: Int? = null
|
|
32
|
-
var purchaseDateInt: Int? = null
|
|
33
|
-
|
|
34
|
-
var expiresDate: Date? = null
|
|
35
|
-
var purchaseDate: Date? = null
|
|
36
30
|
|
|
37
31
|
var skuType: NamiSKUType?
|
|
38
32
|
|
|
@@ -62,34 +56,6 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
if (dict.hasKey("purchaseSource")) {
|
|
66
|
-
purchaseSourceString = dict.getString("purchaseSource")
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (dict.hasKey("expiresDate")) {
|
|
70
|
-
expiresDateInt = dict.getInt("expiresDate")
|
|
71
|
-
expiresDate = Date(expiresDateInt * 1000L)
|
|
72
|
-
}
|
|
73
|
-
if (dict.hasKey("purchaseDate")) {
|
|
74
|
-
purchaseDateInt = dict.getInt("purchaseDate")
|
|
75
|
-
purchaseDate = Date(purchaseDateInt * 1000L)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
val purchaseSource = when (purchaseSourceString) {
|
|
79
|
-
"CAMPAIGN" -> {
|
|
80
|
-
NamiPurchaseSource.CAMPAIGN
|
|
81
|
-
}
|
|
82
|
-
"MARKETPLACE" -> {
|
|
83
|
-
NamiPurchaseSource.MARKETPLACE
|
|
84
|
-
}
|
|
85
|
-
"UNKNOWN" -> {
|
|
86
|
-
NamiPurchaseSource.UNKNOWN
|
|
87
|
-
}
|
|
88
|
-
else -> {
|
|
89
|
-
NamiPurchaseSource.UNKNOWN
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
59
|
if (productId != null && skuRefId != null) {
|
|
94
60
|
val namiSku = NamiSKU.create(
|
|
95
61
|
skuRefId = skuRefId,
|
|
@@ -104,15 +70,11 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
104
70
|
if (dict.hasKey("orderId")) {
|
|
105
71
|
orderId = dict.getString("orderId")
|
|
106
72
|
}
|
|
107
|
-
Log.d(LOG_TAG, "$namiSku $purchaseToken $orderId
|
|
73
|
+
Log.d(LOG_TAG, "$namiSku $purchaseToken $orderId")
|
|
108
74
|
|
|
109
|
-
if (namiSku != null && purchaseToken != null && orderId != null
|
|
75
|
+
if (namiSku != null && purchaseToken != null && orderId != null) {
|
|
110
76
|
purchaseSuccess = NamiPurchaseSuccess.GooglePlay(
|
|
111
77
|
product = namiSku,
|
|
112
|
-
expiresDate = expiresDate,
|
|
113
|
-
purchaseDate = purchaseDate,
|
|
114
|
-
purchaseSource = purchaseSource,
|
|
115
|
-
description = null,
|
|
116
78
|
orderId = orderId,
|
|
117
79
|
purchaseToken = purchaseToken,
|
|
118
80
|
)
|
|
@@ -130,13 +92,9 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
130
92
|
if (dict.hasKey("marketplace")) {
|
|
131
93
|
marketplace = dict.getString("marketplace")
|
|
132
94
|
}
|
|
133
|
-
if (namiSku != null && receiptId != null && localizedPrice != null && userId != null && marketplace != null
|
|
95
|
+
if (namiSku != null && receiptId != null && localizedPrice != null && userId != null && marketplace != null) {
|
|
134
96
|
purchaseSuccess = NamiPurchaseSuccess.Amazon(
|
|
135
97
|
product = namiSku,
|
|
136
|
-
expiresDate = expiresDate,
|
|
137
|
-
purchaseDate = purchaseDate,
|
|
138
|
-
purchaseSource = purchaseSource,
|
|
139
|
-
description = null,
|
|
140
98
|
receiptId = receiptId,
|
|
141
99
|
localizedPrice = localizedPrice,
|
|
142
100
|
userId = userId,
|
|
@@ -213,16 +171,14 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
213
171
|
|
|
214
172
|
@ReactMethod
|
|
215
173
|
fun registerDeeplinkActionHandler() {
|
|
216
|
-
NamiPaywallManager.registerDeepLinkHandler { activity
|
|
174
|
+
NamiPaywallManager.registerDeepLinkHandler { activity, url ->
|
|
217
175
|
latestPaywallActivity = activity
|
|
218
176
|
reactApplicationContext
|
|
219
177
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
220
178
|
.emit("PaywallDeeplinkAction", url)
|
|
221
179
|
}
|
|
222
|
-
|
|
223
180
|
}
|
|
224
181
|
|
|
225
|
-
|
|
226
182
|
@ReactMethod
|
|
227
183
|
fun show() {
|
|
228
184
|
// Do nothing on Android side
|
package/ios/Nami.m
CHANGED
|
@@ -50,7 +50,7 @@ RCT_EXPORT_METHOD(configure: (NSDictionary *)configDict completion: (RCTResponse
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Start commands with header iformation for Nami to let them know this is a React client.
|
|
53
|
-
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.1.
|
|
53
|
+
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.1.17"]];
|
|
54
54
|
|
|
55
55
|
// Add additional namiCommands app may have sent in.
|
|
56
56
|
NSObject *appCommandStrings = configDict[@"namiCommands"];
|
|
@@ -42,35 +42,24 @@ class RNNamiPaywallManager: RCTEventEmitter {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
let namiSku = NamiSKU(namiId: namiId, storeId: storeId, skuType: namiSkuType)
|
|
45
|
+
let priceString = dict["price"] as? String ?? "0"
|
|
45
46
|
|
|
46
47
|
do {
|
|
47
|
-
let
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if
|
|
52
|
-
let transactionID = dict["transactionID"] as? String,
|
|
53
|
-
let originalTransactionID = dict["originalTransactionID"] as? String,
|
|
54
|
-
let priceDecimal = Decimal(string: dict["price"] as! String),
|
|
55
|
-
let currencyCode = dict["currencyCode"] as? String,
|
|
56
|
-
let localeString = dict["locale"] as? String
|
|
48
|
+
if let transactionID = dict["transactionID"] as? String,
|
|
49
|
+
let originalTransactionID = dict["originalTransactionID"] as? String,
|
|
50
|
+
let priceDecimal = Decimal(string: priceString),
|
|
51
|
+
let currencyCode = dict["currencyCode"] as? String
|
|
57
52
|
{
|
|
58
|
-
let expiresDate = Date(timeIntervalSince1970: dict["purchaseDate"] as! Double? ?? 0)
|
|
59
|
-
let originalPurchaseDate = Date(timeIntervalSince1970: dict["originalPurchaseDate"] as! Double)
|
|
60
|
-
let purchaseDate = Date(timeIntervalSince1970: dict["purchaseDate"] as! Double)
|
|
61
|
-
let locale = Locale(identifier: localeString)
|
|
62
53
|
let purchaseSuccess = NamiPurchaseSuccess(
|
|
63
54
|
product: namiSku,
|
|
64
55
|
transactionID: transactionID,
|
|
65
56
|
originalTransactionID: originalTransactionID,
|
|
66
|
-
originalPurchaseDate: originalPurchaseDate,
|
|
67
|
-
purchaseDate: purchaseDate,
|
|
68
|
-
expiresDate: expiresDate,
|
|
69
57
|
price: priceDecimal,
|
|
70
|
-
currencyCode: currencyCode
|
|
71
|
-
locale: locale
|
|
58
|
+
currencyCode: currencyCode
|
|
72
59
|
)
|
|
73
60
|
NamiPaywallManager.buySkuComplete(purchaseSuccess: purchaseSuccess)
|
|
61
|
+
} else {
|
|
62
|
+
print("RNNamiPaywallManager - buySkuComplete payload error \(dict)")
|
|
74
63
|
}
|
|
75
64
|
} catch {
|
|
76
65
|
print("RNNamiPaywallManager - buySkuComplete error - decoding JSON: \(error)")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nami-sdk",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.17",
|
|
4
4
|
"description": "React Native Module for Nami - Easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -32,28 +32,18 @@ export type NamiPurchaseSuccessApple = {
|
|
|
32
32
|
product: NamiSKU;
|
|
33
33
|
transactionID: string;
|
|
34
34
|
originalTransactionID: string;
|
|
35
|
-
originalPurchaseDate: number;
|
|
36
|
-
purchaseDate: number;
|
|
37
|
-
expiresDate?: number;
|
|
38
35
|
price: string;
|
|
39
36
|
currencyCode: string;
|
|
40
|
-
locale: string;
|
|
41
37
|
};
|
|
42
38
|
|
|
43
39
|
export type NamiPurchaseSuccessGooglePlay = {
|
|
44
40
|
product: NamiSKU;
|
|
45
41
|
orderId: string;
|
|
46
|
-
purchaseDate: number;
|
|
47
|
-
expiresDate?: number;
|
|
48
42
|
purchaseToken: string;
|
|
49
|
-
purchaseSource: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
|
|
50
43
|
};
|
|
51
44
|
|
|
52
45
|
export type NamiPurchaseSuccessAmazon = {
|
|
53
46
|
product: NamiSKU;
|
|
54
|
-
purchaseDate: number;
|
|
55
|
-
expiresDate?: number;
|
|
56
|
-
purchaseSource: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
|
|
57
47
|
receiptId: string;
|
|
58
48
|
localizedPrice: string;
|
|
59
49
|
userId: string;
|
package/src/types.ts
CHANGED
|
@@ -228,33 +228,23 @@ export type NamiEntitlement = {
|
|
|
228
228
|
relatedSkus: NamiSKU[];
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
//
|
|
231
|
+
// NamiPaywallManager
|
|
232
232
|
export type NamiPurchaseSuccessApple = {
|
|
233
233
|
product: NamiSKU;
|
|
234
234
|
transactionID: string;
|
|
235
235
|
originalTransactionID: string;
|
|
236
|
-
originalPurchaseDate: number;
|
|
237
|
-
purchaseDate: number;
|
|
238
|
-
expiresDate?: number;
|
|
239
236
|
price: string;
|
|
240
237
|
currencyCode: string;
|
|
241
|
-
locale: string;
|
|
242
238
|
};
|
|
243
239
|
|
|
244
240
|
export type NamiPurchaseSuccessGooglePlay = {
|
|
245
241
|
product: NamiSKU;
|
|
246
242
|
orderId: string;
|
|
247
|
-
purchaseDate: number;
|
|
248
|
-
expiresDate?: number;
|
|
249
243
|
purchaseToken: string;
|
|
250
|
-
purchaseSource: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
|
|
251
244
|
};
|
|
252
245
|
|
|
253
246
|
export type NamiPurchaseSuccessAmazon = {
|
|
254
247
|
product: NamiSKU;
|
|
255
|
-
purchaseDate: number;
|
|
256
|
-
expiresDate?: number;
|
|
257
|
-
purchaseSource: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';
|
|
258
248
|
receiptId: string;
|
|
259
249
|
localizedPrice: string;
|
|
260
250
|
userId: string;
|