kupos-ui-components-lib 9.2.10 → 9.3.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/styles.css CHANGED
@@ -27,14 +27,14 @@
27
27
  .-top-\[8px\] {
28
28
  top: calc(8px * -1);
29
29
  }
30
+ .-top-\[9px\] {
31
+ top: calc(9px * -1);
32
+ }
30
33
  .-top-\[11px\] {
31
34
  top: calc(11px * -1);
32
35
  }
33
- .-top-\[14px\] {
34
- top: calc(14px * -1);
35
- }
36
- .-top-\[16px\] {
37
- top: calc(16px * -1);
36
+ .-top-\[18px\] {
37
+ top: calc(18px * -1);
38
38
  }
39
39
  .top-\[2px\] {
40
40
  top: 2px;
@@ -54,9 +54,6 @@
54
54
  .top-\[88\%\] {
55
55
  top: 88%;
56
56
  }
57
- .right-\[0\] {
58
- right: 0;
59
- }
60
57
  .right-\[0px\] {
61
58
  right: 0px;
62
59
  }
@@ -123,6 +120,24 @@
123
120
  .z-\[1\] {
124
121
  z-index: 1;
125
122
  }
123
+ .col-span-2 {
124
+ grid-column: span 2 / span 2;
125
+ }
126
+ .col-start-1 {
127
+ grid-column-start: 1;
128
+ }
129
+ .col-start-2 {
130
+ grid-column-start: 2;
131
+ }
132
+ .row-start-1 {
133
+ grid-row-start: 1;
134
+ }
135
+ .row-start-2 {
136
+ grid-row-start: 2;
137
+ }
138
+ .row-start-3 {
139
+ grid-row-start: 3;
140
+ }
126
141
  .container {
127
142
  width: 100%;
128
143
  }
@@ -159,9 +174,6 @@
159
174
  .mt-\[13px\] {
160
175
  margin-top: 13px;
161
176
  }
162
- .mt-\[14px\] {
163
- margin-top: 14px;
164
- }
165
177
  .mt-\[15px\] {
166
178
  margin-top: 15px;
167
179
  }
@@ -240,9 +252,6 @@
240
252
  .ml-\[6px\] {
241
253
  margin-left: 6px;
242
254
  }
243
- .ml-\[8px\] {
244
- margin-left: 8px;
245
- }
246
255
  .ml-\[10px\] {
247
256
  margin-left: 10px;
248
257
  }
@@ -445,6 +454,9 @@
445
454
  .grid-cols-\[26px_auto_26\%_1fr\] {
446
455
  grid-template-columns: 26px auto 26% 1fr;
447
456
  }
457
+ .grid-cols-\[auto_auto\] {
458
+ grid-template-columns: auto auto;
459
+ }
448
460
  .flex-col {
449
461
  flex-direction: column;
450
462
  }
@@ -460,6 +472,9 @@
460
472
  .items-center {
461
473
  align-items: center;
462
474
  }
475
+ .items-end {
476
+ align-items: flex-end;
477
+ }
463
478
  .items-start {
464
479
  align-items: flex-start;
465
480
  }
@@ -472,6 +487,9 @@
472
487
  .justify-end {
473
488
  justify-content: flex-end;
474
489
  }
490
+ .justify-start {
491
+ justify-content: flex-start;
492
+ }
475
493
  .gap-\[1px\] {
476
494
  gap: 1px;
477
495
  }
@@ -509,6 +527,10 @@
509
527
  -moz-column-gap: 2%;
510
528
  column-gap: 2%;
511
529
  }
530
+ .gap-x-\[8px\] {
531
+ -moz-column-gap: 8px;
532
+ column-gap: 8px;
533
+ }
512
534
  .overflow-hidden {
513
535
  overflow: hidden;
514
536
  }
@@ -527,12 +549,18 @@
527
549
  .rounded-\[15px\] {
528
550
  border-radius: 15px;
529
551
  }
552
+ .rounded-\[18px\] {
553
+ border-radius: 18px;
554
+ }
530
555
  .rounded-\[20px\] {
531
556
  border-radius: 20px;
532
557
  }
533
558
  .rounded-\[38px\] {
534
559
  border-radius: 38px;
535
560
  }
561
+ .rounded-\[100px\] {
562
+ border-radius: 100px;
563
+ }
536
564
  .rounded-full {
537
565
  border-radius: calc(infinity * 1px);
538
566
  }
@@ -638,6 +666,9 @@
638
666
  .bg-\[\#ff8f45\] {
639
667
  background-color: #ff8f45;
640
668
  }
669
+ .bg-\[\#ff5964\] {
670
+ background-color: #ff5964;
671
+ }
641
672
  .bg-\[\#fff\] {
642
673
  background-color: #fff;
643
674
  }
@@ -678,6 +709,12 @@
678
709
  .p-\[30px_20px\] {
679
710
  padding: 30px 20px;
680
711
  }
712
+ .px-\[6px\] {
713
+ padding-inline: 6px;
714
+ }
715
+ .px-\[8px\] {
716
+ padding-inline: 8px;
717
+ }
681
718
  .px-\[10px\] {
682
719
  padding-inline: 10px;
683
720
  }
@@ -735,12 +772,15 @@
735
772
  .pt-\[50px\] {
736
773
  padding-top: 50px;
737
774
  }
738
- .pr-\[13px\] {
739
- padding-right: 13px;
740
- }
741
775
  .pr-\[15px\] {
742
776
  padding-right: 15px;
743
777
  }
778
+ .pr-\[20px\] {
779
+ padding-right: 20px;
780
+ }
781
+ .pr-\[22px\] {
782
+ padding-right: 22px;
783
+ }
744
784
  .pb-\[7px\] {
745
785
  padding-bottom: 7px;
746
786
  }
@@ -771,6 +811,9 @@
771
811
  .text-left {
772
812
  text-align: left;
773
813
  }
814
+ .text-right {
815
+ text-align: right;
816
+ }
774
817
  .text-\[10px\] {
775
818
  font-size: 10px;
776
819
  }
@@ -798,6 +841,12 @@
798
841
  .text-\[17px\] {
799
842
  font-size: 17px;
800
843
  }
844
+ .text-\[18px\] {
845
+ font-size: 18px;
846
+ }
847
+ .text-\[22px\] {
848
+ font-size: 22px;
849
+ }
801
850
  .text-\[42px\] {
802
851
  font-size: 42px;
803
852
  }
@@ -805,6 +854,22 @@
805
854
  --tw-leading: 1.3;
806
855
  line-height: 1.3;
807
856
  }
