@opexa/portal-components 0.0.304 → 0.0.305

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +13 -40
  2. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  3. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  4. package/dist/components/FeatureFlag/index.d.ts +1 -0
  5. package/dist/components/FeatureFlag/index.js +1 -0
  6. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  7. package/dist/components/KYC/AutoOpen.js +40 -0
  8. package/dist/components/KYC/backup/Header.d.ts +1 -0
  9. package/dist/components/KYC/backup/Header.js +8 -0
  10. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  11. package/dist/components/KYC/backup/Indicator.js +9 -0
  12. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  13. package/dist/components/KYC/backup/KYC.js +14 -0
  14. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  15. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  16. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  17. package/dist/components/KYC/backup/KYCContext.js +2 -0
  18. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  19. package/dist/components/KYC/backup/Step1.js +13 -0
  20. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  21. package/dist/components/KYC/backup/Step2.js +13 -0
  22. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  23. package/dist/components/KYC/backup/Step3.js +13 -0
  24. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  25. package/dist/components/KYC/backup/Step4.js +7 -0
  26. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  27. package/dist/components/KYC/backup/useKYC.js +8 -0
  28. package/dist/components/KYC/loadModels.d.ts +1 -0
  29. package/dist/components/KYC/loadModels.js +9 -0
  30. package/dist/components/Messages/Message.d.ts +1 -0
  31. package/dist/components/Messages/Message.js +35 -0
  32. package/dist/components/Messages/MessageContext.d.ts +6 -0
  33. package/dist/components/Messages/MessageContext.js +2 -0
  34. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  35. package/dist/components/Messages/MessagePopup.js +20 -0
  36. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  37. package/dist/components/Messages/MessageTrigger.js +19 -0
  38. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  39. package/dist/components/Quests/CountdownTimer.js +33 -0
  40. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  41. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  42. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  43. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  44. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  45. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  46. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  47. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  48. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  49. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  50. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  51. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  52. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  53. package/dist/components/SignUp/SignUpContext.js +2 -0
  54. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +1 -2
  55. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +1 -1
  56. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +6 -4
  57. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  58. package/dist/components/SignUp/SignUpForm.js +284 -0
  59. package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.d.ts +1 -1
  60. package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +7 -5
  61. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  62. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  63. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  64. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  65. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  66. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  67. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  68. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  69. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  70. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  71. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  72. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  73. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  74. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  75. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  76. package/dist/components/shared/IdDocumentField.client.js +204 -0
  77. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  78. package/dist/components/shared/IdDocumentField.js +11 -0
  79. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  80. package/dist/components/shared/SelfieField.client.js +327 -0
  81. package/dist/components/shared/SelfieField.d.ts +2 -0
  82. package/dist/components/shared/SelfieField.js +11 -0
  83. package/dist/constants/BranchCode.d.ts +4 -0
  84. package/dist/constants/BranchCode.js +42 -0
  85. package/dist/constants/EnvVar.d.ts +1 -1
  86. package/dist/constants/index.d.ts +0 -1
  87. package/dist/constants/index.js +0 -1
  88. package/dist/handlers/postTransformIdFrontImage.js +6 -21
  89. package/dist/handlers/postTransformSelfieImage.js +9 -20
  90. package/dist/handlers.d.ts +43 -0
  91. package/dist/handlers.js +297 -0
  92. package/dist/icons/BellRingIcon.d.ts +2 -0
  93. package/dist/icons/BellRingIcon.js +4 -0
  94. package/dist/ui/AlertDialog/AlertDialog.d.ts +187 -187
  95. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +17 -17
  96. package/dist/ui/Avatar/Avatar.d.ts +9 -9
  97. package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
  98. package/dist/ui/Badge/Badge.d.ts +12 -12
  99. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  100. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  101. package/dist/ui/Carousel/Carousel.d.ts +99 -99
  102. package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
  103. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  104. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  105. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  106. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  107. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  108. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  109. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  110. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  111. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  112. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  113. package/dist/ui/Dialog/Dialog.d.ts +187 -187
  114. package/dist/ui/Dialog/dialog.recipe.d.ts +17 -17
  115. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  116. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  117. package/dist/ui/Field/Field.d.ts +21 -21
  118. package/dist/ui/Field/field.recipe.d.ts +3 -3
  119. package/dist/ui/Menu/Menu.d.ts +198 -198
  120. package/dist/ui/Menu/menu.recipe.d.ts +11 -11
  121. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  122. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  123. package/dist/ui/Popover/Popover.d.ts +187 -187
  124. package/dist/ui/Popover/popover.recipe.d.ts +17 -17
  125. package/dist/ui/Progress/Progress.d.ts +27 -27
  126. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  127. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  128. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  129. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  130. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  131. package/dist/ui/Select/Select.d.ts +45 -45
  132. package/dist/ui/Select/select.recipe.d.ts +3 -3
  133. package/dist/ui/Table/Table.d.ts +21 -21
  134. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  135. package/dist/ui/Table/table.recipe.d.ts +3 -3
  136. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  137. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  138. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  139. package/dist/utils/dataUrlToBlob.js +11 -0
  140. package/dist/utils/resizeImageSize.d.ts +2 -0
  141. package/dist/utils/resizeImageSize.js +11 -0
  142. package/package.json +1 -1
  143. package/dist/client/utils/recaptcha.d.ts +0 -14
  144. package/dist/client/utils/recaptcha.js +0 -18
  145. package/dist/components/Banner/Banner.client.d.ts +0 -12
  146. package/dist/components/Banner/Banner.client.js +0 -49
