react-native-nami-sdk 3.3.0-4 → 3.3.0-7
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 +2 -2
- package/android/src/main/java/com/namiml/reactnative/NamiCampaignManagerBridge.kt +1 -2
- package/android/src/main/java/com/namiml/reactnative/NamiPaywallManagerBridgeModule.kt +2 -1
- package/android/src/main/java/com/namiml/reactnative/NamiUtil.kt +35 -0
- package/dist/specs/NativeNamiPaywallManager.d.ts +1 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/version.d.ts +1 -1
- package/ios/NamiPaywallManagerBridge.swift +4 -0
- package/package.json +1 -1
- package/react-native-nami-sdk.podspec +6 -0
- package/specs/NativeNamiPaywallManager.ts +1 -0
- package/src/NamiPaywallManager.ts +3 -3
- package/src/types.ts +1 -0
- package/src/version.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -85,8 +85,8 @@ dependencies {
|
|
|
85
85
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
86
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
87
87
|
|
|
88
|
-
playImplementation "com.namiml:sdk-android:3.3.0.
|
|
89
|
-
amazonImplementation "com.namiml:sdk-amazon:3.3.0.
|
|
88
|
+
playImplementation "com.namiml:sdk-android:3.3.0.2"
|
|
89
|
+
amazonImplementation "com.namiml:sdk-amazon:3.3.0.2"
|
|
90
90
|
|
|
91
91
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
92
92
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
|
|
@@ -158,8 +158,7 @@ class NamiCampaignManagerBridgeModule internal constructor(
|
|
|
158
158
|
paywallEvent: NamiPaywallEvent,
|
|
159
159
|
actionCallback: Callback,
|
|
160
160
|
) {
|
|
161
|
-
val actionString = paywallEvent.action.
|
|
162
|
-
|
|
161
|
+
val actionString = paywallEvent.action.toRNActionString()
|
|
163
162
|
val purchasesArray = createPurchaseArray(paywallEvent.purchases)
|
|
164
163
|
|
|
165
164
|
val resultMap =
|
|
@@ -24,11 +24,12 @@ class NamiPaywallManagerBridgeModule internal constructor(
|
|
|
24
24
|
private var latestPaywallActivity: Activity? = null
|
|
25
25
|
|
|
26
26
|
@ReactMethod
|
|
27
|
-
fun buySkuComplete(dict: ReadableMap
|
|
27
|
+
fun buySkuComplete(dict: ReadableMap) {
|
|
28
28
|
val product = dict.getMap("product")
|
|
29
29
|
val productId = product?.getString("id")
|
|
30
30
|
val skuRefId = product?.getString("skuId")
|
|
31
31
|
val typeString = product?.getString("type")
|
|
32
|
+
val storeType = dict.getString("storeType") ?: "GooglePlay"
|
|
32
33
|
var purchaseSuccess: NamiPurchaseSuccess? = null
|
|
33
34
|
|
|
34
35
|
if (productId != null && skuRefId != null) {
|
|
@@ -15,6 +15,41 @@ import java.text.SimpleDateFormat
|
|
|
15
15
|
import java.util.Date
|
|
16
16
|
import java.util.Locale
|
|
17
17
|
import java.util.TimeZone
|
|
18
|
+
import com.namiml.paywall.model.NamiPaywallAction
|
|
19
|
+
|
|
20
|
+
fun NamiPaywallAction.toRNActionString(): String {
|
|
21
|
+
return when (this) {
|
|
22
|
+
NamiPaywallAction.NAMI_BUY_SKU -> "BUY_SKU"
|
|
23
|
+
NamiPaywallAction.NAMI_SELECT_SKU -> "SELECT_SKU"
|
|
24
|
+
NamiPaywallAction.NAMI_RESTORE_PURCHASES -> "RESTORE_PURCHASES"
|
|
25
|
+
NamiPaywallAction.NAMI_SHOW_PAYWALL -> "SHOW_PAYWALL"
|
|
26
|
+
NamiPaywallAction.NAMI_CLOSE_PAYWALL -> "CLOSE_PAYWALL"
|
|
27
|
+
NamiPaywallAction.NAMI_SIGN_IN -> "SIGN_IN"
|
|
28
|
+
NamiPaywallAction.NAMI_PURCHASE_SELECTED_SKU -> "PURCHASE_SELECTED_SKU"
|
|
29
|
+
NamiPaywallAction.NAMI_PURCHASE_SUCCESS -> "PURCHASE_SUCCESS"
|
|
30
|
+
NamiPaywallAction.NAMI_PURCHASE_FAILED -> "PURCHASE_FAILED"
|
|
31
|
+
NamiPaywallAction.NAMI_PURCHASE_CANCELLED -> "PURCHASE_CANCELLED"
|
|
32
|
+
NamiPaywallAction.NAMI_PURCHASE_PENDING -> "PURCHASE_PENDING"
|
|
33
|
+
NamiPaywallAction.NAMI_PURCHASE_UNKNOWN -> "PURCHASE_UNKNOWN"
|
|
34
|
+
NamiPaywallAction.NAMI_DEEP_LINK -> "DEEPLINK"
|
|
35
|
+
NamiPaywallAction.NAMI_TOGGLE_CHANGE -> "TOGGLE_CHANGE"
|
|
36
|
+
NamiPaywallAction.NAMI_PAGE_CHANGE -> "PAGE_CHANGE"
|
|
37
|
+
NamiPaywallAction.NAMI_SLIDE_CHANGE -> "SLIDE_CHANGE"
|
|
38
|
+
NamiPaywallAction.NAMI_COLLAPSIBLE_DRAWER_OPEN -> "COLLAPSIBLE_DRAWER_OPEN"
|
|
39
|
+
NamiPaywallAction.NAMI_COLLAPSIBLE_DRAWER_CLOSE -> "COLLAPSIBLE_DRAWER_CLOSE"
|
|
40
|
+
NamiPaywallAction.NAMI_VIDEO_STARTED -> "VIDEO_STARTED"
|
|
41
|
+
NamiPaywallAction.NAMI_VIDEO_PAUSED -> "VIDEO_PAUSED"
|
|
42
|
+
NamiPaywallAction.NAMI_VIDEO_RESUMED -> "VIDEO_RESUMED"
|
|
43
|
+
NamiPaywallAction.NAMI_VIDEO_ENDED -> "VIDEO_ENDED"
|
|
44
|
+
NamiPaywallAction.NAMI_VIDEO_CHANGED -> "VIDEO_CHANGED"
|
|
45
|
+
NamiPaywallAction.NAMI_VIDEO_MUTED -> "VIDEO_MUTED"
|
|
46
|
+
NamiPaywallAction.NAMI_VIDEO_UNMUTED -> "VIDEO_UNMUTED"
|
|
47
|
+
else -> {
|
|
48
|
+
Log.w("NamiUtil", "Unhandled NamiPaywallAction: $this. This might indicate a new enum value added in the SDK.")
|
|
49
|
+
"UNKNOWN"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
18
53
|
|
|
19
54
|
fun List<*>.toWritableArray(): WritableArray {
|
|
20
55
|
val convertedArray = Arguments.createArray()
|
package/dist/src/types.d.ts
CHANGED
package/dist/src/version.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ class RNNamiPaywallManager: RCTEventEmitter {
|
|
|
48
48
|
let namiSku = NamiSKU(namiId: namiId, storeId: storeId, skuType: namiSkuType)
|
|
49
49
|
let priceString = dict["price"] as? String ?? "0"
|
|
50
50
|
|
|
51
|
+
if let store = dict["storeType"] as? String, store != "Apple" {
|
|
52
|
+
print("RNNamiPaywallManager - buySkuComplete called with the wrong store type \(dict)")
|
|
53
|
+
}
|
|
54
|
+
|
|
51
55
|
do {
|
|
52
56
|
if let transactionID = dict["transactionID"] as? String,
|
|
53
57
|
let originalTransactionID = dict["originalTransactionID"] as? String,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nami-sdk",
|
|
3
|
-
"version": "3.3.0-
|
|
3
|
+
"version": "3.3.0-7",
|
|
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": "dist/index.d.ts",
|
|
@@ -35,15 +35,15 @@ export const NamiPaywallManager = {
|
|
|
35
35
|
|
|
36
36
|
// Compatibility shims
|
|
37
37
|
buySkuCompleteApple: (purchase: NamiPurchaseSuccessApple): void => {
|
|
38
|
-
RNNamiPaywallManager.
|
|
38
|
+
RNNamiPaywallManager.buySkuComplete(purchase);
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
buySkuCompleteAmazon: (purchase: NamiPurchaseSuccessAmazon): void => {
|
|
42
|
-
RNNamiPaywallManager.
|
|
42
|
+
RNNamiPaywallManager.buySkuComplete(purchase);
|
|
43
43
|
},
|
|
44
44
|
|
|
45
45
|
buySkuCompleteGooglePlay: (purchase: NamiPurchaseSuccessGooglePlay): void => {
|
|
46
|
-
RNNamiPaywallManager.
|
|
46
|
+
RNNamiPaywallManager.buySkuComplete(purchase);
|
|
47
47
|
},
|
|
48
48
|
|
|
49
49
|
registerBuySkuHandler: (callback: (sku: NamiSKU) => void): (() => void) => {
|
package/src/types.ts
CHANGED
package/src/version.ts
CHANGED