@purchasely/cordova-plugin-purchasely 4.2.0 → 4.2.2

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.
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "..": {
21
21
  "name": "@purchasely/cordova-plugin-purchasely",
22
- "version": "4.1.0",
22
+ "version": "4.2.2",
23
23
  "dev": true,
24
24
  "license": "ISC",
25
25
  "engines": {
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "../../purchasely-google": {
35
35
  "name": "@purchasely/cordova-plugin-puchasely-google",
36
- "version": "4.1.0",
36
+ "version": "4.2.2",
37
37
  "dev": true,
38
38
  "license": "ISC"
39
39
  },
@@ -105,9 +105,9 @@
105
105
  }
106
106
  },
107
107
  "node_modules/android-versions": {
108
- "version": "1.8.2",
109
- "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.8.2.tgz",
110
- "integrity": "sha512-2MT/Y/mR3BLSbR9E3ugwvE/aA4k84XtjG2Iusu4pRKt4FwfpEvIEAHzm7ZBhL3/aTVNdx3PzZ+sAiK+Dbc4r9A==",
108
+ "version": "1.9.0",
109
+ "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.9.0.tgz",
110
+ "integrity": "sha512-13O2B6PQMEM4ej9n13ePRQeckrCoKbZrvuzlLvK+9s2QmncpHDbYzZxhgapN32sJNoifN6VAHexLnd/6CYrs7Q==",
111
111
  "dev": true,
112
112
  "dependencies": {
113
113
  "semver": "^7.5.2"
@@ -1321,9 +1321,9 @@
1321
1321
  "dev": true
1322
1322
  },
1323
1323
  "android-versions": {
1324
- "version": "1.8.2",
1325
- "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.8.2.tgz",
1326
- "integrity": "sha512-2MT/Y/mR3BLSbR9E3ugwvE/aA4k84XtjG2Iusu4pRKt4FwfpEvIEAHzm7ZBhL3/aTVNdx3PzZ+sAiK+Dbc4r9A==",
1324
+ "version": "1.9.0",
1325
+ "resolved": "https://registry.npmjs.org/android-versions/-/android-versions-1.9.0.tgz",
1326
+ "integrity": "sha512-13O2B6PQMEM4ej9n13ePRQeckrCoKbZrvuzlLvK+9s2QmncpHDbYzZxhgapN32sJNoifN6VAHexLnd/6CYrs7Q==",
1327
1327
  "dev": true,
1328
1328
  "requires": {
1329
1329
  "semver": "^7.5.2"
@@ -250,7 +250,10 @@ function processToPayment() {
250
250
  // Call this method open paywall again
251
251
  Purchasely.showPresentation();
252
252
 
253
- // Call this method to process to payment
253
+ // Call this method in paywallObserver mode to synchronize purchases with Purchasely
254
+ // Purchasely.synchronize();
255
+
256
+ // Call this method to process to payment or false if you handled it
254
257
  Purchasely.onProcessAction(true);
255
258
  }
256
259
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "Purchasely is a solution to ease the integration and boost your In-App Purchases & Subscriptions on the App Store, Google Play Store, Amazon Appstore and Huawei App Gallery.",
5
5
  "cordova": {
6
6
  "id": "@purchasely/cordova-plugin-purchasely",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="@purchasely/cordova-plugin-purchasely" version="4.2.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="@purchasely/cordova-plugin-purchasely" version="4.2.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>Purchasely</name>
4
4
  <js-module name="Purchasely" src="www/Purchasely.js">
5
5
  <clobbers target="Purchasely" />
@@ -36,7 +36,7 @@
36
36
  <source url="https://github.com/CocoaPods/Specs.git"/>
37
37
  </config>
38
38
  <pods use-frameworks="true">
39
- <pod name="Purchasely" spec="4.2.0"/>
39
+ <pod name="Purchasely" spec="4.2.2"/>
40
40
  </pods>
41
41
  </podspec>
42
42
  </platform>
@@ -61,7 +61,7 @@
61
61
  android:theme="@style/Theme.AppCompat.Light.NoActionBar">
62
62
  </activity>
63
63
  </config-file>
64
- <framework src="io.purchasely:core:4.2.0" />
64
+ <framework src="io.purchasely:core:4.2.2" />
65
65
  <source-file src="src/android/PurchaselyPlugin.kt" target-dir="java/cordova/plugin/purchasely" />
66
66
  <source-file src="src/android/PLYProductActivity.kt" target-dir="java/cordova/plugin/purchasely" />
67
67
  <source-file src="src/android/PLYSubscriptionsActivity.java" target-dir="src/cordova/plugin/purchasely" />
@@ -40,6 +40,7 @@
40
40
  - (void)purchaseWithPlanVendorId:(CDVInvokedUrlCommand*)command;
41
41
  - (void)restoreAllProducts:(CDVInvokedUrlCommand*)command;
42
42
  - (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command;
43
+ - (void)synchronize:(CDVInvokedUrlCommand*)command;
43
44
  - (void)purchasedSubscription:(CDVInvokedUrlCommand*)command;
44
45
  - (void)allProducts:(CDVInvokedUrlCommand*)command;
45
46
  - (void)productWithIdentifier:(CDVInvokedUrlCommand*)command;
@@ -216,12 +216,12 @@
216
216
  NSString *planVendorId = [command argumentAtIndex:0];
217
217
  NSString *offerId = [command argumentAtIndex:1];
218
218
  NSString *contentId = [command argumentAtIndex:2];
219
-
219
+
220
220
  [Purchasely planWith:planVendorId
221
221
  success:^(PLYPlan * _Nonnull plan) {
222
-
222
+
223
223
  if (@available(iOS 12.2, macOS 12.0, tvOS 15.0, watchOS 8.0, *)) {
224
-
224
+
225
225
  NSString *storeOfferId = nil;
226
226
  for (PLYPromoOffer *promoOffer in plan.promoOffers) {
227
227
  if ([promoOffer.vendorId isEqualToString:offerId]) {
@@ -229,7 +229,7 @@
229
229
  break;
230
230
  }
231
231
  }
232
-
232
+
233
233
  if (storeOfferId) {
234
234
  [Purchasely purchaseWithPromotionalOfferWithPlan:plan
235
235
  contentId:contentId
@@ -278,6 +278,12 @@
278
278
  }];
279
279
  }
280
280
 
281
+ - (void)synchronize:(CDVInvokedUrlCommand*)command {
282
+ [Purchasely synchronizeWithSuccess:^{
283
+ } failure:^(NSError * _Nonnull error) {
284
+ }];
285
+ }
286
+
281
287
  - (void)purchasedSubscription:(CDVInvokedUrlCommand*)command {
282
288
  self.purchasedCommand = command;
283
289
  [[NSNotificationCenter defaultCenter] addObserver:self
@@ -371,7 +377,7 @@
371
377
  - (void)signPromotionalOffer:(CDVInvokedUrlCommand*)command {
372
378
  NSString *storeProductId = [command argumentAtIndex:0];
373
379
  NSString *storeOfferId = [command argumentAtIndex:1];
374
-
380
+
375
381
  dispatch_async(dispatch_get_main_queue(), ^{
376
382
  if (@available(iOS 12.2, *)) {
377
383
  [Purchasely signPromotionalOfferWithStoreProductId:storeProductId storeOfferId:storeOfferId success:^(PLYOfferSignature * _Nonnull signature) {
@@ -388,7 +394,7 @@
388
394
 
389
395
  - (void)isEligibleForIntroOffer:(CDVInvokedUrlCommand*)command {
390
396
  NSString *planVendorId = [command argumentAtIndex:0];
391
-
397
+
392
398
  [Purchasely planWith:planVendorId
393
399
  success:^(PLYPlan * _Nonnull plan) {
394
400
  [plan isUserEligibleForIntroductoryOfferWithCompletion:^(BOOL isEligible) {
@@ -702,7 +708,7 @@
702
708
  }
703
709
 
704
710
  self.shouldReopenPaywall = NO;
705
-
711
+
706
712
  [Purchasely closeDisplayedPresentation];
707
713
  self.presentedPresentationViewController = presentationLoaded.controller;
708
714
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
@@ -739,13 +745,13 @@
739
745
  [dict setObject:signature.identifier forKey:@"identifier"];
740
746
  [dict setObject:signature.signature forKey:@"signature"];
741
747
  [dict setObject:signature.keyIdentifier forKey:@"keyIdentifier"];
742
-
748
+
743
749
  NSString *nonceString = [signature.nonce UUIDString];
744
750
  NSObject *nonce = (NSObject *)nonceString;
745
751
  if (nonce != nil) {
746
752
  [dict setObject:nonce forKey:@"nonce"];
747
753
  }
748
-
754
+
749
755
  NSNumber *timestamp = [NSNumber numberWithDouble:signature.timestamp];
750
756
  if (timestamp != nil) {
751
757
  [dict setObject:timestamp forKey:@"timestamp"];
package/www/Purchasely.js CHANGED
@@ -5,7 +5,7 @@ var defaultError = (e) => { console.log(e); }
5
5
  exports.start = function (apiKey, stores, storekit1, userId, logLevel, runningMode, success, error) {
6
6
  var cordovaSdkVersion = cordova.define.moduleMap['cordova/plugin_list'].exports['metadata']['cordova-plugin-purchasely']
7
7
  if(!cordovaSdkVersion) {
8
- cordovaSdkVersion = "4.2.0";
8
+ cordovaSdkVersion = "4.2.2";
9
9
  }
10
10
  exec(success, error, 'Purchasely', 'start', [apiKey, stores, storekit1, userId, logLevel, runningMode, cordovaSdkVersion]);
11
11
  };