Skip to content

fix(cc-ui-logging): @webex/ui-logging package#491

Merged
Shreyas281299 merged 14 commits into
webex:ccwidgetsfrom
Shreyas281299:metrics
Aug 14, 2025
Merged

fix(cc-ui-logging): @webex/ui-logging package#491
Shreyas281299 merged 14 commits into
webex:ccwidgetsfrom
Shreyas281299:metrics

Conversation

@Shreyas281299

@Shreyas281299 Shreyas281299 commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

COMPLETES # https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6285

This pull request addresses

  • Adds a new package in contact-center widgets that is used to log the usage of widgets.

by making the following changes

  • Now there is a HOC present that can be wrapped around any widget and that provides us with basic logging for a widget. Like when a widget was mounted and unmounted. We also have access to props in the HOC.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  • The testing is done with the amplify link
  • Released an alpha version and had epic tested the logging
  • Testing this in windows and in mac for our sample page

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document

@coderabbitai

coderabbitai Bot commented Jul 7, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aws-amplify-us-east-2

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-491.d1b38q61t1z947.amplifyapp.com

@Shreyas281299 Shreyas281299 added validated Indicates that the PR is ready for actions run_e2e Add this label to run E2E test for meeting and CC widgets labels Jul 22, 2025
@Shreyas281299
Shreyas281299 marked this pull request as ready for review July 25, 2025 10:21
@Shreyas281299 Shreyas281299 changed the title fix(ui-metrics): @webex/ui-metrics package fix(ui-metrics): @webex/ui-logging package Jul 29, 2025
@Shreyas281299

Shreyas281299 commented Jul 29, 2025

Copy link
Copy Markdown
Contributor Author

Update the package to @webex/ui-logging

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.

revert

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.

revert

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.

revert

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.

revert

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.

revert

});
};
}, []);

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.

Add the ticket for propUpdate log

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.

Added

};

export default CallControlCADComponent;
const CallControlCADComponentWithMetrics = withMetrics(CallControlCADComponent, 'CallControlCAD');

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.

CallControlComponent is already wrapper in withMetrics, and we are again wrapping the component here with withMetrics. See if the logging is happening twice? If it is then it is wrong. we only need it once

expect(renderSpy).toHaveBeenCalledTimes(2);
});

it('should handle complex prop changes', () => {

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.

This is not required, as we are only doing shallow comparision

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.

Removed

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.

revert

Comment thread webpack.config.js
Comment on lines +49 to +51
stats: {
warningsFilter: [/sass-loader/],
},

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.

Add a comment about this suppression

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.

Added

@Kesari3008 Kesari3008 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.

Approving with few minor comments

"@momentum-ui/illustrations": "^1.24.0",
"@r2wc/react-to-web-component": "2.0.3",
"@webex/cc-store": "workspace:*"
"@webex/cc-store": "workspace:*",

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.

Why are we removing this ?

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.

Its not removed, just added another dependency and this line it added a comma that why it is showing like this

"react-dom": ">=18.3.1"
}
} No newline at end of file
}

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.

Why were these changes introduced? Can we revert them ?

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.

These are linting changes, this needs to be fixed in the tooling. We already have a task for this

const taskListPresentational = screen.getByTestId('task-list');
expect(taskListPresentational).toBeInTheDocument();

// Verify that `TaskListPresentational` is called with the correct props.

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.

Why is this removed ?

export type WidgetMetrics = {
widgetName: string;
event: 'WIDGET_MOUNTED' | 'ERROR' | 'WIDGET_UNMOUNTED' | 'PROPS_UPDATED';
props?: Record<string, any>;

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.

Is there no way to avoid using any for props and additionalContext ?

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.

No, we dont for now. props can be from any widget. If I use the actual types from the widgets it would end up creating a circular dependency. 1 thing we can do is move all the types to store but that would go against out design

*/
export const logMetrics = (metric: WidgetMetrics) => {
if (!store.logger) {
console.warn('CC-Widgets: UI Metrics: No logger found');

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.

Can we avoid console.warn ? We can use logger.warn

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.

this scenario is for when logger is not present. so we are just logging a warning

* Once we start sanitizing we can do a deep comparison. This is used to only re-render
* the HOC if the props have changed.
*/
export function havePropsChanged(prev: any, next: any): boolean {

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.

Same comment here about any

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.

Same as above

}

// All shallow comparisons passed, consider props unchanged
return false;

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.

Where do we log metrics for prop updated case or is that what that JIra is added in comment ?

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.

The JIRA has been added @ packages/contact-center/ui-logging/src/withMetrics.tsx

@Shreyas281299 Shreyas281299 changed the title fix(ui-metrics): @webex/ui-logging package fix(cc-ui-logging): @webex/ui-logging package Aug 14, 2025
@Shreyas281299
Shreyas281299 merged commit b647448 into webex:ccwidgets Aug 14, 2025
7 of 9 checks passed
github-actions Bot pushed a commit that referenced this pull request Aug 22, 2025
# [1.28.0-ccwidgets.107](v1.28.0-ccwidgets.106...v1.28.0-ccwidgets.107) (2025-08-22)

### Bug Fixes

* **cc-ui-logging:** @webex/ui-logging package ([#491](#491)) ([b647448](b647448))
* **cc-widgets:** added new chat client for cc widgets e2e testing ([#516](#516)) ([1b34046](1b34046))
* **cc-widgets:** Updated chat client with new asset ([#515](#515)) ([ea99d28](ea99d28))
* **publish:** force-publish-version-108 ([#522](#522)) ([125fd27](125fd27))
* **tooling:** force publish version 108 - 2 ([#523](#523)) ([ae9b70e](ae9b70e))
* **tooling:** force publish version 108 - 4 ([#525](#525)) ([010e10e](010e10e))
* **ui-logging:** add public access config in cc-ui-logging ([#521](#521)) ([3ab033b](3ab033b))

### Features

* **widgets:** addd e2e tests for task list ([#508](#508)) ([549dafd](549dafd))
@sreenara

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.28.0-ccwidgets.107 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @ccwidgets run_e2e Add this label to run E2E test for meeting and CC widgets validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants