fix: connect documentary anchors to investment preparation and recover accepted territories
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-23 19:17:15 +02:00
parent cdf8fcfba4
commit 3fd5128c62
21 changed files with 1668 additions and 33 deletions
+9
View File
@@ -1,6 +1,15 @@
const levels = ['province_id', 'district_id', 'admin_post_id', 'locality_id'];
const searchRoutes = ['/carteira', '/oportunidades', '/zonas', '/educacao'];
/** Keep search geography explicit; a documentary origin is never an invented offer. */
export function portfolioPreparationHref(id: string, pageUrl: string): string {
const source = new URL(pageUrl, 'https://portal.invalid');
const inherited = source.searchParams.has('catalogue_query') ? new URLSearchParams(source.searchParams.get('catalogue_query')!) : source.searchParams;
const query = new URLSearchParams({source: `portfolio:${id}`});
for (const field of levels) if (inherited.get(field)) query.set(field, inherited.get(field)!);
return '/investimentos/iniciar?' + query.toString();
}
/** Preserve an explicit complementary selection while consulting its canonical public fiche. */
export function complementPreparationHref(pageUrl: string, target?: string): string | null {
const params = new URL(pageUrl, 'https://portal.invalid').searchParams;