Skip to content

feat: Expose Integration Name to Kit Object#58

Open
alexs-mparticle wants to merge 2 commits intodevelopmentfrom
feat/SDKE-915-set-integration-name
Open

feat: Expose Integration Name to Kit Object#58
alexs-mparticle wants to merge 2 commits intodevelopmentfrom
feat/SDKE-915-set-integration-name

Conversation

@alexs-mparticle
Copy link
Collaborator

@alexs-mparticle alexs-mparticle commented Feb 12, 2026

Summary

Exposes the integrationName to the kit object, which will be passed into the Core SDK. This allows us to pick up the integration name for logging.

Related to mParticle/mparticle-web-sdk#1137

Testing Plan

Using a sample app, observe that the kit now contains an integrationName when it attaches to the RoktManager.

Copy link

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 a computed integrationName directly on the kit instance so it’s available when the kit attaches to the Rokt Manager (and can be forwarded into Core SDK logging).

Changes:

  • Add integrationName property to the kit instance and set it during initialization.
  • Continue passing the computed integrationName into the launcher options.
  • Add tests intended to validate integrationName is present on the attached kit instance (plus custom-name behavior).

Reviewed changes

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

File Description
src/Rokt-Kit.js Stores the generated integration name on the kit instance (self.integrationName) and uses it for launcher options.
test/src/tests.js Adds new init-time tests asserting integrationName is available on the kit after attach, including custom integration name suffixing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +372 to +377
// Wait for initialization to complete
await waitForCondition(() => window.mParticle.Rokt.isInitialized);

window.mParticle.Rokt.kit.integrationName.should.equal(
`${sdkVersion}_${kitVersion}_${customName}`
);
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This test also waits on window.mParticle.Rokt.isInitialized, which is toggled inside the mock before attachKit necessarily completes. To avoid intermittent failures (e.g., window.mParticle.Rokt.kit still undefined), wait on attachKitCalled / forwarder.isInitialized / kit being assigned before asserting kit.integrationName.

Copilot uses AI. Check for mistakes.
Comment on lines +399 to +405
// Wait for initialization to complete
await waitForCondition(() => window.mParticle.Rokt.isInitialized);

window.mParticle.Rokt.attachKitCalled.should.equal(true);
window.mParticle.Rokt.kit.integrationName.should.be.a.String();
window.mParticle.Rokt.kit.integrationName.should.not.be.empty();
});
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

Even though the test later asserts attachKitCalled, the wait condition is still window.mParticle.Rokt.isInitialized (set early by the mock). Waiting directly for attachKitCalled (or kit assignment) would better guarantee the kit has been attached before reading kit.integrationName.

Copilot uses AI. Check for mistakes.
Comment on lines +339 to +344
// Wait for initialization to complete
await waitForCondition(() => window.mParticle.Rokt.isInitialized);

window.mParticle.Rokt.kit.integrationName.should.equal(
`${sdkVersion}_${kitVersion}`
);
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

These assertions rely on waitForCondition(() => window.mParticle.Rokt.isInitialized), but MockRoktForwarder.createLauncher sets isInitialized = true before the kit is actually attached. This can make the test race/flaky if attachKit runs later. Consider waiting on window.mParticle.Rokt.attachKitCalled (or window.mParticle.forwarder.isInitialized, or window.mParticle.Rokt.kit being set) instead so the kit is guaranteed available before asserting kit.integrationName.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@jaissica12 jaissica12 left a comment

Choose a reason for hiding this comment

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

LGTM

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