File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ @interface MParticleUser ()
1919- (void )setUserId : (NSNumber *)userId ;
2020@end
2121
22+ // Forward declare so New Arch `logCommerceEvent` can use the same JS→native
23+ // product action mapping as `RCTConvert MPCommerceEvent:` (defined later in this file).
24+ @interface RCTConvert (MPCommerceEvent)
25+ + (MPCommerceEventAction)MPCommerceEventAction : (id )json ;
26+ @end
27+
2228@implementation RNMParticle
2329
2430RCT_EXTERN void RCTRegisterModule (Class );
@@ -447,7 +453,7 @@ - (void)logCommerceEvent:(JS::NativeMParticle::CommerceEvent &)commerceEvent {
447453 MPCommerceEvent *mpCommerceEvent = [[MPCommerceEvent alloc ] init ];
448454
449455 if (commerceEvent.productActionType ().has_value ()) {
450- mpCommerceEvent.action = ( MPCommerceEventAction) commerceEvent.productActionType ().value ();
456+ mpCommerceEvent.action = [RCTConvert MPCommerceEventAction: @( commerceEvent.productActionType ().value ())] ;
451457 }
452458
453459 if (commerceEvent.promotionActionType ().has_value ()) {
@@ -778,7 +784,7 @@ + (MPCommerceEvent *)MPCommerceEvent:(NSDictionary *)dict {
778784 MPCommerceEvent *commerceEvent = [[MPCommerceEvent alloc ] init ];
779785
780786 if (dict[@" productActionType" ] && dict[@" productActionType" ] != [NSNull null ]) {
781- commerceEvent.action = (MPCommerceEventAction)[ dict[@" productActionType" ] integerValue ];
787+ commerceEvent.action = [RCTConvert MPCommerceEventAction: dict[@" productActionType" ]];
782788 }
783789
784790 if (dict[@" products" ] && dict[@" products" ] != [NSNull null ]) {
You can’t perform that action at this time.
0 commit comments