Skip to content

feat(task): CAI-7811 Campaign Countdown#682

Merged
brain-frog merged 5 commits intowebex:nextfrom
brain-frog:cai-7811
Apr 30, 2026
Merged

feat(task): CAI-7811 Campaign Countdown#682
brain-frog merged 5 commits intowebex:nextfrom
brain-frog:cai-7811

Conversation

@brain-frog
Copy link
Copy Markdown
Contributor

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

This pull request addresses

Creating the Campaign Countdown component to be used in future campaign preview features

by making the following changes

Created a countdown component that can take an elapsed time or the time the countdown should end as well as a callback for what to do after the countdown finishes, which will be helpful for performing the automatic timeout action for campaign preview tasks

vidcast: https://app.vidcast.io/share/d24a983e-991f-4c10-ba66-60560ca38483?playerMode=vidcast

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
    < ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

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
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

@brain-frog brain-frog requested a review from a team as a code owner April 27, 2026 14:39
@brain-frog brain-frog changed the title Countdown implementation (feat): CAI-7811 Campaign Countdown Apr 27, 2026
@brain-frog brain-frog added the validated Indicates that the PR is ready for actions label Apr 27, 2026
@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-682.d1b38q61t1z947.amplifyapp.com

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eab28a86a3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0ae195827

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +41 to +43
} else if (remainingSeconds === 0 && !hasTimedOut) {
setHasTimedOut(true);
onTimeout?.();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip firing timeout callback without a configured deadline

This branch calls onTimeout immediately whenever remainingSeconds initializes to 0, which also happens when both timeoutTimestamp and timeoutInSeconds are absent (or not yet populated on first render). In that case a parent that always passes onTimeout can trigger the campaign timeout action instantly before backend timeout data arrives, causing premature task expiration. Add a guard so the callback only fires when at least one valid timeout source is configured.

Useful? React with 👍 / 👎.

@@ -1,3 +1,5 @@
const store = window.store;
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.

do you need 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.

yes this was causing the build to fail which in turn caused the pre-commit script to fail

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.

im not having this issue on my branch, which is strange

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.

I think this change is okay to be added, its only sample- it should not be an issue

export const PHONE_NUMBER = 'Phone Number:';
export const CUSTOMER_NAME = 'Customer Name';
export const RONA = 'RONA:';
export const TIME_LEFT = 'Time left:';
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 you confirm that time left isn't used already in incomingtask component? and if so, share the const

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 hard coded there, const can be shared to incoming task in a follow up enhancement dedicated to replacing hard coded text with consts

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce82ee2b88

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

timerRef.current = setTimeout(() => {
// Recalculate from wall clock when using timeoutTimestamp to handle
// browser throttling (background tabs, blocked main thread)
const newRemaining = timeoutTimestamp !== undefined ? calculateRemaining() : remainingSeconds - 1;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Respect fallback countdown when timestamp is unparsable

Use the same validity check here that calculateRemainingSeconds uses, rather than only timeoutTimestamp !== undefined. With inputs like timeoutTimestamp: '' (or any unparsable string) plus timeoutInSeconds, calculateRemaining() falls back to the original timeoutInSeconds value, and this branch reassigns that same value every tick, so the countdown never decreases and onTimeout never fires. This can happen when backend data sends an empty/invalid timestamp while the seconds fallback is provided.

Useful? React with 👍 / 👎.

@brain-frog brain-frog added the run_e2e Add this label to run E2E test for meeting and CC widgets label Apr 28, 2026
@brain-frog brain-frog added validated Indicates that the PR is ready for actions and removed validated Indicates that the PR is ready for actions labels Apr 29, 2026
@brain-frog brain-frog changed the title (feat): CAI-7811 Campaign Countdown feat(task): CAI-7811 Campaign Countdown Apr 29, 2026
@brain-frog brain-frog added validated Indicates that the PR is ready for actions run_e2e Add this label to run E2E test for meeting and CC widgets and removed validated Indicates that the PR is ready for actions run_e2e Add this label to run E2E test for meeting and CC widgets labels Apr 29, 2026
@@ -1,3 +1,5 @@
const store = window.store;
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.

I think this change is okay to be added, its only sample- it should not be an issue

@brain-frog brain-frog merged commit 881fef4 into webex:next Apr 30, 2026
29 of 36 checks passed
@github-actions
Copy link
Copy Markdown

🎉 Your changes are now available!
Released in: webex-cc-widgets-v1.28.0-next.40
📖 View full changelog →
Packages Updated Version
@webex/cc-widgets 1.28.0-next.40
@webex/cc-components 1.28.0-next.30
@webex/cc-station-login 1.28.0-next.30
@webex/cc-task 1.28.0-next.33
@webex/cc-user-state 1.28.0-next.31
samples-cc-react-app 0.0.0-next.1
samples-cc-wc-app 0.0.0-next.1

Thank you for your contribution!
🤖 This is an automated message. For queries, please contact support.

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

Labels

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