@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.
Files changed (334) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +24 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/cli/templates-meta.ts +12 -0
  5. package/corpus/core/src/deploy/build.ts +8 -0
  6. package/corpus/core/src/server/builder-browser.ts +76 -0
  7. package/corpus/core/src/server/core-routes-plugin.ts +15 -5
  8. package/corpus/templates/assets/app/global.css +0 -4
  9. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +195 -167
  10. package/corpus/templates/assets/changelog/2026-07-23-drafts-preview-panel-now-fills-the-full-width-with-a-large-p.md +6 -0
  11. package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
  12. package/corpus/templates/content/actions/_builder-cms-write-client.ts +55 -9
  13. package/corpus/templates/content/actions/_database-source-utils.ts +756 -182
  14. package/corpus/templates/content/actions/change-content-database-source-role.ts +21 -20
  15. package/corpus/templates/content/actions/execute-builder-source-execution.ts +49 -8
  16. package/corpus/templates/content/actions/materialize-builder-required-fields.ts +42 -9
  17. package/corpus/templates/content/actions/prepare-builder-source-review.ts +88 -90
  18. package/corpus/templates/content/actions/preview-builder-source-review.ts +4 -3
  19. package/corpus/templates/content/actions/refresh-content-database-source.ts +36 -9
  20. package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +28 -24
  21. package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +62 -12
  22. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +91 -16
  23. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +15 -1
  24. package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +234 -44
  25. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +194 -16
  26. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +95 -42
  27. package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +4 -2
  28. package/corpus/templates/content/app/components/editor/extensions/CodeBlockNode.tsx +10 -166
  29. package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +32 -8
  30. package/corpus/templates/content/app/components/editor/extensions/VideoNode.ts +14 -0
  31. package/corpus/templates/content/app/components/editor/registrySlashItems.ts +5 -1
  32. package/corpus/templates/content/app/hooks/use-content-database.ts +59 -2
  33. package/corpus/templates/content/app/hooks/use-documents.ts +18 -26
  34. package/corpus/templates/content/app/root.tsx +1 -6
  35. package/corpus/templates/content/changelog/2026-07-24-builder-can-now-publish-approved-updates-to-entries-that-are.md +6 -0
  36. package/corpus/templates/content/changelog/2026-07-24-builder-collection-loading-no-longer-restarts-from-the-begin.md +6 -0
  37. package/corpus/templates/content/changelog/2026-07-24-builder-connections-now-complete-securely-from-netlify-deplo.md +6 -0
  38. package/corpus/templates/content/changelog/2026-07-24-builder-draft-creation-now-scopes-execution-to-the-selected-.md +6 -0
  39. package/corpus/templates/content/changelog/2026-07-24-builder-review-now-distinguishes-preparing-a-safe-dry-run-from.md +6 -0
  40. package/corpus/templates/content/changelog/2026-07-24-builder-source-imports-now-recover-from-a-transient-paginati.md +6 -0
  41. package/corpus/templates/content/changelog/2026-07-24-builder-source-refresh-now-preserves-the-provider-bound-fiel.md +6 -0
  42. package/corpus/templates/content/changelog/2026-07-24-builder-update-reviews-now-open-reliably-on-large-collection.md +6 -0
  43. package/corpus/templates/content/changelog/2026-07-24-builder-write-policy-controls-now-reflect-successful-changes.md +6 -0
  44. package/corpus/templates/content/changelog/2026-07-24-date-properties-now-save-reliably-when-selected-with-the-nat.md +6 -0
  45. package/corpus/templates/content/changelog/2026-07-24-editor-slash-search-now-keeps-multi-word-block-names-open.md +6 -0
  46. package/corpus/templates/content/changelog/2026-07-24-exact-editor-slash-commands-now-execute-on-enter-even-if-the.md +6 -0
  47. package/corpus/templates/content/changelog/2026-07-24-new-collaborative-pages-now-save-their-first-edits.md +6 -0
  48. package/corpus/templates/content/changelog/2026-07-24-new-local-builder-rows-no-longer-remain-locked-behind-a-none.md +6 -0
  49. package/corpus/templates/content/changelog/2026-07-24-opening-or-closing-a-collaborative-document-no-longer-lets-u.md +6 -0
  50. package/corpus/templates/content/changelog/2026-07-24-selected-text-now-opens-the-link-editor-with-command-k-or-co.md +6 -0
  51. package/corpus/templates/content/changelog/2026-07-24-slash-menu-block-choices-no-longer-stall-pointer-interaction.md +6 -0
  52. package/corpus/templates/content/changelog/2026-07-24-uploaded-and-embedded-media-now-stay-intact-while-collaborative-document-drafts-save.md +6 -0
  53. package/corpus/templates/content/changelog/2026-07-24-video-link-insertion-now-keeps-its-source-panel-open-while-t.md +6 -0
  54. package/corpus/templates/content/changelog/2026-07-26-builder-publishing-now-shows-safe-validation-details-instead.md +6 -0
  55. package/corpus/templates/content/changelog/2026-07-26-builder-reviews-stay-responsive-on-large-collections-and-pre.md +6 -0
  56. package/corpus/templates/content/changelog/2026-07-26-collaborative-documents-no-longer-flash-duplicated-recent-bl.md +6 -0
  57. package/corpus/templates/content/changelog/2026-07-26-corrected-builder-updates-are-now-reviewed-separately-from-f.md +6 -0
  58. package/corpus/templates/content/changelog/2026-07-26-documents-now-remain-read-only-until-their-live-collaborativ.md +6 -0
  59. package/corpus/templates/content/changelog/2026-07-26-slash-command-menus-now-stay-reachable-when-editing-near-the.md +6 -0
  60. package/corpus/templates/content/changelog/2026-07-26-the-slash-menu-now-shows-one-clear-callout-choice-instead-of.md +6 -0
  61. package/corpus/templates/content/shared/api.ts +1 -0
  62. package/corpus/templates/content/shared/builder-mdx.ts +73 -16
  63. package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +115 -0
  64. package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +177 -0
  65. package/corpus/templates/crm/.agents/skills/crm/SKILL.md +205 -0
  66. package/corpus/templates/crm/.agents/skills/customizing-agent-native/SKILL.md +220 -0
  67. package/corpus/templates/crm/.agents/skills/feature-flags/SKILL.md +169 -0
  68. package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +228 -0
  69. package/corpus/templates/crm/.agents/skills/storing-data/SKILL.md +178 -0
  70. package/corpus/templates/crm/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
  71. package/corpus/templates/crm/.env.example +5 -0
  72. package/corpus/templates/crm/AGENTS.md +82 -0
  73. package/corpus/templates/crm/CHANGELOG.md +25 -0
  74. package/corpus/templates/crm/DEVELOPING.md +66 -0
  75. package/corpus/templates/crm/README.md +122 -0
  76. package/corpus/templates/crm/_gitignore +12 -0
  77. package/corpus/templates/crm/actions/_crm-action-utils.ts +98 -0
  78. package/corpus/templates/crm/actions/_crm-attribute-utils.ts +219 -0
  79. package/corpus/templates/crm/actions/_crm-dashboard.ts +69 -0
  80. package/corpus/templates/crm/actions/_crm-data-program-actions.ts +15 -0
  81. package/corpus/templates/crm/actions/_crm-list-utils.ts +775 -0
  82. package/corpus/templates/crm/actions/_crm-signal-utils.ts +79 -0
  83. package/corpus/templates/crm/actions/add-crm-record-to-list.ts +164 -0
  84. package/corpus/templates/crm/actions/apply-crm-proposals.ts +291 -0
  85. package/corpus/templates/crm/actions/archive-crm-attribute.ts +69 -0
  86. package/corpus/templates/crm/actions/attach-call-evidence.ts +170 -0
  87. package/corpus/templates/crm/actions/configure-crm-connection.ts +126 -0
  88. package/corpus/templates/crm/actions/configure-native-crm.ts +44 -0
  89. package/corpus/templates/crm/actions/create-crm-attribute.ts +350 -0
  90. package/corpus/templates/crm/actions/create-crm-list.ts +194 -0
  91. package/corpus/templates/crm/actions/create-crm-record.ts +148 -0
  92. package/corpus/templates/crm/actions/create-crm-signal-tracker.ts +58 -0
  93. package/corpus/templates/crm/actions/delete-crm-saved-view.ts +68 -0
  94. package/corpus/templates/crm/actions/delete-staged-dataset.ts +14 -0
  95. package/corpus/templates/crm/actions/estimate-crm-enrichment.ts +229 -0
  96. package/corpus/templates/crm/actions/find-crm-duplicates.ts +87 -0
  97. package/corpus/templates/crm/actions/get-crm-automation-recipe.ts +36 -0
  98. package/corpus/templates/crm/actions/get-crm-dashboard-panel.ts +35 -0
  99. package/corpus/templates/crm/actions/get-crm-dashboard.ts +14 -0
  100. package/corpus/templates/crm/actions/get-crm-overview.ts +13 -0
  101. package/corpus/templates/crm/actions/get-crm-pipeline-data.ts +61 -0
  102. package/corpus/templates/crm/actions/get-crm-record-page.ts +287 -0
  103. package/corpus/templates/crm/actions/get-crm-record.ts +75 -0
  104. package/corpus/templates/crm/actions/get-crm-workspace.ts +364 -0
  105. package/corpus/templates/crm/actions/install-crm-pipeline-dashboard.ts +81 -0
  106. package/corpus/templates/crm/actions/list-crm-attributes.ts +71 -0
  107. package/corpus/templates/crm/actions/list-crm-connections.ts +68 -0
  108. package/corpus/templates/crm/actions/list-crm-dashboard-revisions.ts +15 -0
  109. package/corpus/templates/crm/actions/list-crm-dashboards.ts +15 -0
  110. package/corpus/templates/crm/actions/list-crm-enrichment-slots.ts +28 -0
  111. package/corpus/templates/crm/actions/list-crm-list-entries.ts +192 -0
  112. package/corpus/templates/crm/actions/list-crm-lists.ts +80 -0
  113. package/corpus/templates/crm/actions/list-crm-proposals.ts +55 -0
  114. package/corpus/templates/crm/actions/list-crm-record-field-history.ts +201 -0
  115. package/corpus/templates/crm/actions/list-crm-record-values.ts +200 -0
  116. package/corpus/templates/crm/actions/list-crm-records.ts +103 -0
  117. package/corpus/templates/crm/actions/list-crm-saved-views.ts +66 -0
  118. package/corpus/templates/crm/actions/list-crm-signal-hits.ts +43 -0
  119. package/corpus/templates/crm/actions/list-crm-signal-trackers.ts +32 -0
  120. package/corpus/templates/crm/actions/list-crm-tasks.ts +22 -0
  121. package/corpus/templates/crm/actions/list-staged-datasets.ts +14 -0
  122. package/corpus/templates/crm/actions/list-workspace-connections.ts +47 -0
  123. package/corpus/templates/crm/actions/manage-crm-attribute-option.ts +272 -0
  124. package/corpus/templates/crm/actions/manage-crm-signal-tracker.ts +87 -0
  125. package/corpus/templates/crm/actions/manage-crm-task.ts +132 -0
  126. package/corpus/templates/crm/actions/merge-crm-records.ts +691 -0
  127. package/corpus/templates/crm/actions/navigate.ts +54 -0
  128. package/corpus/templates/crm/actions/provider-api-catalog.ts +22 -0
  129. package/corpus/templates/crm/actions/provider-api-docs.ts +54 -0
  130. package/corpus/templates/crm/actions/provider-api-request.ts +92 -0
  131. package/corpus/templates/crm/actions/query-staged-dataset.ts +44 -0
  132. package/corpus/templates/crm/actions/record-crm-call-insight.ts +160 -0
  133. package/corpus/templates/crm/actions/record-crm-smart-signal.ts +150 -0
  134. package/corpus/templates/crm/actions/remove-crm-list-entry.ts +79 -0
  135. package/corpus/templates/crm/actions/restore-crm-dashboard-revision.ts +23 -0
  136. package/corpus/templates/crm/actions/review-crm-signal.ts +31 -0
  137. package/corpus/templates/crm/actions/run-crm-attribute-fill.ts +443 -0
  138. package/corpus/templates/crm/actions/run-crm-enrichment.ts +647 -0
  139. package/corpus/templates/crm/actions/run-crm-saved-view-program.ts +103 -0
  140. package/corpus/templates/crm/actions/run-crm-signal-trackers.ts +265 -0
  141. package/corpus/templates/crm/actions/run.ts +7 -0
  142. package/corpus/templates/crm/actions/save-crm-dashboard.ts +51 -0
  143. package/corpus/templates/crm/actions/save-crm-saved-view.ts +296 -0
  144. package/corpus/templates/crm/actions/sync-crm.ts +146 -0
  145. package/corpus/templates/crm/actions/update-crm-attribute.ts +111 -0
  146. package/corpus/templates/crm/actions/update-crm-list-entry.ts +102 -0
  147. package/corpus/templates/crm/actions/update-crm-list.ts +97 -0
  148. package/corpus/templates/crm/actions/update-crm-record.ts +543 -0
  149. package/corpus/templates/crm/actions/view-screen.ts +324 -0
  150. package/corpus/templates/crm/agent-native.app-skill.json +69 -0
  151. package/corpus/templates/crm/app/components/crm/CreateCrmRecordDialog.tsx +158 -0
  152. package/corpus/templates/crm/app/components/crm/CrmDashboardPanel.tsx +78 -0
  153. package/corpus/templates/crm/app/components/crm/CrmSignalsPanel.tsx +220 -0
  154. package/corpus/templates/crm/app/components/crm/IntelligenceSettings.tsx +414 -0
  155. package/corpus/templates/crm/app/components/crm/RecordActions.tsx +648 -0
  156. package/corpus/templates/crm/app/components/crm/RecordGrid.tsx +488 -0
  157. package/corpus/templates/crm/app/components/crm/RecordWorkspace.tsx +232 -0
  158. package/corpus/templates/crm/app/components/crm/SavedViewDataProgram.tsx +93 -0
  159. package/corpus/templates/crm/app/components/crm/Surface.tsx +97 -0
  160. package/corpus/templates/crm/app/components/crm/WorkOverview.tsx +180 -0
  161. package/corpus/templates/crm/app/components/crm/board/CrmBoard.tsx +988 -0
  162. package/corpus/templates/crm/app/components/crm/board/board-model.ts +399 -0
  163. package/corpus/templates/crm/app/components/crm/board/entry-filter.ts +150 -0
  164. package/corpus/templates/crm/app/components/crm/board/view-draft.ts +227 -0
  165. package/corpus/templates/crm/app/components/crm/grid/CrmGrid.tsx +1033 -0
  166. package/corpus/templates/crm/app/components/crm/grid/GridCell.tsx +620 -0
  167. package/corpus/templates/crm/app/components/crm/grid/clipboard.ts +84 -0
  168. package/corpus/templates/crm/app/components/crm/grid/model.ts +304 -0
  169. package/corpus/templates/crm/app/components/crm/grid/navigation.ts +220 -0
  170. package/corpus/templates/crm/app/components/crm/grid/query.ts +214 -0
  171. package/corpus/templates/crm/app/components/crm/record/AttributePanel.tsx +192 -0
  172. package/corpus/templates/crm/app/components/crm/record/FieldHistory.tsx +179 -0
  173. package/corpus/templates/crm/app/components/crm/record/RecordHeader.tsx +103 -0
  174. package/corpus/templates/crm/app/components/crm/record/RecordLists.tsx +235 -0
  175. package/corpus/templates/crm/app/components/crm/record/RecordTabs.tsx +206 -0
  176. package/corpus/templates/crm/app/components/crm/record/field-editors.tsx +245 -0
  177. package/corpus/templates/crm/app/components/crm/record/record-data.ts +603 -0
  178. package/corpus/templates/crm/app/components/crm/settings/AdvancedSettings.tsx +49 -0
  179. package/corpus/templates/crm/app/components/crm/settings/AttributeOptionsEditor.tsx +441 -0
  180. package/corpus/templates/crm/app/components/crm/settings/ConnectionSettings.tsx +169 -0
  181. package/corpus/templates/crm/app/components/crm/settings/FieldsSettings.tsx +935 -0
  182. package/corpus/templates/crm/app/components/crm/settings/ListsSettings.tsx +339 -0
  183. package/corpus/templates/crm/app/components/crm/settings/settings-admin.ts +377 -0
  184. package/corpus/templates/crm/app/components/crm/shared/AttributeValueParts.tsx +69 -0
  185. package/corpus/templates/crm/app/components/crm/shared/attribute-value.ts +591 -0
  186. package/corpus/templates/crm/app/components/layout/CrmCommandMenu.tsx +556 -0
  187. package/corpus/templates/crm/app/components/layout/CrmLayout.tsx +130 -0
  188. package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +407 -0
  189. package/corpus/templates/crm/app/components/layout/command-palette-search.ts +126 -0
  190. package/corpus/templates/crm/app/components/layout/crm-ui-intents.ts +41 -0
  191. package/corpus/templates/crm/app/components/layout/sidebar-collapse.ts +40 -0
  192. package/corpus/templates/crm/app/components/layout/sidebar-lists.ts +109 -0
  193. package/corpus/templates/crm/app/components/ui/alert-dialog.tsx +1 -0
  194. package/corpus/templates/crm/app/components/ui/badge.tsx +1 -0
  195. package/corpus/templates/crm/app/components/ui/button.tsx +1 -0
  196. package/corpus/templates/crm/app/components/ui/card.tsx +1 -0
  197. package/corpus/templates/crm/app/components/ui/checkbox.tsx +1 -0
  198. package/corpus/templates/crm/app/components/ui/dialog.tsx +1 -0
  199. package/corpus/templates/crm/app/components/ui/dropdown-menu.tsx +1 -0
  200. package/corpus/templates/crm/app/components/ui/hover-card.tsx +1 -0
  201. package/corpus/templates/crm/app/components/ui/input.tsx +1 -0
  202. package/corpus/templates/crm/app/components/ui/label.tsx +1 -0
  203. package/corpus/templates/crm/app/components/ui/popover.tsx +1 -0
  204. package/corpus/templates/crm/app/components/ui/select.tsx +1 -0
  205. package/corpus/templates/crm/app/components/ui/sheet.tsx +1 -0
  206. package/corpus/templates/crm/app/components/ui/skeleton.tsx +1 -0
  207. package/corpus/templates/crm/app/components/ui/switch.tsx +1 -0
  208. package/corpus/templates/crm/app/components/ui/table.tsx +1 -0
  209. package/corpus/templates/crm/app/components/ui/tabs.tsx +1 -0
  210. package/corpus/templates/crm/app/components/ui/textarea.tsx +1 -0
  211. package/corpus/templates/crm/app/components/ui/toolkit-provider.tsx +17 -0
  212. package/corpus/templates/crm/app/components/ui/tooltip.tsx +1 -0
  213. package/corpus/templates/crm/app/design-system.ts +3 -0
  214. package/corpus/templates/crm/app/entry.client.tsx +19 -0
  215. package/corpus/templates/crm/app/entry.server.tsx +10 -0
  216. package/corpus/templates/crm/app/global.css +167 -0
  217. package/corpus/templates/crm/app/hooks/use-keyboard-shortcuts.ts +206 -0
  218. package/corpus/templates/crm/app/hooks/use-navigation-state.ts +48 -0
  219. package/corpus/templates/crm/app/i18n/en-US.ts +684 -0
  220. package/corpus/templates/crm/app/i18n/index.ts +34 -0
  221. package/corpus/templates/crm/app/lib/dashboard.ts +13 -0
  222. package/corpus/templates/crm/app/lib/navigation.ts +17 -0
  223. package/corpus/templates/crm/app/lib/tab-id.ts +1 -0
  224. package/corpus/templates/crm/app/lib/types.ts +172 -0
  225. package/corpus/templates/crm/app/lib/utils.ts +1 -0
  226. package/corpus/templates/crm/app/root.tsx +93 -0
  227. package/corpus/templates/crm/app/routes/_index.tsx +26 -0
  228. package/corpus/templates/crm/app/routes/accounts.tsx +41 -0
  229. package/corpus/templates/crm/app/routes/agent.tsx +5 -0
  230. package/corpus/templates/crm/app/routes/ask.tsx +53 -0
  231. package/corpus/templates/crm/app/routes/dashboard.tsx +118 -0
  232. package/corpus/templates/crm/app/routes/lists.tsx +228 -0
  233. package/corpus/templates/crm/app/routes/opportunities.tsx +41 -0
  234. package/corpus/templates/crm/app/routes/people.tsx +41 -0
  235. package/corpus/templates/crm/app/routes/proposals.tsx +388 -0
  236. package/corpus/templates/crm/app/routes/records.$recordId.tsx +53 -0
  237. package/corpus/templates/crm/app/routes/records.tsx +64 -0
  238. package/corpus/templates/crm/app/routes/settings.tsx +118 -0
  239. package/corpus/templates/crm/app/routes/setup.tsx +308 -0
  240. package/corpus/templates/crm/app/routes/tasks.tsx +252 -0
  241. package/corpus/templates/crm/app/routes/views.tsx +683 -0
  242. package/corpus/templates/crm/app/routes.ts +19 -0
  243. package/corpus/templates/crm/app/vite-env.d.ts +6 -0
  244. 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
  245. package/corpus/templates/crm/changelog/2026-07-26-crm-now-finds-likely-duplicate-records-and-tells-you-exactly.md +6 -0
  246. package/corpus/templates/crm/changelog/2026-07-26-enrichment-now-shows-what-a-run-will-cost-before-it-starts-g.md +6 -0
  247. package/corpus/templates/crm/changelog/2026-07-26-lists-turn-any-set-of-records-into-a-pipeline-with-its-own-s.md +6 -0
  248. package/corpus/templates/crm/changelog/2026-07-26-moving-a-record-or-list-entry-into-a-stage-that-was-retired-.md +6 -0
  249. package/corpus/templates/crm/changelog/2026-07-26-opening-a-record-now-shows-one-page-with-its-fields-the-list.md +6 -0
  250. 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
  251. package/corpus/templates/crm/changelog/2026-07-26-provider-record-edits-now-show-an-exact-before-after-diff-an.md +6 -0
  252. package/corpus/templates/crm/changelog/2026-07-26-record-page-attribute-labels-now-read-in-full-instead-of-bei.md +6 -0
  253. package/corpus/templates/crm/changelog/2026-07-26-records-now-use-typed-fields-currency-dates-ratings-status-s.md +6 -0
  254. package/corpus/templates/crm/changelog/2026-07-26-retyping-a-value-on-the-record-page-now-replaces-it-instead-.md +6 -0
  255. package/corpus/templates/crm/changelog/2026-07-26-settings-now-has-fields-and-lists-tabs-for-adding-fields-edi.md +6 -0
  256. package/corpus/templates/crm/changelog/2026-07-26-the-proposal-review-now-shows-the-field-that-actually-change.md +6 -0
  257. package/corpus/templates/crm/changelog/2026-07-26-the-record-grid-is-now-a-real-spreadsheet-filter-sort-and-pa.md +6 -0
  258. package/corpus/templates/crm/components.json +20 -0
  259. package/corpus/templates/crm/docs/architecture/crm-contract.md +214 -0
  260. package/corpus/templates/crm/docs/features/README.md +55 -0
  261. package/corpus/templates/crm/docs/features/f1-records-and-fields.mdx +52 -0
  262. package/corpus/templates/crm/docs/features/f2-lists-pipelines-and-views.mdx +48 -0
  263. package/corpus/templates/crm/docs/features/f3-work-and-record-quality.mdx +40 -0
  264. package/corpus/templates/crm/docs/features/f4-evidence-and-chat.mdx +47 -0
  265. package/corpus/templates/crm/learnings.defaults.md +5 -0
  266. package/corpus/templates/crm/netlify.toml +11 -0
  267. package/corpus/templates/crm/package.json +61 -0
  268. package/corpus/templates/crm/public/favicon.svg +1 -0
  269. package/corpus/templates/crm/public/icon-180.svg +1 -0
  270. package/corpus/templates/crm/public/manifest.json +11 -0
  271. package/corpus/templates/crm/react-router.config.ts +7 -0
  272. package/corpus/templates/crm/server/crm/adapter.ts +32 -0
  273. package/corpus/templates/crm/server/crm/crm-field-firewall.ts +64 -0
  274. package/corpus/templates/crm/server/crm/crm-mirror.ts +721 -0
  275. package/corpus/templates/crm/server/crm/field-policy-attributes.ts +48 -0
  276. package/corpus/templates/crm/server/crm/hubspot-adapter.ts +1146 -0
  277. package/corpus/templates/crm/server/crm/native-adapter.ts +1810 -0
  278. package/corpus/templates/crm/server/crm/provider-record-link.ts +264 -0
  279. package/corpus/templates/crm/server/crm/read-through.ts +207 -0
  280. package/corpus/templates/crm/server/crm/salesforce-adapter.ts +1255 -0
  281. package/corpus/templates/crm/server/db/crm-store.ts +1112 -0
  282. package/corpus/templates/crm/server/db/index.ts +191 -0
  283. package/corpus/templates/crm/server/db/schema.ts +647 -0
  284. package/corpus/templates/crm/server/lib/crm-query.ts +1558 -0
  285. package/corpus/templates/crm/server/lib/dedupe.ts +714 -0
  286. package/corpus/templates/crm/server/lib/enrichment-cost.ts +381 -0
  287. package/corpus/templates/crm/server/lib/enrichment-slots.ts +519 -0
  288. package/corpus/templates/crm/server/lib/intelligence/default-detectors.ts +65 -0
  289. package/corpus/templates/crm/server/lib/intelligence/evidence.ts +105 -0
  290. package/corpus/templates/crm/server/lib/intelligence/keyword-detector.ts +94 -0
  291. package/corpus/templates/crm/server/lib/intelligence/smart-detector.ts +39 -0
  292. package/corpus/templates/crm/server/lib/intelligence/summary.ts +19 -0
  293. package/corpus/templates/crm/server/lib/lifecycle.ts +634 -0
  294. package/corpus/templates/crm/server/lib/provider-api.ts +64 -0
  295. package/corpus/templates/crm/server/middleware/auth.ts +4 -0
  296. package/corpus/templates/crm/server/plugins/agent-chat.ts +65 -0
  297. package/corpus/templates/crm/server/plugins/auth.ts +14 -0
  298. package/corpus/templates/crm/server/plugins/core-routes.ts +17 -0
  299. package/corpus/templates/crm/server/plugins/db.ts +738 -0
  300. package/corpus/templates/crm/server/routes/[...page].get.ts +5 -0
  301. package/corpus/templates/crm/shared/crm-attributes.ts +469 -0
  302. package/corpus/templates/crm/shared/crm-automation-recipes.ts +132 -0
  303. package/corpus/templates/crm/shared/crm-contract.ts +417 -0
  304. package/corpus/templates/crm/shared/crm-navigation.ts +190 -0
  305. package/corpus/templates/crm/shared/crm-sales-config.ts +63 -0
  306. package/corpus/templates/crm/ssr-entry.ts +11 -0
  307. package/corpus/templates/crm/tsconfig.json +24 -0
  308. package/corpus/templates/crm/vite.config.ts +15 -0
  309. package/corpus/templates/crm/vitest.config.ts +5 -0
  310. package/corpus/templates/design/app/i18n-data.ts +12 -12
  311. package/corpus/templates/design/changelog/2026-07-26-apply-design-updates-from-a-centered-top-toolbar-without-cov.md +6 -0
  312. package/corpus/toolkit/CHANGELOG.md +6 -0
  313. package/corpus/toolkit/package.json +1 -1
  314. package/corpus/toolkit/src/editor/useCollabReconcile.ts +14 -1
  315. package/dist/cli/templates-meta.d.ts.map +1 -1
  316. package/dist/cli/templates-meta.js +12 -0
  317. package/dist/cli/templates-meta.js.map +1 -1
  318. package/dist/collab/routes.d.ts +2 -2
  319. package/dist/deploy/build.js +6 -0
  320. package/dist/deploy/build.js.map +1 -1
  321. package/dist/observability/routes.d.ts +3 -3
  322. package/dist/server/builder-browser.d.ts +13 -0
  323. package/dist/server/builder-browser.d.ts.map +1 -1
  324. package/dist/server/builder-browser.js +59 -0
  325. package/dist/server/builder-browser.js.map +1 -1
  326. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  327. package/dist/server/core-routes-plugin.js +10 -5
  328. package/dist/server/core-routes-plugin.js.map +1 -1
  329. package/dist/server/transcribe-voice.d.ts +1 -1
  330. package/package.json +2 -2
  331. package/src/cli/templates-meta.ts +12 -0
  332. package/src/deploy/build.ts +8 -0
  333. package/src/server/builder-browser.ts +76 -0
  334. package/src/server/core-routes-plugin.ts +15 -5
