@inappstory/slide-api 0.1.33 → 0.1.35

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
@@ -6301,7 +6301,11 @@ class Slider {
6301
6301
  this.slidesFirstRenders[index].called = true;
6302
6302
  showSlidePromise = new Promise(resolve => {
6303
6303
  this.slidesFirstRenders[index].firstRenderCall(resolve);
6304
- }).then(_ => _);
6304
+ })
6305
+ .then(data => data)
6306
+ .catch(reason => {
6307
+ throw new Error(reason);
6308
+ });
6305
6309
  }
6306
6310
  else {
6307
6311
  showSlidePromise = this.config.onBeforeShowSlide(this.slides[index].element, index);
@@ -7380,22 +7384,27 @@ class TimerRenderer {
7380
7384
  render(time) {
7381
7385
  const container = document.createElement("div");
7382
7386
  container.classList.add("narrative-element-timer__container");
7383
- const days = this.createGroup("d");
7384
- const hours = this.createGroup("h");
7385
- const minutes = this.createGroup("m");
7386
- const seconds = this.createGroup("s");
7387
7387
  if (time.days > 0) {
7388
- container.appendChild(days);
7389
- container.appendChild(this.createDelimiter());
7390
- }
7391
- container.appendChild(hours);
7392
- container.appendChild(this.createDelimiter());
7393
- container.appendChild(minutes);
7394
- container.appendChild(this.createDelimiter());
7395
- container.appendChild(seconds);
7388
+ this.renderByFormat(container, "d:h:m");
7389
+ }
7390
+ else if (time.hours > 0) {
7391
+ this.renderByFormat(container, "h:m:s");
7392
+ }
7393
+ else {
7394
+ this.renderByFormat(container, "m:s");
7395
+ }
7396
7396
  this.setTime(time);
7397
7397
  return container;
7398
7398
  }
7399
+ renderByFormat(container, format) {
7400
+ const parts = format.split(":");
7401
+ for (let i = 0; i < parts.length; i++) {
7402
+ container.appendChild(this.createGroup(parts[i]));
7403
+ if (i < parts.length - 1) {
7404
+ container.appendChild(this.createDelimiter());
7405
+ }
7406
+ }
7407
+ }
7399
7408
  pad(num) {
7400
7409
  return num.toString().padStart(2, "0");
7401
7410
  }
@@ -7424,20 +7433,28 @@ class TimerRenderer {
7424
7433
  }
7425
7434
  setDays(days) {
7426
7435
  const padded = this.pad(days);
7436
+ if (!this.digits["d1"] || !this.digits["d2"])
7437
+ return;
7427
7438
  this.digits["d1"].textContent = padded[0];
7428
7439
  this.digits["d2"].textContent = padded[1];
7429
7440
  }
7430
7441
  setHours(hours) {
7442
+ if (!this.digits["h1"] || !this.digits["h2"])
7443
+ return;
7431
7444
  const padded = this.pad(hours);
7432
7445
  this.digits["h1"].textContent = padded[0];
7433
7446
  this.digits["h2"].textContent = padded[1];
7434
7447
  }
7435
7448
  setMinutes(minutes) {
7449
+ if (!this.digits["m1"] || !this.digits["m2"])
7450
+ return;
7436
7451
  const padded = this.pad(minutes);
7437
7452
  this.digits["m1"].textContent = padded[0];
7438
7453
  this.digits["m2"].textContent = padded[1];
7439
7454
  }
7440
7455
  setSeconds(seconds) {
7456
+ if (!this.digits["s1"] || !this.digits["s2"])
7457
+ return;
7441
7458
  const padded = this.pad(seconds);
7442
7459
  this.digits["s1"].textContent = padded[0];
7443
7460
  this.digits["s2"].textContent = padded[1];
@@ -20336,8 +20353,8 @@ class ProductOfferMapper {
20336
20353
  available: offerDto.availability !== 0,
20337
20354
  availability: offerDto.availability,
20338
20355
  options: {
20339
- color: offerDto.color ? { name: "color", value: offerDto.color } : { name: "color", value: "Undefined" },
20340
- size: offerDto.size ? { name: "size", value: offerDto.size } : { name: "size", value: "Undefined" },
20356
+ color: offerDto.color ? { name: "color", value: offerDto.color } : null,
20357
+ size: offerDto.size ? { name: "size", value: offerDto.size } : null,
20341
20358
  },
20342
20359
  name: offerDto.name,
20343
20360
  price: offerDto.price,
@@ -20429,7 +20446,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20429
20446
  const cartOffer = ProductOfferMapper.fromOfferDtoToProductCartOffer(offerDto, quantity);
20430
20447
  const delay = async () => new Promise(resolve => setTimeout(resolve, 300));
20431
20448
  const [productCart] = await Promise.all([
20432
- await await this.widgetDeps.slideApiDeps.productCartUpdate({
20449
+ this.widgetDeps.slideApiDeps.productCartUpdate({
20433
20450
  offer: cartOffer,
20434
20451
  }),
20435
20452
  delay(),
@@ -20439,11 +20456,7 @@ class ProductDetailsBottomSheet extends RenderableComponent {
20439
20456
  getProductAndRelatedProducts(offerDto) {
20440
20457
  return {
20441
20458
  product: ProductOfferMapper.fromOfferDtoToProductOffer(offerDto),
20442
- relatedProducts: offerDto.subOffersApi
20443
- ? offerDto.subOffersApi
20444
- .filter(subOffer => subOffer.size != null && subOffer.color != null)
20445
- .map(subOffer => ProductOfferMapper.fromOfferDtoToProductOffer(subOffer))
20446
- : [],
20459
+ relatedProducts: offerDto.subOffersApi ? offerDto.subOffersApi.map(subOffer => ProductOfferMapper.fromOfferDtoToProductOffer(subOffer)) : [],
20447
20460
  };
20448
20461
  }
20449
20462
  static get [Symbol.for("___CTOR_ARGS___")]() { return [`WidgetDeps`, `ProductDetailsBottomSheetProps`]; }