@opexa/portal-components 0.0.926 → 0.0.928

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 (184) 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/DisclaimerV2.js +1 -1
  25. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  26. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  27. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  28. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  29. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  30. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  31. package/dist/components/FeatureFlag/index.d.ts +1 -0
  32. package/dist/components/FeatureFlag/index.js +1 -0
  33. package/dist/components/ForgotPassword/Crazywin/ForgotPassword.module.css +42 -42
  34. package/dist/components/Jackpots/Jackpots.module.css +288 -288
  35. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  36. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  37. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  38. package/dist/components/KYC/AutoOpen.js +40 -0
  39. package/dist/components/KYC/BasicInformation.js +1 -1
  40. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  41. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  42. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  43. package/dist/components/KYC/CaptureSelfie.js +285 -0
  44. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  45. package/dist/components/KYC/DisplayImage.js +8 -0
  46. package/dist/components/KYC/FileUpload.d.ts +10 -0
  47. package/dist/components/KYC/FileUpload.js +72 -0
  48. package/dist/components/KYC/IdentityVerification.js +1 -1
  49. package/dist/components/KYC/KYC.lazy.js +1 -1
  50. package/dist/components/KYC/KYCDefault/KYCVerificationStatus.lazy.js +2 -2
  51. package/dist/components/KYC/KYCNonPagCor/KYCVerificationStatus.lazy.js +2 -2
  52. package/dist/components/KYC/KYCNonPagCor/PersonalInformation.js +1 -1
  53. package/dist/components/KYC/KYCVerificationStatus.lazy.js +8 -5
  54. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  55. package/dist/components/KYC/NoCameraError.js +6 -0
  56. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  57. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  58. package/dist/components/KYC/PersonalInformation.js +1 -1
  59. package/dist/components/KYC/backup/Header.d.ts +1 -0
  60. package/dist/components/KYC/backup/Header.js +8 -0
  61. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  62. package/dist/components/KYC/backup/Indicator.js +9 -0
  63. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  64. package/dist/components/KYC/backup/KYC.js +14 -0
  65. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  66. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  67. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  68. package/dist/components/KYC/backup/KYCContext.js +2 -0
  69. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  70. package/dist/components/KYC/backup/Step1.js +13 -0
  71. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  72. package/dist/components/KYC/backup/Step2.js +13 -0
  73. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  74. package/dist/components/KYC/backup/Step3.js +13 -0
  75. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  76. package/dist/components/KYC/backup/Step4.js +7 -0
  77. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  78. package/dist/components/KYC/backup/useKYC.js +8 -0
  79. package/dist/components/KYC/loadModels.d.ts +1 -0
  80. package/dist/components/KYC/loadModels.js +9 -0
  81. package/dist/components/KYC/utils.d.ts +9 -0
  82. package/dist/components/KYC/utils.js +79 -0
  83. package/dist/components/Messages/Message.d.ts +1 -0
  84. package/dist/components/Messages/Message.js +35 -0
  85. package/dist/components/Messages/MessageContext.d.ts +6 -0
  86. package/dist/components/Messages/MessageContext.js +2 -0
  87. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  88. package/dist/components/Messages/MessagePopup.js +20 -0
  89. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  90. package/dist/components/Messages/MessageTrigger.js +19 -0
  91. package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
  92. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  93. package/dist/components/Quests/CountdownTimer.js +33 -0
  94. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  95. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  96. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  97. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  98. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  99. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  100. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  101. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  102. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  103. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  104. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  105. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  106. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  107. package/dist/components/SignUp/SignUpContext.js +2 -0
  108. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  109. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  110. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  111. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  112. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  113. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  114. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  115. package/dist/components/SignUp/SignUpForm.js +284 -0
  116. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  117. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  118. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  119. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  120. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  121. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  122. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  123. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  124. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  125. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  126. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  127. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  128. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  129. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  130. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  131. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  132. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  133. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  134. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  135. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  136. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  137. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  138. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  139. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  140. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  141. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  142. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  143. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  144. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  145. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  146. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  147. package/dist/components/shared/IdDocumentField.client.js +204 -0
  148. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  149. package/dist/components/shared/IdDocumentField.js +11 -0
  150. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  151. package/dist/components/shared/SelfieField.client.js +327 -0
  152. package/dist/components/shared/SelfieField.d.ts +2 -0
  153. package/dist/components/shared/SelfieField.js +11 -0
  154. package/dist/constants/BranchCode.d.ts +4 -0
  155. package/dist/constants/BranchCode.js +42 -0
  156. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  157. package/dist/handlers/postTransformIdFrontImage.js +67 -0
  158. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  159. package/dist/handlers/postTransformSelfieImage.js +71 -0
  160. package/dist/handlers.d.ts +43 -0
  161. package/dist/handlers.js +297 -0
  162. package/dist/icons/BellRingIcon.d.ts +2 -0
  163. package/dist/icons/BellRingIcon.js +4 -0
  164. package/dist/images/phone-icon.svg +10 -10
  165. package/dist/services/queries.js +3369 -3369
  166. package/dist/styles/theme.css +776 -776
  167. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  168. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  169. package/dist/ui/Checkbox/checkbox.recipe.js +1 -1
  170. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  171. package/dist/utils/dataUrlToBlob.js +11 -0
  172. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  173. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  174. package/dist/utils/getGameName.d.ts +1 -0
  175. package/dist/utils/getGameName.js +6 -0
  176. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  177. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  178. package/dist/utils/resizeImageSize.d.ts +2 -0
  179. package/dist/utils/resizeImageSize.js +11 -0
  180. package/package.json +179 -179
  181. package/dist/components/Banner/Banner.client.d.ts +0 -12
  182. package/dist/components/Banner/Banner.client.js +0 -49
  183. package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
  184. package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
