Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled

- Add Logistics component with progress tracking
- Add OrderDetail component for order information
- Support data-driven steps and actions
- Add blue color scale to widget SCSS
- Fix node overflow and progress bar rendering issues
- Add English translations for dashboard components

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Liang XJ
2026-01-26 11:16:56 +08:00
commit 092fb2e083
7646 changed files with 975643 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
json.partial! 'api/v1/models/agent_capacity_policy', formats: [:json],
agent_capacity_policy: @agent_capacity_policy

View File

@@ -0,0 +1,6 @@
json.id @inbox_limit.id
json.inbox_id @inbox_limit.inbox_id
json.agent_capacity_policy_id @inbox_limit.agent_capacity_policy_id
json.conversation_limit @inbox_limit.conversation_limit
json.created_at @inbox_limit.created_at.to_i
json.updated_at @inbox_limit.updated_at.to_i

View File

@@ -0,0 +1,7 @@
json.id @inbox_limit.id
json.inbox_id @inbox_limit.inbox_id
json.inbox_name @inbox_limit.inbox.name
json.agent_capacity_policy_id @agent_capacity_policy.id
json.conversation_limit @inbox_limit.conversation_limit
json.created_at @inbox_limit.created_at.to_i
json.updated_at @inbox_limit.updated_at.to_i

View File

@@ -0,0 +1,4 @@
json.array! @agent_capacity_policies do |policy|
json.partial! 'api/v1/models/agent_capacity_policy', formats: [:json],
agent_capacity_policy: policy
end

View File

@@ -0,0 +1,2 @@
json.partial! 'api/v1/models/agent_capacity_policy', formats: [:json],
agent_capacity_policy: @agent_capacity_policy

View File

@@ -0,0 +1,2 @@
json.partial! 'api/v1/models/agent_capacity_policy', formats: [:json],
agent_capacity_policy: @agent_capacity_policy

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/user', resource: @user

View File

@@ -0,0 +1,3 @@
json.array! @users do |user|
json.partial! 'api/v1/models/user', resource: user
end

View File

@@ -0,0 +1,26 @@
<% headers = [
I18n.t('reports.sla_csv.conversation_id'),
I18n.t('reports.sla_csv.sla_policy_breached'),
I18n.t('reports.sla_csv.assignee'),
I18n.t('reports.sla_csv.team'),
I18n.t('reports.sla_csv.inbox'),
I18n.t('reports.sla_csv.labels'),
I18n.t('reports.sla_csv.conversation_link'),
I18n.t('reports.sla_csv.breached_events')
] %>
<%= CSV.generate_line headers %>
<% @missed_applied_slas.each do |sla| %>
<% missed_events = sla.sla_events.map(&:event_type).join(', ') %>
<% conversation = sla.conversation %>
<%= CSV.generate_line([
conversation.display_id,
sla.sla_policy.name,
conversation.assignee&.name,
conversation.team&.name,
conversation.inbox&.name,
conversation.cached_label_list,
app_account_conversation_url(account_id: conversation.account_id, id: conversation.display_id),
missed_events
]) %>
<% end %>

View File

@@ -0,0 +1,22 @@
json.payload do
json.array! @applied_slas do |applied_sla|
json.applied_sla applied_sla.push_event_data
json.conversation do
conversation = applied_sla.conversation
json.id conversation.display_id
json.contact do
json.name conversation.contact.name if conversation.contact
end
json.labels conversation.cached_label_list
json.assignee conversation.assignee.push_event_data if conversation.assignee
end
json.sla_events applied_sla.sla_events do |sla_event|
json.partial! 'api/v1/models/sla_event', formats: [:json], sla_event: sla_event
end
end
end
json.meta do
json.count @count
json.current_page @current_page
end

View File

@@ -0,0 +1,3 @@
json.total_applied_slas @total_applied_slas
json.number_of_sla_misses @number_of_sla_misses
json.hit_rate @hit_rate

View File

