@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,845 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useFormState } from "react-hook-form";
|
|
4
|
+
import { isSameDay } from "date-fns";
|
|
5
|
+
import { Info, Trash2 } from "lucide-react";
|
|
6
|
+
import { FormControl, FormField } from "../../ui/form.js";
|
|
7
|
+
import { Input } from "../../ui/input.js";
|
|
8
|
+
import {
|
|
9
|
+
Tooltip,
|
|
10
|
+
TooltipContent,
|
|
11
|
+
TooltipProvider,
|
|
12
|
+
TooltipTrigger
|
|
13
|
+
} from "../../ui/tooltip.js";
|
|
14
|
+
import MultipleSelector from "../../custom/multiple-selector.js";
|
|
15
|
+
import MultipleSelectSettingTags from "../../custom/multiple-select-setting-tags.js";
|
|
16
|
+
import DateTimePicker from "../../custom/date-time-picker/index.js";
|
|
17
|
+
import { Combobox } from "../../custom/combobox.js";
|
|
18
|
+
import { CustomSelect } from "../../custom/custom-select.js";
|
|
19
|
+
import PostIdsField from "./post-ids-field.js";
|
|
20
|
+
import {
|
|
21
|
+
Select,
|
|
22
|
+
SelectContent,
|
|
23
|
+
SelectItem,
|
|
24
|
+
SelectTrigger,
|
|
25
|
+
SelectValue
|
|
26
|
+
} from "../../ui/select.js";
|
|
27
|
+
import { searchUser } from "@zenify-omni/chat-js/api/user.js";
|
|
28
|
+
import { cn } from "../../../lib/utils.js";
|
|
29
|
+
import { SettingTags } from "@zenify-omni/chat-js/constants/setting.js";
|
|
30
|
+
import {
|
|
31
|
+
ChatFilterSourceLabel,
|
|
32
|
+
ChatFilterStatusOptions
|
|
33
|
+
} from "@zenify-omni/chat-js/constants/chat-message.js";
|
|
34
|
+
import {
|
|
35
|
+
CRM_TYPE_OPTIONS,
|
|
36
|
+
DATE_FILTER_TYPE_OPTIONS,
|
|
37
|
+
DateFilterType,
|
|
38
|
+
HAS_FB_ADS_OPTIONS,
|
|
39
|
+
IS_GROUP_OPTIONS,
|
|
40
|
+
IS_UNHANDLED_OPTIONS,
|
|
41
|
+
PHONE_STATUS_OPTIONS,
|
|
42
|
+
TAG_MATCH_MODE_OPTIONS,
|
|
43
|
+
TagMatchMode
|
|
44
|
+
} from "./util.js";
|
|
45
|
+
import FilterGroupSelect from "./filter-group-select.js";
|
|
46
|
+
import {
|
|
47
|
+
getUser,
|
|
48
|
+
isAdmin,
|
|
49
|
+
isSupervisor,
|
|
50
|
+
isRoleTeamLeader,
|
|
51
|
+
isRoleTeamLeaderSale
|
|
52
|
+
} from "@zenify-omni/chat-js/utils/auth.js";
|
|
53
|
+
import i18n from "@zenify-omni/chat-js/lib/i18n/index.js";
|
|
54
|
+
const IS_UNANSWERED_OPTIONS = [
|
|
55
|
+
{
|
|
56
|
+
value: "true",
|
|
57
|
+
get label() {
|
|
58
|
+
return i18n.t("chat:status.unanswered", {
|
|
59
|
+
defaultValue: "Ch\u01B0a tr\u1EA3 l\u1EDDi"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: "false",
|
|
65
|
+
get label() {
|
|
66
|
+
return i18n.t("common:status.replied", {
|
|
67
|
+
defaultValue: "\u0110\xE3 tr\u1EA3 l\u1EDDi"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
const boolToSelectValue = (value) => {
|
|
73
|
+
switch (value) {
|
|
74
|
+
case true:
|
|
75
|
+
return "true";
|
|
76
|
+
case false:
|
|
77
|
+
return "false";
|
|
78
|
+
case "post":
|
|
79
|
+
return "post";
|
|
80
|
+
default:
|
|
81
|
+
return "all";
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const selectValueToBool = (value) => {
|
|
85
|
+
switch (value) {
|
|
86
|
+
case "true":
|
|
87
|
+
return true;
|
|
88
|
+
case "false":
|
|
89
|
+
return false;
|
|
90
|
+
case "post":
|
|
91
|
+
return "post";
|
|
92
|
+
default:
|
|
93
|
+
return "all";
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function RangeDateMessage({ control }) {
|
|
97
|
+
const { errors } = useFormState({ control, name: "range_date.from" });
|
|
98
|
+
const message = errors?.range_date?.from?.message;
|
|
99
|
+
if (!message) return null;
|
|
100
|
+
return /* @__PURE__ */ jsx("p", { className: "text-[0.8rem] text-destructive", children: message });
|
|
101
|
+
}
|
|
102
|
+
function buildCriteriaFields({
|
|
103
|
+
form,
|
|
104
|
+
sourceOptions,
|
|
105
|
+
filterSocialPageList,
|
|
106
|
+
includePersonal
|
|
107
|
+
}) {
|
|
108
|
+
const user = getUser();
|
|
109
|
+
const searchUserParams = () => {
|
|
110
|
+
const groupIds = (form.getValues("group_ids") || []).filter(Boolean);
|
|
111
|
+
if (groupIds.length > 0) {
|
|
112
|
+
return { group_ids: JSON.stringify(groupIds.map(Number)) };
|
|
113
|
+
}
|
|
114
|
+
return isRoleTeamLeader() || isRoleTeamLeaderSale() ? { group_id: user.group_id } : {};
|
|
115
|
+
};
|
|
116
|
+
const canFilterByDepartment = isAdmin() || isSupervisor() || isRoleTeamLeader() || isRoleTeamLeaderSale();
|
|
117
|
+
const fields = [
|
|
118
|
+
{
|
|
119
|
+
key: "read_statuses",
|
|
120
|
+
label: i18n.t("chat:label.conversationStatus", {
|
|
121
|
+
defaultValue: "Tr\u1EA1ng th\xE1i cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
122
|
+
}),
|
|
123
|
+
isActive: (v) => v.read_statuses?.length > 0,
|
|
124
|
+
reset: () => form.setValue("read_statuses", []),
|
|
125
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
126
|
+
FormField,
|
|
127
|
+
{
|
|
128
|
+
control: form.control,
|
|
129
|
+
name: "read_statuses",
|
|
130
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
131
|
+
MultipleSelector,
|
|
132
|
+
{
|
|
133
|
+
...field,
|
|
134
|
+
placeholder: i18n.t("chat:field.selectConversationStatus", {
|
|
135
|
+
defaultValue: "Ch\u1ECDn tr\u1EA1ng th\xE1i cu\u1ED9c h\u1ED9i tho\u1EA1i"
|
|
136
|
+
}),
|
|
137
|
+
inputProps: { tabIndex: -1, className: "px-1" },
|
|
138
|
+
options: ChatFilterStatusOptions,
|
|
139
|
+
commandProps: {
|
|
140
|
+
filter: (value, search, keywords) => keywords[0].toLowerCase().includes(search.trim().toLowerCase())
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
) })
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: "sources",
|
|
149
|
+
label: i18n.t("chat:filter.filterBySource", {
|
|
150
|
+
defaultValue: "L\u1ECDc theo ngu\u1ED3n"
|
|
151
|
+
}),
|
|
152
|
+
isActive: (v) => !v.sources?.includes("all"),
|
|
153
|
+
reset: () => {
|
|
154
|
+
form.setValue("sources", ["all"]);
|
|
155
|
+
form.setValue("page_ids", []);
|
|
156
|
+
form.setValue("ad_id", "");
|
|
157
|
+
},
|
|
158
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
159
|
+
FormField,
|
|
160
|
+
{
|
|
161
|
+
control: form.control,
|
|
162
|
+
name: "sources",
|
|
163
|
+
render: ({ field }) => {
|
|
164
|
+
const realOptions = sourceOptions.filter((o) => o.value !== "all");
|
|
165
|
+
const selected = realOptions.filter(
|
|
166
|
+
(o) => field.value.includes(o.value)
|
|
167
|
+
);
|
|
168
|
+
return /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
169
|
+
MultipleSelector,
|
|
170
|
+
{
|
|
171
|
+
value: selected,
|
|
172
|
+
placeholder: i18n.t("chat:placeholder.selectSource", {
|
|
173
|
+
defaultValue: "Ch\u1ECDn ngu\u1ED3n"
|
|
174
|
+
}),
|
|
175
|
+
inputProps: { className: "px-1" },
|
|
176
|
+
options: realOptions,
|
|
177
|
+
onChange: (next) => {
|
|
178
|
+
const newSources = next.map((o) => o.value);
|
|
179
|
+
if (!newSources.length) {
|
|
180
|
+
field.onChange(["all"]);
|
|
181
|
+
form.setValue("page_ids", []);
|
|
182
|
+
form.setValue("ad_id", "");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
field.onChange(newSources);
|
|
186
|
+
const newPageIds = form.getValues("page_ids").filter((p) => newSources.includes(p.source));
|
|
187
|
+
form.setValue("page_ids", newPageIds);
|
|
188
|
+
if (!newSources.includes("facebook")) {
|
|
189
|
+
form.setValue("ad_id", "");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
) });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: "has_fb_ads",
|
|
200
|
+
label: i18n.t("campaign:field.messageType", {
|
|
201
|
+
defaultValue: "Lo\u1EA1i tin nh\u1EAFn"
|
|
202
|
+
}),
|
|
203
|
+
isActive: (v) => v.has_fb_ads !== void 0 && v.has_fb_ads !== "all",
|
|
204
|
+
reset: () => {
|
|
205
|
+
form.setValue("has_fb_ads", "all");
|
|
206
|
+
form.setValue("ad_id", "");
|
|
207
|
+
form.setValue("post_ids", []);
|
|
208
|
+
},
|
|
209
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
210
|
+
FormField,
|
|
211
|
+
{
|
|
212
|
+
control: form.control,
|
|
213
|
+
name: "has_fb_ads",
|
|
214
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
|
|
215
|
+
Select,
|
|
216
|
+
{
|
|
217
|
+
value: boolToSelectValue(field.value) === "all" ? "" : boolToSelectValue(field.value),
|
|
218
|
+
onValueChange: (value) => {
|
|
219
|
+
const boolValue = selectValueToBool(value);
|
|
220
|
+
field.onChange(boolValue);
|
|
221
|
+
if (boolValue !== true) form.setValue("ad_id", "");
|
|
222
|
+
if (boolValue !== "post") form.setValue("post_ids", []);
|
|
223
|
+
},
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx(
|
|
226
|
+
SelectTrigger,
|
|
227
|
+
{
|
|
228
|
+
className: cn(
|
|
229
|
+
boolToSelectValue(field.value) === "all" && "text-muted-foreground"
|
|
230
|
+
),
|
|
231
|
+
children: /* @__PURE__ */ jsx(
|
|
232
|
+
SelectValue,
|
|
233
|
+
{
|
|
234
|
+
placeholder: i18n.t("chat:placeholder.selectMessageType", {
|
|
235
|
+
defaultValue: "Ch\u1ECDn lo\u1EA1i tin nh\u1EAFn"
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ jsx(SelectContent, { children: HAS_FB_ADS_OPTIONS.filter((o) => o.value !== "all").map(
|
|
242
|
+
(option) => /* @__PURE__ */ jsx(
|
|
243
|
+
SelectItem,
|
|
244
|
+
{
|
|
245
|
+
value: boolToSelectValue(option.value),
|
|
246
|
+
children: option.label
|
|
247
|
+
},
|
|
248
|
+
String(option.value)
|
|
249
|
+
)
|
|
250
|
+
) })
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
) })
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
key: "ad_id",
|
|
259
|
+
label: "Ads ID",
|
|
260
|
+
isActive: (v) => !!v.ad_id && v.ad_id.trim().length > 0,
|
|
261
|
+
reset: () => form.setValue("ad_id", ""),
|
|
262
|
+
renderValue: () => {
|
|
263
|
+
const sources = form.watch("sources");
|
|
264
|
+
const hasFbAds = form.watch("has_fb_ads");
|
|
265
|
+
const enabled = sources.includes("facebook") && hasFbAds === true;
|
|
266
|
+
return /* @__PURE__ */ jsx(
|
|
267
|
+
FormField,
|
|
268
|
+
{
|
|
269
|
+
control: form.control,
|
|
270
|
+
name: "ad_id",
|
|
271
|
+
render: ({ field }) => /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
272
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
273
|
+
Input,
|
|
274
|
+
{
|
|
275
|
+
value: field.value || "",
|
|
276
|
+
onChange: (e) => field.onChange(e.target.value),
|
|
277
|
+
onBlur: field.onBlur,
|
|
278
|
+
disabled: !enabled,
|
|
279
|
+
placeholder: i18n.t("chat:placeholder.adsId", {
|
|
280
|
+
defaultValue: "Nh\u1EADp Ads ID"
|
|
281
|
+
}),
|
|
282
|
+
className: cn("py-2", !enabled && "pr-8")
|
|
283
|
+
}
|
|
284
|
+
) }),
|
|
285
|
+
!enabled && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
TooltipTrigger,
|
|
288
|
+
{
|
|
289
|
+
type: "button",
|
|
290
|
+
className: "absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground",
|
|
291
|
+
children: /* @__PURE__ */ jsx(Info, { className: "h-3.5 w-3.5" })
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: i18n.t("chat:hint.onlyAppliesWhenFacebookAndAds", {
|
|
295
|
+
defaultValue: "Ch\u1EC9 \xE1p d\u1EE5ng khi Ngu\u1ED3n c\xF3 Facebook v\xE0 Lo\u1EA1i tin nh\u1EAFn l\xE0\n Ads"
|
|
296
|
+
}) })
|
|
297
|
+
] }) })
|
|
298
|
+
] })
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
key: "post_ids",
|
|
305
|
+
label: i18n.t("chat:label.post", {
|
|
306
|
+
defaultValue: "B\xE0i vi\u1EBFt"
|
|
307
|
+
}),
|
|
308
|
+
isActive: (v) => v.post_ids?.length > 0,
|
|
309
|
+
reset: () => form.setValue("post_ids", []),
|
|
310
|
+
renderValue: () => /* @__PURE__ */ jsx(PostIdsField, { form })
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
key: "page_ids",
|
|
314
|
+
label: i18n.t("common:label.detailedSource", {
|
|
315
|
+
defaultValue: "Ngu\u1ED3n chi ti\u1EBFt"
|
|
316
|
+
}),
|
|
317
|
+
isActive: (v) => v.page_ids?.length > 0,
|
|
318
|
+
reset: () => form.setValue("page_ids", []),
|
|
319
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
320
|
+
FormField,
|
|
321
|
+
{
|
|
322
|
+
control: form.control,
|
|
323
|
+
name: "page_ids",
|
|
324
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
325
|
+
MultipleSelector,
|
|
326
|
+
{
|
|
327
|
+
...field,
|
|
328
|
+
placeholder: i18n.t("chat:field.selectDetailedSource", {
|
|
329
|
+
defaultValue: "Ch\u1ECDn ngu\u1ED3n chi ti\u1EBFt"
|
|
330
|
+
}),
|
|
331
|
+
inputProps: { className: "px-1" },
|
|
332
|
+
options: filterSocialPageList,
|
|
333
|
+
groupBy: "source",
|
|
334
|
+
renderGroupHeading: (source) => ChatFilterSourceLabel[source],
|
|
335
|
+
commandProps: {
|
|
336
|
+
filter: (value, search, keywords) => keywords.length > 0 && keywords[0].toLowerCase().includes(search.trim().toLowerCase())
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
) })
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "agents_in_room",
|
|
345
|
+
label: i18n.t("common:label.agent", {
|
|
346
|
+
defaultValue: "Chuy\xEAn vi\xEAn"
|
|
347
|
+
}),
|
|
348
|
+
isActive: (v) => v.agents_in_room?.length > 0,
|
|
349
|
+
reset: () => form.setValue("agents_in_room", []),
|
|
350
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
351
|
+
FormField,
|
|
352
|
+
{
|
|
353
|
+
control: form.control,
|
|
354
|
+
name: "agents_in_room",
|
|
355
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
356
|
+
MultipleSelector,
|
|
357
|
+
{
|
|
358
|
+
placeholder: i18n.t("common:placeholder.searchAgent", {
|
|
359
|
+
defaultValue: "Nh\u1EADp \u0111\u1EC3 t\xECm chuy\xEAn vi\xEAn"
|
|
360
|
+
}),
|
|
361
|
+
...field,
|
|
362
|
+
inputProps: { className: "px-1" },
|
|
363
|
+
buildOption: (u) => ({ label: u.name, value: u._id }),
|
|
364
|
+
onSearch: (value) => searchUser({ searchText: value, ...searchUserParams() })
|
|
365
|
+
}
|
|
366
|
+
) })
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
key: "assigned",
|
|
372
|
+
label: i18n.t("common:label.assignee", {
|
|
373
|
+
defaultValue: "Ng\u01B0\u1EDDi ph\u1EE5 tr\xE1ch"
|
|
374
|
+
}),
|
|
375
|
+
isActive: (v) => !!v.assigned,
|
|
376
|
+
reset: () => form.setValue("assigned", null),
|
|
377
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
378
|
+
FormField,
|
|
379
|
+
{
|
|
380
|
+
control: form.control,
|
|
381
|
+
name: "assigned",
|
|
382
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
383
|
+
Combobox,
|
|
384
|
+
{
|
|
385
|
+
searchKey: "assigned",
|
|
386
|
+
placeholder: i18n.t("chat:placeholder.searchAssignee", {
|
|
387
|
+
defaultValue: "Nh\u1EADp \u0111\u1EC3 t\xECm ng\u01B0\u1EDDi ph\u1EE5 tr\xE1ch"
|
|
388
|
+
}),
|
|
389
|
+
...field,
|
|
390
|
+
buildOption: (u) => ({ label: u.name, value: u._id }),
|
|
391
|
+
onSearch: (value) => searchUser({ searchText: value, ...searchUserParams() })
|
|
392
|
+
}
|
|
393
|
+
) })
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
key: "group_ids",
|
|
399
|
+
label: i18n.t("common:label.department", {
|
|
400
|
+
defaultValue: "B\u1ED9 ph\u1EADn"
|
|
401
|
+
}),
|
|
402
|
+
isActive: (v) => v.group_ids?.length > 0,
|
|
403
|
+
reset: () => form.setValue("group_ids", []),
|
|
404
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
405
|
+
FormField,
|
|
406
|
+
{
|
|
407
|
+
control: form.control,
|
|
408
|
+
name: "group_ids",
|
|
409
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
410
|
+
FilterGroupSelect,
|
|
411
|
+
{
|
|
412
|
+
value: field.value || [],
|
|
413
|
+
onChange: field.onChange,
|
|
414
|
+
placeholder: i18n.t("common:placeholder.selectDepartment", {
|
|
415
|
+
defaultValue: "Ch\u1ECDn b\u1ED9 ph\u1EADn"
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
key: "crm_type",
|
|
424
|
+
label: i18n.t("common:label.customerStatus", {
|
|
425
|
+
defaultValue: "Tr\u1EA1ng th\xE1i kh\xE1ch h\xE0ng"
|
|
426
|
+
}),
|
|
427
|
+
isActive: (v) => !!v.crm_type,
|
|
428
|
+
reset: () => form.setValue("crm_type", ""),
|
|
429
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
430
|
+
FormField,
|
|
431
|
+
{
|
|
432
|
+
control: form.control,
|
|
433
|
+
name: "crm_type",
|
|
434
|
+
render: ({ field }) => /* @__PURE__ */ jsx(
|
|
435
|
+
CustomSelect,
|
|
436
|
+
{
|
|
437
|
+
value: field.value,
|
|
438
|
+
onChange: field.onChange,
|
|
439
|
+
options: CRM_TYPE_OPTIONS,
|
|
440
|
+
placeholder: i18n.t("common:placeholder.selectCustomerStatus", {
|
|
441
|
+
defaultValue: "Ch\u1ECDn tr\u1EA1ng th\xE1i kh\xE1ch h\xE0ng"
|
|
442
|
+
})
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
key: "phone_status",
|
|
450
|
+
label: i18n.t("common:label.phone", {
|
|
451
|
+
defaultValue: "S\u1ED1 \u0111i\u1EC7n tho\u1EA1i"
|
|
452
|
+
}),
|
|
453
|
+
isActive: (v) => v.phone_status && v.phone_status !== "all",
|
|
454
|
+
reset: () => form.setValue("phone_status", "all"),
|
|
455
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
456
|
+
FormField,
|
|
457
|
+
{
|
|
458
|
+
control: form.control,
|
|
459
|
+
name: "phone_status",
|
|
460
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
|
|
461
|
+
Select,
|
|
462
|
+
{
|
|
463
|
+
value: field.value === "all" ? "" : field.value,
|
|
464
|
+
onValueChange: field.onChange,
|
|
465
|
+
children: [
|
|
466
|
+
/* @__PURE__ */ jsx(
|
|
467
|
+
SelectTrigger,
|
|
468
|
+
{
|
|
469
|
+
className: cn(
|
|
470
|
+
field.value === "all" && "text-muted-foreground"
|
|
471
|
+
),
|
|
472
|
+
children: /* @__PURE__ */ jsx(
|
|
473
|
+
SelectValue,
|
|
474
|
+
{
|
|
475
|
+
placeholder: i18n.t("chat:placeholder.selectPhoneNumber", {
|
|
476
|
+
defaultValue: "Ch\u1ECDn s\u1ED1 \u0111i\u1EC7n tho\u1EA1i"
|
|
477
|
+
})
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ jsx(SelectContent, { children: PHONE_STATUS_OPTIONS.filter((o) => o.value !== "all").map(
|
|
483
|
+
(option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)
|
|
484
|
+
) })
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
) })
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
key: "is_unanswered",
|
|
493
|
+
label: i18n.t("common:label.answerStatus", {
|
|
494
|
+
defaultValue: "Tr\u1EA1ng th\xE1i tr\u1EA3 l\u1EDDi"
|
|
495
|
+
}),
|
|
496
|
+
isActive: (v) => v.is_unanswered && v.is_unanswered !== "all",
|
|
497
|
+
reset: () => form.setValue("is_unanswered", "all"),
|
|
498
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
499
|
+
FormField,
|
|
500
|
+
{
|
|
501
|
+
control: form.control,
|
|
502
|
+
name: "is_unanswered",
|
|
503
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
|
|
504
|
+
Select,
|
|
505
|
+
{
|
|
506
|
+
value: field.value === "all" ? "" : field.value,
|
|
507
|
+
onValueChange: field.onChange,
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ jsx(
|
|
510
|
+
SelectTrigger,
|
|
511
|
+
{
|
|
512
|
+
className: cn(
|
|
513
|
+
field.value === "all" && "text-muted-foreground"
|
|
514
|
+
),
|
|
515
|
+
children: /* @__PURE__ */ jsx(
|
|
516
|
+
SelectValue,
|
|
517
|
+
{
|
|
518
|
+
placeholder: i18n.t("chat:placeholder.selectReplyStatus", {
|
|
519
|
+
defaultValue: "Ch\u1ECDn tr\u1EA1ng th\xE1i tr\u1EA3 l\u1EDDi"
|
|
520
|
+
})
|
|
521
|
+
}
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
/* @__PURE__ */ jsx(SelectContent, { children: IS_UNANSWERED_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
) })
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
key: "is_group",
|
|
534
|
+
label: i18n.t("common:label.group", {
|
|
535
|
+
defaultValue: "Nh\xF3m"
|
|
536
|
+
}),
|
|
537
|
+
isActive: (v) => v.is_group && v.is_group !== "all",
|
|
538
|
+
reset: () => form.setValue("is_group", "all"),
|
|
539
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
540
|
+
FormField,
|
|
541
|
+
{
|
|
542
|
+
control: form.control,
|
|
543
|
+
name: "is_group",
|
|
544
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
|
|
545
|
+
Select,
|
|
546
|
+
{
|
|
547
|
+
value: field.value === "all" ? "" : field.value,
|
|
548
|
+
onValueChange: field.onChange,
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsx(
|
|
551
|
+
SelectTrigger,
|
|
552
|
+
{
|
|
553
|
+
className: cn(
|
|
554
|
+
field.value === "all" && "text-muted-foreground"
|
|
555
|
+
),
|
|
556
|
+
children: /* @__PURE__ */ jsx(
|
|
557
|
+
SelectValue,
|
|
558
|
+
{
|
|
559
|
+
placeholder: i18n.t("chat:placeholder.selectGroup", {
|
|
560
|
+
defaultValue: "Ch\u1ECDn nh\xF3m"
|
|
561
|
+
})
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
/* @__PURE__ */ jsx(SelectContent, { children: IS_GROUP_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
) })
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
key: "is_unhandled",
|
|
575
|
+
label: i18n.t("chat:label.interaction", {
|
|
576
|
+
defaultValue: "T\u01B0\u01A1ng t\xE1c"
|
|
577
|
+
}),
|
|
578
|
+
isActive: (v) => !!v.is_unhandled,
|
|
579
|
+
reset: () => form.setValue("is_unhandled", ""),
|
|
580
|
+
renderValue: () => /* @__PURE__ */ jsx(
|
|
581
|
+
FormField,
|
|
582
|
+
{
|
|
583
|
+
control: form.control,
|
|
584
|
+
name: "is_unhandled",
|
|
585
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
586
|
+
/* @__PURE__ */ jsx(
|
|
587
|
+
SelectTrigger,
|
|
588
|
+
{
|
|
589
|
+
className: cn(!field.value && "text-muted-foreground"),
|
|
590
|
+
children: /* @__PURE__ */ jsx(
|
|
591
|
+
SelectValue,
|
|
592
|
+
{
|
|
593
|
+
placeholder: i18n.t(
|
|
594
|
+
"chat:placeholder.selectInteractionStatus",
|
|
595
|
+
{ defaultValue: "Ch\u1ECDn tr\u1EA1ng th\xE1i t\u01B0\u01A1ng t\xE1c" }
|
|
596
|
+
)
|
|
597
|
+
}
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ jsx(SelectContent, { children: IS_UNHANDLED_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
602
|
+
] }) })
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
key: "tags",
|
|
608
|
+
label: "Tags",
|
|
609
|
+
isActive: (v) => v.tags?.length > 0,
|
|
610
|
+
reset: () => {
|
|
611
|
+
form.setValue("tags", []);
|
|
612
|
+
form.setValue("tag_match_mode", TagMatchMode.Includes);
|
|
613
|
+
},
|
|
614
|
+
renderValue: () => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
615
|
+
/* @__PURE__ */ jsx(
|
|
616
|
+
FormField,
|
|
617
|
+
{
|
|
618
|
+
control: form.control,
|
|
619
|
+
name: "tag_match_mode",
|
|
620
|
+
render: ({ field }) => {
|
|
621
|
+
const tags = form.watch("tags") || [];
|
|
622
|
+
const disabled = tags.length === 0;
|
|
623
|
+
return /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(
|
|
624
|
+
Select,
|
|
625
|
+
{
|
|
626
|
+
value: field.value || TagMatchMode.Includes,
|
|
627
|
+
onValueChange: field.onChange,
|
|
628
|
+
disabled,
|
|
629
|
+
children: [
|
|
630
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-[110px] shrink-0", children: /* @__PURE__ */ jsx(
|
|
631
|
+
SelectValue,
|
|
632
|
+
{
|
|
633
|
+
placeholder: i18n.t("chat:label.tagMatchMode", {
|
|
634
|
+
defaultValue: "\u0110i\u1EC1u ki\u1EC7n tag"
|
|
635
|
+
})
|
|
636
|
+
}
|
|
637
|
+
) }),
|
|
638
|
+
/* @__PURE__ */ jsx(SelectContent, { children: TAG_MATCH_MODE_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
) });
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
),
|
|
645
|
+
/* @__PURE__ */ jsx(
|
|
646
|
+
FormField,
|
|
647
|
+
{
|
|
648
|
+
control: form.control,
|
|
649
|
+
name: "tags",
|
|
650
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx(
|
|
651
|
+
MultipleSelectSettingTags,
|
|
652
|
+
{
|
|
653
|
+
target: SettingTags.Chat,
|
|
654
|
+
selected: field.value || [],
|
|
655
|
+
onChange: field.onChange,
|
|
656
|
+
placeholder: i18n.t("common:placeholder.selectTags", {
|
|
657
|
+
defaultValue: "Ch\u1ECDn tags"
|
|
658
|
+
}),
|
|
659
|
+
size: "default",
|
|
660
|
+
inputClassName: "my-0",
|
|
661
|
+
includePersonal
|
|
662
|
+
}
|
|
663
|
+
) })
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
] })
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
key: "range_date",
|
|
670
|
+
label: i18n.t("common:label.time", {
|
|
671
|
+
defaultValue: "Th\u1EDDi gian"
|
|
672
|
+
}),
|
|
673
|
+
isActive: (v) => !!(v.range_date?.from || v.range_date?.to),
|
|
674
|
+
reset: () => {
|
|
675
|
+
form.setValue("range_date", { from: null, to: null });
|
|
676
|
+
form.setValue("date_filter_type", DateFilterType.LastMsgTime);
|
|
677
|
+
},
|
|
678
|
+
renderValue: () => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
679
|
+
/* @__PURE__ */ jsx(
|
|
680
|
+
FormField,
|
|
681
|
+
{
|
|
682
|
+
control: form.control,
|
|
683
|
+
name: "date_filter_type",
|
|
684
|
+
render: ({ field }) => /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs(Select, { value: field.value, onValueChange: field.onChange, children: [
|
|
685
|
+
/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(
|
|
686
|
+
SelectValue,
|
|
687
|
+
{
|
|
688
|
+
placeholder: i18n.t("chat:placeholder.selectTimeType", {
|
|
689
|
+
defaultValue: "Ch\u1ECDn lo\u1EA1i th\u1EDDi gian"
|
|
690
|
+
})
|
|
691
|
+
}
|
|
692
|
+
) }),
|
|
693
|
+
/* @__PURE__ */ jsx(SelectContent, { children: DATE_FILTER_TYPE_OPTIONS.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
694
|
+
] }) })
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
698
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
699
|
+
FormField,
|
|
700
|
+
{
|
|
701
|
+
control: form.control,
|
|
702
|
+
name: "range_date.from",
|
|
703
|
+
render: ({ field }) => {
|
|
704
|
+
const toDate = form.watch("range_date.to");
|
|
705
|
+
return /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
706
|
+
DateTimePicker,
|
|
707
|
+
{
|
|
708
|
+
date: field.value,
|
|
709
|
+
onChange: field.onChange,
|
|
710
|
+
classNames: {
|
|
711
|
+
container: "pl-3 pr-6",
|
|
712
|
+
icon: "right-2"
|
|
713
|
+
},
|
|
714
|
+
disabledDate: toDate ? { after: toDate } : void 0,
|
|
715
|
+
disabledHourFunc: (hour) => {
|
|
716
|
+
if (!toDate || !isSameDay(field.value, toDate))
|
|
717
|
+
return false;
|
|
718
|
+
return Number(hour) > toDate.getHours();
|
|
719
|
+
},
|
|
720
|
+
disabledMinuteFunc: (minute) => {
|
|
721
|
+
if (!toDate || !isSameDay(field.value, toDate))
|
|
722
|
+
return false;
|
|
723
|
+
return field.value.getHours() < toDate.getHours() ? false : Number(minute) >= toDate.getMinutes();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
) });
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
) }),
|
|
730
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(
|
|
731
|
+
FormField,
|
|
732
|
+
{
|
|
733
|
+
control: form.control,
|
|
734
|
+
name: "range_date.to",
|
|
735
|
+
render: ({ field }) => {
|
|
736
|
+
const fromDate = form.watch("range_date.from");
|
|
737
|
+
return /* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
738
|
+
DateTimePicker,
|
|
739
|
+
{
|
|
740
|
+
date: field.value,
|
|
741
|
+
onChange: field.onChange,
|
|
742
|
+
classNames: {
|
|
743
|
+
container: "pl-3 pr-6",
|
|
744
|
+
icon: "right-1.5"
|
|
745
|
+
},
|
|
746
|
+
disabledDate: fromDate ? { before: fromDate } : void 0,
|
|
747
|
+
disabledHourFunc: (hour) => {
|
|
748
|
+
if (!fromDate || !isSameDay(field.value, fromDate))
|
|
749
|
+
return false;
|
|
750
|
+
return Number(hour) < fromDate.getHours();
|
|
751
|
+
},
|
|
752
|
+
disabledMinuteFunc: (minute) => {
|
|
753
|
+
if (!fromDate || !isSameDay(field.value, fromDate))
|
|
754
|
+
return false;
|
|
755
|
+
return fromDate.getHours() < field.value.getHours() ? false : Number(minute) <= fromDate.getMinutes();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
) });
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
) })
|
|
762
|
+
] }),
|
|
763
|
+
/* @__PURE__ */ jsx(RangeDateMessage, { control: form.control })
|
|
764
|
+
] })
|
|
765
|
+
}
|
|
766
|
+
];
|
|
767
|
+
return canFilterByDepartment ? fields : fields.filter((field) => field.key !== "group_ids");
|
|
768
|
+
}
|
|
769
|
+
function getActiveCriteriaKeys(fieldDefs, values) {
|
|
770
|
+
return fieldDefs.filter((f) => f.isActive(values)).map((f) => f.key);
|
|
771
|
+
}
|
|
772
|
+
function FilterCriteriaRows({
|
|
773
|
+
form,
|
|
774
|
+
sourceOptions,
|
|
775
|
+
filterSocialPageList,
|
|
776
|
+
includePersonal = false,
|
|
777
|
+
activeKeys,
|
|
778
|
+
onRemoveCriteria,
|
|
779
|
+
onChangeCriteriaType
|
|
780
|
+
}) {
|
|
781
|
+
const fieldDefs = useMemo(
|
|
782
|
+
() => buildCriteriaFields({
|
|
783
|
+
form,
|
|
784
|
+
sourceOptions,
|
|
785
|
+
filterSocialPageList,
|
|
786
|
+
includePersonal
|
|
787
|
+
}),
|
|
788
|
+
[form, sourceOptions, filterSocialPageList, includePersonal]
|
|
789
|
+
);
|
|
790
|
+
const fieldMap = useMemo(() => {
|
|
791
|
+
const map = {};
|
|
792
|
+
fieldDefs.forEach((f) => {
|
|
793
|
+
map[f.key] = f;
|
|
794
|
+
});
|
|
795
|
+
return map;
|
|
796
|
+
}, [fieldDefs]);
|
|
797
|
+
const availableFieldDefs = (excludeKey) => fieldDefs.filter(
|
|
798
|
+
(f) => f.key === excludeKey || !activeKeys.includes(f.key)
|
|
799
|
+
);
|
|
800
|
+
return /* @__PURE__ */ jsx("div", { className: "space-y-2 sm:space-y-3", children: activeKeys.map((key) => {
|
|
801
|
+
const field = fieldMap[key];
|
|
802
|
+
if (!field) return null;
|
|
803
|
+
return /* @__PURE__ */ jsxs(
|
|
804
|
+
"div",
|
|
805
|
+
{
|
|
806
|
+
"data-criteria-key": key,
|
|
807
|
+
className: "flex flex-col gap-1.5 rounded-lg border border-border-subtle p-2 sm:flex-row sm:items-start sm:gap-2 sm:border-0 sm:p-0",
|
|
808
|
+
children: [
|
|
809
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:contents", children: [
|
|
810
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1 sm:flex-initial", children: /* @__PURE__ */ jsxs(
|
|
811
|
+
Select,
|
|
812
|
+
{
|
|
813
|
+
value: key,
|
|
814
|
+
onValueChange: (newKey) => onChangeCriteriaType(key, newKey),
|
|
815
|
+
children: [
|
|
816
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-full sm:w-[240px] sm:shrink-0", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
817
|
+
/* @__PURE__ */ jsx(SelectContent, { children: availableFieldDefs(key).map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.key, children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
818
|
+
option.icon,
|
|
819
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
|
|
820
|
+
] }) }, option.key)) })
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
) }),
|
|
824
|
+
/* @__PURE__ */ jsx(
|
|
825
|
+
"button",
|
|
826
|
+
{
|
|
827
|
+
type: "button",
|
|
828
|
+
className: "shrink-0 text-destructive hover:text-destructive sm:order-1",
|
|
829
|
+
onClick: () => onRemoveCriteria(key),
|
|
830
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
|
|
831
|
+
}
|
|
832
|
+
)
|
|
833
|
+
] }),
|
|
834
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: field.renderValue() })
|
|
835
|
+
]
|
|
836
|
+
},
|
|
837
|
+
key
|
|
838
|
+
);
|
|
839
|
+
}) });
|
|
840
|
+
}
|
|
841
|
+
export {
|
|
842
|
+
buildCriteriaFields,
|
|
843
|
+
FilterCriteriaRows as default,
|
|
844
|
+
getActiveCriteriaKeys
|
|
845
|
+
};
|