kupos-ui-components-lib 9.0.4 → 9.0.6

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 (57) hide show
  1. package/README copy.md +223 -67
  2. package/dist/assets/images/anims/service_list/bomb.json +1 -0
  3. package/dist/assets/images/anims/service_list/directo.json +1 -1
  4. package/dist/assets/images/anims/service_list/priority_stage.json +1 -1
  5. package/dist/components/ServiceItem/ExpandedDropdown.d.ts +19 -0
  6. package/dist/components/ServiceItem/ExpandedDropdown.js +28 -0
  7. package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
  8. package/dist/components/ServiceItem/ServiceItemDesktop.js +125 -262
  9. package/dist/components/ServiceItem/ServiceItemMobile.js +44 -291
  10. package/dist/components/ServiceItem/mobileTypes.d.ts +3 -0
  11. package/dist/components/ServiceItem/types.d.ts +7 -0
  12. package/dist/styles.css +67 -12
  13. package/dist/ui/AmenitiesBlock.js +60 -66
  14. package/dist/ui/BottomAmenities/BottomAmenities.d.ts +26 -0
  15. package/dist/ui/BottomAmenities/BottomAmenities.js +22 -0
  16. package/dist/ui/DurationBlock.js +2 -2
  17. package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +19 -0
  18. package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +27 -0
  19. package/dist/ui/FlexibleBlock.js +2 -4
  20. package/dist/ui/KuposButton/KuposButton.d.ts +12 -0
  21. package/dist/ui/KuposButton/KuposButton.js +12 -0
  22. package/dist/ui/PetBlock.js +1 -3
  23. package/dist/ui/RatingBlock.js +6 -2
  24. package/dist/ui/SeatSection/SeatSection.d.ts +17 -0
  25. package/dist/ui/SeatSection/SeatSection.js +92 -0
  26. package/dist/ui/TopAmenities/TopAmenities.d.ts +12 -0
  27. package/dist/ui/TopAmenities/TopAmenities.js +32 -0
  28. package/dist/ui/mobileweb/BottomAmenitiesMobile.d.ts +23 -0
  29. package/dist/ui/mobileweb/BottomAmenitiesMobile.js +37 -0
  30. package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +23 -0
  31. package/dist/ui/mobileweb/DateTimeSectionMobile.js +57 -0
  32. package/dist/ui/mobileweb/SeatSectionMobile.d.ts +17 -0
  33. package/dist/ui/mobileweb/SeatSectionMobile.js +100 -0
  34. package/dist/ui/mobileweb/TopAmenitieMobile.d.ts +10 -0
  35. package/dist/ui/mobileweb/TopAmenitieMobile.js +35 -0
  36. package/package.json +1 -1
  37. package/src/assets/images/anims/service_list/bomb.json +1 -0
  38. package/src/assets/images/anims/service_list/directo.json +1 -1
  39. package/src/assets/images/anims/service_list/priority_stage.json +1 -1
  40. package/src/components/ServiceItem/ServiceItemDesktop.tsx +222 -465
  41. package/src/components/ServiceItem/ServiceItemMobile.tsx +120 -501
  42. package/src/components/ServiceItem/mobileTypes.ts +3 -0
  43. package/src/components/ServiceItem/types.ts +7 -0
  44. package/src/ui/AmenitiesBlock.tsx +115 -97
  45. package/src/ui/BottomAmenities/BottomAmenities.tsx +109 -0
  46. package/src/ui/DurationBlock.tsx +2 -2
  47. package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +85 -0
  48. package/src/ui/FlexibleBlock.tsx +3 -3
  49. package/src/ui/KuposButton/KuposButton.tsx +48 -0
  50. package/src/ui/PetBlock.tsx +2 -2
  51. package/src/ui/RatingBlock.tsx +16 -4
  52. package/src/ui/SeatSection/SeatSection.tsx +187 -0
  53. package/src/ui/TopAmenities/TopAmenities.tsx +82 -0
  54. package/src/ui/mobileweb/BottomAmenitiesMobile.tsx +168 -0
  55. package/src/ui/mobileweb/DateTimeSectionMobile.tsx +192 -0
  56. package/src/ui/mobileweb/SeatSectionMobile.tsx +256 -0
  57. package/src/ui/mobileweb/TopAmenitieMobile.tsx +82 -0
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import LottiePlayer from "../../assets/LottiePlayer";
3
+ function ExpandedDropdown({ serviceItem, showPromo, colors, grayscaleClass, translation, getAnimationIcon, }) {
4
+ const hasPetInfo = serviceItem.pet_seat_info &&
5
+ Object.keys(serviceItem.pet_seat_info).length > 0;
6
+ return (React.createElement("div", { className: "px-[15px] pt-[26px] pb-[14px] -mt-[16px] pt-[20px] relative -z-9", style: {
7
+ backgroundColor: "#f5f5f5",
8
+ borderRadius: "0 0 10px 10px",
9
+ border: showPromo
10
+ ? `1px solid ${colors.priceColor}`
11
+ : "1px solid #ccc",
12
+ borderTop: "none",
13
+ } },
14
+ React.createElement("div", { className: "flex flex-col gap-[12px] text-[13px] text-[#464647]" },
15
+ hasPetInfo && (React.createElement("div", { className: "flex items-center gap-[10px]" },
16
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("petFriendlyAnim"), width: "20px", height: "20px" }),
17
+ React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647] bold-text" },
18
+ React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.petFriendly)))),
19
+ serviceItem.is_change_ticket && (React.createElement("div", { className: "flex items-center gap-[10px]" },
20
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("flexibleIcon"), width: "20px", height: "20px" }),
21
+ React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647] bold-text" },
22
+ React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.flexible)))),
23
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_tracking_enabled) && (React.createElement("div", { className: `${grayscaleClass} flex items-center gap-[10px]` },
24
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("locationAnim"), width: "20px", height: "20px" }),
25
+ React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647] bold-text" },
26
+ React.createElement("span", null, "GPS Tracker")))))));
27
+ }
28
+ export default ExpandedDropdown;
@@ -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, }: ServiceItemProps & {
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, }: ServiceItemProps & {
4
4
  currencySign?: string;
5
5
  }): React.ReactElement;
