-
Notifications
You must be signed in to change notification settings - Fork 57
feat: Add Rokt Wrapper #994
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
feat: Add Rokt Wrapper #994
Conversation
cf803b7 to
5dbfce4
Compare
| export interface IRoktLauncher { | ||
| selectPlacements: (options: ISelectPlacementsOptions) => Promise<ISelection>; | ||
| } | ||
|
|
||
| export interface IRoktMessage { | ||
| methodName: string; | ||
| payload: any; | ||
| } |
There was a problem hiding this comment.
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
src/roktManager.ts
Outdated
| export interface ISelection { | ||
| placementId?: string; | ||
| status?: string; | ||
| error?: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this?
There was a problem hiding this comment.
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>
rmi22186
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments
test/jest/roktManager.spec.ts
Outdated
| }); | ||
|
|
||
| describe('#selectPlacements', () => { | ||
| it('should call selectPlacements', () => { |
There was a problem hiding this comment.
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
| it('should call selectPlacements', () => { | |
| it('should map a IRoktLauncher selectPlacement to a launcher selectPlacements call', () => { |
There was a problem hiding this comment.
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.
test/jest/roktManager.spec.ts
Outdated
| const launcher = { | ||
| selectPlacements: jest.fn() | ||
| } as unknown as IRoktLauncher; |
There was a problem hiding this comment.
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
| const launcher = { | |
| selectPlacements: jest.fn() | |
| } as unknown as IRoktLauncher; | |
| const launcher: IRoktLauncher = { | |
| selectPlacements: jest.fn() | |
| } |
test/jest/roktManager.spec.ts
Outdated
| expect(launcher.selectPlacements).toHaveBeenCalledWith(options); | ||
| }); | ||
|
|
||
| it('should call selectPlacements with any passed in attributes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| it('should call selectPlacements with any passed in attributes', () => { | |
| it('should call IRoktLauncher selectPlacements with any passed in attributes to roktManager.selectPlacements', () => { |
src/roktManager.ts
Outdated
| 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(); |
There was a problem hiding this comment.
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
src/roktManager.ts
Outdated
| if (!launcher) { | ||
| this.queueMessage({ | ||
| methodName: 'attachLauncher', | ||
| payload: launcher, | ||
| }); |
There was a problem hiding this comment.
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.
|
# [2.34.0](v2.33.1...v2.34.0) (2025-03-15) ### Features * Add Rokt Wrapper ([#994](#994)) ([04d1efc](04d1efc))
|
🎉 This PR is included in version 2.34.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |



Instructions
developmentSummary
Testing Plan
window.mParticle.Rokt.selectPlacements()method.window.mParticle.Rokt.attachLauncher().selectPlacementrequests should be queued until the launcher is attached, which will then trigger Rokt'sselectPlacementslogic.Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)