@rsltda/components 1.0.17 → 1.0.19
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.
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ import "@rsltda/components/rs-components.es.js";
|
|
|
94
94
|
| `show-label` | Muestra el texto junto al icono. |
|
|
95
95
|
| `target` | Target del enlace. Por defecto `_blank`. |
|
|
96
96
|
| `marca` | Variante visual para elementos internos como el icono de moto: `ktm`, `hqv`, `gasgas`, `voge` o `rs`. El boton principal mantiene el verde de WhatsApp. |
|
|
97
|
-
| `icon` | Icono por defecto para opciones generadas. Usa
|
|
97
|
+
| `icon` | Icono por defecto para opciones generadas. Usa una URL, un nombre disponible (`gear` o `motorcycle`) o `none` para ocultarlo. |
|
|
98
98
|
| `horario` | Horario de atencion opcional en formato compacto. Ejemplo: `lun-vie 09:00-18:00; sab 10:00-14:00`. |
|
|
99
99
|
| `fuera-horario` | Fuerza el estado fuera de horario manualmente. |
|
|
100
100
|
| `mensaje-fuera-horario` | Mensaje mostrado cuando el componente esta fuera de horario. Si hay horario configurado, el componente agrega el resumen del horario. |
|
|
@@ -112,7 +112,7 @@ Para evitar texto largo en atributos, usa `<rs-whatsapp-schedule>` para los bloq
|
|
|
112
112
|
| `telefono` | Numero de destino con codigo de pais. |
|
|
113
113
|
| `mensaje` | Mensaje inicial opcional para esta opcion. |
|
|
114
114
|
| `target` | Target del enlace. Si no se define, hereda el target de `<rs-whatsapp>`. |
|
|
115
|
-
| `icon` | Icono de esta opcion. Usa
|
|
115
|
+
| `icon` | Icono de esta opcion. Usa una URL, un nombre disponible (`gear` o `motorcycle`) o `none` para ocultarlo. |
|
|
116
116
|
|
|
117
117
|
## Configuracion de `<rs-whatsapp-schedule>`
|
|
118
118
|
|
package/custom-elements.json
CHANGED
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
"name": "icon",
|
|
102
|
-
"description": "Icono por defecto para opciones generadas. Usa
|
|
102
|
+
"description": "Icono por defecto para opciones generadas. Usa una URL, un nombre disponible (gear o motorcycle) o none para ocultarlo."
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"name": "horario",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
"name": "icon",
|
|
147
|
-
"description": "Icono de esta opcion. Usa
|
|
147
|
+
"description": "Icono de esta opcion. Usa una URL, un nombre disponible (gear o motorcycle) o none para ocultarlo."
|
|
148
148
|
}
|
|
149
149
|
]
|
|
150
150
|
},
|
package/dist/rs-components.es.js
CHANGED
|
@@ -943,7 +943,7 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
943
943
|
const e = this.getMarcaRequestValue(), n = new URLSearchParams({
|
|
944
944
|
marca: e,
|
|
945
945
|
tipo: String(this.tipoCode)
|
|
946
|
-
}), o = this.pointsApiUrl.includes("?"), a = o && !/[?&]$/.test(this.pointsApiUrl), s = o ? a ? "&" : "" : "?", i = `${this.pointsApiUrl}${s}${n.toString()}`,
|
|
946
|
+
}), o = this.pointsApiUrl.includes("?"), a = o && !/[?&]$/.test(this.pointsApiUrl), s = o ? a ? "&" : "" : "?", i = `${this.pointsApiUrl}${s}${n.toString()}`, r = this.getPointsCacheKey(i), d = await this.readPointsCache(r), h = d && Date.now() - d.timestamp < this.pointsCacheTtlMs, m = d ? null : await this.getLocalPointsFallback(e, this.tipoCode);
|
|
947
947
|
if (d) {
|
|
948
948
|
if (this.applyPointsPayload(d.data), this.setComponentState("ready"), h)
|
|
949
949
|
return;
|
|
@@ -954,11 +954,11 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
954
954
|
});
|
|
955
955
|
if (!f.ok)
|
|
956
956
|
throw new Error(`Respuesta ${f.status}`);
|
|
957
|
-
const
|
|
958
|
-
if (!Array.isArray(
|
|
957
|
+
const l = await f.json();
|
|
958
|
+
if (!Array.isArray(l))
|
|
959
959
|
throw new Error("La respuesta de puntos no es valida.");
|
|
960
|
-
const u =
|
|
961
|
-
await this.writePointsCache(
|
|
960
|
+
const u = l;
|
|
961
|
+
await this.writePointsCache(r, u), this.applyPointsPayload(u), this.setComponentState("ready");
|
|
962
962
|
} catch (f) {
|
|
963
963
|
if (f instanceof DOMException && f.name === "AbortError")
|
|
964
964
|
return;
|
|
@@ -992,8 +992,8 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
992
992
|
const s = it[o];
|
|
993
993
|
if (!s)
|
|
994
994
|
return null;
|
|
995
|
-
const i = s().then((
|
|
996
|
-
const d = this.parseLocalPointsPayload(
|
|
995
|
+
const i = s().then((r) => {
|
|
996
|
+
const d = this.parseLocalPointsPayload(r);
|
|
997
997
|
return d != null && d.length ? d : null;
|
|
998
998
|
}).catch(() => null);
|
|
999
999
|
return this.localPointsRequests.set(o, i), i;
|
|
@@ -1082,13 +1082,13 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1082
1082
|
s.className = "zone-section__header";
|
|
1083
1083
|
const i = document.createElement("span");
|
|
1084
1084
|
if (i.textContent = ct[o], s.appendChild(i), a.appendChild(s), e[o].length === 0) {
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1085
|
+
const r = document.createElement("p");
|
|
1086
|
+
r.className = "zone-section__empty", r.textContent = "Sin puntos en esta zona.", a.appendChild(r);
|
|
1087
1087
|
} else {
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
}), a.appendChild(
|
|
1088
|
+
const r = document.createElement("div");
|
|
1089
|
+
r.className = "zone-section__list", e[o].forEach((d) => {
|
|
1090
|
+
r.appendChild(this.createPointCard(d));
|
|
1091
|
+
}), a.appendChild(r);
|
|
1092
1092
|
}
|
|
1093
1093
|
n.appendChild(a);
|
|
1094
1094
|
}), this.zonesContainer.replaceChildren(n), this.updateZoneVisibility();
|
|
@@ -1114,36 +1114,36 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1114
1114
|
a.className = "point-card__address-block";
|
|
1115
1115
|
const s = document.createElement("p");
|
|
1116
1116
|
if (s.className = "point-card__address", s.textContent = t.direccion || "Sin direccion", a.appendChild(s), t.comuna_name) {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1117
|
+
const l = document.createElement("p");
|
|
1118
|
+
l.className = "point-card__meta", l.textContent = t.comuna_name, a.appendChild(l);
|
|
1119
1119
|
}
|
|
1120
1120
|
if (t.provincia_name) {
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1121
|
+
const l = document.createElement("p");
|
|
1122
|
+
l.className = "point-card__meta", l.textContent = t.provincia_name, a.appendChild(l);
|
|
1123
1123
|
}
|
|
1124
1124
|
if (t.region_name) {
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1125
|
+
const l = document.createElement("p");
|
|
1126
|
+
l.className = "point-card__meta", l.textContent = t.region_name, a.appendChild(l);
|
|
1127
1127
|
}
|
|
1128
1128
|
e.appendChild(a);
|
|
1129
1129
|
let i = null;
|
|
1130
|
-
const
|
|
1131
|
-
if (
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1130
|
+
const r = this.getPointPosition(t);
|
|
1131
|
+
if (r) {
|
|
1132
|
+
const l = document.createElement("div");
|
|
1133
|
+
l.className = "point-card__map-actions";
|
|
1134
1134
|
const u = document.createElement("button");
|
|
1135
1135
|
u.type = "button", u.className = "point-card__focus";
|
|
1136
1136
|
const b = this.createIconElement("fa-solid fa-location-crosshairs");
|
|
1137
1137
|
u.appendChild(b), u.appendChild(document.createTextNode(" Ver en el mapa")), u.addEventListener("click", () => {
|
|
1138
|
-
this.focusPointWithZoom(
|
|
1139
|
-
}),
|
|
1138
|
+
this.focusPointWithZoom(r.lat, r.lng), this.scrollToPointCard(t.id);
|
|
1139
|
+
}), l.appendChild(u), l.appendChild(this.createMobileNavigationActions(r)), i = l;
|
|
1140
1140
|
} else if (n) {
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1141
|
+
const l = document.createElement("div");
|
|
1142
|
+
l.className = "point-card__coordinate-warning";
|
|
1143
1143
|
const u = this.createIconElement("fa-solid fa-circle-info");
|
|
1144
|
-
|
|
1144
|
+
l.appendChild(u);
|
|
1145
1145
|
const b = document.createElement("span");
|
|
1146
|
-
b.textContent = n,
|
|
1146
|
+
b.textContent = n, l.appendChild(b), i = l;
|
|
1147
1147
|
}
|
|
1148
1148
|
const d = document.createElement("div");
|
|
1149
1149
|
d.className = "point-card__details", d.hidden = !0;
|
|
@@ -1152,24 +1152,24 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1152
1152
|
m.className = "point-card__actions";
|
|
1153
1153
|
let g = null;
|
|
1154
1154
|
if (t.url && t.url !== "#") {
|
|
1155
|
-
const
|
|
1156
|
-
|
|
1155
|
+
const l = document.createElement("a");
|
|
1156
|
+
l.href = t.url, l.target = "_blank", l.rel = "noopener noreferrer", l.className = "point-card__action";
|
|
1157
1157
|
const u = this.createIconElement("fa-solid fa-globe");
|
|
1158
|
-
|
|
1158
|
+
l.appendChild(u), l.appendChild(document.createTextNode("Sitio web")), m.appendChild(l);
|
|
1159
1159
|
}
|
|
1160
1160
|
if (t.email) {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1161
|
+
const l = document.createElement("a");
|
|
1162
|
+
l.href = `mailto:${t.email}`, l.target = "_blank", l.rel = "noopener noreferrer", l.className = "point-card__action point-card__action--text";
|
|
1163
1163
|
const u = this.createIconElement("fa-solid fa-envelope");
|
|
1164
|
-
|
|
1164
|
+
l.appendChild(u), l.appendChild(document.createTextNode(t.email)), m.appendChild(l);
|
|
1165
1165
|
}
|
|
1166
1166
|
if (m.childElementCount && (d.appendChild(m), h = !0), (f = t.telefonos) != null && f.length) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1167
|
+
const l = document.createElement("div");
|
|
1168
|
+
l.className = "point-card__contact";
|
|
1169
1169
|
const u = document.createElement("div");
|
|
1170
1170
|
u.className = "point-card__contact-title";
|
|
1171
1171
|
const b = this.createIconElement("fa-solid fa-phone");
|
|
1172
|
-
u.appendChild(b), u.appendChild(document.createTextNode("Telefonos")),
|
|
1172
|
+
u.appendChild(b), u.appendChild(document.createTextNode("Telefonos")), l.appendChild(u);
|
|
1173
1173
|
const x = document.createElement("ul");
|
|
1174
1174
|
x.className = "point-card__phone-list", t.telefonos.slice().sort((w, y) => w.orden - y.orden).forEach((w) => {
|
|
1175
1175
|
const y = document.createElement("li");
|
|
@@ -1193,33 +1193,33 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1193
1193
|
B && (E.href = B, E.target = "_blank", E.rel = "noopener noreferrer", E.classList.add("point-card__phone-number--link"));
|
|
1194
1194
|
}
|
|
1195
1195
|
E.textContent = w.telefono, S.appendChild(E), y.appendChild(S), x.appendChild(y);
|
|
1196
|
-
}),
|
|
1196
|
+
}), l.appendChild(x), d.appendChild(l), h = !0;
|
|
1197
1197
|
}
|
|
1198
1198
|
if (t.adicional) {
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1199
|
+
const l = document.createElement("p");
|
|
1200
|
+
l.className = "point-card__extra", l.innerHTML = t.adicional, l.querySelectorAll("a").forEach((u) => {
|
|
1201
1201
|
u.classList.add("point-card__extra-link");
|
|
1202
1202
|
const b = this.createIconElement("fa-solid fa-arrow-up-right-from-square");
|
|
1203
1203
|
b.classList.add("point-card__extra-icon"), u.appendChild(b);
|
|
1204
|
-
}), d.appendChild(
|
|
1204
|
+
}), d.appendChild(l), h = !0;
|
|
1205
1205
|
}
|
|
1206
1206
|
if (t.googlelink) {
|
|
1207
1207
|
g = document.createElement("a"), g.href = t.googlelink, g.target = "_blank", g.rel = "noopener noreferrer", g.className = "point-card__action";
|
|
1208
|
-
const
|
|
1209
|
-
g.appendChild(
|
|
1208
|
+
const l = this.createIconElement("fa-solid fa-map-location-dot");
|
|
1209
|
+
g.appendChild(l), g.appendChild(document.createTextNode("Google Maps"));
|
|
1210
1210
|
}
|
|
1211
1211
|
if (g) {
|
|
1212
|
-
const
|
|
1213
|
-
|
|
1212
|
+
const l = document.createElement("div");
|
|
1213
|
+
l.className = "point-card__actions", l.appendChild(g), d.appendChild(l), h = !0;
|
|
1214
1214
|
}
|
|
1215
1215
|
if (h) {
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1216
|
+
const l = document.createElement("button");
|
|
1217
|
+
l.type = "button", l.className = "point-card__toggle";
|
|
1218
1218
|
const u = this.createIconElement("fa-solid fa-circle-info"), b = document.createElement("span");
|
|
1219
|
-
b.textContent = "Mas informacion",
|
|
1219
|
+
b.textContent = "Mas informacion", l.appendChild(u), l.appendChild(b), l.addEventListener("click", () => {
|
|
1220
1220
|
const x = d.hidden;
|
|
1221
1221
|
d.hidden = !x, b.textContent = x ? "Ocultar informacion" : "Mas informacion", u.className = x ? "fa-solid fa-circle-xmark" : "fa-solid fa-circle-info";
|
|
1222
|
-
}), e.appendChild(
|
|
1222
|
+
}), e.appendChild(l), e.appendChild(d);
|
|
1223
1223
|
}
|
|
1224
1224
|
return i && e.appendChild(i), e;
|
|
1225
1225
|
}
|
|
@@ -1298,13 +1298,13 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1298
1298
|
return;
|
|
1299
1299
|
const o = new e.maps.LatLngBounds();
|
|
1300
1300
|
if (n.forEach(({ point: a, position: s }) => {
|
|
1301
|
-
const { lat: i, lng:
|
|
1301
|
+
const { lat: i, lng: r } = s, d = this.getMarkerIcon(a), h = d && this.map ? {
|
|
1302
1302
|
url: d,
|
|
1303
1303
|
scaledSize: new e.maps.Size(64, 64),
|
|
1304
1304
|
anchor: new e.maps.Point(32, 64)
|
|
1305
1305
|
} : void 0, m = new e.maps.Marker({
|
|
1306
1306
|
map: this.map,
|
|
1307
|
-
position: { lat: i, lng:
|
|
1307
|
+
position: { lat: i, lng: r },
|
|
1308
1308
|
title: a.titulo,
|
|
1309
1309
|
icon: h
|
|
1310
1310
|
});
|
|
@@ -1343,18 +1343,18 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1343
1343
|
if (this.appendPointModalLine(o, "Correo", t.email), (s = t.telefonos) != null && s.length) {
|
|
1344
1344
|
const i = document.createElement("p");
|
|
1345
1345
|
i.className = "point-modal__line";
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1346
|
+
const r = document.createElement("span");
|
|
1347
|
+
r.className = "point-modal__label", r.textContent = "Telefonos:", i.appendChild(r), o.appendChild(i);
|
|
1348
1348
|
const d = document.createElement("ul");
|
|
1349
1349
|
d.className = "point-modal__phone-list", t.telefonos.slice().sort((h, m) => h.orden - m.orden).forEach((h) => {
|
|
1350
1350
|
d.appendChild(this.createPointModalPhoneItem(h));
|
|
1351
1351
|
}), o.appendChild(d);
|
|
1352
1352
|
}
|
|
1353
1353
|
if (o.childElementCount && e.appendChild(o), t.adicional) {
|
|
1354
|
-
const i = this.createPointModalSection(),
|
|
1355
|
-
|
|
1354
|
+
const i = this.createPointModalSection(), r = document.createElement("div");
|
|
1355
|
+
r.className = "point-modal__extra", r.innerHTML = t.adicional, r.querySelectorAll("a").forEach((d) => {
|
|
1356
1356
|
d.target = "_blank", d.rel = "noopener noreferrer";
|
|
1357
|
-
}), i.appendChild(
|
|
1357
|
+
}), i.appendChild(r), e.appendChild(i);
|
|
1358
1358
|
}
|
|
1359
1359
|
const a = this.createPointModalActions(t);
|
|
1360
1360
|
return a.childElementCount && e.appendChild(a), e;
|
|
@@ -1435,7 +1435,7 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1435
1435
|
}), n;
|
|
1436
1436
|
}
|
|
1437
1437
|
haversine(t, e, n, o) {
|
|
1438
|
-
const a = (m) => m * Math.PI / 180, i = a(n - t),
|
|
1438
|
+
const a = (m) => m * Math.PI / 180, i = a(n - t), r = a(o - e), d = Math.sin(i / 2) * Math.sin(i / 2) + Math.cos(a(t)) * Math.cos(a(n)) * Math.sin(r / 2) * Math.sin(r / 2);
|
|
1439
1439
|
return 6371e3 * (2 * Math.atan2(Math.sqrt(d), Math.sqrt(1 - d)));
|
|
1440
1440
|
}
|
|
1441
1441
|
scrollToPointCard(t) {
|
|
@@ -1493,9 +1493,9 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1493
1493
|
return;
|
|
1494
1494
|
}
|
|
1495
1495
|
await new Promise((s) => {
|
|
1496
|
-
const i = performance.now(),
|
|
1497
|
-
const m = h - i, g = Math.min(m / e, 1), f =
|
|
1498
|
-
this.map.setZoom(Math.round(
|
|
1496
|
+
const i = performance.now(), r = (h) => 1 - Math.pow(1 - h, 3), d = (h) => {
|
|
1497
|
+
const m = h - i, g = Math.min(m / e, 1), f = r(g), l = o + a * f;
|
|
1498
|
+
this.map.setZoom(Math.round(l * 100) / 100), g < 1 ? requestAnimationFrame(d) : (this.map.setZoom(t), s());
|
|
1499
1499
|
};
|
|
1500
1500
|
requestAnimationFrame(d);
|
|
1501
1501
|
});
|
|
@@ -1509,8 +1509,8 @@ const V = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAA
|
|
|
1509
1509
|
this.map.setCenter({ lat: t, lng: e }), n == null || n();
|
|
1510
1510
|
return;
|
|
1511
1511
|
}
|
|
1512
|
-
const s = a.lat(), i = a.lng(),
|
|
1513
|
-
const u =
|
|
1512
|
+
const s = a.lat(), i = a.lng(), r = t - s, d = e - i, h = 600, m = performance.now(), g = (l) => 1 - Math.pow(1 - l, 3), f = (l) => {
|
|
1513
|
+
const u = l - m, b = Math.min(u / h, 1), x = g(b), w = s + r * x, y = i + d * x;
|
|
1514
1514
|
this.map.setCenter({ lat: w, lng: y }), b < 1 ? this.panAnimationFrame = requestAnimationFrame(f) : (this.panAnimationFrame = null, n == null || n());
|
|
1515
1515
|
};
|
|
1516
1516
|
this.panAnimationFrame = requestAnimationFrame(f);
|
|
@@ -1624,6 +1624,9 @@ function Pt(p) {
|
|
|
1624
1624
|
function P(p) {
|
|
1625
1625
|
return p.normalize("NFD").replace(/[\u0300-\u036f]/g, "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
1626
1626
|
}
|
|
1627
|
+
function Mt(p) {
|
|
1628
|
+
return /^(https?:\/\/|\/\/|data:image\/|blob:|\/|\.\/|\.\.\/)/i.test(p.trim());
|
|
1629
|
+
}
|
|
1627
1630
|
class Q extends HTMLElement {
|
|
1628
1631
|
constructor() {
|
|
1629
1632
|
super();
|
|
@@ -1885,6 +1888,7 @@ class Q extends HTMLElement {
|
|
|
1885
1888
|
height: 32px;
|
|
1886
1889
|
flex: 0 0 auto;
|
|
1887
1890
|
color: var(--rs-whatsapp-menu-icon-color, var(--rs-whatsapp-brand-color));
|
|
1891
|
+
object-fit: contain;
|
|
1888
1892
|
}
|
|
1889
1893
|
@media (max-width: 640px) {
|
|
1890
1894
|
:host {
|
|
@@ -1974,8 +1978,8 @@ class Q extends HTMLElement {
|
|
|
1974
1978
|
this.isConnected && this.syncAttributesToState();
|
|
1975
1979
|
}
|
|
1976
1980
|
syncAttributesToState() {
|
|
1977
|
-
var i,
|
|
1978
|
-
const t = ((i = this.getAttribute("label")) != null ? i : "").trim() || mt, e = ((
|
|
1981
|
+
var i, r, d, h, m;
|
|
1982
|
+
const t = ((i = this.getAttribute("label")) != null ? i : "").trim() || mt, e = ((r = this.getAttribute("menu-label")) != null ? r : "").trim() || gt, n = ((d = this.getAttribute("aria-label")) != null ? d : "").trim() || ut, o = ((h = this.getAttribute("target")) != null ? h : "_blank").trim() || "_blank", a = ((m = this.getAttribute("icon")) != null ? m : Z).trim() || Z, s = this.isOutsideBusinessHours();
|
|
1979
1983
|
if (this.labelEl.textContent = t, this.buttonEl.setAttribute("aria-label", n), this.buttonEl.setAttribute("title", n), this.syncBrandVariant(), this.closedMessageTextEl.textContent = this.getClosedMessage(), this.closedMessageEl.hidden = !s, this.customMenuSlotEl.hidden = s, s) {
|
|
1980
1984
|
this.generatedOptionsEl.hidden = !0, this.generatedOptionsEl.replaceChildren();
|
|
1981
1985
|
return;
|
|
@@ -2019,9 +2023,9 @@ class Q extends HTMLElement {
|
|
|
2019
2023
|
var a, s;
|
|
2020
2024
|
const o = Array.from(this.querySelectorAll(D.tag));
|
|
2021
2025
|
return o.length ? o.map((i) => {
|
|
2022
|
-
var
|
|
2026
|
+
var r, d, h, m, g, f;
|
|
2023
2027
|
return {
|
|
2024
|
-
label: ((d = (
|
|
2028
|
+
label: ((d = (r = i.getAttribute("label")) != null ? r : i.textContent) != null ? d : "").trim() || t,
|
|
2025
2029
|
telefono: ((h = i.getAttribute("telefono")) != null ? h : "").trim(),
|
|
2026
2030
|
mensaje: ((m = i.getAttribute("mensaje")) != null ? m : "").trim(),
|
|
2027
2031
|
target: ((g = i.getAttribute("target")) != null ? g : e).trim() || e,
|
|
@@ -2044,12 +2048,19 @@ class Q extends HTMLElement {
|
|
|
2044
2048
|
return a && e.append(a), e.append(n), o ? (e.href = o, e.tabIndex = 0, e) : (e.setAttribute("aria-disabled", "true"), e.tabIndex = -1, e);
|
|
2045
2049
|
}
|
|
2046
2050
|
createOptionIcon(t) {
|
|
2047
|
-
var
|
|
2048
|
-
const e =
|
|
2049
|
-
if (
|
|
2051
|
+
var s, i;
|
|
2052
|
+
const e = t.trim(), n = P(e);
|
|
2053
|
+
if (n === "none")
|
|
2054
|
+
return null;
|
|
2055
|
+
if (Mt(e)) {
|
|
2056
|
+
const r = document.createElement("img");
|
|
2057
|
+
return r.className = "menu-link-icon", r.src = e, r.alt = "", r.setAttribute("aria-hidden", "true"), r.decoding = "async", r;
|
|
2058
|
+
}
|
|
2059
|
+
const o = vt[n || Z];
|
|
2060
|
+
if (!o)
|
|
2050
2061
|
return null;
|
|
2051
|
-
const
|
|
2052
|
-
return
|
|
2062
|
+
const a = document.createElement("template");
|
|
2063
|
+
return a.innerHTML = o, (i = (s = a.content.firstElementChild) == null ? void 0 : s.cloneNode(!0)) != null ? i : document.createElement("span");
|
|
2053
2064
|
}
|
|
2054
2065
|
getClosedMessage() {
|
|
2055
2066
|
var n;
|
|
@@ -2071,8 +2082,8 @@ ${e}` : t;
|
|
|
2071
2082
|
var e;
|
|
2072
2083
|
const t = Array.from(this.querySelectorAll(M.tag));
|
|
2073
2084
|
return t.length ? t.map((n) => {
|
|
2074
|
-
var i,
|
|
2075
|
-
const o = ((i = n.getAttribute("dias")) != null ? i : "").trim(), a = ((
|
|
2085
|
+
var i, r, d;
|
|
2086
|
+
const o = ((i = n.getAttribute("dias")) != null ? i : "").trim(), a = ((r = n.getAttribute("desde")) != null ? r : "").trim(), s = ((d = n.getAttribute("hasta")) != null ? d : "").trim();
|
|
2076
2087
|
return !o || !a || !s ? "" : `${o} ${a}-${s}`;
|
|
2077
2088
|
}).filter(Boolean) : ((e = this.getAttribute("horario")) != null ? e : "").split(";").map((n) => n.trim()).filter(Boolean);
|
|
2078
2089
|
}
|
|
@@ -2080,8 +2091,8 @@ ${e}` : t;
|
|
|
2080
2091
|
var e;
|
|
2081
2092
|
const t = Array.from(this.querySelectorAll(M.tag));
|
|
2082
2093
|
return t.length ? t.map((n) => {
|
|
2083
|
-
var i,
|
|
2084
|
-
const o = ((i = n.getAttribute("dias")) != null ? i : "").trim(), a = ((
|
|
2094
|
+
var i, r, d;
|
|
2095
|
+
const o = ((i = n.getAttribute("dias")) != null ? i : "").trim(), a = ((r = n.getAttribute("desde")) != null ? r : "").trim(), s = ((d = n.getAttribute("hasta")) != null ? d : "").trim();
|
|
2085
2096
|
return !o || !a || !s ? "" : `${o} ${a}-${s}`;
|
|
2086
2097
|
}).filter(Boolean).join(`
|
|
2087
2098
|
`) : ((e = this.getAttribute("horario")) != null ? e : "").split(";").map((n) => n.trim()).filter(Boolean).join(`
|
|
@@ -2095,31 +2106,31 @@ ${e}` : t;
|
|
|
2095
2106
|
var e, n, o, a, s, i;
|
|
2096
2107
|
const t = ((e = this.getAttribute("time-zone")) != null ? e : "").trim();
|
|
2097
2108
|
if (!t) {
|
|
2098
|
-
const
|
|
2109
|
+
const r = /* @__PURE__ */ new Date();
|
|
2099
2110
|
return {
|
|
2100
|
-
day:
|
|
2101
|
-
minutes:
|
|
2111
|
+
day: r.getDay(),
|
|
2112
|
+
minutes: r.getHours() * 60 + r.getMinutes()
|
|
2102
2113
|
};
|
|
2103
2114
|
}
|
|
2104
2115
|
try {
|
|
2105
|
-
const
|
|
2116
|
+
const r = /* @__PURE__ */ new Date(), d = new Intl.DateTimeFormat("en-US", {
|
|
2106
2117
|
timeZone: t,
|
|
2107
2118
|
weekday: "short"
|
|
2108
|
-
}).format(
|
|
2119
|
+
}).format(r).toLowerCase(), h = new Intl.DateTimeFormat("en-US", {
|
|
2109
2120
|
timeZone: t,
|
|
2110
2121
|
hour12: !1,
|
|
2111
2122
|
hour: "2-digit",
|
|
2112
2123
|
minute: "2-digit"
|
|
2113
|
-
}).formatToParts(
|
|
2124
|
+
}).formatToParts(r), m = Number((o = (n = h.find((f) => f.type === "hour")) == null ? void 0 : n.value) != null ? o : 0) % 24, g = Number((s = (a = h.find((f) => f.type === "minute")) == null ? void 0 : a.value) != null ? s : 0);
|
|
2114
2125
|
return {
|
|
2115
|
-
day: (i = Et[d]) != null ? i :
|
|
2126
|
+
day: (i = Et[d]) != null ? i : r.getDay(),
|
|
2116
2127
|
minutes: m * 60 + g
|
|
2117
2128
|
};
|
|
2118
2129
|
} catch {
|
|
2119
|
-
const
|
|
2130
|
+
const r = /* @__PURE__ */ new Date();
|
|
2120
2131
|
return {
|
|
2121
|
-
day:
|
|
2122
|
-
minutes:
|
|
2132
|
+
day: r.getDay(),
|
|
2133
|
+
minutes: r.getHours() * 60 + r.getMinutes()
|
|
2123
2134
|
};
|
|
2124
2135
|
}
|
|
2125
2136
|
}
|
|
@@ -2138,11 +2149,11 @@ ${e}` : t;
|
|
|
2138
2149
|
return [];
|
|
2139
2150
|
if (s === i)
|
|
2140
2151
|
return [s];
|
|
2141
|
-
const
|
|
2152
|
+
const r = [];
|
|
2142
2153
|
let d = s;
|
|
2143
2154
|
for (; ; ) {
|
|
2144
|
-
if (
|
|
2145
|
-
return
|
|
2155
|
+
if (r.push(d), d === i)
|
|
2156
|
+
return r;
|
|
2146
2157
|
d = (d + 1) % 7;
|
|
2147
2158
|
}
|
|
2148
2159
|
});
|