kupos-ui-components-lib 9.8.6 → 9.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +4 -21
- package/dist/components/ServiceItem/types.d.ts +1 -7
- package/dist/styles.css +0 -3
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +2 -1
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +4 -2
- package/dist/ui/OfferBanner.js +7 -5
- package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
- package/dist/ui/SeatSection/SeatSection.js +6 -31
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +3 -43
- package/src/components/ServiceItem/types.ts +1 -12
- package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +4 -2
- package/src/ui/OfferBanner.tsx +7 -3
- package/src/ui/SeatSection/SeatSection.tsx +15 -76
|
@@ -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, showLoginModal, isLoggedIn, showLoginOption,
|
|
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, showLoginModal, isLoggedIn, showLoginOption, isFlores, operatorLabel, }: ServiceItemProps & {
|
|
4
4
|
currencySign?: string;
|
|
5
5
|
}): React.ReactElement;
|
|
6
6
|
export default ServiceItemPB;
|
|
@@ -74,12 +74,8 @@ const ANIMATION_MAP = {
|
|
|
74
74
|
kupos: femaleAnimation,
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
|
-
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, showLoginModal, isLoggedIn, showLoginOption,
|
|
77
|
+
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, showLoginModal, isLoggedIn, showLoginOption, isFlores, operatorLabel, }) {
|
|
78
78
|
var _a;
|
|
79
|
-
const handleSeatSelect = (key, price, seatKey, apiSeatType) => {
|
|
80
|
-
onClearSeatSelectionError === null || onClearSeatSelectionError === void 0 ? void 0 : onClearSeatSelectionError();
|
|
81
|
-
onSeatSelect === null || onSeatSelect === void 0 ? void 0 : onSeatSelect(key, price, seatKey, apiSeatType);
|
|
82
|
-
};
|
|
83
79
|
const getAnimationIcon = (icon) => {
|
|
84
80
|
var _a;
|
|
85
81
|
const animation = ANIMATION_MAP[icon];
|
|
@@ -217,16 +213,6 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
217
213
|
});
|
|
218
214
|
return;
|
|
219
215
|
}
|
|
220
|
-
if (isTrain) {
|
|
221
|
-
if (!selectedSeatKey) {
|
|
222
|
-
onShowSeatSelectionError === null || onShowSeatSelectionError === void 0 ? void 0 : onShowSeatSelectionError(serviceItem.id);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (onTrainButtonClick) {
|
|
226
|
-
onTrainButtonClick();
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
216
|
onBookButtonPress();
|
|
231
217
|
};
|
|
232
218
|
const items = [
|
|
@@ -289,13 +275,9 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
289
275
|
backgroundColor: "#ccc",
|
|
290
276
|
} }),
|
|
291
277
|
React.createElement("div", { className: "content-center" },
|
|
292
|
-
React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, serviceItem: serviceItem, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, dpSeatColor: colors.seatPriceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru, renderIcon: renderIcon, discountSeatPriceColor: colors.discountSeatPriceColor
|
|
278
|
+
React.createElement(SeatSection, { seatTypes: serviceItem.seat_types, serviceItem: serviceItem, availableSeats: serviceItem.available_seats, isSoldOut: isSoldOut, priceColor: colors.priceColor, dpSeatColor: colors.seatPriceColor, currencySign: currencySign, removeDuplicateSeats: removeDuplicateSeats, isPeru: isPeru, renderIcon: renderIcon, discountSeatPriceColor: colors.discountSeatPriceColor })),
|
|
293
279
|
React.createElement("div", { className: "relative" },
|
|
294
280
|
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 }),
|
|
295
|
-
showSeatSelectionError === serviceItem.id && isTrain && (React.createElement("div", { className: "flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]" },
|
|
296
|
-
React.createElement("div", { className: "text-[9px] text-center whitespace-nowrap", style: {
|
|
297
|
-
color: colors.seatPriceColor,
|
|
298
|
-
} }, "Selecciona el tipo de servicio"))),
|
|
299
281
|
showLastSeats ? (React.createElement("div", { className: "flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]" }, (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) < 10 &&
|
|
300
282
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.available_seats) > 0 && (React.createElement("div", { className: "text-[12px] mt-1 text-center", style: {
|
|
301
283
|
color: colors.seatPriceColor,
|
|
@@ -308,6 +290,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
308
290
|
transition: "grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
309
291
|
position: "relative",
|
|
310
292
|
zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
|
|
293
|
+
marginTop: isItemExpanded ? "" : "-6px",
|
|
311
294
|
} },
|
|
312
295
|
React.createElement("div", { style: Object.assign({ overflow: "hidden", minHeight: 0, marginTop: hasDpEnabled || (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) ? "" : "-10px" }, (hasOfferText || hasDpEnabled
|
|
313
296
|
? {
|
|
@@ -317,7 +300,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
317
300
|
boxSizing: "border-box",
|
|
318
301
|
}
|
|
319
302
|
: {})) },
|
|
320
|
-
React.createElement(ExpandedDropdown, { serviceItem: serviceItem, isPeru: isPeru, translation: translation, getAnimationIcon: getAnimationIcon, isChangeTicket: serviceItem.is_change_ticket === true, isSoldOut: isSoldOut, ladiesBookedSeats: serviceItem.ladies_booked_seats, isDpEnabled: serviceItem.is_dp_enabled, renderIcon: renderIcon })))),
|
|
303
|
+
React.createElement(ExpandedDropdown, { serviceItem: serviceItem, isPeru: isPeru, translation: translation, getAnimationIcon: getAnimationIcon, isChangeTicket: serviceItem.is_change_ticket === true, isSoldOut: isSoldOut, ladiesBookedSeats: serviceItem.ladies_booked_seats, isDpEnabled: serviceItem.is_dp_enabled, renderIcon: renderIcon, operatorLabel: operatorLabel })))),
|
|
321
304
|
children,
|
|
322
305
|
React.createElement(ServiceBadges, { showTopLabel: showTopLabel, isSoldOut: isSoldOut, colors: colors, renderIcon: renderIcon, translation: translation, serviceItem: serviceItem })))));
|
|
323
306
|
}
|
|
@@ -224,12 +224,6 @@ export interface ServiceItemProps {
|
|
|
224
224
|
showLoginModal?: any;
|
|
225
225
|
isLoggedIn?: any;
|
|
226
226
|
showLoginOption?: boolean;
|
|
227
|
-
isTrain?: boolean;
|
|
228
|
-
selectedSeatKey?: any;
|
|
229
|
-
onSeatSelect?: (key: any, price: number, seatKey: string, apiSeatType?: string) => void;
|
|
230
|
-
onTrainButtonClick?: any;
|
|
231
|
-
showSeatSelectionError?: string | null;
|
|
232
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
233
|
-
onClearSeatSelectionError?: () => void;
|
|
234
227
|
isFlores?: boolean;
|
|
228
|
+
operatorLabel?: string;
|
|
235
229
|
}
|
package/dist/styles.css
CHANGED
|
@@ -14,6 +14,7 @@ interface ExpandedDropdownProps {
|
|
|
14
14
|
ladiesBookedSeats?: string;
|
|
15
15
|
isDpEnabled?: boolean;
|
|
16
16
|
renderIcon?: any;
|
|
17
|
+
operatorLabel?: string;
|
|
17
18
|
}
|
|
18
|
-
declare function ExpandedDropdown({ serviceItem, isPeru, translation, getAnimationIcon, isChangeTicket, isSoldOut, ladiesBookedSeats, isDpEnabled, renderIcon, }: ExpandedDropdownProps): React.ReactElement;
|
|
19
|
+
declare function ExpandedDropdown({ serviceItem, isPeru, translation, getAnimationIcon, isChangeTicket, isSoldOut, ladiesBookedSeats, isDpEnabled, renderIcon, operatorLabel, }: ExpandedDropdownProps): React.ReactElement;
|
|
19
20
|
export default ExpandedDropdown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
function ExpandedDropdown({ serviceItem, isPeru = false, translation = {}, getAnimationIcon, isChangeTicket = false, isSoldOut, ladiesBookedSeats, isDpEnabled, renderIcon, }) {
|
|
2
|
+
function ExpandedDropdown({ serviceItem, isPeru = false, translation = {}, getAnimationIcon, isChangeTicket = false, isSoldOut, ladiesBookedSeats, isDpEnabled, renderIcon, operatorLabel, }) {
|
|
3
3
|
const hasPetInfo = serviceItem.pet_seat_info &&
|
|
4
4
|
Object.keys(serviceItem.pet_seat_info).length > 0;
|
|
5
5
|
return (React.createElement("div", { className: "px-[15px] pt-[26px] pb-[14px] -mt-[16px] pt-[35px] relative -z-9", style: {
|
|
@@ -18,7 +18,9 @@ function ExpandedDropdown({ serviceItem, isPeru = false, translation = {}, getAn
|
|
|
18
18
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.change_ticket_hours) || 6,
|
|
19
19
|
" horas antes"),
|
|
20
20
|
" ",
|
|
21
|
-
"de la salida del bus. El monto ser\u00E1 reembolsado a tu billetera
|
|
21
|
+
"de la salida del bus. El monto ser\u00E1 reembolsado a tu billetera",
|
|
22
|
+
" ", operatorLabel !== null && operatorLabel !== void 0 ? operatorLabel : "kupospay",
|
|
23
|
+
"."))) : (React.createElement("div", { className: "flex gap-[8px] text-[13.33px]" },
|
|
22
24
|
React.createElement("span", null, renderIcon("changeTicketIcon", "16px")),
|
|
23
25
|
React.createElement("span", null,
|
|
24
26
|
React.createElement("span", null,
|
package/dist/ui/OfferBanner.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import LottiePlayer from "../assets/LottiePlayer";
|
|
3
3
|
import CommonService from "../utils/CommonService";
|
|
4
|
-
const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, renderIcon, isLoggedIn, showLoginModal, viewersConfig, getAnimationIcon, showLoginOption }) => {
|
|
5
|
-
var _a, _b, _c, _d;
|
|
4
|
+
const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, renderIcon, isLoggedIn, showLoginModal, viewersConfig, getAnimationIcon, showLoginOption, }) => {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
6
|
return (React.createElement("div", { className: "text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[36px] pt-[50px] rounded-b-[14px] text-[14px]", style: {
|
|
7
7
|
background: offerGradient,
|
|
8
8
|
opacity: isSoldOut ? 0.5 : 1,
|
|
@@ -23,7 +23,9 @@ const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, renderIcon, isLogg
|
|
|
23
23
|
? ((serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) || "").slice(0, 30) + "..."
|
|
24
24
|
: (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) || "",
|
|
25
25
|
" ",
|
|
26
|
-
isLoggedIn && showLoginOption ? null :
|
|
26
|
+
isLoggedIn && showLoginOption ? null : Object.keys((_c = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discount_percents) !== null && _c !== void 0 ? _c : {}).length > 0 ||
|
|
27
|
+
((_d = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discounted_seats) !== null && _d !== void 0 ? _d : []).length >
|
|
28
|
+
0 ? null : (React.createElement("span", { onClick: showLoginModal, className: "cursor-pointer" }, "- registro")),
|
|
27
29
|
" ",
|
|
28
30
|
"\u00A0"),
|
|
29
31
|
" ",
|
|
@@ -45,9 +47,9 @@ const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, renderIcon, isLogg
|
|
|
45
47
|
" ",
|
|
46
48
|
React.createElement("span", { className: "" },
|
|
47
49
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled) &&
|
|
48
|
-
Object.keys((
|
|
50
|
+
Object.keys((_e = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discount_percents) !== null && _e !== void 0 ? _e : {}).length ===
|
|
49
51
|
0 &&
|
|
50
|
-
((
|
|
52
|
+
((_f = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.dp_discounted_seats) !== null && _f !== void 0 ? _f : []).length === 0
|
|
51
53
|
? null
|
|
52
54
|
: "Quedan pocos • ",
|
|
53
55
|
React.createElement("span", { className: "bold-text", ref: (node) => CommonService.startComprandoCount(node, 4, 16), style: { fontVariantNumeric: "tabular-nums" } }),
|
|
@@ -3,8 +3,6 @@ interface SeatType {
|
|
|
3
3
|
label: string;
|
|
4
4
|
fare: number;
|
|
5
5
|
key: any;
|
|
6
|
-
apiSeatType?: string;
|
|
7
|
-
api_seat_type?: string;
|
|
8
6
|
}
|
|
9
7
|
interface SeatSectionProps {
|
|
10
8
|
seatTypes: SeatType[];
|
|
@@ -18,10 +16,6 @@ interface SeatSectionProps {
|
|
|
18
16
|
serviceItem?: any;
|
|
19
17
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
20
18
|
discountSeatPriceColor?: string;
|
|
21
|
-
isTrain?: boolean;
|
|
22
|
-
selectedSeatKey?: any;
|
|
23
|
-
onSeatSelect?: (key: any, price: number, seatKey: string, apiSeatType?: string) => void;
|
|
24
|
-
topLabelColor?: string;
|
|
25
19
|
}
|
|
26
|
-
declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats,
|
|
20
|
+
declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, }: SeatSectionProps): React.ReactElement;
|
|
27
21
|
export default SeatSection;
|
|
@@ -8,8 +8,6 @@ function getAllSeatTypes(seatTypes) {
|
|
|
8
8
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
9
9
|
label: val === null || val === void 0 ? void 0 : val.label,
|
|
10
10
|
price: val === null || val === void 0 ? void 0 : val.fare,
|
|
11
|
-
key: val === null || val === void 0 ? void 0 : val.key,
|
|
12
|
-
apiSeatType: (val === null || val === void 0 ? void 0 : val.apiSeatType) || (val === null || val === void 0 ? void 0 : val.api_seat_type),
|
|
13
11
|
}));
|
|
14
12
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
15
13
|
return seatTypesWithPrices;
|
|
@@ -56,7 +54,7 @@ function getUniqueSeats(seatTypes) {
|
|
|
56
54
|
function getNumberOfSeats(seatTypes) {
|
|
57
55
|
return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
|
|
58
56
|
}
|
|
59
|
-
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats,
|
|
57
|
+
function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, dpSeatColor, discountSeatPriceColor, }) {
|
|
60
58
|
var _a;
|
|
61
59
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
62
60
|
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
@@ -67,34 +65,11 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
|
|
|
67
65
|
: CommonService.currency(price, currencySign);
|
|
68
66
|
const renderSeatNames = () => {
|
|
69
67
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
70
|
-
return seats.map((val, key) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
: undefined },
|
|
76
|
-
isTrain && (React.createElement("div", { style: {
|
|
77
|
-
border: `1px solid ${val.label === selectedSeatKey ? topLabelColor : "#ccc"}`,
|
|
78
|
-
borderRadius: "50%",
|
|
79
|
-
width: "14px",
|
|
80
|
-
height: "14px",
|
|
81
|
-
minWidth: "14px",
|
|
82
|
-
marginRight: "10px",
|
|
83
|
-
display: "flex",
|
|
84
|
-
alignItems: "center",
|
|
85
|
-
justifyContent: "center",
|
|
86
|
-
} }, val.label === selectedSeatKey && (React.createElement("div", { style: {
|
|
87
|
-
backgroundColor: topLabelColor,
|
|
88
|
-
borderRadius: "50%",
|
|
89
|
-
width: "7px",
|
|
90
|
-
height: "7px",
|
|
91
|
-
} })))),
|
|
92
|
-
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"
|
|
93
|
-
? removeDuplicateSeats && isPeru
|
|
94
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
95
|
-
: val.label
|
|
96
|
-
: null)));
|
|
97
|
-
});
|
|
68
|
+
return seats.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"
|
|
69
|
+
? removeDuplicateSeats && isPeru
|
|
70
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
71
|
+
: val.label
|
|
72
|
+
: null)));
|
|
98
73
|
};
|
|
99
74
|
const renderSeatPrices = () => {
|
|
100
75
|
if (isPeru) {
|
package/package.json
CHANGED
|
@@ -116,24 +116,9 @@ function ServiceItemPB({
|
|
|
116
116
|
showLoginModal,
|
|
117
117
|
isLoggedIn,
|
|
118
118
|
showLoginOption,
|
|
119
|
-
isTrain,
|
|
120
|
-
selectedSeatKey,
|
|
121
|
-
onSeatSelect,
|
|
122
|
-
onTrainButtonClick,
|
|
123
|
-
showSeatSelectionError,
|
|
124
|
-
onShowSeatSelectionError,
|
|
125
|
-
onClearSeatSelectionError,
|
|
126
119
|
isFlores,
|
|
120
|
+
operatorLabel,
|
|
127
121
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
128
|
-
const handleSeatSelect = (
|
|
129
|
-
key: any,
|
|
130
|
-
price: number,
|
|
131
|
-
seatKey: string,
|
|
132
|
-
apiSeatType?: string,
|
|
133
|
-
) => {
|
|
134
|
-
onClearSeatSelectionError?.();
|
|
135
|
-
onSeatSelect?.(key, price, seatKey, apiSeatType);
|
|
136
|
-
};
|
|
137
122
|
const getAnimationIcon = (icon: string) => {
|
|
138
123
|
const animation = ANIMATION_MAP[icon];
|
|
139
124
|
if (!animation) return null;
|
|
@@ -330,17 +315,6 @@ function ServiceItemPB({
|
|
|
330
315
|
return;
|
|
331
316
|
}
|
|
332
317
|
|
|
333
|
-
if (isTrain) {
|
|
334
|
-
if (!selectedSeatKey) {
|
|
335
|
-
onShowSeatSelectionError?.(serviceItem.id);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
if (onTrainButtonClick) {
|
|
339
|
-
onTrainButtonClick();
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
318
|
onBookButtonPress();
|
|
345
319
|
};
|
|
346
320
|
|
|
@@ -554,10 +528,6 @@ function ServiceItemPB({
|
|
|
554
528
|
isPeru={isPeru}
|
|
555
529
|
renderIcon={renderIcon}
|
|
556
530
|
discountSeatPriceColor={colors.discountSeatPriceColor}
|
|
557
|
-
isTrain={isTrain}
|
|
558
|
-
selectedSeatKey={selectedSeatKey}
|
|
559
|
-
onSeatSelect={handleSeatSelect}
|
|
560
|
-
topLabelColor={colors.topLabelColor}
|
|
561
531
|
/>
|
|
562
532
|
</div>
|
|
563
533
|
|
|
@@ -573,18 +543,6 @@ function ServiceItemPB({
|
|
|
573
543
|
soldOutIcon={renderIcon("soldOutIcon", "14px")}
|
|
574
544
|
onClick={checkMidnight}
|
|
575
545
|
/>
|
|
576
|
-
{showSeatSelectionError === serviceItem.id && isTrain && (
|
|
577
|
-
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
578
|
-
<div
|
|
579
|
-
className="text-[9px] text-center whitespace-nowrap"
|
|
580
|
-
style={{
|
|
581
|
-
color: colors.seatPriceColor,
|
|
582
|
-
}}
|
|
583
|
-
>
|
|
584
|
-
Selecciona el tipo de servicio
|
|
585
|
-
</div>
|
|
586
|
-
</div>
|
|
587
|
-
)}
|
|
588
546
|
{showLastSeats ? (
|
|
589
547
|
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
590
548
|
{serviceItem?.available_seats < 10 &&
|
|
@@ -631,6 +589,7 @@ function ServiceItemPB({
|
|
|
631
589
|
"grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
632
590
|
position: "relative",
|
|
633
591
|
zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
|
|
592
|
+
marginTop: isItemExpanded ? "" : "-6px",
|
|
634
593
|
}}
|
|
635
594
|
>
|
|
636
595
|
<div
|
|
@@ -659,6 +618,7 @@ function ServiceItemPB({
|
|
|
659
618
|
ladiesBookedSeats={serviceItem.ladies_booked_seats}
|
|
660
619
|
isDpEnabled={serviceItem.is_dp_enabled}
|
|
661
620
|
renderIcon={renderIcon}
|
|
621
|
+
operatorLabel={operatorLabel}
|
|
662
622
|
/>
|
|
663
623
|
</div>
|
|
664
624
|
</div>
|
|
@@ -226,17 +226,6 @@ export interface ServiceItemProps {
|
|
|
226
226
|
showLoginModal?: any;
|
|
227
227
|
isLoggedIn?: any;
|
|
228
228
|
showLoginOption?: boolean;
|
|
229
|
-
isTrain?: boolean;
|
|
230
|
-
selectedSeatKey?: any;
|
|
231
|
-
onSeatSelect?: (
|
|
232
|
-
key: any,
|
|
233
|
-
price: number,
|
|
234
|
-
seatKey: string,
|
|
235
|
-
apiSeatType?: string,
|
|
236
|
-
) => void;
|
|
237
|
-
onTrainButtonClick?: any;
|
|
238
|
-
showSeatSelectionError?: string | null;
|
|
239
|
-
onShowSeatSelectionError?: (serviceId: string) => void;
|
|
240
|
-
onClearSeatSelectionError?: () => void;
|
|
241
229
|
isFlores?: boolean;
|
|
230
|
+
operatorLabel?: string;
|
|
242
231
|
}
|
|
@@ -16,6 +16,7 @@ interface ExpandedDropdownProps {
|
|
|
16
16
|
ladiesBookedSeats?: string;
|
|
17
17
|
isDpEnabled?: boolean;
|
|
18
18
|
renderIcon?: any;
|
|
19
|
+
operatorLabel?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
function ExpandedDropdown({
|
|
@@ -28,6 +29,7 @@ function ExpandedDropdown({
|
|
|
28
29
|
ladiesBookedSeats,
|
|
29
30
|
isDpEnabled,
|
|
30
31
|
renderIcon,
|
|
32
|
+
operatorLabel,
|
|
31
33
|
}: ExpandedDropdownProps): React.ReactElement {
|
|
32
34
|
const hasPetInfo =
|
|
33
35
|
serviceItem.pet_seat_info &&
|
|
@@ -62,8 +64,8 @@ function ExpandedDropdown({
|
|
|
62
64
|
<span className="bold-text">
|
|
63
65
|
hasta {serviceItem?.change_ticket_hours || 6} horas antes
|
|
64
66
|
</span>{" "}
|
|
65
|
-
de la salida del bus. El monto será reembolsado a tu billetera
|
|
66
|
-
kupospay.
|
|
67
|
+
de la salida del bus. El monto será reembolsado a tu billetera{" "}
|
|
68
|
+
{operatorLabel ?? "kupospay"}.
|
|
67
69
|
</span>
|
|
68
70
|
</div>
|
|
69
71
|
) : (
|
package/src/ui/OfferBanner.tsx
CHANGED
|
@@ -18,7 +18,7 @@ interface OfferBannerProps {
|
|
|
18
18
|
showLoginModal: any;
|
|
19
19
|
viewersConfig: ServiceItemProps["viewersConfig"];
|
|
20
20
|
getAnimationIcon: (name: string) => any;
|
|
21
|
-
showLoginOption?: boolean
|
|
21
|
+
showLoginOption?: boolean;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
@@ -30,7 +30,7 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
30
30
|
showLoginModal,
|
|
31
31
|
viewersConfig,
|
|
32
32
|
getAnimationIcon,
|
|
33
|
-
showLoginOption
|
|
33
|
+
showLoginOption,
|
|
34
34
|
}) => {
|
|
35
35
|
return (
|
|
36
36
|
<div
|
|
@@ -73,7 +73,11 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
73
73
|
{(serviceItem?.offer_text || "").length > 30
|
|
74
74
|
? (serviceItem?.offer_text || "").slice(0, 30) + "..."
|
|
75
75
|
: serviceItem?.offer_text || ""}{" "}
|
|
76
|
-
{isLoggedIn && showLoginOption ? null : (
|
|
76
|
+
{isLoggedIn && showLoginOption ? null : Object.keys(
|
|
77
|
+
serviceItem?.dp_discount_percents ?? {},
|
|
78
|
+
).length > 0 ||
|
|
79
|
+
(serviceItem?.dp_discounted_seats ?? []).length >
|
|
80
|
+
0 ? null : (
|
|
77
81
|
<span onClick={showLoginModal} className="cursor-pointer">
|
|
78
82
|
- registro
|
|
79
83
|
</span>
|
|
@@ -7,8 +7,6 @@ interface SeatType {
|
|
|
7
7
|
label: string;
|
|
8
8
|
fare: number;
|
|
9
9
|
key: any;
|
|
10
|
-
apiSeatType?: string;
|
|
11
|
-
api_seat_type?: string;
|
|
12
10
|
}
|
|
13
11
|
|
|
14
12
|
interface SeatSectionProps {
|
|
@@ -23,15 +21,6 @@ interface SeatSectionProps {
|
|
|
23
21
|
serviceItem?: any;
|
|
24
22
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
25
23
|
discountSeatPriceColor?: string;
|
|
26
|
-
isTrain?: boolean;
|
|
27
|
-
selectedSeatKey?: any;
|
|
28
|
-
onSeatSelect?: (
|
|
29
|
-
key: any,
|
|
30
|
-
price: number,
|
|
31
|
-
seatKey: string,
|
|
32
|
-
apiSeatType?: string,
|
|
33
|
-
) => void;
|
|
34
|
-
topLabelColor?: string;
|
|
35
24
|
}
|
|
36
25
|
|
|
37
26
|
function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
@@ -42,8 +31,6 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
42
31
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
43
32
|
label: val?.label,
|
|
44
33
|
price: val?.fare,
|
|
45
|
-
key: val?.key,
|
|
46
|
-
apiSeatType: val?.apiSeatType || val?.api_seat_type,
|
|
47
34
|
}));
|
|
48
35
|
|
|
49
36
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
@@ -110,15 +97,11 @@ function SeatSection({
|
|
|
110
97
|
priceColor,
|
|
111
98
|
currencySign,
|
|
112
99
|
removeDuplicateSeats,
|
|
113
|
-
selectedSeatKey,
|
|
114
|
-
onSeatSelect,
|
|
115
100
|
isPeru,
|
|
116
101
|
serviceItem,
|
|
117
102
|
renderIcon,
|
|
118
103
|
dpSeatColor,
|
|
119
104
|
discountSeatPriceColor,
|
|
120
|
-
isTrain,
|
|
121
|
-
topLabelColor,
|
|
122
105
|
}: SeatSectionProps): React.ReactElement {
|
|
123
106
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
124
107
|
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
@@ -133,66 +116,22 @@ function SeatSection({
|
|
|
133
116
|
const renderSeatNames = () => {
|
|
134
117
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
135
118
|
|
|
136
|
-
return seats.map((val, key: number) =>
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
? () =>
|
|
144
|
-
val.label === selectedSeatKey
|
|
145
|
-
? onSeatSelect?.(null, 0, "", "")
|
|
146
|
-
: onSeatSelect?.(
|
|
147
|
-
val.label,
|
|
148
|
-
val.price,
|
|
149
|
-
val.key,
|
|
150
|
-
(val as any).apiSeatType,
|
|
151
|
-
)
|
|
152
|
-
: undefined
|
|
153
|
-
}
|
|
119
|
+
return seats.map((val, key: number) =>
|
|
120
|
+
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
121
|
+
<span
|
|
122
|
+
key={key}
|
|
123
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
124
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
125
|
+
}`}
|
|
154
126
|
>
|
|
155
|
-
{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
marginRight: "10px",
|
|
164
|
-
display: "flex",
|
|
165
|
-
alignItems: "center",
|
|
166
|
-
justifyContent: "center",
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
{val.label === selectedSeatKey && (
|
|
170
|
-
<div
|
|
171
|
-
style={{
|
|
172
|
-
backgroundColor: topLabelColor,
|
|
173
|
-
borderRadius: "50%",
|
|
174
|
-
width: "7px",
|
|
175
|
-
height: "7px",
|
|
176
|
-
}}
|
|
177
|
-
/>
|
|
178
|
-
)}
|
|
179
|
-
</div>
|
|
180
|
-
)}
|
|
181
|
-
<span
|
|
182
|
-
key={key}
|
|
183
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
184
|
-
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
185
|
-
}`}
|
|
186
|
-
>
|
|
187
|
-
{typeof val.label === "string" || typeof val.label === "number"
|
|
188
|
-
? removeDuplicateSeats && isPeru
|
|
189
|
-
? CommonService.truncateSeatLabel(val.label)
|
|
190
|
-
: val.label
|
|
191
|
-
: null}
|
|
192
|
-
</span>
|
|
193
|
-
</div>
|
|
194
|
-
);
|
|
195
|
-
});
|
|
127
|
+
{typeof val.label === "string" || typeof val.label === "number"
|
|
128
|
+
? removeDuplicateSeats && isPeru
|
|
129
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
130
|
+
: val.label
|
|
131
|
+
: null}
|
|
132
|
+
</span>
|
|
133
|
+
),
|
|
134
|
+
);
|
|
196
135
|
};
|
|
197
136
|
|
|
198
137
|
const renderSeatPrices = () => {
|