@sledge-app/react-instant-search 1.0.20 → 1.0.22

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.
@@ -1,5 +1,5 @@
1
- import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, a as $cb5cc270b50c6fcd$export$41fb9f06171c75f4, b as $cb5cc270b50c6fcd$export$602eac185826482c, c as $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, d as $cb5cc270b50c6fcd$export$f39c2d165cd861fe, e as $cb5cc270b50c6fcd$export$21b07c8f274aebd5, f as $67824d98245208a0$export$be92b6f5f03c0fe9, g as $67824d98245208a0$export$adb584737d712b70, h as $e698a72e93240346$export$be92b6f5f03c0fe9, i as $e698a72e93240346$export$adb584737d712b70, k as $faa2e61a3361514f$export$be92b6f5f03c0fe9, l as $faa2e61a3361514f$export$13921ac0cc260818, m as $faa2e61a3361514f$export$9a58ef0d7ad3278c, n as $faa2e61a3361514f$export$6521433ed15a34db, o as $f99a8c78507165f7$export$be92b6f5f03c0fe9, p as $f99a8c78507165f7$export$6d08773d2e66f8f2, q as $f99a8c78507165f7$export$adb584737d712b70, r as $cc7e05a45900e73f$export$6d08773d2e66f8f2, s as $cc7e05a45900e73f$export$d6e5bf9c43ea9319, t as $cc7e05a45900e73f$export$c3468e2714d175fa, u as $cc7e05a45900e73f$export$be92b6f5f03c0fe9, v as $cc7e05a45900e73f$export$41fb9f06171c75f4, w as $cc7e05a45900e73f$export$4c8d1a57a761ef94, x as $cc7e05a45900e73f$export$f04a61298a47a40f, y as $cc7e05a45900e73f$export$602eac185826482c, z as $cc7e05a45900e73f$export$7c6e2c02157bb7d2, A as $cc7e05a45900e73f$export$2f60d3ec9ad468f2, B as $cc7e05a45900e73f$export$d5c6c08dc2d3ca7, C as $cc7e05a45900e73f$export$bf1aedc3039c8d63, D as motion, E as client, F as $a093c7e1ec25a057$export$2881499e37b75b9a, G as $a093c7e1ec25a057$export$be92b6f5f03c0fe9, H as $a093c7e1ec25a057$export$41fb9f06171c75f4, I as $a093c7e1ec25a057$export$602eac185826482c, J as $a093c7e1ec25a057$export$7c6e2c02157bb7d2, K as $a093c7e1ec25a057$export$21b07c8f274aebd5, L as $57acba87d6e25586$export$be92b6f5f03c0fe9, M as $57acba87d6e25586$export$d5c6c08dc2d3ca7, N as $57acba87d6e25586$export$9a4e88b92edfce6b, O as $57acba87d6e25586$export$6521433ed15a34db, P as MasonryResponsive, Q as Masonry, R as $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, S as $5d3850c4d0b4e6c7$export$602eac185826482c, T as $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, U as $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 } from "./vendor-efe38901.js";
2
- import React__default from "react";
1
+ import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, a as $cb5cc270b50c6fcd$export$41fb9f06171c75f4, b as $cb5cc270b50c6fcd$export$602eac185826482c, c as $cb5cc270b50c6fcd$export$7c6e2c02157bb7d2, d as $cb5cc270b50c6fcd$export$f39c2d165cd861fe, e as $cb5cc270b50c6fcd$export$21b07c8f274aebd5, f as $67824d98245208a0$export$be92b6f5f03c0fe9, g as $67824d98245208a0$export$adb584737d712b70, h as $e698a72e93240346$export$be92b6f5f03c0fe9, i as $e698a72e93240346$export$adb584737d712b70, k as $faa2e61a3361514f$export$be92b6f5f03c0fe9, l as $faa2e61a3361514f$export$13921ac0cc260818, m as $faa2e61a3361514f$export$9a58ef0d7ad3278c, n as $faa2e61a3361514f$export$6521433ed15a34db, o as $f99a8c78507165f7$export$be92b6f5f03c0fe9, p as $f99a8c78507165f7$export$6d08773d2e66f8f2, q as $f99a8c78507165f7$export$adb584737d712b70, r as $cc7e05a45900e73f$export$6d08773d2e66f8f2, s as $cc7e05a45900e73f$export$d6e5bf9c43ea9319, t as $cc7e05a45900e73f$export$c3468e2714d175fa, u as $cc7e05a45900e73f$export$be92b6f5f03c0fe9, v as $cc7e05a45900e73f$export$41fb9f06171c75f4, w as $cc7e05a45900e73f$export$4c8d1a57a761ef94, x as $cc7e05a45900e73f$export$f04a61298a47a40f, y as $cc7e05a45900e73f$export$602eac185826482c, z as $cc7e05a45900e73f$export$7c6e2c02157bb7d2, A as $cc7e05a45900e73f$export$2f60d3ec9ad468f2, B as $cc7e05a45900e73f$export$d5c6c08dc2d3ca7, C as $cc7e05a45900e73f$export$bf1aedc3039c8d63, D as motion, E as client, F as $a093c7e1ec25a057$export$2881499e37b75b9a, G as $a093c7e1ec25a057$export$be92b6f5f03c0fe9, H as $a093c7e1ec25a057$export$41fb9f06171c75f4, I as $a093c7e1ec25a057$export$602eac185826482c, J as $a093c7e1ec25a057$export$7c6e2c02157bb7d2, K as $a093c7e1ec25a057$export$21b07c8f274aebd5, L as $57acba87d6e25586$export$be92b6f5f03c0fe9, M as $57acba87d6e25586$export$d5c6c08dc2d3ca7, N as $57acba87d6e25586$export$9a4e88b92edfce6b, O as $57acba87d6e25586$export$6521433ed15a34db, P as MasonryResponsive, Q as Masonry, R as useEmblaCarousel, S as $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9, T as $5d3850c4d0b4e6c7$export$602eac185826482c, U as $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff, V as $5d3850c4d0b4e6c7$export$7c6e2c02157bb7d2 } from "./vendor-eadacf73.js";
2
+ import React__default, { createElement } from "react";
3
3
  import { SledgeContext } from "@sledge-app/core";
4
4
  import "react-dom";
