react-native-iap 14.3.5-rc.1 → 14.3.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 (79) hide show
  1. package/NitroIap.podspec +1 -1
  2. package/README.md +1 -1
  3. package/android/CMakeLists.txt +4 -0
  4. package/android/build.gradle +2 -2
  5. package/android/src/main/cpp/cpp-adapter.cpp +8 -0
  6. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +93 -51
  7. package/ios/HybridRnIap.swift +38 -30
  8. package/lib/module/hooks/useIAP.js +3 -5
  9. package/lib/module/hooks/useIAP.js.map +1 -1
  10. package/lib/module/index.js +54 -55
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/module/types.js +1 -1
  13. package/lib/module/utils/type-bridge.js.map +1 -1
  14. package/lib/typescript/src/hooks/useIAP.d.ts +4 -4
  15. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  16. package/lib/typescript/src/index.d.ts +8 -7
  17. package/lib/typescript/src/index.d.ts.map +1 -1
  18. package/lib/typescript/src/specs/RnIap.nitro.d.ts +2 -1
  19. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  20. package/lib/typescript/src/types.d.ts +141 -146
  21. package/lib/typescript/src/types.d.ts.map +1 -1
  22. package/lib/typescript/src/utils/type-bridge.d.ts.map +1 -1
  23. package/nitrogen/generated/android/NitroIap+autolinking.cmake +9 -4
  24. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +32 -5
  25. package/nitrogen/generated/android/c++/JHybridRnIapSpec.hpp +1 -1
  26. package/nitrogen/generated/android/c++/JIapPlatform.hpp +59 -0
  27. package/nitrogen/generated/android/c++/JPurchase.cpp +26 -0
  28. package/nitrogen/generated/android/c++/JPurchase.hpp +80 -0
  29. package/nitrogen/generated/android/c++/JPurchaseAndroid.hpp +140 -0
  30. package/nitrogen/generated/android/c++/JPurchaseIOS.hpp +194 -0
  31. package/nitrogen/generated/android/c++/JPurchaseOfferIOS.hpp +61 -0
  32. package/nitrogen/generated/android/c++/JPurchaseState.hpp +71 -0
  33. package/nitrogen/generated/android/c++/JRequestPurchaseResult.hpp +89 -0
  34. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.cpp +26 -0
  35. package/nitrogen/generated/android/c++/JVariant_PurchaseAndroid_PurchaseIOS.hpp +80 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/HybridRnIapSpec.kt +1 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapPlatform.kt +21 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Purchase.kt +42 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseAndroid.kt +77 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseIOS.kt +116 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseOfferIOS.kt +35 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/PurchaseState.kt +25 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/RequestPurchaseResult.kt +32 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_PurchaseAndroid_PurchaseIOS.kt +42 -0
  45. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.cpp +13 -5
  46. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +186 -25
  47. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +18 -0
  48. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +20 -2
  49. package/nitrogen/generated/ios/swift/Func_void_RequestPurchaseResult.swift +47 -0
  50. package/nitrogen/generated/ios/swift/HybridRnIapSpec.swift +1 -1
  51. package/nitrogen/generated/ios/swift/HybridRnIapSpec_cxx.swift +7 -7
  52. package/nitrogen/generated/ios/swift/IapPlatform.swift +40 -0
  53. package/nitrogen/generated/ios/swift/Purchase.swift +18 -0
  54. package/nitrogen/generated/ios/swift/PurchaseAndroid.swift +399 -0
  55. package/nitrogen/generated/ios/swift/PurchaseIOS.swift +768 -0
  56. package/nitrogen/generated/ios/swift/PurchaseOfferIOS.swift +57 -0
  57. package/nitrogen/generated/ios/swift/PurchaseState.swift +56 -0
  58. package/nitrogen/generated/ios/swift/RequestPurchaseResult.swift +148 -0
  59. package/nitrogen/generated/ios/swift/Variant_PurchaseAndroid_PurchaseIOS.swift +18 -0
  60. package/nitrogen/generated/shared/c++/HybridRnIapSpec.hpp +4 -1
  61. package/nitrogen/generated/shared/c++/IapPlatform.hpp +76 -0
  62. package/nitrogen/generated/shared/c++/PurchaseAndroid.hpp +138 -0
  63. package/nitrogen/generated/shared/c++/PurchaseIOS.hpp +193 -0
  64. package/nitrogen/generated/shared/c++/PurchaseOfferIOS.hpp +75 -0
  65. package/nitrogen/generated/shared/c++/PurchaseState.hpp +92 -0
  66. package/nitrogen/generated/shared/c++/RequestPurchaseResult.hpp +78 -0
  67. package/package.json +5 -4
  68. package/plugin/build/withIAP.js +1 -1
  69. package/plugin/src/withIAP.ts +1 -1
  70. package/plugin/tsconfig.tsbuildinfo +1 -1
  71. package/src/hooks/useIAP.ts +13 -11
  72. package/src/index.ts +73 -77
  73. package/src/specs/RnIap.nitro.ts +4 -1
  74. package/src/types.ts +168 -178
  75. package/src/utils/type-bridge.ts +3 -1
  76. package/lib/index.d.ts +0 -8
  77. package/lib/index.js +0 -36
  78. package/lib/specs/RnIap.nitro.d.ts +0 -7
  79. package/lib/specs/RnIap.nitro.js +0 -1
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,18 +123,15 @@ 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 type IapEvent =
135
- | 'promoted-product-ios'
136
- | 'purchase-error'
137
- | 'purchase-updated';
134
+ export type IapEvent = 'promoted-product-ios' | 'purchase-error' | 'purchase-updated';
138
135
 
