kupos-ui-components-lib 9.3.2 → 9.3.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.
- package/dist/assets/images/anims/service_list/60_percent_anim.json +1 -0
- package/dist/components/ServiceItem/ServiceItemDesktop.js +18 -84
- package/dist/components/ServiceItem/ServiceItemMobile.js +27 -97
- package/dist/components/ServiceItem/types.d.ts +2 -0
- package/dist/styles.css +37 -0
- package/dist/ui/SeatSection/SeatSection.js +17 -2
- package/dist/ui/ServiceBadges/ServiceBadges.d.ts +17 -0
- package/dist/ui/ServiceBadges/ServiceBadges.js +33 -0
- package/dist/ui/mobileweb/DateTimeSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/DateTimeSectionMobile.js +2 -2
- package/dist/ui/mobileweb/SeatSectionMobile.d.ts +2 -1
- package/dist/ui/mobileweb/SeatSectionMobile.js +8 -4
- package/dist/ui/mobileweb/ServiceBadgesMobile.d.ts +17 -0
- package/dist/ui/mobileweb/ServiceBadgesMobile.js +35 -0
- package/dist/utils/CommonService.d.ts +7 -0
- package/dist/utils/CommonService.js +61 -0
- package/package.json +1 -1
- package/src/components/ServiceItem/ServiceItemDesktop.tsx +35 -131
- package/src/components/ServiceItem/ServiceItemMobile.tsx +57 -165
- package/src/components/ServiceItem/types.ts +2 -0
- package/src/styles.css +10 -0
- package/src/ui/SeatSection/SeatSection.tsx +24 -2
- package/src/ui/ServiceBadges/ServiceBadges.tsx +92 -0
- package/src/ui/mobileweb/DateTimeSectionMobile.tsx +3 -0
- package/src/ui/mobileweb/SeatSectionMobile.tsx +12 -3
- package/src/ui/mobileweb/ServiceBadgesMobile.tsx +92 -0
- package/src/utils/CommonService.ts +86 -0
|
@@ -308,6 +308,92 @@ const commonService = {
|
|
|
308
308
|
|
|
309
309
|
return { originalPrice: price, discountedPrice };
|
|
310
310
|
},
|
|
311
|
+
|
|
312
|
+
startViewerCount: (
|
|
313
|
+
node: HTMLSpanElement | null,
|
|
314
|
+
viewersConfig?: { min: number; max: number; interval?: number },
|
|
315
|
+
) => {
|
|
316
|
+
if (!node || !viewersConfig) return;
|
|
317
|
+
|
|
318
|
+
const prevId = node.dataset.viewerId;
|
|
319
|
+
if (prevId) clearInterval(Number(prevId));
|
|
320
|
+
|
|
321
|
+
const { min, max, interval = 5000 } = viewersConfig;
|
|
322
|
+
const clamp = (v: number) => Math.min(max, Math.max(min, v));
|
|
323
|
+
const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
324
|
+
|
|
325
|
+
node.textContent = String(initialValue);
|
|
326
|
+
|
|
327
|
+
const id = setInterval(() => {
|
|
328
|
+
const current = Number(node.textContent) || initialValue;
|
|
329
|
+
const delta = Math.ceil(current * 0.2);
|
|
330
|
+
const next =
|
|
331
|
+
current + Math.floor(Math.random() * (2 * delta + 1)) - delta;
|
|
332
|
+
node.textContent = String(clamp(Math.round(next)));
|
|
333
|
+
}, interval);
|
|
334
|
+
|
|
335
|
+
node.dataset.viewerId = String(id);
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
startCountdown: (
|
|
339
|
+
node: HTMLSpanElement | null,
|
|
340
|
+
countdownSeconds: number = 599,
|
|
341
|
+
) => {
|
|
342
|
+
if (!node) return;
|
|
343
|
+
|
|
344
|
+
const prevId = node.dataset.countdownId;
|
|
345
|
+
if (prevId) clearInterval(Number(prevId));
|
|
346
|
+
|
|
347
|
+
let remaining = countdownSeconds * 1000; // Convert to milliseconds
|
|
348
|
+
|
|
349
|
+
const formatTime = (totalMs: number) => {
|
|
350
|
+
const m = Math.floor(totalMs / 60000);
|
|
351
|
+
const s = Math.floor((totalMs % 60000) / 1000);
|
|
352
|
+
const ms = Math.floor((totalMs % 1000) / 10); // Show 2 digits for milliseconds
|
|
353
|
+
return `${String(m).padStart(2, "0")}:${String(s).padStart(2, "0")}:${String(ms).padStart(2, "0")}`;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
node.textContent = formatTime(remaining);
|
|
357
|
+
|
|
358
|
+
const id = setInterval(() => {
|
|
359
|
+
remaining -= 100; // Decrease by 100ms
|
|
360
|
+
if (remaining <= 0) {
|
|
361
|
+
remaining = countdownSeconds * 1000;
|
|
362
|
+
}
|
|
363
|
+
node.textContent = formatTime(remaining);
|
|
364
|
+
}, 100); // Update every 100ms
|
|
365
|
+
|
|
366
|
+
node.dataset.countdownId = String(id);
|
|
367
|
+
},
|
|
368
|
+
|
|
369
|
+
startComprandoCount: (
|
|
370
|
+
node: HTMLSpanElement | null,
|
|
371
|
+
min: number = 4,
|
|
372
|
+
max: number = 16,
|
|
373
|
+
) => {
|
|
374
|
+
if (!node) return;
|
|
375
|
+
|
|
376
|
+
const prevId = node.dataset.comprandoId;
|
|
377
|
+
if (prevId) clearInterval(Number(prevId));
|
|
378
|
+
|
|
379
|
+
const initialValue = Math.floor(Math.random() * (max - min + 1)) + min;
|
|
380
|
+
node.textContent = String(initialValue);
|
|
381
|
+
|
|
382
|
+
const id = setInterval(() => {
|
|
383
|
+
const current = Number(node.textContent) || initialValue;
|
|
384
|
+
const changePercent = 0.05; // 5% change
|
|
385
|
+
const change = Math.ceil(current * changePercent);
|
|
386
|
+
const direction = Math.random() > 0.5 ? 1 : -1;
|
|
387
|
+
let next = current + (change * direction);
|
|
388
|
+
|
|
389
|
+
// Clamp within min and max
|
|
390
|
+
next = Math.min(max, Math.max(min, next));
|
|
391
|
+
|
|
392
|
+
node.textContent = String(next);
|
|
393
|
+
}, 5000); // Update every 5 seconds
|
|
394
|
+
|
|
395
|
+
node.dataset.comprandoId = String(id);
|
|
396
|
+
},
|
|
311
397
|
};
|
|
312
398
|
|
|
313
399
|
export default commonService;
|