@aglyn/plugins-crm 1.0.0-beta.221 → 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 +65 -21
- 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
|
@@ -1,757 +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
|
-
*/ 'use client';
|
|
17
|
-
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
-
/**
|
|
20
|
-
* IMPORTING A CSV INTO A CRM COLLECTION — the screen, for whichever
|
|
21
|
-
* collection (AGL-2602, shared since AGL-2621).
|
|
22
|
-
*
|
|
23
|
-
* The contact import settled the walk from a file on disk to a result the
|
|
24
|
-
* operator can act on: choose the file, read what is in it, match its
|
|
25
|
-
* columns to fields with the first row beside each, preview the ten rows
|
|
26
|
-
* the mapping produces, run it in bounded requests with a progress bar,
|
|
27
|
-
* and report what was added, updated and skipped with the skipped rows as
|
|
28
|
-
* a file to fix. A companies file walks the same path with a different
|
|
29
|
-
* vocabulary, so the walk lives here once and each collection hands in a
|
|
30
|
-
* {@link CsvImportVocabulary}: its fields and their labels, the one field
|
|
31
|
-
* every row needs, its route, its tally, its template.
|
|
32
|
-
*
|
|
33
|
-
* ## The file is read in the browser, and judged on the server
|
|
34
|
-
*
|
|
35
|
-
* `parseCsv` — the same parser the list import and the dataset import run
|
|
36
|
-
* — turns the file into cells here, so the operator can map and preview
|
|
37
|
-
* without a round trip and without uploading a file they may still decide
|
|
38
|
-
* not to import. Nothing is VALIDATED here beyond counting the rows whose
|
|
39
|
-
* required cell is unusable, and that count is a courtesy: every row is
|
|
40
|
-
* judged by the route, through the normalizers every other door uses, and
|
|
41
|
-
* the numbers on the result panel are the server's.
|
|
42
|
-
*
|
|
43
|
-
* ## Bounded requests, and closing stops them
|
|
44
|
-
*
|
|
45
|
-
* A chunk per request, as many requests as the file needs, and a progress
|
|
46
|
-
* bar between them. Closing the drawer mid-run stops the loop after the
|
|
47
|
-
* request in flight; the rows already written stay written and the result
|
|
48
|
-
* panel says how far it got. There is no durable job to resume — an import
|
|
49
|
-
* is idempotent by construction (the door dedupes on the address, or the
|
|
50
|
-
* domain and the name), so running the same file again finishes what a
|
|
51
|
-
* closed drawer left, reporting the earlier rows as merged.
|
|
52
|
-
*/ import { customImportTarget, customImportTargetKey, importNoMailServerSentence, CSV_UPLOAD_MAX_CHARACTERS, parseCsv } from "@aglyn/aglyn";
|
|
53
|
-
import { ICON_VARIANT_CLOSE } from "@aglyn/shared-data-enums";
|
|
54
|
-
import { Container, HelpTip, MdiIcon, SrOnly } from "@aglyn/shared-ui-jsx";
|
|
55
|
-
import { NavigationDrawerComponent } from "@aglyn/shared-ui-jsx/components/navigation-drawer.component";
|
|
56
|
-
import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
|
|
57
|
-
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
58
|
-
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
59
|
-
import { useOrgDataScope, useUser } from "@aglyn/tenant-feature-instance";
|
|
60
|
-
import { useConsoleWidgetSlot } from "@aglyn/aglyn/app-utils/console-widget-slot-context";
|
|
61
|
-
import { Alert, AlertTitle, Box, Button, Chip, IconButton, LinearProgress, MenuItem, Stack, TableBody, TableCell, TableHead, TableRow, TextField, Typography } from "@mui/material";
|
|
62
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
63
|
-
import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
|
|
64
|
-
import { downloadTextFile } from "../model/contacts-csv.js";
|
|
65
|
-
import { importColumns } from "../model/import-column-shapes.js";
|
|
66
|
-
import { CrmSitePicker } from "./crm-site-picker.js";
|
|
67
|
-
/** The value the mapping select shows for a column that is not imported. */ const SKIP_TARGET = '';
|
|
68
|
-
/** What a target is called — a standard field's label, or the custom field's. */ function targetLabel(target, vocabulary) {
|
|
69
|
-
var _vocabulary_fieldLabels_target;
|
|
70
|
-
const customKey = customImportTargetKey(target);
|
|
71
|
-
if (customKey) {
|
|
72
|
-
var _ref;
|
|
73
|
-
var _vocabulary_customFields_find, _vocabulary_customFields;
|
|
74
|
-
return (_ref = (_vocabulary_customFields = vocabulary.customFields) == null ? void 0 : (_vocabulary_customFields_find = _vocabulary_customFields.find((field)=>field.key === customKey)) == null ? void 0 : _vocabulary_customFields_find.label) != null ? _ref : customKey;
|
|
75
|
-
}
|
|
76
|
-
return (_vocabulary_fieldLabels_target = vocabulary.fieldLabels[target]) != null ? _vocabulary_fieldLabels_target : target;
|
|
77
|
-
}
|
|
78
|
-
/** What a dropped-value field is called in the result panel — the label without its hint. */ function droppedFieldLabel(field, vocabulary) {
|
|
79
|
-
return targetLabel(field, vocabulary).replace(/ \(.*\)$/, '');
|
|
80
|
-
}
|
|
81
|
-
export function CsvImportDrawer(props) {
|
|
82
|
-
var _ref, _rows_;
|
|
83
|
-
const { open, onClose, hostId, vocabulary } = props;
|
|
84
|
-
const { data: user } = useUser();
|
|
85
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
86
|
-
// The site every row is captured under: the mounted one, or at the
|
|
87
|
-
// organization level the one the picker named — `null` until it has.
|
|
88
|
-
const mount = useCrmOrgMount();
|
|
89
|
-
const createHostId = (_ref = hostId != null ? hostId : mount == null ? void 0 : mount.createHostId) != null ? _ref : null;
|
|
90
|
-
const [fileName, setFileName] = useState('');
|
|
91
|
-
const [columns, setColumns] = useState([]);
|
|
92
|
-
const [rows, setRows] = useState([]);
|
|
93
|
-
/** How many rows the file had past the ceiling, so the drawer can say so. */ const [overCeiling, setOverCeiling] = useState(0);
|
|
94
|
-
const [mapping, setMapping] = useState({});
|
|
95
|
-
const [result, setResult] = useState(null);
|
|
96
|
-
const [progress, setProgress] = useState(null);
|
|
97
|
-
const [busy, setBusy] = useState(false);
|
|
98
|
-
/**
|
|
99
|
-
* Set when the drawer closes mid-run, read by the loop.
|
|
100
|
-
*
|
|
101
|
-
* A ref and not state, for the reason the list import gives: the loop is
|
|
102
|
-
* an `async` function that captured its closure when it started, and a
|
|
103
|
-
* state value it read would be the one from that render.
|
|
104
|
-
*/ const abandoned = useRef(false);
|
|
105
|
-
useEffect(()=>{
|
|
106
|
-
if (open) abandoned.current = false;
|
|
107
|
-
}, [
|
|
108
|
-
open
|
|
109
|
-
]);
|
|
110
|
-
const reset = useCallback(()=>{
|
|
111
|
-
setFileName('');
|
|
112
|
-
setColumns([]);
|
|
113
|
-
setRows([]);
|
|
114
|
-
setOverCeiling(0);
|
|
115
|
-
setMapping({});
|
|
116
|
-
setResult(null);
|
|
117
|
-
setProgress(null);
|
|
118
|
-
}, []);
|
|
119
|
-
const handleClose = useCallback(()=>{
|
|
120
|
-
abandoned.current = true;
|
|
121
|
-
onClose();
|
|
122
|
-
}, [
|
|
123
|
-
onClose
|
|
124
|
-
]);
|
|
125
|
-
const handleFile = useCallback(async (file)=>{
|
|
126
|
-
if (!file) return;
|
|
127
|
-
const contents = await file.text().catch(()=>'');
|
|
128
|
-
if (contents.length > CSV_UPLOAD_MAX_CHARACTERS) {
|
|
129
|
-
return void enqueueSnackbar('That file is too large to read in one go. Split it and import the ' + 'pieces.', {
|
|
130
|
-
variant: 'warning',
|
|
131
|
-
allowDuplicate: true
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
const table = parseCsv(contents).filter((cells)=>cells.some((cell)=>String(cell != null ? cell : '').trim()));
|
|
135
|
-
if (table.length < 2) {
|
|
136
|
-
return void enqueueSnackbar('That file needs a header row and at least one row under it.', {
|
|
137
|
-
variant: 'warning',
|
|
138
|
-
allowDuplicate: true
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
const header = table[0].map((cell)=>String(cell != null ? cell : '').trim());
|
|
142
|
-
const body = table.slice(1);
|
|
143
|
-
setFileName(file.name);
|
|
144
|
-
setColumns(header);
|
|
145
|
-
setRows(body.slice(0, vocabulary.maxRows));
|
|
146
|
-
setOverCeiling(Math.max(0, body.length - vocabulary.maxRows));
|
|
147
|
-
setMapping(vocabulary.guessMapping(header));
|
|
148
|
-
setResult(null);
|
|
149
|
-
setProgress(null);
|
|
150
|
-
}, [
|
|
151
|
-
enqueueSnackbar,
|
|
152
|
-
vocabulary
|
|
153
|
-
]);
|
|
154
|
-
const requiredMapped = Object.values(mapping).includes(vocabulary.requiredField);
|
|
155
|
-
/** Rows whose required cell the server would refuse. */ const unusableRows = useMemo(()=>{
|
|
156
|
-
var _ref, _vocabulary_unusable;
|
|
157
|
-
var _Object_entries_find;
|
|
158
|
-
const at = Number((_ref = (_Object_entries_find = Object.entries(mapping).find(([, target])=>target === vocabulary.requiredField)) == null ? void 0 : _Object_entries_find[0]) != null ? _ref : -1);
|
|
159
|
-
if (at < 0) return rows.length;
|
|
160
|
-
const unusable = (_vocabulary_unusable = vocabulary.unusable) != null ? _vocabulary_unusable : (cell)=>!cell.trim();
|
|
161
|
-
return rows.filter((cells)=>{
|
|
162
|
-
var _cells_at;
|
|
163
|
-
return unusable(String((_cells_at = cells[at]) != null ? _cells_at : ''));
|
|
164
|
-
}).length;
|
|
165
|
-
}, [
|
|
166
|
-
mapping,
|
|
167
|
-
rows,
|
|
168
|
-
vocabulary
|
|
169
|
-
]);
|
|
170
|
-
const preview = useMemo(()=>rows.slice(0, vocabulary.previewRows).map((cells)=>vocabulary.mapRow(cells, mapping)), [
|
|
171
|
-
rows,
|
|
172
|
-
mapping,
|
|
173
|
-
vocabulary
|
|
174
|
-
]);
|
|
175
|
-
// The collection's own warning over the whole mapped file, when it has one.
|
|
176
|
-
const rowsNotice = useMemo(()=>vocabulary.rowsNotice && rows.length ? vocabulary.rowsNotice(rows.map((cells)=>vocabulary.mapRow(cells, mapping))) : null, [
|
|
177
|
-
rows,
|
|
178
|
-
mapping,
|
|
179
|
-
vocabulary
|
|
180
|
-
]);
|
|
181
|
-
const mappedTargets = useMemo(()=>Object.entries(mapping).sort(([a], [b])=>Number(a) - Number(b)).map(([, target])=>target), [
|
|
182
|
-
mapping
|
|
183
|
-
]);
|
|
184
|
-
/*
|
|
185
|
-
* The `importMapping` zone (AGL-2917), hosted through the shell's renderer:
|
|
186
|
-
* a widget there reads each column's header and shape, never a cell, and
|
|
187
|
-
* proposes a matching, which replaces the table's above for the preview to
|
|
188
|
-
* show. A target this import does not offer, or one a column before it
|
|
189
|
-
* already took, is dropped, as the table itself would refuse it.
|
|
190
|
-
*/ const MappingSlot = useConsoleWidgetSlot();
|
|
191
|
-
const { orgId } = useOrgDataScope({
|
|
192
|
-
hostId: hostId != null ? hostId : undefined,
|
|
193
|
-
orgId: mount == null ? void 0 : mount.orgId
|
|
194
|
-
});
|
|
195
|
-
const shapedColumns = useMemo(()=>importColumns(columns, rows), [
|
|
196
|
-
columns,
|
|
197
|
-
rows
|
|
198
|
-
]);
|
|
199
|
-
const offeredTargets = useMemo(()=>{
|
|
200
|
-
var _vocabulary_customFields;
|
|
201
|
-
return new Set([
|
|
202
|
-
...vocabulary.fields,
|
|
203
|
-
...((_vocabulary_customFields = vocabulary.customFields) != null ? _vocabulary_customFields : []).map((field)=>customImportTarget(field.key))
|
|
204
|
-
]);
|
|
205
|
-
}, [
|
|
206
|
-
vocabulary
|
|
207
|
-
]);
|
|
208
|
-
const proposeMapping = useCallback((proposed)=>{
|
|
209
|
-
const taken = new Set();
|
|
210
|
-
const next = {};
|
|
211
|
-
for (const [column, target] of Object.entries(proposed).sort(([a], [b])=>Number(a) - Number(b))){
|
|
212
|
-
const index = Number(column);
|
|
213
|
-
if (!Number.isInteger(index) || index < 0 || index >= columns.length) continue;
|
|
214
|
-
if (!offeredTargets.has(target) || taken.has(target)) continue;
|
|
215
|
-
taken.add(target);
|
|
216
|
-
next[index] = target;
|
|
217
|
-
}
|
|
218
|
-
setMapping(next);
|
|
219
|
-
}, [
|
|
220
|
-
offeredTargets,
|
|
221
|
-
columns.length
|
|
222
|
-
]);
|
|
223
|
-
const handleMap = useCallback((index, target)=>{
|
|
224
|
-
setMapping((previous)=>{
|
|
225
|
-
const next = {};
|
|
226
|
-
for (const [column, existing] of Object.entries(previous)){
|
|
227
|
-
// One column per target: choosing a target already taken moves it
|
|
228
|
-
// here rather than importing one field from two columns.
|
|
229
|
-
if (Number(column) !== index && existing !== target) {
|
|
230
|
-
next[Number(column)] = existing;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (target !== SKIP_TARGET) next[index] = target;
|
|
234
|
-
return next;
|
|
235
|
-
});
|
|
236
|
-
}, []);
|
|
237
|
-
/**
|
|
238
|
-
* Runs the file, one bounded request at a time.
|
|
239
|
-
*
|
|
240
|
-
* Every chunk's result is folded into the running total as it arrives,
|
|
241
|
-
* so a file that stops halfway — a lost connection, a closed drawer —
|
|
242
|
-
* still reports what it did rather than nothing.
|
|
243
|
-
*/ const handleImport = useCallback(async ()=>{
|
|
244
|
-
if (busy || !rows.length || !requiredMapped || !createHostId) return;
|
|
245
|
-
setBusy(true);
|
|
246
|
-
let total = vocabulary.emptyResult();
|
|
247
|
-
setResult(total);
|
|
248
|
-
setProgress({
|
|
249
|
-
sent: 0,
|
|
250
|
-
total: rows.length
|
|
251
|
-
});
|
|
252
|
-
try {
|
|
253
|
-
for(let offset = 0; offset < rows.length; offset += vocabulary.chunkSize){
|
|
254
|
-
if (abandoned.current) return;
|
|
255
|
-
const chunk = rows.slice(offset, offset + vocabulary.chunkSize).map((cells)=>vocabulary.mapRow(cells, mapping));
|
|
256
|
-
const response = await authorizedFetch(user, vocabulary.route, {
|
|
257
|
-
method: 'POST',
|
|
258
|
-
headers: {
|
|
259
|
-
'Content-Type': 'application/json'
|
|
260
|
-
},
|
|
261
|
-
body: JSON.stringify({
|
|
262
|
-
hostId: createHostId,
|
|
263
|
-
rows: chunk
|
|
264
|
-
})
|
|
265
|
-
});
|
|
266
|
-
const payload = await response.json().catch(()=>({}));
|
|
267
|
-
if (!response.ok) {
|
|
268
|
-
var _ref;
|
|
269
|
-
return void enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'The import could not continue.', {
|
|
270
|
-
variant: 'warning',
|
|
271
|
-
allowDuplicate: true
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
total = vocabulary.mergeResults(total, payload, offset);
|
|
275
|
-
setResult(total);
|
|
276
|
-
setProgress({
|
|
277
|
-
sent: Math.min(offset + chunk.length, rows.length),
|
|
278
|
-
total: rows.length
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
enqueueSnackbar('Import finished', {
|
|
282
|
-
variant: 'success',
|
|
283
|
-
persist: false
|
|
284
|
-
});
|
|
285
|
-
} catch (unused) {
|
|
286
|
-
enqueueSnackbar('The import could not continue.', {
|
|
287
|
-
variant: 'warning',
|
|
288
|
-
allowDuplicate: true
|
|
289
|
-
});
|
|
290
|
-
} finally{
|
|
291
|
-
setBusy(false);
|
|
292
|
-
}
|
|
293
|
-
}, [
|
|
294
|
-
busy,
|
|
295
|
-
rows,
|
|
296
|
-
requiredMapped,
|
|
297
|
-
mapping,
|
|
298
|
-
user,
|
|
299
|
-
createHostId,
|
|
300
|
-
enqueueSnackbar,
|
|
301
|
-
vocabulary
|
|
302
|
-
]);
|
|
303
|
-
const handleDownloadSkipped = useCallback(()=>{
|
|
304
|
-
if (!(result == null ? void 0 : result.skipped.length)) return;
|
|
305
|
-
downloadTextFile(vocabulary.skippedFileName, 'text/csv', vocabulary.skippedCsv(columns, result.skipped.map((entry)=>{
|
|
306
|
-
var _rows_entry_index;
|
|
307
|
-
return {
|
|
308
|
-
cells: (_rows_entry_index = rows[entry.index]) != null ? _rows_entry_index : [],
|
|
309
|
-
reason: entry.reason
|
|
310
|
-
};
|
|
311
|
-
})));
|
|
312
|
-
}, [
|
|
313
|
-
result,
|
|
314
|
-
columns,
|
|
315
|
-
rows,
|
|
316
|
-
vocabulary
|
|
317
|
-
]);
|
|
318
|
-
const finished = !!result && !busy;
|
|
319
|
-
return /*#__PURE__*/ _jsx(NavigationDrawerComponent, {
|
|
320
|
-
open: open,
|
|
321
|
-
anchor: "right",
|
|
322
|
-
variant: "temporary",
|
|
323
|
-
onClose: handleClose,
|
|
324
|
-
AppBarProps: {
|
|
325
|
-
color: 'surface'
|
|
326
|
-
},
|
|
327
|
-
appBarLeft: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
328
|
-
children: [
|
|
329
|
-
/*#__PURE__*/ _jsxs(IconButton, {
|
|
330
|
-
color: "inherit",
|
|
331
|
-
edge: "start",
|
|
332
|
-
onClick: handleClose,
|
|
333
|
-
sx: {
|
|
334
|
-
mr: 2
|
|
335
|
-
},
|
|
336
|
-
children: [
|
|
337
|
-
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
338
|
-
path: ICON_VARIANT_CLOSE.path
|
|
339
|
-
}),
|
|
340
|
-
/*#__PURE__*/ _jsx(SrOnly, {
|
|
341
|
-
children: 'close drawer'
|
|
342
|
-
})
|
|
343
|
-
]
|
|
344
|
-
}),
|
|
345
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
346
|
-
variant: "h6",
|
|
347
|
-
component: "div",
|
|
348
|
-
children: vocabulary.title
|
|
349
|
-
}),
|
|
350
|
-
/*#__PURE__*/ _jsx(HelpTip, _extends({}, vocabulary.help))
|
|
351
|
-
]
|
|
352
|
-
}),
|
|
353
|
-
appBarRight: /*#__PURE__*/ _jsx(Button, {
|
|
354
|
-
variant: "outlined",
|
|
355
|
-
color: "inherit",
|
|
356
|
-
onClick: handleClose,
|
|
357
|
-
children: finished ? 'Done' : 'Cancel'
|
|
358
|
-
}),
|
|
359
|
-
children: /*#__PURE__*/ _jsx(Container, {
|
|
360
|
-
gutterY: true,
|
|
361
|
-
children: /*#__PURE__*/ _jsx(Stack, {
|
|
362
|
-
spacing: 2,
|
|
363
|
-
children: result ? /*#__PURE__*/ _jsx(ImportResultPanel, {
|
|
364
|
-
result: result,
|
|
365
|
-
progress: progress,
|
|
366
|
-
busy: busy,
|
|
367
|
-
vocabulary: vocabulary,
|
|
368
|
-
onDownloadSkipped: handleDownloadSkipped,
|
|
369
|
-
onAnother: reset
|
|
370
|
-
}) : /*#__PURE__*/ _jsxs(_Fragment, {
|
|
371
|
-
children: [
|
|
372
|
-
/*#__PURE__*/ _jsx(CrmSitePicker, {
|
|
373
|
-
hostId: hostId,
|
|
374
|
-
disabled: busy,
|
|
375
|
-
helperText: vocabulary.sitePickerHelperText
|
|
376
|
-
}),
|
|
377
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
378
|
-
variant: "body2",
|
|
379
|
-
color: "text.secondary",
|
|
380
|
-
children: vocabulary.intro
|
|
381
|
-
}),
|
|
382
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
383
|
-
direction: "row",
|
|
384
|
-
spacing: 1,
|
|
385
|
-
sx: {
|
|
386
|
-
alignItems: 'center',
|
|
387
|
-
flexWrap: 'wrap',
|
|
388
|
-
rowGap: 1
|
|
389
|
-
},
|
|
390
|
-
children: [
|
|
391
|
-
/*#__PURE__*/ _jsxs(Button, {
|
|
392
|
-
variant: "outlined",
|
|
393
|
-
component: "label",
|
|
394
|
-
disabled: busy,
|
|
395
|
-
children: [
|
|
396
|
-
'Choose file',
|
|
397
|
-
/*#__PURE__*/ _jsx("input", {
|
|
398
|
-
type: "file",
|
|
399
|
-
accept: ".csv,text/csv",
|
|
400
|
-
hidden: true,
|
|
401
|
-
onChange: (event)=>{
|
|
402
|
-
var _event_target_files;
|
|
403
|
-
void handleFile((_event_target_files = event.target.files) == null ? void 0 : _event_target_files[0]);
|
|
404
|
-
event.target.value = '';
|
|
405
|
-
}
|
|
406
|
-
})
|
|
407
|
-
]
|
|
408
|
-
}),
|
|
409
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
410
|
-
size: "small",
|
|
411
|
-
disabled: busy,
|
|
412
|
-
onClick: ()=>downloadTextFile(vocabulary.templateFileName, 'text/csv', vocabulary.templateCsv()),
|
|
413
|
-
children: 'Download template'
|
|
414
|
-
}),
|
|
415
|
-
fileName ? /*#__PURE__*/ _jsx(Chip, {
|
|
416
|
-
size: "small",
|
|
417
|
-
variant: "outlined",
|
|
418
|
-
label: fileName
|
|
419
|
-
}) : null,
|
|
420
|
-
rows.length ? /*#__PURE__*/ _jsx(Typography, {
|
|
421
|
-
variant: "body2",
|
|
422
|
-
color: "text.secondary",
|
|
423
|
-
children: `${rows.length.toLocaleString()} rows`
|
|
424
|
-
}) : null
|
|
425
|
-
]
|
|
426
|
-
}),
|
|
427
|
-
overCeiling > 0 ? /*#__PURE__*/ _jsx(Alert, {
|
|
428
|
-
severity: "warning",
|
|
429
|
-
children: `This file has ${(rows.length + overCeiling).toLocaleString()} ` + `rows. Only the first ${vocabulary.maxRows.toLocaleString()} ` + 'are imported — split the file and import the rest ' + 'separately.'
|
|
430
|
-
}) : null,
|
|
431
|
-
columns.length ? /*#__PURE__*/ _jsx(ImportMappingTable, {
|
|
432
|
-
columns: columns,
|
|
433
|
-
sample: (_rows_ = rows[0]) != null ? _rows_ : [],
|
|
434
|
-
mapping: mapping,
|
|
435
|
-
vocabulary: vocabulary,
|
|
436
|
-
onMap: handleMap
|
|
437
|
-
}) : null,
|
|
438
|
-
columns.length && MappingSlot && vocabulary.collection ? /*#__PURE__*/ _jsx(MappingSlot, {
|
|
439
|
-
slot: "importMapping",
|
|
440
|
-
hostId: hostId,
|
|
441
|
-
orgId: orgId != null ? orgId : undefined,
|
|
442
|
-
collection: vocabulary.collection,
|
|
443
|
-
columns: shapedColumns,
|
|
444
|
-
mapping: mapping,
|
|
445
|
-
proposeMapping: (proposed)=>proposeMapping(proposed)
|
|
446
|
-
}) : null,
|
|
447
|
-
columns.length > 0 && !requiredMapped ? /*#__PURE__*/ _jsx(Alert, {
|
|
448
|
-
severity: "warning",
|
|
449
|
-
children: vocabulary.requiredWarning
|
|
450
|
-
}) : null,
|
|
451
|
-
columns.length > 0 && requiredMapped ? rowsNotice : null,
|
|
452
|
-
columns.length > 0 && requiredMapped ? /*#__PURE__*/ _jsx(ImportPreviewTable, {
|
|
453
|
-
targets: mappedTargets,
|
|
454
|
-
preview: preview,
|
|
455
|
-
total: rows.length,
|
|
456
|
-
unusable: unusableRows,
|
|
457
|
-
vocabulary: vocabulary
|
|
458
|
-
}) : null,
|
|
459
|
-
/*#__PURE__*/ _jsx(Stack, {
|
|
460
|
-
direction: "row",
|
|
461
|
-
spacing: 1,
|
|
462
|
-
sx: {
|
|
463
|
-
justifyContent: 'flex-end'
|
|
464
|
-
},
|
|
465
|
-
children: /*#__PURE__*/ _jsx(Button, {
|
|
466
|
-
variant: "contained",
|
|
467
|
-
// Held until the capturing site is known.
|
|
468
|
-
disabled: busy || !rows.length || !requiredMapped || !createHostId,
|
|
469
|
-
onClick: ()=>void handleImport(),
|
|
470
|
-
children: rows.length ? `Import ${rows.length.toLocaleString()} rows` : 'Import'
|
|
471
|
-
})
|
|
472
|
-
})
|
|
473
|
-
]
|
|
474
|
-
})
|
|
475
|
-
})
|
|
476
|
-
})
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
CsvImportDrawer.displayName = 'CsvImportDrawer';
|
|
480
|
-
/**
|
|
481
|
-
* WHICH COLUMN IS WHICH.
|
|
482
|
-
*
|
|
483
|
-
* One row per column in the file: its header, the first row's value under
|
|
484
|
-
* it so the operator can tell "Title" the job from "Title" the honorific,
|
|
485
|
-
* and a select naming where it goes. The proposal came from the alias
|
|
486
|
-
* table; every row of this table is the operator's to overrule.
|
|
487
|
-
*/ function ImportMappingTable(props) {
|
|
488
|
-
const { columns, sample, mapping, vocabulary, onMap } = props;
|
|
489
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
490
|
-
spacing: 1,
|
|
491
|
-
children: [
|
|
492
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
493
|
-
variant: "subtitle2",
|
|
494
|
-
children: 'Columns'
|
|
495
|
-
}),
|
|
496
|
-
/*#__PURE__*/ _jsxs(ScrollTable, {
|
|
497
|
-
size: "small",
|
|
498
|
-
children: [
|
|
499
|
-
/*#__PURE__*/ _jsx(TableHead, {
|
|
500
|
-
children: /*#__PURE__*/ _jsxs(TableRow, {
|
|
501
|
-
children: [
|
|
502
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
503
|
-
children: 'Column'
|
|
504
|
-
}),
|
|
505
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
506
|
-
children: 'First row'
|
|
507
|
-
}),
|
|
508
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
509
|
-
children: 'Imports as'
|
|
510
|
-
})
|
|
511
|
-
]
|
|
512
|
-
})
|
|
513
|
-
}),
|
|
514
|
-
/*#__PURE__*/ _jsx(TableBody, {
|
|
515
|
-
children: columns.map((column, index)=>{
|
|
516
|
-
var _sample_index, _mapping_index, _vocabulary_customFields;
|
|
517
|
-
return /*#__PURE__*/ _jsxs(TableRow, {
|
|
518
|
-
children: [
|
|
519
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
520
|
-
children: column || `Column ${index + 1}`
|
|
521
|
-
}),
|
|
522
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
523
|
-
children: /*#__PURE__*/ _jsx(Typography, {
|
|
524
|
-
variant: "body2",
|
|
525
|
-
color: "text.secondary",
|
|
526
|
-
noWrap: true,
|
|
527
|
-
children: String((_sample_index = sample[index]) != null ? _sample_index : '')
|
|
528
|
-
})
|
|
529
|
-
}),
|
|
530
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
531
|
-
children: /*#__PURE__*/ _jsxs(TextField, {
|
|
532
|
-
select: true,
|
|
533
|
-
size: "small",
|
|
534
|
-
value: (_mapping_index = mapping[index]) != null ? _mapping_index : SKIP_TARGET,
|
|
535
|
-
onChange: (event)=>onMap(index, event.target.value),
|
|
536
|
-
sx: {
|
|
537
|
-
minWidth: 220
|
|
538
|
-
},
|
|
539
|
-
children: [
|
|
540
|
-
/*#__PURE__*/ _jsx(MenuItem, {
|
|
541
|
-
value: SKIP_TARGET,
|
|
542
|
-
children: 'Do not import'
|
|
543
|
-
}),
|
|
544
|
-
vocabulary.fields.map((field)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
545
|
-
value: field,
|
|
546
|
-
children: vocabulary.fieldLabels[field]
|
|
547
|
-
}, field)),
|
|
548
|
-
((_vocabulary_customFields = vocabulary.customFields) != null ? _vocabulary_customFields : []).map((field)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
549
|
-
value: customImportTarget(field.key),
|
|
550
|
-
children: `${field.label} (custom)`
|
|
551
|
-
}, field.key))
|
|
552
|
-
]
|
|
553
|
-
})
|
|
554
|
-
})
|
|
555
|
-
]
|
|
556
|
-
}, `${column}-${index}`);
|
|
557
|
-
})
|
|
558
|
-
})
|
|
559
|
-
]
|
|
560
|
-
})
|
|
561
|
-
]
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* The first rows, as the mapping reads them.
|
|
566
|
-
*
|
|
567
|
-
* Verbatim cell values under the fields they were mapped to — not the
|
|
568
|
-
* normalized ones, because normalization is the server's and a preview that
|
|
569
|
-
* showed a cleaned phone number would be promising a result the route may
|
|
570
|
-
* refuse. What it does say is how many rows have no usable required cell,
|
|
571
|
-
* since that is the one refusal the operator can fix before sending.
|
|
572
|
-
*/ function ImportPreviewTable(props) {
|
|
573
|
-
const { targets, preview, total, unusable, vocabulary } = props;
|
|
574
|
-
const cell = (row, target)=>{
|
|
575
|
-
var _row_target;
|
|
576
|
-
const customKey = customImportTargetKey(target);
|
|
577
|
-
if (customKey) {
|
|
578
|
-
var _ref;
|
|
579
|
-
var _row_custom;
|
|
580
|
-
return String((_ref = (_row_custom = row['custom']) == null ? void 0 : _row_custom[customKey]) != null ? _ref : '');
|
|
581
|
-
}
|
|
582
|
-
return String((_row_target = row[target]) != null ? _row_target : '');
|
|
583
|
-
};
|
|
584
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
585
|
-
spacing: 1,
|
|
586
|
-
children: [
|
|
587
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
588
|
-
variant: "subtitle2",
|
|
589
|
-
children: `Preview — first ${Math.min(preview.length, vocabulary.previewRows)} of ${total.toLocaleString()}`
|
|
590
|
-
}),
|
|
591
|
-
unusable > 0 ? /*#__PURE__*/ _jsx(Alert, {
|
|
592
|
-
severity: "info",
|
|
593
|
-
children: vocabulary.unusableNotice(unusable, total)
|
|
594
|
-
}) : null,
|
|
595
|
-
/*#__PURE__*/ _jsx(Box, {
|
|
596
|
-
children: /*#__PURE__*/ _jsxs(ScrollTable, {
|
|
597
|
-
size: "small",
|
|
598
|
-
children: [
|
|
599
|
-
/*#__PURE__*/ _jsx(TableHead, {
|
|
600
|
-
children: /*#__PURE__*/ _jsx(TableRow, {
|
|
601
|
-
children: targets.map((target)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
602
|
-
children: targetLabel(target, vocabulary)
|
|
603
|
-
}, target))
|
|
604
|
-
})
|
|
605
|
-
}),
|
|
606
|
-
/*#__PURE__*/ _jsx(TableBody, {
|
|
607
|
-
children: preview.map((row, index)=>/*#__PURE__*/ _jsx(TableRow, {
|
|
608
|
-
children: targets.map((target)=>/*#__PURE__*/ _jsx(TableCell, {
|
|
609
|
-
children: /*#__PURE__*/ _jsx(Typography, {
|
|
610
|
-
variant: "body2",
|
|
611
|
-
noWrap: true,
|
|
612
|
-
sx: {
|
|
613
|
-
maxWidth: 240
|
|
614
|
-
},
|
|
615
|
-
children: cell(row, target)
|
|
616
|
-
})
|
|
617
|
-
}, target))
|
|
618
|
-
}, index))
|
|
619
|
-
})
|
|
620
|
-
]
|
|
621
|
-
})
|
|
622
|
-
})
|
|
623
|
-
]
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
/** How far the run has got, and what it did. */ function ImportResultPanel(props) {
|
|
627
|
-
var _ref, _ref1;
|
|
628
|
-
const { result, progress, busy, vocabulary, onDownloadSkipped, onAnother } = props;
|
|
629
|
-
const percent = (progress == null ? void 0 : progress.total) ? Math.min(progress.sent / progress.total * 100, 100) : 0;
|
|
630
|
-
const skippedByReason = useMemo(()=>{
|
|
631
|
-
const counts = {};
|
|
632
|
-
for (const entry of result.skipped){
|
|
633
|
-
var _counts_entry_reason;
|
|
634
|
-
counts[entry.reason] = ((_counts_entry_reason = counts[entry.reason]) != null ? _counts_entry_reason : 0) + 1;
|
|
635
|
-
}
|
|
636
|
-
return Object.entries(counts);
|
|
637
|
-
}, [
|
|
638
|
-
result.skipped
|
|
639
|
-
]);
|
|
640
|
-
const droppedFields = Object.entries(result.dropped).filter(([, count])=>count > 0);
|
|
641
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
642
|
-
spacing: 2,
|
|
643
|
-
children: [
|
|
644
|
-
/*#__PURE__*/ _jsx(Typography, {
|
|
645
|
-
variant: "body2",
|
|
646
|
-
color: "text.secondary",
|
|
647
|
-
children: busy ? `${((_ref = progress == null ? void 0 : progress.sent) != null ? _ref : 0).toLocaleString()} of ${((_ref1 = progress == null ? void 0 : progress.total) != null ? _ref1 : 0).toLocaleString()} rows sent.` : `Finished. ${result.created.toLocaleString()} added, ` + `${result.merged.toLocaleString()} updated, ` + `${result.skipped.length.toLocaleString()} skipped.`
|
|
648
|
-
}),
|
|
649
|
-
/*#__PURE__*/ _jsx(LinearProgress, {
|
|
650
|
-
variant: "determinate",
|
|
651
|
-
value: percent,
|
|
652
|
-
sx: {
|
|
653
|
-
borderRadius: 1
|
|
654
|
-
}
|
|
655
|
-
}),
|
|
656
|
-
skippedByReason.length ? /*#__PURE__*/ _jsxs(ScrollTable, {
|
|
657
|
-
size: "small",
|
|
658
|
-
children: [
|
|
659
|
-
/*#__PURE__*/ _jsx(TableHead, {
|
|
660
|
-
children: /*#__PURE__*/ _jsxs(TableRow, {
|
|
661
|
-
children: [
|
|
662
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
663
|
-
children: 'Skipped'
|
|
664
|
-
}),
|
|
665
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
666
|
-
align: "right",
|
|
667
|
-
children: 'Rows'
|
|
668
|
-
})
|
|
669
|
-
]
|
|
670
|
-
})
|
|
671
|
-
}),
|
|
672
|
-
/*#__PURE__*/ _jsx(TableBody, {
|
|
673
|
-
children: skippedByReason.map(([reason, count])=>{
|
|
674
|
-
var _vocabulary_skipLabels_reason;
|
|
675
|
-
return /*#__PURE__*/ _jsxs(TableRow, {
|
|
676
|
-
children: [
|
|
677
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
678
|
-
children: (_vocabulary_skipLabels_reason = vocabulary.skipLabels[reason]) != null ? _vocabulary_skipLabels_reason : reason
|
|
679
|
-
}),
|
|
680
|
-
/*#__PURE__*/ _jsx(TableCell, {
|
|
681
|
-
align: "right",
|
|
682
|
-
children: count
|
|
683
|
-
})
|
|
684
|
-
]
|
|
685
|
-
}, reason);
|
|
686
|
-
})
|
|
687
|
-
})
|
|
688
|
-
]
|
|
689
|
-
}) : null,
|
|
690
|
-
droppedFields.length ? /*#__PURE__*/ _jsxs(Alert, {
|
|
691
|
-
severity: "info",
|
|
692
|
-
children: [
|
|
693
|
-
/*#__PURE__*/ _jsx(AlertTitle, {
|
|
694
|
-
children: 'Some values could not be read'
|
|
695
|
-
}),
|
|
696
|
-
'The rows were imported without them: ' + droppedFields.map(([field, count])=>`${droppedFieldLabel(field, vocabulary)} (${count})`).join(', ') + '.'
|
|
697
|
-
]
|
|
698
|
-
}) : null,
|
|
699
|
-
result.ownersUnresolved.length ? /*#__PURE__*/ _jsx(Alert, {
|
|
700
|
-
severity: "info",
|
|
701
|
-
children: 'No team member has these owner addresses, so those rows ' + `have no owner: ${result.ownersUnresolved.slice(0, 5).join(', ')}` + (result.ownersUnresolved.length > 5 ? ` and ${result.ownersUnresolved.length - 5} more.` : '.')
|
|
702
|
-
}) : null,
|
|
703
|
-
importNoMailServerSentence(result.noMailServer) ? /*#__PURE__*/ _jsx(Alert, {
|
|
704
|
-
severity: "warning",
|
|
705
|
-
children: importNoMailServerSentence(result.noMailServer)
|
|
706
|
-
}) : null,
|
|
707
|
-
vocabulary.resultExtras == null ? void 0 : vocabulary.resultExtras.call(vocabulary, result),
|
|
708
|
-
/*#__PURE__*/ _jsxs(Stack, {
|
|
709
|
-
direction: "row",
|
|
710
|
-
spacing: 1,
|
|
711
|
-
sx: {
|
|
712
|
-
justifyContent: 'flex-end'
|
|
713
|
-
},
|
|
714
|
-
children: [
|
|
715
|
-
result.skipped.length ? /*#__PURE__*/ _jsx(Button, {
|
|
716
|
-
variant: "outlined",
|
|
717
|
-
onClick: onDownloadSkipped,
|
|
718
|
-
children: 'Download skipped rows'
|
|
719
|
-
}) : null,
|
|
720
|
-
!busy ? /*#__PURE__*/ _jsx(Button, {
|
|
721
|
-
variant: "outlined",
|
|
722
|
-
onClick: onAnother,
|
|
723
|
-
children: 'Import another file'
|
|
724
|
-
}) : null
|
|
725
|
-
]
|
|
726
|
-
})
|
|
727
|
-
]
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
/**
|
|
731
|
-
* An "Import CSV" button that mounts its drawer only once it has been
|
|
732
|
-
* opened, so the list pays nothing — no hooks, no listeners — for a
|
|
733
|
-
* feature the operator has not reached for.
|
|
734
|
-
*/ export function CsvImportButton(props) {
|
|
735
|
-
const { label = 'Import CSV', children } = props;
|
|
736
|
-
const [open, setOpen] = useState(false);
|
|
737
|
-
const [mounted, setMounted] = useState(false);
|
|
738
|
-
const handleOpen = useCallback(()=>{
|
|
739
|
-
setMounted(true);
|
|
740
|
-
setOpen(true);
|
|
741
|
-
}, []);
|
|
742
|
-
const handleClose = useCallback(()=>setOpen(false), []);
|
|
743
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
744
|
-
children: [
|
|
745
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
746
|
-
size: "small",
|
|
747
|
-
onClick: handleOpen,
|
|
748
|
-
children: label
|
|
749
|
-
}),
|
|
750
|
-
mounted ? children(open, handleClose) : null
|
|
751
|
-
]
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
CsvImportButton.displayName = 'CsvImportButton';
|
|
755
|
-
export default CsvImportDrawer;
|
|
756
|
-
|
|
757
|
-
//# sourceMappingURL=csv-import-drawer.js.map
|