kupos-ui-components-lib 10.4.62 → 10.4.63

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.
@@ -175,6 +175,16 @@ const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showRe
175
175
  return true;
176
176
  });
177
177
  }
178
+ if (fil.type == "service_type") {
179
+ const activeOptions = fil.options.filter((it) => it.active);
180
+ if (activeOptions.length) {
181
+ filteredRoutes = filteredRoutes.filter((it) => activeOptions.some((f) => f.value ===
182
+ String(it.service_type || "")
183
+ .trim()
184
+ .replace(/\s+/g, " ")
185
+ .toLowerCase()));
186
+ }
187
+ }
178
188
  if (fil.type == "operator") {
179
189
  let activeOptions = fil.options.filter((it) => it.active);
180
190
  filteredRoutes = filteredRoutes.filter((it) => {
@@ -9,6 +9,7 @@ interface ServiceFilterBarDesktopState {
9
9
  showTrainType: boolean;
10
10
  addMargin: boolean;
11
11
  showAmenities: boolean;
12
+ showServiceType: boolean;
12
13
  sortedFilters: any[];
13
14
  }
14
15
  declare class ServiceFilter extends React.Component<ServiceFilterProps, ServiceFilterBarDesktopState> {
@@ -23,6 +23,7 @@ class ServiceFilter extends React.Component {
23
23
  showTrainType: ((_f = props.initialOpenFilters) === null || _f === void 0 ? void 0 : _f.includes("train_type")) || true,
24
24
  addMargin: false,
25
25
  showAmenities: ((_g = props.initialOpenFilters) === null || _g === void 0 ? void 0 : _g.includes("amenities")) || true,
26
+ showServiceType: true,
26
27
  sortedFilters: this.sortFilters(props.filtersArray),
27
28
  };
28
29
  this.handleScroll = this.handleScroll.bind(this);
@@ -53,6 +54,7 @@ class ServiceFilter extends React.Component {
53
54
  const FILTER_ORDER = [
54
55
  "time",
55
56
  "operator",
57
+ "service_type",
56
58
  "special_departure",
57
59
  "tipo",
58
60
  "seat_types",
@@ -120,18 +122,21 @@ class ServiceFilter extends React.Component {
120
122
  ? !prevState.showTrainType
121
123
  : prevState.showTrainType, showAmenities: type === "amenities"
122
124
  ? !prevState.showAmenities
123
- : prevState.showAmenities });
125
+ : prevState.showAmenities, showServiceType: type === "service_type"
126
+ ? !prevState.showServiceType
127
+ : prevState.showServiceType });
124
128
  });
125
129
  }
126
130
  renderFilterItem(option, onClick, key) {
127
- const { showOperators, showTimeOptions, showSeatOptions, showTypeOptions, showSpecialDeparture, showTrainType, showAmenities, } = this.state;
131
+ const { showOperators, showTimeOptions, showSeatOptions, showTypeOptions, showSpecialDeparture, showTrainType, showAmenities, showServiceType, } = this.state;
128
132
  const isOpen = (option.type === "operator" && showOperators) ||
129
133
  (option.type === "time" && showTimeOptions) ||
130
134
  (option.type === "seat_types" && showSeatOptions) ||
131
135
  (option.type === "tipo" && showTypeOptions) ||
132
136
  (option.type === "special_departure" && showSpecialDeparture) ||
133
137
  (option.type === "train_type" && showTrainType) ||
134
- (option.type === "amenities" && showAmenities);
138
+ (option.type === "amenities" && showAmenities) ||
139
+ (option.type === "service_type" && showServiceType);
135
140
  if ((option === null || option === void 0 ? void 0 : option.type) === "train_type" && !this.props.isTrain) {
136
141
  return null;
137
142
  }
@@ -159,7 +164,8 @@ class ServiceFilter extends React.Component {
159
164
  option.type !== "seat_types" &&
160
165
  option.type !== "tipo" &&
161
166
  option.type !== "special_departure" &&
162
- option.type !== "train_type")) &&
167
+ option.type !== "train_type" &&
168
+ option.type !== "service_type")) &&
163
169
  option.options.map((val, i) => {
164
170
  var _a, _b, _c, _d, _e, _f, _g, _h;
165
171
  let iconKey = "";
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { ServiceItemProps } from "./types";
3
- declare function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, isCiva, showRating, showLastSeats, removeArrivalTime, removeDuplicateSeats, isPeruSites, showAvailableSeats, isSeatIcon, isLinatal, isPeru, t, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isTrain, selectedSeatKey, onSeatSelect, onTrainButtonClick, showSeatSelectionError, onShowSeatSelectionError, onClearSeatSelectionError, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, operatorLabel, priority_stage_ids, isShowSeatIcon, showDesdeLabel, }: 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, viewersConfig, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isTrain, selectedSeatKey, onSeatSelect, onTrainButtonClick, showSeatSelectionError, onShowSeatSelectionError, onClearSeatSelectionError, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, operatorLabel, priority_stage_ids, isShowSeatIcon, showDesdeLabel, showServiceTypeUnderLogo, }: ServiceItemProps & {
4
4
  currencySign?: string;
5
5
  }): React.ReactElement;
