mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	chore: Reply window fixes (#11242)
- Fixed the can reply window links. - Added the supported file types for Instagram.
This commit is contained in:
		@@ -10,6 +10,7 @@ import {
 | 
				
			|||||||
  ALLOWED_FILE_TYPES,
 | 
					  ALLOWED_FILE_TYPES,
 | 
				
			||||||
  ALLOWED_FILE_TYPES_FOR_TWILIO_WHATSAPP,
 | 
					  ALLOWED_FILE_TYPES_FOR_TWILIO_WHATSAPP,
 | 
				
			||||||
  ALLOWED_FILE_TYPES_FOR_LINE,
 | 
					  ALLOWED_FILE_TYPES_FOR_LINE,
 | 
				
			||||||
 | 
					  ALLOWED_FILE_TYPES_FOR_INSTAGRAM,
 | 
				
			||||||
} from 'shared/constants/messages';
 | 
					} from 'shared/constants/messages';
 | 
				
			||||||
import VideoCallButton from '../VideoCallButton.vue';
 | 
					import VideoCallButton from '../VideoCallButton.vue';
 | 
				
			||||||
import AIAssistanceButton from '../AIAssistanceButton.vue';
 | 
					import AIAssistanceButton from '../AIAssistanceButton.vue';
 | 
				
			||||||
