expo-iap 3.1.37 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +1 -0
- package/build/index.d.ts +15 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +30 -17
- package/build/index.js.map +1 -1
- package/build/types.d.ts +40 -8
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +2 -0
- package/build/useIAP.js.map +1 -1
- package/coverage/clover.xml +93 -91
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/src/index.html +14 -14
- package/coverage/lcov-report/src/index.ts.html +64 -25
- package/coverage/lcov-report/src/modules/android.ts.html +1 -1
- package/coverage/lcov-report/src/modules/index.html +1 -1
- package/coverage/lcov-report/src/modules/ios.ts.html +1 -1
- package/coverage/lcov-report/src/utils/debug.ts.html +1 -1
- package/coverage/lcov-report/src/utils/errorMapping.ts.html +1 -1
- package/coverage/lcov-report/src/utils/index.html +1 -1
- package/coverage/lcov.info +163 -158
- package/ios/ExpoIap.podspec +1 -2
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/index.ts +30 -17
- package/src/types.ts +42 -9
- package/src/useIAP.ts +2 -0
package/build/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8CAA8C;AAC9C,yEAAyE;AACzE,+EAA+E;AAkH/E,MAAM,CAAN,IAAY,SAsCX;AAtCD,WAAY,SAAS;IACnB,yDAA4C,CAAA;IAC5C,2CAA8B,CAAA;IAC9B,iDAAoC,CAAA;IACpC,gFAAmE,CAAA;IACnE,uDAA0C,CAAA;IAC1C,mDAAsC,CAAA;IACtC,iDAAoC,CAAA;IACpC,+CAAkC,CAAA;IAClC,4CAA+B,CAAA;IAC/B,0DAA6C,CAAA;IAC7C,kDAAqC,CAAA;IACrC,+CAAkC,CAAA;IAClC,wCAA2B,CAAA;IAC3B,4CAA+B,CAAA;IAC/B,iDAAoC,CAAA;IACpC,2CAA8B,CAAA;IAC9B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;IAChC,wEAA2D,CAAA;IAC3D,qFAAwE,CAAA;IACxE,4EAA+D,CAAA;IAC/D,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,iDAAoC,CAAA;IACpC,8DAAiD,CAAA;IACjD,yCAA4B,CAAA;IAC5B,yDAA4C,CAAA;IAC5C,2CAA8B,CAAA;IAC9B,0CAA6B,CAAA;IAC7B,oDAAuC,CAAA;IACvC,qCAAwB,CAAA;IACxB,0EAA6D,CAAA;IAC7D,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;IAChC,qCAAwB,CAAA;AAC1B,CAAC,EAtCW,SAAS,KAAT,SAAS,QAsCpB;AAg0BD,mCAAmC","sourcesContent":["// ============================================================================\n// AUTO-GENERATED TYPES — DO NOT EDIT DIRECTLY\n// Run `bun run generate:types` after updating any *.graphql schema file.\n// ============================================================================\n\nexport interface ActiveSubscription {\n autoRenewingAndroid?: (boolean | null);\n basePlanIdAndroid?: (string | null);\n /**\n * The current plan identifier. This is:\n * - On Android: the basePlanId (e.g., \"premium\", \"premium-year\")\n * - On iOS: the productId (e.g., \"com.example.premium_monthly\", \"com.example.premium_yearly\")\n * This provides a unified way to identify which specific plan/tier the user is subscribed to.\n */\n currentPlanId?: (string | null);\n daysUntilExpirationIOS?: (number | null);\n environmentIOS?: (string | null);\n expirationDateIOS?: (number | null);\n isActive: boolean;\n productId: string;\n purchaseToken?: (string | null);\n /** Required for subscription upgrade/downgrade on Android */\n purchaseTokenAndroid?: (string | null);\n /**\n * Renewal information from StoreKit 2 (iOS only). Contains details about subscription renewal status,\n * pending upgrades/downgrades, and auto-renewal preferences.\n */\n renewalInfoIOS?: (RenewalInfoIOS | null);\n transactionDate: number;\n transactionId: string;\n /**\n * @deprecated iOS only - use daysUntilExpirationIOS instead.\n * Whether the subscription will expire soon (within 7 days).\n * Consider using daysUntilExpirationIOS for more precise control.\n */\n willExpireSoon?: (boolean | null);\n}\n\n/**\n * Alternative billing mode for Android\n * Controls which billing system is used\n */\nexport type AlternativeBillingModeAndroid = 'none' | 'user-choice' | 'alternative-only';\n\nexport interface AndroidSubscriptionOfferInput {\n /** Offer token */\n offerToken: string;\n /** Product SKU */\n sku: string;\n}\n\nexport interface AppTransaction {\n appId: number;\n appTransactionId?: (string | null);\n appVersion: string;\n appVersionId: number;\n bundleId: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n environment: string;\n originalAppVersion: string;\n originalPlatform?: (string | null);\n originalPurchaseDate: number;\n preorderDate?: (number | null);\n signedDate: number;\n}\n\nexport interface DeepLinkOptions {\n /** Android package name to target (required on Android) */\n packageNameAndroid?: (string | null);\n /** Android SKU to open (required on Android) */\n skuAndroid?: (string | null);\n}\n\nexport interface DiscountIOS {\n identifier: string;\n localizedPrice?: (string | null);\n numberOfPeriods: number;\n paymentMode: PaymentModeIOS;\n price: string;\n priceAmount: number;\n subscriptionPeriod: string;\n type: string;\n}\n\nexport interface DiscountOfferIOS {\n /** Discount identifier */\n identifier: string;\n /** Key identifier for validation */\n keyIdentifier: string;\n /** Cryptographic nonce */\n nonce: string;\n /** Signature for validation */\n signature: string;\n /** Timestamp of discount offer */\n timestamp: number;\n}\n\nexport interface DiscountOfferInputIOS {\n /** Discount identifier */\n identifier: string;\n /** Key identifier for validation */\n keyIdentifier: string;\n /** Cryptographic nonce */\n nonce: string;\n /** Signature for validation */\n signature: string;\n /** Timestamp of discount offer */\n timestamp: number;\n}\n\nexport interface EntitlementIOS {\n jsonRepresentation: string;\n sku: string;\n transactionId: string;\n}\n\nexport enum ErrorCode {\n ActivityUnavailable = 'activity-unavailable',\n AlreadyOwned = 'already-owned',\n AlreadyPrepared = 'already-prepared',\n BillingResponseJsonParseError = 'billing-response-json-parse-error',\n BillingUnavailable = 'billing-unavailable',\n ConnectionClosed = 'connection-closed',\n DeferredPayment = 'deferred-payment',\n DeveloperError = 'developer-error',\n EmptySkuList = 'empty-sku-list',\n FeatureNotSupported = 'feature-not-supported',\n IapNotAvailable = 'iap-not-available',\n InitConnection = 'init-connection',\n Interrupted = 'interrupted',\n ItemNotOwned = 'item-not-owned',\n ItemUnavailable = 'item-unavailable',\n NetworkError = 'network-error',\n NotEnded = 'not-ended',\n NotPrepared = 'not-prepared',\n Pending = 'pending',\n PurchaseError = 'purchase-error',\n PurchaseVerificationFailed = 'purchase-verification-failed',\n PurchaseVerificationFinishFailed = 'purchase-verification-finish-failed',\n PurchaseVerificationFinished = 'purchase-verification-finished',\n QueryProduct = 'query-product',\n ReceiptFailed = 'receipt-failed',\n ReceiptFinished = 'receipt-finished',\n ReceiptFinishedFailed = 'receipt-finished-failed',\n RemoteError = 'remote-error',\n ServiceDisconnected = 'service-disconnected',\n ServiceError = 'service-error',\n SkuNotFound = 'sku-not-found',\n SkuOfferMismatch = 'sku-offer-mismatch',\n SyncError = 'sync-error',\n TransactionValidationFailed = 'transaction-validation-failed',\n Unknown = 'unknown',\n UserCancelled = 'user-cancelled',\n UserError = 'user-error'\n}\n\n/** Result of presenting an external purchase link (iOS 18.2+) */\nexport interface ExternalPurchaseLinkResultIOS {\n /** Optional error message if the presentation failed */\n error?: (string | null);\n /** Whether the user completed the external purchase flow */\n success: boolean;\n}\n\n/** User actions on external purchase notice sheet (iOS 18.2+) */\nexport type ExternalPurchaseNoticeAction = 'continue' | 'dismissed';\n\n/** Result of presenting external purchase notice sheet (iOS 18.2+) */\nexport interface ExternalPurchaseNoticeResultIOS {\n /** Optional error message if the presentation failed */\n error?: (string | null);\n /** Notice result indicating user action */\n result: ExternalPurchaseNoticeAction;\n}\n\nexport type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;\n\nexport type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android';\n\nexport type IapPlatform = 'ios' | 'android';\n\n/** Unified purchase states from IAPKit verification response. */\nexport type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';\n\nexport type IapkitStore = 'apple' | 'google';\n\n/** Connection initialization configuration */\nexport interface InitConnectionConfig {\n /**\n * Alternative billing mode for Android\n * If not specified, defaults to NONE (standard Google Play billing)\n */\n alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);\n}\n\nexport interface Mutation {\n /** Acknowledge a non-consumable purchase or subscription */\n acknowledgePurchaseAndroid: Promise<boolean>;\n /** Initiate a refund request for a product (iOS 15+) */\n beginRefundRequestIOS?: Promise<(string | null)>;\n /**\n * Check if alternative billing is available for this user/device\n * Step 1 of alternative billing flow\n *\n * Returns true if available, false otherwise\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n checkAlternativeBillingAvailabilityAndroid: Promise<boolean>;\n /** Clear pending transactions from the StoreKit payment queue */\n clearTransactionIOS: Promise<boolean>;\n /** Consume a purchase token so it can be repurchased */\n consumePurchaseAndroid: Promise<boolean>;\n /**\n * Create external transaction token for Google Play reporting\n * Step 3 of alternative billing flow\n * Must be called AFTER successful payment in your payment system\n * Token must be reported to Google Play backend within 24 hours\n *\n * Returns token string, or null if creation failed\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n createAlternativeBillingTokenAndroid?: Promise<(string | null)>;\n /** Open the native subscription management surface */\n deepLinkToSubscriptions: Promise<void>;\n /** Close the platform billing connection */\n endConnection: Promise<boolean>;\n /** Finish a transaction after validating receipts */\n finishTransaction: Promise<void>;\n /** Establish the platform billing connection */\n initConnection: Promise<boolean>;\n /** Present the App Store code redemption sheet */\n presentCodeRedemptionSheetIOS: Promise<boolean>;\n /** Present external purchase custom link with StoreKit UI (iOS 18.2+) */\n presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;\n /** Present external purchase notice sheet (iOS 18.2+) */\n presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;\n /** Initiate a purchase flow; rely on events for final state */\n requestPurchase?: Promise<(Purchase | Purchase[] | null)>;\n /** Purchase the promoted product surfaced by the App Store */\n requestPurchaseOnPromotedProductIOS: Promise<boolean>;\n /** Restore completed purchases across platforms */\n restorePurchases: Promise<void>;\n /**\n * Show alternative billing information dialog to user\n * Step 2 of alternative billing flow\n * Must be called BEFORE processing payment in your payment system\n *\n * Returns true if user accepted, false if user canceled\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n showAlternativeBillingDialogAndroid: Promise<boolean>;\n /** Open subscription management UI and return changed purchases (iOS 15+) */\n showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;\n /** Force a StoreKit sync for transactions (iOS 15+) */\n syncIOS: Promise<boolean>;\n /**\n * Validate purchase receipts with the configured providers\n * @deprecated Use verifyPurchase\n */\n validateReceipt: Promise<VerifyPurchaseResult>;\n /** Verify purchases with the configured providers */\n verifyPurchase: Promise<VerifyPurchaseResult>;\n /** Verify purchases with a specific provider (e.g., IAPKit) */\n verifyPurchaseWithProvider: Promise<VerifyPurchaseWithProviderResult>;\n}\n\n\n\nexport type MutationAcknowledgePurchaseAndroidArgs = string;\n\nexport type MutationBeginRefundRequestIosArgs = string;\n\nexport type MutationConsumePurchaseAndroidArgs = string;\n\nexport type MutationDeepLinkToSubscriptionsArgs = (DeepLinkOptions | null) | undefined;\n\nexport interface MutationFinishTransactionArgs {\n isConsumable?: (boolean | null);\n purchase: PurchaseInput;\n}\n\n\nexport type MutationInitConnectionArgs = (InitConnectionConfig | null) | undefined;\n\nexport type MutationPresentExternalPurchaseLinkIosArgs = string;\n\nexport type MutationRequestPurchaseArgs =\n | {\n /** Per-platform purchase request props */\n request: RequestPurchasePropsByPlatforms;\n type: 'in-app';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n }\n | {\n /** Per-platform subscription request props */\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n };\n\n\nexport type MutationValidateReceiptArgs = VerifyPurchaseProps;\n\nexport type MutationVerifyPurchaseArgs = VerifyPurchaseProps;\n\nexport type MutationVerifyPurchaseWithProviderArgs = VerifyPurchaseWithProviderProps;\n\nexport type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';\n\nexport interface PricingPhaseAndroid {\n billingCycleCount: number;\n billingPeriod: string;\n formattedPrice: string;\n priceAmountMicros: string;\n priceCurrencyCode: string;\n recurrenceMode: number;\n}\n\nexport interface PricingPhasesAndroid {\n pricingPhaseList: PricingPhaseAndroid[];\n}\n\nexport type Product = ProductAndroid | ProductIOS;\n\nexport interface ProductAndroid extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);\n platform: 'android';\n price?: (number | null);\n subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);\n title: string;\n type: 'in-app';\n}\n\nexport interface ProductAndroidOneTimePurchaseOfferDetail {\n formattedPrice: string;\n priceAmountMicros: string;\n priceCurrencyCode: string;\n}\n\nexport interface ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n platform: 'android' | 'ios';\n price?: (number | null);\n title: string;\n type: 'in-app' | 'subs';\n} \n\nexport interface ProductIOS extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayNameIOS: string;\n displayPrice: string;\n id: string;\n isFamilyShareableIOS: boolean;\n jsonRepresentationIOS: string;\n platform: 'ios';\n price?: (number | null);\n subscriptionInfoIOS?: (SubscriptionInfoIOS | null);\n title: string;\n type: 'in-app';\n typeIOS: ProductTypeIOS;\n}\n\nexport type ProductOrSubscription = Product | ProductSubscription;\n\nexport type ProductQueryType = 'in-app' | 'subs' | 'all';\n\nexport interface ProductRequest {\n skus: string[];\n type?: (ProductQueryType | null);\n}\n\nexport type ProductSubscription = ProductSubscriptionAndroid | ProductSubscriptionIOS;\n\nexport interface ProductSubscriptionAndroid extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);\n platform: 'android';\n price?: (number | null);\n subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];\n title: string;\n type: 'subs';\n}\n\nexport interface ProductSubscriptionAndroidOfferDetails {\n basePlanId: string;\n offerId?: (string | null);\n offerTags: string[];\n offerToken: string;\n pricingPhases: PricingPhasesAndroid;\n}\n\nexport interface ProductSubscriptionIOS extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n discountsIOS?: (DiscountIOS[] | null);\n displayName?: (string | null);\n displayNameIOS: string;\n displayPrice: string;\n id: string;\n introductoryPriceAsAmountIOS?: (string | null);\n introductoryPriceIOS?: (string | null);\n introductoryPriceNumberOfPeriodsIOS?: (string | null);\n introductoryPricePaymentModeIOS: PaymentModeIOS;\n introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);\n isFamilyShareableIOS: boolean;\n jsonRepresentationIOS: string;\n platform: 'ios';\n price?: (number | null);\n subscriptionInfoIOS?: (SubscriptionInfoIOS | null);\n subscriptionPeriodNumberIOS?: (string | null);\n subscriptionPeriodUnitIOS?: (SubscriptionPeriodIOS | null);\n title: string;\n type: 'subs';\n typeIOS: ProductTypeIOS;\n}\n\nexport type ProductType = 'in-app' | 'subs';\n\nexport type ProductTypeIOS = 'consumable' | 'non-consumable' | 'auto-renewable-subscription' | 'non-renewing-subscription';\n\nexport type Purchase = PurchaseAndroid | PurchaseIOS;\n\nexport interface PurchaseAndroid extends PurchaseCommon {\n autoRenewingAndroid?: (boolean | null);\n currentPlanId?: (string | null);\n dataAndroid?: (string | null);\n developerPayloadAndroid?: (string | null);\n id: string;\n ids?: (string[] | null);\n isAcknowledgedAndroid?: (boolean | null);\n isAutoRenewing: boolean;\n obfuscatedAccountIdAndroid?: (string | null);\n obfuscatedProfileIdAndroid?: (string | null);\n packageNameAndroid?: (string | null);\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n purchaseToken?: (string | null);\n quantity: number;\n signatureAndroid?: (string | null);\n transactionDate: number;\n transactionId?: (string | null);\n}\n\nexport interface PurchaseCommon {\n /**\n * The current plan identifier. This is:\n * - On Android: the basePlanId (e.g., \"premium\", \"premium-year\")\n * - On iOS: the productId (e.g., \"com.example.premium_monthly\", \"com.example.premium_yearly\")\n * This provides a unified way to identify which specific plan/tier the user is subscribed to.\n */\n currentPlanId?: (string | null);\n id: string;\n ids?: (string[] | null);\n isAutoRenewing: boolean;\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n /** Unified purchase token (iOS JWS, Android purchaseToken) */\n purchaseToken?: (string | null);\n quantity: number;\n transactionDate: number;\n}\n\nexport interface PurchaseError {\n code: ErrorCode;\n message: string;\n productId?: (string | null);\n}\n\nexport interface PurchaseIOS extends PurchaseCommon {\n appAccountToken?: (string | null);\n appBundleIdIOS?: (string | null);\n countryCodeIOS?: (string | null);\n currencyCodeIOS?: (string | null);\n currencySymbolIOS?: (string | null);\n currentPlanId?: (string | null);\n environmentIOS?: (string | null);\n expirationDateIOS?: (number | null);\n id: string;\n ids?: (string[] | null);\n isAutoRenewing: boolean;\n isUpgradedIOS?: (boolean | null);\n offerIOS?: (PurchaseOfferIOS | null);\n originalTransactionDateIOS?: (number | null);\n originalTransactionIdentifierIOS?: (string | null);\n ownershipTypeIOS?: (string | null);\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n purchaseToken?: (string | null);\n quantity: number;\n quantityIOS?: (number | null);\n reasonIOS?: (string | null);\n reasonStringRepresentationIOS?: (string | null);\n renewalInfoIOS?: (RenewalInfoIOS | null);\n revocationDateIOS?: (number | null);\n revocationReasonIOS?: (string | null);\n storefrontCountryCodeIOS?: (string | null);\n subscriptionGroupIdIOS?: (string | null);\n transactionDate: number;\n transactionId: string;\n transactionReasonIOS?: (string | null);\n webOrderLineItemIdIOS?: (string | null);\n}\n\nexport type PurchaseInput = Purchase;\n\nexport interface PurchaseOfferIOS {\n id: string;\n paymentMode: string;\n type: string;\n}\n\nexport interface PurchaseOptions {\n /** Also emit results through the iOS event listeners */\n alsoPublishToEventListenerIOS?: (boolean | null);\n /** Limit to currently active items on iOS */\n onlyIncludeActiveItemsIOS?: (boolean | null);\n}\n\nexport type PurchaseState = 'pending' | 'purchased' | 'failed' | 'restored' | 'deferred' | 'unknown';\n\nexport type PurchaseVerificationProvider = 'iapkit';\n\nexport interface Query {\n /** Check if external purchase notice sheet can be presented (iOS 18.2+) */\n canPresentExternalPurchaseNoticeIOS: Promise<boolean>;\n /** Get current StoreKit 2 entitlements (iOS 15+) */\n currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;\n /** Retrieve products or subscriptions from the store */\n fetchProducts: Promise<(ProductOrSubscription[] | Product[] | ProductSubscription[] | null)>;\n /** Get active subscriptions (filters by subscriptionIds when provided) */\n getActiveSubscriptions: Promise<ActiveSubscription[]>;\n /** Fetch the current app transaction (iOS 16+) */\n getAppTransactionIOS?: Promise<(AppTransaction | null)>;\n /** Get all available purchases for the current user */\n getAvailablePurchases: Promise<Purchase[]>;\n /** Retrieve all pending transactions in the StoreKit queue */\n getPendingTransactionsIOS: Promise<PurchaseIOS[]>;\n /** Get the currently promoted product (iOS 11+) */\n getPromotedProductIOS?: Promise<(ProductIOS | null)>;\n /** Get base64-encoded receipt data for validation */\n getReceiptDataIOS?: Promise<(string | null)>;\n /** Get the current storefront country code */\n getStorefront: Promise<string>;\n /**\n * Get the current App Store storefront country code\n * @deprecated Use getStorefront\n */\n getStorefrontIOS: Promise<string>;\n /** Get the transaction JWS (StoreKit 2) */\n getTransactionJwsIOS?: Promise<(string | null)>;\n /** Check whether the user has active subscriptions */\n hasActiveSubscriptions: Promise<boolean>;\n /** Check introductory offer eligibility for a subscription group */\n isEligibleForIntroOfferIOS: Promise<boolean>;\n /** Verify a StoreKit 2 transaction signature */\n isTransactionVerifiedIOS: Promise<boolean>;\n /** Get the latest transaction for a product using StoreKit 2 */\n latestTransactionIOS?: Promise<(PurchaseIOS | null)>;\n /** Get StoreKit 2 subscription status details (iOS 15+) */\n subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;\n /**\n * Validate a receipt for a specific product\n * @deprecated Use verifyPurchase\n */\n validateReceiptIOS: Promise<VerifyPurchaseResultIOS>;\n}\n\n\n\nexport type QueryCurrentEntitlementIosArgs = string;\n\nexport type QueryFetchProductsArgs = ProductRequest;\n\nexport type QueryGetActiveSubscriptionsArgs = (string[] | null) | undefined;\n\nexport type QueryGetAvailablePurchasesArgs = (PurchaseOptions | null) | undefined;\n\nexport type QueryGetTransactionJwsIosArgs = string;\n\nexport type QueryHasActiveSubscriptionsArgs = (string[] | null) | undefined;\n\nexport type QueryIsEligibleForIntroOfferIosArgs = string;\n\nexport type QueryIsTransactionVerifiedIosArgs = string;\n\nexport type QueryLatestTransactionIosArgs = string;\n\nexport type QuerySubscriptionStatusIosArgs = string;\n\nexport type QueryValidateReceiptIosArgs = VerifyPurchaseProps;\n\nexport interface RefundResultIOS {\n message?: (string | null);\n status: string;\n}\n\n/**\n * Subscription renewal information from Product.SubscriptionInfo.RenewalInfo\n * https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo\n */\nexport interface RenewalInfoIOS {\n autoRenewPreference?: (string | null);\n /**\n * When subscription expires due to cancellation/billing issue\n * Possible values: \"VOLUNTARY\", \"BILLING_ERROR\", \"DID_NOT_AGREE_TO_PRICE_INCREASE\", \"PRODUCT_NOT_AVAILABLE\", \"UNKNOWN\"\n */\n expirationReason?: (string | null);\n /**\n * Grace period expiration date (milliseconds since epoch)\n * When set, subscription is in grace period (billing issue but still has access)\n */\n gracePeriodExpirationDate?: (number | null);\n /**\n * True if subscription failed to renew due to billing issue and is retrying\n * Note: Not directly available in RenewalInfo, available in Status\n */\n isInBillingRetry?: (boolean | null);\n jsonRepresentation?: (string | null);\n /**\n * Product ID that will be used on next renewal (when user upgrades/downgrades)\n * If set and different from current productId, subscription will change on expiration\n */\n pendingUpgradeProductId?: (string | null);\n /**\n * User's response to subscription price increase\n * Possible values: \"AGREED\", \"PENDING\", null (no price increase)\n */\n priceIncreaseStatus?: (string | null);\n /**\n * Expected renewal date (milliseconds since epoch)\n * For active subscriptions, when the next renewal/charge will occur\n */\n renewalDate?: (number | null);\n /** Offer ID applied to next renewal (promotional offer, subscription offer code, etc.) */\n renewalOfferId?: (string | null);\n /**\n * Type of offer applied to next renewal\n * Possible values: \"PROMOTIONAL\", \"SUBSCRIPTION_OFFER_CODE\", \"WIN_BACK\", etc.\n */\n renewalOfferType?: (string | null);\n willAutoRenew: boolean;\n}\n\nexport interface RequestPurchaseAndroidProps {\n /** Personalized offer flag */\n isOfferPersonalized?: (boolean | null);\n /** Obfuscated account ID */\n obfuscatedAccountIdAndroid?: (string | null);\n /** Obfuscated profile ID */\n obfuscatedProfileIdAndroid?: (string | null);\n /** List of product SKUs */\n skus: string[];\n}\n\nexport interface RequestPurchaseIosProps {\n /** Auto-finish transaction (dangerous) */\n andDangerouslyFinishTransactionAutomatically?: (boolean | null);\n /** App account token for user tracking */\n appAccountToken?: (string | null);\n /** Purchase quantity */\n quantity?: (number | null);\n /** Product SKU */\n sku: string;\n /** Discount offer to apply */\n withOffer?: (DiscountOfferInputIOS | null);\n}\n\nexport type RequestPurchaseProps =\n | {\n /** Per-platform purchase request props */\n request: RequestPurchasePropsByPlatforms;\n type: 'in-app';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n }\n | {\n /** Per-platform subscription request props */\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n };\n\nexport interface RequestPurchasePropsByPlatforms {\n /** Android-specific purchase parameters */\n android?: (RequestPurchaseAndroidProps | null);\n /** iOS-specific purchase parameters */\n ios?: (RequestPurchaseIosProps | null);\n}\n\nexport type RequestPurchaseResult = Purchase | Purchase[] | null;\n\nexport interface RequestSubscriptionAndroidProps {\n /** Personalized offer flag */\n isOfferPersonalized?: (boolean | null);\n /** Obfuscated account ID */\n obfuscatedAccountIdAndroid?: (string | null);\n /** Obfuscated profile ID */\n obfuscatedProfileIdAndroid?: (string | null);\n /** Purchase token for upgrades/downgrades */\n purchaseTokenAndroid?: (string | null);\n /** Replacement mode for subscription changes */\n replacementModeAndroid?: (number | null);\n /** List of subscription SKUs */\n skus: string[];\n /** Subscription offers */\n subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);\n}\n\nexport interface RequestSubscriptionIosProps {\n andDangerouslyFinishTransactionAutomatically?: (boolean | null);\n appAccountToken?: (string | null);\n quantity?: (number | null);\n sku: string;\n withOffer?: (DiscountOfferInputIOS | null);\n}\n\nexport interface RequestSubscriptionPropsByPlatforms {\n /** Android-specific subscription parameters */\n android?: (RequestSubscriptionAndroidProps | null);\n /** iOS-specific subscription parameters */\n ios?: (RequestSubscriptionIosProps | null);\n}\n\nexport interface RequestVerifyPurchaseWithIapkitAppleProps {\n /** The JWS token returned with the purchase response. */\n jws: string;\n}\n\nexport interface RequestVerifyPurchaseWithIapkitGoogleProps {\n /** The token provided to the user's device when the product or subscription was purchased. */\n purchaseToken: string;\n}\n\nexport interface RequestVerifyPurchaseWithIapkitProps {\n /** API key used for the Authorization header (Bearer {apiKey}). */\n apiKey?: (string | null);\n /** Apple verification parameters. */\n apple?: (RequestVerifyPurchaseWithIapkitAppleProps | null);\n /** Google verification parameters. */\n google?: (RequestVerifyPurchaseWithIapkitGoogleProps | null);\n}\n\nexport interface RequestVerifyPurchaseWithIapkitResult {\n /** Whether the purchase is valid (not falsified). */\n isValid: boolean;\n /** The current state of the purchase. */\n state: IapkitPurchaseState;\n store: IapkitStore;\n}\n\nexport interface Subscription {\n /** Fires when the App Store surfaces a promoted product (iOS only) */\n promotedProductIOS: string;\n /** Fires when a purchase fails or is cancelled */\n purchaseError: PurchaseError;\n /** Fires when a purchase completes successfully or a pending purchase resolves */\n purchaseUpdated: Purchase;\n /**\n * Fires when a user selects alternative billing in the User Choice Billing dialog (Android only)\n * Only triggered when the user selects alternative billing instead of Google Play billing\n */\n userChoiceBillingAndroid: UserChoiceBillingDetails;\n}\n\n\nexport interface SubscriptionInfoIOS {\n introductoryOffer?: (SubscriptionOfferIOS | null);\n promotionalOffers?: (SubscriptionOfferIOS[] | null);\n subscriptionGroupId: string;\n subscriptionPeriod: SubscriptionPeriodValueIOS;\n}\n\nexport interface SubscriptionOfferIOS {\n displayPrice: string;\n id: string;\n paymentMode: PaymentModeIOS;\n period: SubscriptionPeriodValueIOS;\n periodCount: number;\n price: number;\n type: SubscriptionOfferTypeIOS;\n}\n\nexport type SubscriptionOfferTypeIOS = 'introductory' | 'promotional';\n\nexport type SubscriptionPeriodIOS = 'day' | 'week' | 'month' | 'year' | 'empty';\n\nexport interface SubscriptionPeriodValueIOS {\n unit: SubscriptionPeriodIOS;\n value: number;\n}\n\nexport interface SubscriptionStatusIOS {\n renewalInfo?: (RenewalInfoIOS | null);\n state: string;\n}\n\n/**\n * User Choice Billing event details (Android)\n * Fired when a user selects alternative billing in the User Choice Billing dialog\n */\nexport interface UserChoiceBillingDetails {\n /** Token that must be reported to Google Play within 24 hours */\n externalTransactionToken: string;\n /** List of product IDs selected by the user */\n products: string[];\n}\n\nexport interface VerifyPurchaseAndroidOptions {\n accessToken: string;\n isSub?: (boolean | null);\n packageName: string;\n productToken: string;\n}\n\nexport interface VerifyPurchaseProps {\n /** Android-specific validation options */\n androidOptions?: (VerifyPurchaseAndroidOptions | null);\n /** Product SKU to validate */\n sku: string;\n}\n\nexport type VerifyPurchaseResult = VerifyPurchaseResultAndroid | VerifyPurchaseResultIOS;\n\nexport interface VerifyPurchaseResultAndroid {\n autoRenewing: boolean;\n betaProduct: boolean;\n cancelDate?: (number | null);\n cancelReason?: (string | null);\n deferredDate?: (number | null);\n deferredSku?: (string | null);\n freeTrialEndDate: number;\n gracePeriodEndDate: number;\n parentProductId: string;\n productId: string;\n productType: string;\n purchaseDate: number;\n quantity: number;\n receiptId: string;\n renewalDate: number;\n term: string;\n termSku: string;\n testTransaction: boolean;\n}\n\nexport interface VerifyPurchaseResultIOS {\n /** Whether the receipt is valid */\n isValid: boolean;\n /** JWS representation */\n jwsRepresentation: string;\n /** Latest transaction if available */\n latestTransaction?: (Purchase | null);\n /** Receipt data string */\n receiptData: string;\n}\n\nexport interface VerifyPurchaseWithProviderProps {\n iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);\n provider: PurchaseVerificationProvider;\n}\n\nexport interface VerifyPurchaseWithProviderResult {\n /** IAPKit verification results (can include Apple and Google entries) */\n iapkit: RequestVerifyPurchaseWithIapkitResult[];\n provider: PurchaseVerificationProvider;\n}\n\nexport type VoidResult = void;\n\n// -- Query helper types (auto-generated)\nexport type QueryArgsMap = {\n canPresentExternalPurchaseNoticeIOS: never;\n currentEntitlementIOS: QueryCurrentEntitlementIosArgs;\n fetchProducts: QueryFetchProductsArgs;\n getActiveSubscriptions: QueryGetActiveSubscriptionsArgs;\n getAppTransactionIOS: never;\n getAvailablePurchases: QueryGetAvailablePurchasesArgs;\n getPendingTransactionsIOS: never;\n getPromotedProductIOS: never;\n getReceiptDataIOS: never;\n getStorefront: never;\n getStorefrontIOS: never;\n getTransactionJwsIOS: QueryGetTransactionJwsIosArgs;\n hasActiveSubscriptions: QueryHasActiveSubscriptionsArgs;\n isEligibleForIntroOfferIOS: QueryIsEligibleForIntroOfferIosArgs;\n isTransactionVerifiedIOS: QueryIsTransactionVerifiedIosArgs;\n latestTransactionIOS: QueryLatestTransactionIosArgs;\n subscriptionStatusIOS: QuerySubscriptionStatusIosArgs;\n validateReceiptIOS: QueryValidateReceiptIosArgs;\n};\n\nexport type QueryField<K extends keyof Query> =\n QueryArgsMap[K] extends never\n ? () => NonNullable<Query[K]>\n : undefined extends QueryArgsMap[K]\n ? (args?: QueryArgsMap[K]) => NonNullable<Query[K]>\n : (args: QueryArgsMap[K]) => NonNullable<Query[K]>;\n\nexport type QueryFieldMap = {\n [K in keyof Query]?: QueryField<K>;\n};\n// -- End query helper types\n\n// -- Mutation helper types (auto-generated)\nexport type MutationArgsMap = {\n acknowledgePurchaseAndroid: MutationAcknowledgePurchaseAndroidArgs;\n beginRefundRequestIOS: MutationBeginRefundRequestIosArgs;\n checkAlternativeBillingAvailabilityAndroid: never;\n clearTransactionIOS: never;\n consumePurchaseAndroid: MutationConsumePurchaseAndroidArgs;\n createAlternativeBillingTokenAndroid: never;\n deepLinkToSubscriptions: MutationDeepLinkToSubscriptionsArgs;\n endConnection: never;\n finishTransaction: MutationFinishTransactionArgs;\n initConnection: MutationInitConnectionArgs;\n presentCodeRedemptionSheetIOS: never;\n presentExternalPurchaseLinkIOS: MutationPresentExternalPurchaseLinkIosArgs;\n presentExternalPurchaseNoticeSheetIOS: never;\n requestPurchase: MutationRequestPurchaseArgs;\n requestPurchaseOnPromotedProductIOS: never;\n restorePurchases: never;\n showAlternativeBillingDialogAndroid: never;\n showManageSubscriptionsIOS: never;\n syncIOS: never;\n validateReceipt: MutationValidateReceiptArgs;\n verifyPurchase: MutationVerifyPurchaseArgs;\n verifyPurchaseWithProvider: MutationVerifyPurchaseWithProviderArgs;\n};\n\nexport type MutationField<K extends keyof Mutation> =\n MutationArgsMap[K] extends never\n ? () => NonNullable<Mutation[K]>\n : undefined extends MutationArgsMap[K]\n ? (args?: MutationArgsMap[K]) => NonNullable<Mutation[K]>\n : (args: MutationArgsMap[K]) => NonNullable<Mutation[K]>;\n\nexport type MutationFieldMap = {\n [K in keyof Mutation]?: MutationField<K>;\n};\n// -- End mutation helper types\n\n// -- Subscription helper types (auto-generated)\nexport type SubscriptionArgsMap = {\n promotedProductIOS: never;\n purchaseError: never;\n purchaseUpdated: never;\n userChoiceBillingAndroid: never;\n};\n\nexport type SubscriptionField<K extends keyof Subscription> =\n SubscriptionArgsMap[K] extends never\n ? () => NonNullable<Subscription[K]>\n : undefined extends SubscriptionArgsMap[K]\n ? (args?: SubscriptionArgsMap[K]) => NonNullable<Subscription[K]>\n : (args: SubscriptionArgsMap[K]) => NonNullable<Subscription[K]>;\n\nexport type SubscriptionFieldMap = {\n [K in keyof Subscription]?: SubscriptionField<K>;\n};\n// -- End subscription helper types\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8CAA8C;AAC9C,yEAAyE;AACzE,+EAA+E;AAkH/E,MAAM,CAAN,IAAY,SAsCX;AAtCD,WAAY,SAAS;IACnB,yDAA4C,CAAA;IAC5C,2CAA8B,CAAA;IAC9B,iDAAoC,CAAA;IACpC,gFAAmE,CAAA;IACnE,uDAA0C,CAAA;IAC1C,mDAAsC,CAAA;IACtC,iDAAoC,CAAA;IACpC,+CAAkC,CAAA;IAClC,4CAA+B,CAAA;IAC/B,0DAA6C,CAAA;IAC7C,kDAAqC,CAAA;IACrC,+CAAkC,CAAA;IAClC,wCAA2B,CAAA;IAC3B,4CAA+B,CAAA;IAC/B,iDAAoC,CAAA;IACpC,2CAA8B,CAAA;IAC9B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;IAChC,wEAA2D,CAAA;IAC3D,qFAAwE,CAAA;IACxE,4EAA+D,CAAA;IAC/D,2CAA8B,CAAA;IAC9B,6CAAgC,CAAA;IAChC,iDAAoC,CAAA;IACpC,8DAAiD,CAAA;IACjD,yCAA4B,CAAA;IAC5B,yDAA4C,CAAA;IAC5C,2CAA8B,CAAA;IAC9B,0CAA6B,CAAA;IAC7B,oDAAuC,CAAA;IACvC,qCAAwB,CAAA;IACxB,0EAA6D,CAAA;IAC7D,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;IAChC,qCAAwB,CAAA;AAC1B,CAAC,EAtCW,SAAS,KAAT,SAAS,QAsCpB;AAi2BD,mCAAmC","sourcesContent":["// ============================================================================\n// AUTO-GENERATED TYPES — DO NOT EDIT DIRECTLY\n// Run `bun run generate:types` after updating any *.graphql schema file.\n// ============================================================================\n\nexport interface ActiveSubscription {\n autoRenewingAndroid?: (boolean | null);\n basePlanIdAndroid?: (string | null);\n /**\n * The current plan identifier. This is:\n * - On Android: the basePlanId (e.g., \"premium\", \"premium-year\")\n * - On iOS: the productId (e.g., \"com.example.premium_monthly\", \"com.example.premium_yearly\")\n * This provides a unified way to identify which specific plan/tier the user is subscribed to.\n */\n currentPlanId?: (string | null);\n daysUntilExpirationIOS?: (number | null);\n environmentIOS?: (string | null);\n expirationDateIOS?: (number | null);\n isActive: boolean;\n productId: string;\n purchaseToken?: (string | null);\n /** Required for subscription upgrade/downgrade on Android */\n purchaseTokenAndroid?: (string | null);\n /**\n * Renewal information from StoreKit 2 (iOS only). Contains details about subscription renewal status,\n * pending upgrades/downgrades, and auto-renewal preferences.\n */\n renewalInfoIOS?: (RenewalInfoIOS | null);\n transactionDate: number;\n transactionId: string;\n /**\n * @deprecated iOS only - use daysUntilExpirationIOS instead.\n * Whether the subscription will expire soon (within 7 days).\n * Consider using daysUntilExpirationIOS for more precise control.\n */\n willExpireSoon?: (boolean | null);\n}\n\n/**\n * Alternative billing mode for Android\n * Controls which billing system is used\n */\nexport type AlternativeBillingModeAndroid = 'none' | 'user-choice' | 'alternative-only';\n\nexport interface AndroidSubscriptionOfferInput {\n /** Offer token */\n offerToken: string;\n /** Product SKU */\n sku: string;\n}\n\nexport interface AppTransaction {\n appId: number;\n appTransactionId?: (string | null);\n appVersion: string;\n appVersionId: number;\n bundleId: string;\n deviceVerification: string;\n deviceVerificationNonce: string;\n environment: string;\n originalAppVersion: string;\n originalPlatform?: (string | null);\n originalPurchaseDate: number;\n preorderDate?: (number | null);\n signedDate: number;\n}\n\nexport interface DeepLinkOptions {\n /** Android package name to target (required on Android) */\n packageNameAndroid?: (string | null);\n /** Android SKU to open (required on Android) */\n skuAndroid?: (string | null);\n}\n\nexport interface DiscountIOS {\n identifier: string;\n localizedPrice?: (string | null);\n numberOfPeriods: number;\n paymentMode: PaymentModeIOS;\n price: string;\n priceAmount: number;\n subscriptionPeriod: string;\n type: string;\n}\n\nexport interface DiscountOfferIOS {\n /** Discount identifier */\n identifier: string;\n /** Key identifier for validation */\n keyIdentifier: string;\n /** Cryptographic nonce */\n nonce: string;\n /** Signature for validation */\n signature: string;\n /** Timestamp of discount offer */\n timestamp: number;\n}\n\nexport interface DiscountOfferInputIOS {\n /** Discount identifier */\n identifier: string;\n /** Key identifier for validation */\n keyIdentifier: string;\n /** Cryptographic nonce */\n nonce: string;\n /** Signature for validation */\n signature: string;\n /** Timestamp of discount offer */\n timestamp: number;\n}\n\nexport interface EntitlementIOS {\n jsonRepresentation: string;\n sku: string;\n transactionId: string;\n}\n\nexport enum ErrorCode {\n ActivityUnavailable = 'activity-unavailable',\n AlreadyOwned = 'already-owned',\n AlreadyPrepared = 'already-prepared',\n BillingResponseJsonParseError = 'billing-response-json-parse-error',\n BillingUnavailable = 'billing-unavailable',\n ConnectionClosed = 'connection-closed',\n DeferredPayment = 'deferred-payment',\n DeveloperError = 'developer-error',\n EmptySkuList = 'empty-sku-list',\n FeatureNotSupported = 'feature-not-supported',\n IapNotAvailable = 'iap-not-available',\n InitConnection = 'init-connection',\n Interrupted = 'interrupted',\n ItemNotOwned = 'item-not-owned',\n ItemUnavailable = 'item-unavailable',\n NetworkError = 'network-error',\n NotEnded = 'not-ended',\n NotPrepared = 'not-prepared',\n Pending = 'pending',\n PurchaseError = 'purchase-error',\n PurchaseVerificationFailed = 'purchase-verification-failed',\n PurchaseVerificationFinishFailed = 'purchase-verification-finish-failed',\n PurchaseVerificationFinished = 'purchase-verification-finished',\n QueryProduct = 'query-product',\n ReceiptFailed = 'receipt-failed',\n ReceiptFinished = 'receipt-finished',\n ReceiptFinishedFailed = 'receipt-finished-failed',\n RemoteError = 'remote-error',\n ServiceDisconnected = 'service-disconnected',\n ServiceError = 'service-error',\n SkuNotFound = 'sku-not-found',\n SkuOfferMismatch = 'sku-offer-mismatch',\n SyncError = 'sync-error',\n TransactionValidationFailed = 'transaction-validation-failed',\n Unknown = 'unknown',\n UserCancelled = 'user-cancelled',\n UserError = 'user-error'\n}\n\n/** Result of presenting an external purchase link (iOS 18.2+) */\nexport interface ExternalPurchaseLinkResultIOS {\n /** Optional error message if the presentation failed */\n error?: (string | null);\n /** Whether the user completed the external purchase flow */\n success: boolean;\n}\n\n/** User actions on external purchase notice sheet (iOS 18.2+) */\nexport type ExternalPurchaseNoticeAction = 'continue' | 'dismissed';\n\n/** Result of presenting external purchase notice sheet (iOS 18.2+) */\nexport interface ExternalPurchaseNoticeResultIOS {\n /** Optional error message if the presentation failed */\n error?: (string | null);\n /** Notice result indicating user action */\n result: ExternalPurchaseNoticeAction;\n}\n\nexport type FetchProductsResult = ProductOrSubscription[] | Product[] | ProductSubscription[] | null;\n\nexport type IapEvent = 'purchase-updated' | 'purchase-error' | 'promoted-product-ios' | 'user-choice-billing-android';\n\nexport type IapPlatform = 'ios' | 'android';\n\nexport type IapStore = 'unknown' | 'apple' | 'google' | 'horizon';\n\n/** Unified purchase states from IAPKit verification response. */\nexport type IapkitPurchaseState = 'entitled' | 'pending-acknowledgment' | 'pending' | 'canceled' | 'expired' | 'ready-to-consume' | 'consumed' | 'unknown' | 'inauthentic';\n\n/** Connection initialization configuration */\nexport interface InitConnectionConfig {\n /**\n * Alternative billing mode for Android\n * If not specified, defaults to NONE (standard Google Play billing)\n */\n alternativeBillingModeAndroid?: (AlternativeBillingModeAndroid | null);\n}\n\nexport interface Mutation {\n /** Acknowledge a non-consumable purchase or subscription */\n acknowledgePurchaseAndroid: Promise<boolean>;\n /** Initiate a refund request for a product (iOS 15+) */\n beginRefundRequestIOS?: Promise<(string | null)>;\n /**\n * Check if alternative billing is available for this user/device\n * Step 1 of alternative billing flow\n *\n * Returns true if available, false otherwise\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n checkAlternativeBillingAvailabilityAndroid: Promise<boolean>;\n /** Clear pending transactions from the StoreKit payment queue */\n clearTransactionIOS: Promise<boolean>;\n /** Consume a purchase token so it can be repurchased */\n consumePurchaseAndroid: Promise<boolean>;\n /**\n * Create external transaction token for Google Play reporting\n * Step 3 of alternative billing flow\n * Must be called AFTER successful payment in your payment system\n * Token must be reported to Google Play backend within 24 hours\n *\n * Returns token string, or null if creation failed\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n createAlternativeBillingTokenAndroid?: Promise<(string | null)>;\n /** Open the native subscription management surface */\n deepLinkToSubscriptions: Promise<void>;\n /** Close the platform billing connection */\n endConnection: Promise<boolean>;\n /** Finish a transaction after validating receipts */\n finishTransaction: Promise<void>;\n /** Establish the platform billing connection */\n initConnection: Promise<boolean>;\n /** Present the App Store code redemption sheet */\n presentCodeRedemptionSheetIOS: Promise<boolean>;\n /** Present external purchase custom link with StoreKit UI (iOS 18.2+) */\n presentExternalPurchaseLinkIOS: Promise<ExternalPurchaseLinkResultIOS>;\n /** Present external purchase notice sheet (iOS 18.2+) */\n presentExternalPurchaseNoticeSheetIOS: Promise<ExternalPurchaseNoticeResultIOS>;\n /** Initiate a purchase flow; rely on events for final state */\n requestPurchase?: Promise<(Purchase | Purchase[] | null)>;\n /** Purchase the promoted product surfaced by the App Store */\n requestPurchaseOnPromotedProductIOS: Promise<boolean>;\n /** Restore completed purchases across platforms */\n restorePurchases: Promise<void>;\n /**\n * Show alternative billing information dialog to user\n * Step 2 of alternative billing flow\n * Must be called BEFORE processing payment in your payment system\n *\n * Returns true if user accepted, false if user canceled\n * Throws OpenIapError.NotPrepared if billing client not ready\n */\n showAlternativeBillingDialogAndroid: Promise<boolean>;\n /** Open subscription management UI and return changed purchases (iOS 15+) */\n showManageSubscriptionsIOS: Promise<PurchaseIOS[]>;\n /** Force a StoreKit sync for transactions (iOS 15+) */\n syncIOS: Promise<boolean>;\n /**\n * Validate purchase receipts with the configured providers\n * @deprecated Use verifyPurchase\n */\n validateReceipt: Promise<VerifyPurchaseResult>;\n /** Verify purchases with the configured providers */\n verifyPurchase: Promise<VerifyPurchaseResult>;\n /** Verify purchases with a specific provider (e.g., IAPKit) */\n verifyPurchaseWithProvider: Promise<VerifyPurchaseWithProviderResult>;\n}\n\n\n\nexport type MutationAcknowledgePurchaseAndroidArgs = string;\n\nexport type MutationBeginRefundRequestIosArgs = string;\n\nexport type MutationConsumePurchaseAndroidArgs = string;\n\nexport type MutationDeepLinkToSubscriptionsArgs = (DeepLinkOptions | null) | undefined;\n\nexport interface MutationFinishTransactionArgs {\n isConsumable?: (boolean | null);\n purchase: PurchaseInput;\n}\n\n\nexport type MutationInitConnectionArgs = (InitConnectionConfig | null) | undefined;\n\nexport type MutationPresentExternalPurchaseLinkIosArgs = string;\n\nexport type MutationRequestPurchaseArgs =\n | {\n /** Per-platform purchase request props */\n request: RequestPurchasePropsByPlatforms;\n type: 'in-app';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n }\n | {\n /** Per-platform subscription request props */\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n };\n\n\nexport type MutationValidateReceiptArgs = VerifyPurchaseProps;\n\nexport type MutationVerifyPurchaseArgs = VerifyPurchaseProps;\n\nexport type MutationVerifyPurchaseWithProviderArgs = VerifyPurchaseWithProviderProps;\n\nexport type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';\n\nexport interface PricingPhaseAndroid {\n billingCycleCount: number;\n billingPeriod: string;\n formattedPrice: string;\n priceAmountMicros: string;\n priceCurrencyCode: string;\n recurrenceMode: number;\n}\n\nexport interface PricingPhasesAndroid {\n pricingPhaseList: PricingPhaseAndroid[];\n}\n\nexport type Product = ProductAndroid | ProductIOS;\n\nexport interface ProductAndroid extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);\n platform: 'android';\n price?: (number | null);\n subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);\n title: string;\n type: 'in-app';\n}\n\nexport interface ProductAndroidOneTimePurchaseOfferDetail {\n formattedPrice: string;\n priceAmountMicros: string;\n priceCurrencyCode: string;\n}\n\nexport interface ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n platform: 'android' | 'ios';\n price?: (number | null);\n title: string;\n type: 'in-app' | 'subs';\n} \n\nexport interface ProductIOS extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayNameIOS: string;\n displayPrice: string;\n id: string;\n isFamilyShareableIOS: boolean;\n jsonRepresentationIOS: string;\n platform: 'ios';\n price?: (number | null);\n subscriptionInfoIOS?: (SubscriptionInfoIOS | null);\n title: string;\n type: 'in-app';\n typeIOS: ProductTypeIOS;\n}\n\nexport type ProductOrSubscription = Product | ProductSubscription;\n\nexport type ProductQueryType = 'in-app' | 'subs' | 'all';\n\nexport interface ProductRequest {\n skus: string[];\n type?: (ProductQueryType | null);\n}\n\nexport type ProductSubscription = ProductSubscriptionAndroid | ProductSubscriptionIOS;\n\nexport interface ProductSubscriptionAndroid extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n displayName?: (string | null);\n displayPrice: string;\n id: string;\n nameAndroid: string;\n oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);\n platform: 'android';\n price?: (number | null);\n subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];\n title: string;\n type: 'subs';\n}\n\nexport interface ProductSubscriptionAndroidOfferDetails {\n basePlanId: string;\n offerId?: (string | null);\n offerTags: string[];\n offerToken: string;\n pricingPhases: PricingPhasesAndroid;\n}\n\nexport interface ProductSubscriptionIOS extends ProductCommon {\n currency: string;\n debugDescription?: (string | null);\n description: string;\n discountsIOS?: (DiscountIOS[] | null);\n displayName?: (string | null);\n displayNameIOS: string;\n displayPrice: string;\n id: string;\n introductoryPriceAsAmountIOS?: (string | null);\n introductoryPriceIOS?: (string | null);\n introductoryPriceNumberOfPeriodsIOS?: (string | null);\n introductoryPricePaymentModeIOS: PaymentModeIOS;\n introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);\n isFamilyShareableIOS: boolean;\n jsonRepresentationIOS: string;\n platform: 'ios';\n price?: (number | null);\n subscriptionInfoIOS?: (SubscriptionInfoIOS | null);\n subscriptionPeriodNumberIOS?: (string | null);\n subscriptionPeriodUnitIOS?: (SubscriptionPeriodIOS | null);\n title: string;\n type: 'subs';\n typeIOS: ProductTypeIOS;\n}\n\nexport type ProductType = 'in-app' | 'subs';\n\nexport type ProductTypeIOS = 'consumable' | 'non-consumable' | 'auto-renewable-subscription' | 'non-renewing-subscription';\n\nexport type Purchase = PurchaseAndroid | PurchaseIOS;\n\nexport interface PurchaseAndroid extends PurchaseCommon {\n autoRenewingAndroid?: (boolean | null);\n currentPlanId?: (string | null);\n dataAndroid?: (string | null);\n developerPayloadAndroid?: (string | null);\n id: string;\n ids?: (string[] | null);\n isAcknowledgedAndroid?: (boolean | null);\n isAutoRenewing: boolean;\n obfuscatedAccountIdAndroid?: (string | null);\n obfuscatedProfileIdAndroid?: (string | null);\n packageNameAndroid?: (string | null);\n /**\n * @deprecated Use store instead\n * @deprecated Use store instead\n */\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n purchaseToken?: (string | null);\n quantity: number;\n signatureAndroid?: (string | null);\n /** Store where purchase was made */\n store: IapStore;\n transactionDate: number;\n transactionId?: (string | null);\n}\n\nexport interface PurchaseCommon {\n /**\n * The current plan identifier. This is:\n * - On Android: the basePlanId (e.g., \"premium\", \"premium-year\")\n * - On iOS: the productId (e.g., \"com.example.premium_monthly\", \"com.example.premium_yearly\")\n * This provides a unified way to identify which specific plan/tier the user is subscribed to.\n */\n currentPlanId?: (string | null);\n id: string;\n ids?: (string[] | null);\n isAutoRenewing: boolean;\n /**\n * @deprecated Use store instead\n * @deprecated Use store instead\n */\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n /** Unified purchase token (iOS JWS, Android purchaseToken) */\n purchaseToken?: (string | null);\n quantity: number;\n /** Store where purchase was made */\n store: IapStore;\n transactionDate: number;\n}\n\nexport interface PurchaseError {\n code: ErrorCode;\n message: string;\n productId?: (string | null);\n}\n\nexport interface PurchaseIOS extends PurchaseCommon {\n appAccountToken?: (string | null);\n appBundleIdIOS?: (string | null);\n countryCodeIOS?: (string | null);\n currencyCodeIOS?: (string | null);\n currencySymbolIOS?: (string | null);\n currentPlanId?: (string | null);\n environmentIOS?: (string | null);\n expirationDateIOS?: (number | null);\n id: string;\n ids?: (string[] | null);\n isAutoRenewing: boolean;\n isUpgradedIOS?: (boolean | null);\n offerIOS?: (PurchaseOfferIOS | null);\n originalTransactionDateIOS?: (number | null);\n originalTransactionIdentifierIOS?: (string | null);\n ownershipTypeIOS?: (string | null);\n /**\n * @deprecated Use store instead\n * @deprecated Use store instead\n */\n platform: IapPlatform;\n productId: string;\n purchaseState: PurchaseState;\n purchaseToken?: (string | null);\n quantity: number;\n quantityIOS?: (number | null);\n reasonIOS?: (string | null);\n reasonStringRepresentationIOS?: (string | null);\n renewalInfoIOS?: (RenewalInfoIOS | null);\n revocationDateIOS?: (number | null);\n revocationReasonIOS?: (string | null);\n /** Store where purchase was made */\n store: IapStore;\n storefrontCountryCodeIOS?: (string | null);\n subscriptionGroupIdIOS?: (string | null);\n transactionDate: number;\n transactionId: string;\n transactionReasonIOS?: (string | null);\n webOrderLineItemIdIOS?: (string | null);\n}\n\nexport type PurchaseInput = Purchase;\n\nexport interface PurchaseOfferIOS {\n id: string;\n paymentMode: string;\n type: string;\n}\n\nexport interface PurchaseOptions {\n /** Also emit results through the iOS event listeners */\n alsoPublishToEventListenerIOS?: (boolean | null);\n /** Limit to currently active items on iOS */\n onlyIncludeActiveItemsIOS?: (boolean | null);\n}\n\nexport type PurchaseState = 'pending' | 'purchased' | 'failed' | 'restored' | 'deferred' | 'unknown';\n\nexport type PurchaseVerificationProvider = 'iapkit';\n\nexport interface Query {\n /** Check if external purchase notice sheet can be presented (iOS 18.2+) */\n canPresentExternalPurchaseNoticeIOS: Promise<boolean>;\n /** Get current StoreKit 2 entitlements (iOS 15+) */\n currentEntitlementIOS?: Promise<(PurchaseIOS | null)>;\n /** Retrieve products or subscriptions from the store */\n fetchProducts: Promise<(ProductOrSubscription[] | Product[] | ProductSubscription[] | null)>;\n /** Get active subscriptions (filters by subscriptionIds when provided) */\n getActiveSubscriptions: Promise<ActiveSubscription[]>;\n /** Fetch the current app transaction (iOS 16+) */\n getAppTransactionIOS?: Promise<(AppTransaction | null)>;\n /** Get all available purchases for the current user */\n getAvailablePurchases: Promise<Purchase[]>;\n /** Retrieve all pending transactions in the StoreKit queue */\n getPendingTransactionsIOS: Promise<PurchaseIOS[]>;\n /** Get the currently promoted product (iOS 11+) */\n getPromotedProductIOS?: Promise<(ProductIOS | null)>;\n /** Get base64-encoded receipt data for validation */\n getReceiptDataIOS?: Promise<(string | null)>;\n /** Get the current storefront country code */\n getStorefront: Promise<string>;\n /**\n * Get the current App Store storefront country code\n * @deprecated Use getStorefront\n */\n getStorefrontIOS: Promise<string>;\n /** Get the transaction JWS (StoreKit 2) */\n getTransactionJwsIOS?: Promise<(string | null)>;\n /** Check whether the user has active subscriptions */\n hasActiveSubscriptions: Promise<boolean>;\n /** Check introductory offer eligibility for a subscription group */\n isEligibleForIntroOfferIOS: Promise<boolean>;\n /** Verify a StoreKit 2 transaction signature */\n isTransactionVerifiedIOS: Promise<boolean>;\n /** Get the latest transaction for a product using StoreKit 2 */\n latestTransactionIOS?: Promise<(PurchaseIOS | null)>;\n /** Get StoreKit 2 subscription status details (iOS 15+) */\n subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;\n /**\n * Validate a receipt for a specific product\n * @deprecated Use verifyPurchase\n */\n validateReceiptIOS: Promise<VerifyPurchaseResultIOS>;\n}\n\n\n\nexport type QueryCurrentEntitlementIosArgs = string;\n\nexport type QueryFetchProductsArgs = ProductRequest;\n\nexport type QueryGetActiveSubscriptionsArgs = (string[] | null) | undefined;\n\nexport type QueryGetAvailablePurchasesArgs = (PurchaseOptions | null) | undefined;\n\nexport type QueryGetTransactionJwsIosArgs = string;\n\nexport type QueryHasActiveSubscriptionsArgs = (string[] | null) | undefined;\n\nexport type QueryIsEligibleForIntroOfferIosArgs = string;\n\nexport type QueryIsTransactionVerifiedIosArgs = string;\n\nexport type QueryLatestTransactionIosArgs = string;\n\nexport type QuerySubscriptionStatusIosArgs = string;\n\nexport type QueryValidateReceiptIosArgs = VerifyPurchaseProps;\n\nexport interface RefundResultIOS {\n message?: (string | null);\n status: string;\n}\n\n/**\n * Subscription renewal information from Product.SubscriptionInfo.RenewalInfo\n * https://developer.apple.com/documentation/storekit/product/subscriptioninfo/renewalinfo\n */\nexport interface RenewalInfoIOS {\n autoRenewPreference?: (string | null);\n /**\n * When subscription expires due to cancellation/billing issue\n * Possible values: \"VOLUNTARY\", \"BILLING_ERROR\", \"DID_NOT_AGREE_TO_PRICE_INCREASE\", \"PRODUCT_NOT_AVAILABLE\", \"UNKNOWN\"\n */\n expirationReason?: (string | null);\n /**\n * Grace period expiration date (milliseconds since epoch)\n * When set, subscription is in grace period (billing issue but still has access)\n */\n gracePeriodExpirationDate?: (number | null);\n /**\n * True if subscription failed to renew due to billing issue and is retrying\n * Note: Not directly available in RenewalInfo, available in Status\n */\n isInBillingRetry?: (boolean | null);\n jsonRepresentation?: (string | null);\n /**\n * Product ID that will be used on next renewal (when user upgrades/downgrades)\n * If set and different from current productId, subscription will change on expiration\n */\n pendingUpgradeProductId?: (string | null);\n /**\n * User's response to subscription price increase\n * Possible values: \"AGREED\", \"PENDING\", null (no price increase)\n */\n priceIncreaseStatus?: (string | null);\n /**\n * Expected renewal date (milliseconds since epoch)\n * For active subscriptions, when the next renewal/charge will occur\n */\n renewalDate?: (number | null);\n /** Offer ID applied to next renewal (promotional offer, subscription offer code, etc.) */\n renewalOfferId?: (string | null);\n /**\n * Type of offer applied to next renewal\n * Possible values: \"PROMOTIONAL\", \"SUBSCRIPTION_OFFER_CODE\", \"WIN_BACK\", etc.\n */\n renewalOfferType?: (string | null);\n willAutoRenew: boolean;\n}\n\nexport interface RequestPurchaseAndroidProps {\n /** Personalized offer flag */\n isOfferPersonalized?: (boolean | null);\n /** Obfuscated account ID */\n obfuscatedAccountIdAndroid?: (string | null);\n /** Obfuscated profile ID */\n obfuscatedProfileIdAndroid?: (string | null);\n /** List of product SKUs */\n skus: string[];\n}\n\nexport interface RequestPurchaseIosProps {\n /** Auto-finish transaction (dangerous) */\n andDangerouslyFinishTransactionAutomatically?: (boolean | null);\n /** App account token for user tracking */\n appAccountToken?: (string | null);\n /** Purchase quantity */\n quantity?: (number | null);\n /** Product SKU */\n sku: string;\n /** Discount offer to apply */\n withOffer?: (DiscountOfferInputIOS | null);\n}\n\nexport type RequestPurchaseProps =\n | {\n /** Per-platform purchase request props */\n request: RequestPurchasePropsByPlatforms;\n type: 'in-app';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n }\n | {\n /** Per-platform subscription request props */\n request: RequestSubscriptionPropsByPlatforms;\n type: 'subs';\n /** Use alternative billing (Google Play alternative billing, Apple external purchase link) */\n useAlternativeBilling?: boolean | null;\n };\n\nexport interface RequestPurchasePropsByPlatforms {\n /** @deprecated Use google instead */\n android?: (RequestPurchaseAndroidProps | null);\n /** Apple-specific purchase parameters */\n apple?: (RequestPurchaseIosProps | null);\n /** Google-specific purchase parameters */\n google?: (RequestPurchaseAndroidProps | null);\n /** @deprecated Use apple instead */\n ios?: (RequestPurchaseIosProps | null);\n}\n\nexport type RequestPurchaseResult = Purchase | Purchase[] | null;\n\nexport interface RequestSubscriptionAndroidProps {\n /** Personalized offer flag */\n isOfferPersonalized?: (boolean | null);\n /** Obfuscated account ID */\n obfuscatedAccountIdAndroid?: (string | null);\n /** Obfuscated profile ID */\n obfuscatedProfileIdAndroid?: (string | null);\n /** Purchase token for upgrades/downgrades */\n purchaseTokenAndroid?: (string | null);\n /** Replacement mode for subscription changes */\n replacementModeAndroid?: (number | null);\n /** List of subscription SKUs */\n skus: string[];\n /** Subscription offers */\n subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);\n}\n\nexport interface RequestSubscriptionIosProps {\n andDangerouslyFinishTransactionAutomatically?: (boolean | null);\n appAccountToken?: (string | null);\n quantity?: (number | null);\n sku: string;\n withOffer?: (DiscountOfferInputIOS | null);\n}\n\nexport interface RequestSubscriptionPropsByPlatforms {\n /** @deprecated Use google instead */\n android?: (RequestSubscriptionAndroidProps | null);\n /** Apple-specific subscription parameters */\n apple?: (RequestSubscriptionIosProps | null);\n /** Google-specific subscription parameters */\n google?: (RequestSubscriptionAndroidProps | null);\n /** @deprecated Use apple instead */\n ios?: (RequestSubscriptionIosProps | null);\n}\n\nexport interface RequestVerifyPurchaseWithIapkitAppleProps {\n /** The JWS token returned with the purchase response. */\n jws: string;\n}\n\nexport interface RequestVerifyPurchaseWithIapkitGoogleProps {\n /** The token provided to the user's device when the product or subscription was purchased. */\n purchaseToken: string;\n}\n\nexport interface RequestVerifyPurchaseWithIapkitProps {\n /** API key used for the Authorization header (Bearer {apiKey}). */\n apiKey?: (string | null);\n /** Apple verification parameters. */\n apple?: (RequestVerifyPurchaseWithIapkitAppleProps | null);\n /** Google verification parameters. */\n google?: (RequestVerifyPurchaseWithIapkitGoogleProps | null);\n}\n\nexport interface RequestVerifyPurchaseWithIapkitResult {\n /** Whether the purchase is valid (not falsified). */\n isValid: boolean;\n /** The current state of the purchase. */\n state: IapkitPurchaseState;\n store: IapStore;\n}\n\nexport interface Subscription {\n /** Fires when the App Store surfaces a promoted product (iOS only) */\n promotedProductIOS: string;\n /** Fires when a purchase fails or is cancelled */\n purchaseError: PurchaseError;\n /** Fires when a purchase completes successfully or a pending purchase resolves */\n purchaseUpdated: Purchase;\n /**\n * Fires when a user selects alternative billing in the User Choice Billing dialog (Android only)\n * Only triggered when the user selects alternative billing instead of Google Play billing\n */\n userChoiceBillingAndroid: UserChoiceBillingDetails;\n}\n\n\nexport interface SubscriptionInfoIOS {\n introductoryOffer?: (SubscriptionOfferIOS | null);\n promotionalOffers?: (SubscriptionOfferIOS[] | null);\n subscriptionGroupId: string;\n subscriptionPeriod: SubscriptionPeriodValueIOS;\n}\n\nexport interface SubscriptionOfferIOS {\n displayPrice: string;\n id: string;\n paymentMode: PaymentModeIOS;\n period: SubscriptionPeriodValueIOS;\n periodCount: number;\n price: number;\n type: SubscriptionOfferTypeIOS;\n}\n\nexport type SubscriptionOfferTypeIOS = 'introductory' | 'promotional';\n\nexport type SubscriptionPeriodIOS = 'day' | 'week' | 'month' | 'year' | 'empty';\n\nexport interface SubscriptionPeriodValueIOS {\n unit: SubscriptionPeriodIOS;\n value: number;\n}\n\nexport interface SubscriptionStatusIOS {\n renewalInfo?: (RenewalInfoIOS | null);\n state: string;\n}\n\n/**\n * User Choice Billing event details (Android)\n * Fired when a user selects alternative billing in the User Choice Billing dialog\n */\nexport interface UserChoiceBillingDetails {\n /** Token that must be reported to Google Play within 24 hours */\n externalTransactionToken: string;\n /** List of product IDs selected by the user */\n products: string[];\n}\n\nexport interface VerifyPurchaseAndroidOptions {\n accessToken: string;\n isSub?: (boolean | null);\n packageName: string;\n productToken: string;\n}\n\nexport interface VerifyPurchaseProps {\n /** Android-specific validation options */\n androidOptions?: (VerifyPurchaseAndroidOptions | null);\n /** Product SKU to validate */\n sku: string;\n}\n\nexport type VerifyPurchaseResult = VerifyPurchaseResultAndroid | VerifyPurchaseResultIOS;\n\nexport interface VerifyPurchaseResultAndroid {\n autoRenewing: boolean;\n betaProduct: boolean;\n cancelDate?: (number | null);\n cancelReason?: (string | null);\n deferredDate?: (number | null);\n deferredSku?: (string | null);\n freeTrialEndDate: number;\n gracePeriodEndDate: number;\n parentProductId: string;\n productId: string;\n productType: string;\n purchaseDate: number;\n quantity: number;\n receiptId: string;\n renewalDate: number;\n term: string;\n termSku: string;\n testTransaction: boolean;\n}\n\nexport interface VerifyPurchaseResultIOS {\n /** Whether the receipt is valid */\n isValid: boolean;\n /** JWS representation */\n jwsRepresentation: string;\n /** Latest transaction if available */\n latestTransaction?: (Purchase | null);\n /** Receipt data string */\n receiptData: string;\n}\n\nexport interface VerifyPurchaseWithProviderError {\n code?: (string | null);\n message: string;\n}\n\nexport interface VerifyPurchaseWithProviderProps {\n iapkit?: (RequestVerifyPurchaseWithIapkitProps | null);\n provider: PurchaseVerificationProvider;\n}\n\nexport interface VerifyPurchaseWithProviderResult {\n /** Error details if verification failed */\n errors?: (VerifyPurchaseWithProviderError[] | null);\n /** IAPKit verification result */\n iapkit?: (RequestVerifyPurchaseWithIapkitResult | null);\n provider: PurchaseVerificationProvider;\n}\n\nexport type VoidResult = void;\n\n// -- Query helper types (auto-generated)\nexport type QueryArgsMap = {\n canPresentExternalPurchaseNoticeIOS: never;\n currentEntitlementIOS: QueryCurrentEntitlementIosArgs;\n fetchProducts: QueryFetchProductsArgs;\n getActiveSubscriptions: QueryGetActiveSubscriptionsArgs;\n getAppTransactionIOS: never;\n getAvailablePurchases: QueryGetAvailablePurchasesArgs;\n getPendingTransactionsIOS: never;\n getPromotedProductIOS: never;\n getReceiptDataIOS: never;\n getStorefront: never;\n getStorefrontIOS: never;\n getTransactionJwsIOS: QueryGetTransactionJwsIosArgs;\n hasActiveSubscriptions: QueryHasActiveSubscriptionsArgs;\n isEligibleForIntroOfferIOS: QueryIsEligibleForIntroOfferIosArgs;\n isTransactionVerifiedIOS: QueryIsTransactionVerifiedIosArgs;\n latestTransactionIOS: QueryLatestTransactionIosArgs;\n subscriptionStatusIOS: QuerySubscriptionStatusIosArgs;\n validateReceiptIOS: QueryValidateReceiptIosArgs;\n};\n\nexport type QueryField<K extends keyof Query> =\n QueryArgsMap[K] extends never\n ? () => NonNullable<Query[K]>\n : undefined extends QueryArgsMap[K]\n ? (args?: QueryArgsMap[K]) => NonNullable<Query[K]>\n : (args: QueryArgsMap[K]) => NonNullable<Query[K]>;\n\nexport type QueryFieldMap = {\n [K in keyof Query]?: QueryField<K>;\n};\n// -- End query helper types\n\n// -- Mutation helper types (auto-generated)\nexport type MutationArgsMap = {\n acknowledgePurchaseAndroid: MutationAcknowledgePurchaseAndroidArgs;\n beginRefundRequestIOS: MutationBeginRefundRequestIosArgs;\n checkAlternativeBillingAvailabilityAndroid: never;\n clearTransactionIOS: never;\n consumePurchaseAndroid: MutationConsumePurchaseAndroidArgs;\n createAlternativeBillingTokenAndroid: never;\n deepLinkToSubscriptions: MutationDeepLinkToSubscriptionsArgs;\n endConnection: never;\n finishTransaction: MutationFinishTransactionArgs;\n initConnection: MutationInitConnectionArgs;\n presentCodeRedemptionSheetIOS: never;\n presentExternalPurchaseLinkIOS: MutationPresentExternalPurchaseLinkIosArgs;\n presentExternalPurchaseNoticeSheetIOS: never;\n requestPurchase: MutationRequestPurchaseArgs;\n requestPurchaseOnPromotedProductIOS: never;\n restorePurchases: never;\n showAlternativeBillingDialogAndroid: never;\n showManageSubscriptionsIOS: never;\n syncIOS: never;\n validateReceipt: MutationValidateReceiptArgs;\n verifyPurchase: MutationVerifyPurchaseArgs;\n verifyPurchaseWithProvider: MutationVerifyPurchaseWithProviderArgs;\n};\n\nexport type MutationField<K extends keyof Mutation> =\n MutationArgsMap[K] extends never\n ? () => NonNullable<Mutation[K]>\n : undefined extends MutationArgsMap[K]\n ? (args?: MutationArgsMap[K]) => NonNullable<Mutation[K]>\n : (args: MutationArgsMap[K]) => NonNullable<Mutation[K]>;\n\nexport type MutationFieldMap = {\n [K in keyof Mutation]?: MutationField<K>;\n};\n// -- End mutation helper types\n\n// -- Subscription helper types (auto-generated)\nexport type SubscriptionArgsMap = {\n promotedProductIOS: never;\n purchaseError: never;\n purchaseUpdated: never;\n userChoiceBillingAndroid: never;\n};\n\nexport type SubscriptionField<K extends keyof Subscription> =\n SubscriptionArgsMap[K] extends never\n ? () => NonNullable<Subscription[K]>\n : undefined extends SubscriptionArgsMap[K]\n ? (args?: SubscriptionArgsMap[K]) => NonNullable<Subscription[K]>\n : (args: SubscriptionArgsMap[K]) => NonNullable<Subscription[K]>;\n\nexport type SubscriptionFieldMap = {\n [K in keyof Subscription]?: SubscriptionField<K>;\n};\n// -- End subscription helper types\n"]}
|
package/build/useIAP.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIAP.d.ts","sourceRoot":"","sources":["../src/useIAP.ts"],"names":[],"mappings":"AAMA,OAAO,EAQL,eAAe,IAAI,uBAAuB,EAO1C,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAcjB,OAAO,KAAK,EACV,OAAO,EACP,mBAAmB,EAGnB,QAAQ,EACR,2BAA2B,EAE3B,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAC/B,gCAAgC,EAGjC,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAOxD,KAAK,MAAM,GAAG;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,kBAAkB,EAAE,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C;IAC5D,oCAAoC,EAAE,CACpC,GAAG,CAAC,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IACjD,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACjD,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,6BAA6B,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,kBAAkB,CAAC;CAC7E;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAgZtD"}
|
package/build/useIAP.js
CHANGED
|
@@ -65,7 +65,9 @@ export function useIAP(options) {
|
|
|
65
65
|
purchaseState: purchase.purchaseState,
|
|
66
66
|
purchaseToken: purchase.purchaseToken ?? null,
|
|
67
67
|
quantity: purchase.quantity,
|
|
68
|
+
store: purchase.store,
|
|
68
69
|
transactionDate: purchase.transactionDate,
|
|
70
|
+
transactionId: purchase.transactionId,
|
|
69
71
|
}), []);
|
|
70
72
|
const fetchProductsInternal = useCallback(async (params) => {
|
|
71
73
|
try {
|
package/build/useIAP.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIAP.js","sourceRoot":"","sources":["../src/useIAP.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,mBAAmB;AACnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,IAAI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O,GAAG,EAAE;YACV,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;YAC9C,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,CAAC;YAC7C,oBAAoB,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;YAClD,aAAa,EAAE,CAAC;YAChB,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAE/B,OAAO;QACL,SAAS;QACT,QAAQ;QACR,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB,EAAE,6BAA6B;QACpD,aAAa,EAAE,qBAAqB;QACpC,eAAe,EAAE,wBAAwB;QACzC,eAAe;QACf,cAAc;QACd,0BAA0B;QAC1B,gBAAgB,EAAE,wBAAwB;QAC1C,kDAAkD;QAClD,qBAAqB;QACrB,mCAAmC;QACnC,sBAAsB,EAAE,8BAA8B;QACtD,sBAAsB,EAAE,8BAA8B;QACtD,6CAA6C;QAC7C,0CAA0C;QAC1C,mCAAmC;QACnC,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["// External dependencies\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {Platform} from 'react-native';\nimport {EventSubscription} from 'expo-modules-core';\n\n// Internal modules\nimport {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n promotedProductListenerIOS,\n getAvailablePurchases,\n finishTransaction as finishTransactionInternal,\n requestPurchase as requestPurchaseInternal,\n fetchProducts,\n validateReceipt as validateReceiptInternal,\n verifyPurchase as verifyPurchaseInternal,\n verifyPurchaseWithProvider as verifyPurchaseWithProviderInternal,\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n type ProductTypeInput,\n} from './index';\nimport {ExpoIapConsole} from './utils/debug';\nimport {\n getPromotedProductIOS,\n requestPurchaseOnPromotedProductIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n checkAlternativeBillingAvailabilityAndroid,\n showAlternativeBillingDialogAndroid,\n createAlternativeBillingTokenAndroid,\n} from './modules/android';\n\n// Types\nimport type {\n Product,\n ProductSubscription,\n ProductQueryType,\n ProductRequest,\n Purchase,\n MutationRequestPurchaseArgs,\n PurchaseInput,\n VerifyPurchaseProps,\n VerifyPurchaseResult,\n VerifyPurchaseWithProviderProps,\n VerifyPurchaseWithProviderResult,\n ProductAndroid,\n ProductSubscriptionIOS,\n} from './types';\nimport {ErrorCode} from './types';\nimport type {PurchaseError} from './utils/errorMapping';\nimport {\n getUserFriendlyErrorMessage,\n isUserCancelledError,\n isRecoverableError,\n} from './utils/errorMapping';\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n subscriptions: ProductSubscription[];\n availablePurchases: Purchase[];\n promotedProductIOS?: Product;\n activeSubscriptions: ActiveSubscription[];\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<void>;\n getAvailablePurchases: () => Promise<void>;\n fetchProducts: (params: {\n skus: string[];\n type?: ProductTypeInput;\n }) => Promise<void>;\n\n requestPurchase: (\n params: MutationRequestPurchaseArgs,\n ) => ReturnType<typeof requestPurchaseInternal>;\n /** @deprecated Use verifyPurchase instead */\n validateReceipt: (\n props: VerifyPurchaseProps,\n ) => Promise<VerifyPurchaseResult>;\n verifyPurchase: (props: VerifyPurchaseProps) => Promise<VerifyPurchaseResult>;\n verifyPurchaseWithProvider: (\n props: VerifyPurchaseWithProviderProps,\n ) => Promise<VerifyPurchaseWithProviderResult>;\n restorePurchases: () => Promise<void>;\n getPromotedProductIOS: () => Promise<Product | null>;\n requestPurchaseOnPromotedProductIOS: () => Promise<boolean>;\n getActiveSubscriptions: (subscriptionIds?: string[]) => Promise<void>;\n hasActiveSubscriptions: (subscriptionIds?: string[]) => Promise<boolean>;\n checkAlternativeBillingAvailabilityAndroid: () => Promise<boolean>;\n showAlternativeBillingDialogAndroid: () => Promise<boolean>;\n createAlternativeBillingTokenAndroid: (\n sku?: string,\n ) => Promise<string | null>;\n};\n\nexport interface UseIAPOptions {\n onPurchaseSuccess?: (purchase: Purchase) => void;\n onPurchaseError?: (error: PurchaseError) => void;\n onPromotedProductIOS?: (product: Product) => void;\n /**\n * Alternative billing mode for Android\n * If not specified, defaults to NONE (standard Google Play billing)\n */\n alternativeBillingModeAndroid?: 'none' | 'user-choice' | 'alternative-only';\n}\n\n/**\n * React Hook for managing In-App Purchases.\n * See documentation at https://hyochan.github.io/expo-iap/docs/hooks/useIAP\n */\nexport function useIAP(options?: UseIAPOptions): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [subscriptions, setSubscriptions] = useState<ProductSubscription[]>([]);\n\n const [availablePurchases, setAvailablePurchases] = useState<Purchase[]>([]);\n const [promotedProductIOS, setPromotedProductIOS] = useState<Product>();\n const [activeSubscriptions, setActiveSubscriptions] = useState<\n ActiveSubscription[]\n >([]);\n\n const optionsRef = useRef<UseIAPOptions | undefined>(options);\n const connectedRef = useRef<boolean>(false);\n\n // Helper function to merge arrays with duplicate checking\n const mergeWithDuplicateCheck = useCallback(\n <T>(\n existingItems: T[],\n newItems: T[],\n getKey: (item: T) => string,\n ): T[] => {\n const merged = [...existingItems];\n newItems.forEach((newItem) => {\n const isDuplicate = merged.some(\n (existingItem) => getKey(existingItem) === getKey(newItem),\n );\n if (!isDuplicate) {\n merged.push(newItem);\n }\n });\n return merged;\n },\n [],\n );\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n useEffect(() => {\n connectedRef.current = connected;\n }, [connected]);\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: EventSubscription;\n purchaseError?: EventSubscription;\n promotedProductIOS?: EventSubscription;\n }>({});\n\n const subscriptionsRefState = useRef<ProductSubscription[]>([]);\n\n useEffect(() => {\n subscriptionsRefState.current = subscriptions;\n }, [subscriptions]);\n\n const normalizeProductQueryType = useCallback(\n (type?: ProductTypeInput): ProductQueryType => {\n if (!type || type === 'inapp' || type === 'in-app') {\n return 'in-app';\n }\n return type;\n },\n [],\n );\n\n const canonicalProductType = useCallback(\n (value?: string): ProductQueryType => {\n if (!value) {\n return 'in-app';\n }\n\n const normalized = value.trim().toLowerCase().replace(/[_-]/g, '');\n return normalized === 'subs' ? 'subs' : 'in-app';\n },\n [],\n );\n\n const toPurchaseInput = useCallback(\n (purchase: Purchase): PurchaseInput => ({\n id: purchase.id,\n ids: purchase.ids ?? undefined,\n isAutoRenewing: purchase.isAutoRenewing,\n platform: purchase.platform,\n productId: purchase.productId,\n purchaseState: purchase.purchaseState,\n purchaseToken: purchase.purchaseToken ?? null,\n quantity: purchase.quantity,\n transactionDate: purchase.transactionDate,\n }),\n [],\n );\n\n const fetchProductsInternal = useCallback(\n async (params: {\n skus: string[];\n type?: ProductTypeInput;\n }): Promise<void> => {\n try {\n const queryType = normalizeProductQueryType(params.type);\n const request: ProductRequest = {skus: params.skus, type: queryType};\n const result = await fetchProducts(request);\n const items = (result ?? []) as (Product | ProductSubscription)[];\n\n ExpoIapConsole.debug('Fetched products:', items);\n\n if (queryType === 'subs') {\n const subscriptionsResult = items as ProductSubscription[];\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionsResult,\n (subscription) => subscription.id,\n ),\n );\n } else if (queryType === 'in-app') {\n const productsResult = items as Product[];\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productsResult,\n (product) => product.id,\n ),\n );\n } else {\n // For 'all' type, need to properly distinguish between products and subscriptions\n // On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription\n const productItems = items.filter((item) => {\n // iOS: check type\n if (Platform.OS === 'ios') {\n return canonicalProductType(item.type as string) === 'in-app';\n }\n // Android: check if it has actual subscription details\n const androidItem = item as ProductAndroid;\n return (\n !androidItem.subscriptionOfferDetailsAndroid ||\n (Array.isArray(androidItem.subscriptionOfferDetailsAndroid) &&\n androidItem.subscriptionOfferDetailsAndroid.length === 0)\n );\n }) as Product[];\n\n const subscriptionItems = items.filter((item) => {\n // iOS: check type\n if (Platform.OS === 'ios') {\n return (\n canonicalProductType(\n item.type as ProductSubscriptionIOS['type'],\n ) === 'subs'\n );\n }\n // Android: check if it has actual subscription details\n const androidItem = item as ProductAndroid;\n\n return (\n androidItem.subscriptionOfferDetailsAndroid &&\n Array.isArray(androidItem.subscriptionOfferDetailsAndroid) &&\n androidItem.subscriptionOfferDetailsAndroid.length > 0\n );\n }) as ProductSubscription[];\n\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productItems,\n (product) => product.id,\n ),\n );\n\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionItems,\n (subscription) => subscription.id,\n ),\n );\n }\n } catch (error) {\n ExpoIapConsole.error('Error fetching products:', error);\n }\n },\n [canonicalProductType, mergeWithDuplicateCheck, normalizeProductQueryType],\n );\n\n const getAvailablePurchasesInternal = useCallback(async (): Promise<void> => {\n try {\n const result = await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n setAvailablePurchases(result);\n } catch (error) {\n ExpoIapConsole.error('Error fetching available purchases:', error);\n }\n }, []);\n\n const getActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<void> => {\n try {\n const result = await getActiveSubscriptions(subscriptionIds);\n setActiveSubscriptions(result);\n } catch (error) {\n ExpoIapConsole.error('Error getting active subscriptions:', error);\n // Preserve existing state on error\n }\n },\n [],\n );\n\n const hasActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<boolean> => {\n try {\n return await hasActiveSubscriptions(subscriptionIds);\n } catch (error) {\n ExpoIapConsole.error('Error checking active subscriptions:', error);\n return false;\n }\n },\n [],\n );\n\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }): Promise<void> => {\n await finishTransactionInternal({\n purchase: toPurchaseInput(purchase),\n isConsumable,\n });\n },\n [toPurchaseInput],\n );\n\n const requestPurchaseWithReset = useCallback(\n (requestObj: MutationRequestPurchaseArgs) => {\n return requestPurchaseInternal(requestObj);\n },\n [],\n );\n\n const refreshSubscriptionStatus = useCallback(\n async (productId: string) => {\n try {\n if (subscriptionsRefState.current.some((sub) => sub.id === productId)) {\n await fetchProductsInternal({skus: [productId], type: 'subs'});\n await getAvailablePurchasesInternal();\n }\n } catch (error) {\n ExpoIapConsole.warn('Failed to refresh subscription status:', error);\n }\n },\n [fetchProductsInternal, getAvailablePurchasesInternal],\n );\n\n // Restore completed transactions with cross-platform behavior.\n // iOS: best-effort sync (ignore sync errors) then fetch available purchases.\n // Android: fetch available purchases directly.\n const restorePurchasesInternal = useCallback(async (): Promise<void> => {\n try {\n // iOS: Try to sync first, but don't fail if sync errors occur\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined); // syncIOS returns Promise<boolean>, we don't need the result\n }\n\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n setAvailablePurchases(purchases);\n } catch (error) {\n ExpoIapConsole.warn('Failed to restore purchases:', error);\n }\n }, []);\n\n const validateReceipt = useCallback(async (props: VerifyPurchaseProps) => {\n return validateReceiptInternal(props);\n }, []);\n\n const verifyPurchase = useCallback(async (props: VerifyPurchaseProps) => {\n return verifyPurchaseInternal(props);\n }, []);\n\n const verifyPurchaseWithProvider = useCallback(\n async (props: VerifyPurchaseWithProviderProps) => {\n return verifyPurchaseWithProviderInternal(props);\n },\n [],\n );\n\n const initIapWithSubscriptions = useCallback(async (): Promise<void> => {\n // CRITICAL: Register listeners BEFORE initConnection to avoid race condition\n // Events might fire immediately after initConnection, so listeners must be ready\n // Register purchase update listener BEFORE initConnection to avoid race conditions.\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if ('expirationDateIOS' in purchase) {\n await refreshSubscriptionStatus(purchase.id);\n }\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n );\n\n // Register purchase error listener EARLY. Ignore init-related errors until connected.\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n if (!connectedRef.current && error.code === ErrorCode.InitConnection) {\n return; // Ignore initialization error before connected\n }\n const friendly = getUserFriendlyErrorMessage(error);\n if (!isUserCancelledError(error) && !isRecoverableError(error)) {\n ExpoIapConsole.warn('[useIAP] Purchase error:', friendly);\n }\n\n if (optionsRef.current?.onPurchaseError) {\n optionsRef.current.onPurchaseError(error);\n }\n },\n );\n\n if (Platform.OS === 'ios') {\n // iOS promoted products listener\n subscriptionsRef.current.promotedProductIOS = promotedProductListenerIOS(\n (product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n },\n );\n }\n\n // NOW call initConnection after listeners are ready\n const config = optionsRef.current?.alternativeBillingModeAndroid\n ? {\n alternativeBillingModeAndroid:\n optionsRef.current.alternativeBillingModeAndroid,\n }\n : undefined;\n const result = await initConnection(config);\n setConnected(result);\n if (!result) {\n // If connection failed, clean up listeners\n ExpoIapConsole.warn(\n '[useIAP] Connection failed, cleaning up listeners...',\n );\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n // Keep purchaseError listener registered to capture subsequent retries\n return;\n }\n }, [refreshSubscriptionStatus]);\n\n useEffect(() => {\n initIapWithSubscriptions();\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductIOS?.remove();\n endConnection();\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n subscriptions,\n finishTransaction,\n availablePurchases,\n promotedProductIOS,\n activeSubscriptions,\n getAvailablePurchases: getAvailablePurchasesInternal,\n fetchProducts: fetchProductsInternal,\n requestPurchase: requestPurchaseWithReset,\n validateReceipt,\n verifyPurchase,\n verifyPurchaseWithProvider,\n restorePurchases: restorePurchasesInternal,\n // internal getters kept for hook state management\n getPromotedProductIOS,\n requestPurchaseOnPromotedProductIOS,\n getActiveSubscriptions: getActiveSubscriptionsInternal,\n hasActiveSubscriptions: hasActiveSubscriptionsInternal,\n // Alternative billing methods (Android only)\n checkAlternativeBillingAvailabilityAndroid,\n showAlternativeBillingDialogAndroid,\n createAlternativeBillingTokenAndroid,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useIAP.js","sourceRoot":"","sources":["../src/useIAP.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,mBAAmB;AACnB,OAAO,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,IAAI,yBAAyB,EAC9C,eAAe,IAAI,uBAAuB,EAC1C,aAAa,EACb,eAAe,IAAI,uBAAuB,EAC1C,cAAc,IAAI,sBAAsB,EACxC,0BAA0B,IAAI,kCAAkC,EAChE,sBAAsB,EACtB,sBAAsB,GAGvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,mCAAmC,EACnC,OAAO,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,mBAAmB,CAAC;AAkB3B,O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AAQ;QACR,aAAa;QACb,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB,EAAE,6BAA6B;QACpD,aAAa,EAAE,qBAAqB;QACpC,eAAe,EAAE,wBAAwB;QACzC,eAAe;QACf,cAAc;QACd,0BAA0B;QAC1B,gBAAgB,EAAE,wBAAwB;QAC1C,kDAAkD;QAClD,qBAAqB;QACrB,mCAAmC;QACnC,sBAAsB,EAAE,8BAA8B;QACtD,sBAAsB,EAAE,8BAA8B;QACtD,6CAA6C;QAC7C,0CAA0C;QAC1C,mCAAmC;QACnC,oCAAoC;KACrC,CAAC;AACJ,CAAC","sourcesContent":["// External dependencies\nimport {useCallback, useEffect, useState, useRef} from 'react';\nimport {Platform} from 'react-native';\nimport {EventSubscription} from 'expo-modules-core';\n\n// Internal modules\nimport {\n endConnection,\n initConnection,\n purchaseErrorListener,\n purchaseUpdatedListener,\n promotedProductListenerIOS,\n getAvailablePurchases,\n finishTransaction as finishTransactionInternal,\n requestPurchase as requestPurchaseInternal,\n fetchProducts,\n validateReceipt as validateReceiptInternal,\n verifyPurchase as verifyPurchaseInternal,\n verifyPurchaseWithProvider as verifyPurchaseWithProviderInternal,\n getActiveSubscriptions,\n hasActiveSubscriptions,\n type ActiveSubscription,\n type ProductTypeInput,\n} from './index';\nimport {ExpoIapConsole} from './utils/debug';\nimport {\n getPromotedProductIOS,\n requestPurchaseOnPromotedProductIOS,\n syncIOS,\n} from './modules/ios';\nimport {\n checkAlternativeBillingAvailabilityAndroid,\n showAlternativeBillingDialogAndroid,\n createAlternativeBillingTokenAndroid,\n} from './modules/android';\n\n// Types\nimport type {\n Product,\n ProductSubscription,\n ProductQueryType,\n ProductRequest,\n Purchase,\n MutationRequestPurchaseArgs,\n PurchaseInput,\n VerifyPurchaseProps,\n VerifyPurchaseResult,\n VerifyPurchaseWithProviderProps,\n VerifyPurchaseWithProviderResult,\n ProductAndroid,\n ProductSubscriptionIOS,\n} from './types';\nimport {ErrorCode} from './types';\nimport type {PurchaseError} from './utils/errorMapping';\nimport {\n getUserFriendlyErrorMessage,\n isUserCancelledError,\n isRecoverableError,\n} from './utils/errorMapping';\n\ntype UseIap = {\n connected: boolean;\n products: Product[];\n subscriptions: ProductSubscription[];\n availablePurchases: Purchase[];\n promotedProductIOS?: Product;\n activeSubscriptions: ActiveSubscription[];\n finishTransaction: ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }) => Promise<void>;\n getAvailablePurchases: () => Promise<void>;\n fetchProducts: (params: {\n skus: string[];\n type?: ProductTypeInput;\n }) => Promise<void>;\n\n requestPurchase: (\n params: MutationRequestPurchaseArgs,\n ) => ReturnType<typeof requestPurchaseInternal>;\n /** @deprecated Use verifyPurchase instead */\n validateReceipt: (\n props: VerifyPurchaseProps,\n ) => Promise<VerifyPurchaseResult>;\n verifyPurchase: (props: VerifyPurchaseProps) => Promise<VerifyPurchaseResult>;\n verifyPurchaseWithProvider: (\n props: VerifyPurchaseWithProviderProps,\n ) => Promise<VerifyPurchaseWithProviderResult>;\n restorePurchases: () => Promise<void>;\n getPromotedProductIOS: () => Promise<Product | null>;\n requestPurchaseOnPromotedProductIOS: () => Promise<boolean>;\n getActiveSubscriptions: (subscriptionIds?: string[]) => Promise<void>;\n hasActiveSubscriptions: (subscriptionIds?: string[]) => Promise<boolean>;\n checkAlternativeBillingAvailabilityAndroid: () => Promise<boolean>;\n showAlternativeBillingDialogAndroid: () => Promise<boolean>;\n createAlternativeBillingTokenAndroid: (\n sku?: string,\n ) => Promise<string | null>;\n};\n\nexport interface UseIAPOptions {\n onPurchaseSuccess?: (purchase: Purchase) => void;\n onPurchaseError?: (error: PurchaseError) => void;\n onPromotedProductIOS?: (product: Product) => void;\n /**\n * Alternative billing mode for Android\n * If not specified, defaults to NONE (standard Google Play billing)\n */\n alternativeBillingModeAndroid?: 'none' | 'user-choice' | 'alternative-only';\n}\n\n/**\n * React Hook for managing In-App Purchases.\n * See documentation at https://hyochan.github.io/expo-iap/docs/hooks/useIAP\n */\nexport function useIAP(options?: UseIAPOptions): UseIap {\n const [connected, setConnected] = useState<boolean>(false);\n const [products, setProducts] = useState<Product[]>([]);\n const [subscriptions, setSubscriptions] = useState<ProductSubscription[]>([]);\n\n const [availablePurchases, setAvailablePurchases] = useState<Purchase[]>([]);\n const [promotedProductIOS, setPromotedProductIOS] = useState<Product>();\n const [activeSubscriptions, setActiveSubscriptions] = useState<\n ActiveSubscription[]\n >([]);\n\n const optionsRef = useRef<UseIAPOptions | undefined>(options);\n const connectedRef = useRef<boolean>(false);\n\n // Helper function to merge arrays with duplicate checking\n const mergeWithDuplicateCheck = useCallback(\n <T>(\n existingItems: T[],\n newItems: T[],\n getKey: (item: T) => string,\n ): T[] => {\n const merged = [...existingItems];\n newItems.forEach((newItem) => {\n const isDuplicate = merged.some(\n (existingItem) => getKey(existingItem) === getKey(newItem),\n );\n if (!isDuplicate) {\n merged.push(newItem);\n }\n });\n return merged;\n },\n [],\n );\n\n useEffect(() => {\n optionsRef.current = options;\n }, [options]);\n\n useEffect(() => {\n connectedRef.current = connected;\n }, [connected]);\n\n const subscriptionsRef = useRef<{\n purchaseUpdate?: EventSubscription;\n purchaseError?: EventSubscription;\n promotedProductIOS?: EventSubscription;\n }>({});\n\n const subscriptionsRefState = useRef<ProductSubscription[]>([]);\n\n useEffect(() => {\n subscriptionsRefState.current = subscriptions;\n }, [subscriptions]);\n\n const normalizeProductQueryType = useCallback(\n (type?: ProductTypeInput): ProductQueryType => {\n if (!type || type === 'inapp' || type === 'in-app') {\n return 'in-app';\n }\n return type;\n },\n [],\n );\n\n const canonicalProductType = useCallback(\n (value?: string): ProductQueryType => {\n if (!value) {\n return 'in-app';\n }\n\n const normalized = value.trim().toLowerCase().replace(/[_-]/g, '');\n return normalized === 'subs' ? 'subs' : 'in-app';\n },\n [],\n );\n\n const toPurchaseInput = useCallback(\n (purchase: Purchase): PurchaseInput => ({\n id: purchase.id,\n ids: purchase.ids ?? undefined,\n isAutoRenewing: purchase.isAutoRenewing,\n platform: purchase.platform,\n productId: purchase.productId,\n purchaseState: purchase.purchaseState,\n purchaseToken: purchase.purchaseToken ?? null,\n quantity: purchase.quantity,\n store: purchase.store,\n transactionDate: purchase.transactionDate,\n transactionId: purchase.transactionId,\n }),\n [],\n );\n\n const fetchProductsInternal = useCallback(\n async (params: {\n skus: string[];\n type?: ProductTypeInput;\n }): Promise<void> => {\n try {\n const queryType = normalizeProductQueryType(params.type);\n const request: ProductRequest = {skus: params.skus, type: queryType};\n const result = await fetchProducts(request);\n const items = (result ?? []) as (Product | ProductSubscription)[];\n\n ExpoIapConsole.debug('Fetched products:', items);\n\n if (queryType === 'subs') {\n const subscriptionsResult = items as ProductSubscription[];\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionsResult,\n (subscription) => subscription.id,\n ),\n );\n } else if (queryType === 'in-app') {\n const productsResult = items as Product[];\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productsResult,\n (product) => product.id,\n ),\n );\n } else {\n // For 'all' type, need to properly distinguish between products and subscriptions\n // On Android, check subscriptionOfferDetailsAndroid to determine if it's a real subscription\n const productItems = items.filter((item) => {\n // iOS: check type\n if (Platform.OS === 'ios') {\n return canonicalProductType(item.type as string) === 'in-app';\n }\n // Android: check if it has actual subscription details\n const androidItem = item as ProductAndroid;\n return (\n !androidItem.subscriptionOfferDetailsAndroid ||\n (Array.isArray(androidItem.subscriptionOfferDetailsAndroid) &&\n androidItem.subscriptionOfferDetailsAndroid.length === 0)\n );\n }) as Product[];\n\n const subscriptionItems = items.filter((item) => {\n // iOS: check type\n if (Platform.OS === 'ios') {\n return (\n canonicalProductType(\n item.type as ProductSubscriptionIOS['type'],\n ) === 'subs'\n );\n }\n // Android: check if it has actual subscription details\n const androidItem = item as ProductAndroid;\n\n return (\n androidItem.subscriptionOfferDetailsAndroid &&\n Array.isArray(androidItem.subscriptionOfferDetailsAndroid) &&\n androidItem.subscriptionOfferDetailsAndroid.length > 0\n );\n }) as ProductSubscription[];\n\n setProducts((prevProducts) =>\n mergeWithDuplicateCheck(\n prevProducts,\n productItems,\n (product) => product.id,\n ),\n );\n\n setSubscriptions((prevSubscriptions) =>\n mergeWithDuplicateCheck(\n prevSubscriptions,\n subscriptionItems,\n (subscription) => subscription.id,\n ),\n );\n }\n } catch (error) {\n ExpoIapConsole.error('Error fetching products:', error);\n }\n },\n [canonicalProductType, mergeWithDuplicateCheck, normalizeProductQueryType],\n );\n\n const getAvailablePurchasesInternal = useCallback(async (): Promise<void> => {\n try {\n const result = await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n setAvailablePurchases(result);\n } catch (error) {\n ExpoIapConsole.error('Error fetching available purchases:', error);\n }\n }, []);\n\n const getActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<void> => {\n try {\n const result = await getActiveSubscriptions(subscriptionIds);\n setActiveSubscriptions(result);\n } catch (error) {\n ExpoIapConsole.error('Error getting active subscriptions:', error);\n // Preserve existing state on error\n }\n },\n [],\n );\n\n const hasActiveSubscriptionsInternal = useCallback(\n async (subscriptionIds?: string[]): Promise<boolean> => {\n try {\n return await hasActiveSubscriptions(subscriptionIds);\n } catch (error) {\n ExpoIapConsole.error('Error checking active subscriptions:', error);\n return false;\n }\n },\n [],\n );\n\n const finishTransaction = useCallback(\n async ({\n purchase,\n isConsumable,\n }: {\n purchase: Purchase;\n isConsumable?: boolean;\n }): Promise<void> => {\n await finishTransactionInternal({\n purchase: toPurchaseInput(purchase),\n isConsumable,\n });\n },\n [toPurchaseInput],\n );\n\n const requestPurchaseWithReset = useCallback(\n (requestObj: MutationRequestPurchaseArgs) => {\n return requestPurchaseInternal(requestObj);\n },\n [],\n );\n\n const refreshSubscriptionStatus = useCallback(\n async (productId: string) => {\n try {\n if (subscriptionsRefState.current.some((sub) => sub.id === productId)) {\n await fetchProductsInternal({skus: [productId], type: 'subs'});\n await getAvailablePurchasesInternal();\n }\n } catch (error) {\n ExpoIapConsole.warn('Failed to refresh subscription status:', error);\n }\n },\n [fetchProductsInternal, getAvailablePurchasesInternal],\n );\n\n // Restore completed transactions with cross-platform behavior.\n // iOS: best-effort sync (ignore sync errors) then fetch available purchases.\n // Android: fetch available purchases directly.\n const restorePurchasesInternal = useCallback(async (): Promise<void> => {\n try {\n // iOS: Try to sync first, but don't fail if sync errors occur\n if (Platform.OS === 'ios') {\n await syncIOS().catch(() => undefined); // syncIOS returns Promise<boolean>, we don't need the result\n }\n\n const purchases = await getAvailablePurchases({\n alsoPublishToEventListenerIOS: false,\n onlyIncludeActiveItemsIOS: true,\n });\n setAvailablePurchases(purchases);\n } catch (error) {\n ExpoIapConsole.warn('Failed to restore purchases:', error);\n }\n }, []);\n\n const validateReceipt = useCallback(async (props: VerifyPurchaseProps) => {\n return validateReceiptInternal(props);\n }, []);\n\n const verifyPurchase = useCallback(async (props: VerifyPurchaseProps) => {\n return verifyPurchaseInternal(props);\n }, []);\n\n const verifyPurchaseWithProvider = useCallback(\n async (props: VerifyPurchaseWithProviderProps) => {\n return verifyPurchaseWithProviderInternal(props);\n },\n [],\n );\n\n const initIapWithSubscriptions = useCallback(async (): Promise<void> => {\n // CRITICAL: Register listeners BEFORE initConnection to avoid race condition\n // Events might fire immediately after initConnection, so listeners must be ready\n // Register purchase update listener BEFORE initConnection to avoid race conditions.\n subscriptionsRef.current.purchaseUpdate = purchaseUpdatedListener(\n async (purchase: Purchase) => {\n if ('expirationDateIOS' in purchase) {\n await refreshSubscriptionStatus(purchase.id);\n }\n\n if (optionsRef.current?.onPurchaseSuccess) {\n optionsRef.current.onPurchaseSuccess(purchase);\n }\n },\n );\n\n // Register purchase error listener EARLY. Ignore init-related errors until connected.\n subscriptionsRef.current.purchaseError = purchaseErrorListener(\n (error: PurchaseError) => {\n if (!connectedRef.current && error.code === ErrorCode.InitConnection) {\n return; // Ignore initialization error before connected\n }\n const friendly = getUserFriendlyErrorMessage(error);\n if (!isUserCancelledError(error) && !isRecoverableError(error)) {\n ExpoIapConsole.warn('[useIAP] Purchase error:', friendly);\n }\n\n if (optionsRef.current?.onPurchaseError) {\n optionsRef.current.onPurchaseError(error);\n }\n },\n );\n\n if (Platform.OS === 'ios') {\n // iOS promoted products listener\n subscriptionsRef.current.promotedProductIOS = promotedProductListenerIOS(\n (product: Product) => {\n setPromotedProductIOS(product);\n\n if (optionsRef.current?.onPromotedProductIOS) {\n optionsRef.current.onPromotedProductIOS(product);\n }\n },\n );\n }\n\n // NOW call initConnection after listeners are ready\n const config = optionsRef.current?.alternativeBillingModeAndroid\n ? {\n alternativeBillingModeAndroid:\n optionsRef.current.alternativeBillingModeAndroid,\n }\n : undefined;\n const result = await initConnection(config);\n setConnected(result);\n if (!result) {\n // If connection failed, clean up listeners\n ExpoIapConsole.warn(\n '[useIAP] Connection failed, cleaning up listeners...',\n );\n subscriptionsRef.current.purchaseUpdate?.remove();\n subscriptionsRef.current.promotedProductIOS?.remove();\n subscriptionsRef.current.purchaseUpdate = undefined;\n subscriptionsRef.current.promotedProductIOS = undefined;\n // Keep purchaseError listener registered to capture subsequent retries\n return;\n }\n }, [refreshSubscriptionStatus]);\n\n useEffect(() => {\n initIapWithSubscriptions();\n const currentSubscriptions = subscriptionsRef.current;\n\n return () => {\n currentSubscriptions.purchaseUpdate?.remove();\n currentSubscriptions.purchaseError?.remove();\n currentSubscriptions.promotedProductIOS?.remove();\n endConnection();\n setConnected(false);\n };\n }, [initIapWithSubscriptions]);\n\n return {\n connected,\n products,\n subscriptions,\n finishTransaction,\n availablePurchases,\n promotedProductIOS,\n activeSubscriptions,\n getAvailablePurchases: getAvailablePurchasesInternal,\n fetchProducts: fetchProductsInternal,\n requestPurchase: requestPurchaseWithReset,\n validateReceipt,\n verifyPurchase,\n verifyPurchaseWithProvider,\n restorePurchases: restorePurchasesInternal,\n // internal getters kept for hook state management\n getPromotedProductIOS,\n requestPurchaseOnPromotedProductIOS,\n getActiveSubscriptions: getActiveSubscriptionsInternal,\n hasActiveSubscriptions: hasActiveSubscriptionsInternal,\n // Alternative billing methods (Android only)\n checkAlternativeBillingAvailabilityAndroid,\n showAlternativeBillingDialogAndroid,\n createAlternativeBillingTokenAndroid,\n };\n}\n"]}
|
package/coverage/clover.xml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
4
|
-
<metrics statements="
|
|
2
|
+
<coverage generated="1765229654003" clover="3.2.0">
|
|
3
|
+
<project timestamp="1765229654003" name="All files">
|
|
4
|
+
<metrics statements="468" coveredstatements="440" conditionals="260" coveredconditionals="226" methods="97" coveredmethods="77" elements="825" coveredelements="743" complexity="0" loc="468" ncloc="468" packages="3" files="5" classes="5"/>
|
|
5
5
|
<package name="src">
|
|
6
|
-
<metrics statements="
|
|
6
|
+
<metrics statements="207" coveredstatements="201" conditionals="108" coveredconditionals="98" methods="43" coveredmethods="34"/>
|
|
7
7
|
<file name="index.ts" path="/home/runner/work/expo-iap/expo-iap/src/index.ts">
|
|
8
|
-
<metrics statements="
|
|
8
|
+
<metrics statements="207" coveredstatements="201" conditionals="108" coveredconditionals="98" methods="43" coveredmethods="34"/>
|
|
9
9
|
<line num="2" count="2" type="stmt"/>
|
|
10
10
|
<line num="3" count="2" type="stmt"/>
|
|
11
11
|
<line num="6" count="2" type="stmt"/>
|
|
@@ -120,97 +120,99 @@
|
|
|
120
120
|
<line num="396" count="2" type="cond" truecount="2" falsecount="1"/>
|
|
121
121
|
<line num="397" count="0" type="stmt"/>
|
|
122
122
|
<line num="399" count="2" type="stmt"/>
|
|
123
|
-
<line num="
|
|
124
|
-
<line num="
|
|
125
|
-
<line num="
|
|
126
|
-
<line num="
|
|
127
|
-
<line num="
|
|
128
|
-
<line num="
|
|
129
|
-
<line num="
|
|
130
|
-
<line num="
|
|
131
|
-
<line num="
|
|
132
|
-
<line num="
|
|
133
|
-
<line num="
|
|
134
|
-
<line num="
|
|
135
|
-
<line num="
|
|
136
|
-
<line num="
|
|
137
|
-
<line num="
|
|
138
|
-
<line num="
|
|
139
|
-
<line num="
|
|
140
|
-
<line num="
|
|
141
|
-
<line num="
|
|
142
|
-
<line num="
|
|
143
|
-
<line num="
|
|
144
|
-
<line num="
|
|
145
|
-
<line num="
|
|
146
|
-
<line num="
|
|
147
|
-
<line num="
|
|
123
|
+
<line num="429" count="10" type="cond" truecount="1" falsecount="0"/>
|
|
124
|
+
<line num="430" count="6" type="cond" truecount="2" falsecount="0"/>
|
|
125
|
+
<line num="432" count="4" type="cond" truecount="2" falsecount="0"/>
|
|
126
|
+
<line num="475" count="2" type="stmt"/>
|
|
127
|
+
<line num="478" count="13" type="stmt"/>
|
|
128
|
+
<line num="479" count="13" type="stmt"/>
|
|
129
|
+
<line num="480" count="12" type="stmt"/>
|
|
130
|
+
<line num="482" count="12" type="cond" truecount="1" falsecount="0"/>
|
|
131
|
+
<line num="483" count="6" type="stmt"/>
|
|
132
|
+
<line num="485" count="6" type="cond" truecount="1" falsecount="0"/>
|
|
133
|
+
<line num="486" count="1" type="stmt"/>
|
|
134
|
+
<line num="500" count="5" type="cond" truecount="3" falsecount="0"/>
|
|
135
|
+
<line num="501" count="1" type="stmt"/>
|
|
136
|
+
<line num="504" count="4" type="stmt"/>
|
|
137
|
+
<line num="510" count="4" type="stmt"/>
|
|
138
|
+
<line num="515" count="4" type="cond" truecount="1" falsecount="0"/>
|
|
139
|
+
<line num="516" count="1" type="stmt"/>
|
|
140
|
+
<line num="519" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
141
|
+
<line num="520" count="2" type="stmt"/>
|
|
142
|
+
<line num="523" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
143
|
+
<line num="526" count="6" type="cond" truecount="1" falsecount="0"/>
|
|
144
|
+
<line num="527" count="5" type="cond" truecount="1" falsecount="0"/>
|
|
145
|
+
<line num="528" count="2" type="stmt"/>
|
|
146
|
+
<line num="533" count="2" type="cond" truecount="1" falsecount="0"/>
|
|
147
|
+
<line num="534" count="1" type="stmt"/>
|
|
148
148
|
<line num="553" count="1" type="stmt"/>
|
|
149
|
-
<line num="
|
|
150
|
-
<line num="
|
|
151
|
-
<line num="
|
|
152
|
-
<line num="
|
|
153
|
-
<line num="
|
|
154
|
-
<line num="
|
|
155
|
-
<line num="
|
|
156
|
-
<line num="
|
|
157
|
-
<line num="
|
|
158
|
-
<line num="
|
|
159
|
-
<line num="
|
|
160
|
-
<line num="
|
|
161
|
-
<line num="
|
|
162
|
-
<line num="
|
|
163
|
-
<line num="
|
|
164
|
-
<line num="
|
|
165
|
-
<line num="
|
|
166
|
-
<line num="
|
|
167
|
-
<line num="
|
|
168
|
-
<line num="
|
|
169
|
-
<line num="
|
|
170
|
-
<line num="
|
|
171
|
-
<line num="638" count="1" type="stmt"/>
|
|
172
|
-
<line num="639" count="1" type="stmt"/>
|
|
149
|
+
<line num="555" count="1" type="stmt"/>
|
|
150
|
+
<line num="566" count="1" type="stmt"/>
|
|
151
|
+
<line num="569" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
152
|
+
<line num="570" count="2" type="stmt"/>
|
|
153
|
+
<line num="575" count="2" type="cond" truecount="1" falsecount="0"/>
|
|
154
|
+
<line num="576" count="1" type="stmt"/>
|
|
155
|
+
<line num="598" count="1" type="stmt"/>
|
|
156
|
+
<line num="600" count="1" type="cond" truecount="1" falsecount="1"/>
|
|
157
|
+
<line num="601" count="1" type="cond" truecount="2" falsecount="0"/>
|
|
158
|
+
<line num="602" count="1" type="cond" truecount="2" falsecount="0"/>
|
|
159
|
+
<line num="604" count="1" type="stmt"/>
|
|
160
|
+
<line num="612" count="1" type="stmt"/>
|
|
161
|
+
<line num="618" count="1" type="stmt"/>
|
|
162
|
+
<line num="621" count="1" type="stmt"/>
|
|
163
|
+
<line num="626" count="1" type="stmt"/>
|
|
164
|
+
<line num="629" count="2" type="stmt"/>
|
|
165
|
+
<line num="633" count="6" type="cond" truecount="1" falsecount="0"/>
|
|
166
|
+
<line num="634" count="2" type="stmt"/>
|
|
167
|
+
<line num="635" count="2" type="stmt"/>
|
|
168
|
+
<line num="638" count="4" type="cond" truecount="1" falsecount="0"/>
|
|
169
|
+
<line num="639" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
170
|
+
<line num="641" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
173
171
|
<line num="642" count="1" type="stmt"/>
|
|
174
|
-
<line num="
|
|
175
|
-
<line num="
|
|
176
|
-
<line num="
|
|
177
|
-
<line num="
|
|
178
|
-
<line num="
|
|
179
|
-
<line num="
|
|
180
|
-
<line num="
|
|
181
|
-
<line num="
|
|
182
|
-
<line num="
|
|
183
|
-
<line num="
|
|
184
|
-
<line num="
|
|
185
|
-
<line num="
|
|
186
|
-
<line num="
|
|
187
|
-
<line num="
|
|
188
|
-
<line num="
|
|
189
|
-
<line num="
|
|
190
|
-
<line num="
|
|
191
|
-
<line num="
|
|
192
|
-
<line num="
|
|
193
|
-
<line num="
|
|
194
|
-
<line num="
|
|
195
|
-
<line num="
|
|
196
|
-
<line num="
|
|
172
|
+
<line num="650" count="2" type="cond" truecount="1" falsecount="0"/>
|
|
173
|
+
<line num="651" count="1" type="stmt"/>
|
|
174
|
+
<line num="652" count="1" type="stmt"/>
|
|
175
|
+
<line num="655" count="1" type="stmt"/>
|
|
176
|
+
<line num="656" count="1" type="stmt"/>
|
|
177
|
+
<line num="659" count="1" type="stmt"/>
|
|
178
|
+
<line num="672" count="2" type="stmt"/>
|
|
179
|
+
<line num="673" count="1" type="cond" truecount="1" falsecount="0"/>
|
|
180
|
+
<line num="674" count="1" type="stmt"/>
|
|
181
|
+
<line num="677" count="1" type="stmt"/>
|
|
182
|
+
<line num="701" count="2" type="stmt"/>
|
|
183
|
+
<line num="703" count="2" type="stmt"/>
|
|
184
|
+
<line num="704" count="5" type="cond" truecount="1" falsecount="0"/>
|
|
185
|
+
<line num="705" count="1" type="stmt"/>
|
|
186
|
+
<line num="706" count="1" type="stmt"/>
|
|
187
|
+
<line num="709" count="4" type="cond" truecount="1" falsecount="0"/>
|
|
188
|
+
<line num="710" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
189
|
+
<line num="711" count="1" type="stmt"/>
|
|
190
|
+
<line num="714" count="1" type="stmt"/>
|
|
191
|
+
<line num="727" count="2" type="stmt"/>
|
|
192
|
+
<line num="730" count="4" type="stmt"/>
|
|
193
|
+
<line num="732" count="4" type="cond" truecount="1" falsecount="0"/>
|
|
194
|
+
<line num="733" count="1" type="stmt"/>
|
|
195
|
+
<line num="736" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
196
|
+
<line num="737" count="2" type="cond" truecount="1" falsecount="0"/>
|
|
197
197
|
<line num="743" count="1" type="stmt"/>
|
|
198
|
-
<line num="
|
|
199
|
-
<line num="
|
|
200
|
-
<line num="
|
|
201
|
-
<line num="
|
|
202
|
-
<line num="
|
|
203
|
-
<line num="
|
|
204
|
-
<line num="793" count="13" type="cond" truecount="3" falsecount="0"/>
|
|
205
|
-
<line num="794" count="12" type="stmt"/>
|
|
206
|
-
<line num="797" count="1" type="stmt"/>
|
|
207
|
-
<line num="800" count="2" type="stmt"/>
|
|
208
|
-
<line num="801" count="2" type="stmt"/>
|
|
209
|
-
<line num="802" count="2" type="stmt"/>
|
|
198
|
+
<line num="747" count="1" type="stmt"/>
|
|
199
|
+
<line num="756" count="1" type="stmt"/>
|
|
200
|
+
<line num="768" count="2" type="stmt"/>
|
|
201
|
+
<line num="771" count="3" type="cond" truecount="3" falsecount="0"/>
|
|
202
|
+
<line num="772" count="2" type="stmt"/>
|
|
203
|
+
<line num="775" count="1" type="stmt"/>
|
|
210
204
|
<line num="803" count="2" type="stmt"/>
|
|
211
|
-
<line num="804" count="2" type="stmt"/>
|
|
212
205
|
<line num="805" count="2" type="stmt"/>
|
|
213
|
-
<line num="
|
|
206
|
+
<line num="806" count="13" type="cond" truecount="3" falsecount="0"/>
|
|
207
|
+
<line num="807" count="12" type="stmt"/>
|
|
208
|
+
<line num="810" count="1" type="stmt"/>
|
|
209
|
+
<line num="813" count="2" type="stmt"/>
|
|
210
|
+
<line num="814" count="2" type="stmt"/>
|
|
211
|
+
<line num="815" count="2" type="stmt"/>
|
|
212
|
+
<line num="816" count="2" type="stmt"/>
|
|
213
|
+
<line num="817" count="2" type="stmt"/>
|
|
214
|
+
<line num="818" count="2" type="stmt"/>
|
|
215
|
+
<line num="824" count="2" type="stmt"/>
|
|
214
216
|
</file>
|
|
215
217
|
</package>
|
|
216
218
|
<package name="src.modules">
|