@purchasely/cordova-plugin-purchasely 2.0.1 → 2.1.0

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
@@ -16,3 +16,4 @@ This file provides the underlying native SDK versions that the Cordova SDK relie
16
16
  | 1.2.0 | 2.8.0 | 2.8.0 |
17
17
  | 2.0.0 | 3.0.0 | 3.0.1 |
18
18
  | 2.0.1 | 3.0.0 | 3.0.1 |
19
+ | 2.1.0 | 3.1.0 | 3.1.0 |
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "..": {
20
20
  "name": "cordova-plugin-purchasely",
21
- "version": "2.0.0",
21
+ "version": "2.0.1",
22
22
  "dev": true,
23
23
  "license": "ISC"
24
24
  },
@@ -445,6 +445,12 @@
445
445
  "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
446
446
  "dev": true
447
447
  },
448
+ "node_modules/function-bind": {
449
+ "version": "1.1.1",
450
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
451
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
452
+ "dev": true
453
+ },
448
454
  "node_modules/get-stream": {
449
455
  "version": "6.0.1",
450
456
  "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
@@ -495,6 +501,18 @@
495
501
  "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
496
502
  "dev": true
497
503
  },
504
+ "node_modules/has": {
505
+ "version": "1.0.3",
506
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
507
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
508
+ "dev": true,
509
+ "dependencies": {
510
+ "function-bind": "^1.1.1"
511
+ },
512
+ "engines": {
513
+ "node": ">= 0.4.0"
514
+ }
515
+ },
498
516
  "node_modules/human-signals": {
499
517
  "version": "2.1.0",
500
518
  "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
@@ -520,6 +538,15 @@
520
538
  "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
521
539
  "dev": true
522
540
  },
541
+ "node_modules/interpret": {
542
+ "version": "1.4.0",
543
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
544
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
545
+ "dev": true,
546
+ "engines": {
547
+ "node": ">= 0.10"
548
+ }
549
+ },
523
550
  "node_modules/ios-sim": {
524
551
  "version": "8.0.2",
525
552
  "resolved": "https://registry.npmjs.org/ios-sim/-/ios-sim-8.0.2.tgz",
@@ -559,6 +586,18 @@
559
586
  "node": "*"
560
587
  }
561
588
  },
589
+ "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==",
593
+ "dev": true,
594
+ "dependencies": {
595
+ "has": "^1.0.3"
596
+ },
597
+ "funding": {
598
+ "url": "https://github.com/sponsors/ljharb"
599
+ }
600
+ },
562
601
  "node_modules/is-extglob": {
563
602
  "version": "2.1.1",
564
603
  "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -788,6 +827,12 @@
788
827
  "node": ">=8"
789
828
  }
790
829
  },
830
+ "node_modules/path-parse": {
831
+ "version": "1.0.7",
832
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
833
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
834
+ "dev": true
835
+ },
791
836
  "node_modules/picomatch": {
792
837
  "version": "2.3.0",
793
838
  "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
@@ -877,6 +922,35 @@
877
922
  "node": ">=6"
878
923
  }
879
924
  },
925
+ "node_modules/rechoir": {
926
+ "version": "0.6.2",
927
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
928
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
929
+ "dev": true,
930
+ "dependencies": {
931
+ "resolve": "^1.1.6"
932
+ },
933
+ "engines": {
934
+ "node": ">= 0.10"
935
+ }
936
+ },
937
+ "node_modules/resolve": {
938
+ "version": "1.22.0",
939
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
940
+ "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
941
+ "dev": true,
942
+ "dependencies": {
943
+ "is-core-module": "^2.8.1",
944
+ "path-parse": "^1.0.7",
945
+ "supports-preserve-symlinks-flag": "^1.0.0"
946
+ },
947
+ "bin": {
948
+ "resolve": "bin/resolve"
949
+ },
950
+ "funding": {
951
+ "url": "https://github.com/sponsors/ljharb"
952
+ }
953
+ },
880
954
  "node_modules/reusify": {
881
955
  "version": "1.0.4",
882
956
  "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -953,15 +1027,20 @@
953
1027
  }
