@sledge-app/react-instant-search 0.0.28 → 0.0.30

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.
@@ -23,9 +23,6 @@ const SEPARATE_COMPONENT_DISPLAY_NAME = {
23
23
  SUGGESTION_KEYWORD_LISTS: "SuggestionKeywordLists",
24
24
  OTHER_INDEX_LISTS: "OtherIndexLists"
25
25
  };
26
- const SHOPIFY_GID = "gid://shopify/";
27
- const SHOPIFY_GID_PRODUCT_ID = `${SHOPIFY_GID}Product/`;
28
- const SHOPIFY_GID_PRODUCT_VARIANT_ID = `${SHOPIFY_GID}ProductVariant/`;
29
26
  const sanitizeDataId = (id) => {
30
27
  if (!id)
31
28
  return "";
@@ -1715,28 +1712,16 @@ const ProductGrid = ({
1715
1712
  const { product, variants } = item || {};
1716
1713
  const { id, title, image, url, vendor = "", currency } = product || {};
1717
1714
  const { id: variant_id = "", title: variant_title = "", price = "", sku = "" } = (variants == null ? void 0 : variants.length) ? variants[0] : {};
1718
- const productUrl = new URL(product.url);
1719
- const arrProductUrlPathname = productUrl.pathname.split("/");
1720
- const handle = arrProductUrlPathname[arrProductUrlPathname.length - 1];
1721
1715
  let isLoadingAddToCart = clickedAddToCartId == variant_id;
1722
1716
  let isOutOfStock = (variants == null ? void 0 : variants.length) && Object.hasOwn(variants[0], "inventory_quantity") ? !variants[0].inventory_quantity && showOptionOutOfStock : false;
1723
1717
  return cards ? /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: cards({
1724
1718
  product: {
1725
- ...{
1726
- ...product,
1727
- ...{
1728
- id: `${SHOPIFY_GID_PRODUCT_ID}${id}`,
1729
- handle
1730
- }
1731
- },
1719
+ ...product,
1732
1720
  ...{
1733
1721
  variants: variants.map((variant, index2) => {
1734
- const { id: variant_id2, inventory_quantity, ...otherObject } = variant || {};
1722
+ const { inventory_quantity } = variant || {};
1735
1723
  return {
1736
- ...otherObject,
1737
- ...{
1738
- id: `${SHOPIFY_GID_PRODUCT_VARIANT_ID}${variant_id2}`
1739
- },
1724
+ ...variant,
1740
1725
  is_out_of_stock: Object.hasOwn(variants[index2], "inventory_quantity") ? !inventory_quantity : false
1741
1726
  };
1742
1727
  })
@@ -2281,10 +2266,7 @@ const RenderSuggestionKeywordLists = ({ listsComponent, keywords }) => {
2281
2266
  };
2282
2267
  const RenderOtherIndexLists = ({ listsComponent, name, items }) => {
2283
2268
  return listsComponent ? listsComponent({ name, items }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
2284
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: [
2285
- name,
2286
- " testttt"
2287
- ] }),
2269
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__icon-widget-search-form-result-title", children: name }),
2288
2270
  (items == null ? void 0 : items.length) ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "sledge-instant-search__icon-widget-search-form-result-list", children: items.map((hit, index) => {
2289
2271
  const { title, url } = hit;
2290
2272
  return /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: url, className: "sledge-instant-search__icon-widget-search-form-result-list-link", children: title }) }, index);
@@ -2519,23 +2501,7 @@ const SearchIconWidgetPopup = () => {
2519
2501
  {
2520
2502
  sourceApp: "instant-search",
2521
2503
  type: "medium",
2522
- data: searchResultProduct.map((item) => {
2523
- const { id, title, currency, image, url, vendor, variants } = item || {};
2524
- return {
2525
- product: {
2526
- id,
2527
- title,
2528
- image,
2529
- url,
2530
- vendor,
2531
- currency
2532
- },
2533
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
2534
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
2535
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
2536
- }) : []
2537
- };
2538
- }),
2504
+ data: searchResultProduct,
2539
2505
  setting: {
2540
2506
  show_vendor: (_g = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _g.show_vendor,
2541
2507
  show_sku: (_h = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _h.show_sku,
@@ -2560,23 +2526,7 @@ const SearchIconWidgetPopup = () => {
2560
2526
  {
2561
2527
  sourceApp: "instant-search",
2562
2528
  type: "medium",
2563
- data: suggestionSettings[suggestionIndex].products.list.map((item) => {
2564
- const { id, currency, title, image, url, vendor, variants } = item || {};
2565
- return {
2566
- product: {
2567
- id,
2568
- title,
2569
- image,
2570
- url,
2571
- vendor,
2572
- currency
2573
- },
2574
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
2575
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
2576
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
2577
- }) : []
2578
- };
2579
- }),
2529
+ data: suggestionSettings[suggestionIndex].products.list,
2580
2530
  setting: {
2581
2531
  show_vendor: (_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.show_vendor,
2582
2532
  show_sku: (_p = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _p.show_sku,
@@ -3659,23 +3609,7 @@ const ResultProduct = (props) => {
3659
3609
  {
3660
3610
  sourceApp: "instant-search",
3661
3611
  type: "large",
3662
- data: searchResult.map((item) => {
3663
- const { id, title, currency, image, url, vendor, variants } = item || {};
3664
- return {
3665
- product: {
3666
- id,
3667
- title,
3668
- image,
3669
- url,
3670
- vendor,
3671
- currency
3672
- },
3673
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
3674
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
3675
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
3676
- }) : []
3677
- };
3678
- }),
3612
+ data: searchResult,
3679
3613
  setting: {
3680
3614
  show_vendor: (_r = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _r.show_vendor,
3681
3615
  show_sku: (_s = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _s.show_sku,
@@ -4041,23 +3975,7 @@ const SearchWidget = (props) => {
4041
3975
  {
4042
3976
  sourceApp: "instant-search",
4043
3977
  type: "small",
4044
- data: searchResultProduct.map((item) => {
4045
- const { id, title, currency, image, url, vendor, variants } = item || {};
4046
- return {
4047
- product: {
4048
- id,
4049
- title,
4050
- image,
4051
- url,
4052
- vendor,
4053
- currency
4054
- },
4055
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
4056
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
4057
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
4058
- }) : []
4059
- };
4060
- }),
3978
+ data: searchResultProduct,
4061
3979
  setting: {
4062
3980
  show_vendor: (_f = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _f.show_vendor,
4063
3981
  show_sku: (_g = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _g.show_sku,
@@ -4083,23 +4001,7 @@ const SearchWidget = (props) => {
4083
4001
  {
4084
4002
  sourceApp: "instant-search",
4085
4003
  type: "small",
4086
- data: suggestionSettings[suggestionIndex].products.list.map((item) => {
4087
- const { id, title, currency, image, url, vendor, variants } = item || {};
4088
- return {
4089
- product: {
4090
- id,
4091
- title,
4092
- image,
4093
- url,
4094
- vendor,
4095
- currency
4096
- },
4097
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
4098
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
4099
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
4100
- }) : []
4101
- };
4102
- }),
4004
+ data: suggestionSettings[suggestionIndex].products.list,
4103
4005
  setting: {
4104
4006
  show_vendor: (_n = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _n.show_vendor,
4105
4007
  show_sku: (_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.show_sku,