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.

717 B
Raw Blame
import { toast } from '@core/component/Toast/Toast';
import { openExternalUrl } from '@core/util/url';
import type { ChangesHost } from './context/changes-context';

/** Browser actions shared by production hosts, never implicit controller defaults. */
export function createBrowserChangesActions(): Pick<
  ChangesHost,
  'copyText' | 'openExternal' | 'notify'
> {
  return {
    openExternal: openExternalUrl,
    copyText: async (text) => {
      try {
        await navigator.clipboard.writeText(text);
        return true;
      } catch {
        return false;
      }
    },
    notify: (message, tone) => {
      if (tone === 'success') toast.success(message);
      else toast.failure(message);
    },
  };
}