@opexa/portal-components 0.0.40 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/client/hooks/useGlobalStore.d.ts +1 -2
  2. package/dist/client/hooks/useGlobalStore.js +19 -36
  3. package/dist/components/Account/Account.d.ts +1 -7
  4. package/dist/components/Account/Account.js +15 -40
  5. package/dist/components/AccountInfo/AccountInfo.js +20 -3
  6. package/dist/components/AccountSecurity/AccountSecurity.js +14 -6
  7. package/dist/components/AccountVerification/VerificationDetails.js +6 -6
  8. package/dist/components/DepositWithdrawal/AmountChoices.js +1 -1
  9. package/dist/components/DepositWithdrawal/Deposit/AvailablePromos.js +21 -16
  10. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +4 -23
  11. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +4 -23
  12. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +4 -23
  13. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +5 -24
  14. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +4 -23
  15. package/dist/components/DepositWithdrawal/DepositWithdrawal.js +3 -3
  16. package/dist/components/DepositWithdrawal/PaymentMethods.js +2 -2
  17. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +27 -20
  18. package/dist/components/GameLaunch/GameLaunch.js +33 -57
  19. package/dist/components/KYC/KYC.d.ts +1 -0
  20. package/dist/components/KYC/KYC.js +3 -0
  21. package/dist/components/KYC/index.d.ts +1 -0
  22. package/dist/components/KYC/index.js +1 -0
  23. package/dist/components/Messages/MessageItem.js +12 -7
  24. package/dist/components/Messages/MessagePopup.js +8 -7
  25. package/dist/components/PortalProvider/PortalProvider.d.ts +2 -2
  26. package/dist/components/PortalProvider/PortalProvider.js +8 -5
  27. package/dist/components/PortalProvider/Providers.d.ts +4 -0
  28. package/dist/components/PortalProvider/Providers.js +12 -0
  29. package/dist/components/PortalProvider/Snackbar.d.ts +1 -0
  30. package/dist/components/PortalProvider/Snackbar.js +21 -0
  31. package/dist/components/PortalProvider/WebVitals.d.ts +1 -0
  32. package/dist/components/PortalProvider/WebVitals.js +8 -0
  33. package/dist/components/index.d.ts +1 -0
  34. package/dist/components/index.js +1 -0
  35. package/dist/images/gift.png +0 -0
  36. package/dist/tsconfig.build.tsbuildinfo +1 -1
  37. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  38. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  39. package/dist/ui/AlertDialog/alertDialog.recipe.js +4 -4
  40. package/dist/ui/Button/button.recipe.js +1 -1
  41. package/dist/ui/Checkbox/checkbox.recipe.js +2 -2
  42. package/package.json +2 -1
@@ -1,20 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Portal } from '@ark-ui/react';
3
2
  import { zodResolver } from '@hookform/resolvers/zod';
4
3
  import { useEffect } from 'react';
5
4
  import { Controller, useForm } from 'react-hook-form';
6
5
  import invariant from 'tiny-invariant';
7
6
  import { z } from 'zod';
8
7
  import { useShallow } from 'zustand/shallow';
9
- import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { useAvailablePromosQuery, useCreateMayaDepositMutation, useDepositsCountQuery, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
10
9
  import { toaster } from '../../../../client/utils/index.js';
11
- import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
12
- import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
10
+ import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
11
+ import { Button, Field, NumberInput } from '../../../../ui/index.js';
13
12
  import { parseDecimal } from '../../../../utils/index.js';
14
13
  import { AmountChoices } from '../../AmountChoices.js';
15
14
  import { AvailablePromos } from '../AvailablePromos.js';
16
15
  export function MayaDeposit() {
17
- const disclosure = useDisclosure();
18
16
  const globalStore = useGlobalStore(useShallow((ctx) => ({
19
17
  depositWithdrawal: ctx.depositWithdrawal,
20
18
  })));
@@ -120,22 +118,5 @@ export function MayaDeposit() {
120
118
  shouldDirty: true,
121
119
  shouldValidate: true,
122
120
  });
123
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-4xl", value: o.field.value, onChange: o.field.onChange })) }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createDepositMutation.isPending, onClick: async (e) => {
124
- const ok = await form.trigger('amount');
125
- if (!ok)
126
- return;
127
- if (promos.length <= 0)
128
- return;
129
- if (form.getValues('promo'))
130
- return;
131
- e.preventDefault();
132
- disclosure.setOpen(true);
133
- }, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
134
- disclosure.setOpen(details.open);
135
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
136
- disclosure.setOpen(false);
137
- }, children: "Cancel" }), _jsx(Button, { onClick: () => {
138
- handleSubmit();
139
- disclosure.setOpen(false);
140
- }, children: "Proceed" })] })] }) })] }) })] }));
121
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
141
122
  }
@@ -1,20 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Portal } from '@ark-ui/react';
3
2
  import { zodResolver } from '@hookform/resolvers/zod';
4
3
  import { noop } from 'lodash-es';
5
4
  import { useEffect } from 'react';
6
5
  import { Controller, useForm } from 'react-hook-form';
7
6
  import { z } from 'zod';
8
- import { useAvailablePromosQuery, useDepositsCountQuery, useDisclosure, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
- import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, XIcon, } from '../../../../icons/index.js';
10
- import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
7
+ import { useAvailablePromosQuery, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { ChevronDownIcon, ChevronUpIcon } from '../../../../icons/index.js';
9
+ import { Button, Field, NumberInput } from '../../../../ui/index.js';
11
10
  import { parseDecimal } from '../../../../utils/index.js';
12
11
  import { AmountChoices } from '../../AmountChoices.js';
13
12
  import { AvailablePromos } from '../AvailablePromos.js';
14
13
  import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
15
14
  export function OnlineBankDepositForm() {
16
15
  const context = useOnlineBankDepositContext();
17
- const disclosure = useDisclosure();
18
16
  const depositsCountQuery = useDepositsCountQuery();
19
17
  const depositsCount = depositsCountQuery.data ?? 0;
20
18
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -97,7 +95,7 @@ export function OnlineBankDepositForm() {
97
95
  },
98
96
  });