139
136
  export type IapPlatform = 'android' | 'ios';
140
137
 
@@ -158,7 +155,7 @@ export interface Mutation {
158
155
  /** Present the App Store code redemption sheet */
159
156
  presentCodeRedemptionSheetIOS: Promise<VoidResult>;
160
157
  /** Initiate a purchase flow; rely on events for final state */
161
- requestPurchase?: Promise<RequestPurchaseResult | null>;
158
+ requestPurchase?: Promise<(RequestPurchaseResult | null)>;
162
159
  /** Purchase the promoted product surfaced by the App Store */
163
160
  requestPurchaseOnPromotedProductIOS: Promise<PurchaseIOS>;
164
161
  /** Restore completed purchases across platforms */
@@ -171,40 +168,43 @@ export interface Mutation {
171
168
  validateReceipt: Promise<ReceiptValidationResult>;
172
169
  }
173
170
 
171
+
174
172
  export interface MutationAcknowledgePurchaseAndroidArgs {
175
173
  purchaseToken: string;
176
174
  }
177
175
 
176
+
178
177
  export interface MutationBeginRefundRequestIosArgs {
179
178
  sku: string;
180
179
  }
181
180
 
181
+
182
182
  export interface MutationConsumePurchaseAndroidArgs {
183
183
  purchaseToken: string;
184
184
  }
185
185
 
186
+
186
187
  export interface MutationDeepLinkToSubscriptionsArgs {
187
- options?: DeepLinkOptions | null;
188
+ options?: (DeepLinkOptions | null);
188
189
  }
189
190
 
191
+
190
192
  export interface MutationFinishTransactionArgs {
191
- isConsumable?: boolean | null;
193
+ isConsumable?: (boolean | null);
192
194
  purchase: PurchaseInput;
193
195
  }
194
196
 
197
+
195
198
  export interface MutationRequestPurchaseArgs {
196
- params: PurchaseParams;
199
+ params: RequestPurchaseProps;
197
200
  }
198
201
 
202
+
199
203
  export interface MutationValidateReceiptArgs {
200
204
  options: ReceiptValidationProps;
201
205
  }
202
206
 
203
- export type PaymentModeIOS =
204
- | 'empty'
205
- | 'free-trial'
206
- | 'pay-as-you-go'
207
- | 'pay-up-front';
207
+ export type PaymentModeIOS = 'empty' | 'free-trial' | 'pay-as-you-go' | 'pay-up-front';
208
208
 
209
209
  export interface PricingPhaseAndroid {
210
210
  billingCycleCount: number;
@@ -223,18 +223,16 @@ export type Product = ProductAndroid | ProductIOS;
223
223
 
224
224
  export interface ProductAndroid extends ProductCommon {
225
225
  currency: string;
226
- debugDescription?: string | null;
226
+ debugDescription?: (string | null);
227
227
  description: string;
228
- displayName?: string | null;
228
+ displayName?: (string | null);
229
229
  displayPrice: string;
230
230
  id: string;
231
231
  nameAndroid: string;
232
- oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
232
+ oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
233
233
  platform: IapPlatform;
234
- price?: number | null;
235
- subscriptionOfferDetailsAndroid?:
236
- | ProductSubscriptionAndroidOfferDetails[]
237
- | null;
234
+ price?: (number | null);
235
+ subscriptionOfferDetailsAndroid?: (ProductSubscriptionAndroidOfferDetails[] | null);
238
236
  title: string;
239
237
  type: ProductType;
240
238
  }
@@ -247,30 +245,30 @@ export interface ProductAndroidOneTimePurchaseOfferDetail {
247
245
 
248
246
  export interface ProductCommon {
249
247
  currency: string;
250
- debugDescription?: string | null;
248
+ debugDescription?: (string | null);
251
249
  description: string;
252
- displayName?: string | null;
250
+ displayName?: (string | null);
253
251
  displayPrice: string;
254
252
  id: string;
255
253
  platform: IapPlatform;
256
- price?: number | null;
254
+ price?: (number | null);
257
255
  title: string;
258
256
  type: ProductType;
259
257
  }
260
258
 
261
259
  export interface ProductIOS extends ProductCommon {
262
260
  currency: string;
263
- debugDescription?: string | null;
261
+ debugDescription?: (string | null);
264
262
  description: string;
265
- displayName?: string | null;
263
+ displayName?: (string | null);
266
264
  displayNameIOS: string;
267
265
  displayPrice: string;
268
266
  id: string;
269
267
  isFamilyShareableIOS: boolean;
270
268
  jsonRepresentationIOS: string;
271
269
  platform: IapPlatform;
272
- price?: number | null;
273
- subscriptionInfoIOS?: SubscriptionInfoIOS | null;
270
+ price?: (number | null);
271
+ subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
274
272
  title: string;
275
273
  type: ProductType;
276
274
  typeIOS: ProductTypeIOS;
@@ -280,24 +278,22 @@ export type ProductQueryType = 'all' | 'in-app' | 'subs';
280
278
 
281
279
  export interface ProductRequest {
282
280
  skus: string[];
283
- type?: ProductQueryType | null;
281
+ type?: (ProductQueryType | null);
284
282
  }
285
283
 
286
- export type ProductSubscription =
287
- | ProductSubscriptionAndroid
288
- | ProductSubscriptionIOS;
284
+ export type ProductSubscription = ProductSubscriptionAndroid | ProductSubscriptionIOS;
289
285
 
290
286
  export interface ProductSubscriptionAndroid extends ProductCommon {
291
287
  currency: string;
292
- debugDescription?: string | null;
288
+ debugDescription?: (string | null);
293
289
  description: string;
294
- displayName?: string | null;
290
+ displayName?: (string | null);
295
291
  displayPrice: string;
296
292
  id: string;
297
293
  nameAndroid: string;
298
- oneTimePurchaseOfferDetailsAndroid?: ProductAndroidOneTimePurchaseOfferDetail | null;
294
+ oneTimePurchaseOfferDetailsAndroid?: (ProductAndroidOneTimePurchaseOfferDetail | null);
299
295
  platform: IapPlatform;
300
- price?: number | null;
296
+ price?: (number | null);
301
297
  subscriptionOfferDetailsAndroid: ProductSubscriptionAndroidOfferDetails[];
302
298
  title: string;
303
299
  type: ProductType;
@@ -305,7 +301,7 @@ export interface ProductSubscriptionAndroid extends ProductCommon {
305
301
 
306
302
  export interface ProductSubscriptionAndroidOfferDetails {
307
303
  basePlanId: string;
308
- offerId?: string | null;
304
+ offerId?: (string | null);
309
305
  offerTags: string[];
310
306
  offerToken: string;
311
307
  pricingPhases: PricingPhasesAndroid;
@@ -313,25 +309,25 @@ export interface ProductSubscriptionAndroidOfferDetails {
313
309
 
314
310
  export interface ProductSubscriptionIOS extends ProductCommon {
315
311
  currency: string;
316
- debugDescription?: string | null;
312
+ debugDescription?: (string | null);
317
313
  description: string;
318
- discountsIOS?: DiscountIOS[] | null;
319
- displayName?: string | null;
314
+ discountsIOS?: (DiscountIOS[] | null);
315
+ displayName?: (string | null);
320
316
  displayNameIOS: string;
321
317
  displayPrice: string;
322
318
  id: string;
323
- introductoryPriceAsAmountIOS?: string | null;
324
- introductoryPriceIOS?: string | null;
325
- introductoryPriceNumberOfPeriodsIOS?: string | null;
326
- introductoryPricePaymentModeIOS?: PaymentModeIOS | null;
327
- introductoryPriceSubscriptionPeriodIOS?: SubscriptionPeriodIOS | null;
319
+ introductoryPriceAsAmountIOS?: (string | null);
320
+ introductoryPriceIOS?: (string | null);
321
+ introductoryPriceNumberOfPeriodsIOS?: (string | null);
322
+ introductoryPricePaymentModeIOS?: (PaymentModeIOS | null);
323
+ introductoryPriceSubscriptionPeriodIOS?: (SubscriptionPeriodIOS | null);
328
324
  isFamilyShareableIOS: boolean;
329
325
  jsonRepresentationIOS: string;
330
326
  platform: IapPlatform;
331
- price?: number | null;
332
- subscriptionInfoIOS?: SubscriptionInfoIOS | null;
333
- subscriptionPeriodNumberIOS?: string | null;
334
- subscriptionPeriodUnitIOS?: SubscriptionPeriodIOS | null;
327
+ price?: (number | null);
328
+ subscriptionInfoIOS?: (SubscriptionInfoIOS | null);
329
+ subscriptionPeriodNumberIOS?: (string | null);
330
+ subscriptionPeriodUnitIOS?: (SubscriptionPeriodIOS | null);
335
331
  title: string;
336
332
  type: ProductType;
337
333
  typeIOS: ProductTypeIOS;
@@ -339,43 +335,39 @@ export interface ProductSubscriptionIOS extends ProductCommon {
339
335
 
340
336
  export type ProductType = 'in-app' | 'subs';
341
337
 
342
- export type ProductTypeIOS =
343
- | 'auto-renewable-subscription'
344
- | 'consumable'
345
- | 'non-consumable'
346
- | 'non-renewing-subscription';
338
+ export type ProductTypeIOS = 'auto-renewable-subscription' | 'consumable' | 'non-consumable' | 'non-renewing-subscription';
347
339
 
348
340
  export type Purchase = PurchaseAndroid | PurchaseIOS;
349
341
 
350
342
  export interface PurchaseAndroid extends PurchaseCommon {
351
- autoRenewingAndroid?: boolean | null;
352
- dataAndroid?: string | null;
353
- developerPayloadAndroid?: string | null;
343
+ autoRenewingAndroid?: (boolean | null);
344
+ dataAndroid?: (string | null);
345
+ developerPayloadAndroid?: (string | null);
354
346
  id: string;
355
- ids?: string[] | null;
356
- isAcknowledgedAndroid?: boolean | null;
347
+ ids?: (string[] | null);
348
+ isAcknowledgedAndroid?: (boolean | null);
357
349
  isAutoRenewing: boolean;
358
- obfuscatedAccountIdAndroid?: string | null;
359
- obfuscatedProfileIdAndroid?: string | null;
360
- packageNameAndroid?: string | null;
350
+ obfuscatedAccountIdAndroid?: (string | null);
351
+ obfuscatedProfileIdAndroid?: (string | null);
352
+ packageNameAndroid?: (string | null);
361
353
  platform: IapPlatform;
362
354
  productId: string;
363
355
  purchaseState: PurchaseState;
364
- purchaseToken?: string | null;
356
+ purchaseToken?: (string | null);
365
357
  quantity: number;
366
- signatureAndroid?: string | null;
358
+ signatureAndroid?: (string | null);
367
359
  transactionDate: number;
368
360
  }
369
361
 
370
362
  export interface PurchaseCommon {
371
363
  id: string;
372
- ids?: string[] | null;
364
+ ids?: (string[] | null);
373
365
  isAutoRenewing: boolean;
374
366
  platform: IapPlatform;
375
367
  productId: string;
376
368
  purchaseState: PurchaseState;
377
369
  /** Unified purchase token (iOS JWS, Android purchaseToken) */
378
- purchaseToken?: string | null;
370
+ purchaseToken?: (string | null);
379
371
  quantity: number;
380
372
  transactionDate: number;
381
373
  }
@@ -383,50 +375,50 @@ export interface PurchaseCommon {
383
375
  export interface PurchaseError {
384
376
  code: ErrorCode;
385
377
  message: string;
386
- productId?: string | null;
378
+ productId?: (string | null);
387
379
  }
388
380
 
389
381
  export interface PurchaseIOS extends PurchaseCommon {
390
- appAccountToken?: string | null;
391
- appBundleIdIOS?: string | null;
392
- countryCodeIOS?: string | null;
393
- currencyCodeIOS?: string | null;
394
- currencySymbolIOS?: string | null;
395
- environmentIOS?: string | null;
396
- 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);
397
389
  id: string;
398
- ids?: string[] | null;
390
+ ids?: (string[] | null);
399
391
  isAutoRenewing: boolean;
400
- isUpgradedIOS?: boolean | null;
401
- offerIOS?: PurchaseOfferIOS | null;
402
- originalTransactionDateIOS?: number | null;
403
- originalTransactionIdentifierIOS?: string | null;
404
- ownershipTypeIOS?: string | null;
392
+ isUpgradedIOS?: (boolean | null);
393
+ offerIOS?: (PurchaseOfferIOS | null);
394
+ originalTransactionDateIOS?: (number | null);
395
+ originalTransactionIdentifierIOS?: (string | null);
396
+ ownershipTypeIOS?: (string | null);
405
397
  platform: IapPlatform;
406
398
  productId: string;
407
399
  purchaseState: PurchaseState;
408
- purchaseToken?: string | null;
400
+ purchaseToken?: (string | null);
409
401
  quantity: number;
410
- quantityIOS?: number | null;
411
- reasonIOS?: string | null;
412
- reasonStringRepresentationIOS?: string | null;
413
- revocationDateIOS?: number | null;
414
- revocationReasonIOS?: string | null;
415
- storefrontCountryCodeIOS?: string | null;
416
- 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);
417
409
  transactionDate: number;
418
- transactionReasonIOS?: string | null;
419
- webOrderLineItemIdIOS?: string | null;
410
+ transactionReasonIOS?: (string | null);
411
+ webOrderLineItemIdIOS?: (string | null);
420
412
  }
421
413
 
422
414
  export interface PurchaseInput {
423
415
  id: string;
424
- ids?: string[] | null;
416
+ ids?: (string[] | null);
425
417
  isAutoRenewing: boolean;
426
418
  platform: IapPlatform;
427
419
  productId: string;
428
420
  purchaseState: PurchaseState;
429
- purchaseToken?: string | null;
421
+ purchaseToken?: (string | null);
430
422
  quantity: number;
431
423
  transactionDate: number;
432
424
  }
@@ -439,27 +431,12 @@ export interface PurchaseOfferIOS {
439
431
 
440
432
  export interface PurchaseOptions {
441
433
  /** Also emit results through the iOS event listeners */
442
- alsoPublishToEventListenerIOS?: boolean | null;
434
+ alsoPublishToEventListenerIOS?: (boolean | null);
443
435
  /** Limit to currently active items on iOS */
444
- onlyIncludeActiveItemsIOS?: boolean | null;
445
- }
446
-
447
- export interface PurchaseParams {
448
- /** Per-platform purchase request props */
449
- requestPurchase?: RequestPurchasePropsByPlatforms | null;
450
- /** Per-platform subscription request props */
451
- requestSubscription?: RequestSubscriptionPropsByPlatforms | null;
452
- /** Explicit purchase type hint (defaults to in-app) */
453
- type?: ProductQueryType | null;
436
+ onlyIncludeActiveItemsIOS?: (boolean | null);
454
437
  }
455
438
 
456
- export type PurchaseState =
457
- | 'deferred'
458
- | 'failed'
459
- | 'pending'
460
- | 'purchased'
461
- | 'restored'
462
- | 'unknown';
439
+ export type PurchaseState = 'deferred' | 'failed' | 'pending' | 'purchased' | 'restored' | 'unknown';
463
440
 
464
441
  export interface Query {
465
442
  /** Get current StoreKit 2 entitlements (iOS 15+) */
@@ -469,13 +446,13 @@ export interface Query {
469
446
  /** Get active subscriptions (filters by subscriptionIds when provided) */
470
447
  getActiveSubscriptions: Promise<ActiveSubscription[]>;
471
448
  /** Fetch the current app transaction (iOS 16+) */
472
- getAppTransactionIOS?: Promise<AppTransaction | null>;
449
+ getAppTransactionIOS?: Promise<(AppTransaction | null)>;
473
450
  /** Get all available purchases for the current user */
474
451
  getAvailablePurchases: Promise<Purchase[]>;
475
452
  /** Retrieve all pending transactions in the StoreKit queue */
476
453
  getPendingTransactionsIOS: Promise<PurchaseIOS[]>;
477
454
  /** Get the currently promoted product (iOS 11+) */
478
- getPromotedProductIOS?: Promise<ProductIOS | null>;
455
+ getPromotedProductIOS?: Promise<(ProductIOS | null)>;
479
456
  /** Get base64-encoded receipt data for validation */
480
457
  getReceiptDataIOS: Promise<string>;
481
458
  /** Get the current App Store storefront country code */
@@ -489,76 +466,84 @@ export interface Query {
489
466
  /** Verify a StoreKit 2 transaction signature */
490
467
  isTransactionVerifiedIOS: Promise<boolean>;
491
468
  /** Get the latest transaction for a product using StoreKit 2 */
492
- latestTransactionIOS?: Promise<PurchaseIOS | null>;
469
+ latestTransactionIOS?: Promise<(PurchaseIOS | null)>;
493
470
  /** Get StoreKit 2 subscription status details (iOS 15+) */
494
471
  subscriptionStatusIOS: Promise<SubscriptionStatusIOS[]>;
495
472
  }
496
473
 
474
+
497
475
  export interface QueryCurrentEntitlementIosArgs {
498
- skus?: string[] | null;
476
+ skus?: (string[] | null);
499
477
  }
500
478
 
479
+
501
480
  export interface QueryFetchProductsArgs {
502
481
  params: ProductRequest;
503
482
  }
504
483
 
484
+
505
485
  export interface QueryGetActiveSubscriptionsArgs {
506
- subscriptionIds?: string[] | null;
486
+ subscriptionIds?: (string[] | null);
507
487
  }
508
488
 
489
+
509
490
  export interface QueryGetAvailablePurchasesArgs {
510
- options?: PurchaseOptions | null;
491
+ options?: (PurchaseOptions | null);
511
492
  }
512
493
 
494
+
513
495
  export interface QueryGetTransactionJwsIosArgs {
514
496
  transactionId: string;
515
497
  }
516
498
 
499
+
517
500
  export interface QueryHasActiveSubscriptionsArgs {
518
- subscriptionIds?: string[] | null;
501
+ subscriptionIds?: (string[] | null);
519
502
  }
520
503
 
504
+
521
505
  export interface QueryIsEligibleForIntroOfferIosArgs {
522
506
  productIds: string[];
523
507
  }
524
508
 
509
+
525
510
  export interface QueryIsTransactionVerifiedIosArgs {
526
511
  transactionId: string;
527
512
  }
528
513
 
514
+
529
515
  export interface QueryLatestTransactionIosArgs {
530
516
  sku: string;
531
517
  }
532
518
 
519
+
533
520
  export interface QuerySubscriptionStatusIosArgs {
534
- skus?: string[] | null;
521
+ skus?: (string[] | null);
535
522
  }
536
523
 
537
524
  export interface ReceiptValidationAndroidOptions {
538
525
  accessToken: string;
539
- isSub?: boolean | null;
526
+ isSub?: (boolean | null);
540
527
  packageName: string;
541
528
  productToken: string;
542
529
  }
543
530
 
544
531
  export interface ReceiptValidationProps {
545
532
  /** Android-specific validation options */
546
- androidOptions?: ReceiptValidationAndroidOptions | null;
533
+ androidOptions?: (ReceiptValidationAndroidOptions | null);
547
534
  /** Product SKU to validate */
548
535
  sku: string;
549
536
  }
550
537
 
551
- export type ReceiptValidationResult =
552
- | ReceiptValidationResultAndroid
553
- | ReceiptValidationResultIOS;
538
+ export type ReceiptValidationResult = ReceiptValidationResultAndroid | ReceiptValidationResultIOS;
554
539
 
555
540
  export interface ReceiptValidationResultAndroid {
556
541
  autoRenewing: boolean;
557
542
  betaProduct: boolean;
558
- cancelDate?: number | null;
559
- cancelReason?: string | null;
560
- deferredDate?: number | null;
561
- deferredSku?: string | null;
543
+ cancelDate?: (number | null);
544
+ cancelReason?: (string | null);
545
+ deferredDate?: (number | null);
546
+ deferredSku?: (string | null);
562
547
  freeTrialEndDate: number;
563
548
  gracePeriodEndDate: number;
564
549
  parentProductId: string;
@@ -579,95 +564,100 @@ export interface ReceiptValidationResultIOS {
579
564
  /** JWS representation */
580
565
  jwsRepresentation: string;
581
566
  /** Latest transaction if available */
582
- latestTransaction?: Purchase | null;
567
+ latestTransaction?: (Purchase | null);
583
568
  /** Receipt data string */
584
569
  receiptData: string;
585
570
  }
586
571
 
587
572
  export interface RefundResultIOS {
588
- message?: string | null;
573
+ message?: (string | null);
589
574
  status: string;
590
575
  }
591
576
 
592
577
  export interface RenewalInfoIOS {
593
- autoRenewPreference?: string | null;
594
- jsonRepresentation?: string | null;
578
+ autoRenewPreference?: (string | null);
579
+ jsonRepresentation?: (string | null);
595
580
  willAutoRenew: boolean;
596
581
  }
597
582
 
598
583
  export interface RequestPurchaseAndroidProps {
599
584
  /** Personalized offer flag */
600
- isOfferPersonalized?: boolean | null;
585
+ isOfferPersonalized?: (boolean | null);
601
586
  /** Obfuscated account ID */
602
- obfuscatedAccountIdAndroid?: string | null;
587
+ obfuscatedAccountIdAndroid?: (string | null);
603
588
  /** Obfuscated profile ID */
604
- obfuscatedProfileIdAndroid?: string | null;
589
+ obfuscatedProfileIdAndroid?: (string | null);
605
590
  /** List of product SKUs */
606
591
  skus: string[];
607
592
  }
608
593
 
609
594
  export interface RequestPurchaseIosProps {
610
595
  /** Auto-finish transaction (dangerous) */
611
- andDangerouslyFinishTransactionAutomatically?: boolean | null;
596
+ andDangerouslyFinishTransactionAutomatically?: (boolean | null);
612
597
  /** App account token for user tracking */
613
- appAccountToken?: string | null;
598
+ appAccountToken?: (string | null);
614
599
  /** Purchase quantity */
615
- quantity?: number | null;
600
+ quantity?: (number | null);
616
601
  /** Product SKU */
617
602
  sku: string;
618
603
  /** Discount offer to apply */
619
- withOffer?: DiscountOfferInputIOS | null;
604
+ withOffer?: (DiscountOfferInputIOS | null);
620
605
  }
621
606
 
622
- export interface RequestPurchaseProps {
623
- /** Android-specific purchase parameters */
624
- android?: RequestPurchaseAndroidProps | null;
625
- /** iOS-specific purchase parameters */
626
- ios?: RequestPurchaseIosProps | null;
627
- }
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
+ };
628
618
 
629
619
  export interface RequestPurchasePropsByPlatforms {
630
620
  /** Android-specific purchase parameters */
631
- android?: RequestPurchaseAndroidProps | null;
621
+ android?: (RequestPurchaseAndroidProps | null);
632
622
  /** iOS-specific purchase parameters */
633
- ios?: RequestPurchaseIosProps | null;
623
+ ios?: (RequestPurchaseIosProps | null);
634
624
  }
635
625
 
636
626
  export interface RequestPurchaseResult {
637
- purchase?: Purchase | null;
638
- purchases?: Purchase[] | null;
627
+ purchase?: (Purchase | null);
628
+ purchases?: (Purchase[] | null);
639
629
  }
640
630
 
641
631
  export interface RequestSubscriptionAndroidProps {
642
632
  /** Personalized offer flag */
643
- isOfferPersonalized?: boolean | null;
633
+ isOfferPersonalized?: (boolean | null);
644
634
  /** Obfuscated account ID */
645
- obfuscatedAccountIdAndroid?: string | null;
635
+ obfuscatedAccountIdAndroid?: (string | null);
646
636
  /** Obfuscated profile ID */
647
- obfuscatedProfileIdAndroid?: string | null;
637
+ obfuscatedProfileIdAndroid?: (string | null);
648
638
  /** Purchase token for upgrades/downgrades */
649
- purchaseTokenAndroid?: string | null;
639
+ purchaseTokenAndroid?: (string | null);
650
640
  /** Replacement mode for subscription changes */
651
- replacementModeAndroid?: number | null;
641
+ replacementModeAndroid?: (number | null);
652
642
  /** List of subscription SKUs */
653
643
  skus: string[];
654
644
  /** Subscription offers */
655
- subscriptionOffers?: AndroidSubscriptionOfferInput[] | null;
645
+ subscriptionOffers?: (AndroidSubscriptionOfferInput[] | null);
656
646
  }
657
647
 
658
648
  export interface RequestSubscriptionIosProps {
659
- andDangerouslyFinishTransactionAutomatically?: boolean | null;
660
- appAccountToken?: string | null;
661
- quantity?: number | null;
649
+ andDangerouslyFinishTransactionAutomatically?: (boolean | null);
650
+ appAccountToken?: (string | null);
651
+ quantity?: (number | null);
662
652
  sku: string;
663
- withOffer?: DiscountOfferInputIOS | null;
653
+ withOffer?: (DiscountOfferInputIOS | null);
664
654
  }
665
655
 
666
656
  export interface RequestSubscriptionPropsByPlatforms {
667
657
  /** Android-specific subscription parameters */
668
- android?: RequestSubscriptionAndroidProps | null;
658
+ android?: (RequestSubscriptionAndroidProps | null);
669
659
  /** iOS-specific subscription parameters */
670
- ios?: RequestSubscriptionIosProps | null;
660
+ ios?: (RequestSubscriptionIosProps | null);
671
661
  }
672
662
 
673
663
  export interface Subscription {
@@ -680,8 +670,8 @@ export interface Subscription {
680
670
  }
681
671
 
682
672
  export interface SubscriptionInfoIOS {
683
- introductoryOffer?: SubscriptionOfferIOS | null;
684
- promotionalOffers?: SubscriptionOfferIOS[] | null;
673
+ introductoryOffer?: (SubscriptionOfferIOS | null);
674
+ promotionalOffers?: (SubscriptionOfferIOS[] | null);
685
675
  subscriptionGroupId: string;
686
676
  subscriptionPeriod: SubscriptionPeriodValueIOS;
687
677
  }
@@ -706,7 +696,7 @@ export interface SubscriptionPeriodValueIOS {
706
696
  }
707
697
 
708
698
  export interface SubscriptionStatusIOS {
709
- renewalInfo?: RenewalInfoIOS | null;
699
+ renewalInfo?: (RenewalInfoIOS | null);
710
700
  state: string;
711
701
  }
712
702