@purchasely/cordova-plugin-purchasely 2.1.1 → 2.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.
package/VERSIONS.md CHANGED
@@ -17,4 +17,7 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
17
17
  | 2.0.0 | 3.0.0 | 3.0.1 |
18
18
  | 2.0.1 | 3.0.0 | 3.0.1 |
19
19
  | 2.1.0 | 3.1.0 | 3.1.0 |
20
- | 2.1.1 | 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 |
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <widget id="io.purchasely.sample" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
2
+ <widget id="com.purchasely.demo" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3
3
  <name>HelloCordova</name>
4
4
  <description>
5
5
  A sample Apache Cordova application that responds to the deviceready event.
@@ -9,16 +9,14 @@
9
9
  "version": "1.0.0",
10
10
  "license": "Apache-2.0",
11
11
  "devDependencies": {
12
- "@purchasely/cordova-plugin-purchasely": "file:..",
13
12
  "cordova-android": "^10.1.0",
14
13
  "cordova-ios": "^6.2.0",
15
- "cordova-plugin-purchasely": "file:..",
16
- "cordova-plugin-whitelist": "^1.3.5"
14
+ "cordova-plugin-purchasely": "file:.."
17
15
  }
18
16
  },
19
17
  "..": {
20
18
  "name": "cordova-plugin-purchasely",
21
- "version": "2.0.1",
19
+ "version": "2.2.1",
22
20
  "dev": true,
23
21
  "license": "ISC"
24
22
  },
@@ -68,10 +66,6 @@
68
66
  "node": ">= 8"
69
67
  }
70
68
  },
71
- "node_modules/@purchasely/cordova-plugin-purchasely": {
72
- "resolved": "..",
73
- "link": true
74
- },
75
69
  "node_modules/abbrev": {
76
70
  "version": "1.1.1",
77
71
  "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -227,9 +221,9 @@
227
221
  }
228
222
  },
