@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/fields-section.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 CONTACT_FIELD_TYPE_LABELS,\n type ConsolePluginPageProps,\n createResourceUid,\n CRM_COLLECTIONS,\n CRM_FIELD_OBJECT_LABELS,\n CRM_FIELD_OBJECTS,\n type CrmFieldObject,\n isCrmFieldObject,\n newResourceScopeFields,\n ORG_SCOPE_TOKEN,\n pluginDocsHelp,\n} from '@aglyn/aglyn'\nimport EmptyStateComponent from '@aglyn/shared-ui-jsx/components/empty-state.component'\nimport {\n mdiArchiveArrowUpOutline,\n mdiArchiveOutline,\n mdiArrowDown,\n mdiArrowUp,\n mdiDeleteOutline,\n mdiPencilOutline,\n} from '@aglyn/shared-data-mdi'\nimport {\n CardDisplay,\n MdiIcon,\n SrOnly,\n useConfirmationContext,\n} from '@aglyn/shared-ui-jsx'\nimport RowActionsMenu, {\n type RowActionsMenuItem,\n} from '@aglyn/shared-ui-jsx/components/row-actions-menu.component'\nimport { ScrollTable } from '@aglyn/shared-ui-jsx/components/scroll-table.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n useFirestore,\n useUser,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport {\n Button,\n Chip,\n IconButton,\n Stack,\n Tab,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n Tabs,\n Typography,\n} from '@mui/material'\nimport {\n collection,\n deleteDoc,\n doc,\n setDoc,\n updateDoc,\n writeBatch,\n} from 'firebase/firestore'\nimport { useCallback, useState } from 'react'\nimport {\n type ContactFieldDefinitionDoc,\n useContactFieldDefinitions,\n} from '../hooks/use-contact-field-definitions'\nimport { useCrmScope } from '../hooks/use-crm-scope'\nimport ContactFieldDrawer, { type ContactFieldDraft } from './contact-field-drawer'\nimport { recomputeAllCrmNextActivity } from '../model/next-activity-api'\nimport { crmTaskCallScope } from '../model/task-routes'\n\nexport type ContactsFieldsSectionProps = Pick<ConsolePluginPageProps, 'hostId' | 'org'>\n\n/** What each tab says the fields are for, above its list. */\nconst OBJECT_INTRO: Record<CrmFieldObject, string> = {\n contact:\n 'The custom fields on a contact — text, number, date, choice, ' +\n 'checkbox or link. They show on every contact, as columns on the ' +\n 'list, and a form field can save into one.',\n company:\n 'The custom fields on a company. They show on every company’s page ' +\n 'and its edit form, as columns on the companies list, and a CSV ' +\n 'import can fill them.',\n deal:\n 'The custom fields on a deal. They show on every deal’s page and ' +\n 'its edit form, and as columns on the deals table.',\n}\n\n/** The noun each tab's empty state and captions use. */\nconst OBJECT_NOUN: Record<CrmFieldObject, string> = {\n contact: 'contact',\n company: 'company',\n deal: 'deal',\n}\n\n/**\n * `/crm/fields` — the custom fields a holder keeps on a person (AGL-2601),\n * and since AGL-2661 on a company and a deal too, one tab each.\n *\n * Definitions live in `orgs/{orgId}/contactFields`, one document per field,\n * and the VALUES live under each contact facet's `custom` keyed by the\n * definition's `key`. That split decides everything this section does:\n *\n * - A field is RETIRED, not deleted, while values may exist under it. A\n * retired field leaves every form and every column, but an export can\n * still read what was written, and a restore brings it back intact.\n * Delete is offered only on a retired field, because retiring is the step\n * where the author had to look at what they were losing.\n * - The KEY never changes. It is the map key every value sits under; a\n * rename is a new field and a retire.\n * - Order is a stored `order` on each document, moved with the arrows here,\n * and every reader sorts by it — the profile card, the columns, an export.\n *\n * ## What is NOT on this page\n *\n * How many contacts carry a value under each field. That count is a read of\n * every contact document in the org — the expensive-read shape this codebase\n * has a standing rule against — and it would be paid on every visit to a\n * settings page. The list says so rather than showing a number it cannot\n * afford to keep true.\n *\n * Definitions are ORG-WIDE (`visibleTo: ['org']`): a field is a fact about\n * how this business describes people, and every site in the org files\n * people into the same address book. `hostId` records which site defined it.\n */\nexport function ContactsFieldsSection(props: ContactsFieldsSectionProps) {\n const { hostId, org } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n // The org root from the one scope hook (AGL-2614), which also answers at\n // the organization level (AGL-2630). A definition is org-wide either way;\n // the defining site it records is the mounted one, or the picked one, or\n // none for a field defined over the whole org before any pick.\n const { scope, ready: scopeReady, createHostId } = useCrmScope({ hostId, org })\n const orgId = scope?.[1] ?? null\n /*\n * ONE TAB PER OBJECT (AGL-2661). The list, the drawer and every write\n * below are about the tab's object: the hook narrows the org's one\n * definition list to it, a new field is stamped with it, and the drawer\n * refuses a key only against the keys THIS object already uses — a\n * company and a contact may both define `region`.\n */\n const [object, setObject] = useState<CrmFieldObject>('contact')\n const { definitions, ready, fromCache } = useContactFieldDefinitions(orgId, object)\n const noun = OBJECT_NOUN[object]\n\n /*\n * MAINTENANCE: recompute every record's next activity (AGL-2661). The\n * figure is kept by every task write, so this is for the records written\n * before it existed and for whatever a write that could not reach the\n * route left behind. A console action rather than a script, because the\n * person who notices a stale column is the person who should be able to\n * fix it.\n */\n const { data: user } = useUser()\n const [recomputing, setRecomputing] = useState(false)\n const recomputeNextActivity = useCallback(async () => {\n const callScope = crmTaskCallScope(hostId, orgId)\n if (!callScope || recomputing) return\n const confirmed = await confirm({\n title: 'Recompute next activity?',\n description:\n 'Every contact, company and deal in this organization gets its ' +\n '\"Next activity\" recomputed from its open tasks. Safe to run any time; ' +\n 'it only rewrites a figure the task list already implies.',\n confirmationText: 'Recompute',\n })\n .then(() => true)\n .catch(() => false)\n if (!confirmed) return\n setRecomputing(true)\n try {\n const result = await recomputeAllCrmNextActivity(user, callScope)\n enqueueSnackbar(\n `Next activity recomputed: ${result.records.toLocaleString()} record${result.records === 1 ? '' : 's'} ` +\n `from ${(result.tasks ?? 0).toLocaleString()} open task${result.tasks === 1 ? '' : 's'}` +\n (result.truncated\n ? ' — the first batch of open tasks only; nothing stale was cleared'\n : ''),\n { variant: 'success' },\n )\n } catch (cause) {\n enqueueSnackbar(\n cause instanceof Error ? cause.message : 'The next activity could not be recomputed.',\n { variant: 'warning' },\n )\n } finally {\n setRecomputing(false)\n }\n }, [hostId, orgId, recomputing, confirm, user, enqueueSnackbar])\n\n const [drawerOpen, setDrawerOpen] = useState(false)\n const [editing, setEditing] = useState<ContactFieldDefinitionDoc | null>(null)\n const [busyId, setBusyId] = useState('')\n\n const fieldRef = useCallback(\n (id: string) => {\n if (!scope) throw new Error('a contact field needs an organization')\n return doc(firestore, scope[0], scope[1], CRM_COLLECTIONS.contactFields, id)\n },\n [firestore, scope],\n )\n\n const openCreate = useCallback(() => {\n setEditing(null)\n setDrawerOpen(true)\n }, [])\n const openEdit = useCallback((definition: ContactFieldDefinitionDoc) => {\n setEditing(definition)\n setDrawerOpen(true)\n }, [])\n\n /**\n * Create, or save the editable half of an existing field.\n *\n * On create the document carries everything a reader expects: the key,\n * an `order` past every existing one so it lands last, an explicit\n * `retiredAt: null` so a `where('retiredAt', '==', null)` can find it, the\n * defining site, and the org-wide scope stamp the rules require. On edit\n * only the label, the choices and the required flag move — the key and\n * the type are the drawer's disabled inputs, and this writer does not\n * take them either.\n */\n const handleSubmit = useCallback(\n async (draft: ContactFieldDraft) => {\n if (!scope) return\n const now = new Date()\n if (editing) {\n const verdict = await writeGuardedBySeed(\n { subject: 'field', fromCache },\n async () => {\n await updateDoc(fieldRef(editing.$id), {\n label: draft.label,\n ...(editing.type === 'select' ? { options: draft.options } : {}),\n required: draft.required,\n updatedAt: now,\n })\n },\n )\n if (!verdict.ok) {\n return void enqueueSnackbar(verdict.message, {\n variant: 'warning',\n persist: false,\n })\n }\n enqueueSnackbar('Field saved', { variant: 'success', persist: false })\n } else {\n const order =\n definitions.reduce(\n (highest, definition) => Math.max(highest, Number(definition.order) || 0),\n -1,\n ) + 1\n await setDoc(\n doc(\n collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.contactFields),\n createResourceUid(),\n ),\n {\n key: draft.key,\n label: draft.label,\n type: draft.type,\n ...(draft.type === 'select' ? { options: draft.options } : {}),\n required: draft.required,\n order,\n retiredAt: null,\n // Which record the field describes — the tab it was made on.\n object,\n hostId: createHostId,\n ...newResourceScopeFields([ORG_SCOPE_TOKEN]),\n createdAt: now,\n updatedAt: now,\n },\n )\n enqueueSnackbar(`Field \"${draft.label}\" added`, {\n variant: 'success',\n persist: false,\n })\n }\n setDrawerOpen(false)\n setEditing(null)\n },\n [scope, editing, fromCache, fieldRef, enqueueSnackbar, definitions, firestore, createHostId, object],\n )\n\n /**\n * Move a field one place up or down.\n *\n * Writes `order` as the POSITION for every row whose stored order is not\n * already its position, in one batch. Swapping two numbers would be enough\n * on a list whose orders are already distinct, and wrong on one where they\n * are not — every field created before this section existed carries the\n * same `order`, and a swap of two equal numbers moves nothing. Renumbering\n * what is out of place makes the first move on such a list also the one\n * that normalizes it, at the cost of a batch that is at most the list.\n */\n const move = useCallback(\n async (definition: ContactFieldDefinitionDoc, direction: -1 | 1) => {\n if (!scope || busyId) return\n const index = definitions.findIndex((entry) => entry.$id === definition.$id)\n const target = index + direction\n if (index < 0 || target < 0 || target >= definitions.length) return\n const next = [...definitions]\n next[index] = definitions[target]\n next[target] = definitions[index]\n setBusyId(definition.$id)\n try {\n const verdict = await writeGuardedBySeed(\n { subject: 'field order', fromCache },\n async () => {\n const batch = writeBatch(firestore)\n const now = new Date()\n next.forEach((entry, position) => {\n if (entry.order === position) return\n batch.update(fieldRef(entry.$id), { order: position, updatedAt: now })\n })\n await batch.commit()\n },\n )\n if (!verdict.ok) {\n enqueueSnackbar(verdict.message, { variant: 'warning', persist: false })\n }\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', { variant: 'error', allowDuplicate: true })\n } finally {\n setBusyId('')\n }\n },\n [scope, busyId, definitions, fromCache, firestore, fieldRef, enqueueSnackbar],\n )\n\n /**\n * Retire a field, or bring one back.\n *\n * Retiring is asked about because it takes a control off every contact\n * form and a column off the list; restoring is not, because it puts a\n * choice back and is undone by retiring again. Neither touches a value.\n */\n const toggleRetired = useCallback(\n async (definition: ContactFieldDefinitionDoc) => {\n if (!scope || busyId) return\n if (!definition.retiredAt) {\n const accepted = await confirm({\n title: `Retire “${definition.label}”?`,\n description:\n `It leaves every ${noun} form, column and form-field mapping. ` +\n 'Values already saved under it are kept and still export, and ' +\n 'you can restore the field at any time.',\n confirmationText: 'Retire',\n })\n // `confirm` resolves with no value and REJECTS on cancel, so gating\n // on the resolved value alone would always fall through.\n .then(() => true)\n .catch(() => false)\n if (!accepted) return\n }\n setBusyId(definition.$id)\n try {\n await updateDoc(fieldRef(definition.$id), {\n retiredAt: definition.retiredAt ? null : Date.now(),\n updatedAt: new Date(),\n })\n enqueueSnackbar(definition.retiredAt ? 'Field restored' : 'Field retired', {\n variant: 'success',\n persist: false,\n })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', { variant: 'error', allowDuplicate: true })\n } finally {\n setBusyId('')\n }\n },\n [scope, busyId, confirm, fieldRef, enqueueSnackbar, noun],\n )\n\n /**\n * Delete a RETIRED field's definition.\n *\n * The values under its key are not touched — they sit on contact documents\n * this page does not read — so what is destroyed is the ability to show\n * them anywhere. The dialog says exactly that, and the key stays taken for\n * as long as the list can see it, which after this write it cannot; a new\n * field with the same key would read the orphaned values back as its own.\n */\n const handleDelete = useCallback(\n async (definition: ContactFieldDefinitionDoc) => {\n if (!scope || busyId || !definition.retiredAt) return\n const accepted = await confirm({\n title: `Delete “${definition.label}”?`,\n description:\n 'The definition is removed for good. Values saved under its key ' +\n `(${definition.key}) stay on the ${noun}s that carry them but ` +\n 'nothing will show them again — and a new field created with the ' +\n 'same key would read them as its own.',\n confirmationText: 'Delete field',\n confirmationButtonProps: { color: 'error' },\n })\n .then(() => true)\n .catch(() => false)\n if (!accepted) return\n setBusyId(definition.$id)\n try {\n await deleteDoc(fieldRef(definition.$id))\n enqueueSnackbar('Field deleted', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', { variant: 'error', allowDuplicate: true })\n } finally {\n setBusyId('')\n }\n },\n [scope, busyId, confirm, fieldRef, enqueueSnackbar, noun],\n )\n\n const rowActions = (definition: ContactFieldDefinitionDoc): RowActionsMenuItem[] => [\n {\n key: 'edit',\n label: 'Edit field',\n icon: <MdiIcon path={mdiPencilOutline.path} size={0.8} />,\n onClick: () => openEdit(definition),\n },\n {\n key: 'retire',\n label: definition.retiredAt ? 'Restore' : 'Retire',\n icon: (\n <MdiIcon\n path={definition.retiredAt ? mdiArchiveArrowUpOutline.path : mdiArchiveOutline.path}\n size={0.8}\n />\n ),\n destructive: !definition.retiredAt,\n disabled: Boolean(busyId),\n disabledReason: busyId ? 'Another field is being saved' : undefined,\n onClick: () => void toggleRetired(definition),\n },\n ...(definition.retiredAt\n ? [\n {\n key: 'delete',\n label: 'Delete',\n icon: <MdiIcon path={mdiDeleteOutline.path} size={0.8} />,\n destructive: true,\n disabled: Boolean(busyId),\n disabledReason: busyId ? 'Another field is being saved' : undefined,\n onClick: () => void handleDelete(definition),\n } satisfies RowActionsMenuItem,\n ]\n : []),\n ]\n\n return (\n <CardDisplay\n header={'Fields'}\n help={pluginDocsHelp('contactFields', { anchor: '#define-a-field' })}\n contentGutterX\n contentGutterY\n contentBordered=\"all\"\n HeaderProps={{\n action: scope ? (\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'center' }}>\n <Button size=\"small\" onClick={() => void recomputeNextActivity()} disabled={recomputing}>\n {recomputing ? 'Recomputing…' : 'Recompute next activity'}\n </Button>\n <Button variant=\"contained\" onClick={openCreate}>\n {'New field'}\n </Button>\n </Stack>\n ) : null,\n }}\n >\n <Stack spacing={2}>\n <Tabs\n value={object}\n onChange={(_event, next) => {\n if (isCrmFieldObject(next)) setObject(next)\n }}\n aria-label=\"Fields by record\"\n >\n {CRM_FIELD_OBJECTS.map((entry) => (\n <Tab key={entry} value={entry} label={CRM_FIELD_OBJECT_LABELS[entry]} />\n ))}\n </Tabs>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`${OBJECT_INTRO[object]} Fields are shared across every site in this ` +\n 'organization, like the records themselves.'}\n </Typography>\n {scopeReady && !scope ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`This site has no organization, so it has no ${noun} fields.`}\n </Typography>\n ) : !ready ? null : definitions.length === 0 ? (\n <EmptyStateComponent\n label={`No custom ${noun} fields yet`}\n description={`A field you define here is kept on every ${noun} and shows on its page.`}\n action={\n scope ? (\n <Button variant=\"contained\" onClick={openCreate}>\n {'New field'}\n </Button>\n ) : undefined\n }\n />\n ) : (\n <ScrollTable size=\"small\">\n <TableHead>\n <TableRow>\n <TableCell sx={{ width: 96 }}>{'Order'}</TableCell>\n <TableCell>{'Field'}</TableCell>\n <TableCell>{'Key'}</TableCell>\n <TableCell>{'Type'}</TableCell>\n <TableCell>{'Required'}</TableCell>\n <TableCell align=\"right\" />\n </TableRow>\n </TableHead>\n <TableBody>\n {definitions.map((definition, index) => (\n <TableRow\n key={definition.$id}\n hover\n sx={definition.retiredAt ? { opacity: 0.6 } : undefined}\n >\n <TableCell>\n <Stack direction=\"row\" spacing={0}>\n <IconButton\n size=\"small\"\n disabled={index === 0 || Boolean(busyId)}\n onClick={() => void move(definition, -1)}\n >\n <MdiIcon path={mdiArrowUp.path} size={0.7} />\n <SrOnly>{`Move ${definition.label} up`}</SrOnly>\n </IconButton>\n <IconButton\n size=\"small\"\n disabled={index === definitions.length - 1 || Boolean(busyId)}\n onClick={() => void move(definition, 1)}\n >\n <MdiIcon path={mdiArrowDown.path} size={0.7} />\n <SrOnly>{`Move ${definition.label} down`}</SrOnly>\n </IconButton>\n </Stack>\n </TableCell>\n <TableCell>\n <Stack\n direction=\"row\"\n spacing={1}\n sx={{ flexWrap: 'wrap', alignItems: 'center' }}\n >\n <Typography variant=\"body2\">{definition.label}</Typography>\n {definition.retiredAt ? (\n <Chip size=\"small\" variant=\"outlined\" color=\"warning\" label=\"Retired\" />\n ) : null}\n </Stack>\n </TableCell>\n <TableCell>\n <Typography variant=\"body2\" color=\"text.secondary\" sx={{ fontFamily: 'monospace' }}>\n {definition.key}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body2\">\n {CONTACT_FIELD_TYPE_LABELS[definition.type] ?? definition.type}\n {definition.type === 'select' && definition.options?.length\n ? ` · ${definition.options.length} choices`\n : ''}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {definition.required ? 'Yes' : '—'}\n </Typography>\n </TableCell>\n <TableCell align=\"right\" sx={{ width: 56 }}>\n <RowActionsMenu label={definition.label} items={rowActions(definition)} />\n </TableCell>\n </TableRow>\n ))}\n </TableBody>\n </ScrollTable>\n )}\n {definitions.length ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`How many ${noun}s carry a value under each field is not ` +\n `counted — that would read every ${noun} in the organization ` +\n 'each time this page opened.'}\n </Typography>\n ) : null}\n </Stack>\n <ContactFieldDrawer\n open={drawerOpen}\n onClose={() => setDrawerOpen(false)}\n definition={editing}\n object={object}\n takenKeys={definitions.map((definition) => definition.key)}\n onSubmit={handleSubmit}\n />\n </CardDisplay>\n )\n}\nContactsFieldsSection.displayName = 'ContactsFieldsSection'\n\nexport default ContactsFieldsSection\n"],"names":["CONTACT_FIELD_TYPE_LABELS","createResourceUid","CRM_COLLECTIONS","CRM_FIELD_OBJECT_LABELS","CRM_FIELD_OBJECTS","isCrmFieldObject","newResourceScopeFields","ORG_SCOPE_TOKEN","pluginDocsHelp","EmptyStateComponent","mdiArchiveArrowUpOutline","mdiArchiveOutline","mdiArrowDown","mdiArrowUp","mdiDeleteOutline","mdiPencilOutline","CardDisplay","MdiIcon","SrOnly","useConfirmationContext","RowActionsMenu","ScrollTable","useSnackbar","useFirestore","useUser","writeGuardedBySeed","Button","Chip","IconButton","Stack","Tab","TableBody","TableCell","TableHead","TableRow","Tabs","Typography","collection","deleteDoc","doc","setDoc","updateDoc","writeBatch","useCallback","useState","useContactFieldDefinitions","useCrmScope","ContactFieldDrawer","recomputeAllCrmNextActivity","crmTaskCallScope","OBJECT_INTRO","contact","company","deal","OBJECT_NOUN","ContactsFieldsSection","props","hostId","org","firestore","enqueueSnackbar","confirm","scope","ready","scopeReady","createHostId","orgId","object","setObject","definitions","fromCache","noun","data","user","recomputing","setRecomputing","recomputeNextActivity","callScope","confirmed","title","description","confirmationText","then","catch","result","records","toLocaleString","tasks","truncated","variant","cause","Error","message","drawerOpen","setDrawerOpen","editing","setEditing","busyId","setBusyId","fieldRef","id","contactFields","openCreate","openEdit","definition","handleSubmit","draft","now","Date","verdict","subject","$id","label","type","options","required","updatedAt","ok","persist","order","reduce","highest","Math","max","Number","key","retiredAt","createdAt","move","direction","index","findIndex","entry","target","length","next","batch","forEach","position","update","commit","error","console","allowDuplicate","toggleRetired","accepted","handleDelete","confirmationButtonProps","color","rowActions","icon","path","size","onClick","destructive","disabled","Boolean","disabledReason","undefined","header","help","anchor","contentGutterX","contentGutterY","contentBordered","HeaderProps","action","spacing","sx","alignItems","value","onChange","_event","aria-label","map","width","align","hover","opacity","flexWrap","fontFamily","items","open","onClose","takenKeys","onSubmit","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SACEA,yBAAyB,EAEzBC,iBAAiB,EACjBC,eAAe,EACfC,uBAAuB,EACvBC,iBAAiB,EAEjBC,gBAAgB,EAChBC,sBAAsB,EACtBC,eAAe,EACfC,cAAc,QACT,eAAc;AACrB,OAAOC,yBAAyB,wDAAuD;AACvF,SACEC,wBAAwB,EACxBC,iBAAiB,EACjBC,YAAY,EACZC,UAAU,EACVC,gBAAgB,EAChBC,gBAAgB,QACX,yBAAwB;AAC/B,SACEC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,sBAAsB,QACjB,uBAAsB;AAC7B,OAAOC,oBAEA,6DAA4D;AACnE,SAASC,WAAW,QAAQ,yDAAwD;AACpF,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SACEC,YAAY,EACZC,OAAO,EACPC,kBAAkB,QACb,iCAAgC;AACvC,SACEC,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,KAAK,EACLC,GAAG,EACHC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,UAAU,QACL,gBAAe;AACtB,SACEC,UAAU,EACVC,SAAS,EACTC,GAAG,EACHC,MAAM,EACNC,SAAS,EACTC,UAAU,QACL,qBAAoB;AAC3B,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AAC7C,SAEEC,0BAA0B,QACrB,4CAAwC;AAC/C,SAASC,WAAW,QAAQ,4BAAwB;AACpD,OAAOC,wBAAoD,4BAAwB;AACnF,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AAG;gBACzD4D,UAAUhF;;;;AAIlB;AACAlD,sBAAsBmI,WAAW,GAAG;AAEpC,eAAenI,sBAAqB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type FormFieldDecl } from '@aglyn/aglyn';
|
|
2
|
+
export interface FormContactFieldsCardProps {
|
|
3
|
+
hostId: string;
|
|
4
|
+
formId: string;
|
|
5
|
+
/** The PUBLISHED declaration, as stored on the form document. */
|
|
6
|
+
fields: readonly FormFieldDecl[];
|
|
7
|
+
/** True while the form document is still being read. */
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Writes the declaration back. The form document is the forms plugin's, so
|
|
11
|
+
* its page does the write; this card decides what the array should be.
|
|
12
|
+
*/
|
|
13
|
+
saveFields: (fields: FormFieldDecl[]) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Where each of a form's fields saves on the contact (AGL-2601).
|
|
17
|
+
*
|
|
18
|
+
* The declaration a submission is judged against comes off the DESIGN at
|
|
19
|
+
* publish — names, types, options — and knows nothing about where a field
|
|
20
|
+
* saves to, because that is a fact about the contact, not the canvas. So it
|
|
21
|
+
* is edited here — drawn by the CRM in the zone the form's own page hosts,
|
|
22
|
+
* beside routing and the consent field — and written onto the stored
|
|
23
|
+
* declaration as `contactFieldKey`;
|
|
24
|
+
* `carryContactFieldMappings` keeps it across the next publish by field
|
|
25
|
+
* name. The destinations are the org's custom field definitions, read
|
|
26
|
+
* through the same hook every other surface uses, so a field retired under
|
|
27
|
+
* CRM → Fields leaves this list at the same moment it leaves the columns.
|
|
28
|
+
*
|
|
29
|
+
* Only the org's OWN fields are offered. The sender's name and email are
|
|
30
|
+
* recognized from the field name at submission (`name`, `email`) and need no
|
|
31
|
+
* mapping; a control that offered them here would promise a second way to
|
|
32
|
+
* say the same thing, and the built-in `role` on a declaration is read by
|
|
33
|
+
* nothing at the door today — a choice that writes it would be a choice
|
|
34
|
+
* that does nothing.
|
|
35
|
+
*
|
|
36
|
+
* Save hands the whole `fields` array to the page, which writes it — it is
|
|
37
|
+
* one array on the form document, the document is the forms plugin's, and
|
|
38
|
+
* Firestore has no per-element update — with the picked keys
|
|
39
|
+
* applied through `withContactFieldMapping`, which deletes an unmapped key
|
|
40
|
+
* rather than leaving an `undefined` the array write would refuse.
|
|
41
|
+
*/
|
|
42
|
+
export declare function FormContactFieldsCard(props: FormContactFieldsCardProps): import("react").JSX.Element;
|
|
43
|
+
export declare namespace FormContactFieldsCard {
|
|
44
|
+
var displayName: string;
|
|
45
|
+
}
|
|
46
|
+
export default FormContactFieldsCard;
|
|
@@ -0,0 +1,253 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import { CONTACT_FIELD_TYPE_LABELS, pluginDocsHelp, withContactFieldMapping } from "@aglyn/aglyn";
|
|
20
|
+
import { useContactFieldDefinitions } from "../hooks/use-contact-field-definitions.js";
|
|
21
|
+
import { CardDisplay } from "@aglyn/shared-ui-jsx";
|
|
22
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
23
|
+
import { useOrgDataScope } from "@aglyn/tenant-feature-instance";
|
|
24
|
+
import { Button, MenuItem, Stack, TextField, Typography } from "@mui/material";
|
|
25
|
+
import { useCallback, useMemo, useState } from "react";
|
|
26
|
+
/** The choice that saves nowhere — a `MenuItem` value has to be a string. */ const NONE = '';
|
|
27
|
+
/**
|
|
28
|
+
* Where each of a form's fields saves on the contact (AGL-2601).
|
|
29
|
+
*
|
|
30
|
+
* The declaration a submission is judged against comes off the DESIGN at
|
|
31
|
+
* publish — names, types, options — and knows nothing about where a field
|
|
32
|
+
* saves to, because that is a fact about the contact, not the canvas. So it
|
|
33
|
+
* is edited here — drawn by the CRM in the zone the form's own page hosts,
|
|
34
|
+
* beside routing and the consent field — and written onto the stored
|
|
35
|
+
* declaration as `contactFieldKey`;
|
|
36
|
+
* `carryContactFieldMappings` keeps it across the next publish by field
|
|
37
|
+
* name. The destinations are the org's custom field definitions, read
|
|
38
|
+
* through the same hook every other surface uses, so a field retired under
|
|
39
|
+
* CRM → Fields leaves this list at the same moment it leaves the columns.
|
|
40
|
+
*
|
|
41
|
+
* Only the org's OWN fields are offered. The sender's name and email are
|
|
42
|
+
* recognized from the field name at submission (`name`, `email`) and need no
|
|
43
|
+
* mapping; a control that offered them here would promise a second way to
|
|
44
|
+
* say the same thing, and the built-in `role` on a declaration is read by
|
|
45
|
+
* nothing at the door today — a choice that writes it would be a choice
|
|
46
|
+
* that does nothing.
|
|
47
|
+
*
|
|
48
|
+
* Save hands the whole `fields` array to the page, which writes it — it is
|
|
49
|
+
* one array on the form document, the document is the forms plugin's, and
|
|
50
|
+
* Firestore has no per-element update — with the picked keys
|
|
51
|
+
* applied through `withContactFieldMapping`, which deletes an unmapped key
|
|
52
|
+
* rather than leaving an `undefined` the array write would refuse.
|
|
53
|
+
*/ export function FormContactFieldsCard(props) {
|
|
54
|
+
var _ref;
|
|
55
|
+
const { hostId, fields, loading, saveFields } = props;
|
|
56
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
57
|
+
const { scope, ready: scopeReady } = useOrgDataScope({
|
|
58
|
+
hostId
|
|
59
|
+
});
|
|
60
|
+
const { active, definitions, ready } = useContactFieldDefinitions((_ref = scope == null ? void 0 : scope[1]) != null ? _ref : null);
|
|
61
|
+
/**
|
|
62
|
+
* The destinations picked on screen, by field name — only the fields the
|
|
63
|
+
* reader touched. Everything else reads from the stored declaration, so a
|
|
64
|
+
* write from elsewhere (a publish, another tab) shows through untouched.
|
|
65
|
+
*/ const [draft, setDraft] = useState({});
|
|
66
|
+
const [saving, setSaving] = useState(false);
|
|
67
|
+
const storedKey = useCallback((decl)=>{
|
|
68
|
+
var _decl_contactFieldKey;
|
|
69
|
+
return (_decl_contactFieldKey = decl.contactFieldKey) != null ? _decl_contactFieldKey : NONE;
|
|
70
|
+
}, []);
|
|
71
|
+
const shownKey = useCallback((decl)=>decl.fieldName in draft ? draft[decl.fieldName] : storedKey(decl), [
|
|
72
|
+
draft,
|
|
73
|
+
storedKey
|
|
74
|
+
]);
|
|
75
|
+
const changed = useMemo(()=>fields.filter((decl)=>decl.fieldName in draft && draft[decl.fieldName] !== storedKey(decl)), [
|
|
76
|
+
fields,
|
|
77
|
+
draft,
|
|
78
|
+
storedKey
|
|
79
|
+
]);
|
|
80
|
+
/** Active definitions by key, for the hint under a mapped field. */ const activeByKey = useMemo(()=>new Map(active.map((definition)=>[
|
|
81
|
+
definition.key,
|
|
82
|
+
definition
|
|
83
|
+
])), [
|
|
84
|
+
active
|
|
85
|
+
]);
|
|
86
|
+
const handleSave = useCallback(async ()=>{
|
|
87
|
+
if (!changed.length || saving) return;
|
|
88
|
+
setSaving(true);
|
|
89
|
+
try {
|
|
90
|
+
const next = changed.reduce((decls, decl)=>withContactFieldMapping(decls, decl.fieldName, draft[decl.fieldName] || null), [
|
|
91
|
+
...fields
|
|
92
|
+
]);
|
|
93
|
+
await saveFields(next);
|
|
94
|
+
setDraft({});
|
|
95
|
+
enqueueSnackbar('Form saved', {
|
|
96
|
+
variant: 'success',
|
|
97
|
+
persist: false
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(error);
|
|
101
|
+
enqueueSnackbar('An error has occurred', {
|
|
102
|
+
variant: 'error',
|
|
103
|
+
allowDuplicate: true
|
|
104
|
+
});
|
|
105
|
+
} finally{
|
|
106
|
+
setSaving(false);
|
|
107
|
+
}
|
|
108
|
+
}, [
|
|
109
|
+
changed,
|
|
110
|
+
saving,
|
|
111
|
+
fields,
|
|
112
|
+
draft,
|
|
113
|
+
saveFields,
|
|
114
|
+
enqueueSnackbar
|
|
115
|
+
]);
|
|
116
|
+
/**
|
|
117
|
+
* What the picked destination does with an answer — the type's rule, in a
|
|
118
|
+
* sentence, so the author learns it here rather than from a value that
|
|
119
|
+
* never arrived.
|
|
120
|
+
*/ const hint = (key)=>{
|
|
121
|
+
if (key === NONE) return undefined;
|
|
122
|
+
const definition = activeByKey.get(key);
|
|
123
|
+
if (!definition) {
|
|
124
|
+
return definitions.some((entry)=>entry.key === key) ? 'This field is retired, so the answer is no longer saved. Pick another or clear it.' : 'This field no longer exists, so the answer is not saved. Pick another or clear it.';
|
|
125
|
+
}
|
|
126
|
+
switch(definition.type){
|
|
127
|
+
case 'number':
|
|
128
|
+
return 'Stored as a number; an answer that is not one number is dropped.';
|
|
129
|
+
case 'date':
|
|
130
|
+
return 'Stored as a date, whichever way the visitor types it.';
|
|
131
|
+
case 'checkbox':
|
|
132
|
+
return 'Stored as yes or no, from a ticked or unticked box.';
|
|
133
|
+
case 'select':
|
|
134
|
+
var _definition_options;
|
|
135
|
+
return `Stored only when the answer is one of: ${((_definition_options = definition.options) != null ? _definition_options : []).join(', ')}.`;
|
|
136
|
+
case 'url':
|
|
137
|
+
return 'Stored when the answer is an http(s) link.';
|
|
138
|
+
default:
|
|
139
|
+
return 'Stored as text.';
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* A stored key no active definition answers to — retired, or deleted —
|
|
144
|
+
* still has to be an option, or the control could not show what the
|
|
145
|
+
* declaration says and the author could not clear it.
|
|
146
|
+
*/ const orphanOption = (key)=>{
|
|
147
|
+
if (key === NONE || activeByKey.has(key)) return null;
|
|
148
|
+
const retired = definitions.some((entry)=>entry.key === key);
|
|
149
|
+
return /*#__PURE__*/ _jsx(MenuItem, {
|
|
150
|
+
value: key,
|
|
151
|
+
children: `${key} — ${retired ? 'retired field' : 'no such field'}`
|
|
152
|
+
}, key);
|
|
153
|
+
};
|
|
154
|
+
const settled = scopeReady && !loading && (!scope || ready);
|
|
155
|
+
const anyMapped = fields.some((decl)=>decl.contactFieldKey);
|
|
156
|
+
return /*#__PURE__*/ _jsx(CardDisplay, {
|
|
157
|
+
header: "Saves to contact fields",
|
|
158
|
+
help: pluginDocsHelp('contactFields', {
|
|
159
|
+
anchor: '#save-a-form-field'
|
|
160
|
+
}),
|
|
161
|
+
contentGutterX: true,
|
|
162
|
+
contentGutterY: true,
|
|
163
|
+
children: /*#__PURE__*/ _jsx(Stack, {
|
|
164
|
+
spacing: 2,
|
|
165
|
+
children: !settled ? null : !scope ? /*#__PURE__*/ _jsx(Typography, {
|
|
166
|
+
variant: "body2",
|
|
167
|
+
color: "text.secondary",
|
|
168
|
+
children: 'This site has no organization, so it has no contact fields to save into.'
|
|
169
|
+
}) : fields.length === 0 ? /*#__PURE__*/ _jsx(Typography, {
|
|
170
|
+
variant: "body2",
|
|
171
|
+
color: "text.secondary",
|
|
172
|
+
children: 'Publish a version to declare this form’s fields; then choose where each one saves.'
|
|
173
|
+
}) : active.length === 0 && !anyMapped ? /*#__PURE__*/ _jsx(Typography, {
|
|
174
|
+
variant: "body2",
|
|
175
|
+
color: "text.secondary",
|
|
176
|
+
children: 'No custom contact fields are defined yet. Define them under CRM → Fields and ' + 'each form field can save into one.'
|
|
177
|
+
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
180
|
+
variant: "body2",
|
|
181
|
+
color: "text.secondary",
|
|
182
|
+
children: 'Each answer is stored on the contact the submission creates or updates, ' + 'converted by the field’s type. A blank answer writes nothing.'
|
|
183
|
+
}),
|
|
184
|
+
fields.map((decl)=>{
|
|
185
|
+
const key = shownKey(decl);
|
|
186
|
+
return /*#__PURE__*/ _jsxs(TextField, {
|
|
187
|
+
select: true,
|
|
188
|
+
size: "small",
|
|
189
|
+
label: decl.label ? `${decl.label} (${decl.fieldName})` : decl.fieldName,
|
|
190
|
+
value: key,
|
|
191
|
+
onChange: (event)=>setDraft((current)=>_extends({}, current, {
|
|
192
|
+
[decl.fieldName]: event.target.value
|
|
193
|
+
})),
|
|
194
|
+
helperText: hint(key),
|
|
195
|
+
// `displayEmpty`, or the "saves nowhere" choice renders as
|
|
196
|
+
// a blank control and reads as a field left unset; the label
|
|
197
|
+
// shrinks with it so the two do not overlap.
|
|
198
|
+
slotProps: {
|
|
199
|
+
select: {
|
|
200
|
+
displayEmpty: true
|
|
201
|
+
},
|
|
202
|
+
inputLabel: {
|
|
203
|
+
shrink: true
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
fullWidth: true,
|
|
207
|
+
children: [
|
|
208
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
209
|
+
value: NONE,
|
|
210
|
+
children: 'Not saved to a contact field'
|
|
211
|
+
}),
|
|
212
|
+
orphanOption(key),
|
|
213
|
+
active.map((definition)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
214
|
+
value: definition.key,
|
|
215
|
+
children: `${definition.label} · ${CONTACT_FIELD_TYPE_LABELS[definition.type]}`
|
|
216
|
+
}, definition.key))
|
|
217
|
+
]
|
|
218
|
+
}, decl.fieldName);
|
|
219
|
+
}),
|
|
220
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
221
|
+
variant: "caption",
|
|
222
|
+
color: "text.secondary",
|
|
223
|
+
children: 'The sender’s name and email are read from fields named name and email, ' + 'so they never need mapping.'
|
|
224
|
+
}),
|
|
225
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
226
|
+
direction: "row",
|
|
227
|
+
spacing: 1,
|
|
228
|
+
children: [
|
|
229
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
230
|
+
variant: "contained",
|
|
231
|
+
color: "primary",
|
|
232
|
+
size: "small",
|
|
233
|
+
disabled: !changed.length || saving,
|
|
234
|
+
onClick: handleSave,
|
|
235
|
+
children: 'Save'
|
|
236
|
+
}),
|
|
237
|
+
changed.length ? /*#__PURE__*/ _jsx(Button, {
|
|
238
|
+
size: "small",
|
|
239
|
+
onClick: ()=>setDraft({}),
|
|
240
|
+
disabled: saving,
|
|
241
|
+
children: 'Discard'
|
|
242
|
+
}) : null
|
|
243
|
+
]
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
FormContactFieldsCard.displayName = 'FormContactFieldsCard';
|
|
251
|
+
export default FormContactFieldsCard;
|
|
252
|
+
|
|
253
|
+
//# sourceMappingURL=form-contact-fields-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/form-contact-fields-card.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 CONTACT_FIELD_TYPE_LABELS,\n type FormFieldDecl,\n pluginDocsHelp,\n withContactFieldMapping,\n} from '@aglyn/aglyn'\nimport { useContactFieldDefinitions } from '../hooks/use-contact-field-definitions'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { useOrgDataScope } from '@aglyn/tenant-feature-instance'\nimport { Button, MenuItem, Stack, TextField, Typography } from '@mui/material'\nimport { useCallback, useMemo, useState } from 'react'\n\nexport interface FormContactFieldsCardProps {\n hostId: string\n formId: string\n /** The PUBLISHED declaration, as stored on the form document. */\n fields: readonly FormFieldDecl[]\n /** True while the form document is still being read. */\n loading?: boolean\n /**\n * Writes the declaration back. The form document is the forms plugin's, so\n * its page does the write; this card decides what the array should be.\n */\n saveFields: (fields: FormFieldDecl[]) => Promise<void>\n}\n\n/** The choice that saves nowhere — a `MenuItem` value has to be a string. */\nconst NONE = ''\n\n/**\n * Where each of a form's fields saves on the contact (AGL-2601).\n *\n * The declaration a submission is judged against comes off the DESIGN at\n * publish — names, types, options — and knows nothing about where a field\n * saves to, because that is a fact about the contact, not the canvas. So it\n * is edited here — drawn by the CRM in the zone the form's own page hosts,\n * beside routing and the consent field — and written onto the stored\n * declaration as `contactFieldKey`;\n * `carryContactFieldMappings` keeps it across the next publish by field\n * name. The destinations are the org's custom field definitions, read\n * through the same hook every other surface uses, so a field retired under\n * CRM → Fields leaves this list at the same moment it leaves the columns.\n *\n * Only the org's OWN fields are offered. The sender's name and email are\n * recognized from the field name at submission (`name`, `email`) and need no\n * mapping; a control that offered them here would promise a second way to\n * say the same thing, and the built-in `role` on a declaration is read by\n * nothing at the door today — a choice that writes it would be a choice\n * that does nothing.\n *\n * Save hands the whole `fields` array to the page, which writes it — it is\n * one array on the form document, the document is the forms plugin's, and\n * Firestore has no per-element update — with the picked keys\n * applied through `withContactFieldMapping`, which deletes an unmapped key\n * rather than leaving an `undefined` the array write would refuse.\n */\nexport function FormContactFieldsCard(props: FormContactFieldsCardProps) {\n const { hostId, fields, loading, saveFields } = props\n const { enqueueSnackbar } = useSnackbar()\n const { scope, ready: scopeReady } = useOrgDataScope({ hostId })\n const { active, definitions, ready } = useContactFieldDefinitions(scope?.[1] ?? null)\n\n /**\n * The destinations picked on screen, by field name — only the fields the\n * reader touched. Everything else reads from the stored declaration, so a\n * write from elsewhere (a publish, another tab) shows through untouched.\n */\n const [draft, setDraft] = useState<Record<string, string>>({})\n const [saving, setSaving] = useState(false)\n\n const storedKey = useCallback((decl: FormFieldDecl) => decl.contactFieldKey ?? NONE, [])\n const shownKey = useCallback(\n (decl: FormFieldDecl) => (decl.fieldName in draft ? draft[decl.fieldName] : storedKey(decl)),\n [draft, storedKey],\n )\n const changed = useMemo(\n () =>\n fields.filter(\n (decl) => decl.fieldName in draft && draft[decl.fieldName] !== storedKey(decl),\n ),\n [fields, draft, storedKey],\n )\n\n /** Active definitions by key, for the hint under a mapped field. */\n const activeByKey = useMemo(\n () => new Map(active.map((definition) => [definition.key, definition])),\n [active],\n )\n\n const handleSave = useCallback(async () => {\n if (!changed.length || saving) return\n setSaving(true)\n try {\n const next = changed.reduce<FormFieldDecl[]>(\n (decls, decl) =>\n withContactFieldMapping(decls, decl.fieldName, draft[decl.fieldName] || null),\n [...fields],\n )\n await saveFields(next)\n setDraft({})\n enqueueSnackbar('Form saved', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', { variant: 'error', allowDuplicate: true })\n } finally {\n setSaving(false)\n }\n }, [changed, saving, fields, draft, saveFields, enqueueSnackbar])\n\n /**\n * What the picked destination does with an answer — the type's rule, in a\n * sentence, so the author learns it here rather than from a value that\n * never arrived.\n */\n const hint = (key: string): string | undefined => {\n if (key === NONE) return undefined\n const definition = activeByKey.get(key)\n if (!definition) {\n return definitions.some((entry) => entry.key === key)\n ? 'This field is retired, so the answer is no longer saved. Pick another or clear it.'\n : 'This field no longer exists, so the answer is not saved. Pick another or clear it.'\n }\n switch (definition.type) {\n case 'number':\n return 'Stored as a number; an answer that is not one number is dropped.'\n case 'date':\n return 'Stored as a date, whichever way the visitor types it.'\n case 'checkbox':\n return 'Stored as yes or no, from a ticked or unticked box.'\n case 'select':\n return `Stored only when the answer is one of: ${(definition.options ?? []).join(', ')}.`\n case 'url':\n return 'Stored when the answer is an http(s) link.'\n default:\n return 'Stored as text.'\n }\n }\n\n /**\n * A stored key no active definition answers to — retired, or deleted —\n * still has to be an option, or the control could not show what the\n * declaration says and the author could not clear it.\n */\n const orphanOption = (key: string) => {\n if (key === NONE || activeByKey.has(key)) return null\n const retired = definitions.some((entry) => entry.key === key)\n return (\n <MenuItem key={key} value={key}>\n {`${key} — ${retired ? 'retired field' : 'no such field'}`}\n </MenuItem>\n )\n }\n\n const settled = scopeReady && !loading && (!scope || ready)\n const anyMapped = fields.some((decl) => decl.contactFieldKey)\n\n return (\n <CardDisplay\n header=\"Saves to contact fields\"\n help={pluginDocsHelp('contactFields', { anchor: '#save-a-form-field' })}\n contentGutterX\n contentGutterY\n >\n <Stack spacing={2}>\n {!settled ? null : !scope ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This site has no organization, so it has no contact fields to save into.'}\n </Typography>\n ) : fields.length === 0 ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Publish a version to declare this form’s fields; then choose where each one saves.'}\n </Typography>\n ) : active.length === 0 && !anyMapped ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No custom contact fields are defined yet. Define them under CRM → Fields and ' +\n 'each form field can save into one.'}\n </Typography>\n ) : (\n <>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'Each answer is stored on the contact the submission creates or updates, ' +\n 'converted by the field’s type. A blank answer writes nothing.'}\n </Typography>\n {fields.map((decl) => {\n const key = shownKey(decl)\n return (\n <TextField\n key={decl.fieldName}\n select\n size=\"small\"\n label={decl.label ? `${decl.label} (${decl.fieldName})` : decl.fieldName}\n value={key}\n onChange={(event) =>\n setDraft((current) => ({ ...current, [decl.fieldName]: event.target.value }))\n }\n helperText={hint(key)}\n // `displayEmpty`, or the \"saves nowhere\" choice renders as\n // a blank control and reads as a field left unset; the label\n // shrinks with it so the two do not overlap.\n slotProps={{\n select: { displayEmpty: true },\n inputLabel: { shrink: true },\n }}\n fullWidth\n >\n <MenuItem value={NONE}>{'Not saved to a contact field'}</MenuItem>\n {orphanOption(key)}\n {active.map((definition) => (\n <MenuItem key={definition.key} value={definition.key}>\n {`${definition.label} · ${CONTACT_FIELD_TYPE_LABELS[definition.type]}`}\n </MenuItem>\n ))}\n </TextField>\n )\n })}\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'The sender’s name and email are read from fields named name and email, ' +\n 'so they never need mapping.'}\n </Typography>\n <Stack direction=\"row\" spacing={1}>\n <Button\n variant=\"contained\"\n color=\"primary\"\n size=\"small\"\n disabled={!changed.length || saving}\n onClick={handleSave}\n >\n {'Save'}\n </Button>\n {changed.length ? (\n <Button size=\"small\" onClick={() => setDraft({})} disabled={saving}>\n {'Discard'}\n </Button>\n ) : null}\n </Stack>\n </>\n )}\n </Stack>\n </CardDisplay>\n )\n}\nFormContactFieldsCard.displayName = 'FormContactFieldsCard'\n\nexport default FormContactFieldsCard\n"],"names":["CONTACT_FIELD_TYPE_LABELS","pluginDocsHelp","withContactFieldMapping","useContactFieldDefinitions","CardDisplay","useSnackbar","useOrgDataScope","Button","MenuItem","Stack","TextField","Typography","useCallback","useMemo","useState","NONE","FormContactFieldsCard","props","hostId","fields","loading","saveFields","enqueueSnackbar","scope","ready","scopeReady","active","definitions","draft","setDraft","saving","setSaving","storedKey","decl","contactFieldKey","shownKey","fieldName","changed","filter","activeByKey","Map","map","definition","key","handleSave","length","next","reduce","decls","variant","persist","error","console","allowDuplicate","hint","undefined","get","some","entry","type","options","join","orphanOption","has","retired","value","settled","anyMapped","header","help","anchor","contentGutterX","contentGutterY","spacing","color","select","size","label","onChange","event","current","target","helperText","slotProps","displayEmpty","inputLabel","shrink","fullWidth","direction","disabled","onClick","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SACEA,yBAAyB,EAEzBC,cAAc,EACdC,uBAAuB,QAClB,eAAc;AACrB,SAASC,0BAA0B,QAAQ,4CAAwC;AACnF,S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KAAKG,SAAS,CAAC,EAAE2C,MAAME,MAAM,CAAChB,KAAK;;4BAE3EiB,YAAY5B,KAAKX;4BACjB,2DAA2D;4BAC3D,6DAA6D;4BAC7D,6CAA6C;4BAC7CwC,WAAW;gCACTR,QAAQ;oCAAES,cAAc;gCAAK;gCAC7BC,YAAY;oCAAEC,QAAQ;gCAAK;4BAC7B;4BACAC,SAAS;;8CAET,KAAC/E;oCAASyD,OAAOlD;8CAAO;;gCACvB+C,aAAanB;gCACbjB,OAAOe,GAAG,CAAC,CAACC,2BACX,KAAClC;wCAA8ByD,OAAOvB,WAAWC,GAAG;kDACjD,GAAGD,WAAWmC,KAAK,CAAC,GAAG,EAAE7E,yBAAyB,CAAC0C,WAAWiB,IAAI,CAAC,EAAE;uCADzDjB,WAAWC,GAAG;;2BArB1BV,KAAKG,SAAS;oBA2BzB;kCACA,KAACzB;wBAAWsC,SAAQ;wBAAUyB,OAAM;kCACjC,4EACC;;kCAEJ,MAACjE;wBAAM+E,WAAU;wBAAMf,SAAS;;0CAC9B,KAAClE;gCACC0C,SAAQ;gCACRyB,OAAM;gCACNE,MAAK;gCACLa,UAAU,CAACpD,QAAQQ,MAAM,IAAIf;gCAC7B4D,SAAS9C;0CAER;;4BAEFP,QAAQQ,MAAM,iBACb,KAACtC;gCAAOqE,MAAK;gCAAQc,SAAS,IAAM7D,SAAS,CAAC;gCAAI4D,UAAU3D;0CACzD;iCAED;;;;;;;AAOlB;AACAd,sBAAsB2E,WAAW,GAAG;AAEpC,eAAe3E,sBAAqB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A link dropped into a plain-text draft at the caret, replacing whatever
|
|
19
|
+
* was selected. A space is put on either side where the text would
|
|
20
|
+
* otherwise run into the URL — a mail client reads `word https://…` as a
|
|
21
|
+
* link and `wordhttps://…` as a typo — and none where the caret already
|
|
22
|
+
* sits on whitespace, a line end, or an edge of the draft. The caret lands
|
|
23
|
+
* after the inserted run, where typing continues.
|
|
24
|
+
*/
|
|
25
|
+
export declare function insertLinkAtCaret(text: string, link: string, start: number, end: number): {
|
|
26
|
+
text: string;
|
|
27
|
+
caret: number;
|
|
28
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
*/ /**
|
|
17
|
+
* A link dropped into a plain-text draft at the caret, replacing whatever
|
|
18
|
+
* was selected. A space is put on either side where the text would
|
|
19
|
+
* otherwise run into the URL — a mail client reads `word https://…` as a
|
|
20
|
+
* link and `wordhttps://…` as a typo — and none where the caret already
|
|
21
|
+
* sits on whitespace, a line end, or an edge of the draft. The caret lands
|
|
22
|
+
* after the inserted run, where typing continues.
|
|
23
|
+
*/ export function insertLinkAtCaret(text, link, start, end) {
|
|
24
|
+
const from = Math.max(0, Math.min(start, text.length));
|
|
25
|
+
const to = Math.max(from, Math.min(end, text.length));
|
|
26
|
+
const before = text.slice(0, from);
|
|
27
|
+
const after = text.slice(to);
|
|
28
|
+
const lead = before && !/\s$/.test(before) ? ' ' : '';
|
|
29
|
+
const trail = after && !/^\s/.test(after) ? ' ' : '';
|
|
30
|
+
const inserted = `${lead}${link}${trail}`;
|
|
31
|
+
return {
|
|
32
|
+
text: `${before}${inserted}${after}`,
|
|
33
|
+
caret: before.length + inserted.length
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=insert-link-at-caret.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/insert-link-at-caret.ts"],"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\n/**\n * A link dropped into a plain-text draft at the caret, replacing whatever\n * was selected. A space is put on either side where the text would\n * otherwise run into the URL — a mail client reads `word https://…` as a\n * link and `wordhttps://…` as a typo — and none where the caret already\n * sits on whitespace, a line end, or an edge of the draft. The caret lands\n * after the inserted run, where typing continues.\n */\nexport function insertLinkAtCaret(\n text: string,\n link: string,\n start: number,\n end: number,\n): { text: string; caret: number } {\n const from = Math.max(0, Math.min(start, text.length))\n const to = Math.max(from, Math.min(end, text.length))\n const before = text.slice(0, from)\n const after = text.slice(to)\n const lead = before && !/\\s$/.test(before) ? ' ' : ''\n const trail = after && !/^\\s/.test(after) ? ' ' : ''\n const inserted = `${lead}${link}${trail}`\n return { text: `${before}${inserted}${after}`, caret: before.length + inserted.length }\n}\n"],"names":["insertLinkAtCaret","text","link","start","end","from","Math","max","min","length","to","before","slice","after","lead","test","trail","inserted","caret"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GACD,OAAO,SAASA,kBACdC,IAAY,EACZC,IAAY,EACZC,KAAa,EACbC,GAAW;IAEX,MAAMC,OAAOC,KAAKC,GAAG,CAAC,GAAGD,KAAKE,GAAG,CAACL,OAAOF,KAAKQ,MAAM;IACpD,MAAMC,KAAKJ,KAAKC,GAAG,CAACF,MAAMC,KAAKE,GAAG,CAACJ,KAAKH,KAAKQ,MAAM;IACnD,MAAME,SAASV,KAAKW,KAAK,CAAC,GAAGP;IAC7B,MAAMQ,QAAQZ,KAAKW,KAAK,CAACF;IACzB,MAAMI,OAAOH,UAAU,CAAC,MAAMI,IAAI,CAACJ,UAAU,MAAM;IACnD,MAAMK,QAAQH,SAAS,CAAC,MAAME,IAAI,CAACF,SAAS,MAAM;IAClD,MAAMI,WAAW,GAAGH,OAAOZ,OAAOc,OAAO;IACzC,OAAO;QAAEf,MAAM,GAAGU,SAASM,WAAWJ,OAAO;QAAEK,OAAOP,OAAOF,MAAM,GAAGQ,SAASR,MAAM;IAAC;AACxF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CrmLeadFields } from '@aglyn/aglyn';
|
|
2
|
+
import type { OrgMemberOptions } from '../hooks/use-org-member-options';
|
|
3
|
+
export interface LeadConvertDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
hostId: string;
|
|
7
|
+
orgId: string | null;
|
|
8
|
+
org: Record<string, unknown> | null | undefined;
|
|
9
|
+
leadId: string;
|
|
10
|
+
lead: Record<string, unknown> & CrmLeadFields;
|
|
11
|
+
basePath: string;
|
|
12
|
+
roster: OrgMemberOptions;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert a lead into a contact, and optionally a company and a deal
|
|
16
|
+
* (AGL-2608).
|
|
17
|
+
*
|
|
18
|
+
* The dialog collects the decisions and posts ONE request to
|
|
19
|
+
* `crm/lead-convert`; it writes nothing itself, because the contact can only
|
|
20
|
+
* come from the server's dedupe door and the rest of the conversion has to
|
|
21
|
+
* follow it in order. What it does own is the suggestion: the company the
|
|
22
|
+
* lead's email domain implies, matched against the companies this reader can
|
|
23
|
+
* see, so the common case is a glance and a click.
|
|
24
|
+
*
|
|
25
|
+
* Both reads open only while the dialog is — a converter who never opens it
|
|
26
|
+
* pays for neither the company list nor the pipeline.
|
|
27
|
+
*/
|
|
28
|
+
export declare function LeadConvertDialog(props: LeadConvertDialogProps): import("react").JSX.Element;
|
|
29
|
+
export declare namespace LeadConvertDialog {
|
|
30
|
+
var displayName: string;
|
|
31
|
+
}
|
|
32
|
+
export default LeadConvertDialog;
|