kupos-ui-components-lib 9.9.2 → 9.9.3

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 (36) hide show
  1. package/dist/KuposUIComponent.d.ts +0 -3
  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 +12 -29
  6. package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
  7. package/dist/components/ServiceItem/ServiceItemMobile.js +17 -43
  8. package/dist/components/ServiceItem/mobileTypes.d.ts +1 -48
  9. package/dist/components/ServiceItem/types.d.ts +2 -27
  10. package/dist/styles.css +3 -215
  11. package/dist/ui/ExpendedDropDown/ExpandedDropdown.d.ts +2 -1
  12. package/dist/ui/ExpendedDropDown/ExpandedDropdown.js +5 -3
  13. package/dist/ui/OfferBanner.d.ts +0 -2
  14. package/dist/ui/OfferBanner.js +14 -19
  15. package/dist/ui/SeatSection/SeatSection.js +3 -3
  16. package/dist/ui/mobileweb/ExpandedDropdownMobile.js +1 -1
  17. package/dist/utils/CommonService.d.ts +0 -3
  18. package/dist/utils/CommonService.js +1 -18
  19. package/package.json +1 -1
  20. package/src/KuposUIComponent.tsx +0 -3
  21. package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +24 -35
  22. package/src/components/ServiceItem/ServiceItemDesktop.tsx +10 -65
  23. package/src/components/ServiceItem/ServiceItemMobile.tsx +288 -387
  24. package/src/components/ServiceItem/mobileTypes.ts +7 -50
  25. package/src/components/ServiceItem/types.ts +13 -39
  26. package/src/styles.css +0 -15
  27. package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +5 -3
  28. package/src/ui/OfferBanner.tsx +10 -31
  29. package/src/ui/SeatSection/SeatSection.tsx +3 -3
  30. package/src/ui/mobileweb/ExpandedDropdownMobile.tsx +1 -1
  31. package/src/utils/CommonService.ts +1 -26
  32. package/src/assets/images/anims/service_list/flame_anim.json +0 -1
  33. package/src/assets/images/anims/service_list/thunder_icon.json +0 -1
  34. package/src/assets/images/anims/service_list/users_anim.json +0 -1
  35. package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +0 -575
  36. package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +0 -610
