Skip to content

fix: Update integrationName to support postfix#28

Merged
alexs-mparticle merged 3 commits into
developmentfrom
fix/SQDSDKS-7268-integration-name
May 9, 2025
Merged

fix: Update integrationName to support postfix#28
alexs-mparticle merged 3 commits into
developmentfrom
fix/SQDSDKS-7268-integration-name

Conversation

@alexs-mparticle

Copy link
Copy Markdown
Collaborator

Summary

Add a postfix for integrationName that can be configured via Custom Flags.

Testing Plan

Pass in custom flag via window.mParticle.config to add an extra string to the integrationName.

customFlags: {
    "Rokt.integrationName": "foo",
},

@alexs-mparticle alexs-mparticle marked this pull request as ready for review May 6, 2025 19:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 a custom postfix on the integrationName via custom flags. It updates the integrationName generation logic in the main kit file and adds a new test to validate the expected output when a custom postfix is provided.

  • Updates integrationName generation with a new helper function.
  • Modifies the attachLauncher call to receive the custom integrationName.
  • Adds test coverage for the custom integration name behavior.

Reviewed Changes

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

File Description
test/src/tests.js Adds a test to check that custom integrationName postfix is appended correctly.
src/Rokt-Kit.js Introduces a generateIntegrationName helper and updates attachLauncher to support the custom postfix.

Comment thread src/Rokt-Kit.js Outdated
Comment thread src/Rokt-Kit.js Outdated
@alexs-mparticle alexs-mparticle requested a review from Copilot May 6, 2025 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the behavior of integrating a postfix into the integrationName for the Rokt forwarder based on the customFlags configuration.

  • Added a new test to validate that a custom postfix is appended to integrationName when provided.
  • Updated Rokt-Kit.js to compute integrationName using a new generateIntegrationName helper and modified the attachLauncher function to pass this value.

Reviewed Changes

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

File Description
test/src/tests.js New test ensuring custom integration postfix is correctly applied.
src/Rokt-Kit.js Updated integrationName generation and its propagation to the launcher.
Comments suppressed due to low confidence (1)

test/src/tests.js:204

  • [nitpick] Consider obtaining integrationName using the generateIntegrationName helper instead of duplicating the string construction logic in tests.
window.Rokt.integrationName = 'mParticle_wsdkv_1.2.3_kitv_' + packageVersion + '_' + customIntegrationName;

Comment thread src/Rokt-Kit.js

@BrandonStalnaker BrandonStalnaker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Logic makes sense to me

Comment thread src/Rokt-Kit.js Outdated

var customIntegrationName =
customFlags && customFlags['Rokt.integrationName'];
self.integrationName = generateIntegrationName(customIntegrationName);

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.

Any reason to keep the integration name on the class? It's only used once, I'd just call it a local variable that passes into attachLauncher instead

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good callout.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the integrationName generation logic to support a configurable postfix via customFlags and extends the corresponding test coverage.

  • Updates the Rokt-Kit constructor to generate integrationName using an optional custom integration name.
  • Updates the test suite to verify the appended integration name functionality.

Reviewed Changes

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

File Description
test/src/tests.js Adds a test case to validate the custom integrationName postfix logic.
src/Rokt-Kit.js Updates constructor and launcher attachment to incorporate customFlags for integrationName generation.
Comments suppressed due to low confidence (1)

test/src/tests.js:224

  • [nitpick] Consider extracting the expected integrationName into a variable to reduce duplication and improve test clarity.
window.Rokt.integrationName.should.equal('mParticle_wsdkv_1.2.3_kitv_' + packageVersion + '_' + customIntegrationName);

Comment thread src/Rokt-Kit.js
Comment on lines +283 to +286
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;

if (customIntegrationName) {
name += '_' + customIntegrationName;

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider using template literals to construct the integrationName string, which would improve readability and maintainability.

Suggested change
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
if (customIntegrationName) {
name += '_' + customIntegrationName;
var name = `mParticle_wsdkv_${coreSdkVersion}_kitv_${kitVersion}`;
if (customIntegrationName) {
name += `_${customIntegrationName}`;

Copilot uses AI. Check for mistakes.
@alexs-mparticle alexs-mparticle merged commit 1180363 into development May 9, 2025
4 checks passed
github-actions Bot pushed a commit that referenced this pull request May 13, 2025
## [1.3.1](v1.3.0...v1.3.1) (2025-05-13)

### Bug Fixes

* Update attachLauncher to use options object for integration settings ([#29](#29)) ([a6ad782](a6ad782))
* Update integrationName to support postfix ([#28](#28)) ([1180363](1180363))
@alexs-mparticle alexs-mparticle deleted the fix/SQDSDKS-7268-integration-name branch March 25, 2026 15:15
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.

4 participants