Skip to content

Conversation

Kesari3008
Copy link
Contributor

@Kesari3008 Kesari3008 commented Jul 3, 2025

COMPLETES #AD-HOC

This pull request addresses

Enable the int environment to support testing in integration setup.

by making the following changes

Added flag on the sample app to support integration setup testing.

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 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

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@Kesari3008 Kesari3008 requested a review from a team as a code owner July 3, 2025 19:20
Copy link
Contributor

coderabbitai bot commented Jul 3, 2025

📝 Walkthrough

Walkthrough

A toggle mechanism has been introduced to switch between production and integration environments in the contact center sample application. This involves adding a button to the UI labeled "In Production" and a supporting JavaScript function, changeEnv(), which toggles a boolean flag enableProd. The Webex SDK configuration in both OAuth and Webex initialization functions now conditionally selects the appropriate client credentials and service endpoints based on the value of enableProd. The UI updates the button label to reflect the current environment state, allowing dynamic environment switching.

Estimated code review effort

1 (<30 minutes)

Possibly related PRs

  • feat(CC): add oauth login to samples #4022: This PR extends environment configuration toggling in the same initOauth and initWebex functions, directly building upon the OAuth initialization logic modified in the current PR.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

yarn install v1.22.22
[1/4] Resolving packages...
(node:12612) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.
(Use node --trace-deprecation ... to show where the warning was created)
warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This

... [truncated 7275 characters] ...

