@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,198 @@
|
|
|
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 Aglyn from "@aglyn/aglyn";
|
|
18
|
+
import { useFirestore, usePagedCollection, useScopeTokens, useUser } from "@aglyn/tenant-feature-instance";
|
|
19
|
+
import { collection, limit, orderBy, query, where } from "firebase/firestore";
|
|
20
|
+
import { useCallback, useMemo } from "react";
|
|
21
|
+
import { crmVisibleToClause, useCrmScope } from "../hooks/use-crm-scope.js";
|
|
22
|
+
/**
|
|
23
|
+
* Everything an activity surface needs to know about WHERE it is reading
|
|
24
|
+
* and writing (AGL-2600), resolved once from the two props the shell hands
|
|
25
|
+
* every CRM page.
|
|
26
|
+
*
|
|
27
|
+
* Four surfaces read activities — a record card, a contact's timeline, the
|
|
28
|
+
* recent feed and the dialog that writes them — and each of them would
|
|
29
|
+
* otherwise resolve the same org, the same consent group and the same token
|
|
30
|
+
* set from the same two inputs. Resolved here so that a surface cannot read
|
|
31
|
+
* with one group and write with another, which is the shape of leak the
|
|
32
|
+
* contacts list closed (a listener with no `where` at all).
|
|
33
|
+
*
|
|
34
|
+
* Pure of Firestore reads: the org document is the one the shell already
|
|
35
|
+
* loaded, so the group and the tokens cost nothing, and the data scope is
|
|
36
|
+
* the memoized `['orgs', orgId]` tuple every host-scoped card builds.
|
|
37
|
+
*/ export function useActivityScope(hostId, org) {
|
|
38
|
+
const firestore = useFirestore();
|
|
39
|
+
/*
|
|
40
|
+
* The controller this surface is showing — the sites declared to be one
|
|
41
|
+
* sender, or this site alone — read from the org document the shell
|
|
42
|
+
* passed, by the one hook every CRM surface resolves its scope through
|
|
43
|
+
* (AGL-2614). The contacts list resolves its group the same way, so an
|
|
44
|
+
* activity logged from a contact's page lands in the scope that contact
|
|
45
|
+
* is read under. At the organization level (AGL-2630) there is no viewing
|
|
46
|
+
* site: `consentGroup` and `readTokens` are `null` — the listener carries
|
|
47
|
+
* no scope clause — and a new activity is stamped with the picked site's
|
|
48
|
+
* tokens and provenance.
|
|
49
|
+
*/ const { scope: dataScope, orgId, consentGroup, visibleTo: readTokens, createHostId, createTokens: writeTokens } = useCrmScope({
|
|
50
|
+
hostId,
|
|
51
|
+
org
|
|
52
|
+
});
|
|
53
|
+
return useMemo(()=>({
|
|
54
|
+
firestore,
|
|
55
|
+
dataScope,
|
|
56
|
+
orgId,
|
|
57
|
+
/** The site a NEW activity names as provenance — the mounted site, or the picked one. */ hostId: createHostId,
|
|
58
|
+
/**
|
|
59
|
+
* The site the surface is MOUNTED under, or `null` at the organization
|
|
60
|
+
* level — what a dialog reads to decide whether to ask which site.
|
|
61
|
+
*/ mountedHostId: hostId,
|
|
62
|
+
consentGroup,
|
|
63
|
+
readTokens,
|
|
64
|
+
writeTokens
|
|
65
|
+
}), [
|
|
66
|
+
firestore,
|
|
67
|
+
dataScope,
|
|
68
|
+
orgId,
|
|
69
|
+
createHostId,
|
|
70
|
+
hostId,
|
|
71
|
+
consentGroup,
|
|
72
|
+
readTokens,
|
|
73
|
+
writeTokens
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether the signed-in user may EDIT or DELETE a given activity (AGL-2600).
|
|
78
|
+
*
|
|
79
|
+
* The author may, and so may an org-wide member — the person who administers
|
|
80
|
+
* the org can correct or remove anything logged in it. Nobody else: a scoped
|
|
81
|
+
* colleague may read a call log they did not write, and may not rewrite it.
|
|
82
|
+
*
|
|
83
|
+
* ⚠️ This is a UI verdict, not an enforced one. The Firestore rules on
|
|
84
|
+
* `crmActivities` admit any member who may write scoped org data, and they
|
|
85
|
+
* do not distinguish the author from anybody else — there is no `byUid`
|
|
86
|
+
* clause in them. The controls are hidden here so that the console does not
|
|
87
|
+
* offer a colleague's log for editing, and a caller who bypasses the console
|
|
88
|
+
* is a caller the rules already admit. Tightening the rules to the author is
|
|
89
|
+
* a decision about what the API permits, not something a card takes on its
|
|
90
|
+
* own.
|
|
91
|
+
*
|
|
92
|
+
* `useScopeTokens` answers org-wide while it loads, so the verdict for a
|
|
93
|
+
* NON-author waits for `loaded` — a scoped colleague must not see edit
|
|
94
|
+
* controls flash on for one paint and then vanish.
|
|
95
|
+
*
|
|
96
|
+
* Called ONCE by the list that draws the rows, never by a row. The verdict
|
|
97
|
+
* costs a read of the member document, and a hundred rows each asking would
|
|
98
|
+
* be a hundred reads of one document on every mount — the shape of cost the
|
|
99
|
+
* console pays nowhere else. `enabled` is for a surface that offers no
|
|
100
|
+
* controls at all, the feed: `useScopeTokens` opens nothing for an undefined
|
|
101
|
+
* org, so a disabled verdict reads nothing and answers no.
|
|
102
|
+
*/ export function useCanEditActivity(orgId, enabled = true) {
|
|
103
|
+
const { data: user } = useUser();
|
|
104
|
+
const uid = user == null ? void 0 : user.uid;
|
|
105
|
+
const membership = useScopeTokens(enabled ? orgId : undefined);
|
|
106
|
+
return useCallback((activity)=>{
|
|
107
|
+
if (!enabled || !uid) return false;
|
|
108
|
+
if (activity.byUid === uid) return true;
|
|
109
|
+
return membership.loaded && membership.orgWide;
|
|
110
|
+
}, [
|
|
111
|
+
enabled,
|
|
112
|
+
uid,
|
|
113
|
+
membership.loaded,
|
|
114
|
+
membership.orgWide
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
/** How many rows a "show more" step adds, and how many the first paint reads. */ export const ACTIVITY_PAGE_SIZE = 100;
|
|
118
|
+
/**
|
|
119
|
+
* The activities filed against one record, or across the CRM, newest-first
|
|
120
|
+
* and bounded (AGL-2600).
|
|
121
|
+
*
|
|
122
|
+
* The window is the query. `usePagedCollection` widens the listener by one
|
|
123
|
+
* page each time the reader asks for more, so a record with three hundred
|
|
124
|
+
* calls costs a hundred documents until somebody wants the next hundred —
|
|
125
|
+
* and `hasMore` is a fact from the probe row, not a guess from the length.
|
|
126
|
+
* The rows handed back are the WHOLE window so far, not the last page alone,
|
|
127
|
+
* because a log reads as one list that grows at the bottom rather than as
|
|
128
|
+
* numbered pages.
|
|
129
|
+
*
|
|
130
|
+
* Filtered by `array-contains-any` over the reader's tokens, which is the
|
|
131
|
+
* predicate the rules evaluate with `hasAny`: a filtered query is provable
|
|
132
|
+
* per document, and an unfiltered one is refused outright rather than
|
|
133
|
+
* quietly returning everything. The record filter is one equality on top of
|
|
134
|
+
* it — the four indexes `(visibleTo, contactId|companyId|dealId|leadId, atMs
|
|
135
|
+
* DESC)` exist for exactly these queries, and `(visibleTo, atMs DESC)` for the
|
|
136
|
+
* feed that names no record.
|
|
137
|
+
*
|
|
138
|
+
* Each record filter is indexed twice. An organization-level reader has no
|
|
139
|
+
* tokens, so `crmVisibleToClause` contributes no constraint and the query
|
|
140
|
+
* arrives as `(<record>, atMs DESC)` with the array field gone — a different
|
|
141
|
+
* index, not a prefix of the one above it. Adding a record kind here means
|
|
142
|
+
* adding BOTH halves; one of them alone leaves the other audience unserved.
|
|
143
|
+
*
|
|
144
|
+
* These are all DESCENDING because this window asks for `desc` outright. A
|
|
145
|
+
* read over the same rows that names no order is not served by them: Firestore
|
|
146
|
+
* orders such a query by its range field ascending, and an index serves one
|
|
147
|
+
* direction or its exact reverse. That is why the report counts carry their
|
|
148
|
+
* own ascending indexes rather than borrowing these.
|
|
149
|
+
*/ export function useActivityWindow(scope, link, pageSize = ACTIVITY_PAGE_SIZE) {
|
|
150
|
+
const { firestore, dataScope, readTokens } = scope;
|
|
151
|
+
const { contactId, companyId, dealId, leadId } = link;
|
|
152
|
+
const paged = usePagedCollection((pageLimit)=>{
|
|
153
|
+
if (!dataScope) return null;
|
|
154
|
+
const record = contactId ? [
|
|
155
|
+
where('contactId', '==', contactId)
|
|
156
|
+
] : companyId ? [
|
|
157
|
+
where('companyId', '==', companyId)
|
|
158
|
+
] : dealId ? [
|
|
159
|
+
where('dealId', '==', dealId)
|
|
160
|
+
] : leadId ? [
|
|
161
|
+
where('leadId', '==', leadId)
|
|
162
|
+
] : [];
|
|
163
|
+
return query(collection(firestore, dataScope[0], dataScope[1], Aglyn.CRM_COLLECTIONS.activities), ...crmVisibleToClause(readTokens), ...record, orderBy('atMs', 'desc'), limit(pageLimit));
|
|
164
|
+
}, [
|
|
165
|
+
firestore,
|
|
166
|
+
dataScope,
|
|
167
|
+
readTokens,
|
|
168
|
+
contactId,
|
|
169
|
+
companyId,
|
|
170
|
+
dealId,
|
|
171
|
+
leadId
|
|
172
|
+
], {
|
|
173
|
+
idField: '$id',
|
|
174
|
+
pageSize
|
|
175
|
+
});
|
|
176
|
+
const windowSize = paged.pageSize * (paged.page + 1);
|
|
177
|
+
// The probe row is the one past the window; it says "more exists" and is
|
|
178
|
+
// never shown.
|
|
179
|
+
const rows = useMemo(()=>{
|
|
180
|
+
var _paged_data;
|
|
181
|
+
return ((_paged_data = paged.data) != null ? _paged_data : []).slice(0, windowSize);
|
|
182
|
+
}, [
|
|
183
|
+
paged.data,
|
|
184
|
+
windowSize
|
|
185
|
+
]);
|
|
186
|
+
const showMore = useCallback(()=>paged.setPage(paged.page + 1), [
|
|
187
|
+
paged
|
|
188
|
+
]);
|
|
189
|
+
return {
|
|
190
|
+
rows,
|
|
191
|
+
hasMore: paged.hasMore,
|
|
192
|
+
showMore,
|
|
193
|
+
status: paged.status,
|
|
194
|
+
/** Whether the listener has a scope to read at all. */ ready: Boolean(dataScope)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=activity-queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/activity-queries.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'use client'\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport type { AglynOrgBilling, CrmActivityRow } from '@aglyn/aglyn'\nimport {\n useFirestore,\n usePagedCollection,\n useScopeTokens,\n useUser,\n} from '@aglyn/tenant-feature-instance'\nimport {\n collection,\n limit,\n orderBy,\n query,\n where,\n type QueryConstraint,\n} from 'firebase/firestore'\nimport { useCallback, useMemo } from 'react'\nimport { crmVisibleToClause, useCrmScope } from '../hooks/use-crm-scope'\n\n/** The org document as the shell passes it: partial, and possibly absent. */\nexport type CrmOrg = Partial<AglynOrgBilling> | null | undefined\n\n/**\n * Which record an activity surface is about. Exactly one of the three is set\n * by a record page; a feed across the CRM sets none.\n */\nexport interface ActivityRecordLink {\n contactId?: string\n companyId?: string\n dealId?: string\n /** A lead's own log (AGL-2615) — see `CrmActivityLink.leadId`. */\n leadId?: string\n}\n\n/**\n * Everything an activity surface needs to know about WHERE it is reading\n * and writing (AGL-2600), resolved once from the two props the shell hands\n * every CRM page.\n *\n * Four surfaces read activities — a record card, a contact's timeline, the\n * recent feed and the dialog that writes them — and each of them would\n * otherwise resolve the same org, the same consent group and the same token\n * set from the same two inputs. Resolved here so that a surface cannot read\n * with one group and write with another, which is the shape of leak the\n * contacts list closed (a listener with no `where` at all).\n *\n * Pure of Firestore reads: the org document is the one the shell already\n * loaded, so the group and the tokens cost nothing, and the data scope is\n * the memoized `['orgs', orgId]` tuple every host-scoped card builds.\n */\nexport function useActivityScope(hostId: string | null, org: CrmOrg) {\n const firestore = useFirestore()\n /*\n * The controller this surface is showing — the sites declared to be one\n * sender, or this site alone — read from the org document the shell\n * passed, by the one hook every CRM surface resolves its scope through\n * (AGL-2614). The contacts list resolves its group the same way, so an\n * activity logged from a contact's page lands in the scope that contact\n * is read under. At the organization level (AGL-2630) there is no viewing\n * site: `consentGroup` and `readTokens` are `null` — the listener carries\n * no scope clause — and a new activity is stamped with the picked site's\n * tokens and provenance.\n */\n const {\n scope: dataScope,\n orgId,\n consentGroup,\n visibleTo: readTokens,\n createHostId,\n createTokens: writeTokens,\n } = useCrmScope({ hostId, org })\n return useMemo(\n () => ({\n firestore,\n dataScope,\n orgId,\n /** The site a NEW activity names as provenance — the mounted site, or the picked one. */\n hostId: createHostId,\n /**\n * The site the surface is MOUNTED under, or `null` at the organization\n * level — what a dialog reads to decide whether to ask which site.\n */\n mountedHostId: hostId,\n consentGroup,\n readTokens,\n writeTokens,\n }),\n [\n firestore,\n dataScope,\n orgId,\n createHostId,\n hostId,\n consentGroup,\n readTokens,\n writeTokens,\n ],\n )\n}\n\nexport type ActivityScope = ReturnType<typeof useActivityScope>\n\n/**\n * Whether the signed-in user may EDIT or DELETE a given activity (AGL-2600).\n *\n * The author may, and so may an org-wide member — the person who administers\n * the org can correct or remove anything logged in it. Nobody else: a scoped\n * colleague may read a call log they did not write, and may not rewrite it.\n *\n * ⚠️ This is a UI verdict, not an enforced one. The Firestore rules on\n * `crmActivities` admit any member who may write scoped org data, and they\n * do not distinguish the author from anybody else — there is no `byUid`\n * clause in them. The controls are hidden here so that the console does not\n * offer a colleague's log for editing, and a caller who bypasses the console\n * is a caller the rules already admit. Tightening the rules to the author is\n * a decision about what the API permits, not something a card takes on its\n * own.\n *\n * `useScopeTokens` answers org-wide while it loads, so the verdict for a\n * NON-author waits for `loaded` — a scoped colleague must not see edit\n * controls flash on for one paint and then vanish.\n *\n * Called ONCE by the list that draws the rows, never by a row. The verdict\n * costs a read of the member document, and a hundred rows each asking would\n * be a hundred reads of one document on every mount — the shape of cost the\n * console pays nowhere else. `enabled` is for a surface that offers no\n * controls at all, the feed: `useScopeTokens` opens nothing for an undefined\n * org, so a disabled verdict reads nothing and answers no.\n */\nexport function useCanEditActivity(\n orgId: string | undefined,\n enabled = true,\n) {\n const { data: user } = useUser()\n const uid = user?.uid\n const membership = useScopeTokens(enabled ? orgId : undefined)\n return useCallback(\n (activity: Pick<CrmActivityRow, 'byUid'>): boolean => {\n if (!enabled || !uid) return false\n if (activity.byUid === uid) return true\n return membership.loaded && membership.orgWide\n },\n [enabled, uid, membership.loaded, membership.orgWide],\n )\n}\n\n/** How many rows a \"show more\" step adds, and how many the first paint reads. */\nexport const ACTIVITY_PAGE_SIZE = 100\n\n/**\n * The activities filed against one record, or across the CRM, newest-first\n * and bounded (AGL-2600).\n *\n * The window is the query. `usePagedCollection` widens the listener by one\n * page each time the reader asks for more, so a record with three hundred\n * calls costs a hundred documents until somebody wants the next hundred —\n * and `hasMore` is a fact from the probe row, not a guess from the length.\n * The rows handed back are the WHOLE window so far, not the last page alone,\n * because a log reads as one list that grows at the bottom rather than as\n * numbered pages.\n *\n * Filtered by `array-contains-any` over the reader's tokens, which is the\n * predicate the rules evaluate with `hasAny`: a filtered query is provable\n * per document, and an unfiltered one is refused outright rather than\n * quietly returning everything. The record filter is one equality on top of\n * it — the four indexes `(visibleTo, contactId|companyId|dealId|leadId, atMs\n * DESC)` exist for exactly these queries, and `(visibleTo, atMs DESC)` for the\n * feed that names no record.\n *\n * Each record filter is indexed twice. An organization-level reader has no\n * tokens, so `crmVisibleToClause` contributes no constraint and the query\n * arrives as `(<record>, atMs DESC)` with the array field gone — a different\n * index, not a prefix of the one above it. Adding a record kind here means\n * adding BOTH halves; one of them alone leaves the other audience unserved.\n *\n * These are all DESCENDING because this window asks for `desc` outright. A\n * read over the same rows that names no order is not served by them: Firestore\n * orders such a query by its range field ascending, and an index serves one\n * direction or its exact reverse. That is why the report counts carry their\n * own ascending indexes rather than borrowing these.\n */\nexport function useActivityWindow(\n scope: ActivityScope,\n link: ActivityRecordLink,\n pageSize: number = ACTIVITY_PAGE_SIZE,\n) {\n const { firestore, dataScope, readTokens } = scope\n const { contactId, companyId, dealId, leadId } = link\n const paged = usePagedCollection<CrmActivityRow>(\n (pageLimit) => {\n if (!dataScope) return null\n const record: QueryConstraint[] = contactId\n ? [where('contactId', '==', contactId)]\n : companyId\n ? [where('companyId', '==', companyId)]\n : dealId\n ? [where('dealId', '==', dealId)]\n : leadId\n ? [where('leadId', '==', leadId)]\n : []\n return query(\n collection(\n firestore,\n dataScope[0],\n dataScope[1],\n Aglyn.CRM_COLLECTIONS.activities,\n ),\n ...crmVisibleToClause(readTokens),\n ...record,\n orderBy('atMs', 'desc'),\n limit(pageLimit),\n )\n },\n [firestore, dataScope, readTokens, contactId, companyId, dealId, leadId],\n { idField: '$id', pageSize },\n )\n const windowSize = paged.pageSize * (paged.page + 1)\n // The probe row is the one past the window; it says \"more exists\" and is\n // never shown.\n const rows = useMemo(\n () => (paged.data ?? []).slice(0, windowSize),\n [paged.data, windowSize],\n )\n const showMore = useCallback(\n () => paged.setPage(paged.page + 1),\n [paged],\n )\n return {\n rows,\n hasMore: paged.hasMore,\n showMore,\n status: paged.status,\n /** Whether the listener has a scope to read at all. */\n ready: Boolean(dataScope),\n }\n}\n"],"names":["Aglyn","useFirestore","usePagedCollection","useScopeTokens","useUser","collection","limit","orderBy","query","where","useCallback","useMemo","crmVisibleToClause","useCrmScope","useActivityScope","hostId","org","firestore","scope","dataScope","orgId","consentGroup","visibleTo","readTokens","createHostId","createTokens","writeTokens","mountedHostId","useCanEditActivity","enabled","data","user","uid","membership","undefined","activity","byUid","loaded","orgWide","ACTIVITY_PAGE_SIZE","useActivityWindow","link","pageSize","contactId","companyId","dealId","leadId","paged","pageLimit","record","CRM_COLLECTIONS","activities","idField","windowSize","page","rows","slice","showMore","setPage","hasMore","status","ready","Boolean"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;AAEA,YAAYA,WAAW,eAAc;AAErC,SACEC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,EACdC,OAAO,QACF,iCAAgC;AACvC,SACEC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,KAAK,QAEA,qBAAoB;AAC3B,SAASC,WAAW,EAAEC,OAAO,QAAQ,QAAO;AAC5C,SAASC,kBAAkB,EAAEC,WAAW,QAAQ,4BAAwB;AAiBxE;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASC,iBAAiBC,MAAqB,EAAEC,GAAW;IACjE,MAAMC,YAAYhB;IAClB;;;;;;;;;;GAUC,GACD,MAAM,EACJiB,OAAOC,SAAS,EAChBC,KAAK,EACLC,YAAY,EACZC,WAAWC,UAAU,EACrBC,YAAY,EACZC,cAAcC,WAAW,EAC1B,GAAGb,YAAY;QAAEE;QAAQC;IAAI;IAC9B,OAAOL,QACL,IAAO,CAAA;YACLM;YACAE;YACAC;YACA,uFAAuF,GACvFL,QAAQS;YACR;;;OAGC,GACDG,eAAeZ;YACfM;YACAE;YACAG;QACF,CAAA,GACA;QACET;QACAE;QACAC;QACAI;QACAT;QACAM;QACAE;QACAG;KACD;AAEL;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BC,GACD,OAAO,SAASE,mBACdR,KAAyB,EACzBS,UAAU,IAAI;IAEd,MAAM,EAAEC,MAAMC,IAAI,EAAE,GAAG3B;IACvB,MAAM4B,MAAMD,wBAAAA,KAAMC,GAAG;IACrB,MAAMC,aAAa9B,eAAe0B,UAAUT,QAAQc;IACpD,OAAOxB,YACL,CAACyB;QACC,IAAI,CAACN,WAAW,CAACG,KAAK,OAAO;QAC7B,IAAIG,SAASC,KAAK,KAAKJ,KAAK,OAAO;QACnC,OAAOC,WAAWI,MAAM,IAAIJ,WAAWK,OAAO;IAChD,GACA;QAACT;QAASG;QAAKC,WAAWI,MAAM;QAAEJ,WAAWK,OAAO;KAAC;AAEzD;AAEA,+EAA+E,GAC/E,OAAO,MAAMC,qBAAqB,IAAG;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,SAASC,kBACdtB,KAAoB,EACpBuB,IAAwB,EACxBC,WAAmBH,kBAAkB;IAErC,MAAM,EAAEtB,SAAS,EAAEE,SAAS,EAAEI,UAAU,EAAE,GAAGL;IAC7C,MAAM,EAAEyB,SAAS,EAAEC,SAAS,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGL;IACjD,MAAMM,QAAQ7C,mBACZ,CAAC8C;QACC,IAAI,CAAC7B,WAAW,OAAO;QACvB,MAAM8B,SAA4BN,YAC9B;YAAClC,MAAM,aAAa,MAAMkC;SAAW,GACrCC,YACE;YAACnC,MAAM,aAAa,MAAMmC;SAAW,GACrCC,SACE;YAACpC,MAAM,UAAU,MAAMoC;SAAQ,GAC/BC,SACE;YAACrC,MAAM,UAAU,MAAMqC;SAAQ,GAC/B,EAAE;QACZ,OAAOtC,MACLH,WACEY,WACAE,SAAS,CAAC,EAAE,EACZA,SAAS,CAAC,EAAE,EACZnB,MAAMkD,eAAe,CAACC,UAAU,MAE/BvC,mBAAmBW,gBACnB0B,QACH1C,QAAQ,QAAQ,SAChBD,MAAM0C;IAEV,GACA;QAAC/B;QAAWE;QAAWI;QAAYoB;QAAWC;QAAWC;QAAQC;KAAO,EACxE;QAAEM,SAAS;QAAOV;IAAS;IAE7B,MAAMW,aAAaN,MAAML,QAAQ,GAAIK,CAAAA,MAAMO,IAAI,GAAG,CAAA;IAClD,yEAAyE;IACzE,eAAe;IACf,MAAMC,OAAO5C,QACX;YAAOoC;eAAD,EAACA,cAAAA,MAAMjB,IAAI,YAAViB,cAAc,EAAE,EAAES,KAAK,CAAC,GAAGH;OAClC;QAACN,MAAMjB,IAAI;QAAEuB;KAAW;IAE1B,MAAMI,WAAW/C,YACf,IAAMqC,MAAMW,OAAO,CAACX,MAAMO,IAAI,GAAG,IACjC;QAACP;KAAM;IAET,OAAO;QACLQ;QACAI,SAASZ,MAAMY,OAAO;QACtBF;QACAG,QAAQb,MAAMa,MAAM;QACpB,qDAAqD,GACrDC,OAAOC,QAAQ3C;IACjB;AACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AglynOrgBilling } from '@aglyn/aglyn';
|
|
2
|
+
export interface AddToListButtonProps {
|
|
3
|
+
/** The site the record is read under, or `null` at the organization level. */
|
|
4
|
+
hostId: string | null;
|
|
5
|
+
/** The org the shell passed, so the scope needs no lookup when it has an id. */
|
|
6
|
+
org?: Partial<AglynOrgBilling> | null;
|
|
7
|
+
/** The record the button sits on. */
|
|
8
|
+
contactId: string;
|
|
9
|
+
/** The person's address; a contact with none cannot be on a list. */
|
|
10
|
+
email: string | null | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* "Add to list", for one person's page (AGL-2603).
|
|
14
|
+
*
|
|
15
|
+
* The bulk bar's dialog over a selection of one. It lives on the contact
|
|
16
|
+
* record because that is where somebody reading about one person decides
|
|
17
|
+
* they belong on the newsletter — and it opens the same checked, attested
|
|
18
|
+
* door the selection uses, so the record page cannot enroll anyone the
|
|
19
|
+
* audience page would refuse.
|
|
20
|
+
*/
|
|
21
|
+
export declare function AddToListButton(props: AddToListButtonProps): import("react").JSX.Element;
|
|
22
|
+
export declare namespace AddToListButton {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
export default AddToListButton;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { Button } from "@mui/material";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
import { useCrmScope } from "../hooks/use-crm-scope.js";
|
|
21
|
+
import AddToListDialog from "./add-to-list-dialog.js";
|
|
22
|
+
/**
|
|
23
|
+
* "Add to list", for one person's page (AGL-2603).
|
|
24
|
+
*
|
|
25
|
+
* The bulk bar's dialog over a selection of one. It lives on the contact
|
|
26
|
+
* record because that is where somebody reading about one person decides
|
|
27
|
+
* they belong on the newsletter — and it opens the same checked, attested
|
|
28
|
+
* door the selection uses, so the record page cannot enroll anyone the
|
|
29
|
+
* audience page would refuse.
|
|
30
|
+
*/ export function AddToListButton(props) {
|
|
31
|
+
const { hostId, org, email } = props;
|
|
32
|
+
// The audiences API takes the site whose console is asking: the mounted
|
|
33
|
+
// one, or at the organization level the one the reader picked (AGL-2630).
|
|
34
|
+
const { scope, createHostId } = useCrmScope({
|
|
35
|
+
hostId,
|
|
36
|
+
org
|
|
37
|
+
});
|
|
38
|
+
const [open, setOpen] = useState(false);
|
|
39
|
+
const address = String(email != null ? email : '').trim();
|
|
40
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
43
|
+
size: "small",
|
|
44
|
+
variant: "outlined",
|
|
45
|
+
disabled: !scope || !address || !createHostId,
|
|
46
|
+
onClick: ()=>setOpen(true),
|
|
47
|
+
children: 'Add to list'
|
|
48
|
+
}),
|
|
49
|
+
open ? /*#__PURE__*/ _jsx(AddToListDialog, {
|
|
50
|
+
open: true,
|
|
51
|
+
onClose: ()=>setOpen(false),
|
|
52
|
+
hostId: createHostId,
|
|
53
|
+
scope: scope,
|
|
54
|
+
emails: address ? [
|
|
55
|
+
address
|
|
56
|
+
] : []
|
|
57
|
+
}) : null
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
AddToListButton.displayName = 'AddToListButton';
|
|
62
|
+
export default AddToListButton;
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=add-to-list-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/add-to-list-button.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 type { AglynOrgBilling } from '@aglyn/aglyn'\nimport { Button } from '@mui/material'\nimport { useState } from 'react'\nimport { useCrmScope } from '../hooks/use-crm-scope'\nimport AddToListDialog from './add-to-list-dialog'\n\nexport interface AddToListButtonProps {\n /** The site the record is read under, or `null` at the organization level. */\n hostId: string | null\n /** The org the shell passed, so the scope needs no lookup when it has an id. */\n org?: Partial<AglynOrgBilling> | null\n /** The record the button sits on. */\n contactId: string\n /** The person's address; a contact with none cannot be on a list. */\n email: string | null | undefined\n}\n\n/**\n * \"Add to list\", for one person's page (AGL-2603).\n *\n * The bulk bar's dialog over a selection of one. It lives on the contact\n * record because that is where somebody reading about one person decides\n * they belong on the newsletter — and it opens the same checked, attested\n * door the selection uses, so the record page cannot enroll anyone the\n * audience page would refuse.\n */\nexport function AddToListButton(props: AddToListButtonProps) {\n const { hostId, org, email } = props\n // The audiences API takes the site whose console is asking: the mounted\n // one, or at the organization level the one the reader picked (AGL-2630).\n const { scope, createHostId } = useCrmScope({ hostId, org })\n const [open, setOpen] = useState(false)\n const address = String(email ?? '').trim()\n return (\n <>\n <Button\n size=\"small\"\n variant=\"outlined\"\n disabled={!scope || !address || !createHostId}\n onClick={() => setOpen(true)}\n >\n {'Add to list'}\n </Button>\n {open ? (\n <AddToListDialog\n open\n onClose={() => setOpen(false)}\n hostId={createHostId}\n scope={scope}\n emails={address ? [address] : []}\n />\n ) : null}\n </>\n )\n}\nAddToListButton.displayName = 'AddToListButton'\n\nexport default AddToListButton\n"],"names":["Button","useState","useCrmScope","AddToListDialog","AddToListButton","props","hostId","org","email","scope","createHostId","open","setOpen","address","String","trim","size","variant","disabled","onClick","onClose","emails","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAGA,SAASA,MAAM,QAAQ,gBAAe;AACtC,SAASC,QAAQ,QAAQ,QAAO;AAChC,SAASC,WAAW,QAAQ,4BAAwB;AACpD,OAAOC,qBAAqB,0BAAsB;AAalD;;;;;;;;CAQC,GACD,OAAO,SAASC,gBAAgBC,KAA2B;IACzD,MAAM,EAAEC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAAE,GAAGH;IAC/B,wEAAwE;IACxE,0EAA0E;IAC1E,MAAM,EAAEI,KAAK,EAAEC,YAAY,EAAE,GAAGR,YAAY;QAAEI;QAAQC;IAAI;IAC1D,MAAM,CAACI,MAAMC,QAAQ,GAAGX,SAAS;IACjC,MAAMY,UAAUC,OAAON,gBAAAA,QAAS,IAAIO,IAAI;IACxC,qBACE;;0BACE,KAACf;gBACCgB,MAAK;gBACLC,SAAQ;gBACRC,UAAU,CAACT,SAAS,CAACI,WAAW,CAACH;gBACjCS,SAAS,IAAMP,QAAQ;0BAEtB;;YAEFD,qBACC,KAACR;gBACCQ,IAAI;gBACJS,SAAS,IAAMR,QAAQ;gBACvBN,QAAQI;gBACRD,OAAOA;gBACPY,QAAQR,UAAU;oBAACA;iBAAQ,GAAG,EAAE;iBAEhC;;;AAGV;AACAT,gBAAgBkB,WAAW,GAAG;AAE9B,eAAelB,gBAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many addresses one call to the membership routes takes — their
|
|
3
|
+
* `readAddresses` cap. Named here because a request over it is refused
|
|
4
|
+
* whole, and a refusal of the whole selection reads as nobody being addable.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LIST_MEMBER_REQUEST_CHUNK = 100;
|
|
7
|
+
/** The audience picker's window; the Emails console's own pickers use it. */
|
|
8
|
+
export declare const AUDIENCE_PICKER_LIMIT = 50;
|
|
9
|
+
export interface AddToListDialogProps {
|
|
10
|
+
open: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
hostId: string;
|
|
13
|
+
/** `['orgs', orgId]`, or `null` while the org is still being resolved. */
|
|
14
|
+
scope: readonly [string, string] | null;
|
|
15
|
+
/** The people to add — a selection's addresses, or one person's. */
|
|
16
|
+
emails: readonly string[];
|
|
17
|
+
/** Called once with how many were enrolled, when at least one was. */
|
|
18
|
+
onAdded?: (added: number) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function AddToListDialog(props: AddToListDialogProps): import("react").JSX.Element;
|
|
21
|
+
export declare namespace AddToListDialog {
|
|
22
|
+
var displayName: string;
|
|
23
|
+
}
|
|
24
|
+
export default AddToListDialog;
|