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.
Files changed (37) hide show
  1. package/dist/KuposUIComponent.d.ts +3 -0
  2. package/dist/components/ServiceItem/PeruServiceItemDesktop.d.ts +1 -1
  3. package/dist/components/ServiceItem/PeruServiceItemDesktop.js +2 -2
  4. package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
  5. package/dist/components/ServiceItem/ServiceItemDesktop.js +30 -31
  6. package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
  7. package/dist/components/ServiceItem/ServiceItemMobile.js +43 -17
  8. package/dist/components/ServiceItem/mobileTypes.d.ts +48 -1
  9. package/dist/components/ServiceItem/types.d.ts +27 -9
  10. package/dist/styles.css +215 -6
  11. package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +1 -2
  12. package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +2 -4
  13. package/dist/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.js +22 -41
  14. package/dist/ui/FeatureServiceUI/FeatureServiceUi.js +24 -44
  15. package/dist/ui/OfferBanner.d.ts +2 -0
  16. package/dist/ui/OfferBanner.js +19 -14
  17. package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
  18. package/dist/ui/SeatSection/SeatSection.js +12 -44
  19. package/dist/utils/CommonService.d.ts +3 -0
  20. package/dist/utils/CommonService.js +18 -1
  21. package/package.json +1 -1
  22. package/src/KuposUIComponent.tsx +3 -0
  23. package/src/assets/images/anims/service_list/flame_anim.json +1 -0
  24. package/src/assets/images/anims/service_list/thunder_icon.json +1 -0
  25. package/src/assets/images/anims/service_list/users_anim.json +1 -0
  26. package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +35 -24
  27. package/src/components/ServiceItem/ServiceItemDesktop.tsx +65 -53
  28. package/src/components/ServiceItem/ServiceItemMobile.tsx +387 -288
  29. package/src/components/ServiceItem/mobileTypes.ts +50 -7
  30. package/src/components/ServiceItem/types.ts +39 -25
  31. package/src/styles.css +15 -0
  32. package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +2 -4
  33. package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +575 -0
  34. package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +610 -0
  35. package/src/ui/OfferBanner.tsx +31 -10
  36. package/src/ui/SeatSection/SeatSection.tsx +21 -88
  37. package/src/utils/CommonService.ts +26 -1
@@ -67,7 +67,7 @@ function PeruServiceItemDesktop({
67
67
  isPeru,
68
68
  siteType,
69
69
  isAllinBus,
70
- isFlores,
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 ${moreAnemities ? "w-[16px] h-[16px]" : "w-[16px] h-[16px]"
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] ${isSoldOut ? "text-[#c0c0c0]" : ""
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] ${isSoldOut ? "text-[#c0c0c0]" : ""
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 ${serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"
540
- } ${serviceItem?.is_direct_trip ||
541
- serviceItem?.train_type_label === "Tren Express (Nuevo)" ||
542
- showTopLabel
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 ${isFlores ? "w-[80%]" : "w-full"
587
- } ${isSoldOut ? "grayscale" : ""}`}
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] ${isSoldOut ? "text-[#c0c0c0]" : ""
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] ${isSoldOut ? "grayscale" : ""
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] ${isSoldOut ? "grayscale" : ""
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] ${getNumberOfSeats() < 3 ? "" : ""
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 ${serviceDetailsLoading || isSoldOut ? "py-[12px]" : "py-[12px]"
787
- } text-[13.33px] font-bold text-white rounded-[10px] border-none px-[20px] flex items-center justify-center`}
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
- isTrain,
120
- selectedSeatKey,
121
- onSeatSelect,
122
- onTrainButtonClick,
123
- showSeatSelectionError,
124
- onShowSeatSelectionError,
125
- onClearSeatSelectionError,
126
- isFlores,
127
- operatorLabel,
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
- isFlores={isFlores}
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 || hasDpEnabled) && !isSoldOut
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
- // marginTop: isItemExpanded ? "" : "-6px",
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
- isItemExpanded && !(hasDpEnabled || serviceItem?.offer_text)
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>