ngx-sp-infra 6.11.4 → 6.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10070,42 +10070,33 @@ class SearchInputComponent {
10070
10070
  // - local + RotaOS => https://<productionHost>/<rotaOS>
10071
10071
  // - server + RotaV6 => https://<serverHost>/<rotaV6>
10072
10072
  // - server + RotaOS => https://<serverHost>/<rotaOS>
10073
- // Normalize route and item fields
10074
- const routeStr = route || '';
10075
10073
  const isLocal = window.location.hostname.includes('localhost') || window.location.hostname === '127.0.0.1';
10076
10074
  // Production host to use when we need to redirect to server from local
10077
10075
  const productionHost = isLocal ? 'siscandesv6.sispro.com.br' : window.location.host;
10078
10076
  const protocol = window.location.protocol;
10079
10077
  const host = window.location.host;
10080
- // Helper to remove diacritics / accents
10081
- const normalizarString = (s) => (s || '').normalize('NFD').replace(/[\u0300-\u036f]/g, '');
10082
10078
  // Determine if given route corresponds to a V6 route (it will match item.RotaV6)
10083
- const isV6 = item.RotaV6 && routeStr === item.RotaV6;
10084
- const isOS = item.RotaOS && routeStr === item.RotaOS;
10085
- // Normalize project names for comparison (remove accents)
10086
- const nomeProjeto = normalizarString(item.Projeto || '');
10087
- const primeiroSegmentoRota = routeStr.split('/')[0] || '';
10088
- const nomeProjetoRota = normalizarString(primeiroSegmentoRota || '');
10089
- // If the first segment of the route equals the project name, we may remove it for local V6 routing
10090
- const primeiroSegmentoIsProjeto = nomeProjeto !== '' && nomeProjeto === nomeProjetoRota;
10079
+ const isV6 = item.RotaV6 && route === item.RotaV6;
10080
+ const isOS = item.RotaOS && route === item.RotaOS;
10081
+ const primeiroSegmentoRota = route.split('/')[0] == '' ? route.split('/')[1] : route.split('/')[0];
10082
+ const projetoPresenteNaRota = item.ProjetoURLHome !== '' && item.ProjetoURLHome.split('/')[0] === primeiroSegmentoRota;
10091
10083
  // Build final URL
10092
10084
  let finalURL = '';
10093
10085
  if (isV6) {
10094
10086
  if (isLocal) {
10095
10087
  // On local, route should point to the local app. Remove first segment when it's the project name.
10096
- const rotaReduzida = primeiroSegmentoIsProjeto && routeStr.includes('/') ? routeStr.split('/').slice(1).join('/') : routeStr;
10088
+ const rotaReduzida = projetoPresenteNaRota && route.includes('/') ? route.split('/').slice(1).join('/') : route;
10097
10089
  finalURL = `${protocol}//${host}/${rotaReduzida.replace(/^\/+/, '')}`;
10098
10090
  }
10099
10091
  else {
10100
10092
  // On server, use the server host and keep the full V6 route
10101
10093
  // If the route doesn't start with a product name, it's a Corporativo route
10102
- const isCorporativo = !primeiroSegmentoIsProjeto;
10103
- finalURL = `https://${host}/SisproErpCloud/${isCorporativo ? 'Corporativo/' : ''}${routeStr.replace(/^\/+/, '')}`;
10094
+ finalURL = `https://${host}/SisproErpCloud/${!projetoPresenteNaRota ? `${item.ProjetoURLHome.split('/')[0]}/` : ''}${route.replace(/^\/+/, '')}`;
10104
10095
  }
10105
10096
  }
10106
10097
  else if (isOS) {
10107
10098
  // RotaOS always points to the server (production) using https
10108
- finalURL = `https://${productionHost}/${routeStr.replace(/^\/+/, '')}`;
10099
+ finalURL = `https://${productionHost}/${route.replace(/^\/+/, '')}`;
10109
10100
  }
10110
10101
  else {
10111
10102
  // Fallback: if route is empty or not matched, return current origin