@opexa/portal-components 0.0.869 → 0.0.871

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 (174) hide show
  1. package/dist/client/hooks/useLocaleInfo.d.ts +1 -1
  2. package/dist/client/hooks/useLocaleInfo.js +1 -1
  3. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  4. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  5. package/dist/components/GamesSearch/GamesSearch.js +10 -6
  6. package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.d.ts +1 -1
  7. package/dist/components/Jackpots/JackpotsListNext/useJackpotsListItemData.d.ts +1 -1
  8. package/dist/components/SignIn/MobileNumberField.d.ts +14 -0
  9. package/dist/components/SignIn/MobileNumberField.js +62 -0
  10. package/dist/components/SignIn/MobileNumberSignInternational.d.ts +1 -0
  11. package/dist/components/SignIn/MobileNumberSignInternational.js +266 -0
  12. package/dist/components/SignIn/SignIn.lazy.d.ts +2 -0
  13. package/dist/components/SignIn/SignInForm.js +4 -2
  14. package/dist/components/SignUp/SignUp.d.ts +3 -1
  15. package/dist/components/SignUp/SignUp.js +14 -0
  16. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWin.lazy.d.ts +22 -0
  17. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWin.lazy.js +25 -0
  18. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinContext.d.ts +6 -0
  19. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinContext.js +2 -0
  20. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinForm.d.ts +1 -0
  21. package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinForm.js +282 -0
  22. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +2 -0
  23. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +2 -1
  24. package/dist/components/SignUp/SignUpDefault/SignUpDefaultFormInternational.d.ts +1 -0
  25. package/dist/components/SignUp/SignUpDefault/SignUpDefaultFormInternational.js +305 -0
  26. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingo.lazy.d.ts +23 -0
  27. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingo.lazy.js +26 -0
  28. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoContext.d.ts +6 -0
  29. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoContext.js +2 -0
  30. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoForm.d.ts +1 -0
  31. package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoForm.js +345 -0
  32. package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.d.ts +1 -1
  33. package/dist/constants/BranchCodes.d.ts +4 -0
  34. package/dist/constants/BranchCodes.js +38 -0
  35. package/dist/images/calendar-icon.webp +0 -0
  36. package/dist/utils/countries/countryCodeParser.d.ts +1 -0
  37. package/dist/utils/countries/countryCodeParser.js +9 -0
  38. package/dist/utils/countries/flags/AlgeriaFlag.d.ts +2 -0
  39. package/dist/utils/countries/flags/AlgeriaFlag.js +3 -0
  40. package/dist/utils/countries/flags/ArubaFlag.d.ts +2 -0
  41. package/dist/utils/countries/flags/ArubaFlag.js +2 -0
  42. package/dist/utils/countries/flags/AustraliaFlag.d.ts +2 -0
  43. package/dist/utils/countries/flags/AustraliaFlag.js +2 -0
  44. package/dist/utils/countries/flags/AustriaFlag.d.ts +2 -0
  45. package/dist/utils/countries/flags/AustriaFlag.js +2 -0
  46. package/dist/utils/countries/flags/BahrainFlag.d.ts +2 -0
  47. package/dist/utils/countries/flags/BahrainFlag.js +2 -0
  48. package/dist/utils/countries/flags/BelgiumFlag.d.ts +2 -0
  49. package/dist/utils/countries/flags/BelgiumFlag.js +2 -0
  50. package/dist/utils/countries/flags/BrazilFlag.d.ts +2 -0
  51. package/dist/utils/countries/flags/BrazilFlag.js +2 -0
  52. package/dist/utils/countries/flags/BruneiFlag.d.ts +2 -0
  53. package/dist/utils/countries/flags/BruneiFlag.js +2 -0
  54. package/dist/utils/countries/flags/CambodiaFlag.d.ts +2 -0
  55. package/dist/utils/countries/flags/CambodiaFlag.js +2 -0
  56. package/dist/utils/countries/flags/CanadaFlag.d.ts +2 -0
  57. package/dist/utils/countries/flags/CanadaFlag.js +2 -0
  58. package/dist/utils/countries/flags/CroatiaFlag.d.ts +2 -0
  59. package/dist/utils/countries/flags/CroatiaFlag.js +2 -0
  60. package/dist/utils/countries/flags/CyprusFlag.d.ts +2 -0
  61. package/dist/utils/countries/flags/CyprusFlag.js +2 -0
  62. package/dist/utils/countries/flags/EgyptFlag.d.ts +2 -0
  63. package/dist/utils/countries/flags/EgyptFlag.js +2 -0
  64. package/dist/utils/countries/flags/FinlandFlag.d.ts +2 -0
  65. package/dist/utils/countries/flags/FinlandFlag.js +2 -0
  66. package/dist/utils/countries/flags/FranceFlag.d.ts +2 -0
  67. package/dist/utils/countries/flags/FranceFlag.js +2 -0
  68. package/dist/utils/countries/flags/GermanyFlag.d.ts +2 -0
  69. package/dist/utils/countries/flags/GermanyFlag.js +2 -0
  70. package/dist/utils/countries/flags/GreeceFlag.d.ts +2 -0
  71. package/dist/utils/countries/flags/GreeceFlag.js +2 -0
  72. package/dist/utils/countries/flags/GuamFlag.d.ts +2 -0
  73. package/dist/utils/countries/flags/GuamFlag.js +2 -0
  74. package/dist/utils/countries/flags/HongKongFlag.d.ts +2 -0
  75. package/dist/utils/countries/flags/HongKongFlag.js +2 -0
  76. package/dist/utils/countries/flags/HungaryFlag.d.ts +2 -0
  77. package/dist/utils/countries/flags/HungaryFlag.js +2 -0
  78. package/dist/utils/countries/flags/IndianFlag.d.ts +2 -0
  79. package/dist/utils/countries/flags/IndianFlag.js +2 -0
  80. package/dist/utils/countries/flags/IndonesianFlag.d.ts +2 -0
  81. package/dist/utils/countries/flags/IndonesianFlag.js +2 -0
  82. package/dist/utils/countries/flags/IraqFlag.d.ts +2 -0
  83. package/dist/utils/countries/flags/IraqFlag.js +2 -0
  84. package/dist/utils/countries/flags/IrelandFlag.d.ts +2 -0
  85. package/dist/utils/countries/flags/IrelandFlag.js +2 -0
  86. package/dist/utils/countries/flags/IsraelFlag.d.ts +2 -0
  87. package/dist/utils/countries/flags/IsraelFlag.js +2 -0
  88. package/dist/utils/countries/flags/ItalyFlag.d.ts +2 -0
  89. package/dist/utils/countries/flags/ItalyFlag.js +2 -0
  90. package/dist/utils/countries/flags/JapanFlag.d.ts +2 -0
  91. package/dist/utils/countries/flags/JapanFlag.js +2 -0
  92. package/dist/utils/countries/flags/JordanFlag.d.ts +2 -0
  93. package/dist/utils/countries/flags/JordanFlag.js +2 -0
  94. package/dist/utils/countries/flags/KuwaitFlag.d.ts +2 -0
  95. package/dist/utils/countries/flags/KuwaitFlag.js +2 -0
  96. package/dist/utils/countries/flags/LatviaFlag.d.ts +2 -0
  97. package/dist/utils/countries/flags/LatviaFlag.js +2 -0
  98. package/dist/utils/countries/flags/LebanonFlag.d.ts +2 -0
  99. package/dist/utils/countries/flags/LebanonFlag.js +2 -0
  100. package/dist/utils/countries/flags/LithuaniaFlag.d.ts +2 -0
  101. package/dist/utils/countries/flags/LithuaniaFlag.js +2 -0
  102. package/dist/utils/countries/flags/LuxembourgFlag.d.ts +2 -0
  103. package/dist/utils/countries/flags/LuxembourgFlag.js +2 -0
  104. package/dist/utils/countries/flags/MacauFlag.d.ts +2 -0
  105. package/dist/utils/countries/flags/MacauFlag.js +2 -0
  106. package/dist/utils/countries/flags/MalaysianFlag.d.ts +2 -0
  107. package/dist/utils/countries/flags/MalaysianFlag.js +2 -0
  108. package/dist/utils/countries/flags/MaltaFlag.d.ts +2 -0
  109. package/dist/utils/countries/flags/MaltaFlag.js +2 -0
  110. package/dist/utils/countries/flags/NetherlandsFlag.d.ts +2 -0
  111. package/dist/utils/countries/flags/NetherlandsFlag.js +2 -0
  112. package/dist/utils/countries/flags/NewZealandFlag.d.ts +2 -0
  113. package/dist/utils/countries/flags/NewZealandFlag.js +2 -0
  114. package/dist/utils/countries/flags/NorthernMarianaIslandsFlag.d.ts +2 -0
  115. package/dist/utils/countries/flags/NorthernMarianaIslandsFlag.js +2 -0
  116. package/dist/utils/countries/flags/NorwayFlag.d.ts +2 -0
  117. package/dist/utils/countries/flags/NorwayFlag.js +2 -0
  118. package/dist/utils/countries/flags/OmanFlag.d.ts +2 -0
  119. package/dist/utils/countries/flags/OmanFlag.js +2 -0
  120. package/dist/utils/countries/flags/PhilippineFlag.d.ts +2 -0
  121. package/dist/utils/countries/flags/PhilippineFlag.js +2 -0
  122. package/dist/utils/countries/flags/PolandFlag.d.ts +2 -0
  123. package/dist/utils/countries/flags/PolandFlag.js +2 -0
  124. package/dist/utils/countries/flags/PortugalFlag.d.ts +2 -0
  125. package/dist/utils/countries/flags/PortugalFlag.js +2 -0
  126. package/dist/utils/countries/flags/QatarFlag.d.ts +2 -0
  127. package/dist/utils/countries/flags/QatarFlag.js +2 -0
  128. package/dist/utils/countries/flags/RomaniaFlag.d.ts +2 -0
  129. package/dist/utils/countries/flags/RomaniaFlag.js +2 -0
  130. package/dist/utils/countries/flags/SaoTomeAndPrincipeFlag.d.ts +2 -0
  131. package/dist/utils/countries/flags/SaoTomeAndPrincipeFlag.js +2 -0
  132. package/dist/utils/countries/flags/SaudiArabiaFlag.d.ts +2 -0
  133. package/dist/utils/countries/flags/SaudiArabiaFlag.js +2 -0
  134. package/dist/utils/countries/flags/SingaporeFlag.d.ts +2 -0
  135. package/dist/utils/countries/flags/SingaporeFlag.js +2 -0
  136. package/dist/utils/countries/flags/SlovakiaFlag.d.ts +2 -0
  137. package/dist/utils/countries/flags/SlovakiaFlag.js +2 -0
  138. package/dist/utils/countries/flags/SouthKoreaFlag.d.ts +2 -0
  139. package/dist/utils/countries/flags/SouthKoreaFlag.js +2 -0
  140. package/dist/utils/countries/flags/SpainFlag.d.ts +2 -0
  141. package/dist/utils/countries/flags/SpainFlag.js +2 -0
  142. package/dist/utils/countries/flags/SwedenFlag.d.ts +2 -0
  143. package/dist/utils/countries/flags/SwedenFlag.js +2 -0
  144. package/dist/utils/countries/flags/SwitzerlandFlag.d.ts +2 -0
  145. package/dist/utils/countries/flags/SwitzerlandFlag.js +2 -0
  146. package/dist/utils/countries/flags/TaiwanFlag.d.ts +2 -0
  147. package/dist/utils/countries/flags/TaiwanFlag.js +2 -0
  148. package/dist/utils/countries/flags/TanzaniaFlag.d.ts +2 -0
  149. package/dist/utils/countries/flags/TanzaniaFlag.js +2 -0
  150. package/dist/utils/countries/flags/TrinidadAndTobagoFlag.d.ts +2 -0
  151. package/dist/utils/countries/flags/TrinidadAndTobagoFlag.js +2 -0
  152. package/dist/utils/countries/flags/TurkiyeFlag.d.ts +2 -0
  153. package/dist/utils/countries/flags/TurkiyeFlag.js +2 -0
  154. package/dist/utils/countries/flags/UnitedArabEmiratesFlag.d.ts +2 -0
  155. package/dist/utils/countries/flags/UnitedArabEmiratesFlag.js +2 -0
  156. package/dist/utils/countries/flags/UnitedKingdomFlag.d.ts +2 -0
  157. package/dist/utils/countries/flags/UnitedKingdomFlag.js +2 -0
  158. package/dist/utils/countries/flags/UnitedStatesFlag.d.ts +2 -0
  159. package/dist/utils/countries/flags/UnitedStatesFlag.js +2 -0
  160. package/dist/utils/countries/flags/UzbekistanFlag.d.ts +2 -0
  161. package/dist/utils/countries/flags/UzbekistanFlag.js +2 -0
  162. package/dist/utils/countries/flags/VietnameseFlag.d.ts +2 -0
  163. package/dist/utils/countries/flags/VietnameseFlag.js +2 -0
  164. package/dist/utils/countries/flags/index.d.ts +63 -0
  165. package/dist/utils/countries/flags/index.js +63 -0
  166. package/dist/utils/countries/getAllCountries.d.ts +24 -0
  167. package/dist/utils/countries/getAllCountries.js +296 -0
  168. package/dist/utils/countries/getLocaleInfo.d.ts +2 -0
  169. package/dist/utils/countries/getLocaleInfo.js +1154 -0
  170. package/dist/utils/countries/types.d.ts +79 -0
  171. package/dist/utils/countries/types.js +1 -0
  172. package/dist/utils/sanitizeGamesSearch.d.ts +1 -0
  173. package/dist/utils/sanitizeGamesSearch.js +9 -0
  174. package/package.json +1 -1
