Skip to content

feat: sdke 142 support launcher.use in rokt web kit#44

Merged
jaissica12 merged 6 commits into
developmentfrom
feat/SDKE-142-support-launcher.use-in-rokt-web-kit
Sep 15, 2025
Merged

feat: sdke 142 support launcher.use in rokt web kit#44
jaissica12 merged 6 commits into
developmentfrom
feat/SDKE-142-support-launcher.use-in-rokt-web-kit

Conversation

@jaissica12
Copy link
Copy Markdown
Contributor

@jaissica12 jaissica12 commented Sep 9, 2025

Summary

Testing Plan

  • For now tested by adding respective tests in tests.js

@jaissica12 jaissica12 changed the title featsdke 142 support launcher.use in rokt web kit feat: sdke 142 support launcher.use in rokt web kit Sep 9, 2025
@jaissica12 jaissica12 requested a review from rmi22186 September 9, 2025 20:38
Copy link
Copy Markdown
Collaborator

@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 test clean up, mostly. Looks good otherwise.

Comment thread src/Rokt-Kit.js Outdated

/**
* Enables optional Integration Launcher extensions before selecting placements
* @see https://docs.rokt.com/developers/integration-guides/web/library/integration-launcher/#use
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would link this docs page in the PR description and remove from the commit. The docs are already not searchable, so the docs likely will go away since it's the legacy way of implementing.

Comment thread test/src/tests.js Outdated
Comment on lines +1424 to +1426
window.mParticle.forwarder.launcher = {
use: function () {},
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This line doesn't seem necessary

Comment thread test/src/tests.js Outdated
Comment on lines +1428 to +1438
const error = await (async () => {
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
return null;
} catch (e) {
return e;
}
})();

(!!error).should.equal(true);
error.message.should.equal('Rokt Kit: Not initialized');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems a bit convoluted to gett he error message. I think the following works:

Suggested change
const error = await (async () => {
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
return null;
} catch (e) {
return e;
}
})();
(!!error).should.equal(true);
error.message.should.equal('Rokt Kit: Not initialized');
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
} catch (error) {
error.message.should.equal('Rokt Kit: Not initialized');
}

Comment thread test/src/tests.js Outdated
Comment on lines +1468 to +1478
const error = await (async () => {
try {
await window.mParticle.forwarder.use(123);
return null;
} catch (e) {
return e;
}
})();

(!!error).should.equal(true);
error.message.should.equal('Rokt Kit: Invalid extension name');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const error = await (async () => {
try {
await window.mParticle.forwarder.use(123);
return null;
} catch (e) {
return e;
}
})();
(!!error).should.equal(true);
error.message.should.equal('Rokt Kit: Invalid extension name');
try {
await window.mParticle.forwarder.use(123);
} catch (error) {
error.message.should.equal('Rokt Kit: Invalid extension name');
}

Comment thread test/src/tests.js Outdated
Comment on lines +1493 to +1502
const error = await (async () => {
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
return null;
} catch (e) {
return e;
} finally {
window.console.error = consoleError;
}
})();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const error = await (async () => {
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
return null;
} catch (e) {
return e;
} finally {
window.console.error = consoleError;
}
})();
try {
await window.mParticle.forwarder.use('ThankYouPageJourney');
throw new Error('Expected promise to reject');
} catch (error) {
error.message.should.equal('Rokt Kit: Not initialized');
} finally {
window.console.error = consoleError;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Was there a reason you only did the resetting of window.console.error here to the original state? I think you should follow this in your previous tests where you stub window.console.error as well.

I'd also call the variable originalConsoleError to be more specific.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In my initial commit there were two separate tests (reject + log) that I merged into one here, and that’s when I added the restore of console.error in that spot. I’ve now standardized the #use like you suggested.

Comment thread test/src/tests.js Outdated
window.Rokt.useName.should.equal('ThankYouPageJourney');
});

it('should reject errors from launcher.use', async () => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if this test is needed? We don't need to try to mimic the rejection that the launcher.js file gives us when we put in an incorrect extension name.

@jaissica12 jaissica12 requested a review from rmi22186 September 10, 2025 15:23
Comment thread src/Rokt-Kit.js Outdated
@jaissica12 jaissica12 changed the base branch from main to development September 12, 2025 22:20
@jaissica12 jaissica12 merged commit ea35ce8 into development Sep 15, 2025
6 of 8 checks passed
github-actions Bot pushed a commit that referenced this pull request Sep 15, 2025
# [1.8.0](v1.7.2...v1.8.0) (2025-09-15)

### Features

* sdke 142 support launcher.use in rokt web kit ([#44](#44)) ([ea35ce8](ea35ce8))
@alexs-mparticle alexs-mparticle deleted the feat/SDKE-142-support-launcher.use-in-rokt-web-kit branch March 25, 2026 15:16
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.

3 participants