@aglyn/plugins-crm 1.0.0-beta.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +57 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +29 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/activity-list.d.ts +98 -0
- package/src/lib/components/activity-list.js +321 -0
- package/src/lib/components/activity-list.js.map +1 -0
- package/src/lib/components/activity-queries.d.ts +117 -0
- package/src/lib/components/activity-queries.js +198 -0
- package/src/lib/components/activity-queries.js.map +1 -0
- package/src/lib/components/add-to-list-button.d.ts +25 -0
- package/src/lib/components/add-to-list-button.js +64 -0
- package/src/lib/components/add-to-list-button.js.map +1 -0
- package/src/lib/components/add-to-list-dialog.d.ts +24 -0
- package/src/lib/components/add-to-list-dialog.js +327 -0
- package/src/lib/components/add-to-list-dialog.js.map +1 -0
- package/src/lib/components/assignment-rule-drawer.d.ts +43 -0
- package/src/lib/components/assignment-rule-drawer.js +293 -0
- package/src/lib/components/assignment-rule-drawer.js.map +1 -0
- package/src/lib/components/companies-bulk-bar.d.ts +29 -0
- package/src/lib/components/companies-bulk-bar.js +274 -0
- package/src/lib/components/companies-bulk-bar.js.map +1 -0
- package/src/lib/components/companies-section.d.ts +54 -0
- package/src/lib/components/companies-section.js +522 -0
- package/src/lib/components/companies-section.js.map +1 -0
- package/src/lib/components/company-contacts-card.d.ts +49 -0
- package/src/lib/components/company-contacts-card.js +435 -0
- package/src/lib/components/company-contacts-card.js.map +1 -0
- package/src/lib/components/company-deals-card.d.ts +20 -0
- package/src/lib/components/company-deals-card.js +38 -0
- package/src/lib/components/company-deals-card.js.map +1 -0
- package/src/lib/components/company-detail-page.d.ts +20 -0
- package/src/lib/components/company-detail-page.js +165 -0
- package/src/lib/components/company-detail-page.js.map +1 -0
- package/src/lib/components/company-edit-drawer.d.ts +65 -0
- package/src/lib/components/company-edit-drawer.js +433 -0
- package/src/lib/components/company-edit-drawer.js.map +1 -0
- package/src/lib/components/company-import-drawer.d.ts +42 -0
- package/src/lib/components/company-import-drawer.js +99 -0
- package/src/lib/components/company-import-drawer.js.map +1 -0
- package/src/lib/components/company-picker.d.ts +127 -0
- package/src/lib/components/company-picker.js +323 -0
- package/src/lib/components/company-picker.js.map +1 -0
- package/src/lib/components/company-properties-card.d.ts +47 -0
- package/src/lib/components/company-properties-card.js +289 -0
- package/src/lib/components/company-properties-card.js.map +1 -0
- package/src/lib/components/contact-address-fields.d.ts +29 -0
- package/src/lib/components/contact-address-fields.js +149 -0
- package/src/lib/components/contact-address-fields.js.map +1 -0
- package/src/lib/components/contact-associations-card.d.ts +72 -0
- package/src/lib/components/contact-associations-card.js +296 -0
- package/src/lib/components/contact-associations-card.js.map +1 -0
- package/src/lib/components/contact-custom-columns.d.ts +38 -0
- package/src/lib/components/contact-custom-columns.js +102 -0
- package/src/lib/components/contact-custom-columns.js.map +1 -0
- package/src/lib/components/contact-custom-fields-card.d.ts +39 -0
- package/src/lib/components/contact-custom-fields-card.js +204 -0
- package/src/lib/components/contact-custom-fields-card.js.map +1 -0
- package/src/lib/components/contact-deals-card.d.ts +20 -0
- package/src/lib/components/contact-deals-card.js +38 -0
- package/src/lib/components/contact-deals-card.js.map +1 -0
- package/src/lib/components/contact-detail-page.d.ts +46 -0
- package/src/lib/components/contact-detail-page.js +535 -0
- package/src/lib/components/contact-detail-page.js.map +1 -0
- package/src/lib/components/contact-duplicates-card.d.ts +42 -0
- package/src/lib/components/contact-duplicates-card.js +167 -0
- package/src/lib/components/contact-duplicates-card.js.map +1 -0
- package/src/lib/components/contact-field-drawer.d.ts +64 -0
- package/src/lib/components/contact-field-drawer.js +251 -0
- package/src/lib/components/contact-field-drawer.js.map +1 -0
- package/src/lib/components/contact-import-drawer.d.ts +46 -0
- package/src/lib/components/contact-import-drawer.js +149 -0
- package/src/lib/components/contact-import-drawer.js.map +1 -0
- package/src/lib/components/contact-known-by-card.d.ts +39 -0
- package/src/lib/components/contact-known-by-card.js +142 -0
- package/src/lib/components/contact-known-by-card.js.map +1 -0
- package/src/lib/components/contact-list-columns.d.ts +53 -0
- package/src/lib/components/contact-list-columns.js +288 -0
- package/src/lib/components/contact-list-columns.js.map +1 -0
- package/src/lib/components/contact-merge-dialog.d.ts +79 -0
- package/src/lib/components/contact-merge-dialog.js +405 -0
- package/src/lib/components/contact-merge-dialog.js.map +1 -0
- package/src/lib/components/contact-properties-card.d.ts +89 -0
- package/src/lib/components/contact-properties-card.js +492 -0
- package/src/lib/components/contact-properties-card.js.map +1 -0
- package/src/lib/components/contact-timeline-card.d.ts +68 -0
- package/src/lib/components/contact-timeline-card.js +435 -0
- package/src/lib/components/contact-timeline-card.js.map +1 -0
- package/src/lib/components/contacts-bulk-bar.d.ts +91 -0
- package/src/lib/components/contacts-bulk-bar.js +493 -0
- package/src/lib/components/contacts-bulk-bar.js.map +1 -0
- package/src/lib/components/contacts-section.d.ts +26 -0
- package/src/lib/components/contacts-section.js +1025 -0
- package/src/lib/components/contacts-section.js.map +1 -0
- package/src/lib/components/copy-capture-address-button.d.ts +33 -0
- package/src/lib/components/copy-capture-address-button.js +60 -0
- package/src/lib/components/copy-capture-address-button.js.map +1 -0
- package/src/lib/components/crm-attribution-zone.d.ts +38 -0
- package/src/lib/components/crm-attribution-zone.js +36 -0
- package/src/lib/components/crm-attribution-zone.js.map +1 -0
- package/src/lib/components/crm-booking-zone.d.ts +61 -0
- package/src/lib/components/crm-booking-zone.js +50 -0
- package/src/lib/components/crm-booking-zone.js.map +1 -0
- package/src/lib/components/crm-bulk-bar-frame.d.ts +47 -0
- package/src/lib/components/crm-bulk-bar-frame.js +137 -0
- package/src/lib/components/crm-bulk-bar-frame.js.map +1 -0
- package/src/lib/components/crm-call-actions.d.ts +65 -0
- package/src/lib/components/crm-call-actions.js +110 -0
- package/src/lib/components/crm-call-actions.js.map +1 -0
- package/src/lib/components/crm-column-menu.d.ts +21 -0
- package/src/lib/components/crm-column-menu.js +103 -0
- package/src/lib/components/crm-column-menu.js.map +1 -0
- package/src/lib/components/crm-console-page.d.ts +19 -0
- package/src/lib/components/crm-console-page.js +151 -0
- package/src/lib/components/crm-console-page.js.map +1 -0
- package/src/lib/components/crm-console-sections.d.ts +52 -0
- package/src/lib/components/crm-console-sections.js +83 -0
- package/src/lib/components/crm-console-sections.js.map +1 -0
- package/src/lib/components/crm-custom-field-control.d.ts +26 -0
- package/src/lib/components/crm-custom-field-control.js +131 -0
- package/src/lib/components/crm-custom-field-control.js.map +1 -0
- package/src/lib/components/crm-email-template-tools.d.ts +69 -0
- package/src/lib/components/crm-email-template-tools.js +240 -0
- package/src/lib/components/crm-email-template-tools.js.map +1 -0
- package/src/lib/components/crm-export-all-button.d.ts +39 -0
- package/src/lib/components/crm-export-all-button.js +98 -0
- package/src/lib/components/crm-export-all-button.js.map +1 -0
- package/src/lib/components/crm-filter-bar.d.ts +53 -0
- package/src/lib/components/crm-filter-bar.js +294 -0
- package/src/lib/components/crm-filter-bar.js.map +1 -0
- package/src/lib/components/crm-glance-card.d.ts +54 -0
- package/src/lib/components/crm-glance-card.js +219 -0
- package/src/lib/components/crm-glance-card.js.map +1 -0
- package/src/lib/components/crm-next-activity-column.d.ts +35 -0
- package/src/lib/components/crm-next-activity-column.js +100 -0
- package/src/lib/components/crm-next-activity-column.js.map +1 -0
- package/src/lib/components/crm-record-header.d.ts +97 -0
- package/src/lib/components/crm-record-header.js +160 -0
- package/src/lib/components/crm-record-header.js.map +1 -0
- package/src/lib/components/crm-record-insights-zone.d.ts +50 -0
- package/src/lib/components/crm-record-insights-zone.js +169 -0
- package/src/lib/components/crm-record-insights-zone.js.map +1 -0
- package/src/lib/components/crm-record-picker.d.ts +42 -0
- package/src/lib/components/crm-record-picker.js +104 -0
- package/src/lib/components/crm-record-picker.js.map +1 -0
- package/src/lib/components/crm-send-email-button.d.ts +39 -0
- package/src/lib/components/crm-send-email-button.js +81 -0
- package/src/lib/components/crm-send-email-button.js.map +1 -0
- package/src/lib/components/crm-send-email-dialog.d.ts +61 -0
- package/src/lib/components/crm-send-email-dialog.js +851 -0
- package/src/lib/components/crm-send-email-dialog.js.map +1 -0
- package/src/lib/components/crm-site-picker.d.ts +61 -0
- package/src/lib/components/crm-site-picker.js +99 -0
- package/src/lib/components/crm-site-picker.js.map +1 -0
- package/src/lib/components/crm-suite-lock.d.ts +29 -0
- package/src/lib/components/crm-suite-lock.js +114 -0
- package/src/lib/components/crm-suite-lock.js.map +1 -0
- package/src/lib/components/crm-tasks-due-card.d.ts +42 -0
- package/src/lib/components/crm-tasks-due-card.js +225 -0
- package/src/lib/components/crm-tasks-due-card.js.map +1 -0
- package/src/lib/components/crm-views-control.d.ts +65 -0
- package/src/lib/components/crm-views-control.js +518 -0
- package/src/lib/components/crm-views-control.js.map +1 -0
- package/src/lib/components/csv-import-drawer.d.ts +132 -0
- package/src/lib/components/csv-import-drawer.js +746 -0
- package/src/lib/components/csv-import-drawer.js.map +1 -0
- package/src/lib/components/deal-board.d.ts +70 -0
- package/src/lib/components/deal-board.js +478 -0
- package/src/lib/components/deal-board.js.map +1 -0
- package/src/lib/components/deal-detail-page.d.ts +18 -0
- package/src/lib/components/deal-detail-page.js +323 -0
- package/src/lib/components/deal-detail-page.js.map +1 -0
- package/src/lib/components/deal-edit-drawer.d.ts +59 -0
- package/src/lib/components/deal-edit-drawer.js +640 -0
- package/src/lib/components/deal-edit-drawer.js.map +1 -0
- package/src/lib/components/deal-import-drawer.d.ts +24 -0
- package/src/lib/components/deal-import-drawer.js +83 -0
- package/src/lib/components/deal-import-drawer.js.map +1 -0
- package/src/lib/components/deal-products-card.d.ts +48 -0
- package/src/lib/components/deal-products-card.js +614 -0
- package/src/lib/components/deal-products-card.js.map +1 -0
- package/src/lib/components/deal-properties-card.d.ts +29 -0
- package/src/lib/components/deal-properties-card.js +144 -0
- package/src/lib/components/deal-properties-card.js.map +1 -0
- package/src/lib/components/deal-stage-card.d.ts +24 -0
- package/src/lib/components/deal-stage-card.js +199 -0
- package/src/lib/components/deal-stage-card.js.map +1 -0
- package/src/lib/components/deals-bulk-bar.d.ts +31 -0
- package/src/lib/components/deals-bulk-bar.js +340 -0
- package/src/lib/components/deals-bulk-bar.js.map +1 -0
- package/src/lib/components/deals-section.d.ts +49 -0
- package/src/lib/components/deals-section.js +767 -0
- package/src/lib/components/deals-section.js.map +1 -0
- package/src/lib/components/email-capture-card.d.ts +42 -0
- package/src/lib/components/email-capture-card.js +134 -0
- package/src/lib/components/email-capture-card.js.map +1 -0
- package/src/lib/components/email-template-drawer.d.ts +33 -0
- package/src/lib/components/email-template-drawer.js +209 -0
- package/src/lib/components/email-template-drawer.js.map +1 -0
- package/src/lib/components/email-templates-card.d.ts +33 -0
- package/src/lib/components/email-templates-card.js +370 -0
- package/src/lib/components/email-templates-card.js.map +1 -0
- package/src/lib/components/erase-person-action.d.ts +92 -0
- package/src/lib/components/erase-person-action.js +261 -0
- package/src/lib/components/erase-person-action.js.map +1 -0
- package/src/lib/components/fields-section.d.ts +37 -0
- package/src/lib/components/fields-section.js +641 -0
- package/src/lib/components/fields-section.js.map +1 -0
- package/src/lib/components/form-contact-fields-card.d.ts +46 -0
- package/src/lib/components/form-contact-fields-card.js +253 -0
- package/src/lib/components/form-contact-fields-card.js.map +1 -0
- package/src/lib/components/insert-link-at-caret.d.ts +28 -0
- package/src/lib/components/insert-link-at-caret.js +37 -0
- package/src/lib/components/insert-link-at-caret.js.map +1 -0
- package/src/lib/components/lead-convert-dialog.d.ts +32 -0
- package/src/lib/components/lead-convert-dialog.js +493 -0
- package/src/lib/components/lead-convert-dialog.js.map +1 -0
- package/src/lib/components/lead-detail-page.d.ts +16 -0
- package/src/lib/components/lead-detail-page.js +163 -0
- package/src/lib/components/lead-detail-page.js.map +1 -0
- package/src/lib/components/lead-history-card.d.ts +32 -0
- package/src/lib/components/lead-history-card.js +165 -0
- package/src/lib/components/lead-history-card.js.map +1 -0
- package/src/lib/components/lead-import-drawer.d.ts +24 -0
- package/src/lib/components/lead-import-drawer.js +95 -0
- package/src/lib/components/lead-import-drawer.js.map +1 -0
- package/src/lib/components/lead-owner-select.d.ts +35 -0
- package/src/lib/components/lead-owner-select.js +91 -0
- package/src/lib/components/lead-owner-select.js.map +1 -0
- package/src/lib/components/lead-properties-card.d.ts +61 -0
- package/src/lib/components/lead-properties-card.js +395 -0
- package/src/lib/components/lead-properties-card.js.map +1 -0
- package/src/lib/components/lead-status-chip.d.ts +12 -0
- package/src/lib/components/lead-status-chip.js +43 -0
- package/src/lib/components/lead-status-chip.js.map +1 -0
- package/src/lib/components/lead-surfaces-note.d.ts +126 -0
- package/src/lib/components/lead-surfaces-note.js +262 -0
- package/src/lib/components/lead-surfaces-note.js.map +1 -0
- package/src/lib/components/lead-unqualify-dialog.d.ts +24 -0
- package/src/lib/components/lead-unqualify-dialog.js +125 -0
- package/src/lib/components/lead-unqualify-dialog.js.map +1 -0
- package/src/lib/components/leads-bulk-bar.d.ts +58 -0
- package/src/lib/components/leads-bulk-bar.js +307 -0
- package/src/lib/components/leads-bulk-bar.js.map +1 -0
- package/src/lib/components/leads-section.d.ts +23 -0
- package/src/lib/components/leads-section.js +664 -0
- package/src/lib/components/leads-section.js.map +1 -0
- package/src/lib/components/linked-deals-card.d.ts +32 -0
- package/src/lib/components/linked-deals-card.js +163 -0
- package/src/lib/components/linked-deals-card.js.map +1 -0
- package/src/lib/components/log-activity-dialog.d.ts +60 -0
- package/src/lib/components/log-activity-dialog.js +368 -0
- package/src/lib/components/log-activity-dialog.js.map +1 -0
- package/src/lib/components/lost-reason-dialog.d.ts +26 -0
- package/src/lib/components/lost-reason-dialog.js +95 -0
- package/src/lib/components/lost-reason-dialog.js.map +1 -0
- package/src/lib/components/new-contact-drawer.d.ts +78 -0
- package/src/lib/components/new-contact-drawer.js +343 -0
- package/src/lib/components/new-contact-drawer.js.map +1 -0
- package/src/lib/components/org-lead-surfaces-note.d.ts +57 -0
- package/src/lib/components/org-lead-surfaces-note.js +172 -0
- package/src/lib/components/org-lead-surfaces-note.js.map +1 -0
- package/src/lib/components/owner-avatar.d.ts +18 -0
- package/src/lib/components/owner-avatar.js +61 -0
- package/src/lib/components/owner-avatar.js.map +1 -0
- package/src/lib/components/pipeline-stages-dialog.d.ts +43 -0
- package/src/lib/components/pipeline-stages-dialog.js +339 -0
- package/src/lib/components/pipeline-stages-dialog.js.map +1 -0
- package/src/lib/components/pipelines-dialog.d.ts +55 -0
- package/src/lib/components/pipelines-dialog.js +517 -0
- package/src/lib/components/pipelines-dialog.js.map +1 -0
- package/src/lib/components/recent-activity-feed.d.ts +39 -0
- package/src/lib/components/recent-activity-feed.js +103 -0
- package/src/lib/components/recent-activity-feed.js.map +1 -0
- package/src/lib/components/recipes-card.d.ts +39 -0
- package/src/lib/components/recipes-card.js +485 -0
- package/src/lib/components/recipes-card.js.map +1 -0
- package/src/lib/components/record-activity-card.d.ts +26 -0
- package/src/lib/components/record-activity-card.js +121 -0
- package/src/lib/components/record-activity-card.js.map +1 -0
- package/src/lib/components/record-files-card.d.ts +67 -0
- package/src/lib/components/record-files-card.js +290 -0
- package/src/lib/components/record-files-card.js.map +1 -0
- package/src/lib/components/record-tasks-card.d.ts +32 -0
- package/src/lib/components/record-tasks-card.js +306 -0
- package/src/lib/components/record-tasks-card.js.map +1 -0
- package/src/lib/components/reports/activity-card.d.ts +57 -0
- package/src/lib/components/reports/activity-card.js +281 -0
- package/src/lib/components/reports/activity-card.js.map +1 -0
- package/src/lib/components/reports/closed-deals-card.d.ts +20 -0
- package/src/lib/components/reports/closed-deals-card.js +194 -0
- package/src/lib/components/reports/closed-deals-card.js.map +1 -0
- package/src/lib/components/reports/contacts-mix-card.d.ts +27 -0
- package/src/lib/components/reports/contacts-mix-card.js +161 -0
- package/src/lib/components/reports/contacts-mix-card.js.map +1 -0
- package/src/lib/components/reports/contacts-trend-card.d.ts +31 -0
- package/src/lib/components/reports/contacts-trend-card.js +144 -0
- package/src/lib/components/reports/contacts-trend-card.js.map +1 -0
- package/src/lib/components/reports/forecast-card.d.ts +22 -0
- package/src/lib/components/reports/forecast-card.js +251 -0
- package/src/lib/components/reports/forecast-card.js.map +1 -0
- package/src/lib/components/reports/lead-counts.d.ts +32 -0
- package/src/lib/components/reports/lead-counts.js +44 -0
- package/src/lib/components/reports/lead-counts.js.map +1 -0
- package/src/lib/components/reports/lead-funnel-card.d.ts +38 -0
- package/src/lib/components/reports/lead-funnel-card.js +375 -0
- package/src/lib/components/reports/lead-funnel-card.js.map +1 -0
- package/src/lib/components/reports/pipeline-card.d.ts +19 -0
- package/src/lib/components/reports/pipeline-card.js +338 -0
- package/src/lib/components/reports/pipeline-card.js.map +1 -0
- package/src/lib/components/reports/report-bar-chart.d.ts +39 -0
- package/src/lib/components/reports/report-bar-chart.js +133 -0
- package/src/lib/components/reports/report-bar-chart.js.map +1 -0
- package/src/lib/components/reports/report-breakdown.d.ts +32 -0
- package/src/lib/components/reports/report-breakdown.js +105 -0
- package/src/lib/components/reports/report-breakdown.js.map +1 -0
- package/src/lib/components/reports/report-export.d.ts +37 -0
- package/src/lib/components/reports/report-export.js +66 -0
- package/src/lib/components/reports/report-export.js.map +1 -0
- package/src/lib/components/reports/report-format.d.ts +36 -0
- package/src/lib/components/reports/report-format.js +43 -0
- package/src/lib/components/reports/report-format.js.map +1 -0
- package/src/lib/components/reports/report-scope.d.ts +81 -0
- package/src/lib/components/reports/report-scope.js +58 -0
- package/src/lib/components/reports/report-scope.js.map +1 -0
- package/src/lib/components/reports/report-stat-tile.d.ts +47 -0
- package/src/lib/components/reports/report-stat-tile.js +96 -0
- package/src/lib/components/reports/report-stat-tile.js.map +1 -0
- package/src/lib/components/reports/source-conversion-card.d.ts +28 -0
- package/src/lib/components/reports/source-conversion-card.js +205 -0
- package/src/lib/components/reports/source-conversion-card.js.map +1 -0
- package/src/lib/components/reports/tasks-card.d.ts +26 -0
- package/src/lib/components/reports/tasks-card.js +279 -0
- package/src/lib/components/reports/tasks-card.js.map +1 -0
- package/src/lib/components/reports/use-aggregate-read.d.ts +99 -0
- package/src/lib/components/reports/use-aggregate-read.js +195 -0
- package/src/lib/components/reports/use-aggregate-read.js.map +1 -0
- package/src/lib/components/reports/won-lost-by-owner-card.d.ts +30 -0
- package/src/lib/components/reports/won-lost-by-owner-card.js +168 -0
- package/src/lib/components/reports/won-lost-by-owner-card.js.map +1 -0
- package/src/lib/components/reports-section.d.ts +42 -0
- package/src/lib/components/reports-section.js +308 -0
- package/src/lib/components/reports-section.js.map +1 -0
- package/src/lib/components/sending-addresses-card.d.ts +49 -0
- package/src/lib/components/sending-addresses-card.js +262 -0
- package/src/lib/components/sending-addresses-card.js.map +1 -0
- package/src/lib/components/settings-section.d.ts +151 -0
- package/src/lib/components/settings-section.js +783 -0
- package/src/lib/components/settings-section.js.map +1 -0
- package/src/lib/components/task-cells.d.ts +51 -0
- package/src/lib/components/task-cells.js +139 -0
- package/src/lib/components/task-cells.js.map +1 -0
- package/src/lib/components/task-edit-drawer.d.ts +53 -0
- package/src/lib/components/task-edit-drawer.js +483 -0
- package/src/lib/components/task-edit-drawer.js.map +1 -0
- package/src/lib/components/task-import-drawer.d.ts +24 -0
- package/src/lib/components/task-import-drawer.js +82 -0
- package/src/lib/components/task-import-drawer.js.map +1 -0
- package/src/lib/components/task-snooze-menu.d.ts +65 -0
- package/src/lib/components/task-snooze-menu.js +207 -0
- package/src/lib/components/task-snooze-menu.js.map +1 -0
- package/src/lib/components/tasks-bulk-bar.d.ts +25 -0
- package/src/lib/components/tasks-bulk-bar.js +348 -0
- package/src/lib/components/tasks-bulk-bar.js.map +1 -0
- package/src/lib/components/tasks-calendar.d.ts +38 -0
- package/src/lib/components/tasks-calendar.js +228 -0
- package/src/lib/components/tasks-calendar.js.map +1 -0
- package/src/lib/components/tasks-section.d.ts +27 -0
- package/src/lib/components/tasks-section.js +579 -0
- package/src/lib/components/tasks-section.js.map +1 -0
- package/src/lib/components/use-contact-campaign-emails.d.ts +32 -0
- package/src/lib/components/use-contact-campaign-emails.js +83 -0
- package/src/lib/components/use-contact-campaign-emails.js.map +1 -0
- package/src/lib/components/use-crm-api.d.ts +44 -0
- package/src/lib/components/use-crm-api.js +84 -0
- package/src/lib/components/use-crm-api.js.map +1 -0
- package/src/lib/components/use-crm-inbound-address.d.ts +60 -0
- package/src/lib/components/use-crm-inbound-address.js +124 -0
- package/src/lib/components/use-crm-inbound-address.js.map +1 -0
- package/src/lib/components/use-emails-hub-path.d.ts +24 -0
- package/src/lib/components/use-emails-hub-path.js +59 -0
- package/src/lib/components/use-emails-hub-path.js.map +1 -0
- package/src/lib/components/use-member-email-aliases.d.ts +54 -0
- package/src/lib/components/use-member-email-aliases.js +186 -0
- package/src/lib/components/use-member-email-aliases.js.map +1 -0
- package/src/lib/components/use-org-members.d.ts +40 -0
- package/src/lib/components/use-org-members.js +100 -0
- package/src/lib/components/use-org-members.js.map +1 -0
- package/src/lib/constants/api-routes.d.ts +109 -0
- package/src/lib/constants/api-routes.js +74 -0
- package/src/lib/constants/api-routes.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +14 -0
- package/src/lib/constants/bundle-common.js +14 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/company-filters.d.ts +18 -0
- package/src/lib/constants/company-filters.js +51 -0
- package/src/lib/constants/company-filters.js.map +1 -0
- package/src/lib/constants/contact-filters.d.ts +38 -0
- package/src/lib/constants/contact-filters.js +294 -0
- package/src/lib/constants/contact-filters.js.map +1 -0
- package/src/lib/hooks/use-contact-field-definitions.d.ts +48 -0
- package/src/lib/hooks/use-contact-field-definitions.js +72 -0
- package/src/lib/hooks/use-contact-field-definitions.js.map +1 -0
- package/src/lib/hooks/use-contact-update.d.ts +25 -0
- package/src/lib/hooks/use-contact-update.js +80 -0
- package/src/lib/hooks/use-contact-update.js.map +1 -0
- package/src/lib/hooks/use-crm-activity-logger.d.ts +73 -0
- package/src/lib/hooks/use-crm-activity-logger.js +101 -0
- package/src/lib/hooks/use-crm-activity-logger.js.map +1 -0
- package/src/lib/hooks/use-crm-bulk-apply.d.ts +52 -0
- package/src/lib/hooks/use-crm-bulk-apply.js +112 -0
- package/src/lib/hooks/use-crm-bulk-apply.js.map +1 -0
- package/src/lib/hooks/use-crm-default-view.d.ts +24 -0
- package/src/lib/hooks/use-crm-default-view.js +64 -0
- package/src/lib/hooks/use-crm-default-view.js.map +1 -0
- package/src/lib/hooks/use-crm-email-templates.d.ts +59 -0
- package/src/lib/hooks/use-crm-email-templates.js +103 -0
- package/src/lib/hooks/use-crm-email-templates.js.map +1 -0
- package/src/lib/hooks/use-crm-hub-path.d.ts +29 -0
- package/src/lib/hooks/use-crm-hub-path.js +41 -0
- package/src/lib/hooks/use-crm-hub-path.js.map +1 -0
- package/src/lib/hooks/use-crm-org-mount.d.ts +97 -0
- package/src/lib/hooks/use-crm-org-mount.js +215 -0
- package/src/lib/hooks/use-crm-org-mount.js.map +1 -0
- package/src/lib/hooks/use-crm-record-names.d.ts +52 -0
- package/src/lib/hooks/use-crm-record-names.js +126 -0
- package/src/lib/hooks/use-crm-record-names.js.map +1 -0
- package/src/lib/hooks/use-crm-records-quota.d.ts +68 -0
- package/src/lib/hooks/use-crm-records-quota.js +118 -0
- package/src/lib/hooks/use-crm-records-quota.js.map +1 -0
- package/src/lib/hooks/use-crm-saved-view.d.ts +96 -0
- package/src/lib/hooks/use-crm-saved-view.js +329 -0
- package/src/lib/hooks/use-crm-saved-view.js.map +1 -0
- package/src/lib/hooks/use-crm-scope.d.ts +117 -0
- package/src/lib/hooks/use-crm-scope.js +147 -0
- package/src/lib/hooks/use-crm-scope.js.map +1 -0
- package/src/lib/hooks/use-crm-tasks.d.ts +85 -0
- package/src/lib/hooks/use-crm-tasks.js +153 -0
- package/src/lib/hooks/use-crm-tasks.js.map +1 -0
- package/src/lib/hooks/use-crm-view-grid.d.ts +55 -0
- package/src/lib/hooks/use-crm-view-grid.js +170 -0
- package/src/lib/hooks/use-crm-view-grid.js.map +1 -0
- package/src/lib/hooks/use-crm-views.d.ts +42 -0
- package/src/lib/hooks/use-crm-views.js +84 -0
- package/src/lib/hooks/use-crm-views.js.map +1 -0
- package/src/lib/hooks/use-deal-stage-api.d.ts +69 -0
- package/src/lib/hooks/use-deal-stage-api.js +78 -0
- package/src/lib/hooks/use-deal-stage-api.js.map +1 -0
- package/src/lib/hooks/use-deals.d.ts +47 -0
- package/src/lib/hooks/use-deals.js +105 -0
- package/src/lib/hooks/use-deals.js.map +1 -0
- package/src/lib/hooks/use-org-leads.d.ts +53 -0
- package/src/lib/hooks/use-org-leads.js +114 -0
- package/src/lib/hooks/use-org-leads.js.map +1 -0
- package/src/lib/hooks/use-org-member-directory.d.ts +36 -0
- package/src/lib/hooks/use-org-member-directory.js +116 -0
- package/src/lib/hooks/use-org-member-directory.js.map +1 -0
- package/src/lib/hooks/use-org-member-options.d.ts +38 -0
- package/src/lib/hooks/use-org-member-options.js +131 -0
- package/src/lib/hooks/use-org-member-options.js.map +1 -0
- package/src/lib/hooks/use-pipeline.d.ts +71 -0
- package/src/lib/hooks/use-pipeline.js +159 -0
- package/src/lib/hooks/use-pipeline.js.map +1 -0
- package/src/lib/model/companies-bulk-writes.d.ts +40 -0
- package/src/lib/model/companies-bulk-writes.js +103 -0
- package/src/lib/model/companies-bulk-writes.js.map +1 -0
- package/src/lib/model/companies-csv.d.ts +36 -0
- package/src/lib/model/companies-csv.js +38 -0
- package/src/lib/model/companies-csv.js.map +1 -0
- package/src/lib/model/companies.d.ts +99 -0
- package/src/lib/model/companies.js +168 -0
- package/src/lib/model/companies.js.map +1 -0
- package/src/lib/model/company-delete-route.d.ts +43 -0
- package/src/lib/model/company-delete-route.js +31 -0
- package/src/lib/model/company-delete-route.js.map +1 -0
- package/src/lib/model/company-delete.d.ts +42 -0
- package/src/lib/model/company-delete.js +52 -0
- package/src/lib/model/company-delete.js.map +1 -0
- package/src/lib/model/contact-duplicates.d.ts +58 -0
- package/src/lib/model/contact-duplicates.js +67 -0
- package/src/lib/model/contact-duplicates.js.map +1 -0
- package/src/lib/model/contact-record.d.ts +113 -0
- package/src/lib/model/contact-record.js +70 -0
- package/src/lib/model/contact-record.js.map +1 -0
- package/src/lib/model/contact-update.d.ts +93 -0
- package/src/lib/model/contact-update.js +50 -0
- package/src/lib/model/contact-update.js.map +1 -0
- package/src/lib/model/contacts-bulk-writes.d.ts +173 -0
- package/src/lib/model/contacts-bulk-writes.js +196 -0
- package/src/lib/model/contacts-bulk-writes.js.map +1 -0
- package/src/lib/model/contacts-csv.d.ts +54 -0
- package/src/lib/model/contacts-csv.js +67 -0
- package/src/lib/model/contacts-csv.js.map +1 -0
- package/src/lib/model/contacts-list-seed.d.ts +51 -0
- package/src/lib/model/contacts-list-seed.js +63 -0
- package/src/lib/model/contacts-list-seed.js.map +1 -0
- package/src/lib/model/crm-activity-report.d.ts +27 -0
- package/src/lib/model/crm-activity-report.js +56 -0
- package/src/lib/model/crm-activity-report.js.map +1 -0
- package/src/lib/model/crm-api.d.ts +49 -0
- package/src/lib/model/crm-api.js +47 -0
- package/src/lib/model/crm-api.js.map +1 -0
- package/src/lib/model/crm-bulk-writes.d.ts +147 -0
- package/src/lib/model/crm-bulk-writes.js +207 -0
- package/src/lib/model/crm-bulk-writes.js.map +1 -0
- package/src/lib/model/crm-company-import.d.ts +154 -0
- package/src/lib/model/crm-company-import.js +331 -0
- package/src/lib/model/crm-company-import.js.map +1 -0
- package/src/lib/model/crm-custom-draft.d.ts +62 -0
- package/src/lib/model/crm-custom-draft.js +67 -0
- package/src/lib/model/crm-custom-draft.js.map +1 -0
- package/src/lib/model/crm-deal-import.d.ts +112 -0
- package/src/lib/model/crm-deal-import.js +263 -0
- package/src/lib/model/crm-deal-import.js.map +1 -0
- package/src/lib/model/crm-import.d.ts +244 -0
- package/src/lib/model/crm-import.js +466 -0
- package/src/lib/model/crm-import.js.map +1 -0
- package/src/lib/model/crm-lead-import.d.ts +105 -0
- package/src/lib/model/crm-lead-import.js +255 -0
- package/src/lib/model/crm-lead-import.js.map +1 -0
- package/src/lib/model/crm-record-routes.d.ts +21 -0
- package/src/lib/model/crm-record-routes.js +70 -0
- package/src/lib/model/crm-record-routes.js.map +1 -0
- package/src/lib/model/crm-routes.d.ts +101 -0
- package/src/lib/model/crm-routes.js +92 -0
- package/src/lib/model/crm-routes.js.map +1 -0
- package/src/lib/model/crm-task-import.d.ts +94 -0
- package/src/lib/model/crm-task-import.js +275 -0
- package/src/lib/model/crm-task-import.js.map +1 -0
- package/src/lib/model/crm-view-param.d.ts +43 -0
- package/src/lib/model/crm-view-param.js +49 -0
- package/src/lib/model/crm-view-param.js.map +1 -0
- package/src/lib/model/deal-board-model.d.ts +241 -0
- package/src/lib/model/deal-board-model.js +439 -0
- package/src/lib/model/deal-board-model.js.map +1 -0
- package/src/lib/model/deal-form-model.d.ts +114 -0
- package/src/lib/model/deal-form-model.js +218 -0
- package/src/lib/model/deal-form-model.js.map +1 -0
- package/src/lib/model/deals-csv.d.ts +32 -0
- package/src/lib/model/deals-csv.js +37 -0
- package/src/lib/model/deals-csv.js.map +1 -0
- package/src/lib/model/import-column-shapes.d.ts +36 -0
- package/src/lib/model/import-column-shapes.js +76 -0
- package/src/lib/model/import-column-shapes.js.map +1 -0
- package/src/lib/model/lead-company-suggestion.d.ts +61 -0
- package/src/lib/model/lead-company-suggestion.js +65 -0
- package/src/lib/model/lead-company-suggestion.js.map +1 -0
- package/src/lib/model/lead-filters.d.ts +29 -0
- package/src/lib/model/lead-filters.js +39 -0
- package/src/lib/model/lead-filters.js.map +1 -0
- package/src/lib/model/lead-surfaces.d.ts +58 -0
- package/src/lib/model/lead-surfaces.js +67 -0
- package/src/lib/model/lead-surfaces.js.map +1 -0
- package/src/lib/model/leads-csv.d.ts +40 -0
- package/src/lib/model/leads-csv.js +40 -0
- package/src/lib/model/leads-csv.js.map +1 -0
- package/src/lib/model/next-activity-api.d.ts +31 -0
- package/src/lib/model/next-activity-api.js +57 -0
- package/src/lib/model/next-activity-api.js.map +1 -0
- package/src/lib/model/next-activity.d.ts +64 -0
- package/src/lib/model/next-activity.js +47 -0
- package/src/lib/model/next-activity.js.map +1 -0
- package/src/lib/model/person-key-web.d.ts +43 -0
- package/src/lib/model/person-key-web.js +52 -0
- package/src/lib/model/person-key-web.js.map +1 -0
- package/src/lib/model/record-facts.d.ts +282 -0
- package/src/lib/model/record-facts.js +434 -0
- package/src/lib/model/record-facts.js.map +1 -0
- package/src/lib/model/task-api.d.ts +28 -0
- package/src/lib/model/task-api.js +57 -0
- package/src/lib/model/task-api.js.map +1 -0
- package/src/lib/model/task-calendar.d.ts +108 -0
- package/src/lib/model/task-calendar.js +139 -0
- package/src/lib/model/task-calendar.js.map +1 -0
- package/src/lib/model/task-routes.d.ts +177 -0
- package/src/lib/model/task-routes.js +197 -0
- package/src/lib/model/task-routes.js.map +1 -0
- package/src/lib/model/task-scope.d.ts +45 -0
- package/src/lib/model/task-scope.js +51 -0
- package/src/lib/model/task-scope.js.map +1 -0
- package/src/lib/model/task-views.d.ts +149 -0
- package/src/lib/model/task-views.js +286 -0
- package/src/lib/model/task-views.js.map +1 -0
- package/src/lib/model/tasks-csv.d.ts +28 -0
- package/src/lib/model/tasks-csv.js +28 -0
- package/src/lib/model/tasks-csv.js.map +1 -0
- package/src/lib/plugin.d.ts +32 -0
- package/src/lib/plugin.js +208 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/server/companies-import.d.ts +57 -0
- package/src/lib/server/companies-import.js +242 -0
- package/src/lib/server/companies-import.js.map +1 -0
- package/src/lib/server/company-delete.d.ts +59 -0
- package/src/lib/server/company-delete.js +146 -0
- package/src/lib/server/company-delete.js.map +1 -0
- package/src/lib/server/contact-email-history.d.ts +82 -0
- package/src/lib/server/contact-email-history.js +264 -0
- package/src/lib/server/contact-email-history.js.map +1 -0
- package/src/lib/server/contact-profile.d.ts +41 -0
- package/src/lib/server/contact-profile.js +45 -0
- package/src/lib/server/contact-profile.js.map +1 -0
- package/src/lib/server/contact-update.d.ts +92 -0
- package/src/lib/server/contact-update.js +512 -0
- package/src/lib/server/contact-update.js.map +1 -0
- package/src/lib/server/contacts-import.d.ts +73 -0
- package/src/lib/server/contacts-import.js +263 -0
- package/src/lib/server/contacts-import.js.map +1 -0
- package/src/lib/server/contacts-merge.d.ts +86 -0
- package/src/lib/server/contacts-merge.js +206 -0
- package/src/lib/server/contacts-merge.js.map +1 -0
- package/src/lib/server/deals-import.d.ts +76 -0
- package/src/lib/server/deals-import.js +246 -0
- package/src/lib/server/deals-import.js.map +1 -0
- package/src/lib/server/email-send.d.ts +119 -0
- package/src/lib/server/email-send.js +667 -0
- package/src/lib/server/email-send.js.map +1 -0
- package/src/lib/server/email-template-duplicate.d.ts +19 -0
- package/src/lib/server/email-template-duplicate.js +206 -0
- package/src/lib/server/email-template-duplicate.js.map +1 -0
- package/src/lib/server/erase-person.d.ts +108 -0
- package/src/lib/server/erase-person.js +309 -0
- package/src/lib/server/erase-person.js.map +1 -0
- package/src/lib/server/import-context.d.ts +85 -0
- package/src/lib/server/import-context.js +181 -0
- package/src/lib/server/import-context.js.map +1 -0
- package/src/lib/server/inbound-address.d.ts +61 -0
- package/src/lib/server/inbound-address.js +188 -0
- package/src/lib/server/inbound-address.js.map +1 -0
- package/src/lib/server/lead-convert.d.ts +78 -0
- package/src/lib/server/lead-convert.js +250 -0
- package/src/lib/server/lead-convert.js.map +1 -0
- package/src/lib/server/leads-import.d.ts +84 -0
- package/src/lib/server/leads-import.js +261 -0
- package/src/lib/server/leads-import.js.map +1 -0
- package/src/lib/server/next-activity-routes.d.ts +33 -0
- package/src/lib/server/next-activity-routes.js +110 -0
- package/src/lib/server/next-activity-routes.js.map +1 -0
- package/src/lib/server/org-activity.d.ts +61 -0
- package/src/lib/server/org-activity.js +120 -0
- package/src/lib/server/org-activity.js.map +1 -0
- package/src/lib/server/org-caller.d.ts +110 -0
- package/src/lib/server/org-caller.js +154 -0
- package/src/lib/server/org-caller.js.map +1 -0
- package/src/lib/server/recipe-routes.d.ts +75 -0
- package/src/lib/server/recipe-routes.js +442 -0
- package/src/lib/server/recipe-routes.js.map +1 -0
- package/src/lib/server/record-facts.d.ts +65 -0
- package/src/lib/server/record-facts.js +337 -0
- package/src/lib/server/record-facts.js.map +1 -0
- package/src/lib/server/record-timeline.d.ts +51 -0
- package/src/lib/server/record-timeline.js +215 -0
- package/src/lib/server/record-timeline.js.map +1 -0
- package/src/lib/server/suite-gate.d.ts +42 -0
- package/src/lib/server/suite-gate.js +87 -0
- package/src/lib/server/suite-gate.js.map +1 -0
- package/src/lib/server/task-routes.d.ts +132 -0
- package/src/lib/server/task-routes.js +699 -0
- package/src/lib/server/task-routes.js.map +1 -0
- package/src/lib/server/tasks-import.d.ts +54 -0
- package/src/lib/server/tasks-import.js +157 -0
- package/src/lib/server/tasks-import.js.map +1 -0
- package/src/lib/server-deal-stage.d.ts +88 -0
- package/src/lib/server-deal-stage.js +316 -0
- package/src/lib/server-deal-stage.js.map +1 -0
- package/src/lib/server.d.ts +149 -0
- package/src/lib/server.js +615 -0
- package/src/lib/server.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/company-import-drawer.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\n/**\n * IMPORTING A COMPANIES FILE — the company vocabulary over the shared\n * drawer (AGL-2621).\n *\n * The server half is `server/companies-import.ts`. What is particular to\n * companies: the name is the one cell every row needs (a domain is a key,\n * a name is the caption the list cannot do without), the custom fields\n * are the org's COMPANY definitions (AGL-2661), and a row is matched to a\n * company already filed by its domain first and its name second.\n */\n\nimport {\n type ConsolePluginPageProps,\n type ContactFieldDefinition,\n pluginDocsHelp,\n} from '@aglyn/aglyn'\nimport {\n COMPANY_IMPORT_CHUNK_SIZE,\n COMPANY_IMPORT_FIELD_LABELS,\n COMPANY_IMPORT_FIELDS,\n COMPANY_IMPORT_MAX_ROWS,\n COMPANY_IMPORT_PREVIEW_ROWS,\n COMPANY_IMPORT_SKIP_LABELS,\n type CompanyImportField,\n type CompanyImportRawRow,\n type CompanyImportSkippedRow,\n companyImportSkippedCsv,\n emptyCompanyImportResult,\n guessCompanyImportMapping,\n mapCompanyImportRow,\n mergeCompanyImportResults,\n} from '../model/crm-company-import'\nimport { useMemo } from 'react'\nimport { useContactFieldDefinitions } from '../hooks/use-contact-field-definitions'\nimport { useCrmScope } from '../hooks/use-crm-scope'\nimport { companyImportTemplateCsv } from '../model/companies-csv'\nimport {\n CsvImportButton,\n CsvImportDrawer,\n type CsvImportVocabulary,\n} from './csv-import-drawer'\n\n/** The browser-side address of the route one chunk is posted to. */\nexport const COMPANIES_IMPORT_URL = '/api/crm/companies-import'\n\n/** The company vocabulary, over the org's company custom fields (AGL-2661). */\nexport function companyImportVocabulary(\n fields: readonly ContactFieldDefinition[],\n): CsvImportVocabulary<\n CompanyImportField,\n CompanyImportRawRow & Record<string, unknown>,\n CompanyImportSkippedRow\n> {\n return {\n title: 'Import companies from CSV',\n collection: 'companies',\n help: pluginDocsHelp('companies', { anchor: '#import-from-csv' }),\n sitePickerHelperText:\n 'The site these companies are filed under — it decides which of your ' +\n 'sites may see them.',\n intro:\n 'A CSV with a header row. Match its columns to company fields below, ' +\n 'check the preview, then import. A company already in your list — by ' +\n 'domain, or failing that by name — is updated rather than added twice. ' +\n `Up to ${COMPANY_IMPORT_MAX_ROWS.toLocaleString()} rows per file — split ` +\n 'a larger one.',\n fields: COMPANY_IMPORT_FIELDS,\n fieldLabels: COMPANY_IMPORT_FIELD_LABELS,\n customFields: fields,\n requiredField: 'name',\n requiredWarning:\n 'Choose which column holds the company name. It is the one field every ' +\n 'row needs.',\n unusableNotice: (count, total) =>\n `${count.toLocaleString()} of ${total.toLocaleString()} rows have no ` +\n 'company name and will be skipped. You can download them after the ' +\n 'import.',\n guessMapping: (columns) => guessCompanyImportMapping(columns, fields),\n mapRow: (cells, mapping) =>\n mapCompanyImportRow(cells, mapping) as CompanyImportRawRow & Record<string, unknown>,\n route: COMPANIES_IMPORT_URL,\n maxRows: COMPANY_IMPORT_MAX_ROWS,\n chunkSize: COMPANY_IMPORT_CHUNK_SIZE,\n previewRows: COMPANY_IMPORT_PREVIEW_ROWS,\n emptyResult: emptyCompanyImportResult,\n mergeResults: mergeCompanyImportResults,\n skipLabels: COMPANY_IMPORT_SKIP_LABELS,\n skippedCsv: companyImportSkippedCsv,\n skippedFileName: 'skipped-companies.csv',\n templateCsv: companyImportTemplateCsv,\n templateFileName: 'companies-template.csv',\n }\n}\n\n/** The vocabulary with no custom fields — what a surface without an org resolves to. */\nexport const COMPANY_IMPORT_VOCABULARY = companyImportVocabulary([])\n\nexport interface CompanyImportDrawerProps {\n open: boolean\n onClose: () => void\n /** The site the file is filed under, or `null` at the organization level (AGL-2630). */\n hostId: string | null\n /** The org, for the company field definitions the mapping offers (AGL-2661). */\n org?: ConsolePluginPageProps['org']\n}\n\nexport function CompanyImportDrawer(props: CompanyImportDrawerProps) {\n const { open, onClose, hostId, org } = props\n // The org's company fields, read only while the drawer is open.\n const { orgId } = useCrmScope({ hostId, org })\n const { active } = useContactFieldDefinitions(open ? orgId : null, 'company')\n const vocabulary = useMemo(() => companyImportVocabulary(active), [active])\n return (\n <CsvImportDrawer\n open={open}\n onClose={onClose}\n hostId={hostId}\n vocabulary={vocabulary}\n />\n )\n}\nCompanyImportDrawer.displayName = 'CompanyImportDrawer'\n\n/** The \"Import CSV\" action on the companies list, with the drawer it opens. */\nexport function CompanyImportButton(props: {\n hostId: string | null\n org?: ConsolePluginPageProps['org']\n}) {\n const { hostId, org } = props\n return (\n <CsvImportButton>\n {(open, onClose) => (\n <CompanyImportDrawer open={open} onClose={onClose} hostId={hostId} org={org} />\n )}\n </CsvImportButton>\n )\n}\nCompanyImportButton.displayName = 'CompanyImportButton'\n\nexport default CompanyImportDrawer\n"],"names":["pluginDocsHelp","COMPANY_IMPORT_CHUNK_SIZE","COMPANY_IMPORT_FIELD_LABELS","COMPANY_IMPORT_FIELDS","COMPANY_IMPORT_MAX_ROWS","COMPANY_IMPORT_PREVIEW_ROWS","COMPANY_IMPORT_SKIP_LABELS","companyImportSkippedCsv","emptyCompanyImportResult","guessCompanyImportMapping","mapCompanyImportRow","mergeCompanyImportResults","useMemo","useContactFieldDefinitions","useCrmScope","companyImportTemplateCsv","CsvImportButton","CsvImportDrawer","COMPANIES_IMPORT_URL","companyImportVocabulary","fields","title","collection","help","anchor","sitePickerHelperText","intro","toLocaleString","fieldLabels","customFields","requiredField","requiredWarning","unusableNotice","count","total","guessMapping","columns","mapRow","cells","mapping","route","maxRows","chunkSize","previewRows","emptyResult","mergeResults","skipLabels","skippedCsv","skippedFileName","templateCsv","templateFileName","COMPANY_IMPORT_VOCABULARY","CompanyImportDrawer","props","open","onClose","hostId","org","orgId","active","vocabulary","displayName","CompanyImportButton"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA;;;;;;;;;CASC,GAED,SAGEA,cAAc,QACT,eAAc;AACrB,SACEC,yBAAyB,EACzBC,2BAA2B,EAC3BC,qBAAqB,EACrBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,0BAA0B,EAI1BC,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,EACzBC,mBAAmB,EACnBC,yBAAyB,QACpB,iCAA6B;AACpC,SAASC,OAAO,QAAQ,QAAO;AAC/B,SAASC,0BAA0B,QAAQ,4CAAwC;AACnF,SAASC,WAAW,QAAQ,4BAAwB;AACpD,SAASC,wBAAwB,QAAQ,4BAAwB;AACjE,SACEC,eAAe,EACfC,eAAe,QAEV,yBAAqB;AAE5B,kEAAkE,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AGlB;AACAR,oBAAoBS,WAAW,GAAG;AAElC,6EAA6E,GAC7E,OAAO,SAASC,oBAAoBT,KAGnC;IACC,MAAM,EAAEG,MAAM,EAAEC,GAAG,EAAE,GAAGJ;IACxB,qBACE,KAACrC;kBACE,CAACsC,MAAMC,wBACN,KAACH;gBAAoBE,MAAMA;gBAAMC,SAASA;gBAASC,QAAQA;gBAAQC,KAAKA;;;AAIhF;AACAK,oBAAoBD,WAAW,GAAG;AAElC,eAAeT,oBAAmB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type AglynOrgBilling } from '@aglyn/aglyn';
|
|
2
|
+
import { type CompanyOption, suggestCompanyForEmail } from '../model/companies';
|
|
3
|
+
export { suggestCompanyForEmail, type CompanyOption };
|
|
4
|
+
/**
|
|
5
|
+
* How many companies the picker lists.
|
|
6
|
+
*
|
|
7
|
+
* A ceiling and not a page: somebody choosing a company knows which one, and
|
|
8
|
+
* a workspace past two hundred accounts finds it from the company list's own
|
|
9
|
+
* search and links the person from there. Bounded because this read happens
|
|
10
|
+
* on a contact's page, where the company list is a control and not the
|
|
11
|
+
* subject.
|
|
12
|
+
*/
|
|
13
|
+
export declare const COMPANY_OPTIONS_LIMIT = 200;
|
|
14
|
+
export interface CompanyOptions {
|
|
15
|
+
options: CompanyOption[];
|
|
16
|
+
/** The listen has answered at least once. */
|
|
17
|
+
ready: boolean;
|
|
18
|
+
/** The ceiling cut the list, so a company can exist and not be offered. */
|
|
19
|
+
truncated: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The companies this viewer may link a contact to, alphabetically
|
|
23
|
+
* (AGL-2597).
|
|
24
|
+
*
|
|
25
|
+
* Read under the same `visibleTo` predicate the company list runs, because
|
|
26
|
+
* the rules refuse a listen without it for a scoped member — and because a
|
|
27
|
+
* picker offering a company the reader could not open would let them file a
|
|
28
|
+
* person under a record they cannot see. Ordered by `nameLower`, the key
|
|
29
|
+
* every company write stores, so the picker reads as a list of names rather
|
|
30
|
+
* than as document-id order dressed up.
|
|
31
|
+
*
|
|
32
|
+
* `enabled` gates the listen: a contact's properties card has one picker and
|
|
33
|
+
* a merchant who opened the record to read a note must not pay for the
|
|
34
|
+
* company list.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useCompanyOptions(props: {
|
|
37
|
+
/** The site whose console is reading, or `null` at the organization level. */
|
|
38
|
+
hostId: string | null;
|
|
39
|
+
org?: Partial<AglynOrgBilling> | null;
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
}): CompanyOptions;
|
|
42
|
+
/**
|
|
43
|
+
* Create a company by name, answering the option the picker then selects.
|
|
44
|
+
* Rejects with the sentence to show when the name cannot be stored.
|
|
45
|
+
*/
|
|
46
|
+
export type CreateCompany = (name: string) => Promise<CompanyOption>;
|
|
47
|
+
/**
|
|
48
|
+
* The write behind "Create “Acme”" in the picker (AGL-2613).
|
|
49
|
+
*
|
|
50
|
+
* The same document the company drawer writes for a create — the search
|
|
51
|
+
* keys, the scope every CRM creator stamps, the provenance — with only the
|
|
52
|
+
* name filled in, because that is all the picker asked for: the domain, the
|
|
53
|
+
* address and the rest are the company page's to add. The person filing it
|
|
54
|
+
* owns it, as the drawer seeds too. `null` until the org has resolved, so a
|
|
55
|
+
* picker offered before the scope is known offers no create.
|
|
56
|
+
*
|
|
57
|
+
* A company is a record of the band the drawers refuse on (AGL-2644): an
|
|
58
|
+
* org at a full hard band is refused here with the drawers' sentence, and
|
|
59
|
+
* the picker shows it beneath the field the way it shows any create that
|
|
60
|
+
* failed. Measured on the click and not on the mount — see
|
|
61
|
+
* `readCrmRecordsQuota` — and never for an edit, because linking an
|
|
62
|
+
* existing company adds no record.
|
|
63
|
+
*/
|
|
64
|
+
export declare function useCreateCompany(props: {
|
|
65
|
+
/** The site whose console is creating, or `null` at the organization level. */
|
|
66
|
+
hostId: string | null;
|
|
67
|
+
org?: Partial<AglynOrgBilling> | null;
|
|
68
|
+
}): CreateCompany | null;
|
|
69
|
+
export interface CompanyPickerProps {
|
|
70
|
+
options: readonly CompanyOption[];
|
|
71
|
+
/** The linked company's id, or `null` for none. */
|
|
72
|
+
value: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* The choice, with the option behind it when the list — or a create — can
|
|
75
|
+
* name it, so a caller can echo the company's name onto the contact
|
|
76
|
+
* without a second lookup. `null` for a company the list does not carry.
|
|
77
|
+
*/
|
|
78
|
+
onChange: (companyId: string | null, company: CompanyOption | null) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Create a company from the typed name and select it. Absent — or `null`
|
|
81
|
+
* while the scope is unresolved — the picker offers no create row.
|
|
82
|
+
*/
|
|
83
|
+
onCreate?: CreateCompany | null;
|
|
84
|
+
label?: string;
|
|
85
|
+
helperText?: string;
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The contact's email address, when the caller has one. A company whose
|
|
89
|
+
* domain matches it is offered as a suggestion beneath the field — a
|
|
90
|
+
* suggestion and never an automatic link, because the person who typed
|
|
91
|
+
* `@acme.com` may be a contractor, a customer of Acme's, or Acme itself.
|
|
92
|
+
*/
|
|
93
|
+
email?: string | null;
|
|
94
|
+
/**
|
|
95
|
+
* The company name the record carries as free text while no company is
|
|
96
|
+
* linked — an import, or a save from before the picker existed. Offered
|
|
97
|
+
* beneath the field as the company to link or create, so the label a
|
|
98
|
+
* merchant already typed is one click from becoming the record it names.
|
|
99
|
+
*/
|
|
100
|
+
fallbackName?: string | null;
|
|
101
|
+
/** The option list has answered; until then the field says it is loading. */
|
|
102
|
+
ready?: boolean;
|
|
103
|
+
/** The list was cut at the ceiling, so the field says to narrow by typing. */
|
|
104
|
+
truncated?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* One company, chosen from the list a contact may be filed under
|
|
108
|
+
* (AGL-2597, AGL-2613).
|
|
109
|
+
*
|
|
110
|
+
* A search over the loaded list rather than free text, because the value is
|
|
111
|
+
* a document id and a typed name is how two records called "Acme" come to
|
|
112
|
+
* exist. Typing narrows by name and domain; a name nothing matches grows the
|
|
113
|
+
* list by one row, "Create “…”", which writes the company and selects it —
|
|
114
|
+
* so the person filing a contact never has to leave the form to make the
|
|
115
|
+
* account it belongs to. The clear control is the unlink: a saved contact
|
|
116
|
+
* with no company reads as a decision rather than a field somebody skipped.
|
|
117
|
+
*
|
|
118
|
+
* A stored id the list does not carry — a company past the picker's ceiling,
|
|
119
|
+
* or one this viewer cannot see — still renders as SOMETHING selected, or
|
|
120
|
+
* the field would read empty for a contact that has a company and the next
|
|
121
|
+
* save would silently unlink them.
|
|
122
|
+
*/
|
|
123
|
+
export declare function CompanyPicker(props: CompanyPickerProps): import("react").JSX.Element;
|
|
124
|
+
export declare namespace CompanyPicker {
|
|
125
|
+
var displayName: string;
|
|
126
|
+
}
|
|
127
|
+
export default CompanyPicker;
|
|
@@ -0,0 +1,323 @@
|
|
|
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 { createResourceUid, CRM_COLLECTIONS, CRM_RECORDS_BAND_FULL_MESSAGE } from "@aglyn/aglyn";
|
|
20
|
+
import { useFirestore, useFirestoreCollection, useUser } from "@aglyn/tenant-feature-instance";
|
|
21
|
+
import { Autocomplete, Button, createFilterOptions, Stack, TextField, Typography } from "@mui/material";
|
|
22
|
+
import { collection, doc, limit, orderBy, query, serverTimestamp, setDoc } from "firebase/firestore";
|
|
23
|
+
import { useCallback, useMemo, useState } from "react";
|
|
24
|
+
import { readCrmRecordsQuota } from "../hooks/use-crm-records-quota.js";
|
|
25
|
+
import { crmVisibleToClause, useCrmScope } from "../hooks/use-crm-scope.js";
|
|
26
|
+
import { companyDraftFields, EMPTY_COMPANY_DRAFT, suggestCompanyForEmail } from "../model/companies.js";
|
|
27
|
+
export { suggestCompanyForEmail };
|
|
28
|
+
/**
|
|
29
|
+
* How many companies the picker lists.
|
|
30
|
+
*
|
|
31
|
+
* A ceiling and not a page: somebody choosing a company knows which one, and
|
|
32
|
+
* a workspace past two hundred accounts finds it from the company list's own
|
|
33
|
+
* search and links the person from there. Bounded because this read happens
|
|
34
|
+
* on a contact's page, where the company list is a control and not the
|
|
35
|
+
* subject.
|
|
36
|
+
*/ export const COMPANY_OPTIONS_LIMIT = 200;
|
|
37
|
+
/**
|
|
38
|
+
* The companies this viewer may link a contact to, alphabetically
|
|
39
|
+
* (AGL-2597).
|
|
40
|
+
*
|
|
41
|
+
* Read under the same `visibleTo` predicate the company list runs, because
|
|
42
|
+
* the rules refuse a listen without it for a scoped member — and because a
|
|
43
|
+
* picker offering a company the reader could not open would let them file a
|
|
44
|
+
* person under a record they cannot see. Ordered by `nameLower`, the key
|
|
45
|
+
* every company write stores, so the picker reads as a list of names rather
|
|
46
|
+
* than as document-id order dressed up.
|
|
47
|
+
*
|
|
48
|
+
* `enabled` gates the listen: a contact's properties card has one picker and
|
|
49
|
+
* a merchant who opened the record to read a note must not pay for the
|
|
50
|
+
* company list.
|
|
51
|
+
*/ export function useCompanyOptions(props) {
|
|
52
|
+
var _ref;
|
|
53
|
+
const { hostId, org, enabled = true } = props;
|
|
54
|
+
const firestore = useFirestore();
|
|
55
|
+
const { scope, visibleTo } = useCrmScope({
|
|
56
|
+
hostId,
|
|
57
|
+
org
|
|
58
|
+
});
|
|
59
|
+
const { data, status } = useFirestoreCollection(()=>enabled && scope ? query(collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.companies), ...crmVisibleToClause(visibleTo), orderBy('nameLower'), limit(COMPANY_OPTIONS_LIMIT + 1)) : null, [
|
|
60
|
+
firestore,
|
|
61
|
+
scope,
|
|
62
|
+
visibleTo,
|
|
63
|
+
enabled
|
|
64
|
+
], {
|
|
65
|
+
idField: '$id'
|
|
66
|
+
});
|
|
67
|
+
const options = useMemo(()=>(data != null ? data : []).slice(0, COMPANY_OPTIONS_LIMIT).map((row)=>{
|
|
68
|
+
var _row_name;
|
|
69
|
+
return {
|
|
70
|
+
id: String(row['$id']),
|
|
71
|
+
name: String((_row_name = row['name']) != null ? _row_name : ''),
|
|
72
|
+
domain: typeof row['domain'] === 'string' ? row['domain'] : null
|
|
73
|
+
};
|
|
74
|
+
}), [
|
|
75
|
+
data
|
|
76
|
+
]);
|
|
77
|
+
return {
|
|
78
|
+
options,
|
|
79
|
+
ready: Boolean(scope) && status !== 'loading',
|
|
80
|
+
truncated: ((_ref = data == null ? void 0 : data.length) != null ? _ref : 0) > COMPANY_OPTIONS_LIMIT
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The write behind "Create “Acme”" in the picker (AGL-2613).
|
|
85
|
+
*
|
|
86
|
+
* The same document the company drawer writes for a create — the search
|
|
87
|
+
* keys, the scope every CRM creator stamps, the provenance — with only the
|
|
88
|
+
* name filled in, because that is all the picker asked for: the domain, the
|
|
89
|
+
* address and the rest are the company page's to add. The person filing it
|
|
90
|
+
* owns it, as the drawer seeds too. `null` until the org has resolved, so a
|
|
91
|
+
* picker offered before the scope is known offers no create.
|
|
92
|
+
*
|
|
93
|
+
* A company is a record of the band the drawers refuse on (AGL-2644): an
|
|
94
|
+
* org at a full hard band is refused here with the drawers' sentence, and
|
|
95
|
+
* the picker shows it beneath the field the way it shows any create that
|
|
96
|
+
* failed. Measured on the click and not on the mount — see
|
|
97
|
+
* `readCrmRecordsQuota` — and never for an edit, because linking an
|
|
98
|
+
* existing company adds no record.
|
|
99
|
+
*/ export function useCreateCompany(props) {
|
|
100
|
+
var _ref;
|
|
101
|
+
const { hostId, org } = props;
|
|
102
|
+
const firestore = useFirestore();
|
|
103
|
+
const { data: user } = useUser();
|
|
104
|
+
// The provenance and the scope both come from the site the record is
|
|
105
|
+
// captured by — the mounted one, or at the organization level the one the
|
|
106
|
+
// reader picked (AGL-2630). No site picked, no create offered.
|
|
107
|
+
const { scope, createTokens, createHostId } = useCrmScope({
|
|
108
|
+
hostId,
|
|
109
|
+
org
|
|
110
|
+
});
|
|
111
|
+
const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : '';
|
|
112
|
+
return useMemo(()=>{
|
|
113
|
+
if (!scope || !createHostId) return null;
|
|
114
|
+
return async (name)=>{
|
|
115
|
+
const result = companyDraftFields(_extends({}, EMPTY_COMPANY_DRAFT, {
|
|
116
|
+
name,
|
|
117
|
+
ownerUid: uid
|
|
118
|
+
}));
|
|
119
|
+
if (result.ok === false) throw new Error(result.error);
|
|
120
|
+
const quota = await readCrmRecordsQuota(firestore, scope, org);
|
|
121
|
+
if (!quota.allowed) throw new Error(CRM_RECORDS_BAND_FULL_MESSAGE);
|
|
122
|
+
const id = createResourceUid();
|
|
123
|
+
await setDoc(doc(firestore, scope[0], scope[1], CRM_COLLECTIONS.companies, id), _extends({}, result.set, {
|
|
124
|
+
visibleTo: [
|
|
125
|
+
...createTokens
|
|
126
|
+
],
|
|
127
|
+
hostId: createHostId,
|
|
128
|
+
createdByUid: uid,
|
|
129
|
+
createdAt: serverTimestamp(),
|
|
130
|
+
updatedAt: serverTimestamp()
|
|
131
|
+
}));
|
|
132
|
+
return {
|
|
133
|
+
id,
|
|
134
|
+
name: String(result.set['name']),
|
|
135
|
+
domain: null
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
}, [
|
|
139
|
+
scope,
|
|
140
|
+
createTokens,
|
|
141
|
+
firestore,
|
|
142
|
+
createHostId,
|
|
143
|
+
uid,
|
|
144
|
+
org
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
147
|
+
/** The sentinel id of the "Create …" row the list grows when nothing matches. */ const CREATE_OPTION_ID = '__create__';
|
|
148
|
+
const isCreateOption = (option)=>'create' in option;
|
|
149
|
+
const filterCompanies = createFilterOptions({
|
|
150
|
+
stringify: (option)=>isCreateOption(option) ? option.create : option.domain ? `${option.name} ${option.domain}` : option.name
|
|
151
|
+
});
|
|
152
|
+
const optionLabel = (option)=>isCreateOption(option) ? `Create “${option.create}”` : option.domain ? `${option.name} · ${option.domain}` : option.name;
|
|
153
|
+
/**
|
|
154
|
+
* One company, chosen from the list a contact may be filed under
|
|
155
|
+
* (AGL-2597, AGL-2613).
|
|
156
|
+
*
|
|
157
|
+
* A search over the loaded list rather than free text, because the value is
|
|
158
|
+
* a document id and a typed name is how two records called "Acme" come to
|
|
159
|
+
* exist. Typing narrows by name and domain; a name nothing matches grows the
|
|
160
|
+
* list by one row, "Create “…”", which writes the company and selects it —
|
|
161
|
+
* so the person filing a contact never has to leave the form to make the
|
|
162
|
+
* account it belongs to. The clear control is the unlink: a saved contact
|
|
163
|
+
* with no company reads as a decision rather than a field somebody skipped.
|
|
164
|
+
*
|
|
165
|
+
* A stored id the list does not carry — a company past the picker's ceiling,
|
|
166
|
+
* or one this viewer cannot see — still renders as SOMETHING selected, or
|
|
167
|
+
* the field would read empty for a contact that has a company and the next
|
|
168
|
+
* save would silently unlink them.
|
|
169
|
+
*/ export function CompanyPicker(props) {
|
|
170
|
+
const { options, value, onChange, onCreate, label = 'Company', helperText, disabled, email, fallbackName, ready = true, truncated } = props;
|
|
171
|
+
const [creating, setCreating] = useState(false);
|
|
172
|
+
const [createError, setCreateError] = useState('');
|
|
173
|
+
const suggestion = useMemo(()=>email ? suggestCompanyForEmail(email, options) : null, [
|
|
174
|
+
email,
|
|
175
|
+
options
|
|
176
|
+
]);
|
|
177
|
+
const fallback = useMemo(()=>{
|
|
178
|
+
var _options_find;
|
|
179
|
+
const name = String(fallbackName != null ? fallbackName : '').trim();
|
|
180
|
+
if (value || !name) return null;
|
|
181
|
+
const lower = name.toLowerCase();
|
|
182
|
+
return {
|
|
183
|
+
name,
|
|
184
|
+
match: (_options_find = options.find((option)=>option.name.trim().toLowerCase() === lower)) != null ? _options_find : null
|
|
185
|
+
};
|
|
186
|
+
}, [
|
|
187
|
+
fallbackName,
|
|
188
|
+
options,
|
|
189
|
+
value
|
|
190
|
+
]);
|
|
191
|
+
const selected = useMemo(()=>{
|
|
192
|
+
var _options_find;
|
|
193
|
+
if (!value) return null;
|
|
194
|
+
return (_options_find = options.find((option)=>option.id === value)) != null ? _options_find : {
|
|
195
|
+
id: value,
|
|
196
|
+
name: `Company ${value.slice(-6)}`,
|
|
197
|
+
domain: null
|
|
198
|
+
};
|
|
199
|
+
}, [
|
|
200
|
+
options,
|
|
201
|
+
value
|
|
202
|
+
]);
|
|
203
|
+
/*
|
|
204
|
+
* The list the control searches: every option, plus the placeholder for a
|
|
205
|
+
* stored id the list does not carry, so the selected value is always one
|
|
206
|
+
* of the options and the control never reports it as invalid.
|
|
207
|
+
*/ const listed = useMemo(()=>selected && !options.some((option)=>option.id === selected.id) ? [
|
|
208
|
+
selected,
|
|
209
|
+
...options
|
|
210
|
+
] : [
|
|
211
|
+
...options
|
|
212
|
+
], [
|
|
213
|
+
options,
|
|
214
|
+
selected
|
|
215
|
+
]);
|
|
216
|
+
const create = useCallback(async (name)=>{
|
|
217
|
+
if (!onCreate) return;
|
|
218
|
+
setCreating(true);
|
|
219
|
+
setCreateError('');
|
|
220
|
+
try {
|
|
221
|
+
const company = await onCreate(name);
|
|
222
|
+
onChange(company.id, company);
|
|
223
|
+
} catch (error) {
|
|
224
|
+
setCreateError(error instanceof Error && error.message ? error.message : 'The company could not be created.');
|
|
225
|
+
} finally{
|
|
226
|
+
setCreating(false);
|
|
227
|
+
}
|
|
228
|
+
}, [
|
|
229
|
+
onCreate,
|
|
230
|
+
onChange
|
|
231
|
+
]);
|
|
232
|
+
const busy = disabled || !ready || creating;
|
|
233
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
234
|
+
spacing: 0.5,
|
|
235
|
+
children: [
|
|
236
|
+
/*#__PURE__*/ _jsx(Autocomplete, {
|
|
237
|
+
size: "small",
|
|
238
|
+
options: listed,
|
|
239
|
+
value: selected,
|
|
240
|
+
disabled: busy,
|
|
241
|
+
loading: !ready,
|
|
242
|
+
getOptionLabel: optionLabel,
|
|
243
|
+
isOptionEqualToValue: (option, current)=>option.id === current.id,
|
|
244
|
+
filterOptions: (candidates, state)=>{
|
|
245
|
+
const filtered = filterCompanies(candidates, state);
|
|
246
|
+
const typed = state.inputValue.trim();
|
|
247
|
+
const exact = typed.toLowerCase();
|
|
248
|
+
const named = candidates.some((option)=>!isCreateOption(option) && option.name.trim().toLowerCase() === exact);
|
|
249
|
+
if (onCreate && typed && !named) {
|
|
250
|
+
filtered.push({
|
|
251
|
+
id: CREATE_OPTION_ID,
|
|
252
|
+
name: typed,
|
|
253
|
+
create: typed
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
return filtered;
|
|
257
|
+
},
|
|
258
|
+
onChange: (_event, next)=>{
|
|
259
|
+
if (!next) return onChange(null, null);
|
|
260
|
+
if (isCreateOption(next)) return void create(next.create);
|
|
261
|
+
onChange(next.id, next);
|
|
262
|
+
},
|
|
263
|
+
renderInput: (params)=>/*#__PURE__*/ _jsx(TextField, _extends({}, params, {
|
|
264
|
+
label: label,
|
|
265
|
+
error: Boolean(createError),
|
|
266
|
+
helperText: !ready ? 'Loading companies…' : creating ? 'Creating the company…' : createError || helperText || (truncated ? `The first ${COMPANY_OPTIONS_LIMIT} by name — type to narrow, or create one.` : undefined)
|
|
267
|
+
}))
|
|
268
|
+
}),
|
|
269
|
+
suggestion && suggestion.id !== value ? /*#__PURE__*/ _jsxs(Stack, {
|
|
270
|
+
direction: "row",
|
|
271
|
+
spacing: 1,
|
|
272
|
+
sx: {
|
|
273
|
+
alignItems: 'center'
|
|
274
|
+
},
|
|
275
|
+
children: [
|
|
276
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
277
|
+
variant: "caption",
|
|
278
|
+
color: "text.secondary",
|
|
279
|
+
children: `Suggested from the email address: ${suggestion.name}`
|
|
280
|
+
}),
|
|
281
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
282
|
+
size: "small",
|
|
283
|
+
disabled: busy,
|
|
284
|
+
onClick: ()=>onChange(suggestion.id, suggestion),
|
|
285
|
+
children: 'Use'
|
|
286
|
+
})
|
|
287
|
+
]
|
|
288
|
+
}) : fallback ? /*#__PURE__*/ _jsxs(Stack, {
|
|
289
|
+
direction: "row",
|
|
290
|
+
spacing: 1,
|
|
291
|
+
sx: {
|
|
292
|
+
alignItems: 'center'
|
|
293
|
+
},
|
|
294
|
+
children: [
|
|
295
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
296
|
+
variant: "caption",
|
|
297
|
+
color: "text.secondary",
|
|
298
|
+
children: fallback.match ? `Recorded as “${fallback.name}” — a company by that name exists.` : `Recorded as “${fallback.name}” without a link.`
|
|
299
|
+
}),
|
|
300
|
+
fallback.match ? /*#__PURE__*/ _jsx(Button, {
|
|
301
|
+
size: "small",
|
|
302
|
+
disabled: busy,
|
|
303
|
+
onClick: ()=>{
|
|
304
|
+
var _ref;
|
|
305
|
+
var _fallback_match;
|
|
306
|
+
return onChange((_ref = (_fallback_match = fallback.match) == null ? void 0 : _fallback_match.id) != null ? _ref : null, fallback.match);
|
|
307
|
+
},
|
|
308
|
+
children: 'Use'
|
|
309
|
+
}) : onCreate ? /*#__PURE__*/ _jsx(Button, {
|
|
310
|
+
size: "small",
|
|
311
|
+
disabled: busy,
|
|
312
|
+
onClick: ()=>void create(fallback.name),
|
|
313
|
+
children: `Create “${fallback.name}”`
|
|
314
|
+
}) : null
|
|
315
|
+
]
|
|
316
|
+
}) : null
|
|
317
|
+
]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
CompanyPicker.displayName = 'CompanyPicker';
|
|
321
|
+
export default CompanyPicker;
|
|
322
|
+
|
|
323
|
+
//# sourceMappingURL=company-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/company-picker.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport {\n type AglynOrgBilling,\n createResourceUid,\n CRM_COLLECTIONS,\n CRM_RECORDS_BAND_FULL_MESSAGE,\n} from '@aglyn/aglyn'\nimport {\n useFirestore,\n useFirestoreCollection,\n useUser,\n} from '@aglyn/tenant-feature-instance'\nimport {\n Autocomplete,\n Button,\n createFilterOptions,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n doc,\n limit,\n orderBy,\n query,\n serverTimestamp,\n setDoc,\n where,\n} from 'firebase/firestore'\nimport { useCallback, useMemo, useState } from 'react'\nimport { readCrmRecordsQuota } from '../hooks/use-crm-records-quota'\nimport { crmVisibleToClause, useCrmScope } from '../hooks/use-crm-scope'\nimport {\n type CompanyOption,\n companyDraftFields,\n EMPTY_COMPANY_DRAFT,\n suggestCompanyForEmail,\n} from '../model/companies'\n\nexport { suggestCompanyForEmail, type CompanyOption }\n\n/**\n * How many companies the picker lists.\n *\n * A ceiling and not a page: somebody choosing a company knows which one, and\n * a workspace past two hundred accounts finds it from the company list's own\n * search and links the person from there. Bounded because this read happens\n * on a contact's page, where the company list is a control and not the\n * subject.\n */\nexport const COMPANY_OPTIONS_LIMIT = 200\n\nexport interface CompanyOptions {\n options: CompanyOption[]\n /** The listen has answered at least once. */\n ready: boolean\n /** The ceiling cut the list, so a company can exist and not be offered. */\n truncated: boolean\n}\n\n/**\n * The companies this viewer may link a contact to, alphabetically\n * (AGL-2597).\n *\n * Read under the same `visibleTo` predicate the company list runs, because\n * the rules refuse a listen without it for a scoped member — and because a\n * picker offering a company the reader could not open would let them file a\n * person under a record they cannot see. Ordered by `nameLower`, the key\n * every company write stores, so the picker reads as a list of names rather\n * than as document-id order dressed up.\n *\n * `enabled` gates the listen: a contact's properties card has one picker and\n * a merchant who opened the record to read a note must not pay for the\n * company list.\n */\nexport function useCompanyOptions(props: {\n /** The site whose console is reading, or `null` at the organization level. */\n hostId: string | null\n org?: Partial<AglynOrgBilling> | null\n enabled?: boolean\n}): CompanyOptions {\n const { hostId, org, enabled = true } = props\n const firestore = useFirestore()\n const { scope, visibleTo } = useCrmScope({ hostId, org })\n const { data, status } = useFirestoreCollection<Record<string, unknown>>(\n () =>\n enabled && scope\n ? query(\n collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.companies),\n ...crmVisibleToClause(visibleTo),\n orderBy('nameLower'),\n limit(COMPANY_OPTIONS_LIMIT + 1),\n )\n : null,\n [firestore, scope, visibleTo, enabled],\n { idField: '$id' },\n )\n const options = useMemo<CompanyOption[]>(\n () =>\n (data ?? []).slice(0, COMPANY_OPTIONS_LIMIT).map((row) => ({\n id: String(row['$id']),\n name: String(row['name'] ?? ''),\n domain: typeof row['domain'] === 'string' ? row['domain'] : null,\n })),\n [data],\n )\n return {\n options,\n ready: Boolean(scope) && status !== 'loading',\n truncated: (data?.length ?? 0) > COMPANY_OPTIONS_LIMIT,\n }\n}\n\n/**\n * Create a company by name, answering the option the picker then selects.\n * Rejects with the sentence to show when the name cannot be stored.\n */\nexport type CreateCompany = (name: string) => Promise<CompanyOption>\n\n/**\n * The write behind \"Create “Acme”\" in the picker (AGL-2613).\n *\n * The same document the company drawer writes for a create — the search\n * keys, the scope every CRM creator stamps, the provenance — with only the\n * name filled in, because that is all the picker asked for: the domain, the\n * address and the rest are the company page's to add. The person filing it\n * owns it, as the drawer seeds too. `null` until the org has resolved, so a\n * picker offered before the scope is known offers no create.\n *\n * A company is a record of the band the drawers refuse on (AGL-2644): an\n * org at a full hard band is refused here with the drawers' sentence, and\n * the picker shows it beneath the field the way it shows any create that\n * failed. Measured on the click and not on the mount — see\n * `readCrmRecordsQuota` — and never for an edit, because linking an\n * existing company adds no record.\n */\nexport function useCreateCompany(props: {\n /** The site whose console is creating, or `null` at the organization level. */\n hostId: string | null\n org?: Partial<AglynOrgBilling> | null\n}): CreateCompany | null {\n const { hostId, org } = props\n const firestore = useFirestore()\n const { data: user } = useUser()\n // The provenance and the scope both come from the site the record is\n // captured by — the mounted one, or at the organization level the one the\n // reader picked (AGL-2630). No site picked, no create offered.\n const { scope, createTokens, createHostId } = useCrmScope({ hostId, org })\n const uid = user?.uid ?? ''\n return useMemo<CreateCompany | null>(() => {\n if (!scope || !createHostId) return null\n return async (name) => {\n const result = companyDraftFields({\n ...EMPTY_COMPANY_DRAFT,\n name,\n ownerUid: uid,\n })\n if (result.ok === false) throw new Error(result.error)\n const quota = await readCrmRecordsQuota(firestore, scope, org)\n if (!quota.allowed) throw new Error(CRM_RECORDS_BAND_FULL_MESSAGE)\n const id = createResourceUid()\n await setDoc(\n doc(firestore, scope[0], scope[1], CRM_COLLECTIONS.companies, id),\n {\n ...result.set,\n visibleTo: [...createTokens],\n hostId: createHostId,\n createdByUid: uid,\n createdAt: serverTimestamp(),\n updatedAt: serverTimestamp(),\n },\n )\n return { id, name: String(result.set['name']), domain: null }\n }\n }, [scope, createTokens, firestore, createHostId, uid, org])\n}\n\n/** The sentinel id of the \"Create …\" row the list grows when nothing matches. */\nconst CREATE_OPTION_ID = '__create__'\n\ntype PickerOption = CompanyOption | { id: typeof CREATE_OPTION_ID; name: string; create: string }\n\nconst isCreateOption = (\n option: PickerOption,\n): option is Extract<PickerOption, { create: string }> => 'create' in option\n\nconst filterCompanies = createFilterOptions<PickerOption>({\n stringify: (option) =>\n isCreateOption(option)\n ? option.create\n : option.domain\n ? `${option.name} ${option.domain}`\n : option.name,\n})\n\nconst optionLabel = (option: PickerOption): string =>\n isCreateOption(option)\n ? `Create “${option.create}”`\n : option.domain\n ? `${option.name} · ${option.domain}`\n : option.name\n\nexport interface CompanyPickerProps {\n options: readonly CompanyOption[]\n /** The linked company's id, or `null` for none. */\n value: string | null\n /**\n * The choice, with the option behind it when the list — or a create — can\n * name it, so a caller can echo the company's name onto the contact\n * without a second lookup. `null` for a company the list does not carry.\n */\n onChange: (companyId: string | null, company: CompanyOption | null) => void\n /**\n * Create a company from the typed name and select it. Absent — or `null`\n * while the scope is unresolved — the picker offers no create row.\n */\n onCreate?: CreateCompany | null\n label?: string\n helperText?: string\n disabled?: boolean\n /**\n * The contact's email address, when the caller has one. A company whose\n * domain matches it is offered as a suggestion beneath the field — a\n * suggestion and never an automatic link, because the person who typed\n * `@acme.com` may be a contractor, a customer of Acme's, or Acme itself.\n */\n email?: string | null\n /**\n * The company name the record carries as free text while no company is\n * linked — an import, or a save from before the picker existed. Offered\n * beneath the field as the company to link or create, so the label a\n * merchant already typed is one click from becoming the record it names.\n */\n fallbackName?: string | null\n /** The option list has answered; until then the field says it is loading. */\n ready?: boolean\n /** The list was cut at the ceiling, so the field says to narrow by typing. */\n truncated?: boolean\n}\n\n/**\n * One company, chosen from the list a contact may be filed under\n * (AGL-2597, AGL-2613).\n *\n * A search over the loaded list rather than free text, because the value is\n * a document id and a typed name is how two records called \"Acme\" come to\n * exist. Typing narrows by name and domain; a name nothing matches grows the\n * list by one row, \"Create “…”\", which writes the company and selects it —\n * so the person filing a contact never has to leave the form to make the\n * account it belongs to. The clear control is the unlink: a saved contact\n * with no company reads as a decision rather than a field somebody skipped.\n *\n * A stored id the list does not carry — a company past the picker's ceiling,\n * or one this viewer cannot see — still renders as SOMETHING selected, or\n * the field would read empty for a contact that has a company and the next\n * save would silently unlink them.\n */\nexport function CompanyPicker(props: CompanyPickerProps) {\n const {\n options,\n value,\n onChange,\n onCreate,\n label = 'Company',\n helperText,\n disabled,\n email,\n fallbackName,\n ready = true,\n truncated,\n } = props\n const [creating, setCreating] = useState(false)\n const [createError, setCreateError] = useState('')\n\n const suggestion = useMemo(\n () => (email ? suggestCompanyForEmail(email, options) : null),\n [email, options],\n )\n const fallback = useMemo(() => {\n const name = String(fallbackName ?? '').trim()\n if (value || !name) return null\n const lower = name.toLowerCase()\n return {\n name,\n match: options.find((option) => option.name.trim().toLowerCase() === lower) ?? null,\n }\n }, [fallbackName, options, value])\n\n const selected = useMemo<PickerOption | null>(() => {\n if (!value) return null\n return (\n options.find((option) => option.id === value) ?? {\n id: value,\n name: `Company ${value.slice(-6)}`,\n domain: null,\n }\n )\n }, [options, value])\n /*\n * The list the control searches: every option, plus the placeholder for a\n * stored id the list does not carry, so the selected value is always one\n * of the options and the control never reports it as invalid.\n */\n const listed = useMemo<PickerOption[]>(\n () =>\n selected && !options.some((option) => option.id === selected.id)\n ? [selected, ...options]\n : [...options],\n [options, selected],\n )\n\n const create = useCallback(\n async (name: string) => {\n if (!onCreate) return\n setCreating(true)\n setCreateError('')\n try {\n const company = await onCreate(name)\n onChange(company.id, company)\n } catch (error) {\n setCreateError(\n error instanceof Error && error.message\n ? error.message\n : 'The company could not be created.',\n )\n } finally {\n setCreating(false)\n }\n },\n [onCreate, onChange],\n )\n\n const busy = disabled || !ready || creating\n return (\n <Stack spacing={0.5}>\n <Autocomplete<PickerOption, false, false, false>\n size=\"small\"\n options={listed}\n value={selected}\n disabled={busy}\n loading={!ready}\n getOptionLabel={optionLabel}\n isOptionEqualToValue={(option, current) => option.id === current.id}\n filterOptions={(candidates, state) => {\n const filtered = filterCompanies(candidates, state)\n const typed = state.inputValue.trim()\n const exact = typed.toLowerCase()\n const named = candidates.some(\n (option) =>\n !isCreateOption(option) && option.name.trim().toLowerCase() === exact,\n )\n if (onCreate && typed && !named) {\n filtered.push({ id: CREATE_OPTION_ID, name: typed, create: typed })\n }\n return filtered\n }}\n onChange={(_event, next) => {\n if (!next) return onChange(null, null)\n if (isCreateOption(next)) return void create(next.create)\n onChange(next.id, next)\n }}\n renderInput={(params) => (\n <TextField\n {...params}\n label={label}\n error={Boolean(createError)}\n helperText={\n !ready\n ? 'Loading companies…'\n : creating\n ? 'Creating the company…'\n : createError ||\n helperText ||\n (truncated\n ? `The first ${COMPANY_OPTIONS_LIMIT} by name — type to narrow, or create one.`\n : undefined)\n }\n />\n )}\n />\n {suggestion && suggestion.id !== value ? (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`Suggested from the email address: ${suggestion.name}`}\n </Typography>\n <Button\n size=\"small\"\n disabled={busy}\n onClick={() => onChange(suggestion.id, suggestion)}\n >\n {'Use'}\n </Button>\n </Stack>\n ) : fallback ? (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {fallback.match\n ? `Recorded as “${fallback.name}” — a company by that name exists.`\n : `Recorded as “${fallback.name}” without a link.`}\n </Typography>\n {fallback.match ? (\n <Button\n size=\"small\"\n disabled={busy}\n onClick={() => onChange(fallback.match?.id ?? null, fallback.match)}\n >\n {'Use'}\n </Button>\n ) : onCreate ? (\n <Button size=\"small\" disabled={busy} onClick={() => void create(fallback.name)}>\n {`Create “${fallback.name}”`}\n </Button>\n ) : null}\n </Stack>\n ) : null}\n </Stack>\n )\n}\nCompanyPicker.displayName = 'CompanyPicker'\n\nexport default CompanyPicker\n"],"names":["createResourceUid","CRM_COLLECTIONS","CRM_RECORDS_BAND_FULL_MESSAGE","useFirestore","useFirestoreCollection","useUser","Autocomplete","Button","createFilterOptions","Stack","TextField","Typography","collection","doc","limit","orderBy","query","serverTimestamp","setDoc","useCallback","useMemo","useState","readCrmRecordsQuota","crmVisibleToClause","useCrmScope","companyDraftFields","EMPTY_COMPANY_DRAFT","suggestCompanyForEmail","COMPANY_OPTIONS_LIMIT","useCompanyOptions","props","hostId","org","enabled","firestore","scope","visibleTo","data","status","companies","idField","options","slice","map","row","id","String","name","domain","ready","Boolean","truncated","length","useCreateCompany","user","createTokens","createHostId","uid","result","ownerUid","ok","Error","error","quota","allowed","set","createdByUid","createdAt","updatedAt","CREATE_OPTION_ID","isCreateOption","option","filterCompanies","stringify","create","optionLabel","CompanyPicker","value","onChange","onCreate","label","helperText","disabled","email","fallbackName","creating","setCreating","createError","setCreateError","suggestion","fallback","trim","lower","toLowerCase","match","find","selected","listed","some","company","message","busy","spacing","size","loading","getOptionLabel","isOptionEqualToValue","current","filterOptions","candidates","state","filtered","typed","inputValue","exact","named","push","_event","next","renderInput","params","undefined","direction","sx","alignItems","variant","color","onClick","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAEEA,iBAAiB,EACjBC,eAAe,EACfC,6BAA6B,QACxB,eAAc;AACrB,SACEC,YAAY,EACZC,sBAAsB,EACtBC,OAAO,QACF,iCAAgC;AACvC,SACEC,YAAY,EACZC,MAAM,EACNC,mBAAmB,EACnBC,KAAK,EACLC,SAAS,EACTC,UAAU,QACL,gBAAe;AACtB,SACEC,UAAU,EACVC,GAAG,EACHC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,eAAe,EACfC,MAAM,QAED,qBAAoB;AAC3B,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACtD,SAASC,mBAAmB,QAAQ,oCAAgC;AACpE,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,4BAAwB;AACxE,SAEEC,kBAAkB,EAClBC,mBAAmB,EACnBC,sBAAsB,QACjB,wBAAoB;AAE3B,SAASA,sBAAsB,GAAsB;AAErD;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,IAAG;AAUxC;;;;;;;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B7C,EAAE,mBAAI,MAAM6C,SAASI,KAAK;;kCAEjE;yBAEDf,yBACF,KAACxE;wBAAOgG,MAAK;wBAAQrB,UAAUmB;wBAAM0B,SAAS,IAAM,KAAKrD,OAAOgB,SAAS3C,IAAI;kCAC1E,CAAC,QAAQ,EAAE2C,SAAS3C,IAAI,CAAC,CAAC,CAAC;yBAE5B;;iBAEJ;;;AAGV;AACA6B,cAAcoD,WAAW,GAAG;AAE5B,eAAepD,cAAa"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type AglynOrgBilling, type CrmCompany } from '@aglyn/aglyn';
|
|
2
|
+
import type { CrmScope } from '../hooks/use-crm-scope';
|
|
3
|
+
import type { OrgMemberOptions } from '../hooks/use-org-member-options';
|
|
4
|
+
import type { CrmRoutes } from '../model/crm-routes';
|
|
5
|
+
export interface CompanyPropertiesCardProps {
|
|
6
|
+
company: Partial<CrmCompany> & {
|
|
7
|
+
$id: string;
|
|
8
|
+
};
|
|
9
|
+
/** Whether the document the card holds is server-confirmed. */
|
|
10
|
+
seed: {
|
|
11
|
+
fromCache: boolean;
|
|
12
|
+
unreadable: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** The site the record is read under, or `null` at the organization level. */
|
|
15
|
+
hostId: string | null;
|
|
16
|
+
org?: Partial<AglynOrgBilling>;
|
|
17
|
+
crmScope: CrmScope;
|
|
18
|
+
members: OrgMemberOptions;
|
|
19
|
+
routes: CrmRoutes;
|
|
20
|
+
/** Called once the record is gone, so the page can leave it. */
|
|
21
|
+
onDeleted: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* WHAT A COMPANY IS: its fields, read off the one document the page holds,
|
|
25
|
+
* with the edit and the delete beside them (AGL-2597).
|
|
26
|
+
*
|
|
27
|
+
* ## Edit is the create drawer
|
|
28
|
+
*
|
|
29
|
+
* The same form the list creates with, opened on the record. One form means
|
|
30
|
+
* one set of refusals — a domain that is not a domain is refused the same
|
|
31
|
+
* way on day one and on a rename — and one place to add a field.
|
|
32
|
+
*
|
|
33
|
+
* ## Delete is a DETACH first
|
|
34
|
+
*
|
|
35
|
+
* `crm/company-delete` — the route the bulk bar calls per row as well —
|
|
36
|
+
* unlinks the contacts that name this company before removing it, bounded
|
|
37
|
+
* at {@link COMPANY_DETACH_LIMIT} per pass and honest past it: the company
|
|
38
|
+
* stands, and the person is told more remain. The unlink clears each
|
|
39
|
+
* holder's facet that named the company, which is the server's to write
|
|
40
|
+
* (AGL-2804). What this card adds is the confirm, the sentence for each
|
|
41
|
+
* outcome, and leaving the page once the record is gone.
|
|
42
|
+
*/
|
|
43
|
+
export declare function CompanyPropertiesCard(props: CompanyPropertiesCardProps): import("react").JSX.Element;
|
|
44
|
+
export declare namespace CompanyPropertiesCard {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
47
|
+
export default CompanyPropertiesCard;
|