954
1028
  },
955
1029
  "node_modules/shelljs": {
956
- "version": "0.2.6",
957
- "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz",
958
- "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=",
1030
+ "version": "0.8.5",
1031
+ "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz",
1032
+ "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
959
1033
  "dev": true,
1034
+ "dependencies": {
1035
+ "glob": "^7.0.0",
1036
+ "interpret": "^1.0.0",
1037
+ "rechoir": "^0.6.2"
1038
+ },
960
1039
  "bin": {
961
1040
  "shjs": "bin/shjs"
962
1041
  },
963
1042
  "engines": {
964
- "node": ">=0.8.0"
1043
+ "node": ">=4"
965
1044
  }
966
1045
  },
967
1046
  "node_modules/signal-exit": {
@@ -971,12 +1050,12 @@
971
1050
  "dev": true
972
1051
  },
973
1052
  "node_modules/simctl": {
974
- "version": "2.0.0",
975
- "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.0.tgz",
976
- "integrity": "sha512-5rB7rN4N3b0z0nFdy9eczVssXqrv2aAgdVRksPVqVoiDtvXmfzNvebp3EMdId2sAUzXIflarQlx4P0hjVQEzKQ==",
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==",
977
1056
  "dev": true,
978
1057
  "dependencies": {
979
- "shelljs": "^0.2.6",
1058
+ "shelljs": "^0.8.5",
980
1059
  "tail": "^0.4.0"
981
1060
  }
982
1061
  },
@@ -1036,6 +1115,18 @@
1036
1115
  "node": ">=6"
1037
1116
  }
1038
1117
  },
1118
+ "node_modules/supports-preserve-symlinks-flag": {
1119
+ "version": "1.0.0",
1120
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
1121
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
1122
+ "dev": true,
1123
+ "engines": {
1124
+ "node": ">= 0.4"
1125
+ },
1126
+ "funding": {
1127
+ "url": "https://github.com/sponsors/ljharb"
1128
+ }
1129
+ },
1039
1130
  "node_modules/tail": {
1040
1131
  "version": "0.4.0",
1041
1132
  "resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",
@@ -1508,6 +1599,12 @@
1508
1599
  "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
1509
1600
  "dev": true
1510
1601
  },
1602
+ "function-bind": {
1603
+ "version": "1.1.1",
1604
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
1605
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
1606
+ "dev": true
1607
+ },
1511
1608
  "get-stream": {
1512
1609
  "version": "6.0.1",
1513
1610
  "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
@@ -1543,6 +1640,15 @@
1543
1640
  "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==",
1544
1641
  "dev": true
1545
1642
  },
1643
+ "has": {
1644
+ "version": "1.0.3",
1645
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
1646
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
1647
+ "dev": true,
1648
+ "requires": {
1649
+ "function-bind": "^1.1.1"
1650
+ }
1651
+ },
1546
1652
  "human-signals": {
1547
1653
  "version": "2.1.0",
1548
1654
  "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
@@ -1565,6 +1671,12 @@
1565
1671
  "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
1566
1672
  "dev": true
1567
1673
  },
1674
+ "interpret": {
1675
+ "version": "1.4.0",
1676
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
1677
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
1678
+ "dev": true
1679
+ },
1568
1680
  "ios-sim": {
1569
1681
  "version": "8.0.2",
1570
1682
  "resolved": "https://registry.npmjs.org/ios-sim/-/ios-sim-8.0.2.tgz",
@@ -1594,6 +1706,15 @@
1594
1706
  }
1595
1707
  }
1596
1708
  },
1709
+ "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==",
1713
+ "dev": true,
1714
+ "requires": {
1715
+ "has": "^1.0.3"
1716
+ }
1717
+ },
1597
1718
  "is-extglob": {
1598
1719
  "version": "2.1.1",
1599
1720
  "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
@@ -1761,6 +1882,12 @@
1761
1882
  "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
1762
1883
  "dev": true
1763
1884
  },
