expo-iap 3.0.7-rc.1 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +1 -310
  2. package/build/index.d.ts.map +1 -1
  3. package/build/index.js +1 -4
  4. package/build/index.js.map +1 -1
  5. package/package.json +1 -1
  6. package/plugin/tsconfig.tsbuildinfo +1 -1
  7. package/src/index.ts +1 -6
  8. package/coverage/clover.xml +0 -440
  9. package/coverage/coverage-final.json +0 -7
  10. package/coverage/lcov-report/base.css +0 -224
  11. package/coverage/lcov-report/block-navigation.js +0 -87
  12. package/coverage/lcov-report/favicon.png +0 -0
  13. package/coverage/lcov-report/index.html +0 -161
  14. package/coverage/lcov-report/prettify.css +0 -1
  15. package/coverage/lcov-report/prettify.js +0 -2
  16. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  17. package/coverage/lcov-report/sorter.js +0 -196
  18. package/coverage/lcov-report/src/ExpoIap.types.ts.html +0 -1243
  19. package/coverage/lcov-report/src/PurchaseError.ts.html +0 -787
  20. package/coverage/lcov-report/src/helpers/index.html +0 -116
  21. package/coverage/lcov-report/src/helpers/subscription.ts.html +0 -496
  22. package/coverage/lcov-report/src/index.html +0 -131
  23. package/coverage/lcov-report/src/index.ts.html +0 -2236
  24. package/coverage/lcov-report/src/modules/android.ts.html +0 -544
  25. package/coverage/lcov-report/src/modules/index.html +0 -131
  26. package/coverage/lcov-report/src/modules/ios.ts.html +0 -952
  27. package/coverage/lcov-report/src/purchase-error.ts.html +0 -880
  28. package/coverage/lcov-report/src/types/ExpoIapAndroid.types.ts.html +0 -493
  29. package/coverage/lcov-report/src/types/index.html +0 -116
  30. package/coverage/lcov-report/src/useIap.ts.html +0 -1483
  31. package/coverage/lcov-report/src/utils/errorMapping.ts.html +0 -529
  32. package/coverage/lcov-report/src/utils/index.html +0 -116
  33. package/coverage/lcov.info +0 -852
  34. package/ios/expoiap.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  35. package/ios/expoiap.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