857
+ .leading-\[20px\] {
858
+ --tw-leading: 20px;
859
+ line-height: 20px;
860
+ }
861
+ .leading-\[22px\] {
862
+ --tw-leading: 22px;
863
+ line-height: 22px;
864
+ }
865
+ .leading-\[24px\] {
866
+ --tw-leading: 24px;
867
+ line-height: 24px;
868
+ }
869
+ .leading-\[30px\] {
870
+ --tw-leading: 30px;
871
+ line-height: 30px;
872
+ }
808
873
  .leading-none {
809
874
  --tw-leading: 1;
810
875
  line-height: 1;
@@ -830,15 +895,18 @@
830
895
  .whitespace-nowrap {
831
896
  white-space: nowrap;
832
897
  }
898
+ .text-\[\#9f9f9f\] {
899
+ color: #9f9f9f;
900
+ }
833
901
  .text-\[\#464647\] {
834
902
  color: #464647;
835
903
  }
836
- .text-\[\#bbb\] {
837
- color: #bbb;
838
- }
839
904
  .text-\[\#c0c0c0\] {
840
905
  color: #c0c0c0;
841
906
  }
907
+ .text-\[\#c2c2c2\] {
908
+ color: #c2c2c2;
909
+ }
842
910
  .text-\[\#ccc\] {
843
911
  color: #ccc;
844
912
  }
@@ -905,9 +973,6 @@
905
973
  --tw-outline-style: none;
906
974
  outline-style: none;
907
975
  }
