@opexa/portal-components 0.0.365 → 0.0.367
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/useCellxpertCxd.d.ts +7 -0
- package/dist/client/hooks/useCellxpertCxd.js +4 -0
- package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.d.ts +4 -0
- package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.js +28 -0
- package/dist/client/hooks/useIdle.d.ts +1 -0
- package/dist/client/hooks/useIdle.js +35 -0
- package/dist/client/hooks/useIdleLogout.d.ts +4 -0
- package/dist/client/hooks/useIdleLogout.js +97 -0
- package/dist/client/hooks/useMarkAllMessagesAsReadMutation.d.ts +2 -0
- package/dist/client/hooks/useMarkAllMessagesAsReadMutation.js +48 -0
- package/dist/client/hooks/useMayaAuth.d.ts +5 -0
- package/dist/client/hooks/useMayaAuth.js +22 -0
- package/dist/components/ForgotPassword/ForgotPasswordForm.js +1 -1
- package/dist/components/IdleLogout/IdleLogout.d.ts +7 -0
- package/dist/components/IdleLogout/IdleLogout.js +6 -0
- package/dist/components/IdleLogout/index.d.ts +1 -0
- package/dist/components/IdleLogout/index.js +1 -0
- package/dist/components/Jackpots/Jackpots.module.css +184 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/KYC/KYCReminder.lazy.js +1 -3
- package/dist/components/KYC/KycOpenOnHomeMount.d.ts +1 -0
- package/dist/components/KYC/KycOpenOnHomeMount.js +16 -0
- package/dist/components/Maya/Maya.d.ts +26 -0
- package/dist/components/Maya/Maya.js +90 -0
- package/dist/components/Maya/index.d.ts +1 -0
- package/dist/components/Maya/index.js +1 -0
- package/dist/components/PortalProvider/CXDTokenObserver.d.ts +1 -0
- package/dist/components/PortalProvider/CXDTokenObserver.js +30 -0
- package/dist/components/PortalProvider/SocialAccountLinkObserver.d.ts +1 -0
- package/dist/components/PortalProvider/SocialAccountLinkObserver.js +39 -0
- package/dist/components/Quests/MultiWageringQuest.d.ts +1 -0
- package/dist/components/Quests/MultiWageringQuest.js +111 -0
- package/dist/components/Quests/NoQuests.d.ts +6 -0
- package/dist/components/Quests/NoQuests.js +6 -0
- package/dist/components/SignIn/MobileNumberSignIn.js +1 -1
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +1 -1
- package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +1 -1
- package/dist/components/TopProgress/TopProgressBar.d.ts +6 -0
- package/dist/components/TopProgress/TopProgressBar.js +145 -0
- package/dist/components/TopProgress/index.d.ts +1 -0
- package/dist/components/TopProgress/index.js +1 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
- package/dist/components/TransactionRecords/TransactionContext.d.ts +6 -0
- package/dist/components/TransactionRecords/TransactionContext.js +2 -0
- package/dist/handlers/index.d.ts +7 -7
- package/dist/icons/MinusIcon.d.ts +2 -0
- package/dist/icons/MinusIcon.js +4 -0
- package/dist/icons/NotifExitIcon.d.ts +2 -0
- package/dist/icons/NotifExitIcon.js +4 -0
- package/dist/images/game-providers/SAGAMING.png +0 -0
- package/dist/images/pagcor-round-icon.png +0 -0
- package/dist/services/queries.js +2662 -2662
- package/dist/styles/theme.css +706 -706
- 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 +99 -99
- package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
- 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 +144 -144
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- 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/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/package.json +161 -161
- package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
- package/dist/components/DigitainLauncher/Loading.js +0 -5
- package/dist/components/Disclaimer/ResponsibleGaming.d.ts +0 -10
- package/dist/components/Disclaimer/ResponsibleGaming.js +0 -13
- package/dist/components/Disclaimer/TermsOfUse.d.ts +0 -11
- package/dist/components/Disclaimer/TermsOfUse.js +0 -13
- package/dist/components/FeatureFlag/FeatureFlag.d.ts +0 -1
- package/dist/components/FeatureFlag/FeatureFlag.js +0 -29
- package/dist/components/FeatureFlag/index.d.ts +0 -1
- package/dist/components/FeatureFlag/index.js +0 -1
- package/dist/components/KYC/AutoOpen.d.ts +0 -1
- package/dist/components/KYC/AutoOpen.js +0 -40
- package/dist/components/KYC/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/BasicInformation.js +0 -101
- package/dist/components/KYC/CaptureIdDocument.d.ts +0 -1
- package/dist/components/KYC/CaptureIdDocument.js +0 -219
- package/dist/components/KYC/CaptureSelfie.d.ts +0 -1
- package/dist/components/KYC/CaptureSelfie.js +0 -285
- package/dist/components/KYC/DisplayImage.d.ts +0 -5
- package/dist/components/KYC/DisplayImage.js +0 -8
- package/dist/components/KYC/FileUpload.d.ts +0 -10
- package/dist/components/KYC/FileUpload.js +0 -72
- package/dist/components/KYC/IdentityVerification.d.ts +0 -1
- package/dist/components/KYC/IdentityVerification.js +0 -120
- package/dist/components/KYC/Indicator.d.ts +0 -1
- package/dist/components/KYC/Indicator.js +0 -8
- package/dist/components/KYC/KYC.lazy.d.ts +0 -6
- package/dist/components/KYC/KYC.lazy.js +0 -45
- package/dist/components/KYC/KYCContext.d.ts +0 -6
- package/dist/components/KYC/KYCContext.js +0 -2
- package/dist/components/KYC/NoCameraError.d.ts +0 -7
- package/dist/components/KYC/NoCameraError.js +0 -6
- package/dist/components/KYC/PersonOverlayDesktop.d.ts +0 -7
- package/dist/components/KYC/PersonOverlayDesktop.js +0 -9
- package/dist/components/KYC/PersonalInformation.d.ts +0 -1
- package/dist/components/KYC/PersonalInformation.js +0 -122
- package/dist/components/KYC/backup/Header.d.ts +0 -1
- package/dist/components/KYC/backup/Header.js +0 -8
- package/dist/components/KYC/backup/Indicator.d.ts +0 -1
- package/dist/components/KYC/backup/Indicator.js +0 -9
- package/dist/components/KYC/backup/KYC.d.ts +0 -1
- package/dist/components/KYC/backup/KYC.js +0 -14
- package/dist/components/KYC/backup/KYC.lazy.d.ts +0 -1
- package/dist/components/KYC/backup/KYC.lazy.js +0 -26
- package/dist/components/KYC/backup/KYCContext.d.ts +0 -6
- package/dist/components/KYC/backup/KYCContext.js +0 -2
- package/dist/components/KYC/backup/Step1.d.ts +0 -1
- package/dist/components/KYC/backup/Step1.js +0 -13
- package/dist/components/KYC/backup/Step2.d.ts +0 -1
- package/dist/components/KYC/backup/Step2.js +0 -13
- package/dist/components/KYC/backup/Step3.d.ts +0 -1
- package/dist/components/KYC/backup/Step3.js +0 -13
- package/dist/components/KYC/backup/Step4.d.ts +0 -1
- package/dist/components/KYC/backup/Step4.js +0 -7
- package/dist/components/KYC/backup/useKYC.d.ts +0 -10
- package/dist/components/KYC/backup/useKYC.js +0 -8
- package/dist/components/KYC/loadModels.d.ts +0 -1
- package/dist/components/KYC/loadModels.js +0 -9
- package/dist/components/KYC/useKYC.d.ts +0 -25
- package/dist/components/KYC/useKYC.js +0 -38
- package/dist/components/KYC/utils.d.ts +0 -9
- package/dist/components/KYC/utils.js +0 -79
- package/dist/components/Messages/Message.d.ts +0 -1
- package/dist/components/Messages/Message.js +0 -35
- package/dist/components/Messages/MessageContext.d.ts +0 -6
- package/dist/components/Messages/MessageContext.js +0 -2
- package/dist/components/Messages/MessagePopup.d.ts +0 -1
- package/dist/components/Messages/MessagePopup.js +0 -20
- package/dist/components/Messages/MessageTrigger.d.ts +0 -8
- package/dist/components/Messages/MessageTrigger.js +0 -19
- package/dist/components/Quests/CountdownTimer.d.ts +0 -15
- package/dist/components/Quests/CountdownTimer.js +0 -33
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +0 -4
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +0 -78
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +0 -8
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +0 -9
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +0 -4
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +0 -4
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +0 -4
- package/dist/components/Quests/WageringQuest/WageringQuest.js +0 -20
- package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +0 -9
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +0 -9
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
- package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
- package/dist/components/SessionWatcher/index.d.ts +0 -1
- package/dist/components/SessionWatcher/index.js +0 -1
- package/dist/components/SignIn/utils.d.ts +0 -8
- package/dist/components/SignIn/utils.js +0 -26
- package/dist/components/SignUp/SignUp.lazy.d.ts +0 -12
- package/dist/components/SignUp/SignUp.lazy.js +0 -18
- package/dist/components/SignUp/SignUpContext.d.ts +0 -6
- package/dist/components/SignUp/SignUpContext.js +0 -2
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +0 -17
- package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +0 -18
- package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +0 -6
- package/dist/components/SignUp/SignUpDefault/SignUpContext.js +0 -2
- package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +0 -1
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +0 -310
- package/dist/components/SignUp/SignUpForm.d.ts +0 -1
- package/dist/components/SignUp/SignUpForm.js +0 -284
- package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +0 -1
- package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +0 -198
- package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +0 -1
- package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +0 -251
- package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +0 -10
- package/dist/components/SignUp/SignUpKYC/ImageUploader.js +0 -42
- package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +0 -7
- package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +0 -9
- package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +0 -1
- package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +0 -464
- package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +0 -11
- package/dist/components/SignUp/SignUpKYC/useImageUploader.js +0 -20
- package/dist/components/SignUp/SignUpKYC/utils.d.ts +0 -9
- package/dist/components/SignUp/SignUpKYC/utils.js +0 -79
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +0 -198
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +0 -251
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +0 -10
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +0 -41
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +0 -429
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +0 -13
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +0 -26
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +0 -7
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +0 -2
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +0 -11
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +0 -20
- package/dist/components/shared/IdDocumentField.client.d.ts +0 -25
- package/dist/components/shared/IdDocumentField.client.js +0 -204
- package/dist/components/shared/IdDocumentField.d.ts +0 -2
- package/dist/components/shared/IdDocumentField.js +0 -11
- package/dist/components/shared/SelfieField.client.d.ts +0 -20
- package/dist/components/shared/SelfieField.client.js +0 -327
- package/dist/components/shared/SelfieField.d.ts +0 -2
- package/dist/components/shared/SelfieField.js +0 -11
- package/dist/constants/BranchCode.d.ts +0 -4
- package/dist/constants/BranchCode.js +0 -42
- package/dist/constants/Branches.d.ts +0 -2
- package/dist/constants/Branches.js +0 -42
- package/dist/handlers/postTransformIdFrontImage.d.ts +0 -3
- package/dist/handlers/postTransformIdFrontImage.js +0 -67
- package/dist/handlers/postTransformSelfieImage.d.ts +0 -3
- package/dist/handlers/postTransformSelfieImage.js +0 -71
- package/dist/handlers.d.ts +0 -43
- package/dist/handlers.js +0 -297
- package/dist/icons/BellRingIcon.d.ts +0 -2
- package/dist/icons/BellRingIcon.js +0 -4
- package/dist/images/responsible-gaming-yellow.png +0 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
- package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
- package/dist/third-parties/FacebookPixel/index.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
- package/dist/third-parties/index.d.ts +0 -2
- package/dist/third-parties/index.js +0 -2
- package/dist/utils/dataUrlToBlob.d.ts +0 -1
- package/dist/utils/dataUrlToBlob.js +0 -11
- package/dist/utils/gamesAvailable3pmTo3am.d.ts +0 -1
- package/dist/utils/gamesAvailable3pmTo3am.js +0 -1
- package/dist/utils/getGameName.d.ts +0 -1
- package/dist/utils/getGameName.js +0 -6
- package/dist/utils/isBetween3amAnd3pm.d.ts +0 -1
- package/dist/utils/isBetween3amAnd3pm.js +0 -5
- package/dist/utils/resizeImageSize.d.ts +0 -2
- package/dist/utils/resizeImageSize.js +0 -11
- /package/dist/{third-parties/FacebookPixel/api.d.ts → components/KYCNotRequired/KYCNotRequired.d.ts} +0 -0
- /package/dist/{third-parties/FacebookPixel/api.js → components/KYCNotRequired/KYCNotRequired.js} +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useRouter, useSearchParams } from 'next/navigation';
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
import { useControllableState } from '../../client/hooks/useControllableState.js';
|
|
5
|
+
import { useDisclosure } from '../../client/hooks/useDisclosure.js';
|
|
6
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
7
|
+
import { Lock01Icon } from '../../icons/Lock01Icon.js';
|
|
8
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
9
|
+
import { Badge } from '../../ui/Badge/index.js';
|
|
10
|
+
import { Button } from '../../ui/Button/index.js';
|
|
11
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
12
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
13
|
+
import { Progress } from '../../ui/Progress/index.js';
|
|
14
|
+
import { formatNumber } from '../../utils/formatNumber.js';
|
|
15
|
+
import { useQuestContext } from './QuestsContext.js';
|
|
16
|
+
import { RemainingTime } from './RemainingTime.js';
|
|
17
|
+
export function MultiWageringQuest() {
|
|
18
|
+
const disclosure = useDisclosure();
|
|
19
|
+
const quest = useQuestContext();
|
|
20
|
+
const { stages, totalStage, currentStage, progressPercentage } = useMemo(() => {
|
|
21
|
+
const currentStage = quest.stages.filter((m) => m.cleared).length;
|
|
22
|
+
const progress = [];
|
|
23
|
+
const turnover = parseFloat(quest.turnover || '0');
|
|
24
|
+
let remaining = turnover;
|
|
25
|
+
const stageTargets = quest.stages.map((s) => parseFloat(s.targetTurnover));
|
|
26
|
+
for (const target of stageTargets) {
|
|
27
|
+
if (remaining <= 0) {
|
|
28
|
+
progress.push(0);
|
|
29
|
+
}
|
|
30
|
+
else if (remaining >= target) {
|
|
31
|
+
progress.push(100);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
progress.push((remaining / target) * 100);
|
|
35
|
+
}
|
|
36
|
+
remaining -= target;
|
|
37
|
+
}
|
|
38
|
+
if (!quest?.stages) {
|
|
39
|
+
return {
|
|
40
|
+
stages: [],
|
|
41
|
+
totalStage: 0,
|
|
42
|
+
currentStage: 0,
|
|
43
|
+
progressPercentage: 0,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const transformedStages = quest.stages.map((stage, idx) => ({
|
|
47
|
+
...stage,
|
|
48
|
+
progressValue: progress[idx],
|
|
49
|
+
}));
|
|
50
|
+
return {
|
|
51
|
+
stages: transformedStages,
|
|
52
|
+
totalStage: quest.stages.length,
|
|
53
|
+
currentStage: currentStage === 0 ? 1 : currentStage,
|
|
54
|
+
progressPercentage: +quest.progressPercentage,
|
|
55
|
+
};
|
|
56
|
+
}, [quest]);
|
|
57
|
+
const handleViewDetails = useCallback(() => {
|
|
58
|
+
disclosure.setOpen(true);
|
|
59
|
+
}, [disclosure]);
|
|
60
|
+
const localeInfo = useLocaleInfo();
|
|
61
|
+
const params = useSearchParams();
|
|
62
|
+
const questId = params.get('id');
|
|
63
|
+
const isOpen = useMemo(() => {
|
|
64
|
+
return questId === quest.id;
|
|
65
|
+
}, [questId, quest.id]);
|
|
66
|
+
const router = useRouter();
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx("div", { className: "flex max-h-7.5 items-center justify-between", children: _jsx(RemainingTime, { endOfDay: true }) }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Multi Stage Wagering Quest' }), _jsx("div", { className: "text-[#CECFD2] text-sm", dangerouslySetInnerHTML: {
|
|
68
|
+
__html: quest?.description ||
|
|
69
|
+
'Ready for a challenge? Complete them all and get amazing rewards!',
|
|
70
|
+
} }), _jsxs("div", { className: "flex items-center justify-between pt-5", children: [_jsxs("p", { className: "text-[#F5F5F6] text-sm", children: ["Progress: ", quest.progressPercentage, "%"] }), _jsxs("p", { className: "text-[#F5F5F6] text-sm", children: [quest.turnover, _jsxs("span", { className: "text-[#94969C]", children: ["/", quest.targetTurnover, " PHP"] })] })] }), _jsx(Progress.Root, { max: 100, className: "h-2 rounded-full bg-bg-primary", value: progressPercentage, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("p", { className: "text-[#F5F5F6] text-sm", children: ["Stage ", currentStage, " of ", totalStage] }), _jsx(Badge.Root, { size: "lg", className: "border border-border-badge bg-bg-badge", round: false, children: _jsxs(Badge.Label, { className: "!text-text-badge flex items-center justify-center text-xs", children: [_jsx("p", { className: "flex h-[10px] items-center justify-center", children: "+" }), ' ', formatNumber(quest.stages?.reduce((curr, prev) => {
|
|
71
|
+
return curr + Number(prev.bonusAmount || 0);
|
|
72
|
+
}, 0), {
|
|
73
|
+
currency: localeInfo.currency.code,
|
|
74
|
+
maxDecimalPlaces: 0,
|
|
75
|
+
minDecimalPlaces: 0,
|
|
76
|
+
}), ' ', "Bonus"] }) })] })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "aria-label": "View Details", disabled: quest.status === 'FAILED' || quest.status === 'COMPLETED', className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) })] }), _jsx(Stages, { open: disclosure.open || isOpen, onOpenChange: (open) => {
|
|
77
|
+
disclosure.setOpen(open);
|
|
78
|
+
router.push('/quests');
|
|
79
|
+
}, quest: quest, stages: stages })] }));
|
|
80
|
+
}
|
|
81
|
+
function Stages(props) {
|
|
82
|
+
const [open, setOpen] = useControllableState({
|
|
83
|
+
value: props.open,
|
|
84
|
+
defaultValue: props.defaultOpen ?? false,
|
|
85
|
+
onChange: props.onOpenChange,
|
|
86
|
+
});
|
|
87
|
+
const currentStage = useMemo(() => {
|
|
88
|
+
const stage = props?.stages?.findLastIndex((stage) => stage.cleared) ?? 0;
|
|
89
|
+
return stage !== -1 ? stage + 1 : 1;
|
|
90
|
+
}, [props.stages]);
|
|
91
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto mt-40 min-h-auto min-w-[23rem] max-w-[25rem] overflow-y-auto rounded-xl border border-border-wagering-popup px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: props.quest?.name || 'Quest' }), _jsx("div", { className: "font-normal text-[#94969C] text-sm", dangerouslySetInnerHTML: {
|
|
92
|
+
__html: props.quest?.description ||
|
|
93
|
+
'Ready for a challenge? Complete them all and get amazing rewards!',
|
|
94
|
+
} }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: props.stages.map((stage, idx) => {
|
|
95
|
+
if (currentStage >= idx + 1) {
|
|
96
|
+
return (_jsx(QuestWageringStageUnlocked, { data: stage, progressValue: stage.progressValue, bonus: stage.bonusAmount, stage: idx, isCompleted: stage.cleared }, idx));
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return _jsx(QuestWageringStageLocked, { stage: idx }, idx);
|
|
100
|
+
}
|
|
101
|
+
}) }), _jsx(Button, { size: "sm", onClick: () => setOpen(false), "aria-label": "Close", className: "w-full", children: "Close" })] })] }) })] }) }));
|
|
102
|
+
}
|
|
103
|
+
function QuestWageringStageUnlocked({ bonus, stage, progressValue, data, isCompleted = false, }) {
|
|
104
|
+
const localeInfo = useLocaleInfo();
|
|
105
|
+
return (_jsxs("div", { className: "mb-4 flex flex-col justify-between rounded-xl border border-border-wagering-stage-popup bg-bg-wagering-stage-popup p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("p", { className: "font-medium", children: ["Stage ", stage + 1] }), _jsx(Badge.Root, { colorScheme: isCompleted ? 'success' : 'blue', size: "md", round: true, children: _jsx(Badge.Label, { children: data.cleared ? 'Completed' : 'Ongoing' }) })] }), _jsxs("div", { className: "mt-2.5 flex items-center justify-between", children: [_jsxs("p", { children: ["Progress ", progressValue, "%"] }), _jsx(Badge.Root, { size: "md", className: "border border-border-badge bg-bg-badge", round: false, children: _jsxs(Badge.Label, { className: "!text-text-badge", children: ["+", formatNumber(bonus, {
|
|
106
|
+
currency: localeInfo.currency.code,
|
|
107
|
+
}), ' ', "Bonus"] }) })] }), _jsx(Progress.Root, { max: 100, className: "mt-2 h-2 rounded-full bg-bg-primary", value: progressValue ?? 0, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) })] }));
|
|
108
|
+
}
|
|
109
|
+
function QuestWageringStageLocked({ stage }) {
|
|
110
|
+
return (_jsxs("div", { className: "mb-4 flex items-center justify-between rounded-xl border border-border-wagering-stage-popup bg-bg-wagering-stage-popup p-3", children: [_jsxs("p", { className: "font-medium", children: ["Stage ", stage + 1] }), _jsx("div", { className: "flex items-center justify-center rounded-full border border-border-lock bg-bg-lock p-1", children: _jsx(Lock01Icon, { className: "size-3 stroke-3 font-medium text-text-lock" }) })] }));
|
|
111
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import closeChest from '../../images/close-chest.png';
|
|
4
|
+
export const NoQuests = ({ heading, description }) => {
|
|
5
|
+
return (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mb-3 font-semibold text-lg capitalize", children: heading ?? 'Quests' }), _jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { src: closeChest, width: 100, height: 100, alt: "No Quests Available", className: "mix-blend-luminosity" }), _jsx("div", { className: "mt-3 text-center text-sm text-text-tertiary-600", children: description ?? 'No available quests. Please check back later!' })] })] }));
|
|
6
|
+
};
|
|
@@ -171,7 +171,7 @@ export function MobileNumberSignIn() {
|
|
|
171
171
|
o.field.onBlur();
|
|
172
172
|
}, otp: true, onValueComplete: () => {
|
|
173
173
|
form2Ref.current?.requestSubmit();
|
|
174
|
-
}, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't
|
|
174
|
+
}, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't receive the code?" }), _jsx("button", { type: "button", className: "font-semibold text-button-secondary-fg", disabled: cooldown.cooling, onClick: async () => {
|
|
175
175
|
await sendVerificationCodeMutation.mutateAsync({
|
|
176
176
|
channel: 'SMS',
|
|
177
177
|
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
@@ -290,7 +290,7 @@ export function SignUpDefaultForm() {
|
|
|
290
290
|
o.field.onChange(details.value);
|
|
291
291
|
}, onValueComplete: () => {
|
|
292
292
|
form2Ref.current?.requestSubmit();
|
|
293
|
-
}, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't
|
|
293
|
+
}, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't receive the code?" }), _jsx("button", { type: "button", className: "font-semibold text-button-secondary-fg disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
|
|
294
294
|
await sendVerificationCodeMutation.mutateAsync({
|
|
295
295
|
channel: 'SMS',
|
|
296
296
|
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
@@ -436,7 +436,7 @@ export function SignUpKYCForm() {
|
|
|
436
436
|
o.field.onChange(details.value);
|
|
437
437
|
}, onValueComplete: () => {
|
|
438
438
|
form2Ref.current?.requestSubmit();
|
|
439
|
-
}, children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't
|
|
439
|
+
}, children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't receive the code?" }), _jsx("button", { type: "button", className: "font-semibold text-button-secondary-fg disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
|
|
440
440
|
await sendVerificationCodeMutation.mutateAsync({
|
|
441
441
|
channel: 'SMS',
|
|
442
442
|
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type TopProgressBarPreset = 'Sunset' | 'Poppy' | 'Rosebud' | 'Sunshine' | 'Gold' | 'Twilight' | 'Powder' | 'Holly' | 'Northern Lights' | 'Raw Green' | 'Lime' | 'Nemesia' | 'Snowflake' | 'Blue Bird' | 'Blueprint' | 'Salvia' | 'Heartsease' | 'Amaranthus' | 'Candy' | 'Verbena';
|
|
2
|
+
export declare const TopProgressBar: ({ preset, customPreset, }: {
|
|
3
|
+
preset?: TopProgressBarPreset;
|
|
4
|
+
customPreset?: string;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { usePathname, useSearchParams } from 'next/navigation';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
// CSS gradient presets (inline styles), approximate Tailwind palette colors
|
|
7
|
+
// --> check presets here <3 https://www.creative-tim.com/twcomponents/gradient-generator
|
|
8
|
+
const PRESET_BG = {
|
|
9
|
+
Sunset: 'linear-gradient(90deg, #ef4444 0%, #f97316 100%)',
|
|
10
|
+
Poppy: 'linear-gradient(90deg, #fb7185 0%, #ef4444 100%)',
|
|
11
|
+
Rosebud: 'linear-gradient(90deg, #ec4899 0%, #f43f5e 100%)',
|
|
12
|
+
Sunshine: 'linear-gradient(90deg, #fde68a 0%, #facc15 100%)',
|
|
13
|
+
Gold: 'linear-gradient(90deg, #fde68a 0%, #eab308 100%)',
|
|
14
|
+
Twilight: 'linear-gradient(90deg, #f59e0b 0%, #ec4899 100%)',
|
|
15
|
+
Powder: 'linear-gradient(90deg, #ddd6fe 0%, #fbcfe8 100%)',
|
|
16
|
+
Holly: 'linear-gradient(90deg, #bfdbfe 0%, #a5f3fc 100%)',
|
|
17
|
+
'Northern Lights': 'linear-gradient(90deg, #99f6e4 0%, #14b8a6 100%)',
|
|
18
|
+
'Raw Green': 'linear-gradient(90deg, #a3e635 0%, #84cc16 100%)',
|
|
19
|
+
Lime: 'linear-gradient(90deg, #2dd4bf 0%, #fef08a 100%)',
|
|
20
|
+
Nemesia: 'linear-gradient(90deg, #34d399 0%, #22d3ee 100%)',
|
|
21
|
+
Snowflake: 'linear-gradient(90deg, #d946ef 0%, #22d3ee 100%)',
|
|
22
|
+
'Blue Bird': 'linear-gradient(90deg, #06b6d4 0%, #3b82f6 100%)',
|
|
23
|
+
Blueprint: 'linear-gradient(90deg, #6366f1 0%, #3b82f6 100%)',
|
|
24
|
+
Salvia: 'linear-gradient(90deg, #2563eb 0%, #7c3aed 100%)',
|
|
25
|
+
Heartsease: 'linear-gradient(90deg, #c026d3 0%, #db2777 100%)',
|
|
26
|
+
Amaranthus: 'linear-gradient(90deg, #c026d3 0%, #9333ea 100%)',
|
|
27
|
+
Candy: 'linear-gradient(90deg, #d946ef 0%, #ec4899 100%)',
|
|
28
|
+
Verbena: 'linear-gradient(90deg, #8b5cf6 0%, #a855f7 100%)',
|
|
29
|
+
};
|
|
30
|
+
export const TopProgressBar = ({ preset = 'Gold', customPreset, }) => {
|
|
31
|
+
const [progress, setProgress] = useState(0);
|
|
32
|
+
const [visible, setVisible] = useState(false);
|
|
33
|
+
const incrementTimerRef = useRef(null);
|
|
34
|
+
const hideTimerRef = useRef(null);
|
|
35
|
+
const pathname = usePathname();
|
|
36
|
+
const searchParams = useSearchParams();
|
|
37
|
+
const currentUrl = useMemo(() => {
|
|
38
|
+
const sp = searchParams?.toString();
|
|
39
|
+
return `${pathname ?? ''}${sp ? `?${sp}` : ''}`;
|
|
40
|
+
}, [pathname, searchParams]);
|
|
41
|
+
const clearTimers = useCallback(() => {
|
|
42
|
+
if (incrementTimerRef.current) {
|
|
43
|
+
clearInterval(incrementTimerRef.current);
|
|
44
|
+
incrementTimerRef.current = null;
|
|
45
|
+
}
|
|
46
|
+
if (hideTimerRef.current) {
|
|
47
|
+
clearTimeout(hideTimerRef.current);
|
|
48
|
+
hideTimerRef.current = null;
|
|
49
|
+
}
|
|
50
|
+
}, []);
|
|
51
|
+
const startProgress = useCallback(() => {
|
|
52
|
+
clearTimers();
|
|
53
|
+
setVisible(true);
|
|
54
|
+
setProgress(8);
|
|
55
|
+
incrementTimerRef.current = window.setInterval(() => {
|
|
56
|
+
setProgress((prev) => {
|
|
57
|
+
if (prev >= 90)
|
|
58
|
+
return prev;
|
|
59
|
+
const delta = Math.max(1, Math.min(10, 10 * Math.random()));
|
|
60
|
+
return Math.min(prev + delta, 90);
|
|
61
|
+
});
|
|
62
|
+
}, 250);
|
|
63
|
+
}, [clearTimers]);
|
|
64
|
+
const finishProgress = useCallback(() => {
|
|
65
|
+
setProgress(100);
|
|
66
|
+
if (incrementTimerRef.current) {
|
|
67
|
+
clearInterval(incrementTimerRef.current);
|
|
68
|
+
incrementTimerRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
if (hideTimerRef.current) {
|
|
71
|
+
window.clearTimeout(hideTimerRef.current);
|
|
72
|
+
}
|
|
73
|
+
hideTimerRef.current = window.setTimeout(() => {
|
|
74
|
+
setVisible(false);
|
|
75
|
+
// Reset for next time after fade-out transition
|
|
76
|
+
hideTimerRef.current = window.setTimeout(() => setProgress(0), 200);
|
|
77
|
+
}, 150);
|
|
78
|
+
}, []);
|
|
79
|
+
// Trigger progress completion when URL changes
|
|
80
|
+
const previousUrl = useRef('');
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (previousUrl.current !== currentUrl) {
|
|
83
|
+
previousUrl.current = currentUrl;
|
|
84
|
+
finishProgress();
|
|
85
|
+
}
|
|
86
|
+
}, [currentUrl, finishProgress]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const handleAnchorClick = (event) => {
|
|
89
|
+
const target = event.currentTarget;
|
|
90
|
+
if (!target)
|
|
91
|
+
return;
|
|
92
|
+
const href = target.getAttribute('href');
|
|
93
|
+
if (!href)
|
|
94
|
+
return;
|
|
95
|
+
const targetUrl = new URL(href, window.location.origin);
|
|
96
|
+
const current = new URL(window.location.href);
|
|
97
|
+
const isDifferent = targetUrl.origin !== current.origin ||
|
|
98
|
+
targetUrl.pathname !== current.pathname ||
|
|
99
|
+
targetUrl.search !== current.search;
|
|
100
|
+
if (isDifferent) {
|
|
101
|
+
startProgress();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const attachListeners = () => {
|
|
105
|
+
const anchors = document.querySelectorAll('a[href]');
|
|
106
|
+
anchors.forEach((a) => {
|
|
107
|
+
a.removeEventListener('click', handleAnchorClick);
|
|
108
|
+
a.addEventListener('click', handleAnchorClick);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const observer = new MutationObserver(() => attachListeners());
|
|
112
|
+
observer.observe(document, { childList: true, subtree: true });
|
|
113
|
+
attachListeners();
|
|
114
|
+
const originalPush = window.history.pushState;
|
|
115
|
+
const originalReplace = window.history.replaceState;
|
|
116
|
+
window.history.pushState = new Proxy(originalPush, {
|
|
117
|
+
apply: (target, thisArg, argArray) => {
|
|
118
|
+
const result = Reflect.apply(target, thisArg, argArray);
|
|
119
|
+
requestAnimationFrame(() => finishProgress());
|
|
120
|
+
return result;
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
window.history.replaceState = new Proxy(originalReplace, {
|
|
124
|
+
apply: (target, thisArg, argArray) => {
|
|
125
|
+
const result = Reflect.apply(target, thisArg, argArray);
|
|
126
|
+
requestAnimationFrame(() => finishProgress());
|
|
127
|
+
return result;
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
// Cleanup
|
|
131
|
+
return () => {
|
|
132
|
+
observer.disconnect();
|
|
133
|
+
const anchors = document.querySelectorAll('a[href]');
|
|
134
|
+
anchors.forEach((a) => a.removeEventListener('click', handleAnchorClick));
|
|
135
|
+
window.history.pushState = originalPush;
|
|
136
|
+
window.history.replaceState = originalReplace;
|
|
137
|
+
clearTimers();
|
|
138
|
+
};
|
|
139
|
+
}, [clearTimers, finishProgress, startProgress]);
|
|
140
|
+
return (_jsx("div", { "aria-hidden": true, className: "pointer-events-none fixed top-0 right-0 left-0 z-[9999]", children: _jsx("div", { className: twMerge('h-[3px] transition-[width,opacity] duration-200 ease-out', visible ? 'opacity-100' : 'opacity-0'), style: {
|
|
141
|
+
width: `${progress}%`,
|
|
142
|
+
background: customPreset ?? PRESET_BG[preset],
|
|
143
|
+
boxShadow: '0 0 10px rgba(255, 255, 255, 0.6)',
|
|
144
|
+
} }) }));
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TopProgressBar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TopProgressBar.js';
|