react-native-iap 12.15.2 → 12.15.4

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/README.md CHANGED
@@ -67,6 +67,12 @@ a link to your website. [Buy me a coffee](https://www.buymeacoffee.com/dooboolab
67
67
  [Become a sponsor](https://opencollective.com/react-native-iap#sponsor).
68
68
  <a href="https://opencollective.com/react-native-iap#sponsors" target="_blank"><img src="https://opencollective.com/react-native-iap/sponsors.svg?width=890" /></a>
69
69
 
70
+ ## Need Help Implementing/Debugging/Testing your IAP project?
71
+
72
+ Please take a look at [iap.dev/consulting](https://iap.dev/consulting). At iap.dev, we offer IAP consulting services for all platforms. Please [Contact Us](https://console.iap.dev/contact-us).
73
+
74
+ Note: This service is not affiliated with dooboolab. It was created by [andresesfm](https://github.com/andresesfm) who has contributed and provided support for this project
75
+
70
76
  ### Backers
71
77
 
72
78
  Please be our [Backers](https://opencollective.com/react-native-iap#backer).
@@ -5,7 +5,7 @@ RNIap_compileSdkVersion=33
5
5
  RNIap_buildToolsVersion=33.0.0
6
6
  RNIap_ndkversion=23.1.7779620
7
7
  RNIap_playServicesVersion=18.1.0
8
- RNIap_amazonSdkVersion=3.0.4
8
+ RNIap_amazonSdkVersion=3.0.5
9
9
  RNIap_playBillingSdkVersion=7.0.0
10
10
 
11
11
  android.useAndroidX=true
@@ -72,6 +72,7 @@ func serialize(_ sp: Product.SubscriptionPeriod.Unit?) -> String? {
72
72
  case .week: return "week"
73
73
  case .month: return "month"
74
74
  case .year: return "year"
75
+
75
76
  default:
76
77
  return nil
77
78
  }
@@ -112,6 +113,7 @@ func serialize(_ rs: Product.SubscriptionInfo.RenewalState?) -> String? {
112
113
  case .inGracePeriod: return "inGracePeriod"
113
114
  case .revoked: return "revoked"
114
115
  case .subscribed: return "subscribed"
116
+
115
117
  default:
116
118
  return nil
117
119
  }
@@ -144,6 +146,7 @@ func serialize(_ pm: Product.SubscriptionOffer.PaymentMode?) -> String? {
144
146
  case .freeTrial: return "freeTrial"
145
147
  case .payAsYouGo: return "payAsYouGo"
146
148
  case .payUpFront: return "payUpFront"
149
+
147
150
  default:
148
151
  return nil
149
152
  }
@@ -154,6 +157,7 @@ func serialize(_ ot: Product.SubscriptionOffer.OfferType?) -> String? {
154
157
  switch ot {
155
158
  case .introductory: return "introductory"
156
159
  case .promotional: return "promotional"
160
+
157
161
  default:
158
162
  return nil
159
163
  }
@@ -212,6 +216,7 @@ func serialize(_ ot: Transaction.OfferType?) -> String? {
212
216
  case .promotional: return "promotional"
213
217
  case .introductory: return "introductory"
214
218
  case .code: return "code"
219
+
215
220
  default:
216
221
  return nil
217
222
  }
@@ -222,6 +227,7 @@ func serialize(_ ot: Transaction.OwnershipType?) -> String? {
222
227
  switch ot {
223
228
  case .purchased: return "purchased"
224
229
  case .familyShared: return "familyShared"
230
+
225
231
  default:
226
232
  return nil
227
233
  }
@@ -234,6 +240,7 @@ func serialize(_ pt: Product.ProductType?) -> String? {
234
240
  case .consumable: return "consumable"
235
241
  case .nonConsumable: return "nonConsumable"
236
242
  case .nonRenewable: return "nonRenewable"
243
+
237
244
  default:
238
245
  return nil
239
246
  }
@@ -743,8 +743,10 @@ class RNIapIos: RCTEventEmitter, SKRequestDelegate, SKPaymentTransactionObserver
743
743
  switch discount.type {
744
744
  case SKProductDiscount.Type.introductory:
745
745
  discountType = "INTRODUCTORY"
746
+
746
747
  case SKProductDiscount.Type.subscription:
747
748
  discountType = "SUBSCRIPTION"
749
+
748
750
  default:
749
751
  discountType = ""
750
752
  }
@@ -718,6 +718,7 @@ class RNIapIosSk2iOS15: Sk2Delegate {
718
718
 
719
719
  var result: Product.PurchaseResult?
720
720
 
721
+ #if swift(>=5.9)
721
722
  if #available(iOS 17.0, tvOS 17.0, *) {
722
723
  result = try await product.purchase(confirmIn: windowScene, options: options)
723
724
  } else {
@@ -725,6 +726,10 @@ class RNIapIosSk2iOS15: Sk2Delegate {
725
726
  result = try await product.purchase(options: options)
726
727
  #endif
727
728
  }
729
+ #elseif !os(visionOS)
730
+ result = try await product.purchase(options: options)
731
+ #endif
732
+
728
733
  switch result {
729
734
  case .success(let verification):
730
735
  debugMessage("Purchase Successful")
@@ -1005,6 +1010,7 @@ class RNIapIosSk2iOS15: Sk2Delegate {
1005
1010
  switch rs {
1006
1011
  case .success: return "success"
1007
1012
  case .userCancelled: return "userCancelled"
1013
+
1008
1014
  default:
1009
1015
  return nil
1010
1016
  }
@@ -40,14 +40,20 @@ const App = () => {
40
40
  };
41
41
  ```
42
42
  */
43
- const purchaseUpdatedListener = listener => {
43
+ const purchaseUpdatedListener = (listener, errorCallback) => {
44
44
  const eventEmitter = new _reactNative.NativeEventEmitter((0, _internal.getNativeModule)());
45
45
  const proxyListener = (0, _iap.isIosStorekit2)() ? event => {
46
46
  listener((0, _appleSk.transactionSk2ToPurchaseMap)(event));
47
47
  } : listener;
48
48
  const emitterSubscription = eventEmitter.addListener('purchase-updated', proxyListener);
49
49
  if (_internal.isAndroid) {
50
- (0, _internal.getAndroidModule)().startListening();
50
+ (0, _internal.getAndroidModule)().startListening().catch(error => {
51
+ if (errorCallback) {
52
+ errorCallback(error);
53
+ } else {
54
+ throw error;
55
+ }
56
+ });
51
57
  }
52
58
  return emitterSubscription;
53
59
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_appleSk","_iap","_internal","purchaseUpdatedListener","listener","eventEmitter","NativeEventEmitter","getNativeModule","proxyListener","isIosStorekit2","event","transactionSk2ToPurchaseMap","emitterSubscription","addListener","isAndroid","getAndroidModule","startListening","exports","purchaseErrorListener","promotedProductListener","isIos","getIosModule","transactionListener"],"sourceRoot":"../../src","sources":["eventEmitter.ts"],"mappings":"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"}
1
+ {"version":3,"names":["_reactNative","require","_appleSk","_iap","_internal","purchaseUpdatedListener","listener","errorCallback","eventEmitter","NativeEventEmitter","getNativeModule","proxyListener","isIosStorekit2","event","transactionSk2ToPurchaseMap","emitterSubscription","addListener","isAndroid","getAndroidModule","startListening","catch","error","exports","purchaseErrorListener","promotedProductListener","isIos","getIosModule","transactionListener"],"sourceRoot":"../../src","sources":["eventEmitter.ts"],"mappings":"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"}
@@ -34,14 +34,20 @@ const App = () => {
34
34
  };
35
35
  ```
36
36
  */
37
- export const purchaseUpdatedListener = listener => {
37
+ export const purchaseUpdatedListener = (listener, errorCallback) => {
38
38
  const eventEmitter = new NativeEventEmitter(getNativeModule());
39
39
  const proxyListener = isIosStorekit2() ? event => {
40
40
  listener(transactionSk2ToPurchaseMap(event));
41
41
  } : listener;
42
42
  const emitterSubscription = eventEmitter.addListener('purchase-updated', proxyListener);
43
43
  if (isAndroid) {
44
- getAndroidModule().startListening();
44
+ getAndroidModule().startListening().catch(error => {
45
+ if (errorCallback) {
46
+ errorCallback(error);
47
+ } else {
48
+ throw error;
49
+ }
50
+ });
45
51
  }
46
52
  return emitterSubscription;
47
53
  };
@@ -1 +1 @@
1
- {"version":3,"names":["NativeEventEmitter","transactionSk2ToPurchaseMap","isIosStorekit2","getAndroidModule","getIosModule","getNativeModule","isAndroid","isIos","purchaseUpdatedListener","listener","eventEmitter","proxyListener","event","emitterSubscription","addListener","startListening","purchaseErrorListener","promotedProductListener","transactionListener"],"sourceRoot":"../../src","sources":["eventEmitter.ts"],"mappings":"AAAA,SAA6BA,kBAAkB,QAAO,cAAc;AAEpE,SAA0BC,2BAA2B,QAAO,kBAAkB;AAC9E,SAAQC,cAAc,QAAO,OAAO;AACpC,SACEC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,SAAS,EACTC,KAAK,QACA,YAAY;AAInB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAClCC,QAAmC,IAChC;EACH,MAAMC,YAAY,GAAG,IAAIV,kBAAkB,CAACK,eAAe,CAAC,CAAC,CAAC;EAC9D,MAAMM,aAAa,GAAGT,cAAc,CAAC,CAAC,GACjCU,KAAe,IAAK;IACnBH,QAAQ,CAACR,2BAA2B,CAACW,KAAY,CAAC,CAAC;EACrD,CAAC,GACDH,QAAQ;EACZ,MAAMI,mBAAmB,GAAGH,YAAY,CAACI,WAAW,CAClD,kBAAkB,EAClBH,aACF,CAAC;EAED,IAAIL,SAAS,EAAE;IACbH,gBAAgB,CAAC,CAAC,CAACY,cAAc,CAAC,CAAC;EACrC;EAEA,OAAOF,mBAAmB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,qBAAqB,GAChCP,QAAwC,IAChB;EACxB,MAAMC,YAAY,GAAG,IAAIV,kBAAkB,CAACK,eAAe,CAAC,CAAC,CAAC;EAC9D,OAAOK,YAAY,CAACI,WAAW,CAAC,gBAAgB,EAAEL,QAAQ,CAAC;AAC7D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMQ,uBAAuB,GAAIR,QAAoB,IAAK;EAC/D,IAAIF,KAAK,IAAI,CAACL,cAAc,CAAC,CAAC,EAAE;IAC9B,MAAMQ,YAAY,GAAG,IAAIV,kBAAkB,CAACI,YAAY,CAAC,CAAC,CAAC;IAC3D,OAAOM,YAAY,CAACI,WAAW,CAAC,sBAAsB,EAAEL,QAAQ,CAAC;EACnE;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMS,mBAAmB,GAC9BT,QAA2C,IACxC;EACH,IAAIF,KAAK,IAAIL,cAAc,CAAC,CAAC,EAAE;IAC7B,MAAMQ,YAAY,GAAG,IAAIV,kBAAkB,CAACI,YAAY,CAAC,CAAC,CAAC;IAC3D,OAAOM,YAAY,CAACI,WAAW,CAAC,yBAAyB,EAAEL,QAAQ,CAAC;EACtE;EAEA,OAAO,IAAI;AACb,CAAC"}
1
+ {"version":3,"names":["NativeEventEmitter","transactionSk2ToPurchaseMap","isIosStorekit2","getAndroidModule","getIosModule","getNativeModule","isAndroid","isIos","purchaseUpdatedListener","listener","errorCallback","eventEmitter","proxyListener","event","emitterSubscription","addListener","startListening","catch","error","purchaseErrorListener","promotedProductListener","transactionListener"],"sourceRoot":"../../src","sources":["eventEmitter.ts"],"mappings":"AAAA,SAA6BA,kBAAkB,QAAO,cAAc;AAEpE,SAA0BC,2BAA2B,QAAO,kBAAkB;AAC9E,SAAQC,cAAc,QAAO,OAAO;AACpC,SACEC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,SAAS,EACTC,KAAK,QACA,YAAY;AAInB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGA,CACrCC,QAAmC,EACnCC,aAAwC,KACrC;EACH,MAAMC,YAAY,GAAG,IAAIX,kBAAkB,CAACK,eAAe,CAAC,CAAC,CAAC;EAC9D,MAAMO,aAAa,GAAGV,cAAc,CAAC,CAAC,GACjCW,KAAe,IAAK;IACnBJ,QAAQ,CAACR,2BAA2B,CAACY,KAAY,CAAC,CAAC;EACrD,CAAC,GACDJ,QAAQ;EACZ,MAAMK,mBAAmB,GAAGH,YAAY,CAACI,WAAW,CAClD,kBAAkB,EAClBH,aACF,CAAC;EAED,IAAIN,SAAS,EAAE;IACbH,gBAAgB,CAAC,CAAC,CACfa,cAAc,CAAC,CAAC,CAChBC,KAAK,CAAEC,KAAc,IAAK;MACzB,IAAIR,aAAa,EAAE;QACjBA,aAAa,CAACQ,KAAK,CAAC;MACtB,CAAC,MAAM;QACL,MAAMA,KAAK;MACb;IACF,CAAC,CAAC;EACN;EAEA,OAAOJ,mBAAmB;AAC5B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,qBAAqB,GAChCV,QAAwC,IAChB;EACxB,MAAME,YAAY,GAAG,IAAIX,kBAAkB,CAACK,eAAe,CAAC,CAAC,CAAC;EAC9D,OAAOM,YAAY,CAACI,WAAW,CAAC,gBAAgB,EAAEN,QAAQ,CAAC;AAC7D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMW,uBAAuB,GAAIX,QAAoB,IAAK;EAC/D,IAAIF,KAAK,IAAI,CAACL,cAAc,CAAC,CAAC,EAAE;IAC9B,MAAMS,YAAY,GAAG,IAAIX,kBAAkB,CAACI,YAAY,CAAC,CAAC,CAAC;IAC3D,OAAOO,YAAY,CAACI,WAAW,CAAC,sBAAsB,EAAEN,QAAQ,CAAC;EACnE;EAEA,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,mBAAmB,GAC9BZ,QAA2C,IACxC;EACH,IAAIF,KAAK,IAAIL,cAAc,CAAC,CAAC,EAAE;IAC7B,MAAMS,YAAY,GAAG,IAAIX,kBAAkB,CAACI,YAAY,CAAC,CAAC,CAAC;IAC3D,OAAOO,YAAY,CAACI,WAAW,CAAC,yBAAyB,EAAEN,QAAQ,CAAC;EACtE;EAEA,OAAO,IAAI;AACb,CAAC"}
@@ -34,7 +34,7 @@ const App = () => {
34
34
  };
35
35
  ```
36
36
  */
37
- export declare const purchaseUpdatedListener: (listener: (event: Purchase) => void) => EmitterSubscription;
37
+ export declare const purchaseUpdatedListener: (listener: (event: Purchase) => void, errorCallback?: ((error: unknown) => void) | undefined) => EmitterSubscription;
38
38
  /**
39
39
  * Add IAP purchase error event
40
40
  * Register a callback that gets called when there has been an error with a purchase. Returns a React Native `EmitterSubscription` on which you can call `.remove()` to stop receiving updates.
@@ -1 +1 @@
1
- {"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../../src/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,cAAc,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAA8B,MAAM,kBAAkB,CAAC;AAS/E,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,uBAAuB,qBAChB,QAAQ,KAAK,IAAI,wBAkBpC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,qBAAqB,qBACd,aAAa,KAAK,IAAI,KACvC,mBAGF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,uBAAuB,aAAc,MAAM,IAAI,+BAO3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,mBAAmB,qBACZ,gBAAgB,KAAK,IAAI,+BAQ5C,CAAC"}
1
+ {"version":3,"file":"eventEmitter.d.ts","sourceRoot":"","sources":["../../../src/eventEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAqB,MAAM,cAAc,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAA8B,MAAM,kBAAkB,CAAC;AAS/E,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,uBAAuB,qBAChB,QAAQ,KAAK,IAAI,2BACX,OAAO,KAAK,IAAI,qCA0BzC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,qBAAqB,qBACd,aAAa,KAAK,IAAI,KACvC,mBAGF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,uBAAuB,aAAc,MAAM,IAAI,+BAO3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,mBAAmB,qBACZ,gBAAgB,KAAK,IAAI,+BAQ5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-iap",
3
- "version": "12.15.2",
3
+ "version": "12.15.4",
4
4
  "description": "React Native In App Purchase Module.",
5
5
  "repository": "https://github.com/dooboolab-community/react-native-iap",
6
6
  "author": "hyochan <dooboolab@gmail.com> (https://github.com/hyochan)",
@@ -70,7 +70,7 @@
70
70
  "lint:eslint": "eslint --fix '**/*.{ts,tsx}'",
71
71
  "lint:ci": "yarn lint:tsc && yarn lint:eslint -f ./node_modules/@firmnav/eslint-github-actions-formatter/dist/formatter.js && yarn lint:prettier",
72
72
  "lint:prettier": "prettier --write \"**/*.{md,js,jsx,ts,tsx}\"",
73
- "lint:swift": "swiftlint lint --fix --format --path ios/*.swift --config .swiftlint.yml",
73
+ "lint:swift": "swiftlint lint --fix --format ios/*.swift --config .swiftlint.yml",
74
74
  "lint:kotlin": "ktlint --format",
75
75
  "format": "git ls-files -m | xargs yarn prettier --write --ignore-unknown --no-error-on-unmatched-pattern",
76
76
  "bootstrap": "yarn example && yarn && yarn example pods",
@@ -46,6 +46,7 @@ const App = () => {
46
46
  */
47
47
  export const purchaseUpdatedListener = (
48
48
  listener: (event: Purchase) => void,
49
+ errorCallback?: (error: unknown) => void,
49
50
  ) => {
50
51
  const eventEmitter = new NativeEventEmitter(getNativeModule());
51
52
  const proxyListener = isIosStorekit2()
@@ -59,7 +60,15 @@ export const purchaseUpdatedListener = (
59
60
  );
60
61
 
61
62
  if (isAndroid) {
62
- getAndroidModule().startListening();
63
+ getAndroidModule()
64
+ .startListening()
65
+ .catch((error: unknown) => {
66
+ if (errorCallback) {
67
+ errorCallback(error);
68
+ } else {
69
+ throw error;
70
+ }
71
+ });
63
72
  }
64
73
 
65
74
  return emitterSubscription;