99
97
  });
100
- return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Bank" }), _jsx(Field.Input, { value: "BANKNET", onChange: noop, readOnly: true })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-4", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
98
+ return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Bank" }), _jsx(Field.Input, { value: "BANKNET", onChange: noop, readOnly: true })] }), _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) => {
101
99
  o.field.onChange(details.value);
102
100
  }, formatOptions: {
103
101
  maximumFractionDigits: 2,
@@ -108,22 +106,5 @@ export function OnlineBankDepositForm() {
108
106
  shouldDirty: true,
109
107
  shouldValidate: true,
110
108
  });
111
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-3xl", value: o.field.value, onChange: o.field.onChange })) }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", onClick: async (e) => {
112
- const ok = await form.trigger('amount');
113
- if (!ok)
114
- return;
115
- if (promos.length <= 0)
116
- return;
117
- if (form.getValues('promo'))
118
- return;
119
- e.preventDefault();
120
- disclosure.setOpen(true);
121
- }, children: "Deposit" }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
122
- disclosure.setOpen(details.open);
123
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
124
- disclosure.setOpen(false);
125
- }, children: "Cancel" }), _jsx(Button, { onClick: () => {
126
- handleSubmit();
127
- disclosure.setOpen(false);
128
- }, children: "Proceed" })] })] }) })] }) })] }));
109
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-3xl", value: o.field.value, onChange: o.field.onChange })) }), _jsx(Button, { type: "submit", className: "mt-3xl", children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
129
110
  }
@@ -1,19 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Portal } from '@ark-ui/react';
3
2
  import { zodResolver } from '@hookform/resolvers/zod';
4
3
  import { useEffect } from 'react';
5
4
  import { Controller, useForm } from 'react-hook-form';
6
5
  import { z } from 'zod';
7
- import { useAvailablePromosQuery, useDepositsCountQuery, useDisclosure, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
- import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, XIcon, } from '../../../../icons/index.js';
9
- import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
6
+ import { useAvailablePromosQuery, useDepositsCountQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
7
+ import { ChevronDownIcon, ChevronUpIcon } from '../../../../icons/index.js';
8
+ import { Button, Field, NumberInput } from '../../../../ui/index.js';
10
9
  import { parseDecimal } from '../../../../utils/index.js';
11
10
  import { AmountChoices } from '../../AmountChoices.js';
12
11
  import { AvailablePromos } from '../AvailablePromos.js';
13
12
  import { useQRPHDepositContext } from './QRPHDepositContext.js';
14
13
  export function QRPHDepositForm() {
15
14
  const context = useQRPHDepositContext();
16
- const disclosure = useDisclosure();
17
15
  const depositsCountQuery = useDepositsCountQuery();
18
16
  const depositsCount = depositsCountQuery.data ?? 0;
19
17
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -107,22 +105,5 @@ export function QRPHDepositForm() {
107
105
  shouldDirty: true,
108
106
  shouldValidate: true,
109
107
  });
110
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-4xl", value: o.field.value, onChange: o.field.onChange })) }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", onClick: async (e) => {
111
- const ok = await form.trigger('amount');
112
- if (!ok)
113
- return;
114
- if (promos.length <= 0)
115
- return;
116
- if (form.getValues('promo'))
117
- return;
118
- e.preventDefault();
119
- disclosure.setOpen(true);
120
- }, children: "Deposit" }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
121
- disclosure.setOpen(details.open);
122
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
123
- disclosure.setOpen(false);
124
- }, children: "Cancel" }), _jsx(Button, { onClick: () => {
125
- handleSubmit();
126
- disclosure.setOpen(false);
127
- }, children: "Proceed" })] })] }) })] }) })] }));
108
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
128
109
  }
@@ -6,7 +6,7 @@ import { z } from 'zod';
6
6
  import { useShallow } from 'zustand/shallow';
7
7
  import { useGlobalStore, useLocaleInfo, useWalletQuery, } from '../../client/hooks/index.js';
8
8
  import { Wallet02Icon, XIcon } from '../../icons/index.js';
9
- import { Dialog, Tabs } from '../../ui/index.js';
9
+ import { Dialog, IconButton, Tabs } from '../../ui/index.js';
10
10
  import { formatNumber } from '../../utils/index.js';
11
11
  import { Deposit } from './Deposit/Deposit.js';
12
12
  import { Withdrawal } from './Withdrawal/Withdrawal.js';
@@ -20,12 +20,12 @@ export function DepositWithdrawal(props) {
20
20
  });
