expo-iap 2.8.0 → 2.8.2
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 +57 -1
- package/CLAUDE.md +44 -7
- package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +52 -35
- package/build/ExpoIap.types.d.ts +26 -23
- package/build/ExpoIap.types.d.ts.map +1 -1
- package/build/ExpoIap.types.js +0 -1
- package/build/ExpoIap.types.js.map +1 -1
- package/build/index.d.ts +6 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -5
- package/build/index.js.map +1 -1
- package/build/modules/ios.d.ts +8 -8
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +3 -3
- package/build/modules/ios.js.map +1 -1
- package/build/types/ExpoIapAndroid.types.d.ts +50 -15
- package/build/types/ExpoIapAndroid.types.d.ts.map +1 -1
- package/build/types/ExpoIapAndroid.types.js +11 -6
- package/build/types/ExpoIapAndroid.types.js.map +1 -1
- package/build/types/ExpoIapIOS.types.d.ts +43 -22
- package/build/types/ExpoIapIOS.types.d.ts.map +1 -1
- package/build/types/ExpoIapIOS.types.js.map +1 -1
- package/build/useIAP.d.ts +6 -6
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js.map +1 -1
- package/bun.lock +122 -456
- package/ios/ExpoIapModule.swift +87 -5
- package/package.json +1 -1
- package/src/ExpoIap.types.ts +45 -45
- package/src/index.ts +14 -24
- package/src/modules/ios.ts +13 -20
- package/src/types/ExpoIapAndroid.types.ts +62 -15
- package/src/types/ExpoIapIOS.types.ts +49 -25
- package/src/useIAP.ts +11 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,68 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [2.8.2] - 2025-08-26
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Added `platform` field to all IAP types for improved runtime type discrimination
|
|
8
|
+
- Consolidated `Purchase` types and deprecated legacy type aliases for consistency
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Refactored and consolidated Purchase types to follow OpenIAP specification
|
|
13
|
+
- Improved type consistency across iOS and Android platforms
|
|
14
|
+
|
|
15
|
+
### Deprecated
|
|
16
|
+
|
|
17
|
+
**Note**: The following deprecated type aliases will be removed in v2.9.0:
|
|
18
|
+
|
|
19
|
+
- `ProductPurchase` (use `Purchase` instead)
|
|
20
|
+
- `SubscriptionPurchase` (use `Purchase` instead)
|
|
21
|
+
|
|
22
|
+
## [2.8.1] - 2025-08-19
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- Added `debugDescription?: string` field to `ProductCommon` for debugging purposes
|
|
27
|
+
- Added `platform?: string` field to `ProductCommon` and `PurchaseCommon` for platform identification
|
|
28
|
+
- Added `platform: "ios"` to iOS-specific types (`ProductIOS`, `ProductSubscriptionIOS`, `PurchaseIOS`)
|
|
29
|
+
- Added `platform: "android"` to Android-specific types (`ProductAndroid`, `ProductSubscriptionAndroid`, `PurchaseAndroid`)
|
|
30
|
+
- Added `ids?: string[]` field to `PurchaseCommon` (moved from Android-specific types)
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- Moved common fields from platform-specific types to shared Common types
|
|
35
|
+
- Updated iOS native code to populate missing subscription fields:
|
|
36
|
+
- `introductoryPriceAsAmountIOS`
|
|
37
|
+
- `introductoryPricePaymentModeIOS`
|
|
38
|
+
- `introductoryPriceNumberOfPeriodsIOS`
|
|
39
|
+
- `introductoryPriceSubscriptionPeriodIOS`
|
|
40
|
+
- `subscriptionPeriodNumberIOS`
|
|
41
|
+
- `subscriptionPeriodUnitIOS`
|
|
42
|
+
- Updated Android native code to use common `ids` field instead of platform-specific `idsAndroid`
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Fixed type mismatches between Product and Purchase types across iOS and Android platforms
|
|
47
|
+
- Resolved missing field mappings in iOS native subscription data extraction
|
|
48
|
+
- Improved type consistency for cross-platform compatibility
|
|
49
|
+
|
|
50
|
+
### Deprecated
|
|
51
|
+
|
|
52
|
+
**Note**: No breaking changes in this release. The following deprecated fields will be removed in v2.9.0:
|
|
53
|
+
|
|
54
|
+
- Android: `idsAndroid` (use common `ids` field instead)
|
|
55
|
+
- Android: `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails` (use fields with `Android` suffix)
|
|
56
|
+
- iOS: `displayName`, `isFamilyShareable`, `jsonRepresentation`, `subscription` (use fields with `IOS` suffix)
|
|
57
|
+
- iOS: `discounts`, `introductoryPrice` (use fields with `IOS` suffix)
|
|
58
|
+
|
|
3
59
|
## [2.8.0] - 2025-08-18
|
|
4
60
|
|
|
5
61
|
### Breaking Changes
|
|
6
62
|
|
|
7
63
|
- **iOS Field Naming Convention**: All iOS-related field names ending with "Ios" have been renamed to end with "IOS" to follow the convention that acronyms at the end of field names should be uppercase.
|
|
8
64
|
|
|
9
|
-
**Migration Guide**: See the full migration guide at [expo-iap.
|
|
65
|
+
**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)
|
|
10
66
|
|
|
11
67
|
Affected fields:
|
|
12
68
|
|
package/CLAUDE.md
CHANGED
|
@@ -1,5 +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
|
+
|
|
3
17
|
## Expo-Specific Guidelines
|
|
4
18
|
|
|
5
19
|
### Pre-Commit Checks
|
|
@@ -17,14 +31,37 @@ Before committing any changes:
|
|
|
17
31
|
|
|
18
32
|
### Platform-Specific Naming Conventions
|
|
19
33
|
|
|
20
|
-
|
|
34
|
+
#### Field Naming
|
|
35
|
+
|
|
36
|
+
- **iOS-related fields**: Use `IOS` suffix (e.g., `displayNameIOS`, `discountsIOS`, `introductoryPriceIOS`)
|
|
21
37
|
- **Exception**: When an acronym appears at the end of a field name, use uppercase (e.g., `quantityIOS`, `appBundleIdIOS`, not `quantityIos`)
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- **
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
38
|
+
- Platform-specific fields: `currencyCodeIOS`, `currencySymbolIOS`, `countryCodeIOS`
|
|
39
|
+
- Product fields: `isFamilyShareableIOS`, `jsonRepresentationIOS`, `subscriptionInfoIOS`
|
|
40
|
+
- **Android-related fields**: Use `Android` suffix (e.g., `nameAndroid`)
|
|
41
|
+
- Platform-specific fields: `oneTimePurchaseOfferDetailsAndroid`, `subscriptionOfferDetailsAndroid`
|
|
42
|
+
- Keep `pricingPhases` (not `pricingPhasesAndroid`) for consistency with Google Play Billing
|
|
43
|
+
- **Common fields**: Fields shared across platforms go in Common types (e.g., `ids`, `platform`, `debugDescription`)
|
|
44
|
+
- Use these for data that exists on both platforms without platform-specific variations
|
|
45
|
+
|
|
46
|
+
#### Type Naming
|
|
47
|
+
|
|
48
|
+
- **iOS types**: Use `IOS` suffix (e.g., `PurchaseIOS`, `ProductIOS`)
|
|
49
|
+
- **Android types**: Use descriptive prefixes to identify subtypes:
|
|
50
|
+
- ✅ Good: `ProductAndroidOneTimePurchaseOfferDetail`, `ProductSubscriptionAndroidOfferDetails`, `PurchaseAndroidState`
|
|
51
|
+
- ❌ Avoid: `OneTimePurchaseOfferDetails`, `SubscriptionOfferAndroid`, `PurchaseStateAndroid`
|
|
52
|
+
- **General IAP types**: Use `Iap` prefix (e.g., `IapPurchase`, not `IAPPurchase`)
|
|
53
|
+
|
|
54
|
+
#### General Rules
|
|
55
|
+
|
|
56
|
+
- **ID fields**: Use `Id` instead of `ID` (e.g., `productId`, `transactionId`, not `productID`, `transactionID`)
|
|
57
|
+
- **Consistent naming**: This applies to functions, types, and file names
|
|
58
|
+
- **Deprecation**: Fields without platform suffixes will be removed in v2.9.0
|
|
59
|
+
|
|
60
|
+
### Type System
|
|
61
|
+
|
|
62
|
+
For complete type definitions and documentation, see: <https://www.openiap.dev/docs/types>
|
|
63
|
+
|
|
64
|
+
The library follows the OpenIAP type specifications with platform-specific extensions using iOS/Android suffixes.
|
|
28
65
|
|
|
29
66
|
### React/JSX Conventions
|
|
30
67
|
|
|
@@ -199,48 +199,65 @@ class ExpoIapModule :
|
|
|
199
199
|
?: productDetails.subscriptionOfferDetails?.firstOrNull()?.pricingPhases?.pricingPhaseList?.firstOrNull()?.formattedPrice
|
|
200
200
|
?: "N/A"
|
|
201
201
|
|
|
202
|
+
// Prepare reusable data
|
|
203
|
+
val oneTimePurchaseData = productDetails.oneTimePurchaseOfferDetails?.let {
|
|
204
|
+
mapOf(
|
|
205
|
+
"priceCurrencyCode" to it.priceCurrencyCode,
|
|
206
|
+
"formattedPrice" to it.formattedPrice,
|
|
207
|
+
"priceAmountMicros" to it.priceAmountMicros.toString(),
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
val subscriptionOfferData = productDetails.subscriptionOfferDetails?.map { subscriptionOfferDetailsItem ->
|
|
212
|
+
mapOf(
|
|
213
|
+
"basePlanId" to subscriptionOfferDetailsItem.basePlanId,
|
|
214
|
+
"offerId" to subscriptionOfferDetailsItem.offerId,
|
|
215
|
+
"offerToken" to subscriptionOfferDetailsItem.offerToken,
|
|
216
|
+
"offerTags" to subscriptionOfferDetailsItem.offerTags,
|
|
217
|
+
"pricingPhases" to
|
|
218
|
+
mapOf(
|
|
219
|
+
"pricingPhaseList" to
|
|
220
|
+
subscriptionOfferDetailsItem.pricingPhases.pricingPhaseList.map
|
|
221
|
+
{ pricingPhaseItem ->
|
|
222
|
+
mapOf(
|
|
223
|
+
"formattedPrice" to pricingPhaseItem.formattedPrice,
|
|
224
|
+
"priceCurrencyCode" to pricingPhaseItem.priceCurrencyCode,
|
|
225
|
+
"billingPeriod" to pricingPhaseItem.billingPeriod,
|
|
226
|
+
"billingCycleCount" to pricingPhaseItem.billingCycleCount,
|
|
227
|
+
"priceAmountMicros" to
|
|
228
|
+
pricingPhaseItem.priceAmountMicros.toString(),
|
|
229
|
+
"recurrenceMode" to pricingPhaseItem.recurrenceMode,
|
|
230
|
+
)
|
|
231
|
+
},
|
|
232
|
+
),
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Convert Android productType to our expected 'inapp' or 'subs'
|
|
237
|
+
val productType = if (productDetails.productType == BillingClient.ProductType.SUBS) "subs" else "inapp"
|
|
238
|
+
|
|
202
239
|
mapOf(
|
|
203
240
|
"id" to productDetails.productId,
|
|
204
241
|
"title" to productDetails.title,
|
|
205
242
|
"description" to productDetails.description,
|
|
206
|
-
"type" to
|
|
207
|
-
|
|
243
|
+
"type" to productType,
|
|
244
|
+
// New field names with Android suffix
|
|
245
|
+
"nameAndroid" to productDetails.name,
|
|
246
|
+
"oneTimePurchaseOfferDetailsAndroid" to oneTimePurchaseData,
|
|
247
|
+
"subscriptionOfferDetailsAndroid" to subscriptionOfferData,
|
|
208
248
|
"platform" to "android",
|
|
209
249
|
"currency" to currency,
|
|
210
250
|
"displayPrice" to displayPrice,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
"subscriptionOfferDetails" to
|
|
220
|
-
|
|
221
|
-
mapOf(
|
|
222
|
-
"basePlanId" to subscriptionOfferDetailsItem.basePlanId,
|
|
223
|
-
"offerId" to subscriptionOfferDetailsItem.offerId,
|
|
224
|
-
"offerToken" to subscriptionOfferDetailsItem.offerToken,
|
|
225
|
-
"offerTags" to subscriptionOfferDetailsItem.offerTags,
|
|
226
|
-
"pricingPhases" to
|
|
227
|
-
mapOf(
|
|
228
|
-
"pricingPhaseList" to
|
|
229
|
-
subscriptionOfferDetailsItem.pricingPhases.pricingPhaseList.map
|
|
230
|
-
{ pricingPhaseItem ->
|
|
231
|
-
mapOf(
|
|
232
|
-
"formattedPrice" to pricingPhaseItem.formattedPrice,
|
|
233
|
-
"priceCurrencyCode" to pricingPhaseItem.priceCurrencyCode,
|
|
234
|
-
"billingPeriod" to pricingPhaseItem.billingPeriod,
|
|
235
|
-
"billingCycleCount" to pricingPhaseItem.billingCycleCount,
|
|
236
|
-
"priceAmountMicros" to
|
|
237
|
-
pricingPhaseItem.priceAmountMicros.toString(),
|
|
238
|
-
"recurrenceMode" to pricingPhaseItem.recurrenceMode,
|
|
239
|
-
)
|
|
240
|
-
},
|
|
241
|
-
),
|
|
242
|
-
)
|
|
243
|
-
},
|
|
251
|
+
// START: Deprecated - will be removed in v2.9.0
|
|
252
|
+
// Use nameAndroid instead of displayName
|
|
253
|
+
"displayName" to productDetails.name,
|
|
254
|
+
// Use nameAndroid instead of name
|
|
255
|
+
"name" to productDetails.name,
|
|
256
|
+
// Use oneTimePurchaseOfferDetailsAndroid instead of oneTimePurchaseOfferDetails
|
|
257
|
+
"oneTimePurchaseOfferDetails" to oneTimePurchaseData,
|
|
258
|
+
// Use subscriptionOfferDetailsAndroid instead of subscriptionOfferDetails
|
|
259
|
+
"subscriptionOfferDetails" to subscriptionOfferData,
|
|
260
|
+
// END: Deprecated - will be removed in v2.9.0
|
|
244
261
|
)
|
|
245
262
|
}
|
|
246
263
|
promise.resolve(items)
|
package/build/ExpoIap.types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ProductAndroid,
|
|
2
|
-
import { ProductIOS,
|
|
1
|
+
import { ProductAndroid, PurchaseAndroid, ProductSubscriptionAndroid } from './types/ExpoIapAndroid.types';
|
|
2
|
+
import { ProductIOS, PurchaseIOS, ProductSubscriptionIOS } from './types/ExpoIapIOS.types';
|
|
3
3
|
export type ChangeEventPayload = {
|
|
4
4
|
value: string;
|
|
5
5
|
};
|
|
6
6
|
export type ProductType = 'inapp' | 'subs';
|
|
7
|
-
export type
|
|
7
|
+
export type ProductCommon = {
|
|
8
8
|
id: string;
|
|
9
9
|
title: string;
|
|
10
10
|
description: string;
|
|
@@ -13,14 +13,21 @@ export type ProductBase = {
|
|
|
13
13
|
displayPrice: string;
|
|
14
14
|
currency: string;
|
|
15
15
|
price?: number;
|
|
16
|
+
debugDescription?: string;
|
|
17
|
+
platform?: string;
|
|
16
18
|
};
|
|
17
|
-
export type
|
|
19
|
+
export type PurchaseCommon = {
|
|
18
20
|
id: string;
|
|
19
21
|
productId: string;
|
|
22
|
+
ids?: string[];
|
|
20
23
|
transactionId?: string;
|
|
21
24
|
transactionDate: number;
|
|
22
25
|
transactionReceipt: string;
|
|
23
26
|
purchaseToken?: string;
|
|
27
|
+
platform?: string;
|
|
28
|
+
};
|
|
29
|
+
export type ProductSubscriptionCommon = ProductCommon & {
|
|
30
|
+
type: 'subs';
|
|
24
31
|
};
|
|
25
32
|
export type IosPlatform = {
|
|
26
33
|
platform: 'ios';
|
|
@@ -29,18 +36,18 @@ export type AndroidPlatform = {
|
|
|
29
36
|
platform: 'android';
|
|
30
37
|
};
|
|
31
38
|
export type Product = (ProductAndroid & AndroidPlatform) | (ProductIOS & IosPlatform);
|
|
32
|
-
export type SubscriptionProduct = (
|
|
33
|
-
export type {
|
|
34
|
-
export type {
|
|
39
|
+
export type SubscriptionProduct = (ProductSubscriptionAndroid & AndroidPlatform) | (ProductSubscriptionIOS & IosPlatform);
|
|
40
|
+
export type { PurchaseAndroid, ProductSubscriptionAndroid, } from './types/ExpoIapAndroid.types';
|
|
41
|
+
export type { PurchaseIOS, ProductSubscriptionIOS, } from './types/ExpoIapIOS.types';
|
|
42
|
+
export type Purchase = (PurchaseAndroid & AndroidPlatform) | (PurchaseIOS & IosPlatform);
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.
|
|
45
|
+
*/
|
|
46
|
+
export type ProductPurchase = Purchase;
|
|
35
47
|
/**
|
|
36
|
-
* @deprecated Use
|
|
48
|
+
* @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.
|
|
37
49
|
*/
|
|
38
|
-
export type
|
|
39
|
-
export type ProductPurchase = (ProductPurchaseAndroid & AndroidPlatform) | (ProductPurchaseIOS & IosPlatform);
|
|
40
|
-
export type SubscriptionPurchase = (ProductPurchaseAndroid & AndroidPlatform & {
|
|
41
|
-
autoRenewingAndroid: boolean;
|
|
42
|
-
}) | (ProductPurchaseIOS & IosPlatform);
|
|
43
|
-
export type Purchase = ProductPurchase | SubscriptionPurchase;
|
|
50
|
+
export type SubscriptionPurchase = Purchase;
|
|
44
51
|
export type PurchaseResult = {
|
|
45
52
|
responseCode?: number;
|
|
46
53
|
debugMessage?: string;
|
|
@@ -201,7 +208,7 @@ export declare const ErrorCodeUtils: {
|
|
|
201
208
|
export interface UnifiedRequestPurchaseProps {
|
|
202
209
|
readonly sku?: string;
|
|
203
210
|
readonly skus?: string[];
|
|
204
|
-
readonly
|
|
211
|
+
readonly andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
205
212
|
readonly appAccountToken?: string;
|
|
206
213
|
readonly quantity?: number;
|
|
207
214
|
readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;
|
|
@@ -212,9 +219,9 @@ export interface UnifiedRequestPurchaseProps {
|
|
|
212
219
|
/**
|
|
213
220
|
* iOS-specific purchase request parameters
|
|
214
221
|
*/
|
|
215
|
-
export interface
|
|
222
|
+
export interface RequestPurchaseIosProps {
|
|
216
223
|
readonly sku: string;
|
|
217
|
-
readonly
|
|
224
|
+
readonly andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
218
225
|
readonly appAccountToken?: string;
|
|
219
226
|
readonly quantity?: number;
|
|
220
227
|
readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;
|
|
@@ -244,14 +251,14 @@ export interface RequestSubscriptionAndroidProps extends RequestPurchaseAndroidP
|
|
|
244
251
|
* Allows clear separation of iOS and Android parameters
|
|
245
252
|
*/
|
|
246
253
|
export interface RequestPurchasePropsByPlatforms {
|
|
247
|
-
readonly ios?:
|
|
254
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
248
255
|
readonly android?: RequestPurchaseAndroidProps;
|
|
249
256
|
}
|
|
250
257
|
/**
|
|
251
258
|
* Modern platform-specific subscription request structure (v2.7.0+)
|
|
252
259
|
*/
|
|
253
260
|
export interface RequestSubscriptionPropsByPlatforms {
|
|
254
|
-
readonly ios?:
|
|
261
|
+
readonly ios?: RequestPurchaseIosProps;
|
|
255
262
|
readonly android?: RequestSubscriptionAndroidProps;
|
|
256
263
|
}
|
|
257
264
|
/**
|
|
@@ -264,8 +271,4 @@ export type RequestPurchaseProps = RequestPurchasePropsByPlatforms;
|
|
|
264
271
|
* This is the recommended API moving forward
|
|
265
272
|
*/
|
|
266
273
|
export type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;
|
|
267
|
-
/**
|
|
268
|
-
* @deprecated Use RequestPurchaseIOSProps instead. This alias will be removed in v3.0.0.
|
|
269
|
-
*/
|
|
270
|
-
export type RequestPurchaseIosProps = RequestPurchaseIOSProps;
|
|
271
274
|
//# sourceMappingURL=ExpoIap.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIap.types.d.ts","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.d.ts","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ClB,EAAE;QACX,OAAO,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC;AAuGF,2EAA2E","sourcesContent":["import {\n ProductAndroid,\n ProductPurchaseAndroid,\n SubscriptionProductAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIOS,\n ProductPurchaseIOS,\n SubscriptionProductIOS,\n} from './types/ExpoIapIOS.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\nexport type ProductBase = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n};\n\nexport type PurchaseBase = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIOS & IosPlatform);\n\nexport type SubscriptionProduct =\n | (SubscriptionProductAndroid & AndroidPlatform)\n | (SubscriptionProductIOS & IosPlatform);\n\n// ============================================================================\n// Legacy Types (For backward compatibility with useIAP hook)\n// ============================================================================\n\n// Re-export platform-specific purchase types for legacy compatibility\nexport type {ProductPurchaseAndroid} from './types/ExpoIapAndroid.types';\nexport type {ProductPurchaseIOS} from './types/ExpoIapIOS.types';\n\n/**\n * @deprecated Use ProductPurchaseIOS instead. This alias will be removed in v3.0.0.\n */\nexport type ProductPurchaseIos = ProductPurchaseIOS;\n\n// Union type for platform-specific purchase types (legacy support)\nexport type ProductPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform)\n | (ProductPurchaseIOS & IosPlatform);\n\n// Union type for platform-specific subscription purchase types (legacy support)\nexport type SubscriptionPurchase =\n | (ProductPurchaseAndroid & AndroidPlatform & {autoRenewingAndroid: boolean})\n | (ProductPurchaseIOS & IosPlatform);\n\nexport type Purchase = ProductPurchase | SubscriptionPurchase;\n\n// Legacy result type\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n purchaseToken?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n },\n} as const;\n\nexport class PurchaseError implements Error {\n constructor(\n public name: string,\n public message: string,\n public responseCode?: number,\n public debugMessage?: string,\n public code?: ErrorCode,\n public productId?: string,\n public platform?: 'ios' | 'android',\n ) {\n this.name = '[expo-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n this.platform = platform;\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError(\n '[expo-iap]: PurchaseError',\n errorData.message || 'Unknown error occurred',\n errorData.responseCode,\n errorData.debugMessage,\n errorCode,\n errorData.productId,\n platform,\n );\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n const mapping = ErrorCodeMapping[platform];\n\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n return (\n ErrorCodeMapping[platform][errorCode] ??\n (platform === 'ios' ? 0 : 'E_UNKNOWN')\n );\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIOSProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomaticallyIOS?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIOSProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIOSProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n\n// ============================================================================\n// Deprecated Aliases for Backward Compatibility\n// ============================================================================\n\n/**\n * @deprecated Use RequestPurchaseIOSProps instead. This alias will be removed in v3.0.0.\n */\nexport type RequestPurchaseIosProps = RequestPurchaseIOSProps;\n\n// Note: Type guard functions are exported from index.ts to avoid conflicts\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoIap.types.js","sourceRoot":"","sources":["../src/ExpoIap.types.ts"],"names":[],"mappings":"AAUA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAyFnD;;;GAGG;AACH,MAAM,CAAN,IAAY,SAyBX;AAzBD,WAAY,SAAS;IACnB,oCAAuB,CAAA;IACvB,kDAAqC,CAAA;IACrC,0CAA6B,CAAA;IAC7B,sDAAyC,CAAA;IACzC,8CAAiC,CAAA;IACjC,gDAAmC,CAAA;IACnC,gDAAmC,CAAA;IACnC,kDAAqC,CAAA;IACrC,oEAAuD,CAAA;IACvD,8CAAiC,CAAA;IACjC,wCAA2B,CAAA;IAC3B,gDAAmC,CAAA;IACnC,oDAAuC,CAAA;IACvC,wFAA2E,CAAA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AAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,EAAE,CAClB,SAAoB,EACpB,QAA2B,EAClB,EAAE;QACX,OAAO,SAAS,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACjD,CAAC;CACF,CAAC","sourcesContent":["import {\n ProductAndroid,\n PurchaseAndroid,\n ProductSubscriptionAndroid,\n} from './types/ExpoIapAndroid.types';\nimport {\n ProductIOS,\n PurchaseIOS,\n ProductSubscriptionIOS,\n} from './types/ExpoIapIOS.types';\nimport {NATIVE_ERROR_CODES} from './ExpoIapModule';\n\nexport type ChangeEventPayload = {\n value: string;\n};\n\nexport type ProductType = 'inapp' | 'subs';\n\n// =============================================================================\n// COMMON TYPES (Base types shared across all platforms)\n// =============================================================================\n\nexport type ProductCommon = {\n id: string;\n title: string;\n description: string;\n type: ProductType;\n displayName?: string;\n displayPrice: string;\n currency: string;\n price?: number;\n debugDescription?: string;\n platform?: string;\n};\n\nexport type PurchaseCommon = {\n id: string; // Transaction identifier - used by finishTransaction\n productId: string; // Product identifier - which product was purchased\n ids?: string[]; // Product identifiers for purchases that include multiple products\n transactionId?: string; // @deprecated - use id instead\n transactionDate: number;\n transactionReceipt: string;\n purchaseToken?: string; // Unified purchase token (jwsRepresentation for iOS, purchaseToken for Android)\n platform?: string;\n};\n\nexport type ProductSubscriptionCommon = ProductCommon & {\n type: 'subs';\n};\n\n// Define literal platform types for better type discrimination\nexport type IosPlatform = {platform: 'ios'};\nexport type AndroidPlatform = {platform: 'android'};\n\n// Platform-agnostic unified product types (public API)\nexport type Product =\n | (ProductAndroid & AndroidPlatform)\n | (ProductIOS & IosPlatform);\n\nexport type SubscriptionProduct =\n | (ProductSubscriptionAndroid & AndroidPlatform)\n | (ProductSubscriptionIOS & IosPlatform);\n\n// Re-export platform-specific types\nexport type {\n PurchaseAndroid,\n ProductSubscriptionAndroid,\n} from './types/ExpoIapAndroid.types';\nexport type {\n PurchaseIOS,\n ProductSubscriptionIOS,\n} from './types/ExpoIapIOS.types';\n\n// Unified purchase type for both products and subscriptions\nexport type Purchase =\n | (PurchaseAndroid & AndroidPlatform)\n | (PurchaseIOS & IosPlatform);\n\n// Legacy type aliases - deprecated, use Purchase instead\n/**\n * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.\n */\nexport type ProductPurchase = Purchase;\n/**\n * @deprecated Use `Purchase` instead. This type alias will be removed in v2.9.0.\n */\nexport type SubscriptionPurchase = Purchase;\n\nexport type PurchaseResult = {\n responseCode?: number;\n debugMessage?: string;\n code?: string;\n message?: string;\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n purchaseToken?: string;\n};\n/**\n * Centralized error codes for expo-iap\n * These are mapped to platform-specific error codes and provide consistent error handling\n */\nexport enum ErrorCode {\n E_UNKNOWN = 'E_UNKNOWN',\n E_USER_CANCELLED = 'E_USER_CANCELLED',\n E_USER_ERROR = 'E_USER_ERROR',\n E_ITEM_UNAVAILABLE = 'E_ITEM_UNAVAILABLE',\n E_REMOTE_ERROR = 'E_REMOTE_ERROR',\n E_NETWORK_ERROR = 'E_NETWORK_ERROR',\n E_SERVICE_ERROR = 'E_SERVICE_ERROR',\n E_RECEIPT_FAILED = 'E_RECEIPT_FAILED',\n E_RECEIPT_FINISHED_FAILED = 'E_RECEIPT_FINISHED_FAILED',\n E_NOT_PREPARED = 'E_NOT_PREPARED',\n E_NOT_ENDED = 'E_NOT_ENDED',\n E_ALREADY_OWNED = 'E_ALREADY_OWNED',\n E_DEVELOPER_ERROR = 'E_DEVELOPER_ERROR',\n E_BILLING_RESPONSE_JSON_PARSE_ERROR = 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n E_DEFERRED_PAYMENT = 'E_DEFERRED_PAYMENT',\n E_INTERRUPTED = 'E_INTERRUPTED',\n E_IAP_NOT_AVAILABLE = 'E_IAP_NOT_AVAILABLE',\n E_PURCHASE_ERROR = 'E_PURCHASE_ERROR',\n E_SYNC_ERROR = 'E_SYNC_ERROR',\n E_TRANSACTION_VALIDATION_FAILED = 'E_TRANSACTION_VALIDATION_FAILED',\n E_ACTIVITY_UNAVAILABLE = 'E_ACTIVITY_UNAVAILABLE',\n E_ALREADY_PREPARED = 'E_ALREADY_PREPARED',\n E_PENDING = 'E_PENDING',\n E_CONNECTION_CLOSED = 'E_CONNECTION_CLOSED',\n}\n\n/**\n * Platform-specific error code mappings\n * Maps ErrorCode enum values to platform-specific integer codes\n */\nexport const ErrorCodeMapping = {\n ios: {\n [ErrorCode.E_UNKNOWN]: 0,\n [ErrorCode.E_SERVICE_ERROR]: 1,\n [ErrorCode.E_USER_CANCELLED]: 2,\n [ErrorCode.E_USER_ERROR]: 3,\n [ErrorCode.E_ITEM_UNAVAILABLE]: 4,\n [ErrorCode.E_REMOTE_ERROR]: 5,\n [ErrorCode.E_NETWORK_ERROR]: 6,\n [ErrorCode.E_RECEIPT_FAILED]: 7,\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 8,\n [ErrorCode.E_DEVELOPER_ERROR]: 9,\n [ErrorCode.E_PURCHASE_ERROR]: 10,\n [ErrorCode.E_SYNC_ERROR]: 11,\n [ErrorCode.E_DEFERRED_PAYMENT]: 12,\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]: 13,\n [ErrorCode.E_NOT_PREPARED]: 14,\n [ErrorCode.E_NOT_ENDED]: 15,\n [ErrorCode.E_ALREADY_OWNED]: 16,\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]: 17,\n [ErrorCode.E_INTERRUPTED]: 18,\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 19,\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 20,\n [ErrorCode.E_ALREADY_PREPARED]: 21,\n [ErrorCode.E_PENDING]: 22,\n [ErrorCode.E_CONNECTION_CLOSED]: 23,\n },\n android: {\n [ErrorCode.E_UNKNOWN]: 'E_UNKNOWN',\n [ErrorCode.E_USER_CANCELLED]: 'E_USER_CANCELLED',\n [ErrorCode.E_USER_ERROR]: 'E_USER_ERROR',\n [ErrorCode.E_ITEM_UNAVAILABLE]: 'E_ITEM_UNAVAILABLE',\n [ErrorCode.E_REMOTE_ERROR]: 'E_REMOTE_ERROR',\n [ErrorCode.E_NETWORK_ERROR]: 'E_NETWORK_ERROR',\n [ErrorCode.E_SERVICE_ERROR]: 'E_SERVICE_ERROR',\n [ErrorCode.E_RECEIPT_FAILED]: 'E_RECEIPT_FAILED',\n [ErrorCode.E_RECEIPT_FINISHED_FAILED]: 'E_RECEIPT_FINISHED_FAILED',\n [ErrorCode.E_NOT_PREPARED]: 'E_NOT_PREPARED',\n [ErrorCode.E_NOT_ENDED]: 'E_NOT_ENDED',\n [ErrorCode.E_ALREADY_OWNED]: 'E_ALREADY_OWNED',\n [ErrorCode.E_DEVELOPER_ERROR]: 'E_DEVELOPER_ERROR',\n [ErrorCode.E_BILLING_RESPONSE_JSON_PARSE_ERROR]:\n 'E_BILLING_RESPONSE_JSON_PARSE_ERROR',\n [ErrorCode.E_DEFERRED_PAYMENT]: 'E_DEFERRED_PAYMENT',\n [ErrorCode.E_INTERRUPTED]: 'E_INTERRUPTED',\n [ErrorCode.E_IAP_NOT_AVAILABLE]: 'E_IAP_NOT_AVAILABLE',\n [ErrorCode.E_PURCHASE_ERROR]: 'E_PURCHASE_ERROR',\n [ErrorCode.E_SYNC_ERROR]: 'E_SYNC_ERROR',\n [ErrorCode.E_TRANSACTION_VALIDATION_FAILED]:\n 'E_TRANSACTION_VALIDATION_FAILED',\n [ErrorCode.E_ACTIVITY_UNAVAILABLE]: 'E_ACTIVITY_UNAVAILABLE',\n [ErrorCode.E_ALREADY_PREPARED]: 'E_ALREADY_PREPARED',\n [ErrorCode.E_PENDING]: 'E_PENDING',\n [ErrorCode.E_CONNECTION_CLOSED]: 'E_CONNECTION_CLOSED',\n },\n} as const;\n\nexport class PurchaseError implements Error {\n constructor(\n public name: string,\n public message: string,\n public responseCode?: number,\n public debugMessage?: string,\n public code?: ErrorCode,\n public productId?: string,\n public platform?: 'ios' | 'android',\n ) {\n this.name = '[expo-iap]: PurchaseError';\n this.message = message;\n this.responseCode = responseCode;\n this.debugMessage = debugMessage;\n this.code = code;\n this.productId = productId;\n this.platform = platform;\n }\n\n /**\n * Creates a PurchaseError from platform-specific error data\n * @param errorData Raw error data from native modules\n * @param platform Platform where the error occurred\n * @returns Properly typed PurchaseError instance\n */\n static fromPlatformError(\n errorData: any,\n platform: 'ios' | 'android',\n ): PurchaseError {\n const errorCode = errorData.code\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, platform)\n : ErrorCode.E_UNKNOWN;\n\n return new PurchaseError(\n '[expo-iap]: PurchaseError',\n errorData.message || 'Unknown error occurred',\n errorData.responseCode,\n errorData.debugMessage,\n errorCode,\n errorData.productId,\n platform,\n );\n }\n\n /**\n * Gets the platform-specific error code for this error\n * @returns Platform-specific error code\n */\n getPlatformCode(): string | number | undefined {\n if (!this.code || !this.platform) return undefined;\n return ErrorCodeUtils.toPlatformCode(this.code, this.platform);\n }\n}\n\n/**\n * Utility functions for error code mapping and validation\n */\nexport const ErrorCodeUtils = {\n /**\n * Gets the native error code for the current platform\n * @param errorCode ErrorCode enum value\n * @returns Platform-specific error code from native constants\n */\n getNativeErrorCode: (errorCode: ErrorCode): string => {\n return NATIVE_ERROR_CODES[errorCode] || errorCode;\n },\n\n /**\n * Maps a platform-specific error code back to the standardized ErrorCode enum\n * @param platformCode Platform-specific error code (string for Android, number for iOS)\n * @param platform Target platform\n * @returns Corresponding ErrorCode enum value or E_UNKNOWN if not found\n */\n fromPlatformCode: (\n platformCode: string | number,\n platform: 'ios' | 'android',\n ): ErrorCode => {\n const mapping = ErrorCodeMapping[platform];\n\n for (const [errorCode, mappedCode] of Object.entries(mapping)) {\n if (mappedCode === platformCode) {\n return errorCode as ErrorCode;\n }\n }\n\n return ErrorCode.E_UNKNOWN;\n },\n\n /**\n * Maps an ErrorCode enum to platform-specific code\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns Platform-specific error code\n */\n toPlatformCode: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): string | number => {\n return (\n ErrorCodeMapping[platform][errorCode] ??\n (platform === 'ios' ? 0 : 'E_UNKNOWN')\n );\n },\n\n /**\n * Checks if an error code is valid for the specified platform\n * @param errorCode ErrorCode enum value\n * @param platform Target platform\n * @returns True if the error code is supported on the platform\n */\n isValidForPlatform: (\n errorCode: ErrorCode,\n platform: 'ios' | 'android',\n ): boolean => {\n return errorCode in ErrorCodeMapping[platform];\n },\n};\n\n// ============================================================================\n// Enhanced Unified Request Types\n// ============================================================================\n\n/**\n * Unified request props that work on both iOS and Android platforms\n * iOS will use 'sku', Android will use 'skus' (or convert sku to skus array)\n */\nexport interface UnifiedRequestPurchaseProps {\n // Universal properties - works on both platforms\n readonly sku?: string; // Single SKU (iOS native, Android fallback)\n readonly skus?: string[]; // Multiple SKUs (Android native, iOS uses first item)\n\n // iOS-specific properties (ignored on Android)\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n\n // Android-specific properties (ignored on iOS)\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n// ============================================================================\n// New Platform-Specific Request Types (v2.7.0+)\n// ============================================================================\n\n/**\n * iOS-specific purchase request parameters\n */\nexport interface RequestPurchaseIosProps {\n readonly sku: string;\n readonly andDangerouslyFinishTransactionAutomatically?: boolean;\n readonly appAccountToken?: string;\n readonly quantity?: number;\n readonly withOffer?: import('./types/ExpoIapIOS.types').PaymentDiscount;\n}\n\n/**\n * Android-specific purchase request parameters\n */\nexport interface RequestPurchaseAndroidProps {\n readonly skus: string[];\n readonly obfuscatedAccountIdAndroid?: string;\n readonly obfuscatedProfileIdAndroid?: string;\n readonly isOfferPersonalized?: boolean;\n}\n\n/**\n * Android-specific subscription request parameters\n */\nexport interface RequestSubscriptionAndroidProps\n extends RequestPurchaseAndroidProps {\n readonly purchaseTokenAndroid?: string;\n readonly replacementModeAndroid?: number;\n readonly subscriptionOffers: {\n sku: string;\n offerToken: string;\n }[];\n}\n\n/**\n * Modern platform-specific request structure (v2.7.0+)\n * Allows clear separation of iOS and Android parameters\n */\nexport interface RequestPurchasePropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestPurchaseAndroidProps;\n}\n\n/**\n * Modern platform-specific subscription request structure (v2.7.0+)\n */\nexport interface RequestSubscriptionPropsByPlatforms {\n readonly ios?: RequestPurchaseIosProps;\n readonly android?: RequestSubscriptionAndroidProps;\n}\n\n/**\n * Modern request purchase parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestPurchaseProps = RequestPurchasePropsByPlatforms;\n\n/**\n * Modern request subscription parameters (v2.7.0+)\n * This is the recommended API moving forward\n */\nexport type RequestSubscriptionProps = RequestSubscriptionPropsByPlatforms;\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Product,
|
|
1
|
+
import { Product, Purchase, PurchaseError, PurchaseResult, RequestSubscriptionProps, RequestPurchaseProps, SubscriptionProduct } from './ExpoIap.types';
|
|
2
2
|
export * from './ExpoIap.types';
|
|
3
3
|
export * from './modules/android';
|
|
4
4
|
export * from './modules/ios';
|
|
@@ -84,15 +84,15 @@ export declare const requestProducts: ({ skus, type, }: {
|
|
|
84
84
|
export declare const getPurchaseHistory: ({ alsoPublishToEventListener, onlyIncludeActiveItems, }?: {
|
|
85
85
|
alsoPublishToEventListener?: boolean;
|
|
86
86
|
onlyIncludeActiveItems?: boolean;
|
|
87
|
-
}) => Promise<
|
|
87
|
+
}) => Promise<Purchase[]>;
|
|
88
88
|
export declare const getPurchaseHistories: ({ alsoPublishToEventListener, onlyIncludeActiveItems, }?: {
|
|
89
89
|
alsoPublishToEventListener?: boolean;
|
|
90
90
|
onlyIncludeActiveItems?: boolean;
|
|
91
|
-
}) => Promise<
|
|
91
|
+
}) => Promise<Purchase[]>;
|
|
92
92
|
export declare const getAvailablePurchases: ({ alsoPublishToEventListener, onlyIncludeActiveItems, }?: {
|
|
93
93
|
alsoPublishToEventListener?: boolean;
|
|
94
94
|
onlyIncludeActiveItems?: boolean;
|
|
95
|
-
}) => Promise<
|
|
95
|
+
}) => Promise<Purchase[]>;
|
|
96
96
|
type PurchaseRequest = {
|
|
97
97
|
request: RequestPurchaseProps;
|
|
98
98
|
type?: 'inapp';
|
|
@@ -131,7 +131,7 @@ type PurchaseRequest = {
|
|
|
131
131
|
* });
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
|
-
export declare const requestPurchase: (requestObj: PurchaseRequest) => Promise<
|
|
134
|
+
export declare const requestPurchase: (requestObj: PurchaseRequest) => Promise<Purchase | Purchase[] | void>;
|
|
135
135
|
/**
|
|
136
136
|
* @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.
|
|
137
137
|
*
|
|
@@ -157,7 +157,7 @@ export declare const requestPurchase: (requestObj: PurchaseRequest) => Promise<P
|
|
|
157
157
|
* });
|
|
158
158
|
* ```
|
|
159
159
|
*/
|
|
160
|
-
export declare const requestSubscription: (request: RequestSubscriptionProps) => Promise<
|
|
160
|
+
export declare const requestSubscription: (request: RequestSubscriptionProps) => Promise<Purchase | Purchase[] | null | void>;
|
|
161
161
|
export declare const finishTransaction: ({ purchase, isConsumable, }: {
|
|
162
162
|
purchase: Purchase;
|
|
163
163
|
isConsumable?: boolean;
|
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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,OAAO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equest?.sku) {
|
|
269
269
|
throw new Error('Invalid request for iOS. The `sku` property is required and must be a string.');
|
|
270
270
|
}
|
|
271
|
-
const { sku,
|
|
271
|
+
const { sku, andDangerouslyFinishTransactionAutomatically = false, appAccountToken, quantity, withOffer, } = normalizedRequest;
|
|
272
272
|
return (async () => {
|
|
273
273
|
const offer = offerToRecordIOS(withOffer);
|
|
274
|
-
const purchase = await ExpoIapModule.buyProduct(sku,
|
|
275
|
-
return type === 'inapp'
|
|
276
|
-
? purchase
|
|
277
|
-
: purchase;
|
|
274
|
+
const purchase = await ExpoIapModule.buyProduct(sku, andDangerouslyFinishTransactionAutomatically, appAccountToken, quantity ?? -1, offer);
|
|
275
|
+
return type === 'inapp' ? purchase : purchase;
|
|
278
276
|
})();
|
|
279
277
|
}
|
|
280
278
|
if (Platform.OS === 'android') {
|