expo-iap 2.9.6 → 3.0.0

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.
Files changed (56) hide show
  1. package/.eslintrc.js +24 -0
  2. package/CHANGELOG.md +43 -0
  3. package/README.md +1 -1
  4. package/android/build.gradle +7 -2
  5. package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +195 -668
  6. package/android/src/main/java/expo/modules/iap/PromiseUtils.kt +85 -0
  7. package/build/ExpoIap.types.d.ts +0 -6
  8. package/build/ExpoIap.types.d.ts.map +1 -1
  9. package/build/ExpoIap.types.js.map +1 -1
  10. package/build/helpers/subscription.d.ts.map +1 -1
  11. package/build/helpers/subscription.js +14 -3
  12. package/build/helpers/subscription.js.map +1 -1
  13. package/build/index.d.ts +6 -73
  14. package/build/index.d.ts.map +1 -1
  15. package/build/index.js +21 -154
  16. package/build/index.js.map +1 -1
  17. package/build/modules/android.d.ts +2 -2
  18. package/build/modules/android.d.ts.map +1 -1
  19. package/build/modules/android.js +11 -1
  20. package/build/modules/android.js.map +1 -1
  21. package/build/modules/ios.d.ts +0 -60
  22. package/build/modules/ios.d.ts.map +1 -1
  23. package/build/modules/ios.js +2 -121
  24. package/build/modules/ios.js.map +1 -1
  25. package/build/types/ExpoIapAndroid.types.d.ts +0 -8
  26. package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
  27. package/build/types/ExpoIapAndroid.types.js +0 -1
  28. package/build/types/ExpoIapAndroid.types.js.map +1 -1
  29. package/build/types/ExpoIapIOS.types.d.ts +0 -5
  30. package/build/types/ExpoIapIOS.types.d.ts.map +1 -1
  31. package/build/types/ExpoIapIOS.types.js.map +1 -1
  32. package/build/useIAP.d.ts +0 -18
  33. package/build/useIAP.d.ts.map +1 -1
  34. package/build/useIAP.js +1 -18
  35. package/build/useIAP.js.map +1 -1
  36. package/bun.lock +340 -137
  37. package/codecov.yml +17 -21
  38. package/ios/ExpoIapModule.swift +50 -23
  39. package/jest.config.js +5 -9
  40. package/package.json +5 -3
  41. package/plugin/build/withIAP.d.ts +4 -1
  42. package/plugin/build/withIAP.js +38 -24
  43. package/plugin/build/withLocalOpenIAP.d.ts +6 -2
  44. package/plugin/build/withLocalOpenIAP.js +175 -20
  45. package/plugin/src/withIAP.ts +66 -30
  46. package/plugin/src/withLocalOpenIAP.ts +228 -24
  47. package/src/ExpoIap.types.ts +0 -8
  48. package/src/helpers/subscription.ts +14 -3
  49. package/src/index.ts +22 -230
  50. package/src/modules/android.ts +16 -6
  51. package/src/modules/ios.ts +2 -168
  52. package/src/types/ExpoIapAndroid.types.ts +0 -11
  53. package/src/types/ExpoIapIOS.types.ts +0 -5
  54. package/src/useIAP.ts +3 -55
  55. package/android/src/main/java/expo/modules/iap/PlayUtils.kt +0 -178
  56. package/android/src/main/java/expo/modules/iap/Types.kt +0 -98
package/.eslintrc.js CHANGED
@@ -5,5 +5,29 @@ module.exports = {
5
5
  rules: {
6
6
  'eslint-comments/no-unlimited-disable': 0,
7
7
  'eslint-comments/no-unused-disable': 0,
8
+ // Prevent ambiguous imports that Metro may mis-resolve
9
+ 'no-restricted-imports': [
10
+ 'error',
11
+ {
12
+ paths: [
13
+ {
14
+ name: '.',
15
+ message:
16
+ "Avoid `import from '.'`; use './index' or an explicit path.",
17
+ },
18
+ ],
19
+ },
20
+ ],
21
+ 'no-restricted-modules': [
22
+ 'error',
23
+ {
24
+ paths: [
25
+ {
26
+ name: '.',
27
+ message: "Avoid `require('.')`; use './index' or an explicit path.",
28
+ },
29
+ ],
30
+ },
31
+ ],
8
32
  },
9
33
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.0.0 - 2025-09-13
4
+
5
+ Breaking changes:
6
+
7
+ - Remove legacy APIs: `getProducts`, `getSubscriptions`, `requestProducts`, `requestSubscription`, `getPurchaseHistory`/`getPurchaseHistories`, and non‑suffixed iOS aliases
8
+ - `showManageSubscriptionsIOS()` now returns `Promise<Purchase[]>` (was `boolean`)
9
+ - `getAvailablePurchases()` options now only accept iOS keys: `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`
10
+
11
+ Features:
12
+
13
+ - Unify tokens via `purchaseToken` on `Purchase` (iOS JWS + Android token)
14
+ - Add `getReceiptDataIOS` alias for iOS receipt parity
15
+
16
+ Refactor:
17
+
18
+ - Remove deprecated comments/tests/mocks; simplify subscription dedup to `id`
19
+ - Clean up hook surface and examples to current API
20
+
21
+ Fixes:
22
+
23
+ - iOS parity and guards across native bridge and TS layer
24
+
25
+ Docs:
26
+
27
+ - Add v3 migration and update API pages to remove legacy helpers
28
+
29
+ Tests:
30
+
31
+ - Remove legacy specs; all root and example suites pass
32
+
33
+ ## [2.9.7] - 2025-09-12
34
+
35
+ ### Changed
36
+
37
+ - Android: remove `ensureConnection` wrapper in favor of `BillingClient` auto-reconnect and a simpler `getBillingClientOrReject` precheck
38
+ - Android: also verify `BillingClient.isReady` before proceeding to avoid sporadic failures
39
+ - Android: drop deprecated product fields from mapping (`displayName`, `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails`) in favor of `...Android` suffixed fields
40
+ - iOS: add `ensureConnection()` guard to all public async APIs; fix main-actor state updates and minor warnings
41
+
42
+ ### Fixed
43
+
44
+ - Android: fix stray brace that prematurely closed `ModuleDefinition` and ktlint trailing spaces
45
+
3
46
  ## [2.9.6] - 2025-09-11
4
47
 
5
48
  ### Fixed
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <div align="center">
4
4
  <img src="https://hyochan.github.io/expo-iap/img/icon.png" alt="Expo IAP Logo" width="150" />
5
5
 
6
- [![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
6
+ [![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![CI](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml/badge.svg)](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/hyochan/expo-iap/graph/badge.svg?token=47VMTY5NyM)](https://codecov.io/gh/hyochan/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
7
7
 
8
8
  In app purchase module in [Expo](https://docs.expo.dev/guides/in-app-purchases) that conforms to the [Open IAP specification](https://openiap.dev)
9
9
 
@@ -53,6 +53,11 @@ android {
53
53
 
54
54
  dependencies {
55
55
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
56
- implementation "com.android.billingclient:billing-ktx:8.0.0"
57
- implementation "com.google.android.gms:play-services-base:18.1.0"
56
+ // Use OpenIAP Google module only; avoid direct BillingClient dependency
57
+ if (findProject(":openiap-google") != null) {
58
+ implementation project(":openiap-google")
59
+ } else {
60
+ // Fallback to published artifact when local project isn't linked
61
+ implementation "io.github.hyochan.openiap:openiap-google:1.0.1"
62
+ }
58
63
  }