908
- .\[rid-template-columns\:18\%_28\%_2\.5\%_28\%_15\.5\%\] {
909
- rid-template-columns: 18% 28% 2.5% 28% 15.5%;
910
- }
911
976
  .group-hover\:block {
912
977
  &:is(:where(.group):hover *) {
913
978
  @media (hover: hover) {
package/dist/types.d.ts CHANGED
@@ -105,6 +105,8 @@ export interface ServiceItemProps {
105
105
  wifiIcon?: string;
106
106
  cortinaIcon?: string;
107
107
  frazaIcon?: string;
108
+ specialDeparture?: string;
109
+ fireIcon?: string;
108
110
  [key: string]: string | Record<string, string | undefined> | undefined;
109
111
  };
110
112
  useLottieFor?: string[];
@@ -6,26 +6,12 @@ function ExpandedDropdown({ serviceItem, isPeru = false, translation = {}, getAn
6
6
  return (React.createElement("div", { className: "px-[15px] pt-[26px] pb-[14px] -mt-[16px] pt-[35px] relative -z-9", style: {
7
7
  backgroundColor: "#ffefef",
8
8
  borderRadius: "0 0 10px 10px",
9
- // border: showPromo ? `1px solid ${colors.priceColor}` : "1px solid #ccc",
10
- // border: `1px solid ${colors.priceColor}`,
11
- // borderTop: "none",
12
9
  } },
13
- React.createElement("div", { className: "flex flex-col gap-[10px] text-[13px] text-[#464647]", style: { lineHeight: 1.6 } },
14
- hasPetInfo && (React.createElement("div", { className: "flex items-center gap-[10px]" },
15
- React.createElement(LottiePlayer, { animationData: getAnimationIcon("petFriendlyAnim"), width: "20px", height: "20px" }),
16
- React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647] bold-text" },
17
- React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.petFriendly)))),
18
- React.createElement("div", { className: "flex gap-[8px] text-[13.33px]" },
19
- React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
20
- React.createElement("span", null,
21
- React.createElement("span", { className: "bold-text" }, "Pol\u00EDticas de anulaci\u00F3n:"),
22
- " Tu pasaje puede ser anulado de forma online",
23
- React.createElement("span", { className: "bold-text" }, " hasta 4 horas antes"),
24
- " antes de la salida del bus.")),
25
- isPeru ? null : isChangeTicket ? (React.createElement("div", { className: "flex gap-[8px]" },
10
+ React.createElement("div", { className: "flex flex-col gap-[6px] text-[13px] text-[#464647]", style: { lineHeight: 1.5 } },
11
+ isPeru ? null : isChangeTicket ? (React.createElement("div", { className: "flex gap-[8px]", style: { lineHeight: 1.5 } },
26
12
  React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
27
13
  React.createElement("span", null,
28
- React.createElement("span", { className: "bold-text" }, "Pol\u00EDticas de cambios:"),
14
+ React.createElement("span", { className: "bold-text" }, "Pasaje flexible:"),
29
15
  " Tu pasaje puede ser cambiado de manera online",
30
16
  " ",
31
17
  React.createElement("span", { className: "bold-text" },
@@ -37,7 +23,18 @@ function ExpandedDropdown({ serviceItem, isPeru = false, translation = {}, getAn
37
23
  React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
38
24
  React.createElement("span", null,
39
25
  React.createElement("span", null,
40
- React.createElement("span", { className: "bold-text" }, "Pol\u00EDtica de cambios:"),
41
- " Esta empresa no permite cambios de pasajes")))))));
26
+ React.createElement("span", { className: "bold-text" }, "Pasaje flexible:"),
27
+ " Esta empresa no permite cambios de pasajes.")))),
28
+ hasPetInfo && (React.createElement("div", { className: "flex items-center gap-[10px]" },
29
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("petFriendlyAnim"), width: "20px", height: "20px" }),
30
+ React.createElement("div", { className: "h-auto mr-[4px] text-[13px] text-[#464647] bold-text" },
31
+ React.createElement("span", null, translation === null || translation === void 0 ? void 0 : translation.petFriendly)))),
32
+ React.createElement("div", { className: "flex gap-[8px] text-[13.33px]" },
33
+ React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
34
+ React.createElement("span", null,
35
+ React.createElement("span", { className: "bold-text" }, "Pol\u00EDticas de anulaci\u00F3n:"),
36
+ " Tu pasaje puede ser anulado de forma online",
37
+ React.createElement("span", { className: "bold-text" }, " hasta 4 horas antes"),
38
+ " antes de la salida del bus.")))));
42
39
  }