@@ -0,0 +1,24 @@
json.per_page @per_page
json.total_entries @total_entries
json.current_page @current_page
json.audit_logs do
json.array! @audit_logs do |audit_log|
json.id audit_log.id
json.auditable_id audit_log.auditable_id
json.auditable_type audit_log.auditable_type
json.auditable audit_log.auditable.try(:push_event_data)
json.associated_id audit_log.associated_id
json.associated_type audit_log.associated_type
json.user_id audit_log.user_id
json.user_type audit_log.user_type
json.username audit_log.username
json.action audit_log.action
json.audited_changes audit_log.audited_changes
json.version audit_log.version
json.comment audit_log.comment
json.request_uuid audit_log.request_uuid
json.created_at audit_log.created_at.to_i
json.remote_address audit_log.remote_address
end
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @responses do |response|
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: response
end
end
json.meta do
json.total_count @responses_count
json.page @current_page
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: @response

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @assistants do |assistant|
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: assistant
end
end
json.meta do
json.total_count @assistants.count
json.page 1 # Pagination not yet support at the moment, structure is reserved for future use
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1,6 @@
json.array! @tools do |tool|
json.id tool[:id]
json.title tool[:title]
json.description tool[:description]
json.icon tool[:icon]
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: @assistant

View File

@@ -0,0 +1,3 @@
json.array! @responses do |response|
json.partial! 'api/v1/models/captain/assistant_response', formats: [:json], resource: response
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/copilot_message', formats: [:json], resource: @copilot_message

View File

@@ -0,0 +1,5 @@
json.payload do
json.array! @copilot_messages do |message|
json.partial! 'api/v1/models/captain/copilot_message', formats: [:json], resource: message
end
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/copilot_thread', formats: [:json], resource: @copilot_thread

View File

@@ -0,0 +1,5 @@
json.payload do
json.array! @copilot_threads do |thread|
json.partial! 'api/v1/models/captain/copilot_thread', resource: thread
end
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/custom_tool', custom_tool: @custom_tool

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @custom_tools do |custom_tool|
json.partial! 'api/v1/models/captain/custom_tool', custom_tool: custom_tool
end
end
json.meta do
json.total_count @custom_tools.count
json.page 1
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/custom_tool', custom_tool: @custom_tool

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/custom_tool', custom_tool: @custom_tool

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: @document

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @documents do |document|
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: document
end
end
json.meta do
json.total_count @documents_count
json.page @current_page
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/document', formats: [:json], resource: @document

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/inbox', formats: [:json], resource: @captain_inbox.inbox

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @inboxes do |inbox|
json.partial! 'api/v1/models/inbox', formats: [:json], resource: inbox
end
end
json.meta do
json.total_count @inboxes.count
json.page 1
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/scenario', scenario: @scenario

View File

@@ -0,0 +1,10 @@
json.payload do
json.array! @scenarios do |scenario|
json.partial! 'api/v1/models/captain/scenario', scenario: scenario
end
end
json.meta do
json.total_count @scenarios.count
json.page 1
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/scenario', scenario: @scenario

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/captain/scenario', scenario: @scenario

View File

@@ -0,0 +1,8 @@
json.id company.id
json.name company.name
json.contacts_count company.contacts_count
json.domain company.domain
json.description company.description
json.avatar_url company.avatar_url
json.created_at company.created_at
json.updated_at company.updated_at

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'company', company: @company
end

View File

@@ -0,0 +1,10 @@
json.meta do
json.total_count @companies_count
json.page @current_page
end
json.payload do
json.array! @companies do |company|
json.partial! 'company', company: company
end
end

View File

@@ -0,0 +1,10 @@
json.meta do
json.total_count @companies_count
json.page @current_page
end
json.payload do
json.array! @companies do |company|
json.partial! 'company', company: company
end
end

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'company', company: @company
end

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'company', company: @company
end

View File

@@ -0,0 +1,3 @@
json.array! @reporting_events do |reporting_event|
json.partial! 'api/v1/models/reporting_event', formats: [:json], reporting_event: reporting_event
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/custom_role', formats: [:json], custom_role: @custom_role

View File

@@ -0,0 +1,3 @@
json.array! @custom_roles do |custom_role|
json.partial! 'api/v1/models/custom_role', formats: [:json], custom_role: custom_role
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/custom_role', formats: [:json], custom_role: @custom_role

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/custom_role', formats: [:json], custom_role: @custom_role

