@capgo/native-purchases 0.0.8 → 0.0.10
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 +8 -0
- package/android/src/main/java/ee/forgr/nativepurchases/NativePurchasesPlugin.java +236 -203
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +2 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/NativePurchasesPlugin.swift +19 -21
- package/ios/Plugin/Product+CapacitorPurchasesPlugin.swift +30 -30
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,260 +1,293 @@
|
|
|
1
1
|
package ee.forgr.nativepurchases;
|
|
2
2
|
|
|
3
3
|
import android.util.Log;
|
|
4
|
-
import androidx.annotation.NonNull;
|
|
5
|
-
|
|
6
4
|
import com.android.billingclient.api.AcknowledgePurchaseParams;
|
|
7
5
|
import com.android.billingclient.api.AcknowledgePurchaseResponseListener;
|
|
8
6
|
import com.android.billingclient.api.BillingClient;
|
|
7
|
+
import com.android.billingclient.api.BillingClientStateListener;
|
|
9
8
|
import com.android.billingclient.api.BillingFlowParams;
|
|
10
9
|
import com.android.billingclient.api.BillingResult;
|
|
10
|
+
import com.android.billingclient.api.ProductDetails;
|
|
11
|
+
import com.android.billingclient.api.ProductDetailsResponseListener;
|
|
11
12
|
import com.android.billingclient.api.Purchase;
|
|
12
13
|
import com.android.billingclient.api.PurchasesUpdatedListener;
|
|
13
|
-
import com.android.billingclient.api.
|
|
14
|
-
import com.android.billingclient.api.SkuDetailsParams;
|
|
15
|
-
import com.android.billingclient.api.SkuDetailsResponseListener;
|
|
14
|
+
import com.android.billingclient.api.QueryProductDetailsParams;
|
|
16
15
|
import com.getcapacitor.JSObject;
|
|
17
16
|
import com.getcapacitor.Plugin;
|
|
18
17
|
import com.getcapacitor.PluginCall;
|
|
19
18
|
import com.getcapacitor.PluginMethod;
|
|
20
19
|
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
21
|
-
import com.google.common.
|
|
20
|
+
import com.google.common.collect.ImmutableList;
|
|
22
21
|
import java.util.ArrayList;
|
|
23
|
-
import java.util.HashMap;
|
|
24
|
-
import java.util.Iterator;
|
|
25
22
|
import java.util.List;
|
|
26
|
-
import java.util.
|
|
23
|
+
import java.util.concurrent.CountDownLatch;
|
|
27
24
|
import org.json.JSONArray;
|
|
28
25
|
import org.json.JSONException;
|
|
29
|
-
import org.json.JSONObject;
|
|
30
26
|
|
|
31
27
|
@CapacitorPlugin(name = "NativePurchases")
|
|
32
28
|
public class NativePurchasesPlugin extends Plugin {
|
|
33
29
|
|
|
34
30
|
public final String PLUGIN_VERSION = "2.0.13";
|
|
35
|
-
|
|
36
31
|
private BillingClient billingClient;
|
|
37
|
-
private PluginCall purchaseCall;
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
.setListener(new PurchasesUpdatedListener() {
|
|
44
|
-
@Override
|
|
45
|
-
public void onPurchasesUpdated(BillingResult billingResult, List<Purchase> purchases) {
|
|
46
|
-
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK && purchases != null) {
|
|
47
|
-
for (Purchase purchase : purchases) {
|
|
48
|
-
handlePurchase(purchase);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
// Handle any other error codes.
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
.enablePendingPurchases()
|
|
56
|
-
.build();
|
|
57
|
-
}
|
|
33
|
+
private void handlePurchase(Purchase purchase, PluginCall purchaseCall) {
|
|
34
|
+
if (purchase.getPurchaseState() == Purchase.PurchaseState.PURCHASED) {
|
|
35
|
+
// Grant entitlement to the user, then acknowledge the purchase
|
|
36
|
+
acknowledgePurchase(purchase.getPurchaseToken());
|
|
58
37
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// purchase if you detect that it is still pending.
|
|
38
|
+
JSObject ret = new JSObject();
|
|
39
|
+
ret.put("transactionId", purchase.getPurchaseToken());
|
|
40
|
+
if (purchaseCall != null) {
|
|
41
|
+
purchaseCall.resolve(ret);
|
|
42
|
+
}
|
|
43
|
+
} else if (purchase.getPurchaseState() == Purchase.PurchaseState.PENDING) {
|
|
44
|
+
// Here you can confirm to the user that they've started the pending
|
|
45
|
+
// purchase, and to complete it, they should follow instructions that are
|
|
46
|
+
// given to them. You can also choose to remind the user to complete the
|
|
47
|
+
// purchase if you detect that it is still pending.
|
|
48
|
+
if (purchaseCall != null) {
|
|
49
|
+
purchaseCall.reject("Purchase is pending");
|
|
72
50
|
}
|
|
51
|
+
} else {
|
|
52
|
+
// Handle any other error codes.
|
|
53
|
+
if (purchaseCall != null) {
|
|
54
|
+
purchaseCall.reject("Purchase is not purchased");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
73
57
|
}
|
|
74
58
|
|
|
75
59
|
private void acknowledgePurchase(String purchaseToken) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams
|
|
61
|
+
.newBuilder()
|
|
62
|
+
.setPurchaseToken(purchaseToken)
|
|
63
|
+
.build();
|
|
64
|
+
billingClient.acknowledgePurchase(
|
|
65
|
+
acknowledgePurchaseParams,
|
|
66
|
+
new AcknowledgePurchaseResponseListener() {
|
|
67
|
+
@Override
|
|
68
|
+
public void onAcknowledgePurchaseResponse(BillingResult billingResult) {
|
|
69
|
+
// Handle the result of the acknowledge purchase
|
|
70
|
+
Log.i(
|
|
71
|
+
"NativePurchases",
|
|
72
|
+
"onAcknowledgePurchaseResponse" + billingResult
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private void initBillingClient(PluginCall purchaseCall) {
|
|
80
|
+
if (billingClient != null) {
|
|
81
|
+
billingClient.endConnection();
|
|
82
|
+
billingClient = null;
|
|
83
|
+
}
|
|
84
|
+
CountDownLatch semaphoreReady = new CountDownLatch(1);
|
|
85
|
+
billingClient =
|
|
86
|
+
BillingClient
|
|
87
|
+
.newBuilder(getContext())
|
|
88
|
+
.setListener(
|
|
89
|
+
new PurchasesUpdatedListener() {
|
|
90
|
+
@Override
|
|
91
|
+
public void onPurchasesUpdated(
|
|
92
|
+
BillingResult billingResult,
|
|
93
|
+
List<Purchase> purchases
|
|
94
|
+
) {
|
|
95
|
+
Log.i("NativePurchases", "onPurchasesUpdated" + billingResult);
|
|
96
|
+
if (
|
|
97
|
+
billingResult.getResponseCode() ==
|
|
98
|
+
BillingClient.BillingResponseCode.OK &&
|
|
99
|
+
purchases != null
|
|
100
|
+
) {
|
|
101
|
+
// for (Purchase purchase : purchases) {
|
|
102
|
+
// handlePurchase(purchase, purchaseCall);
|
|
103
|
+
// }
|
|
104
|
+
handlePurchase(purchases.get(0), purchaseCall);
|
|
105
|
+
} else {
|
|
106
|
+
// Handle any other error codes.
|
|
107
|
+
Log.i("NativePurchases", "onPurchasesUpdated" + billingResult);
|
|
108
|
+
if (purchaseCall != null) {
|
|
109
|
+
purchaseCall.reject("Purchase is not purchased");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
billingClient.endConnection();
|
|
113
|
+
billingClient = null;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
84
116
|
}
|
|
85
|
-
|
|
117
|
+
)
|
|
118
|
+
.enablePendingPurchases()
|
|
119
|
+
.build();
|
|
120
|
+
billingClient.startConnection(
|
|
121
|
+
new BillingClientStateListener() {
|
|
122
|
+
@Override
|
|
123
|
+
public void onBillingSetupFinished(BillingResult billingResult) {
|
|
124
|
+
if (
|
|
125
|
+
billingResult.getResponseCode() ==
|
|
126
|
+
BillingClient.BillingResponseCode.OK
|
|
127
|
+
) {
|
|
128
|
+
// The BillingClient is ready. You can query purchases here.
|
|
129
|
+
semaphoreReady.countDown();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@Override
|
|
134
|
+
public void onBillingServiceDisconnected() {
|
|
135
|
+
// Try to restart the connection on the next request to
|
|
136
|
+
// Google Play by calling the startConnection() method.
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
try {
|
|
141
|
+
semaphoreReady.await();
|
|
142
|
+
} catch (InterruptedException e) {
|
|
143
|
+
e.printStackTrace();
|
|
144
|
+
}
|
|
86
145
|
}
|
|
87
146
|
|
|
88
147
|
@PluginMethod
|
|
89
148
|
public void purchaseProduct(PluginCall call) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
149
|
+
String productIdentifier = call.getString("productIdentifier");
|
|
150
|
+
// cannot use quantity, because it's done in native modal
|
|
151
|
+
Log.d("CapacitorPurchases", "purchaseProduct: " + productIdentifier);
|
|
152
|
+
if (productIdentifier.isEmpty()) {
|
|
153
|
+
// Handle error: productIdentifier is empty
|
|
154
|
+
call.reject("productIdentifier is empty");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
ImmutableList<QueryProductDetailsParams.Product> productList = ImmutableList.of(
|
|
158
|
+
QueryProductDetailsParams.Product
|
|
159
|
+
.newBuilder()
|
|
160
|
+
.setProductId(productIdentifier)
|
|
161
|
+
.setProductType(BillingClient.ProductType.INAPP)
|
|
162
|
+
.build()
|
|
163
|
+
);
|
|
164
|
+
QueryProductDetailsParams params = QueryProductDetailsParams
|
|
165
|
+
.newBuilder()
|
|
166
|
+
.setProductList(productList)
|
|
167
|
+
.build();
|
|
168
|
+
this.initBillingClient(call);
|
|
169
|
+
billingClient.queryProductDetailsAsync(
|
|
170
|
+
params,
|
|
171
|
+
new ProductDetailsResponseListener() {
|
|
172
|
+
public void onProductDetailsResponse(
|
|
173
|
+
BillingResult billingResult,
|
|
174
|
+
List<ProductDetails> productDetailsList
|
|
175
|
+
) {
|
|
176
|
+
Log.i(
|
|
177
|
+
"NativePurchases",
|
|
178
|
+
"onProductDetailsResponse" + billingResult + productDetailsList
|
|
179
|
+
);
|
|
180
|
+
// Process the result
|
|
181
|
+
ProductDetails productDetails = productDetailsList.get(0);
|
|
182
|
+
ImmutableList<BillingFlowParams.ProductDetailsParams> productDetailsParamsList = ImmutableList.of(
|
|
183
|
+
BillingFlowParams.ProductDetailsParams
|
|
184
|
+
.newBuilder()
|
|
185
|
+
.setProductDetails(productDetails)
|
|
186
|
+
.build()
|
|
187
|
+
);
|
|
93
188
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP);
|
|
189
|
+
BillingFlowParams billingFlowParams = BillingFlowParams
|
|
190
|
+
.newBuilder()
|
|
191
|
+
.setProductDetailsParamsList(productDetailsParamsList)
|
|
192
|
+
.build();
|
|
99
193
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
194
|
+
// Launch the billing flow
|
|
195
|
+
BillingResult billingResult2 = billingClient.launchBillingFlow(
|
|
196
|
+
getActivity(),
|
|
197
|
+
billingFlowParams
|
|
198
|
+
);
|
|
199
|
+
Log.i(
|
|
200
|
+
"NativePurchases",
|
|
201
|
+
"onProductDetailsResponse2" + billingResult2
|
|
202
|
+
);
|
|
203
|
+
}
|
|
113
204
|
}
|
|
205
|
+
);
|
|
114
206
|
}
|
|
115
207
|
|
|
116
208
|
@PluginMethod
|
|
117
209
|
public void restorePurchases(PluginCall call) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
// Purchase.PurchasesResult purchasesResult = billingClient.queryPurchases(BillingClient.SkuType.INAPP);
|
|
122
|
-
|
|
123
|
-
// if (purchasesResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
|
|
124
|
-
// List<Purchase> purchasesList = purchasesResult.getPurchasesList();
|
|
125
|
-
|
|
126
|
-
// JSObject ret = new JSObject();
|
|
127
|
-
// JSONArray purchases = new JSONArray();
|
|
128
|
-
|
|
129
|
-
// for (Purchase purchase : purchasesList) {
|
|
130
|
-
// JSObject purchaseObject = new JSObject();
|
|
131
|
-
// purchaseObject.put("productId", purchase.getSku());
|
|
132
|
-
// purchaseObject.put("transactionId", purchase.getPurchaseToken());
|
|
133
|
-
// purchaseObject.put("purchaseTime", purchase.getPurchaseTime());
|
|
134
|
-
// purchases.put(purchaseObject);
|
|
135
|
-
// }
|
|
136
|
-
|
|
137
|
-
// ret.put("purchases", purchases);
|
|
138
|
-
// call.resolve(ret);
|
|
139
|
-
// } else {
|
|
140
|
-
// // Handle any other error codes.
|
|
141
|
-
// call.reject("Unknown error");
|
|
142
|
-
// }
|
|
143
|
-
// }
|
|
210
|
+
Log.d("NativePurchases", "restorePurchases");
|
|
211
|
+
this.initBillingClient(null);
|
|
212
|
+
call.resolve();
|
|
144
213
|
}
|
|
145
214
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
public void getProducts(PluginCall call) {
|
|
215
|
+
@PluginMethod
|
|
216
|
+
public void getProducts(PluginCall call) {
|
|
149
217
|
JSONArray productIdentifiersArray = call.getArray("productIdentifiers");
|
|
150
218
|
List<String> productIdentifiers = new ArrayList<>();
|
|
151
219
|
|
|
152
220
|
for (int i = 0; i < productIdentifiersArray.length(); i++) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
221
|
+
try {
|
|
222
|
+
productIdentifiers.add(productIdentifiersArray.getString(i));
|
|
223
|
+
} catch (JSONException e) {
|
|
224
|
+
e.printStackTrace();
|
|
225
|
+
}
|
|
158
226
|
}
|
|
159
227
|
|
|
160
228
|
Log.d("NativePurchases", "getProducts: " + productIdentifiers);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
JSObject ret = new JSObject();
|
|
171
|
-
JSONArray products = new JSONArray();
|
|
172
|
-
|
|
173
|
-
for (SkuDetails skuDetails : skuDetailsList) {
|
|
174
|
-
JSObject product = new JSObject();
|
|
175
|
-
product.put("productId", skuDetails.getSku());
|
|
176
|
-
product.put("title", skuDetails.getTitle());
|
|
177
|
-
product.put("description", skuDetails.getDescription());
|
|
178
|
-
product.put("price", skuDetails.getPrice());
|
|
179
|
-
product.put("priceAmountMicros", skuDetails.getPriceAmountMicros());
|
|
180
|
-
product.put("priceCurrencyCode", skuDetails.getPriceCurrencyCode());
|
|
181
|
-
product.put("type", skuDetails.getType());
|
|
182
|
-
products.put(product);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
ret.put("products", products);
|
|
186
|
-
call.resolve(ret);
|
|
187
|
-
} else {
|
|
188
|
-
// Handle any other error codes.
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
229
|
+
List<QueryProductDetailsParams.Product> productList = new ArrayList<>();
|
|
230
|
+
for (String productIdentifier : productIdentifiers) {
|
|
231
|
+
productList.add(
|
|
232
|
+
QueryProductDetailsParams.Product
|
|
233
|
+
.newBuilder()
|
|
234
|
+
.setProductId(productIdentifier)
|
|
235
|
+
.setProductType(BillingClient.ProductType.INAPP)
|
|
236
|
+
.build()
|
|
237
|
+
);
|
|
192
238
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
239
|
+
QueryProductDetailsParams params = QueryProductDetailsParams
|
|
240
|
+
.newBuilder()
|
|
241
|
+
.setProductList(productList)
|
|
242
|
+
.build();
|
|
243
|
+
this.initBillingClient(call);
|
|
244
|
+
billingClient.queryProductDetailsAsync(
|
|
245
|
+
params,
|
|
246
|
+
new ProductDetailsResponseListener() {
|
|
247
|
+
public void onProductDetailsResponse(
|
|
248
|
+
BillingResult billingResult,
|
|
249
|
+
List<ProductDetails> productDetailsList
|
|
250
|
+
) {
|
|
251
|
+
Log.i(
|
|
252
|
+
"NativePurchases",
|
|
253
|
+
"onProductDetailsResponse" + billingResult + productDetailsList
|
|
254
|
+
);
|
|
255
|
+
// Process the result
|
|
256
|
+
JSObject ret = new JSObject();
|
|
257
|
+
JSONArray products = new JSONArray();
|
|
258
|
+
for (ProductDetails productDetails : productDetailsList) {
|
|
259
|
+
JSObject product = new JSObject();
|
|
260
|
+
product.put("identifier", productDetails.getProductId());
|
|
261
|
+
product.put("title", productDetails.getTitle());
|
|
262
|
+
product.put("description", productDetails.getDescription());
|
|
263
|
+
product.put(
|
|
264
|
+
"price",
|
|
265
|
+
productDetails
|
|
266
|
+
.getOneTimePurchaseOfferDetails()
|
|
267
|
+
.getPriceAmountMicros() /
|
|
268
|
+
1000000.0
|
|
269
|
+
);
|
|
270
|
+
product.put(
|
|
271
|
+
"priceString",
|
|
272
|
+
productDetails
|
|
273
|
+
.getOneTimePurchaseOfferDetails()
|
|
274
|
+
.getFormattedPrice()
|
|
275
|
+
);
|
|
276
|
+
product.put(
|
|
277
|
+
"currencyCode",
|
|
278
|
+
productDetails
|
|
279
|
+
.getOneTimePurchaseOfferDetails()
|
|
280
|
+
.getPriceCurrencyCode()
|
|
281
|
+
);
|
|
282
|
+
product.put("isFamilyShareable", false);
|
|
283
|
+
products.put(product);
|
|
284
|
+
}
|
|
285
|
+
ret.put("products", products);
|
|
286
|
+
billingClient.endConnection();
|
|
287
|
+
billingClient = null;
|
|
288
|
+
call.resolve(ret);
|
|
235
289
|
}
|
|
236
|
-
object.put(camelKey, value);
|
|
237
290
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return object;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
private static JSONArray convertArrayToJsonArray(Object[] array) {
|
|
244
|
-
JSONArray writableArray = new JSONArray();
|
|
245
|
-
for (Object item : array) {
|
|
246
|
-
if (item == null) {
|
|
247
|
-
writableArray.put(JSONObject.NULL);
|
|
248
|
-
} else if (item instanceof Map) {
|
|
249
|
-
writableArray.put(convertMapToJson((Map<String, Object>) item));
|
|
250
|
-
} else if (item instanceof Object[]) {
|
|
251
|
-
writableArray.put(convertArrayToJsonArray((Object[]) item));
|
|
252
|
-
} else if (item instanceof List) {
|
|
253
|
-
writableArray.put(convertArrayToJsonArray(((List) item).toArray()));
|
|
254
|
-
} else {
|
|
255
|
-
writableArray.put(item);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return writableArray;
|
|
291
|
+
);
|
|
259
292
|
}
|
|
260
293
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,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ACnB,CAAC,EA7CW,YAAY,KAAZ,YAAY,QA6CvB;AAED,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+HAAoC,CAAA;IACpC;;OAEG;IACH,qIAAmC,CAAA;IACnC;;OAEG;IACH,iIAAiC,CAAA;AACnC,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC","sourcesContent":["export enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = \"inapp\",\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = \"subs\",\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = \"UNKNOWN\",\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = \"CUSTOM\",\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = \"LIFETIME\",\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = \"ANNUAL\",\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = \"SIX_MONTH\",\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = \"THREE_MONTH\",\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = \"TWO_MONTH\",\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = \"MONTHLY\",\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = \"WEEKLY\",\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * RevenueCat Id associated to the transaction.\n */\n readonly transactionIdentifier: string;\n /**\n * Product Id associated with the transaction.\n */\n readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n */\n readonly purchaseDate: string;\n}\n\nexport interface CustomerInfo {\n /**\n * Set of active subscription skus\n */\n readonly activeSubscriptions: [string];\n /**\n * Set of purchased skus, active and inactive\n */\n readonly allPurchasedProductIdentifiers: [string];\n /**\n * Returns all the non-subscription a user has made.\n * The are ordered by purchase date in ascending order.\n */\n readonly nonSubscriptionTransactions: Transaction[];\n /**\n * The latest expiration date of all purchased skus\n */\n readonly latestExpirationDate: string | null;\n /**\n * The date this user was first seen in RevenueCat.\n */\n readonly firstSeen: string;\n /**\n * The original App User Id recorded for this user.\n */\n readonly originalAppUserId: string;\n /**\n * Date when this info was requested\n */\n readonly requestDate: string;\n /**\n * Returns the version number for the version of the application when the\n * user bought the app. Use this for grandfathering users when migrating\n * to subscriptions.\n *\n * This corresponds to the value of CFBundleVersion (in iOS) in the\n * Info.plist file when the purchase was originally made. This is always null\n * in Android\n */\n readonly originalApplicationVersion: string | null;\n /**\n * Returns the purchase date for the version of the application when the user bought the app.\n * Use this for grandfathering users when migrating to subscriptions.\n */\n readonly originalPurchaseDate: string | null;\n /**\n * URL to manage the active subscription of the user. If this user has an active iOS\n * subscription, this will point to the App Store, if the user has an active Play Store subscription\n * it will point there. If there are no active subscriptions it will be null.\n * If there are multiple for different platforms, it will point to the device store.\n */\n readonly managementURL: string | null;\n}\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }>;\n\n purchaseProduct(options: {productIdentifier: string
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,qFAAoB,CAAA;IACpB,iEAAU,CAAA;IACV,uEAAa,CAAA;IACb,iEAAU,CAAA;IACV,iEAAU,CAAA;IACV,qEAAY,CAAA;AACd,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B;AAED,MAAM,CAAN,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB;;OAEG;IACH,gCAAe,CAAA;IAEf;;OAEG;IACH,8BAAa,CAAA;AACf,CAAC,EAVW,aAAa,KAAb,aAAa,QAUxB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAyBX;AAzBD,WAAY,eAAe;IACzB;;OAEG;IACH,uEAAa,CAAA;IAEb;;OAEG;IACH,qFAAoB,CAAA;IAEpB;;OAEG;IACH,iFAAkB,CAAA;IAElB;;OAEG;IACH,mFAAmB,CAAA;IAEnB;;OAEG;IACH,+FAAyB,CAAA;AAC3B,CAAC,EAzBW,eAAe,KAAf,eAAe,QAyB1B;AACD,MAAM,CAAN,IAAY,cA2BX;AA3BD,WAAY,cAAc;IACxB,qIAAiD,CAAA;IAEjD;;;OAGG;IACH,qGAAiC,CAAA;IAEjC;;;;OAIG;IACH,iHAAuC,CAAA;IAEvC;;;OAGG;IACH,iGAA+B,CAAA;IAE/B;;;OAGG;IACH,2DAAY,CAAA;AACd,CAAC,EA3BW,cAAc,KAAd,cAAc,QA2BzB;AAED,MAAM,CAAN,IAAY,YA6CX;AA7CD,WAAY,YAAY;IACtB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,qCAAqB,CAAA;IAErB;;OAEG;IACH,iCAAiB,CAAA;IAEjB;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,2CAA2B,CAAA;IAE3B;;OAEG;IACH,uCAAuB,CAAA;IAEvB;;OAEG;IACH,mCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAiB,CAAA;AACnB,CAAC,EA7CW,YAAY,KAAZ,YAAY,QA6CvB;AAED,MAAM,CAAN,IAAY,wBAaX;AAbD,WAAY,wBAAwB;IAClC;;OAEG;IACH,+HAAoC,CAAA;IACpC;;OAEG;IACH,qIAAmC,CAAA;IACnC;;OAEG;IACH,iIAAiC,CAAA;AACnC,CAAC,EAbW,wBAAwB,KAAxB,wBAAwB,QAanC","sourcesContent":["export enum ATTRIBUTION_NETWORK {\n APPLE_SEARCH_ADS = 0,\n ADJUST = 1,\n APPSFLYER = 2,\n BRANCH = 3,\n TENJIN = 4,\n FACEBOOK = 5,\n}\n\nexport enum PURCHASE_TYPE {\n /**\n * A type of SKU for in-app products.\n */\n INAPP = \"inapp\",\n\n /**\n * A type of SKU for subscriptions.\n */\n SUBS = \"subs\",\n}\n\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport enum BILLING_FEATURE {\n /**\n * Purchase/query for subscriptions.\n */\n SUBSCRIPTIONS,\n\n /**\n * Subscriptions update/replace.\n */\n SUBSCRIPTIONS_UPDATE,\n\n /**\n * Purchase/query for in-app items on VR.\n */\n IN_APP_ITEMS_ON_VR,\n\n /**\n * Purchase/query for subscriptions on VR.\n */\n SUBSCRIPTIONS_ON_VR,\n\n /**\n * Launch a price change confirmation flow.\n */\n PRICE_CHANGE_CONFIRMATION,\n}\nexport enum PRORATION_MODE {\n UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY = 0,\n\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n IMMEDIATE_WITH_TIME_PRORATION = 1,\n\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n IMMEDIATE_AND_CHARGE_PRORATED_PRICE = 2,\n\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n IMMEDIATE_WITHOUT_PRORATION = 3,\n\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n DEFERRED = 4,\n}\n\nexport enum PACKAGE_TYPE {\n /**\n * A package that was defined with a custom identifier.\n */\n UNKNOWN = \"UNKNOWN\",\n\n /**\n * A package that was defined with a custom identifier.\n */\n CUSTOM = \"CUSTOM\",\n\n /**\n * A package configured with the predefined lifetime identifier.\n */\n LIFETIME = \"LIFETIME\",\n\n /**\n * A package configured with the predefined annual identifier.\n */\n ANNUAL = \"ANNUAL\",\n\n /**\n * A package configured with the predefined six month identifier.\n */\n SIX_MONTH = \"SIX_MONTH\",\n\n /**\n * A package configured with the predefined three month identifier.\n */\n THREE_MONTH = \"THREE_MONTH\",\n\n /**\n * A package configured with the predefined two month identifier.\n */\n TWO_MONTH = \"TWO_MONTH\",\n\n /**\n * A package configured with the predefined monthly identifier.\n */\n MONTHLY = \"MONTHLY\",\n\n /**\n * A package configured with the predefined weekly identifier.\n */\n WEEKLY = \"WEEKLY\",\n}\n\nexport enum INTRO_ELIGIBILITY_STATUS {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS_UNKNOWN = 0,\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_INELIGIBLE,\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS_ELIGIBLE,\n}\n\nexport interface Transaction {\n /**\n * RevenueCat Id associated to the transaction.\n */\n readonly transactionIdentifier: string;\n /**\n * Product Id associated with the transaction.\n */\n readonly productIdentifier: string;\n /**\n * Purchase date of the transaction in ISO 8601 format.\n */\n readonly purchaseDate: string;\n}\n\nexport interface CustomerInfo {\n /**\n * Set of active subscription skus\n */\n readonly activeSubscriptions: [string];\n /**\n * Set of purchased skus, active and inactive\n */\n readonly allPurchasedProductIdentifiers: [string];\n /**\n * Returns all the non-subscription a user has made.\n * The are ordered by purchase date in ascending order.\n */\n readonly nonSubscriptionTransactions: Transaction[];\n /**\n * The latest expiration date of all purchased skus\n */\n readonly latestExpirationDate: string | null;\n /**\n * The date this user was first seen in RevenueCat.\n */\n readonly firstSeen: string;\n /**\n * The original App User Id recorded for this user.\n */\n readonly originalAppUserId: string;\n /**\n * Date when this info was requested\n */\n readonly requestDate: string;\n /**\n * Returns the version number for the version of the application when the\n * user bought the app. Use this for grandfathering users when migrating\n * to subscriptions.\n *\n * This corresponds to the value of CFBundleVersion (in iOS) in the\n * Info.plist file when the purchase was originally made. This is always null\n * in Android\n */\n readonly originalApplicationVersion: string | null;\n /**\n * Returns the purchase date for the version of the application when the user bought the app.\n * Use this for grandfathering users when migrating to subscriptions.\n */\n readonly originalPurchaseDate: string | null;\n /**\n * URL to manage the active subscription of the user. If this user has an active iOS\n * subscription, this will point to the App Store, if the user has an active Play Store subscription\n * it will point there. If there are no active subscriptions it will be null.\n * If there are multiple for different platforms, it will point to the device store.\n */\n readonly managementURL: string | null;\n}\nexport interface SubscriptionPeriod {\n /**\n * The Subscription Period number of unit.\n */\n readonly numberOfUnits: number;\n /**\n * The Subscription Period unit.\n */\n readonly unit: number;\n}\nexport interface SKProductDiscount {\n /**\n * The Product discount identifier.\n */\n readonly identifier: string;\n /**\n * The Product discount type.\n */\n readonly type: number;\n /**\n * The Product discount price.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * The Product discount currency symbol.\n */\n readonly currencySymbol: string;\n /**\n * The Product discount currency code.\n */\n readonly currencyCode: string;\n /**\n * The Product discount paymentMode.\n */\n readonly paymentMode: number;\n /**\n * The Product discount number Of Periods.\n */\n readonly numberOfPeriods: number;\n /**\n * The Product discount subscription period.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n}\nexport interface Product {\n /**\n * Product Id.\n */\n readonly identifier: string;\n /**\n * Description of the product.\n */\n readonly description: string;\n /**\n * Title of the product.\n */\n readonly title: string;\n /**\n * Price of the product in the local currency.\n */\n readonly price: number;\n /**\n * Formatted price of the item, including its currency sign, such as €3.99.\n */\n readonly priceString: string;\n /**\n * Currency code for price and original price.\n */\n readonly currencyCode: string;\n /**\n * Currency symbol for price and original price.\n */\n readonly currencySymbol: string;\n /**\n * Boolean indicating if the product is sharable with family\n */\n readonly isFamilyShareable: boolean;\n /**\n * Group identifier for the product.\n */\n readonly subscriptionGroupIdentifier: string;\n /**\n * The Product subcription group identifier.\n */\n readonly subscriptionPeriod: SubscriptionPeriod;\n /**\n * The Product introductory Price.\n */\n readonly introductoryPrice: SKProductDiscount | null;\n /**\n * The Product discounts list.\n */\n readonly discounts: SKProductDiscount[];\n}\n\nexport interface NativePurchasesPlugin {\n /**\n * Restores a user's previous and links their appUserIDs to any user's also using those .\n */\n restorePurchases(): Promise<{ customerInfo: CustomerInfo }>;\n\n purchaseProduct(options: {\n productIdentifier: string;\n quantity: number;\n }): Promise<{ customerInfo: CustomerInfo }>;\n\n getProducts(options: {\n productIdentifiers: string[];\n }): Promise<{ products: Product[] }>;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NativePurchasesPlugin } from
|
|
1
|
+
import type { NativePurchasesPlugin } from "./definitions";
|
|
2
2
|
declare const NativePurchases: NativePurchasesPlugin;
|
|
3
|
-
export * from
|
|
3
|
+
export * from "./definitions";
|
|
4
4
|
export { NativePurchases };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { registerPlugin } from
|
|
2
|
-
const NativePurchases = registerPlugin(
|
|
3
|
-
web: () => import(
|
|
1
|
+
import { registerPlugin } from "@capacitor/core";
|
|
2
|
+
const NativePurchases = registerPlugin("NativePurchases", {
|
|
3
|
+
web: () => import("./web").then((m) => new m.NativePurchasesWeb()),
|
|
4
4
|
});
|
|
5
|
-
export * from
|
|
5
|
+
export * from "./definitions";
|
|
6
6
|
export { NativePurchases };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,eAAe,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,eAAe,GAAG,cAAc,CACpC,iBAAiB,EACjB;IACE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;CACnE,CACF,CAAC;AAEF,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\n\nimport type { NativePurchasesPlugin } from \"./definitions\";\n\nconst NativePurchases = registerPlugin<NativePurchasesPlugin>(\n \"NativePurchases\",\n {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n }\n);\n\nexport * from \"./definitions\";\nexport { NativePurchases };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebPlugin } from
|
|
2
|
-
import type { NativePurchasesPlugin, CustomerInfo, Product } from
|
|
1
|
+
import { WebPlugin } from "@capacitor/core";
|
|
2
|
+
import type { NativePurchasesPlugin, CustomerInfo, Product } from "./definitions";
|
|
3
3
|
export declare const mockCustomerInfo: CustomerInfo;
|
|
4
4
|
export declare class NativePurchasesWeb extends WebPlugin implements NativePurchasesPlugin {
|
|
5
5
|
restorePurchases(): Promise<{
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,mBAAmB,EAAE,CAAC,EAAE,CAAC;IACzB,8BAA8B,EAAE,CAAC,EAAE,CAAC;IACpC,2BAA2B,EAAE,EAAE;IAC/B,oBAAoB,EAAE,IAAI;IAC1B,SAAS,EAAE,0BAA0B;IACrC,iBAAiB,EAAE,EAAE;IACrB,WAAW,EAAE,0BAA0B;IACvC,0BAA0B,EAAE,EAAE;IAC9B,oBAAoB,EAAE,IAAI;IAC1B,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,OAAO,kBACX,SAAQ,SAAS;IAGjB,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACpD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAEjB;QACC,OAAO,CAAC,KAAK,CAAC,iCAAiC,GAAG,OAAO,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAGrB;QACC,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC,CAAC;QAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;IAC5C,CAAC;CACF","sourcesContent":["import { WebPlugin } from \"@capacitor/core\";\n\nimport type {\n NativePurchasesPlugin,\n CustomerInfo,\n Product,\n} from \"./definitions\";\n\nexport const mockCustomerInfo: CustomerInfo = {\n activeSubscriptions: [\"\"],\n allPurchasedProductIdentifiers: [\"\"],\n nonSubscriptionTransactions: [],\n latestExpirationDate: null,\n firstSeen: \"2020-01-01T00:00:00.000Z\",\n originalAppUserId: \"\",\n requestDate: \"2020-01-01T00:00:00.000Z\",\n originalApplicationVersion: \"\",\n originalPurchaseDate: null,\n managementURL: null,\n};\n\nexport class NativePurchasesWeb\n extends WebPlugin\n implements NativePurchasesPlugin\n{\n async restorePurchases(): Promise<{ customerInfo: CustomerInfo }> {\n console.error(\"purchasePackage only mocked in web\");\n return { customerInfo: mockCustomerInfo };\n }\n\n async getProducts(options: {\n productIdentifiers: string[];\n }): Promise<{ products: Product[] }> {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n\n async purchaseProduct(options: {\n productIdentifier: string;\n quantity: number;\n }): Promise<{ customerInfo: CustomerInfo }> {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { customerInfo: mockCustomerInfo };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -121,8 +121,8 @@ var core = require('@capacitor/core');
|
|
|
121
121
|
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_ELIGIBLE"] = 2] = "INTRO_ELIGIBILITY_STATUS_ELIGIBLE";
|
|
122
122
|
})(exports.INTRO_ELIGIBILITY_STATUS || (exports.INTRO_ELIGIBILITY_STATUS = {}));
|
|
123
123
|
|
|
124
|
-
const NativePurchases = core.registerPlugin(
|
|
125
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NativePurchasesWeb()),
|
|
124
|
+
const NativePurchases = core.registerPlugin("NativePurchases", {
|
|
125
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativePurchasesWeb()),
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
const mockCustomerInfo = {
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then(m => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport const mockCustomerInfo = {\n activeSubscriptions: [\"\"],\n allPurchasedProductIdentifiers: [\"\"],\n nonSubscriptionTransactions: [],\n latestExpirationDate: null,\n firstSeen: \"2020-01-01T00:00:00.000Z\",\n originalAppUserId: \"\",\n requestDate: \"2020-01-01T00:00:00.000Z\",\n originalApplicationVersion: \"\",\n originalPurchaseDate: null,\n managementURL: null,\n};\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"purchasePackage only mocked in web\");\n return { customerInfo: mockCustomerInfo };\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { customerInfo: mockCustomerInfo };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;;;;AACA,CAAC,UAAU,mBAAmB,EAAE;AAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC;AAC1F,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;AAC5E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;AAC1E,CAAC,EAAEA,2BAAmB,KAAKA,2BAAmB,GAAG,EAAE,CAAC,CAAC,CAAC;AAEtD,CAAC,UAAU,aAAa,EAAE;AAC1B;AACA;AACA;AACA,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AACrC;AACA;AACA;AACA,IAAI,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACnC,CAAC,EAAEC,qBAAa,KAAKA,qBAAa,GAAG,EAAE,CAAC,CAAC,CAAC;AAO1C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ORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport const mockCustomerInfo = {\n activeSubscriptions: [\"\"],\n allPurchasedProductIdentifiers: [\"\"],\n nonSubscriptionTransactions: [],\n latestExpirationDate: null,\n firstSeen: \"2020-01-01T00:00:00.000Z\",\n originalAppUserId: \"\",\n requestDate: \"2020-01-01T00:00:00.000Z\",\n originalApplicationVersion: \"\",\n originalPurchaseDate: null,\n managementURL: null,\n};\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"purchasePackage only mocked in web\");\n return { customerInfo: mockCustomerInfo };\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { customerInfo: mockCustomerInfo };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;;;;AACA,CAAC,UAAU,mBAAmB,EAAE;AAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC;AAC1F,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;AAC5E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;AACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ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C,KAAK,CAAC,iCAAiC,GAAG,OAAO,CAAC,CAAC;AACnE,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAChC,KAAK;AACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;AACnC,QAAQ,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC,CAAC;AACtE,QAAQ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAClD,KAAK;AACL;;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -118,8 +118,8 @@ var capacitorNativePurchases = (function (exports, core) {
|
|
|
118
118
|
INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS["INTRO_ELIGIBILITY_STATUS_ELIGIBLE"] = 2] = "INTRO_ELIGIBILITY_STATUS_ELIGIBLE";
|
|
119
119
|
})(exports.INTRO_ELIGIBILITY_STATUS || (exports.INTRO_ELIGIBILITY_STATUS = {}));
|
|
120
120
|
|
|
121
|
-
const NativePurchases = core.registerPlugin(
|
|
122
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.NativePurchasesWeb()),
|
|
121
|
+
const NativePurchases = core.registerPlugin("NativePurchases", {
|
|
122
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.NativePurchasesWeb()),
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
const mockCustomerInfo = {
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst NativePurchases = registerPlugin('NativePurchases', {\n web: () => import('./web').then(m => new m.NativePurchasesWeb()),\n});\nexport * from './definitions';\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport const mockCustomerInfo = {\n activeSubscriptions: [\"\"],\n allPurchasedProductIdentifiers: [\"\"],\n nonSubscriptionTransactions: [],\n latestExpirationDate: null,\n firstSeen: \"2020-01-01T00:00:00.000Z\",\n originalAppUserId: \"\",\n requestDate: \"2020-01-01T00:00:00.000Z\",\n originalApplicationVersion: \"\",\n originalPurchaseDate: null,\n managementURL: null,\n};\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"purchasePackage only mocked in web\");\n return { customerInfo: mockCustomerInfo };\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { customerInfo: mockCustomerInfo };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;IACA,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC;IAC1F,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;IAC5E,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC;IACtE,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC;IAC1E,CAAC,EAAEA,2BAAmB,KAAKA,2BAAmB,GAAG,EAAE,C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oC,GAAG,OAAO,CAAC,CAAC;IACtE,QAAQ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;IAClD,KAAK;IACL;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var ATTRIBUTION_NETWORK;\n(function (ATTRIBUTION_NETWORK) {\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPLE_SEARCH_ADS\"] = 0] = \"APPLE_SEARCH_ADS\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"ADJUST\"] = 1] = \"ADJUST\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"APPSFLYER\"] = 2] = \"APPSFLYER\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"BRANCH\"] = 3] = \"BRANCH\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"TENJIN\"] = 4] = \"TENJIN\";\n ATTRIBUTION_NETWORK[ATTRIBUTION_NETWORK[\"FACEBOOK\"] = 5] = \"FACEBOOK\";\n})(ATTRIBUTION_NETWORK || (ATTRIBUTION_NETWORK = {}));\nexport var PURCHASE_TYPE;\n(function (PURCHASE_TYPE) {\n /**\n * A type of SKU for in-app products.\n */\n PURCHASE_TYPE[\"INAPP\"] = \"inapp\";\n /**\n * A type of SKU for subscriptions.\n */\n PURCHASE_TYPE[\"SUBS\"] = \"subs\";\n})(PURCHASE_TYPE || (PURCHASE_TYPE = {}));\n/**\n * Enum for billing features.\n * Currently, these are only relevant for Google Play Android users:\n * https://developer.android.com/reference/com/android/billingclient/api/BillingClient.FeatureType\n */\nexport var BILLING_FEATURE;\n(function (BILLING_FEATURE) {\n /**\n * Purchase/query for subscriptions.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS\"] = 0] = \"SUBSCRIPTIONS\";\n /**\n * Subscriptions update/replace.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_UPDATE\"] = 1] = \"SUBSCRIPTIONS_UPDATE\";\n /**\n * Purchase/query for in-app items on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"IN_APP_ITEMS_ON_VR\"] = 2] = \"IN_APP_ITEMS_ON_VR\";\n /**\n * Purchase/query for subscriptions on VR.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"SUBSCRIPTIONS_ON_VR\"] = 3] = \"SUBSCRIPTIONS_ON_VR\";\n /**\n * Launch a price change confirmation flow.\n */\n BILLING_FEATURE[BILLING_FEATURE[\"PRICE_CHANGE_CONFIRMATION\"] = 4] = \"PRICE_CHANGE_CONFIRMATION\";\n})(BILLING_FEATURE || (BILLING_FEATURE = {}));\nexport var PRORATION_MODE;\n(function (PRORATION_MODE) {\n PRORATION_MODE[PRORATION_MODE[\"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\"] = 0] = \"UNKNOWN_SUBSCRIPTION_UPGRADE_DOWNGRADE_POLICY\";\n /**\n * Replacement takes effect immediately, and the remaining time will be\n * prorated and credited to the user. This is the current default behavior.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITH_TIME_PRORATION\"] = 1] = \"IMMEDIATE_WITH_TIME_PRORATION\";\n /**\n * Replacement takes effect immediately, and the billing cycle remains the\n * same. The price for the remaining period will be charged. This option is\n * only available for subscription upgrade.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\"] = 2] = \"IMMEDIATE_AND_CHARGE_PRORATED_PRICE\";\n /**\n * Replacement takes effect immediately, and the new price will be charged on\n * next recurrence time. The billing cycle stays the same.\n */\n PRORATION_MODE[PRORATION_MODE[\"IMMEDIATE_WITHOUT_PRORATION\"] = 3] = \"IMMEDIATE_WITHOUT_PRORATION\";\n /**\n * Replacement takes effect when the old plan expires, and the new price will\n * be charged at the same time.\n */\n PRORATION_MODE[PRORATION_MODE[\"DEFERRED\"] = 4] = \"DEFERRED\";\n})(PRORATION_MODE || (PRORATION_MODE = {}));\nexport var PACKAGE_TYPE;\n(function (PACKAGE_TYPE) {\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"UNKNOWN\"] = \"UNKNOWN\";\n /**\n * A package that was defined with a custom identifier.\n */\n PACKAGE_TYPE[\"CUSTOM\"] = \"CUSTOM\";\n /**\n * A package configured with the predefined lifetime identifier.\n */\n PACKAGE_TYPE[\"LIFETIME\"] = \"LIFETIME\";\n /**\n * A package configured with the predefined annual identifier.\n */\n PACKAGE_TYPE[\"ANNUAL\"] = \"ANNUAL\";\n /**\n * A package configured with the predefined six month identifier.\n */\n PACKAGE_TYPE[\"SIX_MONTH\"] = \"SIX_MONTH\";\n /**\n * A package configured with the predefined three month identifier.\n */\n PACKAGE_TYPE[\"THREE_MONTH\"] = \"THREE_MONTH\";\n /**\n * A package configured with the predefined two month identifier.\n */\n PACKAGE_TYPE[\"TWO_MONTH\"] = \"TWO_MONTH\";\n /**\n * A package configured with the predefined monthly identifier.\n */\n PACKAGE_TYPE[\"MONTHLY\"] = \"MONTHLY\";\n /**\n * A package configured with the predefined weekly identifier.\n */\n PACKAGE_TYPE[\"WEEKLY\"] = \"WEEKLY\";\n})(PACKAGE_TYPE || (PACKAGE_TYPE = {}));\nexport var INTRO_ELIGIBILITY_STATUS;\n(function (INTRO_ELIGIBILITY_STATUS) {\n /**\n * RevenueCat doesn't have enough information to determine eligibility.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_UNKNOWN\"] = 0] = \"INTRO_ELIGIBILITY_STATUS_UNKNOWN\";\n /**\n * The user is not eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\"] = 1] = \"INTRO_ELIGIBILITY_STATUS_INELIGIBLE\";\n /**\n * The user is eligible for a free trial or intro pricing for this product.\n */\n INTRO_ELIGIBILITY_STATUS[INTRO_ELIGIBILITY_STATUS[\"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\"] = 2] = \"INTRO_ELIGIBILITY_STATUS_ELIGIBLE\";\n})(INTRO_ELIGIBILITY_STATUS || (INTRO_ELIGIBILITY_STATUS = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst NativePurchases = registerPlugin(\"NativePurchases\", {\n web: () => import(\"./web\").then((m) => new m.NativePurchasesWeb()),\n});\nexport * from \"./definitions\";\nexport { NativePurchases };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport const mockCustomerInfo = {\n activeSubscriptions: [\"\"],\n allPurchasedProductIdentifiers: [\"\"],\n nonSubscriptionTransactions: [],\n latestExpirationDate: null,\n firstSeen: \"2020-01-01T00:00:00.000Z\",\n originalAppUserId: \"\",\n requestDate: \"2020-01-01T00:00:00.000Z\",\n originalApplicationVersion: \"\",\n originalPurchaseDate: null,\n managementURL: null,\n};\nexport class NativePurchasesWeb extends WebPlugin {\n async restorePurchases() {\n console.error(\"purchasePackage only mocked in web\");\n return { customerInfo: mockCustomerInfo };\n }\n async getProducts(options) {\n console.error(\"getProducts only mocked in web \" + options);\n return { products: [] };\n }\n async purchaseProduct(options) {\n console.error(\"purchaseProduct only mocked in web\" + options);\n return { customerInfo: mockCustomerInfo };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ATTRIBUTION_NETWORK","PURCHASE_TYPE","BILLING_FEATURE","PRORATION_MODE","PACKAGE_TYPE","INTRO_ELIGIBILITY_STATUS","registerPlugin","WebPlugin"],"mappings":";;;IACA,CAAC,UAAU,mBAAmB,EAAE;IAChC,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC;IAC1F,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,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IACK,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC5D,QAAQ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;IAClD,KAAK;IACL,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,KAAK,CAAC,iCAAiC,GAAG,OAAO,CAAC,CAAC;IACnE,QAAQ,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAChC,KAAK;IACL,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,OAAO,CAAC,KAAK,CAAC,oCAAoC,GAAG,OAAO,CAAC,CAAC;IACtE,QAAQ,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;IAClD,KAAK;IACL;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,11 +16,11 @@ public class NativePurchasesPlugin: CAPPlugin {
|
|
|
16
16
|
print("purchaseProduct")
|
|
17
17
|
let productIdentifier = call.getString("productIdentifier", "")
|
|
18
18
|
let quantity = call.getInt("quantity", 1)
|
|
19
|
-
if
|
|
19
|
+
if productIdentifier.isEmpty {
|
|
20
20
|
call.reject("productIdentifier is Empty, give an id")
|
|
21
21
|
return
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
Task {
|
|
25
25
|
do {
|
|
26
26
|
let products = try await Product.products(for: [productIdentifier])
|
|
@@ -30,23 +30,23 @@ public class NativePurchasesPlugin: CAPPlugin {
|
|
|
30
30
|
let result = try await product.purchase(options: purchaseOptions)
|
|
31
31
|
print("purchaseProduct result \(result)")
|
|
32
32
|
switch result {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
case let .success(.verified(transaction)):
|
|
34
|
+
// Successful purhcase
|
|
35
|
+
await transaction.finish()
|
|
36
|
+
call.resolve(["transactionId": transaction.id])
|
|
37
|
+
case let .success(.unverified(_, error)):
|
|
38
|
+
// Successful purchase but transaction/receipt can't be verified
|
|
39
|
+
// Could be a jailbroken phone
|
|
40
|
+
call.reject(error.localizedDescription)
|
|
41
|
+
case .pending:
|
|
42
|
+
// Transaction waiting on SCA (Strong Customer Authentication) or
|
|
43
|
+
// approval from Ask to Buy
|
|
44
|
+
call.reject("Transaction pending")
|
|
45
|
+
case .userCancelled:
|
|
46
|
+
// ^^^
|
|
47
|
+
call.reject("User cancelled")
|
|
48
|
+
@unknown default:
|
|
49
|
+
call.reject("Unknown error")
|
|
50
50
|
}
|
|
51
51
|
} catch {
|
|
52
52
|
print(error)
|
|
@@ -101,6 +101,4 @@ public class NativePurchasesPlugin: CAPPlugin {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
104
|
}
|
|
@@ -10,36 +10,36 @@ import StoreKit
|
|
|
10
10
|
|
|
11
11
|
@available(iOS 15.0, *)
|
|
12
12
|
extension Product {
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
var dictionary: [String: Any] {
|
|
15
|
-
// /**
|
|
16
|
-
// * Currency code for price and original price.
|
|
17
|
-
// */
|
|
18
|
-
// readonly currencyCode: string;
|
|
19
|
-
// /**
|
|
20
|
-
// * Currency symbol for price and original price.
|
|
21
|
-
// */
|
|
22
|
-
// readonly currencySymbol: string;
|
|
23
|
-
// /**
|
|
24
|
-
// * Boolean indicating if the product is sharable with family
|
|
25
|
-
// */
|
|
26
|
-
// readonly isFamilyShareable: boolean;
|
|
27
|
-
// /**
|
|
28
|
-
// * Group identifier for the product.
|
|
29
|
-
// */
|
|
30
|
-
// readonly subscriptionGroupIdentifier: string;
|
|
31
|
-
// /**
|
|
32
|
-
// * The Product subcription group identifier.
|
|
33
|
-
// */
|
|
34
|
-
// readonly subscriptionPeriod: SubscriptionPeriod;
|
|
35
|
-
// /**
|
|
36
|
-
// * The Product introductory Price.
|
|
37
|
-
// */
|
|
38
|
-
// readonly introductoryPrice: SKProductDiscount | null;
|
|
39
|
-
// /**
|
|
40
|
-
// * The Product discounts list.
|
|
41
|
-
// */
|
|
42
|
-
// readonly discounts: SKProductDiscount[];
|
|
15
|
+
// /**
|
|
16
|
+
// * Currency code for price and original price.
|
|
17
|
+
// */
|
|
18
|
+
// readonly currencyCode: string;
|
|
19
|
+
// /**
|
|
20
|
+
// * Currency symbol for price and original price.
|
|
21
|
+
// */
|
|
22
|
+
// readonly currencySymbol: string;
|
|
23
|
+
// /**
|
|
24
|
+
// * Boolean indicating if the product is sharable with family
|
|
25
|
+
// */
|
|
26
|
+
// readonly isFamilyShareable: boolean;
|
|
27
|
+
// /**
|
|
28
|
+
// * Group identifier for the product.
|
|
29
|
+
// */
|
|
30
|
+
// readonly subscriptionGroupIdentifier: string;
|
|
31
|
+
// /**
|
|
32
|
+
// * The Product subcription group identifier.
|
|
33
|
+
// */
|
|
34
|
+
// readonly subscriptionPeriod: SubscriptionPeriod;
|
|
35
|
+
// /**
|
|
36
|
+
// * The Product introductory Price.
|
|
37
|
+
// */
|
|
38
|
+
// readonly introductoryPrice: SKProductDiscount | null;
|
|
39
|
+
// /**
|
|
40
|
+
// * The Product discounts list.
|
|
41
|
+
// */
|
|
42
|
+
// readonly discounts: SKProductDiscount[];
|
|
43
43
|
return [
|
|
44
44
|
"identifier": self.id,
|
|
45
45
|
"description": self.description,
|
|
@@ -47,7 +47,7 @@ extension Product {
|
|
|
47
47
|
"price": self.price,
|
|
48
48
|
"priceString": self.displayPrice,
|
|
49
49
|
"currencyCode": self.priceFormatStyle.currencyCode,
|
|
50
|
-
"isFamilyShareable": self.isFamilyShareable
|
|
50
|
+
"isFamilyShareable": self.isFamilyShareable
|
|
51
51
|
]
|
|
52
52
|
}
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-purchases",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "In-app Subscriptions Made Easy",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
34
34
|
"verify:web": "npm run build",
|
|
35
35
|
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
36
|
-
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --
|
|
36
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
|
|
37
37
|
"eslint": "eslint . --ext ts",
|
|
38
|
-
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
38
|
+
"prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
|
|
39
39
|
"swiftlint": "node-swiftlint",
|
|
40
40
|
"docgen": "docgen --api NativePurchasesPlugin --output-readme README.md --output-json dist/docs.json",
|
|
41
41
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.js",
|