6
6
  export default ServiceItemPB;
@@ -87,7 +87,7 @@ const ANIMATION_MAP = {
87
87
  kupos: flameAnimation,
88
88
  },
89
89
  };
90
- function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, isCiva, showRating, showLastSeats, removeArrivalTime, removeDuplicateSeats, isPeruSites, showAvailableSeats, isSeatIcon, isLinatal, isPeru, t = (key) => key, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isTrain, selectedSeatKey, onSeatSelect, onTrainButtonClick, showSeatSelectionError, onShowSeatSelectionError, onClearSeatSelectionError, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, operatorLabel, priority_stage_ids, isShowSeatIcon = false, showDesdeLabel = false, }) {
90
+ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, isCiva, showRating, showLastSeats, removeArrivalTime, removeDuplicateSeats, isPeruSites, showAvailableSeats, isSeatIcon, isLinatal, isPeru, t = (key) => key, siteType, isAllinBus, isExpand, setIsExpand, coachKey, viewersConfig, isNewUi, showLoginModal, isLoggedIn, showLoginOption, isTrain, selectedSeatKey, onSeatSelect, onTrainButtonClick, showSeatSelectionError, onShowSeatSelectionError, onClearSeatSelectionError, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, operatorLabel, priority_stage_ids, isShowSeatIcon = false, showDesdeLabel = false, showServiceTypeUnderLogo = false, }) {
91
91
  var _a, _b, _c;
92
92
  const handleSeatSelect = (key, price, seatKey, apiSeatType) => {
93
93
  onClearSeatSelectionError === null || onClearSeatSelectionError === void 0 ? void 0 : onClearSeatSelectionError();
@@ -356,7 +356,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
356
356
  React.createElement("div", null,
357
357
  React.createElement("img", { src: serviceItem.operator_details[0], alt: "service logo", className: `h-[30px] w-[auto] ${isSoldOut ? "grayscale" : ""}` }),
358
358
  isCiva ? (React.createElement("div", { className: "text-[13.33px] black-text ml-2" }, serviceItem.operator_details[2])) : null),
359
- React.createElement(RatingBlock, { showRating: showRating, serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation, isPeru: isPeru, isTrain: isTrain })),
359
+ React.createElement(RatingBlock, { showRating: showRating, serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation, isPeru: isPeru, isTrain: isTrain, showServiceTypeUnderLogo: showServiceTypeUnderLogo })),
360
360
  React.createElement(DateTimeSection, { serviceItem: serviceItem, isSoldOut: isSoldOut, isCiva: isCiva, isLinatal: isLinatal, removeArrivalTime: removeArrivalTime, orignLabel: orignLabel, destinationLabel: destinationLabel, busStage: busStage, metaData: metaData, colors: colors }),
361
361
  React.createElement("div", { style: {
362
362
  width: "1px",
@@ -376,7 +376,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
376
376
  color: colors.seatPriceColor,
377
377
  } }, "\u00A1\u00DAltimos Asientos!")))) : null)),
378
378
  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 &&
