expo-iap 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/.eslintignore +1 -1
  2. package/.eslintrc.js +1 -0
  3. package/.prettierignore +1 -0
  4. package/CHANGELOG.md +6 -0
  5. package/CLAUDE.md +1 -1
  6. package/CONTRIBUTING.md +10 -0
  7. package/android/build.gradle +1 -1
  8. package/android/src/main/java/expo/modules/iap/ExpoIapModule.kt +12 -12
  9. package/android/src/main/java/expo/modules/iap/PromiseUtils.kt +2 -2
  10. package/build/index.d.ts +28 -14
  11. package/build/index.d.ts.map +1 -1
  12. package/build/index.js +36 -15
  13. package/build/index.js.map +1 -1
  14. package/build/modules/android.d.ts +3 -4
  15. package/build/modules/android.d.ts.map +1 -1
  16. package/build/modules/android.js +2 -4
  17. package/build/modules/android.js.map +1 -1
  18. package/build/modules/ios.d.ts +2 -3
  19. package/build/modules/ios.d.ts.map +1 -1
  20. package/build/modules/ios.js +1 -3
  21. package/build/modules/ios.js.map +1 -1
  22. package/build/purchase-error.d.ts +8 -10
  23. package/build/purchase-error.d.ts.map +1 -1
  24. package/build/purchase-error.js +4 -2
  25. package/build/purchase-error.js.map +1 -1
  26. package/build/types.d.ts +159 -204
  27. package/build/types.d.ts.map +1 -1
  28. package/build/types.js +1 -59
  29. package/build/types.js.map +1 -1
  30. package/build/useIAP.d.ts +5 -8
  31. package/build/useIAP.d.ts.map +1 -1
  32. package/build/useIAP.js.map +1 -1
  33. package/ios/ExpoIap.podspec +1 -1
  34. package/ios/ExpoIapModule.swift +103 -89
  35. package/package.json +2 -1
  36. package/plugin/build/withIAP.js +4 -5
  37. package/plugin/src/withIAP.ts +4 -5
  38. package/scripts/update-types.mjs +61 -0
  39. package/src/index.ts +77 -29
  40. package/src/modules/android.ts +5 -7
  41. package/src/modules/ios.ts +3 -5
  42. package/src/purchase-error.ts +13 -16
  43. package/src/types.ts +183 -216
  44. package/src/useIAP.ts +10 -10
package/src/types.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  // ============================================================================
2
2
  // AUTO-GENERATED TYPES — DO NOT EDIT DIRECTLY
3
- // Run `npm run generate` after updating any *.graphql schema file.
3
+ // Run `bun run generate:types` after updating any *.graphql schema file.
4
4
  // ============================================================================
5
5
 
6
6
  export interface ActiveSubscription {
7
- autoRenewingAndroid?: boolean | null;
8
- daysUntilExpirationIOS?: number | null;
9
- environmentIOS?: string | null;
10
- expirationDateIOS?: number | null;
7
+ autoRenewingAndroid?: (boolean | null);
8
+ daysUntilExpirationIOS?: (number | null);
9
+ environmentIOS?: (string | null);
10
+ expirationDateIOS?: (number | null);
11
11
  isActive: boolean;
12
12
  productId: string;
13
- purchaseToken?: string | null;
13
+ purchaseToken?: (string | null);
14
14
  transactionDate: number;
15
15
  transactionId: string;
16
- willExpireSoon?: boolean | null;
16
+ willExpireSoon?: (boolean | null);
17
17
  }
18
18
 
