react-native-mparticle 2.9.2 → 3.0.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/android/src/main/java/com/mparticle/react/rokt/MPRoktModuleImpl.kt +9 -0
- package/android/src/newarch/java/com/mparticle/react/rokt/MPRoktModule.kt +12 -5
- package/android/src/oldarch/java/com/mparticle/react/NativeMPRoktSpec.kt +6 -0
- package/android/src/oldarch/java/com/mparticle/react/rokt/MPRoktModule.kt +9 -0
- package/ios/RNMParticle/RNMPRokt.mm +80 -91
- package/ios/RNMParticle/RNMParticle.mm +18 -24
- package/ios/RNMParticle/RoktEventManager.h +3 -2
- package/ios/RNMParticle/RoktEventManager.m +71 -33
- package/ios/RNMParticle/RoktLayoutManager.m +7 -2
- package/ios/RNMParticle/RoktNativeLayoutComponentView.h +11 -2
- package/ios/RNMParticle/RoktNativeLayoutComponentView.mm +2 -2
- package/js/codegenSpecs/rokt/NativeMPRokt.ts +6 -0
- package/js/rokt/rokt.ts +8 -0
- package/lib/codegenSpecs/rokt/NativeMPRokt.d.ts +3 -0
- package/lib/codegenSpecs/rokt/NativeMPRokt.js.map +1 -1
- package/lib/rokt/rokt.d.ts +1 -0
- package/lib/rokt/rokt.js +3 -0
- package/lib/rokt/rokt.js.map +1 -1
- package/package.json +5 -3
- package/plugin/build/withMParticleIOS.js +11 -2
- package/plugin/src/withMParticleIOS.ts +11 -2
- package/react-native-mparticle.podspec +4 -3
|
@@ -16,6 +16,7 @@ import com.mparticle.MpRoktEventCallback
|
|
|
16
16
|
import com.mparticle.RoktEvent
|
|
17
17
|
import com.mparticle.UnloadReasons
|
|
18
18
|
import com.mparticle.WrapperSdk
|
|
19
|
+
import com.mparticle.internal.Logger
|
|
19
20
|
import com.mparticle.rokt.CacheConfig
|
|
20
21
|
import com.mparticle.rokt.RoktConfig
|
|
21
22
|
import kotlinx.coroutines.Job
|
|
@@ -39,6 +40,14 @@ class MPRoktModuleImpl(
|
|
|
39
40
|
|
|
40
41
|
fun getName(): String = MODULE_NAME
|
|
41
42
|
|
|
43
|
+
fun selectShoppableAds(
|
|
44
|
+
identifier: String,
|
|
45
|
+
attributes: ReadableMap?,
|
|
46
|
+
roktConfig: ReadableMap?,
|
|
47
|
+
) {
|
|
48
|
+
Logger.warning("selectShoppableAds is not yet supported on Android")
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
fun purchaseFinalized(
|
|
43
52
|
placementId: String,
|
|
44
53
|
catalogItemId: String,
|
|
@@ -7,17 +7,15 @@ import com.facebook.react.bridge.ReadableType
|
|
|
7
7
|
import com.facebook.react.bridge.UiThreadUtil
|
|
8
8
|
import com.facebook.react.uimanager.UIManagerHelper
|
|
9
9
|
import com.mparticle.MParticle
|
|
10
|
-
import com.mparticle.
|
|
10
|
+
import com.mparticle.internal.Logger
|
|
11
11
|
import com.mparticle.react.NativeMPRoktSpec
|
|
12
12
|
import com.mparticle.rokt.RoktEmbeddedView
|
|
13
|
-
import com.mparticle.internal.Logger
|
|
14
13
|
import java.lang.ref.WeakReference
|
|
15
14
|
import java.util.concurrent.CountDownLatch
|
|
16
15
|
|
|
17
16
|
class MPRoktModule(
|
|
18
17
|
private val reactContext: ReactApplicationContext,
|
|
19
18
|
) : NativeMPRoktSpec(reactContext) {
|
|
20
|
-
|
|
21
19
|
private val impl = MPRoktModuleImpl(reactContext)
|
|
22
20
|
|
|
23
21
|
override fun getName(): String = impl.getName()
|
|
@@ -52,6 +50,15 @@ class MPRoktModule(
|
|
|
52
50
|
)
|
|
53
51
|
}
|
|
54
52
|
|
|
53
|
+
@ReactMethod
|
|
54
|
+
override fun selectShoppableAds(
|
|
55
|
+
identifier: String,
|
|
56
|
+
attributes: ReadableMap?,
|
|
57
|
+
roktConfig: ReadableMap?,
|
|
58
|
+
) {
|
|
59
|
+
impl.selectShoppableAds(identifier, attributes, roktConfig)
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
@ReactMethod
|
|
56
63
|
override fun purchaseFinalized(
|
|
57
64
|
placementId: String,
|
|
@@ -61,7 +68,6 @@ class MPRoktModule(
|
|
|
61
68
|
impl.purchaseFinalized(placementId, catalogItemId, success)
|
|
62
69
|
}
|
|
63
70
|
|
|
64
|
-
|
|
65
71
|
/**
|
|
66
72
|
* Process placeholders from ReadableMap to a map of Widgets for use with Rokt.
|
|
67
73
|
* This method handles the Fabric-specific view resolution.
|
|
@@ -83,8 +89,9 @@ class MPRoktModule(
|
|
|
83
89
|
// Get the tag value as an integer
|
|
84
90
|
val reactTag =
|
|
85
91
|
when {
|
|
86
|
-
placeholders.getType(key) == ReadableType.Number ->
|
|
92
|
+
placeholders.getType(key) == ReadableType.Number -> {
|
|
87
93
|
placeholders.getDouble(key).toInt()
|
|
94
|
+
}
|
|
88
95
|
|
|
89
96
|
else -> {
|
|
90
97
|
Logger.warning("Invalid view tag for key: $key")
|
|
@@ -21,6 +21,12 @@ abstract class NativeMPRoktSpec(
|
|
|
21
21
|
fontFilesMap: ReadableMap?,
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
+
abstract fun selectShoppableAds(
|
|
25
|
+
identifier: String,
|
|
26
|
+
attributes: ReadableMap?,
|
|
27
|
+
roktConfig: ReadableMap?,
|
|
28
|
+
)
|
|
29
|
+
|
|
24
30
|
abstract fun purchaseFinalized(
|
|
25
31
|
placementId: String,
|
|
26
32
|
catalogItemId: String,
|
|
@@ -48,6 +48,15 @@ class MPRoktModule(
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
@ReactMethod
|
|
52
|
+
override fun selectShoppableAds(
|
|
53
|
+
identifier: String,
|
|
54
|
+
attributes: ReadableMap?,
|
|
55
|
+
roktConfig: ReadableMap?,
|
|
56
|
+
) {
|
|
57
|
+
impl.selectShoppableAds(identifier, attributes, roktConfig)
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
@ReactMethod
|
|
52
61
|
override fun purchaseFinalized(
|
|
53
62
|
placementId: String,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#import "RNMPRokt.h"
|
|
2
|
-
|
|
2
|
+
// SDK 9.0: ObjC headers moved to mParticle_Apple_SDK_ObjC module
|
|
3
|
+
#if defined(__has_include) && __has_include(<mParticle_Apple_SDK_ObjC/mParticle.h>)
|
|
4
|
+
#import <mParticle_Apple_SDK_ObjC/mParticle.h>
|
|
5
|
+
#import <mParticle_Apple_SDK_ObjC/MPRokt.h>
|
|
6
|
+
#elif defined(__has_include) && __has_include(<mParticle_Apple_SDK/mParticle.h>)
|
|
3
7
|
#import <mParticle_Apple_SDK/mParticle.h>
|
|
4
8
|
#import <mParticle_Apple_SDK/MPRokt.h>
|
|
5
|
-
#elif defined(__has_include) && __has_include(<mParticle_Apple_SDK_NoLocation/mParticle.h>)
|
|
6
|
-
#import <mParticle_Apple_SDK_NoLocation/mParticle.h>
|
|
7
9
|
#else
|
|
8
|
-
#import <
|
|
10
|
+
#import <mParticle_Apple_SDK_ObjC/mParticle.h>
|
|
11
|
+
#import <mParticle_Apple_SDK_ObjC/MPRokt.h>
|
|
9
12
|
#endif
|
|
10
|
-
#if
|
|
11
|
-
#import <
|
|
12
|
-
#elif
|
|
13
|
-
#import <
|
|
14
|
-
#else
|
|
15
|
-
#import "mParticle_Apple_SDK-Swift.h"
|
|
13
|
+
#if __has_include(<RoktContracts/RoktContracts-Swift.h>)
|
|
14
|
+
#import <RoktContracts/RoktContracts-Swift.h>
|
|
15
|
+
#elif __has_include(<RoktContracts/RoktContracts.h>)
|
|
16
|
+
#import <RoktContracts/RoktContracts.h>
|
|
16
17
|
#endif
|
|
17
18
|
#import <React/RCTConvert.h>
|
|
18
19
|
#import <React/RCTEventEmitter.h>
|
|
@@ -81,6 +82,12 @@ RCT_EXTERN void RCTRegisterModule(Class);
|
|
|
81
82
|
// We always return the UI manager's method queue
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
- (void)ensureEventManager {
|
|
86
|
+
if (self.eventManager == nil) {
|
|
87
|
+
self.eventManager = [RoktEventManager allocWithZone: nil];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
85
92
|
// Extracts roktConfig fields into an NSDictionary, returning nil when the
|
|
86
93
|
// TurboModule bridge passes a null C++ reference for an omitted optional param.
|
|
@@ -112,7 +119,7 @@ static NSDictionary * __attribute__((optnone)) safeExtractRoktConfigDict(
|
|
|
112
119
|
return roktConfigDict;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
// New Architecture Implementation
|
|
122
|
+
// New Architecture Implementation — selectPlacements
|
|
116
123
|
- (void)selectPlacements:(NSString *)identifer
|
|
117
124
|
attributes:(NSDictionary *)attributes
|
|
118
125
|
placeholders:(NSDictionary *)placeholders
|
|
@@ -123,48 +130,22 @@ static NSDictionary * __attribute__((optnone)) safeExtractRoktConfigDict(
|
|
|
123
130
|
NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings:attributes];
|
|
124
131
|
|
|
125
132
|
NSDictionary *roktConfigDict = safeExtractRoktConfigDict(roktConfig);
|
|
126
|
-
|
|
133
|
+
RoktConfig *config = [self buildRoktConfigFromDict:roktConfigDict];
|
|
127
134
|
#else
|
|
128
|
-
// Old Architecture Implementation
|
|
135
|
+
// Old Architecture Implementation — selectPlacements
|
|
129
136
|
RCT_EXPORT_METHOD(selectPlacements:(NSString *) identifer attributes:(NSDictionary *)attributes placeholders:(NSDictionary * _Nullable)placeholders roktConfig:(NSDictionary * _Nullable)roktConfig fontFilesMap:(NSDictionary * _Nullable)fontFilesMap)
|
|
130
137
|
{
|
|
131
138
|
_rokt_log(@"[mParticle-Rokt] Old Architecture Implementation");
|
|
132
139
|
NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings:attributes];
|
|
133
|
-
|
|
140
|
+
RoktConfig *config = [self buildRoktConfigFromDict:roktConfig];
|
|
134
141
|
#endif
|
|
135
142
|
|
|
136
143
|
_rokt_log(@"[mParticle-Rokt] selectPlacements called with identifier: %@, attributes count: %lu", identifer, (unsigned long)finalAttributes.count);
|
|
137
144
|
|
|
138
145
|
[MParticle _setWrapperSdk_internal:MPWrapperSdkReactNative version:@""];
|
|
139
|
-
|
|
140
|
-
MPRoktEventCallback *callbacks = [[MPRoktEventCallback alloc] init];
|
|
146
|
+
[self ensureEventManager];
|
|
141
147
|
__weak __typeof__(self) weakSelf = self;
|
|
142
148
|
|
|
143
|
-
callbacks.onLoad = ^{
|
|
144
|
-
_rokt_log(@"[mParticle-Rokt] onLoad");
|
|
145
|
-
[weakSelf.eventManager onRoktCallbackReceived:@"onLoad"];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
callbacks.onUnLoad = ^{
|
|
149
|
-
_rokt_log(@"[mParticle-Rokt] onUnLoad");
|
|
150
|
-
[weakSelf.eventManager onRoktCallbackReceived:@"onUnLoad"];
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
callbacks.onShouldShowLoadingIndicator = ^{
|
|
154
|
-
_rokt_log(@"[mParticle-Rokt] onShouldShowLoadingIndicator");
|
|
155
|
-
[weakSelf.eventManager onRoktCallbackReceived:@"onShouldShowLoadingIndicator"];
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
callbacks.onShouldHideLoadingIndicator = ^{
|
|
159
|
-
_rokt_log(@"[mParticle-Rokt] onShouldHideLoadingIndicator");
|
|
160
|
-
[weakSelf.eventManager onRoktCallbackReceived:@"onShouldHideLoadingIndicator"];
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
callbacks.onEmbeddedSizeChange = ^(NSString *placementId, CGFloat height) {
|
|
164
|
-
_rokt_log(@"[mParticle-Rokt] onEmbeddedSizeChange");
|
|
165
|
-
[weakSelf.eventManager onWidgetHeightChanges:height placement:placementId];
|
|
166
|
-
};
|
|
167
|
-
|
|
168
149
|
BOOL bridgeNil = (self.bridge == nil);
|
|
169
150
|
BOOL uiManagerNil = (self.bridge.uiManager == nil);
|
|
170
151
|
_rokt_log(@"[mParticle-Rokt] bridge %@, uiManager %@", bridgeNil ? @"nil" : @"non-nil", uiManagerNil ? @"nil" : @"non-nil");
|
|
@@ -180,10 +161,6 @@ RCT_EXPORT_METHOD(selectPlacements:(NSString *) identifer attributes:(NSDictiona
|
|
|
180
161
|
|
|
181
162
|
NSMutableDictionary *nativePlaceholders = strongSelf ? [strongSelf getNativePlaceholders:placeholders viewRegistry:viewRegistry] : [NSMutableDictionary dictionary];
|
|
182
163
|
|
|
183
|
-
if (strongSelf) {
|
|
184
|
-
[strongSelf subscribeViewEvents:identifer];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
164
|
id mpInstance = [MParticle sharedInstance];
|
|
188
165
|
id roktKit = mpInstance ? [mpInstance rokt] : nil;
|
|
189
166
|
_rokt_log(@"[mParticle-Rokt] MParticle sharedInstance %@, rokt kit %@", mpInstance ? @"non-nil" : @"nil", roktKit ? @"non-nil" : @"nil");
|
|
@@ -192,11 +169,46 @@ RCT_EXPORT_METHOD(selectPlacements:(NSString *) identifer attributes:(NSDictiona
|
|
|
192
169
|
attributes:finalAttributes
|
|
193
170
|
embeddedViews:nativePlaceholders
|
|
194
171
|
config:config
|
|
195
|
-
|
|
172
|
+
onEvent:^(RoktEvent * _Nonnull event) {
|
|
173
|
+
[weakSelf.eventManager onRoktEvents:event viewName:identifer];
|
|
174
|
+
}];
|
|
196
175
|
}];
|
|
197
176
|
_rokt_log(@"[mParticle-Rokt] addUIBlock enqueued for identifier: %@", identifer);
|
|
198
177
|
}
|
|
199
178
|
|
|
179
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
180
|
+
// New Architecture Implementation — selectShoppableAds
|
|
181
|
+
- (void)selectShoppableAds:(NSString *)identifier
|
|
182
|
+
attributes:(NSDictionary *)attributes
|
|
183
|
+
roktConfig:(JS::NativeMPRokt::RoktConfigType &)roktConfig
|
|
184
|
+
{
|
|
185
|
+
_rokt_log(@"[mParticle-Rokt] selectShoppableAds New Architecture");
|
|
186
|
+
NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings:attributes];
|
|
187
|
+
NSDictionary *roktConfigDict = safeExtractRoktConfigDict(roktConfig);
|
|
188
|
+
RoktConfig *config = [self buildRoktConfigFromDict:roktConfigDict];
|
|
189
|
+
#else
|
|
190
|
+
// Old Architecture Implementation — selectShoppableAds
|
|
191
|
+
RCT_EXPORT_METHOD(selectShoppableAds:(NSString *)identifier attributes:(NSDictionary *)attributes roktConfig:(NSDictionary * _Nullable)roktConfig)
|
|
192
|
+
{
|
|
193
|
+
_rokt_log(@"[mParticle-Rokt] selectShoppableAds Old Architecture");
|
|
194
|
+
NSMutableDictionary *finalAttributes = [self convertToMutableDictionaryOfStrings:attributes];
|
|
195
|
+
RoktConfig *config = [self buildRoktConfigFromDict:roktConfig];
|
|
196
|
+
#endif
|
|
197
|
+
|
|
198
|
+
_rokt_log(@"[mParticle-Rokt] selectShoppableAds called with identifier: %@, attributes count: %lu", identifier, (unsigned long)finalAttributes.count);
|
|
199
|
+
|
|
200
|
+
[MParticle _setWrapperSdk_internal:MPWrapperSdkReactNative version:@""];
|
|
201
|
+
[self ensureEventManager];
|
|
202
|
+
__weak __typeof__(self) weakSelf = self;
|
|
203
|
+
|
|
204
|
+
[[[MParticle sharedInstance] rokt] selectShoppableAds:identifier
|
|
205
|
+
attributes:finalAttributes
|
|
206
|
+
config:config
|
|
207
|
+
onEvent:^(RoktEvent * _Nonnull event) {
|
|
208
|
+
[weakSelf.eventManager onRoktEvents:event viewName:identifier];
|
|
209
|
+
}];
|
|
210
|
+
}
|
|
211
|
+
|
|
200
212
|
RCT_EXPORT_METHOD(purchaseFinalized : (NSString *)placementId catalogItemId : (
|
|
201
213
|
NSString *)catalogItemId success : (BOOL)success) {
|
|
202
214
|
[[[MParticle sharedInstance] rokt] purchaseFinalized:placementId
|
|
@@ -209,48 +221,35 @@ RCT_EXPORT_METHOD(purchaseFinalized : (NSString *)placementId catalogItemId : (
|
|
|
209
221
|
NSMutableDictionary *finalAttributes = [attributes mutableCopy];
|
|
210
222
|
NSArray *keysForNullValues = [finalAttributes allKeysForObject:[NSNull null]];
|
|
211
223
|
[finalAttributes removeObjectsForKeys:keysForNullValues];
|
|
212
|
-
|
|
224
|
+
|
|
213
225
|
NSSet *keys = [finalAttributes keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *stop) {
|
|
214
226
|
return ![obj isKindOfClass:[NSString class]];
|
|
215
227
|
}];
|
|
216
|
-
|
|
228
|
+
|
|
217
229
|
[finalAttributes removeObjectsForKeys:[keys allObjects]];
|
|
218
230
|
return finalAttributes;
|
|
219
|
-
|
|
220
|
-
}
|
|
221
231
|
|
|
222
|
-
- (MPColorMode)stringToColorMode:(NSString*)colorString
|
|
223
|
-
{
|
|
224
|
-
if ([colorString isEqualToString:@"light"]) {
|
|
225
|
-
return MPColorModeLight;
|
|
226
|
-
}
|
|
227
|
-
else if ([colorString isEqualToString:@"dark"]) {
|
|
228
|
-
return MPColorModeDark;
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
return MPColorModeSystem;
|
|
232
|
-
}
|
|
233
232
|
}
|
|
234
233
|
|
|
235
|
-
- (
|
|
234
|
+
- (RoktConfig *)buildRoktConfigFromDict:(NSDictionary<NSString *, id> *)configMap {
|
|
236
235
|
_rokt_log(@"[mParticle-Rokt] buildRoktConfigFromDict: configMap %@", configMap == nil ? @"nil" : [NSString stringWithFormat:@"non-nil (%lu keys)", (unsigned long)configMap.count]);
|
|
237
|
-
|
|
236
|
+
if (configMap == nil || configMap.count == 0) {
|
|
237
|
+
_rokt_log(@"[mParticle-Rokt] buildRoktConfigFromDict: returning nil");
|
|
238
|
+
return nil;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
RoktConfigBuilder *builder = [[RoktConfigBuilder alloc] init];
|
|
238
242
|
BOOL isConfigEmpty = YES;
|
|
239
243
|
|
|
240
244
|
NSString *colorModeString = configMap[@"colorMode"];
|
|
241
245
|
if (colorModeString && [colorModeString isKindOfClass:[NSString class]]) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
config.colorMode = MPColorModeLight;
|
|
250
|
-
} else {
|
|
251
|
-
// default: "system"
|
|
252
|
-
config.colorMode = MPColorModeSystem;
|
|
253
|
-
}
|
|
246
|
+
isConfigEmpty = NO;
|
|
247
|
+
if ([colorModeString isEqualToString:@"dark"]) {
|
|
248
|
+
[builder colorMode:RoktColorModeDark];
|
|
249
|
+
} else if ([colorModeString isEqualToString:@"light"]) {
|
|
250
|
+
[builder colorMode:RoktColorModeLight];
|
|
251
|
+
} else {
|
|
252
|
+
[builder colorMode:RoktColorModeSystem];
|
|
254
253
|
}
|
|
255
254
|
}
|
|
256
255
|
|
|
@@ -262,23 +261,13 @@ RCT_EXPORT_METHOD(purchaseFinalized : (NSString *)placementId catalogItemId : (
|
|
|
262
261
|
cacheDuration = @0;
|
|
263
262
|
}
|
|
264
263
|
NSDictionary<NSString *, NSString *> *cacheAttributes = cacheConfigMap[@"cacheAttributes"];
|
|
265
|
-
|
|
266
|
-
|
|
264
|
+
RoktCacheConfig *cacheConfig = [[RoktCacheConfig alloc] initWithCacheDuration:[cacheDuration longLongValue]
|
|
265
|
+
cacheAttributes:cacheAttributes ?: @{}];
|
|
266
|
+
[builder cacheConfig:cacheConfig];
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
_rokt_log(@"[mParticle-Rokt] buildRoktConfigFromDict: returning %@", isConfigEmpty ? @"nil" : @"config");
|
|
270
|
-
return isConfigEmpty ? nil :
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
- (void)subscribeViewEvents:(NSString* _Nonnull) viewName
|
|
274
|
-
{
|
|
275
|
-
_rokt_log(@"[mParticle-Rokt] subscribeViewEvents for viewName: %@", viewName);
|
|
276
|
-
if (self.eventManager == nil) {
|
|
277
|
-
self.eventManager = [RoktEventManager allocWithZone: nil];
|
|
278
|
-
}
|
|
279
|
-
[[[MParticle sharedInstance] rokt] events:viewName onEvent:^(MPRoktEvent * _Nonnull roktEvent) {
|
|
280
|
-
[self.eventManager onRoktEvents:roktEvent viewName:viewName];
|
|
281
|
-
}];
|
|
270
|
+
return isConfigEmpty ? nil : [builder build];
|
|
282
271
|
}
|
|
283
272
|
|
|
284
273
|
- (NSMutableDictionary *)getNativePlaceholders:(NSDictionary *)placeholders viewRegistry:(NSDictionary<NSNumber *, UIView *> *)viewRegistry
|
|
@@ -295,8 +284,8 @@ RCT_EXPORT_METHOD(purchaseFinalized : (NSString *)placementId catalogItemId : (
|
|
|
295
284
|
}
|
|
296
285
|
nativePlaceholders[key] = wrapperView.roktEmbeddedView;
|
|
297
286
|
#else
|
|
298
|
-
|
|
299
|
-
if (!view || ![view isKindOfClass:[
|
|
287
|
+
RoktEmbeddedView *view = viewRegistry[[placeholders objectForKey:key]];
|
|
288
|
+
if (!view || ![view isKindOfClass:[RoktEmbeddedView class]]) {
|
|
300
289
|
RCTLogError(@"Cannot find RoktEmbeddedView with tag #%@", key);
|
|
301
290
|
continue;
|
|
302
291
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
#import "RNMParticle.h"
|
|
2
2
|
#import <React/RCTConvert.h>
|
|
3
|
-
|
|
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 <
|
|
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
|
-
|
|
48
|
-
[
|
|
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
|
|
208
|
-
[reactError setObject:[NSNumber
|
|
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
|
|
242
|
-
[reactError setObject:[NSNumber
|
|
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
|
|
276
|
-
[reactError setObject:[NSNumber
|
|
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
|
|
310
|
-
[reactError setObject:[NSNumber
|
|
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
|
|
688
|
-
[reactError setObject:[NSNumber
|
|
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.
|
|
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
|
-
|
|
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:(
|
|
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
|
-
|
|
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:(
|
|
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
|
-
|
|
99
|
+
NSString *error;
|
|
100
|
+
NSString *paymentProvider;
|
|
101
|
+
|
|
102
|
+
if ([event isKindOfClass:[RoktShowLoadingIndicator class]]) {
|
|
101
103
|
eventName = @"ShowLoadingIndicator";
|
|
102
|
-
|
|
104
|
+
[self onRoktCallbackReceived:@"onShouldShowLoadingIndicator"];
|
|
105
|
+
} else if ([event isKindOfClass:[RoktHideLoadingIndicator class]]) {
|
|
103
106
|
eventName = @"HideLoadingIndicator";
|
|
104
|
-
|
|
105
|
-
|
|
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:[
|
|
108
|
-
placementId = ((
|
|
111
|
+
} else if ([event isKindOfClass:[RoktPlacementReady class]]) {
|
|
112
|
+
placementId = ((RoktPlacementReady *)event).identifier;
|
|
109
113
|
eventName = @"PlacementReady";
|
|
110
|
-
|
|
111
|
-
|
|
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:[
|
|
114
|
-
placementId = ((
|
|
118
|
+
} else if ([event isKindOfClass:[RoktPositiveEngagement class]]) {
|
|
119
|
+
placementId = ((RoktPositiveEngagement *)event).identifier;
|
|
115
120
|
eventName = @"PositiveEngagement";
|
|
116
|
-
} else if ([event isKindOfClass:[
|
|
117
|
-
placementId = ((
|
|
121
|
+
} else if ([event isKindOfClass:[RoktPlacementClosed class]]) {
|
|
122
|
+
placementId = ((RoktPlacementClosed *)event).identifier;
|
|
118
123
|
eventName = @"PlacementClosed";
|
|
119
|
-
|
|
120
|
-
|
|
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:[
|
|
123
|
-
placementId = ((
|
|
128
|
+
} else if ([event isKindOfClass:[RoktPlacementFailure class]]) {
|
|
129
|
+
placementId = ((RoktPlacementFailure *)event).identifier;
|
|
124
130
|
eventName = @"PlacementFailure";
|
|
125
|
-
} else if ([event isKindOfClass:[
|
|
126
|
-
placementId = ((
|
|
131
|
+
} else if ([event isKindOfClass:[RoktFirstPositiveEngagement class]]) {
|
|
132
|
+
placementId = ((RoktFirstPositiveEngagement *)event).identifier;
|
|
127
133
|
eventName = @"FirstPositiveEngagement";
|
|
128
|
-
} else if ([event isKindOfClass:[
|
|
134
|
+
} else if ([event isKindOfClass:[RoktInitComplete class]]) {
|
|
129
135
|
eventName = @"InitComplete";
|
|
130
|
-
status = ((
|
|
131
|
-
} else if ([event isKindOfClass:[
|
|
136
|
+
status = ((RoktInitComplete *)event).success ? @"true" : @"false";
|
|
137
|
+
} else if ([event isKindOfClass:[RoktOpenUrl class]]) {
|
|
132
138
|
eventName = @"OpenUrl";
|
|
133
|
-
placementId = ((
|
|
134
|
-
url = ((
|
|
135
|
-
} else if ([event isKindOfClass:[
|
|
136
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
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 [[
|
|
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
|
-
#
|
|
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)
|
|
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)
|
|
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 = [[
|
|
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");
|
|
@@ -27,6 +27,12 @@ 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;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
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,
|
|
@@ -19,6 +19,9 @@ 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;
|
|
22
25
|
}
|
|
23
26
|
declare const _default: Spec;
|
|
24
27
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeMPRokt.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/NativeMPRokt.ts"],"names":[],"mappings":";;AACA,+CAAmD;
|
|
1
|
+
{"version":3,"file":"NativeMPRokt.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/NativeMPRokt.ts"],"names":[],"mappings":";;AACA,+CAAmD;AAoCnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC"}
|
package/lib/rokt/rokt.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ 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>;
|
|
14
15
|
static createRoktConfig(colorMode?: ColorMode, cacheConfig?: CacheConfig): RoktConfig;
|
|
15
16
|
static createCacheConfig(cacheDurationInSeconds: number, cacheAttributes: Record<string, string>): CacheConfig;
|
package/lib/rokt/rokt.js
CHANGED
|
@@ -18,6 +18,9 @@ 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
|
}
|
package/lib/rokt/rokt.js.map
CHANGED
|
@@ -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;QACtE,OAAO,IAAI,UAAU,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,iBAAiB,CACtB,sBAA8B,EAC9B,eAAuC;QAEvC,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;CACF;
|
|
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,kBAAkB,CAC7B,UAAkB,EAClB,UAAkC,EAClC,UAAwB;QAExB,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAChE,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;QACtE,OAAO,IAAI,UAAU,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,iBAAiB,CACtB,sBAA8B,EAC9B,eAAuC;QAEvC,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;CACF;AArDD,oBAqDC;AAQD;;GAEG;AACH,MAAa,WAAW;IACtB;;;OAGG;IACH,YACkB,sBAA+B,EAC/B,eAAwC;QADxC,2BAAsB,GAAtB,sBAAsB,CAAS;QAC/B,oBAAe,GAAf,eAAe,CAAyB;IACvD,CAAC;CACL;AATD,kCASC;AAED,MAAM,UAAU;IAId,YAAY,SAAoB,EAAE,WAAyB;QACzD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AACD,MAAM,EAAE,gBAAgB,EAAE,GAAG,4BAAa,CAAC;AAElC,4CAAgB"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"homepage": "https://www.mparticle.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "mParticle/react-native-mparticle",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "3.0.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.
|
|
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
|
-
"
|
|
69
|
+
"componentProvider": {
|
|
70
|
+
"RoktNativeLayout": "RoktNativeLayoutComponentView"
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -273,7 +273,12 @@ function addMParticleToObjcAppDelegate(contents, props) {
|
|
|
273
273
|
* These are dependencies of mParticle kits that must also be dynamic frameworks
|
|
274
274
|
*/
|
|
275
275
|
const KIT_TRANSITIVE_DEPENDENCIES = {
|
|
276
|
-
'mParticle-Rokt': [
|
|
276
|
+
'mParticle-Rokt': [
|
|
277
|
+
'Rokt-Widget',
|
|
278
|
+
'RoktContracts',
|
|
279
|
+
'RoktUXHelper',
|
|
280
|
+
'DcuiSchema',
|
|
281
|
+
],
|
|
277
282
|
// Add other kit dependencies here as needed
|
|
278
283
|
// "mParticle-Amplitude": [],
|
|
279
284
|
// "mParticle-Braze": [],
|
|
@@ -282,7 +287,11 @@ const KIT_TRANSITIVE_DEPENDENCIES = {
|
|
|
282
287
|
* Get all pods that need dynamic framework linking
|
|
283
288
|
*/
|
|
284
289
|
function getDynamicFrameworkPods(iosKits) {
|
|
285
|
-
const pods = [
|
|
290
|
+
const pods = [
|
|
291
|
+
'mParticle-Apple-SDK',
|
|
292
|
+
'mParticle-Apple-SDK-ObjC',
|
|
293
|
+
'mParticle-Apple-SDK-Swift',
|
|
294
|
+
];
|
|
286
295
|
if (iosKits) {
|
|
287
296
|
for (const kit of iosKits) {
|
|
288
297
|
pods.push(kit);
|
|
@@ -338,7 +338,12 @@ function addMParticleToObjcAppDelegate(
|
|
|
338
338
|
* These are dependencies of mParticle kits that must also be dynamic frameworks
|
|
339
339
|
*/
|
|
340
340
|
const KIT_TRANSITIVE_DEPENDENCIES: Record<string, string[]> = {
|
|
341
|
-
'mParticle-Rokt': [
|
|
341
|
+
'mParticle-Rokt': [
|
|
342
|
+
'Rokt-Widget',
|
|
343
|
+
'RoktContracts',
|
|
344
|
+
'RoktUXHelper',
|
|
345
|
+
'DcuiSchema',
|
|
346
|
+
],
|
|
342
347
|
// Add other kit dependencies here as needed
|
|
343
348
|
// "mParticle-Amplitude": [],
|
|
344
349
|
// "mParticle-Braze": [],
|
|
@@ -348,7 +353,11 @@ const KIT_TRANSITIVE_DEPENDENCIES: Record<string, string[]> = {
|
|
|
348
353
|
* Get all pods that need dynamic framework linking
|
|
349
354
|
*/
|
|
350
355
|
function getDynamicFrameworkPods(iosKits?: string[]): string[] {
|
|
351
|
-
const pods = [
|
|
356
|
+
const pods = [
|
|
357
|
+
'mParticle-Apple-SDK',
|
|
358
|
+
'mParticle-Apple-SDK-ObjC',
|
|
359
|
+
'mParticle-Apple-SDK-Swift',
|
|
360
|
+
];
|
|
352
361
|
|
|
353
362
|
if (iosKits) {
|
|
354
363
|
for (const kit of iosKits) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
|
|
3
3
|
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
4
|
-
ios_platform =
|
|
4
|
+
ios_platform = '15.6'
|
|
5
5
|
|
|
6
6
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|
|
14
14
|
|
|
15
15
|
s.homepage = package['homepage']
|
|
16
16
|
s.license = package['license']
|
|
17
|
-
s.platforms = { :ios => ios_platform, :tvos => "
|
|
17
|
+
s.platforms = { :ios => ios_platform, :tvos => "15.6" }
|
|
18
18
|
|
|
19
19
|
s.source = { :git => "https://github.com/mParticle/react-native-mparticle.git", :tag => "#{s.version}" }
|
|
20
20
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
@@ -25,5 +25,6 @@ Pod::Spec.new do |s|
|
|
|
25
25
|
s.dependency "React-Core"
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
s.dependency 'mParticle-Apple-SDK', '~>
|
|
28
|
+
s.dependency 'mParticle-Apple-SDK-ObjC', '~> 9.0'
|
|
29
|
+
s.dependency 'RoktContracts', '~> 0.1'
|
|
29
30
|
end
|