View File

@@ -0,0 +1,11 @@
json.payload do
json.array! @reporting_events do |reporting_event|
json.partial! 'api/v1/models/reporting_event', formats: [:json], reporting_event: reporting_event
end
end
json.meta do
json.count @total_count
json.current_page @current_page
json.total_pages @reporting_events.total_pages
end

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/account_saml_settings', account_saml_settings: @saml_settings

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/account_saml_settings', account_saml_settings: @saml_settings

View File

@@ -0,0 +1 @@
json.partial! 'api/v1/models/account_saml_settings', account_saml_settings: @saml_settings

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'api/v1/models/sla_policy', formats: [:json], sla_policy: @sla_policy
end

View File

@@ -0,0 +1,5 @@
json.payload do
json.array! @sla_policies do |sla_policy|
json.partial! 'api/v1/models/sla_policy', formats: [:json], sla_policy: sla_policy
end
end

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'api/v1/models/sla_policy', formats: [:json], sla_policy: @sla_policy
end

View File

@@ -0,0 +1,3 @@
json.payload do
json.partial! 'api/v1/models/sla_policy', formats: [:json], sla_policy: @sla_policy
end

View File

@@ -0,0 +1,10 @@
json.id account_saml_settings.id
json.account_id account_saml_settings.account_id
json.sso_url account_saml_settings.sso_url
json.certificate account_saml_settings.certificate
json.fingerprint account_saml_settings.certificate_fingerprint
json.idp_entity_id account_saml_settings.idp_entity_id
json.sp_entity_id account_saml_settings.sp_entity_id
json.role_mappings account_saml_settings.role_mappings || {}
json.created_at account_saml_settings.created_at
json.updated_at account_saml_settings.updated_at

View File

@@ -0,0 +1,2 @@
json.custom_role_id account_user&.custom_role_id
json.custom_role account_user&.custom_role&.as_json(only: [:id, :name, :description, :permissions])

View File

@@ -0,0 +1,14 @@
json.id agent_capacity_policy.id
json.name agent_capacity_policy.name
json.description agent_capacity_policy.description
json.exclusion_rules agent_capacity_policy.exclusion_rules
json.created_at agent_capacity_policy.created_at.to_i
json.updated_at agent_capacity_policy.updated_at.to_i
json.account_id agent_capacity_policy.account_id
json.assigned_agent_count agent_capacity_policy.account_users.count
json.inbox_capacity_limits agent_capacity_policy.inbox_capacity_limits do |limit|
json.id limit.id
json.inbox_id limit.inbox_id
json.conversation_limit limit.conversation_limit
end

View File

@@ -0,0 +1,11 @@
json.id resource.id
json.sla_id resource.sla_policy_id
json.sla_status resource.sla_status
json.created_at resource.created_at.to_i
json.updated_at resource.updated_at.to_i
json.sla_description resource.sla_policy.description
json.sla_name resource.sla_policy.name
json.sla_first_response_time_threshold resource.sla_policy.first_response_time_threshold
json.sla_next_response_time_threshold resource.sla_policy.next_response_time_threshold
json.sla_only_during_business_hours resource.sla_policy.only_during_business_hours
json.sla_resolution_time_threshold resource.sla_policy.resolution_time_threshold

View File

@@ -0,0 +1,6 @@
json.id custom_role.id
json.name custom_role.name
json.description custom_role.description
json.permissions custom_role.permissions
json.created_at custom_role.created_at
json.updated_at custom_role.updated_at

View File

@@ -0,0 +1,12 @@
json.id reporting_event.id
json.name reporting_event.name
json.value reporting_event.value
json.value_in_business_hours reporting_event.value_in_business_hours
json.event_start_time reporting_event.event_start_time
json.event_end_time reporting_event.event_end_time
json.account_id reporting_event.account_id
json.inbox_id reporting_event.inbox_id
json.user_id reporting_event.user_id
json.conversation_id reporting_event.conversation_id
json.created_at reporting_event.created_at
json.updated_at reporting_event.updated_at

View File

@@ -0,0 +1,5 @@
json.id sla_event.id
json.event_type sla_event.event_type
json.meta sla_event.meta
json.updated_at sla_event.updated_at.to_i
json.created_at sla_event.created_at.to_i