379
- setIsExpand(isItemExpanded ? null : serviceItem.id), isPeru: isPeru, isTrain: isTrain, isDpEnabled: serviceItem.is_dp_enabled, serviceType: serviceItem.service_type, renderIcon: renderIcon }))),
379
+ setIsExpand(isItemExpanded ? null : serviceItem.id), isPeru: isPeru, isTrain: isTrain, isDpEnabled: serviceItem.is_dp_enabled, serviceType: showServiceTypeUnderLogo ? undefined : serviceItem.service_type, renderIcon: renderIcon }))),
380
380
  isPeru ? null : (React.createElement("div", { style: {
381
381
  display: "grid",
382
382
  gridTemplateRows: isItemExpanded ? "1fr" : "0fr",
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { MobileServiceItemProps } from "./mobileTypes";
3
- declare function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig, operatorLabel, isTrain, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, isAllinBus, isPeruSite, priority_stage_ids, isShowSeatIcon, showDesdeLabel, }: 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, viewersConfig, operatorLabel, isTrain, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, isAllinBus, isPeruSite, priority_stage_ids, isShowSeatIcon, showDesdeLabel, showServiceTypeUnderLogo, }: MobileServiceItemProps): React.ReactElement;
4
4
  export default ServiceItemMobile;
@@ -19,7 +19,7 @@ const exceptions = [
19
19
  "blanco",
20
20
  "asiento_mascota",
21
21
  ];
22
- function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig, operatorLabel, isTrain, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, isAllinBus, isPeruSite, priority_stage_ids, isShowSeatIcon = false, showDesdeLabel = false, }) {
22
+ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, orignLabel, destinationLabel, amenitiesData, setShowDropdown, showDropdown, isExpanded, setIsExpanded, setAmenetiesAtomValue, isCiva, currencySign, isPeru, showRating, showLastSeats, removeDuplicateSeats, isLinatal, viewersConfig, operatorLabel, isTrain, isFeatureDropDownExpand, setIsFeatureDropDownExpand, ticketQuantity, onIncreaseTicketQuantity, onDecreaseTicketQuantity, cityOrigin, cityDestination, isNewUi, onRemateUiButtonClick, selectedTimeSlot, onTimeSlotChange, isTimeDropdownOpen, onTimeDropdownToggle, wowDealData, isFlores, isAllinBus, isPeruSite, priority_stage_ids, isShowSeatIcon = false, showDesdeLabel = false, showServiceTypeUnderLogo = false, }) {
23
23
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
24
24
  const isItemExpanded = serviceItem.id === isExpanded;
25
25
  const isPetSeat = (Object.keys(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.pet_seat_info) || []).length > 0;
@@ -145,7 +145,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
145
145
  } },
146
146
  React.createElement("div", { className: `w-[115px] ${isFlores ? "" : "overflow-y-hidden"} h-[30px]` },
147
147
  React.createElement("img", { src: serviceItem.operator_details[0], alt: "service logo", className: `w-[100px] h-auto object-contain ${isSoldOut ? "grayscale" : ""}` })),
148
- isCiva ? (React.createElement("div", { className: "black-text min-[420]:text-[12px] text-[12px]" }, serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_details[2])) : showRating ? (React.createElement("div", { className: "flex min-[420]:text-[13px] text-[12px] h-[22px] items-center" },
148
+ isCiva ? (React.createElement("div", { className: "black-text min-[420]:text-[12px] text-[12px]" }, serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_details[2])) : showServiceTypeUnderLogo && (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.service_type) ? (React.createElement("div", { className: "min-[420]:text-[13px] text-[12px] text-ellipsis overflow-hidden whitespace-nowrap max-w-[150px]", style: { color: isSoldOut ? "#bbb" : "#464647" } }, commonService.capitalizeFirstLetter(serviceItem.service_type))) : showRating ? (React.createElement("div", { className: "flex min-[420]:text-[13px] text-[12px] h-[22px] items-center" },
149
149
  React.createElement("div", { className: "flex items-center" },
150
150
  React.createElement("div", { className: "flex items-center" },
151
151
  React.createElement("img", { src: serviceItem.icons.rating, alt: "origin", className: `w-[12px] h-[12px] mr-[4px] object-contain ${isSoldOut ? "grayscale" : ""}` }),
@@ -161,7 +161,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
161
161
  color: colors.tooltipBgColor,
162
162
  } }, "\u00A1\u00DAltimos Asientos!")))) : null,
163
163
  React.createElement("div", { className: "bg-[#E6E6E6] mt-[10px] mb-[8px] h-[1px]" }),
