@sledge-app/react-instant-search 2.0.25 → 2.0.27

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.
@@ -1156,14 +1156,31 @@ const RadioGroup = ({ id, name, required, value, items, labelStyle = {}, onValue
1156
1156
  ) }) }) });
1157
1157
  };
1158
1158
  const ColorSwatch$1 = "";
1159
- const ColorSwatch = ({ id, name, value, rgb, image, required, checked, onClick, labelType = "tooltip", label, labelStyle = {} }) => {
1159
+ const ColorSwatch = ({ id, name, value, rgb, additionalRgb: additionalRgbProp = [], image, required, checked, onClick, labelType = "tooltip", label, labelStyle = {} }) => {
1160
+ var _a;
1161
+ const additionalRgb = (_a = additionalRgbProp == null ? void 0 : additionalRgbProp.filter) == null ? void 0 : _a.call(additionalRgbProp, (item) => item);
1162
+ let rgbStyle = {
1163
+ backgroundColor: rgb
1164
+ };
1165
+ if (additionalRgb == null ? void 0 : additionalRgb.length) {
1166
+ rgbStyle = {
1167
+ background: `linear-gradient(to bottom right, ${rgb} 50%, ${additionalRgb[0]} 50%)`
1168
+ };
1169
+ if ((additionalRgb == null ? void 0 : additionalRgb.length) > 1) {
1170
+ rgbStyle = {
1171
+ background: `conic-gradient(
1172
+ ${rgb} 0deg 120deg,
1173
+ ${additionalRgb[0]} 120deg 240deg,
1174
+ ${additionalRgb[1]} 240deg 360deg
1175
+ )`
1176
+ };
1177
+ }
1178
+ }
1160
1179
  const styles = {
1161
1180
  ...(image == null ? void 0 : image.length) ? {
1162
1181
  backgroundImage: `url("${image}")`,
1163
1182
  backgroundSize: "contain"
1164
- } : {
1165
- backgroundColor: rgb
1166
- }
1183
+ } : rgbStyle
1167
1184
  };
1168
1185
  const colorSwatchComponent = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__color-swatch-wrapper", children: [
1169
1186
  /* @__PURE__ */ jsxRuntimeExports.jsx($e698a72e93240346$export$be92b6f5f03c0fe9, { className: "sledge__color-swatch-root", checked, id, name, value, required, onClick, style: styles }),
@@ -4149,13 +4166,41 @@ const addToCartTrigger = async (data) => {
4149
4166
  });
4150
4167
  };