43
40
  export default ExpandedDropdown;
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ declare const FeatureServiceUi: ({ serviceItem, showTopLabel, colors, isSoldOut, getAnimationIcon, cityOrigin, cityDestination, renderIcon, }: {
3
+ serviceItem: any;
4
+ showTopLabel: any;
5
+ colors: any;
6
+ isSoldOut: any;
7
+ getAnimationIcon: any;
8
+ cityOrigin: any;
9
+ cityDestination: any;
10
+ renderIcon: any;
11
+ }) => React.JSX.Element;
12
+ export default FeatureServiceUi;
@@ -0,0 +1,101 @@
1
+ import React from "react";
2
+ import LottiePlayer from "../../assets/LottiePlayer";
3
+ const HARDCODED_OPERATORS = [
4
+ {
5
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Turbus_logo.svg/320px-Turbus_logo.svg.png",
6
+ name: "Turbus",
7
+ },
8
+ {
9
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Pullman_Bus_logo.svg/320px-Pullman_Bus_logo.svg.png",
10
+ name: "Pullmanbus",
11
+ },
12
+ {
13
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Turbus_logo.svg/320px-Turbus_logo.svg.png",
14
+ name: "Expreso Santa C...",
15
+ },
16
+ ];
17
+ const HARDCODED_COUNTDOWN = "09:55";
18
+ const FeatureServiceUi = ({ serviceItem, showTopLabel, colors, isSoldOut, getAnimationIcon, cityOrigin, cityDestination, renderIcon, }) => {
19
+ var _a, _b, _c, _d, _e, _f, _g;
20
+ const operators = ((_a = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.operators) === null || _a === void 0 ? void 0 : _a.length) > 0
21
+ ? serviceItem.operators
22
+ : HARDCODED_OPERATORS;
23
+ return (React.createElement("div", { className: `relative ${serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"} ${(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_direct_trip) ||
24
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.train_type_label) === "Tren Express (Nuevo)" ||
25
+ showTopLabel
26
+ ? "mt-[24px]"
27
+ : "mt-[20px]"}` },
28
+ React.createElement("div", null,
29
+ React.createElement("div", { id: `service-card-${serviceItem.id}`, className: "bg-[#0C1421] text-white mx-auto relative rounded-[14px] p-[14px] text-[13.33px]" },
30
+ React.createElement("div", { className: "grid grid-cols-[1.3fr_2fr_1.2fr] gap-[16px] items-stretch" },
31
+ React.createElement("div", { className: "flex flex-col justify-between gap-[20px] py-[2px]" },
32
+ React.createElement("div", { className: "flex flex-col gap-[8px]" },
33
+ React.createElement("div", { className: "flex items-center gap-[8px]" },
34
+ React.createElement("img", { src: (_b = serviceItem.icons) === null || _b === void 0 ? void 0 : _b.whiteOrigin, alt: "origin", className: `w-[14px] h-[14px] shrink-0 ${isSoldOut ? "grayscale" : ""}` }),
35
+ React.createElement("span", { className: "text-[13px] bold-text" }, cityOrigin === null || cityOrigin === void 0 ? void 0 : cityOrigin.label.split(",")[0])),
36
+ React.createElement("div", { className: "flex items-center gap-[8px]" },
37
+ React.createElement("img", { src: (_c = serviceItem.icons) === null || _c === void 0 ? void 0 : _c.whiteDestination, alt: "destination", className: `w-[16px] h-[16px] shrink-0 ${isSoldOut ? "grayscale" : ""}`, style: { opacity: isSoldOut ? 0.5 : 1 } }),
38
+ React.createElement("span", { className: "text-[13px] bold-text" }, cityDestination === null || cityDestination === void 0 ? void 0 : cityDestination.label.split(",")[0]))),
39
+ React.createElement("div", { className: "flex flex-col gap-[8px]" },
40
+ React.createElement("div", { className: "flex items-center gap-[6px] rounded-[8px] px-[8px] py-[4px] w-fit mb-[6px]", style: {
41
+ border: "1px solid #363c48",
42
+ backgroundColor: "#1a202e",
43
+ } },
44
+ React.createElement("img", { src: (_d = serviceItem.icons) === null || _d === void 0 ? void 0 : _d.busIcon, alt: "bus", style: { width: "20px", height: "20px" } }),
45
+ React.createElement("span", { className: "text-[12px] whitespace-nowrap" }, "Salida flexible")),
46
+ React.createElement("div", { className: "text-[13px] bold-text whitespace-nowrap" }, "07:00 AM \u2013 10:00 AM"),
47
+ React.createElement("div", { className: "text-[12px] bold-text" }, "Vie, 04/11")),
48
+ React.createElement("div", { className: "flex items-start gap-[6px] text-[12px] " },
49
+ React.createElement("img", { src: (_e = serviceItem.icons) === null || _e === void 0 ? void 0 : _e.sheildIcon, alt: "shield", style: { width: "14px", height: "14px" } }),
50
+ React.createElement("span", null, "Tu asiento confirmado al instante."))),
51
+ React.createElement("div", { className: "px-[16px] flex flex-col items-center justify-between gap-[12px] py-[2px]" },
52
+ React.createElement("div", { className: "text-center" },
53
+ React.createElement("div", { className: "bold-text text-[14px]" }, "3 operadores compitiendo por tu compra"),
54
+ React.createElement("div", { className: "text-[12px] mt-[8px]" }, "Empresa a confirmar despu\u00E9s de tu pago")),
55
+ React.createElement("div", { className: "flex items-stretch justify-center gap-[8px] w-full mb-[16px]" }, operators.map((op, idx) => (React.createElement("div", { key: idx, className: "flex flex-col items-center justify-center gap-[8px] rounded-[8px]", style: {
56
+ width: "140px",
57
+ height: "80px",
58
+ border: "1px solid #363c48",
59
+ backgroundColor: "#1a202e",
60
+ } },
61
+ React.createElement("img", { src: serviceItem.operator_details[0], alt: op.name, className: `h-[24px] w-auto object-contain ${isSoldOut ? "grayscale" : ""}` }),
62
+ React.createElement("span", { className: "text-[11px] truncate max-w-full text-center" }, serviceItem.operator_details[2]))))),
63
+ React.createElement("div", { className: "flex items-center gap-[6px] text-[12px]" },
64
+ React.createElement("img", { src: (_f = serviceItem.icons) === null || _f === void 0 ? void 0 : _f.userIcon, alt: "eye", style: { width: "16px", height: "16px" } }),
65
+ React.createElement("span", null,
66
+ React.createElement("span", { className: "bold-text text-white" }, "50 personas"),
67
+ " ",
68
+ "est\u00E1n viendo este viaje"))),
69
+ React.createElement("div", { className: "flex flex-col justify-center gap-[12px] py-[2px] relative mb-[16px]" },
70
+ React.createElement("div", { className: "flex flex-col gap-[6px] ", style: {
71
+ alignItems: "center",
72
+ } },
73
+ React.createElement("span", { className: "text-[#FF8F45] bold-text text-[22px] leading-tight" }, "60% OFF"),
74
+ React.createElement("span", { className: "text-[#666] text-[14px] line-through" }, "$10.000"),
75
+ React.createElement("span", { className: "text-white bold-text text-[28px] leading-none" }, "$4.000")),
76
+ React.createElement("button", { className: "flex items-center gap-[6px] px-[20px] py-[10px] rounded-[12px] text-white bold-text text-[13px] mt-[4px] justify-center border-none cursor-pointer", style: {
77
+ backgroundColor: "#FF5C60",
78
+ } },
79
+ React.createElement(LottiePlayer
80
+ // animationData={serviceItem.icons.flexibleAnim}
81
+ , {
82
+ // animationData={serviceItem.icons.flexibleAnim}
83
+ animationData: getAnimationIcon("thunderAnimation"), width: "18px", height: "18px" }),
84
+ React.createElement("span", { className: "whitespace-nowrap" }, "\u00A1Lo quiero!"))),
85
+ React.createElement("div", { className: "absolute bottom-[11px] right-[18px]" },
86
+ React.createElement("img", { src: (_g = serviceItem.icons) === null || _g === void 0 ? void 0 : _g.downArrow, alt: "down arrow", style: {
87
+ width: "14px",
88
+ height: "8px",
89
+ filter: "brightness(0) invert(1)",
90
+ } }))))),
91
+ React.createElement("div", { className: "absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[15px] z-10 " },
92
+ React.createElement("div", { className: "flex items-center gap-[6px] py-[5px] px-[14px] rounded-[38px] text-[12.5px] bg-[#FF8F45] text-white whitespace-nowrap" },
93
+ React.createElement(LottiePlayer, { animationData: getAnimationIcon("bombAnimation"), width: "14px", height: "14px" }),
94
+ React.createElement("span", null,
95
+ React.createElement("strong", null, "Remate"),
96
+ " | Termina en",
97
+ " ",
98
+ React.createElement("strong", null, HARDCODED_COUNTDOWN),
99
+ " min")))));
100
+ };
101
+ export default FeatureServiceUi;
@@ -6,7 +6,7 @@ const RatingBlock = ({ showRating, serviceItem, isSoldOut, colors, t, translatio
6
6
  marginLeft: showRating ? "6px" : "0",
7
7
  color: isSoldOut ? "#c0c0c0" : "#464647",
8
8
  } },
