From b8d0252511f6435640a77914fa8a37c749850180 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 3 Oct 2024 12:44:18 +0530 Subject: [PATCH] feat: remove usage of `.sync` and define explicitly `emits` (#10209) References - https://v3-migration.vuejs.org/breaking-changes/v-model - https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html --- .../dashboard/components/ChatList.vue | 4 +- app/javascript/dashboard/components/Modal.vue | 11 ++--- .../dashboard/components/ui/Switch.vue | 1 + .../components/widgets/AIAssistanceButton.vue | 4 +- .../widgets/AutomationActionInput.vue | 1 + .../AutomationActionTeamMessageInput.vue | 1 + .../widgets/WootWriter/FullEditor.vue | 1 + .../conversation/EmailTranscriptModal.vue | 13 +++--- .../widgets/conversation/MessagesView.vue | 4 +- .../widgets/conversation/ReplyBox.vue | 22 +++++----- .../widgets/conversation/ReplyEmailHead.vue | 1 + .../conversation/WhatsappTemplates/Modal.vue | 20 +++++---- .../widgets/conversation/bubble/Image.vue | 2 +- .../conversation/bubble/ImageAudioVideo.vue | 2 +- .../widgets/conversation/bubble/Text.vue | 2 +- .../widgets/conversation/bubble/Video.vue | 2 +- .../conversation/components/GalleryView.vue | 8 +--- .../conversationBulkActions/Index.vue | 2 +- .../widgets/conversation/linear/index.vue | 2 +- .../components/widgets/forms/Input.vue | 3 +- .../components/widgets/forms/PhoneInput.vue | 1 + .../widgets/modal/ConfirmDeleteModal.vue | 42 +++++-------------- .../widgets/modal/ConfirmationModal.vue | 2 +- .../components/widgets/modal/DeleteModal.vue | 31 ++++++-------- .../modules/contact/ContactMergeModal.vue | 13 +++--- .../contact/components/AddCustomAttribute.vue | 12 +++--- .../components/MessageContextMenu.vue | 4 +- .../modules/notes/components/ContactNote.vue | 2 +- .../dashboard/routes/dashboard/Dashboard.vue | 7 +++- .../commands/CmdBarConversationSnooze.vue | 2 +- .../contacts/components/ContactsView.vue | 6 +-- .../contacts/components/ImportContacts.vue | 2 +- .../conversation/contact/ContactInfo.vue | 2 +- .../conversation/contact/ConversationForm.vue | 4 +- .../conversation/contact/CreateContact.vue | 19 +++++---- .../conversation/contact/EditContact.vue | 18 ++++---- .../conversation/contact/NewConversation.vue | 13 +++--- .../dashboard/customviews/AddCustomViews.vue | 2 +- .../customviews/DeleteCustomViews.vue | 16 +++---- .../helpcenter/components/AddLocale.vue | 12 +++--- .../components/HelpCenterLayout.vue | 2 +- .../helpcenter/components/PortalListItem.vue | 2 +- .../helpcenter/components/Sidebar/Sidebar.vue | 1 + .../components/Sidebar/SidebarSearch.vue | 1 + .../helpcenter/pages/articles/EditArticle.vue | 2 +- .../pages/categories/AddCategory.vue | 11 ++--- .../pages/categories/EditCategory.vue | 11 ++--- .../pages/categories/ListAllCategories.vue | 4 +- .../pages/portals/EditPortalLocales.vue | 2 +- .../pages/portals/ListAllPortals.vue | 2 +- .../inbox/components/InboxItemHeader.vue | 2 +- .../agentBots/components/CSMLMonacoEditor.vue | 1 + .../dashboard/settings/agents/Index.vue | 6 +-- .../settings/attributes/AddAttribute.vue | 2 +- .../settings/attributes/CustomAttribute.vue | 4 +- .../dashboard/settings/attributes/Index.vue | 2 +- .../dashboard/settings/automation/Index.vue | 6 +-- .../dashboard/settings/campaigns/Campaign.vue | 4 +- .../dashboard/settings/campaigns/Index.vue | 2 +- .../dashboard/settings/canned/AddCanned.vue | 2 +- .../dashboard/settings/canned/EditCanned.vue | 2 +- .../dashboard/settings/canned/Index.vue | 6 +-- .../dashboard/settings/customRoles/Index.vue | 4 +- .../routes/dashboard/settings/inbox/Index.vue | 2 +- .../integrations/DashboardApps/Index.vue | 2 +- .../settings/integrations/Integration.vue | 2 +- .../integrations/IntegrationHooks.vue | 4 +- .../settings/integrations/Webhooks/Index.vue | 6 +-- .../dashboard/settings/labels/Index.vue | 6 +-- .../dashboard/settings/macros/Index.vue | 2 +- .../routes/dashboard/settings/sla/Index.vue | 4 +- .../routes/dashboard/settings/teams/Index.vue | 2 +- .../portal/components/PublicArticleSearch.vue | 1 + .../shared/components/GreetingsEditor.vue | 1 + .../shared/components/ResizableTextArea.vue | 8 ++++ .../components/ui/label/LabelDropdown.vue | 2 +- .../v3/components/Form/RadioTags.vue | 1 + app/javascript/v3/components/Form/Select.vue | 1 + app/javascript/v3/components/Form/Switch.vue | 1 + .../v3/components/Form/Textarea.vue | 1 + .../widget/components/Form/Input.vue | 1 + .../widget/components/Form/TextArea.vue | 1 + 82 files changed, 224 insertions(+), 221 deletions(-) diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 0d6165319..d7b9ae220 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -785,7 +785,7 @@ watch(conversationFilters, (newVal, oldVal) => { { diff --git a/app/javascript/dashboard/components/Modal.vue b/app/javascript/dashboard/components/Modal.vue index e8a71b1c9..5f65c34dd 100644 --- a/app/javascript/dashboard/components/Modal.vue +++ b/app/javascript/dashboard/components/Modal.vue @@ -3,9 +3,8 @@ import { ref, computed, defineEmits, onMounted } from 'vue'; import { useEventListener } from '@vueuse/core'; -const { show, modalType, closeOnBackdropClick, onClose } = defineProps({ +const { modalType, closeOnBackdropClick, onClose } = defineProps({ closeOnBackdropClick: { type: Boolean, default: true }, - show: Boolean, showCloseButton: { type: Boolean, default: true }, onClose: { type: Function, required: true }, fullWidth: { type: Boolean, default: false }, @@ -14,6 +13,7 @@ const { show, modalType, closeOnBackdropClick, onClose } = defineProps({ }); const emit = defineEmits(['close']); +const show = defineModel('show', { type: Boolean, default: false }); const modalClassName = computed(() => { const modalClassNameMap = { @@ -32,6 +32,7 @@ const handleMouseDown = () => { }; const close = () => { + show.value = false; emit('close'); onClose(); }; @@ -40,14 +41,14 @@ const onMouseUp = () => { if (mousedDownOnBackdrop.value) { mousedDownOnBackdrop.value = false; if (closeOnBackdropClick) { - onClose(); + close(); } } }; const onKeydown = e => { - if (show && e.code === 'Escape') { - onClose(); + if (show.value && e.code === 'Escape') { + close(); e.stopPropagation(); } }; diff --git a/app/javascript/dashboard/components/ui/Switch.vue b/app/javascript/dashboard/components/ui/Switch.vue index 0e047db57..f3bc9ee91 100644 --- a/app/javascript/dashboard/components/ui/Switch.vue +++ b/app/javascript/dashboard/components/ui/Switch.vue @@ -4,6 +4,7 @@ export default { modelValue: { type: Boolean, default: false }, size: { type: String, default: '' }, }, + emits: ['update:modelValue', 'input'], methods: { onClick() { this.$emit('update:modelValue', !this.modelValue); diff --git a/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue b/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue index 7f8a1f5ef..c74c7bd73 100644 --- a/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue +++ b/app/javascript/dashboard/components/widgets/AIAssistanceButton.vue @@ -137,7 +137,7 @@ export default { @click="openAIAssist" />
- +
diff --git a/app/javascript/dashboard/components/widgets/AutomationActionInput.vue b/app/javascript/dashboard/components/widgets/AutomationActionInput.vue index 68229f49e..e062a0bb3 100644 --- a/app/javascript/dashboard/components/widgets/AutomationActionInput.vue +++ b/app/javascript/dashboard/components/widgets/AutomationActionInput.vue @@ -38,6 +38,7 @@ export default { default: false, }, }, + emits: ['update:modelValue', 'input', 'removeAction', 'resetAction'], computed: { action_name: { get() { diff --git a/app/javascript/dashboard/components/widgets/AutomationActionTeamMessageInput.vue b/app/javascript/dashboard/components/widgets/AutomationActionTeamMessageInput.vue index f6a164730..8d5bc16fa 100644 --- a/app/javascript/dashboard/components/widgets/AutomationActionTeamMessageInput.vue +++ b/app/javascript/dashboard/components/widgets/AutomationActionTeamMessageInput.vue @@ -3,6 +3,7 @@ export default { // The value types are dynamic, hence prop validation removed to work with our action schema // eslint-disable-next-line vue/require-prop-types props: ['teams', 'value'], + emits: ['input'], data() { return { selectedTeams: [], diff --git a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue index 96081e631..31b00937a 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue @@ -47,6 +47,7 @@ export default { placeholder: { type: String, default: '' }, enabledMenuOptions: { type: Array, default: () => [] }, }, + emits: ['blur', 'input', 'update:modelValue', 'keyup', 'focus', 'keydown'], setup() { const { uiSettings, updateUISettings } = useUISettings(); diff --git a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue index 383d70b2e..b1d96ea54 100644 --- a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue +++ b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue @@ -1,20 +1,20 @@ -