@purchasely/cordova-plugin-purchasely 4.4.0 → 5.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/example/android.sh +1 -1
- package/example/package-lock.json +242 -1052
- package/example/package.json +5 -5
- package/example/www/js/index.js +74 -5
- package/package.json +1 -1
- package/plugin.xml +5 -3
- package/src/android/PLYProductActivity.kt +7 -7
- package/src/android/PurchaselyPlugin.kt +204 -13
- package/src/ios/CDVPurchasely+UserAttributes.h +35 -0
- package/src/ios/CDVPurchasely+UserAttributes.m +144 -0
- package/src/ios/CDVPurchasely.h +9 -1
- package/src/ios/CDVPurchasely.m +163 -4
- package/www/Purchasely.js +49 -17
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CDVPurchasely+UserAttributes.m
|
|
3
|
+
// Purchasely Cordova Plugin
|
|
4
|
+
//
|
|
5
|
+
// Created by Florian HUET on 26/03/2025.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#import <Purchasely/Purchasely-Swift.h>
|
|
9
|
+
#import "CDVPurchasely+UserAttributes.h"
|
|
10
|
+
#import "Purchasely_Hybrid.h"
|
|
11
|
+
|
|
12
|
+
@implementation CDVPurchasely (UserAttributes)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
- (void)onUserAttributeSetWithKey:(NSString * _Nonnull)key
|
|
16
|
+
type:(enum PLYUserAttributeType)type
|
|
17
|
+
value:(id _Nullable)value
|
|
18
|
+
source:(enum PLYUserAttributeSource)source {
|
|
19
|
+
NSDictionary *attributeDic = [self dictionaryFromUserAttributeWithKey:key type:type value:value source:source];
|
|
20
|
+
|
|
21
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:attributeDic];
|
|
22
|
+
|
|
23
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
24
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.attributeCommand.callbackId];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
- (void)onUserAttributeRemovedWithKey:(NSString * _Nonnull)key
|
|
28
|
+
source:(enum PLYUserAttributeSource)source {
|
|
29
|
+
NSString *sourceString = [PLYUserAttributeSourceHelper stringFromUserAttributeSource:source];
|
|
30
|
+
|
|
31
|
+
NSMutableDictionary<NSString *, id> *attributeDic = [@{
|
|
32
|
+
@"action": @"remove",
|
|
33
|
+
@"key": key,
|
|
34
|
+
@"source": sourceString
|
|
35
|
+
} mutableCopy];
|
|
36
|
+
|
|
37
|
+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:attributeDic];
|
|
38
|
+
|
|
39
|
+
[pluginResult setKeepCallbackAsBool:YES];
|
|
40
|
+
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.attributeCommand.callbackId];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (NSDictionary<NSString *, id> *)dictionaryFromUserAttributeWithKey:(NSString * _Nonnull)key
|
|
44
|
+
type:(enum PLYUserAttributeType)type
|
|
45
|
+
value:(id _Nullable)value
|
|
46
|
+
source:(enum PLYUserAttributeSource)source {
|
|
47
|
+
NSString *typeString = [PLYUserAttributeTypeHelper stringFromUserAttributeType:type];
|
|
48
|
+
NSString *sourceString = [PLYUserAttributeSourceHelper stringFromUserAttributeSource:source];
|
|
49
|
+
|
|
50
|
+
NSMutableDictionary<NSString *, id> *attributeDic = [@{
|
|
51
|
+
@"action": @"add",
|
|
52
|
+
@"key": key,
|
|
53
|
+
@"type": typeString,
|
|
54
|
+
@"source": sourceString
|
|
55
|
+
} mutableCopy];
|
|
56
|
+
|
|
57
|
+
if (value) {
|
|
58
|
+
switch (type) {
|
|
59
|
+
case PLYUserAttributeTypeString:
|
|
60
|
+
if ([value isKindOfClass:[NSString class]]) {
|
|
61
|
+
attributeDic[@"value"] = value;
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
case PLYUserAttributeTypeBool:
|
|
65
|
+
if ([value isKindOfClass:[NSNumber class]]) {
|
|
66
|
+
attributeDic[@"value"] = @([(NSNumber *)value boolValue]);
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
case PLYUserAttributeTypeInt:
|
|
70
|
+
if ([value isKindOfClass:[NSNumber class]]) {
|
|
71
|
+
attributeDic[@"value"] = @([(NSNumber *)value intValue]);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
case PLYUserAttributeTypeDouble:
|
|
75
|
+
if ([value isKindOfClass:[NSNumber class]]) {
|
|
76
|
+
attributeDic[@"value"] = @([(NSNumber *)value doubleValue]);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case PLYUserAttributeTypeDate:
|
|
80
|
+
if ([value isKindOfClass:[NSDate class]]) {
|
|
81
|
+
attributeDic[@"value"] = [(NSDate *)value description]; // Convert to string
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case PLYUserAttributeTypeStringArray:
|
|
85
|
+
if ([value isKindOfClass:[NSArray class]]) {
|
|
86
|
+
attributeDic[@"value"] = value; // Ensure it's an NSArray of NSString
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case PLYUserAttributeTypeIntArray:
|
|
90
|
+
case PLYUserAttributeTypeDoubleArray:
|
|
91
|
+
case PLYUserAttributeTypeBoolArray:
|
|
92
|
+
if ([value isKindOfClass:[NSArray class]]) {
|
|
93
|
+
attributeDic[@"value"] = value; // Ensure it's an NSArray of NSNumber
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case PLYUserAttributeTypeDictionary:
|
|
97
|
+
if ([value isKindOfClass:[NSDictionary class]]) {
|
|
98
|
+
attributeDic[@"value"] = value; // Ensure it's an NSDictionary
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
attributeDic[@"value"] = @"unknown";
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return [attributeDic copy];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@end
|
|
112
|
+
|
|
113
|
+
@implementation PLYUserAttributeTypeHelper
|
|
114
|
+
|
|
115
|
+
+ (NSString *_Nullable)stringFromUserAttributeType:(PLYUserAttributeType)type {
|
|
116
|
+
switch (type) {
|
|
117
|
+
case PLYUserAttributeTypeString: return @"string";
|
|
118
|
+
case PLYUserAttributeTypeBool: return @"bool";
|
|
119
|
+
case PLYUserAttributeTypeInt: return @"int";
|
|
120
|
+
case PLYUserAttributeTypeDouble: return @"double";
|
|
121
|
+
case PLYUserAttributeTypeDate: return @"date";
|
|
122
|
+
case PLYUserAttributeTypeStringArray: return @"stringArray";
|
|
123
|
+
case PLYUserAttributeTypeIntArray: return @"intArray";
|
|
124
|
+
case PLYUserAttributeTypeDoubleArray: return @"doubleArray";
|
|
125
|
+
case PLYUserAttributeTypeBoolArray: return @"boolArray";
|
|
126
|
+
case PLYUserAttributeTypeDictionary: return @"dictionary";
|
|
127
|
+
case PLYUserAttributeTypeUnknown: return @"unknown";
|
|
128
|
+
default: return @"invalid";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@end
|
|
133
|
+
|
|
134
|
+
@implementation PLYUserAttributeSourceHelper
|
|
135
|
+
|
|
136
|
+
+ (NSString *_Nullable)stringFromUserAttributeSource:(PLYUserAttributeSource)source {
|
|
137
|
+
switch (source) {
|
|
138
|
+
case PLYUserAttributeSourcePurchasely: return @"purchasely";
|
|
139
|
+
case PLYUserAttributeSourceClient: return @"client";
|
|
140
|
+
default: return @"unknown";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@end
|
package/src/ios/CDVPurchasely.h
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
#import <Cordova/CDVPlugin.h>
|
|
9
9
|
#import <Purchasely/Purchasely-Swift.h>
|
|
10
10
|
|
|
11
|
-
@interface CDVPurchasely<PLYEventDelegate> : CDVPlugin {
|
|
11
|
+
@interface CDVPurchasely<PLYEventDelegate, PLYUserAttributeDelegate> : CDVPlugin {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
@property (nonatomic, retain) UIViewController* presentedPresentationViewController;
|
|
15
15
|
|
|
16
16
|
@property CDVInvokedUrlCommand* purchasedCommand;
|
|
17
17
|
@property CDVInvokedUrlCommand* eventCommand;
|
|
18
|
+
@property CDVInvokedUrlCommand* attributeCommand;
|
|
18
19
|
|
|
19
20
|
@property (nonatomic) NSMutableArray<PLYPresentation *> *presentationsLoaded;
|
|
20
21
|
@property (nonatomic, assign) Boolean shouldReopenPaywall;
|
|
@@ -56,17 +57,24 @@
|
|
|
56
57
|
- (void)hidePresentation:(CDVInvokedUrlCommand*)command;
|
|
57
58
|
- (void)showPresentation:(CDVInvokedUrlCommand*)command;
|
|
58
59
|
- (void)userDidConsumeSubscriptionContent:(CDVInvokedUrlCommand*)command;
|
|
60
|
+
- (void)setUserAttributeWithStringArray:(CDVInvokedUrlCommand*)command;
|
|
61
|
+
- (void)setUserAttributeWithIntArray:(CDVInvokedUrlCommand*)command;
|
|
62
|
+
- (void)setUserAttributeWithDoubleArray:(CDVInvokedUrlCommand*)command;
|
|
63
|
+
- (void)setUserAttributeWithBooleanArray:(CDVInvokedUrlCommand*)command;
|
|
59
64
|
- (void)setUserAttributeWithString:(CDVInvokedUrlCommand*)command;
|
|
60
65
|
- (void)setUserAttributeWithBoolean:(CDVInvokedUrlCommand*)command;
|
|
61
66
|
- (void)setUserAttributeWithInt:(CDVInvokedUrlCommand*)command;
|
|
67
|
+
- (void)setUserAttributeWithDouble:(CDVInvokedUrlCommand*)command;
|
|
62
68
|
- (void)setUserAttributeWithDate:(CDVInvokedUrlCommand*)command;
|
|
63
69
|
- (void)userAttribute:(CDVInvokedUrlCommand*)command;
|
|
64
70
|
- (void)clearUserAttribute:(CDVInvokedUrlCommand*)command;
|
|
65
71
|
- (void)clearUserAttributes:(CDVInvokedUrlCommand*)command;
|
|
72
|
+
- (void)clearBuiltInAttributes:(CDVInvokedUrlCommand*)command;
|
|
66
73
|
- (void)fetchPresentation:(CDVInvokedUrlCommand*)command;
|
|
67
74
|
- (void)presentPresentation:(CDVInvokedUrlCommand*)command;
|
|
68
75
|
- (void)signPromotionalOffer:(CDVInvokedUrlCommand*)command;
|
|
69
76
|
- (void)isEligibleForIntroOffer:(CDVInvokedUrlCommand*)command;
|
|
70
77
|
- (void)setThemeMode:(CDVInvokedUrlCommand*)command;
|
|
78
|
+
- (void)addUserAttributeListener:(CDVInvokedUrlCommand*)command;
|
|
71
79
|
|
|
72
80
|
@end
|
package/src/ios/CDVPurchasely.m
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
- (void)userLogout:(CDVInvokedUrlCommand*)command {
|
|
65
|
-
[Purchasely userLogout];
|
|
65
|
+
[Purchasely userLogout:YES];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
- (void)setThemeMode:(CDVInvokedUrlCommand *)command {
|
|
@@ -72,9 +72,87 @@
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
- (void)setAttribute:(CDVInvokedUrlCommand*)command {
|
|
75
|
-
|
|
75
|
+
NSNumber *attributeNumber = [command argumentAtIndex:0];
|
|
76
76
|
NSString *value = [command argumentAtIndex:1];
|
|
77
77
|
|
|
78
|
+
if (attributeNumber == nil || value == nil) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
NSInteger rawAttribute = [attributeNumber integerValue];
|
|
83
|
+
PLYAttribute *attribute = nil;
|
|
84
|
+
|
|
85
|
+
switch (rawAttribute) {
|
|
86
|
+
case CordovaPLYAttributeFirebaseAppInstanceId:
|
|
87
|
+
attribute = PLYAttributeFirebaseAppInstanceId;
|
|
88
|
+
break;
|
|
89
|
+
case CordovaPLYAttributeAirshipChannelId:
|
|
90
|
+
attribute = PLYAttributeAirshipChannelId;
|
|
91
|
+
break;
|
|
92
|
+
case CordovaPLYAttributeAirshipUserId:
|
|
93
|
+
attribute = PLYAttributeAirshipUserId;
|
|
94
|
+
break;
|
|
95
|
+
case CordovaPLYAttributeBatchInstallationId:
|
|
96
|
+
attribute = PLYAttributeBatchInstallationId;
|
|
97
|
+
break;
|
|
98
|
+
case CordovaPLYAttributeAdjustId:
|
|
99
|
+
attribute = PLYAttributeAdjustId;
|
|
100
|
+
break;
|
|
101
|
+
case CordovaPLYAttributeAppsflyerId:
|
|
102
|
+
attribute = PLYAttributeAppsflyerId;
|
|
103
|
+
break;
|
|
104
|
+
case CordovaPLYAttributeMixpanelDistinctId:
|
|
105
|
+
attribute = PLYAttributeMixpanelDistinctId;
|
|
106
|
+
break;
|
|
107
|
+
case CordovaPLYAttributeCleverTapId:
|
|
108
|
+
attribute = PLYAttributeClevertapId;
|
|
109
|
+
break;
|
|
110
|
+
case CordovaPLYAttributeSendinblueUserEmail:
|
|
111
|
+
attribute = PLYAttributeSendinblueUserEmail;
|
|
112
|
+
break;
|
|
113
|
+
case CordovaPLYAttributeIterableUserEmail:
|
|
114
|
+
attribute = PLYAttributeIterableUserEmail;
|
|
115
|
+
break;
|
|
116
|
+
case CordovaPLYAttributeIterableUserId:
|
|
117
|
+
attribute = PLYAttributeIterableUserId;
|
|
118
|
+
break;
|
|
119
|
+
case CordovaPLYAttributeAtInternetIdClient:
|
|
120
|
+
attribute = PLYAttributeAtInternetIdClient;
|
|
121
|
+
break;
|
|
122
|
+
case CordovaPLYAttributeMParticleUserId:
|
|
123
|
+
attribute = PLYAttributeMParticleUserId;
|
|
124
|
+
break;
|
|
125
|
+
case CordovaPLYAttributeCustomerioUserId:
|
|
126
|
+
attribute = PLYAttributeCustomerioUserId;
|
|
127
|
+
break;
|
|
128
|
+
case CordovaPLYAttributeCustomerioUserEmail:
|
|
129
|
+
attribute = PLYAttributeCustomerioUserEmail;
|
|
130
|
+
break;
|
|
131
|
+
case CordovaPLYAttributeBranchUserDeveloperIdentity:
|
|
132
|
+
attribute = PLYAttributeBranchUserDeveloperIdentity;
|
|
133
|
+
break;
|
|
134
|
+
case CordovaPLYAttributeAmplitudeUserId:
|
|
135
|
+
attribute = PLYAttributeAmplitudeUserId;
|
|
136
|
+
break;
|
|
137
|
+
case CordovaPLYAttributeAmplitudeDeviceId:
|
|
138
|
+
attribute = PLYAttributeAmplitudeDeviceId;
|
|
139
|
+
break;
|
|
140
|
+
case CordovaPLYAttributeMoengageUniqueId:
|
|
141
|
+
attribute = PLYAttributeMoengageUniqueId;
|
|
142
|
+
break;
|
|
143
|
+
case CordovaPLYAttributeOneSignalExternalId:
|
|
144
|
+
attribute = PLYAttributeOneSignalExternalId;
|
|
145
|
+
break;
|
|
146
|
+
case CordovaPLYAttributeBatchCustomUserId:
|
|
147
|
+
attribute = PLYAttributeBatchCustomUserId;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
if (attribute == nil) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
78
156
|
[Purchasely setAttribute:attribute value:value];
|
|
79
157
|
}
|
|
80
158
|
|
|
@@ -370,6 +448,16 @@
|
|
|
370
448
|
self.eventCommand = nil;
|
|
371
449
|
}
|
|
372
450
|
|
|
451
|
+
- (void)removeUserAttributeListener:(CDVInvokedUrlCommand*)command {
|
|
452
|
+
[Purchasely setUserAttributeDelegate:nil];
|
|
453
|
+
self.attributeCommand = nil;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
- (void)addUserAttributeListener:(CDVInvokedUrlCommand*)command {
|
|
457
|
+
[Purchasely setUserAttributeDelegate:self];
|
|
458
|
+
self.attributeCommand = command;
|
|
459
|
+
}
|
|
460
|
+
|
|
373
461
|
- (void)isDeeplinkHandled:(CDVInvokedUrlCommand*)command {
|
|
374
462
|
NSString *deeplinkString = [command argumentAtIndex:0];
|
|
375
463
|
NSURL *deeplink = [NSURL URLWithString:deeplinkString];
|
|
@@ -579,6 +667,48 @@
|
|
|
579
667
|
[Purchasely userDidConsumeSubscriptionContent];
|
|
580
668
|
}
|
|
581
669
|
|
|
670
|
+
- (void)setUserAttributeWithStringArray:(CDVInvokedUrlCommand*)command {
|
|
671
|
+
NSString *key = [command argumentAtIndex:0];
|
|
672
|
+
NSArray<NSString *> *array = [command argumentAtIndex:1];
|
|
673
|
+
[Purchasely setUserAttributeWithStringArray:array forKey:key];
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
- (void)setUserAttributeWithBooleanArray:(CDVInvokedUrlCommand*)command {
|
|
677
|
+
NSString *key = [command argumentAtIndex:0];
|
|
678
|
+
NSArray *values = [command argumentAtIndex:1];
|
|
679
|
+
|
|
680
|
+
NSMutableArray<NSNumber *> *boolArray = [NSMutableArray array];
|
|
681
|
+
for (id value in values) {
|
|
682
|
+
[boolArray addObject:@([value boolValue])];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
[Purchasely setUserAttributeWithBoolArray:boolArray forKey:key];
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
- (void)setUserAttributeWithIntArray:(CDVInvokedUrlCommand*)command {
|
|
689
|
+
NSString *key = [command argumentAtIndex:0];
|
|
690
|
+
NSArray *values = [command argumentAtIndex:1];
|
|
691
|
+
|
|
692
|
+
NSMutableArray<NSNumber *> *intArray = [NSMutableArray array];
|
|
693
|
+
for (id val in values) {
|
|
694
|
+
[intArray addObject:@([val intValue])];
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
[Purchasely setUserAttributeWithIntArray:intArray forKey:key];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
- (void)setUserAttributeWithDoubleArray:(CDVInvokedUrlCommand*)command {
|
|
701
|
+
NSString *key = [command argumentAtIndex:0];
|
|
702
|
+
NSArray *values = [command argumentAtIndex:1];
|
|
703
|
+
|
|
704
|
+
NSMutableArray<NSNumber *> *doubleArray = [NSMutableArray array];
|
|
705
|
+
for (id val in values) {
|
|
706
|
+
[doubleArray addObject:@([val doubleValue])];
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
[Purchasely setUserAttributeWithDoubleArray:doubleArray forKey:key];
|
|
710
|
+
}
|
|
711
|
+
|
|
582
712
|
- (void)setUserAttributeWithString:(CDVInvokedUrlCommand*)command {
|
|
583
713
|
NSString *key = [command argumentAtIndex:0];
|
|
584
714
|
NSString *value = [command argumentAtIndex:1];
|
|
@@ -650,6 +780,10 @@
|
|
|
650
780
|
[Purchasely clearUserAttributes];
|
|
651
781
|
}
|
|
652
782
|
|
|
783
|
+
- (void)clearBuiltInAttributes:(CDVInvokedUrlCommand*)command {
|
|
784
|
+
[Purchasely clearBuiltInAttributes];
|
|
785
|
+
}
|
|
786
|
+
|
|
653
787
|
- (void)fetchPresentation:(CDVInvokedUrlCommand*)command {
|
|
654
788
|
NSString *placementId = [command argumentAtIndex:0];
|
|
655
789
|
NSString *presentationId = [command argumentAtIndex:1];
|
|
@@ -668,7 +802,7 @@
|
|
|
668
802
|
if (self.purchaseResolve != nil){
|
|
669
803
|
[self successFor:self.purchaseResolve resultDict:[self resultDictionaryForPresentationController:result plan:plan]];
|
|
670
804
|
}
|
|
671
|
-
}];
|
|
805
|
+
} loadedCompletion:nil];
|
|
672
806
|
} else {
|
|
673
807
|
[Purchasely fetchPresentationWith:presentationId contentId: contentId fetchCompletion:^(PLYPresentation * _Nullable presentation, NSError * _Nullable error) {
|
|
674
808
|
if (error != nil) {
|
|
@@ -681,7 +815,7 @@
|
|
|
681
815
|
if (self.purchaseResolve != nil) {
|
|
682
816
|
[self successFor:self.purchaseResolve resultDict:[self resultDictionaryForPresentationController:result plan:plan]];
|
|
683
817
|
}
|
|
684
|
-
}];
|
|
818
|
+
} loadedCompletion:nil];
|
|
685
819
|
}
|
|
686
820
|
});
|
|
687
821
|
}
|
|
@@ -911,4 +1045,29 @@
|
|
|
911
1045
|
}
|
|
912
1046
|
|
|
913
1047
|
|
|
1048
|
+
// WARNING: This enum must be strictly identical to the one in the JS side (Purchasely.js).
|
|
1049
|
+
typedef NS_ENUM(NSInteger, CordovaPLYAttribute) {
|
|
1050
|
+
CordovaPLYAttributeFirebaseAppInstanceId,
|
|
1051
|
+
CordovaPLYAttributeAirshipChannelId,
|
|
1052
|
+
CordovaPLYAttributeAirshipUserId,
|
|
1053
|
+
CordovaPLYAttributeBatchInstallationId,
|
|
1054
|
+
CordovaPLYAttributeAdjustId,
|
|
1055
|
+
CordovaPLYAttributeAppsflyerId,
|
|
1056
|
+
CordovaPLYAttributeMixpanelDistinctId,
|
|
1057
|
+
CordovaPLYAttributeCleverTapId,
|
|
1058
|
+
CordovaPLYAttributeSendinblueUserEmail,
|
|
1059
|
+
CordovaPLYAttributeIterableUserEmail,
|
|
1060
|
+
CordovaPLYAttributeIterableUserId,
|
|
1061
|
+
CordovaPLYAttributeAtInternetIdClient,
|
|
1062
|
+
CordovaPLYAttributeMParticleUserId,
|
|
1063
|
+
CordovaPLYAttributeCustomerioUserId,
|
|
1064
|
+
CordovaPLYAttributeCustomerioUserEmail,
|
|
1065
|
+
CordovaPLYAttributeBranchUserDeveloperIdentity,
|
|
1066
|
+
CordovaPLYAttributeAmplitudeUserId,
|
|
1067
|
+
CordovaPLYAttributeAmplitudeDeviceId,
|
|
1068
|
+
CordovaPLYAttributeMoengageUniqueId,
|
|
1069
|
+
CordovaPLYAttributeOneSignalExternalId,
|
|
1070
|
+
CordovaPLYAttributeBatchCustomUserId
|
|
1071
|
+
};
|
|
1072
|
+
|
|
914
1073
|
@end
|
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 = "
|
|
8
|
+
cordovaSdkVersion = "5.1.0";
|
|
9
9
|
}
|
|
10
10
|
exec(success, error, 'Purchasely', 'start', [apiKey, stores, storekit1, userId, logLevel, runningMode, cordovaSdkVersion]);
|
|
11
11
|
};
|
|
@@ -14,6 +14,14 @@ exports.addEventsListener = function (success, error) {
|
|
|
14
14
|
exec(success, error, 'Purchasely', 'addEventsListener', []);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
exports.addUserAttributeListener = function(success, error) {
|
|
18
|
+
exec(success, error, 'Purchasely', 'addUserAttributeListener', []);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.removeUserAttributeListener = function () {
|
|
22
|
+
exec(() => {}, defaultError, 'Purchasely', 'removeUserAttributeListener', []);
|
|
23
|
+
};
|
|
24
|
+
|
|
17
25
|
exports.removeEventsListener = function () {
|
|
18
26
|
exec(() => {}, defaultError, 'Purchasely', 'removeEventsListener', []);
|
|
19
27
|
};
|
|
@@ -170,6 +178,22 @@ exports.setUserAttributeWithDate = function (key, value) {
|
|
|
170
178
|
exec(() => {}, defaultError, 'Purchasely', 'setUserAttributeWithDate', [key, value]);
|
|
171
179
|
};
|
|
172
180
|
|
|
181
|
+
exports.setUserAttributeWithStringArray = function (key, value) {
|
|
182
|
+
exec(() => {}, defaultError, 'Purchasely', 'setUserAttributeWithStringArray', [key, value]);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
exports.setUserAttributeWithIntArray = function (key, value) {
|
|
186
|
+
exec(() => {}, defaultError, 'Purchasely', 'setUserAttributeWithIntArray', [key, value]);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
exports.setUserAttributeWithDoubleArray = function (key, value) {
|
|
190
|
+
exec(() => {}, defaultError, 'Purchasely', 'setUserAttributeWithDoubleArray', [key, value]);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
exports.setUserAttributeWithBooleanArray = function (key, value) {
|
|
194
|
+
exec(() => {}, defaultError, 'Purchasely', 'setUserAttributeWithBooleanArray', [key, value]);
|
|
195
|
+
}
|
|
196
|
+
|
|
173
197
|
exports.userAttribute = function (key, success, error) {
|
|
174
198
|
exec(success, error, 'Purchasely', 'userAttribute', [key]);
|
|
175
199
|
};
|
|
@@ -182,6 +206,10 @@ exports.clearUserAttributes = function () {
|
|
|
182
206
|
exec(() => {}, defaultError, 'Purchasely', 'clearUserAttributes', []);
|
|
183
207
|
};
|
|
184
208
|
|
|
209
|
+
exports.clearBuiltInAttributes = function () {
|
|
210
|
+
exec(() => {}, defaultError, 'Purchasely', 'clearBuiltInAttributes', []);
|
|
211
|
+
}
|
|
212
|
+
|
|
185
213
|
exports.isEligibleForIntroOffer = function (planId, success, error) {
|
|
186
214
|
exec(success, error, 'Purchasely', 'isEligibleForIntroOffer', [planId]);
|
|
187
215
|
};
|
|
@@ -208,22 +236,21 @@ exports.Attribute = {
|
|
|
208
236
|
BATCH_INSTALLATION_ID: 3,
|
|
209
237
|
ADJUST_ID: 4,
|
|
210
238
|
APPSFLYER_ID: 5,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
BATCH_CUSTOM_USER_ID: 21,
|
|
239
|
+
MIXPANEL_DISTINCT_ID: 6,
|
|
240
|
+
CLEVER_TAP_ID: 7,
|
|
241
|
+
SENDINBLUE_USER_EMAIL: 8,
|
|
242
|
+
ITERABLE_USER_EMAIL: 9,
|
|
243
|
+
ITERABLE_USER_ID: 10,
|
|
244
|
+
AT_INTERNET_ID_CLIENT: 11,
|
|
245
|
+
MPARTICLE_USER_ID: 12,
|
|
246
|
+
CUSTOMERIO_USER_ID: 13,
|
|
247
|
+
CUSTOMERIO_USER_EMAIL: 14,
|
|
248
|
+
BRANCH_USER_DEVELOPER_IDENTITY: 15,
|
|
249
|
+
AMPLITUDE_USER_ID: 16,
|
|
250
|
+
AMPLITUDE_DEVICE_ID: 17,
|
|
251
|
+
MOENGAGE_UNIQUE_ID: 18,
|
|
252
|
+
ONESIGNAL_EXTERNAL_ID: 19,
|
|
253
|
+
BATCH_CUSTOM_USER_ID: 20,
|
|
227
254
|
}
|
|
228
255
|
|
|
229
256
|
exports.PurchaseResult = {
|
|
@@ -270,3 +297,8 @@ exports.ThemeMode = {
|
|
|
270
297
|
dark: 1,
|
|
271
298
|
system: 2
|
|
272
299
|
}
|
|
300
|
+
|
|
301
|
+
exports.UserAttributeAction = {
|
|
302
|
+
ADD: 'add',
|
|
303
|
+
REMOVE: 'remove'
|
|
304
|
+
}
|