@sledge-app/react-instant-search 0.0.32 → 0.0.34
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/Global/OtherIndexLists.d.ts +7 -0
- package/dist/components/Global/OtherIndexLists.d.ts.map +1 -0
- package/dist/components/Global/SearchViewMoreResult.d.ts +6 -0
- package/dist/components/Global/SearchViewMoreResult.d.ts.map +1 -0
- package/dist/components/Global/SuggestionKeywordLists.d.ts +6 -0
- package/dist/components/Global/SuggestionKeywordLists.d.ts.map +1 -0
- package/dist/components/Global/index.d.ts +19 -0
- package/dist/components/Global/index.d.ts.map +1 -0
- package/dist/components/ProductFilterWidget/ProductFilterWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidget.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetInitSelector.d.ts.map +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetPopup.d.ts +1 -1
- package/dist/components/SearchIconWidget/SearchIconWidgetPopup.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/SearchWidget.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 +110 -59
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,8 @@ const SEPARATE_COMPONENT_DISPLAY_NAME = {
|
|
|
21
21
|
CARDS: "ProductCards"
|
|
22
22
|
},
|
|
23
23
|
SUGGESTION_KEYWORD_LISTS: "SuggestionKeywordLists",
|
|
24
|
-
OTHER_INDEX_LISTS: "OtherIndexLists"
|
|
24
|
+
OTHER_INDEX_LISTS: "OtherIndexLists",
|
|
25
|
+
SEARCH_VIEW_MORE_RESULT: "SearchViewMoreResult"
|
|
25
26
|
};
|
|
26
27
|
const sanitizeDataId = (id) => {
|
|
27
28
|
if (!id)
|
|
@@ -1640,6 +1641,7 @@ const ProductGrid = ({
|
|
|
1640
1641
|
showOptionOutOfStock = false,
|
|
1641
1642
|
triggerPropAdditional,
|
|
1642
1643
|
sourceApp = null,
|
|
1644
|
+
isComponentJsVersion = false,
|
|
1643
1645
|
cards,
|
|
1644
1646
|
onAfterAddToCart,
|
|
1645
1647
|
onAfterAddWishlist,
|
|
@@ -1714,7 +1716,7 @@ const ProductGrid = ({
|
|
|
1714
1716
|
const { id: variant_id = "", title: variant_title = "", price = "", sku = "" } = (variants == null ? void 0 : variants.length) ? variants[0] : {};
|
|
1715
1717
|
let isLoadingAddToCart = clickedAddToCartId == variant_id;
|
|
1716
1718
|
let isOutOfStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? !variants[0].inventory_quantity && showOptionOutOfStock : false;
|
|
1717
|
-
|
|
1719
|
+
const getCards = cards ? cards({
|
|
1718
1720
|
product: {
|
|
1719
1721
|
...product,
|
|
1720
1722
|
...{
|
|
@@ -1727,7 +1729,8 @@ const ProductGrid = ({
|
|
|
1727
1729
|
})
|
|
1728
1730
|
}
|
|
1729
1731
|
}
|
|
1730
|
-
})
|
|
1732
|
+
}) : null;
|
|
1733
|
+
return cards ? /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: getCards } }) : getCards }, index) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card", children: [
|
|
1731
1734
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-content", children: [
|
|
1732
1735
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-image", children: [
|
|
1733
1736
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -2189,9 +2192,12 @@ const SearchIconWidget = (props) => {
|
|
|
2189
2192
|
let productCardsComponent = null;
|
|
2190
2193
|
let suggestionKeywordListsComponent = null;
|
|
2191
2194
|
let otherIndexListsComponent = null;
|
|
2195
|
+
let searchViewMoreResultComponent = null;
|
|
2196
|
+
let separateJsVersionComponent = false;
|
|
2192
2197
|
React__default.Children.map(children, (child) => {
|
|
2193
2198
|
if (React__default.isValidElement(child) && isFunction(child.type)) {
|
|
2194
|
-
const { component } = (child == null ? void 0 : child.props) || {};
|
|
2199
|
+
const { component, isJsVersion } = (child == null ? void 0 : child.props) || {};
|
|
2200
|
+
separateJsVersionComponent = isJsVersion;
|
|
2195
2201
|
switch (child.type.name) {
|
|
2196
2202
|
case SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS:
|
|
2197
2203
|
productCardsComponent = component;
|
|
@@ -2202,6 +2208,9 @@ const SearchIconWidget = (props) => {
|
|
|
2202
2208
|
case SEPARATE_COMPONENT_DISPLAY_NAME.OTHER_INDEX_LISTS:
|
|
2203
2209
|
otherIndexListsComponent = component;
|
|
2204
2210
|
break;
|
|
2211
|
+
case SEPARATE_COMPONENT_DISPLAY_NAME.SEARCH_VIEW_MORE_RESULT:
|
|
2212
|
+
searchViewMoreResultComponent = component;
|
|
2213
|
+
break;
|
|
2205
2214
|
}
|
|
2206
2215
|
}
|
|
2207
2216
|
});
|
|
@@ -2237,16 +2246,33 @@ const SearchIconWidget = (props) => {
|
|
|
2237
2246
|
onAfterAddWishlist,
|
|
2238
2247
|
onAfterRemoveWishlist,
|
|
2239
2248
|
onAfterRenderProduct,
|
|
2249
|
+
separateJsVersionComponent,
|
|
2240
2250
|
productCardsComponent,
|
|
2241
2251
|
suggestionKeywordListsComponent,
|
|
2242
|
-
otherIndexListsComponent
|
|
2252
|
+
otherIndexListsComponent,
|
|
2253
|
+
searchViewMoreResultComponent
|
|
2243
2254
|
);
|
|
2244
2255
|
};
|
|
2245
2256
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-instant-search__icon-widget", onClick: handleShowWidget, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { ...sizing, color: "currentColor" }) });
|
|
2246
2257
|
};
|
|
2247
2258
|
const SearchIconWidgetPopup$1 = "";
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2259
|
+
const OtherIndexLists = ({ listsComponent, name, items, isComponentJsVersion = false }) => {
|
|
2260
|
+
const getListsComponent = listsComponent ? listsComponent({ name, items }) : null;
|
|
2261
|
+
return listsComponent ? isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: getListsComponent } }) : getListsComponent : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
2262
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: name }),
|
|
2263
|
+
(items == null ? void 0 : items.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: items.map((hit, index) => {
|
|
2264
|
+
const { title, url } = hit;
|
|
2265
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, className: "sledge-instant-search__icon-widget-search-form-result-list-link", children: title }) }, index);
|
|
2266
|
+
}) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: [
|
|
2267
|
+
"No ",
|
|
2268
|
+
name == null ? void 0 : name.toLowerCase(),
|
|
2269
|
+
" were found"
|
|
2270
|
+
] }) })
|
|
2271
|
+
] });
|
|
2272
|
+
};
|
|
2273
|
+
const SuggestionKeywordLists = ({ listsComponent, keywords, isComponentJsVersion = false }) => {
|
|
2274
|
+
const getListsComponent = listsComponent ? listsComponent({ keywords }) : null;
|
|
2275
|
+
return listsComponent ? isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: getListsComponent } }) : getListsComponent : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
2250
2276
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: "Suggestions" }),
|
|
2251
2277
|
/* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: keywords == null ? void 0 : keywords.map((keyword, index) => {
|
|
2252
2278
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
@@ -2264,18 +2290,14 @@ const RenderSuggestionKeywordLists = ({ listsComponent, keywords }) => {
|
|
|
2264
2290
|
}) })
|
|
2265
2291
|
] });
|
|
2266
2292
|
};
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
name == null ? void 0 : name.toLowerCase(),
|
|
2276
|
-
" were found"
|
|
2277
|
-
] }) })
|
|
2278
|
-
] });
|
|
2293
|
+
const SearchViewMoreResult = ({ component, keyword, isComponentJsVersion = false }) => {
|
|
2294
|
+
const getComponent = component ? component({ keyword }) : null;
|
|
2295
|
+
return component ? isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: getComponent } }) : getComponent : /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: `${SEARCH_RESULT_URL}?q=${keyword}`, className: "sledge-instant-search__icon-widget-button-more", children: "View More Result" });
|
|
2296
|
+
};
|
|
2297
|
+
const Global = {
|
|
2298
|
+
OtherIndexLists,
|
|
2299
|
+
SuggestionKeywordLists,
|
|
2300
|
+
SearchViewMoreResult
|
|
2279
2301
|
};
|
|
2280
2302
|
const SearchIconWidgetPopup = () => {
|
|
2281
2303
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
@@ -2299,9 +2321,11 @@ const SearchIconWidgetPopup = () => {
|
|
|
2299
2321
|
},
|
|
2300
2322
|
onAfterRenderProduct: (state) => {
|
|
2301
2323
|
},
|
|
2324
|
+
separateJsVersionComponent: null,
|
|
2302
2325
|
productCardsComponent: null,
|
|
2303
2326
|
suggestionKeywordListsComponent: null,
|
|
2304
|
-
otherIndexListsComponent: null
|
|
2327
|
+
otherIndexListsComponent: null,
|
|
2328
|
+
searchViewMoreResultComponent: null
|
|
2305
2329
|
});
|
|
2306
2330
|
const searchFieldRef = React__default.useRef(null);
|
|
2307
2331
|
const previousState = usePrevious({ keyword });
|
|
@@ -2390,9 +2414,10 @@ const SearchIconWidgetPopup = () => {
|
|
|
2390
2414
|
}, onAfterAddWishlist = () => {
|
|
2391
2415
|
}, onAfterRemoveWishlist = () => {
|
|
2392
2416
|
}, onAfterRenderProduct = () => {
|
|
2393
|
-
}, productCardsComponent = () => {
|
|
2417
|
+
}, separateJsVersionComponent = null, productCardsComponent = () => {
|
|
2394
2418
|
}, suggestionKeywordListsComponent = () => {
|
|
2395
2419
|
}, otherIndexListsComponent = () => {
|
|
2420
|
+
}, searchViewMoreResultComponent = () => {
|
|
2396
2421
|
}) => {
|
|
2397
2422
|
setShowInfo(true);
|
|
2398
2423
|
setHandleFunctions({
|
|
@@ -2400,9 +2425,11 @@ const SearchIconWidgetPopup = () => {
|
|
|
2400
2425
|
onAfterAddWishlist,
|
|
2401
2426
|
onAfterRemoveWishlist,
|
|
2402
2427
|
onAfterRenderProduct,
|
|
2428
|
+
separateJsVersionComponent,
|
|
2403
2429
|
productCardsComponent,
|
|
2404
2430
|
suggestionKeywordListsComponent,
|
|
2405
|
-
otherIndexListsComponent
|
|
2431
|
+
otherIndexListsComponent,
|
|
2432
|
+
searchViewMoreResultComponent
|
|
2406
2433
|
});
|
|
2407
2434
|
setTimeout(() => {
|
|
2408
2435
|
if (searchFieldRef == null ? void 0 : searchFieldRef.current) {
|
|
@@ -2484,15 +2511,24 @@ const SearchIconWidgetPopup = () => {
|
|
|
2484
2511
|
] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex", children: [
|
|
2485
2512
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex-item-other", children: [
|
|
2486
2513
|
Object.keys(suggestionSettings).length && ((_c = (_b = suggestionSettings[suggestionIndex]) == null ? void 0 : _b.keywords) == null ? void 0 : _c.active) && ((_f = (_e = (_d = suggestionSettings[suggestionIndex]) == null ? void 0 : _d.keywords) == null ? void 0 : _e.list) == null ? void 0 : _f.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2487
|
-
|
|
2514
|
+
Global.SuggestionKeywordLists,
|
|
2488
2515
|
{
|
|
2489
2516
|
listsComponent: handleFunctions.suggestionKeywordListsComponent,
|
|
2490
|
-
keywords: suggestionSettings[suggestionIndex].keywords.list
|
|
2517
|
+
keywords: suggestionSettings[suggestionIndex].keywords.list,
|
|
2518
|
+
isComponentJsVersion: handleFunctions.separateJsVersionComponent
|
|
2491
2519
|
}
|
|
2492
2520
|
) : null,
|
|
2493
2521
|
searchResultOther && searchResultOther.map((item, index) => {
|
|
2494
2522
|
const { hits, name } = item;
|
|
2495
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2523
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2524
|
+
Global.OtherIndexLists,
|
|
2525
|
+
{
|
|
2526
|
+
listsComponent: handleFunctions.otherIndexListsComponent,
|
|
2527
|
+
name,
|
|
2528
|
+
items: hits,
|
|
2529
|
+
isComponentJsVersion: handleFunctions.separateJsVersionComponent
|
|
2530
|
+
}
|
|
2531
|
+
) }, index);
|
|
2496
2532
|
})
|
|
2497
2533
|
] }),
|
|
2498
2534
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-flex-item-product", children: [
|
|
@@ -2514,6 +2550,7 @@ const SearchIconWidgetPopup = () => {
|
|
|
2514
2550
|
show_price: (_i = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _i.show_price
|
|
2515
2551
|
},
|
|
2516
2552
|
showOptionOutOfStock: true,
|
|
2553
|
+
isComponentJsVersion: handleFunctions.separateJsVersionComponent,
|
|
2517
2554
|
cards: handleFunctions.productCardsComponent,
|
|
2518
2555
|
onAfterAddToCart: handleFunctions.onAfterAddToCart,
|
|
2519
2556
|
onAfterAddWishlist: handleFunctions.onAfterAddWishlist,
|
|
@@ -2545,6 +2582,7 @@ const SearchIconWidgetPopup = () => {
|
|
|
2545
2582
|
show_price: (_q = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _q.show_price
|
|
2546
2583
|
},
|
|
2547
2584
|
showOptionOutOfStock: true,
|
|
2585
|
+
isComponentJsVersion: handleFunctions.separateJsVersionComponent,
|
|
2548
2586
|
cards: handleFunctions.productCardsComponent,
|
|
2549
2587
|
onAfterAddToCart: handleFunctions.onAfterAddToCart,
|
|
2550
2588
|
onAfterAddWishlist: handleFunctions.onAfterAddWishlist,
|
|
@@ -2556,7 +2594,14 @@ const SearchIconWidgetPopup = () => {
|
|
|
2556
2594
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: "Products" }),
|
|
2557
2595
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-item-disabled", children: "No product were found" })
|
|
2558
2596
|
] }),
|
|
2559
|
-
(searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_s = (_r = suggestionSettings[suggestionIndex]) == null ? void 0 : _r.products) == null ? void 0 : _s.active) && ((_v = (_u = (_t = suggestionSettings[suggestionIndex]) == null ? void 0 : _t.products) == null ? void 0 : _u.list) == null ? void 0 : _v.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2597
|
+
(searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_s = (_r = suggestionSettings[suggestionIndex]) == null ? void 0 : _r.products) == null ? void 0 : _s.active) && ((_v = (_u = (_t = suggestionSettings[suggestionIndex]) == null ? void 0 : _t.products) == null ? void 0 : _u.list) == null ? void 0 : _v.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2598
|
+
Global.SearchViewMoreResult,
|
|
2599
|
+
{
|
|
2600
|
+
component: handleFunctions.searchViewMoreResultComponent,
|
|
2601
|
+
keyword,
|
|
2602
|
+
isComponentJsVersion: handleFunctions.separateJsVersionComponent
|
|
2603
|
+
}
|
|
2604
|
+
) }) : null
|
|
2560
2605
|
] })
|
|
2561
2606
|
] }) }) }) })
|
|
2562
2607
|
] })
|
|
@@ -2569,10 +2614,12 @@ const SearchResultWidget = (props) => {
|
|
|
2569
2614
|
const { keyword: queryKeyword = "" } = query || {};
|
|
2570
2615
|
const { collectionId } = data || {};
|
|
2571
2616
|
let productCardsComponent = null;
|
|
2617
|
+
let separateJsVersionComponent = false;
|
|
2572
2618
|
React__default.Children.map(children, (child) => {
|
|
2573
2619
|
if (React__default.isValidElement(child) && isFunction(child.type) && child.type.name === SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS) {
|
|
2574
|
-
const { component } = (child == null ? void 0 : child.props) || {};
|
|
2620
|
+
const { component, isJsVersion } = (child == null ? void 0 : child.props) || {};
|
|
2575
2621
|
productCardsComponent = component;
|
|
2622
|
+
separateJsVersionComponent = isJsVersion;
|
|
2576
2623
|
}
|
|
2577
2624
|
});
|
|
2578
2625
|
const { isRenderApp } = React__default.useContext(SledgeContext);
|
|
@@ -3040,6 +3087,7 @@ const SearchResultWidget = (props) => {
|
|
|
3040
3087
|
defaultSort,
|
|
3041
3088
|
showOutOfStock,
|
|
3042
3089
|
data,
|
|
3090
|
+
separateJsVersionComponent,
|
|
3043
3091
|
productCardsComponent,
|
|
3044
3092
|
onAfterAddToCart,
|
|
3045
3093
|
onAfterAddWishlist,
|
|
@@ -3070,6 +3118,7 @@ const ResultProduct = (props) => {
|
|
|
3070
3118
|
defaultSort,
|
|
3071
3119
|
showOutOfStock,
|
|
3072
3120
|
data,
|
|
3121
|
+
separateJsVersionComponent,
|
|
3073
3122
|
productCardsComponent,
|
|
3074
3123
|
setKeyword,
|
|
3075
3124
|
filterHorizontalSkeleton,
|
|
@@ -3633,6 +3682,7 @@ const ResultProduct = (props) => {
|
|
|
3633
3682
|
show_sku: (_s = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _s.show_sku,
|
|
3634
3683
|
show_price: (_t = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _t.show_price
|
|
3635
3684
|
},
|
|
3685
|
+
isComponentJsVersion: separateJsVersionComponent,
|
|
3636
3686
|
cards: productCardsComponent,
|
|
3637
3687
|
showOptionOutOfStock: true,
|
|
3638
3688
|
onAfterAddToCart,
|
|
@@ -3783,10 +3833,28 @@ const SearchWidget = (props) => {
|
|
|
3783
3833
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
3784
3834
|
const { width = "400px", children, onAfterAddToCart, onAfterAddWishlist, onAfterRemoveWishlist, onAfterRenderProduct } = props;
|
|
3785
3835
|
let productCardsComponent = null;
|
|
3836
|
+
let suggestionKeywordListsComponent = null;
|
|
3837
|
+
let otherIndexListsComponent = null;
|
|
3838
|
+
let searchViewMoreResultComponent = null;
|
|
3839
|
+
let separateJsVersionComponent = false;
|
|
3786
3840
|
React__default.Children.map(children, (child) => {
|
|
3787
|
-
if (React__default.isValidElement(child) && isFunction(child.type)
|
|
3788
|
-
const { component } = (child == null ? void 0 : child.props) || {};
|
|
3789
|
-
|
|
3841
|
+
if (React__default.isValidElement(child) && isFunction(child.type)) {
|
|
3842
|
+
const { component, isJsVersion } = (child == null ? void 0 : child.props) || {};
|
|
3843
|
+
separateJsVersionComponent = isJsVersion;
|
|
3844
|
+
switch (child.type.name) {
|
|
3845
|
+
case SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS:
|
|
3846
|
+
productCardsComponent = component;
|
|
3847
|
+
break;
|
|
3848
|
+
case SEPARATE_COMPONENT_DISPLAY_NAME.SUGGESTION_KEYWORD_LISTS:
|
|
3849
|
+
suggestionKeywordListsComponent = component;
|
|
3850
|
+
break;
|
|
3851
|
+
case SEPARATE_COMPONENT_DISPLAY_NAME.OTHER_INDEX_LISTS:
|
|
3852
|
+
otherIndexListsComponent = component;
|
|
3853
|
+
break;
|
|
3854
|
+
case SEPARATE_COMPONENT_DISPLAY_NAME.SEARCH_VIEW_MORE_RESULT:
|
|
3855
|
+
searchViewMoreResultComponent = component;
|
|
3856
|
+
break;
|
|
3857
|
+
}
|
|
3790
3858
|
}
|
|
3791
3859
|
});
|
|
3792
3860
|
const { isRenderApp } = React__default.useContext(SledgeContext);
|
|
@@ -3954,36 +4022,17 @@ const SearchWidget = (props) => {
|
|
|
3954
4022
|
] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { isLoading, withCorner: false, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3955
4023
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex", children: [
|
|
3956
4024
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex-item-other", children: [
|
|
3957
|
-
Object.keys(suggestionSettings).length && ((_b = (_a = suggestionSettings[suggestionIndex]) == null ? void 0 : _a.keywords) == null ? void 0 : _b.active) && ((_e = (_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.list) == null ? void 0 : _e.length) ? /* @__PURE__ */ jsxRuntimeExports.
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
children: [
|
|
3966
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { width: 12, height: 12, color: "#677487" }),
|
|
3967
|
-
" ",
|
|
3968
|
-
keyword2
|
|
3969
|
-
]
|
|
3970
|
-
}
|
|
3971
|
-
) }, index);
|
|
3972
|
-
}) })
|
|
3973
|
-
] }) : null,
|
|
4025
|
+
Object.keys(suggestionSettings).length && ((_b = (_a = suggestionSettings[suggestionIndex]) == null ? void 0 : _a.keywords) == null ? void 0 : _b.active) && ((_e = (_d = (_c = suggestionSettings[suggestionIndex]) == null ? void 0 : _c.keywords) == null ? void 0 : _d.list) == null ? void 0 : _e.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4026
|
+
Global.SuggestionKeywordLists,
|
|
4027
|
+
{
|
|
4028
|
+
listsComponent: suggestionKeywordListsComponent,
|
|
4029
|
+
keywords: suggestionSettings[suggestionIndex].keywords.list,
|
|
4030
|
+
isComponentJsVersion: separateJsVersionComponent
|
|
4031
|
+
}
|
|
4032
|
+
) : null,
|
|
3974
4033
|
searchResultOther.map((item, index) => {
|
|
3975
4034
|
const { hits, name } = item;
|
|
3976
|
-
return /* @__PURE__ */ jsxRuntimeExports.
|
|
3977
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-title", children: name }),
|
|
3978
|
-
(hits == null ? void 0 : hits.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__widget-search-form-result-list", children: hits.map((hit, index2) => {
|
|
3979
|
-
const { title, url } = hit;
|
|
3980
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, className: "sledge-instant-search__widget-search-form-result-list-link", children: title }) }, index2);
|
|
3981
|
-
}) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__widget-search-form-result-list", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { className: "sledge-instant-search__widget-search-form-result-item-disabled", children: [
|
|
3982
|
-
"No ",
|
|
3983
|
-
name.toLowerCase(),
|
|
3984
|
-
" were found"
|
|
3985
|
-
] }) })
|
|
3986
|
-
] }, index);
|
|
4035
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Global.OtherIndexLists, { listsComponent: otherIndexListsComponent, name, items: hits, isComponentJsVersion: separateJsVersionComponent }) }, index);
|
|
3987
4036
|
})
|
|
3988
4037
|
] }),
|
|
3989
4038
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__widget-search-form-result-flex-item-product", children: [
|
|
@@ -4006,6 +4055,7 @@ const SearchWidget = (props) => {
|
|
|
4006
4055
|
show_price: (_h = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _h.show_price
|
|
4007
4056
|
},
|
|
4008
4057
|
showOptionOutOfStock: true,
|
|
4058
|
+
isComponentJsVersion: separateJsVersionComponent,
|
|
4009
4059
|
cards: productCardsComponent,
|
|
4010
4060
|
onAfterAddToCart,
|
|
4011
4061
|
onAfterAddWishlist,
|
|
@@ -4038,6 +4088,7 @@ const SearchWidget = (props) => {
|
|
|
4038
4088
|
show_price: (_p = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _p.show_price
|
|
4039
4089
|
},
|
|
4040
4090
|
showOptionOutOfStock: true,
|
|
4091
|
+
isComponentJsVersion: separateJsVersionComponent,
|
|
4041
4092
|
cards: productCardsComponent,
|
|
4042
4093
|
onAfterAddToCart,
|
|
4043
4094
|
onAfterAddWishlist,
|
|
@@ -4048,7 +4099,7 @@ const SearchWidget = (props) => {
|
|
|
4048
4099
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-search-form-result-product-disabled", children: "No product were found" })
|
|
4049
4100
|
] })
|
|
4050
4101
|
] }),
|
|
4051
|
-
(searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_r = (_q = suggestionSettings[suggestionIndex]) == null ? void 0 : _q.products) == null ? void 0 : _r.active) && ((_u = (_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.list) == null ? void 0 : _u.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4102
|
+
(searchResultProduct == null ? void 0 : searchResultProduct.length) || Object.keys(suggestionSettings).length && ((_r = (_q = suggestionSettings[suggestionIndex]) == null ? void 0 : _q.products) == null ? void 0 : _r.active) && ((_u = (_t = (_s = suggestionSettings[suggestionIndex]) == null ? void 0 : _s.products) == null ? void 0 : _t.list) == null ? void 0 : _u.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__widget-button-more-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Global.SearchViewMoreResult, { component: searchViewMoreResultComponent, keyword, isComponentJsVersion: separateJsVersionComponent }) }) : null
|
|
4052
4103
|
] }) }) })
|
|
4053
4104
|
] });
|
|
4054
4105
|
};
|