1885
+ "path-parse": {
1886
+ "version": "1.0.7",
1887
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
1888
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
1889
+ "dev": true
1890
+ },
1764
1891
  "picomatch": {
1765
1892
  "version": "2.3.0",
1766
1893
  "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz",
@@ -1814,6 +1941,26 @@
1814
1941
  "with-open-file": "^0.1.6"
1815
1942
  }
1816
1943
  },
1944
+ "rechoir": {
1945
+ "version": "0.6.2",
1946
+ "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
1947
+ "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
1948
+ "dev": true,
1949
+ "requires": {
1950
+ "resolve": "^1.1.6"
1951
+ }
1952
+ },
1953
+ "resolve": {
1954
+ "version": "1.22.0",
1955
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz",
1956
+ "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==",
1957
+ "dev": true,
1958
+ "requires": {
1959
+ "is-core-module": "^2.8.1",
1960
+ "path-parse": "^1.0.7",
1961
+ "supports-preserve-symlinks-flag": "^1.0.0"
1962
+ }
1963
+ },
1817
1964
  "reusify": {
1818
1965
  "version": "1.0.4",
1819
1966
  "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
@@ -1860,10 +2007,15 @@
1860
2007
  "dev": true
1861
2008
  },
1862
2009
  "shelljs": {
1863
- "version": "0.2.6",
1864
- "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.2.6.tgz",
1865
- "integrity": "sha1-kEktcv/MgVmXa6umL7D2iE8MM3g=",
1866
- "dev": true
2010
+ "version": "0.8.5",
2011
+ "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz",
2012
+ "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
2013
+ "dev": true,
2014
+ "requires": {
2015
+ "glob": "^7.0.0",
2016
+ "interpret": "^1.0.0",
2017
+ "rechoir": "^0.6.2"
2018
+ }
1867
2019
  },
1868
2020
  "signal-exit": {
1869
2021
  "version": "3.0.6",
@@ -1872,12 +2024,12 @@
1872
2024
  "dev": true
1873
2025
  },
1874
2026
  "simctl": {
1875
- "version": "2.0.0",
1876
- "resolved": "https://registry.npmjs.org/simctl/-/simctl-2.0.0.tgz",
1877
- "integrity": "sha512-5rB7rN4N3b0z0nFdy9eczVssXqrv2aAgdVRksPVqVoiDtvXmfzNvebp3EMdId2sAUzXIflarQlx4P0hjVQEzKQ==",
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==",
1878
2030
  "dev": true,
1879
2031
  "requires": {
1880
- "shelljs": "^0.2.6",
2032
+ "shelljs": "^0.8.5",
1881
2033
  "tail": "^0.4.0"
1882
2034
  }
1883
2035
  },
@@ -1927,6 +2079,12 @@
1927
2079
  "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
1928
2080
  "dev": true
1929
2081
  },