@@ -0,0 +1,282 @@
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 { zodResolver } from '@hookform/resolvers/zod';
5
+ import { ObjectId } from '@opexa/object-id';
6
+ import { differenceInYears, format } from 'date-fns';
7
+ import Image from 'next/image';
8
+ import { useRouter } from 'next/navigation';
9
+ import { Controller, useForm } from 'react-hook-form';
10
+ import { twMerge } from 'tailwind-merge';
11
+ import { z } from 'zod';
12
+ import { useShallow } from 'zustand/shallow';
13
+ import { useControllableState } from '../../../client/hooks/useControllableState.js';
14
+ import { useCooldown } from '../../../client/hooks/useCooldown.js';
15
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
16
+ import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
17
+ import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberParser.js';
18
+ import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
19
+ import { useSignUpMutation } from '../../../client/hooks/useSignUpMutation.js';
20
+ import { toaster } from '../../../client/utils/toaster.js';
21
+ import { SHARED_BRANCH_CODES } from '../../../constants/BranchCodes.js';
22
+ import { CalendarIcon } from '../../../icons/CalendarIcon.js';
23
+ import { CheckIcon } from '../../../icons/CheckIcon.js';
24
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
25
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
26
+ import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
27
+ import calendarIcon from '../../../images/calendar-icon.webp';
28
+ import { ObjectType } from '../../../services/ObjectType.js';
29
+ import { Button } from '../../../ui/Button/index.js';
30
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
31
+ import { DatePicker } from '../../../ui/DatePicker/index.js';
32
+ import { Field } from '../../../ui/Field/index.js';
33
+ import { Select } from '../../../ui/Select/index.js';
34
+ import { Tooltip } from '../../../ui/Tooltip/index.js';
35
+ import { useSignUpCrazyWinPropsContext } from './SignUpCrazyWinContext.js';
36
+ export function SignUpCrazyWinForm() {
37
+ const signUpProps = useSignUpCrazyWinPropsContext();
38
+ const signUpMutation = useSignUpMutation();
39
+ const branchCollection = createListCollection({
40
+ items: SHARED_BRANCH_CODES,
41
+ itemToValue: (item) => item.code,
42
+ itemToString: (item) => item.name,
43
+ });
44
+ const router = useRouter();
45
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
46
+ kycReminder: ctx.kycReminder,
47
+ signIn: ctx.signIn,
48
+ signUp: ctx.signUp,
49
+ termsAndConditions: ctx.termsAndConditions,
50
+ responsibleGaming: ctx.responsibleGaming,
51
+ kyc: ctx.kyc,
52
+ })));
53
+ const mobileNumberParser = useMobileNumberParser();
54
+ const definition = z.object({
55
+ mobileNumber: z
56
+ .string()
57
+ .min(1, 'Mobile number is required')
58
+ .superRefine((v, ctx) => {
59
+ if (!mobileNumberParser.validate(v)) {
60
+ ctx.addIssue({
61
+ code: z.ZodIssueCode.custom,
62
+ message: 'Invalid mobile number',
63
+ });
64
+ }
65
+ }),
66
+ firstName: z
67
+ .string()
68
+ .regex(/^[a-z ]+$/gi, 'First name must contain only letters')
69
+ .transform((val) => val.trim())
70
+ .refine((val) => val.length >= 2, {
71
+ message: 'First name must be 2 or more characters',
72
+ })
73
+ .refine((val) => val.length <= 50, {
74
+ message: 'First name must not be more than 50 characters',
75
+ }),
76
+ lastName: z
77
+ .string()
78
+ .regex(/^[a-z ]+$/gi, 'Last name must contain only letters')
79
+ .transform((val) => val.trim())
80
+ .refine((val) => val.length >= 2, {
81
+ message: 'Last name must be 2 or more characters',
82
+ })
83
+ .refine((val) => val.length <= 50, {
84
+ message: 'Last name must not be more than 50 characters',
85
+ }),
86
+ birthDay: z
87
+ .date({
88
+ invalid_type_error: 'Date of birth is required',
89
+ required_error: 'Date of birth is required',
90
+ })
91
+ .superRefine((val, ctx) => {
92
+ const now = new Date();
93
+ const age = differenceInYears(now, val);
94
+ if (age < 21) {
95
+ return ctx.addIssue({
96
+ code: z.ZodIssueCode.custom,
97
+ message: 'You must be at least 21 years old',
98
+ });
99
+ }
100
+ }),
101
+ branchCode: z.string().min(1, 'Branch is required').trim(),
102
+ verificationCode: z.string().regex(/^\d{4,6}$/, 'Invalid OTP'),
103
+ termsAccepted: z.boolean().superRefine((v, ctx) => {
104
+ if (!v) {
105
+ ctx.addIssue({
106
+ code: z.ZodIssueCode.custom,
107
+ message: 'You must accept the terms and conditions',
108
+ });
109
+ }
110
+ }),
111
+ });
112
+ const form = useForm({
113
+ mode: 'all',
114
+ resolver: zodResolver(definition),
115
+ defaultValues: {
116
+ firstName: '',
117
+ lastName: '',
118
+ branchCode: '',
119
+ termsAccepted: globalStore.responsibleGaming.accepted &&
120
+ globalStore.termsAndConditions.accepted
121
+ ? true
122
+ : false,
123
+ },
124
+ });
125
+ const localeInfo = useLocaleInfo();
126
+ const cooldown = useCooldown({
127
+ max: 60,
128
+ duration: 1000 * 60,
129
+ });
130
+ const sendVerificationCodeMutation = useSendVerificationCodeMutation({
131
+ onSuccess: () => {
132
+ cooldown.start();
133
+ },
134
+ onError: (err) => {
135
+ toaster.error({
136
+ title: 'Sign In Failed',
137
+ description: err.message,
138
+ });
139
+ },
140
+ });
141
+ const commonInputClass = 'h-10 w-full rounded-full border-none bg-black/40 text-xs placeholder:text-text-placeholder focus:outline-none focus:ring-0';
142
+ return (_jsxs("div", { className: "scrollbar-gray-hover h-full flex-1 gap-6 overflow-y-auto px-6 pt-4 pb-[1.625rem] md:pt-11", children: [_jsx("h2", { className: "bg-[linear-gradient(50deg,_#c7802d_-5.1%,_#ffe585_44.95%,_#c7802d_109.05%)] bg-clip-text text-center font-semibold text-2xl text-transparent uppercase", children: "Register" }), _jsxs("form", { autoComplete: "off", onSubmit: form.handleSubmit(async (data) => {
143
+ const id = ObjectId.generate(ObjectType.MemberAccount).toString();
144
+ try {
145
+ await signUpMutation.mutateAsync({
146
+ id,
147
+ realName: `${data.firstName} ${data.lastName}`,
148
+ birthDay: format(data.birthDay, 'yyyy-MM-dd'),
149
+ branchCode: data.branchCode,
150
+ mobileNumber: mobileNumberParser.format(data.mobileNumber),
151
+ verificationCode: data.verificationCode,
152
+ });
153
+ globalStore.signUp.setOpen(false);
154
+ form.reset();
155
+ globalStore.signIn.setOpen(true);
156
+ }
157
+ catch (error) {
158
+ toaster.error({
159
+ description: error instanceof Error ? error.message : 'Something went wrong',
160
+ });
161
+ }
162
+ }), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { className: "text-xs", children: "Phone Number" }), _jsxs("div", { className: "relative flex h-10 gap-3", children: [_jsxs("div", { className: "flex h-full items-center gap-2 rounded-full bg-black/40 px-3.5 text-xs", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { className: commonInputClass, placeholder: "Enter Phone Number", ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { className: "text-xs", children: "First Name" }), _jsx(Field.Input, { className: commonInputClass, placeholder: "Enter your first name", ...form.register('firstName') }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { className: "text-xs", children: "Last Name" }), _jsx(Field.Input, { className: commonInputClass, placeholder: "Enter your last name", ...form.register('lastName') }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: form.watch('birthDay'), onChange: (value) => {
163
+ if (!value)
164
+ return;
165
+ form.setValue('birthDay', value, {
166
+ shouldDirty: true,
167
+ shouldTouch: true,
168
+ shouldValidate: true,
169
+ });
170
+ }, onBlur: () => form.trigger('birthDay') }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.birthDay?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.branchCode, className: "mt-xl", children: [_jsxs(Select.Root, { value: [form.watch('branchCode') ?? ''], onValueChange: (details) => {
171
+ form.setValue('branchCode', details.value?.[0], {
172
+ shouldDirty: true,
173
+ shouldTouch: true,
174
+ shouldValidate: true,
175
+ });
176
+ }, collection: branchCollection, positioning: {
177
+ sameWidth: true,
178
+ placement: 'bottom',
179
+ }, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1 text-xs", children: ["Branch Code", _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: {
180
+ placement: 'top',
181
+ }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsx(Select.Trigger, { className: twMerge('h-10 rounded-full border-none bg-black/40 px-4 text-xs'), children: form.watch('branchCode') ? (_jsx(Select.ValueText, {})) : (_jsx("span", { className: "text-text-placeholder", children: "Select Branch Code" })) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: SHARED_BRANCH_CODES.map((item) => {
182
+ return (_jsx(Select.Item, { item: item, children: _jsx("div", { title: item.name, className: "line-clamp-1", children: item.name }) }, item.code));
183
+ }) }) })] }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.branchCode?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { className: "text-xs", children: "OTP Code" }), _jsxs("div", { className: "relative flex", children: [_jsx(Field.Input, { className: commonInputClass, placeholder: "Enter OTP code", ...form.register('verificationCode') }), _jsx("button", { type: "button", className: "-translate-y-1/2 absolute top-1/2 right-1 inline-flex h-fit w-fit items-center justify-center gap-2 rounded-full bg-[linear-gradient(89deg,#c7802d_-15.91%,#ffe585_28.75%,#ffeca6_49.46%,#c7802d_112.69%)] px-3.5 py-[0.375rem] font-semibold text-[#6c5200] text-sm shadow-[0px_-1px_2px_1px_#fff7e1_inset] [text-shadow:0px_1px_0px_rgba(255,255,255,0.9)] active:bg-[linear-gradient(89.27deg,#c7802d_-33.65%,#ffe585_12.75%,#ffeca6_80.96%,#c7802d_128.79%)] disabled:cursor-not-allowed disabled:opacity-50", style: {
184
+ boxShadow: 'inset 0px -1px 2px 1px #fff7e1',
185
+ backgroundImage: 'linear-gradient(89deg, #c7802d -15.91%, #ffe585 28.75%, #ffeca6 49.46%, #c7802d 112.69%)',
186
+ }, disabled: cooldown.cooling ||
187
+ !form.getValues('mobileNumber') ||
188
+ !mobileNumberParser.validate(form.getValues('mobileNumber')), onClick: async () => {
189
+ await sendVerificationCodeMutation.mutateAsync({
190
+ channel: 'SMS',
191
+ recipient: mobileNumberParser.format(form.getValues('mobileNumber')),
192
+ });
193
+ cooldown.start();
194
+ }, children: cooldown.cooling ? `${cooldown.countdown}s` : 'Get OTP' })] }), _jsx(Field.ErrorText, { className: "text</button>-[#ff2525b3] text-xs", children: form.formState.errors.verificationCode?.message })] }), _jsxs("div", { className: "mt-4 flex gap-4.5 md:mt-7.5", children: [_jsx(Button, { type: "button", onClick: () => form.reset(), className: "flex h-10 w-full items-center justify-center gap-2 rounded-full border border-[#ffe5af] bg-[radial-gradient(365.61%_103.33%_at_54.76%_0%,#656564_0%,#031d18_22.17%,#031d19_78.16%,#4a4a45_98.9%)] px-3.5 font-semibold text-[#ffe5af] text-sm shadow-[0px_3px_6px_0px_rgba(255,228,183,0.3)] active:bg-[radial-gradient(365.61%_103.33%_at_54.76%_0%,#656564_0%,#282433_22.17%,#282433_78.16%,#4a4a45_98.9%)] disabled:cursor-not-allowed disabled:opacity-50", children: "Reset" }), _jsx(Button, { className: "h-10 rounded-full text-sm", type: "submit", disabled: form.formState.isSubmitting, style: {
195
+ boxShadow: 'inset 0px -1px 2px 1px #fff7e1',
196
+ backgroundImage: 'linear-gradient(89deg, #c7802d -15.91%, #ffe585 28.75%, #ffeca6 49.46%, #c7802d 112.69%)',
197
+ }, children: "Continue" })] }), _jsx(Controller, { control: form.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) => {
198
+ if (details.checked === 'indeterminate')
199
+ return;
200
+ o.field.onChange(details.checked);
201
+ globalStore.termsAndConditions.setAccepted(details.checked);
202
+ globalStore.responsibleGaming.setAccepted(details.checked);
203
+ }, children: [_jsx(Checkbox.Control, { className: "border-none bg-white", children: _jsx(Checkbox.Indicator, { asChild: true, className: "bg-white", children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { className: "text-white/60 text-xs", children: ["I confirm that I am at least 21 years old, not listed in the PAGCOR NDRP, not a GEL license holder, government employee, or member of the Armed Forces of the Philippines. I am not playing in a public space and agree to", ' ', _jsx("button", { type: "button", className: "font-semibold text-[#FFE595]", onClick: () => {
204
+ if (signUpProps.termsAndConditionsUrl) {
205
+ globalStore.signUp.setOpen(false);
206
+ router.push(signUpProps.termsAndConditionsUrl);
207
+ }
208
+ else {
209
+ globalStore.termsAndConditions.setOpen(true);
210
+ globalStore.termsAndConditions.setNext('SIGN_UP');
211
+ globalStore.signUp.setOpen(false);
212
+ }
213
+ }, children: "Terms of Use" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "font-semibold text-[#FFE595]", onClick: () => {
214
+ if (signUpProps.responsibleGamingUrl) {
215
+ globalStore.signUp.setOpen(false);
216
+ router.push(signUpProps.responsibleGamingUrl);
217
+ }
218
+ else {
219
+ globalStore.responsibleGaming.setOpen(true);
220
+ globalStore.responsibleGaming.setNext('SIGN_UP');
221
+ globalStore.signUp.setOpen(false);
222
+ }
223
+ }, children: "Privacy Policy" }), ' ', ". Ineligible accounts will have their funds forfeited to the government."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-[#ff2525b3] text-xs", children: o.fieldState.error?.message })] })) }), _jsxs("div", { className: "mx-auto mt-3 max-w-[18.75rem] text-2xs text-white/35", children: ["This site is protected by reCAPTCHA and the Google", ' ', _jsx("a", { href: "https://policies.google.com/privacy", target: "_blank", rel: "noreferrer noopener", className: "font-semibold underline underline-offset-2", children: "Privacy Policy" }), ' ', "and", ' ', _jsx("a", { href: "https://policies.google.com/terms", target: "_blank", rel: "noreferrer noopener", className: "font-semibold underline underline-offset-2", children: "Terms of Service" }), ' ', "apply."] })] })] }));
224
+ }
225
+ const DEVICE_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
226
+ function DateOfBirthField(props) {
227
+ const [value, setValue] = useControllableState({
228
+ value: props.value,
229
+ defaultValue: props.defaultValue ?? null,
230
+ onChange: props.onChange,
231
+ });
232
+ // Custom input handler to automatically add slashes
233
+ const handleInput = (e) => {
234
+ const input = e.currentTarget;
235
+ const oldValue = input.value;
236
+ const oldCursorPosition = input.selectionStart ?? 0;
237
+ // Get digits only from the current input value string
238
+ const digitsOnly = input.value.replace(/\D/g, '');
239
+ let formattedValue = '';
240
+ // Format MM/DD/YYYY
241
+ if (digitsOnly.length > 0) {
242
+ formattedValue += digitsOnly.substring(0, 2);
243
+ if (digitsOnly.length > 2) {
244
+ formattedValue += `/${digitsOnly.substring(2, 4)}`;
245
+ }
246
+ if (digitsOnly.length > 4) {
247
+ formattedValue += `/${digitsOnly.substring(4, 8)}`;
248
+ }
249
+ }
250
+ formattedValue = formattedValue.substring(0, 10); // Limit length
251
+ if (formattedValue !== oldValue) {
252
+ input.value = formattedValue;
253
+ let newCursorPosition = oldCursorPosition;
254
+ // Calculate the number of slashes before the old cursor position in the old value
255
+ const oldSlashesBeforeCursor = (oldValue.substring(0, oldCursorPosition).match(/\//g) || []).length;
256
+ // Calculate the number of slashes before the new cursor position in the new formatted value
257
+ // We take the substring of the new formatted value up to where the cursor *would* be based on the old digits
258
+ const digitsBeforeOldCursor = oldValue
259
+ .substring(0, oldCursorPosition)
260
+ .replace(/\D/g, '').length;
261
+ const newSlashesBeforeCursor = (formattedValue
262
+ .substring(0, digitsBeforeOldCursor + oldSlashesBeforeCursor)
263
+ .match(/\//g) || []).length;
264
+ // Adjust newCursorPosition based on the difference in slash count
265
+ newCursorPosition += newSlashesBeforeCursor - oldSlashesBeforeCursor;
266
+ // Ensure cursor stays within bounds
267
+ newCursorPosition = Math.min(newCursorPosition, formattedValue.length);
268
+ newCursorPosition = Math.max(0, newCursorPosition);
269
+ setTimeout(() => {
270
+ input.setSelectionRange(newCursorPosition, newCursorPosition);
271
+ }, 0);
272
+ }
273
+ };
274
+ 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) => {
275
+ const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
276
+ setValue(value ?? null);
277
+ }, children: [_jsx(DatePicker.Label, { className: "text-xs", children: "Date of Birth" }), _jsxs(DatePicker.Control, { className: "relative flex h-10 items-center rounded-full border-none bg-[#05121c] text-xs placeholder:text-text-placeholder focus:outline-none focus:ring-0", children: [_jsx(Image, { src: calendarIcon, alt: "calendar icon", width: 20, height: 20, className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 h-5 w-5" }), _jsx(DatePicker.Input, { className: "pl-10", onBlur: props.onBlur, onFocus: props.onFocus, onInput: handleInput }), _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
278
+ .getMonthsGrid({ columns: 4, format: 'short' })
279
+ .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
280
+ .getYearsGrid({ columns: 4 })
281
+ .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))) }) })] })) }) })] }) })] }));
282
+ }
@@ -1,6 +1,7 @@
1
1
  import { type ImageProps } from 'next/image';
