@tbox.cn/app-module-promotion 0.10.1 → 0.10.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.
@@ -1,5 +1,5 @@
1
1
  // src/client/index.ts
2
- import "./promotion-6L7HLRC2.css";
2
+ import "./promotion-ESTNS7IL.css";
3
3
 
4
4
  // src/client/cards/promotion-offer-list/index.tsx
5
5
  import { CalendarBlank, CalendarDots, CaretDown, Lightbulb, MapPin, Sparkle, Ticket } from "@phosphor-icons/react";
@@ -91,7 +91,7 @@ function sanitizeActivityHtml(html) {
91
91
  // src/client/components/CouponSheet.tsx
92
92
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
93
93
  function CouponSheet(props) {
94
- const { title, imageUrl, subtitle, noticeText, guaranteeText, priceMain, priceOriginal, aside, facts = [], beforeFacts, extra, foot, onClose } = props;
94
+ const { title, imageUrl, imageFit = "contain", subtitle, noticeText, guaranteeText, priceMain, priceOriginal, aside, facts = [], beforeFacts, extra, foot, onClose } = props;
95
95
  const [closing, setClosing] = useState2(false);
96
96
  const closingRef = useRef(false);
97
97
  const closeTimerRef = useRef();
@@ -136,7 +136,7 @@ function CouponSheet(props) {
136
136
  children: /* @__PURE__ */ jsxs("div", { className: "promotion-sheet__panel", children: [
137
137
  /* @__PURE__ */ jsx2("button", { type: "button", className: "promotion-sheet__close", "aria-label": "\u5173\u95ED\u8BE6\u60C5", onClick: requestClose, children: /* @__PURE__ */ jsx2(X, { size: 18, weight: "bold", "aria-hidden": "true" }) }),
138
138
  /* @__PURE__ */ jsxs("div", { className: "promotion-sheet__scroll", children: [
139
- /* @__PURE__ */ jsx2(ImageWithFallback, { src: imageUrl, alt: title, className: "promotion-sheet__image" }),
139
+ /* @__PURE__ */ jsx2(ImageWithFallback, { src: imageUrl, alt: title, className: `promotion-sheet__image${imageFit === "cover" ? " promotion-sheet__image--cover" : ""}` }),
140
140
  (priceMain || aside) && /* @__PURE__ */ jsxs("div", { className: "promotion-sheet__price", children: [
141
141
  priceMain && /* @__PURE__ */ jsx2("b", { children: priceMain }),
142
142
  priceMain && priceOriginal && /* @__PURE__ */ jsx2("s", { children: priceOriginal }),
@@ -243,6 +243,7 @@ var couponSubtitleIsTime = (subtitle) => {
243
243
  const plainText = subtitle.replace(/<[^>]+>/g, " ").replace(/&nbsp;/gi, " ");
244
244
  return /\d{4}\s*[-/.年]\s*\d{1,2}\s*[-/.月]\s*\d{1,2}|\d{1,2}:\d{2}/.test(plainText);
245
245
  };
246
+ var sheetImageFit = (offer) => offer.offerRef === "demo:coupon:1001" || offer.offerRef === "demo:groupon:2001" ? "cover" : "contain";
246
247
  function PromotionOfferListCard(props) {
247
248
  const { data, cardId = "", isHistory = false, actionTokens } = props;
248
249
  const [openRef, setOpenRef] = useState3(null);
@@ -443,6 +444,7 @@ function PromotionOfferListCard(props) {
443
444
  {
444
445
  title: target.title,
445
446
  imageUrl: target.imageUrl,
447
+ imageFit: sheetImageFit(target),
446
448
  noticeText: target.usageNoticeText,
447
449
  guaranteeText: target.guaranteeText,
448
450
  subtitle: redirectOnly ? [target.subtitle, target.purchaseUrl ? `\u8BE5\u4F18\u60E0\u9700\u524D\u5F80\u5C0F\u7A0B\u5E8F\u5B8C\u6210${purchaseOnly ? "\u8D2D\u4E70" : "\u9886\u53D6"}` : `\u8BE5\u4F18\u60E0\u7684${purchaseOnly ? "\u62A2\u8D2D" : "\u9886\u53D6"}\u94FE\u63A5\u6682\u4E0D\u53EF\u7528`].filter(Boolean).join(" \xB7 ") : target.subtitle,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  cards,
3
3
  clientModule
4
- } from "../chunk-DP2XDOBN.js";
4
+ } from "../chunk-HZIEXNVQ.js";
5
5
  export {
6
6
  clientModule,
7
7
  cards as promotionClientCards
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  cards,
13
13
  clientModule
14
- } from "./chunk-DP2XDOBN.js";
14
+ } from "./chunk-HZIEXNVQ.js";
15
15
  export {
16
16
  InMemoryPromotionService,
17
17
  clientModule,
@@ -1969,6 +1969,10 @@
1969
1969
  object-fit: contain;
1970
1970
  background: #f5f6f8;
1971
1971
  }
1972
+ .promotion-sheet__image--cover {
1973
+ display: block;
1974
+ object-fit: cover;
1975
+ }
1972
1976
  .promotion-sheet__price {
1973
1977
  display: flex;
1974
1978
  align-items: baseline;