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