package/CHANGELOG.md CHANGED
@@ -1,312 +1,3 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 3.0.6 (Breaking: useIAP) - 2025-09-18
4
-
5
- - Hook: Remove the transient `currentPurchase` / `currentPurchaseError` state from `useIAP` so consumers rely exclusively on the `onPurchaseSuccess` and `onPurchaseError` callbacks for post-purchase handling. This is a light breaking tweak for hook callers, but keeps the root API untouched.
6
-
7
- ## 3.0.5 - 2025-09-17
8
-
9
- - Types: Normalize OpenIAP literal unions to `'in-app'`, `'ios'`, and `'android'`, update `useIAP` helpers to the new `PurchaseRequestInput`, and refresh docs/examples/tests to the lowercase schema tokens.
10
- - Tooling: Regenerate `src/types.ts` with `openiap-gql` 1.0.2, add lint/format ignores for the generated file, and document the type update workflow.
11
- - Native: Upgrade the Android fallback/config plugin to [openiap-google 1.1.10](https://github.com/hyodotdev/openiap-google/releases/tag/1.1.10), bump the iOS pod to [openiap 1.1.12](https://github.com/hyodotdev/openiap-apple/releases/tag/1.1.12), adopt PascalCase error codes, and wire the new request parameter models through the bridges and config plugin.
12
-
13
- ## 3.0.4 - 2025-09-16
14
-
15
- - Types: Regenerate the OpenIAP schema with the canonical PascalCase names (`ProductIOS`, `PurchaseIOS`, etc.) and align docs/tests/examples with the new exports.
16
- - Errors: Promote `PurchaseError` to extend `Error`, tighten typings for platform error input/output, and ensure Android acknowledgement resolves a `VoidResult {success}` object.
17
- - Docs: Refresh iOS setup examples to use platform-specific request shapes, fix legacy `ErrorCode` references in versioned guides, and trim example helpers to the updated API surface.
18
- - Build: Adopt [openiap-gql 1.0.0](https://github.com/hyodotdev/openiap-gql/releases/tag/1.0.0) for the transport layer to stay aligned with the GraphQL contract shipped across the ecosystem.
19
-
20
- ## 3.0.3 - 2025-09-14
21
-
22
- - Types: Align Expo IAP surface with [react-native-iap #3006](https://github.com/hyochan/react-native-iap/pull/3006) by renaming subscription aliases, adding StoreKit product enums, and exposing optional purchase metadata (quantity, purchaseState, isAutoRenewing).
23
- - Errors: Switch JS helpers and docs to camelCase `ErrorCode` members and tighten error inspection utilities to avoid `any` usage.
24
-
25
- ## 3.0.2 - 2025-09-13
26
-
27
- - iOS: Fix build error “cannot convert value of type '[[String : Any?]]'” in Expo bridge by returning non‑optional dictionaries and removing double‑serialization in `showManageSubscriptionsIOS` (Fixes #202).
28
- - Examples: Make `requestPurchase` fire‑and‑forget with guards for test/mock envs to avoid spurious errors.
29
- - Hook: Dedupe purchase success events across re‑mounts to avoid duplicate logs in dev.
30
-
31
- ## 3.0.1 - 2025-09-13
32
-
33
- - Android: Ensure `openiap-google:1.1.0` is added inside `dependencies {}` and replace/dedupe existing entries. In local dev, remove the Maven line and rely on `project(':openiap-google')`. Library fallback bumped to 1.1.0.
34
- - iOS: Honor `enableLocalDev: false` even when `localPath` is set. Ensure CocoaPods CDN in Podfile and remove any stale local `pod 'openiap', :path => ...` lines.
35
- - Misc: Drop legacy Billing/GMS cleanup patterns, simplify prebuild logs, and add a short release blog post.
36
-
37
- ## 3.0.0 - 2025-09-13
38
-
39
- Breaking changes:
40
-
41
- - Remove legacy APIs: `getProducts`, `getSubscriptions`, `requestProducts`, `requestSubscription`, `getPurchaseHistory`/`getPurchaseHistories`, and non‑suffixed iOS aliases
42
- - `showManageSubscriptionsIOS()` now returns `Promise<Purchase[]>` (was `boolean`)
43
- - `getAvailablePurchases()` options now only accept iOS keys: `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`
44
-
45
- Features:
46
-
47
- - Unify tokens via `purchaseToken` on `Purchase` (iOS JWS + Android token)
48
- - Add `getReceiptDataIOS` alias for iOS receipt parity
49
-
50
- Refactor:
51
-
52
- - Remove deprecated comments/tests/mocks; simplify subscription dedup to `id`
53
- - Clean up hook surface and examples to current API
54
-
55
- Fixes:
56
-
57
- - iOS parity and guards across native bridge and TS layer
58
-
59
- Docs:
60
-
61
- - Add v3 migration and update API pages to remove legacy helpers
62
-
63
- Tests:
64
-
65
- - Remove legacy specs; all root and example suites pass
66
-
67
- ## [2.9.7] - 2025-09-12
68
-
69
- ### Changed
70
-
71
- - Android: remove `ensureConnection` wrapper in favor of `BillingClient` auto-reconnect and a simpler `getBillingClientOrReject` precheck
72
- - Android: also verify `BillingClient.isReady` before proceeding to avoid sporadic failures
73
- - Android: drop deprecated product fields from mapping (`displayName`, `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails`) in favor of `...Android` suffixed fields
74
- - iOS: add `ensureConnection()` guard to all public async APIs; fix main-actor state updates and minor warnings
75
-
76
- ### Fixed
77
-
78
- - Android: fix stray brace that prematurely closed `ModuleDefinition` and ktlint trailing spaces
79
-
80
- ## [2.9.6] - 2025-09-11
81
-
82
- ### Fixed
83
-
84
- - Metro bundling error when importing the hook: fix "Unable to resolve '../../..' from node_modules/expo-iap/build/useIAP.js" by changing an ambiguous `import '.'` to an explicit `import './index'` inside `useIAP`. This prevents Metro from walking up to the app root and trying to resolve `expo-router/entry`.
85
-
86
- ### Notes
87
-
88
- - No runtime behavior changes; this is a bundling path fix only.
89
- - If you cannot upgrade immediately, temporary workaround: patch `node_modules/expo-iap/build/useIAP.js` to replace `from '.'` with `from './index'`, then clear cache (`npx expo start -c`).
90
-
91
- ## [2.9.5] - 2025-09-10
92
-
93
- ### Changed
94
-
95
- - iOS: Podspec pins `openiap` to `1.1.9` to prevent CocoaPods from resolving unintended versions and to stabilize builds.
96
-
97
- ### Deprecated
98
-
99
- - Deprecated `2.9.0`–`2.9.4` due to unpinned iOS dependency behavior in the wild. Please upgrade to `2.9.5`.
100
-
101
- ### Notes
102
-
103
- - If you encounter CocoaPods CDN issues, try `pod install --repo-update`. The config plugin already hardens Podfile sources, but network flakiness can still require a repo update.
104
-
105
- ## [2.9.3] - 2025-09-10
106
-
107
- ### Fixed
108
-
109
- - iOS: replace thrown `OpenIapError.*` and nonexistent types with `OpenIapFailure` cases to resolve build errors and align with error mapping
110
- - iOS: remove explicit `OpenIapErrorEvent` annotation in Swift listener (type is inferred from OpenIAP API)
111
-
112
- ### Notes
113
-
114
- - If your CocoaPods CDN is flaky, `pod install --repo-update` or temporarily pin `openiap` in your app Podfile.
115
-
116
- ## [2.9.1] - 2025-09-09
117
-
118
- ### Added
119
-
120
- - Expanded error codes and mappings (Android parity) with friendly messages in utilities
121
- - New object-style `PurchaseError` constructor and guideline in docs (legacy positional args remain supported)
122
- - Docs site can build for GitHub Pages via dynamic `baseUrl` switch
123
- - Example iOS: pin `openiap` to `1.1.7` via Git to avoid CocoaPods index lag
124
-
125
- ### Changed
126
-
127
- - iOS: `getPromotedProductIOS` now returns a fully serialized Product (fetch by SKU then serialize)
128
- - iOS: `subscriptionStatusIOS` returns `{ state, renewalInfo? }` where `renewalInfo.willAutoRenew` is a real boolean and `autoRenewPreference` is preserved
129
- - Hook: register purchase error listener early and ignore `E_INIT_CONNECTION` until connected
130
-
131
- ## [2.9.0] - 2025-09-05
132
-
133
- ### Added
134
-
135
- - iOS: Integrated OpenIAP Apple v1.1.6
136
- - Updated types to match OpenIAP v1.1.0 specification
137
- - Enhanced error handling with `PurchaseError` type and native error code mapping
138
- - New type system: `ProductRequest`, `RequestPurchaseProps`, `ReceiptValidationProps`
139
- - Improved receipt validation with `ReceiptValidationResult`
140
- - Root-level type re-exports to avoid deep imports (e.g., `ProductAndroid`, `ProductIOS`, `PaymentDiscount`)
141
-
142
- ### Changed
143
-
144
- - Updated serializers for purchases/products to follow OpenIAP structure
145
- - Updated listener setup to use new OpenIAP methods (`purchaseUpdatedListener`, `purchaseErrorListener`)
146
- - Added unified `removeAllListeners()` for cleanup
147
- - `showManageSubscriptionsIOS()` now returns updated subscriptions array (not boolean)
148
-
149
- ### Fixed
150
-
151
- - Fixed duplicate purchase success alerts
152
- - Fixed restore purchase alerts on screen entry
153
- - Improved purchase validation logic
154
-
155
- ### Note
156
-
157
- - Android native module integration with OpenIAP Android is planned for v3.0.0
158
-
159
- ## [2.8.8] - 2025-09-05
160
-
161
- ### Added
162
-
163
- - Enhanced `ActiveSubscription` interface with backend validation fields:
164
- - `transactionId` - Transaction identifier for backend validation
165
- - `purchaseToken` - JWT token (iOS) or purchase token (Android) for backend validation
166
- - `transactionDate` - Transaction timestamp
167
- - Return subscription changes from `showManageSubscriptionsIOS()` as Promise data
168
-
169
- ### Fixed
170
-
171
- - Fixed iOS `getAvailablePurchases({ onlyIncludeActiveItemsIOS: true })` returning expired subscriptions
172
- - Now correctly uses `Transaction.currentEntitlements` for better performance and accuracy
173
- - Fixed subscription status matching to specific SKU in `showManageSubscriptionsIOS()`
174
- - Prevents picking wrong status when multiple statuses exist in a subscription group
175
-
176
- ### Changed
177
-
178
- - Removed unnecessary event sending from `getAvailableItems()` - events are only sent from `requestPurchase()`
179
- - Removed polling logic from subscription status monitoring for cleaner code
180
- - Updated to comply with OpenIAP v1.1.1 specification
181
-
182
- ## [2.8.7] - 2025-09-03
183
-
184
- ### Added
185
-
186
- - `fetchProducts` function following OpenIAP terminology (replaces `requestProducts`)
187
-
188
- ### Deprecated
189
-
190
- - `requestProducts` - Use `fetchProducts` instead (will be removed in v3.0.0)
191
-
192
- ### Changed
193
-
194
- - Internal useIAP hook now uses `fetchProducts`
195
- - Updated documentation and deprecation messages
196
-
197
- ## [2.8.6]
198
-
199
- ### Changed
200
-
201
- - **BREAKING NAMING CONVENTION**: Added platform-specific suffixes to native functions for clarity
202
- - iOS functions now use `IOS` suffix (e.g., `getPromotedProductIOS`, `clearTransactionIOS`)
203
- - Android functions now use `Android` suffix (e.g., `acknowledgePurchaseAndroid`, `consumeProductAndroid`)
204
- - Common cross-platform functions remain without suffix (`requestProducts`, `requestPurchase`)
205
- - Renamed `buyPromotedProductIOS` to `requestPurchaseOnPromotedProductIOS` for consistency
206
-
207
- ### Added
208
-
209
- - Added `getPendingTransactionsIOS` function for iOS
210
- - Added `clearTransactionIOS` function for iOS
211
-
212
- ### Deprecated
213
-
214
- - `getPurchaseHistories` - Use `getAvailablePurchases` instead (will be removed in v2.9.0)
215
- - `buyPromotedProductIOS` - Use `requestPurchaseOnPromotedProductIOS` instead (will be removed in v2.9.0)
216
- - `disable` function - No longer needed, observer management is automatic (will be removed in v2.9.0)
217
-
218
- ## [2.8.5] - 2025-09-03
219
-
220
- ### Fixed
221
-
222
- - Fixed Android `finishTransaction` null error by adding fallback to `purchaseTokenAndroid` (#180)
223
-
224
- ## [2.8.4] - 2025-08-31
225
-
226
- ### Fixed
227
-
228
- - Fixed iOS 18.4 properties build failure on Xcode 16.3 and below by adding Swift 6.1 compiler guard
229
-
230
- ### Changed
231
-
232
- - Android: Enabled automatic service reconnection (Android Billing Client v8 feature) and simplified connection logic (#178)
233
-
234
- ## [2.8.3] - 2025-08-27
235
-
236
- ### Fixed
237
-
238
- - Fixed TypeScript type issues
239
- - Added critical warning about iOS platform version in podspec (#169)
240
-
241
- ## [2.8.2] - 2025-08-26
242
-
243
- ### Added
244
-
245
- - Added `platform` field to all IAP types for improved runtime type discrimination
246
- - Consolidated `Purchase` types and deprecated legacy type aliases for consistency
247
-
248
- ### Changed
249
-
250
- - Refactored and consolidated Purchase types to follow OpenIAP specification
251
- - Improved type consistency across iOS and Android platforms
252
-
253
- ### Deprecated
254
-
255
- **Note**: The following deprecated type aliases will be removed in v2.9.0:
256
-
257
- - `ProductPurchase` (use `Purchase` instead)
258
- - `SubscriptionPurchase` (use `Purchase` instead)
259
-
260
- ## [2.8.1] - 2025-08-19
261
-
262
- ### Added
263
-
264
- - Added `debugDescription?: string` field to `ProductCommon` for debugging purposes
265
- - Added `platform?: string` field to `ProductCommon` and `PurchaseCommon` for platform identification
266
- - Added `platform: "ios"` to iOS-specific types (`ProductIOS`, `ProductSubscriptionIOS`, `PurchaseIOS`)
267
- - Added `platform: "android"` to Android-specific types (`ProductAndroid`, `ProductSubscriptionAndroid`, `PurchaseAndroid`)
268
- - Added `ids?: string[]` field to `PurchaseCommon` (moved from Android-specific types)
269
-
270
- ### Changed
271
-
272
- - Moved common fields from platform-specific types to shared Common types
273
- - Updated iOS native code to populate missing subscription fields:
274
- - `introductoryPriceAsAmountIOS`
275
- - `introductoryPricePaymentModeIOS`
276
- - `introductoryPriceNumberOfPeriodsIOS`
277
- - `introductoryPriceSubscriptionPeriodIOS`
278
- - `subscriptionPeriodNumberIOS`
279
- - `subscriptionPeriodUnitIOS`
280
- - Updated Android native code to use common `ids` field instead of platform-specific `idsAndroid`
281
-
282
- ### Fixed
283
-
284
- - Fixed type mismatches between Product and Purchase types across iOS and Android platforms
285
- - Resolved missing field mappings in iOS native subscription data extraction
286
- - Improved type consistency for cross-platform compatibility
287
-
288
- ### Deprecated
289
-
290
- **Note**: No breaking changes in this release. The following deprecated fields will be removed in v2.9.0:
291
-
292
- - Android: `idsAndroid` (use common `ids` field instead)
293
- - Android: `name`, `oneTimePurchaseOfferDetails`, `subscriptionOfferDetails` (use fields with `Android` suffix)
294
- - iOS: `displayName`, `isFamilyShareable`, `jsonRepresentation`, `subscription` (use fields with `IOS` suffix)
295
- - iOS: `discounts`, `introductoryPrice` (use fields with `IOS` suffix)
296
-
297
- ## [2.8.0] - 2025-08-18
298
-
299
- ### Breaking Changes
300
-
301
- - **iOS Field Naming Convention**: All iOS-related field names ending with "Ios" have been renamed to end with "IOS" to follow the convention that acronyms at the end of field names should be uppercase.
302
-
303
- **Migration Guide**: See the full migration guide at [hyochan.github.io/expo-iap/blog/v2-8-0-migration-guide](https://hyochan.github.io/expo-iap/blog/v2-8-0-migration-guide)
304
-
305
- Affected fields:
306
-
307
- - `quantityIos` → `quantityIOS`
308
- - `expirationDateIos` → `expirationDateIOS`
309
- - `environmentIos` → `environmentIOS`
310
- - And all other iOS-suffixed fields
311
-
312
- For older versions, checkout [Release Notes](https://github.com/hyochan/expo-iap/releases)
3
+ [Check release notes](https://github.com/hyochan/expo-iap/releases)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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AAM,CAS9C,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,uBAAuB,CAwBjC,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,CAaf,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC"}
package/build/index.js CHANGED
@@ -300,10 +300,7 @@ export const requestPurchase = (requestObj) => {
300
300
  obfuscatedAccountId: obfuscatedAccountIdAndroid,
301
301
  obfuscatedProfileId: obfuscatedProfileIdAndroid,
302
302
  offerTokenArr: normalizedOffers.map((so) => so.offerToken),
303
- subscriptionOffers: normalizedOffers.map((so) => ({
304
- sku: so.sku,
305
- offerToken: so.offerToken,
306
- })),
303
+ subscriptionOffers: normalizedOffers,
307
304
  isOfferPersonalized: isOfferPersonalized ?? false,
308
305
  });
309
306
  })();
@@ -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,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,0BAA0B,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B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esProxy} 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 syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n ErrorCode,\n RequestPurchaseProps,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n ProductSubscription,\n PurchaseAndroid,\n DiscountOfferInputIOS,\n VoidResult,\n ReceiptValidationResult,\n AndroidSubscriptionOfferInput,\n} from './types';\nimport {PurchaseError} from './purchase-error';\n\n// Export all types\nexport * from './types';\nexport {ErrorCodeUtils, ErrorCodeMapping} from './purchase-error';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule ||\n NativeModulesProxy.ExpoIap) as ExpoIapEmitter;\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = 'inapp' | 'in-app' | 'subs';\nexport type InAppTypeInput = Exclude<ProductTypeInput, 'subs'>;\n\ntype PurchaseRequestInApp = {\n request: RequestPurchasePropsByPlatforms;\n type?: InAppTypeInput;\n};\n\ntype PurchaseRequestSubscription = {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n};\n\nexport type PurchaseRequestInput =\n | PurchaseRequestInApp\n | PurchaseRequestSubscription;\n\nexport type PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: InAppTypeInput;\n }\n | {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n };\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n console.warn(\n \"expo-iap: 'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as const,\n native: 'inapp' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as const,\n native: 'subs' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n console.log('[JS] Registering purchaseUpdatedListener');\n const wrappedListener = (event: Purchase) => {\n console.log('[JS] purchaseUpdatedListener fired:', event);\n listener(event);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n console.log('[JS] purchaseUpdatedListener registered successfully');\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n console.log('[JS] Registering purchaseErrorListener');\n const wrappedListener = (error: PurchaseError) => {\n console.log('[JS] purchaseErrorListener fired:', error);\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n console.log('[JS] purchaseErrorListener registered successfully');\n return emitterSubscription;\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(OpenIapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param params - Product fetch configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'in-app' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await fetchProducts({\n * skus: ['product1', 'product2'],\n * type: 'in-app'\n * });\n *\n * // Subscriptions\n * const subscriptions = await fetchProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const fetchProducts = async ({\n skus,\n type,\n}: {\n skus: string[];\n type?: ProductTypeInput;\n}): Promise<Product[] | ProductSubscription[]> => {\n if (!skus?.length) {\n throw new PurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(type);\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) {\n return false;\n }\n const isValid =\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id);\n return isValid;\n });\n\n return canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.fetchProducts(native, 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 canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListenerIOS = false,\n onlyIncludeActiveItemsIOS = true,\n}: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListenerIOS,\n onlyIncludeActiveItemsIOS,\n ),\n android: () => ExpoIapModule.getAvailableItems(),\n }) || (() => Promise.resolve([]))\n )();\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper returns the restored/available purchases so callers can update UI/state.\n *\n * @param options.alsoPublishToEventListenerIOS - iOS only: whether to also publish to the event listener\n * @param options.onlyIncludeActiveItemsIOS - iOS only: whether to only include active items\n * @returns Promise resolving to the list of available/restored purchases\n */\nexport const restorePurchases = async (\n options: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n } = {},\n): Promise<Purchase[]> => {\n if (Platform.OS === 'ios') {\n // Perform best-effort sync on iOS and ignore sync errors to avoid blocking restore flow\n await syncIOS().catch(() => undefined);\n }\n\n // Then, fetch available purchases for both platforms\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options.onlyIncludeActiveItemsIOS ?? true,\n });\n\n return purchases;\n};\n\nconst offerToRecordIOS = (\n offer: DiscountOfferInputIOS | undefined,\n): Record<keyof DiscountOfferInputIOS, 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/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\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: 'in-app' 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: 'in-app'\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: PurchaseRequestInput,\n): Promise<Purchase | Purchase[] | void> => {\n const {request, type} = requestObj;\n const {canonical, native} = normalizeProductType(type);\n const isInAppPurchase = canonical === 'in-app';\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 ?? undefined);\n const purchase = await ExpoIapModule.requestPurchase({\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity,\n withOffer: offer,\n });\n\n return purchase as Purchase;\n })();\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest: RequestPurchaseAndroidProps | null | undefined =\n normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n );\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 const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\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 (canonical === 'subs') {\n const normalizedRequest:\n | RequestSubscriptionAndroidProps\n | null\n | undefined = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n );\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 const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers,\n replacementModeAndroid,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeAndroid ?? -1;\n const purchaseToken = purchaseTokenAndroid ?? undefined;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (so: AndroidSubscriptionOfferInput) => so.offerToken,\n ),\n subscriptionOffers: normalizedOffers.map(\n (so: AndroidSubscriptionOfferInput) => ({\n sku: so.sku,\n offerToken: so.offerToken,\n }),\n ),\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\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<VoidResult | 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 // Use purchaseToken if available, fallback to purchaseTokenAndroid for backward compatibility\n const token = androidPurchase.purchaseToken;\n\n if (!token) {\n return Promise.reject(\n new PurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: androidPurchase.productId,\n platform: 'android',\n }),\n );\n }\n\n if (isConsumable) {\n return ExpoIapModule.consumePurchaseAndroid(token);\n }\n\n return ExpoIapModule.acknowledgePurchaseAndroid(token);\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.getStorefrontIOS();\n};\n\n/**\n * Gets the storefront country code from the underlying native store.\n * Returns a two-letter country code such as 'US', 'KR', or empty string on failure.\n *\n * @platform ios\n * @platform android\n */\nexport const getStorefront = (): Promise<string> => {\n // Cross-platform storefront\n if (Platform.OS === 'android') {\n if (typeof ExpoIapModule.getStorefrontAndroid === 'function') {\n return ExpoIapModule.getStorefrontAndroid();\n }\n return Promise.resolve('');\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<ReceiptValidationResult> => {\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 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,EAC1B,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,QAAQ;AACR,OAAO,EAGL,SAAS,GAcV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CA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IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,sBAAsB,CAAC;YAClC,WAAW,EAAE,cAAc,CAAC,WAAW;YACvC,SAAS,EAAE,GAAG;YACd,YAAY,EAAE,cAAc,CAAC,YAAY;YACzC,WAAW,EAAE,cAAc,CAAC,WAAW;YACvC,KAAK,EAAE,cAAc,CAAC,KAAK;SAC5B,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAGvC,EAAiB,EAAE;IAClB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,0BAA0B,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,8BAA8B,CAAC;YACpC,GAAG,EAAE,OAAO,EAAE,UAAU;YACxB,WAAW,EAAE,OAAO,EAAE,kBAAkB;SACzC,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 syncIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n validateReceiptAndroid,\n deepLinkToSubscriptionsAndroid,\n} from './modules/android';\n\n// Types\nimport {\n Product,\n Purchase,\n ErrorCode,\n RequestPurchaseProps,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n ProductSubscription,\n PurchaseAndroid,\n DiscountOfferInputIOS,\n VoidResult,\n ReceiptValidationResult,\n AndroidSubscriptionOfferInput,\n} from './types';\nimport {PurchaseError} from './purchase-error';\n\n// Export all types\nexport * from './types';\nexport {ErrorCodeUtils, ErrorCodeMapping} from './purchase-error';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Export subscription helpers\nexport {\n getActiveSubscriptions,\n hasActiveSubscriptions,\n} from './helpers/subscription';\n\n// Get the native constant value\nexport const PI = ExpoIapModule.PI;\n\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n}\n\nexport function setValueAsync(value: string) {\n return ExpoIapModule.setValueAsync(value);\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n};\n\ntype ExpoIapEventListener<E extends OpenIapEvent> = (\n payload: ExpoIapEventPayloads[E],\n) => void;\n\ntype ExpoIapEmitter = {\n addListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): {remove: () => void};\n removeListener<E extends OpenIapEvent>(\n eventName: E,\n listener: ExpoIapEventListener<E>,\n ): void;\n};\n\n// Ensure the emitter has proper EventEmitter interface\nexport const emitter = (ExpoIapModule ||\n NativeModulesProxy.ExpoIap) as ExpoIapEmitter;\n\n/**\n * TODO(v3.1.0): Remove legacy 'inapp' alias once downstream apps migrate to 'in-app'.\n */\nexport type ProductTypeInput = 'inapp' | 'in-app' | 'subs';\nexport type InAppTypeInput = Exclude<ProductTypeInput, 'subs'>;\n\ntype PurchaseRequestInApp = {\n request: RequestPurchasePropsByPlatforms;\n type?: InAppTypeInput;\n};\n\ntype PurchaseRequestSubscription = {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n};\n\nexport type PurchaseRequestInput =\n | PurchaseRequestInApp\n | PurchaseRequestSubscription;\n\nexport type PurchaseRequest =\n | {\n request: RequestPurchaseProps;\n type?: InAppTypeInput;\n }\n | {\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n };\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n console.warn(\n \"expo-iap: 'inapp' product type is deprecated and will be removed in v3.1.0. Use 'in-app' instead.\",\n );\n }\n\n if (!type || type === 'inapp' || type === 'in-app') {\n return {\n canonical: 'in-app' as const,\n native: 'inapp' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as const,\n native: 'subs' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n console.log('[JS] Registering purchaseUpdatedListener');\n const wrappedListener = (event: Purchase) => {\n console.log('[JS] purchaseUpdatedListener fired:', event);\n listener(event);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n console.log('[JS] purchaseUpdatedListener registered successfully');\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n console.log('[JS] Registering purchaseErrorListener');\n const wrappedListener = (error: PurchaseError) => {\n console.log('[JS] purchaseErrorListener fired:', error);\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\n console.log('[JS] purchaseErrorListener registered successfully');\n return emitterSubscription;\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(OpenIapEvent.PromotedProductIOS, listener);\n};\n\nexport function initConnection(): Promise<boolean> {\n const result = ExpoIapModule.initConnection();\n return Promise.resolve(result);\n}\n\nexport async function endConnection(): Promise<boolean> {\n return ExpoIapModule.endConnection();\n}\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param params - Product fetch configuration\n * @param params.skus - Array of product SKUs to fetch\n * @param params.type - Type of products: 'in-app' for regular products (default) or 'subs' for subscriptions\n *\n * @example\n * ```typescript\n * // Regular products\n * const products = await fetchProducts({\n * skus: ['product1', 'product2'],\n * type: 'in-app'\n * });\n *\n * // Subscriptions\n * const subscriptions = await fetchProducts({\n * skus: ['sub1', 'sub2'],\n * type: 'subs'\n * });\n * ```\n */\nexport const fetchProducts = async ({\n skus,\n type,\n}: {\n skus: string[];\n type?: ProductTypeInput;\n}): Promise<Product[] | ProductSubscription[]> => {\n if (!skus?.length) {\n throw new PurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(type);\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n\n const filteredItems = rawItems.filter((item: unknown) => {\n if (!isProductIOS(item)) {\n return false;\n }\n const isValid =\n typeof item === 'object' &&\n item !== null &&\n 'id' in item &&\n typeof item.id === 'string' &&\n skus.includes(item.id);\n return isValid;\n });\n\n return canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n if (Platform.OS === 'android') {\n const items = await ExpoIapModule.fetchProducts(native, 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 canonical === 'in-app'\n ? (filteredItems as Product[])\n : (filteredItems as ProductSubscription[]);\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases = ({\n alsoPublishToEventListenerIOS = false,\n onlyIncludeActiveItemsIOS = true,\n}: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n} = {}): Promise<Purchase[]> =>\n (\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n alsoPublishToEventListenerIOS,\n onlyIncludeActiveItemsIOS,\n ),\n android: () => ExpoIapModule.getAvailableItems(),\n }) || (() => Promise.resolve([]))\n )();\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync to refresh transactions and ignore sync errors,\n * then fetch available purchases to surface restored items to the app.\n * - Android: simply fetch available purchases (restoration happens via query).\n *\n * This helper returns the restored/available purchases so callers can update UI/state.\n *\n * @param options.alsoPublishToEventListenerIOS - iOS only: whether to also publish to the event listener\n * @param options.onlyIncludeActiveItemsIOS - iOS only: whether to only include active items\n * @returns Promise resolving to the list of available/restored purchases\n */\nexport const restorePurchases = async (\n options: {\n alsoPublishToEventListenerIOS?: boolean;\n onlyIncludeActiveItemsIOS?: boolean;\n } = {},\n): Promise<Purchase[]> => {\n if (Platform.OS === 'ios') {\n // Perform best-effort sync on iOS and ignore sync errors to avoid blocking restore flow\n await syncIOS().catch(() => undefined);\n }\n\n // Then, fetch available purchases for both platforms\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS:\n options.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options.onlyIncludeActiveItemsIOS ?? true,\n });\n\n return purchases;\n};\n\nconst offerToRecordIOS = (\n offer: DiscountOfferInputIOS | undefined,\n): Record<keyof DiscountOfferInputIOS, 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/**\n * Helper to normalize request props to platform-specific format\n */\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'ios',\n): RequestPurchaseIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestPurchasePropsByPlatforms,\n platform: 'android',\n): RequestPurchaseAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'ios',\n): RequestSubscriptionIosProps | null | undefined;\nfunction normalizeRequestProps(\n request: RequestSubscriptionPropsByPlatforms,\n platform: 'android',\n): RequestSubscriptionAndroidProps | null | undefined;\nfunction normalizeRequestProps(\n request:\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms,\n platform: 'ios' | 'android',\n) {\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: 'in-app' 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: 'in-app'\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: PurchaseRequestInput,\n): Promise<Purchase | Purchase[] | void> => {\n const {request, type} = requestObj;\n const {canonical, native} = normalizeProductType(type);\n const isInAppPurchase = canonical === 'in-app';\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 ?? undefined);\n const purchase = await ExpoIapModule.requestPurchase({\n sku,\n andDangerouslyFinishTransactionAutomatically,\n appAccountToken,\n quantity,\n withOffer: offer,\n });\n\n return purchase as Purchase;\n })();\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest: RequestPurchaseAndroidProps | null | undefined =\n normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n );\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 const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\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 (canonical === 'subs') {\n const normalizedRequest:\n | RequestSubscriptionAndroidProps\n | null\n | undefined = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n );\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 const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n subscriptionOffers,\n replacementModeAndroid,\n purchaseTokenAndroid,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const replacementMode = replacementModeAndroid ?? -1;\n const purchaseToken = purchaseTokenAndroid ?? undefined;\n\n return (async () => {\n return ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (so: AndroidSubscriptionOfferInput) => so.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\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\nexport const finishTransaction = ({\n purchase,\n isConsumable = false,\n}: {\n purchase: Purchase;\n isConsumable?: boolean;\n}): Promise<VoidResult | 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 // Use purchaseToken if available, fallback to purchaseTokenAndroid for backward compatibility\n const token = androidPurchase.purchaseToken;\n\n if (!token) {\n return Promise.reject(\n new PurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: androidPurchase.productId,\n platform: 'android',\n }),\n );\n }\n\n if (isConsumable) {\n return ExpoIapModule.consumePurchaseAndroid(token);\n }\n\n return ExpoIapModule.acknowledgePurchaseAndroid(token);\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.getStorefrontIOS();\n};\n\n/**\n * Gets the storefront country code from the underlying native store.\n * Returns a two-letter country code such as 'US', 'KR', or empty string on failure.\n *\n * @platform ios\n * @platform android\n */\nexport const getStorefront = (): Promise<string> => {\n // Cross-platform storefront\n if (Platform.OS === 'android') {\n if (typeof ExpoIapModule.getStorefrontAndroid === 'function') {\n return ExpoIapModule.getStorefrontAndroid();\n }\n return Promise.resolve('');\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<ReceiptValidationResult> => {\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 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "3.0.7-rc.1",
3
+ "version": "3.0.7",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1 +1 @@
1
- {"root":["./src/withiap.ts","./src/withlocalopeniap.ts"],"version":"5.9.2"}
1
+ {"root":["./src/withIAP.ts","./src/withLocalOpenIAP.ts"],"version":"5.9.2"}
package/src/index.ts CHANGED
@@ -530,12 +530,7 @@ export const requestPurchase = (
530
530
  offerTokenArr: normalizedOffers.map(
531
531
  (so: AndroidSubscriptionOfferInput) => so.offerToken,
532
532
  ),
533
- subscriptionOffers: normalizedOffers.map(
534
- (so: AndroidSubscriptionOfferInput) => ({
535
- sku: so.sku,
536
- offerToken: so.offerToken,
537
- }),
538
- ),
533
+ subscriptionOffers: normalizedOffers,
539
534
  isOfferPersonalized: isOfferPersonalized ?? false,
540
535
  }) as Promise<Purchase[]>;
541
536
  })();