9
- React.createElement("span", { className: "block max-w-[120px] overflow-hidden whitespace-nowrap cursor-pointer" }, serviceItem.operator_details[2]),
9
+ React.createElement("span", { className: `block max-w-[120px] cursor-pointer text-[12px] ${isPeru ? "overflow-hidden text-ellipsis whitespace-nowrap" : ""}` }, serviceItem.operator_details[2]),
10
10
  React.createElement("div", { className: "hidden group-hover:block absolute top-[24px] left-1/2 -translate-x-1/2 text-white p-3 rounded-[14px] whitespace-nowrap z-10 mt-2.5 w-max text-center shadow-service text-[12px]", style: { backgroundColor: colors.bottomStripColor, zIndex: "300" } },
11
11
  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.bottomStripColor } }),
12
12
  serviceItem.operator_details[2]))));
@@ -13,6 +13,7 @@ interface SeatSectionProps {
13
13
  removeDuplicateSeats?: boolean;
14
14
  isPeru?: boolean;
15
15
  serviceItem?: any;
16
+ renderIcon?: (iconKey: string, size?: string) => React.ReactNode;
16
17
  }
17
- declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, }: SeatSectionProps): React.ReactElement;
18
+ declare function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, }: SeatSectionProps): React.ReactElement;
18
19
  export default SeatSection;
