@opexa/portal-components 0.0.307 → 0.0.309

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 (266) hide show
  1. package/dist/client/hooks/useCamera.js +2 -2
  2. package/dist/client/hooks/useControllableState.js +1 -1
  3. package/dist/client/hooks/useInfiniteQueryHelper.js +2 -3
  4. package/dist/client/hooks/useMarkGameAsFavoriteMutation.js +1 -2
  5. package/dist/client/hooks/useMobileNumberParser.js +1 -1
  6. package/dist/client/utils/recaptcha.d.ts +14 -0
  7. package/dist/client/utils/recaptcha.js +18 -0
  8. package/dist/components/Account/Account.lazy.js +5 -5
  9. package/dist/components/Account/account.recipe.js +4 -4
  10. package/dist/components/AccountInfo/AccountInfo.js +6 -6
  11. package/dist/components/AccountSecurity/AccountSecurity.js +6 -6
  12. package/dist/components/AccountVerification/AccountVerification.js +7 -7
  13. package/dist/components/Banner/Banner.js +1 -1
  14. package/dist/components/BetRecords/BetRecords.client.js +5 -5
  15. package/dist/components/Bonus/Bonus.client.js +2 -2
  16. package/dist/components/Bonuses/Bonuses.client.js +10 -10
  17. package/dist/components/Bonuses/BonusesTrigger.js +1 -1
  18. package/dist/components/Bonuses/ClaimSpotBonus.lazy.js +1 -1
  19. package/dist/components/Cashback/Cashback.client.js +2 -2
  20. package/dist/components/CustomPromo/CustomPromo.js +1 -1
  21. package/dist/components/DepositWithdrawal/Deposit/AvailablePromos.js +1 -1
  22. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +2 -2
  23. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +2 -2
  24. package/dist/components/DepositWithdrawal/Deposit/LibanganDeposit/LibanganDeposit.js +2 -2
  25. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +2 -2
  26. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +2 -2
  27. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.js +1 -1
  28. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.js +2 -2
  29. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +1 -1
  30. package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.js +2 -2
  31. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +1 -1
  32. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +2 -2
  33. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +1 -1
  34. package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.js +2 -2
  35. package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.js +2 -2
  36. package/dist/components/DepositWithdrawal/HasPendingBonuses.js +1 -1
  37. package/dist/components/DepositWithdrawal/PaymentMethods.js +1 -1
  38. package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +3 -3
  39. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +2 -4
  40. package/dist/components/DepositWithdrawal/Withdrawal/MayaAppWithdrawal/MayaAppWithdrawal.js +2 -2
  41. package/dist/components/DepositWithdrawal/Withdrawal/MayaWithdrawal/MayaWithdrawal.js +3 -3
  42. package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.js +2 -2
  43. package/dist/components/DepositWithdrawal/Withdrawal/TransactionPasswordNotSet.js +2 -2
  44. package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +2 -2
  45. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +4 -4
  46. package/dist/components/DigitainLauncher/Fallback.js +1 -1
  47. package/dist/components/DigitainLauncher/Loading.js +1 -1
  48. package/dist/components/DigitainLauncher/utils.js +1 -2
  49. package/dist/components/Disclaimer/DisclaimerV1.js +1 -1
  50. package/dist/components/Disclaimer/DisclaimerV2.js +3 -3
  51. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  52. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  53. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  54. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  55. package/dist/components/FavoriteGames/FavoriteGames.client.js +4 -4
  56. package/dist/components/ForgotPassword/ForgotPassword.lazy.js +1 -1
  57. package/dist/components/ForgotPassword/ForgotPasswordForm.js +5 -5
  58. package/dist/components/GCashFailed/GCashFailed.js +1 -1
  59. package/dist/components/GCashSuccess/GCashSuccess.js +1 -1
  60. package/dist/components/GameLaunch/GameLaunch.lazy.js +4 -4
  61. package/dist/components/GameLaunch/GameLaunchTrigger.js +2 -4
  62. package/dist/components/GameProviders/GameProvidersCarousel.js +1 -1
  63. package/dist/components/GameProviders/GameProvidersList.js +1 -1
  64. package/dist/components/Games/Game.js +3 -3
  65. package/dist/components/Games/GamesCarousel.client.js +2 -4
  66. package/dist/components/Games/GamesList.client.js +2 -2
  67. package/dist/components/GamesSearch/GamesSearch.js +4 -6
  68. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.js +1 -1
  69. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.d.ts +1 -1
  70. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +54 -54
  71. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  72. package/dist/components/Jackpots/JackpotsList/JackpotsList.js +1 -1
  73. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  74. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +14 -12
  75. package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.js +1 -1
  76. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +13 -11
  77. package/dist/components/Jackpots/JackpotsList/JackpotsListItemRules.js +1 -1
  78. package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.js +16 -18
  79. package/dist/components/KYC/BasicInformation.js +1 -1
  80. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  81. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  82. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  83. package/dist/components/KYC/CaptureSelfie.js +285 -0
  84. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  85. package/dist/components/KYC/DisplayImage.js +8 -0
  86. package/dist/components/KYC/FileUpload.d.ts +10 -0
  87. package/dist/components/KYC/FileUpload.js +72 -0
  88. package/dist/components/KYC/IdentityVerification.js +1 -1
  89. package/dist/components/KYC/KYC.lazy.js +1 -1
  90. package/dist/components/KYC/KYCReminder.lazy.js +1 -1
  91. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  92. package/dist/components/KYC/NoCameraError.js +6 -0
  93. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  94. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  95. package/dist/components/KYC/PersonalInformation.js +1 -1
  96. package/dist/components/KYC/utils.d.ts +9 -0
  97. package/dist/components/KYC/utils.js +79 -0
  98. package/dist/components/Marquee/Marquee.js +1 -1
  99. package/dist/components/Messages/Messages.lazy.js +5 -5
  100. package/dist/components/Messages/MessagesPopup.js +3 -3
  101. package/dist/components/Messages/MessagesTrigger.js +1 -1
  102. package/dist/components/News/News.js +1 -1
  103. package/dist/components/NewsFeed/News.d.ts +2 -2
  104. package/dist/components/NewsFeed/News.js +1 -1
  105. package/dist/components/NewsFeed/NewsFeedCarousel.js +2 -2
  106. package/dist/components/NewsFeed/NewsFeedList.js +1 -1
  107. package/dist/components/PortalProvider/Snackbar.js +2 -2
  108. package/dist/components/Promo/Promo.client.js +2 -2
  109. package/dist/components/Promos/Cashback.js +1 -1
  110. package/dist/components/Promos/CustomPromo.d.ts +2 -2
  111. package/dist/components/Promos/CustomPromo.js +1 -1
  112. package/dist/components/Promos/Promo.js +1 -1
  113. package/dist/components/Promos/PromosCarousel.js +2 -2
  114. package/dist/components/Promos/PromosGrid.js +2 -2
  115. package/dist/components/Quests/DailyCheckInQuest.js +3 -3
  116. package/dist/components/Quests/JourneyQuest.js +5 -5
  117. package/dist/components/Quests/OnboardingQuest.js +2 -2
  118. package/dist/components/Quests/Quests.client.js +4 -4
  119. package/dist/components/Quests/WageringQuest.js +2 -2
  120. package/dist/components/ResponsibleGaming/ResponsibleGaming.lazy.js +1 -1
  121. package/dist/components/Search/Search.lazy.js +7 -9
  122. package/dist/components/SignIn/MobileNumberSignIn.js +5 -5
  123. package/dist/components/SignIn/NameAndPasswordSignIn.js +2 -2
  124. package/dist/components/SignIn/SignIn.lazy.d.ts +1 -1
  125. package/dist/components/SignIn/SignIn.lazy.js +1 -2
  126. package/dist/components/SignIn/SignInForm.js +1 -1
  127. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  128. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  129. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  130. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  131. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +1 -1
  132. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +7 -7
  133. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  134. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  135. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  136. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  137. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  138. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  139. package/dist/components/SignUp/SignUpKYC/IdFrontImageField/IdFrontImageField.client.js +7 -7
  140. package/dist/components/SignUp/SignUpKYC/IdFrontImageField/IdFrontImageField.js +1 -1
  141. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  142. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  143. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  144. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  145. package/dist/components/SignUp/SignUpKYC/SelfieImageField/SelfieImageField.client.js +6 -6
  146. package/dist/components/SignUp/SignUpKYC/SelfieImageField/SelfieImageField.js +1 -1
  147. package/dist/components/SignUp/SignUpKYC/SelfieImageField/useSelfieImageField.js +0 -1
  148. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  149. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  150. package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.js +1 -1
  151. package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +8 -8
  152. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  153. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  154. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  155. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  156. package/dist/components/TermsAndConditions/TermsAndConditions.lazy.js +1 -1
  157. package/dist/components/TermsOfUse/TermsOfUse.lazy.js +1 -1
  158. package/dist/components/TopWins/TopWins.client.js +3 -3
  159. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarousel.js +1 -1
  160. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.js +10 -8
  161. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  162. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  163. package/dist/components/Tournaments/TournamentsList/TournamentsList.js +2 -2
  164. package/dist/components/Tournaments/TournamentsList/TournamentsListItemDesktop.js +9 -7
  165. package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.js +1 -1
  166. package/dist/components/Tournaments/TournamentsList/TournamentsListItemMobile.js +8 -6
  167. package/dist/components/Tournaments/TournamentsList/TournamentsListItemRules.js +1 -1
  168. package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.js +1 -1
  169. package/dist/components/TransactionRecords/DepositRecordsTable.js +2 -2
  170. package/dist/components/TransactionRecords/TableFilters.js +1 -1
  171. package/dist/components/TransactionRecords/TransactionRecords.suspense.js +1 -1
  172. package/dist/components/TransactionRecords/TransactionRecordsTable.js +2 -2
  173. package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +2 -2
  174. package/dist/components/shared/Empty.js +1 -1
  175. package/dist/components/shared/IdFrontImageField/IdFrontImageField.client.js +7 -7
  176. package/dist/components/shared/IdFrontImageField/IdFrontImageField.js +1 -1
  177. package/dist/components/shared/SelfieImageField/SelfieImageField.client.js +6 -6
  178. package/dist/components/shared/SelfieImageField/SelfieImageField.js +1 -1
  179. package/dist/components/shared/SelfieImageField/useSelfieImageField.js +0 -1
  180. package/dist/constants/EnvVar.d.ts +1 -1
  181. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  182. package/dist/handlers/postTransformIdFrontImage.js +82 -0
  183. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  184. package/dist/handlers/postTransformSelfieImage.js +82 -0
  185. package/dist/middleware.d.ts +1 -1
  186. package/dist/middleware.js +1 -1
  187. package/dist/services/graphqlRequest.js +0 -1
  188. package/dist/styles/theme.css +706 -706
  189. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  190. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  191. package/dist/ui/AlertDialog/alertDialog.recipe.js +6 -6
  192. package/dist/ui/Avatar/avatar.recipe.js +3 -3
  193. package/dist/ui/Badge/Badge.d.ts +12 -12
  194. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  195. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  196. package/dist/ui/Badge/badge.recipe.js +7 -7
  197. package/dist/ui/Button/button.recipe.d.ts +2 -2
  198. package/dist/ui/Button/button.recipe.js +3 -3
  199. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  200. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  201. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  202. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  203. package/dist/ui/Checkbox/checkbox.recipe.js +1 -1
  204. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  205. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  206. package/dist/ui/Clipboard/clipboard.recipe.js +2 -2
  207. package/dist/ui/Collapsible/Collapsible.d.ts +32 -32
  208. package/dist/ui/Collapsible/collapsible.recipe.d.ts +8 -8
  209. package/dist/ui/Collapsible/collapsible.recipe.js +2 -2
  210. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  211. package/dist/ui/Combobox/Combobox.js +0 -1
  212. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  213. package/dist/ui/Combobox/combobox.recipe.js +6 -6
  214. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  215. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  216. package/dist/ui/DatePicker/datePicker.recipe.js +7 -7
  217. package/dist/ui/Dialog/Dialog.d.ts +154 -154
  218. package/dist/ui/Dialog/dialog.recipe.d.ts +14 -14
  219. package/dist/ui/Dialog/dialog.recipe.js +4 -4
  220. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  221. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  222. package/dist/ui/Drawer/drawer.recipe.js +5 -5
  223. package/dist/ui/Field/Field.d.ts +21 -21
  224. package/dist/ui/Field/field.recipe.d.ts +3 -3
  225. package/dist/ui/Field/field.recipe.js +3 -3
  226. package/dist/ui/IconButton/iconButton.recipe.d.ts +2 -2
  227. package/dist/ui/Menu/Menu.d.ts +144 -144
  228. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  229. package/dist/ui/NumberInput/numberInput.recipe.js +5 -5
  230. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  231. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  232. package/dist/ui/PasswordInput/passwordInput.recipe.js +3 -3
  233. package/dist/ui/PinInput/pinInput.recipe.js +3 -3
  234. package/dist/ui/Popover/Popover.d.ts +121 -121
  235. package/dist/ui/Popover/popover.recipe.d.ts +11 -11
  236. package/dist/ui/Popover/popover.recipe.js +1 -1
  237. package/dist/ui/Presence/Presence.js +1 -1
  238. package/dist/ui/Progress/Progress.d.ts +27 -27
  239. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  240. package/dist/ui/Progress/progress.recipe.js +2 -2
  241. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  242. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  243. package/dist/ui/SegmentGroup/segmentGroup.recipe.js +4 -4
  244. package/dist/ui/Select/Select.d.ts +45 -45
  245. package/dist/ui/Select/Select.js +0 -1
  246. package/dist/ui/Select/select.recipe.d.ts +3 -3
  247. package/dist/ui/Select/select.recipe.js +7 -7
  248. package/dist/ui/Table/Table.d.ts +21 -21
  249. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  250. package/dist/ui/Table/table.recipe.d.ts +3 -3
  251. package/dist/ui/Table/table.recipe.js +3 -3
  252. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  253. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  254. package/dist/ui/Tabs/tabs.recipe.js +4 -4
  255. package/dist/ui/Tooltip/tooltip.recipe.js +1 -1
  256. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  257. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  258. package/dist/utils/getGameName.d.ts +1 -0
  259. package/dist/utils/getGameName.js +6 -0
  260. package/dist/utils/getLocaleInfo.js +7 -7
  261. package/dist/utils/getQueryClient.js +1 -1
  262. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  263. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  264. package/dist/utils/parseDecimal.js +1 -1
  265. package/dist/utils/validateFile.d.ts +1 -1
  266. package/package.json +159 -164
