Skip to content

fix(ui): persist CZentrix panel on innerpage routes, move dev sim button - #30

Merged
snehar-nd merged 8 commits into
mainfrom
fix/cti-panel-persist
Jul 30, 2026
Merged

fix(ui): persist CZentrix panel on innerpage routes, move dev sim button#30
snehar-nd merged 8 commits into
mainfrom
fix/cti-panel-persist

Conversation

@Aarti-panchal01

@Aarti-panchal01 Aarti-panchal01 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fix 1 — CZentrix panel now persists on all routes including /innerpage/*
The panel was owned by the dashboard footer and was destroyed on navigation.
Extracted into a root-level CtiPanelComponent rendered in app.html outside
the router-outlet so it stays mounted across all routes during a call.

Fix 2 — Dev simulation button moved to bottom-left
"Simulate inbound call (dev)" was colliding with CZentrix button bottom-right.
Moved to bottom-left with subtle muted styling — clearly a dev tool, not
a primary UI element.

Summary by CodeRabbit

  • New Features
    • Added a persistent CZentrix soft-phone panel to the app shell, with an auth/agent-based toggle and embedded iframe.
    • Enabled root-level inbound CTI handling via browser postMessage to start the inbound call flow and navigate to the inner page.
  • Updates
    • Removed CTI-related footer/dashboard controls and state; the dashboard footer now focuses on the post-logout feedback link.
  • Bug Fixes
    • Improved robustness across HAO/closure flows by validating that backend data is an array before updating campaign/call options.

…ton to bottom left

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

CTI rendering and inbound-call handling move from dashboard-scoped code into root-level components and a singleton service. The dashboard retains feedback and agent-status responsibilities. HAO campaign flows now validate array-shaped response payloads.

Changes

CTI application integration

Layer / File(s) Summary
CTI panel implementation
src/app/shared/components/layout/cti-panel.component.ts
Adds a floating CTI panel with authentication, agent, and role gating, toggle state, and sanitized iframe URL binding.
Inbound CTI service
src/app/app-modules/call/inbound-cti.service.ts
Adds root-scoped postMessage handling with origin and eligibility validation, payload parsing, duplicate detection, call-store seeding, and navigation to /innerpage.
Application shell integration
src/app/app.ts, src/app/app.html
Imports, instantiates, and renders the CTI panel and inbound CTI service at the application root.
Dashboard CTI wiring removal
src/app/app-modules/dashboard/components/dashboard-footer.component.ts, src/app/app-modules/dashboard/dashboard.component.ts
Removes footer CTI inputs and state plus dashboard message handling and agent ID derivation while preserving feedback and development simulation behavior.

HAO response validation

Layer / File(s) Summary
Campaign response guards
src/app/app-modules/call/hao/hao.service.ts, src/app/app-modules/call/hao/steps/closure-step.component.ts
Validates campaign responses as arrays, returning or assigning empty arrays for invalid payloads; call types now raise an error for invalid data.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Telephony
  participant InboundCtiService
  participant CallStore
  participant Router
  Telephony->>InboundCtiService: Send inbound CTI postMessage
  InboundCtiService->>CallStore: Validate origin, eligibility, and active session
  InboundCtiService->>CallStore: Seed fresh call with CLI and sessionId
  InboundCtiService->>Router: Navigate to /innerpage
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main UI change: persisting the CZentrix panel across routes and moving the dev simulate button.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/app.html`:
- Line 2: Move the trusted postMessage listener and inbound CTI call-routing
logic out of DashboardComponent into an application-scoped service or root-level
owner that remains alive across route changes. Update the app bootstrap flow to
initialize that owner once, preserving the existing message validation and
routing behavior for calls received from the persistent app-cti-panel iframe.

In `@src/app/shared/components/layout/cti-panel.component.ts`:
- Around line 94-100: Update the showCzentrix computed predicate to also require
a non-null agent ID from ctiUrl(), while preserving the existing authentication
and supervisor feature-code checks. Use the agentID value exposed by ctiUrl() so
the toggle remains hidden when no agent ID is available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 986f1903-90e0-4d84-a9a3-4edfd435b2f9

📥 Commits

Reviewing files that changed from the base of the PR and between 515dec4 and ca3f2e9.

📒 Files selected for processing (5)
  • src/app/app-modules/dashboard/components/dashboard-footer.component.ts
  • src/app/app-modules/dashboard/dashboard.component.ts
  • src/app/app.html
  • src/app/app.ts
  • src/app/shared/components/layout/cti-panel.component.ts

Comment thread src/app/app.html
Comment thread src/app/shared/components/layout/cti-panel.component.ts
Aarti-panchal01 and others added 2 commits July 25, 2026 00:36
…when no agentID

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/app/app-modules/call/inbound-cti.service.ts (1)

35-40: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Reject opaque telephony URL schemes before trusting the origin.

new URL('data:...').origin and new URL('file:///...').origin can be "null", which also appears as MessageEvent.origin for opaque or sandboxed senders. If telephoneServer is misconfigured this way, forged inbound CTI messages would pass the origin check. Restrict the configured URL to http:/https: and reject "null".

Proposed fix
 function safeOrigin(url: string): string {
   try {
-    return new URL(url).origin;
+    const parsed = new URL(url);
+    if (
+      !['http:', 'https:'].includes(parsed.protocol) ||
+      parsed.origin === 'null'
+    ) {
+      return 'invalid:no-telephony-origin';
+    }
+    return parsed.origin;
   } catch {
     return 'invalid:no-telephony-origin';
   }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/app-modules/call/inbound-cti.service.ts` around lines 35 - 40, Update
safeOrigin to accept only http: and https: telephoneServer URLs, returning the
existing invalid sentinel for all other schemes or when the parsed origin is
"null". Preserve the current valid-origin behavior and error fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/app/app-modules/call/inbound-cti.service.ts`:
- Around line 35-40: Update safeOrigin to accept only http: and https:
telephoneServer URLs, returning the existing invalid sentinel for all other
schemes or when the parsed origin is "null". Preserve the current valid-origin
behavior and error fallback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6db7fd8b-3926-429e-a009-a43ca6aebc24

📥 Commits

Reviewing files that changed from the base of the PR and between ca3f2e9 and 0b63050.

📒 Files selected for processing (6)
  • src/app/app-modules/call/hao/hao.service.ts
  • src/app/app-modules/call/hao/steps/closure-step.component.ts
  • src/app/app-modules/call/inbound-cti.service.ts
  • src/app/app-modules/dashboard/dashboard.component.ts
  • src/app/app.ts
  • src/app/shared/components/layout/cti-panel.component.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/shared/components/layout/cti-panel.component.ts

…ypes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 35 minutes.

@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/app-modules/call/inbound-cti.service.ts`:
- Around line 64-69: Update the inbound message handler around onMessage to
require the same CTI eligibility conditions enforced by CtiPanelComponent before
calling handleCtiMessage: the user must be authenticated, able to receive CTI
calls, and have an agent ID. Keep the trusted-origin check and return without
processing events when either origin or authentication eligibility fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a3fc89b6-b3d1-4a54-b967-dad8b6ab3d49

📥 Commits

Reviewing files that changed from the base of the PR and between 515dec4 and 607ebb2.

📒 Files selected for processing (8)
  • src/app/app-modules/call/hao/hao.service.ts
  • src/app/app-modules/call/hao/steps/closure-step.component.ts
  • src/app/app-modules/call/inbound-cti.service.ts
  • src/app/app-modules/dashboard/components/dashboard-footer.component.ts
  • src/app/app-modules/dashboard/dashboard.component.ts
  • src/app/app.html
  • src/app/app.ts
  • src/app/shared/components/layout/cti-panel.component.ts

Comment thread src/app/app-modules/call/inbound-cti.service.ts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 34 minutes.

@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/app-modules/call/hao/hao.service.ts`:
- Line 162: Update the response mapping in the call-type service around the
visible pipe/map logic so null or undefined data still produces an empty result,
but any other non-array payload throws an error instead of returning [].
Preserve array responses unchanged so ClosureStepComponent.loadCallTypes()
reaches its existing error handling for malformed successful responses.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 591a63cb-60d1-4b52-9c4a-64efc0930e63

📥 Commits

Reviewing files that changed from the base of the PR and between 515dec4 and f49814d.

📒 Files selected for processing (8)
  • src/app/app-modules/call/hao/hao.service.ts
  • src/app/app-modules/call/hao/steps/closure-step.component.ts
  • src/app/app-modules/call/inbound-cti.service.ts
  • src/app/app-modules/dashboard/components/dashboard-footer.component.ts
  • src/app/app-modules/dashboard/dashboard.component.ts
  • src/app/app.html
  • src/app/app.ts
  • src/app/shared/components/layout/cti-panel.component.ts

Comment thread src/app/app-modules/call/hao/hao.service.ts Outdated
…ires

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/app-modules/call/hao/hao.service.ts`:
- Around line 167-172: Update the response handling in the call-type retrieval
method around the visible Array.isArray check so null or undefined res.data
returns an empty list, preserving the prior res.data ?? [] behavior. Continue
throwing the existing error for all other non-array payloads, and return array
data unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6125b795-8cb0-4bcc-891c-7a45ad308b40

📥 Commits

Reviewing files that changed from the base of the PR and between f49814d and c20a6a6.

📒 Files selected for processing (1)
  • src/app/app-modules/call/hao/hao.service.ts

Comment thread src/app/app-modules/call/hao/hao.service.ts
@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 49 minutes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Aarti-panchal01

Copy link
Copy Markdown
Contributor Author

@coderabbitai review full pr

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Aarti-panchal01 I’ll perform a full review of PR #30.

✅ Action performed

Full review finished.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@snehar-nd
snehar-nd merged commit 0a7b856 into main Jul 30, 2026
1 check passed
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.

2 participants