Skip to content

Conversation

@alexs-mparticle
Copy link
Collaborator

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

  • Introduces a wrapper class for the Rokt SDK to allow integrations and partners to access Rokt functionality via the mParticle Web SDK.

Testing Plan

  • Was this tested locally? If not, explain why.
  • Using a sample app, attempt to access the window.mParticle.Rokt.selectPlacements() method.
  • Add the Rokt Web SDK to your sample app and attempt to attach the launcher through window.mParticle.Rokt.attachLauncher().
  • selectPlacement requests should be queued until the launcher is attached, which will then trigger Rokt's selectPlacements logic.

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

@alexs-mparticle alexs-mparticle force-pushed the feat/SQDSDKS-7130-add-rokt-wrapper branch from cf803b7 to 5dbfce4 Compare March 13, 2025 17:17
Comment on lines 16 to 23
export interface IRoktLauncher {
selectPlacements: (options: ISelectPlacementsOptions) => Promise<ISelection>;
}

export interface IRoktMessage {
methodName: string;
payload: any;
}
Copy link
Member

Choose a reason for hiding this comment

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

group with other rokt interfaces

Comment on lines 10 to 14
export interface ISelection {
placementId?: string;
status?: string;
error?: string;
}
Copy link
Member

Choose a reason for hiding this comment

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

what's this?

Copy link
Member

Choose a reason for hiding this comment

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

i see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher#select-placements which shows that yes, it does return Promise<selection> but if you click on selection in this page, it brings you here which doesn't have much
https://docs.rokt.com/developers/integration-guides/web/library/selection

Co-authored-by: Robert Ing <rmi22186@gmail.com>
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.

minor comments

});

describe('#selectPlacements', () => {
it('should call selectPlacements', () => {
Copy link
Member

Choose a reason for hiding this comment

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

in general for all these tests, i think it gets confusing when you are saying selectPlacements gets called. we should be more explicit that one selectPlacements gets mapped to anotheri selectPlacements call think being explicit is good here. should call launcher.selectPlacements when roktManager.selectPlacements is called

Suggested change
it('should call selectPlacements', () => {
it('should map a IRoktLauncher selectPlacement to a launcher selectPlacements call', () => {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think "map an IRoktLauncher selectPlacement" is too much of an implementation detail for this specific tests, but I agree that it should more explicit to referenc the launcher. I'll revise.

Comment on lines 51 to 53
const launcher = {
selectPlacements: jest.fn()
} as unknown as IRoktLauncher;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there's a reason to make it unknown

Suggested change
const launcher = {
selectPlacements: jest.fn()
} as unknown as IRoktLauncher;
const launcher: IRoktLauncher = {
selectPlacements: jest.fn()
}

expect(launcher.selectPlacements).toHaveBeenCalledWith(options);
});

it('should call selectPlacements with any passed in attributes', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
it('should call selectPlacements with any passed in attributes', () => {
it('should call IRoktLauncher selectPlacements with any passed in attributes to roktManager.selectPlacements', () => {

Comment on lines 36 to 47
public attachLauncher(launcher: IRoktLauncher): Promise<void> {
return new Promise<void>((resolve) => {
if (!launcher) {
this.queueMessage({
methodName: 'attachLauncher',
payload: launcher,
});
} else {
this.setLauncher(launcher);
this.processMessageQueue();
}
resolve();
Copy link
Member

Choose a reason for hiding this comment

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

no need for this to be a promise

Comment on lines 38 to 42
if (!launcher) {
this.queueMessage({
methodName: 'attachLauncher',
payload: launcher,
});
Copy link
Member

Choose a reason for hiding this comment

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

this can be removed. the expectation is there is no launcher and we are setting.

@sonarqubecloud
Copy link

@alexs-mparticle alexs-mparticle merged commit 04d1efc into development Mar 14, 2025
25 of 29 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 15, 2025
# [2.34.0](v2.33.1...v2.34.0) (2025-03-15)

### Features

* Add Rokt Wrapper ([#994](#994)) ([04d1efc](04d1efc))
@mparticle-automation
Copy link
Collaborator

🎉 This PR is included in version 2.34.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.

4 participants