4151
4168
  const VariantSelector = (props) => {
4152
- var _a;
4153
- const { data, setSelectedVariantId, setSelectedVariantStock, setSelectedVariantInventoryManagement, setSelectedVariantInventoryPolicy, sourceApp } = props;
4169
+ var _a, _b, _c;
4170
+ const {
4171
+ data,
4172
+ setSelectedVariantId,
4173
+ setSelectedVariantStock,
4174
+ setSelectedVariantInventoryManagement,
4175
+ setSelectedVariantInventoryPolicy,
4176
+ sourceApp,
4177
+ instantSearchSettings,
4178
+ optionSelectedValue,
4179
+ hasEntryImage
4180
+ } = props;
4154
4181
  const { product } = data || {};
4155
4182
  const { variants } = product || {};
4156
4183
  const { id, handle, url } = product || {};
4157
4184
  const options = (product == null ? void 0 : product.options) ? Object.entries(product.options) : [];
4158
4185
  const images = (product == null ? void 0 : product.images) ?? [];
4186
+ const isSplitProducts = Boolean((_a = instantSearchSettings == null ? void 0 : instantSearchSettings.split_products) == null ? void 0 : _a.enable);
4187
+ const bySplitProducts = (_b = instantSearchSettings == null ? void 0 : instantSearchSettings.split_products) == null ? void 0 : _b.by;
4188
+ React__default.useEffect(() => {
4189
+ if (isSplitProducts && optionSelectedValue) {
4190
+ const productCardElement = document.querySelector(`.sledge__product-grid-card[data-product-id="${id}"][data-option-selected-value="${encodeURIComponent(optionSelectedValue)}"]`);
4191
+ if (productCardElement) {
4192
+ const variantColorSwatch = productCardElement.querySelector(`.sledge__product-variant-color-swatch[data-option-value="${encodeURIComponent(optionSelectedValue)}"]`);
4193
+ if (variantColorSwatch) {
4194
+ variantColorSwatch.dispatchEvent(new Event("click", { bubbles: true }));
4195
+ }
4196
+ const variantSelectOption = productCardElement.querySelector(`.sledge__product-variant-size-swatch-select[data-option-name="${bySplitProducts}"]`);
4197
+ if (variantSelectOption) {
4198
+ variantSelectOption.value = optionSelectedValue;
4199
+ variantSelectOption.dispatchEvent(new Event("change", { bubbles: true }));
4200
+ }
4201
+ }
4202
+ }
4203
+ }, [hasEntryImage]);
4159
4204
  const defaultSelected = {};
4160
4205
  function setDefaultFunction() {
4161
4206
  if (!(variants == null ? void 0 : variants.length))
@@ -4173,7 +4218,10 @@ const VariantSelector = (props) => {
4173
4218
  }
4174
4219
  setDefaultFunction();
4175
4220
  function setSelectedOption(element, optionName) {
4176
- const optionsButton = element.target.offsetParent.querySelector(`.options-button-${stringToSlug(optionName)}`).querySelectorAll(`button`);
4221
+ const optionsButtonElement = element.target.offsetParent.querySelector(`.options-button-${stringToSlug(optionName)}`);
4222
+ if (!optionsButtonElement)
4223
+ return;
4224
+ const optionsButton = optionsButtonElement.querySelectorAll(`button`);
4177
4225
  const defaultSelectedClassChanger = () => {
4178
4226
  optionsButton.forEach((button, index) => {
4179
4227
  button.classList.remove("sledge__product-variant-size-swatch-active");
@@ -4198,7 +4246,7 @@ const VariantSelector = (props) => {
4198
4246
  }
4199
4247
  }
4200
4248
  function setSelectedVariant(element, value, optionIndex) {
4201
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
4249
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
4202
4250
  const parentCard = element.target.offsetParent;
4203
4251
  const selectedInput = parentCard.querySelector(`.sledge__product-grid-card-selected-option[data-product-id='${id}']`);
4204
4252
  setElementAttribute({
@@ -4206,8 +4254,8 @@ const VariantSelector = (props) => {
4206
4254
  attributeName: `data-selected-option${optionIndex}`,
4207
4255
  value
4208
4256
  });
4209
- const option1 = `[data-option-1="${stringToSlug((_b = (_a2 = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _a2["data-selected-option1"]) == null ? void 0 : _b.value)}"]`;
4210
- const option2 = `${((_c = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _c["data-selected-option2"]) ? `[data-option-2="${stringToSlug((_e = (_d = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _d["data-selected-option2"]) == null ? void 0 : _e.value)}"]` : ""}`;
4257
+ const option1 = `[data-option-1="${stringToSlug((_b2 = (_a2 = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _a2["data-selected-option1"]) == null ? void 0 : _b2.value)}"]`;
4258
+ const option2 = `${((_c2 = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _c2["data-selected-option2"]) ? `[data-option-2="${stringToSlug((_e = (_d = selectedInput == null ? void 0 : selectedInput.attributes) == null ? void 0 : _d["data-selected-option2"]) == null ? void 0 : _e.value)}"]` : ""}`;
4211
4259
  const selectOption = parentCard.querySelector(`select option${option1}${option2}`);
4212
4260
  const variantId = selectOption.attributes["data-graphql-id"].value;
4213
4261
  const imageId = (_f = selectOption.attributes["data-image-id"]) == null ? void 0 : _f.value;
@@ -4215,11 +4263,11 @@ const VariantSelector = (props) => {
4215
4263
  const inventoryManagement = (_h = selectOption.attributes["data-inventory-management"]) == null ? void 0 : _h.value;
4216
4264
  const inventoryPolicy = (_i = selectOption.attributes["data-inventory-policy"]) == null ? void 0 : _i.value;
4217
4265
  const setOther = () => {
4218
- var _a3, _b2;
4266
+ var _a3, _b3;
4219
4267
  setElementAttribute({
4220
4268
  element: selectedInput,
4221
4269
  attributeName: "data-variant-id",
4222
- value: ((_b2 = (_a3 = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _a3["data-graphql-id"]) == null ? void 0 : _b2.value) || ""
4270
+ value: ((_b3 = (_a3 = selectOption == null ? void 0 : selectOption.attributes) == null ? void 0 : _a3["data-graphql-id"]) == null ? void 0 : _b3.value) || ""
4223
4271
  });
4224
4272
  setElementAttribute({
4225
4273
  element: selectedInput,
@@ -4272,7 +4320,7 @@ const VariantSelector = (props) => {
4272
4320
  return /* @__PURE__ */ jsxRuntimeExports.jsx("option", { ...optionAttributes, children: title }, id2);
4273
4321
  }) }),
4274
4322
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-variant-images", children: images == null ? void 0 : images.map((image) => /* @__PURE__ */ jsxRuntimeExports.jsx("input", { type: "hidden", id: image == null ? void 0 : image.id, value: image == null ? void 0 : image.src }, image == null ? void 0 : image.id)) }),
4275
- (_a = options == null ? void 0 : options.map) == null ? void 0 : _a.call(options, (option, optionParentIndex) => {
4323
+ (_c = options == null ? void 0 : options.map) == null ? void 0 : _c.call(options, (option, optionParentIndex) => {
4276
4324
  var _a2;
4277
4325
  const optionName = option[0];
4278
4326
  const optionValues = option[1];
@@ -4324,6 +4372,7 @@ ${selectedOption === item ? "sledge__product-variant-size-swatch-active" : ""} s
4324
4372
  setSelectedOption(el, optionName);
4325
4373
  },
4326
4374
  title: optionName === "Color" ? null : item,
4375
+ "data-option-value": encodeURIComponent(item),
4327
4376
  children: optionName === "Color" ? null : item
4328
4377
  },
4329
4378
  index
@@ -4339,6 +4388,7 @@ ${selectedOption === item ? "sledge__product-variant-size-swatch-active" : ""} s
4339
4388
  setSelectedVariant(el, value, optionParentIndex + 1);
4340
4389
  setSelectedOption(el, optionName);
4341
4390
  },
4391
+ "data-option-name": optionName,
4342
4392
  children: optionValues.map((item, index) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item, children: item }, index))
4343
4393
  }
4344
4394
  ) : "" });
@@ -4366,6 +4416,8 @@ const ProductCard = React__default.memo((props) => {
4366
4416
  generalDataSettings,
4367
4417
  previewSettings,
4368
4418
  isFlyout,
4419
+ instantSearchSettings,
4420
+ optionSelectedValue,
4369
4421
  additionalCardProps
4370
4422
  } = props;
4371
4423
  const {
@@ -4440,105 +4492,42 @@ const ProductCard = React__default.memo((props) => {
4440
4492
  setShowPopupComponent,
4441
4493
  sourceApp,
4442
4494
  forLoopIndex,
4443
- forLoopIndexWithPage
4495
+ forLoopIndexWithPage,
4496
+ optionSelectedValue: optionSelectedValue || null
4444
4497
  };
4445
4498
  component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isComponentJsVersion ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-for-loop-index": forLoopIndex, "data-for-loop-index-with-page": forLoopIndexWithPage, dangerouslySetInnerHTML: { __html: CardsComponent({ ...CardsProps }) } }) : /* @__PURE__ */ jsxRuntimeExports.jsx(CardsComponent, { ...CardsProps }) });
4446
4499
  } else {
4447
- component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFlyout ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-flyout", "data-for-loop-index": forLoopIndex, "data-for-loop-index-with-page": forLoopIndexWithPage, children: [
4448
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-flyout-wishlist-trigger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4449
- Trigger,
4450
- {
4451
- params: {
4452
- productId: id,
4453
- productVariantId: variant_id,
4454
- productName: title,
4455
- productVendor: vendor,
4456
- productSku: sku,
4457
- productVariantName: variant_title,
4458
- productLink: url,
4459
- productImage: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4460
- productCurrency: currency,
4461
- productPrice: price
4462
- },
4463
- ...triggerPropAdditional,
4464
- onAfterAddWishlist,
4465
- onAfterRemoveWishlist,
4466
- wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
4467
- }
4468
- ) }),
4469
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-image-flyout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4470
- "a",
4471
- {
4472
- href: url,
4473
- onClick: () => {
4474
- if (sourceApp === "instant-search") {
4475
- productClickTrigger$1({
4476
- productId: id
4477
- });
4478
- } else if (productRecommendationSourceApps.includes(sourceApp)) {
4479
- productClickTrigger({
4480
- productId: id,
4481
- sourceApp
4482
- });
4483
- }
4484
- },
4485
- className: "sledge__product-grid-card-image-link-flyout",
4486
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4487
- "img",
4500
+ component = /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFlyout ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4501
+ "div",
4502
+ {
4503
+ className: "sledge__product-grid-card-flyout",
4504
+ "data-for-loop-index": forLoopIndex,
4505
+ "data-for-loop-index-with-page": forLoopIndexWithPage,
4506
+ "data-product-id": id,
4507
+ "data-option-selected-value": encodeURIComponent(optionSelectedValue),
4508
+ children: [
4509
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-flyout-wishlist-trigger", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4510
+ Trigger,
4488
4511
  {
4489
- ref: imageRef,
4490
- ...{
4491
- src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4492
- ["loaded"]: ""
4512
+ params: {
4513
+ productId: id,
4514
+ productVariantId: variant_id,
4515
+ productName: title,
4516
+ productVendor: vendor,
4517
+ productSku: sku,
4518
+ productVariantName: variant_title,
4519
+ productLink: url,
4520
+ productImage: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4521
+ productCurrency: currency,
4522
+ productPrice: price
4493
4523
  },
4494
- alt: "sledge-card-image",
4495
- loading: "lazy",
4496
- className: "sledge__product-grid-card-image-featured-image-flyout",
4497
- onError: ({ currentTarget }) => {
4498
- if (!currentTarget)
4499
- return;
4500
- currentTarget.onerror = null;
4501
- currentTarget.src = `${CDN_URL}/images/blank-image.png`;
4502
- }
4503
- }
4504
- )
4505
- }
4506
- ) }),
4507
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-desc-flyout", children: [
4508
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4509
- "a",
4510
- {
4511
- href: url,
4512
- onClick: () => {
4513
- if (sourceApp === "instant-search") {
4514
- productClickTrigger$1({
4515
- productId: id
4516
- });
4517
- } else if (productRecommendationSourceApps.includes(sourceApp)) {
4518
- productClickTrigger({
4519
- productId: id,
4520
- sourceApp
4521
- });
4522
- }
4523
- },
4524
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name-flyout", style: display_product_name_style, children: title })
4525
- }
4526
- ) : null,
4527
- show_price ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-price-flyout", children: [
4528
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: display_price_style, dangerouslySetInnerHTML: { __html: shopifyFormatMoney(price * 100, money_format) } }),
4529
- isOnSale && /* @__PURE__ */ jsxRuntimeExports.jsx(
4530
- "div",
4531
- {
4532
- className: "sledge__product-grid-card-compare-at-price-flyout",
4533
- dangerouslySetInnerHTML: { __html: shopifyFormatMoney(compare_at_price * 100, money_format) }
4524
+ ...triggerPropAdditional,
4525
+ onAfterAddWishlist,
4526
+ onAfterRemoveWishlist,
4527
+ wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id]
4534
4528
  }
