teqo/src/lib/campaignReferenceQuickActions.ts
Francisco Ignácio Fontoura Solla 4a90fb19ec C86+ — pathname de lista das ações rápidas em fonte única (isListPath)
Extrai isListPath + normalizePathname exportados em campaignQuickActionPaths.ts
e migra os 9 wrappers (7 públicos + 2 privados) + a 3a cópia de normalize em
campaignPageChrome.ts. Refactor estrutural sem mudança de comportamento;
derivação de regex de detalhe numérico adiada (gatilho: 3o vertical [id]).
Inclui docs/plans/escala-dry-pos-acoes-rapidas-impl.md e o fix de format
pré-existente de docs/plans/liderancas-coluna-municipios.md (bloqueava format:check).
2026-08-04 01:14:35 -03:00

26 lines
1.1 KiB
TypeScript

import { CAMPAIGN_CONCEPTS_PATH } from '@/lib/campaignIntelligenceConcepts'
import { CAMPAIGN_PROFILE_HOME } from '@/lib/campaignPaths'
import type { CampaignQuickActionContext } from '@/lib/campaignQuickActionContext'
import { isListPath } from '@/lib/campaignQuickActionPaths'
import type { CampaignQuickAction } from '@/lib/campaignQuickActionTypes'
import { isStaffCampaignRole, type CampaignRole } from '@/lib/campaignRoles'
export const isConceptsPath = (pathname: string): boolean =>
isListPath(pathname, CAMPAIGN_CONCEPTS_PATH)
export const isProfilePath = (pathname: string): boolean =>
isListPath(pathname, CAMPAIGN_PROFILE_HOME)
/** B90 — reference/account surfaces with search-only drawer (no action catalog). */
export const isReferenceQuickActionPath = (pathname: string): boolean =>
isConceptsPath(pathname) || isProfilePath(pathname)
export const resolveReferenceQuickActionsForPath = (
pathname: string,
role: CampaignRole,
_context: CampaignQuickActionContext,
): readonly CampaignQuickAction[] => {
if (!isStaffCampaignRole(role)) return []
if (!isReferenceQuickActionPath(pathname)) return []
return []
}