@opexa/portal-components 0.0.40 → 0.0.42

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 (115) hide show
  1. package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +4 -1
  2. package/dist/client/hooks/useCreateQRPHDepositMutation.js +4 -1
  3. package/dist/client/hooks/useGlobalStore.d.ts +1 -2
  4. package/dist/client/hooks/useGlobalStore.js +19 -36
  5. package/dist/client/hooks/useIsMayaSessionValidQuery.js +5 -1
  6. package/dist/components/Account/Account.d.ts +1 -7
  7. package/dist/components/Account/Account.js +15 -40
  8. package/dist/components/AccountInfo/AccountInfo.js +20 -3
  9. package/dist/components/AccountSecurity/AccountSecurity.js +14 -6
  10. package/dist/components/AccountVerification/VerificationDetails.js +6 -6
  11. package/dist/components/DepositWithdrawal/AmountChoices.js +1 -1
  12. package/dist/components/DepositWithdrawal/Deposit/AvailablePromos.js +21 -16
  13. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +15 -4
  14. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +20 -32
  15. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +20 -41
  16. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +20 -32
  17. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDeposit.js +3 -4
  18. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +1 -0
  19. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositAlert.js +96 -0
  20. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +16 -16
  21. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +1 -0
  22. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositDetails.js +16 -0
  23. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.d.ts +1 -1
  24. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +7 -34
  25. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +9 -10
  26. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.js +38 -51
  27. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDeposit.js +3 -4
  28. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
  29. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +96 -0
  30. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +14 -16
  31. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
  32. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +16 -0
  33. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +1 -1
  34. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +7 -34
  35. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +8 -10
  36. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.js +37 -54
  37. package/dist/components/DepositWithdrawal/DepositWithdrawal.js +3 -3
  38. package/dist/components/DepositWithdrawal/PaymentMethods.js +4 -3
  39. package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +23 -19
  40. package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +23 -20
  41. package/dist/components/DepositWithdrawal/Withdrawal/MayaAppWithdrawal/MayaAppWithdrawal.js +23 -25
  42. package/dist/components/DepositWithdrawal/Withdrawal/MayaWithdrawal/MayaWithdrawal.js +23 -19
  43. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +36 -20
  44. package/dist/components/GameLaunch/GameLaunch.js +33 -57
  45. package/dist/components/KYC/KYC.d.ts +1 -0
  46. package/dist/components/KYC/KYC.js +3 -0
  47. package/dist/components/KYC/index.d.ts +1 -0
  48. package/dist/components/KYC/index.js +1 -0
  49. package/dist/components/Messages/MessageItem.js +12 -7
  50. package/dist/components/Messages/MessagePopup.js +8 -7
  51. package/dist/components/PortalProvider/PortalProvider.d.ts +2 -2
  52. package/dist/components/PortalProvider/PortalProvider.js +8 -5
  53. package/dist/components/PortalProvider/Providers.d.ts +4 -0
  54. package/dist/components/PortalProvider/Providers.js +12 -0
  55. package/dist/components/PortalProvider/Snackbar.d.ts +1 -0
  56. package/dist/components/PortalProvider/Snackbar.js +21 -0
  57. package/dist/components/PortalProvider/WebVitals.d.ts +1 -0
  58. package/dist/components/PortalProvider/WebVitals.js +8 -0
  59. package/dist/components/index.d.ts +1 -0
  60. package/dist/components/index.js +1 -0
  61. package/dist/icons/SpinnerIcon.js +1 -1
  62. package/dist/images/QRPH.png +0 -0
  63. package/dist/images/gcash.png +0 -0
  64. package/dist/images/gift.png +0 -0
  65. package/dist/styles/theme.css +28 -1
  66. package/dist/tsconfig.build.tsbuildinfo +1 -1
  67. package/dist/ui/AlertDialog/alertDialog.recipe.js +4 -4
  68. package/dist/ui/Badge/Badge.d.ts +12 -12
  69. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  70. package/dist/ui/Button/button.recipe.js +1 -1
  71. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  72. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  73. package/dist/ui/Checkbox/checkbox.recipe.js +2 -2
  74. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  75. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  76. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  77. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  78. package/dist/ui/Combobox/Combobox.d.ts +196 -196
  79. package/dist/ui/Combobox/combobox.recipe.d.ts +14 -14
  80. package/dist/ui/DatePicker/DatePicker.d.ts +192 -192
  81. package/dist/ui/DatePicker/datePicker.recipe.d.ts +8 -8
  82. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  83. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  84. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  85. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  86. package/dist/ui/Popover/Popover.d.ts +55 -55
  87. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  88. package/dist/ui/Progress/Progress.d.ts +27 -27
  89. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  90. package/dist/ui/Select/Select.d.ts +45 -45
  91. package/dist/ui/Select/select.recipe.d.ts +3 -3
  92. package/dist/ui/Table/Table.d.ts +21 -21
  93. package/dist/ui/Table/table.recipe.d.ts +3 -3
  94. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  95. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  96. package/package.json +11 -5
  97. package/dist/components/AccountVerification/selfie.png +0 -0
  98. package/dist/components/AccountVerification/upload-id.png +0 -0
  99. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.d.ts +0 -1
  100. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositLoading.js +0 -5
  101. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.d.ts +0 -1
  102. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositSuccess.js +0 -5
  103. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.d.ts +0 -1
  104. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositVCA.js +0 -14
  105. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.d.ts +0 -1
  106. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositLoading.js +0 -5
  107. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.d.ts +0 -1
  108. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositQrCode.js +0 -18
  109. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.d.ts +0 -1
  110. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositSuccess.js +0 -8
  111. package/dist/components/DepositWithdrawal/MayaSessionExpired.d.ts +0 -1
  112. package/dist/components/DepositWithdrawal/MayaSessionExpired.js +0 -5
  113. package/dist/components/PortalProvider/PortalProvider.client.d.ts +0 -2
  114. package/dist/components/PortalProvider/PortalProvider.client.js +0 -38
  115. package/dist/images/QRPh.png +0 -0
