@purchasely/cordova-plugin-purchasely 4.4.0 → 5.3.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.
@@ -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
@@ -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
@@ -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
- NSInteger attribute = [[command argumentAtIndex:0] intValue];
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];
@@ -462,6 +550,9 @@
462
550
  case PLYPresentationActionClose:
463
551
  actionString = @"close";
464
552
  break;
553
+ case PLYPresentationActionCloseAll:
554
+ actionString = @"close_all";
555
+ break;
465
556
  case PLYPresentationActionRestore:
466
557
  actionString = @"restore";
467
558
  break;
@@ -474,6 +565,12 @@
474
565
  case PLYPresentationActionOpenPresentation:
475
566
  actionString = @"open_presentation";
476
567
  break;
568
+ case PLYPresentationActionOpenPlacement:
569
+ actionString = @"open_placement";
570
+ break;
571
+ case PLYPresentationActionWebCheckout:
572
+ actionString = @"web_checkout";
573
+ break;
477
574
  }
478
575
 
479
576
  [actionInterceptorResult setObject:actionString forKey:@"action"];
@@ -518,12 +615,31 @@
518
615
  [promoOffer setObject:params.promoOffer.storeOfferId forKey:@"storeOfferId"];
519
616
  [paramsResult setObject:promoOffer forKey:@"offer"];
520
617
  }
618
+ NSString *webCheckoutProviderString = PLYWebCheckoutProviderToString(params.webCheckoutProvider);
619
+ [paramsResult setObject:webCheckoutProviderString forKey:@"webCheckoutProvider"];
620
+ if (params.queryParameterKey != nil) {
621
+ [paramsResult setObject:params.queryParameterKey forKey:@"queryParameterKey"];
622
+ }
623
+ if (params.clientReferenceId != nil) {
624
+ [paramsResult setObject:params.clientReferenceId forKey:@"clientReferenceId"];
625
+ }
521
626
  [actionInterceptorResult setObject:paramsResult forKey:@"parameters"];
522
627
  }
523
-
628
+
524
629
  return actionInterceptorResult;
525
630
  }
526
631
 
632
+ static NSString * PLYWebCheckoutProviderToString(PLYWebCheckoutProvider provider) {
633
+ switch (provider) {
634
+ case PLYWebCheckoutProviderStripe:
635
+ return @"stripe";
636
+ case PLYWebCheckoutProviderOther:
637
+ return @"other";
638
+ default:
639
+ return @"unknown";
640
+ }
641
+ }
642
+
527
643
  - (void)setPaywallActionInterceptor:(CDVInvokedUrlCommand*)command {
528
644
  self.paywallActionInterceptorCommand = command;
529
645
  [Purchasely setPaywallActionsInterceptor:^(enum PLYPresentationAction action, PLYPresentationActionParameters * _Nullable parameters, PLYPresentationInfo * _Nullable infos, void (^ _Nonnull onProcessActionHandler)(BOOL)) {
@@ -579,6 +695,48 @@
579
695
  [Purchasely userDidConsumeSubscriptionContent];
580
696
  }
581
697
 
698
+ - (void)setUserAttributeWithStringArray:(CDVInvokedUrlCommand*)command {
699
+ NSString *key = [command argumentAtIndex:0];
700
+ NSArray<NSString *> *array = [command argumentAtIndex:1];
701
+ [Purchasely setUserAttributeWithStringArray:array forKey:key];
702
+ }
703
+
704
+ - (void)setUserAttributeWithBooleanArray:(CDVInvokedUrlCommand*)command {
705
+ NSString *key = [command argumentAtIndex:0];
706
+ NSArray *values = [command argumentAtIndex:1];
707
+
708
+ NSMutableArray<NSNumber *> *boolArray = [NSMutableArray array];
709
+ for (id value in values) {
710
+ [boolArray addObject:@([value boolValue])];
711
+ }
712
+
713
+ [Purchasely setUserAttributeWithBoolArray:boolArray forKey:key];
714
+ }
715
+
716
+ - (void)setUserAttributeWithIntArray:(CDVInvokedUrlCommand*)command {
717
+ NSString *key = [command argumentAtIndex:0];
718
+ NSArray *values = [command argumentAtIndex:1];
719
+
720
+ NSMutableArray<NSNumber *> *intArray = [NSMutableArray array];
721
+ for (id val in values) {
722
+ [intArray addObject:@([val intValue])];
723
+ }
724
+
725
+ [Purchasely setUserAttributeWithIntArray:intArray forKey:key];
726
+ }
727
+
728
+ - (void)setUserAttributeWithDoubleArray:(CDVInvokedUrlCommand*)command {
729
+ NSString *key = [command argumentAtIndex:0];
730
+ NSArray *values = [command argumentAtIndex:1];
731
+
732
+ NSMutableArray<NSNumber *> *doubleArray = [NSMutableArray array];
733
+ for (id val in values) {
734
+ [doubleArray addObject:@([val doubleValue])];
735
+ }
736
+
737
+ [Purchasely setUserAttributeWithDoubleArray:doubleArray forKey:key];
738
+ }
739
+
582
740
  - (void)setUserAttributeWithString:(CDVInvokedUrlCommand*)command {
583
741
  NSString *key = [command argumentAtIndex:0];
584
742
  NSString *value = [command argumentAtIndex:1];
@@ -650,6 +808,10 @@
650
808
  [Purchasely clearUserAttributes];
651
809
  }
652
810
 
811
+ - (void)clearBuiltInAttributes:(CDVInvokedUrlCommand*)command {
812
+ [Purchasely clearBuiltInAttributes];
813
+ }
814
+
653
815
  - (void)fetchPresentation:(CDVInvokedUrlCommand*)command {
654
816
  NSString *placementId = [command argumentAtIndex:0];
655
817
  NSString *presentationId = [command argumentAtIndex:1];
@@ -668,7 +830,7 @@
668
830
  if (self.purchaseResolve != nil){
669
831
  [self successFor:self.purchaseResolve resultDict:[self resultDictionaryForPresentationController:result plan:plan]];
670
832
  }
671
- }];
833
+ } loadedCompletion:nil];
672
834
  } else {
673
835
  [Purchasely fetchPresentationWith:presentationId contentId: contentId fetchCompletion:^(PLYPresentation * _Nullable presentation, NSError * _Nullable error) {
674
836
  if (error != nil) {
@@ -681,7 +843,7 @@
681
843
  if (self.purchaseResolve != nil) {
682
844
  [self successFor:self.purchaseResolve resultDict:[self resultDictionaryForPresentationController:result plan:plan]];
683
845
  }
684
- }];
846
+ } loadedCompletion:nil];
685
847
  }