5
5
  const ProductFilterWidget = (props) => {
@@ -7,6 +7,7 @@ const ProductFilterWidget = (props) => {
7
7
  };
8
8
  const API_URL = "https://api.sledge-app.com";
9
9
  const INSTANT_SEARCH_ENGINE_URL = "https://instant-search-engine.sledge-app.com";
10
+ const CDN_URL = "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com";
10
11
  const SELECTOR_ATTRIBUTE_KEY = "data-component";
11
12
  const DATASET_ATTRIBUTE_KEY = {
12
13
  GLOBAL: {
@@ -34,7 +35,11 @@ const DATASET_ATTRIBUTE_KEY = {
34
35
  API_KEY: "data-api-key",
35
36
  INSTANT_SEARCH_API_KEY: "data-instant-search-api-key",
36
37
  RENDER_PRODUCT_CARD: "data-render-product-card",
37
- WITH_SKELETON_LOADING: "data-with-skeleton-loading"
38
+ WITH_SKELETON_LOADING: "data-with-skeleton-loading",
39
+ SECTION_TITLE: "data-section-title",
40
+ SECTION_DESCRIPTION: "data-section-description",
41
+ USE_SLIDER: "data-use-slider",
42
+ POSITION_WIDGET: "data-position-widget"
38
43
  },
39
44
  WISHLIST: {
40
45
  SHARE_ID: "data-share-id",
@@ -46,7 +51,9 @@ const DATASET_ATTRIBUTE_KEY = {
46
51
  PRODUCT_REVIEW: {
47
52
  RATING_SIZE: "data-rating-size",
48
53
  RATING_TOTAL: "data-rating-total",
49
- RATING_AVERAGE: "data-rating-average"
54
+ RATING_AVERAGE: "data-rating-average",
55
+ RENDER_REVIEW_PRODUCT_INFO: "data-render-review-product-info",
56
+ SHOW_RATING_AVERAGE: "data-show-rating-average"
50
57
  },
51
58
  INSTANT_SEARCH: {
52
59
  ON_AFTER_RENDER_COLLECTION: "data-on-after-render-collection",
@@ -62,6 +69,10 @@ const DATASET_ATTRIBUTE_KEY = {
62
69
  RENDER_PAGE_CARD: "data-render-page-card",
63
70
  RENDER_BLOG_CARD: "data-render-blog-card",
64
71
  RENDER_ARTICLE_CARD: "data-render-article-card"
72
+ },
73
+ PRODUCT_RECOMMENDATION: {
74
+ LIMIT_TO_DISPLAY: "data-limit-to-display",
75
+ HIDDEN_PRODUCT_IDS: "data-hidden-product-ids"
65
76
  }
66
77
  };
67
78
  const LOCAL_STORAGE_KEY = {
@@ -73,22 +84,25 @@ const LOCAL_STORAGE_KEY = {
73
84
  WISHLIST_SETTING: "sledge-wishlist-setting",
74
85
  PRODUCT_REVIEW_SETTING: "sledge-product-review-setting",
75
86
  INSTANT_SEARCH_SETTING: "sledge-instant-search-setting",
87
+ PRODUCT_RECOMMENDATION_SETTING: "sledge-product-recommendation-setting",
76
88
  ISSUED_AUTH_APP: "sledge-issued-auth-app",
77
- EXPIRED_AUTH_APP: "sledge-expired-auth-app"
89
+ EXPIRED_AUTH_APP: "sledge-expired-auth-app",
90
+ RECENTLY_VIEWED_APP: "sledge-recently-viewed"
78
91
  };
79
92
  const INTERNAL_SELECTOR_VALUE = {
80
93
  ELEMENT_TOAST_NOTIFICATION: "toast-notification",
81
94
  ELEMENT_CONFIRMATION_POPUP: "confirmation-popup",
82
95
  ELEMENT_INFO_POPUP: "info-popup",
83
96
  ELEMENT_CONTAINER_WIDGET: "container-widget",
97
+ ELEMENT_FLOATING_LEFT_WIDGET: "floating-left-widget",
98
+ ELEMENT_FLOATING_RIGHT_WIDGET: "floating-right-widget",
84
99
  WISHLIST: {
85
- ELEMENT_BADGE_FLOATING_ICON: "wishlist-badge-floating-icon",
86
- ELEMENT_BADGE_FLOATING_FULL: "wishlist-badge-floating-full",
87
100
  ELEMENT_WIDGET_POPUP: "wishlist-widget-popup"
88
101
  },
89
102
  PRODUCT_REVIEW: {
90
103
  ELEMENT_WIDGET_POPUP_DETAIL: "product-review-widget-popup-detail",
91
- ELEMENT_WIDGET_FORM_ADD: "product-review-widget-form-add"
104
+ ELEMENT_WIDGET_FORM_ADD: "product-review-widget-form-add",
105
+ ELEMENT_HAPPY_CUSTOMERS_PAGE_POPUP: "product-review-happy-customers-page-popup"
92
106
  },
93
107
  INSTANT_SEARCH: {
94
108
  ELEMENT_SEARCH_ICON_WIDGET_POPUP: "instant-search-icon-widget-popup"
@@ -107,15 +121,21 @@ const SELECTOR = {
107
121
  },
108
122
  PRODUCT_REVIEW: {
109
123
  ELEMENT_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-widget"]`,
110
- ELEMENT_RATING: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-rating"]`
124
+ ELEMENT_HAPPY_CUSTOMERS_PAGE: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-happy-customers-page"]`,
125
+ ELEMENT_RATING: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-rating"]`,
126
+ ELEMENT_STICKY_SIDEBAR_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="product-review-sticky-sidebar-widget"]`
111
127
  },
112
128
  INSTANT_SEARCH: {
113
129
  ELEMENT_SEARCH_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-widget"]`,
114
130
  ELEMENT_SEARCH_ICON_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-icon-widget"]`,
115
131
  ELEMENT_SEARCH_RESULT_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-result-widget"]`,
116
132
  ELEMENT_PLP_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="instant-search-product-filter-widget"]`
133
+ },
134
+ PRODUCT_RECOMMENDATION: {
135
+ ELEMENT_RECENTLY_VIEWED_WIDGET: `[${SELECTOR_ATTRIBUTE_KEY}="product-recommendation-recently-viewed-widget"]`
117
136
  }
118
137
  };
138
+ const DEFAULT_MAX_WIDTH_COMPONENT = "1180px";
119
139
  const DEFAULT_SEARCH_RESULT_URL = "/apps/sledge/search";
120
140
  const DEFAULT_WISHLIST_URL = "/apps/sledge/wishlist";
121
141
  const DEFAULT_QUERY_PARAM = {
@@ -557,8 +577,18 @@ const NoteIcon = ({ width, height, color }) => {
557
577
  };
558
578
  const Button$1 = "";
559
579
  const Button = React__default.forwardRef((props, buttonRef) => {
560
- const { className = "", children, colorType = "light", fullWidth = false, elementType = "button", link = "", ...otherProps } = props;
561
- return elementType === "hyperlink" && (link == null ? void 0 : link.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, className: `sledge__button ${className || ""}`, "data-button-color-type": colorType, "data-button-full-width": fullWidth, ref: buttonRef, ...otherProps, children }) : /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: `sledge__button ${className || ""}`, "data-button-color-type": colorType, "data-button-full-width": fullWidth, ref: buttonRef, ...otherProps, children });
580
+ const { className = "", children, colorType = "light", fullWidth = false, elementType = "button", link = "", isActive, ...otherProps } = props;
581
+ return elementType === "hyperlink" && (link == null ? void 0 : link.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: link, className: `sledge__button ${className || ""}`, "data-button-color-type": colorType, "data-button-full-width": fullWidth, ref: buttonRef, ...otherProps, children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
582
+ "button",
583
+ {
584
+ className: `sledge__button ${className || ""} ${isActive ? "sledge__button-active" : ""}`,
585
+ "data-button-color-type": colorType,
586
+ "data-button-full-width": fullWidth,
587
+ ref: buttonRef,
588
+ ...otherProps,
589
+ children
590
+ }
591
+ );
562
592
  });
563
593
  const SearchInputField$1 = "";
564
594
  const SearchInputField = (props) => {
@@ -647,7 +677,7 @@ const SelectField = (props) => {
647
677
  };
648
678
  const ProductGrid$1 = "";
649
679
  async function swr(url, options) {
650
- if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET") {
680
+ if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET" && !(options == null ? void 0 : options.ignoreSWR)) {
651
681
  const data = await getData(url);
652
682
  return await data.json();
653
683
  } else
@@ -702,8 +732,23 @@ const scrollToElement = (params) => {
702
732
  behavior: "smooth"
703
733
  });
704
734
  };
735
+ const getUnixTimestamp = (params) => {
736
+ const { addMoreTime = 0, addMoreTimeBy = "day" } = params || {};
737
+ let moreTime = 0;
738
+ if (addMoreTime) {
739
+ if (addMoreTimeBy === "day")
740
+ moreTime = addMoreTime * 60 * 60 * 24;
741
+ if (addMoreTimeBy === "hour")
742
+ moreTime = addMoreTime * 60 * 60;
743
+ if (addMoreTimeBy === "minute")
744
+ moreTime = addMoreTime * 60;
745
+ if (addMoreTimeBy === "second")
746
+ moreTime = addMoreTime;
747
+ }
748
+ return Math.floor(Date.now() / 1e3) + moreTime;
749
+ };
705
750
  const fetchApi = async (params) => {
706
- const { url, method, authorization = "", payload = {}, headers = {}, isSimpleRequest = true, isUploadFile = false } = params;
751
+ const { url, method, authorization = "", payload = {}, headers = {}, isSimpleRequest = true, isUploadFile = false, ignoreSWR = false } = params;
707
752
  var myHeaders = new Headers();
708
753
  if (!isSimpleRequest) {
709
754
  if (authorization)
@@ -732,7 +777,8 @@ const fetchApi = async (params) => {
732
777
  method: fixMethod,
733
778
  redirect: "follow",
734
779
  headers: myHeaders,
735
- body: fixMethod === "GET" ? null : isSimpleRequest || isUploadFile ? formdata : JSON.stringify(payload)
780
+ body: fixMethod === "GET" ? null : isSimpleRequest || isUploadFile ? formdata : JSON.stringify(payload),
781
+ ignoreSWR
736
782
  };
737
783
  return await swr(`${url}`, requestOptions);
738
784
  };
@@ -742,6 +788,35 @@ const convertDate = (date, options = {
742
788
  month: "numeric",
743
789
  day: "numeric"
744
790
  }) => new Date(date).toLocaleString("en-US", options);
791
+ const watchElement = ({ selector = null, init = null, customInit = false }) => {
792
+ if (!selector || !init)
793
+ return;
794
+ var observer = new MutationObserver(function(mutations) {
795
+ mutations.forEach(function(mutation) {
796
+ var nodes = Array.prototype.slice.call(mutation.addedNodes);
797
+ nodes.forEach(function(node) {
798
+ if (node.nodeType === 1 && (node.matches(selector) || node.querySelector(selector))) {
799
+ if (!customInit) {
800
+ let elementNode = Array.from(node.querySelectorAll(selector));
801
+ if (elementNode.length) {
802
+ elementNode.map((item) => {
803
+ init(item);
804
+ });
805
+ }
806
+ } else {
807
+ init();
808
+ }
809
+ }
810
+ });
811
+ });
812
+ });
813
+ observer.observe(document.body, {
814
+ childList: true,
815
+ subtree: true,
816
+ attributes: false,
817
+ characterData: false
818
+ });
819
+ };
745
820
  const addToCart = async (data) => {
746
821
  var _a, _b;
747
822
  let items = [];
@@ -773,113 +848,6 @@ const addToCart = async (data) => {
773
848
  return;
774
849
  });
775
850
  };
776
- const BadgeFloatingFull = (props) => {
777
- var _a;
778
- const { sledgeAnonymId } = React__default.useContext(SledgeContext);
779
- const { isFirstLoading, isLoading, totalWishlist, isMaximizeTotalWishlist, proxyUrl, position = "left", dataSettings, useProxyUrl } = props || {};
780
- const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
781
- const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
782
- React__default.useEffect(() => {
783
- setIsRequiredLogin(sledgeAnonymId && is_required_login);
784
- }, [sledgeAnonymId]);
785
- const handleRequiredLogin = (e) => {
786
- if (isRequiredLogin) {
787
- e.preventDefault();
788
- e.stopPropagation();
789
- }
790
- if (isRequiredLogin) {
791
- if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
792
- window.sledgeConfirmationPopup({
793
- title: "Login required!",
794
- message: "Please login to save your wishlist across devices.",
795
- textSubmit: "Login",
796
- textCancel: "Cancel",
797
- buttonSubmitType: "info",
798
- onSubmit: () => window.location.href = "/account/login"
799
- });
800
- } else {
801
- if (useProxyUrl)
802
- window.location.href = proxyUrl || "/";
803
- }
804
- };
805
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-wishlist__badge-floating sledge-wishlist__badge-floating-${position}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { onClick: handleRequiredLogin, className: "sledge-wishlist__badge-floating-icon-link", children: [
806
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-wishlist__badge-floating-text", children: "My Wishlist" }),
807
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge-icon", children: [
808
- /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 18, height: 18, type: "fill", color: "#000000" }),
809
- !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
810
- ] })
811
- ] }) });
812
- };
813
- const BadgeFloatingIcon = (props) => {
814
- var _a;
815
- const { sledgeAnonymId } = React__default.useContext(SledgeContext);
816
- const { isFirstLoading, isLoading, totalWishlist, isMaximizeTotalWishlist, proxyUrl, position = "bottom-right", dataSettings, useProxyUrl } = props || {};
817
- const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
818
- const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
819
- React__default.useEffect(() => {
820
- setIsRequiredLogin(sledgeAnonymId && is_required_login);
821
- }, [sledgeAnonymId]);
822
- const handleRequiredLogin = (e) => {
823
- if (isRequiredLogin) {
824
- e.preventDefault();
825
- e.stopPropagation();
826
- }
827
- if (isRequiredLogin) {
828
- if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
829
- window.sledgeConfirmationPopup({
830
- title: "Login required!",
831
- message: "Please login to save your wishlist across devices.",
832
- textSubmit: "Login",
833
- textCancel: "Cancel",
834
- buttonSubmitType: "info",
835
- onSubmit: () => window.location.href = "/account/login"
836
- });
837
- } else {
838
- if (useProxyUrl)
839
- window.location.href = proxyUrl || "/";
840
- }
841
- };
842
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-wishlist__badge-floating-icon sledge-wishlist__badge-floating-${position}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: handleRequiredLogin, className: "sledge-wishlist__badge-floating-icon-link", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge-icon", children: [
843
- /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 27.01, height: 25.73, type: "outline", color: "#000000" }),
844
- !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
845
- ] }) }) });
846
- };
847
- const BadgeHeaderMenu = (props) => {
848
- var _a;
849
- const { sledgeAnonymId } = React__default.useContext(SledgeContext);
850
- const { isFirstLoading, isLoading, totalWishlist, isMaximizeTotalWishlist, proxyUrl, dataSettings, useProxyUrl } = props || {};
851
- const { is_required_login } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.global) || {};
852
- const defaultColorIcon = "currentColor";
853
- const [colorIcon, setColorIcon] = React__default.useState(defaultColorIcon);
854
- const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
855
- React__default.useEffect(() => {
856
- setIsRequiredLogin(sledgeAnonymId && is_required_login);
857
- }, [sledgeAnonymId]);
858
- const handleRequiredLogin = (e) => {
859
- if (isRequiredLogin) {
860
- e.preventDefault();
861
- e.stopPropagation();
862
- }
863
- if (isRequiredLogin) {
864
- if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
865
- window.sledgeConfirmationPopup({
866
- title: "Login required!",
867
- message: "Please login to save your wishlist across devices.",
868
- textSubmit: "Login",
869
- textCancel: "Cancel",
870
- buttonSubmitType: "info",
871
- onSubmit: () => window.location.href = "/account/login"
872
- });
873
- } else {
874
- if (useProxyUrl)
875
- window.location.href = proxyUrl || "/";
876
- }
877
- };
878
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge", onClick: handleRequiredLogin, onMouseEnter: () => setColorIcon("#F85538"), onMouseLeave: () => setColorIcon(defaultColorIcon), children: [
879
- /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 20, height: 20, type: "outline", color: colorIcon }),
880
- !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-header-menu ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
881
- ] });
882
- };
883
851
  const addWishlist = async (data) => {
884
852
  const { productId, productVariantId, productName, productVendor, productSku, productVariantName, productLink, productImage, productCurrency, productPrice } = data;
885
853
  let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
@@ -995,18 +963,24 @@ const addToCartTrigger$1 = async (data) => {
995
963
  return;
996
964
  });
997
965
  };
998
- const BadgeRoot = (props) => {
966
+ const Badge = (props) => {
999
967
  var _a;
1000
- const { children, useProxyUrl = false, data: propsData } = props;
1001
- const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
968
+ const { useProxyUrl = false, data: propsData, position: positionProp } = props;
969
+ const { isRenderApp, triggerRenderMultipleComponent, sledgeAnonymId } = React__default.useContext(SledgeContext);
1002
970
  const { wishlist: isRenderAppWishlist } = isRenderApp || {};
1003
971
  const { value: valueRenderWishlistBadge, trigger: triggerRenderWishlistBadge } = ((_a = triggerRenderMultipleComponent == null ? void 0 : triggerRenderMultipleComponent.wishlist) == null ? void 0 : _a.badge) || {};
972
+ const defaultColorIcon = "currentColor";
973
+ const [colorIcon, setColorIcon] = React__default.useState(defaultColorIcon);
1004
974
  const [totalWishlist, setTotalWishlist] = React__default.useState((propsData == null ? void 0 : propsData.total_data) || 0);
1005
975
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(!propsData);
1006
976
  const [isLoading, setIsLoading] = React__default.useState(!propsData);
1007
977
  const [isMaximizeTotalWishlist, setIsMaximizeTotalWishlist] = React__default.useState(false);
1008
978
  const [proxyUrl, setProxyUrl] = React__default.useState((propsData == null ? void 0 : propsData.proxy_url) || "");
1009
979
  const [dataSettings, setDataSettings] = React__default.useState({});
980
+ const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
981
+ const { floating_button_type } = (dataSettings == null ? void 0 : dataSettings.launch_point) || {};
982
+ const defaultPosition = positionProp || floating_button_type;
983
+ const position = defaultPosition ? defaultPosition : "none";
1010
984
  const handleGetWishlistInfo = async () => {
1011
985
  var _a2, _b;
1012
986
  let response;
@@ -1030,14 +1004,40 @@ const BadgeRoot = (props) => {
1030
1004
  response = JSON.parse(LOCAL_STORAGE_WISHLIST_SETTING);
1031
1005
  if (!response)
1032
1006
  return;
1007
+ const { is_required_login } = response || {};
1033
1008
  setDataSettings(response);
1034
- await handleGetWishlistInfo();
1009
+ setIsRequiredLogin(sledgeAnonymId && is_required_login);
1010
+ };
1011
+ const handleRequiredLogin = (e) => {
1012
+ if (isRequiredLogin) {
1013
+ e.preventDefault();
1014
+ e.stopPropagation();
1015
+ }
1016
+ if (isRequiredLogin) {
1017
+ if (typeof window !== "undefined" && window.sledgeConfirmationPopup)
1018
+ window.sledgeConfirmationPopup({
1019
+ title: "Login required!",
1020
+ message: "Please login to save your wishlist across devices.",
1021
+ textSubmit: "Login",
1022
+ textCancel: "Cancel",
1023
+ buttonSubmitType: "info",
1024
+ onSubmit: () => window.location.href = "/account/login"
1025
+ });
1026
+ } else {
1027
+ if (useProxyUrl)
1028
+ window.location.href = proxyUrl || "/";
1029
+ }
1035
1030
  };
1036
1031
  React__default.useEffect(() => {
1037
1032
  if (!isRenderAppWishlist)
1038
1033
  return;
1039
1034
  handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.WISHLIST_SETTING) || null);
1040
1035
  }, [isRenderAppWishlist]);
1036
+ React__default.useEffect(() => {
1037
+ if (!(dataSettings == null ? void 0 : dataSettings.launch_point))
1038
+ return;
1039
+ handleGetWishlistInfo();
1040
+ }, [dataSettings]);
1041
1041
  React__default.useEffect(() => {
1042
1042
  if (!valueRenderWishlistBadge)
1043
1043
  return;
@@ -1045,86 +1045,96 @@ const BadgeRoot = (props) => {
1045
1045
  triggerRenderWishlistBadge(false);
1046
1046
  handleGetWishlistInfo();
1047
1047
  }, [valueRenderWishlistBadge]);
1048
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.count(children) && React__default.Children.map(
1049
- children,
1050
- (child) => React__default.cloneElement(child, {
1051
- isFirstLoading,
1052
- isLoading,
1053
- totalWishlist,
1054
- isMaximizeTotalWishlist,
1055
- proxyUrl,
1056
- dataSettings,
1057
- useProxyUrl
1058
- })
1059
- ) });
1048
+ const HeaderMenu = () => {
1049
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge", onClick: handleRequiredLogin, onMouseEnter: () => setColorIcon("#F85538"), onMouseLeave: () => setColorIcon(defaultColorIcon), children: [
1050
+ /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 20, height: 20, type: "outline", color: colorIcon }),
1051
+ !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-header-menu ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
1052
+ ] });
1053
+ };
1054
+ const FloatingFull = () => {
1055
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-wishlist__badge-floating sledge__badge-floating-${position}`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { onClick: handleRequiredLogin, className: "sledge-wishlist__badge-floating-icon-link", children: [
1056
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-wishlist__badge-floating-text", children: "My Wishlist" }),
1057
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge-icon", children: [
1058
+ /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 18, height: 18, type: "fill", color: "#000000" }),
1059
+ !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
1060
+ ] })
1061
+ ] }) });
1062
+ };
1063
+ const FloatingIcon = () => {
1064
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge-wishlist__badge-floating-icon sledge-wishlist__badge-floating-${position}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { onClick: handleRequiredLogin, className: "sledge-wishlist__badge-floating-icon-link", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "sledge-wishlist__badge-icon", children: [
1065
+ /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 27.01, height: 25.73, type: "outline", color: "#000000" }),
1066
+ !isFirstLoading && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `sledge-wishlist__badge-counter sledge-wishlist__badge-counter-bottom-right ${isMaximizeTotalWishlist ? "sledge-wishlist__badge-fit-content" : ""}`, children: isLoading || isRequiredLogin ? 0 : `${isMaximizeTotalWishlist ? "99+" : totalWishlist}` || 0 })
1067
+ ] }) }) });
1068
+ };
1069
+ return isFirstLoading ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: position === "none" ? /* @__PURE__ */ jsxRuntimeExports.jsx(HeaderMenu, {}) : String(position).includes("bottom") ? /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingIcon, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(FloatingFull, {}) });
1060
1070
  };
1061
- const Badge = ({ children }) => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.count(children) && React__default.Children.map(children, (child) => React__default.cloneElement(child, {})) });
1062
- Badge.Root = BadgeRoot;
1063
- Badge.HeaderMenu = BadgeHeaderMenu;
1064
- Badge.FloatingFull = BadgeFloatingFull;
1065
- Badge.FloatingIcon = BadgeFloatingIcon;
1066
1071
  const BadgeInitSelector = () => {
1067
1072
  const sledgeWishlistSettings = localStorage.getItem(LOCAL_STORAGE_KEY.WISHLIST_SETTING) ? JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY.WISHLIST_SETTING) || "") : null;
1068
- if (!sledgeWishlistSettings)
1073
+ let element = Array.from(document.querySelectorAll(SELECTOR.WISHLIST.ELEMENT_BADGE));
1074
+ let isElementDetected = !element || element && !element.length;
1075
+ if (!sledgeWishlistSettings || isElementDetected)
1069
1076
  return;
1070
1077
  const { floating_button_type } = (sledgeWishlistSettings == null ? void 0 : sledgeWishlistSettings.launch_point) || {};
1071
1078
  const isBottomFloatingType = String(floating_button_type).includes("bottom");
1072
1079
  if (floating_button_type !== "none") {
1073
1080
  if (isBottomFloatingType) {
1074
- let elementFloatingIcon = document.createElement("div");
1075
- elementFloatingIcon.setAttribute(SELECTOR_ATTRIBUTE_KEY, INTERNAL_SELECTOR_VALUE.WISHLIST.ELEMENT_BADGE_FLOATING_ICON);
1076
- document.body.appendChild(elementFloatingIcon);
1077
- if (elementFloatingIcon) {
1078
- elementFloatingIcon.innerHTML = "";
1079
- const USE_PROXY_URL = elementFloatingIcon.getAttribute(DATASET_ATTRIBUTE_KEY.WISHLIST.USE_PROXY_URL);
1080
- client.createRoot(elementFloatingIcon).render(
1081
- /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1082
- SledgeContext.Provider,
1083
- {
1084
- value: {
1085
- isRenderApp: {
1086
- wishlist: true,
1087
- productReview: true,
1088
- instantSearch: true
1081
+ element.map((item, index) => {
1082
+ if (item && !index) {
1083
+ if (item.querySelector(`[${SELECTOR_ATTRIBUTE_KEY}="${INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET}"]`))
1084
+ item.querySelector(`[${SELECTOR_ATTRIBUTE_KEY}="${INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET}"]`).remove();
1085
+ let elementContainerWidget = document.createElement("div");
1086
+ elementContainerWidget.setAttribute(SELECTOR_ATTRIBUTE_KEY, INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET);
1087
+ item.appendChild(elementContainerWidget);
1088
+ const USE_PROXY_URL = item.getAttribute(DATASET_ATTRIBUTE_KEY.WISHLIST.USE_PROXY_URL);
1089
+ client.createRoot(elementContainerWidget).render(
1090
+ /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1091
+ SledgeContext.Provider,
1092
+ {
1093
+ value: {
1094
+ isRenderApp: {
1095
+ wishlist: true,
1096
+ productReview: true,
1097
+ instantSearch: true
1098
+ },
1099
+ sledgeAnonymId: localStorage.getItem(LOCAL_STORAGE_KEY.ANONYM_ID) || "",
1100
+ isJsVersion: true
1089
1101
  },
1090
- sledgeAnonymId: localStorage.getItem(LOCAL_STORAGE_KEY.ANONYM_ID) || "",
1091
- isJsVersion: true
1092
- },
1093
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.Root, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.FloatingIcon, { position: floating_button_type }) })
1094
- }
1095
- ) })
1096
- );
1097
- }
1102
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true"), position: floating_button_type })
1103
+ }
1104
+ ) })
1105
+ );
1106
+ }
1107
+ });
1098
1108
  } else {
1099
- let elementFloatingFull = document.createElement("div");
1100
- elementFloatingFull.setAttribute(SELECTOR_ATTRIBUTE_KEY, INTERNAL_SELECTOR_VALUE.WISHLIST.ELEMENT_BADGE_FLOATING_FULL);
1101
- document.body.appendChild(elementFloatingFull);
1102
- if (elementFloatingFull) {
1103
- elementFloatingFull.innerHTML = "";
1104
- const USE_PROXY_URL = elementFloatingFull.getAttribute(DATASET_ATTRIBUTE_KEY.WISHLIST.USE_PROXY_URL);
1105
- client.createRoot(elementFloatingFull).render(
1106
- /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1107
- SledgeContext.Provider,
1108
- {
1109
- value: {
1110
- isRenderApp: {
1111
- wishlist: true,
1112
- productReview: true,
1113
- instantSearch: true
1109
+ element.map((item, index) => {
1110
+ if (item && !index) {
1111
+ if (item.querySelector(`[${SELECTOR_ATTRIBUTE_KEY}="${INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET}"]`))
1112
+ item.querySelector(`[${SELECTOR_ATTRIBUTE_KEY}="${INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET}"]`).remove();
1113
+ let elementContainerWidget = document.createElement("div");
1114
+ elementContainerWidget.setAttribute(SELECTOR_ATTRIBUTE_KEY, INTERNAL_SELECTOR_VALUE.ELEMENT_CONTAINER_WIDGET);
1115
+ item.appendChild(elementContainerWidget);
1116
+ const USE_PROXY_URL = item.getAttribute(DATASET_ATTRIBUTE_KEY.WISHLIST.USE_PROXY_URL);
1117
+ client.createRoot(elementContainerWidget).render(
1118
+ /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1119
+ SledgeContext.Provider,
1120
+ {
1121
+ value: {
1122
+ isRenderApp: {
1123
+ wishlist: true,
1124
+ productReview: true,
1125
+ instantSearch: true
1126
+ },
1127
+ sledgeAnonymId: localStorage.getItem(LOCAL_STORAGE_KEY.ANONYM_ID) || "",
1128
+ isJsVersion: true
1114
1129
  },
1115
- sledgeAnonymId: localStorage.getItem(LOCAL_STORAGE_KEY.ANONYM_ID) || "",
1116
- isJsVersion: true
1117
- },
1118
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.Root, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.FloatingFull, { position: floating_button_type }) })
1119
- }
1120
- ) })
1121
- );
1122
- }
1130
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true"), position: floating_button_type })
1131
+ }
1132
+ ) })
1133
+ );
1134
+ }
1135
+ });
1123
1136
  }