6
6
  export default ServiceItemPB;
@@ -5,6 +5,7 @@ import ModalEventManager from "../../utils/ModalEventManager";
5
5
  import InternationalServicePopupBody from "../InternationalServicePopupBody";
6
6
  import LottiePlayer from "../../assets/LottiePlayer";
7
7
  import PeruServiceItemDesktop from "./PeruServiceItemDesktop";
8
+ import ExpandedDropdown from "../../ui/ExpendedDropDown/ExpandedDropdown";
8
9
  import promoAnimation from "../../assets/images/anims/service_list/promocion.json";
9
10
  import flexibleAnimation from "../../assets/images/anims/service_list/flexible.json";
10
11
  import locationAnimation from "../../assets/images/anims/service_list/location.json";
@@ -15,70 +16,72 @@ import pullmanFlexibleAnimation from "../../assets/images/anims/service_list/pul
15
16
  import pullmanPetFriendlyAnimation from "../../assets/images/anims/service_list/pullmanPetFriendly.json";
16
17
  import pullmanLocationAnimation from "../../assets/images/anims/service_list/pullmanLocation.json";
17
18
  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
19
  import opsitesFlexibleAnimation from "../../assets/images/anims/service_list/opsitesFlexible.json";
21
20
  import opsitesPetFriendlyAnimation from "../../assets/images/anims/service_list/opsitesPetFriendly.json";
22
21
  import opsitesLocationAnimation from "../../assets/images/anims/service_list/opsitesLocation.json";
23
22
  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";
23
+ import bombAnimation from "../../assets/images/anims/service_list/bomb.json";
32
24
  import RatingBlock from "../../ui/RatingBlock";
33
25
  import DurationBlock from "../../ui/DurationBlock";
34
26
  import PetBlock from "../../ui/PetBlock";
35
27
  import FlexibleBlock from "../../ui/FlexibleBlock";
36
28
  import AmenitiesBlock from "../../ui/AmenitiesBlock";
37
29
  import StageTooltip from "../../ui/StagesTooltip";
