@sledge-app/react-instant-search 0.0.128 → 1.0.0

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.
@@ -2289,6 +2289,17 @@ const ProductGrid = ({
2289
2289
  display_button_add_to_cart_style = {}
2290
2290
  } = setting || {};
2291
2291
  const [clickedAddToCartId, setClickedAddToCartId] = React__default.useState(null);
2292
+ const addToCartTrigger$2 = sourceApp ? async (productId) => {
2293
+ if (sourceApp === "wishlist") {
2294
+ await addToCartTrigger$1({
2295
+ productId
2296
+ });
2297
+ } else if (sourceApp === "instant-search") {
2298
+ await addToCartTrigger({
2299
+ productId
2300
+ });
2301
+ }
2302
+ } : null;
2292
2303
  const handleAddToCart = async (data2) => {
2293
2304
  var _a;
2294
2305
  const { id, quantity } = data2;
@@ -2300,15 +2311,7 @@ const ProductGrid = ({
2300
2311
  }
2301
2312
  ]);
2302
2313
  if ((_a = resShopifyAddToCart == null ? void 0 : resShopifyAddToCart.items) == null ? void 0 : _a.length) {
2303
- if (sourceApp === "wishlist") {
2304
- await addToCartTrigger$1({
2305
- productId: id
2306
- });
2307
- } else if (sourceApp === "instant-search") {
2308
- await addToCartTrigger({
2309
- productId: id
2310
- });
2311
- }
2314
+ addToCartTrigger$2 && addToCartTrigger$2(id);
2312
2315
  setClickedAddToCartId(null);
2313
2316
  onAfterAddToCart && onAfterAddToCart("success");
2314
2317
  if (redirect_add_to_cart) {
@@ -2366,7 +2369,8 @@ const ProductGrid = ({
2366
2369
  } : {}
2367
2370
  },
2368
2371
  showPopupComponent,
2369
- setShowPopupComponent
2372
+ setShowPopupComponent,
2373
+ ...addToCartTrigger$2 ? addToCartTrigger$2 : {}
2370
2374
  }) : null;
2371
2375
  return cards ? /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: getCards } }) : getCards }, index) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card", children: [
2372
2376
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-content", children: [