@opexa/portal-components 0.0.870 → 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/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 +2 -1
- package/dist/components/SignUp/SignUp.js +7 -0
- package/dist/components/SignUp/SignUpCrazyWin/SignUpCrazyWinForm.js +3 -3
- 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 +1 -1
- package/dist/constants/BranchCodes.js +1 -1
- 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/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;
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
import type { SignUpCrazyWinProps } from './SignUpCrazyWin/SignUpCrazyWin.lazy';
|
|
2
2
|
import type { SignUpDefaultProps } from './SignUpDefault/SignUpDefault.lazy';
|
|
3
|
+
import type { SignUpHappyBingoProps } from './SignUpHappyBingo/SignUpHappyBingo.lazy';
|
|
3
4
|
import type { SignUpKYCProps } from './SignUpKYC/SignUpKYC.lazy';
|
|
4
5
|
import type { SignUpNameAndPasswordProps } from './SignUpNameAndPassword/SignUpNameAndPassword.lazy';
|
|
5
|
-
export type SignUpProps = SignUpDefaultProps | SignUpKYCProps | SignUpNameAndPasswordProps | SignUpCrazyWinProps;
|
|
6
|
+
export type SignUpProps = SignUpDefaultProps | SignUpKYCProps | SignUpNameAndPasswordProps | SignUpCrazyWinProps | SignUpHappyBingoProps;
|
|
6
7
|
export declare function SignUp(props: SignUpProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -19,6 +19,10 @@ const SignUpCrazyWin = dynamic(() => import('./SignUpCrazyWin/SignUpCrazyWin.laz
|
|
|
19
19
|
ssr: false,
|
|
20
20
|
loading: () => null,
|
|
21
21
|
});
|
|
22
|
+
const SignUpHappyBingo = dynamic(() => import('./SignUpHappyBingo/SignUpHappyBingo.lazy.js').then((m) => m.SignUpHappyBingo), {
|
|
23
|
+
ssr: false,
|
|
24
|
+
loading: () => null,
|
|
25
|
+
});
|
|
22
26
|
export function SignUp(props) {
|
|
23
27
|
const touched = useGlobalStore(useShallow((ctx) => ctx.signUp['~touched']));
|
|
24
28
|
if (!touched) {
|
|
@@ -33,6 +37,9 @@ export function SignUp(props) {
|
|
|
33
37
|
else if (props.layout === 'crazywin') {
|
|
34
38
|
return _jsx(SignUpCrazyWin, { ...props });
|
|
35
39
|
}
|
|
40
|
+
else if (props.layout === 'happybingo') {
|
|
41
|
+
return _jsx(SignUpHappyBingo, { ...props });
|
|
42
|
+
}
|
|
36
43
|
else {
|
|
37
44
|
return _jsx(SignUpDefault, { ...props });
|
|
38
45
|
}
|
|
@@ -18,7 +18,7 @@ import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberPars
|
|
|
18
18
|
import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
|
|
19
19
|
import { useSignUpMutation } from '../../../client/hooks/useSignUpMutation.js';
|
|
20
20
|
import { toaster } from '../../../client/utils/toaster.js';
|
|
21
|
-
import {
|
|
21
|
+
import { SHARED_BRANCH_CODES } from '../../../constants/BranchCodes.js';
|
|
22
22
|
import { CalendarIcon } from '../../../icons/CalendarIcon.js';
|
|
23
23
|
import { CheckIcon } from '../../../icons/CheckIcon.js';
|
|
24
24
|
import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
|
|
@@ -37,7 +37,7 @@ export function SignUpCrazyWinForm() {
|
|
|
37
37
|
const signUpProps = useSignUpCrazyWinPropsContext();
|
|
38
38
|
const signUpMutation = useSignUpMutation();
|
|
39
39
|
const branchCollection = createListCollection({
|
|
40
|
-
items:
|
|
40
|
+
items: SHARED_BRANCH_CODES,
|
|
41
41
|
itemToValue: (item) => item.code,
|
|
42
42
|
itemToString: (item) => item.name,
|
|
43
43
|
});
|
|
@@ -178,7 +178,7 @@ export function SignUpCrazyWinForm() {
|
|
|
178
178
|
placement: 'bottom',
|
|
179
179
|
}, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1 text-xs", children: ["Branch Code", _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: {
|
|
180
180
|
placement: 'top',
|
|
181
|
-
}, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsx(Select.Trigger, { className: twMerge('h-10 rounded-full border-none bg-black/40 px-4 text-xs'), children: form.watch('branchCode') ? (_jsx(Select.ValueText, {})) : (_jsx("span", { className: "text-text-placeholder", children: "Select Branch Code" })) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children:
|
|
181
|
+
}, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsx(Select.Trigger, { className: twMerge('h-10 rounded-full border-none bg-black/40 px-4 text-xs'), children: form.watch('branchCode') ? (_jsx(Select.ValueText, {})) : (_jsx("span", { className: "text-text-placeholder", children: "Select Branch Code" })) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: SHARED_BRANCH_CODES.map((item) => {
|
|
182
182
|
return (_jsx(Select.Item, { item: item, children: _jsx("div", { title: item.name, className: "line-clamp-1", children: item.name }) }, item.code));
|
|
183
183
|
}) }) })] }), _jsx(Field.ErrorText, { className: "text-[#ff2525b3] text-xs", children: form.formState.errors.branchCode?.message })] }), _jsxs(Field.Root, { invalid: !!form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { className: "text-xs", children: "OTP Code" }), _jsxs("div", { className: "relative flex", children: [_jsx(Field.Input, { className: commonInputClass, placeholder: "Enter OTP code", ...form.register('verificationCode') }), _jsx("button", { type: "button", className: "-translate-y-1/2 absolute top-1/2 right-1 inline-flex h-fit w-fit items-center justify-center gap-2 rounded-full bg-[linear-gradient(89deg,#c7802d_-15.91%,#ffe585_28.75%,#ffeca6_49.46%,#c7802d_112.69%)] px-3.5 py-[0.375rem] font-semibold text-[#6c5200] text-sm shadow-[0px_-1px_2px_1px_#fff7e1_inset] [text-shadow:0px_1px_0px_rgba(255,255,255,0.9)] active:bg-[linear-gradient(89.27deg,#c7802d_-33.65%,#ffe585_12.75%,#ffeca6_80.96%,#c7802d_128.79%)] disabled:cursor-not-allowed disabled:opacity-50", style: {
|
|
184
184
|
boxShadow: 'inset 0px -1px 2px 1px #fff7e1',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ImageProps } from 'next/image';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import type { Branch } from '../../../types';
|
|
4
|
+
import type { CountryCode } from '../../../utils/countries/types';
|
|
4
5
|
export interface ClassNameEntries {
|
|
5
6
|
root?: string;
|
|
6
7
|
publicPlayProhibitionRoot?: string;
|
|
@@ -11,6 +12,7 @@ export interface SignUpDefaultProps {
|
|
|
11
12
|
logo: ImageProps['src'];
|
|
12
13
|
basicSignUp?: boolean;
|
|
13
14
|
branches?: Branch[];
|
|
15
|
+
enabledCountries?: CountryCode[];
|
|
14
16
|
termsAndConditionsUrl?: string;
|
|
15
17
|
responsibleGamingUrl?: string;
|
|
16
18
|
className?: ClassNameEntries;
|
|
@@ -10,6 +10,7 @@ import { Dialog } from '../../../ui/Dialog/index.js';
|
|
|
10
10
|
import { Portal } from '../../../ui/Portal/index.js';
|
|
11
11
|
import { SignUpDefaultPropsProvider } from './SignUpDefaultContext.js';
|
|
12
12
|
import { SignUpDefaultForm } from './SignUpDefaultForm.js';
|
|
13
|
+
import { SignUpDefaultFormInternational } from './SignUpDefaultFormInternational.js';
|
|
13
14
|
export function SignUpDefault(props) {
|
|
14
15
|
const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
|
|
15
16
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
@@ -22,5 +23,5 @@ export function SignUpDefault(props) {
|
|
|
22
23
|
// Reset checkbox state when dialog closes
|
|
23
24
|
globalStore.termsAndConditions.setAccepted(false);
|
|
24
25
|
globalStore.responsibleGaming.setAccepted(false);
|
|
25
|
-
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('mx-auto h-full w-full items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:h-auto lg:max-h-[80vh] lg:w-[400px] lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className?.root), style: { msOverflowStyle: 'none', scrollbarWidth: 'none' }, children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsx(Suspense, { children: _jsx(SignUpDefaultForm, {}) })] }) })] }) }) }));
|
|
26
|
+
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('mx-auto h-full w-full items-start overflow-y-auto bg-bg-primary-alt p-3xl pb-4xl lg:h-auto lg:max-h-[80vh] lg:w-[400px] lg:rounded-xl', 'scrollbar:h-2 scrollbar:w-2 scrollbar-thumb:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-track:bg-transparent', props.className?.root), style: { msOverflowStyle: 'none', scrollbarWidth: 'none' }, children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsx(Suspense, { children: props.enabledCountries ? (_jsx(SignUpDefaultFormInternational, {})) : (_jsx(SignUpDefaultForm, {})) })] }) })] }) }) }));
|
|
26
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SignUpDefaultFormInternational(): import("react/jsx-runtime").JSX.Element;
|