You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On iOS with the New Architecture, commerce fields set in JS were dropped before they reached the native mParticle SDK. setCurrency("USD") produced currency_code: null, and setCheckoutStep(1) produced checkout_step: 0. The same JS worked on Android and on iOS Old Architecture.
The JS layer already stored and forwarded these fields. Android convertCommerceEvent and iOS +[RCTConvert MPCommerceEvent:] (legacy bridge) already mapped them. The TurboModule logCommerceEvent: in ios/RNMParticle/RNMParticle.mm built an MPCommerceEvent from the codegen struct but never copied currency, checkout step, or several related native fields, so the SDK kept defaults.
This change brings the New Architecture path to parity with RCTConvert without routing the whole event through RCTConvert (product/impression conversion still uses createMPProductFromDict).
Fills promotionContainer with promotions from the JS struct (it was previously created with promotion: nil and never populated).
Extracts testable helpers applyCommerceEventMetadata:fromDictionary: and addPromotionsFromDicts:toCommerceEvent:.
No JS or Android changes. Affected on 3.3.1 / 3.3.2 with New Architecture enabled; there is no JS-only workaround for native currency_code / checkout_step.
Testing Plan
Sample iOS XCTests in RCTConvertCommerceMappingTests.m:
Legacy JSON → RCTConvert keeps currency, checkout step, checkout options, list name/source, screen name, nonInteractive, and shouldUploadEvent.
applyCommerceEventMetadata:fromDictionary: copies the same fields onto an MPCommerceEvent without generated C++ TurboModule types.
addPromotionsFromDicts:toCommerceEvent: adds a promotion (id, name, creative, position) onto promotionContainer.
Run the MParticleSampleTests target (including RCTConvertCommerceMappingTests) on an iOS simulator.
Medium Risk
Changes only the iOS New Architecture commerce event path; behavior should match existing RCTConvert mapping but incorrect field mapping could skew analytics until caught in tests.
Overview
Fixes iOS New Architecture commerce logging so JS fields reach the mParticle SDK instead of being dropped on the TurboModule path. Legacy bridge and Android already mapped these; logCommerceEvent built MPCommerceEvent from the codegen struct but skipped optional metadata and left promotionContainer empty.
The New Arch handler now copies currency, checkout step/options, product list name/source, screen name, nonInteractive, and shouldUploadEvent via applyCommerceEventMetadata:fromDictionary:, and fills promotions on the container via addPromotionsFromDicts:toCommerceEvent: (using existing RCTConvert MPPromotion:). No JS or Android changes.
RCTConvertCommerceMappingTests adds coverage for legacy JSON → MPCommerceEvent metadata and for the two New Arch helpers without codegen C++ types.
Reviewed by Cursor Bugbot for commit 860c109. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On iOS with the New Architecture, commerce fields set in JS were dropped before they reached the native mParticle SDK. setCurrency("USD") produced currency_code: null, and setCheckoutStep(1) produced checkout_step: 0. The same JS worked on Android and on iOS Old Architecture.
The JS layer already stored and forwarded these fields. Android convertCommerceEvent and iOS +[RCTConvert MPCommerceEvent:] (legacy bridge) already mapped them. The TurboModule logCommerceEvent: in ios/RNMParticle/RNMParticle.mm built an MPCommerceEvent from the codegen struct but never copied currency, checkout step, or several related native fields, so the SDK kept defaults.
This change brings the New Architecture path to parity with RCTConvert without routing the whole event through RCTConvert (product/impression conversion still uses createMPProductFromDict).
Testing Plan
Sample iOS XCTests in RCTConvertCommerceMappingTests.m:
Run the MParticleSampleTests target (including RCTConvertCommerceMappingTests) on an iOS simulator.
Master Issue
Closes https://go.mparticle.com/work/REPLACEME