@@ -54,7 +54,7 @@ function getUniqueSeats(seatTypes) {
54
54
  function getNumberOfSeats(seatTypes) {
55
55
  return seatTypes.filter((val) => !SEAT_EXCEPTIONS.includes(val.label)).length;
56
56
  }
57
- function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, }) {
57
+ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currencySign, removeDuplicateSeats, isPeru, serviceItem, renderIcon, }) {
58
58
  const uniqueSeats = getUniqueSeats(seatTypes);
59
59
  const sortedSeatTypes = getSortedSeatTypes(seatTypes);
60
60
  const numberOfSeats = getNumberOfSeats(seatTypes);
@@ -74,9 +74,8 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
74
74
  if (isPeru) {
75
75
  const allSeats = getAllSeatTypes(seatTypes);
76
76
  const lowestFare = allSeats.length > 0 ? allSeats[0].price : 0;
77
- const { originalPrice, discountedPrice } = CommonService.calculateDiscountedPrice(lowestFare, serviceItem);
77
+ const { discountedPrice } = CommonService.calculateDiscountedPrice(lowestFare, serviceItem);
78
78
  return (React.createElement(React.Fragment, null,
79
- originalPrice !== discountedPrice && (React.createElement("span", { className: "text-[13.33px]", style: strikethroughStyle }, formatPrice(originalPrice))),
80
79
  React.createElement("span", { className: "flex items-center text-[13.33px] bold-text" }, formatPrice(discountedPrice))));
81
80
  }
82
81
  if (removeDuplicateSeats) {
@@ -95,13 +94,16 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
95
94
  : null));
96
95
  });
97
96
  };
98
- const strikethroughStyle = Object.assign({ color: "#ccc", display: "flex", textAlign: "end", textDecoration: "line-through" }, (isPeru
99
- ? { position: "relative", top: 0 }
100
- : { position: "absolute", top: isCentered ? "-10px" : "-18px" }));
101
97
  const seats = removeDuplicateSeats ? uniqueSeats : sortedSeatTypes;
102
98
  const discountedSeats = seats.map((seat) => (Object.assign(Object.assign({}, seat), CommonService.calculateDiscountedPrice(seat.price, serviceItem))));
103
- const highestOriginalPrice = Math.max(...discountedSeats.map((seat) => seat.originalPrice));
104
99
  const hasDiscount = discountedSeats.some((seat) => seat.originalPrice !== seat.discountedPrice);
100
+ const discountSeat = discountedSeats
101
+ .filter((seat) => !SEAT_EXCEPTIONS.includes(seat.label))
102
+ .sort((a, b) => a.discountedPrice - b.discountedPrice)[0];
103
+ const discountValue = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_type) === "percentage" &&
104
+ typeof (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) === "number"
105
+ ? Math.round(serviceItem.discount_value)
106
+ : null;
105
107
  const renderLabels = () => {
106
108
  if (isPeru) {
107
109
  return (React.createElement(React.Fragment, null,
@@ -114,6 +116,22 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
114
116
  }
115
117
  return renderSeatNames();
116
118
  };
119
+ if (hasDiscount && discountSeat) {
120
+ return (React.createElement("div", { className: "grid items-center text-[13.33px] relative" },
121
+ React.createElement("div", { className: "col-start-1 row-start-2 flex items-center" },
122
+ React.createElement("span", { className: "text-[13.33px] font-normal leading-[22px] text-[#c2c2c2]" }, "Antes")),
123
+ React.createElement("div", { className: "col-start-1 row-start-3 flex h-[30px] items-end" },
124
+ React.createElement("span", { className: "text-[13.33px] font-normal leading-[24px] text-[#464647]" }, "Desde")),
125
+ React.createElement("div", { className: "col-start-2 row-start-1 flex items-center justify-center absolute", style: { top: "-22px", right: "30px" } }, discountValue != null && (React.createElement("span", { className: "rounded-[100px] bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white" },
126
+ discountValue,
127
+ "% OFF"))),
128
+ React.createElement("div", { className: "col-start-2 row-start-2 flex items-center justify-center ", style: { textAlign: "center" } },
129
+ React.createElement("span", { className: "text-[13.33px] font-normal leading-[20px] text-[#9f9f9f] line-through" }, formatPrice(discountSeat.originalPrice))),
130
+ React.createElement("div", { className: "col-start-2 row-start-3 flex h-[30px] items-end justify-start" },
131
+ React.createElement("span", { className: "flex items-center gap-[6px] text-[22px] bold-text leading-[30px]", style: { color: isSoldOut ? "#c0c0c0" : "#ff5964" } },
132
+ renderIcon("fireIcon", "16px"),
133
+ formatPrice(discountSeat.discountedPrice)))));
134
+ }
117
135
  return (React.createElement("div", { className: "relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.2rem]", style: isCentered ? { alignItems: "center" } : {} },
118
136
  React.createElement("div", { className: "flex flex-col justify-between", style: { gap: "10px" } }, renderLabels()),
119
137
  React.createElement("div", { className: "flex flex-col justify-between absolute inset-y-0 right-0 left-1/2 h-full", style: {
@@ -124,8 +142,6 @@ function SeatSection({ seatTypes, availableSeats, isSoldOut, priceColor, currenc
124
142
  right: 0,
125
143
  justifyContent: isCentered ? "center" : "",
126
144
  gap: "10px",
127
- } },
128
- hasDiscount && !isPeru && (React.createElement("span", { className: "text-[13.33px]", style: strikethroughStyle }, formatPrice(highestOriginalPrice))),
129
- renderSeatPrices())));
145
+ } }, renderSeatPrices())));
130
146
  }
