@opexa/portal-components 0.0.277 → 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.
- package/dist/client/hooks/useGlobalStore.d.ts +16 -6
- package/dist/client/hooks/useGlobalStore.js +99 -0
- package/dist/client/hooks/useJackpotsQuery.js +1 -1
- package/dist/components/Bonus/Bonus.client.js +1 -1
- package/dist/components/Cashback/Cashback.client.js +1 -1
- package/dist/components/CustomPromo/CustomPromo.js +1 -1
- package/dist/components/Disclaimer/Disclaimer.d.ts +3 -14
- package/dist/components/Disclaimer/Disclaimer.js +14 -5
- package/dist/components/Disclaimer/DisclaimerV1.d.ts +1 -1
- package/dist/components/Disclaimer/DisclaimerV1.js +1 -1
- package/dist/components/Disclaimer/DisclaimerV2.d.ts +3 -7
- package/dist/components/Disclaimer/DisclaimerV2.js +23 -51
- package/dist/components/Disclaimer/useDisclaimer.js +1 -1
- package/dist/components/GameLaunch/GameLaunch.lazy.js +1 -1
- package/dist/components/GamesSearch/GamesSearch.js +1 -1
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +12 -1
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +12 -1
- package/dist/components/KYC/utils.js +18 -18
- package/dist/components/News/News.js +1 -1
- package/dist/components/PortalProvider/FeatureFlag.js +1 -1
- package/dist/components/Promo/Promo.client.js +1 -1
- package/dist/components/ResponsibleGaming/ResponsibleGaming.d.ts +3 -0
- package/dist/components/ResponsibleGaming/ResponsibleGaming.js +14 -0
- package/dist/components/ResponsibleGaming/ResponsibleGaming.lazy.d.ts +8 -0
- package/dist/components/ResponsibleGaming/ResponsibleGaming.lazy.js +35 -0
- package/dist/components/ResponsibleGaming/index.d.ts +1 -0
- package/dist/components/ResponsibleGaming/index.js +1 -0
- package/dist/components/Search/Search.lazy.js +1 -1
- package/dist/components/SignIn/MobileNumberSignIn.js +32 -26
- package/dist/components/SignIn/NameAndPasswordSignIn.js +31 -26
- package/dist/components/SignIn/SignIn.lazy.d.ts +4 -7
- package/dist/components/SignIn/SignIn.lazy.js +1 -0
- package/dist/components/SignUp/SignUp.d.ts +3 -3
- package/dist/components/SignUp/SignUp.js +7 -4
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +14 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +18 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultContext.d.ts +6 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultContext.js +2 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.d.ts +1 -0
- package/dist/components/SignUp/{SignUpForm.js → SignUpDefault/SignUpDefaultForm.js} +88 -57
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +3 -7
- package/dist/components/SignUp/SignUpKYC/SignUpKYC.lazy.d.ts +5 -8
- package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +37 -31
- package/dist/components/SignUp/SignUpKYC/utils.js +18 -18
- package/dist/components/TermsAndConditions/TermsAndConditions.d.ts +2 -0
- package/dist/components/TermsAndConditions/TermsAndConditions.js +14 -0
- package/dist/components/TermsAndConditions/TermsAndConditions.lazy.d.ts +9 -0
- package/dist/components/TermsAndConditions/TermsAndConditions.lazy.js +35 -0
- package/dist/components/TermsAndConditions/index.d.ts +1 -0
- package/dist/components/TermsAndConditions/index.js +1 -0
- package/dist/components/TermsOfUse/TermsOfUse.d.ts +3 -0
- package/dist/components/TermsOfUse/TermsOfUse.js +14 -0
- package/dist/components/TermsOfUse/TermsOfUse.lazy.d.ts +9 -0
- package/dist/components/TermsOfUse/TermsOfUse.lazy.js +35 -0
- package/dist/components/TermsOfUse/index.d.ts +1 -0
- package/dist/components/TermsOfUse/index.js +1 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
- package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
- package/dist/handlers/postTransformIdFrontImage.js +82 -0
- package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
- package/dist/handlers/postTransformSelfieImage.js +82 -0
- package/dist/next.config.js +1 -0
- package/dist/services/queries.js +2570 -2570
- package/dist/styles/theme.css +695 -695
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +99 -99
- package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +88 -88
- package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +306 -306
- package/dist/ui/Menu/menu.recipe.d.ts +17 -17
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +163 -163
- package/dist/client/hooks/index.d.ts +0 -65
- package/dist/client/hooks/index.js +0 -65
- package/dist/client/services/index.d.ts +0 -4
- package/dist/client/services/index.js +0 -4
- package/dist/client/utils/index.d.ts +0 -3
- package/dist/client/utils/index.js +0 -3
- package/dist/components/CashbackBonus/CashbackBonus.client.d.ts +0 -2
- package/dist/components/CashbackBonus/CashbackBonus.client.js +0 -9
- package/dist/components/CashbackBonus/CashbackBonus.d.ts +0 -10
- package/dist/components/CashbackBonus/CashbackBonus.js +0 -5
- package/dist/components/CashbackBonus/index.d.ts +0 -1
- package/dist/components/CashbackBonus/index.js +0 -1
- package/dist/components/Empty.d.ts +0 -9
- package/dist/components/Empty.js +0 -7
- package/dist/components/FeatureFlag/FeatureFlag.d.ts +0 -1
- package/dist/components/FeatureFlag/FeatureFlag.js +0 -29
- package/dist/components/FeatureFlag/index.d.ts +0 -1
- package/dist/components/FeatureFlag/index.js +0 -1
- package/dist/components/Games/GameContext.d.ts +0 -2
- package/dist/components/Games/GameContext.js +0 -2
- package/dist/components/InfiniteScroll.d.ts +0 -10
- package/dist/components/InfiniteScroll.js +0 -25
- package/dist/components/JackpotCounter/JackpotCounter.client.d.ts +0 -2
- package/dist/components/JackpotCounter/JackpotCounter.client.js +0 -66
- package/dist/components/JackpotCounter/JackpotCounter.d.ts +0 -17
- package/dist/components/JackpotCounter/JackpotCounter.js +0 -21
- package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +0 -18
- package/dist/components/JackpotCounter/JackpotCounterItem.js +0 -109
- package/dist/components/JackpotCounter/JackpotCounterItem.module.css +0 -184
- package/dist/components/JackpotCounter/index.d.ts +0 -1
- package/dist/components/JackpotCounter/index.js +0 -1
- package/dist/components/Jackpots/JackpotDesktop.d.ts +0 -1
- package/dist/components/Jackpots/JackpotDesktop.js +0 -45
- package/dist/components/Jackpots/JackpotGameProviders.d.ts +0 -5
- package/dist/components/Jackpots/JackpotGameProviders.js +0 -41
- package/dist/components/Jackpots/JackpotItemDesktop.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemDesktop.js +0 -43
- package/dist/components/Jackpots/JackpotItemMobile.d.ts +0 -9
- package/dist/components/Jackpots/JackpotItemMobile.js +0 -44
- package/dist/components/Jackpots/JackpotMobile.d.ts +0 -1
- package/dist/components/Jackpots/JackpotMobile.js +0 -46
- package/dist/components/Jackpots/JackpotRules.d.ts +0 -5
- package/dist/components/Jackpots/JackpotRules.js +0 -11
- package/dist/components/Jackpots/Jackpots.client.d.ts +0 -2
- package/dist/components/Jackpots/Jackpots.client.js +0 -29
- package/dist/components/Jackpots/JackpotsContext.d.ts +0 -4
- package/dist/components/Jackpots/JackpotsContext.js +0 -3
- package/dist/components/Jackpots/useJackpotData.d.ts +0 -14
- package/dist/components/Jackpots/useJackpotData.js +0 -93
- package/dist/components/Jackpots/useJackpotItemData.d.ts +0 -20
- package/dist/components/Jackpots/useJackpotItemData.js +0 -87
- package/dist/components/KYC/AutoOpen.d.ts +0 -1
- package/dist/components/KYC/AutoOpen.js +0 -45
- package/dist/components/KYC/Header.d.ts +0 -1
- package/dist/components/KYC/Header.js +0 -8
- package/dist/components/KYC/Step1.d.ts +0 -1
- package/dist/components/KYC/Step1.js +0 -13
- package/dist/components/KYC/Step2.d.ts +0 -1
- package/dist/components/KYC/Step2.js +0 -13
- package/dist/components/KYC/Step3.d.ts +0 -1
- package/dist/components/KYC/Step3.js +0 -13
- package/dist/components/KYC/Step4.d.ts +0 -1
- package/dist/components/KYC/Step4.js +0 -7
- package/dist/components/KYC/backup/Header.d.ts +0 -1
- package/dist/components/KYC/backup/Header.js +0 -8
- package/dist/components/KYC/backup/Indicator.d.ts +0 -1
- package/dist/components/KYC/backup/Indicator.js +0 -9
- package/dist/components/KYC/backup/KYC.d.ts +0 -1
- package/dist/components/KYC/backup/KYC.js +0 -14
- package/dist/components/KYC/backup/KYC.lazy.d.ts +0 -1
- package/dist/components/KYC/backup/KYC.lazy.js +0 -26
- package/dist/components/KYC/backup/KYCContext.d.ts +0 -6
- package/dist/components/KYC/backup/KYCContext.js +0 -2
- package/dist/components/KYC/backup/Step1.d.ts +0 -1
- package/dist/components/KYC/backup/Step1.js +0 -13
- package/dist/components/KYC/backup/Step2.d.ts +0 -1
- package/dist/components/KYC/backup/Step2.js +0 -13
- package/dist/components/KYC/backup/Step3.d.ts +0 -1
- package/dist/components/KYC/backup/Step3.js +0 -13
- package/dist/components/KYC/backup/Step4.d.ts +0 -1
- package/dist/components/KYC/backup/Step4.js +0 -7
- package/dist/components/KYC/backup/useKYC.d.ts +0 -10
- package/dist/components/KYC/backup/useKYC.js +0 -8
- package/dist/components/KYC/loadModels.d.ts +0 -1
- package/dist/components/KYC/loadModels.js +0 -9
- package/dist/components/Messages/Message.d.ts +0 -1
- package/dist/components/Messages/Message.js +0 -34
- package/dist/components/Messages/MessageContext.d.ts +0 -6
- package/dist/components/Messages/MessageContext.js +0 -2
- package/dist/components/Messages/MessageItem.d.ts +0 -4
- package/dist/components/Messages/MessageItem.js +0 -34
- package/dist/components/Messages/MessagePopup.d.ts +0 -1
- package/dist/components/Messages/MessagePopup.js +0 -19
- package/dist/components/Messages/MessageTrigger.d.ts +0 -8
- package/dist/components/Messages/MessageTrigger.js +0 -19
- package/dist/components/Promo/PromoContent.d.ts +0 -2
- package/dist/components/Promo/PromoContent.js +0 -9
- package/dist/components/Promos/PromoCarousel.d.ts +0 -2
- package/dist/components/Promos/PromoCarousel.js +0 -41
- package/dist/components/Promos/PromoGrid.d.ts +0 -2
- package/dist/components/Promos/PromoGrid.js +0 -12
- package/dist/components/Promos/PromoItem.d.ts +0 -7
- package/dist/components/Promos/PromoItem.js +0 -10
- package/dist/components/Quests/CountdownTimer.d.ts +0 -15
- package/dist/components/Quests/CountdownTimer.js +0 -33
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +0 -4
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +0 -78
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +0 -8
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +0 -9
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +0 -4
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +0 -4
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +0 -4
- package/dist/components/Quests/WageringQuest/WageringQuest.js +0 -20
- package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +0 -9
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +0 -9
- package/dist/components/SignUp/SignUp.lazy.d.ts +0 -12
- package/dist/components/SignUp/SignUp.lazy.js +0 -18
- package/dist/components/SignUp/SignUpContext.d.ts +0 -6
- package/dist/components/SignUp/SignUpContext.js +0 -2
- package/dist/components/SignUp/SignUpForm.d.ts +0 -1
- package/dist/components/TournamentCounter/TournamentCounter.client.d.ts +0 -2
- package/dist/components/TournamentCounter/TournamentCounter.client.js +0 -50
- package/dist/components/TournamentCounter/TournamentCounter.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounter.js +0 -21
- package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +0 -8
- package/dist/components/TournamentCounter/TournamentCounterItem.js +0 -106
- package/dist/components/TournamentCounter/index.d.ts +0 -1
- package/dist/components/TournamentCounter/index.js +0 -1
- package/dist/components/Tournaments/TournamentDesktop.d.ts +0 -1
- package/dist/components/Tournaments/TournamentDesktop.js +0 -57
- package/dist/components/Tournaments/TournamentGameProviders.d.ts +0 -5
- package/dist/components/Tournaments/TournamentGameProviders.js +0 -38
- package/dist/components/Tournaments/TournamentItemDesktop.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemDesktop.js +0 -56
- package/dist/components/Tournaments/TournamentItemMobile.d.ts +0 -7
- package/dist/components/Tournaments/TournamentItemMobile.js +0 -54
- package/dist/components/Tournaments/TournamentMobile.d.ts +0 -1
- package/dist/components/Tournaments/TournamentMobile.js +0 -55
- package/dist/components/Tournaments/TournamentRules.d.ts +0 -5
- package/dist/components/Tournaments/TournamentRules.js +0 -11
- package/dist/components/Tournaments/Tournaments.client.d.ts +0 -2
- package/dist/components/Tournaments/Tournaments.client.js +0 -20
- package/dist/components/Tournaments/TournamentsContext.d.ts +0 -4
- package/dist/components/Tournaments/TournamentsContext.js +0 -3
- package/dist/components/Tournaments/useTournamentData.d.ts +0 -10
- package/dist/components/Tournaments/useTournamentData.js +0 -72
- package/dist/components/Tournaments/useTournamentItemData.d.ts +0 -16
- package/dist/components/Tournaments/useTournamentItemData.js +0 -64
- package/dist/components/index.d.ts +0 -33
- package/dist/components/index.js +0 -33
- package/dist/components/shared/IdDocumentField.client.d.ts +0 -25
- package/dist/components/shared/IdDocumentField.client.js +0 -204
- package/dist/components/shared/IdDocumentField.d.ts +0 -2
- package/dist/components/shared/IdDocumentField.js +0 -11
- package/dist/components/shared/SelfieField.client.d.ts +0 -20
- package/dist/components/shared/SelfieField.client.js +0 -327
- package/dist/components/shared/SelfieField.d.ts +0 -2
- package/dist/components/shared/SelfieField.js +0 -11
- package/dist/constants/BranchCode.d.ts +0 -4
- package/dist/constants/BranchCode.js +0 -42
- package/dist/constants/endpoints.d.ts +0 -10
- package/dist/constants/endpoints.js +0 -41
- package/dist/constants/envVars.d.ts +0 -5
- package/dist/constants/envVars.js +0 -28
- package/dist/constants/gameProviders.d.ts +0 -76
- package/dist/constants/gameProviders.js +0 -361
- package/dist/constants/gameTypes.d.ts +0 -3
- package/dist/constants/gameTypes.js +0 -64
- package/dist/constants/headerKeys.d.ts +0 -2
- package/dist/constants/headerKeys.js +0 -2
- package/dist/constants/secretQuestions.d.ts +0 -3
- package/dist/constants/secretQuestions.js +0 -24
- package/dist/constants/storageKeys.d.ts +0 -2
- package/dist/constants/storageKeys.js +0 -2
- package/dist/handlers.d.ts +0 -43
- package/dist/handlers.js +0 -297
- package/dist/icons/BellRingIcon.d.ts +0 -2
- package/dist/icons/BellRingIcon.js +0 -4
- package/dist/icons/index.d.ts +0 -65
- package/dist/icons/index.js +0 -65
- package/dist/images/hacksaw-gaming.png +0 -0
- package/dist/server/services/index.d.ts +0 -4
- package/dist/server/services/index.js +0 -4
- package/dist/server/utils/index.d.ts +0 -29
- package/dist/server/utils/index.js +0 -29
- package/dist/ui/Presence.d.ts +0 -2
- package/dist/ui/Presence.js +0 -7
- package/dist/ui/Prose.d.ts +0 -2
- package/dist/ui/Prose.js +0 -5
- package/dist/ui/index.d.ts +0 -26
- package/dist/ui/index.js +0 -26
- package/dist/utils/createErrorFromCode.d.ts +0 -2
- package/dist/utils/createErrorFromCode.js +0 -11
- package/dist/utils/dataUrlToBlob.d.ts +0 -1
- package/dist/utils/dataUrlToBlob.js +0 -11
- package/dist/utils/index.d.ts +0 -17
- package/dist/utils/index.js +0 -17
- package/dist/utils/isMobile.d.ts +0 -5
- package/dist/utils/isMobile.js +0 -9
- package/dist/utils/resizeImageSize.d.ts +0 -1
- package/dist/utils/resizeImageSize.js +0 -6
|
@@ -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 {
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
153
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
157
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
export interface SignInProps {
|
|
4
4
|
logo: ImageProps['src'];
|
|
5
|
-
|
|
6
|
-
/** @default '/terms-and-conditions' */
|
|
5
|
+
siteName?: string;
|
|
7
6
|
termsAndConditionsUrl?: string;
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
1
|
+
import type { SignUpDefaultProps } from './SignUpDefault/SignUpDefault.lazy';
|
|
2
2
|
import type { SignUpKYCProps } from './SignUpKYC/SignUpKYC.lazy';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
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/
|
|
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
|
-
|
|
18
|
+
}
|
|
19
|
+
else if (props.layout === 'kyc') {
|
|
19
20
|
return _jsx(SignUpKYC, { ...props });
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
else {
|
|
23
|
+
return _jsx(SignUpDefault, { ...props });
|
|
24
|
+
}
|
|
22
25
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ImageProps } from 'next/image';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import type { Branch } from '../../../types';
|
|
4
|
+
export interface SignUpDefaultProps {
|
|
5
|
+
layout: 'default';
|
|
6
|
+
logo: ImageProps['src'];
|
|
7
|
+
siteName?: string;
|
|
8
|
+
branches?: Branch[];
|
|
9
|
+
termsAndConditionsUrl?: string;
|
|
10
|
+
responsibleGamingUrl?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
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 @@
|
|
|
1
|
+
export declare function SignUpDefaultForm(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,58 +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
|
|
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 '
|
|
15
|
-
import { useCooldown } from '
|
|
16
|
-
import { useGlobalStore } from '
|
|
17
|
-
import { useLocaleInfo } from '
|
|
18
|
-
import { useMobileNumberParser } from '
|
|
19
|
-
import { useSendVerificationCodeMutation } from '
|
|
20
|
-
import { useSignInMutation } from '
|
|
21
|
-
import { useSignUpMutation } from '
|
|
22
|
-
import { useUpdateAccountMutation } from '
|
|
23
|
-
import { toaster } from '
|
|
24
|
-
import { BRANCHES } from '
|
|
25
|
-
import { ArrowLeftIcon } from '
|
|
26
|
-
import { CalendarIcon } from '
|
|
27
|
-
import { CheckIcon } from '
|
|
28
|
-
import { ChevronDownIcon } from '
|
|
29
|
-
import { ChevronLeftIcon } from '
|
|
30
|
-
import { ChevronRightIcon } from '
|
|
31
|
-
import { HelpCircleIcon } from '
|
|
32
|
-
import { ObjectType } from '
|
|
33
|
-
import { Button } from '
|
|
34
|
-
import { Checkbox } from '
|
|
35
|
-
import { DatePicker } from '
|
|
36
|
-
import { Field } from '
|
|
37
|
-
import { PinInput } from '
|
|
38
|
-
import { Select } from '
|
|
39
|
-
import { Tooltip } from '
|
|
40
|
-
import { createPoll } from '
|
|
41
|
-
import {
|
|
42
|
-
export function
|
|
43
|
-
const signUpProps =
|
|
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
|
});
|
|
48
|
+
const [step, setStep] = useState(1);
|
|
49
|
+
const router = useRouter();
|
|
49
50
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
50
|
-
|
|
51
|
+
kycReminder: ctx.kycReminder,
|
|
52
|
+
signIn: ctx.signIn,
|
|
53
|
+
signUp: ctx.signUp,
|
|
54
|
+
termsAndConditions: ctx.termsAndConditions,
|
|
55
|
+
responsibleGaming: ctx.responsibleGaming,
|
|
51
56
|
})));
|
|
52
|
-
const [step, setStep] = useState(1);
|
|
53
|
-
const dialog = useDialogContext();
|
|
54
57
|
const search = useSearchParams();
|
|
55
|
-
const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
|
|
56
58
|
const signUpMutation = useSignUpMutation();
|
|
57
59
|
const signInMutation = useSignInMutation();
|
|
58
60
|
const updateAccountMutation = useUpdateAccountMutation();
|
|
@@ -75,15 +77,19 @@ export function SignUpForm() {
|
|
|
75
77
|
if (!v) {
|
|
76
78
|
ctx.addIssue({
|
|
77
79
|
code: z.ZodIssueCode.custom,
|
|
78
|
-
message: 'You must accept the terms and conditions',
|
|
80
|
+
message: 'You must accept the terms and conditions and the responsible gaming guidelines',
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
}),
|
|
82
84
|
realName: z
|
|
83
85
|
.string()
|
|
84
|
-
.
|
|
85
|
-
.
|
|
86
|
-
|
|
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
|
+
}),
|
|
87
93
|
birthDay: z
|
|
88
94
|
.date({
|
|
89
95
|
invalid_type_error: 'Date of birth is required',
|
|
@@ -115,10 +121,13 @@ export function SignUpForm() {
|
|
|
115
121
|
mode: 'all',
|
|
116
122
|
resolver: zodResolver(Step1Definition),
|
|
117
123
|
defaultValues: {
|
|
124
|
+
realName: '',
|
|
118
125
|
mobileNumber: '',
|
|
119
|
-
termsAccepted: false,
|
|
120
126
|
branchCode: signUpProps?.branches?.[0]?.code ?? BRANCHES[0].code,
|
|
121
|
-
|
|
127
|
+
termsAccepted: globalStore.responsibleGaming.accepted &&
|
|
128
|
+
globalStore.termsAndConditions.accepted
|
|
129
|
+
? true
|
|
130
|
+
: false,
|
|
122
131
|
},
|
|
123
132
|
});
|
|
124
133
|
const step2Form = useForm({
|
|
@@ -177,15 +186,36 @@ export function SignUpForm() {
|
|
|
177
186
|
placement: 'top',
|
|
178
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) => {
|
|
179
188
|
const label = branchCollection.stringifyItem(item) ?? '';
|
|
180
|
-
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));
|
|
181
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;
|
|
182
193
|
o.field.onChange(details.checked);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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);
|
|
189
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 }) => {
|
|
190
220
|
const id = ObjectId.generate(ObjectType.MemberAccount).toString();
|
|
191
221
|
const { mobileNumber } = step1Form.getValues();
|
|
@@ -195,7 +225,6 @@ export function SignUpForm() {
|
|
|
195
225
|
mobileNumber: mobileNumberParser.format(mobileNumber),
|
|
196
226
|
verificationCode: verificationCode.join(''),
|
|
197
227
|
referralCode: search.get('referralCode') ?? undefined,
|
|
198
|
-
domain: search.get('domain') ?? undefined,
|
|
199
228
|
btag: search.get('btag') ?? undefined,
|
|
200
229
|
});
|
|
201
230
|
const name = mobileNumberParser.format(mobileNumber);
|
|
@@ -214,11 +243,12 @@ export function SignUpForm() {
|
|
|
214
243
|
}
|
|
215
244
|
}, {
|
|
216
245
|
until: (ok) => ok,
|
|
217
|
-
maxAttempt:
|
|
246
|
+
maxAttempt: 5,
|
|
218
247
|
});
|
|
219
248
|
const ok = await pollLogin();
|
|
220
249
|
if (!ok) {
|
|
221
|
-
|
|
250
|
+
globalStore.signIn.setOpen(true);
|
|
251
|
+
return;
|
|
222
252
|
}
|
|
223
253
|
else {
|
|
224
254
|
const pollUpdateAccount = createPoll(async () => {
|
|
@@ -235,14 +265,15 @@ export function SignUpForm() {
|
|
|
235
265
|
}
|
|
236
266
|
}, {
|
|
237
267
|
until: (ok) => ok,
|
|
238
|
-
maxAttempt:
|
|
268
|
+
maxAttempt: 5,
|
|
269
|
+
interval: 300,
|
|
239
270
|
});
|
|
240
271
|
await pollUpdateAccount();
|
|
241
272
|
}
|
|
242
|
-
|
|
273
|
+
globalStore.signUp.setOpen(false);
|
|
274
|
+
globalStore.kycReminder.setOpen(true);
|
|
243
275
|
step1Form.reset();
|
|
244
276
|
step2Form.reset();
|
|
245
|
-
globalStore.kyc.setOpen(true);
|
|
246
277
|
setStep(1);
|
|
247
278
|
}
|
|
248
279
|
catch (error) {
|
|
@@ -256,7 +287,7 @@ export function SignUpForm() {
|
|
|
256
287
|
o.field.onChange(details.value);
|
|
257
288
|
}, onValueComplete: () => {
|
|
258
289
|
form2Ref.current?.requestSubmit();
|
|
259
|
-
}, 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 () => {
|
|
260
291
|
await sendVerificationCodeMutation.mutateAsync({
|
|
261
292
|
channel: 'SMS',
|
|
262
293
|
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
@@ -82,13 +82,9 @@ export function SignUpForm() {
|
|
|
82
82
|
}),
|
|
83
83
|
realName: z
|
|
84
84
|
.string()
|
|
85
|
-
.
|
|
86
|
-
.
|
|
87
|
-
|
|
88
|
-
})
|
|
89
|
-
.refine((val) => val.length <= 50, {
|
|
90
|
-
message: 'Real name must not be more than 50 characters',
|
|
91
|
-
}),
|
|
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(),
|
|
92
88
|
birthDay: z
|
|
93
89
|
.date({
|
|
94
90
|
invalid_type_error: 'Date of birth is required',
|
|
@@ -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
|
-
|
|
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;
|