expo-iap 5.0.1 → 5.1.0

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
@@ -24,9 +24,9 @@
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
26
  - The actual iOS 15.0+ requirement is enforced at build time via @available annotations
27
- - Users must ensure their app target is set to iOS 15.0 or higher:
28
- - app.json: `"expo": { "ios": { "deploymentTarget": "15.0" } }`
29
- - or app.config.ts: `ios: { deploymentTarget: '15.0' }`
27
+ - Users must follow the deployment target required by their Expo SDK. The
28
+ validated Expo SDK 57 example uses iOS 16.4; older supported SDKs must never
29
+ go below the module's iOS 15.0 runtime requirement.
30
30
 
31
31
  **tvOS Exception**: tvOS platform version MUST be `16.0` (not `13.4`) because:
32
32
 
package/README.md CHANGED
@@ -13,21 +13,6 @@ If you're shipping an app with expo-iap, we’d love to hear about it—please s
13
13
 
14
14
  </div>
15
15
 
16
- ## 🎨 Promotion
17
-
18
- <div align="center">
19
- <a href="https://hyodotdev.github.io/kstyled">
20
- <img src="https://hyodotdev.github.io/kstyled/img/logo.png" alt="kstyled Logo" width="120" />
21
- </a>
22
-
23
- **Compile-time CSS-in-JS for React Native**
24
-
25
- ✨ Experience the next generation of styling with **[kstyled](https://hyodotdev.github.io/kstyled)** - a blazing-fast, fully type-safe CSS-in-JS solution with zero runtime overhead.
26
-
27
- 🚀 **[Explore kstyled →](https://hyodotdev.github.io/kstyled)**
28
-
29
- </div>
30
-
31
16
  ## 📚 Documentation
32
17
 
33
18
  **[📖 Visit our comprehensive documentation site →](https://openiap.dev/docs/setup/expo)**
@@ -64,9 +64,9 @@ def useManagedAndroidSdkVersions = false
64
64
  if (useManagedAndroidSdkVersions) {
65
65
  useDefaultAndroidSdkVersions()
66
66
  } else {
67
- def openIapCompileSdkVersion = openIapResolveAndroidSdkVersion('compileSdkVersion', 'compileSdk', 35)
67
+ def openIapCompileSdkVersion = openIapResolveAndroidSdkVersion('compileSdkVersion', 'compileSdk', 36)
68
68
  def openIapMinSdkVersion = openIapResolveAndroidSdkVersion('minSdkVersion', 'minSdk', 23)
69
- def openIapTargetSdkVersion = openIapResolveAndroidSdkVersion('targetSdkVersion', 'compileSdk', 35)
69
+ def openIapTargetSdkVersion = openIapResolveAndroidSdkVersion('targetSdkVersion', 'compileSdk', 36)
70
70
 
71
71
  project.android {
72
72
  compileSdk = openIapCompileSdkVersion
@@ -102,9 +102,8 @@ kotlin {
102
102
  }
103
103
 
104
104
  dependencies {
105
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
106
105
  testImplementation "junit:junit:4.13.2"
107
- testImplementation "org.json:json:20180813"
106
+ testImplementation "org.json:json:20260719"
108
107
 
109
108
  // Use OpenIAP Google module only; avoid direct BillingClient dependency
110
109
  if (findProject(":openiap-google") != null) {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AA6FA,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQtD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,QAE9B;;AAED,wBAyBG"}
1
+ {"version":3,"file":"ExpoIapModule.d.ts","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AA6FA,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAQtD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,QAE9B;;AAED,wBAuBG"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,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c,CAAC,CAAC;IAClE,CAAC;CACF,CACF,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,WAAW,EAAE,CAAC,MAAM,CAAC;AAC9B,CAAC;AAED,eAAe,IAAI,KAAK,CAAC,EAAS,EAAE;IAClC,GAAG,CAAC,MAAM,EAAE,IAAI;QACd,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,IAAI,KAAK,eAAe,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9B,OAAO,QAAQ,CAAC,IAAI,KAAK,aAAa,CAAC;QACzC,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,mBAAmB,CAC3B,UAAU,EACV,2CAA2C,MAAM,CAC/C,IAAI,CACL,mDAAmD,CACrD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {requireNativeModule, UnavailabilityError} from 'expo-modules-core';\nimport {installedFromOnside} from './onside';\nimport {getVegaIapModule, isVegaOS} from './vega';\n\ntype NativeIapModuleName = 'ExpoIapVega' | 'ExpoIapOnside' | 'ExpoIap';\nconst ONSIDE_MARKETPLACE_ID = 'com.onside.marketplace-app';\n\nlet cached: {module: any; name: NativeIapModuleName} | null = null;\nlet onsideModuleUnavailable = false;\n\nfunction getResolved(): {module: any; name: NativeIapModuleName} {\n function shouldUseOnsideModule(): boolean {\n if (installedFromOnside === true) {\n return true;\n }\n\n if (typeof installedFromOnside !== 'string') {\n return false;\n }\n\n const normalized = installedFromOnside.trim().toLowerCase();\n return normalized === 'true' || normalized === ONSIDE_MARKETPLACE_ID;\n }\n\n function getExpectedModuleName(): NativeIapModuleName {\n if (isVegaOS()) {\n return 'ExpoIapVega';\n }\n\n return shouldUseOnsideModule() ? 'ExpoIapOnside' : 'ExpoIap';\n }\n\n function resolveNativeModule(): {\n module: any;\n name: NativeIapModuleName;\n } {\n if (isVegaOS()) {\n const vegaModule = getVegaIapModule();\n if (!vegaModule) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'Amazon Vega IAP module is unavailable. Install @amazon-devices/keplerscript-appstore-iap-lib in the Vega app target and build with the React Native for Vega kepler platform.',\n );\n }\n return {module: vegaModule, name: 'ExpoIapVega'};\n }\n\n if (shouldUseOnsideModule()) {\n if (onsideModuleUnavailable) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n try {\n return {\n module: requireNativeModule('ExpoIapOnside'),\n name: 'ExpoIapOnside',\n };\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIapOnside')) {\n throw error;\n }\n onsideModuleUnavailable = true;\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n }\n\n return {module: requireNativeModule('ExpoIap'), name: 'ExpoIap'};\n }\n\n const expectedName = getExpectedModuleName();\n if (!cached || cached.name !== expectedName) {\n cached = resolveNativeModule();\n }\n return cached;\n}\n\nfunction isMissingModuleError(error: unknown, moduleName: string): boolean {\n if (error instanceof UnavailabilityError) {\n return true;\n }\n\n if (error instanceof Error) {\n return error.message.includes(`Cannot find native module '${moduleName}'`);\n }\n\n return false;\n}\n\nexport const NATIVE_ERROR_CODES: Record<string, unknown> = new Proxy(\n {} as Record<string, unknown>,\n {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n return (getResolved().module.ERROR_CODES || {})[prop as string];\n },\n },\n);\n\n/**\n * Returns the raw native module (not wrapped in a Proxy).\n * Use this for EventEmitter / addListener calls — JSI HostObjects\n * require the real native module as `this`; a Proxy triggers\n * \"native state unsupported on Proxy\" on New Architecture / Hermes.\n */\nexport function getNativeModule() {\n return getResolved().module;\n}\n\nexport default new Proxy({} as any, {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const resolved = getResolved();\n if (prop === 'USING_ONSIDE_SDK') {\n return resolved.name === 'ExpoIapOnside';\n }\n if (prop === 'USING_VEGA_SDK') {\n return resolved.name === 'ExpoIapVega';\n }\n\n const value = resolved.module[prop];\n if (value !== undefined || resolved.name !== 'ExpoIapOnside') {\n return value;\n }\n\n return () => {\n throw new UnavailabilityError(\n 'expo-iap',\n `The Onside marketplace does not support ${String(\n prop,\n )}. The call was not routed through Apple StoreKit.`,\n );\n };\n },\n});\n"]}
1
+ {"version":3,"file":"ExpoIapModule.js","sourceRoot":"","sources":["../src/ExpoIapModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAGlD,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAE3D,IAAI,MAAM,GAAoD,IAAI,CAAC;AACnE,IAAI,uBAAuB,GAAG,KAAK,CAAC;AAEpC,SAAS,WAAW;IAClB,SAAS,qBAAqB;QAC5B,IAAI,mBAAmB,KAAK,IAAI,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE,CAAC;YAC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/B,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAChC,OAAO,QAAQ,CAAC,IAAI,KAAK,eAAe,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9B,OAAO,QAAQ,CAAC,IAAI,KAAK,aAAa,CAAC;QACzC,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7D,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,EAAE;YACV,MAAM,IAAI,mBAAmB,CAC3B,UAAU,EACV,2CAA2C,MAAM,CAAC,IAAI,CAAC,mDAAmD,CAC3G,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {requireNativeModule, UnavailabilityError} from 'expo-modules-core';\nimport {installedFromOnside} from './onside';\nimport {getVegaIapModule, isVegaOS} from './vega';\n\ntype NativeIapModuleName = 'ExpoIapVega' | 'ExpoIapOnside' | 'ExpoIap';\nconst ONSIDE_MARKETPLACE_ID = 'com.onside.marketplace-app';\n\nlet cached: {module: any; name: NativeIapModuleName} | null = null;\nlet onsideModuleUnavailable = false;\n\nfunction getResolved(): {module: any; name: NativeIapModuleName} {\n function shouldUseOnsideModule(): boolean {\n if (installedFromOnside === true) {\n return true;\n }\n\n if (typeof installedFromOnside !== 'string') {\n return false;\n }\n\n const normalized = installedFromOnside.trim().toLowerCase();\n return normalized === 'true' || normalized === ONSIDE_MARKETPLACE_ID;\n }\n\n function getExpectedModuleName(): NativeIapModuleName {\n if (isVegaOS()) {\n return 'ExpoIapVega';\n }\n\n return shouldUseOnsideModule() ? 'ExpoIapOnside' : 'ExpoIap';\n }\n\n function resolveNativeModule(): {\n module: any;\n name: NativeIapModuleName;\n } {\n if (isVegaOS()) {\n const vegaModule = getVegaIapModule();\n if (!vegaModule) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'Amazon Vega IAP module is unavailable. Install @amazon-devices/keplerscript-appstore-iap-lib in the Vega app target and build with the React Native for Vega kepler platform.',\n );\n }\n return {module: vegaModule, name: 'ExpoIapVega'};\n }\n\n if (shouldUseOnsideModule()) {\n if (onsideModuleUnavailable) {\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n try {\n return {\n module: requireNativeModule('ExpoIapOnside'),\n name: 'ExpoIapOnside',\n };\n } catch (error) {\n if (!isMissingModuleError(error, 'ExpoIapOnside')) {\n throw error;\n }\n onsideModuleUnavailable = true;\n throw new UnavailabilityError(\n 'expo-iap',\n 'The Onside marketplace build does not contain ExpoIapOnside. Rebuild with ios.onside.enabled instead of routing purchases through Apple StoreKit.',\n );\n }\n }\n\n return {module: requireNativeModule('ExpoIap'), name: 'ExpoIap'};\n }\n\n const expectedName = getExpectedModuleName();\n if (!cached || cached.name !== expectedName) {\n cached = resolveNativeModule();\n }\n return cached;\n}\n\nfunction isMissingModuleError(error: unknown, moduleName: string): boolean {\n if (error instanceof UnavailabilityError) {\n return true;\n }\n\n if (error instanceof Error) {\n return error.message.includes(`Cannot find native module '${moduleName}'`);\n }\n\n return false;\n}\n\nexport const NATIVE_ERROR_CODES: Record<string, unknown> = new Proxy(\n {} as Record<string, unknown>,\n {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n return (getResolved().module.ERROR_CODES || {})[prop as string];\n },\n },\n);\n\n/**\n * Returns the raw native module (not wrapped in a Proxy).\n * Use this for EventEmitter / addListener calls — JSI HostObjects\n * require the real native module as `this`; a Proxy triggers\n * \"native state unsupported on Proxy\" on New Architecture / Hermes.\n */\nexport function getNativeModule() {\n return getResolved().module;\n}\n\nexport default new Proxy({} as any, {\n get(target, prop) {\n if (typeof prop === 'symbol') return Reflect.get(target, prop);\n const resolved = getResolved();\n if (prop === 'USING_ONSIDE_SDK') {\n return resolved.name === 'ExpoIapOnside';\n }\n if (prop === 'USING_VEGA_SDK') {\n return resolved.name === 'ExpoIapVega';\n }\n\n const value = resolved.module[prop];\n if (value !== undefined || resolved.name !== 'ExpoIapOnside') {\n return value;\n }\n\n return () => {\n throw new UnavailabilityError(\n 'expo-iap',\n `The Onside marketplace does not support ${String(prop)}. The call was not routed through Apple StoreKit.`,\n );\n };\n },\n});\n"]}
@@ -2,6 +2,7 @@
2
2
  // Internal modules
3
3
  // import removed: use purchaseUpdatedListener directly in app code
4
4
  import ExpoIapModule from '../ExpoIapModule';
5
+ import {} from '../utils/errorMapping';
5
6
  import { decodeApplePurchases } from '../utils/availablePurchases';
6
7
  import { Linking, Platform } from 'react-native';
7
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAgB7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,CAAC,UAAkB,EAAQ,EAAE;IACtD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,2BAA2B,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC,CAAC;AAOF,YAAY;AAEZ,cAAc;AACd,MAAM,UAAU,YAAY,CAC1B,IAAa;IAEb,OAAO,CACL,IAAI,IAAI,IAAI;QACZ,OAAO,IAAI,KAAK,QAAQ;QACxB,UAAU,IAAI,IAAI;QAClB,OAAQ,IAAY,CAAC,QAAQ,KAAK,QAAQ;QACzC,IAAY,CAAC,QAAQ,CAAC,W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CAAC,yCAAyC,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,uCAAuC,CACxE,UAAU,CACX,CAAC;IACF,OAAO,MAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n SubscriptionStatusIOS,\n} from '../types';\nimport {type PurchaseError} from '../utils/errorMapping';\nimport {decodeApplePurchases} from '../utils/availablePurchases';\nimport {Linking, Platform} from 'react-native';\n\n/**\n * Enforce the documented iOS-only contract. Without this, calling a\n * suffixed wrapper on another platform falls through to the native proxy\n * and surfaces as an opaque `TypeError: ExpoIapModule.<name> is not a\n * function` instead of the promised platform error.\n */\nconst requireIosPlatform = (methodName: string): void => {\n if (Platform.OS !== 'ios') {\n throw new Error(`${methodName} is only available on iOS`);\n }\n};\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n requireIosPlatform('syncIOS');\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n requireIosPlatform('isEligibleForIntroOfferIOS');\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/subscription-status-ios}\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n requireIosPlatform('subscriptionStatusIOS');\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/current-entitlement-ios}\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n requireIosPlatform('currentEntitlementIOS');\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/latest-transaction-ios}\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n requireIosPlatform('latestTransactionIOS');\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/begin-refund-request-ios}\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n requireIosPlatform('beginRefundRequestIOS');\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n requireIosPlatform('showManageSubscriptionsIOS');\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return decodeApplePurchases(purchases);\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n requireIosPlatform('getReceiptDataIOS');\n return ExpoIapModule.getReceiptDataIOS();\n};\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n requireIosPlatform('requestReceiptRefreshIOS');\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-transaction-verified-ios}\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n requireIosPlatform('isTransactionVerifiedIOS');\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-transaction-jws-ios}\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n requireIosPlatform('getTransactionJwsIOS');\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns The verified redeemed purchase on iOS 27+, or null after the\n * legacy sheet is presented on earlier iOS versions.\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n requireIosPlatform('presentCodeRedemptionSheetIOS');\n return await ExpoIapModule.presentCodeRedemptionSheetIOS();\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-app-transaction-ios}\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n requireIosPlatform('getAppTransactionIOS');\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-promoted-product-ios}\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n requireIosPlatform('getPromotedProductIOS');\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-pending-transactions-ios}\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n requireIosPlatform('getPendingTransactionsIOS');\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return decodeApplePurchases(transactions);\n};\n\n/**\n * List every StoreKit transaction (finished + unfinished) for the current user.\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-all-transactions-ios}\n */\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n requireIosPlatform('getAllTransactionsIOS');\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return decodeApplePurchases(transactions);\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/clear-transaction-ios}\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n requireIosPlatform('clearTransactionIOS');\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 17.4+).\n *\n * Wraps `ExternalPurchase.canPresent`, which Apple introduced in iOS 17.4.\n * Note: the notice sheet itself (`presentExternalPurchaseNoticeSheetIOS`)\n * still requires iOS 18.2+; only the eligibility check is available earlier.\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n requireIosPlatform('canPresentExternalPurchaseNoticeIOS');\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n requireIosPlatform('presentExternalPurchaseNoticeSheetIOS');\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios}\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n requireIosPlatform('presentExternalPurchaseLinkIOS');\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<\n 'isEligibleForExternalPurchaseCustomLinkIOS'\n> = async () => {\n requireIosPlatform('isEligibleForExternalPurchaseCustomLinkIOS');\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n};\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}\n */\nexport const getExternalPurchaseCustomLinkTokenIOS: QueryField<\n 'getExternalPurchaseCustomLinkTokenIOS'\n> = async (tokenType) => {\n requireIosPlatform('getExternalPurchaseCustomLinkTokenIOS');\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS: MutationField<\n 'showExternalPurchaseCustomLinkNoticeIOS'\n> = async (noticeType) => {\n requireIosPlatform('showExternalPurchaseCustomLinkNoticeIOS');\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
1
+ {"version":3,"file":"ios.js","sourceRoot":"","sources":["../../src/modules/ios.ts"],"names":[],"mappings":"AAAA,wBAAwB;AAExB,mBAAmB;AACnB,mEAAmE;AACnE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAe7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IAAI,EAAE;IACb,kBAAkB,CAAC,4CAA4C,CAAC,CAAC;IACjE,OAAO,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,0CAA0C,EAAE,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAE9C,KAAK,EAAE,SAAS,EAAE,EAAE;IACtB,kBAAkB,CAAC,uCAAuC,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,qCAAqC,CACtE,SAAS,CACV,CAAC;IACF,OAAO,MAAkD,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAEhD,KAAK,EAAE,UAAU,EAAE,EAAE;IACvB,kBAAkB,CAAC,yCAAyC,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,uCAAuC,CACxE,UAAU,CACX,CAAC;IACF,OAAO,MAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,uEAAuE","sourcesContent":["// External dependencies\n\n// Internal modules\n// import removed: use purchaseUpdatedListener directly in app code\nimport ExpoIapModule from '../ExpoIapModule';\n\n// Types\nimport type {\n ExternalPurchaseCustomLinkNoticeResultIOS,\n ExternalPurchaseCustomLinkTokenResultIOS,\n ExternalPurchaseLinkResultIOS,\n ExternalPurchaseNoticeResultIOS,\n MutationField,\n ProductIOS,\n Purchase,\n PurchaseIOS,\n QueryField,\n SubscriptionStatusIOS,\n} from '../types';\nimport {type PurchaseError} from '../utils/errorMapping';\nimport {decodeApplePurchases} from '../utils/availablePurchases';\nimport {Linking, Platform} from 'react-native';\n\n/**\n * Enforce the documented iOS-only contract. Without this, calling a\n * suffixed wrapper on another platform falls through to the native proxy\n * and surfaces as an opaque `TypeError: ExpoIapModule.<name> is not a\n * function` instead of the promised platform error.\n */\nconst requireIosPlatform = (methodName: string): void => {\n if (Platform.OS !== 'ios') {\n throw new Error(`${methodName} is only available on iOS`);\n }\n};\n\nexport type TransactionEvent = {\n transaction?: Purchase;\n error?: PurchaseError;\n};\n\n// Listeners\n\n// Type guards\nexport function isProductIOS<T extends {platform?: string}>(\n item: unknown,\n): item is T & {platform: 'ios'} {\n return (\n item != null &&\n typeof item === 'object' &&\n 'platform' in item &&\n typeof (item as any).platform === 'string' &&\n (item as any).platform.toLowerCase() === 'ios'\n );\n}\n\n// Functions\n/**\n * Sync state with Appstore (iOS only)\n * https://developer.apple.com/documentation/storekit/appstore/3791906-sync\n *\n * @returns Promise resolving to null on success\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/sync-ios}\n */\nexport const syncIOS: MutationField<'syncIOS'> = async () => {\n requireIosPlatform('syncIOS');\n return !!(await ExpoIapModule.syncIOS());\n};\n\n/**\n * Check if user is eligible for introductory offer\n *\n * @param groupId - The subscription group ID\n * @returns Promise resolving to true if eligible\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-intro-offer-ios}\n */\nexport const isEligibleForIntroOfferIOS: QueryField<\n 'isEligibleForIntroOfferIOS'\n> = async (groupId) => {\n requireIosPlatform('isEligibleForIntroOfferIOS');\n if (!groupId) {\n throw new Error('isEligibleForIntroOfferIOS requires a groupId');\n }\n return ExpoIapModule.isEligibleForIntroOfferIOS(groupId);\n};\n\n/**\n * Get subscription status for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to array of subscription status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/subscription-status-ios}\n */\nexport const subscriptionStatusIOS: QueryField<\n 'subscriptionStatusIOS'\n> = async (sku) => {\n requireIosPlatform('subscriptionStatusIOS');\n if (!sku) {\n throw new Error('subscriptionStatusIOS requires a SKU');\n }\n const status = await ExpoIapModule.subscriptionStatusIOS(sku);\n return (status ?? []) as SubscriptionStatusIOS[];\n};\n\n/**\n * Get current entitlement for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to current entitlement\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/current-entitlement-ios}\n */\nexport const currentEntitlementIOS: QueryField<\n 'currentEntitlementIOS'\n> = async (sku) => {\n requireIosPlatform('currentEntitlementIOS');\n if (!sku) {\n throw new Error('currentEntitlementIOS requires a SKU');\n }\n const purchase = await ExpoIapModule.currentEntitlementIOS(sku);\n return (purchase ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Get latest transaction for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to latest transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/latest-transaction-ios}\n */\nexport const latestTransactionIOS: QueryField<'latestTransactionIOS'> = async (\n sku,\n) => {\n requireIosPlatform('latestTransactionIOS');\n if (!sku) {\n throw new Error('latestTransactionIOS requires a SKU');\n }\n const transaction = await ExpoIapModule.latestTransactionIOS(sku);\n return (transaction ?? null) as PurchaseIOS | null;\n};\n\n/**\n * Begin refund request for a specific SKU\n *\n * @param sku The product SKU\n * @returns Promise resolving to refund request status\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/begin-refund-request-ios}\n */\nexport const beginRefundRequestIOS: MutationField<\n 'beginRefundRequestIOS'\n> = async (sku) => {\n requireIosPlatform('beginRefundRequestIOS');\n if (!sku) {\n throw new Error('beginRefundRequestIOS requires a SKU');\n }\n const status = await ExpoIapModule.beginRefundRequestIOS(sku);\n return status ?? null;\n};\n\n/**\n * Shows the system UI for managing subscriptions.\n * Returns an array of subscriptions that had status changes after the UI is closed.\n *\n * @returns Promise<Purchase[]> - Array of subscriptions with status changes (e.g., auto-renewal toggled)\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-manage-subscriptions-ios}\n */\nexport const showManageSubscriptionsIOS: MutationField<\n 'showManageSubscriptionsIOS'\n> = async () => {\n requireIosPlatform('showManageSubscriptionsIOS');\n const purchases = await ExpoIapModule.showManageSubscriptionsIOS();\n return decodeApplePurchases(purchases);\n};\n\n/**\n * Get the receipt data from the iOS device.\n * This returns the base64 encoded receipt data which can be sent to your server\n * for verification with Apple's server.\n *\n * NOTE: For proper security, always verify receipts on your server using\n * Apple's verifyReceipt endpoint, not directly from the app.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-receipt-data-ios}\n */\nexport const getReceiptDataIOS: QueryField<'getReceiptDataIOS'> = async () => {\n requireIosPlatform('getReceiptDataIOS');\n return ExpoIapModule.getReceiptDataIOS();\n};\n\n/**\n * Refresh the receipt data from Apple's servers and return the updated receipt.\n * This calls AppStore.sync() before reading the receipt, ensuring the latest\n * receipt data is available. Use this after a first purchase when\n * getReceiptDataIOS() may return an empty string because the receipt file\n * has not yet been written to disk.\n *\n * @returns {Promise<string>} Base64 encoded receipt data\n *\n * @platform iOS\n */\nexport const requestReceiptRefreshIOS = async (): Promise<string> => {\n requireIosPlatform('requestReceiptRefreshIOS');\n return ExpoIapModule.requestReceiptRefreshIOS();\n};\n\n/**\n * Check if a transaction is verified through StoreKit 2.\n * StoreKit 2 performs local verification of transaction JWS signatures.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to true if the transaction is verified\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-transaction-verified-ios}\n */\nexport const isTransactionVerifiedIOS: QueryField<\n 'isTransactionVerifiedIOS'\n> = async (sku) => {\n requireIosPlatform('isTransactionVerifiedIOS');\n if (!sku) {\n throw new Error('isTransactionVerifiedIOS requires a SKU');\n }\n return ExpoIapModule.isTransactionVerifiedIOS(sku);\n};\n\n/**\n * Get the JWS representation of a purchase for server-side verification.\n * The JWS (JSON Web Signature) can be verified on your server using Apple's public keys.\n *\n * @param sku The product's SKU (on iOS)\n * @returns Promise resolving to JWS representation of the transaction\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-transaction-jws-ios}\n */\nexport const getTransactionJwsIOS: QueryField<'getTransactionJwsIOS'> = async (\n sku,\n) => {\n requireIosPlatform('getTransactionJwsIOS');\n if (!sku) {\n throw new Error('getTransactionJwsIOS requires a SKU');\n }\n const jws = await ExpoIapModule.getTransactionJwsIOS(sku);\n return jws ?? '';\n};\n\n/**\n * Present the code redemption sheet for offer codes (iOS only).\n * This allows users to redeem promotional codes for in-app purchases and subscriptions.\n *\n * Note: This only works on real devices, not simulators.\n *\n * @returns The verified redeemed purchase on iOS 27+, or null after the\n * legacy sheet is presented on earlier iOS versions.\n * @throws Error if called on non-iOS platform or tvOS\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-code-redemption-sheet-ios}\n */\nexport const presentCodeRedemptionSheetIOS: MutationField<\n 'presentCodeRedemptionSheetIOS'\n> = async () => {\n requireIosPlatform('presentCodeRedemptionSheetIOS');\n return await ExpoIapModule.presentCodeRedemptionSheetIOS();\n};\n\n/**\n * Get app transaction information (iOS 16.0+).\n * AppTransaction represents the initial purchase that unlocked the app.\n *\n * NOTE: This function requires:\n * - iOS 16.0 or later at runtime\n * - Xcode 15.0+ with iOS 16.0 SDK for compilation\n *\n * @returns Promise resolving to the app transaction information or null if not available\n * @throws Error if called on non-iOS platform, iOS version < 16.0, or compiled with older SDK\n *\n * @platform iOS\n * @since iOS 16.0\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-app-transaction-ios}\n */\nexport const getAppTransactionIOS: QueryField<\n 'getAppTransactionIOS'\n> = async () => {\n requireIosPlatform('getAppTransactionIOS');\n return (await ExpoIapModule.getAppTransactionIOS()) ?? null;\n};\n\n/**\n * Get information about a promoted product if one is available (iOS only).\n * Promoted products are products that the App Store promotes on your behalf.\n * This is called after a promoted product event is received from the App Store.\n *\n * @returns Promise resolving to the promoted product information or null if none available\n * @throws Error if called on non-iOS platform\n *\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-promoted-product-ios}\n */\nexport const getPromotedProductIOS: QueryField<\n 'getPromotedProductIOS'\n> = async () => {\n requireIosPlatform('getPromotedProductIOS');\n const product = await ExpoIapModule.getPromotedProductIOS();\n return (product ?? null) as ProductIOS | null;\n};\n\n/**\n * Get pending transactions that haven't been finished yet (iOS only).\n *\n * @returns Promise resolving to array of pending transactions\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-pending-transactions-ios}\n */\nexport const getPendingTransactionsIOS: QueryField<\n 'getPendingTransactionsIOS'\n> = async () => {\n requireIosPlatform('getPendingTransactionsIOS');\n const transactions = await ExpoIapModule.getPendingTransactionsIOS();\n return decodeApplePurchases(transactions);\n};\n\n/**\n * List every StoreKit transaction (finished + unfinished) for the current user.\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-all-transactions-ios}\n */\nexport const getAllTransactionsIOS: QueryField<\n 'getAllTransactionsIOS'\n> = async () => {\n requireIosPlatform('getAllTransactionsIOS');\n const transactions = await ExpoIapModule.getAllTransactionsIOS();\n return decodeApplePurchases(transactions);\n};\n\n/**\n * Clear a specific transaction (iOS only).\n *\n * @returns Promise resolving when transaction is cleared\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/clear-transaction-ios}\n */\nexport const clearTransactionIOS: MutationField<\n 'clearTransactionIOS'\n> = async () => {\n requireIosPlatform('clearTransactionIOS');\n return !!(await ExpoIapModule.clearTransactionIOS());\n};\n\n/**\n * Deep link to subscriptions screen on iOS.\n * @returns {Promise<void>}\n *\n * @platform iOS\n */\nexport const deepLinkToSubscriptionsIOS = (): Promise<void> =>\n Linking.openURL('https://apps.apple.com/account/subscriptions');\n\n/**\n * Check if the device can present an external purchase notice sheet (iOS 17.4+).\n *\n * Wraps `ExternalPurchase.canPresent`, which Apple introduced in iOS 17.4.\n * Note: the notice sheet itself (`presentExternalPurchaseNoticeSheetIOS`)\n * still requires iOS 18.2+; only the eligibility check is available earlier.\n *\n * @returns Promise resolving to true if the notice sheet can be presented\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/can-present-external-purchase-notice-ios}\n */\nexport const canPresentExternalPurchaseNoticeIOS: QueryField<\n 'canPresentExternalPurchaseNoticeIOS'\n> = async () => {\n requireIosPlatform('canPresentExternalPurchaseNoticeIOS');\n return !!(await ExpoIapModule.canPresentExternalPurchaseNoticeIOS());\n};\n\n/**\n * Present an external purchase notice sheet to inform users about external purchases (iOS 15.4+).\n * This must be called before opening an external purchase link.\n * Returns the external purchase token when user continues.\n *\n * @returns Promise resolving to the result with action, token, and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-notice-sheet-ios}\n */\nexport const presentExternalPurchaseNoticeSheetIOS: MutationField<\n 'presentExternalPurchaseNoticeSheetIOS'\n> = async () => {\n requireIosPlatform('presentExternalPurchaseNoticeSheetIOS');\n const result = await ExpoIapModule.presentExternalPurchaseNoticeSheetIOS();\n return result as ExternalPurchaseNoticeResultIOS;\n};\n\n/**\n * Present an external purchase link to redirect users to your website (iOS 16.0+).\n *\n * @param url - The external purchase URL to open\n * @returns Promise resolving to the result with success status and error if any\n * @platform iOS\n *\n * @see {@link https://openiap.dev/docs/apis/ios/present-external-purchase-link-ios}\n */\nexport const presentExternalPurchaseLinkIOS: MutationField<\n 'presentExternalPurchaseLinkIOS'\n> = async (url: string) => {\n requireIosPlatform('presentExternalPurchaseLinkIOS');\n const result = await ExpoIapModule.presentExternalPurchaseLinkIOS(url);\n return result as ExternalPurchaseLinkResultIOS;\n};\n\n/**\n * Check if app is eligible for ExternalPurchaseCustomLink API (iOS 18.1+).\n * Returns true if the app can use custom external purchase links.\n *\n * @returns Promise resolving to true if eligible\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/iseligible\n *\n * @see {@link https://openiap.dev/docs/apis/ios/is-eligible-for-external-purchase-custom-link-ios}\n */\nexport const isEligibleForExternalPurchaseCustomLinkIOS: QueryField<\n 'isEligibleForExternalPurchaseCustomLinkIOS'\n> = async () => {\n requireIosPlatform('isEligibleForExternalPurchaseCustomLinkIOS');\n return !!(await ExpoIapModule.isEligibleForExternalPurchaseCustomLinkIOS());\n};\n\n/**\n * Get external purchase token for reporting to Apple (iOS 18.1+).\n * Use this token with Apple's External Purchase Server API to report transactions.\n *\n * @param tokenType - Token type: 'acquisition' (new customers) or 'services' (existing customers)\n * @returns Promise resolving to the token result with token string or error\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/token(for:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/get-external-purchase-custom-link-token-ios}\n */\nexport const getExternalPurchaseCustomLinkTokenIOS: QueryField<\n 'getExternalPurchaseCustomLinkTokenIOS'\n> = async (tokenType) => {\n requireIosPlatform('getExternalPurchaseCustomLinkTokenIOS');\n if (!tokenType) {\n throw new Error(\n \"getExternalPurchaseCustomLinkTokenIOS requires a tokenType ('acquisition' or 'services')\",\n );\n }\n const result = await ExpoIapModule.getExternalPurchaseCustomLinkTokenIOS(\n tokenType,\n );\n return result as ExternalPurchaseCustomLinkTokenResultIOS;\n};\n\n/**\n * Show ExternalPurchaseCustomLink notice sheet (iOS 18.1+).\n * Displays the system disclosure notice sheet for custom external purchase links.\n * Call this after a deliberate customer interaction before linking out to external purchases.\n *\n * @param noticeType - Notice type: 'browser' (external purchases displayed in browser)\n * @returns Promise resolving to the result with continued status and error if any\n * @platform iOS\n * @see https://developer.apple.com/documentation/storekit/externalpurchasecustomlink/shownotice(type:)\n *\n * @see {@link https://openiap.dev/docs/apis/ios/show-external-purchase-custom-link-notice-ios}\n */\nexport const showExternalPurchaseCustomLinkNoticeIOS: MutationField<\n 'showExternalPurchaseCustomLinkNoticeIOS'\n> = async (noticeType) => {\n requireIosPlatform('showExternalPurchaseCustomLinkNoticeIOS');\n if (!noticeType) {\n throw new Error(\n \"showExternalPurchaseCustomLinkNoticeIOS requires a noticeType ('browser')\",\n );\n }\n const result = await ExpoIapModule.showExternalPurchaseCustomLinkNoticeIOS(\n noticeType,\n );\n return result as ExternalPurchaseCustomLinkNoticeResultIOS;\n};\n\n// iOS-specific APIs only; cross-platform wrappers live in src/index.ts\n"]}
@@ -1,4 +1,4 @@
1
- import { InstalledFromOnside } from './ExpoOnsideMarketplaceAvailabilityModule';
1
+ import { type InstalledFromOnside } from './ExpoOnsideMarketplaceAvailabilityModule';
2
2
  declare let installedFromOnside: InstalledFromOnside;
3
3
  /**
4
4
  * IMPORTANT:
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/onside/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAGnD,QAAA,IAAI,mBAAmB,EAAE,mBAA0B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,iBAAe,2BAA2B,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAKzE;AAED,iBAAS,SAAS;;EAcjB;AAED,OAAO,EAAC,2BAA2B,EAAE,mBAAmB,EAAE,SAAS,EAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/onside/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,2CAA2C,CAAC;AAGnD,QAAA,IAAI,mBAAmB,EAAE,mBAA0B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,iBAAe,2BAA2B,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAKzE;AAED,iBAAS,SAAS;;EAcjB;AAED,OAAO,EAAC,2BAA2B,EAAE,mBAAmB,EAAE,SAAS,EAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/onside/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,GAExC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE1C,IAAI,mBAAmB,GAAwB,IAAI,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qHAAqH;AACrH,KAAK,UAAU,2BAA2B;IACxC,MAAM,kBAAkB,GACtB,MAAM,uCAAuC,CAAC,gCAAgC,EAAE,CAAC;IACnF,mBAAmB,GAAG,kBAAkB,CAAC;IACzC,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,SAAS,SAAS;IAChB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE;QACb,2BAA2B,EAAE;aAC1B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,mBAAmB,GAAG,MAAM,CAAC;QAC/B,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAC,eAAe,EAAC,CAAC;AAC3B,CAAC;AAED,OAAO,EAAC,2BAA2B,EAAE,mBAAmB,EAAE,SAAS,EAAC,CAAC","sourcesContent":["import {\n ExpoOnsideMarketplaceAvailabilityModule,\n InstalledFromOnside,\n} from './ExpoOnsideMarketplaceAvailabilityModule';\nimport {useEffect, useState} from 'react';\n\nlet installedFromOnside: InstalledFromOnside = null;\n\n/**\n * IMPORTANT:\n * Note: call it BEFORE initializing useIAP, for example during SplashScreen initialization.\n *\n * 1) Call checkInstallationFromOnside BEFORE initializing useIAP.\n * Reason: this is an asynchronous check and cannot run during module import/initialization.\n * Always reference useIAP after this check to ensure the correct platform is being used.\n * 2) Make sure the Onside module is enabled in your Expo config plugin:\n *\n * plugins: [\n * [\n * 'expo-iap',\n * {\n * modules: {\n * onside: true,\n * //Keep other modules\n * },\n * },\n * ],\n * ];\n *\n * Without this, the Onside integration won’t be linked and the availability check will always be false.\n */\n\n// checkInstallationFromOnside is required to switch the payment module at runtime based on marketplace installation.\nasync function checkInstallationFromOnside(): Promise<InstalledFromOnside> {\n const onsideInstallation =\n await ExpoOnsideMarketplaceAvailabilityModule.checkInstallationFromOnsideAsync();\n installedFromOnside = onsideInstallation;\n return onsideInstallation;\n}\n\nfunction useOnside() {\n const [isOnsideLoading, setIsOnsideLoading] = useState(true);\n\n useEffect(() => {\n checkInstallationFromOnside()\n .then((result) => {\n installedFromOnside = result;\n })\n .finally(() => {\n setIsOnsideLoading(false);\n });\n }, []);\n\n return {isOnsideLoading};\n}\n\nexport {checkInstallationFromOnside, installedFromOnside, useOnside};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/onside/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,GAExC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE1C,IAAI,mBAAmB,GAAwB,IAAI,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qHAAqH;AACrH,KAAK,UAAU,2BAA2B;IACxC,MAAM,kBAAkB,GACtB,MAAM,uCAAuC,CAAC,gCAAgC,EAAE,CAAC;IACnF,mBAAmB,GAAG,kBAAkB,CAAC;IACzC,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,SAAS,SAAS;IAChB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE;QACb,2BAA2B,EAAE;aAC1B,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACf,mBAAmB,GAAG,MAAM,CAAC;QAC/B,CAAC,CAAC;aACD,OAAO,CAAC,GAAG,EAAE;YACZ,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAC,eAAe,EAAC,CAAC;AAC3B,CAAC;AAED,OAAO,EAAC,2BAA2B,EAAE,mBAAmB,EAAE,SAAS,EAAC,CAAC","sourcesContent":["import {\n ExpoOnsideMarketplaceAvailabilityModule,\n type InstalledFromOnside,\n} from './ExpoOnsideMarketplaceAvailabilityModule';\nimport {useEffect, useState} from 'react';\n\nlet installedFromOnside: InstalledFromOnside = null;\n\n/**\n * IMPORTANT:\n * Note: call it BEFORE initializing useIAP, for example during SplashScreen initialization.\n *\n * 1) Call checkInstallationFromOnside BEFORE initializing useIAP.\n * Reason: this is an asynchronous check and cannot run during module import/initialization.\n * Always reference useIAP after this check to ensure the correct platform is being used.\n * 2) Make sure the Onside module is enabled in your Expo config plugin:\n *\n * plugins: [\n * [\n * 'expo-iap',\n * {\n * modules: {\n * onside: true,\n * //Keep other modules\n * },\n * },\n * ],\n * ];\n *\n * Without this, the Onside integration won’t be linked and the availability check will always be false.\n */\n\n// checkInstallationFromOnside is required to switch the payment module at runtime based on marketplace installation.\nasync function checkInstallationFromOnside(): Promise<InstalledFromOnside> {\n const onsideInstallation =\n await ExpoOnsideMarketplaceAvailabilityModule.checkInstallationFromOnsideAsync();\n installedFromOnside = onsideInstallation;\n return onsideInstallation;\n}\n\nfunction useOnside() {\n const [isOnsideLoading, setIsOnsideLoading] = useState(true);\n\n useEffect(() => {\n checkInstallationFromOnside()\n .then((result) => {\n installedFromOnside = result;\n })\n .finally(() => {\n setIsOnsideLoading(false);\n });\n }, []);\n\n return {isOnsideLoading};\n}\n\nexport {checkInstallationFromOnside, installedFromOnside, useOnside};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useIAP.d.ts","sourceRoot":"","sources":["../src/useIAP.ts"],"names":[],"mappings":"AAMA,OAAO,EAWL,eAAe,IAAI,uBAAuB,EAM1C,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAejB,OAAO,KAAK,EACV,OAAO,EACP,mBAAmB,EAGnB,8BAA8B,EAC9B,qBAAqB,EACrB,sCAAsC,EAEtC,QAAQ,EACR,2BAA2B,EAE3B,8BAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAChC,eAAe,EACf,aAAa,EACb,UAAU,EACV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAqBxD,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,kBAAkB,EAAE,QAAQ,EAAE,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,iBAAiB,EAAE,CAAC,EAClB,QAAQ,EACR,YAAY,GACb,EAAE;QACD,QAAQ,EAAE,QAAQ,CAAC;QACnB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,qBAAqB,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,aAAa,EAAE,CAAC,MAAM,EAAE;QACtB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;KACzB,KAAK,OAAO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GAAG,MAAM,CAstBtD"}
package/build/useIAP.js CHANGED
@@ -34,6 +34,9 @@ export function useIAP(options) {
34
34
  const [activeSubscriptions, setActiveSubscriptions] = useState([]);
35
35
  const optionsRef = useRef(options);
36
36
  const connectedRef = useRef(false);
37
+ const isMountedRef = useRef(false);
38
+ const initializationGenerationRef = useRef(0);
39
+ const startedInitializationGenerationRef = useRef(0);
37
40
  const deliveredPurchaseKeysRef = useRef(new Set());
38
41
  // Helper function to merge arrays with duplicate checking
39
42
  const mergeWithDuplicateCheck = useCallback((existingItems, newItems, getKey) => {
@@ -368,7 +371,12 @@ export function useIAP(options) {
368
371
  }
369
372
  return undefined;
370
373
  }, []);
371
- const initIapWithSubscriptions = useCallback(async () => {
374
+ const initIapWithSubscriptions = useCallback(async (generation) => {
375
+ if (!isMountedRef.current ||
376
+ initializationGenerationRef.current !== generation) {
377
+ return;
378
+ }
379
+ startedInitializationGenerationRef.current = generation;
372
380
  // CRITICAL: Register listeners BEFORE initConnection to avoid race condition
373
381
  // Events might fire immediately after initConnection, so listeners must be ready
374
382
  // Register purchase update listener BEFORE initConnection to avoid race conditions.
@@ -386,7 +394,8 @@ export function useIAP(options) {
386
394
  }, optionsRef.current?.purchaseUpdatedListenerOptions);
387
395
  // Register purchase error listener EARLY. Ignore init-related errors until connected.
388
396
  subscriptionsRef.current.purchaseError = purchaseErrorListener((error) => {
389
- if (!connectedRef.current && error.code === ErrorCode.InitConnection) {
397
+ if (!connectedRef.current &&
398
+ error.code === ErrorCode.InitConnection) {
390
399
  return; // Ignore initialization error before connected
391
400
  }
392
401
  const friendly = getUserFriendlyErrorMessage(error);
@@ -420,17 +429,26 @@ export function useIAP(options) {
420
429
  });
421
430
  if (Platform.OS === 'ios') {
422
431
  // iOS promoted products listener
423
- subscriptionsRef.current.promotedProductIOS = promotedProductListenerIOS((product) => {
424
- setPromotedProductIOS(product);
425
- if (optionsRef.current?.onPromotedProductIOS) {
426
- optionsRef.current.onPromotedProductIOS(product);
427
- }
428
- });
432
+ subscriptionsRef.current.promotedProductIOS =
433
+ promotedProductListenerIOS((product) => {
434
+ setPromotedProductIOS(product);
435
+ if (optionsRef.current?.onPromotedProductIOS) {
436
+ optionsRef.current.onPromotedProductIOS(product);
437
+ }
438
+ });
429
439
  }
430
440
  // NOW call initConnection after listeners are ready
431
441
  const config = buildConnectionConfig();
432
442
  try {
433
443
  const result = await initConnection(config);
444
+ if (!isMountedRef.current ||
445
+ initializationGenerationRef.current !== generation) {
446
+ if (startedInitializationGenerationRef.current === generation) {
447
+ startedInitializationGenerationRef.current = 0;
448
+ await endConnection();
449
+ }
450
+ return;
451
+ }
434
452
  setConnected(result);
435
453
  if (!result) {
436
454
  // If connection failed, clean up listeners
@@ -443,6 +461,10 @@ export function useIAP(options) {
443
461
  }
444
462
  }
445
463
  catch (error) {
464
+ if (!isMountedRef.current ||
465
+ initializationGenerationRef.current !== generation) {
466
+ return;
467
+ }
446
468
  ExpoIapConsole.error('initConnection failed:', error);
447
469
  invokeOnError(error);
448
470
  // Clean up listeners on error
@@ -503,16 +525,22 @@ export function useIAP(options) {
503
525
  invokeOnError,
504
526
  ]);
505
527
  useEffect(() => {
506
- initIapWithSubscriptions();
528
+ const generation = ++initializationGenerationRef.current;
529
+ isMountedRef.current = true;
530
+ void Promise.resolve().then(() => initIapWithSubscriptions(generation));
507
531
  const currentSubscriptions = subscriptionsRef.current;
508
532
  return () => {
533
+ isMountedRef.current = false;
509
534
  currentSubscriptions.purchaseUpdate?.remove();
510
535
  currentSubscriptions.purchaseError?.remove();
511
536
  currentSubscriptions.promotedProductIOS?.remove();
512
537
  currentSubscriptions.userChoiceBillingAndroid?.remove();
513
538
  currentSubscriptions.developerProvidedBillingAndroid?.remove();
514
539
  currentSubscriptions.subscriptionBillingIssue?.remove();
515
- endConnection();
540
+ if (startedInitializationGenerationRef.current === generation) {
541
+ startedInitializationGenerationRef.current = 0;
542
+ void endConnection();
543
+ }
516
544
  setConnected(false);
517
545
  };
518
546
  }, [initIapWithSubscriptions]);