Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(slack-import): simplify setup and add channel-only import flow (#7847)
Jacob Beckerman55bb615886d3
diff --git a/apps/web/src/components/icon/slack-color.svg b/apps/web/src/components/icon/slack-color.svgnew file mode 100644index 0000000000..f15c274edb--- /dev/null+++ b/apps/web/src/components/icon/slack-color.svg@@ -0,0 +1 @@+<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Slack</title><path fill="#E01E5A" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"/><path fill="#36C5F0" d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"/><path fill="#2EB67D" d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312z"/><path fill="#ECB22E" d="M15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"/></svg>diff --git a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsxindex 765de28929..5f65b6580d 100644--- a/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx+++ b/apps/web/src/features/channels-view/components/rail/ExpandedChannelsRail.tsx@@ -5,6 +5,7 @@ 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';@@ -30,6 +31,7 @@ import {type JSX,Match,Show,+ Suspense,Switch,} from 'solid-js';import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';@@ -86,6 +88,10 @@ 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' },@@ -1102,6 +1108,9 @@ 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"><divdiff --git a/apps/web/src/features/settings/connections/ConnectionsPage.test.tsx b/apps/web/src/features/settings/connections/ConnectionsPage.test.tsxnew file mode 100644index 0000000000..7dbfcaf648--- /dev/null+++ b/apps/web/src/features/settings/connections/ConnectionsPage.test.tsx@@ -0,0 +1,196 @@+import {+ clearPendingConnectApp,+ requestConnectApp,+} from '@core/pipedream/pendingConnect';+import type { ImportState } from '@queries/import';+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from '@solidjs/testing-library';+import { createSignal, type JSX } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { ConnectionsPage } from './ConnectionsPage';++const mocks = vi.hoisted(() => ({+ connected: false,+ connect: vi.fn(),+ discover: vi.fn(),+ importChannels: vi.fn(),+ failure: vi.fn(),+}));+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('@core/component/Toast/Toast', () => ({+ toast: { failure: mocks.failure },+}));+vi.mock('@core/component/TabsInset', () => ({ TabsInset: () => <div /> }));+// The real import module loads websocket infrastructure during initialization.+vi.mock('@service-connection/websocket', () => ({+ createConnectionWebsocketEffect: vi.fn(),+}));+vi.mock('@queries/pipedream-connectors', () => ({+ connectPipedreamApp: mocks.connect,+}));+vi.mock('./use-connections-model', () => ({+ useConnectionsModel: () => ({+ model: () => ({}),+ ready: () => true,+ error: () => false,+ partialError: () => false,+ retry: vi.fn(),+ }),+}));+vi.mock('./model', () => ({+ capabilitiesFor: () =>+ mocks.connected ? [{ mechanism: 'pipedream', status: 'connected' }] : [],+}));+vi.mock('./ConnectedView', () => ({+ ConnectedView: () => <p>Connections overview</p>,+}));+vi.mock('./DiscoverView', () => ({ DiscoverView: () => <div /> }));+vi.mock('./PipedreamAiProvider', () => ({+ PipedreamAiProvider: () => <div />,+}));+vi.mock('@queries/import', async (importOriginal) => ({+ ...(await importOriginal<typeof import('@queries/import')>()),+ useImportQuery: () => ({+ isSuccess: true,+ get data() {+ return state();+ },+ }),+ useDiscoverMutation: () => ({ mutate: mocks.discover, isPending: false }),+ useRunImportMutation: () => ({+ mutate: mocks.importChannels,+ isPending: false,+ }),+}));+vi.mock('@ui', () => ({+ Button: (props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) => (+ <button {...props} />+ ),+}));+vi.mock('../primitives', () => ({+ SettingsPage: (props: {+ title: string;+ description: string;+ children: JSX.Element;+ onBack?: () => void;+ }) => (+ <section>+ <h1>{props.title}</h1>+ <p>{props.description}</p>+ {props.children}+ <button onClick={props.onBack}>Back</button>+ </section>+ ),+ SettingsSection: (props: { title: string; children: JSX.Element }) => (+ <section aria-label={props.title}>{props.children}</section>+ ),+ SettingsCard: (props: { children: JSX.Element }) => (+ <div>{props.children}</div>+ ),+}));++beforeEach(() => {+ vi.clearAllMocks();+ clearPendingConnectApp();+ mocks.connected = false;+ setState({ runs: [], entities: [] });+});+afterEach(cleanup);++function startImport() {+ requestConnectApp('slack', 'import-slack-channels');+ render(() => <ConnectionsPage onOpenMacroMcp={() => {}} />);+}++function provideChannels() {+ setState({+ runs: [],+ entities: ['general', 'random'].map((name) => ({+ id: name,+ foreign_id: `C${name}`,+ source: 'slack',+ status: 'staged',+ initiator: 'manual',+ user_id: 'me',+ created_at: '',+ updated_at: '',+ metadata: { name, members_resolved: true, participants: [] },+ })),+ });+}++describe('Slack channel import handoff', () => {+ it('reuses a connection, discovers channels and imports only the selected channels', async () => {+ mocks.connected = true;+ startImport();+ await screen.findByText('Import channels without history');+ expect(mocks.connect).not.toHaveBeenCalled();+ expect(mocks.discover).toHaveBeenCalledExactlyOnceWith(+ 'slack',+ expect.any(Object)+ );+ expect(mocks.importChannels).not.toHaveBeenCalled();+ provideChannels();+ fireEvent.click(screen.getByRole('checkbox', { name: 'Select general' }));+ fireEvent.click(screen.getByRole('button', { name: 'Import 1 channel' }));+ expect(mocks.importChannels).toHaveBeenCalledWith(+ { importIds: ['general'], discardIds: [] },+ expect.any(Object)+ );+ });++ it('waits for authorization, then automatically discovers channels', async () => {+ let authorize!: (outcome: string) => void;+ mocks.connect.mockReturnValueOnce(+ new Promise((resolve) => {+ authorize = resolve;+ })+ );+ startImport();+ await screen.findByRole('button', { name: 'Connecting Slack…' });+ expect(mocks.connect).toHaveBeenCalledExactlyOnceWith({+ appSlug: 'slack',+ serverName: 'Slack',+ });+ expect(mocks.discover).not.toHaveBeenCalled();+ authorize('connected');+ await waitFor(() => expect(mocks.discover).toHaveBeenCalledOnce());+ expect(screen.getByRole('button', { name: 'Find channels' })).toBeTruthy();+ expect(mocks.importChannels).not.toHaveBeenCalled();+ });++ it('allows retry after cancelling authorization without discovering or importing', async () => {+ mocks.connect.mockResolvedValueOnce('closed');+ startImport();+ await screen.findByRole('button', { name: 'Connect Slack to continue' });+ expect(mocks.discover).not.toHaveBeenCalled();+ mocks.connect.mockResolvedValueOnce('connected');+ fireEvent.click(+ screen.getByRole('button', { name: 'Connect Slack to continue' })+ );+ await waitFor(() => expect(mocks.discover).toHaveBeenCalledOnce());+ expect(mocks.importChannels).not.toHaveBeenCalled();+ });++ it('preserves ordinary external connector requests', async () => {+ mocks.connect.mockResolvedValueOnce('connected');+ requestConnectApp('linear');+ render(() => <ConnectionsPage onOpenMacroMcp={() => {}} />);+ await waitFor(() =>+ expect(mocks.connect).toHaveBeenCalledWith({ appSlug: 'linear' })+ );+ expect(mocks.discover).not.toHaveBeenCalled();+ });+});diff --git a/apps/web/src/features/settings/connections/ConnectionsPage.tsx b/apps/web/src/features/settings/connections/ConnectionsPage.tsxindex b46c95a9c8..fd9eb345d3 100644--- a/apps/web/src/features/settings/connections/ConnectionsPage.tsx+++ b/apps/web/src/features/settings/connections/ConnectionsPage.tsx@@ -6,11 +6,13 @@ import {} from '@core/pipedream/pendingConnect';import { connectPipedreamApp } from '@queries/pipedream-connectors';import { Button } from '@ui';-import { createEffect, on, Show } from 'solid-js';+import { createEffect, createSignal, on, Show, Suspense } from 'solid-js';import { SettingsPage } from '../primitives';import { ConnectedView } from './ConnectedView';import { DiscoverView } from './DiscoverView';+import { capabilitiesFor } from './model';import { PipedreamAiProvider } from './PipedreamAiProvider';+import { SlackChannelImportFlow } from './slack-channel-import/SlackChannelImportFlow';import { useConnectionsModel } from './use-connections-model';import { ConnectionsViewProvider, useConnectionsView } from './view-state';@@ -40,91 +42,132 @@ export function ConnectionsPage(props: { onOpenMacroMcp: () => void }) {function ConnectionsContent(props: { onOpenMacroMcp: () => void }) {const { model, ready, error, partialError, retry } = useConnectionsModel();const view = useConnectionsView();- // Agent replies can request a connection while this page is already mounted.+ const [importSlackChannels, setImportSlackChannels] = createSignal(false);+ // External entry points request a connector or the complete channel import flow.createEffect(on(pendingConnectApp, (requested) => {if (!requested) return;clearPendingConnectApp();- void connectPipedreamApp({ appSlug: requested })- .then((outcome) => {- if (outcome === 'unsupported')- toast.failure('Connectors are not available on this deployment');- })- .catch(() => toast.failure(`Failed to connect ${requested}`));+ if (requested.intent === 'import-slack-channels') {+ setImportSlackChannels(true);+ return;+ }+ void connectRequestedApp(requested.appSlug);}));+ async function connectRequestedApp(appSlug: string) {+ try {+ const outcome = await connectPipedreamApp({ appSlug });+ if (outcome === 'unsupported')+ toast.failure('Connectors are not available on this deployment');+ } catch {+ toast.failure(`Failed to connect ${appSlug}`);+ }+ }+ const slackConnected = () =>+ capabilitiesFor(model(), 'slack').some(+ (capability) =>+ capability.mechanism === 'pipedream' &&+ capability.status === 'connected'+ );const description ="Connect the tools your team already uses so Macro's agent can work in them.";return (<Show- when={!error()}+ when={importSlackChannels()}fallback={- <SettingsPage- title="Agent connections"- description={description}- onBack={view.provider() ? view.closeProvider : undefined}- backLabel="Connections"- >- <div class="flex items-center gap-3 text-sm text-ink-muted">- Couldn't load Connections.- <Button variant="outline" size="sm" depth={3} onClick={retry}>- Retry- </Button>- </div>- </SettingsPage>- }- >- <Show- when={ready() && view.provider()}- keyed- fallback={- <SettingsPage- title="Agent connections"- description={description}- signpost={<MacroMcpSignpost onOpen={props.onOpenMacroMcp} />}- >- <TabsInset- fullWidth- list={[- { value: 'connected', label: 'Connected' },- { value: 'discover', label: 'Discover' },- ]}- value={view.mode()}- onChange={(value) =>- value === 'discover' ? view.showDiscover() : view.showOverview()- }- />- <Show when={partialError()}>- <div- role="status"- class="flex items-center gap-3 text-sm text-ink-muted"- >- Some connections couldn't be loaded.+ <Show+ when={!error()}+ fallback={+ <SettingsPage+ title="Agent connections"+ description={description}+ onBack={view.provider() ? view.closeProvider : undefined}+ backLabel="Connections"+ >+ <div class="flex items-center gap-3 text-sm text-ink-muted">+ Couldn't load Connections.<Button variant="outline" size="sm" depth={3} onClick={retry}>Retry</Button></div>- </Show>- <Show- when={ready()}- fallback={- <p class="text-sm text-ink-muted">Loading Connections…</p>- }- >- <Show- when={view.mode() === 'discover'}- fallback={<ConnectedView model={model()} />}+ </SettingsPage>+ }+ >+ <Show+ when={ready() && view.provider()}+ keyed+ fallback={+ <SettingsPage+ title="Agent connections"+ description={description}+ signpost={<MacroMcpSignpost onOpen={props.onOpenMacroMcp} />}>- <DiscoverView model={model()} />- </Show>- </Show>- </SettingsPage>+ <TabsInset+ fullWidth+ list={[+ { value: 'connected', label: 'Connected' },+ { value: 'discover', label: 'Discover' },+ ]}+ value={view.mode()}+ onChange={(value) =>+ value === 'discover'+ ? view.showDiscover()+ : view.showOverview()+ }+ />+ <Show when={partialError()}>+ <div+ role="status"+ class="flex items-center gap-3 text-sm text-ink-muted"+ >+ Some connections couldn't be loaded.+ <Button+ variant="outline"+ size="sm"+ depth={3}+ onClick={retry}+ >+ Retry+ </Button>+ </div>+ </Show>+ <Show+ when={ready()}+ fallback={+ <p class="text-sm text-ink-muted">Loading Connections…</p>+ }+ >+ <Show+ when={view.mode() === 'discover'}+ fallback={<ConnectedView model={model()} />}+ >+ <DiscoverView model={model()} />+ </Show>+ </Show>+ </SettingsPage>+ }+ >+ {(provider) => (+ <PipedreamAiProvider model={model()} provider={provider} />+ )}+ </Show>+ </Show>+ }+ >+ <Show+ when={ready()}+ fallback={+ <p class="text-sm text-ink-muted">Loading Slack connection…</p>}>- {(provider) => (- <PipedreamAiProvider model={model()} provider={provider} />- )}+ <Suspense>+ <SlackChannelImportFlow+ connected={slackConnected()}+ onBack={() => setImportSlackChannels(false)}+ />+ </Suspense></Show></Show>);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.tsxindex 80a02ca029..ac9b512ffc 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@@ -8,10 +8,20 @@ const mocks = vi.hoisted(() => ({discover: vi.fn(),importChannels: vi.fn(),failure: vi.fn(),+ hidePromotion: vi.fn(),}));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('@core/component/Toast/Toast', () => ({toast: { failure: mocks.failure },}));@@ -144,11 +154,15 @@ describe('Slack channel import card', () => {setState({ runs: [], entities: [channel('general')] });render(() => <SlackChannelImportCard />);fireEvent.click(checkbox('Select general'));+ fireEvent.click(screen.getByRole('button', { name: 'Import 1 channel' }));+ mocks.importChannels.mock.calls[0][1].onSuccess();+ expect(mocks.hidePromotion).not.toHaveBeenCalled();setState({runs: [],entities: [channel('general', { status: 'importing' })],});expect(screen.getByText('Importing…')).toBeTruthy();+ expect(mocks.hidePromotion).not.toHaveBeenCalled();expect(screen.queryByRole('checkbox', { name: 'Select general' })).toBeNull();@@ -176,6 +190,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');});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.tsxindex 7ce364ddd6..7cb8607858 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,3 +1,4 @@+import { hideSlackImportPromotion } from '@app/features/slack-import/primitives/promotion';import { toast } from '@core/component/Toast/Toast';import { useUserId } from '@core/context/user';import { buildSimpleEntityUrl } from '@core/util/url';@@ -8,6 +9,7 @@ import {useImportQuery,useRunImportMutation,} from '@queries/import';+import { useCurrentTeamQuery } from '@queries/team/teams';import { Button } from '@ui';import {createEffect,@@ -15,6 +17,7 @@ import {createSignal,For,type JSX,+ on,Show,} from 'solid-js';import { SettingsCard, SettingsSection } from '../../primitives';@@ -98,8 +101,11 @@ function ChannelRow(props: ChannelRowProps): JSX.Element {);}-export function SlackChannelImportCard(): JSX.Element {+export function SlackChannelImportCard(+ props: { autoDiscover?: boolean } = {}+): JSX.Element {const userId = useUserId();+ const team = useCurrentTeamQuery();const query = useImportQuery();const discover = useDiscoverMutation();const importChannels = useRunImportMutation();@@ -110,6 +116,16 @@ export function SlackChannelImportCard(): JSX.Element {const state = () => (query.isSuccess ? query.data : EMPTY_STATE);const run = () => state().runs.find((run) => run.source === 'slack');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);+ }+ });const visible = createMemo(() =>filterRows(rows(), {search: search(),@@ -147,6 +163,21 @@ export function SlackChannelImportCard(): JSX.Element {});}+ let discoveryRequested = false;+ createEffect(+ on(+ () =>+ Boolean(+ props.autoDiscover && query.isSuccess && !query.isPlaceholderData+ ),+ (ready) => {+ if (!ready || discoveryRequested) return;+ discoveryRequested = true;+ if (!discovering()) findChannels();+ }+ )+ );+function startImport(): void {const ids = importIds();if (!ids.length) return;diff --git a/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportFlow.tsx b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportFlow.tsxnew file mode 100644index 0000000000..93411097fc--- /dev/null+++ b/apps/web/src/features/settings/connections/slack-channel-import/SlackChannelImportFlow.tsx@@ -0,0 +1,80 @@+import { SLACK_CONNECT_SLUG } from '@core/pipedream/slugs';+import { connectPipedreamApp } from '@queries/pipedream-connectors';+import { Button } from '@ui';+import { createSignal, onCleanup, onMount, Show } from 'solid-js';+import { SettingsPage } from '../../primitives';+import { SlackChannelImportCard } from './SlackChannelImportCard';++/** Continue through authorization into channel selection. */+export function SlackChannelImportFlow(props: {+ connected: boolean;+ onBack(): void;+}) {+ const [authorized, setAuthorized] = createSignal(false);+ const [busy, setBusy] = createSignal(false);+ const [error, setError] = createSignal<string>();+ let disposed = false;+ onCleanup(() => {+ disposed = true;+ });++ async function connect() {+ if (busy()) return;+ setBusy(true);+ setError(undefined);+ try {+ const outcome = await connectPipedreamApp({+ appSlug: SLACK_CONNECT_SLUG,+ serverName: 'Slack',+ });+ if (disposed) return;+ if (outcome === 'connected') setAuthorized(true);+ if (outcome === 'unsupported')+ setError('Slack connections are not available on this deployment.');+ } catch {+ if (!disposed) setError('Could not connect Slack. Please try again.');+ } finally {+ if (!disposed) setBusy(false);+ }+ }+ onMount(() => {+ if (!props.connected) void connect();+ });++ return (+ <SettingsPage+ title="Import channels without history"+ description="Copy public channel names and matching teammates into Macro. Messages stay in Slack; channels do not sync."+ onBack={props.onBack}+ backLabel="Connections"+ >+ <Show+ when={props.connected || authorized()}+ fallback={+ <div class="space-y-3 text-sm text-ink-muted">+ <p>+ Connect your Slack account to choose channels. No Slack admin role+ is needed, but your workspace may require app approval.+ </p>+ <Show when={error()}>+ {(message) => (+ <p role="alert" class="text-failure">+ {message()}+ </p>+ )}+ </Show>+ <Button+ variant="accent"+ disabled={busy()}+ onClick={() => void connect()}+ >+ {busy() ? 'Connecting Slack…' : 'Connect Slack to continue'}+ </Button>+ </div>+ }+ >+ <SlackChannelImportCard autoDiscover />+ </Show>+ </SettingsPage>+ );+}diff --git a/apps/web/src/features/slack-import/components/slack-connect-card.tsx b/apps/web/src/features/slack-import/components/slack-connect-card.tsxnew file mode 100644index 0000000000..945c435239--- /dev/null+++ b/apps/web/src/features/slack-import/components/slack-connect-card.tsx@@ -0,0 +1,24 @@+import SlackIcon from '@icon/mcp-slack.svg';+import CaretRightIcon from '@phosphor/caret-right.svg';++export function SlackConnectCard(props: { onConnect(): void }) {+ return (+ <button+ type="button"+ aria-label="Import channels without history"+ class="flex w-full items-center gap-4 rounded-lg border border-edge-muted p-4 text-left hover:bg-ink/4 focus-visible:outline-accent"+ onClick={props.onConnect}+ >+ <SlackIcon aria-hidden="true" class="size-5 shrink-0 text-ink-muted" />+ <span class="flex-1 space-y-1">+ <span class="block text-sm font-medium text-ink">+ Import channels without history+ </span>+ <span class="block text-xs text-ink-muted">+ Copy public channels and teammates. No Slack admin role needed.+ </span>+ </span>+ <CaretRightIcon aria-hidden="true" class="size-4 text-ink-extra-muted" />+ </button>+ );+}diff --git a/apps/web/src/features/slack-import/primitives/promotion.test.ts b/apps/web/src/features/slack-import/primitives/promotion.test.tsnew file mode 100644index 0000000000..0b68f4b8ea--- /dev/null+++ b/apps/web/src/features/slack-import/primitives/promotion.test.ts@@ -0,0 +1,41 @@+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.tsnew file mode 100644index 0000000000..8da629e281--- /dev/null+++ b/apps/web/src/features/slack-import/primitives/promotion.ts@@ -0,0 +1,37 @@+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.tsxnew file mode 100644index 0000000000..d27dde1eed--- /dev/null+++ b/apps/web/src/features/slack-import/slack-import-sidebar.test.tsx@@ -0,0 +1,89 @@+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { createSignal, 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 }));+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} />+ ),+}));+vi.mock('./slack-import', () => ({+ SlackImport: (props: { trigger: (open: () => void) => JSX.Element }) => (+ <>+ {props.trigger(() => {})}+ <p>Import dialog host</p>+ </>+ ),+}));++beforeEach(() => {+ scope += 1;+ setUserId(`sidebar-user-${scope}`);+ setTeamId(`sidebar-team-${scope}`);+ host.enabled = true;+ host.admin = true;+});+afterEach(() => {+ cleanup();+ localStorage.clear();+});++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', () => {+ render(() => <SlackImportSidebar />);+ hideSlackImportPromotion(userId(), teamId());+ expect(screen.queryByText('Bring Slack to Macro')).toBeNull();+ expect(screen.getByText('Import dialog host')).toBeTruthy();+ });++ it.each([+ { enabled: false, admin: true },+ { enabled: true, admin: false },+ ])('preserves the feature and admin gates: %o', (gate) => {+ Object.assign(host, gate);+ render(() => <SlackImportSidebar />);+ expect(screen.queryByText('Bring Slack to Macro')).toBeNull();+ });+});diff --git a/apps/web/src/features/slack-import/slack-import-sidebar.tsx b/apps/web/src/features/slack-import/slack-import-sidebar.tsxnew file mode 100644index 0000000000..e32a7a2af8--- /dev/null+++ b/apps/web/src/features/slack-import/slack-import-sidebar.tsx@@ -0,0 +1,70 @@+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 { 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';++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);++ 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>+ );+}diff --git a/apps/web/src/features/slack-import/slack-import.test.tsx b/apps/web/src/features/slack-import/slack-import.test.tsxindex 607c6d2b98..2dfe4a09a3 100644--- a/apps/web/src/features/slack-import/slack-import.test.tsx+++ b/apps/web/src/features/slack-import/slack-import.test.tsx@@ -1,6 +1,7 @@import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';import { createSignal } from 'solid-js';import { afterEach, describe, expect, it, vi } from 'vitest';+import type { ImportJob } from './context/contracts';import { importReceipt } from './tests/fake-sources';const host = vi.hoisted(() => ({@@ -11,10 +12,14 @@ const host = vi.hoisted(() => ({revalidate: vi.fn(async () => {}),createSource: vi.fn(),view: vi.fn(),+ openSettings: vi.fn(),+ requestConnect: vi.fn(),+ hidePromotion: vi.fn(),props: undefined as| {- onCompleted(): Promise<void>;+ onCompleted(job: ImportJob): Promise<void>;channelHref(id: string): string | undefined;+ onConnect?: () => void;}| undefined,}));@@ -24,6 +29,19 @@ vi.mock('@app/lib/analytics/posthog', () => ({vi.mock('@core/constant/featureFlags', () => ({enableSlackArchiveImport: {},}));+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('@core/pipedream/flag', () => ({+ usePipedreamMcpFlag: () => () => true,+}));+vi.mock('@core/pipedream/pendingConnect', () => ({+ requestConnectApp: host.requestConnect,+}));vi.mock('@core/util/reloadForNewerBuild', () => ({holdAutomaticReload: vi.fn(),}));@@ -82,6 +100,17 @@ afterEach(() => {});describe('Slack import production boundary', () => {+ it('hands off to the existing Slack connector flow', async () => {+ render(() => <SlackImport teamId="team" isAdmin />);+ await screen.findByText('Mounted import');+ host.props!.onConnect!();+ expect(host.requestConnect).toHaveBeenCalledWith(+ 'slack',+ 'import-slack-channels'+ );+ expect(host.openSettings).toHaveBeenCalledWith('Connections');+ });+it.each([{ isAdmin: false, enabled: true },{ isAdmin: true, enabled: false },@@ -99,7 +128,7 @@ describe('Slack import production boundary', () => {render(() => <SlackImport teamId={teamId()} isAdmin={admin()} />);await screen.findByText('Mounted import');expect(host.createSource).toHaveBeenCalledOnce();- await host.props!.onCompleted();+ await host.props!.onCompleted(importReceipt());expect(host.invalidateChannels).toHaveBeenCalledOnce();expect(host.invalidateSoup).toHaveBeenCalledOnce();expect(host.revalidate).toHaveBeenCalledOnce();@@ -109,4 +138,35 @@ describe('Slack import production boundary', () => {setAdmin(false);expect(screen.queryByText('Mounted import')).toBeNull();});++ it.each(['failed', 'cancelled', 'completed_with_errors'] as const)(+ 'does not hide the promotion for %s imports without successful channels',+ async (status) => {+ render(() => <SlackImport teamId="team" isAdmin />);+ await screen.findByText('Mounted import');+ await host.props!.onCompleted(importReceipt({ status }));+ expect(host.hidePromotion).not.toHaveBeenCalled();+ }+ );++ it('hides the promotion after successful completion even if refreshing fails', async () => {+ render(() => <SlackImport teamId="team" isAdmin />);+ await screen.findByText('Mounted import');+ host.invalidateChannels.mockRejectedValueOnce(new Error('Refresh failed'));+ await expect(+ host.props!.onCompleted(importReceipt({ status: 'completed' }))+ ).rejects.toThrow('Refresh failed');+ expect(host.hidePromotion).toHaveBeenCalledWith('me', 'team');+ });++ it('hides after a partial import with a completed channel', async () => {+ render(() => <SlackImport teamId="team" isAdmin />);+ await screen.findByText('Mounted import');+ const job = importReceipt({ status: 'completed_with_errors' });+ await host.props!.onCompleted({+ ...job,+ conversations: [{ ...job.conversations[0], status: 'completed' }],+ });+ expect(host.hidePromotion).toHaveBeenCalledWith('me', 'team');+ });});diff --git a/apps/web/src/features/slack-import/slack-import.tsx b/apps/web/src/features/slack-import/slack-import.tsxindex 400392235e..984061f8ad 100644--- a/apps/web/src/features/slack-import/slack-import.tsx+++ b/apps/web/src/features/slack-import/slack-import.tsx@@ -1,6 +1,11 @@import { IntegrationRow } from '@app/features/settings/primitives';import { useFeatureFlag } from '@app/lib/analytics/posthog';import { enableSlackArchiveImport } from '@core/constant/featureFlags';+import { useSettingsState } from '@core/constant/SettingsState';+import { useUserId } from '@core/context/user';+import { usePipedreamMcpFlag } from '@core/pipedream/flag';+import { requestConnectApp } from '@core/pipedream/pendingConnect';+import { SLACK_CONNECT_SLUG } from '@core/pipedream/slugs';import { holdAutomaticReload } from '@core/util/reloadForNewerBuild';import SlackIcon from '@icon/mcp-slack.svg';import {@@ -16,15 +21,21 @@ import { storageServiceClient } from '@service-storage/client';import { getGraphqlSoupClient } from '@service-storage/graphql-soup';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,} from './queries/archive-source';import { createImportSource } from './queries/import-source';-import { ImportDialog } from './views/import-dialog';+import { ImportDialog, type ImportDialogTrigger } from './views/import-dialog';-type Props = { teamId: string; isAdmin: boolean };+type Props = {+ teamId: string;+ isAdmin: boolean;+ trigger?: ImportDialogTrigger;+};export function SlackImport(props: Props): JSX.Element {const flag = useFeatureFlag(enableSlackArchiveImport);@@ -42,7 +53,7 @@ export function SlackImport(props: Props): JSX.Element {/>}>- <SlackImportSettings teamId={teamId} />+ <SlackImportSettings teamId={teamId} trigger={props.trigger} /></Suspense>)}</Show>@@ -50,9 +61,19 @@ export function SlackImport(props: Props): JSX.Element {);}-function SlackImportSettings(props: { teamId: string }): JSX.Element {+function SlackImportSettings(props: {+ teamId: string;+ trigger?: ImportDialogTrigger;+}): JSX.Element {const channels = useListChannelsQuery();+ const userId = useUserId();const client = getGraphqlSoupClient();+ const pipedreamEnabled = usePipedreamMcpFlag();+ const { openSettings } = useSettingsState();+ const connectSlack = () => {+ requestConnectApp(SLACK_CONNECT_SLUG, 'import-slack-channels');+ openSettings('Connections');+ };function channelHref(id: string): string | undefined {if (!channels.isSuccess ||@@ -61,7 +82,16 @@ function SlackImportSettings(props: { teamId: string }): JSX.Element {return undefined;return `/app/channel/${encodeURIComponent(id)}`;}- async function onCompleted(): Promise<void> {+ async function onCompleted(job: ImportJob): Promise<void> {+ if (+ job.status === 'completed' ||+ (job.status === 'completed_with_errors' &&+ job.conversations.some(+ (conversation) => conversation.status === 'completed'+ ))+ ) {+ hideSlackImportPromotion(userId(), job.teamId);+ }invalidateAllSoup();await Promise.all([invalidateListChannels(),@@ -88,6 +118,8 @@ function SlackImportSettings(props: { teamId: string }): JSX.Element {><ImportDialogteamId={props.teamId}+ trigger={props.trigger}+ onConnect={pipedreamEnabled() ? connectSlack : undefined}onCompleted={onCompleted}channelHref={channelHref}/>diff --git a/apps/web/src/features/slack-import/views/import-dialog.test.tsx b/apps/web/src/features/slack-import/views/import-dialog.test.tsxindex 2228088ee2..906bddfb37 100644--- a/apps/web/src/features/slack-import/views/import-dialog.test.tsx+++ b/apps/web/src/features/slack-import/views/import-dialog.test.tsx@@ -40,7 +40,7 @@ afterEach(() => {vi.unstubAllGlobals();});-function setup() {+function setup(customTrigger = false, onConnect?: () => void) {const fake = fakeImportSources();const [page, setPage] = createSignal<ImportPage>({jobs: [],@@ -68,6 +68,19 @@ function setup() {><ImportDialogteamId="team"+ onConnect={onConnect}+ trigger={+ customTrigger+ ? (onOpen) => (+ <button+ type="button"+ onClick={(event) => onOpen(event.currentTarget)}+ >+ Import from Slack+ </button>+ )+ : undefined+ }onCompleted={completed}channelHref={(id) =>id === 'accessible' ? `/app/channel/${id}` : undefined@@ -114,6 +127,73 @@ function setup() {}describe('Slack import dialog', () => {+ it('explains both methods and opens the connector without starting an archive import', async () => {+ const onConnect = vi.fn();+ const view = setup(false, onConnect);+ expect(screen.queryByLabelText('Slack export ZIP')).toBeNull();+ expect(+ screen.getByText(+ 'Copy public channels and teammates. No Slack admin role needed.'+ )+ ).toBeTruthy();+ fireEvent.click(+ screen.getByRole('button', { name: 'Import channels without history' })+ );+ expect(onConnect).toHaveBeenCalledOnce();+ expect(view.createArchive).not.toHaveBeenCalled();+ expect(view.fake.commands.create).not.toHaveBeenCalled();+ await waitFor(() => expect(document.activeElement).toBe(view.trigger));+ });++ it('reveals upload details only after choosing history and can return to the methods', async () => {+ const view = setup(false, vi.fn());+ const method = screen.getByRole('button', { name: 'Import with history' });+ await waitFor(() => expect(document.activeElement).toBe(method));+ fireEvent.click(method);+ await waitFor(() =>+ expect(document.activeElement).toBe(+ screen.getByLabelText('Slack export ZIP')+ )+ );+ expect(+ screen.getByText(+ /A Slack workspace owner or admin must provide the export/+ )+ ).toBeTruthy();+ const help = screen.getByRole('link', { name: 'How to export from Slack' });+ expect(help.getAttribute('href')).toBe(+ 'https://slack.com/help/articles/201658943-Export-your-workspace-data'+ );+ expect(+ screen.queryByRole('button', { name: 'Import channels without history' })+ ).toBeNull();+ fireEvent.click(screen.getByRole('button', { name: 'Back' }));+ await waitFor(() =>+ expect(document.activeElement).toBe(+ screen.getByRole('button', { name: 'Import with history' })+ )+ );+ expect(view.createArchive).not.toHaveBeenCalled();+ });++ it('opens from a custom sidebar trigger and restores focus when closed', async () => {+ const view = setup(true);+ await waitFor(() =>+ expect(document.activeElement).toBe(+ screen.getByLabelText('Slack export ZIP')+ )+ );+ fireEvent.click(screen.getByRole('button', { name: /^Close$/ }));+ await waitFor(() => expect(document.activeElement).toBe(view.trigger));+ fireEvent.click(view.trigger);+ await waitFor(() =>+ expect(document.activeElement).toBe(+ screen.getByLabelText('Slack export ZIP')+ )+ );+ expect(view.fake.commands.create).not.toHaveBeenCalled();+ });+it('discovers locally, filters/groups selections and requires source confirmation before upload', async () => {const view = setup();const discovery = archiveDiscovery();@@ -309,6 +389,7 @@ describe('Slack import dialog', () => {const dialog = screen.getByRole('dialog');const processing = importReceipt({ status: 'processing' });view.setPage({ ...view.page(), jobs: [processing] });+ fireEvent.click(screen.getByText('Previous imports (1)'));fireEvent.click(screen.getByRole('button', { name: /job · Processing/ }));const result = importReceipt({status: 'cancelled',@@ -338,7 +419,7 @@ describe('Slack import dialog', () => {view.fake.setObserved(result);view.setPage({ ...view.page(), jobs: [result] });await waitFor(() => expect(view.completed).toHaveBeenCalledOnce());- const channelLink = screen.getByRole('link');+ const channelLink = screen.getByRole('link', { name: 'Open channel' });channelLink.focus();view.fake.setObserved({...result,@@ -352,10 +433,12 @@ describe('Slack import dialog', () => {expect(view.completed).toHaveBeenCalledOnce();expect(screen.getByText(/9 imported/)).toBeTruthy();expect(screen.getByText('Target unavailable')).toBeTruthy();- expect(screen.getAllByRole('link')).toHaveLength(1);- expect(screen.getByRole('link').getAttribute('href')).toBe(- '/app/channel/accessible'+ expect(screen.getAllByRole('link', { name: 'Open channel' })).toHaveLength(+ 1);+ expect(+ screen.getByRole('link', { name: 'Open channel' }).getAttribute('href')+ ).toBe('/app/channel/accessible');expect(screen.getByText(/Cancellation is not rollback/)).toBeTruthy();});@@ -389,6 +472,7 @@ describe('Slack import dialog', () => {it('finalizes a historical upload with skips without creating an archive worker', async () => {const view = setup();view.setPage({ ...view.page(), jobs: [importReceipt()] });+ fireEvent.click(screen.getByText('Previous imports (1)'));fireEvent.click(screen.getByRole('button', { name: /job · Uploading/ }));fireEvent.click(screen.getByRole('button', { name: 'Finalize with skips' })@@ -411,6 +495,7 @@ describe('Slack import dialog', () => {jobs: [importReceipt()],nextCursor: 'cursor',});+ fireEvent.click(screen.getByText('Previous imports (1)'));fireEvent.click(screen.getByRole('button', { name: /job · Uploading/ }));view.fake.commands.cancel.mockRejectedValue(new Error('request failed'));fireEvent.click(screen.getByRole('button', { name: 'Cancel import' }));diff --git a/apps/web/src/features/slack-import/views/import-dialog.tsx b/apps/web/src/features/slack-import/views/import-dialog.tsxindex 24cfd1652f..7bdeba11ba 100644--- a/apps/web/src/features/slack-import/views/import-dialog.tsx+++ b/apps/web/src/features/slack-import/views/import-dialog.tsx@@ -1,4 +1,5 @@import { formatDate } from '@core/util/date';+import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';import ArrowsClockwiseIcon from '@phosphor/arrows-clockwise.svg';import CaretRightIcon from '@phosphor/caret-right.svg';import FileZipIcon from '@phosphor/file-zip.svg';@@ -27,6 +28,7 @@ import {type StatusDisplay,StatusDot,} from '../components/import-ui';+import { SlackConnectCard } from '../components/slack-connect-card';import { SlackImportCard } from '../components/slack-import-card';import type { ImportJob, ImportPage } from '../context/contracts';import { useImportContext } from '../context/import-context';@@ -36,10 +38,16 @@ import {type ImportPhase,} from '../primitives/import-controller';+export type ImportDialogTrigger = (+ onOpen: (element: HTMLButtonElement) => void+) => JSX.Element;+type Props = {teamId: string;onCompleted(job: ImportJob): Promise<void>;channelHref(id: string): string | undefined;+ trigger?: ImportDialogTrigger;+ onConnect?: () => void;};function terminal(job: ImportJob): boolean {@@ -91,7 +99,17 @@ export function ImportDialog(props: Props): JSX.Element {const context = useImportContext();const owner = getOwner();const [open, setOpen] = createSignal(false);+ const [importSelected, setImportSelected] = createSignal(false);+ const [historyOpen, setHistoryOpen] = createSignal(false);+ let fileInput: HTMLInputElement | undefined;+ let methodButton: HTMLButtonElement | undefined;+ const choosingMethod = () =>+ Boolean(props.onConnect) && !importSelected() && !archive() && !jobId();let opener: HTMLButtonElement | undefined;+ const openDialog = (trigger: HTMLButtonElement) => {+ opener = trigger;+ setOpen(true);+ };const [jobId, setJobId] = createSignal<string>();const [before, setBefore] = createSignal<string>();const { source, commands } = context.createSource({@@ -176,7 +194,10 @@ export function ImportDialog(props: Props): JSX.Element {function changeOpen(next: boolean): void {if (!next) {const current = phase();- if (current === undefined || REVIEW_PHASES.has(current)) resetSession();+ if (current === undefined || REVIEW_PHASES.has(current)) {+ resetSession();+ setImportSelected(false);+ }}setOpen(next);}@@ -386,17 +407,16 @@ export function ImportDialog(props: Props): JSX.Element {return (<>- <SlackImportCard- onOpen={(trigger) => {- opener = trigger;- setOpen(true);- }}- />+ {props.trigger ? (+ props.trigger(openDialog)+ ) : (+ <SlackImportCard onOpen={openDialog} />+ )}<Dialogopen={open()}onOpenChange={changeOpen}position="center"- class="w-180"+ class={choosingMethod() ? 'w-120' : 'w-180'}visibleScrimonCloseAutoFocus={(event) => {// The card is outside Dialog's trigger context; retain its focus owner.@@ -408,21 +428,75 @@ export function ImportDialog(props: Props): JSX.Element {<ActionDialogShell.Body class="space-y-6"><ActionDialogShell.Header><ActionDialogShell.Title>- Import from Slack+ {choosingMethod()+ ? 'Bring Slack to Macro'+ : 'Import from Slack'}</ActionDialogShell.Title><ActionDialogShell.Description>- Bring conversations from a Slack export into this team. The- archive is read in your browser and only the conversations you- select are uploaded. Keep this page open until uploads finish.+ {choosingMethod()+ ? 'Choose how to get started.'+ : 'Upload a Slack export to bring your history with you.'}</ActionDialogShell.Description></ActionDialogShell.Header>- <ArchivePicker- archive={archive()}- disabled={fileDisabled()}- reading={phase() === 'discovering'}- onChoose={(file) => void runAction(() => chooseFile(file))}- />+ <Show+ when={choosingMethod()}+ fallback={+ <ArchivePicker+ archive={archive()}+ disabled={fileDisabled()}+ reading={phase() === 'discovering'}+ inputRef={(input) => {+ fileInput = input;+ }}+ onChoose={(file) => void runAction(() => chooseFile(file))}+ />+ }+ >+ <div class="flex flex-col gap-2">+ <button+ ref={methodButton}+ type="button"+ aria-label="Import with history"+ class="flex w-full items-center gap-4 rounded-lg border border-edge-muted p-4 text-left hover:bg-ink/4 focus-visible:outline-accent"+ onClick={() => {+ setImportSelected(true);+ queueMicrotask(() => fileInput?.focus());+ }}+ >+ <FileZipIcon+ aria-hidden="true"+ class="size-5 shrink-0 text-ink-muted"+ />+ <span class="flex-1 space-y-1">+ <span class="block text-sm font-medium text-ink">+ Import with history+ <span class="ml-2 rounded bg-accent/10 px-1.5 py-0.5 text-[10px] font-medium text-accent">+ Recommended+ </span>+ </span>+ <span class="block text-xs text-ink-muted">+ Channels, messages and threads. Requires an export from a+ Slack admin.+ </span>+ </span>+ <CaretRightIcon+ aria-hidden="true"+ class="size-4 text-ink-extra-muted"+ />+ </button>+ <Show when={props.onConnect}>+ {(connect) => (+ <SlackConnectCard+ onConnect={() => {+ changeOpen(false);+ connect()();+ }}+ />+ )}+ </Show>+ </div>+ </Show><Show when={!source.page() && !source.error()}><Notice tone="info">Loading import settings…</Notice>@@ -474,9 +548,8 @@ export function ImportDialog(props: Props): JSX.Element {id="slack-import-history-hint"class="block text-xs text-ink-muted">- Messages, threads and reactions are imported with- each conversation. Files, attachments and- attachment-only messages are skipped.+ Messages, threads and reactions. Files and+ attachments are not imported.</span></span></label>@@ -507,26 +580,33 @@ export function ImportDialog(props: Props): JSX.Element {/><span class="min-w-0 flex-1"><span class="block text-sm text-ink">- {SOURCE_CONFIRMATION}+ This export belongs to my team's Slack workspace.</span><spanid="slack-import-source-hint"class="block text-xs text-ink-muted">- The source binding is permanent: this team cannot- import another Slack workspace later.+ This team can only import from one Slack workspace.</span></span></label></div>- <p class="text-xs text-ink-extra-muted">- Public Slack channels become Team channels with explicit- members, never globally public. Existing channel names,- roles and membership history are preserved. External email- addresses can become channel members; a DM needs two- distinct email-bearing members and never adds you as a- third.- </p>+ <details class="text-xs text-ink-extra-muted">+ <summary class="text-ink-muted">How imports work</summary>+ <p class="pt-2">+ Only selected conversations are uploaded. Keep this page+ open until uploads finish. Encrypted, multi-volume and+ ZIP64 archives are not supported.+ </p>+ <p class="pt-2">+ Public Slack channels become Team channels with explicit+ members, never globally public. Existing channel names,+ roles and membership history are preserved. External+ email addresses can become channel members; a DM needs+ two distinct email-bearing members and never adds you as+ a third.+ </p>+ </details></section></>)}@@ -548,28 +628,46 @@ export function ImportDialog(props: Props): JSX.Element {</Notice></Show>- <JobHistory- page={source.page()}- activeJobId={jobId()}- disabled={localActive() || busy()}- paged={Boolean(before())}- onOpen={openHistory}- onNewest={() => setBefore(undefined)}- onOlder={() => setBefore(source.page()?.nextCursor)}- />+ <Show when={source.page()?.jobs.length || before()}>+ <details+ open={historyOpen()}+ onToggle={(event) => setHistoryOpen(event.currentTarget.open)}+ class="text-xs text-ink-muted"+ >+ <summary class="py-1">+ Previous imports+ {source.page()?.jobs.length+ ? ` (${source.page()!.jobs.length})`+ : ''}+ </summary>+ <div class="pt-3">+ <JobHistory+ page={source.page()}+ activeJobId={jobId()}+ disabled={localActive() || busy()}+ paged={Boolean(before())}+ onOpen={openHistory}+ onNewest={() => setBefore(undefined)}+ onOlder={() => setBefore(source.page()?.nextCursor)}+ />+ </div>+ </details>+ </Show></ActionDialogShell.Body><ActionDialogShell.Footer class="justify-between"><div class="flex items-center gap-2">- <Button- variant="ghost"- size="icon-md"- depth={2}- label="Refresh progress"- disabled={busy()}- onClick={() => void runAction(() => source.refresh())}- >- <ArrowsClockwiseIcon />- </Button>+ <Show when={historyOpen() || showProgress() || source.error()}>+ <Button+ variant="ghost"+ size="icon-md"+ depth={2}+ label="Refresh progress"+ disabled={busy()}+ onClick={() => void runAction(() => source.refresh())}+ >+ <ArrowsClockwiseIcon />+ </Button>+ </Show><Show when={canCancel()}><Buttonvariant="ghost"@@ -582,6 +680,22 @@ export function ImportDialog(props: Props): JSX.Element {</Show></div><div class="flex items-center gap-2">+ <Show+ when={+ props.onConnect && importSelected() && !archive() && !jobId()+ }+ >+ <Button+ variant="ghost"+ depth={2}+ onClick={() => {+ setImportSelected(false);+ queueMicrotask(() => methodButton?.focus());+ }}+ >+ Back+ </Button>+ </Show><Show when={canChooseAnother()}><Buttonvariant="ghost"@@ -616,6 +730,7 @@ function ArchivePicker(props: {archive: { name: string; size: number } | undefined;disabled: boolean;reading: boolean;+ inputRef(input: HTMLInputElement): void;onChoose(file: File | undefined): void;}): JSX.Element {const [dragging, setDragging] = createSignal(false);@@ -625,11 +740,16 @@ function ArchivePicker(props: {props.onChoose(file);};return (- <section class="flex flex-col gap-3" aria-label="Archive">- <DialogSectionTitle>Archive</DialogSectionTitle>+ <section+ class={cn(+ 'flex flex-col gap-4',+ !props.archive && 'rounded-xl border border-edge-muted p-5'+ )}+ aria-label="Archive"+ ><divclass={cn(- 'relative flex items-center gap-3 rounded-lg border border-dashed px-4 py-3 transition-colors',+ 'relative flex flex-col items-center justify-center gap-3 rounded-lg border border-dashed px-4 py-5 text-center transition-colors',dragging()? 'border-accent bg-accent-bg': 'border-edge-frame bg-control',@@ -648,6 +768,7 @@ function ArchivePicker(props: {>{/* The mobile focus trap requires tabindex=-1 even on disabled inputs. */}<input+ ref={props.inputRef}id="slack-import-file"type="file"accept=".zip,application/zip"@@ -667,23 +788,17 @@ function ArchivePicker(props: {aria-hidden="true"class="absolute inset-0 rounded-lg peer-focus-visible:ring-2 peer-focus-visible:ring-accent"/>- <div class="flex size-9 shrink-0 items-center justify-center rounded-lg bg-ink/5 text-ink-muted">- <FileZipIcon aria-hidden="true" class="size-5" />- </div><div class="min-w-0 flex-1">- <div- id="slack-import-file-label"- class="text-sm font-medium text-ink"- >+ <div id="slack-import-file-label" class="sr-only">Slack export ZIP</div><divid="slack-import-file-hint"- class="truncate text-xs text-ink-muted"+ class="break-all text-xs text-ink-muted"><Showwhen={props.archive}- fallback="Drop the .zip exported from Slack here, or browse for it."+ fallback="Drop your Slack export ZIP here">{(archive) => (<>@@ -695,15 +810,26 @@ function ArchivePicker(props: {</div></div><Show when={!props.disabled}>- <span class="shrink-0 text-sm font-medium text-ink-muted">- Browse+ <span class="rounded-md bg-accent px-4 py-2 text-sm font-medium text-accent-contrast">+ Choose ZIP file</span></Show></div>- <p class="text-xs text-ink-extra-muted">- Encrypted, multi-volume and ZIP64 archives are not supported. This is a- one-time import, not a live Slack connection.- </p>+ <Show when={!props.archive}>+ <p class="text-xs text-ink-extra-muted">+ A Slack workspace owner or admin must provide the export. Files and+ attachments aren't included.+ </p>+ <a+ href="https://slack.com/help/articles/201658943-Export-your-workspace-data"+ target="_blank"+ rel="noopener noreferrer"+ class="mt-auto inline-flex items-center gap-1 text-xs text-link hover:text-link-hover hover:underline"+ >+ How to export from Slack+ <ArrowUpRightIcon aria-hidden="true" class="size-3" />+ </a>+ </Show></section>);}@@ -727,7 +853,6 @@ function JobHistory(props: {);return (<section class="flex flex-col gap-3" aria-label="Job history">- <DialogSectionTitle>Previous imports</DialogSectionTitle><Showwhen={props.page?.jobs.length}fallback={diff --git a/apps/web/src/lib/core/pipedream/pendingConnect.ts b/apps/web/src/lib/core/pipedream/pendingConnect.tsindex d974b64ec0..b8e5f54f6b 100644--- a/apps/web/src/lib/core/pipedream/pendingConnect.ts+++ b/apps/web/src/lib/core/pipedream/pendingConnect.ts@@ -7,11 +7,20 @@ import { createSignal } from 'solid-js';* Connect flow. A signal rather than a URL parameter because the settings* layout rebuilds its URL from split state and drops query strings.*/-const [pendingConnectApp, setPendingConnectApp] = createSignal<string>();+export type PendingConnectRequest = {+ appSlug: string;+ intent?: 'import-slack-channels';+};++const [pendingConnectApp, setPendingConnectApp] =+ createSignal<PendingConnectRequest>();/** Ask the Connections page to start connecting `appSlug` once it shows. */-export function requestConnectApp(appSlug: string) {- setPendingConnectApp(appSlug);+export function requestConnectApp(+ appSlug: string,+ intent?: PendingConnectRequest['intent']+) {+ setPendingConnectApp({ appSlug, intent });}/** The app slug waiting to be connected, if any. */diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex 0a23346119..d1c7e4fa7f 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -12,8 +12,27 @@ An external email can be selected as a channel participant. For an unregistered## Imported Slack history-Import starts in **Settings → Team → Connections → Import from Slack**, not the-channel composer. Only explicitly selected Slack IDs create work. Slack public+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.+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+and attachments are excluded. The second opens a dedicated channel import flow:+it reuses an enabled Pipedream Slack connection or requests authorization, then+automatically discovers public channels. Select channels and click **Import N+channels** to create their names and matching Macro teammates. It requires no+Slack admin role, but workspace app-approval policies still apply. Neither method+sets up ongoing message sync. Previous ZIP imports are collapsed under a disclosure.+Only explicitly selected Slack IDs create work. Slack publicchannels become Team channels with automatic team joining off; private channelsand group DMs become Private. Two-person DMs keep exactly their mapped pair andnever gain the importing admin as a third participant. Existing names, roles,diff --git a/docs/review-media/slack-import/README.md b/docs/review-media/slack-import/README.mdnew file mode 100644index 0000000000..d2c9760970--- /dev/null+++ b/docs/review-media/slack-import/README.md@@ -0,0 +1,14 @@+# Slack import review media++Captured from the local web app on October 9, 2026.++- [Import choices](choices.jpg): recommended history import and channel-only import.+- [Archive upload](upload.jpg): ZIP picker, Slack admin requirement, and export help.+- [Channel-only setup](channel-only.jpg): connection requirement and no-sync explanation.+- [Flow recording](slack-import-flow.mp4): the chooser, archive upload, back navigation,+ and channel-only authorization handoff.++The recording stops at Pipedream authorization. Live Slack discovery and import+are not demonstrated: the development connection requires a signed-in Pipedream+account. The automated Connections tests cover authorization completion,+discovery, and submitting only selected channels.diff --git a/docs/review-media/slack-import/channel-only.jpg b/docs/review-media/slack-import/channel-only.jpgnew file mode 100644index 0000000000..feb186188dBinary files /dev/null and b/docs/review-media/slack-import/channel-only.jpg differdiff --git a/docs/review-media/slack-import/choices.jpg b/docs/review-media/slack-import/choices.jpgnew file mode 100644index 0000000000..38724c8659Binary files /dev/null and b/docs/review-media/slack-import/choices.jpg differdiff --git a/docs/review-media/slack-import/slack-import-flow.mp4 b/docs/review-media/slack-import/slack-import-flow.mp4new file mode 100644index 0000000000..df4d8edf35Binary files /dev/null and b/docs/review-media/slack-import/slack-import-flow.mp4 differdiff --git a/docs/review-media/slack-import/upload.jpg b/docs/review-media/slack-import/upload.jpgnew file mode 100644index 0000000000..d6010e6a77Binary files /dev/null and b/docs/review-media/slack-import/upload.jpg differ