30
+ import KuposButton from "../../ui/KuposButton/KuposButton";
31
+ import TopAmenities from "../../ui/TopAmenities/TopAmenities";
32
+ import BottomAmenities from "../../ui/BottomAmenities/BottomAmenities";
33
+ import SeatSection from "../../ui/SeatSection/SeatSection";
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, }) {
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
+ const convertTo24Hour = (depTime) => {
67
+ const hasAM = depTime.includes("AM");
68
+ const hasPM = depTime.includes("PM");
69
+ const [timePart] = depTime.split(/AM|PM/).map((part) => part.trim());
70
+ const [hour, minute] = timePart.split(":").map(Number);
71
+ const pad = (n) => (n < 10 ? "0" + n : String(n));
72
+ if (hasAM) {
73
+ return `${pad(hour === 12 ? 0 : hour)}:${pad(minute)}`;
74
+ }
75
+ if (hasPM) {
76
+ return `${hour === 12 ? hour : hour + 12}:${pad(minute)}`;
77
+ }
78
+ return timePart;
79
+ };
80
+ 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, }) {
40
81
  var _a, _b;
41
- const animationMap = {
42
- promoAnim: {
43
- kupos: promoAnimation,
44
- pullman: pullmanPromoAnimation,
45
- opsites: opsitesPromoAnimation,
46
- linatal: linatalPromoAnimation,
47
- },
48
- locationAnim: {
49
- kupos: locationAnimation,
50
- pullman: pullmanLocationAnimation,
51
- opsites: opsitesLocationAnimation,
52
- linatal: linatalLocationAnimation,
53
- },
54
- directoAnim: {
55
- kupos: directoAnimation,
56
- pullman: pullmanDirectoAnimation,
57
- opsites: opsitesDirectoAnimation,
58
- linatal: linatalDirectoAnimation,
59
- },
60
- petFriendlyAnim: {
61
- kupos: petFriendlyAnimation,
62
- pullman: pullmanPetFriendlyAnimation,
63
- opsites: opsitesPetFriendlyAnimation,
64
- linatal: linatalPetFriendlyAnimation,
65
- },
66
- priorityStageAnim: {
67
- kupos: priorityStageAnimation,
68
- pullman: pullmanPriorityStageAnimation,
69
- opsites: opsitesPriorityStageAnimation,
70
- linatal: linatalPriorityStageAnimation,
71
- },
72
- flexibleIcon: {
73
- kupos: flexibleAnimation,
74
- pullman: pullmanFlexibleAnimation,
75
- opsites: opsitesFlexibleAnimation,
76
- linatal: linatalFlexibleAnimation,
77
- },
78
- };
79
82
  const getAnimationIcon = (icon) => {
80
83
  var _a;
81
- const animation = animationMap[icon];
84
+ const animation = ANIMATION_MAP[icon];
82
85
  if (!animation)
83
86
  return null;
84
87
  return (_a = animation[siteType]) !== null && _a !== void 0 ? _a : animation.kupos;
@@ -97,7 +100,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
97
100
  const iconPath = getIconPath();
98
101
  return (React.createElement("img", { src: iconPath, alt: name, style: {
99
102
  filter: color === "white" ? "brightness(0) invert(1)" : "",
100
- }, className: `object-contain ${moreAnemities ? "w-[16px] h-[16px]" : "w-[16px] h-[16px]"}` }));
103
+ }, className: "object-contain w-[16px] h-[16px]" }));
101
104
  };
102
105
  const labelId = typeof serviceItem.boarding_stages === "string"
103
106
  ? serviceItem.boarding_stages.split("|")[0]
@@ -107,98 +110,22 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
107
110
  busStage[labelId].split("|")[1] === "true" &&
108
111
  busStage[labelId].split("|")[0];
109
112
  let isSoldOut = serviceItem.available_seats <= 0;
