Compare commits
62
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1e7c5cb02a | ||
|
|
ee773f31eb | ||
|
|
1f03fc4dc3 | ||
|
|
a42b99ada0 | ||
|
|
c6be04cdc1 | ||
|
|
14471cc20c | ||
|
|
6b42ff8d39 | ||
|
|
a88fef2e1d | ||
|
|
ee9f1d7adb | ||
|
|
b711bfd2ca | ||
|
|
42af4b1d01 | ||
|
|
9a7318a9db | ||
|
|
48fa7bf72b | ||
|
|
469e724e3a | ||
|
|
0c101b1f6b | ||
|
|
ad4ec9e93b | ||
|
|
5c560c7628 | ||
|
|
dbb164a37d | ||
|
|
fdcfed2cd7 | ||
|
|
b53bd932c0 | ||
|
|
b4f758f644 | ||
|
|
4df58501e3 | ||
|
|
693309202e | ||
|
|
ecd9cf0326 | ||
|
|
81d8d3862d | ||
|
|
c31325e982 | ||
|
|
c11581b873 | ||
|
|
68d08d7b7d | ||
|
|
fc5d878c00 | ||
|
|
048682130c | ||
|
|
d6310fbd75 | ||
|
|
de0aa5bb30 | ||
|
|
28452b300d | ||
|
|
5871e8e25d | ||
|
|
6784eb9b3d | ||
|
|
1baf5cbe19 | ||
|
|
c2e6ad6376 | ||
|
|
a3e74c314a | ||
|
|
d908c880d2 | ||
|
|
b84e9ddca2 | ||
|
|
fcc6e2b8b2 | ||
|
|
6cab741392 | ||
|
|
f3bc2476fc | ||
|
|
3214d06a83 | ||
|
|
933d310185 | ||
|
|
9f1a2b53ae | ||
|
|
b2ada112d7 | ||
|
|
2ebde48d15 | ||
|
|
8ea21eeefd | ||
|
|
fd28ed8d83 | ||
|
|
b5f5c5c1bc | ||
|
|
4ebfae8b44 | ||
|
|
d0824cc86a | ||
|
|
d2583d32e9 | ||
|
|
462ab5241c | ||
|
|
f984d745e7 | ||
|
|
ca13664ef9 | ||
|
|
304c938260 | ||
|
|
d5286c9535 | ||
|
|
855dd590ab | ||
|
|
7e70f7a68a | ||
|
|
84fd769570 |
@@ -180,6 +180,8 @@ gem 'reverse_markdown'
|
|||||||
gem 'iso-639'
|
gem 'iso-639'
|
||||||
gem 'ruby-openai'
|
gem 'ruby-openai'
|
||||||
gem 'ai-agents', '>= 0.4.3'
|
gem 'ai-agents', '>= 0.4.3'
|
||||||
|
|
||||||
|
# TODO: Move this gem as a dependency of ai-agents
|
||||||
gem 'ruby_llm-schema'
|
gem 'ruby_llm-schema'
|
||||||
|
|
||||||
gem 'shopify_api'
|
gem 'shopify_api'
|
||||||
|
|||||||
+56
-56
@@ -25,35 +25,35 @@ GIT
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.1.5.1)
|
actioncable (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
zeitwerk (~> 2.6)
|
zeitwerk (~> 2.6)
|
||||||
actionmailbox (7.1.5.1)
|
actionmailbox (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
activejob (= 7.1.5.1)
|
activejob (= 7.1.5.2)
|
||||||
activerecord (= 7.1.5.1)
|
activerecord (= 7.1.5.2)
|
||||||
activestorage (= 7.1.5.1)
|
activestorage (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
actionmailer (7.1.5.1)
|
actionmailer (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
actionview (= 7.1.5.1)
|
actionview (= 7.1.5.2)
|
||||||
activejob (= 7.1.5.1)
|
activejob (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
actionpack (7.1.5.1)
|
actionpack (7.1.5.2)
|
||||||
actionview (= 7.1.5.1)
|
actionview (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
racc
|
racc
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
@@ -61,38 +61,38 @@ GEM
|
|||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
actiontext (7.1.5.1)
|
actiontext (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
activerecord (= 7.1.5.1)
|
activerecord (= 7.1.5.2)
|
||||||
activestorage (= 7.1.5.1)
|
activestorage (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.1.5.1)
|
actionview (7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.11)
|
erubi (~> 1.11)
|
||||||
rails-dom-testing (~> 2.2)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.6)
|
rails-html-sanitizer (~> 1.6)
|
||||||
active_record_query_trace (1.8)
|
active_record_query_trace (1.8)
|
||||||
activejob (7.1.5.1)
|
activejob (7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.1.5.1)
|
activemodel (7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
activerecord (7.1.5.1)
|
activerecord (7.1.5.2)
|
||||||
activemodel (= 7.1.5.1)
|
activemodel (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
timeout (>= 0.4.0)
|
timeout (>= 0.4.0)
|
||||||
activerecord-import (2.1.0)
|
activerecord-import (2.1.0)
|
||||||
activerecord (>= 4.2)
|
activerecord (>= 4.2)
|
||||||
activestorage (7.1.5.1)
|
activestorage (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
activejob (= 7.1.5.1)
|
activejob (= 7.1.5.2)
|
||||||
activerecord (= 7.1.5.1)
|
activerecord (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
activesupport (7.1.5.1)
|
activesupport (7.1.5.2)
|
||||||
base64
|
base64
|
||||||
benchmark (>= 0.3)
|
benchmark (>= 0.3)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
@@ -155,10 +155,10 @@ GEM
|
|||||||
barnes (0.0.9)
|
barnes (0.0.9)
|
||||||
multi_json (~> 1)
|
multi_json (~> 1)
|
||||||
statsd-ruby (~> 1.1)
|
statsd-ruby (~> 1.1)
|
||||||
base64 (0.2.0)
|
base64 (0.3.0)
|
||||||
bcrypt (3.1.20)
|
bcrypt (3.1.20)
|
||||||
benchmark (0.4.0)
|
benchmark (0.4.1)
|
||||||
bigdecimal (3.1.9)
|
bigdecimal (3.2.2)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
bootsnap (1.16.0)
|
bootsnap (1.16.0)
|
||||||
msgpack (~> 1.2)
|
msgpack (~> 1.2)
|
||||||
@@ -599,20 +599,20 @@ GEM
|
|||||||
rackup (1.0.1)
|
rackup (1.0.1)
|
||||||
rack (< 3)
|
rack (< 3)
|
||||||
webrick
|
webrick
|
||||||
rails (7.1.5.1)
|
rails (7.1.5.2)
|
||||||
actioncable (= 7.1.5.1)
|
actioncable (= 7.1.5.2)
|
||||||
actionmailbox (= 7.1.5.1)
|
actionmailbox (= 7.1.5.2)
|
||||||
actionmailer (= 7.1.5.1)
|
actionmailer (= 7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
actiontext (= 7.1.5.1)
|
actiontext (= 7.1.5.2)
|
||||||
actionview (= 7.1.5.1)
|
actionview (= 7.1.5.2)
|
||||||
activejob (= 7.1.5.1)
|
activejob (= 7.1.5.2)
|
||||||
activemodel (= 7.1.5.1)
|
activemodel (= 7.1.5.2)
|
||||||
activerecord (= 7.1.5.1)
|
activerecord (= 7.1.5.2)
|
||||||
activestorage (= 7.1.5.1)
|
activestorage (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 7.1.5.1)
|
railties (= 7.1.5.2)
|
||||||
rails-dom-testing (2.2.0)
|
rails-dom-testing (2.2.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
minitest
|
minitest
|
||||||
@@ -620,9 +620,9 @@ GEM
|
|||||||
rails-html-sanitizer (1.6.1)
|
rails-html-sanitizer (1.6.1)
|
||||||
loofah (~> 2.21)
|
loofah (~> 2.21)
|
||||||
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||||
railties (7.1.5.1)
|
railties (7.1.5.2)
|
||||||
actionpack (= 7.1.5.1)
|
actionpack (= 7.1.5.2)
|
||||||
activesupport (= 7.1.5.1)
|
activesupport (= 7.1.5.2)
|
||||||
irb
|
irb
|
||||||
rackup (>= 1.0.0)
|
rackup (>= 1.0.0)
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::Accounts::AssignmentPoliciesController < Api::V1::Accounts::BaseController
|
||||||
|
before_action :fetch_assignment_policy, only: [:show, :update, :destroy]
|
||||||
|
before_action :check_authorization
|
||||||
|
|
||||||
|
def index
|
||||||
|
@assignment_policies = Current.account.assignment_policies.includes(:inboxes)
|
||||||
|
render json: { assignment_policies: serialize_assignment_policies(@assignment_policies) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
render json: { assignment_policy: serialize_assignment_policy(@assignment_policy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@assignment_policy = Current.account.assignment_policies.build(assignment_policy_params)
|
||||||
|
|
||||||
|
if @assignment_policy.save
|
||||||
|
render json: { assignment_policy: serialize_assignment_policy(@assignment_policy) }, status: :created
|
||||||
|
else
|
||||||
|
render json: { errors: @assignment_policy.errors.full_messages }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @assignment_policy.update(assignment_policy_params)
|
||||||
|
render json: { assignment_policy: serialize_assignment_policy(@assignment_policy) }
|
||||||
|
else
|
||||||
|
render json: { errors: @assignment_policy.errors.full_messages }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if @assignment_policy.destroy
|
||||||
|
head :ok
|
||||||
|
else
|
||||||
|
render json: { errors: @assignment_policy.errors.full_messages }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def fetch_assignment_policy
|
||||||
|
@assignment_policy = Current.account.assignment_policies.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def assignment_policy_params
|
||||||
|
params.require(:assignment_policy).permit(
|
||||||
|
:name, :description, :assignment_order, :conversation_priority,
|
||||||
|
:fair_distribution_limit, :fair_distribution_window, :enabled
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def serialize_assignment_policy(policy)
|
||||||
|
{
|
||||||
|
id: policy.id,
|
||||||
|
name: policy.name,
|
||||||
|
description: policy.description,
|
||||||
|
assignment_order: policy.assignment_order,
|
||||||
|
conversation_priority: policy.conversation_priority,
|
||||||
|
fair_distribution_limit: policy.fair_distribution_limit,
|
||||||
|
fair_distribution_window: policy.fair_distribution_window,
|
||||||
|
enabled: policy.enabled,
|
||||||
|
inbox_count: policy.inboxes.count,
|
||||||
|
inboxes: policy.inboxes.map { |inbox| { id: inbox.id, name: inbox.name } },
|
||||||
|
created_at: policy.created_at,
|
||||||
|
updated_at: policy.updated_at
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def serialize_assignment_policies(policies)
|
||||||
|
policies.map { |policy| serialize_assignment_policy(policy) }
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_authorization
|
||||||
|
authorize(AssignmentPolicy)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::Accounts::InboxAssignmentPoliciesController < Api::V1::Accounts::BaseController
|
||||||
|
before_action :fetch_inbox
|
||||||
|
before_action :check_authorization
|
||||||
|
|
||||||
|
def show
|
||||||
|
@inbox_assignment_policy = @inbox.inbox_assignment_policy
|
||||||
|
|
||||||
|
if @inbox_assignment_policy
|
||||||
|
render json: {
|
||||||
|
inbox_assignment_policy: serialize_inbox_assignment_policy(@inbox_assignment_policy)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
render json: {
|
||||||
|
inbox_assignment_policy: nil,
|
||||||
|
message: 'No assignment policy assigned to this inbox'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
# Remove existing assignment if any
|
||||||
|
@inbox.inbox_assignment_policy&.destroy
|
||||||
|
|
||||||
|
@assignment_policy = Current.account.assignment_policies.find(params[:assignment_policy_id])
|
||||||
|
@inbox_assignment_policy = @inbox.build_inbox_assignment_policy(assignment_policy: @assignment_policy)
|
||||||
|
|
||||||
|
if @inbox_assignment_policy.save
|
||||||
|
render json: {
|
||||||
|
inbox_assignment_policy: serialize_inbox_assignment_policy(@inbox_assignment_policy)
|
||||||
|
}, status: :created
|
||||||
|
else
|
||||||
|
render json: { errors: @inbox_assignment_policy.errors.full_messages }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@inbox_assignment_policy = @inbox.inbox_assignment_policy
|
||||||
|
|
||||||
|
if @inbox_assignment_policy
|
||||||
|
if @inbox_assignment_policy.destroy
|
||||||
|
head :ok
|
||||||
|
else
|
||||||
|
render json: { errors: @inbox_assignment_policy.errors.full_messages }, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render json: { error: 'No assignment policy found for this inbox' }, status: :not_found
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def fetch_inbox
|
||||||
|
@inbox = Current.account.inboxes.find(params[:inbox_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def check_authorization
|
||||||
|
authorize(@inbox, :update?)
|
||||||
|
end
|
||||||
|
|
||||||
|
def serialize_inbox_assignment_policy(inbox_assignment_policy)
|
||||||
|
{
|
||||||
|
id: inbox_assignment_policy.id,
|
||||||
|
inbox_id: inbox_assignment_policy.inbox_id,
|
||||||
|
assignment_policy_id: inbox_assignment_policy.assignment_policy_id,
|
||||||
|
assignment_policy: {
|
||||||
|
id: inbox_assignment_policy.assignment_policy.id,
|
||||||
|
name: inbox_assignment_policy.assignment_policy.name,
|
||||||
|
description: inbox_assignment_policy.assignment_policy.description,
|
||||||
|
assignment_order: inbox_assignment_policy.assignment_policy.assignment_order,
|
||||||
|
conversation_priority: inbox_assignment_policy.assignment_policy.conversation_priority,
|
||||||
|
fair_distribution_limit: inbox_assignment_policy.assignment_policy.fair_distribution_limit,
|
||||||
|
fair_distribution_window: inbox_assignment_policy.assignment_policy.fair_distribution_window,
|
||||||
|
enabled: inbox_assignment_policy.assignment_policy.enabled
|
||||||
|
},
|
||||||
|
created_at: inbox_assignment_policy.created_at,
|
||||||
|
updated_at: inbox_assignment_policy.updated_at
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -26,9 +26,8 @@ class Api::V1::Accounts::PortalsController < Api::V1::Accounts::BaseController
|
|||||||
@portal.update!(portal_params.merge(live_chat_widget_params)) if params[:portal].present?
|
@portal.update!(portal_params.merge(live_chat_widget_params)) if params[:portal].present?
|
||||||
# @portal.custom_domain = parsed_custom_domain
|
# @portal.custom_domain = parsed_custom_domain
|
||||||
process_attached_logo if params[:blob_id].present?
|
process_attached_logo if params[:blob_id].present?
|
||||||
rescue StandardError => e
|
rescue ActiveRecord::RecordInvalid => e
|
||||||
Rails.logger.error e
|
render_record_invalid(e)
|
||||||
render json: { error: @portal.errors.messages }.to_json, status: :unprocessable_entity
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
class Api::V1::Accounts::Whatsapp::AuthorizationsController < Api::V1::Accounts::BaseController
|
class Api::V1::Accounts::Whatsapp::AuthorizationsController < Api::V1::Accounts::BaseController
|
||||||
before_action :validate_feature_enabled!
|
before_action :validate_feature_enabled!
|
||||||
|
before_action :fetch_and_validate_inbox, if: -> { params[:inbox_id].present? }
|
||||||
|
|
||||||
# POST /api/v1/accounts/:account_id/whatsapp/authorization
|
# POST /api/v1/accounts/:account_id/whatsapp/authorization
|
||||||
# Handles the embedded signup callback data from the Facebook SDK
|
# Handles both initial authorization and reauthorization
|
||||||
|
# If inbox_id is present in params, it performs reauthorization
|
||||||
def create
|
def create
|
||||||
validate_embedded_signup_params!
|
validate_embedded_signup_params!
|
||||||
channel = process_embedded_signup
|
channel = process_embedded_signup
|
||||||
@@ -16,21 +18,42 @@ class Api::V1::Accounts::Whatsapp::AuthorizationsController < Api::V1::Accounts:
|
|||||||
def process_embedded_signup
|
def process_embedded_signup
|
||||||
service = Whatsapp::EmbeddedSignupService.new(
|
service = Whatsapp::EmbeddedSignupService.new(
|
||||||
account: Current.account,
|
account: Current.account,
|
||||||
code: params[:code],
|
params: params.permit(:code, :business_id, :waba_id, :phone_number_id).to_h.symbolize_keys,
|
||||||
business_id: params[:business_id],
|
inbox_id: params[:inbox_id]
|
||||||
waba_id: params[:waba_id],
|
|
||||||
phone_number_id: params[:phone_number_id]
|
|
||||||
)
|
)
|
||||||
service.perform
|
service.perform
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_success_response(inbox)
|
def fetch_and_validate_inbox
|
||||||
|
@inbox = Current.account.inboxes.find(params[:inbox_id])
|
||||||
|
validate_reauthorization_required
|
||||||
|
end
|
||||||
|
|
||||||
|
def validate_reauthorization_required
|
||||||
|
return if @inbox.channel.reauthorization_required? || can_upgrade_to_embedded_signup?
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
|
success: false,
|
||||||
|
message: I18n.t('inbox.reauthorization.not_required')
|
||||||
|
}, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
|
||||||
|
def can_upgrade_to_embedded_signup?
|
||||||
|
channel = @inbox.channel
|
||||||
|
return false unless channel.provider == 'whatsapp_cloud'
|
||||||
|
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_success_response(inbox)
|
||||||
|
response = {
|
||||||
success: true,
|
success: true,
|
||||||
id: inbox.id,
|
id: inbox.id,
|
||||||
name: inbox.name,
|
name: inbox.name,
|
||||||
channel_type: 'whatsapp'
|
channel_type: 'whatsapp'
|
||||||
}
|
}
|
||||||
|
response[:message] = I18n.t('inbox.reauthorization.success') if params[:inbox_id].present?
|
||||||
|
render json: response
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_error_response(error)
|
def render_error_response(error)
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
class Platform::Api::V1::AccountsController < PlatformController
|
class Platform::Api::V1::AccountsController < PlatformController
|
||||||
|
def index
|
||||||
|
@resources = @platform_app.platform_app_permissibles
|
||||||
|
.where(permissible_type: 'Account')
|
||||||
|
.includes(:permissible)
|
||||||
|
.map(&:permissible)
|
||||||
|
end
|
||||||
|
|
||||||
def show; end
|
def show; end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ class SlackUploadsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def blob_url
|
def blob_url
|
||||||
url_for(@blob.representation(resize_to_fill: [250, nil]))
|
# Only generate representations for images
|
||||||
|
if @blob.content_type.start_with?('image/')
|
||||||
|
url_for(@blob.representation(resize_to_fill: [250, nil]))
|
||||||
|
else
|
||||||
|
url_for(@blob)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def avatar_url
|
def avatar_url
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ class Twilio::CallbackController < ApplicationController
|
|||||||
:NumMedia,
|
:NumMedia,
|
||||||
:Latitude,
|
:Latitude,
|
||||||
:Longitude,
|
:Longitude,
|
||||||
:MessageType
|
:MessageType,
|
||||||
|
:ProfileName
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ class NotificationFinder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def unread_count
|
def unread_count
|
||||||
@notifications.where(read_at: nil).count
|
if type_included?('read')
|
||||||
|
# If we're including read notifications, filter to unread
|
||||||
|
@notifications.where(read_at: nil).count
|
||||||
|
else
|
||||||
|
# Already filtered to unread notifications, just count
|
||||||
|
@notifications.count
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def count
|
def count
|
||||||
@@ -27,7 +33,7 @@ class NotificationFinder
|
|||||||
def set_up
|
def set_up
|
||||||
find_all_notifications
|
find_all_notifications
|
||||||
filter_snoozed_notifications
|
filter_snoozed_notifications
|
||||||
fitler_read_notifications
|
filter_read_notifications
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all_notifications
|
def find_all_notifications
|
||||||
@@ -38,7 +44,7 @@ class NotificationFinder
|
|||||||
@notifications = @notifications.where(snoozed_until: nil) unless type_included?('snoozed')
|
@notifications = @notifications.where(snoozed_until: nil) unless type_included?('snoozed')
|
||||||
end
|
end
|
||||||
|
|
||||||
def fitler_read_notifications
|
def filter_read_notifications
|
||||||
@notifications = @notifications.where(read_at: nil) unless type_included?('read')
|
@notifications = @notifications.where(read_at: nil) unless type_included?('read')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,25 @@ module ReportingEventHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def last_non_human_activity(conversation)
|
def last_non_human_activity(conversation)
|
||||||
# check if a handoff event already exists
|
# Try to get either a handoff or reopened event first
|
||||||
handoff_event = ReportingEvent.where(conversation_id: conversation.id, name: 'conversation_bot_handoff').last
|
# These will always take precedence over any other activity
|
||||||
|
# Also, any of these events can happen at any time in the course of a conversation lifecycle.
|
||||||
|
# So we pick the latest event
|
||||||
|
event = ReportingEvent.where(
|
||||||
|
conversation_id: conversation.id,
|
||||||
|
name: %w[conversation_bot_handoff conversation_opened]
|
||||||
|
).order(event_end_time: :desc).first
|
||||||
|
|
||||||
# if a handoff exists, last non human activity is when the handoff ended,
|
return event.event_end_time if event&.event_end_time
|
||||||
# otherwise it's when the conversation was created
|
|
||||||
handoff_event&.event_end_time || conversation.created_at
|
# Fallback to bot resolved event
|
||||||
|
# Because this will be closest to the most accurate activity instead of conversation.created_at
|
||||||
|
bot_event = ReportingEvent.where(conversation_id: conversation.id, name: 'conversation_bot_resolved').last
|
||||||
|
|
||||||
|
return bot_event.event_end_time if bot_event&.event_end_time
|
||||||
|
|
||||||
|
# If no events found, return conversation creation time
|
||||||
|
conversation.created_at
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -137,7 +137,6 @@ export default {
|
|||||||
v-if="!authUIFlags.isFetching && !accountUIFlags.isFetchingItem"
|
v-if="!authUIFlags.isFetching && !accountUIFlags.isFetchingItem"
|
||||||
id="app"
|
id="app"
|
||||||
class="flex flex-col w-full h-screen min-h-0"
|
class="flex flex-col w-full h-screen min-h-0"
|
||||||
:class="{ 'app-rtl--wrapper': isRTL }"
|
|
||||||
:dir="isRTL ? 'rtl' : 'ltr'"
|
:dir="isRTL ? 'rtl' : 'ltr'"
|
||||||
>
|
>
|
||||||
<UpdateBanner :latest-chatwoot-version="latestChatwootVersion" />
|
<UpdateBanner :latest-chatwoot-version="latestChatwootVersion" />
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ class WhatsappChannel extends ApiClient {
|
|||||||
createEmbeddedSignup(params) {
|
createEmbeddedSignup(params) {
|
||||||
return axios.post(`${this.baseUrl()}/whatsapp/authorization`, params);
|
return axios.post(`${this.baseUrl()}/whatsapp/authorization`, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reauthorizeWhatsApp({ inboxId, ...params }) {
|
||||||
|
return axios.post(`${this.baseUrl()}/whatsapp/authorization`, {
|
||||||
|
...params,
|
||||||
|
inbox_id: inboxId,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new WhatsappChannel();
|
export default new WhatsappChannel();
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ const campaignStatus = computed(() => {
|
|||||||
const inboxName = computed(() => props.inbox?.name || '');
|
const inboxName = computed(() => props.inbox?.name || '');
|
||||||
|
|
||||||
const inboxIcon = computed(() => {
|
const inboxIcon = computed(() => {
|
||||||
const { phone_number: phoneNumber, channel_type: type } = props.inbox;
|
const { medium, channel_type: type } = props.inbox;
|
||||||
return getInboxIconByType(type, phoneNumber);
|
return getInboxIconByType(type, medium);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -38,11 +38,13 @@ const handleClose = () => emit('close');
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="w-[25rem] z-50 min-w-0 absolute top-10 ltr:right-0 rtl:left-0 bg-n-alpha-3 backdrop-blur-[100px] p-6 rounded-xl border border-n-weak shadow-md flex flex-col gap-6"
|
class="w-[25rem] z-50 min-w-0 absolute top-10 ltr:right-0 rtl:left-0 bg-n-alpha-3 backdrop-blur-[100px] rounded-xl border border-n-weak shadow-md max-h-[80vh] overflow-y-auto"
|
||||||
>
|
>
|
||||||
<h3 class="text-base font-medium text-n-slate-12">
|
<div class="p-6 flex flex-col gap-6">
|
||||||
{{ t(`CAMPAIGN.WHATSAPP.CREATE.TITLE`) }}
|
<h3 class="text-base font-medium text-n-slate-12 flex-shrink-0">
|
||||||
</h3>
|
{{ t(`CAMPAIGN.WHATSAPP.CREATE.TITLE`) }}
|
||||||
<WhatsAppCampaignForm @submit="handleSubmit" @cancel="handleClose" />
|
</h3>
|
||||||
|
<WhatsAppCampaignForm @submit="handleSubmit" @cancel="handleClose" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+15
-106
@@ -9,6 +9,7 @@ import Input from 'dashboard/components-next/input/Input.vue';
|
|||||||
import Button from 'dashboard/components-next/button/Button.vue';
|
import Button from 'dashboard/components-next/button/Button.vue';
|
||||||
import ComboBox from 'dashboard/components-next/combobox/ComboBox.vue';
|
import ComboBox from 'dashboard/components-next/combobox/ComboBox.vue';
|
||||||
import TagMultiSelectComboBox from 'dashboard/components-next/combobox/TagMultiSelectComboBox.vue';
|
import TagMultiSelectComboBox from 'dashboard/components-next/combobox/TagMultiSelectComboBox.vue';
|
||||||
|
import WhatsAppTemplateParser from 'dashboard/components-next/whatsapp/WhatsAppTemplateParser.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['submit', 'cancel']);
|
const emit = defineEmits(['submit', 'cancel']);
|
||||||
|
|
||||||
@@ -18,7 +19,9 @@ const formState = {
|
|||||||
uiFlags: useMapGetter('campaigns/getUIFlags'),
|
uiFlags: useMapGetter('campaigns/getUIFlags'),
|
||||||
labels: useMapGetter('labels/getLabels'),
|
labels: useMapGetter('labels/getLabels'),
|
||||||
inboxes: useMapGetter('inboxes/getWhatsAppInboxes'),
|
inboxes: useMapGetter('inboxes/getWhatsAppInboxes'),
|
||||||
getWhatsAppTemplates: useMapGetter('inboxes/getWhatsAppTemplates'),
|
getFilteredWhatsAppTemplates: useMapGetter(
|
||||||
|
'inboxes/getFilteredWhatsAppTemplates'
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
@@ -30,7 +33,7 @@ const initialState = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const state = reactive({ ...initialState });
|
const state = reactive({ ...initialState });
|
||||||
const processedParams = ref({});
|
const templateParserRef = ref(null);
|
||||||
|
|
||||||
const rules = {
|
const rules = {
|
||||||
title: { required, minLength: minLength(1) },
|
title: { required, minLength: minLength(1) },
|
||||||
@@ -67,7 +70,7 @@ const inboxOptions = computed(() =>
|
|||||||
|
|
||||||
const templateOptions = computed(() => {
|
const templateOptions = computed(() => {
|
||||||
if (!state.inboxId) return [];
|
if (!state.inboxId) return [];
|
||||||
const templates = formState.getWhatsAppTemplates.value(state.inboxId);
|
const templates = formState.getFilteredWhatsAppTemplates.value(state.inboxId);
|
||||||
return templates.map(template => {
|
return templates.map(template => {
|
||||||
// Create a more user-friendly label from template name
|
// Create a more user-friendly label from template name
|
||||||
const friendlyName = template.name
|
const friendlyName = template.name
|
||||||
@@ -88,26 +91,6 @@ const selectedTemplate = computed(() => {
|
|||||||
?.template;
|
?.template;
|
||||||
});
|
});
|
||||||
|
|
||||||
const templateString = computed(() => {
|
|
||||||
if (!selectedTemplate.value) return '';
|
|
||||||
try {
|
|
||||||
return (
|
|
||||||
selectedTemplate.value.components?.find(
|
|
||||||
component => component.type === 'BODY'
|
|
||||||
)?.text || ''
|
|
||||||
);
|
|
||||||
} catch (error) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const processedString = computed(() => {
|
|
||||||
if (!templateString.value) return '';
|
|
||||||
return templateString.value.replace(/{{([^}]+)}}/g, (match, variable) => {
|
|
||||||
return processedParams.value[variable] || `{{${variable}}}`;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const getErrorMessage = (field, errorKey) => {
|
const getErrorMessage = (field, errorKey) => {
|
||||||
const baseKey = 'CAMPAIGN.WHATSAPP.CREATE.FORM';
|
const baseKey = 'CAMPAIGN.WHATSAPP.CREATE.FORM';
|
||||||
return v$.value[field].$error ? t(`${baseKey}.${errorKey}.ERROR`) : '';
|
return v$.value[field].$error ? t(`${baseKey}.${errorKey}.ERROR`) : '';
|
||||||
@@ -122,8 +105,7 @@ const formErrors = computed(() => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const hasRequiredTemplateParams = computed(() => {
|
const hasRequiredTemplateParams = computed(() => {
|
||||||
const params = Object.values(processedParams.value);
|
return templateParserRef.value?.v$?.$invalid === false || true;
|
||||||
return params.length === 0 || params.every(param => param.trim() !== '');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const isSubmitDisabled = computed(
|
const isSubmitDisabled = computed(
|
||||||
@@ -135,32 +117,18 @@ const formatToUTCString = localDateTime =>
|
|||||||
|
|
||||||
const resetState = () => {
|
const resetState = () => {
|
||||||
Object.assign(state, initialState);
|
Object.assign(state, initialState);
|
||||||
processedParams.value = {};
|
|
||||||
v$.value.$reset();
|
v$.value.$reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => emit('cancel');
|
const handleCancel = () => emit('cancel');
|
||||||
|
|
||||||
const generateVariables = () => {
|
|
||||||
const matchedVariables = templateString.value.match(/{{([^}]+)}}/g);
|
|
||||||
if (!matchedVariables) {
|
|
||||||
processedParams.value = {};
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalVars = matchedVariables.map(match => match.replace(/{{|}}/g, ''));
|
|
||||||
processedParams.value = finalVars.reduce((acc, variable) => {
|
|
||||||
acc[variable] = processedParams.value[variable] || '';
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
};
|
|
||||||
|
|
||||||
const prepareCampaignDetails = () => {
|
const prepareCampaignDetails = () => {
|
||||||
// Find the selected template to get its content
|
// Find the selected template to get its content
|
||||||
const currentTemplate = selectedTemplate.value;
|
const currentTemplate = selectedTemplate.value;
|
||||||
|
const parserData = templateParserRef.value;
|
||||||
|
|
||||||
// Extract template content - this should be the template message body
|
// Extract template content - this should be the template message body
|
||||||
const templateContent = templateString.value;
|
const templateContent = parserData?.renderedTemplate || '';
|
||||||
|
|
||||||
// Prepare template_params object with the same structure as used in contacts
|
// Prepare template_params object with the same structure as used in contacts
|
||||||
const templateParams = {
|
const templateParams = {
|
||||||
@@ -168,7 +136,7 @@ const prepareCampaignDetails = () => {
|
|||||||
namespace: currentTemplate?.namespace || '',
|
namespace: currentTemplate?.namespace || '',
|
||||||
category: currentTemplate?.category || 'UTILITY',
|
category: currentTemplate?.category || 'UTILITY',
|
||||||
language: currentTemplate?.language || 'en_US',
|
language: currentTemplate?.language || 'en_US',
|
||||||
processed_params: processedParams.value,
|
processed_params: parserData?.processedParams || {},
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -198,15 +166,6 @@ watch(
|
|||||||
() => state.inboxId,
|
() => state.inboxId,
|
||||||
() => {
|
() => {
|
||||||
state.templateId = null;
|
state.templateId = null;
|
||||||
processedParams.value = {};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Generate variables when template changes
|
|
||||||
watch(
|
|
||||||
() => state.templateId,
|
|
||||||
() => {
|
|
||||||
generateVariables();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
@@ -254,62 +213,12 @@ watch(
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Template Preview -->
|
<!-- Template Parser -->
|
||||||
<div
|
<WhatsAppTemplateParser
|
||||||
v-if="selectedTemplate"
|
v-if="selectedTemplate"
|
||||||
class="flex flex-col gap-4 p-4 rounded-lg bg-n-alpha-black2"
|
ref="templateParserRef"
|
||||||
>
|
:template="selectedTemplate"
|
||||||
<div class="flex justify-between items-center">
|
/>
|
||||||
<h3 class="text-sm font-medium text-n-slate-12">
|
|
||||||
{{ selectedTemplate.name }}
|
|
||||||
</h3>
|
|
||||||
<span class="text-xs text-n-slate-11">
|
|
||||||
{{ t('CAMPAIGN.WHATSAPP.CREATE.FORM.TEMPLATE.LANGUAGE') }}:
|
|
||||||
{{ selectedTemplate.language || 'en' }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<div class="rounded-md bg-n-alpha-black3">
|
|
||||||
<div class="text-sm whitespace-pre-wrap text-n-slate-12">
|
|
||||||
{{ processedString }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text-xs text-n-slate-11">
|
|
||||||
{{ t('CAMPAIGN.WHATSAPP.CREATE.FORM.TEMPLATE.CATEGORY') }}:
|
|
||||||
{{ selectedTemplate.category || 'UTILITY' }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Template Variables -->
|
|
||||||
<div
|
|
||||||
v-if="Object.keys(processedParams).length > 0"
|
|
||||||
class="flex flex-col gap-3"
|
|
||||||
>
|
|
||||||
<label class="text-sm font-medium text-n-slate-12">
|
|
||||||
{{ t('CAMPAIGN.WHATSAPP.CREATE.FORM.TEMPLATE.VARIABLES_LABEL') }}
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<div
|
|
||||||
v-for="(value, key) in processedParams"
|
|
||||||
:key="key"
|
|
||||||
class="flex gap-2 items-center"
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
v-model="processedParams[key]"
|
|
||||||
type="text"
|
|
||||||
class="flex-1"
|
|
||||||
:placeholder="
|
|
||||||
t('CAMPAIGN.WHATSAPP.CREATE.FORM.TEMPLATE.VARIABLE_PLACEHOLDER', {
|
|
||||||
variable: key,
|
|
||||||
})
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-1">
|
<div class="flex flex-col gap-1">
|
||||||
<label for="audience" class="mb-0.5 text-sm font-medium text-n-slate-12">
|
<label for="audience" class="mb-0.5 text-sm font-medium text-n-slate-12">
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const onClickViewDetails = () => emit('showContact', props.id);
|
|||||||
:src="thumbnail"
|
:src="thumbnail"
|
||||||
:size="48"
|
:size="48"
|
||||||
:status="availabilityStatus"
|
:status="availabilityStatus"
|
||||||
|
hide-offline-status
|
||||||
rounded-full
|
rounded-full
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col gap-0.5 flex-1">
|
<div class="flex flex-col gap-0.5 flex-1">
|
||||||
|
|||||||
+2
-2
@@ -48,8 +48,8 @@ const inbox = computed(() => props.stateInbox);
|
|||||||
const inboxName = computed(() => inbox.value?.name);
|
const inboxName = computed(() => inbox.value?.name);
|
||||||
|
|
||||||
const inboxIcon = computed(() => {
|
const inboxIcon = computed(() => {
|
||||||
const { phoneNumber, channelType } = inbox.value;
|
const { channelType, medium } = inbox.value;
|
||||||
return getInboxIconByType(channelType, phoneNumber);
|
return getInboxIconByType(channelType, medium);
|
||||||
});
|
});
|
||||||
|
|
||||||
const lastActivityAt = computed(() => {
|
const lastActivityAt = computed(() => {
|
||||||
|
|||||||
+6
-4
@@ -7,8 +7,8 @@ import { useStore, useStoreGetters } from 'dashboard/composables/store';
|
|||||||
import { uploadFile } from 'dashboard/helper/uploadHelper';
|
import { uploadFile } from 'dashboard/helper/uploadHelper';
|
||||||
import { checkFileSizeLimit } from 'shared/helpers/FileHelper';
|
import { checkFileSizeLimit } from 'shared/helpers/FileHelper';
|
||||||
import { useVuelidate } from '@vuelidate/core';
|
import { useVuelidate } from '@vuelidate/core';
|
||||||
import { required, minLength, helpers } from '@vuelidate/validators';
|
import { required, minLength, helpers, url } from '@vuelidate/validators';
|
||||||
import { shouldBeUrl, isValidSlug } from 'shared/helpers/Validators';
|
import { isValidSlug } from 'shared/helpers/Validators';
|
||||||
|
|
||||||
import Button from 'dashboard/components-next/button/Button.vue';
|
import Button from 'dashboard/components-next/button/Button.vue';
|
||||||
import Input from 'dashboard/components-next/input/Input.vue';
|
import Input from 'dashboard/components-next/input/Input.vue';
|
||||||
@@ -71,7 +71,7 @@ const rules = {
|
|||||||
isValidSlug
|
isValidSlug
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
homePageLink: { shouldBeUrl },
|
homePageLink: { url },
|
||||||
};
|
};
|
||||||
|
|
||||||
const v$ = useVuelidate(rules, state);
|
const v$ = useVuelidate(rules, state);
|
||||||
@@ -315,7 +315,9 @@ const handleAvatarDelete = () => {
|
|||||||
class="[&>div>button:not(.focused)]:!outline-n-weak"
|
class="[&>div>button:not(.focused)]:!outline-n-weak"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-start justify-between w-full gap-2">
|
<div
|
||||||
|
class="grid items-start justify-between w-full gap-2 grid-cols-[200px,1fr]"
|
||||||
|
>
|
||||||
<label
|
<label
|
||||||
class="text-sm font-medium whitespace-nowrap py-2.5 text-n-slate-12"
|
class="text-sm font-medium whitespace-nowrap py-2.5 text-n-slate-12"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ const isUnread = computed(() => !props.inboxItem?.readAt);
|
|||||||
const inbox = computed(() => props.stateInbox);
|
const inbox = computed(() => props.stateInbox);
|
||||||
|
|
||||||
const inboxIcon = computed(() => {
|
const inboxIcon = computed(() => {
|
||||||
const { phoneNumber, channelType } = inbox.value;
|
const { channelType, medium } = inbox.value;
|
||||||
return getInboxIconByType(channelType, phoneNumber);
|
return getInboxIconByType(channelType, medium);
|
||||||
});
|
});
|
||||||
|
|
||||||
const hasSlaThreshold = computed(() => {
|
const hasSlaThreshold = computed(() => {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { ref, computed, onMounted, watch } from 'vue';
|
import { ref, computed, onMounted, watch } from 'vue';
|
||||||
import { useStore, useMapGetter } from 'dashboard/composables/store';
|
import { useStore, useMapGetter } from 'dashboard/composables/store';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useWindowSize } from '@vueuse/core';
|
||||||
import { useUISettings } from 'dashboard/composables/useUISettings';
|
import { useUISettings } from 'dashboard/composables/useUISettings';
|
||||||
import { vOnClickOutside } from '@vueuse/components';
|
import { vOnClickOutside } from '@vueuse/components';
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
@@ -15,6 +16,7 @@ import {
|
|||||||
processContactableInboxes,
|
processContactableInboxes,
|
||||||
mergeInboxDetails,
|
mergeInboxDetails,
|
||||||
} from 'dashboard/components-next/NewConversation/helpers/composeConversationHelper';
|
} from 'dashboard/components-next/NewConversation/helpers/composeConversationHelper';
|
||||||
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
|
|
||||||
import ComposeNewConversationForm from 'dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue';
|
import ComposeNewConversationForm from 'dashboard/components-next/NewConversation/components/ComposeNewConversationForm.vue';
|
||||||
|
|
||||||
@@ -37,9 +39,16 @@ const emit = defineEmits(['close']);
|
|||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const { width: windowWidth } = useWindowSize();
|
||||||
|
|
||||||
const { fetchSignatureFlagFromUISettings } = useUISettings();
|
const { fetchSignatureFlagFromUISettings } = useUISettings();
|
||||||
|
|
||||||
|
const isSmallScreen = computed(
|
||||||
|
() => windowWidth.value < wootConstants.SMALL_SCREEN_BREAKPOINT
|
||||||
|
);
|
||||||
|
|
||||||
|
const viewInModal = computed(() => props.isModal || isSmallScreen.value);
|
||||||
|
|
||||||
const contacts = ref([]);
|
const contacts = ref([]);
|
||||||
const selectedContact = ref(null);
|
const selectedContact = ref(null);
|
||||||
const targetInbox = ref(null);
|
const targetInbox = ref(null);
|
||||||
@@ -67,7 +76,7 @@ const directUploadsEnabled = computed(
|
|||||||
const activeContact = computed(() => contactById.value(props.contactId));
|
const activeContact = computed(() => contactById.value(props.contactId));
|
||||||
|
|
||||||
const composePopoverClass = computed(() => {
|
const composePopoverClass = computed(() => {
|
||||||
if (props.isModal) return '';
|
if (viewInModal.value) return '';
|
||||||
|
|
||||||
return props.alignPosition === 'right'
|
return props.alignPosition === 'right'
|
||||||
? 'absolute ltr:left-0 ltr:right-[unset] rtl:right-0 rtl:left-[unset]'
|
? 'absolute ltr:left-0 ltr:right-[unset] rtl:right-0 rtl:left-[unset]'
|
||||||
@@ -179,14 +188,18 @@ const toggle = () => {
|
|||||||
|
|
||||||
watch(
|
watch(
|
||||||
activeContact,
|
activeContact,
|
||||||
() => {
|
(currentContact, previousContact) => {
|
||||||
if (activeContact.value && props.contactId) {
|
if (currentContact && props.contactId) {
|
||||||
const contactInboxes = activeContact.value?.contactInboxes || [];
|
// Reset on contact change
|
||||||
|
if (currentContact?.id !== previousContact?.id) clearSelectedContact();
|
||||||
|
|
||||||
// First process the contactable inboxes to get the right structure
|
// First process the contactable inboxes to get the right structure
|
||||||
const processedInboxes = processContactableInboxes(contactInboxes);
|
const processedInboxes = processContactableInboxes(
|
||||||
|
currentContact.contactInboxes || []
|
||||||
|
);
|
||||||
// Then Merge processedInboxes with the inboxes list
|
// Then Merge processedInboxes with the inboxes list
|
||||||
selectedContact.value = {
|
selectedContact.value = {
|
||||||
...activeContact.value,
|
...currentContact,
|
||||||
contactInboxes: mergeInboxDetails(processedInboxes, inboxesList.value),
|
contactInboxes: mergeInboxDetails(processedInboxes, inboxesList.value),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -202,7 +215,7 @@ const handleClickOutside = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onModalBackdropClick = () => {
|
const onModalBackdropClick = () => {
|
||||||
if (!props.isModal) return;
|
if (!viewInModal.value) return;
|
||||||
handleClickOutside();
|
handleClickOutside();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -231,7 +244,7 @@ useKeyboardEvents(keyboardEvents);
|
|||||||
]"
|
]"
|
||||||
class="relative"
|
class="relative"
|
||||||
:class="{
|
:class="{
|
||||||
'z-40': showComposeNewConversation,
|
'z-50': showComposeNewConversation && !viewInModal,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<slot
|
<slot
|
||||||
@@ -243,12 +256,12 @@ useKeyboardEvents(keyboardEvents);
|
|||||||
v-if="showComposeNewConversation"
|
v-if="showComposeNewConversation"
|
||||||
:class="{
|
:class="{
|
||||||
'fixed z-50 bg-n-alpha-black1 backdrop-blur-[4px] flex items-start pt-[clamp(3rem,15vh,12rem)] justify-center inset-0':
|
'fixed z-50 bg-n-alpha-black1 backdrop-blur-[4px] flex items-start pt-[clamp(3rem,15vh,12rem)] justify-center inset-0':
|
||||||
isModal,
|
viewInModal,
|
||||||
}"
|
}"
|
||||||
@click.self="onModalBackdropClick"
|
@click.self="onModalBackdropClick"
|
||||||
>
|
>
|
||||||
<ComposeNewConversationForm
|
<ComposeNewConversationForm
|
||||||
:class="[{ 'mt-2': !isModal }, composePopoverClass]"
|
:class="[{ 'mt-2': !viewInModal }, composePopoverClass]"
|
||||||
:contacts="contacts"
|
:contacts="contacts"
|
||||||
:contact-id="contactId"
|
:contact-id="contactId"
|
||||||
:is-loading="isSearching"
|
:is-loading="isSearching"
|
||||||
|
|||||||
+5
-3
@@ -25,6 +25,7 @@ const props = defineProps({
|
|||||||
hasNoInbox: { type: Boolean, default: false },
|
hasNoInbox: { type: Boolean, default: false },
|
||||||
isDropdownActive: { type: Boolean, default: false },
|
isDropdownActive: { type: Boolean, default: false },
|
||||||
messageSignature: { type: String, default: '' },
|
messageSignature: { type: String, default: '' },
|
||||||
|
inboxId: { type: Number, default: null },
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
@@ -150,9 +151,10 @@ useKeyboardEvents(keyboardEvents);
|
|||||||
<div
|
<div
|
||||||
class="flex items-center justify-between w-full h-[3.25rem] gap-2 px-4 py-3"
|
class="flex items-center justify-between w-full h-[3.25rem] gap-2 px-4 py-3"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex gap-2 items-center">
|
||||||
<WhatsAppOptions
|
<WhatsAppOptions
|
||||||
v-if="isWhatsappInbox"
|
v-if="isWhatsappInbox"
|
||||||
|
:inbox-id="inboxId"
|
||||||
:message-templates="messageTemplates"
|
:message-templates="messageTemplates"
|
||||||
@send-message="emit('sendWhatsappMessage', $event)"
|
@send-message="emit('sendWhatsappMessage', $event)"
|
||||||
/>
|
/>
|
||||||
@@ -170,7 +172,7 @@ useKeyboardEvents(keyboardEvents);
|
|||||||
/>
|
/>
|
||||||
<EmojiInput
|
<EmojiInput
|
||||||
v-if="isEmojiPickerOpen"
|
v-if="isEmojiPickerOpen"
|
||||||
class="left-0 top-full mt-1.5"
|
class="ltr:left-0 rtl:right-0 top-full mt-1.5"
|
||||||
:on-click="onClickInsertEmoji"
|
:on-click="onClickInsertEmoji"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -206,7 +208,7 @@ useKeyboardEvents(keyboardEvents);
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex gap-2 items-center">
|
||||||
<Button
|
<Button
|
||||||
:label="t('COMPOSE_NEW_CONVERSATION.FORM.ACTION_BUTTONS.DISCARD')"
|
:label="t('COMPOSE_NEW_CONVERSATION.FORM.ACTION_BUTTONS.DISCARD')"
|
||||||
variant="faded"
|
variant="faded"
|
||||||
|
|||||||
+1
-1
@@ -57,7 +57,7 @@ const removeAttachment = id => {
|
|||||||
variant="ghost"
|
variant="ghost"
|
||||||
icon="i-lucide-trash"
|
icon="i-lucide-trash"
|
||||||
color="slate"
|
color="slate"
|
||||||
class="absolute top-1 right-1 !w-5 !h-5 transition-opacity duration-150 ease-in-out opacity-0 group-hover/image:opacity-100"
|
class="absolute top-1 ltr:right-1 rtl:left-1 !w-5 !h-5 transition-opacity duration-150 ease-in-out opacity-0 group-hover/image:opacity-100"
|
||||||
@click="removeAttachment(attachment.resource.id)"
|
@click="removeAttachment(attachment.resource.id)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-1
@@ -265,7 +265,7 @@ const handleSendWhatsappMessage = async ({ message, templateParams }) => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="w-[42rem] divide-y divide-n-strong overflow-visible transition-all duration-300 ease-in-out top-full justify-between flex flex-col bg-n-alpha-3 border border-n-strong shadow-sm backdrop-blur-[100px] rounded-xl"
|
class="w-[42rem] divide-y divide-n-strong overflow-visible transition-all duration-300 ease-in-out top-full justify-between flex flex-col bg-n-alpha-3 border border-n-strong shadow-sm backdrop-blur-[100px] rounded-xl min-w-0"
|
||||||
>
|
>
|
||||||
<ContactSelector
|
<ContactSelector
|
||||||
:contacts="contacts"
|
:contacts="contacts"
|
||||||
@@ -336,6 +336,7 @@ const handleSendWhatsappMessage = async ({ message, templateParams }) => {
|
|||||||
:is-loading="isCreating"
|
:is-loading="isCreating"
|
||||||
:disable-send-button="isCreating"
|
:disable-send-button="isCreating"
|
||||||
:has-selected-inbox="!!targetInbox"
|
:has-selected-inbox="!!targetInbox"
|
||||||
|
:inbox-id="targetInbox?.id"
|
||||||
:has-no-inbox="showNoInboxAlert"
|
:has-no-inbox="showNoInboxAlert"
|
||||||
:is-dropdown-active="isAnyDropdownActive"
|
:is-dropdown-active="isAnyDropdownActive"
|
||||||
:message-signature="messageSignature"
|
:message-signature="messageSignature"
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ const targetInboxLabel = computed(() => {
|
|||||||
<DropdownMenu
|
<DropdownMenu
|
||||||
v-if="contactableInboxesList?.length > 0 && showInboxesDropdown"
|
v-if="contactableInboxesList?.length > 0 && showInboxesDropdown"
|
||||||
:menu-items="contactableInboxesList"
|
:menu-items="contactableInboxesList"
|
||||||
class="left-0 z-[100] top-8 overflow-y-auto max-h-60 w-fit max-w-sm dark:!outline-n-slate-5"
|
class="ltr:left-0 rtl:right-0 z-[100] top-8 overflow-y-auto max-h-60 w-fit max-w-sm dark:!outline-n-slate-5"
|
||||||
@action="emit('handleInboxAction', $event)"
|
@action="emit('handleInboxAction', $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+19
-26
@@ -1,23 +1,25 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useMapGetter } from 'dashboard/composables/store';
|
||||||
|
|
||||||
|
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
||||||
import Button from 'dashboard/components-next/button/Button.vue';
|
import Button from 'dashboard/components-next/button/Button.vue';
|
||||||
import WhatsappTemplateParser from './WhatsappTemplateParser.vue';
|
import WhatsappTemplate from './WhatsappTemplate.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
messageTemplates: {
|
inboxId: {
|
||||||
type: Array,
|
type: Number,
|
||||||
default: () => [],
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['sendMessage']);
|
const emit = defineEmits(['sendMessage']);
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const getFilteredWhatsAppTemplates = useMapGetter(
|
||||||
// TODO: Remove this when we support all formats
|
'inboxes/getFilteredWhatsAppTemplates'
|
||||||
const formatsToRemove = ['DOCUMENT', 'IMAGE', 'VIDEO'];
|
);
|
||||||
|
|
||||||
const searchQuery = ref('');
|
const searchQuery = ref('');
|
||||||
const selectedTemplate = ref(null);
|
const selectedTemplate = ref(null);
|
||||||
@@ -25,19 +27,7 @@ const selectedTemplate = ref(null);
|
|||||||
const showTemplatesMenu = ref(false);
|
const showTemplatesMenu = ref(false);
|
||||||
|
|
||||||
const whatsAppTemplateMessages = computed(() => {
|
const whatsAppTemplateMessages = computed(() => {
|
||||||
// Add null check and ensure it's an array
|
return getFilteredWhatsAppTemplates.value(props.inboxId);
|
||||||
const templates = Array.isArray(props.messageTemplates)
|
|
||||||
? props.messageTemplates
|
|
||||||
: [];
|
|
||||||
|
|
||||||
// TODO: Remove the last filter when we support all formats
|
|
||||||
return templates
|
|
||||||
.filter(template => template?.status?.toLowerCase() === 'approved')
|
|
||||||
.filter(template => {
|
|
||||||
return template?.components?.every(component => {
|
|
||||||
return !formatsToRemove.includes(component.format);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const filteredTemplates = computed(() => {
|
const filteredTemplates = computed(() => {
|
||||||
@@ -84,10 +74,13 @@ const handleSendMessage = template => {
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="showTemplatesMenu"
|
v-if="showTemplatesMenu"
|
||||||
class="absolute top-full mt-1.5 max-h-96 overflow-y-auto left-0 flex flex-col gap-2 p-4 items-center w-[21.875rem] h-auto bg-n-solid-2 border border-n-strong shadow-sm rounded-lg"
|
class="absolute top-full mt-1.5 max-h-96 overflow-y-auto ltr:left-0 rtl:right-0 flex flex-col gap-2 p-4 items-center w-[21.875rem] h-auto bg-n-solid-2 border border-n-strong shadow-sm rounded-lg"
|
||||||
>
|
>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<span class="absolute i-lucide-search size-3.5 top-2 left-3" />
|
<Icon
|
||||||
|
icon="i-lucide-search"
|
||||||
|
class="absolute size-3.5 top-2 ltr:left-3 rtl:right-3"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
v-model="searchQuery"
|
v-model="searchQuery"
|
||||||
type="search"
|
type="search"
|
||||||
@@ -96,13 +89,13 @@ const handleSendMessage = template => {
|
|||||||
'COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.SEARCH_PLACEHOLDER'
|
'COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.SEARCH_PLACEHOLDER'
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
class="w-full h-8 py-2 pl-10 pr-2 text-sm reset-base outline-none border-none rounded-lg bg-n-alpha-black2 dark:bg-n-solid-1 text-n-slate-12"
|
class="w-full h-8 py-2 ltr:pl-10 rtl:pr-10 ltr:pr-2 rtl:pl-2 text-sm reset-base outline-none border-none rounded-lg bg-n-alpha-black2 dark:bg-n-solid-1 text-n-slate-12"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="template in filteredTemplates"
|
v-for="template in filteredTemplates"
|
||||||
:key="template.id"
|
:key="template.id"
|
||||||
class="flex flex-col w-full gap-2 p-2 rounded-lg cursor-pointer dark:hover:bg-n-alpha-3 hover:bg-n-alpha-1"
|
class="flex flex-col gap-2 p-2 w-full rounded-lg cursor-pointer dark:hover:bg-n-alpha-3 hover:bg-n-alpha-1"
|
||||||
@click="handleTemplateClick(template)"
|
@click="handleTemplateClick(template)"
|
||||||
>
|
>
|
||||||
<span class="text-sm text-n-slate-12">{{ template.name }}</span>
|
<span class="text-sm text-n-slate-12">{{ template.name }}</span>
|
||||||
@@ -111,12 +104,12 @@ const handleSendMessage = template => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="filteredTemplates.length === 0">
|
<template v-if="filteredTemplates.length === 0">
|
||||||
<p class="w-full pt-2 text-sm text-n-slate-11">
|
<p class="pt-2 w-full text-sm text-n-slate-11">
|
||||||
{{ t('COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.EMPTY_STATE') }}
|
{{ t('COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.EMPTY_STATE') }}
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<WhatsappTemplateParser
|
<WhatsappTemplate
|
||||||
v-if="selectedTemplate"
|
v-if="selectedTemplate"
|
||||||
:template="selectedTemplate"
|
:template="selectedTemplate"
|
||||||
@send-message="handleSendMessage"
|
@send-message="handleSendMessage"
|
||||||
|
|||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
<script setup>
|
||||||
|
import WhatsAppTemplateParser from 'dashboard/components-next/whatsapp/WhatsAppTemplateParser.vue';
|
||||||
|
import Button from 'dashboard/components-next/button/Button.vue';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
template: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['sendMessage', 'back']);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const handleSendMessage = payload => {
|
||||||
|
emit('sendMessage', payload);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleBack = () => {
|
||||||
|
emit('back');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="absolute top-full mt-1.5 max-h-[30rem] overflow-y-auto ltr:left-0 rtl:right-0 flex flex-col gap-4 px-4 pt-6 pb-5 items-start w-[28.75rem] h-auto bg-n-solid-2 border border-n-strong shadow-sm rounded-lg"
|
||||||
|
>
|
||||||
|
<div class="w-full">
|
||||||
|
<WhatsAppTemplateParser
|
||||||
|
:template="template"
|
||||||
|
@send-message="handleSendMessage"
|
||||||
|
@back="handleBack"
|
||||||
|
>
|
||||||
|
<template #actions="{ sendMessage, goBack, disabled }">
|
||||||
|
<div class="flex gap-3 justify-between items-end w-full h-14">
|
||||||
|
<Button
|
||||||
|
:label="
|
||||||
|
t(
|
||||||
|
'COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.TEMPLATE_PARSER.BACK'
|
||||||
|
)
|
||||||
|
"
|
||||||
|
color="slate"
|
||||||
|
variant="faded"
|
||||||
|
class="w-full font-medium"
|
||||||
|
@click="goBack"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
:label="
|
||||||
|
t(
|
||||||
|
'COMPOSE_NEW_CONVERSATION.FORM.WHATSAPP_OPTIONS.TEMPLATE_PARSER.SEND_MESSAGE'
|
||||||
|
)
|
||||||
|
"
|
||||||
|
class="w-full font-medium"
|
||||||
|
:disabled="disabled"
|
||||||
|
@click="sendMessage"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</WhatsAppTemplateParser>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
+3
-2
@@ -106,7 +106,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="absolute top-full mt-1.5 max-h-[30rem] overflow-y-auto left-0 flex flex-col gap-4 px-4 pt-6 pb-5 items-start w-[28.75rem] h-auto bg-n-solid-2 border border-n-strong shadow-sm rounded-lg"
|
class="absolute top-full mt-1.5 max-h-[30rem] overflow-y-auto ltr:left-0 rtl:right-0 flex flex-col gap-4 px-4 pt-6 pb-5 items-start w-[28.75rem] h-auto bg-n-solid-2 border border-n-strong shadow-sm rounded-lg"
|
||||||
>
|
>
|
||||||
<span class="text-sm text-n-slate-12">
|
<span class="text-sm text-n-slate-12">
|
||||||
{{
|
{{
|
||||||
@@ -138,7 +138,8 @@ onMounted(() => {
|
|||||||
class="flex items-center w-full gap-2"
|
class="flex items-center w-full gap-2"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="flex items-center h-8 text-sm min-w-6 ltr:text-left rtl:text-right text-n-slate-10"
|
class="block h-8 text-sm min-w-6 text-start truncate text-n-slate-10 leading-8"
|
||||||
|
:title="key"
|
||||||
>
|
>
|
||||||
{{ key }}
|
{{ key }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
+2
-1
@@ -36,10 +36,11 @@ const transformInbox = ({
|
|||||||
email,
|
email,
|
||||||
channelType,
|
channelType,
|
||||||
phoneNumber,
|
phoneNumber,
|
||||||
|
medium,
|
||||||
...rest
|
...rest
|
||||||
}) => ({
|
}) => ({
|
||||||
id,
|
id,
|
||||||
icon: getInboxIconByType(channelType, phoneNumber, 'line'),
|
icon: getInboxIconByType(channelType, medium, 'line'),
|
||||||
label: generateLabelForContactableInboxesList({
|
label: generateLabelForContactableInboxesList({
|
||||||
name,
|
name,
|
||||||
email,
|
email,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||||||
import { removeEmoji } from 'shared/helpers/emoji';
|
import { removeEmoji } from 'shared/helpers/emoji';
|
||||||
|
|
||||||
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
||||||
|
import ChannelIcon from 'dashboard/components-next/icon/ChannelIcon.vue';
|
||||||
import wootConstants from 'dashboard/constants/globals';
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -33,10 +34,18 @@ const props = defineProps({
|
|||||||
validator: value =>
|
validator: value =>
|
||||||
!value || wootConstants.AVAILABILITY_STATUS_KEYS.includes(value),
|
!value || wootConstants.AVAILABILITY_STATUS_KEYS.includes(value),
|
||||||
},
|
},
|
||||||
|
inbox: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
iconName: {
|
iconName: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
hideOfflineStatus: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['upload', 'delete']);
|
const emit = defineEmits(['upload', 'delete']);
|
||||||
@@ -66,11 +75,11 @@ const AVATAR_COLORS = {
|
|||||||
default: { bg: '#E8E8E8', text: '#60646C' },
|
default: { bg: '#E8E8E8', text: '#60646C' },
|
||||||
};
|
};
|
||||||
|
|
||||||
const STATUS_CLASSES = {
|
const STATUS_CLASSES = computed(() => ({
|
||||||
online: 'bg-n-teal-10',
|
online: 'bg-n-teal-10',
|
||||||
busy: 'bg-n-amber-10',
|
busy: 'bg-n-amber-10',
|
||||||
offline: 'bg-n-slate-10',
|
...(props.hideOfflineStatus ? {} : { offline: 'bg-n-slate-10' }),
|
||||||
};
|
}));
|
||||||
|
|
||||||
const showDefaultAvatar = computed(() => !props.src && !props.name);
|
const showDefaultAvatar = computed(() => !props.src && !props.name);
|
||||||
|
|
||||||
@@ -174,21 +183,31 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<span class="relative inline-flex group/avatar z-0" :style="containerStyles">
|
<span
|
||||||
|
class="relative inline-flex group/avatar z-0 flex-shrink-0"
|
||||||
|
:style="containerStyles"
|
||||||
|
>
|
||||||
<!-- Status Badge -->
|
<!-- Status Badge -->
|
||||||
<slot name="badge" :size="size">
|
<slot name="badge" :size="size">
|
||||||
<div
|
<div
|
||||||
v-if="status"
|
v-if="status && STATUS_CLASSES[status]"
|
||||||
class="absolute z-20 border rounded-full border-n-slate-3"
|
class="absolute z-20 border rounded-full border-n-slate-3"
|
||||||
:style="badgeStyles"
|
:style="badgeStyles"
|
||||||
:class="STATUS_CLASSES[status]"
|
:class="STATUS_CLASSES[status]"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
v-if="inbox && !(status && STATUS_CLASSES[status])"
|
||||||
|
:style="badgeStyles"
|
||||||
|
class="absolute z-20 flex items-center justify-center rounded-full bg-n-solid-1 border border-transparent flex-shrink-0"
|
||||||
|
>
|
||||||
|
<ChannelIcon :inbox="inbox" class="w-full h-full text-n-slate-11" />
|
||||||
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<!-- Delete Avatar Button -->
|
<!-- Delete Avatar Button -->
|
||||||
<div
|
<div
|
||||||
v-if="src && allowUpload"
|
v-if="src && allowUpload"
|
||||||
class="absolute z-20 flex items-center justify-center invisible w-6 h-6 transition-all duration-300 ease-in-out opacity-0 cursor-pointer outline outline-1 outline-n-container -top-2 -right-2 rounded-xl bg-n-solid-3 group-hover/avatar:visible group-hover/avatar:opacity-100"
|
class="absolute z-20 flex items-center justify-center invisible w-6 h-6 transition-all duration-300 ease-in-out opacity-0 cursor-pointer outline outline-1 outline-n-container -top-2 ltr:-right-2 rtl:-left-2 rounded-xl bg-n-solid-3 group-hover/avatar:visible group-hover/avatar:opacity-100"
|
||||||
@click="handleDismiss"
|
@click="handleDismiss"
|
||||||
>
|
>
|
||||||
<Icon icon="i-lucide-x" class="text-n-slate-11 size-4" />
|
<Icon icon="i-lucide-x" class="text-n-slate-11 size-4" />
|
||||||
@@ -232,31 +251,40 @@ watch(
|
|||||||
<!-- Fallback Icon if no name or image -->
|
<!-- Fallback Icon if no name or image -->
|
||||||
<Icon
|
<Icon
|
||||||
v-else
|
v-else
|
||||||
v-tooltip.top-start="t('THUMBNAIL.AUTHOR.NOT_AVAILABLE')"
|
:title="t('THUMBNAIL.AUTHOR.NOT_AVAILABLE')"
|
||||||
icon="i-lucide-user"
|
icon="i-lucide-user"
|
||||||
:style="iconStyles"
|
:style="iconStyles"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Upload Overlay and Input -->
|
<!-- Upload Overlay and Input -->
|
||||||
<div
|
<slot
|
||||||
v-if="allowUpload"
|
v-if="allowUpload || $slots.overlay"
|
||||||
class="absolute inset-0 z-10 flex items-center justify-center invisible w-full h-full transition-all duration-300 ease-in-out opacity-0 rounded-xl bg-n-alpha-black1 group-hover/avatar:visible group-hover/avatar:opacity-100"
|
name="overlay"
|
||||||
@click="handleUploadAvatar"
|
:size="size"
|
||||||
|
:handle-upload="handleUploadAvatar"
|
||||||
|
:file-input-ref="fileInput"
|
||||||
|
:handle-image-upload="handleImageUpload"
|
||||||
>
|
>
|
||||||
<Icon
|
<div
|
||||||
icon="i-lucide-upload"
|
class="absolute inset-0 z-10 flex items-center justify-center invisible w-full h-full transition-all duration-300 ease-in-out opacity-0 rounded-xl bg-n-alpha-black1 group-hover/avatar:visible group-hover/avatar:opacity-100"
|
||||||
class="text-white"
|
@click="handleUploadAvatar"
|
||||||
:style="{ width: `${size / 2}px`, height: `${size / 2}px` }"
|
>
|
||||||
/>
|
<Icon
|
||||||
<input
|
icon="i-lucide-upload"
|
||||||
ref="fileInput"
|
class="text-white"
|
||||||
type="file"
|
:style="{ width: `${size / 2}px`, height: `${size / 2}px` }"
|
||||||
accept="image/png, image/jpeg, image/jpg, image/gif, image/webp"
|
/>
|
||||||
class="hidden"
|
<input
|
||||||
@change="handleImageUpload"
|
v-if="allowUpload"
|
||||||
/>
|
ref="fileInput"
|
||||||
</div>
|
type="file"
|
||||||
|
accept="image/png, image/jpeg, image/jpg, image/gif, image/webp"
|
||||||
|
class="hidden"
|
||||||
|
@change="handleImageUpload"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -57,9 +57,10 @@ const menuItems = computed(() => [
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const icon = computed(() =>
|
const icon = computed(() => {
|
||||||
getInboxIconByType(props.inbox.channel_type, '', 'outline')
|
const { medium, channel_type: type } = props.inbox;
|
||||||
);
|
return getInboxIconByType(type, medium, 'outline');
|
||||||
|
});
|
||||||
|
|
||||||
const handleAction = ({ action, value }) => {
|
const handleAction = ({ action, value }) => {
|
||||||
toggleDropdown(false);
|
toggleDropdown(false);
|
||||||
|
|||||||
+10
@@ -35,6 +35,7 @@ const initialState = {
|
|||||||
productName: '',
|
productName: '',
|
||||||
featureFaq: false,
|
featureFaq: false,
|
||||||
featureMemory: false,
|
featureMemory: false,
|
||||||
|
featureCitation: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const state = reactive({ ...initialState });
|
const state = reactive({ ...initialState });
|
||||||
@@ -70,6 +71,7 @@ const prepareAssistantDetails = () => ({
|
|||||||
product_name: state.productName,
|
product_name: state.productName,
|
||||||
feature_faq: state.featureFaq,
|
feature_faq: state.featureFaq,
|
||||||
feature_memory: state.featureMemory,
|
feature_memory: state.featureMemory,
|
||||||
|
feature_citation: state.featureCitation,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -93,6 +95,7 @@ const updateStateFromAssistant = assistant => {
|
|||||||
productName: config.product_name,
|
productName: config.product_name,
|
||||||
featureFaq: config.feature_faq || false,
|
featureFaq: config.feature_faq || false,
|
||||||
featureMemory: config.feature_memory || false,
|
featureMemory: config.feature_memory || false,
|
||||||
|
featureCitation: config.feature_citation || false,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -151,6 +154,13 @@ watch(
|
|||||||
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<label class="flex items-center gap-2">
|
||||||
|
<input v-model="state.featureCitation" type="checkbox" />
|
||||||
|
<span class="text-sm font-medium text-n-slate-12">
|
||||||
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CITATIONS') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="flex items-center justify-between w-full gap-3">
|
<div class="flex items-center justify-between w-full gap-3">
|
||||||
|
|||||||
+8
-6
@@ -41,6 +41,7 @@ const initialState = {
|
|||||||
features: {
|
features: {
|
||||||
conversationFaqs: false,
|
conversationFaqs: false,
|
||||||
memories: false,
|
memories: false,
|
||||||
|
citations: false,
|
||||||
},
|
},
|
||||||
temperature: 1,
|
temperature: 1,
|
||||||
};
|
};
|
||||||
@@ -87,6 +88,7 @@ const updateStateFromAssistant = assistant => {
|
|||||||
state.features = {
|
state.features = {
|
||||||
conversationFaqs: config.feature_faq || false,
|
conversationFaqs: config.feature_faq || false,
|
||||||
memories: config.feature_memory || false,
|
memories: config.feature_memory || false,
|
||||||
|
citations: config.feature_citation || false,
|
||||||
};
|
};
|
||||||
state.temperature = config.temperature || 1;
|
state.temperature = config.temperature || 1;
|
||||||
};
|
};
|
||||||
@@ -152,6 +154,7 @@ const handleFeaturesUpdate = () => {
|
|||||||
...props.assistant.config,
|
...props.assistant.config,
|
||||||
feature_faq: state.features.conversationFaqs,
|
feature_faq: state.features.conversationFaqs,
|
||||||
feature_memory: state.features.memories,
|
feature_memory: state.features.memories,
|
||||||
|
feature_citation: state.features.citations,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -300,20 +303,19 @@ watch(
|
|||||||
<input
|
<input
|
||||||
v-model="state.features.conversationFaqs"
|
v-model="state.features.conversationFaqs"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="form-checkbox"
|
|
||||||
/>
|
/>
|
||||||
{{
|
{{
|
||||||
t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CONVERSATION_FAQS')
|
t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CONVERSATION_FAQS')
|
||||||
}}
|
}}
|
||||||
</label>
|
</label>
|
||||||
<label class="flex items-center gap-2">
|
<label class="flex items-center gap-2">
|
||||||
<input
|
<input v-model="state.features.memories" type="checkbox" />
|
||||||
v-model="state.features.memories"
|
|
||||||
type="checkbox"
|
|
||||||
class="form-checkbox"
|
|
||||||
/>
|
|
||||||
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
||||||
</label>
|
</label>
|
||||||
|
<label class="flex items-center gap-2">
|
||||||
|
<input v-model="state.features.citations" type="checkbox" />
|
||||||
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CITATIONS') }}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+9
-10
@@ -26,6 +26,7 @@ const initialState = {
|
|||||||
features: {
|
features: {
|
||||||
conversationFaqs: false,
|
conversationFaqs: false,
|
||||||
memories: false,
|
memories: false,
|
||||||
|
citations: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ const updateStateFromAssistant = assistant => {
|
|||||||
state.features = {
|
state.features = {
|
||||||
conversationFaqs: config.feature_faq || false,
|
conversationFaqs: config.feature_faq || false,
|
||||||
memories: config.feature_memory || false,
|
memories: config.feature_memory || false,
|
||||||
|
citations: config.feature_citation || false,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,6 +78,7 @@ const handleBasicInfoUpdate = async () => {
|
|||||||
product_name: state.productName,
|
product_name: state.productName,
|
||||||
feature_faq: state.features.conversationFaqs,
|
feature_faq: state.features.conversationFaqs,
|
||||||
feature_memory: state.features.memories,
|
feature_memory: state.features.memories,
|
||||||
|
feature_citation: state.features.citations,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -123,21 +126,17 @@ watch(
|
|||||||
</label>
|
</label>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<label class="flex items-center gap-2">
|
<label class="flex items-center gap-2">
|
||||||
<input
|
<input v-model="state.features.conversationFaqs" type="checkbox" />
|
||||||
v-model="state.features.conversationFaqs"
|
|
||||||
type="checkbox"
|
|
||||||
class="form-checkbox"
|
|
||||||
/>
|
|
||||||
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CONVERSATION_FAQS') }}
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CONVERSATION_FAQS') }}
|
||||||
</label>
|
</label>
|
||||||
<label class="flex items-center gap-2">
|
<label class="flex items-center gap-2">
|
||||||
<input
|
<input v-model="state.features.memories" type="checkbox" />
|
||||||
v-model="state.features.memories"
|
|
||||||
type="checkbox"
|
|
||||||
class="form-checkbox"
|
|
||||||
/>
|
|
||||||
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_MEMORIES') }}
|
||||||
</label>
|
</label>
|
||||||
|
<label class="flex items-center gap-2">
|
||||||
|
<input v-model="state.features.citations" type="checkbox" />
|
||||||
|
{{ t('CAPTAIN.ASSISTANTS.FORM.FEATURES.ALLOW_CITATIONS') }}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
import { toRef } from 'vue';
|
||||||
import { useChannelIcon } from './provider';
|
import { useChannelIcon } from './provider';
|
||||||
import Icon from 'next/icon/Icon.vue';
|
import Icon from 'next/icon/Icon.vue';
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const channelIcon = useChannelIcon(props.inbox);
|
const channelIcon = useChannelIcon(toRef(props, 'inbox'));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -22,15 +22,21 @@ export function useChannelIcon(inbox) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const channelIcon = computed(() => {
|
const channelIcon = computed(() => {
|
||||||
const type = inbox.channel_type;
|
const inboxDetails = inbox.value || inbox;
|
||||||
|
const type = inboxDetails.channel_type;
|
||||||
let icon = channelTypeIconMap[type];
|
let icon = channelTypeIconMap[type];
|
||||||
|
|
||||||
if (type === 'Channel::Email' && inbox.provider) {
|
if (type === 'Channel::Email' && inboxDetails.provider) {
|
||||||
if (Object.keys(providerIconMap).includes(inbox.provider)) {
|
if (Object.keys(providerIconMap).includes(inboxDetails.provider)) {
|
||||||
icon = providerIconMap[inbox.provider];
|
icon = providerIconMap[inboxDetails.provider];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case for Twilio whatsapp
|
||||||
|
if (type === 'Channel::TwilioSms' && inboxDetails.medium === 'whatsapp') {
|
||||||
|
icon = 'i-ri-whatsapp-fill';
|
||||||
|
}
|
||||||
|
|
||||||
return icon ?? 'i-ri-global-fill';
|
return icon ?? 'i-ri-global-fill';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,77 @@ describe('useChannelIcon', () => {
|
|||||||
expect(icon).toBe('i-ri-phone-fill');
|
expect(icon).toBe('i-ri-phone-fill');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for Line channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::Line' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-line-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for SMS channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::Sms' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-chat-1-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for Telegram channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::Telegram' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-telegram-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for Twitter channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::TwitterProfile' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-twitter-x-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for WebWidget channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::WebWidget' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-global-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns correct icon for Instagram channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::Instagram' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-instagram-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('TwilioSms channel', () => {
|
||||||
|
it('returns chat icon for regular Twilio SMS channel', () => {
|
||||||
|
const inbox = { channel_type: 'Channel::TwilioSms' };
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-chat-1-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns WhatsApp icon for Twilio SMS with WhatsApp medium', () => {
|
||||||
|
const inbox = {
|
||||||
|
channel_type: 'Channel::TwilioSms',
|
||||||
|
medium: 'whatsapp',
|
||||||
|
};
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-whatsapp-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns chat icon for Twilio SMS with non-WhatsApp medium', () => {
|
||||||
|
const inbox = {
|
||||||
|
channel_type: 'Channel::TwilioSms',
|
||||||
|
medium: 'sms',
|
||||||
|
};
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-chat-1-fill');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns chat icon for Twilio SMS with undefined medium', () => {
|
||||||
|
const inbox = {
|
||||||
|
channel_type: 'Channel::TwilioSms',
|
||||||
|
medium: undefined,
|
||||||
|
};
|
||||||
|
const { value: icon } = useChannelIcon(inbox);
|
||||||
|
expect(icon).toBe('i-ri-chat-1-fill');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Email channel', () => {
|
describe('Email channel', () => {
|
||||||
it('returns mail icon for generic email channel', () => {
|
it('returns mail icon for generic email channel', () => {
|
||||||
const inbox = { channel_type: 'Channel::Email' };
|
const inbox = { channel_type: 'Channel::Email' };
|
||||||
|
|||||||
@@ -509,10 +509,8 @@ const menuItems = computed(() => {
|
|||||||
class="bg-n-solid-2 rtl:border-l ltr:border-r border-n-weak flex flex-col text-sm pb-1 fixed top-0 ltr:left-0 rtl:right-0 h-full z-40 transition-transform duration-200 ease-in-out md:static w-[200px] basis-[200px] md:flex-shrink-0 md:ltr:translate-x-0 md:rtl:-translate-x-0"
|
class="bg-n-solid-2 rtl:border-l ltr:border-r border-n-weak flex flex-col text-sm pb-1 fixed top-0 ltr:left-0 rtl:right-0 h-full z-40 transition-transform duration-200 ease-in-out md:static w-[200px] basis-[200px] md:flex-shrink-0 md:ltr:translate-x-0 md:rtl:-translate-x-0"
|
||||||
:class="[
|
:class="[
|
||||||
{
|
{
|
||||||
'ltr:translate-x-0 rtl:-translate-x-0 shadow-lg md:shadow-none':
|
'shadow-lg md:shadow-none': isMobileSidebarOpen,
|
||||||
isMobileSidebarOpen,
|
'ltr:-translate-x-full rtl:translate-x-full': !isMobileSidebarOpen,
|
||||||
'ltr:-translate-x-full rtl:translate-x-full md:translate-x-0':
|
|
||||||
!isMobileSidebarOpen,
|
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ onMounted(async () => {
|
|||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-rtl--wrapper .sidebar-group-children > .child-item:last-child::after,
|
#app[dir='rtl'] .sidebar-group-children > .child-item:last-child::after,
|
||||||
.app-rtl--wrapper
|
#app[dir='rtl']
|
||||||
.sidebar-group-children
|
.sidebar-group-children
|
||||||
> *:last-child
|
> *:last-child
|
||||||
> *:last-child
|
> *:last-child
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ const handleBlur = e => emit('blur', e);
|
|||||||
v-if="showDropdownMenu"
|
v-if="showDropdownMenu"
|
||||||
:menu-items="filteredMenuItems"
|
:menu-items="filteredMenuItems"
|
||||||
:is-searching="isLoading"
|
:is-searching="isLoading"
|
||||||
class="left-0 z-[100] top-8 overflow-y-auto max-h-60 w-[inherit] max-w-md dark:!outline-n-slate-5"
|
class="ltr:left-0 rtl:right-0 z-[100] top-8 overflow-y-auto max-h-60 w-[inherit] max-w-md dark:!outline-n-slate-5"
|
||||||
@action="handleDropdownAction"
|
@action="handleDropdownAction"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,279 @@
|
|||||||
|
<script setup>
|
||||||
|
import { ref, computed, onMounted, watch } from 'vue';
|
||||||
|
import { useVuelidate } from '@vuelidate/core';
|
||||||
|
import { requiredIf } from '@vuelidate/validators';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
import Input from 'dashboard/components-next/input/Input.vue';
|
||||||
|
import {
|
||||||
|
buildTemplateParameters,
|
||||||
|
allKeysRequired,
|
||||||
|
replaceTemplateVariables,
|
||||||
|
DEFAULT_LANGUAGE,
|
||||||
|
DEFAULT_CATEGORY,
|
||||||
|
COMPONENT_TYPES,
|
||||||
|
MEDIA_FORMATS,
|
||||||
|
findComponentByType,
|
||||||
|
} from 'dashboard/helper/templateHelper';
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
template: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
validator: value => {
|
||||||
|
if (!value || typeof value !== 'object') return false;
|
||||||
|
if (!value.components || !Array.isArray(value.components)) return false;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['sendMessage', 'resetTemplate', 'back']);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
const processedParams = ref({});
|
||||||
|
|
||||||
|
const languageLabel = computed(() => {
|
||||||
|
return `${t('WHATSAPP_TEMPLATES.PARSER.LANGUAGE')}: ${props.template.language || DEFAULT_LANGUAGE}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const categoryLabel = computed(() => {
|
||||||
|
return `${t('WHATSAPP_TEMPLATES.PARSER.CATEGORY')}: ${props.template.category || DEFAULT_CATEGORY}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const headerComponent = computed(() => {
|
||||||
|
return findComponentByType(props.template, COMPONENT_TYPES.HEADER);
|
||||||
|
});
|
||||||
|
|
||||||
|
const bodyComponent = computed(() => {
|
||||||
|
return findComponentByType(props.template, COMPONENT_TYPES.BODY);
|
||||||
|
});
|
||||||
|
|
||||||
|
const bodyText = computed(() => {
|
||||||
|
return bodyComponent.value?.text || '';
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasMediaHeader = computed(() =>
|
||||||
|
MEDIA_FORMATS.includes(headerComponent.value?.format)
|
||||||
|
);
|
||||||
|
|
||||||
|
const formatType = computed(() => {
|
||||||
|
const format = headerComponent.value?.format;
|
||||||
|
return format ? format.charAt(0) + format.slice(1).toLowerCase() : '';
|
||||||
|
});
|
||||||
|
|
||||||
|
const hasVariables = computed(() => {
|
||||||
|
return bodyText.value?.match(/{{([^}]+)}}/g) !== null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const renderedTemplate = computed(() => {
|
||||||
|
return replaceTemplateVariables(bodyText.value, processedParams.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
const isFormInvalid = computed(() => {
|
||||||
|
if (!hasVariables.value && !hasMediaHeader.value) return false;
|
||||||
|
|
||||||
|
if (hasMediaHeader.value && !processedParams.value.header?.media_url) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasVariables.value && processedParams.value.body) {
|
||||||
|
const hasEmptyBodyVariable = Object.values(processedParams.value.body).some(
|
||||||
|
value => !value
|
||||||
|
);
|
||||||
|
if (hasEmptyBodyVariable) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (processedParams.value.buttons) {
|
||||||
|
const hasEmptyButtonParameter = processedParams.value.buttons.some(
|
||||||
|
button => !button.parameter
|
||||||
|
);
|
||||||
|
if (hasEmptyButtonParameter) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
const v$ = useVuelidate(
|
||||||
|
{
|
||||||
|
processedParams: {
|
||||||
|
requiredIfKeysPresent: requiredIf(hasVariables),
|
||||||
|
allKeysRequired,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ processedParams }
|
||||||
|
);
|
||||||
|
|
||||||
|
const initializeTemplateParameters = () => {
|
||||||
|
processedParams.value = buildTemplateParameters(
|
||||||
|
props.template,
|
||||||
|
hasMediaHeader.value
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateMediaUrl = value => {
|
||||||
|
processedParams.value.header ??= {};
|
||||||
|
processedParams.value.header.media_url = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const sendMessage = () => {
|
||||||
|
v$.value.$touch();
|
||||||
|
if (v$.value.$invalid) return;
|
||||||
|
|
||||||
|
const { name, category, language, namespace } = props.template;
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
message: renderedTemplate.value,
|
||||||
|
templateParams: {
|
||||||
|
name,
|
||||||
|
category,
|
||||||
|
language,
|
||||||
|
namespace,
|
||||||
|
processed_params: processedParams.value,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
emit('sendMessage', payload);
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetTemplate = () => {
|
||||||
|
emit('resetTemplate');
|
||||||
|
};
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
emit('back');
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(initializeTemplateParameters);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.template,
|
||||||
|
() => {
|
||||||
|
initializeTemplateParameters();
|
||||||
|
v$.value.$reset();
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
processedParams,
|
||||||
|
hasVariables,
|
||||||
|
hasMediaHeader,
|
||||||
|
headerComponent,
|
||||||
|
renderedTemplate,
|
||||||
|
v$,
|
||||||
|
updateMediaUrl,
|
||||||
|
sendMessage,
|
||||||
|
resetTemplate,
|
||||||
|
goBack,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div class="flex flex-col gap-4 p-4 mb-4 rounded-lg bg-n-alpha-black2">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<h3 class="text-sm font-medium text-n-slate-12">
|
||||||
|
{{ template.name }}
|
||||||
|
</h3>
|
||||||
|
<span class="text-xs text-n-slate-11">
|
||||||
|
{{ languageLabel }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2">
|
||||||
|
<div class="rounded-md">
|
||||||
|
<div class="text-sm whitespace-pre-wrap text-n-slate-12">
|
||||||
|
{{ renderedTemplate }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-xs text-n-slate-11">
|
||||||
|
{{ categoryLabel }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="hasVariables || hasMediaHeader">
|
||||||
|
<div v-if="hasMediaHeader" class="mb-4">
|
||||||
|
<p class="mb-2.5 text-sm font-semibold">
|
||||||
|
{{
|
||||||
|
$t('WHATSAPP_TEMPLATES.PARSER.MEDIA_HEADER_LABEL', {
|
||||||
|
type: formatType,
|
||||||
|
}) || `${formatType} Header`
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<div class="flex items-center mb-2.5">
|
||||||
|
<Input
|
||||||
|
:model-value="processedParams.header?.media_url || ''"
|
||||||
|
type="url"
|
||||||
|
class="flex-1"
|
||||||
|
:placeholder="
|
||||||
|
t('WHATSAPP_TEMPLATES.PARSER.MEDIA_URL_LABEL', {
|
||||||
|
type: formatType,
|
||||||
|
})
|
||||||
|
"
|
||||||
|
@update:model-value="updateMediaUrl"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Body Variables Section -->
|
||||||
|
<div v-if="processedParams.body">
|
||||||
|
<p class="mb-2.5 text-sm font-semibold">
|
||||||
|
{{ $t('WHATSAPP_TEMPLATES.PARSER.VARIABLES_LABEL') }}
|
||||||
|
</p>
|
||||||
|
<div
|
||||||
|
v-for="(variable, key) in processedParams.body"
|
||||||
|
:key="`body-${key}`"
|
||||||
|
class="flex items-center mb-2.5"
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
v-model="processedParams.body[key]"
|
||||||
|
type="text"
|
||||||
|
class="flex-1"
|
||||||
|
:placeholder="
|
||||||
|
t('WHATSAPP_TEMPLATES.PARSER.VARIABLE_PLACEHOLDER', {
|
||||||
|
variable: key,
|
||||||
|
})
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Button Variables Section -->
|
||||||
|
<div v-if="processedParams.buttons">
|
||||||
|
<p class="mb-2.5 text-sm font-semibold">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PARSER.BUTTON_PARAMETERS') }}
|
||||||
|
</p>
|
||||||
|
<div
|
||||||
|
v-for="(button, index) in processedParams.buttons"
|
||||||
|
:key="`button-${index}`"
|
||||||
|
class="flex items-center mb-2.5"
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
v-model="processedParams.buttons[index].parameter"
|
||||||
|
type="text"
|
||||||
|
class="flex-1"
|
||||||
|
:placeholder="t('WHATSAPP_TEMPLATES.PARSER.BUTTON_PARAMETER')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p
|
||||||
|
v-if="v$.$dirty && v$.$invalid"
|
||||||
|
class="p-2.5 text-center rounded-md bg-n-ruby-9/20 text-n-ruby-9"
|
||||||
|
>
|
||||||
|
{{ $t('WHATSAPP_TEMPLATES.PARSER.FORM_ERROR_MESSAGE') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<slot
|
||||||
|
name="actions"
|
||||||
|
:send-message="sendMessage"
|
||||||
|
:reset-template="resetTemplate"
|
||||||
|
:go-back="goBack"
|
||||||
|
:is-valid="!v$.$invalid"
|
||||||
|
:disabled="isFormInvalid"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -98,7 +98,7 @@ const toggleConversationLayout = () => {
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
id="saveFilterTeleportTarget"
|
id="saveFilterTeleportTarget"
|
||||||
class="absolute z-40 mt-2"
|
class="absolute z-50 mt-2"
|
||||||
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -124,7 +124,7 @@ const toggleConversationLayout = () => {
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
id="conversationFilterTeleportTarget"
|
id="conversationFilterTeleportTarget"
|
||||||
class="absolute z-40 mt-2"
|
class="absolute z-50 mt-2"
|
||||||
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -150,7 +150,7 @@ const toggleConversationLayout = () => {
|
|||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
id="conversationFilterTeleportTarget"
|
id="conversationFilterTeleportTarget"
|
||||||
class="absolute z-40 mt-2"
|
class="absolute z-50 mt-2"
|
||||||
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
:class="{ 'ltr:right-0 rtl:left-0': isOnExpandedLayout }"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// [NOTE][DEPRECATED] This method is to be deprecated, please do not add new components to this file.
|
// [NOTE][DEPRECATED] This method is to be deprecated, please do not add new components to this file.
|
||||||
/* eslint no-plusplus: 0 */
|
/* eslint no-plusplus: 0 */
|
||||||
import AvatarUploader from './widgets/forms/AvatarUploader.vue';
|
|
||||||
import Code from './Code.vue';
|
import Code from './Code.vue';
|
||||||
import ColorPicker from './widgets/ColorPicker.vue';
|
import ColorPicker from './widgets/ColorPicker.vue';
|
||||||
import ConfirmDeleteModal from './widgets/modal/ConfirmDeleteModal.vue';
|
import ConfirmDeleteModal from './widgets/modal/ConfirmDeleteModal.vue';
|
||||||
@@ -18,11 +17,9 @@ import Modal from './Modal.vue';
|
|||||||
import Spinner from 'shared/components/Spinner.vue';
|
import Spinner from 'shared/components/Spinner.vue';
|
||||||
import Tabs from './ui/Tabs/Tabs.vue';
|
import Tabs from './ui/Tabs/Tabs.vue';
|
||||||
import TabsItem from './ui/Tabs/TabsItem.vue';
|
import TabsItem from './ui/Tabs/TabsItem.vue';
|
||||||
import Thumbnail from './widgets/Thumbnail.vue';
|
|
||||||
import DatePicker from './ui/DatePicker/DatePicker.vue';
|
import DatePicker from './ui/DatePicker/DatePicker.vue';
|
||||||
|
|
||||||
const WootUIKit = {
|
const WootUIKit = {
|
||||||
AvatarUploader,
|
|
||||||
Code,
|
Code,
|
||||||
ColorPicker,
|
ColorPicker,
|
||||||
ConfirmDeleteModal,
|
ConfirmDeleteModal,
|
||||||
@@ -40,7 +37,6 @@ const WootUIKit = {
|
|||||||
Spinner,
|
Spinner,
|
||||||
Tabs,
|
Tabs,
|
||||||
TabsItem,
|
TabsItem,
|
||||||
Thumbnail,
|
|
||||||
DatePicker,
|
DatePicker,
|
||||||
install(Vue) {
|
install(Vue) {
|
||||||
const keys = Object.keys(this);
|
const keys = Object.keys(this);
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
/* eslint no-console: 0 */
|
|
||||||
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [globalConfigMixin],
|
|
||||||
props: {
|
props: {
|
||||||
items: {
|
items: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'Avatar',
|
|
||||||
props: {
|
|
||||||
username: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: Number,
|
|
||||||
default: 40,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
style() {
|
|
||||||
return {
|
|
||||||
fontSize: `${Math.floor(this.size / 2.5)}px`,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
userInitial() {
|
|
||||||
const parts = this.username.split(/[ -]/);
|
|
||||||
let initials = parts.reduce((acc, curr) => acc + curr.charAt(0), '');
|
|
||||||
|
|
||||||
if (initials.length > 2 && initials.search(/[A-Z]/) !== -1) {
|
|
||||||
initials = initials.replace(/[a-z]+/g, '');
|
|
||||||
}
|
|
||||||
initials = initials.substring(0, 2).toUpperCase();
|
|
||||||
|
|
||||||
return initials;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="avatar-container" :style="style" aria-hidden="true">
|
|
||||||
<slot>{{ userInitial }}</slot>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
@tailwind components;
|
|
||||||
@layer components {
|
|
||||||
.avatar-color {
|
|
||||||
background-image: linear-gradient(to top, #c2e1ff 0%, #d6ebff 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark-avatar-color {
|
|
||||||
background-image: linear-gradient(to top, #135899 0%, #135899 100%);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.avatar-container {
|
|
||||||
@apply flex leading-[100%] font-medium items-center justify-center text-center cursor-default avatar-color dark:dark-avatar-color text-n-blue-text;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,32 +1,22 @@
|
|||||||
<script>
|
<script setup>
|
||||||
import { getInboxClassByType } from 'dashboard/helper/inbox';
|
import ChannelIcon from 'dashboard/components-next/icon/ChannelIcon.vue';
|
||||||
|
|
||||||
export default {
|
defineProps({
|
||||||
props: {
|
inbox: {
|
||||||
inbox: {
|
type: Object,
|
||||||
type: Object,
|
default: () => {},
|
||||||
default: () => {},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
computed: {
|
});
|
||||||
computedInboxClass() {
|
|
||||||
const { phone_number: phoneNumber, channel_type: type } = this.inbox;
|
|
||||||
const classByType = getInboxClassByType(type, phoneNumber);
|
|
||||||
return classByType;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div class="flex items-center text-n-slate-11 text-xs min-w-0">
|
||||||
class="inbox--name inline-flex items-center py-0.5 px-0 leading-3 whitespace-nowrap bg-none text-n-slate-11 text-xs my-0 mx-2.5"
|
<ChannelIcon
|
||||||
>
|
:inbox="inbox"
|
||||||
<fluent-icon
|
class="size-3 ltr:mr-0.5 rtl:ml-0.5 flex-shrink-0"
|
||||||
class="mr-0.5 rtl:ml-0.5 rtl:mr-0"
|
|
||||||
:icon="computedInboxClass"
|
|
||||||
size="12"
|
|
||||||
/>
|
/>
|
||||||
{{ inbox.name }}
|
<span class="truncate">
|
||||||
|
{{ inbox.name }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
import { mount } from '@vue/test-utils';
|
|
||||||
import Avatar from './Avatar.vue';
|
|
||||||
import Thumbnail from './Thumbnail.vue';
|
|
||||||
|
|
||||||
describe('Thumbnail.vue', () => {
|
|
||||||
it('should render the agent thumbnail if valid image is passed', () => {
|
|
||||||
const wrapper = mount(Thumbnail, {
|
|
||||||
propsData: {
|
|
||||||
src: 'https://some_valid_url.com',
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasImageLoaded: true,
|
|
||||||
imgError: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expect(wrapper.find('.user-thumbnail').exists()).toBe(true);
|
|
||||||
const avatarComponent = wrapper.findComponent(Avatar);
|
|
||||||
expect(avatarComponent.isVisible()).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render the avatar component if invalid image is passed', () => {
|
|
||||||
const wrapper = mount(Thumbnail, {
|
|
||||||
propsData: {
|
|
||||||
src: 'https://some_invalid_url.com',
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasImageLoaded: true,
|
|
||||||
imgError: true,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expect(wrapper.find('#image').exists()).toBe(false);
|
|
||||||
const avatarComponent = wrapper.findComponent(Avatar);
|
|
||||||
expect(avatarComponent.isVisible()).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should the initial of the name if no image is passed', () => {
|
|
||||||
const wrapper = mount(Avatar, {
|
|
||||||
propsData: {
|
|
||||||
username: 'Angie Rojas',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expect(wrapper.find('div').text()).toBe('AR');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,224 +0,0 @@
|
|||||||
<script>
|
|
||||||
/**
|
|
||||||
* Thumbnail Component
|
|
||||||
* Src - source for round image
|
|
||||||
* Size - Size of the thumbnail
|
|
||||||
* Badge - Chat source indication { fb / telegram }
|
|
||||||
* Username - Username for avatar
|
|
||||||
*/
|
|
||||||
import Avatar from './Avatar.vue';
|
|
||||||
import { removeEmoji } from 'shared/helpers/emoji';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
Avatar,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
src: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
type: String,
|
|
||||||
default: '40px',
|
|
||||||
},
|
|
||||||
badge: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
username: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
status: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
hasBorder: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
shouldShowStatusAlways: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
variant: {
|
|
||||||
type: String,
|
|
||||||
default: 'circle',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hasImageLoaded: false,
|
|
||||||
imgError: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
userNameWithoutEmoji() {
|
|
||||||
return removeEmoji(this.username);
|
|
||||||
},
|
|
||||||
showStatusIndicator() {
|
|
||||||
if (this.shouldShowStatusAlways) return true;
|
|
||||||
return this.status === 'online' || this.status === 'busy';
|
|
||||||
},
|
|
||||||
avatarSize() {
|
|
||||||
return Number(this.size.replace(/\D+/g, ''));
|
|
||||||
},
|
|
||||||
badgeSrc() {
|
|
||||||
return {
|
|
||||||
instagram_direct_message: 'instagram-dm',
|
|
||||||
facebook: 'messenger',
|
|
||||||
'twitter-tweet': 'twitter-tweet',
|
|
||||||
'twitter-dm': 'twitter-dm',
|
|
||||||
whatsapp: 'whatsapp',
|
|
||||||
sms: 'sms',
|
|
||||||
'Channel::Line': 'line',
|
|
||||||
'Channel::Telegram': 'telegram',
|
|
||||||
'Channel::WebWidget': '',
|
|
||||||
}[this.badge];
|
|
||||||
},
|
|
||||||
badgeStyle() {
|
|
||||||
const size = Math.floor(this.avatarSize / 3);
|
|
||||||
const badgeSize = `${size + 2}px`;
|
|
||||||
const borderRadius = `${size / 2}px`;
|
|
||||||
return { width: badgeSize, height: badgeSize, borderRadius };
|
|
||||||
},
|
|
||||||
statusStyle() {
|
|
||||||
const statusSize = `${this.avatarSize / 4}px`;
|
|
||||||
return { width: statusSize, height: statusSize };
|
|
||||||
},
|
|
||||||
thumbnailClass() {
|
|
||||||
const className = this.hasBorder
|
|
||||||
? 'border border-solid border-white dark:border-n-weak'
|
|
||||||
: '';
|
|
||||||
const variant =
|
|
||||||
this.variant === 'circle' ? 'thumbnail-rounded' : 'thumbnail-square';
|
|
||||||
return `user-thumbnail ${className} ${variant}`;
|
|
||||||
},
|
|
||||||
thumbnailBoxClass() {
|
|
||||||
const boxClass = this.variant === 'circle' ? 'is-rounded' : '';
|
|
||||||
return `user-thumbnail-box ${boxClass}`;
|
|
||||||
},
|
|
||||||
shouldShowImage() {
|
|
||||||
if (!this.src) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.hasImageLoaded) {
|
|
||||||
return !this.imgError;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
src(value, oldValue) {
|
|
||||||
if (value !== oldValue && this.imgError) {
|
|
||||||
this.imgError = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onImgError() {
|
|
||||||
this.imgError = true;
|
|
||||||
},
|
|
||||||
onImgLoad() {
|
|
||||||
this.hasImageLoaded = true;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div
|
|
||||||
:class="thumbnailBoxClass"
|
|
||||||
:style="{ height: size, width: size }"
|
|
||||||
:title="title"
|
|
||||||
>
|
|
||||||
<!-- Using v-show instead of v-if to avoid flickering as v-if removes dom elements. -->
|
|
||||||
<slot>
|
|
||||||
<img
|
|
||||||
v-show="shouldShowImage"
|
|
||||||
:src="src"
|
|
||||||
draggable="false"
|
|
||||||
:class="thumbnailClass"
|
|
||||||
@load="onImgLoad"
|
|
||||||
@error="onImgError"
|
|
||||||
/>
|
|
||||||
<Avatar
|
|
||||||
v-show="!shouldShowImage"
|
|
||||||
:username="userNameWithoutEmoji"
|
|
||||||
:class="thumbnailClass"
|
|
||||||
:size="avatarSize"
|
|
||||||
/>
|
|
||||||
</slot>
|
|
||||||
<img
|
|
||||||
v-if="badgeSrc"
|
|
||||||
class="source-badge z-20"
|
|
||||||
:style="badgeStyle"
|
|
||||||
:src="`/integrations/channels/badges/${badgeSrc}.png`"
|
|
||||||
alt="Badge"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
v-if="showStatusIndicator"
|
|
||||||
class="z-20"
|
|
||||||
:class="`source-badge user-online-status user-online-status--${status}`"
|
|
||||||
:style="statusStyle"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.user-thumbnail-box {
|
|
||||||
flex: 0 0 auto;
|
|
||||||
max-width: 100%;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&.is-rounded {
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-thumbnail {
|
|
||||||
border-radius: 50%;
|
|
||||||
&.thumbnail-square {
|
|
||||||
border-radius: 0.5625rem;
|
|
||||||
}
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
object-fit: cover;
|
|
||||||
vertical-align: initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
.source-badge {
|
|
||||||
border-radius: 0.1875rem;
|
|
||||||
bottom: -0.125rem;
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
||||||
position: absolute;
|
|
||||||
right: 0;
|
|
||||||
@apply bg-n-background p-0.5 size-3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-online-status {
|
|
||||||
@apply bottom-0.5 rounded-full;
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
content: ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-online-status--online {
|
|
||||||
@apply bg-n-teal-10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-online-status--busy {
|
|
||||||
@apply bg-n-amber-10;
|
|
||||||
}
|
|
||||||
|
|
||||||
.user-online-status--offline {
|
|
||||||
@apply bg-n-slate-10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,78 +1,69 @@
|
|||||||
<script>
|
<script setup>
|
||||||
import Thumbnail from './Thumbnail.vue';
|
import { computed } from 'vue';
|
||||||
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
|
|
||||||
export default {
|
const props = defineProps({
|
||||||
components: {
|
usersList: {
|
||||||
Thumbnail,
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
},
|
},
|
||||||
props: {
|
size: {
|
||||||
usersList: {
|
type: Number,
|
||||||
type: Array,
|
default: 24,
|
||||||
default: () => [],
|
},
|
||||||
},
|
showMoreThumbnailsCount: {
|
||||||
size: {
|
type: Boolean,
|
||||||
type: String,
|
default: false,
|
||||||
default: '24px',
|
},
|
||||||
},
|
moreThumbnailsText: {
|
||||||
showMoreThumbnailsCount: {
|
type: String,
|
||||||
type: Boolean,
|
default: '',
|
||||||
default: false,
|
},
|
||||||
},
|
gap: {
|
||||||
moreThumbnailsText: {
|
type: String,
|
||||||
type: String,
|
default: 'normal',
|
||||||
default: '',
|
validator(value) {
|
||||||
},
|
// The value must match one of these strings
|
||||||
gap: {
|
return ['normal', 'tight'].includes(value);
|
||||||
type: String,
|
|
||||||
default: 'normal',
|
|
||||||
validator(value) {
|
|
||||||
// The value must match one of these strings
|
|
||||||
return ['normal', '', 'tight'].includes(value);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
|
const gapClass = computed(() => {
|
||||||
|
if (props.gap === 'tight') {
|
||||||
|
return 'ltr:[&:not(:first-child)]:-ml-2 rtl:[&:not(:first-child)]:-mr-2';
|
||||||
|
}
|
||||||
|
return 'ltr:[&:not(:first-child)]:-ml-1 rtl:[&:not(:first-child)]:-mr-1';
|
||||||
|
});
|
||||||
|
|
||||||
|
const moreThumbnailsClass = computed(() => {
|
||||||
|
if (props.gap === 'tight') {
|
||||||
|
return 'ltr:-ml-2 rtl:-mr-2';
|
||||||
|
}
|
||||||
|
return 'ltr:-ml-1 rtl:-mr-1';
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="overlapping-thumbnails">
|
<div class="flex">
|
||||||
<Thumbnail
|
<Avatar
|
||||||
v-for="user in usersList"
|
v-for="user in usersList"
|
||||||
:key="user.id"
|
:key="user.id"
|
||||||
v-tooltip="user.name"
|
v-tooltip="user.name"
|
||||||
:title="user.name"
|
:title="user.name"
|
||||||
:src="user.thumbnail"
|
:src="user.thumbnail"
|
||||||
:username="user.name"
|
:name="user.name"
|
||||||
has-border
|
|
||||||
:size="size"
|
:size="size"
|
||||||
:class="`overlapping-thumbnail gap-${gap}`"
|
class="[&>span]:outline [&>span]:outline-1 [&>span]:outline-n-background [&>span]:shadow"
|
||||||
|
:class="gapClass"
|
||||||
|
rounded-full
|
||||||
/>
|
/>
|
||||||
<span v-if="showMoreThumbnailsCount" class="thumbnail-more-text">
|
<span
|
||||||
|
v-if="showMoreThumbnailsCount"
|
||||||
|
class="text-n-slate-11 bg-n-slate-4 outline outline-1 outline-n-background text-xs font-medium rounded-full px-2 inline-flex items-center shadow relative"
|
||||||
|
:class="moreThumbnailsClass"
|
||||||
|
>
|
||||||
{{ moreThumbnailsText }}
|
{{ moreThumbnailsText }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.overlapping-thumbnails {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overlapping-thumbnail {
|
|
||||||
position: relative;
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
||||||
|
|
||||||
&:not(:first-child) {
|
|
||||||
margin-left: -0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gap-tight {
|
|
||||||
margin-left: -0.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.thumbnail-more-text {
|
|
||||||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
||||||
@apply text-n-slate-11 bg-n-slate-4 border border-n-weak text-xs font-medium rounded-full px-2 ltr:-ml-2 rtl:-mr-2 inline-flex items-center relative;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
user: {
|
user: {
|
||||||
@@ -7,8 +7,8 @@ defineProps({
|
|||||||
default: () => ({}),
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: Number,
|
||||||
default: '20px',
|
default: 20,
|
||||||
},
|
},
|
||||||
textClass: {
|
textClass: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -19,11 +19,13 @@ defineProps({
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="flex items-center gap-1.5 text-left">
|
<div class="flex items-center gap-1.5 text-left">
|
||||||
<Thumbnail
|
<Avatar
|
||||||
:src="user.thumbnail"
|
:src="user.thumbnail"
|
||||||
:size="size"
|
:size="size"
|
||||||
:username="user.name"
|
:name="user.name"
|
||||||
:status="user.availability_status"
|
:status="user.availability_status"
|
||||||
|
hide-offline-status
|
||||||
|
rounded-full
|
||||||
/>
|
/>
|
||||||
<span class="my-0 truncate text-capitalize" :class="textClass">
|
<span class="my-0 truncate text-capitalize" :class="textClass">
|
||||||
{{ user.name }}
|
{{ user.name }}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<script>
|
<script setup>
|
||||||
import { mapGetters } from 'vuex';
|
import { computed, ref } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { useStore, useMapGetter } from 'dashboard/composables/store';
|
||||||
import { getLastMessage } from 'dashboard/helper/conversationHelper';
|
import { getLastMessage } from 'dashboard/helper/conversationHelper';
|
||||||
import Thumbnail from '../Thumbnail.vue';
|
import { frontendURL, conversationUrl } from 'dashboard/helper/URLHelper';
|
||||||
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
import MessagePreview from './MessagePreview.vue';
|
import MessagePreview from './MessagePreview.vue';
|
||||||
import router from '../../../routes';
|
|
||||||
import { frontendURL, conversationUrl } from '../../../helper/URLHelper';
|
|
||||||
import InboxName from '../InboxName.vue';
|
import InboxName from '../InboxName.vue';
|
||||||
import inboxMixin from 'shared/mixins/inboxMixin';
|
|
||||||
import ConversationContextMenu from './contextMenu/Index.vue';
|
import ConversationContextMenu from './contextMenu/Index.vue';
|
||||||
import TimeAgo from 'dashboard/components/ui/TimeAgo.vue';
|
import TimeAgo from 'dashboard/components/ui/TimeAgo.vue';
|
||||||
import CardLabels from './conversationCardComponents/CardLabels.vue';
|
import CardLabels from './conversationCardComponents/CardLabels.vue';
|
||||||
@@ -14,257 +14,227 @@ import PriorityMark from './PriorityMark.vue';
|
|||||||
import SLACardLabel from './components/SLACardLabel.vue';
|
import SLACardLabel from './components/SLACardLabel.vue';
|
||||||
import ContextMenu from 'dashboard/components/ui/ContextMenu.vue';
|
import ContextMenu from 'dashboard/components/ui/ContextMenu.vue';
|
||||||
|
|
||||||
export default {
|
const props = defineProps({
|
||||||
components: {
|
activeLabel: { type: String, default: '' },
|
||||||
CardLabels,
|
chat: { type: Object, default: () => ({}) },
|
||||||
InboxName,
|
hideInboxName: { type: Boolean, default: false },
|
||||||
Thumbnail,
|
hideThumbnail: { type: Boolean, default: false },
|
||||||
ConversationContextMenu,
|
teamId: { type: [String, Number], default: 0 },
|
||||||
TimeAgo,
|
foldersId: { type: [String, Number], default: 0 },
|
||||||
MessagePreview,
|
showAssignee: { type: Boolean, default: false },
|
||||||
PriorityMark,
|
conversationType: { type: String, default: '' },
|
||||||
SLACardLabel,
|
selected: { type: Boolean, default: false },
|
||||||
ContextMenu,
|
compact: { type: Boolean, default: false },
|
||||||
},
|
enableContextMenu: { type: Boolean, default: false },
|
||||||
mixins: [inboxMixin],
|
allowedContextMenuOptions: { type: Array, default: () => [] },
|
||||||
props: {
|
});
|
||||||
activeLabel: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
chat: {
|
|
||||||
type: Object,
|
|
||||||
default: () => {},
|
|
||||||
},
|
|
||||||
hideInboxName: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
hideThumbnail: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
teamId: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
foldersId: {
|
|
||||||
type: [String, Number],
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
showAssignee: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
conversationType: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
selected: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
enableContextMenu: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
allowedContextMenuOptions: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emits: [
|
|
||||||
'contextMenuToggle',
|
|
||||||
'assignAgent',
|
|
||||||
'assignLabel',
|
|
||||||
'assignTeam',
|
|
||||||
'markAsUnread',
|
|
||||||
'markAsRead',
|
|
||||||
'assignPriority',
|
|
||||||
'updateConversationStatus',
|
|
||||||
'deleteConversation',
|
|
||||||
],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hovered: false,
|
|
||||||
showContextMenu: false,
|
|
||||||
contextMenu: {
|
|
||||||
x: null,
|
|
||||||
y: null,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
...mapGetters({
|
|
||||||
currentChat: 'getSelectedChat',
|
|
||||||
inboxesList: 'inboxes/getInboxes',
|
|
||||||
activeInbox: 'getSelectedInbox',
|
|
||||||
accountId: 'getCurrentAccountId',
|
|
||||||
}),
|
|
||||||
chatMetadata() {
|
|
||||||
return this.chat.meta || {};
|
|
||||||
},
|
|
||||||
|
|
||||||
assignee() {
|
const emit = defineEmits([
|
||||||
return this.chatMetadata.assignee || {};
|
'contextMenuToggle',
|
||||||
},
|
'assignAgent',
|
||||||
|
'assignLabel',
|
||||||
|
'assignTeam',
|
||||||
|
'markAsUnread',
|
||||||
|
'markAsRead',
|
||||||
|
'assignPriority',
|
||||||
|
'updateConversationStatus',
|
||||||
|
'deleteConversation',
|
||||||
|
'selectConversation',
|
||||||
|
'deSelectConversation',
|
||||||
|
]);
|
||||||
|
|
||||||
currentContact() {
|
const router = useRouter();
|
||||||
return this.$store.getters['contacts/getContact'](
|
const store = useStore();
|
||||||
this.chatMetadata.sender.id
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
isActiveChat() {
|
const hovered = ref(false);
|
||||||
return this.currentChat.id === this.chat.id;
|
const showContextMenu = ref(false);
|
||||||
},
|
const contextMenu = ref({
|
||||||
|
x: null,
|
||||||
|
y: null,
|
||||||
|
});
|
||||||
|
|
||||||
unreadCount() {
|
const currentChat = useMapGetter('getSelectedChat');
|
||||||
return this.chat.unread_count;
|
const inboxesList = useMapGetter('inboxes/getInboxes');
|
||||||
},
|
const activeInbox = useMapGetter('getSelectedInbox');
|
||||||
|
const accountId = useMapGetter('getCurrentAccountId');
|
||||||
|
|
||||||
hasUnread() {
|
const chatMetadata = computed(() => props.chat.meta || {});
|
||||||
return this.unreadCount > 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
isInboxNameVisible() {
|
const assignee = computed(() => chatMetadata.value.assignee || {});
|
||||||
return !this.activeInbox;
|
|
||||||
},
|
|
||||||
|
|
||||||
lastMessageInChat() {
|
const senderId = computed(() => chatMetadata.value.sender?.id);
|
||||||
return getLastMessage(this.chat);
|
|
||||||
},
|
|
||||||
|
|
||||||
inbox() {
|
const currentContact = computed(() => {
|
||||||
const { inbox_id: inboxId } = this.chat;
|
return senderId.value
|
||||||
const stateInbox = this.$store.getters['inboxes/getInbox'](inboxId);
|
? store.getters['contacts/getContact'](senderId.value)
|
||||||
return stateInbox;
|
: {};
|
||||||
},
|
});
|
||||||
|
|
||||||
showInboxName() {
|
const isActiveChat = computed(() => {
|
||||||
return (
|
return currentChat.value.id === props.chat.id;
|
||||||
!this.hideInboxName &&
|
});
|
||||||
this.isInboxNameVisible &&
|
|
||||||
this.inboxesList.length > 1
|
|
||||||
);
|
|
||||||
},
|
|
||||||
inboxName() {
|
|
||||||
const stateInbox = this.inbox;
|
|
||||||
return stateInbox.name || '';
|
|
||||||
},
|
|
||||||
hasSlaPolicyId() {
|
|
||||||
return this.chat?.sla_policy_id;
|
|
||||||
},
|
|
||||||
conversationPath() {
|
|
||||||
const { activeInbox, chat } = this;
|
|
||||||
return frontendURL(
|
|
||||||
conversationUrl({
|
|
||||||
accountId: this.accountId,
|
|
||||||
activeInbox,
|
|
||||||
id: chat.id,
|
|
||||||
label: this.activeLabel,
|
|
||||||
teamId: this.teamId,
|
|
||||||
foldersId: this.foldersId,
|
|
||||||
conversationType: this.conversationType,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onCardClick(e) {
|
|
||||||
const path = this.conversationPath;
|
|
||||||
if (!path) return;
|
|
||||||
|
|
||||||
// Handle Ctrl/Cmd + Click for new tab
|
const unreadCount = computed(() => props.chat.unread_count);
|
||||||
if (e.metaKey || e.ctrlKey) {
|
|
||||||
e.preventDefault();
|
|
||||||
window.open(
|
|
||||||
`${window.chatwootConfig.hostURL}${path}`,
|
|
||||||
'_blank',
|
|
||||||
'noopener,noreferrer'
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip if already active
|
const hasUnread = computed(() => unreadCount.value > 0);
|
||||||
if (this.isActiveChat) return;
|
|
||||||
|
|
||||||
router.push({ path });
|
const isInboxNameVisible = computed(() => !activeInbox.value);
|
||||||
},
|
|
||||||
onThumbnailHover() {
|
const lastMessageInChat = computed(() => getLastMessage(props.chat));
|
||||||
this.hovered = !this.hideThumbnail;
|
|
||||||
},
|
const inboxId = computed(() => props.chat.inbox_id);
|
||||||
onThumbnailLeave() {
|
|
||||||
this.hovered = false;
|
const inbox = computed(() => {
|
||||||
},
|
return inboxId.value ? store.getters['inboxes/getInbox'](inboxId.value) : {};
|
||||||
onSelectConversation(checked) {
|
});
|
||||||
const action = checked ? 'selectConversation' : 'deSelectConversation';
|
|
||||||
this.$emit(action, this.chat.id, this.inbox.id);
|
const showInboxName = computed(() => {
|
||||||
},
|
return (
|
||||||
openContextMenu(e) {
|
!props.hideInboxName &&
|
||||||
if (!this.enableContextMenu) return;
|
isInboxNameVisible.value &&
|
||||||
e.preventDefault();
|
inboxesList.value.length > 1
|
||||||
this.$emit('contextMenuToggle', true);
|
);
|
||||||
this.contextMenu.x = e.pageX || e.clientX;
|
});
|
||||||
this.contextMenu.y = e.pageY || e.clientY;
|
|
||||||
this.showContextMenu = true;
|
const showMetaSection = computed(() => {
|
||||||
},
|
return (
|
||||||
closeContextMenu() {
|
showInboxName.value ||
|
||||||
this.$emit('contextMenuToggle', false);
|
(props.showAssignee && assignee.value.name) ||
|
||||||
this.showContextMenu = false;
|
props.chat.priority
|
||||||
this.contextMenu.x = null;
|
);
|
||||||
this.contextMenu.y = null;
|
});
|
||||||
},
|
|
||||||
onUpdateConversation(status, snoozedUntil) {
|
const hasSlaPolicyId = computed(() => props.chat?.sla_policy_id);
|
||||||
this.closeContextMenu();
|
|
||||||
this.$emit(
|
const showLabelsSection = computed(() => {
|
||||||
'updateConversationStatus',
|
return props.chat.labels?.length > 0 || hasSlaPolicyId.value;
|
||||||
this.chat.id,
|
});
|
||||||
status,
|
|
||||||
snoozedUntil
|
const messagePreviewClass = computed(() => {
|
||||||
);
|
return [
|
||||||
},
|
hasUnread.value ? 'font-medium text-n-slate-12' : 'text-n-slate-11',
|
||||||
async onAssignAgent(agent) {
|
!props.compact && hasUnread.value ? 'ltr:pr-4 rtl:pl-4' : '',
|
||||||
this.$emit('assignAgent', agent, [this.chat.id]);
|
props.compact && hasUnread.value ? 'ltr:pr-6 rtl:pl-6' : '',
|
||||||
this.closeContextMenu();
|
];
|
||||||
},
|
});
|
||||||
async onAssignLabel(label) {
|
|
||||||
this.$emit('assignLabel', [label.title], [this.chat.id]);
|
const conversationPath = computed(() => {
|
||||||
this.closeContextMenu();
|
return frontendURL(
|
||||||
},
|
conversationUrl({
|
||||||
async onAssignTeam(team) {
|
accountId: accountId.value,
|
||||||
this.$emit('assignTeam', team, this.chat.id);
|
activeInbox: activeInbox.value,
|
||||||
this.closeContextMenu();
|
id: props.chat.id,
|
||||||
},
|
label: props.activeLabel,
|
||||||
async markAsUnread() {
|
teamId: props.teamId,
|
||||||
this.$emit('markAsUnread', this.chat.id);
|
conversationType: props.conversationType,
|
||||||
this.closeContextMenu();
|
foldersId: props.foldersId,
|
||||||
},
|
})
|
||||||
async markAsRead() {
|
);
|
||||||
this.$emit('markAsRead', this.chat.id);
|
});
|
||||||
this.closeContextMenu();
|
|
||||||
},
|
const onCardClick = e => {
|
||||||
async assignPriority(priority) {
|
const path = conversationPath.value;
|
||||||
this.$emit('assignPriority', priority, this.chat.id);
|
if (!path) return;
|
||||||
this.closeContextMenu();
|
|
||||||
},
|
// Handle Ctrl/Cmd + Click for new tab
|
||||||
async deleteConversation() {
|
if (e.metaKey || e.ctrlKey) {
|
||||||
this.$emit('deleteConversation', this.chat.id);
|
e.preventDefault();
|
||||||
this.closeContextMenu();
|
window.open(
|
||||||
},
|
`${window.chatwootConfig.hostURL}${path}`,
|
||||||
},
|
'_blank',
|
||||||
|
'noopener,noreferrer'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip if already active
|
||||||
|
if (isActiveChat.value) return;
|
||||||
|
|
||||||
|
router.push({ path });
|
||||||
|
};
|
||||||
|
|
||||||
|
const onThumbnailHover = () => {
|
||||||
|
hovered.value = !props.hideThumbnail;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onThumbnailLeave = () => {
|
||||||
|
hovered.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onSelectConversation = checked => {
|
||||||
|
if (checked) {
|
||||||
|
emit('selectConversation', props.chat.id, inbox.value.id);
|
||||||
|
} else {
|
||||||
|
emit('deSelectConversation', props.chat.id, inbox.value.id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const openContextMenu = e => {
|
||||||
|
if (!props.enableContextMenu) return;
|
||||||
|
e.preventDefault();
|
||||||
|
emit('contextMenuToggle', true);
|
||||||
|
contextMenu.value.x = e.pageX || e.clientX;
|
||||||
|
contextMenu.value.y = e.pageY || e.clientY;
|
||||||
|
showContextMenu.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeContextMenu = () => {
|
||||||
|
emit('contextMenuToggle', false);
|
||||||
|
showContextMenu.value = false;
|
||||||
|
contextMenu.value.x = null;
|
||||||
|
contextMenu.value.y = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onUpdateConversation = (status, snoozedUntil) => {
|
||||||
|
closeContextMenu();
|
||||||
|
emit('updateConversationStatus', props.chat.id, status, snoozedUntil);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAssignAgent = agent => {
|
||||||
|
emit('assignAgent', agent, [props.chat.id]);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAssignLabel = label => {
|
||||||
|
emit('assignLabel', [label.title], [props.chat.id]);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAssignTeam = team => {
|
||||||
|
emit('assignTeam', team, props.chat.id);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const markAsUnread = () => {
|
||||||
|
emit('markAsUnread', props.chat.id);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const markAsRead = () => {
|
||||||
|
emit('markAsRead', props.chat.id);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const assignPriority = priority => {
|
||||||
|
emit('assignPriority', priority, props.chat.id);
|
||||||
|
closeContextMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteConversation = () => {
|
||||||
|
emit('deleteConversation', props.chat.id);
|
||||||
|
closeContextMenu();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="relative flex items-start flex-grow-0 flex-shrink-0 w-auto max-w-full px-3 py-0 border-t-0 border-b-0 border-l-2 border-r-0 border-transparent border-solid cursor-pointer conversation hover:bg-n-alpha-1 dark:hover:bg-n-alpha-3 group"
|
class="relative flex items-start flex-grow-0 flex-shrink-0 w-auto max-w-full py-0 border-t-0 border-b-0 border-l-0 border-r-0 border-transparent border-solid cursor-pointer conversation hover:bg-n-alpha-1 dark:hover:bg-n-alpha-3 group"
|
||||||
:class="{
|
:class="{
|
||||||
'active animate-card-select bg-n-alpha-1 dark:bg-n-alpha-3 border-n-weak':
|
'active animate-card-select bg-n-alpha-1 dark:bg-n-alpha-3 border-n-weak':
|
||||||
isActiveChat,
|
isActiveChat,
|
||||||
'unread-chat': hasUnread,
|
'bg-n-slate-2 dark:bg-n-slate-3': selected,
|
||||||
'has-inbox-name': showInboxName,
|
'px-0': compact,
|
||||||
'conversation-selected': selected,
|
'px-3': !compact,
|
||||||
}"
|
}"
|
||||||
@click="onCardClick"
|
@click="onCardClick"
|
||||||
@contextmenu="openContextMenu($event)"
|
@contextmenu="openContextMenu($event)"
|
||||||
@@ -274,46 +244,65 @@ export default {
|
|||||||
@mouseenter="onThumbnailHover"
|
@mouseenter="onThumbnailHover"
|
||||||
@mouseleave="onThumbnailLeave"
|
@mouseleave="onThumbnailLeave"
|
||||||
>
|
>
|
||||||
<label
|
<Avatar
|
||||||
v-if="hovered || selected"
|
|
||||||
class="checkbox-wrapper absolute inset-0 z-20 backdrop-blur-[2px]"
|
|
||||||
@click.stop
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
:value="selected"
|
|
||||||
:checked="selected"
|
|
||||||
class="checkbox"
|
|
||||||
type="checkbox"
|
|
||||||
@change="onSelectConversation($event.target.checked)"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<Thumbnail
|
|
||||||
v-if="!hideThumbnail"
|
v-if="!hideThumbnail"
|
||||||
|
:name="currentContact.name"
|
||||||
:src="currentContact.thumbnail"
|
:src="currentContact.thumbnail"
|
||||||
:badge="inboxBadge"
|
:size="32"
|
||||||
:username="currentContact.name"
|
|
||||||
:status="currentContact.availability_status"
|
:status="currentContact.availability_status"
|
||||||
size="32px"
|
:inbox="inbox"
|
||||||
/>
|
:class="!showInboxName ? 'mt-4' : 'mt-8'"
|
||||||
|
hide-offline-status
|
||||||
|
rounded-full
|
||||||
|
>
|
||||||
|
<template #overlay="{ size }">
|
||||||
|
<label
|
||||||
|
v-if="hovered || selected"
|
||||||
|
class="flex items-center justify-center rounded-full cursor-pointer absolute inset-0 z-10 backdrop-blur-[2px]"
|
||||||
|
:style="{ width: `${size}px`, height: `${size}px` }"
|
||||||
|
@click.stop
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
:value="selected"
|
||||||
|
:checked="selected"
|
||||||
|
class="!m-0 cursor-pointer"
|
||||||
|
type="checkbox"
|
||||||
|
@change="onSelectConversation($event.target.checked)"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</template>
|
||||||
|
</Avatar>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="px-0 py-3 border-b group-hover:border-transparent flex-1 border-n-slate-3 w-[calc(100%-40px)]"
|
class="px-0 py-3 border-b group-hover:border-transparent flex-1 border-n-slate-3 min-w-0"
|
||||||
>
|
>
|
||||||
<div class="flex justify-between conversation-card--meta">
|
<div
|
||||||
<InboxName v-if="showInboxName" :inbox="inbox" />
|
v-if="showMetaSection"
|
||||||
<div class="flex gap-2 ml-2 rtl:mr-2 rtl:ml-0">
|
class="flex items-center min-w-0 gap-1"
|
||||||
|
:class="{
|
||||||
|
'ltr:ml-2 rtl:mr-2': !compact,
|
||||||
|
'mx-2': compact,
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<InboxName v-if="showInboxName" :inbox="inbox" class="flex-1 min-w-0" />
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-2 flex-shrink-0"
|
||||||
|
:class="{
|
||||||
|
'flex-1 justify-between': !showInboxName,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
v-if="showAssignee && assignee.name"
|
v-if="showAssignee && assignee.name"
|
||||||
class="text-n-slate-11 text-xs font-medium leading-3 py-0.5 px-0 inline-flex text-ellipsis overflow-hidden whitespace-nowrap"
|
class="text-n-slate-11 text-xs font-medium leading-3 py-0.5 px-0 inline-flex items-center truncate"
|
||||||
>
|
>
|
||||||
<fluent-icon icon="person" size="12" class="text-n-slate-11" />
|
<fluent-icon icon="person" size="12" class="text-n-slate-11" />
|
||||||
{{ assignee.name }}
|
{{ assignee.name }}
|
||||||
</span>
|
</span>
|
||||||
<PriorityMark :priority="chat.priority" />
|
<PriorityMark :priority="chat.priority" class="flex-shrink-0" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4
|
<h4
|
||||||
class="conversation--user text-sm my-0 mx-2 capitalize pt-0.5 text-ellipsis overflow-hidden whitespace-nowrap w-[calc(100%-70px)] text-n-slate-12"
|
class="conversation--user text-sm my-0 mx-2 capitalize pt-0.5 text-ellipsis overflow-hidden whitespace-nowrap flex-1 min-w-0 ltr:pr-16 rtl:pl-16 text-n-slate-12"
|
||||||
:class="hasUnread ? 'font-semibold' : 'font-medium'"
|
:class="hasUnread ? 'font-semibold' : 'font-medium'"
|
||||||
>
|
>
|
||||||
{{ currentContact.name }}
|
{{ currentContact.name }}
|
||||||
@@ -321,24 +310,27 @@ export default {
|
|||||||
<MessagePreview
|
<MessagePreview
|
||||||
v-if="lastMessageInChat"
|
v-if="lastMessageInChat"
|
||||||
:message="lastMessageInChat"
|
:message="lastMessageInChat"
|
||||||
class="conversation--message my-0 mx-2 leading-6 h-6 max-w-[96%] w-[16.875rem] text-sm"
|
class="my-0 mx-2 leading-6 h-6 flex-1 min-w-0 text-sm"
|
||||||
:class="hasUnread ? 'font-medium text-n-slate-12' : 'text-n-slate-11'"
|
:class="messagePreviewClass"
|
||||||
/>
|
/>
|
||||||
<p
|
<p
|
||||||
v-else
|
v-else
|
||||||
class="conversation--message text-n-slate-11 text-sm my-0 mx-2 leading-6 h-6 max-w-[96%] w-[16.875rem] overflow-hidden text-ellipsis whitespace-nowrap"
|
class="text-n-slate-11 text-sm my-0 mx-2 leading-6 h-6 flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
:class="hasUnread ? 'font-medium text-n-slate-12' : 'text-n-slate-11'"
|
:class="messagePreviewClass"
|
||||||
>
|
>
|
||||||
<fluent-icon
|
<fluent-icon
|
||||||
size="16"
|
size="16"
|
||||||
class="-mt-0.5 align-middle inline-block text-n-slate-10"
|
class="-mt-0.5 align-middle inline-block text-n-slate-10"
|
||||||
icon="info"
|
icon="info"
|
||||||
/>
|
/>
|
||||||
<span>
|
<span class="mx-0.5">
|
||||||
{{ $t(`CHAT_LIST.NO_MESSAGES`) }}
|
{{ $t(`CHAT_LIST.NO_MESSAGES`) }}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<div class="absolute flex flex-col mt-4 ltr:right-4 rtl:left-4 top-4">
|
<div
|
||||||
|
class="absolute flex flex-col ltr:right-3 rtl:left-3"
|
||||||
|
:class="showMetaSection ? 'top-8' : 'top-4'"
|
||||||
|
>
|
||||||
<span class="ml-auto font-normal leading-4 text-xxs">
|
<span class="ml-auto font-normal leading-4 text-xxs">
|
||||||
<TimeAgo
|
<TimeAgo
|
||||||
:last-activity-timestamp="chat.timestamp"
|
:last-activity-timestamp="chat.timestamp"
|
||||||
@@ -346,12 +338,17 @@ export default {
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
class="unread shadow-lg rounded-full hidden text-xxs font-semibold h-4 leading-4 ltr:ml-auto rtl:mr-auto mt-1 min-w-[1rem] px-1 py-0 text-center text-white bg-n-teal-9"
|
class="shadow-lg rounded-full text-xxs font-semibold h-4 leading-4 ltr:ml-auto rtl:mr-auto mt-1 min-w-[1rem] px-1 py-0 text-center text-white bg-n-teal-9"
|
||||||
|
:class="hasUnread ? 'block' : 'hidden'"
|
||||||
>
|
>
|
||||||
{{ unreadCount > 9 ? '9+' : unreadCount }}
|
{{ unreadCount > 9 ? '9+' : unreadCount }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<CardLabels :conversation-labels="chat.labels" class="mt-0.5 mx-2 mb-0">
|
<CardLabels
|
||||||
|
v-if="showLabelsSection"
|
||||||
|
:conversation-labels="chat.labels"
|
||||||
|
class="mt-0.5 mx-2 mb-0"
|
||||||
|
>
|
||||||
<template v-if="hasSlaPolicyId" #before>
|
<template v-if="hasSlaPolicyId" #before>
|
||||||
<SLACardLabel :chat="chat" class="ltr:mr-1 rtl:ml-1" />
|
<SLACardLabel :chat="chat" class="ltr:mr-1 rtl:ml-1" />
|
||||||
</template>
|
</template>
|
||||||
@@ -384,55 +381,3 @@ export default {
|
|||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.conversation {
|
|
||||||
&.unread-chat {
|
|
||||||
.unread {
|
|
||||||
@apply block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.compact {
|
|
||||||
@apply pl-0;
|
|
||||||
|
|
||||||
.conversation-card--meta {
|
|
||||||
@apply ltr:pr-4 rtl:pl-4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.conversation--details {
|
|
||||||
@apply rounded-sm ml-0 pl-5 pr-2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&::v-deep .user-thumbnail-box {
|
|
||||||
@apply mt-4;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.conversation-selected {
|
|
||||||
@apply bg-n-slate-2 dark:bg-n-slate-3;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.has-inbox-name {
|
|
||||||
&::v-deep .user-thumbnail-box {
|
|
||||||
@apply mt-8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper {
|
|
||||||
@apply mt-8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.conversation--meta {
|
|
||||||
@apply mt-4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-wrapper {
|
|
||||||
@apply flex items-center justify-center rounded-full cursor-pointer mt-4;
|
|
||||||
|
|
||||||
input[type='checkbox'] {
|
|
||||||
@apply m-0 cursor-pointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useElementSize } from '@vueuse/core';
|
|||||||
import BackButton from '../BackButton.vue';
|
import BackButton from '../BackButton.vue';
|
||||||
import InboxName from '../InboxName.vue';
|
import InboxName from '../InboxName.vue';
|
||||||
import MoreActions from './MoreActions.vue';
|
import MoreActions from './MoreActions.vue';
|
||||||
import Thumbnail from '../Thumbnail.vue';
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
import SLACardLabel from './components/SLACardLabel.vue';
|
import SLACardLabel from './components/SLACardLabel.vue';
|
||||||
import wootConstants from 'dashboard/constants/globals';
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
import { conversationListPageURL } from 'dashboard/helper/URLHelper';
|
import { conversationListPageURL } from 'dashboard/helper/URLHelper';
|
||||||
@@ -105,12 +105,13 @@ const hasSlaPolicyId = computed(() => props.chat?.sla_policy_id);
|
|||||||
:back-url="backButtonUrl"
|
:back-url="backButtonUrl"
|
||||||
class="ltr:mr-2 rtl:ml-2"
|
class="ltr:mr-2 rtl:ml-2"
|
||||||
/>
|
/>
|
||||||
<Thumbnail
|
<Avatar
|
||||||
|
:name="currentContact.name"
|
||||||
:src="currentContact.thumbnail"
|
:src="currentContact.thumbnail"
|
||||||
:username="currentContact.name"
|
:size="32"
|
||||||
:status="currentContact.availability_status"
|
:status="currentContact.availability_status"
|
||||||
size="32px"
|
hide-offline-status
|
||||||
class="flex-shrink-0"
|
rounded-full
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col items-start min-w-0 ml-2 overflow-hidden rtl:ml-0 rtl:mr-2"
|
class="flex flex-col items-start min-w-0 ml-2 overflow-hidden rtl:ml-0 rtl:mr-2"
|
||||||
|
|||||||
+36
-143
@@ -1,4 +1,4 @@
|
|||||||
<script>
|
<script setup>
|
||||||
/**
|
/**
|
||||||
* This component handles parsing and sending WhatsApp message templates.
|
* This component handles parsing and sending WhatsApp message templates.
|
||||||
* It works as follows:
|
* It works as follows:
|
||||||
@@ -8,158 +8,51 @@
|
|||||||
* 4. Replaces placeholders with user-provided values.
|
* 4. Replaces placeholders with user-provided values.
|
||||||
* 5. Emits events to send the processed message or reset the template.
|
* 5. Emits events to send the processed message or reset the template.
|
||||||
*/
|
*/
|
||||||
import { ref, computed, onMounted } from 'vue';
|
import WhatsAppTemplateParser from 'dashboard/components-next/whatsapp/WhatsAppTemplateParser.vue';
|
||||||
import { useVuelidate } from '@vuelidate/core';
|
|
||||||
import { requiredIf } from '@vuelidate/validators';
|
|
||||||
|
|
||||||
import NextButton from 'dashboard/components-next/button/Button.vue';
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
||||||
|
|
||||||
export default {
|
defineProps({
|
||||||
components: {
|
template: {
|
||||||
NextButton,
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
},
|
},
|
||||||
props: {
|
});
|
||||||
template: {
|
|
||||||
type: Object,
|
|
||||||
default: () => ({}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emits: ['sendMessage', 'resetTemplate'],
|
|
||||||
setup(props, { emit }) {
|
|
||||||
const processVariable = str => {
|
|
||||||
return str.replace(/{{|}}/g, '');
|
|
||||||
};
|
|
||||||
|
|
||||||
const allKeysRequired = value => {
|
const emit = defineEmits(['sendMessage', 'resetTemplate']);
|
||||||
const keys = Object.keys(value);
|
|
||||||
return keys.every(key => value[key]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const processedParams = ref({});
|
const handleSendMessage = payload => {
|
||||||
|
emit('sendMessage', payload);
|
||||||
|
};
|
||||||
|
|
||||||
const templateString = computed(() => {
|
const handleResetTemplate = () => {
|
||||||
return props.template.components.find(
|
emit('resetTemplate');
|
||||||
component => component.type === 'BODY'
|
|
||||||
).text;
|
|
||||||
});
|
|
||||||
|
|
||||||
const variables = computed(() => {
|
|
||||||
return templateString.value.match(/{{([^}]+)}}/g);
|
|
||||||
});
|
|
||||||
|
|
||||||
const processedString = computed(() => {
|
|
||||||
return templateString.value.replace(/{{([^}]+)}}/g, (match, variable) => {
|
|
||||||
const variableKey = processVariable(variable);
|
|
||||||
return processedParams.value[variableKey] || `{{${variable}}}`;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const v$ = useVuelidate(
|
|
||||||
{
|
|
||||||
processedParams: {
|
|
||||||
requiredIfKeysPresent: requiredIf(variables),
|
|
||||||
allKeysRequired,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ processedParams }
|
|
||||||
);
|
|
||||||
|
|
||||||
const generateVariables = () => {
|
|
||||||
const matchedVariables = templateString.value.match(/{{([^}]+)}}/g);
|
|
||||||
if (!matchedVariables) return;
|
|
||||||
|
|
||||||
const finalVars = matchedVariables.map(i => processVariable(i));
|
|
||||||
processedParams.value = finalVars.reduce((acc, variable) => {
|
|
||||||
acc[variable] = '';
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetTemplate = () => {
|
|
||||||
emit('resetTemplate');
|
|
||||||
};
|
|
||||||
|
|
||||||
const sendMessage = () => {
|
|
||||||
v$.value.$touch();
|
|
||||||
if (v$.value.$invalid) return;
|
|
||||||
|
|
||||||
const payload = {
|
|
||||||
message: processedString.value,
|
|
||||||
templateParams: {
|
|
||||||
name: props.template.name,
|
|
||||||
category: props.template.category,
|
|
||||||
language: props.template.language,
|
|
||||||
namespace: props.template.namespace,
|
|
||||||
processed_params: processedParams.value,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
emit('sendMessage', payload);
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(generateVariables);
|
|
||||||
|
|
||||||
return {
|
|
||||||
processedParams,
|
|
||||||
variables,
|
|
||||||
templateString,
|
|
||||||
processedString,
|
|
||||||
v$,
|
|
||||||
resetTemplate,
|
|
||||||
sendMessage,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<textarea
|
<WhatsAppTemplateParser
|
||||||
v-model="processedString"
|
:template="template"
|
||||||
rows="4"
|
@send-message="handleSendMessage"
|
||||||
readonly
|
@reset-template="handleResetTemplate"
|
||||||
class="template-input"
|
>
|
||||||
/>
|
<template #actions="{ sendMessage, resetTemplate, disabled }">
|
||||||
<div v-if="variables" class="p-2.5">
|
<footer class="flex gap-2 justify-end">
|
||||||
<p class="text-sm font-semibold mb-2.5">
|
<NextButton
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PARSER.VARIABLES_LABEL') }}
|
faded
|
||||||
</p>
|
slate
|
||||||
<div
|
type="reset"
|
||||||
v-for="(variable, key) in processedParams"
|
:label="$t('WHATSAPP_TEMPLATES.PARSER.GO_BACK_LABEL')"
|
||||||
:key="key"
|
@click="resetTemplate"
|
||||||
class="items-center flex mb-2.5"
|
/>
|
||||||
>
|
<NextButton
|
||||||
<span
|
type="button"
|
||||||
class="bg-n-alpha-black2 text-n-slate-12 inline-block rounded-md text-xs py-2.5 px-6"
|
:label="$t('WHATSAPP_TEMPLATES.PARSER.SEND_MESSAGE_LABEL')"
|
||||||
>
|
:disabled="disabled"
|
||||||
{{ key }}
|
@click="sendMessage"
|
||||||
</span>
|
/>
|
||||||
<woot-input
|
</footer>
|
||||||
v-model="processedParams[key]"
|
</template>
|
||||||
type="text"
|
</WhatsAppTemplateParser>
|
||||||
class="flex-1 text-sm ml-2.5"
|
|
||||||
:styles="{ marginBottom: 0 }"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<p
|
|
||||||
v-if="v$.$dirty && v$.$invalid"
|
|
||||||
class="bg-n-ruby-9/20 rounded-md text-n-ruby-9 p-2.5 text-center"
|
|
||||||
>
|
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PARSER.FORM_ERROR_MESSAGE') }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<footer class="flex justify-end gap-2">
|
|
||||||
<NextButton
|
|
||||||
faded
|
|
||||||
slate
|
|
||||||
type="reset"
|
|
||||||
:label="$t('WHATSAPP_TEMPLATES.PARSER.GO_BACK_LABEL')"
|
|
||||||
@click="resetTemplate"
|
|
||||||
/>
|
|
||||||
<NextButton
|
|
||||||
type="button"
|
|
||||||
:label="$t('WHATSAPP_TEMPLATES.PARSER.SEND_MESSAGE_LABEL')"
|
|
||||||
@click="sendMessage"
|
|
||||||
/>
|
|
||||||
</footer>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+130
-67
@@ -1,60 +1,71 @@
|
|||||||
<script>
|
<script setup>
|
||||||
|
import { ref, computed, toRef } from 'vue';
|
||||||
import { useAlert } from 'dashboard/composables';
|
import { useAlert } from 'dashboard/composables';
|
||||||
|
import { useFunctionGetter, useStore } from 'dashboard/composables/store';
|
||||||
|
import {
|
||||||
|
COMPONENT_TYPES,
|
||||||
|
MEDIA_FORMATS,
|
||||||
|
findComponentByType,
|
||||||
|
} from 'dashboard/helper/templateHelper';
|
||||||
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
import Icon from 'dashboard/components-next/icon/Icon.vue';
|
||||||
// TODO: Remove this when we support all formats
|
import { useI18n } from 'vue-i18n';
|
||||||
const formatsToRemove = ['DOCUMENT', 'IMAGE', 'VIDEO'];
|
|
||||||
|
|
||||||
export default {
|
const props = defineProps({
|
||||||
components: {
|
inboxId: {
|
||||||
Icon,
|
type: Number,
|
||||||
},
|
default: undefined,
|
||||||
props: {
|
|
||||||
inboxId: {
|
|
||||||
type: Number,
|
|
||||||
default: undefined,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emits: ['onSelect'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
query: '',
|
|
||||||
isRefreshing: false,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
whatsAppTemplateMessages() {
|
|
||||||
// TODO: Remove the last filter when we support all formats
|
|
||||||
return this.$store.getters['inboxes/getWhatsAppTemplates'](this.inboxId)
|
|
||||||
.filter(template => template.status.toLowerCase() === 'approved')
|
|
||||||
.filter(template => {
|
|
||||||
return template.components.every(component => {
|
|
||||||
return !formatsToRemove.includes(component.format);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
filteredTemplateMessages() {
|
|
||||||
return this.whatsAppTemplateMessages.filter(template =>
|
|
||||||
template.name.toLowerCase().includes(this.query.toLowerCase())
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getTemplatebody(template) {
|
|
||||||
return template.components.find(component => component.type === 'BODY')
|
|
||||||
.text;
|
|
||||||
},
|
|
||||||
async refreshTemplates() {
|
|
||||||
this.isRefreshing = true;
|
|
||||||
try {
|
|
||||||
await this.$store.dispatch('inboxes/syncTemplates', this.inboxId);
|
|
||||||
useAlert(this.$t('WHATSAPP_TEMPLATES.PICKER.REFRESH_SUCCESS'));
|
|
||||||
} catch (error) {
|
|
||||||
useAlert(this.$t('WHATSAPP_TEMPLATES.PICKER.REFRESH_ERROR'));
|
|
||||||
} finally {
|
|
||||||
this.isRefreshing = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits(['onSelect']);
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const store = useStore();
|
||||||
|
const query = ref('');
|
||||||
|
const isRefreshing = ref(false);
|
||||||
|
|
||||||
|
const whatsAppTemplateMessages = useFunctionGetter(
|
||||||
|
'inboxes/getFilteredWhatsAppTemplates',
|
||||||
|
toRef(props, 'inboxId')
|
||||||
|
);
|
||||||
|
|
||||||
|
const filteredTemplateMessages = computed(() =>
|
||||||
|
whatsAppTemplateMessages.value.filter(template =>
|
||||||
|
template.name.toLowerCase().includes(query.value.toLowerCase())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const getTemplateBody = template => {
|
||||||
|
return findComponentByType(template, COMPONENT_TYPES.BODY)?.text || '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTemplateHeader = template => {
|
||||||
|
return findComponentByType(template, COMPONENT_TYPES.HEADER);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTemplateFooter = template => {
|
||||||
|
return findComponentByType(template, COMPONENT_TYPES.FOOTER);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getTemplateButtons = template => {
|
||||||
|
return findComponentByType(template, COMPONENT_TYPES.BUTTONS);
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasMediaContent = template => {
|
||||||
|
const header = getTemplateHeader(template);
|
||||||
|
return header && MEDIA_FORMATS.includes(header.format);
|
||||||
|
};
|
||||||
|
|
||||||
|
const refreshTemplates = async () => {
|
||||||
|
isRefreshing.value = true;
|
||||||
|
try {
|
||||||
|
await store.dispatch('inboxes/syncTemplates', props.inboxId);
|
||||||
|
useAlert(t('WHATSAPP_TEMPLATES.PICKER.REFRESH_SUCCESS'));
|
||||||
|
} catch (error) {
|
||||||
|
useAlert(t('WHATSAPP_TEMPLATES.PICKER.REFRESH_ERROR'));
|
||||||
|
} finally {
|
||||||
|
isRefreshing.value = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -68,14 +79,14 @@ export default {
|
|||||||
<input
|
<input
|
||||||
v-model="query"
|
v-model="query"
|
||||||
type="search"
|
type="search"
|
||||||
:placeholder="$t('WHATSAPP_TEMPLATES.PICKER.SEARCH_PLACEHOLDER')"
|
:placeholder="t('WHATSAPP_TEMPLATES.PICKER.SEARCH_PLACEHOLDER')"
|
||||||
class="reset-base w-full h-9 bg-transparent text-n-slate-12 !text-sm !outline-0"
|
class="reset-base w-full h-9 bg-transparent text-n-slate-12 !text-sm !outline-0"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
:disabled="isRefreshing"
|
:disabled="isRefreshing"
|
||||||
class="flex justify-center items-center w-9 h-9 rounded-lg bg-n-alpha-black2 outline outline-1 outline-n-weak hover:outline-n-slate-6 dark:hover:outline-n-slate-6 hover:bg-n-alpha-2 dark:hover:bg-n-solid-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
class="flex justify-center items-center w-9 h-9 rounded-lg bg-n-alpha-black2 outline outline-1 outline-n-weak hover:outline-n-slate-6 dark:hover:outline-n-slate-6 hover:bg-n-alpha-2 dark:hover:bg-n-solid-2 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
:title="$t('WHATSAPP_TEMPLATES.PICKER.REFRESH_BUTTON')"
|
:title="t('WHATSAPP_TEMPLATES.PICKER.REFRESH_BUTTON')"
|
||||||
@click="refreshTemplates"
|
@click="refreshTemplates"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -91,7 +102,7 @@ export default {
|
|||||||
<div v-for="(template, i) in filteredTemplateMessages" :key="template.id">
|
<div v-for="(template, i) in filteredTemplateMessages" :key="template.id">
|
||||||
<button
|
<button
|
||||||
class="block p-2.5 w-full text-left rounded-lg cursor-pointer hover:bg-n-alpha-2 dark:hover:bg-n-solid-2"
|
class="block p-2.5 w-full text-left rounded-lg cursor-pointer hover:bg-n-alpha-2 dark:hover:bg-n-solid-2"
|
||||||
@click="$emit('onSelect', template)"
|
@click="emit('onSelect', template)"
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between items-center mb-2.5">
|
<div class="flex justify-between items-center mb-2.5">
|
||||||
@@ -101,21 +112,73 @@ export default {
|
|||||||
<span
|
<span
|
||||||
class="inline-block px-2 py-1 text-xs leading-none rounded-lg cursor-default bg-n-slate-3 text-n-slate-12"
|
class="inline-block px-2 py-1 text-xs leading-none rounded-lg cursor-default bg-n-slate-3 text-n-slate-12"
|
||||||
>
|
>
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.LANGUAGE') }} :
|
{{ t('WHATSAPP_TEMPLATES.PICKER.LABELS.LANGUAGE') }}:
|
||||||
{{ template.language }}
|
{{ template.language }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<!-- Header -->
|
||||||
<p class="font-medium">
|
<div v-if="getTemplateHeader(template)" class="mb-3">
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.TEMPLATE_BODY') }}
|
<p class="text-xs font-medium text-n-slate-11">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PICKER.HEADER') || 'HEADER' }}
|
||||||
</p>
|
</p>
|
||||||
<p class="label-body">{{ getTemplatebody(template) }}</p>
|
<div
|
||||||
|
v-if="getTemplateHeader(template).format === 'TEXT'"
|
||||||
|
class="text-sm label-body"
|
||||||
|
>
|
||||||
|
{{ getTemplateHeader(template).text }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else-if="hasMediaContent(template)"
|
||||||
|
class="text-sm italic text-n-slate-11"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
t('WHATSAPP_TEMPLATES.PICKER.MEDIA_CONTENT', {
|
||||||
|
format: getTemplateHeader(template).format,
|
||||||
|
}) ||
|
||||||
|
`${getTemplateHeader(template).format} ${t('WHATSAPP_TEMPLATES.PICKER.MEDIA_CONTENT_FALLBACK')}`
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-5">
|
|
||||||
<p class="font-medium">
|
<!-- Body -->
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PICKER.LABELS.CATEGORY') }}
|
<div>
|
||||||
|
<p class="text-xs font-medium text-n-slate-11">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PICKER.BODY') || 'BODY' }}
|
||||||
</p>
|
</p>
|
||||||
<p>{{ template.category }}</p>
|
<p class="text-sm label-body">{{ getTemplateBody(template) }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<div v-if="getTemplateFooter(template)" class="mt-3">
|
||||||
|
<p class="text-xs font-medium text-n-slate-11">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PICKER.FOOTER') || 'FOOTER' }}
|
||||||
|
</p>
|
||||||
|
<p class="text-sm label-body">
|
||||||
|
{{ getTemplateFooter(template).text }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Buttons -->
|
||||||
|
<div v-if="getTemplateButtons(template)" class="mt-3">
|
||||||
|
<p class="text-xs font-medium text-n-slate-11">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PICKER.BUTTONS') || 'BUTTONS' }}
|
||||||
|
</p>
|
||||||
|
<div class="flex flex-wrap gap-1 mt-1">
|
||||||
|
<span
|
||||||
|
v-for="button in getTemplateButtons(template).buttons"
|
||||||
|
:key="button.text"
|
||||||
|
class="px-2 py-1 text-xs rounded bg-n-slate-3 text-n-slate-12"
|
||||||
|
>
|
||||||
|
{{ button.text }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<p class="text-xs font-medium text-n-slate-11">
|
||||||
|
{{ t('WHATSAPP_TEMPLATES.PICKER.CATEGORY') || 'CATEGORY' }}
|
||||||
|
</p>
|
||||||
|
<p class="text-sm">{{ template.category }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
@@ -128,13 +191,13 @@ export default {
|
|||||||
<div v-if="!filteredTemplateMessages.length" class="py-8 text-center">
|
<div v-if="!filteredTemplateMessages.length" class="py-8 text-center">
|
||||||
<div v-if="query && whatsAppTemplateMessages.length">
|
<div v-if="query && whatsAppTemplateMessages.length">
|
||||||
<p>
|
<p>
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PICKER.NO_TEMPLATES_FOUND') }}
|
{{ t('WHATSAPP_TEMPLATES.PICKER.NO_TEMPLATES_FOUND') }}
|
||||||
<strong>{{ query }}</strong>
|
<strong>{{ query }}</strong>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="!whatsAppTemplateMessages.length" class="space-y-4">
|
<div v-else-if="!whatsAppTemplateMessages.length" class="space-y-4">
|
||||||
<p class="text-n-slate-11">
|
<p class="text-n-slate-11">
|
||||||
{{ $t('WHATSAPP_TEMPLATES.PICKER.NO_TEMPLATES_AVAILABLE') }}
|
{{ t('WHATSAPP_TEMPLATES.PICKER.NO_TEMPLATES_AVAILABLE') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { messageTimestamp } from 'shared/helpers/timeHelper';
|
|||||||
import { downloadFile } from '@chatwoot/utils';
|
import { downloadFile } from '@chatwoot/utils';
|
||||||
|
|
||||||
import NextButton from 'dashboard/components-next/button/Button.vue';
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
||||||
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
import TeleportWithDirection from 'dashboard/components-next/TeleportWithDirection.vue';
|
import TeleportWithDirection from 'dashboard/components-next/TeleportWithDirection.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -186,10 +186,12 @@ onMounted(() => {
|
|||||||
v-if="senderDetails"
|
v-if="senderDetails"
|
||||||
class="flex items-center min-w-[15rem] shrink-0"
|
class="flex items-center min-w-[15rem] shrink-0"
|
||||||
>
|
>
|
||||||
<Thumbnail
|
<Avatar
|
||||||
v-if="senderDetails.avatar"
|
v-if="senderDetails.avatar"
|
||||||
:username="senderDetails.name"
|
:name="senderDetails.name"
|
||||||
:src="senderDetails.avatar"
|
:src="senderDetails.avatar"
|
||||||
|
:size="40"
|
||||||
|
rounded-full
|
||||||
class="flex-shrink-0"
|
class="flex-shrink-0"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-col ml-2 rtl:ml-0 rtl:mr-2 overflow-hidden">
|
<div class="flex flex-col ml-2 rtl:ml-0 rtl:mr-2 overflow-hidden">
|
||||||
|
|||||||
+6
-13
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
// components
|
// components
|
||||||
import NextButton from 'dashboard/components-next/button/Button.vue';
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
||||||
import Avatar from '../../Avatar.vue';
|
import Avatar from 'dashboard/components-next/avatar/Avatar.vue';
|
||||||
|
|
||||||
// composables
|
// composables
|
||||||
import { useAI } from 'dashboard/composables/useAI';
|
import { useAI } from 'dashboard/composables/useAI';
|
||||||
@@ -226,18 +226,16 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sender--info has-tooltip" data-original-title="null">
|
<div class="sender--info has-tooltip" data-original-title="null">
|
||||||
<woot-thumbnail
|
<Avatar
|
||||||
v-tooltip.top="{
|
v-tooltip.top="{
|
||||||
content: $t('LABEL_MGMT.SUGGESTIONS.POWERED_BY'),
|
content: $t('LABEL_MGMT.SUGGESTIONS.POWERED_BY'),
|
||||||
delay: { show: 600, hide: 0 },
|
delay: { show: 600, hide: 0 },
|
||||||
hideOnClick: true,
|
hideOnClick: true,
|
||||||
}"
|
}"
|
||||||
size="16px"
|
:size="16"
|
||||||
>
|
name="chatwoot-ai"
|
||||||
<Avatar class="user-thumbnail thumbnail-rounded">
|
icon-name="i-lucide-sparkles"
|
||||||
<fluent-icon class="chatwoot-ai-icon" icon="chatwoot-ai" />
|
/>
|
||||||
</Avatar>
|
|
||||||
</woot-thumbnail>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@@ -268,11 +266,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatwoot-ai-icon {
|
|
||||||
height: 0.75rem;
|
|
||||||
width: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-suggestion--title {
|
.label-suggestion--title {
|
||||||
@apply text-n-slate-11 mt-0.5 text-xxs;
|
@apply text-n-slate-11 mt-0.5 text-xxs;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-5
@@ -1,12 +1,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import Thumbnail from 'dashboard/components/widgets/Thumbnail.vue';
|
import Avatar from 'next/avatar/Avatar.vue';
|
||||||
import Spinner from 'shared/components/Spinner.vue';
|
import Spinner from 'shared/components/Spinner.vue';
|
||||||
import NextButton from 'dashboard/components-next/button/Button.vue';
|
import NextButton from 'dashboard/components-next/button/Button.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
Thumbnail,
|
Avatar,
|
||||||
Spinner,
|
Spinner,
|
||||||
NextButton,
|
NextButton,
|
||||||
},
|
},
|
||||||
@@ -123,11 +123,13 @@ export default {
|
|||||||
</li>
|
</li>
|
||||||
<li v-for="agent in filteredAgents" :key="agent.id">
|
<li v-for="agent in filteredAgents" :key="agent.id">
|
||||||
<div class="agent-list-item" @click="assignAgent(agent)">
|
<div class="agent-list-item" @click="assignAgent(agent)">
|
||||||
<Thumbnail
|
<Avatar
|
||||||
|
:name="agent.name"
|
||||||
:src="agent.thumbnail"
|
:src="agent.thumbnail"
|
||||||
:status="agent.availability_status"
|
:status="agent.availability_status"
|
||||||
:username="agent.name"
|
:size="22"
|
||||||
size="22px"
|
hide-offline-status
|
||||||
|
rounded-full
|
||||||
/>
|
/>
|
||||||
<span class="my-0 text-n-slate-12">
|
<span class="my-0 text-n-slate-12">
|
||||||
{{ agent.name }}
|
{{ agent.name }}
|
||||||
|
|||||||
+1
-1
@@ -263,7 +263,7 @@ export default {
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.bulk-action__container {
|
.bulk-action__container {
|
||||||
@apply p-4 relative border-b border-solid border-n-strong dark:border-n-weak;
|
@apply p-3 relative border-b border-solid border-n-strong dark:border-n-weak;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bulk-action__panel {
|
.bulk-action__panel {
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
<script>
|
|
||||||
import NextButton from 'dashboard/components-next/button/Button.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
NextButton,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
label: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
src: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
usernameAvatar: {
|
|
||||||
type: String,
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
deleteAvatar: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emits: ['onAvatarSelect', 'onAvatarDelete'],
|
|
||||||
watch: {},
|
|
||||||
methods: {
|
|
||||||
handleImageUpload(event) {
|
|
||||||
const [file] = event.target.files;
|
|
||||||
|
|
||||||
this.$emit('onAvatarSelect', {
|
|
||||||
file,
|
|
||||||
url: file ? URL.createObjectURL(file) : null,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onAvatarDelete() {
|
|
||||||
this.$refs.file.value = null;
|
|
||||||
this.$emit('onAvatarDelete');
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<label>
|
|
||||||
<span v-if="label">{{ label }}</span>
|
|
||||||
</label>
|
|
||||||
<woot-thumbnail
|
|
||||||
v-if="src"
|
|
||||||
size="80px"
|
|
||||||
:src="src"
|
|
||||||
:username="usernameAvatar"
|
|
||||||
/>
|
|
||||||
<div v-if="src && deleteAvatar" class="my-1">
|
|
||||||
<NextButton
|
|
||||||
outline
|
|
||||||
xs
|
|
||||||
ruby
|
|
||||||
:label="$t('INBOX_MGMT.DELETE.AVATAR_DELETE_BUTTON_TEXT')"
|
|
||||||
@click="onAvatarDelete"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<label>
|
|
||||||
<input
|
|
||||||
id="file"
|
|
||||||
ref="file"
|
|
||||||
type="file"
|
|
||||||
accept="image/png, image/jpeg, image/jpg, image/gif, image/webp"
|
|
||||||
@change="handleImageUpload"
|
|
||||||
/>
|
|
||||||
<slot />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -196,6 +196,7 @@ describe('useAutomation', () => {
|
|||||||
automationTypes.conversation_created = { conditions: [] };
|
automationTypes.conversation_created = { conditions: [] };
|
||||||
automationTypes.conversation_updated = { conditions: [] };
|
automationTypes.conversation_updated = { conditions: [] };
|
||||||
automationTypes.conversation_opened = { conditions: [] };
|
automationTypes.conversation_opened = { conditions: [] };
|
||||||
|
automationTypes.conversation_resolved = { conditions: [] };
|
||||||
|
|
||||||
automationHelper.generateCustomAttributeTypes.mockReturnValue([]);
|
automationHelper.generateCustomAttributeTypes.mockReturnValue([]);
|
||||||
automationHelper.generateCustomAttributes.mockReturnValue([]);
|
automationHelper.generateCustomAttributes.mockReturnValue([]);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const DEFAULT_MESSAGE_CREATED_CONDITION = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const DEFAULT_CONVERSATION_OPENED_CONDITION = [
|
export const DEFAULT_CONVERSATION_CONDITION = [
|
||||||
{
|
{
|
||||||
attribute_key: 'browser_language',
|
attribute_key: 'browser_language',
|
||||||
filter_operator: 'equal_to',
|
filter_operator: 'equal_to',
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from 'dashboard/routes/dashboard/settings/automation/operators';
|
} from 'dashboard/routes/dashboard/settings/automation/operators';
|
||||||
import {
|
import {
|
||||||
DEFAULT_MESSAGE_CREATED_CONDITION,
|
DEFAULT_MESSAGE_CREATED_CONDITION,
|
||||||
DEFAULT_CONVERSATION_OPENED_CONDITION,
|
DEFAULT_CONVERSATION_CONDITION,
|
||||||
DEFAULT_OTHER_CONDITION,
|
DEFAULT_OTHER_CONDITION,
|
||||||
DEFAULT_ACTIONS,
|
DEFAULT_ACTIONS,
|
||||||
} from 'dashboard/constants/automation';
|
} from 'dashboard/constants/automation';
|
||||||
@@ -169,8 +169,11 @@ export const getDefaultConditions = eventName => {
|
|||||||
if (eventName === 'message_created') {
|
if (eventName === 'message_created') {
|
||||||
return DEFAULT_MESSAGE_CREATED_CONDITION;
|
return DEFAULT_MESSAGE_CREATED_CONDITION;
|
||||||
}
|
}
|
||||||
if (eventName === 'conversation_opened') {
|
if (
|
||||||
return DEFAULT_CONVERSATION_OPENED_CONDITION;
|
eventName === 'conversation_opened' ||
|
||||||
|
eventName === 'conversation_resolved'
|
||||||
|
) {
|
||||||
|
return DEFAULT_CONVERSATION_CONDITION;
|
||||||
}
|
}
|
||||||
return DEFAULT_OTHER_CONDITION;
|
return DEFAULT_OTHER_CONDITION;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,14 +139,14 @@ export const getInboxClassByType = (type, phoneNumber) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getInboxIconByType = (type, phoneNumber, variant = 'fill') => {
|
export const getInboxIconByType = (type, medium, variant = 'fill') => {
|
||||||
const iconMap =
|
const iconMap =
|
||||||
variant === 'fill' ? INBOX_ICON_MAP_FILL : INBOX_ICON_MAP_LINE;
|
variant === 'fill' ? INBOX_ICON_MAP_FILL : INBOX_ICON_MAP_LINE;
|
||||||
const defaultIcon =
|
const defaultIcon =
|
||||||
variant === 'fill' ? DEFAULT_ICON_FILL : DEFAULT_ICON_LINE;
|
variant === 'fill' ? DEFAULT_ICON_FILL : DEFAULT_ICON_LINE;
|
||||||
|
|
||||||
// Special case for Twilio (whatsapp and sms)
|
// Special case for Twilio (whatsapp and sms)
|
||||||
if (type === INBOX_TYPES.TWILIO && phoneNumber?.startsWith('whatsapp')) {
|
if (type === INBOX_TYPES.TWILIO && medium === 'whatsapp') {
|
||||||
return iconMap[INBOX_TYPES.WHATSAPP];
|
return iconMap[INBOX_TYPES.WHATSAPP];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,13 +112,13 @@ describe('#Inbox Helpers', () => {
|
|||||||
describe('Twilio cases', () => {
|
describe('Twilio cases', () => {
|
||||||
describe('fill variant', () => {
|
describe('fill variant', () => {
|
||||||
it('returns WhatsApp icon for Twilio WhatsApp number', () => {
|
it('returns WhatsApp icon for Twilio WhatsApp number', () => {
|
||||||
expect(
|
expect(getInboxIconByType(INBOX_TYPES.TWILIO, 'whatsapp')).toBe(
|
||||||
getInboxIconByType(INBOX_TYPES.TWILIO, 'whatsapp:+1234567890')
|
'i-ri-whatsapp-fill'
|
||||||
).toBe('i-ri-whatsapp-fill');
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns SMS icon for regular Twilio number', () => {
|
it('returns SMS icon for regular Twilio number', () => {
|
||||||
expect(getInboxIconByType(INBOX_TYPES.TWILIO, '+1234567890')).toBe(
|
expect(getInboxIconByType(INBOX_TYPES.TWILIO, 'sms')).toBe(
|
||||||
'i-ri-chat-1-fill'
|
'i-ri-chat-1-fill'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -133,18 +133,14 @@ describe('#Inbox Helpers', () => {
|
|||||||
describe('line variant', () => {
|
describe('line variant', () => {
|
||||||
it('returns WhatsApp line icon for Twilio WhatsApp number', () => {
|
it('returns WhatsApp line icon for Twilio WhatsApp number', () => {
|
||||||
expect(
|
expect(
|
||||||
getInboxIconByType(
|
getInboxIconByType(INBOX_TYPES.TWILIO, 'whatsapp', 'line')
|
||||||
INBOX_TYPES.TWILIO,
|
|
||||||
'whatsapp:+1234567890',
|
|
||||||
'line'
|
|
||||||
)
|
|
||||||
).toBe('i-ri-whatsapp-line');
|
).toBe('i-ri-whatsapp-line');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns SMS line icon for regular Twilio number', () => {
|
it('returns SMS line icon for regular Twilio number', () => {
|
||||||
expect(
|
expect(getInboxIconByType(INBOX_TYPES.TWILIO, 'sms', 'line')).toBe(
|
||||||
getInboxIconByType(INBOX_TYPES.TWILIO, '+1234567890', 'line')
|
'i-ri-chat-1-line'
|
||||||
).toBe('i-ri-chat-1-line');
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,368 @@
|
|||||||
|
import {
|
||||||
|
replaceTemplateVariables,
|
||||||
|
buildTemplateParameters,
|
||||||
|
processVariable,
|
||||||
|
allKeysRequired,
|
||||||
|
} from '../templateHelper';
|
||||||
|
import { templates } from '../../store/modules/specs/inboxes/templateFixtures';
|
||||||
|
|
||||||
|
describe('templateHelper', () => {
|
||||||
|
const technicianTemplate = templates.find(t => t.name === 'technician_visit');
|
||||||
|
|
||||||
|
describe('processVariable', () => {
|
||||||
|
it('should remove curly braces from variables', () => {
|
||||||
|
expect(processVariable('{{name}}')).toBe('name');
|
||||||
|
expect(processVariable('{{1}}')).toBe('1');
|
||||||
|
expect(processVariable('{{customer_id}}')).toBe('customer_id');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('allKeysRequired', () => {
|
||||||
|
it('should return true when all keys have values', () => {
|
||||||
|
const obj = { name: 'John', age: '30' };
|
||||||
|
expect(allKeysRequired(obj)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when some keys are empty', () => {
|
||||||
|
const obj = { name: 'John', age: '' };
|
||||||
|
expect(allKeysRequired(obj)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return true for empty object', () => {
|
||||||
|
expect(allKeysRequired({})).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('replaceTemplateVariables', () => {
|
||||||
|
const templateText =
|
||||||
|
"Hi {{1}}, we're scheduling a technician visit to {{2}} on {{3}} between {{4}} and {{5}}. Please confirm if this time slot works for you.";
|
||||||
|
|
||||||
|
it('should replace all variables with provided values', () => {
|
||||||
|
const processedParams = {
|
||||||
|
body: {
|
||||||
|
1: 'John',
|
||||||
|
2: '123 Main St',
|
||||||
|
3: '2025-01-15',
|
||||||
|
4: '10:00 AM',
|
||||||
|
5: '2:00 PM',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = replaceTemplateVariables(templateText, processedParams);
|
||||||
|
expect(result).toBe(
|
||||||
|
"Hi John, we're scheduling a technician visit to 123 Main St on 2025-01-15 between 10:00 AM and 2:00 PM. Please confirm if this time slot works for you."
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should keep original variable format when no replacement value provided', () => {
|
||||||
|
const processedParams = {
|
||||||
|
body: {
|
||||||
|
1: 'John',
|
||||||
|
3: '2025-01-15',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = replaceTemplateVariables(templateText, processedParams);
|
||||||
|
expect(result).toContain('John');
|
||||||
|
expect(result).toContain('2025-01-15');
|
||||||
|
expect(result).toContain('{{2}}');
|
||||||
|
expect(result).toContain('{{4}}');
|
||||||
|
expect(result).toContain('{{5}}');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle empty processedParams', () => {
|
||||||
|
const result = replaceTemplateVariables(templateText, {});
|
||||||
|
expect(result).toBe(templateText);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('buildTemplateParameters', () => {
|
||||||
|
it('should build parameters for template with body variables', () => {
|
||||||
|
const result = buildTemplateParameters(technicianTemplate, false);
|
||||||
|
|
||||||
|
expect(result.body).toEqual({
|
||||||
|
1: '',
|
||||||
|
2: '',
|
||||||
|
3: '',
|
||||||
|
4: '',
|
||||||
|
5: '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should include header parameters when hasMediaHeader is true', () => {
|
||||||
|
const imageTemplate = templates.find(
|
||||||
|
t => t.name === 'order_confirmation'
|
||||||
|
);
|
||||||
|
const result = buildTemplateParameters(imageTemplate, true);
|
||||||
|
|
||||||
|
expect(result.header).toEqual({
|
||||||
|
media_url: '',
|
||||||
|
media_type: 'image',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not include header parameters when hasMediaHeader is false', () => {
|
||||||
|
const result = buildTemplateParameters(technicianTemplate, false);
|
||||||
|
expect(result.header).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle template with no body component', () => {
|
||||||
|
const templateWithoutBody = {
|
||||||
|
components: [{ type: 'HEADER', format: 'TEXT' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = buildTemplateParameters(templateWithoutBody, false);
|
||||||
|
expect(result).toEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle template with no variables', () => {
|
||||||
|
const templateWithoutVars = templates.find(
|
||||||
|
t => t.name === 'no_variable_template'
|
||||||
|
);
|
||||||
|
const result = buildTemplateParameters(templateWithoutVars, false);
|
||||||
|
|
||||||
|
expect(result.body).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle URL buttons with variables for non-authentication templates', () => {
|
||||||
|
const templateWithUrlButton = {
|
||||||
|
category: 'MARKETING',
|
||||||
|
components: [
|
||||||
|
{
|
||||||
|
type: 'BODY',
|
||||||
|
text: 'Check out our website at {{site_url}}',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'BUTTONS',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
type: 'URL',
|
||||||
|
url: 'https://example.com/{{campaign_id}}',
|
||||||
|
text: 'Visit Site',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = buildTemplateParameters(templateWithUrlButton, false);
|
||||||
|
expect(result.buttons).toEqual([
|
||||||
|
{
|
||||||
|
type: 'url',
|
||||||
|
parameter: '',
|
||||||
|
url: 'https://example.com/{{campaign_id}}',
|
||||||
|
variables: ['campaign_id'],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle templates with no variables', () => {
|
||||||
|
const emptyTemplate = templates.find(
|
||||||
|
t => t.name === 'no_variable_template'
|
||||||
|
);
|
||||||
|
const result = buildTemplateParameters(emptyTemplate, false);
|
||||||
|
expect(result).toEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should build parameters for templates with multiple component types', () => {
|
||||||
|
const complexTemplate = {
|
||||||
|
components: [
|
||||||
|
{ type: 'HEADER', format: 'IMAGE' },
|
||||||
|
{ type: 'BODY', text: 'Hi {{1}}, your order {{2}} is ready!' },
|
||||||
|
{ type: 'FOOTER', text: 'Thank you for your business' },
|
||||||
|
{
|
||||||
|
type: 'BUTTONS',
|
||||||
|
buttons: [{ type: 'URL', url: 'https://example.com/{{3}}' }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = buildTemplateParameters(complexTemplate, true);
|
||||||
|
|
||||||
|
expect(result.header).toEqual({
|
||||||
|
media_url: '',
|
||||||
|
media_type: 'image',
|
||||||
|
});
|
||||||
|
expect(result.body).toEqual({ 1: '', 2: '' });
|
||||||
|
expect(result.buttons).toEqual([
|
||||||
|
{
|
||||||
|
type: 'url',
|
||||||
|
parameter: '',
|
||||||
|
url: 'https://example.com/{{3}}',
|
||||||
|
variables: ['3'],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle copy code buttons correctly', () => {
|
||||||
|
const copyCodeTemplate = templates.find(
|
||||||
|
t => t.name === 'discount_coupon'
|
||||||
|
);
|
||||||
|
const result = buildTemplateParameters(copyCodeTemplate, false);
|
||||||
|
|
||||||
|
expect(result.body).toBeDefined();
|
||||||
|
expect(result.buttons).toEqual([
|
||||||
|
{
|
||||||
|
type: 'copy_code',
|
||||||
|
parameter: '',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle templates with document headers', () => {
|
||||||
|
const documentTemplate = templates.find(
|
||||||
|
t => t.name === 'purchase_receipt'
|
||||||
|
);
|
||||||
|
const result = buildTemplateParameters(documentTemplate, true);
|
||||||
|
|
||||||
|
expect(result.header).toEqual({
|
||||||
|
media_url: '',
|
||||||
|
media_type: 'document',
|
||||||
|
});
|
||||||
|
expect(result.body).toEqual({
|
||||||
|
1: '',
|
||||||
|
2: '',
|
||||||
|
3: '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle video header templates', () => {
|
||||||
|
const videoTemplate = templates.find(t => t.name === 'training_video');
|
||||||
|
const result = buildTemplateParameters(videoTemplate, true);
|
||||||
|
|
||||||
|
expect(result.header).toEqual({
|
||||||
|
media_url: '',
|
||||||
|
media_type: 'video',
|
||||||
|
});
|
||||||
|
expect(result.body).toEqual({
|
||||||
|
name: '',
|
||||||
|
date: '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('enhanced format validation', () => {
|
||||||
|
it('should validate enhanced format structure', () => {
|
||||||
|
const processedParams = {
|
||||||
|
body: { 1: 'John', 2: 'Order123' },
|
||||||
|
header: {
|
||||||
|
media_url: 'https://example.com/image.jpg',
|
||||||
|
media_type: 'image',
|
||||||
|
},
|
||||||
|
buttons: [{ type: 'copy_code', parameter: 'SAVE20' }],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Test that structure is properly formed
|
||||||
|
expect(processedParams.body).toBeDefined();
|
||||||
|
expect(typeof processedParams.body).toBe('object');
|
||||||
|
expect(processedParams.header).toBeDefined();
|
||||||
|
expect(Array.isArray(processedParams.buttons)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle empty component sections', () => {
|
||||||
|
const processedParams = {
|
||||||
|
body: {},
|
||||||
|
header: {},
|
||||||
|
buttons: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(allKeysRequired(processedParams.body)).toBe(true);
|
||||||
|
expect(allKeysRequired(processedParams.header)).toBe(true);
|
||||||
|
expect(processedParams.buttons.length).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate parameter completeness', () => {
|
||||||
|
const incompleteParams = {
|
||||||
|
body: { 1: 'John', 2: '' },
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(allKeysRequired(incompleteParams.body)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle edge cases in processVariable', () => {
|
||||||
|
expect(processVariable('{{')).toBe('');
|
||||||
|
expect(processVariable('}}')).toBe('');
|
||||||
|
expect(processVariable('')).toBe('');
|
||||||
|
expect(processVariable('{{nested{{variable}}}}')).toBe('nestedvariable');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle special characters in template variables', () => {
|
||||||
|
/* eslint-disable no-template-curly-in-string */
|
||||||
|
const templateText =
|
||||||
|
'Welcome {{user_name}}, your order #{{order_id}} costs ${{amount}}';
|
||||||
|
/* eslint-enable no-template-curly-in-string */
|
||||||
|
const processedParams = {
|
||||||
|
body: {
|
||||||
|
user_name: 'John & Jane',
|
||||||
|
order_id: '12345',
|
||||||
|
amount: '99.99',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = replaceTemplateVariables(templateText, processedParams);
|
||||||
|
expect(result).toBe(
|
||||||
|
'Welcome John & Jane, your order #12345 costs $99.99'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle templates with mixed parameter types', () => {
|
||||||
|
const mixedTemplate = {
|
||||||
|
components: [
|
||||||
|
{ type: 'HEADER', format: 'VIDEO' },
|
||||||
|
{ type: 'BODY', text: 'Order {{order_id}} status: {{status}}' },
|
||||||
|
{ type: 'FOOTER', text: 'Thank you' },
|
||||||
|
{
|
||||||
|
type: 'BUTTONS',
|
||||||
|
buttons: [
|
||||||
|
{ type: 'URL', url: 'https://track.com/{{order_id}}' },
|
||||||
|
{ type: 'COPY_CODE' },
|
||||||
|
{ type: 'PHONE_NUMBER', phone_number: '+1234567890' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = buildTemplateParameters(mixedTemplate, true);
|
||||||
|
|
||||||
|
expect(result.header).toEqual({
|
||||||
|
media_url: '',
|
||||||
|
media_type: 'video',
|
||||||
|
});
|
||||||
|
expect(result.body).toEqual({
|
||||||
|
order_id: '',
|
||||||
|
status: '',
|
||||||
|
});
|
||||||
|
expect(result.buttons).toHaveLength(2); // URL and COPY_CODE (PHONE_NUMBER doesn't need parameters)
|
||||||
|
expect(result.buttons[0].type).toBe('url');
|
||||||
|
expect(result.buttons[1].type).toBe('copy_code');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle templates with no processable components', () => {
|
||||||
|
const emptyTemplate = {
|
||||||
|
components: [
|
||||||
|
{ type: 'HEADER', format: 'TEXT', text: 'Static Header' },
|
||||||
|
{ type: 'BODY', text: 'Static body with no variables' },
|
||||||
|
{ type: 'FOOTER', text: 'Static footer' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = buildTemplateParameters(emptyTemplate, false);
|
||||||
|
expect(result).toEqual({});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate that replaceTemplateVariables preserves unreplaced variables', () => {
|
||||||
|
const templateText = 'Hi {{name}}, order {{order_id}} is {{status}}';
|
||||||
|
const partialParams = {
|
||||||
|
body: {
|
||||||
|
name: 'John',
|
||||||
|
// order_id missing
|
||||||
|
status: 'ready',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = replaceTemplateVariables(templateText, partialParams);
|
||||||
|
expect(result).toBe('Hi John, order {{order_id}} is ready');
|
||||||
|
expect(result).toContain('{{order_id}}'); // Unreplaced variable preserved
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
// Constants
|
||||||
|
export const DEFAULT_LANGUAGE = 'en';
|
||||||
|
export const DEFAULT_CATEGORY = 'UTILITY';
|
||||||
|
export const COMPONENT_TYPES = {
|
||||||
|
HEADER: 'HEADER',
|
||||||
|
BODY: 'BODY',
|
||||||
|
BUTTONS: 'BUTTONS',
|
||||||
|
};
|
||||||
|
export const MEDIA_FORMATS = ['IMAGE', 'VIDEO', 'DOCUMENT'];
|
||||||
|
|
||||||
|
export const findComponentByType = (template, type) =>
|
||||||
|
template.components?.find(component => component.type === type);
|
||||||
|
|
||||||
|
export const processVariable = str => {
|
||||||
|
return str.replace(/{{|}}/g, '');
|
||||||
|
};
|
||||||
|
|
||||||
|
export const allKeysRequired = value => {
|
||||||
|
const keys = Object.keys(value);
|
||||||
|
return keys.every(key => value[key]);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const replaceTemplateVariables = (templateText, processedParams) => {
|
||||||
|
return templateText.replace(/{{([^}]+)}}/g, (match, variable) => {
|
||||||
|
const variableKey = processVariable(variable);
|
||||||
|
return processedParams.body?.[variableKey] || `{{${variable}}}`;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export const buildTemplateParameters = (template, hasMediaHeaderValue) => {
|
||||||
|
const allVariables = {};
|
||||||
|
|
||||||
|
const bodyComponent = findComponentByType(template, COMPONENT_TYPES.BODY);
|
||||||
|
const headerComponent = findComponentByType(template, COMPONENT_TYPES.HEADER);
|
||||||
|
|
||||||
|
if (!bodyComponent) return allVariables;
|
||||||
|
|
||||||
|
const templateString = bodyComponent.text;
|
||||||
|
|
||||||
|
// Process body variables
|
||||||
|
const matchedVariables = templateString.match(/{{([^}]+)}}/g);
|
||||||
|
if (matchedVariables) {
|
||||||
|
allVariables.body = {};
|
||||||
|
matchedVariables.forEach(variable => {
|
||||||
|
const key = processVariable(variable);
|
||||||
|
allVariables.body[key] = '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasMediaHeaderValue) {
|
||||||
|
if (!allVariables.header) allVariables.header = {};
|
||||||
|
allVariables.header.media_url = '';
|
||||||
|
allVariables.header.media_type = headerComponent.format.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process button variables
|
||||||
|
const buttonComponents = template.components.filter(
|
||||||
|
component => component.type === COMPONENT_TYPES.BUTTONS
|
||||||
|
);
|
||||||
|
|
||||||
|
buttonComponents.forEach(buttonComponent => {
|
||||||
|
if (buttonComponent.buttons) {
|
||||||
|
buttonComponent.buttons.forEach((button, index) => {
|
||||||
|
// Handle URL buttons with variables
|
||||||
|
if (button.type === 'URL' && button.url && button.url.includes('{{')) {
|
||||||
|
const buttonVars = button.url.match(/{{([^}]+)}}/g) || [];
|
||||||
|
if (buttonVars.length > 0) {
|
||||||
|
if (!allVariables.buttons) allVariables.buttons = [];
|
||||||
|
allVariables.buttons[index] = {
|
||||||
|
type: 'url',
|
||||||
|
parameter: '',
|
||||||
|
url: button.url,
|
||||||
|
variables: buttonVars.map(v => processVariable(v)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle copy code buttons
|
||||||
|
if (button.type === 'COPY_CODE') {
|
||||||
|
if (!allVariables.buttons) allVariables.buttons = [];
|
||||||
|
allVariables.buttons[index] = {
|
||||||
|
type: 'copy_code',
|
||||||
|
parameter: '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return allVariables;
|
||||||
|
};
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import ar from './locale/ar';
|
import ar from './locale/ar';
|
||||||
|
import bg from './locale/bg';
|
||||||
import ca from './locale/ca';
|
import ca from './locale/ca';
|
||||||
import cs from './locale/cs';
|
import cs from './locale/cs';
|
||||||
import da from './locale/da';
|
import da from './locale/da';
|
||||||
@@ -40,6 +41,7 @@ import lt from './locale/lt';
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
ar,
|
ar,
|
||||||
|
bg,
|
||||||
ca,
|
ca,
|
||||||
cs,
|
cs,
|
||||||
da,
|
da,
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
"CONVERSATION_CREATED": "Conversation Created",
|
"CONVERSATION_CREATED": "Conversation Created",
|
||||||
"CONVERSATION_UPDATED": "Conversation Updated",
|
"CONVERSATION_UPDATED": "Conversation Updated",
|
||||||
"MESSAGE_CREATED": "Message Created",
|
"MESSAGE_CREATED": "Message Created",
|
||||||
|
"CONVERSATION_RESOLVED": "Conversation Resolved",
|
||||||
"CONVERSATION_OPENED": "Conversation Opened"
|
"CONVERSATION_OPENED": "Conversation Opened"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
"AGENTS_LOADING": "Loading agents...",
|
"AGENTS_LOADING": "Loading agents...",
|
||||||
"ASSIGN_TEAM": "Assign team",
|
"ASSIGN_TEAM": "Assign team",
|
||||||
"DELETE": "Delete conversation",
|
"DELETE": "Delete conversation",
|
||||||
|
"OPEN_IN_NEW_TAB": "Open in new tab",
|
||||||
|
"COPY_LINK": "Copy conversation link",
|
||||||
|
"COPY_LINK_SUCCESS": "Conversation link copied to clipboard",
|
||||||
"API": {
|
"API": {
|
||||||
"AGENT_ASSIGNMENT": {
|
"AGENT_ASSIGNMENT": {
|
||||||
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
||||||
|
|||||||
@@ -157,6 +157,12 @@
|
|||||||
"DELETE_SUCCESS": "Portal deleted successfully",
|
"DELETE_SUCCESS": "Portal deleted successfully",
|
||||||
"DELETE_ERROR": "Error while deleting portal"
|
"DELETE_ERROR": "Error while deleting portal"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SEND_CNAME_INSTRUCTIONS": {
|
||||||
|
"API": {
|
||||||
|
"SUCCESS_MESSAGE": "CNAME instructions sent successfully",
|
||||||
|
"ERROR_MESSAGE": "Error while sending CNAME instructions"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -726,7 +732,7 @@
|
|||||||
"HOME_PAGE_LINK": {
|
"HOME_PAGE_LINK": {
|
||||||
"LABEL": "Home page link",
|
"LABEL": "Home page link",
|
||||||
"PLACEHOLDER": "Portal home page link",
|
"PLACEHOLDER": "Portal home page link",
|
||||||
"ERROR": "Invalid URL. The Home page link must start with 'http://' or 'https://'."
|
"ERROR": "Enter a valid URL. The Home page link must start with 'http://' or 'https://'."
|
||||||
},
|
},
|
||||||
"SLUG": {
|
"SLUG": {
|
||||||
"LABEL": "Slug",
|
"LABEL": "Slug",
|
||||||
@@ -747,9 +753,15 @@
|
|||||||
"HEADER": "Custom domain",
|
"HEADER": "Custom domain",
|
||||||
"LABEL": "Custom domain:",
|
"LABEL": "Custom domain:",
|
||||||
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
||||||
|
"STATUS_DESCRIPTION": "Your custom portal will start working as soon as it is verified.",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"EDIT_BUTTON": "Edit custom domain",
|
"EDIT_BUTTON": "Edit",
|
||||||
"ADD_BUTTON": "Add custom domain",
|
"ADD_BUTTON": "Add custom domain",
|
||||||
|
"STATUS": {
|
||||||
|
"LIVE": "Live",
|
||||||
|
"PENDING": "Awaiting verification",
|
||||||
|
"ERROR": "Verification failed"
|
||||||
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"ADD_HEADER": "Add custom domain",
|
"ADD_HEADER": "Add custom domain",
|
||||||
"EDIT_HEADER": "Edit custom domain",
|
"EDIT_HEADER": "Edit custom domain",
|
||||||
@@ -757,13 +769,20 @@
|
|||||||
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
||||||
"LABEL": "Custom domain",
|
"LABEL": "Custom domain",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"ERROR": "Custom domain is required"
|
"ERROR": "Custom domain is required",
|
||||||
|
"FORMAT_ERROR": "Please enter a valid domain URL e.g. docs.yourdomain.com"
|
||||||
},
|
},
|
||||||
"DNS_CONFIGURATION_DIALOG": {
|
"DNS_CONFIGURATION_DIALOG": {
|
||||||
"HEADER": "DNS configuration",
|
"HEADER": "DNS configuration",
|
||||||
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
||||||
"HELP_TEXT": "Once this is done, you can reach out to our support to request for the auto-generated SSL certificate.",
|
"COPY": "Successfully copied CNAME",
|
||||||
"CONFIRM_BUTTON_LABEL": "Got it!"
|
"SEND_INSTRUCTIONS": {
|
||||||
|
"HEADER": "Send instructions",
|
||||||
|
"DESCRIPTION": "If you would prefer to have someone from your development team to handle this step, you can enter email address below, and we will send them the required instructions.",
|
||||||
|
"PLACEHOLDER": "Enter their email",
|
||||||
|
"ERROR": "Enter a valid email address",
|
||||||
|
"SEND_BUTTON": "Send"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DELETE_PORTAL": {
|
"DELETE_PORTAL": {
|
||||||
|
|||||||
@@ -72,6 +72,24 @@
|
|||||||
"MARK_ALL_READ": "All notifications marked as read",
|
"MARK_ALL_READ": "All notifications marked as read",
|
||||||
"DELETE_ALL": "All notifications deleted",
|
"DELETE_ALL": "All notifications deleted",
|
||||||
"DELETE_ALL_READ": "All read notifications deleted"
|
"DELETE_ALL_READ": "All read notifications deleted"
|
||||||
|
},
|
||||||
|
"REAUTHORIZE": {
|
||||||
|
"TITLE": "Reauthorization Required",
|
||||||
|
"DESCRIPTION": "Your WhatsApp connection has expired. Please reconnect to continue receiving and sending messages.",
|
||||||
|
"BUTTON_TEXT": "Reconnect WhatsApp",
|
||||||
|
"LOADING_FACEBOOK": "Loading Facebook SDK...",
|
||||||
|
"SUCCESS": "WhatsApp reconnected successfully",
|
||||||
|
"ERROR": "Failed to reconnect WhatsApp. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"CONFIGURATION_ERROR": "Configuration error occurred during reauthorization.",
|
||||||
|
"FACEBOOK_LOAD_ERROR": "Failed to load Facebook SDK. Please try again.",
|
||||||
|
"TROUBLESHOOTING": {
|
||||||
|
"TITLE": "Troubleshooting",
|
||||||
|
"POPUP_BLOCKED": "Ensure pop-ups are allowed for this site",
|
||||||
|
"COOKIES": "Third-party cookies must be enabled",
|
||||||
|
"ADMIN_ACCESS": "You need admin access to the WhatsApp Business Account"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,6 +280,11 @@
|
|||||||
"SECURE_AUTH": "Secure OAuth based authentication",
|
"SECURE_AUTH": "Secure OAuth based authentication",
|
||||||
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
||||||
},
|
},
|
||||||
|
"LEARN_MORE": {
|
||||||
|
"TEXT": "To learn more about integrated signup, pricing, and limitations, visit",
|
||||||
|
"LINK_TEXT": "this link.",
|
||||||
|
"LINK_URL": "https://developers.facebook.com/docs/whatsapp/embedded-signup/custom-flows/onboarding-business-app-users#limitations"
|
||||||
|
},
|
||||||
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
||||||
"AUTH_PROCESSING": "Authenticating with Meta",
|
"AUTH_PROCESSING": "Authenticating with Meta",
|
||||||
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
||||||
@@ -598,6 +603,21 @@
|
|||||||
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
||||||
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
||||||
"WHATSAPP_SECTION_UPDATE_BUTTON": "Update",
|
"WHATSAPP_SECTION_UPDATE_BUTTON": "Update",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_TITLE": "WhatsApp Embedded Signup",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_SUBHEADER": "This inbox is connected through WhatsApp embedded signup.",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_DESCRIPTION": "You can reconfigure this inbox to update your WhatsApp Business settings.",
|
||||||
|
"WHATSAPP_RECONFIGURE_BUTTON": "Reconfigure",
|
||||||
|
"WHATSAPP_CONNECT_TITLE": "Connect to WhatsApp Business",
|
||||||
|
"WHATSAPP_CONNECT_SUBHEADER": "Upgrade to WhatsApp embedded signup for easier management.",
|
||||||
|
"WHATSAPP_CONNECT_DESCRIPTION": "Connect this inbox to WhatsApp Business for enhanced features and easier management.",
|
||||||
|
"WHATSAPP_CONNECT_BUTTON": "Connect",
|
||||||
|
"WHATSAPP_CONNECT_SUCCESS": "Successfully connected to WhatsApp Business!",
|
||||||
|
"WHATSAPP_CONNECT_ERROR": "Failed to connect to WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_RECONFIGURE_SUCCESS": "Successfully reconfigured WhatsApp Business!",
|
||||||
|
"WHATSAPP_RECONFIGURE_ERROR": "Failed to reconfigure WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_LOGIN_CANCELLED": "WhatsApp login was cancelled. Please try again.",
|
||||||
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
||||||
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
||||||
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
||||||
|
|||||||
@@ -472,7 +472,8 @@
|
|||||||
"FEATURES": {
|
"FEATURES": {
|
||||||
"TITLE": "Features",
|
"TITLE": "Features",
|
||||||
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
||||||
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions."
|
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions.",
|
||||||
|
"ALLOW_CITATIONS": "Include source citations in responses"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -557,6 +558,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No guardrails found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Guardrails added successfully",
|
"SUCCESS": "Guardrails added successfully",
|
||||||
@@ -604,6 +606,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No response guidelines found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Response Guidelines added successfully",
|
"SUCCESS": "Response Guidelines added successfully",
|
||||||
@@ -618,6 +621,73 @@
|
|||||||
"ERROR": "There was an error deleting response guidelines, please try again."
|
"ERROR": "There was an error deleting response guidelines, please try again."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SCENARIOS": {
|
||||||
|
"TITLE": "Scenarios",
|
||||||
|
"DESCRIPTION": "Give your assistant some context—like “what to do when a user is stuck,” or “how to act during a refund request.”",
|
||||||
|
"BREADCRUMB": {
|
||||||
|
"TITLE": "Scenarios"
|
||||||
|
},
|
||||||
|
"BULK_ACTION": {
|
||||||
|
"SELECTED": "{count} item selected | {count} items selected",
|
||||||
|
"SELECT_ALL": "Select all ({count})",
|
||||||
|
"UNSELECT_ALL": "Unselect all ({count})",
|
||||||
|
"BULK_DELETE_BUTTON": "Delete"
|
||||||
|
},
|
||||||
|
"ADD": {
|
||||||
|
"SUGGESTED": {
|
||||||
|
"TITLE": "Example scenarios",
|
||||||
|
"ADD": "Add all",
|
||||||
|
"ADD_SINGLE": "Add this",
|
||||||
|
"TOOLS_USED": "Tools used :"
|
||||||
|
},
|
||||||
|
"NEW": {
|
||||||
|
"CREATE": "Add a scenario",
|
||||||
|
"TITLE": "Create a scenario",
|
||||||
|
"FORM": {
|
||||||
|
"TITLE": {
|
||||||
|
"LABEL": "Title",
|
||||||
|
"PLACEHOLDER": "Enter a name for the scenario",
|
||||||
|
"ERROR": "Scenario name is required"
|
||||||
|
},
|
||||||
|
"DESCRIPTION": {
|
||||||
|
"LABEL": "Description",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be used",
|
||||||
|
"ERROR": "Scenario description is required"
|
||||||
|
},
|
||||||
|
"INSTRUCTION": {
|
||||||
|
"LABEL": "How to handle",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be handled",
|
||||||
|
"ERROR": "Scenario content is required"
|
||||||
|
},
|
||||||
|
"CREATE": "Create",
|
||||||
|
"CANCEL": "Cancel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"CANCEL": "Cancel",
|
||||||
|
"UPDATE": "Update changes"
|
||||||
|
},
|
||||||
|
"LIST": {
|
||||||
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
|
},
|
||||||
|
"EMPTY_MESSAGE": "No scenarios found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No scenarios found for this search.",
|
||||||
|
"API": {
|
||||||
|
"ADD": {
|
||||||
|
"SUCCESS": "Scenarios added successfully",
|
||||||
|
"ERROR": "There was an error adding scenarios, please try again."
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"SUCCESS": "Scenarios updated successfully",
|
||||||
|
"ERROR": "There was an error updating scenarios, please try again."
|
||||||
|
},
|
||||||
|
"DELETE": {
|
||||||
|
"SUCCESS": "Scenarios deleted successfully",
|
||||||
|
"ERROR": "There was an error deleting scenarios, please try again."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DOCUMENTS": {
|
"DOCUMENTS": {
|
||||||
|
|||||||
@@ -1,29 +1,46 @@
|
|||||||
{
|
{
|
||||||
"WHATSAPP_TEMPLATES": {
|
"WHATSAPP_TEMPLATES": {
|
||||||
"MODAL": {
|
"MODAL": {
|
||||||
"TITLE": "Whatsapp Templates",
|
"TITLE": "Whatsapp Templates",
|
||||||
"SUBTITLE": "Select the whatsapp template you want to send",
|
"SUBTITLE": "Select the whatsapp template you want to send",
|
||||||
"TEMPLATE_SELECTED_SUBTITLE": "Process {templateName}"
|
"TEMPLATE_SELECTED_SUBTITLE": "Configure template: {templateName}"
|
||||||
},
|
},
|
||||||
"PICKER": {
|
"PICKER": {
|
||||||
"SEARCH_PLACEHOLDER": "Search Templates",
|
"SEARCH_PLACEHOLDER": "Search Templates",
|
||||||
"NO_TEMPLATES_FOUND": "No templates found for",
|
"NO_TEMPLATES_FOUND": "No templates found for",
|
||||||
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
"HEADER": "Header",
|
||||||
"REFRESH_BUTTON": "Refresh templates",
|
"BODY": "Body",
|
||||||
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
"FOOTER": "Footer",
|
||||||
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
"BUTTONS": "Buttons",
|
||||||
"LABELS": {
|
"CATEGORY": "Category",
|
||||||
"LANGUAGE": "Language",
|
"MEDIA_CONTENT": "Media Content",
|
||||||
"TEMPLATE_BODY": "Template Body",
|
"MEDIA_CONTENT_FALLBACK": "media content",
|
||||||
"CATEGORY": "Category"
|
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
||||||
}
|
"REFRESH_BUTTON": "Refresh templates",
|
||||||
},
|
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
||||||
"PARSER": {
|
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
||||||
"VARIABLES_LABEL": "Variables",
|
"LABELS": {
|
||||||
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
"LANGUAGE": "Language",
|
||||||
"GO_BACK_LABEL": "Go Back",
|
"TEMPLATE_BODY": "Template Body",
|
||||||
"SEND_MESSAGE_LABEL": "Send Message",
|
"CATEGORY": "Category"
|
||||||
"FORM_ERROR_MESSAGE": "Please fill all variables before sending"
|
}
|
||||||
}
|
},
|
||||||
|
"PARSER": {
|
||||||
|
"VARIABLES_LABEL": "Variables",
|
||||||
|
"LANGUAGE": "Language",
|
||||||
|
"CATEGORY": "Category",
|
||||||
|
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
||||||
|
"GO_BACK_LABEL": "Go Back",
|
||||||
|
"SEND_MESSAGE_LABEL": "Send Message",
|
||||||
|
"FORM_ERROR_MESSAGE": "Please fill all variables before sending",
|
||||||
|
"MEDIA_HEADER_LABEL": "{type} Header",
|
||||||
|
"OTP_CODE": "Enter 4-8 digit OTP",
|
||||||
|
"EXPIRY_MINUTES": "Enter expiry minutes",
|
||||||
|
"BUTTON_PARAMETERS": "Button Parameters",
|
||||||
|
"BUTTON_LABEL": "Button {index}",
|
||||||
|
"COUPON_CODE": "Enter coupon code (max 15 chars)",
|
||||||
|
"MEDIA_URL_LABEL": "Enter {type} URL",
|
||||||
|
"BUTTON_PARAMETER": "Enter button parameter"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
"CONVERSATION_CREATED": "تم إنشاء المحادثة",
|
"CONVERSATION_CREATED": "تم إنشاء المحادثة",
|
||||||
"CONVERSATION_UPDATED": "تم تحديث المحادثة",
|
"CONVERSATION_UPDATED": "تم تحديث المحادثة",
|
||||||
"MESSAGE_CREATED": "Message Created",
|
"MESSAGE_CREATED": "Message Created",
|
||||||
|
"CONVERSATION_RESOLVED": "Conversation Resolved",
|
||||||
"CONVERSATION_OPENED": "Conversation Opened"
|
"CONVERSATION_OPENED": "Conversation Opened"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
"AGENTS_LOADING": "جاري جلب الوكلاء...",
|
"AGENTS_LOADING": "جاري جلب الوكلاء...",
|
||||||
"ASSIGN_TEAM": "تعيين فريق",
|
"ASSIGN_TEAM": "تعيين فريق",
|
||||||
"DELETE": "Delete conversation",
|
"DELETE": "Delete conversation",
|
||||||
|
"OPEN_IN_NEW_TAB": "Open in new tab",
|
||||||
|
"COPY_LINK": "Copy conversation link",
|
||||||
|
"COPY_LINK_SUCCESS": "Conversation link copied to clipboard",
|
||||||
"API": {
|
"API": {
|
||||||
"AGENT_ASSIGNMENT": {
|
"AGENT_ASSIGNMENT": {
|
||||||
"SUCCESFUL": "معرف المحادثة {conversationId} تم تعيينه لـ \"{agentName}\"",
|
"SUCCESFUL": "معرف المحادثة {conversationId} تم تعيينه لـ \"{agentName}\"",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"FAILURE": "Could not delete account, try again!",
|
"FAILURE": "Could not delete account, try again!",
|
||||||
"SCHEDULED_DELETION": {
|
"SCHEDULED_DELETION": {
|
||||||
"TITLE": "Account Scheduled for Deletion",
|
"TITLE": "Account Scheduled for Deletion",
|
||||||
"MESSAGE_MANUAL": "This account is scheduled for deletion on {deletionDate}. This was requested by an administrator. You can cancel the deletion before this date.",
|
"MESSAGE_MANUAL": "هذا الحساب مجدول للحذف بتاريخ {deletionDate}. تم طلبه من قبل المسؤول. يمكنك إلغاء الحذف قبل هذا التاريخ.",
|
||||||
"MESSAGE_INACTIVITY": "This account is scheduled for deletion on {deletionDate} due to account inactivity. You can cancel the deletion before this date.",
|
"MESSAGE_INACTIVITY": "This account is scheduled for deletion on {deletionDate} due to account inactivity. You can cancel the deletion before this date.",
|
||||||
"CLEAR_BUTTON": "Cancel Scheduled Deletion"
|
"CLEAR_BUTTON": "Cancel Scheduled Deletion"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,6 +157,12 @@
|
|||||||
"DELETE_SUCCESS": "Portal deleted successfully",
|
"DELETE_SUCCESS": "Portal deleted successfully",
|
||||||
"DELETE_ERROR": "حدث خطأ أثناء حذف البوابة"
|
"DELETE_ERROR": "حدث خطأ أثناء حذف البوابة"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SEND_CNAME_INSTRUCTIONS": {
|
||||||
|
"API": {
|
||||||
|
"SUCCESS_MESSAGE": "CNAME instructions sent successfully",
|
||||||
|
"ERROR_MESSAGE": "Error while sending CNAME instructions"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -726,7 +732,7 @@
|
|||||||
"HOME_PAGE_LINK": {
|
"HOME_PAGE_LINK": {
|
||||||
"LABEL": "Home page link",
|
"LABEL": "Home page link",
|
||||||
"PLACEHOLDER": "رابط الصفحة الرئيسية للبوابة",
|
"PLACEHOLDER": "رابط الصفحة الرئيسية للبوابة",
|
||||||
"ERROR": "Invalid URL. The Home page link must start with 'http://' or 'https://'."
|
"ERROR": "Enter a valid URL. The Home page link must start with 'http://' or 'https://'."
|
||||||
},
|
},
|
||||||
"SLUG": {
|
"SLUG": {
|
||||||
"LABEL": "Slug",
|
"LABEL": "Slug",
|
||||||
@@ -747,9 +753,15 @@
|
|||||||
"HEADER": "نطاق مخصص",
|
"HEADER": "نطاق مخصص",
|
||||||
"LABEL": "نطاق مخصص:",
|
"LABEL": "نطاق مخصص:",
|
||||||
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
||||||
|
"STATUS_DESCRIPTION": "Your custom portal will start working as soon as it is verified.",
|
||||||
"PLACEHOLDER": "نطاق البوابة المخصص",
|
"PLACEHOLDER": "نطاق البوابة المخصص",
|
||||||
"EDIT_BUTTON": "Edit custom domain",
|
"EDIT_BUTTON": "تعديل",
|
||||||
"ADD_BUTTON": "Add custom domain",
|
"ADD_BUTTON": "Add custom domain",
|
||||||
|
"STATUS": {
|
||||||
|
"LIVE": "مباشر",
|
||||||
|
"PENDING": "Awaiting verification",
|
||||||
|
"ERROR": "Verification failed"
|
||||||
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"ADD_HEADER": "Add custom domain",
|
"ADD_HEADER": "Add custom domain",
|
||||||
"EDIT_HEADER": "Edit custom domain",
|
"EDIT_HEADER": "Edit custom domain",
|
||||||
@@ -757,13 +769,20 @@
|
|||||||
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
||||||
"LABEL": "نطاق مخصص",
|
"LABEL": "نطاق مخصص",
|
||||||
"PLACEHOLDER": "نطاق البوابة المخصص",
|
"PLACEHOLDER": "نطاق البوابة المخصص",
|
||||||
"ERROR": "Custom domain is required"
|
"ERROR": "Custom domain is required",
|
||||||
|
"FORMAT_ERROR": "Please enter a valid domain URL e.g. docs.yourdomain.com"
|
||||||
},
|
},
|
||||||
"DNS_CONFIGURATION_DIALOG": {
|
"DNS_CONFIGURATION_DIALOG": {
|
||||||
"HEADER": "DNS configuration",
|
"HEADER": "DNS configuration",
|
||||||
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
||||||
"HELP_TEXT": "Once this is done, you can reach out to our support to request for the auto-generated SSL certificate.",
|
"COPY": "Successfully copied CNAME",
|
||||||
"CONFIRM_BUTTON_LABEL": "Got it!"
|
"SEND_INSTRUCTIONS": {
|
||||||
|
"HEADER": "Send instructions",
|
||||||
|
"DESCRIPTION": "If you would prefer to have someone from your development team to handle this step, you can enter email address below, and we will send them the required instructions.",
|
||||||
|
"PLACEHOLDER": "Enter their email",
|
||||||
|
"ERROR": "Enter a valid email address",
|
||||||
|
"SEND_BUTTON": "إرسال"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DELETE_PORTAL": {
|
"DELETE_PORTAL": {
|
||||||
|
|||||||
@@ -72,6 +72,24 @@
|
|||||||
"MARK_ALL_READ": "تم تحديد جميع الإشعارات كمقروءة",
|
"MARK_ALL_READ": "تم تحديد جميع الإشعارات كمقروءة",
|
||||||
"DELETE_ALL": "تم حذف كل الإشعارات",
|
"DELETE_ALL": "تم حذف كل الإشعارات",
|
||||||
"DELETE_ALL_READ": "تم حذف كل الإشعارات المقروءة"
|
"DELETE_ALL_READ": "تم حذف كل الإشعارات المقروءة"
|
||||||
|
},
|
||||||
|
"REAUTHORIZE": {
|
||||||
|
"TITLE": "Reauthorization Required",
|
||||||
|
"DESCRIPTION": "Your WhatsApp connection has expired. Please reconnect to continue receiving and sending messages.",
|
||||||
|
"BUTTON_TEXT": "Reconnect WhatsApp",
|
||||||
|
"LOADING_FACEBOOK": "Loading Facebook SDK...",
|
||||||
|
"SUCCESS": "WhatsApp reconnected successfully",
|
||||||
|
"ERROR": "Failed to reconnect WhatsApp. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"CONFIGURATION_ERROR": "Configuration error occurred during reauthorization.",
|
||||||
|
"FACEBOOK_LOAD_ERROR": "Failed to load Facebook SDK. Please try again.",
|
||||||
|
"TROUBLESHOOTING": {
|
||||||
|
"TITLE": "Troubleshooting",
|
||||||
|
"POPUP_BLOCKED": "Ensure pop-ups are allowed for this site",
|
||||||
|
"COOKIES": "Third-party cookies must be enabled",
|
||||||
|
"ADMIN_ACCESS": "You need admin access to the WhatsApp Business Account"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,6 +280,11 @@
|
|||||||
"SECURE_AUTH": "Secure OAuth based authentication",
|
"SECURE_AUTH": "Secure OAuth based authentication",
|
||||||
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
||||||
},
|
},
|
||||||
|
"LEARN_MORE": {
|
||||||
|
"TEXT": "To learn more about integrated signup, pricing, and limitations, visit",
|
||||||
|
"LINK_TEXT": "this link.",
|
||||||
|
"LINK_URL": "https://developers.facebook.com/docs/whatsapp/embedded-signup/custom-flows/onboarding-business-app-users#limitations"
|
||||||
|
},
|
||||||
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
||||||
"AUTH_PROCESSING": "Authenticating with Meta",
|
"AUTH_PROCESSING": "Authenticating with Meta",
|
||||||
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
||||||
@@ -598,6 +603,21 @@
|
|||||||
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
||||||
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
||||||
"WHATSAPP_SECTION_UPDATE_BUTTON": "تحديث",
|
"WHATSAPP_SECTION_UPDATE_BUTTON": "تحديث",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_TITLE": "WhatsApp Embedded Signup",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_SUBHEADER": "This inbox is connected through WhatsApp embedded signup.",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_DESCRIPTION": "You can reconfigure this inbox to update your WhatsApp Business settings.",
|
||||||
|
"WHATSAPP_RECONFIGURE_BUTTON": "Reconfigure",
|
||||||
|
"WHATSAPP_CONNECT_TITLE": "Connect to WhatsApp Business",
|
||||||
|
"WHATSAPP_CONNECT_SUBHEADER": "Upgrade to WhatsApp embedded signup for easier management.",
|
||||||
|
"WHATSAPP_CONNECT_DESCRIPTION": "Connect this inbox to WhatsApp Business for enhanced features and easier management.",
|
||||||
|
"WHATSAPP_CONNECT_BUTTON": "ربط الاتصال",
|
||||||
|
"WHATSAPP_CONNECT_SUCCESS": "Successfully connected to WhatsApp Business!",
|
||||||
|
"WHATSAPP_CONNECT_ERROR": "Failed to connect to WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_RECONFIGURE_SUCCESS": "Successfully reconfigured WhatsApp Business!",
|
||||||
|
"WHATSAPP_RECONFIGURE_ERROR": "Failed to reconfigure WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_LOGIN_CANCELLED": "WhatsApp login was cancelled. Please try again.",
|
||||||
"WHATSAPP_WEBHOOK_TITLE": "رمز التحقق من Webhook",
|
"WHATSAPP_WEBHOOK_TITLE": "رمز التحقق من Webhook",
|
||||||
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
||||||
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
||||||
|
|||||||
@@ -472,7 +472,8 @@
|
|||||||
"FEATURES": {
|
"FEATURES": {
|
||||||
"TITLE": "الخصائص",
|
"TITLE": "الخصائص",
|
||||||
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
||||||
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions."
|
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions.",
|
||||||
|
"ALLOW_CITATIONS": "Include source citations in responses"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -557,6 +558,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No guardrails found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Guardrails added successfully",
|
"SUCCESS": "Guardrails added successfully",
|
||||||
@@ -604,6 +606,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No response guidelines found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Response Guidelines added successfully",
|
"SUCCESS": "Response Guidelines added successfully",
|
||||||
@@ -618,6 +621,73 @@
|
|||||||
"ERROR": "There was an error deleting response guidelines, please try again."
|
"ERROR": "There was an error deleting response guidelines, please try again."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SCENARIOS": {
|
||||||
|
"TITLE": "Scenarios",
|
||||||
|
"DESCRIPTION": "Give your assistant some context—like “what to do when a user is stuck,” or “how to act during a refund request.”",
|
||||||
|
"BREADCRUMB": {
|
||||||
|
"TITLE": "Scenarios"
|
||||||
|
},
|
||||||
|
"BULK_ACTION": {
|
||||||
|
"SELECTED": "{count} item selected | {count} items selected",
|
||||||
|
"SELECT_ALL": "Select all ({count})",
|
||||||
|
"UNSELECT_ALL": "Unselect all ({count})",
|
||||||
|
"BULK_DELETE_BUTTON": "حذف"
|
||||||
|
},
|
||||||
|
"ADD": {
|
||||||
|
"SUGGESTED": {
|
||||||
|
"TITLE": "Example scenarios",
|
||||||
|
"ADD": "Add all",
|
||||||
|
"ADD_SINGLE": "Add this",
|
||||||
|
"TOOLS_USED": "Tools used :"
|
||||||
|
},
|
||||||
|
"NEW": {
|
||||||
|
"CREATE": "Add a scenario",
|
||||||
|
"TITLE": "Create a scenario",
|
||||||
|
"FORM": {
|
||||||
|
"TITLE": {
|
||||||
|
"LABEL": "العنوان",
|
||||||
|
"PLACEHOLDER": "Enter a name for the scenario",
|
||||||
|
"ERROR": "Scenario name is required"
|
||||||
|
},
|
||||||
|
"DESCRIPTION": {
|
||||||
|
"LABEL": "الوصف",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be used",
|
||||||
|
"ERROR": "Scenario description is required"
|
||||||
|
},
|
||||||
|
"INSTRUCTION": {
|
||||||
|
"LABEL": "How to handle",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be handled",
|
||||||
|
"ERROR": "Scenario content is required"
|
||||||
|
},
|
||||||
|
"CREATE": "إنشاء",
|
||||||
|
"CANCEL": "إلغاء"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"CANCEL": "إلغاء",
|
||||||
|
"UPDATE": "Update changes"
|
||||||
|
},
|
||||||
|
"LIST": {
|
||||||
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
|
},
|
||||||
|
"EMPTY_MESSAGE": "No scenarios found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No scenarios found for this search.",
|
||||||
|
"API": {
|
||||||
|
"ADD": {
|
||||||
|
"SUCCESS": "Scenarios added successfully",
|
||||||
|
"ERROR": "There was an error adding scenarios, please try again."
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"SUCCESS": "Scenarios updated successfully",
|
||||||
|
"ERROR": "There was an error updating scenarios, please try again."
|
||||||
|
},
|
||||||
|
"DELETE": {
|
||||||
|
"SUCCESS": "Scenarios deleted successfully",
|
||||||
|
"ERROR": "There was an error deleting scenarios, please try again."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DOCUMENTS": {
|
"DOCUMENTS": {
|
||||||
|
|||||||
@@ -1,29 +1,46 @@
|
|||||||
{
|
{
|
||||||
"WHATSAPP_TEMPLATES": {
|
"WHATSAPP_TEMPLATES": {
|
||||||
"MODAL": {
|
"MODAL": {
|
||||||
"TITLE": "قوالب الواتساب",
|
"TITLE": "قوالب الواتساب",
|
||||||
"SUBTITLE": "حدد القالب الذي تريد إرساله",
|
"SUBTITLE": "حدد القالب الذي تريد إرساله",
|
||||||
"TEMPLATE_SELECTED_SUBTITLE": "معالجة {templateName}"
|
"TEMPLATE_SELECTED_SUBTITLE": "Configure template: {templateName}"
|
||||||
},
|
},
|
||||||
"PICKER": {
|
"PICKER": {
|
||||||
"SEARCH_PLACEHOLDER": "نماذج البحث",
|
"SEARCH_PLACEHOLDER": "نماذج البحث",
|
||||||
"NO_TEMPLATES_FOUND": "لم يتم العثور على قوالب",
|
"NO_TEMPLATES_FOUND": "لم يتم العثور على قوالب",
|
||||||
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
"HEADER": "Header",
|
||||||
"REFRESH_BUTTON": "Refresh templates",
|
"BODY": "Body",
|
||||||
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
"FOOTER": "Footer",
|
||||||
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
"BUTTONS": "Buttons",
|
||||||
"LABELS": {
|
"CATEGORY": "الفئة",
|
||||||
"LANGUAGE": "اللغة",
|
"MEDIA_CONTENT": "Media Content",
|
||||||
"TEMPLATE_BODY": "نص القالب",
|
"MEDIA_CONTENT_FALLBACK": "media content",
|
||||||
"CATEGORY": "الفئة"
|
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
||||||
}
|
"REFRESH_BUTTON": "Refresh templates",
|
||||||
},
|
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
||||||
"PARSER": {
|
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
||||||
"VARIABLES_LABEL": "المتغيرات",
|
"LABELS": {
|
||||||
"VARIABLE_PLACEHOLDER": "أدخل قيمة {variable}",
|
"LANGUAGE": "اللغة",
|
||||||
"GO_BACK_LABEL": "العودة للخلف",
|
"TEMPLATE_BODY": "نص القالب",
|
||||||
"SEND_MESSAGE_LABEL": "إرسال الرسالة",
|
"CATEGORY": "الفئة"
|
||||||
"FORM_ERROR_MESSAGE": "يرجى ملء جميع المتغيرات قبل الإرسال"
|
}
|
||||||
}
|
},
|
||||||
|
"PARSER": {
|
||||||
|
"VARIABLES_LABEL": "المتغيرات",
|
||||||
|
"LANGUAGE": "اللغة",
|
||||||
|
"CATEGORY": "الفئة",
|
||||||
|
"VARIABLE_PLACEHOLDER": "أدخل قيمة {variable}",
|
||||||
|
"GO_BACK_LABEL": "العودة للخلف",
|
||||||
|
"SEND_MESSAGE_LABEL": "إرسال الرسالة",
|
||||||
|
"FORM_ERROR_MESSAGE": "يرجى ملء جميع المتغيرات قبل الإرسال",
|
||||||
|
"MEDIA_HEADER_LABEL": "{type} Header",
|
||||||
|
"OTP_CODE": "Enter 4-8 digit OTP",
|
||||||
|
"EXPIRY_MINUTES": "Enter expiry minutes",
|
||||||
|
"BUTTON_PARAMETERS": "Button Parameters",
|
||||||
|
"BUTTON_LABEL": "Button {index}",
|
||||||
|
"COUPON_CODE": "Enter coupon code (max 15 chars)",
|
||||||
|
"MEDIA_URL_LABEL": "Enter {type} URL",
|
||||||
|
"BUTTON_PARAMETER": "Enter button parameter"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
"CONVERSATION_CREATED": "Conversation Created",
|
"CONVERSATION_CREATED": "Conversation Created",
|
||||||
"CONVERSATION_UPDATED": "Conversation Updated",
|
"CONVERSATION_UPDATED": "Conversation Updated",
|
||||||
"MESSAGE_CREATED": "Message Created",
|
"MESSAGE_CREATED": "Message Created",
|
||||||
|
"CONVERSATION_RESOLVED": "Conversation Resolved",
|
||||||
"CONVERSATION_OPENED": "Conversation Opened"
|
"CONVERSATION_OPENED": "Conversation Opened"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
"AGENTS_LOADING": "Loading agents...",
|
"AGENTS_LOADING": "Loading agents...",
|
||||||
"ASSIGN_TEAM": "Assign team",
|
"ASSIGN_TEAM": "Assign team",
|
||||||
"DELETE": "Delete conversation",
|
"DELETE": "Delete conversation",
|
||||||
|
"OPEN_IN_NEW_TAB": "Open in new tab",
|
||||||
|
"COPY_LINK": "Copy conversation link",
|
||||||
|
"COPY_LINK_SUCCESS": "Conversation link copied to clipboard",
|
||||||
"API": {
|
"API": {
|
||||||
"AGENT_ASSIGNMENT": {
|
"AGENT_ASSIGNMENT": {
|
||||||
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
||||||
|
|||||||
@@ -157,6 +157,12 @@
|
|||||||
"DELETE_SUCCESS": "Portal deleted successfully",
|
"DELETE_SUCCESS": "Portal deleted successfully",
|
||||||
"DELETE_ERROR": "Error while deleting portal"
|
"DELETE_ERROR": "Error while deleting portal"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SEND_CNAME_INSTRUCTIONS": {
|
||||||
|
"API": {
|
||||||
|
"SUCCESS_MESSAGE": "CNAME instructions sent successfully",
|
||||||
|
"ERROR_MESSAGE": "Error while sending CNAME instructions"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -726,7 +732,7 @@
|
|||||||
"HOME_PAGE_LINK": {
|
"HOME_PAGE_LINK": {
|
||||||
"LABEL": "Home page link",
|
"LABEL": "Home page link",
|
||||||
"PLACEHOLDER": "Portal home page link",
|
"PLACEHOLDER": "Portal home page link",
|
||||||
"ERROR": "Invalid URL. The Home page link must start with 'http://' or 'https://'."
|
"ERROR": "Enter a valid URL. The Home page link must start with 'http://' or 'https://'."
|
||||||
},
|
},
|
||||||
"SLUG": {
|
"SLUG": {
|
||||||
"LABEL": "Slug",
|
"LABEL": "Slug",
|
||||||
@@ -747,9 +753,15 @@
|
|||||||
"HEADER": "Custom domain",
|
"HEADER": "Custom domain",
|
||||||
"LABEL": "Custom domain:",
|
"LABEL": "Custom domain:",
|
||||||
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
||||||
|
"STATUS_DESCRIPTION": "Your custom portal will start working as soon as it is verified.",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"EDIT_BUTTON": "Edit custom domain",
|
"EDIT_BUTTON": "Edit",
|
||||||
"ADD_BUTTON": "Add custom domain",
|
"ADD_BUTTON": "Add custom domain",
|
||||||
|
"STATUS": {
|
||||||
|
"LIVE": "Live",
|
||||||
|
"PENDING": "Awaiting verification",
|
||||||
|
"ERROR": "Verification failed"
|
||||||
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"ADD_HEADER": "Add custom domain",
|
"ADD_HEADER": "Add custom domain",
|
||||||
"EDIT_HEADER": "Edit custom domain",
|
"EDIT_HEADER": "Edit custom domain",
|
||||||
@@ -757,13 +769,20 @@
|
|||||||
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
||||||
"LABEL": "Custom domain",
|
"LABEL": "Custom domain",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"ERROR": "Custom domain is required"
|
"ERROR": "Custom domain is required",
|
||||||
|
"FORMAT_ERROR": "Please enter a valid domain URL e.g. docs.yourdomain.com"
|
||||||
},
|
},
|
||||||
"DNS_CONFIGURATION_DIALOG": {
|
"DNS_CONFIGURATION_DIALOG": {
|
||||||
"HEADER": "DNS configuration",
|
"HEADER": "DNS configuration",
|
||||||
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
||||||
"HELP_TEXT": "Once this is done, you can reach out to our support to request for the auto-generated SSL certificate.",
|
"COPY": "Successfully copied CNAME",
|
||||||
"CONFIRM_BUTTON_LABEL": "Got it!"
|
"SEND_INSTRUCTIONS": {
|
||||||
|
"HEADER": "Send instructions",
|
||||||
|
"DESCRIPTION": "If you would prefer to have someone from your development team to handle this step, you can enter email address below, and we will send them the required instructions.",
|
||||||
|
"PLACEHOLDER": "Enter their email",
|
||||||
|
"ERROR": "Enter a valid email address",
|
||||||
|
"SEND_BUTTON": "Send"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DELETE_PORTAL": {
|
"DELETE_PORTAL": {
|
||||||
|
|||||||
@@ -72,6 +72,24 @@
|
|||||||
"MARK_ALL_READ": "All notifications marked as read",
|
"MARK_ALL_READ": "All notifications marked as read",
|
||||||
"DELETE_ALL": "All notifications deleted",
|
"DELETE_ALL": "All notifications deleted",
|
||||||
"DELETE_ALL_READ": "All read notifications deleted"
|
"DELETE_ALL_READ": "All read notifications deleted"
|
||||||
|
},
|
||||||
|
"REAUTHORIZE": {
|
||||||
|
"TITLE": "Reauthorization Required",
|
||||||
|
"DESCRIPTION": "Your WhatsApp connection has expired. Please reconnect to continue receiving and sending messages.",
|
||||||
|
"BUTTON_TEXT": "Reconnect WhatsApp",
|
||||||
|
"LOADING_FACEBOOK": "Loading Facebook SDK...",
|
||||||
|
"SUCCESS": "WhatsApp reconnected successfully",
|
||||||
|
"ERROR": "Failed to reconnect WhatsApp. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"CONFIGURATION_ERROR": "Configuration error occurred during reauthorization.",
|
||||||
|
"FACEBOOK_LOAD_ERROR": "Failed to load Facebook SDK. Please try again.",
|
||||||
|
"TROUBLESHOOTING": {
|
||||||
|
"TITLE": "Troubleshooting",
|
||||||
|
"POPUP_BLOCKED": "Ensure pop-ups are allowed for this site",
|
||||||
|
"COOKIES": "Third-party cookies must be enabled",
|
||||||
|
"ADMIN_ACCESS": "You need admin access to the WhatsApp Business Account"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,6 +280,11 @@
|
|||||||
"SECURE_AUTH": "Secure OAuth based authentication",
|
"SECURE_AUTH": "Secure OAuth based authentication",
|
||||||
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
||||||
},
|
},
|
||||||
|
"LEARN_MORE": {
|
||||||
|
"TEXT": "To learn more about integrated signup, pricing, and limitations, visit",
|
||||||
|
"LINK_TEXT": "this link.",
|
||||||
|
"LINK_URL": "https://developers.facebook.com/docs/whatsapp/embedded-signup/custom-flows/onboarding-business-app-users#limitations"
|
||||||
|
},
|
||||||
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
||||||
"AUTH_PROCESSING": "Authenticating with Meta",
|
"AUTH_PROCESSING": "Authenticating with Meta",
|
||||||
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
||||||
@@ -598,6 +603,21 @@
|
|||||||
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
||||||
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
||||||
"WHATSAPP_SECTION_UPDATE_BUTTON": "Update",
|
"WHATSAPP_SECTION_UPDATE_BUTTON": "Update",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_TITLE": "WhatsApp Embedded Signup",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_SUBHEADER": "This inbox is connected through WhatsApp embedded signup.",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_DESCRIPTION": "You can reconfigure this inbox to update your WhatsApp Business settings.",
|
||||||
|
"WHATSAPP_RECONFIGURE_BUTTON": "Reconfigure",
|
||||||
|
"WHATSAPP_CONNECT_TITLE": "Connect to WhatsApp Business",
|
||||||
|
"WHATSAPP_CONNECT_SUBHEADER": "Upgrade to WhatsApp embedded signup for easier management.",
|
||||||
|
"WHATSAPP_CONNECT_DESCRIPTION": "Connect this inbox to WhatsApp Business for enhanced features and easier management.",
|
||||||
|
"WHATSAPP_CONNECT_BUTTON": "Connect",
|
||||||
|
"WHATSAPP_CONNECT_SUCCESS": "Successfully connected to WhatsApp Business!",
|
||||||
|
"WHATSAPP_CONNECT_ERROR": "Failed to connect to WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_RECONFIGURE_SUCCESS": "Successfully reconfigured WhatsApp Business!",
|
||||||
|
"WHATSAPP_RECONFIGURE_ERROR": "Failed to reconfigure WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_LOGIN_CANCELLED": "WhatsApp login was cancelled. Please try again.",
|
||||||
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
||||||
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
||||||
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
||||||
|
|||||||
@@ -472,7 +472,8 @@
|
|||||||
"FEATURES": {
|
"FEATURES": {
|
||||||
"TITLE": "Features",
|
"TITLE": "Features",
|
||||||
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
||||||
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions."
|
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions.",
|
||||||
|
"ALLOW_CITATIONS": "Include source citations in responses"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -557,6 +558,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No guardrails found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Guardrails added successfully",
|
"SUCCESS": "Guardrails added successfully",
|
||||||
@@ -604,6 +606,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No response guidelines found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Response Guidelines added successfully",
|
"SUCCESS": "Response Guidelines added successfully",
|
||||||
@@ -618,6 +621,73 @@
|
|||||||
"ERROR": "There was an error deleting response guidelines, please try again."
|
"ERROR": "There was an error deleting response guidelines, please try again."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SCENARIOS": {
|
||||||
|
"TITLE": "Scenarios",
|
||||||
|
"DESCRIPTION": "Give your assistant some context—like “what to do when a user is stuck,” or “how to act during a refund request.”",
|
||||||
|
"BREADCRUMB": {
|
||||||
|
"TITLE": "Scenarios"
|
||||||
|
},
|
||||||
|
"BULK_ACTION": {
|
||||||
|
"SELECTED": "{count} item selected | {count} items selected",
|
||||||
|
"SELECT_ALL": "Select all ({count})",
|
||||||
|
"UNSELECT_ALL": "Unselect all ({count})",
|
||||||
|
"BULK_DELETE_BUTTON": "Delete"
|
||||||
|
},
|
||||||
|
"ADD": {
|
||||||
|
"SUGGESTED": {
|
||||||
|
"TITLE": "Example scenarios",
|
||||||
|
"ADD": "Add all",
|
||||||
|
"ADD_SINGLE": "Add this",
|
||||||
|
"TOOLS_USED": "Tools used :"
|
||||||
|
},
|
||||||
|
"NEW": {
|
||||||
|
"CREATE": "Add a scenario",
|
||||||
|
"TITLE": "Create a scenario",
|
||||||
|
"FORM": {
|
||||||
|
"TITLE": {
|
||||||
|
"LABEL": "Title",
|
||||||
|
"PLACEHOLDER": "Enter a name for the scenario",
|
||||||
|
"ERROR": "Scenario name is required"
|
||||||
|
},
|
||||||
|
"DESCRIPTION": {
|
||||||
|
"LABEL": "Description",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be used",
|
||||||
|
"ERROR": "Scenario description is required"
|
||||||
|
},
|
||||||
|
"INSTRUCTION": {
|
||||||
|
"LABEL": "How to handle",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be handled",
|
||||||
|
"ERROR": "Scenario content is required"
|
||||||
|
},
|
||||||
|
"CREATE": "Create",
|
||||||
|
"CANCEL": "Cancel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"CANCEL": "Cancel",
|
||||||
|
"UPDATE": "Update changes"
|
||||||
|
},
|
||||||
|
"LIST": {
|
||||||
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
|
},
|
||||||
|
"EMPTY_MESSAGE": "No scenarios found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No scenarios found for this search.",
|
||||||
|
"API": {
|
||||||
|
"ADD": {
|
||||||
|
"SUCCESS": "Scenarios added successfully",
|
||||||
|
"ERROR": "There was an error adding scenarios, please try again."
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"SUCCESS": "Scenarios updated successfully",
|
||||||
|
"ERROR": "There was an error updating scenarios, please try again."
|
||||||
|
},
|
||||||
|
"DELETE": {
|
||||||
|
"SUCCESS": "Scenarios deleted successfully",
|
||||||
|
"ERROR": "There was an error deleting scenarios, please try again."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DOCUMENTS": {
|
"DOCUMENTS": {
|
||||||
|
|||||||
@@ -1,29 +1,46 @@
|
|||||||
{
|
{
|
||||||
"WHATSAPP_TEMPLATES": {
|
"WHATSAPP_TEMPLATES": {
|
||||||
"MODAL": {
|
"MODAL": {
|
||||||
"TITLE": "Whatsapp Templates",
|
"TITLE": "Whatsapp Templates",
|
||||||
"SUBTITLE": "Select the whatsapp template you want to send",
|
"SUBTITLE": "Select the whatsapp template you want to send",
|
||||||
"TEMPLATE_SELECTED_SUBTITLE": "Process {templateName}"
|
"TEMPLATE_SELECTED_SUBTITLE": "Configure template: {templateName}"
|
||||||
},
|
},
|
||||||
"PICKER": {
|
"PICKER": {
|
||||||
"SEARCH_PLACEHOLDER": "Search Templates",
|
"SEARCH_PLACEHOLDER": "Search Templates",
|
||||||
"NO_TEMPLATES_FOUND": "No templates found for",
|
"NO_TEMPLATES_FOUND": "No templates found for",
|
||||||
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
"HEADER": "Header",
|
||||||
"REFRESH_BUTTON": "Refresh templates",
|
"BODY": "Body",
|
||||||
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
"FOOTER": "Footer",
|
||||||
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
"BUTTONS": "Buttons",
|
||||||
"LABELS": {
|
"CATEGORY": "Category",
|
||||||
"LANGUAGE": "Language",
|
"MEDIA_CONTENT": "Media Content",
|
||||||
"TEMPLATE_BODY": "Template Body",
|
"MEDIA_CONTENT_FALLBACK": "media content",
|
||||||
"CATEGORY": "Category"
|
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
||||||
}
|
"REFRESH_BUTTON": "Refresh templates",
|
||||||
},
|
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
||||||
"PARSER": {
|
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
||||||
"VARIABLES_LABEL": "Variables",
|
"LABELS": {
|
||||||
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
"LANGUAGE": "Language",
|
||||||
"GO_BACK_LABEL": "Go Back",
|
"TEMPLATE_BODY": "Template Body",
|
||||||
"SEND_MESSAGE_LABEL": "Send Message",
|
"CATEGORY": "Category"
|
||||||
"FORM_ERROR_MESSAGE": "Please fill all variables before sending"
|
}
|
||||||
}
|
},
|
||||||
|
"PARSER": {
|
||||||
|
"VARIABLES_LABEL": "Variables",
|
||||||
|
"LANGUAGE": "Language",
|
||||||
|
"CATEGORY": "Category",
|
||||||
|
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
||||||
|
"GO_BACK_LABEL": "Go Back",
|
||||||
|
"SEND_MESSAGE_LABEL": "Send Message",
|
||||||
|
"FORM_ERROR_MESSAGE": "Please fill all variables before sending",
|
||||||
|
"MEDIA_HEADER_LABEL": "{type} Header",
|
||||||
|
"OTP_CODE": "Enter 4-8 digit OTP",
|
||||||
|
"EXPIRY_MINUTES": "Enter expiry minutes",
|
||||||
|
"BUTTON_PARAMETERS": "Button Parameters",
|
||||||
|
"BUTTON_LABEL": "Button {index}",
|
||||||
|
"COUPON_CODE": "Enter coupon code (max 15 chars)",
|
||||||
|
"MEDIA_URL_LABEL": "Enter {type} URL",
|
||||||
|
"BUTTON_PARAMETER": "Enter button parameter"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
"CONVERSATION_CREATED": "Conversation Created",
|
"CONVERSATION_CREATED": "Conversation Created",
|
||||||
"CONVERSATION_UPDATED": "Conversation Updated",
|
"CONVERSATION_UPDATED": "Conversation Updated",
|
||||||
"MESSAGE_CREATED": "Message Created",
|
"MESSAGE_CREATED": "Message Created",
|
||||||
|
"CONVERSATION_RESOLVED": "Conversation Resolved",
|
||||||
"CONVERSATION_OPENED": "Conversation Opened"
|
"CONVERSATION_OPENED": "Conversation Opened"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
"AGENTS_LOADING": "Loading agents...",
|
"AGENTS_LOADING": "Loading agents...",
|
||||||
"ASSIGN_TEAM": "Assign team",
|
"ASSIGN_TEAM": "Assign team",
|
||||||
"DELETE": "Delete conversation",
|
"DELETE": "Delete conversation",
|
||||||
|
"OPEN_IN_NEW_TAB": "Open in new tab",
|
||||||
|
"COPY_LINK": "Copy conversation link",
|
||||||
|
"COPY_LINK_SUCCESS": "Conversation link copied to clipboard",
|
||||||
"API": {
|
"API": {
|
||||||
"AGENT_ASSIGNMENT": {
|
"AGENT_ASSIGNMENT": {
|
||||||
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
"SUCCESFUL": "Conversation id {conversationId} assigned to \"{agentName}\"",
|
||||||
|
|||||||
@@ -157,6 +157,12 @@
|
|||||||
"DELETE_SUCCESS": "Portal deleted successfully",
|
"DELETE_SUCCESS": "Portal deleted successfully",
|
||||||
"DELETE_ERROR": "Error while deleting portal"
|
"DELETE_ERROR": "Error while deleting portal"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SEND_CNAME_INSTRUCTIONS": {
|
||||||
|
"API": {
|
||||||
|
"SUCCESS_MESSAGE": "CNAME instructions sent successfully",
|
||||||
|
"ERROR_MESSAGE": "Error while sending CNAME instructions"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -726,7 +732,7 @@
|
|||||||
"HOME_PAGE_LINK": {
|
"HOME_PAGE_LINK": {
|
||||||
"LABEL": "Home page link",
|
"LABEL": "Home page link",
|
||||||
"PLACEHOLDER": "Portal home page link",
|
"PLACEHOLDER": "Portal home page link",
|
||||||
"ERROR": "Invalid URL. The Home page link must start with 'http://' or 'https://'."
|
"ERROR": "Enter a valid URL. The Home page link must start with 'http://' or 'https://'."
|
||||||
},
|
},
|
||||||
"SLUG": {
|
"SLUG": {
|
||||||
"LABEL": "Slug",
|
"LABEL": "Slug",
|
||||||
@@ -747,9 +753,15 @@
|
|||||||
"HEADER": "Custom domain",
|
"HEADER": "Custom domain",
|
||||||
"LABEL": "Custom domain:",
|
"LABEL": "Custom domain:",
|
||||||
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
||||||
|
"STATUS_DESCRIPTION": "Your custom portal will start working as soon as it is verified.",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"EDIT_BUTTON": "Edit custom domain",
|
"EDIT_BUTTON": "Редактирай",
|
||||||
"ADD_BUTTON": "Add custom domain",
|
"ADD_BUTTON": "Add custom domain",
|
||||||
|
"STATUS": {
|
||||||
|
"LIVE": "Live",
|
||||||
|
"PENDING": "Awaiting verification",
|
||||||
|
"ERROR": "Verification failed"
|
||||||
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"ADD_HEADER": "Add custom domain",
|
"ADD_HEADER": "Add custom domain",
|
||||||
"EDIT_HEADER": "Edit custom domain",
|
"EDIT_HEADER": "Edit custom domain",
|
||||||
@@ -757,13 +769,20 @@
|
|||||||
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
||||||
"LABEL": "Custom domain",
|
"LABEL": "Custom domain",
|
||||||
"PLACEHOLDER": "Portal custom domain",
|
"PLACEHOLDER": "Portal custom domain",
|
||||||
"ERROR": "Custom domain is required"
|
"ERROR": "Custom domain is required",
|
||||||
|
"FORMAT_ERROR": "Please enter a valid domain URL e.g. docs.yourdomain.com"
|
||||||
},
|
},
|
||||||
"DNS_CONFIGURATION_DIALOG": {
|
"DNS_CONFIGURATION_DIALOG": {
|
||||||
"HEADER": "DNS configuration",
|
"HEADER": "DNS configuration",
|
||||||
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
||||||
"HELP_TEXT": "Once this is done, you can reach out to our support to request for the auto-generated SSL certificate.",
|
"COPY": "Successfully copied CNAME",
|
||||||
"CONFIRM_BUTTON_LABEL": "Got it!"
|
"SEND_INSTRUCTIONS": {
|
||||||
|
"HEADER": "Send instructions",
|
||||||
|
"DESCRIPTION": "If you would prefer to have someone from your development team to handle this step, you can enter email address below, and we will send them the required instructions.",
|
||||||
|
"PLACEHOLDER": "Enter their email",
|
||||||
|
"ERROR": "Enter a valid email address",
|
||||||
|
"SEND_BUTTON": "Send"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DELETE_PORTAL": {
|
"DELETE_PORTAL": {
|
||||||
|
|||||||
@@ -72,6 +72,24 @@
|
|||||||
"MARK_ALL_READ": "All notifications marked as read",
|
"MARK_ALL_READ": "All notifications marked as read",
|
||||||
"DELETE_ALL": "All notifications deleted",
|
"DELETE_ALL": "All notifications deleted",
|
||||||
"DELETE_ALL_READ": "All read notifications deleted"
|
"DELETE_ALL_READ": "All read notifications deleted"
|
||||||
|
},
|
||||||
|
"REAUTHORIZE": {
|
||||||
|
"TITLE": "Reauthorization Required",
|
||||||
|
"DESCRIPTION": "Your WhatsApp connection has expired. Please reconnect to continue receiving and sending messages.",
|
||||||
|
"BUTTON_TEXT": "Reconnect WhatsApp",
|
||||||
|
"LOADING_FACEBOOK": "Loading Facebook SDK...",
|
||||||
|
"SUCCESS": "WhatsApp reconnected successfully",
|
||||||
|
"ERROR": "Failed to reconnect WhatsApp. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"CONFIGURATION_ERROR": "Configuration error occurred during reauthorization.",
|
||||||
|
"FACEBOOK_LOAD_ERROR": "Failed to load Facebook SDK. Please try again.",
|
||||||
|
"TROUBLESHOOTING": {
|
||||||
|
"TITLE": "Troubleshooting",
|
||||||
|
"POPUP_BLOCKED": "Ensure pop-ups are allowed for this site",
|
||||||
|
"COOKIES": "Third-party cookies must be enabled",
|
||||||
|
"ADMIN_ACCESS": "You need admin access to the WhatsApp Business Account"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -280,6 +280,11 @@
|
|||||||
"SECURE_AUTH": "Secure OAuth based authentication",
|
"SECURE_AUTH": "Secure OAuth based authentication",
|
||||||
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
"AUTO_CONFIG": "Automatic webhook and phone number configuration"
|
||||||
},
|
},
|
||||||
|
"LEARN_MORE": {
|
||||||
|
"TEXT": "To learn more about integrated signup, pricing, and limitations, visit",
|
||||||
|
"LINK_TEXT": "this link.",
|
||||||
|
"LINK_URL": "https://developers.facebook.com/docs/whatsapp/embedded-signup/custom-flows/onboarding-business-app-users#limitations"
|
||||||
|
},
|
||||||
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
"SUBMIT_BUTTON": "Connect with WhatsApp Business",
|
||||||
"AUTH_PROCESSING": "Authenticating with Meta",
|
"AUTH_PROCESSING": "Authenticating with Meta",
|
||||||
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
"WAITING_FOR_BUSINESS_INFO": "Please complete business setup in the Meta window...",
|
||||||
@@ -598,6 +603,21 @@
|
|||||||
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
"WHATSAPP_SECTION_UPDATE_TITLE": "Update API Key",
|
||||||
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
"WHATSAPP_SECTION_UPDATE_PLACEHOLDER": "Enter the new API Key here",
|
||||||
"WHATSAPP_SECTION_UPDATE_BUTTON": "Обновяване",
|
"WHATSAPP_SECTION_UPDATE_BUTTON": "Обновяване",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_TITLE": "WhatsApp Embedded Signup",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_SUBHEADER": "This inbox is connected through WhatsApp embedded signup.",
|
||||||
|
"WHATSAPP_EMBEDDED_SIGNUP_DESCRIPTION": "You can reconfigure this inbox to update your WhatsApp Business settings.",
|
||||||
|
"WHATSAPP_RECONFIGURE_BUTTON": "Reconfigure",
|
||||||
|
"WHATSAPP_CONNECT_TITLE": "Connect to WhatsApp Business",
|
||||||
|
"WHATSAPP_CONNECT_SUBHEADER": "Upgrade to WhatsApp embedded signup for easier management.",
|
||||||
|
"WHATSAPP_CONNECT_DESCRIPTION": "Connect this inbox to WhatsApp Business for enhanced features and easier management.",
|
||||||
|
"WHATSAPP_CONNECT_BUTTON": "Connect",
|
||||||
|
"WHATSAPP_CONNECT_SUCCESS": "Successfully connected to WhatsApp Business!",
|
||||||
|
"WHATSAPP_CONNECT_ERROR": "Failed to connect to WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_RECONFIGURE_SUCCESS": "Successfully reconfigured WhatsApp Business!",
|
||||||
|
"WHATSAPP_RECONFIGURE_ERROR": "Failed to reconfigure WhatsApp Business. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_LOGIN_CANCELLED": "WhatsApp login was cancelled. Please try again.",
|
||||||
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
"WHATSAPP_WEBHOOK_TITLE": "Webhook Verification Token",
|
||||||
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
"WHATSAPP_WEBHOOK_SUBHEADER": "This token is used to verify the authenticity of the webhook endpoint.",
|
||||||
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
"WHATSAPP_TEMPLATES_SYNC_TITLE": "Sync Templates",
|
||||||
|
|||||||
@@ -472,7 +472,8 @@
|
|||||||
"FEATURES": {
|
"FEATURES": {
|
||||||
"TITLE": "Features",
|
"TITLE": "Features",
|
||||||
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
"ALLOW_CONVERSATION_FAQS": "Generate FAQs from resolved conversations",
|
||||||
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions."
|
"ALLOW_MEMORIES": "Capture key details as memories from customer interactions.",
|
||||||
|
"ALLOW_CITATIONS": "Include source citations in responses"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -557,6 +558,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No guardrails found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No guardrails found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Guardrails added successfully",
|
"SUCCESS": "Guardrails added successfully",
|
||||||
@@ -604,6 +606,7 @@
|
|||||||
"SEARCH_PLACEHOLDER": "Search..."
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
},
|
},
|
||||||
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
"EMPTY_MESSAGE": "No response guidelines found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No response guidelines found for this search.",
|
||||||
"API": {
|
"API": {
|
||||||
"ADD": {
|
"ADD": {
|
||||||
"SUCCESS": "Response Guidelines added successfully",
|
"SUCCESS": "Response Guidelines added successfully",
|
||||||
@@ -618,6 +621,73 @@
|
|||||||
"ERROR": "There was an error deleting response guidelines, please try again."
|
"ERROR": "There was an error deleting response guidelines, please try again."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SCENARIOS": {
|
||||||
|
"TITLE": "Scenarios",
|
||||||
|
"DESCRIPTION": "Give your assistant some context—like “what to do when a user is stuck,” or “how to act during a refund request.”",
|
||||||
|
"BREADCRUMB": {
|
||||||
|
"TITLE": "Scenarios"
|
||||||
|
},
|
||||||
|
"BULK_ACTION": {
|
||||||
|
"SELECTED": "{count} item selected | {count} items selected",
|
||||||
|
"SELECT_ALL": "Select all ({count})",
|
||||||
|
"UNSELECT_ALL": "Unselect all ({count})",
|
||||||
|
"BULK_DELETE_BUTTON": "Изтрий"
|
||||||
|
},
|
||||||
|
"ADD": {
|
||||||
|
"SUGGESTED": {
|
||||||
|
"TITLE": "Example scenarios",
|
||||||
|
"ADD": "Add all",
|
||||||
|
"ADD_SINGLE": "Add this",
|
||||||
|
"TOOLS_USED": "Tools used :"
|
||||||
|
},
|
||||||
|
"NEW": {
|
||||||
|
"CREATE": "Add a scenario",
|
||||||
|
"TITLE": "Create a scenario",
|
||||||
|
"FORM": {
|
||||||
|
"TITLE": {
|
||||||
|
"LABEL": "Title",
|
||||||
|
"PLACEHOLDER": "Enter a name for the scenario",
|
||||||
|
"ERROR": "Scenario name is required"
|
||||||
|
},
|
||||||
|
"DESCRIPTION": {
|
||||||
|
"LABEL": "Описание",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be used",
|
||||||
|
"ERROR": "Scenario description is required"
|
||||||
|
},
|
||||||
|
"INSTRUCTION": {
|
||||||
|
"LABEL": "How to handle",
|
||||||
|
"PLACEHOLDER": "Describe how and where this scenario will be handled",
|
||||||
|
"ERROR": "Scenario content is required"
|
||||||
|
},
|
||||||
|
"CREATE": "Create",
|
||||||
|
"CANCEL": "Отмени"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"CANCEL": "Отмени",
|
||||||
|
"UPDATE": "Update changes"
|
||||||
|
},
|
||||||
|
"LIST": {
|
||||||
|
"SEARCH_PLACEHOLDER": "Search..."
|
||||||
|
},
|
||||||
|
"EMPTY_MESSAGE": "No scenarios found. Create or add examples to begin.",
|
||||||
|
"SEARCH_EMPTY_MESSAGE": "No scenarios found for this search.",
|
||||||
|
"API": {
|
||||||
|
"ADD": {
|
||||||
|
"SUCCESS": "Scenarios added successfully",
|
||||||
|
"ERROR": "There was an error adding scenarios, please try again."
|
||||||
|
},
|
||||||
|
"UPDATE": {
|
||||||
|
"SUCCESS": "Scenarios updated successfully",
|
||||||
|
"ERROR": "There was an error updating scenarios, please try again."
|
||||||
|
},
|
||||||
|
"DELETE": {
|
||||||
|
"SUCCESS": "Scenarios deleted successfully",
|
||||||
|
"ERROR": "There was an error deleting scenarios, please try again."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DOCUMENTS": {
|
"DOCUMENTS": {
|
||||||
|
|||||||
@@ -1,29 +1,46 @@
|
|||||||
{
|
{
|
||||||
"WHATSAPP_TEMPLATES": {
|
"WHATSAPP_TEMPLATES": {
|
||||||
"MODAL": {
|
"MODAL": {
|
||||||
"TITLE": "Whatsapp Templates",
|
"TITLE": "Whatsapp Templates",
|
||||||
"SUBTITLE": "Select the whatsapp template you want to send",
|
"SUBTITLE": "Select the whatsapp template you want to send",
|
||||||
"TEMPLATE_SELECTED_SUBTITLE": "Process {templateName}"
|
"TEMPLATE_SELECTED_SUBTITLE": "Configure template: {templateName}"
|
||||||
},
|
},
|
||||||
"PICKER": {
|
"PICKER": {
|
||||||
"SEARCH_PLACEHOLDER": "Search Templates",
|
"SEARCH_PLACEHOLDER": "Search Templates",
|
||||||
"NO_TEMPLATES_FOUND": "No templates found for",
|
"NO_TEMPLATES_FOUND": "No templates found for",
|
||||||
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
"HEADER": "Header",
|
||||||
"REFRESH_BUTTON": "Refresh templates",
|
"BODY": "Body",
|
||||||
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
"FOOTER": "Footer",
|
||||||
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
"BUTTONS": "Buttons",
|
||||||
"LABELS": {
|
"CATEGORY": "Category",
|
||||||
"LANGUAGE": "Language",
|
"MEDIA_CONTENT": "Media Content",
|
||||||
"TEMPLATE_BODY": "Template Body",
|
"MEDIA_CONTENT_FALLBACK": "media content",
|
||||||
"CATEGORY": "Category"
|
"NO_TEMPLATES_AVAILABLE": "No WhatsApp templates available. Click refresh to sync templates from WhatsApp.",
|
||||||
}
|
"REFRESH_BUTTON": "Refresh templates",
|
||||||
},
|
"REFRESH_SUCCESS": "Templates refresh initiated. It may take a couple of minutes to update.",
|
||||||
"PARSER": {
|
"REFRESH_ERROR": "Failed to refresh templates. Please try again.",
|
||||||
"VARIABLES_LABEL": "Variables",
|
"LABELS": {
|
||||||
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
"LANGUAGE": "Language",
|
||||||
"GO_BACK_LABEL": "Go Back",
|
"TEMPLATE_BODY": "Template Body",
|
||||||
"SEND_MESSAGE_LABEL": "Send Message",
|
"CATEGORY": "Category"
|
||||||
"FORM_ERROR_MESSAGE": "Please fill all variables before sending"
|
}
|
||||||
}
|
},
|
||||||
|
"PARSER": {
|
||||||
|
"VARIABLES_LABEL": "Variables",
|
||||||
|
"LANGUAGE": "Language",
|
||||||
|
"CATEGORY": "Category",
|
||||||
|
"VARIABLE_PLACEHOLDER": "Enter {variable} value",
|
||||||
|
"GO_BACK_LABEL": "Go Back",
|
||||||
|
"SEND_MESSAGE_LABEL": "Send Message",
|
||||||
|
"FORM_ERROR_MESSAGE": "Please fill all variables before sending",
|
||||||
|
"MEDIA_HEADER_LABEL": "{type} Header",
|
||||||
|
"OTP_CODE": "Enter 4-8 digit OTP",
|
||||||
|
"EXPIRY_MINUTES": "Enter expiry minutes",
|
||||||
|
"BUTTON_PARAMETERS": "Button Parameters",
|
||||||
|
"BUTTON_LABEL": "Button {index}",
|
||||||
|
"COUPON_CODE": "Enter coupon code (max 15 chars)",
|
||||||
|
"MEDIA_URL_LABEL": "Enter {type} URL",
|
||||||
|
"BUTTON_PARAMETER": "Enter button parameter"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
"CONVERSATION_CREATED": "Conversa Creada",
|
"CONVERSATION_CREATED": "Conversa Creada",
|
||||||
"CONVERSATION_UPDATED": "Conversa Actualitzada",
|
"CONVERSATION_UPDATED": "Conversa Actualitzada",
|
||||||
"MESSAGE_CREATED": "Message Created",
|
"MESSAGE_CREATED": "Message Created",
|
||||||
|
"CONVERSATION_RESOLVED": "Conversation Resolved",
|
||||||
"CONVERSATION_OPENED": "Conversation Opened"
|
"CONVERSATION_OPENED": "Conversation Opened"
|
||||||
},
|
},
|
||||||
"ACTIONS": {
|
"ACTIONS": {
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
"AGENTS_LOADING": "S'estan carregant els agents...",
|
"AGENTS_LOADING": "S'estan carregant els agents...",
|
||||||
"ASSIGN_TEAM": "Assigna un equip",
|
"ASSIGN_TEAM": "Assigna un equip",
|
||||||
"DELETE": "Delete conversation",
|
"DELETE": "Delete conversation",
|
||||||
|
"OPEN_IN_NEW_TAB": "Open in new tab",
|
||||||
|
"COPY_LINK": "Copy conversation link",
|
||||||
|
"COPY_LINK_SUCCESS": "Conversation link copied to clipboard",
|
||||||
"API": {
|
"API": {
|
||||||
"AGENT_ASSIGNMENT": {
|
"AGENT_ASSIGNMENT": {
|
||||||
"SUCCESFUL": "Id de conversa {conversationId} assignat a \"{agentName}\"",
|
"SUCCESFUL": "Id de conversa {conversationId} assignat a \"{agentName}\"",
|
||||||
|
|||||||
@@ -157,6 +157,12 @@
|
|||||||
"DELETE_SUCCESS": "Portal esborrat correctament",
|
"DELETE_SUCCESS": "Portal esborrat correctament",
|
||||||
"DELETE_ERROR": "S'ha produït un error en suprimir el portal"
|
"DELETE_ERROR": "S'ha produït un error en suprimir el portal"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"SEND_CNAME_INSTRUCTIONS": {
|
||||||
|
"API": {
|
||||||
|
"SUCCESS_MESSAGE": "CNAME instructions sent successfully",
|
||||||
|
"ERROR_MESSAGE": "Error while sending CNAME instructions"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"EDIT": {
|
"EDIT": {
|
||||||
@@ -726,7 +732,7 @@
|
|||||||
"HOME_PAGE_LINK": {
|
"HOME_PAGE_LINK": {
|
||||||
"LABEL": "Home page link",
|
"LABEL": "Home page link",
|
||||||
"PLACEHOLDER": "Enllaç a la pàgina d'inici del portal",
|
"PLACEHOLDER": "Enllaç a la pàgina d'inici del portal",
|
||||||
"ERROR": "Invalid URL. The Home page link must start with 'http://' or 'https://'."
|
"ERROR": "Enter a valid URL. The Home page link must start with 'http://' or 'https://'."
|
||||||
},
|
},
|
||||||
"SLUG": {
|
"SLUG": {
|
||||||
"LABEL": "Slug",
|
"LABEL": "Slug",
|
||||||
@@ -747,9 +753,15 @@
|
|||||||
"HEADER": "Domini personalitzat",
|
"HEADER": "Domini personalitzat",
|
||||||
"LABEL": "Domini personalitzat:",
|
"LABEL": "Domini personalitzat:",
|
||||||
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
"DESCRIPTION": "You can host your portal on a custom domain. For instance, if your website is yourdomain.com and you want your portal available at docs.yourdomain.com, simply enter that in this field.",
|
||||||
|
"STATUS_DESCRIPTION": "Your custom portal will start working as soon as it is verified.",
|
||||||
"PLACEHOLDER": "Domini personalitzat del portal",
|
"PLACEHOLDER": "Domini personalitzat del portal",
|
||||||
"EDIT_BUTTON": "Edit custom domain",
|
"EDIT_BUTTON": "Edita",
|
||||||
"ADD_BUTTON": "Add custom domain",
|
"ADD_BUTTON": "Add custom domain",
|
||||||
|
"STATUS": {
|
||||||
|
"LIVE": "En directe",
|
||||||
|
"PENDING": "Awaiting verification",
|
||||||
|
"ERROR": "Verification failed"
|
||||||
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"ADD_HEADER": "Add custom domain",
|
"ADD_HEADER": "Add custom domain",
|
||||||
"EDIT_HEADER": "Edit custom domain",
|
"EDIT_HEADER": "Edit custom domain",
|
||||||
@@ -757,13 +769,20 @@
|
|||||||
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
"EDIT_CONFIRM_BUTTON_LABEL": "Update domain",
|
||||||
"LABEL": "Domini personalitzat",
|
"LABEL": "Domini personalitzat",
|
||||||
"PLACEHOLDER": "Domini personalitzat del portal",
|
"PLACEHOLDER": "Domini personalitzat del portal",
|
||||||
"ERROR": "Custom domain is required"
|
"ERROR": "Custom domain is required",
|
||||||
|
"FORMAT_ERROR": "Please enter a valid domain URL e.g. docs.yourdomain.com"
|
||||||
},
|
},
|
||||||
"DNS_CONFIGURATION_DIALOG": {
|
"DNS_CONFIGURATION_DIALOG": {
|
||||||
"HEADER": "DNS configuration",
|
"HEADER": "DNS configuration",
|
||||||
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
"DESCRIPTION": "Log in to the account you have with your DNS provider, and add a CNAME record for subdomain pointing to chatwoot.help",
|
||||||
"HELP_TEXT": "Once this is done, you can reach out to our support to request for the auto-generated SSL certificate.",
|
"COPY": "Successfully copied CNAME",
|
||||||
"CONFIRM_BUTTON_LABEL": "Got it!"
|
"SEND_INSTRUCTIONS": {
|
||||||
|
"HEADER": "Send instructions",
|
||||||
|
"DESCRIPTION": "If you would prefer to have someone from your development team to handle this step, you can enter email address below, and we will send them the required instructions.",
|
||||||
|
"PLACEHOLDER": "Enter their email",
|
||||||
|
"ERROR": "Enter a valid email address",
|
||||||
|
"SEND_BUTTON": "Envia"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DELETE_PORTAL": {
|
"DELETE_PORTAL": {
|
||||||
|
|||||||
@@ -72,6 +72,24 @@
|
|||||||
"MARK_ALL_READ": "Totes les notificacions s'han marcat com a llegides",
|
"MARK_ALL_READ": "Totes les notificacions s'han marcat com a llegides",
|
||||||
"DELETE_ALL": "S'han suprimit totes les notificacions",
|
"DELETE_ALL": "S'han suprimit totes les notificacions",
|
||||||
"DELETE_ALL_READ": "S'han suprimit totes les notificacions de lectura"
|
"DELETE_ALL_READ": "S'han suprimit totes les notificacions de lectura"
|
||||||
|
},
|
||||||
|
"REAUTHORIZE": {
|
||||||
|
"TITLE": "Reauthorization Required",
|
||||||
|
"DESCRIPTION": "Your WhatsApp connection has expired. Please reconnect to continue receiving and sending messages.",
|
||||||
|
"BUTTON_TEXT": "Reconnect WhatsApp",
|
||||||
|
"LOADING_FACEBOOK": "Loading Facebook SDK...",
|
||||||
|
"SUCCESS": "WhatsApp reconnected successfully",
|
||||||
|
"ERROR": "Failed to reconnect WhatsApp. Please try again.",
|
||||||
|
"WHATSAPP_APP_ID_MISSING": "WhatsApp App ID is not configured. Please contact your administrator.",
|
||||||
|
"WHATSAPP_CONFIG_ID_MISSING": "WhatsApp Configuration ID is not configured. Please contact your administrator.",
|
||||||
|
"CONFIGURATION_ERROR": "Configuration error occurred during reauthorization.",
|
||||||
|
"FACEBOOK_LOAD_ERROR": "Failed to load Facebook SDK. Please try again.",
|
||||||
|
"TROUBLESHOOTING": {
|
||||||
|
"TITLE": "Troubleshooting",
|
||||||
|
"POPUP_BLOCKED": "Ensure pop-ups are allowed for this site",
|
||||||
|
"COOKIES": "Third-party cookies must be enabled",
|
||||||
|
"ADMIN_ACCESS": "You need admin access to the WhatsApp Business Account"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user