686
848
  });
687
849
  }
@@ -726,7 +888,11 @@
726
888
  [Purchasely closeDisplayedPresentation];
727
889
  self.presentedPresentationViewController = presentationLoaded.controller;
728
890
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
729
- [Purchasely showController:presentationLoaded.controller type: PLYUIControllerTypeProductPage from:nil];
891
+ if (presentationLoaded.isFlow) {
892
+ [presentationLoaded displayFrom:nil];
893
+ } else {
894
+ [Purchasely showController:presentationLoaded.controller type: PLYUIControllerTypeProductPage from:nil];
895
+ }
730
896
  });
731
897
  }
732
898
  });
@@ -911,4 +1077,29 @@
911
1077
  }
912
1078
 
913
1079
 
1080
+ // WARNING: This enum must be strictly identical to the one in the JS side (Purchasely.js).
1081
+ typedef NS_ENUM(NSInteger, CordovaPLYAttribute) {
1082
+ CordovaPLYAttributeFirebaseAppInstanceId,
1083
+ CordovaPLYAttributeAirshipChannelId,
1084
+ CordovaPLYAttributeAirshipUserId,
1085
+ CordovaPLYAttributeBatchInstallationId,
1086
+ CordovaPLYAttributeAdjustId,
1087
+ CordovaPLYAttributeAppsflyerId,
1088
+ CordovaPLYAttributeMixpanelDistinctId,
1089
+ CordovaPLYAttributeCleverTapId,
1090
+ CordovaPLYAttributeSendinblueUserEmail,
1091
+ CordovaPLYAttributeIterableUserEmail,
1092
+ CordovaPLYAttributeIterableUserId,
1093
+ CordovaPLYAttributeAtInternetIdClient,
1094
+ CordovaPLYAttributeMParticleUserId,
1095
+ CordovaPLYAttributeCustomerioUserId,
1096
+ CordovaPLYAttributeCustomerioUserEmail,
1097
+ CordovaPLYAttributeBranchUserDeveloperIdentity,
1098
+ CordovaPLYAttributeAmplitudeUserId,
1099
+ CordovaPLYAttributeAmplitudeDeviceId,
1100
+ CordovaPLYAttributeMoengageUniqueId,
1101
+ CordovaPLYAttributeOneSignalExternalId,
1102
+ CordovaPLYAttributeBatchCustomUserId
1103
+ };
1104
+
914
1105
  @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 = "4.4.0";
8
+ cordovaSdkVersion = "5.3.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
- ONESIGNAL_PLAYER_ID: 6,
212
- MIXPANEL_DISTINCT_ID: 7,
213
- CLEVER_TAP_ID: 8,
214
- SENDINBLUE_USER_EMAIL: 9,
215
- ITERABLE_USER_EMAIL: 10,
216
- ITERABLE_USER_ID: 11,
217
- AT_INTERNET_ID_CLIENT: 12,
218
- MPARTICLE_USER_ID: 13,
219
- CUSTOMERIO_USER_ID: 14,
220
- CUSTOMERIO_USER_EMAIL: 15,
221
- BRANCH_USER_DEVELOPER_IDENTITY: 16,
222
- AMPLITUDE_USER_ID: 17,
223
- AMPLITUDE_DEVICE_ID: 18,
224
- MOENGAGE_UNIQUE_ID: 19,
225
- ONESIGNAL_EXTERNAL_ID: 20,
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
+ }