kupos-ui-components-lib 9.3.3 → 9.3.5
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.
|
@@ -67,6 +67,8 @@ const ANIMATION_MAP = {
|
|
|
67
67
|
},
|
|
68
68
|
};
|
|
69
69
|
function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, isCiva, showRating, showLastSeats, removeArrivalTime, removeDuplicateSeats, isPeruSites, showAvailableSeats, isSeatIcon, isLinatal, isPeru, t = (key) => key, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, }) {
|
|
70
|
+
var _a;
|
|
71
|
+
console.log("🚀 ~ ServiceItemPB ~ serviceItem:", serviceItem);
|
|
70
72
|
const getAnimationIcon = (icon) => {
|
|
71
73
|
var _a;
|
|
72
74
|
const animation = ANIMATION_MAP[icon];
|
|
@@ -101,6 +103,11 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
101
103
|
const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
|
|
102
104
|
const grayscaleClass = isSoldOut ? "grayscale" : "";
|
|
103
105
|
const hasOfferText = Boolean(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text);
|
|
106
|
+
const seats = removeDuplicateSeats
|
|
107
|
+
? ((_a = serviceItem.seat_types) === null || _a === void 0 ? void 0 : _a.filter((seat, index, self) => index === self.findIndex((s) => s.label === seat.label))) || []
|
|
108
|
+
: serviceItem.seat_types || [];
|
|
109
|
+
const discountedSeats = seats.map((seat) => (Object.assign(Object.assign({}, seat), CommonService.calculateDiscountedPrice(seat.fare, serviceItem))));
|
|
110
|
+
const hasDiscount = discountedSeats.some((seat) => seat.originalPrice !== seat.discountedPrice);
|
|
104
111
|
const offerGradient = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"} 0%, ${colors.leftGradiantColor || "#ff8842"} 100%)`;
|
|
105
112
|
const serviceCardStyle = hasOfferText
|
|
106
113
|
? {
|
|
@@ -236,7 +243,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
236
243
|
padding: coachKey
|
|
237
244
|
? "15px 15px 20px 15px"
|
|
238
245
|
: "20px 15px 11px 15px",
|
|
239
|
-
marginTop: hasOfferText ? "14px" : "0",
|
|
246
|
+
marginTop: hasDiscount || hasOfferText ? "14px" : "0",
|
|
240
247
|
} },
|
|
241
248
|
React.createElement("div", { className: "grid text-[#464647] w-full [grid-template-columns:22%_28%_2.5%_24%_15.5%] gap-x-[2%] items-center" },
|
|
242
249
|
React.createElement("div", { className: "flex flex-col gap-[5px]" },
|
|
@@ -145,7 +145,8 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
145
145
|
React.createElement("div", { className: "col-start-2 row-start-3 flex h-[30px] items-end justify-start" },
|
|
146
146
|
React.createElement("span", { className: "flex items-center gap-[6px] text-[22px] bold-text leading-[30px]", style: { color: isSoldOut ? "#c0c0c0" : "#ff5964" } },
|
|
147
147
|
renderIcon("fireIcon", "16px"),
|
|
148
|
-
|
|
148
|
+
currencySign || "$",
|
|
149
|
+
Math.floor((discountSeat.discountedPrice / 1000) * 1000) / 1000))));
|
|
149
150
|
}
|
|
150
151
|
return (React.createElement("div", { className: "relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.2rem]", style: isCentered ? { alignItems: "center" } : {} },
|
|
151
152
|
React.createElement("div", { className: "flex flex-col justify-between", style: { gap: "10px" } }, renderLabels()),
|
package/package.json
CHANGED
|
@@ -106,6 +106,7 @@ function ServiceItemPB({
|
|
|
106
106
|
coachKey,
|
|
107
107
|
viewersConfig,
|
|
108
108
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
109
|
+
console.log("🚀 ~ ServiceItemPB ~ serviceItem:", serviceItem);
|
|
109
110
|
const getAnimationIcon = (icon: string) => {
|
|
110
111
|
const animation = ANIMATION_MAP[icon];
|
|
111
112
|
if (!animation) return null;
|
|
@@ -167,6 +168,23 @@ function ServiceItemPB({
|
|
|
167
168
|
const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
|
|
168
169
|
const grayscaleClass = isSoldOut ? "grayscale" : "";
|
|
169
170
|
const hasOfferText = Boolean(serviceItem?.offer_text);
|
|
171
|
+
|
|
172
|
+
const seats = removeDuplicateSeats
|
|
173
|
+
? serviceItem.seat_types?.filter(
|
|
174
|
+
(seat, index, self) =>
|
|
175
|
+
index === self.findIndex((s) => s.label === seat.label),
|
|
176
|
+
) || []
|
|
177
|
+
: serviceItem.seat_types || [];
|
|
178
|
+
|
|
179
|
+
const discountedSeats = seats.map((seat) => ({
|
|
180
|
+
...seat,
|
|
181
|
+
...CommonService.calculateDiscountedPrice(seat.fare, serviceItem as any),
|
|
182
|
+
}));
|
|
183
|
+
|
|
184
|
+
const hasDiscount = discountedSeats.some(
|
|
185
|
+
(seat) => seat.originalPrice !== seat.discountedPrice,
|
|
186
|
+
);
|
|
187
|
+
|
|
170
188
|
const offerGradient = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"} 0%, ${colors.leftGradiantColor || "#ff8842"} 100%)`;
|
|
171
189
|
const serviceCardStyle: React.CSSProperties = hasOfferText
|
|
172
190
|
? {
|
|
@@ -403,7 +421,7 @@ function ServiceItemPB({
|
|
|
403
421
|
padding: coachKey
|
|
404
422
|
? "15px 15px 20px 15px"
|
|
405
423
|
: "20px 15px 11px 15px",
|
|
406
|
-
marginTop: hasOfferText ? "14px" : "0",
|
|
424
|
+
marginTop: hasDiscount || hasOfferText ? "14px" : "0",
|
|
407
425
|
}}
|
|
408
426
|
>
|
|
409
427
|
<div
|
|
@@ -284,7 +284,8 @@ function SeatSection({
|
|
|
284
284
|
>
|
|
285
285
|
{/* <span className="text-[18px] leading-[24px]">🔥</span> */}
|
|
286
286
|
{renderIcon("fireIcon", "16px")}
|
|
287
|
-
{
|
|
287
|
+
{currencySign || "$"}
|
|
288
|
+
{Math.floor((discountSeat.discountedPrice / 1000) * 1000) / 1000}
|
|
288
289
|
</span>
|
|
289
290
|
</div>
|
|
290
291
|
</div>
|