21
21
  return (_jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
22
22
  globalStore.depositWithdrawal.setOpen(details.open);
23
- }, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? _jsx(DefaulTrigger, {}) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "lg:min-h-auto mx-auto min-h-full w-full p-2xl lg:w-[640px] lg:rounded-xl lg:p-3xl", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(Dialog.Header, { className: "flex items-center gap-xl", children: [_jsx("div", { className: "border-border-secondary shadow-xs text-gray-700 flex size-12 items-center justify-center rounded-lg border", children: _jsx(Wallet02Icon, {}) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" })] }), _jsxs(Dialog.Body, { className: "mt-5", children: [_jsx("p", { className: "text-gray-500 text-center text-sm font-medium leading-tight", children: "Available Balance" }), _jsx("p", { className: "mt-lg text-center text-4xl font-semibold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
23
+ }, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { asChild: true, children: props.children ?? _jsx(DefaulTrigger, {}) }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "lg:min-h-auto mx-auto min-h-full w-full px-4 py-3xl lg:w-[480px] lg:rounded-xl", children: [_jsxs(Dialog.Header, { className: "flex items-center gap-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs text-gray-700 text-text-secondary-700 flex size-10 items-center justify-center rounded-md border", children: _jsx(Wallet02Icon, { className: "size-5" }) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" }), _jsx(Dialog.Context, { children: (api) => (_jsx(IconButton, { size: "sm", variant: "outline", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, {}) })) })] }), _jsxs(Dialog.Body, { className: "mt-3xl", children: [_jsx("p", { className: "text-text-secondary-700 text-center text-sm", children: "Deposit Balance" }), _jsx("p", { className: "text-center text-3xl font-bold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
24
24
  currency: localeInfo.currency.code,
25
25
  minDecimalPlaces: 2,
26
26
  }) }), _jsxs(Tabs.Root, { value: globalStore.depositWithdrawal.tab, onValueChange: (details) => {
27
27
  globalStore.depositWithdrawal.setTab(z.enum(['DEPOSIT', 'WITHDRAWAL']).parse(details.value));
28
- }, lazyMount: true, unmountOnExit: true, className: "mt-4xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-4xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-4xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] })] }));
28
+ }, lazyMount: true, unmountOnExit: true, className: "mt-3xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-3xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-3xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] })] }));
29
29
  }
30
30
  function DefaulTrigger(props) {
31
31
  const localeInfo = useLocaleInfo();
@@ -50,10 +50,10 @@ export function PaymentMethods(props) {
50
50
  defaultValue: props.defaultValue ?? options[0].value,
51
51
  onChange: props.onChange,
52
52
  });
53
- return (_jsxs("div", { className: props.className, children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: "Select your payment method" }) }), _jsx(Checkbox.Group, { value: [value], onValueChange: (newValue) => {
53
+ return (_jsxs("div", { className: props.className, children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: "Available payment methods" }) }), _jsx(Checkbox.Group, { value: [value], onValueChange: (newValue) => {
54
54
  const lastValue = newValue.at(-1);
55
55
  if (!lastValue)
56
56
  return;
57
57
  setValue(PaymentMethodDefinition.parse(lastValue));
58
- }, className: "grid grid-cols-2 gap-x-4 gap-y-3", children: options.map((option) => (_jsxs(Checkbox.Root, { value: option.value, className: "border-border-secondary ui-checked:border-gray-900 ui-checked:outline-solid ui-checked:outline-border-secondary flex cursor-pointer rounded-xl border p-xl ui-checked:outline", children: [_jsx("div", { className: "grow", children: _jsx(Image, { src: option.image, alt: "", width: 200, height: 40, className: "h-5 w-auto lg:h-8", draggable: false }) }), _jsx(Checkbox.Control, { className: "shrink-0", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }, option.value))) })] }));
58
+ }, className: "grid grid-cols-2 gap-x-4 gap-y-3", children: options.map((option) => (_jsxs(Checkbox.Root, { value: option.value, className: "border-border-secondary ui-checked:border-border-brand-solid ui-checked:outline-solid ui-checked:outline-border-brand-solid flex cursor-pointer rounded-xl border p-xl ui-checked:outline", children: [_jsx("div", { className: "grow", children: _jsx(Image, { src: option.image, alt: "", width: 200, height: 40, className: "h-5 w-auto lg:h-8", draggable: false }) }), _jsx(Checkbox.Control, { className: "shrink-0", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }, option.value))) })] }));
59
59
  }
@@ -1,10 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Link from 'next/link';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
2
  import { useEffect, useState } from 'react';
4
3
  import { useShallow } from 'zustand/shallow';
5
- import { useAccountQuery, useGlobalStore, useOnMMA, usePaymentSettingsQuery, } from '../../../client/hooks/index.js';
6
- import { AlertCircleIcon, AlertTriangleIcon, ArrowRightIcon, SpinnerIcon, } from '../../../icons/index.js';
7
- import { onMobileDevice } from '../../../utils/index.js';
4
+ import { useAccountQuery, useGlobalStore, useOnMMA, usePaymentSettingsQuery, useWalletQuery, } from '../../../client/hooks/index.js';
5
+ import { AlertCircleIcon, SpinnerIcon } from '../../../icons/index.js';
6
+ import { Button } from '../../../ui/index.js';
7
+ import { onMobileDevice, parseDecimal } from '../../../utils/index.js';
8
8
  import { PaymentMethods } from '../PaymentMethods.js';
9
9
  import { GCashWithdrawal } from './GCashWithdrawal/GCashWithdrawal.js';
10
10
  import { InstapayWithdrawal } from './InstapayWithdrawal/InstapayWithdrawal.js';
@@ -12,6 +12,8 @@ import { MayaAppWithdrawal } from './MayaAppWithdrawal/MayaAppWithdrawal.js';
12
12
  import { MayaWithdrawal } from './MayaWithdrawal/MayaWithdrawal.js';
13
13
  export function Withdrawal() {
14
14
  const [onMMA] = useOnMMA();
15
+ const walletQuery = useWalletQuery();
16
+ const wallet = walletQuery.data;
15
17
  const accountQuery = useAccountQuery();
16
18
  const account = accountQuery.data;
17
19
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -51,25 +53,30 @@ export function Withdrawal() {
51
53
  setPaymentMethod(enabledPaymentMethods[0]);
52
54
  }
53
55
  }, [enabledPaymentMethods, paymentMethod]);