View File

@@ -0,0 +1,7 @@
json.id sla_policy.id
json.name sla_policy.name
json.description sla_policy.description
json.first_response_time_threshold sla_policy.first_response_time_threshold
json.next_response_time_threshold sla_policy.next_response_time_threshold
json.resolution_time_threshold sla_policy.resolution_time_threshold
json.only_during_business_hours sla_policy.only_during_business_hours

View File

@@ -0,0 +1,9 @@
json.account_id resource.account_id
json.config resource.config
json.created_at resource.created_at.to_i
json.description resource.description
json.guardrails resource.guardrails
json.id resource.id
json.name resource.name
json.response_guidelines resource.response_guidelines
json.updated_at resource.updated_at.to_i

View File

@@ -0,0 +1,31 @@
json.account_id resource.account_id
json.answer resource.answer
json.assistant do
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: resource.assistant
end
json.created_at resource.created_at.to_i
if resource.documentable
json.documentable do
json.type resource.documentable_type
case resource.documentable_type
when 'Captain::Document'
json.id resource.documentable.id
json.external_link resource.documentable.external_link
json.name resource.documentable.name
when 'Conversation'
json.id resource.documentable.display_id
json.display_id resource.documentable.display_id
when 'User'
json.id resource.documentable.id
json.email resource.documentable.email
json.available_name resource.documentable.available_name
end
end
end
json.id resource.id
json.question resource.question
json.updated_at resource.updated_at.to_i
json.status resource.status

View File

@@ -0,0 +1,6 @@
json.id resource.id
json.message resource.message
json.message_type resource.message_type
json.created_at resource.created_at.to_i
json.copilot_thread resource.copilot_thread.push_event_data
json.account_id resource.account_id

View File

@@ -0,0 +1,6 @@
json.id resource.id
json.title resource.title
json.created_at resource.created_at.to_i
json.user resource.user.push_event_data
json.assistant resource.assistant.push_event_data
json.account_id resource.account_id

View File

@@ -0,0 +1,15 @@
json.id custom_tool.id
json.slug custom_tool.slug
json.title custom_tool.title
json.description custom_tool.description
json.endpoint_url custom_tool.endpoint_url
json.http_method custom_tool.http_method
json.request_template custom_tool.request_template
json.response_template custom_tool.response_template
json.auth_type custom_tool.auth_type
json.auth_config custom_tool.auth_config
json.param_schema custom_tool.param_schema
json.enabled custom_tool.enabled
json.account_id custom_tool.account_id
json.created_at custom_tool.created_at.to_i
json.updated_at custom_tool.updated_at.to_i

View File

@@ -0,0 +1,14 @@
json.account_id resource.account_id
json.assistant do
json.partial! 'api/v1/models/captain/assistant', formats: [:json], resource: resource.assistant
end
json.content resource.content
json.content_type resource.content_type
json.created_at resource.created_at.to_i
json.external_link resource.external_link
json.display_url resource.display_url
json.file_size resource.file_size
json.id resource.id
json.name resource.name
json.status resource.status
json.updated_at resource.updated_at.to_i

View File

@@ -0,0 +1,16 @@
json.id scenario.id
json.title scenario.title
json.description scenario.description
json.instruction scenario.instruction
json.tools scenario.tools
json.enabled scenario.enabled
json.assistant_id scenario.assistant_id
json.account_id scenario.account_id
json.created_at scenario.created_at
json.updated_at scenario.updated_at
if scenario.assistant.present?
json.assistant do
json.id scenario.assistant.id
json.name scenario.assistant.name
end
end

View File

