@opexa/portal-components 0.0.276 → 0.0.278

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/useGlobalStore.d.ts +16 -6
  2. package/dist/client/hooks/useGlobalStore.js +99 -0
  3. package/dist/client/hooks/useJackpotsQuery.js +1 -1
  4. package/dist/components/Disclaimer/Disclaimer.d.ts +3 -14
  5. package/dist/components/Disclaimer/Disclaimer.js +14 -5
  6. package/dist/components/Disclaimer/DisclaimerV1.d.ts +1 -1
  7. package/dist/components/Disclaimer/DisclaimerV1.js +1 -1
  8. package/dist/components/Disclaimer/DisclaimerV2.d.ts +3 -7
  9. package/dist/components/Disclaimer/DisclaimerV2.js +23 -51
  10. package/dist/components/Disclaimer/useDisclaimer.js +1 -1
  11. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +12 -1
  12. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +12 -1
  13. package/dist/components/ResponsibleGaming/ResponsibleGaming.d.ts +3 -0
  14. package/dist/components/ResponsibleGaming/ResponsibleGaming.js +14 -0
  15. package/dist/components/ResponsibleGaming/ResponsibleGaming.lazy.d.ts +8 -0
  16. package/dist/components/ResponsibleGaming/ResponsibleGaming.lazy.js +35 -0
  17. package/dist/components/ResponsibleGaming/index.d.ts +1 -0
  18. package/dist/components/ResponsibleGaming/index.js +1 -0
  19. package/dist/components/SignIn/MobileNumberSignIn.js +32 -26
  20. package/dist/components/SignIn/NameAndPasswordSignIn.js +31 -26
  21. package/dist/components/SignIn/SignIn.lazy.d.ts +4 -7
  22. package/dist/components/SignIn/SignIn.lazy.js +1 -0
  23. package/dist/components/SignUp/SignUp.d.ts +3 -3
  24. package/dist/components/SignUp/SignUp.js +7 -4
  25. package/dist/components/SignUp/{SignUpPagcor/SignUpPagcor.lazy.d.ts → SignUpDefault/SignUpDefault.lazy.d.ts} +7 -6
  26. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +18 -0
  27. package/dist/components/SignUp/SignUpDefault/SignUpDefaultContext.d.ts +6 -0
  28. package/dist/components/SignUp/SignUpDefault/SignUpDefaultContext.js +2 -0
  29. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.d.ts +1 -0
  30. package/dist/components/SignUp/{SignUpForm.js → SignUpDefault/SignUpDefaultForm.js} +89 -54
  31. package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.d.ts +5 -8
  32. package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +37 -31
  33. package/dist/components/TermsAndConditions/TermsAndConditions.d.ts +2 -0
  34. package/dist/components/TermsAndConditions/TermsAndConditions.js +14 -0
  35. package/dist/components/TermsAndConditions/TermsAndConditions.lazy.d.ts +9 -0
  36. package/dist/components/TermsAndConditions/TermsAndConditions.lazy.js +35 -0
  37. package/dist/components/TermsAndConditions/index.d.ts +1 -0
  38. package/dist/components/TermsAndConditions/index.js +1 -0
  39. package/dist/components/TermsOfUse/TermsOfUse.d.ts +3 -0
  40. package/dist/components/TermsOfUse/TermsOfUse.js +14 -0
  41. package/dist/components/TermsOfUse/TermsOfUse.lazy.d.ts +9 -0
  42. package/dist/components/TermsOfUse/TermsOfUse.lazy.js +35 -0
  43. package/dist/components/TermsOfUse/index.d.ts +1 -0
  44. package/dist/components/TermsOfUse/index.js +1 -0
  45. package/dist/constants/EnvVar.d.ts +1 -1
  46. package/dist/handlers/index.d.ts +2 -2
  47. package/dist/handlers/postTransformIdFrontImage.js +21 -6
  48. package/dist/handlers/postTransformSelfieImage.js +20 -9
  49. package/dist/next.config.js +1 -0
  50. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  51. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  52. package/dist/ui/Badge/Badge.d.ts +12 -12
  53. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  54. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  55. package/dist/ui/Carousel/Carousel.d.ts +72 -72
  56. package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
  57. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  58. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  59. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  60. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  61. package/dist/ui/Collapsible/Collapsible.d.ts +32 -32
  62. package/dist/ui/Collapsible/collapsible.recipe.d.ts +8 -8
  63. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  64. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  65. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  66. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  67. package/dist/ui/Dialog/Dialog.d.ts +88 -88
  68. package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
  69. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  70. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  71. package/dist/ui/Field/Field.d.ts +21 -21
  72. package/dist/ui/Field/field.recipe.d.ts +3 -3
  73. package/dist/ui/Menu/Menu.d.ts +306 -306
  74. package/dist/ui/Menu/menu.recipe.d.ts +17 -17
  75. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  76. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  77. package/dist/ui/Popover/Popover.d.ts +88 -88
  78. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  79. package/dist/ui/Progress/Progress.d.ts +27 -27
  80. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  81. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  82. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  83. package/dist/ui/Select/Select.d.ts +45 -45
  84. package/dist/ui/Select/select.recipe.d.ts +3 -3
  85. package/dist/ui/Table/Table.d.ts +21 -21
  86. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  87. package/dist/ui/Table/table.recipe.d.ts +3 -3
  88. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  89. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  90. package/package.json +3 -3
  91. package/dist/components/FeatureFlag/FeatureFlag.d.ts +0 -1
  92. package/dist/components/FeatureFlag/FeatureFlag.js +0 -29
  93. package/dist/components/FeatureFlag/index.d.ts +0 -1
  94. package/dist/components/FeatureFlag/index.js +0 -1
  95. package/dist/components/KYC/AutoOpen.d.ts +0 -1
  96. package/dist/components/KYC/AutoOpen.js +0 -40
  97. package/dist/components/KYC/backup/Header.d.ts +0 -1
  98. package/dist/components/KYC/backup/Header.js +0 -8
  99. package/dist/components/KYC/backup/Indicator.d.ts +0 -1
  100. package/dist/components/KYC/backup/Indicator.js +0 -9
  101. package/dist/components/KYC/backup/KYC.d.ts +0 -1
  102. package/dist/components/KYC/backup/KYC.js +0 -14
  103. package/dist/components/KYC/backup/KYC.lazy.d.ts +0 -1
  104. package/dist/components/KYC/backup/KYC.lazy.js +0 -26
  105. package/dist/components/KYC/backup/KYCContext.d.ts +0 -6
  106. package/dist/components/KYC/backup/KYCContext.js +0 -2
  107. package/dist/components/KYC/backup/Step1.d.ts +0 -1
  108. package/dist/components/KYC/backup/Step1.js +0 -13
  109. package/dist/components/KYC/backup/Step2.d.ts +0 -1
  110. package/dist/components/KYC/backup/Step2.js +0 -13
  111. package/dist/components/KYC/backup/Step3.d.ts +0 -1
  112. package/dist/components/KYC/backup/Step3.js +0 -13
  113. package/dist/components/KYC/backup/Step4.d.ts +0 -1
  114. package/dist/components/KYC/backup/Step4.js +0 -7
  115. package/dist/components/KYC/backup/useKYC.d.ts +0 -10
  116. package/dist/components/KYC/backup/useKYC.js +0 -8
  117. package/dist/components/KYC/loadModels.d.ts +0 -1
  118. package/dist/components/KYC/loadModels.js +0 -9
  119. package/dist/components/Messages/Message.d.ts +0 -1
  120. package/dist/components/Messages/Message.js +0 -35
  121. package/dist/components/Messages/MessageContext.d.ts +0 -6
  122. package/dist/components/Messages/MessageContext.js +0 -2
  123. package/dist/components/Messages/MessagePopup.d.ts +0 -1
  124. package/dist/components/Messages/MessagePopup.js +0 -20
  125. package/dist/components/Messages/MessageTrigger.d.ts +0 -8
  126. package/dist/components/Messages/MessageTrigger.js +0 -19
  127. package/dist/components/Quests/CountdownTimer.d.ts +0 -15
  128. package/dist/components/Quests/CountdownTimer.js +0 -33
  129. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +0 -4
  130. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +0 -78
  131. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +0 -8
  132. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +0 -9
  133. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +0 -4
  134. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +0 -4
  135. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +0 -4
  136. package/dist/components/Quests/WageringQuest/WageringQuest.js +0 -20
  137. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +0 -9
  138. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +0 -9
  139. package/dist/components/SignUp/SignUp.lazy.d.ts +0 -12
  140. package/dist/components/SignUp/SignUp.lazy.js +0 -18
  141. package/dist/components/SignUp/SignUpContext.d.ts +0 -6
  142. package/dist/components/SignUp/SignUpContext.js +0 -2
  143. package/dist/components/SignUp/SignUpForm.d.ts +0 -1
  144. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +0 -1
  145. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +0 -198
  146. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +0 -1
  147. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +0 -251
  148. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +0 -10
  149. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +0 -41
  150. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +0 -1
  151. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +0 -429
  152. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +0 -26
  153. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +0 -7
  154. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +0 -2
  155. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +0 -11
  156. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +0 -20
  157. package/dist/components/shared/IdDocumentField.client.d.ts +0 -25
  158. package/dist/components/shared/IdDocumentField.client.js +0 -204
  159. package/dist/components/shared/IdDocumentField.d.ts +0 -2
  160. package/dist/components/shared/IdDocumentField.js +0 -11
  161. package/dist/components/shared/SelfieField.client.d.ts +0 -20
  162. package/dist/components/shared/SelfieField.client.js +0 -327
  163. package/dist/components/shared/SelfieField.d.ts +0 -2
  164. package/dist/components/shared/SelfieField.js +0 -11
  165. package/dist/constants/BranchCode.d.ts +0 -4
  166. package/dist/constants/BranchCode.js +0 -42
  167. package/dist/handlers.d.ts +0 -43
  168. package/dist/handlers.js +0 -297
  169. package/dist/icons/BellRingIcon.d.ts +0 -2
  170. package/dist/icons/BellRingIcon.js +0 -4
  171. package/dist/utils/dataUrlToBlob.d.ts +0 -1
  172. package/dist/utils/dataUrlToBlob.js +0 -11
  173. package/dist/utils/resizeImageSize.d.ts +0 -2
  174. package/dist/utils/resizeImageSize.js +0 -11
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect, useRef, useState } from 'react';
3
+ import { useRouter } from 'next/navigation';
4
+ import { useRef } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import { z } from 'zod';
6
7
  import { useShallow } from 'zustand/shallow';
