Skip to content

feat: migrate Rokt kit to Rokt SDK 5.x and remove MpRoktEventCallback#704

Open
jamesnrokt wants to merge 3 commits into
workstation/6.0-Releasefrom
feat/rokt-sdk-5-migration
Open

feat: migrate Rokt kit to Rokt SDK 5.x and remove MpRoktEventCallback#704
jamesnrokt wants to merge 3 commits into
workstation/6.0-Releasefrom
feat/rokt-sdk-5-migration

Conversation

@jamesnrokt
Copy link
Copy Markdown
Collaborator

@jamesnrokt jamesnrokt commented May 18, 2026

Background

mParticle Android SDK 6.0 adopts Rokt Android SDK 5.x. The 5.x release consolidates the legacy RoktCallback / RoktInitCallback / UnloadReasons callbacks behind a single event-driven Flow<RoktEvent> surface and removes several APIs the kit relied on (Rokt.execute, RoktWidgetDimensionCallBack.onMarginChanged, etc.). See Rokt's upstream MIGRATING.md for the full guide.

What Has Changed

Rokt SDK 5.x adoption (kit only):

  • com.rokt:roktsdk bumped 4.14.05.1.0.
  • Rokt.execute(...) replaced with Rokt.selectPlacements(...).
  • RoktEvent.id field renamed to RoktEvent.identifier; SDK-side CartItemInstantPurchase.placementIdidentifier.
  • com.rokt.roktsdk.RoktLayout invocation switched to the new onEvent: (RoktEvent) -> Unit signature.
  • Removed obsolete overrides for Rokt.RoktCallback, Rokt.RoktInitCallback, Rokt.UnloadReasons, and RoktWidgetDimensionCallBack.onMarginChanged (all removed in 5.x).

mParticle public-API cleanup (breaking):

  • Deleted com.mparticle.MpRoktEventCallback and com.mparticle.UnloadReasons. Customers should consume Rokt.events(identifier): Flow<RoktEvent> instead.
  • Dropped the callbacks: MpRoktEventCallback? parameter from com.mparticle.Rokt.selectPlacements.
  • Dropped mpRoktEventCallback from RoktKitApi.selectPlacements, RoktKitApiImpl.selectPlacements, KitIntegration.RoktListener.selectPlacements, and RoktKit.selectPlacements.
  • RoktKit.runComposableWithCallback renamed to prepareComposableAttributes; the mParticle RoktLayout composable no longer takes a callback param.

mParticle naming alignment with Rokt 5.x (breaking):

  • com.mparticle.RoktEvent.*.placementId renamed to identifier on every event class (including the named param on CartItemInstantPurchase).
  • Rokt.purchaseFinalized(placementId, …, status) renamed to (identifier, …, success); propagated through RoktKitApi, RoktKitApiImpl, KitIntegration.RoktListener, and RoktKit.

Screenshots/Video

N/A

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Bumps com.rokt:roktsdk 4.14.0 → 5.1.0 and adopts the 5.x event-driven API:
- Rokt.execute(...) → Rokt.selectPlacements(...)
- RoktEvent.id renamed to identifier; SDK-side CartItemInstantPurchase.placementId
  renamed to identifier
- com.rokt.roktsdk.RoktLayout switched to onEvent: (RoktEvent) -> Unit
- Drops removed Rokt.RoktCallback / Rokt.RoktInitCallback / Rokt.UnloadReasons
  and RoktWidgetDimensionCallBack.onMarginChanged

Removes the legacy callback surface from the mParticle public API, since 5.x
customers consume Rokt.events(identifier): Flow<RoktEvent> instead:
- Delete MpRoktEventCallback and UnloadReasons
- Drop callbacks param from com.mparticle.Rokt.selectPlacements
- Drop mpRoktEventCallback from RoktKitApi, RoktKitApiImpl,
  KitIntegration.RoktListener, and RoktKit.selectPlacements
- Rename RoktKit.runComposableWithCallback to prepareComposableAttributes;
  RoktLayout composable no longer takes a callback parameter

BREAKING CHANGE: MpRoktEventCallback and UnloadReasons are removed and the
callbacks parameter has been dropped from Rokt.selectPlacements and the
mParticle RoktLayout composable. Use Rokt.events(identifier) to observe
placement events as a Flow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jamesnrokt jamesnrokt requested a review from a team as a code owner May 18, 2026 21:46
@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

PR Summary

High Risk
High risk because this upgrades the embedded Rokt SDK to 5.x and makes breaking API changes across the public Rokt surface, kit interfaces, and event model, which could impact partner integration behavior and downstream compilation.

Overview
Migrates the Rokt integration to com.rokt:roktsdk:5.1.0, updating the kit to use Rokt.selectPlacements/Flow<RoktEvent> and adapting event mapping to the new identifier-based event fields.

Removes the legacy callback-based API (MpRoktEventCallback/UnloadReasons) and drops the callback parameter from Rokt.selectPlacements and the internal kit bridge (RoktKitApi, RoktListener, RoktKitApiImpl, Compose RoktLayout).

Aligns naming and signatures with Rokt 5.x (e.g., purchaseFinalized(identifier, ..., success), event payload fields), removes the obsolete onMarginChanged dimension callback, and updates unit tests accordingly.

Reviewed by Cursor Bugbot for commit a81dddc. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b1e4e35. Configure here.

Comment thread kits/rokt/rokt/src/main/kotlin/com/mparticle/kits/RoktKit.kt
jamesnrokt and others added 2 commits May 18, 2026 18:26
Renames public API symbols to match Rokt 5.x's vocabulary:
- com.mparticle.RoktEvent.*.placementId → identifier on all event
  classes (OfferEngagement, PositiveEngagement, FirstPositiveEngagement,
  PlacementInteractive, PlacementReady, PlacementClosed, PlacementCompleted,
  PlacementFailure, OpenUrl, CartItemInstantPurchase)
- Rokt.purchaseFinalized(placementId, ..., status) →
  (identifier, ..., success); propagated through RoktKitApi,
  RoktKitApiImpl, KitIntegration.RoktListener, and RoktKit

Rename-only — no behavior change.

BREAKING CHANGE: RoktEvent.placementId is renamed to identifier and
Rokt.purchaseFinalized parameters renamed from (placementId, status) to
(identifier, success).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rokt SDK 5.x removed onMarginChanged from RoktWidgetDimensionCallBack;
the kit already dropped its override, but mParticle's mirror interface
still forced customers to implement an onMarginChanged that never fires.

onHeightChanged remains the only method on RoktLayoutDimensionCallBack
and is still the way to observe Widget height changes — 5.x exposes no
event-based equivalent.

BREAKING CHANGE: RoktLayoutDimensionCallBack.onMarginChanged is removed.
Customers implementing this interface should drop the override.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@denischilik denischilik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types were moved from mParticle to Rokt Kit. I would suggest merging this PR first: #700

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants