kupos-ui-components-lib 1.0.1 → 1.0.2
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/KuposUIComponent.js +2 -19
- package/dist/components/PaymentSideBar/PaymentItem.d.ts +13 -0
- package/dist/components/PaymentSideBar/PaymentItem.js +24 -0
- package/dist/components/PaymentSideBar/PaymentSideBarDesktop.js +175 -103
- package/dist/components/PaymentSideBar/PaymentSideBarMobile.js +7 -102
- package/dist/components/PaymentSideBar/types.d.ts +68 -32
- package/dist/components/ServiceItem/ServiceItemDesktop.js +45 -15
- package/dist/components/ServiceItem/mobileTypes.d.ts +2 -14
- package/dist/components/ServiceItem/types.d.ts +4 -14
- package/dist/styles.css +35 -1
- package/kupos-ui-components-lib-1.0.1.tgz +0 -0
- package/package.json +3 -2
- package/src/KuposUIComponent.tsx +4 -24
- package/src/components/PaymentSideBar/PaymentItem.tsx +62 -0
- package/src/components/PaymentSideBar/PaymentSideBarDesktop.tsx +439 -159
- package/src/components/PaymentSideBar/PaymentSideBarMobile.tsx +9 -171
- package/src/components/PaymentSideBar/types.ts +69 -40
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +76 -16
- package/src/components/ServiceItem/mobileTypes.ts +2 -19
- package/src/components/ServiceItem/types.ts +4 -19
- package/dist/ResponsiveServiceItem.d.ts +0 -3
- package/dist/ResponsiveServiceItem.js +0 -10
- package/dist/ServiceItemDesktop.d.ts +0 -3
- package/dist/ServiceItemDesktop.js +0 -6
- package/dist/ServiceItemMobile.d.ts +0 -3
- package/dist/ServiceItemMobile.js +0 -5
- package/dist/ServiceItemMobileView.d.ts +0 -4
- package/dist/ServiceItemMobileView.js +0 -33
- package/dist/ServivceItemPbMobile.d.ts +0 -4
- package/dist/ServivceItemPbMobile.js +0 -248
- package/dist/mobileTypes.d.ts +0 -141
- package/dist/mobileTypes.js +0 -1
- package/kupos-service-item-package-1.0.0.tgz +0 -0
package/dist/KuposUIComponent.js
CHANGED
|
@@ -15,29 +15,12 @@ import { ResponsivePaymentSideBar } from "./components/PaymentSideBar";
|
|
|
15
15
|
import { ResponsiveServiceList } from "./components/ServiceList";
|
|
16
16
|
// Using imported ResponsivePaymentSideBar component instead
|
|
17
17
|
export default function KuposUIComponent(props) {
|
|
18
|
-
var _a, _b, _c, _d;
|
|
19
18
|
const { typeOfComponent } = props, restProps = __rest(props, ["typeOfComponent"]);
|
|
20
19
|
switch (typeOfComponent.toLowerCase()) {
|
|
21
20
|
case "serviceitem":
|
|
22
21
|
return (React.createElement(ResponsiveServiceItem, Object.assign({}, restProps)));
|
|
23
|
-
case "paymentsidebar":
|
|
24
|
-
|
|
25
|
-
// Create a properly formatted PaymentSideBarProps object
|
|
26
|
-
const paymentProps = Object.assign(Object.assign({}, otherProps), (orderDetails && {
|
|
27
|
-
orderDetails: {
|
|
28
|
-
items: orderDetails.map((item) => ({
|
|
29
|
-
name: item.name,
|
|
30
|
-
quantity: item.quantity,
|
|
31
|
-
price: item.price,
|
|
32
|
-
})),
|
|
33
|
-
subtotal: ((_a = restProps.orderSummary) === null || _a === void 0 ? void 0 : _a.subtotal) || 0,
|
|
34
|
-
tax: ((_b = restProps.orderSummary) === null || _b === void 0 ? void 0 : _b.taxes) || 0,
|
|
35
|
-
discount: ((_c = restProps.orderSummary) === null || _c === void 0 ? void 0 : _c.discount) || 0,
|
|
36
|
-
total: ((_d = restProps.orderSummary) === null || _d === void 0 ? void 0 : _d.total) || 0,
|
|
37
|
-
},
|
|
38
|
-
}));
|
|
39
|
-
return React.createElement(ResponsivePaymentSideBar, Object.assign({}, paymentProps));
|
|
40
|
-
}
|
|
22
|
+
case "paymentsidebar":
|
|
23
|
+
return (React.createElement(ResponsivePaymentSideBar, Object.assign({}, restProps)));
|
|
41
24
|
case "servicelist":
|
|
42
25
|
return (React.createElement(ResponsiveServiceList, Object.assign({}, restProps)));
|
|
43
26
|
default:
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface PaymentItemProps {
|
|
3
|
+
label: string | ReactNode;
|
|
4
|
+
amount: number | string;
|
|
5
|
+
currency?: string;
|
|
6
|
+
isBold?: boolean;
|
|
7
|
+
isNegative?: boolean;
|
|
8
|
+
customStyle?: React.CSSProperties;
|
|
9
|
+
className?: string;
|
|
10
|
+
formatter?: (amount: number) => string;
|
|
11
|
+
}
|
|
12
|
+
declare const PaymentItem: React.FC<PaymentItemProps>;
|
|
13
|
+
export default PaymentItem;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const PaymentItem = ({ label, amount, currency = "CLP", isBold = false, isNegative = false, customStyle = {}, className = "", formatter, }) => {
|
|
3
|
+
const formatAmount = (amount) => {
|
|
4
|
+
if (formatter && typeof amount === "number") {
|
|
5
|
+
return formatter(amount);
|
|
6
|
+
}
|
|
7
|
+
if (typeof amount === "string") {
|
|
8
|
+
return amount;
|
|
9
|
+
}
|
|
10
|
+
// Default formatting
|
|
11
|
+
const formattedAmount = amount
|
|
12
|
+
.toString()
|
|
13
|
+
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
14
|
+
return formattedAmount;
|
|
15
|
+
};
|
|
16
|
+
return (React.createElement("div", { className: `flex items-center justify-between w-[100%] mt-[5px] text-[13.33px] ${className}` },
|
|
17
|
+
React.createElement("span", { className: isBold ? "bold-text" : "" }, label),
|
|
18
|
+
React.createElement("div", { className: `${isBold ? "bold-text" : ""} secondary-text`, style: Object.assign({ minWidth: 80, display: "flex", justifyContent: "flex-end", alignItems: "center" }, customStyle) },
|
|
19
|
+
currency,
|
|
20
|
+
" ",
|
|
21
|
+
isNegative ? "- " : "",
|
|
22
|
+
formatAmount(amount))));
|
|
23
|
+
};
|
|
24
|
+
export default PaymentItem;
|
|
@@ -1,107 +1,179 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
React.createElement("div", {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
marginBottom: "5px",
|
|
45
|
-
} },
|
|
46
|
-
React.createElement("span", null, "Subtotal"),
|
|
47
|
-
React.createElement("span", null,
|
|
48
|
-
currency,
|
|
49
|
-
orderDetails.subtotal.toFixed(2))),
|
|
50
|
-
orderDetails.tax !== undefined && (React.createElement("div", { style: {
|
|
51
|
-
display: "flex",
|
|
52
|
-
justifyContent: "space-between",
|
|
53
|
-
marginBottom: "5px",
|
|
54
|
-
} },
|
|
55
|
-
React.createElement("span", null, "Tax"),
|
|
56
|
-
React.createElement("span", null,
|
|
57
|
-
currency,
|
|
58
|
-
orderDetails.tax.toFixed(2)))),
|
|
59
|
-
orderDetails.discount !== undefined && (React.createElement("div", { style: {
|
|
60
|
-
display: "flex",
|
|
61
|
-
justifyContent: "space-between",
|
|
62
|
-
marginBottom: "5px",
|
|
63
|
-
} },
|
|
64
|
-
React.createElement("span", null, "Discount"),
|
|
65
|
-
React.createElement("span", null,
|
|
66
|
-
"-",
|
|
67
|
-
currency,
|
|
68
|
-
orderDetails.discount.toFixed(2)))),
|
|
69
|
-
React.createElement("div", { style: {
|
|
70
|
-
display: "flex",
|
|
71
|
-
justifyContent: "space-between",
|
|
72
|
-
fontWeight: "bold",
|
|
73
|
-
marginTop: "10px",
|
|
74
|
-
} },
|
|
75
|
-
React.createElement("span", null, "Total"),
|
|
2
|
+
import DateService from "../../utils/DateService";
|
|
3
|
+
import PaymentItem from "./PaymentItem";
|
|
4
|
+
const currency = (amount) => {
|
|
5
|
+
const formattedAmount = amount
|
|
6
|
+
.toString()
|
|
7
|
+
.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
8
|
+
return "$" + formattedAmount;
|
|
9
|
+
};
|
|
10
|
+
const renderSummaryDetailsCard = ({ serviceName, date, source, dest, boardingStage, boardingTime, droppingStage, droppingTime, duration, trainType, isTrain, icons, }) => {
|
|
11
|
+
return (React.createElement(React.Fragment, null,
|
|
12
|
+
React.createElement("div", { className: "mt-3 border-b border-[#ccc] pb-3 text-[13.33px]" },
|
|
13
|
+
React.createElement("div", { className: "summary-details-card" },
|
|
14
|
+
React.createElement("div", { className: "" }, serviceName),
|
|
15
|
+
isTrain && (React.createElement("div", { className: "", style: { marginTop: 8 } }, trainType)),
|
|
16
|
+
date && (React.createElement("div", { className: " mt-2 capitalize bold-text" }, DateService.getDayNameFromDate(date) +
|
|
17
|
+
", " +
|
|
18
|
+
DateService.getDateFromDate(date) +
|
|
19
|
+
" " +
|
|
20
|
+
DateService.getMonthNameFromDate(date) +
|
|
21
|
+
", " +
|
|
22
|
+
DateService.getYearFromDate(date))),
|
|
23
|
+
React.createElement("div", { className: "mt-3" },
|
|
24
|
+
React.createElement("div", { className: "flex items-center" },
|
|
25
|
+
React.createElement("div", { className: "w-5 h-5 rounded-full flex items-center justify-center mr-2" },
|
|
26
|
+
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.origin, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
27
|
+
React.createElement("span", { className: "bold-text capitalize" }, source)),
|
|
28
|
+
React.createElement("div", { className: "ml-7 text-xs mt-[5px]" },
|
|
29
|
+
boardingStage,
|
|
30
|
+
". ",
|
|
31
|
+
boardingTime ? (React.createElement("span", null, DateService.formatTime(boardingTime))) : null)),
|
|
32
|
+
React.createElement("div", { className: "mt-3" },
|
|
33
|
+
React.createElement("div", { className: "flex items-center" },
|
|
34
|
+
React.createElement("div", { className: "w-5 h-5 rounded-full flex items-center justify-center mr-2" },
|
|
35
|
+
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.destination, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
36
|
+
React.createElement("span", { className: "bold-text capitalize" }, dest)),
|
|
37
|
+
React.createElement("div", { className: "ml-7 text-xs mt-[5px]" },
|
|
38
|
+
droppingStage,
|
|
39
|
+
". ",
|
|
40
|
+
droppingTime ? (React.createElement("span", null, DateService.formatTime(droppingTime))) : null)),
|
|
41
|
+
duration && (React.createElement("div", { className: "mt-3 flex items-center text-xs text-gray-500" },
|
|
42
|
+
React.createElement("div", { className: " flex items-center justify-center mr-2" },
|
|
43
|
+
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.hours, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
76
44
|
React.createElement("span", null,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
45
|
+
"Duraci\u00F3n : ",
|
|
46
|
+
duration,
|
|
47
|
+
" horas")))))));
|
|
48
|
+
};
|
|
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, }) => {
|
|
50
|
+
return (React.createElement("div", null,
|
|
51
|
+
React.createElement("div", { className: "bg-white rounded-[20px] shadow-service mb-[10px] mx-auto sticky w-[322px] relative" },
|
|
52
|
+
React.createElement("div", { className: "p-[15px]" },
|
|
53
|
+
React.createElement("div", { className: "text-[17.33px]" }, translation === null || translation === void 0 ? void 0 :
|
|
54
|
+
translation.passengerSummaryDetails,
|
|
55
|
+
" ",
|
|
56
|
+
React.createElement("span", { className: "bold-text" }, translation === null || translation === void 0 ? void 0 : translation.passengerSummaryDetailsBold)),
|
|
57
|
+
React.createElement("div", null,
|
|
58
|
+
React.createElement("div", { className: "mt-2 flex" },
|
|
59
|
+
React.createElement("div", { className: `flex rounded-[10px] overflow-hidden text-xs bg-[lightgray] ${dateReturn ? "max-w-[165px]" : "w-auto"}` },
|
|
60
|
+
React.createElement("span", { onClick: () => setJourneyTypeActive && setJourneyTypeActive(1), className: "px-4 py-[6px] cursor-pointer text-sm font-medium transition-colors text-[13.33px]", style: {
|
|
61
|
+
backgroundColor: journeyTypeActive === 1
|
|
62
|
+
? (colors === null || colors === void 0 ? void 0 : colors.bottomStripColor) || "red"
|
|
63
|
+
: "transparent",
|
|
64
|
+
color: journeyTypeActive === 1 ? "white" : "#464647",
|
|
65
|
+
borderTopRightRadius: journeyTypeActive === 1 ? "10px" : "0",
|
|
66
|
+
borderBottomRightRadius: journeyTypeActive === 1 ? "10px" : "0",
|
|
67
|
+
} }, (translation === null || translation === void 0 ? void 0 : translation.going) || "Ida"),
|
|
68
|
+
dateReturn && (React.createElement("span", { onClick: () => setJourneyTypeActive && setJourneyTypeActive(2), className: "px-4 py-[6px] cursor-pointer text-sm font-medium transition-colors text-[13.33px]", style: {
|
|
69
|
+
backgroundColor: journeyTypeActive === 2
|
|
70
|
+
? (colors === null || colors === void 0 ? void 0 : colors.bottomStripColor) || "red"
|
|
71
|
+
: "transparent",
|
|
72
|
+
color: journeyTypeActive === 2 ? "white" : "#464647",
|
|
73
|
+
borderTopLeftRadius: journeyTypeActive === 2 ? "10px" : "0",
|
|
74
|
+
borderBottomLeftRadius: journeyTypeActive === 2 ? "10px" : "0",
|
|
75
|
+
} }, (translation === null || translation === void 0 ? void 0 : translation.return) || "Vuelta")))),
|
|
76
|
+
journeyTypeActive == 1
|
|
77
|
+
? renderSummaryDetailsCard({
|
|
78
|
+
serviceName: serviceNameOnward,
|
|
79
|
+
date: dateOnward,
|
|
80
|
+
source: sourceOnward,
|
|
81
|
+
dest: destinationOnward,
|
|
82
|
+
boardingStage: boardingStageOnward,
|
|
83
|
+
boardingTime: boardingTimeOnward,
|
|
84
|
+
droppingStage: droppingStageOnward,
|
|
85
|
+
droppingTime: droppingTimeOnward,
|
|
86
|
+
duration: durationOnward,
|
|
87
|
+
trainType: trainTypeOnward,
|
|
88
|
+
isTrain: trainType,
|
|
89
|
+
icons: icons,
|
|
90
|
+
})
|
|
91
|
+
: renderSummaryDetailsCard({
|
|
92
|
+
serviceName: serviceNameReturn,
|
|
93
|
+
date: dateReturn,
|
|
94
|
+
source: sourceReturn,
|
|
95
|
+
dest: destinationReturn,
|
|
96
|
+
boardingStage: boardingStageReturn,
|
|
97
|
+
boardingTime: boardingTimeReturn,
|
|
98
|
+
droppingStage: droppingStageReturn,
|
|
99
|
+
droppingTime: droppingTimeReturn,
|
|
100
|
+
duration: durationReturn,
|
|
101
|
+
trainType: trainTypeReturn,
|
|
102
|
+
isTrain: trainType,
|
|
103
|
+
icons: icons,
|
|
104
|
+
})),
|
|
105
|
+
React.createElement("div", { className: "mt-3 text-[13.33px]" },
|
|
106
|
+
selectSeatOnward && selectedOnward && selectedOnward[0]
|
|
107
|
+
? selectedOnward[0].map((val, key) => {
|
|
108
|
+
return (React.createElement("div", { key: key, className: "flex justify-between items-center w-[100%]" },
|
|
109
|
+
React.createElement("div", null,
|
|
110
|
+
React.createElement("span", null,
|
|
111
|
+
selectedOnward[1][key],
|
|
112
|
+
" "),
|
|
113
|
+
" x ",
|
|
114
|
+
val.is_pet_seat ? "Asiento Mascota" : val.type
|
|
115
|
+
// CommonService.capitalize(
|
|
116
|
+
// CommonService.getSeatName(val.type),
|
|
117
|
+
// )
|
|
118
|
+
,
|
|
119
|
+
":"),
|
|
120
|
+
React.createElement("div", { className: "bold-text" },
|
|
121
|
+
"CLP ",
|
|
122
|
+
currency(val.fare * selectedOnward[1][key]))));
|
|
123
|
+
})
|
|
124
|
+
: null,
|
|
125
|
+
selectSeatReturn && selectedReturn && selectedReturn[0]
|
|
126
|
+
? selectedReturn[0].map((val, key) => {
|
|
127
|
+
return (React.createElement("div", { key: key, className: "flex justify-between items-center w-[100%] mt-[5px]" },
|
|
128
|
+
React.createElement("div", null,
|
|
129
|
+
React.createElement("span", null,
|
|
130
|
+
selectedReturn[1][key],
|
|
131
|
+
" "),
|
|
132
|
+
" x ",
|
|
133
|
+
val.is_pet_seat ? "Asiento Mascota" : val.type
|
|
134
|
+
// CommonService.capitalize(
|
|
135
|
+
// CommonService.getSeatName(val.type)
|
|
136
|
+
// )
|
|
137
|
+
,
|
|
138
|
+
":"),
|
|
139
|
+
React.createElement("div", { className: "bold-text" },
|
|
140
|
+
"CLP ",
|
|
141
|
+
currency(val.fare * selectedReturn[1][key]))));
|
|
142
|
+
})
|
|
143
|
+
: null),
|
|
144
|
+
conexionChecked && conexionFare && returnConexionFare ? (React.createElement(PaymentItem, { label: "Conexi\u00F3n Aeropuerto:", amount: dateReturn
|
|
145
|
+
? returnConexionFare * conexionPassengers
|
|
146
|
+
: conexionFare * conexionPassengers, formatter: currency, isBold: true, className: "subtotal-row font10" })) : null,
|
|
147
|
+
metaData &&
|
|
148
|
+
metaData.whatsapp_delivery_charges &&
|
|
149
|
+
!loginData &&
|
|
150
|
+
!checkWhatsappEligibility ? (React.createElement(PaymentItem, { label: React.createElement("div", { style: { display: "flex", alignItems: "center" } },
|
|
151
|
+
React.createElement("div", { className: "font10" }, translation === null || translation === void 0 ? void 0 : translation.whatsappDeliveryCharges),
|
|
152
|
+
React.createElement("div", { className: "relative group pointer" },
|
|
153
|
+
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.whatsappInfoIcon, alt: "", style: {
|
|
154
|
+
marginLeft: "5px",
|
|
155
|
+
marginBottom: "3px",
|
|
156
|
+
width: "15px",
|
|
157
|
+
} }),
|
|
158
|
+
React.createElement("div", { className: " hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-1 rounded-[14px] whitespace-normal z-10 mt-2.5 w-[230px] text-center break-normal shadow-service", style: { backgroundColor: colors.tooltipColor } },
|
|
159
|
+
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 } }),
|
|
160
|
+
React.createElement("span", { className: "text-[13.33px]" }, translation === null || translation === void 0 ? void 0 : translation.whatsappInfoIcon)))), amount: metaData.whatsapp_delivery_charges, formatter: currency, isBold: true, className: "mt-[10px] font10" })) : null,
|
|
161
|
+
removeDiscountAtomValue && (React.createElement(PaymentItem, { label: "Cup\u00F3n", amount: netFare, formatter: currency, isBold: true, isNegative: true })),
|
|
162
|
+
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, formatter: (amount) => currency(amount).split(",")[0], isBold: true }),
|
|
164
|
+
(promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCouponAmount) ? (React.createElement("div", { className: "promocode font10" },
|
|
165
|
+
React.createElement("div", null, promoCode === null || promoCode === void 0 ? void 0 : promoCode.promoCode),
|
|
166
|
+
React.createElement("span", { className: "promo-remove", onClick: onPromoRemove },
|
|
167
|
+
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, formatter: currency, isBold: true })),
|
|
169
|
+
walletMoney ? (React.createElement(PaymentItem, { label: "KuposPay", amount: walletMoney, formatter: currency, isBold: true })) : null,
|
|
170
|
+
virtualMoney ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "secondary-text bold-text" }, `kuposcréditos(${virtualLimit}%)`), amount: virtualMoney, formatter: currency, isBold: true })) : null,
|
|
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", formatter: (amount) => currency(amount).split(",")[0], isBold: true, customStyle: { color: "var(--primary-color)" } })) : null)),
|
|
172
|
+
React.createElement("div", { className: ` text-white p-[10px_15px] text-left w-full flex items-center absolute bottom-[52%] pt-[50px] -z-10 rounded-b-[14px] text-[14px]`, style: { backgroundColor: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor } },
|
|
173
|
+
React.createElement(PaymentItem, { label: "Total", amount: removeDiscountAtomValue
|
|
174
|
+
? 0
|
|
175
|
+
: isAgency
|
|
176
|
+
? netFare + agencyFee
|
|
177
|
+
: netFare, formatter: currency, isBold: true, className: "total-row font10", customStyle: { color: "white" } }))));
|
|
106
178
|
};
|
|
107
179
|
export default PaymentSideBarDesktop;
|
|
@@ -1,115 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
const PaymentSideBarMobile = (props) => {
|
|
3
|
-
|
|
4
|
-
const handlePayment = () => {
|
|
5
|
-
try {
|
|
6
|
-
// Payment processing logic would go here
|
|
7
|
-
onPaymentComplete && onPaymentComplete("payment-123");
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
onPaymentError && onPaymentError(error);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
return (React.createElement("div", { className: "payment-sidebar-mobile", style: {
|
|
14
|
-
backgroundColor: colors.backgroundColor || "#ffffff",
|
|
15
|
-
color: colors.textColor || "#333333",
|
|
16
|
-
padding: "15px",
|
|
17
|
-
borderRadius: "8px",
|
|
18
|
-
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.1)",
|
|
19
|
-
width: "100%",
|
|
20
|
-
maxWidth: "100%",
|
|
21
|
-
} },
|
|
3
|
+
return (React.createElement("div", { className: "payment-sidebar-mobile" },
|
|
22
4
|
React.createElement("h2", { style: {
|
|
23
5
|
marginBottom: "15px",
|
|
24
|
-
color:
|
|
25
|
-
fontSize: "18px"
|
|
6
|
+
color: "#333",
|
|
7
|
+
fontSize: "18px",
|
|
26
8
|
} }, "Payment Details"),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
display: "flex",
|
|
31
|
-
justifyContent: "space-between",
|
|
32
|
-
marginBottom: "6px",
|
|
33
|
-
fontSize: "14px"
|
|
34
|
-
} },
|
|
35
|
-
React.createElement("span", null,
|
|
36
|
-
item.name,
|
|
37
|
-
" x ",
|
|
38
|
-
item.quantity),
|
|
39
|
-
React.createElement("span", null,
|
|
40
|
-
currency,
|
|
41
|
-
item.price.toFixed(2)))))),
|
|
42
|
-
React.createElement("div", { style: {
|
|
43
|
-
borderTop: "1px solid #eee",
|
|
44
|
-
paddingTop: "8px",
|
|
45
|
-
marginTop: "8px",
|
|
46
|
-
fontSize: "14px"
|
|
47
|
-
} },
|
|
48
|
-
React.createElement("div", { style: {
|
|
49
|
-
display: "flex",
|
|
50
|
-
justifyContent: "space-between",
|
|
51
|
-
marginBottom: "4px",
|
|
52
|
-
} },
|
|
53
|
-
React.createElement("span", null, "Subtotal"),
|
|
54
|
-
React.createElement("span", null,
|
|
55
|
-
currency,
|
|
56
|
-
orderDetails.subtotal.toFixed(2))),
|
|
57
|
-
orderDetails.tax !== undefined && (React.createElement("div", { style: {
|
|
58
|
-
display: "flex",
|
|
59
|
-
justifyContent: "space-between",
|
|
60
|
-
marginBottom: "4px",
|
|
61
|
-
} },
|
|
62
|
-
React.createElement("span", null, "Tax"),
|
|
63
|
-
React.createElement("span", null,
|
|
64
|
-
currency,
|
|
65
|
-
orderDetails.tax.toFixed(2)))),
|
|
66
|
-
orderDetails.discount !== undefined && (React.createElement("div", { style: {
|
|
67
|
-
display: "flex",
|
|
68
|
-
justifyContent: "space-between",
|
|
69
|
-
marginBottom: "4px",
|
|
70
|
-
} },
|
|
71
|
-
React.createElement("span", null, "Discount"),
|
|
72
|
-
React.createElement("span", null,
|
|
73
|
-
"-",
|
|
74
|
-
currency,
|
|
75
|
-
orderDetails.discount.toFixed(2)))),
|
|
76
|
-
React.createElement("div", { style: {
|
|
77
|
-
display: "flex",
|
|
78
|
-
justifyContent: "space-between",
|
|
79
|
-
fontWeight: "bold",
|
|
80
|
-
marginTop: "8px",
|
|
81
|
-
fontSize: "16px"
|
|
82
|
-
} },
|
|
83
|
-
React.createElement("span", null, "Total"),
|
|
84
|
-
React.createElement("span", null,
|
|
85
|
-
currency,
|
|
86
|
-
orderDetails.total.toFixed(2)))))),
|
|
87
|
-
React.createElement("div", { className: "payment-methods", style: { marginBottom: "15px" } },
|
|
88
|
-
React.createElement("h3", { style: { marginBottom: "8px", fontSize: "16px" } }, "Payment Methods"),
|
|
89
|
-
React.createElement("div", { style: { maxHeight: "150px", overflowY: "auto" } }, paymentMethods.length > 0 ? (paymentMethods.map((method) => (React.createElement("div", { key: method.id, style: {
|
|
90
|
-
display: "flex",
|
|
91
|
-
alignItems: "center",
|
|
92
|
-
padding: "8px",
|
|
93
|
-
marginBottom: "6px",
|
|
94
|
-
border: `1px solid ${method.isSelected ? colors.primaryColor || "#007bff" : "#ddd"}`,
|
|
95
|
-
borderRadius: "4px",
|
|
96
|
-
cursor: "pointer",
|
|
97
|
-
backgroundColor: method.isSelected ? "#f8f9fa" : "transparent",
|
|
98
|
-
} },
|
|
99
|
-
method.icon && (React.createElement("img", { src: method.icon, alt: method.name, style: { width: "20px", height: "20px", marginRight: "8px" } })),
|
|
100
|
-
React.createElement("span", { style: { fontSize: "14px" } }, method.name))))) : (React.createElement("p", { style: { fontSize: "14px" } }, "No payment methods available")))),
|
|
101
|
-
React.createElement("button", { onClick: handlePayment, style: {
|
|
102
|
-
backgroundColor: colors.buttonColor || "#007bff",
|
|
103
|
-
color: colors.buttonTextColor || "#ffffff",
|
|
9
|
+
React.createElement("button", { style: {
|
|
10
|
+
backgroundColor: "#007bff",
|
|
11
|
+
color: "#ffffff",
|
|
104
12
|
padding: "10px 16px",
|
|
105
13
|
border: "none",
|
|
106
14
|
borderRadius: "4px",
|
|
107
15
|
fontSize: "16px",
|
|
108
16
|
cursor: "pointer",
|
|
109
17
|
width: "100%",
|
|
110
|
-
} },
|
|
111
|
-
"Pay ",
|
|
112
|
-
currency,
|
|
113
|
-
amount.toFixed(2))));
|
|
18
|
+
} }, "Pay $2000")));
|
|
114
19
|
};
|
|
115
20
|
export default PaymentSideBarMobile;
|
|
@@ -1,38 +1,74 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export interface PaymentSideBarProps {
|
|
2
3
|
variant?: "mobile" | "desktop";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
serviceNameOnward: string;
|
|
5
|
+
serviceNameReturn: string;
|
|
6
|
+
metaData?: any;
|
|
7
|
+
dateOnward?: string;
|
|
8
|
+
dateReturn?: string;
|
|
9
|
+
sourceOnward?: string;
|
|
10
|
+
sourceReturn?: string;
|
|
11
|
+
destinationOnward?: string;
|
|
12
|
+
destinationReturn?: string;
|
|
13
|
+
boardingStageOnward?: string;
|
|
14
|
+
boardingStageReturn?: string;
|
|
15
|
+
droppingStageOnward?: string;
|
|
16
|
+
droppingStageReturn?: string;
|
|
17
|
+
boardingTimeOnward?: string;
|
|
18
|
+
boardingTimeReturn?: string;
|
|
19
|
+
droppingTimeOnward?: string;
|
|
20
|
+
droppingTimeReturn?: string;
|
|
21
|
+
durationOnward?: string;
|
|
22
|
+
durationReturn?: string;
|
|
23
|
+
selectSeatOnward: any;
|
|
24
|
+
selectSeatReturn: any;
|
|
25
|
+
journeyTypeActive?: number;
|
|
26
|
+
trainTypeOnward?: boolean;
|
|
27
|
+
trainTypeReturn?: boolean;
|
|
28
|
+
setJourneyTypeActive?: (value: number) => void;
|
|
29
|
+
translation?: {
|
|
30
|
+
[key: string]: string;
|
|
15
31
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
colors: {
|
|
33
|
+
kuposButtonColor?: string;
|
|
34
|
+
topLabelColor?: string;
|
|
35
|
+
tooltipColor?: string;
|
|
36
|
+
ratingBorderColor?: string;
|
|
37
|
+
ratingBottomColor?: string;
|
|
38
|
+
priceColor?: string;
|
|
39
|
+
secondaryBgColor?: string;
|
|
40
|
+
secondaryTextColor?: string;
|
|
41
|
+
primaryButtonTextColor?: string;
|
|
42
|
+
bottomStripColor?: string;
|
|
25
43
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
subtotal: number;
|
|
34
|
-
tax?: number;
|
|
35
|
-
discount?: number;
|
|
36
|
-
total: number;
|
|
44
|
+
trainType?: boolean;
|
|
45
|
+
icons?: {
|
|
46
|
+
origin?: string;
|
|
47
|
+
destination?: string;
|
|
48
|
+
hours?: string;
|
|
49
|
+
whatsappInfoIcon?: string;
|
|
50
|
+
closeIcon?: string;
|
|
37
51
|
};
|
|
52
|
+
selectedOnward?: any;
|
|
53
|
+
selectedReturn?: any;
|
|
54
|
+
conexionChecked?: boolean;
|
|
55
|
+
conexionPassengers?: number;
|
|
56
|
+
returnConexionFare?: number;
|
|
57
|
+
conexionFare?: number;
|
|
58
|
+
loginData?: any;
|
|
59
|
+
checkWhatsappEligibility?: boolean;
|
|
60
|
+
removeDiscountAtomValue?: boolean;
|
|
61
|
+
netFare?: number;
|
|
62
|
+
walletMoney?: number;
|
|
63
|
+
virtualMoney?: number;
|
|
64
|
+
virtualLimit?: number;
|
|
65
|
+
discountAmount?: number;
|
|
66
|
+
discountArray?: any;
|
|
67
|
+
agencyFee?: number;
|
|
68
|
+
isAgency?: boolean;
|
|
69
|
+
showUsd?: boolean;
|
|
70
|
+
netFareInUsd?: number;
|
|
71
|
+
promoCode?: any;
|
|
72
|
+
onPromoRemove?: () => void;
|
|
73
|
+
renderDiscount?: (discountAmount: number) => React.ReactNode;
|
|
38
74
|
}
|