@@ -1,33 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import { z } from 'zod';
6
- import { useShallow } from 'zustand/shallow';
7
- import { useCreateGCashWithdrawalMutation, useGlobalStore, useLocaleInfo, useMobileNumberParser, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
- import { toaster } from '../../../../client/utils/index.js';
9
- import { ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, } from '../../../../icons/index.js';
10
- import { Button, Field, NumberInput, PasswordInput } from '../../../../ui/index.js';
7
+ import { useCreateGCashWithdrawalMutation, useLocaleInfo, useMobileNumberParser, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
9
+ import { AlertDialog, Button, Field, NumberInput, PasswordInput, } from '../../../../ui/index.js';
11
10
  import { parseDecimal } from '../../../../utils/index.js';
12
11
  import { AmountChoices } from '../../AmountChoices.js';
13
12
  export function GCashWithdrawal() {
14
- const globalStore = useGlobalStore(useShallow((ctx) => ({
15
- depositWithdrawal: ctx.depositWithdrawal,
16
- })));
13
+ const [status, setStatus] = useState('waiting');
17
14
  const localeInfo = useLocaleInfo();
18
15
  const mobileNumberParser = useMobileNumberParser();
19
16
  const createWithdrawalMutation = useCreateGCashWithdrawalMutation({
17
+ onMutate() {
18
+ setStatus('processing');
19
+ },
20
20
  onSuccess() {
21
+ setStatus('success');
21
22
  form.reset();
22
- globalStore.depositWithdrawal.setOpen(false);
23
- toaster.success({
24
- description: 'Withdrawal request submitted successfully.',
25
- });
26
23
  },
27
- onError(error) {
28
- toaster.error({
29
- description: error.message,
30
- });
24
+ onError() {
25
+ setStatus('failed');
31
26
  },
32
27
  });
33
28
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -101,5 +96,14 @@ export function GCashWithdrawal() {
101
96
  shouldDirty: true,
102
97
  shouldValidate: true,
103
98
  });
104
- }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: createWithdrawalMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') })] }));
99
+ }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
100
+ if (!details.open) {
101
+ setStatus('waiting');
102
+ }
103
+ }, 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' &&
104
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
105
+ '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' &&
106
+ '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: () => {
107
+ api.setOpen(false);
108
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
105
109
  }
@@ -1,32 +1,26 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { createListCollection } from '@ark-ui/react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createListCollection, Portal } from '@ark-ui/react';
3
3
  import { zodResolver } from '@hookform/resolvers/zod';
4
- import { useEffect, useMemo } from 'react';
4
+ import { useEffect, useMemo, useState } from 'react';
5
5
  import { Controller, useForm } from 'react-hook-form';
6
6
  import { z } from 'zod';
