expo-iap 3.3.0-rc.3 → 3.3.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md CHANGED
@@ -17,17 +17,23 @@
17
17
 
18
18
  ### iOS Pod Configuration
19
19
 
20
- **CRITICAL WARNING**: Never modify the platform versions in `ios/ExpoIap.podspec`
20
+ **CRITICAL WARNING**: Never modify the iOS platform version in `ios/ExpoIap.podspec`
21
21
 
22
- - Both iOS and tvOS platform versions MUST remain at `13.4` even though the code requires iOS/tvOS 15.0+
23
- - Changing to `15.0` can cause expo prebuild to exclude the module in certain Expo SDKs (known bug)
22
+ - iOS platform version MUST remain at `13.4` even though the code requires iOS 15.0+
23
+ - Changing iOS to `15.0` can cause expo prebuild to exclude the module in certain Expo SDKs (known bug)
24
24
  - See issue: [#168](https://github.com/hyochan/expo-iap/issues/168)
25
25
  - This is kept at `13.4` for compatibility with affected Expo SDKs
26
- - The actual iOS/tvOS 15.0+ requirement is enforced at build time via @available annotations
26
+ - The actual iOS 15.0+ requirement is enforced at build time via @available annotations
27
27
  - Users must ensure their app target is set to iOS 15.0 or higher:
28
28
  - app.json: `"expo": { "ios": { "deploymentTarget": "15.0" } }`
29
29
  - or app.config.ts: `ios: { deploymentTarget: '15.0' }`
30
30
 
31
+ **tvOS Exception**: tvOS platform version MUST be `16.0` (not `13.4`) because:
32
+
33
+ - The `openiap` CocoaPods dependency requires tvOS 16.0 minimum
34
+ - Setting tvOS to `13.4` causes build failure due to dependency mismatch
35
+ - This is a hard requirement from the dependency, not subject to the iOS workaround
36
+
31
37
  ### Pre-Commit Checks
32
38
 
33
39
  Before committing any changes:
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  <div align="center">
4
4
  <img src="https://hyochan.github.io/expo-iap/img/icon.png" alt="Expo IAP Logo" width="150" />
5
5
 
6
- [![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![CI](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml/badge.svg)](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/hyochan/expo-iap/graph/badge.svg?token=47VMTY5NyM)](https://codecov.io/gh/hyochan/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
6
+ [![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Version (next)](http://img.shields.io/npm/v/expo-iap/next.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![CI](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml/badge.svg)](https://github.com/hyochan/expo-iap/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/hyochan/expo-iap/graph/badge.svg?token=47VMTY5NyM)](https://codecov.io/gh/hyochan/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
7
7
 
8
8
  Expo IAP is a powerful in-app purchase solution for Expo and React Native applications that conforms to the Open IAP specification. It provides a unified API for handling in-app purchases across iOS and Android platforms with comprehensive error handling and modern TypeScript support.
9
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAIV,aAAa,EAGb,OAAO,EACP,gBAAgB,EAEhB,QAAQ,EAER,UAAU,EAOV,wBAAwB,EACzB,MAAM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AM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC"}
package/build/index.js CHANGED
@@ -552,6 +552,30 @@ export const verifyPurchase = async (options) => {
552
552
  */
553
553
  export const verifyPurchaseWithProvider = async (options) => {
554
554
  if (Platform.OS === 'ios' || Platform.OS === 'android') {
555
+ // Auto-fill apiKey from config if not provided and provider is iapkit
556
+ if (options.provider === 'iapkit' &&
557
+ options.iapkit &&
558
+ !options.iapkit.apiKey) {
559
+ try {
560
+ // Dynamically import expo-constants to avoid hard dependency
561
+ const { default: Constants } = await import('expo-constants');
562
+ const configApiKey = Constants.expoConfig?.extra?.iapkitApiKey;
563
+ if (configApiKey) {
564
+ options = {
565
+ ...options,
566
+ iapkit: {
567
+ ...options.iapkit,
568
+ apiKey: configApiKey,
569
+ },
570
+ };
571
+ }
572
+ }
573
+ catch {
574
+ throw new Error('expo-constants is required for auto-filling iapkitApiKey from config. ' +
575
+ 'Please install it: npx expo install expo-constants\n' +
576
+ 'Or provide apiKey directly in verifyPurchaseWithProvider options.');
577
+ }
578
+ }
555
579
  return ExpoIapModule.verifyPurchaseWithProvider(options);
556
580
  }
557
581
  throw new Error(`Unsupported platform: ${Platform.OS}`);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,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;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAwB7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E;IACF,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAEnC,KAAK,EAAE,OAAO,EAAE,EAAE;IACpB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QACvD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {requireNativeModule} 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';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\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 requireNativeModule('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 = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'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 ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\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 ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param request - Product fetch configuration\n * @param request.skus - Array of product SKUs to fetch\n * @param request.type - Product query type: 'in-app', 'subs', or 'all'\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () => ExpoIapModule.getAvailableItems() as Promise<Purchase[]>,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\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 // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Store-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 (recommended: use apple/google)\n * await requestPurchase({\n * request: {\n * apple: { sku: productId },\n * google: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * apple: { sku: subscriptionId },\n * google: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n *\n * // Legacy format (deprecated, but still supported)\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n * ```\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\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 Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n const result = (await 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 Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\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 const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\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 triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\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: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\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 *\n * @deprecated Use verifyPurchase instead\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {apple, google} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n if (!apple?.sku) {\n throw new Error('iOS validation requires apple.sku');\n }\n return validateReceiptIOS({apple: {sku: apple.sku}});\n }\n\n if (Platform.OS === 'android') {\n if (\n !google ||\n !google.sku ||\n !google.packageName ||\n !google.purchaseToken ||\n !google.accessToken\n ) {\n throw new Error(\n 'Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: google.packageName,\n productId: google.sku,\n productToken: google.purchaseToken,\n accessToken: google.accessToken,\n isSub: google.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,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;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAwB7C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,mBAAmB,EAAqB,MAAM,sBAAsB,CAAC;AAE7E,mBAAmB;AACnB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAE9B,gCAAgC;AAChC,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,oDAAoC,CAAA;IACpC,gDAAgC,CAAA;IAChC,2DAA2C,CAAA;IAC3C,wEAAwD,CAAA;AAC1D,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAwBD,uDAAuD;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,aAAa;IACnC,mBAAmB,CAAC,SAAS,CAAC,CAAmB,CAAC;AAOpD,MAA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,KAAK,QAAQ;YAC7B,OAAO,CAAC,MAAM;YACd,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EACtB,CAAC;YACD,IAAI,CAAC;gBACH,6DAA6D;gBAC7D,MAAM,EAAC,OAAO,EAAE,SAAS,EAAC,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBAC5D,MAAM,YAAY,GAAG,SAAS,CAAC,UAAU,EAAE,KAAK,EAAE,YAAY,CAAC;gBAC/D,IAAI,YAAY,EAAE,CAAC;oBACjB,OAAO,GAAG;wBACR,GAAG,OAAO;wBACV,MAAM,EAAE;4BACN,GAAG,OAAO,CAAC,MAAM;4BACjB,MAAM,EAAE,YAAY;yBACrB;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CACb,wEAAwE;oBACtE,sDAAsD;oBACtD,mEAAmE,CACtE,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,aAAa,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {requireNativeModule} 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';\nimport {ExpoIapConsole} from './utils/debug';\n\n// Types\nimport type {\n ActiveSubscription,\n AndroidSubscriptionOfferInput,\n DeepLinkOptions,\n MutationField,\n MutationRequestPurchaseArgs,\n MutationValidateReceiptArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {createPurchaseError, type PurchaseError} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\n\n// Get the native constant value\nexport enum OpenIapEvent {\n PurchaseUpdated = 'purchase-updated',\n PurchaseError = 'purchase-error',\n PromotedProductIOS = 'promoted-product-ios',\n UserChoiceBillingAndroid = 'user-choice-billing-android',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]: Product;\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\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 requireNativeModule('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 = ProductQueryType | 'inapp';\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (type === 'inapp') {\n ExpoIapConsole.warn(\n \"'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 ProductQueryType,\n native: 'in-app' as const,\n };\n }\n if (type === 'subs') {\n return {\n canonical: 'subs' as ProductQueryType,\n native: 'subs' as const,\n };\n }\n if (type === 'all') {\n return {\n canonical: 'all' as ProductQueryType,\n native: 'all' as const,\n };\n }\n throw new Error(`Unsupported product type: ${type}`);\n};\n\nconst normalizePurchasePlatform = (purchase: Purchase): Purchase => {\n const platform = purchase.platform;\n if (typeof platform !== 'string') {\n return purchase;\n }\n\n const lowered = platform.toLowerCase();\n if (lowered === platform || (lowered !== 'ios' && lowered !== 'android')) {\n return purchase;\n }\n\n return {...purchase, platform: lowered};\n};\n\nconst normalizePurchaseArray = (purchases: Purchase[]): Purchase[] =>\n purchases.map((purchase) => normalizePurchasePlatform(purchase));\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n const normalized = normalizePurchasePlatform(event);\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n return emitterSubscription;\n};\n\nexport const purchaseErrorListener = (\n listener: (error: PurchaseError) => void,\n) => {\n const wrappedListener = (error: PurchaseError) => {\n listener(error);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseError,\n wrappedListener,\n );\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 ExpoIapConsole.warn(\n 'promotedProductListenerIOS: This listener is only available on iOS',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.PromotedProductIOS, listener);\n};\n\n/**\n * Android-only listener for User Choice Billing events.\n * This fires when a user selects alternative billing instead of Google Play billing\n * in the User Choice Billing dialog (only in 'user-choice' mode).\n *\n * @param listener - Callback function that receives the external transaction token and product IDs\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = userChoiceBillingListenerAndroid((details) => {\n * console.log('User selected alternative billing');\n * console.log('Token:', details.externalTransactionToken);\n * console.log('Products:', details.products);\n *\n * // Process payment in your system, then report token to Google\n * await processPaymentAndReportToken(details);\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android\n */\nexport const userChoiceBillingListenerAndroid = (\n listener: (details: UserChoiceBillingDetails) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'userChoiceBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(OpenIapEvent.UserChoiceBillingAndroid, listener);\n};\n\nexport const initConnection: MutationField<'initConnection'> = async (config) =>\n ExpoIapModule.initConnection(config ?? null);\n\nexport const endConnection: MutationField<'endConnection'> = async () =>\n ExpoIapModule.endConnection();\n\n/**\n * Fetch products with unified API (v2.7.0+)\n *\n * @param request - Product fetch configuration\n * @param request.skus - Array of product SKUs to fetch\n * @param request.type - Product query type: 'in-app', 'subs', or 'all'\n */\nexport const fetchProducts: QueryField<'fetchProducts'> = async (request) => {\n ExpoIapConsole.debug('fetchProducts called with:', request);\n const {skus, type} = request ?? {};\n\n if (!Array.isArray(skus) || skus.length === 0) {\n throw createPurchaseError({\n message: 'No SKUs provided',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {canonical, native} = normalizeProductType(\n type as ProductTypeInput | undefined,\n );\n const skuSet = new Set(skus);\n\n const filterIosItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductIOS(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const filterAndroidItems = (\n items: unknown[],\n ): (Product | ProductSubscription)[] =>\n items.filter((item): item is Product | ProductSubscription => {\n if (!isProductAndroid(item)) {\n return false;\n }\n const candidate = item as Product | ProductSubscription;\n return typeof candidate.id === 'string' && skuSet.has(candidate.id);\n });\n\n const castResult = (\n items: (Product | ProductSubscription)[],\n ):\n | (Product | ProductSubscription)[]\n | Product[]\n | ProductSubscription[]\n | null => {\n if (canonical === 'in-app') {\n return items as Product[];\n }\n if (canonical === 'subs') {\n return items as ProductSubscription[];\n }\n // For 'all' type, items contain both Product and ProductSubscription\n // Return as ProductOrSubscription[] to preserve discriminated union\n return items;\n };\n\n if (Platform.OS === 'ios') {\n const rawItems = await ExpoIapModule.fetchProducts({skus, type: native});\n return castResult(filterIosItems(rawItems));\n }\n\n if (Platform.OS === 'android') {\n const rawItems = await ExpoIapModule.fetchProducts(native, skus);\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw new Error('Unsupported platform');\n};\n\nexport const getAvailablePurchases: QueryField<\n 'getAvailablePurchases'\n> = async (options) => {\n const normalizedOptions: PurchaseOptions = {\n alsoPublishToEventListenerIOS:\n options?.alsoPublishToEventListenerIOS ?? false,\n onlyIncludeActiveItemsIOS: options?.onlyIncludeActiveItemsIOS ?? true,\n };\n\n const resolvePurchases: () => Promise<Purchase[]> =\n Platform.select({\n ios: () =>\n ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n ) as Promise<Purchase[]>,\n android: () => ExpoIapModule.getAvailableItems() as Promise<Purchase[]>,\n }) ?? (() => Promise.resolve([] as Purchase[]));\n\n const purchases = await resolvePurchases();\n return normalizePurchaseArray(purchases as Purchase[]);\n};\n\n/**\n * Get all active subscriptions with detailed information.\n * Uses native OpenIAP module for accurate subscription status and renewal info.\n *\n * On iOS: Returns subscriptions with renewalInfoIOS containing pendingUpgradeProductId,\n * willAutoRenew, autoRenewPreference, and other renewal details.\n *\n * On Android: Filters available purchases to find active subscriptions (fallback implementation).\n *\n * @param subscriptionIds - Optional array of subscription product IDs to filter. If not provided, returns all active subscriptions.\n * @returns Promise resolving to array of active subscriptions with details\n *\n * @example\n * ```typescript\n * // Get all active subscriptions\n * const subs = await getActiveSubscriptions();\n *\n * // Get specific subscriptions\n * const premiumSubs = await getActiveSubscriptions(['premium', 'premium_year']);\n *\n * // Check for pending upgrades (iOS)\n * subs.forEach(sub => {\n * if (sub.renewalInfoIOS?.pendingUpgradeProductId) {\n * console.log(`Upgrade pending to: ${sub.renewalInfoIOS.pendingUpgradeProductId}`);\n * }\n * });\n * ```\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n const result = await ExpoIapModule.getActiveSubscriptions(\n subscriptionIds ?? null,\n );\n return (result ?? []) as ActiveSubscription[];\n};\n\n/**\n * Check if user has any active subscriptions.\n *\n * @param subscriptionIds - Optional array of subscription product IDs to check. If not provided, checks all subscriptions.\n * @returns Promise resolving to true if user has at least one active subscription\n *\n * @example\n * ```typescript\n * // Check any active subscription\n * const hasAny = await hasActiveSubscriptions();\n *\n * // Check specific subscriptions\n * const hasPremium = await hasActiveSubscriptions(['premium', 'premium_year']);\n * ```\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && Platform.OS !== 'android') {\n return '';\n }\n return ExpoIapModule.getStorefront();\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 // Support both new (apple/google) and legacy (ios/android) field names\n // New fields take precedence over deprecated ones\n if (platform === 'ios') {\n return request.apple ?? request.ios;\n }\n return request.google ?? request.android;\n}\n\n/**\n * Request a purchase for products or subscriptions.\n *\n * @param requestObj - Purchase request configuration\n * @param requestObj.request - Store-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 (recommended: use apple/google)\n * await requestPurchase({\n * request: {\n * apple: { sku: productId },\n * google: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n *\n * // Subscription purchase\n * await requestPurchase({\n * request: {\n * apple: { sku: subscriptionId },\n * google: {\n * skus: [subscriptionId],\n * subscriptionOffers: [{ sku: subscriptionId, offerToken: 'token' }]\n * }\n * },\n * type: 'subs'\n * });\n *\n * // Legacy format (deprecated, but still supported)\n * await requestPurchase({\n * request: {\n * ios: { sku: productId },\n * android: { skus: [productId] }\n * },\n * type: 'in-app'\n * });\n * ```\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\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 Apple. The `sku` property is required and must be a string.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n if (canonical !== 'in-app' && canonical !== 'subs') {\n throw new Error(`Unsupported product type: ${canonical}`);\n }\n\n const payload: MutationRequestPurchaseArgs = {\n type: canonical === 'in-app' ? 'in-app' : 'subs',\n request: {ios: normalizedRequest},\n useAlternativeBilling: args.useAlternativeBilling,\n };\n\n const purchase = (await ExpoIapModule.requestPurchase(payload)) as\n | Purchase\n | Purchase[]\n | null;\n\n if (Array.isArray(purchase)) {\n return normalizePurchaseArray(purchase);\n }\n\n if (purchase) {\n return normalizePurchasePlatform(purchase);\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (Platform.OS === 'android') {\n if (isInAppPurchase) {\n const normalizedRequest = normalizeRequestProps(\n request as RequestPurchasePropsByPlatforms,\n 'android',\n ) as RequestPurchaseAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"product_id\" },\\n' +\n ' google: { skus: [\"product_id\"] }\\n' +\n ' },\\n' +\n ' type: \"in-app\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\n );\n }\n\n const {\n skus,\n obfuscatedAccountIdAndroid,\n obfuscatedProfileIdAndroid,\n isOfferPersonalized,\n } = normalizedRequest;\n\n const result = (await 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 Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n if (canonical === 'subs') {\n const normalizedRequest = normalizeRequestProps(\n request as RequestSubscriptionPropsByPlatforms,\n 'android',\n ) as RequestSubscriptionAndroidProps | null | undefined;\n\n if (!normalizedRequest?.skus?.length) {\n throw new Error(\n 'Invalid request for Google. The `skus` property is required and must be a non-empty array.\\n\\n' +\n 'Expected format:\\n' +\n ' requestPurchase({\\n' +\n ' request: {\\n' +\n ' apple: { sku: \"subscription_id\" },\\n' +\n ' google: { skus: [\"subscription_id\"] }\\n' +\n ' },\\n' +\n ' type: \"subs\"\\n' +\n ' })\\n\\n' +\n 'See: https://hyochan.github.io/expo-iap/docs/api/methods/core-methods#requestpurchase',\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 const result = (await ExpoIapModule.requestPurchase({\n type: native,\n skuArr: skus,\n purchaseToken,\n replacementMode,\n obfuscatedAccountId: obfuscatedAccountIdAndroid,\n obfuscatedProfileId: obfuscatedProfileIdAndroid,\n offerTokenArr: normalizedOffers.map(\n (offer: AndroidSubscriptionOfferInput) => offer.offerToken,\n ),\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n })) as Purchase[];\n\n return normalizePurchaseArray(result);\n }\n\n throw new Error(\n \"Invalid request for Android: Expected a valid request object with 'skus' array.\",\n );\n }\n\n throw new Error('Platform not supported');\n};\n\nexport const finishTransaction: MutationField<'finishTransaction'> = async ({\n purchase,\n isConsumable = false,\n}) => {\n if (Platform.OS === 'ios') {\n await ExpoIapModule.finishTransaction(purchase, isConsumable);\n return;\n }\n\n if (Platform.OS === 'android') {\n const token = purchase.purchaseToken ?? undefined;\n\n if (!token) {\n throw createPurchaseError({\n message: 'Purchase token is required to finish transaction',\n code: ErrorCode.DeveloperError,\n productId: purchase.productId,\n platform: 'android',\n });\n }\n\n if (isConsumable) {\n await ExpoIapModule.consumePurchaseAndroid(token);\n return;\n }\n\n await ExpoIapModule.acknowledgePurchaseAndroid(token);\n return;\n }\n\n throw new Error('Unsupported Platform');\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 triggers the refresh flows but does not return the purchases; consumers should\n * call `getAvailablePurchases` or rely on hook state to inspect the latest items.\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined);\n }\n\n await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\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: MutationField<\n 'deepLinkToSubscriptions'\n> = async (options) => {\n if (Platform.OS === 'ios') {\n await deepLinkToSubscriptionsIOS();\n return;\n }\n\n if (Platform.OS === 'android') {\n await deepLinkToSubscriptionsAndroid((options as DeepLinkOptions) ?? null);\n return;\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\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 *\n * @deprecated Use verifyPurchase instead\n */\nexport const validateReceipt: MutationField<'validateReceipt'> = async (\n options,\n) => {\n const {apple, google} = options as MutationValidateReceiptArgs;\n\n if (Platform.OS === 'ios') {\n if (!apple?.sku) {\n throw new Error('iOS validation requires apple.sku');\n }\n return validateReceiptIOS({apple: {sku: apple.sku}});\n }\n\n if (Platform.OS === 'android') {\n if (\n !google ||\n !google.sku ||\n !google.packageName ||\n !google.purchaseToken ||\n !google.accessToken\n ) {\n throw new Error(\n 'Android validation requires google.sku, google.packageName, google.purchaseToken, and google.accessToken',\n );\n }\n return validateReceiptAndroid({\n packageName: google.packageName,\n productId: google.sku,\n productToken: google.purchaseToken,\n accessToken: google.accessToken,\n isSub: google.isSub ?? undefined,\n });\n }\n\n throw new Error('Platform not supported');\n};\n\n/**\n * Verify purchase with the configured providers\n *\n * This function uses the native OpenIAP verifyPurchase implementation\n * which validates purchases using platform-specific methods.\n *\n * @param options - Receipt validation options containing the SKU\n * @returns Promise resolving to receipt validation result\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n return ExpoIapModule.verifyPurchase(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\n/**\n * Verify purchase with a specific provider (e.g., IAPKit)\n *\n * This function allows you to verify purchases using external verification\n * services like IAPKit, which provide additional validation and security.\n *\n * @param options - Verification options including provider and credentials\n * @returns Promise resolving to provider-specific verification result\n *\n * @example\n * ```typescript\n * const result = await verifyPurchaseWithProvider({\n * provider: 'iapkit',\n * iapkit: {\n * apiKey: 'your-api-key',\n * apple: {\n * jws: purchase.purchaseToken // JWS from purchase\n * },\n * google: {\n * purchaseToken: purchase.purchaseToken\n * }\n * }\n * });\n * ```\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (Platform.OS === 'ios' || Platform.OS === 'android') {\n // Auto-fill apiKey from config if not provided and provider is iapkit\n if (\n options.provider === 'iapkit' &&\n options.iapkit &&\n !options.iapkit.apiKey\n ) {\n try {\n // Dynamically import expo-constants to avoid hard dependency\n const {default: Constants} = await import('expo-constants');\n const configApiKey = Constants.expoConfig?.extra?.iapkitApiKey;\n if (configApiKey) {\n options = {\n ...options,\n iapkit: {\n ...options.iapkit,\n apiKey: configApiKey,\n },\n };\n }\n } catch {\n throw new Error(\n 'expo-constants is required for auto-filling iapkitApiKey from config. ' +\n 'Please install it: npx expo install expo-constants\\n' +\n 'Or provide apiKey directly in verifyPurchaseWithProvider options.',\n );\n }\n }\n return ExpoIapModule.verifyPurchaseWithProvider(options);\n }\n\n throw new Error(`Unsupported platform: ${Platform.OS}`);\n};\n\nexport * from './useIAP';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1765640733669" clover="3.2.0">
3
- <project timestamp="1765640733669" name="All files">
4
- <metrics statements="476" coveredstatements="448" conditionals="262" coveredconditionals="228" methods="100" coveredmethods="80" elements="838" coveredelements="756" complexity="0" loc="476" ncloc="476" packages="3" files="5" classes="5"/>
2
+ <coverage generated="1765662283492" clover="3.2.0">
3
+ <project timestamp="1765662283492" name="All files">
4
+ <metrics statements="483" coveredstatements="449" conditionals="267" coveredconditionals="231" methods="101" coveredmethods="80" elements="851" coveredelements="760" complexity="0" loc="483" ncloc="483" packages="3" files="5" classes="5"/>
5
5
  <package name="src">
6
- <metrics statements="209" coveredstatements="203" conditionals="110" coveredconditionals="100" methods="43" coveredmethods="34"/>
6
+ <metrics statements="216" coveredstatements="204" conditionals="115" coveredconditionals="103" methods="44" coveredmethods="34"/>
7
7
  <file name="index.ts" path="/Users/crossplatformkorea/Github/hyochan/expo-iap/src/index.ts">
8
- <metrics statements="209" coveredstatements="203" conditionals="110" coveredconditionals="100" methods="43" coveredmethods="34"/>
8
+ <metrics statements="216" coveredstatements="204" conditionals="115" coveredconditionals="103" methods="44" coveredmethods="34"/>
9
9
  <line num="2" count="2" type="stmt"/>
10
10
  <line num="3" count="2" type="stmt"/>
11
11
  <line num="6" count="2" type="stmt"/>
@@ -206,15 +206,22 @@
206
206
  <line num="807" count="2" type="stmt"/>
207
207
  <line num="809" count="2" type="stmt"/>
208
208
  <line num="810" count="13" type="cond" truecount="3" falsecount="0"/>
209
- <line num="811" count="12" type="stmt"/>
210
- <line num="814" count="1" type="stmt"/>
211
- <line num="817" count="2" type="stmt"/>
212
- <line num="818" count="2" type="stmt"/>
213
- <line num="819" count="2" type="stmt"/>
214
- <line num="820" count="2" type="stmt"/>
215
- <line num="821" count="2" type="stmt"/>
216
- <line num="822" count="2" type="stmt"/>
217
- <line num="828" count="2" type="stmt"/>
209
+ <line num="812" count="12" type="cond" truecount="0" falsecount="1"/>
210
+ <line num="817" count="0" type="stmt"/>
211
+ <line num="819" count="0" type="stmt"/>
212
+ <line num="820" count="0" type="stmt"/>
213
+ <line num="821" count="0" type="cond" truecount="0" falsecount="1"/>
214
+ <line num="822" count="0" type="stmt"/>
215
+ <line num="831" count="0" type="stmt"/>
216
+ <line num="838" count="12" type="stmt"/>
217
+ <line num="841" count="1" type="stmt"/>
218
+ <line num="844" count="2" type="stmt"/>
219
+ <line num="845" count="2" type="stmt"/>
220
+ <line num="846" count="2" type="stmt"/>
221
+ <line num="847" count="2" type="stmt"/>
222
+ <line num="848" count="2" type="stmt"/>
223
+ <line num="849" count="2" type="stmt"/>
224
+ <line num="855" count="2" type="stmt"/>
218
225
  </file>
219
226
  </package>
220
227
  <package name="src.modules">