1124
1137
  } else {
1125
- let element = Array.from(document.querySelectorAll(SELECTOR.WISHLIST.ELEMENT_BADGE));
1126
- if (!element || element && !element.length)
1127
- return;
1128
1138
  element.map((item) => {
1129
1139
  if (item) {
1130
1140
  const USE_PROXY_URL = item.getAttribute(DATASET_ATTRIBUTE_KEY.WISHLIST.USE_PROXY_URL);
@@ -1146,7 +1156,7 @@ const BadgeInitSelector = () => {
1146
1156
  sledgeAnonymId: localStorage.getItem(LOCAL_STORAGE_KEY.ANONYM_ID) || "",
1147
1157
  isJsVersion: true
1148
1158
  },
1149
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.Root, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge.HeaderMenu, {}) })
1159
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { useProxyUrl: Boolean(USE_PROXY_URL && USE_PROXY_URL === "true") })
1150
1160
  }
1151
1161
  ) })
1152
1162
  );
@@ -1206,11 +1216,11 @@ const Trigger = (props) => {
1206
1216
  });
1207
1217
  return;
1208
1218
  }
1209
- setIsWishlist(!isWishlist);
1210
1219
  let resAddWishlist = await addWishlist(params);
1211
1220
  const { status, data: response_data } = resAddWishlist || {};