@@ -0,0 +1,45 @@
<p>Hi <%= @resource.name %>,</p>
<% account_user = @resource&.account_users&.first %>
<% is_saml_account = account_user&.account&.saml_enabled? %>
<% if account_user&.inviter.present? && @resource.unconfirmed_email.blank? %>
<% if is_saml_account %>
<p><%= account_user.inviter.name %>, with <%= account_user.account.name %>, has invited you to access <%= global_config['BRAND_NAME'] || 'Chatwoot' %> via Single Sign-On (SSO).</p>
<p>Your organization uses SSO for secure authentication. You will not need a password to access your account.</p>
<% else %>
<p><%= account_user.inviter.name %>, with <%= account_user.account.name %>, has invited you to try out <%= global_config['BRAND_NAME'] || 'Chatwoot' %>.</p>
<% end %>
<% end %>
<% if @resource.confirmed? %>
<p>You can login to your <%= global_config['BRAND_NAME'] || 'Chatwoot' %> account through the link below:</p>
<% else %>
<% if account_user&.inviter.blank? %>
<p>
Welcome to <%= global_config['BRAND_NAME'] || 'Chatwoot' %>! We have a suite of powerful tools ready for you to explore. Before that we quickly need to verify your email address to know it's really you.
</p>
<% end %>
<% unless is_saml_account %>
<p>Please take a moment and click the link below and activate your account.</p>
<% end %>
<% end %>
<% if @resource.unconfirmed_email.present? %>
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
<% elsif @resource.confirmed? %>
<% if is_saml_account %>
<p>You can now access your account by logging in through your organization's SSO portal.</p>
<% else %>
<p><%= link_to 'Login to my account', frontend_url('auth/sign_in') %></p>
<% end %>
<% elsif account_user&.inviter.present? %>
<% if is_saml_account %>
<p>You can access your account by logging in through your organization's SSO portal.</p>
<% else %>
<p><%= link_to 'Confirm my account', frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %></p>
<% end %>
<% else %>
<p><%= link_to 'Confirm my account', frontend_url('auth/confirmation', confirmation_token: @token) %></p>
<% end %>

View File

@@ -0,0 +1 @@
json.subscribed_features @account.subscribed_features

View File

@@ -0,0 +1,10 @@
if conversation.account.feature_enabled?('sla')
json.applied_sla do
json.partial! 'api/v1/models/applied_sla', formats: [:json], resource: conversation.applied_sla if conversation.applied_sla.present?
end
json.sla_events do
json.array! conversation.sla_events do |sla_event|
json.partial! 'api/v1/models/sla_event', formats: [:json], sla_event: sla_event
end
end
end

View File

