@agent-native/core 0.123.0 → 0.123.2
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +24 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/templates-meta.ts +12 -0
- package/corpus/core/src/deploy/build.ts +8 -0
- package/corpus/core/src/server/builder-browser.ts +76 -0
- package/corpus/core/src/server/core-routes-plugin.ts +15 -5
- package/corpus/templates/assets/app/global.css +0 -4
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +195 -167
- package/corpus/templates/assets/changelog/2026-07-23-drafts-preview-panel-now-fills-the-full-width-with-a-large-p.md +6 -0
- package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
- package/corpus/templates/content/actions/_builder-cms-write-client.ts +55 -9
- package/corpus/templates/content/actions/_database-source-utils.ts +756 -182
- package/corpus/templates/content/actions/change-content-database-source-role.ts +21 -20
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +49 -8
- package/corpus/templates/content/actions/materialize-builder-required-fields.ts +42 -9
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +88 -90
- package/corpus/templates/content/actions/preview-builder-source-review.ts +4 -3
- package/corpus/templates/content/actions/refresh-content-database-source.ts +36 -9
- package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +28 -24
- package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +62 -12
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +91 -16
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +15 -1
- package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +234 -44
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +194 -16
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +95 -42
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +4 -2
- package/corpus/templates/content/app/components/editor/extensions/CodeBlockNode.tsx +10 -166
- package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +32 -8
- package/corpus/templates/content/app/components/editor/extensions/VideoNode.ts +14 -0
- package/corpus/templates/content/app/components/editor/registrySlashItems.ts +5 -1
- package/corpus/templates/content/app/hooks/use-content-database.ts +59 -2
- package/corpus/templates/content/app/hooks/use-documents.ts +18 -26
- package/corpus/templates/content/app/root.tsx +1 -6
- package/corpus/templates/content/changelog/2026-07-24-builder-can-now-publish-approved-updates-to-entries-that-are.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-collection-loading-no-longer-restarts-from-the-begin.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-connections-now-complete-securely-from-netlify-deplo.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-draft-creation-now-scopes-execution-to-the-selected-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-review-now-distinguishes-preparing-a-safe-dry-run-from.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-source-imports-now-recover-from-a-transient-paginati.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-source-refresh-now-preserves-the-provider-bound-fiel.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-update-reviews-now-open-reliably-on-large-collection.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-builder-write-policy-controls-now-reflect-successful-changes.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-date-properties-now-save-reliably-when-selected-with-the-nat.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-editor-slash-search-now-keeps-multi-word-block-names-open.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-exact-editor-slash-commands-now-execute-on-enter-even-if-the.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-new-collaborative-pages-now-save-their-first-edits.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-new-local-builder-rows-no-longer-remain-locked-behind-a-none.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-opening-or-closing-a-collaborative-document-no-longer-lets-u.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-selected-text-now-opens-the-link-editor-with-command-k-or-co.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-slash-menu-block-choices-no-longer-stall-pointer-interaction.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-uploaded-and-embedded-media-now-stay-intact-while-collaborative-document-drafts-save.md +6 -0
- package/corpus/templates/content/changelog/2026-07-24-video-link-insertion-now-keeps-its-source-panel-open-while-t.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-builder-publishing-now-shows-safe-validation-details-instead.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-builder-reviews-stay-responsive-on-large-collections-and-pre.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-collaborative-documents-no-longer-flash-duplicated-recent-bl.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-corrected-builder-updates-are-now-reviewed-separately-from-f.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-documents-now-remain-read-only-until-their-live-collaborativ.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-slash-command-menus-now-stay-reachable-when-editing-near-the.md +6 -0
- package/corpus/templates/content/changelog/2026-07-26-the-slash-menu-now-shows-one-clear-callout-choice-instead-of.md +6 -0
- package/corpus/templates/content/shared/api.ts +1 -0
- package/corpus/templates/content/shared/builder-mdx.ts +73 -16
- package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +177 -0
- package/corpus/templates/crm/.agents/skills/crm/SKILL.md +205 -0
- package/corpus/templates/crm/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/templates/crm/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +228 -0
- package/corpus/templates/crm/.agents/skills/storing-data/SKILL.md +178 -0
- package/corpus/templates/crm/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
- package/corpus/templates/crm/.env.example +5 -0
- package/corpus/templates/crm/AGENTS.md +82 -0
- package/corpus/templates/crm/CHANGELOG.md +25 -0
- package/corpus/templates/crm/DEVELOPING.md +66 -0
- package/corpus/templates/crm/README.md +122 -0
- package/corpus/templates/crm/_gitignore +12 -0
- package/corpus/templates/crm/actions/_crm-action-utils.ts +98 -0
- package/corpus/templates/crm/actions/_crm-attribute-utils.ts +219 -0
- package/corpus/templates/crm/actions/_crm-dashboard.ts +69 -0
- package/corpus/templates/crm/actions/_crm-data-program-actions.ts +15 -0
- package/corpus/templates/crm/actions/_crm-list-utils.ts +775 -0
- package/corpus/templates/crm/actions/_crm-signal-utils.ts +79 -0
- package/corpus/templates/crm/actions/add-crm-record-to-list.ts +164 -0
- package/corpus/templates/crm/actions/apply-crm-proposals.ts +291 -0
- package/corpus/templates/crm/actions/archive-crm-attribute.ts +69 -0
- package/corpus/templates/crm/actions/attach-call-evidence.ts +170 -0
- package/corpus/templates/crm/actions/configure-crm-connection.ts +126 -0
- package/corpus/templates/crm/actions/configure-native-crm.ts +44 -0
- package/corpus/templates/crm/actions/create-crm-attribute.ts +350 -0
- package/corpus/templates/crm/actions/create-crm-list.ts +194 -0
- package/corpus/templates/crm/actions/create-crm-record.ts +148 -0
- package/corpus/templates/crm/actions/create-crm-signal-tracker.ts +58 -0
- package/corpus/templates/crm/actions/delete-crm-saved-view.ts +68 -0
- package/corpus/templates/crm/actions/delete-staged-dataset.ts +14 -0
- package/corpus/templates/crm/actions/estimate-crm-enrichment.ts +229 -0
- package/corpus/templates/crm/actions/find-crm-duplicates.ts +87 -0
- package/corpus/templates/crm/actions/get-crm-automation-recipe.ts +36 -0
- package/corpus/templates/crm/actions/get-crm-dashboard-panel.ts +35 -0
- package/corpus/templates/crm/actions/get-crm-dashboard.ts +14 -0
- package/corpus/templates/crm/actions/get-crm-overview.ts +13 -0
- package/corpus/templates/crm/actions/get-crm-pipeline-data.ts +61 -0
- package/corpus/templates/crm/actions/get-crm-record-page.ts +287 -0
- package/corpus/templates/crm/actions/get-crm-record.ts +75 -0
- package/corpus/templates/crm/actions/get-crm-workspace.ts +364 -0
- package/corpus/templates/crm/actions/install-crm-pipeline-dashboard.ts +81 -0
- package/corpus/templates/crm/actions/list-crm-attributes.ts +71 -0
- package/corpus/templates/crm/actions/list-crm-connections.ts +68 -0
- package/corpus/templates/crm/actions/list-crm-dashboard-revisions.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-dashboards.ts +15 -0
- package/corpus/templates/crm/actions/list-crm-enrichment-slots.ts +28 -0
- package/corpus/templates/crm/actions/list-crm-list-entries.ts +192 -0
- package/corpus/templates/crm/actions/list-crm-lists.ts +80 -0
- package/corpus/templates/crm/actions/list-crm-proposals.ts +55 -0
- package/corpus/templates/crm/actions/list-crm-record-field-history.ts +201 -0
- package/corpus/templates/crm/actions/list-crm-record-values.ts +200 -0
- package/corpus/templates/crm/actions/list-crm-records.ts +103 -0
- package/corpus/templates/crm/actions/list-crm-saved-views.ts +66 -0
- package/corpus/templates/crm/actions/list-crm-signal-hits.ts +43 -0
- package/corpus/templates/crm/actions/list-crm-signal-trackers.ts +32 -0
- package/corpus/templates/crm/actions/list-crm-tasks.ts +22 -0
- package/corpus/templates/crm/actions/list-staged-datasets.ts +14 -0
- package/corpus/templates/crm/actions/list-workspace-connections.ts +47 -0
- package/corpus/templates/crm/actions/manage-crm-attribute-option.ts +272 -0
- package/corpus/templates/crm/actions/manage-crm-signal-tracker.ts +87 -0
- package/corpus/templates/crm/actions/manage-crm-task.ts +132 -0
- package/corpus/templates/crm/actions/merge-crm-records.ts +691 -0
- package/corpus/templates/crm/actions/navigate.ts +54 -0
- package/corpus/templates/crm/actions/provider-api-catalog.ts +22 -0
- package/corpus/templates/crm/actions/provider-api-docs.ts +54 -0
- package/corpus/templates/crm/actions/provider-api-request.ts +92 -0
- package/corpus/templates/crm/actions/query-staged-dataset.ts +44 -0
- package/corpus/templates/crm/actions/record-crm-call-insight.ts +160 -0
- package/corpus/templates/crm/actions/record-crm-smart-signal.ts +150 -0
- package/corpus/templates/crm/actions/remove-crm-list-entry.ts +79 -0
- package/corpus/templates/crm/actions/restore-crm-dashboard-revision.ts +23 -0
- package/corpus/templates/crm/actions/review-crm-signal.ts +31 -0
- package/corpus/templates/crm/actions/run-crm-attribute-fill.ts +443 -0
- package/corpus/templates/crm/actions/run-crm-enrichment.ts +647 -0
- package/corpus/templates/crm/actions/run-crm-saved-view-program.ts +103 -0
- package/corpus/templates/crm/actions/run-crm-signal-trackers.ts +265 -0
- package/corpus/templates/crm/actions/run.ts +7 -0
- package/corpus/templates/crm/actions/save-crm-dashboard.ts +51 -0
- package/corpus/templates/crm/actions/save-crm-saved-view.ts +296 -0
- package/corpus/templates/crm/actions/sync-crm.ts +146 -0
- package/corpus/templates/crm/actions/update-crm-attribute.ts +111 -0
- package/corpus/templates/crm/actions/update-crm-list-entry.ts +102 -0
- package/corpus/templates/crm/actions/update-crm-list.ts +97 -0
- package/corpus/templates/crm/actions/update-crm-record.ts +543 -0
- package/corpus/templates/crm/actions/view-screen.ts +324 -0
- package/corpus/templates/crm/agent-native.app-skill.json +69 -0
- package/corpus/templates/crm/app/components/crm/CreateCrmRecordDialog.tsx +158 -0
- package/corpus/templates/crm/app/components/crm/CrmDashboardPanel.tsx +78 -0
- package/corpus/templates/crm/app/components/crm/CrmSignalsPanel.tsx +220 -0
- package/corpus/templates/crm/app/components/crm/IntelligenceSettings.tsx +414 -0
- package/corpus/templates/crm/app/components/crm/RecordActions.tsx +648 -0
- package/corpus/templates/crm/app/components/crm/RecordGrid.tsx +488 -0
- package/corpus/templates/crm/app/components/crm/RecordWorkspace.tsx +232 -0
- package/corpus/templates/crm/app/components/crm/SavedViewDataProgram.tsx +93 -0
- package/corpus/templates/crm/app/components/crm/Surface.tsx +97 -0
- package/corpus/templates/crm/app/components/crm/WorkOverview.tsx +180 -0
- package/corpus/templates/crm/app/components/crm/board/CrmBoard.tsx +988 -0
- package/corpus/templates/crm/app/components/crm/board/board-model.ts +399 -0
- package/corpus/templates/crm/app/components/crm/board/entry-filter.ts +150 -0
- package/corpus/templates/crm/app/components/crm/board/view-draft.ts +227 -0
- package/corpus/templates/crm/app/components/crm/grid/CrmGrid.tsx +1033 -0
- package/corpus/templates/crm/app/components/crm/grid/GridCell.tsx +620 -0
- package/corpus/templates/crm/app/components/crm/grid/clipboard.ts +84 -0
- package/corpus/templates/crm/app/components/crm/grid/model.ts +304 -0
- package/corpus/templates/crm/app/components/crm/grid/navigation.ts +220 -0
- package/corpus/templates/crm/app/components/crm/grid/query.ts +214 -0
- package/corpus/templates/crm/app/components/crm/record/AttributePanel.tsx +192 -0
- package/corpus/templates/crm/app/components/crm/record/FieldHistory.tsx +179 -0
- package/corpus/templates/crm/app/components/crm/record/RecordHeader.tsx +103 -0
- package/corpus/templates/crm/app/components/crm/record/RecordLists.tsx +235 -0
- package/corpus/templates/crm/app/components/crm/record/RecordTabs.tsx +206 -0
- package/corpus/templates/crm/app/components/crm/record/field-editors.tsx +245 -0
- package/corpus/templates/crm/app/components/crm/record/record-data.ts +603 -0
- package/corpus/templates/crm/app/components/crm/settings/AdvancedSettings.tsx +49 -0
- package/corpus/templates/crm/app/components/crm/settings/AttributeOptionsEditor.tsx +441 -0
- package/corpus/templates/crm/app/components/crm/settings/ConnectionSettings.tsx +169 -0
- package/corpus/templates/crm/app/components/crm/settings/FieldsSettings.tsx +935 -0
- package/corpus/templates/crm/app/components/crm/settings/ListsSettings.tsx +339 -0
- package/corpus/templates/crm/app/components/crm/settings/settings-admin.ts +377 -0
- package/corpus/templates/crm/app/components/crm/shared/AttributeValueParts.tsx +69 -0
- package/corpus/templates/crm/app/components/crm/shared/attribute-value.ts +591 -0
- package/corpus/templates/crm/app/components/layout/CrmCommandMenu.tsx +556 -0
- package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +130 -0
- package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +407 -0
- package/corpus/templates/crm/app/components/layout/command-palette-search.ts +126 -0
- package/corpus/templates/crm/app/components/layout/crm-ui-intents.ts +41 -0
- package/corpus/templates/crm/app/components/layout/sidebar-collapse.ts +40 -0
- package/corpus/templates/crm/app/components/layout/sidebar-lists.ts +109 -0
- package/corpus/templates/crm/app/components/ui/alert-dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/badge.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/button.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/card.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/checkbox.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/dialog.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/hover-card.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/input.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/label.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/select.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/skeleton.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/table.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/tabs.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/crm/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/crm/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/crm/app/design-system.ts +3 -0
- package/corpus/templates/crm/app/entry.client.tsx +19 -0
- package/corpus/templates/crm/app/entry.server.tsx +10 -0
- package/corpus/templates/crm/app/global.css +167 -0
- package/corpus/templates/crm/app/hooks/use-keyboard-shortcuts.ts +206 -0
- package/corpus/templates/crm/app/hooks/use-navigation-state.ts +48 -0
- package/corpus/templates/crm/app/i18n/en-US.ts +684 -0
- package/corpus/templates/crm/app/i18n/index.ts +34 -0
- package/corpus/templates/crm/app/lib/dashboard.ts +13 -0
- package/corpus/templates/crm/app/lib/navigation.ts +17 -0
- package/corpus/templates/crm/app/lib/tab-id.ts +1 -0
- package/corpus/templates/crm/app/lib/types.ts +172 -0
- package/corpus/templates/crm/app/lib/utils.ts +1 -0
- package/corpus/templates/crm/app/root.tsx +93 -0
- package/corpus/templates/crm/app/routes/_index.tsx +26 -0
- package/corpus/templates/crm/app/routes/accounts.tsx +41 -0
- package/corpus/templates/crm/app/routes/agent.tsx +5 -0
- package/corpus/templates/crm/app/routes/ask.tsx +53 -0
- package/corpus/templates/crm/app/routes/dashboard.tsx +118 -0
- package/corpus/templates/crm/app/routes/lists.tsx +228 -0
- package/corpus/templates/crm/app/routes/opportunities.tsx +41 -0
- package/corpus/templates/crm/app/routes/people.tsx +41 -0
- package/corpus/templates/crm/app/routes/proposals.tsx +388 -0
- package/corpus/templates/crm/app/routes/records.$recordId.tsx +53 -0
- package/corpus/templates/crm/app/routes/records.tsx +64 -0
- package/corpus/templates/crm/app/routes/settings.tsx +118 -0
- package/corpus/templates/crm/app/routes/setup.tsx +308 -0
- package/corpus/templates/crm/app/routes/tasks.tsx +252 -0
- package/corpus/templates/crm/app/routes/views.tsx +683 -0
- package/corpus/templates/crm/app/routes.ts +19 -0
- package/corpus/templates/crm/app/vite-env.d.ts +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-any-list-or-view-can-be-shown-as-a-board-grouped-by-stage-so.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-crm-now-finds-likely-duplicate-records-and-tells-you-exactly.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-enrichment-now-shows-what-a-run-will-cost-before-it-starts-g.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-lists-turn-any-set-of-records-into-a-pipeline-with-its-own-s.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-moving-a-record-or-list-entry-into-a-stage-that-was-retired-.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-opening-a-record-now-shows-one-page-with-its-fields-the-list.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-press-cmd-k-to-jump-to-any-record-list-view-or-setting-and-u.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-provider-record-edits-now-show-an-exact-before-after-diff-an.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-record-page-attribute-labels-now-read-in-full-instead-of-bei.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-records-now-use-typed-fields-currency-dates-ratings-status-s.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-retyping-a-value-on-the-record-page-now-replaces-it-instead-.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-settings-now-has-fields-and-lists-tabs-for-adding-fields-edi.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-the-proposal-review-now-shows-the-field-that-actually-change.md +6 -0
- package/corpus/templates/crm/changelog/2026-07-26-the-record-grid-is-now-a-real-spreadsheet-filter-sort-and-pa.md +6 -0
- package/corpus/templates/crm/components.json +20 -0
- package/corpus/templates/crm/docs/architecture/crm-contract.md +214 -0
- package/corpus/templates/crm/docs/features/README.md +55 -0
- package/corpus/templates/crm/docs/features/f1-records-and-fields.mdx +52 -0
- package/corpus/templates/crm/docs/features/f2-lists-pipelines-and-views.mdx +48 -0
- package/corpus/templates/crm/docs/features/f3-work-and-record-quality.mdx +40 -0
- package/corpus/templates/crm/docs/features/f4-evidence-and-chat.mdx +47 -0
- package/corpus/templates/crm/learnings.defaults.md +5 -0
- package/corpus/templates/crm/netlify.toml +11 -0
- package/corpus/templates/crm/package.json +61 -0
- package/corpus/templates/crm/public/favicon.svg +1 -0
- package/corpus/templates/crm/public/icon-180.svg +1 -0
- package/corpus/templates/crm/public/manifest.json +11 -0
- package/corpus/templates/crm/react-router.config.ts +7 -0
- package/corpus/templates/crm/server/crm/adapter.ts +32 -0
- package/corpus/templates/crm/server/crm/crm-field-firewall.ts +64 -0
- package/corpus/templates/crm/server/crm/crm-mirror.ts +721 -0
- package/corpus/templates/crm/server/crm/field-policy-attributes.ts +48 -0
- package/corpus/templates/crm/server/crm/hubspot-adapter.ts +1146 -0
- package/corpus/templates/crm/server/crm/native-adapter.ts +1810 -0
- package/corpus/templates/crm/server/crm/provider-record-link.ts +264 -0
- package/corpus/templates/crm/server/crm/read-through.ts +207 -0
- package/corpus/templates/crm/server/crm/salesforce-adapter.ts +1255 -0
- package/corpus/templates/crm/server/db/crm-store.ts +1112 -0
- package/corpus/templates/crm/server/db/index.ts +191 -0
- package/corpus/templates/crm/server/db/schema.ts +647 -0
- package/corpus/templates/crm/server/lib/crm-query.ts +1558 -0
- package/corpus/templates/crm/server/lib/dedupe.ts +714 -0
- package/corpus/templates/crm/server/lib/enrichment-cost.ts +381 -0
- package/corpus/templates/crm/server/lib/enrichment-slots.ts +519 -0
- package/corpus/templates/crm/server/lib/intelligence/default-detectors.ts +65 -0
- package/corpus/templates/crm/server/lib/intelligence/evidence.ts +105 -0
- package/corpus/templates/crm/server/lib/intelligence/keyword-detector.ts +94 -0
- package/corpus/templates/crm/server/lib/intelligence/smart-detector.ts +39 -0
- package/corpus/templates/crm/server/lib/intelligence/summary.ts +19 -0
- package/corpus/templates/crm/server/lib/lifecycle.ts +634 -0
- package/corpus/templates/crm/server/lib/provider-api.ts +64 -0
- package/corpus/templates/crm/server/middleware/auth.ts +4 -0
- package/corpus/templates/crm/server/plugins/agent-chat.ts +65 -0
- package/corpus/templates/crm/server/plugins/auth.ts +14 -0
- package/corpus/templates/crm/server/plugins/core-routes.ts +17 -0
- package/corpus/templates/crm/server/plugins/db.ts +738 -0
- package/corpus/templates/crm/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/crm/shared/crm-attributes.ts +469 -0
- package/corpus/templates/crm/shared/crm-automation-recipes.ts +132 -0
- package/corpus/templates/crm/shared/crm-contract.ts +417 -0
- package/corpus/templates/crm/shared/crm-navigation.ts +190 -0
- package/corpus/templates/crm/shared/crm-sales-config.ts +63 -0
- package/corpus/templates/crm/ssr-entry.ts +11 -0
- package/corpus/templates/crm/tsconfig.json +24 -0
- package/corpus/templates/crm/vite.config.ts +15 -0
- package/corpus/templates/crm/vitest.config.ts +5 -0
- package/corpus/templates/design/app/i18n-data.ts +12 -12
- package/corpus/templates/design/changelog/2026-07-26-apply-design-updates-from-a-centered-top-toolbar-without-cov.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +6 -0
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +14 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +12 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/deploy/build.js +6 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/observability/routes.d.ts +3 -3
- package/dist/server/builder-browser.d.ts +13 -0
- package/dist/server/builder-browser.d.ts.map +1 -1
- package/dist/server/builder-browser.js +59 -0
- package/dist/server/builder-browser.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +10 -5
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/package.json +2 -2
- package/src/cli/templates-meta.ts +12 -0
- package/src/deploy/build.ts +8 -0
- package/src/server/builder-browser.ts +76 -0
- package/src/server/core-routes-plugin.ts +15 -5
|
@@ -0,0 +1,648 @@
|
|
|
1
|
+
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
2
|
+
import {
|
|
3
|
+
useActionMutation,
|
|
4
|
+
useActionQuery,
|
|
5
|
+
} from "@agent-native/core/client/hooks";
|
|
6
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
7
|
+
import {
|
|
8
|
+
IconBolt,
|
|
9
|
+
IconChecklist,
|
|
10
|
+
IconExternalLink,
|
|
11
|
+
IconFilePlus,
|
|
12
|
+
IconPencil,
|
|
13
|
+
} from "@tabler/icons-react";
|
|
14
|
+
import { useState } from "react";
|
|
15
|
+
import { Link } from "react-router";
|
|
16
|
+
import { toast } from "sonner";
|
|
17
|
+
|
|
18
|
+
import { Button } from "@/components/ui/button";
|
|
19
|
+
import {
|
|
20
|
+
Dialog,
|
|
21
|
+
DialogContent,
|
|
22
|
+
DialogDescription,
|
|
23
|
+
DialogFooter,
|
|
24
|
+
DialogHeader,
|
|
25
|
+
DialogTitle,
|
|
26
|
+
DialogTrigger,
|
|
27
|
+
} from "@/components/ui/dialog";
|
|
28
|
+
import { Input } from "@/components/ui/input";
|
|
29
|
+
import { Label } from "@/components/ui/label";
|
|
30
|
+
import {
|
|
31
|
+
Select,
|
|
32
|
+
SelectContent,
|
|
33
|
+
SelectItem,
|
|
34
|
+
SelectTrigger,
|
|
35
|
+
SelectValue,
|
|
36
|
+
} from "@/components/ui/select";
|
|
37
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
38
|
+
import type { CrmRecordDetail } from "@/lib/types";
|
|
39
|
+
|
|
40
|
+
export function RecordActions({ record }: { record: CrmRecordDetail }) {
|
|
41
|
+
return (
|
|
42
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
43
|
+
<EditFieldDialog record={record} />
|
|
44
|
+
<CreateRecordTaskDialog recordId={record.id} />
|
|
45
|
+
<AttachEvidenceDialog recordId={record.id} />
|
|
46
|
+
<CallEvidenceAutomationDialog record={record} />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The prepared upstream handoff returned by `apply-crm-proposals`. */
|
|
52
|
+
interface PreparedHandoff {
|
|
53
|
+
providerLabel: string;
|
|
54
|
+
recordUrl: string | null;
|
|
55
|
+
recordUrlUnavailableReason: string | null;
|
|
56
|
+
fields: Array<{
|
|
57
|
+
name: string;
|
|
58
|
+
beforeKnown: boolean;
|
|
59
|
+
before: string | number | boolean | null;
|
|
60
|
+
after: unknown;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function EditFieldDialog({ record }: { record: CrmRecordDetail }) {
|
|
65
|
+
const t = useT();
|
|
66
|
+
const isNative = record.provider === "native";
|
|
67
|
+
const [open, setOpen] = useState(false);
|
|
68
|
+
const [target, setTarget] = useState<"local" | "provider">(
|
|
69
|
+
isNative ? "local" : "provider",
|
|
70
|
+
);
|
|
71
|
+
const [field, setField] = useState("");
|
|
72
|
+
const [value, setValue] = useState("");
|
|
73
|
+
const [valueType, setValueType] = useState<"string" | "number" | "boolean">(
|
|
74
|
+
"string",
|
|
75
|
+
);
|
|
76
|
+
const [handoff, setHandoff] = useState<PreparedHandoff | null>(null);
|
|
77
|
+
const update = useActionMutation<
|
|
78
|
+
{ mutationId: string; status?: string },
|
|
79
|
+
{
|
|
80
|
+
recordId: string;
|
|
81
|
+
target: "local" | "provider";
|
|
82
|
+
fields: Record<string, string | number | boolean>;
|
|
83
|
+
expectedRemoteRevision?: string;
|
|
84
|
+
}
|
|
85
|
+
>("update-crm-record" as never);
|
|
86
|
+
const prepare = useActionMutation<PreparedHandoff, { proposalId: string }>(
|
|
87
|
+
"apply-crm-proposals" as never,
|
|
88
|
+
);
|
|
89
|
+
const providerLabel =
|
|
90
|
+
record.provider === "salesforce" ? "Salesforce" : "HubSpot";
|
|
91
|
+
|
|
92
|
+
async function submit() {
|
|
93
|
+
const nextValue =
|
|
94
|
+
valueType === "number"
|
|
95
|
+
? Number(value)
|
|
96
|
+
: valueType === "boolean"
|
|
97
|
+
? value === "true"
|
|
98
|
+
: value;
|
|
99
|
+
if (valueType === "number" && !Number.isFinite(nextValue)) {
|
|
100
|
+
toast.error(t("recordActions.invalidNumber"));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const result = await update.mutateAsync({
|
|
105
|
+
recordId: record.id,
|
|
106
|
+
target,
|
|
107
|
+
fields: { [field.trim()]: nextValue },
|
|
108
|
+
...((isNative || target === "provider") && record.remoteRevision
|
|
109
|
+
? { expectedRemoteRevision: record.remoteRevision }
|
|
110
|
+
: {}),
|
|
111
|
+
});
|
|
112
|
+
// A provider edit is a handoff, not a write: keep the dialog open and
|
|
113
|
+
// show the exact diff plus the upstream link instead of a success toast
|
|
114
|
+
// that would imply the connected CRM already changed.
|
|
115
|
+
if (target === "provider") {
|
|
116
|
+
setHandoff(
|
|
117
|
+
await prepare.mutateAsync({ proposalId: result.mutationId }),
|
|
118
|
+
);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
setOpen(false);
|
|
122
|
+
setField("");
|
|
123
|
+
setValue("");
|
|
124
|
+
toast.success(t("recordActions.localFieldUpdated"));
|
|
125
|
+
} catch (error) {
|
|
126
|
+
toast.error(
|
|
127
|
+
error instanceof Error
|
|
128
|
+
? error.message
|
|
129
|
+
: t("recordActions.updateFailed"),
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function setDialogOpen(nextOpen: boolean) {
|
|
135
|
+
setOpen(nextOpen);
|
|
136
|
+
if (nextOpen && isNative) setTarget("local");
|
|
137
|
+
if (!nextOpen) {
|
|
138
|
+
setHandoff(null);
|
|
139
|
+
setField("");
|
|
140
|
+
setValue("");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Dialog open={open} onOpenChange={setDialogOpen}>
|
|
146
|
+
<DialogTrigger asChild>
|
|
147
|
+
<Button variant="outline" size="sm" className="gap-1.5">
|
|
148
|
+
<IconPencil className="size-4" /> {t("recordActions.editField")}
|
|
149
|
+
</Button>
|
|
150
|
+
</DialogTrigger>
|
|
151
|
+
{handoff ? (
|
|
152
|
+
<DialogContent className="sm:max-w-lg">
|
|
153
|
+
<DialogHeader>
|
|
154
|
+
<DialogTitle>
|
|
155
|
+
{t("recordActions.providerHandoffTitle", {
|
|
156
|
+
provider: handoff.providerLabel,
|
|
157
|
+
})}
|
|
158
|
+
</DialogTitle>
|
|
159
|
+
<DialogDescription>
|
|
160
|
+
{t("recordActions.providerHandoffDescription", {
|
|
161
|
+
provider: handoff.providerLabel,
|
|
162
|
+
})}
|
|
163
|
+
</DialogDescription>
|
|
164
|
+
</DialogHeader>
|
|
165
|
+
<PreparedFieldDiff fields={handoff.fields} />
|
|
166
|
+
{handoff.recordUrl ? null : (
|
|
167
|
+
<p className="text-sm text-muted-foreground">
|
|
168
|
+
{t("recordActions.recordLinkUnavailable", {
|
|
169
|
+
provider: handoff.providerLabel,
|
|
170
|
+
reason: handoff.recordUrlUnavailableReason ?? "unknown",
|
|
171
|
+
})}
|
|
172
|
+
</p>
|
|
173
|
+
)}
|
|
174
|
+
<DialogFooter className="flex-row flex-wrap justify-end gap-2 sm:justify-end">
|
|
175
|
+
<Button variant="ghost" onClick={() => setDialogOpen(false)}>
|
|
176
|
+
{t("recordActions.reviewLater")}
|
|
177
|
+
</Button>
|
|
178
|
+
{handoff.recordUrl ? (
|
|
179
|
+
<Button asChild className="gap-1.5">
|
|
180
|
+
<a
|
|
181
|
+
href={handoff.recordUrl}
|
|
182
|
+
target="_blank"
|
|
183
|
+
rel="noopener noreferrer"
|
|
184
|
+
onClick={() => setDialogOpen(false)}
|
|
185
|
+
>
|
|
186
|
+
{t("recordActions.openInProvider", {
|
|
187
|
+
provider: handoff.providerLabel,
|
|
188
|
+
})}
|
|
189
|
+
<IconExternalLink className="size-4" />
|
|
190
|
+
</a>
|
|
191
|
+
</Button>
|
|
192
|
+
) : null}
|
|
193
|
+
</DialogFooter>
|
|
194
|
+
</DialogContent>
|
|
195
|
+
) : (
|
|
196
|
+
<DialogContent className="sm:max-w-md">
|
|
197
|
+
<DialogHeader>
|
|
198
|
+
<DialogTitle>{t("recordActions.editFieldTitle")}</DialogTitle>
|
|
199
|
+
<DialogDescription>
|
|
200
|
+
{isNative
|
|
201
|
+
? t("recordActions.nativeAuthorityDescription")
|
|
202
|
+
: t("recordActions.providerAuthorityDescription", {
|
|
203
|
+
provider: providerLabel,
|
|
204
|
+
})}
|
|
205
|
+
</DialogDescription>
|
|
206
|
+
</DialogHeader>
|
|
207
|
+
<div className="grid gap-4 py-2">
|
|
208
|
+
{isNative ? null : (
|
|
209
|
+
<FormField
|
|
210
|
+
label={t("recordActions.authority")}
|
|
211
|
+
htmlFor="field-target"
|
|
212
|
+
>
|
|
213
|
+
<Select
|
|
214
|
+
value={target}
|
|
215
|
+
onValueChange={(next) =>
|
|
216
|
+
setTarget(next as "local" | "provider")
|
|
217
|
+
}
|
|
218
|
+
>
|
|
219
|
+
<SelectTrigger id="field-target">
|
|
220
|
+
<SelectValue />
|
|
221
|
+
</SelectTrigger>
|
|
222
|
+
<SelectContent>
|
|
223
|
+
<SelectItem value="provider">
|
|
224
|
+
{t("recordActions.targetProvider", {
|
|
225
|
+
provider: providerLabel,
|
|
226
|
+
})}
|
|
227
|
+
</SelectItem>
|
|
228
|
+
<SelectItem value="local">
|
|
229
|
+
{t("recordActions.targetLocal")}
|
|
230
|
+
</SelectItem>
|
|
231
|
+
</SelectContent>
|
|
232
|
+
</Select>
|
|
233
|
+
</FormField>
|
|
234
|
+
)}
|
|
235
|
+
<FormField
|
|
236
|
+
label={t("recordActions.fieldName")}
|
|
237
|
+
htmlFor="field-name"
|
|
238
|
+
>
|
|
239
|
+
<Input
|
|
240
|
+
id="field-name"
|
|
241
|
+
value={field}
|
|
242
|
+
maxLength={120}
|
|
243
|
+
placeholder={
|
|
244
|
+
isNative || target === "local"
|
|
245
|
+
? "desiredCadenceDays"
|
|
246
|
+
: record.provider === "salesforce"
|
|
247
|
+
? "StageName"
|
|
248
|
+
: "lifecyclestage"
|
|
249
|
+
}
|
|
250
|
+
onChange={(event) => setField(event.target.value)}
|
|
251
|
+
/>
|
|
252
|
+
</FormField>
|
|
253
|
+
<FormField
|
|
254
|
+
label={t("recordActions.valueType")}
|
|
255
|
+
htmlFor="field-type"
|
|
256
|
+
>
|
|
257
|
+
<Select
|
|
258
|
+
value={valueType}
|
|
259
|
+
onValueChange={(next) => setValueType(next as typeof valueType)}
|
|
260
|
+
>
|
|
261
|
+
<SelectTrigger id="field-type">
|
|
262
|
+
<SelectValue />
|
|
263
|
+
</SelectTrigger>
|
|
264
|
+
<SelectContent>
|
|
265
|
+
<SelectItem value="string">
|
|
266
|
+
{t("recordActions.valueTypeText")}
|
|
267
|
+
</SelectItem>
|
|
268
|
+
<SelectItem value="number">
|
|
269
|
+
{t("recordActions.valueTypeNumber")}
|
|
270
|
+
</SelectItem>
|
|
271
|
+
<SelectItem value="boolean">
|
|
272
|
+
{t("recordActions.valueTypeBoolean")}
|
|
273
|
+
</SelectItem>
|
|
274
|
+
</SelectContent>
|
|
275
|
+
</Select>
|
|
276
|
+
</FormField>
|
|
277
|
+
<FormField
|
|
278
|
+
label={t("recordActions.newValue")}
|
|
279
|
+
htmlFor="field-value"
|
|
280
|
+
>
|
|
281
|
+
{valueType === "boolean" ? (
|
|
282
|
+
<Select value={value} onValueChange={setValue}>
|
|
283
|
+
<SelectTrigger id="field-value">
|
|
284
|
+
<SelectValue placeholder={t("recordActions.chooseValue")} />
|
|
285
|
+
</SelectTrigger>
|
|
286
|
+
<SelectContent>
|
|
287
|
+
<SelectItem value="true">
|
|
288
|
+
{t("recordActions.booleanTrue")}
|
|
289
|
+
</SelectItem>
|
|
290
|
+
<SelectItem value="false">
|
|
291
|
+
{t("recordActions.booleanFalse")}
|
|
292
|
+
</SelectItem>
|
|
293
|
+
</SelectContent>
|
|
294
|
+
</Select>
|
|
295
|
+
) : (
|
|
296
|
+
<Input
|
|
297
|
+
id="field-value"
|
|
298
|
+
type={valueType === "number" ? "number" : "text"}
|
|
299
|
+
value={value}
|
|
300
|
+
maxLength={4_000}
|
|
301
|
+
onChange={(event) => setValue(event.target.value)}
|
|
302
|
+
/>
|
|
303
|
+
)}
|
|
304
|
+
</FormField>
|
|
305
|
+
</div>
|
|
306
|
+
<DialogFooter>
|
|
307
|
+
<Button
|
|
308
|
+
disabled={
|
|
309
|
+
!field.trim() || !value || update.isPending || prepare.isPending
|
|
310
|
+
}
|
|
311
|
+
onClick={() => void submit()}
|
|
312
|
+
>
|
|
313
|
+
{isNative
|
|
314
|
+
? t("recordActions.saveField")
|
|
315
|
+
: target === "provider"
|
|
316
|
+
? t("recordActions.prepareChange", {
|
|
317
|
+
provider: providerLabel,
|
|
318
|
+
})
|
|
319
|
+
: t("recordActions.updateLocally")}
|
|
320
|
+
</Button>
|
|
321
|
+
</DialogFooter>
|
|
322
|
+
</DialogContent>
|
|
323
|
+
)}
|
|
324
|
+
</Dialog>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function PreparedFieldDiff({ fields }: { fields: PreparedHandoff["fields"] }) {
|
|
329
|
+
const t = useT();
|
|
330
|
+
if (!fields.length) return null;
|
|
331
|
+
return (
|
|
332
|
+
<dl className="divide-y divide-border/70 overflow-x-auto rounded-md border border-border/70">
|
|
333
|
+
<div className="grid grid-cols-[8rem_1fr_1fr] gap-3 px-3 py-2 text-xs text-muted-foreground">
|
|
334
|
+
<span>{t("recordActions.diffField")}</span>
|
|
335
|
+
<span>{t("recordActions.diffCurrent")}</span>
|
|
336
|
+
<span>{t("recordActions.diffProposed")}</span>
|
|
337
|
+
</div>
|
|
338
|
+
{fields.map((field) => (
|
|
339
|
+
<div
|
|
340
|
+
key={field.name}
|
|
341
|
+
className="grid grid-cols-[8rem_1fr_1fr] gap-3 px-3 py-2 text-sm"
|
|
342
|
+
>
|
|
343
|
+
<dt className="truncate text-muted-foreground">{field.name}</dt>
|
|
344
|
+
<dd className="break-words text-muted-foreground">
|
|
345
|
+
{field.beforeKnown
|
|
346
|
+
? displayFieldValue(field.before, t)
|
|
347
|
+
: t("recordActions.diffNotMirrored")}
|
|
348
|
+
</dd>
|
|
349
|
+
<dd className="break-words font-medium">
|
|
350
|
+
{displayFieldValue(field.after, t)}
|
|
351
|
+
</dd>
|
|
352
|
+
</div>
|
|
353
|
+
))}
|
|
354
|
+
</dl>
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function displayFieldValue(
|
|
359
|
+
value: unknown,
|
|
360
|
+
t: (key: string, options?: Record<string, unknown>) => string,
|
|
361
|
+
) {
|
|
362
|
+
if (value === null || value === undefined || value === "")
|
|
363
|
+
return t("recordActions.diffEmpty");
|
|
364
|
+
if (typeof value === "string" || typeof value === "number")
|
|
365
|
+
return String(value);
|
|
366
|
+
if (typeof value === "boolean")
|
|
367
|
+
return value
|
|
368
|
+
? t("recordActions.booleanTrue")
|
|
369
|
+
: t("recordActions.booleanFalse");
|
|
370
|
+
return t("recordActions.diffStructuredValue");
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function CreateRecordTaskDialog({ recordId }: { recordId: string }) {
|
|
374
|
+
const [open, setOpen] = useState(false);
|
|
375
|
+
const [title, setTitle] = useState("");
|
|
376
|
+
const [dueAt, setDueAt] = useState("");
|
|
377
|
+
const create = useActionMutation<
|
|
378
|
+
unknown,
|
|
379
|
+
{ recordId: string; title: string; dueAt?: string; status: "open" }
|
|
380
|
+
>("manage-crm-task" as never);
|
|
381
|
+
|
|
382
|
+
async function submit() {
|
|
383
|
+
try {
|
|
384
|
+
await create.mutateAsync({
|
|
385
|
+
recordId,
|
|
386
|
+
title: title.trim(),
|
|
387
|
+
dueAt: dueAt ? new Date(dueAt).toISOString() : undefined,
|
|
388
|
+
status: "open",
|
|
389
|
+
});
|
|
390
|
+
setOpen(false);
|
|
391
|
+
setTitle("");
|
|
392
|
+
setDueAt("");
|
|
393
|
+
toast.success("Follow-up task created.");
|
|
394
|
+
} catch (error) {
|
|
395
|
+
toast.error(
|
|
396
|
+
error instanceof Error ? error.message : "Task creation failed.",
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
403
|
+
<DialogTrigger asChild>
|
|
404
|
+
<Button variant="outline" size="sm" className="gap-1.5">
|
|
405
|
+
<IconChecklist className="size-4" /> Add task
|
|
406
|
+
</Button>
|
|
407
|
+
</DialogTrigger>
|
|
408
|
+
<DialogContent className="sm:max-w-md">
|
|
409
|
+
<DialogHeader>
|
|
410
|
+
<DialogTitle>Add record task</DialogTitle>
|
|
411
|
+
<DialogDescription>
|
|
412
|
+
Keep a local follow-up next to this CRM record.
|
|
413
|
+
</DialogDescription>
|
|
414
|
+
</DialogHeader>
|
|
415
|
+
<div className="grid gap-4 py-2">
|
|
416
|
+
<FormField label="Title" htmlFor="record-task-title">
|
|
417
|
+
<Input
|
|
418
|
+
id="record-task-title"
|
|
419
|
+
value={title}
|
|
420
|
+
maxLength={300}
|
|
421
|
+
onChange={(event) => setTitle(event.target.value)}
|
|
422
|
+
/>
|
|
423
|
+
</FormField>
|
|
424
|
+
<FormField label="Due" htmlFor="record-task-due">
|
|
425
|
+
<Input
|
|
426
|
+
id="record-task-due"
|
|
427
|
+
type="datetime-local"
|
|
428
|
+
value={dueAt}
|
|
429
|
+
onChange={(event) => setDueAt(event.target.value)}
|
|
430
|
+
/>
|
|
431
|
+
</FormField>
|
|
432
|
+
</div>
|
|
433
|
+
<DialogFooter>
|
|
434
|
+
<Button
|
|
435
|
+
disabled={!title.trim() || create.isPending}
|
|
436
|
+
onClick={() => void submit()}
|
|
437
|
+
>
|
|
438
|
+
Create task
|
|
439
|
+
</Button>
|
|
440
|
+
</DialogFooter>
|
|
441
|
+
</DialogContent>
|
|
442
|
+
</Dialog>
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function AttachEvidenceDialog({ recordId }: { recordId: string }) {
|
|
447
|
+
const t = useT();
|
|
448
|
+
const [open, setOpen] = useState(false);
|
|
449
|
+
const [artifactId, setArtifactId] = useState("");
|
|
450
|
+
const [sourceUrl, setSourceUrl] = useState("");
|
|
451
|
+
const [quote, setQuote] = useState("");
|
|
452
|
+
const [summary, setSummary] = useState("");
|
|
453
|
+
const attach = useActionMutation<
|
|
454
|
+
unknown,
|
|
455
|
+
{
|
|
456
|
+
recordId: string;
|
|
457
|
+
artifactId: string;
|
|
458
|
+
sourceUrl: string;
|
|
459
|
+
sourceApp: "clips";
|
|
460
|
+
quote?: string;
|
|
461
|
+
summary?: string;
|
|
462
|
+
}
|
|
463
|
+
>("attach-call-evidence" as never);
|
|
464
|
+
|
|
465
|
+
async function submit() {
|
|
466
|
+
try {
|
|
467
|
+
await attach.mutateAsync({
|
|
468
|
+
recordId,
|
|
469
|
+
artifactId: artifactId.trim(),
|
|
470
|
+
sourceUrl: sourceUrl.trim(),
|
|
471
|
+
sourceApp: "clips",
|
|
472
|
+
quote: quote.trim() || undefined,
|
|
473
|
+
summary: summary.trim() || undefined,
|
|
474
|
+
});
|
|
475
|
+
setOpen(false);
|
|
476
|
+
setArtifactId("");
|
|
477
|
+
setSourceUrl("");
|
|
478
|
+
setQuote("");
|
|
479
|
+
setSummary("");
|
|
480
|
+
toast.success(t("recordActions.evidenceAttached"));
|
|
481
|
+
} catch (error) {
|
|
482
|
+
toast.error(
|
|
483
|
+
error instanceof Error
|
|
484
|
+
? error.message
|
|
485
|
+
: t("recordActions.evidenceAttachFailed"),
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return (
|
|
491
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
492
|
+
<DialogTrigger asChild>
|
|
493
|
+
<Button variant="outline" size="sm" className="gap-1.5">
|
|
494
|
+
<IconFilePlus className="size-4" /> {t("recordActions.addEvidence")}
|
|
495
|
+
</Button>
|
|
496
|
+
</DialogTrigger>
|
|
497
|
+
<DialogContent className="sm:max-w-lg">
|
|
498
|
+
<DialogHeader>
|
|
499
|
+
<DialogTitle>{t("recordActions.attachEvidenceTitle")}</DialogTitle>
|
|
500
|
+
<DialogDescription>
|
|
501
|
+
{t("recordActions.attachEvidenceDescription")}
|
|
502
|
+
</DialogDescription>
|
|
503
|
+
</DialogHeader>
|
|
504
|
+
<div className="grid gap-4 py-2 sm:grid-cols-2">
|
|
505
|
+
<FormField
|
|
506
|
+
label={t("recordActions.artifactId")}
|
|
507
|
+
htmlFor="evidence-id"
|
|
508
|
+
>
|
|
509
|
+
<Input
|
|
510
|
+
id="evidence-id"
|
|
511
|
+
value={artifactId}
|
|
512
|
+
maxLength={256}
|
|
513
|
+
onChange={(event) => setArtifactId(event.target.value)}
|
|
514
|
+
/>
|
|
515
|
+
</FormField>
|
|
516
|
+
<FormField label={t("recordActions.clipsUrl")} htmlFor="evidence-url">
|
|
517
|
+
<Input
|
|
518
|
+
id="evidence-url"
|
|
519
|
+
type="url"
|
|
520
|
+
value={sourceUrl}
|
|
521
|
+
maxLength={2_048}
|
|
522
|
+
onChange={(event) => setSourceUrl(event.target.value)}
|
|
523
|
+
/>
|
|
524
|
+
</FormField>
|
|
525
|
+
<FormField
|
|
526
|
+
label={t("recordActions.summary")}
|
|
527
|
+
htmlFor="evidence-summary"
|
|
528
|
+
className="sm:col-span-2"
|
|
529
|
+
>
|
|
530
|
+
<Input
|
|
531
|
+
id="evidence-summary"
|
|
532
|
+
value={summary}
|
|
533
|
+
maxLength={2_000}
|
|
534
|
+
onChange={(event) => setSummary(event.target.value)}
|
|
535
|
+
/>
|
|
536
|
+
</FormField>
|
|
537
|
+
<FormField
|
|
538
|
+
label={t("recordActions.shortExcerpt")}
|
|
539
|
+
htmlFor="evidence-quote"
|
|
540
|
+
className="sm:col-span-2"
|
|
541
|
+
>
|
|
542
|
+
<Textarea
|
|
543
|
+
id="evidence-quote"
|
|
544
|
+
value={quote}
|
|
545
|
+
maxLength={1_200}
|
|
546
|
+
onChange={(event) => setQuote(event.target.value)}
|
|
547
|
+
/>
|
|
548
|
+
</FormField>
|
|
549
|
+
</div>
|
|
550
|
+
<DialogFooter>
|
|
551
|
+
<Button
|
|
552
|
+
disabled={
|
|
553
|
+
!artifactId.trim() || !sourceUrl.trim() || attach.isPending
|
|
554
|
+
}
|
|
555
|
+
onClick={() => void submit()}
|
|
556
|
+
>
|
|
557
|
+
{t("recordActions.attachEvidence")}
|
|
558
|
+
</Button>
|
|
559
|
+
</DialogFooter>
|
|
560
|
+
</DialogContent>
|
|
561
|
+
</Dialog>
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function CallEvidenceAutomationDialog({ record }: { record: CrmRecordDetail }) {
|
|
566
|
+
const t = useT();
|
|
567
|
+
const [open, setOpen] = useState(false);
|
|
568
|
+
const recipeQuery = useActionQuery<{
|
|
569
|
+
title: string;
|
|
570
|
+
description: string;
|
|
571
|
+
enabledByDefault: false;
|
|
572
|
+
agentContext: string;
|
|
573
|
+
}>("get-crm-automation-recipe" as never, { recordId: record.id } as never, {
|
|
574
|
+
enabled: open,
|
|
575
|
+
});
|
|
576
|
+
const recipe = recipeQuery.data;
|
|
577
|
+
|
|
578
|
+
return (
|
|
579
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
580
|
+
<DialogTrigger asChild>
|
|
581
|
+
<Button variant="outline" size="sm" className="gap-1.5">
|
|
582
|
+
<IconBolt className="size-4" /> {t("recordActions.automate")}
|
|
583
|
+
</Button>
|
|
584
|
+
</DialogTrigger>
|
|
585
|
+
<DialogContent className="sm:max-w-lg">
|
|
586
|
+
<DialogHeader>
|
|
587
|
+
<DialogTitle>
|
|
588
|
+
{recipe?.title ?? t("recordActions.reviewNewClipsCalls")}
|
|
589
|
+
</DialogTitle>
|
|
590
|
+
<DialogDescription>
|
|
591
|
+
{recipe?.description ?? t("recordActions.reviewDescription")}
|
|
592
|
+
</DialogDescription>
|
|
593
|
+
</DialogHeader>
|
|
594
|
+
<div className="space-y-3 text-sm text-muted-foreground">
|
|
595
|
+
<p>
|
|
596
|
+
{t("recordActions.disabledAutomationDescription", {
|
|
597
|
+
name: record.displayName,
|
|
598
|
+
})}
|
|
599
|
+
</p>
|
|
600
|
+
<p>{t("recordActions.handoffDescription", { path: "/r" })}</p>
|
|
601
|
+
</div>
|
|
602
|
+
<DialogFooter className="flex-row flex-wrap justify-end gap-2 sm:justify-end">
|
|
603
|
+
<Button asChild variant="ghost" size="sm" className="gap-1.5">
|
|
604
|
+
<Link to="/agent#jobs" onClick={() => setOpen(false)}>
|
|
605
|
+
<IconExternalLink className="size-4" />{" "}
|
|
606
|
+
{t("recordActions.manageAutomations")}
|
|
607
|
+
</Link>
|
|
608
|
+
</Button>
|
|
609
|
+
<Button
|
|
610
|
+
size="sm"
|
|
611
|
+
disabled={!recipe || recipeQuery.isLoading}
|
|
612
|
+
onClick={() => {
|
|
613
|
+
if (!recipe) return;
|
|
614
|
+
sendToAgentChat({
|
|
615
|
+
message: `Set up the disabled Clips call-evidence review recipe for ${record.displayName}.`,
|
|
616
|
+
context: recipe.agentContext,
|
|
617
|
+
submit: true,
|
|
618
|
+
newTab: true,
|
|
619
|
+
});
|
|
620
|
+
setOpen(false);
|
|
621
|
+
}}
|
|
622
|
+
>
|
|
623
|
+
{t("recordActions.configureWithAgent")}
|
|
624
|
+
</Button>
|
|
625
|
+
</DialogFooter>
|
|
626
|
+
</DialogContent>
|
|
627
|
+
</Dialog>
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function FormField({
|
|
632
|
+
label,
|
|
633
|
+
htmlFor,
|
|
634
|
+
className,
|
|
635
|
+
children,
|
|
636
|
+
}: {
|
|
637
|
+
label: string;
|
|
638
|
+
htmlFor: string;
|
|
639
|
+
className?: string;
|
|
640
|
+
children: React.ReactNode;
|
|
641
|
+
}) {
|
|
642
|
+
return (
|
|
643
|
+
<div className={`grid gap-2 ${className ?? ""}`}>
|
|
644
|
+
<Label htmlFor={htmlFor}>{label}</Label>
|
|
645
|
+
{children}
|
|
646
|
+
</div>
|
|
647
|
+
);
|
|
648
|
+
}
|