113
+ const showPromo = Math.random() > 0.5;
114
+ const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
115
+ const grayscaleClass = isSoldOut ? "grayscale" : "";
110
116
  const renderIcon = (iconKey, size = "14px") => {
111
117
  var _a;
112
118
  const iconValue = (_a = serviceItem.icons) === null || _a === void 0 ? void 0 : _a[iconKey];
113
119
  if (iconValue) {
114
120
  if (typeof iconValue === "string") {
115
- return (React.createElement("img", { src: iconValue, alt: iconKey, className: `${`w-[${size}] h-[${size}]`} mr-[5px]` }));
121
+ return (React.createElement("img", { src: iconValue, alt: iconKey, className: `${`w-[${size}] h-[${size}]`} ` }));
116
122
  }
117
123
  }
118
124
  return null;
119
125
  };
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
126
  const checkMidnight = () => {
201
127
  var _a, _b;
128
+ setIsExpand(null);
202
129
  if ((cityOrigin === null || cityOrigin === void 0 ? void 0 : cityOrigin.label) &&
203
130
  (cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.label) &&
204
131
  ((cityOrigin.label.toLowerCase().includes("argentina") &&
@@ -269,45 +196,33 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
269
196
  });
270
197
  return;
271
198
  }
272
- else {
273
- onBookButtonPress();
274
- }
199
+ onBookButtonPress();
275
200
  };
276
201
  const depTime = serviceItem.dep_time || "";
277
- // Extract hours and minutes and check for AM/PM
278
202
  const hasAM = depTime.includes("AM");
279
203
  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
- }
204
+ const cleanedDepTime = convertTo24Hour(depTime);
299
205
  const items = [
300
206
  {
301
- key: "rating",
302
- width: "30%",
303
- render: (React.createElement(RatingBlock, { showRating: showRating, serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation })),
207
+ key: "amenities",
208
+ width: "20%",
209
+ condition: true,
210
+ render: (React.createElement(AmenitiesBlock, { serviceItem: serviceItem, metaData: metaData, isSoldOut: isSoldOut, colors: colors, isPeru: isPeru, getAnimationIcon: getAnimationIcon, getAmenityName: CommonService.getAmenityName, SvgAmenities: SvgAmenities })),
304
211
  },
305
212
  {
306
213
  key: "duration",
307
- width: "20%",
214
+ width: "12%",
308
215
  condition: serviceItem.duration,
309
216
  render: (React.createElement(DurationBlock, { serviceItem: serviceItem, translation: translation, renderIcon: renderIcon, isSoldOut: isSoldOut, colors: colors })),
310
217
  },
218
+ {
219
+ key: "directo",
220
+ width: "12%",
221
+ condition: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip,
222
+ render: (React.createElement("div", { className: "flex items-center gap-[10px] text-[12.5px] z-10 mt-[6px]" },
223
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("directoAnim"), width: "14px", height: "14px" }),
224
+ React.createElement("div", null, translation === null || translation === void 0 ? void 0 : translation.directService))),
225
+ },
311
226
  {
312
227
  key: "pet",
313
228
  width: "20%",
@@ -321,35 +236,50 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
321
236
  condition: serviceItem.is_change_ticket,
322
237
  render: (React.createElement(FlexibleBlock, { translation: translation, getAnimationIcon: getAnimationIcon, colors: colors, serviceItem: serviceItem, isSoldOut: isSoldOut })),
323
238
  },
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
239
  ];
