@sledge-app/react-instant-search 1.0.36 → 1.0.38
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/ProductFilterWidget/ProductFilterWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/components/SearchResultWidget/SearchResultWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchWidget/SearchWidgetInitSelector.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 +528 -356
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,8 @@ const DATASET_ATTRIBUTE_KEY = {
|
|
|
40
40
|
SECTION_TITLE: "data-section-title",
|
|
41
41
|
SECTION_DESCRIPTION: "data-section-description",
|
|
42
42
|
USE_SLIDER: "data-use-slider",
|
|
43
|
+
FILL_COLOR: "data-fill-color",
|
|
44
|
+
OUTLINE_COLOR: "data-outline-color",
|
|
43
45
|
POSITION_WIDGET: "data-position-widget"
|
|
44
46
|
},
|
|
45
47
|
WISHLIST: {
|
|
@@ -54,6 +56,7 @@ const DATASET_ATTRIBUTE_KEY = {
|
|
|
54
56
|
RATING_TOTAL: "data-rating-total",
|
|
55
57
|
RATING_AVERAGE: "data-rating-average",
|
|
56
58
|
RENDER_REVIEW_PRODUCT_INFO: "data-render-review-product-info",
|
|
59
|
+
TRUST_BADGE_VARIANT: "data-trust-badge-variant",
|
|
57
60
|
SHOW_RATING_AVERAGE: "data-show-rating-average"
|
|
58
61
|
},
|
|
59
62
|
INSTANT_SEARCH: {
|
|
@@ -72,7 +75,7 @@ const DATASET_ATTRIBUTE_KEY = {
|
|
|
72
75
|
RENDER_ARTICLE_CARD: "data-render-article-card"
|
|
73
76
|
},
|
|
74
77
|
PRODUCT_RECOMMENDATION: {
|
|
75
|
-
|
|
78
|
+
DISPLAY_LIMIT: "data-display-limit",
|
|
76
79
|
HIDDEN_PRODUCT_IDS: "data-hidden-product-ids"
|
|
77
80
|
}
|
|
78
81
|
};
|
|
@@ -103,6 +106,7 @@ const INTERNAL_SELECTOR_VALUE = {
|
|
|
103
106
|
PRODUCT_REVIEW: {
|
|
104
107
|
ELEMENT_WIDGET_POPUP_DETAIL: "product-review-widget-popup-detail",
|
|
105
108
|
ELEMENT_WIDGET_FORM_ADD: "product-review-widget-form-add",
|
|
109
|
+
ELEMENT_STICKY_BADGE: "product-review-sticky-badge",
|
|
106
110
|
ELEMENT_HAPPY_CUSTOMERS_PAGE_POPUP: "product-review-happy-customers-page-popup"
|
|
107
111
|
},
|
|
108
112
|
INSTANT_SEARCH: {
|
|
@@ -124,7 +128,9 @@ const SELECTOR = {
|
|
|
124
128
|
ELEMENT_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-widget"]`,
|
|
125
129
|
ELEMENT_HAPPY_CUSTOMERS_PAGE: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-happy-customers-page"]`,
|
|
126
130
|
ELEMENT_RATING: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-rating"]`,
|
|
127
|
-
|
|
131
|
+
ELEMENT_TRUST_BADGE: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-trust-badge"]`,
|
|
132
|
+
ELEMENT_STICKY_SIDEBAR_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-sticky-sidebar-widget"]`,
|
|
133
|
+
ELEMENT_SNIPPET: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-snippet"]`
|
|
128
134
|
},
|
|
129
135
|
INSTANT_SEARCH: {
|
|
130
136
|
ELEMENT_SEARCH_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-widget"]`,
|
|
@@ -133,7 +139,8 @@ const SELECTOR = {
|
|
|
133
139
|
ELEMENT_PLP_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-product-filter-widget"]`
|
|
134
140
|
},
|
|
135
141
|
PRODUCT_RECOMMENDATION: {
|
|
136
|
-
|
|
142
|
+
ELEMENT_RECENTLY_VIEWED: `[${SELECTOR_ATTRIBUTE_KEY}="product-recommendation-recently-viewed"]`,
|
|
143
|
+
ELEMENT_RELATED_PRODUCTS: `[${SELECTOR_ATTRIBUTE_KEY}="product-recommendation-related-prodcuts"]`
|
|
137
144
|
}
|
|
138
145
|
};
|
|
139
146
|
const DEFAULT_MAX_WIDTH_COMPONENT = "1180px";
|
|
@@ -151,7 +158,9 @@ const OBJECT_DATA_STRING_KEY = {
|
|
|
151
158
|
TOTAL_PAGE: "{{ total_page }}",
|
|
152
159
|
TOTAL_RESULT: "{{ total_result }}",
|
|
153
160
|
COLLECTION_NAME: "{{ collection_name }}",
|
|
154
|
-
TOTAL_WISHLIST: "{{ total_wishlist }}"
|
|
161
|
+
TOTAL_WISHLIST: "{{ total_wishlist }}",
|
|
162
|
+
ACCEPTED_FILETYPE_MEDIA: "{{ accepted_filetype_media }}",
|
|
163
|
+
MAX_SIZE_MEDIA: "{{ max_size_media }}"
|
|
155
164
|
};
|
|
156
165
|
const ELEMENT_ID = {
|
|
157
166
|
PRODUCT_REVIEW: {
|
|
@@ -166,6 +175,213 @@ const PAYLOAD_API_ALIASES = {
|
|
|
166
175
|
PUT: "dEnOjbvTzULLK",
|
|
167
176
|
DELETE: "pLC93Tvsu6g7H"
|
|
168
177
|
};
|
|
178
|
+
async function swr(url, options) {
|
|
179
|
+
if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET" && !(options == null ? void 0 : options.ignoreSWR)) {
|
|
180
|
+
const data = await getData(url);
|
|
181
|
+
return await data.json();
|
|
182
|
+
} else
|
|
183
|
+
return fetch(url, options).then((response) => response.json());
|
|
184
|
+
}
|
|
185
|
+
async function getData(url) {
|
|
186
|
+
const cacheVersion = 1;
|
|
187
|
+
const cacheName = `sledge-${cacheVersion}`;
|
|
188
|
+
return caches.open(cacheName).then((cache) => {
|
|
189
|
+
return cache.match(url).then((cachedResponse) => {
|
|
190
|
+
const fetchedResponse = fetch(url).then(async (networkResponse) => {
|
|
191
|
+
const mainUrl = url.split("?")[0];
|
|
192
|
+
const cacheMatches = await cache.matchAll();
|
|
193
|
+
const filteredCaches = await cacheMatches.filter((f) => f.url.includes(mainUrl) && f.url !== url);
|
|
194
|
+
for (const c of filteredCaches) {
|
|
195
|
+
await cache.delete(c.url);
|
|
196
|
+
}
|
|
197
|
+
cache.put(url, networkResponse.clone());
|
|
198
|
+
return networkResponse;
|
|
199
|
+
});
|
|
200
|
+
return cachedResponse || fetchedResponse;
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const usePrevious = (value) => {
|
|
205
|
+
const ref = React__default.useRef();
|
|
206
|
+
React__default.useEffect(() => {
|
|
207
|
+
ref.current = value;
|
|
208
|
+
});
|
|
209
|
+
return ref.current;
|
|
210
|
+
};
|
|
211
|
+
const sanitizeDataId = (id) => {
|
|
212
|
+
if (!id)
|
|
213
|
+
return "";
|
|
214
|
+
let getId = String(id);
|
|
215
|
+
if (getId.includes("shopify") && getId.includes("/")) {
|
|
216
|
+
let arrId = getId.split("/");
|
|
217
|
+
return arrId[arrId.length - 1] || getId;
|
|
218
|
+
} else {
|
|
219
|
+
return getId;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const isFunction = (data) => typeof data === "function";
|
|
223
|
+
const scrollToElement = (params) => {
|
|
224
|
+
const { element, headerOffset } = params;
|
|
225
|
+
if (!element)
|
|
226
|
+
return;
|
|
227
|
+
var elementPosition = element == null ? void 0 : element.getBoundingClientRect().top;
|
|
228
|
+
var offsetPosition = elementPosition + window.scrollY - headerOffset;
|
|
229
|
+
window.scrollTo({
|
|
230
|
+
top: offsetPosition,
|
|
231
|
+
behavior: "smooth"
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
const getUnixTimestamp = (params) => {
|
|
235
|
+
const { addMoreTime = 0, addMoreTimeBy = "day" } = params || {};
|
|
236
|
+
let moreTime = 0;
|
|
237
|
+
if (addMoreTime) {
|
|
238
|
+
if (addMoreTimeBy === "day")
|
|
239
|
+
moreTime = addMoreTime * 60 * 60 * 24;
|
|
240
|
+
if (addMoreTimeBy === "hour")
|
|
241
|
+
moreTime = addMoreTime * 60 * 60;
|
|
242
|
+
if (addMoreTimeBy === "minute")
|
|
243
|
+
moreTime = addMoreTime * 60;
|
|
244
|
+
if (addMoreTimeBy === "second")
|
|
245
|
+
moreTime = addMoreTime;
|
|
246
|
+
}
|
|
247
|
+
return Math.floor(Date.now() / 1e3) + moreTime;
|
|
248
|
+
};
|
|
249
|
+
const fetchApi = async (params) => {
|
|
250
|
+
const { url, method, authorization = "", payload = {}, headers = {}, isSimpleRequest = true, isUploadFile = false, ignoreSWR = false } = params;
|
|
251
|
+
var myHeaders = new Headers();
|
|
252
|
+
if (!isSimpleRequest) {
|
|
253
|
+
if (authorization)
|
|
254
|
+
myHeaders.append("Authorization", `Bearer ${authorization}`);
|
|
255
|
+
if (Object.keys(headers).length)
|
|
256
|
+
Object.keys(headers).forEach(function(key) {
|
|
257
|
+
myHeaders.append(key, headers[key]);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
var formdata = new FormData();
|
|
261
|
+
if (isSimpleRequest || isUploadFile) {
|
|
262
|
+
if (authorization && isSimpleRequest)
|
|
263
|
+
formdata.append(PAYLOAD_API_ALIASES.Authorization, authorization);
|
|
264
|
+
formdata.append(PAYLOAD_API_ALIASES.Method, PAYLOAD_API_ALIASES[method]);
|
|
265
|
+
if (Object.keys(payload).length)
|
|
266
|
+
Object.keys(payload).forEach(function(key) {
|
|
267
|
+
if (isUploadFile && (payload == null ? void 0 : payload.files))
|
|
268
|
+
[...payload.files].map((item) => {
|
|
269
|
+
formdata.append("files", item, item.name);
|
|
270
|
+
});
|
|
271
|
+
formdata.append(key, payload[key]);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
const fixMethod = isSimpleRequest ? "POST" : method;
|
|
275
|
+
var requestOptions = {
|
|
276
|
+
method: fixMethod,
|
|
277
|
+
redirect: "follow",
|
|
278
|
+
headers: myHeaders,
|
|
279
|
+
body: fixMethod === "GET" ? null : isSimpleRequest || isUploadFile ? formdata : JSON.stringify(payload),
|
|
280
|
+
ignoreSWR
|
|
281
|
+
};
|
|
282
|
+
return await swr(`${url}`, requestOptions);
|
|
283
|
+
};
|
|
284
|
+
const convertDate = (date, options = {
|
|
285
|
+
timeZone: "Asia/Jakarta",
|
|
286
|
+
year: "numeric",
|
|
287
|
+
month: "numeric",
|
|
288
|
+
day: "numeric"
|
|
289
|
+
}) => new Date(date).toLocaleString("en-US", options);
|
|
290
|
+
const watchElement = ({ selector = null, init = null, customInit = false }) => {
|
|
291
|
+
if (!selector || !init)
|
|
292
|
+
return;
|
|
293
|
+
var observer = new MutationObserver(function(mutations) {
|
|
294
|
+
mutations.forEach(function(mutation) {
|
|
295
|
+
var nodes = Array.prototype.slice.call(mutation.addedNodes);
|
|
296
|
+
nodes.forEach(function(node) {
|
|
297
|
+
if (node.nodeType === 1 && (node.matches(selector) || node.querySelector(selector))) {
|
|
298
|
+
if (!customInit) {
|
|
299
|
+
let elementNode = Array.from(node.querySelectorAll(selector));
|
|
300
|
+
if (elementNode.length) {
|
|
301
|
+
elementNode.map((item) => {
|
|
302
|
+
init(item);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
} else {
|
|
306
|
+
init();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
observer.observe(document.body, {
|
|
313
|
+
childList: true,
|
|
314
|
+
subtree: true,
|
|
315
|
+
attributes: false,
|
|
316
|
+
characterData: false
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
const getFillRating = ({
|
|
320
|
+
average,
|
|
321
|
+
item,
|
|
322
|
+
index,
|
|
323
|
+
productId,
|
|
324
|
+
customComponentId,
|
|
325
|
+
unixTimestamp
|
|
326
|
+
}) => {
|
|
327
|
+
let ratingValue = Math.floor(parseFloat(average));
|
|
328
|
+
let getCommaValue = String(average).includes(",") ? String(average).split(",") : [];
|
|
329
|
+
let getCommaValueDot = String(average).includes(".") ? String(average).split(".") : [];
|
|
330
|
+
let isHaveCommaValue = getCommaValue.length || getCommaValueDot.length;
|
|
331
|
+
let commaValue = isHaveCommaValue ? getCommaValue[1] || getCommaValueDot[1] : 0;
|
|
332
|
+
let fillOther = "fill-0";
|
|
333
|
+
if (item > ratingValue && ratingValue + 1 === item) {
|
|
334
|
+
fillOther = `fill-${commaValue}`;
|
|
335
|
+
}
|
|
336
|
+
fillOther = item <= ratingValue ? "full" : fillOther;
|
|
337
|
+
let offset;
|
|
338
|
+
if (fillOther === "fill-0") {
|
|
339
|
+
offset = "0%";
|
|
340
|
+
}
|
|
341
|
+
if (fillOther === "fill-1") {
|
|
342
|
+
offset = "25%";
|
|
343
|
+
}
|
|
344
|
+
if (fillOther === "fill-2") {
|
|
345
|
+
offset = "35%";
|
|
346
|
+
}
|
|
347
|
+
if (fillOther === "fill-3") {
|
|
348
|
+
offset = "40%";
|
|
349
|
+
}
|
|
350
|
+
if (fillOther === "fill-4") {
|
|
351
|
+
offset = "45%";
|
|
352
|
+
}
|
|
353
|
+
if (fillOther === "fill-5") {
|
|
354
|
+
offset = "50%";
|
|
355
|
+
}
|
|
356
|
+
if (fillOther === "fill-6") {
|
|
357
|
+
offset = "60%";
|
|
358
|
+
}
|
|
359
|
+
if (fillOther === "fill-7") {
|
|
360
|
+
offset = "70%";
|
|
361
|
+
}
|
|
362
|
+
if (fillOther === "fill-8") {
|
|
363
|
+
offset = "80%";
|
|
364
|
+
}
|
|
365
|
+
if (fillOther === "fill-9") {
|
|
366
|
+
offset = "90%";
|
|
367
|
+
}
|
|
368
|
+
if (fillOther === "full") {
|
|
369
|
+
offset = "100%";
|
|
370
|
+
}
|
|
371
|
+
let suffixGradientId = `-${fillOther}-${index}-${productId ? productId : unixTimestamp}${customComponentId ? `-${customComponentId}` : ""}`;
|
|
372
|
+
let strokeGradientId = `rating-stroke${suffixGradientId}`;
|
|
373
|
+
let fillGradientId = `rating-gradient${suffixGradientId}`;
|
|
374
|
+
return {
|
|
375
|
+
suffixGradientId,
|
|
376
|
+
strokeGradientId,
|
|
377
|
+
fillGradientId,
|
|
378
|
+
offset,
|
|
379
|
+
fillOther
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
const stripTags = (html) => {
|
|
383
|
+
return html.replace(/(<([^>]+)>)/gi, "");
|
|
384
|
+
};
|
|
169
385
|
const root = "";
|
|
170
386
|
const Loading = "";
|
|
171
387
|
const ConfirmationPopup = "";
|
|
@@ -289,12 +505,18 @@ const Checkbox = ({ id, name, value, required, label, checked, labelStyle = {},
|
|
|
289
505
|
const Slider$1 = "";
|
|
290
506
|
const Slider = (props) => {
|
|
291
507
|
const { defaultValue, min, max, step = 1, setValueCommit, setValueChange } = props;
|
|
292
|
-
const [
|
|
508
|
+
const [valueSlider, setValueSlider] = React__default.useState(defaultValue);
|
|
509
|
+
const [hoverActiveMin, setHoverActiveMin] = React__default.useState(false);
|
|
510
|
+
const [hoverActiveMax, setHoverActiveMax] = React__default.useState(false);
|
|
511
|
+
React__default.useEffect(() => {
|
|
512
|
+
setValueSlider(defaultValue);
|
|
513
|
+
}, [defaultValue]);
|
|
293
514
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("form", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
294
515
|
$faa2e61a3361514f$export$be92b6f5f03c0fe9,
|
|
295
516
|
{
|
|
296
517
|
className: "sledge__SliderRoot",
|
|
297
518
|
defaultValue,
|
|
519
|
+
value: valueSlider,
|
|
298
520
|
...typeof min !== "undefined" ? {
|
|
299
521
|
min
|
|
300
522
|
} : {},
|
|
@@ -302,31 +524,32 @@ const Slider = (props) => {
|
|
|
302
524
|
step,
|
|
303
525
|
"aria-label": "Volume",
|
|
304
526
|
onValueCommit: (valueCommit) => {
|
|
305
|
-
setValueCommit
|
|
306
|
-
setValue(valueCommit);
|
|
527
|
+
setValueCommit == null ? void 0 : setValueCommit(valueCommit);
|
|
307
528
|
},
|
|
308
529
|
onValueChange: (valueChange) => {
|
|
309
|
-
setValueChange
|
|
310
|
-
|
|
530
|
+
setValueChange == null ? void 0 : setValueChange(valueChange);
|
|
531
|
+
setValueSlider(valueChange);
|
|
311
532
|
},
|
|
312
533
|
children: [
|
|
313
534
|
/* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$13921ac0cc260818, { className: "sledge__SliderTrack", children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$9a58ef0d7ad3278c, { className: "sledge__SliderRange" }) }),
|
|
314
535
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
315
536
|
Tooltip,
|
|
316
537
|
{
|
|
317
|
-
content:
|
|
538
|
+
content: valueSlider[0],
|
|
318
539
|
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>`,
|
|
319
540
|
wrapTrigger: false,
|
|
320
|
-
|
|
541
|
+
forceOpen: hoverActiveMin,
|
|
542
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb", onMouseEnter: () => setHoverActiveMin(true), onMouseLeave: () => setHoverActiveMin(false) })
|
|
321
543
|
}
|
|
322
544
|
),
|
|
323
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
545
|
+
!defaultValue[1] ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
324
546
|
Tooltip,
|
|
325
547
|
{
|
|
326
|
-
content:
|
|
548
|
+
content: valueSlider[1],
|
|
327
549
|
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>`,
|
|
328
550
|
wrapTrigger: false,
|
|
329
|
-
|
|
551
|
+
forceOpen: hoverActiveMax,
|
|
552
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx($faa2e61a3361514f$export$6521433ed15a34db, { className: "sledge__SliderThumb", onMouseEnter: () => setHoverActiveMax(true), onMouseLeave: () => setHoverActiveMax(false) })
|
|
330
553
|
}
|
|
331
554
|
)
|
|
332
555
|
]
|
|
@@ -701,150 +924,6 @@ const SelectField = (props) => {
|
|
|
701
924
|
) });
|
|
702
925
|
};
|
|
703
926
|
const ProductGrid$1 = "";
|
|
704
|
-
async function swr(url, options) {
|
|
705
|
-
if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET" && !(options == null ? void 0 : options.ignoreSWR)) {
|
|
706
|
-
const data = await getData(url);
|
|
707
|
-
return await data.json();
|
|
708
|
-
} else
|
|
709
|
-
return fetch(url, options).then((response) => response.json());
|
|
710
|
-
}
|
|
711
|
-
async function getData(url) {
|
|
712
|
-
const cacheVersion = 1;
|
|
713
|
-
const cacheName = `sledge-${cacheVersion}`;
|
|
714
|
-
return caches.open(cacheName).then((cache) => {
|
|
715
|
-
return cache.match(url).then((cachedResponse) => {
|
|
716
|
-
const fetchedResponse = fetch(url).then(async (networkResponse) => {
|
|
717
|
-
const mainUrl = url.split("?")[0];
|
|
718
|
-
const cacheMatches = await cache.matchAll();
|
|
719
|
-
const filteredCaches = await cacheMatches.filter((f) => f.url.includes(mainUrl) && f.url !== url);
|
|
720
|
-
for (const c of filteredCaches) {
|
|
721
|
-
await cache.delete(c.url);
|
|
722
|
-
}
|
|
723
|
-
cache.put(url, networkResponse.clone());
|
|
724
|
-
return networkResponse;
|
|
725
|
-
});
|
|
726
|
-
return cachedResponse || fetchedResponse;
|
|
727
|
-
});
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
const usePrevious = (value) => {
|
|
731
|
-
const ref = React__default.useRef();
|
|
732
|
-
React__default.useEffect(() => {
|
|
733
|
-
ref.current = value;
|
|
734
|
-
});
|
|
735
|
-
return ref.current;
|
|
736
|
-
};
|
|
737
|
-
const sanitizeDataId = (id) => {
|
|
738
|
-
if (!id)
|
|
739
|
-
return "";
|
|
740
|
-
let getId = String(id);
|
|
741
|
-
if (getId.includes("shopify") && getId.includes("/")) {
|
|
742
|
-
let arrId = getId.split("/");
|
|
743
|
-
return arrId[arrId.length - 1] || getId;
|
|
744
|
-
} else {
|
|
745
|
-
return getId;
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
const isFunction = (data) => typeof data === "function";
|
|
749
|
-
const scrollToElement = (params) => {
|
|
750
|
-
const { element, headerOffset } = params;
|
|
751
|
-
if (!element)
|
|
752
|
-
return;
|
|
753
|
-
var elementPosition = element == null ? void 0 : element.getBoundingClientRect().top;
|
|
754
|
-
var offsetPosition = elementPosition + window.scrollY - headerOffset;
|
|
755
|
-
window.scrollTo({
|
|
756
|
-
top: offsetPosition,
|
|
757
|
-
behavior: "smooth"
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
const getUnixTimestamp = (params) => {
|
|
761
|
-
const { addMoreTime = 0, addMoreTimeBy = "day" } = params || {};
|
|
762
|
-
let moreTime = 0;
|
|
763
|
-
if (addMoreTime) {
|
|
764
|
-
if (addMoreTimeBy === "day")
|
|
765
|
-
moreTime = addMoreTime * 60 * 60 * 24;
|
|
766
|
-
if (addMoreTimeBy === "hour")
|
|
767
|
-
moreTime = addMoreTime * 60 * 60;
|
|
768
|
-
if (addMoreTimeBy === "minute")
|
|
769
|
-
moreTime = addMoreTime * 60;
|
|
770
|
-
if (addMoreTimeBy === "second")
|
|
771
|
-
moreTime = addMoreTime;
|
|
772
|
-
}
|
|
773
|
-
return Math.floor(Date.now() / 1e3) + moreTime;
|
|
774
|
-
};
|
|
775
|
-
const fetchApi = async (params) => {
|
|
776
|
-
const { url, method, authorization = "", payload = {}, headers = {}, isSimpleRequest = true, isUploadFile = false, ignoreSWR = false } = params;
|
|
777
|
-
var myHeaders = new Headers();
|
|
778
|
-
if (!isSimpleRequest) {
|
|
779
|
-
if (authorization)
|
|
780
|
-
myHeaders.append("Authorization", `Bearer ${authorization}`);
|
|
781
|
-
if (Object.keys(headers).length)
|
|
782
|
-
Object.keys(headers).forEach(function(key) {
|
|
783
|
-
myHeaders.append(key, headers[key]);
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
var formdata = new FormData();
|
|
787
|
-
if (isSimpleRequest || isUploadFile) {
|
|
788
|
-
if (authorization && isSimpleRequest)
|
|
789
|
-
formdata.append(PAYLOAD_API_ALIASES.Authorization, authorization);
|
|
790
|
-
formdata.append(PAYLOAD_API_ALIASES.Method, PAYLOAD_API_ALIASES[method]);
|
|
791
|
-
if (Object.keys(payload).length)
|
|
792
|
-
Object.keys(payload).forEach(function(key) {
|
|
793
|
-
if (isUploadFile && (payload == null ? void 0 : payload.files))
|
|
794
|
-
[...payload.files].map((item) => {
|
|
795
|
-
formdata.append("files", item, item.name);
|
|
796
|
-
});
|
|
797
|
-
formdata.append(key, payload[key]);
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
const fixMethod = isSimpleRequest ? "POST" : method;
|
|
801
|
-
var requestOptions = {
|
|
802
|
-
method: fixMethod,
|
|
803
|
-
redirect: "follow",
|
|
804
|
-
headers: myHeaders,
|
|
805
|
-
body: fixMethod === "GET" ? null : isSimpleRequest || isUploadFile ? formdata : JSON.stringify(payload),
|
|
806
|
-
ignoreSWR
|
|
807
|
-
};
|
|
808
|
-
return await swr(`${url}`, requestOptions);
|
|
809
|
-
};
|
|
810
|
-
const convertDate = (date, options = {
|
|
811
|
-
timeZone: "Asia/Jakarta",
|
|
812
|
-
year: "numeric",
|
|
813
|
-
month: "numeric",
|
|
814
|
-
day: "numeric"
|
|
815
|
-
}) => new Date(date).toLocaleString("en-US", options);
|
|
816
|
-
const watchElement = ({ selector = null, init = null, customInit = false }) => {
|
|
817
|
-
if (!selector || !init)
|
|
818
|
-
return;
|
|
819
|
-
var observer = new MutationObserver(function(mutations) {
|
|
820
|
-
mutations.forEach(function(mutation) {
|
|
821
|
-
var nodes = Array.prototype.slice.call(mutation.addedNodes);
|
|
822
|
-
nodes.forEach(function(node) {
|
|
823
|
-
if (node.nodeType === 1 && (node.matches(selector) || node.querySelector(selector))) {
|
|
824
|
-
if (!customInit) {
|
|
825
|
-
let elementNode = Array.from(node.querySelectorAll(selector));
|
|
826
|
-
if (elementNode.length) {
|
|
827
|
-
elementNode.map((item) => {
|
|
828
|
-
init(item);
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
} else {
|
|
832
|
-
init();
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
});
|
|
836
|
-
});
|
|
837
|
-
});
|
|
838
|
-
observer.observe(document.body, {
|
|
839
|
-
childList: true,
|
|
840
|
-
subtree: true,
|
|
841
|
-
attributes: false,
|
|
842
|
-
characterData: false
|
|
843
|
-
});
|
|
844
|
-
};
|
|
845
|
-
const stripTags = (html) => {
|
|
846
|
-
return html.replace(/(<([^>]+)>)/gi, "");
|
|
847
|
-
};
|
|
848
927
|
const addToCart = async (data) => {
|
|
849
928
|
var _a, _b;
|
|
850
929
|
let items = [];
|
|
@@ -971,7 +1050,7 @@ const checkWishlist = async (id, variantId) => {
|
|
|
971
1050
|
return;
|
|
972
1051
|
});
|
|
973
1052
|
};
|
|
974
|
-
const addToCartTrigger$
|
|
1053
|
+
const addToCartTrigger$2 = async (data) => {
|
|
975
1054
|
const { productId } = data;
|
|
976
1055
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
977
1056
|
let url = `${API_URL}/wishlist/cart`;
|
|
@@ -1510,7 +1589,6 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1510
1589
|
let getMessage = text_confirm_add_to_your_wishlist;
|
|
1511
1590
|
if (getMessage)
|
|
1512
1591
|
getMessage = getMessage.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_WISHLIST, wishlistData.length);
|
|
1513
|
-
console.log("text_confirm_add_to_your_wishlist", text_confirm_add_to_your_wishlist);
|
|
1514
1592
|
if (shareId && wishlistData.length) {
|
|
1515
1593
|
window.sledgeConfirmationPopup({
|
|
1516
1594
|
title: title_confirm_add_to_your_wishlist || "Are you sure want to add this to your wishlist item?",
|
|
@@ -1901,53 +1979,14 @@ const Rating = (props) => {
|
|
|
1901
1979
|
[1, 2, 3, 4, 5].map((item, index) => {
|
|
1902
1980
|
if (!(item <= numberOfIcons))
|
|
1903
1981
|
return;
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
}
|
|
1913
|
-
fillOther = item <= ratingValue ? "full" : fillOther;
|
|
1914
|
-
let offset;
|
|
1915
|
-
if (fillOther === "fill-0") {
|
|
1916
|
-
offset = "0%";
|
|
1917
|
-
}
|
|
1918
|
-
if (fillOther === "fill-1") {
|
|
1919
|
-
offset = "25%";
|
|
1920
|
-
}
|
|
1921
|
-
if (fillOther === "fill-2") {
|
|
1922
|
-
offset = "35%";
|
|
1923
|
-
}
|
|
1924
|
-
if (fillOther === "fill-3") {
|
|
1925
|
-
offset = "40%";
|
|
1926
|
-
}
|
|
1927
|
-
if (fillOther === "fill-4") {
|
|
1928
|
-
offset = "45%";
|
|
1929
|
-
}
|
|
1930
|
-
if (fillOther === "fill-5") {
|
|
1931
|
-
offset = "50%";
|
|
1932
|
-
}
|
|
1933
|
-
if (fillOther === "fill-6") {
|
|
1934
|
-
offset = "60%";
|
|
1935
|
-
}
|
|
1936
|
-
if (fillOther === "fill-7") {
|
|
1937
|
-
offset = "70%";
|
|
1938
|
-
}
|
|
1939
|
-
if (fillOther === "fill-8") {
|
|
1940
|
-
offset = "80%";
|
|
1941
|
-
}
|
|
1942
|
-
if (fillOther === "fill-9") {
|
|
1943
|
-
offset = "90%";
|
|
1944
|
-
}
|
|
1945
|
-
if (fillOther === "full") {
|
|
1946
|
-
offset = "100%";
|
|
1947
|
-
}
|
|
1948
|
-
let suffixGradientId = `-${fillOther}-${index}-${productId ? productId : unixTimestamp}${customComponentId ? `-${customComponentId}` : ""}`;
|
|
1949
|
-
let strokeGradientId = `rating-stroke${suffixGradientId}`;
|
|
1950
|
-
let fillGradientId = `rating-gradient${suffixGradientId}`;
|
|
1982
|
+
const { strokeGradientId, suffixGradientId, offset, fillGradientId, fillOther } = getFillRating({
|
|
1983
|
+
average: averageReview,
|
|
1984
|
+
item,
|
|
1985
|
+
index,
|
|
1986
|
+
productId,
|
|
1987
|
+
unixTimestamp,
|
|
1988
|
+
customComponentId
|
|
1989
|
+
});
|
|
1951
1990
|
return /* @__PURE__ */ createElement("svg", { xmlns: "http://www.w3.org/2000/svg", ...sizing, viewBox: "0 0 32 32", key: suffixGradientId }, /* @__PURE__ */ jsxRuntimeExports.jsxs("defs", { children: [
|
|
1952
1991
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: strokeGradientId, children: [
|
|
1953
1992
|
/* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fillColor || fill_color }),
|
|
@@ -2309,7 +2348,7 @@ const searchTrigger = async (data) => {
|
|
|
2309
2348
|
return;
|
|
2310
2349
|
});
|
|
2311
2350
|
};
|
|
2312
|
-
const productClickTrigger = async (data) => {
|
|
2351
|
+
const productClickTrigger$1 = async (data) => {
|
|
2313
2352
|
const { productId } = data;
|
|
2314
2353
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2315
2354
|
let url = `${API_URL}/instantsearch/statistics/click`;
|
|
@@ -2334,7 +2373,7 @@ const productClickTrigger = async (data) => {
|
|
|
2334
2373
|
return;
|
|
2335
2374
|
});
|
|
2336
2375
|
};
|
|
2337
|
-
const addToCartTrigger = async (data) => {
|
|
2376
|
+
const addToCartTrigger$1 = async (data) => {
|
|
2338
2377
|
const { productId } = data;
|
|
2339
2378
|
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2340
2379
|
let url = `${API_URL}/instantsearch/statistics/cart`;
|
|
@@ -2359,6 +2398,55 @@ const addToCartTrigger = async (data) => {
|
|
|
2359
2398
|
return;
|
|
2360
2399
|
});
|
|
2361
2400
|
};
|
|
2401
|
+
const productRecommendationSourceApps = ["recently-viewed", "related-product", "hand-picked", "new-arrival", "personalized-curated"];
|
|
2402
|
+
const productClickTrigger = async (data) => {
|
|
2403
|
+
const { productId, sourceApp } = data;
|
|
2404
|
+
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2405
|
+
let url = `${API_URL}/product-recommendation/statistics/click`;
|
|
2406
|
+
let headers = {
|
|
2407
|
+
"Content-Type": "application/json"
|
|
2408
|
+
};
|
|
2409
|
+
let payload = {
|
|
2410
|
+
product_id: sanitizeDataId(productId),
|
|
2411
|
+
widget: sourceApp
|
|
2412
|
+
};
|
|
2413
|
+
return await fetchApi({
|
|
2414
|
+
url,
|
|
2415
|
+
method: "POST",
|
|
2416
|
+
authorization: sledgeAuthApp,
|
|
2417
|
+
payload,
|
|
2418
|
+
headers,
|
|
2419
|
+
isSimpleRequest: false
|
|
2420
|
+
}).then((result) => {
|
|
2421
|
+
return result;
|
|
2422
|
+
}).catch(() => {
|
|
2423
|
+
return;
|
|
2424
|
+
});
|
|
2425
|
+
};
|
|
2426
|
+
const addToCartTrigger = async (data) => {
|
|
2427
|
+
const { productId, sourceApp } = data;
|
|
2428
|
+
let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
|
|
2429
|
+
let url = `${API_URL}/product-recommendation/statistics/cart`;
|
|
2430
|
+
let headers = {
|
|
2431
|
+
"Content-Type": "application/json"
|
|
2432
|
+
};
|
|
2433
|
+
let payload = {
|
|
2434
|
+
product_id: sanitizeDataId(productId),
|
|
2435
|
+
widget: sourceApp
|
|
2436
|
+
};
|
|
2437
|
+
return await fetchApi({
|
|
2438
|
+
url,
|
|
2439
|
+
method: "POST",
|
|
2440
|
+
authorization: sledgeAuthApp,
|
|
2441
|
+
payload,
|
|
2442
|
+
headers,
|
|
2443
|
+
isSimpleRequest: false
|
|
2444
|
+
}).then((result) => {
|
|
2445
|
+
return result;
|
|
2446
|
+
}).catch(() => {
|
|
2447
|
+
return;
|
|
2448
|
+
});
|
|
2449
|
+
};
|
|
2362
2450
|
const ProductCard = (props) => {
|
|
2363
2451
|
var _a, _b, _c;
|
|
2364
2452
|
const {
|
|
@@ -2504,9 +2592,18 @@ const ProductCard = (props) => {
|
|
|
2504
2592
|
"a",
|
|
2505
2593
|
{
|
|
2506
2594
|
href: url,
|
|
2507
|
-
onClick: () =>
|
|
2508
|
-
|
|
2509
|
-
|
|
2595
|
+
onClick: () => {
|
|
2596
|
+
if (sourceApp === "instant-search") {
|
|
2597
|
+
productClickTrigger$1({
|
|
2598
|
+
productId: id
|
|
2599
|
+
});
|
|
2600
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2601
|
+
productClickTrigger({
|
|
2602
|
+
productId: id,
|
|
2603
|
+
sourceApp
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
},
|
|
2510
2607
|
className: "sledge__product-grid-card-image-link",
|
|
2511
2608
|
children: [
|
|
2512
2609
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -2530,7 +2627,21 @@ const ProductCard = (props) => {
|
|
|
2530
2627
|
wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
|
|
2531
2628
|
}
|
|
2532
2629
|
),
|
|
2533
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2630
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2631
|
+
"img",
|
|
2632
|
+
{
|
|
2633
|
+
src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
|
|
2634
|
+
alt: "sledge-card-image",
|
|
2635
|
+
loading: "lazy",
|
|
2636
|
+
className: "sledge__product-grid-card-image-featured-image",
|
|
2637
|
+
onError: ({ currentTarget }) => {
|
|
2638
|
+
if (!currentTarget)
|
|
2639
|
+
return;
|
|
2640
|
+
currentTarget.onerror = null;
|
|
2641
|
+
currentTarget.src = `${CDN_URL}/images/blank-image.png`;
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
),
|
|
2534
2645
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: images == null ? void 0 : images.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2535
2646
|
"img",
|
|
2536
2647
|
{
|
|
@@ -2577,9 +2688,18 @@ const ProductCard = (props) => {
|
|
|
2577
2688
|
"a",
|
|
2578
2689
|
{
|
|
2579
2690
|
href: url,
|
|
2580
|
-
onClick: () =>
|
|
2581
|
-
|
|
2582
|
-
|
|
2691
|
+
onClick: () => {
|
|
2692
|
+
if (sourceApp === "instant-search") {
|
|
2693
|
+
productClickTrigger$1({
|
|
2694
|
+
productId: id
|
|
2695
|
+
});
|
|
2696
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2697
|
+
productClickTrigger({
|
|
2698
|
+
productId: id,
|
|
2699
|
+
sourceApp
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
},
|
|
2583
2703
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name", style: display_product_name_style, children: title })
|
|
2584
2704
|
}
|
|
2585
2705
|
) : null,
|
|
@@ -2684,13 +2804,18 @@ const ProductGrid = (props) => {
|
|
|
2684
2804
|
]);
|
|
2685
2805
|
if ((_a = resShopifyAddToCart == null ? void 0 : resShopifyAddToCart.items) == null ? void 0 : _a.length) {
|
|
2686
2806
|
if (sourceApp === "wishlist") {
|
|
2687
|
-
await addToCartTrigger$
|
|
2807
|
+
await addToCartTrigger$2({
|
|
2688
2808
|
productId: id
|
|
2689
2809
|
});
|
|
2690
2810
|
} else if (sourceApp === "instant-search") {
|
|
2691
|
-
await addToCartTrigger({
|
|
2811
|
+
await addToCartTrigger$1({
|
|
2692
2812
|
productId: id
|
|
2693
2813
|
});
|
|
2814
|
+
} else if (productRecommendationSourceApps.includes(sourceApp)) {
|
|
2815
|
+
await addToCartTrigger({
|
|
2816
|
+
productId: id,
|
|
2817
|
+
sourceApp
|
|
2818
|
+
});
|
|
2694
2819
|
}
|
|
2695
2820
|
setClickedAddToCartId(null);
|
|
2696
2821
|
onAfterAddToCart && onAfterAddToCart("success");
|
|
@@ -2720,10 +2845,13 @@ const ProductGrid = (props) => {
|
|
|
2720
2845
|
}
|
|
2721
2846
|
};
|
|
2722
2847
|
const Container = useSlider ? Carousel : "div";
|
|
2848
|
+
const carouselSourceProp = useSlider && {
|
|
2849
|
+
carouselSourceWidget: "productGrid"
|
|
2850
|
+
} || null;
|
|
2723
2851
|
React__default.useEffect(() => {
|
|
2724
2852
|
onAfterRenderProduct && onAfterRenderProduct("success");
|
|
2725
2853
|
}, []);
|
|
2726
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { className: `sledge__product-grid ${className}`, "data-grid-type": type, children: data == null ? void 0 : data.map((item, index) => {
|
|
2854
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { className: `sledge__product-grid ${className}`, ...carouselSourceProp, "data-grid-type": type, children: data == null ? void 0 : data.map((item, index) => {
|
|
2727
2855
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { item, handleAddToCart, clickedAddToCartId, ...props }, `sledge-product-card_${index}`);
|
|
2728
2856
|
}) });
|
|
2729
2857
|
};
|
|
@@ -2827,7 +2955,7 @@ const ArticleGrid = ({ className = "", data, cards: CardsComponent, isComponentJ
|
|
|
2827
2955
|
}) }) });
|
|
2828
2956
|
};
|
|
2829
2957
|
const Tooltip$1 = "";
|
|
2830
|
-
const Tooltip = ({ children, content, withArrow = true, customArrow = "", sideOffset = 5, alignOffset = 0, wrapTrigger = true }) => {
|
|
2958
|
+
const Tooltip = ({ children, content, withArrow = true, customArrow = "", sideOffset = 5, alignOffset = 0, wrapTrigger = true, forceOpen }) => {
|
|
2831
2959
|
const [open, setOpen] = React__default.useState(false);
|
|
2832
2960
|
React__default.useEffect(() => {
|
|
2833
2961
|
var _a;
|
|
@@ -2837,13 +2965,22 @@ const Tooltip = ({ children, content, withArrow = true, customArrow = "", sideOf
|
|
|
2837
2965
|
arrowElement.innerHTML = customArrow;
|
|
2838
2966
|
}
|
|
2839
2967
|
}, [open]);
|
|
2840
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2968
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
2969
|
+
$a093c7e1ec25a057$export$be92b6f5f03c0fe9,
|
|
2970
|
+
{
|
|
2971
|
+
onOpenChange: setOpen,
|
|
2972
|
+
...forceOpen ? {
|
|
2973
|
+
open: forceOpen
|
|
2974
|
+
} : {},
|
|
2975
|
+
children: [
|
|
2976
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx($a093c7e1ec25a057$export$41fb9f06171c75f4, { asChild: true, children: wrapTrigger ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children }) : children }),
|
|
2977
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx($a093c7e1ec25a057$export$602eac185826482c, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs($a093c7e1ec25a057$export$7c6e2c02157bb7d2, { className: "sledge__tooltip-content", sideOffset, alignOffset, children: [
|
|
2978
|
+
content,
|
|
2979
|
+
withArrow ? /* @__PURE__ */ jsxRuntimeExports.jsx($a093c7e1ec25a057$export$21b07c8f274aebd5, { className: "sledge__tooltip-arrow" }) : null
|
|
2980
|
+
] }) })
|
|
2981
|
+
]
|
|
2982
|
+
}
|
|
2983
|
+
) });
|
|
2847
2984
|
};
|
|
2848
2985
|
const ScrollArea$1 = "";
|
|
2849
2986
|
const ScrollArea = ({ children, isLoading = false, className = "" }) => {
|
|
@@ -3090,11 +3227,10 @@ const LoadingDots = () => {
|
|
|
3090
3227
|
};
|
|
3091
3228
|
const Carousel$1 = "";
|
|
3092
3229
|
const Carousel = (props) => {
|
|
3093
|
-
const { children, className = "", "data-grid-type": dataGridType } = props;
|
|
3230
|
+
const { children, className = "", "data-grid-type": dataGridType, carouselSourceWidget } = props;
|
|
3094
3231
|
const [active, setActive] = React__default.useState(true);
|
|
3095
3232
|
const {
|
|
3096
3233
|
options = {
|
|
3097
|
-
active,
|
|
3098
3234
|
slidesToScroll: "auto",
|
|
3099
3235
|
align: "start",
|
|
3100
3236
|
dragFree: true,
|
|
@@ -3104,12 +3240,28 @@ const Carousel = (props) => {
|
|
|
3104
3240
|
const [carouselRef, carouselApi] = useEmblaCarousel(options);
|
|
3105
3241
|
const [prevBtnDisabled, setPrevBtnDisabled] = React__default.useState(true);
|
|
3106
3242
|
const [nextBtnDisabled, setNextBtnDisabled] = React__default.useState(true);
|
|
3243
|
+
const [selectedIndex, setSelectedIndex] = React__default.useState(0);
|
|
3244
|
+
const [scrollSnaps, setScrollSnaps] = React__default.useState([]);
|
|
3107
3245
|
const scrollPrev = React__default.useCallback(() => carouselApi && carouselApi.scrollPrev(), [carouselApi]);
|
|
3108
3246
|
const scrollNext = React__default.useCallback(() => carouselApi && carouselApi.scrollNext(), [carouselApi]);
|
|
3247
|
+
const scrollTo = React__default.useCallback((index) => carouselApi && carouselApi.scrollTo(index), [carouselApi]);
|
|
3109
3248
|
const onSelect = React__default.useCallback((carouselApi2) => {
|
|
3249
|
+
setSelectedIndex(carouselApi2.selectedScrollSnap());
|
|
3110
3250
|
setPrevBtnDisabled(!carouselApi2.canScrollPrev());
|
|
3111
3251
|
setNextBtnDisabled(!carouselApi2.canScrollNext());
|
|
3112
3252
|
}, []);
|
|
3253
|
+
const onInit = React__default.useCallback((carouselApi2) => {
|
|
3254
|
+
setScrollSnaps(carouselApi2.scrollSnapList());
|
|
3255
|
+
}, []);
|
|
3256
|
+
React__default.useEffect(() => {
|
|
3257
|
+
if (!carouselApi)
|
|
3258
|
+
return;
|
|
3259
|
+
onInit(carouselApi);
|
|
3260
|
+
onSelect(carouselApi);
|
|
3261
|
+
carouselApi.on("reInit", onInit);
|
|
3262
|
+
carouselApi.on("reInit", onSelect);
|
|
3263
|
+
carouselApi.on("select", onSelect);
|
|
3264
|
+
}, [carouselApi, onSelect]);
|
|
3113
3265
|
React__default.useEffect(() => {
|
|
3114
3266
|
if (!carouselApi)
|
|
3115
3267
|
return;
|
|
@@ -3121,10 +3273,30 @@ const Carousel = (props) => {
|
|
|
3121
3273
|
React__default.useEffect(() => {
|
|
3122
3274
|
if (!carouselApi)
|
|
3123
3275
|
return;
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3276
|
+
carouselApi.reInit(options);
|
|
3277
|
+
}, [carouselApi, React__default.Children.count(children)]);
|
|
3278
|
+
React__default.useEffect(() => {
|
|
3279
|
+
if (!carouselApi)
|
|
3280
|
+
return;
|
|
3281
|
+
if (!active)
|
|
3282
|
+
carouselApi == null ? void 0 : carouselApi.internalEngine().dragHandler.destroy();
|
|
3283
|
+
else
|
|
3284
|
+
carouselApi == null ? void 0 : carouselApi.internalEngine().dragHandler.init(carouselApi);
|
|
3285
|
+
}, [active]);
|
|
3286
|
+
let carouselAttributes = {};
|
|
3287
|
+
switch (carouselSourceWidget) {
|
|
3288
|
+
case "productGrid":
|
|
3289
|
+
carouselAttributes = {
|
|
3290
|
+
className: "sledge__carousel-container sledge__product-grid",
|
|
3291
|
+
"data-grid-type": dataGridType
|
|
3292
|
+
};
|
|
3293
|
+
break;
|
|
3294
|
+
default:
|
|
3295
|
+
carouselAttributes = {
|
|
3296
|
+
className: "sledge__carousel-container"
|
|
3297
|
+
};
|
|
3298
|
+
break;
|
|
3299
|
+
}
|
|
3128
3300
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `sledge__carousel ${className}`, children: [
|
|
3129
3301
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3130
3302
|
Navigation,
|
|
@@ -3139,7 +3311,7 @@ const Carousel = (props) => {
|
|
|
3139
3311
|
className: "sledge__carousel-button-prev"
|
|
3140
3312
|
}
|
|
3141
3313
|
),
|
|
3142
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
|
3314
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__carousel-viewport ${active && "is-active" || ""}`, ref: carouselRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...carouselAttributes, children }) }),
|
|
3143
3315
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3144
3316
|
Navigation,
|
|
3145
3317
|
{
|
|
@@ -3152,7 +3324,8 @@ const Carousel = (props) => {
|
|
|
3152
3324
|
onClick: scrollNext,
|
|
3153
3325
|
className: "sledge__carousel-button-next"
|
|
3154
3326
|
}
|
|
3155
|
-
)
|
|
3327
|
+
),
|
|
3328
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__carousel-dots", children: scrollSnaps.map((_, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(DotButton, { onClick: () => scrollTo(index), className: "sledge__carousel-dot".concat(index === selectedIndex ? " sledge__carousel-dot--selected" : "") }, index)) })
|
|
3156
3329
|
] });
|
|
3157
3330
|
};
|
|
3158
3331
|
const Navigation = (props) => {
|
|
@@ -3177,6 +3350,10 @@ const Navigation = (props) => {
|
|
|
3177
3350
|
const Icon = () => position === "left" ? LeftIcon : RightIcon;
|
|
3178
3351
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: `sledge__carousel-button ${className}`, type: "button", ...restProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, {}) });
|
|
3179
3352
|
};
|
|
3353
|
+
const DotButton = (props) => {
|
|
3354
|
+
const { children, ...restProps } = props;
|
|
3355
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", ...restProps, children });
|
|
3356
|
+
};
|
|
3180
3357
|
const SearchIconWidget = (props) => {
|
|
3181
3358
|
const { isRenderApp, isJsVersion } = React__default.useContext(SledgeContext);
|
|
3182
3359
|
const { instantSearch: isRenderAppInstantSearch } = isRenderApp || {};
|
|
@@ -3736,9 +3913,9 @@ const SearchResultWidget = (props) => {
|
|
|
3736
3913
|
const [languageSettings, setLanguageSettings] = React__default.useState(((_j = sledgeSettings == null ? void 0 : sledgeSettings.instantsearch) == null ? void 0 : _j.languages) || {});
|
|
3737
3914
|
const [initStatesFirstTime, setInitStatesFirstTime] = React__default.useState(true);
|
|
3738
3915
|
const [defaultFacetStats, setDefaultFacetStats] = React__default.useState({});
|
|
3739
|
-
const [defaultFacetDistribution, setDefaultFacetDistribution] = React__default.useState({});
|
|
3740
3916
|
const [hideFilterWhenOneValue, setHideFilterWhenOneValue] = React__default.useState(false);
|
|
3741
3917
|
const [isReplaceWidgetList, setIsReplaceWidgetList] = React__default.useState(false);
|
|
3918
|
+
const [searchResultFacets, setSearchResultFacets] = React__default.useState({});
|
|
3742
3919
|
let productCardsComponent = null;
|
|
3743
3920
|
let collectionCardsComponent = null;
|
|
3744
3921
|
let pageCardsComponent = null;
|
|
@@ -3839,8 +4016,32 @@ const SearchResultWidget = (props) => {
|
|
|
3839
4016
|
} else {
|
|
3840
4017
|
const { facetStats, totalHits, facetDistribution } = (results == null ? void 0 : results.find(({ indexUid }) => indexUid.includes(index_product))) || {};
|
|
3841
4018
|
setDefaultFacetStats(facetStats);
|
|
3842
|
-
setDefaultFacetDistribution(facetDistribution);
|
|
3843
4019
|
setHideFilterWhenOneValue(((_a2 = display == null ? void 0 : display.filter) == null ? void 0 : _a2.hide_when_one_value) && totalHits <= 1);
|
|
4020
|
+
setSearchResultFacets(
|
|
4021
|
+
facetDistribution ? Object.fromEntries(
|
|
4022
|
+
Object.entries(facetDistribution).map((facet) => {
|
|
4023
|
+
let value = facet[0];
|
|
4024
|
+
let items = [];
|
|
4025
|
+
if (value === "variants.inventory_quantity") {
|
|
4026
|
+
items = [
|
|
4027
|
+
{
|
|
4028
|
+
name: "In Stock",
|
|
4029
|
+
value: "> 0"
|
|
4030
|
+
}
|
|
4031
|
+
];
|
|
4032
|
+
} else {
|
|
4033
|
+
items = Object.keys(facetDistribution[value]).map((item) => {
|
|
4034
|
+
return {
|
|
4035
|
+
name: item,
|
|
4036
|
+
value: item,
|
|
4037
|
+
total: facetDistribution[value][item] || 0
|
|
4038
|
+
};
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
return [value, items];
|
|
4042
|
+
})
|
|
4043
|
+
) : {}
|
|
4044
|
+
);
|
|
3844
4045
|
}
|
|
3845
4046
|
};
|
|
3846
4047
|
const handleSettings = async (LOCAL_STORAGE_INSTANT_SEARCH_SETTING) => {
|
|
@@ -4190,7 +4391,6 @@ const SearchResultWidget = (props) => {
|
|
|
4190
4391
|
allowedFilters,
|
|
4191
4392
|
facets,
|
|
4192
4393
|
defaultFacetStats,
|
|
4193
|
-
defaultFacetDistribution,
|
|
4194
4394
|
hideFilterWhenOneValue,
|
|
4195
4395
|
hiddenTags,
|
|
4196
4396
|
displaySettings,
|
|
@@ -4228,12 +4428,13 @@ const SearchResultWidget = (props) => {
|
|
|
4228
4428
|
data: propsData,
|
|
4229
4429
|
settings,
|
|
4230
4430
|
isReplaceWidgetList,
|
|
4231
|
-
setIsReplaceWidgetList
|
|
4431
|
+
setIsReplaceWidgetList,
|
|
4432
|
+
searchResultFacets
|
|
4232
4433
|
})
|
|
4233
4434
|
] });
|
|
4234
4435
|
};
|
|
4235
4436
|
const ResultProduct = (props) => {
|
|
4236
|
-
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
|
|
4437
|
+
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;
|
|
4237
4438
|
const {
|
|
4238
4439
|
layoutType,
|
|
4239
4440
|
keyword,
|
|
@@ -4243,7 +4444,6 @@ const ResultProduct = (props) => {
|
|
|
4243
4444
|
allowedFilters,
|
|
4244
4445
|
facets,
|
|
4245
4446
|
defaultFacetStats,
|
|
4246
|
-
defaultFacetDistribution,
|
|
4247
4447
|
hideFilterWhenOneValue,
|
|
4248
4448
|
hiddenTags,
|
|
4249
4449
|
displaySettings,
|
|
@@ -4272,17 +4472,15 @@ const ResultProduct = (props) => {
|
|
|
4272
4472
|
data: propsData,
|
|
4273
4473
|
settings,
|
|
4274
4474
|
isReplaceWidgetList,
|
|
4275
|
-
setIsReplaceWidgetList
|
|
4475
|
+
setIsReplaceWidgetList,
|
|
4476
|
+
searchResultFacets
|
|
4276
4477
|
} = props || {};
|
|
4277
4478
|
const queryKeyword = (query == null ? void 0 : query.keyword) ? query.keyword : DEFAULT_QUERY_PARAM.KEYWORD;
|
|
4278
4479
|
const { collectionId, collectionName } = params || {};
|
|
4279
4480
|
const [isFirstLoading, setIsFirstLoading] = React__default.useState(!propsData);
|
|
4280
4481
|
const [isLoading, setIsLoading] = React__default.useState(!propsData);
|
|
4281
|
-
const [isOpenSort, setIsOpenSort] = React__default.useState(false);
|
|
4282
|
-
const [isOpenLimit, setIsOpenLimit] = React__default.useState(false);
|
|
4283
4482
|
const [clickedSortId, setClickedSortId] = React__default.useState(defaultSort || "");
|
|
4284
|
-
const [
|
|
4285
|
-
const [clickedLimitId, setClickedLimitId] = React__default.useState(((_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.limit) || 10);
|
|
4483
|
+
const [clickedLimitId, setClickedLimitId] = React__default.useState(((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.limit) || 10);
|
|
4286
4484
|
const [clickedOpenFilterId, setClickedOpenFilterId] = React__default.useState(null);
|
|
4287
4485
|
const [clickedOpenFilters, setClickedOpenFilters] = React__default.useState([]);
|
|
4288
4486
|
const [clickedFacets, setClickedFacets] = React__default.useState({
|
|
@@ -4291,16 +4489,15 @@ const ResultProduct = (props) => {
|
|
|
4291
4489
|
} : {}
|
|
4292
4490
|
});
|
|
4293
4491
|
const [triggerClickedFacets, setTriggerClickedFacets] = React__default.useState(false);
|
|
4294
|
-
const [searchResult, setSearchResult] = React__default.useState(((
|
|
4492
|
+
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) || []);
|
|
4295
4493
|
const [searchProcessingTimeMs, setSearchProcessingTimeMs] = React__default.useState(0);
|
|
4296
4494
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
4297
4495
|
const [totalPage, setTotalPage] = React__default.useState(0);
|
|
4298
|
-
const [totalSearchResult, setTotalSearchResult] = React__default.useState(((
|
|
4496
|
+
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);
|
|
4299
4497
|
const [valueFilterPriceChange, setValueFilterPriceChange] = React__default.useState([]);
|
|
4300
4498
|
const [allowedFilter, setAllowedFilter] = React__default.useState([]);
|
|
4301
|
-
const [isFilterChanged, setIsFilterChanged] = React__default.useState(false);
|
|
4302
4499
|
const [handleSearchResultFirstTime, setHandleSearchResultFirstTime] = React__default.useState(true);
|
|
4303
|
-
const [
|
|
4500
|
+
const [searchFacetDistribution, setSearchFacetDistribution] = React__default.useState({});
|
|
4304
4501
|
const {
|
|
4305
4502
|
sort_by: language_sort_by,
|
|
4306
4503
|
result: language_result,
|
|
@@ -4333,19 +4530,19 @@ const ResultProduct = (props) => {
|
|
|
4333
4530
|
if (isSummaryTextFromLanguage) {
|
|
4334
4531
|
getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_RESULT, totalResult);
|
|
4335
4532
|
if (layoutType === "product-filter")
|
|
4336
|
-
getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.COLLECTION_NAME, collectionName || "");
|
|
4533
|
+
getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.COLLECTION_NAME, collectionName || "Products");
|
|
4337
4534
|
}
|
|
4338
4535
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-item", children: ((_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_total_products) ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-data-summary-text", children: isSummaryTextFromLanguage ? getSummaryText : defaultSummaryText }) : null });
|
|
4339
4536
|
};
|
|
4340
4537
|
const [summaryText, setSummaryText] = React__default.useState(propsData ? summaryTextGenerator(totalSearchResult) : null);
|
|
4341
4538
|
const previousState = usePrevious({ keyword, clickedLimitId, clickedFacets, clickedTabIndexId });
|
|
4342
|
-
const { color: filter_title_color, font_size: filter_title_font_size, font_weight: filter_title_font_weight, text_transform: filter_title_text_transform } = ((
|
|
4539
|
+
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) || {};
|
|
4343
4540
|
const {
|
|
4344
4541
|
color: filter_option_color,
|
|
4345
4542
|
font_size: filter_option_font_size,
|
|
4346
4543
|
font_weight: filter_option_font_weight,
|
|
4347
4544
|
text_transform: filter_option_text_transform
|
|
4348
|
-
} = ((
|
|
4545
|
+
} = ((_i = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _i.option) || {};
|
|
4349
4546
|
const {
|
|
4350
4547
|
text_color: filter_button_text_color,
|
|
4351
4548
|
border_color: filter_button_border_color,
|
|
@@ -4358,7 +4555,7 @@ const ResultProduct = (props) => {
|
|
|
4358
4555
|
font_size: filter_button_font_size,
|
|
4359
4556
|
font_weight: filter_button_font_weight,
|
|
4360
4557
|
text_transform: filter_button_text_transform
|
|
4361
|
-
} = ((
|
|
4558
|
+
} = ((_j = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _j.button) || {};
|
|
4362
4559
|
const filter_title_style = {
|
|
4363
4560
|
...filter_title_color && { color: filter_title_color },
|
|
4364
4561
|
...filter_title_font_size && { fontSize: filter_title_font_size },
|
|
@@ -4421,12 +4618,9 @@ const ResultProduct = (props) => {
|
|
|
4421
4618
|
window.history.pushState(null, "", `${document.location.pathname}${(newQueryString == null ? void 0 : newQueryString.length) ? `?${newQueryString}` : ""}`);
|
|
4422
4619
|
};
|
|
4423
4620
|
const handleChangeSort = (label, value) => {
|
|
4424
|
-
setIsOpenSort(false);
|
|
4425
|
-
setClickedSortName(label);
|
|
4426
4621
|
setClickedSortId(value);
|
|
4427
4622
|
};
|
|
4428
4623
|
const handleChangeLimit = (value) => {
|
|
4429
|
-
setIsOpenLimit(false);
|
|
4430
4624
|
setClickedLimitId(value);
|
|
4431
4625
|
};
|
|
4432
4626
|
const handleOpenFilterVertical = (id) => {
|
|
@@ -4442,18 +4636,13 @@ const ResultProduct = (props) => {
|
|
|
4442
4636
|
setClickedOpenFilters(valueClickedOpenFilters);
|
|
4443
4637
|
};
|
|
4444
4638
|
const handleFilterReset = () => {
|
|
4445
|
-
setIsFilterChanged(true);
|
|
4446
4639
|
setClickedFacets({});
|
|
4447
4640
|
setTriggerClickedFacets(!triggerClickedFacets);
|
|
4448
4641
|
handleQueryStringFilter({});
|
|
4449
4642
|
setValueFilterPriceChange([]);
|
|
4450
|
-
setTimeout(() => {
|
|
4451
|
-
setIsFilterChanged(false);
|
|
4452
|
-
}, 10);
|
|
4453
4643
|
};
|
|
4454
4644
|
const handleFilterChange = (parentId, value, force = false) => {
|
|
4455
4645
|
var _a2;
|
|
4456
|
-
setIsFilterChanged(true);
|
|
4457
4646
|
let facets2 = [value];
|
|
4458
4647
|
let isRange = ["variants.price"].includes(parentId);
|
|
4459
4648
|
if (clickedFacets) {
|
|
@@ -4485,9 +4674,6 @@ const ResultProduct = (props) => {
|
|
|
4485
4674
|
handleQueryStringFilter(valueClickedFacets);
|
|
4486
4675
|
setClickedFacets(valueClickedFacets);
|
|
4487
4676
|
setTriggerClickedFacets(!triggerClickedFacets);
|
|
4488
|
-
setTimeout(() => {
|
|
4489
|
-
setIsFilterChanged(false);
|
|
4490
|
-
}, 10);
|
|
4491
4677
|
};
|
|
4492
4678
|
const handleSearchResultData = (result, onSearch) => {
|
|
4493
4679
|
if (!result)
|
|
@@ -4507,34 +4693,7 @@ const ResultProduct = (props) => {
|
|
|
4507
4693
|
setTotalPage(totalPages);
|
|
4508
4694
|
setTotalSearchResult(totalHits || 0);
|
|
4509
4695
|
setSummaryText(summaryTextGenerator(totalHits));
|
|
4510
|
-
|
|
4511
|
-
defaultFacetDistribution ? Object.fromEntries(
|
|
4512
|
-
Object.entries(defaultFacetDistribution).map((facet) => {
|
|
4513
|
-
let value = facet[0];
|
|
4514
|
-
let items = [];
|
|
4515
|
-
if (value === "variants.inventory_quantity") {
|
|
4516
|
-
Object.keys(defaultFacetDistribution[value]).map((item) => {
|
|
4517
|
-
return Boolean(Number(item)) ? defaultFacetDistribution[value][item] : 0;
|
|
4518
|
-
});
|
|
4519
|
-
items = [
|
|
4520
|
-
{
|
|
4521
|
-
name: "In Stock",
|
|
4522
|
-
value: "> 0"
|
|
4523
|
-
}
|
|
4524
|
-
];
|
|
4525
|
-
} else {
|
|
4526
|
-
items = Object.keys(defaultFacetDistribution[value]).map((item) => {
|
|
4527
|
-
return {
|
|
4528
|
-
name: item,
|
|
4529
|
-
value: item,
|
|
4530
|
-
total: facetDistribution[value][item] || 0
|
|
4531
|
-
};
|
|
4532
|
-
});
|
|
4533
|
-
}
|
|
4534
|
-
return [value, items];
|
|
4535
|
-
})
|
|
4536
|
-
) : {}
|
|
4537
|
-
);
|
|
4696
|
+
setSearchFacetDistribution(facetDistribution);
|
|
4538
4697
|
};
|
|
4539
4698
|
const handleSearchResult = async (isRefreshPage = false, onSearch = false) => {
|
|
4540
4699
|
var _a2, _b2;
|
|
@@ -4640,6 +4799,37 @@ const ResultProduct = (props) => {
|
|
|
4640
4799
|
React__default.useEffect(() => {
|
|
4641
4800
|
handleAllowedFilter();
|
|
4642
4801
|
}, [allowedFilters, searchResultFacets, totalSearchResult]);
|
|
4802
|
+
let dataClickedFacets = [];
|
|
4803
|
+
let arrFacetSelected = [];
|
|
4804
|
+
Object.entries(clickedFacets).map((facet) => {
|
|
4805
|
+
var _a2, _b2;
|
|
4806
|
+
if ((facet == null ? void 0 : facet.length) && facet[1].length) {
|
|
4807
|
+
arrFacetSelected.push(facet[0]);
|
|
4808
|
+
let getName = facet[0];
|
|
4809
|
+
let isAdditionalFilter = ["variants.inventory_quantity"].includes(getName);
|
|
4810
|
+
if (isAdditionalFilter)
|
|
4811
|
+
return;
|
|
4812
|
+
let isRange = ["variants.price"].includes(getName);
|
|
4813
|
+
let getAllowedFilterOne = allowedFilter.filter(({ value }) => value == null ? void 0 : value.includes(getName));
|
|
4814
|
+
let getLabel = (getAllowedFilterOne == null ? void 0 : getAllowedFilterOne.length) ? getAllowedFilterOne[0].label : getName;
|
|
4815
|
+
let items = Array.isArray(facet[1]) && ((_a2 = facet[1]) == null ? void 0 : _a2.length) > 1 ? isRange ? dataClickedFacets.push({
|
|
4816
|
+
label: getLabel,
|
|
4817
|
+
name: getName,
|
|
4818
|
+
value: facet[1]
|
|
4819
|
+
}) : (_b2 = facet[1]) == null ? void 0 : _b2.map((item) => {
|
|
4820
|
+
dataClickedFacets.push({
|
|
4821
|
+
label: getLabel,
|
|
4822
|
+
name: getName,
|
|
4823
|
+
value: item
|
|
4824
|
+
});
|
|
4825
|
+
}) : dataClickedFacets.push({
|
|
4826
|
+
label: getLabel,
|
|
4827
|
+
name: getName,
|
|
4828
|
+
value: facet[1][0]
|
|
4829
|
+
});
|
|
4830
|
+
return items;
|
|
4831
|
+
}
|
|
4832
|
+
});
|
|
4643
4833
|
const facetBlockSelected = ({ label, name, value, index }) => {
|
|
4644
4834
|
var _a2;
|
|
4645
4835
|
let valueText = value;
|
|
@@ -4663,9 +4853,17 @@ const ResultProduct = (props) => {
|
|
|
4663
4853
|
) }) })
|
|
4664
4854
|
] }, index);
|
|
4665
4855
|
};
|
|
4856
|
+
const handleConditionUpdateFacetDistribution = (value) => {
|
|
4857
|
+
let isHasFacetSelected = arrFacetSelected == null ? void 0 : arrFacetSelected.length;
|
|
4858
|
+
let isOnFacetSelectedOne = arrFacetSelected.includes(value) && (arrFacetSelected == null ? void 0 : arrFacetSelected.length) === 1;
|
|
4859
|
+
let isPriorityFacetClicked = ["vendor"].includes(value);
|
|
4860
|
+
return !(arrFacetSelected == null ? void 0 : arrFacetSelected.length) || isHasFacetSelected && (isPriorityFacetClicked || isOnFacetSelectedOne);
|
|
4861
|
+
};
|
|
4666
4862
|
const facetComponent = (filter) => {
|
|
4667
4863
|
var _a2, _b2;
|
|
4668
4864
|
const { value, label, display } = filter;
|
|
4865
|
+
if (isFirstLoading)
|
|
4866
|
+
return null;
|
|
4669
4867
|
let blockComponent = null;
|
|
4670
4868
|
let items = searchResultFacets[value];
|
|
4671
4869
|
let isShowNumberMatchingProduct = (_a2 = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a2.show_number_matching_product;
|
|
@@ -4683,19 +4881,22 @@ const ResultProduct = (props) => {
|
|
|
4683
4881
|
},
|
|
4684
4882
|
max: items == null ? void 0 : items.max,
|
|
4685
4883
|
step: 1,
|
|
4686
|
-
setValueCommit: (valueCommit) =>
|
|
4687
|
-
|
|
4884
|
+
setValueCommit: (valueCommit) => {
|
|
4885
|
+
setValueFilterPriceChange(valueCommit);
|
|
4886
|
+
handleFilterChange(value, valueCommit);
|
|
4887
|
+
}
|
|
4688
4888
|
}
|
|
4689
4889
|
),
|
|
4690
4890
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-list-slider-minmax", children: [
|
|
4691
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children:
|
|
4692
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children:
|
|
4891
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children: defaultValueMin }),
|
|
4892
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-minmax-field", children: defaultValueMax })
|
|
4693
4893
|
] })
|
|
4694
4894
|
] });
|
|
4695
4895
|
} else if (display.toLowerCase() === "checkbox" && (items == null ? void 0 : items.length)) {
|
|
4696
4896
|
blockComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: items == null ? void 0 : items.map((item, index) => {
|
|
4697
4897
|
var _a3;
|
|
4698
4898
|
let labelName = item.name;
|
|
4899
|
+
let labelTotal = handleConditionUpdateFacetDistribution(value) ? (item == null ? void 0 : item.total) || 0 : searchFacetDistribution[value] && searchFacetDistribution[value][item.value] ? searchFacetDistribution[value][item.value] : 0;
|
|
4699
4900
|
if (languageSettings && (languageSettings[item.value] || languageSettings[item.name]))
|
|
4700
4901
|
labelName = languageSettings[item.value] || languageSettings[item.name];
|
|
4701
4902
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -4704,9 +4905,9 @@ const ResultProduct = (props) => {
|
|
|
4704
4905
|
id: `${value}_${index}`,
|
|
4705
4906
|
name: value,
|
|
4706
4907
|
value: item.value,
|
|
4707
|
-
label: `${labelName}${
|
|
4908
|
+
label: `${labelName}${labelTotal !== void 0 && isShowNumberMatchingProduct ? ` (${labelTotal})` : ""}`,
|
|
4708
4909
|
onClick: (e) => handleFilterChange(value, e.currentTarget.value),
|
|
4709
|
-
checked: clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value)),
|
|
4910
|
+
checked: Boolean(clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value))),
|
|
4710
4911
|
labelStyle: filter_option_style
|
|
4711
4912
|
}
|
|
4712
4913
|
) }, index);
|
|
@@ -4719,13 +4920,14 @@ const ResultProduct = (props) => {
|
|
|
4719
4920
|
name: value,
|
|
4720
4921
|
onValueChange: (getValue) => handleFilterChange(value, getValue, true),
|
|
4721
4922
|
items: items == null ? void 0 : items.map((item) => {
|
|
4722
|
-
const { name, value:
|
|
4923
|
+
const { name, value: itemValue, total } = item;
|
|
4924
|
+
let labelTotal = handleConditionUpdateFacetDistribution(value) ? total || 0 : searchFacetDistribution[value] && searchFacetDistribution[value][itemValue] ? searchFacetDistribution[value][itemValue] : 0;
|
|
4723
4925
|
let labelName = name;
|
|
4724
|
-
if (languageSettings && (languageSettings[
|
|
4725
|
-
labelName = languageSettings[
|
|
4926
|
+
if (languageSettings && (languageSettings[itemValue] || languageSettings[name]))
|
|
4927
|
+
labelName = languageSettings[itemValue] || languageSettings[name];
|
|
4726
4928
|
return {
|
|
4727
|
-
label: `${labelName} ${
|
|
4728
|
-
value:
|
|
4929
|
+
label: `${labelName} ${labelTotal !== void 0 && isShowNumberMatchingProduct ? ` (${labelTotal})` : ""}`,
|
|
4930
|
+
value: itemValue
|
|
4729
4931
|
};
|
|
4730
4932
|
}),
|
|
4731
4933
|
defaultValue: clickedFacets && ((_b2 = clickedFacets[value]) == null ? void 0 : _b2.length) ? clickedFacets[value][0] : "",
|
|
@@ -4740,13 +4942,14 @@ const ResultProduct = (props) => {
|
|
|
4740
4942
|
name: value,
|
|
4741
4943
|
onValueChange: (getValue) => handleFilterChange(value, getValue, true),
|
|
4742
4944
|
items: items == null ? void 0 : items.map((item) => {
|
|
4743
|
-
const { name, value:
|
|
4945
|
+
const { name, value: itemValue, total } = item;
|
|
4946
|
+
let labelTotal = handleConditionUpdateFacetDistribution(value) ? total || 0 : searchFacetDistribution[value] && searchFacetDistribution[value][itemValue] ? searchFacetDistribution[value][itemValue] : 0;
|
|
4744
4947
|
let labelName = name;
|
|
4745
|
-
if (languageSettings && (languageSettings[
|
|
4746
|
-
labelName = languageSettings[
|
|
4948
|
+
if (languageSettings && (languageSettings[itemValue] || languageSettings[name]))
|
|
4949
|
+
labelName = languageSettings[itemValue] || languageSettings[name];
|
|
4747
4950
|
return {
|
|
4748
|
-
label: `${labelName} ${
|
|
4749
|
-
value:
|
|
4951
|
+
label: `${labelName} ${labelTotal !== void 0 && isShowNumberMatchingProduct ? ` (${labelTotal})` : ""}`,
|
|
4952
|
+
value: itemValue
|
|
4750
4953
|
};
|
|
4751
4954
|
}),
|
|
4752
4955
|
labelStyle: filter_option_style
|
|
@@ -4765,7 +4968,7 @@ const ResultProduct = (props) => {
|
|
|
4765
4968
|
rgb: getColorSwatch == null ? void 0 : getColorSwatch.rgb,
|
|
4766
4969
|
image: getColorSwatch == null ? void 0 : getColorSwatch.image,
|
|
4767
4970
|
onClick: (e) => handleFilterChange(value, e.currentTarget.value),
|
|
4768
|
-
defaultChecked: clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value))
|
|
4971
|
+
defaultChecked: Boolean(clickedFacets && ((_a3 = clickedFacets[value]) == null ? void 0 : _a3.includes(item.value)))
|
|
4769
4972
|
}
|
|
4770
4973
|
) }, index);
|
|
4771
4974
|
}) });
|
|
@@ -4776,7 +4979,6 @@ const ResultProduct = (props) => {
|
|
|
4776
4979
|
const { value, label, display } = filter;
|
|
4777
4980
|
let items = searchResultFacets[value];
|
|
4778
4981
|
let isRender = Boolean(display.toLowerCase() === "slider" ? items : items == null ? void 0 : items.length);
|
|
4779
|
-
let isNotRerender = ["select"].includes(display.toLowerCase()) && (items == null ? void 0 : items.length);
|
|
4780
4982
|
let classesUlElement = ["sledge-instant-search__result-filter-item-list"];
|
|
4781
4983
|
let getFacetComponent = facetComponent(filter);
|
|
4782
4984
|
if (display.toLowerCase() === "swatch" && (items == null ? void 0 : items.length)) {
|
|
@@ -4787,7 +4989,7 @@ const ResultProduct = (props) => {
|
|
|
4787
4989
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-filter-title", style: filter_title_style, children: label }),
|
|
4788
4990
|
/* @__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" }) })
|
|
4789
4991
|
] }),
|
|
4790
|
-
clickedOpenFilters.includes(value) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children:
|
|
4992
|
+
clickedOpenFilters.includes(value) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children: getFacetComponent })
|
|
4791
4993
|
] }, indexFilter) : null;
|
|
4792
4994
|
});
|
|
4793
4995
|
const filterHorizontalComponents = allowedFilter.map((filter, indexFilter) => {
|
|
@@ -4795,7 +4997,6 @@ const ResultProduct = (props) => {
|
|
|
4795
4997
|
let isActive = clickedOpenFilterId === value;
|
|
4796
4998
|
let items = searchResultFacets[value];
|
|
4797
4999
|
let isRender = Boolean(display.toLowerCase() === "slider" ? items : items == null ? void 0 : items.length);
|
|
4798
|
-
let isNotRerender = ["radio", "select"].includes(display.toLowerCase()) && (items == null ? void 0 : items.length);
|
|
4799
5000
|
let classesUlElement = ["sledge-instant-search__result-filter-item-list"];
|
|
4800
5001
|
let getFacetComponent = facetComponent(filter);
|
|
4801
5002
|
if (display.toLowerCase() === "swatch" && (items == null ? void 0 : items.length)) {
|
|
@@ -4817,7 +5018,7 @@ const ResultProduct = (props) => {
|
|
|
4817
5018
|
]
|
|
4818
5019
|
}
|
|
4819
5020
|
),
|
|
4820
|
-
content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-facet", children: isActive && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children:
|
|
5021
|
+
content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-facet", children: isActive && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: classesUlElement.join(" "), children: getFacetComponent }) }),
|
|
4821
5022
|
withOpenState: false,
|
|
4822
5023
|
setIsOpen: (open) => setClickedOpenFilterId(!open ? "" : value),
|
|
4823
5024
|
hideCloseIcon: true,
|
|
@@ -4827,39 +5028,10 @@ const ResultProduct = (props) => {
|
|
|
4827
5028
|
}
|
|
4828
5029
|
) }, indexFilter) : null;
|
|
4829
5030
|
});
|
|
4830
|
-
let dataClickedFacets = [];
|
|
4831
|
-
Object.entries(clickedFacets).map((facet) => {
|
|
4832
|
-
var _a2, _b2;
|
|
4833
|
-
if ((facet == null ? void 0 : facet.length) && facet[1].length) {
|
|
4834
|
-
let getName = facet[0];
|
|
4835
|
-
let isAdditionalFilter = ["variants.inventory_quantity"].includes(getName);
|
|
4836
|
-
if (isAdditionalFilter)
|
|
4837
|
-
return;
|
|
4838
|
-
let isRange = ["variants.price"].includes(getName);
|
|
4839
|
-
let getAllowedFilterOne = allowedFilter.filter(({ value }) => value == null ? void 0 : value.includes(getName));
|
|
4840
|
-
let getLabel = (getAllowedFilterOne == null ? void 0 : getAllowedFilterOne.length) ? getAllowedFilterOne[0].label : getName;
|
|
4841
|
-
let items = Array.isArray(facet[1]) && ((_a2 = facet[1]) == null ? void 0 : _a2.length) > 1 ? isRange ? dataClickedFacets.push({
|
|
4842
|
-
label: getLabel,
|
|
4843
|
-
name: getName,
|
|
4844
|
-
value: facet[1]
|
|
4845
|
-
}) : (_b2 = facet[1]) == null ? void 0 : _b2.map((item) => {
|
|
4846
|
-
dataClickedFacets.push({
|
|
4847
|
-
label: getLabel,
|
|
4848
|
-
name: getName,
|
|
4849
|
-
value: item
|
|
4850
|
-
});
|
|
4851
|
-
}) : dataClickedFacets.push({
|
|
4852
|
-
label: getLabel,
|
|
4853
|
-
name: getName,
|
|
4854
|
-
value: facet[1][0]
|
|
4855
|
-
});
|
|
4856
|
-
return items;
|
|
4857
|
-
}
|
|
4858
|
-
});
|
|
4859
5031
|
const paginationComponent = /* @__PURE__ */ jsxRuntimeExports.jsx(Pagination, { currentPage, totalPage, totalResult: totalSearchResult, onChange: (page) => handlePageChange(page), pageInfo: language_pagination_info });
|
|
4860
|
-
const filterHorizontalBlockComponent = ((
|
|
5032
|
+
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: [
|
|
4861
5033
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal sledge-instant-search__result-filter-horizontal-component", children: filterHorizontalComponents }),
|
|
4862
|
-
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((
|
|
5034
|
+
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: [
|
|
4863
5035
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4864
5036
|
"div",
|
|
4865
5037
|
{
|
|
@@ -4880,10 +5052,10 @@ const ResultProduct = (props) => {
|
|
|
4880
5052
|
] }) : null
|
|
4881
5053
|
] }) }) }) : null;
|
|
4882
5054
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4883
|
-
((
|
|
4884
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-wrapper", "data-filter-layout": (
|
|
4885
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: ((
|
|
4886
|
-
Boolean((dataClickedFacets == null ? void 0 : dataClickedFacets.length) && ((
|
|
5055
|
+
((_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,
|
|
5056
|
+
/* @__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: [
|
|
5057
|
+
/* @__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: [
|
|
5058
|
+
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: [
|
|
4887
5059
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-title-refine", children: [
|
|
4888
5060
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { className: "sledge-instant-search__result-filter-item-title-refine-heading", children: language_filter || "Filter" }),
|
|
4889
5061
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__result-filter-item-title-refine-clear", onClick: handleFilterReset, children: language_clear_filter || "Clear All" })
|
|
@@ -4903,7 +5075,7 @@ const ResultProduct = (props) => {
|
|
|
4903
5075
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-data", children: [
|
|
4904
5076
|
isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4905
5077
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__hide-element-mobile-on-lg", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-data-keyword", children: [
|
|
4906
|
-
((
|
|
5078
|
+
((_s = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _s.show_total_products) ? summaryTextSkeleton : null,
|
|
4907
5079
|
searchFieldSkeletonComponent,
|
|
4908
5080
|
filterHorizontalSkeletonComponent,
|
|
4909
5081
|
selectOptionSkeletonComponent
|
|
@@ -4913,7 +5085,7 @@ const ResultProduct = (props) => {
|
|
|
4913
5085
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4914
5086
|
"div",
|
|
4915
5087
|
{
|
|
4916
|
-
className: `sledge-instant-search__result-data-summary sledge-instant-search__result-data-summary-filter-horizontal ${((
|
|
5088
|
+
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"}`,
|
|
4917
5089
|
children: summaryText
|
|
4918
5090
|
}
|
|
4919
5091
|
),
|
|
@@ -4965,7 +5137,7 @@ const ResultProduct = (props) => {
|
|
|
4965
5137
|
language_limit || "Limit",
|
|
4966
5138
|
":"
|
|
4967
5139
|
] }),
|
|
4968
|
-
((
|
|
5140
|
+
((_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(
|
|
4969
5141
|
SelectField,
|
|
4970
5142
|
{
|
|
4971
5143
|
align: "end",
|
|
@@ -4986,7 +5158,7 @@ const ResultProduct = (props) => {
|
|
|
4986
5158
|
productGridSkeleton,
|
|
4987
5159
|
(searchResult == null ? void 0 : searchResult.length) ? paginationComponent : null
|
|
4988
5160
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4989
|
-
((
|
|
5161
|
+
((_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 }) }),
|
|
4990
5162
|
(searchResult == null ? void 0 : searchResult.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4991
5163
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4992
5164
|
ProductGrid,
|
|
@@ -5001,9 +5173,9 @@ const ResultProduct = (props) => {
|
|
|
5001
5173
|
};
|
|
5002
5174
|
}),
|
|
5003
5175
|
setting: {
|
|
5004
|
-
show_vendor: (
|
|
5005
|
-
show_sku: (
|
|
5006
|
-
show_price: (
|
|
5176
|
+
show_vendor: (_y = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _y.show_vendor,
|
|
5177
|
+
show_sku: (_z = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _z.show_sku,
|
|
5178
|
+
show_price: (_A = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _A.show_price,
|
|
5007
5179
|
language_button_add_to_cart: language_add_to_cart,
|
|
5008
5180
|
language_button_out_of_stock: languageSettings && languageSettings["out of stock"] ? languageSettings["out of stock"] : ""
|
|
5009
5181
|
},
|