4535
- )
4536
- ] }) : null
4537
- ] })
4538
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card", "data-for-loop-index": forLoopIndex, "data-for-loop-index-with-page": forLoopIndexWithPage, children: [
4539
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-content", children: [
4540
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-image", children: [
4541
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
4529
+ ) }),
4530
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-image-flyout", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4542
4531
  "a",
4543
4532
  {
4544
4533
  href: url,
@@ -4554,186 +4543,273 @@ const ProductCard = React__default.memo((props) => {
4554
4543
  });
4555
4544
  }
4556
4545
  },
4557
- className: "sledge__product-grid-card-image-link",
4558
- children: [
4559
- isOnSale && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-badge-on-sale", children: "ON SALE" }),
4560
- /* @__PURE__ */ jsxRuntimeExports.jsx(
4561
- Trigger,
4562
- {
4563
- params: {
4564
- productId: id,
4565
- productVariantId: variant_id,
4566
- productName: title,
4567
- productVendor: vendor,
4568
- productSku: sku,
4569
- productVariantName: variant_title,
4570
- productLink: url,
4571
- productImage: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4572
- productCurrency: currency,
4573
- productPrice: price
4574
- },
4575
- ...triggerPropAdditional,
4576
- onAfterAddWishlist,
4577
- onAfterRemoveWishlist,
4578
- wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id],
4579
- ...objectPresent(previewSettings) && ((_e = (_d = previewSettings == null ? void 0 : previewSettings.settings) == null ? void 0 : _d.general) == null ? void 0 : _e.use_dummy_data) ? {
4580
- previewSettings
4581
- } : {}
4582
- }
4583
- ),
4584
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-featured-image-element", children: [
4585
- /* @__PURE__ */ jsxRuntimeExports.jsx(
4586
- "img",
4587
- {
4588
- ref: imageRef,
4589
- ...hasEntryImage ? {
4590
- src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4591
- ["loaded"]: ""
4592
- } : {
4593
- ["data-src"]: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`
4594
- },
4595
- alt: "sledge-card-image",
4596
- loading: "lazy",
4597
- className: "sledge__product-grid-card-image-featured-image",
4598
- onError: ({ currentTarget }) => {
4599
- if (!currentTarget)
4600
- return;
4601
- currentTarget.onerror = null;
4602
- currentTarget.src = `${CDN_URL}/images/blank-image.png`;
4603
- }
4604
- }
4605
- ),
4606
- secondaryImage && /* @__PURE__ */ jsxRuntimeExports.jsx(
4607
- "img",
4608
- {
4609
- src: secondaryImage == null ? void 0 : secondaryImage.src,
4610
- alt: "sledge-card-image",
4611
- className: "sledge__product-grid-card-image-featured-image sledge__product-grid-card-image-featured-image--secondary"
4612
- }
4613
- )
4614
- ] }),
4615
- /* @__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(
4616
- "img",
4617
- {
4618
- decoding: "async",
4619
- id: image2 == null ? void 0 : image2.id,
4620
- height: "270",
4621
- loading: "lazy",
4622
- src: image2 == null ? void 0 : image2.src,
4623
- alt: product == null ? void 0 : product.title,
4624
- width: 269.92,
4625
- style: { aspectRatio: 269.92 / 270 }
4546
+ className: "sledge__product-grid-card-image-link-flyout",
4547
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4548
+ "img",
4549
+ {
4550
+ ref: imageRef,
4551
+ ...{
4552
+ src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4553
+ ["loaded"]: ""
4626
4554
  },
4627
- image2 == null ? void 0 : image2.id
4628
- )) })
4629
- ]
4555
+ alt: "sledge-card-image",
4556
+ loading: "lazy",
4557
+ className: "sledge__product-grid-card-image-featured-image-flyout",
4558
+ onError: ({ currentTarget }) => {
4559
+ if (!currentTarget)
4560
+ return;
4561
+ currentTarget.onerror = null;
4562
+ currentTarget.src = `${CDN_URL}/images/blank-image.png`;
4563
+ }
4564
+ }
4565
+ )
4630
4566
  }
4631
- ),
4632
- isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-out-of-stock", children: language_button_out_of_stock || "Sold out" }) : null
4633
- ] }),
4634
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-desc", children: [
4635
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-title", children: [
4636
- show_price ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-price", children: [
4567
+ ) }),
4568
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-desc-flyout", children: [
4569
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4570
+ "a",
4571
+ {
4572
+ href: url,
4573
+ onClick: () => {
4574
+ if (sourceApp === "instant-search") {
4575
+ productClickTrigger$1({
4576
+ productId: id
4577
+ });
4578
+ } else if (productRecommendationSourceApps.includes(sourceApp)) {
4579
+ productClickTrigger({
4580
+ productId: id,
4581
+ sourceApp
4582
+ });
4583
+ }
4584
+ },
4585
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name-flyout", style: display_product_name_style, children: title })
4586
+ }
4587
+ ) : null,
4588
+ show_price ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-price-flyout", children: [
4637
4589
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: display_price_style, dangerouslySetInnerHTML: { __html: shopifyFormatMoney(price * 100, money_format) } }),
4638
4590
  isOnSale && /* @__PURE__ */ jsxRuntimeExports.jsx(
4639
4591
  "div",
4640
4592
  {
4641
- className: "sledge__product-grid-card-compare-at-price",
4593
+ className: "sledge__product-grid-card-compare-at-price-flyout",
4642
4594
  dangerouslySetInnerHTML: { __html: shopifyFormatMoney(compare_at_price * 100, money_format) }
4643
4595
  }
4644
4596
  )
4645
- ] }) : null,
4646
- show_vendor && vendor ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-badge-vendor", title: vendor, children: [
4647
- "Vendor: ",
4648
- vendor
4649
4597
  ] }) : null
4598
+ ] })
4599
+ ]
4600
+ }
4601
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4602
+ "div",
4603
+ {
4604
+ className: "sledge__product-grid-card",
4605
+ "data-for-loop-index": forLoopIndex,
4606
+ "data-for-loop-index-with-page": forLoopIndexWithPage,
4607
+ "data-product-id": id,
4608
+ "data-option-selected-value": encodeURIComponent(optionSelectedValue),
4609
+ children: [
4610
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-content", children: [
4611
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-image", children: [
4612
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
4613
+ "a",
4614
+ {
4615
+ href: url,
4616
+ onClick: () => {
4617
+ if (sourceApp === "instant-search") {
4618
+ productClickTrigger$1({
4619
+ productId: id
4620
+ });
4621
+ } else if (productRecommendationSourceApps.includes(sourceApp)) {
4622
+ productClickTrigger({
4623
+ productId: id,
4624
+ sourceApp
4625
+ });
4626
+ }
4627
+ },
4628
+ className: "sledge__product-grid-card-image-link",
4629
+ children: [
4630
+ isOnSale && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-badge-on-sale", children: "ON SALE" }),
4631
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4632
+ Trigger,
4633
+ {
4634
+ params: {
4635
+ productId: id,
4636
+ productVariantId: variant_id,
4637
+ productName: title,
4638
+ productVendor: vendor,
4639
+ productSku: sku,
4640
+ productVariantName: variant_title,
4641
+ productLink: url,
4642
+ productImage: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4643
+ productCurrency: currency,
4644
+ productPrice: price
4645
+ },
4646
+ ...triggerPropAdditional,
4647
+ onAfterAddWishlist,
4648
+ onAfterRemoveWishlist,
4649
+ wishlistChecked: dataWishlists == null ? void 0 : dataWishlists[id],
4650
+ ...objectPresent(previewSettings) && ((_e = (_d = previewSettings == null ? void 0 : previewSettings.settings) == null ? void 0 : _d.general) == null ? void 0 : _e.use_dummy_data) ? {
4651
+ previewSettings
4652
+ } : {}
4653
+ }
4654
+ ),
4655
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-featured-image-element", children: [
4656
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4657
+ "img",
4658
+ {
4659
+ ref: imageRef,
4660
+ ...hasEntryImage ? {
4661
+ src: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`,
4662
+ ["loaded"]: ""
4663
+ } : {
4664
+ ["data-src"]: (image == null ? void 0 : image.src) || `${CDN_URL}/images/blank-image.png`
4665
+ },
4666
+ alt: "sledge-card-image",
4667
+ loading: "lazy",
4668
+ className: "sledge__product-grid-card-image-featured-image",
4669
+ onError: ({ currentTarget }) => {
4670
+ if (!currentTarget)
4671
+ return;
4672
+ currentTarget.onerror = null;
4673
+ currentTarget.src = `${CDN_URL}/images/blank-image.png`;
4674
+ }
4675
+ }
4676
+ ),
4677
+ secondaryImage && /* @__PURE__ */ jsxRuntimeExports.jsx(
4678
+ "img",
4679
+ {
4680
+ src: secondaryImage == null ? void 0 : secondaryImage.src,
4681
+ alt: "sledge-card-image",
4682
+ className: "sledge__product-grid-card-image-featured-image sledge__product-grid-card-image-featured-image--secondary"
4683
+ }
4684
+ )
4685
+ ] }),
4686
+ /* @__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(
4687
+ "img",
4688
+ {
4689
+ decoding: "async",
4690
+ id: image2 == null ? void 0 : image2.id,
4691
+ height: "270",
4692
+ loading: "lazy",
4693
+ src: image2 == null ? void 0 : image2.src,
4694
+ alt: product == null ? void 0 : product.title,
4695
+ width: 269.92,
4696
+ style: { aspectRatio: 269.92 / 270 }
4697
+ },
4698
+ image2 == null ? void 0 : image2.id
4699
+ )) })
4700
+ ]
4701
+ }
4702
+ ),
4703
+ isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-out-of-stock", children: language_button_out_of_stock || "Sold out" }) : null
4704
+ ] }),
4705
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-desc", children: [
4706
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-title", children: [
4707
+ show_price ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-card-price", children: [
4708
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: display_price_style, dangerouslySetInnerHTML: { __html: shopifyFormatMoney(price * 100, money_format) } }),
4709
+ isOnSale && /* @__PURE__ */ jsxRuntimeExports.jsx(
4710
+ "div",
4711
+ {
4712
+ className: "sledge__product-grid-card-compare-at-price",
4713
+ dangerouslySetInnerHTML: { __html: shopifyFormatMoney(compare_at_price * 100, money_format) }
4714
+ }
4715
+ )
4716
+ ] }) : null,
4717
+ show_vendor && vendor ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge__product-grid-badge-vendor", title: vendor, children: [
4718
+ "Vendor: ",
4719
+ vendor
4720
+ ] }) : null
4721
+ ] }),
4722
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-rating", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4723
+ Rating,
4724
+ {
4725
+ params: {
4726
+ productId: id
4727
+ },
4728
+ size: "xs",
4729
+ withSkeletonLoading: false,
4730
+ isScrollToElementWidget: false,
4731
+ data: dataReviews == null ? void 0 : dataReviews[id]
4732
+ }
4733
+ ) }),
4734
+ title ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4735
+ "a",
4736
+ {
4737
+ href: url,
4738
+ onClick: () => {
4739
+ if (sourceApp === "instant-search") {
4740
+ productClickTrigger$1({
4741
+ productId: id
4742
+ });
4743
+ } else if (productRecommendationSourceApps.includes(sourceApp)) {
4744
+ productClickTrigger({
4745
+ productId: id,
4746
+ sourceApp
4747
+ });
4748
+ }
4749
+ },
4750
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name", style: display_product_name_style, children: title })
4751
+ }
4752
+ ) : null,
4753
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-text", children: show_sku && sku ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
4754
+ "SKU: ",
4755
+ sku
4756
+ ] }) : null }),
4757
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4758
+ VariantSelector,
4759
+ {
4760
+ data: {
4761
+ product: {
4762
+ ...product,
4763
+ variants
4764
+ }
4765
+ },
4766
+ setSelectedVariantId,
4767
+ setSelectedVariantStock,
4768
+ setSelectedVariantInventoryManagement,
4769
+ setSelectedVariantInventoryPolicy,
4770
+ sourceApp,
4771
+ instantSearchSettings,
4772
+ optionSelectedValue,
4773
+ hasEntryImage
4774
+ }
4775
+ )
4776
+ ] })
4650
4777
  ] }),
