@opexa/portal-components 0.0.931 → 0.0.932

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 (180) hide show
  1. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +2 -2
  2. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +1 -1
  3. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.d.ts +1 -0
  4. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Confirmed.js +11 -0
  5. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.d.ts +1 -0
  6. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Failed.js +11 -0
  7. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.d.ts +1 -0
  8. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/Form.js +126 -0
  9. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.d.ts +1 -0
  10. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/GeneratingQrCode.js +10 -0
  11. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.d.ts +1 -0
  12. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDeposit.js +12 -0
  13. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.d.ts +17 -0
  14. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QRPHDepositContext.js +2 -0
  15. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.d.ts +1 -0
  16. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/QrCodeGenerated.js +41 -0
  17. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.d.ts +13 -0
  18. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__next/useQRPHDeposit.js +91 -0
  19. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  20. package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  21. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  22. package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  23. package/dist/components/DigitainLauncher/Loading.js +1 -1
  24. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  25. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  26. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  27. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  28. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  29. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  30. package/dist/components/FeatureFlag/index.d.ts +1 -0
  31. package/dist/components/FeatureFlag/index.js +1 -0
  32. package/dist/components/ForgotPassword/Crazywin/ForgotPassword.module.css +42 -42
  33. package/dist/components/Jackpots/Jackpots.module.css +288 -288
  34. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  35. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  36. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  37. package/dist/components/KYC/AutoOpen.js +40 -0
  38. package/dist/components/KYC/BasicInformation.js +1 -1
  39. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  40. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  41. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  42. package/dist/components/KYC/CaptureSelfie.js +285 -0
  43. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  44. package/dist/components/KYC/DisplayImage.js +8 -0
  45. package/dist/components/KYC/FileUpload.d.ts +10 -0
  46. package/dist/components/KYC/FileUpload.js +72 -0
  47. package/dist/components/KYC/IdentityVerification.js +1 -1
  48. package/dist/components/KYC/KYC.lazy.js +1 -1
  49. package/dist/components/KYC/KYCDefault/KYCVerificationStatus.lazy.js +2 -2
  50. package/dist/components/KYC/KYCNonPagCor/KYCVerificationStatus.lazy.js +2 -2
  51. package/dist/components/KYC/KYCVerificationStatus.lazy.js +8 -5
  52. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  53. package/dist/components/KYC/NoCameraError.js +6 -0
  54. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  55. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  56. package/dist/components/KYC/PersonalInformation.js +1 -1
  57. package/dist/components/KYC/backup/Header.d.ts +1 -0
  58. package/dist/components/KYC/backup/Header.js +8 -0
  59. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  60. package/dist/components/KYC/backup/Indicator.js +9 -0
  61. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  62. package/dist/components/KYC/backup/KYC.js +14 -0
  63. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  64. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  65. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  66. package/dist/components/KYC/backup/KYCContext.js +2 -0
  67. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  68. package/dist/components/KYC/backup/Step1.js +13 -0
  69. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  70. package/dist/components/KYC/backup/Step2.js +13 -0
  71. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  72. package/dist/components/KYC/backup/Step3.js +13 -0
  73. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  74. package/dist/components/KYC/backup/Step4.js +7 -0
  75. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  76. package/dist/components/KYC/backup/useKYC.js +8 -0
  77. package/dist/components/KYC/loadModels.d.ts +1 -0
  78. package/dist/components/KYC/loadModels.js +9 -0
  79. package/dist/components/KYC/utils.d.ts +9 -0
  80. package/dist/components/KYC/utils.js +79 -0
  81. package/dist/components/Messages/Message.d.ts +1 -0
  82. package/dist/components/Messages/Message.js +35 -0
  83. package/dist/components/Messages/MessageContext.d.ts +6 -0
  84. package/dist/components/Messages/MessageContext.js +2 -0
  85. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  86. package/dist/components/Messages/MessagePopup.js +20 -0
  87. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  88. package/dist/components/Messages/MessageTrigger.js +19 -0
  89. package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
  90. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  91. package/dist/components/Quests/CountdownTimer.js +33 -0
  92. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  93. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  94. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  95. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  96. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  97. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  98. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  99. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  100. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  101. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  102. package/dist/components/Search/Search.lazy.js +4 -2
  103. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  104. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  105. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  106. package/dist/components/SignUp/SignUpContext.js +2 -0
  107. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  108. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  109. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  110. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  111. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  112. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  113. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  114. package/dist/components/SignUp/SignUpForm.js +284 -0
  115. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  116. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  117. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  118. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  119. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  120. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  121. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  122. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  123. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  124. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  125. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  126. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  127. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  128. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  129. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  130. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  131. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  132. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  133. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  134. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  135. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  136. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  137. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  138. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  139. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  140. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  141. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  142. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  143. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  144. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  145. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  146. package/dist/components/shared/IdDocumentField.client.js +204 -0
  147. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  148. package/dist/components/shared/IdDocumentField.js +11 -0
  149. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  150. package/dist/components/shared/SelfieField.client.js +327 -0
  151. package/dist/components/shared/SelfieField.d.ts +2 -0
  152. package/dist/components/shared/SelfieField.js +11 -0
  153. package/dist/constants/BranchCode.d.ts +4 -0
  154. package/dist/constants/BranchCode.js +42 -0
  155. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  156. package/dist/handlers/postTransformIdFrontImage.js +67 -0
  157. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  158. package/dist/handlers/postTransformSelfieImage.js +71 -0
  159. package/dist/handlers.d.ts +43 -0
  160. package/dist/handlers.js +297 -0
  161. package/dist/icons/BellRingIcon.d.ts +2 -0
  162. package/dist/icons/BellRingIcon.js +4 -0
  163. package/dist/images/phone-icon.svg +10 -10
  164. package/dist/services/queries.js +3369 -3369
  165. package/dist/styles/theme.css +776 -776
  166. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  167. package/dist/utils/dataUrlToBlob.js +11 -0
  168. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  169. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  170. package/dist/utils/getGameName.d.ts +1 -0
  171. package/dist/utils/getGameName.js +6 -0
  172. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  173. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  174. package/dist/utils/resizeImageSize.d.ts +2 -0
  175. package/dist/utils/resizeImageSize.js +11 -0
  176. package/package.json +179 -179
  177. package/dist/components/Banner/Banner.client.d.ts +0 -12
  178. package/dist/components/Banner/Banner.client.js +0 -49
  179. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
  180. package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