@@ -0,0 +1,464 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { createListCollection, parseDate } from '@ark-ui/react';
4
+ import { useDialogContext } from '@ark-ui/react/dialog';
5
+ import { zodResolver } from '@hookform/resolvers/zod';
6
+ import { ObjectId } from '@opexa/object-id';
7
+ import { differenceInYears, format } from 'date-fns';
8
+ import Image from 'next/image';
9
+ import { useSearchParams } from 'next/navigation';
10
+ import { useEffect, useRef, useState } from 'react';
11
+ import { Controller, useForm } from 'react-hook-form';
12
+ import { twMerge } from 'tailwind-merge';
13
+ import { z } from 'zod';
14
+ import { useShallow } from 'zustand/shallow';
15
+ import { useControllableState } from '../../../client/hooks/useControllableState.js';
16
+ import { useCooldown } from '../../../client/hooks/useCooldown.js';
17
+ import { useCreateMemberVerificationMutation } from '../../../client/hooks/useCreateMemberVerificationMutation.js';
18
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
19
+ import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
20
+ import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
21
+ import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberParser.js';
22
+ import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
23
+ import { useSignInMutation } from '../../../client/hooks/useSignInMutation.js';
24
+ import { useSignUpMutation } from '../../../client/hooks/useSignUpMutation.js';
25
+ import { useUpdateAccountMutation } from '../../../client/hooks/useUpdateAccountMutation.js';
26
+ import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
27
+ import { useUploadImageFileMutation } from '../../../client/hooks/useUploadImageFileMutation.js';
28
+ import { toaster } from '../../../client/utils/toaster.js';
29
+ import { BRANCHES } from '../../../constants/index.js';
30
+ import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
31
+ import { CalendarIcon } from '../../../icons/CalendarIcon.js';
32
+ import { CheckIcon } from '../../../icons/CheckIcon.js';
33
+ import { ChevronDownIcon } from '../../../icons/ChevronDownIcon.js';
34
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
35
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
36
+ import { EyeIcon } from '../../../icons/EyeIcon.js';
37
+ import { EyeOffIcon } from '../../../icons/EyeOffIcon.js';
38
+ import pagcorLogo from '../../../images/pagcor.png';
39
+ import responsibleGamingLogo from '../../../images/responsible-gaming-yellow.png';
40
+ import { ObjectType } from '../../../services/ObjectType.js';
41
+ import { Button } from '../../../ui/Button/index.js';
42
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
43
+ import { DatePicker } from '../../../ui/DatePicker/index.js';
44
+ import { Field } from '../../../ui/Field/index.js';
45
+ import { PasswordInput } from '../../../ui/PasswordInput/index.js';
46
+ import { PinInput } from '../../../ui/PinInput/index.js';
47
+ import { Select } from '../../../ui/Select/index.js';
48
+ import { createPoll } from '../../../utils/createPoll.js';
49
+ import { getQueryClient } from '../../../utils/getQueryClient.js';
50
+ import { getMemberVerificationQueryKey } from '../../../utils/queryKeys.js';
51
+ import { ResponsibleGaming } from '../../Disclaimer/ResponsibleGaming.js';
52
+ import { TermsOfUse } from '../../Disclaimer/TermsOfUse.js';
53
+ import ImageUploader from './ImageUploader.js';
54
+ import { useSignUpKYCPropsContext } from './SignUpKYCContext.js';
55
+ export function SignUpFormKYC() {
56
+ const props = useSignUpKYCPropsContext();
57
+ const branchCollection = createListCollection({
58
+ items: props.branches ?? BRANCHES,
59
+ itemToValue: (item) => item.code,
60
+ itemToString: (item) => `${item.code} - ${item.name}`,
61
+ });
62
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
63
+ kycReminder: ctx.kycReminder,
64
+ })));
65
+ const [step, setStep] = useState(1);
66
+ const dialog = useDialogContext();
67
+ const search = useSearchParams();
68
+ const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
69
+ const signUpMutation = useSignUpMutation();
70
+ const signInMutation = useSignInMutation();
71
+ const updateAccountMutation = useUpdateAccountMutation();
72
+ const sendVerificationCodeMutation = useSendVerificationCodeMutation();
73
+ const localeInfo = useLocaleInfo();
74
+ const mobileNumberParser = useMobileNumberParser();
75
+ const fileSchema = z
76
+ .instanceof(File)
77
+ .refine((file) => file.size > 0, {
78
+ message: 'File is required.',
79
+ })
80
+ .refine((file) => file.type.startsWith('image/'), {
81
+ message: 'File must be an image.',
82
+ });
83
+ const Step1Definition = z.object({
84
+ name: z
85
+ .string()
86
+ .min(8, 'Username must be 8 or more characters')
87
+ .max(30, 'Username must not be more than 30 characters')
88
+ .trim(),
89
+ password: z
90
+ .string()
91
+ .min(8, 'Password must be 8 or more characters')
92
+ .max(30, 'Password must not be more than 30 characters')
93
+ .trim(),
94
+ mobileNumber: z
95
+ .string()
96
+ .min(1, 'Mobile number is required')
97
+ .superRefine((v, ctx) => {
98
+ if (!mobileNumberParser.validate(v)) {
99
+ ctx.addIssue({
100
+ code: z.ZodIssueCode.custom,
101
+ message: 'Invalid mobile number',
102
+ });
103
+ }
104
+ }),
105
+ firstName: z
106
+ .string()
107
+ .min(2, 'First name must be 2 or more characters')
108
+ .max(20, 'First name must not be more than 50 characters')
109
+ .regex(/\S/, 'First name cannot be empty or contain only spaces')
110
+ .trim(),
111
+ middleName: z
112
+ .string()
113
+ .min(2, 'Middle name must be 2 or more characters')
114
+ .max(20, 'Middle name must not be more than 50 characters')
115
+ .regex(/\S/, 'Middle name cannot be empty or contain only spaces')
116
+ .trim(),
117
+ lastName: z
118
+ .string()
119
+ .min(2, 'Last name must be 2 or more characters')
120
+ .max(20, 'Last name must not be more than 50 characters')
121
+ .regex(/\S/, 'Last name cannot be empty or contain only spaces')
122
+ .trim(),
123
+ birthDay: z
124
+ .date({
125
+ invalid_type_error: 'Date of birth is required',
126
+ required_error: 'Date of birth is required',
127
+ })
128
+ .superRefine((val, ctx) => {
129
+ const now = new Date();
130
+ const age = differenceInYears(now, val);
131
+ if (age < 21) {
132
+ return ctx.addIssue({
133
+ code: z.ZodIssueCode.custom,
134
+ message: 'You must be at least 21 years old',
135
+ });
136
+ }
137
+ }),
138
+ branchCode: z.string().min(1, 'Branch is required').trim(),
139
+ selfieImage: fileSchema,
140
+ frontImage: fileSchema,
141
+ termsAccepted: z.boolean().superRefine((v, ctx) => {
142
+ if (!v) {
143
+ ctx.addIssue({
144
+ code: z.ZodIssueCode.custom,
145
+ message: 'You must accept the terms and conditions and the responsible gaming guidelines',
146
+ });
147
+ }
148
+ }),
149
+ });
150
+ const Step2Definition = z.object({
151
+ verificationCode: z.array(z.string()).superRefine((val, ctx) => {
152
+ if (val.length !== 6 || val.some((v) => v.length !== 1)) {
153
+ ctx.addIssue({
154
+ code: z.ZodIssueCode.custom,
155
+ message: 'Please Enter your 6 digits verification code',
156
+ });
157
+ }
158
+ }),
159
+ });
160
+ const step1Form = useForm({
161
+ mode: 'all',
162
+ resolver: zodResolver(Step1Definition),
163
+ defaultValues: {
164
+ name: '',
165
+ password: '',
166
+ mobileNumber: '',
167
+ firstName: '',
168
+ middleName: '',
169
+ lastName: '',
170
+ branchCode: props?.branches?.[0]?.code ?? BRANCHES[0].code,
171
+ termsAccepted: false,
172
+ frontImage: undefined,
173
+ selfieImage: undefined,
174
+ },
175
+ });
176
+ const step2Form = useForm({
177
+ resolver: zodResolver(Step2Definition),
178
+ defaultValues: {
179
+ verificationCode: Array.from({ length: 6 }).fill(''),
180
+ },
181
+ });
182
+ const cooldown = useCooldown({
183
+ max: 60,
184
+ duration: 1000 * 60,
185
+ });
186
+ const form2Ref = useRef(null);
187
+ const birthDay = step1Form.watch('birthDay');
188
+ const branchCode = step1Form.watch('branchCode', '');
189
+ const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
190
+ const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
191
+ useEffect(() => {
192
+ if (props.frontImage) {
193
+ step1Form.setValue('frontImage', props.frontImage);
194
+ }
195
+ if (props.selfieImage) {
196
+ step1Form.setValue('selfieImage', props.selfieImage);
197
+ }
198
+ }, [step1Form, props]);
199
+ const { mutateAsync: createMemberVerification } = useCreateMemberVerificationMutation({
200
+ onError: (error) => {
201
+ toaster.error({
202
+ title: 'Failed to upload ID Front Image & Selfie Image',
203
+ description: error.message,
204
+ });
205
+ },
206
+ });
207
+ const { mutateAsync: updateMemberVerification } = useUpdateMemberVerificationMutation({
208
+ onSuccess: () => {
209
+ const queryClient = getQueryClient();
210
+ queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
211
+ if (!prev)
212
+ return prev;
213
+ return {
214
+ ...prev,
215
+ status: 'CREATED',
216
+ };
217
+ });
218
+ },
219
+ onError: (error) => {
220
+ toaster.error({
221
+ title: 'Failed to upload ID Front Image & Selfie Image',
222
+ description: error.message,
223
+ });
224
+ },
225
+ });
226
+ const memberVerification = useMemberVerificationQuery();
227
+ const memberId = memberVerification.data?.id;
228
+ const { mutate: uploadImageFile } = useUploadImageFileMutation();
229
+ const [isTermsOfUseAccepted, setIsTermsOfUseAccepted] = useState(false);
230
+ const [isResponsibleGamingAccepted, setIsResponsibleGamingAccepted] = useState(false);
231
+ useEffect(() => {
232
+ if (isTermsOfUseAccepted && isResponsibleGamingAccepted) {
233
+ step1Form.setValue('termsAccepted', true);
234
+ }
235
+ }, [isResponsibleGamingAccepted, isTermsOfUseAccepted, step1Form]);
236
+ return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: props.termsOfUseContent ?? 'Terms of Use content', siteName: props.siteName ?? 'Site', logo: props.logo, open: isTermsOfUseOpen, onCloseAction: () => {
237
+ setIsTermsOfUseAccepted(true);
238
+ setTermsOfUseOpen(false);
239
+ }, responsibleGamingLogo: props.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: props.responsibleGamingContent ?? 'Responsible Gaming content', logo: props.logo, open: isResponsibleGamingOpen, onCloseAction: () => {
240
+ setIsResponsibleGamingAccepted(true);
241
+ setResponsibleGamingOpen(false);
242
+ }, responsibleGamingLogo: props.responsibleGamingLogo }), step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
243
+ try {
244
+ await sendVerificationCodeMutation.mutateAsync({
245
+ channel: 'SMS',
246
+ recipient: mobileNumberParser.format(data.mobileNumber),
247
+ });
248
+ setStep(2);
249
+ cooldown.start();
250
+ }
251
+ catch (e) {
252
+ toaster.error({
253
+ description: e instanceof Error
254
+ ? e.message
255
+ : 'Failed to send verification code',
256
+ });
257
+ }
258
+ }), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.name, className: "mt-xl", children: [_jsx(Field.Label, { children: "Account Username" }), _jsx(Field.Input, { placeholder: "Enter Username", ...step1Form.register('name') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.name?.message })] }), _jsx(Field.Root, { invalid: !!step1Form.formState.errors.password, className: "mt-xl", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter your password", ...step1Form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.password?.message })] }) }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, className: "mt-xl", children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "absolute left-3.5 top-1/2 flex shrink-0 -translate-y-1/2 items-center gap-md", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
259
+ paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
260
+ }, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your First Name", ...step1Form.register('firstName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.middleName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Middle Name" }), _jsx(Field.Input, { placeholder: "Enter your Middle Name", ...step1Form.register('middleName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.middleName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Last Name" }), _jsx(Field.Input, { placeholder: "Enter your Last Name", ...step1Form.register('lastName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: birthDay, onChange: (value) => {
261
+ if (!value)
262
+ return;
263
+ step1Form.setValue('birthDay', value, {
264
+ shouldDirty: true,
265
+ shouldTouch: true,
266
+ shouldValidate: true,
267
+ });
268
+ }, onBlur: () => {
269
+ step1Form.trigger('birthDay');
270
+ } }), _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) => {
271
+ step1Form.setValue('branchCode', details.value.at(0) ??
272
+ props?.branches?.[0]?.code ??
273
+ BRANCHES[0].code, {
274
+ shouldDirty: true,
275
+ shouldTouch: true,
276
+ shouldValidate: true,
277
+ });
278
+ }, collection: branchCollection, positioning: {
279
+ sameWidth: true,
280
+ placement: 'bottom',
281
+ }, 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) => {
282
+ const label = branchCollection.stringifyItem(item) ?? '';
283
+ 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));
284
+ }) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.frontImage, className: "mt-xl", children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(ImageUploader, { value: props.frontImage || null, hasDescription: true, name: "idFrontImage", captureObject: "ID_DOCUMENT", onChange: (file) => {
285
+ step1Form.setValue('frontImage', file);
286
+ props.setFrontImage(file);
287
+ } }, "id-front-image-upload"), _jsx(Field.ErrorText, { children: step1Form.formState.errors.frontImage?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.selfieImage, className: "mt-xl", children: [_jsx(Field.Label, { children: "Selfie holding your ID" }), _jsx(ImageUploader, { value: props.selfieImage || null, name: "selfieImage", captureObject: "SELFIE", hasDescription: false, onChange: (file) => {
288
+ step1Form.setValue('selfieImage', file);
289
+ props.setSelfieImage(file);
290
+ } }, "selfie-image-upload"), _jsx(Field.ErrorText, { children: step1Form.formState.errors.selfieImage?.message })] }), _jsxs("div", { className: "mt-xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx("div", { className: "flex size-5xl items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] }), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
291
+ o.field.onChange(details.checked);
292
+ if (!details.checked) {
293
+ setIsTermsOfUseAccepted(false);
294
+ setIsResponsibleGamingAccepted(false);
295
+ }
296
+ }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I am at least 21 years of age and I have read and accept the", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
297
+ setTermsOfUseOpen(true);
298
+ }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
299
+ setResponsibleGamingOpen(true);
300
+ }, 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: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Already have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
301
+ dialog.setOpen(false);
302
+ signInStore.setOpen(true);
303
+ }, 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 }) => {
304
+ const id = ObjectId.generate(ObjectType.MemberAccount).toString();
305
+ const { mobileNumber } = step1Form.getValues();
306
+ try {
307
+ await signUpMutation.mutateAsync({
308
+ id,
309
+ mobileNumber: mobileNumberParser.format(mobileNumber),
310
+ verificationCode: verificationCode.join(''),
311
+ referralCode: search.get('referralCode') ?? undefined,
312
+ btag: search.get('btag') ?? undefined,
313
+ });
314
+ const name = mobileNumberParser.format(mobileNumber);
315
+ const password = `${name}${id}`;
316
+ const pollLogin = createPoll(async () => {
317
+ try {
318
+ await signInMutation.mutateAsync({
319
+ type: 'NAME_AND_PASSWORD',
320
+ name,
321
+ password,
322
+ });
323
+ return true;
324
+ }
325
+ catch {
326
+ return false;
327
+ }
328
+ }, {
329
+ until: (ok) => ok,
330
+ maxAttempt: 3,
331
+ });
332
+ const ok = await pollLogin();
333
+ if (!ok) {
334
+ signInStore.setOpen(true);
335
+ }
336
+ else {
337
+ const pollUpdateAccount = createPoll(async () => {
338
+ try {
339
+ await updateAccountMutation.mutateAsync({
340
+ name: step1Form.getValues('name'),
341
+ password: step1Form.getValues('password'),
342
+ branchCode: step1Form.getValues('branchCode'),
343
+ realName: [
344
+ step1Form.getValues('firstName'),
345
+ step1Form.getValues('middleName'),
346
+ step1Form.getValues('lastName'),
347
+ ]
348
+ .filter(Boolean)
349
+ .join(' '),
350
+ birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
351
+ });
352
+ return true;
353
+ }
354
+ catch {
355
+ return false;
356
+ }
357
+ }, {
358
+ until: (ok) => ok,
359
+ maxAttempt: 5,
360
+ interval: 300,
361
+ });
362
+ const pollImageUpload = createPoll(async () => {
363
+ const uploadImage = (file) => new Promise((resolve, reject) => {
364
+ if (!file) {
365
+ return reject(new Error('No file provided'));
366
+ }
367
+ uploadImageFile({ file }, {
368
+ onSuccess: (result) => resolve(result),
369
+ onError: (error) => reject(error || new Error('Upload failed')),
370
+ });
371
+ });
372
+ try {
373
+ const selfieFile = step1Form.getValues('selfieImage');
374
+ const frontFile = step1Form.getValues('frontImage');
375
+ if (!(selfieFile instanceof File) ||
376
+ !(frontFile instanceof File)) {
377
+ throw new Error('Invalid or missing image files');
378
+ }
379
+ const selfieImageId = await uploadImage(selfieFile);
380
+ const frontImageId = await uploadImage(frontFile);
381
+ const data = {
382
+ selfieImage: selfieImageId,
383
+ idFrontImage: frontImageId,
384
+ };
385
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
386
+ await delay(2000);
387
+ if (!memberId) {
388
+ await createMemberVerification({
389
+ ...data,
390
+ address: '',
391
+ nationality: '',
392
+ natureOfWork: '',
393
+ permanentAddress: '',
394
+ placeOfBirth: '',
395
+ sourceOfIncome: '',
396
+ });
397
+ }
398
+ else {
399
+ await updateMemberVerification({
400
+ id: memberId,
401
+ data,
402
+ });
403
+ }
404
+ return true;
405
+ }
406
+ catch (error) {
407
+ console.error('Image upload or verification failed:', error);
408
+ return false;
409
+ }
410
+ }, {
411
+ until: (ok) => ok,
412
+ maxAttempt: 5,
413
+ interval: 300,
414
+ });
415
+ await pollUpdateAccount();
416
+ await pollImageUpload();
417
+ }
418
+ dialog.setOpen(false);
419
+ globalStore.kycReminder.setOpen(true);
420
+ step1Form.reset();
421
+ step2Form.reset();
422
+ setStep(1);
423
+ }
424
+ catch (error) {
425
+ toaster.error({
426
+ description: error instanceof Error
427
+ ? error.message
428
+ : 'Invalid Verification Code',
429
+ });
430
+ }
431
+ }), children: [_jsx(Controller, { name: "verificationCode", control: step2Form.control, render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsxs(PinInput.Root, { placeholder: "0", value: o.field.value, onValueChange: (details) => {
432
+ o.field.onChange(details.value);
433
+ }, onValueComplete: () => {
434
+ form2Ref.current?.requestSubmit();
435
+ }, children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "text-text-placeholder-subtle text-2xl font-medium", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't recieve the code?" }), _jsx("button", { type: "button", className: "text-button-secondary-fg font-semibold disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
436
+ await sendVerificationCodeMutation.mutateAsync({
437
+ channel: 'SMS',
438
+ recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
439
+ });
440
+ cooldown.start();
441
+ }, children: cooldown.cooling
442
+ ? `Resend in ${cooldown.countdown}s`
443
+ : 'Resend' })] }), _jsxs("button", { type: "button", className: "text-text-tertiary-600 mx-auto mt-3xl flex w-fit items-center gap-1 text-sm font-semibold", onClick: () => {
444
+ setStep(1);
445
+ step2Form.reset();
446
+ cooldown.stop();
447
+ }, children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] })] })] }))] }));
448
+ }
449
+ const DEVICE_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
450
+ function DateOfBirthField(props) {
451
+ const [value, setValue] = useControllableState({
452
+ value: props.value,
453
+ defaultValue: props.defaultValue ?? null,
454
+ onChange: props.onChange,
455
+ });
456
+ return (_jsxs(DatePicker.Root, { size: "md", variant: "outline", placeholder: "MM/DD/YYYY", lazyMount: true, unmountOnExit: true, fixedWeeks: true, selectionMode: "single", value: value ? [parseDate(value)] : [], onValueChange: (details) => {
457
+ const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
458
+ setValue(value ?? null);
459
+ }, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
460
+ .getMonthsGrid({ columns: 4, format: 'short' })
461
+ .map((months, id) => (_jsx(DatePicker.TableRow, { children: months.map((month, id) => (_jsx(DatePicker.TableCell, { value: month.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: month.label }) }, id))) }, id))) }) })] })) }) }), _jsx(DatePicker.View, { view: "year", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
462
+ .getYearsGrid({ columns: 4 })
463
+ .map((years, id) => (_jsx(DatePicker.TableRow, { children: years.map((year, id) => (_jsx(DatePicker.TableCell, { value: year.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: year.label }) }, id))) }, id))) }) })] })) }) })] }) })] }));
464
+ }
@@ -14,5 +14,5 @@ export function SignUpKYC(props) {
14
14
  const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
15
  return (_jsx(SignUpKYCPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
16
16
  signUpStore.setOpen(details.open);
17
- }, 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 z-banner p-3xl pb-4xl mx-auto flex size-full flex-col items-start overflow-y-auto lg:max-h-[80vh] lg:w-fit lg:rounded-xl', 'scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full', props.className), children: _jsxs("div", { className: "size-full lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[7.5rem]", draggable: false }), _jsx(Suspense, { children: _jsx(SignUpKYCForm, {}) })] }) }) })] }) }) }));
17
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: twMerge('z-banner mx-auto flex size-full flex-col items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:max-h-[80vh] lg:w-fit lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className), children: _jsxs("div", { className: "size-full lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[7.5rem]", draggable: false }), _jsx(Suspense, { children: _jsx(SignUpKYCForm, {}) })] }) }) })] }) }) }));
18
18
  }
@@ -80,7 +80,7 @@ export function SignUpKYCForm() {
80
80
  .refine((file) => !file || file.size > 0, {
81
81
  message: 'File is required.',
82
82
  })
83
- .refine((file) => file && file.type.startsWith('image/'), {
83
+ .refine((file) => file?.type.startsWith('image/'), {
84
84
  message: 'File must be an image.',
85
85
  });
86
86
  const Step1Definition = z.object({
@@ -224,7 +224,7 @@ export function SignUpKYCForm() {
224
224
  const memberVerification = useMemberVerificationQuery();
225
225
  const memberId = memberVerification.data?.id;
226
226
  const { mutate: uploadImageFile } = useUploadImageFileMutation();
227
- return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
227
+ return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Create an account" }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
228
228
  try {
229
229
  await sendVerificationCodeMutation.mutateAsync({
230
230
  channel: 'SMS',
@@ -240,7 +240,7 @@ export function SignUpKYCForm() {
240
240
  : 'Failed to send verification code',
241
241
  });
242
242
  }
243
- }), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.name, className: "mt-xl", children: [_jsx(Field.Label, { children: "Account Username" }), _jsx(Field.Input, { placeholder: "Enter Username", ...step1Form.register('name') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.name?.message })] }), _jsx(Field.Root, { invalid: !!step1Form.formState.errors.password, className: "mt-xl", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter your password", ...step1Form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.password?.message })] }) }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, className: "mt-xl", children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "gap-md absolute left-3.5 top-1/2 flex shrink-0 -translate-y-1/2 items-center", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
243
+ }), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.name, className: "mt-xl", children: [_jsx(Field.Label, { children: "Account Username" }), _jsx(Field.Input, { placeholder: "Enter Username", ...step1Form.register('name') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.name?.message })] }), _jsx(Field.Root, { invalid: !!step1Form.formState.errors.password, className: "mt-xl", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter your password", ...step1Form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.password?.message })] }) }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, className: "mt-xl", children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "-translate-y-1/2 absolute top-1/2 left-3.5 flex shrink-0 items-center gap-md", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
244
244
  paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
245
245
  }, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your First Name", ...step1Form.register('firstName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.middleName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Middle Name" }), _jsx(Field.Input, { placeholder: "Enter your Middle Name", ...step1Form.register('middleName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.middleName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Last Name" }), _jsx(Field.Input, { placeholder: "Enter your Last Name", ...step1Form.register('lastName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: birthDay, onChange: (value) => {
246
246
  if (!value)
@@ -276,7 +276,7 @@ export function SignUpKYCForm() {
276
276
  type: 'validate',
277
277
  message: error.message,
278
278
  });
279
- } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsxs("div", { className: "mt-3xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "gap-3xl h-13 mx-auto mt-5 flex w-fit items-center justify-center rounded-[60px] bg-[#1D0201] px-5 py-2", children: [_jsx("div", { className: "size-5xl flex items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] }), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
279
+ } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsxs("div", { className: "mt-3xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2", children: [_jsx("div", { className: "flex size-5xl items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] }), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
280
280
  if (details.checked === 'indeterminate')
281
281
  return;
282
282
  o.field.onChange(details.checked);
@@ -302,10 +302,10 @@ export function SignUpKYCForm() {
302
302
  globalStore.responsibleGaming.setNext('SIGN_UP');
303
303
  globalStore.signUp.setOpen(false);
304
304
  }
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: () => {
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: "mt-6 flex w-full items-center justify-center gap-xs pb-8 text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Already have an account?" }), _jsx("button", { type: "submit", className: "font-semibold text-button-tertiary-fg", onClick: () => {
306
306
  dialog.setOpen(false);
307
307
  globalStore.signIn.setOpen(true);
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 }) => {
308
+ }, children: "Log In" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Check your Phone" }), _jsxs("p", { className: "mt-xs text-center text-sm text-text-secondary-700", 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 }) => {
309
309
  const id = ObjectId.generate(ObjectType.MemberAccount).toString();
310
310
  const { mobileNumber } = step1Form.getValues();
311
311
  try {
@@ -437,7 +437,7 @@ export function SignUpKYCForm() {
437
437
  o.field.onChange(details.value);
438
438
  }, onValueComplete: () => {
439
439
  form2Ref.current?.requestSubmit();
440
- }, children: [_jsxs(PinInput.Control, { className: "gap-md grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "text-text-placeholder-subtle text-2xl font-medium", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "gap-xs mt-3 flex w-full items-center justify-center text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't recieve the code?" }), _jsx("button", { type: "button", className: "text-button-secondary-fg font-semibold disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
440
+ }, children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "font-medium text-2xl text-text-placeholder-subtle", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] }), _jsx(Field.ErrorText, { children: o.formState.errors.verificationCode?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't recieve the code?" }), _jsx("button", { type: "button", className: "font-semibold text-button-secondary-fg disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
441
441
  await sendVerificationCodeMutation.mutateAsync({
442
442
  channel: 'SMS',
443
443
  recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
@@ -445,7 +445,7 @@ export function SignUpKYCForm() {
445
445
  cooldown.start();
446
446
  }, children: cooldown.cooling
447
447
  ? `Resend in ${cooldown.countdown}s`
448
- : 'Resend' })] }), _jsxs("button", { type: "button", className: "text-text-tertiary-600 mt-3xl mx-auto flex w-fit items-center gap-1 text-sm font-semibold", onClick: () => {
448
+ : 'Resend' })] }), _jsxs("button", { type: "button", className: "mx-auto mt-3xl flex w-fit items-center gap-1 font-semibold text-sm text-text-tertiary-600", onClick: () => {
449
449
  setStep(1);
450
450
  step2Form.reset();
451
451
  cooldown.stop();
@@ -0,0 +1,11 @@
1
+ export type CaptureSubject = 'SELFIE' | 'ID_DOCUMENT';
2
+ export interface UseImageUploaderReturn {
3
+ capturing: CaptureSubject | null;
4
+ setCapturing: (capturing: CaptureSubject | null) => void;
5
+ frontImage: File | null;
6
+ setFrontImage: (id: File | null) => void;
7
+ selfieImage: File | null;
8
+ setSelfieImage: (id: File | null) => void;
9
+ reset: () => void;
10
+ }
11
+ export declare function useImageUploader(): UseImageUploaderReturn;
@@ -0,0 +1,20 @@
1
+ import { useState } from 'react';
2
+ export function useImageUploader() {
3
+ const [frontImage, setFrontImage] = useState(null);
4
+ const [selfieImage, setSelfieImage] = useState(null);
5
+ const [capturing, setCapturing] = useState(null);
6
+ const reset = () => {
7
+ setCapturing(null);
8
+ setFrontImage(null);
9
+ setSelfieImage(null);
10
+ };
11
+ return {
12
+ capturing,
13
+ setCapturing,
14
+ frontImage,
15
+ setFrontImage,
16
+ selfieImage,
17
+ setSelfieImage,
18
+ reset,
19
+ };
20
+ }
@@ -0,0 +1,9 @@
1
+ export declare function loadFaceApiModels(): Promise<void>;
2
+ export declare function dataURLtoBlob(dataURL: string): Blob;
3
+ export declare const resizeFile: (file: File) => Promise<unknown>;
4
+ export declare const MAX_FILE_SIZE = 10;
5
+ export declare const MAX_NAME_LENGTH = 52;
6
+ export declare const SUPPORTED_FILES: string[];
7
+ export declare function validateFile(file: File): "File too large" | "File name too long" | "Unsupported file" | undefined;
8
+ export declare function showPermissionInstructions(): void;
9
+ export declare const cameraErrorDescriptions: Record<string, string>;