← back to AbramsOS

lib/connectors-catalog.js

51 lines

// Catalog of supported connectors. Each entry describes how to connect, sync, and display the source.
// The /import page renders one card per connector. The "Import all" button fans out to every
// connected connector's sync endpoint.

const CATALOG = [
  {
    key: 'gmail',
    name: 'Gmail',
    icon: 'G',
    description: 'Order confirmations, receipts, shipping notices, warranty PDFs.',
    provider: 'google',
    syncPath: (id) => `/api/connectors/${id}/sync`,
    connectPath: '/auth/google/start',
  },
  {
    key: 'gdrive',
    name: 'Google Drive',
    icon: 'D',
    description: 'Receipts, invoices, warranty PDFs you saved to Drive.',
    provider: 'google',
    syncPath: (id) => `/api/connectors/${id}/sync`,
    connectPath: '/auth/google/start',  // same OAuth, drive.readonly scope included
    sharedWith: 'gmail',                // bound by the same Google account
  },
  {
    key: 'plaid',
    name: 'Bank & Credit Cards (Plaid)',
    icon: '$',
    description: 'Amex, Wells Fargo, Chase, Citi, Cap One, Discover, BofA, and 200+ US institutions. Tokenized — no PAN/CVV ever leaves Plaid.',
    provider: 'plaid',
    syncPath: (id) => `/api/connectors/plaid/${id}/sync`,
    connectPath: '/api/plaid/link/token',  // returns Link token; frontend opens Plaid Link UI
    requiresStepUp: true,
  },
  {
    key: 'manual',
    name: 'Manual upload',
    icon: '↑',
    description: 'Drag-drop OFX, QFX, CSV, or PDF statements from any bank.',
    provider: 'manual',
    syncPath: null,                       // upload is the sync
    connectPath: '/import#manual-upload',
    deferred: true,                       // not implemented in v0
  },
];

function byKey(key) { return CATALOG.find(c => c.key === key); }
function byProvider(provider) { return CATALOG.filter(c => c.provider === provider); }

module.exports = { CATALOG, byKey, byProvider };