kupos-ui-components-lib 9.9.7 → 9.9.9

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 (35) 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 +28 -12
  6. package/dist/components/ServiceItem/ServiceItemMobile.d.ts +1 -1
  7. package/dist/components/ServiceItem/ServiceItemMobile.js +45 -17
  8. package/dist/components/ServiceItem/mobileTypes.d.ts +48 -0
  9. package/dist/components/ServiceItem/types.d.ts +27 -1
  10. package/dist/styles.css +219 -13
  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 +3 -10
  14. package/dist/ui/OfferBanner.d.ts +2 -0
  15. package/dist/ui/OfferBanner.js +22 -15
  16. package/dist/ui/SeatSection/SeatSection.js +3 -3
  17. package/dist/utils/CommonService.d.ts +3 -0
  18. package/dist/utils/CommonService.js +18 -1
  19. package/package.json +1 -1
  20. package/src/KuposUIComponent.tsx +3 -0
  21. package/src/assets/images/anims/service_list/flame_anim.json +1 -0
  22. package/src/assets/images/anims/service_list/thunder_icon.json +1 -0
  23. package/src/assets/images/anims/service_list/users_anim.json +1 -0
  24. package/src/components/ServiceItem/PeruServiceItemDesktop.tsx +404 -277
  25. package/src/components/ServiceItem/ServiceItemDesktop.tsx +71 -8
  26. package/src/components/ServiceItem/ServiceItemMobile.tsx +374 -271
  27. package/src/components/ServiceItem/mobileTypes.ts +48 -0
  28. package/src/components/ServiceItem/types.ts +32 -1
  29. package/src/styles.css +15 -0
  30. package/src/ui/ExpendedDropDown/ExpandedDropdown.tsx +2 -4
  31. package/src/ui/FeaturServiceUiMobile/FeatureServiceUiMobile.tsx +575 -0
  32. package/src/ui/FeatureServiceUI/FeatureServiceUi.tsx +634 -0
  33. package/src/ui/OfferBanner.tsx +71 -43
  34. package/src/ui/SeatSection/SeatSection.tsx +3 -3
  35. package/src/utils/CommonService.ts +26 -1
@@ -19,6 +19,8 @@ interface OfferBannerProps {
19
19
  viewersConfig: ServiceItemProps["viewersConfig"];
20
20
  getAnimationIcon: (name: string) => any;
21
21
  showLoginOption?: boolean;
22
+ isNewUiEnabled?: boolean;
23
+ colors: any;
22
24
  }
23
25
 