4651
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-rating", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4652
- Rating,
4653
- {
4654
- params: {
4655
- productId: id
4656
- },
4657
- size: "xs",
4658
- withSkeletonLoading: false,
4659
- isScrollToElementWidget: false,
4660
- data: dataReviews == null ? void 0 : dataReviews[id]
4661
- }
4662
- ) }),
4663
- title ? /* @__PURE__ */ jsxRuntimeExports.jsx(
4664
- "a",
4778
+ show_add_to_cart ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-button-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4779
+ Button,
4665
4780
  {
4666
- href: url,
4667
- onClick: () => {
4668
- if (sourceApp === "instant-search") {
4669
- productClickTrigger$1({
4670
- productId: id
4671
- });
4672
- } else if (productRecommendationSourceApps.includes(sourceApp)) {
4673
- productClickTrigger({
4674
- productId: id,
4675
- sourceApp
4676
- });
4781
+ type: "button",
4782
+ colorType: "light",
4783
+ className: "sledge__product-grid-button-add-to-cart",
4784
+ style: {
4785
+ ...display_button_add_to_cart_style,
4786
+ ...isLoadingAddToCart && {
4787
+ cursor: "wait"
4677
4788
  }
4678
4789
  },
4679
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "sledge__product-grid-card-product-name", style: display_product_name_style, children: title })
4680
- }
4681
- ) : null,
4682
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-card-text", children: show_sku && sku ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
4683
- "SKU: ",
4684
- sku
4685
- ] }) : null }),
4686
- /* @__PURE__ */ jsxRuntimeExports.jsx(
4687
- VariantSelector,
4688
- {
4689
- data: {
4690
- product: {
4691
- ...product,
4692
- variants
4790
+ ...isLoadingAddToCart || isOutOfStock ? {
4791
+ disabled: true
4792
+ } : {
4793
+ onClick: () => {
4794
+ handleAddToCart && handleAddToCart({
4795
+ id: selectedVariantId,
4796
+ quantity: 1
4797
+ });
4693
4798
  }
4694
4799
  },
4695
- setSelectedVariantId,
4696
- setSelectedVariantStock,
4697
- setSelectedVariantInventoryManagement,
4698
- setSelectedVariantInventoryPolicy,
4699
- sourceApp
4700
- }
4701
- )
4702
- ] })
4703
- ] }),
4704
- show_add_to_cart ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__product-grid-button-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4705
- Button,
4706
- {
4707
- type: "button",
4708
- colorType: "light",
4709
- className: "sledge__product-grid-button-add-to-cart",
4710
- style: {
4711
- ...display_button_add_to_cart_style,
4712
- ...isLoadingAddToCart && {
4713
- cursor: "wait"
4714
- }
4715
- },
4716
- ...isLoadingAddToCart || isOutOfStock ? {
4717
- disabled: true
4718
- } : {
4719
- onClick: () => {
4720
- handleAddToCart && handleAddToCart({
4721
- id: selectedVariantId,
4722
- quantity: 1
4723
- });
4800
+ children: isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4801
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
4802
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_button_out_of_stock || "Sold out" })
4803
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4804
+ isLoadingAddToCart ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingDots, {}) : null,
4805
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
4806
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_button_add_to_cart || "Add To Cart" })
4807
+ ] })
4724
4808
  }