@@ -53,7 +53,7 @@ import { useSignUpKYCPropsContext } from './SignUpKYCContext.js';
53
53
  export function SignUpKYCForm() {
54
54
  const props = useSignUpKYCPropsContext();
55
55
  const branchCollection = createListCollection({
56
- items: props.branches,
56
+ items: props.branches ?? [],
57
57
  itemToValue: (item) => item.code,
58
58
  itemToString: (item) => `${item.code} - ${item.name}`,
59
59
  });
@@ -138,7 +138,9 @@ export function SignUpKYCForm() {
138
138
  });
139
139
  }
140
140
  }),
141
- branchCode: z.string().min(1, 'Branch is required').trim(),
141
+ branchCode: (props?.branches ?? []).length > 0
142
+ ? z.string().min(1, 'Branch is required').trim()
143
+ : z.string().optional(),
142
144
  selfieImage: fileSchema,
143
145
  frontImage: fileSchema,
144
146
  termsAccepted: z.boolean().superRefine((v, ctx) => {
@@ -250,7 +252,7 @@ export function SignUpKYCForm() {
250
252
  });
251
253
  }, onBlur: () => {
252
254
  step1Form.trigger('birthDay');
253
- } }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.birthDay?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.branchCode, className: "mt-xl", children: [_jsxs(Select.Root, { value: [branchCode], onValueChange: (details) => {
255
+ } }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.birthDay?.message })] }), props.branches && (_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.branchCode, className: "mt-xl", children: [_jsxs(Select.Root, { value: [branchCode ?? ''], onValueChange: (details) => {
254
256
  step1Form.setValue('branchCode', details.value?.[0], {
255
257
  shouldDirty: true,
256
258
  shouldTouch: true,
@@ -262,7 +264,7 @@ export function SignUpKYCForm() {
262
264
  }, lazyMount: true, unmountOnExit: true, children: [_jsx(Select.Label, { className: "flex items-center gap-1", children: "Select Nearest Branch Around You" }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item) => {
263
265
  const label = branchCollection.stringifyItem(item) ?? '';
264
266
  return (_jsx(Select.Item, { item: item, "aria-disabled": item.disabled, className: twMerge(item.disabled && 'text-border-disabled'), children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
265
- }) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] }), _jsx(Controller, { control: step1Form.control, name: "frontImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(IdFrontImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
267
+ }) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] })), _jsx(Controller, { control: step1Form.control, name: "frontImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(IdFrontImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
266
268
  step1Form.setValue('frontImage', null);
267
269
  step1Form.setError('frontImage', {
268
270
  type: 'validate',
@@ -300,7 +302,7 @@ export function SignUpKYCForm() {
300
302
  globalStore.responsibleGaming.setNext('SIGN_UP');
301
303
  globalStore.signUp.setOpen(false);
302
304
  }
303
- }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _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: "gap-xs mt-6 flex w-full items-center justify-center text-sm pb-8", 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: () => {
305
+ }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _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: "gap-xs mt-6 flex w-full items-center justify-center pb-8 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: () => {
304
306
  dialog.setOpen(false);
305
307
  globalStore.signIn.setOpen(true);
306
308
  }, 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 }) => {
@@ -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;
@@ -0,0 +1,251 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as faceapi from 'face-api.js';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
7
+ import { Camera01Icon } from '../../../icons/Camera01Icon.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 { onMobileDevice } from '../../../utils/onMobileDevice.js';
13
+ import PersonOverlayDesktop from '../../KYC/PersonOverlayDesktop.js';
14
+ import { dataURLtoBlob, loadFaceApiModels, resizeFile } from '../../KYC/utils.js';
15
+ import { useSignUpPagcorPropsContext } from './SignUpPagcorContext.js';
16
+ export function CaptureSelfie() {
17
+ const props = useSignUpPagcorPropsContext();
18
+ const mobileDevice = onMobileDevice();
19
+ const [modelsLoaded, setModelsLoaded] = useState(false);
20
+ const [videoStream, setVideoStream] = useState(null);
21
+ const [cameraError, setCameraError] = useState(null);
22
+ const [captureInProgress, setCaptureInProgress] = useState(false);
23
+ const [selectedImage, setSelectedImage] = useState(null);
24
+ const [isFaceCentered, setIsFaceCentered] = useState(false);
25
+ const [isCapturing, setIsCapturing] = useState(false);
26
+ const [countdown, setCountdown] = useState(3);
27
+ const videoRef = useRef(null);
28
+ const faceCanvasRef = useRef(null);
29
+ const detectionIntervalRef = useRef(null);
30
+ const countdownTimerRef = useRef(null);
31
+ useEffect(() => {
32
+ loadFaceApiModels()
33
+ .then(() => setModelsLoaded(true))
34
+ .catch(() => setModelsLoaded(false));
35
+ }, []);
36
+ useEffect(() => {
37
+ if (captureInProgress) {
38
+ startFaceDetection();
39
+ }
40
+ }, [captureInProgress]);
41
+ async function startCamera() {
42
+ setCaptureInProgress(true);
43
+ const stream = await navigator.mediaDevices.getUserMedia({
44
+ video: {
45
+ facingMode: mobileDevice ? 'user' : 'environment',
46
+ aspectRatio: mobileDevice ? 9 / 16 : 16 / 9,
47
+ width: { ideal: 1920 },
48
+ height: { ideal: 1080 },
49
+ },
50
+ audio: false,
51
+ });
52
+ setVideoStream(stream);
53
+ if (videoRef.current) {
54
+ videoRef.current.srcObject = stream;
55
+ videoRef.current.onloadedmetadata = () => {
56
+ videoRef.current
57
+ ?.play()
58
+ .then(() => {
59
+ if (modelsLoaded) {
60
+ startFaceDetection();
61
+ }
62
+ })
63
+ .catch((error) => {
64
+ console.error('Error playing video:', error);
65
+ setCameraError('Failed to play video stream. Please check your camera settings.');
66
+ });
67
+ };
68
+ }
69
+ }
70
+ function startFaceDetection() {
71
+ if (!modelsLoaded) {
72
+ console.error('Cannot start face detection: video element not ready or models not loaded');
73
+ return;
74
+ }
75
+ if (!faceCanvasRef.current) {
76
+ faceCanvasRef.current = faceapi.createCanvasFromMedia(videoRef.current);
77
+ const parentDiv = document.getElementById('parent');
78
+ faceCanvasRef.current.className = `absolute inset-0 m-auto h-${parentDiv?.clientHeight} w-${parentDiv?.clientWidth} md:aspect-video object-cover md:object-contain`;
79
+ faceCanvasRef.current.style.width = `${videoRef.current?.clientWidth}px`;
80
+ faceCanvasRef.current.style.height = `${videoRef.current?.clientHeight}px`;
81
+ }
82
+ const displaySize = {
83
+ width: videoRef.current?.clientWidth || 643,
84
+ height: videoRef.current?.clientHeight || 333,
85
+ };
86
+ // Clear any existing interval
87
+ if (detectionIntervalRef.current) {
88
+ clearInterval(detectionIntervalRef.current);
89
+ }
90
+ faceapi.matchDimensions(faceCanvasRef.current, displaySize);
91
+ let countdownInterval = null;
92
+ detectionIntervalRef.current = window.setInterval(async () => {
93
+ if (!videoRef.current || !faceCanvasRef.current) {
94
+ console.error('Video or canvas element is not ready');
95
+ return;
96
+ }
97
+ try {
98
+ const detection = await faceapi
99
+ .detectSingleFace(videoRef.current, new faceapi.TinyFaceDetectorOptions())
100
+ .withFaceLandmarks();
101
+ if (detection) {
102
+ const resizedDetection = faceapi.resizeResults(detection, displaySize);
103
+ const frame_height = resizedDetection.detection.box.height;
104
+ const frame_width = resizedDetection.detection.box.width;
105
+ const frame_x = resizedDetection.detection.box.x;
106
+ const frame_y = resizedDetection.detection.box.y;
107
+ const faceCenterX = frame_x + frame_width / 2;
108
+ const faceCenterY = frame_y + frame_height / 2;
109
+ const screenCenterX = displaySize.width / 2;
110
+ const screenCenterY = displaySize.height / 2;
111
+ const centerThresholdX = displaySize.width * 0.15;
112
+ const centerThresholdY = displaySize.height * 0.15;
113
+ const isFaceCentered = Math.abs(faceCenterX - screenCenterX) <= centerThresholdX &&
114
+ Math.abs(faceCenterY - screenCenterY) <= centerThresholdY;
115
+ setIsFaceCentered(isFaceCentered);
116
+ const faceDetectionConfidence = detection.detection.score * 100;
117
+ // const context = faceCanvasRef.current.getContext('2d');
118
+ // if (context) {
119
+ // context.clearRect(
120
+ // 0,
121
+ // 0,
122
+ // faceCanvasRef.current.width,
123
+ // faceCanvasRef.current.height,
124
+ // );
125
+ // faceapi.draw.drawDetections(
126
+ // faceCanvasRef.current,
127
+ // resizedDetection,
128
+ // );
129
+ // faceapi.draw.drawFaceLandmarks(
130
+ // faceCanvasRef.current,
131
+ // resizedDetection,
132
+ // );
133
+ // }
134
+ //adjust the faceDetectionConfidence if need
135
+ if (isFaceCentered && faceDetectionConfidence >= 65) {
136
+ if (!countdownInterval) {
137
+ setIsCapturing(true);
138
+ countdownInterval = setInterval(() => {
139
+ setCountdown((prev) => {
140
+ if (prev === 1) {
141
+ clearInterval(countdownInterval);
142
+ countdownInterval = null;
143
+ captureImage();
144
+ return 3;
145
+ }
146
+ return prev - 1;
147
+ });
148
+ }, 1000);
149
+ }
150
+ }
151
+ else {
152
+ if (countdownInterval) {
153
+ clearInterval(countdownInterval);
154
+ countdownInterval = null;
155
+ setCountdown(3);
156
+ setIsCapturing(false);
157
+ }
158
+ }
159
+ }
160
+ }
161
+ catch (error) {
162
+ console.error('Error during face detection:', error);
163
+ setCameraError('An error occurred while detecting your face. Please try again.');
164
+ }
165
+ }, 100);
166
+ }
167
+ function stopCamera() {
168
+ setCaptureInProgress(false);
169
+ if (detectionIntervalRef.current) {
170
+ clearInterval(detectionIntervalRef.current);
171
+ detectionIntervalRef.current = null;
172
+ }
173
+ if (countdownTimerRef.current) {
174
+ clearInterval(countdownTimerRef.current);
175
+ countdownTimerRef.current = null;
176
+ }
177
+ if (videoStream) {
178
+ videoStream.getTracks().forEach((track) => track.stop());
179
+ setVideoStream(null);
180
+ }
181
+ if (videoRef.current && videoRef.current.srcObject) {
182
+ const stream = videoRef.current.srcObject;
183
+ stream.getTracks().forEach((track) => {
184
+ track.stop();
185
+ });
186
+ videoRef.current.srcObject = null;
187
+ videoRef.current.pause();
188
+ videoRef.current.currentTime = 0;
189
+ videoRef.current.load();
190
+ }
191
+ setCountdown(3);
192
+ }
193
+ function captureImage() {
194
+ if (videoRef.current && faceCanvasRef.current) {
195
+ const canvas = document.createElement('canvas');
196
+ canvas.width = videoRef.current.videoWidth;
197
+ canvas.height = videoRef.current.videoHeight;
198
+ const context = canvas.getContext('2d');
199
+ if (context) {
200
+ context.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
201
+ const imageData = canvas.toDataURL('image/png');
202
+ setSelectedImage(imageData);
203
+ stopCamera();
204
+ }
205
+ }
206
+ }
207
+ function retakePhoto() {
208
+ setSelectedImage(null);
209
+ setCaptureInProgress(true);
210
+ setCameraError(null);
211
+ if (faceCanvasRef.current) {
212
+ const canvas = faceCanvasRef.current.querySelector('canvas');
213
+ if (canvas) {
214
+ canvas.width = canvas.width;
215
+ }
216
+ faceCanvasRef.current.innerHTML = '';
217
+ }
218
+ if (videoRef.current) {
219
+ videoRef.current.play();
220
+ }
221
+ startCamera();
222
+ }
223
+ async function usePhoto() {
224
+ if (!selectedImage) {
225
+ console.error('No photo selected to use');
226
+ return;
227
+ }
228
+ const blob = dataURLtoBlob(selectedImage);
229
+ const img = new File([blob], 'image', { type: blob.type });
230
+ const resizedImage = (await resizeFile(img));
231
+ if (resizedImage) {
232
+ props.setSelfieImage(resizedImage);
233
+ props.setCapturing(null);
234
+ stopCamera();
235
+ }
236
+ }
237
+ useEffect(() => {
238
+ return () => {
239
+ if (detectionIntervalRef.current) {
240
+ clearInterval(detectionIntervalRef.current);
241
+ }
242
+ if (countdownTimerRef.current) {
243
+ clearInterval(countdownTimerRef.current);
244
+ }
245
+ };
246
+ }, []);
247
+ return (_jsx(Dialog.Root, { open: props.capturing === 'SELFIE', 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: () => {
248
+ stopCamera();
249
+ props.setCapturing(null);
250
+ }, 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 Selfie Holding Your ID" }), _jsx(Dialog.Description, { className: "text-text-tertiary-600 mx-auto mt-sm max-w-[19rem] text-center text-sm lg:max-w-full", children: "Make sure your face and ID are clearly visible, with no glare or blur." }), _jsx("div", { id: "parent", className: "border-border-disabled mt-6 aspect-video rounded-xl border bg-black lg:mt-8", children: captureInProgress ? (_jsxs("div", { className: "relative flex h-fit w-full flex-col items-center justify-center", children: [_jsx("video", { ref: videoRef, autoPlay: true, muted: true, className: "h-[60vh] w-full rounded-lg object-cover md:aspect-video md:h-[333px]", width: "100%", height: "100%" }), _jsx("canvas", { ref: faceCanvasRef, className: "absolute inset-0 h-[60vh] w-full object-cover md:aspect-video md:h-[333px] md:object-contain", width: "100%", height: "100%" }), isCapturing && (_jsx("span", { className: "absolute inset-x-0 bottom-8 flex items-center justify-center text-5xl font-bold text-[#713B12CC] md:bottom-4", children: countdown })), !isFaceCentered && (_jsx("span", { className: "absolute inset-x-0 bottom-12 mx-auto w-1/2 text-center text-xs text-white md:bottom-3", children: "Please center your face in the camera view. Make sure your ID is clearly visible next to your face." })), _jsx(PersonOverlayDesktop, { isFaceCentered: isFaceCentered, width: videoRef.current?.clientWidth || 543, height: videoRef.current?.clientHeight || 333 })] })) : (selectedImage && (_jsx("img", { src: selectedImage, alt: "Captured Photo", className: "h-full w-full rounded-lg object-cover md:aspect-video md:h-[333px]" }))) }), selectedImage && (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2 md:flex-row", children: [_jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-4 px-xl disabled:opacity-100", size: "sm", onClick: retakePhoto, type: "button", children: ["Retake Photo", _jsx(Camera01Icon, { className: "size-5" })] }), _jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-4 px-xl disabled:opacity-100", size: "sm", onClick: usePhoto, type: "button", children: ["Use Photo", _jsx(Camera01Icon, { className: "size-5" })] })] })), !captureInProgress && (_jsxs(Button, { className: twMerge('mx-auto mt-6 px-xl lg:mt-8', selectedImage && 'hidden'), onClick: startCamera, disabled: !modelsLoaded, type: "button", children: ["Start Camera", _jsx(Camera01Icon, { className: "size-5" })] }))] }) }) })] }) }));
251
+ }
@@ -0,0 +1,10 @@
1
+ import type { CaptureSubject } from '../../KYC/useKYC';
2
+ interface FileUploadProps {
3
+ name: string;
4
+ value: File | null;
5
+ hasDescription?: boolean;
6
+ onChange?: (id: File) => void;
7
+ captureObject: CaptureSubject;
8
+ }
9
+ declare function ImageUploader({ value, name, hasDescription, onChange, captureObject, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
10
+ export default ImageUploader;
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import Image from 'next/image';
4
+ import { useEffect, useRef, useState } from 'react';
5
+ import { UploadCloud02Icon } from '../../../icons/UploadCloud02Icon.js';
6
+ import { Button } from '../../../ui/Button/index.js';
7
+ import { validateFile } from '../../KYC/utils.js';
8
+ import { useSignUpPagcorPropsContext } from './SignUpPagcorContext.js';
9
+ function ImageUploader({ value, name, hasDescription = true, onChange, captureObject, }) {
10
+ const props = useSignUpPagcorPropsContext();
11
+ const [previewUrl, setPreviewUrl] = useState(null);
12
+ const [error, setError] = useState(null);
13
+ const fileInputRef = useRef(null);
14
+ const handleFileChange = (event) => {
15
+ const file = event.target.files?.[0];
16
+ if (!file) {
17
+ setError('No file selected');
18
+ return;
19
+ }
20
+ const validationError = validateFile(file);
21
+ if (validationError) {
22
+ setError(validationError);
23
+ return;
24
+ }
25
+ setError(null);
26
+ const url = URL.createObjectURL(file);
27
+ setPreviewUrl(url);
28
+ onChange?.(file);
29
+ return () => URL.revokeObjectURL(url);
30
+ };
31
+ const handleUploadClick = () => {
32
+ fileInputRef.current?.click();
33
+ };
34
+ useEffect(() => {
35
+ if (value) {
36
+ setPreviewUrl(URL.createObjectURL(value));
37
+ }
38
+ }, [value]);
39
+ return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col items-center justify-center gap-lg rounded-xl border px-3xl py-xl", children: [error && (_jsx("p", { className: "text-text-error-600 mb-2 text-center text-sm", children: error })), previewUrl ? (_jsxs("div", { className: "flex w-full flex-col items-center", children: [_jsx("div", { className: "relative h-[9.25rem] w-full overflow-hidden rounded-md", children: _jsx(Image, { src: previewUrl, alt: "Uploaded image preview", fill: true, className: "object-contain", draggable: false, priority: true }) }), _jsx(Button, { size: "xs", variant: "outline", className: "mt-4 w-fit", type: "button", onClick: handleUploadClick, children: "Reupload" })] })) : (hasDescription && (_jsxs(_Fragment, { children: [_jsx("div", { className: "border-border-primary shadow-xs flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-quinary size-4" }) }), _jsxs("p", { className: "text-text-tertiary-600 text-center text-sm", children: [_jsx("span", { className: "text-button-secondary-fg cursor-pointer font-semibold hover:underline", onClick: handleUploadClick, children: "Click to upload" }), ' ', "or drag and drop", _jsx("br", {}), "PNG, JPG, or JPEG (max. 10MB)"] })] }))), _jsx("input", { type: "file", id: `file-upload-${name}`, name: name, ref: fileInputRef, onChange: handleFileChange, accept: "image/png,image/jpg,image/jpeg", className: "hidden", "aria-label": "Upload image file" }), _jsx(Button, { size: "xs", variant: "outline", className: "mt-4 w-fit", onClick: () => props.setCapturing(captureObject), type: "button", children: value ? 'Retake Photo' : 'Take a Photo' })] }));
40
+ }
41
+ export default ImageUploader;
@@ -0,0 +1 @@
1
+ export declare function SignUpFormPagcor(): import("react/jsx-runtime").JSX.Element;