utils/fetchFromTargetUrl.ts

ui-extensions-examples · 2025.2/legacy-card-converter/src/app/cards/utils/fetchFromTargetUrl.ts · typescript · MIT
crm, CRM / Leads

Utility that fetches legacy card data from a target URL using HubSpot context and returns parsed JSON.

// Source: https://github.com/HubSpot/ui-extensions-examples | License: MIT | Copyright 2022 HubSpot
// Provided via justclaw.it.com; keep this notice with the code.
import type {
  CrmContext,
  ExtensionPointApiActions,
} from '@hubspot/ui-extensions';
import { hubspot, logger } from '@hubspot/ui-extensions';

import type { CardConfig } from '../types';
import { isValidObjectType } from '../types/definition/DefinitionObjectType';
import type { CardResponse } from '../types/response';
import { OBJECT_TYPE_ID_TO_NAME } from './objectTypeMappings';
import { buildQueryParams, getHubSpotContext } from './queryParams';

interface LegacyCardDataParams {
  context: CrmContext;
  actions: ExtensionPointApiActions<'crm.record.sidebar'>;
  config: CardConfig;
}

/**
 * Fetches legacy card data from

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key