kupos-ui-components-lib 9.9.4 → 9.9.6

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 (42) 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 +156 -176
  4. package/dist/components/ServiceItem/ServiceItemDesktop.d.ts +1 -1
  5. package/dist/components/ServiceItem/ServiceItemDesktop.js +29 -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 -2
  9. package/dist/components/ServiceItem/types.d.ts +27 -8
  10. package/dist/styles.css +219 -16
  11. package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +1 -2
  12. package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +2 -4
  13. package/dist/ui/FeatureServiceUI/FeatureServiceUi.js +19 -4
  14. package/dist/ui/OfferBanner.d.ts +2 -0
  15. package/dist/ui/OfferBanner.js +22 -15
  16. package/dist/ui/SeatSection/SeatSection.d.ts +1 -7
  17. package/dist/ui/SeatSection/SeatSection.js +12 -41
  18. package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +1 -2
  19. package/dist/ui/mobileweb/DateTimeSectionMobile.js +5 -7
  20. package/dist/ui/mobileweb/SeatSectionMobile.d.ts +1 -2
  21. package/dist/ui/mobileweb/SeatSectionMobile.js +10 -15
  22. package/dist/utils/CommonService.d.ts +4 -1
  23. package/dist/utils/CommonService.js +19 -6
  24. package/package.json +1 -1
  25. package/src/KuposUIComponent.tsx +3 -0
  26. package/src/assets/images/anims/service_list/flame_anim.json +1 -0
  27. package/src/assets/images/anims/service_list/thunder_icon.json +1 -0
  28. package/src/assets/images/anims/service_list/users_anim.json +1 -0
  29. package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +404 -277
  30. package/src/components/ServiceItem/ServiceItemDesktop.tsx +71 -51
  31. package/src/components/ServiceItem/ServiceItemMobile.tsx +387 -290
  32. package/src/components/ServiceItem/mobileTypes.ts +50 -8
  33. package/src/components/ServiceItem/types.ts +32 -13
  34. package/src/styles.css +15 -0
  35. package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +2 -4
  36. package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +575 -0
  37. package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +634 -0
  38. package/src/ui/OfferBanner.tsx +71 -43
  39. package/src/ui/SeatSection/SeatSection.tsx +21 -86
  40. package/src/ui/mobileweb/DateTimeSectionMobile.tsx +33 -38
  41. package/src/ui/mobileweb/SeatSectionMobile.tsx +7 -12
  42. package/src/utils/CommonService.ts +27 -8
@@ -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,23 @@ 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,
134
+ isFeatureDropDownExpand,
135
+ setIsFeatureDropDownExpand,
136
+ ticketQuantity,
137
+ onIncreaseTicketQuantity,
138
+ onDecreaseTicketQuantity,
139
+ onRemateUiButtonClick,
140
+ selectedTimeSlot,
141
+ onTimeSlotChange,
142
+ isTimeDropdownOpen,
143
+ onTimeDropdownToggle,
144
+ wowDealData,
126
145
  isFlores,
127
- operatorLabel,
128
146
  }: 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
