kupos-ui-components-lib 9.8.3 → 9.8.4

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.
@@ -0,0 +1,592 @@
1
+ import React from "react";
2
+ import LottiePlayer from "../../assets/LottiePlayer";
3
+ import commonService from "../../utils/CommonService";
4
+
5
+ const TIME_SLOTS = [
6
+ "Entre 07:00 AM y 10:00 AM",
7
+ "Entre 11:00 AM y 14:00 AM",
8
+ "Entre 15:00 PM y 18:00 PM",
9
+ "Entre 19:00 PM y 22:00 PM",
10
+ ];
11
+
12
+ const HARDCODED_OPERATORS = [
13
+ {
14
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Turbus_logo.svg/320px-Turbus_logo.svg.png",
15
+ name: "Turbus",
16
+ time: "7:00 am",
17
+ seatsAvailable: "3 disponibles",
18
+ },
19
+ {
20
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Pullman_Bus_logo.svg/320px-Pullman_Bus_logo.svg.png",
21
+ name: "Turbus",
22
+ time: "8:00 am",
23
+ seatsAvailable: "5 disponibles",
24
+ },
25
+ {
26
+ logo: "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4e/Turbus_logo.svg/320px-Turbus_logo.svg.png",
27
+ name: "Turbus",
28
+ time: "9:00 am",
29
+ seatsAvailable: "3 disponibles",
30
+ },
31
+ ];
32
+
33
+ const FeatureServiceUi = ({
34
+ serviceItem,
35
+ showTopLabel,
36
+ isSoldOut,
37
+ getAnimationIcon,
38
+ cityOrigin,
39
+ cityDestination,
40
+ renderIcon,
41
+ viewersConfig,
42
+ isFeatureDropDownExpand,
43
+ onToggleExpand,
44
+ ticketQuantity = 1,
45
+ onIncreaseTicketQuantity,
46
+ onDecreaseTicketQuantity,
47
+ onBookButtonPress,
48
+ selectedTimeSlot,
49
+ onTimeSlotChange,
50
+ isTimeDropdownOpen,
51
+ onTimeDropdownToggle,
52
+ wowDealData = undefined,
53
+ }) => {
54
+ // Use wow_deal data if available, otherwise fall back to serviceItem operators or hardcoded
55
+ const operators =
56
+ wowDealData?.operators?.length > 0
57
+ ? wowDealData.operators.map((op: any) => ({
58
+ logo: op.operator_logo_url,
59
+ name: op.operator_name,
60
+ time: op.starting_departure,
61
+ seatsAvailable: `${op.available_seats} disponibles`,
62
+ }))
63
+ : serviceItem?.operators?.length > 0
64
+ ? serviceItem.operators
65
+ : HARDCODED_OPERATORS;
66
+
67
+ // Use wow_deal pricing if available
68
+ const finalPrice = wowDealData?.final_price || 4000;
69
+ const originalPrice = wowDealData?.original_price || 10000;
70
+ const savingsPercent = wowDealData?.savings_percent || 60;
71
+ const operatorsCompetingCount = wowDealData?.operators_competing_count || 3;
72
+ const maxSeatsPerBooking = wowDealData?.max_seats_per_booking || 4;
73
+ const expiresAt = wowDealData?.expires_at;
74
+ const isPostPaymentAssignment = wowDealData?.is_post_payment_assignment;
75
+ const dealWindowFrom = wowDealData?.deal_window_from || "07:00";
76
+ const dealWindowTo = wowDealData?.deal_window_to || "10:00";
77
+ const travelDate = wowDealData?.travel_date;
78
+
79
+ // Calculate countdown seconds from expires_at ISO timestamp
80
+ const getCountdownSeconds = () => {
81
+ if (!expiresAt) return 599;
82
+ const expires = new Date(expiresAt).getTime();
83
+ const now = Date.now();
84
+ const seconds = Math.max(0, Math.floor((expires - now) / 1000));
85
+ return seconds;
86
+ };
87
+
88
+ // Generate time slot from deal window
89
+ const dynamicTimeSlot = `Entre ${dealWindowFrom} y ${dealWindowTo}`;
90
+ const displayTimeSlot = selectedTimeSlot || dynamicTimeSlot;
91
+
92
+ const isItemExpanded =
93
+ serviceItem.id === isFeatureDropDownExpand ||
94
+ isFeatureDropDownExpand === true;
95
+ const isThisTimeDropdownOpen = isTimeDropdownOpen === serviceItem.id;
96
+ const canDecreaseTicketQuantity = ticketQuantity > 1;
97
+
98
+ const HOW_IT_WORKS_STEPS = [
99
+ {
100
+ icon: "flexible",
101
+ name: "Salida flexible",
102
+ text: `Viajas en un horario entre las ${dealWindowFrom} y las ${dealWindowTo} del día elegido.`,
103
+ },
104
+ {
105
+ icon: "bus",
106
+ name: "Empresa asignada",
107
+ text: isPostPaymentAssignment
108
+ ? "Empresa y hora a confirmar luego del pago."
109
+ : "Una de las empresas confirmará tu viaje al instante tras el pago.",
110
+ },
111
+ {
112
+ icon: "price",
113
+ name: "Precio garantizado",
114
+ text: "Mejor precio garantizado. Sin cambios ni cancelación.",
115
+ },
116
+ {
117
+ icon: "ticket",
118
+ name: "¡Listo!",
119
+ text: "Recibe todos los detalles de tu viaje al instante tras la compra.",
120
+ },
121
+ ];
122
+
123
+ const FeatureStepIcon = ({ icon }) => {
124
+ switch (icon) {
125
+ case "flexible":
126
+ return renderIcon("flexibleIcon", "24px");
127
+ case "bus":
128
+ return renderIcon("empressaIcon", "24px");
129
+ case "price":
130
+ return renderIcon("precioIcon", "24px");
131
+ default:
132
+ return renderIcon("listoIcon", "24px");
133
+ }
134
+ };
135
+
136
+ return (
137
+ <div
138
+ // ${
139
+ // serviceItem.offer_text ? "mb-[55px]" : "mb-[10px]"
140
+ // }
141
+ className={`relative mb-[10px]
142
+ ${serviceItem?.is_direct_trip ||
143
+ serviceItem?.train_type_label === "Tren Express (Nuevo)" ||
144
+ showTopLabel
145
+ ? "mt-[24px]"
146
+ : "mt-[20px]"
147
+ }`}
148
+ >
149
+ <div
150
+ className="border border-[#ccc]"
151
+ style={{
152
+ // border: "0.6px solid #ccc",
153
+ padding: "14px",
154
+ borderRadius: "14px",
155
+ }}
156
+ >
157
+ <div className="flex justify-between items-center px-[14px] pb-[10px] text-[13.33px]">
158
+ <div className="flex items-center gap-[10px]">
159
+ <span>Salida flexible</span>
160
+ <div
161
+ className="bold-text font-[9px]"
162
+ style={{
163
+ backgroundColor: "#FF5C60",
164
+ padding: "5px 8px",
165
+ borderRadius: "10px",
166
+ color: "#fff",
167
+ animation: "pulse-zoom 2s ease-in-out infinite",
168
+ whiteSpace: "nowrap",
169
+ fontSize: "12px",
170
+ }}
171
+ >
172
+ <span>AHORRAS {savingsPercent}%</span>
173
+ </div>
174
+ </div>
175
+ <div className="flex items-center">
176
+ {/* {renderIcon("fireIcon", "14px")}{" "} */}
177
+ <div className="mb-[2px]">
178
+ <LottiePlayer
179
+ // animationData={serviceItem.icons.flexibleAnim}
180
+ animationData={getAnimationIcon("flameAnimation")}
181
+ width="18px"
182
+ height="18px"
183
+ />
184
+ </div>
185
+ <span className="bold-text">Remate</span>&nbsp;términa en{" "}
186
+ <span
187
+ className="bold-text text-end"
188
+ ref={(node) => commonService.startCountdown(node, getCountdownSeconds())}
189
+ style={{
190
+ fontVariantNumeric: "tabular-nums",
191
+ display: "inline-block",
192
+ color: "#FF5C60",
193
+ minWidth: "40px",
194
+ }}
195
+ />
196
+ </div>
197
+ </div>
198
+ <div
199
+ id={`service-card-${serviceItem.id}`}
200
+ className="bg-[#0C1421] text-white mx-auto relative rounded-[14px] p-[14px] text-[13.33px]"
201
+ >
202
+ <div className="grid grid-cols-[25%_48%_27%] items-stretch">
203
+ {/* LEFT: origin, destination, flexible, time, confirmed seat */}
204
+ <div className="flex flex-col justify-between gap-[20px] mb-[16px] pr-[22px]">
205
+ <div className="flex flex-col gap-[8px]">
206
+ <div className="flex items-center gap-[8px]">
207
+ <img
208
+ src={serviceItem.icons?.whiteOrigin}
209
+ alt="origin"
210
+ className={`w-[14px] h-[14px] shrink-0 ${isSoldOut ? "grayscale" : ""
211
+ }`}
212
+ />
213
+ <span className="text-[13px] bold-text">
214
+ {cityOrigin?.label.split(",")[0]}
215
+ </span>
216
+ </div>
217
+ <div className="flex items-center gap-[8px]">
218
+ <img
219
+ src={serviceItem.icons?.whiteDestination}
220
+ alt="destination"
221
+ className={`w-[14px] h-[14px] shrink-0 ${isSoldOut ? "grayscale" : ""
222
+ }`}
223
+ style={{ opacity: isSoldOut ? 0.5 : 1 }}
224
+ />
225
+ <span className="text-[13px] bold-text">
226
+ {cityDestination?.label.split(",")[0]}
227
+ </span>
228
+ </div>
229
+ </div>
230
+
231
+ <div className="flex flex-col gap-[8px]">
232
+ <div className="text-[12px] bold-text">
233
+ {travelDate ? new Date(travelDate).toLocaleDateString('es-CL', { weekday: 'long', day: 'numeric', month: 'long' }) : 'Viernes 23 de mayo'}
234
+ </div>
235
+
236
+ <div
237
+ className="kupos-time-dd relative"
238
+ tabIndex={0}
239
+ onBlur={(e) => {
240
+ if (!e.currentTarget.contains(e.relatedTarget as Node)) {
241
+ onTimeDropdownToggle?.(null);
242
+ }
243
+ }}
244
+ style={{ outline: "none" }}
245
+ >
246
+ <button
247
+ type="button"
248
+ onClick={() =>
249
+ onTimeDropdownToggle?.(
250
+ isThisTimeDropdownOpen ? null : serviceItem.id,
251
+ )
252
+ }
253
+ className="flex whitespace-nowrap cursor-pointer select-none items-center gap-[6px] border-none bg-transparent p-0 bold-text text-[12px] text-[white]"
254
+ >
255
+ <span>{displayTimeSlot}</span>
256
+ <img
257
+ src={serviceItem?.icons?.downArrow}
258
+ alt="down arrow"
259
+ className={`kupos-time-chevron transition-transform duration-200 ${isThisTimeDropdownOpen ? "rotate-180" : "rotate-0"}`}
260
+ style={{
261
+ width: "12px",
262
+ height: "8px",
263
+ filter: "brightness(0) invert(1)",
264
+ }}
265
+ />
266
+ </button>
267
+ {isThisTimeDropdownOpen && (
268
+ <>
269
+ <div
270
+ className="absolute left-0 top-[calc(100%+10px)]"
271
+ style={{
272
+ zIndex: 20,
273
+ backgroundColor: "#fff",
274
+ borderRadius: "14px",
275
+ minWidth: "190px",
276
+ boxShadow: "0 8px 32px rgba(0,0,0,0.28)",
277
+ overflow: "hidden",
278
+ padding: "6px 0",
279
+ }}
280
+ >
281
+ {TIME_SLOTS.map((slot) => {
282
+ const isActive = slot === selectedTimeSlot;
283
+ return (
284
+ <button
285
+ key={slot}
286
+ type="button"
287
+ onClick={() => {
288
+ onTimeSlotChange?.(slot);
289
+ onTimeDropdownToggle?.(null);
290
+ }}
291
+ className={`flex w-full cursor-pointer items-center gap-[10px] border-none px-[12px] py-[9px] text-left text-[13px] ${isActive ? "bg-[#FF5C60] font-bold text-[white]" : "bg-transparent font-normal text-[#1a1a1a]"}`}
292
+ >
293
+ <span>{slot}</span>
294
+ </button>
295
+ );
296
+ })}
297
+ </div>
298
+ </>
299
+ )}
300
+ </div>
301
+ {/* <div className="text-[12px] bold-text whitespace-nowrap">
302
+ Entre 07:00 AM y 10:00 AM
303
+ </div> */}
304
+ </div>
305
+
306
+ <div className="flex flex-col items-start gap-[10px] text-[12px] ">
307
+ <div className="flex items-justify gap-[8px]">
308
+ {renderIcon("sheildIcon", "16px")}
309
+
310
+ <span
311
+ className="text-[11px]"
312
+ style={{
313
+ lineHeight: 1.3,
314
+ }}
315
+ >
316
+ Empresa y hora a confirmar luego del pago.
317
+ </span>
318
+ </div>
319
+ <div className="flex items-justify gap-[8px]">
320
+ {renderIcon("confirmarIcon", "16px")}
321
+
322
+ <span
323
+ className="text-[11px]"
324
+ style={{
325
+ lineHeight: 1.3,
326
+ }}
327
+ >
328
+ Tu compra está 100% asegurada.
329
+ </span>
330
+ </div>
331
+ </div>
332
+ </div>
333
+
334
+ {/* MIDDLE: competing operators + viewers */}
335
+ <div className="min-w-0 px-[22px] flex flex-col items-center justify-between gap-[16px] py-[2px] border-r border-[#363c48] border-l border-[#363c48]">
336
+ <div className="text-center">
337
+ <div className="bold-text text-[14px]">
338
+ {operatorsCompetingCount} operadores compitiendo
339
+ <br /> por tu compra
340
+ </div>
341
+ </div>
342
+
343
+ <div className="grid w-full grid-cols-3 items-stretch gap-[14px] ">
344
+ {operators.map((op, idx) => (
345
+ <div
346
+ key={idx}
347
+ className="flex min-w-0 flex-col items-center justify-center gap-[8px] rounded-[8px]"
348
+ style={{
349
+ // height: "80px",
350
+ border: "1px solid #363c48",
351
+ backgroundColor: "#1a202e",
352
+ padding: "14px 10px",
353
+ }}
354
+ >
355
+ <img
356
+ src={op.logo}
357
+ alt={op.name}
358
+ onError={(e) => {
359
+ e.currentTarget.src = serviceItem?.operator_details?.[0] || "/images/service-list/bus-icon.svg";
360
+ }}
361
+ className={`h-[24px] max-w-full object-contain ${isSoldOut ? "grayscale" : ""
362
+ }`}
363
+ />
364
+ <span className="text-[11px] truncate max-w-full text-center">
365
+ {op.name}
366
+ </span>
367
+ <div className="bg-[#FF8F45] text-white text-[12px] font-bold px-[10px] py-[4px] rounded-[4px] bold-text whitespace-nowrap">
368
+ <span>{op?.time}</span>
369
+ </div>
370
+ <span className="text-[10px] mt-[6px]">
371
+ {op?.seatsAvailable}
372
+ </span>
373
+ </div>
374
+ ))}
375
+ </div>
376
+
377
+ <div
378
+ className="flex w-full items-center justify-center gap-[6px] text-[12px]"
379
+ style={{
380
+ padding: "8px 14px",
381
+ marginBottom: "6px",
382
+ }}
383
+ >
384
+ <LottiePlayer
385
+ // animationData={serviceItem.icons.flexibleAnim}
386
+ animationData={getAnimationIcon("usersAnimation")}
387
+ width="18px"
388
+ height="18px"
389
+ />
390
+ <span className="text-[13px]">
391
+ <span className="bold-text text-white">
392
+ <span
393
+ className="bold-text"
394
+ ref={(node) =>
395
+ commonService.startViewerCount(node, viewersConfig)
396
+ }
397
+ style={{
398
+ fontVariantNumeric: "tabular-nums",
399
+ color: "#FF5C60",
400
+ }}
401
+ />{" "}
402
+ </span>
403
+
404
+ <span style={{ color: "#FF5C60" }}>viendo</span> |{" "}
405
+
406
+ <span
407
+ className="bold-text"
408
+ ref={(node) =>
409
+ commonService.startComprandoCount(node, 4, 16)
410
+ }
411
+ style={{ fontVariantNumeric: "tabular-nums" }}
412
+ />{" "}
413
+ han comprado
414
+ </span>
415
+ </div>
416
+ </div>
417
+
418
+ {/* RIGHT: price + button */}
419
+ <div className="flex flex-col justify-center gap-[12px] py-[2px] pl-[22px] pr-[10px] relative mb-[16px]">
420
+ <div
421
+ className="flex flex-col gap-[6px] "
422
+ style={{
423
+ alignItems: "center",
424
+ }}
425
+ >
426
+ <span
427
+ className="text-[#FF8F45] bold-text text-[26px] leading-tight"
428
+ style={{
429
+ animation: "pulse-zoom 2s ease-in-out infinite",
430
+ whiteSpace: "nowrap",
431
+ }}
432
+ >
433
+ {savingsPercent}% OFF
434
+ </span>
435
+ {/* <span className="text-[#666] text-[14px] line-through">
436
+ $10.000
437
+ </span> */}
438
+ <span
439
+ className="text-[13.33px] font-normal leading-[20px] text-[#9f9f9f] relative"
440
+ style={{ position: "relative" }}
441
+ >
442
+ ${originalPrice.toLocaleString()}
443
+ <span
444
+ style={{
445
+ position: "absolute",
446
+ left: "-2px",
447
+ top: "50%",
448
+ width: "calc(100% + 4px)",
449
+ height: "1px",
450
+
451
+ backgroundColor: "#FF5C60",
452
+
453
+ transform: "rotate(-10deg)",
454
+ transformOrigin: "center",
455
+ }}
456
+ />
457
+ </span>
458
+ <span className="text-white bold-text text-[28px] leading-none">
459
+ {`$${(finalPrice * ticketQuantity).toLocaleString()}`}
460
+ </span>
461
+ </div>
462
+
463
+ <div className="mt-[4px] flex flex-col items-center gap-[8px]">
464
+ <span className="text-[12px] text-white">
465
+ ¿Cuántos pasajes quieres?
466
+ </span>
467
+ <div
468
+ className="flex w-full items-center justify-between rounded-[16px] "
469
+ style={{
470
+ border: "1px solid #363c48",
471
+ backgroundColor: "#1a202e",
472
+ padding: "4px 14px",
473
+ }}
474
+ >
475
+ <button
476
+ type="button"
477
+ aria-label="Disminuir pasajes"
478
+ disabled={!canDecreaseTicketQuantity}
479
+ onClick={() => onDecreaseTicketQuantity?.(serviceItem)}
480
+ className={`flex h-[26px] w-[26px] items-center justify-center rounded-full border-none text-[16px] leading-none text-white ${canDecreaseTicketQuantity
481
+ ? "cursor-pointer bg-[#2d374d]"
482
+ : "cursor-not-allowed bg-[#222b3d] opacity-50"
483
+ }`}
484
+ >
485
+ -
486
+ </button>
487
+ <span className="bold-text text-[14px] text-white">
488
+ {ticketQuantity}
489
+ </span>
490
+ <button
491
+ type="button"
492
+ aria-label="Aumentar pasajes"
493
+ onClick={() => onIncreaseTicketQuantity?.(serviceItem)}
494
+ className="flex h-[26px] w-[26px] cursor-pointer items-center justify-center rounded-full border-none bg-[#2d374d] text-[16px] leading-none text-white"
495
+ >
496
+ +
497
+ </button>
498
+ </div>
499
+ </div>
500
+
501
+ <button
502
+ type="button"
503
+ onClick={onBookButtonPress}
504
+ className="flex items-center gap-[6px] px-[20px] py-[10px] rounded-[16px] text-white bold-text text-[13px] mt-[4px] justify-center border-none cursor-pointer text-center"
505
+ style={{
506
+ backgroundColor: "#FF5C60",
507
+ whiteSpace: "nowrap",
508
+ }}
509
+ >
510
+ <LottiePlayer
511
+ // animationData={serviceItem.icons.flexibleAnim}
512
+ animationData={getAnimationIcon("thunderAnimation")}
513
+ width="16px"
514
+ height="16px"
515
+ />
516
+ <span className="whitespace-nowrap">¡Lo quiero!</span>
517
+ </button>
518
+ </div>
519
+
520
+ <div
521
+ className={`absolute bottom-[11px] right-[18px] cursor-pointer transition-transform duration-300 ease-in-out ${isItemExpanded ? "rotate-180" : ""}`}
522
+ onClick={onToggleExpand}
523
+ >
524
+ <img
525
+ src={serviceItem.icons?.downArrow}
526
+ alt="down arrow"
527
+ style={{
528
+ width: "14px",
529
+ height: "8px",
530
+ filter: "brightness(0) invert(1)",
531
+ }}
532
+ />
533
+ </div>
534
+ </div>
535
+ </div>
536
+ <div
537
+ className="grid"
538
+ style={{
539
+ gridTemplateRows: isItemExpanded ? "1fr" : "0fr",
540
+ opacity: isItemExpanded ? 1 : 0,
541
+ transition:
542
+ "grid-template-rows 300ms ease-in-out, opacity 250ms ease-in-out",
543
+ }}
544
+ >
545
+ <div
546
+ className={`min-h-0 overflow-hidden px-[16px] text-[13.33px] ${isItemExpanded ? "pt-[14px] pb-[6px]" : "py-0"
547
+ }`}
548
+ style={{ transition: "padding 300ms ease-in-out" }}
549
+ >
550
+ <span className="bold-text">¿Cómo funciona?</span>
551
+
552
+ <div className="mt-[14px] grid grid-cols-4 gap-[20px] px-[16px] ">
553
+ {HOW_IT_WORKS_STEPS.map((step) => (
554
+ <div
555
+ key={step.name}
556
+ className="flex flex-col items-center text-center text-[#272727]"
557
+ >
558
+ <FeatureStepIcon icon={step.icon} />
559
+ <span className="bold-text mt-[10px] text-[12px] leading-[14px]">
560
+ {step.name}
561
+ </span>
562
+ <span className="mt-[2px] max-w-[220px] text-[12px] leading-[14px] text-[#4a4a4a]">
563
+ {step.text}
564
+ </span>
565
+ </div>
566
+ ))}
567
+ </div>
568
+ </div>
569
+ </div>
570
+ </div>
571
+
572
+ {/* TOP BADGE — "Remate | Termina en 09:55 min" hardcoded, no countdown hook */}
573
+ {/* {showTopLabel && (
574
+ <div className="absolute -top-[11px] left-0 w-full flex items-center justify-end gap-[12px] pr-[15px] z-10 ">
575
+ <div className="flex items-center gap-[6px] py-[5px] px-[14px] rounded-[38px] text-[12.5px] bg-[#FF8F45] text-white whitespace-nowrap">
576
+ <LottiePlayer
577
+ animationData={getAnimationIcon("bombAnimation")}
578
+ width="14px"
579
+ height="14px"
580
+ />
581
+ <span>
582
+ <strong>Remate</strong> | Termina en{" "}
583
+ <strong>{HARDCODED_COUNTDOWN}</strong> min
584
+ </span>
585
+ </div>
586
+ </div>
587
+ )} */}
588
+ </div>
589
+ );
590
+ };
591
+
592
+ export default FeatureServiceUi;
@@ -329,10 +329,15 @@ const commonService = {
329
329
  ) => {
330
330
  if (!node || !viewersConfig) return;
331
331
 
332
+ const { min, max, interval = 5000 } = viewersConfig;
333
+ const configKey = `${min}-${max}-${interval}`;
334
+ if (node.dataset.viewerId && node.dataset.viewerConfig === configKey) {
335
+ return;
336
+ }
337
+
332
338
  const prevId = node.dataset.viewerId;
333
339
  if (prevId) clearInterval(Number(prevId));
334
340
 
335
- const { min, max, interval = 5000 } = viewersConfig;
336
341
  const clamp = (v: number) => Math.min(max, Math.max(min, v));
337
342
  const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
338
343
 
@@ -347,6 +352,7 @@ const commonService = {
347
352
  }, interval);
348
353
 
349
354
  node.dataset.viewerId = String(id);
355
+ node.dataset.viewerConfig = configKey;
350
356
  },
351
357
 
352
358
  startCountdown: (
@@ -388,6 +394,11 @@ const commonService = {
388
394
  ) => {
389
395
  if (!node) return;
390
396
 
397
+ const configKey = `${min}-${max}`;
398
+ if (node.dataset.comprandoId && node.dataset.comprandoConfig === configKey) {
399
+ return;
400
+ }
401
+
391
402
  const prevId = node.dataset.comprandoId;
392
403
  if (prevId) clearInterval(Number(prevId));
393
404
 
@@ -408,6 +419,7 @@ const commonService = {
408
419
  }, 5000); // Update every 5 seconds
409
420
 
410
421
  node.dataset.comprandoId = String(id);
422
+ node.dataset.comprandoConfig = configKey;
411
423
  },
412
424
  };
413
425