229
223
  "node_modules/cordova-android/node_modules/fs-extra": {
230
- "version": "10.0.0",
231
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
232
- "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
224
+ "version": "10.0.1",
225
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
226
+ "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
233
227
  "dev": true,
234
228
  "dependencies": {
235
229
  "graceful-fs": "^4.2.0",
@@ -290,22 +284,6 @@
290
284
  "resolved": "..",
291
285
  "link": true
292
286
  },
293
- "node_modules/cordova-plugin-whitelist": {
294
- "version": "1.3.5",
295
- "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
296
- "integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA==",
297
- "dev": true,
298
- "engines": {
299
- "cordovaDependencies": {
300
- "0.0.0": {
301
- "cordova-android": ">=4.0.0"
302
- },
303
- "1.3.5": {
304
- "cordova-android": ">=4.0.0 <10.0.0"
305
- }
306
- }
307
- }
308
- },
309
287
  "node_modules/cross-spawn": {
310
288
  "version": "7.0.3",
311
289
  "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -568,7 +546,7 @@
568
546
  "node_modules/ios-sim/node_modules/bplist-parser": {
569
547
  "version": "0.0.6",
570
548
  "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
571
- "integrity": "sha1-ONo0cYF9+dRKs4kuJ3B7u9daEbk=",
549
+ "integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
572
550
  "dev": true
573
551
  },
574
552
  "node_modules/ios-sim/node_modules/nopt": {
@@ -587,9 +565,9 @@
587
565
  }
588
566
  },
589
567
  "node_modules/is-core-module": {
590
- "version": "2.8.1",
591
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
592
- "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
568
+ "version": "2.9.0",
569
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
570
+ "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
593
571
  "dev": true,
594
572
  "dependencies": {
595
573
  "has": "^1.0.3"
@@ -855,9 +833,9 @@
855
833
  }
856
834
  },
857
835
  "node_modules/plist": {
858
- "version": "3.0.4",
859
- "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
860
- "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
836
+ "version": "3.0.5",
837
+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz",
838
+ "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==",
861
839
  "dev": true,
862
840
  "dependencies": {
863
841
  "base64-js": "^1.5.1",
@@ -1044,15 +1022,15 @@
1044
1022
  }
1045
1023
  },
1046
1024
  "node_modules/signal-exit": {
1047
- "version": "3.0.6",
1048
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
1049
- "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
1025
+ "version": "3.0.7",
1026
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
1027
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
1050
1028
  "dev": true
1051
1029
  },
1052
1030
  "node_modules/simctl": {
1053
- "version": "2.0.1",
1054
- "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.1.tgz",
1055
- "integrity": "sha512-RVZ/iLCI/rRmo8JKwtKjtWDzZFp+wOxI8L6+ux8UMPCC4LuujwrT4S7U3Y7eQKa8mHup3HSZoPzLrr1CR9Dttg==",
1031
+ "version": "2.0.3",
1032
+ "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.3.tgz",
1033
+ "integrity": "sha512-kKCak0yszxHae5eVWcmrjV3ouUGac3sjlhjdLWpyPu4eiQcWoHsCrqS34kkgzHN8Ystqkh/LFjzrldk/g3BYJg==",
1056
1034
  "dev": true,
1057
1035
  "dependencies": {
1058
1036
  "shelljs": "^0.8.5",
@@ -1060,20 +1038,20 @@
1060
1038
  }
1061
1039
  },
1062
1040
  "node_modules/simple-plist": {
1063
- "version": "1.3.0",
1064
- "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
1065
- "integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
1041
+ "version": "1.3.1",
1042
+ "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz",
1043
+ "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==",
1066
1044
  "dev": true,
1067
1045
  "dependencies": {
1068
1046
  "bplist-creator": "0.1.0",
1069
- "bplist-parser": "0.3.0",
1070
- "plist": "^3.0.4"
1047
+ "bplist-parser": "0.3.1",
1048
+ "plist": "^3.0.5"
1071
1049
  }
1072
1050
  },
1073
1051
  "node_modules/simple-plist/node_modules/bplist-parser": {
1074
- "version": "0.3.0",
1075
- "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
1076
- "integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
1052
+ "version": "0.3.1",
1053
+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz",
1054
+ "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==",
1077
1055
  "dev": true,
1078
1056
  "dependencies": {
1079
1057
  "big-integer": "1.6.x"
@@ -1298,9 +1276,6 @@
1298
1276
  "fastq": "^1.6.0"
1299
1277
  }
1300
1278
  },
1301
- "@purchasely/cordova-plugin-purchasely": {
1302
- "version": "file:.."
1303
- },
1304
1279
  "abbrev": {
1305
1280
  "version": "1.1.1",
1306
1281
  "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
@@ -1423,9 +1398,9 @@
1423
1398
  },
1424
1399
  "dependencies": {
1425
1400
  "fs-extra": {
1426
- "version": "10.0.0",
1427
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
1428
- "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
1401
+ "version": "10.0.1",
1402
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
1403
+ "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
1429
1404
  "dev": true,
1430
1405
  "requires": {
1431
1406
  "graceful-fs": "^4.2.0",
@@ -1478,12 +1453,6 @@
1478
1453
  "cordova-plugin-purchasely": {
1479
1454
  "version": "file:.."
1480
1455
  },
1481
- "cordova-plugin-whitelist": {
1482
- "version": "1.3.5",
1483
- "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.5.tgz",
1484
- "integrity": "sha512-+v/VzCYBdGsIxJTP2m+RWaq7l/NLu7b976w6XGJUFiN2TVOeaGrytaR4jRy0w9akRai8uKFeBmuGHmlS/sOeCA==",
1485
- "dev": true
1486
- },
1487
1456
  "cross-spawn": {
1488
1457
  "version": "7.0.3",
1489
1458
  "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -1692,7 +1661,7 @@
1692
1661
  "bplist-parser": {
1693
1662
  "version": "0.0.6",
1694
1663
  "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz",
1695
- "integrity": "sha1-ONo0cYF9+dRKs4kuJ3B7u9daEbk=",
1664
+ "integrity": "sha512-fGeghPEH4Eytvf+Mi446aKcDqvkA/+eh6r7QGiZWMQG6TzqrnsToLP379XFfqRSZ41+676hhGIm++maNST1Apw==",
1696
1665
  "dev": true
1697
1666
  },
1698
1667
  "nopt": {
@@ -1707,9 +1676,9 @@
1707
1676
  }
1708
1677
  },
1709
1678
  "is-core-module": {
1710
- "version": "2.8.1",
1711
- "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
1712
- "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
1679
+ "version": "2.9.0",
1680
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
1681
+ "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
1713
1682
  "dev": true,
1714
1683
  "requires": {
1715
1684
  "has": "^1.0.3"
@@ -1901,9 +1870,9 @@
1901
1870
  "dev": true
1902
1871
  },
1903
1872
  "plist": {
1904
- "version": "3.0.4",
1905
- "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.4.tgz",
1906
- "integrity": "sha512-ksrr8y9+nXOxQB2osVNqrgvX/XQPOXaU4BQMKjYq8PvaY1U18mo+fKgBSwzK+luSyinOuPae956lSVcBwxlAMg==",
1873
+ "version": "3.0.5",
1874
+ "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz",
1875
+ "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==",
1907
1876
  "dev": true,
1908
1877
  "requires": {
1909
1878
  "base64-js": "^1.5.1",
@@ -2018,15 +1987,15 @@
2018
1987
  }
2019
1988
  },
2020
1989
  "signal-exit": {
2021
- "version": "3.0.6",
2022
- "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz",
2023
- "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==",
1990
+ "version": "3.0.7",
1991
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
1992
+ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
2024
1993
  "dev": true
2025
1994
  },
2026
1995
  "simctl": {
2027
- "version": "2.0.1",
2028
- "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.1.tgz",
2029
- "integrity": "sha512-RVZ/iLCI/rRmo8JKwtKjtWDzZFp+wOxI8L6+ux8UMPCC4LuujwrT4S7U3Y7eQKa8mHup3HSZoPzLrr1CR9Dttg==",
1996
+ "version": "2.0.3",
1997
+ "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.3.tgz",
1998
+ "integrity": "sha512-kKCak0yszxHae5eVWcmrjV3ouUGac3sjlhjdLWpyPu4eiQcWoHsCrqS34kkgzHN8Ystqkh/LFjzrldk/g3BYJg==",
2030
1999
  "dev": true,
2031
2000
  "requires": {
2032
2001
  "shelljs": "^0.8.5",
@@ -2034,20 +2003,20 @@
2034
2003
  }
2035
2004
  },
2036
2005
  "simple-plist": {
2037
- "version": "1.3.0",
2038
- "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.0.tgz",
2039
- "integrity": "sha512-uYWpeGFtZtVt2NhG4AHgpwx323zxD85x42heMJBan1qAiqqozIlaGrwrEt6kRjXWRWIXsuV1VLCvVmZan2B5dg==",
2006
+ "version": "1.3.1",
2007
+ "resolved": "https://registry.npmjs.org/simple-plist/-/simple-plist-1.3.1.tgz",
2008
+ "integrity": "sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw==",
2040
2009
  "dev": true,
2041
2010
  "requires": {
2042
2011
  "bplist-creator": "0.1.0",
2043
- "bplist-parser": "0.3.0",
2044
- "plist": "^3.0.4"
2012
+ "bplist-parser": "0.3.1",
2013
+ "plist": "^3.0.5"
2045
2014
  },
2046
2015
  "dependencies": {
2047
2016
  "bplist-parser": {
2048
- "version": "0.3.0",
2049
- "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.0.tgz",
2050
- "integrity": "sha512-zgmaRvT6AN1JpPPV+S0a1/FAtoxSreYDccZGIqEMSvZl9DMe70mJ7MFzpxa1X+gHVdkToE2haRUHHMiW1OdejA==",
2017
+ "version": "0.3.1",
2018
+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.1.tgz",
2019
+ "integrity": "sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA==",
2051
2020
  "dev": true,
2052
2021
  "requires": {
2053
2022
  "big-integer": "1.6.x"
@@ -13,15 +13,12 @@
13
13
  "author": "Apache Cordova Team",
14
14
  "license": "Apache-2.0",
15
15
  "devDependencies": {
16
- "@purchasely/cordova-plugin-purchasely": "file:..",
17
16
  "cordova-android": "^10.1.0",
18
17
  "cordova-ios": "^6.2.0",
19
- "cordova-plugin-purchasely": "file:..",
20
- "cordova-plugin-whitelist": "^1.3.5"
18
+ "cordova-plugin-purchasely": "file:.."
21
19
  },
22
20
  "cordova": {
23
21
  "plugins": {
24
- "cordova-plugin-whitelist": {},
25
22
  "cordova-plugin-purchasely": {}
26
23
  },
27
24
  "platforms": [
@@ -156,10 +156,10 @@ function onPuchaselySdkReady() {
156
156
  }
157
157
 
158
158
  function openPresentation() {
159
- Purchasely.presentPresentationWithIdentifier(
160
- null,
161
- null,
162
- true,
159
+ Purchasely.presentPresentationForPlacement(
160
+ 'onboarding', //placementId
161
+ null, //contentId
162
+ true, //fullscreen
163
163
  (callback) => {
164
164
  console.log(callback);
165
165
  if(callback.result == Purchasely.PurchaseResult.CANCELLED) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "2.1.1",
3
+ "version": "2.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="2.1.1" 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.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" />
@@ -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.1.0"/>
31
+ <pod name="Purchasely" spec="3.2.2"/>
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.1.0" />
54
+ <framework src="io.purchasely:core:3.2.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" />
@@ -63,6 +63,7 @@ public class PLYProductActivity extends AppCompatActivity {
63
63
 
64
64
  PurchaselyPlugin.ProductActivity productActivity = new PurchaselyPlugin.ProductActivity();
65
65
  productActivity.presentationId = presentationId;
66
+ productActivity.placementId = placementId;
66
67
  productActivity.productId = productId;
67
68
  productActivity.planId = planId;
68
69
  productActivity.contentId = contentId;
@@ -78,6 +78,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
78
78
  getStringFromJson(args.getString(2)),
79
79
  args.getInt(3),
80
80
  args.getInt(4),
81
+ getStringFromJson(args.getString(5)),
81
82
  callbackContext);
82
83
  break;
83
84
  case "close":
@@ -240,6 +241,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
240
241
  String userId,
241
242
  int logLevel,
242
243
  int runningMode,
244
+ String cordovaSdkVersion,
243
245
  CallbackContext callbackContext) {
244
246
  ArrayList<String> list = new ArrayList<>();
245
247
  for (int i=0; i< stores.length(); i++) {
@@ -265,6 +267,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
265
267
  .logLevel(LogLevel.values()[logLevel])
266
268
  .build();
267
269
 
270
+ Purchasely.setSdkBridgeVersion(cordovaSdkVersion);
268
271
  Purchasely.setAppTechnology(PLYAppTechnology.CORDOVA);
269
272
 
270
273
  Purchasely.start((isConfigured, error) -> {
@@ -599,6 +602,8 @@ public class PurchaselyPlugin extends CordovaPlugin {
599
602
  if(info.getContentId() != null) infoMap.put("contentId", info.getContentId());
600
603
  if(info.getPresentationId() != null) infoMap.put("presentationId", info.getPresentationId());
601
604
  if(info.getPlacementId() != null) infoMap.put("placementId", info.getPlacementId());
605
+ if(info.getAbTestId() != null) infoMap.put("abTestId", info.getAbTestId());
606
+ if(info.getAbTestVariantId() != null) infoMap.put("abTestVariantId", info.getAbTestVariantId());
602
607
 
603
608
  HashMap<String, Object> resultForCordova = new HashMap<>();
604
609
  resultForCordova.put("info", infoMap);
@@ -664,6 +669,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
664
669
 
665
670
  public static class ProductActivity {
666
671
  String presentationId = null;
672
+ String placementId = null;
667
673
  String productId = null;
668
674
  String planId = null;
669
675
  String contentId = null;
@@ -676,6 +682,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
676
682
  && !backgroundActivity.isDestroyed()) {
677
683
  Intent intent = new Intent(cordova.getActivity(), PLYProductActivity.class);
678
684
  intent.putExtra("presentationId", presentationId);
685
+ intent.putExtra("placementId", placementId);
679
686
  intent.putExtra("productId", productId);
680
687
  intent.putExtra("planId", planId);
681
688
  intent.putExtra("contentId", contentId);
@@ -685,6 +692,7 @@ public class PurchaselyPlugin extends CordovaPlugin {
685
692
  } else {
686
693
  Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
687
694
  intent.putExtra("presentationId", presentationId);
695
+ intent.putExtra("placementId", placementId);
688
696
  intent.putExtra("productId", productId);
689
697
  intent.putExtra("planId", planId);
690
698
  intent.putExtra("contentId", contentId);
@@ -12,12 +12,15 @@
12
12
  @implementation CDVPurchasely
13
13
 
14
14
  - (void)startWithAPIKey:(CDVInvokedUrlCommand*)command {
15
- NSString *apiKey = [command argumentAtIndex:0];
16
- NSString *userId = [command argumentAtIndex:2];
17
- NSInteger logLevel = [[command argumentAtIndex:3] intValue];
18
- NSInteger runningMode = [[command argumentAtIndex:4] intValue];
15
+ NSString *apiKey = [command argumentAtIndex:0];
16
+ NSString *userId = [command argumentAtIndex:2];
17
+ NSInteger logLevel = [[command argumentAtIndex:3] intValue];
18
+ NSInteger runningMode = [[command argumentAtIndex:4] intValue];
19
+ NSString *purchaselySdkVersion = [command argumentAtIndex:5];
19
20
 
20
- [Purchasely setAppTechnology:PLYAppTechnologyCordova];
21
+ [Purchasely setSdkBridgeVersion:purchaselySdkVersion];
22
+
23
+ [Purchasely setAppTechnology:PLYAppTechnologyCordova];
21
24
  [Purchasely startWithAPIKey:apiKey appUserId:userId runningMode:runningMode eventDelegate:nil uiDelegate:nil paywallActionsInterceptor:nil logLevel:logLevel initialized:^(BOOL initialized, NSError * _Nullable error) {
22
25
  if (error != nil) {
23
26
  [self failureFor:command resultString: error.localizedDescription];
@@ -28,50 +31,50 @@
28
31
  }
29
32
 
30
33
  - (void)setLogLevel:(CDVInvokedUrlCommand*)command {
31
- NSInteger logLevel = [[command argumentAtIndex:0] intValue];
32
- [Purchasely setLogLevel:logLevel];
34
+ NSInteger logLevel = [[command argumentAtIndex:0] intValue];
35
+ [Purchasely setLogLevel:logLevel];
33
36
  }
34
37
 
35
38
  - (void)userLogin:(CDVInvokedUrlCommand*)command {
36
- NSString *userId = [command argumentAtIndex:0];
37
- [Purchasely userLoginWith:userId shouldRefresh:^(BOOL refresh) {
38
- [self successFor:command resultBool:refresh];
39
- }];
39
+ NSString *userId = [command argumentAtIndex:0];
40
+ [Purchasely userLoginWith:userId shouldRefresh:^(BOOL refresh) {
41
+ [self successFor:command resultBool:refresh];
42
+ }];
40
43
  }
41
44
 
42
45
  - (void)userLogout:(CDVInvokedUrlCommand*)command {
43
- [Purchasely userLogout];
46
+ [Purchasely userLogout];
44
47
  }
45
48
 
46
49
  - (void)setAttribute:(CDVInvokedUrlCommand*)command {
47
- NSInteger attribute = [[command argumentAtIndex:0] intValue];
48
- NSString *value = [command argumentAtIndex:1];
50
+ NSInteger attribute = [[command argumentAtIndex:0] intValue];
51
+ NSString *value = [command argumentAtIndex:1];
49
52
 
50
- [Purchasely setAttribute:attribute value:value];
53
+ [Purchasely setAttribute:attribute value:value];
51
54
  }
52
55
 
53
56
  - (void)getAnonymousUserId:(CDVInvokedUrlCommand*)command {
54
- NSString *anonymousId = [Purchasely anonymousUserId];
55
- [self successFor:command resultString:anonymousId];
57
+ NSString *anonymousId = [Purchasely anonymousUserId];
58
+ [self successFor:command resultString:anonymousId];
56
59
  }
57
60
 
58
61
  - (void)isReadyToPurchase:(CDVInvokedUrlCommand*)command {
59
- BOOL isReadyToPurchase = [[command argumentAtIndex:0] boolValue];
60
- [Purchasely isReadyToPurchase: isReadyToPurchase];
62
+ BOOL isReadyToPurchase = [[command argumentAtIndex:0] boolValue];
63
+ [Purchasely isReadyToPurchase: isReadyToPurchase];
61
64
  }
62
65
 
63
66
  - (void)setDefaultPresentationResultHandler:(CDVInvokedUrlCommand*)command {
64
- [Purchasely setDefaultPresentationResultHandler:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
65
- NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
67
+ [Purchasely setDefaultPresentationResultHandler:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
68
+ NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
66
69
 
67
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
68
- [pluginResult setKeepCallbackAsBool:YES];
69
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
70
- }];
70
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
71
+ [pluginResult setKeepCallbackAsBool:YES];
72
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
73
+ }];
71
74
  }
72
75
 
73
76
  - (void)presentPresentationWithIdentifier:(CDVInvokedUrlCommand*)command {
74
- NSString *presentationVendorId = [command argumentAtIndex:0];
77
+ NSString *presentationVendorId = [command argumentAtIndex:0];
75
78
  NSString *contentId = [command argumentAtIndex:1];
76
79
  BOOL isFullscreen = [[command argumentAtIndex:2] boolValue];
77
80
 
@@ -123,15 +126,15 @@
123
126
  }
124
127
 
125
128
  - (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command {
126
- NSString *planVendorId = [command argumentAtIndex:0];
127
- NSString *presentationVendorId = [command argumentAtIndex:1];
129
+ NSString *planVendorId = [command argumentAtIndex:0];
130
+ NSString *presentationVendorId = [command argumentAtIndex:1];
128
131
  NSString *contentId = [command argumentAtIndex:2];
129
132
  BOOL isFullscreen = [[command argumentAtIndex:3] boolValue];
130
133
 
131
134
  UIViewController *ctrl = [Purchasely planControllerFor:planVendorId with:presentationVendorId contentId:contentId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
132
- NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
133
- [self successFor:command resultDict:resultDict];
134
- }];
135
+ NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
136
+ [self successFor:command resultDict:resultDict];
137
+ }];
135
138
 
136
139
  if (ctrl != nil) {
137
140
  UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
@@ -150,15 +153,15 @@
150
153
  }
151
154
 
152
155
  - (void)presentProductWithIdentifier:(CDVInvokedUrlCommand*)command {
153
- NSString *productVendorId = [command argumentAtIndex:0];
154
- NSString *presentationVendorId = [command argumentAtIndex:1];
156
+ NSString *productVendorId = [command argumentAtIndex:0];
157
+ NSString *presentationVendorId = [command argumentAtIndex:1];
155
158
  NSString *contentId = [command argumentAtIndex:2];
156
159
  BOOL isFullscreen = [[command argumentAtIndex:3] boolValue];
157
160
 
158
161
  UIViewController *ctrl = [Purchasely productControllerFor:productVendorId with:presentationVendorId contentId:contentId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
159
- NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
160
- [self successFor:command resultDict:resultDict];
161
- }];
162
+ NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
163
+ [self successFor:command resultDict:resultDict];
164
+ }];
162
165
 
163
166
  if (ctrl != nil) {
164
167
  UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
@@ -177,163 +180,163 @@
177
180
  }
178
181
 
179
182
  - (void)presentSubscriptions:(CDVInvokedUrlCommand*)command {
180
- UIViewController *ctrl = [Purchasely subscriptionsController];
181
- UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
182
- ctrl.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target:navCtrl action:@selector(close)];
183
+ UIViewController *ctrl = [Purchasely subscriptionsController];
184
+ UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
185
+ ctrl.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone target:navCtrl action:@selector(close)];
183
186
 
184
- [Purchasely showController:navCtrl type: PLYUIControllerTypeSubscriptionList];
187
+ [Purchasely showController:navCtrl type: PLYUIControllerTypeSubscriptionList];
185
188
  }
186
189
 
187
190
  - (void)purchaseWithPlanVendorId:(CDVInvokedUrlCommand*)command {
188
- NSString *planVendorId = [command argumentAtIndex:0];
189
-
190
- [Purchasely planWith:planVendorId
191
- success:^(PLYPlan * _Nonnull plan) {
192
- [Purchasely purchaseWithPlan:plan
193
- success:^{
194
- [self successFor:command resultDict: plan.asDictionary];
195
- }
196
- failure:^(NSError * _Nonnull error) {
197
- [self failureFor:command resultString: error.localizedDescription];
198
- }];
199
- }
200
- failure:^(NSError * _Nullable error) {
201
- [self failureFor:command resultString: error.localizedDescription];
202
- }];
191
+ NSString *planVendorId = [command argumentAtIndex:0];
192
+
193
+ [Purchasely planWith:planVendorId
194
+ success:^(PLYPlan * _Nonnull plan) {
195
+ [Purchasely purchaseWithPlan:plan
196
+ success:^{
197
+ [self successFor:command resultDict: plan.asDictionary];
198
+ }
199
+ failure:^(NSError * _Nonnull error) {
200
+ [self failureFor:command resultString: error.localizedDescription];
201
+ }];
202
+ }
203
+ failure:^(NSError * _Nullable error) {
204
+ [self failureFor:command resultString: error.localizedDescription];
205
+ }];
203
206
  }
204
207
 
205
208
  - (void)restoreAllProducts:(CDVInvokedUrlCommand*)command {
206
- [Purchasely restoreAllProductsWithSuccess:^{
207
- [self successFor:command];
208
- } failure:^(NSError * _Nonnull error) {
209
- [self failureFor:command resultString:error.localizedDescription];
210
- }];
209
+ [Purchasely restoreAllProductsWithSuccess:^{
210
+ [self successFor:command];
211
+ } failure:^(NSError * _Nonnull error) {
212
+ [self failureFor:command resultString:error.localizedDescription];
213
+ }];
211
214
  }
212
215
 
213
216
  - (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command {
214
- [Purchasely silentRestoreAllProductsWithSuccess:^{
215
- [self successFor:command];
216
- } failure:^(NSError * _Nonnull error) {
217
- [self failureFor:command resultString:error.localizedDescription];
218
- }];
217
+ [Purchasely silentRestoreAllProductsWithSuccess:^{
218
+ [self successFor:command];
219
+ } failure:^(NSError * _Nonnull error) {
220
+ [self failureFor:command resultString:error.localizedDescription];
221
+ }];
219
222
  }
220
223
 
221
224
  - (void)purchasedSubscription:(CDVInvokedUrlCommand*)command {
222
- self.purchasedCommand = command;
223
- [[NSNotificationCenter defaultCenter] addObserver:self
224
- selector:@selector(reloadContent:)
225
- name: @"ply_purchasedSubscription"
226
- object:nil];
225
+ self.purchasedCommand = command;
226
+ [[NSNotificationCenter defaultCenter] addObserver:self
227
+ selector:@selector(reloadContent:)
228
+ name: @"ply_purchasedSubscription"
229
+ object:nil];
227
230
  }
228
231
 
229
232
  - (void)allProducts:(CDVInvokedUrlCommand*)command {
230
- [Purchasely allProductsWithSuccess:^(NSArray<PLYProduct *> * _Nonnull products) {
231
- NSMutableArray *productsArray = [NSMutableArray array];
233
+ [Purchasely allProductsWithSuccess:^(NSArray<PLYProduct *> * _Nonnull products) {
234
+ NSMutableArray *productsArray = [NSMutableArray array];
232
235
 
233
- for (PLYProduct *product in products) {
234
- if (product != nil) {
235
- [productsArray addObject: product.asDictionary];
236
- }
237
- }
236
+ for (PLYProduct *product in products) {
237
+ if (product != nil) {
238
+ [productsArray addObject: product.asDictionary];
239
+ }
240
+ }
238
241
 
239
- [self successFor:command resultArray:productsArray];
240
- } failure:^(NSError * _Nullable error) {
241
- [self failureFor:command resultString:error.localizedDescription];
242
- }];
242
+ [self successFor:command resultArray:productsArray];
243
+ } failure:^(NSError * _Nullable error) {
244
+ [self failureFor:command resultString:error.localizedDescription];
245
+ }];
243
246
  }
244
247
 
245
248
  - (void)productWithIdentifier:(CDVInvokedUrlCommand*)command {
246
- NSString *productVendorId = [command argumentAtIndex:0];
249
+ NSString *productVendorId = [command argumentAtIndex:0];
247
250
 
248
- [Purchasely productWith:productVendorId
249
- success:^(PLYProduct * _Nonnull product) {
250
- [self successFor:command resultDict:product.asDictionary];
251
- }
252
- failure:^(NSError * _Nullable error) {
253
- [self failureFor:command resultString:error.localizedDescription];
254
- }];
251
+ [Purchasely productWith:productVendorId
252
+ success:^(PLYProduct * _Nonnull product) {
253
+ [self successFor:command resultDict:product.asDictionary];
254
+ }
255
+ failure:^(NSError * _Nullable error) {
256
+ [self failureFor:command resultString:error.localizedDescription];
257
+ }];
255
258
  }
256
259
 
257
260
  - (void)planWithIdentifier:(CDVInvokedUrlCommand*)command {
258
- NSString *planVendorId = [command argumentAtIndex:0];
261
+ NSString *planVendorId = [command argumentAtIndex:0];
259
262
 
260
- [Purchasely planWith:planVendorId
261
- success:^(PLYPlan * _Nonnull plan) {
262
- [self successFor:command resultDict:plan.asDictionary];
263
- }
264
- failure:^(NSError * _Nullable error) {
265
- [self failureFor:command resultString:error.localizedDescription];
266
- }];
263
+ [Purchasely planWith:planVendorId
264
+ success:^(PLYPlan * _Nonnull plan) {
265
+ [self successFor:command resultDict:plan.asDictionary];
266
+ }
267
+ failure:^(NSError * _Nullable error) {
268
+ [self failureFor:command resultString:error.localizedDescription];
269
+ }];
267
270
  }
268
271
 
269
272
  - (void)userSubscriptions:(CDVInvokedUrlCommand*)command {
270
- [Purchasely userSubscriptionsWithSuccess:^(NSArray<PLYSubscription *> * _Nullable subscriptions) {
271
- NSMutableArray *result = [NSMutableArray new];
272
- for (PLYSubscription *subscription in subscriptions) {
273
- [result addObject:subscription.asDictionary];
274
- }
275
- [self successFor:command resultArray:result];
276
- }
277
- failure:^(NSError * _Nonnull error) {
278
- [self failureFor:command resultString:error.localizedDescription];
279
- }];
273
+ [Purchasely userSubscriptionsWithSuccess:^(NSArray<PLYSubscription *> * _Nullable subscriptions) {
274
+ NSMutableArray *result = [NSMutableArray new];
275
+ for (PLYSubscription *subscription in subscriptions) {
276
+ [result addObject:subscription.asDictionary];
277
+ }
278
+ [self successFor:command resultArray:result];
279
+ }
280
+ failure:^(NSError * _Nonnull error) {
281
+ [self failureFor:command resultString:error.localizedDescription];
282
+ }];
280
283
  }
281
284
 
282
285
  - (void)addEventsListener:(CDVInvokedUrlCommand*)command {
283
- [Purchasely setEventDelegate:self];
284
- self.eventCommand = command;
286
+ [Purchasely setEventDelegate:self];
287
+ self.eventCommand = command;
285
288
  }
286
289
 
287
290
  - (void)removeEventsListener:(CDVInvokedUrlCommand*)command {
288
- [Purchasely setEventDelegate:nil];
289
- self.eventCommand = nil;
291
+ [Purchasely setEventDelegate:nil];
292
+ self.eventCommand = nil;
290
293
  }
291
294
 
292
295
  - (void)handle:(CDVInvokedUrlCommand*)command {
293
- NSString *deeplinkString = [command argumentAtIndex:0];
294
- NSURL *deeplink = [NSURL URLWithString:deeplinkString];
295
-
296
- if (deeplink != nil) {
297
- BOOL result = [Purchasely handleWithDeeplink:deeplink];
298
- [self successFor:command resultBool:result];
299
- } else {
300
- [self successFor:command resultBool:NO];
301
- }
296
+ NSString *deeplinkString = [command argumentAtIndex:0];
297
+ NSURL *deeplink = [NSURL URLWithString:deeplinkString];
298
+
299
+ if (deeplink != nil) {
300
+ BOOL result = [Purchasely handleWithDeeplink:deeplink];
301
+ [self successFor:command resultBool:result];
302
+ } else {
303
+ [self successFor:command resultBool:NO];
304
+ }
302
305
  }
303
306
 
304
307
  - (void)close:(CDVInvokedUrlCommand*)command {
305
308
  }
306
309
 
307
310
  - (void)setLanguage:(CDVInvokedUrlCommand*)command {
308
- NSString *language = [command argumentAtIndex:0];
309
- NSLocale *locale = [NSLocale localeWithLocaleIdentifier:language];
310
- [Purchasely setLanguageFrom:locale];
311
+ NSString *language = [command argumentAtIndex:0];
312
+ NSLocale *locale = [NSLocale localeWithLocaleIdentifier:language];
313
+ [Purchasely setLanguageFrom:locale];
311
314
  }
312
315
 
313
316
  // Helpers
314
317
 
315
318
  - (NSDictionary<NSString *, NSObject *> *) resultDictionaryForPresentationController:(PLYProductViewControllerResult)result plan:(PLYPlan * _Nullable)plan {
316
- NSMutableDictionary<NSString *, NSObject *> *productViewResult = [NSMutableDictionary new];
317
- int resultString;
319
+ NSMutableDictionary<NSString *, NSObject *> *productViewResult = [NSMutableDictionary new];
320
+ int resultString;
318
321
 
319
- switch (result) {
320
- case PLYProductViewControllerResultPurchased:
321
- resultString = PLYProductViewControllerResultPurchased;
322
- break;
323
- case PLYProductViewControllerResultRestored:
324
- resultString = PLYProductViewControllerResultRestored;
325
- break;
326
- case PLYProductViewControllerResultCancelled:
327
- resultString = PLYProductViewControllerResultCancelled;
328
- break;
329
- }
322
+ switch (result) {
323
+ case PLYProductViewControllerResultPurchased:
324
+ resultString = PLYProductViewControllerResultPurchased;
325
+ break;
326
+ case PLYProductViewControllerResultRestored:
327
+ resultString = PLYProductViewControllerResultRestored;
328
+ break;
329
+ case PLYProductViewControllerResultCancelled:
330
+ resultString = PLYProductViewControllerResultCancelled;
331
+ break;
332
+ }
330
333
 
331
- [productViewResult setObject:[NSNumber numberWithInt:resultString] forKey:@"result"];
334
+ [productViewResult setObject:[NSNumber numberWithInt:resultString] forKey:@"result"];
332
335
 
333
- if (plan != nil) {
334
- [productViewResult setObject:[plan asDictionary] forKey:@"plan"];
335
- }
336
- return productViewResult;
336
+ if (plan != nil) {
337
+ [productViewResult setObject:[plan asDictionary] forKey:@"plan"];
338
+ }
339
+ return productViewResult;
337
340
  }
338
341
 
339
342
  - (NSDictionary<NSString *, NSObject *> *) resultDictionaryForActionInterceptor:(PLYPresentationAction) action
@@ -380,6 +383,13 @@
380
383
  if (infos.placementId != nil) {
381
384
  [infosResult setObject:infos.placementId forKey:@"placementId"];
382
385
  }
386
+ if (infos.abTestId != nil) {
387
+ [infosResult setObject:infos.abTestId forKey:@"abTestId"];
388
+ }
389
+ if (infos.abTestVariantId != nil) {
390
+ [infosResult setObject:infos.abTestVariantId forKey:@"abTestVariantId"];
391
+ }
392
+
383
393
  [actionInterceptorResult setObject:infosResult forKey:@"info"];
384
394
  }
385
395
  if (params != nil) {
@@ -433,43 +443,43 @@
433
443
  }
434
444
 
435
445
  - (void)successFor:(CDVInvokedUrlCommand *)command {
436
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
437
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
446
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
447
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
438
448
  }
439
449
 
440
450
  - (void)successFor:(CDVInvokedUrlCommand *)command resultBool:(BOOL)resultBool {
441
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:resultBool];
442
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
451
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:resultBool];
452
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
443
453
  }
444
454
 
445
455
  - (void)successFor:(CDVInvokedUrlCommand *)command resultString:(NSString *)resultString {
446
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:resultString];
447
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
456
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:resultString];
457
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
448
458
  }
449
459
 
450
460
  - (void)failureFor:(CDVInvokedUrlCommand *)command resultString:(NSString *)resultString {
451
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:resultString];
452
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
461
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:resultString];
462
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
453
463
  }
454
464
 
455
465
  - (void)successFor:(CDVInvokedUrlCommand *)command resultArray:(NSArray *)resultArray {
456
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:resultArray];
457
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
466
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:resultArray];
467
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
458
468
  }
459
469
 
460
470
  - (void)failureFor:(CDVInvokedUrlCommand *)command resultArray:(NSArray *)resultArray {
461
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsArray:resultArray];
462
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
471
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsArray:resultArray];
472
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
463
473
  }
464
474
 
465
475
  - (void)successFor:(CDVInvokedUrlCommand *)command resultDict:(NSDictionary *)resultDict {
466
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
467
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
476
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:resultDict];
477
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
468
478
  }
469
479
 
470
480
  - (void)failureFor:(CDVInvokedUrlCommand *)command resultDict:(NSDictionary *)resultDict {
471
- CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:resultDict];
472
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
481
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:resultDict];
482
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
473
483
  }
474
484
 
475
485
 
@@ -14,14 +14,18 @@
14
14
  NSMutableDictionary<NSString *, NSObject *> *dict = [NSMutableDictionary new];
15
15
 
16
16
  [dict setObject:self.plan.asDictionary forKey:@"plan"];
17
+ [dict setObject:self.product.asDictionary forKey:@"product"];
17
18
  [dict setObject:[NSNumber numberWithInt:self.subscriptionSource] forKey:@"subscriptionSource"];
18
19
 
20
+ NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
21
+ [dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
22
+
19
23
  if (self.nextRenewalDate != nil) {
20
- [dict setObject:@(self.nextRenewalDate.timeIntervalSince1970) forKey:@"nextRenewalDate"];
24
+ [dict setObject:[dateFormat stringFromDate:self.nextRenewalDate] forKey:@"nextRenewalDate"];
21
25
  }
22
26
 
23
27
  if (self.cancelledDate != nil) {
24
- [dict setObject:@(self.cancelledDate.timeIntervalSince1970) forKey:@"cancelledDate"];
28
+ [dict setObject:[dateFormat stringFromDate:self.cancelledDate] forKey:@"cancelledDate"];
25
29
  }
26
30
 
27
31
  return dict;
package/www/Purchasely.js CHANGED
@@ -3,7 +3,11 @@ var exec = require('cordova/exec');
3
3
  var defaultError = (e) => { console.log(e); }
4
4
 
5
5
  exports.startWithAPIKey = function (apiKey, stores, userId, logLevel, runningMode, success, error) {
6
- exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel, runningMode]);
6
+ var cordovaSdkVersion = cordova.define.moduleMap['cordova/plugin_list'].exports['metadata']['cordova-plugin-purchasely']
7
+ if(!cordovaSdkVersion) {
8
+ cordovaSdkVersion = "2.2.0" //fallback if we cannot find version from metadata
9
+ }
10
+ exec(success, error, 'Purchasely', 'startWithAPIKey', [apiKey, stores, userId, logLevel, runningMode, cordovaSdkVersion]);
7
11
  };
8
12
 
9
13
  exports.addEventsListener = function (success, error) {
@@ -133,7 +137,12 @@ exports.Attribute = {
133
137
  AMPLITUDE_SESSION_ID: 0,
134
138
  FIREBASE_APP_INSTANCE_ID: 1,
135
139
  AIRSHIP_CHANNEL_ID: 2,
136
- BATCH_INSTALLATION_ID: 3
140
+ BATCH_INSTALLATION_ID: 3,
141
+ ADJUST_ID: 4,
142
+ APPSFLYER_ID: 5,
143
+ ONESIGNAL_PLAYER_ID: 6,
144
+ MIXPANEL_DISTINCT_ID: 7,
145
+ CLEVER_TAP_ID: 8
137
146
  }
138
147
 
139
148
  exports.PurchaseResult = {