2
2
  import { type ReactNode } from 'react';
3
3
  import type { Branch } from '../../../types';
4
+ import type { CountryCode } from '../../../utils/countries/types';
4
5
  export interface ClassNameEntries {
5
6
  root?: string;
6
7
  publicPlayProhibitionRoot?: string;
@@ -11,6 +12,7 @@ export interface SignUpDefaultProps {
11
12
  logo: ImageProps['src'];
12
13
  basicSignUp?: boolean;
13
14
  branches?: Branch[];
15
+ enabledCountries?: CountryCode[];
14
16
  termsAndConditionsUrl?: string;
15
17
  responsibleGamingUrl?: string;
16
18
  className?: ClassNameEntries;
@@ -10,6 +10,7 @@ import { Dialog } from '../../../ui/Dialog/index.js';
10
10
  import { Portal } from '../../../ui/Portal/index.js';
11
11
  import { SignUpDefaultPropsProvider } from './SignUpDefaultContext.js';
12
12
  import { SignUpDefaultForm } from './SignUpDefaultForm.js';
13
+ import { SignUpDefaultFormInternational } from './SignUpDefaultFormInternational.js';
13
14
  export function SignUpDefault(props) {
14
15
  const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
16
  const globalStore = useGlobalStore(useShallow((ctx) => ({
@@ -22,5 +23,5 @@ export function SignUpDefault(props) {
22
23
  // Reset checkbox state when dialog closes
23
24
  globalStore.termsAndConditions.setAccepted(false);
24
25
  globalStore.responsibleGaming.setAccepted(false);
25
- }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('mx-auto h-full w-full items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:h-auto lg:max-h-[80vh] lg:w-[400px] lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className?.root), style: { msOverflowStyle: 'none', scrollbarWidth: 'none' }, 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(SignUpDefaultForm, {}) })] }) })] }) }) }));
26
+ }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('mx-auto h-full w-full items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:h-auto lg:max-h-[80vh] lg:w-[400px] lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className?.root), style: { msOverflowStyle: 'none', scrollbarWidth: 'none' }, 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: props.enabledCountries ? (_jsx(SignUpDefaultFormInternational, {})) : (_jsx(SignUpDefaultForm, {})) })] }) })] }) }) }));
26
27
  }
@@ -0,0 +1 @@
1
+ export declare function SignUpDefaultFormInternational(): import("react/jsx-runtime").JSX.Element;