@sledge-app/react-instant-search 0.0.7 → 0.0.8
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.
|
@@ -628,7 +628,7 @@ const Trigger = (props) => {
|
|
|
628
628
|
var _a, _b, _c;
|
|
629
629
|
const { data, forceActive, hidden, onAfterAddWishlist, onAfterRemoveWishlist } = props;
|
|
630
630
|
const { productId, productVariantId } = data || {};
|
|
631
|
-
const { isRenderApp } = React__default.useContext(SledgeContext);
|
|
631
|
+
const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
|
|
632
632
|
const defaultColorIcon = "#767676";
|
|
633
633
|
const defaultTypeIcon = "outline";
|
|
634
634
|
const activeColorIcon = "#F85538";
|
|
@@ -652,6 +652,7 @@ const Trigger = (props) => {
|
|
|
652
652
|
setIsWishlist(response);
|
|
653
653
|
};
|
|
654
654
|
const handleClick = async (e) => {
|
|
655
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
655
656
|
e.preventDefault();
|
|
656
657
|
e.stopPropagation();
|
|
657
658
|
if (isRequiredLogin) {
|
|
@@ -672,8 +673,11 @@ const Trigger = (props) => {
|
|
|
672
673
|
const { code } = status || {};
|
|
673
674
|
if (code === 200) {
|
|
674
675
|
if (typeof window !== "undefined") {
|
|
675
|
-
if (window.sledgeWishlistBadgeUpdate)
|
|
676
|
+
if (window.sledgeWishlistBadgeUpdate) {
|
|
677
|
+
if ((_b2 = (_a2 = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _a2.badge) == null ? void 0 : _b2.trigger)
|
|
678
|
+
(_f = (_c2 = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _c2.badge) == null ? void 0 : _f.trigger(!((_e = (_d = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _d.badge) == null ? void 0 : _e.value));
|
|
676
679
|
window.sledgeWishlistBadgeUpdate();
|
|
680
|
+
}
|
|
677
681
|
if (window.sledgeWishlistWidgetListUpdate)
|
|
678
682
|
window.sledgeWishlistWidgetListUpdate();
|
|
679
683
|
if (window.sledgeWishlistButtonDetailUpdate)
|
|
@@ -820,6 +824,7 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
|
|
|
820
824
|
};
|
|
821
825
|
const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger, shareLink, shareId, dataSettings, isFirstLoading }) => {
|
|
822
826
|
var _a, _b, _c, _d, _e, _f;
|
|
827
|
+
const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
|
|
823
828
|
const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
|
|
824
829
|
const {
|
|
825
830
|
text_color: display_button_share_text_color,
|
|
@@ -858,7 +863,7 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
858
863
|
</svg>`;
|
|
859
864
|
let checkIcon = `<svg width="20" height="20" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path></svg>`;
|
|
860
865
|
const handleBulkAddWishlist = async () => {
|
|
861
|
-
var _a2;
|
|
866
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g;
|
|
862
867
|
setIsLoadingBulkAdd(true);
|
|
863
868
|
let data = wishlistData.map((item) => {
|
|
864
869
|
const { id, variant_id, name, variant_name, url, image_url, currency, price } = item.product;
|
|
@@ -876,8 +881,11 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
|
|
|
876
881
|
let resBulkAddWishlist = await bulkAddWishlist(data);
|
|
877
882
|
if (((_a2 = resBulkAddWishlist == null ? void 0 : resBulkAddWishlist.status) == null ? void 0 : _a2.code) === 200) {
|
|
878
883
|
if (typeof window !== "undefined") {
|
|
879
|
-
if (window.sledgeWishlistBadgeUpdate)
|
|
884
|
+
if (window.sledgeWishlistBadgeUpdate) {
|
|
885
|
+
if ((_c2 = (_b2 = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _b2.badge) == null ? void 0 : _c2.trigger)
|
|
886
|
+
(_g = (_d2 = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _d2.badge) == null ? void 0 : _g.trigger(!((_f2 = (_e2 = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _e2.badge) == null ? void 0 : _f2.value));
|
|
880
887
|
window.sledgeWishlistBadgeUpdate();
|
|
888
|
+
}
|
|
881
889
|
if (window.sledgeInfoPopup)
|
|
882
890
|
window.sledgeInfoPopup({
|
|
883
891
|
title: title_added_all_to_wishlist,
|