react-native-nami-sdk 3.0.29 → 3.0.31

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.
@@ -65,7 +65,7 @@ repositories {
65
65
  mavenCentral()
66
66
  // ref: https://www.baeldung.com/maven-local-repository
67
67
  mavenLocal()
68
- maven { url("https://packages.namiml.com/NamiSDK/Android/") }
68
+ maven { url("https://packages.namiml.com/NamiSDK/Amazon/") }
69
69
  maven { url 'https://jitpack.io' }
70
70
  maven {
71
71
  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
@@ -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
- implementation "com.namiml:sdk-android:3.1.3"
87
+ compileOnly "com.namiml:sdk-amazon:3.1.7"
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"
@@ -115,7 +115,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
115
115
  } else {
116
116
  Arguments.createArray()
117
117
  }
118
- val settingsList = mutableListOf("extendedClientInfo:react-native:3.0.29")
118
+ val settingsList = mutableListOf("extendedClientInfo:react-native:3.0.31")
119
119
  namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
120
120
  settingsList.addAll(commandsFromReact)
121
121
  }
@@ -61,6 +61,11 @@ class NamiEntitlementManagerBridgeModule(reactContext: ReactApplicationContext)
61
61
  }
62
62
  }
63
63
 
64
+ @ReactMethod
65
+ fun clearProvisionalEntitlementGrants() {
66
+ NamiEntitlementManager.clearProvisionalEntitlementGrants()
67
+ }
68
+
64
69
  @ReactMethod
65
70
  fun addListener(eventName: String?) {
66
71
  }
@@ -235,6 +235,18 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
235
235
  }
236
236
  }
237
237
 
238
+ @ReactMethod
239
+ fun registerDeeplinkActionHandler() {
240
+ NamiPaywallManager.registerDeepLinkHandler { activity , url ->
241
+ latestPaywallActivity = activity
242
+ reactApplicationContext
243
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
244
+ .emit("PaywallDeeplinkAction", url)
245
+ }
246
+
247
+ }
248
+
249
+
238
250
  @ReactMethod
239
251
  fun show() {
240
252
  // Do nothing on Android side
@@ -251,6 +263,11 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
251
263
  promise.resolve(false)
252
264
  }
253
265
 
266
+ @ReactMethod
267
+ fun buySkuCancel() {
268
+ NamiPaywallManager.buySkuCancel()
269
+ }
270
+
254
271
  @ReactMethod
255
272
  fun addListener(eventName: String?) {
256
273
  }