147
  const getAnimationIcon = (icon: string) => {
139
148
  const animation = ANIMATION_MAP[icon];
140
149
  if (!animation) return null;
@@ -196,6 +205,7 @@ function ServiceItemPB({
196
205
  const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
197
206
  const grayscaleClass = isSoldOut ? "grayscale" : "";
198
207
  const hasOfferText = Boolean(serviceItem?.offer_text);
208
+ const isNewUiEnabled = serviceItem?.discounts?.[0]?.new_ui_enabled === true;
199
209
 
200
210
  const seats = removeDuplicateSeats
201
211
  ? serviceItem.seat_types?.filter(
@@ -222,7 +232,7 @@ function ServiceItemPB({
222
232
  const offerGradient = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"} 0%, ${colors.leftGradiantColor || "#ff8842"} 100%)`;
223
233
  const offerGradientWithOpacity = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"}80 0%, ${colors.leftGradiantColor || "#ff8842"}80 100%)`;
224
234
  const serviceCardStyle: React.CSSProperties =
225
- hasOfferText || hasDpEnabled
235
+ (hasOfferText && isNewUiEnabled) || hasDpEnabled
226
236
  ? {
227
237
  borderColor: "transparent",
228
238
  borderStyle: "solid",
@@ -331,17 +341,6 @@ function ServiceItemPB({
331
341
  return;
332
342
  }
333
343
 
334
- if (isTrain) {
335
- if (!selectedSeatKey) {
336
- onShowSeatSelectionError?.(serviceItem.id);
337
- return;
338
- }
339
- if (onTrainButtonClick) {
340
- onTrainButtonClick();
341
- return;
342
- }
343
- }
344
-
345
344
  onBookButtonPress();
346
345
  };
347
346
 
@@ -443,7 +442,45 @@ function ServiceItemPB({
443
442
  isPeru={isPeru}
444
443
  siteType={siteType}
445
444
  isAllinBus={isAllinBus}
445
+ viewersConfig={viewersConfig}
446
+ isLoggedIn={isLoggedIn}
447
+ showLoginModal={showLoginModal}
448
+ isExpand={isExpand}
449
+ setIsExpand={setIsExpand}
450
+ coachKey={coachKey}
446
451
  isFlores={isFlores}
452
+ isNewUiEnabled={isNewUiEnabled}
453
+ showLoginOption={showLoginOption}
454
+ />
455
+ ) : isNewUi ? (
456
+ <FeatureServiceUi
457
+ serviceItem={serviceItem}
458
+ showTopLabel={showTopLabel}
459
+ isSoldOut={isSoldOut}
460
+ getAnimationIcon={getAnimationIcon}
461
+ cityOrigin={cityOrigin}
462
+ cityDestination={cityDestination}
463
+ renderIcon={renderIcon}
464
+ viewersConfig={viewersConfig}
465
+ isFeatureDropDownExpand={isFeatureDropDownExpand}
466
+ ticketQuantity={ticketQuantity}
467
+ onIncreaseTicketQuantity={onIncreaseTicketQuantity}
468
+ onDecreaseTicketQuantity={onDecreaseTicketQuantity}
469
+ onBookButtonPress={onRemateUiButtonClick}
470
+ onToggleExpand={() =>
471
+ setIsFeatureDropDownExpand &&
472
+ setIsFeatureDropDownExpand(
473
+ isFeatureDropDownExpand === serviceItem.id ||
474
+ isFeatureDropDownExpand === true
475
+ ? null
476
+ : serviceItem.id,
477
+ )
478
+ }
479
+ selectedTimeSlot={selectedTimeSlot}
480
+ onTimeSlotChange={onTimeSlotChange}
481
+ isTimeDropdownOpen={isTimeDropdownOpen}
482
+ onTimeDropdownToggle={onTimeDropdownToggle}
483
+ wowDealData={wowDealData}
447
484
  />
448
485
  ) : (
449
486
  <div
@@ -466,12 +503,14 @@ function ServiceItemPB({
466
503
  viewersConfig={viewersConfig}
467
504
  getAnimationIcon={getAnimationIcon}
468
505
  showLoginOption={showLoginOption}
506
+ isNewUiEnabled={isNewUiEnabled}
507
+ colors={colors}
469
508
  />
470
509
  )}
471
510
  <div
472
511
  id={`service-card-${serviceItem.id}`}
473
512
  className={`bg-white mx-auto relative ${
474
- (hasOfferText || hasDpEnabled) && !isSoldOut
513
+ (hasOfferText && isNewUiEnabled && !isSoldOut) || hasDpEnabled
475
514
  ? "z-[3] rounded-[18px]"
476
515
  : "rounded-[10px] border border-[#ccc]"
477
516
  }`}
@@ -555,10 +594,6 @@ function ServiceItemPB({
555
594
  isPeru={isPeru}
556
595
  renderIcon={renderIcon}
557
596
  discountSeatPriceColor={colors.discountSeatPriceColor}
558
- isTrain={isTrain}
559
- selectedSeatKey={selectedSeatKey}
560
- onSeatSelect={handleSeatSelect}
561
- topLabelColor={colors.topLabelColor}
562
597
  />
563
598
  </div>
564
599
 
@@ -574,18 +609,6 @@ function ServiceItemPB({
574
609
  soldOutIcon={renderIcon("soldOutIcon", "14px")}
575
610
  onClick={checkMidnight}
576
611
  />
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
612
  {showLastSeats ? (
590
613
  <div className="flex justify-center mr-[11px] w-[100%] right-[0px] absolute left-[0] top-[40px]">
591
614
  {serviceItem?.available_seats < 10 &&
@@ -632,7 +655,7 @@ function ServiceItemPB({
632
655
  "grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
633
656
  position: "relative",
634
657
  zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
635
- // marginTop: isItemExpanded ? "" : "-6px",
658
+ marginTop: isItemExpanded ? "" : "-10px",
636
659
  }}
637
660
  >
638
661
  <div
@@ -640,9 +663,7 @@ function ServiceItemPB({
640
663
  overflow: "hidden",
641
664
  minHeight: 0,
642
665
  marginTop:
643
- isItemExpanded && !(hasDpEnabled || serviceItem?.offer_text)
644
- ? "-10px"
645
- : "",
666
+ hasDpEnabled || serviceItem?.offer_text ? "" : "-10px",
646
667
  ...(hasOfferText || hasDpEnabled
647
668
  ? {
648
669
  borderLeft: isSoldOut ? "" : "3px solid #ff5964",
@@ -663,7 +684,6 @@ function ServiceItemPB({
663
684
  ladiesBookedSeats={serviceItem.ladies_booked_seats}
664
685
  isDpEnabled={serviceItem.is_dp_enabled}
665
686
  renderIcon={renderIcon}
666
- operatorLabel={operatorLabel}
667
687
  />
668
688
  </div>
669
689
  </div>