kupos-ui-components-lib 9.10.0 → 9.10.1
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 +2 -20
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +2 -2
- package/dist/components/ServiceItem/mobileTypes.d.ts +0 -2
- package/dist/components/ServiceItem/types.d.ts +0 -7
- package/dist/components/Survey/SurveyDesktop.js +17 -16
- package/dist/styles.css +0 -6
- package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
- package/dist/ui/SeatSection/SeatSection.js +9 -38
- package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +1 -2
- package/dist/ui/mobileweb/DateTimeSectionMobile.js +6 -12
- package/dist/ui/mobileweb/SeatSectionMobile.d.ts +1 -2
- package/dist/ui/mobileweb/SeatSectionMobile.js +14 -21
- package/dist/ui/mobileweb/ServiceBadgesMobile.js +2 -2
- package/dist/utils/CommonService.d.ts +1 -1
- package/dist/utils/CommonService.js +1 -5
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +0 -43
- package/src/components/ServiceItem/ServiceItemMobile.tsx +1 -3
- package/src/components/ServiceItem/mobileTypes.ts +26 -32
- package/src/components/ServiceItem/types.ts +0 -12
- package/src/ui/SeatSection/SeatSection.tsx +18 -86
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +35 -44
- package/src/ui/mobileweb/SeatSectionMobile.tsx +11 -26
- package/src/ui/mobileweb/ServiceBadgesMobile.tsx +2 -2
- package/src/utils/CommonService.ts +1 -7
|
@@ -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, isNewUi, 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, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, }: ServiceItemProps & {
|
|
4
4
|
currencySign?: string;
|
|
5
5
|
}): React.ReactElement;
|
|
6
6
|
export default ServiceItemPB;
|
|
@@ -87,12 +87,8 @@ const ANIMATION_MAP = {
|
|
|
87
87
|
kupos: flameAnimation,
|
|
88
88
|
},
|
|
89
89
|
};
|
|
90
|
-
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, isNewUi, showLoginModal, isLoggedIn, showLoginOption,
|
|
90
|
+
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, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, }) {
|
|
91
91
|
var _a, _b, _c;
|
|
92
|
-
const handleSeatSelect = (key, price, seatKey, apiSeatType) => {
|
|
93
|
-
onClearSeatSelectionError === null || onClearSeatSelectionError === void 0 ? void 0 : onClearSeatSelectionError();
|
|
94
|
-
onSeatSelect === null || onSeatSelect === void 0 ? void 0 : onSeatSelect(key, price, seatKey, apiSeatType);
|
|
95
|
-
};
|
|
96
92
|
const getAnimationIcon = (icon) => {
|
|
97
93
|
var _a;
|
|
98
94
|
const animation = ANIMATION_MAP[icon];
|
|
@@ -231,16 +227,6 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
231
227
|
});
|
|
232
228
|
return;
|
|
233
229
|
}
|
|
234
|
-
if (isTrain) {
|
|
235
|
-
if (!selectedSeatKey) {
|
|
236
|
-
onShowSeatSelectionError === null || onShowSeatSelectionError === void 0 ? void 0 : onShowSeatSelectionError(serviceItem.id);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (onTrainButtonClick) {
|
|
240
|
-
onTrainButtonClick();
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
230
|
onBookButtonPress();
|
|
245
231
|
};
|
|
246
232
|
const items = [
|
|
@@ -307,13 +293,9 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
307
293
|
backgroundColor: "#ccc",
|
|
308
294
|
} }),
|
|
309
295
|
React.createElement("div", { className: "content-center" },
|
|
310
|
-
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
|
|
296
|
+
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 })),
|
|
311
297
|
React.createElement("div", { className: "relative" },
|
|
312
298
|
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 }),
|
|
313
|
-
showSeatSelectionError === serviceItem.id && isTrain && (React.createElement("div", { className: "flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]" },
|
|
314
|
-
React.createElement("div", { className: "text-[9px] text-center whitespace-nowrap", style: {
|
|
315
|
-
color: colors.seatPriceColor,
|
|
316
|
-
} }, "Selecciona el tipo de servicio"))),
|
|
317
299
|
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 &&
|
|
318
300
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0 && (React.createElement("div", { className: "text-[12px] mt-1 text-center", style: {
|
|
319
301
|
color: colors.seatPriceColor,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MobileServiceItemProps } from "./mobileTypes";
|
|
3
|
-
declare function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig,
|
|
3
|
+
declare function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, }: MobileServiceItemProps): React.ReactElement;
|
|
4
4
|
export default ServiceItemMobile;
|
|
@@ -18,7 +18,7 @@ const exceptions = [
|
|
|
18
18
|
"blanco",
|
|
19
19
|
"asiento_mascota",
|
|
20
20
|
];
|
|
21
|
-
function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig,
|
|
21
|
+
function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, }) {
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
23
23
|
const isItemExpanded = serviceItem.id === isExpanded;
|
|
24
24
|
const isPetSeat = (Object.keys(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.pet_seat_info) || []).length > 0;
|
|
@@ -106,7 +106,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
106
106
|
: "rounded-[10px] border border-[#ccc]"}`, style: Object.assign(Object.assign({}, serviceCardStyle), { backgroundColor: "#fff" }) },
|
|
107
107
|
React.createElement("div", { style: {
|
|
108
108
|
padding: "12px 12px 8px 12px",
|
|
109
|
-
marginTop: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && showTopLabel
|
|
109
|
+
marginTop: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && (showTopLabel || isConexion)
|
|
110
110
|
? " 10px"
|
|
111
111
|
: "",
|
|
112
112
|
} },
|
|
@@ -215,8 +215,6 @@ export interface MobileServiceItemProps {
|
|
|
215
215
|
label?: string;
|
|
216
216
|
icon?: string;
|
|
217
217
|
};
|
|
218
|
-
operatorLabel?: string;
|
|
219
|
-
isTrain?: boolean;
|
|
220
218
|
isFeatureDropDownExpand?: any;
|
|
221
219
|
setIsFeatureDropDownExpand?: (value: any) => void;
|
|
222
220
|
ticketQuantity?: number;
|
|
@@ -245,13 +245,6 @@ export interface ServiceItemProps {
|
|
|
245
245
|
showLoginModal?: any;
|
|
246
246
|
isLoggedIn?: any;
|
|
247
247
|
showLoginOption?: boolean;
|
|
248
|
-
isTrain?: boolean;
|
|
249
|
-
selectedSeatKey?: any;
|
|
250
|
-
onSeatSelect?: (key: any, price: number, seatKey: string, apiSeatType?: string) => void;
|
|
251
|
-
onTrainButtonClick?: any;
|
|
252
|
-
showSeatSelectionError?: string | null;
|
|
253
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
254
|
-
onClearSeatSelectionError?: () => void;
|
|
255
248
|
selectedTimeSlot?: string;
|
|
256
249
|
onTimeSlotChange?: (slot: string) => void;
|
|
257
250
|
isTimeDropdownOpen?: string | number | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Modal } from "../../ui/Modal";
|
|
3
|
-
import {
|
|
3
|
+
import { ScoreButtons, FeedbackTextarea, getFeedbackConfig, } from "../../ui/Survey";
|
|
4
4
|
import KuposButton from "../../ui/KuposButton/KuposButton";
|
|
5
5
|
const SurveyDesktop = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feedback = "", onFeedbackChange, onClose, onSkip, onSubmit, colors, icons, isLoading, }) => {
|
|
6
6
|
if (!isOpen)
|
|
@@ -11,20 +11,21 @@ const SurveyDesktop = ({ isOpen, isSubmitted, selectedScore, onScoreChange, feed
|
|
|
11
11
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(selectedScore, feedback);
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, variant: "center", size: "lg", maxWidth: 550, padding: isSubmitted ? 0 : "40px 48px 36px", borderRadius: 28, closeOnBackdrop: false },
|
|
15
|
-
React.createElement(
|
|
16
|
-
React.createElement("
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
React.createElement("div", { className: "
|
|
28
|
-
React.createElement(
|
|
14
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, variant: "center", size: "lg", maxWidth: 550, padding: isSubmitted ? 0 : "40px 48px 36px", borderRadius: 28, closeOnBackdrop: false },
|
|
15
|
+
React.createElement(React.Fragment, null,
|
|
16
|
+
React.createElement("button", { onClick: onClose, "aria-label": "Close survey", className: "absolute top-[15px] right-[25px] bg-transparent border-none cursor-pointer text-[22px] text-gray-400 flex items-center justify-center p-1 z-10 transition-colors duration-200 hover:text-gray-600" },
|
|
17
|
+
React.createElement("img", { src: icons.closeIcon, alt: "Close", className: "w-[16px] h-[16px] block" })),
|
|
18
|
+
(icons === null || icons === void 0 ? void 0 : icons.surveyIcon) && (React.createElement("div", { className: "flex justify-center mb-3 mt-2" },
|
|
19
|
+
React.createElement("img", { src: icons.surveyIcon, alt: "Survey Illustration", className: "w-[90px] h-[90px] block" }))),
|
|
20
|
+
React.createElement("h2", { className: "text-[18px] bold-text leading-[1.25] text-center mt-4 mb-2" }, "Ay\u00FAdanos a mejorar"),
|
|
21
|
+
React.createElement("p", { className: "text-[13.33px] text-center leading-[1.4] mb-6 max-w-[460px] mx-auto" },
|
|
22
|
+
"Bas\u00E1ndote en tu experiencia de compra.",
|
|
23
|
+
React.createElement("br", null),
|
|
24
|
+
"\u00BFNos recomendar\u00EDas a un amigo?"),
|
|
25
|
+
React.createElement(ScoreButtons, { selectedScore: selectedScore, onScoreChange: onScoreChange, buttonHeight: 45, fontSize: 15, colors: colors }),
|
|
26
|
+
React.createElement(FeedbackTextarea, { config: config, feedback: feedback, onFeedbackChange: onFeedbackChange, colors: colors }),
|
|
27
|
+
React.createElement("div", { className: "flex justify-center mt-[20px]" },
|
|
28
|
+
React.createElement("div", { className: "w-[180px]" },
|
|
29
|
+
React.createElement(KuposButton, { isSoldOut: selectedScore == null, isLoading: isLoading || false, buttonColor: "#FF8E43", buyLabel: "Enviar", soldOutLabel: "Enviar", onClick: handleSubmit }))))));
|
|
29
30
|
};
|
|
30
31
|
export default SurveyDesktop;
|
package/dist/styles.css
CHANGED
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
.-top-\[11px\] {
|
|
34
34
|
top: calc(11px * -1);
|
|
35
35
|
}
|
|
36
|
-
.-top-\[12px\] {
|
|
37
|
-
top: calc(12px * -1);
|
|
38
|
-
}
|
|
39
36
|
.-top-\[13px\] {
|
|
40
37
|
top: calc(13px * -1);
|
|
41
38
|
}
|
|
@@ -999,9 +996,6 @@
|
|
|
999
996
|
.text-right {
|
|
1000
997
|
text-align: right;
|
|
1001
998
|
}
|
|
1002
|
-
.text-\[9px\] {
|
|
1003
|
-
font-size: 9px;
|
|
1004
|
-
}
|
|
1005
999
|
.text-\[10px\] {
|
|
1006
1000
|
font-size: 10px;
|
|
1007
1001
|
}
|
|
@@ -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,9 +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, 2);
|
|
28
|
-
}
|
|
24
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
29
25
|
const seenPrices = new Set();
|
|
30
26
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
31
27
|
if (seenPrices.has(seat.price))
|
|
@@ -58,10 +54,10 @@ function getUniqueSeats(seatTypes) {
|
|
|
58
54
|
function getNumberOfSeats(seatTypes) {
|
|
59
55
|
return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
|
|
60
56
|
}
|
|
61
|
-
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats,
|
|
57
|
+
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, }) {
|
|
62
58
|
var _a;
|
|
63
59
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
64
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes
|
|
60
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
65
61
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
66
62
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
67
63
|
const formatPrice = (price) => availableSeats <= 0
|
|
@@ -69,36 +65,11 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
69
65
|
: CommonService.currency(price, currencySign);
|
|
70
66
|
const renderSeatNames = () => {
|
|
71
67
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
72
|
-
return seats.map((val, key) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
: undefined },
|
|
78
|
-
isTrain && (React.createElement("div", { style: {
|
|
79
|
-
border: `1px solid ${val.label === selectedSeatKey ? topLabelColor : "#ccc"}`,
|
|
80
|
-
borderRadius: "50%",
|
|
81
|
-
width: "14px",
|
|
82
|
-
height: "14px",
|
|
83
|
-
minWidth: "14px",
|
|
84
|
-
marginRight: "10px",
|
|
85
|
-
display: "flex",
|
|
86
|
-
alignItems: "center",
|
|
87
|
-
justifyContent: "center",
|
|
88
|
-
} }, val.label === selectedSeatKey && (React.createElement("div", { style: {
|
|
89
|
-
backgroundColor: topLabelColor,
|
|
90
|
-
borderRadius: "50%",
|
|
91
|
-
width: "7px",
|
|
92
|
-
height: "7px",
|
|
93
|
-
} })))),
|
|
94
|
-
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"
|
|
95
|
-
? removeDuplicateSeats && isPeru
|
|
96
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
97
|
-
: isTrain
|
|
98
|
-
? CommonService.truncateSeatLabel(CommonService.capitalize(String(val.label)), 8)
|
|
99
|
-
: val.label
|
|
100
|
-
: null)));
|
|
101
|
-
});
|
|
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)));
|
|
102
73
|
};
|
|
103
74
|
const renderSeatPrices = () => {
|
|
104
75
|
if (isPeru) {
|
|
@@ -22,7 +22,6 @@ interface DateTimeSectionMobileProps {
|
|
|
22
22
|
tooltipBgColor?: string;
|
|
23
23
|
showLastSeats?: boolean;
|
|
24
24
|
discountSeatPriceColor?: string;
|
|
25
|
-
isTrain?: boolean;
|
|
26
25
|
}
|
|
27
|
-
declare function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal, isPeru, orignLabel, destinationLabel, originIcon, destinationIcon, travelDate, arrivalDate, depTime, arrTime, seatTypes, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor,
|
|
26
|
+
declare function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal, isPeru, orignLabel, destinationLabel, originIcon, destinationIcon, travelDate, arrivalDate, depTime, arrTime, seatTypes, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor, }: DateTimeSectionMobileProps): React.ReactElement;
|
|
28
27
|
export default DateTimeSectionMobile;
|
|
@@ -23,10 +23,8 @@ const getCleanedDepTime = (raw) => {
|
|
|
23
23
|
};
|
|
24
24
|
const TimeRow = ({ label, icon, alt, date, timeContent, isSoldOut, }) => {
|
|
25
25
|
const formattedDate = DateService.getServiceItemDate(date);
|
|
26
|
-
const dotPositionClass = formattedDate.includes("dom")
|
|
27
|
-
|
|
28
|
-
: "";
|
|
29
|
-
return (React.createElement("div", { className: `flex items-center min-[420]:text-[13px] text-[12px] justify-between ${isSoldOut ? "text-[#c0c0c0]" : ""}` },
|
|
26
|
+
const dotPositionClass = formattedDate.includes("dom") ? "max-[399px]:left-[53%]" : "";
|
|
27
|
+
return React.createElement("div", { className: `flex items-center min-[420]:text-[13px] text-[12px] justify-between ${isSoldOut ? "text-[#c0c0c0]" : ""}` },
|
|
30
28
|
React.createElement("div", { className: "flex items-center", style: { flex: 1 } },
|
|
31
29
|
React.createElement("div", null,
|
|
32
30
|
" ",
|
|
@@ -35,9 +33,9 @@ const TimeRow = ({ label, icon, alt, date, timeContent, isSoldOut, }) => {
|
|
|
35
33
|
React.createElement("div", { className: "flex items-center relative capitalize justify-between", style: { flex: 1 } },
|
|
36
34
|
React.createElement("span", { className: "cursor-pointer black-text" }, formattedDate),
|
|
37
35
|
React.createElement("div", { className: `absolute left-[50%] ${dotPositionClass}` }, "\u2022"),
|
|
38
|
-
React.createElement("div", { className: "font-[900] relative black-text" }, timeContent))))
|
|
36
|
+
React.createElement("div", { className: "font-[900] relative black-text" }, timeContent))));
|
|
39
37
|
};
|
|
40
|
-
function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal, isPeru, orignLabel, destinationLabel, originIcon, destinationIcon, travelDate, arrivalDate, depTime, arrTime, seatTypes, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor,
|
|
38
|
+
function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal, isPeru, orignLabel, destinationLabel, originIcon, destinationIcon, travelDate, arrivalDate, depTime, arrTime, seatTypes, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor, }) {
|
|
41
39
|
const { cleaned: cleanedDepTime, hasAM, hasPM } = getCleanedDepTime(depTime);
|
|
42
40
|
const depTimeContent = isLinatal ? (React.createElement("div", null,
|
|
43
41
|
React.createElement("span", null,
|
|
@@ -49,11 +47,7 @@ function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal
|
|
|
49
47
|
? null
|
|
50
48
|
: DateService.ampmOnly(depTime)))) : (DateService.formatTime(depTime));
|
|
51
49
|
return (React.createElement("div", { className: "flex justify-between gap-[5px] w-full", onClick: onBookButtonPress },
|
|
52
|
-
React.createElement("div", { className:
|
|
53
|
-
justifyContent: isCiva && "center",
|
|
54
|
-
minHeight: isTrain ? undefined : "2.5rem",
|
|
55
|
-
alignSelf: isTrain ? "stretch" : undefined,
|
|
56
|
-
} },
|
|
50
|
+
React.createElement("div", { className: "min-h-[2.5rem] flex flex-col justify-between gap-[4px] w-[50%] ", style: { justifyContent: isCiva && "center" } },
|
|
57
51
|
React.createElement(TimeRow, { label: orignLabel, icon: originIcon, alt: "origin", date: travelDate, timeContent: depTimeContent, isSoldOut: isSoldOut }),
|
|
58
52
|
isCiva ? null : (React.createElement(TimeRow, { label: destinationLabel, icon: destinationIcon, alt: "destination", date: arrivalDate, timeContent: DateService.formatTime(arrTime), isSoldOut: isSoldOut }))),
|
|
59
53
|
React.createElement("div", { style: {
|
|
@@ -62,6 +56,6 @@ function DateTimeSectionMobile({ onBookButtonPress, isCiva, isSoldOut, isLinatal
|
|
|
62
56
|
backgroundColor: "#ccc",
|
|
63
57
|
margin: "auto",
|
|
64
58
|
} }),
|
|
65
|
-
React.createElement(SeatSectionMobile, { seatTypes: seatTypes, isSoldOut: isSoldOut, isPeru: isPeru, seatPriceColor: seatPriceColor, currencySign: currencySign, availableSeats: availableSeats, removeDuplicateSeats: removeDuplicateSeats, serviceItem: serviceItem, tooltipBgColor: tooltipBgColor, showLastSeats: showLastSeats, discountSeatPriceColor: discountSeatPriceColor
|
|
59
|
+
React.createElement(SeatSectionMobile, { seatTypes: seatTypes, isSoldOut: isSoldOut, isPeru: isPeru, seatPriceColor: seatPriceColor, currencySign: currencySign, availableSeats: availableSeats, removeDuplicateSeats: removeDuplicateSeats, serviceItem: serviceItem, tooltipBgColor: tooltipBgColor, showLastSeats: showLastSeats, discountSeatPriceColor: discountSeatPriceColor })));
|
|
66
60
|
}
|
|
67
61
|
export default DateTimeSectionMobile;
|
|
@@ -16,7 +16,6 @@ interface SeatSectionMobileProps {
|
|
|
16
16
|
tooltipBgColor?: string;
|
|
17
17
|
showLastSeats?: boolean;
|
|
18
18
|
discountSeatPriceColor?: string;
|
|
19
|
-
isTrain?: boolean;
|
|
20
19
|
}
|
|
21
|
-
declare function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor,
|
|
20
|
+
declare function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor, }: SeatSectionMobileProps): React.ReactElement;
|
|
22
21
|
export default SeatSectionMobile;
|
|
@@ -11,7 +11,7 @@ const EXCEPTIONS = [
|
|
|
11
11
|
"blanco",
|
|
12
12
|
"asiento_mascota",
|
|
13
13
|
];
|
|
14
|
-
const SeatRow = ({ type, index, displayLabel, fare, isSoldOut, seatPriceColor, hasMultipleTypes, textSize,
|
|
14
|
+
const SeatRow = ({ type, index, displayLabel, fare, isSoldOut, seatPriceColor, hasMultipleTypes, textSize, }) => {
|
|
15
15
|
if (EXCEPTIONS.includes(type.label))
|
|
16
16
|
return null;
|
|
17
17
|
const rowClass = hasMultipleTypes
|
|
@@ -20,9 +20,7 @@ const SeatRow = ({ type, index, displayLabel, fare, isSoldOut, seatPriceColor, h
|
|
|
20
20
|
const labelColor = isSoldOut ? "#bbb" : "#464647";
|
|
21
21
|
const priceColor = isSoldOut ? "#bbb" : seatPriceColor;
|
|
22
22
|
return (React.createElement("div", { className: rowClass, key: index },
|
|
23
|
-
React.createElement("span", { className: `min-[420]:text-[13px] ${textSize} `, style: { color: labelColor } },
|
|
24
|
-
? commonService.truncateSeatLabel(commonService.capitalize(displayLabel), 8)
|
|
25
|
-
: displayLabel),
|
|
23
|
+
React.createElement("span", { className: `min-[420]:text-[13px] ${textSize} `, style: { color: labelColor } }, displayLabel),
|
|
26
24
|
React.createElement("span", { className: `min-[420]:text-[13px] ${textSize} bold-text`, style: { color: priceColor } }, fare)));
|
|
27
25
|
};
|
|
28
26
|
const getFilteredSeats = (item) => {
|
|
@@ -44,8 +42,8 @@ const getUniqueSeats = (data, limit) => {
|
|
|
44
42
|
.sort((a, b) => a.fare - b.fare)
|
|
45
43
|
.slice(0, limit);
|
|
46
44
|
};
|
|
47
|
-
function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor,
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
45
|
+
function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, tooltipBgColor, showLastSeats, discountSeatPriceColor, }) {
|
|
46
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
47
|
const hasMultipleTypes = ((_a = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.length) !== null && _a !== void 0 ? _a : 0) > 2;
|
|
50
48
|
const getFare = (fare) => {
|
|
51
49
|
if (removeDuplicateSeats && availableSeats <= 0 && !isPeru) {
|
|
@@ -103,24 +101,19 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
|
|
|
103
101
|
React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] text-[#464647]", style: { opacity: isSoldOut ? 0.5 : 1 } }, "Agotado"))) : null));
|
|
104
102
|
};
|
|
105
103
|
const renderSeats = () => {
|
|
106
|
-
var _a, _b;
|
|
104
|
+
var _a, _b, _c;
|
|
107
105
|
if (isPeru) {
|
|
108
106
|
return renderPeruSeats();
|
|
109
107
|
}
|
|
110
108
|
if (removeDuplicateSeats) {
|
|
111
109
|
const uniqueSeats = getUniqueSeats(seatTypesData, 3);
|
|
112
|
-
return uniqueSeats.map((type, i) => (React.createElement(SeatRow, { key: i, type: type, index: i, displayLabel: commonService.truncateSeatLabel(type.label), fare: getFare(type.fare), isSoldOut: isSoldOut, seatPriceColor: seatPriceColor, hasMultipleTypes: hasMultipleTypes, textSize: "text-[11px]"
|
|
110
|
+
return uniqueSeats.map((type, i) => (React.createElement(SeatRow, { key: i, type: type, index: i, displayLabel: commonService.truncateSeatLabel(type.label), fare: getFare(type.fare), isSoldOut: isSoldOut, seatPriceColor: seatPriceColor, hasMultipleTypes: hasMultipleTypes, textSize: "text-[11px]" })));
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
return (_b = (isTrain ? filteredSeats : filteredSeats === null || filteredSeats === void 0 ? void 0 : filteredSeats.slice(0, 2))) === null || _b === void 0 ? void 0 : _b.map((type, i) => (React.createElement(SeatRow, { key: i, type: type, index: i, displayLabel: type.label, fare: getFare(type.fare), isSoldOut: isSoldOut, seatPriceColor: seatPriceColor, hasMultipleTypes: hasMultipleTypes, textSize: "text-[12px]", isTrain: isTrain })));
|
|
112
|
+
return (_c = (_b = (_a = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => getFilteredSeats(item.label))) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.fare - b.fare)) === null || _b === void 0 ? void 0 : _b.slice(0, 2)) === null || _c === void 0 ? void 0 : _c.map((type, i) => (React.createElement(SeatRow, { key: i, type: type, index: i, displayLabel: type.label, fare: getFare(type.fare), isSoldOut: isSoldOut, seatPriceColor: seatPriceColor, hasMultipleTypes: hasMultipleTypes, textSize: "text-[12px]" })));
|
|
116
113
|
};
|
|
117
114
|
const seats = removeDuplicateSeats
|
|
118
115
|
? getUniqueSeats(seatTypesData, 3)
|
|
119
|
-
: (() =>
|
|
120
|
-
var _a;
|
|
121
|
-
const filtered = (_a = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => getFilteredSeats(item.label))) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.fare - b.fare);
|
|
122
|
-
return isTrain ? filtered : filtered === null || filtered === void 0 ? void 0 : filtered.slice(0, 2);
|
|
123
|
-
})();
|
|
116
|
+
: (_c = (_b = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => getFilteredSeats(item.label))) === null || _b === void 0 ? void 0 : _b.sort((a, b) => a.fare - b.fare)) === null || _c === void 0 ? void 0 : _c.slice(0, 2);
|
|
124
117
|
const discountedSeats = seats === null || seats === void 0 ? void 0 : seats.map((seat) => (Object.assign(Object.assign({}, seat), commonService.calculateDiscountedPrice(seat.fare, serviceItem))));
|
|
125
118
|
const peruLowestFare = isPeru ? getLowestFare() : null;
|
|
126
119
|
const peruDiscountCalc = isPeru && peruLowestFare != null
|
|
@@ -131,7 +124,7 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
|
|
|
131
124
|
peruDiscountCalc.originalPrice !== peruDiscountCalc.discountedPrice
|
|
132
125
|
: discountedSeats === null || discountedSeats === void 0 ? void 0 : discountedSeats.some((s) => s.originalPrice !== s.discountedPrice);
|
|
133
126
|
const discountSeat = isPeru && peruDiscountCalc
|
|
134
|
-
? Object.assign({ label: "", fare: peruLowestFare }, peruDiscountCalc) : (
|
|
127
|
+
? Object.assign({ label: "", fare: peruLowestFare }, peruDiscountCalc) : (_d = discountedSeats === null || discountedSeats === void 0 ? void 0 : discountedSeats.filter((seat) => !EXCEPTIONS.includes(seat.label))) === null || _d === void 0 ? void 0 : _d.sort((a, b) => a.discountedPrice - b.discountedPrice)[0];
|
|
135
128
|
const discountValue = (() => {
|
|
136
129
|
if ((serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_type) === "percentage" &&
|
|
137
130
|
typeof (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) === "number") {
|
|
@@ -154,14 +147,14 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
|
|
|
154
147
|
};
|
|
155
148
|
const originalDpPrice = getMinValue(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.original_dp_price);
|
|
156
149
|
const dpDiscountPercent = getMinValue(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discount_percents);
|
|
157
|
-
const firstSeatFare = (
|
|
150
|
+
const firstSeatFare = (_f = (_e = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => getFilteredSeats(item.label) && !EXCEPTIONS.includes(item.label))) === null || _e === void 0 ? void 0 : _e.sort((a, b) => a.fare - b.fare)[0]) === null || _f === void 0 ? void 0 : _f.fare;
|
|
158
151
|
const hasDpDiscount = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discounted_seats) &&
|
|
159
152
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discount_percents) &&
|
|
160
153
|
originalDpPrice != null &&
|
|
161
154
|
dpDiscountPercent != null &&
|
|
162
155
|
firstSeatFare != null;
|
|
163
156
|
return (React.createElement("div", { className: "content-center relative", style: { width: "40%" } }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled) &&
|
|
164
|
-
!((
|
|
157
|
+
!((_g = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discounted_seats) === null || _g === void 0 ? void 0 : _g.length) &&
|
|
165
158
|
!dpDiscountPercent ? (React.createElement("div", { className: "flex flex-col justify-between h-[2.5rem]", style: { gap: isSoldOut ? "0px" : "5px" } }, renderDpSeats())) : hasDpDiscount ? (React.createElement("div", { className: "relative grid grid-cols-[auto_auto] justify-between gap-x-[8px] " },
|
|
166
159
|
!isNaN(Number(dpDiscountPercent)) &&
|
|
167
160
|
Number(dpDiscountPercent) > 0 && (React.createElement("div", { className: "absolute -top-[18px] right-[0px]", style: {
|
|
@@ -193,7 +186,7 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
|
|
|
193
186
|
React.createElement("span", { className: "flex items-center justify-end gap-[4px] text-[14px] bold-text leading-[24px]", style: {
|
|
194
187
|
color: isSoldOut ? "#bbb" : discountSeatPriceColor || "#ff5964",
|
|
195
188
|
} },
|
|
196
|
-
((
|
|
189
|
+
((_h = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.icons) === null || _h === void 0 ? void 0 : _h.fireIcon) ? (React.createElement("img", { src: serviceItem.icons.fireIcon, alt: "discount", className: "h-[16px] w-[16px] object-contain", style: { filter: isSoldOut ? "grayscale" : "" } })) : null,
|
|
197
190
|
commonService.discountedCurrency(Number(firstSeatFare), currencySign)),
|
|
198
191
|
isSoldOut ? (React.createElement("span", { className: "col-span-2 min-[420]:text-[13px] text-right text-[12px] text-[#ccc]" }, "Agotado")) : null)) : hasDiscount && discountSeat ? (React.createElement("div", null,
|
|
199
192
|
React.createElement("div", { className: "relative grid grid-cols-[auto_auto] justify-between gap-x-[8px] " },
|
|
@@ -227,8 +220,8 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
|
|
|
227
220
|
React.createElement("span", { className: "flex items-center justify-end gap-[4px] text-[14px] bold-text leading-[24px]", style: {
|
|
228
221
|
color: isSoldOut ? "#bbb" : discountSeatPriceColor || "#ff5964",
|
|
229
222
|
} },
|
|
230
|
-
((
|
|
231
|
-
commonService.discountedCurrency(discountSeat.discountedPrice, currencySign))))) : (React.createElement("div", { className:
|
|
223
|
+
((_j = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.icons) === null || _j === void 0 ? void 0 : _j.fireIcon) ? (React.createElement("img", { src: serviceItem.icons.fireIcon, alt: "discount", className: "h-[16px] w-[16px] object-contain", style: { opacity: isSoldOut ? 0.5 : 1 } })) : null,
|
|
224
|
+
commonService.discountedCurrency(discountSeat.discountedPrice, currencySign))))) : (React.createElement("div", { className: "flex flex-col justify-between h-[2.5rem] ", style: {
|
|
232
225
|
gap: isSoldOut ? "0px" : "5px",
|
|
233
226
|
justifyContent: hasMultipleTypes ? "space-between" : "center",
|
|
234
227
|
} },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
const ServiceBadgesMobile = ({ showTopLabel, isSoldOut, colors, renderIcon, serviceItem, isConexion, }) => {
|
|
3
|
-
return (React.createElement("div", { className: "absolute -top-[
|
|
4
|
-
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] z-20`, style: {
|
|
3
|
+
return (React.createElement("div", { className: "absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10" },
|
|
4
|
+
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] h-[24px] z-20`, style: {
|
|
5
5
|
backgroundColor: "#fff",
|
|
6
6
|
border: isSoldOut
|
|
7
7
|
? "1px solid #ccc"
|
|
@@ -3,7 +3,7 @@ declare const commonService: {
|
|
|
3
3
|
discountedCurrency(amount: number, currencySign?: string): string;
|
|
4
4
|
copyObject: (ob: any) => any;
|
|
5
5
|
getServiceTypeLabelForFilters: (service_type: any) => "Tipo de servicio" | "Punto de embarque" | "Tipo de asiento" | "SERVICIOS" | "";
|
|
6
|
-
truncateSeatLabel: (label: string | number
|
|
6
|
+
truncateSeatLabel: (label: string | number) => string;
|
|
7
7
|
getAmenitiesImage: (name: string, serviceItem: any) => string;
|
|
8
8
|
getAmenityName: (rawAmenity: string) => string;
|
|
9
9
|
getSeatNameForFilters: (rawSeat: any) => any;
|
|
@@ -34,15 +34,11 @@ const commonService = {
|
|
|
34
34
|
return "";
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
-
truncateSeatLabel: (label
|
|
37
|
+
truncateSeatLabel: (label) => {
|
|
38
38
|
if (typeof label !== "string")
|
|
39
39
|
return String(label);
|
|
40
40
|
if (label.includes("("))
|
|
41
41
|
return label;
|
|
42
|
-
// If maxLength provided, hard-truncate regardless of word count
|
|
43
|
-
if (maxLength != null && label.length > maxLength) {
|
|
44
|
-
return label.slice(0, maxLength) + "...";
|
|
45
|
-
}
|
|
46
42
|
const words = label.trim().split(/\s+/);
|
|
47
43
|
const truncateWord = (word) => word.length > 5 ? word.slice(0, 3) + "..." : word;
|
|
48
44
|
if (words.length === 1)
|
package/package.json
CHANGED
|
@@ -131,13 +131,6 @@ function ServiceItemPB({
|
|
|
131
131
|
showLoginModal,
|
|
132
132
|
isLoggedIn,
|
|
133
133
|
showLoginOption,
|
|
134
|
-
isTrain,
|
|
135
|
-
selectedSeatKey,
|
|
136
|
-
onSeatSelect,
|
|
137
|
-
onTrainButtonClick,
|
|
138
|
-
showSeatSelectionError,
|
|
139
|
-
onShowSeatSelectionError,
|
|
140
|
-
onClearSeatSelectionError,
|
|
141
134
|
isFeatureDropDownExpand,
|
|
142
135
|
setIsFeatureDropDownExpand,
|
|
143
136
|
ticketQuantity,
|
|
@@ -151,15 +144,6 @@ function ServiceItemPB({
|
|
|
151
144
|
wowDealData,
|
|
152
145
|
isFlores,
|
|
153
146
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
154
|
-
const handleSeatSelect = (
|
|
155
|
-
key: any,
|
|
156
|
-
price: number,
|
|
157
|
-
seatKey: string,
|
|
158
|
-
apiSeatType?: string,
|
|
159
|
-
) => {
|
|
160
|
-
onClearSeatSelectionError?.();
|
|
161
|
-
onSeatSelect?.(key, price, seatKey, apiSeatType);
|
|
162
|
-
};
|
|
163
147
|
const getAnimationIcon = (icon: string) => {
|
|
164
148
|
const animation = ANIMATION_MAP[icon];
|
|
165
149
|
if (!animation) return null;
|
|
@@ -360,17 +344,6 @@ function ServiceItemPB({
|
|
|
360
344
|
return;
|
|
361
345
|
}
|
|
362
346
|
|
|
363
|
-
if (isTrain) {
|
|
364
|
-
if (!selectedSeatKey) {
|
|
365
|
-
onShowSeatSelectionError?.(serviceItem.id);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
if (onTrainButtonClick) {
|
|
369
|
-
onTrainButtonClick();
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
347
|
onBookButtonPress();
|
|
375
348
|
};
|
|
376
349
|
|
|
@@ -624,10 +597,6 @@ function ServiceItemPB({
|
|
|
624
597
|
isPeru={isPeru}
|
|
625
598
|
renderIcon={renderIcon}
|
|
626
599
|
discountSeatPriceColor={colors.discountSeatPriceColor}
|
|
627
|
-
isTrain={isTrain}
|
|
628
|
-
selectedSeatKey={selectedSeatKey}
|
|
629
|
-
onSeatSelect={handleSeatSelect}
|
|
630
|
-
topLabelColor={colors.topLabelColor}
|
|
631
600
|
/>
|
|
632
601
|
</div>
|
|
633
602
|
|
|
@@ -643,18 +612,6 @@ function ServiceItemPB({
|
|
|
643
612
|
soldOutIcon={renderIcon("soldOutIcon", "14px")}
|
|
644
613
|
onClick={checkMidnight}
|
|
645
614
|
/>
|
|
646
|
-
{showSeatSelectionError === serviceItem.id && isTrain && (
|
|
647
|
-
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
648
|
-
<div
|
|
649
|
-
className="text-[9px] text-center whitespace-nowrap"
|
|
650
|
-
style={{
|
|
651
|
-
color: colors.seatPriceColor,
|
|
652
|
-
}}
|
|
653
|
-
>
|
|
654
|
-
Selecciona el tipo de servicio
|
|
655
|
-
</div>
|
|
656
|
-
</div>
|
|
657
|
-
)}
|
|
658
615
|
{showLastSeats ? (
|
|
659
616
|
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
660
617
|
{serviceItem?.available_seats < 10 &&
|
|
@@ -46,8 +46,6 @@ function ServiceItemMobile({
|
|
|
46
46
|
removeDuplicateSeats,
|
|
47
47
|
isLinatal,
|
|
48
48
|
viewersConfig,
|
|
49
|
-
operatorLabel,
|
|
50
|
-
isTrain,
|
|
51
49
|
isFeatureDropDownExpand,
|
|
52
50
|
setIsFeatureDropDownExpand,
|
|
53
51
|
ticketQuantity,
|
|
@@ -232,7 +230,7 @@ function ServiceItemMobile({
|
|
|
232
230
|
style={{
|
|
233
231
|
padding: "12px 12px 8px 12px",
|
|
234
232
|
marginTop:
|
|
235
|
-
serviceItem?.is_direct_trip && showTopLabel
|
|
233
|
+
serviceItem?.is_direct_trip && (showTopLabel || isConexion)
|
|
236
234
|
? " 10px"
|
|
237
235
|
: "",
|
|
238
236
|
}}
|
|
@@ -135,36 +135,36 @@ export interface MobileServiceItemProps {
|
|
|
135
135
|
bombAnim?: string;
|
|
136
136
|
whiteBoardingIcon?: string;
|
|
137
137
|
downArrow?: string;
|
|
138
|
-
personIcon?: string
|
|
138
|
+
personIcon?: string
|
|
139
139
|
specialDeparture?: string;
|
|
140
140
|
fireIcon?: string;
|
|
141
141
|
directoIcon?: string;
|
|
142
|
-
whiteFireIcon?: string
|
|
143
|
-
femaleAnim?:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
whiteDestination?: string
|
|
148
|
-
userIcon?: string
|
|
149
|
-
|
|
150
|
-
sheildIcon?: string
|
|
151
|
-
busIcon?: string
|
|
152
|
-
whiteDownArrow?: string
|
|
153
|
-
empressaIcon?: string
|
|
154
|
-
flexibleIcon?: string
|
|
155
|
-
listoIcon?: string
|
|
156
|
-
precioIcon?: string
|
|
157
|
-
confirmarIcon?: string
|
|
142
|
+
whiteFireIcon?: string
|
|
143
|
+
femaleAnim?:string
|
|
144
|
+
thunderAnim?: string
|
|
145
|
+
personsAnim?: string
|
|
146
|
+
whiteOrigin?: string,
|
|
147
|
+
whiteDestination?: string,
|
|
148
|
+
userIcon?: string,
|
|
149
|
+
|
|
150
|
+
sheildIcon?: string,
|
|
151
|
+
busIcon?: string,
|
|
152
|
+
whiteDownArrow?: string,
|
|
153
|
+
empressaIcon?: string,
|
|
154
|
+
flexibleIcon?: string,
|
|
155
|
+
listoIcon?: string,
|
|
156
|
+
precioIcon?: string,
|
|
157
|
+
confirmarIcon?: string
|
|
158
158
|
cancelTicketIcon?: string;
|
|
159
159
|
changeTicketIcon?: string;
|
|
160
160
|
petFriendlyIcon?: string;
|
|
161
|
-
womenSeatIcon?: string
|
|
161
|
+
womenSeatIcon?: string
|
|
162
162
|
[key: string]: string | Record<string, string | undefined> | undefined;
|
|
163
163
|
};
|
|
164
164
|
useLottieFor?: string[];
|
|
165
165
|
};
|
|
166
166
|
onBookButtonPress?: () => void;
|
|
167
|
-
onRemateUiButtonClick?: ()
|
|
167
|
+
onRemateUiButtonClick?: ()=> void;
|
|
168
168
|
terminals?: any[];
|
|
169
169
|
showDropdown?: boolean;
|
|
170
170
|
setShowDropdown?: (value: boolean) => void;
|
|
@@ -208,7 +208,7 @@ export interface MobileServiceItemProps {
|
|
|
208
208
|
seatPriceColor?: string;
|
|
209
209
|
rightGradiantColor?: string;
|
|
210
210
|
leftGradiantColor?: string;
|
|
211
|
-
discountSeatPriceColor?: string
|
|
211
|
+
discountSeatPriceColor?: string
|
|
212
212
|
};
|
|
213
213
|
isCiva?: boolean;
|
|
214
214
|
currencySign?: string;
|
|
@@ -221,29 +221,23 @@ export interface MobileServiceItemProps {
|
|
|
221
221
|
showLastSeats?: boolean;
|
|
222
222
|
removeDuplicateSeats?: boolean;
|
|
223
223
|
isLinatal?: boolean;
|
|
224
|
-
|
|
224
|
+
viewersConfig?: {
|
|
225
225
|
min: number;
|
|
226
226
|
max: number;
|
|
227
227
|
interval?: number; // ms, default 5000
|
|
228
228
|
label?: string; // e.g. "personas están viendo este viaje"
|
|
229
229
|
icon?: string; // optional icon URL
|
|
230
230
|
};
|
|
231
|
-
|
|
232
|
-
isTrain?: boolean;
|
|
233
|
-
isFeatureDropDownExpand?: any;
|
|
231
|
+
isFeatureDropDownExpand?: any;
|
|
234
232
|
setIsFeatureDropDownExpand?: (value: any) => void;
|
|
235
233
|
ticketQuantity?: number;
|
|
236
|
-
onIncreaseTicketQuantity?: (
|
|
237
|
-
|
|
238
|
-
) => void;
|
|
239
|
-
onDecreaseTicketQuantity?: (
|
|
240
|
-
serviceItem: MobileServiceItemProps["serviceItem"],
|
|
241
|
-
) => void;
|
|
234
|
+
onIncreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
235
|
+
onDecreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
242
236
|
cityOrigin?: { value: number; label: string };
|
|
243
237
|
cityDestination?: { value: number; label: string };
|
|
244
|
-
|
|
238
|
+
isNewUi?: boolean
|
|
245
239
|
|
|
246
|
-
|
|
240
|
+
selectedTimeSlot?: string;
|
|
247
241
|
onTimeSlotChange?: (slot: string) => void;
|
|
248
242
|
isTimeDropdownOpen?: string | number | null;
|
|
249
243
|
onTimeDropdownToggle?: (id?: string | number | null) => void;
|
|
@@ -252,18 +252,6 @@ export interface ServiceItemProps {
|
|
|
252
252
|
showLoginModal?: any;
|
|
253
253
|
isLoggedIn?: any;
|
|
254
254
|
showLoginOption?: boolean;
|
|
255
|
-
isTrain?: boolean;
|
|
256
|
-
selectedSeatKey?: any;
|
|
257
|
-
onSeatSelect?: (
|
|
258
|
-
key: any,
|
|
259
|
-
price: number,
|
|
260
|
-
seatKey: string,
|
|
261
|
-
apiSeatType?: string,
|
|
262
|
-
) => void;
|
|
263
|
-
onTrainButtonClick?: any;
|
|
264
|
-
showSeatSelectionError?: string | null;
|
|
265
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
266
|
-
onClearSeatSelectionError?: () => void;
|
|
267
255
|
selectedTimeSlot?: string;
|
|
268
256
|
onTimeSlotChange?: (slot: string) => void;
|
|
269
257
|
isTimeDropdownOpen?: string | number | null;
|
|
@@ -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,9 +52,7 @@ function getSortedSeatTypes(seatTypes: SeatType[], isTrain: any) {
|
|
|
65
52
|
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
66
53
|
}
|
|
67
54
|
|
|
68
|
-
|
|
69
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
70
|
-
}
|
|
55
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
71
56
|
|
|
72
57
|
const seenPrices = new Set<number>();
|
|
73
58
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
@@ -112,18 +97,14 @@ function SeatSection({
|
|
|
112
97
|
priceColor,
|
|
113
98
|
currencySign,
|
|
114
99
|
removeDuplicateSeats,
|
|
115
|
-
selectedSeatKey,
|
|
116
|
-
onSeatSelect,
|
|
117
100
|
isPeru,
|
|
118
101
|
serviceItem,
|
|
119
102
|
renderIcon,
|
|
120
103
|
dpSeatColor,
|
|
121
104
|
discountSeatPriceColor,
|
|
122
|
-
isTrain,
|
|
123
|
-
topLabelColor,
|
|
124
105
|
}: SeatSectionProps): React.ReactElement {
|
|
125
106
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
126
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes
|
|
107
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
127
108
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
128
109
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
129
110
|
|
|
@@ -135,71 +116,22 @@ function SeatSection({
|
|
|
135
116
|
const renderSeatNames = () => {
|
|
136
117
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
137
118
|
|
|
138
|
-
return seats.map((val, key: number) =>
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
? () =>
|
|
146
|
-
val.label === selectedSeatKey
|
|
147
|
-
? onSeatSelect?.(null, 0, "", "")
|
|
148
|
-
: onSeatSelect?.(
|
|
149
|
-
val.label,
|
|
150
|
-
val.price,
|
|
151
|
-
val.key,
|
|
152
|
-
(val as any).apiSeatType,
|
|
153
|
-
)
|
|
154
|
-
: undefined
|
|
155
|
-
}
|
|
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
|
+
}`}
|
|
156
126
|
>
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
marginRight: "10px",
|
|
166
|
-
display: "flex",
|
|
167
|
-
alignItems: "center",
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
{val.label === selectedSeatKey && (
|
|
172
|
-
<div
|
|
173
|
-
style={{
|
|
174
|
-
backgroundColor: topLabelColor,
|
|
175
|
-
borderRadius: "50%",
|
|
176
|
-
width: "7px",
|
|
177
|
-
height: "7px",
|
|
178
|
-
}}
|
|
179
|
-
/>
|
|
180
|
-
)}
|
|
181
|
-
</div>
|
|
182
|
-
)}
|
|
183
|
-
<span
|
|
184
|
-
key={key}
|
|
185
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
186
|
-
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
187
|
-
}`}
|
|
188
|
-
>
|
|
189
|
-
{typeof val.label === "string" || typeof val.label === "number"
|
|
190
|
-
? removeDuplicateSeats && isPeru
|
|
191
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
192
|
-
: isTrain
|
|
193
|
-
? CommonService.truncateSeatLabel(
|
|
194
|
-
CommonService.capitalize(String(val.label)),
|
|
195
|
-
8,
|
|
196
|
-
)
|
|
197
|
-
: val.label
|
|
198
|
-
: null}
|
|
199
|
-
</span>
|
|
200
|
-
</div>
|
|
201
|
-
);
|
|
202
|
-
});
|
|
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
|
+
);
|
|
203
135
|
};
|
|
204
136
|
|
|
205
137
|
const renderSeatPrices = () => {
|
|
@@ -25,7 +25,6 @@ interface DateTimeSectionMobileProps {
|
|
|
25
25
|
tooltipBgColor?: string;
|
|
26
26
|
showLastSeats?: boolean;
|
|
27
27
|
discountSeatPriceColor?: string;
|
|
28
|
-
isTrain?: boolean;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
const pad = (n: number) => (n < 10 ? "0" + n : String(n));
|
|
@@ -68,43 +67,41 @@ const TimeRow: React.FC<TimeRowProps> = ({
|
|
|
68
67
|
isSoldOut,
|
|
69
68
|
}) => {
|
|
70
69
|
const formattedDate = DateService.getServiceItemDate(date);
|
|
71
|
-
const dotPositionClass = formattedDate.includes("dom")
|
|
72
|
-
|
|
73
|
-
:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<div className="font-[900] relative black-text">{timeContent}</div>
|
|
104
|
-
</div>
|
|
70
|
+
const dotPositionClass = formattedDate.includes("dom") ? "max-[399px]:left-[53%]" : "";
|
|
71
|
+
return <div
|
|
72
|
+
className={`flex items-center min-[420]:text-[13px] text-[12px] justify-between ${
|
|
73
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
74
|
+
}`}
|
|
75
|
+
>
|
|
76
|
+
<div className="flex items-center" style={{ flex: 1 }}>
|
|
77
|
+
<div>
|
|
78
|
+
{" "}
|
|
79
|
+
{label ? (
|
|
80
|
+
<div className="w-[60px]">{label}</div>
|
|
81
|
+
) : (
|
|
82
|
+
<div className="w-[12px] h-auto mr-[5px]">
|
|
83
|
+
<img
|
|
84
|
+
src={icon}
|
|
85
|
+
alt={alt}
|
|
86
|
+
className={`w-[12px] h-auto mr-[5px] ${
|
|
87
|
+
isSoldOut ? "grayscale" : ""
|
|
88
|
+
}`}
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
<div
|
|
94
|
+
className="flex items-center relative capitalize justify-between"
|
|
95
|
+
style={{ flex: 1 }}
|
|
96
|
+
>
|
|
97
|
+
<span className="cursor-pointer black-text">
|
|
98
|
+
{formattedDate}
|
|
99
|
+
</span>
|
|
100
|
+
<div className={`absolute left-[50%] ${dotPositionClass}`}>•</div>
|
|
101
|
+
<div className="font-[900] relative black-text">{timeContent}</div>
|
|
105
102
|
</div>
|
|
106
103
|
</div>
|
|
107
|
-
|
|
104
|
+
</div>;
|
|
108
105
|
};
|
|
109
106
|
|
|
110
107
|
function DateTimeSectionMobile({
|
|
@@ -130,7 +127,6 @@ function DateTimeSectionMobile({
|
|
|
130
127
|
tooltipBgColor,
|
|
131
128
|
showLastSeats,
|
|
132
129
|
discountSeatPriceColor,
|
|
133
|
-
isTrain,
|
|
134
130
|
}: DateTimeSectionMobileProps): React.ReactElement {
|
|
135
131
|
const { cleaned: cleanedDepTime, hasAM, hasPM } = getCleanedDepTime(depTime);
|
|
136
132
|
|
|
@@ -157,12 +153,8 @@ function DateTimeSectionMobile({
|
|
|
157
153
|
>
|
|
158
154
|
{/* DATE AND TIME */}
|
|
159
155
|
<div
|
|
160
|
-
className=
|
|
161
|
-
style={{
|
|
162
|
-
justifyContent: isCiva && "center",
|
|
163
|
-
minHeight: isTrain ? undefined : "2.5rem",
|
|
164
|
-
alignSelf: isTrain ? "stretch" : undefined,
|
|
165
|
-
}}
|
|
156
|
+
className="min-h-[2.5rem] flex flex-col justify-between gap-[4px] w-[50%] "
|
|
157
|
+
style={{ justifyContent: isCiva && "center" }}
|
|
166
158
|
>
|
|
167
159
|
<TimeRow
|
|
168
160
|
label={orignLabel}
|
|
@@ -206,7 +198,6 @@ function DateTimeSectionMobile({
|
|
|
206
198
|
tooltipBgColor={tooltipBgColor}
|
|
207
199
|
showLastSeats={showLastSeats}
|
|
208
200
|
discountSeatPriceColor={discountSeatPriceColor}
|
|
209
|
-
isTrain={isTrain}
|
|
210
201
|
/>
|
|
211
202
|
</div>
|
|
212
203
|
);
|
|
@@ -31,7 +31,6 @@ interface SeatSectionMobileProps {
|
|
|
31
31
|
tooltipBgColor?: string;
|
|
32
32
|
showLastSeats?: boolean;
|
|
33
33
|
discountSeatPriceColor?: string;
|
|
34
|
-
isTrain?: boolean;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
interface SeatRowProps {
|
|
@@ -43,7 +42,6 @@ interface SeatRowProps {
|
|
|
43
42
|
seatPriceColor: string;
|
|
44
43
|
hasMultipleTypes: boolean;
|
|
45
44
|
textSize: string;
|
|
46
|
-
isTrain?: boolean;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
const SeatRow: React.FC<SeatRowProps> = ({
|
|
@@ -55,7 +53,6 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
55
53
|
seatPriceColor,
|
|
56
54
|
hasMultipleTypes,
|
|
57
55
|
textSize,
|
|
58
|
-
isTrain,
|
|
59
56
|
}) => {
|
|
60
57
|
if (EXCEPTIONS.includes(type.label)) return null;
|
|
61
58
|
|
|
@@ -72,12 +69,7 @@ const SeatRow: React.FC<SeatRowProps> = ({
|
|
|
72
69
|
className={`min-[420]:text-[13px] ${textSize} `}
|
|
73
70
|
style={{ color: labelColor }}
|
|
74
71
|
>
|
|
75
|
-
{
|
|
76
|
-
? commonService.truncateSeatLabel(
|
|
77
|
-
commonService.capitalize(displayLabel),
|
|
78
|
-
8,
|
|
79
|
-
)
|
|
80
|
-
: displayLabel}
|
|
72
|
+
{displayLabel}
|
|
81
73
|
</span>
|
|
82
74
|
<span
|
|
83
75
|
className={`min-[420]:text-[13px] ${textSize} bold-text`}
|
|
@@ -126,7 +118,6 @@ function SeatSectionMobile({
|
|
|
126
118
|
tooltipBgColor,
|
|
127
119
|
showLastSeats,
|
|
128
120
|
discountSeatPriceColor,
|
|
129
|
-
isTrain,
|
|
130
121
|
}: SeatSectionMobileProps): React.ReactElement {
|
|
131
122
|
const hasMultipleTypes = (seatTypesData?.length ?? 0) > 2;
|
|
132
123
|
|
|
@@ -287,17 +278,15 @@ function SeatSectionMobile({
|
|
|
287
278
|
seatPriceColor={seatPriceColor}
|
|
288
279
|
hasMultipleTypes={hasMultipleTypes}
|
|
289
280
|
textSize="text-[11px]"
|
|
290
|
-
isTrain={isTrain}
|
|
291
281
|
/>
|
|
292
282
|
));
|
|
293
283
|
}
|
|
294
284
|
|
|
295
|
-
|
|
285
|
+
return seatTypesData
|
|
296
286
|
?.filter((item) => getFilteredSeats(item.label))
|
|
297
|
-
?.sort((a, b) => a.fare - b.fare)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
(type, i) => (
|
|
287
|
+
?.sort((a, b) => a.fare - b.fare)
|
|
288
|
+
?.slice(0, 2)
|
|
289
|
+
?.map((type, i) => (
|
|
301
290
|
<SeatRow
|
|
302
291
|
key={i}
|
|
303
292
|
type={type}
|
|
@@ -308,20 +297,16 @@ function SeatSectionMobile({
|
|
|
308
297
|
seatPriceColor={seatPriceColor}
|
|
309
298
|
hasMultipleTypes={hasMultipleTypes}
|
|
310
299
|
textSize="text-[12px]"
|
|
311
|
-
isTrain={isTrain}
|
|
312
300
|
/>
|
|
313
|
-
)
|
|
314
|
-
);
|
|
301
|
+
));
|
|
315
302
|
};
|
|
316
303
|
|
|
317
304
|
const seats = removeDuplicateSeats
|
|
318
305
|
? getUniqueSeats(seatTypesData, 3)
|
|
319
|
-
:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return isTrain ? filtered : filtered?.slice(0, 2);
|
|
324
|
-
})();
|
|
306
|
+
: seatTypesData
|
|
307
|
+
?.filter((item) => getFilteredSeats(item.label))
|
|
308
|
+
?.sort((a, b) => a.fare - b.fare)
|
|
309
|
+
?.slice(0, 2);
|
|
325
310
|
|
|
326
311
|
const discountedSeats = seats?.map((seat) => ({
|
|
327
312
|
...seat,
|
|
@@ -556,7 +541,7 @@ function SeatSectionMobile({
|
|
|
556
541
|
</div>
|
|
557
542
|
) : (
|
|
558
543
|
<div
|
|
559
|
-
className=
|
|
544
|
+
className="flex flex-col justify-between h-[2.5rem] "
|
|
560
545
|
style={{
|
|
561
546
|
gap: isSoldOut ? "0px" : "5px",
|
|
562
547
|
justifyContent: hasMultipleTypes ? "space-between" : "center",
|
|
@@ -24,10 +24,10 @@ const ServiceBadgesMobile: React.FC<ServiceBadgesMobileProps> = ({
|
|
|
24
24
|
isConexion,
|
|
25
25
|
}) => {
|
|
26
26
|
return (
|
|
27
|
-
<div className="absolute -top-[
|
|
27
|
+
<div className="absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[17px] z-10">
|
|
28
28
|
{showTopLabel && (
|
|
29
29
|
<div
|
|
30
|
-
className={`flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] z-20`}
|
|
30
|
+
className={`flex items-center gap-[2p x] py-[4px] px-[10px] rounded-[38px] min-[420]:text-[12px] text-[10px] h-[24px] z-20`}
|
|
31
31
|
style={{
|
|
32
32
|
backgroundColor: "#fff",
|
|
33
33
|
border: isSoldOut
|
|
@@ -39,15 +39,9 @@ const commonService = {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
-
truncateSeatLabel: (label: string | number
|
|
42
|
+
truncateSeatLabel: (label: string | number): string => {
|
|
43
43
|
if (typeof label !== "string") return String(label);
|
|
44
44
|
if (label.includes("(")) return label;
|
|
45
|
-
|
|
46
|
-
// If maxLength provided, hard-truncate regardless of word count
|
|
47
|
-
if (maxLength != null && label.length > maxLength) {
|
|
48
|
-
return label.slice(0, maxLength) + "...";
|
|
49
|
-
}
|
|
50
|
-
|
|
51
45
|
const words = label.trim().split(/\s+/);
|
|
52
46
|
|
|
53
47
|
const truncateWord = (word: string) =>
|