@@ -0,0 +1,429 @@
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 Link from 'next/link';
10
+ import { useSearchParams } from 'next/navigation';
11
+ import { useEffect, useRef, useState } from 'react';
12
+ import { Controller, useForm } from 'react-hook-form';
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 pagcorLogo from '../../../images/pagcor.png';
37
+ import responsibleGamingLogo from '../../../images/responsible-gaming.png';
38
+ import { ObjectType } from '../../../services/ObjectType.js';
39
+ import { Button } from '../../../ui/Button/index.js';
40
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
41
+ import { DatePicker } from '../../../ui/DatePicker/index.js';
42
+ import { Field } from '../../../ui/Field/index.js';
43
+ import { PinInput } from '../../../ui/PinInput/index.js';
44
+ import { Select } from '../../../ui/Select/index.js';
45
+ import { createPoll } from '../../../utils/createPoll.js';
46
+ import { getQueryClient } from '../../../utils/getQueryClient.js';
47
+ import { getMemberVerificationQueryKey } from '../../../utils/queryKeys.js';
48
+ import ImageUploader from './ImageUploader.js';
49
+ import { useSignUpPagcorPropsContext } from './SignUpPagcorContext.js';
50
+ export function SignUpFormPagcor() {
51
+ const props = useSignUpPagcorPropsContext();
52
+ const branchCollection = createListCollection({
53
+ items: props.branches ?? BRANCHES,
54
+ itemToValue: (item) => item.code,
55
+ itemToString: (item) => `${item.code} - ${item.name}`,
56
+ });
57
+ const [step, setStep] = useState(1);
58
+ const dialog = useDialogContext();
59
+ const search = useSearchParams();
60
+ const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
61
+ const signUpMutation = useSignUpMutation();
62
+ const signInMutation = useSignInMutation();
63
+ const updateAccountMutation = useUpdateAccountMutation();
64
+ const sendVerificationCodeMutation = useSendVerificationCodeMutation();
65
+ const localeInfo = useLocaleInfo();
66
+ const mobileNumberParser = useMobileNumberParser();
67
+ const fileSchema = z
68
+ .instanceof(File)
69
+ .refine((file) => file.size > 0, {
70
+ message: 'File is required.',
71
+ })
72
+ .refine((file) => file.type.startsWith('image/'), {
73
+ message: 'File must be an image.',
74
+ });
75
+ const Step1Definition = z.object({
76
+ name: z
77
+ .string()
78
+ .min(8, 'Username must be 8 or more characters')
79
+ .max(30, 'Username must not be more than 30 characters')
80
+ .trim(),
81
+ password: z
82
+ .string()
83
+ .min(8, 'Password must be 8 or more characters')
84
+ .max(30, 'Password must not be more than 30 characters')
85
+ .trim(),
86
+ mobileNumber: z
87
+ .string()
88
+ .min(1, 'Mobile number is required')
89
+ .superRefine((v, ctx) => {
90
+ if (!mobileNumberParser.validate(v)) {
91
+ ctx.addIssue({
92
+ code: z.ZodIssueCode.custom,
93
+ message: 'Invalid mobile number',
94
+ });
95
+ }
96
+ }),
97
+ firstName: z
98
+ .string()
99
+ .min(2, 'First name must be 2 or more characters')
100
+ .max(50, 'First name must not be more than 50 characters')
101
+ .trim(),
102
+ middleName: z
103
+ .string()
104
+ .min(2, 'First name must be 2 or more characters')
105
+ .max(50, 'First name must not be more than 50 characters')
106
+ .trim(),
107
+ lastName: z
108
+ .string()
109
+ .min(2, 'First name must be 2 or more characters')
110
+ .max(50, 'First name must not be more than 50 characters')
111
+ .trim(),
112
+ birthDay: z
113
+ .date({
114
+ invalid_type_error: 'Date of birth is required',
115
+ required_error: 'Date of birth is required',
116
+ })
117
+ .superRefine((val, ctx) => {
118
+ const now = new Date();
119
+ const age = differenceInYears(now, val);
120
+ if (age < 21) {
121
+ return ctx.addIssue({
122
+ code: z.ZodIssueCode.custom,
123
+ message: 'You must be at least 21 years old',
124
+ });
125
+ }
126
+ }),
127
+ branchCode: z.string().min(1, 'Branch is required').trim(),
128
+ selfieImage: fileSchema,
129
+ frontImage: fileSchema,
130
+ termsAccepted: z.boolean().superRefine((v, ctx) => {
131
+ if (!v) {
132
+ ctx.addIssue({
133
+ code: z.ZodIssueCode.custom,
134
+ message: 'You must accept the terms and conditions',
135
+ });
136
+ }
137
+ }),
138
+ });
139
+ const Step2Definition = z.object({
140
+ verificationCode: z.array(z.string()).superRefine((val, ctx) => {
141
+ if (val.length !== 6 || val.some((v) => v.length !== 1)) {
142
+ ctx.addIssue({
143
+ code: z.ZodIssueCode.custom,
144
+ message: 'Please Enter your 6 digits verification code',
145
+ });
146
+ }
147
+ }),
148
+ });
149
+ const step1Form = useForm({
150
+ mode: 'all',
151
+ resolver: zodResolver(Step1Definition),
152
+ defaultValues: {
153
+ name: '',
154
+ password: '',
155
+ mobileNumber: '',
156
+ firstName: '',
157
+ middleName: '',
158
+ lastName: '',
159
+ branchCode: props?.branches?.[0]?.code ?? BRANCHES[0].code,
160
+ termsAccepted: false,
161
+ frontImage: undefined,
162
+ selfieImage: undefined,
163
+ },
164
+ });
165
+ const step2Form = useForm({
166
+ resolver: zodResolver(Step2Definition),
167
+ defaultValues: {
168
+ verificationCode: Array.from({ length: 6 }).fill(''),
169
+ },
170
+ });
171
+ const cooldown = useCooldown({
172
+ max: 60,
173
+ duration: 1000 * 60,
174
+ });
175
+ const form2Ref = useRef(null);
176
+ const birthDay = step1Form.watch('birthDay');
177
+ const branchCode = step1Form.watch('branchCode', '');
178
+ useEffect(() => {
179
+ if (props.frontImage) {
180
+ step1Form.setValue('frontImage', props.frontImage);
181
+ }
182
+ if (props.selfieImage) {
183
+ step1Form.setValue('selfieImage', props.selfieImage);
184
+ }
185
+ }, [step1Form, props]);
186
+ const { mutateAsync: createMemberVerification } = useCreateMemberVerificationMutation({
187
+ onError: (error) => {
188
+ toaster.error({
189
+ title: 'Failed to upload ID Front Image & Selfie Image',
190
+ description: error.message,
191
+ });
192
+ },
193
+ });
194
+ const { mutateAsync: updateMemberVerification } = useUpdateMemberVerificationMutation({
195
+ onSuccess: () => {
196
+ const queryClient = getQueryClient();
197
+ queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
198
+ if (!prev)
199
+ return prev;
200
+ return {
201
+ ...prev,
202
+ status: 'CREATED',
203
+ };
204
+ });
205
+ },
206
+ onError: (error) => {
207
+ toaster.error({
208
+ title: 'Failed to upload ID Front Image & Selfie Image',
209
+ description: error.message,
210
+ });
211
+ },
212
+ });
213
+ const memberVerification = useMemberVerificationQuery();
214
+ const memberId = memberVerification.data?.id;
215
+ const { mutate: uploadImageFile } = useUploadImageFileMutation();
216
+ 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) => {
217
+ try {
218
+ await sendVerificationCodeMutation.mutateAsync({
219
+ channel: 'SMS',
220
+ recipient: mobileNumberParser.format(data.mobileNumber),
221
+ });
222
+ setStep(2);
223
+ cooldown.start();
224
+ }
225
+ catch (e) {
226
+ toaster.error({
227
+ description: e instanceof Error
228
+ ? e.message
229
+ : 'Failed to send verification code',
230
+ });
231
+ }
232
+ }), 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 })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.password, className: "mt-xl", children: [_jsx(Field.Label, { children: "Password" }), _jsx(Field.Input, { type: "password", placeholder: "Enter a password", ...step1Form.register('password') }), _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: {
233
+ paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
234
+ }, ...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) => {
235
+ if (!value)
236
+ return;
237
+ step1Form.setValue('birthDay', value, {
238
+ shouldDirty: true,
239
+ shouldTouch: true,
240
+ shouldValidate: true,
241
+ });
242
+ }, onBlur: () => {
243
+ step1Form.trigger('birthDay');
244
+ } }), _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) => {
245
+ step1Form.setValue('branchCode', details.value.at(0) ??
246
+ props?.branches?.[0]?.code ??
247
+ BRANCHES[0].code, {
248
+ shouldDirty: true,
249
+ shouldTouch: true,
250
+ shouldValidate: true,
251
+ });
252
+ }, collection: branchCollection, positioning: {
253
+ sameWidth: true,
254
+ placement: 'bottom',
255
+ }, 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) => {
256
+ const label = branchCollection.stringifyItem(item) ?? '';
257
+ return (_jsx(Select.Item, { item: item, children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
258
+ }) }) })] }), _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) => {
259
+ step1Form.setValue('frontImage', file);
260
+ props.setFrontImage(file);
261
+ } }, "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", onChange: (file) => {
262
+ step1Form.setValue('selfieImage', file);
263
+ props.setSelfieImage(file);
264
+ } }, "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, className: "h-9.5 w-auto" }) }), _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) => {
265
+ o.field.onChange(details.checked);
266
+ }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I am at least 21 years of age and I accept the", ' ', _jsx(Link, { href: props.termsAndConditionsUrl ?? '/terms-and-conditions', onClick: () => {
267
+ dialog.setOpen(false);
268
+ }, className: "text-brand-400 whitespace-nowrap underline underline-offset-2", children: "Terms and Conditions." })] }), ' ', _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Create Account" })] }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Already have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
269
+ dialog.setOpen(false);
270
+ signInStore.setOpen(true);
271
+ }, 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 }) => {
272
+ const id = ObjectId.generate(ObjectType.MemberAccount).toString();
273
+ const { mobileNumber } = step1Form.getValues();
274
+ try {
275
+ await signUpMutation.mutateAsync({
276
+ id,
277
+ mobileNumber: mobileNumberParser.format(mobileNumber),
278
+ verificationCode: verificationCode.join(''),
279
+ referralCode: search.get('referralCode') ?? undefined,
280
+ btag: search.get('btag') ?? undefined,
281
+ });
282
+ const name = mobileNumberParser.format(mobileNumber);
283
+ const password = `${name}${id}`;
284
+ const pollLogin = createPoll(async () => {
285
+ try {
286
+ await signInMutation.mutateAsync({
287
+ type: 'NAME_AND_PASSWORD',
288
+ name,
289
+ password,
290
+ });
291
+ return true;
292
+ }
293
+ catch {
294
+ return false;
295
+ }
296
+ }, {
297
+ until: (ok) => ok,
298
+ maxAttempt: 3,
299
+ });
300
+ const ok = await pollLogin();
301
+ if (!ok) {
302
+ signInStore.setOpen(true);
303
+ }
304
+ else {
305
+ const pollUpdateAccount = createPoll(async () => {
306
+ try {
307
+ await updateAccountMutation.mutateAsync({
308
+ name: step1Form.getValues('name'),
309
+ password: step1Form.getValues('password'),
310
+ branchCode: step1Form.getValues('branchCode'),
311
+ realName: [
312
+ step1Form.getValues('firstName'),
313
+ step1Form.getValues('middleName'),
314
+ step1Form.getValues('lastName'),
315
+ ]
316
+ .filter(Boolean)
317
+ .join(' '),
318
+ birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
319
+ });
320
+ return true;
321
+ }
322
+ catch {
323
+ return false;
324
+ }
325
+ }, {
326
+ until: (ok) => ok,
327
+ maxAttempt: 3,
328
+ });
329
+ const pollImageUpload = createPoll(async () => {
330
+ const uploadImage = (file) => new Promise((resolve, reject) => {
331
+ if (!file) {
332
+ return reject(new Error('No file provided'));
333
+ }
334
+ uploadImageFile({ file }, {
335
+ onSuccess: (result) => resolve(result),
336
+ onError: (error) => reject(error || new Error('Upload failed')),
337
+ });
338
+ });
339
+ try {
340
+ const selfieFile = step1Form.getValues('selfieImage');
341
+ const frontFile = step1Form.getValues('frontImage');
342
+ if (!(selfieFile instanceof File) ||
343
+ !(frontFile instanceof File)) {
344
+ throw new Error('Invalid or missing image files');
345
+ }
346
+ const selfieImageId = await uploadImage(selfieFile);
347
+ const frontImageId = await uploadImage(frontFile);
348
+ const data = {
349
+ selfieImage: selfieImageId,
350
+ idFrontImage: frontImageId,
351
+ };
352
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
353
+ await delay(2000);
354
+ if (!memberId) {
355
+ await createMemberVerification({
356
+ ...data,
357
+ address: '',
358
+ nationality: '',
359
+ natureOfWork: '',
360
+ permanentAddress: '',
361
+ placeOfBirth: '',
362
+ sourceOfIncome: '',
363
+ });
364
+ }
365
+ else {
366
+ await updateMemberVerification({
367
+ id: memberId,
368
+ data,
369
+ });
370
+ }
371
+ return true;
372
+ }
373
+ catch (error) {
374
+ console.error('Image upload or verification failed:', error);
375
+ return false;
376
+ }
377
+ }, {
378
+ until: (ok) => ok,
379
+ maxAttempt: 1,
380
+ });
381
+ await pollUpdateAccount();
382
+ await pollImageUpload();
383
+ }
384
+ dialog.setOpen(false);
385
+ step1Form.reset();
386
+ step2Form.reset();
387
+ setStep(1);
388
+ }
389
+ catch (error) {
390
+ toaster.error({
391
+ description: error instanceof Error
392
+ ? error.message
393
+ : 'Invalid Verification Code',
394
+ });
395
+ }
396
+ }), 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) => {
397
+ o.field.onChange(details.value);
398
+ }, onValueComplete: () => {
399
+ form2Ref.current?.requestSubmit();
400
+ }, 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 () => {
401
+ await sendVerificationCodeMutation.mutateAsync({
402
+ channel: 'SMS',
403
+ recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
404
+ });
405
+ cooldown.start();
406
+ }, children: cooldown.cooling
407
+ ? `Resend in ${cooldown.countdown}s`
408
+ : '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: () => {
409
+ setStep(1);
410
+ step2Form.reset();
411
+ cooldown.stop();
412
+ }, children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] })] })] }))] }));
413
+ }
414
+ const DEVICE_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
415
+ function DateOfBirthField(props) {
416
+ const [value, setValue] = useControllableState({
417
+ value: props.value,
418
+ defaultValue: props.defaultValue ?? null,
419
+ onChange: props.onChange,
420
+ });
421
+ 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) => {
422
+ const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
423
+ setValue(value ?? null);
424
+ }, 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
425
+ .getMonthsGrid({ columns: 4, format: 'short' })
426
+ .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
427
+ .getYearsGrid({ columns: 4 })
428
+ .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))) }) })] })) }) })] }) })] }));
429
+ }
@@ -0,0 +1,13 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type ReactNode } from 'react';
3
+ import type { Branch } from '../../../types';
4
+ export interface SignUpPagcorProps {
5
+ logo: ImageProps['src'];
6
+ children?: ReactNode;
7
+ /** @default "/terms-and-conditions" */
8
+ termsAndConditionsUrl?: string;
9
+ className?: string;
10
+ branches?: Branch[];
11
+ layout: 'pagcor';
12
+ }
13
+ export declare function SignUpPagcor(props: SignUpPagcorProps): 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 Image, {} from 'next/image';
4
+ import { Suspense } from 'react';
5
+ import { twMerge } from 'tailwind-merge';
6
+ import { useShallow } from 'zustand/shallow';
7
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
8
+ import { XIcon } from '../../../icons/XIcon.js';
9
+ import { Dialog } from '../../../ui/Dialog/index.js';
10
+ import { Portal } from '../../../ui/Portal/index.js';
11
+ import { CaptureIdDocument } from './CaptureIdDocument.js';
12
+ import { CaptureSelfie } from './CaptureSelfie.js';
13
+ import { SignUpFormPagcor } from './SignUpFormPagcor.js';
14
+ import { SignUpPagcorPropsProvider } from './SignUpPagcorContext.js';
15
+ import { useImageUploader } from './useImageUploader.js';
16
+ export function SignUpPagcor(props) {
17
+ const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
18
+ const imageUploader = useImageUploader();
19
+ const value = {
20
+ ...props,
21
+ ...imageUploader,
22
+ };
23
+ return (_jsx(SignUpPagcorPropsProvider, { value: value, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
24
+ signUpStore.setOpen(details.open);
25
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start p-3xl pb-4xl lg:h-auto lg:w-fit lg:rounded-xl', props.className), children: [_jsx(CaptureIdDocument, {}), _jsx(CaptureSelfie, {}), _jsxs("div", { className: "w-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-[120px]", draggable: false }), _jsx(Suspense, { children: _jsx(SignUpFormPagcor, {}) })] })] }) })] }) }) }));
26
+ }
@@ -0,0 +1,7 @@
1
+ import type { SignUpPagcorProps } from './SignUpPagcor.lazy';
2
+ import type { UseImageUploaderReturn } from './useImageUploader';
3
+ export declare const SignUpPagcorPropsProvider: (props: {
4
+ value: SignUpPagcorProps & UseImageUploaderReturn;
5
+ } & {
6
+ children?: import("react").ReactNode | undefined;
7
+ }) => React.ReactNode, useSignUpPagcorPropsContext: () => SignUpPagcorProps & UseImageUploaderReturn;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [SignUpPagcorPropsProvider, useSignUpPagcorPropsContext] = createContext();
@@ -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
+ setFrontImage(null);
10
+ };
11
+ return {
12
+ capturing,
13
+ setCapturing,
14
+ frontImage,
15
+ setFrontImage,
16
+ selfieImage,
17
+ setSelfieImage,
18
+ reset,
19
+ };
20
+ }