330
- const amenitiesItem = items.find((i) => i.key === "amenities");
331
- const otherItems = items.filter((i) => i.key !== "amenities" && i.condition !== false);
332
- 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) ||
333
- (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" ||
334
- showTopLabel
335
- ? "mt-[24px]"
336
- : "mt-[20px]"} ` },
337
- React.createElement("div", { className: "bg-white rounded-[20px] shadow-service mx-auto relative" },
338
- React.createElement("div", { className: "p-[15px] pt-[20px]" },
339
- 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" : "" } },
340
- React.createElement("div", { className: "flex items-center justify-center m-[auto]" },
341
- React.createElement("div", { className: " " },
342
- React.createElement("img", { src: serviceItem.operator_details[0], alt: "service logo", className: ` h-auto object-contain ${isSoldOut ? "grayscale" : ""}` })),
343
- isCiva ? (React.createElement("div", { className: "text-[13.33px] black-text ml-2" }, serviceItem.operator_details[2])) : null),
240
+ const otherItems = items.filter((i) => i.key !== "pet" && i.key !== "flexible" && !!i.condition);
241
+ 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]` },
242
+ React.createElement(TopAmenities, { showPromo: showPromo, showTopLabel: showTopLabel, isSoldOut: isSoldOut, priceColor: colors.priceColor, buttonColor: colors.kuposButtonColor, boardingIcon: renderIcon("whiteBoardingIcon", "14px"), getAnimationIcon: getAnimationIcon }),
243
+ React.createElement("div", { className: "bg-white mx-auto relative", style: {
244
+ border: `1px solid ${colors.priceColor}`,
245
+ // showPromo
246
+ // ? `1px solid ${colors.priceColor}`
247
+ // : "1px solid #ccc",
248
+ borderRadius:
249
+ // showPromo || showTopLabel ?
250
+ "10px 0 10px 10px",
251
+ // : "10px",
252
+ } },
253
+ React.createElement("div", {
254
+ // className="p-[15px] pt-[20px]"
255
+ className: " pt-[20px]", style: {
256
+ padding: coachKey
257
+ ? "15px 15px 20px 15px"
258
+ : "20px 15px 11px 15px",
259
+ } },
260
+ React.createElement("div", {
261
+ // className="grid text-[#464647] w-full [grid-template-columns:18%_28%_2.5%_28%_15.5%] gap-x-[2%] items-center"
262
+ className: "grid text-[#464647] w-full [grid-template-columns:22%_28%_2.5%_24%_15.5%] gap-x-[2%] items-center" },
263
+ React.createElement("div", { style: {
264
+ display: "flex",
265
+ flexDirection: "column",
266
+ gap: "5px",
267
+ } },
268
+ React.createElement("div", {
269
+ // className="flex items-center justify-center m-[auto]"
270
+ className: "" },
271
+ React.createElement("img", { src: serviceItem.operator_details[0], alt: "service logo", className: `h-auto w-[150px] object-contain ${isSoldOut ? "grayscale" : ""}` }),
272
+ isCiva ? (React.createElement("div", { className: "text-[13.33px] black-text ml-2" }, serviceItem.operator_details[2])) : null),
273
+ React.createElement(RatingBlock, { showRating: showRating, serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation })),
344
274
  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: {
345
275
  gridTemplateRows: "1fr",
346
276
  } },
347
277
  React.createElement("div", { className: "flex flex-col gap-[6px]" },
348
278
  orignLabel ? (React.createElement("div", { className: "w-[60px] h-[20px] flex items-center" }, orignLabel)) : (React.createElement("div", { className: "h-[20px] flex items-center" },
349
- 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" : ""}` }))),
279
+ React.createElement("img", { src: (_a = serviceItem.icons) === null || _a === void 0 ? void 0 : _a.origin, alt: "origin", className: `w-[16px] h-auto mr-[8px] ${isSoldOut ? "grayscale" : ""}` }))),
350
280
  !isCiva &&
351
281
  (destinationLabel ? (React.createElement("div", { className: "w-[60px] h-[20px] flex items-center" }, destinationLabel)) : (React.createElement("div", { className: "h-[20px] flex items-center" },
352
- 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 } }))))),
282
+ React.createElement("img", { src: (_b = serviceItem.icons) === null || _b === void 0 ? void 0 : _b.destination, className: `w-[16px] h-auto mr-[8px] ${isSoldOut ? "grayscale" : ""}`, style: { opacity: isSoldOut ? 0.5 : 1 } }))))),
353
283
  React.createElement("div", { className: "flex flex-col gap-[6px]" },
354
284
  React.createElement(StageTooltip, { stageData: serviceItem.boarding_stages, direction: 1, terminals: busStage, serviceItem: serviceItem, metaData: metaData, colors: colors },
355
285
  React.createElement("span", { className: "cursor-pointer bold-text capitalize" }, DateService.getServiceItemDate(serviceItem.travel_date))),
@@ -380,92 +310,25 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
380
310
  backgroundColor: "#ccc",
381
311
  } }),
