expo-iap 2.8.3-rc.2 → 2.8.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/CHANGELOG.md +27 -0
- package/CLAUDE.md +8 -20
- package/CONTRIBUTING.md +4 -3
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +5 -2
- package/android/src/main/java/expo/modules/iap/PlayUtils.kt +12 -28
- package/android/src/main/java/expo/modules/iap/Types.kt +51 -8
- package/build/helpers/subscription.d.ts.map +1 -1
- package/build/helpers/subscription.js +6 -3
- package/build/helpers/subscription.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -3
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js.map +1 -1
- package/build/types/ExpoIapAndroid.types.d.ts +2 -2
- package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
- package/build/types/ExpoIapAndroid.types.js.map +1 -1
- package/build/types/ExpoIapIOS.types.d.ts +3 -3
- package/build/types/ExpoIapIOS.types.d.ts.map +1 -1
- package/build/types/ExpoIapIOS.types.js.map +1 -1
- package/build/useIAP.d.ts +4 -0
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +4 -0
- package/build/useIAP.js.map +1 -1
- package/ios/ExpoIap.podspec +5 -5
- package/ios/ExpoIapModule.swift +4 -0
- package/jest.config.js +17 -14
- package/package.json +1 -1
- package/plugin/build/withIAP.js +4 -17
- package/plugin/src/withIAP.ts +4 -23
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/helpers/subscription.ts +28 -21
- package/src/index.ts +5 -10
- package/src/modules/android.ts +7 -7
- package/src/modules/ios.ts +2 -7
- package/src/types/ExpoIapAndroid.types.ts +4 -3
- package/src/types/ExpoIapIOS.types.ts +3 -4
- package/src/useIAP.ts +7 -9
- package/coverage/clover.xml +0 -601
- package/coverage/coverage-final.json +0 -9
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -176
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/ExpoIap.types.ts.html +0 -1243
- package/coverage/lcov-report/src/helpers/index.html +0 -116
- package/coverage/lcov-report/src/helpers/subscription.ts.html +0 -430
- package/coverage/lcov-report/src/index.html +0 -146
- package/coverage/lcov-report/src/index.ts.html +0 -2227
- package/coverage/lcov-report/src/modules/android.ts.html +0 -469
- package/coverage/lcov-report/src/modules/index.html +0 -131
- package/coverage/lcov-report/src/modules/ios.ts.html +0 -1411
- package/coverage/lcov-report/src/types/ExpoIapAndroid.types.ts.html +0 -487
- package/coverage/lcov-report/src/types/index.html +0 -116
- package/coverage/lcov-report/src/useIap.ts.html +0 -1483
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +0 -349
- package/coverage/lcov-report/src/utils/index.html +0 -116
- package/coverage/lcov.info +0 -1115
- package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,45 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [2.8.4] - 2025-08-31
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed iOS 18.4 properties build failure on Xcode 16.3 and below by adding Swift 6.1 compiler guard
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Android: Enabled automatic service reconnection (Android Billing Client v8 feature) and simplified connection logic (#178)
|
|
12
|
+
|
|
13
|
+
## [2.8.3] - 2025-08-27
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed TypeScript type issues
|
|
18
|
+
- Added critical warning about iOS platform version in podspec (#169)
|
|
19
|
+
|
|
3
20
|
## [2.8.2] - 2025-08-26
|
|
4
21
|
|
|
5
22
|
### Added
|
|
23
|
+
|
|
6
24
|
- Added `platform` field to all IAP types for improved runtime type discrimination
|
|
7
25
|
- Consolidated `Purchase` types and deprecated legacy type aliases for consistency
|
|
8
26
|
|
|
9
27
|
### Changed
|
|
28
|
+
|
|
10
29
|
- Refactored and consolidated Purchase types to follow OpenIAP specification
|
|
11
30
|
- Improved type consistency across iOS and Android platforms
|
|
12
31
|
|
|
13
32
|
### Deprecated
|
|
33
|
+
|
|
14
34
|
**Note**: The following deprecated type aliases will be removed in v2.9.0:
|
|
35
|
+
|
|
15
36
|
- `ProductPurchase` (use `Purchase` instead)
|
|
16
37
|
- `SubscriptionPurchase` (use `Purchase` instead)
|
|
17
38
|
|
|
18
39
|
## [2.8.1] - 2025-08-19
|
|
19
40
|
|
|
20
41
|
### Added
|
|
42
|
+
|
|
21
43
|
- Added `debugDescription?: string` field to `ProductCommon` for debugging purposes
|
|
22
44
|
- Added `platform?: string` field to `ProductCommon` and `PurchaseCommon` for platform identification
|
|
23
45
|
- Added `platform: "ios"` to iOS-specific types (`ProductIOS`, `ProductSubscriptionIOS`, `PurchaseIOS`)
|
|
@@ -25,6 +47,7 @@
|
|
|
25
47
|
- Added `ids?: string[]` field to `PurchaseCommon` (moved from Android-specific types)
|
|
26
48
|
|
|
27
49
|
### Changed
|
|
50
|
+
|
|
28
51
|
- Moved common fields from platform-specific types to shared Common types
|
|
29
52
|
- Updated iOS native code to populate missing subscription fields:
|
|
30
53
|
- `introductoryPriceAsAmountIOS`
|
|
@@ -36,12 +59,15 @@
|
|
|
36
59
|
- Updated Android native code to use common `ids` field instead of platform-specific `idsAndroid`
|
|
37
60
|
|
|
38
61
|
### Fixed
|
|
62
|
+
|
|
39
63
|
- Fixed type mismatches between Product and Purchase types across iOS and Android platforms
|
|
40
64
|
- Resolved missing field mappings in iOS native subscription data extraction
|
|
41
65
|
- Improved type consistency for cross-platform compatibility
|
|
42
66
|
|
|
43
67
|
### Deprecated
|
|
68
|
+
|
|
44
69
|
**Note**: No breaking changes in this release. The following deprecated fields will be removed in v2.9.0:
|
|
70
|
+
|
|
45
71
|
- Android: `idsAndroid` (use common `ids` field instead)
|
|
46
72
|
- Android: `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails` (use fields with `Android` suffix)
|
|
47
73
|
- iOS: `displayName`, `isFamilyShareable`, `jsonRepresentation`, `subscription` (use fields with `IOS` suffix)
|
|
@@ -56,6 +82,7 @@
|
|
|
56
82
|
**Migration Guide**: See the full migration guide at [expo-iap.hyo.dev/blog/v2-8-0-migration-guide](https://expo-iap.hyo.dev/blog/v2-8-0-migration-guide)
|
|
57
83
|
|
|
58
84
|
Affected fields:
|
|
85
|
+
|
|
59
86
|
- `quantityIos` → `quantityIOS`
|
|
60
87
|
- `expirationDateIos` → `expirationDateIOS`
|
|
61
88
|
- `environmentIos` → `environmentIOS`
|
package/CLAUDE.md
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
# Implementation Guidelines
|
|
2
2
|
|
|
3
|
-
## Release Notes
|
|
4
|
-
|
|
5
|
-
### v2.8.1 (2025-08-19)
|
|
6
|
-
|
|
7
|
-
- Added `platform` field to all types for runtime type discrimination
|
|
8
|
-
- Moved common fields to shared base types (`ids`, `debugDescription`)
|
|
9
|
-
- Fixed iOS native code to populate missing subscription fields
|
|
10
|
-
- No breaking changes, but deprecated fields will be removed in v2.9.0
|
|
11
|
-
|
|
12
|
-
### v2.8.0 (2025-08-18)
|
|
13
|
-
|
|
14
|
-
- **Breaking**: iOS field naming convention changed (e.g., `quantityIos` → `quantityIOS`)
|
|
15
|
-
- All iOS-related field names ending with "Ios" now end with "IOS"
|
|
16
|
-
|
|
17
3
|
## Expo-Specific Guidelines
|
|
18
4
|
|
|
19
5
|
### iOS Pod Configuration
|
|
20
6
|
|
|
21
|
-
**CRITICAL WARNING**: Never modify the
|
|
7
|
+
**CRITICAL WARNING**: Never modify the platform versions in `ios/ExpoIap.podspec`
|
|
22
8
|
|
|
23
|
-
-
|
|
24
|
-
- Changing to `15.0`
|
|
9
|
+
- Both iOS and tvOS platform versions MUST remain at `13.4` even though the code requires iOS/tvOS 15.0+
|
|
10
|
+
- Changing to `15.0` can cause expo prebuild to exclude the module in certain Expo SDKs (known bug)
|
|
25
11
|
- See issue: [#168](https://github.com/hyochan/expo-iap/issues/168)
|
|
26
|
-
- This is kept at `13.4` for compatibility
|
|
27
|
-
- The actual iOS 15.0+ requirement is enforced at build time
|
|
28
|
-
- Users must ensure their app target is set to iOS 15.0 or higher
|
|
12
|
+
- This is kept at `13.4` for compatibility with affected Expo SDKs
|
|
13
|
+
- The actual iOS/tvOS 15.0+ requirement is enforced at build time via @available annotations
|
|
14
|
+
- Users must ensure their app target is set to iOS 15.0 or higher:
|
|
15
|
+
- app.json: `"expo": { "ios": { "deploymentTarget": "15.0" } }`
|
|
16
|
+
- or app.config.ts: `ios: { deploymentTarget: '15.0' }`
|
|
29
17
|
|
|
30
18
|
### Pre-Commit Checks
|
|
31
19
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -47,6 +47,7 @@ This project includes VSCode configurations for easier development:
|
|
|
47
47
|
1. **Install recommended extensions**: When you open the project in VSCode, you'll be prompted to install recommended extensions. Accept to install them.
|
|
48
48
|
|
|
49
49
|
1. **Use Debug Configurations**: Press `F5` or go to Run → Start Debugging and select:
|
|
50
|
+
|
|
50
51
|
- `Debug iOS (Expo)` - Runs the example app on iOS simulator
|
|
51
52
|
- `Debug Android (Expo)` - Runs the example app on Android emulator
|
|
52
53
|
- `iOS + Metro` - Starts Metro bundler and iOS app together
|
|
@@ -182,7 +183,7 @@ bun start
|
|
|
182
183
|
# Run on iOS simulator
|
|
183
184
|
bun run ios
|
|
184
185
|
|
|
185
|
-
# Run on Android emulator
|
|
186
|
+
# Run on Android emulator
|
|
186
187
|
bun run android
|
|
187
188
|
|
|
188
189
|
# Run tests
|
|
@@ -286,12 +287,12 @@ bun run test:coverage
|
|
|
286
287
|
Example test structure:
|
|
287
288
|
|
|
288
289
|
```typescript
|
|
289
|
-
import {
|
|
290
|
+
import {render, fireEvent} from '@testing-library/react-native';
|
|
290
291
|
import MyComponent from '../MyComponent';
|
|
291
292
|
|
|
292
293
|
describe('MyComponent', () => {
|
|
293
294
|
it('should render correctly', () => {
|
|
294
|
-
const {
|
|
295
|
+
const {getByText} = render(<MyComponent />);
|
|
295
296
|
expect(getByText('Expected Text')).toBeTruthy();
|
|
296
297
|
});
|
|
297
298
|
});
|
|
@@ -166,7 +166,7 @@ class ExpoIapModule :
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
if (skuList.isEmpty()) {
|
|
169
|
-
promise.reject(
|
|
169
|
+
promise.reject(IapErrorCode.E_EMPTY_SKU_LIST, "The SKU list is empty.", null)
|
|
170
170
|
return@ensureConnection
|
|
171
171
|
}
|
|
172
172
|
|
|
@@ -575,7 +575,9 @@ class ExpoIapModule :
|
|
|
575
575
|
promise: Promise,
|
|
576
576
|
callback: (billingClient: BillingClient) -> Unit,
|
|
577
577
|
) {
|
|
578
|
-
if
|
|
578
|
+
// With auto-reconnection enabled, we only need to check if billing client exists
|
|
579
|
+
// The service will automatically reconnect when needed
|
|
580
|
+
if (billingClientCache != null) {
|
|
579
581
|
callback(billingClientCache!!)
|
|
580
582
|
return
|
|
581
583
|
}
|
|
@@ -605,6 +607,7 @@ class ExpoIapModule :
|
|
|
605
607
|
.newBuilder(context)
|
|
606
608
|
.setListener(this)
|
|
607
609
|
.enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build())
|
|
610
|
+
.enableAutoServiceReconnection() // Automatically handle service disconnections
|
|
608
611
|
.build()
|
|
609
612
|
|
|
610
613
|
billingClientCache?.startConnection(
|
|
@@ -13,22 +13,6 @@ object PromiseUtils {
|
|
|
13
13
|
private val promises = HashMap<String, MutableList<Promise>>()
|
|
14
14
|
|
|
15
15
|
const val TAG = "PromiseUtils"
|
|
16
|
-
const val E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE"
|
|
17
|
-
const val E_UNKNOWN = "E_UNKNOWN"
|
|
18
|
-
const val E_NOT_PREPARED = "E_NOT_PREPARED"
|
|
19
|
-
const val E_ALREADY_PREPARED = "E_ALREADY_PREPARED"
|
|
20
|
-
const val E_PENDING = "E_PENDING"
|
|
21
|
-
const val E_NOT_ENDED = "E_NOT_ENDED"
|
|
22
|
-
const val E_USER_CANCELLED = "E_USER_CANCELLED"
|
|
23
|
-
const val E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE"
|
|
24
|
-
const val E_NETWORK_ERROR = "E_NETWORK_ERROR"
|
|
25
|
-
const val E_SERVICE_ERROR = "E_SERVICE_ERROR"
|
|
26
|
-
const val E_ALREADY_OWNED = "E_ALREADY_OWNED"
|
|
27
|
-
const val E_REMOTE_ERROR = "E_REMOTE_ERROR"
|
|
28
|
-
const val E_USER_ERROR = "E_USER_ERROR"
|
|
29
|
-
const val E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR"
|
|
30
|
-
const val E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR"
|
|
31
|
-
const val E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED"
|
|
32
16
|
|
|
33
17
|
fun addPromiseForKey(
|
|
34
18
|
key: String,
|
|
@@ -49,7 +33,7 @@ object PromiseUtils {
|
|
|
49
33
|
|
|
50
34
|
fun rejectAllPendingPromises() {
|
|
51
35
|
promises.flatMap { it.value }.forEach { promise ->
|
|
52
|
-
promise.safeReject(E_CONNECTION_CLOSED, "Connection has been closed", null)
|
|
36
|
+
promise.safeReject(IapErrorCode.E_CONNECTION_CLOSED, "Connection has been closed", null)
|
|
53
37
|
}
|
|
54
38
|
promises.clear()
|
|
55
39
|
}
|
|
@@ -117,19 +101,19 @@ object PlayUtils {
|
|
|
117
101
|
when (responseCode) {
|
|
118
102
|
BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED -> {
|
|
119
103
|
BillingResponse(
|
|
120
|
-
|
|
104
|
+
IapErrorCode.E_SERVICE_ERROR,
|
|
121
105
|
"This feature is not available on your device.",
|
|
122
106
|
)
|
|
123
107
|
}
|
|
124
108
|
BillingClient.BillingResponseCode.SERVICE_DISCONNECTED -> {
|
|
125
109
|
BillingResponse(
|
|
126
|
-
|
|
110
|
+
IapErrorCode.E_NETWORK_ERROR,
|
|
127
111
|
"The service is disconnected (check your internet connection.)",
|
|
128
112
|
)
|
|
129
113
|
}
|
|
130
114
|
BillingClient.BillingResponseCode.NETWORK_ERROR -> {
|
|
131
115
|
BillingResponse(
|
|
132
|
-
|
|
116
|
+
IapErrorCode.E_NETWORK_ERROR,
|
|
133
117
|
"You have a problem with network connection.",
|
|
134
118
|
)
|
|
135
119
|
}
|
|
@@ -141,49 +125,49 @@ object PlayUtils {
|
|
|
141
125
|
}
|
|
142
126
|
BillingClient.BillingResponseCode.USER_CANCELED -> {
|
|
143
127
|
BillingResponse(
|
|
144
|
-
|
|
128
|
+
IapErrorCode.E_USER_CANCELLED,
|
|
145
129
|
"Payment is cancelled.",
|
|
146
130
|
)
|
|
147
131
|
}
|
|
148
132
|
BillingClient.BillingResponseCode.SERVICE_UNAVAILABLE -> {
|
|
149
133
|
BillingResponse(
|
|
150
|
-
|
|
134
|
+
IapErrorCode.E_SERVICE_ERROR,
|
|
151
135
|
"The service is unreachable. This may be your internet connection, or the Play Store may be down.",
|
|
152
136
|
)
|
|
153
137
|
}
|
|
154
138
|
BillingClient.BillingResponseCode.BILLING_UNAVAILABLE -> {
|
|
155
139
|
BillingResponse(
|
|
156
|
-
|
|
140
|
+
IapErrorCode.E_SERVICE_ERROR,
|
|
157
141
|
"Billing is unavailable. This may be a problem with your device, or the Play Store may be down.",
|
|
158
142
|
)
|
|
159
143
|
}
|
|
160
144
|
BillingClient.BillingResponseCode.ITEM_UNAVAILABLE -> {
|
|
161
145
|
BillingResponse(
|
|
162
|
-
|
|
146
|
+
IapErrorCode.E_ITEM_UNAVAILABLE,
|
|
163
147
|
"That item is unavailable.",
|
|
164
148
|
)
|
|
165
149
|
}
|
|
166
150
|
BillingClient.BillingResponseCode.DEVELOPER_ERROR -> {
|
|
167
151
|
BillingResponse(
|
|
168
|
-
|
|
152
|
+
IapErrorCode.E_DEVELOPER_ERROR,
|
|
169
153
|
"Google is indicating that we have some issue connecting to payment.",
|
|
170
154
|
)
|
|
171
155
|
}
|
|
172
156
|
BillingClient.BillingResponseCode.ERROR -> {
|
|
173
157
|
BillingResponse(
|
|
174
|
-
|
|
158
|
+
IapErrorCode.E_UNKNOWN,
|
|
175
159
|
"An unknown or unexpected error has occurred. Please try again later.",
|
|
176
160
|
)
|
|
177
161
|
}
|
|
178
162
|
BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
|
|
179
163
|
BillingResponse(
|
|
180
|
-
|
|
164
|
+
IapErrorCode.E_ALREADY_OWNED,
|
|
181
165
|
"You already own this item.",
|
|
182
166
|
)
|
|
183
167
|
}
|
|
184
168
|
else -> {
|
|
185
169
|
BillingResponse(
|
|
186
|
-
|
|
170
|
+
IapErrorCode.E_UNKNOWN,
|
|
187
171
|
"Purchase failed with code: $responseCode",
|
|
188
172
|
)
|
|
189
173
|
}
|
|
@@ -5,18 +5,47 @@ package expo.modules.iap
|
|
|
5
5
|
* Single source of truth for all error codes used across the module
|
|
6
6
|
*/
|
|
7
7
|
object IapErrorCode {
|
|
8
|
-
//
|
|
8
|
+
// Connection and initialization errors
|
|
9
9
|
const val E_NOT_PREPARED = "E_NOT_PREPARED"
|
|
10
10
|
const val E_INIT_CONNECTION = "E_INIT_CONNECTION"
|
|
11
|
+
const val E_SERVICE_DISCONNECTED = "E_SERVICE_DISCONNECTED"
|
|
12
|
+
const val E_ALREADY_PREPARED = "E_ALREADY_PREPARED"
|
|
13
|
+
const val E_CONNECTION_CLOSED = "E_CONNECTION_CLOSED"
|
|
14
|
+
|
|
15
|
+
// Product and purchase errors
|
|
11
16
|
const val E_QUERY_PRODUCT = "E_QUERY_PRODUCT"
|
|
12
|
-
const val E_UNKNOWN = "E_UNKNOWN"
|
|
13
|
-
const val E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH"
|
|
14
17
|
const val E_SKU_NOT_FOUND = "E_SKU_NOT_FOUND"
|
|
18
|
+
const val E_SKU_OFFER_MISMATCH = "E_SKU_OFFER_MISMATCH"
|
|
19
|
+
const val E_PURCHASE_ERROR = "E_PURCHASE_ERROR"
|
|
15
20
|
const val E_USER_CANCELLED = "E_USER_CANCELLED"
|
|
21
|
+
const val E_PENDING = "E_PENDING"
|
|
22
|
+
|
|
23
|
+
// Service and developer errors
|
|
24
|
+
const val E_SERVICE_ERROR = "E_SERVICE_ERROR"
|
|
16
25
|
const val E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR"
|
|
17
26
|
const val E_ITEM_UNAVAILABLE = "E_ITEM_UNAVAILABLE"
|
|
18
|
-
const val
|
|
19
|
-
const val
|
|
27
|
+
const val E_ALREADY_OWNED = "E_ALREADY_OWNED"
|
|
28
|
+
const val E_ITEM_NOT_OWNED = "E_ITEM_NOT_OWNED"
|
|
29
|
+
|
|
30
|
+
// Network and billing errors
|
|
31
|
+
const val E_NETWORK_ERROR = "E_NETWORK_ERROR"
|
|
32
|
+
const val E_BILLING_UNAVAILABLE = "E_BILLING_UNAVAILABLE"
|
|
33
|
+
const val E_FEATURE_NOT_SUPPORTED = "E_FEATURE_NOT_SUPPORTED"
|
|
34
|
+
const val E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR"
|
|
35
|
+
|
|
36
|
+
// Activity and UI errors
|
|
37
|
+
const val E_ACTIVITY_UNAVAILABLE = "E_ACTIVITY_UNAVAILABLE"
|
|
38
|
+
|
|
39
|
+
// User and remote errors
|
|
40
|
+
const val E_USER_ERROR = "E_USER_ERROR"
|
|
41
|
+
const val E_REMOTE_ERROR = "E_REMOTE_ERROR"
|
|
42
|
+
const val E_NOT_ENDED = "E_NOT_ENDED"
|
|
43
|
+
|
|
44
|
+
// Unknown error
|
|
45
|
+
const val E_UNKNOWN = "E_UNKNOWN"
|
|
46
|
+
|
|
47
|
+
// Empty SKU list error
|
|
48
|
+
const val E_EMPTY_SKU_LIST = "E_EMPTY_SKU_LIST"
|
|
20
49
|
|
|
21
50
|
// Cached map for Constants export - initialized once at class loading time
|
|
22
51
|
// Using constants as keys to avoid duplication and ensure type safety
|
|
@@ -31,7 +60,22 @@ object IapErrorCode {
|
|
|
31
60
|
E_DEVELOPER_ERROR to E_DEVELOPER_ERROR,
|
|
32
61
|
E_ITEM_UNAVAILABLE to E_ITEM_UNAVAILABLE,
|
|
33
62
|
E_SERVICE_ERROR to E_SERVICE_ERROR,
|
|
34
|
-
E_PURCHASE_ERROR to E_PURCHASE_ERROR
|
|
63
|
+
E_PURCHASE_ERROR to E_PURCHASE_ERROR,
|
|
64
|
+
E_ACTIVITY_UNAVAILABLE to E_ACTIVITY_UNAVAILABLE,
|
|
65
|
+
E_ALREADY_PREPARED to E_ALREADY_PREPARED,
|
|
66
|
+
E_PENDING to E_PENDING,
|
|
67
|
+
E_NOT_ENDED to E_NOT_ENDED,
|
|
68
|
+
E_NETWORK_ERROR to E_NETWORK_ERROR,
|
|
69
|
+
E_ALREADY_OWNED to E_ALREADY_OWNED,
|
|
70
|
+
E_REMOTE_ERROR to E_REMOTE_ERROR,
|
|
71
|
+
E_USER_ERROR to E_USER_ERROR,
|
|
72
|
+
E_BILLING_RESPONSE_JSON_PARSE_ERROR to E_BILLING_RESPONSE_JSON_PARSE_ERROR,
|
|
73
|
+
E_CONNECTION_CLOSED to E_CONNECTION_CLOSED,
|
|
74
|
+
E_SERVICE_DISCONNECTED to E_SERVICE_DISCONNECTED,
|
|
75
|
+
E_BILLING_UNAVAILABLE to E_BILLING_UNAVAILABLE,
|
|
76
|
+
E_FEATURE_NOT_SUPPORTED to E_FEATURE_NOT_SUPPORTED,
|
|
77
|
+
E_ITEM_NOT_OWNED to E_ITEM_NOT_OWNED,
|
|
78
|
+
E_EMPTY_SKU_LIST to E_EMPTY_SKU_LIST
|
|
35
79
|
)
|
|
36
80
|
|
|
37
81
|
// Return cached map reference - no new allocations on repeated calls
|
|
@@ -47,9 +91,8 @@ object IapEvent {
|
|
|
47
91
|
}
|
|
48
92
|
|
|
49
93
|
/**
|
|
50
|
-
* Other IAP-related constants
|
|
94
|
+
* Other IAP-related constants (Promise keys, etc.)
|
|
51
95
|
*/
|
|
52
96
|
object IapConstants {
|
|
53
|
-
const val EMPTY_SKU_LIST = "EMPTY_SKU_LIST"
|
|
54
97
|
const val PROMISE_BUY_ITEM = "PROMISE_BUY_ITEM"
|
|
55
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/helpers/subscription.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,IAAI,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/helpers/subscription.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,IAAI,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,kBAAkB,EAAE,CAgG9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EAAE,KACzB,OAAO,CAAC,OAAO,CAGjB,CAAC"}
|
|
@@ -20,7 +20,7 @@ export const getActiveSubscriptions = async (subscriptionIds) => {
|
|
|
20
20
|
}
|
|
21
21
|
// Check if this purchase has subscription-specific fields
|
|
22
22
|
const hasSubscriptionFields = ('expirationDateIOS' in purchase && purchase.expirationDateIOS) ||
|
|
23
|
-
|
|
23
|
+
'autoRenewingAndroid' in purchase ||
|
|
24
24
|
('environmentIOS' in purchase && purchase.environmentIOS === 'Sandbox');
|
|
25
25
|
if (!hasSubscriptionFields) {
|
|
26
26
|
return false;
|
|
@@ -35,8 +35,11 @@ export const getActiveSubscriptions = async (subscriptionIds) => {
|
|
|
35
35
|
if ('environmentIOS' in purchase && purchase.environmentIOS) {
|
|
36
36
|
const dayInMs = 24 * 60 * 60 * 1000;
|
|
37
37
|
// If no expiration date, consider active if transaction is recent (within 24 hours for Sandbox)
|
|
38
|
-
if (!('expirationDateIOS' in purchase) ||
|
|
39
|
-
|
|
38
|
+
if (!('expirationDateIOS' in purchase) ||
|
|
39
|
+
!purchase.expirationDateIOS) {
|
|
40
|
+
if (purchase.environmentIOS === 'Sandbox' &&
|
|
41
|
+
purchase.transactionDate &&
|
|
42
|
+
currentTime - purchase.transactionDate < dayInMs) {
|
|
40
43
|
return true;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/helpers/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/helpers/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAC;AAY/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,eAA0B,EACK,EAAE;IACjC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,MAAM,qBAAqB,EAAE,CAAC;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC/B,MAAM,mBAAmB,GAAyB,EAAE,CAAC;QAErD,gDAAgD;QAChD,MAAM,iBAAiB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtD,2CAA2C;YAC3C,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBAClD,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;YAED,0DAA0D;YAC1D,MAAM,qBAAqB,GACzB,CAAC,mBAAmB,IAAI,QAAQ,IAAI,QAAQ,CAAC,iBAAiB,CAAC;gBAC/D,qBAAqB,IAAI,QAAQ;gBACjC,CAAC,gBAAgB,IAAI,QAAQ,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC;YAE1E,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAC3B,OAAO,KAAK,CAAC;YACf,CAAC;YAED,gCAAgC;YAChC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;gBAC1B,IAAI,mBAAmB,IAAI,QAAQ,IAAI,QAAQ,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AAC,KAAK,CACpC,CAAC,QAAQ,CAAC,iBAAiB,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CACnE,CAAC;oBACF,YAAY,CAAC,sBAAsB,GAAG,mBAAmB,CAAC;oBAC1D,YAAY,CAAC,cAAc,GAAG,mBAAmB,IAAI,CAAC,CAAC;gBACzD,CAAC;gBAED,IAAI,gBAAgB,IAAI,QAAQ,EAAE,CAAC;oBACjC,YAAY,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;gBACxD,CAAC;YACH,CAAC;iBAAM,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;gBACrC,IAAI,qBAAqB,IAAI,QAAQ,EAAE,CAAC;oBACtC,YAAY,CAAC,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC;oBAChE,2DAA2D;oBAC3D,YAAY,CAAC,cAAc,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBAC9D,CAAC;YACH,CAAC;YAED,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,eAA0B,EACR,EAAE;IACpB,MAAM,aAAa,GAAG,MAAM,sBAAsB,CAAC,eAAe,CAAC,CAAC;IACpE,OAAO,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;AAClC,CAAC,CAAC","sourcesContent":["import {Platform} from 'react-native';\nimport {getAvailablePurchases} from '../index';\n\nexport interface ActiveSubscription {\n productId: string;\n isActive: boolean;\n expirationDateIOS?: Date;\n autoRenewingAndroid?: boolean;\n environmentIOS?: string;\n willExpireSoon?: boolean;\n daysUntilExpirationIOS?: number;\n}\n\n/**\n * Get all active subscriptions with detailed information\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise<ActiveSubscription[]> array of active subscriptions with details\n */\nexport const getActiveSubscriptions = async (\n subscriptionIds?: string[],\n): Promise<ActiveSubscription[]> => {\n try {\n const purchases = await getAvailablePurchases();\n const currentTime = Date.now();\n const activeSubscriptions: ActiveSubscription[] = [];\n\n // Filter purchases to find active subscriptions\n const filteredPurchases = purchases.filter((purchase) => {\n // If specific IDs provided, filter by them\n if (subscriptionIds && subscriptionIds.length > 0) {\n if (!subscriptionIds.includes(purchase.productId)) {\n return false;\n }\n }\n\n // Check if this purchase has subscription-specific fields\n const hasSubscriptionFields =\n ('expirationDateIOS' in purchase && purchase.expirationDateIOS) ||\n 'autoRenewingAndroid' in purchase ||\n ('environmentIOS' in purchase && purchase.environmentIOS === 'Sandbox');\n\n if (!hasSubscriptionFields) {\n return false;\n }\n\n // Check if it's actually active\n if (Platform.OS === 'ios') {\n if ('expirationDateIOS' in purchase && purchase.expirationDateIOS) {\n return purchase.expirationDateIOS > currentTime;\n }\n // For iOS purchases without expiration date (like Sandbox), we consider them active\n // if they have the environmentIOS field and were created recently\n if ('environmentIOS' in purchase && purchase.environmentIOS) {\n const dayInMs = 24 * 60 * 60 * 1000;\n // If no expiration date, consider active if transaction is recent (within 24 hours for Sandbox)\n if (\n !('expirationDateIOS' in purchase) ||\n !purchase.expirationDateIOS\n ) {\n if (\n purchase.environmentIOS === 'Sandbox' &&\n purchase.transactionDate &&\n currentTime - purchase.transactionDate < dayInMs\n ) {\n return true;\n }\n }\n }\n } else if (Platform.OS === 'android') {\n // For Android, if it's in the purchases list, it's active\n return true;\n }\n\n return false;\n });\n\n // Convert to ActiveSubscription format\n for (const purchase of filteredPurchases) {\n const subscription: ActiveSubscription = {\n productId: purchase.productId,\n isActive: true,\n };\n\n // Add platform-specific details\n if (Platform.OS === 'ios') {\n if ('expirationDateIOS' in purchase && purchase.expirationDateIOS) {\n const expirationDate = new Date(purchase.expirationDateIOS);\n subscription.expirationDateIOS = expirationDate;\n\n // Calculate days until expiration (round to nearest day)\n const daysUntilExpiration = Math.round(\n (purchase.expirationDateIOS - currentTime) / (1000 * 60 * 60 * 24),\n );\n subscription.daysUntilExpirationIOS = daysUntilExpiration;\n subscription.willExpireSoon = daysUntilExpiration <= 7;\n }\n\n if ('environmentIOS' in purchase) {\n subscription.environmentIOS = purchase.environmentIOS;\n }\n } else if (Platform.OS === 'android') {\n if ('autoRenewingAndroid' in purchase) {\n subscription.autoRenewingAndroid = purchase.autoRenewingAndroid;\n // If auto-renewing is false, subscription will expire soon\n subscription.willExpireSoon = !purchase.autoRenewingAndroid;\n }\n }\n\n activeSubscriptions.push(subscription);\n }\n\n return activeSubscriptions;\n } catch (error) {\n console.error('Error getting active subscriptions:', error);\n return [];\n }\n};\n\n/**\n * Check if user has any active subscriptions\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise<boolean> true if user has at least one active subscription\n */\nexport const hasActiveSubscriptions = async (\n subscriptionIds?: string[],\n): Promise<boolean> => {\n const subscriptions = await getActiveSubscriptions(subscriptionIds);\n return subscriptions.length > 0;\n};\n"]}
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAKzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EACL,sBAAsB,EACtB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I,6BAG/B;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,KAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAwBnC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,QAAO,OAAO,CAAC,MAAM,CAMjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,MAAM,CAK9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,iBAAiB;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KACA,OAAO,CAAC,GAAG,CAwBb,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,KAAG,OAAO,CAAC,IAAI,CA2Bf,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -272,9 +272,7 @@ export const requestPurchase = (requestObj) => {
|
|
|
272
272
|
return (async () => {
|
|
273
273
|
const offer = offerToRecordIOS(withOffer);
|
|
274
274
|
const purchase = await ExpoIapModule.buyProduct(sku, andDangerouslyFinishTransactionAutomatically, appAccountToken, quantity ?? -1, offer);
|
|
275
|
-
return type === 'inapp'
|
|
276
|
-
? purchase
|
|
277
|
-
: purchase;
|
|
275
|
+
return type === 'inapp' ? purchase : purchase;
|
|
278
276
|
})();
|
|
279
277
|
}
|
|
280
278
|
if (Platform.OS === 'android') {
|