@purchasely/cordova-plugin-purchasely 1.1.7 → 2.0.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 CHANGED
@@ -11,10 +11,24 @@ cordova plugin add @purchasely/cordova-plugin-purchasely
11
11
  ## Usage
12
12
 
13
13
  ```js
14
- Purchasely.startWithAPIKey('API_KEY', ['Google'], null, Purchasely.LogLevel.DEBUG, false);
14
+ Purchasely.startWithAPIKey(
15
+ 'API_KEY',
16
+ ['Google'], // list of stores for Android, accepted values: Google, Huawei and Amazon
17
+ null, // your user id
18
+ Purchasely.LogLevel.DEBUG, // log level, should be warning or error in production
19
+ Purchasely.RunningMode.full, // running mode
20
+ (isConfigured) => {
21
+ if(isConfigured) // you can use the SDK like display a paywall or make a purchase
22
+ },
23
+ (error) => {
24
+ console.log(error);
25
+ }
26
+ );
15
27
 
16
28
  Purchasely.presentPresentationWithIdentifier(
17
- 'my_presentation_id',
29
+ 'my_presentation_id', // may be null
30
+ 'my_content_id', // may be null
31
+ false, //display in fullscreen mode
18
32
  (callback) => {
19
33
  console.log(callback);
20
34
  if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
package/VERSIONS.md CHANGED
@@ -12,3 +12,7 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
12
12
  | 1.1.3 | 2.7.3 | 2.7.2 |
13
13
  | 1.1.6 | 2.7.3 | 2.7.3 |
14
14
  | 1.1.7 | 2.7.3 | 2.7.4 |
15
+ | 1.1.8 | 2.7.3 | 2.7.6 |
16
+ | 1.2.0 | 2.8.0 | 2.8.0 |
17
+ | 2.0.0 | 3.0.0 | 3.0.1 |
18
+ | 2.0.1 | 3.0.0 | 3.0.1 |
@@ -18,6 +18,16 @@
18
18
  <platform name="android">
19
19
  <allow-intent href="market:*" />
20
20
  <preference name="AndroidXEnabled" value="true" />
21
+ <!--<edit-config
22
+ file="AndroidManifest.xml"
23
+ target="/manifest/application/activity[@android:name='cordova.plugin.purchasely.PLYProductActivity']"
24
+ mode="overwrite">
25
+ <activity
26
+ android:label="PLYProductActivity"
27
+ android:name="cordova.plugin.purchasely.PLYProductActivity"
28
+ android:theme="@style/Theme.Purchasely.Fullscreen">
29
+ </activity>
30
+ </edit-config>-->
21
31
  </platform>
22
32
  <platform name="ios">
23
33
  <allow-intent href="itms:*" />
@@ -10,14 +10,15 @@
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
12
  "@purchasely/cordova-plugin-purchasely": "file:..",
13
- "cordova-android": "^10.1.1",
13
+ "cordova-android": "^10.1.0",
14
14
  "cordova-ios": "^6.2.0",
15
+ "cordova-plugin-purchasely": "file:..",
15
16
  "cordova-plugin-whitelist": "^1.3.5"
16
17
  }
17
18
  },
18
19
  "..": {
19
- "name": "@purchasely/cordova-plugin-purchasely",
20
- "version": "1.1.6",
20
+ "name": "cordova-plugin-purchasely",
21
+ "version": "2.0.0",
21
22
  "dev": true,
22
23
  "license": "ISC"
23
24
  },
@@ -155,12 +156,12 @@
155
156
  }
156
157
  },
157
158
  "node_modules/bplist-creator": {
158
- "version": "0.0.8",
159
- "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz",
160
- "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==",
159
+ "version": "0.1.0",
160
+ "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz",
161
+ "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==",
161
162
  "dev": true,
162
163
  "dependencies": {
163
- "stream-buffers": "~2.2.0"
164
+ "stream-buffers": "2.2.x"
164
165
  }
165
166
  },
166
167
  "node_modules/bplist-parser": {
@@ -204,9 +205,9 @@
204
205
  "dev": true
205
206
  },
206
207
  "node_modules/cordova-android": {
207
- "version": "10.1.1",
208
- "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.1.tgz",
209
- "integrity": "sha512-eoJp5AcDMHniqmxj0CbUF/rVQfbbp108TWKU6oyJW9rl/ZTJqZxm5ybznl+1/1MBksklxhMeipMn0Iwd0kEzEQ==",
208
+ "version": "10.1.0",
209
+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
210
+ "integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
210
211
  "dev": true,
211
212
  "dependencies": {
212
213
  "android-versions": "^1.7.0",
@@ -285,6 +286,10 @@
285
286
  "node": ">=10"
286
287
  }
287
288
  },
289
+ "node_modules/cordova-plugin-purchasely": {
290
+ "resolved": "..",
291
+ "link": true
292
+ },
288
293
  "node_modules/cordova-plugin-whitelist": {
289
294
  "version": "1.3.5",
290
295
  "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
@@ -805,14 +810,13 @@
805
810
  }
806
811
  },
807
812
  "node_modules/plist": {
808
- "version": "3.0.2",
809
- "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz",
810
- "integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==",
813
+ "version": "3.0.4",
814
+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
815
+ "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
811
816
  "dev": true,
812
817
  "dependencies": {
813
818
  "base64-js": "^1.5.1",
814
- "xmlbuilder": "^9.0.7",
815
- "xmldom": "^0.5.0"
819
+ "xmlbuilder": "^9.0.7"
816
820
  },
817
821
  "engines": {
818
822
  "node": ">=6"
@@ -961,9 +965,9 @@
961
965
  }
962
966
  },
963
967
  "node_modules/signal-exit": {
964
- "version": "3.0.5",
965
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
966
- "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
968
+ "version": "3.0.6",
969
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
970
+ "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
967
971
  "dev": true
968
972
  },
969
973
  "node_modules/simctl": {
@@ -977,14 +981,26 @@
977
981
  }
978
982
  },
979
983
  "node_modules/simple-plist": {
980
- "version": "1.1.1",
981
- "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz",
982
- "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==",
984
+ "version": "1.3.0",
985
+ "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
986
+ "integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
983
987
  "dev": true,
984
988
  "dependencies": {
985
- "bplist-creator": "0.0.8",
986
- "bplist-parser": "0.2.0",
987
- "plist": "^3.0.1"
989
+ "bplist-creator": "0.1.0",
990
+ "bplist-parser": "0.3.0",
991
+ "plist": "^3.0.4"
992
+ }
993
+ },
994
+ "node_modules/simple-plist/node_modules/bplist-parser": {
995
+ "version": "0.3.0",
996
+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
997
+ "integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
998
+ "dev": true,
999
+ "dependencies": {
1000
+ "big-integer": "1.6.x"
1001
+ },
1002
+ "engines": {
1003
+ "node": ">= 5.10.0"
988
1004
  }
989
1005
  },
990
1006
  "node_modules/stream-buffers": {
@@ -1146,15 +1162,6 @@
1146
1162
  "node": ">=4.0"
1147
1163
  }
1148
1164
  },
1149
- "node_modules/xmldom": {
1150
- "version": "0.5.0",
1151
- "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",
1152
- "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==",
1153
- "dev": true,
1154
- "engines": {
1155
- "node": ">=10.0.0"
1156
- }
1157
- },
1158
1165
  "node_modules/yallist": {
1159
1166
  "version": "4.0.0",
1160
1167
  "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -1263,12 +1270,12 @@
1263
1270
  "dev": true
1264
1271
  },
1265
1272
  "bplist-creator": {
1266
- "version": "0.0.8",
1267
- "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.0.8.tgz",
1268
- "integrity": "sha512-Za9JKzD6fjLC16oX2wsXfc+qBEhJBJB1YPInoAQpMLhDuj5aVOv1baGeIQSq1Fr3OCqzvsoQcSBSwGId/Ja2PA==",
1273
+ "version": "0.1.0",
1274
+ "resolved": "https://registry.npmjs.org/bplist-creator/-/bplist-creator-0.1.0.tgz",
1275
+ "integrity": "sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg==",
1269
1276
  "dev": true,
1270
1277
  "requires": {
1271
- "stream-buffers": "~2.2.0"
1278
+ "stream-buffers": "2.2.x"
1272
1279
  }
1273
1280
  },
1274
1281
  "bplist-parser": {
@@ -1306,9 +1313,9 @@
1306
1313
  "dev": true
1307
1314
  },
1308
1315
  "cordova-android": {
1309
- "version": "10.1.1",
1310
- "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.1.tgz",
1311
- "integrity": "sha512-eoJp5AcDMHniqmxj0CbUF/rVQfbbp108TWKU6oyJW9rl/ZTJqZxm5ybznl+1/1MBksklxhMeipMn0Iwd0kEzEQ==",
1316
+ "version": "10.1.0",
1317
+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
1318
+ "integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
1312
1319
  "dev": true,
1313
1320
  "requires": {
1314
1321
  "android-versions": "^1.7.0",
@@ -1377,6 +1384,9 @@
1377
1384
  "xml-escape": "^1.1.0"
1378
1385
  }
1379
1386
  },
1387
+ "cordova-plugin-purchasely": {
1388
+ "version": "file:.."
1389
+ },
1380
1390
  "cordova-plugin-whitelist": {
1381
1391
  "version": "1.3.5",
1382
1392
  "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
@@ -1764,14 +1774,13 @@
1764
1774
  "dev": true
1765
1775
  },
1766
1776
  "plist": {
1767
- "version": "3.0.2",
1768
- "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz",
1769
- "integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==",
1777
+ "version": "3.0.4",
1778
+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
1779
+ "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
1770
1780
  "dev": true,
1771
1781
  "requires": {
1772
1782
  "base64-js": "^1.5.1",
1773
- "xmlbuilder": "^9.0.7",
1774
- "xmldom": "^0.5.0"
1783
+ "xmlbuilder": "^9.0.7"
1775
1784
  }
1776
1785
  },
1777
1786
  "properties-parser": {
@@ -1857,9 +1866,9 @@
1857
1866
  "dev": true
1858
1867
  },
1859
1868
  "signal-exit": {
1860
- "version": "3.0.5",
1861
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz",
1862
- "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==",
1869
+ "version": "3.0.6",
1870
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
1871
+ "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
1863
1872
  "dev": true
1864
1873
  },
1865
1874
  "simctl": {
@@ -1873,14 +1882,25 @@
1873
1882
  }
1874
1883
  },
1875
1884
  "simple-plist": {
1876
- "version": "1.1.1",
1877
- "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.1.1.tgz",
1878
- "integrity": "sha512-pKMCVKvZbZTsqYR6RKgLfBHkh2cV89GXcA/0CVPje3sOiNOnXA8+rp/ciAMZ7JRaUdLzlEM6JFfUn+fS6Nt3hg==",
1885
+ "version": "1.3.0",
1886
+ "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
1887
+ "integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
1879
1888
  "dev": true,
1880
1889
  "requires": {
1881
- "bplist-creator": "0.0.8",
1882
- "bplist-parser": "0.2.0",
1883
- "plist": "^3.0.1"
1890
+ "bplist-creator": "0.1.0",
1891
+ "bplist-parser": "0.3.0",
1892
+ "plist": "^3.0.4"
1893
+ },
1894
+ "dependencies": {
1895
+ "bplist-parser": {
1896
+ "version": "0.3.0",
1897
+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
1898
+ "integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
1899
+ "dev": true,
1900
+ "requires": {
1901
+ "big-integer": "1.6.x"
1902
+ }
1903
+ }
1884
1904
  }
1885
1905
  },
1886
1906
  "stream-buffers": {
@@ -2000,12 +2020,6 @@
2000
2020
  "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=",
2001
2021
  "dev": true
2002
2022
  },
2003
- "xmldom": {
2004
- "version": "0.5.0",
2005
- "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",
2006
- "integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==",
2007
- "dev": true
2008
- },
2009
2023
  "yallist": {
2010
2024
  "version": "4.0.0",
2011
2025
  "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
@@ -14,18 +14,19 @@
14
14
  "license": "Apache-2.0",
15
15
  "devDependencies": {
16
16
  "@purchasely/cordova-plugin-purchasely": "file:..",
17
- "cordova-android": "^10.1.1",
17
+ "cordova-android": "^10.1.0",
18
18
  "cordova-ios": "^6.2.0",
19
+ "cordova-plugin-purchasely": "file:..",
19
20
  "cordova-plugin-whitelist": "^1.3.5"
20
21
  },
21
22
  "cordova": {
22
23
  "plugins": {
23
24
  "cordova-plugin-whitelist": {},
24
- "@purchasley/cordova-plugin-purchasely": {}
25
+ "cordova-plugin-purchasely": {}
25
26
  },
26
27
  "platforms": [
27
- "ios",
28
- "android"
28
+ "android",
29
+ "ios"
29
30
  ]
30
31
  }
31
- }
32
+ }
@@ -59,6 +59,9 @@
59
59
  <div style="margin-top: 20px;">
60
60
  <button id="restore">Restore</button>
61
61
  </div>
62
+ <div style="margin-top: 20px;">
63
+ <button id="silentRestore">Silent restore</button>
64
+ </div>
62
65
  <div style="margin-top: 20px;">
63
66
  <button id="openDeeplink">Deeplink</button>
64
67
  </div>
@@ -29,12 +29,14 @@ function onDeviceReady() {
29
29
 
30
30
  console.log("Hi");
31
31
 
32
+ Purchasely.setLanguage('en')
33
+
32
34
  Purchasely.startWithAPIKey(
33
35
  'afa96c76-1d8e-4e3c-a48f-204a3cd93a15',
34
36
  ['Google'],
35
37
  null,
36
38
  Purchasely.LogLevel.DEBUG,
37
- false,
39
+ Purchasely.RunningMode.full,
38
40
  (isConfigured) => {
39
41
  if(isConfigured) onPuchaselySdkReady();
40
42
  },
@@ -46,6 +48,7 @@ function onDeviceReady() {
46
48
  document.getElementById("presentSubscriptions").addEventListener("click", presentSubscriptions);
47
49
  document.getElementById("purchaseWithPlanVendorId").addEventListener("click", purchaseWithPlanVendorId);
48
50
  document.getElementById("restore").addEventListener("click", restore);
51
+ document.getElementById("silentRestore").addEventListener("click", silentRestore);
49
52
  document.getElementById("processToPayment").addEventListener("click", processToPayment);
50
53
 
51
54
  }
@@ -81,9 +84,26 @@ function onPuchaselySdkReady() {
81
84
  Purchasely.setLogLevel(Purchasely.LogLevel.DEBUG);
82
85
 
83
86
  Purchasely.setAttribute(Purchasely.Attribute.FIREBASE_APP_INSTANCE_ID, "1");
87
+ Purchasely.setAttribute(Purchasely.Attribute.BATCH_INSTALLATION_ID, "testBatch1");
84
88
 
85
89
  Purchasely.isReadyToPurchase(true);
86
90
 
91
+ Purchasely.planWithIdentifier('PURCHASELY_PLUS_MONTHLY', (plan) => {
92
+ console.log(' ==> Plan');
93
+ console.log(plan.vendorId);
94
+ console.log(plan.productId);
95
+ console.log(plan.name);
96
+ console.log(plan.price);
97
+ console.log(plan.amount);
98
+ console.log(plan.period);
99
+ console.log(plan.hasIntroductoryPrice);
100
+ console.log(plan.introPrice);
101
+ console.log(plan.introAmount);
102
+ console.log(plan.introDuration);
103
+ }, (error) => {
104
+ console.log(error);
105
+ });
106
+
87
107
  Purchasely.setDefaultPresentationResultHandler(callback => {
88
108
  console.log(callback);
89
109
  if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
@@ -92,26 +112,56 @@ function onPuchaselySdkReady() {
92
112
  console.log("User purchased " + callback.plan.vendorId);
93
113
  }
94
114
  },
95
- (error) => {
115
+ (error) => {
96
116
  console.log("Error with purchase : " + error);
97
117
  });
98
118
 
99
- Purchasely.setLoginTappedHandler(onLoginTapped => {
100
- // Present your own screen for user to log in
101
-
102
- // Call this method to update Purchasely Paywall
103
- Purchasely.userLogin('my_user_id');
104
- Purchasely.onUserLoggedIn(true);
105
- });
106
-
107
- Purchasely.setConfirmPurchaseHandler(onPurchaseTapped => {
108
- // Present your own screen before purchase
119
+ Purchasely.setPaywallActionInterceptor((result) => {
120
+ console.log(result);
121
+ console.log('Received action from paywall ' + result.info.presentationId);
122
+
123
+ if (result.action === Purchasely.PaywallAction.navigate) {
124
+ console.log(
125
+ 'User wants to navigate to website ' +
126
+ result.parameters.title +
127
+ ' ' +
128
+ result.parameters.url
129
+ );
130
+ console.log('prevent Purchasely SDK to navigate to website');
131
+ Purchasely.onProcessAction(false);
132
+ } else if (result.action === Purchasely.PaywallAction.close) {
133
+ console.log('User wants to close paywall');
134
+ Purchasely.onProcessAction(true);
135
+ } else if (result.action === Purchasely.PaywallAction.login) {
136
+ console.log('User wants to login');
137
+ //Present your own screen for user to log in
138
+ Purchasely.closePaywall();
139
+ Purchasely.userLogin('MY_USER_ID');
140
+ //Call this method to update Purchasely Paywall
141
+ Purchasely.onProcessAction(true);
142
+ } else if (result.action === Purchasely.PaywallAction.open_presentation) {
143
+ console.log('User wants to open a new paywall');
144
+ Purchasely.onProcessAction(true);
145
+ } else if (result.action === Purchasely.PaywallAction.purchase) {
146
+ console.log('User wants to purchase');
147
+ //If you want to intercept it, close paywall and display your screen
148
+ Purchasely.closePaywall();
149
+ Purchasely.onProcessAction(true);
150
+ } else if (result.action === Purchasely.PaywallAction.restore) {
151
+ console.log('User wants to restore his purchases');
152
+ Purchasely.onProcessAction(true);
153
+ } else {
154
+ console.log('Action unknown ' + result.action);
155
+ Purchasely.onProcessAction(true);
156
+ }
109
157
  });
110
158
  }
111
159
 
112
160
  function openPresentation() {
113
161
  Purchasely.presentPresentationWithIdentifier(
114
162
  null,
163
+ null,
164
+ true,
115
165
  (callback) => {
116
166
  console.log(callback);
117
167
  if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
@@ -136,7 +186,7 @@ function purchaseWithPlanVendorId() {
136
186
 
137
187
  function processToPayment() {
138
188
  // Call this method to process to payment
139
- Purchasely.processToPayment(true);
189
+ Purchasely.onProcessAction(true);
140
190
  }
141
191
 
142
192
  function restore() {
@@ -151,6 +201,18 @@ function restore() {
151
201
  );
152
202
  }
153
203
 
204
+ function silentRestore() {
205
+ Purchasely.silentRestoreAllProducts(
206
+ (plan) => {
207
+ if(plan) console.log("Silent restore " + plan.vendorId);
208
+ else console.log("Nothing to restore");
209
+ },
210
+ (error) => {
211
+ console.log("Silent Restore failed " + error);
212
+ },
213
+ );
214
+ }
215
+
154
216
  function openDeeplink() {
155
217
  Purchasely.handle(
156
218
  "purchasely://ply/presentations/CAROUSEL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "1.1.7",
3
+ "version": "2.0.1",
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="1.1.7" 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="2.0.1" 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" />
@@ -28,7 +28,7 @@
28
28
  <source url="https://github.com/CocoaPods/Specs.git"/>
29
29
  </config>
30
30
  <pods use-frameworks="true">
31
- <pod name="Purchasely" spec="2.7.3"/>
31
+ <pod name="Purchasely" spec="3.0.0"/>
32
32
  </pods>
33
33
  </podspec>
34
34
  </platform>
@@ -51,10 +51,13 @@
51
51
  android:theme="@style/Theme.AppCompat.Light.NoActionBar">
52
52
  </activity>
53
53
  </config-file>
54
- <framework src="io.purchasely:core:2.7.4" />
54
+ <framework src="io.purchasely:core:3.0.1" />
55
55
  <source-file src="src/android/PurchaselyPlugin.java" target-dir="src/cordova/plugin/purchasely" />
56
56
  <source-file src="src/android/PLYProductActivity.java" target-dir="src/cordova/plugin/purchasely" />
57
57
  <source-file src="src/android/PLYSubscriptionsActivity.java" target-dir="src/cordova/plugin/purchasely" />
58
58
  <source-file src="src/android/activity_ply_product_activity.xml" target-dir="res/layout"/>
59
+ <source-file src="src/android/theme_purchasely_fullscreen.xml" target-dir="res/values"/>
60
+ <source-file src="src/android/theme_purchasely_fullscreen_v23_light_status_bar.xml" target-dir="res/values-v23"/>
61
+ <source-file src="src/android/theme_purchasely_fullscreen_v23.xml" target-dir="res/values-v23"/>
59
62
  </platform>
60
63
  </plugin>
@@ -4,12 +4,17 @@
4
4
  <option name="autoReloadType" value="NONE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="ad0a27bd-64f4-4852-98a1-a7dc8e28a72f" name="Default Changelist" comment="" />
7
+ <list default="true" id="ad0a27bd-64f4-4852-98a1-a7dc8e28a72f" name="Default Changelist" comment="">
8
+ <change beforePath="$PROJECT_DIR$/../../plugin.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../../plugin.xml" afterDir="false" />
9
+ </list>
8
10
  <option name="SHOW_DIALOG" value="false" />
9
11
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
12
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
13
  <option name="LAST_RESOLUTION" value="IGNORE" />
12
14
  </component>
15
+ <component name="Git.Settings">
16
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
17
+ </component>
13
18
  <component name="ProjectId" id="1uz33TZxRidCdjXlE00OtDvw6mD" />
14
19
  <component name="ProjectViewState">
15
20
  <option name="hideEmptyMiddlePackages" value="true" />
@@ -18,7 +23,9 @@
18
23
  <component name="PropertiesComponent">
19
24
  <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
20
25
  <property name="android.sdk.path" value="$USER_HOME$/Android/Sdk" />
26
+ <property name="dart.analysis.tool.window.visible" value="false" />
21
27
  <property name="last_opened_file_path" value="$PROJECT_DIR$" />
28
+ <property name="show.migrate.to.gradle.popup" value="false" />
22
29
  </component>
23
30
  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
24
31
  <component name="TaskManager">
@@ -31,4 +38,15 @@
31
38
  </task>
32
39
  <servers />
33
40
  </component>
41
+ <component name="Vcs.Log.Tabs.Properties">
42
+ <option name="TAB_STATES">
43
+ <map>
44
+ <entry key="MAIN">
45
+ <value>
46
+ <State />
47
+ </value>
48
+ </entry>
49
+ </map>
50
+ </option>
51
+ </component>
34
52
  </project>
@@ -6,6 +6,7 @@ import android.os.Bundle;
6
6
 
7
7
  import androidx.annotation.Nullable;
8
8
  import androidx.appcompat.app.AppCompatActivity;
9
+ import androidx.core.view.WindowCompat;
9
10
  import androidx.fragment.app.Fragment;
10
11
 
11
12
  import java.lang.ref.WeakReference;
@@ -18,6 +19,12 @@ public class PLYProductActivity extends AppCompatActivity {
18
19
  @Override
19
20
  protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
20
21
  super.onCreate(savedInstanceState);
22
+
23
+ boolean isFullScreen = getIntent().getExtras().getBoolean("isFullScreen");
24
+ if(isFullScreen) {
25
+ WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
26
+ }
27
+
21
28
  String package_name = getApplication().getPackageName();
22
29
  setContentView(getApplication().getResources()
23
30
  .getIdentifier("activity_ply_product_activity",
@@ -32,11 +39,16 @@ public class PLYProductActivity extends AppCompatActivity {
32
39
 
33
40
  Fragment fragment;
34
41
  if(planId != null && !planId.isEmpty()) {
35
- fragment = Purchasely.planFragment(planId, presentationId, contentId, listener);
42
+ fragment = Purchasely.planFragment(planId, presentationId, contentId, null, listener);
36
43
  } else if(productId != null && !productId.isEmpty()) {
37
- fragment = Purchasely.productFragment(productId, presentationId, contentId, listener);
44
+ fragment = Purchasely.productFragment(productId, presentationId, contentId, null, listener);
38
45
  } else {
39
- fragment = Purchasely.presentationFragment(presentationId, contentId, listener);
46
+ fragment = Purchasely.presentationFragment(presentationId, contentId, null, listener);
47
+ }
48
+
49
+ if(fragment == null) {
50
+ supportFinishAfterTransition();
51
+ return;
40
52
  }
41
53
 
42
54
  getSupportFragmentManager().beginTransaction()