382
312
  React.createElement("div", { className: "content-center" },
383
- React.createElement("div", { className: `relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.5rem] ${getNumberOfSeats() < 3 ? "" : ""}`, style: getNumberOfSeats() < 2 || removeDuplicateSeats
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()))),
313
+ React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru })),
399
314
  React.createElement("div", null,
400
- React.createElement("button", { onClick: () => (!isSoldOut ? checkMidnight() : null), disabled: serviceDetailsLoading, className: `w-full ${serviceDetailsLoading || isSoldOut
401
- ? "py-[12px]"
402
- : "py-[12px]"} text-[13.33px] font-bold text-white rounded-[10px] border-none px-[20px] flex items-center justify-center`, style: {
403
- backgroundColor: serviceDetailsLoading || isSoldOut
404
- ? "lightgray"
405
- : colors.kuposButtonColor,
406
- cursor: serviceDetailsLoading || isSoldOut
407
- ? "not-allowed"
408
- : "pointer",
409
- } },
410
- React.createElement("span", { className: "min-w-[75px] flex justify-center items-center bold-text uppercase" },
411
- isSoldOut ? renderIcon("soldOutIcon", "14px") : null,
412
- 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))))),
413
- showLastSeats ? (React.createElement("div", { className: "flex justify-end mr-[11px]" }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
414
- (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,
415
- React.createElement("div", { className: "flex items-center mt-[15px] border-t border-[#eee] pt-[10px]" },
416
- React.createElement("div", { className: "grid items-center gap-[2%] flex-1", style: {
417
- gridTemplateColumns: "40% 18% 23% 23%",
418
- // otherItems
419
- // .map((i) => i.width)
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)))),
315
+ showLastSeats ? (React.createElement("div", { className: "flex justify-end mr-[11px] ", style: {
316
+ marginBottom: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
317
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0
318
+ ? "6px"
319
+ : "0",
320
+ } }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
321
+ (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,
322
+ 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 }))),
323
+ 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 &&
324
+ setIsExpand(isItemExpanded ? null : serviceItem.id) }))),
325
+ isItemExpanded && (React.createElement(ExpandedDropdown, { serviceItem: serviceItem, showPromo: showPromo, colors: colors, grayscaleClass: grayscaleClass, translation: translation, getAnimationIcon: getAnimationIcon })),
423
326
  children,
424
- (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: {
425
- backgroundColor: isSoldOut
426
- ? colors === null || colors === void 0 ? void 0 : colors.bottomStripColor
427
- : colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
327
+ (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: {
328
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
428
329
  opacity: isSoldOut ? 0.5 : 1,
429
330
  } },
430
331
  React.createElement(LottiePlayer, { animationData: getAnimationIcon("promoAnim"), width: "18px", height: "18px" }),
431
- React.createElement("span", { className: "ml-[10px]" }, serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text))),
432
- 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-20`, style: {
434
- backgroundColor: isSoldOut
435
- ? "#ddd"
436
- : colors.ratingBottomColor,
437
- } },
438
- React.createElement("div", { className: isSoldOut ? "grayscale" : "" },
439
- React.createElement(LottiePlayer
440
- // animationData={serviceItem.icons.priorityStageAnim}
441
- , {
442
- // animationData={serviceItem.icons.priorityStageAnim}
443
- animationData: getAnimationIcon("priorityStageAnim"), width: "14px", height: "14px" })),
444
- React.createElement("div", { className: isSoldOut ? "text-white" : `text-[${colors.topLabelColor}]` }, showTopLabel))),
445
- (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: {
446
- backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
447
- } },
448
- React.createElement(LottiePlayer, { animationData: serviceItem.icons.connectingServiceIcon,
449
- // animationData={getAnimationIcon(connectingServiceIcon)}
450
- width: "14px", height: "14px" }),
451
- 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
- (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
- backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
463
- } },
464
- React.createElement(LottiePlayer
465
- // animationData={serviceItem.icons.directoAnim}
466
- , {
467
- // animationData={serviceItem.icons.directoAnim}
468
- animationData: getAnimationIcon("directoAnim"), width: "14px", height: "14px" }),
469
- React.createElement("div", null, "Tren Express"))))))));
332
+ React.createElement("span", { className: "ml-[10px]" }, serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text)))))));
470
333
  }
471
334
  export default ServiceItemPB;