kupos-ui-components-lib 9.8.9 → 9.9.0
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/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +6 -22
- package/dist/components/ServiceItem/types.d.ts +0 -7
- package/dist/styles.css +0 -3
- package/dist/ui/OfferBanner.js +1 -1
- package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
- package/dist/ui/SeatSection/SeatSection.js +11 -41
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +4 -45
- package/src/components/ServiceItem/types.ts +0 -12
- package/src/ui/OfferBanner.tsx +1 -1
- package/src/ui/SeatSection/SeatSection.tsx +20 -85
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ServiceItemProps } from "./types";
|
|
3
|
-
declare 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, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, showLoginModal, isLoggedIn, showLoginOption,
|
|
3
|
+
declare 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, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, showLoginModal, isLoggedIn, showLoginOption, isFlores, operatorLabel, }: ServiceItemProps & {
|
|
4
4
|
currencySign?: string;
|
|
5
5
|
}): React.ReactElement;
|
|
6
6
|
export default ServiceItemPB;
|
|
@@ -74,12 +74,8 @@ const ANIMATION_MAP = {
|
|
|
74
74
|
kupos: femaleAnimation,
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
|
-
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, showLoginModal, isLoggedIn, showLoginOption,
|
|
77
|
+
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, showLoginModal, isLoggedIn, showLoginOption, isFlores, operatorLabel, }) {
|
|
78
78
|
var _a;
|
|
79
|
-
const handleSeatSelect = (key, price, seatKey, apiSeatType) => {
|
|
80
|
-
onClearSeatSelectionError === null || onClearSeatSelectionError === void 0 ? void 0 : onClearSeatSelectionError();
|
|
81
|
-
onSeatSelect === null || onSeatSelect === void 0 ? void 0 : onSeatSelect(key, price, seatKey, apiSeatType);
|
|
82
|
-
};
|
|
83
79
|
const getAnimationIcon = (icon) => {
|
|
84
80
|
var _a;
|
|
85
81
|
const animation = ANIMATION_MAP[icon];
|
|
@@ -217,16 +213,6 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
217
213
|
});
|
|
218
214
|
return;
|
|
219
215
|
}
|
|
220
|
-
if (isTrain) {
|
|
221
|
-
if (!selectedSeatKey) {
|
|
222
|
-
onShowSeatSelectionError === null || onShowSeatSelectionError === void 0 ? void 0 : onShowSeatSelectionError(serviceItem.id);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (onTrainButtonClick) {
|
|
226
|
-
onTrainButtonClick();
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
216
|
onBookButtonPress();
|
|
231
217
|
};
|
|
232
218
|
const items = [
|
|
@@ -289,13 +275,9 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
289
275
|
backgroundColor: "#ccc",
|
|
290
276
|
} }),
|
|
291
277
|
React.createElement("div", { className: "content-center" },
|
|
292
|
-
React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, serviceItem: serviceItem, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, dpSeatColor: colors.seatPriceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru, renderIcon: renderIcon, discountSeatPriceColor: colors.discountSeatPriceColor
|
|
278
|
+
React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, serviceItem: serviceItem, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, dpSeatColor: colors.seatPriceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru, renderIcon: renderIcon, discountSeatPriceColor: colors.discountSeatPriceColor })),
|
|
293
279
|
React.createElement("div", { className: "relative" },
|
|
294
280
|
React.createElement(KuposButton, { isSoldOut: isSoldOut, isLoading: serviceDetailsLoading, buttonColor: colors.kuposButtonColor, buyLabel: translation === null || translation === void 0 ? void 0 : translation.buyButton, soldOutLabel: translation === null || translation === void 0 ? void 0 : translation.soldOutButton, soldOutIcon: renderIcon("soldOutIcon", "14px"), onClick: checkMidnight }),
|
|
295
|
-
showSeatSelectionError === serviceItem.id && isTrain && (React.createElement("div", { className: "flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]" },
|
|
296
|
-
React.createElement("div", { className: "text-[9px] text-center whitespace-nowrap", style: {
|
|
297
|
-
color: colors.seatPriceColor,
|
|
298
|
-
} }, "Selecciona el tipo de servicio"))),
|
|
299
281
|
showLastSeats ? (React.createElement("div", { className: "flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]" }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
|
|
300
282
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0 && (React.createElement("div", { className: "text-[12px] mt-1 text-center", style: {
|
|
301
283
|
color: colors.seatPriceColor,
|
|
@@ -308,9 +290,11 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
308
290
|
transition: "grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
309
291
|
position: "relative",
|
|
310
292
|
zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
|
|
311
|
-
marginTop: isItemExpanded ? "" : "-6px",
|
|
293
|
+
// marginTop: isItemExpanded ? "" : "-6px",
|
|
312
294
|
} },
|
|
313
|
-
React.createElement("div", { style: Object.assign({ overflow: "hidden", minHeight: 0, marginTop: hasDpEnabled || (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text)
|
|
295
|
+
React.createElement("div", { style: Object.assign({ overflow: "hidden", minHeight: 0, marginTop: isItemExpanded && !(hasDpEnabled || (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text))
|
|
296
|
+
? "-10px"
|
|
297
|
+
: "" }, (hasOfferText || hasDpEnabled
|
|
314
298
|
? {
|
|
315
299
|
borderLeft: isSoldOut ? "" : "3px solid #ff5964",
|
|
316
300
|
borderRight: isSoldOut ? "" : "3px solid #ff8842",
|
|
@@ -224,13 +224,6 @@ export interface ServiceItemProps {
|
|
|
224
224
|
showLoginModal?: any;
|
|
225
225
|
isLoggedIn?: any;
|
|
226
226
|
showLoginOption?: boolean;
|
|
227
|
-
isTrain?: boolean;
|
|
228
|
-
selectedSeatKey?: any;
|
|
229
|
-
onSeatSelect?: (key: any, price: number, seatKey: string, apiSeatType?: string) => void;
|
|
230
|
-
onTrainButtonClick?: any;
|
|
231
|
-
showSeatSelectionError?: string | null;
|
|
232
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
233
|
-
onClearSeatSelectionError?: () => void;
|
|
234
227
|
isFlores?: boolean;
|
|
235
228
|
operatorLabel?: string;
|
|
236
229
|
}
|
package/dist/styles.css
CHANGED
package/dist/ui/OfferBanner.js
CHANGED
|
@@ -29,7 +29,7 @@ const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, renderIcon, isLogg
|
|
|
29
29
|
" ",
|
|
30
30
|
"\u00A0"),
|
|
31
31
|
" ",
|
|
32
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) ? "|" : "",
|
|
32
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) ? "| " : "",
|
|
33
33
|
"Termina en\u00A0",
|
|
34
34
|
React.createElement("span", { className: "bold-text text-end", ref: (node) => CommonService.startCountdown(node, 599), style: {
|
|
35
35
|
fontVariantNumeric: "tabular-nums",
|
|
@@ -3,8 +3,6 @@ interface SeatType {
|
|
|
3
3
|
label: string;
|
|
4
4
|
fare: number;
|
|
5
5
|
key: any;
|
|
6
|
-
apiSeatType?: string;
|
|
7
|
-
api_seat_type?: string;
|
|
8
6
|
}
|
|
9
7
|
interface SeatSectionProps {
|
|
10
8
|
seatTypes: SeatType[];
|
|
@@ -18,10 +16,6 @@ interface SeatSectionProps {
|
|
|
18
16
|
serviceItem?: any;
|
|
19
17
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
20
18
|
discountSeatPriceColor?: string;
|
|
21
|
-
isTrain?: boolean;
|
|
22
|
-
selectedSeatKey?: any;
|
|
23
|
-
onSeatSelect?: (key: any, price: number, seatKey: string, apiSeatType?: string) => void;
|
|
24
|
-
topLabelColor?: string;
|
|
25
19
|
}
|
|
26
|
-
declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats,
|
|
20
|
+
declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, }: SeatSectionProps): React.ReactElement;
|
|
27
21
|
export default SeatSection;
|
|
@@ -8,13 +8,11 @@ function getAllSeatTypes(seatTypes) {
|
|
|
8
8
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
9
9
|
label: val === null || val === void 0 ? void 0 : val.label,
|
|
10
10
|
price: val === null || val === void 0 ? void 0 : val.fare,
|
|
11
|
-
key: val === null || val === void 0 ? void 0 : val.key,
|
|
12
|
-
apiSeatType: (val === null || val === void 0 ? void 0 : val.apiSeatType) || (val === null || val === void 0 ? void 0 : val.api_seat_type),
|
|
13
11
|
}));
|
|
14
12
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
15
13
|
return seatTypesWithPrices;
|
|
16
14
|
}
|
|
17
|
-
function getSortedSeatTypes(seatTypes
|
|
15
|
+
function getSortedSeatTypes(seatTypes) {
|
|
18
16
|
if (!(seatTypes === null || seatTypes === void 0 ? void 0 : seatTypes.length)) {
|
|
19
17
|
return [{ label: "Salon cama", price: 0 }];
|
|
20
18
|
}
|
|
@@ -23,12 +21,7 @@ function getSortedSeatTypes(seatTypes, isTrain) {
|
|
|
23
21
|
if (premiumIndex >= 3) {
|
|
24
22
|
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 4);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
31
|
-
}
|
|
24
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
32
25
|
const seenPrices = new Set();
|
|
33
26
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
34
27
|
if (seenPrices.has(seat.price))
|
|
@@ -61,10 +54,10 @@ function getUniqueSeats(seatTypes) {
|
|
|
61
54
|
function getNumberOfSeats(seatTypes) {
|
|
62
55
|
return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
|
|
63
56
|
}
|
|
64
|
-
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats,
|
|
57
|
+
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, }) {
|
|
65
58
|
var _a;
|
|
66
59
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
67
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes
|
|
60
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
68
61
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
69
62
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
70
63
|
const formatPrice = (price) => availableSeats <= 0
|
|
@@ -72,34 +65,11 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
72
65
|
: CommonService.currency(price, currencySign);
|
|
73
66
|
const renderSeatNames = () => {
|
|
74
67
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
75
|
-
return seats.map((val, key) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
: undefined },
|
|
81
|
-
isTrain && (React.createElement("div", { style: {
|
|
82
|
-
border: `1px solid ${val.label === selectedSeatKey ? topLabelColor : "#ccc"}`,
|
|
83
|
-
borderRadius: "50%",
|
|
84
|
-
width: "14px",
|
|
85
|
-
height: "14px",
|
|
86
|
-
minWidth: "14px",
|
|
87
|
-
marginRight: "10px",
|
|
88
|
-
display: "flex",
|
|
89
|
-
alignItems: "center",
|
|
90
|
-
justifyContent: "center",
|
|
91
|
-
} }, val.label === selectedSeatKey && (React.createElement("div", { style: {
|
|
92
|
-
backgroundColor: topLabelColor,
|
|
93
|
-
borderRadius: "50%",
|
|
94
|
-
width: "7px",
|
|
95
|
-
height: "7px",
|
|
96
|
-
} })))),
|
|
97
|
-
React.createElement("span", { key: key, className: `flex items-center justify-between text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""}` }, typeof val.label === "string" || typeof val.label === "number"
|
|
98
|
-
? removeDuplicateSeats && isPeru
|
|
99
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
100
|
-
: val.label
|
|
101
|
-
: null)));
|
|
102
|
-
});
|
|
68
|
+
return seats.map((val, key) => SEAT_EXCEPTIONS.includes(val.label) ? null : (React.createElement("span", { key: key, className: `flex items-center justify-between text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""}` }, typeof val.label === "string" || typeof val.label === "number"
|
|
69
|
+
? removeDuplicateSeats && isPeru
|
|
70
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
71
|
+
: val.label
|
|
72
|
+
: null)));
|
|
103
73
|
};
|
|
104
74
|
const renderSeatPrices = () => {
|
|
105
75
|
if (isPeru) {
|
|
@@ -198,7 +168,7 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
198
168
|
} }))),
|
|
199
169
|
React.createElement("div", { className: "col-start-2 row-start-3 flex h-[30px] items-end justify-center relative" },
|
|
200
170
|
React.createElement("span", { className: "flex items-center gap-[6px] text-[22px] bold-text leading-[30px]", style: { color: isSoldOut ? "#c0c0c0" : "#ff5964" } },
|
|
201
|
-
React.createElement("div", { className: "absolute", style: { left: isPeru ? "-
|
|
171
|
+
React.createElement("div", { className: "absolute", style: { left: isPeru ? "-19px" : "-19px", bottom: "1px" } }, renderIcon("fireIcon", "16px")),
|
|
202
172
|
availableSeats <= 0
|
|
203
173
|
? CommonService.currency(0, currencySign)
|
|
204
174
|
: CommonService.discountedCurrency(Number(seatTypeFare), currencySign)))));
|
|
@@ -269,7 +239,7 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
269
239
|
React.createElement("div", { className: "col-start-2 row-start-3 flex h-[30px] items-end justify-center relative" },
|
|
270
240
|
React.createElement("span", { className: "flex items-center gap-[6px] text-[22px] bold-text leading-[30px]", style: { color: isSoldOut ? "#c0c0c0" : discountSeatPriceColor } },
|
|
271
241
|
React.createElement("div", { className: "absolute", style: {
|
|
272
|
-
left: isPeru ? "-
|
|
242
|
+
left: isPeru ? "-18px" : "-18px",
|
|
273
243
|
bottom: "1px",
|
|
274
244
|
} }, renderIcon("fireIcon", "16px")),
|
|
275
245
|
availableSeats <= 0
|
package/package.json
CHANGED
|
@@ -116,25 +116,9 @@ function ServiceItemPB({
|
|
|
116
116
|
showLoginModal,
|
|
117
117
|
isLoggedIn,
|
|
118
118
|
showLoginOption,
|
|
119
|
-
isTrain,
|
|
120
|
-
selectedSeatKey,
|
|
121
|
-
onSeatSelect,
|
|
122
|
-
onTrainButtonClick,
|
|
123
|
-
showSeatSelectionError,
|
|
124
|
-
onShowSeatSelectionError,
|
|
125
|
-
onClearSeatSelectionError,
|
|
126
119
|
isFlores,
|
|
127
120
|
operatorLabel,
|
|
128
121
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
129
|
-
const handleSeatSelect = (
|
|
130
|
-
key: any,
|
|
131
|
-
price: number,
|
|
132
|
-
seatKey: string,
|
|
133
|
-
apiSeatType?: string,
|
|
134
|
-
) => {
|
|
135
|
-
onClearSeatSelectionError?.();
|
|
136
|
-
onSeatSelect?.(key, price, seatKey, apiSeatType);
|
|
137
|
-
};
|
|
138
122
|
const getAnimationIcon = (icon: string) => {
|
|
139
123
|
const animation = ANIMATION_MAP[icon];
|
|
140
124
|
if (!animation) return null;
|
|
@@ -331,17 +315,6 @@ function ServiceItemPB({
|
|
|
331
315
|
return;
|
|
332
316
|
}
|
|
333
317
|
|
|
334
|
-
if (isTrain) {
|
|
335
|
-
if (!selectedSeatKey) {
|
|
336
|
-
onShowSeatSelectionError?.(serviceItem.id);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (onTrainButtonClick) {
|
|
340
|
-
onTrainButtonClick();
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
318
|
onBookButtonPress();
|
|
346
319
|
};
|
|
347
320
|
|
|
@@ -555,10 +528,6 @@ function ServiceItemPB({
|
|
|
555
528
|
isPeru={isPeru}
|
|
556
529
|
renderIcon={renderIcon}
|
|
557
530
|
discountSeatPriceColor={colors.discountSeatPriceColor}
|
|
558
|
-
isTrain={isTrain}
|
|
559
|
-
selectedSeatKey={selectedSeatKey}
|
|
560
|
-
onSeatSelect={handleSeatSelect}
|
|
561
|
-
topLabelColor={colors.topLabelColor}
|
|
562
531
|
/>
|
|
563
532
|
</div>
|
|
564
533
|
|
|
@@ -574,18 +543,6 @@ function ServiceItemPB({
|
|
|
574
543
|
soldOutIcon={renderIcon("soldOutIcon", "14px")}
|
|
575
544
|
onClick={checkMidnight}
|
|
576
545
|
/>
|
|
577
|
-
{showSeatSelectionError === serviceItem.id && isTrain && (
|
|
578
|
-
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
579
|
-
<div
|
|
580
|
-
className="text-[9px] text-center whitespace-nowrap"
|
|
581
|
-
style={{
|
|
582
|
-
color: colors.seatPriceColor,
|
|
583
|
-
}}
|
|
584
|
-
>
|
|
585
|
-
Selecciona el tipo de servicio
|
|
586
|
-
</div>
|
|
587
|
-
</div>
|
|
588
|
-
)}
|
|
589
546
|
{showLastSeats ? (
|
|
590
547
|
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
591
548
|
{serviceItem?.available_seats < 10 &&
|
|
@@ -632,7 +589,7 @@ function ServiceItemPB({
|
|
|
632
589
|
"grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
633
590
|
position: "relative",
|
|
634
591
|
zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
|
|
635
|
-
marginTop: isItemExpanded ? "" : "-6px",
|
|
592
|
+
// marginTop: isItemExpanded ? "" : "-6px",
|
|
636
593
|
}}
|
|
637
594
|
>
|
|
638
595
|
<div
|
|
@@ -640,7 +597,9 @@ function ServiceItemPB({
|
|
|
640
597
|
overflow: "hidden",
|
|
641
598
|
minHeight: 0,
|
|
642
599
|
marginTop:
|
|
643
|
-
hasDpEnabled || serviceItem?.offer_text
|
|
600
|
+
isItemExpanded && !(hasDpEnabled || serviceItem?.offer_text)
|
|
601
|
+
? "-10px"
|
|
602
|
+
: "",
|
|
644
603
|
...(hasOfferText || hasDpEnabled
|
|
645
604
|
? {
|
|
646
605
|
borderLeft: isSoldOut ? "" : "3px solid #ff5964",
|
|
@@ -226,18 +226,6 @@ export interface ServiceItemProps {
|
|
|
226
226
|
showLoginModal?: any;
|
|
227
227
|
isLoggedIn?: any;
|
|
228
228
|
showLoginOption?: boolean;
|
|
229
|
-
isTrain?: boolean;
|
|
230
|
-
selectedSeatKey?: any;
|
|
231
|
-
onSeatSelect?: (
|
|
232
|
-
key: any,
|
|
233
|
-
price: number,
|
|
234
|
-
seatKey: string,
|
|
235
|
-
apiSeatType?: string,
|
|
236
|
-
) => void;
|
|
237
|
-
onTrainButtonClick?: any;
|
|
238
|
-
showSeatSelectionError?: string | null;
|
|
239
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
240
|
-
onClearSeatSelectionError?: () => void;
|
|
241
229
|
isFlores?: boolean;
|
|
242
230
|
operatorLabel?: string;
|
|
243
231
|
}
|
package/src/ui/OfferBanner.tsx
CHANGED
|
@@ -7,8 +7,6 @@ interface SeatType {
|
|
|
7
7
|
label: string;
|
|
8
8
|
fare: number;
|
|
9
9
|
key: any;
|
|
10
|
-
apiSeatType?: string;
|
|
11
|
-
api_seat_type?: string;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
interface SeatSectionProps {
|
|
@@ -23,15 +21,6 @@ interface SeatSectionProps {
|
|
|
23
21
|
serviceItem?: any;
|
|
24
22
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
25
23
|
discountSeatPriceColor?: string;
|
|
26
|
-
isTrain?: boolean;
|
|
27
|
-
selectedSeatKey?: any;
|
|
28
|
-
onSeatSelect?: (
|
|
29
|
-
key: any,
|
|
30
|
-
price: number,
|
|
31
|
-
seatKey: string,
|
|
32
|
-
apiSeatType?: string,
|
|
33
|
-
) => void;
|
|
34
|
-
topLabelColor?: string;
|
|
35
24
|
}
|
|
36
25
|
|
|
37
26
|
function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
@@ -42,8 +31,6 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
42
31
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
43
32
|
label: val?.label,
|
|
44
33
|
price: val?.fare,
|
|
45
|
-
key: val?.key,
|
|
46
|
-
apiSeatType: val?.apiSeatType || val?.api_seat_type,
|
|
47
34
|
}));
|
|
48
35
|
|
|
49
36
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
@@ -51,7 +38,7 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
51
38
|
return seatTypesWithPrices;
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
function getSortedSeatTypes(seatTypes: SeatType[]
|
|
41
|
+
function getSortedSeatTypes(seatTypes: SeatType[]) {
|
|
55
42
|
if (!seatTypes?.length) {
|
|
56
43
|
return [{ label: "Salon cama", price: 0 }];
|
|
57
44
|
}
|
|
@@ -65,11 +52,7 @@ function getSortedSeatTypes(seatTypes: SeatType[], isTrain: any) {
|
|
|
65
52
|
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
66
53
|
}
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 4);
|
|
70
|
-
} else {
|
|
71
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
72
|
-
}
|
|
55
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
73
56
|
|
|
74
57
|
const seenPrices = new Set<number>();
|
|
75
58
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
@@ -114,18 +97,14 @@ function SeatSection({
|
|
|
114
97
|
priceColor,
|
|
115
98
|
currencySign,
|
|
116
99
|
removeDuplicateSeats,
|
|
117
|
-
selectedSeatKey,
|
|
118
|
-
onSeatSelect,
|
|
119
100
|
isPeru,
|
|
120
101
|
serviceItem,
|
|
121
102
|
renderIcon,
|
|
122
103
|
dpSeatColor,
|
|
123
104
|
discountSeatPriceColor,
|
|
124
|
-
isTrain,
|
|
125
|
-
topLabelColor,
|
|
126
105
|
}: SeatSectionProps): React.ReactElement {
|
|
127
106
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
128
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes
|
|
107
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
129
108
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
130
109
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
131
110
|
|
|
@@ -137,66 +116,22 @@ function SeatSection({
|
|
|
137
116
|
const renderSeatNames = () => {
|
|
138
117
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
139
118
|
|
|
140
|
-
return seats.map((val, key: number) =>
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
? () =>
|
|
148
|
-
val.label === selectedSeatKey
|
|
149
|
-
? onSeatSelect?.(null, 0, "", "")
|
|
150
|
-
: onSeatSelect?.(
|
|
151
|
-
val.label,
|
|
152
|
-
val.price,
|
|
153
|
-
val.key,
|
|
154
|
-
(val as any).apiSeatType,
|
|
155
|
-
)
|
|
156
|
-
: undefined
|
|
157
|
-
}
|
|
119
|
+
return seats.map((val, key: number) =>
|
|
120
|
+
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
121
|
+
<span
|
|
122
|
+
key={key}
|
|
123
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
124
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
125
|
+
}`}
|
|
158
126
|
>
|
|
159
|
-
{
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
marginRight: "10px",
|
|
168
|
-
display: "flex",
|
|
169
|
-
alignItems: "center",
|
|
170
|
-
justifyContent: "center",
|
|
171
|
-
}}
|
|
172
|
-
>
|
|
173
|
-
{val.label === selectedSeatKey && (
|
|
174
|
-
<div
|
|
175
|
-
style={{
|
|
176
|
-
backgroundColor: topLabelColor,
|
|
177
|
-
borderRadius: "50%",
|
|
178
|
-
width: "7px",
|
|
179
|
-
height: "7px",
|
|
180
|
-
}}
|
|
181
|
-
/>
|
|
182
|
-
)}
|
|
183
|
-
</div>
|
|
184
|
-
)}
|
|
185
|
-
<span
|
|
186
|
-
key={key}
|
|
187
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
188
|
-
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
189
|
-
}`}
|
|
190
|
-
>
|
|
191
|
-
{typeof val.label === "string" || typeof val.label === "number"
|
|
192
|
-
? removeDuplicateSeats && isPeru
|
|
193
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
194
|
-
: val.label
|
|
195
|
-
: null}
|
|
196
|
-
</span>
|
|
197
|
-
</div>
|
|
198
|
-
);
|
|
199
|
-
});
|
|
127
|
+
{typeof val.label === "string" || typeof val.label === "number"
|
|
128
|
+
? removeDuplicateSeats && isPeru
|
|
129
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
130
|
+
: val.label
|
|
131
|
+
: null}
|
|
132
|
+
</span>
|
|
133
|
+
),
|
|
134
|
+
);
|
|
200
135
|
};
|
|
201
136
|
|
|
202
137
|
const renderSeatPrices = () => {
|
|
@@ -384,7 +319,7 @@ function SeatSection({
|
|
|
384
319
|
>
|
|
385
320
|
<div
|
|
386
321
|
className="absolute"
|
|
387
|
-
style={{ left: isPeru ? "-
|
|
322
|
+
style={{ left: isPeru ? "-19px" : "-19px", bottom: "1px" }}
|
|
388
323
|
>
|
|
389
324
|
{renderIcon("fireIcon", "16px")}
|
|
390
325
|
</div>
|
|
@@ -541,7 +476,7 @@ function SeatSection({
|
|
|
541
476
|
<div
|
|
542
477
|
className="absolute"
|
|
543
478
|
style={{
|
|
544
|
-
left: isPeru ? "-
|
|
479
|
+
left: isPeru ? "-18px" : "-18px",
|
|
545
480
|
bottom: "1px",
|
|
546
481
|
}}
|
|
547
482
|
>
|