1212
1221
  const { code } = status || {};
1213
1222
  if (code === 200) {
1223
+ setIsWishlist(!isWishlist);
1214
1224
  if (triggerRenderWishlistBadge)
1215
1225
  triggerRenderWishlistBadge(true);
1216
1226
  BadgeInitSelector();
@@ -1495,20 +1505,9 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
1495
1505
  React__default.useEffect(() => {
1496
1506
  setIsRequiredLogin(sledgeAnonymId && is_required_login);
1497
1507
  }, [sledgeAnonymId]);
1498
- var observer = new MutationObserver(function(mutations) {
1499
- mutations.forEach(function(mutation) {
1500
- var nodes = Array.prototype.slice.call(mutation.addedNodes);
1501
- nodes.forEach(function(node) {
1502
- if (node.nodeType === 1 && node.querySelector(".sledge-wishlist__widget-box-copy"))
1503
- handleCopyShareLink();
1504
- });
1505
- });
1506
- });
1507
- observer.observe(document.body, {
1508
- childList: true,
1509
- subtree: true,
1510
- attributes: false,
1511
- characterData: false
1508
+ watchElement({
1509
+ selector: ".sledge-wishlist__widget-box-copy",
1510
+ init: handleCopyShareLink
1512
1511
  });
1513
1512
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: showShareTrigger && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "136px", height: "46px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item sledge-wishlist__widget-header-share-trigger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1514
1513
  Button,
@@ -1689,10 +1688,15 @@ WidgetHeader$1.ShareTrigger = WidgetHeaderShareTrigger;
1689
1688
  WidgetHeader$1.ClearTrigger = WidgetHeaderClearTrigger;
1690
1689
  WidgetHeader$1.Sort = WidgetHeaderSort$1;
1691
1690
  WidgetHeader$1.Limit = WidgetHeaderLimit;
1692
- const getReviewInfo = async (id) => {
1693
- let convertId = sanitizeDataId(id);
1691
+ const getReviewInfo = async (props) => {
1692
+ const { productId = null, query = null } = props || {};
1693
+ let convertId = productId ? sanitizeDataId(productId) : "";
1694
1694
  let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
1695
- let url = `${API_URL}/review/info/${convertId}?${PAYLOAD_API_ALIASES.Authorization}=${sledgeAuthApp}`;
1695
+ let queryParams = "?" + new URLSearchParams({
1696
+ [PAYLOAD_API_ALIASES.Authorization]: sledgeAuthApp,
1697
+ ...query
1698
+ }).toString();
1699
+ let url = `${API_URL}/review/info/${convertId}${queryParams}`;
1696
1700
  return await fetchApi({
1697
1701
  url,
1698
1702
  method: "GET",
@@ -1721,7 +1725,22 @@ const getProductsReviewInfo = async (ids, token) => {
1721
1725
  };
1722
1726
  const Rating = (props) => {
1723
1727
  var _a, _b, _c;
1724
- const { total, average, size = "sm", params, withSkeletonLoading = true, withTotal = true, isScrollToElementWidget = true, data: propsData, sledgeSettings } = props;
1728
+ const {
1729
+ total,
1730
+ average,
1731
+ size = "sm",
1732
+ params,
1733
+ withSkeletonLoading = true,
1734
+ withTotal = true,
1735
+ isScrollToElementWidget = true,
1736
+ data: propsData,
1737
+ sledgeSettings,
1738
+ fillColor = "",
1739
+ outlineColor = "",
1740
+ withOutlineColor = true,
1741
+ customComponentId = "",
1742
+ numberOfIcons = 5
1743
+ } = props;
1725
1744
  const { productId } = params || {};
1726
1745
  const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
1727
1746
  const { productReview: isRenderAppProductReview } = isRenderApp || {};
@@ -1744,6 +1763,7 @@ const Rating = (props) => {
1744
1763
  const [isFirstTime, setIsFirstTime] = React__default.useState(true);
1745
1764
  const previousState = usePrevious({ productId });
1746
1765
  const { fill_color = "#23BC45", outline_color = "#8D9196" } = ((_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.rating) || {};
1766
+ const unixTimestamp = getUnixTimestamp();
1747
1767
  const handleProductRatingInfo = async (paramsProductId, isTriggerMultiComponent = false) => {
1748
1768
  var _a2;
1749
1769
  if (paramsProductId !== productId)
@@ -1758,7 +1778,9 @@ const Rating = (props) => {
1758
1778
  run = true;
1759
1779
  setIsFirstTime(false);
1760
1780
  } else {
1761
- response = await getReviewInfo(paramsProductId);
1781
+ response = await getReviewInfo({
1782
+ productId: paramsProductId
1783
+ });
1762
1784
  if (!response)
1763
1785
  return;
1764
1786
  const { status } = response;
@@ -1835,103 +1857,114 @@ const Rating = (props) => {
1835
1857
  setIsFirstLoading(true);
1836
1858
  handleProductRatingInfo(valueRenderProductReviewRating, true);
1837
1859
  }, [productId, valueRenderProductReviewRating]);
1838
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__rating", onClick: handleOnClick, "data-rating-size": size, children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isLoading && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1839
- [1, 2, 3, 4, 5].map((item, index) => {
1840
- let ratingValue = Math.floor(parseFloat(averageReview));
1841
- let getCommaValue = String(averageReview).includes(",") ? String(averageReview).split(",") : [];
1842
- let getCommaValueDot = String(averageReview).includes(".") ? String(averageReview).split(".") : [];
1843
- let isHaveCommaValue = getCommaValue.length || getCommaValueDot.length;
1844
- let commaValue = isHaveCommaValue ? getCommaValue[1] || getCommaValueDot[1] : 0;
1845
- let fillOther = "fill-0";
1846
- if (item > ratingValue && ratingValue + 1 === item) {
1847
- fillOther = `fill-${commaValue}`;
1848
- }
1849
- fillOther = item <= ratingValue ? "full" : fillOther;
1850
- let offset;
1851
- if (fillOther === "fill-0") {
1852
- offset = "0%";
1853
- }
1854
- if (fillOther === "fill-1") {
1855
- offset = "25%";
1856
- }
1857
- if (fillOther === "fill-2") {
1858
- offset = "35%";
1859
- }
1860
- if (fillOther === "fill-3") {
1861
- offset = "40%";
1862
- }
1863
- if (fillOther === "fill-4") {
1864
- offset = "45%";
1865
- }
1866
- if (fillOther === "fill-5") {
1867
- offset = "50%";
1868
- }
1869
- if (fillOther === "fill-6") {
1870
- offset = "60%";
1871
- }
1872
- if (fillOther === "fill-7") {
1873
- offset = "70%";
1874
- }
1875
- if (fillOther === "fill-8") {
1876
- offset = "80%";
1877
- }
1878
- if (fillOther === "fill-9") {
1879
- offset = "90%";
1880
- }
1881
- if (fillOther === "full") {
1882
- offset = "100%";
1883
- }
1884
- let suffixGradientId = `-${fillOther}-${index}-${productId}`;
1885
- let strokeGradientId = `rating-stroke${suffixGradientId}`;
1886
- let fillGradientId = `rating-gradient${suffixGradientId}`;
1887
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", ...sizing, viewBox: "0 0 32 32", children: [
1888
- /* @__PURE__ */ jsxRuntimeExports.jsxs("defs", { children: [
1889
- /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: strokeGradientId, children: [
1890
- /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fill_color }),
1891
- /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fillOther === "full" ? fill_color : outline_color })
1892
- ] }),
1893
- /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: fillGradientId, children: [
1894
- /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fill_color }),
1895
- /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: "transparent" })
1896
- ] })
1897
- ] }),
1898
- /* @__PURE__ */ jsxRuntimeExports.jsx(
1899
- "path",
1900
- {
1901
- fill: `url(#${fillGradientId})`,
1902
- d: "M9.18817 19.8162L9.25542 19.4179L8.94431 19.1604L3.14591 14.3604L3.14598 14.3603L3.13673 14.3529C2.5294 13.8672 2.784 12.8955 3.54372 12.7636L11.7291 12.3989L12.1807 12.3788L12.3481 11.959L15.8472 3.18648C15.977 2.94796 16.2257 2.79961 16.4979 2.79961C16.769 2.79961 17.0185 2.94848 17.1489 3.18698L20.6478 11.959L20.8152 12.3788L21.2668 12.3989L29.4522 12.7636C30.2119 12.8955 30.4665 13.8672 29.8592 14.3529L29.8591 14.3528L29.85 14.3604L24.0516 19.1604L23.7405 19.4179L23.8077 19.8162L25.3884 29.1774C25.4834 29.8833 24.7613 30.4104 24.1224 30.1159L16.8734 25.5088L16.498 25.2702L16.1226 25.5088L8.87373 30.1141C8.23317 30.409 7.51248 29.8817 7.60746 29.1758L9.18817 19.8162Z",
1903
- stroke: `url(#${strokeGradientId})`,
1904
- strokeWidth: "1.4"
1860
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
1861
+ "div",
1862
+ {
1863
+ className: "sledge-product-review__rating",
1864
+ onClick: handleOnClick,
1865
+ ...typeof size === "string" ? {
1866
+ ["data-rating-size"]: size
1867
+ } : {},
1868
+ children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isLoading && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1869
+ [1, 2, 3, 4, 5].map((item, index) => {
1870
+ if (!(item <= numberOfIcons))
1871
+ return;
1872
+ let ratingValue = Math.floor(parseFloat(averageReview));
1873
+ let getCommaValue = String(averageReview).includes(",") ? String(averageReview).split(",") : [];
1874
+ let getCommaValueDot = String(averageReview).includes(".") ? String(averageReview).split(".") : [];
1875
+ let isHaveCommaValue = getCommaValue.length || getCommaValueDot.length;
1876
+ let commaValue = isHaveCommaValue ? getCommaValue[1] || getCommaValueDot[1] : 0;
1877
+ let fillOther = "fill-0";
1878
+ if (item > ratingValue && ratingValue + 1 === item) {
1879
+ fillOther = `fill-${commaValue}`;
1905
1880
  }
1906
- )
1907
- ] });
1908
- }),
1909
- withTotal ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-product-review__rating-summary-total", children: [
1910
- "(",
1911
- totalReview,
1912
- ")"
1913
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
1914
- ] }) }) });
1881
+ fillOther = item <= ratingValue ? "full" : fillOther;
1882
+ let offset;
1883
+ if (fillOther === "fill-0") {
1884
+ offset = "0%";
1885
+ }
1886
+ if (fillOther === "fill-1") {
1887
+ offset = "25%";
1888
+ }
1889
+ if (fillOther === "fill-2") {
1890
+ offset = "35%";
1891
+ }
1892
+ if (fillOther === "fill-3") {
1893
+ offset = "40%";
1894
+ }
1895
+ if (fillOther === "fill-4") {
1896
+ offset = "45%";
1897
+ }
1898
+ if (fillOther === "fill-5") {
1899
+ offset = "50%";
1900
+ }
1901
+ if (fillOther === "fill-6") {
1902
+ offset = "60%";
1903
+ }
1904
+ if (fillOther === "fill-7") {
1905
+ offset = "70%";
1906
+ }
1907
+ if (fillOther === "fill-8") {
1908
+ offset = "80%";
1909
+ }
1910
+ if (fillOther === "fill-9") {
1911
+ offset = "90%";
1912
+ }
1913
+ if (fillOther === "full") {
1914
+ offset = "100%";
1915
+ }
1916
+ let suffixGradientId = `-${fillOther}-${index}-${productId ? productId : unixTimestamp}${customComponentId ? `-${customComponentId}` : ""}`;
1917
+ let strokeGradientId = `rating-stroke${suffixGradientId}`;
1918
+ let fillGradientId = `rating-gradient${suffixGradientId}`;
1919
+ return /* @__PURE__ */ createElement("svg", { xmlns: "http://www.w3.org/2000/svg", ...sizing, viewBox: "0 0 32 32", key: suffixGradientId }, /* @__PURE__ */ jsxRuntimeExports.jsxs("defs", { children: [
1920
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: strokeGradientId, children: [
1921
+ /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fillColor || fill_color }),
1922
+ /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fillOther === "full" ? fillColor || fill_color : outlineColor || outline_color })
1923
+ ] }),
1924
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("linearGradient", { id: fillGradientId, children: [
1925
+ /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: fillColor || fill_color }),
1926
+ /* @__PURE__ */ jsxRuntimeExports.jsx("stop", { offset, stopColor: "transparent" })
1927
+ ] })
1928
+ ] }), /* @__PURE__ */ jsxRuntimeExports.jsx(
1929
+ "path",
1930
+ {
1931
+ fill: `url(#${fillGradientId})`,
1932
+ d: "M9.18817 19.8162L9.25542 19.4179L8.94431 19.1604L3.14591 14.3604L3.14598 14.3603L3.13673 14.3529C2.5294 13.8672 2.784 12.8955 3.54372 12.7636L11.7291 12.3989L12.1807 12.3788L12.3481 11.959L15.8472 3.18648C15.977 2.94796 16.2257 2.79961 16.4979 2.79961C16.769 2.79961 17.0185 2.94848 17.1489 3.18698L20.6478 11.959L20.8152 12.3788L21.2668 12.3989L29.4522 12.7636C30.2119 12.8955 30.4665 13.8672 29.8592 14.3529L29.8591 14.3528L29.85 14.3604L24.0516 19.1604L23.7405 19.4179L23.8077 19.8162L25.3884 29.1774C25.4834 29.8833 24.7613 30.4104 24.1224 30.1159L16.8734 25.5088L16.498 25.2702L16.1226 25.5088L8.87373 30.1141C8.23317 30.409 7.51248 29.8817 7.60746 29.1758L9.18817 19.8162Z",
1933
+ ...withOutlineColor ? {
1934
+ stroke: `url(#${strokeGradientId})`,
1935
+ strokeWidth: "1.4"
1936
+ } : {}
1937
+ }
1938
+ ));
1939
+ }),
1940
+ withTotal ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-product-review__rating-summary-total", children: [
1941
+ "(",
1942
+ totalReview,
1943
+ ")"
1944
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
1945
+ ] }) })
1946
+ }
1947
+ );
1915
1948
  };
