@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/companies-bulk-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\n/**\n * The bar over the companies table, for whatever rows are ticked\n * (AGL-2621).\n *\n * Tag or untag them, hand them to an owner, take them into a spreadsheet,\n * or delete them. The patches come from `companies-bulk-writes.ts` and go\n * through the shared runner; the delete is the record page's own\n * `crm/company-delete`, per company, one after another — the route unlinks a\n * company's contacts before it goes, and a company past the detach bound is\n * left standing and NAMED, the way the page says it, so a second delete\n * continues where this one stopped.\n *\n * ## The delete is logged, per company\n *\n * Each company that goes is one line in the site's activity feed, as it\n * would be from its own page. A bulk delete of forty companies is forty\n * acts and forty lines; a single \"deleted 40 companies\" line would name\n * none of them, and the feed exists to answer \"where did Acme go\".\n */\n\nimport { CRM_COLLECTIONS } from '@aglyn/aglyn'\nimport { useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { useFirestore, useHostActivityLogger } from '@aglyn/tenant-feature-instance'\nimport { Button, MenuItem, TextField } from '@mui/material'\nimport { doc } from 'firebase/firestore'\nimport { useCallback, useMemo, useState } from 'react'\nimport { useCrmBulkApply } from '../hooks/use-crm-bulk-apply'\nimport type { OrgMemberOptions } from '../hooks/use-org-member-options'\nimport {\n type CompanyBulkRow,\n planCompanyAddTag,\n planCompanyRemoveTag,\n planCompanySetOwner,\n} from '../model/companies-bulk-writes'\nimport {\n type CompanyCsvOptions,\n type CompanyCsvRow,\n companiesCsv,\n} from '../model/companies-csv'\nimport { COMPANY_DETACH_LIMIT } from '../model/companies'\nimport { deleteCompanyThroughRoute } from '../model/company-delete'\nimport { normalizeBulkTag } from '../model/contacts-bulk-writes'\nimport { downloadTextFile } from '../model/contacts-csv'\nimport {\n type CrmBulkPlan,\n crmBulkWriters,\n runCrmBulkCalls,\n runCrmBulkWrites,\n} from '../model/crm-bulk-writes'\nimport {\n type CrmBulkNoun,\n CrmBulkBarFrame,\n CrmBulkValueDialog,\n countNoun,\n} from './crm-bulk-bar-frame'\nimport CrmExportAllButton from './crm-export-all-button'\nimport { useCrmApi } from './use-crm-api'\n\nexport interface CompaniesBulkBarProps {\n /**\n * The site whose activity feed the bar's acts are logged in, or `null`\n * at the organization level (AGL-2630), where the selection spans sites\n * and no one feed is written.\n */\n hostId: string | null\n /** `['orgs', orgId]`, or `null` while the org is unresolved. */\n scope: readonly ['orgs', string] | null\n rows: readonly (CompanyBulkRow & CompanyCsvRow)[]\n selected: readonly string[]\n onSelectedChange: (ids: string[]) => void\n /** The section's roster — already read for the Owner column. */\n members: OrgMemberOptions\n /** How the export names an owner — the table's own options. */\n csv?: CompanyCsvOptions\n}\n\nconst NOUN: CrmBulkNoun = { singular: 'company', plural: 'companies' }\n\ntype PendingAction = 'add-tag' | 'remove-tag' | 'owner'\n\nconst ACTION_TITLES: Record<PendingAction, string> = {\n 'add-tag': 'Add a tag',\n 'remove-tag': 'Remove a tag',\n owner: 'Set the owner',\n}\n\nconst doneSentence = (action: PendingAction, done: number): string => {\n const rows = countNoun(done, NOUN)\n switch (action) {\n case 'add-tag':\n return `Tagged ${rows}`\n case 'remove-tag':\n return `Removed the tag from ${rows}`\n case 'owner':\n return `Owner set on ${rows}`\n }\n}\n\n/**\n * The bar, or nothing — a separate boundary so the body's hooks never run\n * on the visit to the list that ticks no row.\n */\nexport function CompaniesBulkBar(props: CompaniesBulkBarProps) {\n if (!props.selected.length) return null\n return <CompaniesBulkBarBody {...props} />\n}\nCompaniesBulkBar.displayName = 'CompaniesBulkBar'\n\nfunction CompaniesBulkBarBody(props: CompaniesBulkBarProps) {\n const { hostId, scope, rows, selected, onSelectedChange, members, csv } = props\n const firestore = useFirestore()\n const { confirm } = useConfirmationContext()\n const logActivity = useHostActivityLogger(hostId ?? undefined)\n const callCrm = useCrmApi(hostId)\n const { busy, report, apply, dismissReport } = useCrmBulkApply({ recordKind: 'company' })\n\n const selectedRows = useMemo(() => {\n const chosen = new Set(selected)\n return rows.filter((row) => chosen.has(row.$id))\n }, [rows, selected])\n\n const [pending, setPending] = useState<PendingAction | null>(null)\n const [value, setValue] = useState('')\n\n const writers = useMemo(\n () =>\n crmBulkWriters(firestore, (id) =>\n doc(firestore, scope?.[0] ?? 'orgs', scope?.[1] ?? '', CRM_COLLECTIONS.companies, id),\n ),\n [firestore, scope],\n )\n\n const openAction = (action: PendingAction) => {\n setValue('')\n setPending(action)\n }\n\n const runPlan = useCallback(\n (action: PendingAction, plan: CrmBulkPlan) =>\n apply({\n attempted: plan.writes.length,\n skipped: plan.skipped,\n job: () => runCrmBulkWrites(writers, plan.writes, (write) => write.label),\n done: (count) => doneSentence(action, count),\n }),\n [apply, writers],\n )\n\n const handleApply = useCallback(async () => {\n if (!pending || !scope) return\n const nowMs = Date.now()\n const tag = normalizeBulkTag(value)\n if (pending !== 'owner' && !tag) return\n const plan: CrmBulkPlan =\n pending === 'add-tag'\n ? planCompanyAddTag(selectedRows, tag ?? '', nowMs)\n : pending === 'remove-tag'\n ? planCompanyRemoveTag(selectedRows, tag ?? '', nowMs)\n : planCompanySetOwner(selectedRows, value || null, nowMs)\n const action = pending\n setPending(null)\n await runPlan(action, plan)\n }, [pending, scope, value, selectedRows, runPlan])\n\n const handleExport = useCallback(() => {\n downloadTextFile('companies-selected.csv', 'text/csv', companiesCsv(selectedRows, csv))\n }, [selectedRows, csv])\n\n const handleDelete = useCallback(async () => {\n if (!scope || !selectedRows.length) return\n const count = selectedRows.length\n const confirmed = await confirm({\n title: count === 1 ? 'Delete this company?' : `Delete ${count} companies?`,\n description:\n `${count === 1 ? 'It is' : 'They are'} removed from Companies and ` +\n 'unlinked from every contact at them. The contacts themselves are ' +\n 'kept, and so is anything else filed against the companies.',\n confirmationText: count === 1 ? 'Delete company' : 'Delete companies',\n confirmationButtonProps: { color: 'error' },\n })\n // `confirm` resolves with no value and REJECTS on cancel.\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n const outcome = await apply({\n attempted: count,\n skipped: [],\n job: () =>\n runCrmBulkCalls(\n selectedRows,\n (row) => String(row.name || row.$id),\n async (row) => {\n const result = await deleteCompanyThroughRoute(callCrm, row.$id)\n if (!result.deleted) {\n throw new Error(\n `${COMPANY_DETACH_LIMIT.toLocaleString()} contacts were unlinked ` +\n 'and more remain — delete again to continue',\n )\n }\n logActivity('Deleted company', {\n type: 'company',\n id: row.$id,\n name: row.name,\n })\n },\n ),\n done: (done) => `Deleted ${countNoun(done, NOUN)}`,\n })\n // The rows that went are gone from the table; the refused ones stay\n // selected, so the reader can see which they are and try again.\n const refused = new Set(outcome.refused.map((row) => row.label))\n onSelectedChange(\n selectedRows\n .filter((row) => refused.has(String(row.name || row.$id)))\n .map((row) => row.$id),\n )\n }, [scope, selectedRows, confirm, apply, callCrm, logActivity, onSelectedChange])\n\n return (\n <CrmBulkBarFrame\n count={selected.length}\n noun={NOUN}\n busy={busy}\n onClear={() => onSelectedChange([])}\n report={report}\n onDismissReport={dismissReport}\n extras={\n <CrmBulkValueDialog\n open={pending !== null}\n title={pending ? ACTION_TITLES[pending] : ''}\n count={selected.length}\n noun={NOUN}\n busy={busy}\n canApply={pending === 'owner' || Boolean(normalizeBulkTag(value))}\n onClose={() => setPending(null)}\n onApply={() => void handleApply()}\n >\n {pending === 'add-tag' || pending === 'remove-tag' ? (\n <TextField\n autoFocus\n size=\"small\"\n label=\"Tag\"\n placeholder=\"enterprise\"\n value={value}\n onChange={(event) => setValue(event.target.value)}\n helperText={\n pending === 'add-tag'\n ? 'Lowercased, like the tags on a company'\n : 'Removed wherever it is present'\n }\n />\n ) : pending === 'owner' ? (\n <TextField\n select\n size=\"small\"\n label=\"Owner\"\n value={value}\n onChange={(event) => setValue(event.target.value)}\n disabled={!members.ready}\n error={Boolean(members.error)}\n helperText={members.error ?? (members.ready ? undefined : 'Loading the team…')}\n >\n <MenuItem value=\"\">{'Nobody — clear the owner'}</MenuItem>\n {members.options.map((member) => (\n <MenuItem key={member.uid} value={member.uid}>\n {member.label}\n </MenuItem>\n ))}\n </TextField>\n ) : null}\n </CrmBulkValueDialog>\n }\n >\n <Button size=\"small\" disabled={busy || !scope} onClick={() => openAction('add-tag')}>\n {'Add tag'}\n </Button>\n <Button size=\"small\" disabled={busy || !scope} onClick={() => openAction('remove-tag')}>\n {'Remove tag'}\n </Button>\n <Button size=\"small\" disabled={busy || !scope} onClick={() => openAction('owner')}>\n {'Set owner'}\n </Button>\n <Button size=\"small\" disabled={busy} onClick={handleExport}>\n {'Export CSV'}\n </Button>\n {/*\n The selection's file is the rows on screen; this one is the whole\n collection, streamed by the server (AGL-2662).\n */}\n <CrmExportAllButton\n resource=\"companies\"\n orgId={scope?.[1] ?? null}\n hostId={hostId}\n disabled={busy}\n />\n <Button\n size=\"small\"\n color=\"error\"\n disabled={busy || !scope}\n onClick={() => void handleDelete()}\n >\n {'Delete'}\n </Button>\n </CrmBulkBarFrame>\n )\n}\nCompaniesBulkBarBody.displayName = 'CompaniesBulkBarBody'\n\nexport default CompaniesBulkBar\n"],"names":["CRM_COLLECTIONS","useConfirmationContext","useFirestore","useHostActivityLogger","Button","MenuItem","TextField","doc","useCallback","useMemo","useState","useCrmBulkApply","planCompanyAddTag","planCompanyRemoveTag","planCompanySetOwner","companiesCsv","COMPANY_DETACH_LIMIT","deleteCompanyThroughRoute","normalizeBulkTag","downloadTextFile","crmBulkWriters","runCrmBulkCalls","runCrmBulkWrites","CrmBulkBarFrame","CrmBulkValueDialog","countNoun","CrmExportAllButton","useCrmApi","NOUN","singular","plural","ACTION_TITLES","owner","doneSentence","action","done","rows","CompaniesBulkBar","props","selected","length","CompaniesBulkBarBody","displayName","members","hostId","scope","onSelectedChange","csv","firestore","confirm","logActivity","undefined","callCrm","busy","report","apply","dismissReport","recordKind","selectedRows","chosen","Set","filter","row","has","$id","pending","setPending","value","setValue","writers","id","companies","openAction","runPlan","plan","attempted","writes","skipped","job","write","label","count","handleApply","nowMs","Date","now","tag","handleExport","handleDelete","confirmed","title","description","confirmationText","confirmationButtonProps","color","then","catch","outcome","String","name","result","deleted","Error","toLocaleString","type","refused","map","noun","onClear","onDismissReport","extras","open","canApply","Boolean","onClose","onApply","autoFocus","size","placeholder","onChange","event","target","helperText","select","disabled","ready","error","options","member","uid","onClick","resource","orgId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA;;;;;;;;;;;;;;;;;;CAkBC,GAED,SAASA,eAAe,QAAQ,eAAc;AAC9C,SAASC,sBAAsB,QAAQ,uBAAsB;AAC7D,SAASC,YAAY,EAAEC,qBAAq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,WAAW,GAAG;AAEnC,eAAeL,iBAAgB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type AglynOrgBilling } from '@aglyn/aglyn';
|
|
2
|
+
export interface CompaniesSectionProps {
|
|
3
|
+
/** The site the list is read under, or `null` at the organization level. */
|
|
4
|
+
hostId: string | null;
|
|
5
|
+
org?: Partial<AglynOrgBilling>;
|
|
6
|
+
/** The CRM hub URL, which every company route hangs beneath. */
|
|
7
|
+
basePath: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `/crm/companies` — the organizations behind the people (AGL-2597).
|
|
11
|
+
*
|
|
12
|
+
* A section of its own rather than a column on the contact list, because a
|
|
13
|
+
* company is known by several contacts and carries records of its own: a
|
|
14
|
+
* domain the email suggestion keys on, an address, an owner, and the deals
|
|
15
|
+
* and tasks filed against it. The row opens `/crm/companies/{id}`, where all
|
|
16
|
+
* of that lives; this list is the cheaper surface and reads nothing a row
|
|
17
|
+
* does not show.
|
|
18
|
+
*
|
|
19
|
+
* ## What the listener carries
|
|
20
|
+
*
|
|
21
|
+
* Paged and ordered by the server — `updatedAt desc`, so a company somebody
|
|
22
|
+
* just touched is on page one — and SCOPED by the same `visibleTo
|
|
23
|
+
* array-contains-any` predicate the contact list runs. That predicate is what
|
|
24
|
+
* the rules evaluate: a filtered query is provable per document, and an
|
|
25
|
+
* unfiltered one is refused rather than quietly returning the whole org's
|
|
26
|
+
* accounts to a site that may see one client's.
|
|
27
|
+
*
|
|
28
|
+
* ## What a filter may be
|
|
29
|
+
*
|
|
30
|
+
* The scope predicate is an array clause, and Firestore carries one per
|
|
31
|
+
* query, so the word-prefix search the contact list offers cannot run here.
|
|
32
|
+
* The name is a prefix range and an exact match instead, and the owner is a
|
|
33
|
+
* choice from the roster — each reaching the whole collection, which is the
|
|
34
|
+
* property a search must have: a company on page four is found, not reported
|
|
35
|
+
* missing. `COMPANY_LIST_FILTER_FIELDS` states what the indexes serve.
|
|
36
|
+
*
|
|
37
|
+
* ## Creating is a drawer
|
|
38
|
+
*
|
|
39
|
+
* "New company" opens the same eight-field drawer the company's page edits
|
|
40
|
+
* with, and the new record's page opens when it is saved. A form above a
|
|
41
|
+
* list has nowhere to grow, and this one has an address in it.
|
|
42
|
+
*
|
|
43
|
+
* ## Selection, the bar and the file (AGL-2621)
|
|
44
|
+
*
|
|
45
|
+
* The rows are selectable, and a selection raises `CompaniesBulkBar` over
|
|
46
|
+
* the table. Export CSV writes the loaded page through `companiesCsv()` —
|
|
47
|
+
* the same file the bar writes over the selection, headed as the import
|
|
48
|
+
* reads it — and Import CSV opens the companies drawer beside it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function CompaniesSection(props: CompaniesSectionProps): import("react").JSX.Element;
|
|
51
|
+
export declare namespace CompaniesSection {
|
|
52
|
+
var displayName: string;
|
|
53
|
+
}
|
|
54
|
+
export default CompaniesSection;
|
|
@@ -0,0 +1,522 @@
|
|
|
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_COLLECTIONS, filterByNextActivity, isNoNextActivityClause, pluginDocsHelp } from "@aglyn/aglyn";
|
|
20
|
+
import { mdiPlus } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import { CardDisplay, MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { ListPagination } from "@aglyn/shared-ui-jsx/components/list-pagination.component";
|
|
23
|
+
import { ListTable } from "@aglyn/shared-ui-jsx/components/list-table.component";
|
|
24
|
+
import { gridFilterRequest, listFilterColumn } from "@aglyn/shared-ui-jsx/const/list-filter";
|
|
25
|
+
import { useCrmSavedView } from "../hooks/use-crm-saved-view.js";
|
|
26
|
+
import { useCrmViewGrid } from "../hooks/use-crm-view-grid.js";
|
|
27
|
+
import { CRM_LIST_SLOTS, CrmColumnOrderProvider } from "./crm-column-menu.js";
|
|
28
|
+
import { NoNextActivityToggle, nextActivityColumn } from "./crm-next-activity-column.js";
|
|
29
|
+
import CrmViewsControl from "./crm-views-control.js";
|
|
30
|
+
import { TABLE_ROW_HEIGHT } from "@aglyn/shared-ui-jsx/const/table-pagination";
|
|
31
|
+
import { listFilterConstraints, usePagedCollection, useFirestore } from "@aglyn/tenant-feature-instance";
|
|
32
|
+
import { Button, Chip, Stack, Typography } from "@mui/material";
|
|
33
|
+
import { getGridSingleSelectOperators } from "@mui/x-data-grid";
|
|
34
|
+
import { collection, limit, orderBy, query } from "firebase/firestore";
|
|
35
|
+
import { useRouter } from "next/navigation";
|
|
36
|
+
import { useCallback, useMemo, useState } from "react";
|
|
37
|
+
import { COMPANY_LIST_FILTER_FIELDS } from "../constants/company-filters.js";
|
|
38
|
+
import { useContactFieldDefinitions } from "../hooks/use-contact-field-definitions.js";
|
|
39
|
+
import { crmVisibleToClause, useCrmScope } from "../hooks/use-crm-scope.js";
|
|
40
|
+
import { useOrgMemberOptions } from "../hooks/use-org-member-options.js";
|
|
41
|
+
import { companiesCsv } from "../model/companies-csv.js";
|
|
42
|
+
import { downloadTextFile } from "../model/contacts-csv.js";
|
|
43
|
+
import { crmRoutes } from "../model/crm-routes.js";
|
|
44
|
+
import CompaniesBulkBar from "./companies-bulk-bar.js";
|
|
45
|
+
import CompanyEditDrawer from "./company-edit-drawer.js";
|
|
46
|
+
import { CompanyImportButton } from "./company-import-drawer.js";
|
|
47
|
+
import { customFieldColumns } from "./contact-custom-columns.js";
|
|
48
|
+
/**
|
|
49
|
+
* `/crm/companies` — the organizations behind the people (AGL-2597).
|
|
50
|
+
*
|
|
51
|
+
* A section of its own rather than a column on the contact list, because a
|
|
52
|
+
* company is known by several contacts and carries records of its own: a
|
|
53
|
+
* domain the email suggestion keys on, an address, an owner, and the deals
|
|
54
|
+
* and tasks filed against it. The row opens `/crm/companies/{id}`, where all
|
|
55
|
+
* of that lives; this list is the cheaper surface and reads nothing a row
|
|
56
|
+
* does not show.
|
|
57
|
+
*
|
|
58
|
+
* ## What the listener carries
|
|
59
|
+
*
|
|
60
|
+
* Paged and ordered by the server — `updatedAt desc`, so a company somebody
|
|
61
|
+
* just touched is on page one — and SCOPED by the same `visibleTo
|
|
62
|
+
* array-contains-any` predicate the contact list runs. That predicate is what
|
|
63
|
+
* the rules evaluate: a filtered query is provable per document, and an
|
|
64
|
+
* unfiltered one is refused rather than quietly returning the whole org's
|
|
65
|
+
* accounts to a site that may see one client's.
|
|
66
|
+
*
|
|
67
|
+
* ## What a filter may be
|
|
68
|
+
*
|
|
69
|
+
* The scope predicate is an array clause, and Firestore carries one per
|
|
70
|
+
* query, so the word-prefix search the contact list offers cannot run here.
|
|
71
|
+
* The name is a prefix range and an exact match instead, and the owner is a
|
|
72
|
+
* choice from the roster — each reaching the whole collection, which is the
|
|
73
|
+
* property a search must have: a company on page four is found, not reported
|
|
74
|
+
* missing. `COMPANY_LIST_FILTER_FIELDS` states what the indexes serve.
|
|
75
|
+
*
|
|
76
|
+
* ## Creating is a drawer
|
|
77
|
+
*
|
|
78
|
+
* "New company" opens the same eight-field drawer the company's page edits
|
|
79
|
+
* with, and the new record's page opens when it is saved. A form above a
|
|
80
|
+
* list has nowhere to grow, and this one has an address in it.
|
|
81
|
+
*
|
|
82
|
+
* ## Selection, the bar and the file (AGL-2621)
|
|
83
|
+
*
|
|
84
|
+
* The rows are selectable, and a selection raises `CompaniesBulkBar` over
|
|
85
|
+
* the table. Export CSV writes the loaded page through `companiesCsv()` —
|
|
86
|
+
* the same file the bar writes over the selection, headed as the import
|
|
87
|
+
* reads it — and Import CSV opens the companies drawer beside it.
|
|
88
|
+
*/ export function CompaniesSection(props) {
|
|
89
|
+
var _viewFilters_find;
|
|
90
|
+
const { hostId, org, basePath } = props;
|
|
91
|
+
const routes = crmRoutes(basePath);
|
|
92
|
+
const router = useRouter();
|
|
93
|
+
const firestore = useFirestore();
|
|
94
|
+
const { scope, orgId, visibleTo } = useCrmScope({
|
|
95
|
+
hostId,
|
|
96
|
+
org
|
|
97
|
+
});
|
|
98
|
+
/*
|
|
99
|
+
* The team, read once for this surface: the Owner column names a person
|
|
100
|
+
* from a uid, and the create drawer picks from the same roster. One fetch
|
|
101
|
+
* serves both, which is why the drawer takes it as a prop.
|
|
102
|
+
*/ const members = useOrgMemberOptions(orgId);
|
|
103
|
+
// The org's company fields, for the optional columns below (AGL-2661).
|
|
104
|
+
const companyFields = useContactFieldDefinitions(orgId, 'company');
|
|
105
|
+
/*
|
|
106
|
+
* The column filter is the saved VIEW'S first clause (AGL-2617): this
|
|
107
|
+
* grid's panel holds one, and a view of companies holds that one beside
|
|
108
|
+
* the columns and the sort. Declared BEFORE the listener that reads it,
|
|
109
|
+
* as the filter always was — the query is rebuilt from it.
|
|
110
|
+
*/ const views = useCrmSavedView({
|
|
111
|
+
section: 'companies',
|
|
112
|
+
hostId,
|
|
113
|
+
org,
|
|
114
|
+
basePath
|
|
115
|
+
});
|
|
116
|
+
/*
|
|
117
|
+
* ...beside the "No next activity" clause (AGL-2661), which is not a
|
|
118
|
+
* query the listener can run — absence has no index — and narrows the
|
|
119
|
+
* loaded page below instead. The grid's one clause is the first that is
|
|
120
|
+
* not it, and setting the grid's clause keeps it.
|
|
121
|
+
*/ const viewFilters = views.state.filters;
|
|
122
|
+
const filter = (_viewFilters_find = viewFilters.find((clause)=>!isNoNextActivityClause(clause))) != null ? _viewFilters_find : null;
|
|
123
|
+
const setFilter = useCallback((request)=>views.setFilters([
|
|
124
|
+
...request ? [
|
|
125
|
+
request
|
|
126
|
+
] : [],
|
|
127
|
+
...viewFilters.filter(isNoNextActivityClause)
|
|
128
|
+
]), [
|
|
129
|
+
views.setFilters,
|
|
130
|
+
viewFilters
|
|
131
|
+
]);
|
|
132
|
+
const { rows: loaded, status, hasMore, page, setPage, pageSize, setPageSize } = usePagedCollection((pageLimit)=>{
|
|
133
|
+
if (!scope) return null;
|
|
134
|
+
const constraints = listFilterConstraints(COMPANY_LIST_FILTER_FIELDS, filter);
|
|
135
|
+
return query(collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.companies), // Absent at the organization level, where the tokens are `null` (AGL-2630).
|
|
136
|
+
...crmVisibleToClause(visibleTo), ...constraints != null ? constraints : [
|
|
137
|
+
orderBy('updatedAt', 'desc')
|
|
138
|
+
], limit(pageLimit));
|
|
139
|
+
}, [
|
|
140
|
+
firestore,
|
|
141
|
+
scope,
|
|
142
|
+
visibleTo,
|
|
143
|
+
filter
|
|
144
|
+
], {
|
|
145
|
+
idField: '$id'
|
|
146
|
+
});
|
|
147
|
+
const companies = useMemo(()=>filterByNextActivity(loaded, viewFilters), [
|
|
148
|
+
loaded,
|
|
149
|
+
viewFilters
|
|
150
|
+
]);
|
|
151
|
+
const nowMs = useMemo(()=>Date.now(), []);
|
|
152
|
+
const [createOpen, setCreateOpen] = useState(false);
|
|
153
|
+
const [selectedIds, setSelectedIds] = useState([]);
|
|
154
|
+
/*
|
|
155
|
+
* The owner is written by ADDRESS, because the companies import resolves
|
|
156
|
+
* an owner by email; the same options reach the bar, so the page's file
|
|
157
|
+
* and the selection's are one format.
|
|
158
|
+
*/ const csvOptions = useMemo(()=>({
|
|
159
|
+
ownerEmail: members.emailFor
|
|
160
|
+
}), [
|
|
161
|
+
members.emailFor
|
|
162
|
+
]);
|
|
163
|
+
const handleExport = useCallback(()=>{
|
|
164
|
+
downloadTextFile('companies.csv', 'text/csv', companiesCsv(companies, csvOptions));
|
|
165
|
+
}, [
|
|
166
|
+
companies,
|
|
167
|
+
csvOptions
|
|
168
|
+
]);
|
|
169
|
+
const openCompany = useCallback((id)=>router.push(routes.company(id)), [
|
|
170
|
+
router,
|
|
171
|
+
routes
|
|
172
|
+
]);
|
|
173
|
+
const columns = useMemo(()=>[
|
|
174
|
+
_extends({
|
|
175
|
+
field: 'name',
|
|
176
|
+
headerName: 'Company',
|
|
177
|
+
flex: 1.6,
|
|
178
|
+
minWidth: 240
|
|
179
|
+
}, listFilterColumn(COMPANY_LIST_FILTER_FIELDS, 'name'), {
|
|
180
|
+
valueGetter: (_value, row)=>{
|
|
181
|
+
var _row_name;
|
|
182
|
+
return String((_row_name = row.name) != null ? _row_name : '');
|
|
183
|
+
},
|
|
184
|
+
renderCell: ({ row })=>/*#__PURE__*/ _jsxs(Stack, {
|
|
185
|
+
sx: {
|
|
186
|
+
justifyContent: 'center',
|
|
187
|
+
height: '100%',
|
|
188
|
+
lineHeight: 1.25
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
192
|
+
variant: "body2",
|
|
193
|
+
sx: {
|
|
194
|
+
lineHeight: 1.25
|
|
195
|
+
},
|
|
196
|
+
children: row.name
|
|
197
|
+
}),
|
|
198
|
+
row.industry ? /*#__PURE__*/ _jsx(Typography, {
|
|
199
|
+
variant: "caption",
|
|
200
|
+
color: "text.secondary",
|
|
201
|
+
sx: {
|
|
202
|
+
lineHeight: 1.25
|
|
203
|
+
},
|
|
204
|
+
noWrap: true,
|
|
205
|
+
children: row.industry
|
|
206
|
+
}) : null
|
|
207
|
+
]
|
|
208
|
+
})
|
|
209
|
+
}),
|
|
210
|
+
{
|
|
211
|
+
field: 'domain',
|
|
212
|
+
headerName: 'Domain',
|
|
213
|
+
flex: 1,
|
|
214
|
+
minWidth: 160,
|
|
215
|
+
// Stored normalized, so it could be filtered exactly — but a domain
|
|
216
|
+
// lookup is what the company suggestion on a contact does, and a
|
|
217
|
+
// filter here would need an index of its own for one more way to
|
|
218
|
+
// find a row the name filter already finds.
|
|
219
|
+
filterable: false,
|
|
220
|
+
sortable: false,
|
|
221
|
+
valueGetter: (_value, row)=>{
|
|
222
|
+
var _row_domain;
|
|
223
|
+
return String((_row_domain = row.domain) != null ? _row_domain : '');
|
|
224
|
+
},
|
|
225
|
+
renderCell: ({ row })=>row.domain ? /*#__PURE__*/ _jsx(Typography, {
|
|
226
|
+
variant: "body2",
|
|
227
|
+
children: row.domain
|
|
228
|
+
}) : /*#__PURE__*/ _jsx(Typography, {
|
|
229
|
+
variant: "body2",
|
|
230
|
+
color: "text.secondary",
|
|
231
|
+
children: '—'
|
|
232
|
+
})
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
field: 'contactsCount',
|
|
236
|
+
headerName: 'Contacts',
|
|
237
|
+
width: 110,
|
|
238
|
+
align: 'right',
|
|
239
|
+
headerAlign: 'right',
|
|
240
|
+
/*
|
|
241
|
+
* The denormalized count every link moves (AGL-2613) — a stored
|
|
242
|
+
* number, so a page of companies costs no read per row. Absent on a
|
|
243
|
+
* company nobody has linked since the counter existed, which reads
|
|
244
|
+
* as zero; the company's own page takes the live aggregate.
|
|
245
|
+
*/ filterable: false,
|
|
246
|
+
sortable: false,
|
|
247
|
+
valueGetter: (_value, row)=>{
|
|
248
|
+
var _row_contactsCount;
|
|
249
|
+
return Number((_row_contactsCount = row.contactsCount) != null ? _row_contactsCount : 0);
|
|
250
|
+
},
|
|
251
|
+
renderCell: ({ row })=>{
|
|
252
|
+
var _row_contactsCount;
|
|
253
|
+
return /*#__PURE__*/ _jsx(Typography, {
|
|
254
|
+
variant: "body2",
|
|
255
|
+
color: row.contactsCount ? 'text.primary' : 'text.secondary',
|
|
256
|
+
children: Number((_row_contactsCount = row.contactsCount) != null ? _row_contactsCount : 0).toLocaleString()
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
field: 'tags',
|
|
262
|
+
headerName: 'Tags',
|
|
263
|
+
flex: 1,
|
|
264
|
+
minWidth: 140,
|
|
265
|
+
// Written by the drawer and the bulk bar (AGL-2621); read here, not
|
|
266
|
+
// filtered — a tag filter would need an `array-contains` index of
|
|
267
|
+
// its own beside the scope predicate.
|
|
268
|
+
filterable: false,
|
|
269
|
+
sortable: false,
|
|
270
|
+
valueGetter: (_value, row)=>{
|
|
271
|
+
var _row_tags;
|
|
272
|
+
return ((_row_tags = row.tags) != null ? _row_tags : []).join(', ');
|
|
273
|
+
},
|
|
274
|
+
renderCell: ({ row })=>{
|
|
275
|
+
var _row_tags;
|
|
276
|
+
return ((_row_tags = row.tags) == null ? void 0 : _row_tags.length) ? /*#__PURE__*/ _jsxs(Stack, {
|
|
277
|
+
direction: "row",
|
|
278
|
+
spacing: 0.5,
|
|
279
|
+
sx: {
|
|
280
|
+
alignItems: 'center',
|
|
281
|
+
overflow: 'hidden'
|
|
282
|
+
},
|
|
283
|
+
children: [
|
|
284
|
+
row.tags.slice(0, 3).map((tag)=>/*#__PURE__*/ _jsx(Chip, {
|
|
285
|
+
size: "small",
|
|
286
|
+
variant: "outlined",
|
|
287
|
+
label: tag
|
|
288
|
+
}, tag)),
|
|
289
|
+
row.tags.length > 3 ? /*#__PURE__*/ _jsx(Typography, {
|
|
290
|
+
variant: "caption",
|
|
291
|
+
color: "text.secondary",
|
|
292
|
+
children: `+${row.tags.length - 3}`
|
|
293
|
+
}) : null
|
|
294
|
+
]
|
|
295
|
+
}) : /*#__PURE__*/ _jsx(Typography, {
|
|
296
|
+
variant: "body2",
|
|
297
|
+
color: "text.secondary",
|
|
298
|
+
children: '—'
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
field: 'ownerUid',
|
|
304
|
+
headerName: 'Owner',
|
|
305
|
+
flex: 1,
|
|
306
|
+
minWidth: 160,
|
|
307
|
+
sortable: false,
|
|
308
|
+
/*
|
|
309
|
+
* A CHOICE from the roster, not a text box for a uid. The grid's
|
|
310
|
+
* single-select `is` operator is what the panel offers; the handler
|
|
311
|
+
* below maps it onto the declared field's `equals`, which the
|
|
312
|
+
* translator turns into the equality the index serves.
|
|
313
|
+
*/ type: 'singleSelect',
|
|
314
|
+
valueOptions: members.options.map((option)=>({
|
|
315
|
+
value: option.uid,
|
|
316
|
+
label: option.label
|
|
317
|
+
})),
|
|
318
|
+
filterable: members.options.length > 0,
|
|
319
|
+
filterOperators: getGridSingleSelectOperators().filter((operator)=>operator.value === 'is'),
|
|
320
|
+
valueGetter: (_value, row)=>{
|
|
321
|
+
var _row_ownerUid;
|
|
322
|
+
return String((_row_ownerUid = row.ownerUid) != null ? _row_ownerUid : '');
|
|
323
|
+
},
|
|
324
|
+
renderCell: ({ row })=>/*#__PURE__*/ _jsx(Typography, {
|
|
325
|
+
variant: "body2",
|
|
326
|
+
color: row.ownerUid ? 'text.primary' : 'text.secondary',
|
|
327
|
+
children: row.ownerUid ? members.ready ? members.labelFor(row.ownerUid) : '…' : '—'
|
|
328
|
+
})
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
field: 'updatedAt',
|
|
332
|
+
headerName: 'Updated',
|
|
333
|
+
flex: 0.8,
|
|
334
|
+
minWidth: 140,
|
|
335
|
+
filterable: false,
|
|
336
|
+
sortable: false,
|
|
337
|
+
valueGetter: (_value, row)=>{
|
|
338
|
+
var _row_updatedAt;
|
|
339
|
+
return ((_row_updatedAt = row.updatedAt) == null ? void 0 : _row_updatedAt.seconds) ? new Date(row.updatedAt.seconds * 1000) : null;
|
|
340
|
+
},
|
|
341
|
+
renderCell: ({ row })=>{
|
|
342
|
+
var _row_updatedAt;
|
|
343
|
+
return /*#__PURE__*/ _jsx(Typography, {
|
|
344
|
+
variant: "caption",
|
|
345
|
+
color: "text.secondary",
|
|
346
|
+
children: ((_row_updatedAt = row.updatedAt) == null ? void 0 : _row_updatedAt.seconds) ? new Date(row.updatedAt.seconds * 1000).toLocaleDateString() : '—'
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
// When the earliest open task against the company is due (AGL-2661).
|
|
351
|
+
nextActivityColumn(nowMs),
|
|
352
|
+
// The org's company fields as optional columns (AGL-2661), read off
|
|
353
|
+
// the row's own `custom` map the way the contacts list reads its own.
|
|
354
|
+
...customFieldColumns(companyFields.active)
|
|
355
|
+
], [
|
|
356
|
+
members,
|
|
357
|
+
companyFields.active,
|
|
358
|
+
nowMs
|
|
359
|
+
]);
|
|
360
|
+
/*
|
|
361
|
+
* The grid's models are the view's (AGL-2617). The filter model shows the
|
|
362
|
+
* view's clause in the panel as a typed one would appear — the owner's
|
|
363
|
+
* stored `equals` back as the single-select `is` the panel offers — so a
|
|
364
|
+
* view opened from its address reads as filtered, not as a mystery.
|
|
365
|
+
*/ const grid = useCrmViewGrid(views, columns);
|
|
366
|
+
const filterModel = useMemo(()=>({
|
|
367
|
+
items: filter ? [
|
|
368
|
+
{
|
|
369
|
+
id: 'view',
|
|
370
|
+
field: filter.field,
|
|
371
|
+
operator: filter.field === 'ownerUid' && filter.op === 'equals' ? 'is' : filter.op,
|
|
372
|
+
value: filter.value
|
|
373
|
+
}
|
|
374
|
+
] : []
|
|
375
|
+
}), [
|
|
376
|
+
filter
|
|
377
|
+
]);
|
|
378
|
+
const newCompanyButton = /*#__PURE__*/ _jsx(Button, {
|
|
379
|
+
size: "small",
|
|
380
|
+
variant: "contained",
|
|
381
|
+
color: "primary",
|
|
382
|
+
disabled: !scope,
|
|
383
|
+
startIcon: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
384
|
+
path: mdiPlus.path,
|
|
385
|
+
size: 0.8
|
|
386
|
+
}),
|
|
387
|
+
onClick: ()=>setCreateOpen(true),
|
|
388
|
+
children: 'New company'
|
|
389
|
+
});
|
|
390
|
+
return /*#__PURE__*/ _jsxs(CardDisplay, {
|
|
391
|
+
header: 'Companies',
|
|
392
|
+
help: pluginDocsHelp('companies', {
|
|
393
|
+
anchor: '#the-companies-list'
|
|
394
|
+
}),
|
|
395
|
+
contentGutterX: true,
|
|
396
|
+
contentGutterY: true,
|
|
397
|
+
contentBordered: "all",
|
|
398
|
+
HeaderProps: {
|
|
399
|
+
action: /*#__PURE__*/ _jsxs(Stack, {
|
|
400
|
+
direction: "row",
|
|
401
|
+
spacing: 1,
|
|
402
|
+
sx: {
|
|
403
|
+
alignItems: 'center'
|
|
404
|
+
},
|
|
405
|
+
children: [
|
|
406
|
+
/*#__PURE__*/ _jsx(CrmViewsControl, {
|
|
407
|
+
controller: views,
|
|
408
|
+
allLabel: "All companies"
|
|
409
|
+
}),
|
|
410
|
+
/*#__PURE__*/ _jsx(NoNextActivityToggle, {
|
|
411
|
+
filters: viewFilters,
|
|
412
|
+
onChange: views.setFilters
|
|
413
|
+
}),
|
|
414
|
+
newCompanyButton
|
|
415
|
+
]
|
|
416
|
+
})
|
|
417
|
+
},
|
|
418
|
+
children: [
|
|
419
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
420
|
+
spacing: 1.5,
|
|
421
|
+
children: [
|
|
422
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
423
|
+
direction: "row",
|
|
424
|
+
spacing: 1,
|
|
425
|
+
sx: {
|
|
426
|
+
alignItems: 'center',
|
|
427
|
+
flexWrap: 'wrap',
|
|
428
|
+
rowGap: 1
|
|
429
|
+
},
|
|
430
|
+
children: [
|
|
431
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
432
|
+
variant: "body2",
|
|
433
|
+
color: "text.secondary",
|
|
434
|
+
sx: {
|
|
435
|
+
flex: 1
|
|
436
|
+
},
|
|
437
|
+
children: 'The organizations your contacts belong to. Open one to see its ' + 'people, its deals and its open tasks, or to link a contact ' + 'to it.'
|
|
438
|
+
}),
|
|
439
|
+
/*#__PURE__*/ _jsx(CompanyImportButton, {
|
|
440
|
+
hostId: hostId,
|
|
441
|
+
org: org
|
|
442
|
+
}),
|
|
443
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
444
|
+
size: "small",
|
|
445
|
+
onClick: handleExport,
|
|
446
|
+
disabled: !companies.length,
|
|
447
|
+
children: 'Export CSV'
|
|
448
|
+
})
|
|
449
|
+
]
|
|
450
|
+
}),
|
|
451
|
+
/*#__PURE__*/ _jsx(CompaniesBulkBar, {
|
|
452
|
+
hostId: hostId,
|
|
453
|
+
scope: scope,
|
|
454
|
+
rows: companies,
|
|
455
|
+
selected: selectedIds,
|
|
456
|
+
onSelectedChange: setSelectedIds,
|
|
457
|
+
members: members,
|
|
458
|
+
csv: csvOptions
|
|
459
|
+
}),
|
|
460
|
+
/*#__PURE__*/ _jsx(CrmColumnOrderProvider, {
|
|
461
|
+
value: grid.columnOrder,
|
|
462
|
+
children: /*#__PURE__*/ _jsx(ListTable, {
|
|
463
|
+
rowHeight: TABLE_ROW_HEIGHT,
|
|
464
|
+
columns: grid.columns,
|
|
465
|
+
slots: CRM_LIST_SLOTS,
|
|
466
|
+
rows: companies,
|
|
467
|
+
selectable: {
|
|
468
|
+
selected: selectedIds,
|
|
469
|
+
onChange: setSelectedIds
|
|
470
|
+
},
|
|
471
|
+
noRowsLabel: "No companies yet",
|
|
472
|
+
noRowsDescription: "A company groups the contacts who work at one business, with its domain, owner and address. Create the first one, or link a contact to a company from their page.",
|
|
473
|
+
noRowsAction: newCompanyButton,
|
|
474
|
+
onOpen: (id)=>openCompany(String(id)),
|
|
475
|
+
// An empty table while the read is in flight reads as "you have
|
|
476
|
+
// none" rather than "these are on their way".
|
|
477
|
+
loading: !scope || status === 'loading',
|
|
478
|
+
/*
|
|
479
|
+
* The grid must NOT also filter. The query answers it, so a client
|
|
480
|
+
* pass could only drop rows the query already matched.
|
|
481
|
+
*/ filterMode: "server",
|
|
482
|
+
filterModel: filterModel,
|
|
483
|
+
onFilterModelChange: (model)=>{
|
|
484
|
+
const request = gridFilterRequest(model);
|
|
485
|
+
setFilter(request && request.field === 'ownerUid' && request.op === 'is' ? _extends({}, request, {
|
|
486
|
+
op: 'equals'
|
|
487
|
+
}) : request);
|
|
488
|
+
},
|
|
489
|
+
// Columns and sort are the view's, controlled (AGL-2617).
|
|
490
|
+
columnVisibilityModel: grid.columnVisibilityModel,
|
|
491
|
+
onColumnVisibilityModelChange: grid.onColumnVisibilityModelChange,
|
|
492
|
+
sortModel: grid.sortModel,
|
|
493
|
+
onSortModelChange: grid.onSortModelChange,
|
|
494
|
+
// Paged by the footer below, so the grid must not also slice.
|
|
495
|
+
hideFooter: true
|
|
496
|
+
})
|
|
497
|
+
}),
|
|
498
|
+
/*#__PURE__*/ _jsx(ListPagination, {
|
|
499
|
+
page: page,
|
|
500
|
+
pageSize: pageSize,
|
|
501
|
+
rowCount: companies.length,
|
|
502
|
+
hasMore: hasMore,
|
|
503
|
+
onPageChange: setPage,
|
|
504
|
+
onPageSizeChange: setPageSize
|
|
505
|
+
})
|
|
506
|
+
]
|
|
507
|
+
}),
|
|
508
|
+
createOpen ? /*#__PURE__*/ _jsx(CompanyEditDrawer, {
|
|
509
|
+
open: true,
|
|
510
|
+
onClose: ()=>setCreateOpen(false),
|
|
511
|
+
hostId: hostId,
|
|
512
|
+
org: org,
|
|
513
|
+
members: members,
|
|
514
|
+
onSaved: openCompany
|
|
515
|
+
}) : null
|
|
516
|
+
]
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
CompaniesSection.displayName = 'CompaniesSection';
|
|
520
|
+
export default CompaniesSection;
|
|
521
|
+
|
|
522
|
+
//# sourceMappingURL=companies-section.js.map
|