## Summary Frontend for WhatsApp Cloud Calling: header / contact-panel call buttons, ringing widget, accept/reject/hangup, mute, in-bubble audio player + transcript, recording-on-hangup upload, mid-call reload warning. WebRTC is browser-direct to Meta — no media server bridge. ## Closes - https://linear.app/chatwoot/issue/PLA-150 ## How to test Requires backend support — the controller, services, model changes, and routes ship in **#14334** (`feature/pla-150`). Merge / deploy that first (or simultaneously); the FE alone won't function without those endpoints. Then on staging, for a WhatsApp Cloud + embedded-signup inbox with the new \`Configuration → Enable voice calling\` toggle ON and webhook registered: 1. **Outbound** — open a conversation, click the phone icon in the conversation header (or contact panel), grant mic, your phone rings, answer, audio both ways, hang up. Recording + transcript land in the bubble within ~10s. 2. **Inbound** — call the business number from your phone. The FloatingCallWidget appears bottom-right with caller name. Click accept, audio both ways, hang up. Recording + transcript appear. 3. **Mute** — during an active WhatsApp call, click the mic icon next to hangup. Speech stops reaching Meta until you click again. 4. **Mid-call reload guard** — try `Cmd-R` during an active call; browser shows a confirm prompt. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: iamsivin <iamsivin@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
81 lines
1.3 KiB
Ruby
81 lines
1.3 KiB
Ruby
class InboxPolicy < ApplicationPolicy
|
|
class Scope
|
|
attr_reader :user_context, :user, :scope, :account, :account_user
|
|
|
|
def initialize(user_context, scope)
|
|
@user_context = user_context
|
|
@user = user_context[:user]
|
|
@account = user_context[:account]
|
|
@account_user = user_context[:account_user]
|
|
@scope = scope
|
|
end
|
|
|
|
def resolve
|
|
user.assigned_inboxes
|
|
end
|
|
end
|
|
|
|
def index?
|
|
true
|
|
end
|
|
|
|
def show?
|
|
# FIXME: for agent bots, lets bring this validation to policies as well in future
|
|
return true if @user.is_a?(AgentBot)
|
|
|
|
Current.user.assigned_inboxes.include? record
|
|
end
|
|
|
|
def assignable_agents?
|
|
true
|
|
end
|
|
|
|
def agent_bot?
|
|
true
|
|
end
|
|
|
|
def campaigns?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def create?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def update?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def destroy?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def set_agent_bot?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def avatar?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def sync_templates?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def health?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def reset_secret?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def enable_whatsapp_calling?
|
|
@account_user.administrator?
|
|
end
|
|
|
|
def disable_whatsapp_calling?
|
|
@account_user.administrator?
|
|
end
|
|
end
|