Files
assistant-storefront/db/seeds.rb
Liang XJ 092fb2e083
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
Initial commit: Add logistics and order_detail message types
- 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>
2026-01-26 11:16:56 +08:00

98 lines
2.9 KiB
Ruby

# loading installation configs
GlobalConfig.clear_cache
ConfigLoader.new.process
## Seeds productions
if Rails.env.production?
# Setup Onboarding flow
Redis::Alfred.set(Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING, true)
end
## Seeds for Local Development
unless Rails.env.production?
# Enables creating additional accounts from dashboard
installation_config = InstallationConfig.find_by(name: 'CREATE_NEW_ACCOUNT_FROM_DASHBOARD')
installation_config.value = true
installation_config.save!
GlobalConfig.clear_cache
account = Account.create!(
name: 'Acme Inc'
)
secondary_account = Account.create!(
name: 'Acme Org'
)
user = User.new(name: 'John', email: 'john@acme.inc', password: 'Password1!', type: 'SuperAdmin')
user.skip_confirmation!
user.save!
AccountUser.create!(
account_id: account.id,
user_id: user.id,
role: :administrator
)
AccountUser.create!(
account_id: secondary_account.id,
user_id: user.id,
role: :administrator
)
web_widget = Channel::WebWidget.create!(account: account, website_url: 'https://acme.inc')
inbox = Inbox.create!(channel: web_widget, account: account, name: 'Acme Support')
InboxMember.create!(user: user, inbox: inbox)
contact_inbox = ContactInboxWithContactBuilder.new(
source_id: user.id,
inbox: inbox,
hmac_verified: true,
contact_attributes: { name: 'jane', email: 'jane@example.com', phone_number: '+2320000' }
).perform
conversation = Conversation.create!(
account: account,
inbox: inbox,
status: :open,
assignee: user,
contact: contact_inbox.contact,
contact_inbox: contact_inbox,
additional_attributes: {}
)
# sample email collect
Seeders::MessageSeeder.create_sample_email_collect_message conversation
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, sender: contact_inbox.contact,
message_type: :incoming)
# sample location message
#
location_message = Message.new(content: 'location', account: account, inbox: inbox, sender: contact_inbox.contact, conversation: conversation,
message_type: :incoming)
location_message.attachments.new(
account_id: account.id,
file_type: 'location',
coordinates_lat: 37.7893768,
coordinates_long: -122.3895553,
fallback_title: 'Bay Bridge, San Francisco, CA, USA'
)
location_message.save!
# sample card
Seeders::MessageSeeder.create_sample_cards_message conversation
# input select
Seeders::MessageSeeder.create_sample_input_select_message conversation
# form
Seeders::MessageSeeder.create_sample_form_message conversation
# articles
Seeders::MessageSeeder.create_sample_articles_message conversation
# csat
Seeders::MessageSeeder.create_sample_csat_collect_message conversation
CannedResponse.create!(account: account, short_code: 'start', content: 'Hello welcome to chatwoot.')
end