@opexa/portal-components 0.0.726 → 0.0.728
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/client/hooks/useJackpotsNextQuery.d.ts +3 -0
- package/dist/client/hooks/useJackpotsNextQuery.js +22 -0
- package/dist/components/DigitainLauncher/Loading.js +1 -1
- package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
- package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
- package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
- package/dist/components/Disclaimer/TermsOfUse.js +13 -0
- package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
- package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
- package/dist/components/FeatureFlag/index.d.ts +1 -0
- package/dist/components/FeatureFlag/index.js +1 -0
- package/dist/components/Jackpots/Jackpots.js +13 -0
- package/dist/components/Jackpots/Jackpots.module.css +219 -184
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +16 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsList.js +7 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsListNext/JackpotMultiStageDesktop.d.ts +33 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotMultiStageDesktop.js +107 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotMultiStageMobile.d.ts +55 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotMultiStageMobile.js +136 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsList.d.ts +106 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsList.js +51 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListContext.d.ts +12 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListContext.js +3 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemDesktop.d.ts +43 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemDesktop.js +117 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemGameProviders.d.ts +5 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemGameProviders.js +54 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemMobile.d.ts +43 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemMobile.js +147 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemRules.d.ts +8 -0
- package/dist/components/Jackpots/JackpotsListNext/JackpotsListItemRules.js +15 -0
- package/dist/components/Jackpots/JackpotsListNext/useJackpotsListItemData.d.ts +20 -0
- package/dist/components/Jackpots/JackpotsListNext/useJackpotsListItemData.js +88 -0
- package/dist/components/KYC/AutoOpen.d.ts +1 -0
- package/dist/components/KYC/AutoOpen.js +40 -0
- package/dist/components/KYC/BasicInformation.js +1 -1
- package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
- package/dist/components/KYC/CaptureIdDocument.js +219 -0
- package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
- package/dist/components/KYC/CaptureSelfie.js +285 -0
- package/dist/components/KYC/DisplayImage.d.ts +5 -0
- package/dist/components/KYC/DisplayImage.js +8 -0
- package/dist/components/KYC/FileUpload.d.ts +10 -0
- package/dist/components/KYC/FileUpload.js +72 -0
- package/dist/components/KYC/IdentityVerification.js +1 -1
- package/dist/components/KYC/KYC.lazy.js +1 -1
- package/dist/components/KYC/KYCDefault/IdentityVerification.js +9 -7
- package/dist/components/KYC/KYCDefault/KYCDefault.js +1 -1
- package/dist/components/KYC/KYCDefault/KYCVerificationStatus.lazy.js +2 -2
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +13 -7
- package/dist/components/KYC/KycOpenOnHomeMount.js +9 -30
- package/dist/components/KYC/NoCameraError.d.ts +7 -0
- package/dist/components/KYC/NoCameraError.js +6 -0
- package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
- package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
- package/dist/components/KYC/PersonalInformation.js +1 -1
- package/dist/components/KYC/backup/Header.d.ts +1 -0
- package/dist/components/KYC/backup/Header.js +8 -0
- package/dist/components/KYC/backup/Indicator.d.ts +1 -0
- package/dist/components/KYC/backup/Indicator.js +9 -0
- package/dist/components/KYC/backup/KYC.d.ts +1 -0
- package/dist/components/KYC/backup/KYC.js +14 -0
- package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
- package/dist/components/KYC/backup/KYC.lazy.js +26 -0
- package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
- package/dist/components/KYC/backup/KYCContext.js +2 -0
- package/dist/components/KYC/backup/Step1.d.ts +1 -0
- package/dist/components/KYC/backup/Step1.js +13 -0
- package/dist/components/KYC/backup/Step2.d.ts +1 -0
- package/dist/components/KYC/backup/Step2.js +13 -0
- package/dist/components/KYC/backup/Step3.d.ts +1 -0
- package/dist/components/KYC/backup/Step3.js +13 -0
- package/dist/components/KYC/backup/Step4.d.ts +1 -0
- package/dist/components/KYC/backup/Step4.js +7 -0
- package/dist/components/KYC/backup/useKYC.d.ts +10 -0
- package/dist/components/KYC/backup/useKYC.js +8 -0
- package/dist/components/KYC/loadModels.d.ts +1 -0
- package/dist/components/KYC/loadModels.js +9 -0
- package/dist/components/KYC/utils.d.ts +9 -0
- package/dist/components/KYC/utils.js +79 -0
- package/dist/components/Messages/Message.d.ts +1 -0
- package/dist/components/Messages/Message.js +35 -0
- package/dist/components/Messages/MessageContext.d.ts +6 -0
- package/dist/components/Messages/MessageContext.js +2 -0
- package/dist/components/Messages/MessagePopup.d.ts +1 -0
- package/dist/components/Messages/MessagePopup.js +20 -0
- package/dist/components/Messages/MessageTrigger.d.ts +8 -0
- package/dist/components/Messages/MessageTrigger.js +19 -0
- package/dist/components/Quests/CountdownTimer.d.ts +15 -0
- package/dist/components/Quests/CountdownTimer.js +33 -0
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
- package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
- package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
- package/dist/components/SignIn/utils.d.ts +8 -0
- package/dist/components/SignIn/utils.js +26 -0
- package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
- package/dist/components/SignUp/SignUp.lazy.js +18 -0
- package/dist/components/SignUp/SignUpContext.d.ts +6 -0
- package/dist/components/SignUp/SignUpContext.js +2 -0
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
- package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
- package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
- package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
- package/dist/components/SignUp/SignUpForm.d.ts +1 -0
- package/dist/components/SignUp/SignUpForm.js +284 -0
- package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
- package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
- package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
- package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
- package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
- package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
- package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
- package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
- package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
- package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
- package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
- package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
- package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
- package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
- package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
- package/dist/components/shared/IdDocumentField.client.js +204 -0
- package/dist/components/shared/IdDocumentField.d.ts +2 -0
- package/dist/components/shared/IdDocumentField.js +11 -0
- package/dist/components/shared/IdFrontImageField/IdFrontImageField.client.js +0 -1
- package/dist/components/shared/SelfieField.client.d.ts +20 -0
- package/dist/components/shared/SelfieField.client.js +327 -0
- package/dist/components/shared/SelfieField.d.ts +2 -0
- package/dist/components/shared/SelfieField.js +11 -0
- package/dist/constants/BranchCode.d.ts +4 -0
- package/dist/constants/BranchCode.js +42 -0
- package/dist/constants/Branches.d.ts +2 -0
- package/dist/constants/Branches.js +42 -0
- package/dist/constants/EnvVar.d.ts +1 -1
- package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
- package/dist/handlers/postTransformIdFrontImage.js +67 -0
- package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
- package/dist/handlers/postTransformSelfieImage.js +71 -0
- package/dist/handlers.d.ts +43 -0
- package/dist/handlers.js +297 -0
- package/dist/icons/BellRingIcon.d.ts +2 -0
- package/dist/icons/BellRingIcon.js +4 -0
- package/dist/icons/Flag05Icon.d.ts +2 -0
- package/dist/icons/Flag05Icon.js +4 -0
- package/dist/server/utils/prefetchJackpotsNextQuery.d.ts +2 -0
- package/dist/server/utils/prefetchJackpotsNextQuery.js +16 -0
- package/dist/services/queries.d.ts +2 -1
- package/dist/services/queries.js +3069 -3009
- package/dist/services/report.d.ts +21 -1
- package/dist/services/report.js +13 -1
- package/dist/styles/theme.css +773 -773
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +1 -0
- package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
- package/dist/third-parties/FacebookPixel/index.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
- package/dist/third-parties/index.d.ts +2 -0
- package/dist/third-parties/index.js +2 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +72 -72
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +198 -198
- package/dist/ui/Menu/menu.recipe.d.ts +11 -11
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/utils/dataUrlToBlob.d.ts +1 -0
- package/dist/utils/dataUrlToBlob.js +11 -0
- package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
- package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
- package/dist/utils/getGameName.d.ts +1 -0
- package/dist/utils/getGameName.js +6 -0
- package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
- package/dist/utils/isBetween3amAnd3pm.js +5 -0
- package/dist/utils/queryKeys.d.ts +1 -0
- package/dist/utils/queryKeys.js +1 -0
- package/dist/utils/resizeImageSize.d.ts +2 -0
- package/dist/utils/resizeImageSize.js +11 -0
- package/package.json +176 -176
- package/dist/components/AccountInfo/GoogleDisconnect.d.ts +0 -7
- package/dist/components/AccountInfo/GoogleDisconnect.js +0 -11
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .js +0 -191
- package/dist/icons/LinkBrokenIcon.d.ts +0 -2
- package/dist/icons/LinkBrokenIcon.js +0 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Progress } from '@ark-ui/react/progress';
|
|
3
|
+
import { format } from 'date-fns';
|
|
4
|
+
import Image, {} from 'next/image';
|
|
5
|
+
import { useCallback, useEffect, useId, useState, } from 'react';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { ArrowNarrowDownIcon } from '../../../icons/ArrowNarrowDownIcon.js';
|
|
8
|
+
import { ArrowNarrowUpIcon } from '../../../icons/ArrowNarrowUpIcon.js';
|
|
9
|
+
import { ArrowNarrowUpRightIcon } from '../../../icons/ArrowNarrowUpRightIcon.js';
|
|
10
|
+
import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
|
|
11
|
+
import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
|
|
12
|
+
import { StarIcon } from '../../../icons/StarIcon.js';
|
|
13
|
+
import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
|
|
14
|
+
import { User01Icon } from '../../../icons/User01Icon.js';
|
|
15
|
+
import closeChest from '../../../images/close-chest.png';
|
|
16
|
+
import firstPlace from '../../../images/first-place.png';
|
|
17
|
+
import openChest from '../../../images/open-chest.png';
|
|
18
|
+
import { Button } from '../../../ui/Button/index.js';
|
|
19
|
+
import { Tooltip } from '../../../ui/Tooltip/index.js';
|
|
20
|
+
import { capitalize } from '../../../utils/capitalize.js';
|
|
21
|
+
import { formatNumber } from '../../../utils/formatNumber.js';
|
|
22
|
+
import { mask } from '../../../utils/mask.js';
|
|
23
|
+
import { parseDecimal } from '../../../utils/parseDecimal.js';
|
|
24
|
+
import styles from '../Jackpots.module.css';
|
|
25
|
+
import { useJackpotsListItemContext } from './JackpotsListContext.js';
|
|
26
|
+
import { JackpotsListItemGameProviders } from './JackpotsListItemGameProviders.js';
|
|
27
|
+
import { JackpotsListItemRules } from './JackpotsListItemRules.js';
|
|
28
|
+
import { useJackpotsListItemData } from './useJackpotsListItemData.js';
|
|
29
|
+
function getPercentage(value, total) {
|
|
30
|
+
const v = parseDecimal(value, 0);
|
|
31
|
+
const t = parseDecimal(total, 0);
|
|
32
|
+
return t === 0 ? 0 : (v / t) * 100;
|
|
33
|
+
}
|
|
34
|
+
export function JackpotsListItemMobile({ animate = true, customJackpotChestImage, jackpotProfileShape = 'oval', chestImagesByTier, className, ...props }) {
|
|
35
|
+
const jackpot = useJackpotsListItemContext();
|
|
36
|
+
const { rootRef, jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, getTierFromName, } = useJackpotsListItemData();
|
|
37
|
+
const getChestImages = () => {
|
|
38
|
+
// Priority: chestImagesByTier > customJackpotChestImage > default
|
|
39
|
+
if (chestImagesByTier) {
|
|
40
|
+
const tier = getTierFromName(jackpot.name);
|
|
41
|
+
const tierImages = chestImagesByTier[tier] || chestImagesByTier.default;
|
|
42
|
+
if (tierImages) {
|
|
43
|
+
return {
|
|
44
|
+
open: tierImages.open,
|
|
45
|
+
closed: tierImages.closed,
|
|
46
|
+
style: chestImagesByTier.style,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (customJackpotChestImage?.image) {
|
|
51
|
+
return {
|
|
52
|
+
open: customJackpotChestImage.image.open,
|
|
53
|
+
closed: customJackpotChestImage.image.closed,
|
|
54
|
+
style: customJackpotChestImage.style,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Default fallback
|
|
58
|
+
return {
|
|
59
|
+
open: openChest,
|
|
60
|
+
closed: closeChest,
|
|
61
|
+
style: undefined,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const chestImages = getChestImages();
|
|
65
|
+
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
|
66
|
+
const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
|
|
67
|
+
const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
|
|
68
|
+
const mainTooltipId = useId();
|
|
69
|
+
const minLimitTooltipId = useId();
|
|
70
|
+
const handleMainTooltipClick = useCallback((e) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
setMainTooltipOpen((prev) => !prev);
|
|
73
|
+
}, []);
|
|
74
|
+
const handleMinLimitTooltipClick = useCallback((e) => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
setMinLimitTooltipOpen((prev) => !prev);
|
|
77
|
+
}, []);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (mainTooltipOpen) {
|
|
80
|
+
const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);
|
|
81
|
+
return () => clearTimeout(timeout);
|
|
82
|
+
}
|
|
83
|
+
}, [mainTooltipOpen]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (minLimitTooltipOpen) {
|
|
86
|
+
const timeout = setTimeout(() => setMinLimitTooltipOpen(false), 3000);
|
|
87
|
+
return () => clearTimeout(timeout);
|
|
88
|
+
}
|
|
89
|
+
}, [minLimitTooltipOpen]);
|
|
90
|
+
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" })] }));
|
|
91
|
+
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) }), "Recent Payout"] }));
|
|
92
|
+
const ProgressBar = () => (_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", children: formatNumber(0, {
|
|
93
|
+
currency: localeInfo.currency.code,
|
|
94
|
+
compact: true,
|
|
95
|
+
}) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-red-flash-1']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-red-flash-2']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-red-flash-3']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-green-flash-1']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-green-flash-2']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-green-flash-3']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
96
|
+
currency: localeInfo.currency.code,
|
|
97
|
+
compact: true,
|
|
98
|
+
}) })] })] }), _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, { open: mainTooltipOpen, onOpenChange: (details) => setMainTooltipOpen(details.open), 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, {
|
|
99
|
+
currency: localeInfo.currency.code,
|
|
100
|
+
minDecimalPlaces: 2,
|
|
101
|
+
maxDecimalPlaces: 2,
|
|
102
|
+
})] }), _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: minLimitTooltipOpen, onOpenChange: (details) => 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: {
|
|
103
|
+
width: `${getPercentage(jackpot.minimumJackpotPoolDrawingLimit, jackpot.pool)}%`,
|
|
104
|
+
}, 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, {
|
|
105
|
+
currency: localeInfo.currency.code,
|
|
106
|
+
minDecimalPlaces: 2,
|
|
107
|
+
maxDecimalPlaces: 2,
|
|
108
|
+
})] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] })] }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
|
|
109
|
+
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
110
|
+
currency: localeInfo.currency.code,
|
|
111
|
+
compact: true,
|
|
112
|
+
})} Play now for your chance to win big! 🔥`
|
|
113
|
+
: getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] }));
|
|
114
|
+
const RecentPayoutsTable = () => (_jsx("div", { className: "overflow-x-auto border-gray-200", children: _jsxs("table", { className: "w-full min-w-[37.5rem]", 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: [
|
|
115
|
+
'Player',
|
|
116
|
+
'Game Provider',
|
|
117
|
+
'Multiplier',
|
|
118
|
+
'Prize',
|
|
119
|
+
'Timestamp',
|
|
120
|
+
].map((header) => (_jsx("th", { className: "px-4", children: header }, header))) }) }), _jsx("tbody", { children: jackpotPayouts.length
|
|
121
|
+
? jackpotPayouts.map((jackpotPayout, 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(jackpotPayout.member.name, {
|
|
122
|
+
totalCharsCount: 6,
|
|
123
|
+
}) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: capitalize(jackpotPayout.game?.provider ?? '-', {
|
|
124
|
+
delimiter: capitalize.delimiters.UNDERSCORE,
|
|
125
|
+
}) }), _jsxs("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4 text-brand-400', className?.recentPayoutsTableBodyData), children: formatNumber(jackpotPayout.amount, {
|
|
126
|
+
currency: localeInfo.currency.code,
|
|
127
|
+
minDecimalPlaces: 2,
|
|
128
|
+
maxDecimalPlaces: 2,
|
|
129
|
+
}) }), _jsx("td", { className: twMerge('h-12 border-border-secondary border-t-2 px-4', className?.recentPayoutsTableBodyData), children: format(new Date(jackpotPayout.dateTimeCreated), 'dd MMM yyyy h:mm a') })] }, i)))
|
|
130
|
+
: Array.from({ length: 10 }).map((_, i) => (_jsx("tr", { className: twMerge('bg-bg-primary text-left 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 px-4', className?.recentPayoutsTableBodyData), children: "-" }, j))) }, i))) })] }) }));
|
|
131
|
+
if (jackpot.status === 'DISABLED' && jackpot.drawing !== true) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return (_jsxs("div", { ref: rootRef, className: twMerge('rounded-2xl border border-border-primary bg-bg-primary', className?.itemRoot), children: [_jsxs("div", { style: props.style, className: "relative flex shrink-0 rounded-2xl bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5", 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: _jsx("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: twMerge('right-0 bottom-[-60] z-1 block min-w-34.5 lg:absolute', chestImages?.style?.wrapper), children: _jsx(Image, { width: 100, height: 100, src: isPayingOut ? chestImages.open : chestImages.closed, alt: "chest", className: twMerge('size-full h-34.5 w-34.5 p-2 lg:h-37.5 lg:w-37.5', chestImages?.style?.image) }) })] }) }) }) }), _jsx(ProgressBar, {}), _jsx("div", { className: twMerge('relative mt-4 flex w-full gap-4 rounded-lg bg-bg-primary p-4', className?.latestPayoutRoot), children: topJackpotPayout?.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(topJackpotPayout.member.name, {
|
|
139
|
+
totalCharsCount: 6,
|
|
140
|
+
}) }), _jsx("div", { className: twMerge('text-2xl text-brand-400', className?.latestPayoutAmount), children: formatNumber(topJackpotPayout.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: "closeChest", 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!" })] })] })) }), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute top-safe-area-inset-top right-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:9.375rem]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: twMerge('font-semibold text-lg text-text-primary-900', className?.recentPayoutsHeading), children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' }) }), _jsx(JackpotsListItemRules, { className: {
|
|
145
|
+
button: className?.recentPayoutsJackpotRulesButton,
|
|
146
|
+
} })] }), _jsx(RecentPayoutsTable, {})] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotsListItemGameProviders, { gameProviders: filteredGameProviders })), _jsx("div", { className: "m-3", children: _jsx(Button, { variant: "outline", className: twMerge('px-3.5 py-2.5 text-sm', !isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["Hide", _jsx(ArrowNarrowUpIcon, { className: "size-5" })] }) }) })] }))] }));
|
|
147
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
export interface ClassNameEntries {
|
|
3
|
+
root?: string;
|
|
4
|
+
button?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function JackpotsListItemRules(props: PropsWithChildren<{
|
|
7
|
+
className?: string | ClassNameEntries;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flag06Icon } from '../../../icons/Flag06Icon.js';
|
|
3
|
+
import { XIcon } from '../../../icons/XIcon.js';
|
|
4
|
+
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
5
|
+
import { Portal } from '../../../ui/Portal/index.js';
|
|
6
|
+
import { useJackpotsListItemContext } from './JackpotsListContext.js';
|
|
7
|
+
export function JackpotsListItemRules(props) {
|
|
8
|
+
const classNames = typeof props.className === 'string'
|
|
9
|
+
? { root: props.className }
|
|
10
|
+
: (props.className ?? {});
|
|
11
|
+
const jackpot = useJackpotsListItemContext();
|
|
12
|
+
return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? (_jsx("button", { type: "button", className: classNames.button ??
|
|
13
|
+
'flex font-semibold text-button-tertiary-fg text-sm', children: "Jackpot Rules" })) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: classNames.root ??
|
|
14
|
+
'mx-auto h-full w-full items-start overflow-y-auto lg:h-auto lg:max-h-[80vh] lg:w-[640px] lg:rounded-xl', children: [_jsxs("div", { className: "p-3xl", children: [_jsxs("div", { className: "mb-3 flex justify-between", children: [_jsx("div", { className: "flex h-12 w-12 items-center justify-center rounded-lg border border-border-primary bg-bg-tertiary", children: _jsx(Flag06Icon, { className: "size-full p-3 text-text-tertiary-600" }) }), _jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: "Jackpot Rules" }), _jsx("div", { className: "mt-1 text-sm text-text-tertiary-600", children: "Terms and Conditions" })] }), _jsx("div", { className: "border-gray-800 border-t-1 pb-3", children: _jsx("div", { dangerouslySetInnerHTML: { __html: jackpot.description }, className: "px-3xl py-3" }) })] }) })] })] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GameProvider } from '../../../types';
|
|
2
|
+
export declare function useJackpotsListItemData(): {
|
|
3
|
+
rootRef: (node?: Element | null) => void;
|
|
4
|
+
jackpotPayouts: import("../../../types").JackpotPayout[];
|
|
5
|
+
topJackpotPayout: import("../../../types").JackpotPayout;
|
|
6
|
+
filteredGameProviders: {
|
|
7
|
+
redirectUrl: string;
|
|
8
|
+
providedLogo: string | import("next/dist/shared/lib/get-img-props").StaticImport | undefined;
|
|
9
|
+
id: GameProvider;
|
|
10
|
+
slug: string;
|
|
11
|
+
logo: import("next/image").ImageProps["src"];
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
localeInfo: import("../../../utils/getLocaleInfo").LocaleInfo;
|
|
15
|
+
isPayingOut: boolean;
|
|
16
|
+
jackpotAmount: string;
|
|
17
|
+
arrowImages: import("react/jsx-runtime").JSX.Element[];
|
|
18
|
+
getAccumulatingJackpotDescription: (part: number, total: number) => string;
|
|
19
|
+
getTierFromName: (name: string) => "grand" | "major" | "minor" | "default";
|
|
20
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from 'react';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { useIntersectionObserver } from 'usehooks-ts';
|
|
5
|
+
import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
|
|
6
|
+
import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
|
|
7
|
+
import { GAME_PROVIDER_DATA } from '../../../constants/index.js';
|
|
8
|
+
import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
|
|
9
|
+
import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
|
|
10
|
+
import styles from '../Jackpots.module.css';
|
|
11
|
+
import { useJackpotsListItemContext, useJackpotsListPropsContext, } from './JackpotsListContext.js';
|
|
12
|
+
export function useJackpotsListItemData() {
|
|
13
|
+
const jackpotsListProps = useJackpotsListPropsContext();
|
|
14
|
+
const jackpot = useJackpotsListItemContext();
|
|
15
|
+
const gameProviders = Object.entries(jackpotsListProps.gameProviders ?? {}).map(([key, cfg]) => {
|
|
16
|
+
const id = key;
|
|
17
|
+
const base = GAME_PROVIDER_DATA[id];
|
|
18
|
+
return {
|
|
19
|
+
...base,
|
|
20
|
+
redirectUrl: cfg.redirectUrl,
|
|
21
|
+
providedLogo: cfg.image,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const [rootRef, inView] = useIntersectionObserver({
|
|
25
|
+
threshold: 0.25,
|
|
26
|
+
});
|
|
27
|
+
const jackpotPayoutsQuery = useJackpotPayoutsQuery({
|
|
28
|
+
first: 30,
|
|
29
|
+
filter: {
|
|
30
|
+
jackpot: {
|
|
31
|
+
equal: jackpot.id,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
}, {
|
|
35
|
+
enabled: typeof window !== 'undefined' && inView,
|
|
36
|
+
});
|
|
37
|
+
const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
38
|
+
const topJackpotPayout = jackpotPayouts[0] ?? [];
|
|
39
|
+
const enabledJackpotGameProviders = useMemo(() => {
|
|
40
|
+
const gameProvider = Object.entries(jackpot?.jackpotTurnoverContributionPercentagePerGameProvider ?? {})
|
|
41
|
+
.filter(([, value]) => Number(value) > 0)
|
|
42
|
+
.map(([key]) => key);
|
|
43
|
+
return gameProvider;
|
|
44
|
+
}, [jackpot]);
|
|
45
|
+
const filteredGameProviders = gameProviders.filter((provider) => enabledJackpotGameProviders.includes(provider.id));
|
|
46
|
+
const localeInfo = useLocaleInfo();
|
|
47
|
+
const isPayingOut = jackpot.drawing;
|
|
48
|
+
const jackpotAmount = jackpot.pool;
|
|
49
|
+
const Arrow = useCallback(({ index }) => {
|
|
50
|
+
const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
|
|
51
|
+
return (_jsx(Icon, { className: twMerge('min-w-2.5 scale-400 text-brand-300 lg:min-w-4 lg:scale-250', isPayingOut
|
|
52
|
+
? styles['animate-wave-color-error']
|
|
53
|
+
: styles['animate-wave-color-success']), style: {
|
|
54
|
+
animationDelay: isPayingOut
|
|
55
|
+
? `${(40 - index - 1) * 0.1}s`
|
|
56
|
+
: `${index * 0.1}s`,
|
|
57
|
+
} }));
|
|
58
|
+
}, [isPayingOut]);
|
|
59
|
+
const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
|
|
60
|
+
const getAccumulatingJackpotDescription = (part, total) => {
|
|
61
|
+
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
62
|
+
return percentage <= 90
|
|
63
|
+
? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
|
|
64
|
+
: '🔥 It’s about to pop! Stay in the game for your shot at the prize!';
|
|
65
|
+
};
|
|
66
|
+
const getTierFromName = (name) => {
|
|
67
|
+
const lowerName = name.toLowerCase();
|
|
68
|
+
if (lowerName.includes('grand'))
|
|
69
|
+
return 'grand';
|
|
70
|
+
if (lowerName.includes('major'))
|
|
71
|
+
return 'major';
|
|
72
|
+
if (lowerName.includes('minor'))
|
|
73
|
+
return 'minor';
|
|
74
|
+
return 'default';
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
rootRef,
|
|
78
|
+
jackpotPayouts,
|
|
79
|
+
topJackpotPayout,
|
|
80
|
+
filteredGameProviders,
|
|
81
|
+
localeInfo,
|
|
82
|
+
isPayingOut,
|
|
83
|
+
jackpotAmount,
|
|
84
|
+
arrowImages,
|
|
85
|
+
getAccumulatingJackpotDescription,
|
|
86
|
+
getTierFromName,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AutoOpen(): null;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useShallow } from 'zustand/shallow';
|
|
3
|
+
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
4
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
5
|
+
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
6
|
+
import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
7
|
+
import { KYC_PROMPT_LOCALSTORAGE_KEY } from '../../constants/index.js';
|
|
8
|
+
export function AutoOpen() {
|
|
9
|
+
const kycStore = useGlobalStore(useShallow((ctx) => ctx.kyc));
|
|
10
|
+
const { data: session } = useSessionQuery();
|
|
11
|
+
const { data: account } = useAccountQuery();
|
|
12
|
+
const { data: verification } = useMemberVerificationQuery();
|
|
13
|
+
const isBasicInfoCompleted = account?.realName !== null && account?.birthDay !== null;
|
|
14
|
+
const isUploadCompleted = verification &&
|
|
15
|
+
verification.idFrontImage !== null &&
|
|
16
|
+
verification.selfieImage !== null;
|
|
17
|
+
const isRejected = Boolean(verification?.status === 'REJECTED');
|
|
18
|
+
const step = !isBasicInfoCompleted
|
|
19
|
+
? 1
|
|
20
|
+
: isRejected
|
|
21
|
+
? 2
|
|
22
|
+
: isUploadCompleted
|
|
23
|
+
? 3
|
|
24
|
+
: 2;
|
|
25
|
+
const shouldOpen = !isBasicInfoCompleted || !isUploadCompleted || isRejected;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (session?.status == 'authenticated' &&
|
|
28
|
+
shouldOpen &&
|
|
29
|
+
localStorage.getItem(KYC_PROMPT_LOCALSTORAGE_KEY) === null) {
|
|
30
|
+
kycStore.setKycReminder(true);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}, [kycStore, session?.status, shouldOpen]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (step) {
|
|
36
|
+
kycStore.setStep(step);
|
|
37
|
+
}
|
|
38
|
+
}, [kycStore, step]);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
@@ -84,7 +84,7 @@ export function BasicInformation() {
|
|
|
84
84
|
});
|
|
85
85
|
},
|
|
86
86
|
});
|
|
87
|
-
return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold
|
|
87
|
+
return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Basic Information" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Enter your basic details for identification and communication." }), _jsxs("form", { className: "mt-3", onSubmit: form.handleSubmit((data) => {
|
|
88
88
|
invariant(account);
|
|
89
89
|
const input = omitBy({
|
|
90
90
|
realName: account.realName === data.realName ? undefined : data.realName,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptureIdDocument(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { useUploadImageFileMutation } from '../../client/hooks/useUploadImageFileMutation.js';
|
|
6
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
7
|
+
import { Camera01Icon } from '../../icons/Camera01Icon.js';
|
|
8
|
+
import { CheckCircleIcon } from '../../icons/CheckCircleIcon.js';
|
|
9
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
10
|
+
import { Button } from '../../ui/Button/index.js';
|
|
11
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
12
|
+
import { useKYCContext } from './KYCContext.js';
|
|
13
|
+
import NoCameraError from './NoCameraError.js';
|
|
14
|
+
import { cameraErrorDescriptions, dataURLtoBlob, resizeFile, showPermissionInstructions, } from './utils.js';
|
|
15
|
+
export function CaptureIdDocument() {
|
|
16
|
+
const kyc = useKYCContext();
|
|
17
|
+
const { mutate, isPending } = useUploadImageFileMutation();
|
|
18
|
+
const [videoStream, setVideoStream] = useState(null);
|
|
19
|
+
const [cameraError, setCameraError] = useState(null);
|
|
20
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
21
|
+
const [selectedImage, setSelectedImage] = useState(null);
|
|
22
|
+
const [captureInProgress, setCaptureInProgress] = useState(false);
|
|
23
|
+
const [proccessImageCanvas, setProccessImageCanvas] = useState(null);
|
|
24
|
+
const videoElement = useRef(null);
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
function stopCamera() {
|
|
27
|
+
if (videoStream) {
|
|
28
|
+
videoStream.getTracks().forEach((track) => track.stop());
|
|
29
|
+
setVideoStream(null);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
return () => {
|
|
34
|
+
stopCamera();
|
|
35
|
+
};
|
|
36
|
+
}, [videoStream]);
|
|
37
|
+
async function startCamera() {
|
|
38
|
+
try {
|
|
39
|
+
setIsLoading(true);
|
|
40
|
+
setCameraError(null);
|
|
41
|
+
setCaptureInProgress(true);
|
|
42
|
+
console.log('Starting camera...');
|
|
43
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
44
|
+
video: {
|
|
45
|
+
facingMode: 'environment',
|
|
46
|
+
aspectRatio: 16 / 9,
|
|
47
|
+
width: { ideal: 1920, max: 1920 },
|
|
48
|
+
height: { ideal: 1080, max: 1080 },
|
|
49
|
+
frameRate: {
|
|
50
|
+
ideal: 30,
|
|
51
|
+
max: 60,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
audio: false,
|
|
55
|
+
});
|
|
56
|
+
// Set the stream directly to the video element
|
|
57
|
+
if (videoElement.current) {
|
|
58
|
+
videoElement.current.srcObject = stream;
|
|
59
|
+
videoElement.current.onloadedmetadata = () => {
|
|
60
|
+
console.log('Video metadata loaded, starting playback...');
|
|
61
|
+
videoElement.current
|
|
62
|
+
?.play()
|
|
63
|
+
.then(() => {
|
|
64
|
+
setVideoStream(stream);
|
|
65
|
+
setIsLoading(false);
|
|
66
|
+
})
|
|
67
|
+
.catch(() => {
|
|
68
|
+
setCameraError('Failed to start camera stream. Please try again.');
|
|
69
|
+
setIsLoading(false);
|
|
70
|
+
// Stop the stream if playback fails
|
|
71
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
videoElement.current.onerror = (err) => {
|
|
75
|
+
console.error('Video element error:', err);
|
|
76
|
+
setCameraError('Video playback error. Please try again.');
|
|
77
|
+
setIsLoading(false);
|
|
78
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.error('Video element not available');
|
|
83
|
+
setCameraError('Camera initialization failed. Please try again.');
|
|
84
|
+
setCaptureInProgress(false);
|
|
85
|
+
setIsLoading(false);
|
|
86
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
setIsLoading(false);
|
|
91
|
+
if (error instanceof DOMException) {
|
|
92
|
+
console.error('Error accessing camera:', error.message);
|
|
93
|
+
setCameraError(error.name);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
console.error('Unknown error accessing camera:', error);
|
|
97
|
+
setCameraError('An unknown error occurred. Please check permissions and try again.');
|
|
98
|
+
}
|
|
99
|
+
setCaptureInProgress(false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function captureAndProcessImage() {
|
|
103
|
+
if (!videoElement.current || !videoStream) {
|
|
104
|
+
console.error('Video element or stream not available for capture');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const canvas = document.createElement('canvas');
|
|
109
|
+
const parentDiv = document.getElementById('parent');
|
|
110
|
+
canvas.width = parentDiv?.clientWidth || videoElement.current.width;
|
|
111
|
+
canvas.height = parentDiv?.clientHeight || videoElement.current.height;
|
|
112
|
+
const ctx = canvas.getContext('2d');
|
|
113
|
+
if (!ctx) {
|
|
114
|
+
console.error('Could not get 2D context for canvas');
|
|
115
|
+
setCameraError('Failed to process image. Please try again.');
|
|
116
|
+
setCaptureInProgress(false);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
ctx.drawImage(videoElement.current, 0, 0, canvas.width, canvas.height);
|
|
120
|
+
const imageSrc = canvas.toDataURL('image/png', 1.0);
|
|
121
|
+
setSelectedImage({ src: imageSrc });
|
|
122
|
+
setCaptureInProgress(false);
|
|
123
|
+
stopCamera();
|
|
124
|
+
const newImg = document.createElement('img');
|
|
125
|
+
newImg.src = imageSrc;
|
|
126
|
+
//@ts-expect-error jscanify is not typed
|
|
127
|
+
const scanner = new jscanify();
|
|
128
|
+
newImg.onload = () => {
|
|
129
|
+
try {
|
|
130
|
+
if (containerRef.current) {
|
|
131
|
+
// containerRef.current.innerHTML = '';
|
|
132
|
+
const paperWidth = parentDiv?.clientWidth || videoElement.current?.videoWidth;
|
|
133
|
+
const paperHeight = parentDiv?.clientHeight || videoElement.current?.videoHeight;
|
|
134
|
+
//@ts-expect-error jscanify is not typed
|
|
135
|
+
const contour = scanner.findPaperContour(cv.imread(newImg));
|
|
136
|
+
const cornerPoints = scanner.getCornerPoints(contour);
|
|
137
|
+
const resultCanvas = scanner.extractPaper(newImg, paperWidth, paperHeight, cornerPoints);
|
|
138
|
+
newImg.className =
|
|
139
|
+
'absolute inset-0 m-auto w-full h-auto md:max-h-[333px] md:max-w-[643px] aspect-video rounded-lg object-contain';
|
|
140
|
+
setProccessImageCanvas(resultCanvas);
|
|
141
|
+
containerRef.current.appendChild(resultCanvas);
|
|
142
|
+
setCaptureInProgress(false);
|
|
143
|
+
setSelectedImage({ src: resultCanvas.toDataURL('image/png') });
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.error('Error processing image:', error);
|
|
148
|
+
setCameraError('Failed to process image. Please try again.');
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
newImg.onerror = () => {
|
|
152
|
+
console.error('Error loading image');
|
|
153
|
+
setCameraError('NoIdDetectedError');
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error('Error capturing image:', error);
|
|
158
|
+
setCameraError('NoIdDetectedError');
|
|
159
|
+
setCaptureInProgress(false);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async function uploadPhoto() {
|
|
163
|
+
if (!proccessImageCanvas) {
|
|
164
|
+
console.error('Failed to process the image. Please try again.');
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const blob = proccessImageCanvas.toDataURL('image/png', 1.0);
|
|
168
|
+
const processedBlob = dataURLtoBlob(blob);
|
|
169
|
+
const img = new File([processedBlob], 'frontImage', { type: 'image/jpeg' });
|
|
170
|
+
const resizedImage = (await resizeFile(img));
|
|
171
|
+
if (resizedImage) {
|
|
172
|
+
await mutate({
|
|
173
|
+
file: resizedImage,
|
|
174
|
+
}, {
|
|
175
|
+
onSuccess: (data) => {
|
|
176
|
+
kyc.setFrontImageId(data);
|
|
177
|
+
kyc.setCapturing(null);
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function retakePhoto() {
|
|
183
|
+
setSelectedImage(null);
|
|
184
|
+
setCaptureInProgress(true);
|
|
185
|
+
setCameraError(null);
|
|
186
|
+
if (containerRef.current) {
|
|
187
|
+
const canvas = containerRef.current.querySelector('canvas');
|
|
188
|
+
if (canvas) {
|
|
189
|
+
canvas.width = canvas.width;
|
|
190
|
+
}
|
|
191
|
+
containerRef.current.innerHTML = '';
|
|
192
|
+
}
|
|
193
|
+
if (videoElement.current) {
|
|
194
|
+
videoElement.current.play();
|
|
195
|
+
}
|
|
196
|
+
startCamera();
|
|
197
|
+
}
|
|
198
|
+
function checkCameraPermission() {
|
|
199
|
+
const constraints = { video: true };
|
|
200
|
+
navigator.mediaDevices
|
|
201
|
+
.getUserMedia(constraints)
|
|
202
|
+
.then(() => {
|
|
203
|
+
setCameraError(null);
|
|
204
|
+
startCamera();
|
|
205
|
+
})
|
|
206
|
+
.catch(() => {
|
|
207
|
+
showPermissionInstructions();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full p-4 lg:w-[640px] lg:px-12 lg:py-4xl", children: [_jsxs("button", { type: "button", className: "flex items-center gap-lg lg:absolute lg:right-5 lg:top-5 lg:p-md", onClick: () => {
|
|
211
|
+
stopCamera();
|
|
212
|
+
kyc.setCapturing(null);
|
|
213
|
+
}, children: [_jsx(XIcon, { className: "text-text-senary-300 hidden size-5 lg:block" }), _jsx(ArrowLeftIcon, { className: "text-text-senary-300 size-5 lg:hidden" }), _jsx("span", { className: "text-lg font-semibold lg:hidden", children: "Back" })] }), _jsx(Dialog.Title, { className: "mt-6 text-center text-lg font-semibold lg:mt-0", children: "Take a Picture of Your Front ID" }), _jsxs(Dialog.Description, { className: "lg:max-w-auto text-text-tertiary-600 mx-auto mt-sm max-w-[19rem] text-center text-sm lg:max-w-full", children: ["Make sure your ID is clearly visible, well-lit, and not blurry.", _jsx("br", { className: "hidden lg:block" }), " Avoid glare or reflections, and ensure all corners are within the frame."] }), _jsx("div", { id: "parent", className: "border-border-disabled mt-6 aspect-video rounded-xl border bg-black lg:mt-8", children: [
|
|
214
|
+
'NotAllowedError',
|
|
215
|
+
'NotReadableError',
|
|
216
|
+
'NotFoundError',
|
|
217
|
+
'NoIdDetectedError',
|
|
218
|
+
].includes(cameraError) ? (_jsx(NoCameraError, { onRetry: checkCameraPermission, title: "Camera Access Required", description: cameraErrorDescriptions[cameraError] })) : captureInProgress ? (_jsxs("div", { className: "relative flex h-fit w-full flex-col items-center justify-center", children: [_jsx("video", { ref: videoElement, autoPlay: true, muted: true, playsInline: true, className: "relative h-[50vh] w-full rounded-lg object-cover md:aspect-video md:max-h-[333px]", width: "100%", height: "100%" }), _jsxs("div", { className: "pointer-events-none absolute inset-0 z-50", children: [_jsx("div", { className: twMerge('absolute inset-0 w-full bg-black/60 backdrop-blur-sm [clip-path:polygon(0%_0%,0%_100%,calc(50%-158px)_100%,calc(50%-158px)_calc(50%-100px),calc(50%+158px)_calc(50%-100px),calc(50%+158px)_calc(50%+100px),calc(50%-158px)_calc(50%+100px),calc(50%-158px)_100%,100%_100%,100%_0%)] md:[clip-path:polygon(0%_0%,0%_100%,calc(50%-225px)_100%,calc(50%-225px)_calc(50%-142px),calc(50%+225px)_calc(50%-142px),calc(50%+225px)_calc(50%+142px),calc(50%-225px)_calc(50%+142px),calc(50%-225px)_100%,100%_100%,100%_0%)]') }), _jsx("div", { className: "absolute inset-0 z-[60] mx-auto flex items-center justify-center", children: _jsx("div", { className: "relative aspect-[1011/638] h-[200px] md:h-[295px] md:w-[450px]", children: _jsx("div", { className: "h-full w-full rounded-lg border-4 border-dashed border-[#B54708]" }) }) })] })] })) : (_jsx("div", { ref: containerRef, className: "relative grid h-full w-full place-items-center rounded-lg object-contain md:max-h-[333px]" })) }), captureInProgress ? (_jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-6 px-xl disabled:opacity-100 lg:mt-8 lg:w-fit", onClick: captureAndProcessImage, children: ["Capture Image", _jsx(Camera01Icon, { className: "size-5" })] })) : selectedImage && selectedImage.src ? (_jsxs("div", { className: "mt-4 flex flex-col items-center justify-center gap-2 md:flex-row", children: [_jsxs(Button, { className: "lg:w-fit", type: "button", onClick: retakePhoto, children: ["Retake Photo ", _jsx(Camera01Icon, { className: "ml-1" })] }), _jsxs(Button, { className: "lg:w-fit", type: "button", onClick: uploadPhoto, disabled: isPending, children: ["Use Photo ", _jsx(CheckCircleIcon, { className: "ml-1" })] })] })) : (_jsxs(Button, { className: twMerge('disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-6 px-xl disabled:opacity-100 lg:mt-8 lg:w-fit', cameraError && 'hidden'), onClick: startCamera, disabled: isLoading || !!videoStream, children: [isLoading ? 'Starting Camera...' : 'Start Camera', _jsx(Camera01Icon, { className: "size-5" })] }))] }) }));
|
|
219
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptureSelfie(): import("react/jsx-runtime").JSX.Element;
|