diff --git a/Gemfile b/Gemfile index cf366e79e..bee9eddc1 100644 --- a/Gemfile +++ b/Gemfile @@ -71,7 +71,7 @@ gem 'barnes' ##--- gems for authentication & authorization ---## gem 'devise', '>= 4.9.4' gem 'devise-secure_password', git: 'https://github.com/chatwoot/devise-secure_password', branch: 'chatwoot' -gem 'devise_token_auth' +gem 'devise_token_auth', '>= 1.2.3' # authorization gem 'jwt' gem 'pundit' @@ -155,9 +155,6 @@ gem 'stripe' ## to populate db with sample data gem 'faker' -# to consume GraphQL-based APIs -gem 'graphlient' - # Include logrange conditionally in intializer using env variable gem 'lograge', '~> 0.14.0', require: false @@ -169,7 +166,7 @@ gem 'audited', '~> 5.4', '>= 5.4.1' # need for google auth gem 'omniauth', '>= 2.1.2' gem 'omniauth-google-oauth2', '>= 1.1.2' -gem 'omniauth-rails_csrf_protection', '~> 1.0' +gem 'omniauth-rails_csrf_protection', '~> 1.0', '>= 1.0.2' ## Gems for reponse bot # adds cosine similarity to postgres using vector extension diff --git a/Gemfile.lock b/Gemfile.lock index 1f32a7cc6..2f890deaa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -148,7 +148,7 @@ GEM barnes (0.0.9) multi_json (~> 1) statsd-ruby (~> 1.1) - base64 (0.1.1) + base64 (0.2.0) bcrypt (3.1.20) bigdecimal (3.1.7) bindex (0.8.1) @@ -200,10 +200,10 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise_token_auth (1.2.1) + devise_token_auth (1.2.3) bcrypt (~> 3.0) devise (> 3.5.2, < 5) - rails (>= 4.2.0, < 7.1) + rails (>= 4.2.0, < 7.2) diff-lcs (1.5.0) digest-crc (0.6.4) rake (>= 12.0.0, < 14.0.0) @@ -333,14 +333,6 @@ GEM multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) - graphlient (0.8.0) - faraday (~> 2.0) - graphql-client - graphql (2.3.2) - base64 - graphql-client (0.22.0) - activesupport (>= 3.0) - graphql (>= 1.13.0) groupdate (6.2.1) activesupport (>= 5.2) grpc (1.62.0) @@ -377,7 +369,7 @@ GEM mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) httpclient (2.8.3) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) @@ -482,7 +474,7 @@ GEM uri net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.10) + net-imap (0.4.11) date net-protocol net-pop (0.1.2) @@ -497,15 +489,15 @@ GEM sidekiq newrelic_rpm (9.6.0) base64 - nio4r (2.7.1) - nokogiri (1.16.4) + nio4r (2.7.3) + nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.4-arm64-darwin) + nokogiri (1.16.5-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-darwin) + nokogiri (1.16.5-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -532,7 +524,7 @@ GEM omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) openssl (3.1.0) @@ -827,7 +819,7 @@ GEM working_hours (1.4.1) activesupport (>= 3.2) tzinfo - zeitwerk (2.6.13) + zeitwerk (2.6.14) PLATFORMS arm64-darwin-20 @@ -868,7 +860,7 @@ DEPENDENCIES debug (~> 1.8) devise (>= 4.9.4) devise-secure_password! - devise_token_auth + devise_token_auth (>= 1.2.3) dotenv-rails down elastic-apm @@ -884,7 +876,6 @@ DEPENDENCIES google-cloud-dialogflow-v2 google-cloud-storage google-cloud-translate-v3 - graphlient groupdate grpc haikunator @@ -913,7 +904,7 @@ DEPENDENCIES omniauth (>= 2.1.2) omniauth-google-oauth2 (>= 1.1.2) omniauth-oauth2 - omniauth-rails_csrf_protection (~> 1.0) + omniauth-rails_csrf_protection (~> 1.0, >= 1.0.2) pg pg_search pgvector diff --git a/app.json b/app.json index 4ee025f06..d50040814 100644 --- a/app.json +++ b/app.json @@ -55,7 +55,7 @@ "plan": "heroku-redis:mini" }, { - "plan": "heroku-postgresql:mini" + "plan": "heroku-postgresql:essential-0" } ], "stack": "heroku-20", diff --git a/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue b/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue index 132408dc2..aa566fd4d 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue @@ -33,6 +33,21 @@ import { convertWavToMp3 } from './utils/mp3ConversionUtils'; WaveSurfer.microphone = MicrophonePlugin; +const RECORDER_CONFIG = { + [AUDIO_FORMATS.WAV]: { + audioMimeType: 'audio/wav', + audioWorkerURL: waveWorker, + }, + [AUDIO_FORMATS.MP3]: { + audioMimeType: 'audio/wav', + audioWorkerURL: waveWorker, + }, + [AUDIO_FORMATS.OGG]: { + audioMimeType: 'audio/ogg', + audioWorkerURL: encoderWorker, + }, +}; + export default { name: 'WootAudioRecorder', mixins: [alertMixin], @@ -94,14 +109,7 @@ export default { audioSampleRate: 48000, audioBitRate: 128, audioEngine: 'opus-recorder', - ...(this.audioRecordFormat === AUDIO_FORMATS.WAV && { - audioMimeType: 'audio/wav', - audioWorkerURL: waveWorker, - }), - ...(this.audioRecordFormat === AUDIO_FORMATS.OGG && { - audioMimeType: 'audio/ogg', - audioWorkerURL: encoderWorker, - }), + ...RECORDER_CONFIG[this.audioRecordFormat], }, }, }, @@ -139,7 +147,11 @@ export default { methods: { deviceReady() { if (this.player.record().engine instanceof OpusRecorderEngine) { - if (this.audioRecordFormat === AUDIO_FORMATS.WAV) { + if ( + [AUDIO_FORMATS.WAV, AUDIO_FORMATS.MP3].includes( + this.audioRecordFormat + ) + ) { this.player.record().engine.audioType = 'audio/wav'; } } @@ -154,13 +166,12 @@ export default { async finishRecord() { let recordedContent = this.player.recordedData; let fileName = this.player.recordedData.name; - if (this.isAWhatsAppChannel) { + let type = this.player.recordedData.type; + if (this.audioRecordFormat === AUDIO_FORMATS.MP3) { recordedContent = await convertWavToMp3(this.player.recordedData); fileName = `${getUuid()}.mp3`; + type = AUDIO_FORMATS.MP3; } - const type = !this.isAWhatsAppChannel - ? this.player.recordedData.type - : 'audio/mp3'; const file = new File([recordedContent], fileName, { type }); this.fireRecorderBlob(file); }, diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index 83d31d11f..42fa74ec7 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -53,7 +53,6 @@ v-if="showAudioRecorderEditor" ref="audioRecorderInput" :audio-record-format="audioRecordFormat" - :is-a-whats-app-channel="isAWhatsAppChannel" @state-recorder-progress-changed="onStateProgressRecorderChanged" @state-recorder-changed="onStateRecorderChanged" @finish-record="onFinishRecorder" @@ -502,7 +501,10 @@ export default { return `draft-${this.conversationIdByRoute}-${this.replyType}`; }, audioRecordFormat() { - if (this.isAPIInbox || this.isATelegramChannel) { + if (this.isAWhatsAppChannel || this.isATelegramChannel) { + return AUDIO_FORMATS.MP3; + } + if (this.isAPIInbox) { return AUDIO_FORMATS.OGG; } return AUDIO_FORMATS.WAV; @@ -1250,6 +1252,7 @@ export default { } } } + .send-button { @apply mb-0; } @@ -1274,6 +1277,7 @@ export default { .emoji-dialog--rtl { @apply left-[unset] -right-80; + &::before { transform: rotate(90deg); filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.08)); diff --git a/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue b/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue index 9b77faafe..6b09acbac 100644 --- a/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue +++ b/app/javascript/dashboard/components/widgets/forms/PhoneInput.vue @@ -1,9 +1,16 @@