@opexa/portal-components 0.0.730 → 0.0.732

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 (243) hide show
  1. package/dist/components/Jackpots/Jackpots.js +2 -2
  2. package/dist/components/Jackpots/Jackpots.module.css +219 -219
  3. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.d.ts +20 -0
  4. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.js +8 -0
  5. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarousel.d.ts +87 -0
  6. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarousel.js +77 -0
  7. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselContext.d.ts +6 -0
  8. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselContext.js +2 -0
  9. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselItem.d.ts +44 -0
  10. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselItem.js +198 -0
  11. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselStageItem.d.ts +60 -0
  12. package/dist/components/Jackpots/JackpotsCarouselNext/JackpotsCarouselStageItem.js +159 -0
  13. package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +0 -1
  14. package/dist/components/Jackpots/JackpotsListNext/JackpotMultiStageMobile.js +2 -12
  15. package/dist/components/Jackpots/JackpotsListNext/JackpotsList.d.ts +0 -1
  16. package/dist/components/Jackpots/JackpotsListNext/JackpotsList.js +2 -2
  17. package/dist/components/KYC/KYCDefault/KYCVerificationStatus.lazy.js +2 -2
  18. package/dist/components/KYC/KYCVerificationStatus.lazy.js +7 -13
  19. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +1 -0
  20. package/dist/components/PortalProvider/AndroidOnlyComponents.js +12 -0
  21. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  22. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  23. package/dist/services/queries.js +3069 -3069
  24. package/dist/styles/theme.css +773 -773
  25. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  26. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  27. package/dist/ui/Badge/Badge.d.ts +12 -12
  28. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  29. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  30. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  31. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  32. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  33. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  34. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  35. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  36. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  37. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  38. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  39. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  40. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  41. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  42. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  43. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  44. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  45. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  46. package/dist/ui/Menu/Menu.d.ts +307 -307
  47. package/dist/ui/Menu/menu.recipe.d.ts +17 -17
  48. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  49. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  50. package/dist/ui/Popover/Popover.d.ts +121 -121
  51. package/dist/ui/Popover/popover.recipe.d.ts +11 -11
  52. package/dist/ui/Progress/Progress.d.ts +27 -27
  53. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  54. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  55. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  56. package/dist/ui/Select/Select.d.ts +45 -45
  57. package/dist/ui/Select/select.recipe.d.ts +3 -3
  58. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  59. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  60. package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
  61. package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
  62. package/package.json +176 -176
  63. package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +0 -11
  64. package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +0 -55
  65. package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
  66. package/dist/components/DigitainLauncher/Loading.js +0 -5
  67. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +0 -10
  68. package/dist/components/Disclaimer/ResponsibleGaming.js +0 -13
  69. package/dist/components/Disclaimer/TermsOfUse.d.ts +0 -11
  70. package/dist/components/Disclaimer/TermsOfUse.js +0 -13
  71. package/dist/components/FeatureFlag/FeatureFlag.d.ts +0 -1
  72. package/dist/components/FeatureFlag/FeatureFlag.js +0 -29
  73. package/dist/components/FeatureFlag/index.d.ts +0 -1
  74. package/dist/components/FeatureFlag/index.js +0 -1
  75. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
  76. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
  77. package/dist/components/KYC/AutoOpen.d.ts +0 -1
  78. package/dist/components/KYC/AutoOpen.js +0 -40
  79. package/dist/components/KYC/BasicInformation.d.ts +0 -1
  80. package/dist/components/KYC/BasicInformation.js +0 -101
  81. package/dist/components/KYC/CaptureIdDocument.d.ts +0 -1
  82. package/dist/components/KYC/CaptureIdDocument.js +0 -219
  83. package/dist/components/KYC/CaptureSelfie.d.ts +0 -1
  84. package/dist/components/KYC/CaptureSelfie.js +0 -285
  85. package/dist/components/KYC/DisplayImage.d.ts +0 -5
  86. package/dist/components/KYC/DisplayImage.js +0 -8
  87. package/dist/components/KYC/FileUpload.d.ts +0 -10
  88. package/dist/components/KYC/FileUpload.js +0 -72
  89. package/dist/components/KYC/IdentityVerification.d.ts +0 -1
  90. package/dist/components/KYC/IdentityVerification.js +0 -120
  91. package/dist/components/KYC/Indicator.d.ts +0 -1
  92. package/dist/components/KYC/Indicator.js +0 -8
  93. package/dist/components/KYC/KYC.lazy.d.ts +0 -6
  94. package/dist/components/KYC/KYC.lazy.js +0 -45
  95. package/dist/components/KYC/KYCContext.d.ts +0 -6
  96. package/dist/components/KYC/KYCContext.js +0 -2
  97. package/dist/components/KYC/NoCameraError.d.ts +0 -7
  98. package/dist/components/KYC/NoCameraError.js +0 -6
  99. package/dist/components/KYC/PersonOverlayDesktop.d.ts +0 -7
  100. package/dist/components/KYC/PersonOverlayDesktop.js +0 -9
  101. package/dist/components/KYC/PersonalInformation.d.ts +0 -1
  102. package/dist/components/KYC/PersonalInformation.js +0 -122
  103. package/dist/components/KYC/backup/Header.d.ts +0 -1
  104. package/dist/components/KYC/backup/Header.js +0 -8
  105. package/dist/components/KYC/backup/Indicator.d.ts +0 -1
  106. package/dist/components/KYC/backup/Indicator.js +0 -9
  107. package/dist/components/KYC/backup/KYC.d.ts +0 -1
  108. package/dist/components/KYC/backup/KYC.js +0 -14
  109. package/dist/components/KYC/backup/KYC.lazy.d.ts +0 -1
  110. package/dist/components/KYC/backup/KYC.lazy.js +0 -26
  111. package/dist/components/KYC/backup/KYCContext.d.ts +0 -6
  112. package/dist/components/KYC/backup/KYCContext.js +0 -2
  113. package/dist/components/KYC/backup/Step1.d.ts +0 -1
  114. package/dist/components/KYC/backup/Step1.js +0 -13
  115. package/dist/components/KYC/backup/Step2.d.ts +0 -1
  116. package/dist/components/KYC/backup/Step2.js +0 -13
  117. package/dist/components/KYC/backup/Step3.d.ts +0 -1
  118. package/dist/components/KYC/backup/Step3.js +0 -13
  119. package/dist/components/KYC/backup/Step4.d.ts +0 -1
  120. package/dist/components/KYC/backup/Step4.js +0 -7
  121. package/dist/components/KYC/backup/useKYC.d.ts +0 -10
  122. package/dist/components/KYC/backup/useKYC.js +0 -8
  123. package/dist/components/KYC/loadModels.d.ts +0 -1
  124. package/dist/components/KYC/loadModels.js +0 -9
  125. package/dist/components/KYC/useKYC.d.ts +0 -25
  126. package/dist/components/KYC/useKYC.js +0 -38
  127. package/dist/components/KYC/utils.d.ts +0 -9
  128. package/dist/components/KYC/utils.js +0 -79
  129. package/dist/components/Messages/Message.d.ts +0 -1
  130. package/dist/components/Messages/Message.js +0 -35
  131. package/dist/components/Messages/MessageContext.d.ts +0 -6
  132. package/dist/components/Messages/MessageContext.js +0 -2
  133. package/dist/components/Messages/MessagePopup.d.ts +0 -1
  134. package/dist/components/Messages/MessagePopup.js +0 -20
  135. package/dist/components/Messages/MessageTrigger.d.ts +0 -8
  136. package/dist/components/Messages/MessageTrigger.js +0 -19
  137. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
  138. package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
  139. package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
  140. package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
  141. package/dist/components/Quests/CountdownTimer.d.ts +0 -15
  142. package/dist/components/Quests/CountdownTimer.js +0 -33
  143. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +0 -4
  144. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +0 -78
  145. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +0 -8
  146. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +0 -9
  147. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +0 -4
  148. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +0 -4
  149. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +0 -4
  150. package/dist/components/Quests/WageringQuest/WageringQuest.js +0 -20
  151. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +0 -9
  152. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +0 -9
  153. package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
  154. package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
  155. package/dist/components/SessionWatcher/index.d.ts +0 -1
  156. package/dist/components/SessionWatcher/index.js +0 -1
  157. package/dist/components/SignIn/utils.d.ts +0 -8
  158. package/dist/components/SignIn/utils.js +0 -26
  159. package/dist/components/SignUp/SignUp.lazy.d.ts +0 -12
  160. package/dist/components/SignUp/SignUp.lazy.js +0 -18
  161. package/dist/components/SignUp/SignUpContext.d.ts +0 -6
  162. package/dist/components/SignUp/SignUpContext.js +0 -2
  163. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +0 -17
  164. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +0 -18
  165. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +0 -6
  166. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +0 -2
  167. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +0 -1
  168. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +0 -310
  169. package/dist/components/SignUp/SignUpForm.d.ts +0 -1
  170. package/dist/components/SignUp/SignUpForm.js +0 -284
  171. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +0 -1
  172. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +0 -198
  173. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +0 -1
  174. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +0 -251
  175. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +0 -10
  176. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +0 -42
  177. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +0 -7
  178. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +0 -9
  179. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +0 -1
  180. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +0 -464
  181. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +0 -11
  182. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +0 -20
  183. package/dist/components/SignUp/SignUpKYC/utils.d.ts +0 -9
  184. package/dist/components/SignUp/SignUpKYC/utils.js +0 -79
  185. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +0 -1
  186. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +0 -198
  187. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +0 -1
  188. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +0 -251
  189. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +0 -10
  190. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +0 -41
  191. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +0 -1
  192. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +0 -429
  193. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +0 -13
  194. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +0 -26
  195. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +0 -7
  196. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +0 -2
  197. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +0 -11
  198. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +0 -20
  199. package/dist/components/shared/IdDocumentField.client.d.ts +0 -25
  200. package/dist/components/shared/IdDocumentField.client.js +0 -204
  201. package/dist/components/shared/IdDocumentField.d.ts +0 -2
  202. package/dist/components/shared/IdDocumentField.js +0 -11
  203. package/dist/components/shared/SelfieField.client.d.ts +0 -20
  204. package/dist/components/shared/SelfieField.client.js +0 -327
  205. package/dist/components/shared/SelfieField.d.ts +0 -2
  206. package/dist/components/shared/SelfieField.js +0 -11
  207. package/dist/constants/BranchCode.d.ts +0 -4
  208. package/dist/constants/BranchCode.js +0 -42
  209. package/dist/constants/Branches.d.ts +0 -2
  210. package/dist/constants/Branches.js +0 -42
  211. package/dist/handlers/postTransformIdFrontImage.d.ts +0 -3
  212. package/dist/handlers/postTransformIdFrontImage.js +0 -67
  213. package/dist/handlers/postTransformSelfieImage.d.ts +0 -3
  214. package/dist/handlers/postTransformSelfieImage.js +0 -71
  215. package/dist/handlers.d.ts +0 -43
  216. package/dist/handlers.js +0 -297
  217. package/dist/icons/BellRingIcon.d.ts +0 -2
  218. package/dist/icons/BellRingIcon.js +0 -4
  219. package/dist/images/responsible-gaming-yellow.png +0 -0
  220. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
  221. package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
  222. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  223. package/dist/third-parties/FacebookPixel/api.js +0 -1
  224. package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
  225. package/dist/third-parties/FacebookPixel/index.js +0 -1
  226. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
  227. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
  228. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  229. package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
  230. package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
  231. package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
  232. package/dist/third-parties/index.d.ts +0 -2
  233. package/dist/third-parties/index.js +0 -2
  234. package/dist/utils/dataUrlToBlob.d.ts +0 -1
  235. package/dist/utils/dataUrlToBlob.js +0 -11
  236. package/dist/utils/gamesAvailable3pmTo3am.d.ts +0 -1
  237. package/dist/utils/gamesAvailable3pmTo3am.js +0 -1
  238. package/dist/utils/getGameName.d.ts +0 -1
  239. package/dist/utils/getGameName.js +0 -6
  240. package/dist/utils/isBetween3amAnd3pm.d.ts +0 -1
  241. package/dist/utils/isBetween3amAnd3pm.js +0 -5
  242. package/dist/utils/resizeImageSize.d.ts +0 -2
  243. package/dist/utils/resizeImageSize.js +0 -11
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import useEmblaCarousel from 'embla-carousel-react';
4
+ import { isString } from 'lodash-es';
5
+ import Link from 'next/link';
6
+ import { useCallback, useEffect, useState, } from 'react';
7
+ import { useIntersectionObserver } from 'usehooks-ts';
8
+ import { useJackpotsNextQuery } from '../../../client/hooks/useJackpotsNextQuery.js';
9
+ import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
10
+ import { ArrowRightIcon } from '../../../icons/ArrowRightIcon.js';
11
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
12
+ import { Button } from '../../../ui/Button/index.js';
13
+ import { isStyleEntries } from '../../../utils/isStyleEntries.js';
14
+ import { JackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
15
+ import { JackpotsCarouselItem } from './JackpotsCarouselItem.js';
16
+ import { JackpotsCarouselStageItem } from './JackpotsCarouselStageItem.js';
17
+ export function JackpotsCarouselNext({ style, className, ...props }) {
18
+ const [emblaRef, emblaApi] = useEmblaCarousel({
19
+ align: 'start',
20
+ slidesToScroll: 1,
21
+ });
22
+ const scrollPrev = useCallback(() => {
23
+ if (emblaApi)
24
+ emblaApi.scrollPrev();
25
+ }, [emblaApi]);
26
+ const scrollNext = useCallback(() => {
27
+ if (emblaApi)
28
+ emblaApi.scrollNext();
29
+ }, [emblaApi]);
30
+ const [canScrollPrev, setCanScrollPrev] = useState(false);
31
+ const [canScrollNext, setCanScrollNext] = useState(false);
32
+ const onSelect = useCallback(() => {
33
+ if (!emblaApi)
34
+ return;
35
+ setCanScrollPrev(emblaApi.canScrollPrev());
36
+ setCanScrollNext(emblaApi.canScrollNext());
37
+ }, [emblaApi]);
38
+ useEffect(() => {
39
+ if (!emblaApi)
40
+ return;
41
+ onSelect();
42
+ emblaApi.on('select', onSelect);
43
+ emblaApi.on('reInit', onSelect);
44
+ }, [emblaApi, onSelect]);
45
+ const [ref, inView] = useIntersectionObserver({
46
+ threshold: 0.25,
47
+ });
48
+ const jackpotsQuery = useJackpotsNextQuery({
49
+ first: 100,
50
+ filter: {
51
+ deleted: {
52
+ equal: false,
53
+ },
54
+ },
55
+ sort: {
56
+ cursor: 'POOL',
57
+ order: 'DESC',
58
+ },
59
+ }, {
60
+ refetchInterval: inView ? 10_000 : false,
61
+ });
62
+ const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
63
+ if (jackpots.length <= 0)
64
+ return null;
65
+ const styles = isStyleEntries(style, ['root', 'itemRoot'])
66
+ ? style
67
+ : { root: style };
68
+ const classNames = isString(className)
69
+ ? { root: className }
70
+ : (className ?? {});
71
+ return (_jsxs("div", { ref: ref, style: styles.root, className: classNames.root, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "font-semibold text-lg", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/jackpots', className: "flex gap-sm font-semibold text-button-tertiary-fg text-sm", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: "rounded-l-none", "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] })] }), _jsx("div", { className: "relative mt-lg overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-2.5", children: jackpots.map((jackpot, index) => {
72
+ if (jackpot.stages?.length) {
73
+ return (_jsx(JackpotsCarouselItemContext, { value: jackpot, children: _jsx(JackpotsCarouselStageItem, { style: styles.itemRoot, className: classNames, animate: props.animate, customJackpotChestImage: props.customJackpotChestImage, jackpotProfileShape: props.jackpotProfileShape, customJackpotStageChest: props.customJackpotStageChest, medalImage: props.medalImage }) }, index));
74
+ }
75
+ return (_jsx(JackpotsCarouselItemContext, { value: jackpot, children: _jsx(JackpotsCarouselItem, { style: styles.itemRoot, className: classNames, viewAllUrl: props.viewAllUrl, animate: props.animate, customJackpotChestImage: props.customJackpotChestImage, jackpotProfileShape: props.jackpotProfileShape, chestImagesByTier: props.chestImagesByTier }) }, index));
76
+ }) }) })] }));
77
+ }
@@ -0,0 +1,6 @@
1
+ import type { _Jackpot } from '../../../types';
2
+ export declare const JackpotsCarouselItemContext: (props: {
3
+ value: _Jackpot;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useJackpotsCarouselItemContext: () => _Jackpot;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [JackpotsCarouselItemContext, useJackpotsCarouselItemContext] = createContext();
@@ -0,0 +1,44 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type CSSProperties } from 'react';
3
+ import type { ClassNameEntries } from './JackpotsCarousel';
4
+ export interface JackpotsCarouselItemProps {
5
+ style?: CSSProperties;
6
+ className?: ClassNameEntries;
7
+ /** @default "/jackpots" */
8
+ viewAllUrl?: string;
9
+ customJackpotChestImage?: {
10
+ image: {
11
+ open: string;
12
+ closed: string;
13
+ };
14
+ style?: {
15
+ wrapper?: string;
16
+ image?: string;
17
+ };
18
+ };
19
+ animate?: boolean;
20
+ chestImagesByTier?: {
21
+ grand?: {
22
+ open: ImageProps['src'];
23
+ closed: ImageProps['src'];
24
+ };
25
+ major?: {
26
+ open: ImageProps['src'];
27
+ closed: ImageProps['src'];
28
+ };
29
+ minor?: {
30
+ open: ImageProps['src'];
31
+ closed: ImageProps['src'];
32
+ };
33
+ default?: {
34
+ open: ImageProps['src'];
35
+ closed: ImageProps['src'];
36
+ };
37
+ style?: {
38
+ wrapper?: string;
39
+ image?: string;
40
+ };
41
+ };
42
+ jackpotProfileShape?: 'oval' | 'star';
43
+ }
44
+ export declare function JackpotsCarouselItem({ style, className, viewAllUrl, animate, customJackpotChestImage, chestImagesByTier, jackpotProfileShape, }: JackpotsCarouselItemProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,198 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Progress } from '@ark-ui/react/progress';
4
+ import { format } from 'date-fns';
5
+ import isMobile from 'is-mobile';
6
+ import Image, {} from 'next/image';
7
+ import Link from 'next/link';
8
+ import { useCallback, useEffect, useId, useMemo, useState, } from 'react';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import { useIntersectionObserver } from 'usehooks-ts';
11
+ import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
12
+ import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
13
+ import { ArrowNarrowUpRightIcon } from '../../../icons/ArrowNarrowUpRightIcon.js';
14
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
15
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
16
+ import { StarIcon } from '../../../icons/StarIcon.js';
17
+ import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
18
+ import { User01Icon } from '../../../icons/User01Icon.js';
19
+ import closeChest from '../../../images/close-chest.png';
20
+ import firstPlace from '../../../images/first-place.png';
21
+ import leaderboard from '../../../images/leaderboard.png';
22
+ import openChest from '../../../images/open-chest.png';
23
+ import * as Tooltip from '../../../ui/Tooltip/Tooltip.js';
24
+ import { capitalize } from '../../../utils/capitalize.js';
25
+ import { formatNumber } from '../../../utils/formatNumber.js';
26
+ import { mask } from '../../../utils/mask.js';
27
+ import { parseDecimal } from '../../../utils/parseDecimal.js';
28
+ import styles from '../Jackpots.module.css';
29
+ import { useJackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
30
+ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = true, customJackpotChestImage, chestImagesByTier, jackpotProfileShape = 'oval', }) {
31
+ const [ref, inView] = useIntersectionObserver({
32
+ threshold: 0.75,
33
+ });
34
+ const jackpot = useJackpotsCarouselItemContext();
35
+ const getTierFromName = (name) => {
36
+ const lowerName = name.toLowerCase();
37
+ if (lowerName.includes('grand'))
38
+ return 'grand';
39
+ if (lowerName.includes('major'))
40
+ return 'major';
41
+ if (lowerName.includes('minor'))
42
+ return 'minor';
43
+ return 'default';
44
+ };
45
+ const getChestImages = () => {
46
+ // Priority: chestImagesByTier > customJackpotChestImage > default
47
+ if (chestImagesByTier) {
48
+ const tier = getTierFromName(jackpot.name);
49
+ const tierImages = chestImagesByTier[tier] || chestImagesByTier.default;
50
+ if (tierImages) {
51
+ return {
52
+ open: tierImages.open,
53
+ closed: tierImages.closed,
54
+ style: chestImagesByTier.style,
55
+ };
56
+ }
57
+ }
58
+ if (customJackpotChestImage?.image) {
59
+ return {
60
+ open: customJackpotChestImage.image.open,
61
+ closed: customJackpotChestImage.image.closed,
62
+ style: customJackpotChestImage.style,
63
+ };
64
+ }
65
+ // Default fallback
66
+ return {
67
+ open: openChest,
68
+ closed: closeChest,
69
+ style: undefined,
70
+ };
71
+ };
72
+ const chestImages = getChestImages();
73
+ const jackpotPayoutsQuery = useJackpotPayoutsQuery({
74
+ first: 30,
75
+ filter: {
76
+ jackpot: {
77
+ equal: jackpot.id,
78
+ },
79
+ },
80
+ }, {
81
+ enabled: typeof window !== 'undefined' && inView,
82
+ refetchInterval: 10_000,
83
+ });
84
+ const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
85
+ const latestJackpotPayout = jackpotPayouts[0] ?? [];
86
+ const localeInfo = useLocaleInfo();
87
+ const isPayingOut = jackpot.drawing;
88
+ const jackpotAmount = jackpot.pool;
89
+ const Arrow = useCallback(({ index }) => {
90
+ const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
91
+ return (_jsx(Icon, { className: twMerge('min-w-2.5 scale-400 text-brand-300 lg:min-w-4 lg:scale-250', isPayingOut
92
+ ? styles['animate-wave-color-error']
93
+ : styles['animate-wave-color-success']), style: {
94
+ animationDelay: isPayingOut
95
+ ? `${(40 - index - 1) * 0.1}s`
96
+ : `${index * 0.1}s`,
97
+ } }));
98
+ }, [isPayingOut]);
99
+ const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
100
+ const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
101
+ const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
102
+ const isMobileDevice = useMemo(() => isMobile(), []);
103
+ const mainTooltipId = useId();
104
+ const minLimitTooltipId = useId();
105
+ const handleMainTooltipClick = useCallback((e) => {
106
+ if (isMobileDevice) {
107
+ e.stopPropagation();
108
+ setMainTooltipOpen((prev) => !prev);
109
+ }
110
+ }, [isMobileDevice]);
111
+ const handleMinLimitTooltipClick = useCallback((e) => {
112
+ if (isMobileDevice) {
113
+ e.stopPropagation();
114
+ setMinLimitTooltipOpen((prev) => !prev);
115
+ }
116
+ }, [isMobileDevice]);
117
+ useEffect(() => {
118
+ if (isMobileDevice && mainTooltipOpen) {
119
+ const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);
120
+ return () => clearTimeout(timeout);
121
+ }
122
+ }, [mainTooltipOpen, isMobileDevice]);
123
+ useEffect(() => {
124
+ if (isMobileDevice && minLimitTooltipOpen) {
125
+ const timeout = setTimeout(() => setMinLimitTooltipOpen(false), 3000);
126
+ return () => clearTimeout(timeout);
127
+ }
128
+ }, [minLimitTooltipOpen, isMobileDevice]);
129
+ const ProfileIcon = () => jackpotProfileShape === 'oval' ? (_jsxs("div", { className: "relative flex h-18 w-18 items-center justify-center rounded-full bg-bg-tertiary", children: [_jsx(User01Icon, { className: "size-9 text-text-quarterary-500" }), _jsx("div", { className: twMerge('absolute right-0 bottom-safe-area-inset-bottom flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 font-bold text-brand-950 text-xs', className?.latestPayoutRankRoot), children: "1st" })] })) : (_jsxs("div", { className: "relative grid h-18 w-18", children: [_jsx(StarIcon, { className: "col-start-1 row-start-1 h-full w-full" }), _jsx(User01Icon, { className: "z-10 col-start-1 row-start-1 size-9 place-self-center text-text-quarterary-500" }), _jsx("div", { className: twMerge('-right-0 absolute bottom-safe-area-inset-bottom z-20 flex h-7 w-7 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 text-center font-bold text-brand-950 text-xs', className?.latestPayoutRankRoot), children: "1st" })] }));
130
+ const PayoutBadge = () => (_jsxs("div", { className: twMerge('flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs', className?.latestPayoutBadgeRoot), children: [_jsx(Trophy01Icon, { className: twMerge('size-3.5 text-utility-brand-600', className?.latestPayoutBadgeIcon) }), "Latest Payout"] }));
131
+ if (jackpot.status === 'DISABLED' && jackpot.drawing !== true) {
132
+ return null;
133
+ }
134
+ return (_jsxs("div", { ref: ref, className: twMerge('relative flex w-full shrink-0 rounded-2xl border border-border-primary bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5', className?.itemRoot), style: style, children: [_jsxs("div", { className: "relative z-1 flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: [_jsx("span", { className: "full size-1.5 animate-pulse rounded bg-utility-success-500" }), "Paying Out"] })) : (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-blue-200 bg-utility-blue-50 px-2 py-0.5 font-medium text-utility-blue-700 text-xs", children: [_jsx(ArrowNarrowUpRightIcon, { className: "size-3.5 text-utility-blue-500" }), "Accumulating"] })), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: twMerge('mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl', className?.jackpotAmountRoot), children: formatNumber(jackpotAmount, {
135
+ currency: localeInfo.currency.code,
136
+ minDecimalPlaces: 2,
137
+ maxDecimalPlaces: 2,
138
+ }) })] }), _jsx("div", { className: "hidden min-w-25 lg:block" }), _jsx("div", { className: twMerge('right-0 bottom-[-60] z-1 min-w-25 lg:absolute', chestImages?.style?.wrapper), children: _jsx(Image, { width: 150, height: 150, src: isPayingOut ? chestImages.open : chestImages.closed, alt: "closeChest", className: twMerge('size-full h-25 w-25 p-2 lg:h-37.5 lg:w-37.5', chestImages?.style?.image) }) })] }), _jsx("div", { className: twMerge('relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex', className?.latestPayoutRoot), children: latestJackpotPayout?.amount ? (_jsxs(_Fragment, { children: [_jsx(ProfileIcon, {}), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: mask(latestJackpotPayout.member.name, {
139
+ totalCharsCount: 6,
140
+ }) }), _jsx("div", { className: twMerge('text-2xl text-brand-400', className?.latestPayoutAmount), children: formatNumber(latestJackpotPayout.amount, {
141
+ currency: localeInfo.currency.code,
142
+ minDecimalPlaces: 2,
143
+ maxDecimalPlaces: 2,
144
+ }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "firstPlace", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the jackpot!" })] })] })) })] }) }) }), _jsxs("div", { className: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("div", { className: "font-semibold text-text-primary-900 text-xs", "aria-live": "polite", children: formatNumber(0, {
145
+ currency: localeInfo.currency.code,
146
+ compact: true,
147
+ }) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsx("div", { className: "flex w-6 items-center", children: [0, 1.5, 3].map((left, i) => (_jsx("div", { className: twMerge(`absolute left-${left}`, styles[`animate-arrow-red-flash-${i + 1}`]), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }, i))) })) : (_jsx("div", { className: "flex w-6 items-center", children: [0, 1.5, 3].map((left, i) => (_jsx("div", { className: twMerge(`absolute left-${left}`, styles[`animate-arrow-green-flash-${i + 1}`]), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }, i))) })), _jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
148
+ currency: localeInfo.currency.code,
149
+ compact: true,
150
+ }) })] })] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuenow": getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuemax": 100, "aria-label": "Jackpot progress", children: _jsx(Progress.Track, { className: twMerge('h-full overflow-hidden rounded-full bg-bg-primary', className?.progressBarTrack), children: _jsxs(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: [_jsxs(Tooltip.Root, { ...(isMobileDevice
151
+ ? {
152
+ open: mainTooltipOpen,
153
+ onOpenChange: (details) => setMainTooltipOpen(details.open),
154
+ }
155
+ : {}), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { className: "absolute inset-0 h-full w-full", onClick: handleMainTooltipClick, role: "button", tabIndex: 0, "aria-label": "Show current jackpot tooltip", "aria-describedby": mainTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: mainTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Current\uD83D\uDCB0:", ' ', formatNumber(jackpot.pool, {
156
+ currency: localeInfo.currency.code,
157
+ minDecimalPlaces: 2,
158
+ maxDecimalPlaces: 2,
159
+ })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] }), _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }), _jsxs(Tooltip.Root, { open: isMobile() ? minLimitTooltipOpen : undefined, onOpenChange: (details) => isMobile() && setMinLimitTooltipOpen(details.open), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { onClick: handleMinLimitTooltipClick, className: "absolute inset-0 h-full bg-black opacity-30", style: {
160
+ width: `${getPercentage(jackpot.minimumJackpotPoolDrawingLimit, jackpot.pool)}%`,
161
+ }, role: "button", tabIndex: 0, "aria-label": "Show minimum payout limit tooltip", "aria-describedby": minLimitTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: minLimitTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Minimum Payout Limit:", ' ', formatNumber(jackpot.minimumJackpotPoolDrawingLimit, {
162
+ currency: localeInfo.currency.code,
163
+ minDecimalPlaces: 2,
164
+ maxDecimalPlaces: 2,
165
+ })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] })] }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
166
+ ? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
167
+ currency: localeInfo.currency.code,
168
+ compact: true,
169
+ })} Play now for your chance to win big! 🔥`
170
+ : getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: twMerge('z-1 hidden flex-1 space-y-4 lg:block', className?.recentPayoutsRoot), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' })] }), _jsxs(Link, { className: "flex font-semibold text-button-tertiary-fg text-sm", href: viewAllUrl ?? '/jackpots', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx("div", { className: twMerge('max-h-[17rem] overflow-y-scroll', styles.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { className: twMerge('h-8 whitespace-nowrap bg-bg-secondary text-left font-medium text-text-tertiary-600 text-xs', className?.recentPayoutsTableHeadRow), children: [
171
+ 'Player',
172
+ 'Game Provider',
173
+ 'Multiplier',
174
+ 'Prize',
175
+ 'Timestamp',
176
+ ].map((header) => (_jsx("th", { className: "px-4", children: header }, header))) }) }), _jsx("tbody", { children: jackpotPayouts.length
177
+ ? jackpotPayouts.map((jp, i) => (_jsxs("tr", { className: twMerge('whitespace-nowrap bg-bg-primary text-left text-sm text-text-secondary-700', className?.recentPayoutsTableBodyRow), children: [_jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: mask(jp.member.name, {
178
+ totalCharsCount: 6,
179
+ }) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: capitalize(jp.game?.provider ?? '-', {
180
+ delimiter: capitalize.delimiters.UNDERSCORE,
181
+ }) }), _jsxs("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: [jp.multiplier, "x"] }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4 text-brand-400', className?.recentPayoutsTableBodyData), children: formatNumber(jp.amount, {
182
+ currency: localeInfo.currency.code,
183
+ minDecimalPlaces: 2,
184
+ maxDecimalPlaces: 2,
185
+ }) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: format(new Date(jp.dateTimeCreated), 'dd MMM yyyy h:mm a') })] }, i)))
186
+ : Array.from({ length: 10 }).map((_, i) => (_jsx("tr", { className: twMerge('bg-bg-primary text-sm text-text-secondary-700', className?.recentPayoutsTableBodyRow), children: Array.from({ length: 5 }).map((_, j) => (_jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2', className?.recentPayoutsTableBodyData), children: "-" }, j))) }, i))) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute top-safe-area-inset-top right-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:9.375rem]') }))] }));
187
+ }
188
+ const getAccumulatingJackpotDescription = (part, total) => {
189
+ const percentage = total === 0 ? 0 : (part / total) * 100;
190
+ return percentage <= 90
191
+ ? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
192
+ : '🔥 It’s about to pop! Stay in the game for your shot at the prize!';
193
+ };
194
+ function getPercentage(value, total) {
195
+ const v = parseDecimal(value, 0);
196
+ const t = parseDecimal(total, 0);
197
+ return t === 0 ? 0 : (v / t) * 100;
198
+ }
@@ -0,0 +1,60 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type CSSProperties } from 'react';
3
+ import type { ClassNameEntries } from './JackpotsCarousel';
4
+ export interface JackpotsCarouselItemProps {
5
+ style?: CSSProperties;
6
+ className?: ClassNameEntries;
7
+ /** @default "/jackpots" */
8
+ viewAllUrl?: string;
9
+ customJackpotChestImage?: {
10
+ image: {
11
+ open: string;
12
+ closed: string;
13
+ };
14
+ style?: {
15
+ wrapper?: string;
16
+ image?: string;
17
+ };
18
+ };
19
+ customJackpotStageChest?: {
20
+ style?: {
21
+ wrapper?: string;
22
+ image?: string;
23
+ };
24
+ stage: {
25
+ one: ImageProps['src'];
26
+ two: ImageProps['src'];
27
+ three: ImageProps['src'];
28
+ four: ImageProps['src'];
29
+ };
30
+ };
31
+ medalImage?: {
32
+ image: ImageProps['src'];
33
+ wrapper?: string;
34
+ };
35
+ animate?: boolean;
36
+ chestImagesByTier?: {
37
+ grand?: {
38
+ open: ImageProps['src'];
39
+ closed: ImageProps['src'];
40
+ };
41
+ major?: {
42
+ open: ImageProps['src'];
43
+ closed: ImageProps['src'];
44
+ };
45
+ minor?: {
46
+ open: ImageProps['src'];
47
+ closed: ImageProps['src'];
48
+ };
49
+ default?: {
50
+ open: ImageProps['src'];
51
+ closed: ImageProps['src'];
52
+ };
53
+ style?: {
54
+ wrapper?: string;
55
+ image?: string;
56
+ };
57
+ };
58
+ jackpotProfileShape?: 'oval' | 'star';
59
+ }
60
+ export declare function JackpotsCarouselStageItem({ style, className, viewAllUrl, animate, customJackpotStageChest, jackpotProfileShape, }: JackpotsCarouselItemProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,159 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Progress } from '@ark-ui/react/progress';
4
+ import { format } from 'date-fns';
5
+ import isMobile from 'is-mobile';
6
+ import Image, {} from 'next/image';
7
+ import Link from 'next/link';
8
+ import { useCallback, useEffect, useMemo, useState, } from 'react';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import { useIntersectionObserver } from 'usehooks-ts';
11
+ import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
12
+ import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
13
+ import { ArrowNarrowUpRightIcon } from '../../../icons/ArrowNarrowUpRightIcon.js';
14
+ import { CheckCircleBrokenIcon } from '../../../icons/CheckCircleBrokenIcon.js';
15
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
16
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
17
+ import { Flag05Icon } from '../../../icons/Flag05Icon.js';
18
+ import { StarIcon } from '../../../icons/StarIcon.js';
19
+ import { Target04Icon } from '../../../icons/Target04Icon.js';
20
+ import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
21
+ import { User01Icon } from '../../../icons/User01Icon.js';
22
+ import firstPlace from '../../../images/first-place.png';
23
+ import leaderboard from '../../../images/leaderboard.png';
24
+ import { formatNumber } from '../../../utils/formatNumber.js';
25
+ import { mask } from '../../../utils/mask.js';
26
+ import { parseDecimal } from '../../../utils/parseDecimal.js';
27
+ import styles from '../Jackpots.module.css';
28
+ import { useJackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
29
+ export function JackpotsCarouselStageItem({ style, className, viewAllUrl, animate = true, customJackpotStageChest, jackpotProfileShape = 'oval', }) {
30
+ const [ref, inView] = useIntersectionObserver({
31
+ threshold: 0.75,
32
+ });
33
+ const jackpot = useJackpotsCarouselItemContext();
34
+ const getChestImages = (stage) => {
35
+ if (stage === 1) {
36
+ return {
37
+ image: customJackpotStageChest?.stage.one,
38
+ style: customJackpotStageChest?.style,
39
+ };
40
+ }
41
+ if (stage === 2) {
42
+ return {
43
+ image: customJackpotStageChest?.stage.two,
44
+ style: customJackpotStageChest?.style,
45
+ };
46
+ }
47
+ if (stage === 3) {
48
+ return {
49
+ image: customJackpotStageChest?.stage.three,
50
+ style: customJackpotStageChest?.style,
51
+ };
52
+ }
53
+ return {
54
+ image: customJackpotStageChest?.stage.four,
55
+ style: customJackpotStageChest?.style,
56
+ };
57
+ };
58
+ const chestImages = getChestImages(jackpot.stage ?? 1);
59
+ const jackpotPayoutsQuery = useJackpotPayoutsQuery({
60
+ first: 30,
61
+ filter: {
62
+ jackpot: {
63
+ equal: jackpot.id,
64
+ },
65
+ },
66
+ }, {
67
+ enabled: typeof window !== 'undefined' && inView,
68
+ refetchInterval: 10_000,
69
+ });
70
+ const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
71
+ const latestJackpotPayout = jackpotPayouts[0] ?? [];
72
+ const localeInfo = useLocaleInfo();
73
+ const isPayingOut = jackpot.drawing;
74
+ const jackpotAmount = jackpot.pool;
75
+ const totalTurnover = jackpot.totalTurnover;
76
+ const overallTurnover = parseDecimal(jackpot.totalTurnover, 0) /
77
+ (jackpot.stages?.reduce((acc, stage) => acc + parseFloat(stage.targetTurnover ?? '0'), 0) ?? 0);
78
+ const overallPercentage = getPercentage(totalTurnover, overallTurnover);
79
+ const Arrow = useCallback(({ index }) => {
80
+ const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
81
+ return (_jsx(Icon, { className: twMerge('min-w-2.5 scale-400 text-brand-300 lg:min-w-4 lg:scale-250', isPayingOut
82
+ ? styles['animate-wave-color-error']
83
+ : styles['animate-wave-color-success']), style: {
84
+ animationDelay: isPayingOut
85
+ ? `${(40 - index - 1) * 0.1}s`
86
+ : `${index * 0.1}s`,
87
+ } }));
88
+ }, [isPayingOut]);
89
+ const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
90
+ const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
91
+ const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
92
+ const isMobileDevice = useMemo(() => isMobile(), []);
93
+ const target = parseFloat(jackpot.stages?.[jackpot.stage]?.targetTurnover ?? '0');
94
+ const total = parseFloat(jackpot.totalTurnover ?? '0');
95
+ const currStageProgressPercentage = getPercentage(total, target);
96
+ useEffect(() => {
97
+ if (isMobileDevice && mainTooltipOpen) {
98
+ const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);
99
+ return () => clearTimeout(timeout);
100
+ }
101
+ }, [mainTooltipOpen, isMobileDevice]);
102
+ useEffect(() => {
103
+ if (isMobileDevice && minLimitTooltipOpen) {
104
+ const timeout = setTimeout(() => setMinLimitTooltipOpen(false), 3000);
105
+ return () => clearTimeout(timeout);
106
+ }
107
+ }, [minLimitTooltipOpen, isMobileDevice]);
108
+ const ProfileIcon = () => jackpotProfileShape === 'oval' ? (_jsxs("div", { className: "relative flex h-18 w-18 items-center justify-center rounded-full bg-bg-tertiary", children: [_jsx(User01Icon, { className: "size-9 text-text-quarterary-500" }), _jsx("div", { className: twMerge('absolute right-0 bottom-safe-area-inset-bottom flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 font-bold text-brand-950 text-xs', className?.latestPayoutRankRoot), children: "1st" })] })) : (_jsxs("div", { className: "relative grid h-18 w-18", children: [_jsx(StarIcon, { className: "col-start-1 row-start-1 h-full w-full" }), _jsx(User01Icon, { className: "z-10 col-start-1 row-start-1 size-9 place-self-center text-text-quarterary-500" }), _jsx("div", { className: twMerge('-right-0 absolute bottom-safe-area-inset-bottom z-20 flex h-7 w-7 items-center justify-center rounded-full border-[1.5px] border-bg-primary bg-yellow-400 text-center font-bold text-brand-950 text-xs', className?.latestPayoutRankRoot), children: "1st" })] }));
109
+ const PayoutBadge = () => (_jsxs("div", { className: twMerge('flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs', className?.latestPayoutBadgeRoot), children: [_jsx(Trophy01Icon, { className: twMerge('size-3.5 text-utility-brand-600', className?.latestPayoutBadgeIcon) }), "Winner"] }));
110
+ const OverallProgressBar = () => {
111
+ return (_jsxs("div", { className: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-[0.3125rem] flex items-center justify-between font-semibold text-sm text-text-primary-900", children: [_jsx("p", { children: "Overall Progress" }), overallPercentage, "%"] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: overallPercentage, children: _jsx(Progress.Track, { className: twMerge('h-full overflow-hidden rounded-full bg-bg-primary', className?.progressBarTrack), children: _jsx(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }) }) }) })] }));
112
+ };
113
+ if (jackpot.status === 'DISABLED' && jackpot.drawing !== true) {
114
+ return null;
115
+ }
116
+ return (_jsxs("div", { ref: ref, className: twMerge('relative flex w-full shrink-0 rounded-2xl border border-border-primary bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5', className?.itemRoot, window.location.href.includes('blucky') &&
117
+ styles['animate-multi-stage-gradient-blucky']), style: style, children: [_jsxs("div", { className: "relative z-1 flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex gap-2.5", children: [_jsxs("div", { className: twMerge('flex w-fit items-center gap-1 rounded-full border border-[#3F100B] bg-[#CDA95B] px-2 py-0.5 font-medium text-[#1D0201] text-xs', className?.jackpotBadgeRoot), children: [_jsx(Flag05Icon, { className: "size-3.5 text-[inherit]" }), "Stage ", jackpot.stage] }), overallPercentage < 100 ? (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-blue-200 bg-utility-blue-50 px-2 py-0.5 font-medium text-utility-blue-700 text-xs", children: [_jsx(ArrowNarrowUpRightIcon, { className: "size-3.5 text-utility-blue-500" }), "In Progress"] })) : (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: [_jsx(CheckCircleBrokenIcon, { className: "size-3.5 text-utility-success-500" }), "Completed"] }))] }), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: twMerge('mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl', className?.jackpotAmountRoot), children: formatNumber(jackpotAmount, {
118
+ currency: localeInfo.currency.code,
119
+ minDecimalPlaces: 2,
120
+ maxDecimalPlaces: 2,
121
+ }) }), _jsxs("div", { className: twMerge('mt-[0.625rem] flex w-fit items-center gap-1 rounded-full border border-[#932F19] bg-[#511C10] py-[0.125rem] pr-[0.5rem] pl-[0.375rem] text-[#F7B27A] text-xs', className?.jackpotTurnoverRoot), children: [_jsx(Target04Icon, { className: twMerge('size-3.5 text-[#EF6820]', className?.jackpotTurnoverIcon) }), _jsxs("p", { children: ["Turnover Target:", ' ', formatNumber(jackpot.stages?.[jackpot.stage]?.targetTurnover, {
122
+ currency: localeInfo.currency.code,
123
+ minDecimalPlaces: 2,
124
+ maxDecimalPlaces: 2,
125
+ })] })] })] }), _jsx("div", { className: "hidden min-w-25 lg:block" }), chestImages.image && (_jsx("div", { className: twMerge('right-0 bottom-[-60] z-1 min-w-30 lg:absolute', chestImages?.style?.wrapper), children: _jsx(Image, { width: 150, height: 150, src: chestImages.image, alt: "chest", className: twMerge('size-full h-25 w-25 p-2 lg:h-37.5 lg:w-37.5', chestImages?.style?.image) }) }))] }), _jsx("div", { className: twMerge('relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex', className?.latestPayoutRoot), children: latestJackpotPayout?.amount ? (_jsxs(_Fragment, { children: [_jsx(ProfileIcon, {}), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: mask(latestJackpotPayout.member.name, {
126
+ totalCharsCount: 6,
127
+ }) }), _jsx("div", { className: twMerge('text-2xl text-brand-400', className?.latestPayoutAmount), children: formatNumber(latestJackpotPayout.amount, {
128
+ currency: localeInfo.currency.code,
129
+ minDecimalPlaces: 2,
130
+ maxDecimalPlaces: 2,
131
+ }) })] })] })) : (_jsxs(_Fragment, { children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "firstPlace", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the jackpot!" })] })] })) })] }) }) }), _jsxs("div", { className: "lg:mt-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "font-semibold text-sm text-text-primary-900", children: ["Stage ", jackpot.stage, " Progress"] }), currStageProgressPercentage, "%"] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: currStageProgressPercentage, "aria-valuenow": currStageProgressPercentage, "aria-valuemax": 100, "aria-label": "Jackpot progress", children: _jsx(Progress.Track, { className: twMerge('h-full overflow-hidden rounded-full bg-bg-primary', className?.progressBarTrack), children: _jsx(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }) }) }) })] })] }), _jsxs("div", { className: twMerge('z-1 hidden flex-1 space-y-4 lg:block', className?.recentPayoutsRoot), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: "Stages" })] }), _jsxs(Link, { className: "flex font-semibold text-button-tertiary-fg text-sm", href: viewAllUrl ?? '/jackpots', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx(OverallProgressBar, {}), _jsx("div", { className: twMerge('max-h-[17rem] overflow-y-scroll', styles.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { className: twMerge('h-8 whitespace-nowrap bg-bg-secondary text-left font-medium text-text-tertiary-600 text-xs', className?.recentPayoutsTableHeadRow), children: [
132
+ 'Stage',
133
+ 'Player',
134
+ 'Turnover Target',
135
+ 'Prize',
136
+ 'Timestamp',
137
+ ].map((header) => (_jsx("th", { className: "px-4", children: header }, header))) }) }), _jsx("tbody", { children: jackpot.stages
138
+ ? jackpot.stages.map((j, i) => (_jsxs("tr", { className: twMerge('whitespace-nowrap bg-bg-primary text-left text-sm text-text-secondary-700', className?.recentPayoutsTableBodyRow), children: [_jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: i + 1 }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: j.member?.name
139
+ ? mask(j.member.name, {
140
+ totalCharsCount: 6,
141
+ })
142
+ : '-' }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: formatNumber(j.targetTurnover, {
143
+ currency: localeInfo.currency.code,
144
+ minDecimalPlaces: 2,
145
+ maxDecimalPlaces: 2,
146
+ }) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4 text-brand-400', className?.recentPayoutsTableBodyData), children: formatNumber(j.jackpotPayout, {
147
+ currency: localeInfo.currency.code,
148
+ minDecimalPlaces: 2,
149
+ maxDecimalPlaces: 2,
150
+ }) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: j.dateTimeCompleted
151
+ ? format(new Date(j.dateTimeCompleted), 'dd MMM yyyy h:mm a')
152
+ : '-' })] }, i)))
153
+ : Array.from({ length: 10 }).map((_, i) => (_jsx("tr", { className: twMerge('bg-bg-primary text-sm text-text-secondary-700', className?.recentPayoutsTableBodyRow), children: Array.from({ length: 5 }).map((_, j) => (_jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2', className?.recentPayoutsTableBodyData), children: "-" }, j))) }, i))) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute top-safe-area-inset-top right-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:9.375rem]') }))] }));
154
+ }
155
+ function getPercentage(value, total) {
156
+ const v = parseDecimal(value, 0);
157
+ const t = parseDecimal(total, 0);
158
+ return t === 0 ? 0 : (v / t) * 100;
159
+ }
@@ -32,7 +32,6 @@ export interface ClassNameEntries {
32
32
  interface StyleEntries {
33
33
  root?: CSSProperties;
34
34
  itemRoot?: CSSProperties;
35
- multiStageItemRoot?: CSSProperties;
36
35
  }
37
36
  export interface JackpotsListProps {
38
37
  layout: 'list';
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { Progress } from '@ark-ui/react/progress';
3
3
  import { format } from 'date-fns';
4
4
  import Image, {} from 'next/image';
5
- import { useCallback, useEffect, useId, useState, } from 'react';
5
+ import { useEffect, useState } from 'react';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { ArrowNarrowDownIcon } from '../../../icons/ArrowNarrowDownIcon.js';
8
8
  import { ArrowNarrowUpIcon } from '../../../icons/ArrowNarrowUpIcon.js';
@@ -31,7 +31,7 @@ function getPercentage(value, total) {
31
31
  }
32
32
  export function JackpotMultiStageMobile({ animate = true, customJackpotChestImage, jackpotProfileShape = 'oval', customJackpotStageChest, chestImagesByTier, className, ...props }) {
33
33
  const jackpot = useJackpotsListItemContext();
34
- const { rootRef, jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, } = useJackpotsListItemData();
34
+ const { rootRef, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, } = useJackpotsListItemData();
35
35
  const getChestImages = (stage) => {
36
36
  if (stage === 1) {
37
37
  return {
@@ -60,16 +60,6 @@ export function JackpotMultiStageMobile({ animate = true, customJackpotChestImag
60
60
  const [isDetailsVisible, setIsDetailsVisible] = useState(false);
61
61
  const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
62
62
  const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
63
- const mainTooltipId = useId();
64
- const minLimitTooltipId = useId();
65
- const handleMainTooltipClick = useCallback((e) => {
66
- e.stopPropagation();
67
- setMainTooltipOpen((prev) => !prev);
68
- }, []);
69
- const handleMinLimitTooltipClick = useCallback((e) => {
70
- e.stopPropagation();
71
- setMinLimitTooltipOpen((prev) => !prev);
72
- }, []);
73
63
  useEffect(() => {
74
64
  if (mainTooltipOpen) {
75
65
  const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);