@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,783 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { canManageOrg, CRM_ASSIGNMENT_RULES_MAX, CRM_ASSIGNMENT_RULES_PATH, CRM_AUTO_CREATE_COMPANIES_PATH, CRM_ROUND_ROBIN_POOL_MAX, CRM_ROUND_ROBIN_POOL_PATH, crmHostDefaultOwnerSegments, describeAssignmentRule, orgAutoCreatesCompanies, pluginDocsHelp, readCrmAssignmentSettings, roundRobinOrder } from "@aglyn/aglyn";
|
|
19
|
+
import { mdiArrowDown, mdiArrowUp, mdiDeleteOutline } from "@aglyn/shared-data-mdi";
|
|
20
|
+
import { CardDisplay, MdiIcon, SrOnly } from "@aglyn/shared-ui-jsx";
|
|
21
|
+
import RowActionsMenu from "@aglyn/shared-ui-jsx/components/row-actions-menu.component";
|
|
22
|
+
import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
|
|
23
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
24
|
+
import { useFirestore, useFirestoreDoc, useUser } from "@aglyn/tenant-feature-instance";
|
|
25
|
+
import { Button, Checkbox, FormControlLabel, FormGroup, FormHelperText, IconButton, MenuItem, Stack, Switch, TableBody, TableCell, TableHead, TableRow, TextField, Typography } from "@mui/material";
|
|
26
|
+
import { deleteField, doc, FieldPath, updateDoc } from "firebase/firestore";
|
|
27
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
28
|
+
import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
|
|
29
|
+
import { useCrmScope } from "../hooks/use-crm-scope.js";
|
|
30
|
+
import { useOrgMemberDirectory } from "../hooks/use-org-member-directory.js";
|
|
31
|
+
import AssignmentRuleDrawer from "./assignment-rule-drawer.js";
|
|
32
|
+
import EmailTemplatesCard from "./email-templates-card.js";
|
|
33
|
+
import EmailCaptureCard from "./email-capture-card.js";
|
|
34
|
+
import RecipesCard from "./recipes-card.js";
|
|
35
|
+
import SendingAddressesCard from "./sending-addresses-card.js";
|
|
36
|
+
/**
|
|
37
|
+
* Whether the signed-in member may change an org-wide CRM setting, and
|
|
38
|
+
* whether that is known yet.
|
|
39
|
+
*
|
|
40
|
+
* The org document's client branch admits an OWNER or ADMIN and nobody
|
|
41
|
+
* else — `canManageOrg()` in the rules — so the question is the caller's
|
|
42
|
+
* org role, read off their own membership document, which the rules let a
|
|
43
|
+
* member read for themselves. A scoped collaborator, an editor, a viewer:
|
|
44
|
+
* each sees the switch and cannot move it, with the reason beside it,
|
|
45
|
+
* rather than a switch that moves and snaps back with a bare
|
|
46
|
+
* `permission-denied`. `ready` separates "no" from "not yet", so the
|
|
47
|
+
* control disables with a reason instead of hiding until the read lands.
|
|
48
|
+
*/ export function useCanManageCrmSettings(orgId) {
|
|
49
|
+
var _ref, _ref1;
|
|
50
|
+
const firestore = useFirestore();
|
|
51
|
+
const { data: user } = useUser();
|
|
52
|
+
const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : '';
|
|
53
|
+
const { data: member, status } = useFirestoreDoc(()=>orgId && uid ? doc(firestore, 'orgs', orgId, 'members', uid) : null, [
|
|
54
|
+
firestore,
|
|
55
|
+
orgId,
|
|
56
|
+
uid
|
|
57
|
+
]);
|
|
58
|
+
return {
|
|
59
|
+
canManage: canManageOrg((_ref1 = member == null ? void 0 : member.role) != null ? _ref1 : null),
|
|
60
|
+
ready: Boolean(orgId && uid) && status !== 'loading'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* "Create companies from work email domains" — the org's one switch over
|
|
65
|
+
* what a capture does with a company nobody has filed yet (AGL-2613).
|
|
66
|
+
*
|
|
67
|
+
* ## What the switch decides, and what it does not
|
|
68
|
+
*
|
|
69
|
+
* A contact captured from `jane@acme.com` is linked to the company at
|
|
70
|
+
* `acme.com` whether this is on or off, provided exactly one such company
|
|
71
|
+
* is visible to the capturing site. The switch decides the case where NO
|
|
72
|
+
* company carries the domain: on, the capture creates one named after the
|
|
73
|
+
* domain and links the contact; off — the default — it creates nothing and
|
|
74
|
+
* the contact waits for a person to file them. Public mailbox domains never
|
|
75
|
+
* create a company either way; a workspace's consumer list is not a list
|
|
76
|
+
* of accounts.
|
|
77
|
+
*
|
|
78
|
+
* ## Written where it is read
|
|
79
|
+
*
|
|
80
|
+
* One dotted-path `update()` onto `orgs/{orgId}`, so the org's other keys
|
|
81
|
+
* are untouched and the map under `crm` can grow a key per setting. The
|
|
82
|
+
* shell's org listener delivers the new value back, which is what the
|
|
83
|
+
* switch reflects; a local copy holds the click only until then.
|
|
84
|
+
*/ export function AutoCreateCompaniesCard(props) {
|
|
85
|
+
const { hostId, org } = props;
|
|
86
|
+
const firestore = useFirestore();
|
|
87
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
88
|
+
const { orgId, ready: scopeReady } = useCrmScope({
|
|
89
|
+
hostId,
|
|
90
|
+
org
|
|
91
|
+
});
|
|
92
|
+
const { canManage, ready: roleReady } = useCanManageCrmSettings(orgId);
|
|
93
|
+
const stored = orgAutoCreatesCompanies(org);
|
|
94
|
+
const [checked, setChecked] = useState(stored);
|
|
95
|
+
const [busy, setBusy] = useState(false);
|
|
96
|
+
// The stored value wins whenever it changes: the click is optimistic, and
|
|
97
|
+
// the org document is what the capture door will actually read.
|
|
98
|
+
useEffect(()=>setChecked(stored), [
|
|
99
|
+
stored
|
|
100
|
+
]);
|
|
101
|
+
const handleChange = async (next)=>{
|
|
102
|
+
// The switch is disabled for a member who may not move it; the guard
|
|
103
|
+
// stands anyway, because a disabled control still delivers a change
|
|
104
|
+
// event in some environments and the rules would refuse the write.
|
|
105
|
+
if (!orgId || !canManage) return;
|
|
106
|
+
setChecked(next);
|
|
107
|
+
setBusy(true);
|
|
108
|
+
try {
|
|
109
|
+
await updateDoc(doc(firestore, 'orgs', orgId), {
|
|
110
|
+
[CRM_AUTO_CREATE_COMPANIES_PATH]: next
|
|
111
|
+
});
|
|
112
|
+
enqueueSnackbar(next ? 'Companies will be created from work email domains' : 'Companies will no longer be created from email domains', {
|
|
113
|
+
variant: 'success',
|
|
114
|
+
persist: false
|
|
115
|
+
});
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error(error);
|
|
118
|
+
setChecked(stored);
|
|
119
|
+
enqueueSnackbar('The setting could not be saved', {
|
|
120
|
+
variant: 'error',
|
|
121
|
+
allowDuplicate: true
|
|
122
|
+
});
|
|
123
|
+
} finally{
|
|
124
|
+
setBusy(false);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const ready = scopeReady && roleReady;
|
|
128
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
129
|
+
header: 'Companies',
|
|
130
|
+
help: pluginDocsHelp('crmSettings', {
|
|
131
|
+
anchor: '#companies'
|
|
132
|
+
}),
|
|
133
|
+
contentGutterX: true,
|
|
134
|
+
contentGutterY: true,
|
|
135
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
136
|
+
spacing: 1,
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
139
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
140
|
+
size: "small",
|
|
141
|
+
checked: checked,
|
|
142
|
+
disabled: !ready || !canManage || busy,
|
|
143
|
+
onChange: (event)=>void handleChange(event.target.checked)
|
|
144
|
+
}),
|
|
145
|
+
label: "Create companies from work email domains"
|
|
146
|
+
}),
|
|
147
|
+
/*#__PURE__*/ _jsx(FormHelperText, {
|
|
148
|
+
children: 'A contact captured with a work email address is linked to the ' + 'company whose domain matches it. When this is on and no such ' + 'company exists yet, one is created from the domain — acme.com ' + 'becomes Acme — and the contact is linked to it. Public mailbox ' + 'domains such as gmail.com never create a company.'
|
|
149
|
+
}),
|
|
150
|
+
ready && !canManage ? /*#__PURE__*/ _jsx(Typography, {
|
|
151
|
+
variant: "caption",
|
|
152
|
+
color: "text.secondary",
|
|
153
|
+
children: 'Only a workspace owner or admin can change this.'
|
|
154
|
+
}) : null
|
|
155
|
+
]
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
AutoCreateCompaniesCard.displayName = 'AutoCreateCompaniesCard';
|
|
160
|
+
/** The caption every card shows a member who may read but not change it. */ function ManagersOnlyNote(props) {
|
|
161
|
+
return props.ready && !props.canManage ? /*#__PURE__*/ _jsx(Typography, {
|
|
162
|
+
variant: "caption",
|
|
163
|
+
color: "text.secondary",
|
|
164
|
+
children: 'Only a workspace owner or admin can change this.'
|
|
165
|
+
}) : null;
|
|
166
|
+
}
|
|
167
|
+
ManagersOnlyNote.displayName = 'ManagersOnlyNote';
|
|
168
|
+
/** The `value` of the default-owner picker's "nobody" entry. */ const NO_DEFAULT_OWNER = '';
|
|
169
|
+
/**
|
|
170
|
+
* "Default owner" — who gets the records captured on a site when no
|
|
171
|
+
* assignment rule claims them (AGL-2618).
|
|
172
|
+
*
|
|
173
|
+
* Per site, on the org document: the reader is the org-level assignment
|
|
174
|
+
* pass, which reads one document for every site's default, and the writer
|
|
175
|
+
* is the same owner-or-admin the rest of the `crm` map admits. Under a
|
|
176
|
+
* site the card is that site's one picker; at the ORGANIZATION level
|
|
177
|
+
* (AGL-2630) it is one picker per site in the org, because the map is per
|
|
178
|
+
* site and this is the one place all of it is on screen at once. The
|
|
179
|
+
* field is addressed by `FieldPath` segments rather than a dotted string
|
|
180
|
+
* because a host id is a document id and may contain a dot — joined with
|
|
181
|
+
* dots, the write would land beside the setting rather than in it.
|
|
182
|
+
* Clearing a picker deletes its field, so an org that once set a default
|
|
183
|
+
* and unset it reads exactly like one that never did.
|
|
184
|
+
*/ export function DefaultOwnerCard(props) {
|
|
185
|
+
const { hostId, org } = props;
|
|
186
|
+
const { orgId, ready: scopeReady } = useCrmScope({
|
|
187
|
+
hostId,
|
|
188
|
+
org
|
|
189
|
+
});
|
|
190
|
+
const { canManage, ready: roleReady } = useCanManageCrmSettings(orgId);
|
|
191
|
+
const roster = useOrgMemberDirectory(orgId);
|
|
192
|
+
const mount = useCrmOrgMount();
|
|
193
|
+
const sites = useMemo(()=>{
|
|
194
|
+
var _ref;
|
|
195
|
+
return hostId ? [
|
|
196
|
+
{
|
|
197
|
+
id: hostId,
|
|
198
|
+
name: null
|
|
199
|
+
}
|
|
200
|
+
] : ((_ref = mount == null ? void 0 : mount.hosts) != null ? _ref : []).map((host)=>({
|
|
201
|
+
id: host.id,
|
|
202
|
+
name: host.name
|
|
203
|
+
}));
|
|
204
|
+
}, [
|
|
205
|
+
hostId,
|
|
206
|
+
mount == null ? void 0 : mount.hosts
|
|
207
|
+
]);
|
|
208
|
+
const ready = scopeReady && roleReady && (Boolean(hostId) || Boolean(mount == null ? void 0 : mount.hostsReady));
|
|
209
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
210
|
+
header: 'Default owner',
|
|
211
|
+
help: pluginDocsHelp('crmSettings', {
|
|
212
|
+
anchor: '#default-owner'
|
|
213
|
+
}),
|
|
214
|
+
contentGutterX: true,
|
|
215
|
+
contentGutterY: true,
|
|
216
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
217
|
+
spacing: 1,
|
|
218
|
+
children: [
|
|
219
|
+
sites.map((site)=>/*#__PURE__*/ _jsx(DefaultOwnerPicker, {
|
|
220
|
+
orgId: orgId,
|
|
221
|
+
siteId: site.id,
|
|
222
|
+
siteName: site.name,
|
|
223
|
+
org: org,
|
|
224
|
+
roster: roster,
|
|
225
|
+
canManage: canManage,
|
|
226
|
+
ready: ready
|
|
227
|
+
}, site.id)),
|
|
228
|
+
!hostId && ready && sites.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
|
|
229
|
+
variant: "body2",
|
|
230
|
+
color: "text.secondary",
|
|
231
|
+
children: 'This organization has no sites yet, so there is nobody to route to.'
|
|
232
|
+
}) : null,
|
|
233
|
+
/*#__PURE__*/ _jsx(FormHelperText, {
|
|
234
|
+
children: 'Every contact captured on a site — a form, a sign-up, a booking, ' + 'an order — that no assignment rule claims is handed to that ' + "site's default owner, and they are notified. A contact added by " + 'hand or imported with an owner keeps the owner you chose.'
|
|
235
|
+
}),
|
|
236
|
+
roster.error ? /*#__PURE__*/ _jsx(Typography, {
|
|
237
|
+
variant: "caption",
|
|
238
|
+
color: "error",
|
|
239
|
+
children: roster.error
|
|
240
|
+
}) : null,
|
|
241
|
+
/*#__PURE__*/ _jsx(ManagersOnlyNote, {
|
|
242
|
+
ready: ready,
|
|
243
|
+
canManage: canManage
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
DefaultOwnerCard.displayName = 'DefaultOwnerCard';
|
|
250
|
+
/** One site's slot in the org-wide default-owner map, as a picker. */ function DefaultOwnerPicker(props) {
|
|
251
|
+
var _readCrmAssignmentSettings_hostDefaultOwners_siteId;
|
|
252
|
+
const { orgId, siteId, siteName, org, roster, canManage, ready } = props;
|
|
253
|
+
const firestore = useFirestore();
|
|
254
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
255
|
+
const siteLabel = siteName != null ? siteName : 'this site';
|
|
256
|
+
const stored = (_readCrmAssignmentSettings_hostDefaultOwners_siteId = readCrmAssignmentSettings(org).hostDefaultOwners[siteId]) != null ? _readCrmAssignmentSettings_hostDefaultOwners_siteId : NO_DEFAULT_OWNER;
|
|
257
|
+
const [value, setValue] = useState(stored);
|
|
258
|
+
const [busy, setBusy] = useState(false);
|
|
259
|
+
useEffect(()=>setValue(stored), [
|
|
260
|
+
stored
|
|
261
|
+
]);
|
|
262
|
+
const handleChange = async (next)=>{
|
|
263
|
+
if (!orgId || !canManage) return;
|
|
264
|
+
setValue(next);
|
|
265
|
+
setBusy(true);
|
|
266
|
+
try {
|
|
267
|
+
await updateDoc(doc(firestore, 'orgs', orgId), new FieldPath(...crmHostDefaultOwnerSegments(siteId)), next || deleteField());
|
|
268
|
+
enqueueSnackbar(next ? `New contacts on ${siteLabel} go to ${roster.nameOf(next)} unless a rule says otherwise` : `New contacts on ${siteLabel} stay unassigned unless a rule says otherwise`, {
|
|
269
|
+
variant: 'success',
|
|
270
|
+
persist: false
|
|
271
|
+
});
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error(error);
|
|
274
|
+
setValue(stored);
|
|
275
|
+
enqueueSnackbar('The default owner could not be saved', {
|
|
276
|
+
variant: 'error',
|
|
277
|
+
allowDuplicate: true
|
|
278
|
+
});
|
|
279
|
+
} finally{
|
|
280
|
+
setBusy(false);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
// A stored owner the roster no longer lists is still shown, by uid, so
|
|
284
|
+
// the picker never silently reads "Nobody" for a setting that is there.
|
|
285
|
+
const options = useMemo(()=>stored && !roster.members.some((member)=>member.uid === stored) ? [
|
|
286
|
+
...roster.members,
|
|
287
|
+
{
|
|
288
|
+
uid: stored,
|
|
289
|
+
label: `${stored} (former member)`
|
|
290
|
+
}
|
|
291
|
+
] : roster.members, [
|
|
292
|
+
roster.members,
|
|
293
|
+
stored
|
|
294
|
+
]);
|
|
295
|
+
return /*#__PURE__*/ _jsxs(TextField, {
|
|
296
|
+
select: true,
|
|
297
|
+
size: "small",
|
|
298
|
+
label: siteName ? `Default owner · ${siteName}` : 'Default owner for this site',
|
|
299
|
+
value: value,
|
|
300
|
+
onChange: (event)=>void handleChange(event.target.value),
|
|
301
|
+
disabled: !ready || !canManage || busy || roster.loading,
|
|
302
|
+
// "Nobody" is the empty value, which a select would otherwise
|
|
303
|
+
// render as a blank rather than as the choice it is. The label is
|
|
304
|
+
// shrunk with it: a field that always draws a value has no empty
|
|
305
|
+
// state for the label to sit in, and left to itself it decides from
|
|
306
|
+
// the value alone and paints the label over the choice.
|
|
307
|
+
slotProps: {
|
|
308
|
+
select: {
|
|
309
|
+
displayEmpty: true
|
|
310
|
+
},
|
|
311
|
+
inputLabel: {
|
|
312
|
+
shrink: true
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
sx: {
|
|
316
|
+
maxWidth: 360
|
|
317
|
+
},
|
|
318
|
+
children: [
|
|
319
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
320
|
+
value: NO_DEFAULT_OWNER,
|
|
321
|
+
children: 'Nobody — leave unassigned'
|
|
322
|
+
}),
|
|
323
|
+
options.map((member)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
324
|
+
value: member.uid,
|
|
325
|
+
children: member.label
|
|
326
|
+
}, member.uid))
|
|
327
|
+
]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
DefaultOwnerPicker.displayName = 'DefaultOwnerPicker';
|
|
331
|
+
/**
|
|
332
|
+
* "Assignment rules" — the ordered list the capture pass tries first
|
|
333
|
+
* (AGL-2618), with Add rule in a drawer, reorder and delete.
|
|
334
|
+
*
|
|
335
|
+
* ## The whole list is the unit of write
|
|
336
|
+
*
|
|
337
|
+
* The rules are an array on the org document and every edit — a new rule,
|
|
338
|
+
* a move, a delete — writes the whole array by its dotted path. A per-rule
|
|
339
|
+
* write has no address (an array element is not a field), and the list is
|
|
340
|
+
* bounded at fifty, so the write is small. The array the card writes is
|
|
341
|
+
* the array it read off the org prop plus the one edit, so two admins
|
|
342
|
+
* editing at once last-write-wins at the granularity of one edit, which
|
|
343
|
+
* is what a list this short and this rarely edited needs.
|
|
344
|
+
*
|
|
345
|
+
* ## First match wins, so order is the meaning
|
|
346
|
+
*
|
|
347
|
+
* A rule's position is a fact about it — "bookings go to Kim, and
|
|
348
|
+
* everything else to Sam" is two rules in that order and nonsense in the
|
|
349
|
+
* other — which is why the reorder controls sit in the first column and
|
|
350
|
+
* the row reads "1st, 2nd…" rather than a name. Up and down rather than
|
|
351
|
+
* drag, the way the custom-field list does it: a drag handle needs a
|
|
352
|
+
* pointer, and the reorder is rare.
|
|
353
|
+
*/ export function AssignmentRulesCard(props) {
|
|
354
|
+
const { hostId, org } = props;
|
|
355
|
+
const firestore = useFirestore();
|
|
356
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
357
|
+
const { orgId, ready: scopeReady } = useCrmScope({
|
|
358
|
+
hostId,
|
|
359
|
+
org
|
|
360
|
+
});
|
|
361
|
+
const { canManage, ready: roleReady } = useCanManageCrmSettings(orgId);
|
|
362
|
+
const roster = useOrgMemberDirectory(orgId);
|
|
363
|
+
const settings = useMemo(()=>readCrmAssignmentSettings(org), [
|
|
364
|
+
org
|
|
365
|
+
]);
|
|
366
|
+
const { rules } = settings;
|
|
367
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
368
|
+
const [busy, setBusy] = useState(false);
|
|
369
|
+
const writeRules = useCallback(async (next, said)=>{
|
|
370
|
+
if (!orgId || !canManage) return;
|
|
371
|
+
setBusy(true);
|
|
372
|
+
try {
|
|
373
|
+
await updateDoc(doc(firestore, 'orgs', orgId), {
|
|
374
|
+
[CRM_ASSIGNMENT_RULES_PATH]: next
|
|
375
|
+
});
|
|
376
|
+
enqueueSnackbar(said, {
|
|
377
|
+
variant: 'success',
|
|
378
|
+
persist: false
|
|
379
|
+
});
|
|
380
|
+
} catch (error) {
|
|
381
|
+
console.error(error);
|
|
382
|
+
enqueueSnackbar('The rules could not be saved', {
|
|
383
|
+
variant: 'error',
|
|
384
|
+
allowDuplicate: true
|
|
385
|
+
});
|
|
386
|
+
throw error;
|
|
387
|
+
} finally{
|
|
388
|
+
setBusy(false);
|
|
389
|
+
}
|
|
390
|
+
}, [
|
|
391
|
+
firestore,
|
|
392
|
+
orgId,
|
|
393
|
+
canManage,
|
|
394
|
+
enqueueSnackbar
|
|
395
|
+
]);
|
|
396
|
+
const move = (index, by)=>{
|
|
397
|
+
const target = index + by;
|
|
398
|
+
if (target < 0 || target >= rules.length) return;
|
|
399
|
+
const next = [
|
|
400
|
+
...rules
|
|
401
|
+
];
|
|
402
|
+
[next[index], next[target]] = [
|
|
403
|
+
next[target],
|
|
404
|
+
next[index]
|
|
405
|
+
];
|
|
406
|
+
void writeRules(next, 'Rule moved').catch(()=>undefined);
|
|
407
|
+
};
|
|
408
|
+
const remove = (rule)=>{
|
|
409
|
+
void writeRules(rules.filter((entry)=>entry.id !== rule.id), 'Rule deleted').catch(()=>undefined);
|
|
410
|
+
};
|
|
411
|
+
const handleAdd = async (rule)=>{
|
|
412
|
+
await writeRules([
|
|
413
|
+
...rules,
|
|
414
|
+
rule
|
|
415
|
+
], 'Rule added');
|
|
416
|
+
setDrawerOpen(false);
|
|
417
|
+
};
|
|
418
|
+
const ready = scopeReady && roleReady;
|
|
419
|
+
const atCap = rules.length >= CRM_ASSIGNMENT_RULES_MAX;
|
|
420
|
+
const canEdit = ready && canManage && !busy;
|
|
421
|
+
const ordinal = (index)=>{
|
|
422
|
+
var _;
|
|
423
|
+
const n = index + 1;
|
|
424
|
+
const suffix = n % 100 >= 11 && n % 100 <= 13 ? 'th' : (_ = [
|
|
425
|
+
'th',
|
|
426
|
+
'st',
|
|
427
|
+
'nd',
|
|
428
|
+
'rd'
|
|
429
|
+
][n % 10]) != null ? _ : 'th';
|
|
430
|
+
return `${n}${suffix}`;
|
|
431
|
+
};
|
|
432
|
+
return /*#__PURE__*/ _jsxs(CardDisplay, {
|
|
433
|
+
header: 'Assignment rules',
|
|
434
|
+
help: pluginDocsHelp('crmSettings', {
|
|
435
|
+
anchor: '#assignment-rules'
|
|
436
|
+
}),
|
|
437
|
+
contentGutterX: true,
|
|
438
|
+
contentGutterY: true,
|
|
439
|
+
contentBordered: "all",
|
|
440
|
+
HeaderProps: {
|
|
441
|
+
action: /*#__PURE__*/ _jsx(Button, {
|
|
442
|
+
variant: "contained",
|
|
443
|
+
disabled: !canEdit || atCap,
|
|
444
|
+
onClick: ()=>setDrawerOpen(true),
|
|
445
|
+
children: 'Add rule'
|
|
446
|
+
})
|
|
447
|
+
},
|
|
448
|
+
children: [
|
|
449
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
450
|
+
spacing: 2,
|
|
451
|
+
children: [
|
|
452
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
453
|
+
variant: "body2",
|
|
454
|
+
color: "text.secondary",
|
|
455
|
+
children: 'Tried in order for every new contact captured on any site in the ' + 'workspace; the first rule whose every condition holds assigns the ' + 'owner. A contact no rule claims goes to the capturing site’s ' + 'default owner, or stays unassigned.'
|
|
456
|
+
}),
|
|
457
|
+
rules.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
|
|
458
|
+
variant: "body2",
|
|
459
|
+
color: "text.secondary",
|
|
460
|
+
children: 'No rules yet. Add one to route new contacts by where they came from.'
|
|
461
|
+
}) : /*#__PURE__*/ _jsxs(ScrollTable, {
|
|
462
|
+
size: "small",
|
|
463
|
+
children: [
|
|
464
|
+
/*#__PURE__*/ _jsx(TableHead, {
|
|
465
|
+
children: /*#__PURE__*/ _jsxs(TableRow, {
|
|
466
|
+
children: [
|
|
467
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
468
|
+
sx: {
|
|
469
|
+
width: 120
|
|
470
|
+
},
|
|
471
|
+
children: 'Order'
|
|
472
|
+
}),
|
|
473
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
474
|
+
children: 'When'
|
|
475
|
+
}),
|
|
476
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
477
|
+
children: 'Assign to'
|
|
478
|
+
}),
|
|
479
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
480
|
+
align: "right"
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
})
|
|
484
|
+
}),
|
|
485
|
+
/*#__PURE__*/ _jsx(TableBody, {
|
|
486
|
+
children: rules.map((rule, index)=>{
|
|
487
|
+
const described = describeAssignmentRule(rule, roster.nameOf);
|
|
488
|
+
return /*#__PURE__*/ _jsxs(TableRow, {
|
|
489
|
+
hover: true,
|
|
490
|
+
children: [
|
|
491
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
492
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
493
|
+
direction: "row",
|
|
494
|
+
spacing: 0,
|
|
495
|
+
sx: {
|
|
496
|
+
alignItems: 'center'
|
|
497
|
+
},
|
|
498
|
+
children: [
|
|
499
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
500
|
+
variant: "body2",
|
|
501
|
+
sx: {
|
|
502
|
+
minWidth: 32
|
|
503
|
+
},
|
|
504
|
+
children: ordinal(index)
|
|
505
|
+
}),
|
|
506
|
+
/*#__PURE__*/ _jsxs(IconButton, {
|
|
507
|
+
size: "small",
|
|
508
|
+
disabled: !canEdit || index === 0,
|
|
509
|
+
onClick: ()=>move(index, -1),
|
|
510
|
+
children: [
|
|
511
|
+
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
512
|
+
path: mdiArrowUp.path,
|
|
513
|
+
size: 0.7
|
|
514
|
+
}),
|
|
515
|
+
/*#__PURE__*/ _jsx(SrOnly, {
|
|
516
|
+
children: `Move rule ${index + 1} up`
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
}),
|
|
520
|
+
/*#__PURE__*/ _jsxs(IconButton, {
|
|
521
|
+
size: "small",
|
|
522
|
+
disabled: !canEdit || index === rules.length - 1,
|
|
523
|
+
onClick: ()=>move(index, 1),
|
|
524
|
+
children: [
|
|
525
|
+
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
526
|
+
path: mdiArrowDown.path,
|
|
527
|
+
size: 0.7
|
|
528
|
+
}),
|
|
529
|
+
/*#__PURE__*/ _jsx(SrOnly, {
|
|
530
|
+
children: `Move rule ${index + 1} down`
|
|
531
|
+
})
|
|
532
|
+
]
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
538
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
539
|
+
variant: "body2",
|
|
540
|
+
children: described.when
|
|
541
|
+
})
|
|
542
|
+
}),
|
|
543
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
544
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
545
|
+
variant: "body2",
|
|
546
|
+
children: described.assign
|
|
547
|
+
})
|
|
548
|
+
}),
|
|
549
|
+
/*#__PURE__*/ _jsx(TableCell, {
|
|
550
|
+
align: "right",
|
|
551
|
+
sx: {
|
|
552
|
+
width: 56
|
|
553
|
+
},
|
|
554
|
+
children: /*#__PURE__*/ _jsx(RowActionsMenu, {
|
|
555
|
+
label: `Rule ${index + 1}`,
|
|
556
|
+
items: [
|
|
557
|
+
{
|
|
558
|
+
key: 'delete',
|
|
559
|
+
label: 'Delete rule',
|
|
560
|
+
icon: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
561
|
+
path: mdiDeleteOutline.path,
|
|
562
|
+
size: 0.8
|
|
563
|
+
}),
|
|
564
|
+
destructive: true,
|
|
565
|
+
disabled: !canEdit,
|
|
566
|
+
onClick: ()=>remove(rule)
|
|
567
|
+
}
|
|
568
|
+
]
|
|
569
|
+
})
|
|
570
|
+
})
|
|
571
|
+
]
|
|
572
|
+
}, rule.id);
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
}),
|
|
577
|
+
atCap ? /*#__PURE__*/ _jsx(Typography, {
|
|
578
|
+
variant: "caption",
|
|
579
|
+
color: "text.secondary",
|
|
580
|
+
children: `A workspace keeps at most ${CRM_ASSIGNMENT_RULES_MAX} rules. Delete one to add another.`
|
|
581
|
+
}) : null,
|
|
582
|
+
/*#__PURE__*/ _jsx(ManagersOnlyNote, {
|
|
583
|
+
ready: ready,
|
|
584
|
+
canManage: canManage
|
|
585
|
+
})
|
|
586
|
+
]
|
|
587
|
+
}),
|
|
588
|
+
/*#__PURE__*/ _jsx(AssignmentRuleDrawer, {
|
|
589
|
+
open: drawerOpen,
|
|
590
|
+
onClose: ()=>setDrawerOpen(false),
|
|
591
|
+
members: roster.members,
|
|
592
|
+
membersLoading: roster.loading,
|
|
593
|
+
poolSize: settings.pool.memberUids.length,
|
|
594
|
+
existingIds: rules.map((rule)=>rule.id),
|
|
595
|
+
onSubmit: handleAdd
|
|
596
|
+
})
|
|
597
|
+
]
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
AssignmentRulesCard.displayName = 'AssignmentRulesCard';
|
|
601
|
+
/**
|
|
602
|
+
* "Round robin" — the members handed records in turn (AGL-2618).
|
|
603
|
+
*
|
|
604
|
+
* The pool is the roster with a checkbox per member, and its ORDER is the
|
|
605
|
+
* order members were checked: a member checked later joins the end of the
|
|
606
|
+
* rotation, and unchecking removes them without disturbing the others. The
|
|
607
|
+
* pointer — who got the last record — is the server's to move and is only
|
|
608
|
+
* read here, as "next up", so an admin can see where the rotation stands
|
|
609
|
+
* without being able to put a thumb on it.
|
|
610
|
+
*/ export function RoundRobinCard(props) {
|
|
611
|
+
const { hostId, org } = props;
|
|
612
|
+
const firestore = useFirestore();
|
|
613
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
614
|
+
const { orgId, ready: scopeReady } = useCrmScope({
|
|
615
|
+
hostId,
|
|
616
|
+
org
|
|
617
|
+
});
|
|
618
|
+
const { canManage, ready: roleReady } = useCanManageCrmSettings(orgId);
|
|
619
|
+
const roster = useOrgMemberDirectory(orgId);
|
|
620
|
+
const { pool } = useMemo(()=>readCrmAssignmentSettings(org), [
|
|
621
|
+
org
|
|
622
|
+
]);
|
|
623
|
+
const [busy, setBusy] = useState(false);
|
|
624
|
+
const toggle = async (uid, inPool)=>{
|
|
625
|
+
if (!orgId || !canManage) return;
|
|
626
|
+
const next = inPool ? [
|
|
627
|
+
...pool.memberUids.filter((entry)=>entry !== uid),
|
|
628
|
+
uid
|
|
629
|
+
] : pool.memberUids.filter((entry)=>entry !== uid);
|
|
630
|
+
if (next.length > CRM_ROUND_ROBIN_POOL_MAX) return;
|
|
631
|
+
setBusy(true);
|
|
632
|
+
try {
|
|
633
|
+
await updateDoc(doc(firestore, 'orgs', orgId), {
|
|
634
|
+
[CRM_ROUND_ROBIN_POOL_PATH]: next
|
|
635
|
+
});
|
|
636
|
+
enqueueSnackbar(inPool ? `${roster.nameOf(uid)} joined the rotation` : `${roster.nameOf(uid)} left the rotation`, {
|
|
637
|
+
variant: 'success',
|
|
638
|
+
persist: false
|
|
639
|
+
});
|
|
640
|
+
} catch (error) {
|
|
641
|
+
console.error(error);
|
|
642
|
+
enqueueSnackbar('The pool could not be saved', {
|
|
643
|
+
variant: 'error',
|
|
644
|
+
allowDuplicate: true
|
|
645
|
+
});
|
|
646
|
+
} finally{
|
|
647
|
+
setBusy(false);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const ready = scopeReady && roleReady;
|
|
651
|
+
const canEdit = ready && canManage && !busy && !roster.loading;
|
|
652
|
+
const order = roundRobinOrder(pool.memberUids, pool.lastAssignedUid);
|
|
653
|
+
const nextUp = order[0];
|
|
654
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
655
|
+
header: 'Round robin',
|
|
656
|
+
help: pluginDocsHelp('crmSettings', {
|
|
657
|
+
anchor: '#round-robin'
|
|
658
|
+
}),
|
|
659
|
+
contentGutterX: true,
|
|
660
|
+
contentGutterY: true,
|
|
661
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
662
|
+
spacing: 1,
|
|
663
|
+
children: [
|
|
664
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
665
|
+
variant: "body2",
|
|
666
|
+
color: "text.secondary",
|
|
667
|
+
children: 'The members a round-robin rule, or an automation set to round ' + 'robin, hands records to in turn. Each new record goes to the ' + 'member after the last one who got a record, wrapping round.'
|
|
668
|
+
}),
|
|
669
|
+
roster.loading ? /*#__PURE__*/ _jsx(Typography, {
|
|
670
|
+
variant: "body2",
|
|
671
|
+
color: "text.secondary",
|
|
672
|
+
children: 'Loading the team…'
|
|
673
|
+
}) : roster.error ? /*#__PURE__*/ _jsx(Typography, {
|
|
674
|
+
variant: "body2",
|
|
675
|
+
color: "error",
|
|
676
|
+
children: roster.error
|
|
677
|
+
}) : /*#__PURE__*/ _jsx(FormGroup, {
|
|
678
|
+
children: roster.members.map((member)=>/*#__PURE__*/ _jsx(FormControlLabel, {
|
|
679
|
+
control: /*#__PURE__*/ _jsx(Checkbox, {
|
|
680
|
+
size: "small",
|
|
681
|
+
checked: pool.memberUids.includes(member.uid),
|
|
682
|
+
disabled: !canEdit,
|
|
683
|
+
onChange: (event)=>void toggle(member.uid, event.target.checked)
|
|
684
|
+
}),
|
|
685
|
+
label: member.label
|
|
686
|
+
}, member.uid))
|
|
687
|
+
}),
|
|
688
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
689
|
+
variant: "caption",
|
|
690
|
+
color: "text.secondary",
|
|
691
|
+
children: pool.memberUids.length === 0 ? 'Nobody is in the rotation; a round-robin rule is skipped until somebody is.' : `Rotation: ${pool.memberUids.map(roster.nameOf).join(' → ')}. Next up: ${roster.nameOf(nextUp)}.`
|
|
692
|
+
}),
|
|
693
|
+
/*#__PURE__*/ _jsx(ManagersOnlyNote, {
|
|
694
|
+
ready: ready,
|
|
695
|
+
canManage: canManage
|
|
696
|
+
})
|
|
697
|
+
]
|
|
698
|
+
})
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
RoundRobinCard.displayName = 'RoundRobinCard';
|
|
702
|
+
/**
|
|
703
|
+
* `/crm/settings` — what the CRM does on its own, for every site in the
|
|
704
|
+
* workspace (AGL-2613).
|
|
705
|
+
*
|
|
706
|
+
* A stack of cards, one per concern, so a later setting arrives as a card
|
|
707
|
+
* beside this one rather than a field inside it. Every card writes the org
|
|
708
|
+
* document, because a CRM setting is a fact about how the business files
|
|
709
|
+
* people and not about one site; the section is reached from a site's hub
|
|
710
|
+
* or from the organization's (AGL-2630), and writes the same document from
|
|
711
|
+
* either. The one per-site setting — the default owner — is the site's
|
|
712
|
+
* slot in an org-wide map: under a site the card names the site it is for,
|
|
713
|
+
* and at the organization level it lists every site's slot.
|
|
714
|
+
*
|
|
715
|
+
* The Recipes card (AGL-2639) is the one card that mounts at the
|
|
716
|
+
* ORGANIZATION level only. It installs an automation onto a site of the
|
|
717
|
+
* reader's choosing, which is the org's need; under a site the Actions
|
|
718
|
+
* page's own Recipes menu is the door, and a second one here would write
|
|
719
|
+
* the same action by a different route. Last, because the welcome recipe
|
|
720
|
+
* leans on the round-robin pool set up in the card above it.
|
|
721
|
+
*
|
|
722
|
+
* The Email templates card (AGL-2658) is the one card every CRM editor may
|
|
723
|
+
* write to — a template is working material, not policy — and mounts at
|
|
724
|
+
* both levels, listing the site's letters under a site and the whole
|
|
725
|
+
* workspace's from the organization's hub.
|
|
726
|
+
*
|
|
727
|
+
* Your sending addresses (AGL-2975) sits directly under Email capture,
|
|
728
|
+
* because it is where a member who copies that address from an alias looks
|
|
729
|
+
* next: it is the reader's OWN list, at both levels, and writes through the
|
|
730
|
+
* core route rather than the org document.
|
|
731
|
+
*/ export function CrmSettingsSection(props) {
|
|
732
|
+
const { hostId, org } = props;
|
|
733
|
+
const mount = useCrmOrgMount();
|
|
734
|
+
// The Email capture card (AGL-2657) rotates on the same owner-or-admin
|
|
735
|
+
// bar every other card writes on; the scope and the role are resolved
|
|
736
|
+
// here once and handed down, since the card itself writes no document.
|
|
737
|
+
const { orgId, ready: scopeReady } = useCrmScope({
|
|
738
|
+
hostId,
|
|
739
|
+
org
|
|
740
|
+
});
|
|
741
|
+
const { canManage, ready: roleReady } = useCanManageCrmSettings(orgId);
|
|
742
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
743
|
+
spacing: 3,
|
|
744
|
+
children: [
|
|
745
|
+
/*#__PURE__*/ _jsx(AutoCreateCompaniesCard, {
|
|
746
|
+
hostId: hostId,
|
|
747
|
+
org: org
|
|
748
|
+
}),
|
|
749
|
+
/*#__PURE__*/ _jsx(DefaultOwnerCard, {
|
|
750
|
+
hostId: hostId,
|
|
751
|
+
org: org
|
|
752
|
+
}),
|
|
753
|
+
/*#__PURE__*/ _jsx(AssignmentRulesCard, {
|
|
754
|
+
hostId: hostId,
|
|
755
|
+
org: org
|
|
756
|
+
}),
|
|
757
|
+
/*#__PURE__*/ _jsx(RoundRobinCard, {
|
|
758
|
+
hostId: hostId,
|
|
759
|
+
org: org
|
|
760
|
+
}),
|
|
761
|
+
/*#__PURE__*/ _jsx(EmailTemplatesCard, {
|
|
762
|
+
hostId: hostId,
|
|
763
|
+
org: org
|
|
764
|
+
}),
|
|
765
|
+
/*#__PURE__*/ _jsx(EmailCaptureCard, {
|
|
766
|
+
hostId: hostId,
|
|
767
|
+
canManage: canManage,
|
|
768
|
+
ready: scopeReady && roleReady
|
|
769
|
+
}),
|
|
770
|
+
/*#__PURE__*/ _jsx(SendingAddressesCard, {
|
|
771
|
+
orgId: orgId,
|
|
772
|
+
ready: scopeReady
|
|
773
|
+
}),
|
|
774
|
+
mount ? /*#__PURE__*/ _jsx(RecipesCard, {
|
|
775
|
+
org: org
|
|
776
|
+
}) : null
|
|
777
|
+
]
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
CrmSettingsSection.displayName = 'CrmSettingsSection';
|
|
781
|
+
export default CrmSettingsSection;
|
|
782
|
+
|
|
783
|
+
//# sourceMappingURL=settings-section.js.map
|