@opexa/portal-components 0.0.204 → 0.0.206
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/useCreatePisoPayDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useCreatePisoPayDepositMutation.js +73 -0
- package/dist/client/hooks/useCreatePisoPayWithdrawalMutation.d.ts +4 -0
- package/dist/client/hooks/useCreatePisoPayWithdrawalMutation.js +28 -0
- package/dist/client/hooks/useGlobalStore.d.ts +2 -5
- package/dist/client/hooks/useGlobalStore.js +10 -3
- package/dist/components/Bonus/Bonus.client.js +1 -1
- package/dist/components/Cashback/Cashback.client.js +1 -1
- package/dist/components/CustomPromo/CustomPromo.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/Deposit.js +8 -1
- package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.js +182 -0
- package/dist/components/DepositWithdrawal/PaymentMethods.js +6 -0
- package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.js +151 -0
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +8 -1
- package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
- package/dist/components/DepositWithdrawal/utils.js +1 -0
- package/dist/components/GameLaunch/GameLaunch.lazy.js +1 -1
- package/dist/components/GamesSearch/GamesSearch.js +1 -1
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/KYC/AutoOpen.js +3 -8
- package/dist/components/KYC/BasicInformation.js +16 -12
- package/dist/components/KYC/IdentityVerification.js +2 -2
- package/dist/components/KYC/Indicator.js +3 -6
- package/dist/components/KYC/KYC.js +1 -2
- package/dist/components/KYC/KYC.lazy.d.ts +2 -1
- package/dist/components/KYC/KYC.lazy.js +16 -11
- package/dist/components/KYC/KYCReminder.d.ts +2 -0
- package/dist/components/KYC/KYCReminder.js +14 -0
- package/dist/components/KYC/KYCReminder.lazy.d.ts +4 -0
- package/dist/components/KYC/KYCReminder.lazy.js +30 -0
- package/dist/components/KYC/backup/KYCContext.d.ts +5 -1
- package/dist/components/KYC/index.d.ts +1 -0
- package/dist/components/KYC/index.js +1 -0
- package/dist/components/KYC/loadModels.d.ts +1 -0
- package/dist/components/KYC/loadModels.js +9 -0
- package/dist/components/KYC/utils.js +18 -18
- package/dist/components/Messages/MessageContext.d.ts +5 -1
- package/dist/components/News/News.js +1 -1
- package/dist/components/Promo/Promo.client.js +1 -1
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +1 -1
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +10 -5
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +4 -3
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +1 -1
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +1 -1
- package/dist/components/Quests/WageringQuest/WageringQuest.js +3 -2
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +4 -3
- package/dist/components/Search/Search.lazy.js +1 -1
- package/dist/components/SignIn/MobileNumberSignIn.js +6 -5
- package/dist/components/SignIn/NameAndPasswordSignIn.js +2 -0
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +11 -8
- package/dist/components/SignUp/SignUpForm.js +2 -1
- 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/constants/BranchCode.d.ts +4 -0
- package/dist/constants/BranchCode.js +42 -0
- package/dist/constants/PisoPayBanks.d.ts +4 -0
- package/dist/constants/PisoPayBanks.js +45 -0
- package/dist/constants/StorageKey.d.ts +0 -1
- package/dist/constants/StorageKey.js +0 -1
- package/dist/images/piso-pay.png +0 -0
- package/dist/services/queries.d.ts +2 -0
- package/dist/services/queries.js +2504 -2436
- package/dist/services/wallet.d.ts +27 -0
- package/dist/services/wallet.js +26 -1
- package/dist/styles/theme.css +693 -693
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/mutationKeys.d.ts +2 -0
- package/dist/utils/mutationKeys.js +8 -0
- package/dist/utils/resizeImageSize.d.ts +1 -0
- package/dist/utils/resizeImageSize.js +5 -0
- package/package.json +164 -164
- package/dist/client/hooks/index.d.ts +0 -65
- package/dist/client/hooks/index.js +0 -65
- package/dist/client/services/index.d.ts +0 -4
- package/dist/client/services/index.js +0 -4
- package/dist/client/utils/index.d.ts +0 -3
- package/dist/client/utils/index.js +0 -3
- package/dist/components/Empty.d.ts +0 -10
- package/dist/components/Empty.js +0 -7
- package/dist/components/Games/GameContext.d.ts +0 -2
- package/dist/components/Games/GameContext.js +0 -2
- package/dist/components/InfiniteScroll.d.ts +0 -10
- package/dist/components/InfiniteScroll.js +0 -25
- package/dist/components/JackpotCounter/JackpotCounter.client.d.ts +0 -2
- package/dist/components/JackpotCounter/JackpotCounter.client.js +0 -66
- package/dist/components/JackpotCounter/JackpotCounter.d.ts +0 -17
- package/dist/components/JackpotCounter/JackpotCounter.js +0 -21
- package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +0 -18
- package/dist/components/JackpotCounter/JackpotCounterItem.js +0 -109
- package/dist/components/JackpotCounter/JackpotCounterItem.module.css +0 -184
- package/dist/components/JackpotCounter/index.d.ts +0 -1
- package/dist/components/JackpotCounter/index.js +0 -1
- package/dist/components/Jackpots/JackpotDesktop.d.ts +0 -1
- package/dist/components/Jackpots/JackpotDesktop.js +0 -45
- package/dist/components/Jackpots/JackpotGameProviders.d.ts +0 -5
- package/dist/components/Jackpots/JackpotGameProviders.js +0 -41
- package/dist/components/Jackpots/JackpotItemDesktop.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemDesktop.js +0 -43
- package/dist/components/Jackpots/JackpotItemMobile.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemMobile.js +0 -44
- package/dist/components/Jackpots/JackpotMobile.d.ts +0 -1
- package/dist/components/Jackpots/JackpotMobile.js +0 -46
- package/dist/components/Jackpots/JackpotRules.d.ts +0 -5
- package/dist/components/Jackpots/JackpotRules.js +0 -11
- package/dist/components/Jackpots/Jackpots.client.d.ts +0 -2
- package/dist/components/Jackpots/Jackpots.client.js +0 -29
- package/dist/components/Jackpots/JackpotsContext.d.ts +0 -4
- package/dist/components/Jackpots/JackpotsContext.js +0 -3
- package/dist/components/Jackpots/useJackpotData.d.ts +0 -14
- package/dist/components/Jackpots/useJackpotData.js +0 -93
- package/dist/components/Jackpots/useJackpotItemData.d.ts +0 -20
- package/dist/components/Jackpots/useJackpotItemData.js +0 -87
- package/dist/components/KYC/Header.d.ts +0 -1
- package/dist/components/KYC/Header.js +0 -6
- package/dist/components/KYC/Step1.d.ts +0 -1
- package/dist/components/KYC/Step1.js +0 -12
- package/dist/components/KYC/Step2.d.ts +0 -1
- package/dist/components/KYC/Step2.js +0 -12
- package/dist/components/KYC/Step3.d.ts +0 -1
- package/dist/components/KYC/Step3.js +0 -11
- package/dist/components/KYC/Step4.d.ts +0 -1
- package/dist/components/KYC/Step4.js +0 -6
- package/dist/components/Messages/MessageItem.d.ts +0 -4
- package/dist/components/Messages/MessageItem.js +0 -34
- package/dist/components/TournamentCounter/TournamentCounter.client.d.ts +0 -2
- package/dist/components/TournamentCounter/TournamentCounter.client.js +0 -50
- package/dist/components/TournamentCounter/TournamentCounter.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounter.js +0 -21
- package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounterItem.js +0 -106
- package/dist/components/TournamentCounter/index.d.ts +0 -1
- package/dist/components/TournamentCounter/index.js +0 -1
- package/dist/components/Tournaments/TournamentDesktop.d.ts +0 -1
- package/dist/components/Tournaments/TournamentDesktop.js +0 -57
- package/dist/components/Tournaments/TournamentGameProviders.d.ts +0 -5
- package/dist/components/Tournaments/TournamentGameProviders.js +0 -38
- package/dist/components/Tournaments/TournamentItemDesktop.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemDesktop.js +0 -56
- package/dist/components/Tournaments/TournamentItemMobile.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemMobile.js +0 -54
- package/dist/components/Tournaments/TournamentMobile.d.ts +0 -1
- package/dist/components/Tournaments/TournamentMobile.js +0 -55
- package/dist/components/Tournaments/TournamentRules.d.ts +0 -5
- package/dist/components/Tournaments/TournamentRules.js +0 -11
- package/dist/components/Tournaments/Tournaments.client.d.ts +0 -2
- package/dist/components/Tournaments/Tournaments.client.js +0 -20
- package/dist/components/Tournaments/TournamentsContext.d.ts +0 -4
- package/dist/components/Tournaments/TournamentsContext.js +0 -3
- package/dist/components/Tournaments/useTournamentData.d.ts +0 -10
- package/dist/components/Tournaments/useTournamentData.js +0 -72
- package/dist/components/Tournaments/useTournamentItemData.d.ts +0 -16
- package/dist/components/Tournaments/useTournamentItemData.js +0 -64
- package/dist/components/index.d.ts +0 -33
- package/dist/components/index.js +0 -33
- package/dist/constants/envVars.d.ts +0 -5
- package/dist/constants/envVars.js +0 -28
- package/dist/constants/gameProviders.d.ts +0 -5
- package/dist/constants/gameProviders.js +0 -362
- package/dist/constants/gameTypes.d.ts +0 -4
- package/dist/constants/gameTypes.js +0 -64
- package/dist/constants/headerKeys.d.ts +0 -1
- package/dist/constants/headerKeys.js +0 -1
- package/dist/constants/secretQuestions.d.ts +0 -3
- package/dist/constants/secretQuestions.js +0 -24
- package/dist/constants/storageKeys.d.ts +0 -2
- package/dist/constants/storageKeys.js +0 -2
- package/dist/icons/index.d.ts +0 -65
- package/dist/icons/index.js +0 -65
- package/dist/images/hacksaw-gaming.png +0 -0
- package/dist/server/services/index.d.ts +0 -4
- package/dist/server/services/index.js +0 -4
- package/dist/server/utils/index.d.ts +0 -29
- package/dist/server/utils/index.js +0 -29
- package/dist/ui/Presence.d.ts +0 -2
- package/dist/ui/Presence.js +0 -7
- package/dist/ui/Prose.d.ts +0 -2
- package/dist/ui/Prose.js +0 -5
- package/dist/ui/index.d.ts +0 -26
- package/dist/ui/index.js +0 -26
- package/dist/utils/index.d.ts +0 -17
- package/dist/utils/index.js +0 -17
- package/dist/utils/isMobile.d.ts +0 -5
- package/dist/utils/isMobile.js +0 -9
|
@@ -49,24 +49,24 @@ export function validateFile(file) {
|
|
|
49
49
|
return 'Unsupported file';
|
|
50
50
|
}
|
|
51
51
|
export function showPermissionInstructions() {
|
|
52
|
-
const instructions = `
|
|
53
|
-
Camera access is blocked. To enable camera access:
|
|
54
|
-
|
|
55
|
-
Chrome/Edge:
|
|
56
|
-
1. Click the camera icon in the address bar
|
|
57
|
-
2. Select "Always allow" and click "Done"
|
|
58
|
-
3. Or go to Settings > Privacy and security > Site settings > Camera
|
|
59
|
-
|
|
60
|
-
Firefox:
|
|
61
|
-
1. Click the shield icon in the address bar
|
|
62
|
-
2. Click on "Camera blocked"
|
|
63
|
-
3. Select "Allow" and refresh the page
|
|
64
|
-
|
|
65
|
-
Safari:
|
|
66
|
-
1. Go to Safari > Settings > Websites > Camera
|
|
67
|
-
2. Find this website and change to "Allow"
|
|
68
|
-
|
|
69
|
-
After changing permissions, please refresh the page and try again.
|
|
52
|
+
const instructions = `
|
|
53
|
+
Camera access is blocked. To enable camera access:
|
|
54
|
+
|
|
55
|
+
Chrome/Edge:
|
|
56
|
+
1. Click the camera icon in the address bar
|
|
57
|
+
2. Select "Always allow" and click "Done"
|
|
58
|
+
3. Or go to Settings > Privacy and security > Site settings > Camera
|
|
59
|
+
|
|
60
|
+
Firefox:
|
|
61
|
+
1. Click the shield icon in the address bar
|
|
62
|
+
2. Click on "Camera blocked"
|
|
63
|
+
3. Select "Allow" and refresh the page
|
|
64
|
+
|
|
65
|
+
Safari:
|
|
66
|
+
1. Go to Safari > Settings > Websites > Camera
|
|
67
|
+
2. Find this website and change to "Allow"
|
|
68
|
+
|
|
69
|
+
After changing permissions, please refresh the page and try again.
|
|
70
70
|
`;
|
|
71
71
|
alert(instructions);
|
|
72
72
|
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { Message } from '../../types';
|
|
2
|
-
export declare const MessageContext:
|
|
2
|
+
export declare const MessageContext: (props: {
|
|
3
|
+
value: Message;
|
|
4
|
+
} & {
|
|
5
|
+
children?: import("react").ReactNode | undefined;
|
|
6
|
+
}) => React.ReactNode, useMessageContext: () => Message;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import Image from 'next/image';
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
|
|
5
|
-
import { Prose } from '../../ui/Prose.js';
|
|
5
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
6
6
|
import { stripTags } from '../../utils/stripTags.js';
|
|
7
7
|
export function News(props) {
|
|
8
8
|
return (_jsxs(_Fragment, { children: [_jsx("meta", { name: "description", content: stripTags(props.news.content) }), _jsx("meta", { name: "og:title", content: props.news.title }), _jsx("meta", { name: "og:description", content: stripTags(props.news.content) }), _jsx("meta", { name: "og:image", content: props.news.image }), _jsx("meta", { name: "twitter:title", content: props.news.title }), _jsx("meta", { name: "twitter:description", content: stripTags(props.news.content) }), _jsx("meta", { name: "twitter:image", content: props.news.image }), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }), _jsxs("div", { style: props.style, className: props.className, children: [_jsxs(Link, { href: props.viewAllUrl ?? '/news', className: "text-button-secondary-fg flex items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all News"] }), _jsx(Image, { src: props.news.image, alt: "", width: 1024, height: 600, priority: true, unoptimized: true, className: "mt-3xl block h-auto w-full rounded-xl lg:mt-6" }), _jsx("p", { className: "text-brand-400 mt-xl text-sm font-semibold lg:mt-6", children: props.news.category }), _jsx("h2", { className: "mt-xl text-2xl font-semibold lg:mt-6", children: props.news.title }), _jsx(Prose, { className: "mt-xl lg:mt-6", dangerouslySetInnerHTML: {
|
|
@@ -11,7 +11,7 @@ import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
|
11
11
|
import { usePromoQuery } from '../../client/hooks/usePromoQuery.js';
|
|
12
12
|
import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
|
|
13
13
|
import { Button } from '../../ui/Button/index.js';
|
|
14
|
-
import { Prose } from '../../ui/Prose.js';
|
|
14
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
15
15
|
export function Promo__client(props) {
|
|
16
16
|
const localeInfo = useLocaleInfo();
|
|
17
17
|
const availablePromosQuery = useAvailablePromosQuery();
|
|
@@ -3,11 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { addDays, isEqual, startOfDay } from 'date-fns';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import { useCheckInDailyCheckInQuestMutation } from '../../../client/hooks/
|
|
7
|
-
import { toaster } from '../../../client/utils/
|
|
8
|
-
import { CalendarIcon
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { useCheckInDailyCheckInQuestMutation } from '../../../client/hooks/useCheckInDailyCheckInQuestMutation.js';
|
|
7
|
+
import { toaster } from '../../../client/utils/toaster.js';
|
|
8
|
+
import { CalendarIcon } from '../../../icons/CalendarIcon.js';
|
|
9
|
+
import { CheckIcon } from '../../../icons/CheckIcon.js';
|
|
10
|
+
import { ClockStopWatchIcon } from '../../../icons/ClockStopWatchIcon.js';
|
|
11
|
+
import { InfoCircleIcon } from '../../../icons/InfoCircleIcon.js';
|
|
12
|
+
import { Badge } from '../../../ui/Badge/index.js';
|
|
13
|
+
import { Button } from '../../../ui/Button/index.js';
|
|
14
|
+
import { getQueryClient } from '../../../utils/getQueryClient.js';
|
|
15
|
+
import { getAvailableQuestsQueryKey } from '../../../utils/queryKeys.js';
|
|
11
16
|
import CountdownTimer from '../CountdownTimer.js';
|
|
12
17
|
import { DailyCheckInQuestModal } from './DailyCheckInQuestModal.js';
|
|
13
18
|
export function DailyCheckInQuest({ quest }) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { XIcon } from '../../../icons/XIcon.js';
|
|
4
|
+
import { Button } from '../../../ui/Button/index.js';
|
|
5
|
+
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
6
|
+
import { Portal } from '../../../ui/Portal/index.js';
|
|
6
7
|
export function DailyCheckInQuestModal(props) {
|
|
7
8
|
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: props.modalState.isOpen, onOpenChange: ({ open }) => props.modalState.setIsOpen(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: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("p", { className: "text-text-primary-900 text-lg font-semibold", children: "Daily Check-In Rules" }), _jsxs("ul", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn rewards just for checking in each day!" }), _jsx("li", { children: "Stay consistent to unlock special rewards on the 3rd, 5th, and 7th day." }), _jsx("li", { children: "Missing a day will reset your streak, starting again from Day 1." }), _jsx("li", { children: "Each check-in unlocks the next one on the following day." }), _jsx("li", { children: "Successfully check in for 7 consecutive days to complete the quest and reset the cycle." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => props.modalState.setIsOpen(false), children: "Ok" }) })] }) })] }) }));
|
|
8
9
|
}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
|
-
import { ClockStopWatchIcon
|
|
6
|
-
import {
|
|
5
|
+
import { ClockStopWatchIcon } from '../../../icons/ClockStopWatchIcon.js';
|
|
6
|
+
import { InfoCircleIcon } from '../../../icons/InfoCircleIcon.js';
|
|
7
|
+
import { Badge } from '../../../ui/Badge/index.js';
|
|
7
8
|
import CountdownTimer from '../CountdownTimer.js';
|
|
8
9
|
import { WageringQuestModal } from './WageringQuestModal.js';
|
|
9
10
|
export function WageringQuest({ quest }) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { XIcon } from '../../../icons/XIcon.js';
|
|
4
|
+
import { Button } from '../../../ui/Button/index.js';
|
|
5
|
+
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
6
|
+
import { Portal } from '../../../ui/Portal/index.js';
|
|
6
7
|
export function WageringQuestModal(props) {
|
|
7
8
|
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: props.modalState.isOpen, onOpenChange: ({ open }) => props.modalState.setIsOpen(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: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("p", { className: "text-text-primary-900 text-lg font-semibold", children: props.questName }), _jsxs("ul", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn extra rewards just by playing Slots, every bet counts, win or lose!" }), _jsx("li", { children: "Reach the wagering requirement in bets to complete the quest and claim your reward." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => props.modalState.setIsOpen(false), children: "Ok" }) })] }) })] }) }));
|
|
8
9
|
}
|
|
@@ -18,7 +18,7 @@ import { Dialog } from '../../ui/Dialog/index.js';
|
|
|
18
18
|
import { Field } from '../../ui/Field/index.js';
|
|
19
19
|
import { IconButton } from '../../ui/IconButton/index.js';
|
|
20
20
|
import { Portal } from '../../ui/Portal/index.js';
|
|
21
|
-
import { Presence } from '../../ui/Presence.js';
|
|
21
|
+
import { Presence } from '../../ui/Presence/index.js';
|
|
22
22
|
import { callIfFn } from '../../utils/callIfFn.js';
|
|
23
23
|
import { getGameImageUrl } from '../../utils/getGameImageUrl.js';
|
|
24
24
|
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useDialogContext } from '@ark-ui/react/dialog';
|
|
3
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
3
|
import Link from 'next/link';
|
|
5
4
|
import { useRef } from 'react';
|
|
@@ -23,9 +22,10 @@ import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
|
23
22
|
export function MobileNumberSignIn() {
|
|
24
23
|
const signInProps = useSignInPropsContext();
|
|
25
24
|
const context = useSignInContext();
|
|
26
|
-
const dialog = useDialogContext();
|
|
27
25
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
26
|
+
signIn: ctx.signIn,
|
|
28
27
|
signUp: ctx.signUp,
|
|
28
|
+
kycReminder: ctx.kycReminder,
|
|
29
29
|
})));
|
|
30
30
|
const signInMutation = useSignInMutation();
|
|
31
31
|
const sendVerificationCodeMutation = useSendVerificationCodeMutation();
|
|
@@ -103,9 +103,9 @@ export function MobileNumberSignIn() {
|
|
|
103
103
|
o.field.onChange(details.checked);
|
|
104
104
|
}, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I am at least 21 years of age and I accept the", ' ', _jsx(Link, { href: signInProps.termsAndConditionsUrl ??
|
|
105
105
|
'/terms-and-conditions', onClick: () => {
|
|
106
|
-
|
|
106
|
+
globalStore.signIn.setOpen(false);
|
|
107
107
|
}, className: "text-brand-400 whitespace-nowrap underline underline-offset-2", children: "Terms and Conditions." })] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Don't have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
108
|
-
|
|
108
|
+
globalStore.signIn.setOpen(false);
|
|
109
109
|
globalStore.signUp.setOpen(true);
|
|
110
110
|
}, children: "Sign up" })] })] })), context.step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
111
111
|
const { mobileNumber } = step1Form.getValues();
|
|
@@ -115,10 +115,11 @@ export function MobileNumberSignIn() {
|
|
|
115
115
|
mobileNumber: mobileNumberParser.format(mobileNumber),
|
|
116
116
|
verificationCode: verificationCode.join(''),
|
|
117
117
|
});
|
|
118
|
-
dialog.setOpen(false);
|
|
119
118
|
step1Form.reset();
|
|
120
119
|
step2Form.reset();
|
|
121
120
|
context.setStep(1);
|
|
121
|
+
globalStore.signIn.setOpen(false);
|
|
122
|
+
globalStore.kycReminder.setOpen(true);
|
|
122
123
|
}
|
|
123
124
|
catch {
|
|
124
125
|
toaster.error({
|
|
@@ -25,6 +25,7 @@ export function NameAndPasswordSignIn() {
|
|
|
25
25
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
26
26
|
signIn: ctx.signIn,
|
|
27
27
|
signUp: ctx.signUp,
|
|
28
|
+
kycReminder: ctx.kycReminder,
|
|
28
29
|
forgotPassword: ctx.forgotPassword,
|
|
29
30
|
})));
|
|
30
31
|
const signInMutation = useSignInMutation({
|
|
@@ -48,6 +49,7 @@ export function NameAndPasswordSignIn() {
|
|
|
48
49
|
});
|
|
49
50
|
const authenticateMutation = useAuthenticateMutation({
|
|
50
51
|
onSuccess() {
|
|
52
|
+
globalStore.kycReminder.setOpen(true);
|
|
51
53
|
globalStore.signIn.setOpen(false);
|
|
52
54
|
authenticateMutation.reset();
|
|
53
55
|
signInMutation.reset();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { createListCollection, parseDate } from '@ark-ui/react';
|
|
4
|
-
import { useDialogContext } from '@ark-ui/react/dialog';
|
|
5
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
6
5
|
import { ObjectId } from '@opexa/object-id';
|
|
7
6
|
import { differenceInYears, format } from 'date-fns';
|
|
@@ -48,9 +47,12 @@ export function SignUpForm() {
|
|
|
48
47
|
itemToString: (item) => `${item.code} - ${item.name}`,
|
|
49
48
|
});
|
|
50
49
|
const [step, setStep] = useState(1);
|
|
51
|
-
const
|
|
50
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
51
|
+
kycReminder: ctx.kycReminder,
|
|
52
|
+
signIn: ctx.signIn,
|
|
53
|
+
signUp: ctx.signUp,
|
|
54
|
+
})));
|
|
52
55
|
const search = useSearchParams();
|
|
53
|
-
const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
|
|
54
56
|
const signUpMutation = useSignUpMutation();
|
|
55
57
|
const signInMutation = useSignInMutation();
|
|
56
58
|
const updateAccountMutation = useUpdateAccountMutation();
|
|
@@ -180,10 +182,10 @@ export function SignUpForm() {
|
|
|
180
182
|
o.field.onChange(details.checked);
|
|
181
183
|
}, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I am at least 21 years of age and I accept the", ' ', _jsx(Link, { href: signUpProps.termsAndConditionsUrl ??
|
|
182
184
|
'/terms-and-conditions', onClick: () => {
|
|
183
|
-
|
|
185
|
+
globalStore.signUp.setOpen(false);
|
|
184
186
|
}, className: "text-brand-400 whitespace-nowrap underline underline-offset-2", children: "Terms and Conditions." })] }), ' ', _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Create Account" })] }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Already have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
globalStore.signUp.setOpen(false);
|
|
188
|
+
globalStore.signIn.setOpen(true);
|
|
187
189
|
}, children: "Log In" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
188
190
|
const id = ObjectId.generate(ObjectType.MemberAccount).toString();
|
|
189
191
|
const { mobileNumber } = step1Form.getValues();
|
|
@@ -215,7 +217,7 @@ export function SignUpForm() {
|
|
|
215
217
|
});
|
|
216
218
|
const ok = await pollLogin();
|
|
217
219
|
if (!ok) {
|
|
218
|
-
|
|
220
|
+
globalStore.signIn.setOpen(true);
|
|
219
221
|
return;
|
|
220
222
|
}
|
|
221
223
|
else {
|
|
@@ -238,7 +240,8 @@ export function SignUpForm() {
|
|
|
238
240
|
});
|
|
239
241
|
await pollUpdateAccount();
|
|
240
242
|
}
|
|
241
|
-
|
|
243
|
+
globalStore.signUp.setOpen(false);
|
|
244
|
+
globalStore.kycReminder.setOpen(true);
|
|
242
245
|
step1Form.reset();
|
|
243
246
|
step2Form.reset();
|
|
244
247
|
setStep(1);
|
|
@@ -192,6 +192,7 @@ export function SignUpForm() {
|
|
|
192
192
|
mobileNumber: mobileNumberParser.format(mobileNumber),
|
|
193
193
|
verificationCode: verificationCode.join(''),
|
|
194
194
|
referralCode: search.get('referralCode') ?? undefined,
|
|
195
|
+
domain: search.get('domain') ?? undefined,
|
|
195
196
|
btag: search.get('btag') ?? undefined,
|
|
196
197
|
});
|
|
197
198
|
const name = mobileNumberParser.format(mobileNumber);
|
|
@@ -251,7 +252,7 @@ export function SignUpForm() {
|
|
|
251
252
|
o.field.onChange(details.value);
|
|
252
253
|
}, onValueComplete: () => {
|
|
253
254
|
form2Ref.current?.requestSubmit();
|
|
254
|
-
},
|
|
255
|
+
}, 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: "text-text-placeholder-subtle text-2xl font-medium", 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 recieve the code?" }), _jsx("button", { type: "button", className: "text-button-secondary-fg font-semibold disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
|
|
255
256
|
await sendVerificationCodeMutation.mutateAsync({
|
|
256
257
|
channel: 'SMS',
|
|
257
258
|
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptureIdDocument(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
|
|
6
|
+
import { Camera01Icon } from '../../../icons/Camera01Icon.js';
|
|
7
|
+
import { CheckCircleIcon } from '../../../icons/CheckCircleIcon.js';
|
|
8
|
+
import { XIcon } from '../../../icons/XIcon.js';
|
|
9
|
+
import { Button } from '../../../ui/Button/index.js';
|
|
10
|
+
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
11
|
+
import { Portal } from '../../../ui/Portal/index.js';
|
|
12
|
+
import { dataURLtoBlob, resizeFile } from '../../KYC/utils.js';
|
|
13
|
+
import { useSignUpPagcorPropsContext } from './SignUpPagcorContext.js';
|
|
14
|
+
export function CaptureIdDocument() {
|
|
15
|
+
const props = useSignUpPagcorPropsContext();
|
|
16
|
+
const [videoStream, setVideoStream] = useState(null);
|
|
17
|
+
const [cameraError, setCameraError] = useState(null);
|
|
18
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
19
|
+
const [selectedImage, setSelectedImage] = useState(null);
|
|
20
|
+
const [captureInProgress, setCaptureInProgress] = useState(false);
|
|
21
|
+
const [proccessImageCanvas, setProccessImageCanvas] = useState(null);
|
|
22
|
+
const videoElement = useRef(null);
|
|
23
|
+
const containerRef = useRef(null);
|
|
24
|
+
function stopCamera() {
|
|
25
|
+
if (videoStream) {
|
|
26
|
+
videoStream.getTracks().forEach((track) => track.stop());
|
|
27
|
+
setVideoStream(null);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
return () => {
|
|
32
|
+
stopCamera();
|
|
33
|
+
};
|
|
34
|
+
}, [videoStream]);
|
|
35
|
+
async function startCamera() {
|
|
36
|
+
try {
|
|
37
|
+
setIsLoading(true);
|
|
38
|
+
setCameraError(null);
|
|
39
|
+
setCaptureInProgress(true);
|
|
40
|
+
console.log('Starting camera...');
|
|
41
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
42
|
+
video: {
|
|
43
|
+
facingMode: 'environment',
|
|
44
|
+
aspectRatio: 16 / 9,
|
|
45
|
+
width: { ideal: 1920, max: 1920 },
|
|
46
|
+
height: { ideal: 1080, max: 1080 },
|
|
47
|
+
frameRate: {
|
|
48
|
+
ideal: 30,
|
|
49
|
+
max: 60,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
audio: false,
|
|
53
|
+
});
|
|
54
|
+
// Set the stream directly to the video element
|
|
55
|
+
if (videoElement.current) {
|
|
56
|
+
videoElement.current.srcObject = stream;
|
|
57
|
+
videoElement.current.onloadedmetadata = () => {
|
|
58
|
+
console.log('Video metadata loaded, starting playback...');
|
|
59
|
+
videoElement.current
|
|
60
|
+
?.play()
|
|
61
|
+
.then(() => {
|
|
62
|
+
setVideoStream(stream);
|
|
63
|
+
setIsLoading(false);
|
|
64
|
+
})
|
|
65
|
+
.catch(() => {
|
|
66
|
+
setCameraError('Failed to start camera stream. Please try again.');
|
|
67
|
+
setIsLoading(false);
|
|
68
|
+
// Stop the stream if playback fails
|
|
69
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
videoElement.current.onerror = (err) => {
|
|
73
|
+
console.error('Video element error:', err);
|
|
74
|
+
setCameraError('Video playback error. Please try again.');
|
|
75
|
+
setIsLoading(false);
|
|
76
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
console.error('Video element not available');
|
|
81
|
+
setCameraError('Camera initialization failed. Please try again.');
|
|
82
|
+
setCaptureInProgress(false);
|
|
83
|
+
setIsLoading(false);
|
|
84
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
setIsLoading(false);
|
|
89
|
+
if (error instanceof DOMException) {
|
|
90
|
+
console.error('Error accessing camera:', error.message);
|
|
91
|
+
setCameraError(error.message);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.error('Unknown error accessing camera:', error);
|
|
95
|
+
setCameraError('An unknown error occurred. Please check permissions and try again.');
|
|
96
|
+
}
|
|
97
|
+
setCaptureInProgress(false);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function captureAndProcessImage() {
|
|
101
|
+
if (!videoElement.current || !videoStream) {
|
|
102
|
+
console.error('Video element or stream not available for capture');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const canvas = document.createElement('canvas');
|
|
107
|
+
const parentDiv = document.getElementById('parent');
|
|
108
|
+
canvas.width = parentDiv?.clientWidth || videoElement.current.width;
|
|
109
|
+
canvas.height = parentDiv?.clientHeight || videoElement.current.height;
|
|
110
|
+
const ctx = canvas.getContext('2d');
|
|
111
|
+
if (!ctx) {
|
|
112
|
+
console.error('Could not get 2D context for canvas');
|
|
113
|
+
setCameraError('Failed to process image. Please try again.');
|
|
114
|
+
setCaptureInProgress(false);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
ctx.drawImage(videoElement.current, 0, 0, canvas.width, canvas.height);
|
|
118
|
+
const imageSrc = canvas.toDataURL('image/png', 1.0);
|
|
119
|
+
setSelectedImage({ src: imageSrc });
|
|
120
|
+
setCaptureInProgress(false);
|
|
121
|
+
stopCamera();
|
|
122
|
+
const newImg = document.createElement('img');
|
|
123
|
+
newImg.src = imageSrc;
|
|
124
|
+
//@ts-expect-error jscanify is not typed
|
|
125
|
+
const scanner = new jscanify();
|
|
126
|
+
newImg.onload = () => {
|
|
127
|
+
try {
|
|
128
|
+
if (containerRef.current) {
|
|
129
|
+
// containerRef.current.innerHTML = '';
|
|
130
|
+
const paperWidth = parentDiv?.clientWidth || videoElement.current?.videoWidth;
|
|
131
|
+
const paperHeight = parentDiv?.clientHeight || videoElement.current?.videoHeight;
|
|
132
|
+
//@ts-expect-error jscanify is not typed
|
|
133
|
+
const contour = scanner.findPaperContour(cv.imread(newImg));
|
|
134
|
+
const cornerPoints = scanner.getCornerPoints(contour);
|
|
135
|
+
const resultCanvas = scanner.extractPaper(newImg, paperWidth, paperHeight, cornerPoints);
|
|
136
|
+
newImg.className =
|
|
137
|
+
'absolute inset-0 m-auto w-full h-auto md:max-h-[333px] md:max-w-[643px] aspect-video rounded-lg object-contain';
|
|
138
|
+
setProccessImageCanvas(resultCanvas);
|
|
139
|
+
containerRef.current.appendChild(resultCanvas);
|
|
140
|
+
setCaptureInProgress(false);
|
|
141
|
+
setSelectedImage({ src: resultCanvas.toDataURL('image/png') });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.error('Error processing image:', error);
|
|
146
|
+
setCameraError('Failed to process image. Please try again.');
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
newImg.onerror = () => {
|
|
150
|
+
console.error('Error loading image');
|
|
151
|
+
setCameraError('Failed to load image. Please try again.');
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.error('Error capturing image:', error);
|
|
156
|
+
setCameraError('Failed to capture image. Please try again.');
|
|
157
|
+
setCaptureInProgress(false);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async function uploadPhoto() {
|
|
161
|
+
if (!proccessImageCanvas) {
|
|
162
|
+
console.error('Failed to process the image. Please try again.');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const blob = proccessImageCanvas.toDataURL('image/png', 1.0);
|
|
166
|
+
const processedBlob = dataURLtoBlob(blob);
|
|
167
|
+
const img = new File([processedBlob], 'frontImage', { type: 'image/jpeg' });
|
|
168
|
+
const resizedImage = (await resizeFile(img));
|
|
169
|
+
if (resizedImage) {
|
|
170
|
+
props.setFrontImage(resizedImage);
|
|
171
|
+
props.setCapturing(null);
|
|
172
|
+
stopCamera();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function retakePhoto() {
|
|
176
|
+
setSelectedImage(null);
|
|
177
|
+
setCaptureInProgress(true);
|
|
178
|
+
setCameraError(null);
|
|
179
|
+
if (containerRef.current) {
|
|
180
|
+
const canvas = containerRef.current.querySelector('canvas');
|
|
181
|
+
if (canvas) {
|
|
182
|
+
canvas.width = canvas.width;
|
|
183
|
+
}
|
|
184
|
+
containerRef.current.innerHTML = '';
|
|
185
|
+
}
|
|
186
|
+
if (videoElement.current) {
|
|
187
|
+
videoElement.current.play();
|
|
188
|
+
}
|
|
189
|
+
startCamera();
|
|
190
|
+
}
|
|
191
|
+
return (_jsx(Dialog.Root, { open: props.capturing === 'ID_DOCUMENT', lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start p-3xl pb-4xl lg:h-auto lg:w-fit lg:rounded-xl', props.className), 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: () => {
|
|
192
|
+
stopCamera();
|
|
193
|
+
props.setCapturing(null);
|
|
194
|
+
}, 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: cameraError ? (_jsx("div", { className: "flex h-full items-center justify-center p-4", children: _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-red-500 mb-2 text-sm", children: "Camera Error" }), _jsx("p", { className: "text-gray-400 text-xs", children: 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-[60vh] 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]" })) }), cameraError ? (_jsx("div", { className: "mt-4 text-center", children: _jsx(Button, { className: "mx-auto px-xl lg:w-fit", onClick: () => {
|
|
195
|
+
setCameraError(null);
|
|
196
|
+
startCamera();
|
|
197
|
+
}, children: "Try Again" }) })) : 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, children: ["Use Photo ", _jsx(CheckCircleIcon, { className: "ml-1" })] })] })) : (_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: startCamera, disabled: isLoading || !!videoStream, children: [isLoading ? 'Starting Camera...' : 'Start Camera', _jsx(Camera01Icon, { className: "size-5" })] }))] }) }) })] }) }));
|
|
198
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CaptureSelfie(): import("react/jsx-runtime").JSX.Element;
|