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