@aglyn/plugins-crm 1.0.0-beta.220 → 1.0.0-beta.222
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/README.md +2 -1
- package/package.json +13 -13
- package/src/lib/components/activity-list.js +12 -5
- package/src/lib/components/activity-list.js.map +1 -1
- package/src/lib/components/companies-bulk-bar.d.ts +1 -4
- package/src/lib/components/companies-bulk-bar.js +7 -20
- package/src/lib/components/companies-bulk-bar.js.map +1 -1
- package/src/lib/components/companies-section.d.ts +3 -3
- package/src/lib/components/companies-section.js +149 -46
- package/src/lib/components/companies-section.js.map +1 -1
- package/src/lib/components/company-edit-drawer.js +281 -20
- package/src/lib/components/company-edit-drawer.js.map +1 -1
- package/src/lib/components/company-properties-card.js +99 -8
- package/src/lib/components/company-properties-card.js.map +1 -1
- package/src/lib/components/contact-detail-page.js +3 -1
- package/src/lib/components/contact-detail-page.js.map +1 -1
- package/src/lib/components/contact-merge-dialog.js +33 -10
- package/src/lib/components/contact-merge-dialog.js.map +1 -1
- package/src/lib/components/contact-properties-card.d.ts +0 -69
- package/src/lib/components/contact-properties-card.js +350 -60
- package/src/lib/components/contact-properties-card.js.map +1 -1
- package/src/lib/components/contact-reports-to-field.d.ts +46 -0
- package/src/lib/components/contact-reports-to-field.js +67 -0
- package/src/lib/components/contact-reports-to-field.js.map +1 -0
- package/src/lib/components/contacts-bulk-bar.d.ts +1 -8
- package/src/lib/components/contacts-bulk-bar.js +7 -19
- package/src/lib/components/contacts-bulk-bar.js.map +1 -1
- package/src/lib/components/contacts-section.js +46 -33
- package/src/lib/components/contacts-section.js.map +1 -1
- package/src/lib/components/crm-call-actions.d.ts +10 -0
- package/src/lib/components/crm-call-actions.js +26 -9
- package/src/lib/components/crm-call-actions.js.map +1 -1
- package/src/lib/components/crm-record-picker.d.ts +15 -0
- package/src/lib/components/crm-record-picker.js +16 -10
- package/src/lib/components/crm-record-picker.js.map +1 -1
- package/src/lib/components/crm-transfer-buttons.d.ts +54 -0
- package/src/lib/components/crm-transfer-buttons.js +167 -0
- package/src/lib/components/crm-transfer-buttons.js.map +1 -0
- package/src/lib/components/deal-contact-roles-card.d.ts +46 -0
- package/src/lib/components/deal-contact-roles-card.js +368 -0
- package/src/lib/components/deal-contact-roles-card.js.map +1 -0
- package/src/lib/components/deal-detail-page.d.ts +3 -2
- package/src/lib/components/deal-detail-page.js +25 -6
- package/src/lib/components/deal-detail-page.js.map +1 -1
- package/src/lib/components/deal-edit-drawer.d.ts +10 -0
- package/src/lib/components/deal-edit-drawer.js +219 -10
- package/src/lib/components/deal-edit-drawer.js.map +1 -1
- package/src/lib/components/deal-properties-card.d.ts +7 -0
- package/src/lib/components/deal-properties-card.js +34 -3
- package/src/lib/components/deal-properties-card.js.map +1 -1
- package/src/lib/components/deal-stage-card.d.ts +4 -0
- package/src/lib/components/deal-stage-card.js +10 -2
- package/src/lib/components/deal-stage-card.js.map +1 -1
- package/src/lib/components/deals-bulk-bar.d.ts +0 -3
- package/src/lib/components/deals-bulk-bar.js +7 -20
- package/src/lib/components/deals-bulk-bar.js.map +1 -1
- package/src/lib/components/deals-section.d.ts +3 -3
- package/src/lib/components/deals-section.js +123 -63
- package/src/lib/components/deals-section.js.map +1 -1
- package/src/lib/components/fields-section.js +31 -17
- package/src/lib/components/fields-section.js.map +1 -1
- package/src/lib/components/lead-convert-dialog.d.ts +4 -0
- package/src/lib/components/lead-convert-dialog.js +23 -1
- package/src/lib/components/lead-convert-dialog.js.map +1 -1
- package/src/lib/components/lead-detail-page.js +8 -2
- package/src/lib/components/lead-detail-page.js.map +1 -1
- package/src/lib/components/lead-profile-fields.d.ts +71 -0
- package/src/lib/components/lead-profile-fields.js +386 -0
- package/src/lib/components/lead-profile-fields.js.map +1 -0
- package/src/lib/components/lead-properties-card.d.ts +2 -1
- package/src/lib/components/lead-properties-card.js +85 -176
- package/src/lib/components/lead-properties-card.js.map +1 -1
- package/src/lib/components/lead-source-select.d.ts +4 -23
- package/src/lib/components/lead-source-select.js +9 -73
- package/src/lib/components/lead-source-select.js.map +1 -1
- package/src/lib/components/lead-status-chip.d.ts +9 -3
- package/src/lib/components/lead-status-chip.js +8 -4
- package/src/lib/components/lead-status-chip.js.map +1 -1
- package/src/lib/components/lead-status-options.d.ts +20 -0
- package/src/lib/components/lead-status-options.js +51 -0
- package/src/lib/components/lead-status-options.js.map +1 -0
- package/src/lib/components/lead-unqualify-dialog.d.ts +5 -0
- package/src/lib/components/lead-unqualify-dialog.js +50 -18
- package/src/lib/components/lead-unqualify-dialog.js.map +1 -1
- package/src/lib/components/leads-bulk-bar.d.ts +0 -3
- package/src/lib/components/leads-bulk-bar.js +29 -29
- package/src/lib/components/leads-bulk-bar.js.map +1 -1
- package/src/lib/components/leads-section.js +120 -68
- package/src/lib/components/leads-section.js.map +1 -1
- package/src/lib/components/linked-deals-card.d.ts +4 -0
- package/src/lib/components/linked-deals-card.js +47 -3
- package/src/lib/components/linked-deals-card.js.map +1 -1
- package/src/lib/components/log-activity-dialog.js +43 -3
- package/src/lib/components/log-activity-dialog.js.map +1 -1
- package/src/lib/components/new-contact-drawer.d.ts +8 -0
- package/src/lib/components/new-contact-drawer.js +108 -6
- package/src/lib/components/new-contact-drawer.js.map +1 -1
- package/src/lib/components/new-lead-drawer.d.ts +9 -2
- package/src/lib/components/new-lead-drawer.js +88 -121
- package/src/lib/components/new-lead-drawer.js.map +1 -1
- package/src/lib/components/picklist-select.d.ts +36 -0
- package/src/lib/components/picklist-select.js +114 -0
- package/src/lib/components/picklist-select.js.map +1 -0
- package/src/lib/components/picklist-values-card.d.ts +34 -0
- package/src/lib/components/{lead-source-values-card.js → picklist-values-card.js} +241 -58
- package/src/lib/components/picklist-values-card.js.map +1 -0
- package/src/lib/components/pipeline-stages-dialog.d.ts +7 -0
- package/src/lib/components/pipeline-stages-dialog.js +26 -4
- package/src/lib/components/pipeline-stages-dialog.js.map +1 -1
- package/src/lib/components/pipelines-dialog.js +15 -6
- package/src/lib/components/pipelines-dialog.js.map +1 -1
- package/src/lib/components/recent-activity-feed.js +20 -5
- package/src/lib/components/recent-activity-feed.js.map +1 -1
- package/src/lib/components/recipes-card.js +4 -2
- package/src/lib/components/recipes-card.js.map +1 -1
- package/src/lib/components/record-tasks-card.js +15 -8
- package/src/lib/components/record-tasks-card.js.map +1 -1
- package/src/lib/components/reports/forecast-card.d.ts +6 -0
- package/src/lib/components/reports/forecast-card.js +101 -3
- package/src/lib/components/reports/forecast-card.js.map +1 -1
- package/src/lib/components/reports/lead-funnel-card.d.ts +12 -0
- package/src/lib/components/reports/lead-funnel-card.js +9 -5
- package/src/lib/components/reports/lead-funnel-card.js.map +1 -1
- package/src/lib/components/reports/lead-source-card.d.ts +23 -0
- package/src/lib/components/reports/lead-source-card.js +318 -0
- package/src/lib/components/reports/lead-source-card.js.map +1 -0
- package/src/lib/components/reports/report-export.js +1 -1
- package/src/lib/components/reports/report-export.js.map +1 -1
- package/src/lib/components/reports-section.js +8 -0
- package/src/lib/components/reports-section.js.map +1 -1
- package/src/lib/components/sharing-rule-drawer.d.ts +5 -0
- package/src/lib/components/sharing-rule-drawer.js +108 -19
- package/src/lib/components/sharing-rule-drawer.js.map +1 -1
- package/src/lib/components/sharing-rules-card.js +11 -3
- package/src/lib/components/sharing-rules-card.js.map +1 -1
- package/src/lib/components/task-cells.d.ts +9 -1
- package/src/lib/components/task-cells.js +9 -4
- package/src/lib/components/task-cells.js.map +1 -1
- package/src/lib/components/task-edit-drawer.js +111 -43
- package/src/lib/components/task-edit-drawer.js.map +1 -1
- package/src/lib/components/tasks-bulk-bar.d.ts +0 -3
- package/src/lib/components/tasks-bulk-bar.js +7 -20
- package/src/lib/components/tasks-bulk-bar.js.map +1 -1
- package/src/lib/components/tasks-calendar.d.ts +3 -0
- package/src/lib/components/tasks-calendar.js +8 -1
- package/src/lib/components/tasks-calendar.js.map +1 -1
- package/src/lib/components/tasks-section.d.ts +3 -3
- package/src/lib/components/tasks-section.js +58 -43
- package/src/lib/components/tasks-section.js.map +1 -1
- package/src/lib/constants/api-routes.d.ts +2 -9
- package/src/lib/constants/api-routes.js +1 -7
- package/src/lib/constants/api-routes.js.map +1 -1
- package/src/lib/constants/bundle-common.d.ts +6 -0
- package/src/lib/constants/bundle-common.js +11 -0
- package/src/lib/constants/bundle-common.js.map +1 -1
- package/src/lib/constants/company-filters.d.ts +14 -0
- package/src/lib/constants/company-filters.js +51 -1
- package/src/lib/constants/company-filters.js.map +1 -1
- package/src/lib/constants/contact-filters.d.ts +2 -0
- package/src/lib/constants/contact-filters.js +18 -1
- package/src/lib/constants/contact-filters.js.map +1 -1
- package/src/lib/constants/deal-filters.d.ts +22 -1
- package/src/lib/constants/deal-filters.js +67 -4
- package/src/lib/constants/deal-filters.js.map +1 -1
- package/src/lib/declarations.console-server.d.ts +3 -0
- package/src/lib/declarations.console-server.js +35 -0
- package/src/lib/declarations.console-server.js.map +1 -1
- package/src/lib/declarations.d.ts +26 -0
- package/src/lib/declarations.js +35 -0
- package/src/lib/declarations.js.map +1 -0
- package/src/lib/declarations.server.d.ts +11 -0
- package/src/lib/declarations.server.js +92 -1
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/hooks/use-company-picklists.d.ts +15 -0
- package/src/lib/hooks/use-company-picklists.js +55 -0
- package/src/lib/hooks/use-company-picklists.js.map +1 -0
- package/src/lib/hooks/use-crm-picklist.d.ts +25 -0
- package/src/lib/hooks/use-crm-picklist.js +53 -0
- package/src/lib/hooks/use-crm-picklist.js.map +1 -0
- package/src/lib/hooks/use-crm-record-names.d.ts +16 -0
- package/src/lib/hooks/use-crm-record-names.js +45 -19
- package/src/lib/hooks/use-crm-record-names.js.map +1 -1
- package/src/lib/hooks/use-crm-task-picklists.d.ts +11 -0
- package/src/lib/hooks/use-crm-task-picklists.js +45 -0
- package/src/lib/hooks/use-crm-task-picklists.js.map +1 -0
- package/src/lib/hooks/use-deals.d.ts +14 -0
- package/src/lib/hooks/use-deals.js +29 -0
- package/src/lib/hooks/use-deals.js.map +1 -1
- package/src/lib/hooks/use-lead-picklists.d.ts +14 -0
- package/src/lib/hooks/use-lead-picklists.js +46 -0
- package/src/lib/hooks/use-lead-picklists.js.map +1 -0
- package/src/lib/hooks/use-lead-source-picklist.d.ts +5 -19
- package/src/lib/hooks/use-lead-source-picklist.js +12 -22
- package/src/lib/hooks/use-lead-source-picklist.js.map +1 -1
- package/src/lib/hooks/use-lead-status-picklist.d.ts +9 -0
- package/src/lib/hooks/use-lead-status-picklist.js +40 -0
- package/src/lib/hooks/use-lead-status-picklist.js.map +1 -0
- package/src/lib/model/companies.d.ts +32 -3
- package/src/lib/model/companies.js +133 -16
- package/src/lib/model/companies.js.map +1 -1
- package/src/lib/model/contact-merge.d.ts +27 -3
- package/src/lib/model/contact-merge.js +81 -7
- package/src/lib/model/contact-merge.js.map +1 -1
- package/src/lib/model/contact-record.d.ts +17 -0
- package/src/lib/model/contact-record.js +15 -1
- package/src/lib/model/contact-record.js.map +1 -1
- package/src/lib/model/contact-update.d.ts +31 -2
- package/src/lib/model/contact-update.js +14 -0
- package/src/lib/model/contact-update.js.map +1 -1
- package/src/lib/model/crm-list-query.d.ts +5 -0
- package/src/lib/model/crm-list-query.js +8 -0
- package/src/lib/model/crm-list-query.js.map +1 -1
- package/src/lib/model/crm-recipes.d.ts +40 -0
- package/src/lib/model/crm-recipes.js +244 -0
- package/src/lib/model/crm-recipes.js.map +1 -0
- package/src/lib/model/crm-record-counts.d.ts +36 -0
- package/src/lib/model/crm-record-counts.js +54 -0
- package/src/lib/model/crm-record-counts.js.map +1 -0
- package/src/lib/model/crm-record-lists.d.ts +23 -0
- package/src/lib/model/crm-record-lists.js +161 -0
- package/src/lib/model/crm-record-lists.js.map +1 -0
- package/src/lib/model/crm-reports.d.ts +73 -3
- package/src/lib/model/crm-reports.js +120 -1
- package/src/lib/model/crm-reports.js.map +1 -1
- package/src/lib/model/crm-sharing.d.ts +21 -3
- package/src/lib/model/crm-sharing.js +27 -6
- package/src/lib/model/crm-sharing.js.map +1 -1
- package/src/lib/model/deal-board-model.d.ts +8 -2
- package/src/lib/model/deal-board-model.js +15 -2
- package/src/lib/model/deal-board-model.js.map +1 -1
- package/src/lib/model/deal-contact-roles.d.ts +45 -0
- package/src/lib/model/deal-contact-roles.js +73 -0
- package/src/lib/model/deal-contact-roles.js.map +1 -0
- package/src/lib/model/deal-form-model.d.ts +56 -0
- package/src/lib/model/deal-form-model.js +79 -7
- package/src/lib/model/deal-form-model.js.map +1 -1
- package/src/lib/model/download-text-file.d.ts +23 -0
- package/src/lib/model/download-text-file.js +34 -0
- package/src/lib/model/download-text-file.js.map +1 -0
- package/src/lib/model/lead-filters.d.ts +36 -2
- package/src/lib/model/lead-filters.js +123 -2
- package/src/lib/model/lead-filters.js.map +1 -1
- package/src/lib/model/lead-source-direction.d.ts +38 -0
- package/src/lib/model/lead-source-direction.js +52 -0
- package/src/lib/model/lead-source-direction.js.map +1 -0
- package/src/lib/model/picklist-values.d.ts +119 -0
- package/src/lib/model/picklist-values.js +256 -0
- package/src/lib/model/picklist-values.js.map +1 -0
- package/src/lib/model/record-facts-disclosed.d.ts +81 -0
- package/src/lib/model/record-facts-disclosed.js +281 -0
- package/src/lib/model/record-facts-disclosed.js.map +1 -0
- package/src/lib/model/record-facts.d.ts +215 -34
- package/src/lib/model/record-facts.js +307 -128
- package/src/lib/model/record-facts.js.map +1 -1
- package/src/lib/model/task-picklists.d.ts +52 -0
- package/src/lib/model/task-picklists.js +83 -0
- package/src/lib/model/task-picklists.js.map +1 -0
- package/src/lib/model/task-routes.d.ts +13 -0
- package/src/lib/model/task-routes.js +23 -4
- package/src/lib/model/task-routes.js.map +1 -1
- package/src/lib/plan-entitlements.js +6 -4
- package/src/lib/plan-entitlements.js.map +1 -1
- package/src/lib/plugin.js +17 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/api-v1/contacts.js +220 -14
- package/src/lib/server/api-v1/contacts.js.map +1 -1
- package/src/lib/server/api-v1/crm-activities.js +14 -1
- package/src/lib/server/api-v1/crm-activities.js.map +1 -1
- package/src/lib/server/api-v1/crm-companies.js +123 -14
- package/src/lib/server/api-v1/crm-companies.js.map +1 -1
- package/src/lib/server/api-v1/crm-deals.js +291 -26
- package/src/lib/server/api-v1/crm-deals.js.map +1 -1
- package/src/lib/server/api-v1/crm-leads.js +144 -38
- package/src/lib/server/api-v1/crm-leads.js.map +1 -1
- package/src/lib/server/api-v1/crm-pipelines.d.ts +6 -0
- package/src/lib/server/api-v1/crm-pipelines.js +8 -2
- package/src/lib/server/api-v1/crm-pipelines.js.map +1 -1
- package/src/lib/server/api-v1/crm-tasks.js +75 -33
- package/src/lib/server/api-v1/crm-tasks.js.map +1 -1
- package/src/lib/server/api-v1/openapi.d.ts +0 -11
- package/src/lib/server/api-v1/openapi.js +171 -16
- package/src/lib/server/api-v1/openapi.js.map +1 -1
- package/src/lib/server/assign-contact-owner.d.ts +162 -0
- package/src/lib/server/assign-contact-owner.js +340 -0
- package/src/lib/server/assign-contact-owner.js.map +1 -0
- package/src/lib/server/associate-company-by-domain.d.ts +70 -0
- package/src/lib/server/associate-company-by-domain.js +153 -0
- package/src/lib/server/associate-company-by-domain.js.map +1 -0
- package/src/lib/server/automation-steps.d.ts +139 -0
- package/src/lib/server/automation-steps.js +472 -0
- package/src/lib/server/automation-steps.js.map +1 -0
- package/src/lib/server/capture-contact.js +69 -22
- package/src/lib/server/capture-contact.js.map +1 -1
- package/src/lib/server/capture-host-contact.d.ts +104 -0
- package/src/lib/server/capture-host-contact.js +151 -0
- package/src/lib/server/capture-host-contact.js.map +1 -0
- package/src/lib/server/company-children.d.ts +25 -0
- package/src/lib/server/company-children.js +42 -0
- package/src/lib/server/company-children.js.map +1 -0
- package/src/lib/server/company-delete.d.ts +18 -0
- package/src/lib/server/company-delete.js +44 -21
- package/src/lib/server/company-delete.js.map +1 -1
- package/src/lib/server/contact-email-history.js +21 -19
- package/src/lib/server/contact-email-history.js.map +1 -1
- package/src/lib/server/contact-remove.js +27 -2
- package/src/lib/server/contact-remove.js.map +1 -1
- package/src/lib/server/contact-reports-to.d.ts +61 -0
- package/src/lib/server/contact-reports-to.js +114 -0
- package/src/lib/server/contact-reports-to.js.map +1 -0
- package/src/lib/server/contact-update.d.ts +42 -1
- package/src/lib/server/contact-update.js +204 -23
- package/src/lib/server/contact-update.js.map +1 -1
- package/src/lib/server/convert-host-lead.d.ts +46 -1
- package/src/lib/server/convert-host-lead.js +173 -15
- package/src/lib/server/convert-host-lead.js.map +1 -1
- package/src/lib/server/convert-open-lead.js +12 -5
- package/src/lib/server/convert-open-lead.js.map +1 -1
- package/src/lib/server/crm-record-indexes.d.ts +45 -0
- package/src/lib/server/crm-record-indexes.js +78 -0
- package/src/lib/server/crm-record-indexes.js.map +1 -0
- package/src/lib/server/crm-sharing.d.ts +9 -1
- package/src/lib/server/crm-sharing.js +23 -3
- package/src/lib/server/crm-sharing.js.map +1 -1
- package/src/lib/server/deal-contact-roles.d.ts +27 -0
- package/src/lib/server/deal-contact-roles.js +89 -0
- package/src/lib/server/deal-contact-roles.js.map +1 -0
- package/src/lib/server/lead-convert.d.ts +5 -0
- package/src/lib/server/lead-convert.js +19 -3
- package/src/lib/server/lead-convert.js.map +1 -1
- package/src/lib/server/lead-create.d.ts +17 -2
- package/src/lib/server/lead-create.js +46 -14
- package/src/lib/server/lead-create.js.map +1 -1
- package/src/lib/server/lead-nurturing.d.ts +6 -0
- package/src/lib/server/lead-nurturing.js +57 -20
- package/src/lib/server/lead-nurturing.js.map +1 -1
- package/src/lib/server/lead-picklists.d.ts +35 -0
- package/src/lib/server/lead-picklists.js +52 -0
- package/src/lib/server/lead-picklists.js.map +1 -0
- package/src/lib/server/lead-source-picklist.d.ts +1 -13
- package/src/lib/server/lead-source-picklist.js +6 -33
- package/src/lib/server/lead-source-picklist.js.map +1 -1
- package/src/lib/server/merge-contacts.js +22 -4
- package/src/lib/server/merge-contacts.js.map +1 -1
- package/src/lib/server/person-eraser.d.ts +53 -0
- package/src/lib/server/person-eraser.js +149 -0
- package/src/lib/server/person-eraser.js.map +1 -0
- package/src/lib/server/person-records.d.ts +69 -0
- package/src/lib/server/person-records.js +317 -0
- package/src/lib/server/person-records.js.map +1 -0
- package/src/lib/server/person-refund.d.ts +97 -0
- package/src/lib/server/person-refund.js +221 -0
- package/src/lib/server/person-refund.js.map +1 -0
- package/src/lib/server/picklist-values.d.ts +21 -0
- package/src/lib/server/picklist-values.js +308 -0
- package/src/lib/server/picklist-values.js.map +1 -0
- package/src/lib/server/read-picklist.d.ts +44 -0
- package/src/lib/server/read-picklist.js +65 -0
- package/src/lib/server/read-picklist.js.map +1 -0
- package/src/lib/server/recipe-routes.js +15 -7
- package/src/lib/server/recipe-routes.js.map +1 -1
- package/src/lib/server/record-email-state.js +7 -1
- package/src/lib/server/record-email-state.js.map +1 -1
- package/src/lib/server/record-facts.d.ts +3 -0
- package/src/lib/server/record-facts.js +233 -31
- package/src/lib/server/record-facts.js.map +1 -1
- package/src/lib/server/record-origin.d.ts +27 -0
- package/src/lib/server/record-origin.js +104 -0
- package/src/lib/server/record-origin.js.map +1 -0
- package/src/lib/server/record-timeline.js +15 -2
- package/src/lib/server/record-timeline.js.map +1 -1
- package/src/lib/server/suite-gate.js +4 -3
- package/src/lib/server/suite-gate.js.map +1 -1
- package/src/lib/server/task-routes.js +30 -16
- package/src/lib/server/task-routes.js.map +1 -1
- package/src/lib/server-deal-stage.d.ts +5 -1
- package/src/lib/server-deal-stage.js +10 -5
- package/src/lib/server-deal-stage.js.map +1 -1
- package/src/lib/server.d.ts +8 -3
- package/src/lib/server.js +47 -43
- package/src/lib/server.js.map +1 -1
- package/src/lib/testing/memory-firestore.d.ts +55 -0
- package/src/lib/testing/memory-firestore.js +335 -0
- package/src/lib/testing/memory-firestore.js.map +1 -0
- package/src/lib/testing/stand-in-email-send-index.d.ts +25 -0
- package/src/lib/testing/stand-in-email-send-index.js +49 -0
- package/src/lib/testing/stand-in-email-send-index.js.map +1 -0
- package/src/lib/transfer/activities.d.ts +30 -0
- package/src/lib/transfer/activities.js +132 -0
- package/src/lib/transfer/activities.js.map +1 -0
- package/src/lib/transfer/aliases.d.ts +22 -0
- package/src/lib/transfer/aliases.js +1342 -0
- package/src/lib/transfer/aliases.js.map +1 -0
- package/src/lib/transfer/common.d.ts +222 -0
- package/src/lib/transfer/common.js +832 -0
- package/src/lib/transfer/common.js.map +1 -0
- package/src/lib/transfer/companies.d.ts +43 -0
- package/src/lib/transfer/companies.js +549 -0
- package/src/lib/transfer/companies.js.map +1 -0
- package/src/lib/transfer/contacts.d.ts +31 -0
- package/src/lib/transfer/contacts.js +727 -0
- package/src/lib/transfer/contacts.js.map +1 -0
- package/src/lib/transfer/deals.d.ts +66 -0
- package/src/lib/transfer/deals.js +698 -0
- package/src/lib/transfer/deals.js.map +1 -0
- package/src/lib/transfer/email-templates-package.d.ts +40 -0
- package/src/lib/transfer/email-templates-package.js +76 -0
- package/src/lib/transfer/email-templates-package.js.map +1 -0
- package/src/lib/transfer/email-templates-package.server.d.ts +32 -0
- package/src/lib/transfer/email-templates-package.server.js +176 -0
- package/src/lib/transfer/email-templates-package.server.js.map +1 -0
- package/src/lib/transfer/fields.d.ts +102 -0
- package/src/lib/transfer/fields.js +1755 -0
- package/src/lib/transfer/fields.js.map +1 -0
- package/src/lib/transfer/leads.d.ts +30 -0
- package/src/lib/transfer/leads.js +582 -0
- package/src/lib/transfer/leads.js.map +1 -0
- package/src/lib/transfer/pipelines.d.ts +21 -0
- package/src/lib/transfer/pipelines.js +172 -0
- package/src/lib/transfer/pipelines.js.map +1 -0
- package/src/lib/transfer/register.d.ts +47 -0
- package/src/lib/transfer/register.js +277 -0
- package/src/lib/transfer/register.js.map +1 -0
- package/src/lib/transfer/tasks.d.ts +30 -0
- package/src/lib/transfer/tasks.js +418 -0
- package/src/lib/transfer/tasks.js.map +1 -0
- package/src/lib/transfer/ui.d.ts +20 -0
- package/src/lib/transfer/ui.js +42 -0
- package/src/lib/transfer/ui.js.map +1 -0
- package/src/lib/components/company-import-drawer.d.ts +0 -42
- package/src/lib/components/company-import-drawer.js +0 -99
- package/src/lib/components/company-import-drawer.js.map +0 -1
- package/src/lib/components/contact-import-drawer.d.ts +0 -46
- package/src/lib/components/contact-import-drawer.js +0 -149
- package/src/lib/components/contact-import-drawer.js.map +0 -1
- package/src/lib/components/crm-export-all-button.d.ts +0 -39
- package/src/lib/components/crm-export-all-button.js +0 -98
- package/src/lib/components/crm-export-all-button.js.map +0 -1
- package/src/lib/components/csv-import-drawer.d.ts +0 -139
- package/src/lib/components/csv-import-drawer.js +0 -757
- package/src/lib/components/csv-import-drawer.js.map +0 -1
- package/src/lib/components/deal-import-drawer.d.ts +0 -24
- package/src/lib/components/deal-import-drawer.js +0 -83
- package/src/lib/components/deal-import-drawer.js.map +0 -1
- package/src/lib/components/lead-import-drawer.d.ts +0 -27
- package/src/lib/components/lead-import-drawer.js +0 -118
- package/src/lib/components/lead-import-drawer.js.map +0 -1
- package/src/lib/components/lead-source-values-card.d.ts +0 -27
- package/src/lib/components/lead-source-values-card.js.map +0 -1
- package/src/lib/components/task-import-drawer.d.ts +0 -24
- package/src/lib/components/task-import-drawer.js +0 -82
- package/src/lib/components/task-import-drawer.js.map +0 -1
- package/src/lib/model/companies-csv.d.ts +0 -36
- package/src/lib/model/companies-csv.js +0 -38
- package/src/lib/model/companies-csv.js.map +0 -1
- package/src/lib/model/contacts-csv.d.ts +0 -54
- package/src/lib/model/contacts-csv.js +0 -67
- package/src/lib/model/contacts-csv.js.map +0 -1
- package/src/lib/model/crm-company-import.d.ts +0 -154
- package/src/lib/model/crm-company-import.js +0 -331
- package/src/lib/model/crm-company-import.js.map +0 -1
- package/src/lib/model/crm-csv.d.ts +0 -239
- package/src/lib/model/crm-csv.js +0 -467
- package/src/lib/model/crm-csv.js.map +0 -1
- package/src/lib/model/crm-deal-import.d.ts +0 -112
- package/src/lib/model/crm-deal-import.js +0 -263
- package/src/lib/model/crm-deal-import.js.map +0 -1
- package/src/lib/model/crm-import.d.ts +0 -250
- package/src/lib/model/crm-import.js +0 -467
- package/src/lib/model/crm-import.js.map +0 -1
- package/src/lib/model/crm-lead-import.d.ts +0 -138
- package/src/lib/model/crm-lead-import.js +0 -446
- package/src/lib/model/crm-lead-import.js.map +0 -1
- package/src/lib/model/crm-task-import.d.ts +0 -94
- package/src/lib/model/crm-task-import.js +0 -275
- package/src/lib/model/crm-task-import.js.map +0 -1
- package/src/lib/model/deals-csv.d.ts +0 -32
- package/src/lib/model/deals-csv.js +0 -36
- package/src/lib/model/deals-csv.js.map +0 -1
- package/src/lib/model/import-column-shapes.d.ts +0 -36
- package/src/lib/model/import-column-shapes.js +0 -76
- package/src/lib/model/import-column-shapes.js.map +0 -1
- package/src/lib/model/lead-source-values.d.ts +0 -82
- package/src/lib/model/lead-source-values.js +0 -149
- package/src/lib/model/lead-source-values.js.map +0 -1
- package/src/lib/model/leads-csv.d.ts +0 -40
- package/src/lib/model/leads-csv.js +0 -40
- package/src/lib/model/leads-csv.js.map +0 -1
- package/src/lib/model/tasks-csv.d.ts +0 -28
- package/src/lib/model/tasks-csv.js +0 -28
- package/src/lib/model/tasks-csv.js.map +0 -1
- package/src/lib/server/companies-import.d.ts +0 -57
- package/src/lib/server/companies-import.js +0 -242
- package/src/lib/server/companies-import.js.map +0 -1
- package/src/lib/server/contacts-import.d.ts +0 -109
- package/src/lib/server/contacts-import.js +0 -393
- package/src/lib/server/contacts-import.js.map +0 -1
- package/src/lib/server/deals-import.d.ts +0 -76
- package/src/lib/server/deals-import.js +0 -248
- package/src/lib/server/deals-import.js.map +0 -1
- package/src/lib/server/export-route.d.ts +0 -60
- package/src/lib/server/export-route.js +0 -447
- package/src/lib/server/export-route.js.map +0 -1
- package/src/lib/server/import-context.d.ts +0 -87
- package/src/lib/server/import-context.js +0 -182
- package/src/lib/server/import-context.js.map +0 -1
- package/src/lib/server/lead-source-values.d.ts +0 -50
- package/src/lib/server/lead-source-values.js +0 -191
- package/src/lib/server/lead-source-values.js.map +0 -1
- package/src/lib/server/leads-import.d.ts +0 -84
- package/src/lib/server/leads-import.js +0 -367
- package/src/lib/server/leads-import.js.map +0 -1
- package/src/lib/server/tasks-import.d.ts +0 -54
- package/src/lib/server/tasks-import.js +0 -160
- package/src/lib/server/tasks-import.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
*/ import { CRM_LEAD_SOURCE_PICKLIST, crmPicklistDefinition, crmPicklistValueByLabel, effectiveCrmLeadSourcePicklist } from "@aglyn/aglyn/app-utils/crm";
|
|
17
|
+
export const LEAD_SOURCE_DIRECTIONS = [
|
|
18
|
+
'inbound',
|
|
19
|
+
'outbound'
|
|
20
|
+
];
|
|
21
|
+
/** How each direction reads, from the picklist's own group labels. */ export const LEAD_SOURCE_DIRECTION_LABELS = {
|
|
22
|
+
inbound: groupLabel('inbound', 'Inbound'),
|
|
23
|
+
outbound: groupLabel('outbound', 'Outbound')
|
|
24
|
+
};
|
|
25
|
+
/** A lead with no lead source, or one in no group. */ export const LEAD_SOURCE_UNSPECIFIED_LABEL = 'Unspecified';
|
|
26
|
+
function groupLabel(id, fallback) {
|
|
27
|
+
var _ref, _ref1;
|
|
28
|
+
var _crmPicklistDefinition, _groups_find;
|
|
29
|
+
const groups = (_ref = (_crmPicklistDefinition = crmPicklistDefinition(CRM_LEAD_SOURCE_PICKLIST)) == null ? void 0 : _crmPicklistDefinition.groups) != null ? _ref : [];
|
|
30
|
+
return (_ref1 = (_groups_find = groups.find((group)=>group.id === id)) == null ? void 0 : _groups_find.label) != null ? _ref1 : fallback;
|
|
31
|
+
}
|
|
32
|
+
export function isLeadSourceDirection(value) {
|
|
33
|
+
return LEAD_SOURCE_DIRECTIONS.includes(value);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The direction a lead source label has in `picklist` — `null` for no label,
|
|
37
|
+
* a value in no group, or a label the list does not hold.
|
|
38
|
+
*/ export function leadSourceDirectionOf(picklist, label) {
|
|
39
|
+
var _crmPicklistValueByLabel;
|
|
40
|
+
const group = (_crmPicklistValueByLabel = crmPicklistValueByLabel(picklist, label)) == null ? void 0 : _crmPicklistValueByLabel.group;
|
|
41
|
+
return isLeadSourceDirection(group) ? group : null;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Every label in `picklist` whose value is in `direction` — the inactive
|
|
45
|
+
* ones too, since a record keeps a value after it is deactivated and a
|
|
46
|
+
* direction asked of the records must still find it.
|
|
47
|
+
*/ export function leadSourceLabelsOfDirection(picklist, direction) {
|
|
48
|
+
return picklist.values.filter((value)=>value.group === direction).map((value)=>value.label);
|
|
49
|
+
}
|
|
50
|
+
/** The standard values alone — the answer before an organization's own list is read. */ export const STANDARD_LEAD_SOURCES = effectiveCrmLeadSourcePicklist(null);
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=lead-source-direction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/lead-source-direction.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\nimport {\n CRM_LEAD_SOURCE_PICKLIST,\n type CrmPicklist,\n crmPicklistDefinition,\n crmPicklistValueByLabel,\n effectiveCrmLeadSourcePicklist,\n} from '@aglyn/aglyn/app-utils/crm'\n\n/*==========================================\n * A LEAD SOURCE'S DIRECTION (AGL-3511).\n *\n * Every lead source value sits in a group of the Lead source picklist —\n * Inbound for a person who came to the organization, Outbound for one the\n * organization went to — or in none. The direction is never stored on a\n * record: a record stores the label, and the label's group is read off the\n * organization's list when it is asked, so moving a value between groups\n * moves every record that holds it — in a filter, a sharing rule and the\n * Lead sources report alike.\n *=========================================*/\n\n/** The directions a lead source can have: the Lead source picklist's groups. */\nexport type LeadSourceDirection = 'inbound' | 'outbound'\n\nexport const LEAD_SOURCE_DIRECTIONS: readonly LeadSourceDirection[] = ['inbound', 'outbound']\n\n/** How each direction reads, from the picklist's own group labels. */\nexport const LEAD_SOURCE_DIRECTION_LABELS: Readonly<Record<LeadSourceDirection, string>> = {\n inbound: groupLabel('inbound', 'Inbound'),\n outbound: groupLabel('outbound', 'Outbound'),\n}\n\n/** A lead with no lead source, or one in no group. */\nexport const LEAD_SOURCE_UNSPECIFIED_LABEL = 'Unspecified'\n\nfunction groupLabel(id: LeadSourceDirection, fallback: string): string {\n const groups = crmPicklistDefinition(CRM_LEAD_SOURCE_PICKLIST)?.groups ?? []\n return groups.find((group) => group.id === id)?.label ?? fallback\n}\n\nexport function isLeadSourceDirection(value: unknown): value is LeadSourceDirection {\n return (LEAD_SOURCE_DIRECTIONS as readonly unknown[]).includes(value)\n}\n\n/**\n * The direction a lead source label has in `picklist` — `null` for no label,\n * a value in no group, or a label the list does not hold.\n */\nexport function leadSourceDirectionOf(\n picklist: CrmPicklist,\n label: unknown,\n): LeadSourceDirection | null {\n const group = crmPicklistValueByLabel(picklist, label)?.group\n return isLeadSourceDirection(group) ? group : null\n}\n\n/**\n * Every label in `picklist` whose value is in `direction` — the inactive\n * ones too, since a record keeps a value after it is deactivated and a\n * direction asked of the records must still find it.\n */\nexport function leadSourceLabelsOfDirection(\n picklist: CrmPicklist,\n direction: LeadSourceDirection,\n): string[] {\n return picklist.values.filter((value) => value.group === direction).map((value) => value.label)\n}\n\n/** The standard values alone — the answer before an organization's own list is read. */\nexport const STANDARD_LEAD_SOURCES: CrmPicklist = effectiveCrmLeadSourcePicklist(null)\n"],"names":["CRM_LEAD_SOURCE_PICKLIST","crmPicklistDefinition","crmPicklistValueByLabel","effectiveCrmLeadSourcePicklist","LEAD_SOURCE_DIRECTIONS","LEAD_SOURCE_DIRECTION_LABELS","inbound","groupLabel","outbound","LEAD_SOURCE_UNSPECIFIED_LABEL","id","fallback","groups","find","group","label","isLeadSourceDirection","value","includes","leadSourceDirectionOf","picklist","leadSourceLabelsOfDirection","direction","values","filter","map","STANDARD_LEAD_SOURCES"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,wBAAwB,EAExBC,qBAAqB,EACrBC,uBAAuB,EACvBC,8BAA8B,QACzB,6BAA4B;AAiBnC,OAAO,MAAMC,yBAAyD;IAAC;IAAW;CAAW,CAAA;AAE7F,oEAAoE,GACpE,OAAO,MAAMC,+BAA8E;IACzFC,SAASC,WAAW,WAAW;IAC/BC,UAAUD,WAAW,YAAY;AACnC,EAAC;AAED,oDAAoD,GACpD,OAAO,MAAME,gCAAgC,cAAa;AAE1D,SAASF,WAAWG,EAAuB,EAAEC,QAAgB;;QAC5CV,wBACRW;IADP,MAAMA,kBAASX,yBAAAA,sBAAsBD,8CAAtBC,uBAAiDW,MAAM,mBAAI,EAAE;IAC5E,iBAAOA,eAAAA,OAAOC,IAAI,CAAC,CAACC,QAAUA,MAAMJ,EAAE,KAAKA,wBAApCE,aAAyCG,KAAK,oBAAIJ;AAC3D;AAEA,OAAO,SAASK,sBAAsBC,KAAc;IAClD,OAAO,AAACb,uBAA8Cc,QAAQ,CAACD;AACjE;AAEA;;;CAGC,GACD,OAAO,SAASE,sBACdC,QAAqB,EACrBL,KAAc;QAEAb;IAAd,MAAMY,SAAQZ,2BAAAA,wBAAwBkB,UAAUL,2BAAlCb,yBAA0CY,KAAK;IAC7D,OAAOE,sBAAsBF,SAASA,QAAQ;AAChD;AAEA;;;;CAIC,GACD,OAAO,SAASO,4BACdD,QAAqB,EACrBE,SAA8B;IAE9B,OAAOF,SAASG,MAAM,CAACC,MAAM,CAAC,CAACP,QAAUA,MAAMH,KAAK,KAAKQ,WAAWG,GAAG,CAAC,CAACR,QAAUA,MAAMF,KAAK;AAChG;AAEA,sFAAsF,GACtF,OAAO,MAAMW,wBAAqCvB,+BAA+B,MAAK"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
import { type CrmPicklist, type CrmPicklistDefinition, type CrmPicklistId, type CrmPicklistObject, type CrmPicklistValue } from '@aglyn/aglyn/app-utils/crm';
|
|
18
|
+
/**
|
|
19
|
+
* A PICKLIST'S EDITS (AGL-3298, AGL-3510), as pure moves over a list.
|
|
20
|
+
*
|
|
21
|
+
* The Fields page applies the ones that touch only the list — add, reorder,
|
|
22
|
+
* sort, activate, deactivate, group, default — as one client write of the
|
|
23
|
+
* whole document. The two that change what RECORDS hold — a rename and a
|
|
24
|
+
* delete with its replacement — go to `crm/picklist-values`, which rewrites
|
|
25
|
+
* the list and every record the definition's targets name in one request;
|
|
26
|
+
* this module is where both sides agree what each move does.
|
|
27
|
+
*
|
|
28
|
+
* Each move that depends on the field takes its definition: a standard
|
|
29
|
+
* value cannot be deleted, an added value's id is minted clear of every
|
|
30
|
+
* standard id, and on a definition with meanings a delete's replacement
|
|
31
|
+
* must mean the same.
|
|
32
|
+
*/
|
|
33
|
+
/** The route the two record-changing moves are posted to. */
|
|
34
|
+
export declare const CRM_PICKLIST_VALUES_ROUTE: "crm/picklist-values";
|
|
35
|
+
/**
|
|
36
|
+
* The lead source's own address for the same route, from before every
|
|
37
|
+
* picklist shared one; a request to it needs no `picklistId`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CRM_LEAD_SOURCE_VALUES_ROUTE: "crm/lead-source-values";
|
|
40
|
+
export declare const crmPicklistValuesRouteUrl: () => string;
|
|
41
|
+
/** The record-changing move a request asks for. */
|
|
42
|
+
export type PicklistValuesAction = {
|
|
43
|
+
action: 'rename';
|
|
44
|
+
valueId: string;
|
|
45
|
+
label: string;
|
|
46
|
+
} | {
|
|
47
|
+
action: 'delete';
|
|
48
|
+
valueId: string;
|
|
49
|
+
/** An active value's label the records move to, or `null` to clear them. */
|
|
50
|
+
replaceWith: string | null;
|
|
51
|
+
};
|
|
52
|
+
/** What the route is asked. `hostId` or `orgId` names the org, as every CRM route's scope does. */
|
|
53
|
+
export type PicklistValuesRequest = {
|
|
54
|
+
hostId?: string | null;
|
|
55
|
+
orgId?: string;
|
|
56
|
+
picklistId: CrmPicklistId;
|
|
57
|
+
} & PicklistValuesAction;
|
|
58
|
+
/** What the route answers. */
|
|
59
|
+
export interface PicklistValuesResponse {
|
|
60
|
+
ok: true;
|
|
61
|
+
/**
|
|
62
|
+
* How many records each target object had rewritten. A contact counts
|
|
63
|
+
* once per FACET rewritten — one per holder that held the old label, so
|
|
64
|
+
* a person two sites both filed under it counts twice.
|
|
65
|
+
*/
|
|
66
|
+
updated: Partial<Record<CrmPicklistObject, number>>;
|
|
67
|
+
}
|
|
68
|
+
/** Why a move is refused, in the sentence the page shows. */
|
|
69
|
+
export type PicklistMove = {
|
|
70
|
+
ok: true;
|
|
71
|
+
picklist: CrmPicklist;
|
|
72
|
+
} | {
|
|
73
|
+
ok: false;
|
|
74
|
+
error: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Append an added value. On a definition with groups it is filed under
|
|
78
|
+
* `group` (or none); on one with meanings it must name one.
|
|
79
|
+
*/
|
|
80
|
+
export declare function addPicklistValue(definition: CrmPicklistDefinition, picklist: CrmPicklist, rawLabel: string, options?: {
|
|
81
|
+
group?: string | null;
|
|
82
|
+
meaning?: string | null;
|
|
83
|
+
}): PicklistMove;
|
|
84
|
+
/** Rename a value, keeping its id — the list half of the route's rename. */
|
|
85
|
+
export declare function renamePicklistValue(picklist: CrmPicklist, valueId: string, rawLabel: string): PicklistMove;
|
|
86
|
+
/**
|
|
87
|
+
* Remove an added value — the list half of the route's delete. A standard
|
|
88
|
+
* value is refused: every org has it, so it can be deactivated and not
|
|
89
|
+
* removed. The replacement, when there is one, must be another ACTIVE
|
|
90
|
+
* value — records are not moved onto a value the pickers no longer offer —
|
|
91
|
+
* and, on a definition with meanings, one of the SAME meaning, so a record
|
|
92
|
+
* never changes what it means by losing a label. A default that named the
|
|
93
|
+
* deleted value is cleared.
|
|
94
|
+
*/
|
|
95
|
+
export declare function deletePicklistValue(definition: CrmPicklistDefinition, picklist: CrmPicklist, valueId: string, replaceWith: string | null): PicklistMove;
|
|
96
|
+
/**
|
|
97
|
+
* How a meaning reads on screen: the definition's own label for it (lead
|
|
98
|
+
* status's "Nurturing"), else the label of the one standard value that
|
|
99
|
+
* carries it (a task's "Completed", "To-do"), else the meaning capitalized
|
|
100
|
+
* ("Open").
|
|
101
|
+
*/
|
|
102
|
+
export declare function picklistMeaningLabel(definition: CrmPicklistDefinition, meaning: string): string;
|
|
103
|
+
/** The meanings an org-added value may take: every one but those the platform reserves. */
|
|
104
|
+
export declare function picklistAddableMeanings(definition: CrmPicklistDefinition): string[];
|
|
105
|
+
/**
|
|
106
|
+
* The values a deleted value's records may move to: every other active
|
|
107
|
+
* value, of the same meaning on a definition with meanings.
|
|
108
|
+
*/
|
|
109
|
+
export declare function picklistReplacements(definition: CrmPicklistDefinition, picklist: CrmPicklist, valueId: string): CrmPicklistValue[];
|
|
110
|
+
/** Turn a value on or off. Deactivating the default clears the default. */
|
|
111
|
+
export declare function setPicklistValueActive(picklist: CrmPicklist, valueId: string, active: boolean): CrmPicklist;
|
|
112
|
+
/** File a value under one of the definition's groups, or none with `null`. */
|
|
113
|
+
export declare function setPicklistValueGroup(definition: CrmPicklistDefinition, picklist: CrmPicklist, valueId: string, group: string | null): CrmPicklist;
|
|
114
|
+
/** Make a value the default for new records, or clear the default with `null`. */
|
|
115
|
+
export declare function setPicklistDefault(picklist: CrmPicklist, valueId: string | null): CrmPicklist;
|
|
116
|
+
/** Move the value at `from` to `to`, the drag and the arrows alike. */
|
|
117
|
+
export declare function movePicklistValue(picklist: CrmPicklist, from: number, to: number): CrmPicklist;
|
|
118
|
+
/** Every value in A–Z order by label, as Salesforce's "Sort alphabetically" does. */
|
|
119
|
+
export declare function sortPicklistValues(picklist: CrmPicklist): CrmPicklist;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { CRM_PICKLIST_VALUES_MAX, crmPicklistValueByLabel, crmPicklistValueId, normalizeCrmPicklistLabel } from "@aglyn/aglyn/app-utils/crm";
|
|
18
|
+
import { isStandardPicklistValueId } from "@aglyn/aglyn/app-utils/picklists";
|
|
19
|
+
/**
|
|
20
|
+
* A PICKLIST'S EDITS (AGL-3298, AGL-3510), as pure moves over a list.
|
|
21
|
+
*
|
|
22
|
+
* The Fields page applies the ones that touch only the list — add, reorder,
|
|
23
|
+
* sort, activate, deactivate, group, default — as one client write of the
|
|
24
|
+
* whole document. The two that change what RECORDS hold — a rename and a
|
|
25
|
+
* delete with its replacement — go to `crm/picklist-values`, which rewrites
|
|
26
|
+
* the list and every record the definition's targets name in one request;
|
|
27
|
+
* this module is where both sides agree what each move does.
|
|
28
|
+
*
|
|
29
|
+
* Each move that depends on the field takes its definition: a standard
|
|
30
|
+
* value cannot be deleted, an added value's id is minted clear of every
|
|
31
|
+
* standard id, and on a definition with meanings a delete's replacement
|
|
32
|
+
* must mean the same.
|
|
33
|
+
*/ /** The route the two record-changing moves are posted to. */ export const CRM_PICKLIST_VALUES_ROUTE = 'crm/picklist-values';
|
|
34
|
+
/**
|
|
35
|
+
* The lead source's own address for the same route, from before every
|
|
36
|
+
* picklist shared one; a request to it needs no `picklistId`.
|
|
37
|
+
*/ export const CRM_LEAD_SOURCE_VALUES_ROUTE = 'crm/lead-source-values';
|
|
38
|
+
export const crmPicklistValuesRouteUrl = ()=>`/api/${CRM_PICKLIST_VALUES_ROUTE}`;
|
|
39
|
+
const DUPLICATE = (label)=>`“${label}” is already in the list.`;
|
|
40
|
+
/**
|
|
41
|
+
* Append an added value. On a definition with groups it is filed under
|
|
42
|
+
* `group` (or none); on one with meanings it must name one.
|
|
43
|
+
*/ export function addPicklistValue(definition, picklist, rawLabel, options = {}) {
|
|
44
|
+
var _definition_meanings, _options_meaning, _options_meaning1, _definition_groups;
|
|
45
|
+
var _definition_reservedMeanings;
|
|
46
|
+
const label = normalizeCrmPicklistLabel(rawLabel);
|
|
47
|
+
if (!label) return {
|
|
48
|
+
ok: false,
|
|
49
|
+
error: 'Enter a name for the value.'
|
|
50
|
+
};
|
|
51
|
+
const existing = crmPicklistValueByLabel(picklist, label);
|
|
52
|
+
if (existing) {
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
error: existing.active ? DUPLICATE(existing.label) : `“${existing.label}” is in the list, inactive — activate it instead.`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (picklist.values.length >= CRM_PICKLIST_VALUES_MAX) {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
error: `A list holds at most ${CRM_PICKLIST_VALUES_MAX} values.`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const meanings = (_definition_meanings = definition.meanings) != null ? _definition_meanings : [];
|
|
65
|
+
if (meanings.length && !meanings.includes((_options_meaning = options.meaning) != null ? _options_meaning : '')) {
|
|
66
|
+
return {
|
|
67
|
+
ok: false,
|
|
68
|
+
error: 'Pick what the value means.'
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if ((_definition_reservedMeanings = definition.reservedMeanings) == null ? void 0 : _definition_reservedMeanings.includes((_options_meaning1 = options.meaning) != null ? _options_meaning1 : '')) {
|
|
72
|
+
const name = picklistMeaningLabel(definition, options.meaning);
|
|
73
|
+
return {
|
|
74
|
+
ok: false,
|
|
75
|
+
error: `Only the platform sets ${name}; pick another meaning.`
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const groups = (_definition_groups = definition.groups) != null ? _definition_groups : [];
|
|
79
|
+
const value = _extends({
|
|
80
|
+
id: crmPicklistValueId(label, [
|
|
81
|
+
...picklist.values.map((entry)=>entry.id),
|
|
82
|
+
...definition.standardValues.map((entry)=>entry.id)
|
|
83
|
+
]),
|
|
84
|
+
label,
|
|
85
|
+
active: true
|
|
86
|
+
}, groups.length ? {
|
|
87
|
+
group: groups.some((group)=>group.id === options.group) ? options.group : null
|
|
88
|
+
} : {}, meanings.length ? {
|
|
89
|
+
meaning: options.meaning
|
|
90
|
+
} : {});
|
|
91
|
+
return {
|
|
92
|
+
ok: true,
|
|
93
|
+
picklist: _extends({}, picklist, {
|
|
94
|
+
values: [
|
|
95
|
+
...picklist.values,
|
|
96
|
+
value
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Rename a value, keeping its id — the list half of the route's rename. */ export function renamePicklistValue(picklist, valueId, rawLabel) {
|
|
102
|
+
const label = normalizeCrmPicklistLabel(rawLabel);
|
|
103
|
+
if (!label) return {
|
|
104
|
+
ok: false,
|
|
105
|
+
error: 'Enter a name for the value.'
|
|
106
|
+
};
|
|
107
|
+
if (!picklist.values.some((value)=>value.id === valueId)) {
|
|
108
|
+
return {
|
|
109
|
+
ok: false,
|
|
110
|
+
error: 'That value is no longer in the list.'
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const clash = crmPicklistValueByLabel(picklist, label);
|
|
114
|
+
if (clash && clash.id !== valueId) return {
|
|
115
|
+
ok: false,
|
|
116
|
+
error: DUPLICATE(clash.label)
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
ok: true,
|
|
120
|
+
picklist: _extends({}, picklist, {
|
|
121
|
+
values: picklist.values.map((value)=>value.id === valueId ? _extends({}, value, {
|
|
122
|
+
label
|
|
123
|
+
}) : value)
|
|
124
|
+
})
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Remove an added value — the list half of the route's delete. A standard
|
|
129
|
+
* value is refused: every org has it, so it can be deactivated and not
|
|
130
|
+
* removed. The replacement, when there is one, must be another ACTIVE
|
|
131
|
+
* value — records are not moved onto a value the pickers no longer offer —
|
|
132
|
+
* and, on a definition with meanings, one of the SAME meaning, so a record
|
|
133
|
+
* never changes what it means by losing a label. A default that named the
|
|
134
|
+
* deleted value is cleared.
|
|
135
|
+
*/ export function deletePicklistValue(definition, picklist, valueId, replaceWith) {
|
|
136
|
+
var _definition_meanings;
|
|
137
|
+
const value = picklist.values.find((entry)=>entry.id === valueId);
|
|
138
|
+
if (!value) return {
|
|
139
|
+
ok: false,
|
|
140
|
+
error: 'That value is no longer in the list.'
|
|
141
|
+
};
|
|
142
|
+
if (isStandardPicklistValueId(definition, valueId)) {
|
|
143
|
+
return {
|
|
144
|
+
ok: false,
|
|
145
|
+
error: `“${value.label}” is a standard value and cannot be deleted. Deactivate it instead.`
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// On a definition with meanings a record's meaning must survive the
|
|
149
|
+
// delete, so its label moves to another value of that meaning — never off.
|
|
150
|
+
if (replaceWith === null && ((_definition_meanings = definition.meanings) == null ? void 0 : _definition_meanings.length)) {
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
error: `Pick a value that means the same as “${value.label}” to move its records to.`
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (replaceWith !== null) {
|
|
157
|
+
var _target_meaning, _value_meaning;
|
|
158
|
+
var _definition_meanings1;
|
|
159
|
+
const target = crmPicklistValueByLabel(picklist, replaceWith);
|
|
160
|
+
if (!target || target.id === valueId || !target.active) {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
error: 'Pick an active value to move its records to, or none.'
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (((_definition_meanings1 = definition.meanings) == null ? void 0 : _definition_meanings1.length) && ((_target_meaning = target.meaning) != null ? _target_meaning : null) !== ((_value_meaning = value.meaning) != null ? _value_meaning : null)) {
|
|
167
|
+
return {
|
|
168
|
+
ok: false,
|
|
169
|
+
error: `Pick a value that means the same as “${value.label}” to move its records to.`
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
ok: true,
|
|
175
|
+
picklist: {
|
|
176
|
+
values: picklist.values.filter((entry)=>entry.id !== valueId),
|
|
177
|
+
defaultValueId: picklist.defaultValueId === valueId ? null : picklist.defaultValueId
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* How a meaning reads on screen: the definition's own label for it (lead
|
|
183
|
+
* status's "Nurturing"), else the label of the one standard value that
|
|
184
|
+
* carries it (a task's "Completed", "To-do"), else the meaning capitalized
|
|
185
|
+
* ("Open").
|
|
186
|
+
*/ export function picklistMeaningLabel(definition, meaning) {
|
|
187
|
+
var _definition_meaningLabels;
|
|
188
|
+
const own = (_definition_meaningLabels = definition.meaningLabels) == null ? void 0 : _definition_meaningLabels[meaning];
|
|
189
|
+
if (own) return own;
|
|
190
|
+
const holders = definition.standardValues.filter((value)=>value.meaning === meaning);
|
|
191
|
+
return holders.length === 1 && holders[0] ? holders[0].label : meaning.charAt(0).toUpperCase() + meaning.slice(1);
|
|
192
|
+
}
|
|
193
|
+
/** The meanings an org-added value may take: every one but those the platform reserves. */ export function picklistAddableMeanings(definition) {
|
|
194
|
+
var _definition_meanings;
|
|
195
|
+
return ((_definition_meanings = definition.meanings) != null ? _definition_meanings : []).filter((meaning)=>{
|
|
196
|
+
var _definition_reservedMeanings;
|
|
197
|
+
return !((_definition_reservedMeanings = definition.reservedMeanings) == null ? void 0 : _definition_reservedMeanings.includes(meaning));
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* The values a deleted value's records may move to: every other active
|
|
202
|
+
* value, of the same meaning on a definition with meanings.
|
|
203
|
+
*/ export function picklistReplacements(definition, picklist, valueId) {
|
|
204
|
+
const deleted = picklist.values.find((entry)=>entry.id === valueId);
|
|
205
|
+
return picklist.values.filter((entry)=>{
|
|
206
|
+
var _entry_meaning, _ref;
|
|
207
|
+
var _definition_meanings;
|
|
208
|
+
return entry.active && entry.id !== valueId && (!((_definition_meanings = definition.meanings) == null ? void 0 : _definition_meanings.length) || ((_entry_meaning = entry.meaning) != null ? _entry_meaning : null) === ((_ref = deleted == null ? void 0 : deleted.meaning) != null ? _ref : null));
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/** Turn a value on or off. Deactivating the default clears the default. */ export function setPicklistValueActive(picklist, valueId, active) {
|
|
212
|
+
return {
|
|
213
|
+
values: picklist.values.map((value)=>value.id === valueId ? _extends({}, value, {
|
|
214
|
+
active
|
|
215
|
+
}) : value),
|
|
216
|
+
defaultValueId: !active && picklist.defaultValueId === valueId ? null : picklist.defaultValueId
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/** File a value under one of the definition's groups, or none with `null`. */ export function setPicklistValueGroup(definition, picklist, valueId, group) {
|
|
220
|
+
var _definition_groups;
|
|
221
|
+
const known = ((_definition_groups = definition.groups) == null ? void 0 : _definition_groups.some((entry)=>entry.id === group)) ? group : null;
|
|
222
|
+
return _extends({}, picklist, {
|
|
223
|
+
values: picklist.values.map((value)=>value.id === valueId ? _extends({}, value, {
|
|
224
|
+
group: known
|
|
225
|
+
}) : value)
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** Make a value the default for new records, or clear the default with `null`. */ export function setPicklistDefault(picklist, valueId) {
|
|
229
|
+
const value = picklist.values.find((entry)=>entry.id === valueId);
|
|
230
|
+
return _extends({}, picklist, {
|
|
231
|
+
defaultValueId: (value == null ? void 0 : value.active) ? value.id : null
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/** Move the value at `from` to `to`, the drag and the arrows alike. */ export function movePicklistValue(picklist, from, to) {
|
|
235
|
+
const size = picklist.values.length;
|
|
236
|
+
if (from === to || from < 0 || to < 0 || from >= size || to >= size) return picklist;
|
|
237
|
+
const values = [
|
|
238
|
+
...picklist.values
|
|
239
|
+
];
|
|
240
|
+
const [moved] = values.splice(from, 1);
|
|
241
|
+
values.splice(to, 0, moved);
|
|
242
|
+
return _extends({}, picklist, {
|
|
243
|
+
values
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/** Every value in A–Z order by label, as Salesforce's "Sort alphabetically" does. */ export function sortPicklistValues(picklist) {
|
|
247
|
+
return _extends({}, picklist, {
|
|
248
|
+
values: [
|
|
249
|
+
...picklist.values
|
|
250
|
+
].sort((a, b)=>a.label.localeCompare(b.label, undefined, {
|
|
251
|
+
sensitivity: 'base'
|
|
252
|
+
}))
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
//# sourceMappingURL=picklist-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/picklist-values.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\nimport {\n type CrmPicklist,\n type CrmPicklistDefinition,\n type CrmPicklistId,\n type CrmPicklistObject,\n type CrmPicklistValue,\n CRM_PICKLIST_VALUES_MAX,\n crmPicklistValueByLabel,\n crmPicklistValueId,\n normalizeCrmPicklistLabel,\n} from '@aglyn/aglyn/app-utils/crm'\nimport { isStandardPicklistValueId } from '@aglyn/aglyn/app-utils/picklists'\n\n/**\n * A PICKLIST'S EDITS (AGL-3298, AGL-3510), as pure moves over a list.\n *\n * The Fields page applies the ones that touch only the list — add, reorder,\n * sort, activate, deactivate, group, default — as one client write of the\n * whole document. The two that change what RECORDS hold — a rename and a\n * delete with its replacement — go to `crm/picklist-values`, which rewrites\n * the list and every record the definition's targets name in one request;\n * this module is where both sides agree what each move does.\n *\n * Each move that depends on the field takes its definition: a standard\n * value cannot be deleted, an added value's id is minted clear of every\n * standard id, and on a definition with meanings a delete's replacement\n * must mean the same.\n */\n\n/** The route the two record-changing moves are posted to. */\nexport const CRM_PICKLIST_VALUES_ROUTE = 'crm/picklist-values' as const\n\n/**\n * The lead source's own address for the same route, from before every\n * picklist shared one; a request to it needs no `picklistId`.\n */\nexport const CRM_LEAD_SOURCE_VALUES_ROUTE = 'crm/lead-source-values' as const\n\nexport const crmPicklistValuesRouteUrl = (): string => `/api/${CRM_PICKLIST_VALUES_ROUTE}`\n\n/** The record-changing move a request asks for. */\nexport type PicklistValuesAction =\n | { action: 'rename'; valueId: string; label: string }\n | {\n action: 'delete'\n valueId: string\n /** An active value's label the records move to, or `null` to clear them. */\n replaceWith: string | null\n }\n\n/** What the route is asked. `hostId` or `orgId` names the org, as every CRM route's scope does. */\nexport type PicklistValuesRequest = {\n hostId?: string | null\n orgId?: string\n picklistId: CrmPicklistId\n} & PicklistValuesAction\n\n/** What the route answers. */\nexport interface PicklistValuesResponse {\n ok: true\n /**\n * How many records each target object had rewritten. A contact counts\n * once per FACET rewritten — one per holder that held the old label, so\n * a person two sites both filed under it counts twice.\n */\n updated: Partial<Record<CrmPicklistObject, number>>\n}\n\n/** Why a move is refused, in the sentence the page shows. */\nexport type PicklistMove = { ok: true; picklist: CrmPicklist } | { ok: false; error: string }\n\nconst DUPLICATE = (label: string) => `“${label}” is already in the list.`\n\n/**\n * Append an added value. On a definition with groups it is filed under\n * `group` (or none); on one with meanings it must name one.\n */\nexport function addPicklistValue(\n definition: CrmPicklistDefinition,\n picklist: CrmPicklist,\n rawLabel: string,\n options: { group?: string | null; meaning?: string | null } = {},\n): PicklistMove {\n const label = normalizeCrmPicklistLabel(rawLabel)\n if (!label) return { ok: false, error: 'Enter a name for the value.' }\n const existing = crmPicklistValueByLabel(picklist, label)\n if (existing) {\n return {\n ok: false,\n error: existing.active\n ? DUPLICATE(existing.label)\n : `“${existing.label}” is in the list, inactive — activate it instead.`,\n }\n }\n if (picklist.values.length >= CRM_PICKLIST_VALUES_MAX) {\n return { ok: false, error: `A list holds at most ${CRM_PICKLIST_VALUES_MAX} values.` }\n }\n const meanings = definition.meanings ?? []\n if (meanings.length && !meanings.includes(options.meaning ?? '')) {\n return { ok: false, error: 'Pick what the value means.' }\n }\n if (definition.reservedMeanings?.includes(options.meaning ?? '')) {\n const name = picklistMeaningLabel(definition, options.meaning as string)\n return { ok: false, error: `Only the platform sets ${name}; pick another meaning.` }\n }\n const groups = definition.groups ?? []\n const value: CrmPicklistValue = {\n id: crmPicklistValueId(label, [\n ...picklist.values.map((entry) => entry.id),\n ...definition.standardValues.map((entry) => entry.id),\n ]),\n label,\n active: true,\n ...(groups.length\n ? { group: groups.some((group) => group.id === options.group) ? (options.group as string) : null }\n : {}),\n ...(meanings.length ? { meaning: options.meaning as string } : {}),\n }\n return { ok: true, picklist: { ...picklist, values: [...picklist.values, value] } }\n}\n\n/** Rename a value, keeping its id — the list half of the route's rename. */\nexport function renamePicklistValue(\n picklist: CrmPicklist,\n valueId: string,\n rawLabel: string,\n): PicklistMove {\n const label = normalizeCrmPicklistLabel(rawLabel)\n if (!label) return { ok: false, error: 'Enter a name for the value.' }\n if (!picklist.values.some((value) => value.id === valueId)) {\n return { ok: false, error: 'That value is no longer in the list.' }\n }\n const clash = crmPicklistValueByLabel(picklist, label)\n if (clash && clash.id !== valueId) return { ok: false, error: DUPLICATE(clash.label) }\n return {\n ok: true,\n picklist: {\n ...picklist,\n values: picklist.values.map((value) => (value.id === valueId ? { ...value, label } : value)),\n },\n }\n}\n\n/**\n * Remove an added value — the list half of the route's delete. A standard\n * value is refused: every org has it, so it can be deactivated and not\n * removed. The replacement, when there is one, must be another ACTIVE\n * value — records are not moved onto a value the pickers no longer offer —\n * and, on a definition with meanings, one of the SAME meaning, so a record\n * never changes what it means by losing a label. A default that named the\n * deleted value is cleared.\n */\nexport function deletePicklistValue(\n definition: CrmPicklistDefinition,\n picklist: CrmPicklist,\n valueId: string,\n replaceWith: string | null,\n): PicklistMove {\n const value = picklist.values.find((entry) => entry.id === valueId)\n if (!value) return { ok: false, error: 'That value is no longer in the list.' }\n if (isStandardPicklistValueId(definition, valueId)) {\n return {\n ok: false,\n error: `“${value.label}” is a standard value and cannot be deleted. Deactivate it instead.`,\n }\n }\n // On a definition with meanings a record's meaning must survive the\n // delete, so its label moves to another value of that meaning — never off.\n if (replaceWith === null && definition.meanings?.length) {\n return {\n ok: false,\n error: `Pick a value that means the same as “${value.label}” to move its records to.`,\n }\n }\n if (replaceWith !== null) {\n const target = crmPicklistValueByLabel(picklist, replaceWith)\n if (!target || target.id === valueId || !target.active) {\n return { ok: false, error: 'Pick an active value to move its records to, or none.' }\n }\n if (definition.meanings?.length && (target.meaning ?? null) !== (value.meaning ?? null)) {\n return {\n ok: false,\n error: `Pick a value that means the same as “${value.label}” to move its records to.`,\n }\n }\n }\n return {\n ok: true,\n picklist: {\n values: picklist.values.filter((entry) => entry.id !== valueId),\n defaultValueId: picklist.defaultValueId === valueId ? null : picklist.defaultValueId,\n },\n }\n}\n\n/**\n * How a meaning reads on screen: the definition's own label for it (lead\n * status's \"Nurturing\"), else the label of the one standard value that\n * carries it (a task's \"Completed\", \"To-do\"), else the meaning capitalized\n * (\"Open\").\n */\nexport function picklistMeaningLabel(definition: CrmPicklistDefinition, meaning: string): string {\n const own = definition.meaningLabels?.[meaning]\n if (own) return own\n const holders = definition.standardValues.filter((value) => value.meaning === meaning)\n return holders.length === 1 && holders[0]\n ? holders[0].label\n : meaning.charAt(0).toUpperCase() + meaning.slice(1)\n}\n\n/** The meanings an org-added value may take: every one but those the platform reserves. */\nexport function picklistAddableMeanings(definition: CrmPicklistDefinition): string[] {\n return (definition.meanings ?? []).filter((meaning) => !definition.reservedMeanings?.includes(meaning))\n}\n\n/**\n * The values a deleted value's records may move to: every other active\n * value, of the same meaning on a definition with meanings.\n */\nexport function picklistReplacements(\n definition: CrmPicklistDefinition,\n picklist: CrmPicklist,\n valueId: string,\n): CrmPicklistValue[] {\n const deleted = picklist.values.find((entry) => entry.id === valueId)\n return picklist.values.filter(\n (entry) =>\n entry.active &&\n entry.id !== valueId &&\n (!definition.meanings?.length || (entry.meaning ?? null) === (deleted?.meaning ?? null)),\n )\n}\n\n/** Turn a value on or off. Deactivating the default clears the default. */\nexport function setPicklistValueActive(\n picklist: CrmPicklist,\n valueId: string,\n active: boolean,\n): CrmPicklist {\n return {\n values: picklist.values.map((value) => (value.id === valueId ? { ...value, active } : value)),\n defaultValueId:\n !active && picklist.defaultValueId === valueId ? null : picklist.defaultValueId,\n }\n}\n\n/** File a value under one of the definition's groups, or none with `null`. */\nexport function setPicklistValueGroup(\n definition: CrmPicklistDefinition,\n picklist: CrmPicklist,\n valueId: string,\n group: string | null,\n): CrmPicklist {\n const known = definition.groups?.some((entry) => entry.id === group) ? group : null\n return {\n ...picklist,\n values: picklist.values.map((value) =>\n value.id === valueId ? { ...value, group: known } : value,\n ),\n }\n}\n\n/** Make a value the default for new records, or clear the default with `null`. */\nexport function setPicklistDefault(picklist: CrmPicklist, valueId: string | null): CrmPicklist {\n const value = picklist.values.find((entry) => entry.id === valueId)\n return { ...picklist, defaultValueId: value?.active ? value.id : null }\n}\n\n/** Move the value at `from` to `to`, the drag and the arrows alike. */\nexport function movePicklistValue(picklist: CrmPicklist, from: number, to: number): CrmPicklist {\n const size = picklist.values.length\n if (from === to || from < 0 || to < 0 || from >= size || to >= size) return picklist\n const values = [...picklist.values]\n const [moved] = values.splice(from, 1)\n values.splice(to, 0, moved)\n return { ...picklist, values }\n}\n\n/** Every value in A–Z order by label, as Salesforce's \"Sort alphabetically\" does. */\nexport function sortPicklistValues(picklist: CrmPicklist): CrmPicklist {\n return {\n ...picklist,\n values: [...picklist.values].sort((a, b) =>\n a.label.localeCompare(b.label, undefined, { sensitivity: 'base' }),\n ),\n }\n}\n"],"names":["CRM_PICKLIST_VALUES_MAX","crmPicklistValueByLabel","crmPicklistValueId","normalizeCrmPicklistLabel","isStandardPicklistValueId","CRM_PICKLIST_VALUES_ROUTE","CRM_LEAD_SOURCE_VALUES_ROUTE","crmPicklistValuesRouteUrl","DUPLICATE","label","addPicklistValue","definition","picklist","rawLabel","options","ok","error","existing","active","values","length","meanings","includes","meaning","reservedMeanings","name","picklistMeaningLabel","groups","value","id","map","entry","standardValues","group","some","renamePicklistValue","valueId","clash","deletePicklistValue","replaceWith","find","target","filter","defaultValueId","own","meaningLabels","holders","charAt","toUpperCase","slice","picklistAddableMeanings","picklistReplacements","deleted","setPicklistValueActive","setPicklistValueGroup","known","setPicklistDefault","movePicklistValue","from","to","size","moved","splice","sortPicklistValues","sort","a","b","localeCompare","undefined","sensitivity"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAMEA,uBAAuB,EACvBC,uBAAuB,EACvBC,kBAAkB,EAClBC,yBAAyB,QACpB,6BAA4B;AACnC,SAASC,yBAAyB,QAAQ,mCAAkC;AAE5E;;;;;;;;;;;;;;CAcC,GAED,2DAA2D,GAC3D,OAAO,MAAMC,4BAA4B,sBAA8B;AAEvE;;;CAGC,GACD,OAAO,MAAMC,+BAA+B,yBAAiC;AAE7E,OAAO,MAAMC,4BAA4B,IAAc,CAAC,KAAK,EAAEF,2BAA2B,CAAA;AAiC1F,MAAMG,YAAY,CAACC,QAAkB,CAAC,CAAC,EAAEA,MAAM,yBAAyB,CAAC;AAEzE;;;CAGC,GACD,OAAO,SAASC,iBACdC,UAAiC,EACjCC,QAAqB,EACrBC,QAAgB,EAChBC,UAA8D,CAAC,CAAC;QAgB/CH,sBACyBG,kBAGAA,mBAI3BH;QAJXA;IAlBJ,MAAMF,QAAQN,0BAA0BU;IACxC,IAAI,CAACJ,OAAO,OAAO;QAAEM,IAAI;QAAOC,OAAO;IAA8B;IACrE,MAAMC,WAAWhB,wBAAwBW,UAAUH;IACnD,IAAIQ,UAAU;QACZ,OAA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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
|
+
import { type ContactInteraction, type CrmActivity, type CrmTask } from '@aglyn/aglyn/server';
|
|
18
|
+
import { type CompanyFactsInput, type ContactFactsInput, type CrmCompanyFacts, type CrmContactFacts, type CrmDealFacts, type CrmLeadFacts, type CrmTaskFact, type CrmTimelineFact, type DealFactsInput, type LeadFactsInput } from './record-facts';
|
|
19
|
+
/**
|
|
20
|
+
* THE DISCLOSED FACTS: what CRM assistance sends while
|
|
21
|
+
* `release_crm_assist_whole_record` is off.
|
|
22
|
+
*
|
|
23
|
+
* The published Privacy Policy (section 2) and the Anthropic row on
|
|
24
|
+
* `/legal/subprocessors` promise that CRM assistance sends a record's name
|
|
25
|
+
* and, by kind, its job title, company, lifecycle stage, tags, capture
|
|
26
|
+
* history and counts, domain, industry, headcount, pipeline stages, status,
|
|
27
|
+
* amount, dates, lost reason, parties and lead status, with its notes,
|
|
28
|
+
* newest timeline entries and open tasks and deals — and never an email,
|
|
29
|
+
* phone or postal field, marketing consent, custom field value, team member
|
|
30
|
+
* or record id. These builders report exactly that, so production keeps the
|
|
31
|
+
* promise until those pages are republished and the flag is turned on;
|
|
32
|
+
* `record-facts.ts` builds the whole record for the flag's on side.
|
|
33
|
+
*
|
|
34
|
+
* ## What never leaves
|
|
35
|
+
*
|
|
36
|
+
* No email address, phone number or postal address of anyone; no birthdate;
|
|
37
|
+
* no assistant and no reports-to; no marketing consent; no custom field
|
|
38
|
+
* VALUE; no team member's name or id; no document id of any record; no
|
|
39
|
+
* file; no order or payment detail beyond a count. A logged email carries its
|
|
40
|
+
* subject and a cut of its body, never the address it went to or came from.
|
|
41
|
+
*
|
|
42
|
+
* Every text a person wrote into a record — a name, a job title, a tag, notes,
|
|
43
|
+
* a logged activity, a capture's summary, a task's or a deal's title, a
|
|
44
|
+
* reason — is reported as written, except that an email address or a phone
|
|
45
|
+
* number inside it is replaced by a placeholder first ({@link crmFactProse}):
|
|
46
|
+
* an import that put an address in the name column leaves no address behind.
|
|
47
|
+
* What the workspace configured — pipeline, stage and field names — and a
|
|
48
|
+
* company's domain are reported as they are. A postal address typed into a
|
|
49
|
+
* note is not recognized and leaves as typed.
|
|
50
|
+
*
|
|
51
|
+
* The bytes are as stable as the whole record's: one key order, UTC days,
|
|
52
|
+
* money as a code and a fixed-point amount.
|
|
53
|
+
*/
|
|
54
|
+
export type CrmDisclosedContactFacts = Pick<CrmContactFacts, 'record' | 'name' | 'salutation' | 'jobTitle' | 'department' | 'doNotCall' | 'company' | 'lifecycleStage' | 'tags' | 'sources' | 'orders' | 'lastPurchase' | 'since' | 'lastEmailEngagement' | 'notes' | 'timeline' | 'openTasks' | 'deals'>;
|
|
55
|
+
export type CrmDisclosedCompanyFacts = Pick<CrmCompanyFacts, 'record' | 'name' | 'domain' | 'industry' | 'type' | 'rating' | 'ownership' | 'accountSource' | 'employees' | 'annualRevenue' | 'tags' | 'people' | 'since' | 'notes' | 'timeline' | 'openTasks' | 'deals'>;
|
|
56
|
+
export type CrmDisclosedDealFacts = Pick<CrmDealFacts, 'record' | 'title' | 'pipeline' | 'stages' | 'stageId' | 'stage' | 'status' | 'amount' | 'expectedClose' | 'inStageSince' | 'lostReason' | 'type' | 'leadSource' | 'nextStep' | 'probability' | 'forecastCategory' | 'contact' | 'contactRoles' | 'company' | 'since' | 'notes' | 'timeline' | 'openTasks'> & {
|
|
57
|
+
/** How many products the deal holds — a count, never their names or prices. */
|
|
58
|
+
products: number;
|
|
59
|
+
};
|
|
60
|
+
export type CrmDisclosedLeadFacts = Pick<CrmLeadFacts, 'record' | 'name' | 'salutation' | 'company' | 'jobTitle' | 'leadSource' | 'industry' | 'rating' | 'employees' | 'annualRevenue' | 'doNotCall' | 'status' | 'sources' | 'captures' | 'firstSeen' | 'lastSeen' | 'assigned' | 'converted' | 'unqualifiedReason' | 'notes' | 'timeline'>;
|
|
61
|
+
export declare const CRM_FACTS_EMAIL_PLACEHOLDER = "[email address]";
|
|
62
|
+
export declare const CRM_FACTS_PHONE_PLACEHOLDER = "[phone number]";
|
|
63
|
+
/**
|
|
64
|
+
* Free text the team wrote, as {@link crmFactText} reports it, with every
|
|
65
|
+
* email address, and every run of ten digits or more that is not a list of
|
|
66
|
+
* days, replaced by a placeholder. The fields that hold an address or a number
|
|
67
|
+
* are never reported, and this keeps one typed into a note from leaving
|
|
68
|
+
* either. Replaced before the cut, so a cut never halves an address into
|
|
69
|
+
* something unrecognized.
|
|
70
|
+
*/
|
|
71
|
+
export declare function crmFactProse(value: unknown, max: number): string;
|
|
72
|
+
/** A logged activity as a timeline entry: never the address it went to or came from. */
|
|
73
|
+
export declare function crmDisclosedActivityFact(activity: Partial<CrmActivity>): CrmTimelineFact | null;
|
|
74
|
+
/** A capture the platform recorded on a contact, as a timeline entry. */
|
|
75
|
+
export declare function crmDisclosedInteractionFact(interaction: Partial<ContactInteraction>): CrmTimelineFact | null;
|
|
76
|
+
/** The open tasks among `tasks`, soonest due first, undated last: never who holds one, nor its notes. */
|
|
77
|
+
export declare function crmDisclosedOpenTaskFacts(tasks: ReadonlyArray<Partial<CrmTask>>, nowMs: number): CrmTaskFact[];
|
|
78
|
+
export declare function disclosedContactFacts(input: ContactFactsInput): CrmDisclosedContactFacts;
|
|
79
|
+
export declare function disclosedCompanyFacts(input: CompanyFactsInput): CrmDisclosedCompanyFacts;
|
|
80
|
+
export declare function disclosedDealFacts(input: DealFactsInput): CrmDisclosedDealFacts;
|
|
81
|
+
export declare function disclosedLeadFacts(input: LeadFactsInput): CrmDisclosedLeadFacts;
|