1916
1949
  const getSizing = (size) => {
1917
1950
  if (size === "xs") {
1918
1951
  return {
1919
- width: 14.4,
1920
- height: 14.4
1952
+ width: 14,
1953
+ height: 14
1921
1954
  };
1922
1955
  } else if (size === "sm") {
1923
1956
  return {
1924
- width: 18,
1925
- height: 18
1957
+ width: 20,
1958
+ height: 20
1926
1959
  };
1927
1960
  } else {
1928
1961
  return {
1929
- width: 28.8,
1930
- height: 28.8
1962
+ width: 32,
1963
+ height: 32
1931
1964
  };
1932
1965
  }
1933
1966
  };
1934
- const WidgetHeaderAddTrigger = ({ isFirstLoading, text, dataSettings, params, onAfterAddReview }) => {
1967
+ const WidgetHeaderAddTrigger = ({ isFirstLoadingHeader, text, dataSettings, params, onAfterAddReview, tabIndex }) => {
1935
1968
  var _a, _b, _c;
1936
1969
  const {
1937
1970
  text_color: display_button_write_review_text_color,
@@ -1960,13 +1993,13 @@ const WidgetHeaderAddTrigger = ({ isFirstLoading, text, dataSettings, params, on
1960
1993
  ...display_button_write_review_font_weight && { fontWeight: display_button_write_review_font_weight },
1961
1994
  ...display_button_write_review_text_transform && { textTransform: display_button_write_review_text_transform }
1962
1995
  };
1963
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-header-item", children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "134px", height: "42px", rounded: "lg", color: "lighten" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
1996
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-header-item", children: isFirstLoadingHeader ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "134px", height: "42px", rounded: "lg", color: "lighten" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
1964
1997
  Button,
1965
1998
  {
1966
1999
  type: "button",
1967
2000
  colorType: "success",
1968
2001
  className: "sledge-product-review__widget-header-add-trigger",
1969
- onClick: () => typeof window !== "undefined" && window.sledgeProductReviewWidgetFormAdd && window.sledgeProductReviewWidgetFormAdd(params, onAfterAddReview),
2002
+ onClick: () => typeof window !== "undefined" && window.sledgeProductReviewWidgetFormAdd && window.sledgeProductReviewWidgetFormAdd(params, onAfterAddReview, tabIndex),
1970
2003
  style: display_button_write_review_style,
1971
2004
  children: [
1972
2005
  /* @__PURE__ */ jsxRuntimeExports.jsx(MessageAddIcon, { width: 16, height: 16, color: "currentColor" }),
@@ -1975,7 +2008,7 @@ const WidgetHeaderAddTrigger = ({ isFirstLoading, text, dataSettings, params, on
1975
2008
  }
1976
2009
  ) });
1977
2010
  };
1978
- const WidgetHeaderSort = ({ isFirstLoading, productReviewSort, dataSettings, setSelectedSort, setIsRefreshWidgetList }) => {
2011
+ const WidgetHeaderSort = ({ isFirstLoadingHeader, productReviewSort, dataSettings, setSelectedSort, setIsRefreshWidgetList }) => {
1979
2012
  var _a, _b;
1980
2013
  const { default_sort, show_sorting_options } = ((_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.widget) || {};
1981
2014
  const [clickedSortId, setClickedSortId] = React__default.useState(default_sort || null);
@@ -1985,7 +2018,7 @@ const WidgetHeaderSort = ({ isFirstLoading, productReviewSort, dataSettings, set
1985
2018
  setSelectedSort && setSelectedSort(value);
1986
2019
  };
1987
2020
  const getSelectedSort = clickedSortId || ((_b = productReviewSort[0]) == null ? void 0 : _b.value);
1988
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !show_sorting_options ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-header-item", children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "134px", height: "42px", rounded: "lg", color: "lighten" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
2021
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !show_sorting_options ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-header-item", children: isFirstLoadingHeader ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "134px", height: "42px", rounded: "lg", color: "lighten" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
1989
2022
  SelectField,
1990
2023
  {
1991
2024
  align: "end",
@@ -2015,7 +2048,7 @@ const WidgetHeaderSummary = (props) => {
2015
2048
  const [isLoading, setIsLoading] = React__default.useState(true);
2016
2049
  const [isRefreshRating, setIsRefreshRating] = React__default.useState(summaryData ? false : true);
2017
2050
  const [isOpen, setIsOpen] = React__default.useState(false);
2018
- const [totalReview, setTotalReview] = React__default.useState((summaryData == null ? void 0 : summaryData.review_count) | 0);
2051
+ const [totalReview, setTotalReview] = React__default.useState((summaryData == null ? void 0 : summaryData.review_count) || 0);
2019
2052
  const [ratingList, setRatingList] = React__default.useState(
2020
2053
  (summaryData == null ? void 0 : summaryData.rating) || {
2021
2054
  5: 0,
@@ -2041,7 +2074,9 @@ const WidgetHeaderSummary = (props) => {
2041
2074
  run = true;
2042
2075
  setIsFirstTime(false);
2043
2076
  } else {
2044
- response = await getReviewInfo(productId);
2077
+ response = await getReviewInfo({
2078
+ productId
2079
+ });
2045
2080
  if (!response)
2046
2081
  return;
2047
2082
  const { status } = response;
@@ -2451,7 +2486,7 @@ const ProductCard = (props) => {
2451
2486
  productSku: sku,
2452
2487
  productVariantName: variant_title,
2453
2488
  productLink: url,
2454
- productImage: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png",
2489
+ productImage: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
2455
2490
  productCurrency: currency,
2456
2491
  productPrice: price
2457
2492
  },
@@ -2461,15 +2496,7 @@ const ProductCard = (props) => {
2461
2496
  wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
2462
2497
  }
2463
2498
  ),
2464
- /* @__PURE__ */ jsxRuntimeExports.jsx(
2465
- "img",
2466
- {
2467
- src: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png",
2468
- alt: "sledge-card-image",
2469
- loading: "lazy",
2470
- className: "sledge__product-grid-card-image-featured-image"
2471
- }
2472
- ),
2499
+ /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`, alt: "sledge-card-image", loading: "lazy", className: "sledge__product-grid-card-image-featured-image" }),
2473
2500
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: images == null ? void 0 : images.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
2474
2501
  "img",
2475
2502
  {
@@ -2603,7 +2630,7 @@ ${selectedOption === item2 ? "sledge__product-variant-size-swatch-active" : ""}
2603
2630
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
2604
2631
  };
2605
2632
  const ProductGrid = (props) => {
2606
- const { type, className = "", data, setting, sourceApp = null, onAfterAddToCart, onAfterRenderProduct } = props;
2633
+ const { type, className = "", data, setting, sourceApp = null, useSlider = false, onAfterAddToCart, onAfterRenderProduct } = props;
2607
2634
  const { redirect_add_to_cart = true } = setting || {};
2608
2635
  const [clickedAddToCartId, setClickedAddToCartId] = React__default.useState(null);
2609
2636
  const handleAddToCart = async (data2) => {
@@ -2653,10 +2680,11 @@ const ProductGrid = (props) => {
2653
2680
  }, 1e3);
2654
2681
  }
2655
2682
  };
2683
+ const Container = useSlider ? Carousel : "div";
2656
2684
  React__default.useEffect(() => {
2657
2685
  onAfterRenderProduct && onAfterRenderProduct("success");
2658
2686
  }, []);
2659
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `sledge__product-grid ${className}`, "data-grid-type": type, children: data == null ? void 0 : data.map((item, index) => {
2687
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Container, { className: `sledge__product-grid ${className}`, "data-grid-type": type, children: data == null ? void 0 : data.map((item, index) => {
2660
2688
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { item, handleAddToCart, clickedAddToCartId, ...props }, `sledge-product-card_${index}`);
2661
2689
  }) });
2662
2690
  };
@@ -2674,7 +2702,7 @@ const CollectionGrid = ({ className = "", data, cards: CardsComponent, isCompone
2674
2702
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) }, index);
2675
2703
  } else {
2676
2704
  return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__collection-grid-card", children: [
2677
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-image-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png", alt: "sledge-card-image", loading: "lazy" }) }) }),
2705
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-image-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`, alt: "sledge-card-image", loading: "lazy" }) }) }),
2678
2706
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__collection-grid-card-content", children: [
2679
2707
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-content-title", children: title }),
2680
2708
  body_html ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__collection-grid-card-content-description", dangerouslySetInnerHTML: { __html: body_html } }) : null
@@ -2695,7 +2723,7 @@ const PageGrid = ({ className = "", data, cards: CardsComponent, isComponentJsVe
2695
2723
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) }, index);
2696
2724
  } else {
2697
2725
  return /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__page-grid-card", children: [
2698
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-image-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png", alt: "sledge-card-image", loading: "lazy" }) }) }),
2726
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-image-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`, alt: "sledge-card-image", loading: "lazy" }) }) }),
2699
2727
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__page-grid-card-content", children: [
2700
2728
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-content-title", children: title }),
2701
2729
  body_html ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__page-grid-card-content-description", dangerouslySetInnerHTML: { __html: body_html } }) : null
@@ -2717,7 +2745,7 @@ const BlogGrid = ({ className = "", data, cards: CardsComponent, isComponentJsVe
2717
2745
  } else {
2718
2746
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__blog-grid-card", children: [
2719
2747
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__blog-grid-content", children: [
2720
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__blog-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png", alt: "sledge-card-image", loading: "lazy" }) }) }),
2748
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__blog-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`, alt: "sledge-card-image", loading: "lazy" }) }) }),
2721
2749
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__blog-grid-card-desc", children: [
2722
2750
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__blog-grid-card-title", children: title }) }),
2723
2751
  created_at ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__blog-grid-badge-vendor", children: convertDate(created_at) }) : null
