@opexa/portal-components 0.0.520 → 0.0.522

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 (166) hide show
  1. package/dist/client/hooks/useAccountQuery.js +31 -1
  2. package/dist/client/services/refreshSession.d.ts +2 -0
  3. package/dist/client/services/refreshSession.js +17 -0
  4. package/dist/components/DigitainLauncher/Loading.js +1 -1
  5. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  6. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  7. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  8. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  9. package/dist/components/FeatureFlag/FeatureFlag.d.ts +1 -0
  10. package/dist/components/FeatureFlag/FeatureFlag.js +29 -0
  11. package/dist/components/FeatureFlag/index.d.ts +1 -0
  12. package/dist/components/FeatureFlag/index.js +1 -0
  13. package/dist/components/Jackpots/Jackpots.module.css +184 -184
  14. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  15. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  16. package/dist/components/KYC/AutoOpen.d.ts +1 -0
  17. package/dist/components/KYC/AutoOpen.js +40 -0
  18. package/dist/components/KYC/BasicInformation.js +1 -1
  19. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  20. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  21. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  22. package/dist/components/KYC/CaptureSelfie.js +285 -0
  23. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  24. package/dist/components/KYC/DisplayImage.js +8 -0
  25. package/dist/components/KYC/FileUpload.d.ts +10 -0
  26. package/dist/components/KYC/FileUpload.js +72 -0
  27. package/dist/components/KYC/IdentityVerification.js +1 -1
  28. package/dist/components/KYC/KYC.lazy.js +1 -1
  29. package/dist/components/KYC/KYCReminder.lazy.js +24 -6
  30. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  31. package/dist/components/KYC/NoCameraError.js +6 -0
  32. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  33. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  34. package/dist/components/KYC/PersonalInformation.js +1 -1
  35. package/dist/components/KYC/backup/Header.d.ts +1 -0
  36. package/dist/components/KYC/backup/Header.js +8 -0
  37. package/dist/components/KYC/backup/Indicator.d.ts +1 -0
  38. package/dist/components/KYC/backup/Indicator.js +9 -0
  39. package/dist/components/KYC/backup/KYC.d.ts +1 -0
  40. package/dist/components/KYC/backup/KYC.js +14 -0
  41. package/dist/components/KYC/backup/KYC.lazy.d.ts +1 -0
  42. package/dist/components/KYC/backup/KYC.lazy.js +26 -0
  43. package/dist/components/KYC/backup/KYCContext.d.ts +6 -0
  44. package/dist/components/KYC/backup/KYCContext.js +2 -0
  45. package/dist/components/KYC/backup/Step1.d.ts +1 -0
  46. package/dist/components/KYC/backup/Step1.js +13 -0
  47. package/dist/components/KYC/backup/Step2.d.ts +1 -0
  48. package/dist/components/KYC/backup/Step2.js +13 -0
  49. package/dist/components/KYC/backup/Step3.d.ts +1 -0
  50. package/dist/components/KYC/backup/Step3.js +13 -0
  51. package/dist/components/KYC/backup/Step4.d.ts +1 -0
  52. package/dist/components/KYC/backup/Step4.js +7 -0
  53. package/dist/components/KYC/backup/useKYC.d.ts +10 -0
  54. package/dist/components/KYC/backup/useKYC.js +8 -0
  55. package/dist/components/KYC/loadModels.d.ts +1 -0
  56. package/dist/components/KYC/loadModels.js +9 -0
  57. package/dist/components/KYC/utils.d.ts +9 -0
  58. package/dist/components/KYC/utils.js +79 -0
  59. package/dist/components/Messages/Message.d.ts +1 -0
  60. package/dist/components/Messages/Message.js +35 -0
  61. package/dist/components/Messages/MessageContext.d.ts +6 -0
  62. package/dist/components/Messages/MessageContext.js +2 -0
  63. package/dist/components/Messages/MessagePopup.d.ts +1 -0
  64. package/dist/components/Messages/MessagePopup.js +20 -0
  65. package/dist/components/Messages/MessageTrigger.d.ts +8 -0
  66. package/dist/components/Messages/MessageTrigger.js +19 -0
  67. package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
  68. package/dist/components/Quests/CountdownTimer.d.ts +15 -0
  69. package/dist/components/Quests/CountdownTimer.js +33 -0
  70. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +4 -0
  71. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +78 -0
  72. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +8 -0
  73. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +9 -0
  74. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +4 -0
  75. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +4 -0
  76. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +4 -0
  77. package/dist/components/Quests/WageringQuest/WageringQuest.js +20 -0
  78. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +9 -0
  79. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +9 -0
  80. package/dist/components/Search/Search.lazy.js +10 -10
  81. package/dist/components/SignIn/MobileNumberSignIn.js +1 -1
  82. package/dist/components/SignIn/NameAndPasswordSignIn.js +1 -1
  83. package/dist/components/SignUp/SignUp.lazy.d.ts +12 -0
  84. package/dist/components/SignUp/SignUp.lazy.js +18 -0
  85. package/dist/components/SignUp/SignUpContext.d.ts +6 -0
  86. package/dist/components/SignUp/SignUpContext.js +2 -0
  87. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  88. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  89. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  90. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  91. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  92. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  93. package/dist/components/SignUp/SignUpForm.d.ts +1 -0
  94. package/dist/components/SignUp/SignUpForm.js +284 -0
  95. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  96. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  97. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  98. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  99. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  100. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  101. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  102. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  103. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  104. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  105. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  106. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  107. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  108. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  109. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  110. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  111. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  112. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  113. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  114. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  115. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  116. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  117. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  118. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  119. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  120. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  121. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  122. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  123. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  124. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  125. package/dist/components/shared/IdDocumentField.client.d.ts +25 -0
  126. package/dist/components/shared/IdDocumentField.client.js +204 -0
  127. package/dist/components/shared/IdDocumentField.d.ts +2 -0
  128. package/dist/components/shared/IdDocumentField.js +11 -0
  129. package/dist/components/shared/SelfieField.client.d.ts +20 -0
  130. package/dist/components/shared/SelfieField.client.js +327 -0
  131. package/dist/components/shared/SelfieField.d.ts +2 -0
  132. package/dist/components/shared/SelfieField.js +11 -0
  133. package/dist/constants/BranchCode.d.ts +4 -0
  134. package/dist/constants/BranchCode.js +42 -0
  135. package/dist/handlers/deleteAccessTokenSession.d.ts +9 -0
  136. package/dist/handlers/deleteAccessTokenSession.js +9 -0
  137. package/dist/handlers/index.js +4 -0
  138. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  139. package/dist/handlers/postTransformIdFrontImage.js +67 -0
  140. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  141. package/dist/handlers/postTransformSelfieImage.js +71 -0
  142. package/dist/handlers.d.ts +43 -0
  143. package/dist/handlers.js +297 -0
  144. package/dist/icons/BellRingIcon.d.ts +2 -0
  145. package/dist/icons/BellRingIcon.js +4 -0
  146. package/dist/services/queries.js +2755 -2755
  147. package/dist/styles/theme.css +731 -731
  148. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  149. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  150. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  151. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  152. package/dist/ui/Menu/Menu.d.ts +198 -198
  153. package/dist/ui/Menu/menu.recipe.d.ts +11 -11
  154. package/dist/utils/dataUrlToBlob.d.ts +1 -0
  155. package/dist/utils/dataUrlToBlob.js +11 -0
  156. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  157. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  158. package/dist/utils/getGameName.d.ts +1 -0
  159. package/dist/utils/getGameName.js +6 -0
  160. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  161. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  162. package/dist/utils/resizeImageSize.d.ts +2 -0
  163. package/dist/utils/resizeImageSize.js +11 -0
  164. package/package.json +163 -163
  165. package/dist/components/Banner/Banner.client.d.ts +0 -12
  166. package/dist/components/Banner/Banner.client.js +0 -49
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { XIcon } from '../../../icons/XIcon.js';
4
+ import { Button } from '../../../ui/Button/index.js';
5
+ import { Dialog } from '../../../ui/Dialog/index.js';
6
+ import { Portal } from '../../../ui/Portal/index.js';
7
+ export function WageringQuestModal(props) {
8
+ return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: props.modalState.isOpen, onOpenChange: ({ open }) => props.modalState.setIsOpen(open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("p", { className: "text-text-primary-900 text-lg font-semibold", children: props.questName }), _jsxs("ul", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn extra rewards just by playing Slots, every bet counts, win or lose!" }), _jsx("li", { children: "Reach the wagering requirement in bets to complete the quest and claim your reward." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => props.modalState.setIsOpen(false), children: "Ok" }) })] }) })] }) }));
9
+ }
@@ -74,15 +74,15 @@ export function Search(props) {
74
74
  }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "mx-auto min-h-full w-full overflow-y-auto bg-bg-primary pt-xl lg:mt-[132px] lg:min-h-auto lg:max-w-[1136px] lg:bg-unset lg:px-2 lg:pt-0", children: [_jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex items-center justify-between px-4 lg:hidden", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 40, className: "h-8 w-auto" }), _jsx(IconButton, { size: "sm", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, { className: "size-6 text-text-quinary" }) })] })) }), _jsx("div", { className: "flex justify-end", children: _jsx(Dialog.Context, { children: (api) => (_jsx("button", { type: "button", onClick: () => api.setOpen(false), className: "hidden size-9 items-center justify-center rounded-md bg-white/20 lg:flex", children: _jsx(XIcon, { className: "size-5 text-white" }) })) }) }), _jsx("div", { className: "mt-2xl px-4 lg:mt-xl lg:px-0", children: _jsxs("div", { className: "relative", children: [_jsx(SearchLgIcon, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5 text-text-quinary" }), _jsx(DebouncedInput, { ref: inputRef, value: search, placeholder: props.placeholder ?? 'Search', onChange: setSearch }), _jsx(Presence, { present: search.length > 0, asChild: true, lazyMount: true, children: _jsx("button", { type: "button", className: "-translate-y-1/2 absolute top-1/2 right-3.5 cursor-pointer font-semibold text-text-secondary-700", onClick: () => {
75
75
  setSearch('');
76
76
  inputRef.current?.focus();
77
- }, children: "Clear" }) })] }) }), _jsx("div", { className: "mt-2xl p-xl pb-3xl lg:mt-2 lg:max-h-[41rem] lg:overflow-y-auto lg:rounded-xl lg:border lg:border-border-primary lg:bg-bg-primary", children: search.length <= 0 ? (_jsx(Alert, { message: "Search for your favorite game or provider." })) : search.length === 1 ? (_jsx(Alert, { message: "Search requires at least 2 characters." })) : (_jsxs(_Fragment, { children: [empty && _jsx(Alert, { message: "No results found" }), !empty && (_jsxs(_Fragment, { children: [gameProviders.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "font-semibold text-lg", children: "Providers" }), _jsx("div", { className: "mt-3.5 mb-3xl grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: gameProviders.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), "aria-label": `View ${provider.name} games`, className: twMerge('flex h-14 w-full items-center rounded-md bg-brand-800', classNames.providerThumbnailRoot), onClick: () => {
78
- globalStore.search.setOpen(false);
79
- }, children: _jsx(Image, { src: props.gameProviderImages?.[provider.id] ??
80
- provider.logo, alt: "", width: 100, height: 50, className: twMerge('mx-auto h-auto w-full', classNames.providerThumbnailImage) }) }, provider.id))) })] })), games.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "font-semibold text-lg", children: "Games" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, className: twMerge('block w-full shadow-sm', classNames.gameThumbnailRoot), onClick: () => {
81
- globalStore.search.setOpen(false);
82
- }, children: [_jsx(Image, { src: getGameImageUrl({
83
- reference: game.reference,
84
- provider: game.provider,
85
- }), alt: "", width: 200, height: 200, loading: "lazy", unoptimized: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: twMerge('block w-full truncate rounded-b-md bg-bg-tertiary px-2 py-2.5 text-center font-semibold text-text-primary-brand text-xs', classNames.gameThumbnailTitle), children: game.name })] }, game.id))) })] })), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: twMerge('mx-auto mt-12 w-fit', classNames.loadMoreButton), onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) })] }) })] }) }));
77
+ }, children: "Clear" }) })] }) }), _jsx("div", { className: "flex max-h-[85dvh] min-h-0 flex-1 flex-col", children: _jsx("div", { className: "mt-2xl p-xl pb-3xl lg:mt-2 lg:max-h-[41rem] lg:overflow-y-auto lg:rounded-xl lg:border lg:border-border-primary lg:bg-bg-primary", children: search.length <= 0 ? (_jsx(Alert, { message: "Search for your favorite game or provider." })) : search.length === 1 ? (_jsx(Alert, { message: "Search requires at least 2 characters." })) : (_jsxs(_Fragment, { children: [empty && _jsx(Alert, { message: "No results found" }), !empty && (_jsxs(_Fragment, { children: [gameProviders.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "font-semibold text-lg", children: "Providers" }), _jsx("div", { className: "mt-3.5 mb-3xl grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: gameProviders.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), "aria-label": `View ${provider.name} games`, className: twMerge('flex h-14 w-full items-center rounded-md bg-brand-800', classNames.providerThumbnailRoot), onClick: () => {
78
+ globalStore.search.setOpen(false);
79
+ }, children: _jsx(Image, { src: props.gameProviderImages?.[provider.id] ??
80
+ provider.logo, alt: "", width: 100, height: 50, className: twMerge('mx-auto h-auto w-full', classNames.providerThumbnailImage) }) }, provider.id))) })] })), games.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "font-semibold text-lg", children: "Games" }), _jsx("div", { className: "mt-3.5 grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { game: game, className: twMerge('block w-full shadow-sm', classNames.gameThumbnailRoot), onClick: () => {
81
+ globalStore.search.setOpen(false);
82
+ }, children: [_jsx(Image, { src: getGameImageUrl({
83
+ reference: game.reference,
84
+ provider: game.provider,
85
+ }), alt: "", width: 200, height: 200, loading: "lazy", unoptimized: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: twMerge('block w-full truncate rounded-b-md bg-bg-tertiary px-2 py-2.5 text-center font-semibold text-text-primary-brand text-xs', classNames.gameThumbnailTitle), children: game.name })] }, game.id))) })] })), _jsx(Presence, { present: gamesQuery.hasNextPage, children: _jsx(Button, { variant: "outline", className: twMerge('mx-auto mt-12 w-fit', classNames.loadMoreButton), onClick: () => gamesQuery.fetchNextPage(), children: "Load More" }) })] }))] })) }) })] }) })] }) }));
86
86
  }