@@ -0,0 +1,285 @@
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 { useUploadImageFileMutation } from '../../client/hooks/useUploadImageFileMutation.js';
7
+ import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
8
+ import { Camera01Icon } from '../../icons/Camera01Icon.js';
9
+ import { XIcon } from '../../icons/XIcon.js';
10
+ import { Button } from '../../ui/Button/index.js';
11
+ import { Dialog } from '../../ui/Dialog/index.js';
12
+ import { onMobileDevice } from '../../utils/onMobileDevice.js';
13
+ import { useKYCContext } from './KYCContext.js';
14
+ import NoCameraError from './NoCameraError.js';
15
+ import PersonOverlayDesktop from './PersonOverlayDesktop.js';
16
+ import { dataURLtoBlob, loadFaceApiModels, resizeFile, showPermissionInstructions, } from './utils.js';
17
+ export function CaptureSelfie() {
18
+ const kyc = useKYCContext();
19
+ const { mutate, isPending } = useUploadImageFileMutation();
20
+ const mobileDevice = onMobileDevice();
21
+ const [modelsLoaded, setModelsLoaded] = useState(false);
22
+ const [videoStream, setVideoStream] = useState(null);
23
+ const [cameraError, setCameraError] = useState(null);
24
+ const [captureInProgress, setCaptureInProgress] = useState(false);
25
+ const [selectedImage, setSelectedImage] = useState(null);
26
+ const [isFaceCentered, setIsFaceCentered] = useState(false);
27
+ const [isCapturing, setIsCapturing] = useState(false);
28
+ const [countdown, setCountdown] = useState(3);
29
+ const videoRef = useRef(null);
30
+ const faceCanvasRef = useRef(null);
31
+ const detectionIntervalRef = useRef(null);
32
+ const countdownTimerRef = useRef(null);
33
+ useEffect(() => {
34
+ loadFaceApiModels()
35
+ .then(() => setModelsLoaded(true))
36
+ .catch(() => setModelsLoaded(false));
37
+ }, []);
38
+ useEffect(() => {
39
+ if (captureInProgress) {
40
+ startFaceDetection();
41
+ }
42
+ }, [captureInProgress]);
43
+ async function startCamera() {
44
+ try {
45
+ setCaptureInProgress(true);
46
+ const stream = await navigator.mediaDevices.getUserMedia({
47
+ video: {
48
+ facingMode: mobileDevice ? 'user' : 'environment',
49
+ aspectRatio: mobileDevice ? 9 / 16 : 16 / 9,
50
+ width: { ideal: 1920 },
51
+ height: { ideal: 1080 },
52
+ },
53
+ audio: false,
54
+ });
55
+ setVideoStream(stream);
56
+ if (videoRef.current) {
57
+ videoRef.current.srcObject = stream;
58
+ videoRef.current.onloadedmetadata = () => {
59
+ videoRef.current
60
+ ?.play()
61
+ .then(() => {
62
+ if (modelsLoaded) {
63
+ startFaceDetection();
64
+ }
65
+ })
66
+ .catch((error) => {
67
+ console.error('Error playing video:', error);
68
+ setCameraError('Failed to play video stream. Please check your camera settings.');
69
+ });
70
+ };
71
+ }
72
+ }
73
+ catch (error) {
74
+ if (error instanceof DOMException) {
75
+ console.error('Error accessing camera:', error.message);
76
+ setCameraError(error.name);
77
+ }
78
+ else {
79
+ console.error('Unknown error accessing camera:', error);
80
+ setCameraError('An unknown error occurred. Please check permissions and try again.');
81
+ }
82
+ setCaptureInProgress(false);
83
+ stopCamera();
84
+ }
85
+ }
86
+ function startFaceDetection() {
87
+ if (!modelsLoaded) {
88
+ console.error('Cannot start face detection: video element not ready or models not loaded');
89
+ return;
90
+ }
91
+ if (!faceCanvasRef.current) {
92
+ faceCanvasRef.current = faceapi.createCanvasFromMedia(videoRef.current);
93
+ const parentDiv = document.getElementById('parent');
94
+ faceCanvasRef.current.className = `absolute inset-0 m-auto h-${parentDiv?.clientHeight} w-${parentDiv?.clientWidth} md:aspect-video object-cover md:object-contain`;
95
+ faceCanvasRef.current.style.width = `${videoRef.current?.clientWidth}px`;
96
+ faceCanvasRef.current.style.height = `${videoRef.current?.clientHeight}px`;
97
+ }
98
+ const displaySize = {
99
+ width: videoRef.current?.clientWidth || 643,
100
+ height: videoRef.current?.clientHeight || 333,
101
+ };
102
+ // Clear any existing interval
103
+ if (detectionIntervalRef.current) {
104
+ clearInterval(detectionIntervalRef.current);
105
+ }
106
+ faceapi.matchDimensions(faceCanvasRef.current, displaySize);
107
+ let countdownInterval = null;
108
+ detectionIntervalRef.current = window.setInterval(async () => {
109
+ if (!videoRef.current || !faceCanvasRef.current) {
110
+ console.error('Video or canvas element is not ready');
111
+ return;
112
+ }
113
+ try {
114
+ const detection = await faceapi
115
+ .detectSingleFace(videoRef.current, new faceapi.TinyFaceDetectorOptions())
116
+ .withFaceLandmarks();
117
+ if (detection) {
118
+ const resizedDetection = faceapi.resizeResults(detection, displaySize);
119
+ const frame_height = resizedDetection.detection.box.height;
120
+ const frame_width = resizedDetection.detection.box.width;
121
+ const frame_x = resizedDetection.detection.box.x;
122
+ const frame_y = resizedDetection.detection.box.y;
123
+ const faceCenterX = frame_x + frame_width / 2;
124
+ const faceCenterY = frame_y + frame_height / 2;
125
+ const screenCenterX = displaySize.width / 2;
126
+ const screenCenterY = displaySize.height / 2;
127
+ const centerThresholdX = displaySize.width * 0.15;
128
+ const centerThresholdY = displaySize.height * 0.15;
129
+ const isFaceCentered = Math.abs(faceCenterX - screenCenterX) <= centerThresholdX &&
130
+ Math.abs(faceCenterY - screenCenterY) <= centerThresholdY;
131
+ setIsFaceCentered(isFaceCentered);
132
+ const faceDetectionConfidence = detection.detection.score * 100;
133
+ // const context = faceCanvasRef.current.getContext('2d');
134
+ // if (context) {
135
+ // context.clearRect(
136
+ // 0,
137
+ // 0,
138
+ // faceCanvasRef.current.width,
139
+ // faceCanvasRef.current.height,
140
+ // );
141
+ // faceapi.draw.drawDetections(
142
+ // faceCanvasRef.current,
143
+ // resizedDetection,
144
+ // );
145
+ // faceapi.draw.drawFaceLandmarks(
146
+ // faceCanvasRef.current,
147
+ // resizedDetection,
148
+ // );
149
+ // }
150
+ //adjust the faceDetectionConfidence if need
151
+ if (isFaceCentered && faceDetectionConfidence >= 65) {
152
+ if (!countdownInterval) {
153
+ setIsCapturing(true);
154
+ countdownInterval = setInterval(() => {
155
+ setCountdown((prev) => {
156
+ if (prev === 1) {
157
+ clearInterval(countdownInterval);
158
+ countdownInterval = null;
159
+ captureImage();
160
+ return 3;
161
+ }
162
+ return prev - 1;
163
+ });
164
+ }, 1000);
165
+ }
166
+ }
167
+ else {
168
+ if (countdownInterval) {
169
+ clearInterval(countdownInterval);
170
+ countdownInterval = null;
171
+ setCountdown(3);
172
+ setIsCapturing(false);
173
+ }
174
+ }
175
+ }
176
+ }
177
+ catch (error) {
178
+ console.error('Error during face detection:', error);
179
+ setCameraError('An error occurred while detecting your face. Please try again.');
180
+ }
181
+ }, 100);
182
+ }
183
+ function stopCamera() {
184
+ setCaptureInProgress(false);
185
+ if (detectionIntervalRef.current) {
186
+ clearInterval(detectionIntervalRef.current);
187
+ detectionIntervalRef.current = null;
188
+ }
189
+ if (countdownTimerRef.current) {
190
+ clearInterval(countdownTimerRef.current);
191
+ countdownTimerRef.current = null;
192
+ }
193
+ if (videoStream) {
194
+ videoStream.getTracks().forEach((track) => track.stop());
195
+ setVideoStream(null);
196
+ }
197
+ if (videoRef.current && videoRef.current.srcObject) {
198
+ const stream = videoRef.current.srcObject;
199
+ stream.getTracks().forEach((track) => {
200
+ track.stop();
201
+ });
202
+ videoRef.current.srcObject = null;
203
+ videoRef.current.pause();
204
+ videoRef.current.currentTime = 0;
205
+ videoRef.current.load();
206
+ }
207
+ setCountdown(3);
208
+ }
209
+ function captureImage() {
210
+ if (videoRef.current && faceCanvasRef.current) {
211
+ const canvas = document.createElement('canvas');
212
+ canvas.width = videoRef.current.videoWidth;
213
+ canvas.height = videoRef.current.videoHeight;
214
+ const context = canvas.getContext('2d');
215
+ if (context) {
216
+ context.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
217
+ const imageData = canvas.toDataURL('image/png');
218
+ setSelectedImage(imageData);
219
+ stopCamera();
220
+ }
221
+ }
222
+ }
223
+ function retakePhoto() {
224
+ setSelectedImage(null);
225
+ setCaptureInProgress(true);
226
+ setCameraError(null);
227
+ if (faceCanvasRef.current) {
228
+ const canvas = faceCanvasRef.current.querySelector('canvas');
229
+ if (canvas) {
230
+ canvas.width = canvas.width;
231
+ }
232
+ faceCanvasRef.current.innerHTML = '';
233
+ }
234
+ if (videoRef.current) {
235
+ videoRef.current.play();
236
+ }
237
+ startCamera();
238
+ }
239
+ async function usePhoto() {
240
+ if (!selectedImage) {
241
+ console.error('No photo selected to use');
242
+ return;
243
+ }
244
+ const blob = dataURLtoBlob(selectedImage);
245
+ const img = new File([blob], 'image', { type: blob.type });
246
+ const resizedImage = (await resizeFile(img));
247
+ if (resizedImage) {
248
+ await mutate({
249
+ file: resizedImage,
250
+ }, {
251
+ onSuccess: (data) => {
252
+ kyc.setSelfieImageId(data);
253
+ kyc.setCapturing(null);
254
+ stopCamera();
255
+ },
256
+ });
257
+ }
258
+ }
259
+ function checkCameraPermission() {
260
+ const constraints = { video: true };
261
+ navigator.mediaDevices
262
+ .getUserMedia(constraints)
263
+ .then(() => {
264
+ setCameraError(null);
265
+ startCamera();
266
+ })
267
+ .catch(() => {
268
+ showPermissionInstructions();
269
+ });
270
+ }
271
+ useEffect(() => {
272
+ return () => {
273
+ if (detectionIntervalRef.current) {
274
+ clearInterval(detectionIntervalRef.current);
275
+ }
276
+ if (countdownTimerRef.current) {
277
+ clearInterval(countdownTimerRef.current);
278
+ }
279
+ };
280
+ }, []);
281
+ return (_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: () => {
282
+ stopCamera();
283
+ kyc.setCapturing(null);
284
+ }, 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: ['NotAllowedError', 'NotReadableError', 'NotFoundError'].includes(cameraError) ? (_jsx(NoCameraError, { onRetry: checkCameraPermission, title: "Camera Access Required", description: "We were unable to detect a camera on your device. Please ensure it is properly connected and accessible to this application." })) : captureInProgress && !cameraError ? (_jsxs("div", { className: "relative flex h-fit w-full flex-col items-center justify-center", children: [_jsx("video", { ref: videoRef, autoPlay: true, muted: true, playsInline: 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: ["Rekate 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", disabled: isPending, children: ["Use Photo", _jsx(Camera01Icon, { className: "size-5" })] })] })), !captureInProgress && !cameraError && (_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" })] }))] }));
285
+ }
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ id: string;
3
+ }
4
+ declare function DisplayImage({ id }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default DisplayImage;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import { useFileQuery } from '../../client/hooks/useFileQuery.js';
4
+ function DisplayImage({ id }) {
5
+ const { data } = useFileQuery(id ?? '');
6
+ return (_jsx("div", { className: "border-border-primary bg-bg-primary min-h-[11.25rem]", children: data?.url && (_jsx(Image, { src: data.url, alt: "Uploaded", className: "w-full object-contain", width: 500, height: 500 })) }));
7
+ }
8
+ export default DisplayImage;
@@ -0,0 +1,10 @@
1
+ import type { CaptureSubject } from './useKYC';
2
+ interface FileUploadProps {
3
+ name: string;
4
+ value: string;
5
+ hasDescription?: boolean;
6
+ onChange?: (id: string) => void;
7
+ captureObject: CaptureSubject;
8
+ }
9
+ declare function FileUpload({ value, name, hasDescription, onChange, captureObject, }: FileUploadProps): import("react/jsx-runtime").JSX.Element;
10
+ export default FileUpload;
@@ -0,0 +1,72 @@
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, useState } from 'react';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import invariant from 'tiny-invariant';
7
+ import { useUploadImageFileMutation } from '../../client/hooks/useUploadImageFileMutation.js';
8
+ import { getSession } from '../../client/services/getSession.js';
9
+ import { UploadCloud02Icon } from '../../icons/UploadCloud02Icon.js';
10
+ import { getFile } from '../../services/file.js';
11
+ import { Button } from '../../ui/Button/index.js';
12
+ import { createPoll } from '../../utils/createPoll.js';
13
+ import { useKYCContext } from './KYCContext.js';
14
+ import { validateFile } from './utils.js';
15
+ function FileUpload({ value, name, hasDescription, onChange, captureObject, }) {
16
+ const kyc = useKYCContext();
17
+ const { mutate, isPending } = useUploadImageFileMutation();
18
+ const [isLoading, setIsLoading] = useState(false);
19
+ const [uploadedImageUrl, setUploadedImageUrl] = useState(null);
20
+ async function pollImage(id) {
21
+ if (!id)
22
+ return;
23
+ setIsLoading(true);
24
+ const poll = createPoll(async () => {
25
+ const session = await getSession();
26
+ invariant(session.status === 'authenticated');
27
+ const file = await getFile(id, {
28
+ headers: {
29
+ Authorization: `Bearer ${session.token}`,
30
+ },
31
+ });
32
+ return file ?? null;
33
+ }, { until: (r) => !!r, interval: 1000, maxAttempt: 5 });
34
+ const image = await poll();
35
+ if (!image) {
36
+ console.error('Image not found or failed to load');
37
+ }
38
+ setUploadedImageUrl(image?.url ?? null);
39
+ setIsLoading(false);
40
+ }
41
+ useEffect(() => {
42
+ pollImage(value);
43
+ }, [value]);
44
+ if (isPending || isLoading) {
45
+ return (_jsx("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: _jsx("div", { className: "flex items-center justify-center", children: _jsx("span", { className: "text-text-secondary-700", children: "Uploading..." }) }) }));
46
+ }
47
+ function handleFileChange(event) {
48
+ const file = event.target.files?.[0];
49
+ if (!file) {
50
+ console.error('No file selected');
51
+ return;
52
+ }
53
+ const error = validateFile(file);
54
+ if (error) {
55
+ console.error(error);
56
+ return;
57
+ }
58
+ mutate({ file }, {
59
+ onSuccess: (id) => {
60
+ onChange?.(id);
61
+ },
62
+ });
63
+ }
64
+ function handleUploadClick() {
65
+ const fileInput = document.getElementById(`file-upload-${name}`);
66
+ if (fileInput) {
67
+ fileInput.click();
68
+ }
69
+ }
70
+ return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: [uploadedImageUrl ? (_jsxs("div", { className: "border-border-primary bg-bg-primary min-h-[9.25rem]", children: [_jsx(Image, { src: uploadedImageUrl, alt: "Uploaded", className: "w-full object-contain", width: 350, height: 350, draggable: false }), _jsx(Button, { size: "xs", variant: "outline", className: twMerge('mx-auto mt-4 w-fit', value && 'hidden'), type: "button", onClick: handleUploadClick, children: "Reupload" })] })) : hasDescription ? (_jsxs(_Fragment, { 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-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", onClick: handleUploadClick, children: "Click to upload" }), ' ', "or drag and drop", _jsx("br", {}), "PNG, JPG or JPEG (max. 10mb)", _jsx("br", {}), "or"] })] })) : null, _jsx("input", { type: "file", id: `file-upload-${name}`, name: name, onChange: handleFileChange, accept: "image/png, image/jpg, image/jpeg", className: "hidden" }), _jsx(Button, { size: "xs", variant: "outline", className: "mx-auto w-fit", onClick: () => kyc.setCapturing(captureObject), disabled: isPending, type: "button", children: value ? 'Retake Photo' : 'Take a Photo' })] }));
71
+ }
72
+ export default FileUpload;
@@ -102,7 +102,7 @@ export function IdentityVerification() {
102
102
  if (kyc.idFrontImageId)
103
103
  form.setValue('idFrontImage', kyc.idFrontImageId);
104
104
  }, [form, kyc.idFrontImageId, kyc.selfieImageId]);
105
- return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Verify your identity" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Verify your details to confirm your identity and secure your access." }), _jsxs("div", { className: "mt-7 rounded-xl border border-border-primary bg-bg-primary p-lg text-text-placeholder text-xs leading-tight", children: [_jsx("h3", { className: "font-semibold", children: "Instructions" }), _jsxs("ol", { className: "mt-2 list-inside list-decimal", children: [_jsx("li", { children: "Upload a full photo of your ID." }), _jsx("li", { children: "Please ensure that all details in the uploaded image are legible." }), _jsx("li", { children: "Please ensure that the ID uploaded is within the validity period." })] })] }), _jsxs("form", { className: "mt-xl", onSubmit: form.handleSubmit(onSubmit), children: [_jsx(Controller, { control: form.control, name: "idFrontImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(IdFrontImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
105
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Verify your identity" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Verify your details to confirm your identity and secure your access." }), _jsxs("div", { className: "border-border-primary bg-bg-primary text-text-placeholder mt-7 rounded-xl border p-lg text-xs leading-tight", children: [_jsx("h3", { className: "font-semibold", children: "Instructions" }), _jsxs("ol", { className: "mt-2 list-inside list-decimal", children: [_jsx("li", { children: "Upload a full photo of your ID." }), _jsx("li", { children: "Please ensure that all details in the uploaded image are legible." }), _jsx("li", { children: "Please ensure that the ID uploaded is within the validity period." })] })] }), _jsxs("form", { className: "mt-xl", onSubmit: form.handleSubmit(onSubmit), children: [_jsx(Controller, { control: form.control, name: "idFrontImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(IdFrontImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
106
106
  form.setValue('idFrontImage', '');
107
107
  form.setError('idFrontImage', {
108
108
  type: 'validate',
@@ -41,5 +41,5 @@ export function KYC(props) {
41
41
  }, [steps, kyc]);
42
42
  return (_jsxs(_Fragment, { children: [_jsx(KYCContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open && hasMissingData, onOpenChange: (details) => {
43
43
  globalStore.kyc.setOpen(details.open);
44
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "mx-auto min-h-full w-full overflow-y-auto bg-bg-primary-alt lg:min-h-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
44
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "bg-bg-primary-alt lg:min-h-auto mx-auto min-h-full w-full overflow-y-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
45
45
  }
@@ -24,8 +24,8 @@ export function KYCVerificationStatus() {
24
24
  return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
25
25
  globalStore.kycVerificationStatus.setOpen(details.open);
26
26
  }, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", width: 240, height: 0, className: "w-60 object-contain", draggable: false }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', isUnverified && 'Verification Required'] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
27
- `Your account verification is still under review. Please wait
28
- until it's approved before you can continue playing or
27
+ `Your account verification is still under review. Please wait
28
+ until it's approved before you can continue playing or
29
29
  depositing.`, status === 'REJECTED' &&
30
30
  'Your account verification was not approved. Please resubmit your verification to regain full access.', isUnverified &&
31
31
  'Your account is not yet verified. Please complete the verification process to continue playing or depositing.'] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
@@ -24,8 +24,8 @@ export function KYCVerificationStatus() {
24
24
  return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
25
25
  globalStore.kycVerificationStatus.setOpen(details.open);
26
26
  }, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", width: 240, height: 0, className: "w-60 object-contain", draggable: false }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', isUnverified && 'Verification Required'] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
27
- `Your account verification is still under review. Please wait
28
- until it's approved before you can continue playing or
27
+ `Your account verification is still under review. Please wait
28
+ until it's approved before you can continue playing or
29
29
  depositing.`, status === 'REJECTED' &&
30
30
  'Your account verification was not approved. Please resubmit your verification to regain full access.', isUnverified &&
31
31
  'Your account is not yet verified. Please complete the verification process to continue playing or depositing.'] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
@@ -15,17 +15,20 @@ export function KYCVerificationStatus() {
15
15
  kyc: ctx.kyc,
16
16
  })));
17
17
  const verificationQuery = useMemberVerificationQuery();
18
- const status = verificationQuery.data?.status ?? 'UNVERIFIED';
18
+ console.log(verificationQuery, 'data');
19
+ const status = verificationQuery?.data?.status ?? 'UNVERIFIED';
19
20
  const icons = status === 'PENDING' ? bellIcon : alertIcon;
20
21
  return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
21
22
  globalStore.kycVerificationStatus.setOpen(details.open);
22
23
  }, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED' ||
23
- (status === 'CREATED' && 'Verification Required')] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
24
- `Your account verification is still under review. Please wait
25
- until it's approved before you can continue playing or
24
+ status === 'CREATED' ||
25
+ (verificationQuery?.data === null && 'Verification Required')] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
26
+ `Your account verification is still under review. Please wait
27
+ until it's approved before you can continue playing or
26
28
  depositing.`, status === 'REJECTED' &&
27
29
  'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED' ||
28
- (status === 'CREATED' &&
30
+ status === 'CREATED' ||
31
+ (verificationQuery?.data === null &&
29
32
  'Your account is not yet verified. Please complete the verification process to continue playing or depositing.')] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
30
33
  globalStore.kycVerificationStatus.setOpen(false);
31
34
  globalStore.kyc.setOpen(true);
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ onRetry: () => void;
3
+ title: string;
4
+ description: string;
5
+ }
6
+ declare function NoCameraError({ onRetry, title, description }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default NoCameraError;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '../../ui/Button/index.js';
3
+ function NoCameraError({ onRetry, title, description }) {
4
+ return (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-2 p-4", children: [_jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-red-500 mb-2", children: title }), _jsx("p", { className: "mb-2 text-sm", children: description })] }), _jsx(Button, { className: "mx-auto px-xl lg:w-fit", onClick: onRetry, size: "sm", children: "Try Again" })] }));
5
+ }
6
+ export default NoCameraError;
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ isFaceCentered: boolean;
3
+ width: number;
4
+ height: number;
5
+ }
6
+ declare function PersonOverlayDesktop({ isFaceCentered, height, width }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default PersonOverlayDesktop;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ function PersonOverlayDesktop({ isFaceCentered, height, width }) {
3
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "pointer-events-none absolute inset-0 hidden md:block", children: _jsxs("svg", { width: `${width}px`, height: `${height}px`, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", className: "max-h-full w-full", children: [_jsxs("defs", { children: [_jsx("path", { id: "head-shoulder-path", d: "M 389.605 124.529 C 390.221 129.441 390.638 134.433 390.846 139.492 L 390.932 151.978 C 390.841 155.321 390.658 158.636 390.388 161.919 C 388.294 162.987 388.18 164.214 389 168 L 390.277 171.709 L 395 181 C 395.61 182.222 396.985 183.052 398.459 183.693 L 399.097 183.956 C 401.81 185.016 404.425 186.275 406.923 187.715 L 420.473 198.503 C 424.405 202.729 427.713 207.542 430.252 212.795 L 435.357 229.337 C 435.78 232.162 436 235.055 436 238 V 244.833 V 258.5 H 436 V 272.167 V 285.833 H 436 V 299.5 V 313.167 H 436 V 320 C 436 321.36 435.73 322.651 435.242 323.827 L 429.827 329.242 C 428.651 329.73 427.36 330 426 330 H 418.275 H 402.825 V 330 H 387.375 H 371.925 V 330 H 356.475 H 341.025 V 330 H 325.575 H 310.125 V 330 H 294.675 H 279.225 V 330 H 263.775 H 248.325 V 330 H 232.875 H 217.425 V 330 H 201.975 H 186.525 V 330 H 171.075 H 155.625 V 330 H 140.175 H 124.725 V 330 H 117 C 115.641 330 114.349 329.73 113.173 329.242 L 107.758 323.827 C 107.27 322.651 107 321.36 107 320 V 313.167 V 299.5 H 107 V 285.833 V 272.167 H 107 V 258.5 V 244.833 H 107 V 238 C 107 235.088 107.214 232.227 107.628 229.433 L 112.622 213.056 C 115.107 207.848 118.347 203.067 122.2 198.856 L 135.494 188.055 C 137.641 186.783 139.877 185.647 142.19 184.656 L 143.186 184.241 C 144.876 183.555 146.441 182.623 147.83 181.498 L 153.722 172.52 C 154.177 170.759 154.329 168.902 154.116 167.011 L 153.981 165.769 C 153.85 164.525 153.732 163.276 153.627 162.022 C 151.354 158.847 151.164 155.472 151.069 152.068 L 151.153 139.492 C 151.36 134.462 151.773 129.498 152.383 124.613 L 152.394 124.529 L 154.894 109.723 C 155.95 104.771 157.212 99.9212 158.668 95.1875 L 163.727 81.0498 C 165.649 76.3661 167.77 71.8259 170.076 67.4453 L 177.715 54.5254 C 180.508 50.3027 183.489 46.274 186.641 42.457 L 196.832 31.4316 C 200.471 27.9227 204.28 24.6674 208.24 21.6846 L 220.789 13.4502 C 225.168 10.9758 229.688 8.8149 234.332 6.9912 L 248.66 2.544 C 253.508 1.4258 258.458 0.6639 263.493 0.2832 L 278.506 0.2832 C 283.541 0.6638 288.491 1.4259 293.339 2.544 L 307.667 6.9912 C 312.311 8.8149 316.831 10.9758 321.21 13.4502 L 333.759 21.6846 C 337.719 24.6673 341.528 27.9227 345.167 31.4316 L 355.359 42.458 C 358.511 46.2749 361.491 50.3038 364.284 54.5264 L 371.923 67.4453 C 374.229 71.826 376.35 76.3661 378.272 81.0498 L 383.331 95.1875 C 384.787 99.9212 386.049 104.771 387.105 109.723 L 389.605 124.529 Z" }), _jsxs("mask", { id: "outline-mask", children: [_jsx("rect", { width: "100%", height: "100%", fill: "white" }), _jsx("use", { href: "#head-shoulder-path", fill: "black" })] })] }), _jsx("rect", { width: "100%", height: "100%", fill: !isFaceCentered
4
+ ? 'rgba(156, 156, 156, 0.40)'
5
+ : 'rgba(34, 139, 87, 0.75)', mask: "url(#outline-mask)" }), _jsx("use", { href: "#head-shoulder-path", fill: "none", stroke: !isFaceCentered ? '#B54708' : '#34D399', strokeWidth: "3", strokeDasharray: "10 5" })] }) }), _jsx("div", { className: "pointer-events-none absolute inset-0 block md:hidden", children: _jsxs("svg", { className: "block md:hidden", width: "100%", height: "100%", viewBox: "0 0 400 400", preserveAspectRatio: "xMidYMid slice", children: [_jsxs("defs", { children: [_jsx("path", { id: "fill-path", d: "M 300.85 220.1 C 301.15 223.9 302.705 227.284 305.171 230.096 V 230.097 L 311.15 234.9 L 316.351 238.504 C 320.778 242.037 324.741 246.126 328.135 250.665 L 336.459 265.409 C 338.554 270.577 340.015 276.069 340.746 281.79 V 320.036 V 359.74 V 369.667 L 340.28 374.731 C 338.938 377.967 336.351 380.555 333.115 381.896 H 300.872 H 264.633 H 228.396 H 192.158 H 155.921 H 119.682 H 83.4439 H 74.3844 L 69.319 381.896 C 66.0834 380.554 63.4953 377.967 62.1539 374.731 V 339.888 V 320.036 V 300.184 L 62.15 281.9 C 62.459 275.847 63.967 270.273 66.127 265.038 L 74.702 250.13 C 78.005 245.806 81.828 241.899 86.08 238.506 L 86.819 237.925 L 98.284 229.572 L 104.15 223.9 C 105.146 217.607 104.959 215.459 104.343 213.349 L 102.15 210.9 L 98.15 202.9 C 97.985 196.059 96.943 188.701 96.423 181.159 L 96.31 160.744 C 96.641 154.989 97.273 149.337 98.193 143.813 L 98.454 142.294 L 102.789 124.231 C 104.631 118.212 106.825 112.406 109.34 106.849 L 118.126 90.483 C 121.479 85.154 125.161 80.154 129.135 75.528 L 142.322 62.463 C 147.129 58.431 152.22 54.874 157.55 51.845 L 174.504 44.306 C 180.364 42.381 186.424 41.058 192.638 40.394 L 211.201 40.394 C 217.414 41.057 223.474 42.381 229.334 44.306 L 246.288 51.845 C 251.619 54.874 256.709 58.431 261.516 62.463 L 274.703 75.528 C 278.677 80.154 282.359 85.154 285.712 90.483 L 294.499 106.849 C 297.014 112.406 299.208 118.212 301.049 124.231 L 305.385 142.294 V 142.293 C 306.447 148.299 307.168 154.46 307.529 160.744 L 307.403 181.33 C 306.867 188.989 305.792 196.459 304.224 203.681 C 301.374 206.417 300.58 209.572 300.15 212.9 L 300.15 214.9 L 300.85 220.1 Z" }), _jsx("path", { id: "border-path", d: "M 300.85 220.1 C 301.15 223.9 302.705 227.284 305.171 230.096 V 230.097 L 311.15 234.9 L 316.351 238.504 C 320.778 242.037 324.741 246.126 328.135 250.665 L 336.459 265.409 C 338.554 270.577 340.015 276.069 340.746 281.79 V 320.036 V 359.74 V 369.667 L 340.28 374.731 C 338.938 377.967 336.351 380.555 333.115 381.896 H 300.872 H 264.633 H 228.396 H 192.158 H 155.921 H 119.682 H 83.4439 H 74.3844 L 69.319 381.896 C 66.0834 380.554 63.4953 377.967 62.1539 374.731 V 339.888 V 320.036 V 300.184 L 62.15 281.9 C 62.459 275.847 63.967 270.273 66.127 265.038 L 74.702 250.13 C 78.005 245.806 81.828 241.899 86.08 238.506 L 86.819 237.925 L 98.284 229.572 L 104.15 223.9 C 105.146 217.607 104.959 215.459 104.343 213.349 L 102.15 210.9 L 98.15 202.9 C 97.985 196.059 96.943 188.701 96.423 181.159 L 96.31 160.744 C 96.641 154.989 97.273 149.337 98.193 143.813 L 98.454 142.294 L 102.789 124.231 C 104.631 118.212 106.825 112.406 109.34 106.849 L 118.126 90.483 C 121.479 85.154 125.161 80.154 129.135 75.528 L 142.322 62.463 C 147.129 58.431 152.22 54.874 157.55 51.845 L 174.504 44.306 C 180.364 42.381 186.424 41.058 192.638 40.394 L 211.201 40.394 C 217.414 41.057 223.474 42.381 229.334 44.306 L 246.288 51.845 C 251.619 54.874 256.709 58.431 261.516 62.463 L 274.703 75.528 C 278.677 80.154 282.359 85.154 285.712 90.483 L 294.499 106.849 C 297.014 112.406 299.208 118.212 301.049 124.231 L 305.385 142.294 V 142.293 C 306.447 148.299 307.168 154.46 307.529 160.744 L 307.403 181.33 C 306.867 188.989 305.792 196.459 304.224 203.681 C 301.374 206.417 300.58 209.572 300.15 212.9 L 300.15 214.9 L 300.85 220.1 Z" }), _jsx("clipPath", { id: "face-cutout", children: _jsx("use", { href: "#fill-path" }) }), _jsxs("mask", { id: "face-mask", children: [_jsx("rect", { x: "0", y: "0", width: "400", height: "400", fill: "white" }), _jsx("use", { href: "#fill-path", fill: "black" })] })] }), _jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: !isFaceCentered
6
+ ? 'rgba(156, 156, 156, 0.40)'
7
+ : 'rgba(34, 139, 87, 0.75)', mask: "url(#face-mask)" }), _jsx("use", { href: "#border-path", fill: "none", stroke: !isFaceCentered ? '#B54708' : '#34D399', strokeWidth: "3", strokeDasharray: "12 8", strokeLinecap: "round", id: "border-element" })] }) })] }));
8
+ }
9
+ export default PersonOverlayDesktop;
@@ -104,7 +104,7 @@ export function PersonalInformation() {
104
104
  }
105
105
  const address = form.watch('address');
106
106
  const permanentAddress = form.watch('permanentAddress');
107
- return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Personal Information" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Provide your basic details and work info." }), _jsxs("form", { className: "mt-7", onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.permanentAddress, children: [_jsx(Field.Label, { children: "Permanent address" }), _jsx(Field.Input, { placeholder: "Enter your permanent address", ...form.register('permanentAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.permanentAddress?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.address, children: [_jsx(Field.Label, { children: "Current address" }), _jsx(Field.Input, { placeholder: "Enter your current address", ...form.register('address') }), _jsx(Field.ErrorText, { children: form.formState.errors.address?.message })] }), _jsxs(Checkbox.Root, { className: "mt-md", checked: address !== '' &&
107
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Personal Information" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Provide your basic details and work info." }), _jsxs("form", { className: "mt-7", onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.permanentAddress, children: [_jsx(Field.Label, { children: "Permanent address" }), _jsx(Field.Input, { placeholder: "Enter your permanent address", ...form.register('permanentAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.permanentAddress?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.address, children: [_jsx(Field.Label, { children: "Current address" }), _jsx(Field.Input, { placeholder: "Enter your current address", ...form.register('address') }), _jsx(Field.ErrorText, { children: form.formState.errors.address?.message })] }), _jsxs(Checkbox.Root, { className: "mt-md", checked: address !== '' &&
108
108
  permanentAddress !== '' &&
109
109
  address === permanentAddress, onCheckedChange: (details) => {
110
110
  if (details.checked === true) {
@@ -0,0 +1 @@
1
+ export declare function Header(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
3
+ import { XIcon } from '../../../icons/XIcon.js';
4
+ import { Dialog } from '../../../ui/Dialog/index.js';
5
+ import { IconButton } from '../../../ui/IconButton/index.js';
6
+ export function Header() {
7
+ return (_jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "bg-bg-primary-alt relative flex items-center gap-xl px-xl py-md lg:justify-center lg:bg-transparent lg:p-0", children: [_jsx(IconButton, { size: "2xs", variant: "outline", colorScheme: "gray", className: "lg:hidden", onClick: () => api.setOpen(false), children: _jsx(ChevronLeftIcon, {}) }), _jsx(Dialog.Title, { className: "text-lg font-semibold", children: "Personal Verification" }), _jsx("button", { type: "button", className: "text-text-quinary absolute right-0 top-1/2 hidden -translate-y-1/2 lg:block", onClick: () => api.setOpen(false), children: _jsx(XIcon, { className: "size-6" }) })] })) }));
8
+ }
@@ -0,0 +1 @@
1
+ export declare function Indicator(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { noop } from 'lodash-es';
3
+ import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
4
+ import { Progress } from '../../../ui/Progress/index.js';
5
+ import { useKYCContext } from './KYCContext.js';
6
+ export function Indicator() {
7
+ const context = useKYCContext();
8
+ return (_jsxs("div", { className: "mt-xl grid grid-cols-[max-content_auto_auto] items-center px-xl lg:mt-md lg:px-0", children: [_jsxs("button", { className: "text-text-tertiary-600 flex items-center gap-sm text-sm font-semibold", children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] }), _jsxs("div", { className: "flex justify-center gap-2", children: [_jsx(Progress.Root, { className: "w-[5.625rem] shrink-0", value: context.step >= 2 ? 100 : 50, onValueChange: noop, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-[5.625rem] shrink-0", value: context.step >= 3 ? 50 : 0, onValueChange: noop, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) })] })] }));
9
+ }
@@ -0,0 +1 @@
1
+ export declare function KYC(): import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import dynamic from 'next/dynamic';
4
+ import { useShallow } from 'zustand/shallow';
5
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
6
+ const Component = dynamic(() => import('./KYC.lazy.js').then((m) => m.KYC), {
7
+ ssr: false,
8
+ loading: () => null,
9
+ });
10
+ export function KYC() {
11
+ const touched = useGlobalStore(useShallow((ctx) => ctx.kyc['~touched']));
12
+ if (touched)
13
+ return _jsx(Component, {});
14
+ }
@@ -0,0 +1 @@
1
+ export declare function KYC(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { useShallow } from 'zustand/shallow';
5
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
6
+ import { Dialog } from '../../../ui/Dialog/index.js';
7
+ import { Portal } from '../../../ui/Portal/index.js';
8
+ import { Header } from './Header.js';
9
+ import { Indicator } from './Indicator.js';
10
+ import { KYCContext } from './KYCContext.js';
11
+ import { Step1 } from './Step1.js';
12
+ import { Step2 } from './Step2.js';
13
+ import { Step3 } from './Step3.js';
14
+ import { Step4 } from './Step4.js';
15
+ import { useKYC } from './useKYC.js';
16
+ export function KYC() {
17
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
18
+ kyc: ctx.kyc,
19
+ })));
20
+ const context = useKYC();
21
+ return (_jsx(KYCContext, { value: context, children: _jsx(Dialog.Root, { open: globalStore.kyc.open, onOpenChange: (details) => {
22
+ globalStore.kyc.setOpen(details.open);
23
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: twMerge(context.step === 4 && 'flex items-center'), children: _jsxs(Dialog.Content, { className: twMerge(context.step < 4
24
+ ? 'bg-bg-primary lg:bg-bg-primary-alt mx-auto h-full w-full lg:h-auto lg:w-[400px] lg:p-3xl'
25
+ : 'mx-auto w-[25rem] max-w-[calc(100%-2rem)] p-3xl'), children: [context.step < 4 && _jsx(Header, {}), context.step < 4 && _jsx(Indicator, {}), context.step === 1 && _jsx(Step1, {}), context.step === 2 && _jsx(Step2, {}), context.step === 3 && _jsx(Step3, {}), context.step === 4 && _jsx(Step4, {})] }) })] }) }) }));
26
+ }