Skip to content

feat: Expose Rokt launcher config options #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 2, 2025

Conversation

alexs-mparticle
Copy link
Collaborator

@alexs-mparticle alexs-mparticle commented May 20, 2025

Instructions

  1. PR target branch should be against development
  2. PR title name should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-title-check.yml
  3. PR branch prefix should follow this format: https://github.com/mParticle/mparticle-workflows/blob/main/.github/workflows/pr-branch-check-name.yml

Summary

Testing Plan

  • Was this tested locally? If not, explain why.
  • Using a sample app, pass in various rokt configuration options to window.mParticle.config and verify that they appear in the Rokt Web SDK selectPlacements call.

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for passing Rokt Web SDK launcher options through the Kit SDK, alongside existing sandbox settings.

  • Introduces a nested IRoktOptions type to bundle managerOptions (sandbox) and new launcherOptions.
  • Updates RoktManager to store and expose launcherOptions during initialization.
  • Expands test coverage for both provided and omitted launcher options in roktManager.spec.ts.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/jest/roktManager.spec.ts Updated tests to wrap sandbox under managerOptions and added cases for launcherOptions.
src/sdkRuntimeModels.ts Exposed launcherOptions in SDKInitConfig for consumer configuration.
src/roktManager.ts Added IRoktOptions with launcherOptions, updated init logic and interfaces.
Comments suppressed due to low confidence (2)

test/jest/roktManager.spec.ts:250

  • [nitpick] The test description says 'empty launcher options' but asserts undefined; consider updating the wording to 'undefined launcher options' for clarity.
it('should initialize the manager with empty launcher options when not provided', () => {

src/roktManager.ts:53

  • [nitpick] The launcherOptions property on IRoktKit is only used internally by RoktManager; consider removing it from the public IRoktKit interface to avoid confusion.
launcherOptions?: Dictionary<any>;

@alexs-mparticle alexs-mparticle requested a review from rmi22186 May 21, 2025 17:31
@alexs-mparticle alexs-mparticle marked this pull request as ready for review May 21, 2025 17:31
@alexs-mparticle alexs-mparticle force-pushed the feat/SQDSDKS-7318-rokt-launcher-config branch from 8e5e823 to 31367de Compare May 27, 2025 14:44
Comment on lines +227 to +229
{
managerOptions: { sandbox: true },
}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a test from the past that shows if sandbox is passed into the selectPlacements call that it will override MP's isDevelopmentMode boolean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not really. We treat both createLauncher and selectPlacements sandbox flags as pass throughs.

Copy link
Member

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

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

This looks good, just minor comments

@alexs-mparticle alexs-mparticle force-pushed the feat/SQDSDKS-7318-rokt-launcher-config branch from 957f614 to c411fa7 Compare May 29, 2025 21:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR exposes Rokt launcher configuration options so that the Kit SDK can pass these options through to the Rokt Web SDK. Key changes include:

  • Updating tests in both identity and RoktManager suites to validate new configuration and behavior.
  • Adjusting SDK and Manager interfaces and initialization parameters to support launcherOptions.
  • Modifying mp-instance and identity logic to integrate with the updated RoktManager API.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/src/tests-identity.ts Added tests for Rokt Manager behavior and new identify helper functions.
test/jest/roktManager.spec.ts Updated tests to verify proper initialization of launcher and manager options.
src/sdkRuntimeModels.ts Updated SDKInitConfig to include launcherOptions.
src/roktManager.ts Updated options handling to use the new IRoktOptions structure and store launcherOptions.
src/mp-instance.ts Modified RoktManager initialization to pass managerOptions and launcherOptions.
src/identity.js Added a check to update currentUser from Identity when the RoktManager is ready.

@@ -1677,6 +1677,10 @@ export default function Identity(mpInstance) {
}
mpInstance._Store.isInitialized = true;

if (mpInstance._RoktManager.isReady()) {
Copy link
Member

Choose a reason for hiding this comment

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

So if it's not ready yet because identity returns faster than rokt manager gets initialized, this means there still won't be a current user right/. Is there a way to queue setting the current user for when it is ready?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually is more of a check to see if the Rokt Kit is being used at all. We could potentially create a new method called isConfigured or isActive, but I felt like that might be unnecessary.

Copy link
Member

Choose a reason for hiding this comment

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

ah got it. yea seems like it's more readable/grokable if you go with an approach like isActive. I think you can make it a tech debt ticket.

@rmi22186
Copy link
Member

Food for thought - If we are passing sandbox to createLauncher now, is there a reason to include it in the selectPlacements call?

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR exposes configuration options for Rokt's launcher, enabling the Kit SDK to pass these options to the Rokt Web SDK. Key changes include:

  • Extending the SDK's configuration by introducing a new "launcherOptions" parameter.
  • Adding tests to validate the behavior of Rokt Manager with respect to user identity and launcher options.
  • Updating various modules (including sdkRuntimeModels, mp-instance, and identity) to properly propagate and utilize the new configuration options.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/src/tests-identity.ts Added tests for validating the behavior when a user’s email is identified and when identity calls fail.
test/jest/roktManager.spec.ts Updated tests to verify initialization of launcher options and sandbox mode.
src/sdkRuntimeModels.ts Added a new optional launcherOptions field to the SDK initialization configuration.
src/roktManager.ts Refactored the RoktManager initialization to support new launcherOptions and managerOptions.
src/mp-instance.ts Updated initialization logic to pass new Rokt options to RoktManager.
src/identity.js Modified identity flow to set currentUser in RoktManager when ready.

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Member

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

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

My previous comment was actually that I didn't think we needed RoktManager.sandbox at all because we aren't using it anywhere, right? What is its current purpose?

Ignore me!

@alexs-mparticle alexs-mparticle merged commit c2d25af into development Jun 2, 2025
32 of 36 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 2, 2025
# [2.41.0](v2.40.0...v2.41.0) (2025-06-02)

### Bug Fixes

* Initialize Rokt before processing forwarders ([#1034](#1034)) ([cf09cd0](cf09cd0))

### Features

* Expose Rokt launcher config options ([#1033](#1033)) ([c2d25af](c2d25af))
@mparticle-automation
Copy link
Collaborator

🎉 This PR is included in version 2.41.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants