@sledge-app/react-instant-search 1.0.34 → 1.0.36
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.
|
@@ -150,7 +150,8 @@ const OBJECT_DATA_STRING_KEY = {
|
|
|
150
150
|
CURRENT_PAGE: "{{ current_page }}",
|
|
151
151
|
TOTAL_PAGE: "{{ total_page }}",
|
|
152
152
|
TOTAL_RESULT: "{{ total_result }}",
|
|
153
|
-
COLLECTION_NAME: "{{ collection_name }}"
|
|
153
|
+
COLLECTION_NAME: "{{ collection_name }}",
|
|
154
|
+
TOTAL_WISHLIST: "{{ total_wishlist }}"
|
|
154
155
|
};
|
|
155
156
|
const ELEMENT_ID = {
|
|
156
157
|
PRODUCT_REVIEW: {
|
|
@@ -991,7 +992,7 @@ const addToCartTrigger$1 = async (data) => {
|
|
|
991
992
|
});
|
|
992
993
|
};
|
|
993
994
|
const Badge = (props) => {
|
|
994
|
-
var _a;
|
|
995
|
+
var _a, _b;
|
|
995
996
|
const { useProxyUrl = false, data: propsData, position: positionProp } = props;
|
|
996
997
|
const { isRenderApp, triggerRenderMultipleComponent, sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
997
998
|
const { wishlist: isRenderAppWishlist } = isRenderApp || {};
|
|
@@ -1006,17 +1007,18 @@ const Badge = (props) => {
|
|
|
1006
1007
|
const [dataSettings, setDataSettings] = React__default.useState({});
|
|
1007
1008
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
1008
1009
|
const { floating_button_type } = (dataSettings == null ? void 0 : dataSettings.launch_point) || {};
|
|
1010
|
+
const { alert_login, alert, login_button } = ((_b = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _b.widget) || {};
|
|
1009
1011
|
const defaultPosition = positionProp || floating_button_type;
|
|
1010
1012
|
const position = defaultPosition ? defaultPosition : "none";
|
|
1011
1013
|
const handleGetWishlistInfo = async () => {
|
|
1012
|
-
var _a2,
|
|
1014
|
+
var _a2, _b2;
|
|
1013
1015
|
let response;
|
|
1014
1016
|
let run = false;
|
|
1015
1017
|
let valueTotalWishlist;
|
|
1016
1018
|
let valueProxyUrl;
|
|
1017
1019
|
response = await getWishlistInfo();
|
|
1018
1020
|
run = ((_a2 = response == null ? void 0 : response.status) == null ? void 0 : _a2.code) === 200 || false;
|
|
1019
|
-
valueTotalWishlist = !((
|
|
1021
|
+
valueTotalWishlist = !((_b2 = response == null ? void 0 : response.data) == null ? void 0 : _b2.total_data) ? 0 : response.data.total_data;
|
|
1020
1022
|
valueProxyUrl = DEFAULT_WISHLIST_URL;
|
|
1021
1023
|
if (run) {
|
|
1022
1024
|
setTotalWishlist(valueTotalWishlist);
|
|
@@ -1043,10 +1045,9 @@ const Badge = (props) => {
|
|
|
1043
1045
|
if (isRequiredLogin) {
|
|
1044
1046
|
if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
|
|
1045
1047
|
window.sledgeConfirmationPopup({
|
|
1046
|
-
title: "Login required!",
|
|
1047
|
-
message: "Please login to save your wishlist across devices.",
|
|
1048
|
-
textSubmit: "Login",
|
|
1049
|
-
textCancel: "Cancel",
|
|
1048
|
+
title: alert_login || "Login required!",
|
|
1049
|
+
message: alert || "Please login to save your wishlist across devices.",
|
|
1050
|
+
textSubmit: login_button || "Login",
|
|
1050
1051
|
buttonSubmitType: "info",
|
|
1051
1052
|
onSubmit: () => window.location.href = "/account/login"
|
|
1052
1053
|
});
|
|
@@ -1192,7 +1193,7 @@ const BadgeInitSelector = () => {
|
|
|
1192
1193
|
}
|
|
1193
1194
|
};
|
|
1194
1195
|
const Trigger = (props) => {
|
|
1195
|
-
var _a, _b, _c, _d;
|
|
1196
|
+
var _a, _b, _c, _d, _e;
|
|
1196
1197
|
const { params, forceActive = false, hidden = false, onAfterAddWishlist, onAfterRemoveWishlist, wishlistChecked } = props;
|
|
1197
1198
|
const { productId, productVariantId } = params || {};
|
|
1198
1199
|
const { isRenderApp, triggerRenderMultipleComponent, sledgeAnonymId } = React__default.useContext(SledgeContext);
|
|
@@ -1218,6 +1219,7 @@ const Trigger = (props) => {
|
|
|
1218
1219
|
const { is_required_login } = ((_b = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _b.global) || {};
|
|
1219
1220
|
const { show: show_notification, location: location_notification } = ((_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.notification) || {};
|
|
1220
1221
|
const { title_added_to_wishlist, text_added_to_wishlist, title_removed_to_wishlist, text_removed_to_wishlist, title_fail_add_to_wishlist, text_fail_add_to_wishlist } = ((_d = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _d.notification) || {};
|
|
1222
|
+
const { alert_login, alert, login_button } = ((_e = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _e.widget) || {};
|
|
1221
1223
|
const handleCheckWishlist = async () => {
|
|
1222
1224
|
let response;
|
|
1223
1225
|
if (typeof wishlistChecked === "boolean" && isFirstTime) {
|
|
@@ -1234,10 +1236,9 @@ const Trigger = (props) => {
|
|
|
1234
1236
|
if (isRequiredLogin) {
|
|
1235
1237
|
if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
|
|
1236
1238
|
window.sledgeConfirmationPopup({
|
|
1237
|
-
title: "Login required!",
|
|
1238
|
-
message: "Please login to save your wishlist across devices.",
|
|
1239
|
-
textSubmit: "Login",
|
|
1240
|
-
textCancel: "Cancel",
|
|
1239
|
+
title: alert_login || "Login required!",
|
|
1240
|
+
message: alert || "Please login to save your wishlist across devices.",
|
|
1241
|
+
textSubmit: login_button || "Login",
|
|
1241
1242
|
buttonSubmitType: "info",
|
|
1242
1243
|
onSubmit: () => window.location.href = "/account/login"
|
|
1243
1244
|
});
|
|
@@ -1387,7 +1388,6 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
|
|
|
1387
1388
|
title: title_confirm_clear_all_wishlist,
|
|
1388
1389
|
message: text_confirm_clear_all_wishlist,
|
|
1389
1390
|
textSubmit: button_submit_confirm_clear_all_wishlist,
|
|
1390
|
-
textCancel: button_cancel_confirm_clear_all_wishlist,
|
|
1391
1391
|
buttonSubmitType: "danger",
|
|
1392
1392
|
onSubmit: window.sledgeWishlistWidgetClearList || {}
|
|
1393
1393
|
});
|
|
@@ -1412,8 +1412,8 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1412
1412
|
font_weight: display_button_share_font_weight,
|
|
1413
1413
|
text_transform: display_button_share_text_transform
|
|
1414
1414
|
} = ((_d = (_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.widget) == null ? void 0 : _d.button_share) || {};
|
|
1415
|
-
const { title_share_wishlist } = ((_e = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _e.popup) || {};
|
|
1416
|
-
const { button_share } = ((_f = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _f.widget) || {};
|
|
1415
|
+
const { title_share_wishlist, title_confirm_add_to_your_wishlist, text_confirm_add_to_your_wishlist, button_confirm_add_to_your_wishlist } = ((_e = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _e.popup) || {};
|
|
1416
|
+
const { button_share, button_add_to_your_wishlist } = ((_f = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _f.widget) || {};
|
|
1417
1417
|
const { show: show_notification, location: location_notification } = ((_g = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _g.notification) || {};
|
|
1418
1418
|
const { title_added_all_to_wishlist, text_added_all_to_wishlist, title_fail_add_to_wishlist, text_fail_add_to_wishlist } = ((_h = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _h.notification) || {};
|
|
1419
1419
|
const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
|
|
@@ -1507,12 +1507,15 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1507
1507
|
}
|
|
1508
1508
|
};
|
|
1509
1509
|
const handleClick = async () => {
|
|
1510
|
+
let getMessage = text_confirm_add_to_your_wishlist;
|
|
1511
|
+
if (getMessage)
|
|
1512
|
+
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);
|
|
1510
1514
|
if (shareId && wishlistData.length) {
|
|
1511
1515
|
window.sledgeConfirmationPopup({
|
|
1512
|
-
title: "Are you sure want to add this to your wishlist item?",
|
|
1513
|
-
message: `This action cannot be undone. This will adding <strong>${wishlistData.length}</strong> item to your wishlist page.`,
|
|
1514
|
-
textSubmit: "Add to your wishlist",
|
|
1515
|
-
textCancel: "Cancel",
|
|
1516
|
+
title: title_confirm_add_to_your_wishlist || "Are you sure want to add this to your wishlist item?",
|
|
1517
|
+
message: getMessage || `This action cannot be undone. This will adding <strong>${wishlistData.length}</strong> item to your wishlist page.`,
|
|
1518
|
+
textSubmit: button_confirm_add_to_your_wishlist || "Add to your wishlist",
|
|
1516
1519
|
buttonSubmitType: "info",
|
|
1517
1520
|
onSubmit: handleBulkAddWishlist || {}
|
|
1518
1521
|
});
|
|
@@ -1550,7 +1553,7 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
1550
1553
|
children: shareId ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
1551
1554
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-wishlist__badge-counter sledge-wishlist__badge-counter-top-right", children: wishlistData.length }),
|
|
1552
1555
|
isLoadingBulkAdd ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingDots, {}) : null,
|
|
1553
|
-
"Add to your wishlist"
|
|
1556
|
+
button_add_to_your_wishlist || "Add to your wishlist"
|
|
1554
1557
|
] }) : buttonText ? buttonText : button_share || "Share Wishlist"
|
|
1555
1558
|
}
|
|
1556
1559
|
) }) }) }) });
|
|
@@ -4325,7 +4328,7 @@ const ResultProduct = (props) => {
|
|
|
4325
4328
|
] })
|
|
4326
4329
|
] }) : null
|
|
4327
4330
|
] });
|
|
4328
|
-
let getSummaryText = language_total_result_text[layoutType === "product-filter" ? "product_filter" : "product"];
|
|
4331
|
+
let getSummaryText = language_total_result_text[layoutType === "product-filter" && !(keyword == null ? void 0 : keyword.length) ? "product_filter" : "product"];
|
|
4329
4332
|
let isSummaryTextFromLanguage = language_total_result_text && getSummaryText;
|
|
4330
4333
|
if (isSummaryTextFromLanguage) {
|
|
4331
4334
|
getSummaryText = getSummaryText.replaceAll(OBJECT_DATA_STRING_KEY.TOTAL_RESULT, totalResult);
|