react-native-mparticle 2.9.2 → 3.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.
Files changed (34) hide show
  1. package/README.md +51 -4
  2. package/android/build.gradle +2 -2
  3. package/android/gradle.properties +1 -1
  4. package/android/src/main/java/com/mparticle/react/rokt/MPRoktModuleImpl.kt +27 -0
  5. package/android/src/newarch/java/com/mparticle/react/rokt/MPRoktModule.kt +30 -4
  6. package/android/src/oldarch/java/com/mparticle/react/NativeMPRoktSpec.kt +16 -0
  7. package/android/src/oldarch/java/com/mparticle/react/rokt/MPRoktModule.kt +28 -0
  8. package/ios/RNMParticle/RNMPRokt.mm +138 -91
  9. package/ios/RNMParticle/RNMParticle.mm +18 -24
  10. package/ios/RNMParticle/RoktEventManager.h +3 -2
  11. package/ios/RNMParticle/RoktEventManager.m +71 -33
  12. package/ios/RNMParticle/RoktLayoutManager.m +7 -2
  13. package/ios/RNMParticle/RoktNativeLayoutComponentView.h +11 -2
  14. package/ios/RNMParticle/RoktNativeLayoutComponentView.mm +2 -2
  15. package/js/codegenSpecs/NativeMParticle.ts +1 -4
  16. package/js/codegenSpecs/rokt/NativeMPRokt.ts +12 -0
  17. package/js/rokt/rokt.ts +20 -0
  18. package/lib/codegenSpecs/NativeMParticle.js.map +1 -1
  19. package/lib/codegenSpecs/rokt/NativeMPRokt.d.ts +6 -0
  20. package/lib/codegenSpecs/rokt/NativeMPRokt.js.map +1 -1
  21. package/lib/rokt/rokt.d.ts +4 -0
  22. package/lib/rokt/rokt.js +12 -0
  23. package/lib/rokt/rokt.js.map +1 -1
  24. package/package.json +5 -3
  25. package/plugin/build/customBaseUrl.d.ts +4 -0
  26. package/plugin/build/customBaseUrl.js +22 -0
  27. package/plugin/build/withMParticle.d.ts +6 -0
  28. package/plugin/build/withMParticleAndroid.js +39 -10
  29. package/plugin/build/withMParticleIOS.js +34 -3
  30. package/plugin/src/customBaseUrl.ts +31 -0
  31. package/plugin/src/withMParticle.ts +7 -0
  32. package/plugin/src/withMParticleAndroid.ts +49 -10
  33. package/plugin/src/withMParticleIOS.ts +48 -3
  34. package/react-native-mparticle.podspec +4 -3
@@ -1,18 +1,12 @@
1
1
  #import "RNMParticle.h"
2
2
  #import <React/RCTConvert.h>
3
- #if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
3
+ // SDK 9.0: ObjC headers moved to mParticle_Apple_SDK_ObjC module
4
+ #if defined(__has_include) && __has_include(<mParticle_Apple_SDK_ObjC/mParticle.h>)
5
+ #import <mParticle_Apple_SDK_ObjC/mParticle.h>
6
+ #elif defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
4
7
  #import <mParticle_Apple_SDK/mParticle.h>
5
- #elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
6
- #import <mParticle_Apple_SDK_NoLocation/mParticle.h>
7
8
  #else
8
- #import <mParticle_Apple_SDK/Include/mParticle.h>
9
- #endif
10
- #if defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle_Apple_SDK-Swift.h>)
11
- #import <mParticle_Apple_SDK/mParticle_Apple_SDK-Swift.h>
12
- #elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle_Apple_SDK-Swift.h>)
13
- #import <mParticle_Apple_SDK_NoLocation/mParticle_Apple_SDK-Swift.h>
14
- #else
15
- #import "mParticle_Apple_SDK-Swift.h"
9
+ #import <mParticle_Apple_SDK_ObjC/mParticle.h>
16
10
  #endif
17
11
  #import <React/RCTConvert.h>
18
12
 
@@ -44,8 +38,8 @@ RCT_EXPORT_METHOD(upload)
44
38
 
45
39
  RCT_EXPORT_METHOD(setLocation:(double)latitude longitude:(double)longitude)
