expo-iap 2.8.2 → 2.8.3-rc.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 +0 -10
- package/CLAUDE.md +11 -0
- package/CONTRIBUTING.md +3 -4
- package/build/helpers/subscription.d.ts.map +1 -1
- package/build/helpers/subscription.js +3 -6
- package/build/helpers/subscription.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- 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.map +1 -1
- package/build/useIAP.js.map +1 -1
- package/coverage/clover.xml +601 -0
- package/coverage/coverage-final.json +9 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +176 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov-report/src/ExpoIap.types.ts.html +1243 -0
- package/coverage/lcov-report/src/helpers/index.html +116 -0
- package/coverage/lcov-report/src/helpers/subscription.ts.html +430 -0
- package/coverage/lcov-report/src/index.html +146 -0
- package/coverage/lcov-report/src/index.ts.html +2227 -0
- package/coverage/lcov-report/src/modules/android.ts.html +469 -0
- package/coverage/lcov-report/src/modules/index.html +131 -0
- package/coverage/lcov-report/src/modules/ios.ts.html +1411 -0
- package/coverage/lcov-report/src/types/ExpoIapAndroid.types.ts.html +487 -0
- package/coverage/lcov-report/src/types/index.html +116 -0
- package/coverage/lcov-report/src/useIap.ts.html +1483 -0
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +349 -0
- package/coverage/lcov-report/src/utils/index.html +116 -0
- package/coverage/lcov.info +1115 -0
- package/ios/ExpoIap.podspec +6 -1
- package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/jest.config.js +14 -17
- package/package.json +1 -1
- package/plugin/build/withIAP.js +16 -3
- package/plugin/src/withIAP.ts +22 -3
- package/plugin/tsconfig.tsbuildinfo +1 -1
- package/src/helpers/subscription.ts +21 -28
- package/src/index.ts +10 -5
- package/src/modules/android.ts +7 -7
- package/src/modules/ios.ts +7 -2
- package/src/types/ExpoIapAndroid.types.ts +3 -4
- package/src/types/ExpoIapIOS.types.ts +4 -3
- package/src/useIAP.ts +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,21 @@
|
|
|
3
3
|
## [2.8.2] - 2025-08-26
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
|
-
|
|
7
6
|
- Added `platform` field to all IAP types for improved runtime type discrimination
|
|
8
7
|
- Consolidated `Purchase` types and deprecated legacy type aliases for consistency
|
|
9
8
|
|
|
10
9
|
### Changed
|
|
11
|
-
|
|
12
10
|
- Refactored and consolidated Purchase types to follow OpenIAP specification
|
|
13
11
|
- Improved type consistency across iOS and Android platforms
|
|
14
12
|
|
|
15
13
|
### Deprecated
|
|
16
|
-
|
|
17
14
|
**Note**: The following deprecated type aliases will be removed in v2.9.0:
|
|
18
|
-
|
|
19
15
|
- `ProductPurchase` (use `Purchase` instead)
|
|
20
16
|
- `SubscriptionPurchase` (use `Purchase` instead)
|
|
21
17
|
|
|
22
18
|
## [2.8.1] - 2025-08-19
|
|
23
19
|
|
|
24
20
|
### Added
|
|
25
|
-
|
|
26
21
|
- Added `debugDescription?: string` field to `ProductCommon` for debugging purposes
|
|
27
22
|
- Added `platform?: string` field to `ProductCommon` and `PurchaseCommon` for platform identification
|
|
28
23
|
- Added `platform: "ios"` to iOS-specific types (`ProductIOS`, `ProductSubscriptionIOS`, `PurchaseIOS`)
|
|
@@ -30,7 +25,6 @@
|
|
|
30
25
|
- Added `ids?: string[]` field to `PurchaseCommon` (moved from Android-specific types)
|
|
31
26
|
|
|
32
27
|
### Changed
|
|
33
|
-
|
|
34
28
|
- Moved common fields from platform-specific types to shared Common types
|
|
35
29
|
- Updated iOS native code to populate missing subscription fields:
|
|
36
30
|
- `introductoryPriceAsAmountIOS`
|
|
@@ -42,15 +36,12 @@
|
|
|
42
36
|
- Updated Android native code to use common `ids` field instead of platform-specific `idsAndroid`
|
|
43
37
|
|
|
44
38
|
### Fixed
|
|
45
|
-
|
|
46
39
|
- Fixed type mismatches between Product and Purchase types across iOS and Android platforms
|
|
47
40
|
- Resolved missing field mappings in iOS native subscription data extraction
|
|
48
41
|
- Improved type consistency for cross-platform compatibility
|
|
49
42
|
|
|
50
43
|
### Deprecated
|
|
51
|
-
|
|
52
44
|
**Note**: No breaking changes in this release. The following deprecated fields will be removed in v2.9.0:
|
|
53
|
-
|
|
54
45
|
- Android: `idsAndroid` (use common `ids` field instead)
|
|
55
46
|
- Android: `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails` (use fields with `Android` suffix)
|
|
56
47
|
- iOS: `displayName`, `isFamilyShareable`, `jsonRepresentation`, `subscription` (use fields with `IOS` suffix)
|
|
@@ -65,7 +56,6 @@
|
|
|
65
56
|
**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)
|
|
66
57
|
|
|
67
58
|
Affected fields:
|
|
68
|
-
|
|
69
59
|
- `quantityIos` → `quantityIOS`
|
|
70
60
|
- `expirationDateIos` → `expirationDateIOS`
|
|
71
61
|
- `environmentIos` → `environmentIOS`
|
package/CLAUDE.md
CHANGED
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
|
|
17
17
|
## Expo-Specific Guidelines
|
|
18
18
|
|
|
19
|
+
### iOS Pod Configuration
|
|
20
|
+
|
|
21
|
+
**CRITICAL WARNING**: Never modify the iOS platform version in `ios/ExpoIap.podspec`
|
|
22
|
+
|
|
23
|
+
- The iOS platform version MUST remain at `13.4` even though the code requires iOS 15.0+
|
|
24
|
+
- Changing to `15.0` causes expo prebuild to exclude the module in older Expo versions (known bug)
|
|
25
|
+
- See issue: [#168](https://github.com/hyochan/expo-iap/issues/168)
|
|
26
|
+
- This is kept at `13.4` for compatibility across all Expo versions
|
|
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
|
|
29
|
+
|
|
19
30
|
### Pre-Commit Checks
|
|
20
31
|
|
|
21
32
|
Before committing any changes:
|
package/CONTRIBUTING.md
CHANGED
|
@@ -47,7 +47,6 @@ 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
|
-
|
|
51
50
|
- `Debug iOS (Expo)` - Runs the example app on iOS simulator
|
|
52
51
|
- `Debug Android (Expo)` - Runs the example app on Android emulator
|
|
53
52
|
- `iOS + Metro` - Starts Metro bundler and iOS app together
|
|
@@ -183,7 +182,7 @@ bun start
|
|
|
183
182
|
# Run on iOS simulator
|
|
184
183
|
bun run ios
|
|
185
184
|
|
|
186
|
-
# Run on Android emulator
|
|
185
|
+
# Run on Android emulator
|
|
187
186
|
bun run android
|
|
188
187
|
|
|
189
188
|
# Run tests
|
|
@@ -287,12 +286,12 @@ bun run test:coverage
|
|
|
287
286
|
Example test structure:
|
|
288
287
|
|
|
289
288
|
```typescript
|
|
290
|
-
import {render, fireEvent} from '@testing-library/react-native';
|
|
289
|
+
import { render, fireEvent } from '@testing-library/react-native';
|
|
291
290
|
import MyComponent from '../MyComponent';
|
|
292
291
|
|
|
293
292
|
describe('MyComponent', () => {
|
|
294
293
|
it('should render correctly', () => {
|
|
295
|
-
const {getByText} = render(<MyComponent />);
|
|
294
|
+
const { getByText } = render(<MyComponent />);
|
|
296
295
|
expect(getByText('Expected Text')).toBeTruthy();
|
|
297
296
|
});
|
|
298
297
|
});
|
|
@@ -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,CAyF9B,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
|
-
'autoRenewingAndroid' in purchase ||
|
|
23
|
+
('autoRenewingAndroid' in purchase) ||
|
|
24
24
|
('environmentIOS' in purchase && purchase.environmentIOS === 'Sandbox');
|
|
25
25
|
if (!hasSubscriptionFields) {
|
|
26
26
|
return false;
|
|
@@ -35,11 +35,8 @@ 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
|
-
|
|
40
|
-
if (purchase.environmentIOS === 'Sandbox' &&
|
|
41
|
-
purchase.transactionDate &&
|
|
42
|
-
currentTime - purchase.transactionDate < dayInMs) {
|
|
38
|
+
if (!('expirationDateIOS' in purchase) || !purchase.expirationDateIOS) {
|
|
39
|
+
if (purchase.environmentIOS === 'Sandbox' && purchase.transactionDate && (currentTime - purchase.transactionDate) < dayInMs) {
|
|
43
40
|
return true;
|
|
44
41
|
}
|
|
45
42
|
}
|
|
@@ -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.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AAC;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 (!('expirationDateIOS' in purchase) || !purchase.expirationDateIOS) {\n if (purchase.environmentIOS === 'Sandbox' && purchase.transactionDate && (currentTime - purchase.transactionDate) < dayInMs) {\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};"]}
|
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,sBAAsB,EACtB,KAAK,kBAAkB,GACxB,MAAM,wBAAwB,CAAC;AAGhC,eAAO,MAAM,EAAE,KAAmB,CAAC;AAEnC,oBAAY,QAAQ;IAClB,eAAe,qBAAqB;IACpC,aAAa,mB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G;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,7 +272,9 @@ 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'
|
|
275
|
+
return type === 'inapp'
|
|
276
|
+
? purchase
|
|
277
|
+
: purchase;
|
|
276
278
|
})();
|
|
277
279
|
}
|
|
278
280
|
if (Platform.OS === 'android') {
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAA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AC3E,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionProps,\n RequestPurchaseProps,\n SubscriptionProduct,\n} from './ExpoIap.types';\nimport {PurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIOS.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIOS.types';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions = await ExpoIapModule.getAvailableItemsByType(\n 'subs',\n );\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIOS = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\ntype PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionProps;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchaseProps | RequestSubscriptionProps,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<Purchase | Purchase[] | void> => {\n const {request, type = 'inapp'} = requestObj;\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomatically = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIOS(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp' ? (purchase as Purchase) : (purchase as Purchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n purchaseToken,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid || purchaseToken,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionProps,\n): Promise<Purchase | Purchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | Purchase\n | Purchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as PurchaseAndroid;\n\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(androidPurchase.purchaseToken);\n }\n\n return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseToken);\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else if (Platform.OS === 'android') {\n if (\n !androidOptions ||\n !androidOptions.packageName ||\n !androidOptions.productToken ||\n !androidOptions.accessToken\n ) {\n throw new Error(\n 'Android validation requires packageName, productToken, and accessToken',\n );\n }\n return await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\n }\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n */\nexport const deepLinkToSubscriptions = (options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n}): Promise<void> => {\n if (Platform.OS === 'ios') {\n return deepLinkToSubscriptionsIOS();\n }\n\n if (Platform.OS === 'android') {\n if (!options.skuAndroid) {\n return Promise.reject(\n new Error(\n 'skuAndroid is required to locate subscription in Android Store',\n ),\n );\n }\n if (!options.packageNameAndroid) {\n return Promise.reject(\n new Error(\n 'packageNameAndroid is required to identify your app in Android Store',\n ),\n );\n }\n return deepLinkToSubscriptionsAndroid({\n sku: options.skuAndroid,\n packageName: options.packageNameAndroid,\n });\n }\n\n return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));\n};\n\nexport * from './useIAP';\nexport * from './utils/errorMapping';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAe3B,mBAAmB;AACnB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAG9B,8BAA8B;AAC9B,OAAO,EACL,sBAAsB,EACtB,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAEhC,gCAAgC;AAChC,MAAM,CAAC,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,CAAC;AAEnC,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,gDAAoC,CAAA;IACpC,4CAAgC,CAAA;IAChC,yFAAyF;IACzF,6DAAiD,CAAA;IACjD,uDAA2C,CAAA;AAC7C,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,M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AA0B,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,gEAAgE,CACjE,CACF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,KAAK,CACP,sEAAsE,CACvE,CACF,CAAC;QACJ,CAAC;QACD,OAAO,8BAA8B,CAAC;YACpC,GAAG,EAAE,OAAO,CAAC,UAAU;YACvB,WAAW,EAAE,OAAO,CAAC,kBAAkB;SACxC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC","sourcesContent":["// External dependencies\nimport {NativeModulesProxy} from 'expo-modules-core';\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from './ExpoIapModule';\nimport {\n isProductIOS,\n validateReceiptIOS,\n deepLinkToSubscriptionsIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n PurchaseError,\n PurchaseResult,\n RequestSubscriptionProps,\n RequestPurchaseProps,\n SubscriptionProduct,\n} from './ExpoIap.types';\nimport {PurchaseAndroid} from './types/ExpoIapAndroid.types';\nimport {PaymentDiscount} from './types/ExpoIapIOS.types';\n\n// Export all types\nexport * from './ExpoIap.types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport type {AppTransactionIOS} from './types/ExpoIapIOS.types';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum IapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n /** @deprecated Use PurchaseUpdated instead. This will be removed in a future version. */\n TransactionIapUpdated = 'iap-transaction-updated',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule || NativeModulesProxy.ExpoIap) as {\n addListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => {remove: () => void};\n removeListener: (\n eventName: string,\n listener: (...args: any[]) => void,\n ) => void;\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const emitterSubscription = emitter.addListener(\n IapEvent.PurchaseUpdated,\n listener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n return emitter.addListener(IapEvent.PurchaseError, listener);\n};\n\n/**\n * iOS-only listener for App Store promoted product events.\n * This fires when a user taps on a promoted product in the App Store.\n *\n * @param listener - Callback function that receives the promoted product details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = promotedProductListenerIOS((product) => {\n * console.log('Promoted product:', product);\n * // Handle the promoted product\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform iOS\n */\nexport const promotedProductListenerIOS = (\n listener: (product: Product) => void,\n) => {\n if (Platform.OS !== 'ios') {\n console.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(IapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport const getProducts = async (skus: string[]): Promise<Product[]> => {\n console.warn(\n \"`getProducts` is deprecated. Use `requestProducts({ skus, type: 'inapp' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as Product[];\n },\n android: async () => {\n const products = await ExpoIapModule.getItemsByType('inapp', skus);\n return products.filter((product: unknown) =>\n isProductAndroid<Product>(product),\n );\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport const getSubscriptions = async (\n skus: string[],\n): Promise<SubscriptionProduct[]> => {\n console.warn(\n \"`getSubscriptions` is deprecated. Use `requestProducts({ skus, type: 'subs' })` instead. This function will be removed in version 3.0.0.\",\n );\n if (!skus?.length) {\n return Promise.reject(new Error('\"skus\" is required'));\n }\n\n return Platform.select({\n ios: async () => {\n const rawItems = await ExpoIapModule.getItems(skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n android: async () => {\n const rawItems = await ExpoIapModule.getItemsByType('subs', skus);\n return rawItems.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n }) as SubscriptionProduct[];\n },\n default: () => Promise.reject(new Error('Unsupported Platform')),\n })();\n};\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Request products with unified API (v2.7.0+)\n *\n * @param params - Product request configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'inapp' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await requestProducts({\n * skus: ['product1', 'product2'],\n * type: 'inapp'\n * });\n *\n * // Subscriptions\n * const subscriptions = await requestProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const requestProducts = async ({\n skus,\n type = 'inapp',\n}: {\n skus: string[];\n type?: 'inapp' | 'subs';\n}): Promise<Product[] | SubscriptionProduct[]> => {\n if (!skus?.length) {\n throw new Error('No SKUs provided');\n }\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.getItems(skus);\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.getItemsByType(type, skus);\n const filteredItems = items.filter((item: unknown) => {\n if (!isProductAndroid(item)) return false;\n return (\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id)\n );\n });\n\n return type === 'inapp'\n ? (filteredItems as Product[])\n : (filteredItems as SubscriptionProduct[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\n/**\n * @deprecated Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.\n */\nexport const getPurchaseHistory = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> => {\n console.warn(\n '`getPurchaseHistory` is deprecated. Use `getPurchaseHistories` instead. This function will be removed in version 3.0.0.',\n );\n return getPurchaseHistories({\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n });\n};\n\nexport const getPurchaseHistories = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = false,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: async () => {\n return ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n );\n },\n android: async () => {\n // getPurchaseHistoryByType was removed in Google Play Billing Library v8\n // Android doesn't provide purchase history anymore, only active purchases\n console.warn(\n 'getPurchaseHistories is not supported on Android with Google Play Billing Library v8. Use getAvailablePurchases instead to get active purchases.',\n );\n return [];\n },\n }) || (() => Promise.resolve([]))\n )();\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListener = false,\n onlyIncludeActiveItems = true,\n}: {\n alsoPublishToEventListener?: boolean;\n onlyIncludeActiveItems?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListener,\n onlyIncludeActiveItems,\n ),\n android: async () => {\n const products = await ExpoIapModule.getAvailableItemsByType('inapp');\n const subscriptions =\n await ExpoIapModule.getAvailableItemsByType('subs');\n return products.concat(subscriptions);\n },\n }) || (() => Promise.resolve([]))\n )();\n\nconst offerToRecordIOS = (\n offer: PaymentDiscount | undefined,\n): Record<keyof PaymentDiscount, string> | undefined => {\n if (!offer) return undefined;\n return {\n identifier: offer.identifier,\n keyIdentifier: offer.keyIdentifier,\n nonce: offer.nonce,\n signature: offer.signature,\n timestamp: offer.timestamp.toString(),\n };\n};\n\n// Define discriminated union with explicit type parameter\ntype PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: 'inapp';\n }\n | {\n request: RequestSubscriptionProps;\n type: 'subs';\n };\n\n/**\n * Helper to normalize request props to platform-specific format\n */\nconst normalizeRequestProps = (\n request: RequestPurchaseProps | RequestSubscriptionProps,\n platform: 'ios' | 'android',\n): any => {\n // Platform-specific format - directly return the appropriate platform data\n return platform === 'ios' ? request.ios : request.android;\n};\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Platform-specific purchase parameters\n * @param requestObj.type - Type of purchase: 'inapp' for products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Product purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'inapp'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestPurchase = (\n requestObj: PurchaseRequest,\n): Promise<\n | Purchase\n | Purchase[]\n | void\n> => {\n const {request, type = 'inapp'} = requestObj;\n\n if (Platform.OS === 'ios') {\n const normalizedRequest = normalizeRequestProps(request, 'ios');\n\n if (!normalizedRequest?.sku) {\n throw new Error(\n 'Invalid request for iOS. The `sku` property is required and must be a string.',\n );\n }\n\n const {\n sku,\n andDangerouslyFinishTransactionAutomatically = false,\n appAccountToken,\n quantity,\n withOffer,\n } = normalizedRequest;\n\n return (async () => {\n const offer = offerToRecordIOS(withOffer);\n const purchase = await ExpoIapModule.buyProduct(\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity ?? -1,\n offer,\n );\n\n return type === 'inapp'\n ? (purchase as Purchase)\n : (purchase as Purchase);\n })();\n }\n\n if (Platform.OS === 'android') {\n const normalizedRequest = normalizeRequestProps(request, 'android');\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Android. The `skus` property is required and must be a non-empty array.',\n );\n }\n\n if (type === 'inapp') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'inapp',\n skuArr: skus,\n purchaseToken: undefined,\n replacementMode: -1,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: [],\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\n })();\n }\n\n if (type === 'subs') {\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers = [],\n replacementModeAndroid = -1,\n purchaseTokenAndroid,\n purchaseToken,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.buyItemByType({\n type: 'subs',\n skuArr: skus,\n purchaseToken: purchaseTokenAndroid || purchaseToken,\n replacementMode: replacementModeAndroid,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: subscriptionOffers.map((so: any) => so.offerToken),\n isOfferPersonalized: isOfferPersonalized ?? false,\n }) as Promise<Purchase[]>;\n })();\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n return Promise.resolve(); // Fallback for unsupported platforms\n};\n\n/**\n * @deprecated Use `requestPurchase({ request, type: 'subs' })` instead. This method will be removed in version 3.0.0.\n *\n * @example\n * ```typescript\n * // Old way (deprecated)\n * await requestSubscription({\n * sku: subscriptionId,\n * // or for Android\n * skus: [subscriptionId],\n * });\n *\n * // New way (recommended)\n * await requestPurchase({\n * request: {\n * ios: { sku: subscriptionId },\n * android: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n * ```\n */\nexport const requestSubscription = async (\n request: RequestSubscriptionProps,\n): Promise<Purchase | Purchase[] | null | void> => {\n console.warn(\n \"`requestSubscription` is deprecated and will be removed in version 3.0.0. Use `requestPurchase({ request, type: 'subs' })` instead.\",\n );\n return (await requestPurchase({request, type: 'subs'})) as\n | Purchase\n | Purchase[]\n | null\n | void;\n};\n\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<PurchaseResult | boolean> => {\n return (\n Platform.select({\n ios: async () => {\n const transactionId = purchase.id;\n if (!transactionId) {\n return Promise.reject(\n new Error('purchase.id required to finish iOS transaction'),\n );\n }\n await ExpoIapModule.finishTransaction(transactionId);\n return Promise.resolve(true);\n },\n android: async () => {\n const androidPurchase = purchase as PurchaseAndroid;\n\n if (isConsumable) {\n return ExpoIapModule.consumeProduct(androidPurchase.purchaseToken);\n }\n\n return ExpoIapModule.acknowledgePurchase(androidPurchase.purchaseToken);\n },\n }) || (() => Promise.reject(new Error('Unsupported Platform')))\n )();\n};\n\n/**\n * Retrieves the current storefront information from iOS App Store\n *\n * @returns Promise resolving to the storefront country code\n * @throws Error if called on non-iOS platform\n *\n * @example\n * ```typescript\n * const storefront = await getStorefrontIOS();\n * console.log(storefront); // 'US'\n * ```\n *\n * @platform iOS\n */\nexport const getStorefrontIOS = (): Promise<string> => {\n if (Platform.OS !== 'ios') {\n console.warn('getStorefrontIOS: This method is only available on iOS');\n return Promise.resolve('');\n }\n return ExpoIapModule.getStorefront();\n};\n\n/**\n * @deprecated Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getStorefront = (): Promise<string> => {\n console.warn(\n '`getStorefront` is deprecated. Use `getStorefrontIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getStorefrontIOS();\n};\n\n/**\n * Internal receipt validation function (NOT RECOMMENDED for production use)\n *\n * WARNING: This function performs client-side validation which is NOT secure.\n * For production apps, always validate receipts on your secure server:\n * - iOS: Send receipt data to Apple's verification endpoint from your server\n * - Android: Use Google Play Developer API with service account credentials\n */\nexport const validateReceipt = async (\n sku: string,\n androidOptions?: {\n packageName: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n },\n): Promise<any> => {\n if (Platform.OS === 'ios') {\n return await validateReceiptIOS(sku);\n } else if (Platform.OS === 'android') {\n if (\n !androidOptions ||\n !androidOptions.packageName ||\n !androidOptions.productToken ||\n !androidOptions.accessToken\n ) {\n throw new Error(\n 'Android validation requires packageName, productToken, and accessToken',\n );\n }\n return await validateReceiptAndroid({\n packageName: androidOptions.packageName,\n productId: sku,\n productToken: androidOptions.productToken,\n accessToken: androidOptions.accessToken,\n isSub: androidOptions.isSub,\n });\n } else {\n throw new Error('Platform not supported');\n }\n};\n\n/**\n * Deeplinks to native interface that allows users to manage their subscriptions\n * @param options.skuAndroid - Required for Android to locate specific subscription (ignored on iOS)\n * @param options.packageNameAndroid - Required for Android to identify your app (ignored on iOS)\n *\n * @returns Promise that resolves when the deep link is successfully opened\n *\n * @throws {Error} When called on unsupported platform or when required Android parameters are missing\n *\n * @example\n * import { deepLinkToSubscriptions } from 'expo-iap';\n *\n * // Works on both iOS and Android\n * await deepLinkToSubscriptions({\n * skuAndroid: 'your_subscription_sku',\n * packageNameAndroid: 'com.example.app'\n * });\n */\nexport const deepLinkToSubscriptions = (options: {\n skuAndroid?: string;\n packageNameAndroid?: string;\n}): Promise<void> => {\n if (Platform.OS === 'ios') {\n return deepLinkToSubscriptionsIOS();\n }\n\n if (Platform.OS === 'android') {\n if (!options.skuAndroid) {\n return Promise.reject(\n new Error(\n 'skuAndroid is required to locate subscription in Android Store',\n ),\n );\n }\n if (!options.packageNameAndroid) {\n return Promise.reject(\n new Error(\n 'packageNameAndroid is required to identify your app in Android Store',\n ),\n );\n }\n return deepLinkToSubscriptionsAndroid({\n sku: options.skuAndroid,\n packageName: options.packageNameAndroid,\n });\n }\n\n return Promise.reject(new Error(`Unsupported platform: ${Platform.OS}`));\n};\n\nexport * from './useIAP';\nexport * from './utils/errorMapping';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAG7D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS;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E1C,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,QAAa,OAAO,CAAC,IAAI,CAI/D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,mBAAmB;AACnB,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C,cAAc;AACd,MAAM,UAAU,gBAAgB,CAC9B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,IAAI,CAAC,QAAQ,KAAK,SAAS,CAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EAAE,EACnD,GAAG,EACH,WAAW,GAIZ,EAAiB,EAAE;IAClB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/modules/android.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAErC,mBAAmB;AACnB,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAM7C,cAAc;AACd,MAAM,UAAU,gBAAgB,CAC9B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,IAAI,CAAC,QAAQ,KAAK,SAAS,CAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EAAE,EACnD,GAAG,EACH,WAAW,GAIZ,EAAiB,EAAE;IAClB,IAAI,CAAC,WAAW,EAAE,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B,sCAAsC,CACvC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// External dependencies\nimport {Linking} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {PurchaseResult} from '../ExpoIap.types';\nimport {ReceiptAndroid} from '../types/ExpoIapAndroid.types';\n\n// Type guards\nexport function isProductAndroid<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'android'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n item.platform === 'android'\n );\n}\n\n/**\n * Deep link to subscriptions screen on Android.\n * @param {Object} params - The parameters object\n * @param {string} params.sku - The product's SKU (on Android)\n * @param {string} params.packageName - The package name of your Android app (e.g., 'com.example.app')\n * @returns {Promise<void>}\n * \n * @example\n * ```typescript\n * await deepLinkToSubscriptionsAndroid({\n * sku: 'subscription_id',\n * packageName: 'com.example.app'\n * });\n * ```\n */\nexport const deepLinkToSubscriptionsAndroid = async ({\n sku,\n packageName,\n}: {\n sku: string;\n packageName: string;\n}): Promise<void> => {\n if (!packageName) {\n throw new Error('packageName is required for deepLinkToSubscriptionsAndroid');\n }\n \n return Linking.openURL(\n `https://play.google.com/store/account/subscriptions?package=${packageName}&sku=${sku}`,\n );\n};\n\n/**\n * Validate receipt for Android. NOTE: This method is here for debugging purposes only. Including\n * your access token in the binary you ship to users is potentially dangerous.\n * Use server side validation instead for your production builds\n * @param {Object} params - The parameters object\n * @param {string} params.packageName - package name of your app.\n * @param {string} params.productId - product id for your in app product.\n * @param {string} params.productToken - token for your purchase (called 'token' in the API documentation).\n * @param {string} params.accessToken - OAuth access token with androidpublisher scope. Required for authentication.\n * @param {boolean} params.isSub - whether this is subscription or inapp. `true` for subscription.\n * @returns {Promise<ReceiptAndroid>}\n */\nexport const validateReceiptAndroid = async ({\n packageName,\n productId,\n productToken,\n accessToken,\n isSub,\n}: {\n packageName: string;\n productId: string;\n productToken: string;\n accessToken: string;\n isSub?: boolean;\n}): Promise<ReceiptAndroid> => {\n const type = isSub ? 'subscriptions' : 'products';\n\n const url =\n 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications' +\n `/${packageName}/purchases/${type}/${productId}` +\n `/tokens/${productToken}`;\n\n const response = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${accessToken}`,\n },\n });\n\n if (!response.ok) {\n throw Object.assign(new Error(response.statusText), {\n statusCode: response.status,\n });\n }\n\n return response.json();\n};\n\n/**\n * Acknowledge a product (on Android.) No-op on iOS.\n * @param {Object} params - The parameters object\n * @param {string} params.token - The product's token (on Android)\n * @returns {Promise<PurchaseResult | void>}\n */\nexport const acknowledgePurchaseAndroid = ({\n token,\n}: {\n token: string;\n}): Promise<PurchaseResult | boolean | void> => {\n return ExpoIapModule.acknowledgePurchase(token);\n};\n\n/**\n * Open the Google Play Store to redeem offer codes (Android only).\n * Note: Google Play does not provide a direct API to redeem codes within the app.\n * This function opens the Play Store where users can manually enter their codes.\n * \n * @returns {Promise<void>}\n */\nexport const openRedeemOfferCodeAndroid = async (): Promise<void> => {\n return Linking.openURL(\n `https://play.google.com/redeem?code=`\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAOA,OAAO,
|
|
1
|
+
{"version":3,"file":"ios.d.ts","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EACR,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAGF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,CAAC,K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AClE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,GAAW,EACmB,EAAE;IAChC,OAAO,CAAC,IAAI,CACV,0HAA0H,CAC3H,CAAC;IACF,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAkB,EAAE;IACzD,OAAO,CAAC,IAAI,CACV,oIAAoI,CACrI,CAAC;IACF,OAAO,0BAA0B,EAAE,CAAC;AACtC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAoB,EAAE;IACrE,OAAO,CAAC,IAAI,CACV,gIAAgI,CACjI,CAAC;IACF,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAqB,EAAE;IAC/D,OAAO,CAAC,IAAI,CACV,0IAA0I,CAC3I,CAAC;IACF,OAAO,6BAA6B,EAAE,CAAC;AACzC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAsC,EAAE;IACvE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// External dependencies\n\n// Internal modules\nimport {purchaseUpdatedListener} from '..';\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {Purchase, PurchaseError} from '../ExpoIap.types';\nimport type {\n ProductStatusIOS,\n AppTransactionIOS,\n} from '../types/ExpoIapIOS.types';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n/**\n * @deprecated Use `purchaseUpdatedListener` instead. This function will be removed in a future version.\n *\n * The `transactionUpdatedIos` function is redundant as it simply wraps `purchaseUpdatedListener`.\n * You can achieve the same functionality by using `purchaseUpdatedListener` directly.\n *\n * @example\n * // Instead of:\n * // transactionUpdatedIos((event) => { ... });\n *\n * // Use:\n * // purchaseUpdatedListener((purchase) => { ... });\n */\nexport const transactionUpdatedIOS = (\n listener: (event: TransactionEvent) => void,\n) => {\n const isPurchase = (item: unknown): item is Purchase => {\n return (\n item != null &&\n typeof item === 'object' &&\n 'id' in item &&\n 'transactionId' in item &&\n 'platform' in item\n );\n };\n\n // Helper function to safely convert Purchase to TransactionEvent\n const mapPurchaseToTransactionEvent = (\n purchase: Purchase,\n ): TransactionEvent => {\n // Validate the purchase object before casting\n if (isPurchase(purchase)) {\n return {\n transaction: purchase as Purchase,\n };\n }\n\n // Fallback: create a basic TransactionEvent structure\n return {\n transaction: purchase as Purchase,\n };\n };\n\n return purchaseUpdatedListener((purchase) => {\n // Convert Purchase to TransactionEvent format for backward compatibility\n const event = mapPurchaseToTransactionEvent(purchase);\n listener(event);\n });\n};\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n item.platform === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const syncIOS = (): Promise<null> => {\n return ExpoIapModule.sync();\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isEligibleForIntroOfferIOS = (\n groupId: string,\n): Promise<boolean> => {\n return ExpoIapModule.isEligibleForIntroOffer(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const subscriptionStatusIOS = (\n sku: string,\n): Promise<ProductStatusIOS[]> => {\n return ExpoIapModule.subscriptionStatus(sku);\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const currentEntitlementIOS = (sku: string): Promise<Purchase> => {\n return ExpoIapModule.currentEntitlement(sku);\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const latestTransactionIOS = (sku: string): Promise<Purchase> => {\n return ExpoIapModule.latestTransaction(sku);\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\ntype RefundRequestStatus = 'success' | 'userCancelled';\nexport const beginRefundRequestIOS = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n return ExpoIapModule.beginRefundRequest(sku);\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * When the user changes subscription renewal status, the system will emit events to\n * purchaseUpdatedListener and transactionUpdatedIOS listeners.\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const showManageSubscriptionsIOS = (): Promise<null> => {\n return ExpoIapModule.showManageSubscriptions();\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n */\nexport const getReceiptIOS = (): Promise<string> => {\n return ExpoIapModule.getReceiptData();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {\n return ExpoIapModule.isTransactionVerified(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getTransactionJwsIOS = (sku: string): Promise<string> => {\n return ExpoIapModule.getTransactionJws(sku);\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @param {string} sku The product's SKU (on iOS)\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n */\nexport const validateReceiptIOS = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: Purchase;\n}> => {\n const result = await ExpoIapModule.validateReceiptIOS(sku);\n return result;\n};\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n */\nexport const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {\n return ExpoIapModule.presentCodeRedemptionSheet();\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n */\nexport const getAppTransactionIOS = (): Promise<AppTransactionIOS | null> => {\n return ExpoIapModule.getAppTransaction();\n};\n\n/**\n * Get the promoted product details (iOS only).\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product details or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS = (): Promise<any | null> => {\n return ExpoIapModule.getPromotedProduct();\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n */\nexport const buyPromotedProductIOS = (): Promise<void> => {\n return ExpoIapModule.buyPromotedProduct();\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n// ============= DEPRECATED FUNCTIONS =============\n// These will be removed in version 3.0.0\n\n/**\n * @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const sync = (): Promise<null> => {\n console.warn(\n '`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',\n );\n return syncIOS();\n};\n\n/**\n * @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isEligibleForIntroOffer = (groupId: string): Promise<boolean> => {\n console.warn(\n '`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const subscriptionStatus = (\n sku: string,\n): Promise<ProductStatusIOS[]> => {\n console.warn(\n '`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',\n );\n return subscriptionStatusIOS(sku);\n};\n\n/**\n * @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const currentEntitlement = (sku: string): Promise<Purchase> => {\n console.warn(\n '`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',\n );\n return currentEntitlementIOS(sku);\n};\n\n/**\n * @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const latestTransaction = (sku: string): Promise<Purchase> => {\n console.warn(\n '`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return latestTransactionIOS(sku);\n};\n\n/**\n * @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const beginRefundRequest = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n console.warn(\n '`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',\n );\n return beginRefundRequestIOS(sku);\n};\n\n/**\n * @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const showManageSubscriptions = (): Promise<null> => {\n console.warn(\n '`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return showManageSubscriptionsIOS();\n};\n\n/**\n * @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isTransactionVerified = (sku: string): Promise<boolean> => {\n console.warn(\n '`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isTransactionVerifiedIOS(sku);\n};\n\n/**\n * @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getTransactionJws = (sku: string): Promise<string> => {\n console.warn(\n '`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getTransactionJwsIOS(sku);\n};\n\n/**\n * @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const presentCodeRedemptionSheet = (): Promise<boolean> => {\n console.warn(\n '`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',\n );\n return presentCodeRedemptionSheetIOS();\n};\n\n/**\n * @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getAppTransaction = (): Promise<AppTransactionIOS | null> => {\n console.warn(\n '`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getAppTransactionIOS();\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,OAAO,EAAC,uBAAuB,EAAC,MAAM,IAAI,CAAC;AAC3C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAW7C,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAC;AAOrC,YAAY;AACZ;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAA2C,EAC3C,EAAE;IACF,MAAM,UAAU,GAAG,CAAC,IAAa,EAAoB,EAAE;QACrD,OAAO,CACL,IAAI,IAAI,IAAI;YACZ,OAAO,IAAI,KAAK,QAAQ;YACxB,IAAI,IAAI,IAAI;YACZ,eAAe,IAAI,IAAI;YACvB,UAAU,IAAI,IAAI,CACnB,CAA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AAiB,GAAG,GAAsC,EAAE;IACvE,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;IACF,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["// External dependencies\n\n// Internal modules\nimport {purchaseUpdatedListener} from '..';\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport {\n Purchase,\n PurchaseError,\n} from '../ExpoIap.types';\nimport type {\n ProductStatusIOS,\n AppTransactionIOS,\n} from '../types/ExpoIapIOS.types';\nimport {Linking} from 'react-native';\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n/**\n * @deprecated Use `purchaseUpdatedListener` instead. This function will be removed in a future version.\n *\n * The `transactionUpdatedIos` function is redundant as it simply wraps `purchaseUpdatedListener`.\n * You can achieve the same functionality by using `purchaseUpdatedListener` directly.\n *\n * @example\n * // Instead of:\n * // transactionUpdatedIos((event) => { ... });\n *\n * // Use:\n * // purchaseUpdatedListener((purchase) => { ... });\n */\nexport const transactionUpdatedIOS = (\n listener: (event: TransactionEvent) => void,\n) => {\n const isPurchase = (item: unknown): item is Purchase => {\n return (\n item != null &&\n typeof item === 'object' &&\n 'id' in item &&\n 'transactionId' in item &&\n 'platform' in item\n );\n };\n\n // Helper function to safely convert Purchase to TransactionEvent\n const mapPurchaseToTransactionEvent = (\n purchase: Purchase,\n ): TransactionEvent => {\n // Validate the purchase object before casting\n if (isPurchase(purchase)) {\n return {\n transaction: purchase as Purchase,\n };\n }\n\n // Fallback: create a basic TransactionEvent structure\n return {\n transaction: purchase as Purchase,\n };\n };\n\n return purchaseUpdatedListener((purchase) => {\n // Convert Purchase to TransactionEvent format for backward compatibility\n const event = mapPurchaseToTransactionEvent(purchase);\n listener(event);\n });\n};\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n item.platform === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const syncIOS = (): Promise<null> => {\n return ExpoIapModule.sync();\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isEligibleForIntroOfferIOS = (\n groupId: string,\n): Promise<boolean> => {\n return ExpoIapModule.isEligibleForIntroOffer(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const subscriptionStatusIOS = (\n sku: string,\n): Promise<ProductStatusIOS[]> => {\n return ExpoIapModule.subscriptionStatus(sku);\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const currentEntitlementIOS = (\n sku: string,\n): Promise<Purchase> => {\n return ExpoIapModule.currentEntitlement(sku);\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const latestTransactionIOS = (sku: string): Promise<Purchase> => {\n return ExpoIapModule.latestTransaction(sku);\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\ntype RefundRequestStatus = 'success' | 'userCancelled';\nexport const beginRefundRequestIOS = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n return ExpoIapModule.beginRefundRequest(sku);\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * When the user changes subscription renewal status, the system will emit events to\n * purchaseUpdatedListener and transactionUpdatedIOS listeners.\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const showManageSubscriptionsIOS = (): Promise<null> => {\n return ExpoIapModule.showManageSubscriptions();\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n */\nexport const getReceiptIOS = (): Promise<string> => {\n return ExpoIapModule.getReceiptData();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const isTransactionVerifiedIOS = (sku: string): Promise<boolean> => {\n return ExpoIapModule.isTransactionVerified(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getTransactionJwsIOS = (sku: string): Promise<string> => {\n return ExpoIapModule.getTransactionJws(sku);\n};\n\n/**\n * Validate receipt for iOS using StoreKit 2's built-in verification.\n * Returns receipt data and verification information to help with server-side validation.\n *\n * NOTE: For proper security, Apple recommends verifying receipts on your server using\n * the verifyReceipt endpoint rather than relying solely on client-side verification.\n *\n * @param {string} sku The product's SKU (on iOS)\n * @returns {Promise<{\n * isValid: boolean;\n * receiptData: string;\n * jwsRepresentation: string;\n * latestTransaction?: Purchase;\n * }>}\n */\nexport const validateReceiptIOS = async (\n sku: string,\n): Promise<{\n isValid: boolean;\n receiptData: string;\n jwsRepresentation: string;\n latestTransaction?: Purchase;\n}> => {\n const result = await ExpoIapModule.validateReceiptIOS(sku);\n return result;\n};\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns Promise resolving to true if the sheet was presented successfully\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n */\nexport const presentCodeRedemptionSheetIOS = (): Promise<boolean> => {\n return ExpoIapModule.presentCodeRedemptionSheet();\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n */\nexport const getAppTransactionIOS = (): Promise<AppTransactionIOS | null> => {\n return ExpoIapModule.getAppTransaction();\n};\n\n/**\n * Get the promoted product details (iOS only).\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product details or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n */\nexport const getPromotedProductIOS = (): Promise<any | null> => {\n return ExpoIapModule.getPromotedProduct();\n};\n\n/**\n * Complete the purchase of a promoted product (iOS only).\n * This should be called after showing your purchase UI for a promoted product.\n *\n * @returns Promise resolving when the purchase is initiated\n * @throws Error if called on non-iOS platform or no promoted product is available\n *\n * @platform iOS\n */\nexport const buyPromotedProductIOS = (): Promise<void> => {\n return ExpoIapModule.buyPromotedProduct();\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n// ============= DEPRECATED FUNCTIONS =============\n// These will be removed in version 3.0.0\n\n/**\n * @deprecated Use `syncIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const sync = (): Promise<null> => {\n console.warn(\n '`sync` is deprecated. Use `syncIOS` instead. This function will be removed in version 3.0.0.',\n );\n return syncIOS();\n};\n\n/**\n * @deprecated Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isEligibleForIntroOffer = (groupId: string): Promise<boolean> => {\n console.warn(\n '`isEligibleForIntroOffer` is deprecated. Use `isEligibleForIntroOfferIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * @deprecated Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const subscriptionStatus = (\n sku: string,\n): Promise<ProductStatusIOS[]> => {\n console.warn(\n '`subscriptionStatus` is deprecated. Use `subscriptionStatusIOS` instead. This function will be removed in version 3.0.0.',\n );\n return subscriptionStatusIOS(sku);\n};\n\n/**\n * @deprecated Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const currentEntitlement = (sku: string): Promise<Purchase> => {\n console.warn(\n '`currentEntitlement` is deprecated. Use `currentEntitlementIOS` instead. This function will be removed in version 3.0.0.',\n );\n return currentEntitlementIOS(sku);\n};\n\n/**\n * @deprecated Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const latestTransaction = (sku: string): Promise<Purchase> => {\n console.warn(\n '`latestTransaction` is deprecated. Use `latestTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return latestTransactionIOS(sku);\n};\n\n/**\n * @deprecated Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const beginRefundRequest = (\n sku: string,\n): Promise<RefundRequestStatus> => {\n console.warn(\n '`beginRefundRequest` is deprecated. Use `beginRefundRequestIOS` instead. This function will be removed in version 3.0.0.',\n );\n return beginRefundRequestIOS(sku);\n};\n\n/**\n * @deprecated Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const showManageSubscriptions = (): Promise<null> => {\n console.warn(\n '`showManageSubscriptions` is deprecated. Use `showManageSubscriptionsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return showManageSubscriptionsIOS();\n};\n\n/**\n * @deprecated Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const isTransactionVerified = (sku: string): Promise<boolean> => {\n console.warn(\n '`isTransactionVerified` is deprecated. Use `isTransactionVerifiedIOS` instead. This function will be removed in version 3.0.0.',\n );\n return isTransactionVerifiedIOS(sku);\n};\n\n/**\n * @deprecated Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getTransactionJws = (sku: string): Promise<string> => {\n console.warn(\n '`getTransactionJws` is deprecated. Use `getTransactionJwsIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getTransactionJwsIOS(sku);\n};\n\n/**\n * @deprecated Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const presentCodeRedemptionSheet = (): Promise<boolean> => {\n console.warn(\n '`presentCodeRedemptionSheet` is deprecated. Use `presentCodeRedemptionSheetIOS` instead. This function will be removed in version 3.0.0.',\n );\n return presentCodeRedemptionSheetIOS();\n};\n\n/**\n * @deprecated Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.\n */\nexport const getAppTransaction = (): Promise<AppTransactionIOS | null> => {\n console.warn(\n '`getAppTransaction` is deprecated. Use `getAppTransactionIOS` instead. This function will be removed in version 3.0.0.',\n );\n return getAppTransactionIOS();\n};\n"]}
|
|
@@ -25,7 +25,7 @@ type ProductSubscriptionAndroidOfferDetail = {
|
|
|
25
25
|
export type ProductAndroid = ProductCommon & {
|
|
26
26
|
nameAndroid: string;
|
|
27
27
|
oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;
|
|
28
|
-
platform:
|
|
28
|
+
platform: "android";
|
|
29
29
|
subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[];
|
|
30
30
|
/**
|
|
31
31
|
* @deprecated Use `nameAndroid` instead. This field will be removed in v2.9.0.
|
|
@@ -123,7 +123,7 @@ export declare enum PurchaseAndroidState {
|
|
|
123
123
|
*/
|
|
124
124
|
export declare const PurchaseStateAndroid: typeof PurchaseAndroidState;
|
|
125
125
|
export type ProductPurchaseAndroid = PurchaseCommon & {
|
|
126
|
-
platform:
|
|
126
|
+
platform: "android";
|
|
127
127
|
/**
|
|
128
128
|
* @deprecated Use `purchaseToken` instead. This field will be removed in a future version.
|
|
129
129
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoIapAndroid.types.d.ts","sourceRoot":"","sources":["../../src/types/ExpoIapAndroid.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/D,KAAK,wCAAwC,GAAG;IAC9C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAE1B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,gBAAgB,EAAE,mBAAmB,EAAE,CAAC;CACzC,CAAC;AAEF,KAAK,qCAAqC,GAAG;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,oBAAoB,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,kCAAkC,CAAC,EAA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;AAC/C,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yFAAqB,CAAA;IACrB,yEAAa,CAAA;IACb,qEAAW,CAAA;AACb,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,2CAA2C;AAC3C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC","sourcesContent":["import {PurchaseCommon, ProductCommon} from '../ExpoIap.types';\n\ntype ProductAndroidOneTimePurchaseOfferDetail = {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n};\n\ntype PricingPhaseAndroid = {\n formattedPrice: string;\n priceCurrencyCode: string;\n // P1W, P1M, P1Y\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n};\n\ntype PricingPhasesAndroid = {\n pricingPhaseList: PricingPhaseAndroid[];\n};\n\ntype ProductSubscriptionAndroidOfferDetail = {\n basePlanId: string;\n offerId: string | null;\n offerToken: string;\n offerTags: string[];\n pricingPhases: PricingPhasesAndroid;\n};\n\nexport type ProductAndroid = ProductCommon & {\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;\n platform:
|
|
1
|
+
{"version":3,"file":"ExpoIapAndroid.types.js","sourceRoot":"","sources":["../../src/types/ExpoIapAndroid.types.ts"],"names":[],"mappings":"AA2EA,IAAK,uBAOJ;AAPD,WAAK,uBAAuB;IAC1B,6GAA4B,CAAA;IAC5B,mGAAuB,CAAA;IACvB,uGAAyB,CAAA;IACzB,+FAAqB,CAAA;IACrB,+FAAqB,CAAA;IACrB,6EAAY,CAAA;AACd,CAAC,EAPI,uBAAuB,KAAvB,uBAAuB,QAO3B;AAqCD,MAAM,CAAN,IAAY,kBAWX;AAXD,WAAY,kBAAkB;IAC5B,0EAA0E;IAC1E,2DAAqC,CAAA;IACrC,+CAA+C;IAC/C,6EAAuD,CAAA;IACvD,oFAAoF;IACpF,yDAAmC,CAAA;IACnC,wCAAwC;IACxC,qDAA+B,CAAA;IAC/B,oCAAoC;IACpC,mEAA6C,CAAA;AAC/C,CAAC,EAXW,kBAAkB,KAAlB,kBAAkB,QAW7B;AAED,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,yFAAqB,CAAA;IACrB,yEAAa,CAAA;IACb,qEAAW,CAAA;AACb,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,2CAA2C;AAC3C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC","sourcesContent":["import {PurchaseCommon, ProductCommon} from '../ExpoIap.types';\n\ntype ProductAndroidOneTimePurchaseOfferDetail = {\n priceCurrencyCode: string;\n formattedPrice: string;\n priceAmountMicros: string;\n};\n\ntype PricingPhaseAndroid = {\n formattedPrice: string;\n priceCurrencyCode: string;\n // P1W, P1M, P1Y\n billingPeriod: string;\n billingCycleCount: number;\n priceAmountMicros: string;\n recurrenceMode: number;\n};\n\ntype PricingPhasesAndroid = {\n pricingPhaseList: PricingPhaseAndroid[];\n};\n\ntype ProductSubscriptionAndroidOfferDetail = {\n basePlanId: string;\n offerId: string | null;\n offerToken: string;\n offerTags: string[];\n pricingPhases: PricingPhasesAndroid;\n};\n\nexport type ProductAndroid = ProductCommon & {\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail;\n platform: \"android\";\n subscriptionOfferDetailsAndroid?: ProductSubscriptionAndroidOfferDetail[];\n /**\n * @deprecated Use `nameAndroid` instead. This field will be removed in v2.9.0.\n */\n name?: string;\n /**\n * @deprecated Use `oneTimePurchaseOfferDetailsAndroid` instead. This field will be removed in v2.9.0.\n */\n oneTimePurchaseOfferDetails?: ProductAndroidOneTimePurchaseOfferDetail;\n /**\n * @deprecated Use `subscriptionOfferDetailsAndroid` instead. This field will be removed in v2.9.0.\n */\n subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetail[];\n};\n\ntype ProductSubscriptionAndroidOfferDetails = {\n basePlanId: string;\n offerId: string | null;\n offerToken: string;\n pricingPhases: PricingPhasesAndroid;\n offerTags: string[];\n};\n\nexport type ProductSubscriptionAndroid = ProductAndroid & {\n subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];\n /**\n * @deprecated Use `subscriptionOfferDetailsAndroid` instead. This field will be removed in v2.9.0.\n */\n subscriptionOfferDetails?: ProductSubscriptionAndroidOfferDetails[];\n};\n\n// Legacy naming for backward compatibility\nexport type SubscriptionProductAndroid = ProductSubscriptionAndroid;\n\nexport type RequestPurchaseAndroidProps = {\n skus: string[];\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n isOfferPersonalized?: boolean; // For AndroidBilling V5 https://developer.android.com/google/play/billing/integrate#personalized-price\n};\n\nenum ReplacementModesAndroid {\n UNKNOWN_REPLACEMENT_MODE = 0,\n WITH_TIME_PRORATION = 1,\n CHARGE_PRORATED_PRICE = 2,\n WITHOUT_PRORATION = 3,\n CHARGE_FULL_PRICE = 5,\n DEFERRED = 6,\n}\n\ntype SubscriptionOffer = {\n sku: string;\n offerToken: string;\n};\n\nexport type RequestSubscriptionAndroidProps = RequestPurchaseAndroidProps & {\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n replacementModeAndroid?: ReplacementModesAndroid;\n subscriptionOffers: SubscriptionOffer[];\n};\n\nexport type ReceiptAndroid = {\n autoRenewing: boolean;\n betaProduct: boolean;\n cancelDate: number | null;\n cancelReason: string;\n deferredDate: number | null;\n deferredSku: number | null;\n freeTrialEndDate: number;\n gracePeriodEndDate: number;\n parentProductId: string;\n productId: string;\n productType: string;\n purchaseDate: number;\n quantity: number;\n receiptId: string;\n renewalDate: number;\n term: string;\n termSku: string;\n testTransaction: boolean;\n};\n\nexport enum FeatureTypeAndroid {\n /** Show in-app messages. Included in documentation by the annotations: */\n IN_APP_MESSAGING = 'IN_APP_MESSAGING',\n /** Launch a price change confirmation flow. */\n PRICE_CHANGE_CONFIRMATION = 'PRICE_CHANGE_CONFIRMATION',\n /** Play billing library support for querying and purchasing with ProductDetails. */\n PRODUCT_DETAILS = 'PRODUCT_DETAILS',\n /** Purchase/query for subscriptions. */\n SUBSCRIPTIONS = 'SUBSCRIPTIONS',\n /** Subscriptions update/replace. */\n SUBSCRIPTIONS_UPDATE = 'SUBSCRIPTIONS_UPDATE',\n}\n\nexport enum PurchaseAndroidState {\n UNSPECIFIED_STATE = 0,\n PURCHASED = 1,\n PENDING = 2,\n}\n\n// Legacy naming for backward compatibility\n/**\n * @deprecated Use `PurchaseAndroidState` instead. This enum will be removed in v2.9.0.\n */\nexport const PurchaseStateAndroid = PurchaseAndroidState;\n\n// Legacy naming for backward compatibility\nexport type ProductPurchaseAndroid = PurchaseCommon & {\n platform: \"android\";\n /**\n * @deprecated Use `purchaseToken` instead. This field will be removed in a future version.\n */\n purchaseTokenAndroid?: string;\n dataAndroid?: string;\n signatureAndroid?: string;\n autoRenewingAndroid?: boolean;\n purchaseStateAndroid?: PurchaseAndroidState;\n isAcknowledgedAndroid?: boolean;\n packageNameAndroid?: string;\n developerPayloadAndroid?: string;\n obfuscatedAccountIdAndroid?: string;\n obfuscatedProfileIdAndroid?: string;\n};\n\n// Preferred naming\nexport type PurchaseAndroid = ProductPurchaseAndroid;\n\n// Legacy type aliases for backward compatibility\n/**\n * @deprecated Use `ProductAndroidOneTimePurchaseOfferDetail` instead. This type will be removed in v2.9.0.\n */\nexport type OneTimePurchaseOfferDetails = ProductAndroidOneTimePurchaseOfferDetail;\n\n/**\n * @deprecated Use `ProductSubscriptionAndroidOfferDetail` instead. This type will be removed in v2.9.0.\n */\nexport type SubscriptionOfferDetail = ProductSubscriptionAndroidOfferDetail;\n\n/**\n * @deprecated Use `ProductSubscriptionAndroidOfferDetails` instead. This type will be removed in v2.9.0.\n */\nexport type SubscriptionOfferAndroid = ProductSubscriptionAndroidOfferDetails;\n"]}
|