@opexa/portal-components 0.0.189 β 0.0.192
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/index.d.ts +65 -0
- package/dist/client/hooks/index.js +65 -0
- package/dist/client/hooks/useCreateLibanganDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useCreateLibanganDepositMutation.js +73 -0
- package/dist/client/hooks/useCreateVentajaWithdrawalMutation.d.ts +4 -0
- package/dist/client/hooks/useCreateVentajaWithdrawalMutation.js +28 -0
- package/dist/client/services/index.d.ts +4 -0
- package/dist/client/services/index.js +4 -0
- package/dist/client/utils/index.d.ts +3 -0
- package/dist/client/utils/index.js +3 -0
- package/dist/components/Bonus/Bonus.client.js +1 -1
- package/dist/components/Cashback/Cashback.client.js +1 -1
- package/dist/components/CustomPromo/CustomPromo.js +1 -1
- package/dist/components/DepositWithdrawal/Deposit/Deposit.js +8 -1
- package/dist/components/DepositWithdrawal/Deposit/LibanganDeposit/LibanganDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/LibanganDeposit/LibanganDeposit.js +175 -0
- package/dist/components/DepositWithdrawal/PaymentMethods.js +7 -1
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +154 -0
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +8 -1
- package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
- package/dist/components/DepositWithdrawal/utils.js +2 -0
- package/dist/components/Empty.d.ts +10 -0
- package/dist/components/Empty.js +7 -0
- package/dist/components/GameLaunch/GameLaunch.lazy.js +1 -1
- package/dist/components/GameProviders/GameProvidersList.js +1 -1
- package/dist/components/Games/GameContext.d.ts +2 -0
- package/dist/components/Games/GameContext.js +2 -0
- package/dist/components/GamesSearch/GamesSearch.js +1 -1
- package/dist/components/InfiniteScroll.d.ts +10 -0
- package/dist/components/InfiniteScroll.js +25 -0
- package/dist/components/JackpotCounter/JackpotCounter.client.d.ts +2 -0
- package/dist/components/JackpotCounter/JackpotCounter.client.js +66 -0
- package/dist/components/JackpotCounter/JackpotCounter.d.ts +17 -0
- package/dist/components/JackpotCounter/JackpotCounter.js +21 -0
- package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +18 -0
- package/dist/components/JackpotCounter/JackpotCounterItem.js +109 -0
- package/dist/components/JackpotCounter/JackpotCounterItem.module.css +184 -0
- package/dist/components/JackpotCounter/index.d.ts +1 -0
- package/dist/components/JackpotCounter/index.js +1 -0
- package/dist/components/Jackpots/JackpotDesktop.d.ts +1 -0
- package/dist/components/Jackpots/JackpotDesktop.js +45 -0
- package/dist/components/Jackpots/JackpotGameProviders.d.ts +5 -0
- package/dist/components/Jackpots/JackpotGameProviders.js +41 -0
- package/dist/components/Jackpots/JackpotItemDesktop.d.ts +9 -0
- package/dist/components/Jackpots/JackpotItemDesktop.js +43 -0
- package/dist/components/Jackpots/JackpotItemMobile.d.ts +9 -0
- package/dist/components/Jackpots/JackpotItemMobile.js +44 -0
- package/dist/components/Jackpots/JackpotMobile.d.ts +1 -0
- package/dist/components/Jackpots/JackpotMobile.js +46 -0
- package/dist/components/Jackpots/JackpotRules.d.ts +5 -0
- package/dist/components/Jackpots/JackpotRules.js +11 -0
- package/dist/components/Jackpots/Jackpots.client.d.ts +2 -0
- package/dist/components/Jackpots/Jackpots.client.js +29 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsContext.d.ts +4 -0
- package/dist/components/Jackpots/JackpotsContext.js +3 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItemGameProviders.js +1 -1
- package/dist/components/Jackpots/useJackpotData.d.ts +14 -0
- package/dist/components/Jackpots/useJackpotData.js +93 -0
- package/dist/components/Jackpots/useJackpotItemData.d.ts +20 -0
- package/dist/components/Jackpots/useJackpotItemData.js +87 -0
- package/dist/components/KYC/Header.d.ts +1 -0
- package/dist/components/KYC/Header.js +6 -0
- package/dist/components/KYC/Step1.d.ts +1 -0
- package/dist/components/KYC/Step1.js +12 -0
- package/dist/components/KYC/Step2.d.ts +1 -0
- package/dist/components/KYC/Step2.js +12 -0
- package/dist/components/KYC/Step3.d.ts +1 -0
- package/dist/components/KYC/Step3.js +11 -0
- package/dist/components/KYC/Step4.d.ts +1 -0
- package/dist/components/KYC/Step4.js +6 -0
- package/dist/components/KYC/backup/KYCContext.d.ts +1 -5
- package/dist/components/KYC/utils.js +18 -18
- package/dist/components/Messages/MessageContext.d.ts +1 -5
- package/dist/components/Messages/MessageItem.d.ts +4 -0
- package/dist/components/Messages/MessageItem.js +34 -0
- package/dist/components/News/News.js +1 -1
- package/dist/components/Promo/Promo.client.js +1 -1
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +1 -1
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +5 -10
- package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +3 -4
- package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +1 -1
- package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +1 -1
- package/dist/components/Quests/WageringQuest/WageringQuest.js +2 -3
- package/dist/components/Quests/WageringQuest/WageringQuestModal.js +3 -4
- package/dist/components/Search/Search.lazy.js +2 -2
- package/dist/components/SignUp/SignUpDefault/SignUpForm.js +1 -2
- package/dist/components/SignUp/SignUpForm.js +1 -2
- package/dist/components/TournamentCounter/TournamentCounter.client.d.ts +2 -0
- package/dist/components/TournamentCounter/TournamentCounter.client.js +50 -0
- package/dist/components/TournamentCounter/TournamentCounter.d.ts +8 -0
- package/dist/components/TournamentCounter/TournamentCounter.js +21 -0
- package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +8 -0
- package/dist/components/TournamentCounter/TournamentCounterItem.js +106 -0
- package/dist/components/TournamentCounter/index.d.ts +1 -0
- package/dist/components/TournamentCounter/index.js +1 -0
- package/dist/components/Tournaments/TournamentDesktop.d.ts +1 -0
- package/dist/components/Tournaments/TournamentDesktop.js +57 -0
- package/dist/components/Tournaments/TournamentGameProviders.d.ts +5 -0
- package/dist/components/Tournaments/TournamentGameProviders.js +38 -0
- package/dist/components/Tournaments/TournamentItemDesktop.d.ts +7 -0
- package/dist/components/Tournaments/TournamentItemDesktop.js +56 -0
- package/dist/components/Tournaments/TournamentItemMobile.d.ts +7 -0
- package/dist/components/Tournaments/TournamentItemMobile.js +54 -0
- package/dist/components/Tournaments/TournamentMobile.d.ts +1 -0
- package/dist/components/Tournaments/TournamentMobile.js +55 -0
- package/dist/components/Tournaments/TournamentRules.d.ts +5 -0
- package/dist/components/Tournaments/TournamentRules.js +11 -0
- package/dist/components/Tournaments/Tournaments.client.d.ts +2 -0
- package/dist/components/Tournaments/Tournaments.client.js +20 -0
- package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsContext.d.ts +4 -0
- package/dist/components/Tournaments/TournamentsContext.js +3 -0
- package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
- package/dist/components/Tournaments/TournamentsList/TournamentsListItemGameProviders.js +1 -1
- package/dist/components/Tournaments/useTournamentData.d.ts +10 -0
- package/dist/components/Tournaments/useTournamentData.js +72 -0
- package/dist/components/Tournaments/useTournamentItemData.d.ts +16 -0
- package/dist/components/Tournaments/useTournamentItemData.js +64 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +33 -0
- package/dist/constants/envVars.d.ts +5 -0
- package/dist/constants/envVars.js +28 -0
- package/dist/constants/gameProviders.d.ts +5 -0
- package/dist/constants/gameProviders.js +362 -0
- package/dist/constants/gameTypes.d.ts +4 -0
- package/dist/constants/gameTypes.js +64 -0
- package/dist/constants/headerKeys.d.ts +1 -0
- package/dist/constants/headerKeys.js +1 -0
- package/dist/constants/secretQuestions.d.ts +3 -0
- package/dist/constants/secretQuestions.js +24 -0
- package/dist/constants/storageKeys.d.ts +2 -0
- package/dist/constants/storageKeys.js +2 -0
- package/dist/icons/index.d.ts +65 -0
- package/dist/icons/index.js +65 -0
- package/dist/images/hacksaw-gaming.png +0 -0
- package/dist/images/libangan.png +0 -0
- package/dist/server/services/index.d.ts +4 -0
- package/dist/server/services/index.js +4 -0
- package/dist/server/utils/index.d.ts +29 -0
- package/dist/server/utils/index.js +29 -0
- package/dist/services/queries.d.ts +5 -3
- package/dist/services/queries.js +2436 -2357
- package/dist/services/wallet.d.ts +33 -0
- package/dist/services/wallet.js +21 -1
- package/dist/styles/theme.css +693 -693
- package/dist/types/index.d.ts +2 -0
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +8 -8
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +90 -90
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Presence.d.ts +2 -0
- package/dist/ui/Presence.js +7 -0
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/Prose.d.ts +2 -0
- package/dist/ui/Prose.js +5 -0
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
- package/dist/ui/index.d.ts +26 -0
- package/dist/ui/index.js +26 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/isMobile.d.ts +5 -0
- package/dist/utils/isMobile.js +9 -0
- package/dist/utils/mutationKeys.d.ts +2 -0
- package/dist/utils/mutationKeys.js +8 -0
- package/dist/utils/resizeImageSize.d.ts +0 -1
- package/dist/utils/resizeImageSize.js +0 -5
- package/package.json +164 -164
- package/dist/components/KYC/loadModels.d.ts +0 -1
- package/dist/components/KYC/loadModels.js +0 -9
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +0 -198
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +0 -251
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +0 -10
- package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +0 -41
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +0 -1
- package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +0 -429
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +0 -13
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +0 -26
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +0 -7
- package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +0 -2
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +0 -11
- package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +0 -20
- package/dist/constants/BranchCode.d.ts +0 -4
- package/dist/constants/BranchCode.js +0 -42
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createListCollection } from '@ark-ui/react/collection';
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { useShallow } from 'zustand/shallow';
|
|
9
|
+
import { useCreateVentajaWithdrawalMutation } from '../../../../client/hooks/useCreateVentajaWithdrawalMutation.js';
|
|
10
|
+
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
11
|
+
import { useInstapayBankListQuery } from '../../../../client/hooks/useInstapayBankListQuery.js';
|
|
12
|
+
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
13
|
+
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
14
|
+
import { CheckIcon } from '../../../../icons/CheckIcon.js';
|
|
15
|
+
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
16
|
+
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
17
|
+
import { EyeIcon } from '../../../../icons/EyeIcon.js';
|
|
18
|
+
import { EyeOffIcon } from '../../../../icons/EyeOffIcon.js';
|
|
19
|
+
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
20
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
21
|
+
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
22
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
23
|
+
import { Field } from '../../../../ui/Field/index.js';
|
|
24
|
+
import { NumberInput } from '../../../../ui/NumberInput/index.js';
|
|
25
|
+
import { PasswordInput } from '../../../../ui/PasswordInput/index.js';
|
|
26
|
+
import { Portal } from '../../../../ui/Portal/index.js';
|
|
27
|
+
import { Select } from '../../../../ui/Select/index.js';
|
|
28
|
+
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
29
|
+
import { AmountChoices } from '../../AmountChoices.js';
|
|
30
|
+
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
31
|
+
export function VentajaWithdrawal() {
|
|
32
|
+
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
33
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
34
|
+
depositWithdrawal: ctx.depositWithdrawal,
|
|
35
|
+
})));
|
|
36
|
+
const [status, setStatus] = useState('waiting');
|
|
37
|
+
const createWithdrawalMutation = useCreateVentajaWithdrawalMutation({
|
|
38
|
+
onMutate() {
|
|
39
|
+
setStatus('processing');
|
|
40
|
+
},
|
|
41
|
+
onSuccess() {
|
|
42
|
+
form.reset();
|
|
43
|
+
setStatus('success');
|
|
44
|
+
},
|
|
45
|
+
onError() {
|
|
46
|
+
setStatus('failed');
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const instapayBankListQuery = useInstapayBankListQuery();
|
|
50
|
+
const instapayBankList = instapayBankListQuery.data;
|
|
51
|
+
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
52
|
+
const paymentSettings = paymentSettingsQuery.data;
|
|
53
|
+
const gatewaySettings = paymentSettings?.instapayWithdrawalGatewaySettings;
|
|
54
|
+
const minimumAmount = parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
55
|
+
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
56
|
+
const definition = z.object({
|
|
57
|
+
amount: z.string().superRefine((val, ctx) => {
|
|
58
|
+
const n = parseDecimal(val, 0);
|
|
59
|
+
if (n < minimumAmount) {
|
|
60
|
+
ctx.addIssue({
|
|
61
|
+
type: 'number',
|
|
62
|
+
code: z.ZodIssueCode.too_small,
|
|
63
|
+
inclusive: true,
|
|
64
|
+
minimum: minimumAmount,
|
|
65
|
+
message: `Minimum amount is ${minimumAmount.toLocaleString()}`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (n > maximumAmount) {
|
|
69
|
+
ctx.addIssue({
|
|
70
|
+
type: 'number',
|
|
71
|
+
code: z.ZodIssueCode.too_big,
|
|
72
|
+
inclusive: true,
|
|
73
|
+
maximum: maximumAmount,
|
|
74
|
+
message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
password: z
|
|
79
|
+
.string()
|
|
80
|
+
.min(8, 'Password must be 8 or more characters')
|
|
81
|
+
.max(64, 'Password must be not be more than 64 characters'),
|
|
82
|
+
accountNumber: z.string().min(1).trim(),
|
|
83
|
+
bankCode: z.string().min(1, 'Bank is required').trim(),
|
|
84
|
+
});
|
|
85
|
+
const form = useForm({
|
|
86
|
+
mode: 'all',
|
|
87
|
+
resolver: zodResolver(definition),
|
|
88
|
+
defaultValues: {
|
|
89
|
+
amount: '0',
|
|
90
|
+
password: '',
|
|
91
|
+
accountNumber: '',
|
|
92
|
+
bankCode: '',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (minimumAmount) {
|
|
97
|
+
form.reset({
|
|
98
|
+
amount: minimumAmount.toString(),
|
|
99
|
+
bankCode: form.getValues('bankCode'),
|
|
100
|
+
password: '',
|
|
101
|
+
accountNumber: '',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, [form, minimumAmount]);
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if (instapayBankList?.length) {
|
|
107
|
+
form.reset({
|
|
108
|
+
amount: form.getValues('amount'),
|
|
109
|
+
bankCode: instapayBankList[0].code,
|
|
110
|
+
password: '',
|
|
111
|
+
accountNumber: '',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, [form, instapayBankList]);
|
|
115
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
116
|
+
createWithdrawalMutation.mutate({
|
|
117
|
+
amount: data.amount,
|
|
118
|
+
transactionPassword: data.password,
|
|
119
|
+
accountNumber: data.accountNumber,
|
|
120
|
+
bankCode: data.bankCode,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
const bankCollection = useMemo(() => createListCollection({
|
|
124
|
+
items: instapayBankList ?? [],
|
|
125
|
+
itemToValue: (item) => item.code,
|
|
126
|
+
itemToString: (item) => item.name,
|
|
127
|
+
}), [instapayBankList]);
|
|
128
|
+
console.log(bankCollection.items);
|
|
129
|
+
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsx(Controller, { control: form.control, name: "bankCode", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.bankCode, children: [_jsxs(Select.Root, { collection: bankCollection, positioning: {
|
|
130
|
+
sameWidth: true,
|
|
131
|
+
}, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
|
|
132
|
+
o.field.onChange(details.value.at(0) ?? '');
|
|
133
|
+
}, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item.id))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
134
|
+
o.field.onChange(details.value);
|
|
135
|
+
}, formatOptions: {
|
|
136
|
+
maximumFractionDigits: 2,
|
|
137
|
+
minimumFractionDigits: 0,
|
|
138
|
+
}, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
|
|
139
|
+
form.setValue('amount', value.toString(), {
|
|
140
|
+
shouldTouch: true,
|
|
141
|
+
shouldDirty: true,
|
|
142
|
+
shouldValidate: true,
|
|
143
|
+
});
|
|
144
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
|
|
145
|
+
if (!details.open) {
|
|
146
|
+
setStatus('waiting');
|
|
147
|
+
}
|
|
148
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
149
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
150
|
+
'Your withdrawal request has been submitted successfully and is awaiting confirmation. You wonβt have to wait long β once approved, the funds will be credited to your account.', status === 'failed' &&
|
|
151
|
+
'Something went wrong while processing your withdrawal. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
152
|
+
api.setOpen(false);
|
|
153
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
154
|
+
}
|
|
@@ -18,6 +18,7 @@ import { GCashWithdrawal } from './GCashWithdrawal/GCashWithdrawal.js';
|
|
|
18
18
|
import { InstapayWithdrawal } from './InstapayWithdrawal/InstapayWithdrawal.js';
|
|
19
19
|
import { MayaAppWithdrawal } from './MayaAppWithdrawal/MayaAppWithdrawal.js';
|
|
20
20
|
import { MayaWithdrawal } from './MayaWithdrawal/MayaWithdrawal.js';
|
|
21
|
+
import { VentajaWithdrawal } from './VentajaWithdrawal/VentajaWithdrawal.js';
|
|
21
22
|
export function Withdrawal() {
|
|
22
23
|
const [onMMA] = useOnMMA();
|
|
23
24
|
const walletQuery = useWalletQuery();
|
|
@@ -45,6 +46,9 @@ export function Withdrawal() {
|
|
|
45
46
|
if (paymentSettings?.instapayWithdrawalGatewaySettings?.mobileWebEnabled) {
|
|
46
47
|
l.push('INSTAPAY');
|
|
47
48
|
}
|
|
49
|
+
if (paymentSettings?.ventajaWithdrawalGatewaySettings?.mobileWebEnabled) {
|
|
50
|
+
l.push('VENTAJA');
|
|
51
|
+
}
|
|
48
52
|
}
|
|
49
53
|
else {
|
|
50
54
|
if (paymentSettings?.gcashWithdrawalGatewaySettings?.webEnabled) {
|
|
@@ -56,6 +60,9 @@ export function Withdrawal() {
|
|
|
56
60
|
if (paymentSettings?.instapayWithdrawalGatewaySettings?.mobileWebEnabled) {
|
|
57
61
|
l.push('INSTAPAY');
|
|
58
62
|
}
|
|
63
|
+
if (paymentSettings?.ventajaWithdrawalGatewaySettings?.mobileWebEnabled) {
|
|
64
|
+
l.push('VENTAJA');
|
|
65
|
+
}
|
|
59
66
|
}
|
|
60
67
|
return l;
|
|
61
68
|
})();
|
|
@@ -89,7 +96,7 @@ export function Withdrawal() {
|
|
|
89
96
|
if (enabledPaymentMethods.length <= 0) {
|
|
90
97
|
return _jsx(NoAvailablePaymentMethods, {});
|
|
91
98
|
}
|
|
92
|
-
return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {})] }));
|
|
99
|
+
return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {}), paymentMethod === 'VENTAJA' && _jsx(VentajaWithdrawal, {})] }));
|
|
93
100
|
}
|
|
94
101
|
function TransactionPasswordNotSet() {
|
|
95
102
|
return (_jsxs("div", { className: "pt-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Transaction Password Not Set" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "To proceed with withdrawals, you must first set up a transaction password. This ensures the security of your account and transactions." })] }));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY"]>;
|
|
2
|
+
export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN", "VENTAJA"]>;
|
|
3
3
|
export type PaymentMethod = z.infer<typeof PaymentMethodDefinition>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentProps, ComponentType } from 'react';
|
|
2
|
+
interface EmptyProps {
|
|
3
|
+
icon: ComponentType<ComponentProps<'svg'>>;
|
|
4
|
+
title: string;
|
|
5
|
+
message: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Empty(props: EmptyProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function Empty(props) {
|
|
3
|
+
return (_jsxs("div", { role: "alert", "aria-live": "polite", style: props.style, className: props.className, children: [_jsxs("div", { className: "relative mx-auto w-[9.5rem] pt-4", children: [_jsx("div", { className: "bg-utility-gray-200 absolute left-1/2 top-0 size-[6.5rem] -translate-x-1/2 rounded-full" }), _jsx(CloudIcon, { className: "relative h-auto w-full shrink-0" }), _jsx("div", { className: "bg-utility-gray-200/40 absolute bottom-2 left-1/2 flex size-12 -translate-x-1/2 items-center justify-center rounded-full backdrop-blur-sm", children: _jsx(props.icon, { className: "size-6 text-white" }) }), _jsx("div", { className: "bg-utility-gray-200 absolute left-4 top-3.5 size-2.5 rounded-full" }), _jsx("div", { className: "bg-utility-gray-200 absolute bottom-0.5 left-3 size-3.5 rounded-full" }), _jsx("div", { className: "bg-utility-gray-200 absolute right-3.5 top-1 size-2 rounded-full" }), _jsx("div", { className: "bg-utility-gray-200 absolute right-0 top-6.5 size-3.5 rounded-full" })] }), _jsx("h2", { className: "mt-xl text-center font-semibold", children: props.title }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: props.message })] }));
|
|
4
|
+
}
|
|
5
|
+
function CloudIcon(props) {
|
|
6
|
+
return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 152 104", fill: "none", ...props, children: [_jsxs("g", { filter: "url(#filter0_dd_2719_19242)", children: [_jsx("path", { d: "M77.6 0C66.8273 0 57.2978 5.32329 51.4987 13.4829C49.605 13.0363 47.6301 12.8 45.6 12.8C31.4615 12.8 20 24.2615 20 38.4C20 52.5385 31.4615 64 45.6 64L109.6 64C121.971 64 132 53.9712 132 41.6C132 29.2288 121.971 19.2 109.6 19.2C108.721 19.2 107.854 19.2506 107.002 19.349C102.098 7.9677 90.7797 0 77.6 0Z", fill: "#F9FAFB" }), _jsx("ellipse", { cx: "45.6", cy: "38.4008", rx: "25.6", ry: "25.6", fill: "url(#paint0_linear_2719_19242)" }), _jsx("circle", { cx: "77.6", cy: "32", r: "32", fill: "url(#paint1_linear_2719_19242)" }), _jsx("ellipse", { cx: "109.6", cy: "41.5992", rx: "22.4", ry: "22.4", fill: "url(#paint2_linear_2719_19242)" })] }), _jsxs("defs", { children: [_jsxs("filter", { id: "filter0_dd_2719_19242", x: "0", y: "0", width: "152", height: "104", filterUnits: "userSpaceOnUse", colorInterpolationFilters: "sRGB", children: [_jsx("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }), _jsx("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), _jsx("feMorphology", { radius: "4", operator: "erode", in: "SourceAlpha", result: "effect1_dropShadow_2719_19242" }), _jsx("feOffset", { dy: "8" }), _jsx("feGaussianBlur", { stdDeviation: "4" }), _jsx("feComposite", { in2: "hardAlpha", operator: "out" }), _jsx("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.03 0" }), _jsx("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_2719_19242" }), _jsx("feColorMatrix", { in: "SourceAlpha", type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", result: "hardAlpha" }), _jsx("feMorphology", { radius: "4", operator: "erode", in: "SourceAlpha", result: "effect2_dropShadow_2719_19242" }), _jsx("feOffset", { dy: "20" }), _jsx("feGaussianBlur", { stdDeviation: "12" }), _jsx("feComposite", { in2: "hardAlpha", operator: "out" }), _jsx("feColorMatrix", { type: "matrix", values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.08 0" }), _jsx("feBlend", { mode: "normal", in2: "effect1_dropShadow_2719_19242", result: "effect2_dropShadow_2719_19242" }), _jsx("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect2_dropShadow_2719_19242", result: "shape" })] }), _jsxs("linearGradient", { id: "paint0_linear_2719_19242", x1: "25.9429", y1: "21.4865", x2: "71.2", y2: "64.0007", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#D0D5DD" }), _jsx("stop", { offset: "0.350715", stopColor: "white", stopOpacity: "0" })] }), _jsxs("linearGradient", { id: "paint1_linear_2719_19242", x1: "53.0286", y1: "10.8571", x2: "109.6", y2: "64", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#D0D5DD" }), _jsx("stop", { offset: "0.350715", stopColor: "white", stopOpacity: "0" })] }), _jsxs("linearGradient", { id: "paint2_linear_2719_19242", x1: "92.4", y1: "26.7992", x2: "132", y2: "63.9992", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#D0D5DD" }), _jsx("stop", { offset: "0.350715", stopColor: "white", stopOpacity: "0" })] })] })] }));
|
|
7
|
+
}
|
|
@@ -22,7 +22,7 @@ import { AlertDialog } from '../../ui/AlertDialog/index.js';
|
|
|
22
22
|
import { Button } from '../../ui/Button/index.js';
|
|
23
23
|
import { IconButton } from '../../ui/IconButton/index.js';
|
|
24
24
|
import { Portal } from '../../ui/Portal/index.js';
|
|
25
|
-
import { Presence } from '../../ui/Presence
|
|
25
|
+
import { Presence } from '../../ui/Presence.js';
|
|
26
26
|
export function GameLaunch() {
|
|
27
27
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
28
28
|
gameLaunch: ctx.gameLaunch,
|
|
@@ -22,5 +22,5 @@ export function GameProvidersList(props) {
|
|
|
22
22
|
? { root: props.className }
|
|
23
23
|
: (props.className ?? {});
|
|
24
24
|
const chunked = useChunk(gameProviders, 18);
|
|
25
|
-
return (_jsxs("div", { className: classNames.root, children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Providers' }), _jsx("div", { className: "mt-lg grid grid-cols-3 gap-1.5 lg:grid-cols-6 lg:gap-2.5", children: chunked.loadedItems.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), className: twMerge('bg-
|
|
25
|
+
return (_jsxs("div", { className: classNames.root, children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Providers' }), _jsx("div", { className: "mt-lg grid grid-cols-3 gap-1.5 lg:grid-cols-6 lg:gap-2.5", children: chunked.loadedItems.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), className: twMerge('bg-brand-800 flex h-full w-full items-center overflow-hidden rounded-md lg:h-[5.75rem]', classNames.thumbnailRoot), "aria-label": `View ${provider.name} games`, children: _jsx(Image, { src: props.gameProviderImages?.[provider.id] ?? provider.logo, alt: "", width: 300, height: 150, className: twMerge('mx-auto h-auto w-full', classNames.thumbnailImage) }) }, provider.id))) }), _jsxs("div", { className: "mt-2xl flex flex-col items-center lg:mt-3xl", children: [_jsx(Progress.Root, { min: 0, max: chunked.totalItems, value: chunked.totalLoadedItems, onValueChange: noop, className: "w-[12.5rem]", children: _jsx(Progress.Track, { className: "bg-bg-tertiary", children: _jsx(Progress.Range, {}) }) }), _jsx("p", { className: "text-button-tertiary-fg mt-md text-sm", children: `Displaying ${chunked.totalLoadedItems} of ${chunked.totalItems}` }), chunked.hasNext && (_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, onClick: chunked.next, className: "mt-lg", children: "Load More" }))] })] }));
|
|
26
26
|
}
|
|
@@ -8,7 +8,7 @@ import { SearchLgIcon } from '../../icons/SearchLgIcon.js';
|
|
|
8
8
|
import { Button } from '../../ui/Button/index.js';
|
|
9
9
|
import { Combobox } from '../../ui/Combobox/index.js';
|
|
10
10
|
import { Portal } from '../../ui/Portal/index.js';
|
|
11
|
-
import { Presence } from '../../ui/Presence
|
|
11
|
+
import { Presence } from '../../ui/Presence.js';
|
|
12
12
|
import { getGameImageUrl } from '../../utils/getGameImageUrl.js';
|
|
13
13
|
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
14
14
|
export function GamesSearch(props) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface InfiniteScrollProps {
|
|
3
|
+
loader?: ReactNode;
|
|
4
|
+
hasMore?: boolean;
|
|
5
|
+
loadMore: () => Promise<void> | void;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function InfiniteScroll(props: InfiniteScrollProps): 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 { Fragment } from 'react';
|
|
4
|
+
import { useBoolean, useDebounceCallback, useIntersectionObserver, } from 'usehooks-ts';
|
|
5
|
+
export function InfiniteScroll(props) {
|
|
6
|
+
const { value: loading, setValue: setLoading } = useBoolean(false);
|
|
7
|
+
const loader = props.loader ?? null;
|
|
8
|
+
const hasMore = props.hasMore ?? false;
|
|
9
|
+
const loadMore = useDebounceCallback(async () => {
|
|
10
|
+
if (loading)
|
|
11
|
+
return;
|
|
12
|
+
if (!hasMore)
|
|
13
|
+
return;
|
|
14
|
+
setLoading(true);
|
|
15
|
+
await props.loadMore();
|
|
16
|
+
setLoading(false);
|
|
17
|
+
}, 300);
|
|
18
|
+
const [ref] = useIntersectionObserver({
|
|
19
|
+
onChange(isIntersecting) {
|
|
20
|
+
if (isIntersecting)
|
|
21
|
+
loadMore();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
return (_jsxs(Fragment, { children: [props.children, _jsx("div", { ref: ref, role: "presentation", style: props.style, className: props.className, hidden: !hasMore, children: !!hasMore && _jsx(Fragment, { children: loader }) })] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
+
import { useJackpotsQuery } from '../../client/hooks/index.js';
|
|
8
|
+
import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon } from '../../icons/index.js';
|
|
9
|
+
import { Button } from '../../ui/index.js';
|
|
10
|
+
import { JackpotCounterItem } from './JackpotCounterItem.js';
|
|
11
|
+
export function JackpotCounter__client(props) {
|
|
12
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
13
|
+
align: 'start',
|
|
14
|
+
slidesToScroll: 1,
|
|
15
|
+
});
|
|
16
|
+
const scrollPrev = useCallback(() => {
|
|
17
|
+
if (emblaApi)
|
|
18
|
+
emblaApi.scrollPrev();
|
|
19
|
+
}, [emblaApi]);
|
|
20
|
+
const scrollNext = useCallback(() => {
|
|
21
|
+
if (emblaApi)
|
|
22
|
+
emblaApi.scrollNext();
|
|
23
|
+
}, [emblaApi]);
|
|
24
|
+
const [canScrollPrev, setCanScrollPrev] = useState(false);
|
|
25
|
+
const [canScrollNext, setCanScrollNext] = useState(false);
|
|
26
|
+
const onSelect = useCallback(() => {
|
|
27
|
+
if (!emblaApi)
|
|
28
|
+
return;
|
|
29
|
+
setCanScrollPrev(emblaApi.canScrollPrev());
|
|
30
|
+
setCanScrollNext(emblaApi.canScrollNext());
|
|
31
|
+
}, [emblaApi]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!emblaApi)
|
|
34
|
+
return;
|
|
35
|
+
onSelect();
|
|
36
|
+
emblaApi.on('select', onSelect);
|
|
37
|
+
emblaApi.on('reInit', onSelect);
|
|
38
|
+
}, [emblaApi, onSelect]);
|
|
39
|
+
const jackpotsQuery = useJackpotsQuery({
|
|
40
|
+
first: 100,
|
|
41
|
+
filter: {
|
|
42
|
+
status: {
|
|
43
|
+
equal: 'ACTIVE',
|
|
44
|
+
},
|
|
45
|
+
deleted: {
|
|
46
|
+
equal: false,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
sort: {
|
|
50
|
+
cursor: 'POOL',
|
|
51
|
+
order: 'DESC',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
55
|
+
if (jackpots.length <= 0)
|
|
56
|
+
return null;
|
|
57
|
+
const classNames = isString(props.className)
|
|
58
|
+
? { root: props.className }
|
|
59
|
+
: (props.className ?? {});
|
|
60
|
+
return (_jsxs("div", { className: classNames.root, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-lg font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/jackpots', className: "text-button-tertiary-fg flex gap-sm text-sm font-semibold", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: "rounded-l-none", "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] })] }), _jsx("div", { className: "relative mt-lg lg:overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-2.5", children: jackpots.map((jackpot) => (_jsx(JackpotCounterItem, { jackpot: jackpot, className: {
|
|
61
|
+
root: {
|
|
62
|
+
className: classNames.jackpotCounterItemRoot?.className,
|
|
63
|
+
style: classNames.jackpotCounterItemRoot?.style,
|
|
64
|
+
},
|
|
65
|
+
}, viewAllUrl: props.viewAllUrl, hideAnimation: props.hideAnimation }, jackpot.id))) }) })] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export interface ClassNameEntries {
|
|
3
|
+
root?: string;
|
|
4
|
+
jackpotCounterItemRoot?: {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface JackpotCounterProps {
|
|
10
|
+
/** @default "Promos" */
|
|
11
|
+
heading?: string;
|
|
12
|
+
/** @default "/jackpots" */
|
|
13
|
+
viewAllUrl?: string;
|
|
14
|
+
className?: string | ClassNameEntries;
|
|
15
|
+
hideAnimation?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function JackpotCounter(props: JackpotCounterProps): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { prefetchJackpotsQuery } from '../../server/utils/index.js';
|
|
3
|
+
import { JackpotCounter__client } from './JackpotCounter.client.js';
|
|
4
|
+
export async function JackpotCounter(props) {
|
|
5
|
+
await prefetchJackpotsQuery({
|
|
6
|
+
first: 100,
|
|
7
|
+
filter: {
|
|
8
|
+
status: {
|
|
9
|
+
equal: 'ACTIVE',
|
|
10
|
+
},
|
|
11
|
+
deleted: {
|
|
12
|
+
equal: false,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
sort: {
|
|
16
|
+
cursor: 'POOL',
|
|
17
|
+
order: 'DESC',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return _jsx(JackpotCounter__client, { ...props });
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Jackpot } from '@opexa/portal-sdk-core';
|
|
2
|
+
import { type CSSProperties } from 'react';
|
|
3
|
+
interface ClassNameEntries {
|
|
4
|
+
root?: {
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface JackpotCounterCardProps {
|
|
10
|
+
jackpot: Jackpot;
|
|
11
|
+
className?: string | ClassNameEntries;
|
|
12
|
+
style?: string;
|
|
13
|
+
/** @default "/jackpots" */
|
|
14
|
+
viewAllUrl?: string;
|
|
15
|
+
hideAnimation?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function JackpotCounterItem({ jackpot, className, viewAllUrl, hideAnimation, }: JackpotCounterCardProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Progress } from '@ark-ui/react';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
import Link from 'next/link';
|
|
7
|
+
import { useCallback, useMemo } from 'react';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import { useLocaleInfo } from '../../client/hooks/index.js';
|
|
10
|
+
import { useJackpotPayoutsQuery } from '../../client/hooks/useJackpotPayoutsQuery.js';
|
|
11
|
+
import { ArrowNarrowUpRightIcon, ChevronLeftIcon, ChevronRightIcon, Trophy01Icon, User01Icon, } from '../../icons/index.js';
|
|
12
|
+
import { StarIcon } from '../../icons/StarIcon.js';
|
|
13
|
+
import closeChest from '../../images/close-chest.png';
|
|
14
|
+
import firstPlace from '../../images/first-place.png';
|
|
15
|
+
import leaderboard from '../../images/leaderboard.png';
|
|
16
|
+
import openChest from '../../images/open-chest.png';
|
|
17
|
+
import { formatNumber, getPercentage, mask } from '../../utils/index.js';
|
|
18
|
+
import styles from './JackpotCounterItem.module.css';
|
|
19
|
+
export function JackpotCounterItem({ jackpot, className, viewAllUrl, hideAnimation = false, }) {
|
|
20
|
+
const jackpotPayoutsQuery = useJackpotPayoutsQuery({
|
|
21
|
+
first: 30,
|
|
22
|
+
filter: {
|
|
23
|
+
jackpot: {
|
|
24
|
+
equal: jackpot.id,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
sort: {
|
|
28
|
+
cursor: 'AMOUNT',
|
|
29
|
+
order: 'DESC',
|
|
30
|
+
},
|
|
31
|
+
}, {
|
|
32
|
+
enabled: typeof window !== 'undefined',
|
|
33
|
+
});
|
|
34
|
+
const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
|
|
35
|
+
const topJackpotPayout = jackpotPayouts[0] ?? [];
|
|
36
|
+
const localeInfo = useLocaleInfo();
|
|
37
|
+
const isPayingOut = jackpot.drawing;
|
|
38
|
+
const jackpotAmount = isPayingOut
|
|
39
|
+
? jackpot.maximumJackpotPoolLimit
|
|
40
|
+
: jackpot.pool;
|
|
41
|
+
const Arrow = useCallback(({ index }) => {
|
|
42
|
+
const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
|
|
43
|
+
return (_jsx(Icon, { className: twMerge('scale-400 lg:scale-250 text-brand-300 min-w-2.5 lg:min-w-4', isPayingOut
|
|
44
|
+
? styles['animate-wave-color-error']
|
|
45
|
+
: styles['animate-wave-color-success']), style: {
|
|
46
|
+
animationDelay: isPayingOut
|
|
47
|
+
? `${(40 - index - 1) * 0.1}s`
|
|
48
|
+
: `${index * 0.1}s`,
|
|
49
|
+
} }));
|
|
50
|
+
}, [isPayingOut]);
|
|
51
|
+
const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
|
|
52
|
+
const classNames = isString(className)
|
|
53
|
+
? { root: { className } }
|
|
54
|
+
: (className ?? {});
|
|
55
|
+
return (_jsxs("div", { className: twMerge('bg-bg-tertiary border-border-primary relative flex w-full shrink-0 rounded-2xl border p-3 text-center lg:gap-4 lg:p-5', classNames.root?.className), style: classNames.root?.style, children: [_jsxs("div", { className: "z-1 relative flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx("span", { className: "full bg-utility-success-500 size-1.5 animate-pulse rounded" }), "Paying Out"] })) : (_jsxs("div", { className: "border-utility-blue-200 bg-utility-blue-50 text-utility-blue-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(ArrowNarrowUpRightIcon, { className: "text-utility-blue-500 size-3.5" }), "Accumulating"] })), _jsx("div", { className: "text-text-primary-900 mt-1 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
|
|
56
|
+
currency: localeInfo.currency.code,
|
|
57
|
+
minDecimalPlaces: 2,
|
|
58
|
+
maxDecimalPlaces: 2,
|
|
59
|
+
}) })] }), _jsx("div", { className: "z-1 bottom-[-60] right-0 lg:absolute", children: _jsx(Image, { width: 150, height: 150, src: isPayingOut ? openChest : closeChest, alt: "closeChest", quality: 100, className: "h-25 w-25 lg:h-37.5 lg:w-37.5 size-full p-2" }) })] }), topJackpotPayout.amount ? (_jsx("div", { children: _jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsxs("div", { className: "bg-bg-tertiary relative flex h-18 w-18 items-center justify-center rounded-full", children: [_jsx(User01Icon, { className: "text-text-quarterary-500 size-9" }), _jsx("div", { className: "bg-yellow-400 text-brand-950 border-bg-primary absolute bottom-0 right-0 flex h-6 w-6 items-center justify-center rounded-full border-[1.5px] text-xs font-bold", children: "1st" })] }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: topJackpotPayout.member.name }), _jsx("div", { className: "text-brand-400 text-2xl", children: formatNumber(topJackpotPayout.amount, {
|
|
60
|
+
currency: localeInfo.currency.code,
|
|
61
|
+
minDecimalPlaces: 2,
|
|
62
|
+
maxDecimalPlaces: 2,
|
|
63
|
+
}) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 hidden w-full gap-4 rounded-lg p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "firstPlace", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Top Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] }))] }) }) }), _jsxs("div", { className: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("div", { className: "text-text-primary-900 text-xs font-semibold", children: formatNumber(0, {
|
|
64
|
+
currency: localeInfo.currency.code,
|
|
65
|
+
compact: true,
|
|
66
|
+
}) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-red-flash-1']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-red-flash-2']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-red-flash-3']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-green-flash-1']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-green-flash-2']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-green-flash-3']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "text-text-primary-900 text-xs font-semibold", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
67
|
+
currency: localeInfo.currency.code,
|
|
68
|
+
compact: true,
|
|
69
|
+
}) })] })] }), _jsx(Progress.Root, { className: "bg-bg-primary h-2 w-full rounded-full lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), children: _jsx(Progress.Track, { className: "bg-bg-primary h-full overflow-hidden rounded-full", children: _jsx(Progress.Range, { className: "bg-brand-500 relative h-full overflow-hidden rounded-full pl-1.5", children: _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }) }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
|
|
70
|
+
? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
|
|
71
|
+
currency: localeInfo.currency.code,
|
|
72
|
+
compact: true,
|
|
73
|
+
})} Play now for your chance to win big! π₯`
|
|
74
|
+
: getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, quality: 100, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' })] }), _jsxs(Link, { className: "text-button-tertiary-fg flex text-sm font-semibold", href: viewAllUrl ?? '/jackpots', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx("div", { className: twMerge('max-h-[272px] overflow-y-scroll', styles['scrollArea']), children: _jsx("div", { className: "border-gray-200 overflow-hidden rounded-xl", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-xs font-medium", children: [_jsx("th", { children: "Player" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name, {
|
|
75
|
+
totalCharsCount: 6,
|
|
76
|
+
}) }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
|
|
77
|
+
currency: localeInfo.currency.code,
|
|
78
|
+
minDecimalPlaces: 2,
|
|
79
|
+
maxDecimalPlaces: 2,
|
|
80
|
+
}) })] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 w-[52px] border-t-2", children: i + 1 < 6 ? (_jsxs("div", { className: "relative", children: [_jsx(StarIcon, { className: twMerge('mx-auto size-6.5', starTierStyles[i].starColor) }), _jsx("span", { className: twMerge('absolute inset-0 mt-0.5 flex items-center justify-center text-2xs font-bold', starTierStyles[i].numberColor), children: i + 1 })] })) : (i + 1) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), isPayingOut && !hideAnimation && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:150px]') }))] }));
|
|
81
|
+
}
|
|
82
|
+
const getAccumulatingJackpotDescription = (part, total) => {
|
|
83
|
+
const percentage = total === 0 ? 0 : (part / total) * 100;
|
|
84
|
+
return percentage <= 90
|
|
85
|
+
? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
|
|
86
|
+
: 'π₯ Itβs about to pop! Stay in the game for your shot at the prize!';
|
|
87
|
+
};
|
|
88
|
+
const starTierStyles = [
|
|
89
|
+
{
|
|
90
|
+
starColor: 'text-yellow-400',
|
|
91
|
+
numberColor: 'text-bg-primary',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
starColor: 'text-utility-gray-700',
|
|
95
|
+
numberColor: 'text-bg-primary',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
starColor: 'text-yellow-700',
|
|
99
|
+
numberColor: 'text-bg-primary',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
starColor: 'text-bg-quaternary',
|
|
103
|
+
numberColor: 'text-text-primary-900',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
starColor: 'text-bg-quaternary',
|
|
107
|
+
numberColor: 'text-text-primary-900',
|
|
108
|
+
},
|
|
109
|
+
];
|