Skip to content

[CDX-345] Tag Bundle Usage with a different c param#211

Merged
Mudaafi merged 1 commit intomainfrom
cdx-345-plp-ui-feature-differentiate-the-param_c-from-the-library-vs
Feb 26, 2026
Merged

[CDX-345] Tag Bundle Usage with a different c param#211
Mudaafi merged 1 commit intomainfrom
cdx-345-plp-ui-feature-differentiate-the-param_c-from-the-library-vs

Conversation

@Mudaafi
Copy link
Contributor

@Mudaafi Mudaafi commented Feb 24, 2026

PR Description

We tag the bundle with a separate c param cio-ui-plp-bundled-xxx vs when the library is used normally.

Note: We don't update the expected types in useCioClient since consumers of the library shouldn't be setting version ever.

Pull Request Checklist

Before you submit a pull request, please make sure you have to following:

  • I have added or updated TypeScript types for my changes, ensuring they are compatible with the existing codebase.
  • I have added JSDoc comments to my TypeScript definitions for improved documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added any necessary documentation (if appropriate).
  • I have made sure my PR is up-to-date with the main branch.

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no API changes)
  • Documentation content changes
  • TypeScript type definitions update
  • Other... Please describe: Analytics tagging

@Mudaafi Mudaafi requested a review from a team February 24, 2026 21:51
@Mudaafi Mudaafi requested a review from HHHindawy as a code owner February 24, 2026 21:52
Copilot AI review requested due to automatic review settings February 24, 2026 21:52
Copy link
Contributor

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 adds distinct analytics tagging for the bundled version of the CIO PLP component by setting a custom c param (cio-ui-plp-bundled-xxx) to differentiate bundled usage from normal library usage.

Changes:

  • Modified bundled component to inject a custom version string into cioClientOptions
  • Added test coverage for custom version handling in useCioClient hook
  • Added comprehensive test suite for bundled component behavior

Reviewed changes

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

File Description
src/bundled.jsx Imports version number and passes custom bundled version string through cioClientOptions
spec/hooks/useCioClient/useCioClient.test.js Added test to verify custom version option is respected by the hook
spec/bundled/bundled.test.jsx New test file covering bundled version tagging, option preservation, and error handling

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

@constructor-claude-bedrock
Copy link

Code Review Results

Strengths

The implementation correctly injects the bundled version tag via prop spreading with override, keeping the change minimal and well-tested with four targeted test cases.

Critical Issues

[File: src/bundled.jsx Lines: L36-L39] The version field is always overridden, even when the user explicitly provides one in cioClientOptions. The spread order (...rest.cioClientOptions first, then version:) silently discards the user-supplied value without any warning. The test titled 'should override user-provided version' confirms and enshrines this behavior. If the intent is to always enforce the bundled tag (as stated in the PR description), a console.warn should be emitted when a user-supplied version is detected and overridden, so developers are made aware.

Important Issues

[File: spec/hooks/useCioClient/useCioClient.test.js Lines: L67-L82] The new test passes version inside the options object, but the UseCioClientProps type explicitly excludes version from options via Omit (src/hooks/useCioClient.ts:12). This test works at runtime because JavaScript ignores the TypeScript constraint, but it tests a code path that is intentionally blocked by the public API types. The test should either: (a) verify that passing version in options is ignored or overridden (if that is the intended contract), or (b) better reflect the actual supported API where version override can only happen through the bundled wrapper and not by passing it directly to useCioClient.

Suggestions

[File: src/bundled.jsx Line: L6] The import alias versionNumber differs from the alias used in every other file that imports the same module (version in useCioClient.ts, spec/hooks/useCioClient/useCioClient.test.js, and spec/bundled/bundled.test.jsx). Renaming it to version would improve consistency across the codebase.

Overall Assessment: Needs Work

Copy link
Contributor

@esezen esezen left a comment

Choose a reason for hiding this comment

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

LGTM!

@Mudaafi Mudaafi merged commit decddf0 into main Feb 26, 2026
15 of 16 checks passed
@Mudaafi Mudaafi deleted the cdx-345-plp-ui-feature-differentiate-the-param_c-from-the-library-vs branch February 26, 2026 22:10
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