46
40
  {
47
- CLLocation *newLocation = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude];
48
- [MParticle sharedInstance].location = newLocation;
41
+ // Location support was removed in mParticle Apple SDK 9.0
42
+ NSLog(@"[RNMParticle] setLocation is a no-op in mParticle SDK 9.0+");
49
43
  }
50
44
 
51
45
  RCT_EXPORT_METHOD(setUploadInterval:(double)uploadInterval)
@@ -204,8 +198,8 @@ RCT_EXPORT_METHOD(identify:(MPIdentityApiRequest *)identityRequest completion:(R
204
198
  [reactError setObject:[NSNumber numberWithLong:response.httpCode] forKey:@"httpCode"];
205
199
  }
206
200
 
207
- if ([NSNumber numberWithInt:response.code] != nil) {
208
- [reactError setObject:[NSNumber numberWithInt:response.code] forKey:@"responseCode"];
201
+ if ([NSNumber numberWithInteger:response.code] != nil) {
202
+ [reactError setObject:[NSNumber numberWithInteger:response.code] forKey:@"responseCode"];
209
203
  }
210
204
 
211
205
  if (response.message != nil) {
@@ -238,8 +232,8 @@ RCT_EXPORT_METHOD(login:(MPIdentityApiRequest *)identityRequest completion:(RCTR
238
232
  [reactError setObject:[NSNumber numberWithLong:response.httpCode] forKey:@"httpCode"];
239
233
  }
240
234
 
241
- if ([NSNumber numberWithInt:response.code] != nil) {
242
- [reactError setObject:[NSNumber numberWithInt:response.code] forKey:@"responseCode"];
235
+ if ([NSNumber numberWithInteger:response.code] != nil) {
236
+ [reactError setObject:[NSNumber numberWithInteger:response.code] forKey:@"responseCode"];
243
237
  }
244
238
 
245
239
  if (response.message != nil) {
@@ -272,8 +266,8 @@ RCT_EXPORT_METHOD(logout:(MPIdentityApiRequest *)identityRequest completion:(RCT
272
266
  [reactError setObject:[NSNumber numberWithLong:response.httpCode] forKey:@"httpCode"];
273
267
  }
274
268
 
275
- if ([NSNumber numberWithInt:response.code] != nil) {
276
- [reactError setObject:[NSNumber numberWithInt:response.code] forKey:@"responseCode"];
269
+ if ([NSNumber numberWithInteger:response.code] != nil) {
270
+ [reactError setObject:[NSNumber numberWithInteger:response.code] forKey:@"responseCode"];
277
271
  }
278
272
 
279
273
  if (response.message != nil) {
@@ -306,8 +300,8 @@ RCT_EXPORT_METHOD(modify:(MPIdentityApiRequest *)identityRequest completion:(RCT
306
300
  [reactError setObject:[NSNumber numberWithLong:response.httpCode] forKey:@"httpCode"];
307
301
  }
308
302
 
309
- if ([NSNumber numberWithInt:response.code] != nil) {
310
- [reactError setObject:[NSNumber numberWithInt:response.code] forKey:@"responseCode"];
303
+ if ([NSNumber numberWithInteger:response.code] != nil) {
304
+ [reactError setObject:[NSNumber numberWithInteger:response.code] forKey:@"responseCode"];
311
305
  }
312
306
 
313
307
  if (response.message != nil) {
@@ -684,8 +678,8 @@ RCT_EXPORT_METHOD(setCCPAConsentState:(MPCCPAConsent *)consent)
684
678
  if ([NSNumber numberWithLong:response.httpCode] != nil) {
685
679
  [reactError setObject:[NSNumber numberWithLong:response.httpCode] forKey:@"httpCode"];
686
680
  }
687
- if ([NSNumber numberWithInt:response.code] != nil) {
688
- [reactError setObject:[NSNumber numberWithInt:response.code] forKey:@"responseCode"];
681
+ if ([NSNumber numberWithInteger:response.code] != nil) {
682
+ [reactError setObject:[NSNumber numberWithInteger:response.code] forKey:@"responseCode"];
689
683
  }
690
684
  if (response.message != nil) {
691
685
  [reactError setObject:response.message forKey:@"message"];
@@ -1165,7 +1159,7 @@ typedef NS_ENUM(NSUInteger, MPReactCommerceEventAction) {
1165
1159
  event.category = json[@"category"];
1166
1160
  event.duration = json[@"duration"];
1167
1161
  event.endTime = json[@"endTime"];
1168
- event.info = json[@"info"];
1162
+ event.customAttributes = json[@"info"];
1169
1163
  event.name = json[@"name"];
1170
1164
  event.startTime = json[@"startTime"];
1171
1165
  [event setType:(MPEventType)[json[@"type"] intValue]];
@@ -1,6 +1,7 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTEventEmitter.h>
3
- #import <mParticle_Apple_SDK/MPRokt.h>
3
+
4
+ @class RoktEvent;
4
5
 
5
6
  NS_ASSUME_NONNULL_BEGIN
6
7
 
@@ -9,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN
9
10
  - (void)onWidgetHeightChanges:(CGFloat)widgetHeight placement:(NSString * _Nonnull)selectedPlacement;
10
11
  - (void)onFirstPositiveResponse;
11
12
  - (void)onRoktCallbackReceived:(NSString * _Nonnull)eventValue;
12
- - (void)onRoktEvents:(MPRoktEvent * _Nonnull)event viewName:(NSString * _Nullable)viewName;
13
+ - (void)onRoktEvents:(RoktEvent * _Nonnull)event viewName:(NSString * _Nullable)viewName;
13
14
 
14
15
  @end
15
16
 
@@ -1,5 +1,5 @@
1
1
  #import "RoktEventManager.h"
2
- #import <mParticle_Apple_SDK/mParticle_Apple_SDK-Swift.h>
2
+ @import RoktContracts;
3
3
  #import <os/log.h>
4
4
 
5
5
  static os_log_t _rokt_events_os_log(void) {
@@ -78,7 +78,7 @@ RCT_EXPORT_MODULE(RoktEventManager);
78
78
  }
79
79
  }
80
80
 
81
- - (void)onRoktEvents:(MPRoktEvent * _Nonnull)event viewName:(NSString * _Nullable)viewName
81
+ - (void)onRoktEvents:(RoktEvent * _Nonnull)event viewName:(NSString * _Nullable)viewName
82
82
  {
83
83
  NSString *eventClass = event ? NSStringFromClass([event class]) : @"nil";
84
84
  _rokt_events_log(@"[mParticle-Rokt] RoktEventManager onRoktEvents: %@ viewName: %@", eventClass, viewName ?: @"(nil)");
@@ -96,60 +96,92 @@ RCT_EXPORT_MODULE(RoktEventManager);
96
96
  NSDecimalNumber *quantity;
97
97
  NSDecimalNumber *totalPrice;
98
98
  NSDecimalNumber *unitPrice;
99
-
100
- if ([event isKindOfClass:[MPRoktShowLoadingIndicator class]]) {
99
+ NSString *error;
100
+ NSString *paymentProvider;
101
+
102
+ if ([event isKindOfClass:[RoktShowLoadingIndicator class]]) {
101
103
  eventName = @"ShowLoadingIndicator";
102
- } else if ([event isKindOfClass:[MPRoktHideLoadingIndicator class]]) {
104
+ [self onRoktCallbackReceived:@"onShouldShowLoadingIndicator"];
105
+ } else if ([event isKindOfClass:[RoktHideLoadingIndicator class]]) {
103
106
  eventName = @"HideLoadingIndicator";
104
- } else if ([event isKindOfClass:[MPRoktPlacementInteractive class]]) {
105
- placementId = ((MPRoktPlacementInteractive *)event).placementId;
107
+ [self onRoktCallbackReceived:@"onShouldHideLoadingIndicator"];
108
+ } else if ([event isKindOfClass:[RoktPlacementInteractive class]]) {
109
+ placementId = ((RoktPlacementInteractive *)event).identifier;
106
110
  eventName = @"PlacementInteractive";
107
- } else if ([event isKindOfClass:[MPRoktPlacementReady class]]) {
108
- placementId = ((MPRoktPlacementReady *)event).placementId;
111
+ } else if ([event isKindOfClass:[RoktPlacementReady class]]) {
112
+ placementId = ((RoktPlacementReady *)event).identifier;
109
113
  eventName = @"PlacementReady";
110
- } else if ([event isKindOfClass:[MPRoktOfferEngagement class]]) {
111
- placementId = ((MPRoktOfferEngagement *)event).placementId;
114
+ [self onRoktCallbackReceived:@"onLoad"];
115
+ } else if ([event isKindOfClass:[RoktOfferEngagement class]]) {
116
+ placementId = ((RoktOfferEngagement *)event).identifier;
112
117
  eventName = @"OfferEngagement";
113
- } else if ([event isKindOfClass:[MPRoktPositiveEngagement class]]) {
114
- placementId = ((MPRoktPositiveEngagement *)event).placementId;
118
+ } else if ([event isKindOfClass:[RoktPositiveEngagement class]]) {
119
+ placementId = ((RoktPositiveEngagement *)event).identifier;
115
120
  eventName = @"PositiveEngagement";
116
- } else if ([event isKindOfClass:[MPRoktPlacementClosed class]]) {
117
- placementId = ((MPRoktPlacementClosed *)event).placementId;
121
+ } else if ([event isKindOfClass:[RoktPlacementClosed class]]) {
122
+ placementId = ((RoktPlacementClosed *)event).identifier;
118
123
  eventName = @"PlacementClosed";
119
- } else if ([event isKindOfClass:[MPRoktPlacementCompleted class]]) {
120
- placementId = ((MPRoktPlacementCompleted *)event).placementId;
124
+ [self onRoktCallbackReceived:@"onUnLoad"];
125
+ } else if ([event isKindOfClass:[RoktPlacementCompleted class]]) {
126
+ placementId = ((RoktPlacementCompleted *)event).identifier;
121
127
  eventName = @"PlacementCompleted";
122
- } else if ([event isKindOfClass:[MPRoktPlacementFailure class]]) {
123
- placementId = ((MPRoktPlacementFailure *)event).placementId;
128
+ } else if ([event isKindOfClass:[RoktPlacementFailure class]]) {
129
+ placementId = ((RoktPlacementFailure *)event).identifier;
124
130
  eventName = @"PlacementFailure";
125
- } else if ([event isKindOfClass:[MPRoktFirstPositiveEngagement class]]) {
126
- placementId = ((MPRoktFirstPositiveEngagement *)event).placementId;
131
+ } else if ([event isKindOfClass:[RoktFirstPositiveEngagement class]]) {
132
+ placementId = ((RoktFirstPositiveEngagement *)event).identifier;
127
133
  eventName = @"FirstPositiveEngagement";
128
- } else if ([event isKindOfClass:[MPRoktInitComplete class]]) {
134
+ } else if ([event isKindOfClass:[RoktInitComplete class]]) {
129
135
  eventName = @"InitComplete";
130
- status = ((MPRoktInitComplete *)event).success ? @"true" : @"false";
131
- } else if ([event isKindOfClass:[MPRoktOpenUrl class]]) {
136
+ status = ((RoktInitComplete *)event).success ? @"true" : @"false";
137
+ } else if ([event isKindOfClass:[RoktOpenUrl class]]) {
132
138
  eventName = @"OpenUrl";
133
- placementId = ((MPRoktOpenUrl *)event).placementId;
134
- url = ((MPRoktOpenUrl *)event).url;
135
- } else if ([event isKindOfClass:[MPRoktCartItemInstantPurchase class]]) {
136
- MPRoktCartItemInstantPurchase *cartEvent = (MPRoktCartItemInstantPurchase *)event;
139
+ placementId = ((RoktOpenUrl *)event).identifier;
140
+ url = ((RoktOpenUrl *)event).url;
141
+ } else if ([event isKindOfClass:[RoktEmbeddedSizeChanged class]]) {
142
+ RoktEmbeddedSizeChanged *sizeEvent = (RoktEmbeddedSizeChanged *)event;
143
+ placementId = sizeEvent.identifier;
144
+ eventName = @"EmbeddedSizeChanged";
145
+ [self onWidgetHeightChanges:sizeEvent.updatedHeight placement:sizeEvent.identifier];
146
+ } else if ([event isKindOfClass:[RoktCartItemInstantPurchase class]]) {
147
+ RoktCartItemInstantPurchase *cartEvent = (RoktCartItemInstantPurchase *)event;
137
148
  eventName = @"CartItemInstantPurchase";
138
- // Required properties
139
- placementId = cartEvent.placementId;
149
+ placementId = cartEvent.identifier;
140
150
  cartItemId = cartEvent.cartItemId;
141
151
  catalogItemId = cartEvent.catalogItemId;
142
152
  currency = cartEvent.currency;
143
153
  providerData = cartEvent.providerData;
144
- // Optional properties
145
154
  linkedProductId = cartEvent.linkedProductId;
146
- // Overridden description property
147
155
  itemDescription = cartEvent.description;
148
- // Decimal properties
149
156
  quantity = cartEvent.quantity;
150
157
  totalPrice = cartEvent.totalPrice;
151
158
  unitPrice = cartEvent.unitPrice;
159
+ } else if ([event isKindOfClass:[RoktCartItemInstantPurchaseInitiated class]]) {
160
+ RoktCartItemInstantPurchaseInitiated *initiatedEvent = (RoktCartItemInstantPurchaseInitiated *)event;
161
+ eventName = @"CartItemInstantPurchaseInitiated";
162
+ placementId = initiatedEvent.identifier;
163
+ catalogItemId = initiatedEvent.catalogItemId;
164
+ cartItemId = initiatedEvent.cartItemId;
165
+ } else if ([event isKindOfClass:[RoktCartItemInstantPurchaseFailure class]]) {
166
+ RoktCartItemInstantPurchaseFailure *failureEvent = (RoktCartItemInstantPurchaseFailure *)event;
167
+ eventName = @"CartItemInstantPurchaseFailure";
168
+ placementId = failureEvent.identifier;
169
+ catalogItemId = failureEvent.catalogItemId;
170
+ cartItemId = failureEvent.cartItemId;
171
+ error = failureEvent.error;
172
+ } else if ([event isKindOfClass:[RoktInstantPurchaseDismissal class]]) {
173
+ RoktInstantPurchaseDismissal *dismissalEvent = (RoktInstantPurchaseDismissal *)event;
174
+ eventName = @"InstantPurchaseDismissal";
175
+ placementId = dismissalEvent.identifier;
176
+ } else if ([event isKindOfClass:[RoktCartItemDevicePay class]]) {
177
+ RoktCartItemDevicePay *devicePayEvent = (RoktCartItemDevicePay *)event;
178
+ eventName = @"CartItemDevicePay";
179
+ placementId = devicePayEvent.identifier;
180
+ catalogItemId = devicePayEvent.catalogItemId;
181
+ cartItemId = devicePayEvent.cartItemId;
182
+ paymentProvider = devicePayEvent.paymentProvider;
152
183
  }
184
+
153
185
  NSMutableDictionary *payload = [@{@"event": eventName} mutableCopy];
154
186
  if (viewName != nil) {
155
187
  [payload setObject:viewName forKey:@"viewName"];
@@ -190,6 +222,12 @@ RCT_EXPORT_MODULE(RoktEventManager);
190
222
  if (unitPrice != nil) {
191
223
  [payload setObject:unitPrice forKey:@"unitPrice"];
192
224
  }
225
+ if (error != nil) {
226
+ [payload setObject:error forKey:@"error"];
227
+ }
228
+ if (paymentProvider != nil) {
229
+ [payload setObject:paymentProvider forKey:@"paymentProvider"];
230
+ }
193
231
 
194
232
  [self sendEventWithName:@"RoktEvents" body:payload];
195
233
  }
@@ -1,6 +1,11 @@
1
1
  #import <Foundation/Foundation.h>
2
2
  #import <React/RCTViewManager.h>
3
- #import <mParticle_Apple_SDK/MPRokt.h>
3
+ #if defined(__has_include) && __has_include(<mParticle_Apple_SDK_ObjC/MPRokt.h>)
4
+ #import <mParticle_Apple_SDK_ObjC/MPRokt.h>
5
+ #else
6
+ #import <mParticle_Apple_SDK/MPRokt.h>
7
+ #endif
8
+ @import RoktContracts;
4
9
 
5
10
  @interface RoktLayoutViewManager : RCTViewManager
6
11
  @end
@@ -11,7 +16,7 @@ RCT_EXPORT_MODULE(RoktLegacyLayout)
11
16
 
12
17
  - (UIView *)view
13
18
  {
14
- return [[MPRoktEmbeddedView alloc] init];
19
+ return [[RoktEmbeddedView alloc] init];
15
20
  }
16
21
 
17
22
  + (BOOL)requiresMainQueueSetup
@@ -2,7 +2,16 @@
2
2
  #import <SafariServices/SafariServices.h>
3
3
  #import <React/RCTViewComponentView.h>
4
4
  #import <UIKit/UIKit.h>
5
- #import <mParticle_Apple_SDK/MPRokt.h>
5
+ #if defined(__has_include) && __has_include(<mParticle_Apple_SDK_ObjC/MPRokt.h>)
6
+ #import <mParticle_Apple_SDK_ObjC/MPRokt.h>
7
+ #else
8
+ #import <mParticle_Apple_SDK/MPRokt.h>
9
+ #endif
10
+ #if __has_include(<RoktContracts/RoktContracts-Swift.h>)
11
+ #import <RoktContracts/RoktContracts-Swift.h>
12
+ #elif __has_include(<RoktContracts/RoktContracts.h>)
13
+ #import <RoktContracts/RoktContracts.h>
14
+ #endif
6
15
 
7
16
  #ifndef RoktNativeLayoutComponentView_h
8
17
  #define RoktNativeLayoutComponentView_h
@@ -10,7 +19,7 @@
10
19
  NS_ASSUME_NONNULL_BEGIN
11
20
 
12
21
  @interface RoktNativeLayoutComponentView : RCTViewComponentView
13
- @property (nonatomic, readonly) MPRoktEmbeddedView *roktEmbeddedView;
22
+ @property (nonatomic, readonly) RoktEmbeddedView *roktEmbeddedView;
14
23
  @end
15
24
 
16
25
  NS_ASSUME_NONNULL_END
@@ -9,7 +9,7 @@
9
9
  using namespace facebook::react;
10
10
 
11
11
  @interface RoktNativeLayoutComponentView () <RCTRoktNativeLayoutViewProtocol>
12
- @property (nonatomic, nullable) MPRoktEmbeddedView *roktEmbeddedView;
12
+ @property (nonatomic, nullable) RoktEmbeddedView *roktEmbeddedView;
13
13
  @property (nonatomic, nullable) NSString *placeholderName;
14
14
  @end
15
15
 
@@ -25,7 +25,7 @@ using namespace facebook::react;
25
25
  - (instancetype)initWithFrame:(CGRect)frame
26
26
  {
27
27
  if (self = [super initWithFrame:frame]) {
28
- _roktEmbeddedView = [[MPRoktEmbeddedView alloc] initWithFrame:self.bounds];
28
+ _roktEmbeddedView = [[RoktEmbeddedView alloc] initWithFrame:self.bounds];
29
29
  _roktEmbeddedView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
30
30
  [self addSubview:_roktEmbeddedView];
31
31
  NSLog(@"[ROKT] iOS Fabric: RoktFabricWrapperView initialized");
@@ -150,10 +150,7 @@ export interface Spec extends TurboModule {
150
150
  setUserAttributeArray(mpid: string, key: string, value: Array<string>): void;
151
151
  getUserAttributes(
152
152
  mpid: string,
153
- callback: (
154
- error: CallbackError | null,
155
- result: UserAttributes
156
- ) => void
153
+ callback: (error: CallbackError | null, result: UserAttributes) => void
157
154
  ): void;
158
155
  setUserTag(mpid: string, tag: string): void;
159
156
  incrementUserAttribute(mpid: string, key: string, value: number): void;
@@ -27,6 +27,18 @@ export interface Spec extends TurboModule {
27
27
  catalogItemId: string,
28
28
  success: boolean
29
29
  ): void;
30
+
31
+ selectShoppableAds(
32
+ identifier: string,
33
+ attributes: { [key: string]: string },
34
+ roktConfig?: RoktConfigType
35
+ ): void;
36
+
37
+ close(): Promise<void>;
38
+
39
+ setSessionId(sessionId: string): Promise<void>;
40
+
41
+ getSessionId(): Promise<string | null>;
30
42
  }
31
43
 
32
44
  export default TurboModuleRegistry.getEnforcing<Spec>('RNMPRokt');
package/js/rokt/rokt.ts CHANGED
@@ -31,6 +31,14 @@ export abstract class Rokt {
31
31
  );
32
32
  }
33
33
 
34
+ static async selectShoppableAds(
35
+ identifier: string,
36
+ attributes: Record<string, string>,
37
+ roktConfig?: IRoktConfig
38
+ ): Promise<void> {
39
+ MPRokt.selectShoppableAds(identifier, attributes, roktConfig);
40
+ }
41
+
34
42
  static async purchaseFinalized(
35
43
  placementId: string,
36
44
  catalogItemId: string,
@@ -39,6 +47,18 @@ export abstract class Rokt {
39
47
  MPRokt.purchaseFinalized(placementId, catalogItemId, success);
40
48
  }
41
49
 
50
+ static close(): Promise<void> {
51
+ return MPRokt.close();
52
+ }
53
+
54
+ static setSessionId(sessionId: string): Promise<void> {
55
+ return MPRokt.setSessionId(sessionId);
56
+ }
57
+
58
+ static getSessionId(): Promise<string | null> {
59
+ return MPRokt.getSessionId();
60
+ }
61
+
42
62
  static createRoktConfig(colorMode?: ColorMode, cacheConfig?: CacheConfig) {
43
63
  return new RoktConfig(colorMode ?? 'system', cacheConfig);
44
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"NativeMParticle.js","sourceRoot":"","sources":["../../js/codegenSpecs/NativeMParticle.ts"],"names":[],"mappings":";;AACA,+CAAmD;AAmNnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"NativeMParticle.js","sourceRoot":"","sources":["../../js/codegenSpecs/NativeMParticle.ts"],"names":[],"mappings":";;AACA,+CAAmD;AAgNnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,aAAa,CAAC,CAAC"}
@@ -19,6 +19,12 @@ export interface Spec extends TurboModule {
19
19
  [key: string]: string;
20
20
  }): void;
21
21
  purchaseFinalized(placementId: string, catalogItemId: string, success: boolean): void;
22
+ selectShoppableAds(identifier: string, attributes: {
23
+ [key: string]: string;
24
+ }, roktConfig?: RoktConfigType): void;
25
+ close(): Promise<void>;
26
+ setSessionId(sessionId: string): Promise<void>;
27
+ getSessionId(): Promise<string | null>;
22
28
  }
23
29
  declare const _default: Spec;
24
30
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeMPRokt.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/NativeMPRokt.ts"],"names":[],"mappings":";;AACA,+CAAmD;AA8BnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC"}
1
+ {"version":3,"file":"NativeMPRokt.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/NativeMPRokt.ts"],"names":[],"mappings":";;AACA,+CAAmD;AA0CnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC"}
@@ -10,7 +10,11 @@ export declare abstract class Rokt {
10
10
  * @returns {Promise<void>} A promise that resolves when the placement request is sent.
11
11
  */
12
12
  static selectPlacements(identifier: string, attributes: Record<string, string>, placeholders?: Record<string, number | null>, roktConfig?: IRoktConfig, fontFilesMap?: Record<string, string>): Promise<void>;
13
+ static selectShoppableAds(identifier: string, attributes: Record<string, string>, roktConfig?: IRoktConfig): Promise<void>;
13
14
  static purchaseFinalized(placementId: string, catalogItemId: string, success: boolean): Promise<void>;
15
+ static close(): Promise<void>;
16
+ static setSessionId(sessionId: string): Promise<void>;
17
+ static getSessionId(): Promise<string | null>;
14
18
  static createRoktConfig(colorMode?: ColorMode, cacheConfig?: CacheConfig): RoktConfig;
15
19
  static createCacheConfig(cacheDurationInSeconds: number, cacheAttributes: Record<string, string>): CacheConfig;
16
20
  }
package/lib/rokt/rokt.js CHANGED
@@ -18,9 +18,21 @@ class Rokt {
18
18
  static async selectPlacements(identifier, attributes, placeholders, roktConfig, fontFilesMap) {
19
19
  MPRokt.selectPlacements(identifier, attributes, placeholders, roktConfig, fontFilesMap);
20
20
  }
21
+ static async selectShoppableAds(identifier, attributes, roktConfig) {
22
+ MPRokt.selectShoppableAds(identifier, attributes, roktConfig);
23
+ }
21
24
  static async purchaseFinalized(placementId, catalogItemId, success) {
22
25
  MPRokt.purchaseFinalized(placementId, catalogItemId, success);
23
26
  }
27
+ static close() {
28
+ return MPRokt.close();
29
+ }
30
+ static setSessionId(sessionId) {
31
+ return MPRokt.setSessionId(sessionId);
32
+ }
33
+ static getSessionId() {
34
+ return MPRokt.getSessionId();
35
+ }
24
36
  static createRoktConfig(colorMode, cacheConfig) {
25
37
  return new RoktConfig(colorMode !== null && colorMode !== void 0 ? colorMode : 'system', cacheConfig);
26
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rokt.js","sourceRoot":"","sources":["../../js/rokt/rokt.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAC7C,wDAAwD;AAGxD,MAAM,MAAM,GAAG,IAAA,8BAAe,EAAwB,UAAU,CAAC,CAAC;AAElE,MAAsB,IAAI;IACxB;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,UAAkB,EAClB,UAAkC,EAClC,YAA4C,EAC5C,UAAwB,EACxB,YAAqC;QAErC,MAAM,CAAC,gBAAgB,CACrB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,CACb,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAC5B,WAAmB,EACnB,aAAqB,EACrB,OAAgB;QAEhB,MAAM,CAAC,iBAAiB,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,SAAqB,EAAE,WAAyB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ticle/react-native-mparticle",
7
- "version": "2.9.2",
7
+ "version": "3.1.0",
8
8
  "main": "lib/index.js",
9
9
  "types": "lib/index.d.ts",
10
10
  "react-native": "js/index",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {},
38
38
  "peerDependencies": {
39
39
  "react": ">= 16.0.0-alpha.12",
40
- "react-native": ">= 0.45.0",
40
+ "react-native": ">= 0.76.0",
41
41
  "@expo/config-plugins": ">=7.0.0"
42
42
  },
43
43
  "peerDependenciesMeta": {
@@ -66,7 +66,9 @@
66
66
  "javaPackageName": "com.mparticle.react"
67
67
  },
68
68
  "ios": {
69
- "RoktNativeLayout": "RoktNativeLayoutComponentView"
69
+ "componentProvider": {
70
+ "RoktNativeLayout": "RoktNativeLayoutComponentView"
71
+ }
70
72
  }
71
73
  }
72
74
  }
@@ -0,0 +1,4 @@
1
+ export interface CustomBaseUrlProps {
2
+ customBaseUrl?: string;
3
+ }
4
+ export declare function getCustomBaseUrl(props: CustomBaseUrlProps): string | null;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCustomBaseUrl = void 0;
4
+ function getCustomBaseUrl(props) {
5
+ const customBaseUrl = props.customBaseUrl?.trim();
6
+ if (!customBaseUrl) {
7
+ return null;
8
+ }
9
+ let parsedCustomBaseUrl;
10
+ try {
11
+ parsedCustomBaseUrl = new URL(customBaseUrl);
12
+ }
13
+ catch {
14
+ throw new Error('react-native-mparticle customBaseUrl must be a valid https URL');
15
+ }
16
+ if (parsedCustomBaseUrl.protocol !== 'https:' ||
17
+ !parsedCustomBaseUrl.hostname) {
18
+ throw new Error('react-native-mparticle customBaseUrl must be a valid https URL');
19
+ }
20
+ return customBaseUrl;
21
+ }
22
+ exports.getCustomBaseUrl = getCustomBaseUrl;
@@ -42,6 +42,12 @@ export interface MParticlePluginProps {
42
42
  * @example ['mParticle-Rokt', 'mParticle-Amplitude']
43
43
  */
44
44
  iosKits?: string[];
45
+ /**
46
+ * Custom base URL for global CNAME setup.
47
+ * This is applied before mParticle starts on iOS and Android.
48
+ * @example 'https://your-cname.example.com'
49
+ */
50
+ customBaseUrl?: string;
45
51
  /**
46
52
  * Android kit artifact names to include (version auto-detected from core SDK)
47
53
  * @example ['android-rokt-kit', 'android-amplitude-kit']