@sledge-app/react-instant-search 2.0.3 → 2.0.4

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.
@@ -4217,8 +4217,8 @@ const VariantSelector = (props) => {
4217
4217
  /* @__PURE__ */ jsxRuntimeExports.jsx("select", { className: "variant-picker sledge__product-grid-card-variant-picker", children: variants == null ? void 0 : variants.map((variant) => {
4218
4218
  const { title, option1, option2, position, id: id2, admin_graphql_api_id, image_id, inventory_quantity, inventory_management, inventory_policy } = variant;
4219
4219
  let optionAttributes = {
4220
- "data-option-1": option1,
4221
- "data-option-2": option2,
4220
+ "data-option-1": stringToSlug(option1),
4221
+ "data-option-2": stringToSlug(option2),
4222
4222
  "data-inventory-quantity": inventory_quantity,
4223
4223
  "data-inventory-management": inventory_management,
4224
4224
  "data-inventory-policy": inventory_policy,
@@ -4265,7 +4265,7 @@ ${selectedOption === item ? "sledge__product-variant-size-swatch-active" : ""} s
4265
4265
  ] });
4266
4266
  };
4267
4267
  const ProductCard = React__default.memo((props) => {
4268
- var _a, _b, _c, _d, _e;
4268
+ var _a, _b, _c, _d, _e, _f, _g;
4269
4269
  const {
4270
4270
  item,
4271
4271
  handleAddToCart,
@@ -4489,7 +4489,10 @@ const ProductCard = React__default.memo((props) => {
4489
4489
  ...triggerPropAdditional,
4490
4490
  onAfterAddWishlist,
4491
4491
  onAfterRemoveWishlist,
4492
- wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
4492
+ wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id],
4493
+ ...objectPresent(previewSettings) && ((_e = (_d = previewSettings == null ? void 0 : previewSettings.settings) == null ? void 0 : _d.general) == null ? void 0 : _e.use_dummy_data) ? {
4494
+ previewSettings
4495
+ } : {}
4493
4496
  }
4494
4497
  ),
4495
4498
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-featured-image-element", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4513,7 +4516,7 @@ const ProductCard = React__default.memo((props) => {
4513
4516
  }
4514
4517
  }
4515
4518
  ) }),
4516
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: (_e = (_d = product == null ? void 0 : product.images) == null ? void 0 : _d.map) == null ? void 0 : _e.call(_d, (image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4519
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: (_g = (_f = product == null ? void 0 : product.images) == null ? void 0 : _f.map) == null ? void 0 : _g.call(_f, (image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4517
4520
  "img",
4518
4521
  {
4519
4522
  decoding: "async",
@@ -4638,7 +4641,7 @@ const ProductCard = React__default.memo((props) => {
4638
4641
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
4639
4642
  });
4640
4643
  const ProductGrid = React__default.memo((props) => {
4641
- const { type, className = "", data, setting, sourceApp = null, useSlider = false, isFlyout = false, onAfterAddToCart, onAfterRenderProduct, currentColumnGrid } = props;
4644
+ const { type, className = "", data, setting, sourceApp = null, useSlider = false, isFlyout = false, onAfterAddToCart, onAfterRenderProduct, currentColumnGrid, previewSettings } = props;
4642
4645
  const { redirect_add_to_cart = true } = setting || {};
4643
4646
  const [clickedAddToCartId, setClickedAddToCartId] = React__default.useState(null);
4644
4647
  const [generalDataSettings, setGeneralDataSettings] = React__default.useState({});
@@ -4646,6 +4649,17 @@ const ProductGrid = React__default.memo((props) => {
4646
4649
  var _a;
4647
4650
  const { id, quantity } = data2;
4648
4651
  setClickedAddToCartId(id);
4652
+ if (objectPresent(previewSettings)) {
4653
+ setClickedAddToCartId(null);
4654
+ onAfterAddToCart && onAfterAddToCart("success");
4655
+ window.sledgeToastNotification({
4656
+ title: "Cart added",
4657
+ message: "Successfully added to wishlist",
4658
+ type: "success",
4659
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 40, height: 40, color: "black" })
4660
+ });
4661
+ return;
4662
+ }
4649
4663
  let resShopifyAddToCart = await addToCart([
4650
4664
  {
4651
4665
  id,