19
19
  export interface AndroidSubscriptionOfferInput {
@@ -25,7 +25,7 @@ export interface AndroidSubscriptionOfferInput {
25
25
 
26
26
  export interface AppTransaction {
27
27
  appId: number;
28
- appTransactionId?: string | null;
28
+ appTransactionId?: (string | null);
29
29
  appVersion: string;
30
30
  appVersionId: number;
31
31
  bundleId: string;
@@ -33,22 +33,22 @@ export interface AppTransaction {
33
33
  deviceVerificationNonce: string;
34
34
  environment: string;
35
35
  originalAppVersion: string;
36
- originalPlatform?: string | null;
36
+ originalPlatform?: (string | null);
37
37
  originalPurchaseDate: number;
38
- preorderDate?: number | null;
38
+ preorderDate?: (number | null);
39
39
  signedDate: number;
40
40
  }
41
41
 
42
42
  export interface DeepLinkOptions {
43
43
  /** Android package name to target (required on Android) */
44
- packageNameAndroid?: string | null;
44
+ packageNameAndroid?: (string | null);
45
45
  /** Android SKU to open (required on Android) */
46
- skuAndroid?: string | null;
46
+ skuAndroid?: (string | null);
47
47
  }
48
48
 
49
49
  export interface DiscountIOS {
50
50
  identifier: string;
51
- localizedPrice?: string | null;
51
+ localizedPrice?: (string | null);
52
52
  numberOfPeriods: number;
53
53
  paymentMode: PaymentModeIOS;
54
54
  price: string;
@@ -123,19 +123,17 @@ export enum ErrorCode {
123
123
  TransactionValidationFailed = 'TRANSACTION_VALIDATION_FAILED',
124
124
  Unknown = 'UNKNOWN',
125
125
  UserCancelled = 'USER_CANCELLED',
126
- UserError = 'USER_ERROR',
126
+ UserError = 'USER_ERROR'
127
127
  }
128
128
 
129
129
  export interface FetchProductsResult {
130
- products?: Product[] | null;
131
- subscriptions?: ProductSubscription[] | null;
130
+ products?: (Product[] | null);
131
+ subscriptions?: (ProductSubscription[] | null);
132
132
  }
133
133
 
134
- export enum IapEvent {
135
- PromotedProductIos = 'PROMOTED_PRODUCT_IOS',
136
- PurchaseError = 'PURCHASE_ERROR',
137
- PurchaseUpdated = 'PURCHASE_UPDATED',
138
- }
134
+ export type IapEvent = 'promoted-product-ios' | 'purchase-error' | 'purchase-updated';
135
+
136
+ export type IapPlatform = 'android' | 'ios';
139
137
 
140
138
  export interface Mutation {
141
139
  /** Acknowledge a non-consumable purchase or subscription */
@@ -157,7 +155,7 @@ export interface Mutation {
157
155
  /** Present the App Store code redemption sheet */
158
156
  presentCodeRedemptionSheetIOS: Promise<VoidResult>;
159
157
  /** Initiate a purchase flow; rely on events for final state */
160
- requestPurchase?: Promise<RequestPurchaseResult | null>;
158
+ requestPurchase?: Promise<(RequestPurchaseResult | null)>;
161
159
  /** Purchase the promoted product surfaced by the App Store */
162
160
  requestPurchaseOnPromotedProductIOS: Promise<PurchaseIOS>;
163
161
  /** Restore completed purchases across platforms */
@@ -170,46 +168,43 @@ export interface Mutation {
170
168
  validateReceipt: Promise<ReceiptValidationResult>;
171
169
  }
172
170
 
171
+
173
172
  export interface MutationAcknowledgePurchaseAndroidArgs {
174
173
  purchaseToken: string;
175
174
  }
176
175
 
176
+
177
177
  export interface MutationBeginRefundRequestIosArgs {
178
178
  sku: string;
179
179
  }
180
180
 
181
+
181
182
  export interface MutationConsumePurchaseAndroidArgs {
182
183
  purchaseToken: string;
183
184
  }
184
185
 
186
+
185
187
  export interface MutationDeepLinkToSubscriptionsArgs {
186
- options?: DeepLinkOptions | null;
188
+ options?: (DeepLinkOptions | null);
187
189
  }
188
190
 
191
+
189
192
  export interface MutationFinishTransactionArgs {
190
- isConsumable?: boolean | null;
193
+ isConsumable?: (boolean | null);
191
194
  purchase: PurchaseInput;
192
195
  }
193
196
 
197
+
194
198
  export interface MutationRequestPurchaseArgs {
195
- params: PurchaseParams;
199
+ params: RequestPurchaseProps;
196
200
  }
197
201
 
202
+
198
203
  export interface MutationValidateReceiptArgs {
199
204
  options: ReceiptValidationProps;
200
205
  }
201
206
 
202
- export enum PaymentModeIOS {
203
- Empty = 'EMPTY',
204
- FreeTrial = 'FREE_TRIAL',
205
- PayAsYouGo = 'PAY_AS_YOU_GO',
206
- PayUpFront = 'PAY_UP_FRONT',
207
- }
208
-
209
- export enum Platform {
210
- Android = 'ANDROID',
211
- Ios = 'IOS',
212
- }
207
+ export type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';
213
208
 
214
209
  export interface PricingPhaseAndroid {
215
210
  billingCycleCount: number;
@@ -228,18 +223,16 @@ export type Product = ProductAndroid | ProductIOS;
228
223
 
229
224
  export interface ProductAndroid extends ProductCommon {
230
225
  currency: string;
231
- debugDescription?: string | null;
226
+ debugDescription?: (string | null);
232
227
  description: string;
233
- displayName?: string | null;
228
+ displayName?: (string | null);
234
229
  displayPrice: string;
235
230
  id: string;
236
231
  nameAndroid: string;
237
- oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
238
- platform: Platform;
239
- price?: number | null;
240
- subscriptionOfferDetailsAndroid?:
241
- | ProductSubscriptionAndroidOfferDetails[]
242
- | null;
232
+ oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
233
+ platform: IapPlatform;
234
+ price?: (number | null);
235
+ subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
243
236
  title: string;
244
237
  type: ProductType;
245
238
  }
@@ -252,61 +245,55 @@ export interface ProductAndroidOneTimePurchaseOfferDetail {
252
245
 
253
246
  export interface ProductCommon {
254
247
  currency: string;
255
- debugDescription?: string | null;
248
+ debugDescription?: (string | null);
256
249
  description: string;
257
- displayName?: string | null;
250
+ displayName?: (string | null);
258
251
  displayPrice: string;
259
252
  id: string;
260
- platform: Platform;
261
- price?: number | null;
253
+ platform: IapPlatform;
254
+ price?: (number | null);
262
255
  title: string;
263
256
  type: ProductType;
264
257
  }
265
258
 
266
259
  export interface ProductIOS extends ProductCommon {
267
260
  currency: string;
268
- debugDescription?: string | null;
261
+ debugDescription?: (string | null);
269
262
  description: string;
270
- displayName?: string | null;
263
+ displayName?: (string | null);
271
264
  displayNameIOS: string;
272
265
  displayPrice: string;
273
266
  id: string;
274
267
  isFamilyShareableIOS: boolean;
275
268
  jsonRepresentationIOS: string;
276
- platform: Platform;
277
- price?: number | null;
278
- subscriptionInfoIOS?: SubscriptionInfoIOS | null;
269
+ platform: IapPlatform;
270
+ price?: (number | null);
271
+ subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
279
272
  title: string;
280
273
  type: ProductType;
281
274
  typeIOS: ProductTypeIOS;
282
275
  }
283
276
 
284
- export enum ProductQueryType {
285
- All = 'ALL',
286
- InApp = 'IN_APP',
287
- Subs = 'SUBS',
288
- }
277
+ export type ProductQueryType = 'all' | 'in-app' | 'subs';
289
278
 
290
279
  export interface ProductRequest {
291
280
  skus: string[];
292
- type?: ProductQueryType | null;
281
+ type?: (ProductQueryType | null);
293
282
  }
294
283
 
295
- export type ProductSubscription =
296
- | ProductSubscriptionAndroid
297
- | ProductSubscriptionIOS;
284
+ export type ProductSubscription = ProductSubscriptionAndroid | ProductSubscriptionIOS;
298
285
 
299
286
  export interface ProductSubscriptionAndroid extends ProductCommon {
300
287
  currency: string;
301
- debugDescription?: string | null;
288
+ debugDescription?: (string | null);
302
289
  description: string;
303
- displayName?: string | null;
290
+ displayName?: (string | null);
304
291
  displayPrice: string;
305
292
  id: string;
306
293
  nameAndroid: string;
307
- oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
308
- platform: Platform;
309
- price?: number | null;
294
+ oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
295
+ platform: IapPlatform;
296
+ price?: (number | null);
310
297
  subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
311
298
  title: string;
312
299
  type: ProductType;
@@ -314,7 +301,7 @@ export interface ProductSubscriptionAndroid extends ProductCommon {
314
301
 
315
302
  export interface ProductSubscriptionAndroidOfferDetails {
316
303
  basePlanId: string;
317
- offerId?: string | null;
304
+ offerId?: (string | null);
318
305
  offerTags: string[];
319
306
  offerToken: string;
320
307
  pricingPhases: PricingPhasesAndroid;
@@ -322,73 +309,65 @@ export interface ProductSubscriptionAndroidOfferDetails {
322
309
 
323
310
  export interface ProductSubscriptionIOS extends ProductCommon {
324
311
  currency: string;
325
- debugDescription?: string | null;
312
+ debugDescription?: (string | null);
326
313
  description: string;
327
- discountsIOS?: DiscountIOS[] | null;
328
- displayName?: string | null;
314
+ discountsIOS?: (DiscountIOS[] | null);
315
+ displayName?: (string | null);
329
316
  displayNameIOS: string;
330
317
  displayPrice: string;
331
318
  id: string;
332
- introductoryPriceAsAmountIOS?: string | null;
333
- introductoryPriceIOS?: string | null;
334
- introductoryPriceNumberOfPeriodsIOS?: string | null;
335
- introductoryPricePaymentModeIOS?: PaymentModeIOS | null;
336
- introductoryPriceSubscriptionPeriodIOS?: SubscriptionPeriodIOS | null;
319
+ introductoryPriceAsAmountIOS?: (string | null);
320
+ introductoryPriceIOS?: (string | null);
321
+ introductoryPriceNumberOfPeriodsIOS?: (string | null);
322
+ introductoryPricePaymentModeIOS?: (PaymentModeIOS | null);
323
+ introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);
337
324
  isFamilyShareableIOS: boolean;
338
325
  jsonRepresentationIOS: string;
339
- platform: Platform;
340
- price?: number | null;
341
- subscriptionInfoIOS?: SubscriptionInfoIOS | null;
342
- subscriptionPeriodNumberIOS?: string | null;
343
- subscriptionPeriodUnitIOS?: SubscriptionPeriodIOS | null;
326
+ platform: IapPlatform;
327
+ price?: (number | null);
328
+ subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
329
+ subscriptionPeriodNumberIOS?: (string | null);
330
+ subscriptionPeriodUnitIOS?: (SubscriptionPeriodIOS | null);
344
331
  title: string;
345
332
  type: ProductType;
346
333
  typeIOS: ProductTypeIOS;
347
334
  }
348
335
 
349
- export enum ProductType {
350
- InApp = 'IN_APP',
351
- Subs = 'SUBS',
352
- }
336
+ export type ProductType = 'in-app' | 'subs';
353
337
 
354
- export enum ProductTypeIOS {
355
- AutoRenewableSubscription = 'AUTO_RENEWABLE_SUBSCRIPTION',
356
- Consumable = 'CONSUMABLE',
357
- NonConsumable = 'NON_CONSUMABLE',
358
- NonRenewingSubscription = 'NON_RENEWING_SUBSCRIPTION',
359
- }
338
+ export type ProductTypeIOS = 'auto-renewable-subscription' | 'consumable' | 'non-consumable' | 'non-renewing-subscription';
360
339
 
361
340
  export type Purchase = PurchaseAndroid | PurchaseIOS;
362
341
 
363
342
  export interface PurchaseAndroid extends PurchaseCommon {
364
- autoRenewingAndroid?: boolean | null;
365
- dataAndroid?: string | null;
366
- developerPayloadAndroid?: string | null;
343
+ autoRenewingAndroid?: (boolean | null);
344
+ dataAndroid?: (string | null);
345
+ developerPayloadAndroid?: (string | null);
367
346
  id: string;
368
- ids?: string[] | null;
369
- isAcknowledgedAndroid?: boolean | null;
347
+ ids?: (string[] | null);
348
+ isAcknowledgedAndroid?: (boolean | null);
370
349
  isAutoRenewing: boolean;
371
- obfuscatedAccountIdAndroid?: string | null;
372
- obfuscatedProfileIdAndroid?: string | null;
373
- packageNameAndroid?: string | null;
374
- platform: Platform;
350
+ obfuscatedAccountIdAndroid?: (string | null);
351
+ obfuscatedProfileIdAndroid?: (string | null);
352
+ packageNameAndroid?: (string | null);
353
+ platform: IapPlatform;
375
354
  productId: string;
376
355
  purchaseState: PurchaseState;
377
- purchaseToken?: string | null;
356
+ purchaseToken?: (string | null);
378
357
  quantity: number;
379
- signatureAndroid?: string | null;
358
+ signatureAndroid?: (string | null);
380
359
  transactionDate: number;
381
360
  }
382
361
 
383
362
  export interface PurchaseCommon {
384
363
  id: string;
385
- ids?: string[] | null;
364
+ ids?: (string[] | null);
386
365
  isAutoRenewing: boolean;
387
- platform: Platform;
366
+ platform: IapPlatform;
388
367
  productId: string;
389
368
  purchaseState: PurchaseState;
390
369
  /** Unified purchase token (iOS JWS, Android purchaseToken) */
391
- purchaseToken?: string | null;
370
+ purchaseToken?: (string | null);
392
371
  quantity: number;
393
372
  transactionDate: number;
394
373
  }
@@ -396,50 +375,50 @@ export interface PurchaseCommon {
396
375
  export interface PurchaseError {
397
376
  code: ErrorCode;
398
377
  message: string;
399
- productId?: string | null;
378
+ productId?: (string | null);
400
379
  }
401
380
 
402
381
  export interface PurchaseIOS extends PurchaseCommon {
403
- appAccountToken?: string | null;
404
- appBundleIdIOS?: string | null;
405
- countryCodeIOS?: string | null;
406
- currencyCodeIOS?: string | null;
407
- currencySymbolIOS?: string | null;
408
- environmentIOS?: string | null;
409
- expirationDateIOS?: number | null;
382
+ appAccountToken?: (string | null);
383
+ appBundleIdIOS?: (string | null);
384
+ countryCodeIOS?: (string | null);
385
+ currencyCodeIOS?: (string | null);
386
+ currencySymbolIOS?: (string | null);
387
+ environmentIOS?: (string | null);
388
+ expirationDateIOS?: (number | null);
410
389
  id: string;
411
- ids?: string[] | null;
390
+ ids?: (string[] | null);
412
391
  isAutoRenewing: boolean;
413
- isUpgradedIOS?: boolean | null;
414
- offerIOS?: PurchaseOfferIOS | null;
415
- originalTransactionDateIOS?: number | null;
416
- originalTransactionIdentifierIOS?: string | null;
417
- ownershipTypeIOS?: string | null;
418
- platform: Platform;
392
+ isUpgradedIOS?: (boolean | null);
393
+ offerIOS?: (PurchaseOfferIOS | null);
394
+ originalTransactionDateIOS?: (number | null);
395
+ originalTransactionIdentifierIOS?: (string | null);
396
+ ownershipTypeIOS?: (string | null);
397
+ platform: IapPlatform;
419
398
  productId: string;
420
399
  purchaseState: PurchaseState;
421
- purchaseToken?: string | null;
400
+ purchaseToken?: (string | null);
422
401
  quantity: number;
423
- quantityIOS?: number | null;
424
- reasonIOS?: string | null;
425
- reasonStringRepresentationIOS?: string | null;
426
- revocationDateIOS?: number | null;
427
- revocationReasonIOS?: string | null;
428
- storefrontCountryCodeIOS?: string | null;
429
- subscriptionGroupIdIOS?: string | null;
402
+ quantityIOS?: (number | null);
403
+ reasonIOS?: (string | null);
404
+ reasonStringRepresentationIOS?: (string | null);
405
+ revocationDateIOS?: (number | null);
406
+ revocationReasonIOS?: (string | null);
407
+ storefrontCountryCodeIOS?: (string | null);
408
+ subscriptionGroupIdIOS?: (string | null);
430
409
  transactionDate: number;
431
- transactionReasonIOS?: string | null;
432
- webOrderLineItemIdIOS?: string | null;
410
+ transactionReasonIOS?: (string | null);
411
+ webOrderLineItemIdIOS?: (string | null);
433
412
  }
434
413
 
435
414
  export interface PurchaseInput {
436
415
  id: string;
437
- ids?: string[] | null;
416
+ ids?: (string[] | null);
438
417
  isAutoRenewing: boolean;
439
- platform: Platform;
418
+ platform: IapPlatform;
440
419
  productId: string;
441
420
  purchaseState: PurchaseState;
442
- purchaseToken?: string | null;
421
+ purchaseToken?: (string | null);
443
422
  quantity: number;
444
423
  transactionDate: number;
445
424
  }
@@ -452,28 +431,12 @@ export interface PurchaseOfferIOS {
452
431
 
453
432
  export interface PurchaseOptions {
454
433
  /** Also emit results through the iOS event listeners */
455
- alsoPublishToEventListenerIOS?: boolean | null;
434
+ alsoPublishToEventListenerIOS?: (boolean | null);
456
435
  /** Limit to currently active items on iOS */
457
- onlyIncludeActiveItemsIOS?: boolean | null;
458
- }
459
-
460
- export interface PurchaseParams {
461
- /** Per-platform purchase request props */
462
- requestPurchase?: RequestPurchasePropsByPlatforms | null;
463
- /** Per-platform subscription request props */
464
- requestSubscription?: RequestSubscriptionPropsByPlatforms | null;
465
- /** Explicit purchase type hint (defaults to in-app) */
466
- type?: ProductQueryType | null;
436
+ onlyIncludeActiveItemsIOS?: (boolean | null);
467
437
  }
468
438
 
469
- export enum PurchaseState {
470
- Deferred = 'DEFERRED',
471
- Failed = 'FAILED',
472
- Pending = 'PENDING',
473
- Purchased = 'PURCHASED',
474
- Restored = 'RESTORED',
475
- Unknown = 'UNKNOWN',
476
- }
439
+ export type PurchaseState = 'deferred' | 'failed' | 'pending' | 'purchased' | 'restored' | 'unknown';
477
440
 
478
441
  export interface Query {
479
442
  /** Get current StoreKit 2 entitlements (iOS 15+) */
@@ -483,13 +446,13 @@ export interface Query {
483
446
  /** Get active subscriptions (filters by subscriptionIds when provided) */
484
447
  getActiveSubscriptions: Promise<ActiveSubscription[]>;
485
448
  /** Fetch the current app transaction (iOS 16+) */
486
- getAppTransactionIOS?: Promise<AppTransaction | null>;
449
+ getAppTransactionIOS?: Promise<(AppTransaction | null)>;
487
450
  /** Get all available purchases for the current user */
488
451
  getAvailablePurchases: Promise<Purchase[]>;
489
452
  /** Retrieve all pending transactions in the StoreKit queue */
490
453
  getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
491
454
  /** Get the currently promoted product (iOS 11+) */
492
- getPromotedProductIOS?: Promise<ProductIOS | null>;
455
+ getPromotedProductIOS?: Promise<(ProductIOS | null)>;
493
456
  /** Get base64-encoded receipt data for validation */
494
457
  getReceiptDataIOS: Promise<string>;
495
458
  /** Get the current App Store storefront country code */
@@ -503,76 +466,84 @@ export interface Query {
503
466
  /** Verify a StoreKit 2 transaction signature */
504
467
  isTransactionVerifiedIOS: Promise<boolean>;
505
468
  /** Get the latest transaction for a product using StoreKit 2 */
506
- latestTransactionIOS?: Promise<PurchaseIOS | null>;
469
+ latestTransactionIOS?: Promise<(PurchaseIOS | null)>;
507
470
  /** Get StoreKit 2 subscription status details (iOS 15+) */
508
471
  subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;
509
472
  }
510
473
 
474
+
511
475
  export interface QueryCurrentEntitlementIosArgs {
512
- skus?: string[] | null;
476
+ skus?: (string[] | null);
513
477
  }
514
478
 
479
+
515
480
  export interface QueryFetchProductsArgs {
516
481
  params: ProductRequest;
517
482
  }
518
483
 
484
+
519
485
  export interface QueryGetActiveSubscriptionsArgs {
520
- subscriptionIds?: string[] | null;
486
+ subscriptionIds?: (string[] | null);
521
487
  }
522
488
 
489
+
523
490
  export interface QueryGetAvailablePurchasesArgs {
524
- options?: PurchaseOptions | null;
491
+ options?: (PurchaseOptions | null);
525
492
  }
526
493
 
494
+
527
495
  export interface QueryGetTransactionJwsIosArgs {
528
496
  transactionId: string;
529
497
  }
530
498
 
499
+
531
500
  export interface QueryHasActiveSubscriptionsArgs {
532
- subscriptionIds?: string[] | null;
501
+ subscriptionIds?: (string[] | null);
533
502
  }
534
503
 
504
+
535
505
  export interface QueryIsEligibleForIntroOfferIosArgs {
536
506
  productIds: string[];
537
507
  }
538
508
 
509
+
539
510
  export interface QueryIsTransactionVerifiedIosArgs {
540
511
  transactionId: string;
541
512
  }
542
513
 
514
+
543
515
  export interface QueryLatestTransactionIosArgs {
544
516
  sku: string;
545
517
  }
546
518
 
519
+
547
520
  export interface QuerySubscriptionStatusIosArgs {
548
- skus?: string[] | null;
521
+ skus?: (string[] | null);
549
522
  }
550
523
 
551
524
  export interface ReceiptValidationAndroidOptions {
552
525
  accessToken: string;
553
- isSub?: boolean | null;
526
+ isSub?: (boolean | null);
554
527
  packageName: string;
555
528
  productToken: string;
556
529
  }
557
530
 
558
531
  export interface ReceiptValidationProps {
559
532
  /** Android-specific validation options */
560
- androidOptions?: ReceiptValidationAndroidOptions | null;
533
+ androidOptions?: (ReceiptValidationAndroidOptions | null);
561
534
  /** Product SKU to validate */
562
535
  sku: string;
563
536
  }
564
537
 
565
- export type ReceiptValidationResult =
566
- | ReceiptValidationResultAndroid
567
- | ReceiptValidationResultIOS;
538
+ export type ReceiptValidationResult = ReceiptValidationResultAndroid | ReceiptValidationResultIOS;
568
539
 
569
540
  export interface ReceiptValidationResultAndroid {
570
541
  autoRenewing: boolean;
571
542
  betaProduct: boolean;
572
- cancelDate?: number | null;
573
- cancelReason?: string | null;
574
- deferredDate?: number | null;
575
- deferredSku?: string | null;
543
+ cancelDate?: (number | null);
544
+ cancelReason?: (string | null);
545
+ deferredDate?: (number | null);
546
+ deferredSku?: (string | null);
576
547
  freeTrialEndDate: number;
577
548
  gracePeriodEndDate: number;
578
549
  parentProductId: string;
@@ -593,95 +564,100 @@ export interface ReceiptValidationResultIOS {
593
564
  /** JWS representation */
594
565
  jwsRepresentation: string;
595
566
  /** Latest transaction if available */
596
- latestTransaction?: Purchase | null;
567
+ latestTransaction?: (Purchase | null);
597
568
  /** Receipt data string */
598
569
  receiptData: string;
599
570
  }
600
571
 
601
572
  export interface RefundResultIOS {
602
- message?: string | null;
573
+ message?: (string | null);
603
574
  status: string;
604
575
  }
605
576
 
606
577
  export interface RenewalInfoIOS {
607
- autoRenewPreference?: string | null;
608
- jsonRepresentation?: string | null;
578
+ autoRenewPreference?: (string | null);
579
+ jsonRepresentation?: (string | null);
609
580
  willAutoRenew: boolean;
610
581
  }
611
582
 
612
583
  export interface RequestPurchaseAndroidProps {
613
584
  /** Personalized offer flag */
614
- isOfferPersonalized?: boolean | null;
585
+ isOfferPersonalized?: (boolean | null);
615
586
  /** Obfuscated account ID */
616
- obfuscatedAccountIdAndroid?: string | null;
587
+ obfuscatedAccountIdAndroid?: (string | null);
617
588
  /** Obfuscated profile ID */
618
- obfuscatedProfileIdAndroid?: string | null;
589
+ obfuscatedProfileIdAndroid?: (string | null);
619
590
  /** List of product SKUs */
620
591
  skus: string[];
621
592
  }
622
593
 
623
594
  export interface RequestPurchaseIosProps {
624
595
  /** Auto-finish transaction (dangerous) */
625
- andDangerouslyFinishTransactionAutomatically?: boolean | null;
596
+ andDangerouslyFinishTransactionAutomatically?: (boolean | null);
626
597
  /** App account token for user tracking */
627
- appAccountToken?: string | null;
598
+ appAccountToken?: (string | null);
628
599
  /** Purchase quantity */
629
- quantity?: number | null;
600
+ quantity?: (number | null);
630
601
  /** Product SKU */
631
602
  sku: string;
632
603
  /** Discount offer to apply */
633
- withOffer?: DiscountOfferInputIOS | null;
604
+ withOffer?: (DiscountOfferInputIOS | null);
634
605
  }
635
606
 
636
- export interface RequestPurchaseProps {
637
- /** Android-specific purchase parameters */
638
- android?: RequestPurchaseAndroidProps | null;
639
- /** iOS-specific purchase parameters */
640
- ios?: RequestPurchaseIosProps | null;
641
- }
607
+ export type RequestPurchaseProps =
608
+ | {
609
+ /** Per-platform purchase request props */
610
+ request: RequestPurchasePropsByPlatforms;
611
+ type: 'in-app';
612
+ }
613
+ | {
614
+ /** Per-platform subscription request props */
615
+ request: RequestSubscriptionPropsByPlatforms;
616
+ type: 'subs';
617
+ };
642
618
 
643
619
  export interface RequestPurchasePropsByPlatforms {
644
620
  /** Android-specific purchase parameters */
645
- android?: RequestPurchaseAndroidProps | null;
621
+ android?: (RequestPurchaseAndroidProps | null);
646
622
  /** iOS-specific purchase parameters */
647
- ios?: RequestPurchaseIosProps | null;
623
+ ios?: (RequestPurchaseIosProps | null);
648
624
  }
649
625
 
650
626
  export interface RequestPurchaseResult {
651
- purchase?: Purchase | null;
652
- purchases?: Purchase[] | null;
627
+ purchase?: (Purchase | null);
628
+ purchases?: (Purchase[] | null);
653
629
  }
654
630
 
655
631
  export interface RequestSubscriptionAndroidProps {
656
632
  /** Personalized offer flag */
657
- isOfferPersonalized?: boolean | null;
633
+ isOfferPersonalized?: (boolean | null);
658
634
  /** Obfuscated account ID */
659
- obfuscatedAccountIdAndroid?: string | null;
635
+ obfuscatedAccountIdAndroid?: (string | null);
660
636
  /** Obfuscated profile ID */
661
- obfuscatedProfileIdAndroid?: string | null;
637
+ obfuscatedProfileIdAndroid?: (string | null);
662
638
  /** Purchase token for upgrades/downgrades */
663
- purchaseTokenAndroid?: string | null;
639
+ purchaseTokenAndroid?: (string | null);
664
640
  /** Replacement mode for subscription changes */
665
- replacementModeAndroid?: number | null;
641
+ replacementModeAndroid?: (number | null);
666
642
  /** List of subscription SKUs */
667
643
  skus: string[];
668
644
  /** Subscription offers */
669
- subscriptionOffers?: AndroidSubscriptionOfferInput[] | null;
645
+ subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);
670
646
  }
671
647
 
672
648
  export interface RequestSubscriptionIosProps {
673
- andDangerouslyFinishTransactionAutomatically?: boolean | null;
674
- appAccountToken?: string | null;
675
- quantity?: number | null;
649
+ andDangerouslyFinishTransactionAutomatically?: (boolean | null);
650
+ appAccountToken?: (string | null);
651
+ quantity?: (number | null);
676
652
  sku: string;
677
- withOffer?: DiscountOfferInputIOS | null;
653
+ withOffer?: (DiscountOfferInputIOS | null);
678
654
  }
679
655
 
680
656
  export interface RequestSubscriptionPropsByPlatforms {
681
657
  /** Android-specific subscription parameters */
682
- android?: RequestSubscriptionAndroidProps | null;
658
+ android?: (RequestSubscriptionAndroidProps | null);
683
659
  /** iOS-specific subscription parameters */
684
- ios?: RequestSubscriptionIosProps | null;
660
+ ios?: (RequestSubscriptionIosProps | null);
685
661
  }
686
662
 
687
663
  export interface Subscription {
@@ -694,8 +670,8 @@ export interface Subscription {
694
670
  }
695
671
 
696
672
  export interface SubscriptionInfoIOS {
697
- introductoryOffer?: SubscriptionOfferIOS | null;
698
- promotionalOffers?: SubscriptionOfferIOS[] | null;
673
+ introductoryOffer?: (SubscriptionOfferIOS | null);
674
+ promotionalOffers?: (SubscriptionOfferIOS[] | null);
699
675
  subscriptionGroupId: string;
700
676
  subscriptionPeriod: SubscriptionPeriodValueIOS;
701
677
  }
@@ -710,18 +686,9 @@ export interface SubscriptionOfferIOS {
710
686
  type: SubscriptionOfferTypeIOS;
711
687
  }
712
688
 
713
- export enum SubscriptionOfferTypeIOS {
714
- Introductory = 'INTRODUCTORY',
715
- Promotional = 'PROMOTIONAL',
716
- }
689
+ export type SubscriptionOfferTypeIOS = 'introductory' | 'promotional';
717
690
 
718
- export enum SubscriptionPeriodIOS {
719
- Day = 'DAY',
720
- Empty = 'EMPTY',
721
- Month = 'MONTH',
722
- Week = 'WEEK',
723
- Year = 'YEAR',
724
- }
691
+ export type SubscriptionPeriodIOS = 'day' | 'empty' | 'month' | 'week' | 'year';
725
692
 
726
693
  export interface SubscriptionPeriodValueIOS {
727
694
  unit: SubscriptionPeriodIOS;
@@ -729,7 +696,7 @@ export interface SubscriptionPeriodValueIOS {
729
696
  }
730
697
 
731
698
  export interface SubscriptionStatusIOS {
732
- renewalInfo?: RenewalInfoIOS | null;
699
+ renewalInfo?: (RenewalInfoIOS | null);
733
700
  state: string;
734
701
  }
735
702