164
- React.createElement(BottomAmenitiesMobile, { isSoldOut: isSoldOut, amenitiesNodes: amenities(), hoursIcon: renderIcon("hours", "14px"), duration: (_j = serviceItem.duration) === null || _j === void 0 ? void 0 : _j.toString(), isDirectTrip: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip, serviceType: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.service_type, directoColor: colors.directoColor, directoAnim: serviceItem.icons.directoAnim, isChangeTicket: serviceItem.is_change_ticket, isPetSeat: isPetSeat, petSeatInfo: serviceItem.pet_seat_info, petFriendlyAnim: serviceItem.icons.petFriendlyAnim, flexibleAnim: serviceItem.icons.flexibleAnim, isTrackingEnabled: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_tracking_enabled, locationAnim: serviceItem.icons.locationAnim, downArrowIcon: serviceItem.icons.downArrow, showDropdown: isItemExpanded, setShowDropdown: () => setIsExpanded(isItemExpanded ? null : serviceItem.id), onDropdownToggle: () => {
164
+ React.createElement(BottomAmenitiesMobile, { isSoldOut: isSoldOut, amenitiesNodes: amenities(), hoursIcon: renderIcon("hours", "14px"), duration: (_j = serviceItem.duration) === null || _j === void 0 ? void 0 : _j.toString(), isDirectTrip: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip, serviceType: showServiceTypeUnderLogo ? undefined : serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.service_type, directoColor: colors.directoColor, directoAnim: serviceItem.icons.directoAnim, isChangeTicket: serviceItem.is_change_ticket, isPetSeat: isPetSeat, petSeatInfo: serviceItem.pet_seat_info, petFriendlyAnim: serviceItem.icons.petFriendlyAnim, flexibleAnim: serviceItem.icons.flexibleAnim, isTrackingEnabled: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_tracking_enabled, locationAnim: serviceItem.icons.locationAnim, downArrowIcon: serviceItem.icons.downArrow, showDropdown: isItemExpanded, setShowDropdown: () => setIsExpanded(isItemExpanded ? null : serviceItem.id), onDropdownToggle: () => {
165
165
  setIsExpanded(isItemExpanded ? null : serviceItem.id);
166
166
  }, isPeru: isPeru, femaleAnim: serviceItem.icons.femaleAnim, ladiesBookedSeats: serviceItem.ladies_booked_seats, isDpEnabled: serviceItem.is_dp_enabled, isTrain: isTrain, renderIcon: renderIcon })),
167
167
  React.createElement(ServiceBadgesMobile, { showTopLabel: showTopLabel || undefined, isSoldOut: isSoldOut, colors: colors, renderIcon: renderIcon, serviceItem: serviceItem, isConexion: isConexion, isAllinBus: isAllinBus, boardingName: boardingName })),
@@ -254,4 +254,5 @@ export interface MobileServiceItemProps {
254
254
  priority_stage_ids?: string[];
255
255
  isShowSeatIcon?: boolean;
256
256
  showDesdeLabel?: boolean;
257
+ showServiceTypeUnderLogo?: boolean;
257
258
  }
@@ -275,4 +275,5 @@ export interface ServiceItemProps {
275
275
  priority_stage_ids?: string[];
276
276
  isShowSeatIcon?: boolean;
277
277
  showDesdeLabel?: boolean;
278
+ showServiceTypeUnderLogo?: boolean;
278
279
  }
package/dist/styles.css CHANGED
@@ -596,6 +596,9 @@
596
596
  .max-w-\[120px\] {
597
597
  max-width: 120px;
598
598
  }
599
+ .max-w-\[150px\] {
600
+ max-width: 150px;
601
+ }
599
602
  .max-w-\[165px\] {
600
603
  max-width: 165px;
601
604
  }
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- declare const RatingBlock: ({ showRating, serviceItem, isSoldOut, colors, t, translation, isPeru, isTrain, }: any) => React.JSX.Element;
2
+ declare const RatingBlock: ({ showRating, serviceItem, isSoldOut, colors, t, translation, isPeru, isTrain, showServiceTypeUnderLogo, }: any) => React.JSX.Element;
3
3
  export default RatingBlock;
@@ -1,15 +1,19 @@
1
1
  import React from "react";
2
2
  import RatingHover from "../components/ServiceItem/RatingHover";
3
- const RatingBlock = ({ showRating, serviceItem, isSoldOut, colors, t, translation, isPeru = false, isTrain = false, }) => {
3
+ import commonService from "../utils/CommonService";
4
+ const RatingBlock = ({ showRating, serviceItem, isSoldOut, colors, t, translation, isPeru = false, isTrain = false, showServiceTypeUnderLogo = false, }) => {
5
+ const operatorLabel = showServiceTypeUnderLogo
6
+ ? commonService.capitalizeFirstLetter(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.service_type)
7
+ : serviceItem.operator_details[2];
4
8
  return (React.createElement("div", { className: "flex items-center whitespace-nowrap" },
5
9
  showRating && (React.createElement(RatingHover, { serviceItem: serviceItem, isSoldOut: isSoldOut, colors: colors, t: t, translation: translation, isPeru: isPeru })),
6
10
  React.createElement("div", { className: "group relative ml-[10px] text-[12px]", style: {
7
11
  marginLeft: showRating ? "6px" : "0",
8
12
  color: isSoldOut ? "#c0c0c0" : "#464647",
9
13
  } },
10
- React.createElement("span", { className: `block max-w-[120px] cursor-pointer text-[12px] ${isPeru || isTrain ? "overflow-hidden text-ellipsis whitespace-nowrap" : ""}` }, serviceItem.operator_details[2]),
14
+ React.createElement("span", { className: `block max-w-[120px] cursor-pointer text-[12px] ${isPeru || isTrain ? "overflow-hidden text-ellipsis whitespace-nowrap" : ""}` }, operatorLabel),
11
15
  React.createElement("div", { className: "hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-nowrap z-10 mt-2.5 w-max text-center shadow-service text-[12px]", style: { backgroundColor: colors.bottomStripColor, zIndex: "300" } },
12
16
  React.createElement("div", { className: "tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent ", style: { borderBottomColor: colors.bottomStripColor } }),
13
- serviceItem.operator_details[2]))));
17
+ operatorLabel))));
14
18
  };
