@purchasely/cordova-plugin-purchasely 2.2.3 → 2.3.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.
@@ -9,15 +9,22 @@
9
9
  "version": "1.0.0",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "@purchasely/cordova-plugin-purchasely": "^2.2.2",
13
- "cordova-android": "^10.1.0",
12
+ "@purchasely/cordova-plugin-puchasely-google": "file:../../purchasely-google",
13
+ "cordova-android": "^11.0.0",
14
14
  "cordova-ios": "^6.2.0",
15
+ "cordova-plugin-puchasely-google": "file:../../purchasely-google",
15
16
  "cordova-plugin-purchasely": "file:.."
16
17
  }
17
18
  },
18
19
  "..": {
19
20
  "name": "cordova-plugin-purchasely",
20
- "version": "2.2.3",
21
+ "version": "2.3.1",
22
+ "dev": true,
23
+ "license": "ISC"
24
+ },
25
+ "../../purchasely-google": {
26
+ "name": "cordova-plugin-puchasely-google",
27
+ "version": "2.3.1",
21
28
  "dev": true,
22
29
  "license": "ISC"
23
30
  },
@@ -67,11 +74,9 @@
67
74
  "node": ">= 8"
68
75
  }
69
76
  },
70
- "node_modules/@purchasely/cordova-plugin-purchasely": {
71
- "version": "2.2.2",
72
- "resolved": "https://registry.npmjs.org/@purchasely/cordova-plugin-purchasely/-/cordova-plugin-purchasely-2.2.2.tgz",
73
- "integrity": "sha512-0d8Bfh2RKLU2D+kMiZ75SqeT3/5C3BaTFRFi6+cTKzrZcycjRW1nhHP1lvjoHXvaDDh9bxVMVKt2uCtTtE8xig==",
74
- "dev": true
77
+ "node_modules/@purchasely/cordova-plugin-puchasely-google": {
78
+ "resolved": "../../purchasely-google",
79
+ "link": true
75
80
  },
76
81
  "node_modules/abbrev": {
77
82
  "version": "1.1.1",
@@ -206,31 +211,31 @@
206
211
  "dev": true
207
212
  },
208
213
  "node_modules/cordova-android": {
209
- "version": "10.1.0",
210
- "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
211
- "integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
214
+ "version": "11.0.0",
215
+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-11.0.0.tgz",
216
+ "integrity": "sha512-ZhvSF5BYY8gmrAu1PtMPdHFsRoom/emT4OtTcecmh3Zj22900y4Golg5whhBPcYcTPC7BU6PG/EmG9BBHcX9tQ==",
212
217
  "dev": true,
213
218
  "dependencies": {
214
219
  "android-versions": "^1.7.0",
215
220
  "cordova-common": "^4.0.2",
216
221
  "execa": "^5.1.1",
217
- "fast-glob": "^3.2.7",
218
- "fs-extra": "^10.0.0",
222
+ "fast-glob": "^3.2.11",
223
+ "fs-extra": "^10.1.0",
219
224
  "is-path-inside": "^3.0.3",
220
225
  "nopt": "^5.0.0",
221
226
  "properties-parser": "^0.3.1",
222
- "semver": "^7.3.5",
227
+ "semver": "^7.3.7",
223
228
  "untildify": "^4.0.0",
224
229
  "which": "^2.0.2"
225
230
  },
226
231
  "engines": {
227
- "node": ">=12.0.0"
232
+ "node": ">=14.0.0"
228
233
  }
229
234
  },
230
235
  "node_modules/cordova-android/node_modules/fs-extra": {
231
- "version": "10.0.1",
232
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
233
- "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
236
+ "version": "10.1.0",
237
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
238
+ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
234
239
  "dev": true,
235
240
  "dependencies": {
236
241
  "graceful-fs": "^4.2.0",
@@ -287,6 +292,10 @@
287
292
  "node": ">=10"
288
293
  }
289
294
  },
295
+ "node_modules/cordova-plugin-puchasely-google": {
296
+ "resolved": "../../purchasely-google",
297
+ "link": true
298
+ },
290
299
  "node_modules/cordova-plugin-purchasely": {
291
300
  "resolved": "..",
292
301
  "link": true
@@ -367,9 +376,9 @@
367
376
  ]
368
377
  },