@@ -14,9 +14,6 @@ declare const commonService: {
14
14
  discount_type?: string;
15
15
  discount_value?: number;
16
16
  max_discount?: number;
17
- discounts?: Array<{
18
- new_ui_enabled?: boolean;
19
- }>;
20
17
  }) => {
21
18
  originalPrice: number;
22
19
  discountedPrice: number;
@@ -275,7 +275,6 @@ const commonService = {
275
275
  return label.toLowerCase();
276
276
  },
277
277
  calculateDiscountedPrice: (originalPrice, serviceItem) => {
278
- var _a;
279
278
  const price = typeof originalPrice === "string"
280
279
  ? parseFloat(originalPrice)
281
280
  : originalPrice;
@@ -283,12 +282,6 @@ const commonService = {
283
282
  return { originalPrice: price, discountedPrice: price };
284
283
  }
285
284
  const { discount_type, discount_value, max_discount } = serviceItem;
286
- // Check if there's a discount with new_ui_enabled = true
287
- const newUiEnabled = (_a = serviceItem.discounts) === null || _a === void 0 ? void 0 : _a.some((d) => d.new_ui_enabled === true);
288
- // Only apply discount if new_ui_enabled is true OR if regular discount exists
289
- if (!newUiEnabled && (!discount_type || discount_value == null)) {
290
- return { originalPrice: price, discountedPrice: price };
291
- }
292
285
  const fixedDiscount = discount_type === "fixed" && discount_value != null ? discount_value : 0;
293
286
  const percentageDiscount = discount_type === "percentage" && discount_value != null
294
287
  ? (price * discount_value) / 100
@@ -303,14 +296,10 @@ const commonService = {
303
296
  startViewerCount: (node, viewersConfig) => {
304
297
  if (!node || !viewersConfig)
305
298
  return;
306
- const { min, max, interval = 5000 } = viewersConfig;
307
- const configKey = `${min}-${max}-${interval}`;
308
- if (node.dataset.viewerId && node.dataset.viewerConfig === configKey) {
309
- return;
310
- }
311
299
  const prevId = node.dataset.viewerId;
312
300
  if (prevId)
313
301
  clearInterval(Number(prevId));
302
+ const { min, max, interval = 5000 } = viewersConfig;
314
303
  const clamp = (v) => Math.min(max, Math.max(min, v));
315
304
  const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
316
305
  node.textContent = String(initialValue);
@@ -321,7 +310,6 @@ const commonService = {
321
310
  node.textContent = String(clamp(Math.round(next)));
322
311
  }, interval);
323
312
  node.dataset.viewerId = String(id);
324
- node.dataset.viewerConfig = configKey;
325
313
  },
326
314
  startCountdown: (node, countdownSeconds = 599) => {
327
315
  if (!node)
@@ -351,10 +339,6 @@ const commonService = {
351
339
  startComprandoCount: (node, min = 4, max = 16) => {
352
340
  if (!node)
353
341
  return;
354
- const configKey = `${min}-${max}`;
355
- if (node.dataset.comprandoId && node.dataset.comprandoConfig === configKey) {
356
- return;
357
- }
358
342
  const prevId = node.dataset.comprandoId;
359
343
  if (prevId)
360
344
  clearInterval(Number(prevId));
@@ -371,7 +355,6 @@ const commonService = {
371
355
  node.textContent = String(next);
372
356
  }, 5000); // Update every 5 seconds
373
357
  node.dataset.comprandoId = String(id);
374
- node.dataset.comprandoConfig = configKey;
375
358
  },
376
359
  };
377
360
  export default commonService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "9.9.2",
3
+ "version": "9.9.3",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,9 +32,6 @@ interface KuposUIComponentProps {
32
32
  orignLabel?: string;
33
33
  destinationLabel?: string;
34
34
  t?: (key: string) => string;
35
- ticketQuantity?: number;
36
- onIncreaseTicketQuantity?: (serviceItem: any) => void;
37
- onDecreaseTicketQuantity?: (serviceItem: any) => void;
38
35
 
39
36
  // New ServiceItem props
40
37
  id?: string;
@@ -67,7 +67,7 @@ function PeruServiceItemDesktop({
67
67
  isPeru,
68
68
  siteType,
69
69
  isAllinBus,
70
- isNewUiEnabled,
70
+ isFlores,
71
71
  t = (key: string) => key,
72
72
  }: ServiceItemProps & { currencySign?: string }): React.ReactElement {
73
73
  const animationMap: Record<string, Record<string, any>> = {
@@ -149,9 +149,8 @@ function PeruServiceItemDesktop({
149
149
  style={{
150
150
  filter: color === "white" ? "brightness(0) invert(1)" : "",
151
151
  }}
152
- className={`object-contain ${
153
- moreAnemities ? "w-[16px] h-[16px]" : "w-[16px] h-[16px]"
154
- }`}
152
+ className={`object-contain ${moreAnemities ? "w-[16px] h-[16px]" : "w-[16px] h-[16px]"
153
+ }`}
155
154
  />
156
155
  );
157
156
  };
@@ -262,9 +261,8 @@ function PeruServiceItemDesktop({
262
261
  SEAT_EXCEPTIONS.includes(val.label) ? null : (
263
262
  <span
264
263
  key={key}
265
- className={`flex items-center justify-between text-[13.33px] ${
266
- isSoldOut ? "text-[#c0c0c0]" : ""
267
- }`}
264
+ className={`flex items-center justify-between text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""
265
+ }`}
268
266
  >
269
267
  <div>
270
268
  <img
@@ -289,9 +287,8 @@ function PeruServiceItemDesktop({
289
287
  SEAT_EXCEPTIONS.includes(val.label) ? null : (
290
288
  <span
291
289
  key={key}
292
- className={`flex items-center justify-between text-[13.33px] ${
293
- isSoldOut ? "text-[#c0c0c0]" : ""
294
- }`}
290
+ className={`flex items-center justify-between text-[13.33px] ${isSoldOut ? "text-[#c0c0c0]" : ""
291
+ }`}
295
292
  >
296
293
  <div>
297
294
  <img
@@ -539,15 +536,13 @@ function PeruServiceItemDesktop({
539
536
 
540
537
  return (
541
538
  <div
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
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
548
543
  ? "mt-[24px]"
549
544
  : "mt-[20px]"
550
- } `}
545
+ } `}
551
546
  >
552
547
  <div
553
548
  className={"bg-white rounded-[20px] shadow-service mx-auto relative"}
@@ -588,9 +583,8 @@ function PeruServiceItemDesktop({
588
583
  <img
589
584
  src={serviceItem.operator_details[0]}
590
585
  alt="service logo"
591
- className={` h-auto object-contain ${
592
- isSoldOut ? "grayscale" : ""
593
- }`}
586
+ className={`h-auto object-contain ${isFlores ? "w-[80%]" : "w-full"
587
+ } ${isSoldOut ? "grayscale" : ""}`}
594
588
  />
595
589
  </div>
596
590
  {isCiva ? (
@@ -602,9 +596,8 @@ function PeruServiceItemDesktop({
602
596
 
603
597
  {/* DATE AND TIME - Grid Layout */}
604
598
  <div
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
- }`}
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
+ }`}
608
601
  style={{
609
602
  gridTemplateRows: "1fr",
610
603
  }}
@@ -621,9 +614,8 @@ function PeruServiceItemDesktop({
621
614
  <img
622
615
  src={serviceItem.icons?.origin}
623
616
  alt="origin"
624
- className={`w-[18px] h-auto mr-[8px] ${
625
- isSoldOut ? "grayscale" : ""
626
- }`}
617
+ className={`w-[18px] h-auto mr-[8px] ${isSoldOut ? "grayscale" : ""
618
+ }`}
627
619
  />
628
620
  </div>
629
621
  )}
@@ -638,9 +630,8 @@ function PeruServiceItemDesktop({
638
630
  <div className="h-[20px] flex items-center">
639
631
  <img
640
632
  src={serviceItem.icons?.destination}
641
- className={`w-[18px] h-auto mr-[8px] ${
642
- isSoldOut ? "grayscale" : ""
643
- }`}
633
+ className={`w-[18px] h-auto mr-[8px] ${isSoldOut ? "grayscale" : ""
634
+ }`}
644
635
  style={{ opacity: isSoldOut ? 0.5 : 1 }}
645
636
  />
646
637
  </div>
@@ -745,9 +736,8 @@ function PeruServiceItemDesktop({
745
736
  {/* SEATS */}
746
737
  <div className="content-center">
747
738
  <div
748
- className={`relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.5rem] ${
749
- getNumberOfSeats() < 3 ? "" : ""
750
- }`}
739
+ className={`relative flex gap-[10px] text-[13.33px] justify-between min-h-[2.5rem] ${getNumberOfSeats() < 3 ? "" : ""
740
+ }`}
751
741
  style={
752
742
  getNumberOfSeats() < 2
753
743
  ? { alignItems: "center" }
@@ -793,9 +783,8 @@ function PeruServiceItemDesktop({
793
783
  <button
794
784
  onClick={() => (!isSoldOut ? checkMidnight() : null)}
795
785
  disabled={serviceDetailsLoading}
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`}
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`}
799
788
  style={{
800
789
  backgroundColor:
801
790
  serviceDetailsLoading || isSoldOut
@@ -27,8 +27,6 @@ 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";
32
30
 
33
31
  import RatingBlock from "../../ui/RatingBlock";
34
32
  import DurationBlock from "../../ui/DurationBlock";
@@ -39,9 +37,6 @@ import KuposButton from "../../ui/KuposButton/KuposButton";
39
37
  import BottomAmenities from "../../ui/BottomAmenities/BottomAmenities";
40
38
  import SeatSection from "../../ui/SeatSection/SeatSection";
41
39
  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";
45
40
  import ServiceBadges from "../../ui/ServiceBadges/ServiceBadges";
46
41
 
47
42
  const SEAT_EXCEPTIONS = ["Asiento mascota"];
@@ -76,9 +71,6 @@ const ANIMATION_MAP: Record<string, Record<string, any>> = {
76
71
  bombAnimation: {
77
72
  kupos: bombAnimation,
78
73
  },
79
- thunderAnimation: {
80
- kupos: thunderAnimation,
81
- },
82
74
  dotAnimation: {
83
75
  kupos: dotAnimation,
84
76
  },
@@ -88,12 +80,6 @@ const ANIMATION_MAP: Record<string, Record<string, any>> = {
88
80
  femaaleAnimation: {
89
81
  kupos: femaleAnimation,
90
82
  },
91
- usersAnimation: {
92
- kupos: usersAnimation,
93
- },
94
- flameAnimation: {
95
- kupos: flameAnimation,
96
- },
97
83
  };
98
84
 
99
85
  function ServiceItemPB({
@@ -127,21 +113,11 @@ function ServiceItemPB({
127
113
  setIsExpand,
128
114
  coachKey,
129
115
  viewersConfig,
130
- isNewUi,
131
116
  showLoginModal,
132
117
  isLoggedIn,
133
118
  showLoginOption,
134
- isFeatureDropDownExpand,
135
- setIsFeatureDropDownExpand,
136
- ticketQuantity,
137
- onIncreaseTicketQuantity,
138
- onDecreaseTicketQuantity,
139
- onRemateUiButtonClick,
140
- selectedTimeSlot,
141
- onTimeSlotChange,
142
- isTimeDropdownOpen,
143
- onTimeDropdownToggle,
144
- wowDealData,
119
+ isFlores,
120
+ operatorLabel,
145
121
  }: ServiceItemProps & { currencySign?: string }): React.ReactElement {
146
122
  const getAnimationIcon = (icon: string) => {
147
123
  const animation = ANIMATION_MAP[icon];
@@ -204,7 +180,6 @@ function ServiceItemPB({
204
180
  const isItemExpanded = serviceItem.id === isExpand || isExpand === true;
205
181
  const grayscaleClass = isSoldOut ? "grayscale" : "";
206
182
  const hasOfferText = Boolean(serviceItem?.offer_text);
207
- const isNewUiEnabled = serviceItem?.discounts?.[0]?.new_ui_enabled === true;
208
183
 
209
184
  const seats = removeDuplicateSeats
210
185
  ? serviceItem.seat_types?.filter(
@@ -231,7 +206,7 @@ function ServiceItemPB({
231
206
  const offerGradient = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"} 0%, ${colors.leftGradiantColor || "#ff8842"} 100%)`;
232
207
  const offerGradientWithOpacity = `linear-gradient(90deg, ${colors.rightGradiantColor || "#ff5964"}80 0%, ${colors.leftGradiantColor || "#ff8842"}80 100%)`;
233
208
  const serviceCardStyle: React.CSSProperties =
234
- (hasOfferText && isNewUiEnabled) || hasDpEnabled
209
+ hasOfferText || hasDpEnabled
235
210
  ? {
236
211
  borderColor: "transparent",
237
212
  borderStyle: "solid",
@@ -441,37 +416,7 @@ function ServiceItemPB({
441
416
  isPeru={isPeru}
442
417
  siteType={siteType}
443
418
  isAllinBus={isAllinBus}
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}
419
+ isFlores={isFlores}
475
420
  />
476
421
  ) : (
477
422
  <div
@@ -494,15 +439,12 @@ function ServiceItemPB({
494
439
  viewersConfig={viewersConfig}
495
440
  getAnimationIcon={getAnimationIcon}
496
441
  showLoginOption={showLoginOption}
497
- isNewUiEnabled={isNewUiEnabled}
498
- colors={colors}
499
442
  />
500
443
  )}
501
444
  <div
502
445
  id={`service-card-${serviceItem.id}`}
503
446
  className={`bg-white mx-auto relative ${
504
- (hasOfferText && isNewUiEnabled) && !isSoldOut ||
505
- hasDpEnabled
447
+ (hasOfferText || hasDpEnabled) && !isSoldOut
506
448
  ? "z-[3] rounded-[18px]"
507
449
  : "rounded-[10px] border border-[#ccc]"
508
450
  }`}
@@ -647,7 +589,7 @@ function ServiceItemPB({
647
589
  "grid-template-rows 0.3s ease-in-out, opacity 0.25s ease-in-out",
648
590
  position: "relative",
649
591
  zIndex: hasOfferText || hasDpEnabled ? 0 : -1,
650
- marginTop: isItemExpanded ? "" : "-10px",
592
+ // marginTop: isItemExpanded ? "" : "-6px",
651
593
  }}
652
594
  >
653
595
  <div
@@ -655,7 +597,9 @@ function ServiceItemPB({
655
597
  overflow: "hidden",
656
598
  minHeight: 0,
657
599
  marginTop:
658
- hasDpEnabled || serviceItem?.offer_text ? "" : "-10px",
600
+ isItemExpanded && !(hasDpEnabled || serviceItem?.offer_text)
601
+ ? "-10px"
602
+ : "",
659
603
  ...(hasOfferText || hasDpEnabled
660
604
  ? {
661
605
  borderLeft: isSoldOut ? "" : "3px solid #ff5964",
@@ -676,6 +620,7 @@ function ServiceItemPB({
676
620
  ladiesBookedSeats={serviceItem.ladies_booked_seats}
677
621
  isDpEnabled={serviceItem.is_dp_enabled}
678
622
  renderIcon={renderIcon}
623
+ operatorLabel={operatorLabel}
679
624
  />
680
625
  </div>
681
626
  </div>