@opexa/portal-components 0.0.869 → 0.0.871
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useLocaleInfo.d.ts +1 -1
- package/dist/client/hooks/useLocaleInfo.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/GamesSearch/GamesSearch.js +10 -6
- package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.d.ts +1 -1
- package/dist/components/Jackpots/JackpotsListNext/useJackpotsListItemData.d.ts +1 -1
- package/dist/components/SignIn/MobileNumberField.d.ts +14 -0
- package/dist/components/SignIn/MobileNumberField.js +62 -0
- package/dist/components/SignIn/MobileNumberSignInternational.d.ts +1 -0
- package/dist/components/SignIn/MobileNumberSignInternational.js +266 -0
- package/dist/components/SignIn/SignIn.lazy.d.ts +2 -0
- package/dist/components/SignIn/SignInForm.js +4 -2
- package/dist/components/SignUp/SignUp.d.ts +3 -1
- package/dist/components/SignUp/SignUp.js +14 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWin.lazy.d.ts +22 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWin.lazy.js +25 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinContext.d.ts +6 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinContext.js +2 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinForm.d.ts +1 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinForm.js +282 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +2 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +2 -1
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultFormInternational.d.ts +1 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultFormInternational.js +305 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingo.lazy.d.ts +23 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingo.lazy.js +26 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoContext.d.ts +6 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoContext.js +2 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoForm.d.ts +1 -0
- package/dist/components/SignUp/SignUpHappyBingo/SignUpHappyBingoForm.js +345 -0
- package/dist/components/Tournaments/TournamentsList/useTournamentListItemData.d.ts +1 -1
- package/dist/constants/BranchCodes.d.ts +4 -0
- package/dist/constants/BranchCodes.js +38 -0
- package/dist/images/calendar-icon.webp +0 -0
- package/dist/utils/countries/countryCodeParser.d.ts +1 -0
- package/dist/utils/countries/countryCodeParser.js +9 -0
- package/dist/utils/countries/flags/AlgeriaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/AlgeriaFlag.js +3 -0
- package/dist/utils/countries/flags/ArubaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/ArubaFlag.js +2 -0
- package/dist/utils/countries/flags/AustraliaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/AustraliaFlag.js +2 -0
- package/dist/utils/countries/flags/AustriaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/AustriaFlag.js +2 -0
- package/dist/utils/countries/flags/BahrainFlag.d.ts +2 -0
- package/dist/utils/countries/flags/BahrainFlag.js +2 -0
- package/dist/utils/countries/flags/BelgiumFlag.d.ts +2 -0
- package/dist/utils/countries/flags/BelgiumFlag.js +2 -0
- package/dist/utils/countries/flags/BrazilFlag.d.ts +2 -0
- package/dist/utils/countries/flags/BrazilFlag.js +2 -0
- package/dist/utils/countries/flags/BruneiFlag.d.ts +2 -0
- package/dist/utils/countries/flags/BruneiFlag.js +2 -0
- package/dist/utils/countries/flags/CambodiaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/CambodiaFlag.js +2 -0
- package/dist/utils/countries/flags/CanadaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/CanadaFlag.js +2 -0
- package/dist/utils/countries/flags/CroatiaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/CroatiaFlag.js +2 -0
- package/dist/utils/countries/flags/CyprusFlag.d.ts +2 -0
- package/dist/utils/countries/flags/CyprusFlag.js +2 -0
- package/dist/utils/countries/flags/EgyptFlag.d.ts +2 -0
- package/dist/utils/countries/flags/EgyptFlag.js +2 -0
- package/dist/utils/countries/flags/FinlandFlag.d.ts +2 -0
- package/dist/utils/countries/flags/FinlandFlag.js +2 -0
- package/dist/utils/countries/flags/FranceFlag.d.ts +2 -0
- package/dist/utils/countries/flags/FranceFlag.js +2 -0
- package/dist/utils/countries/flags/GermanyFlag.d.ts +2 -0
- package/dist/utils/countries/flags/GermanyFlag.js +2 -0
- package/dist/utils/countries/flags/GreeceFlag.d.ts +2 -0
- package/dist/utils/countries/flags/GreeceFlag.js +2 -0
- package/dist/utils/countries/flags/GuamFlag.d.ts +2 -0
- package/dist/utils/countries/flags/GuamFlag.js +2 -0
- package/dist/utils/countries/flags/HongKongFlag.d.ts +2 -0
- package/dist/utils/countries/flags/HongKongFlag.js +2 -0
- package/dist/utils/countries/flags/HungaryFlag.d.ts +2 -0
- package/dist/utils/countries/flags/HungaryFlag.js +2 -0
- package/dist/utils/countries/flags/IndianFlag.d.ts +2 -0
- package/dist/utils/countries/flags/IndianFlag.js +2 -0
- package/dist/utils/countries/flags/IndonesianFlag.d.ts +2 -0
- package/dist/utils/countries/flags/IndonesianFlag.js +2 -0
- package/dist/utils/countries/flags/IraqFlag.d.ts +2 -0
- package/dist/utils/countries/flags/IraqFlag.js +2 -0
- package/dist/utils/countries/flags/IrelandFlag.d.ts +2 -0
- package/dist/utils/countries/flags/IrelandFlag.js +2 -0
- package/dist/utils/countries/flags/IsraelFlag.d.ts +2 -0
- package/dist/utils/countries/flags/IsraelFlag.js +2 -0
- package/dist/utils/countries/flags/ItalyFlag.d.ts +2 -0
- package/dist/utils/countries/flags/ItalyFlag.js +2 -0
- package/dist/utils/countries/flags/JapanFlag.d.ts +2 -0
- package/dist/utils/countries/flags/JapanFlag.js +2 -0
- package/dist/utils/countries/flags/JordanFlag.d.ts +2 -0
- package/dist/utils/countries/flags/JordanFlag.js +2 -0
- package/dist/utils/countries/flags/KuwaitFlag.d.ts +2 -0
- package/dist/utils/countries/flags/KuwaitFlag.js +2 -0
- package/dist/utils/countries/flags/LatviaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/LatviaFlag.js +2 -0
- package/dist/utils/countries/flags/LebanonFlag.d.ts +2 -0
- package/dist/utils/countries/flags/LebanonFlag.js +2 -0
- package/dist/utils/countries/flags/LithuaniaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/LithuaniaFlag.js +2 -0
- package/dist/utils/countries/flags/LuxembourgFlag.d.ts +2 -0
- package/dist/utils/countries/flags/LuxembourgFlag.js +2 -0
- package/dist/utils/countries/flags/MacauFlag.d.ts +2 -0
- package/dist/utils/countries/flags/MacauFlag.js +2 -0
- package/dist/utils/countries/flags/MalaysianFlag.d.ts +2 -0
- package/dist/utils/countries/flags/MalaysianFlag.js +2 -0
- package/dist/utils/countries/flags/MaltaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/MaltaFlag.js +2 -0
- package/dist/utils/countries/flags/NetherlandsFlag.d.ts +2 -0
- package/dist/utils/countries/flags/NetherlandsFlag.js +2 -0
- package/dist/utils/countries/flags/NewZealandFlag.d.ts +2 -0
- package/dist/utils/countries/flags/NewZealandFlag.js +2 -0
- package/dist/utils/countries/flags/NorthernMarianaIslandsFlag.d.ts +2 -0
- package/dist/utils/countries/flags/NorthernMarianaIslandsFlag.js +2 -0
- package/dist/utils/countries/flags/NorwayFlag.d.ts +2 -0
- package/dist/utils/countries/flags/NorwayFlag.js +2 -0
- package/dist/utils/countries/flags/OmanFlag.d.ts +2 -0
- package/dist/utils/countries/flags/OmanFlag.js +2 -0
- package/dist/utils/countries/flags/PhilippineFlag.d.ts +2 -0
- package/dist/utils/countries/flags/PhilippineFlag.js +2 -0
- package/dist/utils/countries/flags/PolandFlag.d.ts +2 -0
- package/dist/utils/countries/flags/PolandFlag.js +2 -0
- package/dist/utils/countries/flags/PortugalFlag.d.ts +2 -0
- package/dist/utils/countries/flags/PortugalFlag.js +2 -0
- package/dist/utils/countries/flags/QatarFlag.d.ts +2 -0
- package/dist/utils/countries/flags/QatarFlag.js +2 -0
- package/dist/utils/countries/flags/RomaniaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/RomaniaFlag.js +2 -0
- package/dist/utils/countries/flags/SaoTomeAndPrincipeFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SaoTomeAndPrincipeFlag.js +2 -0
- package/dist/utils/countries/flags/SaudiArabiaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SaudiArabiaFlag.js +2 -0
- package/dist/utils/countries/flags/SingaporeFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SingaporeFlag.js +2 -0
- package/dist/utils/countries/flags/SlovakiaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SlovakiaFlag.js +2 -0
- package/dist/utils/countries/flags/SouthKoreaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SouthKoreaFlag.js +2 -0
- package/dist/utils/countries/flags/SpainFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SpainFlag.js +2 -0
- package/dist/utils/countries/flags/SwedenFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SwedenFlag.js +2 -0
- package/dist/utils/countries/flags/SwitzerlandFlag.d.ts +2 -0
- package/dist/utils/countries/flags/SwitzerlandFlag.js +2 -0
- package/dist/utils/countries/flags/TaiwanFlag.d.ts +2 -0
- package/dist/utils/countries/flags/TaiwanFlag.js +2 -0
- package/dist/utils/countries/flags/TanzaniaFlag.d.ts +2 -0
- package/dist/utils/countries/flags/TanzaniaFlag.js +2 -0
- package/dist/utils/countries/flags/TrinidadAndTobagoFlag.d.ts +2 -0
- package/dist/utils/countries/flags/TrinidadAndTobagoFlag.js +2 -0
- package/dist/utils/countries/flags/TurkiyeFlag.d.ts +2 -0
- package/dist/utils/countries/flags/TurkiyeFlag.js +2 -0
- package/dist/utils/countries/flags/UnitedArabEmiratesFlag.d.ts +2 -0
- package/dist/utils/countries/flags/UnitedArabEmiratesFlag.js +2 -0
- package/dist/utils/countries/flags/UnitedKingdomFlag.d.ts +2 -0
- package/dist/utils/countries/flags/UnitedKingdomFlag.js +2 -0
- package/dist/utils/countries/flags/UnitedStatesFlag.d.ts +2 -0
- package/dist/utils/countries/flags/UnitedStatesFlag.js +2 -0
- package/dist/utils/countries/flags/UzbekistanFlag.d.ts +2 -0
- package/dist/utils/countries/flags/UzbekistanFlag.js +2 -0
- package/dist/utils/countries/flags/VietnameseFlag.d.ts +2 -0
- package/dist/utils/countries/flags/VietnameseFlag.js +2 -0
- package/dist/utils/countries/flags/index.d.ts +63 -0
- package/dist/utils/countries/flags/index.js +63 -0
- package/dist/utils/countries/getAllCountries.d.ts +24 -0
- package/dist/utils/countries/getAllCountries.js +296 -0
- package/dist/utils/countries/getLocaleInfo.d.ts +2 -0
- package/dist/utils/countries/getLocaleInfo.js +1154 -0
- package/dist/utils/countries/types.d.ts +79 -0
- package/dist/utils/countries/types.js +1 -0
- package/dist/utils/sanitizeGamesSearch.d.ts +1 -0
- package/dist/utils/sanitizeGamesSearch.js +9 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const useLocaleInfo: () => import("../../utils/
|
|
1
|
+
export declare const useLocaleInfo: () => import("../../utils/countries/types").LocaleInfo;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
3
|
view: "form" | "vca";
|
|
4
|
-
status: "
|
|
4
|
+
status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
7
7
|
deposit: import("../../../../types").Deposit | null;
|
|
@@ -14,7 +14,7 @@ export declare const OnlineBankDepositContext: (props: {
|
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
16
|
view: "form" | "vca";
|
|
17
|
-
status: "
|
|
17
|
+
status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
20
20
|
deposit: import("../../../../types").Deposit | null;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Deposit } from '../../../../types';
|
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
4
|
view: "form" | "vca";
|
|
5
|
-
status: "
|
|
5
|
+
status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
8
8
|
deposit: Deposit | null;
|
|
@@ -13,17 +13,21 @@ import { Combobox } from '../../ui/Combobox/index.js';
|
|
|
13
13
|
import { Portal } from '../../ui/Portal/index.js';
|
|
14
14
|
import { Presence } from '../../ui/Presence/index.js';
|
|
15
15
|
import { getGameImageUrl } from '../../utils/getGameImageUrl.js';
|
|
16
|
+
import { sanitizeGamesSearch } from '../../utils/sanitizeGamesSearch.js';
|
|
16
17
|
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
17
18
|
export function GamesSearch(props) {
|
|
18
19
|
const isBypass = useBypassKycChecker(props.bypassDomains);
|
|
19
|
-
const [
|
|
20
|
+
const [searchInput, setSearchInput] = useState('');
|
|
21
|
+
const sanitizedSearch = sanitizeGamesSearch(searchInput);
|
|
22
|
+
const trimmedInputLength = searchInput.trim().length;
|
|
23
|
+
const showMinLengthWarning = trimmedInputLength > 0 && trimmedInputLength < 3 && sanitizedSearch.length < 3;
|
|
20
24
|
const gamesQuery = useGamesQuery({
|
|
21
25
|
first: props.first ?? 18,
|
|
22
26
|
filter: props.filter,
|
|
23
|
-
search,
|
|
27
|
+
search: sanitizedSearch,
|
|
24
28
|
sort: props.sort,
|
|
25
29
|
}, {
|
|
26
|
-
enabled:
|
|
30
|
+
enabled: sanitizedSearch.length >= 3,
|
|
27
31
|
});
|
|
28
32
|
const games = gamesQuery.data?.pages.flatMap((page) => page.edges.map((edge) => edge.node)) ?? [];
|
|
29
33
|
const collection = createListCollection({
|
|
@@ -37,8 +41,8 @@ export function GamesSearch(props) {
|
|
|
37
41
|
return (_jsx("div", { className: classNames.root, children: _jsxs(Combobox.Root, { collection: collection, positioning: {
|
|
38
42
|
sameWidth: true,
|
|
39
43
|
placement: 'bottom',
|
|
40
|
-
}, inputValue:
|
|
41
|
-
|
|
44
|
+
}, inputValue: searchInput, onInputValueChange: (details) => {
|
|
45
|
+
setSearchInput(details.inputValue);
|
|
42
46
|
}, selectionBehavior: "preserve", allowCustomValue: true, children: [_jsxs(Combobox.Control, { className: "relative z-50", children: [_jsx(Combobox.Input, { placeholder: props.placeholder ?? 'Search' }), _jsx(Combobox.Context, { children: (api) => {
|
|
43
47
|
if (api.inputValue.length <= 0)
|
|
44
48
|
return null;
|
|
@@ -46,7 +50,7 @@ export function GamesSearch(props) {
|
|
|
46
50
|
api.setInputValue('');
|
|
47
51
|
api.focus();
|
|
48
52
|
}, children: "Clear" }));
|
|
49
|
-
} })] }), _jsx(Portal, { children: _jsx(Combobox.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsx(Presence, { present: api.open, children: _jsx("div", { className: "fixed inset-0 z-40 bg-black/50 backdrop-blur-sm", onClick: () => api.setOpen(false) }) }), _jsx(Combobox.Positioner, { children:
|
|
53
|
+
} })] }), _jsx(Portal, { children: _jsx(Combobox.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsx(Presence, { present: api.open, children: _jsx("div", { className: "fixed inset-0 z-40 bg-black/50 backdrop-blur-sm", onClick: () => api.setOpen(false) }) }), _jsx(Combobox.Positioner, { children: searchInput.trim().length > 0 && (_jsx(Combobox.Content, { className: "z-50 max-h-[33.25rem] overflow-y-auto p-0", children: showMinLengthWarning ? (_jsx(Alert, { message: "Search requires at least 3 characters." })) : (_jsxs(_Fragment, { children: [games.length <= 0 && (_jsx(Alert, { message: "No results found" })), games.length > 0 && (_jsxs("div", { className: "p-xl", children: [_jsx(Combobox.Context, { children: (api) => (_jsx("div", { className: "grid grid-cols-3 gap-1.5 lg:grid-cols-9 lg:gap-3.5", children: games.map((game) => (_jsxs(GameLaunchTrigger, { bypassKycCheck: isBypass, game: game, onClick: () => {
|
|
50
54
|
api.setOpen(false);
|
|
51
55
|
}, className: twMerge('block w-full shadow-sm', classNames.thumbnailRoot), children: [_jsx(Image, { src: getGameImageUrl({
|
|
52
56
|
reference: game.reference,
|
|
@@ -11,7 +11,7 @@ export declare function useJackpotsListItemData(): {
|
|
|
11
11
|
logo: import("next/image").ImageProps["src"];
|
|
12
12
|
name: string;
|
|
13
13
|
}[];
|
|
14
|
-
localeInfo: import("../../../utils/
|
|
14
|
+
localeInfo: import("../../../utils/countries/types").LocaleInfo;
|
|
15
15
|
isPayingOut: boolean;
|
|
16
16
|
jackpotAmount: string;
|
|
17
17
|
arrowImages: import("react/jsx-runtime").JSX.Element[];
|
|
@@ -11,7 +11,7 @@ export declare function useJackpotsListItemData(): {
|
|
|
11
11
|
logo: import("next/image").ImageProps["src"];
|
|
12
12
|
name: string;
|
|
13
13
|
}[];
|
|
14
|
-
localeInfo: import("../../../utils/
|
|
14
|
+
localeInfo: import("../../../utils/countries/types").LocaleInfo;
|
|
15
15
|
isPayingOut: boolean;
|
|
16
16
|
jackpotAmount: string;
|
|
17
17
|
arrowImages: import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { UseFormRegisterReturn } from 'react-hook-form';
|
|
3
|
+
import type { CountryCode } from '../../utils/countries/types';
|
|
4
|
+
interface MobileNumberFieldProps {
|
|
5
|
+
enabledCountries: CountryCode[];
|
|
6
|
+
setAreaCode: (areaCode: CountryCode) => void;
|
|
7
|
+
mobileNumber: string;
|
|
8
|
+
onMobileNumberChange: (value: string) => void;
|
|
9
|
+
error?: string;
|
|
10
|
+
/** Optional react-hook-form registration for the mobile number input */
|
|
11
|
+
mobileNumberRegistration?: UseFormRegisterReturn;
|
|
12
|
+
}
|
|
13
|
+
export declare const MobileNumberField: React.FC<MobileNumberFieldProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createListCollection, Popover, Portal } from '@ark-ui/react';
|
|
3
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
4
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
5
|
+
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
6
|
+
import { ChevronDownIcon } from '../../icons/ChevronDownIcon.js';
|
|
7
|
+
import { Combobox } from '../../ui/Combobox/index.js';
|
|
8
|
+
import { Field } from '../../ui/Field/index.js';
|
|
9
|
+
import { getAllUniqueCountries, getCountryDetails, } from '../../utils/countries/getAllCountries.js';
|
|
10
|
+
export const MobileNumberField = ({ enabledCountries, mobileNumber, onMobileNumberChange, setAreaCode, error, mobileNumberRegistration, }) => {
|
|
11
|
+
const localeInfo = useLocaleInfo();
|
|
12
|
+
const [selectedCountry, setSelectedCountry] = useState(getCountryDetails(localeInfo.country.code));
|
|
13
|
+
const [search, setSearch] = useState('');
|
|
14
|
+
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
|
|
15
|
+
const allCountries = useMemo(() => getAllUniqueCountries(enabledCountries), [enabledCountries]);
|
|
16
|
+
const countriesCollection = useMemo(() => countriesListCollection(allCountries), [allCountries]);
|
|
17
|
+
const handleMobileChange = useCallback((e) => {
|
|
18
|
+
onMobileNumberChange(e.target.value
|
|
19
|
+
.replaceAll(' ', '')
|
|
20
|
+
.replace(selectedCountry.areaCode, ''));
|
|
21
|
+
}, [onMobileNumberChange, selectedCountry]);
|
|
22
|
+
if (enabledCountries.length === 0) {
|
|
23
|
+
return (_jsxs(Field.Root, { invalid: !!error, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "-translate-y-1/2 absolute top-1/2 left-3.5 flex shrink-0 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, { ...(mobileNumberRegistration || {}), style: {
|
|
24
|
+
paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
25
|
+
},
|
|
26
|
+
// Avoid forcing controlled mode if RHF wants uncontrolled; still safe if value passed
|
|
27
|
+
value: mobileNumber, onChange: handleMobileChange, placeholder: "Enter mobile number" })] }), _jsx(Field.ErrorText, { children: error })] }));
|
|
28
|
+
}
|
|
29
|
+
return (_jsxs(Field.Root, { invalid: !!error, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative flex gap-2", children: [_jsxs(Popover.Root, { open: isPopoverOpen, closeOnEscape: false, closeOnInteractOutside: false, onOpenChange: () => {
|
|
30
|
+
setSearch('');
|
|
31
|
+
}, children: [_jsx(Popover.Trigger, { onClick: () => {
|
|
32
|
+
setIsPopoverOpen(!isPopoverOpen);
|
|
33
|
+
}, className: "rounded-md border border-border-primary bg-background bg-bg-primary px-3 py-2 shadow-xs transition-colors placeholder:text-text-placeholder hover:border-border-hover focus:border-border-brand focus:border-border-focus focus:shadow-brand-xs focus:outline-none", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(selectedCountry.flag, { className: "size-5" }), _jsx("span", { children: selectedCountry.areaCode }), _jsx(Popover.Indicator, { children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Popover.Positioner, { className: "w-full", children: _jsx(Popover.Content, { children: _jsx(Popover.Description, { children: isPopoverOpen && (_jsxs(Combobox.Root, { collection: countriesCollection, positioning: {
|
|
34
|
+
sameWidth: true,
|
|
35
|
+
}, value: [selectedCountry.code], onValueChange: (details) => {
|
|
36
|
+
if (details.value && details.value.length > 0) {
|
|
37
|
+
setSelectedCountry(getCountryDetails(details.value[0]));
|
|
38
|
+
setAreaCode(getCountryDetails(details.value[0]).areaCode);
|
|
39
|
+
setSearch('');
|
|
40
|
+
setIsPopoverOpen(false);
|
|
41
|
+
}
|
|
42
|
+
}, inputValue: search, onInputValueChange: (details) => {
|
|
43
|
+
setSearch(details.inputValue);
|
|
44
|
+
}, open: isPopoverOpen, onOpenChange: (details) => {
|
|
45
|
+
// Prevent combobox from closing when we want it open
|
|
46
|
+
if (isPopoverOpen && !details.open) {
|
|
47
|
+
// Don't let combobox close itself
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}, openOnClick: true, children: [_jsx(Combobox.Control, { className: "rounded-lg border-1 shadow-none outline-none", children: _jsx(Combobox.Input, { placeholder: "Search country..." }) }), _jsx(Portal, { children: _jsx(Combobox.Positioner, { style: { zIndex: 9999 }, children: _jsx(Combobox.Content, { className: "w-full", style: { zIndex: 9999 }, children: _jsx(Combobox.ItemGroup, { children: countriesCollection.items
|
|
51
|
+
.filter((country) => search === '' ||
|
|
52
|
+
country.name
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.includes(search.toLowerCase()) ||
|
|
55
|
+
country.areaCode.includes(search))
|
|
56
|
+
.map((country) => (_jsxs(Combobox.Item, { item: country, children: [_jsxs(Combobox.ItemText, { children: [_jsx(country.flag, { className: "mr-2 inline-block size-5" }), country.name, " (", country.areaCode, ")"] }), _jsx(Combobox.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, country.code))) }) }) }) })] })) }) }) })] }), _jsx(Field.Input, { ...(mobileNumberRegistration || {}), style: { paddingLeft: '0.5rem' }, value: mobileNumber, onChange: handleMobileChange, placeholder: "Enter mobile number" })] }), _jsx(Field.ErrorText, { children: error })] }));
|
|
57
|
+
};
|
|
58
|
+
const countriesListCollection = (countries) => createListCollection({
|
|
59
|
+
items: countries,
|
|
60
|
+
itemToValue: (item) => item.code,
|
|
61
|
+
itemToString: (item) => item.name,
|
|
62
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function MobileNumberSignInInternational(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Capacitor } from '@capacitor/core';
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import dynamic from 'next/dynamic';
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
import { useRouter } from 'next/navigation';
|
|
7
|
+
import { useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
9
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import invariant from 'tiny-invariant';
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { useShallow } from 'zustand/shallow';
|
|
13
|
+
import { useCooldown } from '../../client/hooks/useCooldown.js';
|
|
14
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
15
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
16
|
+
import { useSendVerificationCodeMutation } from '../../client/hooks/useSendVerificationCodeMutation.js';
|
|
17
|
+
import { useSignInMutation } from '../../client/hooks/useSignInMutation.js';
|
|
18
|
+
import { getSession } from '../../client/services/getSession.js';
|
|
19
|
+
import { deleteBiometricCredentials, getBiometricCredentials, hasSavedBiometry, saveBiometricCredentials, } from '../../client/utils/biometric.js';
|
|
20
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
21
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
22
|
+
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
23
|
+
import pagcorLogo from '../../images/pagcor-round-icon.png';
|
|
24
|
+
import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
|
|
25
|
+
import { createSingleUseToken } from '../../services/auth.js';
|
|
26
|
+
import { registerFCMDevice, unregisterFCMDevice } from '../../services/trigger.js';
|
|
27
|
+
import { Button } from '../../ui/Button/index.js';
|
|
28
|
+
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
29
|
+
import { Field } from '../../ui/Field/index.js';
|
|
30
|
+
import { PinInput } from '../../ui/PinInput/index.js';
|
|
31
|
+
import { countryCodeParser } from '../../utils/countries/countryCodeParser.js';
|
|
32
|
+
import { LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY } from '../PortalProvider/PushNotifications.js';
|
|
33
|
+
import { FacebookSignInTrigger } from './FacebookSignInTrigger.js';
|
|
34
|
+
import { MobileNumberField } from './MobileNumberField.js';
|
|
35
|
+
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
36
|
+
const GoogleSignInButton = dynamic(() => import('./GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
|
|
37
|
+
ssr: false,
|
|
38
|
+
loading: () => null,
|
|
39
|
+
});
|
|
40
|
+
const Step1Definition = (countryCode) => z.object({
|
|
41
|
+
mobileNumber: z
|
|
42
|
+
.string()
|
|
43
|
+
.min(1, 'Mobile number is required')
|
|
44
|
+
.superRefine((v, ctx) => {
|
|
45
|
+
if (!countryCodeParser(v, countryCode)) {
|
|
46
|
+
ctx.addIssue({
|
|
47
|
+
code: z.ZodIssueCode.custom,
|
|
48
|
+
message: 'Invalid mobile number',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
termsAccepted: z.boolean().superRefine((v, ctx) => {
|
|
53
|
+
if (!v) {
|
|
54
|
+
ctx.addIssue({
|
|
55
|
+
code: z.ZodIssueCode.custom,
|
|
56
|
+
message: 'You must accept the terms and conditions and the responsible gaming guidelines',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
export function MobileNumberSignInInternational() {
|
|
62
|
+
const signInProps = useSignInPropsContext();
|
|
63
|
+
const localeInfo = useLocaleInfo();
|
|
64
|
+
const [areaCode, setAreaCode] = useState(localeInfo.country.code);
|
|
65
|
+
const router = useRouter();
|
|
66
|
+
const context = useSignInContext();
|
|
67
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
68
|
+
signIn: ctx.signIn,
|
|
69
|
+
signUp: ctx.signUp,
|
|
70
|
+
kycReminder: ctx.kycReminder,
|
|
71
|
+
responsibleGaming: ctx.responsibleGaming,
|
|
72
|
+
termsAndConditions: ctx.termsAndConditions,
|
|
73
|
+
responsibleGamingReminder: ctx.responsibleGamingReminder,
|
|
74
|
+
kyc: ctx.kyc,
|
|
75
|
+
registerBiometrics: ctx.registerBiometrics,
|
|
76
|
+
disclaimer: ctx.disclaimer,
|
|
77
|
+
})));
|
|
78
|
+
const signInMutation = useSignInMutation({
|
|
79
|
+
onSuccess: async () => {
|
|
80
|
+
step1Form.reset();
|
|
81
|
+
step2Form.reset();
|
|
82
|
+
context.setStep(1);
|
|
83
|
+
globalStore.signIn.setOpen(false);
|
|
84
|
+
const session = await getSession();
|
|
85
|
+
await unregisterFCMDevice({
|
|
86
|
+
type: ['IOS', 'ANDROID'],
|
|
87
|
+
}, {
|
|
88
|
+
headers: {
|
|
89
|
+
Authorization: `Bearer ${session.token}`,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
invariant(session.status === 'authenticated');
|
|
93
|
+
if (Capacitor.isNativePlatform()) {
|
|
94
|
+
const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
|
|
95
|
+
if (pushToken) {
|
|
96
|
+
await registerFCMDevice({
|
|
97
|
+
type: Capacitor.getPlatform() === 'android' ? 'ANDROID' : 'IOS',
|
|
98
|
+
token: pushToken,
|
|
99
|
+
}, {
|
|
100
|
+
headers: {
|
|
101
|
+
Authorization: `Bearer ${session.token}`,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (signInProps.shouldShowResponsibleGamingReminder) {
|
|
107
|
+
globalStore.responsibleGamingReminder.setOpen(true);
|
|
108
|
+
}
|
|
109
|
+
if (signInProps.shouldShowDisclaimer) {
|
|
110
|
+
globalStore.disclaimer.setOpen(true);
|
|
111
|
+
}
|
|
112
|
+
if (Capacitor.isNativePlatform()) {
|
|
113
|
+
if (!hasSavedBiometry()) {
|
|
114
|
+
globalStore.registerBiometrics.setOpen(true);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
const r = await createSingleUseToken({
|
|
118
|
+
headers: {
|
|
119
|
+
Authorization: `Bearer ${session.token}`,
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
if (r.token) {
|
|
123
|
+
const credentials = await getBiometricCredentials();
|
|
124
|
+
if (!credentials) {
|
|
125
|
+
console.error({ description: 'Biometric verification failed' });
|
|
126
|
+
deleteBiometricCredentials();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const saved = await saveBiometricCredentials({
|
|
130
|
+
username: credentials.username,
|
|
131
|
+
password: r.token,
|
|
132
|
+
});
|
|
133
|
+
if (saved) {
|
|
134
|
+
console.info('Biometric credentials has been updated');
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.warn('Failed to updated biometric credentials');
|
|
138
|
+
globalStore.signIn.setOpen(!globalStore.signIn.open);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
console.error('Failed to create token');
|
|
143
|
+
globalStore.signIn.setOpen(!globalStore.signIn.open);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
onError: (err) => {
|
|
149
|
+
const errorMessage = err.name === 'Forbidden'
|
|
150
|
+
? 'Please enter the correct verification code'
|
|
151
|
+
: err.message;
|
|
152
|
+
toaster.error({
|
|
153
|
+
title: 'Sign In Failed',
|
|
154
|
+
description: errorMessage,
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
const sendVerificationCodeMutation = useSendVerificationCodeMutation({
|
|
159
|
+
onSuccess: () => {
|
|
160
|
+
context.setStep(2);
|
|
161
|
+
cooldown.start();
|
|
162
|
+
},
|
|
163
|
+
onError: (err) => {
|
|
164
|
+
toaster.error({
|
|
165
|
+
title: 'Sign In Failed',
|
|
166
|
+
description: err.message,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
const Step2Definition = z.object({
|
|
171
|
+
verificationCode: z.array(z.string()).superRefine((val, ctx) => {
|
|
172
|
+
if (val.length !== 6 || val.some((v) => v.length !== 1)) {
|
|
173
|
+
ctx.addIssue({
|
|
174
|
+
code: z.ZodIssueCode.custom,
|
|
175
|
+
message: 'Please enter your 6-digit verification code.',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}),
|
|
179
|
+
});
|
|
180
|
+
const resolver = useMemo(() => {
|
|
181
|
+
return zodResolver(Step1Definition(areaCode));
|
|
182
|
+
}, [areaCode]);
|
|
183
|
+
const step1Form = useForm({
|
|
184
|
+
resolver: resolver,
|
|
185
|
+
defaultValues: {
|
|
186
|
+
mobileNumber: '',
|
|
187
|
+
termsAccepted: globalStore.responsibleGaming.accepted &&
|
|
188
|
+
globalStore.termsAndConditions.accepted
|
|
189
|
+
? true
|
|
190
|
+
: false,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
const step2Form = useForm({
|
|
194
|
+
resolver: zodResolver(Step2Definition),
|
|
195
|
+
defaultValues: {
|
|
196
|
+
verificationCode: Array.from({ length: 6 }).fill(''),
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
const cooldown = useCooldown({
|
|
200
|
+
max: 60,
|
|
201
|
+
duration: 1000 * 60,
|
|
202
|
+
});
|
|
203
|
+
const form2Ref = useRef(null);
|
|
204
|
+
return (_jsxs(_Fragment, { children: [context.step === 1 && (_jsxs(_Fragment, { children: [_jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
205
|
+
sendVerificationCodeMutation.mutateAsync({
|
|
206
|
+
channel: 'SMS',
|
|
207
|
+
recipient: countryCodeParser(areaCode, data.mobileNumber),
|
|
208
|
+
strict: true,
|
|
209
|
+
});
|
|
210
|
+
}), children: [_jsx(MobileNumberField, { setAreaCode: setAreaCode, enabledCountries: signInProps.enabledCountries || [], mobileNumber: step1Form.watch('mobileNumber'), onMobileNumberChange: (val) => step1Form.setValue('mobileNumber', val), error: 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, { variant: "outline", colorScheme: "neutral", checked: o.field.value, onCheckedChange: (details) => {
|
|
211
|
+
if (details.checked === 'indeterminate')
|
|
212
|
+
return;
|
|
213
|
+
o.field.onChange(details.checked);
|
|
214
|
+
globalStore.termsAndConditions.setAccepted(details.checked);
|
|
215
|
+
globalStore.responsibleGaming.setAccepted(details.checked);
|
|
216
|
+
}, 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: () => {
|
|
217
|
+
if (signInProps.termsAndConditionsUrl) {
|
|
218
|
+
globalStore.signIn.setOpen(false);
|
|
219
|
+
router.push(signInProps.termsAndConditionsUrl);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
globalStore.termsAndConditions.setOpen(true);
|
|
223
|
+
globalStore.termsAndConditions.setNext('SIGN_IN');
|
|
224
|
+
}
|
|
225
|
+
}, children: "Terms of Use" }), ' ', "and", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
226
|
+
if (signInProps.responsibleGamingUrl) {
|
|
227
|
+
globalStore.signIn.setOpen(false);
|
|
228
|
+
router.push(signInProps.responsibleGamingUrl);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
globalStore.responsibleGaming.setOpen(true);
|
|
232
|
+
globalStore.responsibleGaming.setNext('SIGN_IN');
|
|
233
|
+
}
|
|
234
|
+
}, 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: () => {
|
|
235
|
+
globalStore.signIn.setOpen(false);
|
|
236
|
+
globalStore.signUp.setOpen(true);
|
|
237
|
+
}, 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: countryCodeParser(areaCode, step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
238
|
+
const { mobileNumber } = step1Form.getValues();
|
|
239
|
+
signInMutation.mutateAsync({
|
|
240
|
+
type: 'MOBILE_NUMBER',
|
|
241
|
+
mobileNumber: countryCodeParser(areaCode, mobileNumber),
|
|
242
|
+
verificationCode: verificationCode.join(''),
|
|
243
|
+
});
|
|
244
|
+
}), children: [_jsx(Controller, { name: "verificationCode", control: step2Form.control, render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsxs(PinInput.Root, { placeholder: "0", onKeyDown: (e) => {
|
|
245
|
+
if (e.key === 'Backspace') {
|
|
246
|
+
step2Form.reset();
|
|
247
|
+
}
|
|
248
|
+
}, value: o.field.value, onValueChange: (details) => {
|
|
249
|
+
o.field.onChange(details.value);
|
|
250
|
+
o.field.onBlur();
|
|
251
|
+
}, otp: true, onValueComplete: () => {
|
|
252
|
+
form2Ref.current?.requestSubmit();
|
|
253
|
+
}, 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: "font-medium text-2xl text-text-placeholder-subtle", 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.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: step2Form.formState.isSubmitting || signInMutation.isPending, 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 receive the code?" }), _jsx("button", { type: "button", className: "font-semibold text-button-secondary-fg", disabled: cooldown.cooling, onClick: async () => {
|
|
254
|
+
await sendVerificationCodeMutation.mutateAsync({
|
|
255
|
+
channel: 'SMS',
|
|
256
|
+
recipient: countryCodeParser(areaCode, step1Form.getValues('mobileNumber')),
|
|
257
|
+
});
|
|
258
|
+
cooldown.start();
|
|
259
|
+
}, children: cooldown.cooling
|
|
260
|
+
? `Resend in ${cooldown.countdown}s`
|
|
261
|
+
: 'Resend' })] }), _jsxs("button", { type: "button", className: "mx-auto mt-3xl flex w-fit items-center gap-1 font-semibold text-sm text-text-tertiary-600", onClick: () => {
|
|
262
|
+
context.setStep(1);
|
|
263
|
+
step2Form.reset();
|
|
264
|
+
cooldown.stop();
|
|
265
|
+
}, children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] })] })] }))] }));
|
|
266
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ImageProps } from 'next/image';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { CountryCode } from '../../utils/countries/types';
|
|
3
4
|
import { type UseSignInProps } from './useSignIn';
|
|
4
5
|
export interface ClassNameEntries {
|
|
5
6
|
root?: string;
|
|
@@ -9,6 +10,7 @@ export interface ClassNameEntries {
|
|
|
9
10
|
export interface SignInProps extends UseSignInProps {
|
|
10
11
|
logo: ImageProps['src'];
|
|
11
12
|
pagcorLogo?: ImageProps['src'];
|
|
13
|
+
enabledCountries?: CountryCode[];
|
|
12
14
|
responsibleGamingLogo?: ImageProps['src'];
|
|
13
15
|
siteName?: string;
|
|
14
16
|
termsAndConditionsUrl?: string;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { MobileNumberSignIn } from './MobileNumberSignIn.js';
|
|
4
|
+
import { MobileNumberSignInInternational } from './MobileNumberSignInternational.js';
|
|
4
5
|
import { NameAndPasswordSignIn } from './NameAndPasswordSignIn.js';
|
|
5
|
-
import { useSignInContext } from './SignInContext.js';
|
|
6
|
+
import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
|
|
6
7
|
import { SignInMethod } from './SignInMethod.js';
|
|
7
8
|
export function SignInForm() {
|
|
8
9
|
const context = useSignInContext();
|
|
9
|
-
|
|
10
|
+
const signInProps = useSignInPropsContext();
|
|
11
|
+
return (_jsxs(_Fragment, { children: [context.step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Log in to your account" }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Welcome back! Please enter your details." })] })), _jsx(SignInMethod, {}), context.type === 'MOBILE_NUMBER' && signInProps.enabledCountries ? (_jsx(MobileNumberSignInInternational, {})) : (_jsx(MobileNumberSignIn, {})), context.type === 'NAME_AND_PASSWORD' && _jsx(NameAndPasswordSignIn, {})] }));
|
|
10
12
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { SignUpCrazyWinProps } from './SignUpCrazyWin/SignUpCrazyWin.lazy';
|
|
1
2
|
import type { SignUpDefaultProps } from './SignUpDefault/SignUpDefault.lazy';
|
|
3
|
+
import type { SignUpHappyBingoProps } from './SignUpHappyBingo/SignUpHappyBingo.lazy';
|
|
2
4
|
import type { SignUpKYCProps } from './SignUpKYC/SignUpKYC.lazy';
|
|
3
5
|
import type { SignUpNameAndPasswordProps } from './SignUpNameAndPassword/SignUpNameAndPassword.lazy';
|
|
4
|
-
export type SignUpProps = SignUpDefaultProps | SignUpKYCProps | SignUpNameAndPasswordProps;
|
|
6
|
+
export type SignUpProps = SignUpDefaultProps | SignUpKYCProps | SignUpNameAndPasswordProps | SignUpCrazyWinProps | SignUpHappyBingoProps;
|
|
5
7
|
export declare function SignUp(props: SignUpProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -15,6 +15,14 @@ const SignUpNameAndPassword = dynamic(() => import('./SignUpNameAndPassword/Sign
|
|
|
15
15
|
ssr: false,
|
|
16
16
|
loading: () => null,
|
|
17
17
|
});
|
|
18
|
+
const SignUpCrazyWin = dynamic(() => import('./SignUpCrazyWin/SignUpCrazyWin.lazy.js').then((m) => m.SignUpCrazyWin), {
|
|
19
|
+
ssr: false,
|
|
20
|
+
loading: () => null,
|
|
21
|
+
});
|
|
22
|
+
const SignUpHappyBingo = dynamic(() => import('./SignUpHappyBingo/SignUpHappyBingo.lazy.js').then((m) => m.SignUpHappyBingo), {
|
|
23
|
+
ssr: false,
|
|
24
|
+
loading: () => null,
|
|
25
|
+
});
|
|
18
26
|
export function SignUp(props) {
|
|
19
27
|
const touched = useGlobalStore(useShallow((ctx) => ctx.signUp['~touched']));
|
|
20
28
|
if (!touched) {
|
|
@@ -26,6 +34,12 @@ export function SignUp(props) {
|
|
|
26
34
|
else if (props.layout === 'nameAndPassword') {
|
|
27
35
|
return _jsx(SignUpNameAndPassword, { ...props });
|
|
28
36
|
}
|
|
37
|
+
else if (props.layout === 'crazywin') {
|
|
38
|
+
return _jsx(SignUpCrazyWin, { ...props });
|
|
39
|
+
}
|
|
40
|
+
else if (props.layout === 'happybingo') {
|
|
41
|
+
return _jsx(SignUpHappyBingo, { ...props });
|
|
42
|
+
}
|
|
29
43
|
else {
|
|
30
44
|
return _jsx(SignUpDefault, { ...props });
|
|
31
45
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ImageProps } from 'next/image';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import type { Branch } from '../../../types';
|
|
4
|
+
export interface ClassNameEntries {
|
|
5
|
+
root?: string;
|
|
6
|
+
publicPlayProhibitionRoot?: string;
|
|
7
|
+
publicPlayProhibitionLogoContainer?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SignUpCrazyWinProps {
|
|
10
|
+
layout: 'crazywin';
|
|
11
|
+
logo: ImageProps['src'];
|
|
12
|
+
branches?: Branch[];
|
|
13
|
+
termsAndConditionsUrl?: string;
|
|
14
|
+
responsibleGamingUrl?: string;
|
|
15
|
+
className?: ClassNameEntries;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
showPublicPlayProhibition?: boolean;
|
|
18
|
+
pagcorLogo?: ImageProps['src'];
|
|
19
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
20
|
+
isRegulated?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function SignUpCrazyWin(props: SignUpCrazyWinProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { SignUpCrazyWinPropsProvider } from './SignUpCrazyWinContext.js';
|
|
12
|
+
import { SignUpCrazyWinForm } from './SignUpCrazyWinForm.js';
|
|
13
|
+
export function SignUpCrazyWin(props) {
|
|
14
|
+
const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
|
|
15
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
16
|
+
termsAndConditions: ctx.termsAndConditions,
|
|
17
|
+
responsibleGaming: ctx.responsibleGaming,
|
|
18
|
+
})));
|
|
19
|
+
return (_jsx(SignUpCrazyWinPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
|
|
20
|
+
signUpStore.setOpen(details.open);
|
|
21
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
22
|
+
globalStore.termsAndConditions.setAccepted(false);
|
|
23
|
+
globalStore.responsibleGaming.setAccepted(false);
|
|
24
|
+
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('h-full w-full lg:mx-auto lg:grid lg:h-[50rem] lg:w-[44.25rem] lg:grid-cols-2', props.className?.root), children: [_jsx("div", { className: "hidden h-full overflow-hidden rounded-l-xl lg:block", children: _jsx(Image, { src: "https://assets.opexacms.atalos.io/hd48QiKmacXs1XWnY", alt: "login banner", width: 1000, height: 1000, className: "h-full w-full", draggable: false }) }), _jsxs("div", { className: 'border-white/10 bg-[radial-gradient(103.87%_100%_at_50.15%_0%,_#072b37_20.3%,_#051125_100%)] backdrop-blur-[25px] lg:rounded-r-xl', children: [_jsx(Dialog.CloseTrigger, { className: "md:-right-10 -top-15 absolute right-2 z-10 size-5.5 rounded-md bg-gradient-to-t from-[#FFE5AF] to-[#EAC467] p-0.5", children: _jsx(XIcon, { className: "h-4.5 w-4.5 text-[#6C5200]" }) }), _jsx(Suspense, { children: _jsx(SignUpCrazyWinForm, {}) })] })] }) })] }) }) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SignUpCrazyWinProps } from './SignUpCrazyWin.lazy';
|
|
2
|
+
export declare const SignUpCrazyWinPropsProvider: (props: {
|
|
3
|
+
value: SignUpCrazyWinProps;
|
|
4
|
+
} & {
|
|
5
|
+
children?: import("react").ReactNode | undefined;
|
|
6
|
+
}) => React.ReactNode, useSignUpCrazyWinPropsContext: () => SignUpCrazyWinProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SignUpCrazyWinForm(): import("react/jsx-runtime").JSX.Element;
|