Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(import): add connector import and sidebar setup cards (#7976)

Jacob Beckermanf3ef5d4c97c5
diff --git a/.sqlx/query-69bb9bd03a7ca993e20eaf2df1334b7b508016c2f9fb75f933fd8048d9e9da52.json b/.sqlx/query-69bb9bd03a7ca993e20eaf2df1334b7b508016c2f9fb75f933fd8048d9e9da52.json
new file mode 100644
index 0000000000..a89221c586
--- /dev/null
+++ b/.sqlx/query-69bb9bd03a7ca993e20eaf2df1334b7b508016c2f9fb75f933fd8048d9e9da52.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO user_dismissed_prompt (user_id, prompt_id)\n VALUES ($1, $2)\n ON CONFLICT (user_id, prompt_id) DO NOTHING\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "69bb9bd03a7ca993e20eaf2df1334b7b508016c2f9fb75f933fd8048d9e9da52"
+}
diff --git a/.sqlx/query-c4c8195f8b69fbbfedeffe718953a107e56214b42387e5e1de40de3a5520db09.json b/.sqlx/query-c4c8195f8b69fbbfedeffe718953a107e56214b42387e5e1de40de3a5520db09.json
new file mode 100644
index 0000000000..5e0416b8c0
--- /dev/null
+++ b/.sqlx/query-c4c8195f8b69fbbfedeffe718953a107e56214b42387e5e1de40de3a5520db09.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n DELETE FROM user_dismissed_prompt\n WHERE user_id = $1\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "c4c8195f8b69fbbfedeffe718953a107e56214b42387e5e1de40de3a5520db09"
+}
diff --git a/.sqlx/query-e21945cccea90543a1f076d295ddc8d2a8e9bd20bd5871b4cfdba429cfc2dddd.json b/.sqlx/query-e21945cccea90543a1f076d295ddc8d2a8e9bd20bd5871b4cfdba429cfc2dddd.json
new file mode 100644
index 0000000000..4f93100d81
--- /dev/null
+++ b/.sqlx/query-e21945cccea90543a1f076d295ddc8d2a8e9bd20bd5871b4cfdba429cfc2dddd.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT prompt_id\n FROM user_dismissed_prompt\n WHERE user_id = $1\n ORDER BY dismissed_at, prompt_id\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "prompt_id",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "e21945cccea90543a1f076d295ddc8d2a8e9bd20bd5871b4cfdba429cfc2dddd"
+}
diff --git a/apps/web/src/components/app/AppProviders.tsx b/apps/web/src/components/app/AppProviders.tsx
index bb2a904f73..c48619bdb9 100644
--- a/apps/web/src/components/app/AppProviders.tsx
+++ b/apps/web/src/components/app/AppProviders.tsx
@@ -24,6 +24,7 @@ import {
} from '@notifications';
import { maybeHandlePlatformNotification } from '@notifications/notification-platform';
import { useChatRenameWebsocketSync } from '@queries/chat';
+import { useWarmPromptDismissals } from '@queries/prompt-dismissals';
import { useQuerySync } from '@queries/sync/use-query-sync';
import { MutationUndoProvider } from '@queries/undo';
import {
@@ -100,6 +101,7 @@ export function AppProviders(props: ParentProps) {
useQuerySync(userId);
useSoupBackfills(userId);
useCalendarCache(() => userId() !== undefined);
+ useWarmPromptDismissals(userId);
useGlobalAttachableHistory();
return (
diff --git a/apps/web/src/components/icon/import/airtable.svg b/apps/web/src/components/icon/import/airtable.svg
new file mode 100644
index 0000000000..8101805827
--- /dev/null
+++ b/apps/web/src/components/icon/import/airtable.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 215"><path fill="#FFBF00" d="M114.259 2.701L18.86 42.176c-5.305 2.195-5.25 9.73.089 11.847l95.797 37.989a35.54 35.54 0 0 0 26.208 0l95.799-37.99c5.337-2.115 5.393-9.65.086-11.846L141.442 2.7a35.55 35.55 0 0 0-27.183 0"/><path fill="#26B5F8" d="M136.35 112.757v94.902c0 4.514 4.55 7.605 8.746 5.942l106.748-41.435a6.39 6.39 0 0 0 4.035-5.941V71.322c0-4.514-4.551-7.604-8.747-5.941l-106.748 41.434a6.39 6.39 0 0 0-4.035 5.942"/><path fill="#ED3049" d="m111.423 117.654l-31.68 15.296l-3.217 1.555L9.65 166.548C5.411 168.593 0 165.504 0 160.795V71.72c0-1.704.874-3.175 2.046-4.283a7.3 7.3 0 0 1 1.618-1.213c1.598-.959 3.878-1.215 5.816-.448l101.41 40.18c5.155 2.045 5.56 9.268.533 11.697"/><path fill-opacity=".25" d="m111.423 117.654l-31.68 15.296L2.045 67.438a7.3 7.3 0 0 1 1.618-1.213c1.598-.959 3.878-1.215 5.816-.448l101.41 40.18c5.155 2.045 5.56 9.268.533 11.697"/></svg>
diff --git a/apps/web/src/components/icon/import/asana.svg b/apps/web/src/components/icon/import/asana.svg
new file mode 100644
index 0000000000..812e311bca
--- /dev/null
+++ b/apps/web/src/components/icon/import/asana.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 237"><path fill="#F06A6A" d="M200.325 125.27c-30.749 0-55.675 24.927-55.675 55.677s24.926 55.677 55.675 55.677S256 211.696 256 180.947c0-30.75-24.926-55.677-55.675-55.677m-144.65.005C24.927 125.275 0 150.197 0 180.947s24.927 55.677 55.675 55.677c30.75 0 55.678-24.928 55.678-55.677c0-30.75-24.928-55.672-55.678-55.672m128-69.6c0 30.75-24.927 55.68-55.674 55.68c-30.75 0-55.676-24.93-55.676-55.68C72.325 24.928 97.25 0 128 0c30.747 0 55.673 24.93 55.673 55.674"/></svg>
diff --git a/apps/web/src/components/icon/import/box.svg b/apps/web/src/components/icon/import/box.svg
new file mode 100644
index 0000000000..159ecf3b63
--- /dev/null
+++ b/apps/web/src/components/icon/import/box.svg
@@ -0,0 +1 @@
+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#0061D5" d="M.959 5.523c-.54 0-.959.42-.959.899v7.549a4.59 4.59 0 004.613 4.494 4.717 4.717 0 004.135-2.457c.779 1.438 2.337 2.457 4.074 2.457 2.577 0 4.674-2.037 4.674-4.613.06-2.457-2.037-4.495-4.613-4.495-1.738 0-3.295.959-4.074 2.397-.78-1.438-2.338-2.397-4.135-2.397-1.079 0-2.038.36-2.817.899V6.422a.92.92 0 00-.898-.899zM17.602 9.26a.95.95 0 00-.704.158c-.36.3-.479.899-.18 1.318l2.397 3.116-2.396 3.115c-.3.42-.24.96.18 1.26.419.3 1.016.298 1.316-.122l2.039-2.636 2.096 2.697c.3.36.899.419 1.318.12.36-.3.42-.84.121-1.259l-2.338-3.115 2.338-3.057c.3-.419.298-1.018-.121-1.318-.48-.3-1.019-.24-1.318.18l-2.096 2.576-2.04-2.695c-.149-.18-.373-.3-.612-.338zM4.613 11.154c1.558 0 2.817 1.26 2.817 2.758 0 1.558-1.259 2.756-2.817 2.756-1.558 0-2.816-1.198-2.816-2.756 0-1.498 1.258-2.758 2.816-2.758zm8.27 0c1.558 0 2.816 1.26 2.816 2.758-.06 1.558-1.318 2.756-2.816 2.756-1.558 0-2.817-1.198-2.817-2.756 0-1.498 1.259-2.758 2.817-2.758Z"/></svg>
diff --git a/apps/web/src/components/icon/import/close.svg b/apps/web/src/components/icon/import/close.svg
new file mode 100644
index 0000000000..f51ca881ed
--- /dev/null
+++ b/apps/web/src/components/icon/import/close.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path fill="#49BC82" d="M194.21 167.138a254 254 0 0 0 1.263-10.796a286 286 0 0 1-12.101 13.716q5.636-1.33 10.838-2.92M62.567 90.053a247 247 0 0 0-1.306 10.705a272 272 0 0 1 11.938-13.62a176 176 0 0 0-10.632 2.915m134.05 28.778a172 172 0 0 0 5.623-9.789a253 253 0 0 0-6.84-8.632a271 271 0 0 1 1.217 18.42M54.646 147.619q3.135 4.202 6.548 8.383A286 286 0 0 1 60.08 138.1a177 177 0 0 0-5.434 9.52m112.021 46.91c-1.576 5.02-3.315 9.735-5.207 14.097c-3.004 6.928-6.378 12.972-10.02 18.039c-6.914 9.62-14.794 15.68-22.984 17.27c-8.626-1.857-16.634-7.954-23.53-17.488c-6.782 2.546-13.407 4.353-19.788 5.36c2.06 2.852 4.239 5.497 6.549 7.889c9.93 10.279 18.6 16.138 36.663 16.138s28.292-6.633 38.543-18.168a74 74 0 0 0 4.446-5.55c3.807-5.218 7.195-11.18 10.153-17.787c3.285-7.342 6.042-15.473 8.272-24.234c-7.293 1.845-15.02 3.324-23.097 4.434m-.151-175.103C156.19 7.628 146.2.83 128.35.83s-24.2 5.023-33.67 13.926c-3.231 3.038-6.245 6.542-9.05 10.439c-3.655 5.079-6.942 10.845-9.847 17.204c-3.453 7.557-6.365 15.943-8.714 24.997c7.234-1.888 14.89-3.416 22.892-4.57c1.615-5.235 3.41-10.145 5.372-14.674c2.918-6.74 6.194-12.647 9.732-17.645c6.988-9.876 15.007-16.165 23.39-17.989c8.312 1.543 16.305 7.736 23.292 17.606c6.534-2.476 12.923-4.238 19.1-5.237a78 78 0 0 0-4.332-5.46m.418 43.301q-5.175-.718-10.528-1.231a271 271 0 0 1 13.413 11.766a176 176 0 0 0-2.885-10.535M89.848 194.37c3.594.52 7.253.97 10.977 1.34A286 286 0 0 1 86.9 183.434a173 173 0 0 0 2.949 10.936m143.066-15.982a74 74 0 0 0-.75-6.873c-.982-6.389-2.789-13.008-5.362-19.782c-2.896-7.622-6.755-15.436-11.453-23.325c-3.844 6.466-8.257 12.983-13.178 19.484c2.507 4.79 4.663 9.473 6.445 14.009c2.764 7.03 4.642 13.698 5.63 19.856c1.86 11.595.56 21.37-4.078 28.243c-7.343 4.742-17.198 6.116-28.676 4.329c-2.958 6.607-6.346 12.569-10.153 17.786c3.343.523 6.627.832 9.831.888c14.29.247 24.565-1.741 37.337-14.513s15.315-24.697 14.407-40.102M78.33 24.337c-15.644-1.041-27.514 1.215-40.137 13.838c-12.622 12.622-13.56 20.662-13.96 33.654c-.138 4.494.217 9.169 1.012 13.975c1.021 6.17 2.786 12.565 5.236 19.106c2.874 7.673 6.688 15.545 11.348 23.49c3.788-6.445 8.128-12.935 12.974-19.402c-2.483-4.714-4.636-9.332-6.415-13.806c-2.713-6.823-4.585-13.31-5.637-19.346c-2.095-12.022-.886-22.22 3.782-29.482c7.034-4.831 17.185-6.084 29.252-3.965c2.905-6.359 6.192-12.125 9.847-17.204a78 78 0 0 0-7.302-.858m117.072 76.073a247 247 0 0 0-1.244-10.215c-1.16-8.087-2.704-15.823-4.613-23.127c-2.29-8.764-5.107-16.903-8.435-24.26c-6.025 1.018-12.527 2.873-19.373 5.571c1.893 4.439 3.628 9.242 5.198 14.348a176 176 0 0 1 2.885 10.535c.898 3.727 1.707 7.59 2.422 11.578c1.366 7.602 2.38 15.66 3 24.098a264 264 0 0 1 .71 19.288c0 6.678-.257 13.157-.722 19.435c5.6-6.463 10.652-12.912 15.103-19.27a199 199 0 0 0 6.285-9.56a271 271 0 0 0-1.216-18.421M89.848 194.37a173 173 0 0 1-2.95-10.936c-.847-3.6-1.62-7.318-2.297-11.169c-1.362-7.738-2.356-15.976-2.96-24.622a278 278 0 0 1-.68-19.417c0-6.667.255-13.129.714-19.385c-5.615 6.484-10.665 12.978-15.136 19.397a202 202 0 0 0-6.459 9.862c.19 6.098.564 12.073 1.114 17.902c.349 3.693.763 7.331 1.255 10.896c1.104 7.99 2.572 15.637 4.395 22.86c2.243 8.882 5.03 17.117 8.354 24.547c6.17-1.025 12.821-2.917 19.827-5.696c-1.893-4.403-3.623-9.161-5.177-14.24M109.133 54.6a255 255 0 0 0-8.786 6.957a271 271 0 0 1 18.813-1.232a176 176 0 0 0-10.027-5.724M46.3 210.426c-4.83-7.033-6.084-17.185-3.963-29.252c-6.36-2.904-12.127-6.192-17.205-9.847c-.403 2.471-.7 4.91-.859 7.302c-1.04 15.644 1.216 27.515 13.838 40.136s20.662 13.56 33.655 13.96c4.306.133 8.777-.19 13.372-.916c-3.721-5.151-7.038-11.015-9.94-17.503c-11.767 1.954-21.753.711-28.898-3.88m62.65-8.279c-4.756 2.508-9.414 4.673-13.925 6.463c2.94 6.835 6.265 12.813 9.901 17.838c7.606-2.854 15.407-6.634 23.28-11.243c-6.392-3.819-12.83-8.189-19.256-13.058m38.762.048a246 246 0 0 0 8.227-6.43c-5.705.537-11.551.905-17.515 1.099a172 172 0 0 0 9.288 5.331m-52.687 6.415c-7.006 2.78-13.658 4.67-19.827 5.696c2.902 6.488 6.219 12.352 9.94 17.503c6.38-1.008 13.006-2.815 19.788-5.36c-3.636-5.026-6.962-11.004-9.901-17.839m123.4-170.16c-12.771-12.771-24.695-15.314-40.1-14.407a74 74 0 0 0-7.476.845c-6.178.999-12.567 2.761-19.1 5.237c-7.692 2.916-15.578 6.813-23.539 11.564c6.52 3.814 13.087 8.193 19.632 13.09c4.749-2.485 9.395-4.626 13.894-6.399c6.846-2.698 13.348-4.553 19.373-5.57c11.85-2 21.84-.735 28.827 3.98c4.743 7.343 6.116 17.198 4.329 28.676c6.607 2.959 12.569 6.345 17.788 10.154c.523-3.344.831-6.629.886-9.833c.248-14.29-1.74-24.564-14.513-37.336m-9.863 57.048c-1.755 4.394-3.869 8.92-6.322 13.545a172 172 0 0 1-5.623 9.789a199 199 0 0 1-6.285 9.56c-4.451 6.358-9.503 12.807-15.103 19.27a277 277 0 0 1-13.527 14.53a264 264 0 0 1-14.122 13.126c8.61-.602 16.815-1.592 24.526-2.945a199 199 0 0 0 11.266-2.314a285 285 0 0 0 12.101-13.716a255 255 0 0 0 6.698-8.45c4.921-6.501 9.334-13.018 13.178-19.484c4.603-7.74 8.386-15.406 11.252-22.892c-5.065-3.64-11.11-7.015-18.039-10.019M84.68 84.732a201 201 0 0 0-11.48 2.406a272 272 0 0 0-11.94 13.62a245 245 0 0 0-6.458 8.24c-4.846 6.467-9.186 12.957-12.974 19.401c-4.67 7.944-8.5 15.818-11.384 23.492c4.999 3.538 10.904 6.814 17.645 9.733c1.819-4.536 4.018-9.221 6.557-14.005a177 177 0 0 1 5.434-9.52a202 202 0 0 1 6.46-9.86c4.47-6.42 9.52-12.914 15.135-19.398a262.5 262.5 0 0 1 27.2-27.124c-8.473.621-16.565 1.641-24.195 3.015m152.922 5.331a74 74 0 0 0-5.55-4.444c-5.218-3.809-11.18-7.195-17.787-10.154c-7.477-3.347-15.773-6.146-24.721-8.397c1.91 7.304 3.452 15.04 4.613 23.127c5.135 1.6 9.954 3.372 14.405 5.302c6.928 3.004 12.974 6.378 18.039 10.019c9.62 6.915 15.68 14.795 17.27 22.985c-1.83 8.502-7.772 16.404-17.069 23.232c2.573 6.774 4.38 13.393 5.362 19.782c2.692-1.97 5.194-4.048 7.468-6.245c10.28-9.929 16.139-18.6 16.139-36.663s-6.634-28.292-18.17-38.544M62.449 166.898c-5.116-1.59-9.921-3.352-14.36-5.274c-6.74-2.919-12.646-6.195-17.645-9.733c-9.875-6.989-16.166-15.007-17.99-23.39c1.565-8.43 7.908-16.533 18.026-23.59c-2.45-6.542-4.215-12.937-5.236-19.107a78 78 0 0 0-5.88 4.638C7.564 100.767.766 110.757.766 128.607s5.022 24.198 13.926 33.67c3.038 3.23 6.542 6.245 10.439 9.049c5.078 3.655 10.845 6.943 17.205 9.847c7.419 3.39 15.64 6.259 24.507 8.585c-1.823-7.223-3.291-14.87-4.395-22.86m66.09-100.422a202 202 0 0 0-9.38-6.15c-6.414.199-12.695.613-18.812 1.23q-5.281.534-10.385 1.27c-8.001 1.154-15.658 2.682-22.892 4.57c-8.787 2.293-16.947 5.115-24.32 8.45c1.052 6.035 2.924 12.523 5.637 19.346c4.392-1.87 9.137-3.586 14.18-5.139a177 177 0 0 1 10.632-2.915c3.698-.89 7.528-1.695 11.481-2.406c7.63-1.374 15.722-2.394 24.196-3.015c6.233-.458 12.663-.71 19.286-.71c6.877 0 13.541.273 19.993.765c-6.556-5.681-13.125-10.786-19.615-15.296m80.077 95.425c-4.45 1.917-9.265 3.667-14.406 5.237a172 172 0 0 1-10.838 2.92a200 200 0 0 1-11.266 2.314c-7.711 1.353-15.915 2.343-24.526 2.945c-6.265.438-12.737.679-19.418.679a266 266 0 0 1-18.828-.67c6.39 5.534 12.766 10.53 19.054 14.94a199 199 0 0 0 10.036 6.597a286 286 0 0 0 17.515-1.1a255 255 0 0 0 10.728-1.234c8.076-1.11 15.804-2.589 23.097-4.434c8.858-2.24 17.07-5.022 24.482-8.338c-.988-6.158-2.866-12.826-5.63-19.856m-60.904 40.293a172 172 0 0 1-9.288-5.331a199 199 0 0 1-10.036-6.596c-6.288-4.411-12.664-9.407-19.054-14.942a278 278 0 0 1-14.568-13.56a264 264 0 0 1-13.126-14.122c.605 8.646 1.599 16.884 2.96 24.622a199 199 0 0 0 2.299 11.17a286 286 0 0 0 13.926 12.275a254 254 0 0 0 8.125 6.436c6.425 4.87 12.864 9.24 19.256 13.058c7.857 4.695 15.64 8.552 23.234 11.46c3.642-5.066 7.016-11.11 10.02-18.038c-4.458-1.781-9.053-3.933-13.748-6.432m24.53-117.354a201 201 0 0 0-2.423-11.578a271 271 0 0 0-13.413-11.766a246 246 0 0 0-8.564-6.718c-6.545-4.897-13.112-9.276-19.632-13.09c-7.826-4.576-15.582-8.338-23.144-11.181c-3.538 4.998-6.814 10.905-9.732 17.645c4.47 1.793 9.086 3.957 13.799 6.449a176 176 0 0 1 10.027 5.724c3.1 1.908 6.23 3.964 9.38 6.151c6.49 4.51 13.059 9.615 19.615 15.296a263 263 0 0 1 27.085 27.167c-.62-8.439-1.633-16.497-2.999-24.1"/><path fill="#49BC82" d="M194.21 167.138a254 254 0 0 0 1.263-10.796a286 286 0 0 1-12.101 13.716q5.636-1.33 10.838-2.92M62.567 90.053a247 247 0 0 0-1.306 10.705a272 272 0 0 1 11.938-13.62a176 176 0 0 0-10.632 2.915"/><path fill="#57B6DF" d="M196.617 118.83a172 172 0 0 0 5.623-9.788a253 253 0 0 0-6.84-8.632a271 271 0 0 1 1.217 18.42M54.646 147.62q3.135 4.202 6.548 8.382A286 286 0 0 1 60.08 138.1a177 177 0 0 0-5.434 9.52"/><path fill="#49BC82" d="M166.667 194.53c-1.576 5.019-3.315 9.734-5.207 14.096c-3.004 6.928-6.378 12.972-10.02 18.039c-6.914 9.62-14.794 15.68-22.984 17.27c-8.626-1.857-16.634-7.954-23.53-17.488c-6.782 2.546-13.407 4.353-19.788 5.36c2.06 2.852 4.239 5.497 6.549 7.889c9.93 10.279 18.6 16.138 36.663 16.138s28.292-6.633 38.543-18.168a74 74 0 0 0 4.446-5.55c3.807-5.218 7.195-11.18 10.153-17.787c3.285-7.342 6.042-15.473 8.272-24.234c-7.293 1.845-15.02 3.324-23.097 4.434m-.151-175.103C156.19 7.628 146.2.83 128.35.83s-24.2 5.023-33.67 13.926c-3.231 3.038-6.245 6.542-9.05 10.439c-3.655 5.079-6.942 10.845-9.847 17.204c-3.453 7.557-6.365 15.943-8.714 24.997c7.234-1.888 14.89-3.416 22.892-4.57c1.615-5.235 3.41-10.145 5.372-14.674c2.918-6.74 6.194-12.647 9.732-17.645c6.988-9.876 15.007-16.165 23.39-17.989c8.312 1.543 16.305 7.736 23.292 17.606c6.534-2.476 12.923-4.238 19.1-5.237a78 78 0 0 0-4.332-5.46"/><path fill="#276392" d="M166.934 62.727q-5.175-.718-10.528-1.231a271 271 0 0 1 13.413 11.766a176 176 0 0 0-2.885-10.535M89.848 194.37c3.594.52 7.253.97 10.977 1.34A286 286 0 0 1 86.9 183.434a173 173 0 0 0 2.949 10.936"/><path fill="#57B6DF" d="M232.914 178.388a74 74 0 0 0-.75-6.873c-.982-6.389-2.789-13.008-5.362-19.782c-2.896-7.622-6.755-15.436-11.453-23.325c-3.844 6.466-8.257 12.983-13.178 19.484c2.507 4.79 4.663 9.473 6.445 14.009c2.764 7.03 4.642 13.698 5.63 19.856c1.86 11.595.56 21.37-4.078 28.243c-7.343 4.742-17.198 6.116-28.676 4.329c-2.958 6.607-6.346 12.569-10.153 17.786c3.343.523 6.627.832 9.831.888c14.29.247 24.565-1.741 37.337-14.513s15.315-24.697 14.407-40.102M78.329 24.337c-15.644-1.041-27.514 1.215-40.137 13.838c-12.622 12.622-13.56 20.662-13.96 33.654c-.138 4.494.217 9.169 1.012 13.975c1.021 6.17 2.786 12.565 5.236 19.106c2.874 7.673 6.688 15.545 11.348 23.49c3.788-6.445 8.128-12.935 12.974-19.402c-2.483-4.714-4.636-9.332-6.415-13.806c-2.713-6.823-4.585-13.31-5.637-19.346c-2.095-12.022-.886-22.22 3.782-29.482c7.034-4.831 17.185-6.084 29.252-3.965c2.905-6.359 6.192-12.125 9.847-17.204a78 78 0 0 0-7.302-.858"/><path fill="#49BC82" d="M195.4 100.41c-.349-3.46-.763-6.868-1.243-10.215c-1.16-8.087-2.704-15.823-4.613-23.127c-2.29-8.764-5.107-16.903-8.435-24.26c-6.025 1.018-12.527 2.873-19.373 5.571c1.893 4.439 3.628 9.242 5.198 14.348a176 176 0 0 1 2.885 10.535c.898 3.727 1.707 7.59 2.422 11.578c1.366 7.602 2.38 15.66 3 24.098a264 264 0 0 1 .71 19.288c0 6.678-.257 13.157-.722 19.435c5.6-6.463 10.652-12.912 15.103-19.27a199 199 0 0 0 6.285-9.56a271 271 0 0 0-1.216-18.421M89.848 194.37a173 173 0 0 1-2.95-10.936c-.847-3.6-1.62-7.318-2.297-11.169c-1.362-7.738-2.356-15.976-2.96-24.622a278 278 0 0 1-.68-19.417c0-6.667.255-13.129.714-19.385c-5.615 6.484-10.665 12.978-15.136 19.397a202 202 0 0 0-6.459 9.862c.19 6.098.564 12.073 1.114 17.902c.349 3.693.763 7.331 1.255 10.896c1.104 7.99 2.572 15.637 4.395 22.86c2.243 8.882 5.03 17.117 8.354 24.547c6.17-1.025 12.821-2.917 19.827-5.696c-1.893-4.403-3.623-9.161-5.177-14.24"/><path fill="#FABB66" d="M109.133 54.6a255 255 0 0 0-8.786 6.957a271 271 0 0 1 18.813-1.232a176 176 0 0 0-10.027-5.724M46.3 210.425c-4.83-7.033-6.084-17.185-3.963-29.252c-6.36-2.904-12.127-6.192-17.205-9.847c-.403 2.471-.7 4.91-.859 7.302c-1.04 15.644 1.216 27.515 13.838 40.136s20.662 13.56 33.655 13.96c4.306.133 8.777-.19 13.372-.916c-3.721-5.151-7.038-11.015-9.94-17.503c-11.767 1.954-21.753.711-28.898-3.88m62.65-8.279c-4.756 2.508-9.414 4.673-13.925 6.463c2.94 6.835 6.265 12.813 9.901 17.838c7.606-2.854 15.407-6.634 23.28-11.243c-6.392-3.819-12.83-8.189-19.256-13.058m38.762.048a246 246 0 0 0 8.227-6.43c-5.705.537-11.551.905-17.515 1.099a172 172 0 0 0 9.288 5.331"/><path fill="#FABB66" d="M95.025 208.61c-7.006 2.778-13.658 4.67-19.827 5.695c2.902 6.488 6.219 12.352 9.94 17.503c6.38-1.008 13.006-2.815 19.788-5.36c-3.636-5.026-6.962-11.004-9.901-17.839M218.426 38.45c-12.772-12.772-24.696-15.315-40.102-14.408a74 74 0 0 0-7.475.845c-6.178.999-12.567 2.761-19.1 5.237c-7.692 2.916-15.578 6.813-23.539 11.564c6.52 3.814 13.087 8.193 19.632 13.09c4.749-2.485 9.395-4.626 13.894-6.399c6.846-2.698 13.348-4.553 19.373-5.57c11.85-2 21.84-.735 28.827 3.98c4.743 7.343 6.116 17.198 4.329 28.676c6.607 2.959 12.569 6.345 17.788 10.154c.523-3.344.831-6.629.886-9.833c.248-14.29-1.74-24.564-14.513-37.336m-9.864 57.047c-1.755 4.394-3.869 8.92-6.322 13.545a172 172 0 0 1-5.623 9.789a199 199 0 0 1-6.285 9.56c-4.451 6.358-9.503 12.807-15.103 19.27a277 277 0 0 1-13.527 14.53a264 264 0 0 1-14.122 13.126c8.61-.602 16.815-1.592 24.526-2.945a199 199 0 0 0 11.266-2.314a285 285 0 0 0 12.101-13.716a255 255 0 0 0 6.698-8.45c4.921-6.501 9.334-13.018 13.178-19.484c4.603-7.74 8.386-15.406 11.252-22.892c-5.065-3.64-11.11-7.015-18.039-10.019M84.68 84.732a201 201 0 0 0-11.48 2.406a272 272 0 0 0-11.94 13.62a245 245 0 0 0-6.458 8.24c-4.846 6.467-9.186 12.957-12.974 19.401c-4.67 7.944-8.5 15.818-11.384 23.492c4.999 3.538 10.904 6.814 17.645 9.733c1.819-4.536 4.018-9.221 6.557-14.005a177 177 0 0 1 5.434-9.52a202 202 0 0 1 6.46-9.86c4.47-6.42 9.52-12.914 15.135-19.398a262.5 262.5 0 0 1 27.2-27.124c-8.473.621-16.565 1.641-24.195 3.015"/><path fill="#276392" d="M237.602 90.063a74 74 0 0 0-5.55-4.444c-5.218-3.809-11.18-7.195-17.787-10.154c-7.477-3.347-15.773-6.146-24.721-8.397c1.91 7.304 3.452 15.04 4.613 23.127c5.135 1.6 9.954 3.372 14.405 5.302c6.928 3.004 12.974 6.378 18.039 10.019c9.62 6.915 15.68 14.795 17.27 22.985c-1.83 8.502-7.772 16.404-17.069 23.232c2.573 6.774 4.38 13.393 5.362 19.782c2.692-1.97 5.194-4.048 7.468-6.245c10.28-9.929 16.139-18.6 16.139-36.663s-6.634-28.292-18.17-38.544M62.45 166.898c-5.117-1.59-9.922-3.352-14.36-5.274c-6.742-2.919-12.647-6.195-17.646-9.733c-9.875-6.989-16.166-15.007-17.99-23.39c1.565-8.43 7.908-16.533 18.026-23.59c-2.45-6.542-4.215-12.937-5.236-19.107a78 78 0 0 0-5.88 4.638C7.564 100.767.766 110.757.766 128.607s5.022 24.198 13.926 33.67c3.038 3.23 6.542 6.245 10.439 9.049c5.078 3.655 10.845 6.943 17.205 9.847c7.419 3.39 15.64 6.259 24.507 8.585c-1.823-7.223-3.291-14.87-4.395-22.86M128.54 66.476a202 202 0 0 0-9.38-6.15c-6.415.199-12.696.613-18.813 1.23q-5.281.534-10.385 1.27c-8.001 1.154-15.658 2.682-22.892 4.57c-8.787 2.293-16.947 5.115-24.32 8.45c1.052 6.035 2.924 12.523 5.637 19.346c4.392-1.87 9.137-3.586 14.18-5.139a177 177 0 0 1 10.632-2.915c3.698-.89 7.528-1.695 11.481-2.406c7.63-1.374 15.722-2.394 24.196-3.015c6.233-.458 12.663-.71 19.286-.71c6.877 0 13.541.273 19.993.765c-6.556-5.681-13.125-10.786-19.615-15.296m80.076 95.424c-4.45 1.918-9.265 3.668-14.406 5.238a172 172 0 0 1-10.838 2.92a200 200 0 0 1-11.266 2.314c-7.711 1.353-15.915 2.343-24.526 2.945c-6.265.438-12.737.679-19.418.679a266 266 0 0 1-18.828-.67c6.39 5.534 12.766 10.53 19.054 14.94a199 199 0 0 0 10.036 6.597a286 286 0 0 0 17.515-1.1a255 255 0 0 0 10.728-1.234c8.076-1.11 15.804-2.589 23.097-4.434c8.858-2.24 17.07-5.022 24.482-8.338c-.988-6.158-2.866-12.826-5.63-19.856"/><path fill="#57B6DF" d="M147.712 202.194a172 172 0 0 1-9.288-5.331a199 199 0 0 1-10.036-6.596c-6.288-4.411-12.664-9.407-19.054-14.942a278 278 0 0 1-14.568-13.56a264 264 0 0 1-13.126-14.122c.605 8.646 1.599 16.884 2.96 24.622a199 199 0 0 0 2.299 11.17a286 286 0 0 0 13.926 12.275a254 254 0 0 0 8.125 6.436c6.425 4.87 12.864 9.24 19.256 13.058c7.857 4.695 15.64 8.552 23.234 11.46c3.642-5.066 7.016-11.11 10.02-18.038c-4.458-1.781-9.053-3.933-13.748-6.432M172.241 84.84a201 201 0 0 0-2.422-11.578a271 271 0 0 0-13.413-11.766a246 246 0 0 0-8.564-6.718c-6.545-4.897-13.112-9.276-19.632-13.09c-7.826-4.576-15.582-8.338-23.144-11.181c-3.538 4.998-6.814 10.905-9.732 17.645c4.47 1.793 9.086 3.957 13.799 6.449a176 176 0 0 1 10.027 5.724c3.1 1.908 6.23 3.964 9.38 6.151c6.49 4.51 13.059 9.615 19.615 15.296a263 263 0 0 1 27.085 27.167c-.62-8.439-1.633-16.497-2.999-24.1"/></svg>
diff --git a/apps/web/src/components/icon/import/confluence.svg b/apps/web/src/components/icon/import/confluence.svg
new file mode 100644
index 0000000000..7194fbf758
--- /dev/null
+++ b/apps/web/src/components/icon/import/confluence.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 246"><path fill="#2684FF" d="M9.26 187.33c-2.64 4.307-5.607 9.305-8.126 13.287a8.127 8.127 0 0 0 2.722 11.052l52.823 32.507a8.127 8.127 0 0 0 11.256-2.763c2.113-3.536 4.835-8.127 7.801-13.044c20.926-34.538 41.974-30.312 79.925-12.19l52.376 24.908a8.127 8.127 0 0 0 10.93-4.063l25.152-56.886a8.127 8.127 0 0 0-4.063-10.646c-11.052-5.201-33.034-15.562-52.823-25.111c-71.189-34.579-131.691-32.344-177.972 42.949"/><path fill="#2684FF" d="M246.115 58.232c2.641-4.307 5.607-9.305 8.127-13.287a8.127 8.127 0 0 0-2.723-11.052L198.696 1.386a8.127 8.127 0 0 0-11.58 2.682c-2.113 3.535-4.835 8.127-7.802 13.043c-20.926 34.538-41.974 30.313-79.925 12.19L47.176 4.515a8.127 8.127 0 0 0-10.93 4.063L11.093 65.465a8.127 8.127 0 0 0 4.063 10.645c11.052 5.202 33.035 15.563 52.823 25.112c71.351 34.538 131.854 32.222 178.135-42.99"/></svg>
diff --git a/apps/web/src/components/icon/import/dropbox.svg b/apps/web/src/components/icon/import/dropbox.svg
new file mode 100644
index 0000000000..e124827dc9
--- /dev/null
+++ b/apps/web/src/components/icon/import/dropbox.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 218"><path fill="#0061FF" d="M63.995 0L0 40.771l63.995 40.772L128 40.771zM192 0l-64 40.775l64 40.775l64.001-40.775zM0 122.321l63.995 40.772L128 122.321L63.995 81.55zM192 81.55l-64 40.775l64 40.774l64-40.774zM64 176.771l64.005 40.772L192 176.771L128.005 136z"/></svg>
diff --git a/apps/web/src/components/icon/import/google-calendar.svg b/apps/web/src/components/icon/import/google-calendar.svg
new file mode 100644
index 0000000000..cefbfe54b9
--- /dev/null
+++ b/apps/web/src/components/icon/import/google-calendar.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path fill="#FFF" d="M195.368 60.632H60.632v134.736h134.736z"/><path fill="#EA4335" d="M195.368 256L256 195.368l-30.316-5.172l-30.316 5.172l-5.533 27.73z"/><path fill="#188038" d="M0 195.368v40.421C0 246.956 9.044 256 20.21 256h40.422l6.225-30.316l-6.225-30.316l-33.033-5.172z"/><path fill="#1967D2" d="M256 60.632V20.21C256 9.044 246.956 0 235.79 0h-40.422q-5.532 22.554-5.533 33.196q0 10.641 5.533 27.436q20.115 5.76 30.316 5.76T256 60.631"/><path fill="#FBBC04" d="M256 60.632h-60.632v134.736H256z"/><path fill="#34A853" d="M195.368 195.368H60.632V256h134.736z"/><path fill="#4285F4" d="M195.368 0H20.211C9.044 0 0 9.044 0 20.21v175.158h60.632V60.632h134.736z"/><path fill="#4285F4" d="M88.27 165.154c-5.036-3.402-8.523-8.37-10.426-14.94l11.689-4.816q1.59 6.063 5.558 9.398c2.627 2.223 5.827 3.318 9.566 3.318q5.734 0 9.852-3.487c2.746-2.324 4.127-5.288 4.127-8.875q0-5.508-4.345-8.994c-2.897-2.324-6.535-3.486-10.88-3.486h-6.754v-11.57h6.063q5.608 0 9.448-3.033c2.56-2.02 3.84-4.783 3.84-8.303c0-3.132-1.145-5.625-3.435-7.494c-2.29-1.87-5.188-2.813-8.708-2.813c-3.436 0-6.164.91-8.185 2.745a16.1 16.1 0 0 0-4.413 6.754l-11.57-4.817c1.532-4.345 4.345-8.185 8.471-11.503s9.398-4.985 15.798-4.985c4.733 0 8.994.91 12.767 2.745c3.772 1.836 6.736 4.379 8.875 7.613c2.14 3.25 3.2 6.888 3.2 10.93c0 4.126-.993 7.613-2.98 10.476s-4.43 5.052-7.327 6.585v.69a22.25 22.25 0 0 1 9.398 7.327c2.442 3.284 3.672 7.208 3.672 11.79c0 4.58-1.163 8.673-3.487 12.26c-2.324 3.588-5.54 6.417-9.617 8.472c-4.092 2.055-8.69 3.1-13.793 3.1c-5.912.016-11.369-1.685-16.405-5.087m71.797-58.005l-12.833 9.28l-6.417-9.734l23.023-16.607h8.825v78.333h-12.598z"/></svg>
diff --git a/apps/web/src/components/icon/import/google-drive.svg b/apps/web/src/components/icon/import/google-drive.svg
new file mode 100644
index 0000000000..98eb827497
--- /dev/null
+++ b/apps/web/src/components/icon/import/google-drive.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 229"><path fill="#0066DA" d="m19.354 196.034l11.29 19.5c2.346 4.106 5.718 7.332 9.677 9.678q17.009-21.591 23.68-33.137q6.77-11.717 16.641-36.655q-26.604-3.502-40.32-3.502q-13.165 0-40.322 3.502c0 4.545 1.173 9.09 3.519 13.196z"/><path fill="#EA4335" d="M215.681 225.212c3.96-2.346 7.332-5.572 9.677-9.677l4.692-8.064l22.434-38.855a26.57 26.57 0 0 0 3.518-13.196q-27.315-3.502-40.247-3.502q-13.899 0-40.248 3.502q9.754 25.075 16.422 36.655q6.724 11.683 23.752 33.137"/><path fill="#00832D" d="M128.001 73.311q19.68-23.768 27.125-36.655q5.996-10.377 13.196-33.137C164.363 1.173 159.818 0 155.126 0h-54.25C96.184 0 91.64 1.32 87.68 3.519q9.16 26.103 15.544 37.154q7.056 12.213 24.777 32.638"/><path fill="#2684FC" d="M175.36 155.42H80.642l-40.32 69.792c3.958 2.346 8.503 3.519 13.195 3.519h148.968c4.692 0 9.238-1.32 13.196-3.52z"/><path fill="#00AC47" d="M128.001 73.311L87.681 3.52c-3.96 2.346-7.332 5.571-9.678 9.677L3.519 142.224A26.57 26.57 0 0 0 0 155.42h80.642z"/><path fill="#FFBA00" d="m215.242 77.71l-37.243-64.514c-2.345-4.106-5.718-7.331-9.677-9.677l-40.32 69.792l47.358 82.109h80.496c0-4.546-1.173-9.09-3.519-13.196z"/></svg>
diff --git a/apps/web/src/components/icon/import/hubspot.svg b/apps/web/src/components/icon/import/hubspot.svg
new file mode 100644
index 0000000000..dea63ad7f7
--- /dev/null
+++ b/apps/web/src/components/icon/import/hubspot.svg
@@ -0,0 +1 @@
+<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FF7A59" d="M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"/></svg>
diff --git a/apps/web/src/components/icon/import/jira.svg b/apps/web/src/components/icon/import/jira.svg
new file mode 100644
index 0000000000..d7da1bc847
--- /dev/null
+++ b/apps/web/src/components/icon/import/jira.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path fill="#2684FF" d="M244.658 0H121.707a55.5 55.5 0 0 0 55.502 55.502h22.649V77.37c.02 30.625 24.841 55.447 55.466 55.467V10.666C255.324 4.777 250.55 0 244.658 0"/><path fill="#2684FF" d="M183.822 61.262H60.872c.019 30.625 24.84 55.447 55.466 55.467h22.649v21.938c.039 30.625 24.877 55.43 55.502 55.43V71.93c0-5.891-4.776-10.667-10.667-10.667"/><path fill="#2684FF" d="M122.951 122.489H0c0 30.653 24.85 55.502 55.502 55.502h22.72v21.867c.02 30.597 24.798 55.408 55.396 55.466V133.156c0-5.891-4.776-10.667-10.667-10.667"/></svg>
diff --git a/apps/web/src/components/icon/import/monday.svg b/apps/web/src/components/icon/import/monday.svg
new file mode 100644
index 0000000000..6489b5cde5
--- /dev/null
+++ b/apps/web/src/components/icon/import/monday.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 156"><path fill="#F62B54" d="M31.846 153.489a31.97 31.97 0 0 1-27.86-16.167a30.91 30.91 0 0 1 .875-31.823l57.373-90.096A31.99 31.99 0 0 1 90.556.015a31.93 31.93 0 0 1 27.41 16.896c5.349 10.113 4.68 22.28-1.725 31.774L58.904 138.78a31.98 31.98 0 0 1-27.058 14.709"/><path fill="#FC0" d="M130.256 153.488c-11.572 0-22.22-6.187-27.812-16.13a30.81 30.81 0 0 1 .875-31.737l57.264-89.89A31.94 31.94 0 0 1 188.93.016c11.669.255 22.244 6.782 27.592 16.993a30.81 30.81 0 0 1-2.066 31.92l-57.252 89.889a31.93 31.93 0 0 1-26.948 14.671"/><ellipse cx="226.466" cy="125.324" fill="#00CA72" rx="29.538" ry="28.918"/></svg>
diff --git a/apps/web/src/components/icon/import/notion.svg b/apps/web/src/components/icon/import/notion.svg
new file mode 100644
index 0000000000..c1bc172724
--- /dev/null
+++ b/apps/web/src/components/icon/import/notion.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 268"><path fill="#FFF" d="M16.092 11.538L164.09.608c18.179-1.56 22.85-.508 34.28 7.801l47.243 33.282C253.406 47.414 256 48.975 256 55.207v182.527c0 11.439-4.155 18.205-18.696 19.24L65.44 267.378c-10.913.517-16.11-1.043-21.825-8.327L8.826 213.814C2.586 205.487 0 199.254 0 191.97V29.726c0-9.352 4.155-17.153 16.092-18.188"/><path d="M164.09.608L16.092 11.538C4.155 12.573 0 20.374 0 29.726v162.245c0 7.284 2.585 13.516 8.826 21.843l34.789 45.237c5.715 7.284 10.912 8.844 21.825 8.327l171.864-10.404c14.532-1.035 18.696-7.801 18.696-19.24V55.207c0-5.911-2.336-7.614-9.21-12.66l-1.185-.856L198.37 8.409C186.94.1 182.27-.952 164.09.608M69.327 52.22c-14.033.945-17.216 1.159-25.186-5.323L23.876 30.778c-2.06-2.086-1.026-4.69 4.163-5.207l142.274-10.395c11.947-1.043 18.17 3.12 22.842 6.758l24.401 17.68c1.043.525 3.638 3.637.517 3.637L71.146 52.095zm-16.36 183.954V81.222c0-6.767 2.077-9.887 8.3-10.413L230.02 60.93c5.724-.517 8.31 3.12 8.31 9.879v153.917c0 6.767-1.044 12.49-10.387 13.008l-161.487 9.361c-9.343.517-13.489-2.594-13.489-10.921M212.377 89.53c1.034 4.681 0 9.362-4.681 9.897l-7.783 1.542v114.404c-6.758 3.637-12.981 5.715-18.18 5.715c-8.308 0-10.386-2.604-16.609-10.396l-50.898-80.079v77.476l16.1 3.646s0 9.362-12.989 9.362l-35.814 2.077c-1.043-2.086 0-7.284 3.63-8.318l9.351-2.595V109.823l-12.98-1.052c-1.044-4.68 1.55-11.439 8.826-11.965l38.426-2.585l52.958 81.113v-71.76l-13.498-1.552c-1.043-5.733 3.111-9.896 8.3-10.404z"/></svg>
diff --git a/apps/web/src/components/icon/import/onedrive.svg b/apps/web/src/components/icon/import/onedrive.svg
new file mode 100644
index 0000000000..de6af5fa55
--- /dev/null
+++ b/apps/web/src/components/icon/import/onedrive.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 165"><path fill="#0364B8" d="m154.66 110.682l52.842-50.534c-10.976-42.8-54.57-68.597-97.37-57.62a80 80 0 0 0-46.952 33.51c.817-.02 91.48 74.644 91.48 74.644"/><path fill="#0078D4" d="m97.618 45.552l-.002.009a63.7 63.7 0 0 0-33.619-9.543c-.274 0-.544.017-.818.02C27.852 36.476-.432 65.47.005 100.798a63.97 63.97 0 0 0 11.493 35.798l79.165-9.915l60.694-48.94z"/><path fill="#1490DF" d="M207.502 60.148a53 53 0 0 0-3.51-.131a51.8 51.8 0 0 0-20.61 4.254l-.002-.005l-32.022 13.475l35.302 43.607l63.11 15.341c13.62-25.283 4.164-56.82-21.12-70.44a52 52 0 0 0-21.148-6.1"/><path fill="#28A8EA" d="M11.498 136.596a63.91 63.91 0 0 0 52.5 27.417h139.994a51.99 51.99 0 0 0 45.778-27.323l-98.413-58.95z"/></svg>
diff --git a/apps/web/src/components/icon/import/salesforce.svg b/apps/web/src/components/icon/import/salesforce.svg
new file mode 100644
index 0000000000..e4d28ac2c1
--- /dev/null
+++ b/apps/web/src/components/icon/import/salesforce.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 180"><path fill="#00A1E0" d="M106.553 19.651c8.248-8.594 19.731-13.924 32.43-13.924c16.883 0 31.612 9.414 39.455 23.389a54.5 54.5 0 0 1 22.3-4.74c30.449 0 55.134 24.9 55.134 55.615c0 30.719-24.685 55.62-55.134 55.62a54.7 54.7 0 0 1-10.86-1.083c-6.908 12.321-20.07 20.645-35.178 20.645a40.1 40.1 0 0 1-17.632-4.058c-7.002 16.47-23.316 28.019-42.33 28.019c-19.8 0-36.674-12.529-43.152-30.1c-2.83.602-5.763.915-8.772.915c-23.574 0-42.686-19.308-42.686-43.13a43.2 43.2 0 0 1 21.345-37.36a49.4 49.4 0 0 1-4.088-19.727C17.385 22.336 39.626.128 67.06.128c16.106 0 30.42 7.658 39.494 19.523"/><path fill="#FFF" d="M37.17 92.956c-.16.419.058.506.11.58c.48.349.968.6 1.46.88c2.609 1.385 5.071 1.79 7.647 1.79c5.246 0 8.503-2.79 8.503-7.283v-.087c0-4.153-3.676-5.662-7.126-6.75l-.448-.147c-2.601-.845-4.845-1.573-4.845-3.286v-.09c0-1.465 1.311-2.544 3.344-2.544c2.259 0 4.94.75 6.667 1.705c0 0 .506.328.692-.164c.102-.262.976-2.615 1.068-2.87c.098-.277-.077-.481-.255-.59c-1.971-1.2-4.696-2.019-7.516-2.019l-.525.004c-4.801 0-8.153 2.9-8.153 7.057v.087c0 4.383 3.698 5.803 7.162 6.794l.558.172c2.524.775 4.7 1.442 4.7 3.22v.087c0 1.625-1.414 2.835-3.695 2.835c-.885 0-3.708-.018-6.758-1.946c-.368-.215-.583-.371-.867-.542c-.15-.095-.524-.26-.688.236zm76.8 0c-.16.419.058.506.11.58c.48.349.968.6 1.46.88c2.608 1.385 5.071 1.79 7.647 1.79c5.246 0 8.503-2.79 8.503-7.283v-.087c0-4.153-3.676-5.662-7.126-6.75l-.448-.147c-2.601-.845-4.846-1.573-4.846-3.286v-.09c0-1.465 1.312-2.544 3.345-2.544c2.259 0 4.94.75 6.667 1.705c0 0 .506.328.692-.164c.102-.262.976-2.615 1.067-2.87c.099-.277-.076-.481-.255-.59c-1.97-1.2-4.696-2.019-7.515-2.019l-.525.004c-4.802 0-8.153 2.9-8.153 7.057v.087c0 4.383 3.697 5.803 7.162 6.794l.557.172c2.525.775 4.704 1.442 4.704 3.22v.087c0 1.625-1.418 2.835-3.698 2.835a12.4 12.4 0 0 1-6.758-1.946c-.368-.215-.587-.364-.863-.542c-.095-.062-.54-.234-.693.236zm52.429-8.799c0 2.54-.474 4.54-1.406 5.953c-.922 1.4-2.317 2.08-4.263 2.08c-1.949 0-3.337-.677-4.244-2.08c-.918-1.41-1.384-3.413-1.384-5.953c0-2.535.466-4.532 1.384-5.93c.907-1.385 2.295-2.059 4.244-2.059c1.946 0 3.34.674 4.266 2.058c.93 1.4 1.403 3.396 1.403 5.931m4.379-4.707c-.43-1.453-1.1-2.735-1.993-3.803c-.893-1.071-2.022-1.93-3.363-2.557c-1.337-.623-2.918-.94-4.692-.94c-1.778 0-3.359.317-4.696.94c-1.34.626-2.47 1.486-3.366 2.557c-.889 1.071-1.56 2.354-1.993 3.803c-.426 1.447-.64 3.028-.64 4.707c0 1.68.214 3.265.64 4.707c.434 1.45 1.1 2.732 1.997 3.804a9.4 9.4 0 0 0 3.362 2.535c1.34.609 2.918.918 4.696.918c1.774 0 3.352-.31 4.692-.918a9.4 9.4 0 0 0 3.363-2.535c.893-1.068 1.563-2.35 1.993-3.804c.43-1.446.645-3.03.645-4.707c0-1.675-.215-3.26-.645-4.707m35.959 12.063c-.145-.426-.557-.266-.557-.266c-.637.244-1.315.47-2.036.583a16 16 0 0 1-2.401.171c-2.12 0-3.804-.63-5.01-1.876c-1.209-1.246-1.887-3.26-1.88-5.986c.008-2.48.606-4.346 1.68-5.767c1.068-1.413 2.692-2.138 4.86-2.138c1.807 0 3.184.207 4.627.663c0 0 .346.15.51-.303c.382-1.063.667-1.825 1.075-2.994c.116-.332-.168-.474-.27-.514c-.568-.222-1.909-.583-2.922-.736c-.947-.145-2.054-.222-3.286-.222c-1.84 0-3.479.313-4.882.94c-1.399.623-2.586 1.483-3.526 2.554s-1.654 2.353-2.131 3.803c-.474 1.446-.714 3.035-.714 4.714c0 3.632.98 6.569 2.914 8.718c1.938 2.157 4.85 3.253 8.645 3.253c2.244 0 4.547-.455 6.2-1.107c0 0 .318-.153.18-.521zm7.663-9.788c.207-1.41.597-2.583 1.198-3.497c.907-1.388 2.291-2.15 4.237-2.15c1.945 0 3.231.765 4.153 2.15c.612.914.878 2.138.983 3.497zm14.743-3.1c-.372-1.403-1.294-2.82-1.898-3.468c-.955-1.028-1.887-1.746-2.813-2.146a10.8 10.8 0 0 0-4.248-.86c-1.85 0-3.53.31-4.892.95c-1.366.642-2.514 1.516-3.414 2.606c-.9 1.085-1.577 2.379-2.007 3.847c-.434 1.46-.652 3.053-.652 4.732c0 1.709.226 3.3.674 4.732c.451 1.443 1.173 2.715 2.15 3.767c.972 1.06 2.225 1.891 3.726 2.47c1.49.576 3.3.875 5.38.871c4.281-.015 6.537-.969 7.465-1.483c.164-.09.321-.251.124-.71l-.969-2.714c-.145-.405-.557-.255-.557-.255c-1.06.393-2.568 1.1-6.084 1.093c-2.299-.004-4.004-.682-5.071-1.742c-1.097-1.085-1.632-2.68-1.727-4.932l14.824.014s.39-.007.43-.386c.014-.16.51-3.046-.441-6.386m-133.46 3.1c.211-1.41.597-2.583 1.199-3.497c.907-1.388 2.291-2.15 4.236-2.15c1.946 0 3.232.765 4.157 2.15c.609.914.875 2.138.98 3.497zm14.74-3.1c-.372-1.403-1.29-2.82-1.895-3.468c-.954-1.028-1.887-1.746-2.812-2.146a10.8 10.8 0 0 0-4.248-.86c-1.847 0-3.53.31-4.892.95c-1.367.642-2.514 1.516-3.414 2.606c-.9 1.085-1.577 2.379-2.007 3.847c-.43 1.46-.652 3.053-.652 4.732c0 1.709.225 3.3.674 4.732c.451 1.443 1.173 2.715 2.149 3.767c.973 1.06 2.226 1.891 3.727 2.47c1.49.576 3.3.875 5.38.871c4.281-.015 6.536-.969 7.465-1.483c.164-.09.32-.251.124-.71l-.965-2.714c-.15-.405-.561-.255-.561-.255c-1.06.393-2.565 1.1-6.088 1.093c-2.295-.004-4-.682-5.067-1.742c-1.097-1.085-1.633-2.68-1.727-4.932l14.823.014s.39-.007.43-.386c.015-.16.51-3.046-.444-6.386M63.642 91.431c-.58-.462-.66-.579-.856-.878c-.292-.455-.441-1.104-.441-1.927c0-1.304.43-2.24 1.322-2.87c-.01.003 1.275-1.112 4.3-1.072c2.123.03 4.021.343 4.021.343v6.74h.004s-1.884.404-4.004.531c-3.017.182-4.357-.87-4.346-.867m5.898-10.415c-.601-.044-1.38-.07-2.313-.07c-1.272 0-2.5.16-3.65.47a9.5 9.5 0 0 0-3.097 1.436a7.15 7.15 0 0 0-2.15 2.444c-.524.977-.79 2.128-.79 3.417c0 1.312.225 2.452.677 3.385a6.1 6.1 0 0 0 1.935 2.317c.823.601 1.84 1.042 3.02 1.308c1.162.266 2.48.4 3.923.4c1.52 0 3.035-.123 4.503-.375a94 94 0 0 0 3.734-.721c.492-.117 1.039-.266 1.039-.266c.368-.091.338-.485.338-.485l-.007-13.555c0-2.973-.794-5.177-2.357-6.543c-1.555-1.363-3.847-2.051-6.809-2.051c-1.11 0-2.9.153-3.97.368c0 0-3.24.626-4.573 1.668c0 0-.291.182-.131.59l1.05 2.82c.13.364.484.24.484.24s.113-.043.244-.12c2.852-1.552 6.459-1.504 6.459-1.504c1.603 0 2.834.32 3.665.958c.809.619 1.22 1.555 1.22 3.53v.626c-1.275-.182-2.444-.287-2.444-.287m119.56-7.639a.4.4 0 0 0-.223-.532c-.251-.098-1.512-.364-2.485-.426c-1.861-.113-2.896.2-3.821.616c-.918.415-1.938 1.085-2.507 1.847v-1.804c0-.251-.178-.451-.426-.451h-3.8c-.247 0-.426.2-.426.451v22.11c0 .248.204.452.452.452h3.894a.45.45 0 0 0 .448-.452V84.142c0-1.482.164-2.962.492-3.89c.32-.919.758-1.654 1.297-2.183a4.55 4.55 0 0 1 1.833-1.1c.688-.211 1.45-.28 1.989-.28c.776 0 1.628.2 1.628.2c.284.033.445-.142.54-.4c.254-.678.976-2.708 1.114-3.112"/><path fill="#FFF" d="M152.544 63.13a13 13 0 0 0-1.465-.35a11.6 11.6 0 0 0-2.014-.152c-2.682 0-4.795.757-6.277 2.251c-1.476 1.486-2.478 3.749-2.98 6.725l-.183 1.002h-3.366s-.408-.015-.495.43l-.55 3.086c-.04.291.087.477.48.477h3.276l-3.323 18.55c-.258 1.494-.557 2.722-.889 3.654c-.324.918-.64 1.607-1.034 2.11c-.38.48-.736.838-1.356 1.045c-.51.172-1.1.252-1.745.252c-.357 0-.834-.059-1.187-.131a3.5 3.5 0 0 1-.802-.26s-.382-.145-.535.238c-.12.317-.995 2.717-1.1 3.013c-.102.295.043.524.229.593c.437.153.761.255 1.355.397c.824.194 1.52.204 2.172.204c1.362 0 2.608-.193 3.639-.564c1.035-.375 1.938-1.028 2.74-1.91c.863-.954 1.406-1.952 1.923-3.318c.514-1.348.955-3.024 1.304-4.976l3.341-18.897h4.882s.411.014.495-.434l.554-3.082c.036-.295-.087-.477-.485-.477h-4.74c.026-.106.241-1.774.784-3.344c.233-.667.67-1.21 1.038-1.581a3.1 3.1 0 0 1 1.243-.773c.47-.153 1.005-.226 1.592-.226c.444 0 .885.051 1.216.12c.46.099.638.15.758.186c.485.146.55.004.645-.23l1.133-3.11c.117-.335-.171-.478-.273-.518M86.322 95.19c0 .247-.179.448-.426.448h-3.931c-.248 0-.423-.2-.423-.448V63.553c0-.247.175-.448.423-.448h3.93c.248 0 .427.2.427.448z"/></svg>
diff --git a/apps/web/src/components/icon/import/trello.svg b/apps/web/src/components/icon/import/trello.svg
new file mode 100644
index 0000000000..cd8c4136ac
--- /dev/null
+++ b/apps/web/src/components/icon/import/trello.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="#0079BF" rx="25"/><rect width="78.08" height="112" x="144.64" y="33.28" fill="#FFF" rx="12"/><rect width="78.08" height="176" x="33.28" y="33.28" fill="#FFF" rx="12"/></svg>
diff --git a/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx b/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx
index 35b2acb591..f0a8123371 100644
--- a/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx
+++ b/apps/web/src/features/calendar-view/components/CalendarSidebar.tsx
@@ -43,6 +43,7 @@ import {
CalendarCreateEventItem,
} from './CalendarCreateItems';
import { CalendarCreateMenu } from './CalendarCreateMenu';
+import { ConnectCalendarsPromotion } from './ConnectCalendarsPromotion';
function CalendarMiniCalendar() {
const calendarView = useCalendarView();
@@ -334,6 +335,8 @@ export function CalendarSidebar() {
<CalendarTeamOooSection />
</ShowFeatureFlag>
</ViewSidebar.Content>
+ {/* Outside the scrolling list, so a long list never slides it under Settings. */}
+ <ConnectCalendarsPromotion class="px-(--sidebar-gutter) pt-2" />
<ViewSidebar.Footer class="border-0">
<ViewSidebar.Nav aria-label="Calendar tools">
<CalendarSettingsDropdown sidebar />
diff --git a/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.test.tsx b/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.test.tsx
new file mode 100644
index 0000000000..3a2c120956
--- /dev/null
+++ b/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.test.tsx
@@ -0,0 +1,113 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ConnectCalendarsPromotion } from './ConnectCalendarsPromotion';
+
+const host = vi.hoisted(() => ({
+ accounts: [] as
+ | {
+ linkId: string;
+ emailAddress: string;
+ action: 'enable' | 'reconnect' | 'turnOff';
+ consentScopes: string;
+ }[]
+ | undefined,
+ startAddInbox: vi.fn(),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: true }),
+}));
+vi.mock('@queries/prompt-dismissals', () => ({
+ usePromptDismissalsQuery: () => ({
+ isSuccess: true,
+ isError: false,
+ data: { dismissed: [] },
+ }),
+ dismissPromptEverywhere: vi.fn(),
+}));
+vi.mock('@app/features/calendar/hooks/use-calendar-accounts', () => ({
+ useLoadedCalendarAccounts: () => () => host.accounts,
+}));
+vi.mock('@core/email-link', () => ({
+ useAddInboxFlow: () => host.startAddInbox,
+}));
+
+const account = (
+ emailAddress: string,
+ action: 'enable' | 'reconnect' | 'turnOff'
+) => ({
+ linkId: emailAddress,
+ emailAddress,
+ action,
+ consentScopes: 'calendar',
+});
+
+afterEach(() => {
+ cleanup();
+ host.accounts = [];
+ host.startAddInbox.mockReset();
+ localStorage.clear();
+});
+
+describe('ConnectCalendarsPromotion', () => {
+ it('connects a new Google account with mail and calendar scopes', () => {
+ host.accounts = [account('[email protected]', 'turnOff')];
+ render(() => <ConnectCalendarsPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Connect a calendar' }));
+ expect(host.startAddInbox).toHaveBeenCalledWith({
+ scopes: 'gmail_and_calendar',
+ });
+ });
+
+ it('turns on calendar for a connected account before adding another', () => {
+ host.accounts = [account('[email protected]', 'enable')];
+ render(() => <ConnectCalendarsPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Turn on calendar' }));
+ expect(host.startAddInbox).toHaveBeenCalledWith({
+ scopes: 'calendar',
+ emailAddress: '[email protected]',
+ });
+ });
+
+ it('offers to reconnect an expired calendar grant', () => {
+ host.accounts = [
+ account('[email protected]', 'turnOff'),
+ account('[email protected]', 'reconnect'),
+ ];
+ render(() => <ConnectCalendarsPromotion />);
+ expect(
+ screen.getByRole('button', { name: 'Reconnect calendar' })
+ ).toBeTruthy();
+ });
+
+ it('hides once two accounts have calendar access', () => {
+ host.accounts = [
+ account('[email protected]', 'turnOff'),
+ account('[email protected]', 'turnOff'),
+ ];
+ render(() => <ConnectCalendarsPromotion />);
+ expect(screen.queryByText('Connect more calendars')).toBeNull();
+ });
+
+ it('renders the last known button at once while accounts load', () => {
+ host.accounts = [account('[email protected]', 'enable')];
+ const view = render(() => <ConnectCalendarsPromotion />);
+ expect(
+ screen.getByRole('button', { name: 'Turn on calendar' })
+ ).toBeTruthy();
+ view.unmount();
+ host.accounts = undefined;
+ render(() => <ConnectCalendarsPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Turn on calendar' }));
+ expect(host.startAddInbox).toHaveBeenCalledWith({
+ scopes: 'calendar',
+ emailAddress: '[email protected]',
+ });
+ });
+
+ it('shows nothing while accounts load on a first visit', () => {
+ host.accounts = undefined;
+ render(() => <ConnectCalendarsPromotion />);
+ expect(screen.queryByText('Connect more calendars')).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.tsx b/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.tsx
new file mode 100644
index 0000000000..4b098d1b05
--- /dev/null
+++ b/apps/web/src/features/calendar-view/components/ConnectCalendarsPromotion.tsx
@@ -0,0 +1,120 @@
+import { useLoadedCalendarAccounts } from '@app/features/calendar/hooks/use-calendar-accounts';
+import { CALENDAR_ACCOUNTS_PROMOTION as COPY } from '@app/features/sidebar-promotion/core/promotions';
+import { createLastKnown } from '@app/features/sidebar-promotion/primitives/last-known';
+import {
+ allOf,
+ flagVerdict,
+ SidebarPromotion,
+} from '@app/features/sidebar-promotion/sidebar-promotion';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import {
+ enableMultiInbox,
+ enableSidebarPromotions,
+} from '@core/constant/featureFlags';
+import { useUserId } from '@core/context/user';
+import { useAddInboxFlow } from '@core/email-link';
+import { fireAndForget } from '@core/util/fireAndForget';
+import { untrack } from 'solid-js';
+import { match } from 'ts-pattern';
+import { z } from 'zod';
+
+/** Accounts with calendar access at which the prompt has done its job. */
+const ENOUGH_CALENDAR_ACCOUNTS = 2;
+
+const scopesSchema = z.enum(['gmail', 'gmail_and_calendar', 'calendar']);
+
+/** What the button does, kept so the card renders before the links load. */
+const cardStateSchema = z.object({
+ satisfied: z.boolean(),
+ /** An account already connected without (working) calendar access. */
+ fix: z
+ .object({
+ kind: z.enum(['enable', 'reconnect']),
+ emailAddress: z.string(),
+ scopes: scopesSchema,
+ })
+ .optional(),
+});
+type CardState = z.infer<typeof cardStateSchema>;
+
+/**
+ * The Calendar sidebar's prompt to connect another Google account. Adding
+ * accounts follows the multi-inbox flag, like "Connect another account" in
+ * the calendar settings menu.
+ */
+export function ConnectCalendarsPromotion(props: { class?: string }) {
+ const promotions = useFeatureFlag(enableSidebarPromotions);
+ const multiInbox = useFeatureFlag(enableMultiInbox);
+ const accounts = useLoadedCalendarAccounts();
+ const userId = useUserId();
+ const startAddInbox = useAddInboxFlow();
+ const state = createLastKnown<CardState>(
+ 'calendar-accounts',
+ untrack(userId),
+ () => {
+ const loaded = accounts();
+ if (!loaded) return undefined;
+ // An account needing attention comes first: the same consent the
+ // calendar settings menu runs for it.
+ const attention = loaded.find((account) => account.action !== 'turnOff');
+ const withCalendar = loaded.filter(
+ (account) => account.action === 'turnOff'
+ ).length;
+ return {
+ satisfied: !attention && withCalendar >= ENOUGH_CALENDAR_ACCOUNTS,
+ fix:
+ attention && attention.action !== 'turnOff'
+ ? {
+ kind: attention.action,
+ emailAddress: attention.emailAddress,
+ scopes: attention.consentScopes,
+ }
+ : undefined,
+ };
+ },
+ cardStateSchema
+ );
+ const action = () => {
+ const fix = state()?.fix;
+ if (!fix)
+ return {
+ label: COPY.action,
+ // A brand-new account needs the mailbox scopes alongside calendar.
+ onClick: () =>
+ fireAndForget(
+ startAddInbox({ scopes: 'gmail_and_calendar' }),
+ 'sidebar-promotion.calendar'
+ ),
+ };
+ return {
+ label: match(fix.kind)
+ .with('reconnect', () => COPY.reconnectAction)
+ .with('enable', () => COPY.enableAction)
+ .exhaustive(),
+ onClick: () =>
+ fireAndForget(
+ startAddInbox({
+ scopes: fix.scopes,
+ emailAddress: fix.emailAddress,
+ }),
+ 'sidebar-promotion.calendar'
+ ),
+ };
+ };
+ return (
+ <SidebarPromotion
+ id={COPY.id}
+ applies={allOf(
+ flagVerdict(promotions()),
+ flagVerdict(multiInbox()),
+ state() === undefined ? undefined : !state()?.satisfied
+ )}
+ logos={COPY.logos}
+ headline={COPY.headline}
+ pitch={COPY.pitch}
+ class={props.class}
+ dismissLabel="Dismiss connect more calendars"
+ action={action()}
+ />
+ );
+}
diff --git a/apps/web/src/features/calendar/hooks/use-calendar-accounts.ts b/apps/web/src/features/calendar/hooks/use-calendar-accounts.ts
index 98d1a5afbc..53e5bd288b 100644
--- a/apps/web/src/features/calendar/hooks/use-calendar-accounts.ts
+++ b/apps/web/src/features/calendar/hooks/use-calendar-accounts.ts
@@ -61,3 +61,17 @@ export function useCalendarAccounts() {
)
);
}
+
+/**
+ * {@link useCalendarAccounts} for callers that must not suspend: `undefined`
+ * until the email links have loaded.
+ */
+export function useLoadedCalendarAccounts() {
+ const linksQuery = useEmailLinksQuery();
+ const userId = useUserId();
+ return createMemo<CalendarAccount[] | undefined>(() =>
+ linksQuery.isPending || !linksQuery.data
+ ? undefined
+ : toCalendarAccounts(linksQuery.data.links, userId())
+ );
+}
diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
index 5f65b6580d..68aea71e5c 100644
--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx
@@ -1,11 +1,11 @@
import { SearchBar, ViewSidebar } from '@app/components/view-shell';
import { runCreateAction } from '@app/features/command/Launcher';
+import { SlackImportSidebar } from '@app/features/slack-import/slack-import-sidebar';
import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
import { openNewChannelModal } from '@channel/CreateChannelModal';
import { ChannelMutedIndicator } from '@channel/components/ChannelMutedIndicator';
import { useUserId } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { lazyNamed } from '@core/util/lazyNamed';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
import { type ChannelEntity, Entity } from '@entity';
import CaretDownIcon from '@phosphor/caret-down.svg';
@@ -31,7 +31,6 @@ import {
type JSX,
Match,
Show,
- Suspense,
Switch,
} from 'solid-js';
import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';
@@ -88,10 +87,6 @@ const CHANNEL_TABS = [
{ value: 'browse', label: 'All' },
{ value: 'recents', label: 'Recent' },
];
-const SlackImportSidebar = lazyNamed(
- () => import('@app/features/slack-import/slack-import-sidebar'),
- 'SlackImportSidebar'
-);
const CHANNEL_TABS_WITH_THREADS = [
...CHANNEL_TABS,
{ value: 'threads', label: 'Threads' },
@@ -1108,9 +1103,6 @@ export function ExpandedChannelsRail(props: { search: ChannelRailSearch }) {
return (
<>
<ExpandedHeader search={props.search} />
- <Suspense>
- <SlackImportSidebar />
- </Suspense>
<ChannelsLiveCallsSidebar />
<div class="flex min-h-0 flex-1 flex-col">
<div
@@ -1138,6 +1130,8 @@ export function ExpandedChannelsRail(props: { search: ChannelRailSearch }) {
</Match>
</Switch>
</div>
+ {/* Bottom of the rail, like the Drive, Tasks, and CRM import cards. */}
+ <SlackImportSidebar />
<Show when={!props.search.isOpen() && rail.tab() === 'browse'}>
<footer class="flex h-9 shrink-0 items-center justify-start gap-1 border-t border-edge-muted px-4 text-xxs text-ink-extra-muted">
<span>Use</span>
diff --git a/apps/web/src/features/connector-import/browser-test/import.browser.e2e.ts b/apps/web/src/features/connector-import/browser-test/import.browser.e2e.ts
new file mode 100644
index 0000000000..5c5658c180
--- /dev/null
+++ b/apps/web/src/features/connector-import/browser-test/import.browser.e2e.ts
@@ -0,0 +1,88 @@
+import { expect, test } from '@playwright/test';
+
+const fixture = '/src/features/connector-import/browser-test/import.html';
+
+test.beforeEach(async ({ page }) => {
+ await page.routeWebSocket('**', (socket) => socket.close());
+ await page.route('https://**', (route) => route.abort());
+ await page.route('**/__macro_dev/**', (route) => route.abort());
+ await page.goto(fixture, { waitUntil: 'domcontentloaded' });
+});
+
+test('imports selected Notion pages from the Drive card', async ({ page }) => {
+ const sidebar = page.getByRole('complementary', { name: 'files sidebar' });
+ await expect(
+ sidebar.getByRole('list', { name: /Notion, Google Drive, Dropbox/ })
+ ).toBeVisible();
+ await sidebar
+ .getByRole('button', { name: 'Import files', exact: true })
+ .click();
+ const dialog = page.getByRole('dialog');
+ await dialog.getByRole('button', { name: 'Connect Notion' }).click();
+ await expect(dialog.getByText('Import from Notion')).toBeVisible();
+ // The title is the checkbox's label, so clicking it selects the page.
+ await dialog.getByText('Q4 planning', { exact: true }).click();
+ await expect(
+ dialog.getByRole('checkbox', { name: /^Select Q4 planning/ })
+ ).toBeChecked();
+ await dialog.getByRole('button', { name: 'Import 1' }).click();
+ await expect(
+ dialog.getByRole('link', { name: 'Open imported Q4 planning' })
+ ).toBeVisible();
+ await expect(
+ sidebar.getByRole('button', { name: 'Import files', exact: true })
+ ).toHaveCount(0);
+});
+
+test('hands a connected provider without an importer to the agent', async ({
+ page,
+}) => {
+ const sidebar = page.getByRole('complementary', { name: 'tasks sidebar' });
+ await sidebar
+ .getByRole('button', { name: 'Import tasks', exact: true })
+ .click();
+ const dialog = page.getByRole('dialog');
+ await dialog.getByRole('button', { name: 'Connect Jira' }).click();
+ await dialog.getByRole('button', { name: 'Import from Jira' }).click();
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByRole('status', { name: 'Agent handoff' })).toHaveText(
+ 'Import my most recent issues and tasks from Jira into Macro tasks.'
+ );
+});
+
+test('picks Slack channels or hands history to the archive upload', async ({
+ page,
+}) => {
+ const sidebar = page.getByRole('complementary', { name: 'channels sidebar' });
+ await sidebar
+ .getByRole('button', { name: 'Import from Slack', exact: true })
+ .click();
+ const dialog = page.getByRole('dialog');
+ await dialog.getByRole('button', { name: 'Connect Slack' }).click();
+ await dialog.getByText('#general', { exact: true }).click();
+ await dialog.getByRole('button', { name: 'Import 1' }).click();
+ await expect(
+ dialog.getByRole('link', { name: 'Open imported #general' })
+ ).toBeVisible();
+ await dialog.getByRole('button', { name: 'Back to apps' }).click();
+ await dialog.getByRole('button', { name: /Import with history/ }).click();
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByRole('status', { name: 'Agent handoff' })).toHaveText(
+ 'Slack export upload'
+ );
+});
+
+test('offers local file and folder uploads in the Files dialog', async ({
+ page,
+}) => {
+ const sidebar = page.getByRole('complementary', { name: 'files sidebar' });
+ await sidebar
+ .getByRole('button', { name: 'Import files', exact: true })
+ .click();
+ const dialog = page.getByRole('dialog');
+ await dialog.getByRole('button', { name: /Upload a folder/ }).click();
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByRole('status', { name: 'Agent handoff' })).toHaveText(
+ 'Upload a folder'
+ );
+});
diff --git a/apps/web/src/features/connector-import/browser-test/import.html b/apps/web/src/features/connector-import/browser-test/import.html
new file mode 100644
index 0000000000..10244630dd
--- /dev/null
+++ b/apps/web/src/features/connector-import/browser-test/import.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<html lang="en">
+ <head><meta charset="utf-8" /><title>Connector import</title></head>
+ <body><div id="root"></div><script type="module" src="./import.tsx"></script></body>
+</html>
diff --git a/apps/web/src/features/connector-import/browser-test/import.tsx b/apps/web/src/features/connector-import/browser-test/import.tsx
new file mode 100644
index 0000000000..1d223121f2
--- /dev/null
+++ b/apps/web/src/features/connector-import/browser-test/import.tsx
@@ -0,0 +1,202 @@
+import '@app/index.css';
+import { PromoCard } from '@app/features/sidebar-promotion/components/promo-card';
+import { applyTheme } from '@app/features/theme/utils/themeUtils';
+import FileCsvIcon from '@phosphor/file-csv.svg';
+import FileZipIcon from '@phosphor/file-zip.svg';
+import FolderIcon from '@phosphor/folder.svg';
+import UploadIcon from '@phosphor/upload-simple.svg';
+import type { ImportState } from '@service-cognition/import';
+import { createSignal, For } from 'solid-js';
+import { render } from 'solid-js/web';
+import { ConnectorImportProvider } from '../context/connector-import-context';
+import type { ConnectorImportContext } from '../context/contracts';
+import { IMPORT_CATEGORIES } from '../core/catalog';
+import type { ImportCategory } from '../core/providers';
+import { ConnectorImportDialog } from '../views/import-dialog';
+
+// The real card and dialog over an in-memory pipeline: connecting succeeds
+// at once, Notion discovery stages two pages, and accepted pages import.
+const now = '2026-10-12T00:00:00Z';
+const [connected, setConnected] = createSignal<ReadonlySet<string>>(
+ new Set(['dropbox'])
+);
+const [state, setState] = createSignal<ImportState>({ runs: [], entities: [] });
+const [handoff, setHandoff] = createSignal('');
+
+function page(id: string, title: string, summary: string) {
+ return {
+ id,
+ user_id: 'fixture',
+ source: 'notion' as const,
+ foreign_id: id,
+ status: 'staged' as const,
+ initiator: 'manual' as const,
+ metadata: { title, summary },
+ created_at: now,
+ updated_at: now,
+ };
+}
+
+function channel(id: string, name: string, purpose: string) {
+ return {
+ ...page(id, name, ''),
+ source: 'slack' as const,
+ metadata: { name, purpose, member_count: 12 },
+ };
+}
+
+const context: ConnectorImportContext = {
+ createConnections: () => ({ connected, ready: () => true }),
+ createImportState: () => ({ state, ready: () => true }),
+ connect: async (app) => {
+ setConnected((previous) => new Set([...previous, app.appSlug]));
+ return 'connected';
+ },
+ discover: async (source) => {
+ setState({
+ runs: [
+ { source, status: 'running', auto_import: false, updated_at: now },
+ ],
+ entities: [],
+ });
+ setTimeout(
+ () =>
+ setState({
+ runs: [
+ { source, status: 'ready', auto_import: false, updated_at: now },
+ ],
+ entities:
+ source === 'slack'
+ ? [
+ channel('c1', 'general', 'Company-wide announcements'),
+ channel('c2', 'eng', 'Engineering discussion'),
+ ]
+ : [
+ page('p1', 'Q4 planning', 'Goals and owners for the quarter'),
+ page(
+ 'p2',
+ 'Onboarding guide',
+ 'How new teammates get set up'
+ ),
+ ],
+ }),
+ 400
+ );
+ },
+ runImport: async (ids) => {
+ const flip = (status: 'importing' | 'imported') =>
+ setState((previous) => ({
+ ...previous,
+ entities: previous.entities.map((entity) =>
+ ids.includes(entity.id)
+ ? {
+ ...entity,
+ status,
+ ...(status === 'imported'
+ ? { entity_id: `doc-${entity.id}`, entity_type: 'md' }
+ : {}),
+ }
+ : entity
+ ),
+ }));
+ flip('importing');
+ setTimeout(() => flip('imported'), 400);
+ },
+ startAgentImport: async (value) => {
+ setHandoff(value.input);
+ },
+ entityHref: (entity) => `#${entity.type}/${entity.id}`,
+};
+
+function Sidebar(props: { category: ImportCategory }) {
+ const [open, setOpen] = createSignal(false);
+ const [hidden, setHidden] = createSignal(false);
+ const config = IMPORT_CATEGORIES[props.category];
+ return (
+ <aside
+ class="flex h-[440px] w-64 flex-col bg-panel px-2 py-3"
+ aria-label={`${props.category} sidebar`}
+ >
+ <p class="px-2 text-sm font-semibold text-ink">{config.action}</p>
+ <div class="mt-auto">
+ {hidden() ? null : (
+ <PromoCard
+ logos={config.providers}
+ headline={config.headline}
+ pitch={config.pitch}
+ action={{ label: config.action, onClick: () => setOpen(true) }}
+ dismissLabel={`Dismiss ${config.action.toLowerCase()}`}
+ onDismiss={() => setHidden(true)}
+ />
+ )}
+ </div>
+ <ConnectorImportDialog
+ config={config}
+ open={open()}
+ onOpenChange={setOpen}
+ onImported={() => setHidden(true)}
+ alternatives={(() => {
+ const alternative =
+ props.category === 'crm'
+ ? {
+ icon: FileCsvIcon,
+ label: 'Upload a CSV',
+ description: 'Import companies from a spreadsheet export.',
+ onSelect: () => {},
+ }
+ : props.category === 'channels'
+ ? {
+ icon: FileZipIcon,
+ label: 'Import with history',
+ description:
+ 'Upload a Slack export from a workspace owner or admin.',
+ onSelect: () => setHandoff('Slack export upload'),
+ }
+ : undefined;
+ return alternative
+ ? [alternative]
+ : props.category === 'files'
+ ? [
+ {
+ icon: UploadIcon,
+ label: 'Upload files',
+ description: 'Choose files from this computer.',
+ onSelect: () => setHandoff('Upload files'),
+ },
+ {
+ icon: FolderIcon,
+ label: 'Upload a folder',
+ description: 'Bring over a folder and everything in it.',
+ onSelect: () => setHandoff('Upload a folder'),
+ },
+ ]
+ : undefined;
+ })()}
+ />
+ </aside>
+ );
+}
+
+function Fixture() {
+ return (
+ <ConnectorImportProvider context={context}>
+ <main class="flex min-h-screen gap-6 bg-page p-6">
+ <For each={['files', 'tasks', 'crm', 'channels'] as const}>
+ {(category) => <Sidebar category={category} />}
+ </For>
+ <output aria-label="Agent handoff" class="text-xs text-ink-muted">
+ {handoff()}
+ </output>
+ </main>
+ </ConnectorImportProvider>
+ );
+}
+
+// Apply dark explicitly too: `dark-mode:` styles key off the theme attribute.
+applyTheme(
+ new URLSearchParams(location.search).get('theme') === 'light'
+ ? 'Macro Light'
+ : 'Macro Dark'
+);
+const root = document.getElementById('root');
+if (root) render(() => <Fixture />, root);
diff --git a/apps/web/src/features/connector-import/browser-test/playwright.config.ts b/apps/web/src/features/connector-import/browser-test/playwright.config.ts
new file mode 100644
index 0000000000..d2b95ddc54
--- /dev/null
+++ b/apps/web/src/features/connector-import/browser-test/playwright.config.ts
@@ -0,0 +1,26 @@
+import { fileURLToPath } from 'node:url';
+import { defineConfig } from '@playwright/test';
+
+const webDirectory = fileURLToPath(new URL('../../../../', import.meta.url));
+const port = process.env.CONNECTOR_IMPORT_TEST_PORT ?? '3048';
+export default defineConfig({
+ testDir: fileURLToPath(new URL('.', import.meta.url)),
+ testMatch: '*.browser.e2e.ts',
+ workers: 1,
+ timeout: 60_000,
+ use: {
+ baseURL: `http://localhost:${port}`,
+ headless: true,
+ viewport: { width: 1280, height: 800 },
+ launchOptions: {
+ executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
+ },
+ },
+ webServer: {
+ command: `MACRO_DEV_HTTPS=false bunx vite --port ${port} --strictPort`,
+ cwd: webDirectory,
+ url: `http://localhost:${port}/app/`,
+ reuseExistingServer: false,
+ timeout: 60_000,
+ },
+});
diff --git a/apps/web/src/features/connector-import/components/import-item-list.tsx b/apps/web/src/features/connector-import/components/import-item-list.tsx
new file mode 100644
index 0000000000..e251524917
--- /dev/null
+++ b/apps/web/src/features/connector-import/components/import-item-list.tsx
@@ -0,0 +1,98 @@
+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import SpinnerIcon from '@phosphor/spinner-gap.svg';
+import { Checkbox } from '@ui';
+import { For, type JSX, Match, Show, Switch } from 'solid-js';
+import type { ImportItem } from '../core/import-items';
+
+function ItemText(props: { item: ImportItem }): JSX.Element {
+ return (
+ <>
+ <span class="block truncate font-medium text-ink">
+ {props.item.title}
+ </span>
+ <Show when={props.item.detail}>
+ <span class="block truncate text-xs text-ink-muted">
+ {props.item.detail}
+ </span>
+ </Show>
+ <Show when={props.item.status === 'staged' && props.item.error}>
+ <span class="block text-xs text-failure">
+ Last attempt failed. Select it to try again.
+ </span>
+ </Show>
+ </>
+ );
+}
+
+/** Discovered items: staged ones are selectable, the rest show progress. */
+export function ImportItemList(props: {
+ items: readonly ImportItem[];
+ selected: ReadonlySet<string>;
+ disabled?: boolean;
+ onSelect(id: string, selected: boolean): void;
+ href(entity: NonNullable<ImportItem['entity']>): string;
+}) {
+ return (
+ <ul class="rounded-2xl bg-ink/3 px-3 py-1" aria-label="Items to import">
+ <For each={props.items}>
+ {(item) => (
+ <li class="flex items-start gap-3 py-2.5 text-sm">
+ <Switch>
+ <Match when={item.status === 'staged'}>
+ <Checkbox
+ class="flex min-w-0 flex-1 items-start gap-3"
+ checked={props.selected.has(item.id)}
+ disabled={props.disabled}
+ onChange={(checked) => props.onSelect(item.id, checked)}
+ >
+ <Checkbox.Control class="mt-0.5" />
+ <Checkbox.Label class="min-w-0 flex-1">
+ <span class="sr-only">Select </span>
+ <ItemText item={item} />
+ </Checkbox.Label>
+ </Checkbox>
+ </Match>
+ <Match when={item.status === 'importing'}>
+ <SpinnerIcon
+ class="mt-0.5 size-4 shrink-0 animate-spin text-ink-muted"
+ aria-hidden="true"
+ />
+ <span class="min-w-0 flex-1">
+ <ItemText item={item} />
+ </span>
+ <span class="shrink-0 text-xs text-ink-muted" role="status">
+ Importing…
+ </span>
+ </Match>
+ <Match when={item.status === 'imported'}>
+ <span class="size-4 shrink-0" aria-hidden="true" />
+ <span class="min-w-0 flex-1">
+ <ItemText item={item} />
+ </span>
+ <Show
+ when={item.entity}
+ fallback={
+ <span class="shrink-0 text-xs text-ink-muted">
+ Imported
+ </span>
+ }
+ >
+ {(entity) => (
+ <a
+ href={props.href(entity())}
+ class="inline-flex shrink-0 items-center gap-1 text-xs text-accent"
+ aria-label={`Open imported ${item.title}`}
+ >
+ Imported
+ <ArrowUpRightIcon class="size-3" aria-hidden="true" />
+ </a>
+ )}
+ </Show>
+ </Match>
+ </Switch>
+ </li>
+ )}
+ </For>
+ </ul>
+ );
+}
diff --git a/apps/web/src/features/connector-import/components/provider-row.tsx b/apps/web/src/features/connector-import/components/provider-row.tsx
new file mode 100644
index 0000000000..3524597991
--- /dev/null
+++ b/apps/web/src/features/connector-import/components/provider-row.tsx
@@ -0,0 +1,79 @@
+import CheckCircleIcon from '@phosphor/check-circle.svg';
+import SparkleIcon from '@phosphor/sparkle.svg';
+import { Button } from '@ui';
+import { Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import type { ImportProvider } from '../core/providers';
+
+export type ProviderRowState =
+ /** Connections are still loading; no action is offered yet. */
+ 'unknown' | 'disconnected' | 'connecting' | 'connected';
+
+/** One app in the import dialog: connect it, then import from it. */
+export function ProviderRow(props: {
+ provider: ImportProvider;
+ state: ProviderRowState;
+ /** Another action is running; hold this row's buttons. */
+ disabled?: boolean;
+ onConnect(): void;
+ onImport(): void;
+}) {
+ const native = () => props.provider.native !== undefined;
+ return (
+ <li class="flex items-center gap-3 py-2.5">
+ <span class="flex size-9 shrink-0 items-center justify-center rounded-full bg-dialog">
+ <Dynamic
+ component={props.provider.icon}
+ class="size-5 text-ink"
+ aria-hidden="true"
+ />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="flex items-center gap-1.5 text-sm font-medium text-ink">
+ {props.provider.name}
+ <Show when={props.state === 'connected'}>
+ <CheckCircleIcon
+ class="size-3.5 text-success"
+ aria-label="Connected"
+ />
+ </Show>
+ </span>
+ <span class="block truncate text-xs text-ink-muted">
+ {props.provider.detail}
+ {native() ? '' : ' · with the agent'}
+ </span>
+ </span>
+ <Show
+ when={props.state === 'connected'}
+ fallback={
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={
+ props.disabled ||
+ props.state === 'unknown' ||
+ props.state === 'connecting'
+ }
+ aria-label={`Connect ${props.provider.name}`}
+ onClick={() => props.onConnect()}
+ >
+ {props.state === 'connecting' ? 'Connecting…' : 'Connect'}
+ </Button>
+ }
+ >
+ <Button
+ variant="strong"
+ size="sm"
+ disabled={props.disabled}
+ aria-label={`Import from ${props.provider.name}`}
+ onClick={() => props.onImport()}
+ >
+ <Show when={!native()}>
+ <SparkleIcon aria-hidden="true" />
+ </Show>
+ Import
+ </Button>
+ </Show>
+ </li>
+ );
+}
diff --git a/apps/web/src/features/connector-import/components/security-note.tsx b/apps/web/src/features/connector-import/components/security-note.tsx
new file mode 100644
index 0000000000..3b98e78524
--- /dev/null
+++ b/apps/web/src/features/connector-import/components/security-note.tsx
@@ -0,0 +1,17 @@
+import LockIcon from '@phosphor/lock-simple.svg';
+import { cn } from '@ui';
+import { IMPORT_SECURITY_NOTE } from '../core/providers';
+
+export function SecurityNote(props: { class?: string }) {
+ return (
+ <p
+ class={cn(
+ 'flex items-start gap-1.5 text-xs leading-relaxed text-ink-extra-muted',
+ props.class
+ )}
+ >
+ <LockIcon class="mt-0.5 size-3 shrink-0" aria-hidden="true" />
+ <span>{IMPORT_SECURITY_NOTE}</span>
+ </p>
+ );
+}
diff --git a/apps/web/src/features/connector-import/connector-import-dialog.tsx b/apps/web/src/features/connector-import/connector-import-dialog.tsx
new file mode 100644
index 0000000000..ad792960fd
--- /dev/null
+++ b/apps/web/src/features/connector-import/connector-import-dialog.tsx
@@ -0,0 +1,81 @@
+import { openChatWithInput } from '@app/features/chat/ChatWithAgentButton';
+import { buildSimpleEntityUrl } from '@core/util/url';
+import {
+ type ImportState,
+ useDiscoverMutation,
+ useImportQuery,
+ useRunImportMutation,
+} from '@queries/import';
+import {
+ connectPipedreamApp,
+ usePipedreamConnectedSlugs,
+} from '@queries/pipedream-connectors';
+import type { JSX } from 'solid-js';
+import { ConnectorImportProvider } from './context/connector-import-context';
+import type { ConnectorImportContext } from './context/contracts';
+import type { ImportCategoryConfig } from './core/providers';
+import {
+ ConnectorImportDialog,
+ type ImportAlternative,
+} from './views/import-dialog';
+
+const PENDING_STATE: ImportState = { runs: [], entities: [] };
+
+function useProductionContext(): ConnectorImportContext {
+ const discover = useDiscoverMutation();
+ const runImport = useRunImportMutation();
+ return {
+ createConnections() {
+ const { slugs, ready } = usePipedreamConnectedSlugs();
+ return { connected: slugs, ready };
+ },
+ createImportState() {
+ const query = useImportQuery();
+ return {
+ // Guard resource reads so polling never suspends the dialog.
+ state: () => (query.isSuccess ? query.data : PENDING_STATE),
+ ready: () => query.isSuccess && !query.isPlaceholderData,
+ };
+ },
+ connect: (app, container) =>
+ connectPipedreamApp({
+ appSlug: app.appSlug,
+ serverName: app.name,
+ container,
+ }),
+ discover: (source) => discover.mutateAsync(source),
+ runImport: async (importIds) => {
+ await runImport.mutateAsync({ importIds, discardIds: [] });
+ },
+ startAgentImport: (handoff) =>
+ openChatWithInput(handoff.input, { instructions: handoff.instructions }),
+ entityHref: (entity) => buildSimpleEntityUrl(entity),
+ };
+}
+
+/**
+ * The import dialog wired to production: the Pipedream connector stack, the
+ * import pipeline, and agent handoff. Loaded on demand by the sidebar card,
+ * so the card itself renders with its view.
+ */
+export function ConnectorImportDialogHost(props: {
+ config: ImportCategoryConfig;
+ open: boolean;
+ onOpenChange(open: boolean): void;
+ opener?: HTMLElement;
+ alternatives?: readonly ImportAlternative[];
+ onImported(): void;
+}): JSX.Element {
+ return (
+ <ConnectorImportProvider context={useProductionContext()}>
+ <ConnectorImportDialog
+ config={props.config}
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ opener={props.opener}
+ alternatives={props.alternatives}
+ onImported={props.onImported}
+ />
+ </ConnectorImportProvider>
+ );
+}
diff --git a/apps/web/src/features/connector-import/connector-import.test.tsx b/apps/web/src/features/connector-import/connector-import.test.tsx
new file mode 100644
index 0000000000..037d3db139
--- /dev/null
+++ b/apps/web/src/features/connector-import/connector-import.test.tsx
@@ -0,0 +1,49 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { ConnectorImportPromotion } from './connector-import';
+
+const host = vi.hoisted(() => ({
+ dialog: undefined as
+ | undefined
+ | { open: boolean; config: { action: string } },
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: true, loading: false }),
+}));
+vi.mock('@queries/prompt-dismissals', () => ({
+ usePromptDismissalsQuery: () => ({
+ isSuccess: true,
+ isError: false,
+ data: { dismissed: [] },
+ }),
+ dismissPromptEverywhere: vi.fn(),
+}));
+vi.mock('./connector-import-dialog', () => ({
+ ConnectorImportDialogHost: (props: NonNullable<typeof host.dialog>) => {
+ host.dialog = props;
+ return <p>{props.open ? 'Dialog open' : 'Dialog closed'}</p>;
+ },
+}));
+
+afterEach(() => {
+ cleanup();
+ host.dialog = undefined;
+ localStorage.clear();
+});
+
+describe('ConnectorImportPromotion', () => {
+ it('renders the card at once and loads the dialog on first open', async () => {
+ render(() => <ConnectorImportPromotion category="files" applies />);
+ const button = screen.getByRole('button', { name: 'Import files' });
+ expect(host.dialog).toBeUndefined();
+ fireEvent.click(button);
+ expect(await screen.findByText('Dialog open')).toBeTruthy();
+ expect(host.dialog?.config.action).toBe('Import files');
+ });
+
+ it('renders nothing while it does not apply', () => {
+ render(() => <ConnectorImportPromotion category="files" applies={false} />);
+ expect(screen.queryByRole('button', { name: 'Import files' })).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/connector-import/connector-import.tsx b/apps/web/src/features/connector-import/connector-import.tsx
new file mode 100644
index 0000000000..f5b4517bba
--- /dev/null
+++ b/apps/web/src/features/connector-import/connector-import.tsx
@@ -0,0 +1,136 @@
+import {
+ allOf,
+ flagVerdict,
+ SidebarPromotion,
+ type Verdict,
+} from '@app/features/sidebar-promotion/sidebar-promotion';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { enableSidebarPromotions } from '@core/constant/featureFlags';
+import { useUserId } from '@core/context/user';
+import {
+ usePipedreamMcpFlag,
+ usePipedreamMcpFlagResult,
+} from '@core/pipedream/flag';
+import { fireAndForget } from '@core/util/fireAndForget';
+import { lazyNamed } from '@core/util/lazyNamed';
+import { createSignal, type JSX, Show, Suspense } from 'solid-js';
+import { IMPORT_CATEGORIES } from './core/catalog';
+import type { ImportCategory } from './core/providers';
+import { hideImportPromotion, importPromotionId } from './primitives/promotion';
+import type { ImportAlternative } from './views/import-dialog';
+
+export type { ImportAlternative } from './views/import-dialog';
+
+const loadDialog = () => import('./connector-import-dialog');
+const ConnectorImportDialogHost = lazyNamed(
+ loadDialog,
+ 'ConnectorImportDialogHost'
+);
+
+/**
+ * A view sidebar's prompt to import this category from other apps, and the
+ * dialog it opens. Applies once connector import is rolled out to the user
+ * and the Pipedream connector stack is on.
+ */
+export function ConnectorImportSidebar(props: {
+ category: ImportCategory;
+ /** The host's own gate, e.g. team membership; applies when omitted. */
+ applies?: Verdict;
+ alternatives?: readonly ImportAlternative[];
+ class?: string;
+}): JSX.Element {
+ const flag = useFeatureFlag(enableSidebarPromotions);
+ const pipedream = usePipedreamMcpFlagResult();
+ return (
+ <ConnectorImportPromotion
+ {...props}
+ applies={allOf(
+ flagVerdict(flag()),
+ flagVerdict(pipedream()),
+ props.applies ?? true
+ )}
+ />
+ );
+}
+
+/**
+ * The card and dialog behind the host's own gate. Connector rows need the
+ * Pipedream stack; with none available and a single alternative, the card
+ * opens it directly.
+ */
+export function ConnectorImportPromotion(props: {
+ category: ImportCategory;
+ /** See `SidebarPromotion`: `undefined` while the host's gates load. */
+ applies: Verdict;
+ alternatives?: readonly ImportAlternative[];
+ class?: string;
+}): JSX.Element {
+ const userId = useUserId();
+ const pipedream = usePipedreamMcpFlag();
+ const config = () => IMPORT_CATEGORIES[props.category];
+ const dialogConfig = () => ({
+ ...config(),
+ providers: pipedream() ? config().providers : [],
+ });
+ const [open, setOpen] = createSignal(false);
+ // The dialog's code loads on first open (and is fetched ahead on hover).
+ const [opened, setOpened] = createSignal(false);
+ const [opener, setOpener] = createSignal<HTMLButtonElement>();
+ const hide = () => hideImportPromotion(userId(), props.category);
+ // Alternatives open their own dialogs; hand them the card button for focus.
+ const alternatives = (): ImportAlternative[] =>
+ (props.alternatives ?? []).map((base) => ({
+ ...base,
+ onSelect: () => base.onSelect(opener()),
+ }));
+ const openDialog = (value: boolean) => {
+ if (value) setOpened(true);
+ setOpen(value);
+ };
+
+ return (
+ <>
+ <div
+ class="contents"
+ onPointerEnter={() =>
+ fireAndForget(loadDialog(), 'connector-import.preload')
+ }
+ onFocusIn={() =>
+ fireAndForget(loadDialog(), 'connector-import.preload')
+ }
+ >
+ <SidebarPromotion
+ id={importPromotionId(props.category)}
+ applies={props.applies}
+ logos={config().providers}
+ headline={config().headline}
+ pitch={config().pitch}
+ class={props.class}
+ action={{
+ label: config().action,
+ onClick: (trigger) => {
+ setOpener(trigger);
+ const [direct, ...others] = alternatives();
+ if (!dialogConfig().providers.length && direct && !others.length)
+ direct.onSelect();
+ else openDialog(true);
+ },
+ }}
+ />
+ </div>
+ {/* Beside the card: a finished import hides the card, not the dialog. */}
+ <Show when={opened()}>
+ <Suspense>
+ <ConnectorImportDialogHost
+ config={dialogConfig()}
+ open={open()}
+ onOpenChange={openDialog}
+ opener={opener()}
+ alternatives={alternatives()}
+ onImported={hide}
+ />
+ </Suspense>
+ </Show>
+ </>
+ );
+}
diff --git a/apps/web/src/features/connector-import/context/connector-import-context.tsx b/apps/web/src/features/connector-import/context/connector-import-context.tsx
new file mode 100644
index 0000000000..a1cd681c3c
--- /dev/null
+++ b/apps/web/src/features/connector-import/context/connector-import-context.tsx
@@ -0,0 +1,19 @@
+import { createContext, type JSX, useContext } from 'solid-js';
+import type { ConnectorImportContext } from './contracts';
+
+const Context = createContext<ConnectorImportContext>();
+
+export function ConnectorImportProvider(props: {
+ context: ConnectorImportContext;
+ children: JSX.Element;
+}): JSX.Element {
+ return (
+ <Context.Provider value={props.context}>{props.children}</Context.Provider>
+ );
+}
+
+export function useConnectorImport(): ConnectorImportContext {
+ const context = useContext(Context);
+ if (!context) throw new Error('ConnectorImportProvider is required');
+ return context;
+}
diff --git a/apps/web/src/features/connector-import/context/contracts.ts b/apps/web/src/features/connector-import/context/contracts.ts
new file mode 100644
index 0000000000..c72b7bf289
--- /dev/null
+++ b/apps/web/src/features/connector-import/context/contracts.ts
@@ -0,0 +1,35 @@
+import type { ImportSource, ImportState } from '@service-cognition/import';
+import type { Accessor } from 'solid-js';
+import type { AgentImportHandoff } from '../core/agent-handoff';
+
+export type ConnectOutcome = 'connected' | 'closed' | 'unsupported';
+
+/** The user's connected apps; `ready` is false until the answer is known. */
+type ConnectionsSource = {
+ connected: Accessor<ReadonlySet<string>>;
+ ready: Accessor<boolean>;
+};
+
+/** Import pipeline state; `ready` is false while serving a placeholder. */
+type ImportStateSource = {
+ state: Accessor<ImportState>;
+ ready: Accessor<boolean>;
+};
+
+export type ConnectorImportContext = {
+ /** Called inside an open dialog so its queries live only that long. */
+ createConnections(): ConnectionsSource;
+ createImportState(): ImportStateSource;
+ /** Connect through Pipedream; `container` keeps the iframe usable in a modal. */
+ connect(
+ app: { appSlug: string; name: string },
+ container?: HTMLElement
+ ): Promise<ConnectOutcome>;
+ /** Start finding items for a native source. */
+ discover(source: ImportSource): Promise<void>;
+ /** Accept staged rows; completion arrives through the import state. */
+ runImport(importIds: string[]): Promise<void>;
+ /** Hand a provider without a native importer to an agent chat. */
+ startAgentImport(handoff: AgentImportHandoff): Promise<void>;
+ entityHref(entity: { id: string; type: string }): string;
+};
diff --git a/apps/web/src/features/connector-import/core/agent-handoff.test.ts b/apps/web/src/features/connector-import/core/agent-handoff.test.ts
new file mode 100644
index 0000000000..ebdb9b346f
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/agent-handoff.test.ts
@@ -0,0 +1,36 @@
+import { describe, expect, it } from 'vitest';
+import { agentImportHandoff } from './agent-handoff';
+import { IMPORT_CATEGORIES } from './catalog';
+
+describe('agent import handoff', () => {
+ it('asks before creating and never writes back to the source', () => {
+ const crm = IMPORT_CATEGORIES.crm;
+ const hubspot = crm.providers.find((p) => p.appSlug === 'hubspot')!;
+ const handoff = agentImportHandoff(crm, hubspot);
+ expect(handoff.input).toBe(
+ 'Import my most recent companies and contacts from HubSpot into the Macro CRM.'
+ );
+ expect(handoff.instructions).toContain('ask which ones to bring over');
+ expect(handoff.instructions).toContain('CreateCompany');
+ expect(handoff.instructions).toContain('never edit or delete');
+ });
+
+ it('creates tasks as task documents', () => {
+ const tasks = IMPORT_CATEGORIES.tasks;
+ const jira = tasks.providers.find((p) => p.appSlug === 'jira')!;
+ expect(agentImportHandoff(tasks, jira).instructions).toContain(
+ 'isTask true'
+ );
+ });
+});
+
+describe('import catalog', () => {
+ it('gives every category unique providers led by a native source where one exists', () => {
+ for (const config of Object.values(IMPORT_CATEGORIES)) {
+ const slugs = config.providers.map((p) => p.appSlug);
+ expect(new Set(slugs).size).toBe(slugs.length);
+ const native = config.providers.findIndex((p) => p.native);
+ expect(native === -1 || native === 0).toBe(true);
+ }
+ });
+});
diff --git a/apps/web/src/features/connector-import/core/agent-handoff.ts b/apps/web/src/features/connector-import/core/agent-handoff.ts
new file mode 100644
index 0000000000..f6fdf6fb94
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/agent-handoff.ts
@@ -0,0 +1,52 @@
+import { match } from 'ts-pattern';
+import type { ImportCategoryConfig, ImportProvider } from './providers';
+
+/** What an agent chat opens with when a provider has no native importer. */
+export type AgentImportHandoff = {
+ /** Unsent composer text the user can adjust before sending. */
+ input: string;
+ /** Private guidance for the agent; never shown in the transcript. */
+ instructions: string;
+};
+
+function createWith(config: ImportCategoryConfig): string {
+ return match(config.category)
+ .with(
+ 'files',
+ () =>
+ 'Create each document with CreateDocument, converting its content to markdown. Keep the original title.'
+ )
+ .with(
+ 'tasks',
+ () =>
+ 'Create each one with CreateDocument and isTask true. Keep the title, put the description in the body, and set status, assignee, and due date with SetEntityProperty when the source has them.'
+ )
+ .with(
+ 'crm',
+ () =>
+ 'Check ListCompanies first so nothing is duplicated, then use CreateCompany and CreateContact. Set stage, owner, and other properties with SetEntityProperty when the source has them.'
+ )
+ .with(
+ 'channels',
+ () =>
+ 'Create each channel with CreateChannel, keeping its name and purpose.'
+ )
+ .exhaustive();
+}
+
+export function agentImportHandoff(
+ config: ImportCategoryConfig,
+ provider: ImportProvider
+): AgentImportHandoff {
+ return {
+ input: `Import my most recent ${config.items} from ${provider.name} into ${config.destination}.`,
+ instructions: [
+ `The user started this from Macro's import dialog and has just connected ${provider.name}.`,
+ `Use the ${provider.name} connector tools to find their most relevant recent ${config.items}.`,
+ `Before creating anything, show a short numbered list and ask which ones to bring over.`,
+ createWith(config),
+ `Only read from ${provider.name}; never edit or delete anything there.`,
+ 'Finish with links to everything you created.',
+ ].join(' '),
+ };
+}
diff --git a/apps/web/src/features/connector-import/core/catalog.ts b/apps/web/src/features/connector-import/core/catalog.ts
new file mode 100644
index 0000000000..78f7e6bfa5
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/catalog.ts
@@ -0,0 +1,183 @@
+import IconAirtable from '@icon/import/airtable.svg';
+import IconAsana from '@icon/import/asana.svg';
+import IconBox from '@icon/import/box.svg';
+import IconClose from '@icon/import/close.svg';
+import IconConfluence from '@icon/import/confluence.svg';
+import IconDropbox from '@icon/import/dropbox.svg';
+import IconGoogleDrive from '@icon/import/google-drive.svg';
+import IconHubSpot from '@icon/import/hubspot.svg';
+import IconJira from '@icon/import/jira.svg';
+import IconMonday from '@icon/import/monday.svg';
+import IconNotion from '@icon/import/notion.svg';
+import IconOneDrive from '@icon/import/onedrive.svg';
+import IconSalesforce from '@icon/import/salesforce.svg';
+import IconTrello from '@icon/import/trello.svg';
+import IconGithub from '@icon/mcp-github.svg';
+import IconLinear from '@icon/mcp-linear.svg';
+import IconSlack from '@icon/slack-color.svg';
+import type {
+ ImportCategory,
+ ImportCategoryConfig,
+ ImportIcon,
+} from './providers';
+
+// Order is promotion order: the sidebar card shows these left to right and
+// its copy names the first few. Natively imported sources lead.
+// Each pitch fills one line and most of a second at the default sidebar width.
+export const IMPORT_CATEGORIES: Record<ImportCategory, ImportCategoryConfig> = {
+ files: {
+ category: 'files',
+ headline: 'Bring your files to Macro',
+ pitch:
+ 'Import docs and files from Notion, Google Drive, Dropbox, and more.',
+ action: 'Import files',
+ dialogDescription:
+ 'Connect an app, then pick what to bring into your Drive.',
+ items: 'documents and files',
+ destination: 'my Macro Drive',
+ providers: [
+ {
+ appSlug: 'notion',
+ name: 'Notion',
+ detail: 'Pages and wikis',
+ icon: IconNotion as ImportIcon,
+ native: 'notion',
+ },
+ {
+ appSlug: 'google_drive',
+ name: 'Google Drive',
+ detail: 'Docs, PDFs, and files',
+ icon: IconGoogleDrive as ImportIcon,
+ },
+ {
+ appSlug: 'dropbox',
+ name: 'Dropbox',
+ detail: 'Files and folders',
+ icon: IconDropbox as ImportIcon,
+ },
+ {
+ appSlug: 'microsoft_onedrive',
+ name: 'OneDrive',
+ detail: 'Files and folders',
+ icon: IconOneDrive as ImportIcon,
+ },
+ {
+ appSlug: 'box',
+ name: 'Box',
+ detail: 'Files and folders',
+ icon: IconBox as ImportIcon,
+ },
+ {
+ appSlug: 'confluence',
+ name: 'Confluence',
+ detail: 'Spaces and pages',
+ icon: IconConfluence as ImportIcon,
+ },
+ ],
+ },
+ tasks: {
+ category: 'tasks',
+ headline: 'Bring your tasks to Macro',
+ pitch:
+ 'Import issues and tasks from Linear, Jira, Asana, GitHub, and more.',
+ action: 'Import tasks',
+ dialogDescription: 'Connect an app, then pick which tasks to bring over.',
+ items: 'issues and tasks',
+ destination: 'Macro tasks',
+ providers: [
+ {
+ appSlug: 'linear',
+ name: 'Linear',
+ detail: 'Issues',
+ icon: IconLinear as ImportIcon,
+ native: 'linear',
+ },
+ {
+ appSlug: 'jira',
+ name: 'Jira',
+ detail: 'Issues',
+ icon: IconJira as ImportIcon,
+ },
+ {
+ appSlug: 'asana',
+ name: 'Asana',
+ detail: 'Tasks',
+ icon: IconAsana as ImportIcon,
+ },
+ {
+ appSlug: 'github',
+ name: 'GitHub',
+ detail: 'Issues',
+ icon: IconGithub as ImportIcon,
+ },
+ {
+ appSlug: 'trello',
+ name: 'Trello',
+ detail: 'Cards',
+ icon: IconTrello as ImportIcon,
+ },
+ {
+ appSlug: 'monday',
+ name: 'monday.com',
+ detail: 'Items',
+ icon: IconMonday as ImportIcon,
+ },
+ ],
+ },
+ crm: {
+ category: 'crm',
+ headline: 'Bring your customers to Macro',
+ pitch: 'Import companies and contacts from HubSpot, Salesforce, and more.',
+ action: 'Import customers',
+ dialogDescription:
+ 'Connect an app, then bring its companies and contacts into your CRM.',
+ items: 'companies and contacts',
+ destination: 'the Macro CRM',
+ providers: [
+ {
+ appSlug: 'hubspot',
+ name: 'HubSpot',
+ detail: 'Companies and contacts',
+ icon: IconHubSpot as ImportIcon,
+ },
+ {
+ appSlug: 'salesforce_rest_api',
+ name: 'Salesforce',
+ detail: 'Accounts and contacts',
+ icon: IconSalesforce as ImportIcon,
+ },
+ {
+ appSlug: 'close',
+ name: 'Close',
+ detail: 'Leads and contacts',
+ icon: IconClose as ImportIcon,
+ },
+ {
+ appSlug: 'airtable_oauth',
+ name: 'Airtable',
+ detail: 'Records from a base',
+ icon: IconAirtable as ImportIcon,
+ },
+ ],
+ },
+ channels: {
+ category: 'channels',
+ headline: 'Bring Slack to Macro',
+ pitch:
+ 'Import Slack channels and members, with or without message history.',
+ action: 'Import from Slack',
+ dialogDescription:
+ 'Connect Slack to pick channels, or upload an export to bring history.',
+ items: 'channels',
+ destination: 'Macro channels',
+ providers: [
+ {
+ appSlug: 'slack',
+ name: 'Slack',
+ detail: 'Channels',
+ icon: IconSlack as ImportIcon,
+ native: 'slack',
+ },
+ ],
+ },
+};
diff --git a/apps/web/src/features/connector-import/core/import-items.test.ts b/apps/web/src/features/connector-import/core/import-items.test.ts
new file mode 100644
index 0000000000..da94507ef1
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/import-items.test.ts
@@ -0,0 +1,79 @@
+import { describe, expect, it } from 'vitest';
+import { importEntity, importRunState } from '../tests/fake-context';
+import { importItems, needsDiscovery, toImportItem } from './import-items';
+
+describe('import items', () => {
+ it('labels Linear issues by identifier and status', () => {
+ expect(
+ toImportItem(
+ importEntity({
+ id: 'a',
+ source: 'linear',
+ metadata: { identifier: 'ENG-1', title: 'Fix it', status: 'Todo' },
+ })
+ )
+ ).toMatchObject({ title: 'Fix it', detail: 'ENG-1 · Todo' });
+ });
+
+ it('labels Notion pages by summary and links imported entities', () => {
+ expect(
+ toImportItem(
+ importEntity({
+ id: 'b',
+ source: 'notion',
+ status: 'imported',
+ metadata: { title: 'Plan', summary: 'Q4 goals' },
+ entity_id: 'doc-1',
+ entity_type: 'md',
+ })
+ )
+ ).toMatchObject({
+ title: 'Plan',
+ detail: 'Q4 goals',
+ entity: { id: 'doc-1', type: 'md' },
+ });
+ });
+
+ it('labels Slack channels with a hash, purpose, and member count', () => {
+ expect(
+ toImportItem(
+ importEntity({
+ id: 'c',
+ source: 'slack',
+ metadata: { name: 'eng', purpose: 'Builds', member_count: 4 },
+ })
+ )
+ ).toMatchObject({ title: '#eng', detail: 'Builds · 4 members' });
+ });
+
+ it('keeps one source, drops discarded rows, and lists staged first', () => {
+ const items = importItems(
+ {
+ runs: [],
+ entities: [
+ importEntity({ id: 'done', source: 'notion', status: 'imported' }),
+ importEntity({ id: 'gone', source: 'notion', status: 'discarded' }),
+ importEntity({ id: 'other', source: 'linear' }),
+ importEntity({ id: 'new', source: 'notion' }),
+ ],
+ },
+ 'notion'
+ );
+ expect(items.map((item) => item.id)).toEqual(['new', 'done']);
+ });
+
+ it('discovers only when nothing is staged or running', () => {
+ const staged = [{ id: 'a', title: 'A', status: 'staged' as const }];
+ expect(needsDiscovery(undefined, [])).toBe(true);
+ expect(needsDiscovery(undefined, staged)).toBe(false);
+ expect(
+ needsDiscovery(
+ importRunState({ source: 'notion', status: 'running' }),
+ []
+ )
+ ).toBe(false);
+ expect(
+ needsDiscovery(importRunState({ source: 'notion', status: 'failed' }), [])
+ ).toBe(true);
+ });
+});
diff --git a/apps/web/src/features/connector-import/core/import-items.ts b/apps/web/src/features/connector-import/core/import-items.ts
new file mode 100644
index 0000000000..32782c7943
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/import-items.ts
@@ -0,0 +1,94 @@
+import type {
+ ImportEntity,
+ ImportEntityStatus,
+ ImportRun,
+ ImportSource,
+ ImportState,
+} from '@service-cognition/import';
+import { match } from 'ts-pattern';
+
+/** One discovered item, as the native import list shows it. */
+export type ImportItem = {
+ id: string;
+ title: string;
+ /** A secondary line: a Linear identifier and status, a Notion summary. */
+ detail?: string;
+ status: Exclude<ImportEntityStatus, 'discarded'>;
+ /** The created Macro entity, once imported. */
+ entity?: { id: string; type: string };
+ error?: string;
+};
+
+function text(value: unknown): string | undefined {
+ return typeof value === 'string' && value.trim() ? value.trim() : undefined;
+}
+
+export function toImportItem(entity: ImportEntity): ImportItem | undefined {
+ if (entity.status === 'discarded') return undefined;
+ const meta = entity.metadata;
+ const title =
+ entity.source === 'slack'
+ ? `#${text(meta.name)?.replace(/^#/, '') ?? entity.foreign_id}`
+ : (text(meta.title) ?? text(meta.name) ?? entity.foreign_id);
+ const detail = match(entity.source)
+ .with('linear', () =>
+ [text(meta.identifier), text(meta.status)].filter(Boolean).join(' · ')
+ )
+ .with('notion', () => text(meta.summary))
+ .with('slack', () =>
+ [
+ meta.archived === true ? 'Archived' : undefined,
+ text(meta.purpose),
+ typeof meta.member_count === 'number'
+ ? `${meta.member_count} members`
+ : undefined,
+ ]
+ .filter(Boolean)
+ .join(' · ')
+ )
+ .exhaustive();
+ return {
+ id: entity.id,
+ title,
+ detail: detail || undefined,
+ status: entity.status,
+ entity:
+ entity.entity_id && entity.entity_type
+ ? { id: entity.entity_id, type: entity.entity_type }
+ : undefined,
+ error: entity.last_error ?? undefined,
+ };
+}
+
+const STATUS_ORDER: Record<ImportItem['status'], number> = {
+ staged: 0,
+ importing: 1,
+ imported: 2,
+};
+
+/** One source's items: staged first (selectable), then in-flight and done. */
+export function importItems(
+ state: ImportState,
+ source: ImportSource
+): ImportItem[] {
+ return state.entities
+ .filter((entity) => entity.source === source)
+ .flatMap((entity) => toImportItem(entity) ?? [])
+ .sort((a, b) => STATUS_ORDER[a.status] - STATUS_ORDER[b.status]);
+}
+
+export function importRun(
+ state: ImportState,
+ source: ImportSource
+): ImportRun | undefined {
+ return state.runs.find((run) => run.source === source);
+}
+
+/** Whether opening a source should start finding items to import. */
+export function needsDiscovery(
+ run: ImportRun | undefined,
+ items: readonly ImportItem[]
+): boolean {
+ if (run?.status === 'running' || run?.status === 'importing') return false;
+ return !items.some((item) => item.status === 'staged');
+}
diff --git a/apps/web/src/features/connector-import/core/providers.ts b/apps/web/src/features/connector-import/core/providers.ts
new file mode 100644
index 0000000000..9b3041a49c
--- /dev/null
+++ b/apps/web/src/features/connector-import/core/providers.ts
@@ -0,0 +1,43 @@
+import type { ImportSource } from '@service-cognition/import';
+import type { Component, JSX } from 'solid-js';
+
+export type ImportIcon = Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
+
+/** The Macro surface an import fills: Drive, Tasks, the CRM, or Channels. */
+export type ImportCategory = 'files' | 'tasks' | 'crm' | 'channels';
+
+export type ImportProvider = {
+ /** Pipedream app slug the provider connects through. */
+ appSlug: string;
+ name: string;
+ /** What comes over, in a few words. */
+ detail: string;
+ icon: ImportIcon;
+ /**
+ * The import pipeline source that discovers and copies items without an
+ * agent. Providers without one hand off to an agent chat once connected.
+ */
+ native?: ImportSource;
+};
+
+type ImportCategoryCopy = {
+ /** Sidebar card heading. */
+ headline: string;
+ /** Sidebar card body; names the leading providers. */
+ pitch: string;
+ /** Sidebar card button and dialog title. */
+ action: string;
+ dialogDescription: string;
+ /** Plural noun for imported items, as used in agent prompts. */
+ items: string;
+ /** Where imported items land, as used in agent prompts. */
+ destination: string;
+};
+
+export type ImportCategoryConfig = ImportCategoryCopy & {
+ category: ImportCategory;
+ providers: readonly ImportProvider[];
+};
+
+/** Shown on every card and dialog; grounded in Macro's security page. */
+export const IMPORT_SECURITY_NOTE = 'Encrypted in transit and at rest.';
diff --git a/apps/web/src/features/connector-import/primitives/promotion.ts b/apps/web/src/features/connector-import/primitives/promotion.ts
new file mode 100644
index 0000000000..30fd5aaf42
--- /dev/null
+++ b/apps/web/src/features/connector-import/primitives/promotion.ts
@@ -0,0 +1,14 @@
+import { hidePromotion } from '@app/features/sidebar-promotion/primitives/promotion';
+import type { ImportCategory } from '../core/providers';
+
+export function importPromotionId(category: ImportCategory): string {
+ return `import:${category}`;
+}
+
+/** Used by a confirmed import; dismissal goes through the card itself. */
+export function hideImportPromotion(
+ userId: string | undefined,
+ category: ImportCategory
+): void {
+ hidePromotion(userId, importPromotionId(category));
+}
diff --git a/apps/web/src/features/connector-import/tests/fake-context.ts b/apps/web/src/features/connector-import/tests/fake-context.ts
new file mode 100644
index 0000000000..2766485e4b
--- /dev/null
+++ b/apps/web/src/features/connector-import/tests/fake-context.ts
@@ -0,0 +1,72 @@
+import type {
+ ImportEntity,
+ ImportRun,
+ ImportState,
+} from '@service-cognition/import';
+import { createSignal } from 'solid-js';
+import { vi } from 'vitest';
+import type {
+ ConnectOutcome,
+ ConnectorImportContext,
+} from '../context/contracts';
+
+export function importEntity(
+ overrides: Partial<ImportEntity> & Pick<ImportEntity, 'id' | 'source'>
+): ImportEntity {
+ return {
+ user_id: 'user',
+ foreign_id: overrides.id,
+ status: 'staged',
+ initiator: 'manual',
+ metadata: {},
+ created_at: '2026-10-12T00:00:00Z',
+ updated_at: '2026-10-12T00:00:00Z',
+ ...overrides,
+ };
+}
+
+export function importRunState(
+ overrides: Partial<ImportRun> & Pick<ImportRun, 'source'>
+): ImportRun {
+ return {
+ status: 'ready',
+ auto_import: false,
+ updated_at: '2026-10-12T00:00:00Z',
+ ...overrides,
+ };
+}
+
+/** An in-memory context whose server state tests drive directly. */
+export function fakeConnectorImport(options?: { connected?: string[] }) {
+ const [connected, setConnected] = createSignal<ReadonlySet<string>>(
+ new Set(options?.connected)
+ );
+ const [state, setState] = createSignal<ImportState>({
+ runs: [],
+ entities: [],
+ });
+ const [ready, setReady] = createSignal(true);
+ let connectOutcome: ConnectOutcome = 'connected';
+ const context = {
+ createConnections: () => ({ connected, ready: () => true }),
+ createImportState: () => ({ state, ready }),
+ connect: vi.fn(async (app: { appSlug: string }) => {
+ if (connectOutcome === 'connected')
+ setConnected((previous) => new Set([...previous, app.appSlug]));
+ return connectOutcome;
+ }),
+ discover: vi.fn(async () => {}),
+ runImport: vi.fn(async () => {}),
+ startAgentImport: vi.fn(async () => {}),
+ entityHref: (entity: { id: string; type: string }) =>
+ `/app/${entity.type}/${entity.id}`,
+ } satisfies ConnectorImportContext;
+ return {
+ context,
+ setState,
+ setReady,
+ setConnectOutcome(outcome: ConnectOutcome) {
+ connectOutcome = outcome;
+ },
+ };
+}
diff --git a/apps/web/src/features/connector-import/views/import-dialog.test.tsx b/apps/web/src/features/connector-import/views/import-dialog.test.tsx
new file mode 100644
index 0000000000..e82cc789c4
--- /dev/null
+++ b/apps/web/src/features/connector-import/views/import-dialog.test.tsx
@@ -0,0 +1,227 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { ConnectorImportProvider } from '../context/connector-import-context';
+import { IMPORT_CATEGORIES } from '../core/catalog';
+import type { ImportCategory } from '../core/providers';
+import {
+ fakeConnectorImport,
+ importEntity,
+ importRunState,
+} from '../tests/fake-context';
+import { ConnectorImportDialog } from './import-dialog';
+
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => false }));
+vi.mock('@core/mobile/virtualKeyboard', () => ({
+ virtualKeyboardVisible: () => false,
+}));
+vi.mock('@core/component/Toast/Toast', () => ({
+ toast: { failure: vi.fn() },
+}));
+
+let motionStyles: HTMLStyleElement;
+beforeEach(() => {
+ motionStyles = document.createElement('style');
+ motionStyles.textContent =
+ '* { transition-duration: 0s; animation-name: none; }';
+ document.head.append(motionStyles);
+ vi.stubGlobal('scrollTo', vi.fn());
+});
+afterEach(() => {
+ cleanup();
+ motionStyles.remove();
+ vi.unstubAllGlobals();
+});
+
+function setup(
+ category: ImportCategory,
+ options?: Parameters<typeof fakeConnectorImport>[0] & {
+ alternative?: () => void;
+ }
+) {
+ const fake = fakeConnectorImport(options);
+ const [open, setOpen] = createSignal(true);
+ const onImported = vi.fn();
+ render(() => (
+ <ConnectorImportProvider context={fake.context}>
+ <ConnectorImportDialog
+ config={IMPORT_CATEGORIES[category]}
+ open={open()}
+ onOpenChange={setOpen}
+ onImported={onImported}
+ alternatives={
+ options?.alternative && [
+ {
+ icon: () => <svg />,
+ label: 'Upload a CSV',
+ description: 'From a spreadsheet.',
+ onSelect: options.alternative,
+ },
+ ]
+ }
+ />
+ </ConnectorImportProvider>
+ ));
+ return { ...fake, open, onImported };
+}
+
+describe('connector import dialog', () => {
+ it('lists every provider in the category with its connection state', () => {
+ setup('files', { connected: ['dropbox'] });
+ for (const provider of IMPORT_CATEGORIES.files.providers) {
+ expect(screen.getByText(provider.name)).toBeTruthy();
+ }
+ expect(
+ screen.getByRole('button', { name: 'Import from Dropbox' })
+ ).toBeTruthy();
+ expect(
+ screen.getByRole('button', { name: 'Connect Google Drive' })
+ ).toBeTruthy();
+ expect(screen.getByText(/Encrypted in transit and at rest/)).toBeTruthy();
+ });
+
+ it('connects an agent provider, then hands its import to a chat', async () => {
+ const { context, open } = setup('tasks');
+ fireEvent.click(screen.getByRole('button', { name: 'Connect Jira' }));
+ expect(context.connect).toHaveBeenCalledWith(
+ { appSlug: 'jira', name: 'Jira' },
+ expect.anything()
+ );
+ const importButton = await screen.findByRole('button', {
+ name: 'Import from Jira',
+ });
+ fireEvent.click(importButton);
+ await waitFor(() => expect(open()).toBe(false));
+ expect(context.startAgentImport).toHaveBeenCalledWith(
+ expect.objectContaining({
+ input:
+ 'Import my most recent issues and tasks from Jira into Macro tasks.',
+ })
+ );
+ });
+
+ it('keeps an unfinished connection disconnected', async () => {
+ const fake = setup('crm');
+ fake.setConnectOutcome('closed');
+ fireEvent.click(screen.getByRole('button', { name: 'Connect HubSpot' }));
+ await waitFor(() =>
+ expect(
+ screen.getByRole('button', { name: 'Connect HubSpot' })
+ ).toHaveProperty('disabled', false)
+ );
+ expect(screen.queryByRole('button', { name: 'Import from HubSpot' })).toBe(
+ null
+ );
+ });
+
+ it('discovers, imports selected native items, and reports confirmed imports', async () => {
+ const { context, setState, onImported } = setup('files', {
+ connected: ['notion'],
+ });
+ fireEvent.click(screen.getByRole('button', { name: 'Import from Notion' }));
+ expect(screen.getByText('Import from Notion')).toBeTruthy();
+ await waitFor(() =>
+ expect(context.discover).toHaveBeenCalledWith('notion')
+ );
+
+ setState({
+ runs: [importRunState({ source: 'notion', status: 'running' })],
+ entities: [],
+ });
+ expect(
+ screen.getByText(/Finding your recent pages and wikis/)
+ ).toBeTruthy();
+
+ setState({
+ runs: [importRunState({ source: 'notion' })],
+ entities: [
+ importEntity({
+ id: 'a',
+ source: 'notion',
+ metadata: { title: 'Plan' },
+ }),
+ importEntity({
+ id: 'b',
+ source: 'notion',
+ metadata: { title: 'Notes' },
+ }),
+ ],
+ });
+ fireEvent.click(screen.getByRole('checkbox', { name: 'Select Plan' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Import 1' }));
+ await waitFor(() => expect(context.runImport).toHaveBeenCalledWith(['a']));
+ expect(onImported).not.toHaveBeenCalled();
+
+ setState({
+ runs: [importRunState({ source: 'notion' })],
+ entities: [
+ importEntity({
+ id: 'a',
+ source: 'notion',
+ status: 'imported',
+ metadata: { title: 'Plan' },
+ entity_id: 'doc-1',
+ entity_type: 'md',
+ }),
+ importEntity({
+ id: 'b',
+ source: 'notion',
+ metadata: { title: 'Notes' },
+ }),
+ ],
+ });
+ expect(
+ screen
+ .getByRole('link', { name: 'Open imported Plan' })
+ .getAttribute('href')
+ ).toBe('/app/md/doc-1');
+ expect(onImported).toHaveBeenCalled();
+ expect(context.discover).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not rediscover when items are already staged', async () => {
+ const fake = fakeConnectorImport({ connected: ['linear'] });
+ fake.setState({
+ runs: [importRunState({ source: 'linear' })],
+ entities: [
+ importEntity({
+ id: 'x',
+ source: 'linear',
+ metadata: { identifier: 'ENG-7', title: 'Ship it' },
+ }),
+ ],
+ });
+ render(() => (
+ <ConnectorImportProvider context={fake.context}>
+ <ConnectorImportDialog
+ config={IMPORT_CATEGORIES.tasks}
+ open
+ onOpenChange={() => {}}
+ onImported={() => {}}
+ />
+ </ConnectorImportProvider>
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Import from Linear' }));
+ expect(await screen.findByText('Ship it')).toBeTruthy();
+ expect(screen.getByText('ENG-7')).toBeTruthy();
+ expect(fake.context.discover).not.toHaveBeenCalled();
+ fireEvent.click(screen.getByRole('button', { name: 'Back to apps' }));
+ expect(
+ screen.getByRole('button', { name: 'Import from Linear' })
+ ).toBeTruthy();
+ });
+
+ it('offers the host alternative and closes before running it', async () => {
+ const alternative = vi.fn();
+ const { open } = setup('crm', { alternative });
+ fireEvent.click(screen.getByRole('button', { name: /Upload a CSV/ }));
+ expect(alternative).toHaveBeenCalled();
+ await waitFor(() => expect(open()).toBe(false));
+ });
+});
diff --git a/apps/web/src/features/connector-import/views/import-dialog.tsx b/apps/web/src/features/connector-import/views/import-dialog.tsx
new file mode 100644
index 0000000000..dc28fa78db
--- /dev/null
+++ b/apps/web/src/features/connector-import/views/import-dialog.tsx
@@ -0,0 +1,233 @@
+import { LogoStack } from '@app/features/sidebar-promotion/components/logo-stack';
+import { toast } from '@core/component/Toast/Toast';
+import { fireAndForget } from '@core/util/fireAndForget';
+import CaretRightIcon from '@phosphor/caret-right.svg';
+import type { ImportSource } from '@service-cognition/import';
+import { ActionDialogShell, Dialog } from '@ui';
+import { createSignal, For, type JSX, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import { ProviderRow, type ProviderRowState } from '../components/provider-row';
+import { SecurityNote } from '../components/security-note';
+import { useConnectorImport } from '../context/connector-import-context';
+import { agentImportHandoff } from '../core/agent-handoff';
+import type { ImportCategoryConfig, ImportProvider } from '../core/providers';
+import { NativeImportPane } from './native-import-pane';
+
+/** Another way in that does not go through a connector, e.g. a CSV upload. */
+export type ImportAlternative = {
+ icon: (props: JSX.SvgSVGAttributes<SVGSVGElement>) => JSX.Element;
+ label: string;
+ description: string;
+ /** `opener` is the card button, for the next dialog to return focus to. */
+ onSelect(opener?: HTMLButtonElement): void;
+};
+
+type NativeProvider = ImportProvider & { native: ImportSource };
+
+function isNative(provider: ImportProvider): provider is NativeProvider {
+ return provider.native !== undefined;
+}
+
+export function ConnectorImportDialog(props: {
+ config: ImportCategoryConfig;
+ open: boolean;
+ onOpenChange(open: boolean): void;
+ /** Focus returns here on close; the card sits outside Dialog's trigger. */
+ opener?: HTMLElement;
+ /** Ways in that skip connectors, e.g. a CSV or local upload. */
+ alternatives?: readonly ImportAlternative[];
+ onImported(): void;
+}): JSX.Element {
+ let content: HTMLDivElement | undefined;
+ return (
+ <Dialog
+ open={props.open}
+ onOpenChange={props.onOpenChange}
+ position="center"
+ class="w-120"
+ visibleScrim
+ contentRef={(element) => {
+ content = element;
+ }}
+ onCloseAutoFocus={(event) => {
+ event.preventDefault();
+ props.opener?.focus();
+ }}
+ >
+ <Show when={props.open}>
+ <ImportDialogBody
+ config={props.config}
+ container={() => content}
+ alternatives={props.alternatives}
+ onClose={() => props.onOpenChange(false)}
+ onImported={props.onImported}
+ />
+ </Show>
+ </Dialog>
+ );
+}
+
+function ImportDialogBody(props: {
+ config: ImportCategoryConfig;
+ container: () => HTMLElement | undefined;
+ /** Ways in that skip connectors, e.g. a CSV or local upload. */
+ alternatives?: readonly ImportAlternative[];
+ onClose(): void;
+ onImported(): void;
+}): JSX.Element {
+ const context = useConnectorImport();
+ const connections = context.createConnections();
+ const [connecting, setConnecting] = createSignal<string>();
+ const [handingOff, setHandingOff] = createSignal(false);
+ const [picking, setPicking] = createSignal<NativeProvider>();
+
+ function rowState(provider: ImportProvider): ProviderRowState {
+ if (connecting() === provider.appSlug) return 'connecting';
+ if (!connections.ready()) return 'unknown';
+ return connections.connected().has(provider.appSlug)
+ ? 'connected'
+ : 'disconnected';
+ }
+
+ async function connect(provider: ImportProvider) {
+ if (connecting()) return;
+ setConnecting(provider.appSlug);
+ try {
+ const outcome = await context.connect(
+ { appSlug: provider.appSlug, name: provider.name },
+ props.container()
+ );
+ if (outcome === 'unsupported') {
+ toast.failure('Connectors are not available on this deployment');
+ } else if (outcome === 'connected' && isNative(provider)) {
+ setPicking(provider);
+ }
+ } catch {
+ toast.failure(`Couldn't connect ${provider.name}`);
+ } finally {
+ setConnecting(undefined);
+ }
+ }
+
+ async function startImport(provider: ImportProvider) {
+ if (isNative(provider)) {
+ setPicking(provider);
+ return;
+ }
+ if (handingOff()) return;
+ setHandingOff(true);
+ try {
+ await context.startAgentImport(
+ agentImportHandoff(props.config, provider)
+ );
+ props.onClose();
+ } finally {
+ setHandingOff(false);
+ }
+ }
+
+ // A stable element: swapping panes at the root of Dialog content left the
+ // previous pane mounted beside the next one.
+ return (
+ <div class="contents">
+ <Show
+ when={picking()}
+ fallback={
+ // The `contents` wrapper hides this shell from Dialog's surface reset.
+ <ActionDialogShell
+ hideBorder
+ class="max-h-[85dvh] rounded-[24px] bg-transparent"
+ >
+ <ActionDialogShell.Body class="space-y-4">
+ <ActionDialogShell.Header>
+ <LogoStack
+ logos={props.config.providers}
+ class="mb-3 [--logo-stack-separator:var(--color-dialog)]"
+ />
+ <ActionDialogShell.Title>
+ {props.config.action}
+ </ActionDialogShell.Title>
+ <ActionDialogShell.Description>
+ {props.config.dialogDescription}
+ </ActionDialogShell.Description>
+ </ActionDialogShell.Header>
+ <ul
+ class="rounded-2xl bg-ink/3 px-3 py-1"
+ aria-label={`Apps to ${props.config.action.toLowerCase()} from`}
+ >
+ <For each={props.config.providers}>
+ {(provider) => (
+ <ProviderRow
+ provider={provider}
+ state={rowState(provider)}
+ disabled={
+ handingOff() ||
+ (connecting() !== undefined &&
+ connecting() !== provider.appSlug)
+ }
+ onConnect={() =>
+ fireAndForget(
+ connect(provider),
+ 'connector-import.connect'
+ )
+ }
+ onImport={() =>
+ fireAndForget(
+ startImport(provider),
+ 'connector-import.start'
+ )
+ }
+ />
+ )}
+ </For>
+ </ul>
+ <Show when={props.alternatives?.length}>
+ <div class="flex flex-col gap-2">
+ <For each={props.alternatives}>
+ {(alternative) => (
+ <button
+ type="button"
+ class="flex w-full items-center gap-3 rounded-2xl bg-ink/3 px-3 py-3 text-left hover:bg-ink/5 focus-visible:outline-accent"
+ onClick={() => {
+ props.onClose();
+ alternative.onSelect();
+ }}
+ >
+ <Dynamic
+ component={alternative.icon}
+ class="size-5 shrink-0 text-ink-muted"
+ aria-hidden="true"
+ />
+ <span class="min-w-0 flex-1">
+ <span class="block text-sm font-medium text-ink">
+ {alternative.label}
+ </span>
+ <span class="block text-xs text-ink-muted">
+ {alternative.description}
+ </span>
+ </span>
+ <CaretRightIcon
+ class="size-4 text-ink-extra-muted"
+ aria-hidden="true"
+ />
+ </button>
+ )}
+ </For>
+ </div>
+ </Show>
+ <SecurityNote />
+ </ActionDialogShell.Body>
+ </ActionDialogShell>
+ }
+ >
+ {(provider) => (
+ <NativeImportPane
+ provider={provider()}
+ onBack={() => setPicking(undefined)}
+ onImported={props.onImported}
+ />
+ )}
+ </Show>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/connector-import/views/native-import-pane.tsx b/apps/web/src/features/connector-import/views/native-import-pane.tsx
new file mode 100644
index 0000000000..88f65123ea
--- /dev/null
+++ b/apps/web/src/features/connector-import/views/native-import-pane.tsx
@@ -0,0 +1,257 @@
+import { SearchBar } from '@app/components/view-shell';
+import { toast } from '@core/component/Toast/Toast';
+import { fireAndForget } from '@core/util/fireAndForget';
+import ArrowLeftIcon from '@phosphor/arrow-left.svg';
+import SpinnerIcon from '@phosphor/spinner-gap.svg';
+import WarningIcon from '@phosphor/warning-circle.svg';
+import type { ImportSource } from '@service-cognition/import';
+import { ActionDialogShell, Button } from '@ui';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ type JSX,
+ Match,
+ on,
+ Show,
+ Switch,
+} from 'solid-js';
+import { ImportItemList } from '../components/import-item-list';
+import { SecurityNote } from '../components/security-note';
+import { useConnectorImport } from '../context/connector-import-context';
+import { importItems, importRun, needsDiscovery } from '../core/import-items';
+import type { ImportProvider } from '../core/providers';
+
+const FILTER_THRESHOLD = 8;
+
+/**
+ * Pick-and-import for a provider the import pipeline copies natively:
+ * discovery stages candidates, the user selects, accepted rows import live.
+ */
+export function NativeImportPane(props: {
+ provider: ImportProvider & { native: ImportSource };
+ onBack(): void;
+ /** A row this pane submitted finished importing. */
+ onImported(): void;
+}): JSX.Element {
+ const context = useConnectorImport();
+ const importState = context.createImportState();
+ const source = () => props.provider.native;
+ const run = () => importRun(importState.state(), source());
+ const items = createMemo(() => importItems(importState.state(), source()));
+ const [filter, setFilter] = createSignal('');
+ // Slack discovery lists every visible channel; long lists get a filter.
+ const filterable = () => items().length > FILTER_THRESHOLD;
+ const visible = createMemo(() => {
+ const query = filter().trim().toLowerCase();
+ if (!query) return items();
+ return items().filter((item) =>
+ `${item.title} ${item.detail ?? ''}`.toLowerCase().includes(query)
+ );
+ });
+ const staged = () => visible().filter((item) => item.status === 'staged');
+ const [selected, setSelected] = createSignal<ReadonlySet<string>>(new Set());
+ const [submitted, setSubmitted] = createSignal<ReadonlySet<string>>(
+ new Set()
+ );
+ const [discovering, setDiscovering] = createSignal(false);
+ const [importing, setImporting] = createSignal(false);
+ const searching = () => discovering() || run()?.status === 'running' || false;
+ // Status changes can make a selected row no longer importable.
+ // Selections stay importable while the filter hides them.
+ const importIds = () =>
+ items()
+ .filter((item) => item.status === 'staged' && selected().has(item.id))
+ .map((item) => item.id);
+ const allSelected = () =>
+ staged().length > 0 && staged().every((item) => selected().has(item.id));
+
+ async function discover() {
+ if (searching()) return;
+ setDiscovering(true);
+ try {
+ await context.discover(source());
+ } catch {
+ toast.failure(`Couldn't search ${props.provider.name}`);
+ } finally {
+ setDiscovering(false);
+ }
+ }
+
+ async function runImport() {
+ const ids = importIds();
+ if (!ids.length || importing()) return;
+ setImporting(true);
+ try {
+ await context.runImport(ids);
+ setSubmitted((previous) => new Set([...previous, ...ids]));
+ setSelected(new Set<string>());
+ } catch {
+ toast.failure(`Couldn't import from ${props.provider.name}`);
+ } finally {
+ setImporting(false);
+ }
+ }
+
+ // Search once the real state is known, unless there is already a list.
+ createEffect(
+ on(
+ importState.ready,
+ (ready) => {
+ if (ready && needsDiscovery(run(), items()))
+ fireAndForget(discover(), 'connector-import.discover');
+ },
+ { defer: false }
+ )
+ );
+
+ // The run mutation only queues work; wait for a server-confirmed import.
+ createEffect(() => {
+ if (
+ items().some(
+ (item) => item.status === 'imported' && submitted().has(item.id)
+ )
+ ) {
+ props.onImported();
+ }
+ });
+
+ function select(id: string, checked: boolean) {
+ setSelected((previous) => {
+ const next = new Set(previous);
+ if (checked) next.add(id);
+ else next.delete(id);
+ return next;
+ });
+ }
+
+ return (
+ // Inside the dialog's `contents` wrapper, out of reach of its surface reset.
+ <ActionDialogShell
+ hideBorder
+ class="max-h-[85dvh] rounded-[24px] bg-transparent"
+ >
+ <ActionDialogShell.Body class="space-y-4">
+ <ActionDialogShell.Header>
+ <div class="flex items-center gap-2">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Back to apps"
+ onClick={() => props.onBack()}
+ >
+ <ArrowLeftIcon aria-hidden="true" />
+ </Button>
+ <ActionDialogShell.Title>
+ Import from {props.provider.name}
+ </ActionDialogShell.Title>
+ </div>
+ <ActionDialogShell.Description>
+ Pick what to copy into Macro. Copies don't sync back to{' '}
+ {props.provider.name}.
+ </ActionDialogShell.Description>
+ </ActionDialogShell.Header>
+
+ <Switch>
+ <Match when={run()?.status === 'failed' && !searching()}>
+ <div
+ class="flex items-start gap-2 rounded-2xl bg-ink/3 p-3 text-sm text-ink-muted"
+ role="alert"
+ >
+ <WarningIcon
+ class="mt-0.5 size-4 shrink-0 text-failure"
+ aria-hidden="true"
+ />
+ <span>
+ {run()?.error ?? `Couldn't search ${props.provider.name}.`}
+ </span>
+ </div>
+ </Match>
+ <Match when={searching() && !items().length}>
+ <p
+ class="flex items-center gap-2 py-6 text-sm text-ink-muted"
+ role="status"
+ >
+ <SpinnerIcon class="size-4 animate-spin" aria-hidden="true" />
+ Finding your recent {props.provider.detail.toLowerCase()} in{' '}
+ {props.provider.name}…
+ </p>
+ </Match>
+ <Match when={!items().length && importState.ready()}>
+ <p class="py-6 text-sm text-ink-muted">
+ Nothing new to import from {props.provider.name}.
+ </p>
+ </Match>
+ </Switch>
+
+ <Show when={items().length}>
+ <Show when={filterable()}>
+ <SearchBar
+ label={`Filter ${props.provider.detail.toLowerCase()}`}
+ placeholder={`Filter ${props.provider.detail.toLowerCase()}`}
+ value={filter()}
+ onValueChange={setFilter}
+ />
+ </Show>
+ <Show when={staged().length > 1}>
+ <Button
+ variant="ghost"
+ size="xs"
+ disabled={importing()}
+ onClick={() => {
+ // Only the rows the filter shows; hidden selections stay.
+ const shown = staged().map((item) => item.id);
+ const clear = allSelected();
+ setSelected((previous) => {
+ const next = new Set(previous);
+ for (const id of shown) {
+ if (clear) next.delete(id);
+ else next.add(id);
+ }
+ return next;
+ });
+ }}
+ >
+ {allSelected() ? 'Clear selection' : 'Select all'}
+ </Button>
+ </Show>
+ <ImportItemList
+ items={visible()}
+ selected={selected()}
+ disabled={importing()}
+ onSelect={select}
+ href={context.entityHref}
+ />
+ <Show when={searching()}>
+ <p
+ class="flex items-center gap-2 text-xs text-ink-muted"
+ role="status"
+ >
+ <SpinnerIcon class="size-3 animate-spin" aria-hidden="true" />
+ Looking for more…
+ </p>
+ </Show>
+ </Show>
+ <SecurityNote />
+ </ActionDialogShell.Body>
+ <ActionDialogShell.Footer class="border-t-0">
+ <Button
+ variant="ghost"
+ depth={2}
+ disabled={searching() || importing()}
+ onClick={() => fireAndForget(discover(), 'connector-import.discover')}
+ >
+ Search again
+ </Button>
+ <Button
+ variant="strong"
+ depth={2}
+ disabled={!importIds().length || importing()}
+ onClick={() => fireAndForget(runImport(), 'connector-import.import')}
+ >
+ {importIds().length ? `Import ${importIds().length}` : 'Import'}
+ </Button>
+ </ActionDialogShell.Footer>
+ </ActionDialogShell>
+ );
+}
diff --git a/apps/web/src/features/crm/components/crm-sidebar.tsx b/apps/web/src/features/crm/components/crm-sidebar.tsx
index 55683c55d9..c63a3ce5e0 100644
--- a/apps/web/src/features/crm/components/crm-sidebar.tsx
+++ b/apps/web/src/features/crm/components/crm-sidebar.tsx
@@ -32,6 +32,8 @@ export function CrmSidebar(props: {
/** The highlighted record type, list, pipeline, or `settings`. */
active: string;
pipelines?: JSX.Element;
+ /** Pinned to the bottom of the scrolling content, above the tools. */
+ promotion?: JSX.Element;
lists: { id: string; name: string; count: number }[];
listsEnabled: boolean;
listsLoading: boolean;
@@ -177,6 +179,7 @@ export function CrmSidebar(props: {
</CollapsibleSection.Content>
</CollapsibleSection.Root>
</Show>
+ {props.promotion}
</ViewSidebar.Content>
<ViewSidebar.Footer>
<ViewSidebar.Nav aria-label="CRM tools">
diff --git a/apps/web/src/features/crm/views/crm-workspace.tsx b/apps/web/src/features/crm/views/crm-workspace.tsx
index ed01670184..e3c74e7bac 100644
--- a/apps/web/src/features/crm/views/crm-workspace.tsx
+++ b/apps/web/src/features/crm/views/crm-workspace.tsx
@@ -5,6 +5,7 @@ import {
ViewShell,
} from '@app/components/view-shell';
import { VIEW_SHELL_TOUR } from '@app/components/view-shell/tour';
+import { ConnectorImportSidebar } from '@app/features/connector-import/connector-import';
import { NIL_UUID } from '@app/features/next-soup/filters/filter-store';
import { getViewPreset } from '@app/features/next-soup/sidebar/soup-filter-presets';
import { MobileFilterDrawer } from '@app/features/next-soup/soup-view/filters-bar/mobile-filter-drawer';
@@ -27,6 +28,7 @@ import {
isCrmContactEntity,
} from '@entity';
import ArrowLeftIcon from '@phosphor/arrow-left.svg';
+import FileCsvIcon from '@phosphor/file-csv.svg';
import ListIcon from '@phosphor/list.svg';
import PlusIcon from '@phosphor/plus.svg';
import { Button, Dropdown, Tooltip } from '@ui';
@@ -394,6 +396,21 @@ export function CrmWorkspaceView(props: {
);
const sidebar = (onCollapse?: () => void) => (
<CrmSidebar
+ promotion={
+ <ConnectorImportSidebar
+ category="crm"
+ class="mt-auto"
+ applies={teamQuery.isSuccess ? !!teamId() : undefined}
+ alternatives={[
+ {
+ icon: FileCsvIcon,
+ label: 'Upload a CSV',
+ description: 'Import companies from a spreadsheet export.',
+ onSelect: () => setImporting(true),
+ },
+ ]}
+ />
+ }
pipelines={
<Show when={pipelinesEnabled()}>
<PipelineSidebar
diff --git a/apps/web/src/features/drive-view/views/drive-sidebar.tsx b/apps/web/src/features/drive-view/views/drive-sidebar.tsx
index af5c6aeb9a..2cb05f0a7a 100644
--- a/apps/web/src/features/drive-view/views/drive-sidebar.tsx
+++ b/apps/web/src/features/drive-view/views/drive-sidebar.tsx
@@ -3,12 +3,14 @@ import {
SearchBar,
ViewSidebar,
} from '@app/components/view-shell';
+import { ConnectorImportSidebar } from '@app/features/connector-import/connector-import';
import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenu';
import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
import { useFavoriteDisplayName } from '@app/util/favorites';
import { fireAndForget } from '@core/util/fireAndForget';
import FolderIcon from '@phosphor/folder.svg';
import SearchIcon from '@phosphor/magnifying-glass.svg';
+import UploadIcon from '@phosphor/upload-simple.svg';
import type { Favorite } from '@service-storage/generated/schemas/favorite';
import { Button } from '@ui';
import { createMemo, createSignal, For, Show } from 'solid-js';
@@ -199,6 +201,31 @@ export function DriveSidebarContent(props: { onNavigate?: () => void }) {
);
}
+/** The import card, offering local uploads beside connected apps. */
+function DriveImportPromotion() {
+ const { actions } = useDriveView();
+ return (
+ <ConnectorImportSidebar
+ category="files"
+ class="mt-auto"
+ alternatives={[
+ {
+ icon: UploadIcon,
+ label: 'Upload files',
+ description: 'Choose files from this computer.',
+ onSelect: actions.uploadFiles,
+ },
+ {
+ icon: FolderIcon,
+ label: 'Upload a folder',
+ description: 'Bring over a folder and everything in it.',
+ onSelect: actions.uploadFolder,
+ },
+ ]}
+ />
+ );
+}
+
export function DriveSidebar() {
return (
<ViewSidebar.Root aria-label="Drive navigation">
@@ -213,6 +240,7 @@ export function DriveSidebar() {
</ViewSidebar.Primary>
<ViewSidebar.Content>
<DriveSidebarContent />
+ <DriveImportPromotion />
</ViewSidebar.Content>
</ViewSidebar.Root>
);
diff --git a/apps/web/src/features/home/components/HomeListLayout.tsx b/apps/web/src/features/home/components/HomeListLayout.tsx
index fba961a4a0..fc789817f0 100644
--- a/apps/web/src/features/home/components/HomeListLayout.tsx
+++ b/apps/web/src/features/home/components/HomeListLayout.tsx
@@ -18,7 +18,12 @@ function MobileHomeHeader(props: ParentProps) {
/** Keep mobile chrome above a full-height list so rows fade beneath it. */
export function HomeListLayout(
- props: ParentProps<{ tabs: JSX.Element; onNewChat: () => void }>
+ props: ParentProps<{
+ tabs: JSX.Element;
+ onNewChat: () => void;
+ /** Below the list on desktop, e.g. the setup prompt. */
+ footer?: JSX.Element;
+ }>
) {
return (
<div
@@ -42,6 +47,7 @@ export function HomeListLayout(
<MobileHomeHeader>{props.tabs}</MobileHomeHeader>
</Show>
{props.children}
+ <Show when={!isTouchDevice()}>{props.footer}</Show>
<Show when={isTouchDevice()}>
<MobileTopEdgeFade />
</Show>
diff --git a/apps/web/src/features/home/components/HomeSetupPromotion.test.tsx b/apps/web/src/features/home/components/HomeSetupPromotion.test.tsx
new file mode 100644
index 0000000000..c347074d8d
--- /dev/null
+++ b/apps/web/src/features/home/components/HomeSetupPromotion.test.tsx
@@ -0,0 +1,76 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { HomeSetupPromotion } from './HomeSetupPromotion';
+
+const host = vi.hoisted(() => ({
+ team: null as null | { team: { allow_non_admin_invites?: boolean } },
+ admin: false,
+ pending: false,
+ openSettings: vi.fn(),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: true }),
+}));
+vi.mock('@queries/prompt-dismissals', () => ({
+ usePromptDismissalsQuery: () => ({
+ isSuccess: true,
+ isError: false,
+ data: { dismissed: [] },
+ }),
+ dismissPromptEverywhere: vi.fn(),
+}));
+vi.mock('@core/constant/SettingsState', () => ({
+ useSettingsState: () => ({ openSettings: host.openSettings }),
+}));
+vi.mock('@queries/team/teams', () => ({
+ useCurrentTeamQuery: () => ({
+ get isPending() {
+ return host.pending;
+ },
+ get data() {
+ return host.team;
+ },
+ }),
+ useIsTeamAdmin: () => () => host.admin,
+}));
+
+afterEach(() => {
+ cleanup();
+ host.team = null;
+ host.admin = false;
+ host.pending = false;
+ host.openSettings.mockReset();
+});
+
+describe('HomeSetupPromotion', () => {
+ it('opens Connections and Team settings', () => {
+ render(() => <HomeSetupPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Connect tools' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Invite team' }));
+ expect(host.openSettings.mock.calls).toEqual([['Connections'], ['Team']]);
+ });
+
+ it('hides invites from members of a team that limits them to admins', () => {
+ host.team = { team: { allow_non_admin_invites: false } };
+ render(() => <HomeSetupPromotion />);
+ expect(screen.getByRole('button', { name: 'Connect tools' })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'Invite team' })).toBeNull();
+ });
+
+ it('keeps invites for admins of such a team', () => {
+ host.team = { team: { allow_non_admin_invites: false } };
+ host.admin = true;
+ render(() => <HomeSetupPromotion />);
+ expect(screen.getByRole('button', { name: 'Invite team' })).toBeTruthy();
+ });
+
+ it('renders with its last known actions at once while the team loads', () => {
+ const view = render(() => <HomeSetupPromotion />);
+ expect(screen.getByRole('button', { name: 'Invite team' })).toBeTruthy();
+ view.unmount();
+ host.pending = true;
+ render(() => <HomeSetupPromotion />);
+ expect(screen.getByRole('button', { name: 'Invite team' })).toBeTruthy();
+ });
+});
diff --git a/apps/web/src/features/home/components/HomeSetupPromotion.tsx b/apps/web/src/features/home/components/HomeSetupPromotion.tsx
new file mode 100644
index 0000000000..ef59057fc7
--- /dev/null
+++ b/apps/web/src/features/home/components/HomeSetupPromotion.tsx
@@ -0,0 +1,62 @@
+import { HOME_SETUP_PROMOTION as COPY } from '@app/features/sidebar-promotion/core/promotions';
+import { createLastKnown } from '@app/features/sidebar-promotion/primitives/last-known';
+import {
+ allOf,
+ flagVerdict,
+ SidebarPromotion,
+} from '@app/features/sidebar-promotion/sidebar-promotion';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { enableSidebarPromotions } from '@core/constant/featureFlags';
+import { useSettingsState } from '@core/constant/SettingsState';
+import { useUserId } from '@core/context/user';
+import { useCurrentTeamQuery, useIsTeamAdmin } from '@queries/team/teams';
+import { untrack } from 'solid-js';
+import { z } from 'zod';
+
+/** Home's prompt to connect tools (Settings → Connections) and invite teammates (Settings → Team). */
+export function HomeSetupPromotion(props: { class?: string }) {
+ const promotions = useFeatureFlag(enableSidebarPromotions);
+ const { openSettings } = useSettingsState();
+ const team = useCurrentTeamQuery(() => promotions().enabled);
+ const isAdmin = useIsTeamAdmin();
+ const userId = useUserId();
+ // Settings → Team can invite (or create a team with invites) unless the
+ // user is a member of a team that limits invites to admins. Until the team
+ // loads, the card keeps the answer this browser last saw.
+ const canInvite = createLastKnown(
+ 'home-setup:can-invite',
+ untrack(userId),
+ () => {
+ if (team.isPending) return undefined;
+ const current = team.data?.team;
+ return !current || isAdmin() || current.allow_non_admin_invites !== false;
+ },
+ z.boolean()
+ );
+ return (
+ <SidebarPromotion
+ id={COPY.id}
+ applies={allOf(
+ flagVerdict(promotions()),
+ canInvite() === undefined ? undefined : true
+ )}
+ logos={COPY.logos}
+ headline={COPY.headline}
+ pitch={COPY.pitch}
+ class={props.class}
+ dismissLabel="Dismiss workspace setup"
+ action={{
+ label: COPY.action,
+ onClick: () => openSettings('Connections'),
+ }}
+ secondaryAction={
+ canInvite()
+ ? {
+ label: COPY.secondaryAction,
+ onClick: () => openSettings('Team'),
+ }
+ : undefined
+ }
+ />
+ );
+}
diff --git a/apps/web/src/features/home/home-view.tsx b/apps/web/src/features/home/home-view.tsx
index 7221c6f833..3910080f88 100644
--- a/apps/web/src/features/home/home-view.tsx
+++ b/apps/web/src/features/home/home-view.tsx
@@ -20,6 +20,7 @@ import { HomeList } from './components/HomeList';
import { HomeListLayout } from './components/HomeListLayout';
import { HomeListSkeleton } from './components/HomeListSkeleton';
import { HomeReturnBreadcrumb } from './components/HomeReturnBreadcrumb';
+import { HomeSetupPromotion } from './components/HomeSetupPromotion';
import { HomeTabs } from './components/HomeTabs';
import { HomeViewProvider, useHomeView } from './home-view-context';
import { homeTour } from './tour';
@@ -68,6 +69,7 @@ function HomeListPane(props: {
props.onNewChat();
showContent();
}}
+ footer={<HomeSetupPromotion class="px-(--sidebar-gutter) py-2" />}
>
<ViewTour tour={homeTour} />
<DebugSuspense name="HomeView.list" fallback={<HomeFallback />}>
diff --git a/apps/web/src/features/reviews-view/components/RepositoriesPromotion.test.tsx b/apps/web/src/features/reviews-view/components/RepositoriesPromotion.test.tsx
new file mode 100644
index 0000000000..ab566bc06f
--- /dev/null
+++ b/apps/web/src/features/reviews-view/components/RepositoriesPromotion.test.tsx
@@ -0,0 +1,100 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { RepositoriesPromotion } from './RepositoriesPromotion';
+
+const host = vi.hoisted(() => ({
+ status: 'linked' as string,
+ pending: false,
+ authorize: vi.fn(async () => false),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@queries/prompt-dismissals', () => ({
+ usePromptDismissalsQuery: () => ({
+ isSuccess: true,
+ isError: false,
+ data: { dismissed: [] },
+ }),
+ dismissPromptEverywhere: vi.fn(),
+}));
+vi.mock('@app/lib/analytics/posthog', () => ({
+ useFeatureFlag: () => () => ({ enabled: true }),
+}));
+vi.mock('@core/auth/authorize-github', () => ({
+ authorizeGithub: host.authorize,
+}));
+vi.mock('@queries/auth', () => ({
+ useGithubLinkStatusQuery: () => ({
+ get isPending() {
+ return host.pending;
+ },
+ get data() {
+ return { status: host.status };
+ },
+ }),
+ useInitGithubLinkMutation: () => ({ mutateAsync: vi.fn() }),
+ useReauthenticateGithubMutation: () => ({ mutateAsync: vi.fn() }),
+}));
+
+beforeEach(() => {
+ host.status = 'linked';
+ host.pending = false;
+ host.authorize.mockClear();
+ vi.stubGlobal('open', vi.fn());
+});
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ localStorage.clear();
+});
+
+describe('RepositoriesPromotion', () => {
+ it('opens the GitHub App install page once GitHub is linked', () => {
+ render(() => <RepositoriesPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Add repositories' }));
+ expect(window.open).toHaveBeenCalledWith(
+ expect.stringContaining('/github/install-sync'),
+ '_blank',
+ 'noopener'
+ );
+ });
+
+ it('links the GitHub account first when none is connected', () => {
+ host.status = 'unlinked';
+ render(() => <RepositoriesPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Connect GitHub' }));
+ expect(host.authorize).toHaveBeenCalled();
+ expect(window.open).not.toHaveBeenCalled();
+ host.status = 'linked';
+ });
+
+ it('reconnects an expired GitHub link instead of opening the install page', () => {
+ host.status = 'reauthentication_required';
+ render(() => <RepositoriesPromotion />);
+ fireEvent.click(screen.getByRole('button', { name: 'Reconnect GitHub' }));
+ expect(host.authorize).toHaveBeenCalledWith(
+ expect.any(Function),
+ 'Failed to reconnect GitHub'
+ );
+ expect(window.open).not.toHaveBeenCalled();
+ host.status = 'linked';
+ });
+
+ it('renders the last known GitHub status at once while it reloads', () => {
+ const view = render(() => <RepositoriesPromotion />);
+ expect(
+ screen.getByRole('button', { name: 'Add repositories' })
+ ).toBeTruthy();
+ view.unmount();
+ host.pending = true;
+ render(() => <RepositoriesPromotion />);
+ expect(
+ screen.getByRole('button', { name: 'Add repositories' })
+ ).toBeTruthy();
+ });
+
+ it('shows nothing while GitHub status loads on a first visit', () => {
+ host.pending = true;
+ render(() => <RepositoriesPromotion />);
+ expect(screen.queryByRole('button', { name: 'Connect GitHub' })).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/reviews-view/components/RepositoriesPromotion.tsx b/apps/web/src/features/reviews-view/components/RepositoriesPromotion.tsx
new file mode 100644
index 0000000000..c917c501b5
--- /dev/null
+++ b/apps/web/src/features/reviews-view/components/RepositoriesPromotion.tsx
@@ -0,0 +1,102 @@
+import { PULL_REQUEST_REPOSITORIES_PROMOTION as COPY } from '@app/features/sidebar-promotion/core/promotions';
+import { createLastKnown } from '@app/features/sidebar-promotion/primitives/last-known';
+import {
+ allOf,
+ flagVerdict,
+ SidebarPromotion,
+} from '@app/features/sidebar-promotion/sidebar-promotion';
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { authorizeGithub } from '@core/auth/authorize-github';
+import { toast } from '@core/component/Toast/Toast';
+import { enableSidebarPromotions } from '@core/constant/featureFlags';
+import { SERVER_HOSTS } from '@core/constant/servers';
+import { useUserId } from '@core/context/user';
+import { fireAndForget } from '@core/util/fireAndForget';
+import {
+ useGithubLinkStatusQuery,
+ useInitGithubLinkMutation,
+ useReauthenticateGithubMutation,
+} from '@queries/auth';
+import { untrack } from 'solid-js';
+import { match } from 'ts-pattern';
+import { z } from 'zod';
+
+/** The GitHub App install page, where orgs and repositories are chosen. */
+const GITHUB_APP_INSTALL_URL = `${SERVER_HOSTS['document-storage-service']}/github/install-sync`;
+
+/**
+ * The Pull requests sidebar's prompt to sync more GitHub orgs and
+ * repositories. The app install callback needs a linked account, so until
+ * one exists the card links the account first, like Settings → GitHub.
+ */
+export function RepositoriesPromotion(props: { class?: string }) {
+ const promotions = useFeatureFlag(enableSidebarPromotions);
+ const githubLink = useGithubLinkStatusQuery({
+ enabled: () => promotions().enabled,
+ });
+ const initGithubLink = useInitGithubLinkMutation();
+ const reauthenticateGithub = useReauthenticateGithubMutation();
+ const userId = useUserId();
+ // Gate the status read so a pending query never suspends the sidebar; until
+ // it loads, the card keeps the status this browser last saw.
+ const status = createLastKnown(
+ 'pull-request-repositories:github',
+ untrack(userId),
+ () => (githubLink.isPending ? undefined : githubLink.data?.status),
+ z.enum(['linked', 'reauthentication_required', 'unlinked'])
+ );
+
+ // Settings → GitHub runs the same two grants; an expired link must be
+ // reauthenticated rather than linked again.
+ const authorize = async (reconnect: boolean) => {
+ try {
+ await authorizeGithub(
+ (callbackUrl) =>
+ reconnect
+ ? reauthenticateGithub.mutateAsync(callbackUrl)
+ : initGithubLink.mutateAsync(callbackUrl),
+ reconnect ? 'Failed to reconnect GitHub' : 'Failed to connect GitHub'
+ );
+ } catch {
+ toast.failure(
+ reconnect
+ ? 'Failed to start GitHub reconnect flow'
+ : 'Failed to start GitHub connect flow'
+ );
+ }
+ };
+
+ const action = () =>
+ match(status())
+ .with('linked', () => ({
+ label: COPY.action,
+ onClick: () =>
+ window.open(GITHUB_APP_INSTALL_URL, '_blank', 'noopener'),
+ }))
+ .with('reauthentication_required', () => ({
+ label: COPY.reconnectAction,
+ onClick: () =>
+ fireAndForget(authorize(true), 'sidebar-promotion.github'),
+ }))
+ .otherwise(() => ({
+ label: COPY.connectAction,
+ onClick: () =>
+ fireAndForget(authorize(false), 'sidebar-promotion.github'),
+ }));
+
+ return (
+ <SidebarPromotion
+ id={COPY.id}
+ applies={allOf(
+ flagVerdict(promotions()),
+ status() === undefined ? undefined : true
+ )}
+ logos={COPY.logos}
+ headline={COPY.headline}
+ pitch={COPY.pitch}
+ class={props.class}
+ dismissLabel={`Dismiss ${COPY.headline.toLowerCase()}`}
+ action={action()}
+ />
+ );
+}
diff --git a/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx b/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
index cca3b4df63..6ed134c494 100644
--- a/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
+++ b/apps/web/src/features/reviews-view/components/ReviewsSidebar.tsx
@@ -43,6 +43,7 @@ import {
type ReviewsScope,
type ReviewsStatusTabId,
} from '../reviews-types';
+import { RepositoriesPromotion } from './RepositoriesPromotion';
import { ReviewsStatusTabs } from './ReviewsStatusTabs';
const SCOPE_ITEMS: Record<
@@ -366,6 +367,7 @@ export function ReviewsSidebar(props: {
activeLabels={props.activeLabels}
onActiveLabelsChange={props.onActiveLabelsChange}
/>
+ <RepositoriesPromotion class="mt-auto" />
</ViewSidebar.Content>
</ViewSidebar.Root>
);
diff --git a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx
index ac9b512ffc..4f6fd4c418 100644
--- a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx
+++ b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.test.tsx
@@ -13,14 +13,8 @@ const mocks = vi.hoisted(() => ({
const [state, setState] = createSignal<ImportState>({ runs: [], entities: [] });
vi.mock('@core/context/user', () => ({ useUserId: () => () => 'me' }));
-vi.mock('@queries/team/teams', () => ({
- useCurrentTeamQuery: () => ({
- isSuccess: true,
- data: { team: { id: 'team' } },
- }),
-}));
-vi.mock('@app/features/slack-import/primitives/promotion', () => ({
- hideSlackImportPromotion: mocks.hidePromotion,
+vi.mock('@app/features/connector-import/primitives/promotion', () => ({
+ hideImportPromotion: mocks.hidePromotion,
}));
vi.mock('@core/component/Toast/Toast', () => ({
toast: { failure: mocks.failure },
@@ -190,7 +184,7 @@ describe('Slack channel import card', () => {
.getAttribute('href')
).toContain('/app/channel/macro-channel');
expect(screen.getByText('by a teammate', { exact: false })).toBeTruthy();
- expect(mocks.hidePromotion).toHaveBeenCalledWith('me', 'team');
+ expect(mocks.hidePromotion).toHaveBeenCalledWith('me', 'channels');
});
it('shows empty and failed discoveries with retry', () => {
diff --git a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx
index bbcdcff3d7..1e6fff8ecc 100644
--- a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx
+++ b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportCard.tsx
@@ -1,4 +1,4 @@
-import { hideSlackImportPromotion } from '@app/features/slack-import/primitives/promotion';
+import { hideImportPromotion } from '@app/features/connector-import/primitives/promotion';
import { toast } from '@core/component/Toast/Toast';
import { useUserId } from '@core/context/user';
import { fireAndForget } from '@core/util/fireAndForget';
@@ -10,7 +10,6 @@ import {
useImportQuery,
useRunImportMutation,
} from '@queries/import';
-import { useCurrentTeamQuery } from '@queries/team/teams';
import { Button } from '@ui';
import {
createEffect,
@@ -106,7 +105,6 @@ export function SlackChannelImportCard(
props: { autoDiscover?: boolean } = {}
): JSX.Element {
const userId = useUserId();
- const team = useCurrentTeamQuery();
const query = useImportQuery();
const discover = useDiscoverMutation();
const importChannels = useRunImportMutation();
@@ -119,12 +117,8 @@ export function SlackChannelImportCard(
const rows = createMemo(() => buildRows(state(), userId()));
// The run mutation only queues work; wait for a server-confirmed import.
createEffect(() => {
- if (
- query.isSuccess &&
- team.isSuccess &&
- rows().some((row) => row.status === 'imported')
- ) {
- hideSlackImportPromotion(userId(), team.data?.team.id);
+ if (query.isSuccess && rows().some((row) => row.status === 'imported')) {
+ hideImportPromotion(userId(), 'channels');
}
});
const visible = createMemo(() =>
diff --git a/apps/web/src/features/sidebar-promotion/browser-test/playwright.config.ts b/apps/web/src/features/sidebar-promotion/browser-test/playwright.config.ts
new file mode 100644
index 0000000000..bbca74af2e
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/browser-test/playwright.config.ts
@@ -0,0 +1,26 @@
+import { fileURLToPath } from 'node:url';
+import { defineConfig } from '@playwright/test';
+
+const webDirectory = fileURLToPath(new URL('../../../../', import.meta.url));
+const port = process.env.SIDEBAR_PROMOTION_TEST_PORT ?? '3049';
+export default defineConfig({
+ testDir: fileURLToPath(new URL('.', import.meta.url)),
+ testMatch: '*.browser.e2e.ts',
+ workers: 1,
+ timeout: 60_000,
+ use: {
+ baseURL: `http://localhost:${port}`,
+ headless: true,
+ viewport: { width: 1280, height: 800 },
+ launchOptions: {
+ executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
+ },
+ },
+ webServer: {
+ command: `MACRO_DEV_HTTPS=false bunx vite --port ${port} --strictPort`,
+ cwd: webDirectory,
+ url: `http://localhost:${port}/app/`,
+ reuseExistingServer: false,
+ timeout: 60_000,
+ },
+});
diff --git a/apps/web/src/features/sidebar-promotion/browser-test/promotions.browser.e2e.ts b/apps/web/src/features/sidebar-promotion/browser-test/promotions.browser.e2e.ts
new file mode 100644
index 0000000000..255ab16e7f
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/browser-test/promotions.browser.e2e.ts
@@ -0,0 +1,41 @@
+import { expect, test } from '@playwright/test';
+
+const fixture = '/src/features/sidebar-promotion/browser-test/promotions.html';
+
+test.beforeEach(async ({ page }) => {
+ await page.routeWebSocket('**', (socket) => socket.close());
+ await page.route('https://**', (route) => route.abort());
+ await page.route('**/__macro_dev/**', (route) => route.abort());
+ await page.goto(fixture, { waitUntil: 'domcontentloaded' });
+});
+
+test('runs either Home action and dismisses a card', async ({ page }) => {
+ const home = page.getByRole('complementary', { name: 'Home sidebar' });
+ const result = page.getByRole('status', { name: 'Last action' });
+ await home
+ .getByRole('button', { name: 'Connect tools', exact: true })
+ .click();
+ await expect(result).toHaveText('Connect tools');
+ await home.getByRole('button', { name: 'Invite team' }).click();
+ await expect(result).toHaveText('Invite team');
+ await home.getByRole('button', { name: 'Dismiss connect tools' }).click();
+ await expect(
+ home.getByRole('button', { name: 'Connect tools', exact: true })
+ ).toHaveCount(0);
+});
+
+test('keeps every pitch to two lines at the default sidebar width', async ({
+ page,
+}) => {
+ const lines = await page
+ .locator('[role=region] p')
+ .evaluateAll((pitches) =>
+ pitches.map((pitch) =>
+ Math.round(
+ pitch.getBoundingClientRect().height /
+ Number.parseFloat(getComputedStyle(pitch).lineHeight)
+ )
+ )
+ );
+ expect(lines).toEqual([2, 2, 2]);
+});
diff --git a/apps/web/src/features/sidebar-promotion/browser-test/promotions.html b/apps/web/src/features/sidebar-promotion/browser-test/promotions.html
new file mode 100644
index 0000000000..cf74425b3a
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/browser-test/promotions.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<html lang="en">
+ <head><meta charset="utf-8" /><title>Sidebar promotions</title></head>
+ <body><div id="root"></div><script type="module" src="./promotions.tsx"></script></body>
+</html>
diff --git a/apps/web/src/features/sidebar-promotion/browser-test/promotions.tsx b/apps/web/src/features/sidebar-promotion/browser-test/promotions.tsx
new file mode 100644
index 0000000000..9b308696a8
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/browser-test/promotions.tsx
@@ -0,0 +1,86 @@
+import '@app/index.css';
+import { applyTheme } from '@app/features/theme/utils/themeUtils';
+import { createSignal, For, Show } from 'solid-js';
+import { render } from 'solid-js/web';
+import { PromoCard } from '../components/promo-card';
+import {
+ CALENDAR_ACCOUNTS_PROMOTION,
+ HOME_SETUP_PROMOTION,
+ PULL_REQUEST_REPOSITORIES_PROMOTION,
+} from '../core/promotions';
+
+// The real card with each host's copy, at the default sidebar width. Actions
+// record what they would do instead of leaving the page.
+const [lastAction, setLastAction] = createSignal('');
+
+const CARDS: {
+ sidebar: string;
+ copy: Pick<
+ typeof CALENDAR_ACCOUNTS_PROMOTION,
+ 'logos' | 'headline' | 'pitch' | 'action'
+ >;
+ secondary?: string;
+}[] = [
+ {
+ sidebar: 'Home',
+ copy: HOME_SETUP_PROMOTION,
+ secondary: HOME_SETUP_PROMOTION.secondaryAction,
+ },
+ { sidebar: 'Calendar', copy: CALENDAR_ACCOUNTS_PROMOTION },
+ { sidebar: 'Pull requests', copy: PULL_REQUEST_REPOSITORIES_PROMOTION },
+];
+
+function Sidebar(props: (typeof CARDS)[number]) {
+ const [hidden, setHidden] = createSignal(false);
+ return (
+ <aside
+ class="flex h-[440px] w-64 flex-col bg-panel px-2 py-3"
+ aria-label={`${props.sidebar} sidebar`}
+ >
+ <p class="px-2 text-sm font-semibold text-ink">{props.sidebar}</p>
+ <div class="mt-auto">
+ <Show when={!hidden()}>
+ <PromoCard
+ logos={props.copy.logos}
+ headline={props.copy.headline}
+ pitch={props.copy.pitch}
+ action={{
+ label: props.copy.action,
+ onClick: () => setLastAction(props.copy.action),
+ }}
+ secondaryAction={
+ props.secondary
+ ? {
+ label: props.secondary,
+ onClick: () => setLastAction(props.secondary ?? ''),
+ }
+ : undefined
+ }
+ dismissLabel={`Dismiss ${props.copy.action.toLowerCase()}`}
+ onDismiss={() => setHidden(true)}
+ />
+ </Show>
+ </div>
+ </aside>
+ );
+}
+
+function Fixture() {
+ return (
+ <main class="flex min-h-screen gap-6 bg-page p-6">
+ <For each={CARDS}>{(card) => <Sidebar {...card} />}</For>
+ <output aria-label="Last action" class="text-xs text-ink-muted">
+ {lastAction()}
+ </output>
+ </main>
+ );
+}
+
+// Apply dark explicitly too: `dark-mode:` styles key off the theme attribute.
+applyTheme(
+ new URLSearchParams(location.search).get('theme') === 'light'
+ ? 'Macro Light'
+ : 'Macro Dark'
+);
+const root = document.getElementById('root');
+if (root) render(() => <Fixture />, root);
diff --git a/apps/web/src/features/sidebar-promotion/components/logo-stack.tsx b/apps/web/src/features/sidebar-promotion/components/logo-stack.tsx
new file mode 100644
index 0000000000..b0aa401eb6
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/components/logo-stack.tsx
@@ -0,0 +1,38 @@
+import { cn } from '@ui';
+import type { Component, JSX } from 'solid-js';
+import { For } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+
+export type PromotionLogo = {
+ name: string;
+ icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;
+};
+
+/** Logos as overlapping round pills, first logo on top. */
+export function LogoStack(props: {
+ logos: readonly PromotionLogo[];
+ class?: string;
+}) {
+ return (
+ <ul
+ class={cn('isolate flex items-center -space-x-1.5', props.class)}
+ aria-label={props.logos.map((logo) => logo.name).join(', ')}
+ >
+ <For each={props.logos}>
+ {(logo, index) => (
+ <li
+ class="flex size-6 shrink-0 items-center justify-center rounded-full border border-edge-muted bg-surface ring-2 ring-(--logo-stack-separator,var(--color-control))"
+ style={{ 'z-index': props.logos.length - index() }}
+ title={logo.name}
+ >
+ <Dynamic
+ component={logo.icon}
+ class="size-3.5 text-ink"
+ aria-hidden="true"
+ />
+ </li>
+ )}
+ </For>
+ </ul>
+ );
+}
diff --git a/apps/web/src/features/sidebar-promotion/components/promo-card.tsx b/apps/web/src/features/sidebar-promotion/components/promo-card.tsx
new file mode 100644
index 0000000000..36c62a998c
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/components/promo-card.tsx
@@ -0,0 +1,83 @@
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import XIcon from '@phosphor/x.svg';
+import { Button, ComposerSurface, cn } from '@ui';
+import { Show } from 'solid-js';
+import { LogoStack, type PromotionLogo } from './logo-stack';
+
+export type PromoAction = {
+ label: string;
+ onClick(trigger: HTMLButtonElement): void;
+};
+
+/**
+ * A dismissible sidebar prompt: logos, a headline, a pitch, and actions.
+ * Desktop shares the email message card's surface (rounding, soft shadow,
+ * dark rim); touch keeps a plain bordered card.
+ */
+export function PromoCard(props: {
+ logos: readonly PromotionLogo[];
+ headline: string;
+ pitch: string;
+ action: PromoAction;
+ /** Shown beside the main action, splitting the row. */
+ secondaryAction?: PromoAction;
+ /** Accessible name for the close button. */
+ dismissLabel: string;
+ onDismiss(): void;
+}) {
+ return (
+ <ComposerSurface
+ as="div"
+ role="region"
+ class={cn(
+ 'w-full p-4',
+ isTouchDevice() && 'rounded-xl border border-edge-muted bg-control'
+ )}
+ aria-label={props.headline}
+ >
+ {/* Same-height row: the logos and the close glyph share one inset. */}
+ <div class="flex items-start justify-between gap-2">
+ <LogoStack
+ logos={props.logos}
+ class={
+ isTouchDevice()
+ ? undefined
+ : '[--logo-stack-separator:var(--color-composer)]'
+ }
+ />
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ aria-label={props.dismissLabel}
+ onClick={() => props.onDismiss()}
+ >
+ <XIcon class="size-3.5" aria-hidden="true" />
+ </Button>
+ </div>
+ <h2 class="mt-2.5 text-xs font-medium text-ink">{props.headline}</h2>
+ <p class="mt-1 text-[11px] leading-4 text-ink-muted">{props.pitch}</p>
+ <div class="mt-3 flex gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ class="min-w-0 flex-1"
+ onClick={(event) => props.action.onClick(event.currentTarget)}
+ >
+ {props.action.label}
+ </Button>
+ <Show when={props.secondaryAction}>
+ {(secondary) => (
+ <Button
+ variant="outline"
+ size="sm"
+ class="min-w-0 flex-1"
+ onClick={(event) => secondary().onClick(event.currentTarget)}
+ >
+ {secondary().label}
+ </Button>
+ )}
+ </Show>
+ </div>
+ </ComposerSurface>
+ );
+}
diff --git a/apps/web/src/features/sidebar-promotion/core/promotions.ts b/apps/web/src/features/sidebar-promotion/core/promotions.ts
new file mode 100644
index 0000000000..1e2cd613b4
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/core/promotions.ts
@@ -0,0 +1,67 @@
+import IconGoogleCalendar from '@icon/import/google-calendar.svg';
+import IconGoogleDrive from '@icon/import/google-drive.svg';
+import IconJira from '@icon/import/jira.svg';
+import IconNotion from '@icon/import/notion.svg';
+import IconGithub from '@icon/mcp-github.svg';
+import IconLinear from '@icon/mcp-linear.svg';
+import IconSlack from '@icon/slack-color.svg';
+import type { PromotionLogo } from '../components/logo-stack';
+
+type PromotionCopy = {
+ /** Dismissal key; changing it shows the card again to everyone. */
+ id: string;
+ logos: readonly PromotionLogo[];
+ headline: string;
+ /** Fills one line and most of a second at the default sidebar width. */
+ pitch: string;
+ action: string;
+ secondaryAction?: string;
+};
+
+const logo = (name: string, icon: unknown): PromotionLogo => ({
+ name,
+ icon: icon as PromotionLogo['icon'],
+});
+
+export const HOME_SETUP_PROMOTION = {
+ id: 'home-setup',
+ logos: [
+ logo('Slack', IconSlack),
+ logo('Notion', IconNotion),
+ logo('Linear', IconLinear),
+ logo('GitHub', IconGithub),
+ logo('Google Drive', IconGoogleDrive),
+ logo('Jira', IconJira),
+ ],
+ headline: 'Make Macro your home base',
+ pitch:
+ 'Connect the tools you use every day and invite teammates to work in Macro.',
+ action: 'Connect tools',
+ secondaryAction: 'Invite team',
+} satisfies PromotionCopy;
+
+export const CALENDAR_ACCOUNTS_PROMOTION = {
+ id: 'calendar-accounts',
+ logos: [logo('Google Calendar', IconGoogleCalendar)],
+ headline: 'Connect more calendars',
+ pitch:
+ 'Add another Google account to see work and personal calendars together.',
+ action: 'Connect a calendar',
+ /** Shown instead while one of your accounts lacks calendar access. */
+ enableAction: 'Turn on calendar',
+ /** Shown instead while a calendar grant has expired. */
+ reconnectAction: 'Reconnect calendar',
+} satisfies PromotionCopy & { enableAction: string; reconnectAction: string };
+
+export const PULL_REQUEST_REPOSITORIES_PROMOTION = {
+ id: 'pull-request-repositories',
+ logos: [logo('GitHub', IconGithub)],
+ headline: 'Bring in more repositories',
+ pitch:
+ 'Add more GitHub orgs and repositories to review their pull requests right here.',
+ action: 'Add repositories',
+ /** Shown instead while no GitHub account is linked. */
+ connectAction: 'Connect GitHub',
+ /** Shown instead while the GitHub link has expired. */
+ reconnectAction: 'Reconnect GitHub',
+} satisfies PromotionCopy & { connectAction: string; reconnectAction: string };
diff --git a/apps/web/src/features/sidebar-promotion/core/verdict.test.ts b/apps/web/src/features/sidebar-promotion/core/verdict.test.ts
new file mode 100644
index 0000000000..305b183107
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/core/verdict.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest';
+import { allOf, flagVerdict } from './verdict';
+
+describe('allOf', () => {
+ it('is false once any part is false, even while others load', () => {
+ expect(allOf(true, undefined, false)).toBe(false);
+ });
+
+ it('waits on any unknown part, then is true', () => {
+ expect(allOf(true, undefined)).toBeUndefined();
+ expect(allOf(true, true)).toBe(true);
+ expect(allOf()).toBe(true);
+ });
+});
+
+describe('flagVerdict', () => {
+ it('is unknown until the flag has loaded', () => {
+ expect(flagVerdict({ enabled: false, loading: true })).toBeUndefined();
+ expect(flagVerdict({ enabled: false, loading: false })).toBe(false);
+ expect(flagVerdict({ enabled: true, loading: false })).toBe(true);
+ });
+});
diff --git a/apps/web/src/features/sidebar-promotion/core/verdict.ts b/apps/web/src/features/sidebar-promotion/core/verdict.ts
new file mode 100644
index 0000000000..6e5f9121e0
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/core/verdict.ts
@@ -0,0 +1,20 @@
+/**
+ * Whether a card applies: `true` or `false` once known, `undefined` while an
+ * input (a feature flag, a query) is still loading.
+ */
+export type Verdict = boolean | undefined;
+
+/** `false` as soon as any part is `false`, `true` once every part is `true`. */
+export function allOf(...parts: Verdict[]): Verdict {
+ if (parts.includes(false)) return false;
+ if (parts.includes(undefined)) return undefined;
+ return true;
+}
+
+/** A feature flag read: unknown until PostHog has answered. */
+export function flagVerdict(flag: {
+ enabled: boolean;
+ loading: boolean;
+}): Verdict {
+ return flag.loading ? undefined : flag.enabled;
+}
diff --git a/apps/web/src/features/sidebar-promotion/primitives/last-known.ts b/apps/web/src/features/sidebar-promotion/primitives/last-known.ts
new file mode 100644
index 0000000000..db3effa163
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/primitives/last-known.ts
@@ -0,0 +1,56 @@
+import { makePersistedState } from '@app/lib/persistence';
+import { deepEqual } from '@core/util/compareUtils';
+import { createUserScopedStorage } from '@core/util/userScopedStorage';
+import {
+ type Accessor,
+ createEffect,
+ createSignal,
+ on,
+ untrack,
+} from 'solid-js';
+import type { z } from 'zod';
+
+/**
+ * `current()` once it is known; until then, the value this browser last saw
+ * for the signed-in user. Cards read their flags and queries through this so
+ * a remount (switching views, reloading) renders the settled card at once
+ * instead of waiting on the network. `undefined` only when neither is known.
+ */
+export function createLastKnown<T>(
+ key: string,
+ userId: string | undefined,
+ current: Accessor<T | undefined>,
+ schema: z.ZodType<T>
+): Accessor<T | undefined> {
+ const storage = createUserScopedStorage(
+ `sidebar-promotion:last-known:v1:${key}`
+ );
+ const [last, setLast] = makePersistedState(
+ createSignal<T | undefined>(undefined),
+ {
+ storages: {
+ restore: () => {
+ const raw = userId ? storage.read(userId) : null;
+ if (raw === null) return;
+ const parsed = schema.safeParse(JSON.parse(raw));
+ return parsed.success ? parsed.data : undefined;
+ },
+ write: (value) => {
+ if (userId && value !== undefined)
+ storage.write(userId, JSON.stringify(value));
+ },
+ },
+ }
+ );
+ // Remember each settled value; local storage is the external system here.
+ createEffect(
+ on(current, (value) => {
+ if (value !== undefined && !deepEqual(value, untrack(last)))
+ setLast(() => value);
+ })
+ );
+ return () => {
+ const value = current();
+ return value === undefined ? last() : value;
+ };
+}
diff --git a/apps/web/src/features/sidebar-promotion/primitives/promotion.test.ts b/apps/web/src/features/sidebar-promotion/primitives/promotion.test.ts
new file mode 100644
index 0000000000..4aa118fbe3
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/primitives/promotion.test.ts
@@ -0,0 +1,46 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { hidePromotion, isPromotionHiddenLocally } from './promotion';
+
+const host = vi.hoisted(() => ({ dismiss: vi.fn() }));
+vi.mock('@queries/prompt-dismissals', () => ({
+ dismissPromptEverywhere: host.dismiss,
+}));
+
+beforeEach(() => host.dismiss.mockClear());
+afterEach(() => {
+ vi.unstubAllGlobals();
+ localStorage.clear();
+});
+
+describe('sidebar promotion dismissal', () => {
+ it('dismisses on the server once and mirrors it per user and promotion', () => {
+ hidePromotion('alice', 'import:files');
+ hidePromotion('alice', 'import:files');
+ expect(host.dismiss).toHaveBeenCalledTimes(1);
+ expect(host.dismiss).toHaveBeenCalledWith('import:files');
+ expect(isPromotionHiddenLocally('alice', 'import:files')).toBe(true);
+ expect(
+ localStorage.getItem('sidebar-promotion:v1:import%3Afiles:alice')
+ ).toBe('hidden');
+ expect(isPromotionHiddenLocally('alice', 'calendar')).toBe(false);
+ expect(isPromotionHiddenLocally('bob', 'import:files')).toBe(false);
+ });
+
+ it('restores a previously mirrored dismissal', () => {
+ localStorage.setItem('sidebar-promotion:v1:home:saved', 'hidden');
+ expect(isPromotionHiddenLocally('saved', 'home')).toBe(true);
+ });
+
+ it('still hides in memory when storage is unavailable', () => {
+ vi.stubGlobal('localStorage', undefined);
+ hidePromotion('offline', 'pull-requests');
+ expect(isPromotionHiddenLocally('offline', 'pull-requests')).toBe(true);
+ expect(host.dismiss).toHaveBeenCalledWith('pull-requests');
+ });
+
+ it('ignores an unknown user', () => {
+ hidePromotion(undefined, 'home');
+ expect(host.dismiss).not.toHaveBeenCalled();
+ expect(localStorage.length).toBe(0);
+ });
+});
diff --git a/apps/web/src/features/sidebar-promotion/primitives/promotion.ts b/apps/web/src/features/sidebar-promotion/primitives/promotion.ts
new file mode 100644
index 0000000000..5c1130ace0
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/primitives/promotion.ts
@@ -0,0 +1,41 @@
+import { createUserScopedStorage } from '@core/util/userScopedStorage';
+import { dismissPromptEverywhere } from '@queries/prompt-dismissals';
+import { createSignal } from 'solid-js';
+
+// Dismissals live on the server (see `@queries/prompt-dismissals`) so they
+// follow the user across devices. This local mirror hides a card instantly,
+// keeps it hidden while the server list loads or is unreachable, and keeps
+// every mounted card in sync even when local storage is unavailable.
+const [hiddenScopes, setHiddenScopes] = createSignal<ReadonlySet<string>>(
+ new Set()
+);
+
+function storage(id: string) {
+ return createUserScopedStorage(
+ `sidebar-promotion:v1:${encodeURIComponent(id)}`
+ );
+}
+
+function scope(userId: string, id: string): string {
+ return JSON.stringify([userId, id]);
+}
+
+/** Whether this browser already knows `id` is dismissed for the user. */
+export function isPromotionHiddenLocally(
+ userId: string | undefined,
+ id: string
+): boolean {
+ if (!userId) return false;
+ return (
+ hiddenScopes().has(scope(userId, id)) ||
+ storage(id).read(userId) === 'hidden'
+ );
+}
+
+/** Dismiss everywhere. Used by the close button and by fulfilled prompts. */
+export function hidePromotion(userId: string | undefined, id: string): void {
+ if (!userId || isPromotionHiddenLocally(userId, id)) return;
+ storage(id).write(userId, 'hidden');
+ setHiddenScopes((previous) => new Set(previous).add(scope(userId, id)));
+ dismissPromptEverywhere(id);
+}
diff --git a/apps/web/src/features/sidebar-promotion/sidebar-promotion.test.tsx b/apps/web/src/features/sidebar-promotion/sidebar-promotion.test.tsx
new file mode 100644
index 0000000000..043e7a336d
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/sidebar-promotion.test.tsx
@@ -0,0 +1,171 @@
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { SidebarPromotion } from './sidebar-promotion';
+
+const server = vi.hoisted(() => ({
+ status: 'success' as 'success' | 'pending' | 'error',
+ dismissed: [] as string[],
+ dismiss: vi.fn(),
+}));
+vi.mock('@core/context/user', () => ({ useUserId: () => () => 'user' }));
+vi.mock('@queries/prompt-dismissals', () => ({
+ usePromptDismissalsQuery: () => ({
+ get isSuccess() {
+ return server.status === 'success';
+ },
+ get isError() {
+ return server.status === 'error';
+ },
+ get data() {
+ return { dismissed: server.dismissed };
+ },
+ }),
+ dismissPromptEverywhere: server.dismiss,
+}));
+
+afterEach(() => {
+ cleanup();
+ localStorage.clear();
+ server.status = 'success';
+ server.dismissed = [];
+ server.dismiss.mockClear();
+});
+
+const logos = [{ name: 'GitHub', icon: () => <svg /> }];
+
+describe('SidebarPromotion', () => {
+ it('runs both actions with their buttons and stays dismissed', () => {
+ const action = vi.fn();
+ const secondary = vi.fn();
+ const view = render(() => (
+ <SidebarPromotion
+ id="test"
+ applies
+ logos={logos}
+ headline="Set up"
+ pitch="Do the thing."
+ action={{ label: 'Connect tools', onClick: action }}
+ secondaryAction={{ label: 'Invite team', onClick: secondary }}
+ />
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Connect tools' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Invite team' }));
+ expect(action).toHaveBeenCalledWith(expect.any(HTMLButtonElement));
+ expect(secondary).toHaveBeenCalled();
+ fireEvent.click(
+ screen.getByRole('button', { name: 'Dismiss connect tools' })
+ );
+ expect(screen.queryByText('Set up')).toBeNull();
+ expect(server.dismiss).toHaveBeenCalledWith('test');
+ view.unmount();
+ render(() => (
+ <SidebarPromotion
+ id="test"
+ applies
+ logos={logos}
+ headline="Set up"
+ pitch="Do the thing."
+ action={{ label: 'Connect tools', onClick: action }}
+ />
+ ));
+ expect(screen.queryByText('Set up')).toBeNull();
+ });
+
+ it('hides while it does not apply without recording a dismissal', () => {
+ const [applies, setApplies] = createSignal(false);
+ render(() => (
+ <SidebarPromotion
+ id="satisfied"
+ applies={applies()}
+ logos={logos}
+ headline="More calendars"
+ pitch="Add one."
+ action={{ label: 'Connect', onClick: () => {} }}
+ />
+ ));
+ expect(screen.queryByText('More calendars')).toBeNull();
+ setApplies(true);
+ expect(screen.getByText('More calendars')).toBeTruthy();
+ expect(server.dismiss).not.toHaveBeenCalled();
+ });
+
+ it('stays hidden when another device dismissed it', () => {
+ server.dismissed = ['elsewhere'];
+ render(() => (
+ <SidebarPromotion
+ id="elsewhere"
+ applies
+ logos={logos}
+ headline="Dismissed elsewhere"
+ pitch="Gone."
+ action={{ label: 'Go', onClick: () => {} }}
+ />
+ ));
+ expect(screen.queryByText('Dismissed elsewhere')).toBeNull();
+ });
+
+ it('waits for the server, then falls back to showing on error', () => {
+ server.status = 'pending';
+ const view = render(() => (
+ <SidebarPromotion
+ id="loading"
+ applies
+ logos={logos}
+ headline="Loading card"
+ pitch="Wait."
+ action={{ label: 'Go', onClick: () => {} }}
+ />
+ ));
+ expect(screen.queryByText('Loading card')).toBeNull();
+ view.unmount();
+ server.status = 'error';
+ render(() => (
+ <SidebarPromotion
+ id="loading"
+ applies
+ logos={logos}
+ headline="Loading card"
+ pitch="Wait."
+ action={{ label: 'Go', onClick: () => {} }}
+ />
+ ));
+ expect(screen.getByText('Loading card')).toBeTruthy();
+ });
+
+ it('renders its last decision at once while inputs load', () => {
+ const card = (applies: boolean | undefined) => (
+ <SidebarPromotion
+ id="remembered"
+ applies={applies}
+ logos={logos}
+ headline="Remembered"
+ pitch="Instant."
+ action={{ label: 'Go', onClick: () => {} }}
+ />
+ );
+ // Nothing known yet: stay hidden rather than guess.
+ server.status = 'pending';
+ let view = render(() => card(undefined));
+ expect(screen.queryByText('Remembered')).toBeNull();
+ view.unmount();
+ // Settled as shown, then remounted while flags and dismissals load.
+ server.status = 'success';
+ view = render(() => card(true));
+ expect(screen.getByText('Remembered')).toBeTruthy();
+ view.unmount();
+ server.status = 'pending';
+ view = render(() => card(undefined));
+ expect(screen.getByText('Remembered')).toBeTruthy();
+ view.unmount();
+ // Settled as hidden: a remount while loading must not flash it.
+ server.status = 'success';
+ server.dismissed = ['remembered'];
+ view = render(() => card(true));
+ expect(screen.queryByText('Remembered')).toBeNull();
+ view.unmount();
+ server.status = 'pending';
+ render(() => card(undefined));
+ expect(screen.queryByText('Remembered')).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/sidebar-promotion/sidebar-promotion.tsx b/apps/web/src/features/sidebar-promotion/sidebar-promotion.tsx
new file mode 100644
index 0000000000..4c67541490
--- /dev/null
+++ b/apps/web/src/features/sidebar-promotion/sidebar-promotion.tsx
@@ -0,0 +1,80 @@
+import { useUserId } from '@core/context/user';
+import { usePromptDismissalsQuery } from '@queries/prompt-dismissals';
+import { cn } from '@ui';
+import { type JSX, Show, untrack } from 'solid-js';
+import { z } from 'zod';
+import type { PromotionLogo } from './components/logo-stack';
+import { type PromoAction, PromoCard } from './components/promo-card';
+import { allOf, type Verdict } from './core/verdict';
+import { createLastKnown } from './primitives/last-known';
+import {
+ hidePromotion,
+ isPromotionHiddenLocally,
+} from './primitives/promotion';
+
+export type { PromotionLogo } from './components/logo-stack';
+export type { PromoAction } from './components/promo-card';
+export { allOf, flagVerdict, type Verdict } from './core/verdict';
+
+/**
+ * A view sidebar's dismissible prompt card. Dismissal is stored on the
+ * server under `id`, so it holds on every device; hosts decide whether the
+ * card applies and supply the actions.
+ *
+ * Every remount renders at once: while the host's inputs or the server's
+ * dismissals load, the card keeps what this browser last decided for it, so
+ * a shown card never pops in late and a hidden one never flashes.
+ */
+export function SidebarPromotion(props: {
+ id: string;
+ /**
+ * Whether the card applies (rollout flags on, goal not yet met):
+ * `undefined` while the host's flags or queries load.
+ */
+ applies: Verdict;
+ logos: readonly PromotionLogo[];
+ headline: string;
+ pitch: string;
+ action: PromoAction;
+ secondaryAction?: PromoAction;
+ /** Defaults to "Dismiss <action label>". */
+ dismissLabel?: string;
+ class?: string;
+}): JSX.Element {
+ const userId = useUserId();
+ const dismissals = usePromptDismissalsQuery();
+ // An unreachable server falls back to what this browser remembers.
+ const dismissed = (): Verdict => {
+ if (isPromotionHiddenLocally(userId(), props.id)) return true;
+ if (dismissals.isError) return false;
+ if (!dismissals.isSuccess) return undefined;
+ return dismissals.data.dismissed.includes(props.id);
+ };
+ const shown = createLastKnown(
+ `shown:${untrack(() => props.id)}`,
+ untrack(userId),
+ () =>
+ allOf(
+ props.applies,
+ dismissed() === undefined ? undefined : !dismissed()
+ ),
+ z.boolean()
+ );
+ return (
+ <Show when={shown()}>
+ <div class={cn('shrink-0', props.class)}>
+ <PromoCard
+ logos={props.logos}
+ headline={props.headline}
+ pitch={props.pitch}
+ action={props.action}
+ secondaryAction={props.secondaryAction}
+ dismissLabel={
+ props.dismissLabel ?? `Dismiss ${props.action.label.toLowerCase()}`
+ }
+ onDismiss={() => hidePromotion(userId(), props.id)}
+ />
+ </div>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/slack-import/primitives/promotion.test.ts b/apps/web/src/features/slack-import/primitives/promotion.test.ts
deleted file mode 100644
index 0b68f4b8ea..0000000000
--- a/apps/web/src/features/slack-import/primitives/promotion.test.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest';
-import {
- hideSlackImportPromotion,
- isSlackImportPromotionHidden,
-} from './promotion';
-
-afterEach(() => {
- vi.unstubAllGlobals();
- localStorage.clear();
-});
-
-describe('Slack import promotion persistence', () => {
- it('persists dismissal and isolates users and teams', () => {
- hideSlackImportPromotion('alice', 'team-one');
- expect(isSlackImportPromotionHidden('alice', 'team-one')).toBe(true);
- expect(
- localStorage.getItem('slack-import-promotion:v1:team-one:alice')
- ).toBe('hidden');
- expect(isSlackImportPromotionHidden('bob', 'team-one')).toBe(false);
- expect(isSlackImportPromotionHidden('alice', 'team-two')).toBe(false);
- });
-
- it('restores a previously saved dismissal', () => {
- localStorage.setItem('slack-import-promotion:v1:saved:user', 'hidden');
- expect(isSlackImportPromotionHidden('user', 'saved')).toBe(true);
- });
-
- it('continues to hide in memory when storage is unavailable', () => {
- vi.stubGlobal('localStorage', undefined);
- hideSlackImportPromotion('offline', 'team');
- expect(isSlackImportPromotionHidden('offline', 'team')).toBe(true);
- });
-
- it('does not persist an unknown user or team', () => {
- hideSlackImportPromotion(undefined, 'team');
- hideSlackImportPromotion('unknown', undefined);
- expect(isSlackImportPromotionHidden(undefined, 'team')).toBe(false);
- expect(isSlackImportPromotionHidden('unknown', undefined)).toBe(false);
- expect(localStorage.length).toBe(0);
- });
-});
diff --git a/apps/web/src/features/slack-import/primitives/promotion.ts b/apps/web/src/features/slack-import/primitives/promotion.ts
deleted file mode 100644
index 8da629e281..0000000000
--- a/apps/web/src/features/slack-import/primitives/promotion.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { createUserScopedStorage } from '@core/util/userScopedStorage';
-import { createSignal } from 'solid-js';
-
-// Keep mounted sidebars in sync, including when local storage is unavailable.
-const [hiddenScopes, setHiddenScopes] = createSignal<ReadonlySet<string>>(
- new Set()
-);
-
-function storage(teamId: string) {
- return createUserScopedStorage(
- `slack-import-promotion:v1:${encodeURIComponent(teamId)}`
- );
-}
-
-export function isSlackImportPromotionHidden(
- userId: string | undefined,
- teamId: string | undefined
-): boolean {
- if (!userId || !teamId) return false;
- return (
- hiddenScopes().has(JSON.stringify([userId, teamId])) ||
- storage(teamId).read(userId) === 'hidden'
- );
-}
-
-/** Used by both explicit dismissal and confirmed import completion. */
-export function hideSlackImportPromotion(
- userId: string | undefined,
- teamId: string | undefined
-): void {
- if (!userId || !teamId || isSlackImportPromotionHidden(userId, teamId))
- return;
- storage(teamId).write(userId, 'hidden');
- setHiddenScopes((previous) =>
- new Set(previous).add(JSON.stringify([userId, teamId]))
- );
-}
diff --git a/apps/web/src/features/slack-import/slack-import-sidebar.test.tsx b/apps/web/src/features/slack-import/slack-import-sidebar.test.tsx
index d27dde1eed..d29a435120 100644
--- a/apps/web/src/features/slack-import/slack-import-sidebar.test.tsx
+++ b/apps/web/src/features/slack-import/slack-import-sidebar.test.tsx
@@ -1,81 +1,64 @@
-import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { createSignal, type JSX } from 'solid-js';
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { hideSlackImportPromotion } from './primitives/promotion';
import { SlackImportSidebar } from './slack-import-sidebar';
-const [userId, setUserId] = createSignal('');
-const [teamId, setTeamId] = createSignal('');
-let scope = 0;
-const host = vi.hoisted(() => ({ enabled: true, admin: true }));
+const host = vi.hoisted(() => ({
+ enabled: true,
+ admin: true,
+ openHistory: vi.fn(),
+ promotion: undefined as
+ | undefined
+ | {
+ category: string;
+ applies: boolean | undefined;
+ alternatives: { label: string; onSelect(opener?: unknown): void }[];
+ },
+ slackImport: undefined as undefined | { historyOnly?: boolean },
+}));
vi.mock('@app/lib/analytics/posthog', () => ({
useFeatureFlag: () => () => ({ enabled: host.enabled }),
}));
-vi.mock('@core/context/user', () => ({ useUserId: () => userId }));
vi.mock('@queries/team/teams', () => ({
useIsTeamAdmin: () => () => host.admin,
- useCurrentTeamQuery: () => ({
- isSuccess: true,
- get data() {
- return { team: { id: teamId() } };
- },
- }),
-}));
-vi.mock('@ui', () => ({
- Button: (props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) => (
- <button {...props} />
- ),
+ useCurrentTeamQuery: () => ({ isSuccess: true, data: { team: { id: 't' } } }),
}));
vi.mock('./slack-import', () => ({
- SlackImport: (props: { trigger: (open: () => void) => JSX.Element }) => (
- <>
- {props.trigger(() => {})}
- <p>Import dialog host</p>
- </>
- ),
+ SlackImport: (props: {
+ historyOnly?: boolean;
+ trigger: (open: (opener: unknown) => void) => JSX.Element;
+ }) => {
+ host.slackImport = props;
+ return <>{props.trigger(host.openHistory)}</>;
+ },
+}));
+vi.mock('@app/features/connector-import/connector-import', () => ({
+ ConnectorImportPromotion: (props: NonNullable<typeof host.promotion>) => {
+ host.promotion = props;
+ return props.applies ? <p>Shared import card</p> : null;
+ },
}));
beforeEach(() => {
- scope += 1;
- setUserId(`sidebar-user-${scope}`);
- setTeamId(`sidebar-team-${scope}`);
host.enabled = true;
host.admin = true;
+ host.promotion = undefined;
+ host.slackImport = undefined;
+ host.openHistory.mockReset();
});
-afterEach(() => {
- cleanup();
- localStorage.clear();
-});
+afterEach(cleanup);
describe('Slack import sidebar', () => {
- it('dismisses, stays dismissed after remount, and retains the import host', () => {
- const view = render(() => <SlackImportSidebar />);
- fireEvent.click(
- screen.getByRole('button', { name: 'Dismiss Slack import' })
- );
- expect(
- screen.queryByRole('button', { name: 'Import from Slack' })
- ).toBeNull();
- expect(screen.getByText('Import dialog host')).toBeTruthy();
- view.unmount();
- render(() => <SlackImportSidebar />);
- expect(screen.queryByText('Bring Slack to Macro')).toBeNull();
- setTeamId('another-team');
- expect(
- screen.getByRole('button', { name: 'Import from Slack' })
- ).toBeTruthy();
- setTeamId(`sidebar-team-${scope}`);
- setUserId('another-user');
- expect(
- screen.getByRole('button', { name: 'Import from Slack' })
- ).toBeTruthy();
- });
-
- it('hides immediately after completion without unmounting import progress', () => {
+ it('renders the shared channels card with history import as its alternative', async () => {
render(() => <SlackImportSidebar />);
- hideSlackImportPromotion(userId(), teamId());
- expect(screen.queryByText('Bring Slack to Macro')).toBeNull();
- expect(screen.getByText('Import dialog host')).toBeTruthy();
+ expect(screen.getByText('Shared import card')).toBeTruthy();
+ expect(host.promotion?.category).toBe('channels');
+ // The archive dialog loads behind the card.
+ await vi.waitFor(() => expect(host.slackImport?.historyOnly).toBe(true));
+ expect(host.promotion?.alternatives[0]?.label).toBe('Import with history');
+ const opener = document.createElement('button');
+ host.promotion?.alternatives[0]?.onSelect(opener);
+ expect(host.openHistory).toHaveBeenCalledWith(opener);
});
it.each([
@@ -84,6 +67,6 @@ describe('Slack import sidebar', () => {
])('preserves the feature and admin gates: %o', (gate) => {
Object.assign(host, gate);
render(() => <SlackImportSidebar />);
- expect(screen.queryByText('Bring Slack to Macro')).toBeNull();
+ expect(screen.queryByText('Shared import card')).toBeNull();
});
});
diff --git a/apps/web/src/features/slack-import/slack-import-sidebar.tsx b/apps/web/src/features/slack-import/slack-import-sidebar.tsx
index e32a7a2af8..53444012a5 100644
--- a/apps/web/src/features/slack-import/slack-import-sidebar.tsx
+++ b/apps/web/src/features/slack-import/slack-import-sidebar.tsx
@@ -1,70 +1,68 @@
+import { ConnectorImportPromotion } from '@app/features/connector-import/connector-import';
+import {
+ allOf,
+ flagVerdict,
+} from '@app/features/sidebar-promotion/sidebar-promotion';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { enableSlackArchiveImport } from '@core/constant/featureFlags';
-import { useUserId } from '@core/context/user';
-import SlackIcon from '@icon/slack-color.svg';
-import XIcon from '@phosphor/x.svg';
+import { lazyNamed } from '@core/util/lazyNamed';
+import FileZipIcon from '@phosphor/file-zip.svg';
import { useCurrentTeamQuery, useIsTeamAdmin } from '@queries/team/teams';
-import { Button } from '@ui';
-import { Show } from 'solid-js';
-import {
- hideSlackImportPromotion,
- isSlackImportPromotionHidden,
-} from './primitives/promotion';
-import { SlackImport } from './slack-import';
+import { Show, Suspense } from 'solid-js';
+
+// The archive dialog's code loads behind the card, which renders at once.
+const SlackImport = lazyNamed(() => import('./slack-import'), 'SlackImport');
+/**
+ * The Channels rail's Slack card: the shared connector-import card, whose
+ * dialog picks channels through the Slack connector and hands history
+ * imports to the archive dialog.
+ */
export function SlackImportSidebar() {
const flag = useFeatureFlag(enableSlackArchiveImport);
const team = useCurrentTeamQuery(() => flag().enabled);
const isAdmin = useIsTeamAdmin();
- const userId = useUserId();
const teamId = () => (team.isSuccess ? team.data?.team.id : undefined);
+ let openHistory: ((opener: HTMLButtonElement) => void) | undefined;
return (
- <Show when={flag().enabled && isAdmin() && teamId()}>
- {(id) => (
- <SlackImport
- teamId={id()}
- isAdmin={isAdmin()}
- trigger={(onOpen) => (
- <Show when={!isSlackImportPromotionHidden(userId(), id())}>
- <div class="px-(--sidebar-gutter) py-2">
- <section class="w-full rounded-xl border border-edge-muted bg-control px-2 py-3">
- <div class="flex items-start gap-2.5">
- <SlackIcon
- aria-hidden="true"
- class="mt-0.5 size-4 shrink-0"
- />
- <div class="min-w-0 flex-1">
- <h2 class="text-xs font-medium text-ink">
- Bring Slack to Macro
- </h2>
- <p class="mt-1 text-xs leading-relaxed text-ink-muted">
- Bring over channels with or without message history.
- </p>
- </div>
- <Button
- variant="ghost"
- size="icon-sm"
- aria-label="Dismiss Slack import"
- onClick={() => hideSlackImportPromotion(userId(), id())}
- >
- <XIcon class="size-3.5" aria-hidden="true" />
- </Button>
- </div>
- <Button
- variant="outline"
- size="sm"
- class="mt-3 w-full"
- onClick={(event) => onOpen(event.currentTarget)}
- >
- Import from Slack
- </Button>
- </section>
- </div>
- </Show>
- )}
- />
- )}
- </Show>
+ <>
+ <Show when={flag().enabled && isAdmin() && teamId()}>
+ {(id) => (
+ <Suspense>
+ <SlackImport
+ teamId={id()}
+ isAdmin={isAdmin()}
+ historyOnly
+ trigger={(open) => {
+ // The archive dialog has no button of its own here; the
+ // card's "Import with history" option opens it.
+ openHistory = open;
+ return null;
+ }}
+ />
+ </Suspense>
+ )}
+ </Show>
+ <ConnectorImportPromotion
+ category="channels"
+ class="px-(--sidebar-gutter) py-2"
+ applies={allOf(
+ flagVerdict(flag()),
+ team.isSuccess ? isAdmin() && !!teamId() : undefined
+ )}
+ alternatives={[
+ {
+ icon: FileZipIcon,
+ label: 'Import with history',
+ description:
+ 'Upload a Slack export from a workspace owner or admin.',
+ onSelect: (opener) => {
+ if (opener) openHistory?.(opener);
+ },
+ },
+ ]}
+ />
+ </>
);
}
diff --git a/apps/web/src/features/slack-import/slack-import.test.tsx b/apps/web/src/features/slack-import/slack-import.test.tsx
index d1272ff17d..82923ab061 100644
--- a/apps/web/src/features/slack-import/slack-import.test.tsx
+++ b/apps/web/src/features/slack-import/slack-import.test.tsx
@@ -33,8 +33,8 @@ vi.mock('@core/constant/SettingsState', () => ({
useSettingsState: () => ({ openSettings: host.openSettings }),
}));
vi.mock('@core/context/user', () => ({ useUserId: () => () => 'me' }));
-vi.mock('./primitives/promotion', () => ({
- hideSlackImportPromotion: host.hidePromotion,
+vi.mock('@app/features/connector-import/primitives/promotion', () => ({
+ hideImportPromotion: host.hidePromotion,
}));
vi.mock('@core/pipedream/flag', () => ({
usePipedreamMcpFlag: () => () => true,
@@ -156,7 +156,7 @@ describe('Slack import production boundary', () => {
await expect(
host.props!.onCompleted(importReceipt({ status: 'completed' }))
).rejects.toThrow('Refresh failed');
- expect(host.hidePromotion).toHaveBeenCalledWith('me', 'team');
+ expect(host.hidePromotion).toHaveBeenCalledWith('me', 'channels');
});
it('hides after a partial import with a completed channel', async () => {
@@ -167,6 +167,6 @@ describe('Slack import production boundary', () => {
...job,
conversations: [{ ...job.conversations[0], status: 'completed' }],
});
- expect(host.hidePromotion).toHaveBeenCalledWith('me', 'team');
+ expect(host.hidePromotion).toHaveBeenCalledWith('me', 'channels');
});
});
diff --git a/apps/web/src/features/slack-import/slack-import.tsx b/apps/web/src/features/slack-import/slack-import.tsx
index 984061f8ad..00a2003bb6 100644
--- a/apps/web/src/features/slack-import/slack-import.tsx
+++ b/apps/web/src/features/slack-import/slack-import.tsx
@@ -1,3 +1,4 @@
+import { hideImportPromotion } from '@app/features/connector-import/primitives/promotion';
import { IntegrationRow } from '@app/features/settings/primitives';
import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { enableSlackArchiveImport } from '@core/constant/featureFlags';
@@ -23,7 +24,6 @@ import { uploadSlackImport } from '@service-storage/slack-import-upload';
import { type JSX, Show, Suspense } from 'solid-js';
import type { ImportJob } from './context/contracts';
import { ImportProvider } from './context/import-context';
-import { hideSlackImportPromotion } from './primitives/promotion';
import {
createArchiveSource,
protectImportFile,
@@ -35,6 +35,8 @@ type Props = {
teamId: string;
isAdmin: boolean;
trigger?: ImportDialogTrigger;
+ /** Open straight to the archive upload; the host offers channel picking. */
+ historyOnly?: boolean;
};
export function SlackImport(props: Props): JSX.Element {
@@ -45,15 +47,23 @@ export function SlackImport(props: Props): JSX.Element {
{(teamId) => (
<Suspense
fallback={
- <IntegrationRow
- icon={<SlackIcon />}
- title="Slack"
- description="Loading Slack import…"
- muted
- />
+ // A host-supplied trigger lives elsewhere (the Chat rail card);
+ // only the Settings row has a loading placeholder.
+ props.trigger ? null : (
+ <IntegrationRow
+ icon={<SlackIcon />}
+ title="Slack"
+ description="Loading Slack import…"
+ muted
+ />
+ )
}
>
- <SlackImportSettings teamId={teamId} trigger={props.trigger} />
+ <SlackImportSettings
+ teamId={teamId}
+ trigger={props.trigger}
+ historyOnly={props.historyOnly}
+ />
</Suspense>
)}
</Show>
@@ -64,6 +74,7 @@ export function SlackImport(props: Props): JSX.Element {
function SlackImportSettings(props: {
teamId: string;
trigger?: ImportDialogTrigger;
+ historyOnly?: boolean;
}): JSX.Element {
const channels = useListChannelsQuery();
const userId = useUserId();
@@ -90,7 +101,7 @@ function SlackImportSettings(props: {
(conversation) => conversation.status === 'completed'
))
) {
- hideSlackImportPromotion(userId(), job.teamId);
+ hideImportPromotion(userId(), 'channels');
}
invalidateAllSoup();
await Promise.all([
@@ -119,7 +130,9 @@ function SlackImportSettings(props: {
<ImportDialog
teamId={props.teamId}
trigger={props.trigger}
- onConnect={pipedreamEnabled() ? connectSlack : undefined}
+ onConnect={
+ pipedreamEnabled() && !props.historyOnly ? connectSlack : undefined
+ }
onCompleted={onCompleted}
channelHref={channelHref}
/>
diff --git a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
index 4b28a4d253..4e94613ed8 100644
--- a/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
+++ b/apps/web/src/features/tasks-view/components/TasksSidebar.tsx
@@ -4,6 +4,7 @@ import {
ViewSidebar,
} from '@app/components/view-shell';
import { SidebarCreateHeader } from '@app/components/view-shell/SidebarCreateButton';
+import { ConnectorImportSidebar } from '@app/features/connector-import/connector-import';
import { FavoriteContextMenu } from '@app/features/favorites/FavoriteContextMenu';
import { FavoriteIcon } from '@app/features/favorites/FavoriteIcon';
import { openProject } from '@app/features/projects/open-project';
@@ -209,6 +210,7 @@ export function TasksSidebar() {
}}
/>
</Show>
+ <ConnectorImportSidebar category="tasks" class="mt-auto" />
</ViewSidebar.Content>
</ViewSidebar.Root>
);
diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.ts
index 6cbbc59d91..603e6b0df0 100644
--- a/apps/web/src/lib/core/constant/featureFlags.ts
+++ b/apps/web/src/lib/core/constant/featureFlags.ts
@@ -157,6 +157,13 @@ export const enableSlackArchiveImport = defineFlag({
default: onInDev,
});
+/** Sidebar prompt cards: imports, calendars, repositories, and Home setup. */
+export const enableSidebarPromotions = defineFlag({
+ key: 'enable-sidebar-promotions',
+ env: 'ENABLE_SIDEBAR_PROMOTIONS',
+ default: onInDev,
+});
+
/** Shows the Reviews shortcut in Tasks; copied Reviews links remain accessible. */
export const enableTasksReviews = defineFlag({
key: 'enable-tasks-reviews',
diff --git a/apps/web/src/lib/core/pipedream/flag.ts b/apps/web/src/lib/core/pipedream/flag.ts
index f650fe9280..b07a407c70 100644
--- a/apps/web/src/lib/core/pipedream/flag.ts
+++ b/apps/web/src/lib/core/pipedream/flag.ts
@@ -24,10 +24,15 @@ export const PIPEDREAM_MCP_OVERRIDE =
getFeatureFlagOverride('ENABLE_PIPEDREAM_MCP') ??
(DEV_MODE_ENV ? true : undefined);
-/** Whether this user sees the Pipedream connector frontend. */
-export function usePipedreamMcpFlag(): Accessor<boolean> {
- const flag = useFeatureFlag(PIPEDREAM_MCP_FLAG, {
+/** The Pipedream flag with its loading state, for gates that must not guess. */
+export function usePipedreamMcpFlagResult() {
+ return useFeatureFlag(PIPEDREAM_MCP_FLAG, {
enabledOverride: PIPEDREAM_MCP_OVERRIDE,
});
+}
+
+/** Whether this user sees the Pipedream connector frontend. */
+export function usePipedreamMcpFlag(): Accessor<boolean> {
+ const flag = usePipedreamMcpFlagResult();
return () => flag().enabled;
}
diff --git a/apps/web/src/lib/queries/prompt-dismissals.test.tsx b/apps/web/src/lib/queries/prompt-dismissals.test.tsx
new file mode 100644
index 0000000000..e3cd86dfab
--- /dev/null
+++ b/apps/web/src/lib/queries/prompt-dismissals.test.tsx
@@ -0,0 +1,75 @@
+import { queryClient } from '@queries/client';
+import { cleanup, render, waitFor } from '@solidjs/testing-library';
+import { QueryClientProvider } from '@tanstack/solid-query';
+import { errAsync, okAsync } from 'neverthrow';
+import { createSignal, type JSX } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import {
+ usePromptDismissalsQuery,
+ useWarmPromptDismissals,
+} from './prompt-dismissals';
+
+const server = vi.hoisted(() => ({ list: vi.fn() }));
+vi.mock('@queries/client', async () => {
+ const { QueryClient } = await import('@tanstack/solid-query');
+ return { queryClient: new QueryClient() };
+});
+vi.mock('@service-cognition/prompt-dismissals', () => ({
+ promptDismissalsClient: { list: server.list, dismiss: vi.fn() },
+}));
+
+afterEach(() => {
+ cleanup();
+ queryClient.clear();
+ server.list.mockReset();
+});
+
+function app(children: () => JSX.Element) {
+ function Warm() {
+ useWarmPromptDismissals(() => 'user');
+ return null;
+ }
+ return render(() => (
+ <QueryClientProvider client={queryClient}>
+ <Warm />
+ {children()}
+ </QueryClientProvider>
+ ));
+}
+
+describe('prompt dismissals', () => {
+ it('fails fast, and a card mounted later reads the failure without refetching', async () => {
+ server.list.mockReturnValue(errAsync([{ code: 'NOT_FOUND' }]));
+ const [mounted, setMounted] = createSignal(false);
+ let status = '';
+ function Card() {
+ const query = usePromptDismissalsQuery();
+ status = query.status;
+ return null;
+ }
+ app(() => (mounted() ? <Card /> : null));
+ await waitFor(() => expect(server.list).toHaveBeenCalledTimes(1));
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ setMounted(true);
+ expect(status).toBe('error');
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ expect(server.list).toHaveBeenCalledTimes(1);
+ });
+
+ it('serves the loaded list to a card at once', async () => {
+ server.list.mockReturnValue(okAsync({ dismissed: ['home-setup'] }));
+ const [mounted, setMounted] = createSignal(false);
+ let dismissed: string[] | undefined;
+ function Card() {
+ const query = usePromptDismissalsQuery();
+ dismissed = query.isSuccess ? query.data.dismissed : undefined;
+ return null;
+ }
+ app(() => (mounted() ? <Card /> : null));
+ await waitFor(() => expect(server.list).toHaveBeenCalledTimes(1));
+ await new Promise((resolve) => setTimeout(resolve, 20));
+ setMounted(true);
+ expect(dismissed).toEqual(['home-setup']);
+ expect(server.list).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/apps/web/src/lib/queries/prompt-dismissals.ts b/apps/web/src/lib/queries/prompt-dismissals.ts
new file mode 100644
index 0000000000..d3f5fe3c10
--- /dev/null
+++ b/apps/web/src/lib/queries/prompt-dismissals.ts
@@ -0,0 +1,73 @@
+/**
+ * Sidebar prompts the user dismissed, stored server-side so a dismissal holds
+ * on every device. Dismissing updates the cache optimistically; a failed
+ * write refetches the server's answer.
+ */
+import { fireAndForget } from '@core/util/fireAndForget';
+import { throwOnErr } from '@core/util/result';
+import { queryClient } from '@queries/client';
+import {
+ type DismissedPrompts,
+ promptDismissalsClient,
+} from '@service-cognition/prompt-dismissals';
+import { useQuery } from '@tanstack/solid-query';
+import { type Accessor, createEffect, on } from 'solid-js';
+
+const KEY = ['promptDismissals'] as const;
+
+function fetchDismissedPrompts() {
+ return throwOnErr(() => promptDismissalsClient.list());
+}
+
+function promptDismissalsQueryOptions() {
+ return {
+ queryKey: KEY,
+ queryFn: fetchDismissedPrompts,
+ staleTime: 5 * 60 * 1000,
+ // Cards fall back to what the browser remembers when the list is
+ // unavailable, so a retry would only hold them back.
+ retry: false,
+ };
+}
+
+/**
+ * The list as a card reads it. The app-level observer below loads it, so a
+ * card mounting never refetches: an answer, or a failure that falls back to
+ * the browser's own record, is available at once.
+ */
+export function usePromptDismissalsQuery() {
+ return useQuery(() => ({
+ ...promptDismissalsQueryOptions(),
+ refetchOnMount: false,
+ retryOnMount: false,
+ }));
+}
+
+/**
+ * Loads the list once the user is known and keeps it cached for the session,
+ * so a sidebar card never waits on it when its view opens.
+ */
+export function useWarmPromptDismissals(userId: Accessor<string | undefined>) {
+ // The shared cache is the external system here; nothing renders from it.
+ createEffect(
+ on(userId, (id) => {
+ if (id) queryClient.prefetchQuery(promptDismissalsQueryOptions());
+ })
+ );
+}
+
+/** Dismiss `promptId` on every device. */
+export function dismissPromptEverywhere(promptId: string): void {
+ queryClient.setQueryData(KEY, (current: DismissedPrompts | undefined) =>
+ current?.dismissed.includes(promptId)
+ ? current
+ : { dismissed: [...(current?.dismissed ?? []), promptId] }
+ );
+ fireAndForget(saveDismissal(promptId), 'prompt-dismissals.dismiss');
+}
+
+/** A failed write refetches the server's answer instead of keeping the guess. */
+async function saveDismissal(promptId: string) {
+ const result = await promptDismissalsClient.dismiss(promptId);
+ if (result.isErr()) queryClient.invalidateQueries({ queryKey: KEY });
+}
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/client.ts b/apps/web/src/lib/service-clients/service-cognition/generated/client.ts
index 2958507035..cc87c21f48 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/client.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/client.ts
@@ -20,6 +20,7 @@ import type {
DecisionResponse,
DeleteMcpServerParams,
DeletePipedreamMcpConnectionParams,
+ DismissedPrompts,
DocumentTextPart,
ErrorBody,
ErrorResponse,
@@ -2101,6 +2102,115 @@ export const completeHandler = async (
} as completeHandlerResponse;
};
+/**
+ * @summary List the sidebar prompts the authenticated user dismissed on any device.
+ */
+export type dismissedPromptsHandlerResponse200 = {
+ data: DismissedPrompts;
+ status: 200;
+};
+
+export type dismissedPromptsHandlerResponse500 = {
+ data: void;
+ status: 500;
+};
+
+export type dismissedPromptsHandlerResponseSuccess =
+ dismissedPromptsHandlerResponse200 & {
+ headers: Headers;
+ };
+export type dismissedPromptsHandlerResponseError =
+ dismissedPromptsHandlerResponse500 & {
+ headers: Headers;
+ };
+
+export type dismissedPromptsHandlerResponse =
+ | dismissedPromptsHandlerResponseSuccess
+ | dismissedPromptsHandlerResponseError;
+
+export const getDismissedPromptsHandlerUrl = () => {
+ return `/onboarding/prompts`;
+};
+
+export const dismissedPromptsHandler = async (
+ options?: RequestInit
+): Promise<dismissedPromptsHandlerResponse> => {
+ const res = await fetch(getDismissedPromptsHandlerUrl(), {
+ ...options,
+ method: 'GET',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: dismissedPromptsHandlerResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as dismissedPromptsHandlerResponse;
+};
+
+/**
+ * @summary Dismiss one sidebar prompt for the authenticated user, on every device.
+Idempotent.
+ */
+export type dismissPromptHandlerResponse204 = {
+ data: void;
+ status: 204;
+};
+
+export type dismissPromptHandlerResponse400 = {
+ data: void;
+ status: 400;
+};
+
+export type dismissPromptHandlerResponse500 = {
+ data: void;
+ status: 500;
+};
+
+export type dismissPromptHandlerResponseSuccess =
+ dismissPromptHandlerResponse204 & {
+ headers: Headers;
+ };
+export type dismissPromptHandlerResponseError = (
+ | dismissPromptHandlerResponse400
+ | dismissPromptHandlerResponse500
+) & {
+ headers: Headers;
+};
+
+export type dismissPromptHandlerResponse =
+ | dismissPromptHandlerResponseSuccess
+ | dismissPromptHandlerResponseError;
+
+export const getDismissPromptHandlerUrl = (promptId: string) => {
+ return `/onboarding/prompts/${promptId}/dismiss`;
+};
+
+export const dismissPromptHandler = async (
+ promptId: string,
+ options?: RequestInit
+): Promise<dismissPromptHandlerResponse> => {
+ const res = await fetch(getDismissPromptHandlerUrl(promptId), {
+ ...options,
+ method: 'POST',
+ });
+
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
+
+ const data: dismissPromptHandlerResponse['data'] = body
+ ? JSON.parse(body)
+ : {};
+ return {
+ data,
+ status: res.status,
+ headers: res.headers,
+ } as dismissPromptHandlerResponse;
+};
+
/**
* Results come from Pipedream's app directory, most popular first.
* @summary Browse or search the catalog of connectable apps.
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/dismissedPrompts.ts b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/dismissedPrompts.ts
new file mode 100644
index 0000000000..f42cc6babd
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/dismissedPrompts.ts
@@ -0,0 +1,14 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * Document Cognition Service
+ * OpenAPI spec version: 1.0.0
+ */
+
+/**
+ * The prompts the user dismissed, on any device.
+ */
+export interface DismissedPrompts {
+ /** Dismissed prompt ids, oldest dismissal first. */
+ dismissed: string[];
+}
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts
index 90541935bb..aa77045836 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/index.ts
@@ -108,6 +108,7 @@ export * from './decisionResponse';
export * from './decisionResponseProbabilities';
export * from './deleteMcpServerParams';
export * from './deletePipedreamMcpConnectionParams';
+export * from './dismissedPrompts';
export * from './documentCognitionServiceApiVersion';
export * from './documentReference';
export * from './documentReferenceOneOf';
diff --git a/apps/web/src/lib/service-clients/service-cognition/openapi.json b/apps/web/src/lib/service-clients/service-cognition/openapi.json
index eb6a220fba..34ef75823b 100644
--- a/apps/web/src/lib/service-clients/service-cognition/openapi.json
+++ b/apps/web/src/lib/service-clients/service-cognition/openapi.json
@@ -1212,7 +1212,7 @@
"description": "Discovery accepted (idempotent)"
},
"400": {
- "description": "Unknown import source or discovery not supported"
+ "description": "Unknown import source"
},
"500": {
"description": "Internal server error"
@@ -1725,6 +1725,57 @@
}
}
},
+ "/onboarding/prompts": {
+ "get": {
+ "tags": ["onboarding"],
+ "summary": "List the sidebar prompts the authenticated user dismissed on any device.",
+ "operationId": "dismissed_prompts_handler",
+ "responses": {
+ "200": {
+ "description": "Dismissed prompt ids",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DismissedPrompts"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/onboarding/prompts/{prompt_id}/dismiss": {
+ "post": {
+ "tags": ["onboarding"],
+ "summary": "Dismiss one sidebar prompt for the authenticated user, on every device.\nIdempotent.",
+ "operationId": "dismiss_prompt_handler",
+ "parameters": [
+ {
+ "name": "prompt_id",
+ "in": "path",
+ "description": "Prompt id, e.g. `import:files`",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Dismissed"
+ },
+ "400": {
+ "description": "Malformed prompt id"
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
"/pipedream/mcp/catalog": {
"get": {
"tags": ["pipedream-mcp"],
@@ -3219,6 +3270,20 @@
}
}
},
+ "DismissedPrompts": {
+ "type": "object",
+ "description": "The prompts the user dismissed, on any device.",
+ "required": ["dismissed"],
+ "properties": {
+ "dismissed": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "Dismissed prompt ids, oldest dismissal first."
+ }
+ }
+ },
"DocumentCognitionServiceApiVersion": {
"type": "string",
"enum": ["v1", "v2"]
diff --git a/apps/web/src/lib/service-clients/service-cognition/prompt-dismissals.ts b/apps/web/src/lib/service-clients/service-cognition/prompt-dismissals.ts
new file mode 100644
index 0000000000..59b4b6ca25
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-cognition/prompt-dismissals.ts
@@ -0,0 +1,29 @@
+/**
+ * Client for dismissed sidebar prompts on the document cognition service
+ * (the onboarding crate's `/onboarding/prompts` routes).
+ */
+import { SERVER_HOSTS } from '@core/constant/servers';
+import { fetchWithToken } from '@core/util/fetchWithToken';
+import type { DismissedPrompts } from './generated/schemas/dismissedPrompts';
+
+export type { DismissedPrompts };
+
+const dcsHost: string = SERVER_HOSTS['cognition-service'];
+
+export const promptDismissalsClient = {
+ /** The prompts the user dismissed on any device. */
+ async list() {
+ return await fetchWithToken<DismissedPrompts>(
+ `${dcsHost}/onboarding/prompts`,
+ { method: 'GET' }
+ );
+ },
+
+ /** Dismiss one prompt everywhere (idempotent). */
+ async dismiss(promptId: string) {
+ return await fetchWithToken(
+ `${dcsHost}/onboarding/prompts/${encodeURIComponent(promptId)}/dismiss`,
+ { method: 'POST' }
+ );
+ },
+};
diff --git a/crates/agent_code_mode/src/domain/operations.json b/crates/agent_code_mode/src/domain/operations.json
index 62af1e5280..4a471e44fd 100644
--- a/crates/agent_code_mode/src/domain/operations.json
+++ b/crates/agent_code_mode/src/domain/operations.json
@@ -191,6 +191,8 @@
"cognition.getMemoryHandler": "Get Memory",
"cognition.getStateHandler2": "Get State Handler2",
"cognition.completeHandler": "Complete",
+ "cognition.dismissedPromptsHandler": "Dismissed Prompts",
+ "cognition.dismissPromptHandler": "Dismiss Prompt",
"cognition.browsePipedreamMcpCatalog": "Browse Pipedream Mcp Catalog",
"cognition.completePipedreamMcpConnection": "Complete Pipedream Mcp Connection",
"cognition.deletePipedreamMcpConnection": "Delete Pipedream Mcp Connection",
diff --git a/crates/code_execution/src/outbound/deno/sdk.mjs b/crates/code_execution/src/outbound/deno/sdk.mjs
index 9db0f98649..8c2489618c 100644
--- a/crates/code_execution/src/outbound/deno/sdk.mjs
+++ b/crates/code_execution/src/outbound/deno/sdk.mjs
@@ -19,7 +19,7 @@ async function bO($,O,j){if(!Number.isInteger(O)||O<1)throw RangeError(`concurre
`);U=g.pop()??"";for(let r of g){let p=r.split(`
`),F=[],y;for(let R of p)if(R.startsWith("data:"))F.push(R.replace(/^data:\s*/,""));else if(R.startsWith("event:"))y=R.replace(/^event:\s*/,"");else if(R.startsWith("id:"))Q=R.replace(/^id:\s*/,"");else if(R.startsWith("retry:")){let h=Number.parseInt(R.replace(/^retry:\s*/,""),10);if(!Number.isNaN(h))V=h}let _,v=!1;if(F.length){let R=F.join(`
-`);try{_=JSON.parse(R),v=!0}catch{_=R}}if(v){if(S)await S(_);if(x)_=await x(_)}if(j?.({data:_,event:y,id:Q,retry:V}),F.length)yield _}}}finally{I.removeEventListener("abort",k),H.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let C=Math.min(V*2**(B-1),X??30000);await T(C)}}}()}}var P7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},F7=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},E7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},vj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((G)=>encodeURIComponent(G))).join(F7(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let K=P7(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return RO({allowReserved:$,name:j,value:X})}).join(K);return x==="label"||x==="matrix"?K+Z:Z},RO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},hj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:K})=>{if(S instanceof Date)return K?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let G=[];Object.entries(S).forEach(([Y,Q])=>{G=[...G,Y,$?Q:encodeURIComponent(Q)]});let L=G.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=E7(x),X=Object.entries(S).map(([G,L])=>RO({allowReserved:$,name:x==="deepObject"?`${j}[${G}]`:G,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var w7=/\{[^{}]+\}/g,q7=({path:$,url:O})=>{let j=O,x=O.match(w7);if(x)for(let S of x){let K=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))K=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let G=$[Z];if(G===void 0||G===null)continue;if(Array.isArray(G)){j=j.replace(S,vj({explode:K,name:Z,style:X,value:G}));continue}if(typeof G==="object"){j=j.replace(S,hj({explode:K,name:Z,style:X,value:G,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${RO({name:Z,value:G})}`);continue}let L=encodeURIComponent(X==="label"?`.${G}`:G);j=j.replace(S,L)}return j},TS=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let K=S.startsWith("/")?S:`/${S}`,Z=($??"")+K;if(O)Z=q7({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function m0($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var HS=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var RS={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var DS=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let K in x){let Z=x[K];if(Z===void 0||Z===null)continue;let X=$[K]||O;if(Array.isArray(Z)){let G=vj({allowReserved:X.allowReserved,explode:!0,name:K,style:"form",value:Z,...X.array});if(G)S.push(G)}else if(typeof Z==="object"){let G=hj({allowReserved:X.allowReserved,explode:!0,name:K,style:"deepObject",value:Z,...X.object});if(G)S.push(G)}else{let G=RO({allowReserved:X.allowReserved,name:K,value:Z});if(G)S.push(G)}}return S.join("&")}},CS=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},f7=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function _S($){for(let O of $.security??[]){if(f7($,O.name))continue;let j=await HS(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var c0=($)=>TS({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:DS($.querySerializer),url:$.url}),u0=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=cj($.headers,O.headers),j},b7=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},cj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?b7(j):Object.entries(j);for(let[S,K]of x)if(K===null)O.delete(S);else if(Array.isArray(K))for(let Z of K)O.append(S,Z);else if(K!==void 0)O.set(S,typeof K==="object"?JSON.stringify(K):K)}return O};class mj{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var MS=()=>({error:new mj,request:new mj,response:new mj}),k7=DS({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),g7={"Content-Type":"application/json"},sO=($={})=>({...RS,headers:g7,parseAs:"auto",querySerializer:k7,...$});var d0=($={})=>{let O=u0(sO(),$),j=()=>({...O}),x=(Y)=>{return O=u0(O,Y),j()},S=MS(),K=async(Y)=>{let Q={...O,...Y,fetch:Y.fetch??O.fetch??globalThis.fetch,headers:cj(O.headers,Y.headers),serializedBody:void 0};if(Q.security)await _S(Q);if(Q.requestValidator)await Q.requestValidator(Q);if(Q.body!==void 0&&Q.bodySerializer)Q.serializedBody=Q.bodySerializer(Q.body);if(Q.body===void 0||Q.serializedBody==="")Q.headers.delete("Content-Type");let T=Q,z=c0(T);return{opts:T,url:z}},Z=async(Y)=>{let Q=Y.throwOnError??O.throwOnError,T=Y.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await K(Y),I={redirect:"follow",...V,body:m0(V)};z=new Request(B,I);for(let N of S.request.fns)if(N)z=await N(z,V);let P=V.fetch;W=await P(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?CS(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let H;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":H=await W[N]();break;case"json":{let U=await W.text();H=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(H);if(V.responseTransformer)H=await V.responseTransformer(H)}return V.responseStyle==="data"?H:{data:H,...D}}let C=await W.text(),E;try{E=JSON.parse(C)}catch{}throw E??C}catch(V){let B=V;for(let I of S.error.fns)if(I)B=await I(B,W,z,Y);if(B=B||{},Q)throw B;return T==="data"?void 0:{error:B,request:z,response:W}}},X=(Y)=>(Q)=>Z({...Q,method:Y}),G=(Y)=>async(Q)=>{let{opts:T,url:z}=await K(Q);return IS({...T,body:T.body,method:Y,onRequest:async(W,V)=>{let B=new Request(W,V);for(let I of S.request.fns)if(I)B=await I(B,T);return B},serializedBody:m0(T),url:z})};return{buildUrl:(Y)=>c0({...O,...Y}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),head:G("HEAD"),options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),trace:G("TRACE")},trace:X("TRACE")}};var AS=d0(sO());class PS{client;constructor($){this.client=$?.client??AS}}class FS{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class uj extends PS{static __registry=new FS;constructor($){super($);uj.__registry.set(this,$?.key)}setPricingHandler($){return($.client??this.client).post({url:"/ai-cost/pricing",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUsageHandler($){return($.client??this.client).post({url:"/ai-cost/usage",...$,headers:{"Content-Type":"application/json",...$.headers}})}upsertAiProjection($){return($.client??this.client).post({url:"/ai-projections",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatsForAttachmentHandler($){return($.client??this.client).get({url:"/attachments/{attachment_id}/chats",...$})}deleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}",...$})}patchChat($){return($.client??this.client).patch({url:"/chat/{chat_id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}permanentlyDeleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}/permanent",...$})}createChat($){return($.client??this.client).post({url:"/chats",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatHistoryHandler($){return($.client??this.client).get({url:"/chats/history/{chat_id}",...$})}getChatHistoryBatchMessagesHandler($){return($.client??this.client).post({url:"/chats/history_batch_messages",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChat($){return($.client??this.client).get({url:"/chats/{chat_id}",...$})}copyChat($){return($.client??this.client).post({url:"/chats/{chat_id}/copy",...$})}getChatPermissions($){return($.client??this.client).get({url:"/chats/{chat_id}/permissions",...$})}revertDeleteChat($){return($.client??this.client).put({url:"/chats/{chat_id}/revert_delete",...$})}callTool($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/call",...$,headers:{"Content-Type":"application/json",...$.headers}})}rejectToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/reject",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolResponse($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/response/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}getCitationHandler($){return($.client??this.client).get({url:"/citations/{id}",...$})}decisions($){return($.client??this.client).post({url:"/decisions",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}runImportHandler($){return($.client??this.client).post({url:"/import/run",...$,headers:{"Content-Type":"application/json",...$.headers}})}discoverHandler($){return($.client??this.client).post({url:"/import/runs/{source}/discover",...$})}dismissRunHandler($){return($.client??this.client).post({url:"/import/runs/{source}/dismiss",...$})}retryGatherHandler($){return($.client??this.client).post({url:"/import/runs/{source}/retry",...$})}getStateHandler($){return($?.client??this.client).get({url:"/import/state",...$})}deleteMcpServer($){return($.client??this.client).delete({url:"/mcp/servers",...$})}listMcpServers($){return($?.client??this.client).get({url:"/mcp/servers",...$})}addMcpServer($){return($.client??this.client).post({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateMcpServer($){return($.client??this.client).put({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}mcpAuthCallback($){return($?.client??this.client).get({url:"/mcp/servers/auth/callback",...$})}mcpOauthClientMetadata($){return($?.client??this.client).get({url:"/mcp/servers/auth/client-metadata",...$})}startMcpAuth($){return($.client??this.client).post({url:"/mcp/servers/auth/start",...$,headers:{"Content-Type":"application/json",...$.headers}})}getMemoryHandler($){return($?.client??this.client).get({url:"/memory",...$})}getStateHandler2($){return($?.client??this.client).get({url:"/onboarding",...$})}completeHandler($){return($.client??this.client).post({url:"/onboarding/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}browsePipedreamMcpCatalog($){return($?.client??this.client).get({url:"/pipedream/mcp/catalog",...$})}completePipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}deletePipedreamMcpConnection($){return($.client??this.client).delete({url:"/pipedream/mcp/connections",...$})}listPipedreamMcpConnections($){return($?.client??this.client).get({url:"/pipedream/mcp/connections",...$})}updatePipedreamMcpConnection($){return($.client??this.client).put({url:"/pipedream/mcp/connections",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPipedreamMcpToken($){return($?.client??this.client).post({url:"/pipedream/mcp/token",...$})}getBatchPreview($){return($.client??this.client).post({url:"/preview",...$,headers:{"Content-Type":"application/json",...$.headers}})}sendChatMessage($){return($.client??this.client).post({url:"/stream/chat/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}stopChatStream($){return($.client??this.client).post({url:"/stream/chat/message/stop",...$,headers:{"Content-Type":"application/json",...$.headers}})}structuredCompletion($){return($.client??this.client).post({url:"/structured-completion",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function ES({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Y}){let Q,T=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,I=Y.signal??new AbortController().signal;while(!0){if(I.aborted)break;B++;let P=Y.headers instanceof Headers?Y.headers:new Headers(Y.headers);if(Q!==void 0)P.set("Last-Event-ID",Q);try{let D={redirect:"follow",...Y,body:Y.serializedBody,headers:P,signal:I},C=new Request(L,D);if($)C=await $(L,D);let N=await(Y.fetch??globalThis.fetch)(C);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",k=()=>{try{H.cancel()}catch{}};I.addEventListener("abort",k);try{while(!0){let{done:d,value:l}=await H.read();if(d)break;U+=l,U=U.replace(/\r\n?/g,`
+`);try{_=JSON.parse(R),v=!0}catch{_=R}}if(v){if(S)await S(_);if(x)_=await x(_)}if(j?.({data:_,event:y,id:Q,retry:V}),F.length)yield _}}}finally{I.removeEventListener("abort",k),H.releaseLock()}break}catch(D){if(O?.(D),Z!==void 0&&B>=Z)break;let C=Math.min(V*2**(B-1),X??30000);await T(C)}}}()}}var P7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},F7=($)=>{switch($){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},E7=($)=>{switch($){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},vj=({allowReserved:$,explode:O,name:j,style:x,value:S})=>{if(!O){let X=($?S:S.map((G)=>encodeURIComponent(G))).join(F7(x));switch(x){case"label":return`.${X}`;case"matrix":return`;${j}=${X}`;case"simple":return X;default:return`${j}=${X}`}}let K=P7(x),Z=S.map((X)=>{if(x==="label"||x==="simple")return $?X:encodeURIComponent(X);return RO({allowReserved:$,name:j,value:X})}).join(K);return x==="label"||x==="matrix"?K+Z:Z},RO=({allowReserved:$,name:O,value:j})=>{if(j===void 0||j===null)return"";if(typeof j==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${O}=${$?j:encodeURIComponent(j)}`},hj=({allowReserved:$,explode:O,name:j,style:x,value:S,valueOnly:K})=>{if(S instanceof Date)return K?S.toISOString():`${j}=${S.toISOString()}`;if(x!=="deepObject"&&!O){let G=[];Object.entries(S).forEach(([Y,Q])=>{G=[...G,Y,$?Q:encodeURIComponent(Q)]});let L=G.join(",");switch(x){case"form":return`${j}=${L}`;case"label":return`.${L}`;case"matrix":return`;${j}=${L}`;default:return L}}let Z=E7(x),X=Object.entries(S).map(([G,L])=>RO({allowReserved:$,name:x==="deepObject"?`${j}[${G}]`:G,value:L})).join(Z);return x==="label"||x==="matrix"?Z+X:X};var w7=/\{[^{}]+\}/g,q7=({path:$,url:O})=>{let j=O,x=O.match(w7);if(x)for(let S of x){let K=!1,Z=S.substring(1,S.length-1),X="simple";if(Z.endsWith("*"))K=!0,Z=Z.substring(0,Z.length-1);if(Z.startsWith("."))Z=Z.substring(1),X="label";else if(Z.startsWith(";"))Z=Z.substring(1),X="matrix";let G=$[Z];if(G===void 0||G===null)continue;if(Array.isArray(G)){j=j.replace(S,vj({explode:K,name:Z,style:X,value:G}));continue}if(typeof G==="object"){j=j.replace(S,hj({explode:K,name:Z,style:X,value:G,valueOnly:!0}));continue}if(X==="matrix"){j=j.replace(S,`;${RO({name:Z,value:G})}`);continue}let L=encodeURIComponent(X==="label"?`.${G}`:G);j=j.replace(S,L)}return j},TS=({baseUrl:$,path:O,query:j,querySerializer:x,url:S})=>{let K=S.startsWith("/")?S:`/${S}`,Z=($??"")+K;if(O)Z=q7({path:O,url:Z});let X=j?x(j):"";if(X.startsWith("?"))X=X.substring(1);if(X)Z+=`?${X}`;return Z};function m0($){let O=$.body!==void 0;if(O&&$.bodySerializer){if("serializedBody"in $)return $.serializedBody!==void 0&&$.serializedBody!==""?$.serializedBody:null;return $.body!==""?$.body:null}if(O)return $.body;return}var HS=async($,O)=>{let j=typeof O==="function"?await O($):O;if(!j)return;if($.scheme==="bearer")return`Bearer ${j}`;if($.scheme==="basic")return`Basic ${btoa(j)}`;return j};var RS={bodySerializer:($)=>JSON.stringify($,(O,j)=>typeof j==="bigint"?j.toString():j)};var DS=({parameters:$={},...O}={})=>{return(x)=>{let S=[];if(x&&typeof x==="object")for(let K in x){let Z=x[K];if(Z===void 0||Z===null)continue;let X=$[K]||O;if(Array.isArray(Z)){let G=vj({allowReserved:X.allowReserved,explode:!0,name:K,style:"form",value:Z,...X.array});if(G)S.push(G)}else if(typeof Z==="object"){let G=hj({allowReserved:X.allowReserved,explode:!0,name:K,style:"deepObject",value:Z,...X.object});if(G)S.push(G)}else{let G=RO({allowReserved:X.allowReserved,name:K,value:Z});if(G)S.push(G)}}return S.join("&")}},CS=($)=>{if(!$)return"stream";let O=$.split(";")[0]?.trim();if(!O)return;if(O.startsWith("application/json")||O.endsWith("+json"))return"json";if(O==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((j)=>O.startsWith(j)))return"blob";if(O.startsWith("text/"))return"text";return},f7=($,O)=>{if(!O)return!1;if($.headers.has(O)||$.query?.[O]||$.headers.get("Cookie")?.includes(`${O}=`))return!0;return!1};async function _S($){for(let O of $.security??[]){if(f7($,O.name))continue;let j=await HS(O,$.auth);if(!j)continue;let x=O.name??"Authorization";switch(O.in){case"query":if(!$.query)$.query={};$.query[x]=j;break;case"cookie":$.headers.append("Cookie",`${x}=${j}`);break;case"header":default:$.headers.set(x,j);break}}}var c0=($)=>TS({baseUrl:$.baseUrl,path:$.path,query:$.query,querySerializer:typeof $.querySerializer==="function"?$.querySerializer:DS($.querySerializer),url:$.url}),u0=($,O)=>{let j={...$,...O};if(j.baseUrl?.endsWith("/"))j.baseUrl=j.baseUrl.substring(0,j.baseUrl.length-1);return j.headers=cj($.headers,O.headers),j},b7=($)=>{let O=[];return $.forEach((j,x)=>{O.push([x,j])}),O},cj=(...$)=>{let O=new Headers;for(let j of $){if(!j)continue;let x=j instanceof Headers?b7(j):Object.entries(j);for(let[S,K]of x)if(K===null)O.delete(S);else if(Array.isArray(K))for(let Z of K)O.append(S,Z);else if(K!==void 0)O.set(S,typeof K==="object"?JSON.stringify(K):K)}return O};class mj{fns=[];clear(){this.fns=[]}eject($){let O=this.getInterceptorIndex($);if(this.fns[O])this.fns[O]=null}exists($){let O=this.getInterceptorIndex($);return Boolean(this.fns[O])}getInterceptorIndex($){if(typeof $==="number")return this.fns[$]?$:-1;return this.fns.indexOf($)}update($,O){let j=this.getInterceptorIndex($);if(this.fns[j])return this.fns[j]=O,$;return!1}use($){return this.fns.push($),this.fns.length-1}}var MS=()=>({error:new mj,request:new mj,response:new mj}),k7=DS({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),g7={"Content-Type":"application/json"},sO=($={})=>({...RS,headers:g7,parseAs:"auto",querySerializer:k7,...$});var d0=($={})=>{let O=u0(sO(),$),j=()=>({...O}),x=(Y)=>{return O=u0(O,Y),j()},S=MS(),K=async(Y)=>{let Q={...O,...Y,fetch:Y.fetch??O.fetch??globalThis.fetch,headers:cj(O.headers,Y.headers),serializedBody:void 0};if(Q.security)await _S(Q);if(Q.requestValidator)await Q.requestValidator(Q);if(Q.body!==void 0&&Q.bodySerializer)Q.serializedBody=Q.bodySerializer(Q.body);if(Q.body===void 0||Q.serializedBody==="")Q.headers.delete("Content-Type");let T=Q,z=c0(T);return{opts:T,url:z}},Z=async(Y)=>{let Q=Y.throwOnError??O.throwOnError,T=Y.responseStyle??O.responseStyle,z,W;try{let{opts:V,url:B}=await K(Y),I={redirect:"follow",...V,body:m0(V)};z=new Request(B,I);for(let N of S.request.fns)if(N)z=await N(z,V);let P=V.fetch;W=await P(z);for(let N of S.response.fns)if(N)W=await N(W,z,V);let D={request:z,response:W};if(W.ok){let N=(V.parseAs==="auto"?CS(W.headers.get("Content-Type")):V.parseAs)??"json";if(W.status===204||W.headers.get("Content-Length")==="0"){let U;switch(N){case"arrayBuffer":case"blob":case"text":U=await W[N]();break;case"formData":U=new FormData;break;case"stream":U=W.body;break;case"json":default:U={};break}return V.responseStyle==="data"?U:{data:U,...D}}let H;switch(N){case"arrayBuffer":case"blob":case"formData":case"text":H=await W[N]();break;case"json":{let U=await W.text();H=U?JSON.parse(U):{};break}case"stream":return V.responseStyle==="data"?W.body:{data:W.body,...D}}if(N==="json"){if(V.responseValidator)await V.responseValidator(H);if(V.responseTransformer)H=await V.responseTransformer(H)}return V.responseStyle==="data"?H:{data:H,...D}}let C=await W.text(),E;try{E=JSON.parse(C)}catch{}throw E??C}catch(V){let B=V;for(let I of S.error.fns)if(I)B=await I(B,W,z,Y);if(B=B||{},Q)throw B;return T==="data"?void 0:{error:B,request:z,response:W}}},X=(Y)=>(Q)=>Z({...Q,method:Y}),G=(Y)=>async(Q)=>{let{opts:T,url:z}=await K(Q);return IS({...T,body:T.body,method:Y,onRequest:async(W,V)=>{let B=new Request(W,V);for(let I of S.request.fns)if(I)B=await I(B,T);return B},serializedBody:m0(T),url:z})};return{buildUrl:(Y)=>c0({...O,...Y}),connect:X("CONNECT"),delete:X("DELETE"),get:X("GET"),getConfig:j,head:X("HEAD"),interceptors:S,options:X("OPTIONS"),patch:X("PATCH"),post:X("POST"),put:X("PUT"),request:Z,setConfig:x,sse:{connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),head:G("HEAD"),options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),trace:G("TRACE")},trace:X("TRACE")}};var AS=d0(sO());class PS{client;constructor($){this.client=$?.client??AS}}class FS{defaultKey="default";instances=new Map;get($){let O=this.instances.get($??this.defaultKey);if(!O)throw Error('No SDK client found. Create one with "new Sdk()" to fix this error.');return O}set($,O){this.instances.set(O??this.defaultKey,$)}}class uj extends PS{static __registry=new FS;constructor($){super($);uj.__registry.set(this,$?.key)}setPricingHandler($){return($.client??this.client).post({url:"/ai-cost/pricing",...$,headers:{"Content-Type":"application/json",...$.headers}})}getUsageHandler($){return($.client??this.client).post({url:"/ai-cost/usage",...$,headers:{"Content-Type":"application/json",...$.headers}})}upsertAiProjection($){return($.client??this.client).post({url:"/ai-projections",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatsForAttachmentHandler($){return($.client??this.client).get({url:"/attachments/{attachment_id}/chats",...$})}deleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}",...$})}patchChat($){return($.client??this.client).patch({url:"/chat/{chat_id}",...$,headers:{"Content-Type":"application/json",...$.headers}})}permanentlyDeleteChat($){return($.client??this.client).delete({url:"/chat/{chat_id}/permanent",...$})}createChat($){return($.client??this.client).post({url:"/chats",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChatHistoryHandler($){return($.client??this.client).get({url:"/chats/history/{chat_id}",...$})}getChatHistoryBatchMessagesHandler($){return($.client??this.client).post({url:"/chats/history_batch_messages",...$,headers:{"Content-Type":"application/json",...$.headers}})}getChat($){return($.client??this.client).get({url:"/chats/{chat_id}",...$})}copyChat($){return($.client??this.client).post({url:"/chats/{chat_id}/copy",...$})}getChatPermissions($){return($.client??this.client).get({url:"/chats/{chat_id}/permissions",...$})}revertDeleteChat($){return($.client??this.client).put({url:"/chats/{chat_id}/revert_delete",...$})}callTool($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/call",...$,headers:{"Content-Type":"application/json",...$.headers}})}rejectToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/reject",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolResponse($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/response/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateToolCall($){return($.client??this.client).post({url:"/chats/{chat_id}/tool/update",...$,headers:{"Content-Type":"application/json",...$.headers}})}getCitationHandler($){return($.client??this.client).get({url:"/citations/{id}",...$})}decisions($){return($.client??this.client).post({url:"/decisions",...$,headers:{"Content-Type":"application/json",...$.headers}})}healthHandler($){return($?.client??this.client).get({url:"/health",...$})}runImportHandler($){return($.client??this.client).post({url:"/import/run",...$,headers:{"Content-Type":"application/json",...$.headers}})}discoverHandler($){return($.client??this.client).post({url:"/import/runs/{source}/discover",...$})}dismissRunHandler($){return($.client??this.client).post({url:"/import/runs/{source}/dismiss",...$})}retryGatherHandler($){return($.client??this.client).post({url:"/import/runs/{source}/retry",...$})}getStateHandler($){return($?.client??this.client).get({url:"/import/state",...$})}deleteMcpServer($){return($.client??this.client).delete({url:"/mcp/servers",...$})}listMcpServers($){return($?.client??this.client).get({url:"/mcp/servers",...$})}addMcpServer($){return($.client??this.client).post({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}updateMcpServer($){return($.client??this.client).put({url:"/mcp/servers",...$,headers:{"Content-Type":"application/json",...$.headers}})}mcpAuthCallback($){return($?.client??this.client).get({url:"/mcp/servers/auth/callback",...$})}mcpOauthClientMetadata($){return($?.client??this.client).get({url:"/mcp/servers/auth/client-metadata",...$})}startMcpAuth($){return($.client??this.client).post({url:"/mcp/servers/auth/start",...$,headers:{"Content-Type":"application/json",...$.headers}})}getMemoryHandler($){return($?.client??this.client).get({url:"/memory",...$})}getStateHandler2($){return($?.client??this.client).get({url:"/onboarding",...$})}completeHandler($){return($.client??this.client).post({url:"/onboarding/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}dismissedPromptsHandler($){return($?.client??this.client).get({url:"/onboarding/prompts",...$})}dismissPromptHandler($){return($.client??this.client).post({url:"/onboarding/prompts/{prompt_id}/dismiss",...$})}browsePipedreamMcpCatalog($){return($?.client??this.client).get({url:"/pipedream/mcp/catalog",...$})}completePipedreamMcpConnection($){return($.client??this.client).post({url:"/pipedream/mcp/complete",...$,headers:{"Content-Type":"application/json",...$.headers}})}deletePipedreamMcpConnection($){return($.client??this.client).delete({url:"/pipedream/mcp/connections",...$})}listPipedreamMcpConnections($){return($?.client??this.client).get({url:"/pipedream/mcp/connections",...$})}updatePipedreamMcpConnection($){return($.client??this.client).put({url:"/pipedream/mcp/connections",...$,headers:{"Content-Type":"application/json",...$.headers}})}createPipedreamMcpToken($){return($?.client??this.client).post({url:"/pipedream/mcp/token",...$})}getBatchPreview($){return($.client??this.client).post({url:"/preview",...$,headers:{"Content-Type":"application/json",...$.headers}})}sendChatMessage($){return($.client??this.client).post({url:"/stream/chat/message",...$,headers:{"Content-Type":"application/json",...$.headers}})}stopChatStream($){return($.client??this.client).post({url:"/stream/chat/message/stop",...$,headers:{"Content-Type":"application/json",...$.headers}})}structuredCompletion($){return($.client??this.client).post({url:"/structured-completion",...$,headers:{"Content-Type":"application/json",...$.headers}})}}function ES({onRequest:$,onSseError:O,onSseEvent:j,responseTransformer:x,responseValidator:S,sseDefaultRetryDelay:K,sseMaxRetryAttempts:Z,sseMaxRetryDelay:X,sseSleepFn:G,url:L,...Y}){let Q,T=G??((V)=>new Promise((B)=>setTimeout(B,V)));return{stream:async function*(){let V=K??3000,B=0,I=Y.signal??new AbortController().signal;while(!0){if(I.aborted)break;B++;let P=Y.headers instanceof Headers?Y.headers:new Headers(Y.headers);if(Q!==void 0)P.set("Last-Event-ID",Q);try{let D={redirect:"follow",...Y,body:Y.serializedBody,headers:P,signal:I},C=new Request(L,D);if($)C=await $(L,D);let N=await(Y.fetch??globalThis.fetch)(C);if(!N.ok)throw Error(`SSE failed: ${N.status} ${N.statusText}`);if(!N.body)throw Error("No body in SSE response");let H=N.body.pipeThrough(new TextDecoderStream).getReader(),U="",k=()=>{try{H.cancel()}catch{}};I.addEventListener("abort",k);try{while(!0){let{done:d,value:l}=await H.read();if(d)break;U+=l,U=U.replace(/\r\n?/g,`
`);let g=U.split(`
`);U=g.pop()??"";for(let r of g){let p=r.split(`
diff --git a/crates/import/src/domain/ports.rs b/crates/import/src/domain/ports.rs
index be6baa0f28..15621997c3 100644
--- a/crates/import/src/domain/ports.rs
+++ b/crates/import/src/domain/ports.rs
@@ -16,9 +16,6 @@ pub enum ImportError {
/// AI work was refused or usage validation is temporarily unavailable.
#[error(transparent)]
Admission(#[from] ai_billing::AiAdmissionError),
- /// This source does not support user-triggered discovery.
- #[error("manual discovery is not supported for {source}", source = .0.as_ref())]
- UnsupportedDiscovery(ImportSource),
/// Database failure.
#[error("database error: {0}")]
Db(rootcause::Report),
diff --git a/crates/import/src/domain/service.rs b/crates/import/src/domain/service.rs
index ba02f84120..376a6a9a0e 100644
--- a/crates/import/src/domain/service.rs
+++ b/crates/import/src/domain/service.rs
@@ -181,8 +181,8 @@ pub trait ImportService: Send + Sync + 'static {
auto_import: bool,
) -> impl Future<Output = Result<bool>> + Send;
- /// User-triggered, non-auto-import gather that stages everything visible.
- /// Only Slack is supported in this slice. Returns whether a run started.
+ /// User-triggered, non-auto-import gather that stages candidates for
+ /// explicit selection. Returns whether a run started.
fn start_discovery(
&self,
user: MacroUserIdStr<'static>,
@@ -542,14 +542,14 @@ where
// rerunning the whole session on the fallback model is safe even
// when the primary died mid-way through staging.
match self
- .gather_agent_session(user, source, GATHER_MODEL, mcp_tools.clone())
+ .gather_agent_session(user, source, mode, GATHER_MODEL, mcp_tools.clone())
.await
{
Ok(()) => Ok(()),
Err(e) if e.is::<ai_billing::AiAdmissionError>() => Err(e),
Err(e) => {
tracing::warn!(model = GATHER_MODEL, error = ?e, "gather session failed; retrying on the fallback model");
- self.gather_agent_session(user, source, GATHER_FALLBACK_MODEL, mcp_tools)
+ self.gather_agent_session(user, source, mode, GATHER_FALLBACK_MODEL, mcp_tools)
.await
}
}
@@ -561,14 +561,19 @@ where
&self,
user: &MacroUserIdStr<'static>,
source: ImportSource,
+ mode: GatherMode,
model: &str,
mcp_tools: Arc<M>,
) -> anyhow::Result<()> {
let native = gather_toolset::<Self>();
let toolset = NativePlusMcp::new(native, mcp_tools);
+ let initiator = match mode {
+ GatherMode::Onboarding => Initiator::Onboarding,
+ GatherMode::Manual => Initiator::Manual,
+ };
let context = ImportToolContext {
service: Some(Arc::new(self.clone())),
- policy: ToolPolicy::gather(source),
+ policy: ToolPolicy::gather(source, initiator),
};
self.drive_session(
@@ -1039,9 +1044,6 @@ where
user: MacroUserIdStr<'static>,
source: ImportSource,
) -> Result<bool> {
- if source != ImportSource::Slack {
- return Err(ImportError::UnsupportedDiscovery(source));
- }
let from = [
RunStatus::Ready,
RunStatus::Completed,
diff --git a/crates/import/src/domain/service/slack_discovery/test.rs b/crates/import/src/domain/service/slack_discovery/test.rs
index b6eb0f3e87..7e046f58b6 100644
--- a/crates/import/src/domain/service/slack_discovery/test.rs
+++ b/crates/import/src/domain/service/slack_discovery/test.rs
@@ -1,6 +1,5 @@
use super::*;
use crate::domain::models::{ImportStatus, RunStatus};
-use crate::domain::ports::ImportError;
use crate::domain::service::test::admission::{Creator, NoConnector, Repo, user};
use crate::domain::service::{ImportService, ImportStager, gather_timeout};
use std::sync::atomic::{AtomicUsize, Ordering};
@@ -755,20 +754,23 @@ async fn manual_without_tools_fails_readably() {
}
#[tokio::test]
-async fn manual_rejects_other_sources_and_does_not_restart_running_runs() {
+async fn manual_accepts_agent_sources_and_does_not_restart_running_runs() {
let service = service(Repo::default(), Workspace::default());
- let error = service
- .start_discovery(user(), ImportSource::Linear)
- .await
- .unwrap_err();
- assert!(matches!(
- error,
- ImportError::UnsupportedDiscovery(ImportSource::Linear)
- ));
- assert_eq!(
- error.to_string(),
- "manual discovery is not supported for linear"
+ assert!(
+ service
+ .start_discovery(user(), ImportSource::Linear)
+ .await
+ .unwrap()
);
+ let linear = service
+ .repo
+ .list_runs(&user())
+ .await
+ .unwrap()
+ .into_iter()
+ .find(|run| run.source == ImportSource::Linear)
+ .unwrap();
+ assert!(!linear.auto_import);
service
.repo
.start_run(&user(), ImportSource::Slack, &[], true)
@@ -780,7 +782,15 @@ async fn manual_rejects_other_sources_and_does_not_restart_running_runs() {
.await
.unwrap()
);
- assert!(service.repo.list_runs(&user()).await.unwrap()[0].auto_import);
+ let slack = service
+ .repo
+ .list_runs(&user())
+ .await
+ .unwrap()
+ .into_iter()
+ .find(|run| run.source == ImportSource::Slack)
+ .unwrap();
+ assert!(slack.auto_import);
assert!(
service
.slack_source
diff --git a/crates/import/src/domain/service/test/admission.rs b/crates/import/src/domain/service/test/admission.rs
index bb7fa1cf08..42cd002282 100644
--- a/crates/import/src/domain/service/test/admission.rs
+++ b/crates/import/src/domain/service/test/admission.rs
@@ -728,7 +728,13 @@ async fn slack_agent_fallback_still_requires_admission() {
calls: AtomicUsize::new(0),
});
let error = service
- .gather_agent_session(&user(), ImportSource::Slack, GATHER_MODEL, tools.clone())
+ .gather_agent_session(
+ &user(),
+ ImportSource::Slack,
+ GatherMode::Onboarding,
+ GATHER_MODEL,
+ tools.clone(),
+ )
.await
.unwrap_err();
assert_eq!(error.downcast_ref::<AiAdmissionError>(), Some(&denied()));
diff --git a/crates/import/src/inbound/axum_router.rs b/crates/import/src/inbound/axum_router.rs
index 84080399f7..ca40e17a20 100644
--- a/crates/import/src/inbound/axum_router.rs
+++ b/crates/import/src/inbound/axum_router.rs
@@ -197,7 +197,7 @@ pub async fn retry_gather_handler<T: ImportService, Auth: MacroAuthorizationServ
params(("source" = String, Path, description = "Import source")),
responses(
(status = 204, description = "Discovery accepted (idempotent)"),
- (status = 400, description = "Unknown import source or discovery not supported"),
+ (status = 400, description = "Unknown import source"),
(status = 500, description = "Internal server error"),
),
tag = "import"
@@ -216,9 +216,6 @@ pub async fn discover_handler<T: ImportService, Auth: MacroAuthorizationService>
.await
{
Ok(_) => StatusCode::NO_CONTENT.into_response(),
- Err(e @ ImportError::UnsupportedDiscovery(_)) => {
- (StatusCode::BAD_REQUEST, e.to_string()).into_response()
- }
Err(e) => error_response(e),
}
}
diff --git a/crates/import/src/inbound/axum_router/test.rs b/crates/import/src/inbound/axum_router/test.rs
index bd318d2662..44d088b5f6 100644
--- a/crates/import/src/inbound/axum_router/test.rs
+++ b/crates/import/src/inbound/axum_router/test.rs
@@ -149,24 +149,17 @@ async fn discovery_rejects_unknown_source_without_calling_service() {
}
#[tokio::test]
-async fn discovery_returns_unsupported_source_message() {
- let (router, service) =
- discovery_router(Err(ImportError::UnsupportedDiscovery(ImportSource::Linear)));
- let response = router
- .oneshot(discovery_request("linear", true))
- .await
- .unwrap();
+async fn discovery_accepts_agent_gathered_sources() {
+ for (path, source) in [
+ ("linear", ImportSource::Linear),
+ ("notion", ImportSource::Notion),
+ ] {
+ let (router, service) = discovery_router(Ok(true));
+ let response = router.oneshot(discovery_request(path, true)).await.unwrap();
- assert_eq!(response.status(), StatusCode::BAD_REQUEST);
- let body = axum::body::to_bytes(response.into_body(), 4096)
- .await
- .unwrap();
- assert!(
- std::str::from_utf8(&body)
- .unwrap()
- .contains("not supported")
- );
- assert_eq!(service.calls.lock().unwrap()[0].1, ImportSource::Linear);
+ assert_eq!(response.status(), StatusCode::NO_CONTENT);
+ assert_eq!(service.calls.lock().unwrap()[0].1, source);
+ }
}
#[tokio::test]
diff --git a/crates/import/src/inbound/toolset.rs b/crates/import/src/inbound/toolset.rs
index 20ffbdf69e..18339c36f8 100644
--- a/crates/import/src/inbound/toolset.rs
+++ b/crates/import/src/inbound/toolset.rs
@@ -52,10 +52,11 @@ impl ToolPolicy {
}
}
- /// Policy for an onboarding gather job over one connector.
- pub fn gather(source: ImportSource) -> Self {
+ /// Policy for a gather job over one connector, recording `initiator`
+ /// (onboarding suggestions or a user-started discovery).
+ pub fn gather(source: ImportSource, initiator: Initiator) -> Self {
Self {
- initiator: Initiator::Onboarding,
+ initiator,
forced_source: Some(source),
allow_imported: false,
}
diff --git a/crates/import/src/inbound/toolset/test.rs b/crates/import/src/inbound/toolset/test.rs
index 7bbfaac802..743885fc39 100644
--- a/crates/import/src/inbound/toolset/test.rs
+++ b/crates/import/src/inbound/toolset/test.rs
@@ -120,8 +120,10 @@ fn contexts(
#[tokio::test]
async fn gather_policy_locks_source_and_initiator() {
- let (service_context, request_context, stager) =
- contexts(ToolPolicy::gather(ImportSource::Linear));
+ let (service_context, request_context, stager) = contexts(ToolPolicy::gather(
+ ImportSource::Linear,
+ Initiator::Onboarding,
+ ));
// Wrong source is refused before touching the service.
let err = CreateImportEntity {
@@ -172,6 +174,24 @@ async fn gather_policy_locks_source_and_initiator() {
);
}
+#[tokio::test]
+async fn manual_gather_policy_records_manual_initiator() {
+ let (service_context, request_context, stager) =
+ contexts(ToolPolicy::gather(ImportSource::Notion, Initiator::Manual));
+
+ CreateImportEntity {
+ source: ImportSource::Notion,
+ foreign_id: "https://notion.so/Plan-0123456789abcdef0123456789abcdef".into(),
+ status: CreateImportStatus::Staged,
+ metadata: serde_json::json!({"title": "Plan"}),
+ entity_id: None,
+ }
+ .call(service_context, request_context)
+ .await
+ .expect("staging succeeds");
+ assert_eq!(stager.staged_calls.lock().unwrap()[0].0, Initiator::Manual);
+}
+
#[tokio::test]
async fn chat_policy_requires_entity_id_for_imported_writes() {
let (service_context, request_context, _) = contexts(ToolPolicy::chat());
diff --git a/crates/macro_db_client/migrations/20261013165404_user_dismissed_prompt.sql b/crates/macro_db_client/migrations/20261013165404_user_dismissed_prompt.sql
new file mode 100644
index 0000000000..718d706521
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261013165404_user_dismissed_prompt.sql
@@ -0,0 +1,8 @@
+-- Sidebar prompts (setup and import cards) a user dismissed. Stored per user
+-- so a dismissal holds on every device; removed with the account.
+CREATE TABLE user_dismissed_prompt (
+ user_id TEXT NOT NULL,
+ prompt_id TEXT NOT NULL CHECK (prompt_id ~ '^[a-z0-9][a-z0-9:_-]{0,63}$'),
+ dismissed_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ PRIMARY KEY (user_id, prompt_id)
+);
diff --git a/crates/onboarding/src/domain/models.rs b/crates/onboarding/src/domain/models.rs
index c8e4974b2c..394d8f9844 100644
--- a/crates/onboarding/src/domain/models.rs
+++ b/crates/onboarding/src/domain/models.rs
@@ -65,3 +65,36 @@ pub struct OnboardingState {
/// would refuse.
pub suggested_team_domain: Option<String>,
}
+
+/// A sidebar prompt (setup or import card) the client can dismiss: 1–64
+/// lowercase letters, digits, `:`, `_`, or `-`, starting alphanumerically.
+#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+pub struct PromptId(String);
+
+impl PromptId {
+ /// Validate a client-supplied prompt id. `None` when it is malformed.
+ pub fn parse(raw: &str) -> Option<Self> {
+ let mut chars = raw.chars();
+ let valid = raw.len() <= 64
+ && chars
+ .next()
+ .is_some_and(|c| c.is_ascii_lowercase() || c.is_ascii_digit())
+ && chars.all(|c| {
+ c.is_ascii_lowercase() || c.is_ascii_digit() || matches!(c, ':' | '_' | '-')
+ });
+ valid.then(|| Self(raw.to_owned()))
+ }
+}
+
+impl AsRef<str> for PromptId {
+ fn as_ref(&self) -> &str {
+ &self.0
+ }
+}
+
+/// The prompts the user dismissed, on any device.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)]
+pub struct DismissedPrompts {
+ /// Dismissed prompt ids, oldest dismissal first.
+ pub dismissed: Vec<String>,
+}
diff --git a/crates/onboarding/src/domain/ports.rs b/crates/onboarding/src/domain/ports.rs
index 75cefcbc4b..123f65ebac 100644
--- a/crates/onboarding/src/domain/ports.rs
+++ b/crates/onboarding/src/domain/ports.rs
@@ -1,6 +1,6 @@
//! Ports (traits) the onboarding domain depends on.
-use super::models::OnboardingRow;
+use super::models::{OnboardingRow, PromptId};
use macro_user_id::user_id::MacroUserIdStr;
use thiserror::Error;
@@ -44,9 +44,22 @@ pub trait OnboardingRepo: Send + Sync + 'static {
skipped: bool,
) -> impl Future<Output = Result<OnboardingRow>> + Send;
- /// Remove the user's onboarding row, for account deletion. Idempotent: a
- /// user who never entered the flow (or whose row is already gone from an
- /// earlier attempt) is not an error.
+ /// Remove the user's onboarding row and dismissed prompts, for account
+ /// deletion. Idempotent: a user who never entered the flow (or whose
+ /// data is already gone from an earlier attempt) is not an error.
fn delete_row(&self, user: &MacroUserIdStr<'static>)
-> impl Future<Output = Result<()>> + Send;
+
+ /// The prompt ids the user dismissed, oldest first.
+ fn dismissed_prompts(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ ) -> impl Future<Output = Result<Vec<String>>> + Send;
+
+ /// Record a dismissal (idempotent; keeps the first dismissal time).
+ fn dismiss_prompt(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ prompt: &PromptId,
+ ) -> impl Future<Output = Result<()>> + Send;
}
diff --git a/crates/onboarding/src/domain/service.rs b/crates/onboarding/src/domain/service.rs
index c688a81ba0..a4a3338349 100644
--- a/crates/onboarding/src/domain/service.rs
+++ b/crates/onboarding/src/domain/service.rs
@@ -7,7 +7,9 @@
//! `start_gather` is a CAS that only wins when no run has ever started, so
//! ticking on every read (and on the MCP post-auth hook) is safe.
-use super::models::{ConnectedServer, OnboardingRow, OnboardingState, OnboardingStatus};
+use super::models::{
+ ConnectedServer, DismissedPrompts, OnboardingRow, OnboardingState, OnboardingStatus, PromptId,
+};
use super::ports::{OnboardingError, OnboardingRepo, Result};
use generic_email_domains::is_generic_email_domain;
use import::domain::models::{ImportSource, Initiator};
@@ -55,6 +57,20 @@ pub trait OnboardingService: Send + Sync + 'static {
user: MacroUserIdStr<'static>,
skipped: bool,
) -> impl Future<Output = Result<OnboardingRow>> + Send;
+
+ /// The sidebar prompts the user dismissed, so a dismissal holds on
+ /// every device. Never enters the user into the onboarding flow.
+ fn dismissed_prompts(
+ &self,
+ user: MacroUserIdStr<'static>,
+ ) -> impl Future<Output = Result<DismissedPrompts>> + Send;
+
+ /// Dismiss one sidebar prompt for good.
+ fn dismiss_prompt(
+ &self,
+ user: MacroUserIdStr<'static>,
+ prompt: PromptId,
+ ) -> impl Future<Output = Result<()>> + Send;
}
/// Concrete orchestrator wiring the repo, the user's MCP servers, and the
@@ -207,4 +223,16 @@ where
});
Ok(row)
}
+
+ #[tracing::instrument(skip(self, user), err)]
+ async fn dismissed_prompts(&self, user: MacroUserIdStr<'static>) -> Result<DismissedPrompts> {
+ Ok(DismissedPrompts {
+ dismissed: self.repo.dismissed_prompts(&user).await?,
+ })
+ }
+
+ #[tracing::instrument(skip(self, user), err)]
+ async fn dismiss_prompt(&self, user: MacroUserIdStr<'static>, prompt: PromptId) -> Result<()> {
+ self.repo.dismiss_prompt(&user, &prompt).await
+ }
}
diff --git a/crates/onboarding/src/domain/service/test.rs b/crates/onboarding/src/domain/service/test.rs
index b31e0812d8..c1d6dc429c 100644
--- a/crates/onboarding/src/domain/service/test.rs
+++ b/crates/onboarding/src/domain/service/test.rs
@@ -26,6 +26,7 @@ struct MockRepo {
/// Whether a row exists at all (get_row returns None when false).
exists: bool,
completions: Mutex<Vec<bool>>,
+ dismissed: Mutex<Vec<String>>,
}
impl MockRepo {
@@ -34,6 +35,7 @@ impl MockRepo {
status,
exists: true,
completions: Mutex::new(Vec::new()),
+ dismissed: Mutex::new(Vec::new()),
}
}
@@ -77,6 +79,22 @@ impl OnboardingRepo for MockRepo {
async fn delete_row(&self, _user: &MacroUserIdStr<'static>) -> Result<()> {
Ok(())
}
+
+ async fn dismissed_prompts(&self, _user: &MacroUserIdStr<'static>) -> Result<Vec<String>> {
+ Ok(self.dismissed.lock().unwrap().clone())
+ }
+
+ async fn dismiss_prompt(
+ &self,
+ _user: &MacroUserIdStr<'static>,
+ prompt: &PromptId,
+ ) -> Result<()> {
+ let mut dismissed = self.dismissed.lock().unwrap();
+ if !dismissed.iter().any(|id| id == prompt.as_ref()) {
+ dismissed.push(prompt.as_ref().to_owned());
+ }
+ Ok(())
+ }
}
struct MockStore {
@@ -355,3 +373,43 @@ async fn get_state_carries_the_suggested_team_domain() {
let state = service.get_state(user()).await.expect("get_state");
assert_eq!(state.suggested_team_domain.as_deref(), Some("macro.com"));
}
+
+#[test]
+fn prompt_ids_accept_card_slugs_and_reject_everything_else() {
+ for valid in [
+ "import:files",
+ "home-setup",
+ "pull-request-repositories",
+ "a1_b",
+ ] {
+ assert!(PromptId::parse(valid).is_some(), "{valid}");
+ }
+ for invalid in [
+ "",
+ "Import:files",
+ ":files",
+ "has space",
+ "slash/id",
+ &"a".repeat(65),
+ ] {
+ assert!(PromptId::parse(invalid).is_none(), "{invalid}");
+ }
+}
+
+#[tokio::test]
+async fn dismissed_prompts_round_trip_without_entering_onboarding() {
+ let (service, _) = service(OnboardingStatus::Active, Vec::new());
+ service
+ .dismiss_prompt(user(), PromptId::parse("import:tasks").unwrap())
+ .await
+ .unwrap();
+ service
+ .dismiss_prompt(user(), PromptId::parse("import:tasks").unwrap())
+ .await
+ .unwrap();
+
+ assert_eq!(
+ service.dismissed_prompts(user()).await.unwrap().dismissed,
+ vec!["import:tasks".to_string()]
+ );
+}
diff --git a/crates/onboarding/src/inbound/axum_router.rs b/crates/onboarding/src/inbound/axum_router.rs
index fc005aca02..6c98d8e298 100644
--- a/crates/onboarding/src/inbound/axum_router.rs
+++ b/crates/onboarding/src/inbound/axum_router.rs
@@ -1,11 +1,11 @@
//! HTTP surface for the onboarding flow.
-use crate::domain::models::{OnboardingRow, OnboardingState};
+use crate::domain::models::{DismissedPrompts, OnboardingRow, OnboardingState, PromptId};
use crate::domain::ports::OnboardingError;
use crate::domain::service::OnboardingService;
use axum::{
Json, Router,
- extract::{FromRef, State},
+ extract::{FromRef, Path, State},
http::StatusCode,
response::{IntoResponse, Response},
routing::{get, post},
@@ -67,6 +67,14 @@ where
Router::new()
.route("/onboarding", get(get_state_handler::<T, Auth>))
.route("/onboarding/complete", post(complete_handler::<T, Auth>))
+ .route(
+ "/onboarding/prompts",
+ get(dismissed_prompts_handler::<T, Auth>),
+ )
+ .route(
+ "/onboarding/prompts/{prompt_id}/dismiss",
+ post(dismiss_prompt_handler::<T, Auth>),
+ )
.with_state(state)
}
@@ -127,3 +135,58 @@ pub async fn complete_handler<T: OnboardingService, Auth: MacroAuthorizationServ
Err(e) => error_response(e),
}
}
+
+/// List the sidebar prompts the authenticated user dismissed on any device.
+#[utoipa::path(
+ get,
+ path = "/onboarding/prompts",
+ responses(
+ (status = 200, description = "Dismissed prompt ids", body = DismissedPrompts),
+ (status = 500, description = "Internal server error"),
+ ),
+ tag = "onboarding"
+)]
+#[tracing::instrument(skip(service, user), fields(user_id = %user.authorization.user.macro_user_id))]
+pub async fn dismissed_prompts_handler<T: OnboardingService, Auth: MacroAuthorizationService>(
+ State(service): State<Arc<T>>,
+ user: MacroAuthorizationExtractor<Auth, UserOrInternal>,
+) -> Response {
+ match service
+ .dismissed_prompts(user.authorization.user.macro_user_id)
+ .await
+ {
+ Ok(prompts) => Json(prompts).into_response(),
+ Err(e) => error_response(e),
+ }
+}
+
+/// Dismiss one sidebar prompt for the authenticated user, on every device.
+/// Idempotent.
+#[utoipa::path(
+ post,
+ path = "/onboarding/prompts/{prompt_id}/dismiss",
+ params(("prompt_id" = String, Path, description = "Prompt id, e.g. `import:files`")),
+ responses(
+ (status = 204, description = "Dismissed"),
+ (status = 400, description = "Malformed prompt id"),
+ (status = 500, description = "Internal server error"),
+ ),
+ tag = "onboarding"
+)]
+#[tracing::instrument(skip(service, user), fields(user_id = %user.authorization.user.macro_user_id))]
+pub async fn dismiss_prompt_handler<T: OnboardingService, Auth: MacroAuthorizationService>(
+ State(service): State<Arc<T>>,
+ user: MacroAuthorizationExtractor<Auth, UserOrInternal>,
+ Path(prompt_id): Path<String>,
+) -> Response {
+ let Some(prompt) = PromptId::parse(&prompt_id) else {
+ return (StatusCode::BAD_REQUEST, "malformed prompt id").into_response();
+ };
+ match service
+ .dismiss_prompt(user.authorization.user.macro_user_id, prompt)
+ .await
+ {
+ Ok(()) => StatusCode::NO_CONTENT.into_response(),
+ Err(e) => error_response(e),
+ }
+}
diff --git a/crates/onboarding/src/outbound/pg_onboarding_repo.rs b/crates/onboarding/src/outbound/pg_onboarding_repo.rs
index b063c196f3..26fce2fee5 100644
--- a/crates/onboarding/src/outbound/pg_onboarding_repo.rs
+++ b/crates/onboarding/src/outbound/pg_onboarding_repo.rs
@@ -1,6 +1,6 @@
//! Postgres implementation of [`OnboardingRepo`].
-use crate::domain::models::{OnboardingRow, OnboardingStatus};
+use crate::domain::models::{OnboardingRow, OnboardingStatus, PromptId};
use crate::domain::ports::{OnboardingRepo, Result};
use chrono::{DateTime, Utc};
use macro_user_id::user_id::MacroUserIdStr;
@@ -111,6 +111,7 @@ impl OnboardingRepo for PgOnboardingRepo {
#[tracing::instrument(skip(self), err)]
async fn delete_row(&self, user: &MacroUserIdStr<'static>) -> Result<()> {
+ let mut tx = self.pool.begin().await?;
sqlx::query!(
r#"
DELETE FROM user_onboarding
@@ -118,6 +119,52 @@ impl OnboardingRepo for PgOnboardingRepo {
"#,
user.as_ref(),
)
+ .execute(&mut *tx)
+ .await?;
+ sqlx::query!(
+ r#"
+ DELETE FROM user_dismissed_prompt
+ WHERE user_id = $1
+ "#,
+ user.as_ref(),
+ )
+ .execute(&mut *tx)
+ .await?;
+ tx.commit().await?;
+ Ok(())
+ }
+
+ #[tracing::instrument(skip(self), err)]
+ async fn dismissed_prompts(&self, user: &MacroUserIdStr<'static>) -> Result<Vec<String>> {
+ let rows = sqlx::query_scalar!(
+ r#"
+ SELECT prompt_id
+ FROM user_dismissed_prompt
+ WHERE user_id = $1
+ ORDER BY dismissed_at, prompt_id
+ "#,
+ user.as_ref(),
+ )
+ .fetch_all(&self.pool)
+ .await?;
+ Ok(rows)
+ }
+
+ #[tracing::instrument(skip(self), err)]
+ async fn dismiss_prompt(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ prompt: &PromptId,
+ ) -> Result<()> {
+ sqlx::query!(
+ r#"
+ INSERT INTO user_dismissed_prompt (user_id, prompt_id)
+ VALUES ($1, $2)
+ ON CONFLICT (user_id, prompt_id) DO NOTHING
+ "#,
+ user.as_ref(),
+ prompt.as_ref(),
+ )
.execute(&self.pool)
.await?;
Ok(())
diff --git a/crates/onboarding/src/outbound/pg_onboarding_repo/test.rs b/crates/onboarding/src/outbound/pg_onboarding_repo/test.rs
index 2c8b7cb36e..c7fd503436 100644
--- a/crates/onboarding/src/outbound/pg_onboarding_repo/test.rs
+++ b/crates/onboarding/src/outbound/pg_onboarding_repo/test.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::domain::models::OnboardingStatus;
+use crate::domain::models::{OnboardingStatus, PromptId};
use macro_db_migrator::MACRO_DB_MIGRATIONS;
fn user(email: &str) -> MacroUserIdStr<'static> {
@@ -37,3 +37,50 @@ async fn delete_row_is_idempotent(pool: PgPool) {
assert!(repo.get_row(&never_onboarded).await.unwrap().is_none());
}
+
+fn prompt(id: &str) -> PromptId {
+ PromptId::parse(id).expect("valid prompt id")
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn dismissals_are_per_user_idempotent_and_ordered(pool: PgPool) {
+ let repo = PgOnboardingRepo::new(pool);
+ let alice = user("[email protected]");
+ let bob = user("[email protected]");
+
+ repo.dismiss_prompt(&alice, &prompt("import:files"))
+ .await
+ .unwrap();
+ repo.dismiss_prompt(&alice, &prompt("home-setup"))
+ .await
+ .unwrap();
+ repo.dismiss_prompt(&alice, &prompt("import:files"))
+ .await
+ .unwrap();
+
+ assert_eq!(
+ repo.dismissed_prompts(&alice).await.unwrap(),
+ vec!["import:files".to_string(), "home-setup".to_string()]
+ );
+ assert!(repo.dismissed_prompts(&bob).await.unwrap().is_empty());
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn delete_row_removes_dismissals_without_an_onboarding_row(pool: PgPool) {
+ // Users who never entered onboarding can still dismiss prompts; account
+ // deletion must clear those too.
+ let repo = PgOnboardingRepo::new(pool);
+ let deleted = user("[email protected]");
+ let kept = user("[email protected]");
+ repo.dismiss_prompt(&deleted, &prompt("calendar-accounts"))
+ .await
+ .unwrap();
+ repo.dismiss_prompt(&kept, &prompt("calendar-accounts"))
+ .await
+ .unwrap();
+
+ repo.delete_row(&deleted).await.unwrap();
+
+ assert!(repo.dismissed_prompts(&deleted).await.unwrap().is_empty());
+ assert_eq!(repo.dismissed_prompts(&kept).await.unwrap().len(), 1);
+}
diff --git a/crates/slack_integration/src/outbound/import_ledger.rs b/crates/slack_integration/src/outbound/import_ledger.rs
index 3bc0dd2f58..fd3c31f51a 100644
--- a/crates/slack_integration/src/outbound/import_ledger.rs
+++ b/crates/slack_integration/src/outbound/import_ledger.rs
@@ -173,11 +173,9 @@ fn map_error(error: import::domain::ports::ImportError) -> rootcause::Report<Imp
LedgerError::SourceConfirmationRequired => ImportError::InvalidInput,
LedgerError::TargetConflict | LedgerError::TargetNotReserved => ImportError::Conflict,
LedgerError::Db(_) | LedgerError::Other(_) => ImportError::Retryable,
- // Canonical ledger operations do not perform discovery or AI work.
- // These errors are unexpected adapter failures, not permission to proceed.
- LedgerError::Admission(_)
- | LedgerError::Metadata(_)
- | LedgerError::UnsupportedDiscovery(_) => ImportError::Internal,
+ // Canonical ledger operations do not perform AI work. These errors
+ // are unexpected adapter failures, not permission to proceed.
+ LedgerError::Admission(_) | LedgerError::Metadata(_) => ImportError::Internal,
};
rootcause::Report::new(error).context(code)
}
diff --git a/crates/slack_integration/src/outbound/import_ledger/test.rs b/crates/slack_integration/src/outbound/import_ledger/test.rs
index 5c97fa2c71..c15976f024 100644
--- a/crates/slack_integration/src/outbound/import_ledger/test.rs
+++ b/crates/slack_integration/src/outbound/import_ledger/test.rs
@@ -151,17 +151,6 @@ async fn reservation_passes_requester_explicit_team_and_authorized_target_for_ev
}
}
-#[test]
-fn unexpected_discovery_error_fails_closed() {
- assert_eq!(
- map_error(LedgerError::UnsupportedDiscovery(
- ledger::ImportSource::Slack
- ))
- .into_current_context(),
- ImportError::Internal
- );
-}
-
#[test]
fn unexpected_ai_admission_error_fails_closed() {
let admission = serde_json::from_str(r#""unavailable""#).unwrap();
diff --git a/docs/agent-guide/README.md b/docs/agent-guide/README.md
index f5ca6ed614..b09a125253 100644
--- a/docs/agent-guide/README.md
+++ b/docs/agent-guide/README.md
@@ -29,6 +29,7 @@ verified live against a local stack (`just run_local`).
| [notifications.md](notifications.md) | Notifications |
| [settings.md](settings.md) | Settings sections, including Slack import and team membership |
| [onboarding.md](onboarding.md) | Onboarding bypass and setup plan |
+| [setup-cards.md](setup-cards.md) | Sidebar import and setup cards, the connector import dialog, and permanent dismissal |
| [canvas.md](canvas.md) | Canvas colors and link paste |
| [soup-live-updates.md](soup-live-updates.md) | Live updates in flat Soup lists |
| [ui-conventions.md](ui-conventions.md) | Shared UI behavior: list loading, top bars, dialog actions, user cards, information panels |
diff --git a/docs/agent-guide/channels.md b/docs/agent-guide/channels.md
index 2084185145..09017ada5d 100644
--- a/docs/agent-guide/channels.md
+++ b/docs/agent-guide/channels.md
@@ -122,17 +122,23 @@ internal rollout. Model usage continues through the existing session metering.
## Imported Slack history
-Import starts from the **Import from Slack** chip below the Chat sidebar tabs,
-or **Settings → Team → Connections → Import from Slack**. The chip is visible
-to team admins and owners when Slack archive import is enabled, and opens the
-same dialog without leaving Chat. Its **Dismiss Slack import** button hides the
-card and remembers the choice in this browser for that user and Macro team.
-Successful archive imports (including partial imports with a completed channel)
-and server-confirmed channel-only imports also hide it. Failed or cancelled
-imports do not. Dismissing or completing an import keeps the Settings entry
-available; completion does not close an open progress dialog. Check persistence
-after reload and confirm dismissal does not affect another user or team.
-Closing the dialog returns focus to the chip when it is still visible.
+Import starts from the **Import from Slack** card at the bottom of the Chat
+sidebar, or **Settings → Team → Connections → Import from Slack**. The card is
+the shared connector-import card (see
+[Import from connected apps](surfaces.md#import-from-connected-apps)) and is
+visible to team admins and owners when Slack archive import is enabled. It
+opens the shared import dialog: a **Slack** row connects through Pipedream,
+then discovers channels for a filterable pick list (**Import N**), and
+**Import with history** closes it and opens the archive upload below. Without
+an available Slack connector (Slack's Pipedream app is dev-only), the card opens
+the archive upload directly. **Dismiss import from slack** hides the card for
+that user on every device (see
+[Dismissing cards](surfaces.md#dismissing-cards)); successful archive imports (including partial
+imports with a completed channel) and server-confirmed channel imports also
+hide it. Failed or cancelled imports do not. Dismissing or completing an import
+keeps the Settings entry available; completion does not close an open progress
+dialog. Closing the archive dialog returns focus to the card's button when it
+is still visible.
The dialog offers **Import with history** (recommended) and **Import channels
without history**. The first needs a ZIP export provided by a Slack workspace
owner or admin; its upload screen links to Slack's export instructions. Files
diff --git a/docs/agent-guide/setup-cards.md b/docs/agent-guide/setup-cards.md
new file mode 100644
index 0000000000..3936e25dfc
--- /dev/null
+++ b/docs/agent-guide/setup-cards.md
@@ -0,0 +1,96 @@
+# Setup and import cards
+
+## Import from connected apps
+
+With `enable-sidebar-promotions` on (on in dev) and the Pipedream connector stack
+enabled, the Drive, Tasks, and Customers sidebars end with an import card (the
+Chat sidebar's Slack card is the same component under the Slack import gates;
+see [channels](channels.md#imported-slack-history)):
+overlapping provider logos, a two-line pitch, and **Import files**, **Import
+tasks**, or **Import customers**. Customers shows it only to team members.
+**Dismiss import files** (or tasks, customers) hides that card for good; a
+server-confirmed native import also hides it. See
+[Dismissing cards](#dismissing-cards).
+
+The button opens a dialog listing that category's apps (Files: Notion, Google
+Drive, Dropbox, OneDrive, Box, Confluence; Tasks: Linear, Jira, Asana, GitHub,
+Trello, monday.com; Customers: HubSpot, Salesforce, Close, Airtable). A
+disconnected row offers **Connect** (`Connect <App>`), which opens Pipedream's
+Connect UI inside the dialog. A connected row shows a check and **Import**
+(`Import from <App>`).
+
+- **Notion**, **Linear**, and **Slack** import natively. Connecting one opens
+ **Import from <App>** and starts discovery
+ (`POST /import/runs/<source>/discover`) unless rows are already staged: a
+ gather agent stages recent pages or issues, and Slack discovery stages every
+ visible public channel. Click a title to select it, then **Import N**. Lists
+ longer than eight rows get a filter; selections hidden by the filter still
+ import. Rows spin while importing and then link to the created document,
+ task, or channel. **Search again** rediscovers; **Back to apps** returns to
+ the list.
+- Every other app is labelled "with the agent". **Import** closes the dialog
+ and opens an agent chat with an unsent prompt such as "Import my most recent
+ issues and tasks from Jira into Macro tasks.". Private instructions tell the
+ agent to list candidates and ask before creating anything, and never to
+ write to the source.
+- Files also offers **Upload files** and **Upload a folder** (Drive's own
+ uploads), and Customers offers **Upload a CSV** (the existing CSV import).
+ Each closes the dialog first.
+
+`src/features/connector-import/browser-test/` exercises both paths without a
+backend.
+
+## Sidebar setup cards
+
+The same flag puts a dismissible card (`src/features/sidebar-promotion`) at
+the bottom of three more sidebars. On desktop every card, import cards
+included, uses the email message card's surface (`ComposerSurface`). Calendar's
+card sits above **Settings**, outside the scrolling list.
+
+- **Home** (desktop): "Make Macro your home base". **Connect tools** opens
+ Settings → Connections; **Invite team** opens Settings → Team. **Invite
+ team** is hidden for members of a team that limits invites to admins
+ (Settings → Team would offer nothing to do).
+- **Calendar**: "Connect more calendars", shown only with multi-inbox enabled.
+ If a connected account lacks calendar access the button is **Turn on
+ calendar**, and if its grant expired, **Reconnect calendar**; both rerun that
+ account's consent like the calendar settings menu. Otherwise **Connect a
+ calendar** adds another Google account (mail and calendar, like **Connect
+ another account**; plans without multi-inbox see the paywall). The card
+ hides once two accounts have working calendar access.
+- **Pull requests**: "Bring in more repositories". Without a linked GitHub
+ account the button is **Connect GitHub**; with an expired link it is
+ **Reconnect GitHub** (the same reauthentication as Settings → GitHub). Once
+ linked it is **Add repositories**, which opens the GitHub App install page
+ (`/github/install-sync`) in a new tab, where GitHub asks which orgs and
+ repositories to grant.
+
+`src/features/sidebar-promotion/browser-test/` renders all three cards.
+
+## Dismissing cards
+
+Every card (import, Slack, and setup) has a close button. Dismissing is
+permanent and per account: `POST /onboarding/prompts/<id>/dismiss` stores it
+server-side, so the card stays gone on every device and browser. If
+`GET /onboarding/prompts` fails, the browser's own record of dismissals is
+used. Ids are `import:<files|tasks|crm|channels>`, `home-setup`,
+`calendar-accounts`, and `pull-request-repositories`. Account deletion removes
+them.
+
+## Rendering on view switches
+
+A card renders in the same frame as its sidebar. Each card remembers, per
+account and in local storage (`sidebar-promotion:last-known:v1:*`), whether
+it was last shown and the data behind its buttons (calendar account, GitHub
+status, invite access). While feature flags, `GET /onboarding/prompts`, or the
+host's queries load, the card shows that remembered state: a shown card
+appears at once, and a hidden one never flashes. With nothing remembered
+(first visit on a browser) it stays hidden until everything has loaded. The
+one stale case is a card dismissed on another device since this browser last
+loaded: it shows until the dismissal list arrives, then hides. The app loads
+the dismissal list once at startup without retrying, and cards reuse that
+answer (or its failure) instead of refetching when a view opens. Against a
+backend without `/onboarding/prompts` (the shared dev backend before this
+endpoint deploys), the list 404s and cards fall back to the browser's record.
+The import dialog's code loads on first open (fetched ahead when the pointer
+or focus reaches the card).
diff --git a/docs/agent-guide/tasks.md b/docs/agent-guide/tasks.md
index 9d406d7196..7fa63cab2c 100644
--- a/docs/agent-guide/tasks.md
+++ b/docs/agent-guide/tasks.md
@@ -550,6 +550,10 @@ even between launch and mount. The next opening uses the current context.
Tasks are documents under the hood (creation hits `POST /dss/documents/create_task`), so they
also show up in Files/`All` and in AI-chat document listings.
+To bring tasks over from Linear, Jira, Asana, and other apps, use the **Import
+tasks** card at the bottom of the Tasks sidebar; see
+[Import from connected apps](surfaces.md#import-from-connected-apps).
+
## Projects
Projects are enabled by default in development. Production rollout is gated by
diff --git a/docs/runbooks/media/connector-import/README.md b/docs/runbooks/media/connector-import/README.md
new file mode 100644
index 0000000000..12b454ae6d
--- /dev/null
+++ b/docs/runbooks/media/connector-import/README.md
@@ -0,0 +1,17 @@
+# Connector import review media
+
+Captured from `apps/web/src/features/connector-import/browser-test/import.html`,
+which renders the real card and dialog over an in-memory import pipeline.
+
+- [Sidebar cards, light](cards-light.jpg) and [dark](cards-dark.jpg): Drive,
+ Tasks, Customers, and Chat (Slack) cards with overlapping provider logos.
+- [Import files dialog](dialog-light.jpg): Notion imports natively; the other
+ apps connect through Pipedream and import with the agent. Dropbox is connected.
+- [Notion pick list](notion-dark.jpg): discovered pages after connecting Notion.
+
+Live Pipedream authorization and agent imports are not shown: the hosted dev
+connection requires a signed-in account.
+
+- [Trailer](trailer.mp4): a 21-second walkthrough of the import cards, the Files
+ dialog, a Notion import, and the Home, Calendar, and Pull request setup cards.
+ Rendered from the same fixture captures.
diff --git a/docs/runbooks/media/connector-import/cards-dark.jpg b/docs/runbooks/media/connector-import/cards-dark.jpg
new file mode 100644
index 0000000000..64819278a8
Binary files /dev/null and b/docs/runbooks/media/connector-import/cards-dark.jpg differ
diff --git a/docs/runbooks/media/connector-import/cards-light.jpg b/docs/runbooks/media/connector-import/cards-light.jpg
new file mode 100644
index 0000000000..26c0fe7730
Binary files /dev/null and b/docs/runbooks/media/connector-import/cards-light.jpg differ
diff --git a/docs/runbooks/media/connector-import/dialog-light.jpg b/docs/runbooks/media/connector-import/dialog-light.jpg
new file mode 100644
index 0000000000..9395678a0f
Binary files /dev/null and b/docs/runbooks/media/connector-import/dialog-light.jpg differ
diff --git a/docs/runbooks/media/connector-import/notion-dark.jpg b/docs/runbooks/media/connector-import/notion-dark.jpg
new file mode 100644
index 0000000000..7f3013c90b
Binary files /dev/null and b/docs/runbooks/media/connector-import/notion-dark.jpg differ
diff --git a/docs/runbooks/media/connector-import/trailer.mp4 b/docs/runbooks/media/connector-import/trailer.mp4
new file mode 100644
index 0000000000..7f0bdd4887
Binary files /dev/null and b/docs/runbooks/media/connector-import/trailer.mp4 differ
diff --git a/docs/runbooks/media/sidebar-promotion/README.md b/docs/runbooks/media/sidebar-promotion/README.md
new file mode 100644
index 0000000000..2f29fdb4b9
--- /dev/null
+++ b/docs/runbooks/media/sidebar-promotion/README.md
@@ -0,0 +1,6 @@
+# Sidebar setup card review media
+
+Captured from `apps/web/src/features/sidebar-promotion/browser-test/promotions.html`.
+
+- [Light](promos-light.jpg) and [dark](promos-dark.jpg): the Home, Calendar,
+ and Pull requests cards at the default sidebar width.
diff --git a/docs/runbooks/media/sidebar-promotion/promos-dark.jpg b/docs/runbooks/media/sidebar-promotion/promos-dark.jpg
new file mode 100644
index 0000000000..bbc405a08d
Binary files /dev/null and b/docs/runbooks/media/sidebar-promotion/promos-dark.jpg differ
diff --git a/docs/runbooks/media/sidebar-promotion/promos-light.jpg b/docs/runbooks/media/sidebar-promotion/promos-light.jpg
new file mode 100644
index 0000000000..e940029366
Binary files /dev/null and b/docs/runbooks/media/sidebar-promotion/promos-light.jpg differ
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/README.md b/packages/sdk-docs/reference/generated/cognition/types.gen/README.md
index 58efc86462..ba4934ba68 100644
--- a/packages/sdk-docs/reference/generated/cognition/types.gen/README.md
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/README.md
@@ -97,6 +97,15 @@
- [DiscoverHandlerErrors](type-aliases/DiscoverHandlerErrors.md)
- [DiscoverHandlerResponse](type-aliases/DiscoverHandlerResponse.md)
- [DiscoverHandlerResponses](type-aliases/DiscoverHandlerResponses.md)
+- [DismissedPrompts](type-aliases/DismissedPrompts.md)
+- [DismissedPromptsHandlerData](type-aliases/DismissedPromptsHandlerData.md)
+- [DismissedPromptsHandlerErrors](type-aliases/DismissedPromptsHandlerErrors.md)
+- [DismissedPromptsHandlerResponse](type-aliases/DismissedPromptsHandlerResponse.md)
+- [DismissedPromptsHandlerResponses](type-aliases/DismissedPromptsHandlerResponses.md)
+- [DismissPromptHandlerData](type-aliases/DismissPromptHandlerData.md)
+- [DismissPromptHandlerErrors](type-aliases/DismissPromptHandlerErrors.md)
+- [DismissPromptHandlerResponse](type-aliases/DismissPromptHandlerResponse.md)
+- [DismissPromptHandlerResponses](type-aliases/DismissPromptHandlerResponses.md)
- [DismissRunHandlerData](type-aliases/DismissRunHandlerData.md)
- [DismissRunHandlerErrors](type-aliases/DismissRunHandlerErrors.md)
- [DismissRunHandlerResponse](type-aliases/DismissRunHandlerResponse.md)
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DiscoverHandlerErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DiscoverHandlerErrors.md
index 892fdf32f5..59d162bfc7 100644
--- a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DiscoverHandlerErrors.md
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DiscoverHandlerErrors.md
@@ -6,5 +6,5 @@
| Property | Type | Description |
| ------ | ------ | ------ |
-| <a id="property-400"></a> `400` | `unknown` | Unknown import source or discovery not supported |
+| <a id="property-400"></a> `400` | `unknown` | Unknown import source |
| <a id="property-500"></a> `500` | `unknown` | Internal server error |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerData.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerData.md
new file mode 100644
index 0000000000..5f4cdc55e0
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerData.md
@@ -0,0 +1,13 @@
+# Type Alias: DismissPromptHandlerData
+
+> **DismissPromptHandlerData** = \{ `body?`: `never`; `path`: \{ `prompt_id`: `string`; \}; `query?`: `never`; `url`: `"/onboarding/prompts/{prompt_id}/dismiss"`; \}
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-body"></a> `body?` | `never` | - |
+| <a id="property-path"></a> `path` | \{ `prompt_id`: `string`; \} | - |
+| `path.prompt_id` | `string` | Prompt id, e.g. `import:files` |
+| <a id="property-query"></a> `query?` | `never` | - |
+| <a id="property-url"></a> `url` | `"/onboarding/prompts/{prompt_id}/dismiss"` | - |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerErrors.md
new file mode 100644
index 0000000000..2b044a6c48
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerErrors.md
@@ -0,0 +1,10 @@
+# Type Alias: DismissPromptHandlerErrors
+
+> **DismissPromptHandlerErrors** = \{ `400`: `unknown`; `500`: `unknown`; \}
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-400"></a> `400` | `unknown` | Malformed prompt id |
+| <a id="property-500"></a> `500` | `unknown` | Internal server error |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponse.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponse.md
new file mode 100644
index 0000000000..1f470b98c6
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponse.md
@@ -0,0 +1,3 @@
+# Type Alias: DismissPromptHandlerResponse
+
+> **DismissPromptHandlerResponse** = [`DismissPromptHandlerResponses`](DismissPromptHandlerResponses.md)\[keyof [`DismissPromptHandlerResponses`](DismissPromptHandlerResponses.md)\]
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponses.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponses.md
new file mode 100644
index 0000000000..0c7094f662
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissPromptHandlerResponses.md
@@ -0,0 +1,9 @@
+# Type Alias: DismissPromptHandlerResponses
+
+> **DismissPromptHandlerResponses** = \{ `204`: `void`; \}
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-204"></a> `204` | `void` | Dismissed |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPrompts.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPrompts.md
new file mode 100644
index 0000000000..26cfa39857
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPrompts.md
@@ -0,0 +1,11 @@
+# Type Alias: DismissedPrompts
+
+> **DismissedPrompts** = \{ `dismissed`: `string`[]; \}
+
+The prompts the user dismissed, on any device.
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-dismissed"></a> `dismissed` | `string`[] | Dismissed prompt ids, oldest dismissal first. |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerData.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerData.md
new file mode 100644
index 0000000000..87db39fc95
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerData.md
@@ -0,0 +1,12 @@
+# Type Alias: DismissedPromptsHandlerData
+
+> **DismissedPromptsHandlerData** = \{ `body?`: `never`; `path?`: `never`; `query?`: `never`; `url`: `"/onboarding/prompts"`; \}
+
+## Properties
+
+| Property | Type |
+| ------ | ------ |
+| <a id="property-body"></a> `body?` | `never` |
+| <a id="property-path"></a> `path?` | `never` |
+| <a id="property-query"></a> `query?` | `never` |
+| <a id="property-url"></a> `url` | `"/onboarding/prompts"` |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerErrors.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerErrors.md
new file mode 100644
index 0000000000..472371b4fe
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerErrors.md
@@ -0,0 +1,9 @@
+# Type Alias: DismissedPromptsHandlerErrors
+
+> **DismissedPromptsHandlerErrors** = \{ `500`: `unknown`; \}
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-500"></a> `500` | `unknown` | Internal server error |
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponse.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponse.md
new file mode 100644
index 0000000000..1014ad15fd
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponse.md
@@ -0,0 +1,3 @@
+# Type Alias: DismissedPromptsHandlerResponse
+
+> **DismissedPromptsHandlerResponse** = [`DismissedPromptsHandlerResponses`](DismissedPromptsHandlerResponses.md)\[keyof [`DismissedPromptsHandlerResponses`](DismissedPromptsHandlerResponses.md)\]
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponses.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponses.md
new file mode 100644
index 0000000000..e301818017
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/DismissedPromptsHandlerResponses.md
@@ -0,0 +1,9 @@
+# Type Alias: DismissedPromptsHandlerResponses
+
+> **DismissedPromptsHandlerResponses** = \{ `200`: [`DismissedPrompts`](DismissedPrompts.md); \}
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-200"></a> `200` | [`DismissedPrompts`](DismissedPrompts.md) | Dismissed prompt ids |
diff --git a/packages/sdk/generated/cognition/index.ts b/packages/sdk/generated/cognition/index.ts
index 160421c271..106616acb6 100644
--- a/packages/sdk/generated/cognition/index.ts
+++ b/packages/sdk/generated/cognition/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessLevel, AddMcpServerData, AddMcpServerError, AddMcpServerErrors, AddMcpServerResponse, AddMcpServerResponses, AddServerRequest, AiAdmissionErrorBody, AiFeature, AssistantMessagePart, AttachmentMetadata, AttachmentType, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogError, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponse, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolError, CallToolErrors, CallToolRequest, CallToolResponse, CallToolResponse2, CallToolResponses, ChannelSharePermission, ChannelType, Chat, ChatAttachment, ChatHistory, ChatHistoryBatchMessagesRequest, ChatMessage, ChatMessageContent, ChatMessageError, ChatMessageWithAttachments, ChatPreview, ChatPreviewData, ChatResponse, ChatStream, ClientOptions, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponse, CompleteHandlerResponses, CompleteOnboardingRequest, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionError, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponse, CompletePipedreamMcpConnectionResponses, CompletionUsage, ConnectedServer, ConversationRecord, CopyChatData, CopyChatError, CopyChatErrors, CopyChatResponse, CopyChatResponses, CreateChatData, CreateChatError, CreateChatErrors, CreateChatRequest, CreateChatResponse, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenError, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponse, CreatePipedreamMcpTokenResponses, DatabaseChange, DecisionErrorBody, DecisionRequest, DecisionResponse, DecisionsData, DecisionsError, DecisionsErrors, DecisionsResponse, DecisionsResponses, DeleteChatData, DeleteChatError, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerError, DeleteMcpServerErrors, DeleteMcpServerResponse, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionError, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponse, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponse, DiscoverHandlerResponses, DismissRunHandlerData, DismissRunHandlerErrors, DismissRunHandlerResponse, DismissRunHandlerResponses, DocumentCognitionServiceApiVersion, DocumentReference, DocumentTextPart, DynamicSchema, Entity, EntityType, ErrorBody, ErrorResponse, Expiry, FeatureUsage, FileType, FreeTierModel, GenericErrorResponse, GetBatchPreviewData, GetBatchPreviewError, GetBatchPreviewErrors, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchPreviewResponse2, GetBatchPreviewResponses, GetChatData, GetChatError, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerError, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponse, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerError, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponse, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsError, GetChatPermissionsErrors, GetChatPermissionsResponse, GetChatPermissionsResponse2, GetChatPermissionsResponses, GetChatResponse, GetChatResponse2, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerError, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponse, GetChatsForAttachmentHandlerResponses, GetChatsForAttachmentResponse, GetCitationHandlerData, GetCitationHandlerError, GetCitationHandlerErrors, GetCitationHandlerResponse, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerError, GetMemoryHandlerErrors, GetMemoryHandlerResponse, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Response, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponse, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerError, GetUsageHandlerErrors, GetUsageHandlerResponse, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HttpSendChatMessageRequest, ImportEntity, ImportRun, ImportSource, ImportState, ImportStatus, Initiator, JwtPayload, LinearIssueMeta, LinkShare, ListMcpServersData, ListMcpServersError, ListMcpServersErrors, ListMcpServersResponse, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsError, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponse, ListPipedreamMcpConnectionsResponses, MacroUserIdStr, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, MemoryErrorBody, MemoryResponse, MessageWithAttachments, ModelSpeed, NewAttachment, NewChatMessage, NewMessageAttachment, NotionDocMeta, OnboardingRow, OnboardingState, OnboardingStatus, PatchChatData, PatchChatError, PatchChatErrors, PatchChatRequest, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatError, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, PipedreamCatalogEntryResponse, PipedreamCatalogResponse, PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamTokenResponse, PipedreamUpdateRequest, Price, ProjectionStateResponse, ProjectionStatus, RefreshCadence, RejectToolCallData, RejectToolCallError, RejectToolCallErrors, RejectToolCallRequest, RejectToolCallResponses, RetryGatherHandlerData, RetryGatherHandlerError, RetryGatherHandlerErrors, RetryGatherHandlerResponse, RetryGatherHandlerResponses, RevertDeleteChatData, RevertDeleteChatError, RevertDeleteChatErrors, RevertDeleteChatResponses, Role, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponse, RunImportHandlerResponses, RunImportOutcome, RunImportRequest, RunStatus, SendChatMessageData, SendChatMessageError, SendChatMessageErrors, SendChatMessagePayload, SendChatMessageResponse, SendChatMessageResponse2, SendChatMessageResponses, ServerResponse, SetPricingHandlerData, SetPricingHandlerError, SetPricingHandlerErrors, SetPricingHandlerResponses, SetPricingRequest, SharePermissionV2, SlackChannelMeta, SlackParticipant, StartAuthRequest, StartAuthResponse, StartMcpAuthData, StartMcpAuthError, StartMcpAuthErrors, StartMcpAuthResponse, StartMcpAuthResponses, StopChatStreamData, StopChatStreamError, StopChatStreamError2, StopChatStreamErrors, StopChatStreamRequest, StopChatStreamResponse, StopChatStreamResponse2, StopChatStreamResponses, StreamError, StringIdResponse, StructuredCompletionData, StructuredCompletionError, StructuredCompletionError2, StructuredCompletionErrors, StructuredCompletionOutcome, StructuredCompletionRequest, StructuredCompletionResponse, StructuredCompletionResponse2, StructuredCompletionResponses, StructuredToolActivity, TargetType, ToolOutcome, ToolSet, UpdateChannelSharePermission, UpdateMcpServerData, UpdateMcpServerError, UpdateMcpServerErrors, UpdateMcpServerResponse, UpdateMcpServerResponses, UpdateOperation, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionError, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponse, UpdatePipedreamMcpConnectionResponses, UpdateServerRequest, UpdateSharePermissionRequestV2, UpdateToolCallData, UpdateToolCallError, UpdateToolCallErrors, UpdateToolCallRequest, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseError, UpdateToolResponseErrors, UpdateToolResponseRequest, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionError, UpsertAiProjectionErrors, UpsertAiProjectionResponse, UpsertAiProjectionResponses, UpsertProjectionRequest, Usage, UsageRequest, UsageSummary, UserPdfRect, UserToolResponseValue, WebCitation, WithChatId } from './types.gen';
+export type { AccessLevel, AddMcpServerData, AddMcpServerError, AddMcpServerErrors, AddMcpServerResponse, AddMcpServerResponses, AddServerRequest, AiAdmissionErrorBody, AiFeature, AssistantMessagePart, AttachmentMetadata, AttachmentType, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogError, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponse, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolError, CallToolErrors, CallToolRequest, CallToolResponse, CallToolResponse2, CallToolResponses, ChannelSharePermission, ChannelType, Chat, ChatAttachment, ChatHistory, ChatHistoryBatchMessagesRequest, ChatMessage, ChatMessageContent, ChatMessageError, ChatMessageWithAttachments, ChatPreview, ChatPreviewData, ChatResponse, ChatStream, ClientOptions, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponse, CompleteHandlerResponses, CompleteOnboardingRequest, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionError, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponse, CompletePipedreamMcpConnectionResponses, CompletionUsage, ConnectedServer, ConversationRecord, CopyChatData, CopyChatError, CopyChatErrors, CopyChatResponse, CopyChatResponses, CreateChatData, CreateChatError, CreateChatErrors, CreateChatRequest, CreateChatResponse, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenError, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponse, CreatePipedreamMcpTokenResponses, DatabaseChange, DecisionErrorBody, DecisionRequest, DecisionResponse, DecisionsData, DecisionsError, DecisionsErrors, DecisionsResponse, DecisionsResponses, DeleteChatData, DeleteChatError, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerError, DeleteMcpServerErrors, DeleteMcpServerResponse, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionError, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponse, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponse, DiscoverHandlerResponses, DismissedPrompts, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponse, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponse, DismissPromptHandlerResponses, DismissRunHandlerData, DismissRunHandlerErrors, DismissRunHandlerResponse, DismissRunHandlerResponses, DocumentCognitionServiceApiVersion, DocumentReference, DocumentTextPart, DynamicSchema, Entity, EntityType, ErrorBody, ErrorResponse, Expiry, FeatureUsage, FileType, FreeTierModel, GenericErrorResponse, GetBatchPreviewData, GetBatchPreviewError, GetBatchPreviewErrors, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchPreviewResponse2, GetBatchPreviewResponses, GetChatData, GetChatError, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerError, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponse, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerError, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponse, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsError, GetChatPermissionsErrors, GetChatPermissionsResponse, GetChatPermissionsResponse2, GetChatPermissionsResponses, GetChatResponse, GetChatResponse2, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerError, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponse, GetChatsForAttachmentHandlerResponses, GetChatsForAttachmentResponse, GetCitationHandlerData, GetCitationHandlerError, GetCitationHandlerErrors, GetCitationHandlerResponse, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerError, GetMemoryHandlerErrors, GetMemoryHandlerResponse, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Response, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponse, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerError, GetUsageHandlerErrors, GetUsageHandlerResponse, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HttpSendChatMessageRequest, ImportEntity, ImportRun, ImportSource, ImportState, ImportStatus, Initiator, JwtPayload, LinearIssueMeta, LinkShare, ListMcpServersData, ListMcpServersError, ListMcpServersErrors, ListMcpServersResponse, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsError, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponse, ListPipedreamMcpConnectionsResponses, MacroUserIdStr, McpAuthCallbackData, McpAuthCallbackError, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, MemoryErrorBody, MemoryResponse, MessageWithAttachments, ModelSpeed, NewAttachment, NewChatMessage, NewMessageAttachment, NotionDocMeta, OnboardingRow, OnboardingState, OnboardingStatus, PatchChatData, PatchChatError, PatchChatErrors, PatchChatRequest, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatError, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, PipedreamCatalogEntryResponse, PipedreamCatalogResponse, PipedreamCompleteRequest, PipedreamConnectionResponse, PipedreamTokenResponse, PipedreamUpdateRequest, Price, ProjectionStateResponse, ProjectionStatus, RefreshCadence, RejectToolCallData, RejectToolCallError, RejectToolCallErrors, RejectToolCallRequest, RejectToolCallResponses, RetryGatherHandlerData, RetryGatherHandlerError, RetryGatherHandlerErrors, RetryGatherHandlerResponse, RetryGatherHandlerResponses, RevertDeleteChatData, RevertDeleteChatError, RevertDeleteChatErrors, RevertDeleteChatResponses, Role, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponse, RunImportHandlerResponses, RunImportOutcome, RunImportRequest, RunStatus, SendChatMessageData, SendChatMessageError, SendChatMessageErrors, SendChatMessagePayload, SendChatMessageResponse, SendChatMessageResponse2, SendChatMessageResponses, ServerResponse, SetPricingHandlerData, SetPricingHandlerError, SetPricingHandlerErrors, SetPricingHandlerResponses, SetPricingRequest, SharePermissionV2, SlackChannelMeta, SlackParticipant, StartAuthRequest, StartAuthResponse, StartMcpAuthData, StartMcpAuthError, StartMcpAuthErrors, StartMcpAuthResponse, StartMcpAuthResponses, StopChatStreamData, StopChatStreamError, StopChatStreamError2, StopChatStreamErrors, StopChatStreamRequest, StopChatStreamResponse, StopChatStreamResponse2, StopChatStreamResponses, StreamError, StringIdResponse, StructuredCompletionData, StructuredCompletionError, StructuredCompletionError2, StructuredCompletionErrors, StructuredCompletionOutcome, StructuredCompletionRequest, StructuredCompletionResponse, StructuredCompletionResponse2, StructuredCompletionResponses, StructuredToolActivity, TargetType, ToolOutcome, ToolSet, UpdateChannelSharePermission, UpdateMcpServerData, UpdateMcpServerError, UpdateMcpServerErrors, UpdateMcpServerResponse, UpdateMcpServerResponses, UpdateOperation, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionError, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponse, UpdatePipedreamMcpConnectionResponses, UpdateServerRequest, UpdateSharePermissionRequestV2, UpdateToolCallData, UpdateToolCallError, UpdateToolCallErrors, UpdateToolCallRequest, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseError, UpdateToolResponseErrors, UpdateToolResponseRequest, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionError, UpsertAiProjectionErrors, UpsertAiProjectionResponse, UpsertAiProjectionResponses, UpsertProjectionRequest, Usage, UsageRequest, UsageSummary, UserPdfRect, UserToolResponseValue, WebCitation, WithChatId } from './types.gen';
diff --git a/packages/sdk/generated/cognition/sdk.gen.ts b/packages/sdk/generated/cognition/sdk.gen.ts
index 1f5381e872..6dd5f2e5c6 100644
--- a/packages/sdk/generated/cognition/sdk.gen.ts
+++ b/packages/sdk/generated/cognition/sdk.gen.ts
@@ -2,7 +2,7 @@
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
import { client } from './client.gen';
-import type { AddMcpServerData, AddMcpServerErrors, AddMcpServerResponses, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolErrors, CallToolResponses, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponses, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponses, CopyChatData, CopyChatErrors, CopyChatResponses, CreateChatData, CreateChatErrors, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponses, DecisionsData, DecisionsErrors, DecisionsResponses, DeleteChatData, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerErrors, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponses, DismissRunHandlerData, DismissRunHandlerErrors, DismissRunHandlerResponses, GetBatchPreviewData, GetBatchPreviewErrors, GetBatchPreviewResponses, GetChatData, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsErrors, GetChatPermissionsResponses, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponses, GetCitationHandlerData, GetCitationHandlerErrors, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerErrors, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerErrors, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponses, ListMcpServersData, ListMcpServersErrors, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponses, McpAuthCallbackData, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, PatchChatData, PatchChatErrors, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, RejectToolCallData, RejectToolCallErrors, RejectToolCallResponses, RetryGatherHandlerData, RetryGatherHandlerErrors, RetryGatherHandlerResponses, RevertDeleteChatData, RevertDeleteChatErrors, RevertDeleteChatResponses, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponses, SendChatMessageData, SendChatMessageErrors, SendChatMessageResponses, SetPricingHandlerData, SetPricingHandlerErrors, SetPricingHandlerResponses, StartMcpAuthData, StartMcpAuthErrors, StartMcpAuthResponses, StopChatStreamData, StopChatStreamErrors, StopChatStreamResponses, StructuredCompletionData, StructuredCompletionErrors, StructuredCompletionResponses, UpdateMcpServerData, UpdateMcpServerErrors, UpdateMcpServerResponses, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponses, UpdateToolCallData, UpdateToolCallErrors, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseErrors, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionErrors, UpsertAiProjectionResponses } from './types.gen';
+import type { AddMcpServerData, AddMcpServerErrors, AddMcpServerResponses, BrowsePipedreamMcpCatalogData, BrowsePipedreamMcpCatalogErrors, BrowsePipedreamMcpCatalogResponses, CallToolData, CallToolErrors, CallToolResponses, CompleteHandlerData, CompleteHandlerErrors, CompleteHandlerResponses, CompletePipedreamMcpConnectionData, CompletePipedreamMcpConnectionErrors, CompletePipedreamMcpConnectionResponses, CopyChatData, CopyChatErrors, CopyChatResponses, CreateChatData, CreateChatErrors, CreateChatResponses, CreatePipedreamMcpTokenData, CreatePipedreamMcpTokenErrors, CreatePipedreamMcpTokenResponses, DecisionsData, DecisionsErrors, DecisionsResponses, DeleteChatData, DeleteChatErrors, DeleteChatResponses, DeleteMcpServerData, DeleteMcpServerErrors, DeleteMcpServerResponses, DeletePipedreamMcpConnectionData, DeletePipedreamMcpConnectionErrors, DeletePipedreamMcpConnectionResponses, DiscoverHandlerData, DiscoverHandlerErrors, DiscoverHandlerResponses, DismissedPromptsHandlerData, DismissedPromptsHandlerErrors, DismissedPromptsHandlerResponses, DismissPromptHandlerData, DismissPromptHandlerErrors, DismissPromptHandlerResponses, DismissRunHandlerData, DismissRunHandlerErrors, DismissRunHandlerResponses, GetBatchPreviewData, GetBatchPreviewErrors, GetBatchPreviewResponses, GetChatData, GetChatErrors, GetChatHistoryBatchMessagesHandlerData, GetChatHistoryBatchMessagesHandlerErrors, GetChatHistoryBatchMessagesHandlerResponses, GetChatHistoryHandlerData, GetChatHistoryHandlerErrors, GetChatHistoryHandlerResponses, GetChatPermissionsData, GetChatPermissionsErrors, GetChatPermissionsResponses, GetChatResponses, GetChatsForAttachmentHandlerData, GetChatsForAttachmentHandlerErrors, GetChatsForAttachmentHandlerResponses, GetCitationHandlerData, GetCitationHandlerErrors, GetCitationHandlerResponses, GetMemoryHandlerData, GetMemoryHandlerErrors, GetMemoryHandlerResponses, GetStateHandler2Data, GetStateHandler2Errors, GetStateHandler2Responses, GetStateHandlerData, GetStateHandlerErrors, GetStateHandlerResponses, GetUsageHandlerData, GetUsageHandlerErrors, GetUsageHandlerResponses, HealthHandlerData, HealthHandlerResponses, ListMcpServersData, ListMcpServersErrors, ListMcpServersResponses, ListPipedreamMcpConnectionsData, ListPipedreamMcpConnectionsErrors, ListPipedreamMcpConnectionsResponses, McpAuthCallbackData, McpAuthCallbackErrors, McpAuthCallbackResponses, McpOauthClientMetadataData, McpOauthClientMetadataResponses, PatchChatData, PatchChatErrors, PatchChatResponses, PermanentlyDeleteChatData, PermanentlyDeleteChatErrors, PermanentlyDeleteChatResponses, RejectToolCallData, RejectToolCallErrors, RejectToolCallResponses, RetryGatherHandlerData, RetryGatherHandlerErrors, RetryGatherHandlerResponses, RevertDeleteChatData, RevertDeleteChatErrors, RevertDeleteChatResponses, RunImportHandlerData, RunImportHandlerErrors, RunImportHandlerResponses, SendChatMessageData, SendChatMessageErrors, SendChatMessageResponses, SetPricingHandlerData, SetPricingHandlerErrors, SetPricingHandlerResponses, StartMcpAuthData, StartMcpAuthErrors, StartMcpAuthResponses, StopChatStreamData, StopChatStreamErrors, StopChatStreamResponses, StructuredCompletionData, StructuredCompletionErrors, StructuredCompletionResponses, UpdateMcpServerData, UpdateMcpServerErrors, UpdateMcpServerResponses, UpdatePipedreamMcpConnectionData, UpdatePipedreamMcpConnectionErrors, UpdatePipedreamMcpConnectionResponses, UpdateToolCallData, UpdateToolCallErrors, UpdateToolCallResponses, UpdateToolResponseData, UpdateToolResponseErrors, UpdateToolResponseResponses, UpsertAiProjectionData, UpsertAiProjectionErrors, UpsertAiProjectionResponses } from './types.gen';
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
/**
@@ -422,6 +422,21 @@ export class Sdk extends HeyApiClient {
});
}
+ /**
+ * List the sidebar prompts the authenticated user dismissed on any device.
+ */
+ public dismissedPromptsHandler<ThrowOnError extends boolean = false>(options?: Options<DismissedPromptsHandlerData, ThrowOnError>): RequestResult<DismissedPromptsHandlerResponses, DismissedPromptsHandlerErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<DismissedPromptsHandlerResponses, DismissedPromptsHandlerErrors, ThrowOnError>({ url: '/onboarding/prompts', ...options });
+ }
+
+ /**
+ * Dismiss one sidebar prompt for the authenticated user, on every device.
+ * Idempotent.
+ */
+ public dismissPromptHandler<ThrowOnError extends boolean = false>(options: Options<DismissPromptHandlerData, ThrowOnError>): RequestResult<DismissPromptHandlerResponses, DismissPromptHandlerErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<DismissPromptHandlerResponses, DismissPromptHandlerErrors, ThrowOnError>({ url: '/onboarding/prompts/{prompt_id}/dismiss', ...options });
+ }
+
/**
* Browse or search the catalog of connectable apps.
*
diff --git a/packages/sdk/generated/cognition/types.gen.ts b/packages/sdk/generated/cognition/types.gen.ts
index bc8d287059..086eafd91f 100644
--- a/packages/sdk/generated/cognition/types.gen.ts
+++ b/packages/sdk/generated/cognition/types.gen.ts
@@ -533,6 +533,16 @@ export type DecisionResponse = {
};
};
+/**
+ * The prompts the user dismissed, on any device.
+ */
+export type DismissedPrompts = {
+ /**
+ * Dismissed prompt ids, oldest dismissal first.
+ */
+ dismissed: Array<string>;
+};
+
export type DocumentCognitionServiceApiVersion = 'v1' | 'v2';
export type DocumentReference = UserPdfRect & {
@@ -2462,7 +2472,7 @@ export type DiscoverHandlerData = {
export type DiscoverHandlerErrors = {
/**
- * Unknown import source or discovery not supported
+ * Unknown import source
*/
400: unknown;
/**
@@ -2813,6 +2823,61 @@ export type CompleteHandlerResponses = {
export type CompleteHandlerResponse = CompleteHandlerResponses[keyof CompleteHandlerResponses];
+export type DismissedPromptsHandlerData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/onboarding/prompts';
+};
+
+export type DismissedPromptsHandlerErrors = {
+ /**
+ * Internal server error
+ */
+ 500: unknown;
+};
+
+export type DismissedPromptsHandlerResponses = {
+ /**
+ * Dismissed prompt ids
+ */
+ 200: DismissedPrompts;
+};
+
+export type DismissedPromptsHandlerResponse = DismissedPromptsHandlerResponses[keyof DismissedPromptsHandlerResponses];
+
+export type DismissPromptHandlerData = {
+ body?: never;
+ path: {
+ /**
+ * Prompt id, e.g. `import:files`
+ */
+ prompt_id: string;
+ };
+ query?: never;
+ url: '/onboarding/prompts/{prompt_id}/dismiss';
+};
+
+export type DismissPromptHandlerErrors = {
+ /**
+ * Malformed prompt id
+ */
+ 400: unknown;
+ /**
+ * Internal server error
+ */
+ 500: unknown;
+};
+
+export type DismissPromptHandlerResponses = {
+ /**
+ * Dismissed
+ */
+ 204: void;
+};
+
+export type DismissPromptHandlerResponse = DismissPromptHandlerResponses[keyof DismissPromptHandlerResponses];
+
export type BrowsePipedreamMcpCatalogData = {
body?: never;
path?: never;
diff --git a/packages/sdk/specs/cognition.json b/packages/sdk/specs/cognition.json
index eb6a220fba..34ef75823b 100644
--- a/packages/sdk/specs/cognition.json
+++ b/packages/sdk/specs/cognition.json
@@ -1212,7 +1212,7 @@
"description": "Discovery accepted (idempotent)"
},
"400": {
- "description": "Unknown import source or discovery not supported"
+ "description": "Unknown import source"
},
"500": {
"description": "Internal server error"
@@ -1725,6 +1725,57 @@
}
}
},
+ "/onboarding/prompts": {
+ "get": {
+ "tags": ["onboarding"],
+ "summary": "List the sidebar prompts the authenticated user dismissed on any device.",
+ "operationId": "dismissed_prompts_handler",
+ "responses": {
+ "200": {
+ "description": "Dismissed prompt ids",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/DismissedPrompts"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
+ "/onboarding/prompts/{prompt_id}/dismiss": {
+ "post": {
+ "tags": ["onboarding"],
+ "summary": "Dismiss one sidebar prompt for the authenticated user, on every device.\nIdempotent.",
+ "operationId": "dismiss_prompt_handler",
+ "parameters": [
+ {
+ "name": "prompt_id",
+ "in": "path",
+ "description": "Prompt id, e.g. `import:files`",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Dismissed"
+ },
+ "400": {
+ "description": "Malformed prompt id"
+ },
+ "500": {
+ "description": "Internal server error"
+ }
+ }
+ }
+ },
"/pipedream/mcp/catalog": {
"get": {
"tags": ["pipedream-mcp"],
@@ -3219,6 +3270,20 @@
}
}
},
+ "DismissedPrompts": {
+ "type": "object",
+ "description": "The prompts the user dismissed, on any device.",
+ "required": ["dismissed"],
+ "properties": {
+ "dismissed": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "description": "Dismissed prompt ids, oldest dismissal first."
+ }
+ }
+ },
"DocumentCognitionServiceApiVersion": {
"type": "string",
"enum": ["v1", "v2"]
diff --git a/packages/sdk/src/coverage/skipped.ts b/packages/sdk/src/coverage/skipped.ts
index 7e3cfe559a..874976b6c0 100644
--- a/packages/sdk/src/coverage/skipped.ts
+++ b/packages/sdk/src/coverage/skipped.ts
@@ -174,6 +174,9 @@ export const cognitionExcluded = [
'getStateHandler',
'getStateHandler2',
'completeHandler',
+ // Sidebar setup and import cards remember dismissals per user (web app only).
+ 'dismissedPromptsHandler',
+ 'dismissPromptHandler',
'setPricingHandler',
'startMcpAuth',
'updateMcpServer',
diff --git a/services/document_cognition_service/src/api/swagger.rs b/services/document_cognition_service/src/api/swagger.rs
index 2c710ac1d6..cd3e327f5e 100644
--- a/services/document_cognition_service/src/api/swagger.rs
+++ b/services/document_cognition_service/src/api/swagger.rs
@@ -99,6 +99,8 @@ use utoipa::OpenApi;
import_api::dismiss_run_handler,
onboarding_api::get_state_handler,
onboarding_api::complete_handler,
+ onboarding_api::dismissed_prompts_handler,
+ onboarding_api::dismiss_prompt_handler,
ai_usage_api::get_usage_handler,
ai_usage_api::set_pricing_handler,
ai_projections::inbound::axum_router::upsert_projection::handler::<crate::api::context::DcsAiProjectionService>,
@@ -216,6 +218,7 @@ use utoipa::OpenApi;
// Onboarding
onboarding::domain::models::OnboardingState,
+ onboarding::domain::models::DismissedPrompts,
onboarding::domain::models::OnboardingRow,
onboarding::domain::models::OnboardingStatus,
onboarding::domain::models::ConnectedServer,