15
19
  export default RatingBlock;
@@ -66,6 +66,10 @@ function getUniqueSeats(seatTypes, isTrain) {
66
66
  return true;
67
67
  });
68
68
  }
69
+ // Matches "160°" as well as a bare "160" label
70
+ function hasInclinationSeatTypes(seatTypes) {
71
+ return (seatTypes !== null && seatTypes !== void 0 ? seatTypes : []).some((seat) => { var _a; return /\b(120|140|160|180)\b/.test(String((_a = seat === null || seat === void 0 ? void 0 : seat.label) !== null && _a !== void 0 ? _a : "")); });
72
+ }
69
73
  function getNumberOfSeats(seatTypes) {
70
74
  return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
71
75
  }
@@ -101,6 +105,12 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
101
105
  const uniqueSeats = getUniqueSeats(seatTypes, isTrain);
102
106
  const sortedSeatTypes = getSortedSeatTypes(seatTypes, isTrain);
103
107
  const numberOfSeats = getNumberOfSeats(seatTypes);
108
+ const isMovilBus = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "MovilBus" ||
109
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "Movil Bus";
110
+ // Peru: list every seat type with its own fare (MovilBus, or inclination
111
+ // seats like 160° / 180°) instead of only the cheapest one.
112
+ const showSeatTypeRows = (isMovilBus || hasInclinationSeatTypes(seatTypes)) &&
113
+ uniqueSeats.length > 1;
104
114
  const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
105
115
  const formatPrice = (price) => availableSeats <= 0
106
116
  ? CommonService.currency(0, currencySign)
@@ -146,10 +156,8 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
146
156
  };
147
157
  const renderSeatPrices = () => {
148
158
  if (isPeru) {
149
- const isMovilBus = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "MovilBus" ||
150
- (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "Movil Bus";
151
- // Multiple unique seat types → show a price row for each (MovilBus only)
152
- if (isMovilBus && uniqueSeats.length > 1) {
159
+ // Multiple unique seat types → show a price row for each
160
+ if (showSeatTypeRows) {
153
161
  return uniqueSeats
154
162
  .filter((s) => !SEAT_EXCEPTIONS.includes(s.label))
155
163
  .map((val, key) => {
@@ -215,10 +223,8 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
215
223
  })();
216
224
  const renderLabels = () => {
217
225
  if (isPeru) {
218
- const isMovilBus = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "MovilBus" ||
219
- (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operator_service_name) === "Movil Bus";
220
- // Multiple unique seat types → show a label row for each (MovilBus only)
221
- if (isMovilBus && uniqueSeats.length > 1) {
226
+ // Multiple unique seat types → show a label row for each
227
+ if (showSeatTypeRows) {
222
228
  return uniqueSeats
223
229
  .filter((s) => !SEAT_EXCEPTIONS.includes(s.label))
224
230
  .map((val, key) => (React.createElement("span", { key: key, className: `flex items-center justify-between text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""}` },
@@ -227,7 +233,14 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
227
233
  height: "20px",
228
234
  marginRight: "5px",
229
235
  } })),
230
- CommonService.truncateSeatLabel(val.label))));
236
+ !isMovilBus && isShowSeatIcon && (React.createElement("img", { src: getSeatLabelIcon(val.label, serviceItem), alt: "seattype", style: {
237
+ width: "20px",
238
+ height: "20px",
239
+ marginRight: "5px",
240
+ } })),
241
+ isMovilBus
242
+ ? CommonService.truncateSeatLabel(val.label)
243
+ : CommonService.capitalize(addSeatDegree(val.label)))));
231
244
  }
232
245
  // Single seat type → original behaviour
233
246
  const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
@@ -45,7 +45,8 @@ function addSeatDegree(label) {
45
45
  return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
46
46
  }
47
47
  function hasInclinationSeatTypes(seatTypes) {
48
- return (seatTypes !== null && seatTypes !== void 0 ? seatTypes : []).some((seat) => { var _a; return String((_a = seat === null || seat === void 0 ? void 0 : seat.label) !== null && _a !== void 0 ? _a : "").includes("°"); });
48
+ // Matches "160°" as well as a bare "160" label
49
+ return (seatTypes !== null && seatTypes !== void 0 ? seatTypes : []).some((seat) => { var _a; return /\b(120|140|160|180)\b/.test(String((_a = seat === null || seat === void 0 ? void 0 : seat.label) !== null && _a !== void 0 ? _a : "")); });
49
50
  }
50
51
  const getUniqueSeats = (data, limit) => {
51
52
  var _a;
@@ -116,7 +117,7 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
116
117
  marginRight: "4px",
117
118
  filter: isSoldOut ? "grayscale(1)" : "",
118
119
  } })),
