@sledge-app/react-instant-search 1.0.115 → 1.0.116
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/components/SearchResultWidget/Atoms.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/utils.d.ts +5 -1
- package/dist/components/SearchResultWidget/utils.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +334 -115
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vendor-1f6b0377.cjs +2 -0
- package/dist/vendor-1f6b0377.cjs.map +1 -0
- package/dist/{vendor-dc719d80.js → vendor-5ae8da85.js} +505 -40
- package/dist/vendor-5ae8da85.js.map +1 -0
- package/package.json +1 -1
- package/dist/vendor-3fb6b338.cjs +0 -2
- package/dist/vendor-3fb6b338.cjs.map +0 -1
- package/dist/vendor-dc719d80.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, a as $cb5cc270b50c6fcd$export$41fb9f06171c75f4, b as $cb5cc270b50c6fcd$export$602eac185826482c, c as $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, d as $cb5cc270b50c6fcd$export$f39c2d165cd861fe, e as $cb5cc270b50c6fcd$export$21b07c8f274aebd5, f as $67824d98245208a0$export$be92b6f5f03c0fe9, g as $67824d98245208a0$export$adb584737d712b70, h as $e698a72e93240346$export$be92b6f5f03c0fe9, i as $e698a72e93240346$export$adb584737d712b70, k as $
|
|
1
|
+
import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, a as $cb5cc270b50c6fcd$export$41fb9f06171c75f4, b as $cb5cc270b50c6fcd$export$602eac185826482c, c as $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, d as $cb5cc270b50c6fcd$export$f39c2d165cd861fe, e as $cb5cc270b50c6fcd$export$21b07c8f274aebd5, f as $67824d98245208a0$export$be92b6f5f03c0fe9, g as $67824d98245208a0$export$adb584737d712b70, h as $e698a72e93240346$export$be92b6f5f03c0fe9, i as $e698a72e93240346$export$adb584737d712b70, k as $d94698215c4408a7$export$be92b6f5f03c0fe9, l as $faa2e61a3361514f$export$be92b6f5f03c0fe9, m as $faa2e61a3361514f$export$13921ac0cc260818, n as $faa2e61a3361514f$export$9a58ef0d7ad3278c, o as $faa2e61a3361514f$export$6521433ed15a34db, p as $f99a8c78507165f7$export$be92b6f5f03c0fe9, q as $f99a8c78507165f7$export$6d08773d2e66f8f2, r as $f99a8c78507165f7$export$adb584737d712b70, s as $cc7e05a45900e73f$export$6d08773d2e66f8f2, t as $cc7e05a45900e73f$export$d6e5bf9c43ea9319, u as $cc7e05a45900e73f$export$c3468e2714d175fa, v as $cc7e05a45900e73f$export$be92b6f5f03c0fe9, w as $cc7e05a45900e73f$export$41fb9f06171c75f4, x as $cc7e05a45900e73f$export$4c8d1a57a761ef94, y as $cc7e05a45900e73f$export$f04a61298a47a40f, z as $cc7e05a45900e73f$export$602eac185826482c, A as $cc7e05a45900e73f$export$7c6e2c02157bb7d2, B as $cc7e05a45900e73f$export$2f60d3ec9ad468f2, C as $cc7e05a45900e73f$export$d5c6c08dc2d3ca7, D as $cc7e05a45900e73f$export$bf1aedc3039c8d63, E as motion, F as client, G as $d94698215c4408a7$export$a455218a85c89869, H as $d94698215c4408a7$export$7a7fa4424cb20976, I as $d94698215c4408a7$export$f69c19e57285b83a, J as $a093c7e1ec25a057$export$2881499e37b75b9a, K as $a093c7e1ec25a057$export$be92b6f5f03c0fe9, L as $a093c7e1ec25a057$export$41fb9f06171c75f4, M as $a093c7e1ec25a057$export$602eac185826482c, N as $a093c7e1ec25a057$export$7c6e2c02157bb7d2, O as $a093c7e1ec25a057$export$21b07c8f274aebd5, P as $57acba87d6e25586$export$be92b6f5f03c0fe9, Q as $57acba87d6e25586$export$d5c6c08dc2d3ca7, R as $57acba87d6e25586$export$9a4e88b92edfce6b, S as $57acba87d6e25586$export$6521433ed15a34db, T as MasonryResponsive, U as Masonry, V as useEmblaCarousel, W as useVirtualizer, X as $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, Y as $5d3850c4d0b4e6c7$export$602eac185826482c, Z as $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, _ as $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 } from "./vendor-5ae8da85.js";
|
|
2
2
|
import React__default, { createElement } from "react";
|
|
3
3
|
import { SledgeContext } from "@sledge-app/core";
|
|
4
4
|
import "react-dom";
|
|
@@ -176,7 +176,8 @@ const OBJECT_DATA_STRING_KEY = {
|
|
|
176
176
|
TOTAL_WISHLIST: "{{ total_wishlist }}",
|
|
177
177
|
ACCEPTED_FILETYPE_MEDIA: "{{ accepted_filetype_media }}",
|
|
178
178
|
MAX_SIZE_MEDIA: "{{ max_size_media }}",
|
|
179
|
-
FILTER_TITLE: "{{ filter_title }}"
|
|
179
|
+
FILTER_TITLE: "{{ filter_title }}",
|
|
180
|
+
PRICE_MAX_MONEY_FORMAT: "{{ price_max_money_format }}"
|
|
180
181
|
};
|
|
181
182
|
const ELEMENT_ID = {
|
|
182
183
|
PRODUCT_REVIEW: {
|
|
@@ -197,6 +198,7 @@ const HIERARCHICAL_FACET_OBJECT_ALIASES = {
|
|
|
197
198
|
product_type: "hierarchicalProductType"
|
|
198
199
|
};
|
|
199
200
|
const MAX_LIMIT_HIERARCHICAL = 7;
|
|
201
|
+
const SEPARATOR_HIERARCHICAL_FACET = "---5L3D9E---";
|
|
200
202
|
async function swr(url, options) {
|
|
201
203
|
if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET" && !(options == null ? void 0 : options.ignoreSWR)) {
|
|
202
204
|
const data = await getData(url);
|
|
@@ -289,6 +291,14 @@ function useIsFirstRender() {
|
|
|
289
291
|
}
|
|
290
292
|
return renderRef.current;
|
|
291
293
|
}
|
|
294
|
+
function useEffectOnChange(callback, dependencies) {
|
|
295
|
+
const isFirstRender = useIsFirstRender();
|
|
296
|
+
useEffectCallback(() => {
|
|
297
|
+
if (isFirstRender)
|
|
298
|
+
return;
|
|
299
|
+
callback();
|
|
300
|
+
}, dependencies);
|
|
301
|
+
}
|
|
292
302
|
const sanitizeDataId = (id) => {
|
|
293
303
|
if (!id)
|
|
294
304
|
return "";
|
|
@@ -472,7 +482,11 @@ const getFillRating = ({
|
|
|
472
482
|
const stripTags = (html) => {
|
|
473
483
|
return html.replace(/(<([^>]+)>)/gi, "");
|
|
474
484
|
};
|
|
475
|
-
const stringToSlug = (text) =>
|
|
485
|
+
const stringToSlug = (text) => {
|
|
486
|
+
if (!text)
|
|
487
|
+
return text;
|
|
488
|
+
return text.toLowerCase().replace(/[^\w ]+/g, "").replace(/ +/g, "-");
|
|
489
|
+
};
|
|
476
490
|
const shopifyFormatMoney = (cents, format) => {
|
|
477
491
|
var _a;
|
|
478
492
|
if (typeof cents == "string") {
|
|
@@ -650,52 +664,135 @@ const Checkbox = ({ id, name, value, required, label, checked, labelStyle = {},
|
|
|
650
664
|
};
|
|
651
665
|
const Slider$1 = "";
|
|
652
666
|
const Slider = (props) => {
|
|
653
|
-
|
|
667
|
+
var _a, _b, _c;
|
|
668
|
+
const {
|
|
669
|
+
type = "slider",
|
|
670
|
+
prefixInputRange = "",
|
|
671
|
+
descriptionInputRange = "",
|
|
672
|
+
valueFilterSliderChange = [],
|
|
673
|
+
labelStyle = {},
|
|
674
|
+
value,
|
|
675
|
+
textValue = [],
|
|
676
|
+
min,
|
|
677
|
+
max,
|
|
678
|
+
step = 1,
|
|
679
|
+
setValueCommit,
|
|
680
|
+
setValueChange,
|
|
681
|
+
wrapperClassName = "",
|
|
682
|
+
minMaxClassName = "",
|
|
683
|
+
minMaxTextClassName = ""
|
|
684
|
+
} = props;
|
|
685
|
+
const [inputRangeMin, setInputRangeMin] = React__default.useState(value == null ? void 0 : value[0]);
|
|
686
|
+
const [inputRangeMax, setInputRangeMax] = React__default.useState((value == null ? void 0 : value[1]) || (value == null ? void 0 : value[0]));
|
|
687
|
+
const delayInputRangeRef = React__default.useRef(null);
|
|
654
688
|
let content = (textValue == null ? void 0 : textValue.length) ? textValue : value;
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
689
|
+
const hasMaxValue = (value == null ? void 0 : value.length) && (value == null ? void 0 : value[1]);
|
|
690
|
+
const FormWrapper = ((_a = String(type)) == null ? void 0 : _a.includes("input_range")) ? $d94698215c4408a7$export$be92b6f5f03c0fe9 : React__default.Fragment;
|
|
691
|
+
const isTypeInputRange = type === "input_range";
|
|
692
|
+
const isTypeIncludeSlider = (_b = String(type)) == null ? void 0 : _b.includes("slider");
|
|
693
|
+
const isTypeIncludeInputRange = (_c = String(type)) == null ? void 0 : _c.includes("input_range");
|
|
694
|
+
const handleChangeInputRange = ({ event, type: type2 }) => {
|
|
695
|
+
var _a2;
|
|
696
|
+
const valueInput = (_a2 = event == null ? void 0 : event.target) == null ? void 0 : _a2.value;
|
|
697
|
+
const valueCommit = type2 === "min" ? [valueInput || 0, value == null ? void 0 : value[1]] : [value == null ? void 0 : value[0], valueInput || 0];
|
|
698
|
+
if (type2 === "min") {
|
|
699
|
+
setInputRangeMin(valueInput);
|
|
700
|
+
} else {
|
|
701
|
+
setInputRangeMax(valueInput);
|
|
702
|
+
}
|
|
703
|
+
setValueChange == null ? void 0 : setValueChange(valueCommit);
|
|
704
|
+
if (delayInputRangeRef.current) {
|
|
705
|
+
clearTimeout(delayInputRangeRef.current);
|
|
706
|
+
}
|
|
707
|
+
delayInputRangeRef.current = setTimeout(() => {
|
|
708
|
+
setValueCommit == null ? void 0 : setValueCommit(valueCommit);
|
|
709
|
+
}, 500);
|
|
710
|
+
};
|
|
711
|
+
useEffectOnChange(() => {
|
|
712
|
+
if (isTypeIncludeInputRange && !(valueFilterSliderChange == null ? void 0 : valueFilterSliderChange.length)) {
|
|
713
|
+
setInputRangeMin(value == null ? void 0 : value[0]);
|
|
714
|
+
setInputRangeMax((value == null ? void 0 : value[1]) || (value == null ? void 0 : value[0]));
|
|
715
|
+
}
|
|
716
|
+
}, [valueFilterSliderChange]);
|
|
717
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__slider-wrapper ${wrapperClassName}`, "data-slider-type": type, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormWrapper, { children: [
|
|
718
|
+
isTypeIncludeInputRange ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
719
|
+
isTypeInputRange && descriptionInputRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__slider-input-range-description", style: labelStyle, children: descriptionInputRange }) : null,
|
|
720
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__slider-input-range-wrapper", children: [
|
|
721
|
+
isTypeInputRange && prefixInputRange ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__slider-input-range-prefix", style: labelStyle, children: prefixInputRange }) : null,
|
|
670
722
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
671
|
-
|
|
723
|
+
InputField,
|
|
672
724
|
{
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
customArrow: `<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#43c6ac"/></svg>`,
|
|
679
|
-
wrapTrigger: false,
|
|
680
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb" })
|
|
725
|
+
className: "sledge__slider-input-range-minmax",
|
|
726
|
+
type: "text",
|
|
727
|
+
onChange: (event) => handleChangeInputRange({ event, type: "min" }),
|
|
728
|
+
value: inputRangeMin,
|
|
729
|
+
style: labelStyle
|
|
681
730
|
}
|
|
682
731
|
),
|
|
683
|
-
|
|
684
|
-
|
|
732
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge__slider-input-range-minmax-separator", children: "-" }),
|
|
733
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
734
|
+
InputField,
|
|
685
735
|
{
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
customArrow: `<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#43c6ac"/></svg>`,
|
|
692
|
-
wrapTrigger: false,
|
|
693
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb" })
|
|
736
|
+
className: "sledge__slider-input-range-minmax",
|
|
737
|
+
type: "text",
|
|
738
|
+
onChange: (event) => handleChangeInputRange({ event, type: "max" }),
|
|
739
|
+
value: inputRangeMax,
|
|
740
|
+
style: labelStyle
|
|
694
741
|
}
|
|
695
742
|
)
|
|
696
|
-
]
|
|
697
|
-
}
|
|
698
|
-
|
|
743
|
+
] })
|
|
744
|
+
] }) : null,
|
|
745
|
+
isTypeIncludeSlider ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
746
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("form", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
747
|
+
$faa2e61a3361514f$export$be92b6f5f03c0fe9,
|
|
748
|
+
{
|
|
749
|
+
className: "sledge__SliderRoot",
|
|
750
|
+
value,
|
|
751
|
+
...typeof min !== "undefined" ? {
|
|
752
|
+
min
|
|
753
|
+
} : {},
|
|
754
|
+
max,
|
|
755
|
+
step,
|
|
756
|
+
"aria-label": "Volume",
|
|
757
|
+
onValueCommit: (valueCommit) => setValueCommit == null ? void 0 : setValueCommit(valueCommit),
|
|
758
|
+
onValueChange: (valueChange) => setValueChange == null ? void 0 : setValueChange(valueChange),
|
|
759
|
+
children: [
|
|
760
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$13921ac0cc260818, { className: "sledge__SliderTrack", children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$9a58ef0d7ad3278c, { className: "sledge__SliderRange" }) }),
|
|
761
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
762
|
+
Tooltip,
|
|
763
|
+
{
|
|
764
|
+
...(textValue == null ? void 0 : textValue.length) ? {
|
|
765
|
+
innerHTMLContent: content[0]
|
|
766
|
+
} : {
|
|
767
|
+
content: content[0]
|
|
768
|
+
},
|
|
769
|
+
customArrow: `<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#43c6ac"/></svg>`,
|
|
770
|
+
wrapTrigger: false,
|
|
771
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb" })
|
|
772
|
+
}
|
|
773
|
+
),
|
|
774
|
+
hasMaxValue ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
775
|
+
Tooltip,
|
|
776
|
+
{
|
|
777
|
+
...(textValue == null ? void 0 : textValue.length) ? {
|
|
778
|
+
innerHTMLContent: content[1]
|
|
779
|
+
} : {
|
|
780
|
+
content: content[1]
|
|
781
|
+
},
|
|
782
|
+
customArrow: `<svg width="19" height="5" viewBox="0 0 19 5" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 4.99998C9 9.48298e-05 16.4996 1.99678e-05 18.4999 0L9 2.2985e-06L0.5 2.04891e-06C9 2.2985e-06 9 4.99998 9 4.99998Z" fill="#43c6ac"/></svg>`,
|
|
783
|
+
wrapTrigger: false,
|
|
784
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb" })
|
|
785
|
+
}
|
|
786
|
+
) : null
|
|
787
|
+
]
|
|
788
|
+
}
|
|
789
|
+
) }),
|
|
790
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `sledge__slider-minmax ${minMaxClassName}`, children: [
|
|
791
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__slider-minmax-text ${minMaxTextClassName}`, dangerouslySetInnerHTML: { __html: content[0] } }),
|
|
792
|
+
hasMaxValue ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__slider-minmax-text ${minMaxTextClassName}`, dangerouslySetInnerHTML: { __html: content[1] } }) : null
|
|
793
|
+
] })
|
|
794
|
+
] }) : null
|
|
795
|
+
] }) });
|
|
699
796
|
};
|
|
700
797
|
const Pagination$1 = "";
|
|
701
798
|
const Pagination = (props) => {
|
|
@@ -3051,7 +3148,7 @@ const ProductCard = (props) => {
|
|
|
3051
3148
|
defaultSelectedClassChanger();
|
|
3052
3149
|
}
|
|
3053
3150
|
}, setSelectedVariant = function(element, value, optionIndex) {
|
|
3054
|
-
var _a2, _b2, _c2, _d;
|
|
3151
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
3055
3152
|
const parentCard = element.target.offsetParent;
|
|
3056
3153
|
const selectedInput = parentCard.querySelector(`.sledge__product-grid-card-selected-option[data-product-id='${id}']`);
|
|
3057
3154
|
setElementAttribute({
|
|
@@ -3059,14 +3156,14 @@ const ProductCard = (props) => {
|
|
|
3059
3156
|
attributeName: `data-selected-option${optionIndex}`,
|
|
3060
3157
|
value
|
|
3061
3158
|
});
|
|
3062
|
-
const option1 = `[data-option-1="${selectedInput.attributes["data-selected-option1"].value}"]`;
|
|
3063
|
-
const option2 = `${selectedInput.attributes["data-selected-option2"] ? `[data-option-2="${selectedInput.attributes["data-selected-option2"].value}"]` : ""}`;
|
|
3159
|
+
const option1 = `[data-option-1="${stringToSlug((_b2 = (_a2 = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _a2["data-selected-option1"]) == null ? void 0 : _b2.value)}"]`;
|
|
3160
|
+
const option2 = `${((_c2 = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _c2["data-selected-option2"]) ? `[data-option-2="${stringToSlug((_e = (_d = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _d["data-selected-option2"]) == null ? void 0 : _e.value)}"]` : ""}`;
|
|
3064
3161
|
const selectOption = parentCard.querySelector(`select option${option1}${option2}`);
|
|
3065
|
-
const variantId = selectOption.attributes["data-graphql-id"].value;
|
|
3066
|
-
const imageId = (
|
|
3067
|
-
const inventoryQuantity = (
|
|
3068
|
-
const inventoryManagement = (
|
|
3069
|
-
const inventoryPolicy = (
|
|
3162
|
+
const variantId = (_g = (_f = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _f["data-graphql-id"]) == null ? void 0 : _g.value;
|
|
3163
|
+
const imageId = (_i = (_h = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _h["data-image-id"]) == null ? void 0 : _i.value;
|
|
3164
|
+
const inventoryQuantity = (_k = (_j = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _j["data-inventory-quantity"]) == null ? void 0 : _k.value;
|
|
3165
|
+
const inventoryManagement = (_m = (_l = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _l["data-inventory-management"]) == null ? void 0 : _m.value;
|
|
3166
|
+
const inventoryPolicy = (_o = (_n = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _n["data-inventory-policy"]) == null ? void 0 : _o.value;
|
|
3070
3167
|
const setOther = () => {
|
|
3071
3168
|
var _a3, _b3;
|
|
3072
3169
|
setElementAttribute({
|
|
@@ -3253,8 +3350,8 @@ const ProductCard = (props) => {
|
|
|
3253
3350
|
/* @__PURE__ */ jsxRuntimeExports.jsx("select", { className: "variant-picker sledge__product-grid-card-variant-picker", children: variants == null ? void 0 : variants.map((variant) => {
|
|
3254
3351
|
const { title: title2, option1, option2, position, id: id2, admin_graphql_api_id, image_id, inventory_quantity, inventory_management, inventory_policy } = variant;
|
|
3255
3352
|
let optionAttributes = {
|
|
3256
|
-
"data-option-1": option1,
|
|
3257
|
-
"data-option-2": option2,
|
|
3353
|
+
"data-option-1": stringToSlug(option1),
|
|
3354
|
+
"data-option-2": stringToSlug(option2),
|
|
3258
3355
|
"data-inventory-quantity": inventory_quantity,
|
|
3259
3356
|
"data-inventory-management": inventory_management,
|
|
3260
3357
|
"data-inventory-policy": inventory_policy,
|
|
@@ -3425,7 +3522,30 @@ const ProductGrid = (props) => {
|
|
|
3425
3522
|
}) });
|
|
3426
3523
|
};
|
|
3427
3524
|
const TextAreaField = "";
|
|
3428
|
-
const InputField = "";
|
|
3525
|
+
const InputField$1 = "";
|
|
3526
|
+
const InputField = (props) => {
|
|
3527
|
+
const { className = "", value = "", onChange, required, type, name = "", ...otherProps } = props;
|
|
3528
|
+
const handleChangeField = (e) => {
|
|
3529
|
+
onChange && onChange(e);
|
|
3530
|
+
};
|
|
3531
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__input-field-wrapper ${className || ""}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs($d94698215c4408a7$export$a455218a85c89869, { className: "FormField", name, children: [
|
|
3532
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx($d94698215c4408a7$export$7a7fa4424cb20976, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3533
|
+
"input",
|
|
3534
|
+
{
|
|
3535
|
+
className: "sledge__input-field",
|
|
3536
|
+
type,
|
|
3537
|
+
value,
|
|
3538
|
+
onChange: (e) => handleChangeField(e),
|
|
3539
|
+
...required ? {
|
|
3540
|
+
required
|
|
3541
|
+
} : {},
|
|
3542
|
+
...otherProps
|
|
3543
|
+
}
|
|
3544
|
+
) }),
|
|
3545
|
+
required && /* @__PURE__ */ jsxRuntimeExports.jsx($d94698215c4408a7$export$f69c19e57285b83a, { className: "FormMessage", match: "valueMissing", children: "Required field" }),
|
|
3546
|
+
type === "email" && /* @__PURE__ */ jsxRuntimeExports.jsx($d94698215c4408a7$export$f69c19e57285b83a, { className: "FormMessage", match: "typeMismatch", children: "Please fill a valid email address" })
|
|
3547
|
+
] }) });
|
|
3548
|
+
};
|
|
3429
3549
|
const CollectionGrid$1 = "";
|
|
3430
3550
|
const CollectionGrid = ({ className = "", data, cards: CardsComponent, isComponentJsVersion, onAfterRenderCollection }) => {
|
|
3431
3551
|
React__default.useEffect(() => {
|
|
@@ -4563,6 +4683,54 @@ const SearchIconWidgetPopup = () => {
|
|
|
4563
4683
|
] })
|
|
4564
4684
|
] }) });
|
|
4565
4685
|
};
|
|
4686
|
+
const sortFacets = ({ facets, sortingOrder }) => {
|
|
4687
|
+
if (!(facets == null ? void 0 : facets.length) || !(sortingOrder == null ? void 0 : sortingOrder.length))
|
|
4688
|
+
return facets;
|
|
4689
|
+
const sortRecursively = (objects, orderArray) => {
|
|
4690
|
+
var _a, _b;
|
|
4691
|
+
const isCollectionIdSort = ((_b = (_a = objects == null ? void 0 : objects[0]) == null ? void 0 : _a.parseObject) == null ? void 0 : _b.collection_id) !== void 0;
|
|
4692
|
+
const sortKey = isCollectionIdSort ? "collection_id" : "name";
|
|
4693
|
+
const objectsMap = new Map(objects.map((obj) => [isCollectionIdSort ? obj.parseObject[sortKey] : obj[sortKey], obj]));
|
|
4694
|
+
const sorted = [];
|
|
4695
|
+
const usedKeys = /* @__PURE__ */ new Set();
|
|
4696
|
+
orderArray.forEach((sortItem) => {
|
|
4697
|
+
var _a2, _b2, _c;
|
|
4698
|
+
const lookupKey = isCollectionIdSort ? sortItem == null ? void 0 : sortItem.id : sortItem;
|
|
4699
|
+
const matchingObject = objectsMap.get(lookupKey);
|
|
4700
|
+
if (lookupKey && matchingObject) {
|
|
4701
|
+
usedKeys.add(lookupKey);
|
|
4702
|
+
const hasMatchingChildren = ((_a2 = matchingObject == null ? void 0 : matchingObject.children) == null ? void 0 : _a2.length) > 0 && ((_b2 = sortItem == null ? void 0 : sortItem.children) == null ? void 0 : _b2.length) > 0;
|
|
4703
|
+
sorted.push({
|
|
4704
|
+
...matchingObject,
|
|
4705
|
+
...hasMatchingChildren ? {
|
|
4706
|
+
children: hasMatchingChildren ? sortRecursively(matchingObject == null ? void 0 : matchingObject.children, sortItem == null ? void 0 : sortItem.children) : ((_c = matchingObject == null ? void 0 : matchingObject.children) == null ? void 0 : _c.length) ? matchingObject == null ? void 0 : matchingObject.children : []
|
|
4707
|
+
} : {}
|
|
4708
|
+
});
|
|
4709
|
+
}
|
|
4710
|
+
});
|
|
4711
|
+
objects.forEach((obj) => {
|
|
4712
|
+
const objKey = isCollectionIdSort ? obj.parseObject[sortKey] : obj[sortKey];
|
|
4713
|
+
if (!usedKeys.has(objKey)) {
|
|
4714
|
+
sorted.push(obj);
|
|
4715
|
+
}
|
|
4716
|
+
});
|
|
4717
|
+
return sorted;
|
|
4718
|
+
};
|
|
4719
|
+
try {
|
|
4720
|
+
const rootObjects = facets;
|
|
4721
|
+
const rootSortOrder = sortingOrder;
|
|
4722
|
+
const sorted = sortRecursively(rootObjects, rootSortOrder);
|
|
4723
|
+
return sorted;
|
|
4724
|
+
} catch (error) {
|
|
4725
|
+
return facets;
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
const parseFacetObject = ({ facet = "" }) => {
|
|
4729
|
+
var _a, _b;
|
|
4730
|
+
if (facet && ((_a = String(facet)) == null ? void 0 : _a.includes(SEPARATOR_HIERARCHICAL_FACET)))
|
|
4731
|
+
return JSON.parse((_b = String(facet)) == null ? void 0 : _b.replaceAll(SEPARATOR_HIERARCHICAL_FACET, ","));
|
|
4732
|
+
return null;
|
|
4733
|
+
};
|
|
4566
4734
|
const detectQueryStringFilter = ({ facets, facetsQueryStringObject, callback }) => {
|
|
4567
4735
|
const searchParams = new URLSearchParams(document.location.search);
|
|
4568
4736
|
const searchParamsObject = Object.fromEntries(searchParams);
|
|
@@ -4674,10 +4842,12 @@ const createHierarchicalFacet = ({
|
|
|
4674
4842
|
hiddensCollection,
|
|
4675
4843
|
displaySettings,
|
|
4676
4844
|
searchFacetDistribution,
|
|
4677
|
-
hierarchicalFacetAliases
|
|
4845
|
+
hierarchicalFacetAliases,
|
|
4846
|
+
hierarchicalCollectionsSettings
|
|
4678
4847
|
}) => {
|
|
4679
|
-
var _a, _b, _c;
|
|
4848
|
+
var _a, _b, _c, _d, _e;
|
|
4680
4849
|
const { hide_unrelated } = filter;
|
|
4850
|
+
const { hidden_ids: hierarchical_collections_hidden_ids, structure: hierarchical_collections_structure } = hierarchicalCollectionsSettings || {};
|
|
4681
4851
|
const isCollection = (_a = String(indexValue)) == null ? void 0 : _a.includes(HIERARCHICAL_FACET_OBJECT_ALIASES.collections);
|
|
4682
4852
|
const hiddensProp = isCollection ? hiddensCollection : hiddens;
|
|
4683
4853
|
let arrSelectedFacetHierarchical = detectArrFacetHierarchical({
|
|
@@ -4705,36 +4875,52 @@ const createHierarchicalFacet = ({
|
|
|
4705
4875
|
let parent = hierarchicalFacets;
|
|
4706
4876
|
for (let facet of facets) {
|
|
4707
4877
|
const names = facet.name.split(isCollection ? separatorCollection : separator);
|
|
4878
|
+
const name = (_d = (_c = names == null ? void 0 : names[names.length - 1]) == null ? void 0 : _c.trim) == null ? void 0 : _d.call(_c);
|
|
4879
|
+
const parseObject = parseFacetObject({ facet: name });
|
|
4880
|
+
const isFacetObject = Boolean(parseObject == null ? void 0 : parseObject.collection_id);
|
|
4708
4881
|
const selectedFacetHierarchical = arrSelectedFacetHierarchical[indexValue][`lvl${level}`];
|
|
4709
4882
|
const isWhenSelectedHideSiblings = hide_unrelated && (selectedFacetHierarchical == null ? void 0 : selectedFacetHierarchical.length) && !selectedFacetHierarchical.includes(facet.value);
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
}
|
|
4883
|
+
let isHidden = false;
|
|
4884
|
+
if (isCollection && isFacetObject && (hierarchical_collections_hidden_ids == null ? void 0 : hierarchical_collections_hidden_ids.length)) {
|
|
4885
|
+
isHidden = hierarchical_collections_hidden_ids == null ? void 0 : hierarchical_collections_hidden_ids.includes(parseObject == null ? void 0 : parseObject.collection_id);
|
|
4886
|
+
} else {
|
|
4887
|
+
isHidden = hiddensProp == null ? void 0 : hiddensProp.find((hierarchical_hidden) => {
|
|
4888
|
+
var _a2;
|
|
4889
|
+
return (_a2 = facet.value) == null ? void 0 : _a2.startsWith(hierarchical_hidden);
|
|
4890
|
+
});
|
|
4891
|
+
}
|
|
4714
4892
|
if (isWhenSelectedHideSiblings || isHidden)
|
|
4715
4893
|
continue;
|
|
4716
4894
|
if (level > 0) {
|
|
4717
4895
|
parent = hierarchicalFacets;
|
|
4718
4896
|
for (let i = 0; i < names.length - 1; i++) {
|
|
4719
4897
|
let foundIndex = parent == null ? void 0 : parent.findIndex((f) => f.name.trim().toLowerCase() === names[i].trim().toLowerCase());
|
|
4720
|
-
parent = (
|
|
4898
|
+
parent = (_e = parent == null ? void 0 : parent[foundIndex]) == null ? void 0 : _e.children;
|
|
4721
4899
|
}
|
|
4722
4900
|
parent == null ? void 0 : parent.push({
|
|
4723
4901
|
...facet,
|
|
4724
|
-
name
|
|
4902
|
+
name,
|
|
4725
4903
|
level,
|
|
4904
|
+
parseObject,
|
|
4726
4905
|
children: []
|
|
4727
4906
|
});
|
|
4728
4907
|
}
|
|
4729
4908
|
if (level === 0)
|
|
4730
4909
|
parent == null ? void 0 : parent.push({
|
|
4731
4910
|
...facet,
|
|
4732
|
-
name
|
|
4911
|
+
name,
|
|
4733
4912
|
level: 0,
|
|
4913
|
+
parseObject,
|
|
4734
4914
|
children: []
|
|
4735
4915
|
});
|
|
4736
4916
|
}
|
|
4737
4917
|
}
|
|
4918
|
+
if (isCollection) {
|
|
4919
|
+
hierarchicalFacets = sortFacets({
|
|
4920
|
+
facets: hierarchicalFacets,
|
|
4921
|
+
sortingOrder: hierarchical_collections_structure
|
|
4922
|
+
});
|
|
4923
|
+
}
|
|
4738
4924
|
return hierarchicalFacets;
|
|
4739
4925
|
};
|
|
4740
4926
|
const handleConditionNotUpdateFacetDistribution = ({
|
|
@@ -4772,15 +4958,16 @@ const handleFacetValues = ({
|
|
|
4772
4958
|
keepCounterFacets,
|
|
4773
4959
|
allowedFilterSlider
|
|
4774
4960
|
}) => {
|
|
4775
|
-
var _a, _b;
|
|
4961
|
+
var _a, _b, _c, _d;
|
|
4776
4962
|
const { value, settings: filterSettings } = filter;
|
|
4777
4963
|
let aliases = {};
|
|
4778
|
-
if (filter.value ===
|
|
4964
|
+
if (filter.value === HIERARCHICAL_FACET_OBJECT_ALIASES.product_type)
|
|
4779
4965
|
aliases = settings.productTypeAliases || {};
|
|
4780
|
-
if (filter.value ===
|
|
4966
|
+
if (filter.value === HIERARCHICAL_FACET_OBJECT_ALIASES.collections)
|
|
4781
4967
|
aliases = settings.collectionAliases || {};
|
|
4782
|
-
const
|
|
4783
|
-
const
|
|
4968
|
+
const isCollection = (_a = String(filter == null ? void 0 : filter.value)) == null ? void 0 : _a.includes(HIERARCHICAL_FACET_OBJECT_ALIASES.collections);
|
|
4969
|
+
const isHideFacetWhenZeroValue = (_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.hide_when_zero_value;
|
|
4970
|
+
const { prefix, filter_list, delete_prefix, selected_filter, structure } = filterSettings || {};
|
|
4784
4971
|
let facetValues = [];
|
|
4785
4972
|
if (!(items == null ? void 0 : items.length))
|
|
4786
4973
|
return facetValues;
|
|
@@ -4794,6 +4981,8 @@ const handleFacetValues = ({
|
|
|
4794
4981
|
continue;
|
|
4795
4982
|
const isFacetHierarchical = Object.hasOwn(item, "children");
|
|
4796
4983
|
let labelName = item.name;
|
|
4984
|
+
if (isFacetHierarchical && isCollection)
|
|
4985
|
+
labelName = ((_c = parseFacetObject({ facet: labelName })) == null ? void 0 : _c.collection_title) || labelName;
|
|
4797
4986
|
let getValue = isFacetHierarchical ? `${value}.lvl${item.level}` : value;
|
|
4798
4987
|
if (languageSettings && (languageSettings[item.value] || languageSettings[item.name]))
|
|
4799
4988
|
labelName = languageSettings[item.value] || languageSettings[item.name];
|
|
@@ -4802,7 +4991,7 @@ const handleFacetValues = ({
|
|
|
4802
4991
|
clickedFacets,
|
|
4803
4992
|
keepCounterFacets,
|
|
4804
4993
|
allowedFilterSlider
|
|
4805
|
-
}) ? (item == null ? void 0 : item.total) || 0 : (searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) && ((
|
|
4994
|
+
}) ? (item == null ? void 0 : item.total) || 0 : (searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) && ((_d = searchFacetDistribution == null ? void 0 : searchFacetDistribution[getValue]) == null ? void 0 : _d[item.value]) ? searchFacetDistribution[getValue][item.value] : 0;
|
|
4806
4995
|
let getLabelName = aliases[labelName] || labelName;
|
|
4807
4996
|
delete_prefix == null ? void 0 : delete_prefix.map((deletePrefix) => {
|
|
4808
4997
|
if (String(getLabelName).startsWith(deletePrefix))
|
|
@@ -4815,6 +5004,10 @@ const handleFacetValues = ({
|
|
|
4815
5004
|
counter
|
|
4816
5005
|
});
|
|
4817
5006
|
}
|
|
5007
|
+
facetValues = sortFacets({
|
|
5008
|
+
facets: facetValues,
|
|
5009
|
+
sortingOrder: structure
|
|
5010
|
+
});
|
|
4818
5011
|
return facetValues;
|
|
4819
5012
|
};
|
|
4820
5013
|
const FacetComponent = (props) => {
|
|
@@ -4855,9 +5048,9 @@ const FacetComponent = (props) => {
|
|
|
4855
5048
|
const [showFacet, setShowFacet] = React__default.useState(false);
|
|
4856
5049
|
const searchFacetRef = React__default.useRef(null);
|
|
4857
5050
|
const previousState = usePrevious({ keywordFacet });
|
|
4858
|
-
const { money_format } = generalDataSettings || {};
|
|
5051
|
+
const { money_format, default_currency_symbol } = generalDataSettings || {};
|
|
4859
5052
|
const { button_load_more } = (generalDataSettings == null ? void 0 : generalDataSettings.languages) || {};
|
|
4860
|
-
const { search_filter_placeholder, search_filter_show_more_result, search_filter_no_result, filter_select_placeholder } = languageSettings || {};
|
|
5053
|
+
const { search_filter_placeholder, search_filter_show_more_result, search_filter_no_result, filter_select_placeholder, highest_price_info } = languageSettings || {};
|
|
4861
5054
|
const {
|
|
4862
5055
|
color: filter_option_color,
|
|
4863
5056
|
font_size: filter_option_font_size,
|
|
@@ -4878,7 +5071,8 @@ const FacetComponent = (props) => {
|
|
|
4878
5071
|
return null;
|
|
4879
5072
|
let blockComponent = null;
|
|
4880
5073
|
const isShowNumberMatchingProduct = (_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.show_number_matching_product;
|
|
4881
|
-
const isDisplaySlider = display.toLowerCase()
|
|
5074
|
+
const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display.toLowerCase());
|
|
5075
|
+
const isDisplayInputRange = display.toLowerCase() === "input_range";
|
|
4882
5076
|
const getValue = `${value}-${indexFilter}`;
|
|
4883
5077
|
if (show_search && keywordFacet && !isDisplaySlider)
|
|
4884
5078
|
items = items == null ? void 0 : items.filter(({ name }) => {
|
|
@@ -5109,37 +5303,43 @@ const FacetComponent = (props) => {
|
|
|
5109
5303
|
let defaultValueMax = (valueFilterSliderChange == null ? void 0 : valueFilterSliderChange[1]) || (items == null ? void 0 : items.max);
|
|
5110
5304
|
let contentDefaultValueMin = isPriceValue ? shopifyFormatMoney(defaultValueMin * 100, money_format) : isSalePercent ? `${defaultValueMin}%` : defaultValueMin;
|
|
5111
5305
|
let contentDefaultValueMax = isPriceValue ? shopifyFormatMoney(defaultValueMax * 100, money_format) : isSalePercent ? `${defaultValueMax}%` : defaultValueMax;
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5306
|
+
let contentFacetStatsMax = isPriceValue ? shopifyFormatMoney((items == null ? void 0 : items.max) * 100, money_format) : isSalePercent ? `${items == null ? void 0 : items.max}%` : items == null ? void 0 : items.max;
|
|
5307
|
+
let descriptionInputRange = highest_price_info ? String(highest_price_info).replaceAll(OBJECT_DATA_STRING_KEY.PRICE_MAX_MONEY_FORMAT, contentFacetStatsMax) : `The highest price is ${contentFacetStatsMax}`;
|
|
5308
|
+
blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5309
|
+
Slider,
|
|
5310
|
+
{
|
|
5311
|
+
type: display.toLowerCase(),
|
|
5312
|
+
valueFilterSliderChange,
|
|
5313
|
+
labelStyle: filter_option_style,
|
|
5314
|
+
...isDisplayInputRange ? {
|
|
5315
|
+
prefixInputRange: default_currency_symbol,
|
|
5316
|
+
descriptionInputRange
|
|
5317
|
+
} : {},
|
|
5318
|
+
value: defaultValueMin === defaultValueMax ? [defaultValueMax] : [defaultValueMin, defaultValueMax],
|
|
5319
|
+
textValue: defaultValueMin === defaultValueMax ? [contentDefaultValueMax] : [contentDefaultValueMin, contentDefaultValueMax],
|
|
5320
|
+
...(items == null ? void 0 : items.min) === (items == null ? void 0 : items.max) ? {} : {
|
|
5321
|
+
min: items == null ? void 0 : items.min
|
|
5322
|
+
},
|
|
5323
|
+
max: items == null ? void 0 : items.max,
|
|
5324
|
+
step: 1,
|
|
5325
|
+
setValueCommit: (valueCommit) => handleFilterChange({
|
|
5326
|
+
parentId: value,
|
|
5327
|
+
value: valueCommit
|
|
5328
|
+
}),
|
|
5329
|
+
setValueChange: (valueChange) => {
|
|
5330
|
+
if (value === "variants.price") {
|
|
5331
|
+
setValueFilterPriceChange(valueChange);
|
|
5332
|
+
} else if (value === "variants.sale_percent") {
|
|
5333
|
+
setValueFilterOnSaleChange(valueChange);
|
|
5334
|
+
} else {
|
|
5335
|
+
setValueFilterSliderOthers((prevState) => ({ ...prevState, [value]: valueChange }));
|
|
5135
5336
|
}
|
|
5136
|
-
}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
] });
|
|
5337
|
+
},
|
|
5338
|
+
wrapperClassName: "sledge-instant-search__result-filter-item-list-slider",
|
|
5339
|
+
minMaxClassName: "sledge-instant-search__result-filter-item-list-slider-minmax",
|
|
5340
|
+
minMaxTextClassName: "sledge-instant-search__result-filter-minmax-field"
|
|
5341
|
+
}
|
|
5342
|
+
);
|
|
5143
5343
|
} else if ((display.toLowerCase() === "checkbox" || display.toLowerCase() === "tree") && (currentItems == null ? void 0 : currentItems.length)) {
|
|
5144
5344
|
blockComponent = display.toLowerCase() === "checkbox" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5145
5345
|
VirtualizedList,
|
|
@@ -5599,7 +5799,7 @@ const SearchResultWidget = (props) => {
|
|
|
5599
5799
|
var _a3;
|
|
5600
5800
|
const { value, label, display: display2, settings: settings2 } = filter;
|
|
5601
5801
|
const { prefix, filter_list, selected_filter } = settings2 || {};
|
|
5602
|
-
const isDisplaySlider = display2.toLowerCase()
|
|
5802
|
+
const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display2.toLowerCase());
|
|
5603
5803
|
if (isDisplaySlider)
|
|
5604
5804
|
return;
|
|
5605
5805
|
let items = [];
|
|
@@ -5627,7 +5827,7 @@ const SearchResultWidget = (props) => {
|
|
|
5627
5827
|
}).filter((item) => item);
|
|
5628
5828
|
let valueAllowedFilterSlider = valueAllowedFilter.map((filter) => {
|
|
5629
5829
|
const { value, display: display2 } = filter;
|
|
5630
|
-
const isDisplaySlider = display2.toLowerCase()
|
|
5830
|
+
const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display2.toLowerCase());
|
|
5631
5831
|
if (!isDisplaySlider)
|
|
5632
5832
|
return;
|
|
5633
5833
|
return value;
|
|
@@ -6222,7 +6422,12 @@ const ResultProduct = (props) => {
|
|
|
6222
6422
|
total_result_text: language_total_result_text
|
|
6223
6423
|
} = languageSettings || {};
|
|
6224
6424
|
const { separator: hierarchical_separator, hiddens: hierarchical_hiddens } = hierarchicalProductTypeSettings || {};
|
|
6225
|
-
const {
|
|
6425
|
+
const {
|
|
6426
|
+
separator: hierarchical_collections_separator,
|
|
6427
|
+
hiddens: hierarchical_collections_hiddens,
|
|
6428
|
+
hidden_ids: hierarchical_collections_hidden_ids,
|
|
6429
|
+
structure: hierarchical_collections_structure
|
|
6430
|
+
} = hierarchicalCollectionsSettings || {};
|
|
6226
6431
|
const { money_format } = generalDataSettings || {};
|
|
6227
6432
|
const { button_load_more, button_loading, mobile_sort_placeholder } = (generalDataSettings == null ? void 0 : generalDataSettings.languages) || {};
|
|
6228
6433
|
const summaryTextGenerator = (totalResult) => {
|
|
@@ -6569,8 +6774,20 @@ const ResultProduct = (props) => {
|
|
|
6569
6774
|
if ((_a2 = filter == null ? void 0 : filter.settings) == null ? void 0 : _a2.keep_counter)
|
|
6570
6775
|
keepCounterFacets.push(filter == null ? void 0 : filter.value);
|
|
6571
6776
|
});
|
|
6572
|
-
const facetBlockSelected = ({ label, name, value, index }) => {
|
|
6573
|
-
var _a2, _b2, _c2, _d2;
|
|
6777
|
+
const facetBlockSelected = ({ label, name, value: valueProp, index }) => {
|
|
6778
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
6779
|
+
let value = valueProp;
|
|
6780
|
+
if (name === HIERARCHICAL_FACET_OBJECT_ALIASES.collections) {
|
|
6781
|
+
if ((_a2 = String(value)) == null ? void 0 : _a2.includes(hierarchical_collections_separator)) {
|
|
6782
|
+
let arrValue = String(value).split(hierarchical_collections_separator);
|
|
6783
|
+
value = (arrValue == null ? void 0 : arrValue.length) ? arrValue.map((item) => {
|
|
6784
|
+
var _a3;
|
|
6785
|
+
return ((_a3 = parseFacetObject({ facet: item })) == null ? void 0 : _a3.collection_title) || item;
|
|
6786
|
+
}).join(hierarchical_collections_separator) : valueProp;
|
|
6787
|
+
} else {
|
|
6788
|
+
value = ((_b2 = parseFacetObject({ facet: valueProp })) == null ? void 0 : _b2.collection_title) || valueProp;
|
|
6789
|
+
}
|
|
6790
|
+
}
|
|
6574
6791
|
let valueText = (languageSettings == null ? void 0 : languageSettings[value]) || value;
|
|
6575
6792
|
let isRange = allowedFilterSlider == null ? void 0 : allowedFilterSlider.includes(name);
|
|
6576
6793
|
let getLabel = label;
|
|
@@ -6591,29 +6808,29 @@ const ResultProduct = (props) => {
|
|
|
6591
6808
|
}
|
|
6592
6809
|
});
|
|
6593
6810
|
}
|
|
6594
|
-
(
|
|
6811
|
+
(_c2 = getSettings == null ? void 0 : getSettings.delete_prefix) == null ? void 0 : _c2.map((deletePrefix) => {
|
|
6595
6812
|
if (String(valueText).startsWith(deletePrefix))
|
|
6596
6813
|
valueText = String(valueText).replace(deletePrefix, "");
|
|
6597
6814
|
});
|
|
6598
6815
|
if (isRange) {
|
|
6599
6816
|
const getValueRange = new Set(value).size === 1 ? [value[0]] : value;
|
|
6600
|
-
valueText = (
|
|
6817
|
+
valueText = (_d2 = getValueRange == null ? void 0 : getValueRange.map((valueItem) => isPriceValue ? shopifyFormatMoney(valueItem * 100, money_format) : isSalePercent ? `${valueItem}%` : valueItem)) == null ? void 0 : _d2.join(" - ");
|
|
6601
6818
|
} else {
|
|
6602
|
-
valueText = (
|
|
6819
|
+
valueText = (_e2 = String(valueText)) == null ? void 0 : _e2.replaceAll(hierarchical_collections_separator, " > ");
|
|
6603
6820
|
}
|
|
6604
|
-
valueText = (
|
|
6821
|
+
valueText = (_f2 = String(valueText)) == null ? void 0 : _f2.replaceAll("_", " ");
|
|
6605
6822
|
let aliases = {};
|
|
6606
6823
|
let aliasValue = "";
|
|
6607
6824
|
let aliasSeparator = "";
|
|
6608
|
-
if (name ===
|
|
6825
|
+
if (name === HIERARCHICAL_FACET_OBJECT_ALIASES.collections) {
|
|
6609
6826
|
aliases = settings.collectionAliases || {};
|
|
6610
6827
|
aliasSeparator = hierarchicalCollectionsSettings.separator;
|
|
6611
6828
|
}
|
|
6612
|
-
if (name ===
|
|
6829
|
+
if (name === HIERARCHICAL_FACET_OBJECT_ALIASES.product_type) {
|
|
6613
6830
|
aliases = settings.productTypeAliases || {};
|
|
6614
6831
|
aliasSeparator = hierarchicalProductTypeSettings.separator;
|
|
6615
6832
|
}
|
|
6616
|
-
if ([
|
|
6833
|
+
if ([HIERARCHICAL_FACET_OBJECT_ALIASES.collections, HIERARCHICAL_FACET_OBJECT_ALIASES.product_type].includes(name) && aliasSeparator) {
|
|
6617
6834
|
const splitedValues = value.split(aliasSeparator);
|
|
6618
6835
|
let newSplitedValues = [];
|
|
6619
6836
|
for (const splitedValue of splitedValues) {
|
|
@@ -6650,6 +6867,7 @@ const ResultProduct = (props) => {
|
|
|
6650
6867
|
}) => {
|
|
6651
6868
|
var _a2, _b2;
|
|
6652
6869
|
const { value, display, indexFilter } = filter;
|
|
6870
|
+
const isDisplaySlider = ["slider", "input_range", "slider_with_input_range"].includes(display.toLowerCase());
|
|
6653
6871
|
let items = display.toLowerCase() === "tree" ? createHierarchicalFacet({
|
|
6654
6872
|
indexValue: value,
|
|
6655
6873
|
filter,
|
|
@@ -6661,10 +6879,11 @@ const ResultProduct = (props) => {
|
|
|
6661
6879
|
hiddensCollection: hierarchical_collections_hiddens,
|
|
6662
6880
|
displaySettings,
|
|
6663
6881
|
searchFacetDistribution,
|
|
6664
|
-
hierarchicalFacetAliases
|
|
6882
|
+
hierarchicalFacetAliases,
|
|
6883
|
+
hierarchicalCollectionsSettings
|
|
6665
6884
|
}) : searchResultFacets[value];
|
|
6666
6885
|
let isRender = Boolean(
|
|
6667
|
-
|
|
6886
|
+
isDisplaySlider ? items : Number(
|
|
6668
6887
|
(_a2 = handleFacetValues({
|
|
6669
6888
|
filter,
|
|
6670
6889
|
languageSettings,
|
|
@@ -6677,7 +6896,7 @@ const ResultProduct = (props) => {
|
|
|
6677
6896
|
})) == null ? void 0 : _a2.length
|
|
6678
6897
|
)
|
|
6679
6898
|
);
|
|
6680
|
-
if (
|
|
6899
|
+
if (isDisplaySlider) {
|
|
6681
6900
|
let defaultItemSlider = (defaultFacetStats == null ? void 0 : defaultFacetStats[value]) && Object.keys(defaultFacetStats[value]).length ? defaultFacetStats[value] : {};
|
|
6682
6901
|
let valueFilterSliderChange = [];
|
|
6683
6902
|
if (value === "variants.price") {
|