131
147
  export default SeatSection;
@@ -7,6 +7,23 @@ function ExpandedDropdownMobile({ serviceItem, isPeru, petSeatInfo, petFriendlyA
7
7
  opacity: isSoldOut ? 0.5 : 1,
8
8
  } },
9
9
  React.createElement("div", { className: "flex flex-col gap-[8px] text-[11px] min-[420px]:text-[12px] text-[#464647]", style: { lineHeight: 1.6 } },
10
+ isPeru ? null : isChangeTicket ? (React.createElement("div", { className: "flex gap-[6px]" },
11
+ React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
12
+ React.createElement("span", null,
13
+ React.createElement("span", { className: "bold-text" }, "Pasaje flexible:"),
14
+ " Tu pasaje puede ser cambiado de manera online",
15
+ " ",
16
+ React.createElement("span", { className: "bold-text" },
17
+ "hasta ",
18
+ (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.change_ticket_hours) || 6,
19
+ " horas antes"),
20
+ " ",
21
+ "de la salida del bus. El monto ser\u00E1 reembolsado a tu billetera kupospay."))) : (React.createElement("div", { className: "flex gap-[8px] " },
22
+ React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
23
+ React.createElement("span", null,
24
+ React.createElement("span", null,
25
+ React.createElement("span", { className: "bold-text" }, "Pasaje flexible:"),
26
+ " Esta empresa no permite cambios de pasajes")))),
10
27
  petSeatInfo && Object.keys(petSeatInfo).length > 0 ? (React.createElement("div", { className: "flex items-center" },
11
28
  React.createElement("div", { className: `relative group cursor-default ` },
12
29
  React.createElement("div", { className: "flex items-center" },
@@ -24,23 +41,6 @@ function ExpandedDropdownMobile({ serviceItem, isPeru, petSeatInfo, petFriendlyA
24
41
  React.createElement("span", { className: "bold-text" }, "Pol\u00EDticas de anulaci\u00F3n:"),
25
42
  " Tu pasaje puede ser anulado de forma online",
26
43
  React.createElement("span", { className: "bold-text" }, " hasta 4 horas antes"),
27
- " antes de la salida del bus.")),
28
- isPeru ? null : isChangeTicket ? (React.createElement("div", { className: "flex gap-[6px]" },
29
- React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
30
- React.createElement("span", null,
31
- React.createElement("span", { className: "bold-text" }, "Pol\u00EDticas de cambios:"),
32
- " Tu pasaje puede ser cambiado de manera online",
33
- " ",
34
- React.createElement("span", { className: "bold-text" },
35
- "hasta ",
36
- (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.change_ticket_hours) || 6,
37
- " horas antes"),
38
- " ",
39
- "de la salida del bus. El monto ser\u00E1 reembolsado a tu billetera kupospay."))) : (React.createElement("div", { className: "flex gap-[8px] " },
40
- React.createElement("span", { style: { marginTop: "2px" } }, "\u2022"),
41
- React.createElement("span", null,
42
- React.createElement("span", null,
43
- React.createElement("span", { className: "bold-text" }, "Pol\u00EDtica de cambios:"),
44
- " Esta empresa no permite cambios de pasajes")))))));
44
+ " antes de la salida del bus.")))));
45
45
  }
46
46
  export default ExpandedDropdownMobile;
@@ -43,7 +43,7 @@ const getUniqueSeats = (data, limit) => {
43
43
  .slice(0, limit);
44
44
  };
