expo-iap 5.5.1 → 5.6.1

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.
@@ -7,6 +7,7 @@ import dev.hyo.openiap.OpenIapModule
7
7
  import dev.hyo.openiap.ProductQueryType
8
8
  import dev.hyo.openiap.SubscriptionProductReplacementParamsAndroid
9
9
  import dev.hyo.openiap.SubscriptionReplacementModeAndroid
10
+ import dev.hyo.openiap.listener.OpenIapConnectionStateListener
10
11
  import dev.hyo.openiap.listener.OpenIapDeveloperProvidedBillingListener
11
12
  import dev.hyo.openiap.listener.OpenIapPurchaseErrorListener
12
13
  import dev.hyo.openiap.listener.OpenIapPurchaseUpdateListener
@@ -30,6 +31,7 @@ object ExpoIapHelper {
30
31
  val userChoiceBilling: OpenIapUserChoiceBillingListener,
31
32
  val developerProvidedBilling: OpenIapDeveloperProvidedBillingListener,
32
33
  val subscriptionBillingIssue: OpenIapSubscriptionBillingIssueListener,
34
+ val connectionState: OpenIapConnectionStateListener,
33
35
  )
34
36
 
35
37
  internal fun serializeOpenIapError(error: OpenIapError): Map<String, Any?> =
@@ -440,12 +442,21 @@ object ExpoIapHelper {
440
442
  }
441
443
  openIap.addSubscriptionBillingIssueListener(subscriptionBillingIssueListener)
442
444
 
445
+ // Diagnostic only. connectionReady gates event emission, so clearing it
446
+ // here would buffer the purchase error instead of sending it (#408).
447
+ val connectionStateListener =
448
+ OpenIapConnectionStateListener {
449
+ ExpoIapLog.warning("billing service disconnected; connection must be re-initialized")
450
+ }
451
+ openIap.addConnectionStateListener(connectionStateListener)
452
+
443
453
  return ListenerHandles(
444
454
  purchaseUpdate = purchaseUpdateListener,
445
455
  purchaseError = purchaseErrorListener,
446
456
  userChoiceBilling = userChoiceBillingListener,
447
457
  developerProvidedBilling = developerProvidedBillingListener,
448
458
  subscriptionBillingIssue = subscriptionBillingIssueListener,
459
+ connectionState = connectionStateListener,
449
460
  )
450
461
  }
451
462
 
@@ -459,5 +470,6 @@ object ExpoIapHelper {
459
470
  openIap.removeUserChoiceBillingListener(handles.userChoiceBilling)
460
471
  openIap.removeDeveloperProvidedBillingListener(handles.developerProvidedBilling)
461
472
  openIap.removeSubscriptionBillingIssueListener(handles.subscriptionBillingIssue)
473
+ openIap.removeConnectionStateListener(handles.connectionState)
462
474
  }
463
475
  }
@@ -159,13 +159,6 @@ class ExpoIapModule : Module() {
159
159
  ExpoIapLog.warning("Activity not available during initConnection")
160
160
  }
161
161
 
162
- // If already connected, short-circuit
163
- if (connectionReady.get()) {
164
- ExpoIapLog.result("initConnection", true)
165
- promise.resolve(true)
166
- return@withLock
167
- }
168
-
169
162
  // Attach listeners early to avoid races during init
