@sledge-app/react-instant-search 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SearchResultWidget/SearchResultWidget.d.ts.map +1 -1
- package/dist/sledge-react-instant-search.cjs +1 -1
- package/dist/sledge-react-instant-search.cjs.map +1 -1
- package/dist/sledge-react-instant-search.js +116 -88
- package/dist/sledge-react-instant-search.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1737,14 +1737,18 @@ const addToCartTrigger$2 = async (data) => {
|
|
|
1737
1737
|
return;
|
|
1738
1738
|
});
|
|
1739
1739
|
};
|
|
1740
|
-
const wishlistInfo = async ({
|
|
1740
|
+
const wishlistInfo = async ({
|
|
1741
|
+
callback,
|
|
1742
|
+
wishlistPreviewSettings,
|
|
1743
|
+
generalPreviewSettings
|
|
1744
|
+
}) => {
|
|
1741
1745
|
var _a, _b;
|
|
1742
1746
|
let response;
|
|
1743
1747
|
let run = false;
|
|
1744
1748
|
let valueTotalWishlist;
|
|
1745
1749
|
let valueProxyUrl;
|
|
1746
1750
|
let queryParam = {
|
|
1747
|
-
...wishlistPreviewSettings ? {
|
|
1751
|
+
...wishlistPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
1748
1752
|
is_preview: true
|
|
1749
1753
|
} : {}
|
|
1750
1754
|
};
|
|
@@ -1818,10 +1822,9 @@ const BadgeCounter = (props) => {
|
|
|
1818
1822
|
const contentTotalWishlist = isFirstLoading ? defaultTotalWishlist : isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0;
|
|
1819
1823
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "data-wishlist-counter": contentTotalWishlist, children: contentTotalWishlist });
|
|
1820
1824
|
};
|
|
1821
|
-
const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLoading }) => {
|
|
1822
|
-
var _a, _b, _c, _d
|
|
1825
|
+
const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLoading, previewSettings }) => {
|
|
1826
|
+
var _a, _b, _c, _d;
|
|
1823
1827
|
const { sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
1824
|
-
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
1825
1828
|
const {
|
|
1826
1829
|
text_color: display_button_clear_all_text_color,
|
|
1827
1830
|
border_color: display_button_clear_all_border_color,
|
|
@@ -1834,9 +1837,9 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
|
|
|
1834
1837
|
font_size: display_button_clear_all_font_size,
|
|
1835
1838
|
font_weight: display_button_clear_all_font_weight,
|
|
1836
1839
|
text_transform: display_button_clear_all_text_transform
|
|
1837
|
-
} = ((
|
|
1838
|
-
const { title_confirm_clear_all_wishlist, text_confirm_clear_all_wishlist, button_submit_confirm_clear_all_wishlist, button_cancel_confirm_clear_all_wishlist } = ((
|
|
1839
|
-
const { button_clear_all } = ((
|
|
1840
|
+
} = ((_b = (_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.widget) == null ? void 0 : _b.button_clear_all) || {};
|
|
1841
|
+
const { title_confirm_clear_all_wishlist, text_confirm_clear_all_wishlist, button_submit_confirm_clear_all_wishlist, button_cancel_confirm_clear_all_wishlist } = ((_c = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _c.popup) || {};
|
|
1842
|
+
const { button_clear_all } = ((_d = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _d.widget) || {};
|
|
1840
1843
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
1841
1844
|
const display_button_clear_all_style = {
|
|
1842
1845
|
...display_button_clear_all_text_color && { color: display_button_clear_all_text_color },
|
|
@@ -1852,25 +1855,41 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
|
|
|
1852
1855
|
...display_button_clear_all_text_transform && { textTransform: display_button_clear_all_text_transform }
|
|
1853
1856
|
};
|
|
1854
1857
|
React__default.useEffect(() => {
|
|
1858
|
+
var _a2;
|
|
1859
|
+
const { is_required_login } = ((_a2 = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a2.global) || {};
|
|
1855
1860
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
1856
|
-
}, [sledgeAnonymId]);
|
|
1857
|
-
const handleClick = () => {
|
|
1861
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
1862
|
+
const handleClick = (props) => {
|
|
1858
1863
|
if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
|
|
1859
1864
|
window.sledgeConfirmationPopup({
|
|
1860
1865
|
title: title_confirm_clear_all_wishlist,
|
|
1861
1866
|
message: text_confirm_clear_all_wishlist,
|
|
1862
1867
|
textSubmit: button_submit_confirm_clear_all_wishlist,
|
|
1868
|
+
textCancel: button_cancel_confirm_clear_all_wishlist,
|
|
1863
1869
|
buttonSubmitType: "danger",
|
|
1864
|
-
onSubmit: window.sledgeWishlistWidgetClearList || {}
|
|
1870
|
+
onSubmit: window.sledgeWishlistWidgetClearList || {},
|
|
1871
|
+
...props || {}
|
|
1865
1872
|
});
|
|
1866
1873
|
};
|
|
1874
|
+
useEffectOnChange(() => {
|
|
1875
|
+
handleClick({ isPreviewSettings: true });
|
|
1876
|
+
}, [previewSettings]);
|
|
1867
1877
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !shareId && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "132px", height: "46px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item sledge-wishlist__widget-header-clear-all-trigger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", colorType: "danger", onClick: handleClick, style: display_button_clear_all_style, children: buttonText ? buttonText : button_clear_all || "Clear Wishlist" }) }) }) }) });
|
|
1868
1878
|
};
|
|
1869
|
-
const WidgetHeaderShareTrigger = ({
|
|
1870
|
-
|
|
1879
|
+
const WidgetHeaderShareTrigger = ({
|
|
1880
|
+
wishlistData,
|
|
1881
|
+
buttonText,
|
|
1882
|
+
showShareTrigger,
|
|
1883
|
+
shareLink,
|
|
1884
|
+
shareId,
|
|
1885
|
+
dataSettings,
|
|
1886
|
+
isFirstLoading,
|
|
1887
|
+
triggerBadge,
|
|
1888
|
+
previewSettings
|
|
1889
|
+
}) => {
|
|
1890
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1871
1891
|
const { triggerRenderMultipleComponent, sledgeAnonymId, isJsVersion } = React__default.useContext(SledgeContext);
|
|
1872
1892
|
const { trigger: triggerRenderWishlistBadge } = ((_a = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _a.badge) || {};
|
|
1873
|
-
const { is_required_login } = ((_b = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _b.global) || {};
|
|
1874
1893
|
const {
|
|
1875
1894
|
text_color: display_button_share_text_color,
|
|
1876
1895
|
border_color: display_button_share_border_color,
|
|
@@ -1883,11 +1902,11 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1883
1902
|
font_size: display_button_share_font_size,
|
|
1884
1903
|
font_weight: display_button_share_font_weight,
|
|
1885
1904
|
text_transform: display_button_share_text_transform
|
|
1886
|
-
} = ((
|
|
1887
|
-
const { title_share_wishlist, title_confirm_add_to_your_wishlist, text_confirm_add_to_your_wishlist, button_confirm_add_to_your_wishlist } = ((
|
|
1888
|
-
const { button_share, button_add_to_your_wishlist } = ((
|
|
1889
|
-
const { show: show_notification, location: location_notification } = ((
|
|
1890
|
-
const { title_added_all_to_wishlist, text_added_all_to_wishlist, title_fail_add_to_wishlist, text_fail_add_to_wishlist } = ((
|
|
1905
|
+
} = ((_c = (_b = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _b.widget) == null ? void 0 : _c.button_share) || {};
|
|
1906
|
+
const { title_share_wishlist, title_confirm_add_to_your_wishlist, text_confirm_add_to_your_wishlist, button_confirm_add_to_your_wishlist } = ((_d = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _d.popup) || {};
|
|
1907
|
+
const { button_share, button_add_to_your_wishlist } = ((_e = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _e.widget) || {};
|
|
1908
|
+
const { show: show_notification, location: location_notification } = ((_f = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _f.notification) || {};
|
|
1909
|
+
const { title_added_all_to_wishlist, text_added_all_to_wishlist, title_fail_add_to_wishlist, text_fail_add_to_wishlist } = ((_g = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _g.notification) || {};
|
|
1891
1910
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
1892
1911
|
const display_button_share_style = {
|
|
1893
1912
|
...display_button_share_text_color && { color: display_button_share_text_color },
|
|
@@ -1985,7 +2004,7 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1985
2004
|
});
|
|
1986
2005
|
}
|
|
1987
2006
|
};
|
|
1988
|
-
const handleClick = async () => {
|
|
2007
|
+
const handleClick = async (props) => {
|
|
1989
2008
|
let getMessage = text_confirm_add_to_your_wishlist;
|
|
1990
2009
|
if (getMessage)
|
|
1991
2010
|
getMessage = getMessage.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_WISHLIST, wishlistData.length);
|
|
@@ -1995,7 +2014,8 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1995
2014
|
message: getMessage || `This action cannot be undone. This will adding <strong>${wishlistData.length}</strong> item to your wishlist page.`,
|
|
1996
2015
|
textSubmit: button_confirm_add_to_your_wishlist || "Add to your wishlist",
|
|
1997
2016
|
buttonSubmitType: "info",
|
|
1998
|
-
onSubmit: handleBulkAddWishlist || {}
|
|
2017
|
+
onSubmit: handleBulkAddWishlist || {},
|
|
2018
|
+
...props || {}
|
|
1999
2019
|
});
|
|
2000
2020
|
} else {
|
|
2001
2021
|
if (typeof window !== "undefined" && window.sledgeInfoPopup) {
|
|
@@ -2006,14 +2026,20 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
2006
2026
|
${clipboardIcon}
|
|
2007
2027
|
</div>
|
|
2008
2028
|
<div class="sledge-wishlist__widget-box-copy-content">${shareLink}</div>
|
|
2009
|
-
</div>` : ""
|
|
2029
|
+
</div>` : "",
|
|
2030
|
+
...props || {}
|
|
2010
2031
|
});
|
|
2011
2032
|
}
|
|
2012
2033
|
}
|
|
2013
2034
|
};
|
|
2014
2035
|
React__default.useEffect(() => {
|
|
2036
|
+
var _a2;
|
|
2037
|
+
const { is_required_login } = ((_a2 = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a2.global) || {};
|
|
2015
2038
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
2016
|
-
}, [sledgeAnonymId]);
|
|
2039
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
2040
|
+
useEffectOnChange(() => {
|
|
2041
|
+
handleClick({ isPreviewSettings: true });
|
|
2042
|
+
}, [previewSettings]);
|
|
2017
2043
|
watchElement({
|
|
2018
2044
|
selector: ".sledge-wishlist__widget-box-copy",
|
|
2019
2045
|
init: handleCopyShareLink
|
|
@@ -2037,10 +2063,9 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
2037
2063
|
) }) }) }) });
|
|
2038
2064
|
};
|
|
2039
2065
|
const WidgetHeaderSearchForm = ({ setIsLoading, setKeyword, keyword, placeholder, dataSettings }) => {
|
|
2040
|
-
var _a
|
|
2066
|
+
var _a;
|
|
2041
2067
|
const { sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
2042
|
-
const {
|
|
2043
|
-
const { search_form_placeholder } = ((_b = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _b.widget) || {};
|
|
2068
|
+
const { search_form_placeholder } = ((_a = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _a.widget) || {};
|
|
2044
2069
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
2045
2070
|
const searchFieldRef = React__default.useRef(null);
|
|
2046
2071
|
const handleResetField = () => {
|
|
@@ -2053,8 +2078,10 @@ const WidgetHeaderSearchForm = ({ setIsLoading, setKeyword, keyword, placeholder
|
|
|
2053
2078
|
setKeyword && setKeyword(value);
|
|
2054
2079
|
};
|
|
2055
2080
|
React__default.useEffect(() => {
|
|
2081
|
+
var _a2;
|
|
2082
|
+
const { is_required_login } = ((_a2 = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a2.global) || {};
|
|
2056
2083
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
2057
|
-
}, [sledgeAnonymId]);
|
|
2084
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
2058
2085
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2059
2086
|
SearchInputField,
|
|
2060
2087
|
{
|
|
@@ -2088,17 +2115,17 @@ const WidgetHeaderTitle = ({ text, dataSettings }) => {
|
|
|
2088
2115
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { style: display_header_title_style, children: text ? text : language_header_title || "My Wishlist" }) });
|
|
2089
2116
|
};
|
|
2090
2117
|
const WidgetHeaderLimit = ({ limitOptions, selectedLimit, setSelectedLimit, setIsRefreshWidgetList, dataSettings }) => {
|
|
2091
|
-
var _a;
|
|
2092
2118
|
const { sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
2093
|
-
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2094
2119
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
2095
2120
|
const handleChangeLimit = (value) => {
|
|
2096
2121
|
setSelectedLimit && setSelectedLimit(value);
|
|
2097
2122
|
setIsRefreshWidgetList && setIsRefreshWidgetList(true);
|
|
2098
2123
|
};
|
|
2099
2124
|
React__default.useEffect(() => {
|
|
2125
|
+
var _a;
|
|
2126
|
+
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2100
2127
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
2101
|
-
}, [sledgeAnonymId]);
|
|
2128
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
2102
2129
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: limitOptions && Boolean(limitOptions == null ? void 0 : limitOptions.length) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item sledge-wishlist__widget-header-limit-option", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2103
2130
|
SelectField,
|
|
2104
2131
|
{
|
|
@@ -2115,9 +2142,7 @@ const WidgetHeaderLimit = ({ limitOptions, selectedLimit, setSelectedLimit, setI
|
|
|
2115
2142
|
) }) }) : null });
|
|
2116
2143
|
};
|
|
2117
2144
|
const WidgetHeaderSort$1 = ({ wishlistSort, selectedSort, setSelectedSort, setIsRefreshWidgetList, dataSettings, generalDataSettings }) => {
|
|
2118
|
-
var _a;
|
|
2119
2145
|
const { sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
2120
|
-
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2121
2146
|
const { sort_placeholder } = (generalDataSettings == null ? void 0 : generalDataSettings.languages) || {};
|
|
2122
2147
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
2123
2148
|
const handleChangeSort = (value) => {
|
|
@@ -2125,8 +2150,10 @@ const WidgetHeaderSort$1 = ({ wishlistSort, selectedSort, setSelectedSort, setIs
|
|
|
2125
2150
|
setIsRefreshWidgetList && setIsRefreshWidgetList(true);
|
|
2126
2151
|
};
|
|
2127
2152
|
React__default.useEffect(() => {
|
|
2153
|
+
var _a;
|
|
2154
|
+
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2128
2155
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
2129
|
-
}, [sledgeAnonymId]);
|
|
2156
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
2130
2157
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: wishlistSort && Boolean(wishlistSort == null ? void 0 : wishlistSort.length) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item sledge-wishlist__widget-header-sort-option", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2131
2158
|
SelectField,
|
|
2132
2159
|
{
|
|
@@ -2200,26 +2227,26 @@ WidgetHeader$1.Sort = WidgetHeaderSort$1;
|
|
|
2200
2227
|
WidgetHeader$1.Limit = WidgetHeaderLimit;
|
|
2201
2228
|
const defaultGridType = "large";
|
|
2202
2229
|
const WidgetList = (props) => {
|
|
2203
|
-
var _a;
|
|
2204
2230
|
const { sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
2205
2231
|
const { isLoading, wishlistData, dataSettings, gridType = defaultGridType, isFlyout } = props || {};
|
|
2206
|
-
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2207
2232
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
2208
2233
|
React__default.useEffect(() => {
|
|
2234
|
+
var _a;
|
|
2235
|
+
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
2209
2236
|
setIsRequiredLogin(sledgeAnonymId && is_required_login);
|
|
2210
|
-
}, [sledgeAnonymId]);
|
|
2237
|
+
}, [sledgeAnonymId, dataSettings]);
|
|
2211
2238
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.ProductGrid, { count: 8, type: gridType, isFlyout }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-product-wrapper", children: !(wishlistData == null ? void 0 : wishlistData.length) || isRequiredLogin ? /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetListEmpty, { ...props, isRequiredLogin }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ProductWrapper, { ...props }) }) });
|
|
2212
2239
|
};
|
|
2213
2240
|
const WidgetListEmpty = (props) => {
|
|
2214
|
-
var _a;
|
|
2215
2241
|
const { onSearch, keyword, dataSettings, isRequiredLogin } = props || {};
|
|
2216
|
-
const { title_no_result, text_no_result, title_search_no_result, text_search_no_result, login_button, continue_shopping, alert, alert_login } = ((_a = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _a.widget) || {};
|
|
2217
2242
|
const [title, setTitle] = React__default.useState("");
|
|
2218
2243
|
const [description, setDescription] = React__default.useState("");
|
|
2219
2244
|
const [showButton, setShowButton] = React__default.useState(false);
|
|
2220
2245
|
const [textButton, setTextButton] = React__default.useState("");
|
|
2221
2246
|
const [urlButton, setUrlButton] = React__default.useState("");
|
|
2222
2247
|
React__default.useEffect(() => {
|
|
2248
|
+
var _a;
|
|
2249
|
+
const { title_no_result, text_no_result, title_search_no_result, text_search_no_result, login_button, continue_shopping, alert, alert_login } = ((_a = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _a.widget) || {};
|
|
2223
2250
|
if (isRequiredLogin) {
|
|
2224
2251
|
setTitle(alert_login || "Login required!");
|
|
2225
2252
|
setDescription(alert || "Please login to save your wishlist across devices.");
|
|
@@ -2235,7 +2262,7 @@ const WidgetListEmpty = (props) => {
|
|
|
2235
2262
|
setUrlButton("/");
|
|
2236
2263
|
}
|
|
2237
2264
|
}
|
|
2238
|
-
}, [onSearch, dataSettings]);
|
|
2265
|
+
}, [onSearch, isRequiredLogin, dataSettings]);
|
|
2239
2266
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-wishlist__widget-product-empty", children: [
|
|
2240
2267
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-product-empty-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 32, height: 32, type: "outline", color: "#000000" }) }),
|
|
2241
2268
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-product-empty-title", dangerouslySetInnerHTML: { __html: title } }),
|
|
@@ -2512,7 +2539,7 @@ const WidgetRoot = (props) => {
|
|
|
2512
2539
|
keyword,
|
|
2513
2540
|
shareId: getShareId,
|
|
2514
2541
|
locale: isJsVersion ? selectedLocaleJs() : locale,
|
|
2515
|
-
...wishlistPreviewSettings ? {
|
|
2542
|
+
...wishlistPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
2516
2543
|
is_preview: true
|
|
2517
2544
|
} : {}
|
|
2518
2545
|
};
|
|
@@ -2544,7 +2571,7 @@ const WidgetRoot = (props) => {
|
|
|
2544
2571
|
let valueShareLink;
|
|
2545
2572
|
let valueShareId;
|
|
2546
2573
|
let queryParam = {
|
|
2547
|
-
...wishlistPreviewSettings ? {
|
|
2574
|
+
...wishlistPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
2548
2575
|
is_preview: true
|
|
2549
2576
|
} : {}
|
|
2550
2577
|
};
|
|
@@ -2745,7 +2772,8 @@ const Badge = (props) => {
|
|
|
2745
2772
|
setData(valueData);
|
|
2746
2773
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_KEY.WISHLIST_BADGE_COUNTER, valueTotalWishlist);
|
|
2747
2774
|
},
|
|
2748
|
-
wishlistPreviewSettings
|
|
2775
|
+
wishlistPreviewSettings,
|
|
2776
|
+
generalPreviewSettings
|
|
2749
2777
|
});
|
|
2750
2778
|
};
|
|
2751
2779
|
const handleSettings = async (LOCAL_STORAGE_WISHLIST_SETTING) => {
|
|
@@ -3183,7 +3211,7 @@ const Trigger = (props) => {
|
|
|
3183
3211
|
const handleCheckWishlist = async () => {
|
|
3184
3212
|
let response;
|
|
3185
3213
|
let queryParam = {
|
|
3186
|
-
...wishlistPreviewSettings ? {
|
|
3214
|
+
...wishlistPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
3187
3215
|
is_preview: true
|
|
3188
3216
|
} : {}
|
|
3189
3217
|
};
|
|
@@ -3218,20 +3246,11 @@ const Trigger = (props) => {
|
|
|
3218
3246
|
handleConfirmationPopup();
|
|
3219
3247
|
return;
|
|
3220
3248
|
}
|
|
3221
|
-
let resAddWishlist =
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
productVendor: "",
|
|
3227
|
-
productSku: "",
|
|
3228
|
-
productVariantName: "",
|
|
3229
|
-
productLink: "",
|
|
3230
|
-
productImage: "",
|
|
3231
|
-
productCurrency: "",
|
|
3232
|
-
productPrice: ""
|
|
3233
|
-
} : params
|
|
3234
|
-
);
|
|
3249
|
+
let resAddWishlist = wishlistPreviewSettings ? {
|
|
3250
|
+
status: {
|
|
3251
|
+
code: 200
|
|
3252
|
+
}
|
|
3253
|
+
} : await addWishlist(params);
|
|
3235
3254
|
const { status, data } = resAddWishlist || {};
|
|
3236
3255
|
const { code } = status || {};
|
|
3237
3256
|
const { product } = data || {};
|
|
@@ -3259,7 +3278,8 @@ const Trigger = (props) => {
|
|
|
3259
3278
|
if (window.sledgeWishlistButtonDetailUpdate)
|
|
3260
3279
|
window.sledgeWishlistButtonDetailUpdate();
|
|
3261
3280
|
}
|
|
3262
|
-
|
|
3281
|
+
if (!wishlistPreviewSettings)
|
|
3282
|
+
handleCheckWishlist();
|
|
3263
3283
|
if (!isWishlist) {
|
|
3264
3284
|
handleFunctions.onAfterAddWishlist && handleFunctions.onAfterAddWishlist("success");
|
|
3265
3285
|
} else {
|
|
@@ -3434,7 +3454,7 @@ const Rating = (props) => {
|
|
|
3434
3454
|
const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
|
|
3435
3455
|
const { productReview: isRenderAppProductReview } = isRenderApp || {};
|
|
3436
3456
|
const { value: valueRenderProductReviewRating, trigger: triggerRenderProductReviewRating } = ((_a = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.productReview) == null ? void 0 : _a.rating) || {};
|
|
3437
|
-
const { productReviewPreviewSettings, previewSettings } = usePreviewSettings({
|
|
3457
|
+
const { generalPreviewSettings, productReviewPreviewSettings, previewSettings } = usePreviewSettings({
|
|
3438
3458
|
defaultSettings: previewSettingsProp,
|
|
3439
3459
|
nestedProperty: "sledge.productReview.rating.preview"
|
|
3440
3460
|
});
|
|
@@ -3472,7 +3492,7 @@ const Rating = (props) => {
|
|
|
3472
3492
|
let valueTotalReview = 0;
|
|
3473
3493
|
let valueAverageReview;
|
|
3474
3494
|
let queryParam = {
|
|
3475
|
-
...productReviewPreviewSettings ? {
|
|
3495
|
+
...productReviewPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
3476
3496
|
is_preview: true
|
|
3477
3497
|
} : {}
|
|
3478
3498
|
};
|
|
@@ -3737,7 +3757,7 @@ const WidgetHeaderSummary = (props) => {
|
|
|
3737
3757
|
var _a, _b, _c, _d, _e;
|
|
3738
3758
|
const { isRenderApp } = React__default.useContext(SledgeContext);
|
|
3739
3759
|
const { productReview: isRenderAppProductReview } = isRenderApp || {};
|
|
3740
|
-
const { params, dataSettings, summaryData, sledgeSettings, productReviewPreviewSettings } = props;
|
|
3760
|
+
const { params, dataSettings, summaryData, sledgeSettings, generalPreviewSettings, productReviewPreviewSettings } = props;
|
|
3741
3761
|
const { productId } = params || {};
|
|
3742
3762
|
const { fill_color: display_summary_bar_fill_color, outline_color: display_summary_bar_outline_color } = ((_b = (_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.widget) == null ? void 0 : _b.summary_bar) || {};
|
|
3743
3763
|
const { fill_color = "#23BC45", outline_color = "#8D9196" } = ((_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.rating) || {};
|
|
@@ -3769,7 +3789,7 @@ const WidgetHeaderSummary = (props) => {
|
|
|
3769
3789
|
let valueRatingList;
|
|
3770
3790
|
let valueAverageReview;
|
|
3771
3791
|
let queryParam = {
|
|
3772
|
-
...productReviewPreviewSettings ? {
|
|
3792
|
+
...productReviewPreviewSettings && (generalPreviewSettings == null ? void 0 : generalPreviewSettings.use_dummy_data) ? {
|
|
3773
3793
|
is_preview: true
|
|
3774
3794
|
} : {}
|
|
3775
3795
|
};
|
|
@@ -4651,7 +4671,7 @@ const ProductGrid = React__default.memo((props) => {
|
|
|
4651
4671
|
setClickedAddToCartId(null);
|
|
4652
4672
|
onAfterAddToCart && onAfterAddToCart("success");
|
|
4653
4673
|
if (redirect_add_to_cart) {
|
|
4654
|
-
window.location.href = "/cart";
|
|
4674
|
+
window.location.href = (generalDataSettings == null ? void 0 : generalDataSettings.cart_url) || "/cart";
|
|
4655
4675
|
} else {
|
|
4656
4676
|
window.sledgeToastNotification({
|
|
4657
4677
|
title: "Cart added",
|
|
@@ -6766,7 +6786,7 @@ const FilterSelected$2 = (props) => {
|
|
|
6766
6786
|
handleFilterChange,
|
|
6767
6787
|
allowedFilterSlider
|
|
6768
6788
|
} = props;
|
|
6769
|
-
const { language_filter, language_clear_filter } = languageSettings || {};
|
|
6789
|
+
const { filter: language_filter, clear_filter: language_clear_filter } = languageSettings || {};
|
|
6770
6790
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: Boolean((items == null ? void 0 : items.length) && ((_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.show_refine_by_block)) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item", children: [
|
|
6771
6791
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-item-title-refine", children: [
|
|
6772
6792
|
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { className: "sledge-instant-search__result-filter-item-title-refine-heading", children: language_filter || "Filter" }),
|
|
@@ -7147,7 +7167,7 @@ const FilterSelected$1 = (props) => {
|
|
|
7147
7167
|
handleFilterChange,
|
|
7148
7168
|
allowedFilterSlider
|
|
7149
7169
|
} = props;
|
|
7150
|
-
const { language_clear_filter } = languageSettings || {};
|
|
7170
|
+
const { clear_filter: language_clear_filter } = languageSettings || {};
|
|
7151
7171
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: Boolean((items == null ? void 0 : items.length) && ((_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.show_refine_by_block)) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-horizontal", children: [
|
|
7152
7172
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-refine-item sledge-instant-search__result-filter-horizontal-refine-item-clear-all", onClick: handleFilterReset, children: language_clear_filter || "Clear All" }),
|
|
7153
7173
|
items.map((item, index) => {
|
|
@@ -7264,7 +7284,7 @@ const FilterSelected = (props) => {
|
|
|
7264
7284
|
handleFilterChange,
|
|
7265
7285
|
allowedFilterSlider
|
|
7266
7286
|
} = props;
|
|
7267
|
-
const { language_clear_filter } = languageSettings || {};
|
|
7287
|
+
const { clear_filter: language_clear_filter } = languageSettings || {};
|
|
7268
7288
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: Boolean((items == null ? void 0 : items.length) && ((_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.show_refine_by_block)) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-filter-horizontal sledge-instant-search__result-filter-active", children: [
|
|
7269
7289
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-filter-horizontal-refine-item sledge-instant-search__result-filter-horizontal-refine-item-clear-all", onClick: handleFilterReset, children: language_clear_filter || "Clear All" }),
|
|
7270
7290
|
items.map((item, index) => {
|
|
@@ -8982,11 +9002,13 @@ const SearchResultWidget = (props) => {
|
|
|
8982
9002
|
setUsePublishedFilter(use_published_filter);
|
|
8983
9003
|
setShowOutOfStock(show_out_of_stock);
|
|
8984
9004
|
setTabs(tabs2);
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
9005
|
+
if (!clickedTabIndexId) {
|
|
9006
|
+
getFirstIndex = (_b2 = tabs2 == null ? void 0 : tabs2.find) == null ? void 0 : _b2.call(tabs2, ({ index }) => index.includes(index_product));
|
|
9007
|
+
if (Object.keys(getFirstIndex).length) {
|
|
9008
|
+
setClickedTabIndexId(getFirstIndex.index);
|
|
9009
|
+
setClickedTabIndexName(getFirstIndex.name);
|
|
9010
|
+
setClickedTabIndexType(getFirstIndex.type);
|
|
9011
|
+
}
|
|
8990
9012
|
}
|
|
8991
9013
|
setIsLoadingSetting(false);
|
|
8992
9014
|
if (isPreviewSettings) {
|
|
@@ -9005,16 +9027,14 @@ const SearchResultWidget = (props) => {
|
|
|
9005
9027
|
}
|
|
9006
9028
|
}
|
|
9007
9029
|
setAllowedTabs(
|
|
9008
|
-
(_g2 = (_f2 = (_e2 =
|
|
9030
|
+
(_g2 = (_f2 = (_e2 = tabs2 == null ? void 0 : tabs2.map) == null ? void 0 : _e2.call(tabs2, (allowedTab) => {
|
|
9009
9031
|
var _a3, _b3;
|
|
9010
|
-
const {
|
|
9011
|
-
|
|
9012
|
-
return;
|
|
9013
|
-
const newName = ((_b3 = (_a3 = tabs2 == null ? void 0 : tabs2.find) == null ? void 0 : _a3.call(tabs2, (tab) => (tab == null ? void 0 : tab.type) === type)) == null ? void 0 : _b3.name) || name;
|
|
9032
|
+
const { type } = allowedTab;
|
|
9033
|
+
const total = ((_b3 = (_a3 = allowedTabs == null ? void 0 : allowedTabs.find) == null ? void 0 : _a3.call(allowedTabs, (tab) => (tab == null ? void 0 : tab.type) === type)) == null ? void 0 : _b3.total) || 0;
|
|
9014
9034
|
return {
|
|
9015
9035
|
...allowedTab,
|
|
9016
9036
|
...{
|
|
9017
|
-
|
|
9037
|
+
total
|
|
9018
9038
|
}
|
|
9019
9039
|
};
|
|
9020
9040
|
})) == null ? void 0 : _f2.filter) == null ? void 0 : _g2.call(_f2, (item) => item)
|
|
@@ -9329,17 +9349,22 @@ const SearchResultWidget = (props) => {
|
|
|
9329
9349
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", {}),
|
|
9330
9350
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "The products and collections will become visible in the widgets once indexing is complete." })
|
|
9331
9351
|
] }) : null;
|
|
9352
|
+
const tabItems = instantSearchPreviewSettings ? (_y = (_x = (_w = tabs == null ? void 0 : tabs.map) == null ? void 0 : _w.call(tabs, (allowedTab) => {
|
|
9353
|
+
var _a2, _b2;
|
|
9354
|
+
const { type } = allowedTab;
|
|
9355
|
+
const total = ((_b2 = (_a2 = allowedTabs == null ? void 0 : allowedTabs.find) == null ? void 0 : _a2.call(allowedTabs, (tab) => (tab == null ? void 0 : tab.type) === type)) == null ? void 0 : _b2.total) || 0;
|
|
9356
|
+
if (!(activeTabs == null ? void 0 : activeTabs[type]))
|
|
9357
|
+
return;
|
|
9358
|
+
return {
|
|
9359
|
+
...allowedTab,
|
|
9360
|
+
...{
|
|
9361
|
+
total
|
|
9362
|
+
}
|
|
9363
|
+
};
|
|
9364
|
+
})) == null ? void 0 : _x.filter) == null ? void 0 : _y.call(_x, (item) => item) : allowedTabs;
|
|
9332
9365
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-container", ref: searchResultContainerRef, style: containerStyle, children: [
|
|
9333
9366
|
alertFirstSyncComponent,
|
|
9334
|
-
isFirstLoading ? tabSkeleton : layoutType === "default" && (allowedTabs == null ? void 0 : allowedTabs.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
9335
|
-
Tab,
|
|
9336
|
-
{
|
|
9337
|
-
items: instantSearchPreviewSettings ? (_y = (_x = (_w = allowedTabs == null ? void 0 : allowedTabs.map) == null ? void 0 : _w.call(allowedTabs, (allowedTab) => (activeTabs == null ? void 0 : activeTabs[allowedTab == null ? void 0 : allowedTab.type]) ? allowedTab : null)) == null ? void 0 : _x.filter) == null ? void 0 : _y.call(_x, (item) => item) : allowedTabs,
|
|
9338
|
-
layoutType,
|
|
9339
|
-
clickedTabIndexId,
|
|
9340
|
-
handleChangeTab: handleChangeTabIndex
|
|
9341
|
-
}
|
|
9342
|
-
) : tabSkeleton,
|
|
9367
|
+
isFirstLoading ? tabSkeleton : layoutType === "default" && (allowedTabs == null ? void 0 : allowedTabs.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tab, { items: tabItems, layoutType, clickedTabIndexId, handleChangeTab: handleChangeTabIndex }) : tabSkeleton,
|
|
9343
9368
|
isFirstLoading && (layoutType == null ? void 0 : layoutType.length) && !propsData ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
9344
9369
|
mobileFilterWithSearchAndSelectOptionSkeleton,
|
|
9345
9370
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__hide-element-lg-on-mobile", children: filterHorizontalSkeleton }),
|
|
@@ -9806,9 +9831,10 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9806
9831
|
return;
|
|
9807
9832
|
const { hits, processingTimeMs, totalHits, totalPages, facetDistribution } = result;
|
|
9808
9833
|
const updateTabs = () => {
|
|
9809
|
-
|
|
9834
|
+
const valueAllowedTabs = objectPresent(previewSettings) ? tabs : allowedTabs;
|
|
9835
|
+
if (valueAllowedTabs == null ? void 0 : valueAllowedTabs.length) {
|
|
9810
9836
|
setAllowedTabs == null ? void 0 : setAllowedTabs(
|
|
9811
|
-
|
|
9837
|
+
valueAllowedTabs.map((tab) => {
|
|
9812
9838
|
var _a3, _b3, _c2;
|
|
9813
9839
|
const { index, total } = tab;
|
|
9814
9840
|
let isCurrentIndex = index.includes(clickedTabIndexId);
|
|
@@ -9827,6 +9853,8 @@ const ResultProduct = React__default.memo((props) => {
|
|
|
9827
9853
|
);
|
|
9828
9854
|
}
|
|
9829
9855
|
};
|
|
9856
|
+
if (objectPresent(previewSettings))
|
|
9857
|
+
updateTabs();
|
|
9830
9858
|
if (isFirstTimeOrOnSearch || isNoneFacetSelected) {
|
|
9831
9859
|
handleSetInitStates == null ? void 0 : handleSetInitStates({
|
|
9832
9860
|
results: resultData,
|