kupos-ui-components-lib 9.9.1 → 9.9.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.d.ts +3 -0
- package/dist/components/ServiceItem/PeruServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/PeruServiceItemDesktop.js +2 -2
- package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemDesktop.js +30 -31
- package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
- package/dist/components/ServiceItem/ServiceItemMobile.js +43 -17
- package/dist/components/ServiceItem/mobileTypes.d.ts +48 -1
- package/dist/components/ServiceItem/types.d.ts +27 -9
- package/dist/styles.css +215 -6
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +1 -2
- package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +2 -4
- package/dist/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.js +22 -41
- package/dist/ui/FeatureServiceUI/FeatureServiceUi.js +24 -44
- package/dist/ui/OfferBanner.d.ts +2 -0
- package/dist/ui/OfferBanner.js +19 -14
- package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
- package/dist/ui/SeatSection/SeatSection.js +12 -44
- package/dist/utils/CommonService.d.ts +3 -0
- package/dist/utils/CommonService.js +18 -1
- package/package.json +1 -1
- package/src/KuposUIComponent.tsx +3 -0
- package/src/assets/images/anims/service_list/flame_anim.json +1 -0
- package/src/assets/images/anims/service_list/thunder_icon.json +1 -0
- package/src/assets/images/anims/service_list/users_anim.json +1 -0
- package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +35 -24
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +65 -53
- package/src/components/ServiceItem/ServiceItemMobile.tsx +387 -288
- package/src/components/ServiceItem/mobileTypes.ts +50 -7
- package/src/components/ServiceItem/types.ts +39 -25
- package/src/styles.css +15 -0
- package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +2 -4
- package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +575 -0
- package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +610 -0
- package/src/ui/OfferBanner.tsx +31 -10
- package/src/ui/SeatSection/SeatSection.tsx +21 -88
- package/src/utils/CommonService.ts +26 -1
|
@@ -67,7 +67,7 @@ function PeruServiceItemDesktop({
|
|
|
67
67
|
isPeru,
|
|
68
68
|
siteType,
|
|
69
69
|
isAllinBus,
|
|
70
|
-
|
|
70
|
+
isNewUiEnabled,
|
|
71
71
|
t = (key: string) => key,
|
|
72
72
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
73
73
|
const animationMap: Record<string, Record<string, any>> = {
|
|
@@ -149,8 +149,9 @@ function PeruServiceItemDesktop({
|
|
|
149
149
|
style={{
|
|
150
150
|
filter: color === "white" ? "brightness(0) invert(1)" : "",
|
|
151
151
|
}}
|
|
152
|
-
className={`object-contain ${
|
|
153
|
-
|
|
152
|
+
className={`object-contain ${
|
|
153
|
+
moreAnemities ? "w-[16px] h-[16px]" : "w-[16px] h-[16px]"
|
|
154
|
+
}`}
|
|
154
155
|
/>
|
|
155
156
|
);
|
|
156
157
|
};
|
|
@@ -261,8 +262,9 @@ function PeruServiceItemDesktop({
|
|
|
261
262
|
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
262
263
|
<span
|
|
263
264
|
key={key}
|
|
264
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
265
|
-
|
|
265
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
266
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
267
|
+
}`}
|
|
266
268
|
>
|
|
267
269
|
<div>
|
|
268
270
|
<img
|
|
@@ -287,8 +289,9 @@ function PeruServiceItemDesktop({
|
|
|
287
289
|
SEAT_EXCEPTIONS.includes(val.label) ? null : (
|
|
288
290
|
<span
|
|
289
291
|
key={key}
|
|
290
|
-
className={`flex items-center justify-between text-[13.33px] ${
|
|
291
|
-
|
|
292
|
+
className={`flex items-center justify-between text-[13.33px] ${
|
|
293
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
294
|
+
}`}
|
|
292
295
|
>
|
|
293
296
|
<div>
|
|
294
297
|
<img
|
|
@@ -536,13 +539,15 @@ function PeruServiceItemDesktop({
|
|
|
536
539
|
|
|
537
540
|
return (
|
|
538
541
|
<div
|
|
539
|
-
className={`relative ${
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
542
|
+
className={`relative ${
|
|
543
|
+
serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"
|
|
544
|
+
} ${
|
|
545
|
+
serviceItem?.is_direct_trip ||
|
|
546
|
+
serviceItem?.train_type_label === "Tren Express (Nuevo)" ||
|
|
547
|
+
showTopLabel
|
|
543
548
|
? "mt-[24px]"
|
|
544
549
|
: "mt-[20px]"
|
|
545
|
-
|
|
550
|
+
} `}
|
|
546
551
|
>
|
|
547
552
|
<div
|
|
548
553
|
className={"bg-white rounded-[20px] shadow-service mx-auto relative"}
|
|
@@ -583,8 +588,9 @@ function PeruServiceItemDesktop({
|
|
|
583
588
|
<img
|
|
584
589
|
src={serviceItem.operator_details[0]}
|
|
585
590
|
alt="service logo"
|
|
586
|
-
className={`h-auto object-contain ${
|
|
587
|
-
|
|
591
|
+
className={` h-auto object-contain ${
|
|
592
|
+
isSoldOut ? "grayscale" : ""
|
|
593
|
+
}`}
|
|
588
594
|
/>
|
|
589
595
|
</div>
|
|
590
596
|
{isCiva ? (
|
|
@@ -596,8 +602,9 @@ function PeruServiceItemDesktop({
|
|
|
596
602
|
|
|
597
603
|
{/* DATE AND TIME - Grid Layout */}
|
|
598
604
|
<div
|
|
599
|
-
className={`min-h-[2.5rem] grid grid-cols-[0.8fr_auto_26%_1fr] gap-x-4 items-center text-[13.33px] ${
|
|
600
|
-
|
|
605
|
+
className={`min-h-[2.5rem] grid grid-cols-[0.8fr_auto_26%_1fr] gap-x-4 items-center text-[13.33px] ${
|
|
606
|
+
isSoldOut ? "text-[#c0c0c0]" : ""
|
|
607
|
+
}`}
|
|
601
608
|
style={{
|
|
602
609
|
gridTemplateRows: "1fr",
|
|
603
610
|
}}
|
|
@@ -614,8 +621,9 @@ function PeruServiceItemDesktop({
|
|
|
614
621
|
<img
|
|
615
622
|
src={serviceItem.icons?.origin}
|
|
616
623
|
alt="origin"
|
|
617
|
-
className={`w-[18px] h-auto mr-[8px] ${
|
|
618
|
-
|
|
624
|
+
className={`w-[18px] h-auto mr-[8px] ${
|
|
625
|
+
isSoldOut ? "grayscale" : ""
|
|
626
|
+
}`}
|
|
619
627
|
/>
|
|
620
628
|
</div>
|
|
621
629
|
)}
|
|
@@ -630,8 +638,9 @@ function PeruServiceItemDesktop({
|
|
|
630
638
|
<div className="h-[20px] flex items-center">
|
|
631
639
|
<img
|
|
632
640
|
src={serviceItem.icons?.destination}
|
|
633
|
-
className={`w-[18px] h-auto mr-[8px] ${
|
|
634
|
-
|
|
641
|
+
className={`w-[18px] h-auto mr-[8px] ${
|
|
642
|
+
isSoldOut ? "grayscale" : ""
|
|
643
|
+
}`}
|
|
635
644
|
style={{ opacity: isSoldOut ? 0.5 : 1 }}
|
|
636
645
|
/>
|
|
637
646
|
</div>
|
|
@@ -736,8 +745,9 @@ function PeruServiceItemDesktop({
|
|
|
736
745
|
{/* SEATS */}
|
|
737
746
|
<div className="content-center">
|
|
738
747
|
<div
|
|
739
|
-
className={`relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.5rem] ${
|
|
740
|
-
|
|
748
|
+
className={`relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.5rem] ${
|
|
749
|
+
getNumberOfSeats() < 3 ? "" : ""
|
|
750
|
+
}`}
|
|
741
751
|
style={
|
|
742
752
|
getNumberOfSeats() < 2
|
|
743
753
|
? { alignItems: "center" }
|
|
@@ -783,8 +793,9 @@ function PeruServiceItemDesktop({
|
|
|
783
793
|
<button
|
|
784
794
|
onClick={() => (!isSoldOut ? checkMidnight() : null)}
|
|
785
795
|
disabled={serviceDetailsLoading}
|
|
786
|
-
className={`w-full ${
|
|
787
|
-
|
|
796
|
+
className={`w-full ${
|
|
797
|
+
serviceDetailsLoading || isSoldOut ? "py-[12px]" : "py-[12px]"
|
|
798
|
+
} text-[13.33px] font-bold text-white rounded-[10px] border-none px-[20px] flex items-center justify-center`}
|
|
788
799
|
style={{
|
|
789
800
|
backgroundColor:
|
|
790
801
|
serviceDetailsLoading || isSoldOut
|
|
@@ -27,6 +27,8 @@ import bombAnimation from "../../assets/images/anims/service_list/bomb.json";
|
|
|
27
27
|
import dotAnimation from "../../assets/images/anims/service_list/dot_animation.json";
|
|
28
28
|
import starAnimation from "../../assets/images/anims/service_list/star_anim.json";
|
|
29
29
|
import femaleAnimation from "../../assets/images/anims/service_list/female_anim.json";
|
|
30
|
+
import usersAnimation from "../../assets/images/anims/service_list/users_anim.json";
|
|
31
|
+
import flameAnimation from "../../assets/images/anims/service_list/flame_anim.json";
|
|
30
32
|
|
|
31
33
|
import RatingBlock from "../../ui/RatingBlock";
|
|
32
34
|
import DurationBlock from "../../ui/DurationBlock";
|
|
@@ -37,6 +39,9 @@ import KuposButton from "../../ui/KuposButton/KuposButton";
|
|
|
37
39
|
import BottomAmenities from "../../ui/BottomAmenities/BottomAmenities";
|
|
38
40
|
import SeatSection from "../../ui/SeatSection/SeatSection";
|
|
39
41
|
import DateTimeSection from "../../ui/DateTimeSection/DateTimeSection";
|
|
42
|
+
import FeatureServiceUi from "../../ui/FeatureServiceUI/FeatureServiceUi";
|
|
43
|
+
|
|
44
|
+
import thunderAnimation from "../../assets/images/anims/service_list/thunder_icon.json";
|
|
40
45
|
import ServiceBadges from "../../ui/ServiceBadges/ServiceBadges";
|
|
41
46
|
|
|
42
47
|
const SEAT_EXCEPTIONS = ["Asiento mascota"];
|
|
@@ -71,6 +76,9 @@ const ANIMATION_MAP: Record<string, Record<string, any>> = {
|
|
|
71
76
|
bombAnimation: {
|
|
72
77
|
kupos: bombAnimation,
|
|
73
78
|
},
|
|
79
|
+
thunderAnimation: {
|
|
80
|
+
kupos: thunderAnimation,
|
|
81
|
+
},
|
|
74
82
|
dotAnimation: {
|
|
75
83
|
kupos: dotAnimation,
|
|
76
84
|
},
|
|
@@ -80,6 +88,12 @@ const ANIMATION_MAP: Record<string, Record<string, any>> = {
|
|
|
80
88
|
femaaleAnimation: {
|
|
81
89
|
kupos: femaleAnimation,
|
|
82
90
|
},
|
|
91
|
+
usersAnimation: {
|
|
92
|
+
kupos: usersAnimation,
|
|
93
|
+
},
|
|
94
|
+
flameAnimation: {
|
|
95
|
+
kupos: flameAnimation,
|
|
96
|
+
},
|
|
83
97
|
};
|
|
84
98
|
|
|
85
99
|
function ServiceItemPB({
|
|
@@ -113,28 +127,22 @@ function ServiceItemPB({
|
|
|
113
127
|
setIsExpand,
|
|
114
128
|
coachKey,
|
|
115
129
|
viewersConfig,
|
|
130
|
+
isNewUi,
|
|
116
131
|
showLoginModal,
|
|
117
132
|
isLoggedIn,
|
|
118
133
|
showLoginOption,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
isFeatureDropDownExpand,
|
|
135
|
+
setIsFeatureDropDownExpand,
|
|
136
|
+
ticketQuantity,
|
|
137
|
+
onIncreaseTicketQuantity,
|
|
138
|
+
onDecreaseTicketQuantity,
|
|
139
|
+
onRemateUiButtonClick,
|
|
140
|
+
selectedTimeSlot,
|
|
141
|
+
onTimeSlotChange,
|
|
142
|
+
isTimeDropdownOpen,
|
|
143
|
+
onTimeDropdownToggle,
|
|
144
|
+
wowDealData,
|
|
128
145
|
}: ServiceItemProps & { currencySign?: string }): React.ReactElement {
|
|
129
|
-
const handleSeatSelect = (
|
|
130
|
-
key: any,
|
|
131
|
-
price: number,
|
|
132
|
-
seatKey: string,
|
|
133
|
-
apiSeatType?: string,
|
|
134
|
-
) => {
|
|
135
|
-
onClearSeatSelectionError?.();
|
|
136
|
-
onSeatSelect?.(key, price, seatKey, apiSeatType);
|
|
137
|
-
};
|
|
138
146
|
const getAnimationIcon = (icon: string) => {
|
|
139
147
|
const animation = ANIMATION_MAP[icon];
|
|
140
148
|
if (!animation) return null;
|
|
@@ -196,6 +204,7 @@ function ServiceItemPB({
|
|
|
196
204
|
const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
|
|
197
205
|
const grayscaleClass = isSoldOut ? "grayscale" : "";
|
|
198
206
|
const hasOfferText = Boolean(serviceItem?.offer_text);
|
|
207
|
+
const isNewUiEnabled = serviceItem?.discounts?.[0]?.new_ui_enabled === true;
|
|
199
208
|
|
|
200
209
|
const seats = removeDuplicateSeats
|
|
201
210
|
? serviceItem.seat_types?.filter(
|
|
@@ -222,7 +231,7 @@ function ServiceItemPB({
|
|
|
222
231
|
const offerGradient = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"} 0%, ${colors.leftGradiantColor || "#ff8842"} 100%)`;
|
|
223
232
|
const offerGradientWithOpacity = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"}80 0%, ${colors.leftGradiantColor || "#ff8842"}80 100%)`;
|
|
224
233
|
const serviceCardStyle: React.CSSProperties =
|
|
225
|
-
hasOfferText || hasDpEnabled
|
|
234
|
+
(hasOfferText && isNewUiEnabled) || hasDpEnabled
|
|
226
235
|
? {
|
|
227
236
|
borderColor: "transparent",
|
|
228
237
|
borderStyle: "solid",
|
|
@@ -331,17 +340,6 @@ function ServiceItemPB({
|
|
|
331
340
|
return;
|
|
332
341
|
}
|
|
333
342
|
|
|
334
|
-
if (isTrain) {
|
|
335
|
-
if (!selectedSeatKey) {
|
|
336
|
-
onShowSeatSelectionError?.(serviceItem.id);
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (onTrainButtonClick) {
|
|
340
|
-
onTrainButtonClick();
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
343
|
onBookButtonPress();
|
|
346
344
|
};
|
|
347
345
|
|
|
@@ -443,7 +441,37 @@ function ServiceItemPB({
|
|
|
443
441
|
isPeru={isPeru}
|
|
444
442
|
siteType={siteType}
|
|
445
443
|
isAllinBus={isAllinBus}
|
|
446
|
-
|
|
444
|
+
isNewUiEnabled={isNewUiEnabled}
|
|
445
|
+
/>
|
|
446
|
+
) : isNewUi ? (
|
|
447
|
+
<FeatureServiceUi
|
|
448
|
+
serviceItem={serviceItem}
|
|
449
|
+
showTopLabel={showTopLabel}
|
|
450
|
+
isSoldOut={isSoldOut}
|
|
451
|
+
getAnimationIcon={getAnimationIcon}
|
|
452
|
+
cityOrigin={cityOrigin}
|
|
453
|
+
cityDestination={cityDestination}
|
|
454
|
+
renderIcon={renderIcon}
|
|
455
|
+
viewersConfig={viewersConfig}
|
|
456
|
+
isFeatureDropDownExpand={isFeatureDropDownExpand}
|
|
457
|
+
ticketQuantity={ticketQuantity}
|
|
458
|
+
onIncreaseTicketQuantity={onIncreaseTicketQuantity}
|
|
459
|
+
onDecreaseTicketQuantity={onDecreaseTicketQuantity}
|
|
460
|
+
onBookButtonPress={onRemateUiButtonClick}
|
|
461
|
+
onToggleExpand={() =>
|
|
462
|
+
setIsFeatureDropDownExpand &&
|
|
463
|
+
setIsFeatureDropDownExpand(
|
|
464
|
+
isFeatureDropDownExpand === serviceItem.id ||
|
|
465
|
+
isFeatureDropDownExpand === true
|
|
466
|
+
? null
|
|
467
|
+
: serviceItem.id,
|
|
468
|
+
)
|
|
469
|
+
}
|
|
470
|
+
selectedTimeSlot={selectedTimeSlot}
|
|
471
|
+
onTimeSlotChange={onTimeSlotChange}
|
|
472
|
+
isTimeDropdownOpen={isTimeDropdownOpen}
|
|
473
|
+
onTimeDropdownToggle={onTimeDropdownToggle}
|
|
474
|
+
wowDealData={wowDealData}
|
|
447
475
|
/>
|
|
448
476
|
) : (
|
|
449
477
|
<div
|
|
@@ -466,12 +494,15 @@ function ServiceItemPB({
|
|
|
466
494
|
viewersConfig={viewersConfig}
|
|
467
495
|
getAnimationIcon={getAnimationIcon}
|
|
468
496
|
showLoginOption={showLoginOption}
|
|
497
|
+
isNewUiEnabled={isNewUiEnabled}
|
|
498
|
+
colors={colors}
|
|
469
499
|
/>
|
|
470
500
|
)}
|
|
471
501
|
<div
|
|
472
502
|
id={`service-card-${serviceItem.id}`}
|
|
473
503
|
className={`bg-white mx-auto relative ${
|
|
474
|
-
(hasOfferText
|
|
504
|
+
(hasOfferText && isNewUiEnabled) && !isSoldOut ||
|
|
505
|
+
hasDpEnabled
|
|
475
506
|
? "z-[3] rounded-[18px]"
|
|
476
507
|
: "rounded-[10px] border border-[#ccc]"
|
|
477
508
|
}`}
|
|
@@ -555,10 +586,6 @@ function ServiceItemPB({
|
|
|
555
586
|
isPeru={isPeru}
|
|
556
587
|
renderIcon={renderIcon}
|
|
557
588
|
discountSeatPriceColor={colors.discountSeatPriceColor}
|
|
558
|
-
isTrain={isTrain}
|
|
559
|
-
selectedSeatKey={selectedSeatKey}
|
|
560
|
-
onSeatSelect={handleSeatSelect}
|
|
561
|
-
topLabelColor={colors.topLabelColor}
|
|
562
589
|
/>
|
|
563
590
|
</div>
|
|
564
591
|
|
|
@@ -574,18 +601,6 @@ function ServiceItemPB({
|
|
|
574
601
|
soldOutIcon={renderIcon("soldOutIcon", "14px")}
|
|
575
602
|
onClick={checkMidnight}
|
|
576
603
|
/>
|
|
577
|
-
{showSeatSelectionError === serviceItem.id && isTrain && (
|
|
578
|
-
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
579
|
-
<div
|
|
580
|
-
className="text-[9px] text-center whitespace-nowrap"
|
|
581
|
-
style={{
|
|
582
|
-
color: colors.seatPriceColor,
|
|
583
|
-
}}
|
|
584
|
-
>
|
|
585
|
-
Selecciona el tipo de servicio
|
|
586
|
-
</div>
|
|
587
|
-
</div>
|
|
588
|
-
)}
|
|
589
604
|
{showLastSeats ? (
|
|
590
605
|
<div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
|
|
591
606
|
{serviceItem?.available_seats < 10 &&
|
|
@@ -632,7 +647,7 @@ function ServiceItemPB({
|
|
|
632
647
|
"grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
|
|
633
648
|
position: "relative",
|
|
634
649
|
zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
|
|
635
|
-
|
|
650
|
+
marginTop: isItemExpanded ? "" : "-10px",
|
|
636
651
|
}}
|
|
637
652
|
>
|
|
638
653
|
<div
|
|
@@ -640,9 +655,7 @@ function ServiceItemPB({
|
|
|
640
655
|
overflow: "hidden",
|
|
641
656
|
minHeight: 0,
|
|
642
657
|
marginTop:
|
|
643
|
-
|
|
644
|
-
? "-10px"
|
|
645
|
-
: "",
|
|
658
|
+
hasDpEnabled || serviceItem?.offer_text ? "" : "-10px",
|
|
646
659
|
...(hasOfferText || hasDpEnabled
|
|
647
660
|
? {
|
|
648
661
|
borderLeft: isSoldOut ? "" : "3px solid #ff5964",
|
|
@@ -663,7 +676,6 @@ function ServiceItemPB({
|
|
|
663
676
|
ladiesBookedSeats={serviceItem.ladies_booked_seats}
|
|
664
677
|
isDpEnabled={serviceItem.is_dp_enabled}
|
|
665
678
|
renderIcon={renderIcon}
|
|
666
|
-
operatorLabel={operatorLabel}
|
|
667
679
|
/>
|
|
668
680
|
</div>
|
|
669
681
|
</div>
|