24
26
  const OfferBanner: React.FC<OfferBannerProps> = ({
@@ -31,12 +33,17 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
31
33
  viewersConfig,
32
34
  getAnimationIcon,
33
35
  showLoginOption,
36
+ isNewUiEnabled,
37
+ colors,
34
38
  }) => {
35
39
  return (
36
40
  <div
37
- className="text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[36px] pt-[50px] rounded-b-[14px] text-[14px]"
41
+ className="text-white p-[15px_15px] text-left w-full flex items-center absolute -bottom-[44px] pt-[50px] rounded-b-[14px] text-[14px] mt-[10px]"
38
42
  style={{
39
- background: offerGradient,
43
+ background:
44
+ serviceItem?.offer_text && !isNewUiEnabled
45
+ ? colors?.bottomStripColor
46
+ : offerGradient,
40
47
  opacity: isSoldOut ? 0.5 : 1,
41
48
  // zIndex: 0,
42
49
  }}
@@ -56,7 +63,7 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
56
63
  {/* starAnimation */}
57
64
  <span>Servicio popular entre los usuarios</span>
58
65
  </div>
59
- ) : (
66
+ ) : isNewUiEnabled && serviceItem?.offer_text ? (
60
67
  <div className="flex items-center">
61
68
  <LottiePlayer
62
69
  animationData={getAnimationIcon("bombAnimation")}
@@ -73,18 +80,14 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
73
80
  {(serviceItem?.offer_text || "").length > 30
74
81
  ? (serviceItem?.offer_text || "").slice(0, 30) + "..."
75
82
  : serviceItem?.offer_text || ""}{" "}
76
- {isLoggedIn && showLoginOption ? null : Object.keys(
77
- serviceItem?.dp_discount_percents ?? {},
78
- ).length > 0 ||
79
- (serviceItem?.dp_discounted_seats ?? []).length >
80
- 0 ? null : (
83
+ {isLoggedIn && showLoginOption ? null : (
81
84
  <span onClick={showLoginModal} className="cursor-pointer">
82
85
  - registro
83
86
  </span>
84
87
  )}{" "}
85
88
  &nbsp;
86
89
  </span>{" "}
87
- {serviceItem?.offer_text ? "| " : ""}
90
+ {serviceItem?.offer_text ? "|" : ""}
88
91
  Termina en&nbsp;
89
92
  <span
90
93
  className="bold-text text-end"
@@ -96,45 +99,70 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
96
99
  />
97
100
  </div>
98
101
  </div>
102
+ ) : (
103
+ serviceItem?.offer_text &&
104
+ !isNewUiEnabled && (
105
+ <div className="flex items-center">
106
+ <LottiePlayer
107
+ animationData={getAnimationIcon("promoAnim")}
108
+ width="18px"
109
+ height="18px"
110
+ />
111
+ <div className="flex items-center mt-[2px]">
112
+ <span
113
+ className="bold-text"
114
+ style={{
115
+ marginLeft: serviceItem?.offer_text ? "6px" : "3px",
116
+ }}
117
+ >
118
+ {serviceItem?.offer_text || ""}
119
+ </span>{" "}
120
+ </div>
121
+ </div>
122
+ )
99
123
  )}
100
124
  </div>
101
- <div className="flex items-center">
102
- {/* {renderIcon("personIcon", "16px")} */}
103
- <LottiePlayer
104
- animationData={getAnimationIcon("dotAnimation")}
105
- width="12px"
106
- height="12px"
107
- />
125
+ {(isNewUiEnabled || serviceItem?.is_dp_enabled) && (
126
+ <div className="flex items-center">
127
+ {/* {renderIcon("personIcon", "16px")} */}
128
+ <LottiePlayer
129
+ animationData={getAnimationIcon("dotAnimation")}
130
+ width="12px"
131
+ height="12px"
132
+ />
108
133
 
109
- <span className="ml-[6px]">
110
- <span
111
- className="bold-text"
112
- ref={(node) =>
113
- CommonService.startViewerCount(node, viewersConfig)
114
- }
115
- style={{ fontVariantNumeric: "tabular-nums" }}
116
- />{" "}
117
- {/* <span className="bold-text">personas</span>{" "} */}
118
- <span>
119
- {" "}
120
- {viewersConfig?.label || " viendo"} |{" "}
121
- <span className="">
122
- {serviceItem?.is_dp_enabled &&
123
- Object.keys(serviceItem?.dp_discount_percents ?? {}).length ===
124
- 0 &&
125
- (serviceItem?.dp_discounted_seats ?? []).length === 0
126
- ? null
127
- : "Quedan pocos • "}
128
- <span
129
- className="bold-text"
130
- ref={(node) => CommonService.startComprandoCount(node, 4, 16)}
131
- style={{ fontVariantNumeric: "tabular-nums" }}
132
- />{" "}
133
- comprando
134
+ <span className="ml-[6px]">
135
+ <span
136
+ className="bold-text"
137
+ ref={(node) =>
138
+ CommonService.startViewerCount(node, viewersConfig)
139
+ }
140
+ style={{ fontVariantNumeric: "tabular-nums" }}
141
+ />{" "}
142
+ {/* <span className="bold-text">personas</span>{" "} */}
143
+ <span>
144
+ {" "}
145
+ {viewersConfig?.label || " viendo"} |{" "}
146
+ <span className="">
147
+ {serviceItem?.is_dp_enabled &&
148
+ Object.keys(serviceItem?.dp_discount_percents ?? {})
149
+ .length === 0 &&
150
+ (serviceItem?.dp_discounted_seats ?? []).length === 0
151
+ ? null
152
+ : "Quedan pocos • "}
153
+ <span
154
+ className="bold-text"
155
+ ref={(node) =>
156
+ CommonService.startComprandoCount(node, 4, 16)
157
+ }
158
+ style={{ fontVariantNumeric: "tabular-nums" }}
159
+ />{" "}
160
+ comprando
161
+ </span>
134
162
  </span>
135
163
  </span>
136
- </span>
137
- </div>
164
+ </div>
165
+ )}
138
166
  </div>
139
167
  </div>
140
168
  );
@@ -342,7 +342,7 @@ function SeatSection({
342
342
  {!isNaN(Number(dpDiscountPercent)) &&
343
343
  Number(dpDiscountPercent) > 0 && (
344
344
  <span
345
- className="rounded-[100px] bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white"
345
+ className={`rounded-[100px] ${discountSeatPriceColor} bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white`}
346
346
  style={{
347
347
  animation: "pulse-zoom 2s ease-in-out infinite",
348
348
  whiteSpace: "nowrap",
@@ -384,7 +384,7 @@ function SeatSection({
384
384
  >
385
385
  <div
386
386
  className="absolute"
387
- style={{ left: isPeru ? "-19px" : "-19px", bottom: "1px" }}
387
+ style={{ left: isPeru ? "-1px" : "-19px", bottom: "1px" }}
388
388
  >
389
389
  {renderIcon("fireIcon", "16px")}
390
390
  </div>
@@ -541,7 +541,7 @@ function SeatSection({
541
541
  <div
542
542
  className="absolute"
543
543
  style={{
544
- left: isPeru ? "-18px" : "-18px",
544
+ left: isPeru ? "-1px" : "-18px",
545
545
  bottom: "1px",
546
546
  }}
547
547
  >
@@ -296,6 +296,9 @@ const commonService = {
296
296
  discount_type?: string;
297
297
  discount_value?: number;
298
298
  max_discount?: number;
299
+ discounts?: Array<{
300
+ new_ui_enabled?: boolean;
301
+ }>;
299
302
  },
300
303
  ): { originalPrice: number; discountedPrice: number } => {
301
304
  const price =
@@ -308,6 +311,16 @@ const commonService = {
308
311
  }
309
312
 
310
313
  const { discount_type, discount_value, max_discount } = serviceItem;
314
+ // Check if there's a discount with new_ui_enabled = true
315
+ const newUiEnabled = serviceItem.discounts?.some(
316
+ (d) => d.new_ui_enabled === true
317
+ );
318
+
319
+
320
+ // Only apply discount if new_ui_enabled is true OR if regular discount exists
321
+ if (!newUiEnabled && (!discount_type || discount_value == null)) {
322
+ return { originalPrice: price, discountedPrice: price };
323
+ }
311
324
 
312
325
  const fixedDiscount =
313
326
  discount_type === "fixed" && discount_value != null ? discount_value : 0;
@@ -335,10 +348,15 @@ const commonService = {
335
348
  ) => {
336
349
  if (!node || !viewersConfig) return;
337
350
 
351
+ const { min, max, interval = 5000 } = viewersConfig;
352
+ const configKey = `${min}-${max}-${interval}`;
353
+ if (node.dataset.viewerId && node.dataset.viewerConfig === configKey) {
354
+ return;
355
+ }
356
+
338
357
  const prevId = node.dataset.viewerId;
339
358
  if (prevId) clearInterval(Number(prevId));
340
359
 
341
- const { min, max, interval = 5000 } = viewersConfig;
342
360
  const clamp = (v: number) => Math.min(max, Math.max(min, v));
343
361
  const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
344
362
 
@@ -353,6 +371,7 @@ const commonService = {
353
371
  }, interval);
354
372
 
355
373
  node.dataset.viewerId = String(id);
374
+ node.dataset.viewerConfig = configKey;
356
375
  },
357
376
 
358
377
  startCountdown: (
@@ -394,6 +413,11 @@ const commonService = {
394
413
  ) => {
395
414
  if (!node) return;
396
415
 
416
+ const configKey = `${min}-${max}`;
417
+ if (node.dataset.comprandoId && node.dataset.comprandoConfig === configKey) {
418
+ return;
419
+ }
420
+
397
421
  const prevId = node.dataset.comprandoId;
398
422
  if (prevId) clearInterval(Number(prevId));
399
423
 
@@ -414,6 +438,7 @@ const commonService = {
414
438
  }, 5000); // Update every 5 seconds
415
439
 
416
440
  node.dataset.comprandoId = String(id);
441
+ node.dataset.comprandoConfig = configKey;
417
442
  },
418
443
  };
419
444