@purchasely/cordova-plugin-purchasely 4.1.0 → 4.2.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/example/package-lock.json +39 -18
- package/example/www/js/index.js +1 -1
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/PurchaselyPlugin.kt +31 -22
- package/src/ios/CDVPurchasely.h +1 -0
- package/src/ios/CDVPurchasely.m +9 -2
- package/www/Purchasely.js +13 -2
|
@@ -462,6 +462,15 @@
|
|
|
462
462
|
"dev": true,
|
|
463
463
|
"license": "ISC"
|
|
464
464
|
},
|
|
465
|
+
"node_modules/function-bind": {
|
|
466
|
+
"version": "1.1.2",
|
|
467
|
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
|
468
|
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
|
469
|
+
"dev": true,
|
|
470
|
+
"funding": {
|
|
471
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
472
|
+
}
|
|
473
|
+
},
|
|
465
474
|
"node_modules/get-stream": {
|
|
466
475
|
"version": "6.0.1",
|
|
467
476
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
|
@@ -509,13 +518,16 @@
|
|
|
509
518
|
"dev": true,
|
|
510
519
|
"license": "ISC"
|
|
511
520
|
},
|
|
512
|
-
"node_modules/
|
|
513
|
-
"version": "
|
|
514
|
-
"resolved": "https://registry.npmjs.org/
|
|
515
|
-
"integrity": "sha512-
|
|
521
|
+
"node_modules/hasown": {
|
|
522
|
+
"version": "2.0.0",
|
|
523
|
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
|
|
524
|
+
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
|
|
516
525
|
"dev": true,
|
|
526
|
+
"dependencies": {
|
|
527
|
+
"function-bind": "^1.1.2"
|
|
528
|
+
},
|
|
517
529
|
"engines": {
|
|
518
|
-
"node": ">= 0.4
|
|
530
|
+
"node": ">= 0.4"
|
|
519
531
|
}
|
|
520
532
|
},
|
|
521
533
|
"node_modules/human-signals": {
|
|
@@ -596,12 +608,12 @@
|
|
|
596
608
|
}
|
|
597
609
|
},
|
|
598
610
|
"node_modules/is-core-module": {
|
|
599
|
-
"version": "2.13.
|
|
600
|
-
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.
|
|
601
|
-
"integrity": "sha512-
|
|
611
|
+
"version": "2.13.1",
|
|
612
|
+
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
|
|
613
|
+
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
|
|
602
614
|
"dev": true,
|
|
603
615
|
"dependencies": {
|
|
604
|
-
"
|
|
616
|
+
"hasown": "^2.0.0"
|
|
605
617
|
},
|
|
606
618
|
"funding": {
|
|
607
619
|
"url": "https://github.com/sponsors/ljharb"
|
|
@@ -1576,6 +1588,12 @@
|
|
|
1576
1588
|
"version": "1.0.0",
|
|
1577
1589
|
"dev": true
|
|
1578
1590
|
},
|
|
1591
|
+
"function-bind": {
|
|
1592
|
+
"version": "1.1.2",
|
|
1593
|
+
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
|
1594
|
+
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
|
1595
|
+
"dev": true
|
|
1596
|
+
},
|
|
1579
1597
|
"get-stream": {
|
|
1580
1598
|
"version": "6.0.1",
|
|
1581
1599
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
|
|
@@ -1605,11 +1623,14 @@
|
|
|
1605
1623
|
"version": "4.2.6",
|
|
1606
1624
|
"dev": true
|
|
1607
1625
|
},
|
|
1608
|
-
"
|
|
1609
|
-
"version": "
|
|
1610
|
-
"resolved": "https://registry.npmjs.org/
|
|
1611
|
-
"integrity": "sha512-
|
|
1612
|
-
"dev": true
|
|
1626
|
+
"hasown": {
|
|
1627
|
+
"version": "2.0.0",
|
|
1628
|
+
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz",
|
|
1629
|
+
"integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==",
|
|
1630
|
+
"dev": true,
|
|
1631
|
+
"requires": {
|
|
1632
|
+
"function-bind": "^1.1.2"
|
|
1633
|
+
}
|
|
1613
1634
|
},
|
|
1614
1635
|
"human-signals": {
|
|
1615
1636
|
"version": "2.1.0",
|
|
@@ -1671,12 +1692,12 @@
|
|
|
1671
1692
|
}
|
|
1672
1693
|
},
|
|
1673
1694
|
"is-core-module": {
|
|
1674
|
-
"version": "2.13.
|
|
1675
|
-
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.
|
|
1676
|
-
"integrity": "sha512-
|
|
1695
|
+
"version": "2.13.1",
|
|
1696
|
+
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
|
|
1697
|
+
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
|
|
1677
1698
|
"dev": true,
|
|
1678
1699
|
"requires": {
|
|
1679
|
-
"
|
|
1700
|
+
"hasown": "^2.0.0"
|
|
1680
1701
|
}
|
|
1681
1702
|
},
|
|
1682
1703
|
"is-extglob": {
|
package/example/www/js/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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="4.
|
|
2
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="4.2.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
3
|
<name>Purchasely</name>
|
|
4
4
|
<js-module name="Purchasely" src="www/Purchasely.js">
|
|
5
5
|
<clobbers target="Purchasely" />
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
37
37
|
</config>
|
|
38
38
|
<pods use-frameworks="true">
|
|
39
|
-
<pod name="Purchasely" spec="4.
|
|
39
|
+
<pod name="Purchasely" spec="4.2.0"/>
|
|
40
40
|
</pods>
|
|
41
41
|
</podspec>
|
|
42
42
|
</platform>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
|
62
62
|
</activity>
|
|
63
63
|
</config-file>
|
|
64
|
-
<framework src="io.purchasely:core:4.
|
|
64
|
+
<framework src="io.purchasely:core:4.2.0" />
|
|
65
65
|
<source-file src="src/android/PurchaselyPlugin.kt" target-dir="java/cordova/plugin/purchasely" />
|
|
66
66
|
<source-file src="src/android/PLYProductActivity.kt" target-dir="java/cordova/plugin/purchasely" />
|
|
67
67
|
<source-file src="src/android/PLYSubscriptionsActivity.java" target-dir="src/cordova/plugin/purchasely" />
|
|
@@ -34,6 +34,7 @@ import io.purchasely.models.PLYPlan
|
|
|
34
34
|
import io.purchasely.models.PLYPresentationPlan
|
|
35
35
|
import io.purchasely.models.PLYProduct
|
|
36
36
|
import io.purchasely.models.PLYSubscriptionData
|
|
37
|
+
import io.purchasely.views.presentation.PLYThemeMode
|
|
37
38
|
import org.apache.cordova.CallbackContext
|
|
38
39
|
import org.apache.cordova.CordovaInterface
|
|
39
40
|
import org.apache.cordova.CordovaPlugin
|
|
@@ -81,6 +82,7 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
81
82
|
"userLogout" -> userLogout()
|
|
82
83
|
"setLanguage" -> setLanguage(getStringFromJson(args.getString(0)))
|
|
83
84
|
"setLogLevel" -> setLogLevel(args.getInt(0))
|
|
85
|
+
"setThemeMode" -> setThemeMode(args.getInt(0))
|
|
84
86
|
"setAttribute" -> setAttribute(args.getInt(0), getStringFromJson(args.getString(1)))
|
|
85
87
|
"setDefaultPresentationResultHandler" -> setDefaultPresentationResultHandler(
|
|
86
88
|
callbackContext
|
|
@@ -321,6 +323,10 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
321
323
|
Purchasely.readyToOpenDeeplink = isReadyToPurchase
|
|
322
324
|
}
|
|
323
325
|
|
|
326
|
+
private fun setThemeMode(mode: Int) {
|
|
327
|
+
Purchasely.setThemeMode(PLYThemeMode.values()[mode])
|
|
328
|
+
}
|
|
329
|
+
|
|
324
330
|
private fun setAttribute(attribute: Int, value: String?) {
|
|
325
331
|
if(value == null) return
|
|
326
332
|
|
|
@@ -502,32 +508,35 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
502
508
|
}
|
|
503
509
|
|
|
504
510
|
private fun userSubscriptions(callbackContext: CallbackContext) {
|
|
505
|
-
Purchasely.userSubscriptions(
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
val
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
map["
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
511
|
+
Purchasely.userSubscriptions(
|
|
512
|
+
false,
|
|
513
|
+
object : SubscriptionsListener {
|
|
514
|
+
override fun onSuccess(list: List<PLYSubscriptionData>) {
|
|
515
|
+
val result = JSONArray()
|
|
516
|
+
for (i in list.indices) {
|
|
517
|
+
val data = list[i]
|
|
518
|
+
val map = HashMap(data.toMap())
|
|
519
|
+
map["plan"] = transformPlanToMap(data.plan)
|
|
520
|
+
map["product"] = data.product.toMap()
|
|
521
|
+
if (data.data.storeType == StoreType.GOOGLE_PLAY_STORE) {
|
|
522
|
+
map["subscriptionSource"] = StoreType.GOOGLE_PLAY_STORE.ordinal
|
|
523
|
+
} else if (data.data.storeType == StoreType.AMAZON_APP_STORE) {
|
|
524
|
+
map["subscriptionSource"] = StoreType.AMAZON_APP_STORE.ordinal
|
|
525
|
+
} else if (data.data.storeType == StoreType.HUAWEI_APP_GALLERY) {
|
|
526
|
+
map["subscriptionSource"] = StoreType.HUAWEI_APP_GALLERY.ordinal
|
|
527
|
+
} else if (data.data.storeType == StoreType.APPLE_APP_STORE) {
|
|
528
|
+
map["subscriptionSource"] = StoreType.APPLE_APP_STORE.ordinal
|
|
529
|
+
}
|
|
530
|
+
result.put(JSONObject(map))
|
|
521
531
|
}
|
|
522
|
-
|
|
532
|
+
callbackContext.success(result)
|
|
523
533
|
}
|
|
524
|
-
callbackContext.success(result)
|
|
525
|
-
}
|
|
526
534
|
|
|
527
|
-
|
|
528
|
-
|
|
535
|
+
override fun onFailure(throwable: Throwable) {
|
|
536
|
+
callbackContext.error(throwable.message)
|
|
537
|
+
}
|
|
529
538
|
}
|
|
530
|
-
|
|
539
|
+
)
|
|
531
540
|
}
|
|
532
541
|
|
|
533
542
|
private fun isDeeplinkHandled(deeplink: String?, callbackContext: CallbackContext) {
|
package/src/ios/CDVPurchasely.h
CHANGED
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -65,6 +65,12 @@
|
|
|
65
65
|
[Purchasely userLogout];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
- (void)setThemeMode:(CDVInvokedUrlCommand *)command {
|
|
69
|
+
NSInteger mode = [[command argumentAtIndex:0] intValue];
|
|
70
|
+
|
|
71
|
+
[Purchasely setThemeMode:(enum PLYThemeMode) mode];
|
|
72
|
+
}
|
|
73
|
+
|
|
68
74
|
- (void)setAttribute:(CDVInvokedUrlCommand*)command {
|
|
69
75
|
NSInteger attribute = [[command argumentAtIndex:0] intValue];
|
|
70
76
|
NSString *value = [command argumentAtIndex:1];
|
|
@@ -321,14 +327,15 @@
|
|
|
321
327
|
}
|
|
322
328
|
|
|
323
329
|
- (void)userSubscriptions:(CDVInvokedUrlCommand*)command {
|
|
324
|
-
[Purchasely
|
|
330
|
+
[Purchasely userSubscriptions:false
|
|
331
|
+
success:^(NSArray<PLYSubscription *> * _Nullable subscriptions) {
|
|
325
332
|
NSMutableArray *result = [NSMutableArray new];
|
|
326
333
|
for (PLYSubscription *subscription in subscriptions) {
|
|
327
334
|
[result addObject:subscription.asDictionary];
|
|
328
335
|
}
|
|
329
336
|
[self successFor:command resultArray:result];
|
|
330
337
|
}
|
|
331
|
-
|
|
338
|
+
failure:^(NSError * _Nonnull error) {
|
|
332
339
|
[self failureFor:command resultString:error.localizedDescription];
|
|
333
340
|
}];
|
|
334
341
|
}
|
package/www/Purchasely.js
CHANGED
|
@@ -5,7 +5,7 @@ var defaultError = (e) => { console.log(e); }
|
|
|
5
5
|
exports.start = function (apiKey, stores, storekit1, userId, logLevel, runningMode, success, error) {
|
|
6
6
|
var cordovaSdkVersion = cordova.define.moduleMap['cordova/plugin_list'].exports['metadata']['cordova-plugin-purchasely']
|
|
7
7
|
if(!cordovaSdkVersion) {
|
|
8
|
-
cordovaSdkVersion = "4.
|
|
8
|
+
cordovaSdkVersion = "4.2.0";
|
|
9
9
|
}
|
|
10
10
|
exec(success, error, 'Purchasely', 'start', [apiKey, stores, storekit1, userId, logLevel, runningMode, cordovaSdkVersion]);
|
|
11
11
|
};
|
|
@@ -186,6 +186,10 @@ exports.signPromotionalOffer = function (storeProductId, storeOfferId, success,
|
|
|
186
186
|
exec(success, error, 'Purchasely', 'signPromotionalOffer', [storeProductId, storeOfferId]);
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
exports.setThemeMode = function (mode) {
|
|
190
|
+
exec(() => {}, defaultError, 'Purchasely', 'setThemeMode', [mode]);
|
|
191
|
+
};
|
|
192
|
+
|
|
189
193
|
exports.LogLevel = {
|
|
190
194
|
DEBUG: 0,
|
|
191
195
|
INFO: 1,
|
|
@@ -214,7 +218,8 @@ exports.Attribute = {
|
|
|
214
218
|
AMPLITUDE_USER_ID: 17,
|
|
215
219
|
AMPLITUDE_DEVICE_ID: 18,
|
|
216
220
|
MOENGAGE_UNIQUE_ID: 19,
|
|
217
|
-
ONESIGNAL_EXTERNAL_ID: 20
|
|
221
|
+
ONESIGNAL_EXTERNAL_ID: 20,
|
|
222
|
+
BATCH_CUSTOM_USER_ID: 21,
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
exports.PurchaseResult = {
|
|
@@ -255,3 +260,9 @@ exports.PaywallAction = {
|
|
|
255
260
|
open_presentation: 'open_placement',
|
|
256
261
|
promo_code: 'promo_code',
|
|
257
262
|
}
|
|
263
|
+
|
|
264
|
+
exports.ThemeMode = {
|
|
265
|
+
light: 0,
|
|
266
|
+
dark: 1,
|
|
267
|
+
system: 2
|
|
268
|
+
}
|