369
378
  "node_modules/fast-glob": {
370
- "version": "3.2.7",
371
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
372
- "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
379
+ "version": "3.2.11",
380
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
381
+ "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
373
382
  "dev": true,
374
383
  "dependencies": {
375
384
  "@nodelib/fs.stat": "^2.0.2",
@@ -379,7 +388,7 @@
379
388
  "micromatch": "^4.0.4"
380
389
  },
381
390
  "engines": {
382
- "node": ">=8"
391
+ "node": ">=8.6.0"
383
392
  }
384
393
  },
385
394
  "node_modules/fast-json-parse": {
@@ -572,9 +581,9 @@
572
581
  }
573
582
  },
574
583
  "node_modules/is-core-module": {
575
- "version": "2.9.0",
576
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
577
- "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
584
+ "version": "2.10.0",
585
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
586
+ "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
578
587
  "dev": true,
579
588
  "dependencies": {
580
589
  "has": "^1.0.3"
@@ -855,7 +864,7 @@
855
864
  "node_modules/properties-parser": {
856
865
  "version": "0.3.1",
857
866
  "resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",
858
- "integrity": "sha1-ExbpU5/7/ZOEXjabIRAiq9R4dxo=",
867
+ "integrity": "sha512-AkSQxQAviJ89x4FIxOyHGfO3uund0gvYo7lfD0E+Gp7gFQKrTNgtoYQklu8EhrfHVZUzTwKGZx2r/KDSfnljcA==",
859
868
  "dev": true,
860
869
  "dependencies": {
861
870
  "string.prototype.codepointat": "^0.2.0"
@@ -920,12 +929,12 @@
920
929
  }
921
930
  },
922
931
  "node_modules/resolve": {
923
- "version": "1.22.0",
924
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
925
- "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
932
+ "version": "1.22.1",
933
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
934
+ "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
926
935
  "dev": true,
927
936
  "dependencies": {
928
- "is-core-module": "^2.8.1",
937
+ "is-core-module": "^2.9.0",
929
938
  "path-parse": "^1.0.7",
930
939
  "supports-preserve-symlinks-flag": "^1.0.0"
931
940
  },
@@ -976,9 +985,9 @@
976
985
  "dev": true
977
986
  },
978
987
  "node_modules/semver": {
979
- "version": "7.3.5",
980
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
981
- "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
988
+ "version": "7.3.7",
989
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
990
+ "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
982
991
  "dev": true,
983
992
  "dependencies": {
984
993
  "lru-cache": "^6.0.0"
@@ -1283,11 +1292,8 @@
1283
1292
  "fastq": "^1.6.0"
1284
1293
  }
1285
1294
  },
1286
- "@purchasely/cordova-plugin-purchasely": {
1287
- "version": "2.2.2",
1288
- "resolved": "https://registry.npmjs.org/@purchasely/cordova-plugin-purchasely/-/cordova-plugin-purchasely-2.2.2.tgz",
1289
- "integrity": "sha512-0d8Bfh2RKLU2D+kMiZ75SqeT3/5C3BaTFRFi6+cTKzrZcycjRW1nhHP1lvjoHXvaDDh9bxVMVKt2uCtTtE8xig==",
1290
- "dev": true
1295
+ "@purchasely/cordova-plugin-puchasely-google": {
1296
+ "version": "file:../../purchasely-google"
1291
1297
  },
1292
1298
  "abbrev": {
1293
1299
  "version": "1.1.1",
@@ -1392,28 +1398,28 @@
1392
1398
  "dev": true
1393
1399
  },
1394
1400
  "cordova-android": {
1395
- "version": "10.1.0",
1396
- "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-10.1.0.tgz",
1397
- "integrity": "sha512-nkVh8VMDWoDmvWaQav/sF3Q7N9ZpRRNBJduDhjCOMwYUF/6q2526i/Jb/wJLdXmetBNh+THkGolcTBi9i+1UzA==",
1401
+ "version": "11.0.0",
1402
+ "resolved": "https://registry.npmjs.org/cordova-android/-/cordova-android-11.0.0.tgz",
1403
+ "integrity": "sha512-ZhvSF5BYY8gmrAu1PtMPdHFsRoom/emT4OtTcecmh3Zj22900y4Golg5whhBPcYcTPC7BU6PG/EmG9BBHcX9tQ==",
1398
1404
  "dev": true,
1399
1405
  "requires": {
1400
1406
  "android-versions": "^1.7.0",
1401
1407
  "cordova-common": "^4.0.2",
1402
1408
  "execa": "^5.1.1",
1403
- "fast-glob": "^3.2.7",
1404
- "fs-extra": "^10.0.0",
1409
+ "fast-glob": "^3.2.11",
1410
+ "fs-extra": "^10.1.0",
1405
1411
  "is-path-inside": "^3.0.3",
1406
1412
  "nopt": "^5.0.0",
1407
1413
  "properties-parser": "^0.3.1",
1408
- "semver": "^7.3.5",
1414
+ "semver": "^7.3.7",
1409
1415
  "untildify": "^4.0.0",
1410
1416
  "which": "^2.0.2"
1411
1417
  },
1412
1418
  "dependencies": {
1413
1419
  "fs-extra": {
1414
- "version": "10.0.1",
1415
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
1416
- "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
1420
+ "version": "10.1.0",
1421
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz",
1422
+ "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==",
1417
1423
  "dev": true,
1418
1424
  "requires": {
1419
1425
  "graceful-fs": "^4.2.0",
@@ -1463,6 +1469,9 @@
1463
1469
  "xml-escape": "^1.1.0"
1464
1470
  }
1465
1471
  },
1472
+ "cordova-plugin-puchasely-google": {
1473
+ "version": "file:../../purchasely-google"
1474
+ },
1466
1475
  "cordova-plugin-purchasely": {
1467
1476
  "version": "file:.."
1468
1477
  },
@@ -1527,9 +1536,9 @@
1527
1536
  "dev": true
1528
1537
  },
1529
1538
  "fast-glob": {
1530
- "version": "3.2.7",
1531
- "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz",
1532
- "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==",
1539
+ "version": "3.2.11",
1540
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
1541
+ "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
1533
1542
  "dev": true,
1534
1543
  "requires": {
1535
1544
  "@nodelib/fs.stat": "^2.0.2",
@@ -1689,9 +1698,9 @@
1689
1698
  }
1690
1699
  },
1691
1700
  "is-core-module": {
1692
- "version": "2.9.0",
1693
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
1694
- "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
1701
+ "version": "2.10.0",
1702
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
1703
+ "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
1695
1704
  "dev": true,
1696
1705
  "requires": {
1697
1706
  "has": "^1.0.3"
@@ -1895,7 +1904,7 @@
1895
1904
  "properties-parser": {
1896
1905
  "version": "0.3.1",
1897
1906
  "resolved": "https://registry.npmjs.org/properties-parser/-/properties-parser-0.3.1.tgz",
1898
- "integrity": "sha1-ExbpU5/7/ZOEXjabIRAiq9R4dxo=",
1907
+ "integrity": "sha512-AkSQxQAviJ89x4FIxOyHGfO3uund0gvYo7lfD0E+Gp7gFQKrTNgtoYQklu8EhrfHVZUzTwKGZx2r/KDSfnljcA==",
1899
1908
  "dev": true,
1900
1909
  "requires": {
1901
1910
  "string.prototype.codepointat": "^0.2.0"
@@ -1933,12 +1942,12 @@
1933
1942
  }
1934
1943
  },
1935
1944
  "resolve": {
1936
- "version": "1.22.0",
1937
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
1938
- "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
1945
+ "version": "1.22.1",
1946
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
1947
+ "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
1939
1948
  "dev": true,
1940
1949
  "requires": {
1941
- "is-core-module": "^2.8.1",
1950
+ "is-core-module": "^2.9.0",
1942
1951
  "path-parse": "^1.0.7",
1943
1952
  "supports-preserve-symlinks-flag": "^1.0.0"
1944
1953
  }
@@ -1965,9 +1974,9 @@
1965
1974
  "dev": true
1966
1975
  },
1967
1976
  "semver": {
1968
- "version": "7.3.5",
1969
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
1970
- "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
1977
+ "version": "7.3.7",
1978
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
1979
+ "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
1971
1980
  "dev": true,
1972
1981
  "requires": {
1973
1982
  "lru-cache": "^6.0.0"
@@ -13,18 +13,20 @@
13
13
  "author": "Apache Cordova Team",
14
14
  "license": "Apache-2.0",
15
15
  "devDependencies": {
16
- "@purchasely/cordova-plugin-purchasely": "^2.2.2",
17
- "cordova-android": "^10.1.0",
16
+ "@purchasely/cordova-plugin-puchasely-google": "file:../../purchasely-google",
17
+ "cordova-android": "^11.0.0",
18
18
  "cordova-ios": "^6.2.0",
19
+ "cordova-plugin-puchasely-google": "file:../../purchasely-google",
19
20
  "cordova-plugin-purchasely": "file:.."
20
21
  },
21
22
  "cordova": {
22
23
  "plugins": {
23
- "@purchasely/cordova-plugin-purchasely": {},
24
- "cordova-plugin-purchasely": {}
24
+ "cordova-plugin-puchasely-google": {},
25
+ "@purchasely/cordova-plugin-puchasely-google": {}
25
26
  },
26
27
  "platforms": [
27
- "android"
28
+ "android",
29
+ "ios"
28
30
  ]
29
31
  }
30
- }
32
+ }
@@ -27,10 +27,12 @@ function onDeviceReady() {
27
27
  console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
28
28
  document.getElementById('deviceready').classList.add('ready');
29
29
 
30
- Purchasely.setLanguage('en')
30
+ Purchasely.setLanguage('en');
31
+
32
+ Purchasely.userDidConsumeSubscriptionContent();
31
33
 
32
34
  Purchasely.startWithAPIKey(
33
- 'afa96c76-1d8e-4e3c-a48f-204a3cd93a15',
35
+ 'fcb39be4-2ba4-4db7-bde3-2a5a1e20745d',
34
36
  ['Google'],
35
37
  null,
36
38
  Purchasely.LogLevel.DEBUG,
@@ -98,6 +100,7 @@ function onPuchaselySdkReady() {
98
100
  console.log(plan.introPrice);
99
101
  console.log(plan.introAmount);
100
102
  console.log(plan.introDuration);
103
+ console.log('Eligible for intro offer ? ' + plan.isEligibleForIntroOffer);
101
104
  }, (error) => {
102
105
  console.log(error);
103
106
  });
@@ -126,7 +129,7 @@ function onPuchaselySdkReady() {
126
129
  result.parameters.url
127
130
  );
128
131
  console.log('prevent Purchasely SDK to navigate to website');
129
- Purchasely.onProcessAction(false);
132
+ Purchasely.onProcessAction(true);
130
133
  } else if (result.action === Purchasely.PaywallAction.close) {
131
134
  console.log('User wants to close paywall');
132
135
  Purchasely.onProcessAction(true);
@@ -144,7 +147,6 @@ function onPuchaselySdkReady() {
144
147
  console.log('User wants to purchase');
145
148
  //If you want to intercept it, close paywall and display your screen
146
149
  Purchasely.closePaywall();
147
- Purchasely.onProcessAction(true);
148
150
  } else if (result.action === Purchasely.PaywallAction.restore) {
149
151
  console.log('User wants to restore his purchases');
150
152
  Purchasely.onProcessAction(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "2.2.3",
3
+ "version": "2.3.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="2.2.2" 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.3.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" />
@@ -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="3.2.3"/>
31
+ <pod name="Purchasely" spec="3.3.3"/>
32
32
  </pods>
33
33
  </podspec>
34
34
  </platform>
@@ -51,7 +51,7 @@
51
51
  android:theme="@style/Theme.AppCompat.Light.NoActionBar">
52
52
  </activity>
53
53
  </config-file>
54
- <framework src="io.purchasely:core:3.2.1" />
54
+ <framework src="io.purchasely:core:3.3.3" />
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" />
@@ -59,7 +59,8 @@ public class PurchaselyPlugin extends CordovaPlugin {
59
59
  static CallbackContext eventsCallback = null;
60
60
  static ProductActivity productActivity = null;
61
61
 
62
- private PLYProcessActionListener processActionListener;
62
+ @Nullable private PLYProcessActionListener processActionListener;
63
+ @Nullable private PLYPresentationAction paywallAction;
63
64
 
64
65
  private static int runningModeTransactionOnly = 0;
65
66
  private static int runningModeObserver = 1;
@@ -194,6 +195,9 @@ public class PurchaselyPlugin extends CordovaPlugin {
194
195
  case "closePaywall":
195
196
  closePaywall(callbackContext);
196
197
  break;
198
+ case "userDidConsumeSubscriptionContent":
199
+ userDidConsumeSubscriptionContent();
200
+ break;
197
201
  default:
198
202
  return false;
199
203
  }
@@ -397,6 +401,10 @@ public class PurchaselyPlugin extends CordovaPlugin {
397
401
  Purchasely.synchronize();
398
402
  }
399
403
 
404
+ private void userDidConsumeSubscriptionContent() {
405
+ Purchasely.userDidConsumeSubscriptionContent();
406
+ }
407
+
400
408
  private void presentPresentationWithIdentifier(String presentationVendorId,
401
409
  String contentId,
402
410
  boolean isFullScreen,
@@ -586,6 +594,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
586
594
  Purchasely.setPaywallActionsInterceptor(
587
595
  (info, plyPresentationAction, map, plyProcessActionListener) -> {
588
596
  processActionListener = plyProcessActionListener;
597
+ paywallAction = plyPresentationAction;
589
598
 
590
599
  String url = null;
591
600
  if(map.getUrl() != null) {
@@ -620,7 +629,10 @@ public class PurchaselyPlugin extends CordovaPlugin {
620
629
  }
621
630
 
622
631
  private void closePaywall(CallbackContext callbackContext) {
623
- Activity purchaselyActivity = productActivity.activity.get();
632
+ Activity purchaselyActivity = null;
633
+ if(productActivity != null && productActivity.activity != null) {
634
+ purchaselyActivity = productActivity.activity.get();
635
+ }
624
636
  Activity activity = purchaselyActivity != null ? purchaselyActivity : cordova.getActivity();
625
637
  Intent intent = new Intent(activity, cordova.getActivity().getClass());
626
638
  intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
@@ -628,24 +640,40 @@ public class PurchaselyPlugin extends CordovaPlugin {
628
640
  }
629
641
 
630
642
  private void onProcessAction(boolean processAction) {
631
- if(processActionListener != null) {
632
- if(productActivity != null) {
633
- boolean softRelaunched = productActivity.relaunch(cordova);
634
- if(softRelaunched) {
643
+ if(processActionListener == null) return;
644
+
645
+ PLYPresentationAction action = PLYPresentationAction.CLOSE;
646
+ if(paywallAction != null) action = paywallAction;
647
+
648
+ switch (action) {
649
+ case PROMO_CODE:
650
+ case RESTORE:
651
+ case PURCHASE:
652
+ case LOGIN:
653
+ case OPEN_PRESENTATION:
654
+ processActionWithPaywallActivity(processAction);
655
+ break;
656
+ default:
657
+ cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
658
+ }
659
+ }
660
+
661
+ private void processActionWithPaywallActivity(boolean processAction) {
662
+ if(processActionListener == null) return;
663
+
664
+ boolean softRelaunched = productActivity != null && productActivity.relaunch(cordova);
665
+ if(softRelaunched) {
666
+ cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
667
+ } else {
668
+ new Thread(() -> {
669
+ try {
670
+ Thread.sleep(500);
671
+ } catch (InterruptedException e) {
672
+ Log.e("Purchasely", "process action error", e);
673
+ } finally {
635
674
  cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
636
- } else {
637
- new Thread(() -> {
638
- try {
639
- Thread.sleep(500);
640
- } catch (InterruptedException e) {
641
- Log.e("Purchasely", "process action error", e);
642
- } finally {
643
- cordova.getActivity().runOnUiThread(() -> processActionListener.processAction(processAction));
644
- }
645
- }).start();
646
675
  }
647
-
648
- }
676
+ }).start();
649
677
  }
650
678
  }
651
679
 
@@ -664,6 +692,8 @@ public class PurchaselyPlugin extends CordovaPlugin {
664
692
  } else if(plan.getType() == DistributionType.UNKNOWN) {
665
693
  map.put("type", DistributionType.UNKNOWN.ordinal());
666
694
  }
695
+
696
+ map.put("isEligibleForIntroOffer", plan.isEligibleToIntroOffer());
667
697
  return map;
668
698
  }
669
699
 
@@ -673,10 +703,15 @@ public class PurchaselyPlugin extends CordovaPlugin {
673
703
  String productId = null;
674
704
  String planId = null;
675
705
  String contentId = null;
676
- WeakReference<PLYProductActivity> activity = null;
706
+ @Nullable WeakReference<PLYProductActivity> activity = null;
677
707
 
678
708
  public boolean relaunch(CordovaInterface cordova) {
679
- PLYProductActivity backgroundActivity = activity.get();
709
+ PLYProductActivity backgroundActivity = null;
710
+
711
+ if(activity != null) {
712
+ backgroundActivity = activity.get();
713
+ }
714
+
680
715
  if(backgroundActivity != null
681
716
  && !backgroundActivity.isFinishing()
682
717
  && !backgroundActivity.isDestroyed()) {
@@ -47,5 +47,6 @@
47
47
  - (void)setPaywallActionInterceptor:(CDVInvokedUrlCommand*)command;
48
48
  - (void)onProcessAction:(CDVInvokedUrlCommand*)command;
49
49
  - (void)closePaywall:(CDVInvokedUrlCommand*)command;
50
+ - (void)userDidConsumeSubscriptionContent:(CDVInvokedUrlCommand*)command;
50
51
 
51
52
  @end
@@ -442,6 +442,10 @@
442
442
  }
443
443
  }
444
444
 
445
+ - (void)userDidConsumeSubscriptionContent:(CDVInvokedUrlCommand*)command {
446
+ [Purchasely userDidConsumeSubscriptionContent];
447
+ }
448
+
445
449
  - (void)successFor:(CDVInvokedUrlCommand *)command {
446
450
  CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
447
451
  [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
@@ -15,6 +15,7 @@
15
15
  [dict setObject:self.vendorId forKey:@"vendorId"];
16
16
  [dict setObject:@(self.hasIntroductoryPrice) forKey:@"hasIntroductoryPrice"];
17
17
  [dict setObject:@([self type]) forKey:@"type"];
18
+ [dict setObject:@([self isEligibleForIntroOffer]) forKey:@"isEligibleForIntroOffer"];
18
19
 
19
20
  if (self.hasIntroductoryPrice && [[self introAmount] intValue] == 0) {
20
21
  [dict setObject:@(YES) forKey:@"hasFreeTrial"];
package/www/Purchasely.js CHANGED
@@ -5,7 +5,7 @@ var defaultError = (e) => { console.log(e); }
5
5
  exports.startWithAPIKey = function (apiKey, stores, 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 = "2.2.0" //fallback if we cannot find version from metadata
8
+ cordovaSdkVersion = "2.3.0" //fallback if we cannot find version from metadata
9
9
  }
10
10
  exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel, runningMode, cordovaSdkVersion]);
11
11
  };
@@ -118,6 +118,10 @@ exports.closePaywall = function () {
118
118
  exec(() => {}, defaultError, 'Purchasely', 'closePaywall', []);
119
119
  };
120
120
 
121
+ exports.userDidConsumeSubscriptionContent = function () {
122
+ exec(() => {}, defaultError, 'Purchasely', 'userDidConsumeSubscriptionContent', []);
123
+ };
124
+
121
125
  exports.userSubscriptions = function (success, error) {
122
126
  exec(success, defaultError, 'Purchasely', 'userSubscriptions', []);
123
127
  };
@@ -134,15 +138,19 @@ exports.LogLevel = {
134
138
  }
135
139
 
136
140
  exports.Attribute = {
137
- AMPLITUDE_SESSION_ID: 0,
138
- FIREBASE_APP_INSTANCE_ID: 1,
139
- AIRSHIP_CHANNEL_ID: 2,
141
+ AMPLITUDE_SESSION_ID: 0,
142
+ FIREBASE_APP_INSTANCE_ID: 1,
143
+ AIRSHIP_CHANNEL_ID: 2,
140
144
  BATCH_INSTALLATION_ID: 3,
141
145
  ADJUST_ID: 4,
142
146
  APPSFLYER_ID: 5,
143
147
  ONESIGNAL_PLAYER_ID: 6,
144
148
  MIXPANEL_DISTINCT_ID: 7,
145
- CLEVER_TAP_ID: 8
149
+ CLEVER_TAP_ID: 8,
150
+ SENDINBLUE_USER_EMAIL: 9,
151
+ ITERABLE_USER_ID: 10,
152
+ ITERABLE_USER_EMAIL: 11,
153
+ AT_INTERNET_ID_CLIENT: 12
146
154
  }
147
155
 
148
156
  exports.PurchaseResult = {
package/INTERNAL DELETED
@@ -1,33 +0,0 @@
1
- # Purchasely-Cordova-Sources
2
-
3
- ## Add plugin :
4
-
5
- `cd example/`
6
-
7
- `cordova plugin add /home/kevin/Documents/Purchasely/Cordova/Purchasely --link`
8
-
9
-
10
- ## Add android platform :
11
-
12
- `cd example/`
13
-
14
- `cordova platform add android`
15
-
16
- `cordova run android`
17
-
18
- ### Add Google-Play dependencies
19
-
20
- In folder `example/platforms/android/app` create a file called `build-extras.gradle` and add thoses lines :
21
- ```groovy
22
- dependencies {
23
- implementation "io.purchasely:google-play:2.5.5"
24
- }
25
- ```
26
-
27
- ### Troubleshot
28
-
29
- `cd example/`
30
-
31
- `cordova platform remove android`
32
-
33
- `cordova plugin remove cordova-plugin-purchasely`
package/VERSIONS.md DELETED
@@ -1,24 +0,0 @@
1
- This file provides the underlying native SDK versions that the Cordova SDK relies on.
2
-
3
- | Version | iOS version | Android version |
4
- |---------|-------------|-----------------|
5
- | 1.0.2 | 2.5.3 | 2.5.4 |
6
- | 1.0.3 | 2.5.5 | 2.5.5 |
7
- | 1.0.4 | 2.5.5 | 2.5.6 |
8
- | 1.0.5 | 2.6.0 | 2.5.6 |
9
- | 1.1.0 | 2.7.2 | 2.7.2 |
10
- | 1.1.1 | 2.7.3 | 2.7.2 |
11
- | 1.1.2 | 2.7.3 | 2.7.2 |
12
- | 1.1.3 | 2.7.3 | 2.7.2 |
13
- | 1.1.6 | 2.7.3 | 2.7.3 |
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 |
19
- | 2.1.0 | 3.1.0 | 3.1.0 |
20
- | 2.1.1 | 3.1.0 | 3.1.0 |
21
- | 2.2.0 | 3.2.0 | 3.2.0 |
22
- | 2.2.1 | 3.2.1 | 3.2.1 |
23
- | 2.2.2 | 3.2.2 | 3.2.2 |
24
- | 2.2.3 | 3.2.3 | 3.2.2 |