@@ -0,0 +1,683 @@
1
+ /**
2
+ * Saved views: the index, and the table/board surface for one view.
3
+ *
4
+ * Unsaved filter, sort, grouping, and presentation changes live in the URL
5
+ * search params and nowhere else — a reload reverts to the stored view, and a
6
+ * shared view is never autosaved. Committing a change is an explicit three-way
7
+ * fork: save it, fork it into a new view, or discard it.
8
+ */
9
+
10
+ import {
11
+ useActionMutation,
12
+ useActionQuery,
13
+ } from "@agent-native/core/client/hooks";
14
+ import { useT } from "@agent-native/core/client/i18n";
15
+ import {
16
+ IconArrowLeft,
17
+ IconBookmark,
18
+ IconLayoutKanban,
19
+ IconLock,
20
+ IconPlus,
21
+ IconTable,
22
+ IconUsers,
23
+ } from "@tabler/icons-react";
24
+ import { useCallback, useState } from "react";
25
+ import { Link, useNavigate, useSearchParams } from "react-router";
26
+ import { toast } from "sonner";
27
+
28
+ import { CrmBoard, type CrmBoardTarget } from "@/components/crm/board/CrmBoard";
29
+ import {
30
+ buildSaveFork,
31
+ clearBoardDraft,
32
+ draftIsDirty,
33
+ effectiveView,
34
+ groupSavedViews,
35
+ readBoardDraft,
36
+ writeBoardDraft,
37
+ type BoardDraft,
38
+ type SavedViewShape,
39
+ } from "@/components/crm/board/view-draft";
40
+ import {
41
+ LoadingRows,
42
+ PageHeader,
43
+ SetupEmptyState,
44
+ } from "@/components/crm/Surface";
45
+ import { Badge } from "@/components/ui/badge";
46
+ import { Button } from "@/components/ui/button";
47
+ import {
48
+ Dialog,
49
+ DialogContent,
50
+ DialogDescription,
51
+ DialogFooter,
52
+ DialogHeader,
53
+ DialogTitle,
54
+ DialogTrigger,
55
+ } from "@/components/ui/dialog";
56
+ import { Input } from "@/components/ui/input";
57
+ import { Label } from "@/components/ui/label";
58
+ import {
59
+ Select,
60
+ SelectContent,
61
+ SelectItem,
62
+ SelectTrigger,
63
+ SelectValue,
64
+ } from "@/components/ui/select";
65
+
66
+ interface SavedViewsResponse {
67
+ views: SavedViewShape[];
68
+ }
69
+
70
+ interface ListsResponse {
71
+ lists: Array<{
72
+ id: string;
73
+ name: string;
74
+ parentObjectType: string;
75
+ defaultViewId: string | null;
76
+ archived: boolean;
77
+ }>;
78
+ }
79
+
80
+ const OBJECT_TYPE_BY_KIND: Record<string, string> = {
81
+ account: "accounts",
82
+ person: "people",
83
+ opportunity: "opportunities",
84
+ };
85
+
86
+ function objectTypeFor(view: SavedViewShape): string {
87
+ if (view.targetId) return view.targetId;
88
+ return OBJECT_TYPE_BY_KIND[view.kind ?? ""] ?? "accounts";
89
+ }
90
+
91
+ function boardTargetFor(view: SavedViewShape): CrmBoardTarget {
92
+ if (view.targetKind === "list" && view.targetId) {
93
+ return { kind: "list", id: view.targetId };
94
+ }
95
+ return {
96
+ kind: "object",
97
+ id: objectTypeFor(view),
98
+ recordKind: view.kind,
99
+ };
100
+ }
101
+
102
+ export default function SavedViewsRoute() {
103
+ const [params] = useSearchParams();
104
+ const viewsQuery = useActionQuery<SavedViewsResponse>(
105
+ "list-crm-saved-views" as never,
106
+ { limit: 100 } as never,
107
+ );
108
+ const listsQuery = useActionQuery<ListsResponse>(
109
+ "list-crm-lists" as never,
110
+ { limit: 100 } as never,
111
+ );
112
+
113
+ const viewId = params.get("view");
114
+ const listId = params.get("list");
115
+ const views = viewsQuery.data?.views ?? [];
116
+ const lists = listsQuery.data?.lists ?? [];
117
+
118
+ if (viewsQuery.isLoading || listsQuery.isLoading)
119
+ return <LoadingRows rows={6} />;
120
+
121
+ if (viewId) {
122
+ const view = views.find((entry) => entry.id === viewId);
123
+ return view ? (
124
+ <SavedViewSurface view={view} onSaved={() => void viewsQuery.refetch()} />
125
+ ) : (
126
+ <MissingSurface kind="view" />
127
+ );
128
+ }
129
+ if (listId) {
130
+ const list = lists.find((entry) => entry.id === listId);
131
+ if (!list) return <MissingSurface kind="list" />;
132
+ const defaultView = list.defaultViewId
133
+ ? views.find((entry) => entry.id === list.defaultViewId)
134
+ : undefined;
135
+ return defaultView ? (
136
+ <SavedViewSurface
137
+ view={defaultView}
138
+ onSaved={() => void viewsQuery.refetch()}
139
+ />
140
+ ) : (
141
+ <AdHocListSurface listId={list.id} name={list.name} />
142
+ );
143
+ }
144
+ return <ViewsIndex views={views} lists={lists} />;
145
+ }
146
+
147
+ // ---------------------------------------------------------------------------
148
+ // Index
149
+ // ---------------------------------------------------------------------------
150
+
151
+ function ViewsIndex({
152
+ views,
153
+ lists,
154
+ }: {
155
+ views: SavedViewShape[];
156
+ lists: ListsResponse["lists"];
157
+ }) {
158
+ const t = useT();
159
+ const groups = groupSavedViews(views);
160
+ const listNames = new Map(lists.map((list) => [list.id, list.name]));
161
+
162
+ return (
163
+ <>
164
+ <PageHeader
165
+ eyebrow={t("views.eyebrow")}
166
+ title={t("views.title")}
167
+ description={t("views.description")}
168
+ actions={<CreateSavedViewDialog />}
169
+ />
170
+ {groups.length ? (
171
+ <div className="grid gap-6 p-5 sm:p-7">
172
+ {groups.map((group) => (
173
+ <section key={`${group.targetKind}:${group.targetId}`}>
174
+ <h2 className="mb-2 text-xs font-medium uppercase tracking-[0.12em] text-muted-foreground">
175
+ {group.targetKind === "list"
176
+ ? (listNames.get(group.targetId) ??
177
+ t("views.groupList", { target: group.targetId }))
178
+ : t("views.groupObject", { target: group.targetId })}
179
+ </h2>
180
+ <div className="grid gap-2 sm:grid-cols-2 xl:grid-cols-3">
181
+ {group.views.map((view) => (
182
+ <Link
183
+ key={view.id}
184
+ to={`/views?view=${encodeURIComponent(view.id)}`}
185
+ className="group rounded-lg border border-border/70 bg-card p-4 transition-colors hover:bg-muted/50"
186
+ >
187
+ <div className="flex items-start gap-3">
188
+ {view.viewKind === "board" ? (
189
+ <IconLayoutKanban className="mt-0.5 size-4 text-muted-foreground" />
190
+ ) : (
191
+ <IconTable className="mt-0.5 size-4 text-muted-foreground" />
192
+ )}
193
+ <div className="min-w-0">
194
+ <p className="truncate text-sm font-medium">
195
+ {view.name}
196
+ </p>
197
+ {view.description ? (
198
+ <p className="mt-1 line-clamp-2 text-sm text-muted-foreground">
199
+ {view.description}
200
+ </p>
201
+ ) : null}
202
+ <div className="mt-3 flex flex-wrap gap-2">
203
+ <AudienceBadge audience={view.audience} />
204
+ {view.dataProgramId ? (
205
+ <Badge variant="outline" className="font-normal">
206
+ {t("views.dataProgram")}
207
+ </Badge>
208
+ ) : null}
209
+ </div>
210
+ </div>
211
+ </div>
212
+ </Link>
213
+ ))}
214
+ </div>
215
+ </section>
216
+ ))}
217
+ </div>
218
+ ) : (
219
+ <SetupEmptyState
220
+ title={t("views.emptyTitle")}
221
+ description={t("views.emptyDescription")}
222
+ />
223
+ )}
224
+ </>
225
+ );
226
+ }
227
+
228
+ function AudienceBadge({ audience }: { audience: "personal" | "shared" }) {
229
+ const t = useT();
230
+ return (
231
+ <Badge variant="secondary" className="gap-1 font-normal">
232
+ {audience === "shared" ? (
233
+ <IconUsers className="size-3.5" />
234
+ ) : (
235
+ <IconLock className="size-3.5" />
236
+ )}
237
+ {t(`views.audience.${audience}`)}
238
+ </Badge>
239
+ );
240
+ }
241
+
242
+ function MissingSurface({ kind }: { kind: "view" | "list" }) {
243
+ const t = useT();
244
+ return (
245
+ <>
246
+ <PageHeader
247
+ eyebrow={t("views.eyebrow")}
248
+ title={t(`views.missing.${kind}Title`)}
249
+ description={t(`views.missing.${kind}Description`)}
250
+ actions={<BackToViews />}
251
+ />
252
+ </>
253
+ );
254
+ }
255
+
256
+ function BackToViews() {
257
+ const t = useT();
258
+ return (
259
+ <Button asChild variant="outline" size="sm" className="gap-1.5">
260
+ <Link to="/views">
261
+ <IconArrowLeft className="size-4" />
262
+ {t("views.backToViews")}
263
+ </Link>
264
+ </Button>
265
+ );
266
+ }
267
+
268
+ // ---------------------------------------------------------------------------
269
+ // One saved view
270
+ // ---------------------------------------------------------------------------
271
+
272
+ function SavedViewSurface({
273
+ view,
274
+ onSaved,
275
+ }: {
276
+ view: SavedViewShape;
277
+ onSaved: () => void;
278
+ }) {
279
+ const t = useT();
280
+ const navigate = useNavigate();
281
+ const [params, setParams] = useSearchParams();
282
+ const [resolvedGroupId, setResolvedGroupId] = useState<string | null>(null);
283
+ const [statusAttributes, setStatusAttributes] = useState<
284
+ Array<{ id: string; label: string }>
285
+ >([]);
286
+ const save = useActionMutation<{ id: string }, Record<string, unknown>>(
287
+ "save-crm-saved-view" as never,
288
+ );
289
+
290
+ const onGrouping = useCallback(
291
+ (state: {
292
+ statusAttributes: Array<{ id: string; label: string }>;
293
+ groupAttributeId: string | null;
294
+ }) => {
295
+ setStatusAttributes(state.statusAttributes);
296
+ setResolvedGroupId(state.groupAttributeId);
297
+ },
298
+ [],
299
+ );
300
+
301
+ let draft: BoardDraft;
302
+ try {
303
+ draft = readBoardDraft(params);
304
+ } catch (error) {
305
+ return (
306
+ <>
307
+ <PageHeader
308
+ eyebrow={t("views.eyebrow")}
309
+ title={view.name}
310
+ description={
311
+ error instanceof Error ? error.message : t("views.draftUnreadable")
312
+ }
313
+ actions={
314
+ <Button
315
+ size="sm"
316
+ variant="outline"
317
+ onClick={() =>
318
+ setParams(clearBoardDraft(params), { replace: true })
319
+ }
320
+ >
321
+ {t("views.resetToSaved")}
322
+ </Button>
323
+ }
324
+ />
325
+ </>
326
+ );
327
+ }
328
+
329
+ const effective = effectiveView(view, draft);
330
+ const dirty = draftIsDirty(view, draft);
331
+ // A board view must persist an explicit grouping, so a mode switch carries
332
+ // whatever the board actually grouped by.
333
+ const saveDraft: BoardDraft = {
334
+ ...draft,
335
+ ...(effective.viewKind === "board"
336
+ ? {
337
+ groupByAttributeId:
338
+ draft.groupByAttributeId ??
339
+ view.groupByAttributeId ??
340
+ resolvedGroupId ??
341
+ undefined,
342
+ }
343
+ : {}),
344
+ };
345
+
346
+ function updateDraft(next: BoardDraft) {
347
+ setParams(writeBoardDraft(params, { ...draft, ...next }), {
348
+ replace: true,
349
+ });
350
+ }
351
+
352
+ async function commitFork(branch: "update" | "new", name?: string) {
353
+ const mutation = buildSaveFork(branch, {
354
+ view,
355
+ draft: saveDraft,
356
+ ...(name === undefined ? {} : { name }),
357
+ });
358
+ if (!mutation) return;
359
+ try {
360
+ const saved = await save.mutateAsync(mutation.input);
361
+ onSaved();
362
+ toast.success(t("views.savedToast"));
363
+ if (branch === "new") {
364
+ navigate(`/views?view=${encodeURIComponent(saved.id)}`);
365
+ } else {
366
+ setParams(clearBoardDraft(params), { replace: true });
367
+ }
368
+ } catch (error) {
369
+ toast.error(
370
+ error instanceof Error ? error.message : t("views.saveFailedToast"),
371
+ );
372
+ }
373
+ }
374
+
375
+ return (
376
+ <>
377
+ <PageHeader
378
+ eyebrow={t("views.eyebrow")}
379
+ title={view.name}
380
+ {...(view.description ? { description: view.description } : {})}
381
+ actions={
382
+ <div className="flex flex-wrap items-center gap-2">
383
+ <AudienceBadge audience={view.audience} />
384
+ <ModeToggle
385
+ mode={effective.viewKind}
386
+ onChange={(mode) => updateDraft({ mode })}
387
+ />
388
+ <BackToViews />
389
+ </div>
390
+ }
391
+ />
392
+ {effective.viewKind === "board" && statusAttributes.length > 1 ? (
393
+ <div className="flex items-center gap-2 border-b border-border/70 px-5 py-2 sm:px-7">
394
+ <span className="text-xs text-muted-foreground">
395
+ {t("views.groupBy")}
396
+ </span>
397
+ <Select
398
+ value={saveDraft.groupByAttributeId ?? ""}
399
+ onValueChange={(next) => updateDraft({ groupByAttributeId: next })}
400
+ >
401
+ <SelectTrigger className="h-8 w-56">
402
+ <SelectValue />
403
+ </SelectTrigger>
404
+ <SelectContent>
405
+ {statusAttributes.map((attribute) => (
406
+ <SelectItem key={attribute.id} value={attribute.id}>
407
+ {attribute.label}
408
+ </SelectItem>
409
+ ))}
410
+ </SelectContent>
411
+ </Select>
412
+ </div>
413
+ ) : null}
414
+ {dirty ? (
415
+ <SaveFork
416
+ audience={view.audience}
417
+ isSaving={save.isPending}
418
+ onUpdate={() => void commitFork("update")}
419
+ onSaveAsNew={(name) => void commitFork("new", name)}
420
+ onDiscard={() =>
421
+ setParams(clearBoardDraft(params), { replace: true })
422
+ }
423
+ />
424
+ ) : null}
425
+ <CrmBoard
426
+ target={boardTargetFor(view)}
427
+ {...(effective.groupByAttributeId
428
+ ? { groupByAttributeId: effective.groupByAttributeId }
429
+ : {})}
430
+ filter={effective.filter}
431
+ mode={effective.viewKind}
432
+ columnAttributeIds={(view.columns ?? []).flatMap((column) =>
433
+ typeof column === "string"
434
+ ? [column]
435
+ : typeof (column as { attributeId?: unknown }).attributeId ===
436
+ "string"
437
+ ? [(column as { attributeId: string }).attributeId]
438
+ : [],
439
+ )}
440
+ onGrouping={onGrouping}
441
+ />
442
+ </>
443
+ );
444
+ }
445
+
446
+ function ModeToggle({
447
+ mode,
448
+ onChange,
449
+ }: {
450
+ mode: "table" | "board";
451
+ onChange: (mode: "table" | "board") => void;
452
+ }) {
453
+ const t = useT();
454
+ return (
455
+ <div className="flex items-center gap-1 rounded-md border border-border/70 p-0.5">
456
+ <Button
457
+ size="sm"
458
+ variant={mode === "table" ? "secondary" : "ghost"}
459
+ className="h-7 gap-1.5"
460
+ onClick={() => onChange("table")}
461
+ >
462
+ <IconTable className="size-4" />
463
+ {t("views.table")}
464
+ </Button>
465
+ <Button
466
+ size="sm"
467
+ variant={mode === "board" ? "secondary" : "ghost"}
468
+ className="h-7 gap-1.5"
469
+ onClick={() => onChange("board")}
470
+ >
471
+ <IconLayoutKanban className="size-4" />
472
+ {t("views.board")}
473
+ </Button>
474
+ </div>
475
+ );
476
+ }
477
+
478
+ function SaveFork({
479
+ audience,
480
+ isSaving,
481
+ onUpdate,
482
+ onSaveAsNew,
483
+ onDiscard,
484
+ }: {
485
+ audience: "personal" | "shared";
486
+ isSaving: boolean;
487
+ onUpdate: () => void;
488
+ onSaveAsNew: (name: string) => void;
489
+ onDiscard: () => void;
490
+ }) {
491
+ const t = useT();
492
+ const [open, setOpen] = useState(false);
493
+ const [name, setName] = useState("");
494
+
495
+ return (
496
+ <div className="flex flex-wrap items-center gap-2 border-b border-border/70 bg-muted/40 px-5 py-2.5 sm:px-7">
497
+ <span className="mr-auto text-sm text-muted-foreground">
498
+ {t("views.unsavedChanges")}
499
+ </span>
500
+ <Button size="sm" disabled={isSaving} onClick={onUpdate}>
501
+ {audience === "shared" ? t("views.saveForEveryone") : t("views.save")}
502
+ </Button>
503
+ <Dialog open={open} onOpenChange={setOpen}>
504
+ <DialogTrigger asChild>
505
+ <Button size="sm" variant="outline" className="gap-1.5">
506
+ <IconPlus className="size-4" />
507
+ {t("views.saveAsNew")}
508
+ </Button>
509
+ </DialogTrigger>
510
+ <DialogContent className="sm:max-w-md">
511
+ <DialogHeader>
512
+ <DialogTitle>{t("views.saveAsNewTitle")}</DialogTitle>
513
+ <DialogDescription>
514
+ {t("views.saveAsNewDescription")}
515
+ </DialogDescription>
516
+ </DialogHeader>
517
+ <div className="grid gap-2 py-2">
518
+ <Label htmlFor="new-view-name">{t("views.nameLabel")}</Label>
519
+ <Input
520
+ id="new-view-name"
521
+ value={name}
522
+ maxLength={120}
523
+ onChange={(event) => setName(event.target.value)}
524
+ />
525
+ </div>
526
+ <DialogFooter>
527
+ <Button
528
+ disabled={!name.trim() || isSaving}
529
+ onClick={() => {
530
+ setOpen(false);
531
+ onSaveAsNew(name.trim());
532
+ }}
533
+ >
534
+ {t("views.createView")}
535
+ </Button>
536
+ </DialogFooter>
537
+ </DialogContent>
538
+ </Dialog>
539
+ <Button size="sm" variant="ghost" onClick={onDiscard}>
540
+ {t("views.discard")}
541
+ </Button>
542
+ </div>
543
+ );
544
+ }
545
+
546
+ // ---------------------------------------------------------------------------
547
+ // A list with no default view yet
548
+ // ---------------------------------------------------------------------------
549
+
550
+ function AdHocListSurface({ listId, name }: { listId: string; name: string }) {
551
+ const t = useT();
552
+ const [params, setParams] = useSearchParams();
553
+ const mode = params.get("mode") === "table" ? "table" : "board";
554
+
555
+ return (
556
+ <>
557
+ <PageHeader
558
+ eyebrow={t("views.eyebrow")}
559
+ title={name}
560
+ description={t("views.listNoDefaultView")}
561
+ actions={
562
+ <div className="flex flex-wrap items-center gap-2">
563
+ <ModeToggle
564
+ mode={mode}
565
+ onChange={(next) => {
566
+ const updated = new URLSearchParams(params);
567
+ updated.set("mode", next);
568
+ setParams(updated, { replace: true });
569
+ }}
570
+ />
571
+ <Button asChild variant="outline" size="sm" className="gap-1.5">
572
+ <Link to="/lists">
573
+ <IconBookmark className="size-4" />
574
+ {t("views.allLists")}
575
+ </Link>
576
+ </Button>
577
+ </div>
578
+ }
579
+ />
580
+ <CrmBoard target={{ kind: "list", id: listId }} mode={mode} />
581
+ </>
582
+ );
583
+ }
584
+
585
+ // ---------------------------------------------------------------------------
586
+ // Create
587
+ // ---------------------------------------------------------------------------
588
+
589
+ function CreateSavedViewDialog() {
590
+ const t = useT();
591
+ const navigate = useNavigate();
592
+ const [open, setOpen] = useState(false);
593
+ const [name, setName] = useState("");
594
+ const [description, setDescription] = useState("");
595
+ const [kind, setKind] = useState("account");
596
+ const save = useActionMutation<{ id: string }, Record<string, unknown>>(
597
+ "save-crm-saved-view" as never,
598
+ );
599
+
600
+ async function createView() {
601
+ try {
602
+ const saved = await save.mutateAsync({
603
+ name: name.trim(),
604
+ ...(description.trim() ? { description: description.trim() } : {}),
605
+ kind,
606
+ viewKind: "table",
607
+ targetKind: "object",
608
+ targetId: OBJECT_TYPE_BY_KIND[kind] ?? "accounts",
609
+ audience: "personal",
610
+ });
611
+ setOpen(false);
612
+ navigate(`/views?view=${encodeURIComponent(saved.id)}`);
613
+ } catch (error) {
614
+ toast.error(
615
+ error instanceof Error ? error.message : t("views.saveFailedToast"),
616
+ );
617
+ }
618
+ }
619
+
620
+ return (
621
+ <Dialog open={open} onOpenChange={setOpen}>
622
+ <DialogTrigger asChild>
623
+ <Button size="sm" className="gap-2">
624
+ <IconPlus className="size-4" />
625
+ {t("views.newView")}
626
+ </Button>
627
+ </DialogTrigger>
628
+ <DialogContent className="sm:max-w-lg">
629
+ <DialogHeader>
630
+ <DialogTitle>{t("views.createTitle")}</DialogTitle>
631
+ <DialogDescription>{t("views.createDescription")}</DialogDescription>
632
+ </DialogHeader>
633
+ <div className="grid gap-4 py-2">
634
+ <div className="grid gap-2">
635
+ <Label htmlFor="view-name">{t("views.nameLabel")}</Label>
636
+ <Input
637
+ id="view-name"
638
+ value={name}
639
+ maxLength={120}
640
+ onChange={(event) => setName(event.target.value)}
641
+ />
642
+ </div>
643
+ <div className="grid gap-2">
644
+ <Label htmlFor="view-description">
645
+ {t("views.descriptionLabel")}
646
+ </Label>
647
+ <Input
648
+ id="view-description"
649
+ value={description}
650
+ maxLength={500}
651
+ onChange={(event) => setDescription(event.target.value)}
652
+ />
653
+ </div>
654
+ <div className="grid gap-2">
655
+ <Label htmlFor="view-kind">{t("views.recordTypeLabel")}</Label>
656
+ <Select value={kind} onValueChange={setKind}>
657
+ <SelectTrigger id="view-kind">
658
+ <SelectValue />
659
+ </SelectTrigger>
660
+ <SelectContent>
661
+ <SelectItem value="account">
662
+ {t("navigation.accounts")}
663
+ </SelectItem>
664
+ <SelectItem value="person">{t("navigation.people")}</SelectItem>
665
+ <SelectItem value="opportunity">
666
+ {t("navigation.opportunities")}
667
+ </SelectItem>
668
+ </SelectContent>
669
+ </Select>
670
+ </div>
671
+ </div>
672
+ <DialogFooter>
673
+ <Button
674
+ disabled={!name.trim() || save.isPending}
675
+ onClick={() => void createView()}
676
+ >
677
+ {t("views.createView")}
678
+ </Button>
679
+ </DialogFooter>
680
+ </DialogContent>
681
+ </Dialog>
682
+ );
683
+ }
@@ -0,0 +1,19 @@
1
+ import { type RouteConfig, index, route } from "@react-router/dev/routes";
2
+
3
+ export default [
4
+ index("./routes/_index.tsx"),
5
+ route("accounts", "./routes/accounts.tsx"),
6
+ route("people", "./routes/people.tsx"),
7
+ route("opportunities", "./routes/opportunities.tsx"),
8
+ route("lists", "./routes/lists.tsx"),
9
+ route("records", "./routes/records.tsx"),
10
+ route("records/:recordId", "./routes/records.$recordId.tsx"),
11
+ route("tasks", "./routes/tasks.tsx"),
12
+ route("proposals", "./routes/proposals.tsx"),
13
+ route("views", "./routes/views.tsx"),
14
+ route("dashboard", "./routes/dashboard.tsx"),
15
+ route("ask", "./routes/ask.tsx"),
16
+ route("setup", "./routes/setup.tsx"),
17
+ route("settings/*", "./routes/settings.tsx"),
18
+ route("agent", "./routes/agent.tsx"),
19
+ ] satisfies RouteConfig;
@@ -0,0 +1,6 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "react-dom/server.browser" {
4
+ export * from "react-dom/server";
5
+ export { default } from "react-dom/server";
6
+ }