expo-iap 3.0.3 → 3.0.4
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/CHANGELOG.md +7 -0
- package/CLAUDE.md +2 -0
- package/build/helpers/subscription.d.ts +1 -12
- package/build/helpers/subscription.d.ts.map +1 -1
- package/build/helpers/subscription.js +12 -7
- package/build/helpers/subscription.js.map +1 -1
- package/build/index.d.ts +8 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/modules/android.d.ts +7 -6
- package/build/modules/android.d.ts.map +1 -1
- package/build/modules/android.js +19 -4
- package/build/modules/android.js.map +1 -1
- package/build/modules/ios.d.ts +7 -10
- package/build/modules/ios.d.ts.map +1 -1
- package/build/modules/ios.js +3 -1
- package/build/modules/ios.js.map +1 -1
- package/build/purchase-error.d.ts +69 -0
- package/build/purchase-error.d.ts.map +1 -0
- package/build/purchase-error.js +164 -0
- package/build/purchase-error.js.map +1 -0
- package/build/types.d.ts +649 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +100 -0
- package/build/types.js.map +1 -0
- package/build/useIAP.d.ts +5 -4
- package/build/useIAP.d.ts.map +1 -1
- package/build/useIAP.js +1 -1
- package/build/useIAP.js.map +1 -1
- package/build/utils/errorMapping.d.ts +1 -1
- package/build/utils/errorMapping.d.ts.map +1 -1
- package/build/utils/errorMapping.js +19 -3
- package/build/utils/errorMapping.js.map +1 -1
- package/jest.config.js +1 -1
- package/package.json +1 -1
- package/src/helpers/subscription.ts +12 -20
- package/src/index.ts +14 -14
- package/src/modules/android.ts +28 -10
- package/src/modules/ios.ts +11 -13
- package/src/purchase-error.ts +268 -0
- package/src/types.ts +738 -0
- package/src/useIAP.ts +8 -8
- package/src/utils/errorMapping.ts +24 -3
- package/build/ExpoIap.types.d.ts +0 -307
- package/build/ExpoIap.types.d.ts.map +0 -1
- package/build/ExpoIap.types.js +0 -235
- package/build/ExpoIap.types.js.map +0 -1
- package/build/types/ExpoIapAndroid.types.d.ts +0 -114
- package/build/types/ExpoIapAndroid.types.d.ts.map +0 -1
- package/build/types/ExpoIapAndroid.types.js +0 -29
- package/build/types/ExpoIapAndroid.types.js.map +0 -1
- package/build/types/ExpoIapIOS.types.d.ts +0 -149
- package/build/types/ExpoIapIOS.types.d.ts.map +0 -1
- package/build/types/ExpoIapIOS.types.js +0 -8
- package/build/types/ExpoIapIOS.types.js.map +0 -1
- package/src/ExpoIap.types.ts +0 -444
- package/src/types/ExpoIapAndroid.types.ts +0 -133
- package/src/types/ExpoIapIOS.types.ts +0 -172
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import {PurchaseCommon, ProductCommon} from '../ExpoIap.types';
|
|
2
|
-
|
|
3
|
-
export enum ProductTypeIOS {
|
|
4
|
-
Consumable = 'consumable',
|
|
5
|
-
NonConsumable = 'nonConsumable',
|
|
6
|
-
AutoRenewableSubscription = 'autoRenewableSubscription',
|
|
7
|
-
NonRenewingSubscription = 'nonRenewingSubscription',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type SubscriptionIosPeriod = 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | '';
|
|
11
|
-
type PaymentMode = '' | 'FREETRIAL' | 'PAYASYOUGO' | 'PAYUPFRONT';
|
|
12
|
-
|
|
13
|
-
type SubscriptionOffer = {
|
|
14
|
-
displayPrice: string;
|
|
15
|
-
id: string;
|
|
16
|
-
paymentMode: PaymentMode;
|
|
17
|
-
period: {
|
|
18
|
-
unit: SubscriptionIosPeriod;
|
|
19
|
-
value: number;
|
|
20
|
-
};
|
|
21
|
-
periodCount: number;
|
|
22
|
-
price: number;
|
|
23
|
-
type: 'introductory' | 'promotional';
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
type SubscriptionInfo = {
|
|
27
|
-
introductoryOffer?: SubscriptionOffer;
|
|
28
|
-
promotionalOffers?: SubscriptionOffer[];
|
|
29
|
-
subscriptionGroupId: string;
|
|
30
|
-
subscriptionPeriod: {
|
|
31
|
-
unit: SubscriptionIosPeriod;
|
|
32
|
-
value: number;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type ProductIOS = ProductCommon & {
|
|
37
|
-
displayNameIOS: string;
|
|
38
|
-
isFamilyShareableIOS: boolean;
|
|
39
|
-
jsonRepresentationIOS: string;
|
|
40
|
-
platform: 'ios';
|
|
41
|
-
typeIOS: ProductTypeIOS;
|
|
42
|
-
subscriptionInfoIOS?: SubscriptionInfo;
|
|
43
|
-
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
44
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type Discount = {
|
|
48
|
-
identifier: string;
|
|
49
|
-
type: string;
|
|
50
|
-
numberOfPeriods: string;
|
|
51
|
-
price: string;
|
|
52
|
-
localizedPrice: string;
|
|
53
|
-
paymentMode: PaymentMode;
|
|
54
|
-
subscriptionPeriod: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type ProductSubscriptionIOS = ProductIOS & {
|
|
58
|
-
discountsIOS?: Discount[];
|
|
59
|
-
introductoryPriceIOS?: string;
|
|
60
|
-
introductoryPriceAsAmountIOS?: string;
|
|
61
|
-
introductoryPricePaymentModeIOS?: PaymentMode;
|
|
62
|
-
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
63
|
-
introductoryPriceSubscriptionPeriodIOS?: SubscriptionIosPeriod;
|
|
64
|
-
platform: 'ios';
|
|
65
|
-
subscriptionPeriodNumberIOS?: string;
|
|
66
|
-
subscriptionPeriodUnitIOS?: SubscriptionIosPeriod;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type PaymentDiscount = {
|
|
70
|
-
/**
|
|
71
|
-
* A string used to uniquely identify a discount offer for a product.
|
|
72
|
-
*/
|
|
73
|
-
identifier: string;
|
|
74
|
-
/**
|
|
75
|
-
* A string that identifies the key used to generate the signature.
|
|
76
|
-
*/
|
|
77
|
-
keyIdentifier: string;
|
|
78
|
-
/**
|
|
79
|
-
* A universally unique ID (UUID) value that you define.
|
|
80
|
-
*/
|
|
81
|
-
nonce: string;
|
|
82
|
-
/**
|
|
83
|
-
* A UTF-8 string representing the properties of a specific discount offer, cryptographically signed.
|
|
84
|
-
*/
|
|
85
|
-
signature: string;
|
|
86
|
-
/**
|
|
87
|
-
* The date and time of the signature's creation in milliseconds, formatted in Unix epoch time.
|
|
88
|
-
*/
|
|
89
|
-
timestamp: number;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export type RequestPurchaseIosProps = {
|
|
93
|
-
sku: string;
|
|
94
|
-
andDangerouslyFinishTransactionAutomatically?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* UUID representing user account
|
|
97
|
-
*/
|
|
98
|
-
appAccountToken?: string;
|
|
99
|
-
quantity?: number;
|
|
100
|
-
withOffer?: PaymentDiscount;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
type SubscriptionState =
|
|
104
|
-
| 'expired'
|
|
105
|
-
| 'inBillingRetryPeriod'
|
|
106
|
-
| 'inGracePeriod'
|
|
107
|
-
| 'revoked'
|
|
108
|
-
| 'subscribed';
|
|
109
|
-
|
|
110
|
-
type RenewalInfo = {
|
|
111
|
-
jsonRepresentation?: string;
|
|
112
|
-
willAutoRenew: boolean;
|
|
113
|
-
autoRenewPreference?: string;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export type SubscriptionStatusIOS = {
|
|
117
|
-
state: SubscriptionState;
|
|
118
|
-
renewalInfo?: RenewalInfo;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// Legacy naming for backward compatibility
|
|
122
|
-
export type ProductPurchaseIOS = PurchaseCommon & {
|
|
123
|
-
// iOS basic fields
|
|
124
|
-
platform: 'ios';
|
|
125
|
-
quantityIOS?: number;
|
|
126
|
-
originalTransactionDateIOS?: number;
|
|
127
|
-
originalTransactionIdentifierIOS?: string;
|
|
128
|
-
appAccountToken?: string;
|
|
129
|
-
// iOS additional fields from StoreKit 2
|
|
130
|
-
expirationDateIOS?: number;
|
|
131
|
-
webOrderLineItemIdIOS?: number;
|
|
132
|
-
environmentIOS?: string;
|
|
133
|
-
storefrontCountryCodeIOS?: string;
|
|
134
|
-
appBundleIdIOS?: string;
|
|
135
|
-
productTypeIOS?: string;
|
|
136
|
-
subscriptionGroupIdIOS?: string;
|
|
137
|
-
isUpgradedIOS?: boolean;
|
|
138
|
-
ownershipTypeIOS?: string;
|
|
139
|
-
reasonIOS?: string;
|
|
140
|
-
reasonStringRepresentationIOS?: string;
|
|
141
|
-
transactionReasonIOS?: 'PURCHASE' | 'RENEWAL' | string;
|
|
142
|
-
revocationDateIOS?: number;
|
|
143
|
-
revocationReasonIOS?: string;
|
|
144
|
-
offerIOS?: {
|
|
145
|
-
id: string;
|
|
146
|
-
type: string;
|
|
147
|
-
paymentMode: string;
|
|
148
|
-
};
|
|
149
|
-
// Price locale fields
|
|
150
|
-
currencyCodeIOS?: string;
|
|
151
|
-
currencySymbolIOS?: string;
|
|
152
|
-
countryCodeIOS?: string;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// Preferred naming
|
|
156
|
-
export type PurchaseIOS = ProductPurchaseIOS;
|
|
157
|
-
|
|
158
|
-
export type AppTransactionIOS = {
|
|
159
|
-
appTransactionId?: string; // Only available in iOS 18.4+
|
|
160
|
-
originalPlatform?: string; // Only available in iOS 18.4+
|
|
161
|
-
bundleId: string;
|
|
162
|
-
appVersion: string;
|
|
163
|
-
originalAppVersion: string;
|
|
164
|
-
originalPurchaseDate: number;
|
|
165
|
-
deviceVerification: string;
|
|
166
|
-
deviceVerificationNonce: string;
|
|
167
|
-
environment: string;
|
|
168
|
-
signedDate: number;
|
|
169
|
-
appId?: number;
|
|
170
|
-
appVersionId?: number;
|
|
171
|
-
preorderDate?: number;
|
|
172
|
-
};
|