@@ -113,6 +114,10 @@ export default {
 | 
				
			|||||||
      type: String,
 | 
					      type: String,
 | 
				
			||||||
      required: true,
 | 
					      required: true,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    conversationType: {
 | 
				
			||||||
 | 
					      type: String,
 | 
				
			||||||
 | 
					      default: '',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  emits: [
 | 
					  emits: [
 | 
				
			||||||
    'replaceText',
 | 
					    'replaceText',
 | 
				
			||||||
@@ -187,6 +192,9 @@ export default {
 | 
				
			|||||||
    showAudioPlayStopButton() {
 | 
					    showAudioPlayStopButton() {
 | 
				
			||||||
      return this.showAudioRecorder && this.isRecordingAudio;
 | 
					      return this.showAudioRecorder && this.isRecordingAudio;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    isInstagramDM() {
 | 
				
			||||||
 | 
					      return this.conversationType === 'instagram_direct_message';
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    allowedFileTypes() {
 | 
					    allowedFileTypes() {
 | 
				
			||||||
      if (this.isATwilioWhatsAppChannel) {
 | 
					      if (this.isATwilioWhatsAppChannel) {
 | 
				
			||||||
        return ALLOWED_FILE_TYPES_FOR_TWILIO_WHATSAPP;
 | 
					        return ALLOWED_FILE_TYPES_FOR_TWILIO_WHATSAPP;
 | 
				
			||||||
@@ -194,6 +202,10 @@ export default {
 | 
				
			|||||||
      if (this.isALineChannel) {
 | 
					      if (this.isALineChannel) {
 | 
				
			||||||
        return ALLOWED_FILE_TYPES_FOR_LINE;
 | 
					        return ALLOWED_FILE_TYPES_FOR_LINE;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      if (this.isAInstagramChannel || this.isInstagramDM) {
 | 
				
			||||||
 | 
					        return ALLOWED_FILE_TYPES_FOR_INSTAGRAM;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return ALLOWED_FILE_TYPES;
 | 
					      return ALLOWED_FILE_TYPES;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    enableDragAndDrop() {
 | 
					    enableDragAndDrop() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -226,16 +226,23 @@ export default {
 | 
				
			|||||||
      return this.$t('CONVERSATION.CANNOT_REPLY');
 | 
					      return this.$t('CONVERSATION.CANNOT_REPLY');
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    replyWindowLink() {
 | 
					    replyWindowLink() {
 | 
				
			||||||
      if (this.isAWhatsAppChannel) {
 | 
					      if (this.isAFacebookInbox || this.isAInstagramChannel) {
 | 
				
			||||||
        return REPLY_POLICY.FACEBOOK;
 | 
					        return REPLY_POLICY.FACEBOOK;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      if (this.isAWhatsAppCloudChannel) {
 | 
				
			||||||
 | 
					        return REPLY_POLICY.WHATSAPP_CLOUD;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      if (!this.isAPIInbox) {
 | 
					      if (!this.isAPIInbox) {
 | 
				
			||||||
        return REPLY_POLICY.TWILIO_WHATSAPP;
 | 
					        return REPLY_POLICY.TWILIO_WHATSAPP;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      return '';
 | 
					      return '';
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    replyWindowLinkText() {
 | 
					    replyWindowLinkText() {
 | 
				
			||||||
      if (this.isAWhatsAppChannel) {
 | 
					      if (
 | 
				
			||||||
 | 
					        this.isAWhatsAppChannel ||
 | 
				
			||||||
 | 
					        this.isAFacebookInbox ||
 | 
				
			||||||
 | 
					        this.isAInstagramChannel
 | 
				
			||||||
 | 
					      ) {
 | 
				
			||||||
        return this.$t('CONVERSATION.24_HOURS_WINDOW');
 | 
					        return this.$t('CONVERSATION.24_HOURS_WINDOW');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (!this.isAPIInbox) {
 | 
					      if (!this.isAPIInbox) {
 | 
				
			||||||
@@ -485,7 +492,7 @@ export default {
 | 
				
			|||||||
    <Banner
 | 
					    <Banner
 | 
				
			||||||
      v-if="!currentChat.can_reply"
 | 
					      v-if="!currentChat.can_reply"
 | 
				
			||||||
      color-scheme="alert"
 | 
					      color-scheme="alert"
 | 
				
			||||||
      class="mt-2 mx-2 rounded-lg overflow-hidden"
 | 
					      class="mx-2 mt-2 overflow-hidden rounded-lg"
 | 
				
			||||||
      :banner-message="replyWindowBannerMessage"
 | 
					      :banner-message="replyWindowBannerMessage"
 | 
				
			||||||
      :href-link="replyWindowLink"
 | 
					      :href-link="replyWindowLink"
 | 
				
			||||||
      :href-link-text="replyWindowLinkText"
 | 
					      :href-link-text="replyWindowLinkText"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1195,6 +1195,7 @@ export default {
 | 
				
			|||||||
      :mode="replyType"
 | 
					      :mode="replyType"
 | 
				
			||||||
      :on-file-upload="onFileUpload"
 | 
					      :on-file-upload="onFileUpload"
 | 
				
			||||||
      :on-send="onSendReply"
 | 
					      :on-send="onSendReply"
 | 
				
			||||||
 | 
					      :conversation-type="conversationType"
 | 
				
			||||||
      :recording-audio-duration-text="recordingAudioDurationText"
 | 
					      :recording-audio-duration-text="recordingAudioDurationText"
 | 
				
			||||||
      :recording-audio-state="recordingAudioState"
 | 
					      :recording-audio-state="recordingAudioState"
 | 
				
			||||||
      :send-button-text="replyButtonLabel"
 | 
					      :send-button-text="replyButtonLabel"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,4 +3,6 @@ export const REPLY_POLICY = {
 | 
				
			|||||||
    'https://developers.facebook.com/docs/messenger-platform/policy/policy-overview/',
 | 
					    'https://developers.facebook.com/docs/messenger-platform/policy/policy-overview/',
 | 
				
			||||||
  TWILIO_WHATSAPP:
 | 
					  TWILIO_WHATSAPP:
 | 
				
			||||||
    'https://www.twilio.com/docs/whatsapp/tutorial/send-whatsapp-notification-messages-templates#sending-non-template-messages-within-a-24-hour-session',
 | 
					    'https://www.twilio.com/docs/whatsapp/tutorial/send-whatsapp-notification-messages-templates#sending-non-template-messages-within-a-24-hour-session',
 | 
				
			||||||
 | 
					  WHATSAPP_CLOUD:
 | 
				
			||||||
 | 
					    'https://business.whatsapp.com/policy#:~:text=You%20may%20reply%20to%20a,messages%20via%20approved%20Message%20Templates.',
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,6 +57,10 @@ export const ALLOWED_FILE_TYPES_FOR_TWILIO_WHATSAPP =
 | 
				
			|||||||
// https://developers.line.biz/en/reference/messaging-api/#image-message, https://developers.line.biz/en/reference/messaging-api/#video-message
 | 
					// https://developers.line.biz/en/reference/messaging-api/#image-message, https://developers.line.biz/en/reference/messaging-api/#video-message
 | 
				
			||||||
export const ALLOWED_FILE_TYPES_FOR_LINE = 'image/png, image/jpeg,video/mp4';
 | 
					export const ALLOWED_FILE_TYPES_FOR_LINE = 'image/png, image/jpeg,video/mp4';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/messaging-api#requirements
 | 
				
			||||||
 | 
					export const ALLOWED_FILE_TYPES_FOR_INSTAGRAM =
 | 
				
			||||||
 | 
					  'image/png, image/jpeg, video/mp4, video/mov, video/webm';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const CSAT_RATINGS = [
 | 
					export const CSAT_RATINGS = [
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    key: 'disappointed',
 | 
					    key: 'disappointed',
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user