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