@inappstory/slide-api 0.1.36 → 0.1.37

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.
package/dist/index.cjs CHANGED
@@ -20205,6 +20205,9 @@ class ProductOptions extends RenderableComponent {
20205
20205
  this.optionsManager = new ProductOptionsManager(props.optionNames, props.products);
20206
20206
  this.init(props.products);
20207
20207
  }
20208
+ getOptionsCount() {
20209
+ return this.props.optionNames.reduce((sum, optionName) => sum + this.optionsManager.getOptionsFor(optionName).length, 0);
20210
+ }
20208
20211
  renderTemplate() {
20209
20212
  this.optionsContainer = h("div", { class: "ias-product-details__options" }, this.renderOptionSelectors());
20210
20213
  return this.optionsContainer;
@@ -20300,10 +20303,10 @@ class ProductDetails extends RenderableComponent {
20300
20303
  });
20301
20304
  const description = new ProductDetailsDescription(props.product);
20302
20305
  const productOptions = this.createProductOptions({ purchase, gallery, description, cover });
20303
- const relatedProductsLength = this.props.relatedProducts.length ?? 0;
20306
+ const hasRelatedProducts = this.props.relatedProducts.length > 0 && productOptions.getOptionsCount() > 0;
20304
20307
  return h("div", { class: "ias-product-details" },
20305
20308
  /* this.props.product.coverUrl ? cover.render() : null, */
20306
- h("div", { class: "ias-product-details__scrollable" }, gallery.render(), h("div", { class: "ias-product-details__content" }, description.render(), relatedProductsLength > 0 ? productOptions.render() : null)), this.createFooter(purchase));
20309
+ h("div", { class: "ias-product-details__scrollable" }, gallery.render(), h("div", { class: "ias-product-details__content" }, description.render(), hasRelatedProducts ? productOptions.render() : null)), this.createFooter(purchase));
20307
20310
  }
20308
20311
  createProductOptions({ purchase, gallery, description, cover, }) {
20309
20312
  return new ProductOptions({