@purchasely/cordova-plugin-purchasely 5.5.0 → 5.6.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/android.sh +4 -2
- package/example/ios.sh +1 -1
- package/example/package-lock.json +69 -452
- package/example/package.json +7 -5
- package/example/www/js/index.js +18 -6
- package/package.json +1 -1
- package/plugin.xml +3 -3
- package/src/android/PurchaselyPlugin.kt +7 -0
- package/src/ios/CDVPurchasely.m +24 -19
- package/src/ios/Hybrid/UIViewController+Hybrid.m +2 -1
- package/www/Purchasely.js +8 -2
package/example/package.json
CHANGED
|
@@ -13,18 +13,20 @@
|
|
|
13
13
|
"author": "Apache Cordova Team",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@purchasely/cordova-plugin-puchasely-google": "file:../../purchasely-google",
|
|
17
16
|
"@purchasely/cordova-plugin-purchasely": "file:..",
|
|
17
|
+
"@purchasely/cordova-plugin-purchasely-google": "file:../../purchasely-google",
|
|
18
18
|
"cordova-android": "^14.0.1",
|
|
19
|
-
"cordova-ios": "^
|
|
20
|
-
"cordova-plugin-
|
|
21
|
-
"cordova-plugin-purchasely": "file
|
|
19
|
+
"cordova-ios": "^8.0.0",
|
|
20
|
+
"cordova-plugin-purchasely": "file:..",
|
|
21
|
+
"cordova-plugin-purchasely-google": "file:../../purchasely-google"
|
|
22
22
|
},
|
|
23
23
|
"cordova": {
|
|
24
24
|
"plugins": {
|
|
25
|
-
"@purchasely/cordova-plugin-
|
|
25
|
+
"@purchasely/cordova-plugin-purchasely": {},
|
|
26
|
+
"@purchasely/cordova-plugin-purchasely-google": {}
|
|
26
27
|
},
|
|
27
28
|
"platforms": [
|
|
29
|
+
"ios",
|
|
28
30
|
"android"
|
|
29
31
|
]
|
|
30
32
|
}
|
package/example/www/js/index.js
CHANGED
|
@@ -48,12 +48,14 @@ function onDeviceReady() {
|
|
|
48
48
|
Purchasely.LogLevel.DEBUG,
|
|
49
49
|
Purchasely.RunningMode.full,
|
|
50
50
|
(isConfigured) => {
|
|
51
|
-
if(isConfigured)
|
|
51
|
+
if(isConfigured) onPurchaselySdkReady();
|
|
52
52
|
},
|
|
53
53
|
(error) => {
|
|
54
54
|
console.log(error);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
Purchasely.setDebugMode(true);
|
|
58
|
+
|
|
57
59
|
Purchasely.setLanguage('en');
|
|
58
60
|
|
|
59
61
|
document.getElementById("openPresentation").addEventListener("click", openPresentation);
|
|
@@ -69,7 +71,7 @@ function onDeviceReady() {
|
|
|
69
71
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
function
|
|
74
|
+
function onPurchaselySdkReady() {
|
|
73
75
|
Purchasely.allProducts( products => {
|
|
74
76
|
console.log("Products " + products.length);
|
|
75
77
|
console.log("First product name: " + products[0].name);
|
|
@@ -172,7 +174,7 @@ function onPuchaselySdkReady() {
|
|
|
172
174
|
Purchasely.setUserAttributeWithInt("key_int", 7, Purchasely.DataProcessingLegalBasis.essential);
|
|
173
175
|
Purchasely.setUserAttributeWithDouble("key_double", 4.5, Purchasely.DataProcessingLegalBasis.essential);
|
|
174
176
|
Purchasely.setUserAttributeWithDate("key_date", new Date().toISOString(), Purchasely.DataProcessingLegalBasis.essential);
|
|
175
|
-
|
|
177
|
+
|
|
176
178
|
Purchasely.clearUserAttributes();
|
|
177
179
|
|
|
178
180
|
Purchasely.setUserAttributeWithString("key_string", "value_string");
|
|
@@ -252,6 +254,9 @@ function onPuchaselySdkReady() {
|
|
|
252
254
|
} else if (result.action === Purchasely.PaywallAction.close) {
|
|
253
255
|
console.log('User wants to close paywall - close reason ' + result.parameters.closeReason);
|
|
254
256
|
Purchasely.onProcessAction(true);
|
|
257
|
+
} else if (result.action === Purchasely.PaywallAction.close_all) {
|
|
258
|
+
console.log('User wants to close all paywalls');
|
|
259
|
+
Purchasely.onProcessAction(true);
|
|
255
260
|
} else if (result.action === Purchasely.PaywallAction.login) {
|
|
256
261
|
console.log('User wants to login');
|
|
257
262
|
//Present your own screen for user to log in
|
|
@@ -262,12 +267,19 @@ function onPuchaselySdkReady() {
|
|
|
262
267
|
} else if (result.action === Purchasely.PaywallAction.open_presentation) {
|
|
263
268
|
console.log('User wants to open a new paywall');
|
|
264
269
|
Purchasely.onProcessAction(true);
|
|
270
|
+
} else if (result.action === Purchasely.PaywallAction.open_placement) {
|
|
271
|
+
console.log('User wants to open a new placement');
|
|
272
|
+
Purchasely.onProcessAction(true);
|
|
265
273
|
} else if (result.action === Purchasely.PaywallAction.purchase) {
|
|
266
274
|
console.log('User wants to purchase');
|
|
267
275
|
//If you want to intercept it, close paywall and display your screen
|
|
268
276
|
Purchasely.hidePresentation();
|
|
269
|
-
} else if (result.action === Purchasely.PaywallAction.
|
|
270
|
-
console.log('User wants to
|
|
277
|
+
} else if (result.action === Purchasely.PaywallAction.web_checkout) {
|
|
278
|
+
console.log('User wants to proceed to web checkout');
|
|
279
|
+
console.log('web checkout url: ' + result.parameters.url);
|
|
280
|
+
console.log('web checkout provider: ' + result.parameters.webCheckoutProvider);
|
|
281
|
+
console.log('web checkout client reference id: ' + result.parameters.clientReferenceId);
|
|
282
|
+
console.log('web checkout query parameter key: ' + result.parameters.queryParameterKey);
|
|
271
283
|
Purchasely.onProcessAction(true);
|
|
272
284
|
} else {
|
|
273
285
|
console.log('Action unknown ' + result.action);
|
|
@@ -299,7 +311,7 @@ function openPresentation() {
|
|
|
299
311
|
|
|
300
312
|
function fetchPresentation() {
|
|
301
313
|
Purchasely.fetchPresentationForPlacement(
|
|
302
|
-
'
|
|
314
|
+
'flow_demo', //placementId
|
|
303
315
|
null, //contentId
|
|
304
316
|
(presentation) => {
|
|
305
317
|
console.log(safeStringify(presentation));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purchasely/cordova-plugin-purchasely",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.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="5.
|
|
2
|
+
<plugin id="@purchasely/cordova-plugin-purchasely" version="5.6.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" />
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<source url="https://github.com/CocoaPods/Specs.git"/>
|
|
39
39
|
</config>
|
|
40
40
|
<pods use-frameworks="true">
|
|
41
|
-
<pod name="Purchasely" spec="5.
|
|
41
|
+
<pod name="Purchasely" spec="5.6.0"/>
|
|
42
42
|
</pods>
|
|
43
43
|
</podspec>
|
|
44
44
|
</platform>
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
|
|
64
64
|
</activity>
|
|
65
65
|
</config-file>
|
|
66
|
-
<framework src="io.purchasely:core:5.
|
|
66
|
+
<framework src="io.purchasely:core:5.6.0" />
|
|
67
67
|
<source-file src="src/android/PurchaselyPlugin.kt" target-dir="java/cordova/plugin/purchasely" />
|
|
68
68
|
<source-file src="src/android/PLYProductActivity.kt" target-dir="java/cordova/plugin/purchasely" />
|
|
69
69
|
<source-file src="src/android/PLYSubscriptionsActivity.java" target-dir="src/cordova/plugin/purchasely" />
|
|
@@ -188,6 +188,7 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
188
188
|
"isEligibleForIntroOffer" -> isEligibleForIntroOffer(getStringFromJson(args.getString(0)), callbackContext)
|
|
189
189
|
"signPromotionalOffer" -> signPromotionalOffer(getStringFromJson(args.getString(0)), getStringFromJson(args.getString(1)), callbackContext)
|
|
190
190
|
"revokeDataProcessingConsent" -> revokeDataProcessingConsent(args.getJSONArray(0))
|
|
191
|
+
"setDebugMode" -> setDebugMode(args.getBoolean(0))
|
|
191
192
|
else -> return false
|
|
192
193
|
}
|
|
193
194
|
} catch (e: JSONException) {
|
|
@@ -779,6 +780,9 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
779
780
|
parametersForCordova["presentation"] = parameters.presentation
|
|
780
781
|
parametersForCordova["placement"] = parameters.placement
|
|
781
782
|
parametersForCordova["closeReason"] = parameters.closeReason?.name
|
|
783
|
+
parametersForCordova["clientReferenceId"] = parameters?.clientReferenceId
|
|
784
|
+
parametersForCordova["queryParameterKey"] = parameters?.queryParameterKey
|
|
785
|
+
parametersForCordova["webCheckoutProvider"] = parameters?.webCheckoutProvider?.name
|
|
782
786
|
|
|
783
787
|
val result = PluginResult(
|
|
784
788
|
PluginResult.Status.OK,
|
|
@@ -1066,6 +1070,9 @@ class PurchaselyPlugin : CordovaPlugin() {
|
|
|
1066
1070
|
Purchasely.revokeDataProcessingConsent(mappedPurposes)
|
|
1067
1071
|
}
|
|
1068
1072
|
|
|
1073
|
+
fun setDebugMode(enabled: Boolean) {
|
|
1074
|
+
Purchasely.debugMode = enabled
|
|
1075
|
+
}
|
|
1069
1076
|
|
|
1070
1077
|
class ProductActivity {
|
|
1071
1078
|
var presentationId: String? = null
|
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -625,7 +625,7 @@
|
|
|
625
625
|
}
|
|
626
626
|
[actionInterceptorResult setObject:paramsResult forKey:@"parameters"];
|
|
627
627
|
}
|
|
628
|
-
|
|
628
|
+
|
|
629
629
|
return actionInterceptorResult;
|
|
630
630
|
}
|
|
631
631
|
|
|
@@ -699,9 +699,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
699
699
|
NSString *key = [command argumentAtIndex:0];
|
|
700
700
|
NSArray<NSString *> *array = [command argumentAtIndex:1];
|
|
701
701
|
NSString *processingLegalBasisBasisArg = [command argumentAtIndex:2];
|
|
702
|
-
|
|
702
|
+
|
|
703
703
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
704
|
-
|
|
704
|
+
|
|
705
705
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
706
706
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
707
707
|
}
|
|
@@ -718,9 +718,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
718
718
|
for (id value in values) {
|
|
719
719
|
[boolArray addObject:@([value boolValue])];
|
|
720
720
|
}
|
|
721
|
-
|
|
721
|
+
|
|
722
722
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
723
|
-
|
|
723
|
+
|
|
724
724
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
725
725
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
726
726
|
}
|
|
@@ -737,9 +737,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
737
737
|
for (id val in values) {
|
|
738
738
|
[intArray addObject:@([val intValue])];
|
|
739
739
|
}
|
|
740
|
-
|
|
740
|
+
|
|
741
741
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
742
|
-
|
|
742
|
+
|
|
743
743
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
744
744
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
745
745
|
}
|
|
@@ -756,9 +756,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
756
756
|
for (id val in values) {
|
|
757
757
|
[doubleArray addObject:@([val doubleValue])];
|
|
758
758
|
}
|
|
759
|
-
|
|
759
|
+
|
|
760
760
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
761
|
-
|
|
761
|
+
|
|
762
762
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
763
763
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
764
764
|
}
|
|
@@ -770,9 +770,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
770
770
|
NSString *key = [command argumentAtIndex:0];
|
|
771
771
|
NSString *value = [command argumentAtIndex:1];
|
|
772
772
|
NSString *processingLegalBasisBasisArg = [command argumentAtIndex:2];
|
|
773
|
-
|
|
773
|
+
|
|
774
774
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
775
|
-
|
|
775
|
+
|
|
776
776
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
777
777
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
778
778
|
}
|
|
@@ -784,9 +784,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
784
784
|
NSString *key = [command argumentAtIndex:0];
|
|
785
785
|
BOOL value = [[command argumentAtIndex:1] boolValue];
|
|
786
786
|
NSString *processingLegalBasisBasisArg = [command argumentAtIndex:2];
|
|
787
|
-
|
|
787
|
+
|
|
788
788
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
789
|
-
|
|
789
|
+
|
|
790
790
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
791
791
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
792
792
|
}
|
|
@@ -798,9 +798,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
798
798
|
NSString *key = [command argumentAtIndex:0];
|
|
799
799
|
NSInteger value = [[command argumentAtIndex:1] intValue];
|
|
800
800
|
NSString *processingLegalBasisBasisArg = [command argumentAtIndex:2];
|
|
801
|
-
|
|
801
|
+
|
|
802
802
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
803
|
-
|
|
803
|
+
|
|
804
804
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
805
805
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
806
806
|
}
|
|
@@ -812,9 +812,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
812
812
|
NSString *key = [command argumentAtIndex:0];
|
|
813
813
|
double value = [[command argumentAtIndex:1] doubleValue];
|
|
814
814
|
NSString *processingLegalBasisBasisArg = [command argumentAtIndex:2];
|
|
815
|
-
|
|
815
|
+
|
|
816
816
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
817
|
-
|
|
817
|
+
|
|
818
818
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
819
819
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
820
820
|
}
|
|
@@ -831,9 +831,9 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
831
831
|
dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"GMT"];
|
|
832
832
|
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
|
|
833
833
|
NSDate *date = [dateFormatter dateFromString:value];
|
|
834
|
-
|
|
834
|
+
|
|
835
835
|
NSInteger processingLegalBasis = PLYDataProcessingLegalBasisOptional;
|
|
836
|
-
|
|
836
|
+
|
|
837
837
|
if ([processingLegalBasisBasisArg isEqualToString:@"ESSENTIAL"]) {
|
|
838
838
|
processingLegalBasis = PLYDataProcessingLegalBasisEssential;
|
|
839
839
|
}
|
|
@@ -991,6 +991,11 @@ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider
|
|
|
991
991
|
[Purchasely revokeDataProcessingConsentFor: purposesSet];
|
|
992
992
|
}
|
|
993
993
|
|
|
994
|
+
- (void)setDebugMode:(CDVInvokedUrlCommand*)command {
|
|
995
|
+
BOOL enabled = [[command argumentAtIndex:0] boolValue];
|
|
996
|
+
[Purchasely setDebugModeWithEnabled: enabled];
|
|
997
|
+
}
|
|
998
|
+
|
|
994
999
|
- (PLYPresentation *) findPresentationLoadedFor:(NSString * _Nullable) presentationId {
|
|
995
1000
|
for (PLYPresentation *presentationLoaded in self.presentationsLoaded) {
|
|
996
1001
|
if ([presentationLoaded.id isEqualToString: presentationId]) {
|
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 = "5.
|
|
8
|
+
cordovaSdkVersion = "5.6.0";
|
|
9
9
|
}
|
|
10
10
|
exec(success, error, 'Purchasely', 'start', [apiKey, stores, storekit1, userId, logLevel, runningMode, cordovaSdkVersion]);
|
|
11
11
|
};
|
|
@@ -226,6 +226,10 @@ exports.revokeDataProcessingConsent = function (purposes) {
|
|
|
226
226
|
exec(() => {}, defaultError, 'Purchasely', 'revokeDataProcessingConsent', [purposes]);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
exports.setDebugMode = function (enabled) {
|
|
230
|
+
exec(() => {}, defaultError, 'Purchasely', 'setDebugMode', [enabled]);
|
|
231
|
+
}
|
|
232
|
+
|
|
229
233
|
exports.LogLevel = {
|
|
230
234
|
DEBUG: 0,
|
|
231
235
|
INFO: 1,
|
|
@@ -300,13 +304,15 @@ exports.RunningMode = {
|
|
|
300
304
|
|
|
301
305
|
exports.PaywallAction = {
|
|
302
306
|
close: 'close',
|
|
307
|
+
close_all: 'close_all',
|
|
303
308
|
login: 'login',
|
|
304
309
|
navigate: 'navigate',
|
|
305
310
|
purchase: 'purchase',
|
|
306
311
|
restore: 'restore',
|
|
307
312
|
open_presentation: 'open_presentation',
|
|
308
|
-
|
|
313
|
+
open_placement: 'open_placement',
|
|
309
314
|
promo_code: 'promo_code',
|
|
315
|
+
web_checkout: 'web_checkout'
|
|
310
316
|
}
|
|
311
317
|
|
|
312
318
|
exports.ThemeMode = {
|