170
163
  if (listenerHandles == null) {
171
164
  listenerHandles =
@@ -191,7 +184,11 @@ class ExpoIapModule : Module() {
191
184
  // Clear any buffered events from a failed init
192
185
  pendingEvents.clear()
193
186
  ExpoIapLog.failure("initConnection", IllegalStateException("Failed to initialize connection"))
194
- promise.reject(OpenIapError.InitConnection.CODE, "Failed to initialize connection", null)
187
+ promise.reject(
188
+ OpenIapError.InitConnection.CODE,
189
+ OpenIapError.InitConnection.message,
190
+ null,
191
+ )
195
192
  return@withLock
196
193
  }
197
194
 
package/build/index.d.ts CHANGED
@@ -429,7 +429,7 @@ export declare const verifyPurchaseWithProvider: MutationField<'verifyPurchaseWi
429
429
  export * from './useIAP';
430
430
  export { kitApi, KitApiError } from './kit-api';
431
431
  export type { KitApiOptions, KitClientPayloadCache, KitClientPayloadOptions, KitClientPayloadResponse, KitProduct, KitProductClientPayload, KitProductOffer, KitProductPlatform, KitProductsOptions, KitProductsResponse, KitSubscription, EntitlementsResponse, StatusResponse, } from './kit-api';
432
- export { ErrorCodeUtils, ErrorCodeMapping, createPurchaseError, createPurchaseErrorFromPlatform, } from './utils/errorMapping';
432
+ export { ErrorCodeUtils, ErrorCodeMapping, createPurchaseError, createPurchaseErrorFromPlatform, getUserFriendlyErrorMessage, isUserCancelledError, } from './utils/errorMapping';
433
433
  export type { PurchaseError as ExpoPurchaseError, PurchaseErrorProps, } from './utils/errorMapping';
434
434
  export { ExpoIapConsole } from './utils/debug';
435
435
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAGV,sCAAsC,EAEtC,aAAa,EAEb,OAAO,EACP,gBAAgB,EAEhB,QAAQ,EAER,8BAA8B,EAC9B,UAAU,EAOV,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIL,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAG9B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AAGvB,oBAAY,YAAY;IACtB,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,kBAAkB,yBAAyB;IAC3C,wBAAwB,gCAAgC;IACxD;;;OAGG;IACH,+BAA+B,uCAAuC;IACtE;;;;OAIG;IACH,wBAAwB,+BAA+B;CACxD;AAED,KAAK,oBAAoB,GAAG;IAC1B,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC;IACzC,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC5C,CAAC,YAAY,CAAC,kBAAkB,CAAC,EAC7B,OAAO,GACP,MAAM,GACN;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IACtC,CAAC,YAAY,CAAC,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IAClE,CAAC,YAAY,CAAC,+BAA+B,CAAC,EAAE,sCAAsC,CAAC;IACvF,CAAC,YAAY,CAAC,wBAAwB,CAAC,EAAE,QAAQ,CAAC;CACnD,CAAC;AAEF,KAAK,oBAAoB,CAAC,CAAC,SAAS,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B,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,aAAa,IAAI,iBAAiB,EAClC,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC"}
package/build/index.js CHANGED
@@ -1045,6 +1045,6 @@ export const verifyPurchaseWithProvider = async (options) => {
1045
1045
  };
1046
1046
  export * from './useIAP';
1047
1047
  export { kitApi, KitApiError } from './kit-api';
1048
- export { ErrorCodeUtils, ErrorCodeMapping, createPurchaseError, createPurchaseErrorFromPlatform, } from './utils/errorMapping';
1048
+ export { ErrorCodeUtils, ErrorCodeMapping, createPurchaseError, createPurchaseErrorFromPlatform, getUserFriendlyErrorMessage, isUserCancelledError, } from './utils/errorMapping';
1049
1049
  export { ExpoIapConsole } from './utils/debug';
1050
1050
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,EAAE,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,yBAAyB,EAAC,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAyBpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,sCA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AAM,IAAI,IAAI,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,EAAC,aAAa,EAAE,SAAS,EAAE,GAAG,MAAM,EAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5D,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE;YACN,GAAG,MAAM;YACT,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,aAAa,EAAC,CAAC;YACjD,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,SAAS,EAAC,CAAC;SAC1C;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAgB9C,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 {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule, {getNativeModule} from './ExpoIapModule';\nimport {isVegaOS} from './vega';\nimport {\n isProductIOS,\n deepLinkToSubscriptionsIOS,\n presentCodeRedemptionSheetIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n deepLinkToSubscriptionsAndroid,\n openRedeemOfferCodeAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\nimport {restorePurchasesIOSNative} from './utils/restorePurchases';\nimport {\n decodeAndroidPurchases,\n decodeApplePurchases,\n} from './utils/availablePurchases';\n\n// Types\nimport type {\n ActiveSubscription,\n DeepLinkOptions,\n DeveloperProvidedBillingDetailsAndroid,\n IapPlatform,\n MutationField,\n MutationRequestPurchaseArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n PurchaseUpdatedListenerOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {\n createPurchaseError,\n createPurchaseErrorFromNativeException,\n OPENIAP_ERROR_ENVELOPE_PREFIX,\n type PurchaseError,\n type PurchaseErrorProps,\n} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport * from './onside';\nexport * from './vega';\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 * Fired for External Payments (8.3.0+) and Billing Choice (9.1.0+)\n * developer billing flows. Nullable fields depend on the selected flow.\n */\n DeveloperProvidedBillingAndroid = 'developer-provided-billing-android',\n /**\n * Fired when a subscription enters a billing-issue state (cross-platform).\n * Unifies StoreKit 2 `Message.Reason.billingIssue` (iOS / Mac Catalyst 16.4+, visionOS 1.0+) and Play Billing 8.1+\n * `Purchase.isSuspended`. NOT fired on the Meta Horizon flavor.\n */\n SubscriptionBillingIssue = 'subscription-billing-issue',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]:\n | Product\n | string\n | {id?: string; productId?: string};\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n [OpenIapEvent.DeveloperProvidedBillingAndroid]: DeveloperProvidedBillingDetailsAndroid;\n [OpenIapEvent.SubscriptionBillingIssue]: Purchase;\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\ntype NativePurchaseUpdatedOptionsModule = {\n setPurchaseUpdatedListenerOptions?: (\n options?: PurchaseUpdatedListenerOptions | null,\n ) => Promise<void>;\n};\n\nconst isStorePlatform = (): boolean =>\n Platform.OS === 'ios' || Platform.OS === 'android';\n\nconst isStoreRuntime = (): boolean =>\n Platform.OS === 'ios' || isAndroidStoreRuntime();\n\nconst unsupportedPlatformError = (): Error =>\n new Error(`Unsupported platform: ${Platform.OS}`);\n\n// Use the raw native module for listener calls — JSI HostObjects require the\n// real native module as `this` when calling addListener. Using a Proxy as\n// `this` triggers \"native state unsupported on Proxy\" on New Architecture / Hermes.\n// Resolved lazily so importing this module doesn't throw on unsupported platforms.\nexport const emitter: ExpoIapEmitter = {\n addListener(eventName, listener) {\n const nativeModule = getNativeModule();\n const nativeSubscription = nativeModule.addListener(eventName, listener);\n let removed = false;\n\n return {\n remove: () => {\n if (removed) {\n return;\n }\n removed = true;\n\n if (typeof nativeSubscription?.remove === 'function') {\n nativeSubscription.remove();\n return;\n }\n\n nativeModule.removeListener?.(eventName, listener);\n },\n };\n },\n removeListener(eventName, listener) {\n return getNativeModule().removeListener?.(eventName, listener);\n },\n};\n\nlet nonDedupingPurchaseUpdatedListenerCountIOS = 0;\nconst purchaseUpdatedDedupeHistoryLimitIOS = 512;\nconst purchaseUpdatedDedupeHistoryIOS = {\n ids: new Set<string>(),\n order: [] as string[],\n start: 0,\n};\nlet purchaseUpdatedDedupeGenerationIOS = 0;\n\ntype PurchaseUpdatedDedupeHistoryIOS = {\n ids: Set<string>;\n order: string[];\n start: number;\n};\n\nconst purchaseUpdatedTransactionIdIOS = (purchase: Purchase) => {\n if (typeof purchase.id === 'string' && purchase.id.length > 0) {\n return purchase.id;\n }\n return null;\n};\n\nconst rememberPurchaseUpdatedTransactionIOS = (\n transactionId: string,\n history: PurchaseUpdatedDedupeHistoryIOS,\n) => {\n if (history.ids.has(transactionId)) {\n return;\n }\n\n history.ids.add(transactionId);\n history.order.push(transactionId);\n if (\n history.order.length - history.start >\n purchaseUpdatedDedupeHistoryLimitIOS\n ) {\n const evicted = history.order[history.start];\n history.start += 1;\n if (evicted != null) {\n history.ids.delete(evicted);\n }\n if (history.start > 128 && history.start * 2 > history.order.length) {\n history.order = history.order.slice(history.start);\n history.start = 0;\n }\n }\n};\n\nconst clearPurchaseUpdatedDedupeHistoryIOS = (\n history: PurchaseUpdatedDedupeHistoryIOS,\n) => {\n history.ids.clear();\n history.order.length = 0;\n history.start = 0;\n};\n\nconst resetPurchaseUpdatedDedupeHistoryIOS = () => {\n clearPurchaseUpdatedDedupeHistoryIOS(purchaseUpdatedDedupeHistoryIOS);\n purchaseUpdatedDedupeGenerationIOS += 1;\n};\n\nconst configurePurchaseUpdatedListenerOptionsIOS = (\n dedupeTransactionIOS: boolean,\n) => {\n if (Platform.OS !== 'ios') return;\n\n const nativeModule = getNativeModule() as NativePurchaseUpdatedOptionsModule;\n const promise = nativeModule.setPurchaseUpdatedListenerOptions?.({\n dedupeTransactionIOS,\n });\n void promise?.catch((error: unknown) => {\n ExpoIapConsole.warn(\n 'Failed to configure purchase updated listener options:',\n error,\n );\n });\n};\n\nexport type ProductTypeInput = ProductQueryType;\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (!type || 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 isAndroidStoreRuntime = (): boolean => {\n return Platform.OS === 'android' || isVegaOS();\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n options?: PurchaseUpdatedListenerOptions | null,\n) => {\n const receiveDuplicateTransactionUpdatesIOS =\n Platform.OS === 'ios' && options?.dedupeTransactionIOS === false;\n const listenerDedupeHistoryIOS: PurchaseUpdatedDedupeHistoryIOS = {\n ids: new Set(purchaseUpdatedDedupeHistoryIOS.ids),\n order: purchaseUpdatedDedupeHistoryIOS.order.slice(\n purchaseUpdatedDedupeHistoryIOS.start,\n ),\n start: 0,\n };\n let listenerDedupeGenerationIOS = purchaseUpdatedDedupeGenerationIOS;\n\n const wrappedListener = (event: Purchase) => {\n const normalized = event;\n if (Platform.OS === 'ios') {\n if (listenerDedupeGenerationIOS !== purchaseUpdatedDedupeGenerationIOS) {\n clearPurchaseUpdatedDedupeHistoryIOS(listenerDedupeHistoryIOS);\n listenerDedupeGenerationIOS = purchaseUpdatedDedupeGenerationIOS;\n }\n const transactionId = purchaseUpdatedTransactionIdIOS(normalized);\n if (transactionId != null) {\n const isDuplicateForListener =\n listenerDedupeHistoryIOS.ids.has(transactionId);\n rememberPurchaseUpdatedTransactionIOS(\n transactionId,\n listenerDedupeHistoryIOS,\n );\n rememberPurchaseUpdatedTransactionIOS(\n transactionId,\n purchaseUpdatedDedupeHistoryIOS,\n );\n if (!receiveDuplicateTransactionUpdatesIOS && isDuplicateForListener) {\n return;\n }\n }\n }\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n\n if (!receiveDuplicateTransactionUpdatesIOS) {\n return emitterSubscription;\n }\n\n nonDedupingPurchaseUpdatedListenerCountIOS += 1;\n configurePurchaseUpdatedListenerOptionsIOS(false);\n let removed = false;\n\n return {\n remove: () => {\n if (removed) {\n return;\n }\n removed = true;\n try {\n emitterSubscription?.remove?.();\n } finally {\n nonDedupingPurchaseUpdatedListenerCountIOS = Math.max(\n 0,\n nonDedupingPurchaseUpdatedListenerCountIOS - 1,\n );\n configurePurchaseUpdatedListenerOptionsIOS(\n nonDedupingPurchaseUpdatedListenerCountIOS === 0,\n );\n }\n },\n };\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\n let deliveredProductId: string | undefined;\n const deliver = (product: Product) => {\n const productId =\n product.id ?? (product as Product & {productId?: string}).productId;\n if (productId && productId === deliveredProductId) {\n return;\n }\n deliveredProductId = productId;\n listener(product);\n };\n\n const replayPendingProduct = () => {\n let pendingProduct: Promise<Product | null> | undefined;\n try {\n pendingProduct = ExpoIapModule.getPromotedProductIOS() as\n | Promise<Product | null>\n | undefined;\n } catch {\n return Promise.resolve();\n }\n\n if (!pendingProduct || typeof pendingProduct.then !== 'function') {\n return Promise.resolve();\n }\n\n return pendingProduct\n .then((product: Product | null) => {\n if (product) {\n deliver(product);\n }\n })\n .catch(() => {});\n };\n\n const subscription = emitter.addListener(\n OpenIapEvent.PromotedProductIOS,\n (payload) => {\n if (typeof payload === 'string') {\n void replayPendingProduct();\n return;\n }\n\n deliver(payload as Product);\n },\n );\n\n void replayPendingProduct();\n\n return subscription;\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('External transaction token received; send it to your backend without logging it.');\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\n/**\n * Android-only listener for Developer Provided Billing events.\n * This fires when a user selects the developer's option in an External Payments\n * or Billing Choice purchase flow.\n *\n * Requires Google Play Billing Library 8.3.0+; Billing Choice fields require 9.1.0+.\n *\n * @param listener - Callback that receives selected products and flow details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = developerProvidedBillingListenerAndroid(async (details) => {\n * await processPaymentWithYourGateway(details.products, details.linkUri);\n * if (details.externalTransactionToken) {\n * await reportExternalTransactionToGoogle(details.externalTransactionToken);\n * }\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android (8.3.0+; Billing Choice 9.1.0+)\n */\nexport const developerProvidedBillingListenerAndroid = (\n listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'developerProvidedBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(\n OpenIapEvent.DeveloperProvidedBillingAndroid,\n listener,\n );\n};\n\n/**\n * Listen for subscription billing-issue events (cross-platform).\n *\n * Fires when a user's active subscription enters a state that needs attention\n * for a payment problem. Unifies:\n * - iOS / Mac Catalyst 16.4+ and visionOS 1.0+: StoreKit 2 `Message.Reason.billingIssue`.\n * - Android (Play Billing 8.1+): when `Purchase.isSuspendedAndroid === true`.\n * - Meta Horizon / iOS 17 / older platforms: never fires.\n *\n * Recommended UX: call `deepLinkToSubscriptions()` when this fires so the user\n * can update their payment method in the platform subscription center.\n *\n * @example\n * ```typescript\n * const subscription = subscriptionBillingIssueListener((purchase) => {\n * console.warn('Needs attention:', purchase.productId);\n * deepLinkToSubscriptions({\n * skuAndroid: purchase.productId,\n * packageNameAndroid: 'com.example.app',\n * });\n * });\n * ```\n */\nexport const subscriptionBillingIssueListener = (\n listener: (purchase: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n listener(event);\n };\n return emitter.addListener(\n OpenIapEvent.SubscriptionBillingIssue,\n wrappedListener,\n );\n};\n\n/**\n * Initialize the store connection. Must be called before any other IAP API.\n *\n * @param config Optional connection config. Use `enableBillingProgramAndroid` (Android,\n * Play Billing 8.2.0+) to opt into a billing program. For Billing Choice 9.1.0+, set\n * `billingChoiceScreenTypeAndroid` to the renderer configured in Play Console.\n * iOS ignores Android-specific fields.\n * @returns Promise resolving to `true` when the platform billing client is connected.\n * @throws When the platform billing client fails to initialize.\n *\n * @example\n * ```ts\n * await initConnection();\n * await initConnection({ enableBillingProgramAndroid: 'external-offer' });\n * await initConnection({\n * enableBillingProgramAndroid: 'billing-choice',\n * billingChoiceScreenTypeAndroid: 'developer-rendered',\n * });\n * ```\n *\n * @remarks When using `useIAP()`, connection is auto-managed on mount/unmount —\n * pass options to the hook instead of calling this directly.\n *\n * @see {@link https://openiap.dev/docs/apis/init-connection}\n */\nexport const initConnection: MutationField<'initConnection'> = async (\n config,\n) => {\n const result = await ExpoIapModule.initConnection(config ?? null);\n if (\n result === true &&\n Platform.OS === 'ios' &&\n nonDedupingPurchaseUpdatedListenerCountIOS > 0\n ) {\n configurePurchaseUpdatedListenerOptionsIOS(false);\n }\n return result;\n};\n\n/**\n * Close the store connection and release resources.\n *\n * @see {@link https://openiap.dev/docs/apis/end-connection}\n */\nexport const endConnection: MutationField<'endConnection'> = async () => {\n const result = await ExpoIapModule.endConnection();\n if (result === true && Platform.OS === 'ios') {\n resetPurchaseUpdatedDedupeHistoryIOS();\n }\n return result;\n};\n\nconst invokeNativeWithPurchaseError = async <T>(\n operation: () => Promise<T>,\n platform: IapPlatform,\n fallback: PurchaseErrorProps,\n): Promise<T> => {\n try {\n return await operation();\n } catch (error) {\n const nativeError =\n typeof error === 'object' && error !== null\n ? (error as Record<string, unknown>)\n : undefined;\n const nativeMessage =\n typeof nativeError?.message === 'string'\n ? nativeError.message\n : typeof error === 'string'\n ? error\n : '';\n const hasCanonicalFields =\n nativeMessage.includes(OPENIAP_ERROR_ENVELOPE_PREFIX) ||\n nativeError?.code !== undefined ||\n nativeError?.responseCode !== undefined ||\n nativeError?.debugMessage !== undefined ||\n nativeError?.productId !== undefined ||\n nativeError?.productIds !== undefined;\n\n // Preserve the identity of unrelated JavaScript errors (including adapter\n // or test errors) while normalizing native OpenIAP rejections.\n if (!hasCanonicalFields) throw error;\n throw createPurchaseErrorFromNativeException(error, platform, fallback);\n }\n};\n\n/**\n * Retrieve products or subscriptions from the store by SKU.\n *\n * @param request `ProductRequest` — `skus` (string[]) and optional `type`\n * (`'in-app' | 'subs' | 'all'`, defaults to `'in-app'`).\n * @returns Promise resolving to a `FetchProductsResult` union — `Product[]` for `'in-app'`,\n * `ProductSubscription[]` for `'subs'`, or a mixed array for `'all'`.\n * @throws When the store rejects the request (empty `skus`, not connected,\n * network/store error). Unknown SKUs are simply omitted from the result, not thrown.\n *\n * @example\n * ```ts\n * const products = await fetchProducts({\n * skus: ['com.app.coins_100', 'com.app.premium'],\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks This is a regular promise-based call. Don't confuse with `request*` APIs\n * (`requestPurchase`), which are event-based.\n *\n * @see {@link https://openiap.dev/docs/apis/fetch-products}\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 invokeNativeWithPurchaseError<unknown[]>(\n () => ExpoIapModule.fetchProducts({skus, type: native}),\n 'ios',\n {\n code: ErrorCode.QueryProduct,\n message: 'Failed to query products',\n productIds: skus,\n productType: canonical,\n },\n );\n return castResult(filterIosItems(rawItems));\n }\n\n if (isAndroidStoreRuntime()) {\n const rawItems = await invokeNativeWithPurchaseError<unknown[]>(\n () => ExpoIapModule.fetchProducts(native, skus),\n 'android',\n {\n code: ErrorCode.QueryProduct,\n message: 'Failed to query products',\n productIds: skus,\n productType: canonical,\n },\n );\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw unsupportedPlatformError();\n};\n\n/**\n * List the user's unfinished purchases — non-consumables, active subscriptions, and any\n * pending transactions not yet finished.\n *\n * @param options Optional `PurchaseOptions`. iOS-only flags:\n * `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`.\n * @returns Promise resolving to an array of `Purchase` currently held by the store.\n * @throws When the platform query fails.\n *\n * @example\n * ```ts\n * const purchases = await getAvailablePurchases();\n * for (const p of purchases) {\n * if (await verifyOnServer(p)) await finishTransaction({ purchase: p, isConsumable: false });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/get-available-purchases}\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 includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n };\n\n if (isVegaOS()) {\n const purchases = await ExpoIapModule.getAvailableItems(normalizedOptions);\n return decodeAndroidPurchases(purchases);\n }\n\n let purchases: Purchase[];\n\n if (Platform.OS === 'ios') {\n purchases = (await ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n )) as Purchase[];\n } else if (Platform.OS === 'android') {\n purchases = (await ExpoIapModule.getAvailableItems(\n normalizedOptions,\n )) as Purchase[];\n } else {\n throw unsupportedPlatformError();\n }\n\n return Platform.OS === 'ios'\n ? decodeApplePurchases(purchases)\n : decodeAndroidPurchases(purchases);\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 *\n * @see {@link https://openiap.dev/docs/apis/get-active-subscriptions}\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\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 *\n * @see {@link https://openiap.dev/docs/apis/has-active-subscriptions}\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\n/**\n * Return the user's storefront country code.\n *\n * @see {@link https://openiap.dev/docs/apis/get-storefront}\n */\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && !isAndroidStoreRuntime()) {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: `Storefront lookup is not supported on ${Platform.OS}.`,\n });\n }\n\n const platform: IapPlatform = Platform.OS === 'ios' ? 'ios' : 'android';\n if (typeof ExpoIapModule.getStorefront !== 'function') {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: 'Native getStorefront is not available on this build.',\n platform,\n });\n }\n\n let storefront: unknown;\n try {\n storefront = await ExpoIapModule.getStorefront();\n } catch (error) {\n throw createPurchaseErrorFromNativeException(error, platform, {\n code: ErrorCode.ServiceError,\n message: 'Failed to get storefront.',\n debugMessage: error instanceof Error ? error.message : String(error),\n });\n }\n\n if (typeof storefront !== 'string' || storefront.trim().length === 0) {\n throw createPurchaseError({\n code: ErrorCode.ServiceError,\n message: 'Storefront lookup returned no country code.',\n platform,\n });\n }\n return storefront;\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 if (platform === 'ios') {\n return request.apple;\n }\n return request.google;\n}\n\nfunction validateAndroidPurchaseBranchOptions(\n request: unknown,\n type: ProductQueryType,\n): void {\n if (request == null || typeof request !== 'object') return;\n const fields = request as Record<string, unknown>;\n const subscriptionOnlyFields = [\n 'subscriptionOffers',\n 'subscriptionProductReplacementParams',\n 'purchaseToken',\n 'originalExternalTransactionId',\n ];\n if (\n (type === 'in-app' &&\n subscriptionOnlyFields.some((field) => fields[field] != null)) ||\n (type === 'subs' && fields.offerToken != null)\n ) {\n throw createPurchaseError({\n code: ErrorCode.DeveloperError,\n message:\n 'Invalid request for Android. Purchase options must match the selected product type.',\n });\n }\n}\n\n/**\n * Initiate a purchase or subscription flow. The result is delivered through\n * `purchaseUpdatedListener` — NOT the return value.\n *\n * @param args `RequestPurchaseProps`, discriminated by `type`:\n * - `type: 'in-app'` — pass `request.apple.sku` (iOS) and/or `request.google.skus` (Android).\n * - `type: 'subs'` — same shape, plus `request.google.subscriptionOffers: [{ sku, offerToken }]`.\n * @returns The dispatched purchase payload. **Do not rely on it** for the actual outcome.\n * @throws Synchronous rejection from the store (e.g. `E_NOT_PREPARED`, validation failure).\n *\n * @example\n * ```ts\n * await requestPurchase({\n * request: {\n * apple: { sku: 'com.app.premium' },\n * google: { skus: ['com.app.premium'] },\n * },\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks Event-based. Listen for the result via {@link purchaseUpdatedListener} /\n * {@link purchaseErrorListener}, or use `useIAP({ onPurchaseSuccess, onPurchaseError })`.\n *\n * @see {@link https://openiap.dev/docs/apis/request-purchase}\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n if (canonical === 'all') {\n throw createPurchaseError({\n code: ErrorCode.DeveloperError,\n message: 'Product type all is only supported for product queries.',\n });\n }\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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\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: {apple: normalizedRequest},\n };\n\n const purchase = (await invokeNativeWithPurchaseError(\n () => ExpoIapModule.requestPurchase(payload),\n 'ios',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: normalizedRequest.sku,\n productIds: [normalizedRequest.sku],\n productType: canonical,\n },\n )) as Purchase | Purchase[] | null;\n\n if (Array.isArray(purchase)) {\n return purchase;\n }\n\n if (purchase) {\n return purchase;\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (isAndroidStoreRuntime()) {\n validateAndroidPurchaseBranchOptions(\n (\n request as\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms\n )?.google,\n canonical,\n );\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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n offerToken,\n developerBillingOption,\n } = normalizedRequest;\n\n const result = (await invokeNativeWithPurchaseError(\n () =>\n ExpoIapModule.requestPurchase({\n type: native,\n skus,\n purchaseToken: undefined,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerToken: offerToken,\n developerBillingOption: developerBillingOption ?? undefined,\n isOfferPersonalized: isOfferPersonalized ?? false,\n }),\n 'android',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: skus[0],\n productIds: skus,\n productType: canonical,\n },\n )) as Purchase[];\n\n return 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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n subscriptionOffers,\n purchaseToken: purchaseTokenInput,\n originalExternalTransactionId,\n developerBillingOption,\n subscriptionProductReplacementParams,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const purchaseToken = purchaseTokenInput ?? undefined;\n\n const result = (await invokeNativeWithPurchaseError(\n () =>\n ExpoIapModule.requestPurchase({\n type: native,\n skus,\n purchaseToken,\n originalExternalTransactionId:\n originalExternalTransactionId ?? undefined,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n developerBillingOption: developerBillingOption ?? undefined,\n subscriptionProductReplacementParams:\n subscriptionProductReplacementParams ?? undefined,\n }),\n 'android',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: skus[0],\n productIds: skus,\n productType: canonical,\n },\n )) as Purchase[];\n\n return 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 unsupportedPlatformError();\n};\n\n/**\n * Complete a purchase transaction. Call after server-side verification to remove it\n * from the queue.\n *\n * @param args.purchase The `Purchase` to finalize.\n * @param args.isConsumable `true` for consumables (consumes the token so the SKU can be\n * re-bought, e.g. coins); `false` (default) for non-consumables and subscriptions.\n * @returns Promise that resolves once the platform finalizes the transaction.\n * @throws When the platform finalize call fails.\n *\n * @example\n * ```ts\n * // Inside purchaseUpdatedListener:\n * if (await verifyOnServer(purchase)) {\n * await finishTransaction({ purchase, isConsumable: false });\n * }\n * ```\n *\n * @remarks **Critical:** Android purchases must be finalized within 3 days or Google\n * auto-refunds. iOS unfinished transactions replay on every app launch.\n *\n * @see {@link https://openiap.dev/docs/apis/finish-transaction}\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 (isAndroidStoreRuntime()) {\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 unsupportedPlatformError();\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync, or Onside restore when OnsideKit is active,\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 *\n * @see {@link https://openiap.dev/docs/apis/restore-purchases}\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await restorePurchasesIOSNative();\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 *\n * @see {@link https://openiap.dev/docs/apis/deep-link-to-subscriptions}\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 unsupportedPlatformError();\n};\n\n/**\n * Open the platform's offer/promo code redemption flow.\n *\n * Resolves the redeemed purchase only when the store reports it synchronously;\n * every other path resolves null, so reconcile with `getAvailablePurchases`\n * when the app resumes.\n *\n * @returns Promise resolving to the redeemed purchase, or null\n * @throws Error when a redemption flow exists but cannot be opened\n *\n * @see {@link https://openiap.dev/docs/apis/open-redeem-offer-code}\n */\nexport const openRedeemOfferCode: MutationField<\n 'openRedeemOfferCode'\n> = async () => {\n if (Platform.OS === 'ios') {\n return presentCodeRedemptionSheetIOS();\n }\n\n if (isAndroidStoreRuntime()) {\n // Native returns Boolean; false also maps to null until the SDK adopts openiap-google 3.4.0.\n await openRedeemOfferCodeAndroid();\n return null;\n }\n\n throw unsupportedPlatformError();\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 *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase}\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (!isStorePlatform()) {\n throw unsupportedPlatformError();\n }\n\n return ExpoIapModule.verifyPurchase(options);\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 * // Choose exactly one store payload.\n * // apple: { jws: purchase.purchaseToken },\n * // google: { purchaseToken: purchase.purchaseToken },\n * amazon: {\n * expectedProductId: purchase.productId,\n * userId: amazonUserId,\n * receiptId: purchase.purchaseToken,\n * // Enable only for App Tester after the IAPKit project opt-in.\n * sandbox: amazonSandboxEnabled,\n * }\n * }\n * });\n * ```\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase-with-provider}\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\n let resolvedOptions = options;\n\n if (\n resolvedOptions.provider === 'iapkit' &&\n resolvedOptions.iapkit &&\n !resolvedOptions.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 (typeof configApiKey === 'string' && configApiKey.length > 0) {\n resolvedOptions = {\n ...resolvedOptions,\n iapkit: {\n ...resolvedOptions.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\n const result = await ExpoIapModule.verifyPurchaseWithProvider(\n resolvedOptions,\n );\n if (result.iapkit == null) {\n return result;\n }\n\n const {clientPayload, productId, ...iapkit} = result.iapkit;\n return {\n ...result,\n iapkit: {\n ...iapkit,\n ...(clientPayload == null ? {} : {clientPayload}),\n ...(productId == null ? {} : {productId}),\n },\n };\n};\n\nexport * from './useIAP';\nexport {kitApi, KitApiError} from './kit-api';\nexport type {\n KitApiOptions,\n KitClientPayloadCache,\n KitClientPayloadOptions,\n KitClientPayloadResponse,\n KitProduct,\n KitProductClientPayload,\n KitProductOffer,\n KitProductPlatform,\n KitProductsOptions,\n KitProductsResponse,\n KitSubscription,\n EntitlementsResponse,\n StatusResponse,\n} from './kit-api';\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,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,mBAAmB;AACnB,OAAO,aAAa,EAAE,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,8BAA8B,EAC9B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,yBAAyB,EAAC,MAAM,0BAA0B,CAAC;AACnE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;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AM,GAAG,MAAM,aAAa,CAAC,0BAA0B,CAC3D,eAAe,CAChB,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,EAAC,aAAa,EAAE,SAAS,EAAE,GAAG,MAAM,EAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5D,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE;YACN,GAAG,MAAM;YACT,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,aAAa,EAAC,CAAC;YACjD,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,SAAS,EAAC,CAAC;SAC1C;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,UAAU,CAAC;AACzB,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAgB9C,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC","sourcesContent":["// External dependencies\nimport {Platform} from 'react-native';\n\n// Internal modules\nimport ExpoIapModule, {getNativeModule} from './ExpoIapModule';\nimport {isVegaOS} from './vega';\nimport {\n isProductIOS,\n deepLinkToSubscriptionsIOS,\n presentCodeRedemptionSheetIOS,\n} from './modules/ios';\nimport {\n isProductAndroid,\n deepLinkToSubscriptionsAndroid,\n openRedeemOfferCodeAndroid,\n} from './modules/android';\nimport {ExpoIapConsole} from './utils/debug';\nimport {restorePurchasesIOSNative} from './utils/restorePurchases';\nimport {\n decodeAndroidPurchases,\n decodeApplePurchases,\n} from './utils/availablePurchases';\n\n// Types\nimport type {\n ActiveSubscription,\n DeepLinkOptions,\n DeveloperProvidedBillingDetailsAndroid,\n IapPlatform,\n MutationField,\n MutationRequestPurchaseArgs,\n Product,\n ProductQueryType,\n ProductSubscription,\n Purchase,\n PurchaseOptions,\n PurchaseUpdatedListenerOptions,\n QueryField,\n RequestPurchasePropsByPlatforms,\n RequestPurchaseAndroidProps,\n RequestPurchaseIosProps,\n RequestSubscriptionPropsByPlatforms,\n RequestSubscriptionAndroidProps,\n RequestSubscriptionIosProps,\n UserChoiceBillingDetails,\n} from './types';\nimport {ErrorCode} from './types';\nimport {\n createPurchaseError,\n createPurchaseErrorFromNativeException,\n OPENIAP_ERROR_ENVELOPE_PREFIX,\n type PurchaseError,\n type PurchaseErrorProps,\n} from './utils/errorMapping';\n\n// Export all types\nexport * from './types';\nexport * from './modules/android';\nexport * from './modules/ios';\nexport * from './onside';\nexport * from './vega';\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 * Fired for External Payments (8.3.0+) and Billing Choice (9.1.0+)\n * developer billing flows. Nullable fields depend on the selected flow.\n */\n DeveloperProvidedBillingAndroid = 'developer-provided-billing-android',\n /**\n * Fired when a subscription enters a billing-issue state (cross-platform).\n * Unifies StoreKit 2 `Message.Reason.billingIssue` (iOS / Mac Catalyst 16.4+, visionOS 1.0+) and Play Billing 8.1+\n * `Purchase.isSuspended`. NOT fired on the Meta Horizon flavor.\n */\n SubscriptionBillingIssue = 'subscription-billing-issue',\n}\n\ntype ExpoIapEventPayloads = {\n [OpenIapEvent.PurchaseUpdated]: Purchase;\n [OpenIapEvent.PurchaseError]: PurchaseError;\n [OpenIapEvent.PromotedProductIOS]:\n | Product\n | string\n | {id?: string; productId?: string};\n [OpenIapEvent.UserChoiceBillingAndroid]: UserChoiceBillingDetails;\n [OpenIapEvent.DeveloperProvidedBillingAndroid]: DeveloperProvidedBillingDetailsAndroid;\n [OpenIapEvent.SubscriptionBillingIssue]: Purchase;\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\ntype NativePurchaseUpdatedOptionsModule = {\n setPurchaseUpdatedListenerOptions?: (\n options?: PurchaseUpdatedListenerOptions | null,\n ) => Promise<void>;\n};\n\nconst isStorePlatform = (): boolean =>\n Platform.OS === 'ios' || Platform.OS === 'android';\n\nconst isStoreRuntime = (): boolean =>\n Platform.OS === 'ios' || isAndroidStoreRuntime();\n\nconst unsupportedPlatformError = (): Error =>\n new Error(`Unsupported platform: ${Platform.OS}`);\n\n// Use the raw native module for listener calls — JSI HostObjects require the\n// real native module as `this` when calling addListener. Using a Proxy as\n// `this` triggers \"native state unsupported on Proxy\" on New Architecture / Hermes.\n// Resolved lazily so importing this module doesn't throw on unsupported platforms.\nexport const emitter: ExpoIapEmitter = {\n addListener(eventName, listener) {\n const nativeModule = getNativeModule();\n const nativeSubscription = nativeModule.addListener(eventName, listener);\n let removed = false;\n\n return {\n remove: () => {\n if (removed) {\n return;\n }\n removed = true;\n\n if (typeof nativeSubscription?.remove === 'function') {\n nativeSubscription.remove();\n return;\n }\n\n nativeModule.removeListener?.(eventName, listener);\n },\n };\n },\n removeListener(eventName, listener) {\n return getNativeModule().removeListener?.(eventName, listener);\n },\n};\n\nlet nonDedupingPurchaseUpdatedListenerCountIOS = 0;\nconst purchaseUpdatedDedupeHistoryLimitIOS = 512;\nconst purchaseUpdatedDedupeHistoryIOS = {\n ids: new Set<string>(),\n order: [] as string[],\n start: 0,\n};\nlet purchaseUpdatedDedupeGenerationIOS = 0;\n\ntype PurchaseUpdatedDedupeHistoryIOS = {\n ids: Set<string>;\n order: string[];\n start: number;\n};\n\nconst purchaseUpdatedTransactionIdIOS = (purchase: Purchase) => {\n if (typeof purchase.id === 'string' && purchase.id.length > 0) {\n return purchase.id;\n }\n return null;\n};\n\nconst rememberPurchaseUpdatedTransactionIOS = (\n transactionId: string,\n history: PurchaseUpdatedDedupeHistoryIOS,\n) => {\n if (history.ids.has(transactionId)) {\n return;\n }\n\n history.ids.add(transactionId);\n history.order.push(transactionId);\n if (\n history.order.length - history.start >\n purchaseUpdatedDedupeHistoryLimitIOS\n ) {\n const evicted = history.order[history.start];\n history.start += 1;\n if (evicted != null) {\n history.ids.delete(evicted);\n }\n if (history.start > 128 && history.start * 2 > history.order.length) {\n history.order = history.order.slice(history.start);\n history.start = 0;\n }\n }\n};\n\nconst clearPurchaseUpdatedDedupeHistoryIOS = (\n history: PurchaseUpdatedDedupeHistoryIOS,\n) => {\n history.ids.clear();\n history.order.length = 0;\n history.start = 0;\n};\n\nconst resetPurchaseUpdatedDedupeHistoryIOS = () => {\n clearPurchaseUpdatedDedupeHistoryIOS(purchaseUpdatedDedupeHistoryIOS);\n purchaseUpdatedDedupeGenerationIOS += 1;\n};\n\nconst configurePurchaseUpdatedListenerOptionsIOS = (\n dedupeTransactionIOS: boolean,\n) => {\n if (Platform.OS !== 'ios') return;\n\n const nativeModule = getNativeModule() as NativePurchaseUpdatedOptionsModule;\n const promise = nativeModule.setPurchaseUpdatedListenerOptions?.({\n dedupeTransactionIOS,\n });\n void promise?.catch((error: unknown) => {\n ExpoIapConsole.warn(\n 'Failed to configure purchase updated listener options:',\n error,\n );\n });\n};\n\nexport type ProductTypeInput = ProductQueryType;\n\nconst normalizeProductType = (type?: ProductTypeInput) => {\n if (!type || 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 isAndroidStoreRuntime = (): boolean => {\n return Platform.OS === 'android' || isVegaOS();\n};\n\nexport const purchaseUpdatedListener = (\n listener: (event: Purchase) => void,\n options?: PurchaseUpdatedListenerOptions | null,\n) => {\n const receiveDuplicateTransactionUpdatesIOS =\n Platform.OS === 'ios' && options?.dedupeTransactionIOS === false;\n const listenerDedupeHistoryIOS: PurchaseUpdatedDedupeHistoryIOS = {\n ids: new Set(purchaseUpdatedDedupeHistoryIOS.ids),\n order: purchaseUpdatedDedupeHistoryIOS.order.slice(\n purchaseUpdatedDedupeHistoryIOS.start,\n ),\n start: 0,\n };\n let listenerDedupeGenerationIOS = purchaseUpdatedDedupeGenerationIOS;\n\n const wrappedListener = (event: Purchase) => {\n const normalized = event;\n if (Platform.OS === 'ios') {\n if (listenerDedupeGenerationIOS !== purchaseUpdatedDedupeGenerationIOS) {\n clearPurchaseUpdatedDedupeHistoryIOS(listenerDedupeHistoryIOS);\n listenerDedupeGenerationIOS = purchaseUpdatedDedupeGenerationIOS;\n }\n const transactionId = purchaseUpdatedTransactionIdIOS(normalized);\n if (transactionId != null) {\n const isDuplicateForListener =\n listenerDedupeHistoryIOS.ids.has(transactionId);\n rememberPurchaseUpdatedTransactionIOS(\n transactionId,\n listenerDedupeHistoryIOS,\n );\n rememberPurchaseUpdatedTransactionIOS(\n transactionId,\n purchaseUpdatedDedupeHistoryIOS,\n );\n if (!receiveDuplicateTransactionUpdatesIOS && isDuplicateForListener) {\n return;\n }\n }\n }\n listener(normalized);\n };\n const emitterSubscription = emitter.addListener(\n OpenIapEvent.PurchaseUpdated,\n wrappedListener,\n );\n\n if (!receiveDuplicateTransactionUpdatesIOS) {\n return emitterSubscription;\n }\n\n nonDedupingPurchaseUpdatedListenerCountIOS += 1;\n configurePurchaseUpdatedListenerOptionsIOS(false);\n let removed = false;\n\n return {\n remove: () => {\n if (removed) {\n return;\n }\n removed = true;\n try {\n emitterSubscription?.remove?.();\n } finally {\n nonDedupingPurchaseUpdatedListenerCountIOS = Math.max(\n 0,\n nonDedupingPurchaseUpdatedListenerCountIOS - 1,\n );\n configurePurchaseUpdatedListenerOptionsIOS(\n nonDedupingPurchaseUpdatedListenerCountIOS === 0,\n );\n }\n },\n };\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\n let deliveredProductId: string | undefined;\n const deliver = (product: Product) => {\n const productId =\n product.id ?? (product as Product & {productId?: string}).productId;\n if (productId && productId === deliveredProductId) {\n return;\n }\n deliveredProductId = productId;\n listener(product);\n };\n\n const replayPendingProduct = () => {\n let pendingProduct: Promise<Product | null> | undefined;\n try {\n pendingProduct = ExpoIapModule.getPromotedProductIOS() as\n | Promise<Product | null>\n | undefined;\n } catch {\n return Promise.resolve();\n }\n\n if (!pendingProduct || typeof pendingProduct.then !== 'function') {\n return Promise.resolve();\n }\n\n return pendingProduct\n .then((product: Product | null) => {\n if (product) {\n deliver(product);\n }\n })\n .catch(() => {});\n };\n\n const subscription = emitter.addListener(\n OpenIapEvent.PromotedProductIOS,\n (payload) => {\n if (typeof payload === 'string') {\n void replayPendingProduct();\n return;\n }\n\n deliver(payload as Product);\n },\n );\n\n void replayPendingProduct();\n\n return subscription;\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('External transaction token received; send it to your backend without logging it.');\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\n/**\n * Android-only listener for Developer Provided Billing events.\n * This fires when a user selects the developer's option in an External Payments\n * or Billing Choice purchase flow.\n *\n * Requires Google Play Billing Library 8.3.0+; Billing Choice fields require 9.1.0+.\n *\n * @param listener - Callback that receives selected products and flow details\n * @returns EventSubscription that can be used to unsubscribe\n *\n * @example\n * ```typescript\n * const subscription = developerProvidedBillingListenerAndroid(async (details) => {\n * await processPaymentWithYourGateway(details.products, details.linkUri);\n * if (details.externalTransactionToken) {\n * await reportExternalTransactionToGoogle(details.externalTransactionToken);\n * }\n * });\n *\n * // Later, clean up\n * subscription.remove();\n * ```\n *\n * @platform Android (8.3.0+; Billing Choice 9.1.0+)\n */\nexport const developerProvidedBillingListenerAndroid = (\n listener: (details: DeveloperProvidedBillingDetailsAndroid) => void,\n) => {\n if (Platform.OS !== 'android') {\n ExpoIapConsole.warn(\n 'developerProvidedBillingListenerAndroid: This listener is only available on Android',\n );\n return {remove: () => {}};\n }\n return emitter.addListener(\n OpenIapEvent.DeveloperProvidedBillingAndroid,\n listener,\n );\n};\n\n/**\n * Listen for subscription billing-issue events (cross-platform).\n *\n * Fires when a user's active subscription enters a state that needs attention\n * for a payment problem. Unifies:\n * - iOS / Mac Catalyst 16.4+ and visionOS 1.0+: StoreKit 2 `Message.Reason.billingIssue`.\n * - Android (Play Billing 8.1+): when `Purchase.isSuspendedAndroid === true`.\n * - Meta Horizon / iOS 17 / older platforms: never fires.\n *\n * Recommended UX: call `deepLinkToSubscriptions()` when this fires so the user\n * can update their payment method in the platform subscription center.\n *\n * @example\n * ```typescript\n * const subscription = subscriptionBillingIssueListener((purchase) => {\n * console.warn('Needs attention:', purchase.productId);\n * deepLinkToSubscriptions({\n * skuAndroid: purchase.productId,\n * packageNameAndroid: 'com.example.app',\n * });\n * });\n * ```\n */\nexport const subscriptionBillingIssueListener = (\n listener: (purchase: Purchase) => void,\n) => {\n const wrappedListener = (event: Purchase) => {\n listener(event);\n };\n return emitter.addListener(\n OpenIapEvent.SubscriptionBillingIssue,\n wrappedListener,\n );\n};\n\n/**\n * Initialize the store connection. Must be called before any other IAP API.\n *\n * @param config Optional connection config. Use `enableBillingProgramAndroid` (Android,\n * Play Billing 8.2.0+) to opt into a billing program. For Billing Choice 9.1.0+, set\n * `billingChoiceScreenTypeAndroid` to the renderer configured in Play Console.\n * iOS ignores Android-specific fields.\n * @returns Promise resolving to `true` when the platform billing client is connected.\n * @throws When the platform billing client fails to initialize.\n *\n * @example\n * ```ts\n * await initConnection();\n * await initConnection({ enableBillingProgramAndroid: 'external-offer' });\n * await initConnection({\n * enableBillingProgramAndroid: 'billing-choice',\n * billingChoiceScreenTypeAndroid: 'developer-rendered',\n * });\n * ```\n *\n * @remarks When using `useIAP()`, connection is auto-managed on mount/unmount —\n * pass options to the hook instead of calling this directly.\n *\n * @see {@link https://openiap.dev/docs/apis/init-connection}\n */\nexport const initConnection: MutationField<'initConnection'> = async (\n config,\n) => {\n const result = await ExpoIapModule.initConnection(config ?? null);\n if (\n result === true &&\n Platform.OS === 'ios' &&\n nonDedupingPurchaseUpdatedListenerCountIOS > 0\n ) {\n configurePurchaseUpdatedListenerOptionsIOS(false);\n }\n return result;\n};\n\n/**\n * Close the store connection and release resources.\n *\n * @see {@link https://openiap.dev/docs/apis/end-connection}\n */\nexport const endConnection: MutationField<'endConnection'> = async () => {\n const result = await ExpoIapModule.endConnection();\n if (result === true && Platform.OS === 'ios') {\n resetPurchaseUpdatedDedupeHistoryIOS();\n }\n return result;\n};\n\nconst invokeNativeWithPurchaseError = async <T>(\n operation: () => Promise<T>,\n platform: IapPlatform,\n fallback: PurchaseErrorProps,\n): Promise<T> => {\n try {\n return await operation();\n } catch (error) {\n const nativeError =\n typeof error === 'object' && error !== null\n ? (error as Record<string, unknown>)\n : undefined;\n const nativeMessage =\n typeof nativeError?.message === 'string'\n ? nativeError.message\n : typeof error === 'string'\n ? error\n : '';\n const hasCanonicalFields =\n nativeMessage.includes(OPENIAP_ERROR_ENVELOPE_PREFIX) ||\n nativeError?.code !== undefined ||\n nativeError?.responseCode !== undefined ||\n nativeError?.debugMessage !== undefined ||\n nativeError?.productId !== undefined ||\n nativeError?.productIds !== undefined;\n\n // Preserve the identity of unrelated JavaScript errors (including adapter\n // or test errors) while normalizing native OpenIAP rejections.\n if (!hasCanonicalFields) throw error;\n throw createPurchaseErrorFromNativeException(error, platform, fallback);\n }\n};\n\n/**\n * Retrieve products or subscriptions from the store by SKU.\n *\n * @param request `ProductRequest` — `skus` (string[]) and optional `type`\n * (`'in-app' | 'subs' | 'all'`, defaults to `'in-app'`).\n * @returns Promise resolving to a `FetchProductsResult` union — `Product[]` for `'in-app'`,\n * `ProductSubscription[]` for `'subs'`, or a mixed array for `'all'`.\n * @throws When the store rejects the request (empty `skus`, not connected,\n * network/store error). Unknown SKUs are simply omitted from the result, not thrown.\n *\n * @example\n * ```ts\n * const products = await fetchProducts({\n * skus: ['com.app.coins_100', 'com.app.premium'],\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks This is a regular promise-based call. Don't confuse with `request*` APIs\n * (`requestPurchase`), which are event-based.\n *\n * @see {@link https://openiap.dev/docs/apis/fetch-products}\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 invokeNativeWithPurchaseError<unknown[]>(\n () => ExpoIapModule.fetchProducts({skus, type: native}),\n 'ios',\n {\n code: ErrorCode.QueryProduct,\n message: 'Failed to query products',\n productIds: skus,\n productType: canonical,\n },\n );\n return castResult(filterIosItems(rawItems));\n }\n\n if (isAndroidStoreRuntime()) {\n const rawItems = await invokeNativeWithPurchaseError<unknown[]>(\n () => ExpoIapModule.fetchProducts(native, skus),\n 'android',\n {\n code: ErrorCode.QueryProduct,\n message: 'Failed to query products',\n productIds: skus,\n productType: canonical,\n },\n );\n return castResult(filterAndroidItems(rawItems));\n }\n\n throw unsupportedPlatformError();\n};\n\n/**\n * List the user's unfinished purchases — non-consumables, active subscriptions, and any\n * pending transactions not yet finished.\n *\n * @param options Optional `PurchaseOptions`. iOS-only flags:\n * `alsoPublishToEventListenerIOS`, `onlyIncludeActiveItemsIOS`.\n * @returns Promise resolving to an array of `Purchase` currently held by the store.\n * @throws When the platform query fails.\n *\n * @example\n * ```ts\n * const purchases = await getAvailablePurchases();\n * for (const p of purchases) {\n * if (await verifyOnServer(p)) await finishTransaction({ purchase: p, isConsumable: false });\n * }\n * ```\n *\n * @see {@link https://openiap.dev/docs/apis/get-available-purchases}\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 includeSuspendedAndroid: options?.includeSuspendedAndroid ?? false,\n };\n\n if (isVegaOS()) {\n const purchases = await ExpoIapModule.getAvailableItems(normalizedOptions);\n return decodeAndroidPurchases(purchases);\n }\n\n let purchases: Purchase[];\n\n if (Platform.OS === 'ios') {\n purchases = (await ExpoIapModule.getAvailableItems(\n normalizedOptions.alsoPublishToEventListenerIOS,\n normalizedOptions.onlyIncludeActiveItemsIOS,\n )) as Purchase[];\n } else if (Platform.OS === 'android') {\n purchases = (await ExpoIapModule.getAvailableItems(\n normalizedOptions,\n )) as Purchase[];\n } else {\n throw unsupportedPlatformError();\n }\n\n return Platform.OS === 'ios'\n ? decodeApplePurchases(purchases)\n : decodeAndroidPurchases(purchases);\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 *\n * @see {@link https://openiap.dev/docs/apis/get-active-subscriptions}\n */\nexport const getActiveSubscriptions: QueryField<\n 'getActiveSubscriptions'\n> = async (subscriptionIds) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\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 *\n * @see {@link https://openiap.dev/docs/apis/has-active-subscriptions}\n */\nexport const hasActiveSubscriptions: QueryField<\n 'hasActiveSubscriptions'\n> = async (subscriptionIds) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\n return !!(await ExpoIapModule.hasActiveSubscriptions(\n subscriptionIds ?? null,\n ));\n};\n\n/**\n * Return the user's storefront country code.\n *\n * @see {@link https://openiap.dev/docs/apis/get-storefront}\n */\nexport const getStorefront: QueryField<'getStorefront'> = async () => {\n if (Platform.OS !== 'ios' && !isAndroidStoreRuntime()) {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: `Storefront lookup is not supported on ${Platform.OS}.`,\n });\n }\n\n const platform: IapPlatform = Platform.OS === 'ios' ? 'ios' : 'android';\n if (typeof ExpoIapModule.getStorefront !== 'function') {\n throw createPurchaseError({\n code: ErrorCode.FeatureNotSupported,\n message: 'Native getStorefront is not available on this build.',\n platform,\n });\n }\n\n let storefront: unknown;\n try {\n storefront = await ExpoIapModule.getStorefront();\n } catch (error) {\n throw createPurchaseErrorFromNativeException(error, platform, {\n code: ErrorCode.ServiceError,\n message: 'Failed to get storefront.',\n debugMessage: error instanceof Error ? error.message : String(error),\n });\n }\n\n if (typeof storefront !== 'string' || storefront.trim().length === 0) {\n throw createPurchaseError({\n code: ErrorCode.ServiceError,\n message: 'Storefront lookup returned no country code.',\n platform,\n });\n }\n return storefront;\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 if (platform === 'ios') {\n return request.apple;\n }\n return request.google;\n}\n\nfunction validateAndroidPurchaseBranchOptions(\n request: unknown,\n type: ProductQueryType,\n): void {\n if (request == null || typeof request !== 'object') return;\n const fields = request as Record<string, unknown>;\n const subscriptionOnlyFields = [\n 'subscriptionOffers',\n 'subscriptionProductReplacementParams',\n 'purchaseToken',\n 'originalExternalTransactionId',\n ];\n if (\n (type === 'in-app' &&\n subscriptionOnlyFields.some((field) => fields[field] != null)) ||\n (type === 'subs' && fields.offerToken != null)\n ) {\n throw createPurchaseError({\n code: ErrorCode.DeveloperError,\n message:\n 'Invalid request for Android. Purchase options must match the selected product type.',\n });\n }\n}\n\n/**\n * Initiate a purchase or subscription flow. The result is delivered through\n * `purchaseUpdatedListener` — NOT the return value.\n *\n * @param args `RequestPurchaseProps`, discriminated by `type`:\n * - `type: 'in-app'` — pass `request.apple.sku` (iOS) and/or `request.google.skus` (Android).\n * - `type: 'subs'` — same shape, plus `request.google.subscriptionOffers: [{ sku, offerToken }]`.\n * @returns The dispatched purchase payload. **Do not rely on it** for the actual outcome.\n * @throws Synchronous rejection from the store (e.g. `E_NOT_PREPARED`, validation failure).\n *\n * @example\n * ```ts\n * await requestPurchase({\n * request: {\n * apple: { sku: 'com.app.premium' },\n * google: { skus: ['com.app.premium'] },\n * },\n * type: 'in-app',\n * });\n * ```\n *\n * @remarks Event-based. Listen for the result via {@link purchaseUpdatedListener} /\n * {@link purchaseErrorListener}, or use `useIAP({ onPurchaseSuccess, onPurchaseError })`.\n *\n * @see {@link https://openiap.dev/docs/apis/request-purchase}\n */\nexport const requestPurchase: MutationField<'requestPurchase'> = async (\n args,\n) => {\n const {request, type} = args;\n const {canonical, native} = normalizeProductType(type as ProductTypeInput);\n if (canonical === 'all') {\n throw createPurchaseError({\n code: ErrorCode.DeveloperError,\n message: 'Product type all is only supported for product queries.',\n });\n }\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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\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: {apple: normalizedRequest},\n };\n\n const purchase = (await invokeNativeWithPurchaseError(\n () => ExpoIapModule.requestPurchase(payload),\n 'ios',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: normalizedRequest.sku,\n productIds: [normalizedRequest.sku],\n productType: canonical,\n },\n )) as Purchase | Purchase[] | null;\n\n if (Array.isArray(purchase)) {\n return purchase;\n }\n\n if (purchase) {\n return purchase;\n }\n\n return canonical === 'subs' ? [] : null;\n }\n\n if (isAndroidStoreRuntime()) {\n validateAndroidPurchaseBranchOptions(\n (\n request as\n | RequestPurchasePropsByPlatforms\n | RequestSubscriptionPropsByPlatforms\n )?.google,\n canonical,\n );\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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n offerToken,\n developerBillingOption,\n } = normalizedRequest;\n\n const result = (await invokeNativeWithPurchaseError(\n () =>\n ExpoIapModule.requestPurchase({\n type: native,\n skus,\n purchaseToken: undefined,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n offerToken: offerToken,\n developerBillingOption: developerBillingOption ?? undefined,\n isOfferPersonalized: isOfferPersonalized ?? false,\n }),\n 'android',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: skus[0],\n productIds: skus,\n productType: canonical,\n },\n )) as Purchase[];\n\n return 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 createPurchaseError({\n message:\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://openiap.dev/docs/apis/request-purchase',\n code: ErrorCode.EmptySkuList,\n });\n }\n\n const {\n skus,\n obfuscatedAccountId,\n obfuscatedProfileId,\n isOfferPersonalized,\n subscriptionOffers,\n purchaseToken: purchaseTokenInput,\n originalExternalTransactionId,\n developerBillingOption,\n subscriptionProductReplacementParams,\n } = normalizedRequest;\n\n const normalizedOffers = subscriptionOffers ?? [];\n const purchaseToken = purchaseTokenInput ?? undefined;\n\n const result = (await invokeNativeWithPurchaseError(\n () =>\n ExpoIapModule.requestPurchase({\n type: native,\n skus,\n purchaseToken,\n originalExternalTransactionId:\n originalExternalTransactionId ?? undefined,\n obfuscatedAccountId: obfuscatedAccountId,\n obfuscatedProfileId: obfuscatedProfileId,\n subscriptionOffers: normalizedOffers,\n isOfferPersonalized: isOfferPersonalized ?? false,\n developerBillingOption: developerBillingOption ?? undefined,\n subscriptionProductReplacementParams:\n subscriptionProductReplacementParams ?? undefined,\n }),\n 'android',\n {\n code: ErrorCode.PurchaseError,\n message: 'Failed to request purchase',\n productId: skus[0],\n productIds: skus,\n productType: canonical,\n },\n )) as Purchase[];\n\n return 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 unsupportedPlatformError();\n};\n\n/**\n * Complete a purchase transaction. Call after server-side verification to remove it\n * from the queue.\n *\n * @param args.purchase The `Purchase` to finalize.\n * @param args.isConsumable `true` for consumables (consumes the token so the SKU can be\n * re-bought, e.g. coins); `false` (default) for non-consumables and subscriptions.\n * @returns Promise that resolves once the platform finalizes the transaction.\n * @throws When the platform finalize call fails.\n *\n * @example\n * ```ts\n * // Inside purchaseUpdatedListener:\n * if (await verifyOnServer(purchase)) {\n * await finishTransaction({ purchase, isConsumable: false });\n * }\n * ```\n *\n * @remarks **Critical:** Android purchases must be finalized within 3 days or Google\n * auto-refunds. iOS unfinished transactions replay on every app launch.\n *\n * @see {@link https://openiap.dev/docs/apis/finish-transaction}\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 (isAndroidStoreRuntime()) {\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 unsupportedPlatformError();\n};\n\n/**\n * Restore completed transactions (cross-platform behavior)\n *\n * - iOS: perform a lightweight sync, or Onside restore when OnsideKit is active,\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 *\n * @see {@link https://openiap.dev/docs/apis/restore-purchases}\n */\nexport const restorePurchases: MutationField<'restorePurchases'> = async () => {\n if (Platform.OS === 'ios') {\n await restorePurchasesIOSNative();\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 *\n * @see {@link https://openiap.dev/docs/apis/deep-link-to-subscriptions}\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 unsupportedPlatformError();\n};\n\n/**\n * Open the platform's offer/promo code redemption flow.\n *\n * Resolves the redeemed purchase only when the store reports it synchronously;\n * every other path resolves null, so reconcile with `getAvailablePurchases`\n * when the app resumes.\n *\n * @returns Promise resolving to the redeemed purchase, or null\n * @throws Error when a redemption flow exists but cannot be opened\n *\n * @see {@link https://openiap.dev/docs/apis/open-redeem-offer-code}\n */\nexport const openRedeemOfferCode: MutationField<\n 'openRedeemOfferCode'\n> = async () => {\n if (Platform.OS === 'ios') {\n return presentCodeRedemptionSheetIOS();\n }\n\n if (isAndroidStoreRuntime()) {\n // Native returns Boolean; false also maps to null until the SDK adopts openiap-google 3.4.0.\n await openRedeemOfferCodeAndroid();\n return null;\n }\n\n throw unsupportedPlatformError();\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 *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase}\n */\nexport const verifyPurchase: MutationField<'verifyPurchase'> = async (\n options,\n) => {\n if (!isStorePlatform()) {\n throw unsupportedPlatformError();\n }\n\n return ExpoIapModule.verifyPurchase(options);\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 * // Choose exactly one store payload.\n * // apple: { jws: purchase.purchaseToken },\n * // google: { purchaseToken: purchase.purchaseToken },\n * amazon: {\n * expectedProductId: purchase.productId,\n * userId: amazonUserId,\n * receiptId: purchase.purchaseToken,\n * // Enable only for App Tester after the IAPKit project opt-in.\n * sandbox: amazonSandboxEnabled,\n * }\n * }\n * });\n * ```\n *\n * @see {@link https://openiap.dev/docs/features/validation#verify-purchase-with-provider}\n */\nexport const verifyPurchaseWithProvider: MutationField<\n 'verifyPurchaseWithProvider'\n> = async (options) => {\n if (!isStoreRuntime()) {\n throw unsupportedPlatformError();\n }\n\n let resolvedOptions = options;\n\n if (\n resolvedOptions.provider === 'iapkit' &&\n resolvedOptions.iapkit &&\n !resolvedOptions.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 (typeof configApiKey === 'string' && configApiKey.length > 0) {\n resolvedOptions = {\n ...resolvedOptions,\n iapkit: {\n ...resolvedOptions.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\n const result = await ExpoIapModule.verifyPurchaseWithProvider(\n resolvedOptions,\n );\n if (result.iapkit == null) {\n return result;\n }\n\n const {clientPayload, productId, ...iapkit} = result.iapkit;\n return {\n ...result,\n iapkit: {\n ...iapkit,\n ...(clientPayload == null ? {} : {clientPayload}),\n ...(productId == null ? {} : {productId}),\n },\n };\n};\n\nexport * from './useIAP';\nexport {kitApi, KitApiError} from './kit-api';\nexport type {\n KitApiOptions,\n KitClientPayloadCache,\n KitClientPayloadOptions,\n KitClientPayloadResponse,\n KitProduct,\n KitProductClientPayload,\n KitProductOffer,\n KitProductPlatform,\n KitProductsOptions,\n KitProductsResponse,\n KitSubscription,\n EntitlementsResponse,\n StatusResponse,\n} from './kit-api';\nexport {\n ErrorCodeUtils,\n ErrorCodeMapping,\n createPurchaseError,\n createPurchaseErrorFromPlatform,\n getUserFriendlyErrorMessage,\n isUserCancelledError,\n} from './utils/errorMapping';\nexport type {\n PurchaseError as ExpoPurchaseError,\n PurchaseErrorProps,\n} from './utils/errorMapping';\nexport {ExpoIapConsole} from './utils/debug';\n"]}
@@ -62,6 +62,11 @@ type ErrorLike = string | {
62
62
  export declare function isUserCancelledError(error: unknown): boolean;
63
63
  export declare function isNetworkError(error: unknown): boolean;
64
64
  export declare function isRecoverableError(error: unknown): boolean;
65
+ /**
66
+ * End-user copy for a known error code, derived from the code by design: the
67
+ * native message can name build configuration a customer must not be shown.
68
+ * Developers get that diagnostic as `error.message`.
69
+ */
65
70
  export declare function getUserFriendlyErrorMessage(error: ErrorLike): string;
66
71
  export {};
67
72
  //# sourceMappingURL=errorMapping.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorMapping.d.ts","sourceRoot":"","sources":["../../src/utils/errorMapping.ts"],"names":[],"mappings":"AAAA;;;;GAIG;A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,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWtD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAc1D;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAoDpE"}
@@ -300,6 +300,11 @@ export function isRecoverableError(error) {
300
300
  const code = extractCode(error);
301
301
  return !!code && recoverableErrors.includes(code);
302
302
  }
303
+ /**
304
+ * End-user copy for a known error code, derived from the code by design: the
305
+ * native message can name build configuration a customer must not be shown.
306
+ * Developers get that diagnostic as `error.message`.
307
+ */
303
308
  export function getUserFriendlyErrorMessage(error) {
304
309
  const errorCode = extractCode(error);
305
310
  switch (errorCode) {
@@ -1 +1 @@
1
- {"version":3,"file":"errorMapping.js","sourceRoot":"","sources":["../../src/utils/errorMapping.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,GAGV,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC1C,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG;aACP,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;aACjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,GAAG;aACP,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;aAC1B,WAAW,EAAE;aACb,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AA2BF;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAInE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAA6B,EAAE,CAC7D,OAAO,KAAK,KAAK,QAAQ,IAAI,KA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AAO,CACJ,KAA4B,CAAC,OAAO;oBACrC,8BAA8B,CAC/B,CAAC;YACJ,CAAC;YACD,OAAO,8BAA8B,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Error mapping utilities for expo-iap.\n * Provides helpers for working with platform-specific error codes\n * and constructing structured purchase errors.\n */\n\nimport {\n ErrorCode,\n type IapPlatform,\n type SubResponseCodeAndroid,\n} from '../types';\n\nconst toKebabCase = (str: string): string => {\n if (str.includes('_')) {\n return str\n .split('_')\n .map((word) => word.toLowerCase())\n .join('-');\n } else {\n return str\n .replace(/([A-Z])/g, '-$1')\n .toLowerCase()\n .replace(/^-/, '');\n }\n};\n\nexport interface PurchaseErrorProps {\n message?: string;\n responseCode?: number;\n debugMessage?: string;\n code?: ErrorCode | string | number;\n productId?: string;\n productIds?: string[];\n productType?: string;\n isEmptyProductList?: boolean;\n subResponseCodeAndroid?: SubResponseCodeAndroid;\n platform?: IapPlatform;\n}\n\nexport interface PurchaseError extends Error {\n responseCode?: number;\n debugMessage?: string;\n code?: ErrorCode;\n productId?: string;\n productIds?: string[];\n productType?: string;\n isEmptyProductList?: boolean;\n subResponseCodeAndroid?: SubResponseCodeAndroid;\n platform?: IapPlatform;\n}\n\n/**\n * Prefix shared with the native Expo bridges. Expo Modules only transports an\n * exception code and message for rejected async functions, so native bridges\n * append the canonical PurchaseError payload to the message with this marker.\n */\nexport const OPENIAP_ERROR_ENVELOPE_PREFIX = 'OPENIAP_ERROR_JSON:';\n\ntype UnknownRecord = Record<string, unknown>;\n\nconst asRecord = (value: unknown): UnknownRecord | undefined =>\n typeof value === 'object' && value !== null\n ? (value as UnknownRecord)\n : undefined;\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === 'string' ? value : undefined;\n\nconst asNumber = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n\nconst asBoolean = (value: unknown): boolean | undefined =>\n typeof value === 'boolean' ? value : undefined;\n\nconst asStringArray = (value: unknown): string[] | undefined =>\n Array.isArray(value)\n ? value.filter(\n (candidate): candidate is string => typeof candidate === 'string',\n )\n : undefined;\n\nconst parseNativeErrorEnvelope = (\n message: string,\n): UnknownRecord | undefined => {\n const markerIndex = message.indexOf(OPENIAP_ERROR_ENVELOPE_PREFIX);\n if (markerIndex < 0) return undefined;\n\n try {\n return asRecord(\n JSON.parse(\n message.slice(markerIndex + OPENIAP_ERROR_ENVELOPE_PREFIX.length),\n ),\n );\n } catch {\n return undefined;\n }\n};\n\nconst normalizePlatform = (platform: IapPlatform): 'ios' | 'android' =>\n typeof platform === 'string' && platform.toLowerCase() === 'ios'\n ? 'ios'\n : 'android';\n\nconst COMMON_ERROR_CODE_MAP: Record<ErrorCode, string> = {\n [ErrorCode.Unknown]: ErrorCode.Unknown,\n [ErrorCode.UserCancelled]: ErrorCode.UserCancelled,\n [ErrorCode.UserError]: ErrorCode.UserError,\n [ErrorCode.ItemUnavailable]: ErrorCode.ItemUnavailable,\n [ErrorCode.RemoteError]: ErrorCode.RemoteError,\n [ErrorCode.NetworkError]: ErrorCode.NetworkError,\n [ErrorCode.ServiceError]: ErrorCode.ServiceError,\n [ErrorCode.NotPrepared]: ErrorCode.NotPrepared,\n [ErrorCode.NotEnded]: ErrorCode.NotEnded,\n [ErrorCode.AlreadyOwned]: ErrorCode.AlreadyOwned,\n [ErrorCode.DeveloperError]: ErrorCode.DeveloperError,\n [ErrorCode.BillingResponseJsonParseError]:\n ErrorCode.BillingResponseJsonParseError,\n [ErrorCode.DeferredPayment]: ErrorCode.DeferredPayment,\n [ErrorCode.Interrupted]: ErrorCode.Interrupted,\n [ErrorCode.IapNotAvailable]: ErrorCode.IapNotAvailable,\n [ErrorCode.PurchaseError]: ErrorCode.PurchaseError,\n [ErrorCode.SyncError]: ErrorCode.SyncError,\n [ErrorCode.TransactionValidationFailed]:\n ErrorCode.TransactionValidationFailed,\n [ErrorCode.ActivityUnavailable]: ErrorCode.ActivityUnavailable,\n [ErrorCode.AlreadyPrepared]: ErrorCode.AlreadyPrepared,\n [ErrorCode.Pending]: ErrorCode.Pending,\n [ErrorCode.ConnectionClosed]: ErrorCode.ConnectionClosed,\n [ErrorCode.InitConnection]: ErrorCode.InitConnection,\n [ErrorCode.ServiceDisconnected]: ErrorCode.ServiceDisconnected,\n [ErrorCode.QueryProduct]: ErrorCode.QueryProduct,\n [ErrorCode.SkuNotFound]: ErrorCode.SkuNotFound,\n [ErrorCode.SkuOfferMismatch]: ErrorCode.SkuOfferMismatch,\n [ErrorCode.ItemNotOwned]: ErrorCode.ItemNotOwned,\n [ErrorCode.BillingUnavailable]: ErrorCode.BillingUnavailable,\n [ErrorCode.FeatureNotSupported]: ErrorCode.FeatureNotSupported,\n [ErrorCode.DuplicatePurchase]: ErrorCode.DuplicatePurchase,\n [ErrorCode.ServiceTimeout]: ErrorCode.ServiceTimeout,\n [ErrorCode.EmptySkuList]: ErrorCode.EmptySkuList,\n [ErrorCode.PurchaseVerificationFailed]: ErrorCode.PurchaseVerificationFailed,\n [ErrorCode.PurchaseVerificationFinishFailed]:\n ErrorCode.PurchaseVerificationFinishFailed,\n [ErrorCode.PurchaseVerificationFinished]:\n ErrorCode.PurchaseVerificationFinished,\n};\n\nexport const ErrorCodeMapping = {\n ios: COMMON_ERROR_CODE_MAP,\n android: COMMON_ERROR_CODE_MAP,\n} as const;\n\nconst OPENIAP_ERROR_CODE_SET: Set<string> = new Set(Object.values(ErrorCode));\n\nconst HISTORICAL_ERROR_CODE_INPUTS: Record<string, ErrorCode> = {\n RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,\n E_RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,\n RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,\n E_RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,\n RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,\n E_RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,\n};\n\nconst historicalErrorCode = (code: string): ErrorCode | undefined =>\n HISTORICAL_ERROR_CODE_INPUTS[\n code\n .trim()\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/-/g, '_')\n .toUpperCase()\n ];\n\n// Legacy Google Play Billing response codes accepted by older JS call sites.\n// Native ERROR_CODES constants are code -> message tables, not response-code maps.\nconst LEGACY_ANDROID_RESPONSE_CODES = new Map<number, ErrorCode>([\n [-3, ErrorCode.ServiceTimeout],\n [-2, ErrorCode.FeatureNotSupported],\n [-1, ErrorCode.ServiceDisconnected],\n [1, ErrorCode.UserCancelled],\n [2, ErrorCode.ServiceError],\n [3, ErrorCode.BillingUnavailable],\n [4, ErrorCode.ItemUnavailable],\n [5, ErrorCode.DeveloperError],\n [6, ErrorCode.ServiceError],\n [7, ErrorCode.AlreadyOwned],\n [8, ErrorCode.ItemNotOwned],\n [12, ErrorCode.NetworkError],\n]);\n\nexport const createPurchaseError = (\n props: PurchaseErrorProps,\n): PurchaseError => {\n const errorCode = props.code\n ? typeof props.code === 'string' || typeof props.code === 'number'\n ? ErrorCodeUtils.fromPlatformCode(props.code, props.platform || 'ios')\n : props.code\n : undefined;\n\n const error = new Error(\n props.message ?? 'Unknown error occurred',\n ) as PurchaseError;\n error.name = '[expo-iap]: PurchaseError';\n error.responseCode = props.responseCode;\n error.debugMessage = props.debugMessage;\n error.code = errorCode;\n error.productId = props.productId;\n error.productIds = props.productIds;\n error.productType = props.productType;\n error.isEmptyProductList = props.isEmptyProductList;\n error.subResponseCodeAndroid = props.subResponseCodeAndroid;\n error.platform = props.platform;\n return error;\n};\n\nexport const createPurchaseErrorFromPlatform = (\n errorData: PurchaseErrorProps,\n platform: IapPlatform,\n): PurchaseError => {\n const normalizedPlatform = normalizePlatform(platform);\n const errorCode = errorData.code\n ? typeof errorData.code === 'string' || typeof errorData.code === 'number'\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, normalizedPlatform)\n : errorData.code\n : ErrorCode.Unknown;\n\n return createPurchaseError({\n message: errorData.message ?? 'Unknown error occurred',\n responseCode: errorData.responseCode,\n debugMessage: errorData.debugMessage,\n code: errorCode,\n productId: errorData.productId,\n productIds: errorData.productIds,\n productType: errorData.productType,\n isEmptyProductList: errorData.isEmptyProductList,\n subResponseCodeAndroid: errorData.subResponseCodeAndroid,\n platform,\n });\n};\n\n/**\n * Rebuild a canonical PurchaseError from an Expo Modules Promise rejection.\n *\n * Native Expo async functions cannot attach arbitrary fields to the rejected\n * JavaScript Error. The iOS and Android bridges therefore place the complete\n * payload in a marked JSON envelope inside the rejection message. This helper\n * also accepts direct fields so the Vega/Onside adapters and older native\n * builds continue to work.\n */\nexport const createPurchaseErrorFromNativeException = (\n error: unknown,\n platform: IapPlatform,\n fallback: PurchaseErrorProps = {},\n): PurchaseError => {\n const direct = asRecord(error) ?? {};\n const nativeMessage =\n asString(direct.message) ??\n (typeof error === 'string' ? error : undefined) ??\n fallback.message ??\n 'Unknown error occurred';\n const envelope = parseNativeErrorEnvelope(nativeMessage) ?? {};\n\n const envelopePlatform = asString(envelope.platform);\n const resolvedPlatform: IapPlatform =\n envelopePlatform === 'ios' || envelopePlatform === 'android'\n ? envelopePlatform\n : platform;\n const subResponseCode =\n asString(envelope.subResponseCodeAndroid) ??\n asString(direct.subResponseCodeAndroid) ??\n fallback.subResponseCodeAndroid;\n\n return createPurchaseErrorFromPlatform(\n {\n code:\n asString(envelope.code) ??\n asNumber(envelope.code) ??\n asString(direct.code) ??\n asNumber(direct.code) ??\n fallback.code ??\n ErrorCode.Unknown,\n message: asString(envelope.message) ?? fallback.message ?? nativeMessage,\n debugMessage:\n asString(envelope.debugMessage) ??\n asString(direct.debugMessage) ??\n fallback.debugMessage,\n responseCode:\n asNumber(envelope.responseCode) ??\n asNumber(direct.responseCode) ??\n fallback.responseCode,\n productId:\n asString(envelope.productId) ??\n asString(direct.productId) ??\n fallback.productId,\n productIds:\n asStringArray(envelope.productIds) ??\n asStringArray(direct.productIds) ??\n fallback.productIds,\n productType:\n asString(envelope.productType) ??\n asString(direct.productType) ??\n fallback.productType,\n isEmptyProductList:\n asBoolean(envelope.isEmptyProductList) ??\n asBoolean(direct.isEmptyProductList) ??\n fallback.isEmptyProductList,\n subResponseCodeAndroid: subResponseCode as\n SubResponseCodeAndroid | undefined,\n platform: resolvedPlatform,\n },\n resolvedPlatform,\n );\n};\n\nexport const ErrorCodeUtils = {\n // OpenIAP native bridges already exchange canonical error-code strings.\n getNativeErrorCode: (errorCode: ErrorCode): string => errorCode,\n fromPlatformCode: (\n platformCode: string | number | null | undefined,\n platform: IapPlatform,\n ): ErrorCode => {\n if (platformCode == null) {\n return ErrorCode.Unknown;\n }\n if (typeof platformCode === 'number') {\n return normalizePlatform(platform) === 'android'\n ? (LEGACY_ANDROID_RESPONSE_CODES.get(platformCode) ?? ErrorCode.Unknown)\n : ErrorCode.Unknown;\n }\n const historical = historicalErrorCode(platformCode);\n if (historical) {\n return historical;\n }\n const normalized = toKebabCase(platformCode.replace(/^E_/i, ''));\n return OPENIAP_ERROR_CODE_SET.has(normalized)\n ? (normalized as ErrorCode)\n : ErrorCode.Unknown;\n },\n toPlatformCode: (\n errorCode: ErrorCode,\n _platform: IapPlatform,\n ): string | number => errorCode,\n isValidForPlatform: (errorCode: ErrorCode, _platform: IapPlatform): boolean =>\n OPENIAP_ERROR_CODE_SET.has(errorCode),\n};\n\n// ---------------------------------------------------------------------------\n// Convenience helpers for interpreting error objects\n// ---------------------------------------------------------------------------\n\ntype ErrorLike = string | {code?: ErrorCode | string; message?: string};\n\nconst ERROR_CODES = new Set<string>(Object.values(ErrorCode));\n\nconst normalizeErrorCode = (code?: string | null): string | undefined => {\n if (!code) {\n return undefined;\n }\n\n if (ERROR_CODES.has(code)) {\n return code;\n }\n\n const historical = historicalErrorCode(code);\n if (historical) {\n return historical;\n }\n\n const camelCased = toKebabCase(code);\n if (ERROR_CODES.has(camelCased)) {\n return camelCased;\n }\n\n if (code.startsWith('E_')) {\n const trimmed = code.substring(2);\n if (ERROR_CODES.has(trimmed)) {\n return trimmed;\n }\n const camelTrimmed = toKebabCase(trimmed);\n if (ERROR_CODES.has(camelTrimmed)) {\n return camelTrimmed;\n }\n }\n\n return code;\n};\n\nfunction extractCode(error: unknown): string | undefined {\n if (typeof error === 'string') {\n return normalizeErrorCode(error);\n }\n\n if (error && typeof error === 'object' && 'code' in error) {\n return normalizeErrorCode((error as {code?: string}).code);\n }\n\n return undefined;\n}\n\nexport function isUserCancelledError(error: unknown): boolean {\n return extractCode(error) === ErrorCode.UserCancelled;\n}\n\nexport function isNetworkError(error: unknown): boolean {\n const networkErrors: ErrorCode[] = [\n ErrorCode.NetworkError,\n ErrorCode.RemoteError,\n ErrorCode.ServiceError,\n ErrorCode.ServiceDisconnected,\n ErrorCode.BillingUnavailable,\n ];\n\n const code = extractCode(error);\n return !!code && (networkErrors as string[]).includes(code);\n}\n\nexport function isRecoverableError(error: unknown): boolean {\n const recoverableErrors: ErrorCode[] = [\n ErrorCode.NetworkError,\n ErrorCode.RemoteError,\n ErrorCode.ServiceError,\n ErrorCode.Interrupted,\n ErrorCode.ServiceDisconnected,\n ErrorCode.BillingUnavailable,\n ErrorCode.QueryProduct,\n ErrorCode.InitConnection,\n ];\n\n const code = extractCode(error);\n return !!code && (recoverableErrors as string[]).includes(code);\n}\n\nexport function getUserFriendlyErrorMessage(error: ErrorLike): string {\n const errorCode = extractCode(error);\n\n switch (errorCode) {\n case ErrorCode.UserCancelled:\n return 'Purchase was cancelled by user';\n case ErrorCode.NetworkError:\n return 'Network connection error. Please check your internet connection and try again.';\n case ErrorCode.PurchaseVerificationFinished:\n return 'Purchase verification already finished';\n case ErrorCode.ServiceDisconnected:\n return 'Billing service disconnected. Please try again.';\n case ErrorCode.BillingUnavailable:\n return 'Billing is unavailable on this device or account.';\n case ErrorCode.ItemUnavailable:\n return 'This item is not available for purchase';\n case ErrorCode.ItemNotOwned:\n return \"You don't own this item\";\n case ErrorCode.AlreadyOwned:\n return 'You already own this item';\n case ErrorCode.SkuNotFound:\n return 'Requested product could not be found';\n case ErrorCode.SkuOfferMismatch:\n return 'Selected offer does not match the SKU';\n case ErrorCode.DeferredPayment:\n return 'Payment is pending approval';\n case ErrorCode.NotPrepared:\n return 'In-app purchase is not ready. Please try again later.';\n case ErrorCode.ServiceError:\n return 'Store service error. Please try again later.';\n case ErrorCode.FeatureNotSupported:\n return 'This feature is not supported on this device.';\n case ErrorCode.TransactionValidationFailed:\n return 'Transaction could not be verified';\n case ErrorCode.PurchaseVerificationFailed:\n return 'Purchase verification failed';\n case ErrorCode.EmptySkuList:\n return 'No product IDs provided';\n case ErrorCode.InitConnection:\n return 'Failed to initialize billing connection';\n case ErrorCode.QueryProduct:\n return 'Failed to query products. Please try again later.';\n default: {\n if (error && typeof error === 'object' && 'message' in error) {\n return (\n (error as {message?: string}).message ??\n 'An unexpected error occurred'\n );\n }\n return 'An unexpected error occurred';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"errorMapping.js","sourceRoot":"","sources":["../../src/utils/errorMapping.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,GAGV,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC1C,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG;aACP,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;aACjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,GAAG;aACP,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;aAC1B,WAAW,EAAE;aACb,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AA2BF;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AAInE,MAAM,Q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ACR,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;gBAC7D,OAAO,CACJ,KAA4B,CAAC,OAAO;oBACrC,8BAA8B,CAC/B,CAAC;YACJ,CAAC;YACD,OAAO,8BAA8B,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Error mapping utilities for expo-iap.\n * Provides helpers for working with platform-specific error codes\n * and constructing structured purchase errors.\n */\n\nimport {\n ErrorCode,\n type IapPlatform,\n type SubResponseCodeAndroid,\n} from '../types';\n\nconst toKebabCase = (str: string): string => {\n if (str.includes('_')) {\n return str\n .split('_')\n .map((word) => word.toLowerCase())\n .join('-');\n } else {\n return str\n .replace(/([A-Z])/g, '-$1')\n .toLowerCase()\n .replace(/^-/, '');\n }\n};\n\nexport interface PurchaseErrorProps {\n message?: string;\n responseCode?: number;\n debugMessage?: string;\n code?: ErrorCode | string | number;\n productId?: string;\n productIds?: string[];\n productType?: string;\n isEmptyProductList?: boolean;\n subResponseCodeAndroid?: SubResponseCodeAndroid;\n platform?: IapPlatform;\n}\n\nexport interface PurchaseError extends Error {\n responseCode?: number;\n debugMessage?: string;\n code?: ErrorCode;\n productId?: string;\n productIds?: string[];\n productType?: string;\n isEmptyProductList?: boolean;\n subResponseCodeAndroid?: SubResponseCodeAndroid;\n platform?: IapPlatform;\n}\n\n/**\n * Prefix shared with the native Expo bridges. Expo Modules only transports an\n * exception code and message for rejected async functions, so native bridges\n * append the canonical PurchaseError payload to the message with this marker.\n */\nexport const OPENIAP_ERROR_ENVELOPE_PREFIX = 'OPENIAP_ERROR_JSON:';\n\ntype UnknownRecord = Record<string, unknown>;\n\nconst asRecord = (value: unknown): UnknownRecord | undefined =>\n typeof value === 'object' && value !== null\n ? (value as UnknownRecord)\n : undefined;\n\nconst asString = (value: unknown): string | undefined =>\n typeof value === 'string' ? value : undefined;\n\nconst asNumber = (value: unknown): number | undefined =>\n typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n\nconst asBoolean = (value: unknown): boolean | undefined =>\n typeof value === 'boolean' ? value : undefined;\n\nconst asStringArray = (value: unknown): string[] | undefined =>\n Array.isArray(value)\n ? value.filter(\n (candidate): candidate is string => typeof candidate === 'string',\n )\n : undefined;\n\nconst parseNativeErrorEnvelope = (\n message: string,\n): UnknownRecord | undefined => {\n const markerIndex = message.indexOf(OPENIAP_ERROR_ENVELOPE_PREFIX);\n if (markerIndex < 0) return undefined;\n\n try {\n return asRecord(\n JSON.parse(\n message.slice(markerIndex + OPENIAP_ERROR_ENVELOPE_PREFIX.length),\n ),\n );\n } catch {\n return undefined;\n }\n};\n\nconst normalizePlatform = (platform: IapPlatform): 'ios' | 'android' =>\n typeof platform === 'string' && platform.toLowerCase() === 'ios'\n ? 'ios'\n : 'android';\n\nconst COMMON_ERROR_CODE_MAP: Record<ErrorCode, string> = {\n [ErrorCode.Unknown]: ErrorCode.Unknown,\n [ErrorCode.UserCancelled]: ErrorCode.UserCancelled,\n [ErrorCode.UserError]: ErrorCode.UserError,\n [ErrorCode.ItemUnavailable]: ErrorCode.ItemUnavailable,\n [ErrorCode.RemoteError]: ErrorCode.RemoteError,\n [ErrorCode.NetworkError]: ErrorCode.NetworkError,\n [ErrorCode.ServiceError]: ErrorCode.ServiceError,\n [ErrorCode.NotPrepared]: ErrorCode.NotPrepared,\n [ErrorCode.NotEnded]: ErrorCode.NotEnded,\n [ErrorCode.AlreadyOwned]: ErrorCode.AlreadyOwned,\n [ErrorCode.DeveloperError]: ErrorCode.DeveloperError,\n [ErrorCode.BillingResponseJsonParseError]:\n ErrorCode.BillingResponseJsonParseError,\n [ErrorCode.DeferredPayment]: ErrorCode.DeferredPayment,\n [ErrorCode.Interrupted]: ErrorCode.Interrupted,\n [ErrorCode.IapNotAvailable]: ErrorCode.IapNotAvailable,\n [ErrorCode.PurchaseError]: ErrorCode.PurchaseError,\n [ErrorCode.SyncError]: ErrorCode.SyncError,\n [ErrorCode.TransactionValidationFailed]:\n ErrorCode.TransactionValidationFailed,\n [ErrorCode.ActivityUnavailable]: ErrorCode.ActivityUnavailable,\n [ErrorCode.AlreadyPrepared]: ErrorCode.AlreadyPrepared,\n [ErrorCode.Pending]: ErrorCode.Pending,\n [ErrorCode.ConnectionClosed]: ErrorCode.ConnectionClosed,\n [ErrorCode.InitConnection]: ErrorCode.InitConnection,\n [ErrorCode.ServiceDisconnected]: ErrorCode.ServiceDisconnected,\n [ErrorCode.QueryProduct]: ErrorCode.QueryProduct,\n [ErrorCode.SkuNotFound]: ErrorCode.SkuNotFound,\n [ErrorCode.SkuOfferMismatch]: ErrorCode.SkuOfferMismatch,\n [ErrorCode.ItemNotOwned]: ErrorCode.ItemNotOwned,\n [ErrorCode.BillingUnavailable]: ErrorCode.BillingUnavailable,\n [ErrorCode.FeatureNotSupported]: ErrorCode.FeatureNotSupported,\n [ErrorCode.DuplicatePurchase]: ErrorCode.DuplicatePurchase,\n [ErrorCode.ServiceTimeout]: ErrorCode.ServiceTimeout,\n [ErrorCode.EmptySkuList]: ErrorCode.EmptySkuList,\n [ErrorCode.PurchaseVerificationFailed]: ErrorCode.PurchaseVerificationFailed,\n [ErrorCode.PurchaseVerificationFinishFailed]:\n ErrorCode.PurchaseVerificationFinishFailed,\n [ErrorCode.PurchaseVerificationFinished]:\n ErrorCode.PurchaseVerificationFinished,\n};\n\nexport const ErrorCodeMapping = {\n ios: COMMON_ERROR_CODE_MAP,\n android: COMMON_ERROR_CODE_MAP,\n} as const;\n\nconst OPENIAP_ERROR_CODE_SET: Set<string> = new Set(Object.values(ErrorCode));\n\nconst HISTORICAL_ERROR_CODE_INPUTS: Record<string, ErrorCode> = {\n RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,\n E_RECEIPT_FAILED: ErrorCode.PurchaseVerificationFailed,\n RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,\n E_RECEIPT_FINISHED: ErrorCode.PurchaseVerificationFinished,\n RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,\n E_RECEIPT_FINISHED_FAILED: ErrorCode.PurchaseVerificationFinishFailed,\n};\n\nconst historicalErrorCode = (code: string): ErrorCode | undefined =>\n HISTORICAL_ERROR_CODE_INPUTS[\n code\n .trim()\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/-/g, '_')\n .toUpperCase()\n ];\n\n// Legacy Google Play Billing response codes accepted by older JS call sites.\n// Native ERROR_CODES constants are code -> message tables, not response-code maps.\nconst LEGACY_ANDROID_RESPONSE_CODES = new Map<number, ErrorCode>([\n [-3, ErrorCode.ServiceTimeout],\n [-2, ErrorCode.FeatureNotSupported],\n [-1, ErrorCode.ServiceDisconnected],\n [1, ErrorCode.UserCancelled],\n [2, ErrorCode.ServiceError],\n [3, ErrorCode.BillingUnavailable],\n [4, ErrorCode.ItemUnavailable],\n [5, ErrorCode.DeveloperError],\n [6, ErrorCode.ServiceError],\n [7, ErrorCode.AlreadyOwned],\n [8, ErrorCode.ItemNotOwned],\n [12, ErrorCode.NetworkError],\n]);\n\nexport const createPurchaseError = (\n props: PurchaseErrorProps,\n): PurchaseError => {\n const errorCode = props.code\n ? typeof props.code === 'string' || typeof props.code === 'number'\n ? ErrorCodeUtils.fromPlatformCode(props.code, props.platform || 'ios')\n : props.code\n : undefined;\n\n const error = new Error(\n props.message ?? 'Unknown error occurred',\n ) as PurchaseError;\n error.name = '[expo-iap]: PurchaseError';\n error.responseCode = props.responseCode;\n error.debugMessage = props.debugMessage;\n error.code = errorCode;\n error.productId = props.productId;\n error.productIds = props.productIds;\n error.productType = props.productType;\n error.isEmptyProductList = props.isEmptyProductList;\n error.subResponseCodeAndroid = props.subResponseCodeAndroid;\n error.platform = props.platform;\n return error;\n};\n\nexport const createPurchaseErrorFromPlatform = (\n errorData: PurchaseErrorProps,\n platform: IapPlatform,\n): PurchaseError => {\n const normalizedPlatform = normalizePlatform(platform);\n const errorCode = errorData.code\n ? typeof errorData.code === 'string' || typeof errorData.code === 'number'\n ? ErrorCodeUtils.fromPlatformCode(errorData.code, normalizedPlatform)\n : errorData.code\n : ErrorCode.Unknown;\n\n return createPurchaseError({\n message: errorData.message ?? 'Unknown error occurred',\n responseCode: errorData.responseCode,\n debugMessage: errorData.debugMessage,\n code: errorCode,\n productId: errorData.productId,\n productIds: errorData.productIds,\n productType: errorData.productType,\n isEmptyProductList: errorData.isEmptyProductList,\n subResponseCodeAndroid: errorData.subResponseCodeAndroid,\n platform,\n });\n};\n\n/**\n * Rebuild a canonical PurchaseError from an Expo Modules Promise rejection.\n *\n * Native Expo async functions cannot attach arbitrary fields to the rejected\n * JavaScript Error. The iOS and Android bridges therefore place the complete\n * payload in a marked JSON envelope inside the rejection message. This helper\n * also accepts direct fields so the Vega/Onside adapters and older native\n * builds continue to work.\n */\nexport const createPurchaseErrorFromNativeException = (\n error: unknown,\n platform: IapPlatform,\n fallback: PurchaseErrorProps = {},\n): PurchaseError => {\n const direct = asRecord(error) ?? {};\n const nativeMessage =\n asString(direct.message) ??\n (typeof error === 'string' ? error : undefined) ??\n fallback.message ??\n 'Unknown error occurred';\n const envelope = parseNativeErrorEnvelope(nativeMessage) ?? {};\n\n const envelopePlatform = asString(envelope.platform);\n const resolvedPlatform: IapPlatform =\n envelopePlatform === 'ios' || envelopePlatform === 'android'\n ? envelopePlatform\n : platform;\n const subResponseCode =\n asString(envelope.subResponseCodeAndroid) ??\n asString(direct.subResponseCodeAndroid) ??\n fallback.subResponseCodeAndroid;\n\n return createPurchaseErrorFromPlatform(\n {\n code:\n asString(envelope.code) ??\n asNumber(envelope.code) ??\n asString(direct.code) ??\n asNumber(direct.code) ??\n fallback.code ??\n ErrorCode.Unknown,\n message: asString(envelope.message) ?? fallback.message ?? nativeMessage,\n debugMessage:\n asString(envelope.debugMessage) ??\n asString(direct.debugMessage) ??\n fallback.debugMessage,\n responseCode:\n asNumber(envelope.responseCode) ??\n asNumber(direct.responseCode) ??\n fallback.responseCode,\n productId:\n asString(envelope.productId) ??\n asString(direct.productId) ??\n fallback.productId,\n productIds:\n asStringArray(envelope.productIds) ??\n asStringArray(direct.productIds) ??\n fallback.productIds,\n productType:\n asString(envelope.productType) ??\n asString(direct.productType) ??\n fallback.productType,\n isEmptyProductList:\n asBoolean(envelope.isEmptyProductList) ??\n asBoolean(direct.isEmptyProductList) ??\n fallback.isEmptyProductList,\n subResponseCodeAndroid: subResponseCode as\n SubResponseCodeAndroid | undefined,\n platform: resolvedPlatform,\n },\n resolvedPlatform,\n );\n};\n\nexport const ErrorCodeUtils = {\n // OpenIAP native bridges already exchange canonical error-code strings.\n getNativeErrorCode: (errorCode: ErrorCode): string => errorCode,\n fromPlatformCode: (\n platformCode: string | number | null | undefined,\n platform: IapPlatform,\n ): ErrorCode => {\n if (platformCode == null) {\n return ErrorCode.Unknown;\n }\n if (typeof platformCode === 'number') {\n return normalizePlatform(platform) === 'android'\n ? (LEGACY_ANDROID_RESPONSE_CODES.get(platformCode) ?? ErrorCode.Unknown)\n : ErrorCode.Unknown;\n }\n const historical = historicalErrorCode(platformCode);\n if (historical) {\n return historical;\n }\n const normalized = toKebabCase(platformCode.replace(/^E_/i, ''));\n return OPENIAP_ERROR_CODE_SET.has(normalized)\n ? (normalized as ErrorCode)\n : ErrorCode.Unknown;\n },\n toPlatformCode: (\n errorCode: ErrorCode,\n _platform: IapPlatform,\n ): string | number => errorCode,\n isValidForPlatform: (errorCode: ErrorCode, _platform: IapPlatform): boolean =>\n OPENIAP_ERROR_CODE_SET.has(errorCode),\n};\n\n// ---------------------------------------------------------------------------\n// Convenience helpers for interpreting error objects\n// ---------------------------------------------------------------------------\n\ntype ErrorLike = string | {code?: ErrorCode | string; message?: string};\n\nconst ERROR_CODES = new Set<string>(Object.values(ErrorCode));\n\nconst normalizeErrorCode = (code?: string | null): string | undefined => {\n if (!code) {\n return undefined;\n }\n\n if (ERROR_CODES.has(code)) {\n return code;\n }\n\n const historical = historicalErrorCode(code);\n if (historical) {\n return historical;\n }\n\n const camelCased = toKebabCase(code);\n if (ERROR_CODES.has(camelCased)) {\n return camelCased;\n }\n\n if (code.startsWith('E_')) {\n const trimmed = code.substring(2);\n if (ERROR_CODES.has(trimmed)) {\n return trimmed;\n }\n const camelTrimmed = toKebabCase(trimmed);\n if (ERROR_CODES.has(camelTrimmed)) {\n return camelTrimmed;\n }\n }\n\n return code;\n};\n\nfunction extractCode(error: unknown): string | undefined {\n if (typeof error === 'string') {\n return normalizeErrorCode(error);\n }\n\n if (error && typeof error === 'object' && 'code' in error) {\n return normalizeErrorCode((error as {code?: string}).code);\n }\n\n return undefined;\n}\n\nexport function isUserCancelledError(error: unknown): boolean {\n return extractCode(error) === ErrorCode.UserCancelled;\n}\n\nexport function isNetworkError(error: unknown): boolean {\n const networkErrors: ErrorCode[] = [\n ErrorCode.NetworkError,\n ErrorCode.RemoteError,\n ErrorCode.ServiceError,\n ErrorCode.ServiceDisconnected,\n ErrorCode.BillingUnavailable,\n ];\n\n const code = extractCode(error);\n return !!code && (networkErrors as string[]).includes(code);\n}\n\nexport function isRecoverableError(error: unknown): boolean {\n const recoverableErrors: ErrorCode[] = [\n ErrorCode.NetworkError,\n ErrorCode.RemoteError,\n ErrorCode.ServiceError,\n ErrorCode.Interrupted,\n ErrorCode.ServiceDisconnected,\n ErrorCode.BillingUnavailable,\n ErrorCode.QueryProduct,\n ErrorCode.InitConnection,\n ];\n\n const code = extractCode(error);\n return !!code && (recoverableErrors as string[]).includes(code);\n}\n\n/**\n * End-user copy for a known error code, derived from the code by design: the\n * native message can name build configuration a customer must not be shown.\n * Developers get that diagnostic as `error.message`.\n */\nexport function getUserFriendlyErrorMessage(error: ErrorLike): string {\n const errorCode = extractCode(error);\n\n switch (errorCode) {\n case ErrorCode.UserCancelled:\n return 'Purchase was cancelled by user';\n case ErrorCode.NetworkError:\n return 'Network connection error. Please check your internet connection and try again.';\n case ErrorCode.PurchaseVerificationFinished:\n return 'Purchase verification already finished';\n case ErrorCode.ServiceDisconnected:\n return 'Billing service disconnected. Please try again.';\n case ErrorCode.BillingUnavailable:\n return 'Billing is unavailable on this device or account.';\n case ErrorCode.ItemUnavailable:\n return 'This item is not available for purchase';\n case ErrorCode.ItemNotOwned:\n return \"You don't own this item\";\n case ErrorCode.AlreadyOwned:\n return 'You already own this item';\n case ErrorCode.SkuNotFound:\n return 'Requested product could not be found';\n case ErrorCode.SkuOfferMismatch:\n return 'Selected offer does not match the SKU';\n case ErrorCode.DeferredPayment:\n return 'Payment is pending approval';\n case ErrorCode.NotPrepared:\n return 'In-app purchase is not ready. Please try again later.';\n case ErrorCode.ServiceError:\n return 'Store service error. Please try again later.';\n case ErrorCode.FeatureNotSupported:\n return 'This feature is not supported on this device.';\n case ErrorCode.TransactionValidationFailed:\n return 'Transaction could not be verified';\n case ErrorCode.PurchaseVerificationFailed:\n return 'Purchase verification failed';\n case ErrorCode.EmptySkuList:\n return 'No product IDs provided';\n case ErrorCode.InitConnection:\n return 'Failed to initialize billing connection';\n case ErrorCode.QueryProduct:\n return 'Failed to query products. Please try again later.';\n default: {\n if (error && typeof error === 'object' && 'message' in error) {\n return (\n (error as {message?: string}).message ??\n 'An unexpected error occurred'\n );\n }\n return 'An unexpected error occurred';\n }\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "spec": "3.4.0",
3
- "google": "3.5.0",
3
+ "google": "3.5.2",
4
4
  "apple": "3.4.0"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-iap",
3
- "version": "5.5.1",
3
+ "version": "5.6.1",
4
4
  "description": "In App Purchase module in Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/src/index.ts CHANGED
@@ -1462,6 +1462,8 @@ export {
1462
1462
  ErrorCodeMapping,
1463
1463
  createPurchaseError,
1464
1464
  createPurchaseErrorFromPlatform,
1465
+ getUserFriendlyErrorMessage,
1466
+ isUserCancelledError,
1465
1467
  } from './utils/errorMapping';
1466
1468
  export type {
1467
1469
  PurchaseError as ExpoPurchaseError,
@@ -428,6 +428,11 @@ export function isRecoverableError(error: unknown): boolean {
428
428
  return !!code && (recoverableErrors as string[]).includes(code);
429
429
  }
430
430
 
431
+ /**
432
+ * End-user copy for a known error code, derived from the code by design: the
433
+ * native message can name build configuration a customer must not be shown.
434
+ * Developers get that diagnostic as `error.message`.
435
+ */
431
436
  export function getUserFriendlyErrorMessage(error: ErrorLike): string {
432
437
  const errorCode = extractCode(error);
433
438