119
- commonService.truncateSeatLabel(seat.label)),
120
+ commonService.truncateSeatLabel(commonService.addSeatDegree(seat.label))),
120
121
  React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] bold-text", style: { color: priceColor } }, commonService.currency(showOriginalFare ? originalPrice : discountedPrice, currencySign))));
121
122
  })));
122
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "10.4.62",
3
+ "version": "10.4.63",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -221,6 +221,22 @@ const FilterBarDesktop = ({
221
221
  });
222
222
  }
223
223
 
224
+ if (fil.type == "service_type") {
225
+ const activeOptions = fil.options.filter((it) => it.active);
226
+ if (activeOptions.length) {
227
+ filteredRoutes = filteredRoutes.filter((it) =>
228
+ activeOptions.some(
229
+ (f) =>
230
+ f.value ===
231
+ String(it.service_type || "")
232
+ .trim()
233
+ .replace(/\s+/g, " ")
234
+ .toLowerCase(),
235
+ ),
236
+ );
237
+ }
238
+ }
239
+
224
240
  if (fil.type == "operator") {
225
241
  let activeOptions = fil.options.filter((it) => it.active);
226
242
  filteredRoutes = filteredRoutes.filter((it) => {
@@ -23,6 +23,7 @@ interface ServiceFilterBarDesktopState {
23
23
  showTrainType: boolean;
24
24
  addMargin: boolean;
25
25
  showAmenities: boolean;
26
+ showServiceType: boolean;
26
27
  sortedFilters: any[];
27
28
  }
28
29
 
@@ -43,6 +44,7 @@ class ServiceFilter extends React.Component<
43
44
  showTrainType: props.initialOpenFilters?.includes("train_type") || true,
44
45
  addMargin: false,
45
46
  showAmenities: props.initialOpenFilters?.includes("amenities") || true,
47
+ showServiceType: true,
46
48
  sortedFilters: this.sortFilters(props.filtersArray),
47
49
  };
48
50
 
@@ -80,6 +82,7 @@ class ServiceFilter extends React.Component<
80
82
  const FILTER_ORDER = [
81
83
  "time",
82
84
  "operator",
85
+ "service_type",
83
86
  "special_departure",
84
87
  "tipo",
85
88
  "seat_types",
@@ -173,6 +176,10 @@ class ServiceFilter extends React.Component<
173
176
  type === "amenities"
174
177
  ? !prevState.showAmenities
175
178
  : prevState.showAmenities,
179
+ showServiceType:
180
+ type === "service_type"
181
+ ? !prevState.showServiceType
182
+ : prevState.showServiceType,
176
183
  };
177
184
  });
178
185
  }
@@ -186,6 +193,7 @@ class ServiceFilter extends React.Component<
186
193
  showSpecialDeparture,
187
194
  showTrainType,
188
195
  showAmenities,
196
+ showServiceType,
189
197
  } = this.state;
190
198
 
191
199
  const isOpen =
@@ -195,7 +203,8 @@ class ServiceFilter extends React.Component<
195
203
  (option.type === "tipo" && showTypeOptions) ||
196
204
  (option.type === "special_departure" && showSpecialDeparture) ||
197
205
  (option.type === "train_type" && showTrainType) ||
198
- (option.type === "amenities" && showAmenities);
206
+ (option.type === "amenities" && showAmenities) ||
207
+ (option.type === "service_type" && showServiceType);
199
208
 
