kupos-ui-components-lib 9.9.3 → 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 (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 +43 -17
  8. package/dist/components/ServiceItem/mobileTypes.d.ts +48 -1
  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/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.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 +387 -288
  27. package/src/components/ServiceItem/mobileTypes.ts +50 -7
  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
  );
@@ -277,7 +277,7 @@ function SeatSection({
277
277
  {!isNaN(Number(dpDiscountPercent)) &&
278
278
  Number(dpDiscountPercent) > 0 && (
279
279
  <span
280
- className="rounded-[100px] bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white"
280
+ className={`rounded-[100px] ${discountSeatPriceColor} bg-[#ff5964] px-[6px] text-[12px] bold-text leading-[20px] text-white`}
281
281
  style={{
282
282
  animation: "pulse-zoom 2s ease-in-out infinite",
283
283
  whiteSpace: "nowrap",
@@ -319,7 +319,7 @@ function SeatSection({
319
319
  >
320
320
  <div
321
321
  className="absolute"
322
- style={{ left: isPeru ? "-19px" : "-19px", bottom: "1px" }}
322
+ style={{ left: isPeru ? "-1px" : "-19px", bottom: "1px" }}
323
323
  >
324
324
  {renderIcon("fireIcon", "16px")}
325
325
  </div>
@@ -476,7 +476,7 @@ function SeatSection({
476
476
  <div
477
477
  className="absolute"
478
478
  style={{
479
- left: isPeru ? "-18px" : "-18px",
479
+ left: isPeru ? "-1px" : "-18px",
480
480
  bottom: "1px",
481
481
  }}
482
482
  >
@@ -290,6 +290,9 @@ const commonService = {
290
290
  discount_type?: string;
291
291
  discount_value?: number;
292
292
  max_discount?: number;
293
+ discounts?: Array<{
294
+ new_ui_enabled?: boolean;
295
+ }>;
293
296
  },
294
297
  ): { originalPrice: number; discountedPrice: number } => {
295
298
  const price =
@@ -302,6 +305,16 @@ const commonService = {
302
305
  }
303
306
 
304
307
  const { discount_type, discount_value, max_discount } = serviceItem;
308
+ // Check if there's a discount with new_ui_enabled = true
309
+ const newUiEnabled = serviceItem.discounts?.some(
310
+ (d) => d.new_ui_enabled === true
311
+ );
312
+
313
+
314
+ // Only apply discount if new_ui_enabled is true OR if regular discount exists
315
+ if (!newUiEnabled && (!discount_type || discount_value == null)) {
316
+ return { originalPrice: price, discountedPrice: price };
317
+ }
305
318
 
306
319
  const fixedDiscount =
307
320
  discount_type === "fixed" && discount_value != null ? discount_value : 0;
@@ -329,10 +342,15 @@ const commonService = {
329
342
  ) => {
330
343
  if (!node || !viewersConfig) return;
331
344
 
345
+ const { min, max, interval = 5000 } = viewersConfig;
346
+ const configKey = `${min}-${max}-${interval}`;
347
+ if (node.dataset.viewerId && node.dataset.viewerConfig === configKey) {
348
+ return;
349
+ }
350
+
332
351
  const prevId = node.dataset.viewerId;
333
352
  if (prevId) clearInterval(Number(prevId));
334
353
 
335
- const { min, max, interval = 5000 } = viewersConfig;
336
354
  const clamp = (v: number) => Math.min(max, Math.max(min, v));
337
355
  const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
338
356
 
@@ -347,6 +365,7 @@ const commonService = {
347
365
  }, interval);
348
366
 
349
367
  node.dataset.viewerId = String(id);
368
+ node.dataset.viewerConfig = configKey;
350
369
  },
351
370
 
352
371
  startCountdown: (
@@ -388,6 +407,11 @@ const commonService = {
388
407
  ) => {
389
408
  if (!node) return;
390
409
 
410
+ const configKey = `${min}-${max}`;
411
+ if (node.dataset.comprandoId && node.dataset.comprandoConfig === configKey) {
412
+ return;
413
+ }
414
+
391
415
  const prevId = node.dataset.comprandoId;
392
416
  if (prevId) clearInterval(Number(prevId));
393
417
 
@@ -408,6 +432,7 @@ const commonService = {
408
432
  }, 5000); // Update every 5 seconds
409
433
 
410
434
  node.dataset.comprandoId = String(id);
435
+ node.dataset.comprandoConfig = configKey;
411
436
  },
412
437
  };
413
438