@cartbot/vehicle-search-beta 3.0.24 → 3.0.25
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/dist/js/vehicle-search.es.js +53 -53
- package/dist/js/vehicle-search.js +15 -15
- package/package.json +1 -1
|
@@ -328,7 +328,7 @@ function X({
|
|
|
328
328
|
)
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
|
-
const $t = "3.0.
|
|
331
|
+
const $t = "3.0.25";
|
|
332
332
|
console.info(
|
|
333
333
|
`Vehicle Search v${$t} powered by Partbot https://mmyvs.partbot.io`
|
|
334
334
|
);
|
|
@@ -377,7 +377,7 @@ function Mt({
|
|
|
377
377
|
mobileButtonLabel: s = "Select Vehicle"
|
|
378
378
|
// Label for mobile drawer trigger button
|
|
379
379
|
}) {
|
|
380
|
-
const F = Z(null), z = Z(null), ie = Z(null), S = Z(null), K = Z(null), j = Z(null), Q = Z(null), w = Z(null), W = Z(null), M = Z(!1), x = f === "YMM", [le,
|
|
380
|
+
const F = Z(null), z = Z(null), ie = Z(null), S = Z(null), K = Z(null), j = Z(null), Q = Z(null), w = Z(null), W = Z(null), M = Z(!1), x = f === "YMM", [le, he] = A([]), [ge, ce] = A([]), [de, ue] = A([]), [Le, be] = A([]), [Ie, we] = A([]), [Ve, ye] = A([]), [De, xe] = A([]), [Fe, ke] = A([]), Je = Z([]), [se, Ce] = A([]), [e, Y] = A({
|
|
381
381
|
make: null,
|
|
382
382
|
model: null,
|
|
383
383
|
year: null,
|
|
@@ -392,7 +392,7 @@ function Mt({
|
|
|
392
392
|
"variant",
|
|
393
393
|
"engine",
|
|
394
394
|
"engine_capacity"
|
|
395
|
-
]),
|
|
395
|
+
]), _e = Z(
|
|
396
396
|
R && R.length && Ue.current ? R.split(",").filter((t) => {
|
|
397
397
|
var r;
|
|
398
398
|
return (r = Ue.current) == null ? void 0 : r.includes(t);
|
|
@@ -443,7 +443,7 @@ function Mt({
|
|
|
443
443
|
// Fallback for backward compatibility
|
|
444
444
|
algolia_index_name: te,
|
|
445
445
|
// Fallback for backward compatibility
|
|
446
|
-
store_index_name:
|
|
446
|
+
store_index_name: ve,
|
|
447
447
|
store_popular_makes: ae,
|
|
448
448
|
// Array of popular make values for this store (from PostHog)
|
|
449
449
|
store_popular_models: h
|
|
@@ -522,7 +522,7 @@ function Mt({
|
|
|
522
522
|
limit: 500
|
|
523
523
|
// Reduced from 1000 for faster queries
|
|
524
524
|
})).hits.map((d) => d.otto_id);
|
|
525
|
-
|
|
525
|
+
Ce(l);
|
|
526
526
|
let c = {
|
|
527
527
|
...Object.fromEntries(
|
|
528
528
|
Object.entries(e || {}).map(([d, $]) => [d, $ && $.value || null]).filter(([d, $]) => $ !== null)
|
|
@@ -569,7 +569,7 @@ function Mt({
|
|
|
569
569
|
Me(!1);
|
|
570
570
|
}, 900);
|
|
571
571
|
}, [se, q]), Te = N(() => {
|
|
572
|
-
var i, o, l, n, c, d, $, te,
|
|
572
|
+
var i, o, l, n, c, d, $, te, ve;
|
|
573
573
|
const t = {
|
|
574
574
|
vehicle_ids: se,
|
|
575
575
|
vehicle: (i = e == null ? void 0 : e.make) != null && i.value ? e : {},
|
|
@@ -583,7 +583,7 @@ function Mt({
|
|
|
583
583
|
if (M.current === !0) {
|
|
584
584
|
localStorage.removeItem("partbot_plate_details");
|
|
585
585
|
const ae = JSON.stringify({
|
|
586
|
-
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((l = e.model) == null ? void 0 : l.value) || ""} ${((n = e.year) == null ? void 0 : n.value) || ""} ${((c = e.body) == null ? void 0 : c.value) || ""} ${((d = e.series) == null ? void 0 : d.value) || ""} ${(($ = e.variant) == null ? void 0 : $.value) || ""} ${((te = e.engine) == null ? void 0 : te.value) || ""} ${((
|
|
586
|
+
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((l = e.model) == null ? void 0 : l.value) || ""} ${((n = e.year) == null ? void 0 : n.value) || ""} ${((c = e.body) == null ? void 0 : c.value) || ""} ${((d = e.series) == null ? void 0 : d.value) || ""} ${(($ = e.variant) == null ? void 0 : $.value) || ""} ${((te = e.engine) == null ? void 0 : te.value) || ""} ${((ve = e.engine_capacity) == null ? void 0 : ve.value) || ""}`.trim(),
|
|
587
587
|
vehicle_ids: se,
|
|
588
588
|
vehicle: e ? Object.entries(e).reduce((h, [m, k]) => (h[m] = k != null && k.value ? k.value : {}, h), {}) : {}
|
|
589
589
|
});
|
|
@@ -597,17 +597,17 @@ function Mt({
|
|
|
597
597
|
window.dispatchEvent(r), document.dispatchEvent(r), Je.current = se, setTimeout(() => {
|
|
598
598
|
Me(!1);
|
|
599
599
|
}, 900);
|
|
600
|
-
}, [se, u]),
|
|
600
|
+
}, [se, u]), pe = ut(
|
|
601
601
|
() => Ct(Te, 100),
|
|
602
602
|
[Te]
|
|
603
603
|
);
|
|
604
604
|
B(() => {
|
|
605
|
-
|
|
606
|
-
}, [se,
|
|
607
|
-
|
|
608
|
-
}, [
|
|
605
|
+
pe();
|
|
606
|
+
}, [se, pe]), B(() => () => {
|
|
607
|
+
pe.cancel();
|
|
608
|
+
}, [pe]), B(() => {
|
|
609
609
|
const t = () => {
|
|
610
|
-
M.current = !1, Y({
|
|
610
|
+
M.current = !1, pe.cancel(), Y({
|
|
611
611
|
make: null,
|
|
612
612
|
model: null,
|
|
613
613
|
year: null,
|
|
@@ -616,7 +616,7 @@ function Mt({
|
|
|
616
616
|
variant: null,
|
|
617
617
|
engine: null,
|
|
618
618
|
engine_capacity: null
|
|
619
|
-
}),
|
|
619
|
+
}), Ce([]);
|
|
620
620
|
};
|
|
621
621
|
return window.addEventListener("plate-search-change", t), () => {
|
|
622
622
|
window.removeEventListener(
|
|
@@ -624,7 +624,7 @@ function Mt({
|
|
|
624
624
|
t
|
|
625
625
|
);
|
|
626
626
|
};
|
|
627
|
-
}, []), B(() => {
|
|
627
|
+
}, [pe]), B(() => {
|
|
628
628
|
oe.searchKey && (x || pt(), at());
|
|
629
629
|
}, [oe.searchKey, x]), B(() => {
|
|
630
630
|
x && w.current && de.length === 0 && !e.year && w.current.search("", {
|
|
@@ -635,7 +635,7 @@ function Mt({
|
|
|
635
635
|
{ length: l - o + 1 },
|
|
636
636
|
(c, d) => ({ value: o + d, refinement: o + d })
|
|
637
637
|
).reverse();
|
|
638
|
-
|
|
638
|
+
ue(n);
|
|
639
639
|
}).catch((t) => {
|
|
640
640
|
console.error("[VehicleSearch] Error loading year range:", t);
|
|
641
641
|
});
|
|
@@ -644,7 +644,7 @@ function Mt({
|
|
|
644
644
|
}, [Oe]);
|
|
645
645
|
const Ze = N(
|
|
646
646
|
(t) => {
|
|
647
|
-
M.current = !0, ce([]), !x && !g &&
|
|
647
|
+
M.current = !0, ce([]), !x && !g && ue([]), be([]), we([]), ye([]), ke([]), xe([]), Y((r) => ({
|
|
648
648
|
make: t,
|
|
649
649
|
year: x || g ? r.year : null
|
|
650
650
|
})), L({
|
|
@@ -666,7 +666,7 @@ function Mt({
|
|
|
666
666
|
"variant",
|
|
667
667
|
"engine_capacity"
|
|
668
668
|
]
|
|
669
|
-
}), t ||
|
|
669
|
+
}), t || Ce([]);
|
|
670
670
|
},
|
|
671
671
|
[L, x, g]
|
|
672
672
|
), Ye = N(
|
|
@@ -681,7 +681,7 @@ function Mt({
|
|
|
681
681
|
variant: null,
|
|
682
682
|
engine: null,
|
|
683
683
|
engine_capacity: null
|
|
684
|
-
})), !x && !g &&
|
|
684
|
+
})), !x && !g && ue([]), be([]), we([]), ye([]), ke([]), xe([]), L({
|
|
685
685
|
query: "model",
|
|
686
686
|
value: (t == null ? void 0 : t.value) ?? "",
|
|
687
687
|
remove: x ? ["body", "series", "engine", "variant", "engine_capacity"] : g ? ["body", "series", "engine", "variant", "engine_capacity"] : [
|
|
@@ -697,9 +697,9 @@ function Mt({
|
|
|
697
697
|
[L, x, g]
|
|
698
698
|
), He = N(
|
|
699
699
|
(t) => {
|
|
700
|
-
M.current = !0, x ? (
|
|
700
|
+
M.current = !0, x ? (he([]), ce([]), Y({
|
|
701
701
|
year: t !== "" ? t : null
|
|
702
|
-
}), (!t || t === "") &&
|
|
702
|
+
}), (!t || t === "") && ue([])) : Y(g ? (r) => ({
|
|
703
703
|
...r,
|
|
704
704
|
year: t !== "" ? t : null
|
|
705
705
|
}) : (r) => ({
|
|
@@ -710,7 +710,7 @@ function Mt({
|
|
|
710
710
|
variant: null,
|
|
711
711
|
engine: null,
|
|
712
712
|
engine_capacity: null
|
|
713
|
-
})), g || (
|
|
713
|
+
})), g || (be([]), we([]), ye([]), ke([]), xe([])), L({
|
|
714
714
|
query: "year",
|
|
715
715
|
value: (t == null ? void 0 : t.value) ?? "",
|
|
716
716
|
remove: x ? [
|
|
@@ -722,7 +722,7 @@ function Mt({
|
|
|
722
722
|
"engine",
|
|
723
723
|
"engine_capacity"
|
|
724
724
|
] : g ? [] : ["body", "series", "variant", "engine", "engine_capacity"]
|
|
725
|
-
}), !g && (!t || t === "") &&
|
|
725
|
+
}), !g && (!t || t === "") && Ce([]);
|
|
726
726
|
},
|
|
727
727
|
[L, x, g]
|
|
728
728
|
), it = N(
|
|
@@ -803,7 +803,7 @@ function Mt({
|
|
|
803
803
|
return d && !$ ? -1 : !d && $ ? 1 : d && $ ? K.current.indexOf(n.value) - K.current.indexOf(c.value) : n.value.localeCompare(c.value);
|
|
804
804
|
}) : o.sort(
|
|
805
805
|
(n, c) => c.popularity === n.popularity ? n.value.localeCompare(c.value) : c.popularity - n.popularity
|
|
806
|
-
),
|
|
806
|
+
), he(o);
|
|
807
807
|
} catch (r) {
|
|
808
808
|
console.error("[VehicleSearch] Error loading makes for year:", r);
|
|
809
809
|
}
|
|
@@ -844,7 +844,7 @@ function Mt({
|
|
|
844
844
|
});
|
|
845
845
|
} else
|
|
846
846
|
r.sort((i, o) => i.popularity === o.popularity ? i.value.localeCompare(o.value) : o.popularity - i.popularity);
|
|
847
|
-
|
|
847
|
+
he(r);
|
|
848
848
|
})();
|
|
849
849
|
}, [v]);
|
|
850
850
|
B(() => {
|
|
@@ -883,7 +883,7 @@ function Mt({
|
|
|
883
883
|
limit: 1
|
|
884
884
|
// Only one document per make
|
|
885
885
|
}).then((i) => {
|
|
886
|
-
var
|
|
886
|
+
var ve, ae;
|
|
887
887
|
const { hits: o } = i;
|
|
888
888
|
let l = [];
|
|
889
889
|
o.length > 0 && o[0].models && (l = o[0].models);
|
|
@@ -924,7 +924,7 @@ function Mt({
|
|
|
924
924
|
refinement: h.model.match(/[^>]*$/)[0].trim(),
|
|
925
925
|
popularity: h.model_popularity
|
|
926
926
|
}));
|
|
927
|
-
const $ = (
|
|
927
|
+
const $ = (ve = e.make) == null ? void 0 : ve.refinement, te = (ae = j.current) == null ? void 0 : ae[$];
|
|
928
928
|
if (te && Array.isArray(te) && te.length > 0) {
|
|
929
929
|
const h = new Set(
|
|
930
930
|
te.map((m) => String(m).trim().toUpperCase())
|
|
@@ -977,7 +977,7 @@ function Mt({
|
|
|
977
977
|
}).map(function(d, $) {
|
|
978
978
|
return $ + o;
|
|
979
979
|
});
|
|
980
|
-
c = c.reverse().map((d) => ({ value: d, refinement: d })),
|
|
980
|
+
c = c.reverse().map((d) => ({ value: d, refinement: d })), ue(c);
|
|
981
981
|
}).catch((r) => {
|
|
982
982
|
console.error("[VehicleSearch] Error fetching years:", r);
|
|
983
983
|
});
|
|
@@ -1009,11 +1009,11 @@ function Mt({
|
|
|
1009
1009
|
i = [...new Map(i.map((o) => [o.body, o])).values()].map((o) => ({
|
|
1010
1010
|
value: o.body.match(/[^>]*$/)[0].trim(),
|
|
1011
1011
|
refinement: o.body.match(/[^>]*$/)[0].trim()
|
|
1012
|
-
})).filter((o) => o.value),
|
|
1012
|
+
})).filter((o) => o.value), be(i);
|
|
1013
1013
|
});
|
|
1014
1014
|
}
|
|
1015
1015
|
}, [e.year, e.make, e.model, g]);
|
|
1016
|
-
const
|
|
1016
|
+
const me = N(({ hits: t, attribute: r, stateCallback: i }) => {
|
|
1017
1017
|
let o = [
|
|
1018
1018
|
...new Map(t.map((l) => [l[r], l])).values()
|
|
1019
1019
|
].map((l) => ({
|
|
@@ -1022,7 +1022,7 @@ function Mt({
|
|
|
1022
1022
|
})).filter((l) => l.refinement);
|
|
1023
1023
|
i(o);
|
|
1024
1024
|
}, []), vt = N(() => {
|
|
1025
|
-
const t =
|
|
1025
|
+
const t = _e.current ? _e.current.length + 3 : 3, r = C ? t + 1 : t;
|
|
1026
1026
|
return `vs:lg:grid-cols-${r > 8 ? 8 : r}`;
|
|
1027
1027
|
}, [C]);
|
|
1028
1028
|
B(() => {
|
|
@@ -1053,22 +1053,22 @@ function Mt({
|
|
|
1053
1053
|
],
|
|
1054
1054
|
limit: 1e3
|
|
1055
1055
|
}).then(({ hits: o }) => {
|
|
1056
|
-
|
|
1056
|
+
me({
|
|
1057
1057
|
hits: o,
|
|
1058
1058
|
attribute: "series",
|
|
1059
|
-
stateCallback:
|
|
1060
|
-
}),
|
|
1059
|
+
stateCallback: we
|
|
1060
|
+
}), me({
|
|
1061
1061
|
hits: o,
|
|
1062
1062
|
attribute: "variant",
|
|
1063
|
-
stateCallback:
|
|
1064
|
-
}),
|
|
1063
|
+
stateCallback: ye
|
|
1064
|
+
}), me({
|
|
1065
1065
|
hits: o,
|
|
1066
1066
|
attribute: "engine",
|
|
1067
|
-
stateCallback:
|
|
1068
|
-
}),
|
|
1067
|
+
stateCallback: xe
|
|
1068
|
+
}), me({
|
|
1069
1069
|
hits: o,
|
|
1070
1070
|
attribute: "engine_capacity",
|
|
1071
|
-
stateCallback:
|
|
1071
|
+
stateCallback: ke
|
|
1072
1072
|
});
|
|
1073
1073
|
});
|
|
1074
1074
|
}
|
|
@@ -1078,7 +1078,7 @@ function Mt({
|
|
|
1078
1078
|
e.variant,
|
|
1079
1079
|
e.engine,
|
|
1080
1080
|
e.engine_capacity,
|
|
1081
|
-
|
|
1081
|
+
me,
|
|
1082
1082
|
e.make,
|
|
1083
1083
|
e.model,
|
|
1084
1084
|
e.year,
|
|
@@ -1192,7 +1192,7 @@ function Mt({
|
|
|
1192
1192
|
X,
|
|
1193
1193
|
{
|
|
1194
1194
|
label: "Model",
|
|
1195
|
-
items:
|
|
1195
|
+
items: ge,
|
|
1196
1196
|
refine: Ye,
|
|
1197
1197
|
selected: e.model,
|
|
1198
1198
|
showPopular: !0,
|
|
@@ -1200,7 +1200,7 @@ function Mt({
|
|
|
1200
1200
|
showLabel: _,
|
|
1201
1201
|
isMobile: J,
|
|
1202
1202
|
sortOptions: !1,
|
|
1203
|
-
loading: e.make &&
|
|
1203
|
+
loading: e.make && ge.length === 0,
|
|
1204
1204
|
shouldBeActive: !!e.make
|
|
1205
1205
|
}
|
|
1206
1206
|
)
|
|
@@ -1225,7 +1225,7 @@ function Mt({
|
|
|
1225
1225
|
X,
|
|
1226
1226
|
{
|
|
1227
1227
|
label: "Model",
|
|
1228
|
-
items:
|
|
1228
|
+
items: ge,
|
|
1229
1229
|
refine: Ye,
|
|
1230
1230
|
selected: e.model,
|
|
1231
1231
|
showPopular: !0,
|
|
@@ -1233,7 +1233,7 @@ function Mt({
|
|
|
1233
1233
|
showLabel: _,
|
|
1234
1234
|
isMobile: J,
|
|
1235
1235
|
sortOptions: !1,
|
|
1236
|
-
loading: e.make &&
|
|
1236
|
+
loading: e.make && ge.length === 0,
|
|
1237
1237
|
shouldBeActive: !!e.make
|
|
1238
1238
|
}
|
|
1239
1239
|
),
|
|
@@ -1253,7 +1253,7 @@ function Mt({
|
|
|
1253
1253
|
}
|
|
1254
1254
|
)
|
|
1255
1255
|
] }),
|
|
1256
|
-
|
|
1256
|
+
_e.current && _e.current.map((t) => {
|
|
1257
1257
|
let r = null;
|
|
1258
1258
|
switch (t) {
|
|
1259
1259
|
case "body":
|
|
@@ -1389,7 +1389,7 @@ function Mt({
|
|
|
1389
1389
|
)
|
|
1390
1390
|
] });
|
|
1391
1391
|
}
|
|
1392
|
-
let We = !1,
|
|
1392
|
+
let We = !1, fe = !1;
|
|
1393
1393
|
function At(b) {
|
|
1394
1394
|
var T, re;
|
|
1395
1395
|
const v = b.shadowRoot;
|
|
@@ -1405,13 +1405,13 @@ function At(b) {
|
|
|
1405
1405
|
if (new MutationObserver((u) => {
|
|
1406
1406
|
u.forEach((y) => {
|
|
1407
1407
|
y.addedNodes.forEach((C) => {
|
|
1408
|
-
C.nodeType === 1 && C.id === "headlessui-portal-root" && (p.appendChild(C),
|
|
1408
|
+
C.nodeType === 1 && C.id === "headlessui-portal-root" && (p.appendChild(C), fe = !0);
|
|
1409
1409
|
});
|
|
1410
1410
|
}), u.forEach((y) => {
|
|
1411
1411
|
y.removedNodes.forEach((C) => {
|
|
1412
1412
|
C.nodeType === 1 && C.id === "headlessui-portal-root" && (p.querySelector(
|
|
1413
1413
|
"#headlessui-portal-root"
|
|
1414
|
-
) || (
|
|
1414
|
+
) || (fe = !1));
|
|
1415
1415
|
});
|
|
1416
1416
|
});
|
|
1417
1417
|
}).observe(document.body, {
|
|
@@ -1419,7 +1419,7 @@ function At(b) {
|
|
|
1419
1419
|
}), new MutationObserver((u) => {
|
|
1420
1420
|
u.forEach((y) => {
|
|
1421
1421
|
y.removedNodes.forEach((C) => {
|
|
1422
|
-
C.nodeType === 1 && C.id === "headlessui-portal-root" && (
|
|
1422
|
+
C.nodeType === 1 && C.id === "headlessui-portal-root" && (fe = !1);
|
|
1423
1423
|
});
|
|
1424
1424
|
});
|
|
1425
1425
|
}).observe(p, {
|
|
@@ -1455,7 +1455,7 @@ function At(b) {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
}, _ = CSSStyleDeclaration.prototype.setProperty;
|
|
1457
1457
|
CSSStyleDeclaration.prototype.setProperty = function(u, y, C) {
|
|
1458
|
-
if (!(O(this) && u === "overflow" && y === "hidden" &&
|
|
1458
|
+
if (!(O(this) && u === "overflow" && y === "hidden" && fe))
|
|
1459
1459
|
return _.call(this, u, y, C);
|
|
1460
1460
|
};
|
|
1461
1461
|
const V = Object.getOwnPropertyDescriptor(
|
|
@@ -1467,7 +1467,7 @@ function At(b) {
|
|
|
1467
1467
|
return V.get.call(this);
|
|
1468
1468
|
},
|
|
1469
1469
|
set: function(u) {
|
|
1470
|
-
if (!(O(this) && u === "hidden" &&
|
|
1470
|
+
if (!(O(this) && u === "hidden" && fe))
|
|
1471
1471
|
return V.set.call(this, u);
|
|
1472
1472
|
}
|
|
1473
1473
|
}), We = !0;
|
|
@@ -1486,8 +1486,8 @@ class jt extends HTMLElement {
|
|
|
1486
1486
|
if (this.hasAttribute(Q)) {
|
|
1487
1487
|
const M = this.getAttribute(Q);
|
|
1488
1488
|
if (/^#[0-9A-F]{6}$/i.test(M)) {
|
|
1489
|
-
const x = parseInt(M.slice(1, 3), 16), le = parseInt(M.slice(3, 5), 16),
|
|
1490
|
-
W = `${x} ${le} ${
|
|
1489
|
+
const x = parseInt(M.slice(1, 3), 16), le = parseInt(M.slice(3, 5), 16), he = parseInt(M.slice(5, 7), 16);
|
|
1490
|
+
W = `${x} ${le} ${he}`;
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
1493
|
return W = W || w, `:host { --${j}: ${W}; } .partbot-mmyvs-container { --${j}: ${W}; }`;
|