kupos-ui-components-lib 9.9.6 → 9.9.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/KuposUIComponent.d.ts +0 -3
- package/dist/components/ServiceItem/PeruServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/PeruServiceItemDesktop.js +176 -156
- package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +31 -29
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +17 -43
- package/dist/components/ServiceItem/mobileTypes.d.ts +2 -48
- package/dist/components/ServiceItem/types.d.ts +8 -27
- package/dist/styles.css +16 -219
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +2 -1
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +4 -2
- package/dist/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.js +10 -3
- package/dist/ui/OfferBanner.d.ts +0 -2
- package/dist/ui/OfferBanner.js +15 -22
- package/dist/ui/SeatSection/SeatSection.d.ts +7 -1
- package/dist/ui/SeatSection/SeatSection.js +41 -12
- package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/DateTimeSectionMobile.js +12 -6
- package/dist/ui/mobileweb/SeatSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/SeatSectionMobile.js +21 -14
- package/dist/utils/CommonService.d.ts +1 -4
- package/dist/utils/CommonService.js +6 -19
- package/package.json +1 -1
- package/src/KuposUIComponent.tsx +0 -3
- package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +277 -404
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +51 -71
- package/src/components/ServiceItem/ServiceItemMobile.tsx +290 -387
- package/src/components/ServiceItem/mobileTypes.ts +8 -50
- package/src/components/ServiceItem/types.ts +13 -32
- package/src/styles.css +0 -15
- package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +4 -2
- package/src/ui/OfferBanner.tsx +43 -71
- package/src/ui/SeatSection/SeatSection.tsx +86 -21
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +44 -35
- package/src/ui/mobileweb/SeatSectionMobile.tsx +23 -11
- package/src/utils/CommonService.ts +8 -27
- package/src/assets/images/anims/service_list/flame_anim.json +0 -1
- package/src/assets/images/anims/service_list/thunder_icon.json +0 -1
- package/src/assets/images/anims/service_list/users_anim.json +0 -1
- package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +0 -575
- package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +0 -634
|
@@ -46,20 +46,6 @@ export interface MobileServiceItemProps {
|
|
|
46
46
|
dp_discount_percents?: Record<string, number>;
|
|
47
47
|
dp_discounted_seats?: string[];
|
|
48
48
|
dep_validation_text?: string;
|
|
49
|
-
discount_type?: string;
|
|
50
|
-
discount_value?: number;
|
|
51
|
-
max_discount?: number;
|
|
52
|
-
discounts?: Array<{
|
|
53
|
-
id?: number;
|
|
54
|
-
name?: string;
|
|
55
|
-
send_discount_to_api?: boolean;
|
|
56
|
-
new_ui_enabled?: boolean;
|
|
57
|
-
discount?: number;
|
|
58
|
-
seatwise_breakdown?: any;
|
|
59
|
-
seat_wise_discounts?: any;
|
|
60
|
-
total_amount?: number;
|
|
61
|
-
promotional_text?: string;
|
|
62
|
-
}>;
|
|
63
49
|
metaData?: {};
|
|
64
50
|
is_tracking_enabled?: boolean;
|
|
65
51
|
show_top_label?: boolean;
|
|
@@ -135,36 +121,21 @@ export interface MobileServiceItemProps {
|
|
|
135
121
|
bombAnim?: string;
|
|
136
122
|
whiteBoardingIcon?: string;
|
|
137
123
|
downArrow?: string;
|
|
138
|
-
personIcon?: string
|
|
124
|
+
personIcon?: string;
|
|
139
125
|
specialDeparture?: string;
|
|
140
126
|
fireIcon?: string;
|
|
141
127
|
directoIcon?: string;
|
|
142
|
-
whiteFireIcon?: string
|
|
143
|
-
femaleAnim?:string
|
|
144
|
-
thunderAnim?: string
|
|
145
|
-
personsAnim?: string
|
|
146
|
-
whiteOrigin?: string,
|
|
147
|
-
whiteDestination?: string,
|
|
148
|
-
userIcon?: string,
|
|
149
|
-
|
|
150
|
-
sheildIcon?: string,
|
|
151
|
-
busIcon?: string,
|
|
152
|
-
whiteDownArrow?: string,
|
|
153
|
-
empressaIcon?: string,
|
|
154
|
-
flexibleIcon?: string,
|
|
155
|
-
listoIcon?: string,
|
|
156
|
-
precioIcon?: string,
|
|
157
|
-
confirmarIcon?: string
|
|
128
|
+
whiteFireIcon?: string;
|
|
129
|
+
femaleAnim?: string;
|
|
158
130
|
cancelTicketIcon?: string;
|
|
159
131
|
changeTicketIcon?: string;
|
|
160
132
|
petFriendlyIcon?: string;
|
|
161
|
-
womenSeatIcon?: string
|
|
133
|
+
womenSeatIcon?: string;
|
|
162
134
|
[key: string]: string | Record<string, string | undefined> | undefined;
|
|
163
135
|
};
|
|
164
136
|
useLottieFor?: string[];
|
|
165
137
|
};
|
|
166
138
|
onBookButtonPress?: () => void;
|
|
167
|
-
onRemateUiButtonClick?: ()=> void;
|
|
168
139
|
terminals?: any[];
|
|
169
140
|
showDropdown?: boolean;
|
|
170
141
|
setShowDropdown?: (value: boolean) => void;
|
|
@@ -208,7 +179,7 @@ export interface MobileServiceItemProps {
|
|
|
208
179
|
seatPriceColor?: string;
|
|
209
180
|
rightGradiantColor?: string;
|
|
210
181
|
leftGradiantColor?: string;
|
|
211
|
-
discountSeatPriceColor?: string
|
|
182
|
+
discountSeatPriceColor?: string;
|
|
212
183
|
};
|
|
213
184
|
isCiva?: boolean;
|
|
214
185
|
currencySign?: string;
|
|
@@ -221,26 +192,13 @@ export interface MobileServiceItemProps {
|
|
|
221
192
|
showLastSeats?: boolean;
|
|
222
193
|
removeDuplicateSeats?: boolean;
|
|
223
194
|
isLinatal?: boolean;
|
|
224
|
-
|
|
195
|
+
viewersConfig?: {
|
|
225
196
|
min: number;
|
|
226
197
|
max: number;
|
|
227
198
|
interval?: number; // ms, default 5000
|
|
228
199
|
label?: string; // e.g. "personas están viendo este viaje"
|
|
229
200
|
icon?: string; // optional icon URL
|
|
230
201
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
ticketQuantity?: number;
|
|
234
|
-
onIncreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
235
|
-
onDecreaseTicketQuantity?: (serviceItem: MobileServiceItemProps["serviceItem"]) => void;
|
|
236
|
-
cityOrigin?: { value: number; label: string };
|
|
237
|
-
cityDestination?: { value: number; label: string };
|
|
238
|
-
isNewUi?: boolean
|
|
239
|
-
|
|
240
|
-
selectedTimeSlot?: string;
|
|
241
|
-
onTimeSlotChange?: (slot: string) => void;
|
|
242
|
-
isTimeDropdownOpen?: string | number | null;
|
|
243
|
-
onTimeDropdownToggle?: (id?: string | number | null) => void;
|
|
244
|
-
wowDealData?: any;
|
|
245
|
-
isFlores?: boolean;
|
|
202
|
+
operatorLabel?: string;
|
|
203
|
+
isTrain?: boolean;
|
|
246
204
|
}
|
|
@@ -47,9 +47,6 @@ export interface ServiceItemProps {
|
|
|
47
47
|
discount_type?: string;
|
|
48
48
|
discount_value?: number;
|
|
49
49
|
max_discount?: number;
|
|
50
|
-
discounts?: Array<{
|
|
51
|
-
new_ui_enabled?: boolean;
|
|
52
|
-
}>;
|
|
53
50
|
is_transpordo?: boolean;
|
|
54
51
|
is_train_type?: boolean;
|
|
55
52
|
operator_service_name?: string;
|
|
@@ -135,24 +132,11 @@ export interface ServiceItemProps {
|
|
|
135
132
|
whiteFireIcon?: string;
|
|
136
133
|
fireIcon?: string;
|
|
137
134
|
|
|
138
|
-
whiteOrigin?: string;
|
|
139
|
-
whiteDestination?: string;
|
|
140
|
-
userIcon?: string;
|
|
141
|
-
|
|
142
|
-
sheildIcon?: string;
|
|
143
|
-
busIcon?: string;
|
|
144
|
-
whiteDownArrow?: string;
|
|
145
|
-
empressaIcon?: string;
|
|
146
|
-
flexibleIcon?: string;
|
|
147
|
-
listoIcon?: string;
|
|
148
|
-
precioIcon?: string;
|
|
149
|
-
confirmarIcon?: string;
|
|
150
135
|
[key: string]: string | Record<string, string | undefined> | undefined;
|
|
151
136
|
};
|
|
152
137
|
useLottieFor?: string[];
|
|
153
138
|
};
|
|
154
139
|
onBookButtonPress?: () => void;
|
|
155
|
-
onRemateUiButtonClick?: () => void;
|
|
156
140
|
terminals?: any[];
|
|
157
141
|
t?: (key: string) => string;
|
|
158
142
|
serviceDetailsLoading?: boolean;
|
|
@@ -231,15 +215,6 @@ export interface ServiceItemProps {
|
|
|
231
215
|
isAllinBus?: boolean;
|
|
232
216
|
isExpand?: any;
|
|
233
217
|
setIsExpand?: (value: any) => void;
|
|
234
|
-
isFeatureDropDownExpand?: any;
|
|
235
|
-
setIsFeatureDropDownExpand?: (value: any) => void;
|
|
236
|
-
ticketQuantity?: number;
|
|
237
|
-
onIncreaseTicketQuantity?: (
|
|
238
|
-
serviceItem: ServiceItemProps["serviceItem"],
|
|
239
|
-
) => void;
|
|
240
|
-
onDecreaseTicketQuantity?: (
|
|
241
|
-
serviceItem: ServiceItemProps["serviceItem"],
|
|
242
|
-
) => void;
|
|
243
218
|
coachKey?: number;
|
|
244
219
|
viewersConfig?: {
|
|
245
220
|
min: number;
|
|
@@ -248,15 +223,21 @@ export interface ServiceItemProps {
|
|
|
248
223
|
label?: string; // e.g. "personas están viendo este viaje"
|
|
249
224
|
icon?: string; // optional icon URL
|
|
250
225
|
};
|
|
251
|
-
isNewUi?: boolean;
|
|
252
226
|
showLoginModal?: any;
|
|
253
227
|
isLoggedIn?: any;
|
|
254
228
|
showLoginOption?: boolean;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
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;
|
|
261
241
|
isFlores?: boolean;
|
|
242
|
+
operatorLabel?: string;
|
|
262
243
|
}
|
package/src/styles.css
CHANGED
|
@@ -93,21 +93,6 @@
|
|
|
93
93
|
display: none;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
/* Time slot dropdown */
|
|
97
|
-
.kupos-time-dd > summary {
|
|
98
|
-
list-style: none;
|
|
99
|
-
}
|
|
100
|
-
.kupos-time-dd > summary::-webkit-details-marker {
|
|
101
|
-
display: none;
|
|
102
|
-
}
|
|
103
|
-
.kupos-time-chevron {
|
|
104
|
-
transition: transform 200ms ease;
|
|
105
|
-
flex-shrink: 0;
|
|
106
|
-
}
|
|
107
|
-
.kupos-time-dd[open] .kupos-time-chevron {
|
|
108
|
-
transform: rotate(180deg);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
96
|
.hide-scrollbar {
|
|
112
97
|
-ms-overflow-style: none;
|
|
113
98
|
scrollbar-width: none;
|
|
@@ -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
|
@@ -19,8 +19,6 @@ interface OfferBannerProps {
|
|
|
19
19
|
viewersConfig: ServiceItemProps["viewersConfig"];
|
|
20
20
|
getAnimationIcon: (name: string) => any;
|
|
21
21
|
showLoginOption?: boolean;
|
|
22
|
-
isNewUiEnabled?: boolean;
|
|
23
|
-
colors: any;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
@@ -33,17 +31,12 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
33
31
|
viewersConfig,
|
|
34
32
|
getAnimationIcon,
|
|
35
33
|
showLoginOption,
|
|
36
|
-
isNewUiEnabled,
|
|
37
|
-
colors,
|
|
38
34
|
}) => {
|
|
39
35
|
return (
|
|
40
36
|
<div
|
|
41
|
-
className="text-white p-[
|
|
37
|
+
className="text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[36px] pt-[50px] rounded-b-[14px] text-[14px]"
|
|
42
38
|
style={{
|
|
43
|
-
background:
|
|
44
|
-
serviceItem?.offer_text && !isNewUiEnabled
|
|
45
|
-
? colors?.bottomStripColor
|
|
46
|
-
: offerGradient,
|
|
39
|
+
background: offerGradient,
|
|
47
40
|
opacity: isSoldOut ? 0.5 : 1,
|
|
48
41
|
// zIndex: 0,
|
|
49
42
|
}}
|
|
@@ -63,7 +56,7 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
63
56
|
{/* starAnimation */}
|
|
64
57
|
<span>Servicio popular entre los usuarios</span>
|
|
65
58
|
</div>
|
|
66
|
-
) :
|
|
59
|
+
) : (
|
|
67
60
|
<div className="flex items-center">
|
|
68
61
|
<LottiePlayer
|
|
69
62
|
animationData={getAnimationIcon("bombAnimation")}
|
|
@@ -80,14 +73,18 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
80
73
|
{(serviceItem?.offer_text || "").length > 30
|
|
81
74
|
? (serviceItem?.offer_text || "").slice(0, 30) + "..."
|
|
82
75
|
: serviceItem?.offer_text || ""}{" "}
|
|
83
|
-
{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 : (
|
|
84
81
|
<span onClick={showLoginModal} className="cursor-pointer">
|
|
85
82
|
- registro
|
|
86
83
|
</span>
|
|
87
84
|
)}{" "}
|
|
88
85
|
|
|
89
86
|
</span>{" "}
|
|
90
|
-
{serviceItem?.offer_text ? "|" : ""}
|
|
87
|
+
{serviceItem?.offer_text ? "| " : ""}
|
|
91
88
|
Termina en
|
|
92
89
|
<span
|
|
93
90
|
className="bold-text text-end"
|
|
@@ -99,70 +96,45 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
99
96
|
/>
|
|
100
97
|
</div>
|
|
101
98
|
</div>
|
|
102
|
-
) : (
|
|
103
|
-
serviceItem?.offer_text &&
|
|
104
|
-
!isNewUiEnabled && (
|
|
105
|
-
<div className="flex items-center">
|
|
106
|
-
<LottiePlayer
|
|
107
|
-
animationData={getAnimationIcon("promoAnim")}
|
|
108
|
-
width="18px"
|
|
109
|
-
height="18px"
|
|
110
|
-
/>
|
|
111
|
-
<div className="flex items-center mt-[2px]">
|
|
112
|
-
<span
|
|
113
|
-
className="bold-text"
|
|
114
|
-
style={{
|
|
115
|
-
marginLeft: serviceItem?.offer_text ? "6px" : "3px",
|
|
116
|
-
}}
|
|
117
|
-
>
|
|
118
|
-
{serviceItem?.offer_text || ""}
|
|
119
|
-
</span>{" "}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
)
|
|
123
99
|
)}
|
|
124
100
|
</div>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/>
|
|
101
|
+
<div className="flex items-center">
|
|
102
|
+
{/* {renderIcon("personIcon", "16px")} */}
|
|
103
|
+
<LottiePlayer
|
|
104
|
+
animationData={getAnimationIcon("dotAnimation")}
|
|
105
|
+
width="12px"
|
|
106
|
+
height="12px"
|
|
107
|
+
/>
|
|
133
108
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
/>{" "}
|
|
160
|
-
comprando
|
|
161
|
-
</span>
|
|
109
|
+
<span className="ml-[6px]">
|
|
110
|
+
<span
|
|
111
|
+
className="bold-text"
|
|
112
|
+
ref={(node) =>
|
|
113
|
+
CommonService.startViewerCount(node, viewersConfig)
|
|
114
|
+
}
|
|
115
|
+
style={{ fontVariantNumeric: "tabular-nums" }}
|
|
116
|
+
/>{" "}
|
|
117
|
+
{/* <span className="bold-text">personas</span>{" "} */}
|
|
118
|
+
<span>
|
|
119
|
+
{" "}
|
|
120
|
+
{viewersConfig?.label || " viendo"} |{" "}
|
|
121
|
+
<span className="">
|
|
122
|
+
{serviceItem?.is_dp_enabled &&
|
|
123
|
+
Object.keys(serviceItem?.dp_discount_percents ?? {}).length ===
|
|
124
|
+
0 &&
|
|
125
|
+
(serviceItem?.dp_discounted_seats ?? []).length === 0
|
|
126
|
+
? null
|
|
127
|
+
: "Quedan pocos • "}
|
|
128
|
+
<span
|
|
129
|
+
className="bold-text"
|
|
130
|
+
ref={(node) => CommonService.startComprandoCount(node, 4, 16)}
|
|
131
|
+
style={{ fontVariantNumeric: "tabular-nums" }}
|
|
132
|
+
/>{" "}
|
|
133
|
+
comprando
|
|
162
134
|
</span>
|
|
163
135
|
</span>
|
|
164
|
-
</
|
|
165
|
-
|
|
136
|
+
</span>
|
|
137
|
+
</div>
|
|
166
138
|
</div>
|
|
167
139
|
</div>
|
|
168
140
|
);
|
|
@@ -7,6 +7,8 @@ interface SeatType {
|
|
|
7
7
|
label: string;
|
|
8
8
|
fare: number;
|
|
9
9
|
key: any;
|
|
10
|
+
apiSeatType?: string;
|
|
11
|
+
api_seat_type?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
interface SeatSectionProps {
|
|
@@ -21,6 +23,15 @@ interface SeatSectionProps {
|
|
|
21
23
|
serviceItem?: any;
|
|
22
24
|
renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
|
|
23
25
|
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;
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
@@ -31,6 +42,8 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
31
42
|
let seatTypesWithPrices = seatTypes.filter(Boolean).map((val) => ({
|
|
32
43
|
label: val?.label,
|
|
33
44
|
price: val?.fare,
|
|
45
|
+
key: val?.key,
|
|
46
|
+
apiSeatType: val?.apiSeatType || val?.api_seat_type,
|
|
34
47
|
}));
|
|
35
48
|
|
|
36
49
|
seatTypesWithPrices.sort((a, b) => a.price - b.price);
|
|
@@ -38,7 +51,7 @@ function getAllSeatTypes(seatTypes: SeatType[]) {
|
|
|
38
51
|
return seatTypesWithPrices;
|
|
39
52
|
}
|
|
40
53
|
|
|
41
|
-
function getSortedSeatTypes(seatTypes: SeatType[]) {
|
|
54
|
+
function getSortedSeatTypes(seatTypes: SeatType[], isTrain: any) {
|
|
42
55
|
if (!seatTypes?.length) {
|
|
43
56
|
return [{ label: "Salon cama", price: 0 }];
|
|
44
57
|
}
|
|
@@ -52,7 +65,9 @@ function getSortedSeatTypes(seatTypes: SeatType[]) {
|
|
|
52
65
|
seatTypesWithPrices[2] = seatTypesWithPrices[premiumIndex];
|
|
53
66
|
}
|
|
54
67
|
|
|
55
|
-
|
|
68
|
+
if (!isTrain) {
|
|
69
|
+
seatTypesWithPrices = seatTypesWithPrices.slice(0, 2);
|
|
70
|
+
}
|
|
56
71
|
|
|
57
72
|
const seenPrices = new Set<number>();
|
|
58
73
|
seatTypesWithPrices = seatTypesWithPrices.filter((seat) => {
|
|
@@ -97,14 +112,18 @@ function SeatSection({
|
|
|
97
112
|
priceColor,
|
|
98
113
|
currencySign,
|
|
99
114
|
removeDuplicateSeats,
|
|
115
|
+
selectedSeatKey,
|
|
116
|
+
onSeatSelect,
|
|
100
117
|
isPeru,
|
|
101
118
|
serviceItem,
|
|
102
119
|
renderIcon,
|
|
103
120
|
dpSeatColor,
|
|
104
121
|
discountSeatPriceColor,
|
|
122
|
+
isTrain,
|
|
123
|
+
topLabelColor,
|
|
105
124
|
}: SeatSectionProps): React.ReactElement {
|
|
106
125
|
const uniqueSeats = getUniqueSeats(seatTypes);
|
|
107
|
-
const sortedSeatTypes = getSortedSeatTypes(seatTypes);
|
|
126
|
+
const sortedSeatTypes = getSortedSeatTypes(seatTypes, isTrain);
|
|
108
127
|
const numberOfSeats = getNumberOfSeats(seatTypes);
|
|
109
128
|
const isCentered = numberOfSeats < 2 || removeDuplicateSeats;
|
|
110
129
|
|
|
@@ -116,22 +135,68 @@ function SeatSection({
|
|
|
116
135
|
const renderSeatNames = () => {
|
|
117
136
|
const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
|
|
118
137
|
|
|
119
|
-
return seats.map((val, key: number) =>
|
|
120
|
-
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
return seats.map((val, key: number) => {
|
|
139
|
+
return SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
140
|
+
<div
|
|
141
|
+
className="flex items-center"
|
|
142
|
+
style={isTrain ? { cursor: "pointer" } : undefined}
|
|
143
|
+
onClick={
|
|
144
|
+
isTrain && !isSoldOut
|
|
145
|
+
? () =>
|
|
146
|
+
val.label === selectedSeatKey
|
|
147
|
+
? onSeatSelect?.(null, 0, "", "")
|
|
148
|
+
: onSeatSelect?.(
|
|
149
|
+
val.label,
|
|
150
|
+
val.price,
|
|
151
|
+
val.key,
|
|
152
|
+
(val as any).apiSeatType,
|
|
153
|
+
)
|
|
154
|
+
: undefined
|
|
155
|
+
}
|
|
126
156
|
>
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
157
|
+
{isTrain && (
|
|
158
|
+
<div
|
|
159
|
+
style={{
|
|
160
|
+
border: `1px solid ${val.label === selectedSeatKey ? topLabelColor : "#ccc"}`,
|
|
161
|
+
borderRadius: "50%",
|
|
162
|
+
width: "14px",
|
|
163
|
+
height: "14px",
|
|
164
|
+
minWidth: "14px",
|
|
165
|
+
marginRight: "10px",
|
|
166
|
+
display: "flex",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
justifyContent: "center",
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
{val.label === selectedSeatKey && (
|
|
172
|
+
<div
|
|
173
|
+
style={{
|
|
174
|
+
backgroundColor: topLabelColor,
|
|
175
|
+
borderRadius: "50%",
|
|
176
|
+
width: "7px",
|
|
177
|
+
height: "7px",
|
|
178
|
+
}}
|
|
179
|
+
/>
|
|
180
|
+
)}
|
|
181
|
+
</div>
|
|
182
|
+
)}
|
|
183
|
+
<span
|
|
184
|
+
key={key}
|
|
185
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
186
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
187
|
+
}`}
|
|
188
|
+
>
|
|
189
|
+
{typeof val.label === "string" || typeof val.label === "number"
|
|
190
|
+
? removeDuplicateSeats && isPeru
|
|
191
|
+
? CommonService.truncateSeatLabel(val.label)
|
|
192
|
+
: isTrain
|
|
193
|
+
? CommonService.truncateSeatLabel(val.label, 8)
|
|
194
|
+
: val.label
|
|
195
|
+
: null}
|
|
196
|
+
</span>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
});
|
|
135
200
|
};
|
|
136
201
|
|
|
137
202
|
const renderSeatPrices = () => {
|
|
@@ -277,7 +342,7 @@ function SeatSection({
|
|
|
277
342
|
{!isNaN(Number(dpDiscountPercent)) &&
|
|
278
343
|
Number(dpDiscountPercent) > 0 && (
|
|
279
344
|
<span
|
|
280
|
-
className=
|
|
345
|
+
className="rounded-[100px] bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white"
|
|
281
346
|
style={{
|
|
282
347
|
animation: "pulse-zoom 2s ease-in-out infinite",
|
|
283
348
|
whiteSpace: "nowrap",
|
|
@@ -319,7 +384,7 @@ function SeatSection({
|
|
|
319
384
|
>
|
|
320
385
|
<div
|
|
321
386
|
className="absolute"
|
|
322
|
-
style={{ left: isPeru ? "-
|
|
387
|
+
style={{ left: isPeru ? "-19px" : "-19px", bottom: "1px" }}
|
|
323
388
|
>
|
|
324
389
|
{renderIcon("fireIcon", "16px")}
|
|
325
390
|
</div>
|
|
@@ -476,7 +541,7 @@ function SeatSection({
|
|
|
476
541
|
<div
|
|
477
542
|
className="absolute"
|
|
478
543
|
style={{
|
|
479
|
-
left: isPeru ? "-
|
|
544
|
+
left: isPeru ? "-18px" : "-18px",
|
|
480
545
|
bottom: "1px",
|
|
481
546
|
}}
|
|
482
547
|
>
|