kupos-ui-components-lib 9.1.1 → 9.1.2
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/README copy.md +223 -67
- package/dist/assets/images/anims/service_list/directo.json +1 -1
- package/dist/components/ServiceItem/PeruServiceItemDesktop.js +1 -1
- package/dist/components/ServiceItem/RatingHover.js +32 -33
- package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +147 -267
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +87 -278
- package/dist/components/ServiceItem/mobileTypes.d.ts +5 -0
- package/dist/components/ServiceItem/types.d.ts +7 -0
- package/dist/styles.css +131 -32
- package/dist/ui/AmenitiesBlock.js +23 -30
- package/dist/ui/BottomAmenities/BottomAmenities.js +0 -1
- package/dist/ui/DurationBlock.js +4 -4
- package/dist/ui/FlexibleBlock.js +5 -6
- package/dist/ui/PetBlock.js +1 -3
- package/dist/ui/RatingBlock.d.ts +9 -1
- package/dist/ui/RatingBlock.js +7 -3
- package/dist/utils/CommonService.d.ts +1 -1
- package/dist/utils/CommonService.js +2 -0
- package/package.json +2 -1
- package/src/assets/images/anims/service_list/bomb.json +1 -0
- package/src/assets/images/anims/service_list/directo.json +1 -1
- package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +1 -0
- package/src/components/ServiceItem/RatingHover.tsx +44 -45
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +313 -537
- package/src/components/ServiceItem/ServiceItemMobile.tsx +213 -530
- package/src/components/ServiceItem/mobileTypes.ts +5 -0
- package/src/components/ServiceItem/types.ts +7 -0
- package/src/ui/AmenitiesBlock.tsx +50 -29
- package/src/ui/BottomAmenities/BottomAmenities.tsx +110 -0
- package/src/ui/DateTimeSection/DateTimeSection.tsx +207 -0
- package/src/ui/DirectoBlock.tsx +31 -0
- package/src/ui/DurationBlock.tsx +4 -4
- package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +103 -0
- package/src/ui/FlexibleBlock.tsx +6 -5
- package/src/ui/KuposButton/KuposButton.tsx +48 -0
- package/src/ui/PetBlock.tsx +2 -2
- package/src/ui/RatingBlock.tsx +18 -6
- package/src/ui/SeatSection/SeatSection.tsx +207 -0
- package/src/ui/TopAmenities/TopAmenities.tsx +127 -0
- package/src/ui/mobileweb/BottomAmenitiesMobile.tsx +169 -0
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +192 -0
- package/src/ui/mobileweb/ExpandedDropdownMobile.tsx +56 -0
- package/src/ui/mobileweb/SeatSectionMobile.tsx +256 -0
- package/src/ui/mobileweb/TopAmenitieMobile.tsx +126 -0
- package/src/utils/CommonService.ts +2 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import DateService from "../../utils/DateService";
|
|
3
2
|
import CommonService from "../../utils/CommonService";
|
|
4
3
|
import ModalEventManager from "../../utils/ModalEventManager";
|
|
5
4
|
import InternationalServicePopupBody from "../InternationalServicePopupBody";
|
|
6
5
|
import LottiePlayer from "../../assets/LottiePlayer";
|
|
7
6
|
import PeruServiceItemDesktop from "./PeruServiceItemDesktop";
|
|
7
|
+
import ExpandedDropdown from "../../ui/ExpendedDropDown/ExpandedDropdown";
|
|
8
8
|
import promoAnimation from "../../assets/images/anims/service_list/promocion.json";
|
|
9
9
|
import flexibleAnimation from "../../assets/images/anims/service_list/flexible.json";
|
|
10
10
|
import locationAnimation from "../../assets/images/anims/service_list/location.json";
|
|
@@ -15,70 +15,57 @@ import pullmanFlexibleAnimation from "../../assets/images/anims/service_list/pul
|
|
|
15
15
|
import pullmanPetFriendlyAnimation from "../../assets/images/anims/service_list/pullmanPetFriendly.json";
|
|
16
16
|
import pullmanLocationAnimation from "../../assets/images/anims/service_list/pullmanLocation.json";
|
|
17
17
|
import pullmanPriorityStageAnimation from "../../assets/images/anims/service_list/pullmanPriorityStage.json";
|
|
18
|
-
import pullmanPromoAnimation from "../../assets/images/anims/service_list/promocion.json";
|
|
19
|
-
import pullmanDirectoAnimation from "../../assets/images/anims/service_list/directo.json";
|
|
20
18
|
import opsitesFlexibleAnimation from "../../assets/images/anims/service_list/opsitesFlexible.json";
|
|
21
19
|
import opsitesPetFriendlyAnimation from "../../assets/images/anims/service_list/opsitesPetFriendly.json";
|
|
22
20
|
import opsitesLocationAnimation from "../../assets/images/anims/service_list/opsitesLocation.json";
|
|
23
21
|
import opsitesPriorityStageAnimation from "../../assets/images/anims/service_list/opsitesPriorityStage.json";
|
|
24
|
-
import
|
|
25
|
-
import opsitesDirectoAnimation from "../../assets/images/anims/service_list/directo.json";
|
|
26
|
-
import linatalFlexibleAnimation from "../../assets/images/anims/service_list/flexible.json";
|
|
27
|
-
import linatalPromoAnimation from "../../assets/images/anims/service_list/promocion.json";
|
|
28
|
-
import linatalDirectoAnimation from "../../assets/images/anims/service_list/directo.json";
|
|
29
|
-
import linatalPriorityStageAnimation from "../../assets/images/anims/service_list/priority_stage.json";
|
|
30
|
-
import linatalPetFriendlyAnimation from "../../assets/images/anims/service_list/pet_friendly.json";
|
|
31
|
-
import linatalLocationAnimation from "../../assets/images/anims/service_list/location.json";
|
|
22
|
+
import bombAnimation from "../../assets/images/anims/service_list/bomb.json";
|
|
32
23
|
import RatingBlock from "../../ui/RatingBlock";
|
|
33
24
|
import DurationBlock from "../../ui/DurationBlock";
|
|
25
|
+
import DirectoBlock from "../../ui/DirectoBlock";
|
|
34
26
|
import PetBlock from "../../ui/PetBlock";
|
|
35
27
|
import FlexibleBlock from "../../ui/FlexibleBlock";
|
|
36
28
|
import AmenitiesBlock from "../../ui/AmenitiesBlock";
|
|
37
|
-
import
|
|
29
|
+
import KuposButton from "../../ui/KuposButton/KuposButton";
|
|
30
|
+
import BottomAmenities from "../../ui/BottomAmenities/BottomAmenities";
|
|
31
|
+
import SeatSection from "../../ui/SeatSection/SeatSection";
|
|
32
|
+
import DateTimeSection from "../../ui/DateTimeSection/DateTimeSection";
|
|
38
33
|
const SEAT_EXCEPTIONS = ["Asiento mascota"];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
flexibleIcon: {
|
|
73
|
-
kupos: flexibleAnimation,
|
|
74
|
-
pullman: pullmanFlexibleAnimation,
|
|
75
|
-
opsites: opsitesFlexibleAnimation,
|
|
76
|
-
linatal: linatalFlexibleAnimation,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
34
|
+
const ANIMATION_MAP = {
|
|
35
|
+
promoAnim: {
|
|
36
|
+
kupos: promoAnimation,
|
|
37
|
+
},
|
|
38
|
+
locationAnim: {
|
|
39
|
+
kupos: locationAnimation,
|
|
40
|
+
pullman: pullmanLocationAnimation,
|
|
41
|
+
opsites: opsitesLocationAnimation,
|
|
42
|
+
},
|
|
43
|
+
directoAnim: {
|
|
44
|
+
kupos: directoAnimation,
|
|
45
|
+
},
|
|
46
|
+
petFriendlyAnim: {
|
|
47
|
+
kupos: petFriendlyAnimation,
|
|
48
|
+
pullman: pullmanPetFriendlyAnimation,
|
|
49
|
+
opsites: opsitesPetFriendlyAnimation,
|
|
50
|
+
},
|
|
51
|
+
priorityStageAnim: {
|
|
52
|
+
kupos: priorityStageAnimation,
|
|
53
|
+
pullman: pullmanPriorityStageAnimation,
|
|
54
|
+
opsites: opsitesPriorityStageAnimation,
|
|
55
|
+
},
|
|
56
|
+
flexibleIcon: {
|
|
57
|
+
kupos: flexibleAnimation,
|
|
58
|
+
pullman: pullmanFlexibleAnimation,
|
|
59
|
+
opsites: opsitesFlexibleAnimation,
|
|
60
|
+
},
|
|
61
|
+
bombAnimation: {
|
|
62
|
+
kupos: bombAnimation,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
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, }) {
|
|
79
66
|
const getAnimationIcon = (icon) => {
|
|
80
67
|
var _a;
|
|
81
|
-
const animation =
|
|
68
|
+
const animation = ANIMATION_MAP[icon];
|
|
82
69
|
if (!animation)
|
|
83
70
|
return null;
|
|
84
71
|
return (_a = animation[siteType]) !== null && _a !== void 0 ? _a : animation.kupos;
|
|
@@ -97,7 +84,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
97
84
|
const iconPath = getIconPath();
|
|
98
85
|
return (React.createElement("img", { src: iconPath, alt: name, style: {
|
|
99
86
|
filter: color === "white" ? "brightness(0) invert(1)" : "",
|
|
100
|
-
}, className:
|
|
87
|
+
}, className: "object-contain w-[16px] h-[16px]" }));
|
|
101
88
|
};
|
|
102
89
|
const labelId = typeof serviceItem.boarding_stages === "string"
|
|
103
90
|
? serviceItem.boarding_stages.split("|")[0]
|
|
@@ -107,98 +94,22 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
107
94
|
busStage[labelId].split("|")[1] === "true" &&
|
|
108
95
|
busStage[labelId].split("|")[0];
|
|
109
96
|
let isSoldOut = serviceItem.available_seats <= 0;
|
|
97
|
+
const showPromo = Math.random() > 0.5;
|
|
98
|
+
const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
|
|
99
|
+
const grayscaleClass = isSoldOut ? "grayscale" : "";
|
|
110
100
|
const renderIcon = (iconKey, size = "14px") => {
|
|
111
101
|
var _a;
|
|
112
102
|
const iconValue = (_a = serviceItem.icons) === null || _a === void 0 ? void 0 : _a[iconKey];
|
|
113
103
|
if (iconValue) {
|
|
114
104
|
if (typeof iconValue === "string") {
|
|
115
|
-
return (React.createElement("img", { src: iconValue, alt: iconKey, className: `${`w-[${size}] h-[${size}]`}
|
|
105
|
+
return (React.createElement("img", { src: iconValue, alt: iconKey, className: `${`w-[${size}] h-[${size}]`} ` }));
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
return null;
|
|
119
109
|
};
|
|
120
|
-
const getAllSeatTypes = () => {
|
|
121
|
-
var _a;
|
|
122
|
-
if (!((_a = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.seat_types) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
123
|
-
return [{ label: "Salon cama", price: 0 }];
|
|
124
|
-
}
|
|
125
|
-
let seatTypesWithPrices = serviceItem.seat_types
|
|
126
|
-
.filter((item) => getFilteredSeats(item))
|
|
127
|
-
.map((val) => ({
|
|
128
|
-
label: val === null || val === void 0 ? void 0 : val.label,
|
|
129
|
-
price: val === null || val === void 0 ? void 0 : val.fare,
|
|
130
|
-
}));
|
|
131
|
-
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
132
|
-
return seatTypesWithPrices;
|
|
133
|
-
};
|
|
134
|
-
const getSortedSeatTypes = () => {
|
|
135
|
-
var _a;
|
|
136
|
-
if (!((_a = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.seat_types) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
137
|
-
return [{ label: "Salon cama", price: 0 }];
|
|
138
|
-
}
|
|
139
|
-
let seatTypesWithPrices = getAllSeatTypes();
|
|
140
|
-
const premiumIndex = seatTypesWithPrices.findIndex((item) => item.label === "Premium");
|
|
141
|
-
if (premiumIndex >= 3) {
|
|
142
|
-
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
143
|
-
}
|
|
144
|
-
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
145
|
-
return seatTypesWithPrices;
|
|
146
|
-
};
|
|
147
|
-
const getUniqueSeats = () => {
|
|
148
|
-
const allSeatTypes = getAllSeatTypes();
|
|
149
|
-
const seatMap = new Map();
|
|
150
|
-
allSeatTypes.forEach((seat) => {
|
|
151
|
-
if (SEAT_EXCEPTIONS.includes(seat.label))
|
|
152
|
-
return;
|
|
153
|
-
// Only check if the label already exists in the map, don't compare prices
|
|
154
|
-
if (!seatMap.has(seat.label)) {
|
|
155
|
-
seatMap.set(seat.label, seat);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
return Array.from(seatMap.values());
|
|
159
|
-
};
|
|
160
|
-
const getNumberOfSeats = () => {
|
|
161
|
-
return serviceItem.seat_types.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
|
|
162
|
-
};
|
|
163
|
-
const getSeatNames = () => {
|
|
164
|
-
const uniqueSeats = getUniqueSeats();
|
|
165
|
-
const sortedSeatTypes = getSortedSeatTypes();
|
|
166
|
-
if (removeDuplicateSeats) {
|
|
167
|
-
return uniqueSeats.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"
|
|
168
|
-
? isPeru
|
|
169
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
170
|
-
: val.label
|
|
171
|
-
: null)));
|
|
172
|
-
}
|
|
173
|
-
return sortedSeatTypes.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"
|
|
174
|
-
? val.label
|
|
175
|
-
: null)));
|
|
176
|
-
};
|
|
177
|
-
const getSeatPrice = () => {
|
|
178
|
-
const sortedSeatTypes = getSortedSeatTypes();
|
|
179
|
-
const uniqueSeats = getUniqueSeats();
|
|
180
|
-
if (removeDuplicateSeats) {
|
|
181
|
-
return uniqueSeats.map((val, key) => (React.createElement("span", { key: key }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) <= 0
|
|
182
|
-
? CommonService.currency(0, currencySign)
|
|
183
|
-
: CommonService.currency(val.price, currencySign))));
|
|
184
|
-
}
|
|
185
|
-
return sortedSeatTypes.map((val, key) => {
|
|
186
|
-
return SEAT_EXCEPTIONS.includes(val.label) ? null : (React.createElement("span", { key: key, className: "flex items-center text-[13.33px] bold-text" }, typeof val.price === "string"
|
|
187
|
-
? (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) <= 0
|
|
188
|
-
? CommonService.currency(0, currencySign)
|
|
189
|
-
: CommonService.currency(val.price, currencySign)
|
|
190
|
-
: typeof val.price === "number"
|
|
191
|
-
? (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) <= 0
|
|
192
|
-
? CommonService.currency(0, currencySign)
|
|
193
|
-
: CommonService.currency(val.price, currencySign)
|
|
194
|
-
: null));
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
const getFilteredSeats = (item) => {
|
|
198
|
-
return item;
|
|
199
|
-
};
|
|
200
110
|
const checkMidnight = () => {
|
|
201
111
|
var _a, _b;
|
|
112
|
+
setIsExpand === null || setIsExpand === void 0 ? void 0 : setIsExpand(null);
|
|
202
113
|
if ((cityOrigin === null || cityOrigin === void 0 ? void 0 : cityOrigin.label) &&
|
|
203
114
|
(cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.label) &&
|
|
204
115
|
((cityOrigin.label.toLowerCase().includes("argentina") &&
|
|
@@ -269,45 +180,52 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
269
180
|
});
|
|
270
181
|
return;
|
|
271
182
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
183
|
+
onBookButtonPress();
|
|
184
|
+
};
|
|
185
|
+
const countdownSeconds = 7830;
|
|
186
|
+
const startCountdown = (node) => {
|
|
187
|
+
if (!node)
|
|
188
|
+
return;
|
|
189
|
+
const prevId = node.dataset.countdownId;
|
|
190
|
+
if (prevId)
|
|
191
|
+
clearInterval(Number(prevId));
|
|
192
|
+
let remaining = countdownSeconds;
|
|
193
|
+
const formatTime = (totalSecs) => {
|
|
194
|
+
const h = Math.floor(totalSecs / 3600);
|
|
195
|
+
const m = Math.floor((totalSecs % 3600) / 60);
|
|
196
|
+
const s = totalSecs % 60;
|
|
197
|
+
return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
|
|
198
|
+
};
|
|
199
|
+
node.textContent = formatTime(remaining);
|
|
200
|
+
const id = setInterval(() => {
|
|
201
|
+
remaining -= 1;
|
|
202
|
+
if (remaining <= 0) {
|
|
203
|
+
remaining = 0;
|
|
204
|
+
clearInterval(id);
|
|
205
|
+
}
|
|
206
|
+
node.textContent = formatTime(remaining);
|
|
207
|
+
}, 1000);
|
|
208
|
+
node.dataset.countdownId = String(id);
|
|
275
209
|
};
|
|
276
|
-
const depTime = serviceItem.dep_time || "";
|
|
277
|
-
// Extract hours and minutes and check for AM/PM
|
|
278
|
-
const hasAM = depTime.includes("AM");
|
|
279
|
-
const hasPM = depTime.includes("PM");
|
|
280
|
-
const [timePart] = depTime.split(/AM|PM/).map((part) => part.trim());
|
|
281
|
-
const [hour, minute] = timePart.split(":").map(Number);
|
|
282
|
-
// Convert to 24-hour format
|
|
283
|
-
let cleanedDepTime;
|
|
284
|
-
if (hasAM) {
|
|
285
|
-
cleanedDepTime =
|
|
286
|
-
hour === 12
|
|
287
|
-
? `00:${minute < 10 ? "0" + minute : minute}`
|
|
288
|
-
: `${hour < 10 ? "0" + hour : hour}:${minute < 10 ? "0" + minute : minute}`;
|
|
289
|
-
}
|
|
290
|
-
else if (hasPM) {
|
|
291
|
-
cleanedDepTime =
|
|
292
|
-
hour === 12
|
|
293
|
-
? `${hour}:${minute < 10 ? "0" + minute : minute}`
|
|
294
|
-
: `${hour + 12}:${minute < 10 ? "0" + minute : minute}`;
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
cleanedDepTime = timePart;
|
|
298
|
-
}
|
|
299
210
|
const items = [
|
|
300
211
|
{
|
|
301
|
-
key: "
|
|
302
|
-
width: "
|
|
303
|
-
|
|
212
|
+
key: "amenities",
|
|
213
|
+
width: "20%",
|
|
214
|
+
condition: true,
|
|
215
|
+
render: (React.createElement(AmenitiesBlock, { serviceItem: serviceItem, metaData: metaData, isSoldOut: isSoldOut, colors: colors, isPeru: isPeru, getAnimationIcon: getAnimationIcon, getAmenityName: CommonService.getAmenityName, SvgAmenities: SvgAmenities })),
|
|
304
216
|
},
|
|
305
217
|
{
|
|
306
218
|
key: "duration",
|
|
307
|
-
width: "
|
|
219
|
+
width: "12%",
|
|
308
220
|
condition: serviceItem.duration,
|
|
309
221
|
render: (React.createElement(DurationBlock, { serviceItem: serviceItem, translation: translation, renderIcon: renderIcon, isSoldOut: isSoldOut, colors: colors })),
|
|
310
222
|
},
|
|
223
|
+
{
|
|
224
|
+
key: "directo",
|
|
225
|
+
width: "12%",
|
|
226
|
+
condition: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) === true,
|
|
227
|
+
render: (React.createElement(DirectoBlock, { translation: translation, getAnimationIcon: getAnimationIcon, colors: colors, isSoldOut: isSoldOut })),
|
|
228
|
+
},
|
|
311
229
|
{
|
|
312
230
|
key: "pet",
|
|
313
231
|
width: "20%",
|
|
@@ -321,116 +239,87 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
321
239
|
condition: serviceItem.is_change_ticket === true,
|
|
322
240
|
render: (React.createElement(FlexibleBlock, { translation: translation, getAnimationIcon: getAnimationIcon, colors: colors, serviceItem: serviceItem, isSoldOut: isSoldOut })),
|
|
323
241
|
},
|
|
324
|
-
{
|
|
325
|
-
key: "amenities",
|
|
326
|
-
width: "20%",
|
|
327
|
-
render: (React.createElement(AmenitiesBlock, { serviceItem: serviceItem, metaData: metaData, isSoldOut: isSoldOut, colors: colors, isPeru: isPeru, getAnimationIcon: getAnimationIcon, getAmenityName: CommonService.getAmenityName, SvgAmenities: SvgAmenities })),
|
|
328
|
-
},
|
|
329
242
|
];
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
243
|
+
const otherItems = items.filter((i) => i.key !== "pet" && i.key !== "flexible" && !!i.condition);
|
|
244
|
+
return (React.createElement(React.Fragment, null, isPeruSites ? (React.createElement(PeruServiceItemDesktop, { serviceItem: serviceItem, onBookButtonPress: onBookButtonPress, colors: colors, metaData: metaData, children: children, busStage: busStage, serviceDetailsLoading: serviceDetailsLoading, cityOrigin: cityOrigin, cityDestination: cityDestination, translation: translation, orignLabel: orignLabel, destinationLabel: destinationLabel, currencySign: currencySign, isCiva: isCiva, showRating: showRating, showLastSeats: showLastSeats, removeArrivalTime: removeArrivalTime, removeDuplicateSeats: removeDuplicateSeats, isPeruSites: isPeruSites, t: (key) => t(key), showAvailableSeats: showAvailableSeats, isSeatIcon: isSeatIcon, isPeru: isPeru, siteType: siteType, isAllinBus: isAllinBus })) : (React.createElement("div", {
|
|
245
|
+
// className={`relative ${
|
|
246
|
+
// serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"
|
|
247
|
+
// } mt-[14px]`}
|
|
248
|
+
className: `relative ${serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"} ${(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) ||
|
|
333
249
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" ||
|
|
334
250
|
showTopLabel
|
|
335
251
|
? "mt-[24px]"
|
|
336
252
|
: "mt-[20px]"} ` },
|
|
337
|
-
React.createElement("div", { className: "bg-white rounded-[
|
|
338
|
-
React.createElement("div", {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
253
|
+
React.createElement("div", { id: `service-card-${serviceItem.id}`, className: "bg-white mx-auto relative rounded-[10px] border border-[#ccc]" },
|
|
254
|
+
React.createElement("div", {
|
|
255
|
+
// className="p-[15px] pt-[20px]"
|
|
256
|
+
className: " pt-[20px]", style: {
|
|
257
|
+
padding: coachKey
|
|
258
|
+
? "15px 15px 20px 15px"
|
|
259
|
+
: "20px 15px 11px 15px",
|
|
260
|
+
} },
|
|
261
|
+
React.createElement("div", {
|
|
262
|
+
// className="grid text-[#464647] w-full [grid-template-columns:18%_28%_2.5%_28%_15.5%] gap-x-[2%] items-center"
|
|
263
|
+
className: "grid text-[#464647] w-full [grid-template-columns:22%_28%_2.5%_24%_15.5%] gap-x-[2%] items-center" },
|
|
264
|
+
React.createElement("div", { style: {
|
|
265
|
+
display: "flex",
|
|
266
|
+
flexDirection: "column",
|
|
267
|
+
gap: "5px",
|
|
346
268
|
} },
|
|
347
|
-
React.createElement("div", {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
React.createElement(StageTooltip, { stageData: serviceItem.boarding_stages, direction: 1, terminals: busStage, serviceItem: serviceItem, metaData: metaData, colors: colors },
|
|
355
|
-
React.createElement("span", { className: "cursor-pointer bold-text capitalize" }, DateService.getServiceItemDate(serviceItem.travel_date))),
|
|
356
|
-
!isCiva && (React.createElement(StageTooltip, { stageData: serviceItem.boarding_stages, direction: 1, terminals: busStage, serviceItem: serviceItem, metaData: metaData, colors: colors },
|
|
357
|
-
React.createElement("span", { className: "cursor-pointer bold-text capitalize" }, DateService.getServiceItemDate(serviceItem.arrival_date))))),
|
|
358
|
-
React.createElement("div", { className: "flex flex-col gap-[6px] items-center" },
|
|
359
|
-
React.createElement("div", { className: "h-[20px] flex items-center justify-center" },
|
|
360
|
-
React.createElement("div", null, "\u2022")),
|
|
361
|
-
!isCiva && (React.createElement("div", { className: "h-[20px] flex items-center justify-center" }, removeArrivalTime ? null : serviceItem.arr_time ? (React.createElement("div", null, "\u2022")) : null))),
|
|
362
|
-
React.createElement("div", { className: "flex flex-col gap-[6px]" },
|
|
363
|
-
React.createElement(StageTooltip, { stageData: serviceItem.dropoff_stages, direction: 2, terminals: busStage, serviceItem: serviceItem, metaData: metaData, colors: colors },
|
|
364
|
-
React.createElement("div", { className: "font-[900] bold-text" }, isLinatal ? (React.createElement(React.Fragment, null,
|
|
365
|
-
cleanedDepTime,
|
|
366
|
-
" ",
|
|
367
|
-
React.createElement("span", null, hasPM ? "PM" : hasAM ? "AM" : ""),
|
|
368
|
-
!(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dep_time.includes("AM")) &&
|
|
369
|
-
!(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dep_time.includes("PM")) &&
|
|
370
|
-
DateService.ampmOnly(serviceItem.dep_time))) : (DateService.formatTime(serviceItem.dep_time)))),
|
|
371
|
-
!isCiva && (React.createElement(StageTooltip, { stageData: serviceItem.dropoff_stages, direction: 2, terminals: busStage, serviceItem: serviceItem, metaData: metaData, colors: colors },
|
|
372
|
-
React.createElement("div", { className: "font-[900] bold-text" }, removeArrivalTime
|
|
373
|
-
? null
|
|
374
|
-
: serviceItem.arr_time
|
|
375
|
-
? DateService.formatTime(serviceItem.arr_time)
|
|
376
|
-
: null))))),
|
|
269
|
+
React.createElement("div", {
|
|
270
|
+
// className="flex items-center justify-center m-[auto]"
|
|
271
|
+
className: "" },
|
|
272
|
+
React.createElement("img", { src: serviceItem.operator_details[0], alt: "service logo", className: `h-auto w-[150px] object-contain ${isSoldOut ? "grayscale" : ""}` }),
|
|
273
|
+
isCiva ? (React.createElement("div", { className: "text-[13.33px] black-text ml-2" }, serviceItem.operator_details[2])) : null),
|
|
274
|
+
React.createElement(RatingBlock, { showRating: showRating, serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation, isPeru: isPeru })),
|
|
275
|
+
React.createElement(DateTimeSection, { serviceItem: serviceItem, isSoldOut: isSoldOut, isCiva: isCiva, isLinatal: isLinatal, removeArrivalTime: removeArrivalTime, orignLabel: orignLabel, destinationLabel: destinationLabel, busStage: busStage, metaData: metaData, colors: colors }),
|
|
377
276
|
React.createElement("div", { style: {
|
|
378
277
|
width: "1px",
|
|
379
278
|
height: "2.5rem",
|
|
380
279
|
backgroundColor: "#ccc",
|
|
381
280
|
} }),
|
|
382
281
|
React.createElement("div", { className: "content-center" },
|
|
383
|
-
React.createElement(
|
|
384
|
-
? { alignItems: "center" }
|
|
385
|
-
: {} },
|
|
386
|
-
React.createElement("div", { className: "flex flex-col justify-between", style: { gap: "10px" } }, getSeatNames()),
|
|
387
|
-
React.createElement("div", { className: "flex flex-col justify-between absolute inset-y-0 right-0 left-1/2 h-full", style: {
|
|
388
|
-
color: isSoldOut ? "#c0c0c0" : colors.priceColor,
|
|
389
|
-
top: 0,
|
|
390
|
-
bottom: 0,
|
|
391
|
-
left: "clamp(60%, 65% + (100vw - 1300px) * 0.1, 65%)",
|
|
392
|
-
// left: "68%",
|
|
393
|
-
right: 0,
|
|
394
|
-
justifyContent: getNumberOfSeats() < 2 || removeDuplicateSeats
|
|
395
|
-
? "center"
|
|
396
|
-
: "",
|
|
397
|
-
gap: "10px",
|
|
398
|
-
} }, getSeatPrice()))),
|
|
282
|
+
React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru })),
|
|
399
283
|
React.createElement("div", null,
|
|
400
|
-
React.createElement("
|
|
401
|
-
?
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
// .join(" "),
|
|
421
|
-
} }, otherItems.map((item) => (React.createElement("div", { key: item.key, className: "flex items-center " }, item.render)))),
|
|
422
|
-
React.createElement("div", { className: "flex items-center ml-[12px] shrink-0 w-[130px] justify-end" }, amenitiesItem === null || amenitiesItem === void 0 ? void 0 : amenitiesItem.render)))),
|
|
284
|
+
showLastSeats ? (React.createElement("div", { className: "flex justify-end mr-[11px] ", style: {
|
|
285
|
+
marginBottom: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
|
|
286
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0
|
|
287
|
+
? "6px"
|
|
288
|
+
: "0",
|
|
289
|
+
} }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
|
|
290
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0 && (React.createElement("div", { className: "text-[12.5px] text-[#464647] mt-1 text-center" }, "\u00A1\u00DAltimos Asientos!")))) : null,
|
|
291
|
+
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 }))),
|
|
292
|
+
React.createElement(BottomAmenities, { otherItems: otherItems, serviceItem: serviceItem, grayscaleClass: grayscaleClass, isSoldOut: isSoldOut, isItemExpanded: isItemExpanded, colors: colors, translation: translation, getAnimationIcon: getAnimationIcon, downArrowIcon: renderIcon("downArrow", "10px"), onToggleExpand: () => setIsExpand &&
|
|
293
|
+
setIsExpand(isItemExpanded ? null : serviceItem.id) }))),
|
|
294
|
+
React.createElement("div", { style: {
|
|
295
|
+
display: "grid",
|
|
296
|
+
gridTemplateRows: isItemExpanded ? "1fr" : "0fr",
|
|
297
|
+
opacity: isItemExpanded ? 1 : 0,
|
|
298
|
+
transition: "grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
299
|
+
position: "relative",
|
|
300
|
+
zIndex: -1,
|
|
301
|
+
} },
|
|
302
|
+
React.createElement("div", { style: { overflow: "hidden", minHeight: 0, marginTop: "-10px" } },
|
|
303
|
+
React.createElement(ExpandedDropdown, { serviceItem: serviceItem }))),
|
|
423
304
|
children,
|
|
424
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) && (React.createElement("div", { className:
|
|
425
|
-
backgroundColor:
|
|
426
|
-
? colors === null || colors === void 0 ? void 0 : colors.bottomStripColor
|
|
427
|
-
: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
|
|
305
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) && (React.createElement("div", { className: "text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[36px] pt-[50px] -z-10 rounded-b-[14px] text-[14px]", style: {
|
|
306
|
+
backgroundColor: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
|
|
428
307
|
opacity: isSoldOut ? 0.5 : 1,
|
|
429
308
|
} },
|
|
430
|
-
React.createElement(LottiePlayer, { animationData: getAnimationIcon("
|
|
431
|
-
React.createElement("
|
|
309
|
+
React.createElement(LottiePlayer, { animationData: getAnimationIcon("bombAnimation"), width: "18px", height: "18px" }),
|
|
310
|
+
React.createElement("div", { className: "flex items-center mt-[2px]" },
|
|
311
|
+
React.createElement("span", { className: "bold-text ml-[6px]" },
|
|
312
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) || "",
|
|
313
|
+
"\u00A0"),
|
|
314
|
+
" ",
|
|
315
|
+
"| Termina en\u00A0",
|
|
316
|
+
React.createElement("span", { className: "bold-text text-end", ref: startCountdown, style: {
|
|
317
|
+
fontVariantNumeric: "tabular-nums",
|
|
318
|
+
display: "inline-block",
|
|
319
|
+
// minWidth: "70px",
|
|
320
|
+
} })))),
|
|
432
321
|
React.createElement("div", { className: "absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[15px] z-10 " },
|
|
433
|
-
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[10px] py-[4px] px-[14px] rounded-[38px] text-[12.5px] z-
|
|
322
|
+
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[10px] py-[4px] px-[14px] rounded-[38px] text-[12.5px] z-10`, style: {
|
|
434
323
|
backgroundColor: isSoldOut
|
|
435
324
|
? "#ddd"
|
|
436
325
|
: colors.ratingBottomColor,
|
|
@@ -449,15 +338,6 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
449
338
|
// animationData={getAnimationIcon(connectingServiceIcon)}
|
|
450
339
|
width: "14px", height: "14px" }),
|
|
451
340
|
React.createElement("div", null, "Conexión"))),
|
|
452
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && (React.createElement("div", { className: `flex items-center gap-[10px] py-[4px] text-white px-[14px] rounded-[38px] text-[12.5px] z-20 `, style: {
|
|
453
|
-
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
454
|
-
} },
|
|
455
|
-
React.createElement(LottiePlayer
|
|
456
|
-
// animationData={serviceItem.icons.directoAnim}
|
|
457
|
-
, {
|
|
458
|
-
// animationData={serviceItem.icons.directoAnim}
|
|
459
|
-
animationData: getAnimationIcon("directoAnim"), width: "14px", height: "14px" }),
|
|
460
|
-
React.createElement("div", null, translation === null || translation === void 0 ? void 0 : translation.directService))),
|
|
461
341
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" && (React.createElement("div", { className: `flex items-center gap-[10px] py-[4px] text-white px-[14px] rounded-[38px] text-[12.5px] z-20 `, style: {
|
|
462
342
|
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
463
343
|
} },
|
|
@@ -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, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, }: MobileServiceItemProps): React.ReactElement;
|
|
3
|
+
declare function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, }: MobileServiceItemProps): React.ReactElement;
|
|
4
4
|
export default ServiceItemMobile;
|