4725
- },
4726
- children: isOutOfStock ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4727
- /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
4728
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_button_out_of_stock || "Sold out" })
4729
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4730
- isLoadingAddToCart ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingDots, {}) : null,
4731
- /* @__PURE__ */ jsxRuntimeExports.jsx(BagIcon, { width: 15, height: 15, color: "currentColor" }),
4732
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_button_add_to_cart || "Add To Cart" })
4733
- ] })
4734
- }
4735
- ) }) : null
4736
- ] }) });
4809
+ ) }) : null
4810
+ ]
4811
+ }
4812
+ ) });
4737
4813
  }
4738
4814
  return /* @__PURE__ */ jsxRuntimeExports.jsx(React__default.Fragment, { children: component }, id);
4739
4815
  });
@@ -4750,6 +4826,7 @@ const ProductGrid = React__default.memo((props) => {
4750
4826
  onAfterRenderProduct,
4751
4827
  currentColumnGrid,
4752
4828
  previewSettings,
4829
+ instantSearchSettings,
4753
4830
  hitsPerPage,
4754
4831
  currentPage
4755
4832
  } = props;
@@ -4847,21 +4924,23 @@ const ProductGrid = React__default.memo((props) => {
4847
4924
  "data-custom-card": Boolean(props == null ? void 0 : props.cards),
4848
4925
  "data-flyout": isFlyout,
4849
4926
  children: data == null ? void 0 : data.map((item, index) => {
4850
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
4851
- ProductCard,
4852
- {
4853
- item,
4854
- handleAddToCart,
4855
- clickedAddToCartId,
4856
- generalDataSettings,
4857
- additionalCardProps: {
4858
- forLoopIndex: index,
4859
- forLoopIndexWithPage: Number(currentPage) && Number(hitsPerPage) ? index + (Number(currentPage) - 1) * Number(hitsPerPage) : index
4860
- },
4861
- ...props
4927
+ var _a, _b, _c, _d, _e;
4928
+ const isSplitProducts = Boolean((_a = instantSearchSettings == null ? void 0 : instantSearchSettings.split_products) == null ? void 0 : _a.enable);
4929
+ const optionFirst = isSplitProducts && ((_b = instantSearchSettings == null ? void 0 : instantSearchSettings.split_products) == null ? void 0 : _b.by) ? (_e = (_c = item == null ? void 0 : item.product) == null ? void 0 : _c.options) == null ? void 0 : _e[(_d = instantSearchSettings == null ? void 0 : instantSearchSettings.split_products) == null ? void 0 : _d.by] : [];
4930
+ const optionFirstValues = (optionFirst == null ? void 0 : optionFirst.length) ? optionFirst : [];
4931
+ const productCardProps = {
4932
+ item,
4933
+ handleAddToCart,
4934
+ clickedAddToCartId,
4935
+ generalDataSettings,
4936
+ additionalCardProps: {
4937
+ forLoopIndex: index,
4938
+ forLoopIndexWithPage: Number(currentPage) && Number(hitsPerPage) ? index + (Number(currentPage) - 1) * Number(hitsPerPage) : index
4862
4939
  },
4863
- `sledge-product-card_${index}`
4864
- );
4940
+ instantSearchSettings,
4941
+ ...props
4942
+ };
4943
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isSplitProducts && (optionFirstValues == null ? void 0 : optionFirstValues.length) ? optionFirstValues.map((optionFirstValue, indexFirstValue) => /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { optionSelectedValue: optionFirstValue, ...productCardProps }, `sledge-product-card_${index}_${indexFirstValue}`)) : /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { ...productCardProps }, `sledge-product-card_${index}`) });
4865
4944
  })
