kupos-ui-components-lib 10.4.58 → 10.4.59

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.
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { FilterBarProps } from "./tyoes";
3
- declare const FilterBarDesktop: ({ t, serviceList, setServiceList, allSchedules, showReturnTripModal, filterArrData, isBlankTicket, operatorId, filtersArray, setFiltersArray, metaData, busTerminals, setTypes, colors, icons, translation, isTrain, isPeru, hideOperator, setCoachLoading, setCoachKey, isAllinBus, priority_stage_ids, }: FilterBarProps) => React.JSX.Element;
3
+ declare const FilterBarDesktop: ({ t, serviceList, setServiceList, allSchedules, showReturnTripModal, filterArrData, isBlankTicket, operatorId, filtersArray, setFiltersArray, metaData, busTerminals, setTypes, colors, icons, translation, isTrain, isPeru, hideOperator, isShowSeatDegree, setCoachLoading, setCoachKey, isAllinBus, priority_stage_ids, }: FilterBarProps) => React.JSX.Element;
4
4
  export default FilterBarDesktop;
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import commonService from "../../utils/CommonService";
3
3
  import ServiceFilter from "./ServiceFilter";
4
4
  let cachedStageOptions = null;
5
- const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showReturnTripModal, filterArrData, isBlankTicket, operatorId, filtersArray, setFiltersArray, metaData, busTerminals, setTypes, colors, icons, translation, isTrain, isPeru, hideOperator, setCoachLoading, setCoachKey, isAllinBus, priority_stage_ids, }) => {
5
+ const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showReturnTripModal, filterArrData, isBlankTicket, operatorId, filtersArray, setFiltersArray, metaData, busTerminals, setTypes, colors, icons, translation, isTrain, isPeru, hideOperator, isShowSeatDegree, setCoachLoading, setCoachKey, isAllinBus, priority_stage_ids, }) => {
6
6
  // Same rule as showTopLabel in ServiceItemDesktop: a visible bus terminal
7
7
  // label, restricted to priority_stage_ids when that list is non-empty.
8
8
  const getTopLabel = (labelId) => {
@@ -267,6 +267,6 @@ const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showRe
267
267
  return (React.createElement(ServiceFilter, { filtersArray: enrichedFilters, onFilterSelected: onFilterSelected, onFilterClear: (val) => {
268
268
  setFiltersArray(val);
269
269
  filterBy(val);
270
- }, showReturnTripModal: showReturnTripModal, initialOpenFilters: isBlankTicket ? ["operator"] : [], colors: colors, icons: icons, translation: translation, isTrain: isTrain, hideOperator: hideOperator, t: t }));
270
+ }, showReturnTripModal: showReturnTripModal, initialOpenFilters: isBlankTicket ? ["operator"] : [], colors: colors, icons: icons, translation: translation, isTrain: isTrain, hideOperator: hideOperator, isShowSeatDegree: isShowSeatDegree, t: t }));
271
271
  };
272
272
  export default FilterBarDesktop;
@@ -10,6 +10,11 @@ let SEAT_ORDER = [
10
10
  "Premium",
11
11
  "Premium (I)",
12
12
  ];
13
+ function addSeatDegree(label) {
14
+ if (!label)
15
+ return label;
16
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
17
+ }
13
18
  class ServiceFilter extends React.Component {
14
19
  constructor(props) {
15
20
  var _a, _b, _c, _d, _e, _f, _g;
@@ -244,7 +249,10 @@ class ServiceFilter extends React.Component {
244
249
  textTransform: option.type !== "time" ? "capitalize" : "none",
245
250
  } }, option.type === "time"
246
251
  ? commonService.formatTimeLabel(label)
247
- : commonService.formatDefaultLabel(label))));
252
+ : option.type === "seat_types" &&
253
+ this.props.isShowSeatDegree
254
+ ? addSeatDegree(commonService.formatDefaultLabel(label))
255
+ : commonService.formatDefaultLabel(label))));
248
256
  }))));
249
257
  }