[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning workspace-aggregator-75ef3cb4-d947-4038-ba49-b783d0a0ed07 > @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^14 || ^16 || ^17 || ^18 || ^19". Got "24.3.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c71a810 and efc821f.

📒 Files selected for processing (2)
  • docs/samples/contact-center/app.js (3 hunks)
  • docs/samples/contact-center/index.html (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/samples/contact-center/index.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/samples/contact-center/app.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Initialize Project
  • GitHub Check: AWS Amplify Console Web Preview
✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

  • 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbacdbb and c71a810.

📒 Files selected for processing (2)
  • docs/samples/contact-center/app.js (3 hunks)
  • docs/samples/contact-center/index.html (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.
Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: packages/@webex/plugin-cc/test/unit/spec/services/task/dialer.ts:52-57
Timestamp: 2025-02-12T10:13:06.265Z
Learning: In packages/@webex/plugin-cc tests, catch blocks in test cases follow CC Desktop pattern using `expect(true).toBe(true)` for consistency.
Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: docs/samples/contact-center/index.html:226-237
Timestamp: 2025-02-12T10:21:39.427Z
Learning: Accessibility improvements are not required for sample applications in the webex-js-sdk repository, as these apps primarily focus on demonstrating core functionality.
Learnt from: bhabalan
PR: webex/webex-js-sdk#4022
File: docs/samples/contact-center/app.js:116-118
Timestamp: 2024-12-06T12:48:03.643Z
Learning: In `docs/samples/contact-center/app.js`, hardcoding the OAuth client ID and secret is acceptable for testing purposes in an isolated sandbox environment.
Learnt from: sreenara
PR: webex/webex-js-sdk#4175
File: packages/calling/src/Voicemail/WxCallBackendConnector.ts:360-370
Timestamp: 2025-04-01T11:07:10.907Z
Learning: In the Webex JavaScript SDK, some HTTP requests need to use GET even for operations that change state (like marking voicemails as read/unread or deleting them) because the team doesn't control the service implementation. This is part of adapting to external service requirements, particularly for FedRAMP compliance.
docs/samples/contact-center/index.html (1)
Learnt from: bhabalan
PR: webex/webex-js-sdk#4022
File: docs/samples/contact-center/app.js:116-118
Timestamp: 2024-12-06T12:48:03.643Z
Learning: In `docs/samples/contact-center/app.js`, hardcoding the OAuth client ID and secret is acceptable for testing purposes in an isolated sandbox environment.
docs/samples/contact-center/app.js (5)
Learnt from: bhabalan
PR: webex/webex-js-sdk#4022
File: docs/samples/contact-center/app.js:116-118
Timestamp: 2024-12-06T12:48:03.643Z
Learning: In `docs/samples/contact-center/app.js`, hardcoding the OAuth client ID and secret is acceptable for testing purposes in an isolated sandbox environment.
Learnt from: Kesari3008
PR: webex/webex-js-sdk#4258
File: packages/@webex/plugin-cc/src/webex.js:0-0
Timestamp: 2025-05-13T17:01:05.340Z
Learning: In the webex-js-sdk project, `PACKAGE_VERSION` is a constant that's injected by the build system and doesn't need to be explicitly imported in the source files.
Learnt from: robstax
PR: webex/webex-js-sdk#3948
File: packages/@webex/webex-core/test/unit/spec/webex-core.js:178-254
Timestamp: 2024-11-01T00:30:53.442Z
Learning: In the webex-js-sdk project, when reviewing changes in `packages/@webex/webex-core/test/unit/spec/webex-core.js`, if the user declines to add negative test cases for invalid interceptor configurations, accept their decision and do not insist.
Learnt from: pagour98
PR: webex/webex-js-sdk#4086
File: docs/samples/contact-center/index.html:226-237
Timestamp: 2025-02-12T10:21:39.427Z
Learning: Accessibility improvements are not required for sample applications in the webex-js-sdk repository, as these apps primarily focus on demonstrating core functionality.
Learnt from: rsarika
PR: webex/webex-js-sdk#4098
File: packages/calling/src/Logger/index.ts:0-0
Timestamp: 2025-02-14T09:43:31.759Z
Learning: In the Webex JS SDK's Logger module, the console is used as the default logger fallback when no custom logger is provided, making extensive logger validation unnecessary. A simple existence check `if (logger)` is sufficient when setting a custom logger.
🪛 Biome (1.9.4)
docs/samples/contact-center/app.js

[error] 83-83: Shouldn't redeclare 'changeEnv'. Consider to delete it or rename it.

'changeEnv' is defined here:

(lint/suspicious/noRedeclare)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: AWS Amplify Console Web Preview
🔇 Additional comments (5)
docs/samples/contact-center/index.html (1)

47-47: LGTM! Clean UI addition for environment toggle.

The button placement in the Auth & Registration section is logical, and the implementation correctly integrates with the JavaScript functionality defined in app.js.

docs/samples/contact-center/app.js (4)

81-81: LGTM! Good default value for production environment.

Starting with enableProd = true ensures the application defaults to production mode, which is the safer default.


83-86: LGTM! Clean toggle implementation.

The function correctly toggles the environment state and updates the button label accordingly. The ternary operator clearly shows the two states.


182-197: LGTM! Proper environment-based OAuth configuration.

The implementation correctly:

  • Uses different client IDs for production vs integration environments
  • Conditionally sets the discovery service URL for integration environment
  • Maintains the existing OAuth flow structure

The hardcoded client IDs are acceptable for testing purposes in this sample application context.


814-821: LGTM! Consistent environment configuration in Webex initialization.

The integration environment discovery service URL configuration matches the OAuth initialization approach, ensuring consistent environment selection across both authentication methods.

@Kesari3008 Kesari3008 added the validated If the pull request is validated for automation. label Jul 3, 2025
Copy link

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

Access this pull request here: https://pr-4377.d3m3l2kee0btzx.amplifyapp.com

Copy link
Contributor

@sreenara sreenara left a comment

Choose a reason for hiding this comment

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

Please see the comment

const webexConfig = generateWebexConfig({
credentials: {
...(!enableProd && {authorizeUrl: 'https://idbrokerbts.webex.com/idb/oauth2/v1/authorize'}),
client_id: enableProd ? 'C70599433db154842e919ad9e18273d835945ff198251c82204b236b157b3a213' : 'Cd0dd53db1f470a5a9941e5eee31575bd0889d7006e3a80a1443ad12a42049da1',
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the clientId different from the older value for Prod? C04ef08ffce356c3161bb66b15dbdd98d26b6c683c5ce1a1a89efad545fdadd74. We won't use the integration then...

@sreenara sreenara dismissed their stale review July 22, 2025 17:10

Not a blocking comment

Copy link
Contributor

@sreenara sreenara left a comment

Choose a reason for hiding this comment

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

Non-blocking comment. Please reply on the change of the clientId

Copy link
Contributor

@adhmenon adhmenon left a comment

Choose a reason for hiding this comment

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

PR looks good, only have one comment regarding the different client id.
Let us also update with latest next before merging.

webex = window.webex = Webex.init({
config: generateWebexConfig({
credentials: {
client_id: 'C04ef08ffce356c3161bb66b15dbdd98d26b6c683c5ce1a1a89efad545fdadd74',
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we not using this service app for OAuth anymore? Is there a reason for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validated If the pull request is validated for automation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants