@tbox.cn/app-module-promotion 0.10.2 → 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.
- package/dist/{chunk-DP2XDOBN.js → chunk-HZIEXNVQ.js} +5 -3
- package/dist/client/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{promotion-6L7HLRC2.css → promotion-ESTNS7IL.css} +4 -0
- package/dist/server/index.d.ts +589 -589
- package/package.json +1 -1
- package/src/client/cards/promotion-offer-list/index.tsx +4 -0
- package/src/client/components/CouponSheet.tsx +4 -2
- package/src/client/styles/promotion.css +4 -0
- package/tests/cards-render.test.tsx +32 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/client/index.ts
|
|
2
|
-
import "./promotion-
|
|
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(/ /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,
|
package/dist/client/index.js
CHANGED
package/dist/index.js
CHANGED