7
- import { useShallow } from 'zustand/shallow';
8
- import { useCreateInstapayWithdrawalMutation, useGlobalStore, useInstapayBankListQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
- import { toaster } from '../../../../client/utils/index.js';
10
- import { CheckIcon, ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, } from '../../../../icons/index.js';
11
- import { Button, Field, NumberInput, PasswordInput, Select, } from '../../../../ui/index.js';
7
+ import { useCreateInstapayWithdrawalMutation, useInstapayBankListQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { AlertCircleIcon, CheckIcon, ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
9
+ import { AlertDialog, Button, Field, NumberInput, PasswordInput, Select, } from '../../../../ui/index.js';
12
10
  import { parseDecimal } from '../../../../utils/index.js';
13
11
  import { AmountChoices } from '../../AmountChoices.js';
14
12
  export function InstapayWithdrawal() {
15
- const globalStore = useGlobalStore(useShallow((ctx) => ({
16
- depositWithdrawal: ctx.depositWithdrawal,
17
- })));
13
+ const [status, setStatus] = useState('waiting');
18
14
  const createWithdrawalMutation = useCreateInstapayWithdrawalMutation({
15
+ onMutate() {
16
+ setStatus('processing');
17
+ },
19
18
  onSuccess() {
20
19
  form.reset();
21
- globalStore.depositWithdrawal.setOpen(false);
22
- toaster.success({
23
- description: 'Withdrawal request submitted successfully.',
24
- });
20
+ setStatus('success');
25
21
  },
26
- onError(error) {
27
- toaster.error({
28
- description: error.message,
29
- });
22
+ onError() {
23
+ setStatus('failed');
30
24
  },
31
25
  });
32
26
  const instapayBankListQuery = useInstapayBankListQuery();
@@ -124,5 +118,14 @@ export function InstapayWithdrawal() {
124
118
  shouldDirty: true,
125
119
  shouldValidate: true,
126
120
  });
127
- }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: createWithdrawalMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') })] }));
121
+ }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
122
+ if (!details.open) {
123
+ setStatus('waiting');
124
+ }
125
+ }, 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' &&
126
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
127
+ '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' &&
128
+ '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: () => {
129
+ api.setOpen(false);
130
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
128
131
  }
@@ -1,36 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import { z } from 'zod';
6
- import { useShallow } from 'zustand/shallow';
7
- import { useCreateMayaAppWithdrawalMutation, useGlobalStore, useIsMayaSessionValidQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
- import { toaster } from '../../../../client/utils/index.js';
9
- import { ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, } from '../../../../icons/index.js';
10
- import { Button, Field, NumberInput, PasswordInput } from '../../../../ui/index.js';
7
+ import { useCreateMayaAppWithdrawalMutation, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
9
+ import { AlertDialog, Button, Field, NumberInput, PasswordInput, } from '../../../../ui/index.js';
11
10
  import { parseDecimal } from '../../../../utils/index.js';
12
11
  import { AmountChoices } from '../../AmountChoices.js';
13
- import { MayaSessionExpired } from '../../MayaSessionExpired.js';
14
12
  export function MayaAppWithdrawal() {
15
- const globalStore = useGlobalStore(useShallow((ctx) => ({
16
- depositWithdrawal: ctx.depositWithdrawal,
17
- })));
13
+ const [status, setStatus] = useState('waiting');
18
14
  const createWithdrawalMutation = useCreateMayaAppWithdrawalMutation({
15
+ onMutate() {
16
+ setStatus('processing');
17
+ },
19
18
  onSuccess() {
20
19
  form.reset();
21
- globalStore.depositWithdrawal.setOpen(false);
22
- toaster.success({
23
- description: 'Withdrawal request submitted successfully.',
24
- });
20
+ setStatus('success');
25
21
  },
26
- onError(error) {
27
- toaster.error({
28
- description: error.message,
29
- });
22
+ onError() {
23
+ setStatus('failed');
30
24
  },
31
25
  });
32
- const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
33
- const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
34
26
  const paymentSettingsQuery = usePaymentSettingsQuery();
35
27
  const paymentSettings = paymentSettingsQuery.data;
36
28
  const gatewaySettings = paymentSettings?.mayaAppWithdrawalGatewaySettings;
@@ -85,9 +77,6 @@ export function MayaAppWithdrawal() {
85
77
  transactionPassword: data.password,
86
78
  });
87
79
  });
88
- if (!isMayaSessionValid) {
89
- return _jsx(MayaSessionExpired, {});
90
- }
91
80
  return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [_jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
92
81
  o.field.onChange(details.value);
93
82
  }, formatOptions: {
@@ -99,5 +88,14 @@ export function MayaAppWithdrawal() {
99
88
  shouldDirty: true,
100
89
  shouldValidate: true,
101
90
  });
102
- }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: createWithdrawalMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Withdraw') })] }));
91
+ }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
92
+ if (!details.open) {
93
+ setStatus('waiting');
94
+ }
95
+ }, 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' &&
96
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
97
+ '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' &&
98
+ '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: () => {
99
+ api.setOpen(false);
100
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
103
101
  }
@@ -1,33 +1,28 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Portal } from '@ark-ui/react';
2
3
  import { zodResolver } from '@hookform/resolvers/zod';
3
- import { useEffect } from 'react';
4
+ import { useEffect, useState } from 'react';
4
5
  import { Controller, useForm } from 'react-hook-form';
