@aglyn/plugins-crm 1.0.0-beta.221 → 1.0.0-beta.223
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-next-activity-column.js +1 -1
- package/src/lib/components/crm-next-activity-column.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/pipeline-card.js +2 -1
- package/src/lib/components/reports/pipeline-card.js.map +1 -1
- 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 +97 -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 +17 -2
- 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-next-activity.d.ts +107 -0
- package/src/lib/model/crm-next-activity.js +140 -0
- package/src/lib/model/crm-next-activity.js.map +1 -0
- package/src/lib/model/crm-recipes.d.ts +40 -0
- package/src/lib/model/crm-recipes.js +259 -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/crm-task-reminders.d.ts +152 -0
- package/src/lib/model/crm-task-reminders.js +161 -0
- package/src/lib/model/crm-task-reminders.js.map +1 -0
- 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/next-activity.d.ts +1 -1
- package/src/lib/model/next-activity.js.map +1 -1
- 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 +78 -34
- 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 +188 -0
- package/src/lib/server/assign-contact-owner.js +446 -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 +140 -0
- package/src/lib/server/automation-steps.js +669 -0
- package/src/lib/server/automation-steps.js.map +1 -0
- package/src/lib/server/capture-contact.d.ts +17 -0
- package/src/lib/server/capture-contact.js +95 -26
- 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-email-activity.d.ts +118 -0
- package/src/lib/server/crm-email-activity.js +148 -0
- package/src/lib/server/crm-email-activity.js.map +1 -0
- package/src/lib/server/crm-inbound-email.js +1 -1
- package/src/lib/server/crm-inbound-email.js.map +1 -1
- package/src/lib/server/crm-next-activity.d.ts +74 -0
- package/src/lib/server/crm-next-activity.js +194 -0
- package/src/lib/server/crm-next-activity.js.map +1 -0
- 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/email-send.js +2 -1
- package/src/lib/server/email-send.js.map +1 -1
- 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 +23 -5
- package/src/lib/server/merge-contacts.js.map +1 -1
- package/src/lib/server/next-activity-routes.js +2 -1
- package/src/lib/server/next-activity-routes.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 +22 -8
- 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 +40 -3
- 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-reminders-route.js +2 -1
- package/src/lib/server/task-reminders-route.js.map +1 -1
- package/src/lib/server/task-routes.js +33 -17
- 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
|
@@ -1,94 +0,0 @@
|
|
|
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 CrmTaskKind, type CrmTaskPriority, type CrmTaskStatus } from '@aglyn/aglyn/app-utils/crm';
|
|
18
|
-
import { type ImportChunkResult, type ImportDroppedValue } from '@aglyn/aglyn/app-utils/csv-import';
|
|
19
|
-
/** The shared ceilings, under this collection's names. */
|
|
20
|
-
export declare const TASK_IMPORT_MAX_ROWS = 5000;
|
|
21
|
-
export declare const TASK_IMPORT_CHUNK_SIZE = 200;
|
|
22
|
-
export declare const TASK_IMPORT_MAX_BODY_BYTES = 2000000;
|
|
23
|
-
export declare const TASK_IMPORT_PREVIEW_ROWS = 10;
|
|
24
|
-
/** The same caps the task drawer holds a typed task to. */
|
|
25
|
-
export declare const TASK_IMPORT_TITLE_MAX = 200;
|
|
26
|
-
export declare const TASK_IMPORT_NOTES_MAX = 4000;
|
|
27
|
-
/** The fields a column may be mapped to, in the order the mapping menu lists them. */
|
|
28
|
-
export declare const TASK_IMPORT_FIELDS: readonly ["title", "kind", "priority", "status", "due", "assigneeEmail", "notes"];
|
|
29
|
-
export type TaskImportField = (typeof TASK_IMPORT_FIELDS)[number];
|
|
30
|
-
/** How each field reads in the mapping menu. Typed so a field cannot ship unlabeled. */
|
|
31
|
-
export declare const TASK_IMPORT_FIELD_LABELS: Record<TaskImportField, string>;
|
|
32
|
-
/** Column index → field. A column absent from the map is not imported. */
|
|
33
|
-
export type TaskImportMapping = Record<number, TaskImportField>;
|
|
34
|
-
/** A proposed mapping from a file's header row, each field taken at most once. */
|
|
35
|
-
export declare function guessTaskImportMapping(columns: readonly string[]): TaskImportMapping;
|
|
36
|
-
/**
|
|
37
|
-
* What the browser posts for one line: the cells the mapping selected,
|
|
38
|
-
* under the field they were mapped to, verbatim. `unknown` because the
|
|
39
|
-
* server reads this off an untrusted body.
|
|
40
|
-
*/
|
|
41
|
-
export type TaskImportRawRow = Partial<Record<TaskImportField, unknown>>;
|
|
42
|
-
/** One parsed line under the mapping. Empty cells are left absent; a task has no custom fields. */
|
|
43
|
-
export declare function mapTaskImportRow(cells: readonly string[], mapping: Record<number, TaskImportField | `custom:${string}`>): TaskImportRawRow;
|
|
44
|
-
export type TaskImportSkipReason = 'missing-title' | 'unknown-assignee' | 'write-failed';
|
|
45
|
-
/** How a skip reason reads on screen and in the downloaded file. */
|
|
46
|
-
export declare const TASK_IMPORT_SKIP_LABELS: Record<TaskImportSkipReason, string>;
|
|
47
|
-
/** One row, ready for the server to resolve and write. */
|
|
48
|
-
export interface TaskImportRow {
|
|
49
|
-
title: string;
|
|
50
|
-
kind: CrmTaskKind;
|
|
51
|
-
priority: CrmTaskPriority;
|
|
52
|
-
status: CrmTaskStatus;
|
|
53
|
-
/** Epoch ms, or `null` for no due date — the shape the document stores. */
|
|
54
|
-
dueAtMs: number | null;
|
|
55
|
-
/** Normalized, for the server to resolve against the org's members. */
|
|
56
|
-
assigneeEmail?: string;
|
|
57
|
-
notes?: string;
|
|
58
|
-
dropped: ImportDroppedValue[];
|
|
59
|
-
}
|
|
60
|
-
export type TaskImportRowVerdict = {
|
|
61
|
-
ok: true;
|
|
62
|
-
row: TaskImportRow;
|
|
63
|
-
} | {
|
|
64
|
-
ok: false;
|
|
65
|
-
reason: 'missing-title';
|
|
66
|
-
input: string;
|
|
67
|
-
};
|
|
68
|
-
/** A kind cell by id or by label — `todo`, `To-do`, `to do` are one kind. */
|
|
69
|
-
export declare function parseImportTaskKind(value: unknown): CrmTaskKind | null;
|
|
70
|
-
/** A priority cell as one of the three, `medium` and `urgent` folded in. */
|
|
71
|
-
export declare function parseImportTaskPriority(value: unknown): CrmTaskPriority | null;
|
|
72
|
-
/** A status cell as open or done — `done`, `complete`, `yes`, `true` all close it. */
|
|
73
|
-
export declare function parseImportTaskStatus(value: unknown): CrmTaskStatus | null;
|
|
74
|
-
/**
|
|
75
|
-
* One raw row as the values that will be written, or the reason it cannot
|
|
76
|
-
* be. Refused here only for a missing title; the assignee is refused by
|
|
77
|
-
* the server, which alone can look them up.
|
|
78
|
-
*/
|
|
79
|
-
export declare function normalizeTaskImportRow(raw: TaskImportRawRow): TaskImportRowVerdict;
|
|
80
|
-
/** One row the server did not store, by its index in the request, named by the task. */
|
|
81
|
-
export interface TaskImportSkippedRow {
|
|
82
|
-
index: number;
|
|
83
|
-
title: string;
|
|
84
|
-
reason: TaskImportSkipReason;
|
|
85
|
-
}
|
|
86
|
-
/** What one request did. The drawer sums these across a file. */
|
|
87
|
-
export type TaskImportChunkResult = ImportChunkResult<TaskImportSkippedRow>;
|
|
88
|
-
export declare function emptyTaskImportResult(): TaskImportChunkResult;
|
|
89
|
-
export declare function mergeTaskImportResults(total: TaskImportChunkResult, chunk: TaskImportChunkResult, offset?: number): TaskImportChunkResult;
|
|
90
|
-
/** The skipped rows as a file the operator can fix and re-import. */
|
|
91
|
-
export declare function taskImportSkippedCsv(columns: readonly string[], entries: readonly {
|
|
92
|
-
cells: readonly string[];
|
|
93
|
-
reason: TaskImportSkipReason;
|
|
94
|
-
}[]): string;
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
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
|
-
*/ /**
|
|
18
|
-
* BRINGING A SPREADSHEET OF TASKS INTO THE CRM — the pure half (AGL-2662).
|
|
19
|
-
*
|
|
20
|
-
* The contact import's three stages (`crm-import.ts`) over the task
|
|
21
|
-
* vocabulary. A task is the simplest CRM record — a title, what kind of
|
|
22
|
-
* thing it is, how urgent, when it is due, whose it is — and the file
|
|
23
|
-
* carries exactly that.
|
|
24
|
-
*
|
|
25
|
-
* ## The assignee is resolved by address, and a stranger refuses the row
|
|
26
|
-
*
|
|
27
|
-
* A contact or a company whose owner address matches nobody is filed
|
|
28
|
-
* without an owner and the address is named at the end, because the
|
|
29
|
-
* record is worth having either way. A task is different: a task nobody
|
|
30
|
-
* holds is a task nobody does, and a file that names an assignee meant
|
|
31
|
-
* that person. So an address that matches no member of the organization
|
|
32
|
-
* refuses the ROW as `unknown-assignee`, and the operator fixes the sheet.
|
|
33
|
-
* A row with no assignee cell is filed unassigned, which is a choice.
|
|
34
|
-
*
|
|
35
|
-
* ## A task has no key, so nothing is merged
|
|
36
|
-
*
|
|
37
|
-
* Every row CREATES; importing a file twice files it twice. An imported
|
|
38
|
-
* task does not notify its assignee: forty notifications for a spreadsheet
|
|
39
|
-
* is noise, and the drawer's assignment notice is for one task at a time.
|
|
40
|
-
*
|
|
41
|
-
* ## A bad cell is dropped and named; a bad row is skipped and named
|
|
42
|
-
*
|
|
43
|
-
* A kind or a priority the CRM does not have falls back to the drawer's
|
|
44
|
-
* own defaults (`todo`, `normal`) and is REPORTED under
|
|
45
|
-
* {@link TaskImportRow.dropped}; a due date that is not a date is dropped
|
|
46
|
-
* the same way; a status other than open or done reads as open.
|
|
47
|
-
*/ import { normalizeContactEmail } from "@aglyn/aglyn/app-utils/contacts";
|
|
48
|
-
import { parseImportDate } from "./crm-deal-import.js";
|
|
49
|
-
import { CRM_TASK_KIND_LABELS, isCrmTaskKind } from "@aglyn/aglyn/app-utils/crm";
|
|
50
|
-
import { CSV_IMPORT_CHUNK_SIZE, CSV_IMPORT_MAX_BODY_BYTES, CSV_IMPORT_MAX_ROWS, CSV_IMPORT_PREVIEW_ROWS, emptyImportResult, guessImportMapping, importAliasKeys, importSkippedCsv, importTextValue, mapImportRow, mergeImportResults } from "@aglyn/aglyn/app-utils/csv-import";
|
|
51
|
-
/** The shared ceilings, under this collection's names. */ export const TASK_IMPORT_MAX_ROWS = CSV_IMPORT_MAX_ROWS;
|
|
52
|
-
export const TASK_IMPORT_CHUNK_SIZE = CSV_IMPORT_CHUNK_SIZE;
|
|
53
|
-
export const TASK_IMPORT_MAX_BODY_BYTES = CSV_IMPORT_MAX_BODY_BYTES;
|
|
54
|
-
export const TASK_IMPORT_PREVIEW_ROWS = CSV_IMPORT_PREVIEW_ROWS;
|
|
55
|
-
/** The same caps the task drawer holds a typed task to. */ export const TASK_IMPORT_TITLE_MAX = 200;
|
|
56
|
-
export const TASK_IMPORT_NOTES_MAX = 4000;
|
|
57
|
-
/** The fields a column may be mapped to, in the order the mapping menu lists them. */ export const TASK_IMPORT_FIELDS = [
|
|
58
|
-
'title',
|
|
59
|
-
'kind',
|
|
60
|
-
'priority',
|
|
61
|
-
'status',
|
|
62
|
-
'due',
|
|
63
|
-
'assigneeEmail',
|
|
64
|
-
'notes'
|
|
65
|
-
];
|
|
66
|
-
/** How each field reads in the mapping menu. Typed so a field cannot ship unlabeled. */ export const TASK_IMPORT_FIELD_LABELS = {
|
|
67
|
-
title: 'Title (required)',
|
|
68
|
-
kind: 'Kind (call, email, meeting, to-do)',
|
|
69
|
-
priority: 'Priority (low, normal, high)',
|
|
70
|
-
status: 'Status (open or done)',
|
|
71
|
-
due: 'Due (date or timestamp)',
|
|
72
|
-
assigneeEmail: 'Assignee (team member email)',
|
|
73
|
-
notes: 'Notes'
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Header aliases per field, matched after the shared header normalization.
|
|
77
|
-
*
|
|
78
|
-
* First in each list is the header this CRM's own tasks export writes, so
|
|
79
|
-
* an export re-imports without a hand mapping; the export's Contact,
|
|
80
|
-
* Company, Deal and Completed columns are deliberately absent, because a
|
|
81
|
-
* link is made on the record, not from a file, and the completion is
|
|
82
|
-
* stamped by the import when the status says done.
|
|
83
|
-
*/ const FIELD_ALIASES = {
|
|
84
|
-
title: [
|
|
85
|
-
'title',
|
|
86
|
-
'task',
|
|
87
|
-
'task title',
|
|
88
|
-
'task name',
|
|
89
|
-
'name',
|
|
90
|
-
'subject',
|
|
91
|
-
'summary'
|
|
92
|
-
],
|
|
93
|
-
kind: [
|
|
94
|
-
'kind',
|
|
95
|
-
'type',
|
|
96
|
-
'task type',
|
|
97
|
-
'activity type'
|
|
98
|
-
],
|
|
99
|
-
priority: [
|
|
100
|
-
'priority',
|
|
101
|
-
'importance',
|
|
102
|
-
'urgency'
|
|
103
|
-
],
|
|
104
|
-
status: [
|
|
105
|
-
'status',
|
|
106
|
-
'state',
|
|
107
|
-
'done',
|
|
108
|
-
'completed'
|
|
109
|
-
],
|
|
110
|
-
due: [
|
|
111
|
-
'due',
|
|
112
|
-
'due date',
|
|
113
|
-
'due at',
|
|
114
|
-
'deadline',
|
|
115
|
-
'due on'
|
|
116
|
-
],
|
|
117
|
-
assigneeEmail: [
|
|
118
|
-
'assignee',
|
|
119
|
-
'assignee email',
|
|
120
|
-
'assigned to',
|
|
121
|
-
'owner',
|
|
122
|
-
'owner email',
|
|
123
|
-
'rep'
|
|
124
|
-
],
|
|
125
|
-
notes: [
|
|
126
|
-
'notes',
|
|
127
|
-
'note',
|
|
128
|
-
'description',
|
|
129
|
-
'comments',
|
|
130
|
-
'details'
|
|
131
|
-
]
|
|
132
|
-
};
|
|
133
|
-
const FIELD_ALIAS_KEYS = importAliasKeys(TASK_IMPORT_FIELDS, FIELD_ALIASES);
|
|
134
|
-
/** A proposed mapping from a file's header row, each field taken at most once. */ export function guessTaskImportMapping(columns) {
|
|
135
|
-
return guessImportMapping(columns, TASK_IMPORT_FIELDS, FIELD_ALIAS_KEYS);
|
|
136
|
-
}
|
|
137
|
-
/** One parsed line under the mapping. Empty cells are left absent; a task has no custom fields. */ export function mapTaskImportRow(cells, mapping) {
|
|
138
|
-
const _mapImportRow = mapImportRow(cells, mapping), { custom: _custom } = _mapImportRow, row = _object_without_properties_loose(_mapImportRow, [
|
|
139
|
-
"custom"
|
|
140
|
-
]);
|
|
141
|
-
return row;
|
|
142
|
-
}
|
|
143
|
-
/** How a skip reason reads on screen and in the downloaded file. */ export const TASK_IMPORT_SKIP_LABELS = {
|
|
144
|
-
'missing-title': 'No title',
|
|
145
|
-
'unknown-assignee': 'No team member has that assignee address',
|
|
146
|
-
'write-failed': 'Could not be saved'
|
|
147
|
-
};
|
|
148
|
-
/** A kind cell by id or by label — `todo`, `To-do`, `to do` are one kind. */ export function parseImportTaskKind(value) {
|
|
149
|
-
const text = String(value != null ? value : '').trim().toLowerCase();
|
|
150
|
-
if (!text) return null;
|
|
151
|
-
if (isCrmTaskKind(text)) return text;
|
|
152
|
-
const bare = text.replace(/[\s-]+/g, '');
|
|
153
|
-
for (const [kind, label] of Object.entries(CRM_TASK_KIND_LABELS)){
|
|
154
|
-
if (label.toLowerCase().replace(/[\s-]+/g, '') === bare) return kind;
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
const PRIORITIES = {
|
|
159
|
-
low: 'low',
|
|
160
|
-
normal: 'normal',
|
|
161
|
-
medium: 'normal',
|
|
162
|
-
high: 'high',
|
|
163
|
-
urgent: 'high'
|
|
164
|
-
};
|
|
165
|
-
/** A priority cell as one of the three, `medium` and `urgent` folded in. */ export function parseImportTaskPriority(value) {
|
|
166
|
-
var _PRIORITIES_String_trim_toLowerCase;
|
|
167
|
-
return (_PRIORITIES_String_trim_toLowerCase = PRIORITIES[String(value != null ? value : '').trim().toLowerCase()]) != null ? _PRIORITIES_String_trim_toLowerCase : null;
|
|
168
|
-
}
|
|
169
|
-
/** A status cell as open or done — `done`, `complete`, `yes`, `true` all close it. */ export function parseImportTaskStatus(value) {
|
|
170
|
-
const text = String(value != null ? value : '').trim().toLowerCase();
|
|
171
|
-
if (!text) return null;
|
|
172
|
-
if ([
|
|
173
|
-
'done',
|
|
174
|
-
'complete',
|
|
175
|
-
'completed',
|
|
176
|
-
'closed',
|
|
177
|
-
'yes',
|
|
178
|
-
'y',
|
|
179
|
-
'true',
|
|
180
|
-
'1'
|
|
181
|
-
].includes(text)) {
|
|
182
|
-
return 'done';
|
|
183
|
-
}
|
|
184
|
-
if ([
|
|
185
|
-
'open',
|
|
186
|
-
'todo',
|
|
187
|
-
'to do',
|
|
188
|
-
'pending',
|
|
189
|
-
'no',
|
|
190
|
-
'n',
|
|
191
|
-
'false',
|
|
192
|
-
'0',
|
|
193
|
-
'incomplete'
|
|
194
|
-
].includes(text)) {
|
|
195
|
-
return 'open';
|
|
196
|
-
}
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* One raw row as the values that will be written, or the reason it cannot
|
|
201
|
-
* be. Refused here only for a missing title; the assignee is refused by
|
|
202
|
-
* the server, which alone can look them up.
|
|
203
|
-
*/ export function normalizeTaskImportRow(raw) {
|
|
204
|
-
var _importTextValue;
|
|
205
|
-
const title = (_importTextValue = importTextValue(raw.title, TASK_IMPORT_TITLE_MAX)) == null ? void 0 : _importTextValue.replace(/\s+/g, ' ');
|
|
206
|
-
if (!title) {
|
|
207
|
-
return {
|
|
208
|
-
ok: false,
|
|
209
|
-
reason: 'missing-title',
|
|
210
|
-
input: ''
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
const dropped = [];
|
|
214
|
-
const drop = (field, value)=>{
|
|
215
|
-
dropped.push({
|
|
216
|
-
field,
|
|
217
|
-
value: String(value != null ? value : '').trim()
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
const row = {
|
|
221
|
-
title,
|
|
222
|
-
kind: 'todo',
|
|
223
|
-
priority: 'normal',
|
|
224
|
-
status: 'open',
|
|
225
|
-
dueAtMs: null,
|
|
226
|
-
dropped
|
|
227
|
-
};
|
|
228
|
-
const kindText = importTextValue(raw.kind, 32);
|
|
229
|
-
if (kindText) {
|
|
230
|
-
const kind = parseImportTaskKind(kindText);
|
|
231
|
-
if (kind) row.kind = kind;
|
|
232
|
-
else drop('kind', kindText);
|
|
233
|
-
}
|
|
234
|
-
const priorityText = importTextValue(raw.priority, 32);
|
|
235
|
-
if (priorityText) {
|
|
236
|
-
const priority = parseImportTaskPriority(priorityText);
|
|
237
|
-
if (priority) row.priority = priority;
|
|
238
|
-
else drop('priority', priorityText);
|
|
239
|
-
}
|
|
240
|
-
const statusText = importTextValue(raw.status, 32);
|
|
241
|
-
if (statusText) {
|
|
242
|
-
const status = parseImportTaskStatus(statusText);
|
|
243
|
-
if (status) row.status = status;
|
|
244
|
-
else drop('status', statusText);
|
|
245
|
-
}
|
|
246
|
-
const dueText = importTextValue(raw.due, 64);
|
|
247
|
-
if (dueText) {
|
|
248
|
-
const ms = parseImportDate(dueText);
|
|
249
|
-
if (ms !== null) row.dueAtMs = ms;
|
|
250
|
-
else drop('due', dueText);
|
|
251
|
-
}
|
|
252
|
-
const assigneeText = importTextValue(raw.assigneeEmail, 320);
|
|
253
|
-
if (assigneeText) {
|
|
254
|
-
const assignee = normalizeContactEmail(assigneeText);
|
|
255
|
-
if (assignee) row.assigneeEmail = assignee;
|
|
256
|
-
else drop('assigneeEmail', assigneeText);
|
|
257
|
-
}
|
|
258
|
-
const notes = importTextValue(raw.notes, TASK_IMPORT_NOTES_MAX);
|
|
259
|
-
if (notes) row.notes = notes;
|
|
260
|
-
return {
|
|
261
|
-
ok: true,
|
|
262
|
-
row
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
export function emptyTaskImportResult() {
|
|
266
|
-
return emptyImportResult();
|
|
267
|
-
}
|
|
268
|
-
export function mergeTaskImportResults(total, chunk, offset = 0) {
|
|
269
|
-
return mergeImportResults(total, chunk, offset);
|
|
270
|
-
}
|
|
271
|
-
/** The skipped rows as a file the operator can fix and re-import. */ export function taskImportSkippedCsv(columns, entries) {
|
|
272
|
-
return importSkippedCsv(columns, entries, TASK_IMPORT_SKIP_LABELS);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
//# sourceMappingURL=crm-task-import.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/crm-task-import.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * BRINGING A SPREADSHEET OF TASKS INTO THE CRM — the pure half (AGL-2662).\n *\n * The contact import's three stages (`crm-import.ts`) over the task\n * vocabulary. A task is the simplest CRM record — a title, what kind of\n * thing it is, how urgent, when it is due, whose it is — and the file\n * carries exactly that.\n *\n * ## The assignee is resolved by address, and a stranger refuses the row\n *\n * A contact or a company whose owner address matches nobody is filed\n * without an owner and the address is named at the end, because the\n * record is worth having either way. A task is different: a task nobody\n * holds is a task nobody does, and a file that names an assignee meant\n * that person. So an address that matches no member of the organization\n * refuses the ROW as `unknown-assignee`, and the operator fixes the sheet.\n * A row with no assignee cell is filed unassigned, which is a choice.\n *\n * ## A task has no key, so nothing is merged\n *\n * Every row CREATES; importing a file twice files it twice. An imported\n * task does not notify its assignee: forty notifications for a spreadsheet\n * is noise, and the drawer's assignment notice is for one task at a time.\n *\n * ## A bad cell is dropped and named; a bad row is skipped and named\n *\n * A kind or a priority the CRM does not have falls back to the drawer's\n * own defaults (`todo`, `normal`) and is REPORTED under\n * {@link TaskImportRow.dropped}; a due date that is not a date is dropped\n * the same way; a status other than open or done reads as open.\n */\n\nimport { normalizeContactEmail } from '@aglyn/aglyn/app-utils/contacts'\nimport { parseImportDate } from './crm-deal-import'\nimport {\n CRM_TASK_KIND_LABELS,\n type CrmTaskKind,\n type CrmTaskPriority,\n type CrmTaskStatus,\n isCrmTaskKind,\n} from '@aglyn/aglyn/app-utils/crm'\nimport {\n CSV_IMPORT_CHUNK_SIZE,\n CSV_IMPORT_MAX_BODY_BYTES,\n CSV_IMPORT_MAX_ROWS,\n CSV_IMPORT_PREVIEW_ROWS,\n emptyImportResult,\n guessImportMapping,\n importAliasKeys,\n type ImportChunkResult,\n type ImportDroppedValue,\n importSkippedCsv,\n importTextValue,\n mapImportRow,\n mergeImportResults,\n} from '@aglyn/aglyn/app-utils/csv-import'\n\n/** The shared ceilings, under this collection's names. */\nexport const TASK_IMPORT_MAX_ROWS = CSV_IMPORT_MAX_ROWS\nexport const TASK_IMPORT_CHUNK_SIZE = CSV_IMPORT_CHUNK_SIZE\nexport const TASK_IMPORT_MAX_BODY_BYTES = CSV_IMPORT_MAX_BODY_BYTES\nexport const TASK_IMPORT_PREVIEW_ROWS = CSV_IMPORT_PREVIEW_ROWS\n\n/** The same caps the task drawer holds a typed task to. */\nexport const TASK_IMPORT_TITLE_MAX = 200\nexport const TASK_IMPORT_NOTES_MAX = 4000\n\n/** The fields a column may be mapped to, in the order the mapping menu lists them. */\nexport const TASK_IMPORT_FIELDS = [\n 'title',\n 'kind',\n 'priority',\n 'status',\n 'due',\n 'assigneeEmail',\n 'notes',\n] as const\n\nexport type TaskImportField = (typeof TASK_IMPORT_FIELDS)[number]\n\n/** How each field reads in the mapping menu. Typed so a field cannot ship unlabeled. */\nexport const TASK_IMPORT_FIELD_LABELS: Record<TaskImportField, string> = {\n title: 'Title (required)',\n kind: 'Kind (call, email, meeting, to-do)',\n priority: 'Priority (low, normal, high)',\n status: 'Status (open or done)',\n due: 'Due (date or timestamp)',\n assigneeEmail: 'Assignee (team member email)',\n notes: 'Notes',\n}\n\n/**\n * Header aliases per field, matched after the shared header normalization.\n *\n * First in each list is the header this CRM's own tasks export writes, so\n * an export re-imports without a hand mapping; the export's Contact,\n * Company, Deal and Completed columns are deliberately absent, because a\n * link is made on the record, not from a file, and the completion is\n * stamped by the import when the status says done.\n */\nconst FIELD_ALIASES: Record<TaskImportField, readonly string[]> = {\n title: ['title', 'task', 'task title', 'task name', 'name', 'subject', 'summary'],\n kind: ['kind', 'type', 'task type', 'activity type'],\n priority: ['priority', 'importance', 'urgency'],\n status: ['status', 'state', 'done', 'completed'],\n due: ['due', 'due date', 'due at', 'deadline', 'due on'],\n assigneeEmail: ['assignee', 'assignee email', 'assigned to', 'owner', 'owner email', 'rep'],\n notes: ['notes', 'note', 'description', 'comments', 'details'],\n}\n\nconst FIELD_ALIAS_KEYS = importAliasKeys(TASK_IMPORT_FIELDS, FIELD_ALIASES)\n\n/** Column index → field. A column absent from the map is not imported. */\nexport type TaskImportMapping = Record<number, TaskImportField>\n\n/** A proposed mapping from a file's header row, each field taken at most once. */\nexport function guessTaskImportMapping(columns: readonly string[]): TaskImportMapping {\n return guessImportMapping(columns, TASK_IMPORT_FIELDS, FIELD_ALIAS_KEYS)\n}\n\n/**\n * What the browser posts for one line: the cells the mapping selected,\n * under the field they were mapped to, verbatim. `unknown` because the\n * server reads this off an untrusted body.\n */\nexport type TaskImportRawRow = Partial<Record<TaskImportField, unknown>>\n\n/** One parsed line under the mapping. Empty cells are left absent; a task has no custom fields. */\nexport function mapTaskImportRow(\n cells: readonly string[],\n mapping: Record<number, TaskImportField | `custom:${string}`>,\n): TaskImportRawRow {\n const { custom: _custom, ...row } = mapImportRow(cells, mapping)\n return row\n}\n\nexport type TaskImportSkipReason =\n | 'missing-title'\n | 'unknown-assignee'\n | 'write-failed'\n\n/** How a skip reason reads on screen and in the downloaded file. */\nexport const TASK_IMPORT_SKIP_LABELS: Record<TaskImportSkipReason, string> = {\n 'missing-title': 'No title',\n 'unknown-assignee': 'No team member has that assignee address',\n 'write-failed': 'Could not be saved',\n}\n\n/** One row, ready for the server to resolve and write. */\nexport interface TaskImportRow {\n title: string\n kind: CrmTaskKind\n priority: CrmTaskPriority\n status: CrmTaskStatus\n /** Epoch ms, or `null` for no due date — the shape the document stores. */\n dueAtMs: number | null\n /** Normalized, for the server to resolve against the org's members. */\n assigneeEmail?: string\n notes?: string\n dropped: ImportDroppedValue[]\n}\n\nexport type TaskImportRowVerdict =\n | { ok: true; row: TaskImportRow }\n | { ok: false; reason: 'missing-title'; input: string }\n\n/** A kind cell by id or by label — `todo`, `To-do`, `to do` are one kind. */\nexport function parseImportTaskKind(value: unknown): CrmTaskKind | null {\n const text = String(value ?? '')\n .trim()\n .toLowerCase()\n if (!text) return null\n if (isCrmTaskKind(text)) return text\n const bare = text.replace(/[\\s-]+/g, '')\n for (const [kind, label] of Object.entries(CRM_TASK_KIND_LABELS)) {\n if (label.toLowerCase().replace(/[\\s-]+/g, '') === bare) return kind as CrmTaskKind\n }\n return null\n}\n\nconst PRIORITIES: Record<string, CrmTaskPriority> = {\n low: 'low',\n normal: 'normal',\n medium: 'normal',\n high: 'high',\n urgent: 'high',\n}\n\n/** A priority cell as one of the three, `medium` and `urgent` folded in. */\nexport function parseImportTaskPriority(value: unknown): CrmTaskPriority | null {\n return PRIORITIES[String(value ?? '').trim().toLowerCase()] ?? null\n}\n\n/** A status cell as open or done — `done`, `complete`, `yes`, `true` all close it. */\nexport function parseImportTaskStatus(value: unknown): CrmTaskStatus | null {\n const text = String(value ?? '')\n .trim()\n .toLowerCase()\n if (!text) return null\n if (['done', 'complete', 'completed', 'closed', 'yes', 'y', 'true', '1'].includes(text)) {\n return 'done'\n }\n if (['open', 'todo', 'to do', 'pending', 'no', 'n', 'false', '0', 'incomplete'].includes(text)) {\n return 'open'\n }\n return null\n}\n\n/**\n * One raw row as the values that will be written, or the reason it cannot\n * be. Refused here only for a missing title; the assignee is refused by\n * the server, which alone can look them up.\n */\nexport function normalizeTaskImportRow(raw: TaskImportRawRow): TaskImportRowVerdict {\n const title = importTextValue(raw.title, TASK_IMPORT_TITLE_MAX)?.replace(/\\s+/g, ' ')\n if (!title) {\n return { ok: false, reason: 'missing-title', input: '' }\n }\n const dropped: ImportDroppedValue[] = []\n const drop = (field: TaskImportField, value: unknown) => {\n dropped.push({ field, value: String(value ?? '').trim() })\n }\n const row: TaskImportRow = {\n title,\n kind: 'todo',\n priority: 'normal',\n status: 'open',\n dueAtMs: null,\n dropped,\n }\n\n const kindText = importTextValue(raw.kind, 32)\n if (kindText) {\n const kind = parseImportTaskKind(kindText)\n if (kind) row.kind = kind\n else drop('kind', kindText)\n }\n\n const priorityText = importTextValue(raw.priority, 32)\n if (priorityText) {\n const priority = parseImportTaskPriority(priorityText)\n if (priority) row.priority = priority\n else drop('priority', priorityText)\n }\n\n const statusText = importTextValue(raw.status, 32)\n if (statusText) {\n const status = parseImportTaskStatus(statusText)\n if (status) row.status = status\n else drop('status', statusText)\n }\n\n const dueText = importTextValue(raw.due, 64)\n if (dueText) {\n const ms = parseImportDate(dueText)\n if (ms !== null) row.dueAtMs = ms\n else drop('due', dueText)\n }\n\n const assigneeText = importTextValue(raw.assigneeEmail, 320)\n if (assigneeText) {\n const assignee = normalizeContactEmail(assigneeText)\n if (assignee) row.assigneeEmail = assignee\n else drop('assigneeEmail', assigneeText)\n }\n\n const notes = importTextValue(raw.notes, TASK_IMPORT_NOTES_MAX)\n if (notes) row.notes = notes\n\n return { ok: true, row }\n}\n\n/** One row the server did not store, by its index in the request, named by the task. */\nexport interface TaskImportSkippedRow {\n index: number\n title: string\n reason: TaskImportSkipReason\n}\n\n/** What one request did. The drawer sums these across a file. */\nexport type TaskImportChunkResult = ImportChunkResult<TaskImportSkippedRow>\n\nexport function emptyTaskImportResult(): TaskImportChunkResult {\n return emptyImportResult<TaskImportSkippedRow>()\n}\n\nexport function mergeTaskImportResults(\n total: TaskImportChunkResult,\n chunk: TaskImportChunkResult,\n offset = 0,\n): TaskImportChunkResult {\n return mergeImportResults(total, chunk, offset)\n}\n\n/** The skipped rows as a file the operator can fix and re-import. */\nexport function taskImportSkippedCsv(\n columns: readonly string[],\n entries: readonly { cells: readonly string[]; reason: TaskImportSkipReason }[],\n): string {\n return importSkippedCsv(columns, entries, TASK_IMPORT_SKIP_LABELS)\n}\n"],"names":["normalizeContactEmail","parseImportDate","CRM_TASK_KIND_LABELS","isCrmTaskKind","CSV_IMPORT_CHUNK_SIZE","CSV_IMPORT_MAX_BODY_BYTES","CSV_IMPORT_MAX_ROWS","CSV_IMPORT_PREVIEW_ROWS","emptyImportResult","guessImportMapping","importAliasKeys","importSkippedCsv","importTextValue","mapImportRow","mergeImportResults","TASK_IMPORT_MAX_ROWS","TASK_IMPORT_CHUNK_SIZE","TASK_IMPORT_MAX_BODY_BYTES","TASK_IMPORT_PREVIEW_ROWS","TASK_IMPORT_TITLE_MAX","TASK_IMPORT_NOTES_MAX","TASK_IMPORT_FIELDS","TASK_IMPORT_FIELD_LABELS","title","kind","priority","status","due","assigneeEmail","notes","FIELD_ALIASES","FIELD_ALIAS_KEYS","guessTaskImportMapping","columns","mapTaskImportRow","cells","mapping","custom","_custom","row","TASK_IMPORT_SKIP_LABELS","parseImportTaskKind","value","text","String","trim","toLowerCase","bare","replace","label","Object","entries","PRIORITIES","low","normal","medium","high","urgent","parseImportTaskPriority","parseImportTaskStatus","includes","normalizeTaskImportRow","raw","ok","reason","input","dropped","drop","field","push","dueAtMs","kindText","priorityText","statusText","dueText","ms","assigneeText","assignee","emptyTaskImportResult","mergeTaskImportResults","total","chunk","offset","taskImportSkippedCsv"],"mappings":"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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2026 Aglyn LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* The deals CSV — one file from the table's Export button and the bulk
|
|
19
|
-
* bar's (AGL-2621).
|
|
20
|
-
*
|
|
21
|
-
* A deal names its stage, its owner, its contact and its company by id, and
|
|
22
|
-
* an id is nothing a spreadsheet can read: the stage and the pipeline are
|
|
23
|
-
* written by NAME, resolved through the caller's pipelines, the owner by
|
|
24
|
-
* address, and the contact and the company by the names the deal already
|
|
25
|
-
* carries as captions. The amount is written in major units (`1250.00`),
|
|
26
|
-
* with the currency beside it, because a column of cents is a column
|
|
27
|
-
* somebody will sum wrongly.
|
|
28
|
-
*
|
|
29
|
-
* There is no deals import, so the header is free to read well; it stays
|
|
30
|
-
* in the table's column order so the file and the screen agree.
|
|
31
|
-
*/
|
|
32
|
-
export { csvAmount, csvInstant, DEAL_CSV_COLUMNS, dealsCsv, type DealCsvOptions, type DealCsvRow, } from './crm-csv';
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
* The deals CSV — one file from the table's Export button and the bulk
|
|
18
|
-
* bar's (AGL-2621).
|
|
19
|
-
*
|
|
20
|
-
* A deal names its stage, its owner, its contact and its company by id, and
|
|
21
|
-
* an id is nothing a spreadsheet can read: the stage and the pipeline are
|
|
22
|
-
* written by NAME, resolved through the caller's pipelines, the owner by
|
|
23
|
-
* address, and the contact and the company by the names the deal already
|
|
24
|
-
* carries as captions. The amount is written in major units (`1250.00`),
|
|
25
|
-
* with the currency beside it, because a column of cents is a column
|
|
26
|
-
* somebody will sum wrongly.
|
|
27
|
-
*
|
|
28
|
-
* There is no deals import, so the header is free to read well; it stays
|
|
29
|
-
* in the table's column order so the file and the screen agree.
|
|
30
|
-
*/ /*
|
|
31
|
-
* The columns and the cells are `crm-csv.ts`, which the server's
|
|
32
|
-
* whole-collection export writes too (AGL-2662): one feature, one file
|
|
33
|
-
* format. This module keeps its name and its callers.
|
|
34
|
-
*/ export { csvAmount, csvInstant, DEAL_CSV_COLUMNS, dealsCsv } from "./crm-csv.js";
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=deals-csv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/deals-csv.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The deals CSV — one file from the table's Export button and the bulk\n * bar's (AGL-2621).\n *\n * A deal names its stage, its owner, its contact and its company by id, and\n * an id is nothing a spreadsheet can read: the stage and the pipeline are\n * written by NAME, resolved through the caller's pipelines, the owner by\n * address, and the contact and the company by the names the deal already\n * carries as captions. The amount is written in major units (`1250.00`),\n * with the currency beside it, because a column of cents is a column\n * somebody will sum wrongly.\n *\n * There is no deals import, so the header is free to read well; it stays\n * in the table's column order so the file and the screen agree.\n */\n\n/*\n * The columns and the cells are `crm-csv.ts`, which the server's\n * whole-collection export writes too (AGL-2662): one feature, one file\n * format. This module keeps its name and its callers.\n */\nexport {\n csvAmount,\n csvInstant,\n DEAL_CSV_COLUMNS,\n dealsCsv,\n type DealCsvOptions,\n type DealCsvRow,\n} from './crm-csv'\n"],"names":["csvAmount","csvInstant","DEAL_CSV_COLUMNS","dealsCsv"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED;;;;CAIC,GACD,SACEA,SAAS,EACTC,UAAU,EACVC,gBAAgB,EAChBC,QAAQ,QAGH,eAAW"}
|
|
@@ -1,36 +0,0 @@
|
|
|
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 { ConsoleImportColumn, ConsoleImportColumnShape } from '@aglyn/aglyn/plugin-manager/record-zone-props';
|
|
18
|
-
/**
|
|
19
|
-
* WHAT A FILE'S COLUMN HOLDS, WITHOUT SAYING WHAT IS IN IT (AGL-2917).
|
|
20
|
-
*
|
|
21
|
-
* The import drawer's `importMapping` zone tells a widget each column's header
|
|
22
|
-
* and one word for its values — an email address, a phone number, a date —
|
|
23
|
-
* and never a cell. The word is read here, in the browser, from the rows the
|
|
24
|
-
* drawer already parsed, so a widget that asks a model to match the columns
|
|
25
|
-
* has nothing of the file's people to pass on.
|
|
26
|
-
*/
|
|
27
|
-
/** Non-empty cells a column's shape is read from. */
|
|
28
|
-
export declare const IMPORT_SHAPE_SAMPLE = 50;
|
|
29
|
-
/** Rows a column's cells are looked for in; past these a file says nothing new about its shape. */
|
|
30
|
-
export declare const IMPORT_SHAPE_ROWS = 500;
|
|
31
|
-
/** The share of those cells that must agree for a column to take a shape. */
|
|
32
|
-
export declare const IMPORT_SHAPE_AGREEMENT = 0.8;
|
|
33
|
-
/** One column's shape, from its cells: the first shape most of them agree on, else `text`. */
|
|
34
|
-
export declare function importColumnShape(cells: readonly unknown[]): ConsoleImportColumnShape;
|
|
35
|
-
/** Every column of a parsed file: its header, and the shape of what the rows under it hold. */
|
|
36
|
-
export declare function importColumns(headers: readonly string[], rows: ReadonlyArray<readonly unknown[]>): ConsoleImportColumn[];
|
|
@@ -1,76 +0,0 @@
|
|
|
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
|
-
* WHAT A FILE'S COLUMN HOLDS, WITHOUT SAYING WHAT IS IN IT (AGL-2917).
|
|
18
|
-
*
|
|
19
|
-
* The import drawer's `importMapping` zone tells a widget each column's header
|
|
20
|
-
* and one word for its values — an email address, a phone number, a date —
|
|
21
|
-
* and never a cell. The word is read here, in the browser, from the rows the
|
|
22
|
-
* drawer already parsed, so a widget that asks a model to match the columns
|
|
23
|
-
* has nothing of the file's people to pass on.
|
|
24
|
-
*/ /** Non-empty cells a column's shape is read from. */ export const IMPORT_SHAPE_SAMPLE = 50;
|
|
25
|
-
/** Rows a column's cells are looked for in; past these a file says nothing new about its shape. */ export const IMPORT_SHAPE_ROWS = 500;
|
|
26
|
-
/** The share of those cells that must agree for a column to take a shape. */ export const IMPORT_SHAPE_AGREEMENT = 0.8;
|
|
27
|
-
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
28
|
-
const YES_NO = /^(?:yes|no|y|n|true|false|opted in|opted out|subscribed|unsubscribed)$/i;
|
|
29
|
-
const NUMBER = /^[-+]?[$€£¥]?\s?(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d+)?%?$/;
|
|
30
|
-
const DATE = /^(?:\d{4}-\d{1,2}-\d{1,2}(?:[T ][\d:.]+(?:Z|[+-]\d{2}:?\d{2})?)?|\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}|(?:\d{1,2}\s+)?(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*\.?\s+\d{1,2}(?:st|nd|rd|th)?,?\s+\d{4})$/i;
|
|
31
|
-
const PHONE = /^\+?[\d\s().-]{7,}$/;
|
|
32
|
-
const URL = /^(?:https?:\/\/)?(?:[\w-]+\.)+[a-z]{2,}(?:[/?#]\S*)?$/i;
|
|
33
|
-
const SHAPES = [
|
|
34
|
-
[
|
|
35
|
-
'email',
|
|
36
|
-
(value)=>EMAIL.test(value)
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
'yes-no',
|
|
40
|
-
(value)=>YES_NO.test(value)
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
'date',
|
|
44
|
-
(value)=>DATE.test(value)
|
|
45
|
-
],
|
|
46
|
-
[
|
|
47
|
-
'number',
|
|
48
|
-
(value)=>NUMBER.test(value)
|
|
49
|
-
],
|
|
50
|
-
[
|
|
51
|
-
'phone',
|
|
52
|
-
(value)=>PHONE.test(value) && value.replace(/\D/g, '').length >= 7
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
'url',
|
|
56
|
-
(value)=>URL.test(value)
|
|
57
|
-
]
|
|
58
|
-
];
|
|
59
|
-
/** One column's shape, from its cells: the first shape most of them agree on, else `text`. */ export function importColumnShape(cells) {
|
|
60
|
-
const values = cells.map((cell)=>String(cell != null ? cell : '').trim()).filter(Boolean).slice(0, IMPORT_SHAPE_SAMPLE);
|
|
61
|
-
if (!values.length) return 'empty';
|
|
62
|
-
for (const [shape, test] of SHAPES){
|
|
63
|
-
const agreeing = values.filter(test).length;
|
|
64
|
-
if (agreeing / values.length >= IMPORT_SHAPE_AGREEMENT) return shape;
|
|
65
|
-
}
|
|
66
|
-
return 'text';
|
|
67
|
-
}
|
|
68
|
-
/** Every column of a parsed file: its header, and the shape of what the rows under it hold. */ export function importColumns(headers, rows) {
|
|
69
|
-
const sample = rows.slice(0, IMPORT_SHAPE_ROWS);
|
|
70
|
-
return headers.map((header, index)=>({
|
|
71
|
-
header: String(header != null ? header : '').trim(),
|
|
72
|
-
shape: importColumnShape(sample.map((row)=>row[index]))
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//# sourceMappingURL=import-column-shapes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/import-column-shapes.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 type {\n ConsoleImportColumn,\n ConsoleImportColumnShape,\n} from '@aglyn/aglyn/plugin-manager/record-zone-props'\n\n/**\n * WHAT A FILE'S COLUMN HOLDS, WITHOUT SAYING WHAT IS IN IT (AGL-2917).\n *\n * The import drawer's `importMapping` zone tells a widget each column's header\n * and one word for its values — an email address, a phone number, a date —\n * and never a cell. The word is read here, in the browser, from the rows the\n * drawer already parsed, so a widget that asks a model to match the columns\n * has nothing of the file's people to pass on.\n */\n\n/** Non-empty cells a column's shape is read from. */\nexport const IMPORT_SHAPE_SAMPLE = 50\n\n/** Rows a column's cells are looked for in; past these a file says nothing new about its shape. */\nexport const IMPORT_SHAPE_ROWS = 500\n\n/** The share of those cells that must agree for a column to take a shape. */\nexport const IMPORT_SHAPE_AGREEMENT = 0.8\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\nconst YES_NO = /^(?:yes|no|y|n|true|false|opted in|opted out|subscribed|unsubscribed)$/i\nconst NUMBER = /^[-+]?[$€£¥]?\\s?(?:\\d{1,3}(?:,\\d{3})+|\\d+)(?:\\.\\d+)?%?$/\nconst DATE =\n /^(?:\\d{4}-\\d{1,2}-\\d{1,2}(?:[T ][\\d:.]+(?:Z|[+-]\\d{2}:?\\d{2})?)?|\\d{1,2}[/.-]\\d{1,2}[/.-]\\d{2,4}|(?:\\d{1,2}\\s+)?(?:jan|feb|mar|apr|may|jun|jul|aug|sep|sept|oct|nov|dec)[a-z]*\\.?\\s+\\d{1,2}(?:st|nd|rd|th)?,?\\s+\\d{4})$/i\nconst PHONE = /^\\+?[\\d\\s().-]{7,}$/\nconst URL = /^(?:https?:\\/\\/)?(?:[\\w-]+\\.)+[a-z]{2,}(?:[/?#]\\S*)?$/i\n\nconst SHAPES: ReadonlyArray<[ConsoleImportColumnShape, (value: string) => boolean]> = [\n ['email', (value) => EMAIL.test(value)],\n ['yes-no', (value) => YES_NO.test(value)],\n ['date', (value) => DATE.test(value)],\n ['number', (value) => NUMBER.test(value)],\n ['phone', (value) => PHONE.test(value) && value.replace(/\\D/g, '').length >= 7],\n ['url', (value) => URL.test(value)],\n]\n\n/** One column's shape, from its cells: the first shape most of them agree on, else `text`. */\nexport function importColumnShape(cells: readonly unknown[]): ConsoleImportColumnShape {\n const values = cells\n .map((cell) => String(cell ?? '').trim())\n .filter(Boolean)\n .slice(0, IMPORT_SHAPE_SAMPLE)\n if (!values.length) return 'empty'\n for (const [shape, test] of SHAPES) {\n const agreeing = values.filter(test).length\n if (agreeing / values.length >= IMPORT_SHAPE_AGREEMENT) return shape\n }\n return 'text'\n}\n\n/** Every column of a parsed file: its header, and the shape of what the rows under it hold. */\nexport function importColumns(\n headers: readonly string[],\n rows: ReadonlyArray<readonly unknown[]>,\n): ConsoleImportColumn[] {\n const sample = rows.slice(0, IMPORT_SHAPE_ROWS)\n return headers.map((header, index) => ({\n header: String(header ?? '').trim(),\n shape: importColumnShape(sample.map((row) => row[index])),\n }))\n}\n"],"names":["IMPORT_SHAPE_SAMPLE","IMPORT_SHAPE_ROWS","IMPORT_SHAPE_AGREEMENT","EMAIL","YES_NO","NUMBER","DATE","PHONE","URL","SHAPES","value","test","replace","length","importColumnShape","cells","values","map","cell","String","trim","filter","Boolean","slice","shape","agreeing","importColumns","headers","rows","sample","header","index","row"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAOD;;;;;;;;CAQC,GAED,mDAAmD,GACnD,OAAO,MAAMA,sBAAsB,GAAE;AAErC,iGAAiG,GACjG,OAAO,MAAMC,oBAAoB,IAAG;AAEpC,2EAA2E,GAC3E,OAAO,MAAMC,yBAAyB,IAAG;AAEzC,MAAMC,QAAQ;AACd,MAAMC,SAAS;AACf,MAAMC,SAAS;AACf,MAAMC,OACJ;AACF,MAAMC,QAAQ;AACd,MAAMC,MAAM;AAEZ,MAAMC,SAAgF;IACpF;QAAC;QAAS,CAACC,QAAUP,MAAMQ,IAAI,CAACD;KAAO;IACvC;QAAC;QAAU,CAACA,QAAUN,OAAOO,IAAI,CAACD;KAAO;IACzC;QAAC;QAAQ,CAACA,QAAUJ,KAAKK,IAAI,CAACD;KAAO;IACrC;QAAC;QAAU,CAACA,QAAUL,OAAOM,IAAI,CAACD;KAAO;IACzC;QAAC;QAAS,CAACA,QAAUH,MAAMI,IAAI,CAACD,UAAUA,MAAME,OAAO,CAAC,OAAO,IAAIC,MAAM,IAAI;KAAE;IAC/E;QAAC;QAAO,CAACH,QAAUF,IAAIG,IAAI,CAACD;KAAO;CACpC;AAED,4FAA4F,GAC5F,OAAO,SAASI,kBAAkBC,KAAyB;IACzD,MAAMC,SAASD,MACZE,GAAG,CAAC,CAACC,OAASC,OAAOD,eAAAA,OAAQ,IAAIE,IAAI,IACrCC,MAAM,CAACC,SACPC,KAAK,CAAC,GAAGvB;IACZ,IAAI,CAACgB,OAAOH,MAAM,EAAE,OAAO;IAC3B,KAAK,MAAM,CAACW,OAAOb,KAAK,IAAIF,OAAQ;QAClC,MAAMgB,WAAWT,OAAOK,MAAM,CAACV,MAAME,MAAM;QAC3C,IAAIY,WAAWT,OAAOH,MAAM,IAAIX,wBAAwB,OAAOsB;IACjE;IACA,OAAO;AACT;AAEA,6FAA6F,GAC7F,OAAO,SAASE,cACdC,OAA0B,EAC1BC,IAAuC;IAEvC,MAAMC,SAASD,KAAKL,KAAK,CAAC,GAAGtB;IAC7B,OAAO0B,QAAQV,GAAG,CAAC,CAACa,QAAQC,QAAW,CAAA;YACrCD,QAAQX,OAAOW,iBAAAA,SAAU,IAAIV,IAAI;YACjCI,OAAOV,kBAAkBe,OAAOZ,GAAG,CAAC,CAACe,MAAQA,GAAG,CAACD,MAAM;QACzD,CAAA;AACF"}
|