@zenify-omni/chat-ui-react-js 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +92 -0
- package/assets/asset-url.js +6 -0
- package/assets/icons/chatter_agent.js +27 -0
- package/assets/icons/chatter_chatbot.js +43 -0
- package/assets/icons/chatter_contact.js +36 -0
- package/assets/icons/email_icon.png +0 -0
- package/assets/icons/emoji/angry.svg +56 -0
- package/assets/icons/emoji/haha.svg +20 -0
- package/assets/icons/emoji/like.svg +10 -0
- package/assets/icons/emoji/like_out_line.png +0 -0
- package/assets/icons/emoji/love.svg +10 -0
- package/assets/icons/emoji/sad.svg +46 -0
- package/assets/icons/emoji/wow.svg +51 -0
- package/assets/icons/instagram.js +29 -0
- package/assets/icons/not_found.png +0 -0
- package/assets/icons/not_found_template.svg +9 -0
- package/assets/icons/phone_icon.png +0 -0
- package/assets/icons/shopee.js +17 -0
- package/assets/icons/sms_icon.png +0 -0
- package/assets/icons/tiktok.js +17 -0
- package/assets/icons/whatsapp.js +28 -0
- package/assets/icons/zalo.js +17 -0
- package/assets/icons/zalo_icon.png +0 -0
- package/assets/icons/zns_icon.png +0 -0
- package/assets/images/emoji.webp +0 -0
- package/assets/images/error.png +0 -0
- package/assets/images/menu.png +0 -0
- package/assets/images/money.png +0 -0
- package/assets/images/success.png +0 -0
- package/assets/public-urls.js +78 -0
- package/components/campaign-detail-route/select/group.js +38 -0
- package/components/campaign-detail-route/select/multi-groups.js +43 -0
- package/components/chat-route/chat-box/ads-context-card.js +143 -0
- package/components/chat-route/chat-box/chat-drop-file.js +18 -0
- package/components/chat-route/chat-box/chat-feedback/chat-insight.js +214 -0
- package/components/chat-route/chat-box/chat-feedback/index.js +127 -0
- package/components/chat-route/chat-box/chat-header-actions-inline.js +1055 -0
- package/components/chat-route/chat-box/chat-header.js +465 -0
- package/components/chat-route/chat-box/chat-input.js +1164 -0
- package/components/chat-route/chat-box/chat-message-action.js +399 -0
- package/components/chat-route/chat-box/chat-message-list.js +995 -0
- package/components/chat-route/chat-box/chat-message.js +2099 -0
- package/components/chat-route/chat-box/chat-reply-preview.js +317 -0
- package/components/chat-route/chat-box/common-groups-modal.js +430 -0
- package/components/chat-route/chat-box/constants.js +29 -0
- package/components/chat-route/chat-box/contact-card/index.js +87 -0
- package/components/chat-route/chat-box/edit-customer-alias-dialog.js +197 -0
- package/components/chat-route/chat-box/emoji-picker-combined.js +91 -0
- package/components/chat-route/chat-box/emoji-sprite.js +45 -0
- package/components/chat-route/chat-box/emojiMap.js +92 -0
- package/components/chat-route/chat-box/facebook-reconnect-notice.js +49 -0
- package/components/chat-route/chat-box/forward-message-modal.js +659 -0
- package/components/chat-route/chat-box/index.js +165 -0
- package/components/chat-route/chat-box/message-time.js +44 -0
- package/components/chat-route/chat-box/message-viewers.js +114 -0
- package/components/chat-route/chat-box/pasted-file-preview.js +138 -0
- package/components/chat-route/chat-box/pinned-messages.js +255 -0
- package/components/chat-route/chat-box/react-message/react-preview.js +83 -0
- package/components/chat-route/chat-box/react-message/reaction-button.js +200 -0
- package/components/chat-route/chat-box/right-side/chat-history.js +142 -0
- package/components/chat-route/chat-box/right-side/chat-tag-selector.js +232 -0
- package/components/chat-route/chat-box/right-side/create-personal-tag-modal.js +458 -0
- package/components/chat-route/chat-box/right-side/customer/customer-info-item.js +60 -0
- package/components/chat-route/chat-box/right-side/in-room-dialog.js +225 -0
- package/components/chat-route/chat-box/right-side/zalo-group/add-friend-dialog.js +154 -0
- package/components/chat-route/chat-box/right-side/zalo-group/send-message-dialog.js +165 -0
- package/components/chat-route/chat-box/send-contact-card-modal.js +102 -0
- package/components/chat-route/chat-box/send-contact-card.js +80 -0
- package/components/chat-route/chat-box/text-content.js +400 -0
- package/components/chat-route/chat-box/use-facebook-page-invalid.js +22 -0
- package/components/chat-route/chat-box/zalo-emoji-decoration.js +98 -0
- package/components/chat-route/chat-box/zalo-emoji-picker.js +74 -0
- package/components/chat-route/chat-box/zalo-personal-editor.js +590 -0
- package/components/chat-route/chat-box/zalo-reminder/create-zalo-reminder.js +868 -0
- package/components/chat-route/chat-box/zalo-reminder/use-send-zalo-reminder.js +98 -0
- package/components/chat-route/chat-box/zalo-reminder/zalo-reminder-content.js +294 -0
- package/components/chat-route/chat-box/zalo-rtf-utils.js +422 -0
- package/components/chat-route/chat-list/action-chat-item.js +116 -0
- package/components/chat-route/chat-list/assign-agent-dialog.js +170 -0
- package/components/chat-route/chat-list/assign-tag-dialog.js +242 -0
- package/components/chat-route/chat-list/chat-item-tags.js +105 -0
- package/components/chat-route/chat-list/chat-item.js +749 -0
- package/components/chat-route/chat-list/chat-list-item.js +370 -0
- package/components/chat-route/chat-list/chat-list-selection-bar.js +426 -0
- package/components/chat-route/chat-list/chat-search-preview.js +48 -0
- package/components/chat-route/chat-list/chat-sort-menu.js +89 -0
- package/components/chat-route/chat-list/edit-filter-modal.js +468 -0
- package/components/chat-route/chat-list/filter-chat-sources.js +222 -0
- package/components/chat-route/chat-list/filter-chat.js +501 -0
- package/components/chat-route/chat-list/filter-criteria-rows.js +845 -0
- package/components/chat-route/chat-list/filter-group-select.js +66 -0
- package/components/chat-route/chat-list/filter-pin-menu.js +165 -0
- package/components/chat-route/chat-list/friend-request/list-friend-request.js +287 -0
- package/components/chat-route/chat-list/index.js +243 -0
- package/components/chat-route/chat-list/inline-search-results.js +178 -0
- package/components/chat-route/chat-list/post-ids-field.js +104 -0
- package/components/chat-route/chat-list/quick-filter-bar.js +391 -0
- package/components/chat-route/chat-list/save-filter-popover.js +258 -0
- package/components/chat-route/chat-list/search-messages/index.js +225 -0
- package/components/chat-route/chat-list/search-result-header.js +51 -0
- package/components/chat-route/chat-list/util.js +604 -0
- package/components/chat-route/chat-toolbar.js +108 -0
- package/components/chat-route/hooks/use-reassign.js +111 -0
- package/components/chat-route/shared/close-conversation-dialog.js +111 -0
- package/components/chat-route/shared/force-transfer-dialog.js +109 -0
- package/components/chat-route/shared/in-queue-confirm-dialog.js +40 -0
- package/components/chat-route/util.js +146 -0
- package/components/chat-route/zalo/modal-action-zalo.js +76 -0
- package/components/chat-route/zalo/modal-add-friend-zalo.js +277 -0
- package/components/custom/SafeHTML.js +45 -0
- package/components/custom/audio-player.js +81 -0
- package/components/custom/avatar.js +95 -0
- package/components/custom/between-date-picker/index.js +86 -0
- package/components/custom/button-close.js +28 -0
- package/components/custom/button.js +80 -0
- package/components/custom/color-picker.js +81 -0
- package/components/custom/combobox.js +168 -0
- package/components/custom/custom-dialog.js +44 -0
- package/components/custom/custom-select.js +256 -0
- package/components/custom/cycle-value-helpers.js +11 -0
- package/components/custom/cycle-value.js +93 -0
- package/components/custom/date-time-picker/components/date-time-group.js +44 -0
- package/components/custom/date-time-picker/components/date-time-input.js +383 -0
- package/components/custom/date-time-picker/components/date-time-unit-input.js +138 -0
- package/components/custom/date-time-picker/components/month-year-picker.js +232 -0
- package/components/custom/date-time-picker/hooks/use-merge-refs.js +18 -0
- package/components/custom/date-time-picker/hooks/use-scroll-to-center.js +18 -0
- package/components/custom/date-time-picker/index.js +348 -0
- package/components/custom/field-file-upload/files-upload.js +87 -0
- package/components/custom/field-file-upload/image-upload.js +115 -0
- package/components/custom/field-file-upload/preview-images-modal.js +284 -0
- package/components/custom/field-file-upload/preview-list-file.js +134 -0
- package/components/custom/field-file-upload/preview-list-image.js +108 -0
- package/components/custom/field-file-upload/upload-custom.js +222 -0
- package/components/custom/field-generator.js +639 -0
- package/components/custom/field-layout-popover.js +304 -0
- package/components/custom/file-preview-modal.js +351 -0
- package/components/custom/html-edtior.js +100 -0
- package/components/custom/icon.js +49 -0
- package/components/custom/infinite-scroll-combobox.js +253 -0
- package/components/custom/inline-edit-popover.js +90 -0
- package/components/custom/inputs/calendar-input.js +0 -0
- package/components/custom/inputs/chip-input.js +136 -0
- package/components/custom/inputs/file-input.js +71 -0
- package/components/custom/inputs/mask-data/mask-data-input.js +80 -0
- package/components/custom/inputs/mask-data/mask-data-select.js +78 -0
- package/components/custom/inputs/mask-data/mask-data-textarea.js +75 -0
- package/components/custom/inputs/mask-data/reconcile-masked-edit.js +20 -0
- package/components/custom/jxl-decode.js +34 -0
- package/components/custom/jxl-image.js +68 -0
- package/components/custom/jxl-worker.js +12 -0
- package/components/custom/label.js +55 -0
- package/components/custom/layout.js +30 -0
- package/components/custom/multi-select-search-cc.js +179 -0
- package/components/custom/multiple-select-setting-tags.js +404 -0
- package/components/custom/multiple-selector.js +821 -0
- package/components/custom/pagination.js +95 -0
- package/components/custom/popup-confirm.js +120 -0
- package/components/custom/previews/facebook/facebook-appointment-booking-preview.js +83 -0
- package/components/custom/previews/facebook/facebook-audio-preview.js +130 -0
- package/components/custom/previews/facebook/facebook-event-preview.js +72 -0
- package/components/custom/previews/facebook/facebook-file-preview.js +95 -0
- package/components/custom/previews/facebook/facebook-group-preview.js +103 -0
- package/components/custom/previews/facebook/facebook-image-preview.js +81 -0
- package/components/custom/previews/facebook/facebook-page-preview.js +85 -0
- package/components/custom/previews/facebook/facebook-post-preview.js +77 -0
- package/components/custom/previews/facebook/facebook-reel-preview.js +83 -0
- package/components/custom/previews/facebook/facebook-sticker-preview.js +23 -0
- package/components/custom/previews/facebook/facebook-video-preview.js +114 -0
- package/components/custom/previews/facebook/index.js +24 -0
- package/components/custom/previews/file-preview.js +747 -0
- package/components/custom/previews/image-preview.js +288 -0
- package/components/custom/previews/instagram/index.js +4 -0
- package/components/custom/previews/instagram/instagram-share-post-preview.js +77 -0
- package/components/custom/previews/link-preview.js +166 -0
- package/components/custom/previews/product-preview.js +334 -0
- package/components/custom/previews/tiktok-order-preview.js +278 -0
- package/components/custom/previews/tiktok-product-preview.js +321 -0
- package/components/custom/previews/tiktok-voucher-preview.js +151 -0
- package/components/custom/previews/whatsapp/index.js +10 -0
- package/components/custom/previews/whatsapp/whatsapp-contact-card-preview.js +150 -0
- package/components/custom/previews/whatsapp/whatsapp-order-preview.js +38 -0
- package/components/custom/previews/whatsapp/whatsapp-poll-preview.js +29 -0
- package/components/custom/previews/whatsapp/whatsapp-product-preview.js +29 -0
- package/components/custom/retry-image.js +44 -0
- package/components/custom/search-input.js +26 -0
- package/components/custom/separator-with-text.js +14 -0
- package/components/custom/showToast.js +21 -0
- package/components/custom/sortable-header.js +62 -0
- package/components/custom/table-resize-line.js +92 -0
- package/components/custom/time-picker/index.js +73 -0
- package/components/custom/time-picker/time-picker-input.js +159 -0
- package/components/custom/time-picker/time-picker-utils.js +152 -0
- package/components/custom/viewers/audio-player.js +192 -0
- package/components/custom/viewers/code-viewer.js +140 -0
- package/components/custom/viewers/csv-viewer.js +174 -0
- package/components/custom/viewers/docx-viewer.js +145 -0
- package/components/custom/viewers/image-viewer.js +104 -0
- package/components/custom/viewers/markdown-viewer.js +124 -0
- package/components/custom/viewers/pdf-viewer.js +333 -0
- package/components/custom/viewers/spreadsheet-viewer.js +232 -0
- package/components/custom/viewers/unsupported-viewer.js +85 -0
- package/components/custom/viewers/video-player.js +241 -0
- package/components/customers-route/change-owner-modal.js +430 -0
- package/components/customers-route/contact-note-button.js +212 -0
- package/components/customers-route/customer-source.js +37 -0
- package/components/customers-route/table/columns.js +675 -0
- package/components/customers-route/table/edit-fields.js +125 -0
- package/components/customers-route/table/editable-cell.js +218 -0
- package/components/customers-route/table/note-cell.js +77 -0
- package/components/dialogs/invite-agent.js +677 -0
- package/components/error-boundary.js +53 -0
- package/components/leads-route/duplicate-phone-warning-toast.js +96 -0
- package/components/leads-route/table/columns.js +523 -0
- package/components/leads-route/table/contact-cell-name.js +82 -0
- package/components/leads-route/table/edit-fields.js +142 -0
- package/components/leads-route/table/editable-cell.js +228 -0
- package/components/org-tree/group-name-display.js +36 -0
- package/components/org-tree/group-tree-multi-select.js +208 -0
- package/components/org-tree/group-tree-select.js +220 -0
- package/components/posts-route/dialog-select-posts.js +284 -0
- package/components/reports-route/agents/multi-select-agents.js +55 -0
- package/components/reports-route/agents/multi-select-search-agents.js +43 -0
- package/components/settings-route/chat-layout/detail/constants.js +353 -0
- package/components/settings-route/chat-layout/detail/form.js +43 -0
- package/components/settings-route/chat-timeout/channel-multi-select.js +119 -0
- package/components/settings-route/multi-channel/facebook/hooks/use-facebook-sdk.js +3 -0
- package/components/settings-route/object-rule/util.js +79 -0
- package/components/settings-route/routing/settings-dialog.js +561 -0
- package/components/settings-route/switchboard/queue-new/constant.js +9 -0
- package/components/shared/linked-customer-fields/LinkedCustomerFields.js +91 -0
- package/components/shared/linked-customer-fields/use-linked-customer-fields.js +123 -0
- package/components/smartqc-route/qc-form/controls/multi-select-search-agents.js +50 -0
- package/components/ui/alert-dialog.js +112 -0
- package/components/ui/avatar.js +44 -0
- package/components/ui/badge.js +54 -0
- package/components/ui/button.js +48 -0
- package/components/ui/calendar.js +70 -0
- package/components/ui/card.js +58 -0
- package/components/ui/carousel.js +238 -0
- package/components/ui/checkbox.js +27 -0
- package/components/ui/command.js +111 -0
- package/components/ui/context-menu.js +154 -0
- package/components/ui/dialog.js +104 -0
- package/components/ui/dropdown-menu.js +169 -0
- package/components/ui/form.js +104 -0
- package/components/ui/input.js +115 -0
- package/components/ui/label.js +20 -0
- package/components/ui/popover.js +29 -0
- package/components/ui/radio-group.js +53 -0
- package/components/ui/scroll-area.js +38 -0
- package/components/ui/select.js +147 -0
- package/components/ui/separator.js +24 -0
- package/components/ui/sheet.js +113 -0
- package/components/ui/skeleton.js +17 -0
- package/components/ui/slider.js +26 -0
- package/components/ui/sonner.js +76 -0
- package/components/ui/switch.js +54 -0
- package/components/ui/table-v2.js +269 -0
- package/components/ui/table.js +245 -0
- package/components/ui/tabs.js +89 -0
- package/components/ui/textarea.js +33 -0
- package/components/ui/tooltip.js +40 -0
- package/components/workflow-editor/nodes/ticket/picker-field.js +233 -0
- package/components/zalo-login-qr.js +237 -0
- package/components/zalo-login-status-modal.js +45 -0
- package/config/env.js +27 -0
- package/config/hmr.js +8 -0
- package/config/navigation.js +54 -0
- package/config/runtime.js +46 -0
- package/config/theme.js +274 -0
- package/constants/brand-colors.js +32 -0
- package/constants/chat-icon.js +34 -0
- package/dist/chat.css +1 -0
- package/exceptions/throw-exception.js +15 -0
- package/hooks/use-chat-attachments.js +106 -0
- package/hooks/use-chat-configs.js +62 -0
- package/hooks/use-chat-customer.js +33 -0
- package/hooks/use-chat-display-config-sync.js +72 -0
- package/hooks/use-chat-permission.js +68 -0
- package/hooks/use-chat-room-detail.js +44 -0
- package/hooks/use-chat-selection.js +26 -0
- package/hooks/use-chat-sort.js +69 -0
- package/hooks/use-chat-surface.js +8 -0
- package/hooks/use-common-filter-options.js +70 -0
- package/hooks/use-crm-organization-filter-options.js +0 -0
- package/hooks/use-crm-organizations-data.js +23 -0
- package/hooks/use-debounce.js +14 -0
- package/hooks/use-dynamic-fields.js +7 -0
- package/hooks/use-facebook-notice.js +24 -0
- package/hooks/use-feature-flags.js +6 -0
- package/hooks/use-field-layout-override.js +46 -0
- package/hooks/use-file-upload.js +119 -0
- package/hooks/use-file-viewer.js +93 -0
- package/hooks/use-frozen-columns.js +29 -0
- package/hooks/use-horizontal-scroll.js +41 -0
- package/hooks/use-image-preview-queue.js +101 -0
- package/hooks/use-inline-editable-cell.js +97 -0
- package/hooks/use-intersection-observer.js +24 -0
- package/hooks/use-interval.js +20 -0
- package/hooks/use-latest-message-id.js +13 -0
- package/hooks/use-lead-filter-options.js +0 -0
- package/hooks/use-logout-listener.js +43 -0
- package/hooks/use-org-tree.js +43 -0
- package/hooks/use-permission.js +33 -0
- package/hooks/use-quick-filters.js +175 -0
- package/hooks/use-resizable-table.js +0 -0
- package/hooks/use-setting-common.js +389 -0
- package/hooks/use-settings.js +41 -0
- package/hooks/use-sort-bindings.js +24 -0
- package/hooks/use-table-display-config.js +0 -0
- package/hooks/use-tenant-config.js +99 -0
- package/hooks/use-update-user-config.js +150 -0
- package/hooks/use-zalo-connection.js +57 -0
- package/hooks/use-zalo-mention-list.js +31 -0
- package/index.css +624 -0
- package/index.js +100 -0
- package/lib/deal-name.js +27 -0
- package/lib/i18n/react.js +7 -0
- package/lib/i18n/use-language.js +0 -0
- package/lib/query-client.js +34 -0
- package/lib/utils.js +25 -0
- package/package.json +108 -0
- package/provider/chat-context.js +9 -0
- package/provider/chat-provider.js +177 -0
- package/provider/chat-room-context.js +9 -0
- package/provider/chat-room-hooks.js +8 -0
- package/provider/chat-room-provider.js +84 -0
- package/provider/hooks.js +22 -0
- package/provider/index.js +42 -0
- package/public/contact-card-user.svg +25 -0
- package/public/images/icons/facebook.svg +1 -0
- package/public/images/icons/instagram.svg +1 -0
- package/public/images/icons/shopee.svg +1 -0
- package/public/images/icons/whatsapp.svg +1 -0
- package/public/images/icons/zalo.png +0 -0
- package/public/images/images.jpg +0 -0
- package/public/images/ticket_sources/api.png +0 -0
- package/public/images/ticket_sources/email.png +0 -0
- package/public/images/ticket_sources/facebook.png +0 -0
- package/public/images/ticket_sources/hand.png +0 -0
- package/public/images/ticket_sources/instagram.png +0 -0
- package/public/images/ticket_sources/livechat.png +0 -0
- package/public/images/ticket_sources/shopee.svg +1 -0
- package/public/images/ticket_sources/sms.png +0 -0
- package/public/images/ticket_sources/telephone-call-in.png +0 -0
- package/public/images/ticket_sources/telephone-call-out.png +0 -0
- package/public/images/ticket_sources/tiktok.png +0 -0
- package/public/images/ticket_sources/tiktok_shop.png +0 -0
- package/public/images/ticket_sources/whatsapp.png +0 -0
- package/public/images/ticket_sources/whatsapp.svg +1 -0
- package/public/images/ticket_sources/zalo.png +0 -0
- package/public/placeholder.svg +13 -0
- package/store/app-status-store.js +17 -0
- package/store/chat-display-config-store.js +182 -0
- package/store/chat-display-config.resolvers.js +88 -0
- package/store/chat-store-helpers.js +62 -0
- package/store/chat-store.js +931 -0
- package/store/crm-organization-list-filter-store.js +126 -0
- package/store/customer-list-filter-store.js +139 -0
- package/store/devtools.js +9 -0
- package/store/duplicate-phone-warning-store.js +18 -0
- package/store/entity-extract-store.js +72 -0
- package/store/file-preview-store.js +27 -0
- package/store/filter-store.js +289 -0
- package/store/index.js +22 -0
- package/store/knowledge-crawl-store.js +53 -0
- package/store/lead-list-filter-store.js +142 -0
- package/store/list-pagination-state.js +44 -0
- package/store/lumi-learn-from-chat-store.js +69 -0
- package/store/merge-suggestion-store.js +27 -0
- package/store/notification-store.js +63 -0
- package/store/preview-image-store.js +22 -0
- package/store/settings-store/multi-channel/email-list-store.js +20 -0
- package/store/settings-store/multi-channel/facebook-list-store.js +22 -0
- package/store/settings-store/multi-channel/google-list-store.js +20 -0
- package/store/settings-store/multi-channel/instagram-list-store.js +20 -0
- package/store/settings-store/multi-channel/misa-list-store.js +20 -0
- package/store/settings-store/multi-channel/nhanhvn-list-store.js +20 -0
- package/store/settings-store/multi-channel/shopee-list-store.js +20 -0
- package/store/settings-store/multi-channel/shopee-order-list-store.js +20 -0
- package/store/settings-store/multi-channel/sms-list-store.js +20 -0
- package/store/settings-store/multi-channel/tiktok-business-list-store.js +20 -0
- package/store/settings-store/multi-channel/tiktok-list-store.js +20 -0
- package/store/settings-store/multi-channel/zalo-list-store.js +22 -0
- package/store/settings-store/multi-channel/zalo-user-list-store.js +25 -0
- package/store/smart-qc-store/smart-qc-list-filter-store.js +70 -0
- package/store/tenant-config-store.js +21 -0
- package/store/user-detail-store.js +17 -0
- package/store/user-status-store.js +33 -0
- package/store/workflow-store.js +24 -0
- package/store/workspace-store.js +32 -0
- package/tailwind-preset.js +129 -0
- package/utils/chat-actions.js +414 -0
- package/utils/chat_socket.js +1225 -0
- package/utils/extra-columns.js +108 -0
- package/utils/file.js +316 -0
- package/utils/html-to-plain-text.js +12 -0
- package/utils/notification.js +71 -0
- package/utils/replaceZaloSprite.js +64 -0
- package/utils/show-be-error.js +17 -0
- package/utils/typing_socket.js +101 -0
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import i18n from "@zenify-omni/chat-js/lib/i18n/index.js";
|
|
3
|
+
import React, { useMemo, useRef, useEffect } from "react";
|
|
4
|
+
import {
|
|
5
|
+
Avatar,
|
|
6
|
+
AvatarFallback,
|
|
7
|
+
AvatarImage
|
|
8
|
+
} from "../../custom/avatar.js";
|
|
9
|
+
import { cn } from "../../../lib/utils.js";
|
|
10
|
+
import {
|
|
11
|
+
Link,
|
|
12
|
+
Pin,
|
|
13
|
+
Map,
|
|
14
|
+
PinOff,
|
|
15
|
+
User,
|
|
16
|
+
ShoppingBag,
|
|
17
|
+
Image as ImageIcon,
|
|
18
|
+
File as FileIcon,
|
|
19
|
+
Mic,
|
|
20
|
+
Video as VideoIcon,
|
|
21
|
+
Smile,
|
|
22
|
+
CalendarClock
|
|
23
|
+
} from "lucide-react";
|
|
24
|
+
import useChatStore from "../../../store/chat-store.js";
|
|
25
|
+
import {
|
|
26
|
+
MessageType,
|
|
27
|
+
MessageTypeContext,
|
|
28
|
+
ChatFilterAssignStatus
|
|
29
|
+
} from "@zenify-omni/chat-js/constants/chat-message.js";
|
|
30
|
+
import { getUser, checkIsViewAsMode } from "@zenify-omni/chat-js/utils/auth.js";
|
|
31
|
+
import { generateLastMsgTimeText } from "@zenify-omni/chat-js/utils/date.js";
|
|
32
|
+
import { ActionChatItem } from "./action-chat-item.js";
|
|
33
|
+
import {
|
|
34
|
+
getChatAvatarSrc,
|
|
35
|
+
getChatAvatarAlt,
|
|
36
|
+
getChatDisplayName,
|
|
37
|
+
getPageDisplayName
|
|
38
|
+
} from "../util.js";
|
|
39
|
+
import { ChatIcon } from "../../../constants/chat-icon.js";
|
|
40
|
+
import {
|
|
41
|
+
Tooltip,
|
|
42
|
+
TooltipProvider,
|
|
43
|
+
TooltipTrigger,
|
|
44
|
+
TooltipContent
|
|
45
|
+
} from "../../ui/tooltip.js";
|
|
46
|
+
import { CHATTER_TYPES } from "../chat-box/constants.js";
|
|
47
|
+
import ChatterAgentIcon from "../../../assets/icons/chatter_agent.js";
|
|
48
|
+
import ChatterContactIcon from "../../../assets/icons/chatter_contact.js";
|
|
49
|
+
import { notFoundValue } from "@zenify-omni/chat-js/constants/common.js";
|
|
50
|
+
import useTenantConfigStore from "../../../store/tenant-config-store.js";
|
|
51
|
+
import { ChatReadRule } from "../../settings-route/routing/settings-dialog.js";
|
|
52
|
+
import ChatterChatbotIcon from "../../../assets/icons/chatter_chatbot.js";
|
|
53
|
+
import DOMPurify from "dompurify";
|
|
54
|
+
import {
|
|
55
|
+
replaceZaloSprite,
|
|
56
|
+
applyZaloEmojiStyles
|
|
57
|
+
} from "../../../utils/replaceZaloSprite.js";
|
|
58
|
+
import { ChatItemTags } from "./chat-item-tags.js";
|
|
59
|
+
import { Checkbox } from "../../ui/checkbox.js";
|
|
60
|
+
import { useQuery } from "@tanstack/react-query";
|
|
61
|
+
import QUERY_KEY from "@zenify-omni/chat-js/constants/use-query-key.js";
|
|
62
|
+
import { getConversationLabels } from "@zenify-omni/chat-js/api/facebook-labels.js";
|
|
63
|
+
import { maskData } from "@zenify-omni/chat-js/utils/data.js";
|
|
64
|
+
import { useTranslation } from "react-i18next";
|
|
65
|
+
function ZaloLastMsg({ text }) {
|
|
66
|
+
const ref = useRef(null);
|
|
67
|
+
const html = DOMPurify.sanitize(replaceZaloSprite(text));
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
applyZaloEmojiStyles(ref.current, 16);
|
|
70
|
+
}, [html]);
|
|
71
|
+
return /* @__PURE__ */ jsx("span", { ref, dangerouslySetInnerHTML: { __html: html } });
|
|
72
|
+
}
|
|
73
|
+
const TEMPLATE_MESSAGE_TYPES = [
|
|
74
|
+
MessageType.GENERIC_TEMPLATE,
|
|
75
|
+
MessageType.BUTTON_TEMPLATE,
|
|
76
|
+
MessageType.MEDIA_TEMPLATE,
|
|
77
|
+
MessageType.PRODUCT_TEMPLATE,
|
|
78
|
+
MessageType.IMAGE_GRID_TEMPLATE,
|
|
79
|
+
MessageType.RECEIPT_TEMPLATE,
|
|
80
|
+
MessageType.TEMPLATE
|
|
81
|
+
];
|
|
82
|
+
const lastMsgTypeHidden = [
|
|
83
|
+
MessageType.CREATE_REMINDER,
|
|
84
|
+
MessageType.UPDATE_REMINDER,
|
|
85
|
+
MessageType.DELETE_REMINDER,
|
|
86
|
+
MessageType.REMINDER_RECEIVE,
|
|
87
|
+
MessageType.ACTION_RECEIVE,
|
|
88
|
+
MessageType.ACTION_JOIN,
|
|
89
|
+
MessageType.ACTION_OPT_IN,
|
|
90
|
+
MessageType.ACTION_STARTED,
|
|
91
|
+
MessageType.ACTION_LEAVE,
|
|
92
|
+
MessageType.ACTION_END,
|
|
93
|
+
MessageType.ACTION_REOPEN,
|
|
94
|
+
MessageType.ZALO_CALL,
|
|
95
|
+
MessageType.ZALO_ACCEPT_FRIEND,
|
|
96
|
+
MessageType.ZALO_CREATE_GROUP,
|
|
97
|
+
MessageType.CHAT_SIGNAL
|
|
98
|
+
];
|
|
99
|
+
const ChatItem = React.memo(
|
|
100
|
+
({
|
|
101
|
+
item,
|
|
102
|
+
onSelect,
|
|
103
|
+
isSelected,
|
|
104
|
+
onPin,
|
|
105
|
+
isPinned,
|
|
106
|
+
onMarkUnread,
|
|
107
|
+
currentChatTab,
|
|
108
|
+
isSelectMode = false,
|
|
109
|
+
isChecked = false,
|
|
110
|
+
onToggleSelect
|
|
111
|
+
}) => {
|
|
112
|
+
const { t } = useTranslation();
|
|
113
|
+
const user = getUser();
|
|
114
|
+
const sortUnansweredFirst = useTenantConfigStore(
|
|
115
|
+
(s) => s.chatConfig?.sort_chat ?? false
|
|
116
|
+
);
|
|
117
|
+
const { _id: id, last_msg, unread } = item;
|
|
118
|
+
const unansweredBg = [
|
|
119
|
+
"695b2bc0fbcf10042ea543ad",
|
|
120
|
+
"6a38933648331560a41b602d"
|
|
121
|
+
].includes(user?.tenant_id) ? "bg-secondary" : "bg-card";
|
|
122
|
+
const { time: updated_at } = last_msg || {};
|
|
123
|
+
const formattedLastMsgTime = useMemo(
|
|
124
|
+
() => generateLastMsgTimeText(updated_at),
|
|
125
|
+
[updated_at]
|
|
126
|
+
);
|
|
127
|
+
const lastChatMessage = useChatStore((state) => {
|
|
128
|
+
const msgs = state.ticketChatMessages[id];
|
|
129
|
+
return msgs?.[msgs.length - 1];
|
|
130
|
+
});
|
|
131
|
+
const draftMessage = useChatStore((state) => state.draftMessages[id]);
|
|
132
|
+
const currentChatId = useChatStore((state) => state.currentChatId);
|
|
133
|
+
const aliasMap = useChatStore((state) => state.aliasMap);
|
|
134
|
+
const showDraft = draftMessage && id !== currentChatId;
|
|
135
|
+
const chatReadRule = useTenantConfigStore(
|
|
136
|
+
(s) => s.chatConfig?.chat_read_rule
|
|
137
|
+
);
|
|
138
|
+
const isChatAllowed = useChatStore((state) => state.isChatAllowed);
|
|
139
|
+
const showUnread = useMemo(() => {
|
|
140
|
+
if (!unread) return false;
|
|
141
|
+
if (checkIsViewAsMode()) return true;
|
|
142
|
+
if (id === currentChatId) {
|
|
143
|
+
if (chatReadRule && chatReadRule === ChatReadRule.ASSIGNEE_VIEW && item.assigned?._id !== user?._id) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
return !isChatAllowed;
|
|
147
|
+
}
|
|
148
|
+
return unread > 0;
|
|
149
|
+
}, [
|
|
150
|
+
chatReadRule,
|
|
151
|
+
currentChatId,
|
|
152
|
+
id,
|
|
153
|
+
isChatAllowed,
|
|
154
|
+
item.assigned?._id,
|
|
155
|
+
unread,
|
|
156
|
+
user?._id
|
|
157
|
+
]);
|
|
158
|
+
const previewMsg = () => {
|
|
159
|
+
const isIncomingMsg = last_msg?.chatter_type && last_msg.chatter_type !== CHATTER_TYPES.AGENT && last_msg.chatter_type !== CHATTER_TYPES.CHATBOT;
|
|
160
|
+
const maskIfIncoming = (value) => isIncomingMsg ? maskData(value) : value;
|
|
161
|
+
const hideIcon = item.source === "facebook" && !!last_msg?.chatter_type && !lastMsgTypeHidden.includes(last_msg?.type);
|
|
162
|
+
if (last_msg?.type === MessageType.CONTACT_CARD) {
|
|
163
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
164
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
165
|
+
" ",
|
|
166
|
+
t("chat:message.attachedContactCard", {
|
|
167
|
+
defaultValue: "Danh thi\u1EBFp \u0111\xEDnh\n k\xE8m"
|
|
168
|
+
})
|
|
169
|
+
] });
|
|
170
|
+
}
|
|
171
|
+
if (last_msg?.type === "ads_content") {
|
|
172
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: [
|
|
173
|
+
t("chat:label.adPrefix", { defaultValue: "Qu\u1EA3ng c\xE1o:" }),
|
|
174
|
+
" ",
|
|
175
|
+
last_msg?.ad_name || "Facebook Ads"
|
|
176
|
+
] });
|
|
177
|
+
}
|
|
178
|
+
if (item.source === "facebook" || item.source === "instagram") {
|
|
179
|
+
if (last_msg?.type === MessageType.UNSUPPORTED) {
|
|
180
|
+
return /* @__PURE__ */ jsx("span", { className: "ml-1 line-clamp-1 text-[13px] italic text-muted-foreground", children: t("chat:message.unsupportedMessage", {
|
|
181
|
+
defaultValue: "Tin nh\u1EAFn ch\u01B0a \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3"
|
|
182
|
+
}) });
|
|
183
|
+
}
|
|
184
|
+
if (last_msg?.type === MessageType.UTILITY_MESSAGES) {
|
|
185
|
+
const title = last_msg?.title || last_msg?.text || "";
|
|
186
|
+
return title ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: title }) : /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: t("chat:label.utilityMessage", {
|
|
187
|
+
defaultValue: "Tin nh\u1EAFn ti\u1EC7n \xEDch"
|
|
188
|
+
}) });
|
|
189
|
+
}
|
|
190
|
+
if (TEMPLATE_MESSAGE_TYPES.includes(last_msg?.type)) {
|
|
191
|
+
return /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: t("chat:status.sentOneMessage") });
|
|
192
|
+
}
|
|
193
|
+
if (last_msg?.type === "reel") {
|
|
194
|
+
return last_msg?.description ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: last_msg.description }) : /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
195
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
196
|
+
" ",
|
|
197
|
+
t("chat:message.sharedReel", {
|
|
198
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB\n Reel"
|
|
199
|
+
})
|
|
200
|
+
] });
|
|
201
|
+
}
|
|
202
|
+
if (last_msg?.type === "share_post") {
|
|
203
|
+
return last_msg?.description ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: last_msg.description }) : /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
204
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
205
|
+
" ",
|
|
206
|
+
t("chat:message.sharedPost", {
|
|
207
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB\n b\xE0i vi\u1EBFt"
|
|
208
|
+
})
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
if (last_msg?.type === "share_group") {
|
|
212
|
+
return last_msg?.description ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: last_msg.description }) : /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
213
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
214
|
+
" ",
|
|
215
|
+
t("chat:message.sharedGroup", {
|
|
216
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB\n nh\xF3m"
|
|
217
|
+
})
|
|
218
|
+
] });
|
|
219
|
+
}
|
|
220
|
+
if (last_msg?.type === "share_page") {
|
|
221
|
+
return last_msg?.description ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: last_msg.description }) : /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
222
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
223
|
+
" ",
|
|
224
|
+
t("chat:message.sharedPage", {
|
|
225
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB\n trang"
|
|
226
|
+
})
|
|
227
|
+
] });
|
|
228
|
+
}
|
|
229
|
+
if (last_msg?.type === "share_event") {
|
|
230
|
+
return last_msg?.description ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: last_msg.description }) : /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
231
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
232
|
+
" ",
|
|
233
|
+
t("chat:message.sharedEvent", {
|
|
234
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB s\u1EF1\n ki\u1EC7n"
|
|
235
|
+
})
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
if (last_msg?.type === "share_review") {
|
|
239
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
240
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
241
|
+
" ",
|
|
242
|
+
t("chat:message.sharedReview", {
|
|
243
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB\n \u0111\xE1nh gi\xE1"
|
|
244
|
+
})
|
|
245
|
+
] });
|
|
246
|
+
}
|
|
247
|
+
if (last_msg?.type === "forward") {
|
|
248
|
+
const fwdText = last_msg?.text || "";
|
|
249
|
+
return fwdText ? /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: fwdText }) : /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: t("chat:status.forwardedMessage", {
|
|
250
|
+
defaultValue: "Tin nh\u1EAFn \u0111\xE3 chuy\u1EC3n ti\u1EBFp"
|
|
251
|
+
}) });
|
|
252
|
+
}
|
|
253
|
+
if (last_msg?.type === "chat_form") {
|
|
254
|
+
return /* @__PURE__ */ jsx("div", { className: "ml-1 line-clamp-1 text-[13px] text-muted-foreground", children: t("chat:label.chatForm", { defaultValue: "Bi\u1EC3u m\u1EABu chat" }) });
|
|
255
|
+
}
|
|
256
|
+
if (last_msg?.type === "appointment_booking") {
|
|
257
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
258
|
+
!hideIcon && /* @__PURE__ */ jsx(CalendarClock, { size: 12, className: "inline" }),
|
|
259
|
+
" ",
|
|
260
|
+
t("chat:message.bookedAppointment", {
|
|
261
|
+
defaultValue: "\u0110\xE3\n \u0111\u1EB7t l\u1ECBch h\u1EB9n"
|
|
262
|
+
})
|
|
263
|
+
] });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
let text = "";
|
|
267
|
+
const agentName = t("common:label.agent", {
|
|
268
|
+
defaultValue: "Chuy\xEAn vi\xEAn"
|
|
269
|
+
});
|
|
270
|
+
switch (last_msg?.type) {
|
|
271
|
+
case MessageType.ACTION_RECEIVE:
|
|
272
|
+
text = t("common:message.conversationAcceptedBy", {
|
|
273
|
+
name: agentName,
|
|
274
|
+
defaultValue: "{name} \u0111\xE3 ti\u1EBFp nh\u1EADn cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
275
|
+
});
|
|
276
|
+
break;
|
|
277
|
+
case MessageType.ACTION_JOIN:
|
|
278
|
+
text = t("common:message.conversationJoinedBy", {
|
|
279
|
+
name: agentName,
|
|
280
|
+
defaultValue: "{name} \u0111\xE3 tham gia cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
281
|
+
});
|
|
282
|
+
break;
|
|
283
|
+
case MessageType.ACTION_OPT_IN:
|
|
284
|
+
text = t("common:message.conversationActionBy", {
|
|
285
|
+
defaultValue: "{name} \u0111\xE3 {action}",
|
|
286
|
+
name: maskData(
|
|
287
|
+
last_msg?.chatter_name || i18n.t("common:label.customer", {
|
|
288
|
+
defaultValue: "Kh\xE1ch h\xE0ng"
|
|
289
|
+
})
|
|
290
|
+
),
|
|
291
|
+
action: MessageTypeContext[MessageType.ACTION_OPT_IN]
|
|
292
|
+
});
|
|
293
|
+
break;
|
|
294
|
+
case MessageType.SHARE_POST:
|
|
295
|
+
text = t("chat:message.sharedPost", {
|
|
296
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB b\xE0i vi\u1EBFt"
|
|
297
|
+
});
|
|
298
|
+
break;
|
|
299
|
+
case MessageType.ACTION_STARTED: {
|
|
300
|
+
const customerName = maskData(
|
|
301
|
+
last_msg?.chatter_name || t("common:label.customer", {
|
|
302
|
+
defaultValue: "Kh\xE1ch h\xE0ng"
|
|
303
|
+
})
|
|
304
|
+
);
|
|
305
|
+
text = t("common:message.conversationStartedBy", {
|
|
306
|
+
name: customerName,
|
|
307
|
+
defaultValue: "{name} \u0111\xE3 b\u1EAFt \u0111\u1EA7u cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
308
|
+
});
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
case MessageType.ACTION_LEAVE: {
|
|
312
|
+
const leaverName = last_msg?.chatter_id && String(last_msg.chatter_id) === String(user._id) ? t("chat:label.you", { defaultValue: "B\u1EA1n" }) : last_msg?.chatter_name || agentName;
|
|
313
|
+
const removerName = last_msg?.removed_by_id && String(last_msg.removed_by_id) === String(user._id) ? t("chat:label.you", { defaultValue: "B\u1EA1n" }) : last_msg?.removed_by_name;
|
|
314
|
+
text = last_msg?.removed_by_name ? t("common:message.conversationMemberRemovedBy", {
|
|
315
|
+
name: leaverName,
|
|
316
|
+
actor: removerName,
|
|
317
|
+
defaultValue: "{actor} \u0111\xE3 x\xF3a {name} ra kh\u1ECFi \u0111o\u1EA1n chat."
|
|
318
|
+
}) : t("common:message.conversationLeftBy", {
|
|
319
|
+
name: leaverName,
|
|
320
|
+
defaultValue: "{name} \u0111\xE3 r\u1EDDi cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
321
|
+
});
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
case MessageType.ACTION_END: {
|
|
325
|
+
const closedByName = last_msg?.chatter_id ? agentName : last_msg?.chatter_name || agentName;
|
|
326
|
+
text = t("common:message.conversationClosedBy", {
|
|
327
|
+
name: closedByName,
|
|
328
|
+
defaultValue: "{name} \u0111\xE3 \u0111\xF3ng h\u1ED9i tho\u1EA1i n\xE0y."
|
|
329
|
+
});
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
case MessageType.ACTION_REOPEN:
|
|
333
|
+
text = t("common:message.conversationReopenedBy", {
|
|
334
|
+
name: agentName,
|
|
335
|
+
defaultValue: "{name} \u0111\xE3 m\u1EDF l\u1EA1i cu\u1ED9c h\u1ED9i tho\u1EA1i."
|
|
336
|
+
});
|
|
337
|
+
break;
|
|
338
|
+
case MessageType.ACTION_TIKTOK_END_SESSION:
|
|
339
|
+
text = t("common:message.tiktokEndSessionSuccess", {
|
|
340
|
+
defaultValue: "\u0110\xE3 g\u1EEDi kh\u1EA3o s\xE1t m\u1EE9c \u0111\u1ED9 h\xE0i l\xF2ng \u0111\u1EBFn kh\xE1ch h\xE0ng."
|
|
341
|
+
});
|
|
342
|
+
break;
|
|
343
|
+
case MessageType.IMAGE: {
|
|
344
|
+
if (item.source === "facebook") {
|
|
345
|
+
const imgUrl = last_msg?.src || last_msg?.url || "";
|
|
346
|
+
if (/\.gif/i.test(imgUrl)) {
|
|
347
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
348
|
+
!hideIcon && /* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
349
|
+
" ",
|
|
350
|
+
t("chat:message.sentGifImage", {
|
|
351
|
+
defaultValue: "\u0110\xE3\n g\u1EEDi \u1EA3nh GIF"
|
|
352
|
+
})
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
357
|
+
!hideIcon && /* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
358
|
+
" ",
|
|
359
|
+
t("chat:message.sentAnImage", {
|
|
360
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n m\u1ED9t \u1EA3nh"
|
|
361
|
+
})
|
|
362
|
+
] });
|
|
363
|
+
}
|
|
364
|
+
case MessageType.POLL_CREATION: {
|
|
365
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 text-[13px] font-bold text-muted-foreground", children: [
|
|
366
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
367
|
+
" ",
|
|
368
|
+
t("chat:message.createdPoll", {
|
|
369
|
+
defaultValue: "\u0110\xE3 t\u1EA1o th\u0103m\n d\xF2 \xFD ki\u1EBFn"
|
|
370
|
+
})
|
|
371
|
+
] });
|
|
372
|
+
}
|
|
373
|
+
case MessageType.IMAGES: {
|
|
374
|
+
if (last_msg?.src) {
|
|
375
|
+
const images = last_msg?.src?.split("||") || [];
|
|
376
|
+
if (images.length === 1) {
|
|
377
|
+
if (item.source === "facebook" && /\.gif/i.test(images[0])) {
|
|
378
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
379
|
+
!hideIcon && /* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
380
|
+
" ",
|
|
381
|
+
t("chat:message.sentAGifImage", {
|
|
382
|
+
defaultValue: "\u0110\xE3\n g\u1EEDi m\u1ED9t \u1EA3nh GIF"
|
|
383
|
+
})
|
|
384
|
+
] });
|
|
385
|
+
}
|
|
386
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
387
|
+
!hideIcon && /* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
388
|
+
" ",
|
|
389
|
+
t("chat:message.sentAnImage", {
|
|
390
|
+
defaultValue: "\u0110\xE3\n g\u1EEDi m\u1ED9t \u1EA3nh"
|
|
391
|
+
})
|
|
392
|
+
] });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
396
|
+
!hideIcon && /* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
397
|
+
" ",
|
|
398
|
+
t("chat:message.sentMultipleImages", {
|
|
399
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n nhi\u1EC1u \u1EA3nh"
|
|
400
|
+
})
|
|
401
|
+
] });
|
|
402
|
+
}
|
|
403
|
+
case MessageType.FILE: {
|
|
404
|
+
if (item.source === "facebook") {
|
|
405
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
406
|
+
!hideIcon && /* @__PURE__ */ jsx(FileIcon, { size: 12, className: "inline" }),
|
|
407
|
+
" ",
|
|
408
|
+
t("chat:message.sentAFile", {
|
|
409
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n m\u1ED9t t\u1EC7p"
|
|
410
|
+
})
|
|
411
|
+
] });
|
|
412
|
+
}
|
|
413
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
414
|
+
/* @__PURE__ */ jsx(FileIcon, { size: 12, className: "inline" }),
|
|
415
|
+
" ",
|
|
416
|
+
t("chat:message.sentAFile", { defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t t\u1EC7p" })
|
|
417
|
+
] });
|
|
418
|
+
}
|
|
419
|
+
case MessageType.AUDIO:
|
|
420
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
421
|
+
!hideIcon && /* @__PURE__ */ jsx(Mic, { size: 12, className: "inline" }),
|
|
422
|
+
" ",
|
|
423
|
+
t("chat:message.sentAudioClip", {
|
|
424
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t\n \u0111o\u1EA1n \xE2m thanh"
|
|
425
|
+
})
|
|
426
|
+
] });
|
|
427
|
+
case MessageType.VIDEO:
|
|
428
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
429
|
+
!hideIcon && /* @__PURE__ */ jsx(VideoIcon, { size: 12, className: "inline" }),
|
|
430
|
+
" ",
|
|
431
|
+
t("chat:message.sentAVideo", {
|
|
432
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n m\u1ED9t video"
|
|
433
|
+
})
|
|
434
|
+
] });
|
|
435
|
+
case MessageType.STICKER:
|
|
436
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
437
|
+
!hideIcon && /* @__PURE__ */ jsx(Smile, { size: 12, className: "inline" }),
|
|
438
|
+
" ",
|
|
439
|
+
t("chat:message.sentASticker", {
|
|
440
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t\n nh\xE3n d\xE1n"
|
|
441
|
+
})
|
|
442
|
+
] });
|
|
443
|
+
case MessageType.REEL:
|
|
444
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
445
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
446
|
+
" ",
|
|
447
|
+
t("chat:label.attachedFile", { defaultValue: "T\u1EC7p \u0111\xEDnh k\xE8m" })
|
|
448
|
+
] });
|
|
449
|
+
case MessageType.FALLBACK:
|
|
450
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
451
|
+
!hideIcon && /* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
452
|
+
" ",
|
|
453
|
+
t("chat:label.attachedFile", { defaultValue: "T\u1EC7p \u0111\xEDnh k\xE8m" })
|
|
454
|
+
] });
|
|
455
|
+
case MessageType.PRODUCT:
|
|
456
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 truncate text-[13px] font-bold text-muted-foreground", children: [
|
|
457
|
+
/* @__PURE__ */ jsx(ShoppingBag, { size: 12, className: "inline" }),
|
|
458
|
+
" ",
|
|
459
|
+
t("chat:message.sharedProduct", {
|
|
460
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB s\u1EA3n ph\u1EA9m"
|
|
461
|
+
})
|
|
462
|
+
] });
|
|
463
|
+
case MessageType.LOCATION:
|
|
464
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
465
|
+
/* @__PURE__ */ jsx(Map, { size: 12, className: "inline" }),
|
|
466
|
+
" ",
|
|
467
|
+
t("chat:message.sentALocation", {
|
|
468
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t v\u1ECB tr\xED"
|
|
469
|
+
})
|
|
470
|
+
] });
|
|
471
|
+
case MessageType.PIN:
|
|
472
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
473
|
+
/* @__PURE__ */ jsx(Pin, { size: 12, className: "inline" }),
|
|
474
|
+
" ",
|
|
475
|
+
t("chat:toast.pinMessageSuccess", {
|
|
476
|
+
defaultValue: "\u0110\xE3 ghim m\u1ED9t tin nh\u1EAFn"
|
|
477
|
+
})
|
|
478
|
+
] });
|
|
479
|
+
case MessageType.UN_PIN:
|
|
480
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
481
|
+
/* @__PURE__ */ jsx(PinOff, { size: 12, className: "inline" }),
|
|
482
|
+
" ",
|
|
483
|
+
t("chat:toast.unpinMessageSuccess", {
|
|
484
|
+
defaultValue: "\u0110\xE3 b\u1ECF ghim m\u1ED9t tin nh\u1EAFn"
|
|
485
|
+
})
|
|
486
|
+
] });
|
|
487
|
+
case MessageType.COUPON:
|
|
488
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
489
|
+
/* @__PURE__ */ jsx(ShoppingBag, { size: 12, className: "inline" }),
|
|
490
|
+
" ",
|
|
491
|
+
t("chat:message.sharedVoucher", {
|
|
492
|
+
defaultValue: "\u0110\xE3 chia s\u1EBB voucher"
|
|
493
|
+
})
|
|
494
|
+
] });
|
|
495
|
+
case MessageType.ORDER:
|
|
496
|
+
return /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground", children: [
|
|
497
|
+
/* @__PURE__ */ jsx(ShoppingBag, { size: 12, className: "inline" }),
|
|
498
|
+
" ",
|
|
499
|
+
t("chat:label.orderPrefix", { defaultValue: "\u0110\u01A1n h\xE0ng:" }),
|
|
500
|
+
" ",
|
|
501
|
+
maskIfIncoming(last_msg.text || "")
|
|
502
|
+
] });
|
|
503
|
+
default:
|
|
504
|
+
text = typeof last_msg?.text == "string" ? maskIfIncoming(last_msg?.text) : "";
|
|
505
|
+
}
|
|
506
|
+
if (!text) {
|
|
507
|
+
const lastStoreMsg = lastChatMessage;
|
|
508
|
+
if (Array.isArray(lastStoreMsg?.extra_data?.products))
|
|
509
|
+
return /* @__PURE__ */ jsx("span", { children: t("chat:label.attachedProduct", {
|
|
510
|
+
defaultValue: "S\u1EA3n ph\u1EA9m \u0111\xEDnh k\xE8m"
|
|
511
|
+
}) });
|
|
512
|
+
return /* @__PURE__ */ jsx("span", { className: "italic", children: t("chat:message.unsupportedMessage", {
|
|
513
|
+
defaultValue: "Tin nh\u1EAFn ch\u01B0a \u0111\u01B0\u1EE3c h\u1ED7 tr\u1EE3"
|
|
514
|
+
}) });
|
|
515
|
+
}
|
|
516
|
+
return /* @__PURE__ */ jsx(ZaloLastMsg, { text });
|
|
517
|
+
};
|
|
518
|
+
const isChatbot = last_msg?.chatter_type === CHATTER_TYPES.CHATBOT;
|
|
519
|
+
const isAgentMessage = last_msg?.chatter_type === CHATTER_TYPES.AGENT;
|
|
520
|
+
const isCustomerMessage = !isChatbot && !isAgentMessage;
|
|
521
|
+
const { data: liveConvLabelsData } = useQuery({
|
|
522
|
+
queryKey: [
|
|
523
|
+
QUERY_KEY.GET_CONVERSATION_FACEBOOK_LABELS,
|
|
524
|
+
item.source_id,
|
|
525
|
+
item.source_room_id
|
|
526
|
+
],
|
|
527
|
+
queryFn: () => getConversationLabels({
|
|
528
|
+
page_id: item.source_id,
|
|
529
|
+
psid: item.source_room_id
|
|
530
|
+
}),
|
|
531
|
+
enabled: isSelected && item.source === "facebook" && !!item.source_id && !!item.source_room_id
|
|
532
|
+
});
|
|
533
|
+
const mergedTags = useMemo(() => {
|
|
534
|
+
const baseTags = item.tags ?? [];
|
|
535
|
+
const personalTags = item.personal_tags ?? [];
|
|
536
|
+
if (item.source !== "facebook") return [...baseTags, ...personalTags];
|
|
537
|
+
let facebookLabels = item.facebook_labels ?? [];
|
|
538
|
+
if (isSelected && liveConvLabelsData !== void 0) {
|
|
539
|
+
facebookLabels = liveConvLabelsData?.data || [];
|
|
540
|
+
}
|
|
541
|
+
if (facebookLabels.length === 0) return [...baseTags, ...personalTags];
|
|
542
|
+
const existingIds = new Set(baseTags.map((t2) => String(t2._id)));
|
|
543
|
+
const additionalTags = facebookLabels.filter((label) => !existingIds.has(String(label.id))).map((label) => ({
|
|
544
|
+
_id: label.id,
|
|
545
|
+
name: label.name,
|
|
546
|
+
color: "hsl(var(--primary))",
|
|
547
|
+
isFacebookLabel: true
|
|
548
|
+
}));
|
|
549
|
+
return [...baseTags, ...additionalTags, ...personalTags];
|
|
550
|
+
}, [
|
|
551
|
+
item.tags,
|
|
552
|
+
item.personal_tags,
|
|
553
|
+
item.facebook_labels,
|
|
554
|
+
item.source,
|
|
555
|
+
isSelected,
|
|
556
|
+
liveConvLabelsData
|
|
557
|
+
]);
|
|
558
|
+
const getChatterTypePreview = () => {
|
|
559
|
+
if (lastMsgTypeHidden.includes(last_msg?.type) || !last_msg?.chatter_type) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
563
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
|
|
564
|
+
isAgentMessage && /* @__PURE__ */ jsx(ChatterAgentIcon, { className: "mr-0.5" }),
|
|
565
|
+
isChatbot && /* @__PURE__ */ jsx(ChatterChatbotIcon, { className: "mr-0.5" }),
|
|
566
|
+
isCustomerMessage && /* @__PURE__ */ jsx(ChatterContactIcon, { className: "mr-0.5" }),
|
|
567
|
+
":"
|
|
568
|
+
] }) }),
|
|
569
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", align: "center", sideOffset: 6, children: /* @__PURE__ */ jsxs("p", { children: [
|
|
570
|
+
isAgentMessage && t("chat:label.agentName", {
|
|
571
|
+
defaultValue: "Chuy\xEAn vi\xEAn: {name}",
|
|
572
|
+
name: last_msg?.chatter_name || notFoundValue
|
|
573
|
+
}),
|
|
574
|
+
isChatbot && "Chatbot",
|
|
575
|
+
isCustomerMessage && t("chat:label.customerName", {
|
|
576
|
+
defaultValue: "Kh\xE1ch h\xE0ng: {name}",
|
|
577
|
+
name: last_msg?.chatter_name || notFoundValue
|
|
578
|
+
})
|
|
579
|
+
] }) })
|
|
580
|
+
] }) });
|
|
581
|
+
};
|
|
582
|
+
const hasTags = mergedTags.length > 0 || item.assigned?._id;
|
|
583
|
+
const isCheckedItem = isSelectMode && isChecked;
|
|
584
|
+
return /* @__PURE__ */ jsx(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
className: cn(
|
|
588
|
+
"relative flex w-full cursor-pointer items-center rounded-none border-b border-b-border-subtle px-2 py-1 text-left text-sm hover:bg-accent",
|
|
589
|
+
hasTags ? "min-h-[110px]" : "min-h-[90px]",
|
|
590
|
+
isSelected ? "bg-secondary" : item.is_unanswered && sortUnansweredFirst && currentChatTab !== ChatFilterAssignStatus.Closed && unansweredBg,
|
|
591
|
+
isCheckedItem && "border-l-2 border-l-primary bg-secondary hover:bg-secondary"
|
|
592
|
+
),
|
|
593
|
+
onClick: () => isSelectMode ? onToggleSelect?.(id) : onSelect(id),
|
|
594
|
+
children: /* @__PURE__ */ jsxs("div", { className: "mx-0 w-full px-0", children: [
|
|
595
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2 px-2 py-2", children: [
|
|
596
|
+
/* @__PURE__ */ jsxs(
|
|
597
|
+
"div",
|
|
598
|
+
{
|
|
599
|
+
className: cn(
|
|
600
|
+
"flex flex-1 items-center gap-2 truncate text-xs capitalize text-muted-foreground",
|
|
601
|
+
(isSelected || isCheckedItem) && "text-primary"
|
|
602
|
+
),
|
|
603
|
+
children: [
|
|
604
|
+
isSelectMode && /* @__PURE__ */ jsx(
|
|
605
|
+
Checkbox,
|
|
606
|
+
{
|
|
607
|
+
className: cn(
|
|
608
|
+
"h-[18px] w-[18px] flex-shrink-0 border-muted-foreground",
|
|
609
|
+
isChecked && "border-primary"
|
|
610
|
+
),
|
|
611
|
+
checked: isChecked,
|
|
612
|
+
onCheckedChange: () => onToggleSelect?.(id),
|
|
613
|
+
onClick: (e) => e.stopPropagation(),
|
|
614
|
+
"aria-label": t("chat:action.selectConversation", {
|
|
615
|
+
defaultValue: "Ch\u1ECDn h\u1ED9i tho\u1EA1i"
|
|
616
|
+
})
|
|
617
|
+
}
|
|
618
|
+
),
|
|
619
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: ChatIcon[item.source] }),
|
|
620
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: getPageDisplayName(item, aliasMap) })
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
),
|
|
624
|
+
/* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx(
|
|
625
|
+
ActionChatItem,
|
|
626
|
+
{
|
|
627
|
+
data: item,
|
|
628
|
+
onPin,
|
|
629
|
+
isPinned,
|
|
630
|
+
isChecked: isCheckedItem,
|
|
631
|
+
onMarkUnread,
|
|
632
|
+
showMarkUnread: !unread
|
|
633
|
+
}
|
|
634
|
+
) })
|
|
635
|
+
] }),
|
|
636
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-start gap-2", children: [
|
|
637
|
+
/* @__PURE__ */ jsxs(Avatar, { children: [
|
|
638
|
+
/* @__PURE__ */ jsx(
|
|
639
|
+
AvatarImage,
|
|
640
|
+
{
|
|
641
|
+
src: getChatAvatarSrc(item),
|
|
642
|
+
alt: getChatAvatarAlt(item)
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
/* @__PURE__ */ jsx(AvatarFallback, { className: "bg-muted", children: /* @__PURE__ */ jsx(User, { size: 18 }) })
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-[calc(100%-40px-0.5rem)] flex-col gap-1", children: [
|
|
648
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
649
|
+
/* @__PURE__ */ jsx("span", { className: "ml-1 truncate text-[13px] font-medium", children: getChatDisplayName(item) }),
|
|
650
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-right text-xs font-normal text-muted-foreground", children: formattedLastMsgTime })
|
|
651
|
+
] }),
|
|
652
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
653
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1 items-center", children: showDraft ? /* @__PURE__ */ jsxs("div", { className: "ml-1 line-clamp-1 w-full text-[13px]", children: [
|
|
654
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-destructive", children: t("chat:label.draftBracket", {
|
|
655
|
+
defaultValue: "[Nh\xE1p]"
|
|
656
|
+
}) }),
|
|
657
|
+
" ",
|
|
658
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: draftMessage })
|
|
659
|
+
] }) : item.source !== "facebook" && last_msg?.type !== "chat_form" && [
|
|
660
|
+
MessageType.FILE,
|
|
661
|
+
MessageType.AUDIO,
|
|
662
|
+
MessageType.VIDEO,
|
|
663
|
+
MessageType.IMAGE,
|
|
664
|
+
MessageType.STICKER,
|
|
665
|
+
MessageType.LINK
|
|
666
|
+
].includes(last_msg?.type) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
667
|
+
getChatterTypePreview(),
|
|
668
|
+
/* @__PURE__ */ jsx(
|
|
669
|
+
"div",
|
|
670
|
+
{
|
|
671
|
+
className: cn(
|
|
672
|
+
"ml-1 line-clamp-2 text-[13px] font-bold text-muted-foreground",
|
|
673
|
+
showUnread && "font-medium text-foreground"
|
|
674
|
+
),
|
|
675
|
+
children: last_msg?.type === MessageType.IMAGE ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
676
|
+
/* @__PURE__ */ jsx(ImageIcon, { size: 12, className: "inline" }),
|
|
677
|
+
" ",
|
|
678
|
+
t("chat:message.sentAnImage", {
|
|
679
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n m\u1ED9t \u1EA3nh"
|
|
680
|
+
})
|
|
681
|
+
] }) : last_msg?.type === MessageType.VIDEO ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
682
|
+
/* @__PURE__ */ jsx(VideoIcon, { size: 12, className: "inline" }),
|
|
683
|
+
" ",
|
|
684
|
+
t("chat:message.sentAVideo", {
|
|
685
|
+
defaultValue: "\u0110\xE3 g\u1EEDi\n m\u1ED9t video"
|
|
686
|
+
})
|
|
687
|
+
] }) : last_msg?.type === MessageType.AUDIO ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
688
|
+
/* @__PURE__ */ jsx(Mic, { size: 12, className: "inline" }),
|
|
689
|
+
" ",
|
|
690
|
+
t("chat:message.sentAnAudio", {
|
|
691
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t \u0111o\u1EA1n\n \xE2m thanh"
|
|
692
|
+
})
|
|
693
|
+
] }) : last_msg?.type === MessageType.FILE ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 truncate", children: [
|
|
694
|
+
/* @__PURE__ */ jsx(FileIcon, { size: 12, className: "shrink-0" }),
|
|
695
|
+
" ",
|
|
696
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: t("chat:message.sentAFile", {
|
|
697
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t t\u1EC7p"
|
|
698
|
+
}) })
|
|
699
|
+
] }) : last_msg?.type === MessageType.STICKER ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
700
|
+
/* @__PURE__ */ jsx(Smile, { size: 12, className: "inline" }),
|
|
701
|
+
" ",
|
|
702
|
+
t("chat:message.sentASticker", {
|
|
703
|
+
defaultValue: "\u0110\xE3 g\u1EEDi m\u1ED9t\n nh\xE3n d\xE1n"
|
|
704
|
+
})
|
|
705
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
706
|
+
/* @__PURE__ */ jsx(Link, { size: 12, className: "inline" }),
|
|
707
|
+
" ",
|
|
708
|
+
t("chat:label.attachedFile", {
|
|
709
|
+
defaultValue: "T\u1EC7p \u0111\xEDnh k\xE8m"
|
|
710
|
+
})
|
|
711
|
+
] })
|
|
712
|
+
}
|
|
713
|
+
)
|
|
714
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
715
|
+
getChatterTypePreview(),
|
|
716
|
+
/* @__PURE__ */ jsx(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
className: cn(
|
|
720
|
+
"ml-1 line-clamp-1 w-full text-[13px] text-muted-foreground",
|
|
721
|
+
showUnread && "font-medium text-foreground",
|
|
722
|
+
item.is_unanswered && sortUnansweredFirst && "font-medium text-foreground"
|
|
723
|
+
),
|
|
724
|
+
children: previewMsg()
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
] }) }),
|
|
728
|
+
showUnread ? /* @__PURE__ */ jsx("span", { className: "flex min-w-[18px] shrink-0 items-center justify-center rounded-full bg-destructive px-1 py-0.5 text-[10px] font-bold leading-none text-white", children: unread > 99 ? "99+" : unread }) : null
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsx(
|
|
731
|
+
ChatItemTags,
|
|
732
|
+
{
|
|
733
|
+
tags: mergedTags,
|
|
734
|
+
_id: item.assigned?._id,
|
|
735
|
+
assignName: item.assigned?.name
|
|
736
|
+
}
|
|
737
|
+
) })
|
|
738
|
+
] })
|
|
739
|
+
] })
|
|
740
|
+
] })
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
);
|
|
745
|
+
ChatItem.displayName = "ChatItem";
|
|
746
|
+
var chat_item_default = ChatItem;
|
|
747
|
+
export {
|
|
748
|
+
chat_item_default as default
|
|
749
|
+
};
|