@resira/ui 0.4.2 → 0.4.3

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
@@ -1777,6 +1777,10 @@ function ServiceOverlayCard({
1777
1777
  }) {
1778
1778
  const currency = product.currency ?? "EUR";
1779
1779
  const priceLabel = product.pricingModel === "per_rider" ? "per rider" : product.pricingModel === "per_person" ? locale.perPerson : locale.perSession;
1780
+ const hasMultipleOptions = (product.durationPricing?.length ?? 0) > 1 || (product.riderTierPricing?.length ?? 0) > 1;
1781
+ const lowestPrice = hasMultipleOptions && product.durationPricing?.length ? Math.min(...product.durationPricing.map((dp) => dp.priceCents)) : product.priceCents;
1782
+ const pricePrefix = hasMultipleOptions ? "from " : "";
1783
+ const optionCount = product.durationPricing?.length ?? (product.riderTierPricing?.length ?? 0);
1780
1784
  let className = "resira-service-overlay-card";
1781
1785
  if (isSelected) className += " resira-service-overlay-card--selected";
1782
1786
  if (cardClassName) className += ` ${cardClassName}`;
@@ -1797,17 +1801,22 @@ function ServiceOverlayCard({
1797
1801
  ] }),
1798
1802
  /* @__PURE__ */ jsxs("div", { className: "resira-service-overlay-card-bottom", children: [
1799
1803
  /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-price", children: [
1800
- formatPrice2(product.priceCents, currency),
1804
+ pricePrefix,
1805
+ formatPrice2(lowestPrice, currency),
1801
1806
  /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-price-unit", children: [
1802
1807
  "/",
1803
1808
  priceLabel
1804
1809
  ] })
1805
1810
  ] }),
1806
1811
  /* @__PURE__ */ jsxs("div", { className: "resira-service-overlay-card-pills", children: [
1807
- product.durationMinutes > 0 && /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-pill", children: [
1812
+ hasMultipleOptions && optionCount > 1 ? /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-pill", children: [
1813
+ /* @__PURE__ */ jsx(ClockIcon, { size: 11 }),
1814
+ optionCount,
1815
+ " options"
1816
+ ] }) : product.durationMinutes > 0 ? /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-pill", children: [
1808
1817
  /* @__PURE__ */ jsx(ClockIcon, { size: 11 }),
1809
1818
  formatDuration2(product.durationMinutes)
1810
- ] }),
1819
+ ] }) : null,
1811
1820
  product.maxPartySize && /* @__PURE__ */ jsxs("span", { className: "resira-service-overlay-card-pill", children: [
1812
1821
  /* @__PURE__ */ jsx(UsersIcon, { size: 11 }),
1813
1822
  "max ",
@@ -3024,8 +3033,14 @@ function ResiraBookingWidget() {
3024
3033
  partySize: clampedPartySize
3025
3034
  };
3026
3035
  });
3036
+ if (step === "resource" && isServiceBased) {
3037
+ const nextIdx = stepIndex("resource", STEPS) + 1;
3038
+ if (nextIdx < STEPS.length) {
3039
+ setStep(STEPS[nextIdx]);
3040
+ }
3041
+ }
3027
3042
  },
3028
- [setActiveResourceId, domainConfig.maxPartySize]
3043
+ [setActiveResourceId, domainConfig.maxPartySize, step, isServiceBased, STEPS]
3029
3044
  );
3030
3045
  const handleResourceSelect = useCallback(
3031
3046
  (resourceId) => {