@aglyn/plugins-crm 1.0.0-beta.143
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 +201 -0
- package/README.md +7 -0
- package/package.json +57 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +29 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/activity-list.d.ts +98 -0
- package/src/lib/components/activity-list.js +321 -0
- package/src/lib/components/activity-list.js.map +1 -0
- package/src/lib/components/activity-queries.d.ts +117 -0
- package/src/lib/components/activity-queries.js +198 -0
- package/src/lib/components/activity-queries.js.map +1 -0
- package/src/lib/components/add-to-list-button.d.ts +25 -0
- package/src/lib/components/add-to-list-button.js +64 -0
- package/src/lib/components/add-to-list-button.js.map +1 -0
- package/src/lib/components/add-to-list-dialog.d.ts +24 -0
- package/src/lib/components/add-to-list-dialog.js +327 -0
- package/src/lib/components/add-to-list-dialog.js.map +1 -0
- package/src/lib/components/assignment-rule-drawer.d.ts +43 -0
- package/src/lib/components/assignment-rule-drawer.js +293 -0
- package/src/lib/components/assignment-rule-drawer.js.map +1 -0
- package/src/lib/components/companies-bulk-bar.d.ts +29 -0
- package/src/lib/components/companies-bulk-bar.js +274 -0
- package/src/lib/components/companies-bulk-bar.js.map +1 -0
- package/src/lib/components/companies-section.d.ts +54 -0
- package/src/lib/components/companies-section.js +522 -0
- package/src/lib/components/companies-section.js.map +1 -0
- package/src/lib/components/company-contacts-card.d.ts +49 -0
- package/src/lib/components/company-contacts-card.js +435 -0
- package/src/lib/components/company-contacts-card.js.map +1 -0
- package/src/lib/components/company-deals-card.d.ts +20 -0
- package/src/lib/components/company-deals-card.js +38 -0
- package/src/lib/components/company-deals-card.js.map +1 -0
- package/src/lib/components/company-detail-page.d.ts +20 -0
- package/src/lib/components/company-detail-page.js +165 -0
- package/src/lib/components/company-detail-page.js.map +1 -0
- package/src/lib/components/company-edit-drawer.d.ts +65 -0
- package/src/lib/components/company-edit-drawer.js +433 -0
- package/src/lib/components/company-edit-drawer.js.map +1 -0
- package/src/lib/components/company-import-drawer.d.ts +42 -0
- package/src/lib/components/company-import-drawer.js +99 -0
- package/src/lib/components/company-import-drawer.js.map +1 -0
- package/src/lib/components/company-picker.d.ts +127 -0
- package/src/lib/components/company-picker.js +323 -0
- package/src/lib/components/company-picker.js.map +1 -0
- package/src/lib/components/company-properties-card.d.ts +47 -0
- package/src/lib/components/company-properties-card.js +289 -0
- package/src/lib/components/company-properties-card.js.map +1 -0
- package/src/lib/components/contact-address-fields.d.ts +29 -0
- package/src/lib/components/contact-address-fields.js +149 -0
- package/src/lib/components/contact-address-fields.js.map +1 -0
- package/src/lib/components/contact-associations-card.d.ts +72 -0
- package/src/lib/components/contact-associations-card.js +296 -0
- package/src/lib/components/contact-associations-card.js.map +1 -0
- package/src/lib/components/contact-custom-columns.d.ts +38 -0
- package/src/lib/components/contact-custom-columns.js +102 -0
- package/src/lib/components/contact-custom-columns.js.map +1 -0
- package/src/lib/components/contact-custom-fields-card.d.ts +39 -0
- package/src/lib/components/contact-custom-fields-card.js +204 -0
- package/src/lib/components/contact-custom-fields-card.js.map +1 -0
- package/src/lib/components/contact-deals-card.d.ts +20 -0
- package/src/lib/components/contact-deals-card.js +38 -0
- package/src/lib/components/contact-deals-card.js.map +1 -0
- package/src/lib/components/contact-detail-page.d.ts +46 -0
- package/src/lib/components/contact-detail-page.js +535 -0
- package/src/lib/components/contact-detail-page.js.map +1 -0
- package/src/lib/components/contact-duplicates-card.d.ts +42 -0
- package/src/lib/components/contact-duplicates-card.js +167 -0
- package/src/lib/components/contact-duplicates-card.js.map +1 -0
- package/src/lib/components/contact-field-drawer.d.ts +64 -0
- package/src/lib/components/contact-field-drawer.js +251 -0
- package/src/lib/components/contact-field-drawer.js.map +1 -0
- package/src/lib/components/contact-import-drawer.d.ts +46 -0
- package/src/lib/components/contact-import-drawer.js +149 -0
- package/src/lib/components/contact-import-drawer.js.map +1 -0
- package/src/lib/components/contact-known-by-card.d.ts +39 -0
- package/src/lib/components/contact-known-by-card.js +142 -0
- package/src/lib/components/contact-known-by-card.js.map +1 -0
- package/src/lib/components/contact-list-columns.d.ts +53 -0
- package/src/lib/components/contact-list-columns.js +288 -0
- package/src/lib/components/contact-list-columns.js.map +1 -0
- package/src/lib/components/contact-merge-dialog.d.ts +79 -0
- package/src/lib/components/contact-merge-dialog.js +405 -0
- package/src/lib/components/contact-merge-dialog.js.map +1 -0
- package/src/lib/components/contact-properties-card.d.ts +89 -0
- package/src/lib/components/contact-properties-card.js +492 -0
- package/src/lib/components/contact-properties-card.js.map +1 -0
- package/src/lib/components/contact-timeline-card.d.ts +68 -0
- package/src/lib/components/contact-timeline-card.js +435 -0
- package/src/lib/components/contact-timeline-card.js.map +1 -0
- package/src/lib/components/contacts-bulk-bar.d.ts +91 -0
- package/src/lib/components/contacts-bulk-bar.js +493 -0
- package/src/lib/components/contacts-bulk-bar.js.map +1 -0
- package/src/lib/components/contacts-section.d.ts +26 -0
- package/src/lib/components/contacts-section.js +1025 -0
- package/src/lib/components/contacts-section.js.map +1 -0
- package/src/lib/components/copy-capture-address-button.d.ts +33 -0
- package/src/lib/components/copy-capture-address-button.js +60 -0
- package/src/lib/components/copy-capture-address-button.js.map +1 -0
- package/src/lib/components/crm-attribution-zone.d.ts +38 -0
- package/src/lib/components/crm-attribution-zone.js +36 -0
- package/src/lib/components/crm-attribution-zone.js.map +1 -0
- package/src/lib/components/crm-booking-zone.d.ts +61 -0
- package/src/lib/components/crm-booking-zone.js +50 -0
- package/src/lib/components/crm-booking-zone.js.map +1 -0
- package/src/lib/components/crm-bulk-bar-frame.d.ts +47 -0
- package/src/lib/components/crm-bulk-bar-frame.js +137 -0
- package/src/lib/components/crm-bulk-bar-frame.js.map +1 -0
- package/src/lib/components/crm-call-actions.d.ts +65 -0
- package/src/lib/components/crm-call-actions.js +110 -0
- package/src/lib/components/crm-call-actions.js.map +1 -0
- package/src/lib/components/crm-column-menu.d.ts +21 -0
- package/src/lib/components/crm-column-menu.js +103 -0
- package/src/lib/components/crm-column-menu.js.map +1 -0
- package/src/lib/components/crm-console-page.d.ts +19 -0
- package/src/lib/components/crm-console-page.js +151 -0
- package/src/lib/components/crm-console-page.js.map +1 -0
- package/src/lib/components/crm-console-sections.d.ts +52 -0
- package/src/lib/components/crm-console-sections.js +83 -0
- package/src/lib/components/crm-console-sections.js.map +1 -0
- package/src/lib/components/crm-custom-field-control.d.ts +26 -0
- package/src/lib/components/crm-custom-field-control.js +131 -0
- package/src/lib/components/crm-custom-field-control.js.map +1 -0
- package/src/lib/components/crm-email-template-tools.d.ts +69 -0
- package/src/lib/components/crm-email-template-tools.js +240 -0
- package/src/lib/components/crm-email-template-tools.js.map +1 -0
- package/src/lib/components/crm-export-all-button.d.ts +39 -0
- package/src/lib/components/crm-export-all-button.js +98 -0
- package/src/lib/components/crm-export-all-button.js.map +1 -0
- package/src/lib/components/crm-filter-bar.d.ts +53 -0
- package/src/lib/components/crm-filter-bar.js +294 -0
- package/src/lib/components/crm-filter-bar.js.map +1 -0
- package/src/lib/components/crm-glance-card.d.ts +54 -0
- package/src/lib/components/crm-glance-card.js +219 -0
- package/src/lib/components/crm-glance-card.js.map +1 -0
- package/src/lib/components/crm-next-activity-column.d.ts +35 -0
- package/src/lib/components/crm-next-activity-column.js +100 -0
- package/src/lib/components/crm-next-activity-column.js.map +1 -0
- package/src/lib/components/crm-record-header.d.ts +97 -0
- package/src/lib/components/crm-record-header.js +160 -0
- package/src/lib/components/crm-record-header.js.map +1 -0
- package/src/lib/components/crm-record-insights-zone.d.ts +50 -0
- package/src/lib/components/crm-record-insights-zone.js +169 -0
- package/src/lib/components/crm-record-insights-zone.js.map +1 -0
- package/src/lib/components/crm-record-picker.d.ts +42 -0
- package/src/lib/components/crm-record-picker.js +104 -0
- package/src/lib/components/crm-record-picker.js.map +1 -0
- package/src/lib/components/crm-send-email-button.d.ts +39 -0
- package/src/lib/components/crm-send-email-button.js +81 -0
- package/src/lib/components/crm-send-email-button.js.map +1 -0
- package/src/lib/components/crm-send-email-dialog.d.ts +61 -0
- package/src/lib/components/crm-send-email-dialog.js +851 -0
- package/src/lib/components/crm-send-email-dialog.js.map +1 -0
- package/src/lib/components/crm-site-picker.d.ts +61 -0
- package/src/lib/components/crm-site-picker.js +99 -0
- package/src/lib/components/crm-site-picker.js.map +1 -0
- package/src/lib/components/crm-suite-lock.d.ts +29 -0
- package/src/lib/components/crm-suite-lock.js +114 -0
- package/src/lib/components/crm-suite-lock.js.map +1 -0
- package/src/lib/components/crm-tasks-due-card.d.ts +42 -0
- package/src/lib/components/crm-tasks-due-card.js +225 -0
- package/src/lib/components/crm-tasks-due-card.js.map +1 -0
- package/src/lib/components/crm-views-control.d.ts +65 -0
- package/src/lib/components/crm-views-control.js +518 -0
- package/src/lib/components/crm-views-control.js.map +1 -0
- package/src/lib/components/csv-import-drawer.d.ts +132 -0
- package/src/lib/components/csv-import-drawer.js +746 -0
- package/src/lib/components/csv-import-drawer.js.map +1 -0
- package/src/lib/components/deal-board.d.ts +70 -0
- package/src/lib/components/deal-board.js +478 -0
- package/src/lib/components/deal-board.js.map +1 -0
- package/src/lib/components/deal-detail-page.d.ts +18 -0
- package/src/lib/components/deal-detail-page.js +323 -0
- package/src/lib/components/deal-detail-page.js.map +1 -0
- package/src/lib/components/deal-edit-drawer.d.ts +59 -0
- package/src/lib/components/deal-edit-drawer.js +640 -0
- package/src/lib/components/deal-edit-drawer.js.map +1 -0
- package/src/lib/components/deal-import-drawer.d.ts +24 -0
- package/src/lib/components/deal-import-drawer.js +83 -0
- package/src/lib/components/deal-import-drawer.js.map +1 -0
- package/src/lib/components/deal-products-card.d.ts +48 -0
- package/src/lib/components/deal-products-card.js +614 -0
- package/src/lib/components/deal-products-card.js.map +1 -0
- package/src/lib/components/deal-properties-card.d.ts +29 -0
- package/src/lib/components/deal-properties-card.js +144 -0
- package/src/lib/components/deal-properties-card.js.map +1 -0
- package/src/lib/components/deal-stage-card.d.ts +24 -0
- package/src/lib/components/deal-stage-card.js +199 -0
- package/src/lib/components/deal-stage-card.js.map +1 -0
- package/src/lib/components/deals-bulk-bar.d.ts +31 -0
- package/src/lib/components/deals-bulk-bar.js +340 -0
- package/src/lib/components/deals-bulk-bar.js.map +1 -0
- package/src/lib/components/deals-section.d.ts +49 -0
- package/src/lib/components/deals-section.js +767 -0
- package/src/lib/components/deals-section.js.map +1 -0
- package/src/lib/components/email-capture-card.d.ts +42 -0
- package/src/lib/components/email-capture-card.js +134 -0
- package/src/lib/components/email-capture-card.js.map +1 -0
- package/src/lib/components/email-template-drawer.d.ts +33 -0
- package/src/lib/components/email-template-drawer.js +209 -0
- package/src/lib/components/email-template-drawer.js.map +1 -0
- package/src/lib/components/email-templates-card.d.ts +33 -0
- package/src/lib/components/email-templates-card.js +370 -0
- package/src/lib/components/email-templates-card.js.map +1 -0
- package/src/lib/components/erase-person-action.d.ts +92 -0
- package/src/lib/components/erase-person-action.js +261 -0
- package/src/lib/components/erase-person-action.js.map +1 -0
- package/src/lib/components/fields-section.d.ts +37 -0
- package/src/lib/components/fields-section.js +641 -0
- package/src/lib/components/fields-section.js.map +1 -0
- package/src/lib/components/form-contact-fields-card.d.ts +46 -0
- package/src/lib/components/form-contact-fields-card.js +253 -0
- package/src/lib/components/form-contact-fields-card.js.map +1 -0
- package/src/lib/components/insert-link-at-caret.d.ts +28 -0
- package/src/lib/components/insert-link-at-caret.js +37 -0
- package/src/lib/components/insert-link-at-caret.js.map +1 -0
- package/src/lib/components/lead-convert-dialog.d.ts +32 -0
- package/src/lib/components/lead-convert-dialog.js +493 -0
- package/src/lib/components/lead-convert-dialog.js.map +1 -0
- package/src/lib/components/lead-detail-page.d.ts +16 -0
- package/src/lib/components/lead-detail-page.js +163 -0
- package/src/lib/components/lead-detail-page.js.map +1 -0
- package/src/lib/components/lead-history-card.d.ts +32 -0
- package/src/lib/components/lead-history-card.js +165 -0
- package/src/lib/components/lead-history-card.js.map +1 -0
- package/src/lib/components/lead-import-drawer.d.ts +24 -0
- package/src/lib/components/lead-import-drawer.js +95 -0
- package/src/lib/components/lead-import-drawer.js.map +1 -0
- package/src/lib/components/lead-owner-select.d.ts +35 -0
- package/src/lib/components/lead-owner-select.js +91 -0
- package/src/lib/components/lead-owner-select.js.map +1 -0
- package/src/lib/components/lead-properties-card.d.ts +61 -0
- package/src/lib/components/lead-properties-card.js +395 -0
- package/src/lib/components/lead-properties-card.js.map +1 -0
- package/src/lib/components/lead-status-chip.d.ts +12 -0
- package/src/lib/components/lead-status-chip.js +43 -0
- package/src/lib/components/lead-status-chip.js.map +1 -0
- package/src/lib/components/lead-surfaces-note.d.ts +126 -0
- package/src/lib/components/lead-surfaces-note.js +262 -0
- package/src/lib/components/lead-surfaces-note.js.map +1 -0
- package/src/lib/components/lead-unqualify-dialog.d.ts +24 -0
- package/src/lib/components/lead-unqualify-dialog.js +125 -0
- package/src/lib/components/lead-unqualify-dialog.js.map +1 -0
- package/src/lib/components/leads-bulk-bar.d.ts +58 -0
- package/src/lib/components/leads-bulk-bar.js +307 -0
- package/src/lib/components/leads-bulk-bar.js.map +1 -0
- package/src/lib/components/leads-section.d.ts +23 -0
- package/src/lib/components/leads-section.js +664 -0
- package/src/lib/components/leads-section.js.map +1 -0
- package/src/lib/components/linked-deals-card.d.ts +32 -0
- package/src/lib/components/linked-deals-card.js +163 -0
- package/src/lib/components/linked-deals-card.js.map +1 -0
- package/src/lib/components/log-activity-dialog.d.ts +60 -0
- package/src/lib/components/log-activity-dialog.js +368 -0
- package/src/lib/components/log-activity-dialog.js.map +1 -0
- package/src/lib/components/lost-reason-dialog.d.ts +26 -0
- package/src/lib/components/lost-reason-dialog.js +95 -0
- package/src/lib/components/lost-reason-dialog.js.map +1 -0
- package/src/lib/components/new-contact-drawer.d.ts +78 -0
- package/src/lib/components/new-contact-drawer.js +343 -0
- package/src/lib/components/new-contact-drawer.js.map +1 -0
- package/src/lib/components/org-lead-surfaces-note.d.ts +57 -0
- package/src/lib/components/org-lead-surfaces-note.js +172 -0
- package/src/lib/components/org-lead-surfaces-note.js.map +1 -0
- package/src/lib/components/owner-avatar.d.ts +18 -0
- package/src/lib/components/owner-avatar.js +61 -0
- package/src/lib/components/owner-avatar.js.map +1 -0
- package/src/lib/components/pipeline-stages-dialog.d.ts +43 -0
- package/src/lib/components/pipeline-stages-dialog.js +339 -0
- package/src/lib/components/pipeline-stages-dialog.js.map +1 -0
- package/src/lib/components/pipelines-dialog.d.ts +55 -0
- package/src/lib/components/pipelines-dialog.js +517 -0
- package/src/lib/components/pipelines-dialog.js.map +1 -0
- package/src/lib/components/recent-activity-feed.d.ts +39 -0
- package/src/lib/components/recent-activity-feed.js +103 -0
- package/src/lib/components/recent-activity-feed.js.map +1 -0
- package/src/lib/components/recipes-card.d.ts +39 -0
- package/src/lib/components/recipes-card.js +485 -0
- package/src/lib/components/recipes-card.js.map +1 -0
- package/src/lib/components/record-activity-card.d.ts +26 -0
- package/src/lib/components/record-activity-card.js +121 -0
- package/src/lib/components/record-activity-card.js.map +1 -0
- package/src/lib/components/record-files-card.d.ts +67 -0
- package/src/lib/components/record-files-card.js +290 -0
- package/src/lib/components/record-files-card.js.map +1 -0
- package/src/lib/components/record-tasks-card.d.ts +32 -0
- package/src/lib/components/record-tasks-card.js +306 -0
- package/src/lib/components/record-tasks-card.js.map +1 -0
- package/src/lib/components/reports/activity-card.d.ts +57 -0
- package/src/lib/components/reports/activity-card.js +281 -0
- package/src/lib/components/reports/activity-card.js.map +1 -0
- package/src/lib/components/reports/closed-deals-card.d.ts +20 -0
- package/src/lib/components/reports/closed-deals-card.js +194 -0
- package/src/lib/components/reports/closed-deals-card.js.map +1 -0
- package/src/lib/components/reports/contacts-mix-card.d.ts +27 -0
- package/src/lib/components/reports/contacts-mix-card.js +161 -0
- package/src/lib/components/reports/contacts-mix-card.js.map +1 -0
- package/src/lib/components/reports/contacts-trend-card.d.ts +31 -0
- package/src/lib/components/reports/contacts-trend-card.js +144 -0
- package/src/lib/components/reports/contacts-trend-card.js.map +1 -0
- package/src/lib/components/reports/forecast-card.d.ts +22 -0
- package/src/lib/components/reports/forecast-card.js +251 -0
- package/src/lib/components/reports/forecast-card.js.map +1 -0
- package/src/lib/components/reports/lead-counts.d.ts +32 -0
- package/src/lib/components/reports/lead-counts.js +44 -0
- package/src/lib/components/reports/lead-counts.js.map +1 -0
- package/src/lib/components/reports/lead-funnel-card.d.ts +38 -0
- package/src/lib/components/reports/lead-funnel-card.js +375 -0
- package/src/lib/components/reports/lead-funnel-card.js.map +1 -0
- package/src/lib/components/reports/pipeline-card.d.ts +19 -0
- package/src/lib/components/reports/pipeline-card.js +338 -0
- package/src/lib/components/reports/pipeline-card.js.map +1 -0
- package/src/lib/components/reports/report-bar-chart.d.ts +39 -0
- package/src/lib/components/reports/report-bar-chart.js +133 -0
- package/src/lib/components/reports/report-bar-chart.js.map +1 -0
- package/src/lib/components/reports/report-breakdown.d.ts +32 -0
- package/src/lib/components/reports/report-breakdown.js +105 -0
- package/src/lib/components/reports/report-breakdown.js.map +1 -0
- package/src/lib/components/reports/report-export.d.ts +37 -0
- package/src/lib/components/reports/report-export.js +66 -0
- package/src/lib/components/reports/report-export.js.map +1 -0
- package/src/lib/components/reports/report-format.d.ts +36 -0
- package/src/lib/components/reports/report-format.js +43 -0
- package/src/lib/components/reports/report-format.js.map +1 -0
- package/src/lib/components/reports/report-scope.d.ts +81 -0
- package/src/lib/components/reports/report-scope.js +58 -0
- package/src/lib/components/reports/report-scope.js.map +1 -0
- package/src/lib/components/reports/report-stat-tile.d.ts +47 -0
- package/src/lib/components/reports/report-stat-tile.js +96 -0
- package/src/lib/components/reports/report-stat-tile.js.map +1 -0
- package/src/lib/components/reports/source-conversion-card.d.ts +28 -0
- package/src/lib/components/reports/source-conversion-card.js +205 -0
- package/src/lib/components/reports/source-conversion-card.js.map +1 -0
- package/src/lib/components/reports/tasks-card.d.ts +26 -0
- package/src/lib/components/reports/tasks-card.js +279 -0
- package/src/lib/components/reports/tasks-card.js.map +1 -0
- package/src/lib/components/reports/use-aggregate-read.d.ts +99 -0
- package/src/lib/components/reports/use-aggregate-read.js +195 -0
- package/src/lib/components/reports/use-aggregate-read.js.map +1 -0
- package/src/lib/components/reports/won-lost-by-owner-card.d.ts +30 -0
- package/src/lib/components/reports/won-lost-by-owner-card.js +168 -0
- package/src/lib/components/reports/won-lost-by-owner-card.js.map +1 -0
- package/src/lib/components/reports-section.d.ts +42 -0
- package/src/lib/components/reports-section.js +308 -0
- package/src/lib/components/reports-section.js.map +1 -0
- package/src/lib/components/sending-addresses-card.d.ts +49 -0
- package/src/lib/components/sending-addresses-card.js +262 -0
- package/src/lib/components/sending-addresses-card.js.map +1 -0
- package/src/lib/components/settings-section.d.ts +151 -0
- package/src/lib/components/settings-section.js +783 -0
- package/src/lib/components/settings-section.js.map +1 -0
- package/src/lib/components/task-cells.d.ts +51 -0
- package/src/lib/components/task-cells.js +139 -0
- package/src/lib/components/task-cells.js.map +1 -0
- package/src/lib/components/task-edit-drawer.d.ts +53 -0
- package/src/lib/components/task-edit-drawer.js +483 -0
- package/src/lib/components/task-edit-drawer.js.map +1 -0
- package/src/lib/components/task-import-drawer.d.ts +24 -0
- package/src/lib/components/task-import-drawer.js +82 -0
- package/src/lib/components/task-import-drawer.js.map +1 -0
- package/src/lib/components/task-snooze-menu.d.ts +65 -0
- package/src/lib/components/task-snooze-menu.js +207 -0
- package/src/lib/components/task-snooze-menu.js.map +1 -0
- package/src/lib/components/tasks-bulk-bar.d.ts +25 -0
- package/src/lib/components/tasks-bulk-bar.js +348 -0
- package/src/lib/components/tasks-bulk-bar.js.map +1 -0
- package/src/lib/components/tasks-calendar.d.ts +38 -0
- package/src/lib/components/tasks-calendar.js +228 -0
- package/src/lib/components/tasks-calendar.js.map +1 -0
- package/src/lib/components/tasks-section.d.ts +27 -0
- package/src/lib/components/tasks-section.js +579 -0
- package/src/lib/components/tasks-section.js.map +1 -0
- package/src/lib/components/use-contact-campaign-emails.d.ts +32 -0
- package/src/lib/components/use-contact-campaign-emails.js +83 -0
- package/src/lib/components/use-contact-campaign-emails.js.map +1 -0
- package/src/lib/components/use-crm-api.d.ts +44 -0
- package/src/lib/components/use-crm-api.js +84 -0
- package/src/lib/components/use-crm-api.js.map +1 -0
- package/src/lib/components/use-crm-inbound-address.d.ts +60 -0
- package/src/lib/components/use-crm-inbound-address.js +124 -0
- package/src/lib/components/use-crm-inbound-address.js.map +1 -0
- package/src/lib/components/use-emails-hub-path.d.ts +24 -0
- package/src/lib/components/use-emails-hub-path.js +59 -0
- package/src/lib/components/use-emails-hub-path.js.map +1 -0
- package/src/lib/components/use-member-email-aliases.d.ts +54 -0
- package/src/lib/components/use-member-email-aliases.js +186 -0
- package/src/lib/components/use-member-email-aliases.js.map +1 -0
- package/src/lib/components/use-org-members.d.ts +40 -0
- package/src/lib/components/use-org-members.js +100 -0
- package/src/lib/components/use-org-members.js.map +1 -0
- package/src/lib/constants/api-routes.d.ts +109 -0
- package/src/lib/constants/api-routes.js +74 -0
- package/src/lib/constants/api-routes.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +14 -0
- package/src/lib/constants/bundle-common.js +14 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/company-filters.d.ts +18 -0
- package/src/lib/constants/company-filters.js +51 -0
- package/src/lib/constants/company-filters.js.map +1 -0
- package/src/lib/constants/contact-filters.d.ts +38 -0
- package/src/lib/constants/contact-filters.js +294 -0
- package/src/lib/constants/contact-filters.js.map +1 -0
- package/src/lib/hooks/use-contact-field-definitions.d.ts +48 -0
- package/src/lib/hooks/use-contact-field-definitions.js +72 -0
- package/src/lib/hooks/use-contact-field-definitions.js.map +1 -0
- package/src/lib/hooks/use-contact-update.d.ts +25 -0
- package/src/lib/hooks/use-contact-update.js +80 -0
- package/src/lib/hooks/use-contact-update.js.map +1 -0
- package/src/lib/hooks/use-crm-activity-logger.d.ts +73 -0
- package/src/lib/hooks/use-crm-activity-logger.js +101 -0
- package/src/lib/hooks/use-crm-activity-logger.js.map +1 -0
- package/src/lib/hooks/use-crm-bulk-apply.d.ts +52 -0
- package/src/lib/hooks/use-crm-bulk-apply.js +112 -0
- package/src/lib/hooks/use-crm-bulk-apply.js.map +1 -0
- package/src/lib/hooks/use-crm-default-view.d.ts +24 -0
- package/src/lib/hooks/use-crm-default-view.js +64 -0
- package/src/lib/hooks/use-crm-default-view.js.map +1 -0
- package/src/lib/hooks/use-crm-email-templates.d.ts +59 -0
- package/src/lib/hooks/use-crm-email-templates.js +103 -0
- package/src/lib/hooks/use-crm-email-templates.js.map +1 -0
- package/src/lib/hooks/use-crm-hub-path.d.ts +29 -0
- package/src/lib/hooks/use-crm-hub-path.js +41 -0
- package/src/lib/hooks/use-crm-hub-path.js.map +1 -0
- package/src/lib/hooks/use-crm-org-mount.d.ts +97 -0
- package/src/lib/hooks/use-crm-org-mount.js +215 -0
- package/src/lib/hooks/use-crm-org-mount.js.map +1 -0
- package/src/lib/hooks/use-crm-record-names.d.ts +52 -0
- package/src/lib/hooks/use-crm-record-names.js +126 -0
- package/src/lib/hooks/use-crm-record-names.js.map +1 -0
- package/src/lib/hooks/use-crm-records-quota.d.ts +68 -0
- package/src/lib/hooks/use-crm-records-quota.js +118 -0
- package/src/lib/hooks/use-crm-records-quota.js.map +1 -0
- package/src/lib/hooks/use-crm-saved-view.d.ts +96 -0
- package/src/lib/hooks/use-crm-saved-view.js +329 -0
- package/src/lib/hooks/use-crm-saved-view.js.map +1 -0
- package/src/lib/hooks/use-crm-scope.d.ts +117 -0
- package/src/lib/hooks/use-crm-scope.js +147 -0
- package/src/lib/hooks/use-crm-scope.js.map +1 -0
- package/src/lib/hooks/use-crm-tasks.d.ts +85 -0
- package/src/lib/hooks/use-crm-tasks.js +153 -0
- package/src/lib/hooks/use-crm-tasks.js.map +1 -0
- package/src/lib/hooks/use-crm-view-grid.d.ts +55 -0
- package/src/lib/hooks/use-crm-view-grid.js +170 -0
- package/src/lib/hooks/use-crm-view-grid.js.map +1 -0
- package/src/lib/hooks/use-crm-views.d.ts +42 -0
- package/src/lib/hooks/use-crm-views.js +84 -0
- package/src/lib/hooks/use-crm-views.js.map +1 -0
- package/src/lib/hooks/use-deal-stage-api.d.ts +69 -0
- package/src/lib/hooks/use-deal-stage-api.js +78 -0
- package/src/lib/hooks/use-deal-stage-api.js.map +1 -0
- package/src/lib/hooks/use-deals.d.ts +47 -0
- package/src/lib/hooks/use-deals.js +105 -0
- package/src/lib/hooks/use-deals.js.map +1 -0
- package/src/lib/hooks/use-org-leads.d.ts +53 -0
- package/src/lib/hooks/use-org-leads.js +114 -0
- package/src/lib/hooks/use-org-leads.js.map +1 -0
- package/src/lib/hooks/use-org-member-directory.d.ts +36 -0
- package/src/lib/hooks/use-org-member-directory.js +116 -0
- package/src/lib/hooks/use-org-member-directory.js.map +1 -0
- package/src/lib/hooks/use-org-member-options.d.ts +38 -0
- package/src/lib/hooks/use-org-member-options.js +131 -0
- package/src/lib/hooks/use-org-member-options.js.map +1 -0
- package/src/lib/hooks/use-pipeline.d.ts +71 -0
- package/src/lib/hooks/use-pipeline.js +159 -0
- package/src/lib/hooks/use-pipeline.js.map +1 -0
- package/src/lib/model/companies-bulk-writes.d.ts +40 -0
- package/src/lib/model/companies-bulk-writes.js +103 -0
- package/src/lib/model/companies-bulk-writes.js.map +1 -0
- package/src/lib/model/companies-csv.d.ts +36 -0
- package/src/lib/model/companies-csv.js +38 -0
- package/src/lib/model/companies-csv.js.map +1 -0
- package/src/lib/model/companies.d.ts +99 -0
- package/src/lib/model/companies.js +168 -0
- package/src/lib/model/companies.js.map +1 -0
- package/src/lib/model/company-delete-route.d.ts +43 -0
- package/src/lib/model/company-delete-route.js +31 -0
- package/src/lib/model/company-delete-route.js.map +1 -0
- package/src/lib/model/company-delete.d.ts +42 -0
- package/src/lib/model/company-delete.js +52 -0
- package/src/lib/model/company-delete.js.map +1 -0
- package/src/lib/model/contact-duplicates.d.ts +58 -0
- package/src/lib/model/contact-duplicates.js +67 -0
- package/src/lib/model/contact-duplicates.js.map +1 -0
- package/src/lib/model/contact-record.d.ts +113 -0
- package/src/lib/model/contact-record.js +70 -0
- package/src/lib/model/contact-record.js.map +1 -0
- package/src/lib/model/contact-update.d.ts +93 -0
- package/src/lib/model/contact-update.js +50 -0
- package/src/lib/model/contact-update.js.map +1 -0
- package/src/lib/model/contacts-bulk-writes.d.ts +173 -0
- package/src/lib/model/contacts-bulk-writes.js +196 -0
- package/src/lib/model/contacts-bulk-writes.js.map +1 -0
- package/src/lib/model/contacts-csv.d.ts +54 -0
- package/src/lib/model/contacts-csv.js +67 -0
- package/src/lib/model/contacts-csv.js.map +1 -0
- package/src/lib/model/contacts-list-seed.d.ts +51 -0
- package/src/lib/model/contacts-list-seed.js +63 -0
- package/src/lib/model/contacts-list-seed.js.map +1 -0
- package/src/lib/model/crm-activity-report.d.ts +27 -0
- package/src/lib/model/crm-activity-report.js +56 -0
- package/src/lib/model/crm-activity-report.js.map +1 -0
- package/src/lib/model/crm-api.d.ts +49 -0
- package/src/lib/model/crm-api.js +47 -0
- package/src/lib/model/crm-api.js.map +1 -0
- package/src/lib/model/crm-bulk-writes.d.ts +147 -0
- package/src/lib/model/crm-bulk-writes.js +207 -0
- package/src/lib/model/crm-bulk-writes.js.map +1 -0
- package/src/lib/model/crm-company-import.d.ts +154 -0
- package/src/lib/model/crm-company-import.js +331 -0
- package/src/lib/model/crm-company-import.js.map +1 -0
- package/src/lib/model/crm-custom-draft.d.ts +62 -0
- package/src/lib/model/crm-custom-draft.js +67 -0
- package/src/lib/model/crm-custom-draft.js.map +1 -0
- package/src/lib/model/crm-deal-import.d.ts +112 -0
- package/src/lib/model/crm-deal-import.js +263 -0
- package/src/lib/model/crm-deal-import.js.map +1 -0
- package/src/lib/model/crm-import.d.ts +244 -0
- package/src/lib/model/crm-import.js +466 -0
- package/src/lib/model/crm-import.js.map +1 -0
- package/src/lib/model/crm-lead-import.d.ts +105 -0
- package/src/lib/model/crm-lead-import.js +255 -0
- package/src/lib/model/crm-lead-import.js.map +1 -0
- package/src/lib/model/crm-record-routes.d.ts +21 -0
- package/src/lib/model/crm-record-routes.js +70 -0
- package/src/lib/model/crm-record-routes.js.map +1 -0
- package/src/lib/model/crm-routes.d.ts +101 -0
- package/src/lib/model/crm-routes.js +92 -0
- package/src/lib/model/crm-routes.js.map +1 -0
- package/src/lib/model/crm-task-import.d.ts +94 -0
- package/src/lib/model/crm-task-import.js +275 -0
- package/src/lib/model/crm-task-import.js.map +1 -0
- package/src/lib/model/crm-view-param.d.ts +43 -0
- package/src/lib/model/crm-view-param.js +49 -0
- package/src/lib/model/crm-view-param.js.map +1 -0
- package/src/lib/model/deal-board-model.d.ts +241 -0
- package/src/lib/model/deal-board-model.js +439 -0
- package/src/lib/model/deal-board-model.js.map +1 -0
- package/src/lib/model/deal-form-model.d.ts +114 -0
- package/src/lib/model/deal-form-model.js +218 -0
- package/src/lib/model/deal-form-model.js.map +1 -0
- package/src/lib/model/deals-csv.d.ts +32 -0
- package/src/lib/model/deals-csv.js +37 -0
- package/src/lib/model/deals-csv.js.map +1 -0
- package/src/lib/model/import-column-shapes.d.ts +36 -0
- package/src/lib/model/import-column-shapes.js +76 -0
- package/src/lib/model/import-column-shapes.js.map +1 -0
- package/src/lib/model/lead-company-suggestion.d.ts +61 -0
- package/src/lib/model/lead-company-suggestion.js +65 -0
- package/src/lib/model/lead-company-suggestion.js.map +1 -0
- package/src/lib/model/lead-filters.d.ts +29 -0
- package/src/lib/model/lead-filters.js +39 -0
- package/src/lib/model/lead-filters.js.map +1 -0
- package/src/lib/model/lead-surfaces.d.ts +58 -0
- package/src/lib/model/lead-surfaces.js +67 -0
- package/src/lib/model/lead-surfaces.js.map +1 -0
- package/src/lib/model/leads-csv.d.ts +40 -0
- package/src/lib/model/leads-csv.js +40 -0
- package/src/lib/model/leads-csv.js.map +1 -0
- package/src/lib/model/next-activity-api.d.ts +31 -0
- package/src/lib/model/next-activity-api.js +57 -0
- package/src/lib/model/next-activity-api.js.map +1 -0
- package/src/lib/model/next-activity.d.ts +64 -0
- package/src/lib/model/next-activity.js +47 -0
- package/src/lib/model/next-activity.js.map +1 -0
- package/src/lib/model/person-key-web.d.ts +43 -0
- package/src/lib/model/person-key-web.js +52 -0
- package/src/lib/model/person-key-web.js.map +1 -0
- package/src/lib/model/record-facts.d.ts +282 -0
- package/src/lib/model/record-facts.js +434 -0
- package/src/lib/model/record-facts.js.map +1 -0
- package/src/lib/model/task-api.d.ts +28 -0
- package/src/lib/model/task-api.js +57 -0
- package/src/lib/model/task-api.js.map +1 -0
- package/src/lib/model/task-calendar.d.ts +108 -0
- package/src/lib/model/task-calendar.js +139 -0
- package/src/lib/model/task-calendar.js.map +1 -0
- package/src/lib/model/task-routes.d.ts +177 -0
- package/src/lib/model/task-routes.js +197 -0
- package/src/lib/model/task-routes.js.map +1 -0
- package/src/lib/model/task-scope.d.ts +45 -0
- package/src/lib/model/task-scope.js +51 -0
- package/src/lib/model/task-scope.js.map +1 -0
- package/src/lib/model/task-views.d.ts +149 -0
- package/src/lib/model/task-views.js +286 -0
- package/src/lib/model/task-views.js.map +1 -0
- package/src/lib/model/tasks-csv.d.ts +28 -0
- package/src/lib/model/tasks-csv.js +28 -0
- package/src/lib/model/tasks-csv.js.map +1 -0
- package/src/lib/plugin.d.ts +32 -0
- package/src/lib/plugin.js +208 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/server/companies-import.d.ts +57 -0
- package/src/lib/server/companies-import.js +242 -0
- package/src/lib/server/companies-import.js.map +1 -0
- package/src/lib/server/company-delete.d.ts +59 -0
- package/src/lib/server/company-delete.js +146 -0
- package/src/lib/server/company-delete.js.map +1 -0
- package/src/lib/server/contact-email-history.d.ts +82 -0
- package/src/lib/server/contact-email-history.js +264 -0
- package/src/lib/server/contact-email-history.js.map +1 -0
- package/src/lib/server/contact-profile.d.ts +41 -0
- package/src/lib/server/contact-profile.js +45 -0
- package/src/lib/server/contact-profile.js.map +1 -0
- package/src/lib/server/contact-update.d.ts +92 -0
- package/src/lib/server/contact-update.js +512 -0
- package/src/lib/server/contact-update.js.map +1 -0
- package/src/lib/server/contacts-import.d.ts +73 -0
- package/src/lib/server/contacts-import.js +263 -0
- package/src/lib/server/contacts-import.js.map +1 -0
- package/src/lib/server/contacts-merge.d.ts +86 -0
- package/src/lib/server/contacts-merge.js +206 -0
- package/src/lib/server/contacts-merge.js.map +1 -0
- package/src/lib/server/deals-import.d.ts +76 -0
- package/src/lib/server/deals-import.js +246 -0
- package/src/lib/server/deals-import.js.map +1 -0
- package/src/lib/server/email-send.d.ts +119 -0
- package/src/lib/server/email-send.js +667 -0
- package/src/lib/server/email-send.js.map +1 -0
- package/src/lib/server/email-template-duplicate.d.ts +19 -0
- package/src/lib/server/email-template-duplicate.js +206 -0
- package/src/lib/server/email-template-duplicate.js.map +1 -0
- package/src/lib/server/erase-person.d.ts +108 -0
- package/src/lib/server/erase-person.js +309 -0
- package/src/lib/server/erase-person.js.map +1 -0
- package/src/lib/server/import-context.d.ts +85 -0
- package/src/lib/server/import-context.js +181 -0
- package/src/lib/server/import-context.js.map +1 -0
- package/src/lib/server/inbound-address.d.ts +61 -0
- package/src/lib/server/inbound-address.js +188 -0
- package/src/lib/server/inbound-address.js.map +1 -0
- package/src/lib/server/lead-convert.d.ts +78 -0
- package/src/lib/server/lead-convert.js +250 -0
- package/src/lib/server/lead-convert.js.map +1 -0
- package/src/lib/server/leads-import.d.ts +84 -0
- package/src/lib/server/leads-import.js +261 -0
- package/src/lib/server/leads-import.js.map +1 -0
- package/src/lib/server/next-activity-routes.d.ts +33 -0
- package/src/lib/server/next-activity-routes.js +110 -0
- package/src/lib/server/next-activity-routes.js.map +1 -0
- package/src/lib/server/org-activity.d.ts +61 -0
- package/src/lib/server/org-activity.js +120 -0
- package/src/lib/server/org-activity.js.map +1 -0
- package/src/lib/server/org-caller.d.ts +110 -0
- package/src/lib/server/org-caller.js +154 -0
- package/src/lib/server/org-caller.js.map +1 -0
- package/src/lib/server/recipe-routes.d.ts +75 -0
- package/src/lib/server/recipe-routes.js +442 -0
- package/src/lib/server/recipe-routes.js.map +1 -0
- package/src/lib/server/record-facts.d.ts +65 -0
- package/src/lib/server/record-facts.js +337 -0
- package/src/lib/server/record-facts.js.map +1 -0
- package/src/lib/server/record-timeline.d.ts +51 -0
- package/src/lib/server/record-timeline.js +215 -0
- package/src/lib/server/record-timeline.js.map +1 -0
- package/src/lib/server/suite-gate.d.ts +42 -0
- package/src/lib/server/suite-gate.js +87 -0
- package/src/lib/server/suite-gate.js.map +1 -0
- package/src/lib/server/task-routes.d.ts +132 -0
- package/src/lib/server/task-routes.js +699 -0
- package/src/lib/server/task-routes.js.map +1 -0
- package/src/lib/server/tasks-import.d.ts +54 -0
- package/src/lib/server/tasks-import.js +157 -0
- package/src/lib/server/tasks-import.js.map +1 -0
- package/src/lib/server-deal-stage.d.ts +88 -0
- package/src/lib/server-deal-stage.js +316 -0
- package/src/lib/server-deal-stage.js.map +1 -0
- package/src/lib/server.d.ts +149 -0
- package/src/lib/server.js +615 -0
- package/src/lib/server.js.map +1 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { CRM_VIEW_MAX_FILTERS } from "@aglyn/aglyn";
|
|
20
|
+
import { mdiFilterPlusOutline } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import { MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { listFilterOperatorLabel, listFilterOperators } from "@aglyn/shared-ui-jsx/const/list-filter";
|
|
23
|
+
import { Button, Chip, MenuItem, Popover, Stack, TextField, Tooltip } from "@mui/material";
|
|
24
|
+
import { useMemo, useState } from "react";
|
|
25
|
+
/** Operators that carry no value, so the value box is not shown for them. */ const VALUELESS = new Set([
|
|
26
|
+
'isEmpty',
|
|
27
|
+
'isNotEmpty'
|
|
28
|
+
]);
|
|
29
|
+
/** Operators that take several values, comma-joined the way the grammar splits them. */ const MULTI = new Set([
|
|
30
|
+
'isAnyOf'
|
|
31
|
+
]);
|
|
32
|
+
const dayLabel = (raw)=>{
|
|
33
|
+
const at = new Date(raw);
|
|
34
|
+
return Number.isNaN(at.getTime()) ? raw : at.toLocaleDateString();
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The chips above a CRM list: every clause the list is narrowed by, and
|
|
38
|
+
* the one control that adds another (AGL-2617).
|
|
39
|
+
*
|
|
40
|
+
* A saved view carries several clauses and the data grid's own filter panel
|
|
41
|
+
* holds one, so the list needs an editor of its own for the set. Each
|
|
42
|
+
* clause is a chip that reads as a sentence — "Owner is Dana", "Created on
|
|
43
|
+
* or after 1 Jan" — with the clause the query serves marked, because that
|
|
44
|
+
* is the one that reached every contact and the others narrowed the loaded
|
|
45
|
+
* window; the list's caption says the same thing in prose.
|
|
46
|
+
*
|
|
47
|
+
* Adding one is a popover, not a row of controls: field, operator, value,
|
|
48
|
+
* Add. The value control follows the field — a picker where the section
|
|
49
|
+
* supplied choices, a date box for a date, a number box for a number, a
|
|
50
|
+
* text box otherwise — and the operators offered are exactly the ones the
|
|
51
|
+
* grammar declares for the field, so a clause cannot be built that nothing
|
|
52
|
+
* answers.
|
|
53
|
+
*/ export function CrmFilterBar(props) {
|
|
54
|
+
var _choosable_find;
|
|
55
|
+
const { fields, headers, clauses, onChange, options = {}, servedField = null, disabled = false, onOpen } = props;
|
|
56
|
+
const [anchor, setAnchor] = useState(null);
|
|
57
|
+
const [draft, setDraft] = useState({
|
|
58
|
+
field: '',
|
|
59
|
+
op: '',
|
|
60
|
+
value: ''
|
|
61
|
+
});
|
|
62
|
+
/** Fields a clause can be added on — those with at least one operator. */ const choosable = useMemo(()=>fields.filter((field)=>listFilterOperators(field).length > 0), [
|
|
63
|
+
fields
|
|
64
|
+
]);
|
|
65
|
+
const header = (column)=>{
|
|
66
|
+
var _headers_column;
|
|
67
|
+
return (_headers_column = headers[column]) != null ? _headers_column : column;
|
|
68
|
+
};
|
|
69
|
+
const draftField = (_choosable_find = choosable.find((field)=>field.column === draft.field)) != null ? _choosable_find : null;
|
|
70
|
+
const operators = draftField ? listFilterOperators(draftField) : [];
|
|
71
|
+
const draftOptions = draft.field ? options[draft.field] : undefined;
|
|
72
|
+
const valueless = VALUELESS.has(draft.op);
|
|
73
|
+
const multi = MULTI.has(draft.op);
|
|
74
|
+
const open = (event)=>{
|
|
75
|
+
var _ref, _firstOps_;
|
|
76
|
+
const first = choosable[0];
|
|
77
|
+
const firstOps = first ? listFilterOperators(first) : [];
|
|
78
|
+
setDraft({
|
|
79
|
+
field: (_ref = first == null ? void 0 : first.column) != null ? _ref : '',
|
|
80
|
+
op: (_firstOps_ = firstOps[0]) != null ? _firstOps_ : '',
|
|
81
|
+
value: ''
|
|
82
|
+
});
|
|
83
|
+
setAnchor(event.currentTarget);
|
|
84
|
+
onOpen == null ? void 0 : onOpen();
|
|
85
|
+
};
|
|
86
|
+
const close = ()=>setAnchor(null);
|
|
87
|
+
const chooseField = (column)=>{
|
|
88
|
+
var _ops_;
|
|
89
|
+
const field = choosable.find((entry)=>entry.column === column);
|
|
90
|
+
const ops = field ? listFilterOperators(field) : [];
|
|
91
|
+
setDraft({
|
|
92
|
+
field: column,
|
|
93
|
+
op: (_ops_ = ops[0]) != null ? _ops_ : '',
|
|
94
|
+
value: ''
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const canAdd = Boolean(draft.field && draft.op) && (valueless || draft.value.trim() !== '') && clauses.length < CRM_VIEW_MAX_FILTERS;
|
|
98
|
+
const add = ()=>{
|
|
99
|
+
var _draftOptions_find;
|
|
100
|
+
if (!canAdd) return;
|
|
101
|
+
const value = valueless ? '' : draft.value.trim();
|
|
102
|
+
const label = draftOptions && !multi ? (_draftOptions_find = draftOptions.find((option)=>option.value === value)) == null ? void 0 : _draftOptions_find.label : undefined;
|
|
103
|
+
onChange([
|
|
104
|
+
...clauses,
|
|
105
|
+
_extends({
|
|
106
|
+
field: draft.field,
|
|
107
|
+
op: draft.op,
|
|
108
|
+
value
|
|
109
|
+
}, label ? {
|
|
110
|
+
label
|
|
111
|
+
} : {})
|
|
112
|
+
]);
|
|
113
|
+
close();
|
|
114
|
+
};
|
|
115
|
+
/** How a clause reads: its header, its operator, and its value by label. */ const sentence = (clause)=>{
|
|
116
|
+
var _clause_label;
|
|
117
|
+
const field = fields.find((entry)=>entry.column === clause.field);
|
|
118
|
+
const choices = options[clause.field];
|
|
119
|
+
const named = (value)=>{
|
|
120
|
+
var _ref;
|
|
121
|
+
var _choices_find;
|
|
122
|
+
return (_ref = choices == null ? void 0 : (_choices_find = choices.find((option)=>option.value === value)) == null ? void 0 : _choices_find.label) != null ? _ref : value;
|
|
123
|
+
};
|
|
124
|
+
const value = VALUELESS.has(clause.op) ? '' : MULTI.has(clause.op) ? clause.value.split(',').map((entry)=>entry.trim()).filter(Boolean).map(named).join(', ') : (_clause_label = clause.label) != null ? _clause_label : (field == null ? void 0 : field.kind) === 'date' ? dayLabel(clause.value) : named(clause.value);
|
|
125
|
+
return `${header(clause.field)} ${listFilterOperatorLabel(clause.op)}${value ? ` ${value}` : ''}`;
|
|
126
|
+
};
|
|
127
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
128
|
+
direction: "row",
|
|
129
|
+
spacing: 1,
|
|
130
|
+
useFlexGap: true,
|
|
131
|
+
sx: {
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
flexWrap: 'wrap'
|
|
134
|
+
},
|
|
135
|
+
children: [
|
|
136
|
+
clauses.map((clause, index)=>{
|
|
137
|
+
const served = servedField !== null && clause.field === servedField;
|
|
138
|
+
return /*#__PURE__*/ _jsx(Tooltip, {
|
|
139
|
+
title: served ? 'Searched across every record' : 'Narrows the records already loaded',
|
|
140
|
+
children: /*#__PURE__*/ _jsx(Chip, {
|
|
141
|
+
size: "small",
|
|
142
|
+
variant: served ? 'filled' : 'outlined',
|
|
143
|
+
color: served ? 'primary' : 'default',
|
|
144
|
+
label: sentence(clause),
|
|
145
|
+
disabled: disabled,
|
|
146
|
+
onDelete: ()=>onChange(clauses.filter((_entry, at)=>at !== index))
|
|
147
|
+
})
|
|
148
|
+
}, `${clause.field}-${clause.op}-${index}`);
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
151
|
+
size: "small",
|
|
152
|
+
startIcon: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
153
|
+
path: mdiFilterPlusOutline.path,
|
|
154
|
+
size: 0.8
|
|
155
|
+
}),
|
|
156
|
+
onClick: open,
|
|
157
|
+
disabled: disabled || !choosable.length || clauses.length >= CRM_VIEW_MAX_FILTERS,
|
|
158
|
+
"aria-haspopup": "dialog",
|
|
159
|
+
children: 'Add filter'
|
|
160
|
+
}),
|
|
161
|
+
/*#__PURE__*/ _jsx(Popover, {
|
|
162
|
+
open: Boolean(anchor),
|
|
163
|
+
anchorEl: anchor,
|
|
164
|
+
onClose: close,
|
|
165
|
+
anchorOrigin: {
|
|
166
|
+
vertical: 'bottom',
|
|
167
|
+
horizontal: 'left'
|
|
168
|
+
},
|
|
169
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
170
|
+
spacing: 1.5,
|
|
171
|
+
sx: {
|
|
172
|
+
p: 2,
|
|
173
|
+
minWidth: 280
|
|
174
|
+
},
|
|
175
|
+
role: "dialog",
|
|
176
|
+
"aria-label": "Add filter",
|
|
177
|
+
children: [
|
|
178
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
179
|
+
select: true,
|
|
180
|
+
size: "small",
|
|
181
|
+
label: "Field",
|
|
182
|
+
value: draft.field,
|
|
183
|
+
onChange: (event)=>chooseField(event.target.value),
|
|
184
|
+
children: choosable.map((field)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
185
|
+
value: field.column,
|
|
186
|
+
children: header(field.column)
|
|
187
|
+
}, field.column))
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
190
|
+
select: true,
|
|
191
|
+
size: "small",
|
|
192
|
+
label: "Condition",
|
|
193
|
+
value: draft.op,
|
|
194
|
+
onChange: (event)=>setDraft((prev)=>_extends({}, prev, {
|
|
195
|
+
op: event.target.value,
|
|
196
|
+
value: ''
|
|
197
|
+
})),
|
|
198
|
+
disabled: !draftField,
|
|
199
|
+
children: operators.map((op)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
200
|
+
value: op,
|
|
201
|
+
children: listFilterOperatorLabel(op)
|
|
202
|
+
}, op))
|
|
203
|
+
}),
|
|
204
|
+
valueless ? null : draftOptions ? /*#__PURE__*/ _jsx(TextField, {
|
|
205
|
+
select: true,
|
|
206
|
+
size: "small",
|
|
207
|
+
label: "Value",
|
|
208
|
+
value: multi ? draft.value.split(',').filter(Boolean) : draft.value,
|
|
209
|
+
onChange: (event)=>{
|
|
210
|
+
const next = event.target.value;
|
|
211
|
+
setDraft((prev)=>_extends({}, prev, {
|
|
212
|
+
value: Array.isArray(next) ? next.join(',') : String(next)
|
|
213
|
+
}));
|
|
214
|
+
},
|
|
215
|
+
slotProps: multi ? {
|
|
216
|
+
select: {
|
|
217
|
+
multiple: true
|
|
218
|
+
}
|
|
219
|
+
} : undefined,
|
|
220
|
+
children: draftOptions.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
221
|
+
value: option.value,
|
|
222
|
+
children: option.label
|
|
223
|
+
}, option.value))
|
|
224
|
+
}) : (draftField == null ? void 0 : draftField.kind) === 'boolean' ? /*#__PURE__*/ _jsxs(TextField, {
|
|
225
|
+
select: true,
|
|
226
|
+
size: "small",
|
|
227
|
+
label: "Value",
|
|
228
|
+
value: draft.value,
|
|
229
|
+
onChange: (event)=>setDraft((prev)=>_extends({}, prev, {
|
|
230
|
+
value: event.target.value
|
|
231
|
+
})),
|
|
232
|
+
children: [
|
|
233
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
234
|
+
value: "true",
|
|
235
|
+
children: 'Yes'
|
|
236
|
+
}),
|
|
237
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
238
|
+
value: "false",
|
|
239
|
+
children: 'No'
|
|
240
|
+
})
|
|
241
|
+
]
|
|
242
|
+
}) : /*#__PURE__*/ _jsx(TextField, {
|
|
243
|
+
size: "small",
|
|
244
|
+
label: "Value",
|
|
245
|
+
type: (draftField == null ? void 0 : draftField.kind) === 'date' ? 'date' : (draftField == null ? void 0 : draftField.kind) === 'number' ? 'number' : 'text',
|
|
246
|
+
placeholder: multi ? 'one, two, three' : undefined,
|
|
247
|
+
helperText: multi ? 'Separate several with commas' : undefined,
|
|
248
|
+
value: draft.value,
|
|
249
|
+
onChange: (event)=>setDraft((prev)=>_extends({}, prev, {
|
|
250
|
+
value: event.target.value
|
|
251
|
+
})),
|
|
252
|
+
onKeyDown: (event)=>{
|
|
253
|
+
if (event.key === 'Enter') {
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
add();
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
slotProps: (draftField == null ? void 0 : draftField.kind) === 'date' ? {
|
|
259
|
+
inputLabel: {
|
|
260
|
+
shrink: true
|
|
261
|
+
}
|
|
262
|
+
} : undefined
|
|
263
|
+
}),
|
|
264
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
265
|
+
direction: "row",
|
|
266
|
+
spacing: 1,
|
|
267
|
+
sx: {
|
|
268
|
+
justifyContent: 'flex-end'
|
|
269
|
+
},
|
|
270
|
+
children: [
|
|
271
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
272
|
+
size: "small",
|
|
273
|
+
onClick: close,
|
|
274
|
+
children: 'Cancel'
|
|
275
|
+
}),
|
|
276
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
277
|
+
size: "small",
|
|
278
|
+
variant: "contained",
|
|
279
|
+
disabled: !canAdd,
|
|
280
|
+
onClick: add,
|
|
281
|
+
children: 'Add'
|
|
282
|
+
})
|
|
283
|
+
]
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
CrmFilterBar.displayName = 'CrmFilterBar';
|
|
292
|
+
export default CrmFilterBar;
|
|
293
|
+
|
|
294
|
+
//# sourceMappingURL=crm-filter-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/crm-filter-bar.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { CRM_VIEW_MAX_FILTERS, type CrmViewFilterClause } from '@aglyn/aglyn'\nimport { mdiFilterPlusOutline } from '@aglyn/shared-data-mdi'\nimport { MdiIcon } from '@aglyn/shared-ui-jsx'\nimport {\n type ListFilterField,\n listFilterOperatorLabel,\n listFilterOperators,\n} from '@aglyn/shared-ui-jsx/const/list-filter'\nimport {\n Button,\n Chip,\n MenuItem,\n Popover,\n Stack,\n TextField,\n Tooltip,\n} from '@mui/material'\nimport { type MouseEvent, useMemo, useState } from 'react'\n\n/** A choice for a field whose value is picked rather than typed. */\nexport interface CrmFilterOption {\n value: string\n label: string\n}\n\nexport interface CrmFilterBarProps {\n /** The list's grammar — every field a clause may name. */\n fields: readonly ListFilterField[]\n /** How a field reads on a chip; a field without one reads as its column. */\n headers: Readonly<Record<string, string>>\n clauses: readonly CrmViewFilterClause[]\n onChange: (clauses: CrmViewFilterClause[]) => void\n /**\n * Choices per field — an owner from the roster, a stage from the fixed\n * list, a source from its labels. A field with choices gets a picker\n * and its chip shows the label; without them a value is typed.\n */\n options?: Readonly<Record<string, readonly CrmFilterOption[]>>\n /** The field the query is serving, marked so the reader knows which reached everything. */\n servedField?: string | null\n disabled?: boolean\n /**\n * The reader reached for a filter. A section that reads its pickers'\n * choices lazily — the roster, the companies — starts those reads here,\n * so a list nobody is narrowing pays for neither.\n */\n onOpen?: () => void\n}\n\n/** Operators that carry no value, so the value box is not shown for them. */\nconst VALUELESS = new Set(['isEmpty', 'isNotEmpty'])\n/** Operators that take several values, comma-joined the way the grammar splits them. */\nconst MULTI = new Set(['isAnyOf'])\n\nconst dayLabel = (raw: string): string => {\n const at = new Date(raw)\n return Number.isNaN(at.getTime()) ? raw : at.toLocaleDateString()\n}\n\n/**\n * The chips above a CRM list: every clause the list is narrowed by, and\n * the one control that adds another (AGL-2617).\n *\n * A saved view carries several clauses and the data grid's own filter panel\n * holds one, so the list needs an editor of its own for the set. Each\n * clause is a chip that reads as a sentence — \"Owner is Dana\", \"Created on\n * or after 1 Jan\" — with the clause the query serves marked, because that\n * is the one that reached every contact and the others narrowed the loaded\n * window; the list's caption says the same thing in prose.\n *\n * Adding one is a popover, not a row of controls: field, operator, value,\n * Add. The value control follows the field — a picker where the section\n * supplied choices, a date box for a date, a number box for a number, a\n * text box otherwise — and the operators offered are exactly the ones the\n * grammar declares for the field, so a clause cannot be built that nothing\n * answers.\n */\nexport function CrmFilterBar(props: CrmFilterBarProps) {\n const {\n fields,\n headers,\n clauses,\n onChange,\n options = {},\n servedField = null,\n disabled = false,\n onOpen,\n } = props\n const [anchor, setAnchor] = useState<HTMLElement | null>(null)\n const [draft, setDraft] = useState<{ field: string; op: string; value: string }>({\n field: '',\n op: '',\n value: '',\n })\n\n /** Fields a clause can be added on — those with at least one operator. */\n const choosable = useMemo(\n () => fields.filter((field) => listFilterOperators(field).length > 0),\n [fields],\n )\n const header = (column: string) => headers[column] ?? column\n const draftField = choosable.find((field) => field.column === draft.field) ?? null\n const operators = draftField ? listFilterOperators(draftField) : []\n const draftOptions = draft.field ? options[draft.field] : undefined\n const valueless = VALUELESS.has(draft.op)\n const multi = MULTI.has(draft.op)\n\n const open = (event: MouseEvent<HTMLElement>) => {\n const first = choosable[0]\n const firstOps = first ? listFilterOperators(first) : []\n setDraft({ field: first?.column ?? '', op: firstOps[0] ?? '', value: '' })\n setAnchor(event.currentTarget)\n onOpen?.()\n }\n const close = () => setAnchor(null)\n\n const chooseField = (column: string) => {\n const field = choosable.find((entry) => entry.column === column)\n const ops = field ? listFilterOperators(field) : []\n setDraft({ field: column, op: ops[0] ?? '', value: '' })\n }\n\n const canAdd =\n Boolean(draft.field && draft.op) &&\n (valueless || draft.value.trim() !== '') &&\n clauses.length < CRM_VIEW_MAX_FILTERS\n\n const add = () => {\n if (!canAdd) return\n const value = valueless ? '' : draft.value.trim()\n const label =\n draftOptions && !multi\n ? draftOptions.find((option) => option.value === value)?.label\n : undefined\n onChange([...clauses, { field: draft.field, op: draft.op, value, ...(label ? { label } : {}) }])\n close()\n }\n\n /** How a clause reads: its header, its operator, and its value by label. */\n const sentence = (clause: CrmViewFilterClause): string => {\n const field = fields.find((entry) => entry.column === clause.field)\n const choices = options[clause.field]\n const named = (value: string) =>\n choices?.find((option) => option.value === value)?.label ?? value\n const value = VALUELESS.has(clause.op)\n ? ''\n : MULTI.has(clause.op)\n ? clause.value\n .split(',')\n .map((entry) => entry.trim())\n .filter(Boolean)\n .map(named)\n .join(', ')\n : clause.label ?? (field?.kind === 'date' ? dayLabel(clause.value) : named(clause.value))\n return `${header(clause.field)} ${listFilterOperatorLabel(clause.op)}${value ? ` ${value}` : ''}`\n }\n\n return (\n <Stack\n direction=\"row\"\n spacing={1}\n useFlexGap\n sx={{ alignItems: 'center', flexWrap: 'wrap' }}\n >\n {clauses.map((clause, index) => {\n const served = servedField !== null && clause.field === servedField\n return (\n <Tooltip\n key={`${clause.field}-${clause.op}-${index}`}\n title={\n served\n ? 'Searched across every record'\n : 'Narrows the records already loaded'\n }\n >\n <Chip\n size=\"small\"\n variant={served ? 'filled' : 'outlined'}\n color={served ? 'primary' : 'default'}\n label={sentence(clause)}\n disabled={disabled}\n onDelete={() => onChange(clauses.filter((_entry, at) => at !== index))}\n />\n </Tooltip>\n )\n })}\n <Button\n size=\"small\"\n startIcon={<MdiIcon path={mdiFilterPlusOutline.path} size={0.8} />}\n onClick={open}\n disabled={disabled || !choosable.length || clauses.length >= CRM_VIEW_MAX_FILTERS}\n aria-haspopup=\"dialog\"\n >\n {'Add filter'}\n </Button>\n <Popover\n open={Boolean(anchor)}\n anchorEl={anchor}\n onClose={close}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}\n >\n <Stack spacing={1.5} sx={{ p: 2, minWidth: 280 }} role=\"dialog\" aria-label=\"Add filter\">\n <TextField\n select\n size=\"small\"\n label=\"Field\"\n value={draft.field}\n onChange={(event) => chooseField(event.target.value)}\n >\n {choosable.map((field) => (\n <MenuItem key={field.column} value={field.column}>\n {header(field.column)}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n select\n size=\"small\"\n label=\"Condition\"\n value={draft.op}\n onChange={(event) => setDraft((prev) => ({ ...prev, op: event.target.value, value: '' }))}\n disabled={!draftField}\n >\n {operators.map((op) => (\n <MenuItem key={op} value={op}>\n {listFilterOperatorLabel(op)}\n </MenuItem>\n ))}\n </TextField>\n {valueless ? null : draftOptions ? (\n <TextField\n select\n size=\"small\"\n label=\"Value\"\n value={multi ? draft.value.split(',').filter(Boolean) : draft.value}\n onChange={(event) => {\n const next = event.target.value as unknown\n setDraft((prev) => ({\n ...prev,\n value: Array.isArray(next) ? next.join(',') : String(next),\n }))\n }}\n slotProps={multi ? { select: { multiple: true } } : undefined}\n >\n {draftOptions.map((option) => (\n <MenuItem key={option.value} value={option.value}>\n {option.label}\n </MenuItem>\n ))}\n </TextField>\n ) : draftField?.kind === 'boolean' ? (\n <TextField\n select\n size=\"small\"\n label=\"Value\"\n value={draft.value}\n onChange={(event) => setDraft((prev) => ({ ...prev, value: event.target.value }))}\n >\n <MenuItem value=\"true\">{'Yes'}</MenuItem>\n <MenuItem value=\"false\">{'No'}</MenuItem>\n </TextField>\n ) : (\n <TextField\n size=\"small\"\n label=\"Value\"\n type={\n draftField?.kind === 'date'\n ? 'date'\n : draftField?.kind === 'number'\n ? 'number'\n : 'text'\n }\n placeholder={multi ? 'one, two, three' : undefined}\n helperText={multi ? 'Separate several with commas' : undefined}\n value={draft.value}\n onChange={(event) => setDraft((prev) => ({ ...prev, value: event.target.value }))}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n add()\n }\n }}\n slotProps={\n draftField?.kind === 'date' ? { inputLabel: { shrink: true } } : undefined\n }\n />\n )}\n <Stack direction=\"row\" spacing={1} sx={{ justifyContent: 'flex-end' }}>\n <Button size=\"small\" onClick={close}>\n {'Cancel'}\n </Button>\n <Button size=\"small\" variant=\"contained\" disabled={!canAdd} onClick={add}>\n {'Add'}\n </Button>\n </Stack>\n </Stack>\n </Popover>\n </Stack>\n )\n}\nCrmFilterBar.displayName = 'CrmFilterBar'\n\nexport default CrmFilterBar\n"],"names":["CRM_VIEW_MAX_FILTERS","mdiFilterPlusOutline","MdiIcon","listFilterOperatorLabel","listFilterOperators","Button","Chip","MenuItem","Popover","Stack","TextField","Tooltip","useMemo","useState","VALUELESS","Set","MULTI","dayLabel","raw","at","Date","Number","isNaN","getTime","toLocaleDateString","CrmFilterBar","props","choosable","fields","headers","clauses","onChange","options","servedField","disabled","onOpen","anchor","setAnchor","draft","setDraft","field","op","value","filter","length","header","column","draftField","find","operators","draftOptions","undefined","valueless","has","multi","open","event","firstOps","first","currentTarget","close","chooseField","ops","entry","canAdd","Boolean","trim","add","label","option","sentence","clause","choices","named","split","map","join","kind","direction","spacing","useFlexGap","sx","alignItems","flexWrap","index","served","title","size","variant","color","onDelete","_entry","startIcon","path","onClick","aria-haspopup","anchorEl","onClose","anchorOrigin","vertical","horizontal","p","minWidth","role","aria-label","select","target","prev","next","Array","isArray","String","slotProps","multiple","type","placeholder","helperText","onKeyDown","key","preventDefault","inputLabel","shrink","justifyContent","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,oBAAoB,QAAkC,eAAc;AAC7E,SAASC,oBAAoB,QAAQ,yBAAwB;AAC7D,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,SAEEC,uBAAuB,EACvBC,mBAAmB,QACd,yCAAwC;AAC/C,SACEC,MAAM,EACNC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,KAAK,EACLC,SAAS,EACTC,OAAO,QACF,gBAAe;AACtB,SAA0BC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAgC1D,2EAA2E,GAC3E,MAAMC,YAAY,IAAIC,IAAI;IAAC;IAAW;CAAa;AACnD,sFAAsF,GACtF,MAAMC,QAAQ,IAAID,IAAI;IAAC;CAAU;AAEjC,MAAME,WAAW,CAACC;IAChB,MAAMC,KAAK,IAAIC,KAAKF;IACpB,OAAOG,OAAOC,KAAK,CAACH,GAAGI,OAAO,MAAML,MAAMC,GAAGK,kBAAkB;AACjE;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,aAAaC,KAAwB;QAwBhCC;IAvBnB,MAAM,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,QAAQ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;8CAC3B;;8CAEH,KAACvD;oCAAOkF,MAAK;oCAAQC,SAAQ;oCAAYtD,UAAU,CAAC8B;oCAAQ8B,SAAS3B;8CAClE;;;;;;;;;AAOf;AACA1C,aAAakG,WAAW,GAAG;AAE3B,eAAelG,aAAY"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface CrmGlanceCardProps {
|
|
2
|
+
/**
|
|
3
|
+
* The site the card is on the dashboard of, or `null` beneath the org
|
|
4
|
+
* hub's mount (AGL-2634), where the figures total every site: the
|
|
5
|
+
* org-wide reads carry no scope clause, and the lead figure fans out
|
|
6
|
+
* over the mount's site list.
|
|
7
|
+
*/
|
|
8
|
+
hostId: string | null;
|
|
9
|
+
/** The org hub's own path, for the links when there is no site to derive them from. */
|
|
10
|
+
basePath?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* CRM at a glance (AGL-2604): a `hostDashboard` widget with five numbers —
|
|
14
|
+
* contacts, new this week, open pipeline value, tasks due today or overdue,
|
|
15
|
+
* and leads still to work (AGL-2624) — each a link into the section that
|
|
16
|
+
* explains it.
|
|
17
|
+
*
|
|
18
|
+
* Server aggregates and nothing else: a dashboard card mounts on every
|
|
19
|
+
* visit to the site's front page, so it is the one surface on which a
|
|
20
|
+
* bounded read of a thousand rows would be a cost paid for nothing. Each
|
|
21
|
+
* number is a count or a sum the server takes over the same `visibleTo`
|
|
22
|
+
* predicate the hub's sections query with, so the card never shows a figure
|
|
23
|
+
* the section behind the link would not.
|
|
24
|
+
*
|
|
25
|
+
* The lead figure is two counts and a subtraction — every lead on the site,
|
|
26
|
+
* less the closed ones — because a lead nobody has touched carries no status
|
|
27
|
+
* field and Firestore cannot select on a field's absence; see
|
|
28
|
+
* `openLeadsFromCounts`. Leads are host-scoped by path rather than by
|
|
29
|
+
* `visibleTo`, so those two counts run on `hosts/{hostId}/leads` under the
|
|
30
|
+
* site's own rules, the way the Leads section reads it.
|
|
31
|
+
*
|
|
32
|
+
* The widget is handed a host doc id and nothing else, so the org — needed
|
|
33
|
+
* for the consent group whose tokens scope the reads — comes from
|
|
34
|
+
* `useOrgPlan`, and the link base from `useConsoleHostRoute`, the way the
|
|
35
|
+
* commerce glance card builds its store link. Nothing is read until the org
|
|
36
|
+
* has settled: a first round of aggregates against the solo group, replaced
|
|
37
|
+
* by a second against the real one, would be two reads for one answer.
|
|
38
|
+
*
|
|
39
|
+
* ## The organization level (AGL-2634)
|
|
40
|
+
*
|
|
41
|
+
* Mounted with no site beneath the org hub's mount, the card totals the
|
|
42
|
+
* organization: the reads carry no scope clause — the rules admit an
|
|
43
|
+
* org-wide member to every row — and the lead figure is the same two
|
|
44
|
+
* counts per site, over every site the mount lists, summed. Nothing is
|
|
45
|
+
* read until that list has settled, for the reason nothing is read under
|
|
46
|
+
* a site until the org has. The org's dashboard has no widget slot yet, so
|
|
47
|
+
* the mount is a capability rather than a page; what it needs from the
|
|
48
|
+
* shell is a slot and the hub's `basePath`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function CrmGlanceCard(props: CrmGlanceCardProps): import("react").JSX.Element;
|
|
51
|
+
export declare namespace CrmGlanceCard {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
export default CrmGlanceCard;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import * as Aglyn from "@aglyn/aglyn";
|
|
20
|
+
import { money } from "@aglyn/shared-ui-email-campaigns/components/report-figures";
|
|
21
|
+
import { AppLink, CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { Button, Stack, Typography } from "@mui/material";
|
|
23
|
+
import { getAggregateFromServer, getCountFromServer, query, sum, Timestamp, where } from "firebase/firestore";
|
|
24
|
+
import { useMemo } from "react";
|
|
25
|
+
import { useConsoleHostRoute, useFirestore, useOrgDataScope, useOrgPlan } from "@aglyn/tenant-feature-instance";
|
|
26
|
+
import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
|
|
27
|
+
import { crmRoutes } from "../model/crm-routes.js";
|
|
28
|
+
import { openLeadsAcrossSites } from "./reports/lead-counts.js";
|
|
29
|
+
import { scopedCollection, visibleToClause } from "./reports/report-scope.js";
|
|
30
|
+
import { ReportStatTile } from "./reports/report-stat-tile.js";
|
|
31
|
+
import { useAggregateRead } from "./reports/use-aggregate-read.js";
|
|
32
|
+
const WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
|
33
|
+
/**
|
|
34
|
+
* CRM at a glance (AGL-2604): a `hostDashboard` widget with five numbers —
|
|
35
|
+
* contacts, new this week, open pipeline value, tasks due today or overdue,
|
|
36
|
+
* and leads still to work (AGL-2624) — each a link into the section that
|
|
37
|
+
* explains it.
|
|
38
|
+
*
|
|
39
|
+
* Server aggregates and nothing else: a dashboard card mounts on every
|
|
40
|
+
* visit to the site's front page, so it is the one surface on which a
|
|
41
|
+
* bounded read of a thousand rows would be a cost paid for nothing. Each
|
|
42
|
+
* number is a count or a sum the server takes over the same `visibleTo`
|
|
43
|
+
* predicate the hub's sections query with, so the card never shows a figure
|
|
44
|
+
* the section behind the link would not.
|
|
45
|
+
*
|
|
46
|
+
* The lead figure is two counts and a subtraction — every lead on the site,
|
|
47
|
+
* less the closed ones — because a lead nobody has touched carries no status
|
|
48
|
+
* field and Firestore cannot select on a field's absence; see
|
|
49
|
+
* `openLeadsFromCounts`. Leads are host-scoped by path rather than by
|
|
50
|
+
* `visibleTo`, so those two counts run on `hosts/{hostId}/leads` under the
|
|
51
|
+
* site's own rules, the way the Leads section reads it.
|
|
52
|
+
*
|
|
53
|
+
* The widget is handed a host doc id and nothing else, so the org — needed
|
|
54
|
+
* for the consent group whose tokens scope the reads — comes from
|
|
55
|
+
* `useOrgPlan`, and the link base from `useConsoleHostRoute`, the way the
|
|
56
|
+
* commerce glance card builds its store link. Nothing is read until the org
|
|
57
|
+
* has settled: a first round of aggregates against the solo group, replaced
|
|
58
|
+
* by a second against the real one, would be two reads for one answer.
|
|
59
|
+
*
|
|
60
|
+
* ## The organization level (AGL-2634)
|
|
61
|
+
*
|
|
62
|
+
* Mounted with no site beneath the org hub's mount, the card totals the
|
|
63
|
+
* organization: the reads carry no scope clause — the rules admit an
|
|
64
|
+
* org-wide member to every row — and the lead figure is the same two
|
|
65
|
+
* counts per site, over every site the mount lists, summed. Nothing is
|
|
66
|
+
* read until that list has settled, for the reason nothing is read under
|
|
67
|
+
* a site until the org has. The org's dashboard has no widget slot yet, so
|
|
68
|
+
* the mount is a capability rather than a page; what it needs from the
|
|
69
|
+
* shell is a slot and the hub's `basePath`.
|
|
70
|
+
*/ export function CrmGlanceCard(props) {
|
|
71
|
+
var _ref;
|
|
72
|
+
const { hostId, basePath } = props;
|
|
73
|
+
const mount = useCrmOrgMount();
|
|
74
|
+
const consoleRoute = useConsoleHostRoute(hostId);
|
|
75
|
+
const { org, ready: planReady } = useOrgPlan(hostId != null ? hostId : undefined);
|
|
76
|
+
const { scope } = useOrgDataScope(hostId ? {
|
|
77
|
+
hostId
|
|
78
|
+
} : {
|
|
79
|
+
orgId: mount == null ? void 0 : mount.orgId
|
|
80
|
+
});
|
|
81
|
+
const firestore = useFirestore();
|
|
82
|
+
// Under a site, the site's group's tokens once the org has settled; at
|
|
83
|
+
// the org level `null` — no clause — once the site list has.
|
|
84
|
+
const tokens = useMemo(()=>{
|
|
85
|
+
if (!hostId) return null;
|
|
86
|
+
if (!planReady) return undefined;
|
|
87
|
+
const group = Aglyn.consentGroupForHost(org != null ? org : null, hostId);
|
|
88
|
+
return [
|
|
89
|
+
Aglyn.ORG_SCOPE_TOKEN,
|
|
90
|
+
...group.hostIds.map((id)=>Aglyn.hostScopeToken(id))
|
|
91
|
+
].slice(0, Aglyn.MAX_SCOPE_HOSTS);
|
|
92
|
+
}, [
|
|
93
|
+
org,
|
|
94
|
+
planReady,
|
|
95
|
+
hostId
|
|
96
|
+
]);
|
|
97
|
+
const leadSites = useMemo(()=>hostId ? [
|
|
98
|
+
hostId
|
|
99
|
+
] : (mount == null ? void 0 : mount.hostsReady) ? mount.hosts.map((host)=>host.id) : null, [
|
|
100
|
+
hostId,
|
|
101
|
+
mount
|
|
102
|
+
]);
|
|
103
|
+
const leadSitesKey = (_ref = leadSites == null ? void 0 : leadSites.join('\n')) != null ? _ref : '';
|
|
104
|
+
// Anchored once per mount so the queries are stable across renders.
|
|
105
|
+
const nowMs = useMemo(()=>Date.now(), []);
|
|
106
|
+
const figures = useAggregateRead(()=>{
|
|
107
|
+
if (!scope || tokens === undefined || !leadSites) return null;
|
|
108
|
+
const contacts = scopedCollection(firestore, scope, 'contacts');
|
|
109
|
+
const deals = scopedCollection(firestore, scope, Aglyn.CRM_COLLECTIONS.deals);
|
|
110
|
+
const tasks = scopedCollection(firestore, scope, Aglyn.CRM_COLLECTIONS.tasks);
|
|
111
|
+
const day = Aglyn.localDayBounds(nowMs);
|
|
112
|
+
const countOf = (target)=>getCountFromServer(target).then((snapshot)=>snapshot.data().count);
|
|
113
|
+
return Promise.all([
|
|
114
|
+
countOf(query(contacts, ...visibleToClause(tokens))),
|
|
115
|
+
countOf(query(contacts, ...visibleToClause(tokens), where('createdAt', '>=', Timestamp.fromMillis(nowMs - WEEK_MS)))),
|
|
116
|
+
getAggregateFromServer(query(deals, ...visibleToClause(tokens), where('status', '==', 'open')), {
|
|
117
|
+
amountCents: sum('amountCents')
|
|
118
|
+
}).then((snapshot)=>{
|
|
119
|
+
var _snapshot_data_amountCents;
|
|
120
|
+
return Number((_snapshot_data_amountCents = snapshot.data().amountCents) != null ? _snapshot_data_amountCents : 0);
|
|
121
|
+
}),
|
|
122
|
+
// Due today OR overdue: everything open that is due before the day ends.
|
|
123
|
+
countOf(query(tasks, ...visibleToClause(tokens), where('status', '==', 'open'), where('dueAtMs', '<', day.end))),
|
|
124
|
+
openLeadsAcrossSites(firestore, leadSites)
|
|
125
|
+
]).then(([contacts, newThisWeek, pipelineCents, tasksDue, leadsToWork])=>({
|
|
126
|
+
contacts,
|
|
127
|
+
newThisWeek,
|
|
128
|
+
pipelineCents,
|
|
129
|
+
tasksDue,
|
|
130
|
+
leadsToWork
|
|
131
|
+
}));
|
|
132
|
+
}, [
|
|
133
|
+
firestore,
|
|
134
|
+
scope,
|
|
135
|
+
tokens,
|
|
136
|
+
nowMs,
|
|
137
|
+
leadSitesKey
|
|
138
|
+
]);
|
|
139
|
+
const routes = useMemo(()=>hostId ? consoleRoute.base ? crmRoutes(`${consoleRoute.base}/crm`) : null : basePath ? crmRoutes(basePath) : null, [
|
|
140
|
+
hostId,
|
|
141
|
+
consoleRoute.base,
|
|
142
|
+
basePath
|
|
143
|
+
]);
|
|
144
|
+
const hubHref = hostId ? consoleRoute.base ? `${consoleRoute.base}/crm` : undefined : basePath;
|
|
145
|
+
const value = figures.value;
|
|
146
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
147
|
+
header: 'CRM at a glance',
|
|
148
|
+
help: Aglyn.pluginDocsHelp('crmReports', {
|
|
149
|
+
anchor: '#crm-at-a-glance',
|
|
150
|
+
excerpt: 'Contacts, new contacts this week, the value of every open deal, ' + 'the tasks due today or overdue, and the leads still to work — ' + 'each counted on the server and each a link into the CRM.'
|
|
151
|
+
}),
|
|
152
|
+
contentGutterX: true,
|
|
153
|
+
contentGutterY: true,
|
|
154
|
+
HeaderProps: {
|
|
155
|
+
action: /*#__PURE__*/ _jsx(Button, _extends({
|
|
156
|
+
component: AppLink
|
|
157
|
+
}, {
|
|
158
|
+
componentVariant: 'naked',
|
|
159
|
+
nativeButton: false
|
|
160
|
+
}, {
|
|
161
|
+
href: hubHref,
|
|
162
|
+
size: "small",
|
|
163
|
+
color: "primary",
|
|
164
|
+
children: 'Open CRM'
|
|
165
|
+
}))
|
|
166
|
+
},
|
|
167
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
168
|
+
spacing: 1.5,
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
171
|
+
direction: "row",
|
|
172
|
+
spacing: 3,
|
|
173
|
+
sx: {
|
|
174
|
+
flexWrap: 'wrap'
|
|
175
|
+
},
|
|
176
|
+
children: [
|
|
177
|
+
/*#__PURE__*/ _jsx(ReportStatTile, {
|
|
178
|
+
label: 'Contacts',
|
|
179
|
+
value: value ? value.contacts.toLocaleString() : null,
|
|
180
|
+
href: routes == null ? void 0 : routes.section('contacts')
|
|
181
|
+
}),
|
|
182
|
+
/*#__PURE__*/ _jsx(ReportStatTile, {
|
|
183
|
+
label: 'New this week',
|
|
184
|
+
value: value ? value.newThisWeek.toLocaleString() : null,
|
|
185
|
+
href: routes == null ? void 0 : routes.section('contacts')
|
|
186
|
+
}),
|
|
187
|
+
/*#__PURE__*/ _jsx(ReportStatTile, {
|
|
188
|
+
label: 'Open pipeline',
|
|
189
|
+
value: value ? money(value.pipelineCents, 'usd') : null,
|
|
190
|
+
href: routes == null ? void 0 : routes.section('deals')
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ _jsx(ReportStatTile, {
|
|
193
|
+
label: 'Tasks due',
|
|
194
|
+
value: value ? value.tasksDue.toLocaleString() : null,
|
|
195
|
+
note: 'today or overdue',
|
|
196
|
+
color: (value == null ? void 0 : value.tasksDue) ? 'warning.main' : undefined,
|
|
197
|
+
href: routes == null ? void 0 : routes.section('tasks')
|
|
198
|
+
}),
|
|
199
|
+
/*#__PURE__*/ _jsx(ReportStatTile, {
|
|
200
|
+
label: 'Leads to work',
|
|
201
|
+
value: value ? value.leadsToWork.toLocaleString() : null,
|
|
202
|
+
note: hostId ? 'open on this site' : 'open across every site',
|
|
203
|
+
href: routes == null ? void 0 : routes.section('leads')
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
}),
|
|
207
|
+
figures.status === 'error' ? /*#__PURE__*/ _jsx(Typography, {
|
|
208
|
+
variant: "caption",
|
|
209
|
+
color: "text.secondary",
|
|
210
|
+
children: 'The CRM figures could not be read. Open the CRM for the full picture.'
|
|
211
|
+
}) : null
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
CrmGlanceCard.displayName = 'CrmGlanceCard';
|
|
217
|
+
export default CrmGlanceCard;
|
|
218
|
+
|
|
219
|
+
//# sourceMappingURL=crm-glance-card.js.map
|