@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,851 @@
|
|
|
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_EMAIL_BODY_MAX, CRM_EMAIL_SUBJECT_MAX, normalizeContactEmail, consentGroupForHost, CRM_COLLECTIONS, createResourceUid, crmMergeUnresolvedMessage, hasCrmMergeFields, resolveCrmMergeFields } from "@aglyn/aglyn";
|
|
20
|
+
import { useConsoleWidgetSlot } from "@aglyn/aglyn/app-utils/console-widget-slot-context";
|
|
21
|
+
import { useSendingApi } from "@aglyn/tenant-feature-instance/hooks/use-sending-identity-api";
|
|
22
|
+
import { AppLink, useConfirmationContext } from "@aglyn/shared-ui-jsx";
|
|
23
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
24
|
+
import { useFirestore, useOrgDataScope, useUser } from "@aglyn/tenant-feature-instance";
|
|
25
|
+
import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, InputAdornment, Stack, TextField, Typography } from "@mui/material";
|
|
26
|
+
import { collection, doc, getDoc, setDoc } from "firebase/firestore";
|
|
27
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
28
|
+
import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
|
|
29
|
+
import { CrmRecordBookingZone } from "./crm-booking-zone.js";
|
|
30
|
+
import { insertLinkAtCaret } from "./insert-link-at-caret.js";
|
|
31
|
+
import { CAPTURE_ADDRESS_HELPER, CopyCaptureAddressButton } from "./copy-capture-address-button.js";
|
|
32
|
+
import { CrmSitePicker } from "./crm-site-picker.js";
|
|
33
|
+
import { useCrmApi } from "./use-crm-api.js";
|
|
34
|
+
import { useCrmInboundAddress } from "./use-crm-inbound-address.js";
|
|
35
|
+
import { useEmailsHubPath } from "./use-emails-hub-path.js";
|
|
36
|
+
import { useCrmEmailTemplates, useCrmEmailTemplateScope } from "../hooks/use-crm-email-templates.js";
|
|
37
|
+
import { CrmInsertMenu, CrmSaveAsTemplateDialog, CrmTemplatePicker } from "./crm-email-template-tools.js";
|
|
38
|
+
const NO_MERGE_RECORDS = {
|
|
39
|
+
contact: null,
|
|
40
|
+
deal: null,
|
|
41
|
+
lead: null,
|
|
42
|
+
site: null,
|
|
43
|
+
loaded: false
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* One email to one person, from their record (AGL-2615).
|
|
47
|
+
*
|
|
48
|
+
* ## What the reader sees, and what they cannot change
|
|
49
|
+
*
|
|
50
|
+
* To is the record's address and is read-only: the route resolves the
|
|
51
|
+
* recipient off the record again, so an editable field here would be a
|
|
52
|
+
* promise the server does not keep. From is the site's sending identity as
|
|
53
|
+
* the sending-identity route reports it — the same answer the campaign
|
|
54
|
+
* composer prints — and when that route refuses, the dialog says why and
|
|
55
|
+
* points at **Emails › Sending** rather than offering a Send button that
|
|
56
|
+
* 409s. Reply-to is the signed-in user's own address, because a reply to a
|
|
57
|
+
* relationship email belongs in the inbox of the person who wrote it, not
|
|
58
|
+
* the site's shared mailbox. Subject and Body are the whole of what a
|
|
59
|
+
* person writes; the body is plain paragraphs, and the email design system
|
|
60
|
+
* is deliberately not here — this is a letter, not a campaign.
|
|
61
|
+
*
|
|
62
|
+
* ## A refusal stays on screen
|
|
63
|
+
*
|
|
64
|
+
* The route's refusals — the daily cap, a suppressed address, a stated
|
|
65
|
+
* refusal, the ceiling — are answers the rep should read, so they render
|
|
66
|
+
* inside the dialog with the draft intact rather than as a toast over a
|
|
67
|
+
* closed one. Only a send the provider accepted closes it.
|
|
68
|
+
*
|
|
69
|
+
* Mounted on open by its button, so the identity request and the contact
|
|
70
|
+
* read happen when somebody asks and not on every record page paint.
|
|
71
|
+
*/ export function CrmSendEmailDialog(props) {
|
|
72
|
+
var _ref, _ref1, _normalizeContactEmail, _normalizeContactEmail1, _props_name;
|
|
73
|
+
const { open, onClose, hostId, org, contactId, leadId, dealId, onSent } = props;
|
|
74
|
+
const firestore = useFirestore();
|
|
75
|
+
const mount = useCrmOrgMount();
|
|
76
|
+
const { orgId } = useOrgDataScope({
|
|
77
|
+
hostId: hostId != null ? hostId : undefined,
|
|
78
|
+
orgId: (_ref = org == null ? void 0 : org.$id) != null ? _ref : mount == null ? void 0 : mount.orgId
|
|
79
|
+
});
|
|
80
|
+
const { data: user } = useUser();
|
|
81
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
82
|
+
const sendingApi = useSendingApi();
|
|
83
|
+
/*
|
|
84
|
+
* The site the message LEAVES FROM: the record's own, or at the
|
|
85
|
+
* organization level — for a record no site captured — the site the
|
|
86
|
+
* reader picked (AGL-2634). The identity, the suppression list and the
|
|
87
|
+
* person's stated refusal are each that site's, which is why the org
|
|
88
|
+
* level cannot do without one.
|
|
89
|
+
*/ const sendHostId = (_ref1 = hostId != null ? hostId : mount == null ? void 0 : mount.createHostId) != null ? _ref1 : null;
|
|
90
|
+
const crmApi = useCrmApi(sendHostId);
|
|
91
|
+
const emailsHub = useEmailsHubPath(sendHostId);
|
|
92
|
+
// The capture address (AGL-2657), for the reply this send will get: the
|
|
93
|
+
// console logs what IT sends, so the address is shown to be forwarded
|
|
94
|
+
// to or copied from a mailbox, never put on this message.
|
|
95
|
+
const capture = useCrmInboundAddress(sendHostId, {
|
|
96
|
+
enabled: open
|
|
97
|
+
});
|
|
98
|
+
// The Sending section of the Emails console — the page that fixes a
|
|
99
|
+
// missing identity. `null` on a surface that cannot name the site's hub,
|
|
100
|
+
// so the refusal prints the section's name instead of a link to nowhere.
|
|
101
|
+
const sendingPath = emailsHub ? `${emailsHub}/sending` : null;
|
|
102
|
+
const [identity, setIdentity] = useState({
|
|
103
|
+
status: 'loading'
|
|
104
|
+
});
|
|
105
|
+
const [recipient, setRecipient] = useState((_normalizeContactEmail = normalizeContactEmail(props.email)) != null ? _normalizeContactEmail : null);
|
|
106
|
+
const [subject, setSubject] = useState('');
|
|
107
|
+
const [body, setBody] = useState('');
|
|
108
|
+
const [sending, setSending] = useState(false);
|
|
109
|
+
const [error, setError] = useState(null);
|
|
110
|
+
/*
|
|
111
|
+
* TEMPLATES, SNIPPETS AND MERGE FIELDS (AGL-2658). The listener is the
|
|
112
|
+
* dialog's own scope — the mounted site's tokens, or none at the org
|
|
113
|
+
* level — and what a saved template is stamped with follows the same
|
|
114
|
+
* rule. The message field's element is held so a snippet lands at the
|
|
115
|
+
* caret rather than at the end.
|
|
116
|
+
*/ const { confirm } = useConfirmationContext();
|
|
117
|
+
const templateScope = useCrmEmailTemplateScope({
|
|
118
|
+
hostId,
|
|
119
|
+
org
|
|
120
|
+
});
|
|
121
|
+
const { templates } = useCrmEmailTemplates({
|
|
122
|
+
scope: templateScope.scope,
|
|
123
|
+
visibleTo: templateScope.visibleTo,
|
|
124
|
+
uid: user == null ? void 0 : user.uid
|
|
125
|
+
});
|
|
126
|
+
const pickable = useMemo(()=>templates.filter((row)=>row.kind === 'template'), [
|
|
127
|
+
templates
|
|
128
|
+
]);
|
|
129
|
+
const snippets = useMemo(()=>templates.filter((row)=>row.kind === 'snippet'), [
|
|
130
|
+
templates
|
|
131
|
+
]);
|
|
132
|
+
const [appliedTemplate, setAppliedTemplate] = useState(null);
|
|
133
|
+
const [saveOpen, setSaveOpen] = useState(false);
|
|
134
|
+
const [records, setRecords] = useState(NO_MERGE_RECORDS);
|
|
135
|
+
const messageRef = useRef(null);
|
|
136
|
+
const draftHasFields = hasCrmMergeFields(`${subject}\n${body}`);
|
|
137
|
+
// The groups the Insert menu offers: what the record can answer.
|
|
138
|
+
const fieldGroups = useMemo(()=>[
|
|
139
|
+
...contactId || dealId ? [
|
|
140
|
+
'Contact'
|
|
141
|
+
] : [],
|
|
142
|
+
...leadId && !contactId ? [
|
|
143
|
+
'Lead'
|
|
144
|
+
] : [],
|
|
145
|
+
...dealId ? [
|
|
146
|
+
'Deal'
|
|
147
|
+
] : [],
|
|
148
|
+
'You',
|
|
149
|
+
'Site'
|
|
150
|
+
], [
|
|
151
|
+
contactId,
|
|
152
|
+
dealId,
|
|
153
|
+
leadId
|
|
154
|
+
]);
|
|
155
|
+
/*
|
|
156
|
+
* The identity, asked for on open. The route is the send path's own
|
|
157
|
+
* resolver, so what it prints here is what the message will leave as; a
|
|
158
|
+
* dialog that derived "verified" from the domain list would be a second
|
|
159
|
+
* opinion that drifts from the send.
|
|
160
|
+
*/ useEffect(()=>{
|
|
161
|
+
if (!open) return;
|
|
162
|
+
let cancelled = false;
|
|
163
|
+
setError(null);
|
|
164
|
+
// The draft survives a change of sending site — the site is not the
|
|
165
|
+
// letter — and is cleared only when the dialog opens.
|
|
166
|
+
if (!sendHostId) {
|
|
167
|
+
setIdentity({
|
|
168
|
+
status: 'site'
|
|
169
|
+
});
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
setIdentity({
|
|
173
|
+
status: 'loading'
|
|
174
|
+
});
|
|
175
|
+
void (async ()=>{
|
|
176
|
+
var _ref, _ref1, _payload_identity;
|
|
177
|
+
var _senders_find, _senders_find1;
|
|
178
|
+
const { response, payload } = await sendingApi({
|
|
179
|
+
path: 'sending-identity',
|
|
180
|
+
method: 'GET',
|
|
181
|
+
query: {
|
|
182
|
+
hostId: sendHostId
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
if (cancelled) return;
|
|
186
|
+
if (!response.ok) {
|
|
187
|
+
var _payload_error;
|
|
188
|
+
setIdentity({
|
|
189
|
+
status: 'error',
|
|
190
|
+
message: String((_payload_error = payload['error']) != null ? _payload_error : 'The sending identity could not be read.')
|
|
191
|
+
});
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const refusal = payload['refusal'];
|
|
195
|
+
if (refusal) {
|
|
196
|
+
var _refusal_message;
|
|
197
|
+
setIdentity({
|
|
198
|
+
status: 'refused',
|
|
199
|
+
message: String((_refusal_message = refusal.message) != null ? _refusal_message : 'This site has no verified sending identity.'),
|
|
200
|
+
canManage: payload['canManage'] === true
|
|
201
|
+
});
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const senders = Array.isArray(payload['senders']) ? payload['senders'] : [];
|
|
205
|
+
const from = (_ref = (_ref1 = (_senders_find = senders.find((sender)=>sender.isDefault && sender.from)) == null ? void 0 : _senders_find.from) != null ? _ref1 : (_senders_find1 = senders.find((sender)=>sender.from)) == null ? void 0 : _senders_find1.from) != null ? _ref : null;
|
|
206
|
+
setIdentity(from ? {
|
|
207
|
+
status: 'ready',
|
|
208
|
+
from
|
|
209
|
+
} : {
|
|
210
|
+
status: 'error',
|
|
211
|
+
message: String((_payload_identity = payload['identity']) != null ? _payload_identity : 'No sending address is in effect.')
|
|
212
|
+
});
|
|
213
|
+
})();
|
|
214
|
+
return ()=>{
|
|
215
|
+
cancelled = true;
|
|
216
|
+
};
|
|
217
|
+
}, [
|
|
218
|
+
open,
|
|
219
|
+
sendHostId,
|
|
220
|
+
sendingApi
|
|
221
|
+
]);
|
|
222
|
+
useEffect(()=>{
|
|
223
|
+
if (!open) return;
|
|
224
|
+
setSubject('');
|
|
225
|
+
setBody('');
|
|
226
|
+
setAppliedTemplate(null);
|
|
227
|
+
setSaveOpen(false);
|
|
228
|
+
setRecords(NO_MERGE_RECORDS);
|
|
229
|
+
}, [
|
|
230
|
+
open
|
|
231
|
+
]);
|
|
232
|
+
/*
|
|
233
|
+
* The documents a preview reads, fetched the first time the draft names
|
|
234
|
+
* a merge field and kept for the rest of the open: the contact, the
|
|
235
|
+
* deal, the lead, and the sending site's name — off the org mount when
|
|
236
|
+
* it knows the site, off the host document otherwise. The route reads
|
|
237
|
+
* the same documents again for the send; these are what the rep sees.
|
|
238
|
+
*/ useEffect(()=>{
|
|
239
|
+
var _ref;
|
|
240
|
+
if (!open || !draftHasFields || records.loaded) return;
|
|
241
|
+
let cancelled = false;
|
|
242
|
+
const read = async (path)=>{
|
|
243
|
+
var _snapshot_data;
|
|
244
|
+
if (!path) return null;
|
|
245
|
+
const snapshot = await getDoc(doc(firestore, path[0], ...path.slice(1)));
|
|
246
|
+
return snapshot.exists() ? (_snapshot_data = snapshot.data()) != null ? _snapshot_data : null : null;
|
|
247
|
+
};
|
|
248
|
+
const mountedSite = sendHostId ? ((_ref = mount == null ? void 0 : mount.hosts) != null ? _ref : []).find((host)=>host.id === sendHostId) : undefined;
|
|
249
|
+
void Promise.all([
|
|
250
|
+
read(contactId && orgId ? [
|
|
251
|
+
'orgs',
|
|
252
|
+
orgId,
|
|
253
|
+
'contacts',
|
|
254
|
+
contactId
|
|
255
|
+
] : null),
|
|
256
|
+
read(dealId && orgId ? [
|
|
257
|
+
'orgs',
|
|
258
|
+
orgId,
|
|
259
|
+
CRM_COLLECTIONS.deals,
|
|
260
|
+
dealId
|
|
261
|
+
] : null),
|
|
262
|
+
read(leadId && sendHostId ? [
|
|
263
|
+
'hosts',
|
|
264
|
+
sendHostId,
|
|
265
|
+
'leads',
|
|
266
|
+
leadId
|
|
267
|
+
] : null),
|
|
268
|
+
mountedSite || !sendHostId ? null : read([
|
|
269
|
+
'hosts',
|
|
270
|
+
sendHostId
|
|
271
|
+
])
|
|
272
|
+
]).then(([contact, deal, lead, host])=>{
|
|
273
|
+
var _ref;
|
|
274
|
+
if (cancelled) return;
|
|
275
|
+
// A deal's contact, when the page named only the deal.
|
|
276
|
+
const dealContactId = String((_ref = deal == null ? void 0 : deal['contactId']) != null ? _ref : '').trim();
|
|
277
|
+
const withContact = !contact && dealContactId && orgId ? read([
|
|
278
|
+
'orgs',
|
|
279
|
+
orgId,
|
|
280
|
+
'contacts',
|
|
281
|
+
dealContactId
|
|
282
|
+
]) : Promise.resolve(contact);
|
|
283
|
+
return withContact.then((resolvedContact)=>{
|
|
284
|
+
var _ref, _host_displayName;
|
|
285
|
+
if (cancelled) return;
|
|
286
|
+
setRecords({
|
|
287
|
+
contact: resolvedContact,
|
|
288
|
+
deal,
|
|
289
|
+
lead,
|
|
290
|
+
site: (_ref = mountedSite == null ? void 0 : mountedSite.name) != null ? _ref : host ? String((_host_displayName = host['displayName']) != null ? _host_displayName : '') : null,
|
|
291
|
+
loaded: true
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
}).catch((cause)=>{
|
|
295
|
+
console.error(cause);
|
|
296
|
+
if (!cancelled) setRecords(_extends({}, NO_MERGE_RECORDS, {
|
|
297
|
+
loaded: true
|
|
298
|
+
}));
|
|
299
|
+
});
|
|
300
|
+
return ()=>{
|
|
301
|
+
cancelled = true;
|
|
302
|
+
};
|
|
303
|
+
}, [
|
|
304
|
+
open,
|
|
305
|
+
draftHasFields,
|
|
306
|
+
records.loaded,
|
|
307
|
+
firestore,
|
|
308
|
+
orgId,
|
|
309
|
+
contactId,
|
|
310
|
+
dealId,
|
|
311
|
+
leadId,
|
|
312
|
+
sendHostId,
|
|
313
|
+
mount == null ? void 0 : mount.hosts
|
|
314
|
+
]);
|
|
315
|
+
const mergeContext = useMemo(()=>{
|
|
316
|
+
var _ref, _ref1, _records_site;
|
|
317
|
+
return {
|
|
318
|
+
contact: records.contact,
|
|
319
|
+
contactGroupId: sendHostId ? consentGroupForHost(org != null ? org : null, sendHostId).groupId : null,
|
|
320
|
+
deal: records.deal,
|
|
321
|
+
lead: records.lead,
|
|
322
|
+
sender: {
|
|
323
|
+
name: (_ref = user == null ? void 0 : user.displayName) != null ? _ref : '',
|
|
324
|
+
email: (_ref1 = user == null ? void 0 : user.email) != null ? _ref1 : ''
|
|
325
|
+
},
|
|
326
|
+
site: {
|
|
327
|
+
name: (_records_site = records.site) != null ? _records_site : ''
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}, [
|
|
331
|
+
records,
|
|
332
|
+
sendHostId,
|
|
333
|
+
org,
|
|
334
|
+
user == null ? void 0 : user.displayName,
|
|
335
|
+
user == null ? void 0 : user.email
|
|
336
|
+
]);
|
|
337
|
+
const preview = useMemo(()=>draftHasFields && records.loaded ? {
|
|
338
|
+
subject: resolveCrmMergeFields(subject, mergeContext),
|
|
339
|
+
body: resolveCrmMergeFields(body, mergeContext)
|
|
340
|
+
} : null, [
|
|
341
|
+
draftHasFields,
|
|
342
|
+
records.loaded,
|
|
343
|
+
subject,
|
|
344
|
+
body,
|
|
345
|
+
mergeContext
|
|
346
|
+
]);
|
|
347
|
+
const unresolved = useMemo(()=>preview ? [
|
|
348
|
+
...new Set([
|
|
349
|
+
...preview.subject.unresolved,
|
|
350
|
+
...preview.body.unresolved
|
|
351
|
+
])
|
|
352
|
+
] : [], [
|
|
353
|
+
preview
|
|
354
|
+
]);
|
|
355
|
+
/** A template into both fields — asking first when a message is already written. */ const applyTemplate = useCallback(async (template)=>{
|
|
356
|
+
if (!template) {
|
|
357
|
+
setAppliedTemplate(null);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const written = body.trim().length > 0 && body !== (appliedTemplate == null ? void 0 : appliedTemplate.body);
|
|
361
|
+
if (written) {
|
|
362
|
+
const accepted = await confirm({
|
|
363
|
+
title: 'Replace the message?',
|
|
364
|
+
description: `"${template.name}" replaces what you have written in the subject and the message.`,
|
|
365
|
+
confirmationText: 'Replace'
|
|
366
|
+
}).then(()=>true).catch(()=>false);
|
|
367
|
+
if (!accepted) return;
|
|
368
|
+
}
|
|
369
|
+
if (template.subject) setSubject(template.subject);
|
|
370
|
+
setBody(template.body);
|
|
371
|
+
setAppliedTemplate(template);
|
|
372
|
+
}, [
|
|
373
|
+
body,
|
|
374
|
+
appliedTemplate,
|
|
375
|
+
confirm
|
|
376
|
+
]);
|
|
377
|
+
/*
|
|
378
|
+
* The `recordEmail` zone (AGL-2917), hosted through the shell's renderer: a
|
|
379
|
+
* widget there proposes a subject and a message, which land in the fields
|
|
380
|
+
* above like a template does, asking first when a message is already
|
|
381
|
+
* written. Send is still the only write, and the zone reads the record the
|
|
382
|
+
* message is written from: the deal over its contact, a lead on its own site,
|
|
383
|
+
* and at the organization level a contact or a deal the org reads.
|
|
384
|
+
*/ const EmailDraftSlot = useConsoleWidgetSlot();
|
|
385
|
+
const proposeDraft = useCallback(async (draft)=>{
|
|
386
|
+
const next = {
|
|
387
|
+
subject: draft.subject.slice(0, CRM_EMAIL_SUBJECT_MAX),
|
|
388
|
+
body: draft.body.slice(0, CRM_EMAIL_BODY_MAX)
|
|
389
|
+
};
|
|
390
|
+
if (body.trim() && body !== next.body) {
|
|
391
|
+
const accepted = await confirm({
|
|
392
|
+
title: 'Replace the message?',
|
|
393
|
+
description: 'The draft replaces what you have written in the subject and the message.',
|
|
394
|
+
confirmationText: 'Replace'
|
|
395
|
+
}).then(()=>true).catch(()=>false);
|
|
396
|
+
if (!accepted) return;
|
|
397
|
+
}
|
|
398
|
+
setSubject(next.subject);
|
|
399
|
+
setBody(next.body);
|
|
400
|
+
setAppliedTemplate(null);
|
|
401
|
+
}, [
|
|
402
|
+
body,
|
|
403
|
+
confirm
|
|
404
|
+
]);
|
|
405
|
+
const draftRecord = dealId ? {
|
|
406
|
+
kind: 'deal',
|
|
407
|
+
id: dealId
|
|
408
|
+
} : leadId ? {
|
|
409
|
+
kind: 'lead',
|
|
410
|
+
id: leadId
|
|
411
|
+
} : contactId ? {
|
|
412
|
+
kind: 'contact',
|
|
413
|
+
id: contactId
|
|
414
|
+
} : null;
|
|
415
|
+
/** A snippet or a field where the caret is, the caret moved past it. */ const insertAtCaret = useCallback((text)=>{
|
|
416
|
+
var _ref, _ref1;
|
|
417
|
+
const element = messageRef.current;
|
|
418
|
+
const start = (_ref = element == null ? void 0 : element.selectionStart) != null ? _ref : body.length;
|
|
419
|
+
const end = (_ref1 = element == null ? void 0 : element.selectionEnd) != null ? _ref1 : body.length;
|
|
420
|
+
const next = `${body.slice(0, start)}${text}${body.slice(end)}`.slice(0, CRM_EMAIL_BODY_MAX);
|
|
421
|
+
setBody(next);
|
|
422
|
+
const caret = Math.min(start + text.length, next.length);
|
|
423
|
+
window.setTimeout(()=>{
|
|
424
|
+
element == null ? void 0 : element.focus();
|
|
425
|
+
element == null ? void 0 : element.setSelectionRange(caret, caret);
|
|
426
|
+
}, 0);
|
|
427
|
+
}, [
|
|
428
|
+
body
|
|
429
|
+
]);
|
|
430
|
+
/**
|
|
431
|
+
* The draft kept as a template, stamped as this surface's scope stamps
|
|
432
|
+
* every CRM record — the site's tokens under a site, the org token from
|
|
433
|
+
* the organization's hub — and, when personal, owned by the writer.
|
|
434
|
+
*/ const saveAsTemplate = useCallback(async (draft)=>{
|
|
435
|
+
const scope = templateScope.scope;
|
|
436
|
+
const uid = user == null ? void 0 : user.uid;
|
|
437
|
+
if (!scope || !uid || templateScope.createTokens.length === 0) {
|
|
438
|
+
throw new Error('a template needs an organization and a signed-in writer');
|
|
439
|
+
}
|
|
440
|
+
const now = Date.now();
|
|
441
|
+
await setDoc(doc(collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.emailTemplates), createResourceUid()), _extends({
|
|
442
|
+
name: draft.name,
|
|
443
|
+
subject: subject.trim(),
|
|
444
|
+
body: body.trim(),
|
|
445
|
+
kind: 'template',
|
|
446
|
+
visibility: draft.visibility
|
|
447
|
+
}, draft.visibility === 'personal' ? {
|
|
448
|
+
ownerUid: uid
|
|
449
|
+
} : {}, {
|
|
450
|
+
createdByUid: uid,
|
|
451
|
+
createdAtMs: now,
|
|
452
|
+
updatedAtMs: now,
|
|
453
|
+
hostId: templateScope.createHostId,
|
|
454
|
+
visibleTo: [
|
|
455
|
+
...templateScope.createTokens
|
|
456
|
+
],
|
|
457
|
+
createdAt: new Date(now),
|
|
458
|
+
updatedAt: new Date(now)
|
|
459
|
+
}));
|
|
460
|
+
enqueueSnackbar(`Template "${draft.name}" saved`, {
|
|
461
|
+
variant: 'success',
|
|
462
|
+
persist: false
|
|
463
|
+
});
|
|
464
|
+
setSaveOpen(false);
|
|
465
|
+
}, [
|
|
466
|
+
templateScope,
|
|
467
|
+
user == null ? void 0 : user.uid,
|
|
468
|
+
firestore,
|
|
469
|
+
subject,
|
|
470
|
+
body,
|
|
471
|
+
enqueueSnackbar
|
|
472
|
+
]);
|
|
473
|
+
/*
|
|
474
|
+
* The address, when the caller had none: one read of the contact, on
|
|
475
|
+
* open. The route reads it again for itself; this one is what the To
|
|
476
|
+
* field prints, and a field that printed nothing until the send answered
|
|
477
|
+
* would ask the rep to write to somebody unnamed.
|
|
478
|
+
*/ useEffect(()=>{
|
|
479
|
+
if (!open) return;
|
|
480
|
+
const given = normalizeContactEmail(props.email);
|
|
481
|
+
if (given) {
|
|
482
|
+
setRecipient(given);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (!contactId || !orgId) return;
|
|
486
|
+
let cancelled = false;
|
|
487
|
+
void getDoc(doc(firestore, 'orgs', orgId, 'contacts', contactId)).then((snapshot)=>{
|
|
488
|
+
var _normalizeContactEmail;
|
|
489
|
+
if (cancelled) return;
|
|
490
|
+
setRecipient((_normalizeContactEmail = normalizeContactEmail(snapshot.get('email'))) != null ? _normalizeContactEmail : null);
|
|
491
|
+
}).catch((cause)=>{
|
|
492
|
+
console.error(cause);
|
|
493
|
+
if (!cancelled) setRecipient(null);
|
|
494
|
+
});
|
|
495
|
+
return ()=>{
|
|
496
|
+
cancelled = true;
|
|
497
|
+
};
|
|
498
|
+
}, [
|
|
499
|
+
open,
|
|
500
|
+
props.email,
|
|
501
|
+
contactId,
|
|
502
|
+
orgId,
|
|
503
|
+
firestore
|
|
504
|
+
]);
|
|
505
|
+
const replyTo = (_normalizeContactEmail1 = normalizeContactEmail(user == null ? void 0 : user.email)) != null ? _normalizeContactEmail1 : '';
|
|
506
|
+
const canSend = identity.status === 'ready' && Boolean(recipient) && subject.trim().length > 0 && body.trim().length > 0 && !sending;
|
|
507
|
+
const handleSend = useCallback(async ()=>{
|
|
508
|
+
if (!canSend) return;
|
|
509
|
+
setSending(true);
|
|
510
|
+
setError(null);
|
|
511
|
+
try {
|
|
512
|
+
var _payload_activityId;
|
|
513
|
+
const { response, payload } = await crmApi('email-send', _extends({}, contactId ? {
|
|
514
|
+
contactId
|
|
515
|
+
} : {}, leadId ? {
|
|
516
|
+
leadId
|
|
517
|
+
} : {}, dealId ? {
|
|
518
|
+
dealId
|
|
519
|
+
} : {}, {
|
|
520
|
+
subject: subject.trim(),
|
|
521
|
+
body: body.trim()
|
|
522
|
+
}));
|
|
523
|
+
if (!response.ok) {
|
|
524
|
+
var _payload_error;
|
|
525
|
+
setError(String((_payload_error = payload['error']) != null ? _payload_error : 'The email could not be sent.'));
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
enqueueSnackbar('Email sent', {
|
|
529
|
+
variant: 'success',
|
|
530
|
+
persist: false
|
|
531
|
+
});
|
|
532
|
+
onSent == null ? void 0 : onSent({
|
|
533
|
+
activityId: String((_payload_activityId = payload['activityId']) != null ? _payload_activityId : '')
|
|
534
|
+
});
|
|
535
|
+
onClose();
|
|
536
|
+
} catch (cause) {
|
|
537
|
+
console.error(cause);
|
|
538
|
+
setError('The email could not be sent.');
|
|
539
|
+
} finally{
|
|
540
|
+
setSending(false);
|
|
541
|
+
}
|
|
542
|
+
}, [
|
|
543
|
+
canSend,
|
|
544
|
+
crmApi,
|
|
545
|
+
contactId,
|
|
546
|
+
leadId,
|
|
547
|
+
dealId,
|
|
548
|
+
subject,
|
|
549
|
+
body,
|
|
550
|
+
enqueueSnackbar,
|
|
551
|
+
onSent,
|
|
552
|
+
onClose
|
|
553
|
+
]);
|
|
554
|
+
const toLabel = props.name && recipient ? `${props.name} <${recipient}>` : recipient != null ? recipient : '';
|
|
555
|
+
/*
|
|
556
|
+
* The booking door (AGL-2660): a link to one of the sending site's
|
|
557
|
+
* services, dropped where the caret is. The link carries the most
|
|
558
|
+
* specific record this message is about — the deal over its contact, so
|
|
559
|
+
* the booking lands on the deal's timeline as the email does.
|
|
560
|
+
*/ const bookingRef = dealId ? {
|
|
561
|
+
kind: 'deal',
|
|
562
|
+
id: dealId
|
|
563
|
+
} : leadId ? {
|
|
564
|
+
kind: 'lead',
|
|
565
|
+
id: leadId
|
|
566
|
+
} : contactId ? {
|
|
567
|
+
kind: 'contact',
|
|
568
|
+
id: contactId
|
|
569
|
+
} : null;
|
|
570
|
+
const handleInsertLink = useCallback((link)=>{
|
|
571
|
+
var _ref, _ref1, _ref2;
|
|
572
|
+
const input = messageRef.current;
|
|
573
|
+
const current = (_ref = input == null ? void 0 : input.value) != null ? _ref : '';
|
|
574
|
+
const start = (_ref1 = input == null ? void 0 : input.selectionStart) != null ? _ref1 : current.length;
|
|
575
|
+
const end = (_ref2 = input == null ? void 0 : input.selectionEnd) != null ? _ref2 : start;
|
|
576
|
+
const next = insertLinkAtCaret(current, link, start, end);
|
|
577
|
+
setBody(next.text);
|
|
578
|
+
// Once the new value has painted, typing continues after the link.
|
|
579
|
+
window.setTimeout(()=>{
|
|
580
|
+
input == null ? void 0 : input.focus();
|
|
581
|
+
input == null ? void 0 : input.setSelectionRange(next.caret, next.caret);
|
|
582
|
+
}, 0);
|
|
583
|
+
}, []);
|
|
584
|
+
return /*#__PURE__*/ _jsxs(Dialog, {
|
|
585
|
+
open: open,
|
|
586
|
+
onClose: sending ? undefined : onClose,
|
|
587
|
+
maxWidth: "sm",
|
|
588
|
+
fullWidth: true,
|
|
589
|
+
children: [
|
|
590
|
+
/*#__PURE__*/ _jsx(DialogTitle, {
|
|
591
|
+
children: 'Send email'
|
|
592
|
+
}),
|
|
593
|
+
/*#__PURE__*/ _jsxs(DialogContent, {
|
|
594
|
+
sx: {
|
|
595
|
+
display: 'flex',
|
|
596
|
+
flexDirection: 'column',
|
|
597
|
+
gap: 2
|
|
598
|
+
},
|
|
599
|
+
children: [
|
|
600
|
+
!hostId ? /*#__PURE__*/ _jsx(CrmSitePicker, {
|
|
601
|
+
hostId: hostId,
|
|
602
|
+
label: "Send from",
|
|
603
|
+
helperText: "The site whose sending address the email leaves on.",
|
|
604
|
+
disabled: sending
|
|
605
|
+
}) : null,
|
|
606
|
+
identity.status === 'site' ? /*#__PURE__*/ _jsx(Alert, {
|
|
607
|
+
severity: "info",
|
|
608
|
+
sx: {
|
|
609
|
+
mt: 1
|
|
610
|
+
},
|
|
611
|
+
children: 'Pick the site the email leaves from.'
|
|
612
|
+
}) : identity.status === 'refused' ? /*#__PURE__*/ _jsxs(Alert, {
|
|
613
|
+
severity: "warning",
|
|
614
|
+
sx: {
|
|
615
|
+
mt: 1
|
|
616
|
+
},
|
|
617
|
+
children: [
|
|
618
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
619
|
+
variant: "body2",
|
|
620
|
+
children: identity.message
|
|
621
|
+
}),
|
|
622
|
+
sendingPath ? /*#__PURE__*/ _jsx(Typography, {
|
|
623
|
+
variant: "body2",
|
|
624
|
+
sx: {
|
|
625
|
+
mt: 0.5
|
|
626
|
+
},
|
|
627
|
+
children: /*#__PURE__*/ _jsx(AppLink, {
|
|
628
|
+
href: sendingPath,
|
|
629
|
+
children: identity.canManage ? 'Set up sending' : 'See sending'
|
|
630
|
+
})
|
|
631
|
+
}) : /*#__PURE__*/ _jsx(Typography, {
|
|
632
|
+
variant: "body2",
|
|
633
|
+
sx: {
|
|
634
|
+
mt: 0.5
|
|
635
|
+
},
|
|
636
|
+
children: 'An admin sets this up under Emails › Sending.'
|
|
637
|
+
})
|
|
638
|
+
]
|
|
639
|
+
}) : identity.status === 'error' ? /*#__PURE__*/ _jsx(Alert, {
|
|
640
|
+
severity: "error",
|
|
641
|
+
sx: {
|
|
642
|
+
mt: 1
|
|
643
|
+
},
|
|
644
|
+
children: identity.message
|
|
645
|
+
}) : null,
|
|
646
|
+
open && !recipient && (identity.status === 'ready' || identity.status === 'loading') ? /*#__PURE__*/ _jsx(Alert, {
|
|
647
|
+
severity: "warning",
|
|
648
|
+
sx: {
|
|
649
|
+
mt: 1
|
|
650
|
+
},
|
|
651
|
+
children: 'This record has no email address.'
|
|
652
|
+
}) : null,
|
|
653
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
654
|
+
size: "small",
|
|
655
|
+
label: "To",
|
|
656
|
+
value: toLabel,
|
|
657
|
+
slotProps: {
|
|
658
|
+
input: {
|
|
659
|
+
readOnly: true
|
|
660
|
+
},
|
|
661
|
+
inputLabel: {
|
|
662
|
+
shrink: true
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
sx: {
|
|
666
|
+
mt: identity.status === 'ready' || identity.status === 'loading' ? 1 : 0
|
|
667
|
+
}
|
|
668
|
+
}),
|
|
669
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
670
|
+
size: "small",
|
|
671
|
+
label: "From",
|
|
672
|
+
value: identity.status === 'ready' ? identity.from : identity.status === 'loading' ? 'Resolving the site’s sending address…' : identity.status === 'site' ? 'Pick a site to send from' : '',
|
|
673
|
+
slotProps: {
|
|
674
|
+
input: {
|
|
675
|
+
readOnly: true
|
|
676
|
+
},
|
|
677
|
+
inputLabel: {
|
|
678
|
+
shrink: true
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}),
|
|
682
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
683
|
+
size: "small",
|
|
684
|
+
label: "Reply-to",
|
|
685
|
+
value: replyTo,
|
|
686
|
+
helperText: "Replies come to you, not to the site's mailbox.",
|
|
687
|
+
slotProps: {
|
|
688
|
+
input: {
|
|
689
|
+
readOnly: true
|
|
690
|
+
},
|
|
691
|
+
inputLabel: {
|
|
692
|
+
shrink: true
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}),
|
|
696
|
+
capture.status === 'ready' ? /*#__PURE__*/ _jsx(TextField, {
|
|
697
|
+
size: "small",
|
|
698
|
+
label: "Log replies",
|
|
699
|
+
value: capture.address,
|
|
700
|
+
helperText: CAPTURE_ADDRESS_HELPER,
|
|
701
|
+
slotProps: {
|
|
702
|
+
input: {
|
|
703
|
+
readOnly: true,
|
|
704
|
+
endAdornment: /*#__PURE__*/ _jsx(InputAdornment, {
|
|
705
|
+
position: "end",
|
|
706
|
+
children: /*#__PURE__*/ _jsx(CopyCaptureAddressButton, {
|
|
707
|
+
address: capture.address
|
|
708
|
+
})
|
|
709
|
+
})
|
|
710
|
+
},
|
|
711
|
+
inputLabel: {
|
|
712
|
+
shrink: true
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}) : null,
|
|
716
|
+
pickable.length ? /*#__PURE__*/ _jsx(CrmTemplatePicker, {
|
|
717
|
+
templates: pickable,
|
|
718
|
+
value: appliedTemplate,
|
|
719
|
+
onChange: (template)=>void applyTemplate(template),
|
|
720
|
+
disabled: sending
|
|
721
|
+
}) : null,
|
|
722
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
723
|
+
size: "small",
|
|
724
|
+
label: "Subject",
|
|
725
|
+
value: subject,
|
|
726
|
+
onChange: (event)=>setSubject(event.target.value),
|
|
727
|
+
autoFocus: true,
|
|
728
|
+
slotProps: {
|
|
729
|
+
htmlInput: {
|
|
730
|
+
maxLength: CRM_EMAIL_SUBJECT_MAX
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}),
|
|
734
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
735
|
+
direction: "row",
|
|
736
|
+
spacing: 1,
|
|
737
|
+
sx: {
|
|
738
|
+
justifyContent: 'flex-end'
|
|
739
|
+
},
|
|
740
|
+
children: [
|
|
741
|
+
/*#__PURE__*/ _jsx(CrmInsertMenu, {
|
|
742
|
+
snippets: snippets,
|
|
743
|
+
groups: fieldGroups,
|
|
744
|
+
disabled: sending,
|
|
745
|
+
onInsert: insertAtCaret
|
|
746
|
+
}),
|
|
747
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
748
|
+
size: "small",
|
|
749
|
+
disabled: sending || !templateScope.scope || !subject.trim() && !body.trim(),
|
|
750
|
+
onClick: ()=>setSaveOpen(true),
|
|
751
|
+
children: 'Save as template…'
|
|
752
|
+
})
|
|
753
|
+
]
|
|
754
|
+
}),
|
|
755
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
756
|
+
size: "small",
|
|
757
|
+
label: "Message",
|
|
758
|
+
value: body,
|
|
759
|
+
onChange: (event)=>setBody(event.target.value),
|
|
760
|
+
multiline: true,
|
|
761
|
+
minRows: 6,
|
|
762
|
+
inputRef: messageRef,
|
|
763
|
+
helperText: unresolved.length ? crmMergeUnresolvedMessage(unresolved) : draftHasFields ? 'Plain text. Merge fields are filled in from this record when the email is sent.' : 'Plain text. A blank line starts a new paragraph.',
|
|
764
|
+
slotProps: {
|
|
765
|
+
htmlInput: {
|
|
766
|
+
maxLength: CRM_EMAIL_BODY_MAX
|
|
767
|
+
},
|
|
768
|
+
formHelperText: {
|
|
769
|
+
sx: unresolved.length ? {
|
|
770
|
+
color: 'warning.main'
|
|
771
|
+
} : undefined
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}),
|
|
775
|
+
EmailDraftSlot && draftRecord ? /*#__PURE__*/ _jsx(EmailDraftSlot, {
|
|
776
|
+
slot: "recordEmail",
|
|
777
|
+
// A lead is read on its own site; a contact or a deal at the level
|
|
778
|
+
// the composer was opened at.
|
|
779
|
+
hostId: draftRecord.kind === 'lead' || !mount ? hostId : null,
|
|
780
|
+
orgId: orgId != null ? orgId : undefined,
|
|
781
|
+
record: _extends({}, draftRecord, {
|
|
782
|
+
name: String((_props_name = props.name) != null ? _props_name : '')
|
|
783
|
+
}),
|
|
784
|
+
subject: subject,
|
|
785
|
+
body: body,
|
|
786
|
+
proposeDraft: (draft)=>void proposeDraft(draft)
|
|
787
|
+
}) : null,
|
|
788
|
+
preview ? /*#__PURE__*/ _jsxs(Stack, {
|
|
789
|
+
spacing: 0.5,
|
|
790
|
+
"data-testid": "crm-email-preview",
|
|
791
|
+
children: [
|
|
792
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
793
|
+
variant: "caption",
|
|
794
|
+
color: "text.secondary",
|
|
795
|
+
children: 'Preview — as it will be sent'
|
|
796
|
+
}),
|
|
797
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
798
|
+
variant: "subtitle2",
|
|
799
|
+
children: preview.subject.text
|
|
800
|
+
}),
|
|
801
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
802
|
+
variant: "body2",
|
|
803
|
+
sx: {
|
|
804
|
+
whiteSpace: 'pre-wrap'
|
|
805
|
+
},
|
|
806
|
+
children: preview.body.text
|
|
807
|
+
})
|
|
808
|
+
]
|
|
809
|
+
}) : null,
|
|
810
|
+
bookingRef ? /*#__PURE__*/ _jsx(CrmRecordBookingZone, {
|
|
811
|
+
variant: "chip",
|
|
812
|
+
hostId: sendHostId,
|
|
813
|
+
org: org,
|
|
814
|
+
kind: bookingRef.kind,
|
|
815
|
+
recordId: bookingRef.id,
|
|
816
|
+
onInsert: handleInsertLink
|
|
817
|
+
}) : null,
|
|
818
|
+
error ? /*#__PURE__*/ _jsx(Alert, {
|
|
819
|
+
severity: "error",
|
|
820
|
+
children: error
|
|
821
|
+
}) : null
|
|
822
|
+
]
|
|
823
|
+
}),
|
|
824
|
+
/*#__PURE__*/ _jsx(CrmSaveAsTemplateDialog, {
|
|
825
|
+
open: saveOpen,
|
|
826
|
+
onClose: ()=>setSaveOpen(false),
|
|
827
|
+
onSave: saveAsTemplate
|
|
828
|
+
}),
|
|
829
|
+
/*#__PURE__*/ _jsxs(DialogActions, {
|
|
830
|
+
children: [
|
|
831
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
832
|
+
onClick: onClose,
|
|
833
|
+
disabled: sending,
|
|
834
|
+
children: 'Cancel'
|
|
835
|
+
}),
|
|
836
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
837
|
+
variant: "contained",
|
|
838
|
+
color: "primary",
|
|
839
|
+
disabled: !canSend,
|
|
840
|
+
onClick: handleSend,
|
|
841
|
+
children: sending ? 'Sending…' : 'Send'
|
|
842
|
+
})
|
|
843
|
+
]
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
CrmSendEmailDialog.displayName = 'CrmSendEmailDialog';
|
|
849
|
+
export default CrmSendEmailDialog;
|
|
850
|
+
|
|
851
|
+
//# sourceMappingURL=crm-send-email-dialog.js.map
|