/* global React, Icon */
/* eslint-disable no-unused-vars */
const { useState: useState2, useEffect: useEffect2 } = React;
const VCFG2 = (typeof window !== "undefined" && window.VCF_CFG) || {};
/* ============================================================
TIENDAS
============================================================ */
const STORES = [
{ name: "Amazon", tag: "Electrónica · Hogar", domain: "amazon.com", color: "FF9900" },
{ name: "Shein", tag: "Moda · Accesorios", domain: "shein.com", color: "000000" },
{ name: "eBay", tag: "Subastas · Coleccionables", domain: "ebay.com", color: "E53238" },
{ name: "Walmart", tag: "Supermercado · Hogar", domain: "walmart.com", color: "0071DC" },
{ name: "Temu", tag: "Ofertas · Todo", domain: "temu.com", color: "FB7701" },
{ name: "Nike", tag: "Deportes", domain: "nike.com", color: "111111" },
{ name: "Target", tag: "Departamentales", domain: "target.com", color: "CC0000" },
{ name: "AliExpress", tag: "Ofertas · Todo", domain: "aliexpress.com", color: "E62E04" },
{ name: "Best Buy", tag: "Electrónica", domain: "bestbuy.com", color: "0046BE" },
{ name: "Macy's", tag: "Departamentales", domain: "macys.com", color: "E21A23" },
{ name: "Samsung", tag: "Electrónica", domain: "samsung.com", color: "1428A0" },
{ name: "Apple", tag: "Tecnología", domain: "apple.com", color: "111111" },
];
function VCTiendas() {
return (
Tu mundo en compras
Compra en miles de tiendas en USA.
Tu dirección Vía Courier funciona en cualquier tienda con envío doméstico en Estados Unidos.
Estos son algunos de nuestros favoritos.
{[...STORES, ...STORES].map((s, i) => )}
{[...STORES.slice().reverse(), ...STORES.slice().reverse()].map((s, i) => )}
);
}
function MarqueeFade() {
return (
<>
>
);
}
function StoreChip({ name, tag, color, domain }) {
const onImgError = (e) => {
const el = e.currentTarget;
const step = el.getAttribute("data-step") || "0";
if (step === "0") {
el.setAttribute("data-step", "1");
el.src = `https://www.google.com/s2/favicons?domain=${domain}&sz=64`;
} else {
el.style.display = "none";
const fb = el.nextSibling; if (fb) fb.style.display = "grid";
}
};
return (
{ e.currentTarget.style.transform = "translateY(-2px)"; e.currentTarget.style.boxShadow = "var(--shadow-card)"; }}
onMouseLeave={(e) => { e.currentTarget.style.transform = "translateY(0)"; e.currentTarget.style.boxShadow = "none"; }}
>
{name[0]}
);
}
/* ============================================================
CÓMO FUNCIONA
============================================================ */
function VCComoFunciona() {
const steps = [
{ n: "01", title: "Regístrate gratis", desc: "Crea tu cuenta en menos de 2 minutos y recibe tu número de casillero VIA-#####.", meta: "Sin tarjeta de crédito" },
{ n: "02", title: "Compra en USA", desc: "Usa tu dirección en Miami al momento del checkout en cualquier tienda online.", meta: "Amazon, Shein, eBay…", accent: "blue" },
{ n: "03", title: "Recibe en RD", desc: "Tu paquete llega a Miami, se envía a tu sucursal y te avisamos cuando esté listo.", meta: "Entrega en 24-48 horas" },
];
return (
La ruta
Tres paradas,
una sola vía.
{steps.map((s, i) => (
))}
¿Necesitas ayuda con tu primera compra?
Te guiamos paso a paso por WhatsApp.
Hablar por WhatsApp
);
}
function StepCard({ n, title, desc, meta, active, accent }) {
const isBlue = accent === "blue";
return (
{ e.currentTarget.style.transform = "translateY(-4px)"; e.currentTarget.style.boxShadow = "var(--shadow-pop)"; }}
onMouseLeave={(e) => { e.currentTarget.style.transform = "translateY(0)"; e.currentTarget.style.boxShadow = "none"; }}
>
{n}
{title}
{desc}
{meta}
);
}
/* ============================================================
SUCURSALES — datos reales vía REST (con fallback)
============================================================ */
const BRANCHES_FALLBACK = [
{ id: "b1", name: "Oficina Principal — Don Bosco", region: "Santo Domingo", addr: "Av. 27 de Febrero 282, Don Bosco", hours: "Lun–Vie 9:00am – 6:00pm", phone: "(809) 707-3995", lat: 18.4801, lng: -69.9018, main: true },
];
function VCSucursales() {
const [branches, setBranches] = useState2(BRANCHES_FALLBACK);
const [query, setQuery] = useState2("");
const [selected, setSelected] = useState2(null);
const mapRef = React.useRef(null);
const mapEl = React.useRef(null);
const markers = React.useRef({});
const listRef = React.useRef(null);
// Cargar sucursales reales del REST del sitio.
React.useEffect(() => {
if (!VCFG2.sucursalesApi) return;
fetch(VCFG2.sucursalesApi)
.then((r) => r.json())
.then((res) => {
if (res && res.success && Array.isArray(res.data) && res.data.length) {
const mapped = res.data.map((s) => ({
id: "s" + s.id,
name: s.nombre,
region: "",
addr: s.direccion || "",
hours: s.horario || "",
phone: s.telefono || "",
wa: s.whatsapp || null,
idoficina: s.idoficina,
lat: s.lat, lng: s.lng,
main: !!s.principal,
}));
setBranches(mapped);
setSelected(mapped[0] ? mapped[0].id : null);
}
})
.catch(() => {});
}, []);
const filtered = branches.filter((b) => {
const q = query.trim().toLowerCase();
if (!q) return true;
return (b.name + " " + b.addr + " " + b.region).toLowerCase().includes(q);
});
React.useEffect(() => {
if (!window.L || mapRef.current || !mapEl.current) return;
const L = window.L;
const map = L.map(mapEl.current, { center: [18.9, -70.4], zoom: 8, scrollWheelZoom: false, zoomControl: true });
L.tileLayer("https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png", { attribution: "© OpenStreetMap · © CARTO", maxZoom: 19 }).addTo(map);
mapRef.current = map;
setTimeout(() => map.invalidateSize(), 200);
return () => { map.remove(); mapRef.current = null; };
}, []);
// (Re)dibujar marcadores cuando cambian las sucursales.
React.useEffect(() => {
const L = window.L;
if (!L || !mapRef.current) return;
Object.values(markers.current).forEach((m) => mapRef.current.removeLayer(m));
markers.current = {};
const makeIcon = (active) => L.divIcon({
className: "", iconSize: [34, 44], iconAnchor: [17, 42], popupAnchor: [0, -40],
html: ``,
});
branches.forEach((b) => {
const m = L.marker([b.lat, b.lng], { icon: makeIcon(b.id === selected) }).addTo(mapRef.current);
m.bindPopup(popupHTML(b), { closeButton: true, className: "vc-leaflet-popup" });
m.on("click", () => setSelected(b.id));
markers.current[b.id] = m;
});
}, [branches]);
React.useEffect(() => {
const L = window.L;
if (!L || !mapRef.current || !selected) return;
const b = branches.find((x) => x.id === selected);
Object.entries(markers.current).forEach(([id, m]) => {
const active = id === selected;
m.setIcon(L.divIcon({
className: "", iconSize: active ? [40, 52] : [34, 44], iconAnchor: active ? [20, 50] : [17, 42], popupAnchor: [0, active ? -46 : -40],
html: ``,
}));
});
if (b) {
mapRef.current.flyTo([b.lat, b.lng], 11, { duration: 0.7 });
markers.current[b.id] && markers.current[b.id].openPopup();
const node = listRef.current && listRef.current.querySelector(`[data-branch="${b.id}"]`);
if (node && listRef.current) {
listRef.current.scrollTo({ top: node.offsetTop - listRef.current.offsetTop - 8, behavior: "smooth" });
}
}
}, [selected]);
const nearest = () => {
if (!navigator.geolocation) { setSelected(branches[0] && branches[0].id); return; }
navigator.geolocation.getCurrentPosition(
(pos) => {
const { latitude, longitude } = pos.coords;
let best = branches[0], bd = Infinity;
branches.forEach((b) => {
const d = (b.lat - latitude) ** 2 + (b.lng - longitude) ** 2;
if (d < bd) { bd = d; best = b; }
});
best && setSelected(best.id);
},
() => setSelected(branches[0] && branches[0].id),
{ timeout: 6000 }
);
};
return (
Nuestra red
Encuentra tu vía más cercana.
{branches.length}
paradas en todo el país
Ver la sucursal más cercana
{filtered.length} sucursal{filtered.length === 1 ? "" : "es"} encontrada{filtered.length === 1 ? "" : "s"}
Vía Courier
{filtered.length === 0 && (
Sin resultados para “{query}”.
)}
{filtered.map((b) => (
setSelected(b.id)} />
))}
);
}
function regLink(b) {
const cfg = window.VCF_CFG || {};
if (!cfg.registerBase || b.idoficina == null) return null;
return cfg.registerBase.replace("{idoficina}", encodeURIComponent(b.idoficina));
}
function popupHTML(b) {
const reg = regLink(b);
const maps = `https://www.google.com/maps/dir/?api=1&destination=${b.lat},${b.lng}`;
const wa = b.wa ? ("https://wa.me/" + b.wa) : null;
return ``;
}
function BranchRow({ b, active, onSelect }) {
const wa = b.wa ? ("https://wa.me/" + b.wa) : (b.phone ? ("https://wa.me/1809" + b.phone.replace(/\D/g, "").slice(-7)) : null);
const reg = regLink(b);
return (
{ if (!active) e.currentTarget.style.background = "var(--vc-cream)"; }}
onMouseLeave={(e) => { if (!active) e.currentTarget.style.background = "transparent"; }}
>
{active &&
}
{b.name}
{b.main && PRINCIPAL }
{b.addr && (
{b.addr}
)}
{b.hours &&
{b.hours}
}
{reg && (
e.stopPropagation()}
style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 7, marginTop: 12, padding: "10px 12px", borderRadius: 10, background: "var(--vc-yellow)", color: "var(--vc-ink)", fontSize: 13, fontWeight: 700 }}>
Regístrate en esta sucursal
)}
e.stopPropagation()}
style={{ flex: 1, textAlign: "center", padding: "9px 10px", borderRadius: 10, border: "1.5px solid var(--vc-line-strong)", fontSize: 13, fontWeight: 600, color: "var(--vc-ink)", background: "var(--vc-white)" }}>Cómo llegar
{wa && (
e.stopPropagation()}
style={{ flex: 1, textAlign: "center", padding: "9px 10px", borderRadius: 10, background: "var(--vc-green)", color: "#fff", fontSize: 13, fontWeight: 700 }}>WhatsApp
)}
);
}
/* ============================================================
APP
============================================================ */
function VCApp() {
return (
App disponible
Tu vía,
en el bolsillo.
Rastrea envíos, recibe notificaciones cuando tu paquete llegue a Miami
y gestiona pagos — todo desde Vía Courier Pack.
{["Rastrea envíos en vivo", "Notificaciones al instante", "Pre-alerta de paquetes", "100% gratis"].map((t, i) => (
{t}
))}
);
}
function StoreBadge({ store }) {
const isApple = store === "apple";
const href = isApple
? "https://apps.apple.com/do/app/via-courier/id1631621463"
: "https://play.google.com/store/apps/details?id=com.viacourierpack.appmovil&hl=es_DO";
return (
{ e.currentTarget.style.transform = "translateY(-2px)"; e.currentTarget.style.boxShadow = "var(--shadow-pop)"; }}
onMouseLeave={(e) => { e.currentTarget.style.transform = "translateY(0)"; e.currentTarget.style.boxShadow = "none"; }}
>
{isApple ? (
) : (
)}
{isApple ? "Descarga en el" : "Disponible en"}
{isApple ? "App Store" : "Google Play"}
);
}
function PhoneMock() {
return (
📦
VÍA COURIER · Ahora
Tu paquete VIA-00427 llegó a Miami
9:41
●●●● 5G ▮
Hola, Carla 👋
Tus paquetes
VIA-00427
EN TRÁNSITO
Amazon · 3 ítems
{["USA", "MIA", "SDQ", "RD"].map((s, i) => (
{i < 3 &&
}
))}
USA MIA SDQ RD
{[{ id: "VIA-00425", desc: "Shein · 1 ítem", status: "Listo para retiro" }, { id: "VIA-00422", desc: "eBay · 2 ítems", status: "Entregado" }].map((p) => (
{p.id}
{p.status}
{p.desc}
))}
);
}
/* ============================================================
FOOTER
============================================================ */
function VCFooter() {
return (
¿Empezamos a comprar?
Tu compañero de compras en línea, siempre en tu bolsillo. Explora,
rastrea y gestiona tus envíos con un toque.
Crea tu casillero
Toma 2 minutos. Es gratis.
{(VCFG2.logoWhite || VCFG2.logo)
?
:
Vía Courier }
Miami, FL
7715 NW 46th Street, Doral, FL 33195
+1-305-848-1017
Santo Domingo
Av. 27 de Febrero 282, Don Bosco
(809) 707-3995
Lun – Vie: 9:00am – 6:00pm
{[
{ title: "Enlaces rápidos", links: [["Nosotros", VCFG2.nosotrosUrl || "#"], ["Sucursales", VCFG2.sucursalesUrl || "#"], ["Rastrea tu paquete", VCFG2.rastreoUrl || "#"], ["Consulta RUA", VCFG2.rua || "#"]] },
{ title: "Mi cuenta", links: [["Regístrate", VCFG2.registerUrl || "#"], ["Iniciar sesión", VCFG2.accountUrl || "#"]] },
{ title: "Trabaja con nosotros", links: [["Adquiere franquicia", VCFG2.franquiciasUrl || "#"], ["Contacto", VCFG2.whatsapp || "#"]] },
].map((col) => (
))}
© 2026 Vía Courier. Todos los derechos reservados.
Diseñado con ♥ por Pixeles Creativos
);
}
Object.assign(window, { VCTiendas, VCComoFunciona, VCSucursales, VCApp, VCFooter });