45
45
  function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPriceColor, currencySign, availableSeats, removeDuplicateSeats, serviceItem, }) {
46
- var _a, _b, _c;
46
+ var _a, _b, _c, _d, _e;
47
47
  const hasMultipleTypes = ((_a = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.length) !== null && _a !== void 0 ? _a : 0) > 2;
48
48
  const getFare = (fare) => {
49
49
  if (removeDuplicateSeats && availableSeats <= 0 && !isPeru) {
@@ -59,10 +59,6 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
59
59
  return null;
60
60
  return filtered.reduce((min, item) => (item.fare < min ? item.fare : min), filtered[0].fare);
61
61
  };
62
- const getHighestFare = () => {
63
- var _a;
64
- return (((_a = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => !EXCEPTIONS.includes(item.label))) === null || _a === void 0 ? void 0 : _a.reduce((max, item) => (item.fare > max ? item.fare : max), 0)) || 0);
65
- };
66
62
  const renderPeruSeats = () => {
67
63
  const lowestFare = getLowestFare();
68
64
  if (lowestFare === null)
@@ -92,17 +88,29 @@ function SeatSectionMobile({ seatTypes: seatTypesData, isSoldOut, isPeru, seatPr
92
88
  ? getUniqueSeats(seatTypesData, 3)
93
89
  : (_c = (_b = seatTypesData === null || seatTypesData === void 0 ? void 0 : seatTypesData.filter((item) => getFilteredSeats(item.label))) === null || _b === void 0 ? void 0 : _b.sort((a, b) => a.fare - b.fare)) === null || _c === void 0 ? void 0 : _c.slice(0, 2);
94
90
  const discountedSeats = seats === null || seats === void 0 ? void 0 : seats.map((seat) => (Object.assign(Object.assign({}, seat), commonService.calculateDiscountedPrice(seat.fare, serviceItem))));
95
- const highestOriginalPrice = Math.max(...((discountedSeats === null || discountedSeats === void 0 ? void 0 : discountedSeats.map((s) => s.originalPrice)) || [0]));
96
91
  const hasDiscount = discountedSeats === null || discountedSeats === void 0 ? void 0 : discountedSeats.some((s) => s.originalPrice !== s.discountedPrice);
97
- return (React.createElement("div", { className: "content-center relative", style: { width: "40%" } },
98
- !isPeru && hasDiscount && (React.createElement("div", { className: "absolute -top-[16px] right-[0] flex justify-end" },
99
- React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] line-through", style: { color: "#bbb" } }, commonService.currency(highestOriginalPrice, currencySign)))),
100
- React.createElement("div", { className: "flex flex-col justify-between h-[2.5rem] ", style: {
101
- gap: isSoldOut ? "0px" : "5px",
102
- justifyContent: hasMultipleTypes ? "space-between" : "center",
103
- } },
104
- renderSeats(),
105
- isSoldOut ? (React.createElement("div", { className: "flex justify-end" },
106
- React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] text-[#ccc]" }, "Agotado"))) : null)));
92
+ const discountSeat = (_d = discountedSeats === null || discountedSeats === void 0 ? void 0 : discountedSeats.filter((seat) => !EXCEPTIONS.includes(seat.label))) === null || _d === void 0 ? void 0 : _d.sort((a, b) => a.discountedPrice - b.discountedPrice)[0];
93
+ const discountValue = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_type) === "percentage" &&
94
+ typeof (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) === "number"
95
+ ? Math.round(serviceItem.discount_value)
96
+ : null;
97
+ return (React.createElement("div", { className: "content-center relative", style: { width: "40%" } }, hasDiscount && discountSeat ? (React.createElement("div", { className: "relative grid grid-cols-[auto_auto] justify-between gap-x-[8px]" },
98
+ discountValue != null && (React.createElement("div", { className: "absolute -top-[18px] right-[0px]" },
99
+ React.createElement("span", { className: "rounded-[100px] px-[8px] text-[12px] bold-text leading-[20px] text-[#fff]", style: { backgroundColor: seatPriceColor } },
100
+ discountValue,
101
+ "% OFF"))),
102
+ React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] leading-[20px] text-[#c2c2c2]" }, "Antes"),
103
+ React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] leading-[20px] text-[#9f9f9f] line-through text-right" }, commonService.currency(discountSeat.originalPrice, currencySign)),
104
+ React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] leading-[24px]", style: { color: isSoldOut ? "#bbb" : "#464647" } }, "Desde"),
105
+ React.createElement("span", { className: "flex items-center justify-end gap-[4px] text-[14px] bold-text leading-[24px]", style: { color: isSoldOut ? "#bbb" : "#ff5964" } },
106
+ ((_e = serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.icons) === null || _e === void 0 ? void 0 : _e.fireIcon) ? (React.createElement("img", { src: serviceItem.icons.fireIcon, alt: "discount", className: "h-[16px] w-[16px] object-contain", style: { filter: isSoldOut ? "grayscale" : "" } })) : null,
107
+ commonService.currency(discountSeat.discountedPrice, currencySign)),
108
+ isSoldOut ? (React.createElement("span", { className: "col-span-2 min-[420]:text-[13px] text-right text-[12px] text-[#ccc]" }, "Agotado")) : null)) : (React.createElement("div", { className: "flex flex-col justify-between h-[2.5rem] ", style: {
109
+ gap: isSoldOut ? "0px" : "5px",
110
+ justifyContent: hasMultipleTypes ? "space-between" : "center",
111
+ } },
112
+ renderSeats(),
113
+ isSoldOut ? (React.createElement("div", { className: "flex justify-end" },
114
+ React.createElement("span", { className: "min-[420]:text-[13px] text-[12px] text-[#ccc]" }, "Agotado"))) : null))));
107
115
  }
108
116
  export default SeatSectionMobile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "9.2.10",
3
+ "version": "9.3.2",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"