@@ -0,0 +1,34 @@
<div class="field-unit__label">
<%= f.label field.attribute %>
</div>
<div class="field-unit__field feature-container">
<% regular_features, premium_features = SuperAdmin::AccountFeaturesHelper.filtered_features(field.data).partition { |key_array, _val| !SuperAdmin::AccountFeaturesHelper.account_premium_features.include?(key_array.first) } %>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<% regular_features.each do |key_array, val| %>
<% feature_key, display_name = key_array %>
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
<span class="text-sm text-slate-700"><%= display_name %></span>
<span><%= check_box "enabled_features", "feature_#{feature_key}", { checked: val, class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" }, true, false %></span>
</div>
<% end %>
</div>
<hr class="my-8 boshadow-sm outline outline-1 outline-n-container">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<% premium_features.each do |key_array, val| %>
<% feature_key, display_name = key_array %>
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
<div class="flex items-center gap-2">
<span class="text-amber-500">
<svg class="h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M480 224l-186.828 7.487L401.688 64l-59.247-32L256 208 169.824 32l-59.496 32 108.5 167.487L32 224v64l185.537-10.066L113.65 448l55.969 32L256 304l86.381 176 55.949-32-103.867-170.066L480 288z" fill="currentColor"/></svg>
</span>
<span class="text-sm text-slate-700"><%= display_name %></span>
</div>
<% should_disable = ChatwootHub.pricing_plan == 'community' %>
<span><%= check_box "enabled_features", "feature_#{feature_key}", { checked: val, disabled: should_disable, class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" }, true, false %></span>
</div>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,34 @@
<div class="w-full">
<% regular_features, premium_features = SuperAdmin::AccountFeaturesHelper.partition_features(field.data) %>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
<% regular_features.each do |key_array, val| %>
<% feature_key, display_name = key_array %>
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
<span class="text-sm text-n-slate-12"><%= display_name %></span>
<span class="<%= val.present? ? 'bg-green-400 text-white': 'bg-slate-50 text-slate-800' %> rounded-full p-1 inline-flex right-4 top-5">
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
</span>
</div>
<% end %>
</div>
<hr class="my-8 border-t border-n-weak">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
<% premium_features.each do |key_array, val| %>
<% feature_key, display_name = key_array %>
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
<div class="flex items-center gap-2">
<span class="bg-n-amber-3 text-n-amber-12 rounded-full p-1 inline-flex right-4 top-5">
<svg width="12" height="12"><use xlink:href="#icon-lock-line" /></svg>
</span>
<span class="text-sm text-n-slate-12"><%= display_name %></span>
</div>
<span class="<%= val.present? ? 'bg-green-400 text-white': 'bg-slate-50 text-slate-800' %> rounded-full p-1 inline-flex right-4 top-5">
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
</span>
</div>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,9 @@
<div class="field-unit__label">
<%= f.label field.attribute %>
</div>
<div class="field-unit__field">
<% JSON.parse(field.to_s).each do |key,val| %>
<%= key %>: <%= number_field "account[limits]", key, value: val %> </br>
<% end %>
</div>

View File

@@ -0,0 +1 @@
<%= field.to_s %>

View File

@@ -0,0 +1,3 @@
<% JSON.parse(field.to_s).each do |k,v| %>
<%= k %>: <%= v %> </br>
<% end %>

View File

@@ -0,0 +1,41 @@
<%
# Get all feature names and their display names
all_feature_display_names = SuperAdmin::AccountFeaturesHelper.feature_display_names
# Business and Enterprise plan features only
premium_features = Enterprise::Billing::HandleStripeEventService::BUSINESS_PLAN_FEATURES +
Enterprise::Billing::HandleStripeEventService::ENTERPRISE_PLAN_FEATURES
# Get only premium features with display names
premium_features_with_display = premium_features.map do |feature|
[feature, all_feature_display_names[feature] || feature.humanize]
end.sort_by { |_, display_name| display_name }
# Get already selected features
selected_features = field.selected_features
%>
<div class="field-unit__label">
<%= f.label :manually_managed_features %>
</div>
<div class="field-unit__field feature-container">
<p class="text-gray-400 text-xs italic mb-4">Features that remain enabled even when account plan is downgraded</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<% premium_features_with_display.each do |feature_key, display_name| %>
<div class="flex items-center justify-between p-3 bg-white rounded-lg shadow-sm outline outline-1 outline-n-container">
<span class="text-sm text-slate-700"><%= display_name %></span>
<span>
<%= check_box_tag "account[manually_managed_features][]",
feature_key,
selected_features.include?(feature_key),
class: "h-4 w-4 rounded border-slate-300 text-violet-600 focus:ring-violet-600" %>
</span>
</div>
<% end %>
</div>
<hr class="my-8 border-t border-n-weak">
<%= hidden_field_tag "account[manually_managed_features][]", "", id: nil %>
</div>

View File

@@ -0,0 +1,31 @@
<%
selected_features = field.selected_features
# Get all feature names and their display names
all_feature_display_names = SuperAdmin::AccountFeaturesHelper.feature_display_names
# Business and Enterprise plan features only
premium_features = Enterprise::Billing::HandleStripeEventService::BUSINESS_PLAN_FEATURES +
Enterprise::Billing::HandleStripeEventService::ENTERPRISE_PLAN_FEATURES
%>
<% if selected_features.present? %>
<div class="w-full">
<p class="text-gray-400 text-xs italic mb-2">Features that remain enabled even when account plan is downgraded</p>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
<% selected_features.each do |feature| %>
<div class="flex items-center justify-between p-3 bg-white rounded-md outline outline-n-container outline-1 shadow-sm">
<span class="text-sm text-n-slate-12"><%= all_feature_display_names[feature] || feature.humanize %></span>
<span class="bg-green-400 text-white rounded-full p-1 inline-flex right-4 top-5">
<svg width="12" height="12"><use xlink:href="#icon-tick-line" /></svg>
</span>
</div>
<% end %>
</div>
<hr class="my-8 border-t border-n-weak">
</div>
<% else %>
<p class="text-gray-400 text-xs italic">No manually managed features configured</p>
<% end %>