@@ -17,17 +18,18 @@ import { Button } from '../../ui/Button/index.js';
17
18
  import { Checkbox } from '../../ui/Checkbox/index.js';
18
19
  import { Field } from '../../ui/Field/index.js';
19
20
  import { PinInput } from '../../ui/PinInput/index.js';
20
- import { ResponsibleGaming } from '../Disclaimer/ResponsibleGaming.js';
21
- import { TermsOfUse } from '../Disclaimer/TermsOfUse.js';
22
21
  import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
23
22
  import { getFriendlyErrorMessage } from './utils.js';
24
23
  export function MobileNumberSignIn(props) {
25
24
  const signInProps = useSignInPropsContext();
25
+ const router = useRouter();
26
26
  const context = useSignInContext();
27
27
  const globalStore = useGlobalStore(useShallow((ctx) => ({
28
28
  signIn: ctx.signIn,
29
29
  signUp: ctx.signUp,
30
30
  kycReminder: ctx.kycReminder,
31
+ responsibleGaming: ctx.responsibleGaming,
32
+ termsAndConditions: ctx.termsAndConditions,
31
33
  })));
32
34
  const signInMutation = useSignInMutation({
33
35
  onSuccess: () => {
@@ -110,7 +112,10 @@ export function MobileNumberSignIn(props) {
110
112
  resolver: zodResolver(Step1Definition),
111
113
  defaultValues: {
112
114
  mobileNumber: '',
113
- termsAccepted: false,
115
+ termsAccepted: globalStore.responsibleGaming.accepted &&
116
+ globalStore.termsAndConditions.accepted
117
+ ? true
118
+ : false,
114
119
  },
115
120
  });
116
121
  const step2Form = useForm({
@@ -124,22 +129,7 @@ export function MobileNumberSignIn(props) {
124
129
  duration: 1000 * 60,
125
130
  });
126
131
  const form2Ref = useRef(null);
127
- const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
128
- const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
129
- const [isTermsOfUseAccepted, setIsTermsOfUseAccepted] = useState(false);
130
- const [isResponsibleGamingAccepted, setIsResponsibleGamingAccepted] = useState(false);
131
- useEffect(() => {
132
- if (isTermsOfUseAccepted && isResponsibleGamingAccepted) {
133
- step1Form.setValue('termsAccepted', true);
134
- }
135
- }, [isResponsibleGamingAccepted, isTermsOfUseAccepted, step1Form]);
136
- return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signInProps.termsOfUseContent ?? 'Terms of Use content', siteName: signInProps.siteName ?? 'Site', logo: signInProps.logo, open: isTermsOfUseOpen, onCloseAction: () => {
137
- setIsTermsOfUseAccepted(true);
138
- setTermsOfUseOpen(false);
139
- }, responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signInProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signInProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => {
140
- setIsResponsibleGamingAccepted(true);
141
- setResponsibleGamingOpen(false);
142
- }, responsibleGamingLogo: signInProps.responsibleGamingLogo }), context.step === 1 && (_jsxs(_Fragment, { children: [_jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
132
+ return (_jsxs(_Fragment, { children: [context.step === 1 && (_jsxs(_Fragment, { children: [_jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
143
133
  sendVerificationCodeMutation.mutate({
144
134
  channel: 'SMS',
145
135
  recipient: mobileNumberParser.format(data.mobileNumber),
@@ -148,15 +138,31 @@ export function MobileNumberSignIn(props) {
148
138
  }), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, 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: {
149
139
  paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
150
140
  }, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Log In" }), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
141
+ if (details.checked === 'indeterminate')
142
+ return;
151
143
  o.field.onChange(details.checked);
152
- if (!details.checked) {
153
- setIsTermsOfUseAccepted(false);
154
- setIsResponsibleGamingAccepted(false);
155
- }
144
+ globalStore.termsAndConditions.setAccepted(details.checked);
145
+ globalStore.responsibleGaming.setAccepted(details.checked);
156
146
  }, 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: () => {
157
- setTermsOfUseOpen(true);
147
+ if (signInProps.termsAndConditionsUrl) {
148
+ globalStore.signIn.setOpen(false);
149
+ router.push(signInProps.termsAndConditionsUrl);
150
+ }
151
+ else {
152
+ globalStore.termsAndConditions.setOpen(true);
153
+ globalStore.termsAndConditions.setNext('SIGN_IN');
154
+ globalStore.signIn.setOpen(false);
155
+ }
158
156
  }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
159
- setResponsibleGamingOpen(true);
157
+ if (signInProps.responsibleGamingUrl) {
158
+ globalStore.signIn.setOpen(false);
159
+ router.push(signInProps.responsibleGamingUrl);
160
+ }
161
+ else {
162
+ globalStore.responsibleGaming.setOpen(true);
163
+ globalStore.responsibleGaming.setNext('SIGN_IN');
164
+ globalStore.signIn.setOpen(false);
165
+ }
160
166
  }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), _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: "Don't have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
161
167
  globalStore.signIn.setOpen(false);
162
168
  globalStore.signUp.setOpen(true);
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useDialogContext } from '@ark-ui/react/dialog';
3
3
  import { zodResolver } from '@hookform/resolvers/zod';
4
- import { useEffect, useState } from 'react';
4
+ import { useRouter } from 'next/navigation';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import { z } from 'zod';
7
7
  import { useShallow } from 'zustand/shallow';
@@ -17,19 +17,20 @@ import { Button } from '../../ui/Button/index.js';
17
17
  import { Checkbox } from '../../ui/Checkbox/index.js';
18
18
  import { Field } from '../../ui/Field/index.js';
19
19
  import { PasswordInput } from '../../ui/PasswordInput/index.js';
20
- import { ResponsibleGaming } from '../Disclaimer/ResponsibleGaming.js';
21
- import { TermsOfUse } from '../Disclaimer/TermsOfUse.js';
22
20
  import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
23
21
  import { getFriendlyErrorMessage } from './utils.js';
24
22
  export function NameAndPasswordSignIn(props) {
25
23
  const signInProps = useSignInPropsContext();
26
24
  const context = useSignInContext();
25
+ const router = useRouter();
27
26
  const dialog = useDialogContext();
28
27
  const globalStore = useGlobalStore(useShallow((ctx) => ({
29
28
  signIn: ctx.signIn,
30
29
  signUp: ctx.signUp,
31
30
  kycReminder: ctx.kycReminder,
32
31
  forgotPassword: ctx.forgotPassword,
32
+ termsAndConditions: ctx.termsAndConditions,
33
+ responsibleGaming: ctx.responsibleGaming,
33
34
  })));
34
35
  const signInMutation = useSignInMutation({
35
36
  onSuccess(authenticator) {
@@ -100,7 +101,10 @@ export function NameAndPasswordSignIn(props) {
100
101
  name: '',
101
102
  password: '',
102
103
  secretAnswer: '',
103
- termsAccepted: false,
104
+ termsAccepted: globalStore.responsibleGaming.accepted &&
105
+ globalStore.termsAndConditions.accepted
106
+ ? true
107
+ : false,
104
108
  },
105
109
  });
106
110
  const secretQuestion = signInMutation.data
@@ -113,22 +117,7 @@ export function NameAndPasswordSignIn(props) {
113
117
  ])
114
118
  .parse(signInMutation.data.secretQuestion)
115
119
  : null;
116
- const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
117
- const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
118
- const [isTermsOfUseAccepted, setIsTermsOfUseAccepted] = useState(false);
119
- const [isResponsibleGamingAccepted, setIsResponsibleGamingAccepted] = useState(false);
120
- useEffect(() => {
121
- if (isTermsOfUseAccepted && isResponsibleGamingAccepted) {
122
- form.setValue('termsAccepted', true);
123
- }
124
- }, [isResponsibleGamingAccepted, isTermsOfUseAccepted, form]);
125
- return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signInProps.termsOfUseContent ?? 'Terms of Use content', siteName: signInProps.siteName ?? 'Site', logo: signInProps.logo, open: isTermsOfUseOpen, onCloseAction: () => {
126
- setIsTermsOfUseAccepted(true);
127
- setTermsOfUseOpen(false);
128
- }, responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signInProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signInProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => {
129
- setIsResponsibleGamingAccepted(true);
130
- setResponsibleGamingOpen(false);
131
- }, responsibleGamingLogo: signInProps.responsibleGamingLogo }), _jsxs("form", { className: "mt-3xl", onSubmit: form.handleSubmit((data) => {
120
+ return (_jsxs(_Fragment, { children: [_jsxs("form", { className: "mt-3xl", onSubmit: form.handleSubmit((data) => {
132
121
  if (!signInMutation.data) {
133
122
  signInMutation.mutate({
134
123
  type: 'NAME_AND_PASSWORD',
@@ -152,15 +141,31 @@ export function NameAndPasswordSignIn(props) {
152
141
  globalStore.forgotPassword.setOpen(true);
153
142
  dialog.setOpen(false);
154
143
  }, children: "Forgot Password" }) })] }) }), signInMutation.data && (_jsxs(Field.Root, { invalid: !!form.formState.errors.secretAnswer, className: "mt-xl", children: [_jsx(Field.Label, { children: secretQuestion }), _jsx(Field.Input, { placeholder: "Answer the security question", ...form.register('secretAnswer') }), _jsx(Field.ErrorText, { children: form.formState.errors.secretAnswer?.message })] })), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: signInMutation.isPending || authenticateMutation.isPending, children: "Log In" }), _jsx(Controller, { control: form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-xl", children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
144
+ if (details.checked === 'indeterminate')
145
+ return;
155
146
  o.field.onChange(details.checked);
156
- if (!details.checked) {
157
- setIsTermsOfUseAccepted(false);
158
- setIsResponsibleGamingAccepted(false);
159
- }
147
+ globalStore.termsAndConditions.setAccepted(details.checked);
148
+ globalStore.responsibleGaming.setAccepted(details.checked);
160
149
  }, 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: () => {
161
- setTermsOfUseOpen(true);
150
+ if (signInProps.termsAndConditionsUrl) {
151
+ globalStore.signIn.setOpen(true);
152
+ router.push(signInProps.termsAndConditionsUrl);
153
+ }
154
+ else {
155
+ globalStore.termsAndConditions.setOpen(true);
156
+ globalStore.termsAndConditions.setNext('SIGN_IN');
157
+ globalStore.signIn.setOpen(false);
158
+ }
162
159
  }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
163
- setResponsibleGamingOpen(true);
160
+ if (signInProps.responsibleGamingUrl) {
161
+ globalStore.signIn.setOpen(false);
162
+ router.push(signInProps.responsibleGamingUrl);
163
+ }
164
+ else {
165
+ globalStore.responsibleGaming.setOpen(true);
166
+ globalStore.responsibleGaming.setNext('SIGN_IN');
167
+ globalStore.signIn.setOpen(false);
168
+ }
164
169
  }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), _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: "Don't have an account?" }), _jsx("button", { type: "submit", className: "text-button-tertiary-fg font-semibold", onClick: () => {
165
170
  dialog.setOpen(false);
166
171
  globalStore.signUp.setOpen(true);
@@ -1,14 +1,11 @@
1
1
  import { type ImageProps } from 'next/image';
2
- import type { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  export interface SignInProps {
4
4
  logo: ImageProps['src'];
5
- className?: string;
6
- /** @default '/terms-and-conditions' */
5
+ siteName?: string;
7
6
  termsAndConditionsUrl?: string;
8
- termsOfUseContent?: ReactNode;
9
- responsibleGamingContent?: ReactNode;
10
- responsibleGamingLogo?: ImageProps['src'];
7
+ responsibleGamingUrl?: string;
8
+ className?: string;
11
9
  children?: ReactNode;
12
- siteName?: string;
13
10
  }
14
11
  export declare function SignIn(props: SignInProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import Image, {} from 'next/image';
4
+ import {} from 'react';
4
5
  import { twMerge } from 'tailwind-merge';
5
6
  import { useShallow } from 'zustand/shallow';
6
7
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
@@ -1,4 +1,4 @@
1
- import type { SignUpProps } from './SignUpDefault/SignUp.lazy';
1
+ import type { SignUpDefaultProps } from './SignUpDefault/SignUpDefault.lazy';
2
2
  import type { SignUpKYCProps } from './SignUpKYC/SignUpKYC.lazy';
3
- export declare function SignUp(props: SignUpProps | SignUpKYCProps): import("react/jsx-runtime").JSX.Element | null;
4
- export type { SignUpProps };
3
+ export type SignUpProps = SignUpDefaultProps | SignUpKYCProps;
4
+ export declare function SignUp(props: SignUpProps): import("react/jsx-runtime").JSX.Element | null;
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import dynamic from 'next/dynamic';
4
4
  import { useShallow } from 'zustand/shallow';
5
5
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
6
- const SignUpDefault = dynamic(() => import('./SignUpDefault/SignUp.lazy.js').then((m) => m.SignUp), {
6
+ const SignUpDefault = dynamic(() => import('./SignUpDefault/SignUpDefault.lazy.js').then((m) => m.SignUpDefault), {
7
7
  ssr: false,
8
8
  loading: () => null,
9
9
  });
@@ -13,10 +13,13 @@ const SignUpKYC = dynamic(() => import('./SignUpKYC/SignUpKYC.lazy.js').then((m)
13
13
  });
14
14
  export function SignUp(props) {
15
15
  const touched = useGlobalStore(useShallow((ctx) => ctx.signUp['~touched']));
16
- if (!touched)
16
+ if (!touched) {
17
17
  return null;
18
- if (props.layout === 'kyc') {
18
+ }
19
+ else if (props.layout === 'kyc') {
19
20
  return _jsx(SignUpKYC, { ...props });
20
21
  }
21
- return _jsx(SignUpDefault, { ...props });
22
+ else {
23
+ return _jsx(SignUpDefault, { ...props });
24
+ }
22
25
  }
@@ -1,13 +1,14 @@
1
1
  import { type ImageProps } from 'next/image';
2
2
  import { type ReactNode } from 'react';
3
3
  import type { Branch } from '../../../types';
4
- export interface SignUpPagcorProps {
4
+ export interface SignUpDefaultProps {
5
+ layout: 'default';
5
6
  logo: ImageProps['src'];
6
- children?: ReactNode;
7
- /** @default "/terms-and-conditions" */
7
+ siteName?: string;
8
+ branches?: Branch[];
8
9
  termsAndConditionsUrl?: string;
10
+ responsibleGamingUrl?: string;
9
11
  className?: string;
10
- branches?: Branch[];
11
- layout: 'pagcor';
12
+ children?: ReactNode;
12
13
  }
13
- export declare function SignUpPagcor(props: SignUpPagcorProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function SignUpDefault(props: SignUpDefaultProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
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 { SignUpDefaultPropsProvider } from './SignUpDefaultContext.js';
12
+ import { SignUpDefaultForm } from './SignUpDefaultForm.js';
13
+ export function SignUpDefault(props) {
14
+ const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
+ return (_jsx(SignUpDefaultPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
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: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start overflow-y-auto p-3xl pb-4xl lg:h-auto lg:w-[400px] lg:rounded-xl', props.className), 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, {}) })] }) })] }) }) }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import type { SignUpDefaultProps } from './SignUpDefault.lazy';
2
+ export declare const SignUpDefaultPropsProvider: (props: {
3
+ value: SignUpDefaultProps;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useSignUpDefaultPropsContext: () => SignUpDefaultProps;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [SignUpDefaultPropsProvider, useSignUpDefaultPropsContext] = createContext();
@@ -0,0 +1 @@
1
+ export declare function SignUpDefaultForm(): import("react/jsx-runtime").JSX.Element;
@@ -1,55 +1,60 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { createListCollection, parseDate } from '@ark-ui/react';
4
- import { useDialogContext } from '@ark-ui/react/dialog';
5
4
  import { zodResolver } from '@hookform/resolvers/zod';
6
5
  import { ObjectId } from '@opexa/object-id';
7
6
  import { differenceInYears, format } from 'date-fns';
8
- import Link from 'next/link';
9
- import { useSearchParams } from 'next/navigation';
7
+ import { useRouter, useSearchParams } from 'next/navigation';
10
8
  import { useRef, useState } from 'react';
11
9
  import { Controller, useForm } from 'react-hook-form';
10
+ import { twMerge } from 'tailwind-merge';
12
11
  import { z } from 'zod';
13
12
  import { useShallow } from 'zustand/shallow';
14
- import { useControllableState } from '../../client/hooks/useControllableState.js';
15
- import { useCooldown } from '../../client/hooks/useCooldown.js';
16
- import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
17
- import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
18
- import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
19
- import { useSendVerificationCodeMutation } from '../../client/hooks/useSendVerificationCodeMutation.js';
20
- import { useSignInMutation } from '../../client/hooks/useSignInMutation.js';
21
- import { useSignUpMutation } from '../../client/hooks/useSignUpMutation.js';
22
- import { useUpdateAccountMutation } from '../../client/hooks/useUpdateAccountMutation.js';
23
- import { toaster } from '../../client/utils/toaster.js';
24
- import { BRANCHES } from '../../constants/index.js';
25
- import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
26
- import { CalendarIcon } from '../../icons/CalendarIcon.js';
27
- import { CheckIcon } from '../../icons/CheckIcon.js';
28
- import { ChevronDownIcon } from '../../icons/ChevronDownIcon.js';
29
- import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
30
- import { ChevronRightIcon } from '../../icons/ChevronRightIcon.js';
31
- import { HelpCircleIcon } from '../../icons/HelpCircleIcon.js';
32
- import { ObjectType } from '../../services/ObjectType.js';
33
- import { Button } from '../../ui/Button/index.js';
34
- import { Checkbox } from '../../ui/Checkbox/index.js';
35
- import { DatePicker } from '../../ui/DatePicker/index.js';
36
- import { Field } from '../../ui/Field/index.js';
37
- import { PinInput } from '../../ui/PinInput/index.js';
38
- import { Select } from '../../ui/Select/index.js';
39
- import { Tooltip } from '../../ui/Tooltip/index.js';
40
- import { createPoll } from '../../utils/createPoll.js';
41
- import { useSignUpPropsContext } from './SignUpContext.js';
42
- export function SignUpForm() {
43
- const signUpProps = useSignUpPropsContext();
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 { useSignInMutation } from '../../../client/hooks/useSignInMutation.js';
20
+ import { useSignUpMutation } from '../../../client/hooks/useSignUpMutation.js';
21
+ import { useUpdateAccountMutation } from '../../../client/hooks/useUpdateAccountMutation.js';
22
+ import { toaster } from '../../../client/utils/toaster.js';
23
+ import { BRANCHES } from '../../../constants/index.js';
24
+ import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
25
+ import { CalendarIcon } from '../../../icons/CalendarIcon.js';
26
+ import { CheckIcon } from '../../../icons/CheckIcon.js';
27
+ import { ChevronDownIcon } from '../../../icons/ChevronDownIcon.js';
28
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
29
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
30
+ import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
31
+ import { ObjectType } from '../../../services/ObjectType.js';
32
+ import { Button } from '../../../ui/Button/index.js';
33
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
34
+ import { DatePicker } from '../../../ui/DatePicker/index.js';
35
+ import { Field } from '../../../ui/Field/index.js';
36
+ import { PinInput } from '../../../ui/PinInput/index.js';
37
+ import { Select } from '../../../ui/Select/index.js';
38
+ import { Tooltip } from '../../../ui/Tooltip/index.js';
39
+ import { createPoll } from '../../../utils/createPoll.js';
40
+ import { useSignUpDefaultPropsContext } from './SignUpDefaultContext.js';
41
+ export function SignUpDefaultForm() {
42
+ const signUpProps = useSignUpDefaultPropsContext();
44
43
  const branchCollection = createListCollection({
45
44
  items: signUpProps.branches ?? BRANCHES,
46
45
  itemToValue: (item) => item.code,
47
46
  itemToString: (item) => `${item.code} - ${item.name}`,
48
47
  });
49
48
  const [step, setStep] = useState(1);
50
- const dialog = useDialogContext();
49
+ const router = useRouter();
50
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
51
+ kycReminder: ctx.kycReminder,
52
+ signIn: ctx.signIn,
53
+ signUp: ctx.signUp,
54
+ termsAndConditions: ctx.termsAndConditions,
55
+ responsibleGaming: ctx.responsibleGaming,
56
+ })));
51
57
  const search = useSearchParams();
52
- const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
53
58
  const signUpMutation = useSignUpMutation();
54
59
  const signInMutation = useSignInMutation();
55
60
  const updateAccountMutation = useUpdateAccountMutation();
@@ -72,15 +77,19 @@ export function SignUpForm() {
72
77
  if (!v) {
73
78
  ctx.addIssue({
74
79
  code: z.ZodIssueCode.custom,
75
- message: 'You must accept the terms and conditions',
80
+ message: 'You must accept the terms and conditions and the responsible gaming guidelines',
76
81
  });
77
82
  }
78
83
  }),
79
84
  realName: z
80
85
  .string()
81
- .min(2, 'Real name must be 2 or more characters')
82
- .max(50, 'Real name must not be more than 50 characters')
83
- .trim(),
86
+ .transform((val) => val.trim())
87
+ .refine((val) => val.length >= 2, {
88
+ message: 'Real name must be 2 or more characters',
89
+ })
90
+ .refine((val) => val.length <= 50, {
91
+ message: 'Real name must not be more than 50 characters',
92
+ }),
84
93
  birthDay: z
85
94
  .date({
86
95
  invalid_type_error: 'Date of birth is required',
@@ -112,10 +121,13 @@ export function SignUpForm() {
112
121
  mode: 'all',
113
122
  resolver: zodResolver(Step1Definition),
114
123
  defaultValues: {
124
+ realName: '',
115
125
  mobileNumber: '',
116
- termsAccepted: false,
117
126
  branchCode: signUpProps?.branches?.[0]?.code ?? BRANCHES[0].code,
118
- realName: '',
127
+ termsAccepted: globalStore.responsibleGaming.accepted &&
128
+ globalStore.termsAndConditions.accepted
129
+ ? true
130
+ : false,
119
131
  },
120
132
  });
121
133
  const step2Form = useForm({
@@ -174,15 +186,36 @@ export function SignUpForm() {
174
186
  placement: 'top',
175
187
  }, children: [_jsx(Tooltip.Trigger, { children: _jsx(HelpCircleIcon, { className: "text-text-nav-item-button-icon size-4" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _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) => {
176
188
  const label = branchCollection.stringifyItem(item) ?? '';
177
- return (_jsx(Select.Item, { item: item, children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
189
+ 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));
178
190
  }) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] }), _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) => {
191
+ if (details.checked === 'indeterminate')
192
+ return;
179
193
  o.field.onChange(details.checked);
180
- }, 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: signUpProps.termsAndConditionsUrl ??
181
- '/terms-and-conditions', onClick: () => {
182
- dialog.setOpen(false);
183
- }, 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: () => {
184
- dialog.setOpen(false);
185
- signInStore.setOpen(true);
194
+ globalStore.termsAndConditions.setAccepted(details.checked);
195
+ globalStore.responsibleGaming.setAccepted(details.checked);
196
+ }, 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: () => {
197
+ if (signUpProps.termsAndConditionsUrl) {
198
+ globalStore.signUp.setOpen(false);
199
+ router.push(signUpProps.termsAndConditionsUrl);
200
+ }
201
+ else {
202
+ globalStore.termsAndConditions.setOpen(true);
203
+ globalStore.termsAndConditions.setNext('SIGN_UP');
204
+ globalStore.signUp.setOpen(false);
205
+ }
206
+ }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
207
+ if (signUpProps.responsibleGamingUrl) {
208
+ globalStore.signUp.setOpen(false);
209
+ router.push(signUpProps.responsibleGamingUrl);
210
+ }
211
+ else {
212
+ globalStore.responsibleGaming.setOpen(true);
213
+ globalStore.responsibleGaming.setNext('SIGN_UP');
214
+ globalStore.signUp.setOpen(false);
215
+ }
216
+ }, 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: () => {
217
+ globalStore.signUp.setOpen(false);
218
+ globalStore.signIn.setOpen(true);
186
219
  }, 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 }) => {
187
220
  const id = ObjectId.generate(ObjectType.MemberAccount).toString();
188
221
  const { mobileNumber } = step1Form.getValues();
@@ -192,7 +225,6 @@ export function SignUpForm() {
192
225
  mobileNumber: mobileNumberParser.format(mobileNumber),
193
226
  verificationCode: verificationCode.join(''),
194
227
  referralCode: search.get('referralCode') ?? undefined,
195
- domain: search.get('domain') ?? undefined,
196
228
  btag: search.get('btag') ?? undefined,
197
229
  });
198
230
  const name = mobileNumberParser.format(mobileNumber);
@@ -211,11 +243,12 @@ export function SignUpForm() {
211
243
  }
212
244
  }, {
213
245
  until: (ok) => ok,
214
- maxAttempt: 3,
246
+ maxAttempt: 5,
215
247
  });
216
248
  const ok = await pollLogin();
217
249
  if (!ok) {
218
- signInStore.setOpen(true);
250
+ globalStore.signIn.setOpen(true);
251
+ return;
219
252
  }
220
253
  else {
221
254
  const pollUpdateAccount = createPoll(async () => {
@@ -232,11 +265,13 @@ export function SignUpForm() {
232
265
  }
233
266
  }, {
234
267
  until: (ok) => ok,
235
- maxAttempt: 3,
268
+ maxAttempt: 5,
269
+ interval: 300,
236
270
  });
237
271
  await pollUpdateAccount();
238
272
  }
239
- dialog.setOpen(false);
273
+ globalStore.signUp.setOpen(false);
274
+ globalStore.kycReminder.setOpen(true);
240
275
  step1Form.reset();
241
276
  step2Form.reset();
242
277
  setStep(1);
@@ -252,7 +287,7 @@ export function SignUpForm() {
252
287
  o.field.onChange(details.value);
253
288
  }, onValueComplete: () => {
254
289
  form2Ref.current?.requestSubmit();
255
- }, 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 () => {
290
+ }, blurOnComplete: true, readOnly: step2Form.formState.isSubmitting, type: "numeric", 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 () => {
256
291
  await sendVerificationCodeMutation.mutateAsync({
257
292
  channel: 'SMS',
258
293
  recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
@@ -2,16 +2,13 @@ import { type ImageProps } from 'next/image';
2
2
  import { type ReactNode } from 'react';
3
3
  import type { Branch } from '../../../types';
4
4
  export interface SignUpKYCProps {
5
+ layout: 'kyc';
5
6
  logo: ImageProps['src'];
6
- children?: ReactNode;
7
- /** @default "/terms-and-conditions" */
8
- termsAndConditionsUrl?: string;
9
- termsOfUseContent?: ReactNode;
10
- responsibleGamingContent?: ReactNode;
11
- responsibleGamingLogo?: ImageProps['src'];
12
7
  siteName?: string;
13
- className?: string;
14
8
  branches?: Branch[];
15
- layout: 'kyc';
9
+ termsAndConditionsUrl?: string;
10
+ responsibleGamingUrl?: string;
11
+ className?: string;
12
+ children?: ReactNode;
16
13
  }
17
14
  export declare function SignUpKYC(props: SignUpKYCProps): import("react/jsx-runtime").JSX.Element;