@@ -2744,7 +2772,7 @@ const ArticleGrid = ({ className = "", data, cards: CardsComponent, isComponentJ
2744
2772
  } else {
2745
2773
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__article-grid-card", children: [
2746
2774
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__article-grid-content", children: [
2747
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__article-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || "https://sledgeassets.nyc3.cdn.digitaloceanspaces.com/images/blank-image.png", alt: "sledge-card-image", loading: "lazy" }) }) }),
2775
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__article-grid-card-image", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`, alt: "sledge-card-image", loading: "lazy" }) }) }),
2748
2776
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__article-grid-card-desc", children: [
2749
2777
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__article-grid-card-title", children: title }) }),
2750
2778
  created_at ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__article-grid-badge-vendor", children: convertDate(created_at) }) : null,
@@ -2874,13 +2902,21 @@ const SkeletonReviewGrid = ({ count, type, gridItemHeights = [] }) => {
2874
2902
  let components = [];
2875
2903
  for (let i = 0; i < count; i++) {
2876
2904
  components.push(
2877
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-review-card", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonItem, { width: "100%", height: type === "list" || type === "grid" && !(gridItemHeights == null ? void 0 : gridItemHeights.length) ? "111px" : gridItemHeights[i], color: "lighten", rounded: "md" }) }, i)
2905
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__widget-review-card", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2906
+ SkeletonItem,
2907
+ {
2908
+ width: "100%",
2909
+ height: type === "list" || (type === "grid" || type === "image_grid") && !(gridItemHeights == null ? void 0 : gridItemHeights.length) ? "111px" : gridItemHeights[i],
2910
+ color: "lighten",
2911
+ rounded: "md"
2912
+ }
2913
+ ) }, i)
2878
2914
  );
2879
2915
  }
2880
2916
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2881
2917
  MasonryResponsive,
2882
2918
  {
2883
- columnsCountBreakPoints: type === "grid" ? { 350: 1, 750: 3, 1024: 4 } : { 350: 1 },
2919
+ columnsCountBreakPoints: type === "list" ? { 350: 1 } : { 350: 1, 750: 3, 1024: 4 },
2884
2920
  className: "sledge-product-review__widget-review-grid sledge__skeleton-review-grid sledge__skeleton-pointer-events-none",
2885
2921
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Masonry, { gutter: "30px", children: components })
2886
2922
  }
@@ -3013,6 +3049,95 @@ const LoadingDots = () => {
3013
3049
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__loading-icon-dot" })
3014
3050
  ] });
