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

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.
@@ -1107,46 +1107,34 @@ const rowRenderer = ({ virtualized, item, id, labelStyle }) => {
1107
1107
  ] });
1108
1108
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__radio-group-item-flex", children: content }, key || index);
1109
1109
  };
1110
- const RadioGroup = ({ id, name, required, defaultValue, items, labelStyle = {}, onValueChange, useVirtualized = false, scrollElement, selector, parentRef }) => {
1111
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__radio-group-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("form", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1112
- $f99a8c78507165f7$export$be92b6f5f03c0fe9,
1110
+ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValueChange, useVirtualized = false, scrollElement, selector, parentRef }) => {
1111
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__radio-group-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("form", { children: /* @__PURE__ */ jsxRuntimeExports.jsx($f99a8c78507165f7$export$be92b6f5f03c0fe9, { className: "sledge__radio-group-root", "aria-label": "View density", id, name, required, onValueChange, value: String(value), children: useVirtualized ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1112
+ VirtualizedList,
1113
1113
  {
1114
- className: "sledge__radio-group-root",
1115
- "aria-label": "View density",
1116
- defaultValue,
1114
+ rowCount: items == null ? void 0 : items.length,
1115
+ rowRenderer: ({ index, key }) => rowRenderer({
1116
+ virtualized: {
1117
+ index,
1118
+ key
1119
+ },
1120
+ item: items[index],
1121
+ id,
1122
+ labelStyle
1123
+ }),
1124
+ scrollElement,
1125
+ selector,
1126
+ parentRef
1127
+ }
1128
+ ) : items.map(
1129
+ (item, index) => rowRenderer({
1130
+ virtualized: {
1131
+ index
1132
+ },
1133
+ item,
1117
1134
  id,
1118
- name,
1119
- required,
1120
- onValueChange,
1121
- children: useVirtualized ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1122
- VirtualizedList,
1123
- {
1124
- rowCount: items == null ? void 0 : items.length,
1125
- rowRenderer: ({ index, key }) => rowRenderer({
1126
- virtualized: {
1127
- index,
1128
- key
1129
- },
1130
- item: items[index],
1131
- id,
1132
- labelStyle
1133
- }),
1134
- scrollElement,
1135
- selector,
1136
- parentRef
1137
- }
1138
- ) : items.map(
1139
- (item, index) => rowRenderer({
1140
- virtualized: {
1141
- index
1142
- },
1143
- item,
1144
- id,
1145
- labelStyle
1146
- })
1147
- )
1148
- }
1149
- ) }) });
1135
+ labelStyle
1136
+ })
1137
+ ) }) }) });
1150
1138
  };
1151
1139
  const ColorSwatch$1 = "";
1152
1140
  const ColorSwatch = ({ id, name, value, rgb, image, required, checked, onClick }) => {
@@ -4217,8 +4205,8 @@ const VariantSelector = (props) => {
4217
4205
  /* @__PURE__ */ jsxRuntimeExports.jsx("select", { className: "variant-picker sledge__product-grid-card-variant-picker", children: variants == null ? void 0 : variants.map((variant) => {
4218
4206
  const { title, option1, option2, position, id: id2, admin_graphql_api_id, image_id, inventory_quantity, inventory_management, inventory_policy } = variant;
4219
4207
  let optionAttributes = {
4220
- "data-option-1": option1,
4221
- "data-option-2": option2,
4208
+ "data-option-1": stringToSlug(option1),
4209
+ "data-option-2": stringToSlug(option2),
4222
4210
  "data-inventory-quantity": inventory_quantity,
4223
4211
  "data-inventory-management": inventory_management,
4224
4212
  "data-inventory-policy": inventory_policy,
@@ -4265,7 +4253,7 @@ ${selectedOption === item ? "sledge__product-variant-size-swatch-active" : ""} s
4265
4253
  ] });
4266
4254
  };
4267
4255
  const ProductCard = React__default.memo((props) => {
4268
- var _a, _b, _c, _d, _e;
4256
+ var _a, _b, _c, _d, _e, _f, _g;
4269
4257
  const {
4270
4258
  item,
4271
4259
  handleAddToCart,
@@ -4489,7 +4477,10 @@ const ProductCard = React__default.memo((props) => {
4489
4477
  ...triggerPropAdditional,
4490
4478
  onAfterAddWishlist,
4491
4479
  onAfterRemoveWishlist,
4492
- wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
4480
+ wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id],
4481
+ ...objectPresent(previewSettings) && ((_e = (_d = previewSettings == null ? void 0 : previewSettings.settings) == null ? void 0 : _d.general) == null ? void 0 : _e.use_dummy_data) ? {
4482
+ previewSettings
4483
+ } : {}
4493
4484
  }
4494
4485
  ),
4495
4486
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-featured-image-element", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4513,7 +4504,7 @@ const ProductCard = React__default.memo((props) => {
4513
4504
  }
4514
4505
  }
4515
4506
  ) }),
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(
4507
+ /* @__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
4508
  "img",
4518
4509
  {
4519
4510
  decoding: "async",
@@ -4638,7 +4629,7 @@ const ProductCard = React__default.memo((props) => {
4638
4629
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
4639
4630
  });
4640
4631
  const ProductGrid = React__default.memo((props) => {
4641
- const { type, className = "", data, setting, sourceApp = null, useSlider = false, isFlyout = false, onAfterAddToCart, onAfterRenderProduct, currentColumnGrid } = props;
4632
+ const { type, className = "", data, setting, sourceApp = null, useSlider = false, isFlyout = false, onAfterAddToCart, onAfterRenderProduct, currentColumnGrid, previewSettings } = props;
4642
4633
  const { redirect_add_to_cart = true } = setting || {};
4643
4634
  const [clickedAddToCartId, setClickedAddToCartId] = React__default.useState(null);
4644
4635
  const [generalDataSettings, setGeneralDataSettings] = React__default.useState({});
@@ -4646,6 +4637,17 @@ const ProductGrid = React__default.memo((props) => {
4646
4637
  var _a;
4647
4638
  const { id, quantity } = data2;
4648
4639
  setClickedAddToCartId(id);
4640
+ if (objectPresent(previewSettings)) {
4641
+ setClickedAddToCartId(null);
4642
+ onAfterAddToCart && onAfterAddToCart("success");
4643
+ window.sledgeToastNotification({
4644
+ title: "Cart added",
4645
+ message: "Successfully added to wishlist",
4646
+ type: "success",
4647
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 40, height: 40, color: "black" })
4648
+ });
4649
+ return;
4650
+ }
4649
4651
  let resShopifyAddToCart = await addToCart([
4650
4652
  {
4651
4653
  id,
@@ -7718,7 +7720,7 @@ const Facet = (props) => {
7718
7720
  value: value2
7719
7721
  };
7720
7722
  }),
7721
- defaultValue: clickedFacets && ((_d = clickedFacets[value]) == null ? void 0 : _d.length) ? clickedFacets[value][0] : "",
7723
+ value: clickedFacets && ((_d = clickedFacets[value]) == null ? void 0 : _d.length) ? clickedFacets[value][0] : "",
7722
7724
  labelStyle: filter_option_style,
7723
7725
  useVirtualized: true,
7724
7726
  selector: scrollElementSelector,