200
209
  if (option?.type === "train_type" && !this.props.isTrain) {
201
210
  return null;
@@ -249,7 +258,8 @@ class ServiceFilter extends React.Component<
249
258
  option.type !== "seat_types" &&
250
259
  option.type !== "tipo" &&
251
260
  option.type !== "special_departure" &&
252
- option.type !== "train_type")) &&
261
+ option.type !== "train_type" &&
262
+ option.type !== "service_type")) &&
253
263
  option.options.map((val: any, i: number) => {
254
264
  let iconKey = "";
255
265
  if (val.icon === "sunrise") {
@@ -154,6 +154,7 @@ function ServiceItemPB({
154
154
  priority_stage_ids,
155
155
  isShowSeatIcon = false,
156
156
  showDesdeLabel = false,
157
+ showServiceTypeUnderLogo = false,
157
158
  }: ServiceItemProps & { currencySign?: string }): React.ReactElement {
158
159
  const handleSeatSelect = (
159
160
  key: any,
@@ -669,6 +670,7 @@ function ServiceItemPB({
669
670
  translation={translation}
670
671
  isPeru={isPeru}
671
672
  isTrain={isTrain}
673
+ showServiceTypeUnderLogo={showServiceTypeUnderLogo}
672
674
  />
673
675
  </div>
674
676
 
@@ -778,7 +780,9 @@ function ServiceItemPB({
778
780
  isPeru={isPeru}
779
781
  isTrain={isTrain}
780
782
  isDpEnabled={serviceItem.is_dp_enabled}
781
- serviceType={serviceItem.service_type}
783
+ serviceType={
784
+ showServiceTypeUnderLogo ? undefined : serviceItem.service_type
785
+ }
782
786
  renderIcon={renderIcon}
783
787
  />
784
788
  </div>
@@ -69,6 +69,7 @@ function ServiceItemMobile({
69
69
  priority_stage_ids,
70
70
  isShowSeatIcon = false,
71
71
  showDesdeLabel = false,
72
+ showServiceTypeUnderLogo = false,
72
73
  }: MobileServiceItemProps): React.ReactElement {
73
74
  const isItemExpanded = serviceItem.id === isExpanded;
74
75
  const isPetSeat = (Object.keys(serviceItem?.pet_seat_info) || []).length > 0;
@@ -340,6 +341,15 @@ function ServiceItemMobile({
340
341
  <div className="black-text min-[420]:text-[12px] text-[12px]">
341
342
  {serviceItem?.operator_details[2]}
342
343
  </div>
344
+ ) : showServiceTypeUnderLogo && serviceItem?.service_type ? (
345
+ <div
346
+ className="min-[420]:text-[13px] text-[12px] text-ellipsis overflow-hidden whitespace-nowrap max-w-[150px]"
347
+ style={{ color: isSoldOut ? "#bbb" : "#464647" }}
348
+ >
349
+ {commonService.capitalizeFirstLetter(
350
+ serviceItem.service_type,
351
+ )}
352
+ </div>
343
353
  ) : showRating ? (
344
354
  <div className="flex min-[420]:text-[13px] text-[12px] h-[22px] items-center">
345
355
  <div className="flex items-center">
@@ -436,7 +446,9 @@ function ServiceItemMobile({
436
446
  hoursIcon={renderIcon("hours", "14px")}
437
447
  duration={serviceItem.duration?.toString()}
438
448
  isDirectTrip={serviceItem?.is_direct_trip}
439
- serviceType={serviceItem?.service_type}
449
+ serviceType={
450
+ showServiceTypeUnderLogo ? undefined : serviceItem?.service_type
451
+ }
440
452
  directoColor={colors.directoColor}
441
453
  directoAnim={serviceItem.icons.directoAnim}
442
454
  isChangeTicket={serviceItem.is_change_ticket}
@@ -267,4 +267,5 @@ export interface MobileServiceItemProps {
267
267
  isShowSeatIcon?: boolean;
268
268
  // shows a small "Desde" label above the price in the seat section
269
269
  showDesdeLabel?: boolean;
270
+ showServiceTypeUnderLogo?: boolean;
270
271
  }
@@ -288,4 +288,5 @@ export interface ServiceItemProps {
288
288
  isShowSeatIcon?: boolean;
289
289
  // shows a small "Desde" label above the price in the seat section
290
290
  showDesdeLabel?: boolean;
291
+ showServiceTypeUnderLogo?: boolean;
291
292
  }
@@ -11,7 +11,12 @@ const RatingBlock = ({
11
11
  translation,
12
12
  isPeru = false,
13
13
  isTrain = false,
14
+ showServiceTypeUnderLogo = false,
14
15
  }: any) => {
16
+ const operatorLabel = showServiceTypeUnderLogo
17
+ ? commonService.capitalizeFirstLetter(serviceItem?.service_type)
18
+ : serviceItem.operator_details[2];
19
+
15
20
  return (
16
21
  <div
17
22
  className="flex items-center whitespace-nowrap"
@@ -38,7 +43,7 @@ const RatingBlock = ({
38
43
  <span
39
44
  className={`block max-w-[120px] cursor-pointer text-[12px] ${isPeru || isTrain ? "overflow-hidden text-ellipsis whitespace-nowrap" : ""}`}
40
45
  >
41
- {serviceItem.operator_details[2]}
46
+ {operatorLabel}
42
47
  </span>
43
48
  <div
44
49
  className="hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-nowrap z-10 mt-2.5 w-max text-center shadow-service text-[12px]"
@@ -48,7 +53,7 @@ const RatingBlock = ({
48
53
  className="tooltip-arrow absolute -top-[7px] left-1/2 -translate-x-1/2 w-0 h-0 border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent "
49
54
  style={{ borderBottomColor: colors.bottomStripColor }}
50
55
  ></div>
51
- {serviceItem.operator_details[2]}
56
+ {operatorLabel}
52
57
  </div>
53
58
  </div>
54
59
  </div>
@@ -119,6 +119,13 @@ function getUniqueSeats(seatTypes: SeatType[], isTrain?: boolean) {
119
119
  });
120
120
  }
121
121
 
122
+ // Matches "160°" as well as a bare "160" label
123
+ function hasInclinationSeatTypes(seatTypes: SeatType[]) {
124
+ return (seatTypes ?? []).some((seat) =>
125
+ /\b(120|140|160|180)\b/.test(String(seat?.label ?? "")),
126
+ );
127
+ }
128
+
122
129
  function getNumberOfSeats(seatTypes: SeatType[]) {
123
130
  return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
124
131
  }
@@ -169,6 +176,14 @@ function SeatSection({
169
176
  const uniqueSeats = getUniqueSeats(seatTypes, isTrain);
170
177
  const sortedSeatTypes = getSortedSeatTypes(seatTypes, isTrain);
171
178
  const numberOfSeats = getNumberOfSeats(seatTypes);
179
+ const isMovilBus =
180
+ serviceItem?.operator_service_name === "MovilBus" ||
181
+ serviceItem?.operator_service_name === "Movil Bus";
182
+ // Peru: list every seat type with its own fare (MovilBus, or inclination
183
+ // seats like 160° / 180°) instead of only the cheapest one.
184
+ const showSeatTypeRows =
185
+ (isMovilBus || hasInclinationSeatTypes(seatTypes)) &&
186
+ uniqueSeats.length > 1;
172
187
  const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
173
188
 
174
189
  const formatPrice = (price: number) =>
@@ -256,12 +271,8 @@ function SeatSection({
256
271
 
257
272
  const renderSeatPrices = () => {
258
273
  if (isPeru) {
259
- const isMovilBus =
260
- serviceItem?.operator_service_name === "MovilBus" ||
261
- serviceItem?.operator_service_name === "Movil Bus";
262
-
263
- // Multiple unique seat types → show a price row for each (MovilBus only)
264
- if (isMovilBus && uniqueSeats.length > 1) {
274
+ // Multiple unique seat types → show a price row for each
275
+ if (showSeatTypeRows) {
265
276
  return uniqueSeats
266
277
  .filter((s) => !SEAT_EXCEPTIONS.includes(s.label))
267
278
  .map((val, key) => {
@@ -378,12 +389,8 @@ function SeatSection({
378
389
 
379
390
  const renderLabels = () => {
380
391
  if (isPeru) {
381
- const isMovilBus =
382
- serviceItem?.operator_service_name === "MovilBus" ||
383
- serviceItem?.operator_service_name === "Movil Bus";
384
-
385
- // Multiple unique seat types → show a label row for each (MovilBus only)
386
- if (isMovilBus && uniqueSeats.length > 1) {
392
+ // Multiple unique seat types → show a label row for each
393
+ if (showSeatTypeRows) {
387
394
  return uniqueSeats
388
395
  .filter((s) => !SEAT_EXCEPTIONS.includes(s.label))
389
396
  .map((val, key) => (
@@ -404,7 +411,20 @@ function SeatSection({
404
411
  }}
405
412
  />
406
413
  )}
407
- {CommonService.truncateSeatLabel(val.label)}
414
+ {!isMovilBus && isShowSeatIcon && (
415
+ <img
416
+ src={getSeatLabelIcon(val.label, serviceItem)}
417
+ alt="seattype"
418
+ style={{
419
+ width: "20px",
420
+ height: "20px",
421
+ marginRight: "5px",
422
+ }}
423
+ />
424
+ )}
425
+ {isMovilBus
426
+ ? CommonService.truncateSeatLabel(val.label)
427
+ : CommonService.capitalize(addSeatDegree(val.label))}
408
428
  </span>
409
429
  ));
410
430
  }
@@ -112,8 +112,9 @@ function addSeatDegree(label: string | null) {
112
112
  }
113
113
 
114
114
  function hasInclinationSeatTypes(seatTypes: SeatType[]): boolean {
115
+ // Matches "160°" as well as a bare "160" label
115
116
  return (seatTypes ?? []).some((seat) =>
116
- String(seat?.label ?? "").includes("°"),
117
+ /\b(120|140|160|180)\b/.test(String(seat?.label ?? "")),
117
118
  );
118
119
  }
119
120
 
@@ -247,7 +248,9 @@ function SeatSectionMobile({
247
248
  }}
248
249
  />
249
250
  )}
250
- {commonService.truncateSeatLabel(seat.label)}
251
+ {commonService.truncateSeatLabel(
252
+ commonService.addSeatDegree(seat.label),
253
+ )}
251
254
  </span>
252
255
  <span
253
256
  className="min-[420]:text-[13px] text-[12px] bold-text"