Compare commits
182
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
201747d6a2 | ||
|
|
cd217a3f86 | ||
|
|
6c79642450 | ||
|
|
201d476720 | ||
|
|
c1a2e67c9e | ||
|
|
1948bef9ac | ||
|
|
5486f39f7e | ||
|
|
f018b0013c | ||
|
|
950f085e80 | ||
|
|
268e26625b | ||
|
|
7041d86e4d | ||
|
|
78398ee800 | ||
|
|
7b09b02737 | ||
|
|
af7631d9f1 | ||
|
|
e0f33e62af | ||
|
|
5d224f2e04 | ||
|
|
4cb981d81b | ||
|
|
f891cfbf47 | ||
|
|
e54c8a857d | ||
|
|
66229b0d6b | ||
|
|
3eb1d49577 | ||
|
|
677888bcde | ||
|
|
abbb4180ea | ||
|
|
d1cbc56d67 | ||
|
|
b579ff832e | ||
|
|
39d0748a5b | ||
|
|
b4d20689b7 | ||
|
|
3b84b0fc47 | ||
|
|
23ea829510 | ||
|
|
ebe9daea00 | ||
|
|
36b6c0cb9c | ||
|
|
16c36a78f0 | ||
|
|
4999f7ed23 | ||
|
|
e8f4ac632f | ||
|
|
3c7854ccdf | ||
|
|
1e70223ed7 | ||
|
|
f34cd3ea61 | ||
|
|
68b8d721a7 | ||
|
|
d876419b27 | ||
|
|
8455186e9f | ||
|
|
b6584ec68b | ||
|
|
29f18c7f18 | ||
|
|
11b27f9805 | ||
|
|
653e0335c0 | ||
|
|
013dab7da6 | ||
|
|
2ba81830f3 | ||
|
|
dfba4770bd | ||
|
|
63e702ca12 | ||
|
|
394fece846 | ||
|
|
24fbab94c3 | ||
|
|
61e03fa33a | ||
|
|
6c4b92f7f6 | ||
|
|
f023325b0e | ||
|
|
dd05482cb0 | ||
|
|
d94108bf3f | ||
|
|
ab872beb1d | ||
|
|
d02cfff4cc | ||
|
|
736f269c49 | ||
|
|
b067acfd4a | ||
|
|
232fa6fd18 | ||
|
|
483d55df91 | ||
|
|
3e54d3654b | ||
|
|
b6831d464e | ||
|
|
8c67ea56e7 | ||
|
|
54bc4c23df | ||
|
|
58f47eb02c | ||
|
|
4fc62ed9ae | ||
|
|
4a89bab23a | ||
|
|
7438f3b157 | ||
|
|
9551dbc25f | ||
|
|
2e54f4a67c | ||
|
|
6d9b2a6b33 | ||
|
|
35a9acf099 | ||
|
|
b9694a0818 | ||
|
|
7416bbb25e | ||
|
|
b94c89ebf1 | ||
|
|
78ce8a4652 | ||
|
|
04c874fe35 | ||
|
|
eabe548520 | ||
|
|
f96b54e57f | ||
|
|
d3bf828524 | ||
|
|
c20415f3ba | ||
|
|
6b2ed4fe79 | ||
|
|
eca9ca90f1 | ||
|
|
9018ec9678 | ||
|
|
e55fe33f1b | ||
|
|
3b0788c3be | ||
|
|
626e67b859 | ||
|
|
28db18ebbd | ||
|
|
b28721e10b | ||
|
|
f77db4d814 | ||
|
|
62d8ec7edb | ||
|
|
7b09fa4a03 | ||
|
|
980013abae | ||
|
|
5c729ccea5 | ||
|
|
ae52ca87aa | ||
|
|
415bb23c37 | ||
|
|
9e173fca3c | ||
|
|
bd918ee506 | ||
|
|
7c9884b853 | ||
|
|
7ffa669c5c | ||
|
|
0bc20873f6 | ||
|
|
88de3359a5 | ||
|
|
a3d008da06 | ||
|
|
cbae95422d | ||
|
|
081c845c56 | ||
|
|
1e54d6deb3 | ||
|
|
bb5c6a416a | ||
|
|
6a07251007 | ||
|
|
759a66dd21 | ||
|
|
8189dd932c | ||
|
|
b6ba0f343e | ||
|
|
86ca90aa15 | ||
|
|
26e8877cd9 | ||
|
|
1b63adfb2e | ||
|
|
e27274a5a8 | ||
|
|
e5c198f839 | ||
|
|
72ba429159 | ||
|
|
3227cf7ff3 | ||
|
|
f0740120a8 | ||
|
|
3ea54065b1 | ||
|
|
6f19546c3c | ||
|
|
5c9ab21617 | ||
|
|
b71a580573 | ||
|
|
6a73953003 | ||
|
|
336af1ac9a | ||
|
|
e4de366b8d | ||
|
|
373c3dcd6c | ||
|
|
4b12dd89b0 | ||
|
|
c19cfeaa81 | ||
|
|
fa118ad18c | ||
|
|
249bfe44bb | ||
|
|
826d9ec5a7 | ||
|
|
d8b53f5d2f | ||
|
|
08ced452e1 | ||
|
|
24fe3805d8 | ||
|
|
845b0c0a68 | ||
|
|
8ce7539c5e | ||
|
|
5ee980465f | ||
|
|
fd633e1613 | ||
|
|
12a64f1b10 | ||
|
|
ffc2d98fb8 | ||
|
|
f7f04f788e | ||
|
|
a88d155dd7 | ||
|
|
e8b7e791a5 | ||
|
|
b18cac77fb | ||
|
|
647161121e | ||
|
|
cbbe939662 | ||
|
|
30cb141e5e | ||
|
|
b0d5c438ac | ||
|
|
3eefa4daee | ||
|
|
ddce999385 | ||
|
|
ff915dd2ea | ||
|
|
dd0930d75e | ||
|
|
3f0d96c24d | ||
|
|
c16b801562 | ||
|
|
018c468303 | ||
|
|
48bf8d08e5 | ||
|
|
fabb3c8da4 | ||
|
|
bdeb2f9812 | ||
|
|
53dc38e650 | ||
|
|
27fc24375d | ||
|
|
f999777a2d | ||
|
|
71d1e98765 | ||
|
|
2c93d563c1 | ||
|
|
f1b556d4a3 | ||
|
|
73c119cd3d | ||
|
|
0ad2f94151 | ||
|
|
f8cb806548 | ||
|
|
9ba5adfd60 | ||
|
|
0dd5104acb | ||
|
|
0968aead6c | ||
|
|
53d530b815 | ||
|
|
2429daa45c | ||
|
|
86894b27b5 | ||
|
|
05df4d4212 | ||
|
|
47fd0ea2b2 | ||
|
|
30b8a365dc | ||
|
|
29110ffd6b | ||
|
|
fe8a67b76a | ||
|
|
e204fe1c1f | ||
|
|
08fa370261 |
+21
-2
@@ -81,7 +81,7 @@ SMTP_OPENSSL_VERIFY_MODE=peer
|
|||||||
# Mail Incoming
|
# Mail Incoming
|
||||||
# This is the domain set for the reply emails when conversation continuity is enabled
|
# This is the domain set for the reply emails when conversation continuity is enabled
|
||||||
MAILER_INBOUND_EMAIL_DOMAIN=
|
MAILER_INBOUND_EMAIL_DOMAIN=
|
||||||
# Set this to appropriate ingress channel with regards to incoming emails
|
# Set this to the appropriate ingress channel with regards to incoming emails
|
||||||
# Possible values are :
|
# Possible values are :
|
||||||
# relay for Exim, Postfix, Qmail
|
# relay for Exim, Postfix, Qmail
|
||||||
# mailgun for Mailgun
|
# mailgun for Mailgun
|
||||||
@@ -91,10 +91,20 @@ MAILER_INBOUND_EMAIL_DOMAIN=
|
|||||||
RAILS_INBOUND_EMAIL_SERVICE=
|
RAILS_INBOUND_EMAIL_SERVICE=
|
||||||
# Use one of the following based on the email ingress service
|
# Use one of the following based on the email ingress service
|
||||||
# Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html
|
# Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html
|
||||||
|
# Set this to a password of your choice and use it in the Inbound webhook
|
||||||
RAILS_INBOUND_EMAIL_PASSWORD=
|
RAILS_INBOUND_EMAIL_PASSWORD=
|
||||||
|
|
||||||
MAILGUN_INGRESS_SIGNING_KEY=
|
MAILGUN_INGRESS_SIGNING_KEY=
|
||||||
MANDRILL_INGRESS_API_KEY=
|
MANDRILL_INGRESS_API_KEY=
|
||||||
|
|
||||||
|
# Creating Your Inbound Webhook Instructions for Postmark and Sendgrid:
|
||||||
|
# Inbound webhook URL format:
|
||||||
|
# https://actionmailbox:[YOUR_RAILS_INBOUND_EMAIL_PASSWORD]@[YOUR_CHATWOOT_DOMAIN.COM]/rails/action_mailbox/[RAILS_INBOUND_EMAIL_SERVICE]/inbound_emails
|
||||||
|
# Note: Replace the values inside the brackets; do not include the brackets themselves.
|
||||||
|
# Example: https://actionmailbox:mYRandomPassword3@chatwoot.example.com/rails/action_mailbox/postmark/inbound_emails
|
||||||
|
# For Postmark
|
||||||
|
# Ensure the 'Include raw email content in JSON payload' checkbox is selected in the inbound webhook section.
|
||||||
|
|
||||||
# Storage
|
# Storage
|
||||||
ACTIVE_STORAGE_SERVICE=local
|
ACTIVE_STORAGE_SERVICE=local
|
||||||
|
|
||||||
@@ -176,6 +186,9 @@ ANDROID_SHA256_CERT_FINGERPRINT=AC:73:8E:DE:EB:56:EA:CC:10:87:02:A7:65:37:7B:38:
|
|||||||
# MICROSOFT CLARITY
|
# MICROSOFT CLARITY
|
||||||
# MS_CLARITY_TOKEN=xxxxxxxxx
|
# MS_CLARITY_TOKEN=xxxxxxxxx
|
||||||
|
|
||||||
|
# GOOGLE_TAG_MANAGER
|
||||||
|
# GOOGLE_TAG = GTM-XXXXXXX
|
||||||
|
|
||||||
## Scout
|
## Scout
|
||||||
## https://scoutapm.com/docs/ruby/configuration
|
## https://scoutapm.com/docs/ruby/configuration
|
||||||
# SCOUT_KEY=YOURKEY
|
# SCOUT_KEY=YOURKEY
|
||||||
@@ -199,7 +212,7 @@ ANDROID_SHA256_CERT_FINGERPRINT=AC:73:8E:DE:EB:56:EA:CC:10:87:02:A7:65:37:7B:38:
|
|||||||
## Rack Attack configuration
|
## Rack Attack configuration
|
||||||
## To prevent and throttle abusive requests
|
## To prevent and throttle abusive requests
|
||||||
# ENABLE_RACK_ATTACK=true
|
# ENABLE_RACK_ATTACK=true
|
||||||
# RACK_ATTACK_IP_LIMIT=3000
|
# RACK_ATTACK_LIMIT=300
|
||||||
# ENABLE_RACK_ATTACK_WIDGET_API=true
|
# ENABLE_RACK_ATTACK_WIDGET_API=true
|
||||||
|
|
||||||
## Running chatwoot as an API only server
|
## Running chatwoot as an API only server
|
||||||
@@ -240,3 +253,9 @@ AZURE_APP_SECRET=
|
|||||||
|
|
||||||
# Sentiment analysis model file path
|
# Sentiment analysis model file path
|
||||||
SENTIMENT_FILE_PATH=
|
SENTIMENT_FILE_PATH=
|
||||||
|
|
||||||
|
|
||||||
|
# Housekeeping/Performance related configurations
|
||||||
|
# Set to true if you want to remove stale contact inboxes
|
||||||
|
# contact_inboxes with no conversation older than 90 days will be removed
|
||||||
|
# REMOVE_STALE_CONTACT_INBOX_JOB_STATUS=false
|
||||||
|
|||||||
+8
-3
@@ -4,9 +4,10 @@ module.exports = {
|
|||||||
'prettier',
|
'prettier',
|
||||||
'plugin:vue/recommended',
|
'plugin:vue/recommended',
|
||||||
'plugin:storybook/recommended',
|
'plugin:storybook/recommended',
|
||||||
|
'plugin:cypress/recommended',
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
parser: 'babel-eslint',
|
parser: '@babel/eslint-parser',
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
@@ -24,13 +25,16 @@ module.exports = {
|
|||||||
'jsx-a11y/label-has-for': 'off',
|
'jsx-a11y/label-has-for': 'off',
|
||||||
'jsx-a11y/anchor-is-valid': 'off',
|
'jsx-a11y/anchor-is-valid': 'off',
|
||||||
'import/no-unresolved': 'off',
|
'import/no-unresolved': 'off',
|
||||||
|
'vue/html-indent': 'off',
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
'vue/max-attributes-per-line': [
|
'vue/max-attributes-per-line': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
singleline: 20,
|
singleline: {
|
||||||
|
max: 20,
|
||||||
|
},
|
||||||
multiline: {
|
multiline: {
|
||||||
max: 1,
|
max: 1,
|
||||||
allowFirstLine: false,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -47,6 +51,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
'vue/no-v-html': 'off',
|
'vue/no-v-html': 'off',
|
||||||
|
'vue/component-definition-name-casing': 'off',
|
||||||
'vue/singleline-html-element-content-newline': 'off',
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
'import/extensions': ['off'],
|
'import/extensions': ['off'],
|
||||||
'no-console': 'error',
|
'no-console': 'error',
|
||||||
|
|||||||
@@ -69,7 +69,12 @@ jobs:
|
|||||||
# Run Response Bot specs
|
# Run Response Bot specs
|
||||||
- name: Run backend tests
|
- name: Run backend tests
|
||||||
run: |
|
run: |
|
||||||
bundle exec rspec spec/enterprise/controllers/api/v1/accounts/response_sources_controller_spec.rb spec/enterprise/controllers/enterprise/api/v1/accounts/inboxes_controller_spec.rb:47 --profile=10 --format documentation
|
bundle exec rspec \
|
||||||
|
spec/enterprise/controllers/api/v1/accounts/response_sources_controller_spec.rb \
|
||||||
|
spec/enterprise/services/enterprise/message_templates/response_bot_service_spec.rb \
|
||||||
|
spec/enterprise/controllers/enterprise/api/v1/accounts/inboxes_controller_spec.rb:47 \
|
||||||
|
--profile=10 \
|
||||||
|
--format documentation
|
||||||
|
|
||||||
- name: Upload rails log folder
|
- name: Upload rails log folder
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ Metrics/BlockLength:
|
|||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- lib/seeders/message_seeder.rb
|
- lib/seeders/message_seeder.rb
|
||||||
|
- spec/support/slack_stubs.rb
|
||||||
Rails/ApplicationController:
|
Rails/ApplicationController:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/api/v1/widget/messages_controller.rb'
|
- 'app/controllers/api/v1/widget/messages_controller.rb'
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ gem 'browser'
|
|||||||
gem 'hashie'
|
gem 'hashie'
|
||||||
gem 'jbuilder'
|
gem 'jbuilder'
|
||||||
gem 'kaminari'
|
gem 'kaminari'
|
||||||
gem 'responders'
|
gem 'responders', '>= 3.1.1'
|
||||||
gem 'rest-client'
|
gem 'rest-client'
|
||||||
gem 'telephone_number'
|
gem 'telephone_number'
|
||||||
gem 'time_diff'
|
gem 'time_diff'
|
||||||
@@ -67,7 +67,7 @@ gem 'webpacker'
|
|||||||
gem 'barnes'
|
gem 'barnes'
|
||||||
|
|
||||||
##--- gems for authentication & authorization ---##
|
##--- gems for authentication & authorization ---##
|
||||||
gem 'devise'
|
gem 'devise', '>= 4.9.3'
|
||||||
gem 'devise-secure_password', git: 'https://github.com/chatwoot/devise-secure_password', branch: 'chatwoot'
|
gem 'devise-secure_password', git: 'https://github.com/chatwoot/devise-secure_password', branch: 'chatwoot'
|
||||||
gem 'devise_token_auth'
|
gem 'devise_token_auth'
|
||||||
# authorization
|
# authorization
|
||||||
@@ -76,6 +76,7 @@ gem 'pundit'
|
|||||||
# super admin
|
# super admin
|
||||||
gem 'administrate', '>= 0.19.0'
|
gem 'administrate', '>= 0.19.0'
|
||||||
gem 'administrate-field-active_storage'
|
gem 'administrate-field-active_storage'
|
||||||
|
gem 'administrate-field-belongs_to_search'
|
||||||
|
|
||||||
##--- gems for pubsub service ---##
|
##--- gems for pubsub service ---##
|
||||||
# https://karolgalanciak.com/blog/2019/11/30/from-activerecord-callbacks-to-publish-slash-subscribe-pattern-and-event-driven-design/
|
# https://karolgalanciak.com/blog/2019/11/30/from-activerecord-callbacks-to-publish-slash-subscribe-pattern-and-event-driven-design/
|
||||||
@@ -91,7 +92,7 @@ gem 'twitty', '~> 0.1.5'
|
|||||||
# facebook client
|
# facebook client
|
||||||
gem 'koala'
|
gem 'koala'
|
||||||
# slack client
|
# slack client
|
||||||
gem 'slack-ruby-client', '~> 2.0.0'
|
gem 'slack-ruby-client', '~> 2.2.0'
|
||||||
# for dialogflow integrations
|
# for dialogflow integrations
|
||||||
gem 'google-cloud-dialogflow-v2'
|
gem 'google-cloud-dialogflow-v2'
|
||||||
gem 'grpc'
|
gem 'grpc'
|
||||||
@@ -106,16 +107,16 @@ gem 'google-cloud-translate-v3'
|
|||||||
gem 'ddtrace', require: false
|
gem 'ddtrace', require: false
|
||||||
gem 'elastic-apm', require: false
|
gem 'elastic-apm', require: false
|
||||||
gem 'newrelic_rpm', require: false
|
gem 'newrelic_rpm', require: false
|
||||||
gem 'newrelic-sidekiq-metrics', require: false
|
gem 'newrelic-sidekiq-metrics', '>= 1.6.2', require: false
|
||||||
gem 'scout_apm', require: false
|
gem 'scout_apm', require: false
|
||||||
gem 'sentry-rails', '>= 5.11.0', require: false
|
gem 'sentry-rails', '>= 5.12.0', require: false
|
||||||
gem 'sentry-ruby', require: false
|
gem 'sentry-ruby', require: false
|
||||||
gem 'sentry-sidekiq', '>= 5.11.0', require: false
|
gem 'sentry-sidekiq', '>= 5.12.0', require: false
|
||||||
|
|
||||||
##-- background job processing --##
|
##-- background job processing --##
|
||||||
gem 'sidekiq', '>= 7.1.3'
|
gem 'sidekiq', '>= 7.1.3'
|
||||||
# We want cron jobs
|
# We want cron jobs
|
||||||
gem 'sidekiq-cron', '>= 1.10.1'
|
gem 'sidekiq-cron', '>= 1.11.0'
|
||||||
|
|
||||||
##-- Push notification service --##
|
##-- Push notification service --##
|
||||||
gem 'fcm'
|
gem 'fcm'
|
||||||
@@ -153,12 +154,12 @@ gem 'stripe'
|
|||||||
gem 'faker'
|
gem 'faker'
|
||||||
|
|
||||||
# Include logrange conditionally in intializer using env variable
|
# Include logrange conditionally in intializer using env variable
|
||||||
gem 'lograge', '~> 0.13.0', require: false
|
gem 'lograge', '~> 0.14.0', require: false
|
||||||
|
|
||||||
# worked with microsoft refresh token
|
# worked with microsoft refresh token
|
||||||
gem 'omniauth-oauth2'
|
gem 'omniauth-oauth2'
|
||||||
|
|
||||||
gem 'audited', '~> 5.3'
|
gem 'audited', '~> 5.4', '>= 5.4.1'
|
||||||
|
|
||||||
# need for google auth
|
# need for google auth
|
||||||
gem 'omniauth'
|
gem 'omniauth'
|
||||||
|
|||||||
+41
-34
@@ -116,14 +116,19 @@ GEM
|
|||||||
administrate-field-active_storage (0.4.2)
|
administrate-field-active_storage (0.4.2)
|
||||||
administrate (>= 0.2.2)
|
administrate (>= 0.2.2)
|
||||||
rails (>= 7.0)
|
rails (>= 7.0)
|
||||||
|
administrate-field-belongs_to_search (0.8.0)
|
||||||
|
administrate (>= 0.3, < 1.0)
|
||||||
|
jbuilder (~> 2)
|
||||||
|
rails (>= 4.2, < 7.1)
|
||||||
|
selectize-rails (~> 0.6)
|
||||||
annotate (3.2.0)
|
annotate (3.2.0)
|
||||||
activerecord (>= 3.2, < 8.0)
|
activerecord (>= 3.2, < 8.0)
|
||||||
rake (>= 10.4, < 14.0)
|
rake (>= 10.4, < 14.0)
|
||||||
ast (2.4.2)
|
ast (2.4.2)
|
||||||
attr_extras (7.1.0)
|
attr_extras (7.1.0)
|
||||||
audited (5.3.3)
|
audited (5.4.1)
|
||||||
activerecord (>= 5.0, < 7.1)
|
activerecord (>= 5.0, < 7.7)
|
||||||
request_store (~> 1.2)
|
activesupport (>= 5.0, < 7.7)
|
||||||
aws-eventstream (1.2.0)
|
aws-eventstream (1.2.0)
|
||||||
aws-partitions (1.760.0)
|
aws-partitions (1.760.0)
|
||||||
aws-sdk-core (3.171.1)
|
aws-sdk-core (3.171.1)
|
||||||
@@ -143,7 +148,8 @@ GEM
|
|||||||
barnes (0.0.9)
|
barnes (0.0.9)
|
||||||
multi_json (~> 1)
|
multi_json (~> 1)
|
||||||
statsd-ruby (~> 1.1)
|
statsd-ruby (~> 1.1)
|
||||||
bcrypt (3.1.18)
|
base64 (0.1.1)
|
||||||
|
bcrypt (3.1.19)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
blingfire (0.1.8)
|
blingfire (0.1.8)
|
||||||
bootsnap (1.16.0)
|
bootsnap (1.16.0)
|
||||||
@@ -169,7 +175,7 @@ GEM
|
|||||||
rexml
|
rexml
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
csv-safe (3.2.1)
|
csv-safe (3.2.1)
|
||||||
cypress-on-rails (1.13.1)
|
cypress-on-rails (1.16.0)
|
||||||
rack
|
rack
|
||||||
database_cleaner (2.0.2)
|
database_cleaner (2.0.2)
|
||||||
database_cleaner-active_record (>= 2, < 3)
|
database_cleaner-active_record (>= 2, < 3)
|
||||||
@@ -188,7 +194,7 @@ GEM
|
|||||||
irb (>= 1.5.0)
|
irb (>= 1.5.0)
|
||||||
reline (>= 0.3.1)
|
reline (>= 0.3.1)
|
||||||
declarative (0.0.20)
|
declarative (0.0.20)
|
||||||
devise (4.9.2)
|
devise (4.9.3)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
@@ -256,7 +262,7 @@ GEM
|
|||||||
rake
|
rake
|
||||||
flag_shih_tzu (0.3.23)
|
flag_shih_tzu (0.3.23)
|
||||||
foreman (0.87.2)
|
foreman (0.87.2)
|
||||||
fugit (1.8.1)
|
fugit (1.9.0)
|
||||||
et-orbi (~> 1, >= 1.2.7)
|
et-orbi (~> 1, >= 1.2.7)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
gapic-common (0.18.0)
|
gapic-common (0.18.0)
|
||||||
@@ -268,7 +274,7 @@ GEM
|
|||||||
googleauth (~> 1.0)
|
googleauth (~> 1.0)
|
||||||
grpc (~> 1.36)
|
grpc (~> 1.36)
|
||||||
geocoder (1.8.1)
|
geocoder (1.8.1)
|
||||||
gli (2.21.0)
|
gli (2.21.1)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
gmail_xoauth (0.4.2)
|
gmail_xoauth (0.4.2)
|
||||||
@@ -429,12 +435,12 @@ GEM
|
|||||||
llhttp-ffi (0.4.0)
|
llhttp-ffi (0.4.0)
|
||||||
ffi-compiler (~> 1.0)
|
ffi-compiler (~> 1.0)
|
||||||
rake (~> 13.0)
|
rake (~> 13.0)
|
||||||
lograge (0.13.0)
|
lograge (0.14.0)
|
||||||
actionpack (>= 4)
|
actionpack (>= 4)
|
||||||
activesupport (>= 4)
|
activesupport (>= 4)
|
||||||
railties (>= 4)
|
railties (>= 4)
|
||||||
request_store (~> 1.0)
|
request_store (~> 1.0)
|
||||||
loofah (2.21.3)
|
loofah (2.21.4)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.12.0)
|
nokogiri (>= 1.12.0)
|
||||||
mail (2.8.1)
|
mail (2.8.1)
|
||||||
@@ -473,10 +479,11 @@ GEM
|
|||||||
net-smtp (0.3.3)
|
net-smtp (0.3.3)
|
||||||
net-protocol
|
net-protocol
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
newrelic-sidekiq-metrics (1.6.1)
|
newrelic-sidekiq-metrics (1.6.2)
|
||||||
newrelic_rpm (~> 8)
|
newrelic_rpm (>= 8.0.0)
|
||||||
sidekiq
|
sidekiq
|
||||||
newrelic_rpm (8.16.0)
|
newrelic_rpm (9.6.0)
|
||||||
|
base64
|
||||||
nio4r (2.5.9)
|
nio4r (2.5.9)
|
||||||
nokogiri (1.15.4)
|
nokogiri (1.15.4)
|
||||||
mini_portile2 (~> 2.8.2)
|
mini_portile2 (~> 2.8.2)
|
||||||
@@ -598,7 +605,7 @@ GEM
|
|||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
redis (5.0.6)
|
redis (5.0.6)
|
||||||
redis-client (>= 0.9.0)
|
redis-client (>= 0.9.0)
|
||||||
redis-client (0.17.0)
|
redis-client (0.18.0)
|
||||||
connection_pool
|
connection_pool
|
||||||
redis-namespace (1.10.0)
|
redis-namespace (1.10.0)
|
||||||
redis (>= 4)
|
redis (>= 4)
|
||||||
@@ -611,7 +618,7 @@ GEM
|
|||||||
uber (< 0.2.0)
|
uber (< 0.2.0)
|
||||||
request_store (1.5.1)
|
request_store (1.5.1)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
responders (3.1.0)
|
responders (3.1.1)
|
||||||
actionpack (>= 5.2)
|
actionpack (>= 5.2)
|
||||||
railties (>= 5.2)
|
railties (>= 5.2)
|
||||||
rest-client (2.1.0)
|
rest-client (2.1.0)
|
||||||
@@ -697,23 +704,23 @@ GEM
|
|||||||
activesupport (>= 4)
|
activesupport (>= 4)
|
||||||
selectize-rails (0.12.6)
|
selectize-rails (0.12.6)
|
||||||
semantic_range (3.0.0)
|
semantic_range (3.0.0)
|
||||||
sentry-rails (5.11.0)
|
sentry-rails (5.12.0)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
sentry-ruby (~> 5.11.0)
|
sentry-ruby (~> 5.12.0)
|
||||||
sentry-ruby (5.11.0)
|
sentry-ruby (5.12.0)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
sentry-sidekiq (5.11.0)
|
sentry-sidekiq (5.12.0)
|
||||||
sentry-ruby (~> 5.11.0)
|
sentry-ruby (~> 5.12.0)
|
||||||
sidekiq (>= 3.0)
|
sidekiq (>= 3.0)
|
||||||
sexp_processor (4.17.0)
|
sexp_processor (4.17.0)
|
||||||
shoulda-matchers (5.3.0)
|
shoulda-matchers (5.3.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
sidekiq (7.1.3)
|
sidekiq (7.2.0)
|
||||||
concurrent-ruby (< 2)
|
concurrent-ruby (< 2)
|
||||||
connection_pool (>= 2.3.0)
|
connection_pool (>= 2.3.0)
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
redis-client (>= 0.14.0)
|
redis-client (>= 0.14.0)
|
||||||
sidekiq-cron (1.10.1)
|
sidekiq-cron (1.11.0)
|
||||||
fugit (~> 1.8)
|
fugit (~> 1.8)
|
||||||
globalid (>= 1.0.1)
|
globalid (>= 1.0.1)
|
||||||
sidekiq (>= 6)
|
sidekiq (>= 6)
|
||||||
@@ -727,13 +734,12 @@ GEM
|
|||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
slack-ruby-client (2.0.0)
|
slack-ruby-client (2.2.0)
|
||||||
faraday (>= 2.0)
|
faraday (>= 2.0)
|
||||||
faraday-mashify
|
faraday-mashify
|
||||||
faraday-multipart
|
faraday-multipart
|
||||||
gli
|
gli
|
||||||
hashie
|
hashie
|
||||||
websocket-driver
|
|
||||||
snaky_hash (2.0.1)
|
snaky_hash (2.0.1)
|
||||||
hashie
|
hashie
|
||||||
version_gem (~> 1.1, >= 1.1.1)
|
version_gem (~> 1.1, >= 1.1.1)
|
||||||
@@ -812,7 +818,7 @@ GEM
|
|||||||
working_hours (1.4.1)
|
working_hours (1.4.1)
|
||||||
activesupport (>= 3.2)
|
activesupport (>= 3.2)
|
||||||
tzinfo
|
tzinfo
|
||||||
zeitwerk (2.6.11)
|
zeitwerk (2.6.12)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
arm64-darwin-20
|
arm64-darwin-20
|
||||||
@@ -831,9 +837,10 @@ DEPENDENCIES
|
|||||||
acts-as-taggable-on
|
acts-as-taggable-on
|
||||||
administrate (>= 0.19.0)
|
administrate (>= 0.19.0)
|
||||||
administrate-field-active_storage
|
administrate-field-active_storage
|
||||||
|
administrate-field-belongs_to_search
|
||||||
annotate
|
annotate
|
||||||
attr_extras
|
attr_extras
|
||||||
audited (~> 5.3)
|
audited (~> 5.4, >= 5.4.1)
|
||||||
aws-sdk-s3
|
aws-sdk-s3
|
||||||
azure-storage-blob!
|
azure-storage-blob!
|
||||||
barnes
|
barnes
|
||||||
@@ -850,7 +857,7 @@ DEPENDENCIES
|
|||||||
database_cleaner
|
database_cleaner
|
||||||
ddtrace
|
ddtrace
|
||||||
debug (~> 1.8)
|
debug (~> 1.8)
|
||||||
devise
|
devise (>= 4.9.3)
|
||||||
devise-secure_password!
|
devise-secure_password!
|
||||||
devise_token_auth
|
devise_token_auth
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
@@ -886,11 +893,11 @@ DEPENDENCIES
|
|||||||
line-bot-api
|
line-bot-api
|
||||||
liquid
|
liquid
|
||||||
listen
|
listen
|
||||||
lograge (~> 0.13.0)
|
lograge (~> 0.14.0)
|
||||||
maxminddb
|
maxminddb
|
||||||
mock_redis
|
mock_redis
|
||||||
neighbor
|
neighbor
|
||||||
newrelic-sidekiq-metrics
|
newrelic-sidekiq-metrics (>= 1.6.2)
|
||||||
newrelic_rpm
|
newrelic_rpm
|
||||||
omniauth
|
omniauth
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
@@ -910,7 +917,7 @@ DEPENDENCIES
|
|||||||
rails (~> 7.0.8.0)
|
rails (~> 7.0.8.0)
|
||||||
redis
|
redis
|
||||||
redis-namespace
|
redis-namespace
|
||||||
responders
|
responders (>= 3.1.1)
|
||||||
rest-client
|
rest-client
|
||||||
reverse_markdown
|
reverse_markdown
|
||||||
rspec-rails
|
rspec-rails
|
||||||
@@ -922,14 +929,14 @@ DEPENDENCIES
|
|||||||
scout_apm
|
scout_apm
|
||||||
scss_lint
|
scss_lint
|
||||||
seed_dump
|
seed_dump
|
||||||
sentry-rails (>= 5.11.0)
|
sentry-rails (>= 5.12.0)
|
||||||
sentry-ruby
|
sentry-ruby
|
||||||
sentry-sidekiq (>= 5.11.0)
|
sentry-sidekiq (>= 5.12.0)
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
sidekiq (>= 7.1.3)
|
sidekiq (>= 7.1.3)
|
||||||
sidekiq-cron (>= 1.10.1)
|
sidekiq-cron (>= 1.11.0)
|
||||||
simplecov (= 0.17.1)
|
simplecov (= 0.17.1)
|
||||||
slack-ruby-client (~> 2.0.0)
|
slack-ruby-client (~> 2.2.0)
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen
|
spring-watcher-listen
|
||||||
squasher
|
squasher
|
||||||
|
|||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
backend: RAILS_ENV=test bin/rails s -p 5050
|
backend: RAILS_ENV=test bin/rails s -p 5050
|
||||||
frontend: bin/webpack-dev-server
|
frontend: export NODE_OPTIONS=--openssl-legacy-provider && bin/webpack-dev-server
|
||||||
worker: dotenv RAILS_ENV=test bundle exec sidekiq -C config/sidekiq.yml
|
worker: RAILS_ENV=test dotenv bundle exec sidekiq -C config/sidekiq.yml
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<p align="center">
|
<img src="https://user-images.githubusercontent.com/2246121/282256557-1570674b-d142-4198-9740-69404cc6a339.png#gh-light-mode-only" width="100%" alt="Chat dashboard dark mode"/>
|
||||||
<img src="https://s3.us-west-2.amazonaws.com/gh-assets.chatwoot.com/brand.svg" alt="Woot-logo" width="240" />
|
<img src="https://user-images.githubusercontent.com/2246121/282256632-87f6a01b-6467-4e0e-8a93-7bbf66d03a17.png#gh-dark-mode-only" width="100%" alt="Chat dashboard"/>
|
||||||
|
|
||||||
<p align="center">Customer engagement suite, an open-source alternative to Intercom, Zendesk, Salesforce Service Cloud etc.</p>
|
___
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
# Chatwoot
|
||||||
|
|
||||||
|
Customer engagement suite, an open-source alternative to Intercom, Zendesk, Salesforce Service Cloud etc.
|
||||||
|
<p>
|
||||||
<a href="https://heroku.com/deploy?template=https://github.com/chatwoot/chatwoot/tree/master" alt="Deploy to Heroku">
|
<a href="https://heroku.com/deploy?template=https://github.com/chatwoot/chatwoot/tree/master" alt="Deploy to Heroku">
|
||||||
<img width="150" alt="Deploy" src="https://www.herokucdn.com/deploy/button.svg"/>
|
<img width="150" alt="Deploy" src="https://www.herokucdn.com/deploy/button.svg"/>
|
||||||
</a>
|
</a>
|
||||||
@@ -13,9 +15,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
___
|
<p>
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="https://codeclimate.com/github/chatwoot/chatwoot/maintainability"><img src="https://api.codeclimate.com/v1/badges/e6e3f66332c91e5a4c0c/maintainability" alt="Maintainability"></a>
|
<a href="https://codeclimate.com/github/chatwoot/chatwoot/maintainability"><img src="https://api.codeclimate.com/v1/badges/e6e3f66332c91e5a4c0c/maintainability" alt="Maintainability"></a>
|
||||||
<img src="https://img.shields.io/circleci/build/github/chatwoot/chatwoot" alt="CircleCI Badge">
|
<img src="https://img.shields.io/circleci/build/github/chatwoot/chatwoot" alt="CircleCI Badge">
|
||||||
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/pulls/chatwoot/chatwoot" alt="Docker Pull Badge"></a>
|
<a href="https://hub.docker.com/r/chatwoot/chatwoot/"><img src="https://img.shields.io/docker/pulls/chatwoot/chatwoot" alt="Docker Pull Badge"></a>
|
||||||
@@ -29,9 +29,8 @@ ___
|
|||||||
<a href="https://artifacthub.io/packages/helm/chatwoot/chatwoot"><img src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/artifact-hub" alt="Artifact HUB"></a>
|
<a href="https://artifacthub.io/packages/helm/chatwoot/chatwoot"><img src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/artifact-hub" alt="Artifact HUB"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<img src="https://chatwoot-public-assets.s3.amazonaws.com/github/screenshot.png" width="100%" alt="Chat dashboard"/>
|
<img src="https://user-images.githubusercontent.com/2246121/282255783-ee8a50c9-f42d-4752-8201-2d59965a663d.png#gh-light-mode-only" width="100%" alt="Chat dashboard dark mode"/>
|
||||||
|
<img src="https://user-images.githubusercontent.com/2246121/282255784-3d1994ec-d895-4ff5-ac68-d819987e1869.png#gh-dark-mode-only" width="100%" alt="Chat dashboard"/>
|
||||||
|
|
||||||
|
|
||||||
Chatwoot is an open-source, self-hosted customer engagement suite. Chatwoot lets you view and manage your customer data, communicate with them irrespective of which medium they use, and re-engage them based on their profile.
|
Chatwoot is an open-source, self-hosted customer engagement suite. Chatwoot lets you view and manage your customer data, communicate with them irrespective of which medium they use, and re-engage them based on their profile.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.17.0
|
3.1.0
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.3.0
|
2.6.0
|
||||||
|
|||||||
@@ -29,3 +29,5 @@
|
|||||||
@import 'components/pagination';
|
@import 'components/pagination';
|
||||||
@import 'components/search';
|
@import 'components/search';
|
||||||
@import 'components/reports';
|
@import 'components/reports';
|
||||||
|
|
||||||
|
@import 'custom_styles';
|
||||||
|
|||||||
@@ -24,14 +24,6 @@ select {
|
|||||||
font-size: $base-font-size;
|
font-size: $base-font-size;
|
||||||
}
|
}
|
||||||
|
|
||||||
input,
|
|
||||||
select,
|
|
||||||
textarea {
|
|
||||||
display: block;
|
|
||||||
font-family: $base-font-family;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
[type="color"],
|
[type="color"],
|
||||||
[type="date"],
|
[type="date"],
|
||||||
[type="datetime-local"],
|
[type="datetime-local"],
|
||||||
@@ -51,6 +43,7 @@ textarea {
|
|||||||
background-color: $white;
|
background-color: $white;
|
||||||
border: $base-border;
|
border: $base-border;
|
||||||
border-radius: $base-border-radius;
|
border-radius: $base-border-radius;
|
||||||
|
font-family: $base-font-family;
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
transition: border-color $base-duration $base-timing;
|
transition: border-color $base-duration $base-timing;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
float: left;
|
float: left;
|
||||||
margin-bottom: $base-spacing;
|
margin-bottom: $base-spacing;
|
||||||
margin-top: 0.25em;
|
margin-top: 0.25em;
|
||||||
text-align: right;
|
text-align: left;
|
||||||
width: calc(15% - 1rem);
|
width: calc(16% - 1rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.preserve-whitespace {
|
.preserve-whitespace {
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
float: left;
|
float: left;
|
||||||
margin-bottom: $base-spacing;
|
margin-bottom: $base-spacing;
|
||||||
margin-left: 2rem;
|
margin-left: 2rem;
|
||||||
width: calc(85% - 1rem);
|
width: calc(84% - 1rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.attribute--nested {
|
.attribute--nested {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ input[type="submit"],
|
|||||||
color: $white;
|
color: $white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: $font-size-default;
|
font-size: $font-size-small;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
font-weight: $font-weight-medium;
|
font-weight: $font-weight-medium;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
.main-content {
|
.main-content {
|
||||||
font-size: $font-size-default;
|
font-size: $font-size-default;
|
||||||
left: 23rem;
|
left: 21rem;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content__body {
|
.main-content__body {
|
||||||
|
font-size: $font-size-small;
|
||||||
padding: $space-two;
|
padding: $space-two;
|
||||||
|
|
||||||
|
table {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content__header {
|
.main-content__header {
|
||||||
@@ -20,7 +25,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.main-content__page-title {
|
.main-content__page-title {
|
||||||
font-size: $font-size-large;
|
font-size: $font-size-medium;
|
||||||
font-weight: $font-weight-medium;
|
font-weight: $font-weight-medium;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
.logo-brand {
|
.logo-brand {
|
||||||
margin-bottom: $space-normal;
|
margin-bottom: $space-normal;
|
||||||
padding: $space-normal $space-smaller $space-small;
|
padding: $space-normal $space-smaller $space-small;
|
||||||
text-align: center;
|
text-align: left;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin-bottom: $space-smaller;
|
||||||
|
max-height: 3rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation {
|
.navigation {
|
||||||
@@ -19,12 +24,13 @@
|
|||||||
padding: $space-normal;
|
padding: $space-normal;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 23rem;
|
width: 21rem;
|
||||||
z-index: 1023;
|
z-index: 1023;
|
||||||
|
|
||||||
li {
|
li {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
font-size: $font-size-small;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: $color-gray;
|
color: $color-gray;
|
||||||
@@ -35,6 +41,10 @@
|
|||||||
min-width: $space-medium;
|
min-width: $space-medium;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: $space-slab;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation__link {
|
.navigation__link {
|
||||||
@@ -43,7 +53,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
margin-bottom: $space-smaller;
|
margin-bottom: $space-smaller;
|
||||||
padding: $space-one;
|
padding: $space-small;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $blue;
|
color: $blue;
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// custom styles for the dashboard
|
||||||
|
|
||||||
|
.feature-cell {
|
||||||
|
background: $color-extra-light-blue;
|
||||||
|
border-radius: 10px;
|
||||||
|
float: left;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-top: 6px;
|
||||||
|
padding: 4px 12px;
|
||||||
|
|
||||||
|
.icon-container {
|
||||||
|
margin-right: 4px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.value-container {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.feature-container {
|
||||||
|
max-width: 100rem;
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ $base-font-family: PlusJakarta, Inter, -apple-system, BlinkMacSystemFont, "Segoe
|
|||||||
sans-serif !default;
|
sans-serif !default;
|
||||||
$heading-font-family: $base-font-family !default;
|
$heading-font-family: $base-font-family !default;
|
||||||
|
|
||||||
$base-font-size: 16px !default;
|
$base-font-size: 14px !default;
|
||||||
|
|
||||||
$base-line-height: 1.5 !default;
|
$base-line-height: 1.5 !default;
|
||||||
$heading-line-height: 1.2 !default;
|
$heading-line-height: 1.2 !default;
|
||||||
|
|||||||
@@ -78,11 +78,6 @@ $conv-header-height: 4rem;
|
|||||||
$inbox-thumb-size: 4.8rem;
|
$inbox-thumb-size: 4.8rem;
|
||||||
|
|
||||||
|
|
||||||
// Spinner
|
|
||||||
$spinkit-spinner-color: $color-white !default;
|
|
||||||
$spinkit-spinner-margin: 0 0 0 1.6rem !default;
|
|
||||||
$spinkit-size: 1.6rem !default;
|
|
||||||
|
|
||||||
// Snackbar default
|
// Snackbar default
|
||||||
$woot-snackbar-bg: #323232;
|
$woot-snackbar-bg: #323232;
|
||||||
$woot-snackbar-button: #ffeb3b;
|
$woot-snackbar-button: #ffeb3b;
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ class Messages::Facebook::MessageBuilder < Messages::Messenger::MessageBuilder
|
|||||||
message_type: @message_type,
|
message_type: @message_type,
|
||||||
content: response.content,
|
content: response.content,
|
||||||
source_id: response.identifier,
|
source_id: response.identifier,
|
||||||
|
content_attributes: {
|
||||||
|
in_reply_to_external_id: response.in_reply_to_external_id
|
||||||
|
},
|
||||||
sender: @outgoing_echo ? nil : @contact_inbox.contact
|
sender: @outgoing_echo ? nil : @contact_inbox.contact
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ class Messages::Instagram::MessageBuilder < Messages::Messenger::MessageBuilder
|
|||||||
message[:reply_to][:story] if message[:reply_to].present? && message[:reply_to][:story].present?
|
message[:reply_to][:story] if message[:reply_to].present? && message[:reply_to][:story].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def message_reply_attributes
|
||||||
|
message[:reply_to][:mid] if message[:reply_to].present? && message[:reply_to][:mid].present?
|
||||||
|
end
|
||||||
|
|
||||||
def build_message
|
def build_message
|
||||||
return if @outgoing_echo && already_sent_from_chatwoot?
|
return if @outgoing_echo && already_sent_from_chatwoot?
|
||||||
return if message_content.blank? && all_unsupported_files?
|
return if message_content.blank? && all_unsupported_files?
|
||||||
@@ -118,7 +122,10 @@ class Messages::Instagram::MessageBuilder < Messages::Messenger::MessageBuilder
|
|||||||
message_type: message_type,
|
message_type: message_type,
|
||||||
source_id: message_identifier,
|
source_id: message_identifier,
|
||||||
content: message_content,
|
content: message_content,
|
||||||
sender: @outgoing_echo ? nil : contact
|
sender: @outgoing_echo ? nil : contact,
|
||||||
|
content_attributes: {
|
||||||
|
in_reply_to_external_id: message_reply_attributes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ class Messages::MessageBuilder
|
|||||||
@user = user
|
@user = user
|
||||||
@message_type = params[:message_type] || 'outgoing'
|
@message_type = params[:message_type] || 'outgoing'
|
||||||
@attachments = params[:attachments]
|
@attachments = params[:attachments]
|
||||||
@automation_rule = @params&.dig(:content_attributes, :automation_rule_id)
|
@automation_rule = content_attributes&.dig(:automation_rule_id)
|
||||||
return unless params.instance_of?(ActionController::Parameters)
|
return unless params.instance_of?(ActionController::Parameters)
|
||||||
|
|
||||||
@in_reply_to = params.to_unsafe_h&.dig(:content_attributes, :in_reply_to)
|
@in_reply_to = content_attributes&.dig(:in_reply_to)
|
||||||
@items = params.to_unsafe_h&.dig(:content_attributes, :items)
|
@items = content_attributes&.dig(:items)
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
@@ -26,6 +26,38 @@ class Messages::MessageBuilder
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Extracts content attributes from the given params.
|
||||||
|
# - Converts ActionController::Parameters to a regular hash if needed.
|
||||||
|
# - Attempts to parse a JSON string if content is a string.
|
||||||
|
# - Returns an empty hash if content is not present, if there's a parsing error, or if it's an unexpected type.
|
||||||
|
def content_attributes
|
||||||
|
params = convert_to_hash(@params)
|
||||||
|
content_attributes = params.fetch(:content_attributes, {})
|
||||||
|
|
||||||
|
return parse_json(content_attributes) if content_attributes.is_a?(String)
|
||||||
|
return content_attributes if content_attributes.is_a?(Hash)
|
||||||
|
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts the given object to a hash.
|
||||||
|
# If it's an instance of ActionController::Parameters, converts it to an unsafe hash.
|
||||||
|
# Otherwise, returns the object as-is.
|
||||||
|
def convert_to_hash(obj)
|
||||||
|
return obj.to_unsafe_h if obj.instance_of?(ActionController::Parameters)
|
||||||
|
|
||||||
|
obj
|
||||||
|
end
|
||||||
|
|
||||||
|
# Attempts to parse a string as JSON.
|
||||||
|
# If successful, returns the parsed hash with symbolized names.
|
||||||
|
# If unsuccessful, returns nil.
|
||||||
|
def parse_json(content)
|
||||||
|
JSON.parse(content, symbolize_names: true)
|
||||||
|
rescue JSON::ParserError
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
def process_attachments
|
def process_attachments
|
||||||
return if @attachments.blank?
|
return if @attachments.blank?
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ class V2::ReportBuilder
|
|||||||
end
|
end
|
||||||
|
|
||||||
def timeseries
|
def timeseries
|
||||||
send(params[:metric])
|
return send(params[:metric]) if metric_valid?
|
||||||
|
|
||||||
|
Rails.logger.error "ReportBuilder: Invalid metric - #{params[:metric]}"
|
||||||
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
# For backward compatible with old report
|
# For backward compatible with old report
|
||||||
@@ -53,6 +56,16 @@ class V2::ReportBuilder
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def metric_valid?
|
||||||
|
%w[conversations_count
|
||||||
|
incoming_messages_count
|
||||||
|
outgoing_messages_count
|
||||||
|
avg_first_response_time
|
||||||
|
avg_resolution_time reply_time
|
||||||
|
resolutions_count
|
||||||
|
reply_time].include?(params[:metric])
|
||||||
|
end
|
||||||
|
|
||||||
def inbox
|
def inbox
|
||||||
@inbox ||= account.inboxes.find(params[:id])
|
@inbox ||= account.inboxes.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ class Api::V1::Accounts::Actions::ContactMergesController < Api::V1::Accounts::B
|
|||||||
mergee_contact: @mergee_contact
|
mergee_contact: @mergee_contact
|
||||||
)
|
)
|
||||||
contact_merge_action.perform
|
contact_merge_action.perform
|
||||||
render json: @base_contact
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class Api::V1::Accounts::ArticlesController < Api::V1::Accounts::BaseController
|
|||||||
@articles_count = @all_articles.count
|
@articles_count = @all_articles.count
|
||||||
|
|
||||||
@articles = if list_params[:category_slug].present?
|
@articles = if list_params[:category_slug].present?
|
||||||
@all_articles.order_by_position.page(@current_page).per(50)
|
@all_articles.order_by_position.page(@current_page)
|
||||||
else
|
else
|
||||||
@all_articles.order_by_updated_at.page(@current_page)
|
@all_articles.order_by_updated_at.page(@current_page)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class Api::V1::Accounts::CategoriesController < Api::V1::Accounts::BaseControlle
|
|||||||
|
|
||||||
def category_params
|
def category_params
|
||||||
params.require(:category).permit(
|
params.require(:category).permit(
|
||||||
:name, :description, :position, :slug, :locale, :parent_category_id, :associated_category_id
|
:name, :description, :position, :slug, :locale, :icon, :parent_category_id, :associated_category_id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class Api::V1::Accounts::ContactInboxesController < Api::V1::Accounts::BaseController
|
||||||
|
before_action :ensure_inbox
|
||||||
|
|
||||||
|
def filter
|
||||||
|
contact_inbox = @inbox.contact_inboxes.where(inbox_id: permitted_params[:inbox_id], source_id: permitted_params[:source_id])
|
||||||
|
return head :not_found if contact_inbox.empty?
|
||||||
|
|
||||||
|
@contact = contact_inbox.first.contact
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def ensure_inbox
|
||||||
|
@inbox = Current.account.inboxes.find(permitted_params[:inbox_id])
|
||||||
|
authorize @inbox, :show?
|
||||||
|
end
|
||||||
|
|
||||||
|
def permitted_params
|
||||||
|
params.permit(:inbox_id, :source_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -25,7 +25,8 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController
|
|||||||
render json: { error: 'Specify search string with parameter q' }, status: :unprocessable_entity if params[:q].blank? && return
|
render json: { error: 'Specify search string with parameter q' }, status: :unprocessable_entity if params[:q].blank? && return
|
||||||
|
|
||||||
contacts = resolved_contacts.where(
|
contacts = resolved_contacts.where(
|
||||||
'name ILIKE :search OR email ILIKE :search OR phone_number ILIKE :search OR contacts.identifier LIKE :search',
|
'name ILIKE :search OR email ILIKE :search OR phone_number ILIKE :search OR contacts.identifier LIKE :search
|
||||||
|
OR contacts.additional_attributes->>\'company_name\' ILIKE :search',
|
||||||
search: "%#{params[:q].strip}%"
|
search: "%#{params[:q].strip}%"
|
||||||
)
|
)
|
||||||
@contacts_count = contacts.count
|
@contacts_count = contacts.count
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class Api::V1::Accounts::ConversationsController < Api::V1::Accounts::BaseContro
|
|||||||
end
|
end
|
||||||
|
|
||||||
def toggle_status
|
def toggle_status
|
||||||
if params[:status]
|
if params[:status].present?
|
||||||
set_conversation_status
|
set_conversation_status
|
||||||
@status = @conversation.save!
|
@status = @conversation.save!
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
class Api::V1::UploadController < Api::BaseController
|
class Api::V1::Accounts::UploadController < Api::V1::Accounts::BaseController
|
||||||
def create
|
def create
|
||||||
file_blob = ActiveStorage::Blob.create_and_upload!(
|
file_blob = ActiveStorage::Blob.create_and_upload!(
|
||||||
key: nil,
|
key: nil,
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
class Api::V1::Integrations::WebhooksController < ApplicationController
|
class Api::V1::Integrations::WebhooksController < ApplicationController
|
||||||
def create
|
def create
|
||||||
builder = Integrations::Slack::IncomingMessageBuilder.new(params)
|
builder = Integrations::Slack::IncomingMessageBuilder.new(permitted_params)
|
||||||
response = builder.perform
|
response = builder.perform
|
||||||
render json: response
|
render json: response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# TODO: This is a temporary solution to permit all params for slack unfurling job.
|
||||||
|
# We should only permit the params that we use. Handle all the params based on events and send it to the respective services.
|
||||||
|
def permitted_params
|
||||||
|
params.permit!
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ class Api::V1::Widget::BaseController < ApplicationController
|
|||||||
sender: @contact,
|
sender: @contact,
|
||||||
content: permitted_params[:message][:content],
|
content: permitted_params[:message][:content],
|
||||||
inbox_id: conversation.inbox_id,
|
inbox_id: conversation.inbox_id,
|
||||||
|
content_attributes: {
|
||||||
|
in_reply_to: permitted_params[:message][:reply_to]
|
||||||
|
},
|
||||||
echo_id: permitted_params[:message][:echo_id],
|
echo_id: permitted_params[:message][:echo_id],
|
||||||
message_type: :incoming
|
message_type: :incoming
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
||||||
include Events::Types
|
include Events::Types
|
||||||
|
before_action :render_not_found_if_empty, only: [:toggle_typing, :toggle_status, :set_custom_attributes, :destroy_custom_attributes]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@conversation = conversation
|
@conversation = conversation
|
||||||
@@ -27,6 +28,7 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
|||||||
|
|
||||||
conversation.contact_last_seen_at = DateTime.now.utc
|
conversation.contact_last_seen_at = DateTime.now.utc
|
||||||
conversation.save!
|
conversation.save!
|
||||||
|
::Conversations::UpdateMessageStatusJob.perform_later(conversation.id, conversation.contact_last_seen_at)
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,8 +43,6 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def toggle_typing
|
def toggle_typing
|
||||||
head :ok && return if conversation.nil?
|
|
||||||
|
|
||||||
case permitted_params[:typing_status]
|
case permitted_params[:typing_status]
|
||||||
when 'on'
|
when 'on'
|
||||||
trigger_typing_event(CONVERSATION_TYPING_ON)
|
trigger_typing_event(CONVERSATION_TYPING_ON)
|
||||||
@@ -54,8 +54,6 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def toggle_status
|
def toggle_status
|
||||||
return head :not_found if conversation.nil?
|
|
||||||
|
|
||||||
return head :forbidden unless @web_widget.end_conversation?
|
return head :forbidden unless @web_widget.end_conversation?
|
||||||
|
|
||||||
unless conversation.resolved?
|
unless conversation.resolved?
|
||||||
@@ -81,6 +79,10 @@ class Api::V1::Widget::ConversationsController < Api::V1::Widget::BaseController
|
|||||||
Rails.configuration.dispatcher.dispatch(event, Time.zone.now, conversation: conversation, user: @contact)
|
Rails.configuration.dispatcher.dispatch(event, Time.zone.now, conversation: conversation, user: @contact)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_not_found_if_empty
|
||||||
|
return head :not_found if conversation.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def permitted_params
|
def permitted_params
|
||||||
params.permit(:id, :typing_status, :website_token, :email, contact: [:name, :email, :phone_number],
|
params.permit(:id, :typing_status, :website_token, :email, contact: [:name, :email, :phone_number],
|
||||||
message: [:content, :referer_url, :timestamp, :echo_id],
|
message: [:content, :referer_url, :timestamp, :echo_id],
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Api::V1::Widget::MessagesController < Api::V1::Widget::BaseController
|
|||||||
|
|
||||||
def permitted_params
|
def permitted_params
|
||||||
# timestamp parameter is used in create conversation method
|
# timestamp parameter is used in create conversation method
|
||||||
params.permit(:id, :before, :after, :website_token, contact: [:name, :email], message: [:content, :referer_url, :timestamp, :echo_id])
|
params.permit(:id, :before, :after, :website_token, contact: [:name, :email], message: [:content, :referer_url, :timestamp, :echo_id, :reply_to])
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_message
|
def set_message
|
||||||
|
|||||||
@@ -9,11 +9,14 @@ module RequestExceptionHandler
|
|||||||
|
|
||||||
def handle_with_exception
|
def handle_with_exception
|
||||||
yield
|
yield
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound => e
|
||||||
|
log_handled_error(e)
|
||||||
render_not_found_error('Resource could not be found')
|
render_not_found_error('Resource could not be found')
|
||||||
rescue Pundit::NotAuthorizedError
|
rescue Pundit::NotAuthorizedError => e
|
||||||
|
log_handled_error(e)
|
||||||
render_unauthorized('You are not authorized to do this action')
|
render_unauthorized('You are not authorized to do this action')
|
||||||
rescue ActionController::ParameterMissing => e
|
rescue ActionController::ParameterMissing => e
|
||||||
|
log_handled_error(e)
|
||||||
render_could_not_create_error(e.message)
|
render_could_not_create_error(e.message)
|
||||||
ensure
|
ensure
|
||||||
# to address the thread variable leak issues in Puma/Thin webserver
|
# to address the thread variable leak issues in Puma/Thin webserver
|
||||||
@@ -41,6 +44,7 @@ module RequestExceptionHandler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_record_invalid(exception)
|
def render_record_invalid(exception)
|
||||||
|
log_handled_error(exception)
|
||||||
render json: {
|
render json: {
|
||||||
message: exception.record.errors.full_messages.join(', '),
|
message: exception.record.errors.full_messages.join(', '),
|
||||||
attributes: exception.record.errors.attribute_names
|
attributes: exception.record.errors.attribute_names
|
||||||
@@ -48,6 +52,11 @@ module RequestExceptionHandler
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_error_response(exception)
|
def render_error_response(exception)
|
||||||
|
log_handled_error(exception)
|
||||||
render json: exception.to_hash, status: exception.http_status
|
render json: exception.to_hash, status: exception.http_status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_handled_error(exception)
|
||||||
|
logger.info("Handled error: #{exception.inspect}")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Public::Api::V1::Inboxes::ConversationsController < Public::Api::V1::Inbox
|
|||||||
def update_last_seen
|
def update_last_seen
|
||||||
@conversation.contact_last_seen_at = DateTime.now.utc
|
@conversation.contact_last_seen_at = DateTime.now.utc
|
||||||
@conversation.save!
|
@conversation.save!
|
||||||
|
::Conversations::UpdateMessageStatusJob.perform_later(@conversation.id, @conversation.contact_last_seen_at)
|
||||||
head :ok
|
head :ok
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ class Public::Api::V1::Inboxes::ConversationsController < Public::Api::V1::Inbox
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_conversation
|
def create_conversation
|
||||||
::Conversation.create!(conversation_params)
|
ConversationBuilder.new(params: conversation_params, contact_inbox: @contact_inbox).perform
|
||||||
end
|
end
|
||||||
|
|
||||||
def trigger_typing_event(event)
|
def trigger_typing_event(event)
|
||||||
@@ -41,11 +42,6 @@ class Public::Api::V1::Inboxes::ConversationsController < Public::Api::V1::Inbox
|
|||||||
end
|
end
|
||||||
|
|
||||||
def conversation_params
|
def conversation_params
|
||||||
{
|
params.permit(custom_attributes: {})
|
||||||
account_id: @contact_inbox.contact.account_id,
|
|
||||||
inbox_id: @contact_inbox.inbox_id,
|
|
||||||
contact_id: @contact_inbox.contact_id,
|
|
||||||
contact_inbox_id: @contact_inbox.id
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,12 +39,8 @@ class Public::Api::V1::Portals::ArticlesController < Public::Api::V1::Portals::B
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def portal
|
|
||||||
@portal ||= Portal.find_by!(slug: permitted_params[:slug], archived: false)
|
|
||||||
end
|
|
||||||
|
|
||||||
def list_params
|
def list_params
|
||||||
params.permit(:query, :locale, :sort)
|
params.permit(:query, :locale, :sort, :status)
|
||||||
end
|
end
|
||||||
|
|
||||||
def permitted_params
|
def permitted_params
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class Public::Api::V1::Portals::BaseController < PublicController
|
class Public::Api::V1::Portals::BaseController < PublicController
|
||||||
before_action :show_plain_layout
|
before_action :show_plain_layout
|
||||||
|
before_action :set_color_scheme
|
||||||
around_action :set_locale
|
around_action :set_locale
|
||||||
after_action :allow_iframe_requests
|
after_action :allow_iframe_requests
|
||||||
|
|
||||||
@@ -9,6 +10,18 @@ class Public::Api::V1::Portals::BaseController < PublicController
|
|||||||
@is_plain_layout_enabled = params[:show_plain_layout] == 'true'
|
@is_plain_layout_enabled = params[:show_plain_layout] == 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_color_scheme
|
||||||
|
@theme = if %w[dark light].include?(params[:theme])
|
||||||
|
params[:theme]
|
||||||
|
else
|
||||||
|
'system'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def portal
|
||||||
|
@portal ||= Portal.find_by!(slug: params[:slug], archived: false)
|
||||||
|
end
|
||||||
|
|
||||||
def set_locale(&)
|
def set_locale(&)
|
||||||
switch_locale_with_portal(&) if params[:locale].present?
|
switch_locale_with_portal(&) if params[:locale].present?
|
||||||
switch_locale_with_article(&) if params[:article_slug].present?
|
switch_locale_with_article(&) if params[:article_slug].present?
|
||||||
@@ -31,6 +44,8 @@ class Public::Api::V1::Portals::BaseController < PublicController
|
|||||||
|
|
||||||
def switch_locale_with_article(&)
|
def switch_locale_with_article(&)
|
||||||
article = Article.find_by(slug: params[:article_slug])
|
article = Article.find_by(slug: params[:article_slug])
|
||||||
|
Rails.logger.info "Article: not found for slug: #{params[:article_slug]}"
|
||||||
|
render_404 && return if article.blank?
|
||||||
|
|
||||||
@locale = if article.category.present?
|
@locale = if article.category.present?
|
||||||
article.category.locale
|
article.category.locale
|
||||||
@@ -44,4 +59,9 @@ class Public::Api::V1::Portals::BaseController < PublicController
|
|||||||
def allow_iframe_requests
|
def allow_iframe_requests
|
||||||
response.headers.delete('X-Frame-Options') if @is_plain_layout_enabled
|
response.headers.delete('X-Frame-Options') if @is_plain_layout_enabled
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_404
|
||||||
|
portal
|
||||||
|
render 'public/api/v1/portals/error/404', status: :not_found
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ class Public::Api::V1::Portals::CategoriesController < Public::Api::V1::Portals:
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_category
|
def set_category
|
||||||
@category = @portal.categories.find_by!(locale: params[:locale], slug: params[:category_slug])
|
@category = @portal.categories.find_by(locale: params[:locale], slug: params[:category_slug])
|
||||||
end
|
|
||||||
|
|
||||||
def portal
|
Rails.logger.info "Category: not found for slug: #{params[:category_slug]}"
|
||||||
@portal ||= Portal.find_by!(slug: params[:slug], archived: false)
|
render_404 && return if @category.blank?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
class SlackUploadsController < ApplicationController
|
||||||
|
include Rails.application.routes.url_helpers
|
||||||
|
before_action :set_blob, only: [:show]
|
||||||
|
|
||||||
|
def show
|
||||||
|
if @blob
|
||||||
|
redirect_to blob_url
|
||||||
|
else
|
||||||
|
redirect_to avatar_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_blob
|
||||||
|
@blob = ActiveStorage::Blob.find_by(key: params[:blob_key])
|
||||||
|
end
|
||||||
|
|
||||||
|
def blob_url
|
||||||
|
url_for(@blob.representation(resize_to_fill: [250, nil]))
|
||||||
|
end
|
||||||
|
|
||||||
|
def avatar_url
|
||||||
|
base_url = ENV.fetch('FRONTEND_URL', nil)
|
||||||
|
"#{base_url}/integrations/slack/#{params[:sender_type]}.png"
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -6,6 +6,7 @@ class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController
|
|||||||
postgres_status
|
postgres_status
|
||||||
redis_metrics
|
redis_metrics
|
||||||
chatwoot_edition
|
chatwoot_edition
|
||||||
|
instance_meta
|
||||||
end
|
end
|
||||||
|
|
||||||
def chatwoot_edition
|
def chatwoot_edition
|
||||||
@@ -18,6 +19,10 @@ class SuperAdmin::InstanceStatusesController < SuperAdmin::ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def instance_meta
|
||||||
|
@metrics['Database Migrations'] = ActiveRecord::Base.connection.migration_context.needs_migration? ? 'pending' : 'completed'
|
||||||
|
end
|
||||||
|
|
||||||
def chatwoot_version
|
def chatwoot_version
|
||||||
@metrics['Chatwoot version'] = Chatwoot.config[:version]
|
@metrics['Chatwoot version'] = Chatwoot.config[:version]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
class Twilio::DeliveryStatusController < ApplicationController
|
||||||
|
def create
|
||||||
|
::Twilio::DeliveryStatusService.new(params: permitted_params).perform
|
||||||
|
|
||||||
|
head :no_content
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def permitted_params
|
||||||
|
params.permit(
|
||||||
|
:AccountSid,
|
||||||
|
:From,
|
||||||
|
:MessageSid,
|
||||||
|
:MessagingServiceSid,
|
||||||
|
:MessageStatus,
|
||||||
|
:ErrorCode,
|
||||||
|
:ErrorMessage
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -18,8 +18,8 @@ class AccountDashboard < Administrate::BaseDashboard
|
|||||||
end
|
end
|
||||||
|
|
||||||
ATTRIBUTE_TYPES = {
|
ATTRIBUTE_TYPES = {
|
||||||
id: Field::Number,
|
id: Field::Number.with_options(searchable: true),
|
||||||
name: Field::String,
|
name: Field::String.with_options(searchable: true),
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
users: CountField,
|
users: CountField,
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ class AccountUserDashboard < Administrate::BaseDashboard
|
|||||||
# which determines how the attribute is displayed
|
# which determines how the attribute is displayed
|
||||||
# on pages throughout the dashboard.
|
# on pages throughout the dashboard.
|
||||||
ATTRIBUTE_TYPES = {
|
ATTRIBUTE_TYPES = {
|
||||||
account: Field::BelongsTo.with_options(searchable: true, searchable_field: 'name', order: 'id DESC'),
|
account: Field::BelongsToSearch.with_options(class_name: 'Account', searchable: true, searchable_field: [:name, :id], order: 'id DESC'),
|
||||||
user: Field::BelongsTo.with_options(searchable: true, searchable_field: 'name', order: 'id DESC'),
|
user: Field::BelongsToSearch.with_options(class_name: 'User', searchable: true, searchable_field: [:name, :email, :id], order: 'id DESC'),
|
||||||
inviter: Field::BelongsTo.with_options(class_name: 'User', searchable: true, searchable_field: 'name'),
|
inviter: Field::BelongsToSearch.with_options(class_name: 'User', searchable: true, searchable_field: [:name, :email, :id], order: 'id DESC'),
|
||||||
id: Field::Number,
|
id: Field::Number,
|
||||||
role: Field::Select.with_options(collection: AccountUser.roles.keys),
|
role: Field::Select.with_options(collection: AccountUser.roles.keys),
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class UserDashboard < Administrate::BaseDashboard
|
|||||||
# on pages throughout the dashboard.
|
# on pages throughout the dashboard.
|
||||||
ATTRIBUTE_TYPES = {
|
ATTRIBUTE_TYPES = {
|
||||||
account_users: Field::HasMany,
|
account_users: Field::HasMany,
|
||||||
id: Field::Number,
|
id: Field::Number.with_options(searchable: true),
|
||||||
avatar_url: AvatarField,
|
avatar_url: AvatarField,
|
||||||
avatar: Field::ActiveStorage.with_options(
|
avatar: Field::ActiveStorage.with_options(
|
||||||
destroy_url: proc do |_namespace, _resource, attachment|
|
destroy_url: proc do |_namespace, _resource, attachment|
|
||||||
@@ -28,9 +28,9 @@ class UserDashboard < Administrate::BaseDashboard
|
|||||||
confirmed_at: Field::DateTime,
|
confirmed_at: Field::DateTime,
|
||||||
confirmation_sent_at: Field::DateTime,
|
confirmation_sent_at: Field::DateTime,
|
||||||
unconfirmed_email: Field::String,
|
unconfirmed_email: Field::String,
|
||||||
name: Field::String,
|
name: Field::String.with_options(searchable: true),
|
||||||
display_name: Field::String,
|
display_name: Field::String,
|
||||||
email: Field::String,
|
email: Field::String.with_options(searchable: true),
|
||||||
tokens: Field::String.with_options(searchable: false),
|
tokens: Field::String.with_options(searchable: false),
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
module PortalHelper
|
||||||
|
def generate_portal_bg_color(portal_color, theme)
|
||||||
|
base_color = theme == 'dark' ? 'black' : 'white'
|
||||||
|
"color-mix(in srgb, #{portal_color} 20%, #{base_color})"
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_portal_bg(portal_color, theme)
|
||||||
|
bg_image = theme == 'dark' ? 'hexagon-dark.svg' : 'hexagon-light.svg'
|
||||||
|
"background: url(/assets/images/hc/#{bg_image}) #{generate_portal_bg_color(portal_color, theme)}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def language_name(locale)
|
||||||
|
language_map = YAML.load_file(Rails.root.join('config/languages/language_map.yml'))
|
||||||
|
language_map[locale] || locale
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_theme_names(theme)
|
||||||
|
if theme == 'light'
|
||||||
|
I18n.t('public_portal.header.appearance.light')
|
||||||
|
elsif theme == 'dark'
|
||||||
|
I18n.t('public_portal.header.appearance.dark')
|
||||||
|
else
|
||||||
|
I18n.t('public_portal.header.appearance.system')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_theme_icon(theme)
|
||||||
|
if theme == 'light'
|
||||||
|
'icons/sun'
|
||||||
|
elsif theme == 'dark'
|
||||||
|
'icons/moon'
|
||||||
|
else
|
||||||
|
'icons/monitor'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_gradient_to_bottom(theme)
|
||||||
|
"background-image: linear-gradient(to bottom, transparent, #{theme == 'dark' ? '#151718' : 'white'})"
|
||||||
|
end
|
||||||
|
|
||||||
|
def generate_article_link(portal_slug, article_slug, theme)
|
||||||
|
"/hc/#{portal_slug}/articles/#{article_slug}#{theme.present? && theme != 'system' ? "?theme=#{theme}" : ''}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def render_category_content(content)
|
||||||
|
ChatwootMarkdownRenderer.new(content).render_markdown_to_plain_text
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="!authUIFlags.isFetching"
|
v-if="!authUIFlags.isFetching && !accountUIFlags.isFetchingItem"
|
||||||
id="app"
|
id="app"
|
||||||
class="app-wrapper h-full flex-grow-0 min-h-0 w-full"
|
class="app-wrapper h-full flex-grow-0 min-h-0 w-full"
|
||||||
:class="{ 'app-rtl--wrapper': isRTLView }"
|
:class="{ 'app-rtl--wrapper': isRTLView }"
|
||||||
:dir="isRTLView ? 'rtl' : 'ltr'"
|
:dir="isRTLView ? 'rtl' : 'ltr'"
|
||||||
>
|
>
|
||||||
<update-banner :latest-chatwoot-version="latestChatwootVersion" />
|
<update-banner :latest-chatwoot-version="latestChatwootVersion" />
|
||||||
<template v-if="!accountUIFlags.isFetchingItem && currentAccountId">
|
<template v-if="currentAccountId">
|
||||||
<payment-pending-banner />
|
<payment-pending-banner />
|
||||||
<upgrade-banner />
|
<upgrade-banner />
|
||||||
</template>
|
</template>
|
||||||
@@ -26,14 +26,14 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import AddAccountModal from '../dashboard/components/layout/sidebarComponents/AddAccountModal';
|
import AddAccountModal from '../dashboard/components/layout/sidebarComponents/AddAccountModal.vue';
|
||||||
import LoadingState from './components/widgets/LoadingState.vue';
|
import LoadingState from './components/widgets/LoadingState.vue';
|
||||||
import NetworkNotification from './components/NetworkNotification';
|
import NetworkNotification from './components/NetworkNotification.vue';
|
||||||
import UpdateBanner from './components/app/UpdateBanner.vue';
|
import UpdateBanner from './components/app/UpdateBanner.vue';
|
||||||
import UpgradeBanner from './components/app/UpgradeBanner.vue';
|
import UpgradeBanner from './components/app/UpgradeBanner.vue';
|
||||||
import PaymentPendingBanner from './components/app/PaymentPendingBanner.vue';
|
import PaymentPendingBanner from './components/app/PaymentPendingBanner.vue';
|
||||||
import vueActionCable from './helper/actionCable';
|
import vueActionCable from './helper/actionCable';
|
||||||
import WootSnackbarBox from './components/SnackbarContainer';
|
import WootSnackbarBox from './components/SnackbarContainer.vue';
|
||||||
import rtlMixin from 'shared/mixins/rtlMixin';
|
import rtlMixin from 'shared/mixins/rtlMixin';
|
||||||
import { setColorTheme } from './helper/themeHelper';
|
import { setColorTheme } from './helper/themeHelper';
|
||||||
import {
|
import {
|
||||||
@@ -111,10 +111,8 @@ export default {
|
|||||||
this.$store.dispatch('setActiveAccount', {
|
this.$store.dispatch('setActiveAccount', {
|
||||||
accountId: this.currentAccountId,
|
accountId: this.currentAccountId,
|
||||||
});
|
});
|
||||||
const {
|
const { locale, latest_chatwoot_version: latestChatwootVersion } =
|
||||||
locale,
|
this.getAccount(this.currentAccountId);
|
||||||
latest_chatwoot_version: latestChatwootVersion,
|
|
||||||
} = this.getAccount(this.currentAccountId);
|
|
||||||
const { pubsub_token: pubsubToken } = this.currentUser || {};
|
const { pubsub_token: pubsubToken } = this.currentUser || {};
|
||||||
this.setLocale(locale);
|
this.setLocale(locale);
|
||||||
this.updateRTLDirectionView(locale);
|
this.updateRTLDirectionView(locale);
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ class ApiClient {
|
|||||||
|
|
||||||
// eslint-disable-next-line class-methods-use-this
|
// eslint-disable-next-line class-methods-use-this
|
||||||
get accountIdFromRoute() {
|
get accountIdFromRoute() {
|
||||||
const isInsideAccountScopedURLs = window.location.pathname.includes(
|
const isInsideAccountScopedURLs =
|
||||||
'/app/accounts'
|
window.location.pathname.includes('/app/accounts');
|
||||||
);
|
|
||||||
|
|
||||||
if (isInsideAccountScopedURLs) {
|
if (isInsideAccountScopedURLs) {
|
||||||
return window.location.pathname.split('/')[3];
|
return window.location.pathname.split('/')[3];
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ export default {
|
|||||||
return axios.delete(endPoints('deleteAvatar').url);
|
return axios.delete(endPoints('deleteAvatar').url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
resetPassword({ email }) {
|
||||||
|
const urlData = endPoints('resetPassword');
|
||||||
|
return axios.post(urlData.url, { email });
|
||||||
|
},
|
||||||
|
|
||||||
setActiveAccount({ accountId }) {
|
setActiveAccount({ accountId }) {
|
||||||
const urlData = endPoints('setActiveAccount');
|
const urlData = endPoints('setActiveAccount');
|
||||||
return axios.put(urlData.url, {
|
return axios.put(urlData.url, {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class ContactAPI extends ApiClient {
|
|||||||
return axios.get(requestURL);
|
return axios.get(requestURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line default-param-last
|
||||||
filter(page = 1, sortAttr = 'name', queryPayload) {
|
filter(page = 1, sortAttr = 'name', queryPayload) {
|
||||||
let requestURL = `${this.url}/filter?${buildContactParams(page, sortAttr)}`;
|
let requestURL = `${this.url}/filter?${buildContactParams(page, sortAttr)}`;
|
||||||
return axios.post(requestURL, queryPayload);
|
return axios.post(requestURL, queryPayload);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import accountAPI from '../account';
|
import accountAPI from '../account';
|
||||||
import ApiClient from '../../ApiClient';
|
import ApiClient from '../../ApiClient';
|
||||||
import describeWithAPIMock from '../../specs/apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#enterpriseAccountAPI', () => {
|
describe('#enterpriseAccountAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -13,17 +12,33 @@ describe('#enterpriseAccountAPI', () => {
|
|||||||
expect(accountAPI).toHaveProperty('checkout');
|
expect(accountAPI).toHaveProperty('checkout');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#checkout', () => {
|
it('#checkout', () => {
|
||||||
accountAPI.checkout();
|
accountAPI.checkout();
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/enterprise/api/v1/checkout'
|
'/enterprise/api/v1/checkout'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#subscription', () => {
|
it('#subscription', () => {
|
||||||
accountAPI.subscription();
|
accountAPI.subscription();
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/enterprise/api/v1/subscription'
|
'/enterprise/api/v1/subscription'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/* global axios */
|
/* global axios */
|
||||||
|
|
||||||
import PortalsAPI from './portals';
|
import PortalsAPI from './portals';
|
||||||
|
import { getArticleSearchURL } from 'dashboard/helper/URLHelper.js';
|
||||||
|
|
||||||
class ArticlesAPI extends PortalsAPI {
|
class ArticlesAPI extends PortalsAPI {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -12,14 +13,31 @@ class ArticlesAPI extends PortalsAPI {
|
|||||||
portalSlug,
|
portalSlug,
|
||||||
locale,
|
locale,
|
||||||
status,
|
status,
|
||||||
author_id,
|
authorId,
|
||||||
category_slug,
|
categorySlug,
|
||||||
|
sort,
|
||||||
}) {
|
}) {
|
||||||
let baseUrl = `${this.url}/${portalSlug}/articles?page=${pageNumber}&locale=${locale}`;
|
const url = getArticleSearchURL({
|
||||||
if (status !== undefined) baseUrl += `&status=${status}`;
|
pageNumber,
|
||||||
if (author_id) baseUrl += `&author_id=${author_id}`;
|
portalSlug,
|
||||||
if (category_slug) baseUrl += `&category_slug=${category_slug}`;
|
locale,
|
||||||
return axios.get(baseUrl);
|
status,
|
||||||
|
authorId,
|
||||||
|
categorySlug,
|
||||||
|
sort,
|
||||||
|
host: this.url,
|
||||||
|
});
|
||||||
|
|
||||||
|
return axios.get(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchArticles({ portalSlug, query }) {
|
||||||
|
const url = getArticleSearchURL({
|
||||||
|
portalSlug,
|
||||||
|
query,
|
||||||
|
host: this.url,
|
||||||
|
});
|
||||||
|
return axios.get(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
getArticle({ id, portalSlug }) {
|
getArticle({ id, portalSlug }) {
|
||||||
|
|||||||
@@ -26,9 +26,13 @@ export const buildCreatePayload = ({
|
|||||||
payload.append('echo_id', echoId);
|
payload.append('echo_id', echoId);
|
||||||
payload.append('cc_emails', ccEmails);
|
payload.append('cc_emails', ccEmails);
|
||||||
payload.append('bcc_emails', bccEmails);
|
payload.append('bcc_emails', bccEmails);
|
||||||
|
|
||||||
if (toEmails) {
|
if (toEmails) {
|
||||||
payload.append('to_emails', toEmails);
|
payload.append('to_emails', toEmails);
|
||||||
}
|
}
|
||||||
|
if (contentAttributes) {
|
||||||
|
payload.append('content_attributes', JSON.stringify(contentAttributes));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
payload = {
|
payload = {
|
||||||
content: message,
|
content: message,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class ReportsAPI extends ApiClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line default-param-last
|
||||||
getSummary(since, until, type = 'account', id, groupBy, businessHours) {
|
getSummary(since, until, type = 'account', id, groupBy, businessHours) {
|
||||||
return axios.get(`${this.url}/summary`, {
|
return axios.get(`${this.url}/summary`, {
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import accountAPI from '../account';
|
import accountAPI from '../account';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#accountAPI', () => {
|
describe('#accountAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -13,12 +12,28 @@ describe('#accountAPI', () => {
|
|||||||
expect(accountAPI).toHaveProperty('createAccount');
|
expect(accountAPI).toHaveProperty('createAccount');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#createAccount', () => {
|
it('#createAccount', () => {
|
||||||
accountAPI.createAccount({
|
accountAPI.createAccount({
|
||||||
name: 'Chatwoot',
|
name: 'Chatwoot',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith('/api/v1/accounts', {
|
expect(axiosMock.post).toHaveBeenCalledWith('/api/v1/accounts', {
|
||||||
name: 'Chatwoot',
|
name: 'Chatwoot',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import accountActionsAPI from '../accountActions';
|
import accountActionsAPI from '../accountActions';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#ContactsAPI', () => {
|
describe('#ContactsAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -8,10 +7,26 @@ describe('#ContactsAPI', () => {
|
|||||||
expect(accountActionsAPI).toHaveProperty('merge');
|
expect(accountActionsAPI).toHaveProperty('merge');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#merge', () => {
|
it('#merge', () => {
|
||||||
accountActionsAPI.merge(1, 2);
|
accountActionsAPI.merge(1, 2);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/actions/contact_merge',
|
'/api/v1/actions/contact_merge',
|
||||||
{
|
{
|
||||||
base_contact_id: 1,
|
base_contact_id: 1,
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
function apiSpecHelper() {
|
|
||||||
beforeEach(() => {
|
|
||||||
this.originalAxios = window.axios;
|
|
||||||
this.axiosMock = {
|
|
||||||
post: jest.fn(() => Promise.resolve()),
|
|
||||||
get: jest.fn(() => Promise.resolve()),
|
|
||||||
patch: jest.fn(() => Promise.resolve()),
|
|
||||||
delete: jest.fn(() => Promise.resolve()),
|
|
||||||
};
|
|
||||||
window.axios = this.axiosMock;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
window.axios = this.originalAxios;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// https://stackoverflow.com/a/59344023/3901856
|
|
||||||
const sharedWrapper = describe('sharedWrapper', () => {});
|
|
||||||
export default function describeWithAPIMock(skillName, testFn) {
|
|
||||||
return describe(skillName, function configureContext() {
|
|
||||||
function Context() {}
|
|
||||||
Context.prototype = sharedWrapper.ctx;
|
|
||||||
this.ctx = new Context();
|
|
||||||
apiSpecHelper.call(this);
|
|
||||||
testFn.call(this, this);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import articlesAPI from '../helpCenter/articles';
|
import articlesAPI from '../helpCenter/articles';
|
||||||
import ApiClient from 'dashboard/api/helpCenter/portals';
|
import ApiClient from 'dashboard/api/helpCenter/portals';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#PortalAPI', () => {
|
describe('#PortalAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -12,39 +11,114 @@ describe('#PortalAPI', () => {
|
|||||||
expect(articlesAPI).toHaveProperty('delete');
|
expect(articlesAPI).toHaveProperty('delete');
|
||||||
expect(articlesAPI).toHaveProperty('getArticles');
|
expect(articlesAPI).toHaveProperty('getArticles');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getArticles', () => {
|
it('#getArticles', () => {
|
||||||
articlesAPI.getArticles({
|
articlesAPI.getArticles({
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
portalSlug: 'room-rental',
|
portalSlug: 'room-rental',
|
||||||
locale: 'en-US',
|
locale: 'en-US',
|
||||||
status: 'published',
|
status: 'published',
|
||||||
author_id: '1',
|
authorId: '1',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/portals/room-rental/articles?page=1&locale=en-US&status=published&author_id=1'
|
'/api/v1/portals/room-rental/articles?page=1&locale=en-US&status=published&author_id=1'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getArticle', () => {
|
it('#getArticle', () => {
|
||||||
articlesAPI.getArticle({
|
articlesAPI.getArticle({
|
||||||
id: 1,
|
id: 1,
|
||||||
portalSlug: 'room-rental',
|
portalSlug: 'room-rental',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/portals/room-rental/articles/1'
|
'/api/v1/portals/room-rental/articles/1'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('#searchArticles', () => {
|
||||||
|
articlesAPI.searchArticles({
|
||||||
|
query: 'test',
|
||||||
|
portalSlug: 'room-rental',
|
||||||
|
});
|
||||||
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
|
'/api/v1/portals/room-rental/articles?query=test'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#updateArticle', () => {
|
it('#updateArticle', () => {
|
||||||
articlesAPI.updateArticle({
|
articlesAPI.updateArticle({
|
||||||
articleId: 1,
|
articleId: 1,
|
||||||
portalSlug: 'room-rental',
|
portalSlug: 'room-rental',
|
||||||
articleObj: { title: 'Update shipping address' },
|
articleObj: { title: 'Update shipping address' },
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.patch).toHaveBeenCalledWith(
|
expect(axiosMock.patch).toHaveBeenCalledWith(
|
||||||
'/api/v1/portals/room-rental/articles/1',
|
'/api/v1/portals/room-rental/articles/1',
|
||||||
{
|
{
|
||||||
title: 'Update shipping address',
|
title: 'Update shipping address',
|
||||||
@@ -52,13 +126,29 @@ describe('#PortalAPI', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#deleteArticle', () => {
|
it('#deleteArticle', () => {
|
||||||
articlesAPI.deleteArticle({
|
articlesAPI.deleteArticle({
|
||||||
articleId: 1,
|
articleId: 1,
|
||||||
portalSlug: 'room-rental',
|
portalSlug: 'room-rental',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
expect(axiosMock.delete).toHaveBeenCalledWith(
|
||||||
'/api/v1/portals/room-rental/articles/1'
|
'/api/v1/portals/room-rental/articles/1'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,18 +1,30 @@
|
|||||||
import assignableAgentsAPI from '../assignableAgents';
|
import assignableAgentsAPI from '../assignableAgents';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#AssignableAgentsAPI', () => {
|
describe('#AssignableAgentsAPI', () => {
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getAssignableAgents', () => {
|
it('#getAssignableAgents', () => {
|
||||||
assignableAgentsAPI.get([1]);
|
assignableAgentsAPI.get([1]);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/assignable_agents', {
|
||||||
'/api/v1/assignable_agents',
|
params: {
|
||||||
{
|
inbox_ids: [1],
|
||||||
params: {
|
},
|
||||||
inbox_ids: [1],
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import fbChannel from '../../channel/fbChannel';
|
import fbChannel from '../../channel/fbChannel';
|
||||||
import ApiClient from '../../ApiClient';
|
import ApiClient from '../../ApiClient';
|
||||||
import describeWithAPIMock from '../apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#FBChannel', () => {
|
describe('#FBChannel', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -11,10 +10,26 @@ describe('#FBChannel', () => {
|
|||||||
expect(fbChannel).toHaveProperty('update');
|
expect(fbChannel).toHaveProperty('update');
|
||||||
expect(fbChannel).toHaveProperty('delete');
|
expect(fbChannel).toHaveProperty('delete');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#create', () => {
|
it('#create', () => {
|
||||||
fbChannel.create({ omniauthToken: 'ASFM131CSF@#@$', appId: 'chatwoot' });
|
fbChannel.create({ omniauthToken: 'ASFM131CSF@#@$', appId: 'chatwoot' });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/callbacks/register_facebook_page',
|
'/api/v1/callbacks/register_facebook_page',
|
||||||
{
|
{
|
||||||
omniauthToken: 'ASFM131CSF@#@$',
|
omniauthToken: 'ASFM131CSF@#@$',
|
||||||
@@ -27,7 +42,7 @@ describe('#FBChannel', () => {
|
|||||||
omniauthToken: 'ASFM131CSF@#@$',
|
omniauthToken: 'ASFM131CSF@#@$',
|
||||||
inboxId: 1,
|
inboxId: 1,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/callbacks/reauthorize_page',
|
'/api/v1/callbacks/reauthorize_page',
|
||||||
{
|
{
|
||||||
omniauth_token: 'ASFM131CSF@#@$',
|
omniauth_token: 'ASFM131CSF@#@$',
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import contactAPI, { buildContactParams } from '../contacts';
|
import contactAPI, { buildContactParams } from '../contacts';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#ContactsAPI', () => {
|
describe('#ContactsAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -15,56 +14,67 @@ describe('#ContactsAPI', () => {
|
|||||||
expect(contactAPI).toHaveProperty('destroyAvatar');
|
expect(contactAPI).toHaveProperty('destroyAvatar');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#get', () => {
|
it('#get', () => {
|
||||||
contactAPI.get(1, 'name', 'customer-support');
|
contactAPI.get(1, 'name', 'customer-support');
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts?include_contact_inboxes=false&page=1&sort=name&labels[]=customer-support'
|
'/api/v1/contacts?include_contact_inboxes=false&page=1&sort=name&labels[]=customer-support'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getConversations', () => {
|
it('#getConversations', () => {
|
||||||
contactAPI.getConversations(1);
|
contactAPI.getConversations(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/1/conversations'
|
'/api/v1/contacts/1/conversations'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getContactableInboxes', () => {
|
it('#getContactableInboxes', () => {
|
||||||
contactAPI.getContactableInboxes(1);
|
contactAPI.getContactableInboxes(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/1/contactable_inboxes'
|
'/api/v1/contacts/1/contactable_inboxes'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getContactLabels', () => {
|
it('#getContactLabels', () => {
|
||||||
contactAPI.getContactLabels(1);
|
contactAPI.getContactLabels(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/contacts/1/labels');
|
||||||
'/api/v1/contacts/1/labels'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#updateContactLabels', () => {
|
it('#updateContactLabels', () => {
|
||||||
const labels = ['support-query'];
|
const labels = ['support-query'];
|
||||||
contactAPI.updateContactLabels(1, labels);
|
contactAPI.updateContactLabels(1, labels);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith('/api/v1/contacts/1/labels', {
|
||||||
'/api/v1/contacts/1/labels',
|
labels,
|
||||||
{
|
});
|
||||||
labels,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#search', () => {
|
it('#search', () => {
|
||||||
contactAPI.search('leads', 1, 'date', 'customer-support');
|
contactAPI.search('leads', 1, 'date', 'customer-support');
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/search?include_contact_inboxes=false&page=1&sort=date&q=leads&labels[]=customer-support'
|
'/api/v1/contacts/search?include_contact_inboxes=false&page=1&sort=date&q=leads&labels[]=customer-support'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#destroyCustomAttributes', () => {
|
it('#destroyCustomAttributes', () => {
|
||||||
contactAPI.destroyCustomAttributes(1, ['cloudCustomer']);
|
contactAPI.destroyCustomAttributes(1, ['cloudCustomer']);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/1/destroy_custom_attributes',
|
'/api/v1/contacts/1/destroy_custom_attributes',
|
||||||
{
|
{
|
||||||
custom_attributes: ['cloudCustomer'],
|
custom_attributes: ['cloudCustomer'],
|
||||||
@@ -75,7 +85,7 @@ describe('#ContactsAPI', () => {
|
|||||||
it('#importContacts', () => {
|
it('#importContacts', () => {
|
||||||
const file = 'file';
|
const file = 'file';
|
||||||
contactAPI.importContacts(file);
|
contactAPI.importContacts(file);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/import',
|
'/api/v1/contacts/import',
|
||||||
expect.any(FormData),
|
expect.any(FormData),
|
||||||
{
|
{
|
||||||
@@ -96,7 +106,7 @@ describe('#ContactsAPI', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
contactAPI.filter(1, 'name', queryPayload);
|
contactAPI.filter(1, 'name', queryPayload);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/filter?include_contact_inboxes=false&page=1&sort=name',
|
'/api/v1/contacts/filter?include_contact_inboxes=false&page=1&sort=name',
|
||||||
queryPayload
|
queryPayload
|
||||||
);
|
);
|
||||||
@@ -104,7 +114,7 @@ describe('#ContactsAPI', () => {
|
|||||||
|
|
||||||
it('#destroyAvatar', () => {
|
it('#destroyAvatar', () => {
|
||||||
contactAPI.destroyAvatar(1);
|
contactAPI.destroyAvatar(1);
|
||||||
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
expect(axiosMock.delete).toHaveBeenCalledWith(
|
||||||
'/api/v1/contacts/1/avatar'
|
'/api/v1/contacts/1/avatar'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import conversationsAPI from '../conversations';
|
import conversationsAPI from '../conversations';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#ConversationApi', () => {
|
describe('#ConversationApi', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -14,10 +13,26 @@ describe('#ConversationApi', () => {
|
|||||||
expect(conversationsAPI).toHaveProperty('updateLabels');
|
expect(conversationsAPI).toHaveProperty('updateLabels');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getLabels', () => {
|
it('#getLabels', () => {
|
||||||
conversationsAPI.getLabels(1);
|
conversationsAPI.getLabels(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/1/labels'
|
'/api/v1/conversations/1/labels'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -25,7 +40,7 @@ describe('#ConversationApi', () => {
|
|||||||
it('#updateLabels', () => {
|
it('#updateLabels', () => {
|
||||||
const labels = ['support-query'];
|
const labels = ['support-query'];
|
||||||
conversationsAPI.updateLabels(1, labels);
|
conversationsAPI.updateLabels(1, labels);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/1/labels',
|
'/api/v1/conversations/1/labels',
|
||||||
{
|
{
|
||||||
labels,
|
labels,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import csatReportsAPI from '../csatReports';
|
import csatReportsAPI from '../csatReports';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#Reports API', () => {
|
describe('#Reports API', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -9,10 +8,26 @@ describe('#Reports API', () => {
|
|||||||
expect(csatReportsAPI).toHaveProperty('get');
|
expect(csatReportsAPI).toHaveProperty('get');
|
||||||
expect(csatReportsAPI).toHaveProperty('getMetrics');
|
expect(csatReportsAPI).toHaveProperty('getMetrics');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#get', () => {
|
it('#get', () => {
|
||||||
csatReportsAPI.get({ page: 1, from: 1622485800, to: 1623695400 });
|
csatReportsAPI.get({ page: 1, from: 1622485800, to: 1623695400 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/csat_survey_responses',
|
'/api/v1/csat_survey_responses',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
@@ -26,7 +41,7 @@ describe('#Reports API', () => {
|
|||||||
});
|
});
|
||||||
it('#getMetrics', () => {
|
it('#getMetrics', () => {
|
||||||
csatReportsAPI.getMetrics({ from: 1622485800, to: 1623695400 });
|
csatReportsAPI.getMetrics({ from: 1622485800, to: 1623695400 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/csat_survey_responses/metrics',
|
'/api/v1/csat_survey_responses/metrics',
|
||||||
{
|
{
|
||||||
params: { since: 1622485800, until: 1623695400 },
|
params: { since: 1622485800, until: 1623695400 },
|
||||||
@@ -39,7 +54,7 @@ describe('#Reports API', () => {
|
|||||||
to: 1623695400,
|
to: 1623695400,
|
||||||
user_ids: 1,
|
user_ids: 1,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/csat_survey_responses/download',
|
'/api/v1/csat_survey_responses/download',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import conversationAPI from '../../inbox/conversation';
|
import conversationAPI from '../../inbox/conversation';
|
||||||
import ApiClient from '../../ApiClient';
|
import ApiClient from '../../ApiClient';
|
||||||
import describeWithAPIMock from '../apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#ConversationAPI', () => {
|
describe('#ConversationAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -22,7 +21,23 @@ describe('#ConversationAPI', () => {
|
|||||||
expect(conversationAPI).toHaveProperty('filter');
|
expect(conversationAPI).toHaveProperty('filter');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#get conversations', () => {
|
it('#get conversations', () => {
|
||||||
conversationAPI.get({
|
conversationAPI.get({
|
||||||
inboxId: 1,
|
inboxId: 1,
|
||||||
@@ -32,19 +47,16 @@ describe('#ConversationAPI', () => {
|
|||||||
labels: [],
|
labels: [],
|
||||||
teamId: 1,
|
teamId: 1,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/conversations', {
|
||||||
'/api/v1/conversations',
|
params: {
|
||||||
{
|
inbox_id: 1,
|
||||||
params: {
|
team_id: 1,
|
||||||
inbox_id: 1,
|
status: 'open',
|
||||||
team_id: 1,
|
assignee_type: 'me',
|
||||||
status: 'open',
|
page: 1,
|
||||||
assignee_type: 'me',
|
labels: [],
|
||||||
page: 1,
|
},
|
||||||
labels: [],
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#search', () => {
|
it('#search', () => {
|
||||||
@@ -53,7 +65,7 @@ describe('#ConversationAPI', () => {
|
|||||||
page: 1,
|
page: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/search',
|
'/api/v1/conversations/search',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
@@ -66,7 +78,7 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#toggleStatus', () => {
|
it('#toggleStatus', () => {
|
||||||
conversationAPI.toggleStatus({ conversationId: 12, status: 'online' });
|
conversationAPI.toggleStatus({ conversationId: 12, status: 'online' });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/toggle_status`,
|
`/api/v1/conversations/12/toggle_status`,
|
||||||
{
|
{
|
||||||
status: 'online',
|
status: 'online',
|
||||||
@@ -77,7 +89,7 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#assignAgent', () => {
|
it('#assignAgent', () => {
|
||||||
conversationAPI.assignAgent({ conversationId: 12, agentId: 34 });
|
conversationAPI.assignAgent({ conversationId: 12, agentId: 34 });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/assignments?assignee_id=34`,
|
`/api/v1/conversations/12/assignments?assignee_id=34`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
@@ -85,7 +97,7 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#assignTeam', () => {
|
it('#assignTeam', () => {
|
||||||
conversationAPI.assignTeam({ conversationId: 12, teamId: 1 });
|
conversationAPI.assignTeam({ conversationId: 12, teamId: 1 });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/assignments`,
|
`/api/v1/conversations/12/assignments`,
|
||||||
{
|
{
|
||||||
team_id: 1,
|
team_id: 1,
|
||||||
@@ -95,7 +107,7 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#markMessageRead', () => {
|
it('#markMessageRead', () => {
|
||||||
conversationAPI.markMessageRead({ id: 12 });
|
conversationAPI.markMessageRead({ id: 12 });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/update_last_seen`
|
`/api/v1/conversations/12/update_last_seen`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -105,7 +117,7 @@ describe('#ConversationAPI', () => {
|
|||||||
conversationId: 12,
|
conversationId: 12,
|
||||||
status: 'typing_on',
|
status: 'typing_on',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/toggle_typing_status`,
|
`/api/v1/conversations/12/toggle_typing_status`,
|
||||||
{
|
{
|
||||||
typing_status: 'typing_on',
|
typing_status: 'typing_on',
|
||||||
@@ -115,14 +127,14 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#mute', () => {
|
it('#mute', () => {
|
||||||
conversationAPI.mute(45);
|
conversationAPI.mute(45);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/45/mute'
|
'/api/v1/conversations/45/mute'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#unmute', () => {
|
it('#unmute', () => {
|
||||||
conversationAPI.unmute(45);
|
conversationAPI.unmute(45);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/45/unmute'
|
'/api/v1/conversations/45/unmute'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -135,18 +147,15 @@ describe('#ConversationAPI', () => {
|
|||||||
labels: [],
|
labels: [],
|
||||||
teamId: 1,
|
teamId: 1,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/conversations/meta', {
|
||||||
'/api/v1/conversations/meta',
|
params: {
|
||||||
{
|
inbox_id: 1,
|
||||||
params: {
|
team_id: 1,
|
||||||
inbox_id: 1,
|
status: 'open',
|
||||||
team_id: 1,
|
assignee_type: 'me',
|
||||||
status: 'open',
|
labels: [],
|
||||||
assignee_type: 'me',
|
},
|
||||||
labels: [],
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#sendEmailTranscript', () => {
|
it('#sendEmailTranscript', () => {
|
||||||
@@ -154,7 +163,7 @@ describe('#ConversationAPI', () => {
|
|||||||
conversationId: 45,
|
conversationId: 45,
|
||||||
email: 'john@acme.inc',
|
email: 'john@acme.inc',
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/45/transcript',
|
'/api/v1/conversations/45/transcript',
|
||||||
{
|
{
|
||||||
email: 'john@acme.inc',
|
email: 'john@acme.inc',
|
||||||
@@ -167,7 +176,7 @@ describe('#ConversationAPI', () => {
|
|||||||
conversationId: 45,
|
conversationId: 45,
|
||||||
customAttributes: { order_d: '1001' },
|
customAttributes: { order_d: '1001' },
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/45/custom_attributes',
|
'/api/v1/conversations/45/custom_attributes',
|
||||||
{
|
{
|
||||||
custom_attributes: { order_d: '1001' },
|
custom_attributes: { order_d: '1001' },
|
||||||
@@ -202,9 +211,7 @@ describe('#ConversationAPI', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
conversationAPI.filter(payload);
|
conversationAPI.filter(payload);
|
||||||
expect(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
context.axiosMock.post
|
|
||||||
).toHaveBeenCalledWith(
|
|
||||||
'/api/v1/conversations/filter',
|
'/api/v1/conversations/filter',
|
||||||
payload.queryData,
|
payload.queryData,
|
||||||
{ params: { page: payload.page } }
|
{ params: { page: payload.page } }
|
||||||
@@ -213,7 +220,7 @@ describe('#ConversationAPI', () => {
|
|||||||
|
|
||||||
it('#getAllAttachments', () => {
|
it('#getAllAttachments', () => {
|
||||||
conversationAPI.getAllAttachments(1);
|
conversationAPI.getAllAttachments(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/conversations/1/attachments'
|
'/api/v1/conversations/1/attachments'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import messageAPI, { buildCreatePayload } from '../../inbox/message';
|
import messageAPI, { buildCreatePayload } from '../../inbox/message';
|
||||||
import ApiClient from '../../ApiClient';
|
import ApiClient from '../../ApiClient';
|
||||||
import describeWithAPIMock from '../apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#ConversationAPI', () => {
|
describe('#ConversationAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -13,13 +12,29 @@ describe('#ConversationAPI', () => {
|
|||||||
expect(messageAPI).toHaveProperty('getPreviousMessages');
|
expect(messageAPI).toHaveProperty('getPreviousMessages');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getPreviousMessages', () => {
|
it('#getPreviousMessages', () => {
|
||||||
messageAPI.getPreviousMessages({
|
messageAPI.getPreviousMessages({
|
||||||
conversationId: 12,
|
conversationId: 12,
|
||||||
before: 4573,
|
before: 4573,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
`/api/v1/conversations/12/messages`,
|
`/api/v1/conversations/12/messages`,
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
@@ -35,7 +50,7 @@ describe('#ConversationAPI', () => {
|
|||||||
message: 'test content',
|
message: 'test content',
|
||||||
echoId: 12,
|
echoId: 12,
|
||||||
isPrivate: true,
|
isPrivate: true,
|
||||||
|
contentAttributes: { in_reply_to: 12 },
|
||||||
files: [new Blob(['test-content'], { type: 'application/pdf' })],
|
files: [new Blob(['test-content'], { type: 'application/pdf' })],
|
||||||
});
|
});
|
||||||
expect(formPayload).toBeInstanceOf(FormData);
|
expect(formPayload).toBeInstanceOf(FormData);
|
||||||
@@ -43,6 +58,10 @@ describe('#ConversationAPI', () => {
|
|||||||
expect(formPayload.get('echo_id')).toEqual('12');
|
expect(formPayload.get('echo_id')).toEqual('12');
|
||||||
expect(formPayload.get('private')).toEqual('true');
|
expect(formPayload.get('private')).toEqual('true');
|
||||||
expect(formPayload.get('cc_emails')).toEqual('');
|
expect(formPayload.get('cc_emails')).toEqual('');
|
||||||
|
expect(formPayload.get('bcc_emails')).toEqual('');
|
||||||
|
expect(formPayload.get('content_attributes')).toEqual(
|
||||||
|
'{"in_reply_to":12}'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('builds object payload if file is not available', () => {
|
it('builds object payload if file is not available', () => {
|
||||||
@@ -58,8 +77,10 @@ describe('#ConversationAPI', () => {
|
|||||||
private: false,
|
private: false,
|
||||||
echo_id: 12,
|
echo_id: 12,
|
||||||
content_attributes: { in_reply_to: 12 },
|
content_attributes: { in_reply_to: 12 },
|
||||||
bcc_emails: '',
|
|
||||||
cc_emails: '',
|
cc_emails: '',
|
||||||
|
bcc_emails: '',
|
||||||
|
to_emails: '',
|
||||||
|
template_params: undefined,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import inboxesAPI from '../inboxes';
|
import inboxesAPI from '../inboxes';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#InboxesAPI', () => {
|
describe('#InboxesAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -14,19 +13,32 @@ describe('#InboxesAPI', () => {
|
|||||||
expect(inboxesAPI).toHaveProperty('getAgentBot');
|
expect(inboxesAPI).toHaveProperty('getAgentBot');
|
||||||
expect(inboxesAPI).toHaveProperty('setAgentBot');
|
expect(inboxesAPI).toHaveProperty('setAgentBot');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
|
||||||
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getCampaigns', () => {
|
it('#getCampaigns', () => {
|
||||||
inboxesAPI.getCampaigns(2);
|
inboxesAPI.getCampaigns(2);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v1/inboxes/2/campaigns');
|
||||||
'/api/v1/inboxes/2/campaigns'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#deleteInboxAvatar', () => {
|
it('#deleteInboxAvatar', () => {
|
||||||
inboxesAPI.deleteInboxAvatar(2);
|
inboxesAPI.deleteInboxAvatar(2);
|
||||||
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
expect(axiosMock.delete).toHaveBeenCalledWith('/api/v1/inboxes/2/avatar');
|
||||||
'/api/v1/inboxes/2/avatar'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import integrationAPI from '../integrations';
|
import integrationAPI from '../integrations';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#integrationAPI', () => {
|
describe('#integrationAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -16,11 +15,27 @@ describe('#integrationAPI', () => {
|
|||||||
expect(integrationAPI).toHaveProperty('listAllSlackChannels');
|
expect(integrationAPI).toHaveProperty('listAllSlackChannels');
|
||||||
expect(integrationAPI).toHaveProperty('deleteHook');
|
expect(integrationAPI).toHaveProperty('deleteHook');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#connectSlack', () => {
|
it('#connectSlack', () => {
|
||||||
const code = 'SDNFJNSDFNDSJN';
|
const code = 'SDNFJNSDFNDSJN';
|
||||||
integrationAPI.connectSlack(code);
|
integrationAPI.connectSlack(code);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/slack',
|
'/api/v1/integrations/slack',
|
||||||
{
|
{
|
||||||
code,
|
code,
|
||||||
@@ -31,7 +46,7 @@ describe('#integrationAPI', () => {
|
|||||||
it('#updateSlack', () => {
|
it('#updateSlack', () => {
|
||||||
const updateObj = { referenceId: 'SDFSDGSVE' };
|
const updateObj = { referenceId: 'SDFSDGSVE' };
|
||||||
integrationAPI.updateSlack(updateObj);
|
integrationAPI.updateSlack(updateObj);
|
||||||
expect(context.axiosMock.patch).toHaveBeenCalledWith(
|
expect(axiosMock.patch).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/slack',
|
'/api/v1/integrations/slack',
|
||||||
{
|
{
|
||||||
reference_id: updateObj.referenceId,
|
reference_id: updateObj.referenceId,
|
||||||
@@ -41,16 +56,14 @@ describe('#integrationAPI', () => {
|
|||||||
|
|
||||||
it('#listAllSlackChannels', () => {
|
it('#listAllSlackChannels', () => {
|
||||||
integrationAPI.listAllSlackChannels();
|
integrationAPI.listAllSlackChannels();
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/slack/list_all_channels'
|
'/api/v1/integrations/slack/list_all_channels'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#delete', () => {
|
it('#delete', () => {
|
||||||
integrationAPI.delete(2);
|
integrationAPI.delete(2);
|
||||||
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
expect(axiosMock.delete).toHaveBeenCalledWith('/api/v1/integrations/2');
|
||||||
'/api/v1/integrations/2'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#createHook', () => {
|
it('#createHook', () => {
|
||||||
@@ -59,7 +72,7 @@ describe('#integrationAPI', () => {
|
|||||||
settings: { api_key: 'SDFSDGSVE' },
|
settings: { api_key: 'SDFSDGSVE' },
|
||||||
};
|
};
|
||||||
integrationAPI.createHook(hookData);
|
integrationAPI.createHook(hookData);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/hooks',
|
'/api/v1/integrations/hooks',
|
||||||
hookData
|
hookData
|
||||||
);
|
);
|
||||||
@@ -67,7 +80,7 @@ describe('#integrationAPI', () => {
|
|||||||
|
|
||||||
it('#deleteHook', () => {
|
it('#deleteHook', () => {
|
||||||
integrationAPI.deleteHook(2);
|
integrationAPI.deleteHook(2);
|
||||||
expect(context.axiosMock.delete).toHaveBeenCalledWith(
|
expect(axiosMock.delete).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/hooks/2'
|
'/api/v1/integrations/hooks/2'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import DyteAPIClient from '../../integrations/dyte';
|
import DyteAPIClient from '../../integrations/dyte';
|
||||||
import ApiClient from '../../ApiClient';
|
import ApiClient from '../../ApiClient';
|
||||||
import describeWithAPIMock from '../apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#accountAPI', () => {
|
describe('#accountAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -9,10 +8,26 @@ describe('#accountAPI', () => {
|
|||||||
expect(DyteAPIClient).toHaveProperty('addParticipantToMeeting');
|
expect(DyteAPIClient).toHaveProperty('addParticipantToMeeting');
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('createAMeeting', context => {
|
describe('createAMeeting', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('creates a valid request', () => {
|
it('creates a valid request', () => {
|
||||||
DyteAPIClient.createAMeeting(1);
|
DyteAPIClient.createAMeeting(1);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/dyte/create_a_meeting',
|
'/api/v1/integrations/dyte/create_a_meeting',
|
||||||
{
|
{
|
||||||
conversation_id: 1,
|
conversation_id: 1,
|
||||||
@@ -21,10 +36,26 @@ describe('#accountAPI', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describeWithAPIMock('addParticipantToMeeting', context => {
|
describe('addParticipantToMeeting', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('creates a valid request', () => {
|
it('creates a valid request', () => {
|
||||||
DyteAPIClient.addParticipantToMeeting(1);
|
DyteAPIClient.addParticipantToMeeting(1);
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/integrations/dyte/add_participant_to_meeting',
|
'/api/v1/integrations/dyte/add_participant_to_meeting',
|
||||||
{
|
{
|
||||||
message_id: 1,
|
message_id: 1,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import notificationsAPI from '../notifications';
|
import notificationsAPI from '../notifications';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#NotificationAPI', () => {
|
describe('#NotificationAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -11,31 +10,47 @@ describe('#NotificationAPI', () => {
|
|||||||
expect(notificationsAPI).toHaveProperty('read');
|
expect(notificationsAPI).toHaveProperty('read');
|
||||||
expect(notificationsAPI).toHaveProperty('readAll');
|
expect(notificationsAPI).toHaveProperty('readAll');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#get', () => {
|
it('#get', () => {
|
||||||
notificationsAPI.get(1);
|
notificationsAPI.get(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/notifications?page=1'
|
'/api/v1/notifications?page=1'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getNotifications', () => {
|
it('#getNotifications', () => {
|
||||||
notificationsAPI.getNotifications(1);
|
notificationsAPI.getNotifications(1);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/notifications/1/notifications'
|
'/api/v1/notifications/1/notifications'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getUnreadCount', () => {
|
it('#getUnreadCount', () => {
|
||||||
notificationsAPI.getUnreadCount();
|
notificationsAPI.getUnreadCount();
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/notifications/unread_count'
|
'/api/v1/notifications/unread_count'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#read', () => {
|
it('#read', () => {
|
||||||
notificationsAPI.read(48670, 'Conversation');
|
notificationsAPI.read(48670, 'Conversation');
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/notifications/read_all',
|
'/api/v1/notifications/read_all',
|
||||||
{
|
{
|
||||||
primary_actor_id: 'Conversation',
|
primary_actor_id: 'Conversation',
|
||||||
@@ -46,7 +61,7 @@ describe('#NotificationAPI', () => {
|
|||||||
|
|
||||||
it('#readAll', () => {
|
it('#readAll', () => {
|
||||||
notificationsAPI.readAll();
|
notificationsAPI.readAll();
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/notifications/read_all'
|
'/api/v1/notifications/read_all'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import reportsAPI from '../reports';
|
import reportsAPI from '../reports';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#Reports API', () => {
|
describe('#Reports API', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -18,14 +17,30 @@ describe('#Reports API', () => {
|
|||||||
expect(reportsAPI).toHaveProperty('getInboxReports');
|
expect(reportsAPI).toHaveProperty('getInboxReports');
|
||||||
expect(reportsAPI).toHaveProperty('getTeamReports');
|
expect(reportsAPI).toHaveProperty('getTeamReports');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getAccountReports', () => {
|
it('#getAccountReports', () => {
|
||||||
reportsAPI.getReports({
|
reportsAPI.getReports({
|
||||||
metric: 'conversations_count',
|
metric: 'conversations_count',
|
||||||
from: 1621103400,
|
from: 1621103400,
|
||||||
to: 1621621800,
|
to: 1621621800,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith('/api/v2/reports', {
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports', {
|
||||||
params: {
|
params: {
|
||||||
metric: 'conversations_count',
|
metric: 'conversations_count',
|
||||||
since: 1621103400,
|
since: 1621103400,
|
||||||
@@ -38,20 +53,17 @@ describe('#Reports API', () => {
|
|||||||
|
|
||||||
it('#getAccountSummary', () => {
|
it('#getAccountSummary', () => {
|
||||||
reportsAPI.getSummary(1621103400, 1621621800);
|
reportsAPI.getSummary(1621103400, 1621621800);
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports/summary', {
|
||||||
'/api/v2/reports/summary',
|
params: {
|
||||||
{
|
business_hours: undefined,
|
||||||
params: {
|
group_by: undefined,
|
||||||
business_hours: undefined,
|
id: undefined,
|
||||||
group_by: undefined,
|
since: 1621103400,
|
||||||
id: undefined,
|
timezone_offset: -0,
|
||||||
since: 1621103400,
|
type: 'account',
|
||||||
timezone_offset: -0,
|
until: 1621621800,
|
||||||
type: 'account',
|
},
|
||||||
until: 1621621800,
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getAgentReports', () => {
|
it('#getAgentReports', () => {
|
||||||
@@ -60,60 +72,48 @@ describe('#Reports API', () => {
|
|||||||
to: 1621621800,
|
to: 1621621800,
|
||||||
businessHours: true,
|
businessHours: true,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports/agents', {
|
||||||
'/api/v2/reports/agents',
|
params: {
|
||||||
{
|
since: 1621103400,
|
||||||
params: {
|
until: 1621621800,
|
||||||
since: 1621103400,
|
business_hours: true,
|
||||||
until: 1621621800,
|
},
|
||||||
business_hours: true,
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getLabelReports', () => {
|
it('#getLabelReports', () => {
|
||||||
reportsAPI.getLabelReports({ from: 1621103400, to: 1621621800 });
|
reportsAPI.getLabelReports({ from: 1621103400, to: 1621621800 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports/labels', {
|
||||||
'/api/v2/reports/labels',
|
params: {
|
||||||
{
|
since: 1621103400,
|
||||||
params: {
|
until: 1621621800,
|
||||||
since: 1621103400,
|
},
|
||||||
until: 1621621800,
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getInboxReports', () => {
|
it('#getInboxReports', () => {
|
||||||
reportsAPI.getInboxReports({ from: 1621103400, to: 1621621800 });
|
reportsAPI.getInboxReports({ from: 1621103400, to: 1621621800 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports/inboxes', {
|
||||||
'/api/v2/reports/inboxes',
|
params: {
|
||||||
{
|
since: 1621103400,
|
||||||
params: {
|
until: 1621621800,
|
||||||
since: 1621103400,
|
},
|
||||||
until: 1621621800,
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getTeamReports', () => {
|
it('#getTeamReports', () => {
|
||||||
reportsAPI.getTeamReports({ from: 1621103400, to: 1621621800 });
|
reportsAPI.getTeamReports({ from: 1621103400, to: 1621621800 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith('/api/v2/reports/teams', {
|
||||||
'/api/v2/reports/teams',
|
params: {
|
||||||
{
|
since: 1621103400,
|
||||||
params: {
|
until: 1621621800,
|
||||||
since: 1621103400,
|
},
|
||||||
until: 1621621800,
|
});
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#getConversationMetric', () => {
|
it('#getConversationMetric', () => {
|
||||||
reportsAPI.getConversationMetric('account');
|
reportsAPI.getConversationMetric('account');
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v2/reports/conversations',
|
'/api/v2/reports/conversations',
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import teamsAPI from '../teams';
|
import teamsAPI from '../teams';
|
||||||
import ApiClient from '../ApiClient';
|
import ApiClient from '../ApiClient';
|
||||||
import describeWithAPIMock from './apiSpecHelper';
|
|
||||||
|
|
||||||
describe('#TeamsAPI', () => {
|
describe('#TeamsAPI', () => {
|
||||||
it('creates correct instance', () => {
|
it('creates correct instance', () => {
|
||||||
@@ -14,17 +13,33 @@ describe('#TeamsAPI', () => {
|
|||||||
expect(teamsAPI).toHaveProperty('addAgents');
|
expect(teamsAPI).toHaveProperty('addAgents');
|
||||||
expect(teamsAPI).toHaveProperty('updateAgents');
|
expect(teamsAPI).toHaveProperty('updateAgents');
|
||||||
});
|
});
|
||||||
describeWithAPIMock('API calls', context => {
|
describe('API calls', () => {
|
||||||
|
const originalAxios = window.axios;
|
||||||
|
const axiosMock = {
|
||||||
|
post: jest.fn(() => Promise.resolve()),
|
||||||
|
get: jest.fn(() => Promise.resolve()),
|
||||||
|
patch: jest.fn(() => Promise.resolve()),
|
||||||
|
delete: jest.fn(() => Promise.resolve()),
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
window.axios = axiosMock;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
window.axios = originalAxios;
|
||||||
|
});
|
||||||
|
|
||||||
it('#getAgents', () => {
|
it('#getAgents', () => {
|
||||||
teamsAPI.getAgents({ teamId: 1 });
|
teamsAPI.getAgents({ teamId: 1 });
|
||||||
expect(context.axiosMock.get).toHaveBeenCalledWith(
|
expect(axiosMock.get).toHaveBeenCalledWith(
|
||||||
'/api/v1/teams/1/team_members'
|
'/api/v1/teams/1/team_members'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('#addAgents', () => {
|
it('#addAgents', () => {
|
||||||
teamsAPI.addAgents({ teamId: 1, agentsList: { user_ids: [1, 10, 21] } });
|
teamsAPI.addAgents({ teamId: 1, agentsList: { user_ids: [1, 10, 21] } });
|
||||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
expect(axiosMock.post).toHaveBeenCalledWith(
|
||||||
'/api/v1/teams/1/team_members',
|
'/api/v1/teams/1/team_members',
|
||||||
{
|
{
|
||||||
user_ids: { user_ids: [1, 10, 21] },
|
user_ids: { user_ids: [1, 10, 21] },
|
||||||
@@ -38,7 +53,7 @@ describe('#TeamsAPI', () => {
|
|||||||
teamId: 1,
|
teamId: 1,
|
||||||
agentsList,
|
agentsList,
|
||||||
});
|
});
|
||||||
expect(context.axiosMock.patch).toHaveBeenCalledWith(
|
expect(axiosMock.patch).toHaveBeenCalledWith(
|
||||||
'/api/v1/teams/1/team_members',
|
'/api/v1/teams/1/team_members',
|
||||||
{
|
{
|
||||||
user_ids: agentsList,
|
user_ids: agentsList,
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
@import '~vue2-datepicker/scss/index';
|
@import '~vue2-datepicker/scss/index';
|
||||||
|
|
||||||
.mx-datepicker-popup {
|
|
||||||
@apply z-[99999];
|
|
||||||
}
|
|
||||||
|
|
||||||
.date-picker {
|
.date-picker {
|
||||||
&.no-margin {
|
&.no-margin {
|
||||||
.mx-input {
|
.mx-input {
|
||||||
@@ -29,10 +25,52 @@
|
|||||||
.mx-input[readonly] {
|
.mx-input[readonly] {
|
||||||
@apply bg-white dark:bg-slate-900 cursor-pointer;
|
@apply bg-white dark:bg-slate-900 cursor-pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx-icon-calendar {
|
||||||
|
@apply dark:text-slate-500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx-calendar-content .cell:hover {
|
.mx-datepicker-main {
|
||||||
@apply bg-slate-75 dark:bg-slate-700 text-slate-900 dark:text-slate-100;
|
@apply border-0 bg-white dark:bg-slate-800;
|
||||||
|
|
||||||
|
.cell {
|
||||||
|
&.disabled {
|
||||||
|
@apply bg-slate-25 dark:bg-slate-900 text-slate-200 dark:text-slate-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&.hover-in-range,
|
||||||
|
&.in-range {
|
||||||
|
@apply bg-slate-75 dark:bg-slate-700 text-slate-900 dark:text-slate-100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx-time {
|
||||||
|
@apply border-0 bg-white dark:bg-slate-800;
|
||||||
|
|
||||||
|
.mx-time-header {
|
||||||
|
@apply border-0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx-time-item {
|
||||||
|
&.disabled {
|
||||||
|
@apply bg-slate-25 dark:bg-slate-900;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
@apply bg-slate-75 dark:bg-slate-700;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.today {
|
||||||
|
@apply font-semibold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx-datepicker-popup {
|
||||||
|
@apply z-[99999];
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx-datepicker-inline {
|
.mx-datepicker-inline {
|
||||||
@@ -41,24 +79,4 @@
|
|||||||
.mx-calendar {
|
.mx-calendar {
|
||||||
@apply w-full;
|
@apply w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell.disabled {
|
|
||||||
@apply bg-slate-25 dark:bg-slate-900 text-slate-200 dark:text-slate-300;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx-time-item.disabled {
|
|
||||||
@apply bg-slate-25 dark:bg-slate-900;
|
|
||||||
}
|
|
||||||
|
|
||||||
.today {
|
|
||||||
@apply font-semibold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx-datepicker-main {
|
|
||||||
@apply border-0 bg-white dark:bg-slate-800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx-time-header {
|
|
||||||
@apply border-0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,11 +81,6 @@ $conv-header-height: 2.5rem;
|
|||||||
$inbox-thumb-size: 3rem;
|
$inbox-thumb-size: 3rem;
|
||||||
|
|
||||||
|
|
||||||
// Spinner
|
|
||||||
$spinkit-spinner-color: $color-white !default;
|
|
||||||
$spinkit-spinner-margin: 0 0 0 1rem !default;
|
|
||||||
$spinkit-size: 1rem !default;
|
|
||||||
|
|
||||||
// Snackbar default
|
// Snackbar default
|
||||||
$woot-snackbar-bg: #323232;
|
$woot-snackbar-bg: #323232;
|
||||||
$woot-snackbar-button: #ffeb3b;
|
$woot-snackbar-button: #ffeb3b;
|
||||||
|
|||||||
@@ -149,15 +149,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.multiselect-wrap--small {
|
.multiselect-wrap--small {
|
||||||
.multiselect__tags,
|
|
||||||
.multiselect__input {
|
|
||||||
@apply items-center flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.multiselect__tags,
|
.multiselect__tags,
|
||||||
.multiselect__input,
|
.multiselect__input,
|
||||||
.multiselect {
|
.multiselect {
|
||||||
@apply bg-white dark:bg-slate-900 text-slate-800 dark:text-slate-100 rounded-[5px] text-sm h-10 min-h-[2.5rem];
|
@apply bg-white dark:bg-slate-900 text-slate-800 dark:text-slate-100 rounded-[5px] text-sm min-h-[2.5rem];
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect__input {
|
.multiselect__input {
|
||||||
@@ -165,11 +161,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.multiselect__single {
|
.multiselect__single {
|
||||||
@apply items-center flex m-0 text-sm max-h-[2.375rem] text-slate-800 dark:text-slate-100 bg-white dark:bg-slate-900 py-1 px-0.5;
|
@apply items-center flex m-0 text-sm max-h-[2.375rem] text-slate-800 dark:text-slate-100 bg-white dark:bg-slate-900 py-3 px-0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect__placeholder {
|
.multiselect__placeholder {
|
||||||
@apply m-0 py-1 px-0.5;
|
@apply m-0 py-2 px-0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect__tag {
|
||||||
|
@apply py-[6px] my-[1px];
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect__select {
|
.multiselect__select {
|
||||||
@@ -181,9 +181,6 @@
|
|||||||
@apply bg-transparent;
|
@apply bg-transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect__tags-wrap {
|
|
||||||
@apply flex-shrink-0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiselect-wrap--medium {
|
.multiselect-wrap--medium {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
@import 'shared/assets/stylesheets/border-radius';
|
@import 'shared/assets/stylesheets/border-radius';
|
||||||
@import 'variables';
|
@import 'variables';
|
||||||
|
|
||||||
@import '~spinkit/scss/spinners/7-three-bounce';
|
|
||||||
@import 'vue-multiselect/dist/vue-multiselect.min.css';
|
@import 'vue-multiselect/dist/vue-multiselect.min.css';
|
||||||
@import '~shared/assets/stylesheets/ionicons';
|
@import '~shared/assets/stylesheets/ionicons';
|
||||||
|
|
||||||
|
|||||||
@@ -34,26 +34,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.hollow {
|
&.hollow {
|
||||||
@apply border border-slate-200 dark:border-slate-600 text-woot-700 dark:text-woot-100 hover:bg-woot-50 dark:hover:bg-woot-900;
|
@apply border border-woot-500 dark:border-woot-500 text-woot-500 dark:text-woot-500 hover:bg-woot-50 dark:hover:bg-woot-900;
|
||||||
|
|
||||||
&.secondary {
|
&.secondary {
|
||||||
@apply text-slate-700 border-slate-200 dark:border-slate-600 dark:text-slate-100 hover:bg-slate-50 dark:hover:bg-slate-700;
|
@apply text-slate-700 border-slate-200 dark:border-slate-600 dark:text-slate-100 hover:bg-slate-50 dark:hover:bg-slate-700;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.success {
|
&.success {
|
||||||
@apply text-green-700 dark:text-green-100 hover:bg-green-50 dark:hover:bg-green-800;
|
@apply text-green-700 dark:text-green-400 border-green-100 dark:border-green-600 hover:bg-green-50 dark:hover:bg-green-800;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.alert {
|
&.alert {
|
||||||
@apply text-red-700 dark:text-red-100 hover:bg-red-50 dark:hover:bg-red-800;
|
@apply text-red-700 dark:text-red-400 border-red-100 dark:border-red-600 hover:bg-red-50 dark:hover:bg-red-800;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.warning {
|
&.warning {
|
||||||
@apply text-yellow-700 dark:text-yellow-100 hover:bg-yellow-50 dark:hover:bg-yellow-800;
|
@apply text-yellow-600 dark:text-yellow-600 border-yellow-600 dark:border-yellow-700 hover:bg-yellow-50 dark:hover:bg-yellow-800;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
@apply bg-slate-75 dark:bg-slate-900 border-slate-100 dark:border-slate-700;
|
@apply bg-woot-75 dark:bg-woot-800 border-slate-100 dark:border-woot-600 dark:text-woot-400;
|
||||||
|
|
||||||
&.secondary {
|
&.secondary {
|
||||||
@apply border-slate-100 dark:border-slate-700 text-slate-800 dark:text-slate-100;
|
@apply border-slate-100 dark:border-slate-700 text-slate-800 dark:text-slate-100;
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.warning {
|
&.warning {
|
||||||
@apply border-slate-100 dark:border-slate-700 text-yellow-700 dark:text-yellow-700;
|
@apply border-slate-100 dark:border-slate-700 text-yellow-700 dark:text-yellow-500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,10 @@
|
|||||||
|
|
||||||
&.is-image {
|
&.is-image {
|
||||||
@apply rounded-lg;
|
@apply rounded-lg;
|
||||||
|
|
||||||
|
.message__mail-head {
|
||||||
|
@apply px-4 py-2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,6 @@
|
|||||||
@apply flex items-center justify-center bg-modal dark:bg-modal z-[9990] h-full left-0 fixed top-0 w-full;
|
@apply flex items-center justify-center bg-modal dark:bg-modal z-[9990] h-full left-0 fixed top-0 w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal--close {
|
|
||||||
@apply absolute right-2 rtl:right-[unset] rtl:left-2 top-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-top-bar {
|
.page-top-bar {
|
||||||
@apply px-8 pt-9 pb-0;
|
@apply px-8 pt-9 pb-0;
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import EmojiOrIcon from 'shared/components/EmojiOrIcon';
|
import EmojiOrIcon from 'shared/components/EmojiOrIcon.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
<div
|
<div
|
||||||
class="flex items-center justify-between py-0 px-4"
|
class="flex items-center justify-between py-0 px-4"
|
||||||
:class="{
|
:class="{
|
||||||
'pb-3 border-b border-slate-75 dark:border-slate-700': hasAppliedFiltersOrActiveFolders,
|
'pb-3 border-b border-slate-75 dark:border-slate-700':
|
||||||
|
hasAppliedFiltersOrActiveFolders,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="flex max-w-[85%] justify-center items-center">
|
<div class="flex max-w-[85%] justify-center items-center">
|
||||||
@@ -24,9 +25,7 @@
|
|||||||
v-if="!hasAppliedFiltersOrActiveFolders"
|
v-if="!hasAppliedFiltersOrActiveFolders"
|
||||||
class="p-1 my-0.5 mx-1 rounded-md capitalize bg-slate-50 dark:bg-slate-800 text-xxs text-slate-600 dark:text-slate-300"
|
class="p-1 my-0.5 mx-1 rounded-md capitalize bg-slate-50 dark:bg-slate-800 text-xxs text-slate-600 dark:text-slate-300"
|
||||||
>
|
>
|
||||||
{{
|
{{ $t(`CHAT_LIST.CHAT_STATUS_FILTER_ITEMS.${activeStatus}.TEXT`) }}
|
||||||
this.$t(`CHAT_LIST.CHAT_STATUS_FILTER_ITEMS.${activeStatus}.TEXT`)
|
|
||||||
}}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
@@ -193,21 +192,22 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
|
|
||||||
import ConversationAdvancedFilter from './widgets/conversation/ConversationAdvancedFilter';
|
import ConversationAdvancedFilter from './widgets/conversation/ConversationAdvancedFilter.vue';
|
||||||
import ConversationBasicFilter from './widgets/conversation/ConversationBasicFilter';
|
import ConversationBasicFilter from './widgets/conversation/ConversationBasicFilter.vue';
|
||||||
import ChatTypeTabs from './widgets/ChatTypeTabs';
|
import ChatTypeTabs from './widgets/ChatTypeTabs.vue';
|
||||||
import ConversationCard from './widgets/conversation/ConversationCard';
|
import ConversationCard from './widgets/conversation/ConversationCard.vue';
|
||||||
import timeMixin from '../mixins/time';
|
import timeMixin from '../mixins/time';
|
||||||
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
|
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
|
||||||
import conversationMixin from '../mixins/conversations';
|
import conversationMixin from '../mixins/conversations';
|
||||||
import wootConstants from 'dashboard/constants/globals';
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
import advancedFilterTypes from './widgets/conversation/advancedFilterItems';
|
import advancedFilterTypes from './widgets/conversation/advancedFilterItems';
|
||||||
import filterQueryGenerator from '../helper/filterQueryGenerator.js';
|
import filterQueryGenerator from '../helper/filterQueryGenerator.js';
|
||||||
import AddCustomViews from 'dashboard/routes/dashboard/customviews/AddCustomViews';
|
import AddCustomViews from 'dashboard/routes/dashboard/customviews/AddCustomViews.vue';
|
||||||
import DeleteCustomViews from 'dashboard/routes/dashboard/customviews/DeleteCustomViews.vue';
|
import DeleteCustomViews from 'dashboard/routes/dashboard/customviews/DeleteCustomViews.vue';
|
||||||
import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Index.vue';
|
import ConversationBulkActions from './widgets/conversation/conversationBulkActions/Index.vue';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
import filterMixin from 'shared/mixins/filterMixin';
|
import filterMixin from 'shared/mixins/filterMixin';
|
||||||
|
import uiSettingsMixin from 'dashboard/mixins/uiSettings';
|
||||||
import languages from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
import languages from 'dashboard/components/widgets/conversation/advancedFilterItems/languages';
|
||||||
import countries from 'shared/constants/countries';
|
import countries from 'shared/constants/countries';
|
||||||
import { generateValuesForEditCustomViews } from 'dashboard/helper/customViewsHelper';
|
import { generateValuesForEditCustomViews } from 'dashboard/helper/customViewsHelper';
|
||||||
@@ -239,6 +239,7 @@ export default {
|
|||||||
eventListenerMixins,
|
eventListenerMixins,
|
||||||
alertMixin,
|
alertMixin,
|
||||||
filterMixin,
|
filterMixin,
|
||||||
|
uiSettingsMixin,
|
||||||
],
|
],
|
||||||
props: {
|
props: {
|
||||||
conversationInbox: {
|
conversationInbox: {
|
||||||
@@ -409,8 +410,12 @@ export default {
|
|||||||
},
|
},
|
||||||
conversationListPagination() {
|
conversationListPagination() {
|
||||||
const conversationsPerPage = 25;
|
const conversationsPerPage = 25;
|
||||||
|
const hasChatsOnView =
|
||||||
|
this.chatsOnView &&
|
||||||
|
Array.isArray(this.chatsOnView) &&
|
||||||
|
!this.chatsOnView.length;
|
||||||
const isNoFiltersOrFoldersAndChatListNotEmpty =
|
const isNoFiltersOrFoldersAndChatListNotEmpty =
|
||||||
!this.hasAppliedFiltersOrActiveFolders && this.chatsOnView !== [];
|
!this.hasAppliedFiltersOrActiveFolders && hasChatsOnView;
|
||||||
const isUnderPerPage =
|
const isUnderPerPage =
|
||||||
this.chatsOnView.length < conversationsPerPage &&
|
this.chatsOnView.length < conversationsPerPage &&
|
||||||
this.activeAssigneeTabCount < conversationsPerPage &&
|
this.activeAssigneeTabCount < conversationsPerPage &&
|
||||||
@@ -516,6 +521,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
this.setFiltersFromUISettings();
|
||||||
this.$store.dispatch('setChatStatusFilter', this.activeStatus);
|
this.$store.dispatch('setChatStatusFilter', this.activeStatus);
|
||||||
this.$store.dispatch('setChatSortFilter', this.activeSortBy);
|
this.$store.dispatch('setChatSortFilter', this.activeSortBy);
|
||||||
this.resetAndFetchData();
|
this.resetAndFetchData();
|
||||||
@@ -545,6 +551,12 @@ export default {
|
|||||||
this.$store.dispatch('customViews/update', payloadData);
|
this.$store.dispatch('customViews/update', payloadData);
|
||||||
this.closeAdvanceFiltersModal();
|
this.closeAdvanceFiltersModal();
|
||||||
},
|
},
|
||||||
|
setFiltersFromUISettings() {
|
||||||
|
const { conversations_filter_by: filterBy = {} } = this.uiSettings;
|
||||||
|
const { status, order_by: orderBy } = filterBy;
|
||||||
|
this.activeStatus = status || wootConstants.STATUS_TYPE.OPEN;
|
||||||
|
this.activeSortBy = orderBy || wootConstants.SORT_BY_TYPE.LATEST;
|
||||||
|
},
|
||||||
onClickOpenAddFoldersModal() {
|
onClickOpenAddFoldersModal() {
|
||||||
this.showAddFoldersModal = true;
|
this.showAddFoldersModal = true;
|
||||||
},
|
},
|
||||||
@@ -642,10 +654,8 @@ export default {
|
|||||||
},
|
},
|
||||||
handleKeyEvents(e) {
|
handleKeyEvents(e) {
|
||||||
if (hasPressedAltAndJKey(e)) {
|
if (hasPressedAltAndJKey(e)) {
|
||||||
const {
|
const { allConversations, activeConversationIndex } =
|
||||||
allConversations,
|
this.getKeyboardListenerParams();
|
||||||
activeConversationIndex,
|
|
||||||
} = this.getKeyboardListenerParams();
|
|
||||||
if (activeConversationIndex === -1) {
|
if (activeConversationIndex === -1) {
|
||||||
allConversations[0].click();
|
allConversations[0].click();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
/>
|
/>
|
||||||
<div class="flex flex-row justify-end gap-2 py-2 px-0 w-full">
|
<div class="flex flex-row justify-end gap-2 py-2 px-0 w-full">
|
||||||
<woot-button variant="clear" @click.prevent="onClose">
|
<woot-button variant="clear" @click.prevent="onClose">
|
||||||
{{ this.$t('CONVERSATION.CUSTOM_SNOOZE.CANCEL') }}
|
{{ $t('CONVERSATION.CUSTOM_SNOOZE.CANCEL') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<woot-button>
|
<woot-button>
|
||||||
{{ this.$t('CONVERSATION.CUSTOM_SNOOZE.APPLY') }}
|
{{ $t('CONVERSATION.CUSTOM_SNOOZE.APPLY') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="text--container">
|
<div class="text--container">
|
||||||
<woot-button size="small" class=" button--text" @click="onCopy">
|
<woot-button size="small" class="button--text" @click="onCopy">
|
||||||
{{ $t('COMPONENTS.CODE.BUTTON_TEXT') }}
|
{{ $t('COMPONENTS.CODE.BUTTON_TEXT') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<woot-button
|
<woot-button
|
||||||
|
|||||||
@@ -4,15 +4,19 @@
|
|||||||
v-if="show"
|
v-if="show"
|
||||||
:class="modalClassName"
|
:class="modalClassName"
|
||||||
transition="modal"
|
transition="modal"
|
||||||
@click="onBackDropClick"
|
@mousedown="handleMouseDown"
|
||||||
>
|
>
|
||||||
<div :class="modalContainerClassName" @click.stop>
|
<div
|
||||||
|
:class="modalContainerClassName"
|
||||||
|
@mouse.stop
|
||||||
|
@mousedown="event => event.stopPropagation()"
|
||||||
|
>
|
||||||
<woot-button
|
<woot-button
|
||||||
v-if="showCloseButton"
|
v-if="showCloseButton"
|
||||||
color-scheme="secondary"
|
color-scheme="secondary"
|
||||||
icon="dismiss"
|
icon="dismiss"
|
||||||
variant="clear"
|
variant="clear"
|
||||||
class="modal--close"
|
class="absolute ltr:right-2 rtl:left-2 top-2 z-10"
|
||||||
@click="close"
|
@click="close"
|
||||||
/>
|
/>
|
||||||
<slot />
|
<slot />
|
||||||
@@ -50,6 +54,11 @@ export default {
|
|||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
mousedDownOnBackdrop: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
modalContainerClassName() {
|
modalContainerClassName() {
|
||||||
let className =
|
let className =
|
||||||
@@ -66,9 +75,9 @@ export default {
|
|||||||
'right-aligned': 'right-aligned',
|
'right-aligned': 'right-aligned',
|
||||||
};
|
};
|
||||||
|
|
||||||
return `modal-mask skip-context-menu ${modalClassNameMap[
|
return `modal-mask skip-context-menu ${
|
||||||
this.modalType
|
modalClassNameMap[this.modalType] || ''
|
||||||
] || ''}`;
|
}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -77,13 +86,22 @@ export default {
|
|||||||
this.onClose();
|
this.onClose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.body.addEventListener('mouseup', this.onMouseUp);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
document.body.removeEventListener('mouseup', this.onMouseUp);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleMouseDown() {
|
||||||
|
this.mousedDownOnBackdrop = true;
|
||||||
|
},
|
||||||
close() {
|
close() {
|
||||||
this.onClose();
|
this.onClose();
|
||||||
},
|
},
|
||||||
onBackDropClick() {
|
onMouseUp() {
|
||||||
if (this.closeOnBackdropClick) {
|
if (this.mousedDownOnBackdrop) {
|
||||||
|
this.mousedDownOnBackdrop = false;
|
||||||
this.onClose();
|
this.onClose();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
<div
|
<div
|
||||||
class="ml-0 mr-0 flex pt-0 pr-4 pb-4 pl-0"
|
class="ml-0 mr-0 flex pt-0 pr-4 pb-4 pl-0"
|
||||||
:class="{
|
:class="{
|
||||||
'pt-4 border-b border-solid border-slate-50 dark:border-slate-700/30': showBorder,
|
'pt-4 border-b border-solid border-slate-50 dark:border-slate-700/30':
|
||||||
|
showBorder,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<div class="w-[30%] min-w-0 max-w-[30%] pr-12">
|
<div class="w-[30%] min-w-0 max-w-[30%] pr-12">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import WootSnackbar from './Snackbar';
|
import WootSnackbar from './Snackbar.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -72,10 +72,8 @@ export default {
|
|||||||
const { custom_attributes: subscription } = account;
|
const { custom_attributes: subscription } = account;
|
||||||
if (!subscription) return EMPTY_SUBSCRIPTION_INFO;
|
if (!subscription) return EMPTY_SUBSCRIPTION_INFO;
|
||||||
|
|
||||||
const {
|
const { subscription_status: status, subscription_ends_on: endsOn } =
|
||||||
subscription_status: status,
|
subscription;
|
||||||
subscription_ends_on: endsOn,
|
|
||||||
} = subscription;
|
|
||||||
|
|
||||||
return { status, endsOn: new Date(endsOn) };
|
return { status, endsOn: new Date(endsOn) };
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const semver = require('semver');
|
import semver from 'semver';
|
||||||
|
|
||||||
export const hasAnUpdateAvailable = (latestVersion, currentVersion) => {
|
export const hasAnUpdateAvailable = (latestVersion, currentVersion) => {
|
||||||
if (!semver.valid(latestVersion)) {
|
if (!semver.valid(latestVersion)) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Spinner from 'shared/components/Spinner';
|
import Spinner from 'shared/components/Spinner.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
:is-loading="isLoading"
|
:is-loading="isLoading"
|
||||||
@click="onCmdResolveConversation"
|
@click="onCmdResolveConversation"
|
||||||
>
|
>
|
||||||
{{ this.$t('CONVERSATION.HEADER.RESOLVE_ACTION') }}
|
{{ $t('CONVERSATION.HEADER.RESOLVE_ACTION') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<woot-button
|
<woot-button
|
||||||
v-else-if="isResolved"
|
v-else-if="isResolved"
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
:is-loading="isLoading"
|
:is-loading="isLoading"
|
||||||
@click="onCmdOpenConversation"
|
@click="onCmdOpenConversation"
|
||||||
>
|
>
|
||||||
{{ this.$t('CONVERSATION.HEADER.REOPEN_ACTION') }}
|
{{ $t('CONVERSATION.HEADER.REOPEN_ACTION') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<woot-button
|
<woot-button
|
||||||
v-else-if="showOpenButton"
|
v-else-if="showOpenButton"
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
:is-loading="isLoading"
|
:is-loading="isLoading"
|
||||||
@click="onCmdOpenConversation"
|
@click="onCmdOpenConversation"
|
||||||
>
|
>
|
||||||
{{ this.$t('CONVERSATION.HEADER.OPEN_ACTION') }}
|
{{ $t('CONVERSATION.HEADER.OPEN_ACTION') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
<woot-button
|
<woot-button
|
||||||
v-if="showAdditionalActions"
|
v-if="showAdditionalActions"
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
icon="snooze"
|
icon="snooze"
|
||||||
@click="() => openSnoozeModal()"
|
@click="() => openSnoozeModal()"
|
||||||
>
|
>
|
||||||
{{ this.$t('CONVERSATION.RESOLVE_DROPDOWN.SNOOZE_UNTIL') }}
|
{{ $t('CONVERSATION.RESOLVE_DROPDOWN.SNOOZE_UNTIL') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
</woot-dropdown-item>
|
</woot-dropdown-item>
|
||||||
<woot-dropdown-item v-if="!isPending">
|
<woot-dropdown-item v-if="!isPending">
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
icon="book-clock"
|
icon="book-clock"
|
||||||
@click="() => toggleStatus(STATUS_TYPE.PENDING)"
|
@click="() => toggleStatus(STATUS_TYPE.PENDING)"
|
||||||
>
|
>
|
||||||
{{ this.$t('CONVERSATION.RESOLVE_DROPDOWN.MARK_PENDING') }}
|
{{ $t('CONVERSATION.RESOLVE_DROPDOWN.MARK_PENDING') }}
|
||||||
</woot-button>
|
</woot-button>
|
||||||
</woot-dropdown-item>
|
</woot-dropdown-item>
|
||||||
</woot-dropdown-menu>
|
</woot-dropdown-menu>
|
||||||
@@ -90,7 +90,7 @@ import { getUnixTime } from 'date-fns';
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { mixin as clickaway } from 'vue-clickaway';
|
import { mixin as clickaway } from 'vue-clickaway';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
import CustomSnoozeModal from 'dashboard/components/CustomSnoozeModal';
|
import CustomSnoozeModal from 'dashboard/components/CustomSnoozeModal.vue';
|
||||||
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
|
import eventListenerMixins from 'shared/mixins/eventListenerMixins';
|
||||||
import {
|
import {
|
||||||
hasPressedAltAndEKey,
|
hasPressedAltAndEKey,
|
||||||
|
|||||||
@@ -49,11 +49,11 @@
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { mixin as clickaway } from 'vue-clickaway';
|
import { mixin as clickaway } from 'vue-clickaway';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem';
|
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
|
||||||
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu';
|
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
|
||||||
import WootDropdownHeader from 'shared/components/ui/dropdown/DropdownHeader';
|
import WootDropdownHeader from 'shared/components/ui/dropdown/DropdownHeader.vue';
|
||||||
import WootDropdownDivider from 'shared/components/ui/dropdown/DropdownDivider';
|
import WootDropdownDivider from 'shared/components/ui/dropdown/DropdownDivider.vue';
|
||||||
import AvailabilityStatusBadge from '../widgets/conversation/AvailabilityStatusBadge';
|
import AvailabilityStatusBadge from '../widgets/conversation/AvailabilityStatusBadge.vue';
|
||||||
import wootConstants from 'dashboard/constants/globals';
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
|
|
||||||
const { AVAILABILITY_STATUS_KEYS } = wootConstants;
|
const { AVAILABILITY_STATUS_KEYS } = wootConstants;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
@key-shortcut-modal="toggleKeyShortcutModal"
|
@key-shortcut-modal="toggleKeyShortcutModal"
|
||||||
@open-notification-panel="openNotificationPanel"
|
@open-notification-panel="openNotificationPanel"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<secondary-sidebar
|
<secondary-sidebar
|
||||||
v-if="showSecondarySidebar"
|
v-if="showSecondarySidebar"
|
||||||
:class="sidebarClassName"
|
:class="sidebarClassName"
|
||||||
@@ -35,8 +34,8 @@ import adminMixin from '../../mixins/isAdmin';
|
|||||||
import { getSidebarItems } from './config/default-sidebar';
|
import { getSidebarItems } from './config/default-sidebar';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
|
|
||||||
import PrimarySidebar from './sidebarComponents/Primary';
|
import PrimarySidebar from './sidebarComponents/Primary.vue';
|
||||||
import SecondarySidebar from './sidebarComponents/Secondary';
|
import SecondarySidebar from './sidebarComponents/Secondary.vue';
|
||||||
import {
|
import {
|
||||||
hasPressedAltAndCKey,
|
hasPressedAltAndCKey,
|
||||||
hasPressedAltAndRKey,
|
hasPressedAltAndRKey,
|
||||||
@@ -114,7 +113,12 @@ export default {
|
|||||||
if (!isAvailableForTheUser) {
|
if (!isAvailableForTheUser) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
menuItem.alwaysVisibleOnChatwootInstances &&
|
||||||
|
!this.isACustomBrandedInstance
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (menuItem.featureFlag) {
|
if (menuItem.featureFlag) {
|
||||||
return this.isFeatureEnabledonAccount(
|
return this.isFeatureEnabledonAccount(
|
||||||
this.accountId,
|
this.accountId,
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const primaryMenuItems = accountId => [
|
|||||||
key: 'helpcenter',
|
key: 'helpcenter',
|
||||||
label: 'HELP_CENTER.TITLE',
|
label: 'HELP_CENTER.TITLE',
|
||||||
featureFlag: FEATURE_FLAGS.HELP_CENTER,
|
featureFlag: FEATURE_FLAGS.HELP_CENTER,
|
||||||
|
alwaysVisibleOnChatwootInstances: true,
|
||||||
toState: frontendURL(`accounts/${accountId}/portals`),
|
toState: frontendURL(`accounts/${accountId}/portals`),
|
||||||
toStateName: 'default_portal_articles',
|
toStateName: 'default_portal_articles',
|
||||||
roles: ['administrator'],
|
roles: ['administrator'],
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
<woot-submit-button
|
<woot-submit-button
|
||||||
:disabled="
|
:disabled="
|
||||||
$v.accountName.$invalid ||
|
$v.accountName.$invalid ||
|
||||||
$v.accountName.$invalid ||
|
$v.accountName.$invalid ||
|
||||||
uiFlags.isCreating
|
uiFlags.isCreating
|
||||||
"
|
"
|
||||||
:button-text="$t('CREATE_ACCOUNT.FORM.SUBMIT')"
|
:button-text="$t('CREATE_ACCOUNT.FORM.SUBMIT')"
|
||||||
:loading="uiFlags.isCreating"
|
:loading="uiFlags.isCreating"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import Thumbnail from '../../widgets/Thumbnail';
|
import Thumbnail from '../../widgets/Thumbnail.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
<button
|
<button
|
||||||
class="text-slate-600 dark:text-slate-100 w-10 h-10 my-2 flex items-center justify-center rounded-lg hover:bg-slate-25 dark:hover:bg-slate-700 dark:hover:text-slate-100 hover:text-slate-600 relative"
|
class="text-slate-600 dark:text-slate-100 w-10 h-10 my-2 flex items-center justify-center rounded-lg hover:bg-slate-25 dark:hover:bg-slate-700 dark:hover:text-slate-100 hover:text-slate-600 relative"
|
||||||
:class="{
|
:class="{
|
||||||
'bg-woot-50 dark:bg-slate-800 text-woot-500 hover:bg-woot-50': isNotificationPanelActive,
|
'bg-woot-50 dark:bg-slate-800 text-woot-500 hover:bg-woot-50':
|
||||||
|
isNotificationPanelActive,
|
||||||
}"
|
}"
|
||||||
@click="openNotificationPanel"
|
@click="openNotificationPanel"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -109,9 +109,9 @@
|
|||||||
import { mixin as clickaway } from 'vue-clickaway';
|
import { mixin as clickaway } from 'vue-clickaway';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import Auth from '../../../api/auth';
|
import Auth from '../../../api/auth';
|
||||||
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem';
|
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem.vue';
|
||||||
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu';
|
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu.vue';
|
||||||
import AvailabilityStatus from 'dashboard/components/layout/AvailabilityStatus';
|
import AvailabilityStatus from 'dashboard/components/layout/AvailabilityStatus.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@@ -39,11 +39,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Logo from './Logo';
|
import Logo from './Logo.vue';
|
||||||
import PrimaryNavItem from './PrimaryNavItem';
|
import PrimaryNavItem from './PrimaryNavItem.vue';
|
||||||
import OptionsMenu from './OptionsMenu';
|
import OptionsMenu from './OptionsMenu.vue';
|
||||||
import AgentDetails from './AgentDetails';
|
import AgentDetails from './AgentDetails.vue';
|
||||||
import NotificationBell from './NotificationBell';
|
import NotificationBell from './NotificationBell.vue';
|
||||||
import wootConstants from 'dashboard/constants/globals';
|
import wootConstants from 'dashboard/constants/globals';
|
||||||
import { frontendURL } from 'dashboard/helper/URLHelper';
|
import { frontendURL } from 'dashboard/helper/URLHelper';
|
||||||
import { ACCOUNT_EVENTS } from '../../../helper/AnalyticsHelper/events';
|
import { ACCOUNT_EVENTS } from '../../../helper/AnalyticsHelper/events';
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ export default {
|
|||||||
toStateName: 'labels_list',
|
toStateName: 'labels_list',
|
||||||
showModalForNewItem: true,
|
showModalForNewItem: true,
|
||||||
modalName: 'AddLabel',
|
modalName: 'AddLabel',
|
||||||
|
dataTestid: 'sidebar-new-label-button',
|
||||||
children: this.labels.map(label => ({
|
children: this.labels.map(label => ({
|
||||||
id: label.id,
|
id: label.id,
|
||||||
label: label.title,
|
label: label.title,
|
||||||
|
|||||||
+4
-2
@@ -9,7 +9,8 @@
|
|||||||
class="font-medium h-7 my-1 hover:bg-slate-25 hover:text-bg-50 flex items-center px-2 rounded-md dark:hover:bg-slate-800"
|
class="font-medium h-7 my-1 hover:bg-slate-25 hover:text-bg-50 flex items-center px-2 rounded-md dark:hover:bg-slate-800"
|
||||||
:class="{
|
:class="{
|
||||||
'bg-woot-25 dark:bg-slate-800': isActive,
|
'bg-woot-25 dark:bg-slate-800': isActive,
|
||||||
'text-ellipsis overflow-hidden whitespace-nowrap max-w-full': shouldTruncate,
|
'text-ellipsis overflow-hidden whitespace-nowrap max-w-full':
|
||||||
|
shouldTruncate,
|
||||||
}"
|
}"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
>
|
>
|
||||||
@@ -44,7 +45,8 @@
|
|||||||
class="text-sm text-slate-700 dark:text-slate-100"
|
class="text-sm text-slate-700 dark:text-slate-100"
|
||||||
:class="{
|
:class="{
|
||||||
'text-woot-500 dark:text-woot-500': isActive,
|
'text-woot-500 dark:text-woot-500': isActive,
|
||||||
'text-ellipsis overflow-hidden whitespace-nowrap max-w-full': shouldTruncate,
|
'text-ellipsis overflow-hidden whitespace-nowrap max-w-full':
|
||||||
|
shouldTruncate,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
|
|||||||
@@ -35,7 +35,8 @@
|
|||||||
:class="{
|
:class="{
|
||||||
'text-slate-300 dark:text-slate-600': isCountZero && !isActiveView,
|
'text-slate-300 dark:text-slate-600': isCountZero && !isActiveView,
|
||||||
'text-slate-600 dark:text-slate-50': !isCountZero && !isActiveView,
|
'text-slate-600 dark:text-slate-50': !isCountZero && !isActiveView,
|
||||||
'bg-woot-75 dark:bg-woot-200 text-woot-600 dark:text-woot-600': isActiveView,
|
'bg-woot-75 dark:bg-woot-200 text-woot-600 dark:text-woot-600':
|
||||||
|
isActiveView,
|
||||||
'bg-slate-50 dark:bg-slate-700': !isActiveView,
|
'bg-slate-50 dark:bg-slate-700': !isActiveView,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
variant="clear"
|
variant="clear"
|
||||||
color-scheme="secondary"
|
color-scheme="secondary"
|
||||||
icon="add"
|
icon="add"
|
||||||
|
:data-testid="menuItem.dataTestid"
|
||||||
@click="e => newLinkClick(e, navigate)"
|
@click="e => newLinkClick(e, navigate)"
|
||||||
>
|
>
|
||||||
{{ $t(`SIDEBAR.${menuItem.newLinkTag}`) }}
|
{{ $t(`SIDEBAR.${menuItem.newLinkTag}`) }}
|
||||||
@@ -97,7 +99,7 @@ import {
|
|||||||
getInboxWarningIconClass,
|
getInboxWarningIconClass,
|
||||||
} from 'dashboard/helper/inbox';
|
} from 'dashboard/helper/inbox';
|
||||||
|
|
||||||
import SecondaryChildNavItem from './SecondaryChildNavItem';
|
import SecondaryChildNavItem from './SecondaryChildNavItem.vue';
|
||||||
import {
|
import {
|
||||||
isOnMentionsView,
|
isOnMentionsView,
|
||||||
isOnUnattendedView,
|
isOnUnattendedView,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user