4866
4945
  }
4867
4946
  );
@@ -7820,6 +7899,7 @@ const Facet = (props) => {
7820
7899
  name: value,
7821
7900
  value: item == null ? void 0 : item.value,
7822
7901
  rgb: getColorSwatch == null ? void 0 : getColorSwatch.rgb,
7902
+ additionalRgb: [(getColorSwatch == null ? void 0 : getColorSwatch.color_2) || null, (getColorSwatch == null ? void 0 : getColorSwatch.color_3) || null],
7823
7903
  image: getColorSwatch == null ? void 0 : getColorSwatch.image,
7824
7904
  onClick: (e) => handleFilterChange({
7825
7905
  parentId: value,
@@ -9822,6 +9902,7 @@ const SearchResultWidget = (props) => {
9822
9902
  setAllowedTabs,
9823
9903
  isDesktopLayout,
9824
9904
  previewSettings,
9905
+ instantSearchSettings,
9825
9906
  currentColumnGrid,
9826
9907
  setCurrentColumnGrid
9827
9908
  })
@@ -9908,6 +9989,7 @@ const ResultProduct = React__default.memo((props) => {
9908
9989
  setAllowedTabs,
9909
9990
  isDesktopLayout,
9910
9991
  previewSettings,
9992
+ instantSearchSettings,
9911
9993
  currentColumnGrid,
9912
9994
  setCurrentColumnGrid
9913
9995
  } = props || {};
@@ -10668,6 +10750,7 @@ const ResultProduct = React__default.memo((props) => {
10668
10750
  dataReviews: propsData == null ? void 0 : propsData.reviews,
10669
10751
  currentColumnGrid,
10670
10752
  previewSettings,
10753
+ instantSearchSettings,
10671
10754
  hitsPerPage: hitsPerPageResult,
10672
10755
  currentPage
10673
10756
  }