react-native-purchases 4.6.1 → 5.0.0-beta.1
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/README.md +10 -18
- package/RNPurchases.podspec +2 -2
- package/android/build.gradle +2 -2
- package/android/build.gradle.bck +126 -0
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +18 -42
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java.bck +374 -0
- package/dist/{purchaserInfo.d.ts → customerInfo.d.ts} +4 -5
- package/dist/{purchaserInfo.js → customerInfo.js} +0 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/offerings.d.ts +11 -43
- package/dist/offerings.js +4 -0
- package/dist/purchases.d.ts +52 -114
- package/dist/purchases.js +52 -160
- package/ios/RNPurchases.h +2 -2
- package/ios/RNPurchases.m +39 -72
- package/ios/RNPurchases.m.bck +342 -0
- package/package.json +4 -6
- package/scripts/{build.js → build.js.bck} +0 -0
- package/scripts/setupJest.js +5 -9
- package/scripts/download-purchases-common.sh +0 -39
- package/scripts/download-purchases-framework.sh +0 -39
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
package com.revenuecat.purchases.react;
|
|
2
|
+
|
|
3
|
+
import android.util.Log;
|
|
4
|
+
|
|
5
|
+
import androidx.annotation.NonNull;
|
|
6
|
+
import androidx.annotation.Nullable;
|
|
7
|
+
|
|
8
|
+
import com.facebook.react.bridge.Arguments;
|
|
9
|
+
import com.facebook.react.bridge.Promise;
|
|
10
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
12
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
13
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
14
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
15
|
+
import com.facebook.react.bridge.WritableArray;
|
|
16
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
17
|
+
import com.revenuecat.purchases.CustomerInfo;
|
|
18
|
+
import com.revenuecat.purchases.Purchases;
|
|
19
|
+
import com.revenuecat.purchases.common.PlatformInfo;
|
|
20
|
+
import com.revenuecat.purchases.hybridcommon.CommonKt;
|
|
21
|
+
import com.revenuecat.purchases.hybridcommon.ErrorContainer;
|
|
22
|
+
import com.revenuecat.purchases.hybridcommon.OnResult;
|
|
23
|
+
import com.revenuecat.purchases.hybridcommon.OnResultAny;
|
|
24
|
+
import com.revenuecat.purchases.hybridcommon.OnResultList;
|
|
25
|
+
import com.revenuecat.purchases.hybridcommon.SubscriberAttributesKt;
|
|
26
|
+
import com.revenuecat.purchases.hybridcommon.mappers.CustomerInfoMapperKt;
|
|
27
|
+
import com.revenuecat.purchases.interfaces.UpdatedCustomerInfoListener;
|
|
28
|
+
|
|
29
|
+
import org.jetbrains.annotations.NotNull;
|
|
30
|
+
import org.json.JSONException;
|
|
31
|
+
|
|
32
|
+
import java.util.ArrayList;
|
|
33
|
+
import java.util.HashMap;
|
|
34
|
+
import java.util.List;
|
|
35
|
+
import java.util.Map;
|
|
36
|
+
|
|
37
|
+
import kotlin.UninitializedPropertyAccessException;
|
|
38
|
+
|
|
39
|
+
import static com.revenuecat.purchases.react.RNPurchasesConverters.convertMapToWriteableMap;
|
|
40
|
+
|
|
41
|
+
public class RNPurchasesModule extends ReactContextBaseJavaModule implements UpdatedCustomerInfoListener {
|
|
42
|
+
|
|
43
|
+
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
44
|
+
public static final String PLATFORM_NAME = "react-native";
|
|
45
|
+
public static final String PLUGIN_VERSION = "4.6.0";
|
|
46
|
+
|
|
47
|
+
private final ReactApplicationContext reactContext;
|
|
48
|
+
|
|
49
|
+
@SuppressWarnings("WeakerAccess")
|
|
50
|
+
public RNPurchasesModule(ReactApplicationContext reactContext) {
|
|
51
|
+
super(reactContext);
|
|
52
|
+
this.reactContext = reactContext;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@NonNull
|
|
56
|
+
@Override
|
|
57
|
+
public String getName() {
|
|
58
|
+
return "RNPurchases";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public void onCatalystInstanceDestroy() {
|
|
62
|
+
try {
|
|
63
|
+
Purchases.getSharedInstance().close();
|
|
64
|
+
} catch (UninitializedPropertyAccessException e) {
|
|
65
|
+
// there's no instance so all good
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@ReactMethod
|
|
70
|
+
public void addListener(String eventName) {
|
|
71
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@ReactMethod
|
|
75
|
+
public void removeListeners(Integer count) {
|
|
76
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@ReactMethod
|
|
80
|
+
public void setupPurchases(String apiKey, @Nullable String appUserID,
|
|
81
|
+
boolean observerMode, @Nullable String userDefaultsSuiteName,
|
|
82
|
+
@Nullable Boolean usesStoreKit2IfAvailable) {
|
|
83
|
+
PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
|
|
84
|
+
CommonKt.configure(reactContext, apiKey, appUserID, observerMode, platformInfo);
|
|
85
|
+
Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@ReactMethod
|
|
89
|
+
public void setAllowSharingStoreAccount(boolean allowSharingStoreAccount) {
|
|
90
|
+
CommonKt.setAllowSharingAppStoreAccount(allowSharingStoreAccount);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@ReactMethod
|
|
94
|
+
public void getOfferings(final Promise promise) {
|
|
95
|
+
CommonKt.getOfferings(getOnResult(promise));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@ReactMethod
|
|
99
|
+
public void getProductInfo(ReadableArray productIDs, String type, final Promise promise) {
|
|
100
|
+
ArrayList<String> productIDList = new ArrayList<>();
|
|
101
|
+
for (int i = 0; i < productIDs.size(); i++) {
|
|
102
|
+
productIDList.add(productIDs.getString(i));
|
|
103
|
+
}
|
|
104
|
+
CommonKt.getProductInfo(productIDList, type, new OnResultList() {
|
|
105
|
+
@Override
|
|
106
|
+
public void onReceived(List<Map<String, ?>> map) {
|
|
107
|
+
WritableArray writableArray = Arguments.createArray();
|
|
108
|
+
for (Map<String, ?> detail : map) {
|
|
109
|
+
writableArray.pushMap(convertMapToWriteableMap(detail));
|
|
110
|
+
}
|
|
111
|
+
promise.resolve(writableArray);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Override
|
|
115
|
+
public void onError(ErrorContainer errorContainer) {
|
|
116
|
+
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
117
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@ReactMethod
|
|
123
|
+
public void purchaseProduct(final String productIdentifier,
|
|
124
|
+
@Nullable final ReadableMap upgradeInfo,
|
|
125
|
+
final String type,
|
|
126
|
+
@Nullable final String discountTimestamp,
|
|
127
|
+
final Promise promise) {
|
|
128
|
+
CommonKt.purchaseProduct(
|
|
129
|
+
getCurrentActivity(),
|
|
130
|
+
productIdentifier,
|
|
131
|
+
upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null,
|
|
132
|
+
upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null,
|
|
133
|
+
type,
|
|
134
|
+
getOnResult(promise));
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@ReactMethod
|
|
138
|
+
public void purchasePackage(final String packageIdentifier,
|
|
139
|
+
final String offeringIdentifier,
|
|
140
|
+
@Nullable final ReadableMap upgradeInfo,
|
|
141
|
+
@Nullable final String discountTimestamp,
|
|
142
|
+
final Promise promise) {
|
|
143
|
+
CommonKt.purchasePackage(
|
|
144
|
+
getCurrentActivity(),
|
|
145
|
+
packageIdentifier,
|
|
146
|
+
offeringIdentifier,
|
|
147
|
+
upgradeInfo != null && upgradeInfo.hasKey("oldSKU") ? upgradeInfo.getString("oldSKU") : null,
|
|
148
|
+
upgradeInfo != null && upgradeInfo.hasKey("prorationMode") ? upgradeInfo.getInt("prorationMode") : null,
|
|
149
|
+
getOnResult(promise));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@ReactMethod
|
|
153
|
+
public void getAppUserID(final Promise promise) {
|
|
154
|
+
promise.resolve(CommonKt.getAppUserID());
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@ReactMethod
|
|
158
|
+
public void restorePurchases(final Promise promise) {
|
|
159
|
+
CommonKt.restorePurchases(getOnResult(promise));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@ReactMethod
|
|
163
|
+
public void logOut(final Promise promise) {
|
|
164
|
+
CommonKt.logOut(getOnResult(promise));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@ReactMethod
|
|
168
|
+
public void logIn(String appUserID, final Promise promise) {
|
|
169
|
+
CommonKt.logIn(appUserID, getOnResult(promise));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@ReactMethod
|
|
173
|
+
public void setDebugLogsEnabled(boolean enabled) {
|
|
174
|
+
CommonKt.setDebugLogsEnabled(enabled);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@ReactMethod
|
|
178
|
+
public void getCustomerInfo(final Promise promise) {
|
|
179
|
+
CommonKt.getCustomerInfo(getOnResult(promise));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@ReactMethod
|
|
183
|
+
public void setFinishTransactions(boolean enabled) {
|
|
184
|
+
CommonKt.setFinishTransactions(enabled);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@ReactMethod
|
|
188
|
+
public void syncPurchases() {
|
|
189
|
+
CommonKt.syncPurchases();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@ReactMethod
|
|
193
|
+
public void isAnonymous(final Promise promise) {
|
|
194
|
+
promise.resolve(CommonKt.isAnonymous());
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@ReactMethod
|
|
198
|
+
public void checkTrialOrIntroductoryPriceEligibility(ReadableArray productIDs, final Promise promise) {
|
|
199
|
+
ArrayList<String> productIDList = new ArrayList<>();
|
|
200
|
+
for (int i = 0; i < productIDs.size(); i++) {
|
|
201
|
+
productIDList.add(productIDs.getString(i));
|
|
202
|
+
}
|
|
203
|
+
promise.resolve(convertMapToWriteableMap(CommonKt.checkTrialOrIntroductoryPriceEligibility(productIDList)));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@Override
|
|
207
|
+
public void onReceived(@NonNull CustomerInfo customerInfo) {
|
|
208
|
+
reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
209
|
+
.emit(RNPurchasesModule.CUSTOMER_INFO_UPDATED,
|
|
210
|
+
convertMapToWriteableMap(CustomerInfoMapperKt.map(customerInfo)));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@ReactMethod
|
|
214
|
+
public void invalidateCustomerInfoCache() {
|
|
215
|
+
CommonKt.invalidateCustomerInfoCache();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@ReactMethod
|
|
219
|
+
public void setProxyURLString(String proxyURLString) {
|
|
220
|
+
CommonKt.setProxyURLString(proxyURLString);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
@ReactMethod
|
|
224
|
+
public void isConfigured(Promise promise) {
|
|
225
|
+
promise.resolve(Purchases.isConfigured());
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
//================================================================================
|
|
229
|
+
// Subscriber Attributes
|
|
230
|
+
//================================================================================
|
|
231
|
+
|
|
232
|
+
@ReactMethod
|
|
233
|
+
public void setAttributes(ReadableMap attributes) {
|
|
234
|
+
HashMap attributesHashMap = attributes.toHashMap();
|
|
235
|
+
SubscriberAttributesKt.setAttributes(attributesHashMap);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@ReactMethod
|
|
239
|
+
public void setEmail(String email) {
|
|
240
|
+
SubscriberAttributesKt.setEmail(email);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@ReactMethod
|
|
244
|
+
public void setPhoneNumber(String phoneNumber) {
|
|
245
|
+
SubscriberAttributesKt.setPhoneNumber(phoneNumber);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@ReactMethod
|
|
249
|
+
public void setDisplayName(String displayName) {
|
|
250
|
+
SubscriberAttributesKt.setDisplayName(displayName);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
@ReactMethod
|
|
254
|
+
public void setPushToken(String pushToken) {
|
|
255
|
+
SubscriberAttributesKt.setPushToken(pushToken);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// region Attribution IDs
|
|
259
|
+
|
|
260
|
+
@ReactMethod
|
|
261
|
+
public void collectDeviceIdentifiers() {
|
|
262
|
+
SubscriberAttributesKt.collectDeviceIdentifiers();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@ReactMethod
|
|
266
|
+
public void setAdjustID(String adjustID) {
|
|
267
|
+
SubscriberAttributesKt.setAdjustID(adjustID);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@ReactMethod
|
|
271
|
+
public void setAppsflyerID(String appsflyerID) {
|
|
272
|
+
SubscriberAttributesKt.setAppsflyerID(appsflyerID);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
@ReactMethod
|
|
276
|
+
public void setFBAnonymousID(String fbAnonymousID) {
|
|
277
|
+
SubscriberAttributesKt.setFBAnonymousID(fbAnonymousID);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@ReactMethod
|
|
281
|
+
public void setMparticleID(String mparticleID) {
|
|
282
|
+
SubscriberAttributesKt.setMparticleID(mparticleID);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
@ReactMethod
|
|
286
|
+
public void setOnesignalID(String onesignalID) {
|
|
287
|
+
SubscriberAttributesKt.setOnesignalID(onesignalID);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@ReactMethod
|
|
291
|
+
public void setAirshipChannelID(String airshipChannelID) {
|
|
292
|
+
SubscriberAttributesKt.setAirshipChannelID(airshipChannelID);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// endregion
|
|
296
|
+
|
|
297
|
+
// region Campaign parameters
|
|
298
|
+
|
|
299
|
+
@ReactMethod
|
|
300
|
+
public void setMediaSource(String mediaSource) {
|
|
301
|
+
SubscriberAttributesKt.setMediaSource(mediaSource);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
@ReactMethod
|
|
305
|
+
public void setCampaign(String campaign) {
|
|
306
|
+
SubscriberAttributesKt.setCampaign(campaign);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@ReactMethod
|
|
310
|
+
public void setAdGroup(String adGroup) {
|
|
311
|
+
SubscriberAttributesKt.setAdGroup(adGroup);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
@ReactMethod
|
|
315
|
+
public void setAd(String ad) {
|
|
316
|
+
SubscriberAttributesKt.setAd(ad);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@ReactMethod
|
|
320
|
+
public void setKeyword(String keyword) {
|
|
321
|
+
SubscriberAttributesKt.setKeyword(keyword);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
@ReactMethod
|
|
325
|
+
public void setCreative(String creative) {
|
|
326
|
+
SubscriberAttributesKt.setCreative(creative);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@ReactMethod
|
|
330
|
+
public void canMakePayments(ReadableArray features, final Promise promise) {
|
|
331
|
+
ArrayList<Integer> featureList = new ArrayList<>();
|
|
332
|
+
|
|
333
|
+
if (features != null) {
|
|
334
|
+
for (int i = 0; i < features.size(); i++) {
|
|
335
|
+
featureList.add(features.getInt(i));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
CommonKt.canMakePayments(reactContext, featureList, new OnResultAny<Boolean>() {
|
|
339
|
+
@Override
|
|
340
|
+
public void onError(@Nullable ErrorContainer errorContainer) {
|
|
341
|
+
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
342
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
@Override
|
|
346
|
+
public void onReceived(Boolean result) {
|
|
347
|
+
promise.resolve(result);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// endregion
|
|
353
|
+
|
|
354
|
+
//================================================================================
|
|
355
|
+
// Private methods
|
|
356
|
+
//================================================================================
|
|
357
|
+
|
|
358
|
+
@NotNull
|
|
359
|
+
private OnResult getOnResult(final Promise promise) {
|
|
360
|
+
return new OnResult() {
|
|
361
|
+
@Override
|
|
362
|
+
public void onReceived(Map<String, ?> map) {
|
|
363
|
+
promise.resolve(convertMapToWriteableMap(map));
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
@Override
|
|
367
|
+
public void onError(ErrorContainer errorContainer) {
|
|
368
|
+
promise.reject(errorContainer.getCode() + "", errorContainer.getMessage(),
|
|
369
|
+
convertMapToWriteableMap(errorContainer.getInfo()));
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
}
|
|
@@ -12,7 +12,6 @@ export interface PurchasesEntitlementInfo {
|
|
|
12
12
|
readonly isActive: boolean;
|
|
13
13
|
/**
|
|
14
14
|
* True if the underlying subscription is set to renew at the end of the billing period (expirationDate).
|
|
15
|
-
* Will always be True if entitlement is for lifetime access.
|
|
16
15
|
*/
|
|
17
16
|
readonly willRenew: boolean;
|
|
18
17
|
/**
|
|
@@ -74,9 +73,9 @@ export interface PurchasesEntitlementInfos {
|
|
|
74
73
|
[key: string]: PurchasesEntitlementInfo;
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
|
-
export interface
|
|
76
|
+
export interface CustomerInfo {
|
|
78
77
|
/**
|
|
79
|
-
* Entitlements attached to this
|
|
78
|
+
* Entitlements attached to this customer info
|
|
80
79
|
*/
|
|
81
80
|
readonly entitlements: PurchasesEntitlementInfos;
|
|
82
81
|
/**
|
|
@@ -137,13 +136,13 @@ export interface PurchaserInfo {
|
|
|
137
136
|
* If there are multiple for different platforms, it will point to the device store.
|
|
138
137
|
*/
|
|
139
138
|
readonly managementURL: string | null;
|
|
140
|
-
readonly nonSubscriptionTransactions:
|
|
139
|
+
readonly nonSubscriptionTransactions: PurchasesStoreTransaction[];
|
|
141
140
|
}
|
|
142
141
|
/**
|
|
143
142
|
* List of all non subscription transactions. Use this to fetch the history of
|
|
144
143
|
* non-subscription purchases
|
|
145
144
|
*/
|
|
146
|
-
export interface
|
|
145
|
+
export interface PurchasesStoreTransaction {
|
|
147
146
|
/**
|
|
148
147
|
* RevenueCat Id associated to the transaction.
|
|
149
148
|
*/
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
var purchases_1 = __importDefault(require("./purchases"));
|
|
17
17
|
exports.default = purchases_1.default;
|
|
18
18
|
__exportStar(require("./errors"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./customerInfo"), exports);
|
|
20
20
|
__exportStar(require("./purchases"), exports);
|
|
21
21
|
__exportStar(require("./offerings"), exports);
|
package/dist/offerings.d.ts
CHANGED
|
@@ -48,9 +48,13 @@ export declare enum INTRO_ELIGIBILITY_STATUS {
|
|
|
48
48
|
/**
|
|
49
49
|
* The user is eligible for a free trial or intro pricing for this product.
|
|
50
50
|
*/
|
|
51
|
-
INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2
|
|
51
|
+
INTRO_ELIGIBILITY_STATUS_ELIGIBLE = 2,
|
|
52
|
+
/**
|
|
53
|
+
* There is no free trial or intro pricing for this product.
|
|
54
|
+
*/
|
|
55
|
+
INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS = 3
|
|
52
56
|
}
|
|
53
|
-
export interface
|
|
57
|
+
export interface PurchasesStoreProduct {
|
|
54
58
|
/**
|
|
55
59
|
* Product Id.
|
|
56
60
|
*/
|
|
@@ -75,52 +79,16 @@ export interface PurchasesProduct {
|
|
|
75
79
|
* Currency code for price and original price.
|
|
76
80
|
*/
|
|
77
81
|
readonly currency_code: string;
|
|
78
|
-
/**
|
|
79
|
-
* @deprecated, use introPrice instead.
|
|
80
|
-
*
|
|
81
|
-
* Introductory price of a subscription in the local currency.
|
|
82
|
-
*/
|
|
83
|
-
readonly intro_price: number | null;
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated, use introPrice instead.
|
|
86
|
-
*
|
|
87
|
-
* Formatted introductory price of a subscription, including its currency sign, such as €3.99.
|
|
88
|
-
*/
|
|
89
|
-
readonly intro_price_string: string | null;
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated, use introPrice instead.
|
|
92
|
-
*
|
|
93
|
-
* Billing period of the introductory price, specified in ISO 8601 format.
|
|
94
|
-
*/
|
|
95
|
-
readonly intro_price_period: string | null;
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated, use introPrice instead.
|
|
98
|
-
*
|
|
99
|
-
* Number of subscription billing periods for which the user will be given the introductory price, such as 3.
|
|
100
|
-
*/
|
|
101
|
-
readonly intro_price_cycles: number | null;
|
|
102
|
-
/**
|
|
103
|
-
* @deprecated, use introPrice instead.
|
|
104
|
-
*
|
|
105
|
-
* Unit for the billing period of the introductory price, can be DAY, WEEK, MONTH or YEAR.
|
|
106
|
-
*/
|
|
107
|
-
readonly intro_price_period_unit: string | null;
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated, use introPrice instead.
|
|
110
|
-
*
|
|
111
|
-
* Number of units for the billing period of the introductory price.
|
|
112
|
-
*/
|
|
113
|
-
readonly intro_price_period_number_of_units: number | null;
|
|
114
82
|
/**
|
|
115
83
|
* Introductory price.
|
|
116
84
|
*/
|
|
117
|
-
readonly
|
|
85
|
+
readonly intro_price: PurchasesIntroPrice | null;
|
|
118
86
|
/**
|
|
119
87
|
* Collection of discount offers for a product. Null for Android.
|
|
120
88
|
*/
|
|
121
|
-
readonly discounts:
|
|
89
|
+
readonly discounts: PurchasesStoreProductDiscount[] | null;
|
|
122
90
|
}
|
|
123
|
-
export interface
|
|
91
|
+
export interface PurchasesStoreProductDiscount {
|
|
124
92
|
/**
|
|
125
93
|
* Identifier of the discount.
|
|
126
94
|
*/
|
|
@@ -192,7 +160,7 @@ export interface PurchasesPackage {
|
|
|
192
160
|
/**
|
|
193
161
|
* Product assigned to this package.
|
|
194
162
|
*/
|
|
195
|
-
readonly product:
|
|
163
|
+
readonly product: PurchasesStoreProduct;
|
|
196
164
|
/**
|
|
197
165
|
* Offering this package belongs to.
|
|
198
166
|
*/
|
|
@@ -286,7 +254,7 @@ export interface IntroEligibility {
|
|
|
286
254
|
*/
|
|
287
255
|
readonly description: string;
|
|
288
256
|
}
|
|
289
|
-
export interface
|
|
257
|
+
export interface PurchasesPromotionalOffer {
|
|
290
258
|
readonly identifier: string;
|
|
291
259
|
readonly keyIdentifier: string;
|
|
292
260
|
readonly nonce: string;
|
package/dist/offerings.js
CHANGED
|
@@ -54,6 +54,10 @@ var INTRO_ELIGIBILITY_STATUS;
|
|
|
54
54
|
* The user is eligible for a free trial or intro pricing for this product.
|
|
55
55
|
*/
|
|
56
56
|
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_ELIGIBLE"] = 2] = "INTRO_ELIGIBILITY_STATUS_ELIGIBLE";
|
|
57
|
+
/**
|
|
58
|
+
* There is no free trial or intro pricing for this product.
|
|
59
|
+
*/
|
|
60
|
+
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS"] = 3] = "INTRO_ELIGIBILITY_STATUS_NO_INTRO_OFFER_EXISTS";
|
|
57
61
|
})(INTRO_ELIGIBILITY_STATUS = exports.INTRO_ELIGIBILITY_STATUS || (exports.INTRO_ELIGIBILITY_STATUS = {}));
|
|
58
62
|
var PRORATION_MODE;
|
|
59
63
|
(function (PRORATION_MODE) {
|