kupos-ui-components-lib 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PaymentSideBar/PaymentItem.d.ts +1 -2
- package/dist/components/PaymentSideBar/PaymentItem.js +2 -2
- package/dist/components/PaymentSideBar/PaymentSideBarDesktop.js +19 -22
- package/dist/components/PaymentSideBar/types.d.ts +1 -0
- package/dist/components/ServiceFilterBar/ResponsiveFilterBar.d.ts +6 -0
- package/dist/components/ServiceFilterBar/ResponsiveFilterBar.js +13 -0
- package/dist/components/ServiceFilterBar/ServiceFilterBarDesktop.d.ts +26 -0
- package/dist/components/ServiceFilterBar/ServiceFilterBarDesktop.js +201 -0
- package/dist/components/ServiceFilterBar/ServiceFilterBarMobile.d.ts +4 -0
- package/dist/components/ServiceFilterBar/ServiceFilterBarMobile.js +7 -0
- package/dist/components/ServiceFilterBar/index.d.ts +5 -0
- package/dist/components/ServiceFilterBar/index.js +4 -0
- package/dist/components/ServiceFilterBar/types.d.ts +30 -0
- package/dist/components/ServiceFilterBar/types.js +1 -0
- package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +3 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +25 -19
- package/dist/components/ServiceItem/types.d.ts +1 -0
- package/dist/styles.css +6 -0
- package/dist/utils/CommonService.d.ts +4 -0
- package/dist/utils/CommonService.js +10 -0
- package/package.json +1 -1
- package/src/components/PaymentSideBar/PaymentItem.tsx +4 -4
- package/src/components/PaymentSideBar/PaymentSideBarDesktop.tsx +34 -30
- package/src/components/PaymentSideBar/types.ts +1 -0
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +51 -48
- package/src/components/ServiceItem/types.ts +1 -0
- package/src/utils/CommonService.ts +12 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
interface PaymentItemProps {
|
|
3
3
|
label: ReactNode;
|
|
4
|
-
amount:
|
|
4
|
+
amount: string;
|
|
5
5
|
currency?: string;
|
|
6
|
-
formatter?: (amount: number) => string;
|
|
7
6
|
className?: string;
|
|
8
7
|
isNegative?: boolean;
|
|
9
8
|
customStyle?: React.CSSProperties;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
const PaymentItem = ({ label, amount, currency = "CLP",
|
|
2
|
+
const PaymentItem = ({ label, amount, currency = "CLP", className = "", isNegative = false, customStyle = {}, }) => {
|
|
3
3
|
return (React.createElement("div", { className: `flex justify-between items-center w-full ${className} text-[13.33px] `, style: { margin: "6px 0" } },
|
|
4
4
|
React.createElement("div", { className: "" }, label),
|
|
5
5
|
React.createElement("div", { className: "bold-text", style: Object.assign({ minWidth: 80, display: "flex", justifyContent: "flex-end" }, customStyle) },
|
|
6
6
|
currency,
|
|
7
7
|
" ",
|
|
8
8
|
isNegative ? "- " : "",
|
|
9
|
-
|
|
9
|
+
amount)));
|
|
10
10
|
};
|
|
11
11
|
export default PaymentItem;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DateService from "../../utils/DateService";
|
|
3
3
|
import PaymentItem from "./PaymentItem";
|
|
4
|
-
|
|
5
|
-
const formattedAmount = amount
|
|
6
|
-
.toString()
|
|
7
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
8
|
-
return "$" + formattedAmount;
|
|
9
|
-
};
|
|
4
|
+
import CommonService from "../../utils/CommonService";
|
|
10
5
|
const renderSummaryDetailsCard = ({ serviceName, date, source, dest, boardingStage, boardingTime, droppingStage, droppingTime, duration, trainType, isTrain, icons, }) => {
|
|
11
6
|
return (React.createElement(React.Fragment, null,
|
|
12
7
|
React.createElement("div", { className: "mt-3 border-b border-[#ccc] pb-3 text-[13.33px]" },
|
|
@@ -46,7 +41,7 @@ const renderSummaryDetailsCard = ({ serviceName, date, source, dest, boardingSta
|
|
|
46
41
|
duration,
|
|
47
42
|
" horas")))))));
|
|
48
43
|
};
|
|
49
|
-
const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData, dateOnward, dateReturn, sourceOnward, sourceReturn, destinationOnward, destinationReturn, boardingStageOnward, boardingStageReturn, droppingStageOnward, droppingStageReturn, boardingTimeOnward, boardingTimeReturn, droppingTimeOnward, droppingTimeReturn, durationOnward, durationReturn, selectSeatOnward, selectSeatReturn, journeyTypeActive, setJourneyTypeActive, translation, trainTypeOnward, trainTypeReturn, colors, trainType, icons, selectedOnward, selectedReturn, conexionChecked, conexionPassengers, returnConexionFare, conexionFare, loginData, checkWhatsappEligibility, removeDiscountAtomValue, netFare, promoCode, onPromoRemove, isAgency, agencyFee, walletMoney, virtualMoney, virtualLimit, showUsd, netFareInUsd, renderDiscount, discountAmount, }) => {
|
|
44
|
+
const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData, currencySign, dateOnward, dateReturn, sourceOnward, sourceReturn, destinationOnward, destinationReturn, boardingStageOnward, boardingStageReturn, droppingStageOnward, droppingStageReturn, boardingTimeOnward, boardingTimeReturn, droppingTimeOnward, droppingTimeReturn, durationOnward, durationReturn, selectSeatOnward, selectSeatReturn, journeyTypeActive, setJourneyTypeActive, translation, trainTypeOnward, trainTypeReturn, colors, trainType, icons, selectedOnward, selectedReturn, conexionChecked, conexionPassengers, returnConexionFare, conexionFare, loginData, checkWhatsappEligibility, removeDiscountAtomValue, netFare, promoCode, onPromoRemove, isAgency, agencyFee, walletMoney, virtualMoney, virtualLimit, showUsd, netFareInUsd, renderDiscount, discountAmount, }) => {
|
|
50
45
|
console.log("🚀 ~ PaymentSideBarDesktop ~ netFare:", netFare);
|
|
51
46
|
return (React.createElement("div", null,
|
|
52
47
|
React.createElement("div", { className: "bg-white rounded-[20px] shadow-service mb-[10px] mx-auto w-[325px] relative" },
|
|
@@ -119,8 +114,9 @@ const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
119
114
|
,
|
|
120
115
|
":"),
|
|
121
116
|
React.createElement("div", { className: "bold-text" },
|
|
122
|
-
"CLP
|
|
123
|
-
|
|
117
|
+
"CLP",
|
|
118
|
+
" ",
|
|
119
|
+
CommonService.currency(val.fare * selectedOnward[1][key], currencySign))));
|
|
124
120
|
})
|
|
125
121
|
: null,
|
|
126
122
|
selectSeatReturn && selectedReturn && selectedReturn[0]
|
|
@@ -138,13 +134,14 @@ const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
138
134
|
,
|
|
139
135
|
":"),
|
|
140
136
|
React.createElement("div", { className: "bold-text" },
|
|
141
|
-
"CLP
|
|
142
|
-
|
|
137
|
+
"CLP",
|
|
138
|
+
" ",
|
|
139
|
+
CommonService.currency(val.fare * selectedReturn[1][key], currencySign))));
|
|
143
140
|
})
|
|
144
141
|
: null),
|
|
145
|
-
conexionChecked && conexionFare && returnConexionFare ? (React.createElement(PaymentItem, { label: "Conexi\u00F3n Aeropuerto:", amount: dateReturn
|
|
142
|
+
conexionChecked && conexionFare && returnConexionFare ? (React.createElement(PaymentItem, { label: "Conexi\u00F3n Aeropuerto:", amount: CommonService.currency(dateReturn
|
|
146
143
|
? returnConexionFare * conexionPassengers
|
|
147
|
-
: conexionFare,
|
|
144
|
+
: conexionFare, currencySign), className: "subtotal-row font10" })) : null,
|
|
148
145
|
metaData &&
|
|
149
146
|
metaData.whatsapp_delivery_charges &&
|
|
150
147
|
!loginData &&
|
|
@@ -157,18 +154,18 @@ const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
157
154
|
width: "15px",
|
|
158
155
|
} }),
|
|
159
156
|
React.createElement("div", { className: "duration-mouseover font9", style: { lineHeight: "1.3" } },
|
|
160
|
-
React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.whatsappInfoIcon)))), amount: metaData.whatsapp_delivery_charges,
|
|
161
|
-
removeDiscountAtomValue && (React.createElement(PaymentItem, { label: "Cup\u00F3n", amount: netFare,
|
|
157
|
+
React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.whatsappInfoIcon)))), amount: metaData.whatsapp_delivery_charges, className: "font10", customStyle: { color: "var(--secondary-color)" } })) : null,
|
|
158
|
+
removeDiscountAtomValue && (React.createElement(PaymentItem, { label: "Cup\u00F3n", amount: CommonService.currency(netFare, currencySign), isNegative: true })),
|
|
162
159
|
renderDiscount(discountAmount),
|
|
163
|
-
React.createElement(PaymentItem, { label: `${translation === null || translation === void 0 ? void 0 : translation.promotionalCode}:`, amount: (promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount) ? promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount : 0,
|
|
160
|
+
React.createElement(PaymentItem, { label: `${translation === null || translation === void 0 ? void 0 : translation.promotionalCode}:`, amount: CommonService.currency((promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount) ? promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount : 0, currencySign), className: "text-[13.33px]" }),
|
|
164
161
|
(promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount) ? (React.createElement("div", { className: "promocode font10" },
|
|
165
162
|
React.createElement("div", null, promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCode),
|
|
166
163
|
React.createElement("span", { className: "promo-remove", onClick: onPromoRemove },
|
|
167
164
|
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.closeIcon, alt: "close", className: "w-[16px] h-[16px]" })))) : null,
|
|
168
|
-
isAgency && (React.createElement(PaymentItem, { label: translation === null || translation === void 0 ? void 0 : translation.agencyFee, amount: agencyFee ? agencyFee : 0,
|
|
169
|
-
walletMoney ? (React.createElement(PaymentItem, { label: "KuposPay", amount: walletMoney,
|
|
170
|
-
virtualMoney ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "secondary-text bold-text" }, `kuposcréditos(${virtualLimit}%)`), amount: virtualMoney,
|
|
171
|
-
showUsd ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "primary-text" }, translation === null || translation === void 0 ? void 0 : translation.showUsd), amount: isAgency ? netFareInUsd + agencyFee : netFareInUsd, currency: "USD",
|
|
165
|
+
isAgency && (React.createElement(PaymentItem, { label: translation === null || translation === void 0 ? void 0 : translation.agencyFee, amount: CommonService.currency(agencyFee ? agencyFee : 0, currencySign) })),
|
|
166
|
+
walletMoney ? (React.createElement(PaymentItem, { label: "KuposPay", amount: CommonService.currency(walletMoney, currencySign) })) : null,
|
|
167
|
+
virtualMoney ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "secondary-text bold-text" }, `kuposcréditos(${virtualLimit}%)`), amount: CommonService.currency(virtualMoney, currencySign), customStyle: { color: "var(--secondary-color)" } })) : null,
|
|
168
|
+
showUsd ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "primary-text" }, translation === null || translation === void 0 ? void 0 : translation.showUsd), amount: CommonService.currency(isAgency ? netFareInUsd + agencyFee : netFareInUsd, currencySign), currency: "USD", customStyle: { color: "var(--primary-color)" } })) : null),
|
|
172
169
|
React.createElement("div", { className: ` text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[8%] pt-[50px] -z-10 rounded-b-[14px] text-[14px]`, style: { backgroundColor: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor } },
|
|
173
170
|
React.createElement("div", { className: "flex justify-between items-center w-full" },
|
|
174
171
|
React.createElement("div", { className: "" }, "Total"),
|
|
@@ -179,10 +176,10 @@ const PaymentSideBarDesktop = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
179
176
|
} },
|
|
180
177
|
"CLP",
|
|
181
178
|
" ",
|
|
182
|
-
currency(removeDiscountAtomValue
|
|
179
|
+
CommonService.currency(removeDiscountAtomValue
|
|
183
180
|
? 0
|
|
184
181
|
: isAgency
|
|
185
182
|
? netFare + agencyFee
|
|
186
|
-
: netFare)))))));
|
|
183
|
+
: netFare, currencySign)))))));
|
|
187
184
|
};
|
|
188
185
|
export default PaymentSideBarDesktop;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ServiceFilterBarDesktop from "./ServiceFilterBarDesktop";
|
|
3
|
+
import ServiceFilterBarMobile from "./ServiceFilterBarMobile";
|
|
4
|
+
class ResponsiveServiceFilterBar extends React.Component {
|
|
5
|
+
render() {
|
|
6
|
+
const { variant = "desktop" } = this.props;
|
|
7
|
+
if (variant === "mobile") {
|
|
8
|
+
return React.createElement(ServiceFilterBarMobile, Object.assign({}, this.props));
|
|
9
|
+
}
|
|
10
|
+
return React.createElement(ServiceFilterBarDesktop, Object.assign({}, this.props));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export default ResponsiveServiceFilterBar;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ServiceFilterBarProps } from "./types";
|
|
3
|
+
interface ServiceFilterBarDesktopState {
|
|
4
|
+
showOperators: boolean;
|
|
5
|
+
showTimeOptions: boolean;
|
|
6
|
+
showSeatOptions: boolean;
|
|
7
|
+
showTypeOptions: boolean;
|
|
8
|
+
showSpecialDeparture: boolean;
|
|
9
|
+
showTrainType: boolean;
|
|
10
|
+
addMargin: boolean;
|
|
11
|
+
sortedFilters: any[];
|
|
12
|
+
}
|
|
13
|
+
declare class ServiceFilterBarDesktop extends React.Component<ServiceFilterBarProps, ServiceFilterBarDesktopState> {
|
|
14
|
+
constructor(props: ServiceFilterBarProps);
|
|
15
|
+
componentDidMount(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
componentDidUpdate(prevProps: ServiceFilterBarProps): void;
|
|
18
|
+
handleScroll(): void;
|
|
19
|
+
sortFilters(filtersArray: any[]): any[];
|
|
20
|
+
clearFilter(): void;
|
|
21
|
+
showClearFilter(): boolean;
|
|
22
|
+
toggleFilter(type: string): void;
|
|
23
|
+
renderFilterItem(option: any, onClick: (i: number) => void, key: number): React.JSX.Element;
|
|
24
|
+
render(): React.JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
export default ServiceFilterBarDesktop;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import commonService from "../../utils/CommonService";
|
|
3
|
+
let SEAT_ORDER = [
|
|
4
|
+
"Ejecutivo",
|
|
5
|
+
"Semi Cama",
|
|
6
|
+
"Semi Cama Low",
|
|
7
|
+
"Salón Cama",
|
|
8
|
+
"Salón Cama (I)",
|
|
9
|
+
"Salón Cama Low",
|
|
10
|
+
"Premium",
|
|
11
|
+
"Premium (I)",
|
|
12
|
+
];
|
|
13
|
+
class ServiceFilterBarDesktop extends React.Component {
|
|
14
|
+
constructor(props) {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16
|
+
super(props);
|
|
17
|
+
this.state = {
|
|
18
|
+
showOperators: ((_a = props.initialOpenFilters) === null || _a === void 0 ? void 0 : _a.includes("operator")) || false,
|
|
19
|
+
showTimeOptions: ((_b = props.initialOpenFilters) === null || _b === void 0 ? void 0 : _b.includes("time")) || false,
|
|
20
|
+
showSeatOptions: ((_c = props.initialOpenFilters) === null || _c === void 0 ? void 0 : _c.includes("seat_types")) || false,
|
|
21
|
+
showTypeOptions: ((_d = props.initialOpenFilters) === null || _d === void 0 ? void 0 : _d.includes("tipo")) || false,
|
|
22
|
+
showSpecialDeparture: ((_e = props.initialOpenFilters) === null || _e === void 0 ? void 0 : _e.includes("special_departure")) || false,
|
|
23
|
+
showTrainType: ((_f = props.initialOpenFilters) === null || _f === void 0 ? void 0 : _f.includes("train_type")) || false,
|
|
24
|
+
addMargin: false,
|
|
25
|
+
sortedFilters: this.sortFilters(props.filtersArray),
|
|
26
|
+
};
|
|
27
|
+
this.handleScroll = this.handleScroll.bind(this);
|
|
28
|
+
this.clearFilter = this.clearFilter.bind(this);
|
|
29
|
+
}
|
|
30
|
+
componentDidMount() {
|
|
31
|
+
window.addEventListener("scroll", this.handleScroll);
|
|
32
|
+
this.clearFilter();
|
|
33
|
+
}
|
|
34
|
+
componentWillUnmount() {
|
|
35
|
+
window.removeEventListener("scroll", this.handleScroll);
|
|
36
|
+
}
|
|
37
|
+
componentDidUpdate(prevProps) {
|
|
38
|
+
if (prevProps.showReturnTripModal !== this.props.showReturnTripModal) {
|
|
39
|
+
this.clearFilter();
|
|
40
|
+
}
|
|
41
|
+
if (prevProps.filtersArray !== this.props.filtersArray) {
|
|
42
|
+
this.setState({
|
|
43
|
+
sortedFilters: this.sortFilters(this.props.filtersArray),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleScroll() {
|
|
48
|
+
this.setState({ addMargin: window.scrollY > 0 });
|
|
49
|
+
}
|
|
50
|
+
sortFilters(filtersArray) {
|
|
51
|
+
let newArr = [];
|
|
52
|
+
filtersArray.forEach((val) => {
|
|
53
|
+
if (val.type === "seat_types") {
|
|
54
|
+
let newSeatOrder = val.options.sort((a, b) => SEAT_ORDER.indexOf(a.label) - SEAT_ORDER.indexOf(b.label));
|
|
55
|
+
newArr.push(Object.assign(Object.assign({}, val), { options: newSeatOrder }));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
newArr.push(val);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return newArr;
|
|
62
|
+
}
|
|
63
|
+
clearFilter() {
|
|
64
|
+
let filters = commonService.copyObject(this.props.filtersArray);
|
|
65
|
+
for (let f of filters) {
|
|
66
|
+
for (let o of f.options) {
|
|
67
|
+
o.active = false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this.props.onFilterClear(filters);
|
|
71
|
+
}
|
|
72
|
+
showClearFilter() {
|
|
73
|
+
for (let f of this.props.filtersArray) {
|
|
74
|
+
for (let o of f.options) {
|
|
75
|
+
if (o.active) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
toggleFilter(type) {
|
|
83
|
+
this.setState((prevState) => {
|
|
84
|
+
return Object.assign(Object.assign({}, prevState), { showOperators: type === "operator"
|
|
85
|
+
? !prevState.showOperators
|
|
86
|
+
: prevState.showOperators, showTimeOptions: type === "time"
|
|
87
|
+
? !prevState.showTimeOptions
|
|
88
|
+
: prevState.showTimeOptions, showSeatOptions: type === "seat_types"
|
|
89
|
+
? !prevState.showSeatOptions
|
|
90
|
+
: prevState.showSeatOptions, showTypeOptions: type === "tipo"
|
|
91
|
+
? !prevState.showTypeOptions
|
|
92
|
+
: prevState.showTypeOptions, showSpecialDeparture: type === "special_departure"
|
|
93
|
+
? !prevState.showSpecialDeparture
|
|
94
|
+
: prevState.showSpecialDeparture, showTrainType: type === "train_type"
|
|
95
|
+
? !prevState.showTrainType
|
|
96
|
+
: prevState.showTrainType });
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
renderFilterItem(option, onClick, key) {
|
|
100
|
+
const { showOperators, showTimeOptions, showSeatOptions, showTypeOptions, showSpecialDeparture, showTrainType, } = this.state;
|
|
101
|
+
const isOpen = (option.type === "operator" && showOperators) ||
|
|
102
|
+
(option.type === "time" && showTimeOptions) ||
|
|
103
|
+
(option.type === "seat_types" && showSeatOptions) ||
|
|
104
|
+
(option.type === "tipo" && showTypeOptions) ||
|
|
105
|
+
(option.type === "special_departure" && showSpecialDeparture) ||
|
|
106
|
+
(option.type === "train_type" && showTrainType);
|
|
107
|
+
// if (option?.type === "train_type" && !this.props.isTrain) {
|
|
108
|
+
// return null;
|
|
109
|
+
// }
|
|
110
|
+
if (this.props.isTrain &&
|
|
111
|
+
["operator", "seat_types", "special_departure"].includes(option === null || option === void 0 ? void 0 : option.type)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return (React.createElement("div", { key: key },
|
|
115
|
+
React.createElement("div", { onClick: () => this.toggleFilter(option.type), className: "bold-text flex items-center justify-between mt-[16px]" },
|
|
116
|
+
this.props.t("RESULTS_PAGE." + option.title),
|
|
117
|
+
React.createElement("img", { src: this.props.icons.downArrow, alt: "downArrow", className: `${isOpen ? "rotate-180" : ""} w-[auto] h-[9px] transition-all duration-300` })),
|
|
118
|
+
isOpen &&
|
|
119
|
+
option.options.map((val, i) => {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f;
|
|
121
|
+
let iconKey = "";
|
|
122
|
+
if (val.icon === "sunrise") {
|
|
123
|
+
iconKey = val.active
|
|
124
|
+
? this.props.icons.iconSunriseOrange
|
|
125
|
+
: this.props.icons.iconSunrise;
|
|
126
|
+
}
|
|
127
|
+
else if (val.icon === "morning") {
|
|
128
|
+
iconKey = val.active
|
|
129
|
+
? this.props.icons.iconMorningOrange
|
|
130
|
+
: this.props.icons.iconMorning;
|
|
131
|
+
}
|
|
132
|
+
else if (val.icon === "sunset") {
|
|
133
|
+
iconKey = val.active
|
|
134
|
+
? this.props.icons.iconSunsetOrange
|
|
135
|
+
: this.props.icons.iconSunset;
|
|
136
|
+
}
|
|
137
|
+
else if (val.icon === "night") {
|
|
138
|
+
iconKey = val.active
|
|
139
|
+
? this.props.icons.iconNightOrange
|
|
140
|
+
: this.props.icons.iconNight;
|
|
141
|
+
}
|
|
142
|
+
let label = "";
|
|
143
|
+
if (val.icon === "night") {
|
|
144
|
+
label = (_a = this.props.translation) === null || _a === void 0 ? void 0 : _a.night;
|
|
145
|
+
}
|
|
146
|
+
else if (val.icon === "morning") {
|
|
147
|
+
label = (_b = this.props.translation) === null || _b === void 0 ? void 0 : _b.morning;
|
|
148
|
+
}
|
|
149
|
+
else if (val.icon === "sunset") {
|
|
150
|
+
label = (_c = this.props.translation) === null || _c === void 0 ? void 0 : _c.sunset;
|
|
151
|
+
}
|
|
152
|
+
else if (val.icon === "sunrise") {
|
|
153
|
+
label = (_d = this.props.translation) === null || _d === void 0 ? void 0 : _d.sunrise;
|
|
154
|
+
}
|
|
155
|
+
else if (val.label === "DIRECT_FILTER") {
|
|
156
|
+
label = (_e = this.props.translation) === null || _e === void 0 ? void 0 : _e.directService;
|
|
157
|
+
}
|
|
158
|
+
else if (val.label === "tipo") {
|
|
159
|
+
label = (_f = this.props.translation) === null || _f === void 0 ? void 0 : _f.tipo;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
label = val.trText
|
|
163
|
+
? val.trText
|
|
164
|
+
: val.spText
|
|
165
|
+
? val.spText
|
|
166
|
+
: val.label;
|
|
167
|
+
}
|
|
168
|
+
return (React.createElement("div", { key: i, onClick: () => onClick(i), style: {
|
|
169
|
+
margin: "3px 0",
|
|
170
|
+
backgroundColor: val.active
|
|
171
|
+
? this.props.colors.selectedColor
|
|
172
|
+
: "",
|
|
173
|
+
padding: "2px 6px",
|
|
174
|
+
paddingLeft: val.active ? "11px" : "",
|
|
175
|
+
marginLeft: val.active ? "-10px" : "",
|
|
176
|
+
}, className: `flex items-center h-[26px] rounded-[15px] cursor-pointer pt-[4px] capitalize ${val.active
|
|
177
|
+
? `text-[${this.props.colors.selectedTextColor}]`
|
|
178
|
+
: ""} ${val.active ? "bold-text" : ""}` },
|
|
179
|
+
val.icon && this.props.icons && (React.createElement("img", { src: iconKey, alt: val.icon, className: "w-[20px] h-[20px] mr-[10px]" })),
|
|
180
|
+
label));
|
|
181
|
+
})));
|
|
182
|
+
}
|
|
183
|
+
render() {
|
|
184
|
+
var _a, _b;
|
|
185
|
+
const { onFilterSelected } = this.props;
|
|
186
|
+
const { sortedFilters } = this.state;
|
|
187
|
+
return (React.createElement("div", null,
|
|
188
|
+
React.createElement("div", { className: "flex flex-col px-[20px] py-[16px] max-h-[66vh] z-[2] border-[1px] border-[#ddd] rounded-[20px] bg-[#fff] scrollbar-width-none shadow-none cursor-pointer relative overflow-scroll mb-[30px] flex justify-center mt-[20px]" },
|
|
189
|
+
React.createElement("span", { className: "text-[17.33px] bold-text flex justify-center mt-[20px]" }, (_a = this.props.translation) === null || _a === void 0 ? void 0 : _a.filterHeader),
|
|
190
|
+
React.createElement("div", { className: "text-[13.33px] pb-[10px]" }, sortedFilters === null || sortedFilters === void 0 ? void 0 : sortedFilters.map((val, key) => {
|
|
191
|
+
var _a;
|
|
192
|
+
return ((_a = val.options) === null || _a === void 0 ? void 0 : _a.length)
|
|
193
|
+
? this.renderFilterItem(val, (i) => onFilterSelected(val, key, i), key)
|
|
194
|
+
: null;
|
|
195
|
+
}))),
|
|
196
|
+
this.showClearFilter() && (React.createElement("div", { onClick: this.clearFilter, className: "text-[13.33px] bold-text items-center cursor-pointer absolute flex justify-center bg-[#eaeaea] pt-[35px] pb-[7px] w-full left-0 z-[1] -bottom-[1px] rounded-b-[10px]" },
|
|
197
|
+
React.createElement("img", { src: this.props.icons.removeFilterIcon, alt: "removeFilterIcon", className: "w-[16px] h-[16px] mr-[10px]" }), (_b = this.props.translation) === null || _b === void 0 ? void 0 :
|
|
198
|
+
_b.removeFilters))));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
export default ServiceFilterBarDesktop;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const ServiceFilterBarMobile = ({ t, onFilterSelected, onFilterClear, showReturnTripModal, initialOpenFilters = [], filtersArray = [], }) => {
|
|
3
|
+
return (React.createElement("div", null,
|
|
4
|
+
React.createElement("button", { className: "bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded" }, t("filters"))));
|
|
5
|
+
};
|
|
6
|
+
// Track open filter categories
|
|
7
|
+
export default ServiceFilterBarMobile;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import ServiceFilterBarDesktop from "./ServiceFilterBarDesktop";
|
|
2
|
+
import ServiceFilterBarMobile from "./ServiceFilterBarMobile";
|
|
3
|
+
import ResponsiveFilterBar from "./ResponsiveFilterBar";
|
|
4
|
+
export { ServiceFilterBarDesktop, ServiceFilterBarMobile, ResponsiveFilterBar };
|
|
5
|
+
export type { ServiceFilterBarProps } from "./types";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ServiceFilterBarProps {
|
|
2
|
+
variant?: "mobile" | "desktop";
|
|
3
|
+
key?: string;
|
|
4
|
+
t: (key: string) => string;
|
|
5
|
+
onFilterSelected: (filter: any, filterIndex: number, optionIndex: number) => void;
|
|
6
|
+
onFilterClear: (filters: any[]) => void;
|
|
7
|
+
showReturnTripModal: boolean;
|
|
8
|
+
initialOpenFilters: string[];
|
|
9
|
+
filtersArray: any[];
|
|
10
|
+
translation?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
icons?: {
|
|
14
|
+
iconSunrise: string;
|
|
15
|
+
iconSunriseOrange: string;
|
|
16
|
+
iconMorning: string;
|
|
17
|
+
iconMorningOrange: string;
|
|
18
|
+
iconSunset: string;
|
|
19
|
+
iconSunsetOrange: string;
|
|
20
|
+
iconNight: string;
|
|
21
|
+
iconNightOrange: string;
|
|
22
|
+
downArrow: string;
|
|
23
|
+
removeFilterIcon: string;
|
|
24
|
+
};
|
|
25
|
+
isTrain?: boolean;
|
|
26
|
+
colors: {
|
|
27
|
+
selectedColor?: string;
|
|
28
|
+
selectedTextColor?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +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, t, }: ServiceItemProps
|
|
3
|
+
declare function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, t, }: ServiceItemProps & {
|
|
4
|
+
currencySign?: string;
|
|
5
|
+
}): React.ReactElement;
|
|
4
6
|
export default ServiceItemPB;
|
|
@@ -3,8 +3,9 @@ import LottiePlayer from "../../assets/LottiePlayer";
|
|
|
3
3
|
import DateService from "../../utils/DateService";
|
|
4
4
|
import ModalEventManager from "../../utils/ModalEventManager";
|
|
5
5
|
import InternationalServicePopupBody from "../InternationalServicePopupBody";
|
|
6
|
+
import CommonService from "../../utils/CommonService";
|
|
6
7
|
const SEAT_EXCEPTIONS = ["Asiento mascota"];
|
|
7
|
-
function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, t = (key) => key, }) {
|
|
8
|
+
function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, children, busStage, serviceDetailsLoading, cityOrigin, cityDestination, translation, orignLabel, destinationLabel, currencySign, t = (key) => key, }) {
|
|
8
9
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
10
|
const SvgAmenities = ({ moreAnemities, name, color, }) => {
|
|
10
11
|
const amenityKey = name.toLowerCase().replace(/\s/g, "_");
|
|
@@ -99,12 +100,6 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
99
100
|
return rawAmenity;
|
|
100
101
|
}
|
|
101
102
|
};
|
|
102
|
-
const currency = (amount) => {
|
|
103
|
-
const formattedAmount = amount
|
|
104
|
-
.toString()
|
|
105
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
106
|
-
return "$" + formattedAmount;
|
|
107
|
-
};
|
|
108
103
|
const labelId = typeof serviceItem.boarding_stages === "string"
|
|
109
104
|
? serviceItem.boarding_stages.split("|")[0]
|
|
110
105
|
: "";
|
|
@@ -199,9 +194,9 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
199
194
|
const getSeatPrice = () => {
|
|
200
195
|
const sortedSeatTypes = getSortedSeatTypes();
|
|
201
196
|
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]" }, typeof val.price === "string"
|
|
202
|
-
? currency(val.price)
|
|
197
|
+
? CommonService.currency(val.price, currencySign)
|
|
203
198
|
: typeof val.price === "number"
|
|
204
|
-
? currency(val.price)
|
|
199
|
+
? CommonService.currency(val.price, currencySign)
|
|
205
200
|
: null)));
|
|
206
201
|
};
|
|
207
202
|
const getFilteredSeats = (item) => {
|
|
@@ -335,7 +330,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
335
330
|
// }`}
|
|
336
331
|
style: { color: isSoldOut ? "#c0c0c0" : colors.priceColor } }, getSeatPrice()))),
|
|
337
332
|
React.createElement("div", null,
|
|
338
|
-
React.createElement("button", { onClick: () => (!isSoldOut ? checkMidnight() : null), disabled: serviceDetailsLoading, className: `w-full ${serviceDetailsLoading || isSoldOut ? "py-[
|
|
333
|
+
React.createElement("button", { onClick: () => (!isSoldOut ? checkMidnight() : null), disabled: serviceDetailsLoading, className: `w-full ${serviceDetailsLoading || isSoldOut ? "py-[12px]" : "py-[12px]"} text-[13.33px] font-bold text-white rounded-[10px] border-none px-[20px] flex items-center justify-center`, style: {
|
|
339
334
|
backgroundColor: serviceDetailsLoading || isSoldOut
|
|
340
335
|
? "lightgray"
|
|
341
336
|
: colors.kuposButtonColor,
|
|
@@ -421,15 +416,15 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
421
416
|
? serviceItem.operator_details[1].toFixed(1)
|
|
422
417
|
: serviceItem.operator_details[1])),
|
|
423
418
|
React.createElement("span", { className: "ml-[10px] text-[#464647] text-[13.33px]" }, serviceItem.operator_details[2])))),
|
|
424
|
-
React.createElement("div", { className: "flex items-baseline relative text-[#464647]" },
|
|
419
|
+
serviceItem.duration && (React.createElement("div", { className: "flex items-baseline relative text-[#464647]" },
|
|
425
420
|
React.createElement("div", { className: `w-[18px] h-auto mr-[4px] ${isSoldOut ? "grayscale" : ""}` }, renderIcon("hours", "14px")),
|
|
426
421
|
React.createElement("div", { className: `cursor-default group text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""}` },
|
|
427
422
|
serviceItem.duration,
|
|
428
423
|
" ",
|
|
429
424
|
translation.hours,
|
|
430
|
-
React.createElement("div", { className: "
|
|
425
|
+
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-normal z-10 mt-2.5 w-[188px] text-center break-normal shadow-service text-[12px]", style: { backgroundColor: colors.tooltipColor } },
|
|
431
426
|
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.tooltipColor } }),
|
|
432
|
-
"Duraci\u00F3n estimada del viaje"))),
|
|
427
|
+
"Duraci\u00F3n estimada del viaje")))),
|
|
433
428
|
serviceItem.pet_seat_info &&
|
|
434
429
|
Object.keys(serviceItem.pet_seat_info).length > 0 ? (React.createElement("div", { className: "flex items-center" },
|
|
435
430
|
React.createElement("div", { className: `relative group cursor-default ` },
|
|
@@ -448,7 +443,7 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
448
443
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.flexibleAnim, width: "20px", height: "20px" })),
|
|
449
444
|
React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647]" },
|
|
450
445
|
React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.flexible))),
|
|
451
|
-
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-normal z-10 mt-2.5 w-[230px] text-center break-normal shadow-service text-[
|
|
446
|
+
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-normal z-10 mt-2.5 w-[230px] text-center break-normal shadow-service text-[12px]", style: { backgroundColor: colors.tooltipColor } },
|
|
452
447
|
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.tooltipColor } }),
|
|
453
448
|
"Esta empresa permite cambios sin costo hasta (", (_c = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.change_ticket_hours) !== null && _c !== void 0 ? _c : 6,
|
|
454
449
|
") horas antes del viaje.")))),
|
|
@@ -498,21 +493,32 @@ function ServiceItemPB({ serviceItem, onBookButtonPress, colors, metaData, child
|
|
|
498
493
|
borderRightColor: colors.tooltipColor,
|
|
499
494
|
} }))))))))))))),
|
|
500
495
|
children,
|
|
501
|
-
(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: {
|
|
496
|
+
(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: {
|
|
497
|
+
backgroundColor: isSoldOut
|
|
498
|
+
? colors === null || colors === void 0 ? void 0 : colors.bottomStripColor
|
|
499
|
+
: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
|
|
500
|
+
opacity: isSoldOut ? 0.5 : 1,
|
|
501
|
+
} },
|
|
502
502
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.promoAnim, width: "18px", height: "18px" }),
|
|
503
503
|
React.createElement("span", { className: "ml-[10px]" }, serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text))),
|
|
504
504
|
React.createElement("div", { className: "absolute -top-[17px] left-0 w-full flex items-center justify-end gap-[12px] pr-[20px] z-10 " },
|
|
505
|
-
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] px-[
|
|
505
|
+
showTopLabel && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] px-[14px] rounded-[38px] text-[13.33px] z-20`, style: { backgroundColor: !isSoldOut && colors.ratingBottomColor } },
|
|
506
506
|
React.createElement("div", { className: isSoldOut ? "grayscale" : "" },
|
|
507
507
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.priorityStageAnim, width: "20px", height: "20px" })),
|
|
508
508
|
React.createElement("div", { className: isSoldOut ? "text-white" : `text-[${colors.topLabelColor}]` }, showTopLabel))),
|
|
509
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_transpordo) && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[
|
|
509
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_transpordo) && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20`, style: {
|
|
510
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
511
|
+
} },
|
|
510
512
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.connectingServiceIcon, width: "20px", height: "20px" }),
|
|
511
513
|
React.createElement("div", null, "Conexión"))),
|
|
512
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[
|
|
514
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20 `, style: {
|
|
515
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
516
|
+
} },
|
|
513
517
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.directoAnim, width: "20px", height: "20px" }),
|
|
514
518
|
React.createElement("div", null, translation === null || translation === void 0 ? void 0 : translation.directService))),
|
|
515
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[
|
|
519
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" && (React.createElement("div", { className: `flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20 `, style: {
|
|
520
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
521
|
+
} },
|
|
516
522
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.directoAnim, width: "20px", height: "20px" }),
|
|
517
523
|
React.createElement("div", null, "Tren Express"))))));
|
|
518
524
|
}
|
package/dist/styles.css
CHANGED
|
@@ -258,6 +258,9 @@
|
|
|
258
258
|
.w-\[120px\] {
|
|
259
259
|
width: 120px;
|
|
260
260
|
}
|
|
261
|
+
.w-\[188px\] {
|
|
262
|
+
width: 188px;
|
|
263
|
+
}
|
|
261
264
|
.w-\[230px\] {
|
|
262
265
|
width: 230px;
|
|
263
266
|
}
|
|
@@ -475,6 +478,9 @@
|
|
|
475
478
|
.px-\[10px\] {
|
|
476
479
|
padding-inline: 10px;
|
|
477
480
|
}
|
|
481
|
+
.px-\[14px\] {
|
|
482
|
+
padding-inline: 14px;
|
|
483
|
+
}
|
|
478
484
|
.px-\[20px\] {
|
|
479
485
|
padding-inline: 20px;
|
|
480
486
|
}
|
package/package.json
CHANGED
|
@@ -2,9 +2,9 @@ import React, { ReactNode } from "react";
|
|
|
2
2
|
|
|
3
3
|
interface PaymentItemProps {
|
|
4
4
|
label: ReactNode;
|
|
5
|
-
amount:
|
|
5
|
+
amount: string;
|
|
6
6
|
currency?: string;
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
className?: string;
|
|
9
9
|
isNegative?: boolean;
|
|
10
10
|
customStyle?: React.CSSProperties;
|
|
@@ -14,7 +14,7 @@ const PaymentItem: React.FC<PaymentItemProps> = ({
|
|
|
14
14
|
label,
|
|
15
15
|
amount,
|
|
16
16
|
currency = "CLP",
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
className = "",
|
|
19
19
|
isNegative = false,
|
|
20
20
|
customStyle = {},
|
|
@@ -35,7 +35,7 @@ const PaymentItem: React.FC<PaymentItemProps> = ({
|
|
|
35
35
|
}}
|
|
36
36
|
>
|
|
37
37
|
{currency} {isNegative ? "- " : ""}
|
|
38
|
-
{
|
|
38
|
+
{amount}
|
|
39
39
|
</div>
|
|
40
40
|
</div>
|
|
41
41
|
);
|
|
@@ -2,13 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { PaymentSideBarProps } from "./types";
|
|
3
3
|
import DateService from "../../utils/DateService";
|
|
4
4
|
import PaymentItem from "./PaymentItem";
|
|
5
|
-
|
|
6
|
-
const currency = (amount: number) => {
|
|
7
|
-
const formattedAmount = amount
|
|
8
|
-
.toString()
|
|
9
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
10
|
-
return "$" + formattedAmount;
|
|
11
|
-
};
|
|
5
|
+
import CommonService from "../../utils/CommonService";
|
|
12
6
|
|
|
13
7
|
const renderSummaryDetailsCard = ({
|
|
14
8
|
serviceName,
|
|
@@ -112,6 +106,7 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
112
106
|
serviceNameOnward,
|
|
113
107
|
serviceNameReturn,
|
|
114
108
|
metaData,
|
|
109
|
+
currencySign,
|
|
115
110
|
dateOnward,
|
|
116
111
|
dateReturn,
|
|
117
112
|
sourceOnward,
|
|
@@ -273,7 +268,11 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
273
268
|
:
|
|
274
269
|
</div>
|
|
275
270
|
<div className="bold-text">
|
|
276
|
-
CLP
|
|
271
|
+
CLP{" "}
|
|
272
|
+
{CommonService.currency(
|
|
273
|
+
val.fare * selectedOnward[1][key],
|
|
274
|
+
currencySign
|
|
275
|
+
)}
|
|
277
276
|
</div>
|
|
278
277
|
</div>
|
|
279
278
|
);
|
|
@@ -298,7 +297,11 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
298
297
|
:
|
|
299
298
|
</div>
|
|
300
299
|
<div className="bold-text">
|
|
301
|
-
CLP
|
|
300
|
+
CLP{" "}
|
|
301
|
+
{CommonService.currency(
|
|
302
|
+
val.fare * selectedReturn[1][key],
|
|
303
|
+
currencySign
|
|
304
|
+
)}
|
|
302
305
|
</div>
|
|
303
306
|
</div>
|
|
304
307
|
);
|
|
@@ -309,12 +312,12 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
309
312
|
{conexionChecked && conexionFare && returnConexionFare ? (
|
|
310
313
|
<PaymentItem
|
|
311
314
|
label="Conexión Aeropuerto:"
|
|
312
|
-
amount={
|
|
315
|
+
amount={CommonService.currency(
|
|
313
316
|
dateReturn
|
|
314
317
|
? returnConexionFare * conexionPassengers
|
|
315
|
-
: conexionFare
|
|
316
|
-
|
|
317
|
-
|
|
318
|
+
: conexionFare,
|
|
319
|
+
currencySign
|
|
320
|
+
)}
|
|
318
321
|
className="subtotal-row font10"
|
|
319
322
|
/>
|
|
320
323
|
) : null}
|
|
@@ -349,7 +352,6 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
349
352
|
</div>
|
|
350
353
|
}
|
|
351
354
|
amount={metaData.whatsapp_delivery_charges}
|
|
352
|
-
formatter={currency}
|
|
353
355
|
className="font10"
|
|
354
356
|
customStyle={{ color: "var(--secondary-color)" }}
|
|
355
357
|
/>
|
|
@@ -358,8 +360,7 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
358
360
|
{removeDiscountAtomValue && (
|
|
359
361
|
<PaymentItem
|
|
360
362
|
label="Cupón"
|
|
361
|
-
amount={netFare}
|
|
362
|
-
formatter={currency}
|
|
363
|
+
amount={CommonService.currency(netFare, currencySign)}
|
|
363
364
|
isNegative={true}
|
|
364
365
|
/>
|
|
365
366
|
)}
|
|
@@ -368,10 +369,10 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
368
369
|
|
|
369
370
|
<PaymentItem
|
|
370
371
|
label={`${translation?.promotionalCode}:`}
|
|
371
|
-
amount={
|
|
372
|
-
promoCode?.promoCouponAmount ? promoCode?.promoCouponAmount : 0
|
|
373
|
-
|
|
374
|
-
|
|
372
|
+
amount={CommonService.currency(
|
|
373
|
+
promoCode?.promoCouponAmount ? promoCode?.promoCouponAmount : 0,
|
|
374
|
+
currencySign
|
|
375
|
+
)}
|
|
375
376
|
className="text-[13.33px]"
|
|
376
377
|
/>
|
|
377
378
|
{promoCode?.promoCouponAmount ? (
|
|
@@ -390,16 +391,17 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
390
391
|
{isAgency && (
|
|
391
392
|
<PaymentItem
|
|
392
393
|
label={translation?.agencyFee}
|
|
393
|
-
amount={
|
|
394
|
-
|
|
394
|
+
amount={CommonService.currency(
|
|
395
|
+
agencyFee ? agencyFee : 0,
|
|
396
|
+
currencySign
|
|
397
|
+
)}
|
|
395
398
|
/>
|
|
396
399
|
)}
|
|
397
400
|
|
|
398
401
|
{walletMoney ? (
|
|
399
402
|
<PaymentItem
|
|
400
403
|
label="KuposPay"
|
|
401
|
-
amount={walletMoney}
|
|
402
|
-
formatter={currency}
|
|
404
|
+
amount={CommonService.currency(walletMoney, currencySign)}
|
|
403
405
|
/>
|
|
404
406
|
) : null}
|
|
405
407
|
|
|
@@ -408,8 +410,7 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
408
410
|
label={
|
|
409
411
|
<span className="secondary-text bold-text">{`kuposcréditos(${virtualLimit}%)`}</span>
|
|
410
412
|
}
|
|
411
|
-
amount={virtualMoney}
|
|
412
|
-
formatter={currency}
|
|
413
|
+
amount={CommonService.currency(virtualMoney, currencySign)}
|
|
413
414
|
customStyle={{ color: "var(--secondary-color)" }}
|
|
414
415
|
/>
|
|
415
416
|
) : null}
|
|
@@ -419,9 +420,11 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
419
420
|
label={
|
|
420
421
|
<span className="primary-text">{translation?.showUsd}</span>
|
|
421
422
|
}
|
|
422
|
-
amount={
|
|
423
|
+
amount={CommonService.currency(
|
|
424
|
+
isAgency ? netFareInUsd + agencyFee : netFareInUsd,
|
|
425
|
+
currencySign
|
|
426
|
+
)}
|
|
423
427
|
currency="USD"
|
|
424
|
-
formatter={(amount) => currency(amount).split(",")[0]}
|
|
425
428
|
customStyle={{ color: "var(--primary-color)" }}
|
|
426
429
|
/>
|
|
427
430
|
) : null}
|
|
@@ -441,12 +444,13 @@ const PaymentSideBarDesktop: React.FC<PaymentSideBarProps> = ({
|
|
|
441
444
|
}}
|
|
442
445
|
>
|
|
443
446
|
CLP{" "}
|
|
444
|
-
{currency(
|
|
447
|
+
{CommonService.currency(
|
|
445
448
|
removeDiscountAtomValue
|
|
446
449
|
? 0
|
|
447
450
|
: isAgency
|
|
448
451
|
? netFare + agencyFee
|
|
449
|
-
: netFare
|
|
452
|
+
: netFare,
|
|
453
|
+
currencySign
|
|
450
454
|
)}
|
|
451
455
|
</div>
|
|
452
456
|
</div>
|
|
@@ -4,6 +4,7 @@ import LottiePlayer from "../../assets/LottiePlayer";
|
|
|
4
4
|
import DateService from "../../utils/DateService";
|
|
5
5
|
import ModalEventManager from "../../utils/ModalEventManager";
|
|
6
6
|
import InternationalServicePopupBody from "../InternationalServicePopupBody";
|
|
7
|
+
import CommonService from "../../utils/CommonService";
|
|
7
8
|
|
|
8
9
|
const SEAT_EXCEPTIONS = ["Asiento mascota"];
|
|
9
10
|
|
|
@@ -20,8 +21,9 @@ function ServiceItemPB({
|
|
|
20
21
|
translation,
|
|
21
22
|
orignLabel,
|
|
22
23
|
destinationLabel,
|
|
24
|
+
currencySign,
|
|
23
25
|
t = (key: string) => key,
|
|
24
|
-
}: ServiceItemProps): React.ReactElement {
|
|
26
|
+
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
25
27
|
const SvgAmenities = ({
|
|
26
28
|
moreAnemities,
|
|
27
29
|
name,
|
|
@@ -139,13 +141,6 @@ function ServiceItemPB({
|
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
|
|
142
|
-
const currency = (amount: number) => {
|
|
143
|
-
const formattedAmount = amount
|
|
144
|
-
.toString()
|
|
145
|
-
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
146
|
-
return "$" + formattedAmount;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
144
|
const labelId =
|
|
150
145
|
typeof serviceItem.boarding_stages === "string"
|
|
151
146
|
? serviceItem.boarding_stages.split("|")[0]
|
|
@@ -300,9 +295,9 @@ function ServiceItemPB({
|
|
|
300
295
|
className="flex items-center justify-between text-[13.33px]"
|
|
301
296
|
>
|
|
302
297
|
{typeof val.price === "string"
|
|
303
|
-
? currency(val.price)
|
|
298
|
+
? CommonService.currency(val.price, currencySign)
|
|
304
299
|
: typeof val.price === "number"
|
|
305
|
-
? currency(val.price)
|
|
300
|
+
? CommonService.currency(val.price, currencySign)
|
|
306
301
|
: null}
|
|
307
302
|
</span>
|
|
308
303
|
)
|
|
@@ -593,7 +588,7 @@ function ServiceItemPB({
|
|
|
593
588
|
onClick={() => (!isSoldOut ? checkMidnight() : null)}
|
|
594
589
|
disabled={serviceDetailsLoading}
|
|
595
590
|
className={`w-full ${
|
|
596
|
-
serviceDetailsLoading || isSoldOut ? "py-[
|
|
591
|
+
serviceDetailsLoading || isSoldOut ? "py-[12px]" : "py-[12px]"
|
|
597
592
|
} text-[13.33px] font-bold text-white rounded-[10px] border-none px-[20px] flex items-center justify-center`}
|
|
598
593
|
style={{
|
|
599
594
|
backgroundColor:
|
|
@@ -784,34 +779,36 @@ function ServiceItemPB({
|
|
|
784
779
|
|
|
785
780
|
{/* <div className="flex justify-between items-center gap-[10px]"> */}
|
|
786
781
|
{/* Duration */}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
className={`w-[18px] h-auto mr-[4px] ${
|
|
791
|
-
isSoldOut ? "grayscale" : ""
|
|
792
|
-
}`}
|
|
793
|
-
>
|
|
794
|
-
{renderIcon("hours", "14px")}
|
|
795
|
-
</div>
|
|
796
|
-
<div
|
|
797
|
-
className={`cursor-default group text-[13.33px] ${
|
|
798
|
-
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
799
|
-
}`}
|
|
800
|
-
>
|
|
801
|
-
{serviceItem.duration} {translation.hours}
|
|
782
|
+
{serviceItem.duration && (
|
|
783
|
+
<div className="flex items-baseline relative text-[#464647]">
|
|
784
|
+
{/* {renderIcon("duration", "14px")} */}
|
|
802
785
|
<div
|
|
803
|
-
className=
|
|
804
|
-
|
|
786
|
+
className={`w-[18px] h-auto mr-[4px] ${
|
|
787
|
+
isSoldOut ? "grayscale" : ""
|
|
788
|
+
}`}
|
|
805
789
|
>
|
|
806
|
-
{
|
|
790
|
+
{renderIcon("hours", "14px")}
|
|
791
|
+
</div>
|
|
792
|
+
<div
|
|
793
|
+
className={`cursor-default group text-[13.33px] ${
|
|
794
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
795
|
+
}`}
|
|
796
|
+
>
|
|
797
|
+
{serviceItem.duration} {translation.hours}
|
|
807
798
|
<div
|
|
808
|
-
className="
|
|
809
|
-
style={{
|
|
810
|
-
|
|
811
|
-
|
|
799
|
+
className="hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-normal z-10 mt-2.5 w-[188px] text-center break-normal shadow-service text-[12px]"
|
|
800
|
+
style={{ backgroundColor: colors.tooltipColor }}
|
|
801
|
+
>
|
|
802
|
+
{/* Tooltip arrow */}
|
|
803
|
+
<div
|
|
804
|
+
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"
|
|
805
|
+
style={{ borderBottomColor: colors.tooltipColor }}
|
|
806
|
+
></div>
|
|
807
|
+
Duración estimada del viaje
|
|
808
|
+
</div>
|
|
812
809
|
</div>
|
|
813
810
|
</div>
|
|
814
|
-
|
|
811
|
+
)}
|
|
815
812
|
|
|
816
813
|
{serviceItem.pet_seat_info &&
|
|
817
814
|
Object.keys(serviceItem.pet_seat_info).length > 0 ? (
|
|
@@ -860,7 +857,7 @@ function ServiceItemPB({
|
|
|
860
857
|
</div>
|
|
861
858
|
</div>
|
|
862
859
|
<div
|
|
863
|
-
className="hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-normal z-10 mt-2.5 w-[230px] text-center break-normal shadow-service text-[
|
|
860
|
+
className="hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-normal z-10 mt-2.5 w-[230px] text-center break-normal shadow-service text-[12px]"
|
|
864
861
|
style={{ backgroundColor: colors.tooltipColor }}
|
|
865
862
|
>
|
|
866
863
|
{/* Tooltip arrow */}
|
|
@@ -1029,7 +1026,12 @@ function ServiceItemPB({
|
|
|
1029
1026
|
{serviceItem?.offer_text && (
|
|
1030
1027
|
<div
|
|
1031
1028
|
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]`}
|
|
1032
|
-
style={{
|
|
1029
|
+
style={{
|
|
1030
|
+
backgroundColor: isSoldOut
|
|
1031
|
+
? colors?.bottomStripColor
|
|
1032
|
+
: colors?.bottomStripColor,
|
|
1033
|
+
opacity: isSoldOut ? 0.5 : 1,
|
|
1034
|
+
}}
|
|
1033
1035
|
>
|
|
1034
1036
|
<LottiePlayer
|
|
1035
1037
|
animationData={serviceItem.icons.promoAnim}
|
|
@@ -1043,9 +1045,7 @@ function ServiceItemPB({
|
|
|
1043
1045
|
<div className="absolute -top-[17px] left-0 w-full flex items-center justify-end gap-[12px] pr-[20px] z-10 ">
|
|
1044
1046
|
{showTopLabel && (
|
|
1045
1047
|
<div
|
|
1046
|
-
className={`flex items-center gap-[10px] py-[8px] px-[
|
|
1047
|
-
isSoldOut ? "bg-[#ddd]" : ``
|
|
1048
|
-
}`}
|
|
1048
|
+
className={`flex items-center gap-[10px] py-[8px] px-[14px] rounded-[38px] text-[13.33px] z-20`}
|
|
1049
1049
|
style={{ backgroundColor: !isSoldOut && colors.ratingBottomColor }}
|
|
1050
1050
|
>
|
|
1051
1051
|
<div className={isSoldOut ? "grayscale" : ""}>
|
|
@@ -1066,9 +1066,10 @@ function ServiceItemPB({
|
|
|
1066
1066
|
)}
|
|
1067
1067
|
{serviceItem?.is_transpordo && (
|
|
1068
1068
|
<div
|
|
1069
|
-
className={`flex items-center gap-[10px] py-[8px] text-white px-[
|
|
1070
|
-
|
|
1071
|
-
|
|
1069
|
+
className={`flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20`}
|
|
1070
|
+
style={{
|
|
1071
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
1072
|
+
}}
|
|
1072
1073
|
>
|
|
1073
1074
|
<LottiePlayer
|
|
1074
1075
|
animationData={serviceItem.icons.connectingServiceIcon}
|
|
@@ -1080,9 +1081,10 @@ function ServiceItemPB({
|
|
|
1080
1081
|
)}
|
|
1081
1082
|
{serviceItem?.is_direct_trip && (
|
|
1082
1083
|
<div
|
|
1083
|
-
className={`flex items-center gap-[10px] py-[8px] text-white px-[
|
|
1084
|
-
|
|
1085
|
-
|
|
1084
|
+
className={`flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20 `}
|
|
1085
|
+
style={{
|
|
1086
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
1087
|
+
}}
|
|
1086
1088
|
>
|
|
1087
1089
|
<LottiePlayer
|
|
1088
1090
|
animationData={serviceItem.icons.directoAnim}
|
|
@@ -1094,9 +1096,10 @@ function ServiceItemPB({
|
|
|
1094
1096
|
)}
|
|
1095
1097
|
{serviceItem?.train_type_label === "Tren Express (Nuevo)" && (
|
|
1096
1098
|
<div
|
|
1097
|
-
className={`flex items-center gap-[10px] py-[8px] text-white px-[
|
|
1098
|
-
|
|
1099
|
-
|
|
1099
|
+
className={`flex items-center gap-[10px] py-[8px] text-white px-[14px] rounded-[38px] text-[13.33px] z-20 `}
|
|
1100
|
+
style={{
|
|
1101
|
+
backgroundColor: isSoldOut ? "#ddd" : colors.tooltipColor,
|
|
1102
|
+
}}
|
|
1100
1103
|
>
|
|
1101
1104
|
<LottiePlayer
|
|
1102
1105
|
animationData={serviceItem.icons.directoAnim}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const commonService = {
|
|
2
|
+
currency(amount: number, currencySign?: string) {
|
|
3
|
+
const formattedAmount = amount
|
|
4
|
+
.toString()
|
|
5
|
+
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
6
|
+
|
|
7
|
+
const sign = currencySign || "$";
|
|
8
|
+
return sign + formattedAmount;
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default commonService;
|