@sledge-app/react-instant-search 0.0.29 → 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
  })
@@ -2516,23 +2501,7 @@ const SearchIconWidgetPopup = () => {
2516
2501
  {
2517
2502
  sourceApp: "instant-search",
2518
2503
  type: "medium",
2519
- data: searchResultProduct.map((item) => {
2520
- const { id, title, currency, image, url, vendor, variants } = item || {};
2521
- return {
2522
- product: {
2523
- id,
2524
- title,
2525
- image,
2526
- url,
2527
- vendor,
2528
- currency
2529
- },
2530
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
2531
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
2532
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
2533
- }) : []
2534
- };
2535
- }),
2504
+ data: searchResultProduct,
2536
2505
  setting: {
2537
2506
  show_vendor: (_g = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _g.show_vendor,
2538
2507
  show_sku: (_h = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _h.show_sku,
@@ -2557,23 +2526,7 @@ const SearchIconWidgetPopup = () => {
2557
2526
  {
2558
2527
  sourceApp: "instant-search",
2559
2528
  type: "medium",
2560
- data: suggestionSettings[suggestionIndex].products.list.map((item) => {
2561
- const { id, currency, title, image, url, vendor, variants } = item || {};
2562
- return {
2563
- product: {
2564
- id,
2565
- title,
2566
- image,
2567
- url,
2568
- vendor,
2569
- currency
2570
- },
2571
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
2572
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
2573
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
2574
- }) : []
2575
- };
2576
- }),
2529
+ data: suggestionSettings[suggestionIndex].products.list,
2577
2530
  setting: {
2578
2531
  show_vendor: (_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.show_vendor,
2579
2532
  show_sku: (_p = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _p.show_sku,
@@ -3656,23 +3609,7 @@ const ResultProduct = (props) => {
3656
3609
  {
3657
3610
  sourceApp: "instant-search",
3658
3611
  type: "large",
3659
- data: searchResult.map((item) => {
3660
- const { id, title, currency, image, url, vendor, variants } = item || {};
3661
- return {
3662
- product: {
3663
- id,
3664
- title,
3665
- image,
3666
- url,
3667
- vendor,
3668
- currency
3669
- },
3670
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
3671
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
3672
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
3673
- }) : []
3674
- };
3675
- }),
3612
+ data: searchResult,
3676
3613
  setting: {
3677
3614
  show_vendor: (_r = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _r.show_vendor,
3678
3615
  show_sku: (_s = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _s.show_sku,
@@ -4038,23 +3975,7 @@ const SearchWidget = (props) => {
4038
3975
  {
4039
3976
  sourceApp: "instant-search",
4040
3977
  type: "small",
4041
- data: searchResultProduct.map((item) => {
4042
- const { id, title, currency, image, url, vendor, variants } = item || {};
4043
- return {
4044
- product: {
4045
- id,
4046
- title,
4047
- image,
4048
- url,
4049
- vendor,
4050
- currency
4051
- },
4052
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
4053
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
4054
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
4055
- }) : []
4056
- };
4057
- }),
3978
+ data: searchResultProduct,
4058
3979
  setting: {
4059
3980
  show_vendor: (_f = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _f.show_vendor,
4060
3981
  show_sku: (_g = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _g.show_sku,
@@ -4080,23 +4001,7 @@ const SearchWidget = (props) => {
4080
4001
  {
4081
4002
  sourceApp: "instant-search",
4082
4003
  type: "small",
4083
- data: suggestionSettings[suggestionIndex].products.list.map((item) => {
4084
- const { id, title, currency, image, url, vendor, variants } = item || {};
4085
- return {
4086
- product: {
4087
- id,
4088
- title,
4089
- image,
4090
- url,
4091
- vendor,
4092
- currency
4093
- },
4094
- variants: (variants == null ? void 0 : variants.length) ? variants.map((variant) => {
4095
- const { id: variant_id, title: variant_title, price, sku, inventory_quantity } = variant || {};
4096
- return { id: variant_id, title: variant_title, price, sku, inventory_quantity };
4097
- }) : []
4098
- };
4099
- }),
4004
+ data: suggestionSettings[suggestionIndex].products.list,
4100
4005
  setting: {
4101
4006
  show_vendor: (_n = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _n.show_vendor,
4102
4007
  show_sku: (_o = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _o.show_sku,