@sledge-app/react-instant-search 1.0.37 → 1.0.39
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/SearchResultWidget.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 +225 -148
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -504,27 +504,20 @@ const Checkbox = ({ id, name, value, required, label, checked, labelStyle = {},
|
|
|
504
504
|
};
|
|
505
505
|
const Slider$1 = "";
|
|
506
506
|
const Slider = (props) => {
|
|
507
|
-
const {
|
|
508
|
-
const [value, setValue] = React__default.useState(defaultValue);
|
|
507
|
+
const { value, min, max, step = 1, setValueCommit, setValueChange } = props;
|
|
509
508
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
510
509
|
$faa2e61a3361514f$export$be92b6f5f03c0fe9,
|
|
511
510
|
{
|
|
512
511
|
className: "sledge__SliderRoot",
|
|
513
|
-
|
|
512
|
+
value,
|
|
514
513
|
...typeof min !== "undefined" ? {
|
|
515
514
|
min
|
|
516
515
|
} : {},
|
|
517
516
|
max,
|
|
518
517
|
step,
|
|
519
518
|
"aria-label": "Volume",
|
|
520
|
-
onValueCommit: (valueCommit) =>
|
|
521
|
-
|
|
522
|
-
setValue(valueCommit);
|
|
523
|
-
},
|
|
524
|
-
onValueChange: (valueChange) => {
|
|
525
|
-
setValueChange && setValueChange(valueChange);
|
|
526
|
-
setValue(valueChange);
|
|
527
|
-
},
|
|
519
|
+
onValueCommit: (valueCommit) => setValueCommit == null ? void 0 : setValueCommit(valueCommit),
|
|
520
|
+
onValueChange: (valueChange) => setValueChange == null ? void 0 : setValueChange(valueChange),
|
|
528
521
|
children: [
|
|
529
522
|
/* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$13921ac0cc260818, { className: "sledge__SliderTrack", children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$9a58ef0d7ad3278c, { className: "sledge__SliderRange" }) }),
|
|
530
523
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -536,7 +529,7 @@ const Slider = (props) => {
|
|
|
536
529
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb" })
|
|
537
530
|
}
|
|
538
531
|
),
|
|
539
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
532
|
+
!value[1] ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
540
533
|
Tooltip,
|
|
541
534
|
{
|
|
542
535
|
content: value[1],
|
|
@@ -1043,7 +1036,7 @@ const checkWishlist = async (id, variantId) => {
|
|
|
1043
1036
|
return;
|
|
1044
1037
|
});
|
|
1045
1038
|
};
|
|
1046
|
-
const addToCartTrigger$
|
|
1039
|
+
const addToCartTrigger$2 = async (data) => {
|
|
1047
1040
|
const { productId } = data;
|
|
1048
1041
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
1049
1042
|
let url = `${API_URL}/wishlist/cart`;
|
|
@@ -2341,7 +2334,7 @@ const searchTrigger = async (data) => {
|
|
|
2341
2334
|
return;
|
|
2342
2335
|
});
|
|
2343
2336
|
};
|
|
2344
|
-
const productClickTrigger = async (data) => {
|
|
2337
|
+
const productClickTrigger$1 = async (data) => {
|
|
2345
2338
|
const { productId } = data;
|
|
2346
2339
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2347
2340
|
let url = `${API_URL}/instantsearch/statistics/click`;
|
|
@@ -2366,7 +2359,7 @@ const productClickTrigger = async (data) => {
|
|
|
2366
2359
|
return;
|
|
2367
2360
|
});
|
|
2368
2361
|
};
|
|
2369
|
-
const addToCartTrigger = async (data) => {
|
|
2362
|
+
const addToCartTrigger$1 = async (data) => {
|
|
2370
2363
|
const { productId } = data;
|
|
2371
2364
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2372
2365
|
let url = `${API_URL}/instantsearch/statistics/cart`;
|
|
@@ -2391,6 +2384,55 @@ const addToCartTrigger = async (data) => {
|
|
|
2391
2384
|
return;
|
|
2392
2385
|
});
|
|
2393
2386
|
};
|
|
2387
|
+
const productRecommendationSourceApps = ["recently-viewed", "related-product", "hand-picked", "new-arrival", "personalized-curated"];
|
|
2388
|
+
const productClickTrigger = async (data) => {
|
|
2389
|
+
const { productId, sourceApp } = data;
|
|
2390
|
+
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2391
|
+
let url = `${API_URL}/product-recommendation/statistics/click`;
|
|
2392
|
+
let headers = {
|
|
2393
|
+
"Content-Type": "application/json"
|
|
2394
|
+
};
|
|
2395
|
+
let payload = {
|
|
2396
|
+
product_id: sanitizeDataId(productId),
|
|
2397
|
+
widget: sourceApp
|
|
2398
|
+
};
|
|
2399
|
+
return await fetchApi({
|
|
2400
|
+
url,
|
|
2401
|
+
method: "POST",
|
|
2402
|
+
authorization: sledgeAuthApp,
|
|
2403
|
+
payload,
|
|
2404
|
+
headers,
|
|
2405
|
+
isSimpleRequest: false
|
|
2406
|
+
}).then((result) => {
|
|
2407
|
+
return result;
|
|
2408
|
+
}).catch(() => {
|
|
2409
|
+
return;
|
|
2410
|
+
});
|
|
2411
|
+
};
|
|
2412
|
+
const addToCartTrigger = async (data) => {
|
|
2413
|
+
const { productId, sourceApp } = data;
|
|
2414
|
+
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2415
|
+
let url = `${API_URL}/product-recommendation/statistics/cart`;
|
|
2416
|
+
let headers = {
|
|
2417
|
+
"Content-Type": "application/json"
|
|
2418
|
+
};
|
|
2419
|
+
let payload = {
|
|
2420
|
+
product_id: sanitizeDataId(productId),
|
|
2421
|
+
widget: sourceApp
|
|
2422
|
+
};
|
|
2423
|
+
return await fetchApi({
|
|
2424
|
+
url,
|
|
2425
|
+
method: "POST",
|
|
2426
|
+
authorization: sledgeAuthApp,
|
|
2427
|
+
payload,
|
|
2428
|
+
headers,
|
|
2429
|
+
isSimpleRequest: false
|
|
2430
|
+
}).then((result) => {
|
|
2431
|
+
return result;
|
|
2432
|
+
}).catch(() => {
|
|
2433
|
+
return;
|
|
2434
|
+
});
|
|
2435
|
+
};
|
|
2394
2436
|
const ProductCard = (props) => {
|
|
2395
2437
|
var _a, _b, _c;
|
|
2396
2438
|
const {
|
|
@@ -2536,9 +2578,18 @@ const ProductCard = (props) => {
|
|
|
2536
2578
|
"a",
|
|
2537
2579
|
{
|
|
2538
2580
|
href: url,
|
|
2539
|
-
onClick: () =>
|
|
2540
|
-
|
|
2541
|
-
|
|
2581
|
+
onClick: () => {
|
|
2582
|
+
if (sourceApp === "instant-search") {
|
|
2583
|
+
productClickTrigger$1({
|
|
2584
|
+
productId: id
|
|
2585
|
+
});
|
|
2586
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2587
|
+
productClickTrigger({
|
|
2588
|
+
productId: id,
|
|
2589
|
+
sourceApp
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
},
|
|
2542
2593
|
className: "sledge__product-grid-card-image-link",
|
|
2543
2594
|
children: [
|
|
2544
2595
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -2562,7 +2613,21 @@ const ProductCard = (props) => {
|
|
|
2562
2613
|
wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
|
|
2563
2614
|
}
|
|
2564
2615
|
),
|
|
2565
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2616
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2617
|
+
"img",
|
|
2618
|
+
{
|
|
2619
|
+
src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
|
|
2620
|
+
alt: "sledge-card-image",
|
|
2621
|
+
loading: "lazy",
|
|
2622
|
+
className: "sledge__product-grid-card-image-featured-image",
|
|
2623
|
+
onError: ({ currentTarget }) => {
|
|
2624
|
+
if (!currentTarget)
|
|
2625
|
+
return;
|
|
2626
|
+
currentTarget.onerror = null;
|
|
2627
|
+
currentTarget.src = `${CDN_URL}/images/blank-image.png`;
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
),
|
|
2566
2631
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: images == null ? void 0 : images.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2567
2632
|
"img",
|
|
2568
2633
|
{
|
|
@@ -2609,9 +2674,18 @@ const ProductCard = (props) => {
|
|
|
2609
2674
|
"a",
|
|
2610
2675
|
{
|
|
2611
2676
|
href: url,
|
|
2612
|
-
onClick: () =>
|
|
2613
|
-
|
|
2614
|
-
|
|
2677
|
+
onClick: () => {
|
|
2678
|
+
if (sourceApp === "instant-search") {
|
|
2679
|
+
productClickTrigger$1({
|
|
2680
|
+
productId: id
|
|
2681
|
+
});
|
|
2682
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2683
|
+
productClickTrigger({
|
|
2684
|
+
productId: id,
|
|
2685
|
+
sourceApp
|
|
2686
|
+
});
|
|
2687
|
+
}
|
|
2688
|
+
},
|
|
2615
2689
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name", style: display_product_name_style, children: title })
|
|
2616
2690
|
}
|
|
2617
2691
|
) : null,
|
|
@@ -2716,13 +2790,18 @@ const ProductGrid = (props) => {
|
|
|
2716
2790
|
]);
|
|
2717
2791
|
if ((_a = resShopifyAddToCart == null ? void 0 : resShopifyAddToCart.items) == null ? void 0 : _a.length) {
|
|
2718
2792
|
if (sourceApp === "wishlist") {
|
|
2719
|
-
await addToCartTrigger$
|
|
2793
|
+
await addToCartTrigger$2({
|
|
2720
2794
|
productId: id
|
|
2721
2795
|
});
|
|
2722
2796
|
} else if (sourceApp === "instant-search") {
|
|
2723
|
-
await addToCartTrigger({
|
|
2797
|
+
await addToCartTrigger$1({
|
|
2724
2798
|
productId: id
|
|
2725
2799
|
});
|
|
2800
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2801
|
+
await addToCartTrigger({
|
|
2802
|
+
productId: id,
|
|
2803
|
+
sourceApp
|
|
2804
|
+
});
|
|
2726
2805
|
}
|
|
2727
2806
|
setClickedAddToCartId(null);
|
|
2728
2807
|
onAfterAddToCart && onAfterAddToCart("success");
|
|
@@ -3811,9 +3890,9 @@ const SearchResultWidget = (props) => {
|
|
|
3811
3890
|
const [languageSettings, setLanguageSettings] = React__default.useState(((_j = sledgeSettings == null ? void 0 : sledgeSettings.instantsearch) == null ? void 0 : _j.languages) || {});
|
|
3812
3891
|
const [initStatesFirstTime, setInitStatesFirstTime] = React__default.useState(true);
|
|
3813
3892
|
const [defaultFacetStats, setDefaultFacetStats] = React__default.useState({});
|
|
3814
|
-
const [defaultFacetDistribution, setDefaultFacetDistribution] = React__default.useState({});
|
|
3815
3893
|
const [hideFilterWhenOneValue, setHideFilterWhenOneValue] = React__default.useState(false);
|
|
3816
3894
|
const [isReplaceWidgetList, setIsReplaceWidgetList] = React__default.useState(false);
|
|
3895
|
+
const [searchResultFacets, setSearchResultFacets] = React__default.useState({});
|
|
3817
3896
|
let productCardsComponent = null;
|
|
3818
3897
|
let collectionCardsComponent = null;
|
|
3819
3898
|
let pageCardsComponent = null;
|
|
@@ -3914,8 +3993,32 @@ const SearchResultWidget = (props) => {
|
|
|
3914
3993
|
} else {
|
|
3915
3994
|
const { facetStats, totalHits, facetDistribution } = (results == null ? void 0 : results.find(({ indexUid }) => indexUid.includes(index_product))) || {};
|
|
3916
3995
|
setDefaultFacetStats(facetStats);
|
|
3917
|
-
setDefaultFacetDistribution(facetDistribution);
|
|
3918
3996
|
setHideFilterWhenOneValue(((_a2 = display == null ? void 0 : display.filter) == null ? void 0 : _a2.hide_when_one_value) && totalHits <= 1);
|
|
3997
|
+
setSearchResultFacets(
|
|
3998
|
+
facetDistribution ? Object.fromEntries(
|
|
3999
|
+
Object.entries(facetDistribution).map((facet) => {
|
|
4000
|
+
let value = facet[0];
|
|
4001
|
+
let items = [];
|
|
4002
|
+
if (value === "variants.inventory_quantity") {
|
|
4003
|
+
items = [
|
|
4004
|
+
{
|
|
4005
|
+
name: "In Stock",
|
|
4006
|
+
value: "> 0"
|
|
4007
|
+
}
|
|
4008
|
+
];
|
|
4009
|
+
} else {
|
|
4010
|
+
items = Object.keys(facetDistribution[value]).map((item) => {
|
|
4011
|
+
return {
|
|
4012
|
+
name: item,
|
|
4013
|
+
value: item,
|
|
4014
|
+
total: facetDistribution[value][item] || 0
|
|
4015
|
+
};
|
|
4016
|
+
});
|
|
4017
|
+
}
|
|
4018
|
+
return [value, items];
|
|
4019
|
+
})
|
|
4020
|
+
) : {}
|
|
4021
|
+
);
|
|
3919
4022
|
}
|
|
3920
4023
|
};
|
|
3921
4024
|
const handleSettings = async (LOCAL_STORAGE_INSTANT_SEARCH_SETTING) => {
|
|
@@ -4265,7 +4368,6 @@ const SearchResultWidget = (props) => {
|
|
|
4265
4368
|
allowedFilters,
|
|
4266
4369
|
facets,
|
|
4267
4370
|
defaultFacetStats,
|
|
4268
|
-
defaultFacetDistribution,
|
|
4269
4371
|
hideFilterWhenOneValue,
|
|
4270
4372
|
hiddenTags,
|
|
4271
4373
|
displaySettings,
|
|
@@ -4303,12 +4405,13 @@ const SearchResultWidget = (props) => {
|
|
|
4303
4405
|
data: propsData,
|
|
4304
4406
|
settings,
|
|
4305
4407
|
isReplaceWidgetList,
|
|
4306
|
-
setIsReplaceWidgetList
|
|
4408
|
+
setIsReplaceWidgetList,
|
|
4409
|
+
searchResultFacets
|
|
4307
4410
|
})
|
|
4308
4411
|
] });
|
|
4309
4412
|
};
|
|
4310
4413
|
const ResultProduct = (props) => {
|
|
4311
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A
|
|
4414
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
4312
4415
|
const {
|
|
4313
4416
|
layoutType,
|
|
4314
4417
|
keyword,
|
|
@@ -4318,7 +4421,6 @@ const ResultProduct = (props) => {
|
|
|
4318
4421
|
allowedFilters,
|
|
4319
4422
|
facets,
|
|
4320
4423
|
defaultFacetStats,
|
|
4321
|
-
defaultFacetDistribution,
|
|
4322
4424
|
hideFilterWhenOneValue,
|
|
4323
4425
|
hiddenTags,
|
|
4324
4426
|
displaySettings,
|
|
@@ -4347,17 +4449,15 @@ const ResultProduct = (props) => {
|
|
|
4347
4449
|
data: propsData,
|
|
4348
4450
|
settings,
|
|
4349
4451
|
isReplaceWidgetList,
|
|
4350
|
-
setIsReplaceWidgetList
|
|
4452
|
+
setIsReplaceWidgetList,
|
|
4453
|
+
searchResultFacets
|
|
4351
4454
|
} = props || {};
|
|
4352
4455
|
const queryKeyword = (query == null ? void 0 : query.keyword) ? query.keyword : DEFAULT_QUERY_PARAM.KEYWORD;
|
|
4353
4456
|
const { collectionId, collectionName } = params || {};
|
|
4354
4457
|
const [isFirstLoading, setIsFirstLoading] = React__default.useState(!propsData);
|
|
4355
4458
|
const [isLoading, setIsLoading] = React__default.useState(!propsData);
|
|
4356
|
-
const [isOpenSort, setIsOpenSort] = React__default.useState(false);
|
|
4357
|
-
const [isOpenLimit, setIsOpenLimit] = React__default.useState(false);
|
|
4358
4459
|
const [clickedSortId, setClickedSortId] = React__default.useState(defaultSort || "");
|
|
4359
|
-
const [
|
|
4360
|
-
const [clickedLimitId, setClickedLimitId] = React__default.useState(((_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.limit) || 10);
|
|
4460
|
+
const [clickedLimitId, setClickedLimitId] = React__default.useState(((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.limit) || 10);
|
|
4361
4461
|
const [clickedOpenFilterId, setClickedOpenFilterId] = React__default.useState(null);
|
|
4362
4462
|
const [clickedOpenFilters, setClickedOpenFilters] = React__default.useState([]);
|
|
4363
4463
|
const [clickedFacets, setClickedFacets] = React__default.useState({
|
|
@@ -4366,16 +4466,15 @@ const ResultProduct = (props) => {
|
|
|
4366
4466
|
} : {}
|
|
4367
4467
|
});
|
|
4368
4468
|
const [triggerClickedFacets, setTriggerClickedFacets] = React__default.useState(false);
|
|
4369
|
-
const [searchResult, setSearchResult] = React__default.useState(((
|
|
4469
|
+
const [searchResult, setSearchResult] = React__default.useState(((_d = (_c = (_b = propsData == null ? void 0 : propsData.result) == null ? void 0 : _b.results) == null ? void 0 : _c[0]) == null ? void 0 : _d.hits) || []);
|
|
4370
4470
|
const [searchProcessingTimeMs, setSearchProcessingTimeMs] = React__default.useState(0);
|
|
4371
4471
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
4372
4472
|
const [totalPage, setTotalPage] = React__default.useState(0);
|
|
4373
|
-
const [totalSearchResult, setTotalSearchResult] = React__default.useState(((
|
|
4473
|
+
const [totalSearchResult, setTotalSearchResult] = React__default.useState(((_g = (_f = (_e = propsData == null ? void 0 : propsData.result) == null ? void 0 : _e.results) == null ? void 0 : _f[0]) == null ? void 0 : _g.totalHits) || 0);
|
|
4374
4474
|
const [valueFilterPriceChange, setValueFilterPriceChange] = React__default.useState([]);
|
|
4375
4475
|
const [allowedFilter, setAllowedFilter] = React__default.useState([]);
|
|
4376
|
-
const [isFilterChanged, setIsFilterChanged] = React__default.useState(false);
|
|
4377
4476
|
const [handleSearchResultFirstTime, setHandleSearchResultFirstTime] = React__default.useState(true);
|
|
4378
|
-
const [
|
|
4477
|
+
const [searchFacetDistribution, setSearchFacetDistribution] = React__default.useState({});
|
|
4379
4478
|
const {
|
|
4380
4479
|
sort_by: language_sort_by,
|
|
4381
4480
|
result: language_result,
|
|
@@ -4414,13 +4513,13 @@ const ResultProduct = (props) => {
|
|
|
4414
4513
|
};
|
|
4415
4514
|
const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator(totalSearchResult) : null);
|
|
4416
4515
|
const previousState = usePrevious({ keyword, clickedLimitId, clickedFacets, clickedTabIndexId });
|
|
4417
|
-
const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((
|
|
4516
|
+
const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((_h = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _h.title) || {};
|
|
4418
4517
|
const {
|
|
4419
4518
|
color: filter_option_color,
|
|
4420
4519
|
font_size: filter_option_font_size,
|
|
4421
4520
|
font_weight: filter_option_font_weight,
|
|
4422
4521
|
text_transform: filter_option_text_transform
|
|
4423
|
-
} = ((
|
|
4522
|
+
} = ((_i = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _i.option) || {};
|
|
4424
4523
|
const {
|
|
4425
4524
|
text_color: filter_button_text_color,
|
|
4426
4525
|
border_color: filter_button_border_color,
|
|
@@ -4433,7 +4532,7 @@ const ResultProduct = (props) => {
|
|
|
4433
4532
|
font_size: filter_button_font_size,
|
|
4434
4533
|
font_weight: filter_button_font_weight,
|
|
4435
4534
|
text_transform: filter_button_text_transform
|
|
4436
|
-
} = ((
|
|
4535
|
+
} = ((_j = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _j.button) || {};
|
|
4437
4536
|
const filter_title_style = {
|
|
4438
4537
|
...filter_title_color && { color: filter_title_color },
|
|
4439
4538
|
...filter_title_font_size && { fontSize: filter_title_font_size },
|
|
@@ -4496,12 +4595,9 @@ const ResultProduct = (props) => {
|
|
|
4496
4595
|
window.history.pushState(null, "", `${document.location.pathname}${(newQueryString == null ? void 0 : newQueryString.length) ? `?${newQueryString}` : ""}`);
|
|
4497
4596
|
};
|
|
4498
4597
|
const handleChangeSort = (label, value) => {
|
|
4499
|
-
setIsOpenSort(false);
|
|
4500
|
-
setClickedSortName(label);
|
|
4501
4598
|
setClickedSortId(value);
|
|
4502
4599
|
};
|
|
4503
4600
|
const handleChangeLimit = (value) => {
|
|
4504
|
-
setIsOpenLimit(false);
|
|
4505
4601
|
setClickedLimitId(value);
|
|
4506
4602
|
};
|
|
4507
4603
|
const handleOpenFilterVertical = (id) => {
|
|
@@ -4517,18 +4613,13 @@ const ResultProduct = (props) => {
|
|
|
4517
4613
|
setClickedOpenFilters(valueClickedOpenFilters);
|
|
4518
4614
|
};
|
|
4519
4615
|
const handleFilterReset = () => {
|
|
4520
|
-
setIsFilterChanged(true);
|
|
4521
4616
|
setClickedFacets({});
|
|
4522
4617
|
setTriggerClickedFacets(!triggerClickedFacets);
|
|
4523
4618
|
handleQueryStringFilter({});
|
|
4524
4619
|
setValueFilterPriceChange([]);
|
|
4525
|
-
setTimeout(() => {
|
|
4526
|
-
setIsFilterChanged(false);
|
|
4527
|
-
}, 10);
|
|
4528
4620
|
};
|
|
4529
4621
|
const handleFilterChange = (parentId, value, force = false) => {
|
|
4530
4622
|
var _a2;
|
|
4531
|
-
setIsFilterChanged(true);
|
|
4532
4623
|
let facets2 = [value];
|
|
4533
4624
|
let isRange = ["variants.price"].includes(parentId);
|
|
4534
4625
|
if (clickedFacets) {
|
|
@@ -4560,9 +4651,6 @@ const ResultProduct = (props) => {
|
|
|
4560
4651
|
handleQueryStringFilter(valueClickedFacets);
|
|
4561
4652
|
setClickedFacets(valueClickedFacets);
|
|
4562
4653
|
setTriggerClickedFacets(!triggerClickedFacets);
|
|
4563
|
-
setTimeout(() => {
|
|
4564
|
-
setIsFilterChanged(false);
|
|
4565
|
-
}, 10);
|
|
4566
4654
|
};
|
|
4567
4655
|
const handleSearchResultData = (result, onSearch) => {
|
|
4568
4656
|
if (!result)
|
|
@@ -4582,34 +4670,7 @@ const ResultProduct = (props) => {
|
|
|
4582
4670
|
setTotalPage(totalPages);
|
|
4583
4671
|
setTotalSearchResult(totalHits || 0);
|
|
4584
4672
|
setSummaryText(summaryTextGenerator(totalHits));
|
|
4585
|
-
|
|
4586
|
-
defaultFacetDistribution ? Object.fromEntries(
|
|
4587
|
-
Object.entries(defaultFacetDistribution).map((facet) => {
|
|
4588
|
-
let value = facet[0];
|
|
4589
|
-
let items = [];
|
|
4590
|
-
if (value === "variants.inventory_quantity") {
|
|
4591
|
-
Object.keys(defaultFacetDistribution[value]).map((item) => {
|
|
4592
|
-
return Boolean(Number(item)) ? defaultFacetDistribution[value][item] : 0;
|
|
4593
|
-
});
|
|
4594
|
-
items = [
|
|
4595
|
-
{
|
|
4596
|
-
name: "In Stock",
|
|
4597
|
-
value: "> 0"
|
|
4598
|
-
}
|
|
4599
|
-
];
|
|
4600
|
-
} else {
|
|
4601
|
-
items = Object.keys(defaultFacetDistribution[value]).map((item) => {
|
|
4602
|
-
return {
|
|
4603
|
-
name: item,
|
|
4604
|
-
value: item,
|
|
4605
|
-
total: facetDistribution[value][item] || 0
|
|
4606
|
-
};
|
|
4607
|
-
});
|
|
4608
|
-
}
|
|
4609
|
-
return [value, items];
|
|
4610
|
-
})
|
|
4611
|
-
) : {}
|
|
4612
|
-
);
|
|
4673
|
+
setSearchFacetDistribution(facetDistribution);
|
|
4613
4674
|
};
|
|
4614
4675
|
const handleSearchResult = async (isRefreshPage = false, onSearch = false) => {
|
|
4615
4676
|
var _a2, _b2;
|
|
@@ -4715,6 +4776,37 @@ const ResultProduct = (props) => {
|
|
|
4715
4776
|
React__default.useEffect(() => {
|
|
4716
4777
|
handleAllowedFilter();
|
|
4717
4778
|
}, [allowedFilters, searchResultFacets, totalSearchResult]);
|
|
4779
|
+
let dataClickedFacets = [];
|
|
4780
|
+
let arrFacetSelected = [];
|
|
4781
|
+
Object.entries(clickedFacets).map((facet) => {
|
|
4782
|
+
var _a2, _b2;
|
|
4783
|
+
if ((facet == null ? void 0 : facet.length) && facet[1].length) {
|
|
4784
|
+
arrFacetSelected.push(facet[0]);
|
|
4785
|
+
let getName = facet[0];
|
|
4786
|
+
let isAdditionalFilter = ["variants.inventory_quantity"].includes(getName);
|
|
4787
|
+
if (isAdditionalFilter)
|
|
4788
|
+
return;
|
|
4789
|
+
let isRange = ["variants.price"].includes(getName);
|
|
4790
|
+
let getAllowedFilterOne = allowedFilter.filter(({ value }) => value == null ? void 0 : value.includes(getName));
|
|
4791
|
+
let getLabel = (getAllowedFilterOne == null ? void 0 : getAllowedFilterOne.length) ? getAllowedFilterOne[0].label : getName;
|
|
4792
|
+
let items = Array.isArray(facet[1]) && ((_a2 = facet[1]) == null ? void 0 : _a2.length) > 1 ? isRange ? dataClickedFacets.push({
|
|
4793
|
+
label: getLabel,
|
|
4794
|
+
name: getName,
|
|
4795
|
+
value: facet[1]
|
|
4796
|
+
}) : (_b2 = facet[1]) == null ? void 0 : _b2.map((item) => {
|
|
4797
|
+
dataClickedFacets.push({
|
|
4798
|
+
label: getLabel,
|
|
4799
|
+
name: getName,
|
|
4800
|
+
value: item
|
|
4801
|
+
});
|
|
4802
|
+
}) : dataClickedFacets.push({
|
|
4803
|
+
label: getLabel,
|
|
4804
|
+
name: getName,
|
|
4805
|
+
value: facet[1][0]
|
|
4806
|
+
});
|
|
4807
|
+
return items;
|
|
4808
|
+
}
|
|
4809
|
+
});
|
|
4718
4810
|
const facetBlockSelected = ({ label, name, value, index }) => {
|
|
4719
4811
|
var _a2;
|
|
4720
4812
|
let valueText = value;
|
|
@@ -4738,12 +4830,36 @@ const ResultProduct = (props) => {
|
|
|
4738
4830
|
) }) })
|
|
4739
4831
|
] }, index);
|
|
4740
4832
|
};
|
|
4833
|
+
const handleConditionNotUpdateFacetDistribution = (value) => {
|
|
4834
|
+
let arrPriorityFacet = ["vendor"];
|
|
4835
|
+
let isHasFacetSelected = arrFacetSelected == null ? void 0 : arrFacetSelected.length;
|
|
4836
|
+
let isNoneFacetSelected = !isHasFacetSelected;
|
|
4837
|
+
let isOnFacetSelectedOne = isHasFacetSelected && arrFacetSelected.includes(value) && isHasFacetSelected === 1;
|
|
4838
|
+
let isSelectedFacetWithPrice = arrFacetSelected.includes("variants.price");
|
|
4839
|
+
let isPriorityFacet = isHasFacetSelected && !isOnFacetSelectedOne && arrPriorityFacet.includes(value) && !isSelectedFacetWithPrice;
|
|
4840
|
+
return isNoneFacetSelected || isOnFacetSelectedOne || isPriorityFacet;
|
|
4841
|
+
};
|
|
4741
4842
|
const facetComponent = (filter) => {
|
|
4742
4843
|
var _a2, _b2;
|
|
4743
4844
|
const { value, label, display } = filter;
|
|
4845
|
+
if (isFirstLoading)
|
|
4846
|
+
return null;
|
|
4744
4847
|
let blockComponent = null;
|
|
4745
4848
|
let items = searchResultFacets[value];
|
|
4746
4849
|
let isShowNumberMatchingProduct = (_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_number_matching_product;
|
|
4850
|
+
let itemsComponent = [];
|
|
4851
|
+
if (["checkbox", "radio", "select"].includes(display.toLowerCase()))
|
|
4852
|
+
itemsComponent = items == null ? void 0 : items.map((item) => {
|
|
4853
|
+
let labelName = item.name;
|
|
4854
|
+
if (languageSettings && (languageSettings[item.value] || languageSettings[item.name]))
|
|
4855
|
+
labelName = languageSettings[item.value] || languageSettings[item.name];
|
|
4856
|
+
let counter = handleConditionNotUpdateFacetDistribution(value) ? (item == null ? void 0 : item.total) || 0 : searchFacetDistribution[value] && searchFacetDistribution[value][item.value] ? searchFacetDistribution[value][item.value] : 0;
|
|
4857
|
+
return {
|
|
4858
|
+
...item,
|
|
4859
|
+
labelName,
|
|
4860
|
+
counter
|
|
4861
|
+
};
|
|
4862
|
+
});
|
|
4747
4863
|
if (display.toLowerCase() === "slider") {
|
|
4748
4864
|
items = defaultFacetStats[value] && Object.keys(defaultFacetStats[value]).length ? defaultFacetStats[value] : {};
|
|
4749
4865
|
let defaultValueMin = valueFilterPriceChange[0] || (items == null ? void 0 : items.min);
|
|
@@ -4752,7 +4868,7 @@ const ResultProduct = (props) => {
|
|
|
4752
4868
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4753
4869
|
Slider,
|
|
4754
4870
|
{
|
|
4755
|
-
|
|
4871
|
+
value: defaultValueMin === defaultValueMax ? [defaultValueMax] : [defaultValueMin, defaultValueMax],
|
|
4756
4872
|
...(items == null ? void 0 : items.min) === (items == null ? void 0 : items.max) ? {} : {
|
|
4757
4873
|
min: items == null ? void 0 : items.min
|
|
4758
4874
|
},
|
|
@@ -4763,25 +4879,23 @@ const ResultProduct = (props) => {
|
|
|
4763
4879
|
}
|
|
4764
4880
|
),
|
|
4765
4881
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-list-slider-minmax", children: [
|
|
4766
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children:
|
|
4767
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children:
|
|
4882
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children: defaultValueMin }),
|
|
4883
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children: defaultValueMax })
|
|
4768
4884
|
] })
|
|
4769
4885
|
] });
|
|
4770
4886
|
} else if (display.toLowerCase() === "checkbox" && (items == null ? void 0 : items.length)) {
|
|
4771
|
-
blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children:
|
|
4887
|
+
blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: itemsComponent == null ? void 0 : itemsComponent.map((item, index) => {
|
|
4772
4888
|
var _a3;
|
|
4773
|
-
|
|
4774
|
-
if (languageSettings && (languageSettings[item.value] || languageSettings[item.name]))
|
|
4775
|
-
labelName = languageSettings[item.value] || languageSettings[item.name];
|
|
4889
|
+
const { labelName, value: itemValue, counter } = item;
|
|
4776
4890
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4777
4891
|
Checkbox,
|
|
4778
4892
|
{
|
|
4779
4893
|
id: `${value}_${index}`,
|
|
4780
4894
|
name: value,
|
|
4781
|
-
value:
|
|
4782
|
-
label: `${labelName}${
|
|
4895
|
+
value: itemValue,
|
|
4896
|
+
label: `${labelName}${counter !== void 0 && isShowNumberMatchingProduct ? ` (${counter})` : ""}`,
|
|
4783
4897
|
onClick: (e) => handleFilterChange(value, e.currentTarget.value),
|
|
4784
|
-
checked: clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(
|
|
4898
|
+
checked: Boolean(clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(itemValue))),
|
|
4785
4899
|
labelStyle: filter_option_style
|
|
4786
4900
|
}
|
|
4787
4901
|
) }, index);
|
|
@@ -4794,12 +4908,9 @@ const ResultProduct = (props) => {
|
|
|
4794
4908
|
name: value,
|
|
4795
4909
|
onValueChange: (getValue) => handleFilterChange(value, getValue, true),
|
|
4796
4910
|
items: items == null ? void 0 : items.map((item) => {
|
|
4797
|
-
const {
|
|
4798
|
-
let labelName = name;
|
|
4799
|
-
if (languageSettings && (languageSettings[value2] || languageSettings[name]))
|
|
4800
|
-
labelName = languageSettings[value2] || languageSettings[name];
|
|
4911
|
+
const { labelName, value: value2, counter } = item;
|
|
4801
4912
|
return {
|
|
4802
|
-
label: `${labelName} ${
|
|
4913
|
+
label: `${labelName} ${counter !== void 0 && isShowNumberMatchingProduct ? ` (${counter})` : ""}`,
|
|
4803
4914
|
value: value2
|
|
4804
4915
|
};
|
|
4805
4916
|
}),
|
|
@@ -4815,12 +4926,9 @@ const ResultProduct = (props) => {
|
|
|
4815
4926
|
name: value,
|
|
4816
4927
|
onValueChange: (getValue) => handleFilterChange(value, getValue, true),
|
|
4817
4928
|
items: items == null ? void 0 : items.map((item) => {
|
|
4818
|
-
const {
|
|
4819
|
-
let labelName = name;
|
|
4820
|
-
if (languageSettings && (languageSettings[value2] || languageSettings[name]))
|
|
4821
|
-
labelName = languageSettings[value2] || languageSettings[name];
|
|
4929
|
+
const { labelName, value: value2, counter } = item;
|
|
4822
4930
|
return {
|
|
4823
|
-
label: `${labelName} ${
|
|
4931
|
+
label: `${labelName} ${counter !== void 0 && isShowNumberMatchingProduct ? ` (${counter})` : ""}`,
|
|
4824
4932
|
value: value2
|
|
4825
4933
|
};
|
|
4826
4934
|
}),
|
|
@@ -4840,7 +4948,7 @@ const ResultProduct = (props) => {
|
|
|
4840
4948
|
rgb: getColorSwatch == null ? void 0 : getColorSwatch.rgb,
|
|
4841
4949
|
image: getColorSwatch == null ? void 0 : getColorSwatch.image,
|
|
4842
4950
|
onClick: (e) => handleFilterChange(value, e.currentTarget.value),
|
|
4843
|
-
defaultChecked: clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value))
|
|
4951
|
+
defaultChecked: Boolean(clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value)))
|
|
4844
4952
|
}
|
|
4845
4953
|
) }, index);
|
|
4846
4954
|
}) });
|
|
@@ -4851,7 +4959,6 @@ const ResultProduct = (props) => {
|
|
|
4851
4959
|
const { value, label, display } = filter;
|
|
4852
4960
|
let items = searchResultFacets[value];
|
|
4853
4961
|
let isRender = Boolean(display.toLowerCase() === "slider" ? items : items == null ? void 0 : items.length);
|
|
4854
|
-
let isNotRerender = ["select"].includes(display.toLowerCase()) && (items == null ? void 0 : items.length);
|
|
4855
4962
|
let classesUlElement = ["sledge-instant-search__result-filter-item-list"];
|
|
4856
4963
|
let getFacetComponent = facetComponent(filter);
|
|
4857
4964
|
if (display.toLowerCase() === "swatch" && (items == null ? void 0 : items.length)) {
|
|
@@ -4862,7 +4969,7 @@ const ResultProduct = (props) => {
|
|
|
4862
4969
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-filter-title", style: filter_title_style, children: label }),
|
|
4863
4970
|
/* @__PURE__ */ jsxRuntimeExports.jsx(motion.div, { initial: false, animate: clickedOpenFilters.includes(value) ? "open" : "closed", variants: ROTATE_FILTER_ARROW_ANIMATION, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronArrowDownIcon, { width: 15, height: 15, color: "#000000" }) })
|
|
4864
4971
|
] }),
|
|
4865
|
-
clickedOpenFilters.includes(value) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children:
|
|
4972
|
+
clickedOpenFilters.includes(value) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children: getFacetComponent })
|
|
4866
4973
|
] }, indexFilter) : null;
|
|
4867
4974
|
});
|
|
4868
4975
|
const filterHorizontalComponents = allowedFilter.map((filter, indexFilter) => {
|
|
@@ -4870,7 +4977,6 @@ const ResultProduct = (props) => {
|
|
|
4870
4977
|
let isActive = clickedOpenFilterId === value;
|
|
4871
4978
|
let items = searchResultFacets[value];
|
|
4872
4979
|
let isRender = Boolean(display.toLowerCase() === "slider" ? items : items == null ? void 0 : items.length);
|
|
4873
|
-
let isNotRerender = ["radio", "select"].includes(display.toLowerCase()) && (items == null ? void 0 : items.length);
|
|
4874
4980
|
let classesUlElement = ["sledge-instant-search__result-filter-item-list"];
|
|
4875
4981
|
let getFacetComponent = facetComponent(filter);
|
|
4876
4982
|
if (display.toLowerCase() === "swatch" && (items == null ? void 0 : items.length)) {
|
|
@@ -4892,7 +4998,7 @@ const ResultProduct = (props) => {
|
|
|
4892
4998
|
]
|
|
4893
4999
|
}
|
|
4894
5000
|
),
|
|
4895
|
-
content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-facet", children: isActive && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children:
|
|
5001
|
+
content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-facet", children: isActive && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children: getFacetComponent }) }),
|
|
4896
5002
|
withOpenState: false,
|
|
4897
5003
|
setIsOpen: (open) => setClickedOpenFilterId(!open ? "" : value),
|
|
4898
5004
|
hideCloseIcon: true,
|
|
@@ -4902,39 +5008,10 @@ const ResultProduct = (props) => {
|
|
|
4902
5008
|
}
|
|
4903
5009
|
) }, indexFilter) : null;
|
|
4904
5010
|
});
|
|
4905
|
-
let dataClickedFacets = [];
|
|
4906
|
-
Object.entries(clickedFacets).map((facet) => {
|
|
4907
|
-
var _a2, _b2;
|
|
4908
|
-
if ((facet == null ? void 0 : facet.length) && facet[1].length) {
|
|
4909
|
-
let getName = facet[0];
|
|
4910
|
-
let isAdditionalFilter = ["variants.inventory_quantity"].includes(getName);
|
|
4911
|
-
if (isAdditionalFilter)
|
|
4912
|
-
return;
|
|
4913
|
-
let isRange = ["variants.price"].includes(getName);
|
|
4914
|
-
let getAllowedFilterOne = allowedFilter.filter(({ value }) => value == null ? void 0 : value.includes(getName));
|
|
4915
|
-
let getLabel = (getAllowedFilterOne == null ? void 0 : getAllowedFilterOne.length) ? getAllowedFilterOne[0].label : getName;
|
|
4916
|
-
let items = Array.isArray(facet[1]) && ((_a2 = facet[1]) == null ? void 0 : _a2.length) > 1 ? isRange ? dataClickedFacets.push({
|
|
4917
|
-
label: getLabel,
|
|
4918
|
-
name: getName,
|
|
4919
|
-
value: facet[1]
|
|
4920
|
-
}) : (_b2 = facet[1]) == null ? void 0 : _b2.map((item) => {
|
|
4921
|
-
dataClickedFacets.push({
|
|
4922
|
-
label: getLabel,
|
|
4923
|
-
name: getName,
|
|
4924
|
-
value: item
|
|
4925
|
-
});
|
|
4926
|
-
}) : dataClickedFacets.push({
|
|
4927
|
-
label: getLabel,
|
|
4928
|
-
name: getName,
|
|
4929
|
-
value: facet[1][0]
|
|
4930
|
-
});
|
|
4931
|
-
return items;
|
|
4932
|
-
}
|
|
4933
|
-
});
|
|
4934
5011
|
const paginationComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Pagination, { currentPage, totalPage, totalResult: totalSearchResult, onChange: (page) => handlePageChange(page), pageInfo: language_pagination_info });
|
|
4935
|
-
const filterHorizontalBlockComponent = ((
|
|
5012
|
+
const filterHorizontalBlockComponent = ((_k = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _k.enable_on_search) && allowedFilter.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading && !propsData ? filterHorizontalSkeleton : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isLoadingSetting && !propsData ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-loading", children: filterHorizontalSkeleton }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-horizontal-wrapper", children: [
|
|
4936
5013
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal sledge-instant-search__result-filter-horizontal-component", children: filterHorizontalComponents }),
|
|
4937
|
-
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((
|
|
5014
|
+
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((_l = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _l.show_refine_by_block)) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-horizontal", children: [
|
|
4938
5015
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4939
5016
|
"div",
|
|
4940
5017
|
{
|
|
@@ -4955,10 +5032,10 @@ const ResultProduct = (props) => {
|
|
|
4955
5032
|
] }) : null
|
|
4956
5033
|
] }) }) }) : null;
|
|
4957
5034
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4958
|
-
((
|
|
4959
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-wrapper", "data-filter-layout": (
|
|
4960
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ((
|
|
4961
|
-
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((
|
|
5035
|
+
((_m = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _m.enable_on_search) && ((_n = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _n.layout) === "horizontal" && allowedFilter.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__hide-element-lg-on-mobile", children: filterHorizontalBlockComponent }) : null,
|
|
5036
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-wrapper", "data-filter-layout": (_o = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _o.layout, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5037
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ((_p = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _p.enable_on_search) && ((_q = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _q.layout) === "vertical" && allowedFilter.length ? isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter sledge__hide-element-lg-on-mobile", children: filterVerticalSkeleton }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter sledge__hide-element-lg-on-mobile", children: isLoadingSetting ? filterVerticalSkeleton : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5038
|
+
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((_r = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _r.show_refine_by_block)) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item", children: [
|
|
4962
5039
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-title-refine", children: [
|
|
4963
5040
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { className: "sledge-instant-search__result-filter-item-title-refine-heading", children: language_filter || "Filter" }),
|
|
4964
5041
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-filter-item-title-refine-clear", onClick: handleFilterReset, children: language_clear_filter || "Clear All" })
|
|
@@ -4978,7 +5055,7 @@ const ResultProduct = (props) => {
|
|
|
4978
5055
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-data", children: [
|
|
4979
5056
|
isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4980
5057
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__hide-element-mobile-on-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-data-keyword", children: [
|
|
4981
|
-
((
|
|
5058
|
+
((_s = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _s.show_total_products) ? summaryTextSkeleton : null,
|
|
4982
5059
|
searchFieldSkeletonComponent,
|
|
4983
5060
|
filterHorizontalSkeletonComponent,
|
|
4984
5061
|
selectOptionSkeletonComponent
|
|
@@ -4988,7 +5065,7 @@ const ResultProduct = (props) => {
|
|
|
4988
5065
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4989
5066
|
"div",
|
|
4990
5067
|
{
|
|
4991
|
-
className: `sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-horizontal ${((
|
|
5068
|
+
className: `sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-horizontal ${((_t = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _t.layout) === "horizontal" ? "" : "sledge__hide-element-mobile-on-lg"}`,
|
|
4992
5069
|
children: summaryText
|
|
4993
5070
|
}
|
|
4994
5071
|
),
|
|
@@ -5040,7 +5117,7 @@ const ResultProduct = (props) => {
|
|
|
5040
5117
|
language_limit || "Limit",
|
|
5041
5118
|
":"
|
|
5042
5119
|
] }),
|
|
5043
|
-
((
|
|
5120
|
+
((_u = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _u.allowed_limit) && Boolean((_w = (_v = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _v.allowed_limit) == null ? void 0 : _w.length) && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5044
5121
|
SelectField,
|
|
5045
5122
|
{
|
|
5046
5123
|
align: "end",
|
|
@@ -5061,7 +5138,7 @@ const ResultProduct = (props) => {
|
|
|
5061
5138
|
productGridSkeleton,
|
|
5062
5139
|
(searchResult == null ? void 0 : searchResult.length) ? paginationComponent : null
|
|
5063
5140
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5064
|
-
((
|
|
5141
|
+
((_x = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _x.layout) === "vertical" && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__hide-element-lg-on-mobile", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-vertical", children: summaryText }) }),
|
|
5065
5142
|
(searchResult == null ? void 0 : searchResult.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
5066
5143
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
5067
5144
|
ProductGrid,
|
|
@@ -5076,9 +5153,9 @@ const ResultProduct = (props) => {
|
|
|
5076
5153
|
};
|
|
5077
5154
|
}),
|
|
5078
5155
|
setting: {
|
|
5079
|
-
show_vendor: (
|
|
5080
|
-
show_sku: (
|
|
5081
|
-
show_price: (
|
|
5156
|
+
show_vendor: (_y = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _y.show_vendor,
|
|
5157
|
+
show_sku: (_z = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _z.show_sku,
|
|
5158
|
+
show_price: (_A = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _A.show_price,
|
|
5082
5159
|
language_button_add_to_cart: language_add_to_cart,
|
|
5083
5160
|
language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
|
|
5084
5161
|
},
|