54
- if (account) {
55
- if (!account.transactionPassword ||
56
- account.verificationStatus !== 'VERIFIED')
57
- return _jsx(WithdrawalNotAllowed, {});
58
- }
59
- if (paymentSettingsQuery.isLoading) {
56
+ if (accountQuery.isLoading ||
57
+ walletQuery.isLoading ||
58
+ paymentSettingsQuery.isLoading) {
60
59
  return _jsx(SpinnerIcon, { className: "mx-auto size-6" });
61
60
  }
61
+ if (parseDecimal(wallet?.balance, 0) < 1) {
62
+ return _jsx(InsufficientBalance, {});
63
+ }
64
+ if (!account?.transactionPassword ||
65
+ account.verificationStatus !== 'VERIFIED') {
66
+ return _jsx(AccountVerificationRequired, {});
67
+ }
62
68
  if (enabledPaymentMethods.length <= 0) {
63
- return (_jsxs("div", { className: "border-amber-200 text-amber-700 bg-amber-50 flex items-center gap-1.5 rounded-sm border px-3 py-2.5 text-sm", children: [_jsx(AlertCircleIcon, { className: "size-4" }), "No available payment methods"] }));
69
+ return _jsx(NoAvailablePaymentMethods, {});
64
70
  }
65
71
  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, {})] }));
66
72
  }
