kupos-ui-components-lib 9.0.7 → 9.0.8

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