From 6b9580dcf810dc1171392cb33ab6ec24735cfd0c Mon Sep 17 00:00:00 2001 From: Ariunzaya Date: Fri, 9 Jun 2023 15:01:54 +0800 Subject: [PATCH 01/24] add mutations --- .../ui-cards/src/comment/graphql/mutations.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/ui-cards/src/comment/graphql/mutations.ts b/packages/ui-cards/src/comment/graphql/mutations.ts index b85d0a99bcc..c718e2c7532 100644 --- a/packages/ui-cards/src/comment/graphql/mutations.ts +++ b/packages/ui-cards/src/comment/graphql/mutations.ts @@ -8,6 +8,25 @@ const clientPortalCommentsRemove = ` } `; +const clientPortalCommentsAdd = ` + mutation clientPortalCommentsAdd( + $typeId: String! + $type: String! + $content: String! + $userType: String! + ) { + clientPortalCommentsAdd( + typeId: $typeId + type: $type + content: $content + userType: $userType + ) { + _id + } + } +`; + export default { - clientPortalCommentsRemove + clientPortalCommentsRemove, + clientPortalCommentsAdd }; From beb595415191b23093b315d66a4ec2a3562e781d Mon Sep 17 00:00:00 2001 From: munkhsaikhan Date: Fri, 9 Jun 2023 00:24:32 +0800 Subject: [PATCH 02/24] little fix --- .../src/components/dashboard/Participators.tsx | 3 ++- .../components/conversationDetail/workarea/Participators.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/plugin-dashboard-ui/src/components/dashboard/Participators.tsx b/packages/plugin-dashboard-ui/src/components/dashboard/Participators.tsx index ce4f663d63e..62b29b7200f 100644 --- a/packages/plugin-dashboard-ui/src/components/dashboard/Participators.tsx +++ b/packages/plugin-dashboard-ui/src/components/dashboard/Participators.tsx @@ -51,7 +51,8 @@ class Participators extends React.Component { const length = participatedUsers.length; const Trigger = user => { - const name = user.details.fullName || user.username || ''; + const name = + (user.details && user.details.fullName) || user.username || ''; return ( diff --git a/packages/ui-inbox/src/inbox/components/conversationDetail/workarea/Participators.tsx b/packages/ui-inbox/src/inbox/components/conversationDetail/workarea/Participators.tsx index ce4f663d63e..62b29b7200f 100644 --- a/packages/ui-inbox/src/inbox/components/conversationDetail/workarea/Participators.tsx +++ b/packages/ui-inbox/src/inbox/components/conversationDetail/workarea/Participators.tsx @@ -51,7 +51,8 @@ class Participators extends React.Component { const length = participatedUsers.length; const Trigger = user => { - const name = user.details.fullName || user.username || ''; + const name = + (user.details && user.details.fullName) || user.username || ''; return ( From cae695938af8bec860b4fbee03708108b0d7a9c8 Mon Sep 17 00:00:00 2001 From: uuganaa1007 <80632055+uuganaa1007@users.noreply.github.com> Date: Fri, 9 Jun 2023 01:42:52 +0800 Subject: [PATCH 03/24] Translation purchase (#4442) --- packages/core-ui/public/locales/en.json | 15 +++++++++++++++ packages/core-ui/public/locales/mn.json | 17 +++++++++++++++++ packages/core-ui/src/modules/robot/constants.ts | 2 +- .../dashboardSchemas/PurchasesProductsData.js | 2 -- packages/plugin-cards-api/src/forms.ts | 2 +- packages/plugin-cards-ui/src/configs.js | 4 ++-- .../src/purchases/components/CalendarColumn.tsx | 2 +- packages/plugin-forms-ui/src/constants.ts | 4 ++-- packages/ui-cards/src/boards/constants.ts | 12 ++++++------ packages/ui-settings/src/constants.ts | 2 +- plugins.js | 4 ++-- 11 files changed, 48 insertions(+), 18 deletions(-) diff --git a/packages/core-ui/public/locales/en.json b/packages/core-ui/public/locales/en.json index bb1143507be..4e233de36df 100644 --- a/packages/core-ui/public/locales/en.json +++ b/packages/core-ui/public/locales/en.json @@ -561,8 +561,12 @@ "Included fields": "Included fields", "Deal": "Deal", "Deals": "Deals", + "Purchase": "Purchase", + "Purchases": "Purchases", "Sales Pipeline": "Sales Pipeline", "Sales Pipelines": "Sales Pipelines", + "Purchases Pipeline": "Purchases Pipeline", + "Purchases Pipelines": "Purchases Pipelines", "New Product & Service": "New Product & Service", "No product or services": "No product or services", "Supply": "Supply", @@ -586,6 +590,7 @@ "Assigned to": "Assigned to", "Move": "Move", "Move deal": "Move deal", + "Move purchase": "Move purchase", "Copy": "Copy", "Close date": "Close date", "Choose product & service": "Choose product & service", @@ -601,6 +606,7 @@ "Manage Board & Pipeline": "Manage Board & Pipeline", "Choose a stage": "Choose a stage", "Deal Settings": "Sales Pipeline Settings", + "Purchase Settings": "Purchase Pipeline Settings", "Ticket Settings": "Ticket Settings", "Task Settings": "Task Settings", "Boards & Pipelines": "Boards & Pipelines", @@ -617,6 +623,7 @@ "Stage": "Stage", "Stage name": "Stage name", "Add a deal": "Add a deal", + "Add a purchase": "Add a purchase", "Add a task": "Add a task", "Add a ticket": "Add a ticket", "Priority": "Priority", @@ -631,6 +638,7 @@ "Description": "Description", "Select a priority": "Select a priority", "Edit deal": "Edit deal", + "Edit purchase": "Edit purchase", "Edit task": "Edit task", "Edit ticket": "Edit ticket", "Add Product / Service": "Add Product / Service", @@ -662,8 +670,10 @@ "Create another board": "Create another board", "No pipeline": "No pipeline", "No Sales Pipelines": "No Sales Pipelines", + "No Purchases Pipelines": "No Purchases Pipelines", "No stage": "No stage", "No deal": "No deal", + "No purchase": "No purchase", "Background": "Background", "Choose": "Choose", "Successfully saved.": "Successfully saved.", @@ -1211,6 +1221,7 @@ "Convert": "Convert", "Go to a ticket": "Go to a ticket", "Convert to a deal": "Convert to a deal", + "Convert to a purchase": "Convert to a purchase", "Convert to a task": "Convert to a task", "This message must have at least one recipient.": "This message must have at least one recipient.", "It`s size exceeds the limit 5mb": "It`s size exceeds the limit 5mb", @@ -1757,6 +1768,7 @@ "Board & Pipeline": "Board & Pipeline", "No label chosen": "No label chosen", "Click on “Boards, Calendar, Conversions” to filter deals": "Click on “Boards, Calendar, Conversions” to filter deals", + "Click on “Boards, Calendar, Conversions” to filter purchases": "Click on “Boards, Calendar, Conversions” to filter purchases", "Getting Started with Sales Pipeline": "Getting Started with Sales Pipeline", "Get started on your group": "Get started on your group", "Add calendar": "Add calendar", @@ -1809,6 +1821,7 @@ "permission": "permission", "product": "product", "deal": "deal", + "purchase": "purchase", "task": "task", "ticket": "ticket", "user": "user", @@ -1916,6 +1929,7 @@ "Export channels": "Export channels", "Export products": "Export products", "Export sales pipelines": "Export sales pipelines", + "Export purchases pipelines": "Export purchases pipelines", "Set up once and your team will be able to easily display multiple erxes widgets on any of their businesses websites": "Set up once and your team will be able to easily display multiple erxes widgets on any of their businesses websites", "Manage your boards and pipelines so that its easy to manage incoming leads or requests that is adaptable to your teams needs": "Manage your boards and pipelines so that its easy to manage incoming leads or requests that is adaptable to your teams needs", "All information and know-how related to your business products and services are found here": "All information and know-how related to your business products and services are found here", @@ -1924,6 +1938,7 @@ "There is no campaign": "There is no campaign", "Track your entire sales pipeline from one dashboard": "Track your entire sales pipeline from one dashboard", "You can also restrict access to your sales pipelines": "You can also restrict access to your sales pipelines", + "You can also restrict access to your purchases pipelines": "You can also restrict access to your purchases pipelines", "Drive leads to a successful close with our Kanban-style boards": "Drive leads to a successful close with our Kanban-style boards", "Import": "Import", "Add lead": "Add lead", diff --git a/packages/core-ui/public/locales/mn.json b/packages/core-ui/public/locales/mn.json index 2a845d8f33e..e77a4a502f9 100644 --- a/packages/core-ui/public/locales/mn.json +++ b/packages/core-ui/public/locales/mn.json @@ -562,8 +562,12 @@ "Included fields": "Оруулсан талбарууд", "Deal": "Хэлэлцээ", "Deals": "Хэлэлцээнүүд", + "Purchase": "Худалдан авалт", + "Purchases": "Худалдан авалтууд", "Sales Pipeline": "Борлуулалтын бүртгэл", "Sales Pipelines": "Борлуулалтын бүртгэлүүд", + "Purchases Pipeline": "Худалдан авалтын бүртгэл", + "Purchases Pipelines": "Худалдан авалтын бүртгэлүүд", "New Product & Service": "Шинэ бүтээгдэхүүн ба үйлчилгээ", "No product or services": "Ямар ч бүтээгдэхүүн, үйлчилгээ байхгүй", "Supply": "Нийлүүлэлтийн төрөл", @@ -587,6 +591,7 @@ "Assigned to": "Хуваарилагдсан", "Move": "Шилжүүлэх", "Move deal": "Шилжүүлэх гэрээ", + "Move purchase": "Худалдан авалтыг шилжүүлэх", "Copy": "Хуулбарлах", "Close date": "Огноо", "Choose product & service": "Бүтээгдэхүүн, үйлчилгээг сонгоно уу", @@ -602,6 +607,7 @@ "Manage Board & Pipeline": "Зөвлөл ба шугам хоолойг удирдах", "Choose a stage": "Тайзыг сонгоно уу", "Deal Settings": "Борлуулалт самбарын тохиргоо", + "Purchase Settings": "Худалдан авах тохиргоо", "Ticket Settings": "Суппорт самбарын тохиргоо", "Task Settings": "Ажлын самбарын тохиргоо", "Boards & Pipelines": "ТУЗ ба дамжуулах хоолой", @@ -618,6 +624,7 @@ "Stage": "Шат", "Stage name": "Тайзны нэр", "Add a deal": "Хэлэлцээр нэмнэ үү", + "Add a purchase": "Худалдан авалт нэмнэ үү", "Add a task": "Даалгавар нэмнэ үү", "Add a ticket": "Тасалбар нэмэх", "Priority": "Тэргүүлэх чиглэл", @@ -632,6 +639,7 @@ "Description": "Тайлбар", "Select a priority": "Нэн тэргүүлэх чиглэлийг сонгоно уу", "Edit deal": "Гэрээг засварлах", + "Edit purchase": "Худалдан авалтыг засах", "Edit task": "Даалгаврыг засах", "Edit ticket": "Тасалбар засах", "Add Product / Service": "Бүтээгдэхүүн / үйлчилгээ нэмэх", @@ -663,8 +671,10 @@ "Create another board": "Өөр самбар үүсгэх", "No pipeline": "Шугам хоолой байхгүй", "No Sales Pipelines": "Борлуулалтын бүртгэл олдсонгүй", + "No Purchases Pipelines": "Худалдан авалтын бүртгэл олдсонгүй", "No stage": "Шат байхгүй", "No deal": "Тохиролцохгүй", + "No purchase": "Худалдан авалт байхгүй", "Background": "Дэвсгэр", "Choose": "Сонгоно уу", "Successfully saved.": "Амжилттай хадгаллаа.", @@ -1211,6 +1221,7 @@ "Convert": "Хөрвүүлэх", "Go to a ticket": "Тасалбар руу яв", "Convert to a deal": "Хэлэлцээр рүү хөрвүүлэх", + "Convert to a purchase": "Худалдан авалт болгон хөрвүүлэх", "Convert to a task": "Даалгавар болгон хөрвүүлэх", "This message must have at least one recipient.": "Энэ зурвас дор хаяж нэг хүлээн авагчтай байх ёстой.", "It`s size exceeds the limit 5mb": "Хэмжээ нь 5mb хязгаараас давсан байна", @@ -1243,6 +1254,7 @@ "The conversation has been reopened and restored to Inbox": "Харилцан яриаг дахин нээж Ирсэн имэйл рүү сэргээсэн", "Growth Hacking Settings": "Growth Hacking тохиргоо", "Sales Pipeline Settings": "Борлуулалт самбарын тохиргоо", + "Purchases Pipeline Settings": "Худалдан авалтын самбарын тохиргоо", "AWS SES": "AWS SES", "Learn how to set file uploading.": "Файл байршуулах тохиргоог хэрхэн хийхийг сурах.", "Learn the case of custom email service": "Захиалгат имэйлийн үйлчилгээний талаар олж мэдэх", @@ -1756,6 +1768,7 @@ "Board & Pipeline": "Удирдах зөвлөл ба дамжуулах хоолой", "No label chosen": "Шошго сонгоогүй байна", "Click on “Boards, Calendar, Conversions” to filter deals": "Хэлэлцүүлгийг шүүхийн тулд "Самбар, Хуанли, Хөрвүүлэлт" дээр дарна уу", + "Click on “Boards, Calendar, Conversions” to filter purchases": "Худалдан авалтыг шүүхийн тулд "Самбар, Хуанли, Хөрвүүлэлт" дээр дарна уу", "Getting Started with Sales Pipeline": "Борлуулалтын хоолойг эхлүүлэх", "Get started on your group": "Бүлгээ эхлүүлээрэй", "Add calendar": "Календарь нэмэх", @@ -1808,6 +1821,7 @@ "permission": "зөвшөөрөл", "product": "бүтээгдэхүүн", "deal": "гэрээ", + "purchase": "худалдан авалт", "task": "даалгавар", "ticket": "тасалбар", "user": "хэрэглэгч", @@ -1915,6 +1929,7 @@ "Export channels": "Экспортлох сувгууд", "Export products": "Бүтээгдэхүүн экспортлох", "Export sales pipelines": "Борлуулалтын шугамыг экспортлох", + "Export purchases pipelines": "Худалдан авалтын шугам хоолой экспортлох", "Set up once and your team will be able to easily display multiple erxes widgets on any of their businesses websites": "Нэг удаа тохируулаарай, танай баг бизнесийнхээ аль ч вэбсайт дээр олон erxes виджетийг хялбархан харуулах боломжтой болно", "Manage your boards and pipelines so that its easy to manage incoming leads or requests that is adaptable to your teams needs": "Багуудынхаа хэрэгцээнд нийцүүлэн орж ирж буй утас эсвэл хүсэлтийг удирдахад хялбар байхын тулд самбар, дамжуулах хоолойгоо удирдаарай", "All information and know-how related to your business products and services are found here": "Танай бизнесийн бүтээгдэхүүн, үйлчилгээтэй холбоотой бүх мэдээлэл, ноу-хау энд байна", @@ -1923,6 +1938,7 @@ "There is no campaign": "Ямар ч кампанит ажил байхгүй", "Track your entire sales pipeline from one dashboard": "Борлуулалтын шугамаа бүхэлд нь нэг самбараас хянах", "You can also restrict access to your sales pipelines": "Та мөн борлуулалтын шугам руу нэвтрэх эрхийг хязгаарлаж болно", + "You can also restrict access to your purchases pipelines": "Та мөн худалдан авалтын шугам руу нэвтрэх эрхийг хязгаарлаж болно", "Drive leads to a successful close with our Kanban-style boards": "Драйв нь манай Канбан маягийн самбарыг амжилттай хаахад хүргэдэг", "Import": "Импортлох", "Add lead": "Хар тугалга нэмэх", @@ -2108,6 +2124,7 @@ "Verify your sending email": "Майл хаягаа баталгаажуулах", "Send test email": "Туршилтын майл илгээх", "Create deal": "Гэрээ үүсгэх", + "Create purchase": "Худалдан авалт үүсгэх", "Khowledge Base": "Мэдээллийн сан", "Create topic": "Топик үүсгэх", "Create category": "Категори үүсгэх", diff --git a/packages/core-ui/src/modules/robot/constants.ts b/packages/core-ui/src/modules/robot/constants.ts index dbc02f49a35..99c5dac81fd 100644 --- a/packages/core-ui/src/modules/robot/constants.ts +++ b/packages/core-ui/src/modules/robot/constants.ts @@ -385,7 +385,7 @@ export const ROLE_SETUP_DETAILS = { url: '/settings/boards/purchase#showBoardModal=true' }, purchasePipelinesCreate: { - name: 'Create a pipeline to be used on your board', + name: 'Create a purchase to be used on your board', url: '/settings/boards/purchase#showPipelineModal=true' }, purchaseCreate: { diff --git a/packages/plugin-cards-api/src/dashboardSchemas/PurchasesProductsData.js b/packages/plugin-cards-api/src/dashboardSchemas/PurchasesProductsData.js index 868e8eac285..f8d9a1711a6 100644 --- a/packages/plugin-cards-api/src/dashboardSchemas/PurchasesProductsData.js +++ b/packages/plugin-cards-api/src/dashboardSchemas/PurchasesProductsData.js @@ -2,14 +2,12 @@ const { tableSchema } = require('../tablePrefix'); cube(`PurchasesProductsdata`, { sql: `SELECT * FROM ${tableSchema()}.\`purchases_productsData\``, - joins: { Products: { sql: `${CUBE}.\`productsData.productId\` = ${Products}._id`, relationship: `belongsTo` } }, - measures: { productAmountSum: { sql: `${CUBE}.\`productsData.amount\``, diff --git a/packages/plugin-cards-api/src/forms.ts b/packages/plugin-cards-api/src/forms.ts index c38b2e204d5..3b4ce91b5cc 100644 --- a/packages/plugin-cards-api/src/forms.ts +++ b/packages/plugin-cards-api/src/forms.ts @@ -49,7 +49,7 @@ export default { relations: relations('cards:task') }, { - description: 'purchase pipelines', + description: 'Purchases', type: 'purchase', relations: [ ...relations('cards:purchase'), diff --git a/packages/plugin-cards-ui/src/configs.js b/packages/plugin-cards-ui/src/configs.js index ad4a47e02c7..cded2de3d65 100644 --- a/packages/plugin-cards-ui/src/configs.js +++ b/packages/plugin-cards-ui/src/configs.js @@ -33,7 +33,7 @@ module.exports = { permission: 'showDeals' }, { - text: 'Purchase Pipeline', + text: 'Purchases Pipeline', url: '/purchase', icon: 'icon-bag-alt', location: 'mainNavigation', @@ -84,7 +84,7 @@ module.exports = { ] }, { - text: 'Purchase Pipelines', + text: 'Purchases Pipelines', to: '/settings/boards/purchase', image: '/images/icons/erxes-25.png', location: 'settings', diff --git a/packages/plugin-cards-ui/src/purchases/components/CalendarColumn.tsx b/packages/plugin-cards-ui/src/purchases/components/CalendarColumn.tsx index d8f9f61ddda..4fd7c79c753 100644 --- a/packages/plugin-cards-ui/src/purchases/components/CalendarColumn.tsx +++ b/packages/plugin-cards-ui/src/purchases/components/CalendarColumn.tsx @@ -61,7 +61,7 @@ class PurchaseColumn extends React.Component { const { purchases } = this.props; if (purchases.length === 0) { - return ; + return ; } const contents = purchases.map((purchase: IPurchase, index: number) => ( diff --git a/packages/plugin-forms-ui/src/constants.ts b/packages/plugin-forms-ui/src/constants.ts index 9d7b4da8632..a76c52e8b0b 100644 --- a/packages/plugin-forms-ui/src/constants.ts +++ b/packages/plugin-forms-ui/src/constants.ts @@ -24,10 +24,10 @@ const PROPERTY_GROUPS = [ ] }, { - label: 'Purchase pipeline', + label: 'Purchases pipeline', value: 'purchase', types: [ - { value: 'purchase', label: 'Purchase pipeline' }, + { value: 'purchase', label: 'Purchases pipeline' }, { value: 'product', label: 'Products & services' } ] }, diff --git a/packages/ui-cards/src/boards/constants.ts b/packages/ui-cards/src/boards/constants.ts index 36ac73df0bf..05006b42f37 100644 --- a/packages/ui-cards/src/boards/constants.ts +++ b/packages/ui-cards/src/boards/constants.ts @@ -66,23 +66,23 @@ export const EMPTY_CONTENT_DEAL = { }; export const EMPTY_CONTENT_PURCHASE = { - title: __('Getting Started with Sales Pipeline'), + title: __('Getting Started with Purchase'), description: __( `Drive leads to a successful close with our Kanban-style boards` ), steps: [ { - title: __('Create Boards and Pipelines'), + title: __('Create Boards and purchases Pipeline'), description: `${__( - 'Track your entire sales pipeline from one dashboard' - )}${__('You can also restrict access to your sales pipelines')}`, + 'Track your entire purchases pipeline from one dashboard' + )}${__('You can also restrict access to your purchases pipelines')}`, url: '/settings/boards/purchase', - urlText: __('Go to Board & Pipeline') + urlText: __('Go to Board & purchases pipeline') }, { title: __('Tip: Choose different views'), description: __( - 'Click on “Boards, Calendar, Conversions” to filter purchases' + 'Click on “Boards, Calendar, Conversions” to filter purchases pipeline' ), icon: 'lightbulb-alt' } diff --git a/packages/ui-settings/src/constants.ts b/packages/ui-settings/src/constants.ts index e8d73239d82..c6c8137a703 100644 --- a/packages/ui-settings/src/constants.ts +++ b/packages/ui-settings/src/constants.ts @@ -343,7 +343,7 @@ export const EMPTY_CONTENT_PURCHASE_PIPELINE = { ), steps: [ { - title: __('Create your first Sales Board'), + title: __('Create your first Purchases Board'), description: __( 'Tip: This could be equivalent to your brands and/or you can organize by year/project/etc' diff --git a/plugins.js b/plugins.js index bc19018e72a..2bbab6f0304 100644 --- a/plugins.js +++ b/plugins.js @@ -328,7 +328,7 @@ window.plugins = [ ] }, { - text: 'Purchase Pipelines', + text: 'Purchases Pipelines', to: '/settings/boards/purchase', image: '/images/icons/erxes-25.png', location: 'settings', @@ -350,7 +350,7 @@ window.plugins = [ 'purchaseStagesRemove' ] }, - + { text: 'Task Pipelines', to: '/settings/boards/task', From 001ae595226a6d91a38b4b4f6de7711551d90173 Mon Sep 17 00:00:00 2001 From: soyombo <40427263+soyombo-baterdene@users.noreply.github.com> Date: Fri, 9 Jun 2023 14:30:51 +0800 Subject: [PATCH 04/24] Add-webmessenger-in-opensource-customers (#4408) --- packages/core-ui/.env.sample | 3 ++- packages/core-ui/public/index.html | 1 + .../modules/layout/components/MainLayout.tsx | 20 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/core-ui/.env.sample b/packages/core-ui/.env.sample index 5148e2ccc9a..ff6de127cbe 100644 --- a/packages/core-ui/.env.sample +++ b/packages/core-ui/.env.sample @@ -5,4 +5,5 @@ REACT_APP_CDN_HOST=http://localhost:3200 # /packages/gateway port REACT_APP_API_URL=http://localhost:4000 REACT_APP_DASHBOARD_URL=http://localhost:4300 -REACT_APP_API_SUBSCRIPTION_URL=ws://localhost:3300/subscriptions \ No newline at end of file +REACT_APP_API_SUBSCRIPTION_URL=ws://localhost:3300/subscriptions +REACT_APP_HIDE_MESSENGER= \ No newline at end of file diff --git a/packages/core-ui/public/index.html b/packages/core-ui/public/index.html index cc1da721638..1d8a4a561e6 100644 --- a/packages/core-ui/public/index.html +++ b/packages/core-ui/public/index.html @@ -49,6 +49,7 @@ processValue: '%REACT_APP_FILE_UPLOAD_MAX_SIZE%' }, { name: 'REACT_APP_APM_SERVER_URL', processValue: '%REACT_APP_APM_SERVER_URL%' }, + { name: 'REACT_APP_HIDE_MESSENGER', processValue: '%REACT_APP_HIDE_MESSENGER%' }, ]; for (var i = 0; i < window.envMaps.length; i++) { diff --git a/packages/core-ui/src/modules/layout/components/MainLayout.tsx b/packages/core-ui/src/modules/layout/components/MainLayout.tsx index 5ebc013bd59..071facd28ad 100644 --- a/packages/core-ui/src/modules/layout/components/MainLayout.tsx +++ b/packages/core-ui/src/modules/layout/components/MainLayout.tsx @@ -65,6 +65,26 @@ class MainLayout extends React.Component { }; } // end currentUser checking + if (!(window as any).env.REACT_APP_HIDE_MESSENGER) { + const userDetail = (currentUser && currentUser.details) || { + firstName: '', + lastName: '' + }; + (window as any).erxesSettings = { + messenger: { + brand_id: '5fkS4v', + email: (currentUser && currentUser.email) || '', + firstName: userDetail.firstName, + lastName: userDetail.lastName + } + }; + + const script = document.createElement('script'); + script.src = 'https://w.office.erxes.io/build/messengerWidget.bundle.js'; + const entry = document.getElementsByTagName('script')[0]; + (entry as any).parentNode.insertBefore(script, entry); + } + if (enabledServices && Object.keys(enabledServices).length !== 0) { localStorage.setItem('enabledServices', JSON.stringify(enabledServices)); } From 93ab85b7199faf5134deb7f0c47ef384e997925b Mon Sep 17 00:00:00 2001 From: munkhsaikhan Date: Sat, 10 Jun 2023 13:45:42 +0800 Subject: [PATCH 05/24] update(notifications): add index --- .../src/models/definitions/notifications.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/plugin-notifications-api/src/models/definitions/notifications.ts b/packages/plugin-notifications-api/src/models/definitions/notifications.ts index e91f3e4f53a..bba64a5ae41 100644 --- a/packages/plugin-notifications-api/src/models/definitions/notifications.ts +++ b/packages/plugin-notifications-api/src/models/definitions/notifications.ts @@ -25,11 +25,11 @@ export const notificationSchema = new Schema({ _id: field({ pkey: true }), notifType: field({ type: String, - enum: NOTIFICATION_TYPES.ALL, + enum: NOTIFICATION_TYPES.ALL }), action: field({ type: String, - optional: true, + optional: true }), title: field({ type: String }), link: field({ type: String }), @@ -41,11 +41,22 @@ export const notificationSchema = new Schema({ date: field({ type: Date, default: Date.now, + index: true }), isRead: field({ type: Boolean, default: false, - }), + index: true + }) +}); + +notificationSchema.index({ + receiver: 1, + isRead: 1, + title: 1, + notifType: 1, + contentType: 1, + date: 1 }); export interface IConfig { @@ -64,7 +75,7 @@ export const configSchema = new Schema({ user: field({ type: String }), notifType: field({ type: String, - enum: NOTIFICATION_TYPES.ALL, + enum: NOTIFICATION_TYPES.ALL }), - isAllowed: field({ type: Boolean }), + isAllowed: field({ type: Boolean }) }); From 284276a844e589d6ba5025fb3428a4bf9f5e01fe Mon Sep 17 00:00:00 2001 From: munkhsaikhan Date: Sat, 10 Jun 2023 14:42:09 +0800 Subject: [PATCH 06/24] update(cards): little --- packages/plugin-cards-api/src/models/definitions/boards.ts | 2 +- packages/ui-cards/src/boards/utils.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-cards-api/src/models/definitions/boards.ts b/packages/plugin-cards-api/src/models/definitions/boards.ts index 632388abb84..06e003b50b7 100644 --- a/packages/plugin-cards-api/src/models/definitions/boards.ts +++ b/packages/plugin-cards-api/src/models/definitions/boards.ts @@ -184,7 +184,7 @@ export const commonItemFieldsSchema = { parentId: field({ type: String, optional: true, label: 'Parent Id' }), userId: field({ type: String, optional: true, esType: 'keyword' }), createdAt: field({ type: Date, label: 'Created at', esType: 'date' }), - order: field({ type: Number }), + order: field({ type: Number, index: true }), name: field({ type: String, label: 'Name' }), startDate: field({ type: Date, label: 'Start date', esType: 'date' }), closeDate: field({ type: Date, label: 'Close date', esType: 'date' }), diff --git a/packages/ui-cards/src/boards/utils.tsx b/packages/ui-cards/src/boards/utils.tsx index 331ad8069c5..3bdd4b8963a 100644 --- a/packages/ui-cards/src/boards/utils.tsx +++ b/packages/ui-cards/src/boards/utils.tsx @@ -66,7 +66,7 @@ export const reorderItemMap = ({ const current = [...itemMap[source.droppableId]]; const next = [...itemMap[destination.droppableId]]; - let target = current[source.index]; + let target: any = current[source.index]; if (!target && source.item) { target = source.item; From 8be522732c9bc74751c0756c731db26b590fc7ee Mon Sep 17 00:00:00 2001 From: munkhsaikhan Date: Sun, 11 Jun 2023 03:17:06 +0800 Subject: [PATCH 07/24] remove branches departments for currentuser on ui --- packages/erxes-ui/src/auth/graphql.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/erxes-ui/src/auth/graphql.ts b/packages/erxes-ui/src/auth/graphql.ts index 39e6d87d21f..6ffb6fbc019 100644 --- a/packages/erxes-ui/src/auth/graphql.ts +++ b/packages/erxes-ui/src/auth/graphql.ts @@ -1,5 +1,3 @@ -import { branchField, departmentField } from '../team/graphql/queries'; - export const currentUser = ` query currentUser { currentUser { @@ -29,13 +27,7 @@ export const currentUser = ` configs configsConstants departmentIds - departments { - ${departmentField} - } branchIds - branches { - ${branchField} - } onboardingHistory { _id userId From 027e9f4c29cdb04d82723ecfc3065df9485531a6 Mon Sep 17 00:00:00 2001 From: Dulguun Otgon Date: Sun, 11 Jun 2023 20:16:29 +0800 Subject: [PATCH 08/24] stop doing core to core RPC --- packages/api-utils/src/permissions.ts | 37 +++++++++++++++--------- packages/core/src/data/resolvers/user.ts | 8 +++-- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/packages/api-utils/src/permissions.ts b/packages/api-utils/src/permissions.ts index f7a29cc34df..6bbdf550727 100644 --- a/packages/api-utils/src/permissions.ts +++ b/packages/api-utils/src/permissions.ts @@ -76,7 +76,8 @@ export const permissionWrapper = ( export const getUserActionsMap = async ( subdomain: string, - user: IUser + user: IUser, + permissionsFind?: (query: any) => any ): Promise => { const key = getKey(user); const permissionCache = await redis.get(key); @@ -86,19 +87,27 @@ export const getUserActionsMap = async ( if (permissionCache && permissionCache !== '{}') { actionMap = JSON.parse(permissionCache); } else { - const userPermissions = await sendRPCMessage('core:permissions.find', { - subdomain, - data: { - userId: user._id - } - }); - - const groupPermissions = await sendRPCMessage('core:permissions.find', { - subdomain, - data: { - groupId: { $in: user.groupIds } - } - }); + const userPermissionQuery = { + userId: user._id + }; + + const userPermissions = await (permissionsFind + ? permissionsFind(userPermissionQuery) + : sendRPCMessage('core:permissions.find', { + subdomain, + data: userPermissionQuery + })); + + const groupPermissionQuery = { + groupId: { $in: user.groupIds } + }; + + const groupPermissions = await (permissionsFind + ? permissionsFind(groupPermissionQuery) + : sendRPCMessage('core:permissions.find', { + subdomain, + data: groupPermissionQuery + })); actionMap = await userActionsMap(userPermissions, groupPermissions, user); diff --git a/packages/core/src/data/resolvers/user.ts b/packages/core/src/data/resolvers/user.ts index b12e0713e7f..5e1e9ad768f 100644 --- a/packages/core/src/data/resolvers/user.ts +++ b/packages/core/src/data/resolvers/user.ts @@ -31,8 +31,12 @@ export default { }).lean(); }, - async permissionActions(user: IUserDocument, _args, { subdomain }: IContext) { - return getUserActionsMap(subdomain, user); + async permissionActions( + user: IUserDocument, + _args, + { subdomain, models: { Permissions } }: IContext + ) { + return getUserActionsMap(subdomain, user, query => Permissions.find(query)); }, async configs(_user, _args, { models }: IContext) { From 7f89e96bfb7a680a11ce38d8c6e87c81910c704a Mon Sep 17 00:00:00 2001 From: Dulguun Otgon Date: Sun, 11 Jun 2023 22:12:21 +0800 Subject: [PATCH 09/24] enable query deduplication --- packages/erxes-ui/src/apolloClient.ts | 2 +- packages/ui-plugin-template/.erxes/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/erxes-ui/src/apolloClient.ts b/packages/erxes-ui/src/apolloClient.ts index fbe25e85c55..5471ad93fe1 100644 --- a/packages/erxes-ui/src/apolloClient.ts +++ b/packages/erxes-ui/src/apolloClient.ts @@ -74,7 +74,7 @@ const link = split( // Creating Apollo-client const client = new ApolloClient({ cache: new InMemoryCache(), - queryDeduplication: false, + queryDeduplication: true, link }); diff --git a/packages/ui-plugin-template/.erxes/package.json b/packages/ui-plugin-template/.erxes/package.json index 0379285076b..365b8f3cde8 100644 --- a/packages/ui-plugin-template/.erxes/package.json +++ b/packages/ui-plugin-template/.erxes/package.json @@ -40,6 +40,7 @@ "@apollo/client": "~3.7.14", "@types/styled-components": "^3.0.0", "dayjs": "1.8.15", + "graphql": "^15.8.0", "lodash.flowright": "3.5.0", "node-polyfill-webpack-plugin": "^2.0.1", "query-string": "^5.0.0", From b91e85c8ea0f67b9eebc7e89a33673697c9d9882 Mon Sep 17 00:00:00 2001 From: Gerelsukh <48400228+Gerelsukh@users.noreply.github.com> Date: Mon, 12 Jun 2023 10:39:59 +0800 Subject: [PATCH 10/24] fix(integration) fix required of channels field in creating integrations --- .../components/messenger/steps/Appearance.tsx | 22 +++++++++++-------- .../containers/SelectChannels.tsx | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/plugin-inbox-ui/src/settings/integrations/components/messenger/steps/Appearance.tsx b/packages/plugin-inbox-ui/src/settings/integrations/components/messenger/steps/Appearance.tsx index a06b0e0bc8d..22e9d1a3098 100644 --- a/packages/plugin-inbox-ui/src/settings/integrations/components/messenger/steps/Appearance.tsx +++ b/packages/plugin-inbox-ui/src/settings/integrations/components/messenger/steps/Appearance.tsx @@ -97,7 +97,11 @@ class Appearance extends React.Component { return ( {title} - + ); } @@ -107,22 +111,22 @@ class Appearance extends React.Component { const onChangeColor = (key, e) => onChange(key, e.hex); const popoverContent = ( - + ); const textColorContent = ( - + ); @@ -133,9 +137,9 @@ class Appearance extends React.Component { {__('Choose a background color')} @@ -146,9 +150,9 @@ class Appearance extends React.Component { {__('Choose a text color')} diff --git a/packages/ui-inbox/src/settings/integrations/containers/SelectChannels.tsx b/packages/ui-inbox/src/settings/integrations/containers/SelectChannels.tsx index cdef324cd35..84605696bf9 100644 --- a/packages/ui-inbox/src/settings/integrations/containers/SelectChannels.tsx +++ b/packages/ui-inbox/src/settings/integrations/containers/SelectChannels.tsx @@ -33,7 +33,7 @@ const SelectChannelContainer = (props: ChildProps) => { } const renderButton = ({ - passedName: name, + name, values, isSubmitted, callback From 0992af747fda3cab4ab31691c1a6b5dc0580c409 Mon Sep 17 00:00:00 2001 From: Anu-Ujin Bat-Ulzii Date: Mon, 12 Jun 2023 13:01:57 +0800 Subject: [PATCH 11/24] fix loading everywhere bug --- .../src/auth/containers/withCurrentUser.tsx | 21 ++++++------------- .../settings/channels/components/Sidebar.tsx | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/erxes-ui/src/auth/containers/withCurrentUser.tsx b/packages/erxes-ui/src/auth/containers/withCurrentUser.tsx index c4194af15d5..930704d05dd 100644 --- a/packages/erxes-ui/src/auth/containers/withCurrentUser.tsx +++ b/packages/erxes-ui/src/auth/containers/withCurrentUser.tsx @@ -1,11 +1,12 @@ -import { gql } from '@apollo/client'; import * as compose from 'lodash.flowright'; -import Spinner from '../../components/Spinner'; +import * as gq from '../graphql'; + import { storeConstantToStore, withProps } from '../../utils'; + +import { CurrentUserQueryResponse } from '../types'; import React from 'react'; +import { gql } from '@apollo/client'; import { graphql } from '@apollo/client/react/hoc'; -import * as gq from '../graphql'; -import { CurrentUserQueryResponse } from '../types'; type Props = { currentUserQuery: CurrentUserQueryResponse; @@ -16,21 +17,11 @@ const withCurrentUser = Component => { const { currentUserQuery } = props; if (currentUserQuery.loading) { - return ; + return null; } const currentUser = currentUserQuery.currentUser; - // useEffect( () => { - // currentUserQuery.subscribeToMore({ - // document: gql(gq.userChanged), - // variables: { userId: currentUser ? currentUser._id : null }, - // updateQuery: () => { - // currentUserQuery.refetch(); - // } - // }); - // }); - const updatedProps = { ...props, currentUser diff --git a/packages/plugin-inbox-ui/src/settings/channels/components/Sidebar.tsx b/packages/plugin-inbox-ui/src/settings/channels/components/Sidebar.tsx index 669eaa72633..76a484f5705 100644 --- a/packages/plugin-inbox-ui/src/settings/channels/components/Sidebar.tsx +++ b/packages/plugin-inbox-ui/src/settings/channels/components/Sidebar.tsx @@ -70,7 +70,7 @@ class Sidebar extends React.Component { hasBorder={true} header={this.renderSidebarHeader()} > - + {this.renderItems()} {loading && } From 8685ceafc1e620f3cf33453ca00eaf94e0771ce0 Mon Sep 17 00:00:00 2001 From: Nandinbold Norovsambuu Date: Mon, 12 Jun 2023 13:25:47 +0800 Subject: [PATCH 12/24] perf(client portal) improve client portal comments logic --- .../main/containers/notifications/List.tsx | 22 +++++++++---------- .../src/graphql/schema/comment.ts | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client-portal/modules/main/containers/notifications/List.tsx b/client-portal/modules/main/containers/notifications/List.tsx index 7f5a4d4d558..261c90bb0eb 100644 --- a/client-portal/modules/main/containers/notifications/List.tsx +++ b/client-portal/modules/main/containers/notifications/List.tsx @@ -1,8 +1,8 @@ -import { IUser, NotificationsQueryResponse } from "../../../types"; -import { gql, useMutation, useQuery } from "@apollo/client"; +import { IUser, NotificationsQueryResponse } from '../../../types'; +import { gql, useMutation, useQuery } from '@apollo/client'; -import NotificationList from "../../components/notifications/List"; -import React from "react"; +import NotificationList from '../../components/notifications/List'; +import React from 'react'; type Props = { count: number; @@ -62,16 +62,16 @@ function NotificationsContainer(props: Props) { const markAsRead = (ids: string[]) => { markAsReadMutaion({ variables: { - ids, - }, + ids + } }); }; const markAllAsRead = () => { markAsReadMutaion({ variables: { - markAll: true, - }, + markAll: true + } }); }; @@ -81,9 +81,9 @@ function NotificationsContainer(props: Props) { skip: !props.currentUser, variables: { page: 1, - perPage: 10, + perPage: 10 }, - fetchPolicy: "network-only", + fetchPolicy: 'network-only' } ); @@ -107,7 +107,7 @@ function NotificationsContainer(props: Props) { markAsRead, showNotifications, markAllAsRead, - refetch, + refetch }; return ; diff --git a/packages/plugin-clientportal-api/src/graphql/schema/comment.ts b/packages/plugin-clientportal-api/src/graphql/schema/comment.ts index d9d74feacd5..14fc2781c6f 100644 --- a/packages/plugin-clientportal-api/src/graphql/schema/comment.ts +++ b/packages/plugin-clientportal-api/src/graphql/schema/comment.ts @@ -8,7 +8,7 @@ export const types = ` userType: String, content: String - createdUser: JSON + createdUser: User createdAt: Date } `; From 8c46ab57f045b1bc1b303f2b4606a054715b8e2c Mon Sep 17 00:00:00 2001 From: Ariunzaya <91462097+ariunzayarin@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:40:41 +0800 Subject: [PATCH 13/24] add isEnabled (#4453) --- .../src/inbox/components/InboxCore.tsx | 13 --- .../src/inbox/containers/EmailWidget.tsx | 9 +- .../integrations/components/mail/MailForm.tsx | 63 ++++++------ .../integrations/components/mail/styles.ts | 2 + .../integrations/containers/mail/MailForm.tsx | 98 ++++++++++--------- 5 files changed, 89 insertions(+), 96 deletions(-) diff --git a/packages/plugin-inbox-ui/src/inbox/components/InboxCore.tsx b/packages/plugin-inbox-ui/src/inbox/components/InboxCore.tsx index b87282e1493..29e2d00f81b 100644 --- a/packages/plugin-inbox-ui/src/inbox/components/InboxCore.tsx +++ b/packages/plugin-inbox-ui/src/inbox/components/InboxCore.tsx @@ -41,25 +41,12 @@ class Inbox extends React.Component { /> ); - const sendEmail = ( - {__('Send an Email')}} - size="lg" - content={content} - paddingContent="less-padding" - enforceFocus={false} - /> - ); - return (
{ <> - showWidget()} /> + showWidget()} /> @@ -55,12 +55,7 @@ const WidgetContainer = () => { onClose()} /> - + ); diff --git a/packages/ui-inbox/src/settings/integrations/components/mail/MailForm.tsx b/packages/ui-inbox/src/settings/integrations/components/mail/MailForm.tsx index 7233213ca50..fa1afe5da73 100644 --- a/packages/ui-inbox/src/settings/integrations/components/mail/MailForm.tsx +++ b/packages/ui-inbox/src/settings/integrations/components/mail/MailForm.tsx @@ -37,7 +37,7 @@ import Tip from '@erxes/ui/src/components/Tip'; import dayjs from 'dayjs'; import { generateEmailTemplateParams } from '@erxes/ui-engage/src/utils'; import Uploader from '@erxes/ui/src/components/Uploader'; -import { readFile } from '@erxes/ui/src/utils/core'; +import { isEnabled, readFile } from '@erxes/ui/src/utils/core'; type Props = { emailTemplates: any[] /*change type*/; @@ -662,23 +662,33 @@ class MailForm extends React.Component { return ( - - - - - - - - {this.renderIcon({ - text: 'Delete', - icon: 'trash-alt', - onClick: toggleReply - })} +
+ {this.renderSubmit('Send', this.onSubmit, 'primary')} + {isReply && + this.renderSubmit( + 'Send and Resolve', + onSubmitResolve, + 'success', + 'check-circle' + )} +
+ + + + + + + {this.renderIcon({ + text: 'Delete', + icon: 'trash-alt', + onClick: toggleReply + })} + {isEnabled('emailtemplates') && ( { targets={generateEmailTemplateParams(emailTemplates || [])} history={history} /> - -
- {this.renderSubmit('Send', this.onSubmit, 'primary')} - {isReply && - this.renderSubmit( - 'Send and Resolve', - onSubmitResolve, - 'success', - 'check-circle' - )} -
-
+ )} +
); } @@ -734,7 +734,8 @@ class MailForm extends React.Component { toolbarLocation="bottom" autoFocus={!this.props.isForward} autoGrow={true} - autoGrowMinHeight={120} + autoGrowMinHeight={300} + autoGrowMaxHeight={300} /> ); diff --git a/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts b/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts index 060c148b5b4..5b6dffb2413 100644 --- a/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts +++ b/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts @@ -92,6 +92,8 @@ const Resipients = styledTS<{ isActive?: boolean }>(styled.a)` const EditorFooter = styled.div` padding: ${dimensions.unitSpacing}px ${dimensions.coreSpacing}px; + display: flex; + gap: 15px; `; const Attachments = styled.div` diff --git a/packages/ui-inbox/src/settings/integrations/containers/mail/MailForm.tsx b/packages/ui-inbox/src/settings/integrations/containers/mail/MailForm.tsx index 1030d938549..540493504a3 100644 --- a/packages/ui-inbox/src/settings/integrations/containers/mail/MailForm.tsx +++ b/packages/ui-inbox/src/settings/integrations/containers/mail/MailForm.tsx @@ -17,6 +17,7 @@ import withCurrentUser from '@erxes/ui/src/auth/containers/withCurrentUser'; import queryString from 'query-string'; import { IRouterProps } from '@erxes/ui/src/types'; import { withRouter } from 'react-router-dom'; +import { isEnabled } from '@erxes/ui/src/utils/core'; type Props = { detailQuery?: any; @@ -90,53 +91,58 @@ class MailFormContainer extends React.Component< } = this.state; if (!loadedEmails) { - client - .query({ - query: gql(engageQueries.verifiedEmails) - }) - .then(({ data }) => { - this.setState({ - loadedEmails: true, - verifiedEngageEmails: data.engageVerifiedEmails || [] + if (isEnabled('engages')) { + client + .query({ + query: gql(engageQueries.verifiedEmails) + }) + .then(({ data }) => { + this.setState({ + loadedEmails: true, + verifiedEngageEmails: data.engageVerifiedEmails || [] + }); + }) + .catch(() => { + this.setState({ loadedEmails: true, verifiedEngageEmails: [] }); }); - }) - .catch(() => { - this.setState({ loadedEmails: true, verifiedEngageEmails: [] }); - }); - client - .query({ - query: gql(queries.imapIntegrations), - variables: { - kind: 'imap' - } - }) - .then(({ data }) => { - const emails: string[] = []; - - for (const integration of data.imapGetIntegrations || []) { - if (integration.user && !emails.includes(integration.user)) { - emails.push(integration.user); + } + if (isEnabled('imap')) { + client + .query({ + query: gql(queries.imapIntegrations), + variables: { + kind: 'imap' } - - if ( - integration.mainUser && - !emails.includes(integration.mainUser) - ) { - emails.push(integration.mainUser); + }) + .then(({ data }) => { + const emails: string[] = []; + + for (const integration of data.imapGetIntegrations || []) { + if (integration.user && !emails.includes(integration.user)) { + emails.push(integration.user); + } + + if ( + integration.mainUser && + !emails.includes(integration.mainUser) + ) { + emails.push(integration.mainUser); + } } - } - this.setState({ - loadedEmails: true, - verifiedImapEmails: emails + this.setState({ + loadedEmails: true, + verifiedImapEmails: emails + }); + }) + .catch(() => { + this.setState({ loadedEmails: true, verifiedImapEmails: [] }); }); - }) - .catch(() => { - this.setState({ loadedEmails: true, verifiedImapEmails: [] }); - }); + } } - const { emailTemplatesTotalCount } = emailTemplatesTotalCountQuery; + const { emailTemplatesTotalCount } = + emailTemplatesTotalCountQuery || ({} as any); const fetchMoreEmailTemplates = (page: number) => { const { fetchMore, emailTemplates } = emailTemplatesQuery; @@ -250,13 +256,13 @@ class MailFormContainer extends React.Component< sendMail, currentUser, fetchMoreEmailTemplates, - emailTemplates: emailTemplatesQuery.emailTemplates, + emailTemplates: emailTemplatesQuery?.emailTemplates || [], emailSignatures: currentUser.emailSignatures || [], totalCount: emailTemplatesTotalCount, mails, messageId, - verifiedImapEmails, - verifiedEngageEmails + verifiedImapEmails: verifiedImapEmails || [], + verifiedEngageEmails: verifiedEngageEmails || [] }; return ; @@ -272,7 +278,8 @@ const WithMailForm = withProps( searchValue: queryParams.emailTemplatesSearch || '' }, fetchPolicy: 'network-only' - }) + }), + skip: !isEnabled('emailtemplates') }), graphql(gql(queries.templateTotalCount), { name: 'emailTemplatesTotalCountQuery', @@ -281,7 +288,8 @@ const WithMailForm = withProps( searchValue: queryParams.emailTemplatesSearch || '' }, fetchPolicy: 'network-only' - }) + }), + skip: !isEnabled('emailtemplates') }) )(withCurrentUser(MailFormContainer)) ); From 68d2e23f03e1cf426df07e89b4ea205ce7aa72e5 Mon Sep 17 00:00:00 2001 From: Ariunzaya <91462097+ariunzayarin@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:10:50 +0800 Subject: [PATCH 14/24] fix(nav): more button style (#4455) --- packages/core-ui/src/modules/layout/styles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core-ui/src/modules/layout/styles.ts b/packages/core-ui/src/modules/layout/styles.ts index bb20e33977f..4350e126223 100644 --- a/packages/core-ui/src/modules/layout/styles.ts +++ b/packages/core-ui/src/modules/layout/styles.ts @@ -463,7 +463,7 @@ const NavItem = styledTS<{ isMoreItem?: boolean }>(styled.div)` } } - @media screen and (max-height: 870px){ + @media screen and (max-height: 720px){ &.more-2 { position: fixed; bottom: 160px; From b40e3a6fa66f6f69e9672e750bc6df947f6ddbbe Mon Sep 17 00:00:00 2001 From: Ariunzaya <91462097+ariunzayarin@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:26:36 +0800 Subject: [PATCH 15/24] fix email widget shrink (#4456) --- .../src/inbox/containers/EmailWidget.tsx | 23 +++++++++++++------ .../integrations/components/mail/styles.ts | 7 +++++- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/plugin-inbox-ui/src/inbox/containers/EmailWidget.tsx b/packages/plugin-inbox-ui/src/inbox/containers/EmailWidget.tsx index 3718356498c..b502d1c649b 100644 --- a/packages/plugin-inbox-ui/src/inbox/containers/EmailWidget.tsx +++ b/packages/plugin-inbox-ui/src/inbox/containers/EmailWidget.tsx @@ -8,18 +8,25 @@ import { __ } from '@erxes/ui/src/utils'; import { NewEmailHeader } from '@erxes/ui-inbox/src/settings/integrations/components/mail/styles'; const WidgetContainer = () => { - const [shrink, setShrink] = useState(false); + const [shrink, setShrink] = useState( + localStorage.getItem('emailWidgetShrink') || 'false' + ); const [show, setShow] = useState(true); const [clear, setClear] = useState(false); const changeShrink = () => { - setShrink(!shrink); + setShrink(shrink === 'true' ? 'false' : 'true'); + localStorage.setItem( + 'emailWidgetShrink', + shrink === 'true' ? 'false' : 'true' + ); }; const hideWidget = () => { setTimeout(() => { setShow(true); - setShrink(false); + setShrink('false'); + localStorage.setItem('emailWidgetShrink', 'false'); }, 10); localStorage.setItem('emailWidgetShow', 'false'); @@ -31,14 +38,16 @@ const WidgetContainer = () => { }; const showWidget = () => { - setShrink(false); + setShrink('false'); setShow(!show); setClear(false); + localStorage.setItem('emailWidgetShrink', 'false'); localStorage.setItem('emailWidgetShow', show ? 'true' : 'false'); }; const isWidgetShow = localStorage.getItem('emailWidgetShow'); + const isShrink = shrink === 'true' ? true : false; return ( <> @@ -48,14 +57,14 @@ const WidgetContainer = () => { - + {__('New Email')}
- + onClose()} />
- +
); diff --git a/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts b/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts index 5b6dffb2413..cdd5daa23d5 100644 --- a/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts +++ b/packages/ui-inbox/src/settings/integrations/components/mail/styles.ts @@ -259,7 +259,12 @@ const NewEmailHeader = styledTS<{ shrink: boolean }>(styled.h5)` width: ${props => (props.shrink ? '260px' : '600px')}; i { - margin-left: ${dimensions.unitSpacing}px; + margin-left: 5px; + padding: 5px; + + &:hover { + background: ${colors.bgGray}; + } } `; From 7fbf80acf3788667a05ed57dc1fc1bf6bf3c96dc Mon Sep 17 00:00:00 2001 From: Ariunzaya Date: Mon, 12 Jun 2023 16:22:54 +0800 Subject: [PATCH 16/24] add comment from team --- .../modules/card/components/Detail.tsx | 6 +- client-portal/modules/card/graphql/queries.ts | 12 +++- .../src/comment/components/Comment.tsx | 23 ++++--- .../ui-cards/src/comment/graphql/queries.ts | 12 +++- .../ui-internalnotes/src/containers/Form.tsx | 66 +++++++++++++++---- packages/ui-internalnotes/src/types.ts | 13 ++++ .../components/ActivityInputs.tsx | 19 +++++- 7 files changed, 125 insertions(+), 26 deletions(-) diff --git a/client-portal/modules/card/components/Detail.tsx b/client-portal/modules/card/components/Detail.tsx index 8a438c3e327..85071c6df9b 100644 --- a/client-portal/modules/card/components/Detail.tsx +++ b/client-portal/modules/card/components/Detail.tsx @@ -83,7 +83,11 @@ export default class CardDetail extends React.Component< />
-
{`${createdUser?.firstName} ${createdUser?.lastName}`}
+
+ {createdUser && createdUser.details + ? createdUser.details.fullName || createdUser.username + : createdUser.email || "Undefined"} +
- + {__('Comments')} @@ -64,15 +65,22 @@ function Comment(item) { profile
-
{`${createdUser?.firstName} ${createdUser?.lastName}`}
+
+ {createdUser && createdUser.details + ? createdUser.details.fullName || + createdUser.username + : createdUser.email || 'Undefined'} +
-
); diff --git a/packages/ui-cards/src/comment/graphql/queries.ts b/packages/ui-cards/src/comment/graphql/queries.ts index 04b465a1c40..1c3b7fd208c 100644 --- a/packages/ui-cards/src/comment/graphql/queries.ts +++ b/packages/ui-cards/src/comment/graphql/queries.ts @@ -3,7 +3,17 @@ const clientPortalComments = ` clientPortalComments(typeId: $typeId, type: $type) { _id content - createdUser + createdUser { + _id + details { + avatar + firstName + fullName + lastName + } + email + username + } createdAt userType type diff --git a/packages/ui-internalnotes/src/containers/Form.tsx b/packages/ui-internalnotes/src/containers/Form.tsx index 8726e93e7b4..c57f2be8a17 100644 --- a/packages/ui-internalnotes/src/containers/Form.tsx +++ b/packages/ui-internalnotes/src/containers/Form.tsx @@ -4,17 +4,23 @@ import React from 'react'; import { graphql } from '@apollo/client/react/hoc'; import Form from '../components/Form'; import { mutations } from '../graphql'; +import { mutations as commentMutations } from '@erxes/ui-cards/src/comment/graphql'; import { InternalNotesAddMutationResponse, - InternalNotesAddMutationVariables + InternalNotesAddMutationVariables, + CommentAddMutationResponse, + CommentAddMutationVariables } from '../types'; type Props = { contentType: string; contentTypeId: string; + inputType?: string; }; -type FinalProps = Props & InternalNotesAddMutationResponse; +type FinalProps = Props & + InternalNotesAddMutationResponse & + CommentAddMutationResponse; class FormContainer extends React.Component< FinalProps, @@ -28,21 +34,42 @@ class FormContainer extends React.Component< // create internalNote create = (variables, callback: () => void) => { - const { contentType, contentTypeId, internalNotesAdd } = this.props; + const { + contentType, + contentTypeId, + internalNotesAdd, + commentAdd, + inputType + } = this.props; this.setState({ isLoading: true }); - internalNotesAdd({ - variables: { - contentType, - contentTypeId, - ...variables - } - }).then(() => { - callback(); + if (inputType === 'comment') { + commentAdd({ + variables: { + type: contentType.slice(6), + typeId: contentTypeId, + userType: 'team', + ...variables + } + }).then(() => { + callback(); + + this.setState({ isLoading: false }); + }); + } else { + internalNotesAdd({ + variables: { + contentType, + contentTypeId, + ...variables + } + }).then(() => { + callback(); - this.setState({ isLoading: false }); - }); + this.setState({ isLoading: false }); + }); + } }; render() { @@ -71,5 +98,16 @@ export default compose( refetchQueries: ['activityLogs'] }; } - }) + }), + graphql( + gql(commentMutations.clientPortalCommentsAdd), + { + name: 'commentAdd', + options: () => { + return { + refetchQueries: ['activityLogs'] + }; + } + } + ) )(FormContainer); diff --git a/packages/ui-internalnotes/src/types.ts b/packages/ui-internalnotes/src/types.ts index af3d290057a..e4419f9ca53 100644 --- a/packages/ui-internalnotes/src/types.ts +++ b/packages/ui-internalnotes/src/types.ts @@ -20,6 +20,13 @@ export type InternalNotesAddMutationVariables = { mentionedUserIds: string[]; }; +export type CommentAddMutationVariables = { + typeId: string; + type: string; + content: string; + userType: string; +}; + export type InternalNotesEditMutationResponse = ({ variables: InternalNotesEditMutationVariables }) => Promise; @@ -30,6 +37,12 @@ export type InternalNotesAddMutationResponse = { }) => Promise; }; +export type CommentAddMutationResponse = { + commentAdd: (params: { + variables: InternalNotesAddMutationVariables; + }) => Promise; +}; + export type InternalNotesRemoveMutationResponse = { internalNotesRemove: (params: { variables: { _id: string } }) => Promise; }; diff --git a/packages/ui-log/src/activityLogs/components/ActivityInputs.tsx b/packages/ui-log/src/activityLogs/components/ActivityInputs.tsx index d734b835e12..5ef957a9746 100644 --- a/packages/ui-log/src/activityLogs/components/ActivityInputs.tsx +++ b/packages/ui-log/src/activityLogs/components/ActivityInputs.tsx @@ -35,7 +35,11 @@ class ActivityInputs extends React.PureComponent { super(props); this.state = { - currentTab: 'newNote' + currentTab: isEnabled('internalnotes') + ? 'newNote' + : isEnabled('clientportal') + ? 'newComment' + : '' }; } @@ -53,6 +57,16 @@ class ActivityInputs extends React.PureComponent { ); } + if (currentTab === 'newComment' && isEnabled('clientportal')) { + return ( + + ); + } + if (currentTab === 'ticket' && isEnabled('cards')) { return ( { {isEnabled('internalnotes') && this.renderTabTitle('newNote', 'file-plus', 'New note')} + {isEnabled('clientportal') && + this.renderTabTitle('newComment', 'comment-plus', 'New comment')} + {this.renderExtraTab()} From 66d3c9b967a31aefedb6551786f4585eb4fd63e7 Mon Sep 17 00:00:00 2001 From: nandinboldn Date: Mon, 12 Jun 2023 17:29:43 +0800 Subject: [PATCH 17/24] see user details --- .../modules/card/components/Detail.tsx | 18 +++++++++--------- client-portal/modules/card/graphql/queries.ts | 10 ++++------ .../src/graphql/resolvers/comment.ts | 8 ++++++-- .../src/graphql/schema/clientPortalUser.ts | 1 + .../src/graphql/schema/comment.ts | 2 +- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/client-portal/modules/card/components/Detail.tsx b/client-portal/modules/card/components/Detail.tsx index 85071c6df9b..fc00ee317c1 100644 --- a/client-portal/modules/card/components/Detail.tsx +++ b/client-portal/modules/card/components/Detail.tsx @@ -11,7 +11,7 @@ import { FlexRow, Label, TicketComment, - TicketDetailContent, + TicketDetailContent } from "../../styles/cards"; import { getUserAvatar, renderUserFullName } from "../../utils"; @@ -46,11 +46,11 @@ export default class CardDetail extends React.Component< super(props); this.state = { - content: "", + content: "" }; } - handleChange = (e) => { + handleChange = e => { this.setState({ content: e.target.value }); }; @@ -67,7 +67,7 @@ export default class CardDetail extends React.Component< renderComments(comments) { return ( - {comments.map((comment) => { + {comments.map(comment => { const { createdUser = {} } = comment; return ( @@ -84,8 +84,8 @@ export default class CardDetail extends React.Component<
- {createdUser && createdUser.details - ? createdUser.details.fullName || createdUser.username + {createdUser + ? createdUser.fullName || createdUser.username : createdUser.email || "Undefined"}
{__("No one`s assigned yet")}; } - return assignedUsers.map((user) => ( + return assignedUsers.map(user => ( {renderUserFullName(user)}No labels at the moment! ) : ( - (labels || []).map((label) => ( + (labels || []).map(label => (