feat: add Rokt Brain event type constants#1269
Conversation
PR SummaryLow Risk Overview Updates commerce logging so these new product action types map to Reviewed by Cursor Bugbot for commit 3be0456. Bugbot is set up for automated code reviews on this repo. Configure here. |
…for new commerce event types
|


Background
This PR extends the mParticle Web SDK to support additional event types commonly used in commerce and engagement flows (e.g.,
view_cart,add_shipping_info,subscribe,sign_up). New typed constants are added toProductActionTypeand a newRoktEventsobject, allowing partners to log these events through existing SDK methods.What Has Changed
ProductActionTypewith 8 new commerce-adjacent values (11–18):ViewCart,AddShippingInfo,AddPaymentInfo,PaymentMethodSelected,PaymentAttempted,PaymentSucceeded,PaymentFailed,RefundInitiatedisRoktCommerceType()helper to identify new commerce types by rangeRokt.CommerceEventTypecustom flag auto-population inevents.jsfor new commerce types, carrying the snake_case event name (e.g.,payment_succeeded)RoktEventsconst object with 11 non-commerce event name constants (SignUp,Subscribe,StartTrial,GenerateLead,Search,Upsell,EarnVirtualCurrency,DwellTime,Hover,Scroll,ClickToExpand)RoktEventNameunion type with(string & {})escape hatch for arbitrary event namesgetName()andgetExpansionName()helpers to cover newProductActionTypevaluesSDKProductActionTypeenum,MParticleWebSDKinterface, instance manager, and stubRoktEventsonmParticleinstance for customer useUnknownon the wire (MPServer safe) while preserving actual event names viaRokt.CommerceEventTypecustom flag for kit-side enrichmentpublic-types.tsisRoktCommerceTypecoverage intypes.spec.ts, public API key assertion in instance manager testsScreenshots/Video
Checklist
Additional Notes
Reference Issue (For employees only. Ignore if you are an outside contributor)