5
6
  import { z } from 'zod';
6
- import { useShallow } from 'zustand/shallow';
7
- import { useCreateMayaWithdrawalMutation, useGlobalStore, useLocaleInfo, useMobileNumberParser, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
- import { toaster } from '../../../../client/utils/index.js';
9
- import { ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, } from '../../../../icons/index.js';
10
- import { Button, Field, NumberInput, PasswordInput } from '../../../../ui/index.js';
7
+ import { useCreateMayaWithdrawalMutation, useLocaleInfo, useMobileNumberParser, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, EyeIcon, EyeOffIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
9
+ import { AlertDialog, Button, Field, NumberInput, PasswordInput, } from '../../../../ui/index.js';
11
10
  import { parseDecimal } from '../../../../utils/index.js';
12
11
  import { AmountChoices } from '../../AmountChoices.js';
13
12
  export function MayaWithdrawal() {
14
- const globalStore = useGlobalStore(useShallow((ctx) => ({
15
- depositWithdrawal: ctx.depositWithdrawal,
16
- })));
13
+ const [status, setStatus] = useState('waiting');
17
14
  const localeInfo = useLocaleInfo();
18
15
  const mobileNumberParser = useMobileNumberParser();
19
16
  const createWithdrawalMutation = useCreateMayaWithdrawalMutation({
17
+ onMutate() {
18
+ setStatus('processing');
19
+ },
20
20
  onSuccess() {
21
21
  form.reset();
22
- globalStore.depositWithdrawal.setOpen(false);
23
- toaster.success({
24
- description: 'Withdrawal request submitted successfully.',
25
- });
22
+ setStatus('success');
26
23
  },
27
- onError(error) {
28
- toaster.error({
29
- description: error.message,
30
- });
24
+ onError() {
25
+ setStatus('failed');
31
26
  },
32
27
  });
33
28
  const paymentSettingsQuery = usePaymentSettingsQuery();
@@ -101,5 +96,14 @@ export function MayaWithdrawal() {
101
96
  shouldDirty: true,
102
97
  shouldValidate: true,
103
98
  });
104
- }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: createWithdrawalMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') })] }));
99
+ }, 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("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
100
+ if (!details.open) {
101
+ setStatus('waiting');
102
+ }
103
+ }, 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' &&
104
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
105
+ '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' &&
106
+ '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: () => {
107
+ api.setOpen(false);
108
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
105
109
  }
@@ -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, useIsMayaSessionValidQuery, 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,10 +12,14 @@ 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();
18
20
  const paymentSettings = paymentSettingsQuery.data;
21
+ const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
22
+ const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
19
23
  const enabledPaymentMethods = (() => {
20
24
  const l = [];
21
25
  if (onMMA) {
@@ -51,25 +55,37 @@ export function Withdrawal() {
51
55
  setPaymentMethod(enabledPaymentMethods[0]);
52
56
  }
53
57
  }, [enabledPaymentMethods, paymentMethod]);
54
- if (account) {
55
- if (!account.transactionPassword ||
56
- account.verificationStatus !== 'VERIFIED')
57
- return _jsx(WithdrawalNotAllowed, {});
58
- }
59
- if (paymentSettingsQuery.isLoading) {
58
+ if (accountQuery.isLoading ||
59
+ walletQuery.isLoading ||
60
+ paymentSettingsQuery.isLoading ||
61
+ isMayaSessionValidQuery.isLoading) {
60
62
  return _jsx(SpinnerIcon, { className: "mx-auto size-6" });
61
63
  }
64
+ if (!isMayaSessionValid) {
65
+ return _jsx(MayaSessionSessionExpired, {});
66
+ }
67
+ if (parseDecimal(wallet?.balance, 0) < 1) {
68
+ return _jsx(InsufficientBalance, {});
69
+ }
70
+ if (!account?.transactionPassword ||
71
+ account.verificationStatus !== 'VERIFIED') {
72
+ return _jsx(AccountVerificationRequired, {});
73
+ }
62
74
  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"] }));
75
+ return _jsx(NoAvailablePaymentMethods, {});
64
76
  }
65
77
  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
78
  }
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" })] })] }));
79
+ function AccountVerificationRequired() {
80
+ 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" })] }));
81
+ }
82
+ function InsufficientBalance() {
83
+ const setTab = useGlobalStore(useShallow((ctx) => ctx.depositWithdrawal.setTab));
84
+ 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" })] }));
85
+ }
86
+ function NoAvailablePaymentMethods() {
87
+ 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." })] }));
88
+ }
89
+ function MayaSessionSessionExpired() {
90
+ 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: "Session Expired" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "Your session has timed out. To continue with deposits or withdrawals, Please try reloading the app." })] }));
75
91
  }
@@ -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
  };