250
258
  render() {
@@ -9,5 +9,6 @@ export interface ServiceFilterProps {
9
9
  translation: any;
10
10
  isTrain?: boolean;
11
11
  hideOperator?: boolean;
12
+ isShowSeatDegree?: boolean;
12
13
  t?: (key: string) => string;
13
14
  }
@@ -14,6 +14,7 @@ export interface FilterBarProps {
14
14
  busTerminals?: any;
15
15
  setTypes?: any;
16
16
  hideOperator?: boolean;
17
+ isShowSeatDegree?: boolean;
17
18
  colors: {
18
19
  selectedColor?: string;
19
20
  selectedTextColor?: string;
@@ -86,7 +86,7 @@ function getSeatLabelIcon(label, serviceItem) {
86
86
  function addSeatDegree(label) {
87
87
  if (!label)
88
88
  return label;
89
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
89
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
90
90
  }
91
91
  function PeruSeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, serviceItem, renderIcon, discountSeatPriceColor, isSeatIcon, isShowSeatIcon, }) {
92
92
  var _a;
@@ -94,7 +94,7 @@ function getSeatLabelIcon(label, serviceItem) {
94
94
  function addSeatDegree(label) {
95
95
  if (!label)
96
96
  return label;
97
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
97
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
98
98
  }
99
99
  function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, selectedSeatKey, onSeatSelect, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, isSeatIcon, isTrain, topLabelColor, tooltipColor, discountSeatCrossPriceColor, isShowSeatIcon }) {
100
100
  var _a;
@@ -42,7 +42,7 @@ function getSeatLabelIcon(label, serviceItem) {
42
42
  function addSeatDegree(label) {
43
43
  if (!label)
44
44
  return label;
45
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
45
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
46
46
  }
47
47
  function hasInclinationSeatTypes(seatTypes) {
48
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("°"); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "10.4.58",
3
+ "version": "10.4.59",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,6 +25,7 @@ const FilterBarDesktop = ({
25
25
  isTrain,
26
26
  isPeru,
27
27
  hideOperator,
28
+ isShowSeatDegree,
28
29
  setCoachLoading,
29
30
  setCoachKey,
30
31
  isAllinBus,
@@ -329,6 +330,7 @@ const FilterBarDesktop = ({
329
330
  translation={translation}
330
331
  isTrain={isTrain}
331
332
  hideOperator={hideOperator}
333
+ isShowSeatDegree={isShowSeatDegree}
332
334
  t={t}
333
335
  />
334
336
  );
@@ -14,6 +14,11 @@ let SEAT_ORDER = [
14
14
  "Premium (I)",
15
15
  ];
16
16
 
17
+ function addSeatDegree(label: string) {
18
+ if (!label) return label;
19
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
20
+ }
21
+
17
22
  interface ServiceFilterBarDesktopState {
18
23
  showOperators: boolean;
19
24
  showTimeOptions: boolean;
@@ -345,7 +350,10 @@ class ServiceFilter extends React.Component<
345
350
  >
346
351
  {option.type === "time"
347
352
  ? commonService.formatTimeLabel(label)
348
- : commonService.formatDefaultLabel(label)}
353
+ : option.type === "seat_types" &&
354
+ this.props.isShowSeatDegree
355
+ ? addSeatDegree(commonService.formatDefaultLabel(label))
356
+ : commonService.formatDefaultLabel(label)}
349
357
  </span>
350
358
  </div>
351
359
  );
@@ -9,5 +9,6 @@ export interface ServiceFilterProps {
9
9
  translation: any;
10
10
  isTrain?: boolean;
11
11
  hideOperator?: boolean;
12
+ isShowSeatDegree?: boolean;
12
13
  t?: (key: string) => string;
13
14
  }
@@ -14,6 +14,7 @@ export interface FilterBarProps {
14
14
  busTerminals?: any;
15
15
  setTypes?: any;
16
16
  hideOperator?: boolean;
17
+ isShowSeatDegree?: boolean;
17
18
  colors: {
18
19
  selectedColor?: string;
19
20
  selectedTextColor?: string;
@@ -120,7 +120,7 @@ function getSeatLabelIcon(label: string, serviceItem: any) {
120
120
 
121
121
  function addSeatDegree(label: string) {
122
122
  if (!label) return label;
123
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
123
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
124
124
  }
125
125
 
126
126
  function PeruSeatSection({
@@ -140,7 +140,7 @@ function getSeatLabelIcon(label: string, serviceItem: any) {
140
140
 
141
141
  function addSeatDegree(label: string) {
142
142
  if (!label) return label;
143
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
143
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
144
144
  }
145
145
 
146
146
  function SeatSection({
@@ -106,7 +106,7 @@ function getSeatLabelIcon(label: string, serviceItem: any) {
106
106
 
107
107
  function addSeatDegree(label: string | null) {
108
108
  if (!label) return label;
109
- return String(label).replace(/\b(140|160|180)\b(?!°)/g, "$1°");
109
+ return String(label).replace(/\b(120|140|160|180)\b(?!°)/g, "$1°");
110
110
  }
111
111
 
112
112
  function hasInclinationSeatTypes(seatTypes: SeatType[]): boolean {