67
- function WithdrawalNotAllowed() {
68
- const globalStore = useGlobalStore(useShallow((ctx) => ({
69
- depositWithdrawal: ctx.depositWithdrawal,
70
- })));
71
- return (_jsxs("div", { className: "pb-16 pt-4xl lg:pb-12", children: [_jsx("div", { className: "bg-amber-50 text-amber-600 mx-auto flex size-12 items-center justify-center rounded-full lg:size-14", children: _jsx(AlertTriangleIcon, { className: "size-6 lg:size-7" }) }), _jsx("h2", { className: "mt-xl text-center text-lg font-semibold lg:text-2xl", children: "Verification and password not set" }), _jsx("p", { className: "text-gray-500 mx-auto mt-md max-w-[31.25rem] text-center text-sm lg:text-base", children: "To enable withdrawals, first complete the identity verification process and set up your transaction password." }), _jsxs(Link, { href: "/personal-center", className: "text-gray-900 mx-auto mt-2xl flex w-fit items-center gap-md font-semibold", onClick: () => {
72
- globalStore.depositWithdrawal.setOpen(false);
73
- globalStore.depositWithdrawal.setTab('WITHDRAWAL');
74
- }, children: ["Personal Center ", _jsx(ArrowRightIcon, { className: "size-5" })] })] }));
73
+ function AccountVerificationRequired() {
74
+ 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: "Personal Verification" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "To withdraw funds, you must first verify your identity. Complete personal verification to ensure your account\u2019s security." }), _jsx(Button, { className: "mt-3xl", children: "Verify Now" })] }));
75
+ }
76
+ function InsufficientBalance() {
77
+ const setTab = useGlobalStore(useShallow((ctx) => ctx.depositWithdrawal.setTab));
78
+ 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: "Balance is very low" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "No funds available for withdrawal. Please make a deposit." }), _jsx(Button, { className: "mt-3xl", onClick: () => setTab('DEPOSIT'), children: "Deposit" })] }));
79
+ }
80
+ function NoAvailablePaymentMethods() {
81
+ return (_jsxs("div", { className: "py-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: "Not Available" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "Withdrawal is not available at this time. Please try again later or contact support for assistance." })] }));
75
82
  }
@@ -1,34 +1,18 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Dialog, Portal, Presence } from '@ark-ui/react';
4
- import { useRef } from 'react';
3
+ import { Dialog, Portal } from '@ark-ui/react';
5
4
  import { twMerge } from 'tailwind-merge';
6
5
  import { useShallow } from 'zustand/shallow';
7
6
  import { useDisclosure, useEndGameSessionMutation, useFavoriteGamesQuery, useGlobalStore, useMarkGameAsFavoriteMutation, useUnmarkGameAsFavoriteMutation, } from '../../client/hooks/index.js';
8
- import { AlertCircleIcon, ChevronLeftIcon, CoinsHandIcon, Expand03Icon, SpinnerIcon, Star01Icon, XIcon, } from '../../icons/index.js';
9
- import { AlertDialog, Button, IconButton } from '../../ui/index.js';
7
+ import { AlertCircleIcon, ChevronDownIcon, ChevronLeftIcon, CoinsHandIcon, Expand03Icon, SpinnerIcon, Star01Icon, XIcon, } from '../../icons/index.js';
8
+ import { AlertDialog, Button, IconButton, Presence } from '../../ui/index.js';
10
9
  export function GameLaunch() {
11
- const ref = useRef(null);
12
- const maximizeDisclosure = useDisclosure({
13
- defaultOpen: true,
14
- onOpenChange(open) {
15
- if (!open) {
16
- setTimeout(() => {
17
- ref.current?.scrollIntoView({
18
- behavior: 'smooth',
19
- block: 'start',
20
- inline: 'start',
21
- });
22
- }, 25);
23
- }
24
- },
25
- });
26
- const cancelDisclosure = useDisclosure();
27
- const endGameSessionMutation = useEndGameSessionMutation();
28
10
  const globalStore = useGlobalStore(useShallow((ctx) => ({
29
11
  gameLaunch: ctx.gameLaunch,
30
12
  depositWithdrawal: ctx.depositWithdrawal,
31
13
  })));
14
+ const maximizeDisclosure = useDisclosure({ defaultOpen: true });
15
+ const cancelDisclosure = useDisclosure();
32
16
  async function endGameSession() {
33
17
  if (globalStore.gameLaunch.details.status === 'PLAYING') {
34
18
  await endGameSessionMutation.mutateAsync({
@@ -45,6 +29,7 @@ export function GameLaunch() {
45
29
  }
46
30
  const favoriteGamesQuery = useFavoriteGamesQuery();
47
31
  const favoriteGames = favoriteGamesQuery.data ?? [];
32
+ const endGameSessionMutation = useEndGameSessionMutation();
48
33
  const markGameAsFavoriteMutation = useMarkGameAsFavoriteMutation();
49
34
  const unmarkGameAsFavoriteMutation = useUnmarkGameAsFavoriteMutation();
50
35
  const markedAsFavorite = favoriteGames.some((favoriteGame) => {
@@ -54,43 +39,34 @@ export function GameLaunch() {
54
39
  ? favoriteGame.id === globalStore.gameLaunch.details.game.reference
55
40
  : favoriteGame.id === globalStore.gameLaunch.details.game.id;
56
41
  });
57
- return (_jsxs(_Fragment, { children: [_jsxs(Presence, { ref: ref, present: globalStore.gameLaunch.details.status !== 'WAITING' &&
58
- !maximizeDisclosure.open, lazyMount: true, unmountOnExit: globalStore.gameLaunch.details.status === 'WAITING', className: "border-border-primary bg-bg-primary-alt w-full overflow-hidden rounded-lg border ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsxs("section", { className: "aspect-[960/540] w-full", children: [globalStore.gameLaunch.details.status === 'LOADING' && (_jsx("div", { className: "flex size-full items-center justify-center", children: _jsx(SpinnerIcon, { className: "size-8" }) })), globalStore.gameLaunch.details.status === 'FAILED' && (_jsx("div", {})), globalStore.gameLaunch.details.status === 'PLAYING' && (_jsx("iframe", { src: globalStore.gameLaunch.details.session?.launchUrl ?? '', className: "size-full" }))] }), _jsxs("section", { className: "border-border-primary flex justify-end gap-2 border-t p-2", children: [_jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", onClick: () => {
59
- if (globalStore.gameLaunch.details.status !== 'PLAYING') {
60
- endGameSession();
61
- return;
62
- }
63
- cancelDisclosure.setOpen(true);
64
- }, disabled: globalStore.gameLaunch.details.status === 'LOADING', "aria-label": "Quit Game", children: _jsx(XIcon, { className: "size-5" }) }), _jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", disabled: globalStore.gameLaunch.details.status === 'LOADING', "aria-label": markedAsFavorite ? 'Remove from Favorites' : 'Add to Favorites', onClick: () => {
65
- if (!globalStore.gameLaunch.details.game)
66
- return;
67
- if (markedAsFavorite) {
68
- unmarkGameAsFavoriteMutation.mutate('reference' in globalStore.gameLaunch.details.game
69
- ? globalStore.gameLaunch.details.game.reference
70
- : globalStore.gameLaunch.details.game.id);
71
- }
72
- else {
73
- markGameAsFavoriteMutation.mutate('reference' in globalStore.gameLaunch.details.game
74
- ? globalStore.gameLaunch.details.game.reference
75
- : globalStore.gameLaunch.details.game.id);
76
- }
77
- }, children: _jsx(Star01Icon, { className: twMerge('size-5', markedAsFavorite
78
- ? 'text-yellow-400 fill-yellow-400'
79
- : 'text-inherit') }) }), _jsx(IconButton, { size: "xs", variant: "outline", colorScheme: "gray", onClick: () => maximizeDisclosure.setOpen(true), title: "Maximize", "aria-label": "Maximize", children: _jsx(Expand03Icon, { className: "size-5" }) })] })] }), _jsx(Dialog.Root, { open: globalStore.gameLaunch.details.status !== 'WAITING' &&
80
- maximizeDisclosure.open &&
81
- !cancelDisclosure.open, lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsx(Portal, { children: _jsx(Dialog.Positioner, { className: "z-dialog fixed inset-0", children: _jsxs(Dialog.Content, { className: "ui-open:animate-dialog-in ui-closed:animate-dialog-out bg-bg-primary-alt flex size-full flex-col", children: [_jsxs("section", { className: "flex items-center gap-2 px-4 py-2", children: [_jsx(IconButton, { size: "xs", variant: "outline", onClick: () => {
82
- if (globalStore.gameLaunch.details.status !== 'PLAYING') {
83
- endGameSession();
84
- return;
85
- }
86
- cancelDisclosure.setOpen(true);
87
- }, disabled: globalStore.gameLaunch.details.status === 'LOADING', title: "Quit", "aria-label": "Quit Game", children: _jsx(ChevronLeftIcon, { className: "size-5" }) }), _jsx("div", { className: "grow" }), _jsx(IconButton, { size: "xs", variant: "outline", children: _jsx(Star01Icon, { className: twMerge('size-5', markedAsFavorite
88
- ? 'text-yellow-400 fill-yellow-400'
89
- : 'text-inherit') }) }), _jsx(IconButton, { size: "xs", variant: "outline", onClick: () => maximizeDisclosure.setOpen(false), title: "Minimize", "aria-label": "Minimize", children: _jsx(Expand03Icon, { className: "size-5" }) }), _jsx(IconButton, { size: "xs", fullWidth: false, onClick: () => {
90
- globalStore.depositWithdrawal.setOpen(true);
91
- }, children: _jsx(CoinsHandIcon, { className: "size-5" }) })] }), _jsxs("section", { className: "grow", children: [globalStore.gameLaunch.details.status === 'LOADING' && (_jsx("div", { className: "flex size-full items-center justify-center", children: _jsx(SpinnerIcon, { className: "size-8" }) })), globalStore.gameLaunch.details.status === 'FAILED' && (_jsx("div", {})), globalStore.gameLaunch.details.status === 'PLAYING' && (_jsx("iframe", { src: globalStore.gameLaunch.details.session.launchUrl ?? '', className: "size-full" }))] })] }) }) }) }), _jsx(AlertDialog.Root, { role: "alertdialog", open: cancelDisclosure.open, onOpenChange: (details) => {
42
+ return (_jsxs(_Fragment, { children: [_jsx(Dialog.Root, { open: globalStore.gameLaunch.details.status !== 'WAITING' &&
43
+ !cancelDisclosure.open, lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsx(Portal, { children: _jsx(Dialog.Positioner, { className: "z-dialog fixed inset-0", children: _jsxs(Dialog.Content, { className: "ui-open:animate-dialog-in ui-closed:animate-dialog-out bg-bg-primary-alt relative size-full", children: [_jsx(Presence, { asChild: true, lazyMount: true, unmountOnExit: true, present: !maximizeDisclosure.open, children: _jsxs("section", { className: "ui-open:animate-slide-in-down ui-closed:animate-slide-out-down bg-bg-primary-alt z-1 absolute left-0 top-0 flex h-[3.25rem] w-full items-center gap-2 px-4 py-2", children: [_jsx(IconButton, { size: "xs", variant: "outline", onClick: () => {
44
+ if (globalStore.gameLaunch.details.status !== 'PLAYING') {
45
+ endGameSession();
46
+ return;
47
+ }
48
+ cancelDisclosure.setOpen(true);
49
+ }, disabled: globalStore.gameLaunch.details.status === 'LOADING', children: _jsx(ChevronLeftIcon, { className: "size-5" }) }), _jsx("div", { className: "grow" }), _jsx(IconButton, { size: "xs", variant: "outline", disabled: unmarkGameAsFavoriteMutation.isPending ||
50
+ markGameAsFavoriteMutation.isPending, onClick: () => {
51
+ if (!globalStore.gameLaunch.details.game)
52
+ return;
53
+ if (markedAsFavorite) {
54
+ unmarkGameAsFavoriteMutation.mutate('reference' in globalStore.gameLaunch.details.game
55
+ ? globalStore.gameLaunch.details.game.reference
56
+ : globalStore.gameLaunch.details.game.id);
57
+ }
58
+ else {
59
+ markGameAsFavoriteMutation.mutate('reference' in globalStore.gameLaunch.details.game
60
+ ? globalStore.gameLaunch.details.game.reference
61
+ : globalStore.gameLaunch.details.game.id);
62
+ }
63
+ }, children: _jsx(Star01Icon, { className: twMerge('size-5', markedAsFavorite
64
+ ? 'text-yellow-400 fill-yellow-400'
65
+ : 'text-inherit') }) }), _jsx(IconButton, { size: "xs", variant: "outline", onClick: () => maximizeDisclosure.setOpen(true), children: _jsx(Expand03Icon, { className: "size-5" }) }), _jsx(IconButton, { size: "xs", fullWidth: false, onClick: () => {
66
+ globalStore.depositWithdrawal.setOpen(true);
67
+ }, children: _jsx(CoinsHandIcon, { className: "size-5" }) })] }) }), _jsx(Presence, { asChild: true, lazyMount: true, unmountOnExit: true, present: maximizeDisclosure.open, children: _jsx("button", { type: "button", onClick: () => maximizeDisclosure.setOpen(false), className: "shadow-xs ui-open:animate-slide-in-down ui-closed:animate-slide-out-down z-1 absolute left-1/2 top-0 flex h-7.5 w-[4.5rem] -translate-x-1/2 items-center justify-center rounded-b-md bg-white/30 backdrop-blur-sm", children: _jsx(ChevronDownIcon, {}) }) }), _jsxs("section", { className: "size-full", children: [globalStore.gameLaunch.details.status === 'LOADING' && (_jsx("div", { className: "flex size-full items-center justify-center", children: _jsx(SpinnerIcon, { className: "size-8" }) })), globalStore.gameLaunch.details.status === 'FAILED' && (_jsx("div", {})), globalStore.gameLaunch.details.status === 'PLAYING' && (_jsx("iframe", { src: globalStore.gameLaunch.details.session.launchUrl ?? '', className: "size-full" }))] })] }) }) }) }), _jsx(AlertDialog.Root, { role: "alertdialog", open: cancelDisclosure.open, onOpenChange: (details) => {
92
68
  cancelDisclosure.setOpen(details.open);
93
- }, lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, {}), _jsx(AlertDialog.Positioner, { children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "bg-error-700/25 text-error-200 flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Quit Game" }), _jsx(AlertDialog.Description, { children: "Are you sure you want to quit?" })] }), _jsx(AlertDialog.Context, { children: (api) => (_jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", disabled: endGameSessionMutation.isPending, onClick: () => {
69
+ }, lazyMount: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, {}), _jsx(AlertDialog.Positioner, { children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(AlertDialog.Header, { children: _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, { className: "size-6" }) }) }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Quit Game" }), _jsx(AlertDialog.Description, { children: "Are you sure you want to quit?" })] }), _jsx(AlertDialog.Context, { children: (api) => (_jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", disabled: endGameSessionMutation.isPending, onClick: () => {
94
70
  api.setOpen(false);
95
71
  }, children: "Cancel" }), _jsx(Button, { colorScheme: "danger", disabled: endGameSessionMutation.isPending, onClick: async () => {
96
72
  await endGameSession();
@@ -0,0 +1 @@
1
+ export declare function KYC(): null;
@@ -0,0 +1,3 @@
1
+ export function KYC() {
2
+ return null;
3
+ }
@@ -0,0 +1 @@
1
+ export * from './KYC';
@@ -0,0 +1 @@
1
+ export * from './KYC.js';
@@ -6,21 +6,26 @@ import { useShallow } from 'zustand/shallow';
6
6
  import { useGlobalStore, useLocaleInfo, useMarkMessageAsReadMutation, } from '../../client/hooks/index.js';
7
7
  import { getMessageIcon } from '../../components/Messages/utils.js';
8
8
  export function MessageItem({ message }) {
9
- const { id, title, dateTimeCreated, content, markedAsRead, icon, actions } = message;
9
+ const {
10
+ /**/
11
+ id, icon, title, content, actions, markedAsRead, dateTimeCreated, } = message;
10
12
  const localeInfo = useLocaleInfo();
11
- const { messages: messagesStore } = useGlobalStore(useShallow((ctx) => ({ messages: ctx.messages })));
13
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
14
+ message: ctx.message,
15
+ messages: ctx.messages,
16
+ })));
12
17
  const { mutate } = useMarkMessageAsReadMutation();
13
18
  const Icon = getMessageIcon(icon);
14
19
  const handleViewMessage = async () => {
15
20
  mutate(id);
16
- messagesStore.setOpen(false);
17
- messagesStore.message.setData(message);
18
- messagesStore.message.setOpen(true);
21
+ globalStore.message.setData(message);
22
+ globalStore.message.setOpen(true);
23
+ globalStore.messages.setOpen(false);
19
24
  };
20
25
  const handleActionClick = (e) => {
21
26
  e.stopPropagation();
22
- messagesStore.setOpen(false);
23
- messagesStore.setTab('ALL');
27
+ globalStore.messages.setOpen(false);
28
+ globalStore.messages.setTab('ALL');
24
29
  };
25
30
  return (_jsxs("div", { role: "button", tabIndex: 0, className: "border-border-secondary rounded-xs bg-bg-secondary flex h-auto flex-shrink-0 cursor-pointer flex-col border px-3.5 py-2.5", onClick: handleViewMessage, "aria-pressed": "false", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("p", { className: "text-text-tertiary-600 text-xs font-normal", children: format(new Date(dateTimeCreated), 'M/d/yyyy - h:mma', {
26
31
  in: tz(localeInfo.timezone),
@@ -7,12 +7,13 @@ import { XIcon } from '../../icons/index.js';
7
7
  import { Dialog } from '../../ui/index.js';
8
8
  import { getMessageIcon } from './utils.js';
9
9
  export const MessagePopup = () => {
10
- const { messages: messagesStore } = useGlobalStore(useShallow((ctx) => ({ messages: ctx.messages })));
11
- const message = messagesStore.message.data;
12
- const Icon = getMessageIcon(message?.icon ?? 'MESSAGE');
13
- return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: messagesStore.message.open, onOpenChange: ({ open }) => {
14
- messagesStore.message.setOpen(open);
15
- }, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto min-w-[21.438rem] max-w-[21.438rem] rounded-xl px-xl pb-0 pt-5 shadow-xl", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "pb-6", children: [_jsx("div", { className: "bg-bg-brand-secondary mx-auto w-fit rounded-full p-3", children: _jsx(Icon, { className: "text-text-brand", height: "24", width: "24" }) }), _jsx("p", { className: "text-text-primary-brand mt-lg text-center text-lg font-semibold leading-tight", children: message?.title }), _jsx("div", { className: "text-shadow-text-secondary-700 mt-xs text-center text-sm font-normal leading-tight", dangerouslySetInnerHTML: { __html: message?.content ?? '' } })] }), message?.actions.length ? (_jsx("div", { className: "flex flex-col space-y-2 px-4 pb-8 pt-6 text-center", children: message.actions.map((action, index) => (_jsx(Link, { className: "bg-button-primary-bg rounded-xs text-button-primary-fg w-full px-4 py-2.5 text-base font-semibold", href: action.url, onClick: () => {
16
- messagesStore.message.setOpen(false);
10
+ const globalStore = useGlobalStore(useShallow((ctx) => ({ message: ctx.message })));
11
+ const Icon = getMessageIcon(globalStore.message.data?.icon ?? 'MESSAGE');
12
+ return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.message.open, onOpenChange: ({ open }) => {
13
+ globalStore.message.setOpen(open);
14
+ }, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto min-w-[21.438rem] max-w-[21.438rem] rounded-xl px-xl pb-0 pt-5 shadow-xl", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "pb-6", children: [_jsx("div", { className: "bg-bg-brand-secondary mx-auto w-fit rounded-full p-3", children: _jsx(Icon, { className: "text-text-brand", height: "24", width: "24" }) }), _jsx("p", { className: "text-text-primary-brand mt-lg text-center text-lg font-semibold leading-tight", children: globalStore.message.data?.title }), _jsx("div", { className: "text-shadow-text-secondary-700 mt-xs text-center text-sm font-normal leading-tight", dangerouslySetInnerHTML: {
15
+ __html: globalStore.message.data?.content ?? '',
16
+ } })] }), globalStore.message.data?.actions.length ? (_jsx("div", { className: "flex flex-col space-y-2 px-4 pb-8 pt-6 text-center", children: globalStore.message.data.actions.map((action, index) => (_jsx(Link, { className: "bg-button-primary-bg rounded-xs text-button-primary-fg w-full px-4 py-2.5 text-base font-semibold", href: action.url, onClick: () => {
17
+ globalStore.message.setOpen(false);
17
18
  }, children: action.name }, index))) })) : null] }) })] }) }));
