@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,501 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { debounce } from "lodash-es";
|
|
4
|
+
import { maskData } from "@zenify-omni/chat-js/utils/data.js";
|
|
5
|
+
import { SlidersHorizontal, Plus, RotateCcw } from "lucide-react";
|
|
6
|
+
import {
|
|
7
|
+
Popover,
|
|
8
|
+
PopoverTrigger,
|
|
9
|
+
PopoverContent
|
|
10
|
+
} from "../../ui/popover.js";
|
|
11
|
+
import {
|
|
12
|
+
DropdownMenu,
|
|
13
|
+
DropdownMenuContent,
|
|
14
|
+
DropdownMenuItem,
|
|
15
|
+
DropdownMenuTrigger
|
|
16
|
+
} from "../../ui/dropdown-menu.js";
|
|
17
|
+
import { Tabs, TabsList, TabsTrigger } from "../../ui/tabs.js";
|
|
18
|
+
import { SearchInput } from "../../custom/search-input.js";
|
|
19
|
+
import { Button } from "../../custom/button.js";
|
|
20
|
+
import { Form } from "../../ui/form.js";
|
|
21
|
+
import useChatStore from "../../../store/chat-store.js";
|
|
22
|
+
import useChatDisplayConfigStore, {
|
|
23
|
+
selectStatusTabs
|
|
24
|
+
} from "../../../store/chat-display-config-store.js";
|
|
25
|
+
import { useShallow } from "zustand/react/shallow";
|
|
26
|
+
import { getQuickFilterById } from "@zenify-omni/chat-js/api/chatroom.js";
|
|
27
|
+
import { useForm, useWatch } from "react-hook-form";
|
|
28
|
+
import {
|
|
29
|
+
ChatFilterSourceOptions,
|
|
30
|
+
ChatFilterSource
|
|
31
|
+
} from "@zenify-omni/chat-js/constants/chat-message.js";
|
|
32
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
33
|
+
import { useGetListSocialPage } from "../../../hooks/use-setting-common.js";
|
|
34
|
+
import ChatSortMenu from "./chat-sort-menu.js";
|
|
35
|
+
import {
|
|
36
|
+
baseFilterSchema,
|
|
37
|
+
CHAT_SEARCH_DEBOUNCE_MS,
|
|
38
|
+
DEFAULT_FILTER_STATE,
|
|
39
|
+
validateRangeDate
|
|
40
|
+
} from "./util.js";
|
|
41
|
+
import FilterCriteriaRows, {
|
|
42
|
+
buildCriteriaFields,
|
|
43
|
+
getActiveCriteriaKeys
|
|
44
|
+
} from "./filter-criteria-rows.js";
|
|
45
|
+
import SaveFilterPopover from "./save-filter-popover.js";
|
|
46
|
+
import { throwException } from "../../../exceptions/throw-exception.js";
|
|
47
|
+
import {
|
|
48
|
+
CHAT_TAB_CONFIGS,
|
|
49
|
+
PREDEFINED_FILTER_CHIPS
|
|
50
|
+
} from "../../settings-route/chat-layout/detail/constants.js";
|
|
51
|
+
import { cn } from "../../../lib/utils.js";
|
|
52
|
+
import { useTranslation } from "react-i18next";
|
|
53
|
+
const formSchema = baseFilterSchema.superRefine(validateRangeDate);
|
|
54
|
+
const DEFAULT_CRITERIA_KEYS = [
|
|
55
|
+
"sources",
|
|
56
|
+
"page_ids",
|
|
57
|
+
"has_fb_ads",
|
|
58
|
+
"agents_in_room",
|
|
59
|
+
"assigned",
|
|
60
|
+
"range_date"
|
|
61
|
+
];
|
|
62
|
+
const RAW_SOCIAL_PAGE_SOURCE_ALIASES = {
|
|
63
|
+
"tiktok-business": ChatFilterSource.Tiktok,
|
|
64
|
+
"tiktok-shop": ChatFilterSource.TiktokShop
|
|
65
|
+
};
|
|
66
|
+
const normalizeSocialPageSource = (source) => RAW_SOCIAL_PAGE_SOURCE_ALIASES[source] ?? source;
|
|
67
|
+
function FilterChat({ onClearKeyword }) {
|
|
68
|
+
const { t } = useTranslation();
|
|
69
|
+
const formRef = useRef(null);
|
|
70
|
+
const criteriaScrollRef = useRef(null);
|
|
71
|
+
const [open, setOpen] = useState(false);
|
|
72
|
+
const [highlightCriteriaKey, setHighlightCriteriaKey] = useState(null);
|
|
73
|
+
const [criteriaResetSignal, setCriteriaResetSignal] = useState(0);
|
|
74
|
+
const bumpCriteriaResetSignal = () => setCriteriaResetSignal((prev) => prev + 1);
|
|
75
|
+
const { data: socialPageList } = useGetListSocialPage();
|
|
76
|
+
const [
|
|
77
|
+
filterState,
|
|
78
|
+
setFilterState,
|
|
79
|
+
selectedFilterId,
|
|
80
|
+
setSelectedFilterId,
|
|
81
|
+
currentChatTab,
|
|
82
|
+
setCurrentChatTab,
|
|
83
|
+
unreadReceivedTab,
|
|
84
|
+
notReceivedTab,
|
|
85
|
+
closedTab
|
|
86
|
+
] = useChatStore(
|
|
87
|
+
useShallow((state) => [
|
|
88
|
+
state.filterState,
|
|
89
|
+
state.setFilterState,
|
|
90
|
+
state.selectedFilterId,
|
|
91
|
+
state.setSelectedFilterId,
|
|
92
|
+
state.currentChatTab,
|
|
93
|
+
state.setCurrentChatTab,
|
|
94
|
+
state.unreadReceivedTab,
|
|
95
|
+
state.notReceivedTab,
|
|
96
|
+
state.closedTab
|
|
97
|
+
])
|
|
98
|
+
);
|
|
99
|
+
const aliasMap = useChatStore((state) => state.aliasMap);
|
|
100
|
+
const statusTabs = useChatDisplayConfigStore(useShallow(selectStatusTabs));
|
|
101
|
+
const sourceOptions = ChatFilterSourceOptions;
|
|
102
|
+
const [keyword, setKeyword] = useState(filterState.keyword);
|
|
103
|
+
const form = useForm({
|
|
104
|
+
resolver: zodResolver(formSchema),
|
|
105
|
+
mode: "onSubmit",
|
|
106
|
+
defaultValues: filterState
|
|
107
|
+
});
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!open) return;
|
|
110
|
+
if (!selectedFilterId && !activePredefinedChipId) return;
|
|
111
|
+
form.reset(useChatStore.getState().filterState);
|
|
112
|
+
bumpCriteriaResetSignal();
|
|
113
|
+
}, [open]);
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!open) return;
|
|
116
|
+
if (!selectedFilterId) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
getQuickFilterById({ id: selectedFilterId }).catch((error) => {
|
|
120
|
+
if (error?.response?.status === 404) {
|
|
121
|
+
setSelectedFilterId(null);
|
|
122
|
+
form.reset(DEFAULT_FILTER_STATE);
|
|
123
|
+
setFilterState(DEFAULT_FILTER_STATE);
|
|
124
|
+
} else {
|
|
125
|
+
throwException(error);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, [open]);
|
|
129
|
+
const applyKeyword = useCallback(
|
|
130
|
+
(value) => {
|
|
131
|
+
const { filterState: current, setFilterState: apply } = useChatStore.getState();
|
|
132
|
+
if (value === current.keyword) return;
|
|
133
|
+
apply({ ...form.getValues(), keyword: value });
|
|
134
|
+
},
|
|
135
|
+
[form]
|
|
136
|
+
);
|
|
137
|
+
const applyKeywordDebounced = useMemo(
|
|
138
|
+
() => debounce(applyKeyword, CHAT_SEARCH_DEBOUNCE_MS),
|
|
139
|
+
[applyKeyword]
|
|
140
|
+
);
|
|
141
|
+
useEffect(() => () => applyKeywordDebounced.cancel(), [applyKeywordDebounced]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
form.setValue("sources", filterState.sources);
|
|
144
|
+
}, [filterState.sources]);
|
|
145
|
+
const hasKeyword = keyword.trim().length > 0;
|
|
146
|
+
const handleKeywordChange = (value) => {
|
|
147
|
+
setKeyword(value);
|
|
148
|
+
if (value && value.length < 3) {
|
|
149
|
+
applyKeywordDebounced.cancel();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
applyKeywordDebounced(value);
|
|
153
|
+
};
|
|
154
|
+
const handleCloseSearch = () => {
|
|
155
|
+
applyKeywordDebounced.cancel();
|
|
156
|
+
setKeyword("");
|
|
157
|
+
const hadAppliedKeyword = !!filterState.keyword;
|
|
158
|
+
applyKeyword("");
|
|
159
|
+
if (hadAppliedKeyword) onClearKeyword?.();
|
|
160
|
+
};
|
|
161
|
+
const hasFilter = useMemo(() => {
|
|
162
|
+
return !filterState.sources.includes("all") || filterState.read_statuses.length > 0 || filterState.agents_in_room.length > 0 || filterState.assigned || filterState.tags.length > 0 || filterState.personal_tags?.length > 0 || filterState.page_ids.length > 0 || filterState.phone_status && filterState.phone_status !== "all" || !!filterState.is_sla_violated || filterState.has_fb_ads !== void 0 && filterState.has_fb_ads !== "all" || filterState.ad_id && filterState.ad_id.trim().length > 0 || filterState.range_date.from && filterState.range_date.to || filterState.has_chatbot && filterState.has_chatbot !== "all" || filterState.is_unanswered && filterState.is_unanswered !== "all" || filterState.is_group && filterState.is_group !== "all" || !!filterState.is_unhandled || filterState.group_ids?.length > 0 || !!filterState.crm_type;
|
|
163
|
+
}, [filterState]);
|
|
164
|
+
const activePredefinedChipId = useMemo(
|
|
165
|
+
() => PREDEFINED_FILTER_CHIPS.find((chip) => chip.isActive(filterState))?.id,
|
|
166
|
+
[filterState]
|
|
167
|
+
);
|
|
168
|
+
const onSubmit = (payload) => {
|
|
169
|
+
setFilterState(payload);
|
|
170
|
+
if (selectedFilterId || activePredefinedChipId) setSelectedFilterId(null);
|
|
171
|
+
};
|
|
172
|
+
const handleResetForm = () => {
|
|
173
|
+
const keepSavedFilter = selectedFilterId && !activePredefinedChipId;
|
|
174
|
+
form.reset(keepSavedFilter ? void 0 : DEFAULT_FILTER_STATE);
|
|
175
|
+
bumpCriteriaResetSignal();
|
|
176
|
+
setFilterState({ ...form.getValues(), keyword: filterState.keyword });
|
|
177
|
+
if (!keepSavedFilter && selectedFilterId) setSelectedFilterId(null);
|
|
178
|
+
};
|
|
179
|
+
const handleCancelForm = () => {
|
|
180
|
+
form.reset(filterState);
|
|
181
|
+
setOpen(false);
|
|
182
|
+
};
|
|
183
|
+
const filterSources = useWatch({
|
|
184
|
+
control: form.control,
|
|
185
|
+
name: "sources"
|
|
186
|
+
});
|
|
187
|
+
const filterSocialPageList = useMemo(() => {
|
|
188
|
+
const toOption = (option) => ({
|
|
189
|
+
label: maskData(
|
|
190
|
+
aliasMap[`${option.source}:${option.page_id}`] ?? option.page_name
|
|
191
|
+
),
|
|
192
|
+
value: option.page_id,
|
|
193
|
+
source: normalizeSocialPageSource(option.source)
|
|
194
|
+
});
|
|
195
|
+
if (filterSources.includes("all")) {
|
|
196
|
+
return (socialPageList ?? []).map(toOption);
|
|
197
|
+
}
|
|
198
|
+
return (socialPageList ?? []).filter(
|
|
199
|
+
(option) => filterSources.includes(normalizeSocialPageSource(option.source))
|
|
200
|
+
).map(toOption);
|
|
201
|
+
}, [filterSources, socialPageList, aliasMap]);
|
|
202
|
+
const criteriaFieldDefs = useMemo(
|
|
203
|
+
() => buildCriteriaFields({
|
|
204
|
+
form,
|
|
205
|
+
sourceOptions,
|
|
206
|
+
filterSocialPageList,
|
|
207
|
+
includePersonal: true
|
|
208
|
+
}),
|
|
209
|
+
[form, sourceOptions, filterSocialPageList]
|
|
210
|
+
);
|
|
211
|
+
const criteriaFieldMap = useMemo(() => {
|
|
212
|
+
const map = {};
|
|
213
|
+
criteriaFieldDefs.forEach((f) => {
|
|
214
|
+
map[f.key] = f;
|
|
215
|
+
});
|
|
216
|
+
return map;
|
|
217
|
+
}, [criteriaFieldDefs]);
|
|
218
|
+
const [activeCriteriaKeys, setActiveCriteriaKeys] = useState([]);
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const activeKeys = getActiveCriteriaKeys(
|
|
221
|
+
criteriaFieldDefs,
|
|
222
|
+
form.getValues()
|
|
223
|
+
);
|
|
224
|
+
const mergedKeys = [
|
|
225
|
+
...DEFAULT_CRITERIA_KEYS,
|
|
226
|
+
...activeKeys.filter((key) => !DEFAULT_CRITERIA_KEYS.includes(key))
|
|
227
|
+
];
|
|
228
|
+
setActiveCriteriaKeys(mergedKeys);
|
|
229
|
+
}, [criteriaResetSignal]);
|
|
230
|
+
const remainingCriteriaFieldDefs = criteriaFieldDefs.filter(
|
|
231
|
+
(f) => !activeCriteriaKeys.includes(f.key)
|
|
232
|
+
);
|
|
233
|
+
const handleAddCriteria = (key) => {
|
|
234
|
+
if (!key || activeCriteriaKeys.includes(key)) return;
|
|
235
|
+
setActiveCriteriaKeys((prev) => [...prev, key]);
|
|
236
|
+
setHighlightCriteriaKey(null);
|
|
237
|
+
requestAnimationFrame(() => setHighlightCriteriaKey(key));
|
|
238
|
+
};
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
if (!highlightCriteriaKey) return;
|
|
241
|
+
const container = criteriaScrollRef.current;
|
|
242
|
+
const el = container?.querySelector(
|
|
243
|
+
`[data-criteria-key="${highlightCriteriaKey}"]`
|
|
244
|
+
);
|
|
245
|
+
if (container && el) {
|
|
246
|
+
const buffer = 16;
|
|
247
|
+
const containerRect = container.getBoundingClientRect();
|
|
248
|
+
const elRect = el.getBoundingClientRect();
|
|
249
|
+
if (elRect.bottom > containerRect.bottom - buffer) {
|
|
250
|
+
container.scrollBy({
|
|
251
|
+
top: elRect.bottom - containerRect.bottom + buffer,
|
|
252
|
+
behavior: "smooth"
|
|
253
|
+
});
|
|
254
|
+
} else if (elRect.top < containerRect.top + buffer) {
|
|
255
|
+
container.scrollBy({
|
|
256
|
+
top: elRect.top - containerRect.top - buffer,
|
|
257
|
+
behavior: "smooth"
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
const timer = setTimeout(() => setHighlightCriteriaKey(null), 1200);
|
|
262
|
+
return () => clearTimeout(timer);
|
|
263
|
+
}, [highlightCriteriaKey]);
|
|
264
|
+
const handleRemoveCriteria = (key) => {
|
|
265
|
+
criteriaFieldMap[key]?.reset();
|
|
266
|
+
setActiveCriteriaKeys((prev) => prev.filter((k) => k !== key));
|
|
267
|
+
};
|
|
268
|
+
const handleChangeCriteriaType = (oldKey, newKey) => {
|
|
269
|
+
if (oldKey === newKey) return;
|
|
270
|
+
criteriaFieldMap[oldKey]?.reset();
|
|
271
|
+
setActiveCriteriaKeys(
|
|
272
|
+
(prev) => prev.map((k) => k === oldKey ? newKey : k)
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
const tabCounts = { unreadReceivedTab, notReceivedTab, closedTab };
|
|
276
|
+
const visibleTabs = useMemo(
|
|
277
|
+
() => CHAT_TAB_CONFIGS.filter((tab) => statusTabs.includes(tab.value)),
|
|
278
|
+
[statusTabs]
|
|
279
|
+
);
|
|
280
|
+
useEffect(() => {
|
|
281
|
+
if (!visibleTabs.length) return;
|
|
282
|
+
if (visibleTabs.some((tab) => tab.value === currentChatTab)) return;
|
|
283
|
+
setCurrentChatTab(visibleTabs[0].value);
|
|
284
|
+
}, [visibleTabs, currentChatTab, setCurrentChatTab]);
|
|
285
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ jsxs("div", { className: "mx-auto flex w-[95%] flex-row items-center gap-2", children: [
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
SearchInput,
|
|
289
|
+
{
|
|
290
|
+
className: "flex-1 text-xs",
|
|
291
|
+
placeholder: t("chat:placeholder.searchConversation", {
|
|
292
|
+
defaultValue: "T\xECm ki\u1EBFm h\u1ED9i tho\u1EA1i (theo n\u1ED9i dung, s\u1ED1 \u0111i\u1EC7n tho\u1EA1i,...)"
|
|
293
|
+
}),
|
|
294
|
+
value: keyword,
|
|
295
|
+
onChange: (e) => handleKeywordChange(e.target.value)
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
hasKeyword ? /* @__PURE__ */ jsx(
|
|
299
|
+
Button,
|
|
300
|
+
{
|
|
301
|
+
type: "button",
|
|
302
|
+
variant: "ghost",
|
|
303
|
+
size: "sm",
|
|
304
|
+
className: "shrink-0 px-2 text-sm font-normal text-muted-foreground hover:text-foreground",
|
|
305
|
+
onClick: handleCloseSearch,
|
|
306
|
+
children: t("common:action.close", { defaultValue: "\u0110\xF3ng" })
|
|
307
|
+
}
|
|
308
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
309
|
+
/* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
310
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
311
|
+
Button,
|
|
312
|
+
{
|
|
313
|
+
type: "button",
|
|
314
|
+
size: "icon",
|
|
315
|
+
className: cn(
|
|
316
|
+
"rounded-md p-2",
|
|
317
|
+
hasFilter && "border-primary/40 bg-secondary text-primary hover:bg-secondary"
|
|
318
|
+
),
|
|
319
|
+
variant: "outline",
|
|
320
|
+
children: /* @__PURE__ */ jsx(
|
|
321
|
+
SlidersHorizontal,
|
|
322
|
+
{
|
|
323
|
+
className: "h-4 w-4 cursor-pointer",
|
|
324
|
+
onClick: () => {
|
|
325
|
+
setOpen(true);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
}
|
|
330
|
+
) }),
|
|
331
|
+
/* @__PURE__ */ jsxs(
|
|
332
|
+
PopoverContent,
|
|
333
|
+
{
|
|
334
|
+
className: "flex max-h-[min(600px,60vh)] w-[92vw] max-w-[92vw] flex-col space-y-3 overflow-hidden rounded-xl p-0 sm:w-[700px] sm:min-w-[480px] sm:max-w-[90vw]",
|
|
335
|
+
side: "bottom",
|
|
336
|
+
align: "start",
|
|
337
|
+
children: [
|
|
338
|
+
/* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-10 space-y-1 bg-card px-[22px] pb-1.5 pt-[18px]", children: [
|
|
339
|
+
/* @__PURE__ */ jsx("h1", { className: "text-lg font-bold tracking-[-0.18px] text-foreground", children: t("common:label.filter", { defaultValue: "B\u1ED9 l\u1ECDc" }) }),
|
|
340
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("chat:message.addConditionToFilterConversations", {
|
|
341
|
+
defaultValue: "Th\xEAm \u0111i\u1EC1u ki\u1EC7n \u0111\u1EC3 l\u1ECDc ch\xEDnh x\xE1c h\u1ED9i tho\u1EA1i. L\u01B0u l\u1EA1i th\xE0nh m\u1ED9t b\u1ED9\n l\u1ECDc \u0111\u1EC3 m\u1EDF nhanh \u1EDF l\u1EA7n sau."
|
|
342
|
+
}) })
|
|
343
|
+
] }),
|
|
344
|
+
/* @__PURE__ */ jsx(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
ref: criteriaScrollRef,
|
|
348
|
+
className: "scroll-container-thin flex-1 overflow-auto border-b border-border-subtle px-[22px] pb-4 pt-0.5",
|
|
349
|
+
children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsx("form", { ref: formRef, onSubmit: form.handleSubmit(onSubmit), children: /* @__PURE__ */ jsx(
|
|
350
|
+
FilterCriteriaRows,
|
|
351
|
+
{
|
|
352
|
+
form,
|
|
353
|
+
sourceOptions,
|
|
354
|
+
filterSocialPageList,
|
|
355
|
+
includePersonal: true,
|
|
356
|
+
activeKeys: activeCriteriaKeys,
|
|
357
|
+
onRemoveCriteria: handleRemoveCriteria,
|
|
358
|
+
onChangeCriteriaType: handleChangeCriteriaType
|
|
359
|
+
}
|
|
360
|
+
) }) })
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 px-[22px] pb-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3.5", children: [
|
|
365
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
366
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
367
|
+
Button,
|
|
368
|
+
{
|
|
369
|
+
type: "button",
|
|
370
|
+
variant: "link",
|
|
371
|
+
disabled: remainingCriteriaFieldDefs.length === 0,
|
|
372
|
+
className: "h-auto gap-1 p-0 text-xs font-semibold text-primary disabled:no-underline",
|
|
373
|
+
children: [
|
|
374
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
375
|
+
t("common:action.addFilterCriteria", {
|
|
376
|
+
defaultValue: "Th\xEAm ti\xEAu ch\xED l\u1ECDc"
|
|
377
|
+
})
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
) }),
|
|
381
|
+
/* @__PURE__ */ jsx(
|
|
382
|
+
DropdownMenuContent,
|
|
383
|
+
{
|
|
384
|
+
align: "start",
|
|
385
|
+
className: "max-h-[var(--radix-dropdown-menu-content-available-height,24rem)] overflow-y-auto",
|
|
386
|
+
children: remainingCriteriaFieldDefs.map((option) => /* @__PURE__ */ jsx(
|
|
387
|
+
DropdownMenuItem,
|
|
388
|
+
{
|
|
389
|
+
onClick: () => handleAddCriteria(option.key),
|
|
390
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
391
|
+
option.icon,
|
|
392
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
|
|
393
|
+
] })
|
|
394
|
+
},
|
|
395
|
+
option.key
|
|
396
|
+
))
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
] }),
|
|
400
|
+
/* @__PURE__ */ jsx("div", { className: "h-[18px] w-px shrink-0 bg-border-subtle" }),
|
|
401
|
+
/* @__PURE__ */ jsxs(
|
|
402
|
+
Button,
|
|
403
|
+
{
|
|
404
|
+
type: "button",
|
|
405
|
+
variant: "link",
|
|
406
|
+
className: "h-auto gap-1.5 p-0 text-xs font-semibold text-primary",
|
|
407
|
+
disabled: !form.formState.isDirty && !activePredefinedChipId,
|
|
408
|
+
onClick: handleResetForm,
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "h-4 w-4" }),
|
|
411
|
+
t("common:action.reset", { defaultValue: "\u0110\u1EB7t l\u1EA1i" })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
] }),
|
|
416
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
417
|
+
/* @__PURE__ */ jsx(
|
|
418
|
+
Button,
|
|
419
|
+
{
|
|
420
|
+
size: "sm",
|
|
421
|
+
type: "button",
|
|
422
|
+
variant: "outline",
|
|
423
|
+
onClick: handleCancelForm,
|
|
424
|
+
children: t("common:action.cancelAlt", { defaultValue: "Hu\u1EF7" })
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
/* @__PURE__ */ jsx(
|
|
428
|
+
SaveFilterPopover,
|
|
429
|
+
{
|
|
430
|
+
trigger: /* @__PURE__ */ jsx(Button, { size: "sm", type: "button", variant: "outline", children: t("chat:action.saveAsNewFilter", {
|
|
431
|
+
defaultValue: "L\u01B0u th\xE0nh b\u1ED9 l\u1ECDc m\u1EDBi"
|
|
432
|
+
}) }),
|
|
433
|
+
getFilterValues: () => form.getValues()
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ jsx(
|
|
437
|
+
Button,
|
|
438
|
+
{
|
|
439
|
+
size: "sm",
|
|
440
|
+
type: "button",
|
|
441
|
+
onClick: () => formRef.current.requestSubmit(),
|
|
442
|
+
children: t("common:action.apply", { defaultValue: "\xC1p d\u1EE5ng" })
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
] })
|
|
446
|
+
] })
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ jsx(ChatSortMenu, {})
|
|
452
|
+
] })
|
|
453
|
+
] }),
|
|
454
|
+
/* @__PURE__ */ jsx(
|
|
455
|
+
Tabs,
|
|
456
|
+
{
|
|
457
|
+
value: currentChatTab,
|
|
458
|
+
onValueChange: setCurrentChatTab,
|
|
459
|
+
className: "mt-2 w-full min-w-0",
|
|
460
|
+
children: /* @__PURE__ */ jsx("div", { className: "scroll-container-hide w-full overflow-x-auto", children: /* @__PURE__ */ jsx(TabsList, { className: "m-0 flex h-auto w-max !bg-transparent !p-0", children: visibleTabs.map((tab) => {
|
|
461
|
+
const count = tabCounts[tab.countKey]?.total ?? 0;
|
|
462
|
+
return /* @__PURE__ */ jsx(
|
|
463
|
+
TabsTrigger,
|
|
464
|
+
{
|
|
465
|
+
value: tab.value,
|
|
466
|
+
onClick: (e) => e.currentTarget.scrollIntoView({
|
|
467
|
+
behavior: "smooth",
|
|
468
|
+
inline: "nearest",
|
|
469
|
+
block: "nearest"
|
|
470
|
+
}),
|
|
471
|
+
className: cn(
|
|
472
|
+
"group shrink-0 whitespace-nowrap rounded-none px-4 pb-2 !text-sm",
|
|
473
|
+
"border-b-2 border-solid !bg-transparent !shadow-none",
|
|
474
|
+
"transition-all duration-200 ease-in-out",
|
|
475
|
+
currentChatTab === tab.value ? "border-primary !text-primary" : "border-transparent text-foreground hover:border-border hover:text-muted-foreground"
|
|
476
|
+
),
|
|
477
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 font-normal", children: [
|
|
478
|
+
tab.label(t),
|
|
479
|
+
/* @__PURE__ */ jsx(
|
|
480
|
+
"span",
|
|
481
|
+
{
|
|
482
|
+
className: cn(
|
|
483
|
+
"inline-flex min-h-[18px] items-center justify-center rounded-full",
|
|
484
|
+
"px-2 text-xs leading-none",
|
|
485
|
+
currentChatTab === tab.value ? "bg-secondary font-medium text-primary" : "bg-border-subtle font-normal text-foreground"
|
|
486
|
+
),
|
|
487
|
+
children: count
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
] })
|
|
491
|
+
},
|
|
492
|
+
tab.value
|
|
493
|
+
);
|
|
494
|
+
}) }) })
|
|
495
|
+
}
|
|
496
|
+
)
|
|
497
|
+
] });
|
|
498
|
+
}
|
|
499
|
+
export {
|
|
500
|
+
FilterChat as default
|
|
501
|
+
};
|