2082
+ "supports-preserve-symlinks-flag": {
2083
+ "version": "1.0.0",
2084
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
2085
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
2086
+ "dev": true
2087
+ },
1930
2088
  "tail": {
1931
2089
  "version": "0.4.0",
1932
2090
  "resolved": "https://registry.npmjs.org/tail/-/tail-0.4.0.tgz",
@@ -27,8 +27,6 @@ function onDeviceReady() {
27
27
  console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
28
28
  document.getElementById('deviceready').classList.add('ready');
29
29
 
30
- console.log("Hi");
31
-
32
30
  Purchasely.setLanguage('en')
33
31
 
34
32
  Purchasely.startWithAPIKey(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purchasely/cordova-plugin-purchasely",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
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.0.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.1.0" 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.0.0"/>
31
+ <pod name="Purchasely" spec="3.1.0"/>
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.0.1" />
54
+ <framework src="io.purchasely:core:3.1.0" />
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" />
@@ -33,12 +33,15 @@ public class PLYProductActivity extends AppCompatActivity {
33
33
  );
34
34
 
35
35
  String presentationId = getIntent().getExtras().getString("presentationId");
36
+ String placementId = getIntent().getExtras().getString("placementId");
36
37
  String productId = getIntent().getExtras().getString("productId");
37
38
  String planId = getIntent().getExtras().getString("planId");
38
39
  String contentId = getIntent().getExtras().getString("contentId");
39
40
 
40
41
  Fragment fragment;
41
- if(planId != null && !planId.isEmpty()) {
42
+ if(placementId != null && !placementId.isEmpty()) {
43
+ fragment = Purchasely.presentationFragmentForPlacement(placementId, contentId, null, listener);
44
+ } else if(planId != null && !planId.isEmpty()) {
42
45
  fragment = Purchasely.planFragment(planId, presentationId, contentId, null, listener);
43
46
  } else if(productId != null && !productId.isEmpty()) {
44
47
  fragment = Purchasely.productFragment(productId, presentationId, contentId, null, listener);
@@ -127,6 +127,14 @@ public class PurchaselyPlugin extends CordovaPlugin {
127
127
  callbackContext
128
128
  );
129
129
  break;
130
+ case "presentPresentationForPlacement":
131
+ presentPresentationForPlacement(
132
+ args.getString(0),
133
+ args.getString(1),
134
+ args.getBoolean(2),
135
+ callbackContext
136
+ );
137
+ break;
130
138
  case "presentProductWithIdentifier":
131
139
  presentProductWithIdentifier(
132
140
  args.getString(0),
@@ -390,6 +398,18 @@ public class PurchaselyPlugin extends CordovaPlugin {
390
398
  cordova.getActivity().startActivity(intent);
391
399
  }
392
400
 
401
+ private void presentPresentationForPlacement(String placementVendorId,
402
+ String contentId,
403
+ boolean isFullScreen,
404
+ CallbackContext callbackContext) {
405
+ presentationCallback = callbackContext;
406
+ Intent intent = PLYProductActivity.newIntent(cordova.getActivity());
407
+ intent.putExtra("placementId", placementVendorId);
408
+ intent.putExtra("contentId", contentId);
409
+ intent.putExtra("isFullScreen", isFullScreen);
410
+ cordova.getActivity().startActivity(intent);
411
+ }
412
+
393
413
  private void presentProductWithIdentifier(String productVendorId,
394
414
  String presentationVendorId,
395
415
  String contentId,
@@ -556,15 +576,21 @@ public class PurchaselyPlugin extends CordovaPlugin {
556
576
  (info, plyPresentationAction, map, plyProcessActionListener) -> {
557
577
  processActionListener = plyProcessActionListener;
558
578
 
579
+ String url = null;
580
+ if(map.getUrl() != null) {
581
+ url = map.getUrl().toString();
582
+ }
583
+
559
584
  HashMap<String, Object> parametersForCordova = new HashMap<>();
560
585
  parametersForCordova.put("title", map.getTitle());
561
- parametersForCordova.put("url", map.getUrl());
586
+ parametersForCordova.put("url", url);
562
587
  parametersForCordova.put("plan", transformPlanToMap(map.getPlan()));
563
588
  parametersForCordova.put("presentation", map.getPresentation());
564
589
 
565
590
  HashMap<String, Object> infoMap = new HashMap<>();
566
591
  if(info.getContentId() != null) infoMap.put("contentId", info.getContentId());
567
592
  if(info.getPresentationId() != null) infoMap.put("presentationId", info.getPresentationId());
593
+ if(info.getPlacementId() != null) infoMap.put("placementId", info.getPlacementId());
568
594
 
569
595
  HashMap<String, Object> resultForCordova = new HashMap<>();
570
596
  resultForCordova.put("info", infoMap);
@@ -28,6 +28,7 @@
28
28
  - (void)isReadyToPurchase:(CDVInvokedUrlCommand*)command;
29
29
  - (void)setDefaultPresentationResultHandler:(CDVInvokedUrlCommand*)command;
30
30
  - (void)presentPresentationWithIdentifier:(CDVInvokedUrlCommand*)command;
31
+ - (void)presentPresentationForPlacement:(CDVInvokedUrlCommand*)command;
31
32
  - (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command;
32
33
  - (void)presentProductWithIdentifier:(CDVInvokedUrlCommand*)command;
33
34
  - (void)presentSubscriptions:(CDVInvokedUrlCommand*)command;
@@ -96,6 +96,32 @@
96
96
  }
97
97
  }
98
98
 
99
+ - (void)presentPresentationForPlacement:(CDVInvokedUrlCommand*)command {
100
+ NSString *placementVendorId = [command argumentAtIndex:0];
101
+ NSString *contentId = [command argumentAtIndex:1];
102
+ BOOL isFullscreen = [[command argumentAtIndex:2] boolValue];
103
+
104
+ UIViewController *ctrl = [Purchasely presentationControllerFor:placementVendorId contentId:contentId loaded:nil completion:^(enum PLYProductViewControllerResult result, PLYPlan * _Nullable plan) {
105
+ NSDictionary *resultDict = [self resultDictionaryForPresentationController:result plan:plan];
106
+ [self successFor:command resultDict:resultDict];
107
+ }];
108
+
109
+ if (ctrl != nil) {
110
+ UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:ctrl];
111
+ [navCtrl.navigationBar setTranslucent:YES];
112
+ [navCtrl.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
113
+ [navCtrl.navigationBar setShadowImage: [UIImage new]];
114
+ [navCtrl.navigationBar setTintColor: [UIColor whiteColor]];
115
+
116
+ self.presentedPresentationViewController = navCtrl;
117
+
118
+ if (isFullscreen) {
119
+ navCtrl.modalPresentationStyle = UIModalPresentationFullScreen;
120
+ }
121
+ [Purchasely showController:navCtrl type: PLYUIControllerTypeProductPage];
122
+ }
123
+ }
124
+
99
125
  - (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command {
100
126
  NSString *planVendorId = [command argumentAtIndex:0];
101
127
  NSString *presentationVendorId = [command argumentAtIndex:1];
@@ -351,6 +377,9 @@
351
377
  if (infos.presentationId != nil) {
352
378
  [infosResult setObject:infos.presentationId forKey:@"presentationId"];
353
379
  }
380
+ if (infos.placementId != nil) {
381
+ [infosResult setObject:infos.placementId forKey:@"placementId"];
382
+ }
354
383
  [actionInterceptorResult setObject:infosResult forKey:@"info"];
355
384
  }
356
385
  if (params != nil) {
@@ -38,6 +38,11 @@
38
38
  if (amount != nil) {
39
39
  [dict setObject:amount forKey:@"amount"];
40
40
  }
41
+
42
+ NSString *localizedAmount = [self localizedPriceWithLanguage:nil];
43
+ if (localizedAmount != nil) {
44
+ [dict setObject:localizedAmount forKey:@"localizedAmount"];
45
+ }
41
46
 
42
47
  NSDecimalNumber *introAmount = [self introAmount];
43
48
  if (introAmount != nil) {
package/www/Purchasely.js CHANGED
@@ -50,6 +50,10 @@ exports.presentPresentationWithIdentifier = function (presentationId, contentId,
50
50
  exec(success, error, 'Purchasely', 'presentPresentationWithIdentifier', [presentationId, contentId, isFullscreen]);
51
51
  };
52
52
 
53
+ exports.presentPresentationForPlacement = function (placementId, contentId, isFullscreen, success, error) {
54
+ exec(success, error, 'Purchasely', 'presentPresentationForPlacement', [placementId, contentId, isFullscreen]);
55
+ };
56
+
53
57
  exports.presentProductWithIdentifier = function (productId, presentationId, contentId, isFullscreen, success, error) {
54
58
  exec(success, error, 'Purchasely', 'presentProductWithIdentifier', [productId, presentationId, contentId, isFullscreen]);
55
59
  };