87
87
  function DebouncedInput(props) {
88
88
  const [value, setValue] = useControllableState({
@@ -95,7 +95,7 @@ function DebouncedInput(props) {
95
95
  useEffect(() => {
96
96
  setInternalValue(value);
97
97
  }, [value]);
98
- return (_jsx(Field.Input, { ref: props.ref, type: "search", value: internalValue, onChange: (e) => {
98
+ return (_jsx(Field.Input, { ref: props.ref, type: "text", value: internalValue, onChange: (e) => {
99
99
  setInternalValue(e.target.value);
100
100
  setValueDebounced(e.target.value);
101
101
  }, className: "pr-16 pl-10", placeholder: props.placeholder, autoComplete: "off" }));
@@ -155,7 +155,7 @@ export function MobileNumberSignIn() {
155
155
  globalStore.responsibleGaming.setNext('SIGN_IN');
156
156
  globalStore.signIn.setOpen(false);
157
157
  }
158
- }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: twMerge('mt-3xl text-center text-sm', signInProps.className?.publicPlayProhibitionRoot), children: ["Prohibition to play in open and public places", _jsxs("div", { className: twMerge('mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2', signInProps.className?.publicPlayProhibitionLogoContainer), children: [_jsx(Image, { src: signInProps.pagcorLogo ?? pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-10 w-auto" }), _jsx(Image, { src: signInProps.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), _jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] }), _jsxs("div", { className: "mt-6", children: [signInProps.googleSso && _jsx(GoogleSignInButton, {}), signInProps.facebookSso && _jsx(FacebookSignInTrigger, {})] }), _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: "font-semibold text-button-tertiary-fg", onClick: () => {
158
+ }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: twMerge('mt-3xl text-center text-sm', signInProps.className?.publicPlayProhibitionRoot), children: ["Prohibition to play in open and public places", _jsxs("div", { className: twMerge('mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2', signInProps.className?.publicPlayProhibitionLogoContainer), children: [_jsx(Image, { src: signInProps.pagcorLogo ?? pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-10 w-auto" }), _jsx(Image, { src: signInProps.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), (signInProps.googleSso || signInProps.facebookSso) && (_jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] })), _jsxs("div", { className: "mt-6", children: [signInProps.googleSso && _jsx(GoogleSignInButton, {}), signInProps.facebookSso && _jsx(FacebookSignInTrigger, {})] }), _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: "font-semibold text-button-tertiary-fg", onClick: () => {
159
159
  globalStore.signIn.setOpen(false);
160
160
  globalStore.signUp.setOpen(true);
161
161
  }, children: "Sign up" })] })] })), context.step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Check your Phone" }), _jsxs("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
@@ -167,7 +167,7 @@ export function NameAndPasswordSignIn() {
167
167
  globalStore.responsibleGaming.setNext('SIGN_IN');
168
168
  globalStore.signIn.setOpen(false);
169
169
  }
170
- }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: twMerge('mt-3xl text-center text-sm', signInProps.className?.publicPlayProhibitionRoot), children: ["Prohibition to play in open and public places", _jsxs("div", { className: twMerge('mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2', signInProps.className?.publicPlayProhibitionLogoContainer), children: [_jsx(Image, { src: signInProps.pagcorLogo ?? pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-10 w-auto" }), _jsx(Image, { src: signInProps.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), _jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] }), _jsxs("div", { className: "mt-6", children: [signInProps.googleSso && _jsx(GoogleSignInButton, {}), signInProps.facebookSso && _jsx(FacebookSignInTrigger, {})] }), _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: "font-semibold text-button-tertiary-fg", onClick: () => {
170
+ }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: twMerge('mt-3xl text-center text-sm', signInProps.className?.publicPlayProhibitionRoot), children: ["Prohibition to play in open and public places", _jsxs("div", { className: twMerge('mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2', signInProps.className?.publicPlayProhibitionLogoContainer), children: [_jsx(Image, { src: signInProps.pagcorLogo ?? pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-10 w-auto" }), _jsx(Image, { src: signInProps.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), (signInProps.googleSso || signInProps.facebookSso) && (_jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] })), _jsxs("div", { className: "mt-6", children: [signInProps.googleSso && _jsx(GoogleSignInButton, {}), signInProps.facebookSso && _jsx(FacebookSignInTrigger, {})] }), _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: "font-semibold text-button-tertiary-fg", onClick: () => {
171
171
  dialog.setOpen(false);
172
172
  globalStore.signUp.setOpen(true);
173
173
  }, children: "Sign up" })] })] }));
@@ -0,0 +1,12 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type ReactNode } from 'react';
3
+ import type { Branch } from '../../types';
4
+ export interface SignUpProps {
5
+ logo: ImageProps['src'];
6
+ children?: ReactNode;
7
+ /** @default "/terms-and-conditions" */
8
+ termsAndConditionsUrl?: string;
9
+ className?: string;
10
+ branches?: Branch[];
11
+ }
12
+ export declare function SignUp(props: SignUpProps): 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 { SignUpPropsProvider } from './SignUpContext.js';
12
+ import { SignUpForm } from './SignUpForm.js';
13
+ export function SignUp(props) {
14
+ const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
+ return (_jsx(SignUpPropsProvider, { 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 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(SignUpForm, {}) })] }) })] }) }) }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import type { SignUpProps } from './SignUp.lazy';
2
+ export declare const SignUpPropsProvider: (props: {
3
+ value: SignUpProps;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useSignUpPropsContext: () => SignUpProps;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../client/utils/createContext.js';
2
+ export const [SignUpPropsProvider, useSignUpPropsContext] = createContext();
@@ -0,0 +1,17 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type ReactNode } from 'react';
3
+ import type { Branch } from '../../../types';
4
+ export interface SignUpProps {
5
+ 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
+ siteName?: string;
13
+ className?: string;
14
+ branches?: Branch[];
15
+ layout: 'default';
16
+ }
17
+ export declare function SignUp(props: SignUpProps): 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 { SignUpPropsProvider } from './SignUpContext.js';
12
+ import { SignUpForm } from './SignUpForm.js';
13
+ export function SignUp(props) {
14
+ const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
15
+ return (_jsx(SignUpPropsProvider, { 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(SignUpForm, {}) })] }) })] }) }) }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import type { SignUpProps } from './SignUp.lazy';
2
+ export declare const SignUpPropsProvider: (props: {
3
+ value: SignUpProps;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useSignUpPropsContext: () => SignUpProps;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [SignUpPropsProvider, useSignUpPropsContext] = createContext();
@@ -0,0 +1 @@
1
+ export declare function SignUpForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,310 @@
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 { useSearchParams } from 'next/navigation';
8
+ import { useEffect, useRef, useState } from 'react';
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 { 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 { ResponsibleGaming } from '../../Disclaimer/ResponsibleGaming.js';
41
+ import { TermsOfUse } from '../../Disclaimer/TermsOfUse.js';
42
+ import { useSignUpPropsContext } from './SignUpContext.js';
43
+ export function SignUpForm() {
44
+ const signUpProps = useSignUpPropsContext();
45
+ const branchCollection = createListCollection({
46
+ items: signUpProps.branches ?? BRANCHES,
47
+ itemToValue: (item) => item.code,
48
+ itemToString: (item) => `${item.code} - ${item.name}`,
49
+ });
50
+ const [step, setStep] = useState(1);
51
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
52
+ kycReminder: ctx.kycReminder,
53
+ signIn: ctx.signIn,
54
+ signUp: ctx.signUp,
55
+ })));
56
+ const search = useSearchParams();
57
+ const signUpMutation = useSignUpMutation();
58
+ const signInMutation = useSignInMutation();
59
+ const updateAccountMutation = useUpdateAccountMutation();
60
+ const sendVerificationCodeMutation = useSendVerificationCodeMutation();
61
+ const localeInfo = useLocaleInfo();
62
+ const mobileNumberParser = useMobileNumberParser();
63
+ const Step1Definition = z.object({
64
+ mobileNumber: z
65
+ .string()
66
+ .min(1, 'Mobile number is required')
67
+ .superRefine((v, ctx) => {
68
+ if (!mobileNumberParser.validate(v)) {
69
+ ctx.addIssue({
70
+ code: z.ZodIssueCode.custom,
71
+ message: 'Invalid mobile number',
72
+ });
73
+ }
74
+ }),
75
+ termsAccepted: z.boolean().superRefine((v, ctx) => {
76
+ if (!v) {
77
+ ctx.addIssue({
78
+ code: z.ZodIssueCode.custom,
79
+ message: 'You must accept the terms and conditions and the responsible gaming guidelines',
80
+ });
81
+ }
82
+ }),
83
+ realName: z
84
+ .string()
85
+ .min(2, 'Real name must be 2 or more characters')
86
+ .max(50, 'Real name must not be more than 50 characters')
87
+ .trim(),
88
+ birthDay: z
89
+ .date({
90
+ invalid_type_error: 'Date of birth is required',
91
+ required_error: 'Date of birth is required',
92
+ })
93
+ .superRefine((val, ctx) => {
94
+ const now = new Date();
95
+ const age = differenceInYears(now, val);
96
+ if (age < 21) {
97
+ return ctx.addIssue({
98
+ code: z.ZodIssueCode.custom,
99
+ message: 'You must be at least 21 years old',
100
+ });
101
+ }
102
+ }),
103
+ branchCode: z.string().min(1, 'Branch is required').trim(),
104
+ });
105
+ const Step2Definition = z.object({
106
+ verificationCode: z.array(z.string()).superRefine((val, ctx) => {
107
+ if (val.length !== 6 || val.some((v) => v.length !== 1)) {
108
+ ctx.addIssue({
109
+ code: z.ZodIssueCode.custom,
110
+ message: 'Please Enter your 6 digits verification code',
111
+ });
112
+ }
113
+ }),
114
+ });
115
+ const step1Form = useForm({
116
+ mode: 'all',
117
+ resolver: zodResolver(Step1Definition),
118
+ defaultValues: {
119
+ mobileNumber: '',
120
+ termsAccepted: false,
121
+ branchCode: signUpProps?.branches?.[0]?.code ?? BRANCHES[0].code,
122
+ realName: '',
123
+ },
124
+ });
125
+ const step2Form = useForm({
126
+ resolver: zodResolver(Step2Definition),
127
+ defaultValues: {
128
+ verificationCode: Array.from({ length: 6 }).fill(''),
129
+ },
130
+ });
131
+ const cooldown = useCooldown({
132
+ max: 60,
133
+ duration: 1000 * 60,
134
+ });
135
+ const form2Ref = useRef(null);
136
+ const birthDay = step1Form.watch('birthDay');
137
+ const branchCode = step1Form.watch('branchCode', '');
138
+ const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
139
+ const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
140
+ const [isTermsOfUseAccepted, setIsTermsOfUseAccepted] = useState(false);
141
+ const [isResponsibleGamingAccepted, setIsResponsibleGamingAccepted] = useState(false);
142
+ useEffect(() => {
143
+ if (isTermsOfUseAccepted && isResponsibleGamingAccepted) {
144
+ step1Form.setValue('termsAccepted', true);
145
+ }
146
+ }, [isResponsibleGamingAccepted, isTermsOfUseAccepted, step1Form]);
147
+ return (_jsxs(_Fragment, { children: [_jsx(TermsOfUse, { termsOfUseContent: signUpProps.termsOfUseContent ?? 'Terms of Use content', siteName: signUpProps.siteName ?? 'Site', logo: signUpProps.logo, open: isTermsOfUseOpen, onCloseAction: () => {
148
+ setIsTermsOfUseAccepted(true);
149
+ setTermsOfUseOpen(false);
150
+ }, responsibleGamingLogo: signUpProps.responsibleGamingLogo }), _jsx(ResponsibleGaming, { responsibleGamingContent: signUpProps.responsibleGamingContent ?? 'Responsible Gaming content', logo: signUpProps.logo, open: isResponsibleGamingOpen, onCloseAction: () => {
151
+ setIsResponsibleGamingAccepted(true);
152
+ setResponsibleGamingOpen(false);
153
+ }, responsibleGamingLogo: signUpProps.responsibleGamingLogo }), step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
154
+ try {
155
+ await sendVerificationCodeMutation.mutateAsync({
156
+ channel: 'SMS',
157
+ recipient: mobileNumberParser.format(data.mobileNumber),
158
+ });
159
+ setStep(2);
160
+ cooldown.start();
161
+ }
162
+ catch (e) {
163
+ toaster.error({
164
+ description: e instanceof Error
165
+ ? e.message
166
+ : 'Failed to send verification code',
167
+ });
168
+ }
169
+ }), 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: {
170
+ paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
171
+ }, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.realName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Real Name" }), _jsx(Field.Input, { placeholder: "Enter your real name", ...step1Form.register('realName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: birthDay, onChange: (value) => {
172
+ if (!value)
173
+ return;
174
+ step1Form.setValue('birthDay', value, {
175
+ shouldDirty: true,
176
+ shouldTouch: true,
177
+ shouldValidate: true,
178
+ });
179
+ }, onBlur: () => {
180
+ step1Form.trigger('birthDay');
181
+ } }), _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) => {
182
+ step1Form.setValue('branchCode', details.value.at(0) ??
183
+ signUpProps?.branches?.[0]?.code ??
184
+ BRANCHES[0].code, {
185
+ shouldDirty: true,
186
+ shouldTouch: true,
187
+ shouldValidate: true,
188
+ });
189
+ }, collection: branchCollection, positioning: {
190
+ sameWidth: true,
191
+ placement: 'bottom',
192
+ }, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1", children: ["Branch", _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: {
193
+ placement: 'top',
194
+ }, 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) => {
195
+ const label = branchCollection.stringifyItem(item) ?? '';
196
+ 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));
197
+ }) }) })] }), _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) => {
198
+ o.field.onChange(details.checked);
199
+ if (!details.checked) {
200
+ setIsTermsOfUseAccepted(false);
201
+ setIsResponsibleGamingAccepted(false);
202
+ }
203
+ }, 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: () => {
204
+ setTermsOfUseOpen(true);
205
+ }, children: "Terms and Conditions" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
206
+ setResponsibleGamingOpen(true);
207
+ }, 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: () => {
208
+ globalStore.signUp.setOpen(false);
209
+ globalStore.signIn.setOpen(true);
210
+ }, 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 }) => {
211
+ const id = ObjectId.generate(ObjectType.MemberAccount).toString();
212
+ const { mobileNumber } = step1Form.getValues();
213
+ try {
214
+ await signUpMutation.mutateAsync({
215
+ id,
216
+ mobileNumber: mobileNumberParser.format(mobileNumber),
217
+ verificationCode: verificationCode.join(''),
218
+ referralCode: search.get('referralCode') ?? undefined,
219
+ btag: search.get('btag') ?? undefined,
220
+ });
221
+ const name = mobileNumberParser.format(mobileNumber);
222
+ const password = `${name}${id}`;
223
+ const pollLogin = createPoll(async () => {
224
+ try {
225
+ await signInMutation.mutateAsync({
226
+ type: 'NAME_AND_PASSWORD',
227
+ name,
228
+ password,
229
+ });
230
+ return true;
231
+ }
232
+ catch {
233
+ return false;
234
+ }
235
+ }, {
236
+ until: (ok) => ok,
237
+ maxAttempt: 5,
238
+ });
239
+ const ok = await pollLogin();
240
+ if (!ok) {
241
+ globalStore.signIn.setOpen(true);
242
+ return;
243
+ }
244
+ else {
245
+ const pollUpdateAccount = createPoll(async () => {
246
+ try {
247
+ await updateAccountMutation.mutateAsync({
248
+ branchCode: step1Form.getValues('branchCode'),
249
+ realName: step1Form.getValues('realName'),
250
+ birthDay: format(step1Form.getValues('birthDay'), 'yyyy-MM-dd'),
251
+ });
252
+ return true;
253
+ }
254
+ catch {
255
+ return false;
256
+ }
257
+ }, {
258
+ until: (ok) => ok,
259
+ maxAttempt: 5,
260
+ interval: 300,
261
+ });
262
+ await pollUpdateAccount();
263
+ }
264
+ globalStore.signUp.setOpen(false);
265
+ globalStore.kycReminder.setOpen(true);
266
+ step1Form.reset();
267
+ step2Form.reset();
268
+ setStep(1);
269
+ }
270
+ catch (error) {
271
+ toaster.error({
272
+ description: error instanceof Error
273
+ ? error.message
274
+ : 'Invalid Verification Code',
275
+ });
276
+ }
277
+ }), 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) => {
278
+ o.field.onChange(details.value);
279
+ }, onValueComplete: () => {
280
+ form2Ref.current?.requestSubmit();
281
+ }, 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 () => {
282
+ await sendVerificationCodeMutation.mutateAsync({
283
+ channel: 'SMS',
284
+ recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
285
+ });
286
+ cooldown.start();
287
+ }, children: cooldown.cooling
288
+ ? `Resend in ${cooldown.countdown}s`
289
+ : '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: () => {
290
+ setStep(1);
291
+ step2Form.reset();
292
+ cooldown.stop();
293
+ }, children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] })] })] }))] }));
294
+ }
295
+ const DEVICE_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone;
296
+ function DateOfBirthField(props) {
297
+ const [value, setValue] = useControllableState({
298
+ value: props.value,
299
+ defaultValue: props.defaultValue ?? null,
300
+ onChange: props.onChange,
301
+ });
302
+ 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) => {
303
+ const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
304
+ setValue(value ?? null);
305
+ }, 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
306
+ .getMonthsGrid({ columns: 4, format: 'short' })
307
+ .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
308
+ .getYearsGrid({ columns: 4 })
309
+ .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))) }) })] })) }) })] }) })] }));
310
+ }
@@ -0,0 +1 @@
1
+ export declare function SignUpForm(): import("react/jsx-runtime").JSX.Element;