package/ios/Nami.m CHANGED
@@ -52,7 +52,7 @@ RCT_EXPORT_METHOD(configure: (NSDictionary *)configDict completion: (RCTResponse
52
52
  }
53
53
 
54
54
  // Start commands with header iformation for Nami to let them know this is a React client.
55
- NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.0.29"]];
55
+ NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.0.31"]];
56
56
 
57
57
  // Add additional namiCommands app may have sent in.
58
58
  NSObject *appCommandStrings = configDict[@"namiCommands"];
@@ -63,6 +63,8 @@ class RNNamiCampaignManager: RCTEventEmitter {
63
63
  actionString = "PURCHASE_SELECTED_SKU"
64
64
  case .purchase_success:
65
65
  actionString = "PURCHASE_SUCCESS"
66
+ case .purchase_pending:
67
+ actionString = "PURCHASE_PENDING"
66
68
  case .purchase_deferred:
67
69
  actionString = "PURCHASE_DEFERRED"
68
70
  case .purchase_failed:
@@ -18,6 +18,8 @@ RCT_EXTERN_METHOD(refresh)
18
18
 
19
19
  RCT_EXTERN_METHOD(registerActiveEntitlementsHandler)
20
20
 
21
+ RCT_EXTERN_METHOD(clearProvisionalEntitlementGrants)
22
+
21
23
  + (BOOL)requiresMainQueueSetup {
22
24
  return YES;
23
25
  }
@@ -36,6 +36,7 @@ class RNNamiEntitlementManager: RCTEventEmitter {
36
36
  let dictionary = RNNamiPurchaseManager.skuToSKUDict(sku)
37
37
  return dictionary
38
38
  }
39
+
39
40
  let dictionary: [String: Any?] = [
40
41
  "name": entitlement.name,
41
42
  "desc": entitlement.desc,
@@ -78,4 +79,9 @@ class RNNamiEntitlementManager: RCTEventEmitter {
78
79
  RNNamiEntitlementManager.shared?.sendEvent(withName: "EntitlementsChanged", body: dictionaries)
79
80
  }
80
81
  }
82
+
83
+ @objc(clearProvisionalEntitlementGrants)
84
+ func clearProvisionalEntitlementGrants() {
85
+ NamiEntitlementManager.clearProvisionalEntitlementGrants()
86
+ }
81
87
  }
@@ -25,6 +25,8 @@ RCT_EXTERN_METHOD(registerSignInHandler)
25
25
 
26
26
  RCT_EXTERN_METHOD(registerRestoreHandler)
27
27
 
28
+ RCT_EXTERN_METHOD(registerDeeplinkActionHandler)
29
+
28
30
  RCT_EXTERN_METHOD(dismiss:(BOOL)animated)
29
31
 
30
32
  RCT_EXTERN_METHOD(show)
@@ -33,6 +35,8 @@ RCT_EXTERN_METHOD(hide)
33
35
 
34
36
  RCT_EXTERN_METHOD(isHidden:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
35
37
 
38
+ RCT_EXTERN_METHOD(buySkuCancel)
39
+
36
40
  + (BOOL)requiresMainQueueSetup {
37
41
  return YES;
38
42
  }
@@ -19,7 +19,7 @@ class RNNamiPaywallManager: RCTEventEmitter {
19
19
  }
20
20
 
21
21
  override func supportedEvents() -> [String]! {
22
- return ["RegisterBuySKU", "PaywallCloseRequested", "PaywallSignInRequested", "PaywallRestoreRequested"]
22
+ return ["RegisterBuySKU", "PaywallCloseRequested", "PaywallSignInRequested", "PaywallRestoreRequested", "PaywallDeeplinkAction"]
23
23
  }
24
24
 
25
25
  @objc(buySkuComplete:)
@@ -111,6 +111,13 @@ class RNNamiPaywallManager: RCTEventEmitter {
111
111
  }
112
112
  }
113
113
 
114
+ @objc(registerDeeplinkActionHandler)
115
+ func registerDeeplinkActionHandler() {
116
+ NamiPaywallManager.registerDeeplinkActionHandler { url in
117
+ RNNamiPaywallManager.shared?.sendEvent(withName: "PaywallDeeplinkAction", body: url)
118
+ }
119
+ }
120
+
114
121
  @objc(dismiss:)
115
122
  func dismiss(animated: Bool) {
116
123
  NamiPaywallManager.dismiss(animated: animated) {}
@@ -130,6 +137,13 @@ class RNNamiPaywallManager: RCTEventEmitter {
130
137
  }
131
138
  }
132
139
 
140
+ @objc(buySkuCancel)
141
+ func buySkuCancel() {
142
+ DispatchQueue.main.async {
143
+ NamiPaywallManager.buySkuCancel()
144
+ }
145
+ }
146
+
133
147
  @objc(isHidden:rejecter:)
134
148
  func isHidden(resolve: @escaping RCTPromiseResolveBlock, reject _: @escaping RCTPromiseRejectBlock) {
135
149
  DispatchQueue.main.async {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nami-sdk",
3
- "version": "3.0.29",
3
+ "version": "3.0.31",
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",
@@ -20,7 +20,7 @@ Pod::Spec.new do |s|
20
20
  s.source_files = "ios/**/*.{h,m,swift}"
21
21
  s.requires_arc = true
22
22
 
23
- s.dependency 'Nami', '3.1.4'
23
+ s.dependency 'Nami', '3.1.7'
24
24
  s.dependency 'React'
25
25
 
26
26
  end
@@ -10,6 +10,7 @@ export const NamiEntitlementManager: {
10
10
  registerActiveEntitlementsHandler: (
11
11
  callback: (activeEntitlements: NamiEntitlement[]) => void,
12
12
  ) => EmitterSubscription['remove'];
13
+ clearProvisionalEntitlementGrants: () => void;
13
14
  };
14
15
 
15
16
  export type NamiEntitlement = {
@@ -22,6 +22,7 @@ export interface INamiEntitlementManager {
22
22
  registerActiveEntitlementsHandler: (
23
23
  callback: (activeEntitlements: NamiEntitlement[]) => void,
24
24
  ) => EmitterSubscription['remove'];
25
+ clearProvisionalEntitlementGrants: () => void;
25
26
  }
26
27
 
27
28
  export const NamiEntitlementManager: INamiEntitlementManager = {
@@ -18,8 +18,12 @@ export const NamiPaywallManager: {
18
18
  registerRestoreHandler: (
19
19
  callback: () => void,
20
20
  ) => EmitterSubscription['remove'];
21
+ registerDeeplinkActionHandler: (
22
+ callback: (url: string) => void,
23
+ ) => EmitterSubscription['remove'];
21
24
  show: () => void;
22
25
  hide: () => void;
26
+ buySkuCancel: () => void;
23
27
  isHidden: () => Promise<boolean>;
24
28
  };
25
29
 
@@ -15,6 +15,7 @@ export enum NamiPaywallManagerEvents {
15
15
  PaywallCloseRequested = 'PaywallCloseRequested',
16
16
  PaywallSignInRequested = 'PaywallSignInRequested',
17
17
  PaywallRestoreRequested = 'PaywallRestoreRequested',
18
+ PaywallDeeplinkAction = 'PaywallDeeplinkAction',
18
19
  }
19
20
 
20
21
  export enum ServicesEnum {
@@ -39,6 +40,9 @@ export interface INamiPaywallManager {
39
40
  registerRestoreHandler: (
40
41
  callback: () => void,
41
42
  ) => EmitterSubscription['remove'];
43
+ registerDeeplinkActionHandler: (
44
+ callback: (url: string) => void,
45
+ ) => EmitterSubscription['remove'];
42
46
  dismiss: (animated?: boolean) => void;
43
47
  show: () => void;
44
48
  hide: () => void;
@@ -65,9 +69,11 @@ export const NamiPaywallManager: INamiPaywallManager = {
65
69
  ServicesEnum.GooglePlay,
66
70
  );
67
71
  },
72
+ buySkuCancel: () => {
73
+ RNNamiPaywallManager.buySkuCancel();
74
+ },
68
75
  registerBuySkuHandler: (callback: (sku: NamiSKU) => void) => {
69
- let subscription;
70
- subscription = NamiPaywallManager.paywallEmitter.addListener(
76
+ let subscription = NamiPaywallManager.paywallEmitter.addListener(
71
77
  NamiPaywallManagerEvents.RegisterBuySKU,
72
78
  sku => {
73
79
  callback(sku);
@@ -81,8 +87,7 @@ export const NamiPaywallManager: INamiPaywallManager = {
81
87
  };
82
88
  },
83
89
  registerCloseHandler: (callback: (body: any) => void) => {
84
- let subscription;
85
- subscription = NamiPaywallManager.paywallEmitter.addListener(
90
+ let subscription = NamiPaywallManager.paywallEmitter.addListener(
86
91
  NamiPaywallManagerEvents.PaywallCloseRequested,
87
92
  body => {
88
93
  callback(body);
@@ -96,8 +101,7 @@ export const NamiPaywallManager: INamiPaywallManager = {
96
101
  };
97
102
  },
98
103
  registerSignInHandler(callback) {
99
- let subscription;
100
- subscription = NamiPaywallManager.paywallEmitter.addListener(
104
+ let subscription = NamiPaywallManager.paywallEmitter.addListener(
101
105
  NamiPaywallManagerEvents.PaywallSignInRequested,
102
106
  () => {
103
107
  callback();
@@ -112,8 +116,7 @@ export const NamiPaywallManager: INamiPaywallManager = {
112
116
  };
113
117
  },
114
118
  registerRestoreHandler(callback) {
115
- let subscription;
116
- subscription = NamiPaywallManager.paywallEmitter.addListener(
119
+ let subscription = NamiPaywallManager.paywallEmitter.addListener(
117
120
  NamiPaywallManagerEvents.PaywallRestoreRequested,
118
121
  () => {
119
122
  callback();
@@ -126,6 +129,20 @@ export const NamiPaywallManager: INamiPaywallManager = {
126
129
  }
127
130
  };
128
131
  },
132
+ registerDeeplinkActionHandler: (callback: (url: string) => void) => {
133
+ let subscription = NamiPaywallManager.paywallEmitter.addListener(
134
+ NamiPaywallManagerEvents.PaywallDeeplinkAction,
135
+ url => {
136
+ callback(url);
137
+ },
138
+ );
139
+ RNNamiPaywallManager.registerDeeplinkActionHandler();
140
+ return () => {
141
+ if (subscription) {
142
+ subscription.remove();
143
+ }
144
+ };
145
+ },
129
146
  dismiss: (animated?: boolean) => {
130
147
  RNNamiPaywallManager.dismiss(animated ?? true);
131
148
  },