3015
3051
  };
3052
+ const Carousel$1 = "";
3053
+ const Carousel = (props) => {
3054
+ const { children, className = "", "data-grid-type": dataGridType } = props;
3055
+ const [active, setActive] = React__default.useState(true);
3056
+ const {
3057
+ options = {
3058
+ active,
3059
+ slidesToScroll: "auto",
3060
+ align: "start",
3061
+ dragFree: true,
3062
+ duration: 35
3063
+ }
3064
+ } = props;
3065
+ const [carouselRef, carouselApi] = useEmblaCarousel(options);
3066
+ const [prevBtnDisabled, setPrevBtnDisabled] = React__default.useState(true);
3067
+ const [nextBtnDisabled, setNextBtnDisabled] = React__default.useState(true);
3068
+ const scrollPrev = React__default.useCallback(() => carouselApi && carouselApi.scrollPrev(), [carouselApi]);
3069
+ const scrollNext = React__default.useCallback(() => carouselApi && carouselApi.scrollNext(), [carouselApi]);
3070
+ const onSelect = React__default.useCallback((carouselApi2) => {
3071
+ setPrevBtnDisabled(!carouselApi2.canScrollPrev());
3072
+ setNextBtnDisabled(!carouselApi2.canScrollNext());
3073
+ }, []);
3074
+ React__default.useEffect(() => {
3075
+ if (!carouselApi)
3076
+ return;
3077
+ if (prevBtnDisabled && nextBtnDisabled)
3078
+ setActive(false);
3079
+ else
3080
+ setActive(true);
3081
+ }, [carouselApi, prevBtnDisabled, nextBtnDisabled]);
3082
+ React__default.useEffect(() => {
3083
+ if (!carouselApi)
3084
+ return;
3085
+ onSelect(carouselApi);
3086
+ carouselApi.on("reInit", onSelect);
3087
+ carouselApi.on("select", onSelect);
3088
+ }, [carouselApi, onSelect]);
3089
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `sledge__carousel ${className}`, children: [
3090
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
3091
+ Navigation,
3092
+ {
3093
+ state: {
3094
+ prevBtnDisabled,
3095
+ nextBtnDisabled
3096
+ },
3097
+ position: "left",
3098
+ disabled: prevBtnDisabled,
3099
+ onClick: scrollPrev,
3100
+ className: "sledge__carousel-button-prev"
3101
+ }
3102
+ ),
3103
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__carousel-viewport", ref: carouselRef, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__carousel-container sledge__product-grid", "data-grid-type": dataGridType, children }) }),
3104
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
3105
+ Navigation,
3106
+ {
3107
+ state: {
3108
+ prevBtnDisabled,
3109
+ nextBtnDisabled
3110
+ },
3111
+ position: "right",
3112
+ disabled: nextBtnDisabled,
3113
+ onClick: scrollNext,
3114
+ className: "sledge__carousel-button-next"
3115
+ }
3116
+ )
3117
+ ] });
3118
+ };
3119
+ const Navigation = (props) => {
3120
+ const { children, state, className, position, ...restProps } = props;
3121
+ const { prevBtnDisabled, nextBtnDisabled } = state;
3122
+ if (prevBtnDisabled && nextBtnDisabled)
3123
+ return null;
3124
+ const LeftIcon = /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3125
+ "path",
3126
+ {
3127
+ d: "M10.6875 2.97945C10.865 3.15697 10.8812 3.43474 10.7359 3.63048L10.6875 3.68656L6.37465 7.99967L10.6875 12.3128C10.865 12.4903 10.8812 12.7681 10.7359 12.9638L10.6875 13.0199C10.51 13.1974 10.2323 13.2135 10.0365 13.0683L9.98043 13.0199L5.31377 8.35323C5.13625 8.17572 5.12012 7.89794 5.26535 7.7022L5.31377 7.64612L9.98043 2.97945C10.1757 2.78419 10.4923 2.78419 10.6875 2.97945Z",
3128
+ fill: "#767676"
3129
+ }
3130
+ ) });
3131
+ const RightIcon = /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3132
+ "path",
3133
+ {
3134
+ d: "M5.60738 13.1299C5.42987 12.9524 5.41374 12.6746 5.55897 12.4789L5.60738 12.4228L9.92027 8.1097L5.60738 3.79659C5.42987 3.61908 5.41374 3.3413 5.55897 3.14556L5.60738 3.08948C5.7849 2.91197 6.06267 2.89583 6.25841 3.04107L6.31449 3.08948L10.9812 7.75615C11.1587 7.93366 11.1748 8.21143 11.0296 8.40718L10.9812 8.46325L6.31449 13.1299C6.11923 13.3252 5.80265 13.3252 5.60738 13.1299Z",
3135
+ fill: "#767676"
3136
+ }
3137
+ ) });
3138
+ const Icon = () => position === "left" ? LeftIcon : RightIcon;
3139
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: `sledge__carousel-button ${className}`, type: "button", ...restProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, {}) });
3140
+ };
3016
3141
  const SearchIconWidget = (props) => {
3017
3142
  const { isRenderApp, isJsVersion } = React__default.useContext(SledgeContext);
3018
3143
  const { instantSearch: isRenderAppInstantSearch } = isRenderApp || {};
@@ -3515,6 +3640,7 @@ const SearchResultWidget = (props) => {
3515
3640
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
3516
3641
  const {
3517
3642
  layoutType = "default",
3643
+ width = DEFAULT_MAX_WIDTH_COMPONENT,
3518
3644
  query,
3519
3645
  params,
3520
3646
  children,
@@ -3611,7 +3737,7 @@ const SearchResultWidget = (props) => {
3611
3737
  let isHasProductFacets = isProductIndex && getFacets.length;
3612
3738
  let additionalFilter = [];
3613
3739
  if (hidden_tags == null ? void 0 : hidden_tags.length)
3614
- additionalFilter.push(`tags NOT IN [${hidden_tags}]`);
3740
+ additionalFilter.push(`tags NOT IN ${JSON.stringify(hidden_tags)}`);
3615
3741
  if (!show_out_of_stock)
3616
3742
  additionalFilter.push("variants.inventory_quantity > 0");
3617
3743
  if (collectionId)
@@ -3958,7 +4084,10 @@ const SearchResultWidget = (props) => {
3958
4084
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-data-summary-select-field-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "150px", height: "42px", color: "lighten", rounded: "lg" }) })
3959
4085
  ] })
3960
4086
  ] });
3961
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-container", ref: searchResultContainerRef, children: [
4087
+ const containerStyle = {
4088
+ maxWidth: width
4089
+ };
4090
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__result-container", ref: searchResultContainerRef, style: containerStyle, children: [
3962
4091
  isFirstLoading ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${layoutType === "default" && (allowedTabs == null ? void 0 : allowedTabs.length) ? "sledge-instant-search__result-tab" : "sledge-instant-search__result-tab-no-index"}`, children: layoutType === "default" && (allowedTabs == null ? void 0 : allowedTabs.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__result-tab-list", children: allowedTabs.map((item) => {
3963
4092
  const { name, index, type, total } = item;
3964
4093
  let isActive = clickedTabIndexId === index;
@@ -4336,15 +4465,15 @@ const ResultProduct = (props) => {
4336
4465
  let isCustom = ["variants.inventory_quantity"].includes(value);
4337
4466
  let isRange = ["variants.price"].includes(value);
4338
4467
  let isArray = ["tags"].includes(value);
4339
- let items = Array.isArray(facet[1]) && ((_a3 = facet[1]) == null ? void 0 : _a3.length) > 1 ? isRange ? `${value} >= ${facet[1][0]} AND ${value} <= ${facet[1][1]}` : isArray ? `${value} IN [${facet[1]}]` : (_b3 = facet[1]) == null ? void 0 : _b3.map((item) => {
4468
+ let items = Array.isArray(facet[1]) && ((_a3 = facet[1]) == null ? void 0 : _a3.length) > 1 ? isRange ? `${value} >= ${facet[1][0]} AND ${value} <= ${facet[1][1]}` : isArray ? `${value} IN ${JSON.stringify(facet[1])}` : (_b3 = facet[1]) == null ? void 0 : _b3.map((item) => {
4340
4469
  return isCustom ? `${value} ${item}` : `${value} = '${item}'`;
4341
- }).join(" OR ") : isCustom ? `${value} ${facet[1]}` : isArray ? `${value} IN [${facet[1]}]` : `${value} = '${facet[1]}'`;
4470
+ }).join(" OR ") : isCustom ? `${value} ${facet[1]}` : isArray ? `${value} IN ${JSON.stringify(facet[1])}` : `${value} = '${facet[1]}'`;
4342
4471
  return items;
4343
4472
  } else
4344
4473
  return null;
4345
4474
  }).filter((item) => item);
4346
4475
  if (hiddenTags == null ? void 0 : hiddenTags.length)
4347
- filters.push(`tags NOT IN [${hiddenTags}]`);
4476
+ filters.push(`tags NOT IN ${JSON.stringify(hiddenTags)}`);
4348
4477
  if (collectionId)
4349
4478
  filters.push(`collections.id = '${collectionId}'`);
4350
4479
  let body = {