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.
@@ -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.1"
89
- amazonImplementation "com.namiml:sdk-amazon:3.3.0.1"
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.toString()
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, storeType: String) {
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()
@@ -17,6 +17,7 @@ export interface Spec extends TurboModule {
17
17
  marketplace?: string;
18
18
  price?: string;
19
19
  currencyCode?: string;
20
+ storeType?: string;
20
21
  }): void;
21
22
  buySkuCompleteApple(purchase: {
22
23
  product: {
@@ -123,6 +123,7 @@ export type NamiPurchaseDetails = {
123
123
  currencyCode?: string;
124
124
  userId?: string;
125
125
  marketplace?: string;
126
+ storeType?: string;
126
127
  };
127
128
  export type NamiPurchaseSuccessApple = {
128
129
  product: NamiSKU;
@@ -2,4 +2,4 @@
2
2
  * Auto-generated file. Do not edit manually.
3
3
  * React Native Nami SDK version.
4
4
  */
5
- export declare const NAMI_REACT_NATIVE_VERSION = "3.3.0-4";
5
+ export declare const NAMI_REACT_NATIVE_VERSION = "3.3.0-7";
@@ -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-4",
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",
@@ -31,4 +31,10 @@ Pod::Spec.new do |s|
31
31
 
32
32
  install_modules_dependencies(s)
33
33
 
34
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
35
+ s.pod_target_xcconfig = {
36
+ 'USE_HEADERMAP' => 'YES',
37
+ }
38
+ end
39
+
34
40
  end
@@ -20,6 +20,7 @@ export interface Spec extends TurboModule {
20
20
  marketplace?: string;
21
21
  price?: string;
22
22
  currencyCode?: string;
23
+ storeType?: string;
23
24
  }): void;
24
25
 
25
26
  // Backward compatibility methods
@@ -35,15 +35,15 @@ export const NamiPaywallManager = {
35
35
 
36
36
  // Compatibility shims
37
37
  buySkuCompleteApple: (purchase: NamiPurchaseSuccessApple): void => {
38
- RNNamiPaywallManager.buySkuCompleteApple(purchase);
38
+ RNNamiPaywallManager.buySkuComplete(purchase);
39
39
  },
40
40
 
41
41
  buySkuCompleteAmazon: (purchase: NamiPurchaseSuccessAmazon): void => {
42
- RNNamiPaywallManager.buySkuCompleteAmazon(purchase);
42
+ RNNamiPaywallManager.buySkuComplete(purchase);
43
43
  },
44
44
 
45
45
  buySkuCompleteGooglePlay: (purchase: NamiPurchaseSuccessGooglePlay): void => {
46
- RNNamiPaywallManager.buySkuCompleteGooglePlay(purchase);
46
+ RNNamiPaywallManager.buySkuComplete(purchase);
47
47
  },
48
48
 
49
49
  registerBuySkuHandler: (callback: (sku: NamiSKU) => void): (() => void) => {
package/src/types.ts CHANGED
@@ -255,6 +255,7 @@ export type NamiPurchaseDetails = {
255
255
  currencyCode?: string;
256
256
  userId?: string;
257
257
  marketplace?: string;
258
+ storeType?: string; // 'Apple', 'GooglePlay', 'Amazon'
258
259
  };
259
260
 
260
261
  export type NamiPurchaseSuccessApple = {
package/src/version.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Auto-generated file. Do not edit manually.
3
3
  * React Native Nami SDK version.
4
4
  */
5
- export const NAMI_REACT_NATIVE_VERSION = '3.3.0-4';
5
+ export const NAMI_REACT_NATIVE_VERSION = '3.3.0-7';