18
19
  };
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  export interface PortalProviderProps {
3
3
  googleAnalyticsId?: string;
4
4
  googleTagManagerId?: string;
@@ -6,4 +6,4 @@ export interface PortalProviderProps {
6
6
  facebookPixelId?: string;
7
7
  children: ReactNode;
8
8
  }
9
- export declare function PortalProvider({ children, ...props }: PortalProviderProps): Promise<import("react/jsx-runtime").JSX.Element>;
9
+ export declare function PortalProvider({ children, facebookPixelId, googleAnalyticsId, googleTagManagerId, googleRecaptchaSiteKey, }: PortalProviderProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,15 +1,18 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { GoogleAnalytics, GoogleTagManager } from '@next/third-parties/google';
2
3
  import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
3
- import {} from 'react';
4
4
  import { prefetchAccountQuery, prefetchSessionQuery, prefetchWalletQuery, } from '../../server/utils/index.js';
5
+ import { FacebookPixel, GoogleRecaptcha } from '../../third-parties/index.js';
5
6
  import { getQueryClient } from '../../utils/index.js';
6
- import { PortalProvider__client } from './PortalProvider.client.js';
7
- export async function PortalProvider({ children, ...props }) {
7
+ import { Providers } from './Providers.js';
8
+ import { Snackbar } from './Snackbar.js';
9
+ import { WebVitals } from './WebVitals.js';
10
+ export async function PortalProvider({ children, facebookPixelId, googleAnalyticsId, googleTagManagerId, googleRecaptchaSiteKey, }) {
8
11
  const queryClient = getQueryClient();
9
12
  await Promise.all([
10
13
  prefetchSessionQuery(),
11
14
  prefetchAccountQuery(),
12
15
  prefetchWalletQuery(),
13
16
  ]);
14
- return (_jsx(PortalProvider__client, { ...props, children: _jsx(HydrationBoundary, { state: dehydrate(queryClient), children: children }) }));
17
+ return (_jsxs(_Fragment, { children: [_jsx(Providers, { children: _jsx(HydrationBoundary, { state: dehydrate(queryClient), children: children }) }), _jsx(Snackbar, {}), _jsx(WebVitals, {}), facebookPixelId && _jsx(FacebookPixel, { fbId: facebookPixelId }), googleAnalyticsId && _jsx(GoogleAnalytics, { gaId: googleAnalyticsId }), googleTagManagerId && _jsx(GoogleTagManager, { gtmId: googleTagManagerId }), googleRecaptchaSiteKey && (_jsx(GoogleRecaptcha, { siteKey: googleRecaptchaSiteKey }))] }));
15
18
  }
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ export declare function Providers({ children }: {
3
+ children: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { QueryClientProvider } from '@tanstack/react-query';
4
+ import dynamic from 'next/dynamic';
5
+ import { getQueryClient } from '../../utils/index.js';
6
+ const ThemeProvider = dynamic(() => import('next-themes').then((mod) => mod.ThemeProvider), {
7
+ ssr: false,
8
+ });
9
+ export function Providers({ children }) {
10
+ const queryClient = getQueryClient();
11
+ return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ThemeProvider, { attribute: "class", storageKey: "WebPortalTheme", enableSystem: false, enableColorScheme: false, defaultTheme: "dark", disableTransitionOnChange: true, children: children }) }));
12
+ }
@@ -0,0 +1 @@
1
+ export declare function Snackbar(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Toast, Toaster } from '@ark-ui/react';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { toaster } from '../../client/utils/index.js';
6
+ import { AlertCircleIcon, XIcon } from '../../icons/index.js';
7
+ export function Snackbar() {
8
+ return (_jsx(Toaster, { toaster: toaster, children: (toast) => (_jsxs(Toast.Root, { className: twMerge('group', 'p-xl', 'border', 'border-border-primary', 'bg-bg-primary-alt', 'flex', 'items-start', 'gap-lg', 'w-[21.438rem]', 'lg:w-[1200px]', 'max-w-full', 'rounded-xl', 'shadow-xs', 'h-[var(--height)]', 'z-[var(--z-index)]', 'scale-[var(--scale)]', 'opacity-[var(--opacity)]', '[translate:var(--x)_var(--y)_0]', 'transition-all', 'duration-300'), children: [_jsxs("div", { className: "flex grow flex-col gap-xl lg:flex-row lg:gap-lg", children: [_jsx("div", { className: twMerge('flex', 'items-center', 'justify-center', 'size-9.5', 'border-2', 'rounded-full', toast.type === 'success' && 'border-text-success-primary/15', toast.type === 'warning' && 'border-text-warning-primary/15', toast.type === 'error' && 'border-text-error-primary/15'), children: _jsx("div", { className: twMerge('flex', 'items-center', 'justify-center', 'size-7', 'border-2', 'rounded-full', toast.type === 'success' && 'border-text-success-primary/35', toast.type === 'warning' && 'border-text-warning-primary/35', toast.type === 'error' && 'border-text-error-primary/35'), children: _jsx(AlertCircleIcon, { className: twMerge('size-5', toast.type === 'success' && 'text-text-success-primary', toast.type === 'warning' && 'text-text-warning-primary', toast.type === 'error' && 'text-text-error-primary') }) }) }), _jsxs("div", { className: "grow text-sm leading-none", children: [_jsx(Toast.Title, { className: "text-text-secondary-700 font-semibold", children: toast.title
9
+ ? toast.title
10
+ : toast.type === 'error'
11
+ ? 'Error'
12
+ : toast.type === 'warning'
13
+ ? 'Warning'
14
+ : 'Success' }), _jsx(Toast.Description, { className: "text-text-tertiary-600 mt-xs", children: toast.description
15
+ ? toast.description
16
+ : toast.type === 'error'
17
+ ? 'Something went wrong.'
18
+ : toast.type === 'warning'
19
+ ? 'Please be cautious.'
20
+ : 'Operation completed successfully.' })] })] }), _jsx(Toast.CloseTrigger, { className: "text-text-secondary-700", children: _jsx(XIcon, { className: "size-5" }) })] }, toast.id)) }));
21
+ }