@opexa/portal-components 0.0.940 → 0.0.941
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/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.js +11 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.js +11 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.js +126 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.js +10 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.js +12 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.d.ts +17 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.js +2 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.js +41 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.d.ts +13 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.js +91 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/DigitainLauncher/Loading.js +1 -1
- package/dist/components/Disclaimer/DisclaimerV2.js +0 -3
- 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/ForgotPassword/Crazywin/ForgotPassword.module.css +42 -42
- package/dist/components/Jackpots/Jackpots.module.css +288 -288
- 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.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/KYCVerificationStatus.lazy.js +2 -2
- package/dist/components/KYC/KYCNonPagCor/KYCVerificationStatus.lazy.js +2 -2
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +8 -5
- 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/PortalProvider/CXDTokenObserver.js +11 -11
- 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/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/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/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/images/phone-icon.svg +10 -10
- package/dist/services/queries.js +3369 -3369
- package/dist/styles/theme.css +776 -776
- 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/resizeImageSize.d.ts +2 -0
- package/dist/utils/resizeImageSize.js +11 -0
- package/package.json +179 -179
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useFieldContext } from '@ark-ui/react';
|
|
3
|
+
import { FaceDetector, FilesetResolver } from '@mediapipe/tasks-vision';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { useEffect, useId, useRef, useState, } from 'react';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { useInterval } from 'usehooks-ts';
|
|
8
|
+
import { useCamera } from '../../client/hooks/useCamera.js';
|
|
9
|
+
import { useControllableState } from '../../client/hooks/useControllableState.js';
|
|
10
|
+
import { useDisclosure } from '../../client/hooks/useDisclosure.js';
|
|
11
|
+
import { useFileQuery } from '../../client/hooks/useFileQuery.js';
|
|
12
|
+
import { useUploadImageFileMutation } from '../../client/hooks/useUploadImageFileMutation.js';
|
|
13
|
+
import { createContext } from '../../client/utils/createContext.js';
|
|
14
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
15
|
+
import { Camera01Icon } from '../../icons/Camera01Icon.js';
|
|
16
|
+
import { CameraOffIcon } from '../../icons/CameraOffIcon.js';
|
|
17
|
+
import { CheckCircleIcon } from '../../icons/CheckCircleIcon.js';
|
|
18
|
+
import { RefreshCcw01Icon } from '../../icons/RefreshCcw01Icon.js';
|
|
19
|
+
import { Spinner02Icon } from '../../icons/Spinner02Icon.js';
|
|
20
|
+
import { UploadCloud02Icon } from '../../icons/UploadCloud02Icon.js';
|
|
21
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
22
|
+
import { Button } from '../../ui/Button/index.js';
|
|
23
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
24
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
25
|
+
import { validateFile } from '../../utils/validateFile.js';
|
|
26
|
+
export function SelfieField__client(props) {
|
|
27
|
+
const context = useSelfieField(props);
|
|
28
|
+
return (_jsxs(SelfieFieldProvider, { value: context, children: [_jsxs("div", { ref: props.ref, id: props.id, style: props.style, className: twMerge('group', 'border', 'border-border-primary', 'bg-bg-primary', 'relative', 'w-full', 'aspect-[352/180]', 'shrink-0', 'rounded-xl', 'p-xl', props.className), onDragOver: (e) => e.preventDefault(), onDragEnter: (e) => e.preventDefault(), onDragLeave: (e) => e.preventDefault(), onDrop: async (e) => {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
const file = e.dataTransfer.files?.[0];
|
|
31
|
+
if (!file)
|
|
32
|
+
return;
|
|
33
|
+
const error = validateFile(file);
|
|
34
|
+
if (error)
|
|
35
|
+
return props.onError?.(error);
|
|
36
|
+
context.mutation.mutate({ file });
|
|
37
|
+
}, "aria-describedby": context.field?.ariaDescribedby, children: [_jsx("input", { id: context.field?.ids?.control, ref: context.inputRef, type: "file", accept: "image/png, image/jpeg", onChange: async (e) => {
|
|
38
|
+
const file = e.target.files?.[0];
|
|
39
|
+
if (!file)
|
|
40
|
+
return;
|
|
41
|
+
const error = validateFile(file);
|
|
42
|
+
if (error)
|
|
43
|
+
return props.onError?.(error);
|
|
44
|
+
context.mutation.mutate({ file });
|
|
45
|
+
}, disabled: context.field?.disabled ||
|
|
46
|
+
context.query.isLoading ||
|
|
47
|
+
context.mutation.isPending ||
|
|
48
|
+
props.disabled, readOnly: context.field?.readOnly || props.readOnly, required: context.field?.required || props.required, className: "sr-only" }), !context.query.data?.url && (_jsxs("div", { className: "flex size-full flex-col justify-center", children: [_jsx("div", { className: "border-border-primary shadow-xs mx-auto flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-placeholder-subtle size-4" }) }), _jsxs("h2", { className: "text-text-tertiary-600 mt-lg", children: [_jsxs("span", { className: "block text-center text-sm", children: [_jsx("button", { type: "button", onClick: () => {
|
|
49
|
+
context.inputRef.current?.click();
|
|
50
|
+
}, disabled: context.field?.disabled ||
|
|
51
|
+
context.field?.readOnly ||
|
|
52
|
+
context.query.isLoading ||
|
|
53
|
+
context.mutation.isPending ||
|
|
54
|
+
props.disabled ||
|
|
55
|
+
props.readOnly, className: "text-button-secondary-fg font-semibold disabled:opacity-60", children: "Click to upload" }), ' ', "or drag and drop"] }), _jsx("span", { className: "mt-xs block text-center text-xs", children: "PNG, JPG or JPEG (max. 10mb)" }), _jsx("span", { className: "m-txs block text-center text-xs", children: "or" })] }), _jsx(Button, { size: "sm", variant: "outline", className: "mx-auto mt-md w-auto", onClick: () => {
|
|
56
|
+
context.disclosure.setOpen(true);
|
|
57
|
+
}, disabled: context.field?.disabled ||
|
|
58
|
+
context.field?.readOnly ||
|
|
59
|
+
context.query.isLoading ||
|
|
60
|
+
context.mutation.isPending ||
|
|
61
|
+
props.disabled ||
|
|
62
|
+
props.readOnly, children: "Take a photo" })] })), context.query.data?.url && (_jsxs("div", { className: "relative", children: [_jsx(Image, { src: context.query.data.url, alt: "", width: 600, height: 600, unoptimized: true, className: "h-auto w-full rounded-md" }), _jsx("button", { type: "button", className: "backdrop-blur-xs absolute right-2 top-2 rounded-full bg-white/10 p-1", onClick: () => {
|
|
63
|
+
context.setValue('');
|
|
64
|
+
}, children: _jsx(XIcon, { className: "size-5" }) })] }))] }), _jsx(Camera, {})] }));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* -------------------------------------
|
|
68
|
+
* Camera
|
|
69
|
+
* -------------------------------------
|
|
70
|
+
*/
|
|
71
|
+
function Camera() {
|
|
72
|
+
const context = useSelfieFieldContext();
|
|
73
|
+
return (_jsx(Dialog.Root, { open: context.disclosure.open, onOpenChange: (details) => {
|
|
74
|
+
context.disclosure.setOpen(details.open);
|
|
75
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: context.camera.close, 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 overflow-y-auto py-4", children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto w-[calc(100dvw-1rem)] max-w-[calc(100dvw-1rem)] overflow-y-auto rounded-lg px-4 py-5 lg:w-[747px] lg:max-w-[747px] lg:px-3xl lg:py-4xl", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Dialog.Title, { className: "text-center font-semibold lg:text-xl", children: "Take a Selfie Holding Your ID" }), _jsx(Dialog.Description, { className: "text-text-tertiary-600 mt-md text-center text-xs lg:text-base", children: "Make sure your face and ID are clearly visible, with no glare\u00A0or\u00A0blur." }), _jsxs("div", { className: "relative mt-5 lg:mt-10 lg:px-3xl", children: [_jsx(Video, {}), context.camera.error && (_jsxs("div", { className: "border-border-disabled flex aspect-[4/3] flex-col items-center justify-center rounded-md border bg-black px-4 lg:aspect-video", children: [_jsx(CameraOffIcon, { className: "text-text-placeholder-subtle size-10 text-center lg:size-12" }), _jsx("h2", { className: "mt-3 text-sm font-semibold lg:mt-4 lg:text-base", children: context.camera.error.name }), _jsx("p", { className: "text-text-tertiary-600 mt-0.5 text-center text-xs lg:mt-1 lg:text-sm", children: context.camera.error.message }), _jsx(Button, { size: "xs", variant: "outline", colorScheme: "gray", fullWidth: false, className: "mt-4 lg:mt-5", onClick: () => {
|
|
76
|
+
context.camera.reopen();
|
|
77
|
+
}, children: "Try again" })] })), context.camera.loading && (_jsx("div", { className: "border-border-disabled flex aspect-[4/3] flex-col items-center justify-center rounded-md border bg-black px-4 lg:aspect-video", children: _jsx(Spinner02Icon, { className: "text-text-placeholder size-8" }) })), context.camera.data && (_jsx("div", { className: "border-border-disabled aspect-[4/3] w-full overflow-hidden rounded-md border bg-black lg:aspect-video", children: _jsx(Image, { src: context.camera.data.url, alt: "", width: 600, height: 600, unoptimized: true, className: "mx-auto mt-2 block h-[calc(100%-1rem)] w-auto" }) }))] }), !context.camera.data && (_jsx("div", { className: "mt-5 lg:mt-10", children: _jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto w-full px-xl py-lg lg:w-[10rem]", onClick: () => {
|
|
78
|
+
context.camera.snap({
|
|
79
|
+
crop: context.guideRef.current?.getBoundingClientRect(),
|
|
80
|
+
});
|
|
81
|
+
}, disabled: !context.faceFound ||
|
|
82
|
+
context.camera.loading ||
|
|
83
|
+
context.camera.snapping ||
|
|
84
|
+
!!context.camera.error, children: [context.camera.snapping ? (_jsx(Spinner02Icon, { className: "size-5" })) : (_jsx(Camera01Icon, { className: "size-5" })), "Capture"] }) })), context.camera.data && (_jsxs("div", { className: "mt-5 flex gap-3 lg:mt-10 lg:justify-center", children: [_jsxs(Button, { onClick: () => {
|
|
85
|
+
const file = context.camera.data?.file;
|
|
86
|
+
if (!file)
|
|
87
|
+
return;
|
|
88
|
+
context.mutation.mutate({ file });
|
|
89
|
+
context.disclosure.setOpen(false);
|
|
90
|
+
}, className: "w-full lg:w-[10rem]", children: [_jsx(CheckCircleIcon, { className: "size-5" }), "Use Photo"] }), _jsxs(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
|
|
91
|
+
context.camera.reset();
|
|
92
|
+
}, className: "w-full lg:w-[10rem]", children: [_jsx(RefreshCcw01Icon, { className: "size-5" }), " Retake"] })] }))] }) })] }) }));
|
|
93
|
+
}
|
|
94
|
+
/*
|
|
95
|
+
* -------------------------------------
|
|
96
|
+
* Video
|
|
97
|
+
* -------------------------------------
|
|
98
|
+
*/
|
|
99
|
+
function Video() {
|
|
100
|
+
const id = useId();
|
|
101
|
+
const context = useSelfieFieldContext();
|
|
102
|
+
const [maskBox, setMaskBox] = useState({
|
|
103
|
+
x: 0,
|
|
104
|
+
y: 0,
|
|
105
|
+
width: 0,
|
|
106
|
+
height: 0,
|
|
107
|
+
});
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const update = () => {
|
|
110
|
+
const guide = context.guideRef.current;
|
|
111
|
+
const mask = context.maskRef.current;
|
|
112
|
+
if (!guide || !mask)
|
|
113
|
+
return;
|
|
114
|
+
const guideRect = guide.getBoundingClientRect();
|
|
115
|
+
const maskRect = mask.getBoundingClientRect();
|
|
116
|
+
const x = guideRect.left - maskRect.left;
|
|
117
|
+
const y = guideRect.top - maskRect.top;
|
|
118
|
+
const width = guideRect.width;
|
|
119
|
+
const height = guideRect.height;
|
|
120
|
+
if (width && height) {
|
|
121
|
+
setMaskBox({
|
|
122
|
+
x,
|
|
123
|
+
y,
|
|
124
|
+
width,
|
|
125
|
+
height,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const observer = new ResizeObserver(update);
|
|
130
|
+
if (context.guideRef.current)
|
|
131
|
+
observer.observe(context.guideRef.current);
|
|
132
|
+
if (context.maskRef.current)
|
|
133
|
+
observer.observe(context.maskRef.current);
|
|
134
|
+
requestAnimationFrame(update);
|
|
135
|
+
return () => observer.disconnect();
|
|
136
|
+
}, [context.guideRef, context.maskRef]);
|
|
137
|
+
const [videoSize, setVideoSize] = useState({
|
|
138
|
+
width: 0,
|
|
139
|
+
height: 0,
|
|
140
|
+
});
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
const video = context.camera.videoRef.current;
|
|
143
|
+
if (!video)
|
|
144
|
+
return;
|
|
145
|
+
const updateVideoWidth = () => {
|
|
146
|
+
const rect = video.getBoundingClientRect();
|
|
147
|
+
setVideoSize({
|
|
148
|
+
width: rect.width,
|
|
149
|
+
height: rect.height,
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
video.addEventListener('loadedmetadata', updateVideoWidth);
|
|
153
|
+
video.addEventListener('resize', updateVideoWidth);
|
|
154
|
+
return () => {
|
|
155
|
+
video.removeEventListener('loadedmetadata', updateVideoWidth);
|
|
156
|
+
video.removeEventListener('resize', updateVideoWidth);
|
|
157
|
+
};
|
|
158
|
+
}, [context.camera.videoRef]);
|
|
159
|
+
const guideWidth = videoSize.width <= 0 || videoSize.height <= 0
|
|
160
|
+
? 0
|
|
161
|
+
: videoSize.width > videoSize.height
|
|
162
|
+
? videoSize.height
|
|
163
|
+
: videoSize.width;
|
|
164
|
+
return (_jsxs("div", { className: twMerge('relative h-auto w-full overflow-hidden', !context.camera.data && !context.camera.error && !context.camera.loading
|
|
165
|
+
? 'block'
|
|
166
|
+
: 'hidden'), children: [_jsx("video", { ...context.camera.videoProps }), _jsx("svg", { className: "pointer-events-none absolute -inset-4 size-[200%]", children: _jsx("defs", { children: _jsxs("mask", { id: id, maskUnits: "userSpaceOnUse", children: [_jsx("rect", { x: "0", y: "0", width: "200%", height: "200%", fill: "white" }), _jsx("rect", { x: maskBox.x, y: maskBox.y, width: maskBox.width, height: maskBox.height, fill: "black", rx: "8", ry: "8" })] }) }) }), _jsx("div", { ref: context.maskRef, className: "absolute -inset-4 size-[200%] bg-black/60 backdrop-blur-sm", style: {
|
|
167
|
+
mask: `url(#${id})`,
|
|
168
|
+
WebkitMask: `url(#${id})`,
|
|
169
|
+
maskRepeat: 'no-repeat',
|
|
170
|
+
WebkitMaskRepeat: 'no-repeat',
|
|
171
|
+
} }), _jsx("div", { ref: context.guideRef, className: twMerge('border-utility-warning-700 absolute left-1/2 top-1/2 z-20 aspect-square -translate-x-1/2 -translate-y-1/2 rounded-md border-2 border-dashed', context.faceFound && 'border-utility-success-700', guideWidth <= 0 ? 'hidden' : 'block'), style: {
|
|
172
|
+
width: `calc(${guideWidth}px - 2rem)`,
|
|
173
|
+
} })] }));
|
|
174
|
+
}
|
|
175
|
+
function useSelfieField(props) {
|
|
176
|
+
const field = useFieldContext();
|
|
177
|
+
const [value, setValue] = useControllableState({
|
|
178
|
+
value: props.value,
|
|
179
|
+
defaultValue: props.defaultValue ?? '',
|
|
180
|
+
onChange: props.onChange,
|
|
181
|
+
});
|
|
182
|
+
const query = useFileQuery(value, {
|
|
183
|
+
refetchInterval({ state }) {
|
|
184
|
+
return !state.data || state.data.status === 'UPLOADING' ? 1000 : false;
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
const mutation = useUploadImageFileMutation({
|
|
188
|
+
onSuccess(id) {
|
|
189
|
+
setValue(id);
|
|
190
|
+
},
|
|
191
|
+
onMutate() {
|
|
192
|
+
setValue('');
|
|
193
|
+
},
|
|
194
|
+
onError(error) {
|
|
195
|
+
toaster.error({
|
|
196
|
+
title: 'Upload Failed',
|
|
197
|
+
description: error.message,
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
onSettled() {
|
|
201
|
+
if (inputRef.current) {
|
|
202
|
+
inputRef.current.value = '';
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
const inputRef = useRef(null);
|
|
207
|
+
const maskRef = useRef(null);
|
|
208
|
+
const guideRef = useRef(null);
|
|
209
|
+
const camera = useCamera({
|
|
210
|
+
async validate(data) {
|
|
211
|
+
/*
|
|
212
|
+
* 💁♂️
|
|
213
|
+
* Check if we still have the face.
|
|
214
|
+
* User could have moved away from the camera
|
|
215
|
+
*/
|
|
216
|
+
const ok = await validateFaceFromImage(data.image);
|
|
217
|
+
if (!ok) {
|
|
218
|
+
return {
|
|
219
|
+
name: 'FaceNotFoundError',
|
|
220
|
+
message: 'Please ensure your face is clearly visible in the photo.',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
const disclosure = useDisclosure({
|
|
226
|
+
onOpenChange(open) {
|
|
227
|
+
if (open) {
|
|
228
|
+
camera.open();
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
const [faceFound, setFaceFound] = useState(false);
|
|
233
|
+
useInterval(async () => {
|
|
234
|
+
if (!camera.videoRef.current || !guideRef.current) {
|
|
235
|
+
return setFaceFound(false);
|
|
236
|
+
}
|
|
237
|
+
setFaceFound(await validateFace(camera.videoRef.current, guideRef.current));
|
|
238
|
+
}, disclosure.open && !camera.data && !camera.error && !camera.loading
|
|
239
|
+
? 1000
|
|
240
|
+
: null);
|
|
241
|
+
return {
|
|
242
|
+
field,
|
|
243
|
+
value,
|
|
244
|
+
setValue,
|
|
245
|
+
query,
|
|
246
|
+
mutation,
|
|
247
|
+
camera,
|
|
248
|
+
disclosure,
|
|
249
|
+
inputRef,
|
|
250
|
+
guideRef,
|
|
251
|
+
maskRef,
|
|
252
|
+
faceFound,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
const [SelfieFieldProvider, useSelfieFieldContext] = createContext();
|
|
256
|
+
/*
|
|
257
|
+
* -------------------------------------
|
|
258
|
+
* Utils
|
|
259
|
+
* -------------------------------------
|
|
260
|
+
*/
|
|
261
|
+
let __video_detector__;
|
|
262
|
+
let __image_detector__;
|
|
263
|
+
async function getDetector(mode) {
|
|
264
|
+
if (mode === 'VIDEO' && __video_detector__)
|
|
265
|
+
return __video_detector__;
|
|
266
|
+
if (mode === 'IMAGE' && __image_detector__)
|
|
267
|
+
return __image_detector__;
|
|
268
|
+
const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.0/wasm');
|
|
269
|
+
if (mode === 'VIDEO') {
|
|
270
|
+
__video_detector__ = await FaceDetector.createFromOptions(vision, {
|
|
271
|
+
baseOptions: {
|
|
272
|
+
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite',
|
|
273
|
+
delegate: 'GPU',
|
|
274
|
+
},
|
|
275
|
+
runningMode: 'VIDEO',
|
|
276
|
+
});
|
|
277
|
+
return __video_detector__;
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
__image_detector__ = await FaceDetector.createFromOptions(vision, {
|
|
281
|
+
baseOptions: {
|
|
282
|
+
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite',
|
|
283
|
+
delegate: 'GPU',
|
|
284
|
+
},
|
|
285
|
+
runningMode: 'IMAGE',
|
|
286
|
+
});
|
|
287
|
+
return __image_detector__;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async function validateFace(video, guide) {
|
|
291
|
+
if (video.readyState < 2)
|
|
292
|
+
return false;
|
|
293
|
+
const detector = await getDetector('VIDEO');
|
|
294
|
+
const result = detector.detectForVideo(video, performance.now());
|
|
295
|
+
const detection = result.detections.at(0);
|
|
296
|
+
if (!detection)
|
|
297
|
+
return false;
|
|
298
|
+
const category = detection.categories.at(0);
|
|
299
|
+
if (!category || category.score < 0.75)
|
|
300
|
+
return false;
|
|
301
|
+
const videoRect = video.getBoundingClientRect(); // DOM position & size
|
|
302
|
+
const guideRect = guide.getBoundingClientRect();
|
|
303
|
+
if (!detection.boundingBox)
|
|
304
|
+
return false;
|
|
305
|
+
const faceLeft = videoRect.left +
|
|
306
|
+
(detection.boundingBox.originX / video.videoWidth) * videoRect.width;
|
|
307
|
+
const faceTop = videoRect.top +
|
|
308
|
+
(detection.boundingBox.originY / video.videoHeight) * videoRect.height;
|
|
309
|
+
const faceRight = faceLeft +
|
|
310
|
+
(detection.boundingBox.width / video.videoWidth) * videoRect.width;
|
|
311
|
+
const faceBottom = faceTop +
|
|
312
|
+
(detection.boundingBox.height / video.videoHeight) * videoRect.height;
|
|
313
|
+
const isInside = faceLeft >= guideRect.left &&
|
|
314
|
+
faceTop >= guideRect.top &&
|
|
315
|
+
faceRight <= guideRect.right &&
|
|
316
|
+
faceBottom <= guideRect.bottom;
|
|
317
|
+
return isInside;
|
|
318
|
+
}
|
|
319
|
+
async function validateFaceFromImage(image) {
|
|
320
|
+
const detector = await getDetector('IMAGE');
|
|
321
|
+
const result = detector.detect(image);
|
|
322
|
+
const detection = result.detections.at(0);
|
|
323
|
+
if (!detection)
|
|
324
|
+
return false;
|
|
325
|
+
const category = detection.categories.at(0);
|
|
326
|
+
return !category || category.score < 0.75 ? false : true;
|
|
327
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import dynamic from 'next/dynamic';
|
|
4
|
+
import { Spinner02Icon } from '../../icons/Spinner02Icon.js';
|
|
5
|
+
const Component = dynamic(() => import('./SelfieField.client.js').then((mod) => mod.SelfieField__client), {
|
|
6
|
+
ssr: false,
|
|
7
|
+
loading: () => (_jsx("div", { className: "border-border-primary bg-bg-primary flex aspect-[352/180] w-full shrink-0 items-center justify-center rounded-xl border", children: _jsx(Spinner02Icon, { className: "text-text-quinary size-8" }) })),
|
|
8
|
+
});
|
|
9
|
+
export function SelfieField(props) {
|
|
10
|
+
return _jsx(Component, { ...props });
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const BRANCH_CODES = [
|
|
2
|
+
{
|
|
3
|
+
code: 'BRCAL',
|
|
4
|
+
name: 'Bingo Republic 2nd floor Primark Center Deparo St., Caloocan City',
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
code: 'BRNAG',
|
|
8
|
+
name: 'Bingo Republic 3rd floor Robinsons Mall, Naga City, Camarines Sur',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
code: 'BRANT',
|
|
12
|
+
name: 'Bingo Republic 2nd floor Robinsons Mall, San Vicente,Antique',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
code: 'BRCLA',
|
|
16
|
+
name: 'Clark',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
code: 'BRLAG',
|
|
20
|
+
name: 'Laguna',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
code: 'BREAS',
|
|
24
|
+
name: 'Eastwood City, Quezon City',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
code: 'BRMAR',
|
|
28
|
+
name: 'Bingo ng Bayan 4th floor Marikina Public Market, Marikina City',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
code: 'BRILO',
|
|
32
|
+
name: 'Iloilo',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: 'BRFIM',
|
|
36
|
+
name: 'Fisher Mall,Quezon City',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: 'BRCAC',
|
|
40
|
+
name: 'Villa Caceres Hotel, Naga City,Camsur',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import sharp from 'sharp';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { validateFile } from '../utils/validateFile.js';
|
|
5
|
+
const TransformIdFrontImageDefinition = z.object({
|
|
6
|
+
image: z.instanceof(File).superRefine((file, context) => {
|
|
7
|
+
const error = validateFile(file);
|
|
8
|
+
if (error) {
|
|
9
|
+
context.addIssue({
|
|
10
|
+
code: z.ZodIssueCode.custom,
|
|
11
|
+
message: error.message,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
cropTop: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
16
|
+
cropLeft: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
17
|
+
cropWidth: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
18
|
+
cropHeight: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
19
|
+
});
|
|
20
|
+
export async function postTransformIdFrontImage(request) {
|
|
21
|
+
const form = await request.formData();
|
|
22
|
+
const parsed = TransformIdFrontImageDefinition.safeParse({
|
|
23
|
+
image: form.get('image'),
|
|
24
|
+
cropTop: form.get('cropTop'),
|
|
25
|
+
cropLeft: form.get('cropLeft'),
|
|
26
|
+
cropWidth: form.get('cropWidth'),
|
|
27
|
+
cropHeight: form.get('cropHeight'),
|
|
28
|
+
});
|
|
29
|
+
if (!parsed.success) {
|
|
30
|
+
return NextResponse.json({
|
|
31
|
+
ok: false,
|
|
32
|
+
message: parsed.error.issues[0].message,
|
|
33
|
+
__error: parsed.error,
|
|
34
|
+
}, { status: 400 });
|
|
35
|
+
}
|
|
36
|
+
const file = parsed.data.image;
|
|
37
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
38
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
39
|
+
const cropped = await sharp(buffer)
|
|
40
|
+
.extract({
|
|
41
|
+
top: parsed.data.cropTop,
|
|
42
|
+
left: parsed.data.cropLeft,
|
|
43
|
+
width: parsed.data.cropWidth,
|
|
44
|
+
height: parsed.data.cropHeight,
|
|
45
|
+
})
|
|
46
|
+
.resize({
|
|
47
|
+
width: 1200,
|
|
48
|
+
height: 757,
|
|
49
|
+
kernel: sharp.kernel.lanczos3,
|
|
50
|
+
withoutEnlargement: true,
|
|
51
|
+
})
|
|
52
|
+
.modulate({
|
|
53
|
+
brightness: 1.025,
|
|
54
|
+
saturation: 1.025,
|
|
55
|
+
})
|
|
56
|
+
.median(3)
|
|
57
|
+
.blur()
|
|
58
|
+
.sharpen()
|
|
59
|
+
.webp()
|
|
60
|
+
.toBuffer();
|
|
61
|
+
return new NextResponse(cropped, {
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'image/webp',
|
|
64
|
+
'Content-Disposition': `inline; filename="id-front-${Date.now()}.webp"`,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { NextResponse } from 'next/server';
|
|
2
|
+
import sharp from 'sharp';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { validateFile } from '../utils/validateFile.js';
|
|
5
|
+
const TransformSelfieImageDefinition = z.object({
|
|
6
|
+
image: z.instanceof(File).superRefine((file, context) => {
|
|
7
|
+
const error = validateFile(file);
|
|
8
|
+
if (error) {
|
|
9
|
+
context.addIssue({
|
|
10
|
+
code: z.ZodIssueCode.custom,
|
|
11
|
+
message: error.message,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
cropTop: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
16
|
+
cropLeft: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
17
|
+
cropWidth: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
18
|
+
cropHeight: z.number().or(z.string().transform((v) => Math.round(Number(v)))),
|
|
19
|
+
});
|
|
20
|
+
export async function postTransformSelfieImage(request) {
|
|
21
|
+
const form = await request.formData();
|
|
22
|
+
const parsed = TransformSelfieImageDefinition.safeParse({
|
|
23
|
+
image: form.get('image'),
|
|
24
|
+
cropTop: form.get('cropTop'),
|
|
25
|
+
cropLeft: form.get('cropLeft'),
|
|
26
|
+
cropWidth: form.get('cropWidth'),
|
|
27
|
+
cropHeight: form.get('cropHeight'),
|
|
28
|
+
});
|
|
29
|
+
if (!parsed.success) {
|
|
30
|
+
return NextResponse.json({
|
|
31
|
+
ok: false,
|
|
32
|
+
message: parsed.error.issues[0].message,
|
|
33
|
+
__error: parsed.error,
|
|
34
|
+
}, { status: 400 });
|
|
35
|
+
}
|
|
36
|
+
const file = parsed.data.image;
|
|
37
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
38
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
39
|
+
const cropped = await sharp(buffer)
|
|
40
|
+
.extract({
|
|
41
|
+
top: parsed.data.cropTop,
|
|
42
|
+
left: parsed.data.cropLeft,
|
|
43
|
+
width: parsed.data.cropWidth,
|
|
44
|
+
height: parsed.data.cropHeight,
|
|
45
|
+
})
|
|
46
|
+
.resize({
|
|
47
|
+
width: 1200,
|
|
48
|
+
height: 1200,
|
|
49
|
+
kernel: sharp.kernel.lanczos3,
|
|
50
|
+
withoutEnlargement: true,
|
|
51
|
+
})
|
|
52
|
+
.sharpen({
|
|
53
|
+
sigma: 1.15,
|
|
54
|
+
m1: 2.0,
|
|
55
|
+
m2: 5.0,
|
|
56
|
+
})
|
|
57
|
+
.modulate({
|
|
58
|
+
brightness: 1.025,
|
|
59
|
+
saturation: 1.025,
|
|
60
|
+
})
|
|
61
|
+
.median(3)
|
|
62
|
+
.blur()
|
|
63
|
+
.webp()
|
|
64
|
+
.toBuffer();
|
|
65
|
+
return new NextResponse(cropped, {
|
|
66
|
+
headers: {
|
|
67
|
+
'Content-Type': 'image/webp',
|
|
68
|
+
'Content-Disposition': `inline; filename="selfie-${Date.now()}.webp"`,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NextResponse, type NextRequest } from 'next/server';
|
|
2
|
+
import type { Session } from './types';
|
|
3
|
+
export declare const GET: (request: NextRequest, { params }: {
|
|
4
|
+
params: Promise<{
|
|
5
|
+
auth: string[];
|
|
6
|
+
}>;
|
|
7
|
+
}) => Promise<NextResponse<{
|
|
8
|
+
ok: true;
|
|
9
|
+
data?: never;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
message: string;
|
|
13
|
+
__error?: unknown;
|
|
14
|
+
}> | NextResponse<{
|
|
15
|
+
ok: false;
|
|
16
|
+
message: string;
|
|
17
|
+
__error?: unknown;
|
|
18
|
+
} | {
|
|
19
|
+
ok: true;
|
|
20
|
+
data: Session;
|
|
21
|
+
}>>;
|
|
22
|
+
export declare const DELETE: (request: NextRequest, { params }: {
|
|
23
|
+
params: Promise<{
|
|
24
|
+
auth: string[];
|
|
25
|
+
}>;
|
|
26
|
+
}) => Promise<NextResponse<{
|
|
27
|
+
ok: true;
|
|
28
|
+
data?: never;
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
message: string;
|
|
32
|
+
__error?: unknown;
|
|
33
|
+
}>>;
|
|
34
|
+
export declare const POST: (request: NextRequest, { params }: {
|
|
35
|
+
params: Promise<{
|
|
36
|
+
auth: string[];
|
|
37
|
+
}>;
|
|
38
|
+
}) => Promise<NextResponse>;
|
|
39
|
+
export declare const PATCH: (request: NextRequest, { params }: {
|
|
40
|
+
params: Promise<{
|
|
41
|
+
auth: string[];
|
|
42
|
+
}>;
|
|
43
|
+
}) => Promise<NextResponse>;
|