@opexa/portal-components 0.0.697 → 0.0.698

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 (71) hide show
  1. package/dist/client/hooks/useCreateGCashWebpayDepositMutation.d.ts +4 -0
  2. package/dist/client/hooks/useCreateGCashWebpayDepositMutation.js +73 -0
  3. package/dist/components/AccountInfo/GoogleDisconnect.d.ts +7 -0
  4. package/dist/components/AccountInfo/GoogleDisconnect.js +11 -0
  5. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +24 -16
  6. package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .d.ts +1 -0
  7. package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .js +191 -0
  8. package/dist/components/DepositWithdrawal/PaymentMethods.js +7 -2
  9. package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
  10. package/dist/components/DepositWithdrawal/utils.js +1 -0
  11. package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
  12. package/dist/components/DigitainLauncher/Loading.js +5 -0
  13. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.d.ts +23 -0
  14. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarousel.js +1 -1
  15. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.d.ts +24 -1
  16. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +41 -9
  17. package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +22 -0
  18. package/dist/components/Jackpots/JackpotsList/JackpotsList.js +1 -1
  19. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.d.ts +24 -1
  20. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +32 -10
  21. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.d.ts +24 -1
  22. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +32 -10
  23. package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.d.ts +1 -0
  24. package/dist/components/Jackpots/JackpotsList/useJackpotsListItemData.js +11 -0
  25. package/dist/components/KYC/BasicInformation.d.ts +1 -0
  26. package/dist/components/KYC/BasicInformation.js +101 -0
  27. package/dist/components/KYC/IdentityVerification.d.ts +1 -0
  28. package/dist/components/KYC/IdentityVerification.js +120 -0
  29. package/dist/components/KYC/Indicator.d.ts +1 -0
  30. package/dist/components/KYC/Indicator.js +8 -0
  31. package/dist/components/KYC/KYC.lazy.d.ts +6 -0
  32. package/dist/components/KYC/KYC.lazy.js +45 -0
  33. package/dist/components/KYC/KYCContext.d.ts +6 -0
  34. package/dist/components/KYC/KYCContext.js +2 -0
  35. package/dist/components/KYC/PersonalInformation.d.ts +1 -0
  36. package/dist/components/KYC/PersonalInformation.js +122 -0
  37. package/dist/components/KYC/useKYC.d.ts +25 -0
  38. package/dist/components/KYC/useKYC.js +38 -0
  39. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +1 -0
  40. package/dist/components/PortalProvider/CXDTokenObserver.js +30 -0
  41. package/dist/icons/LinkBrokenIcon.d.ts +2 -0
  42. package/dist/icons/LinkBrokenIcon.js +4 -0
  43. package/dist/images/responsible-gaming-yellow.png +0 -0
  44. package/dist/services/queries.d.ts +1 -1
  45. package/dist/services/queries.js +3 -0
  46. package/dist/services/wallet.d.ts +2 -0
  47. package/dist/services/wallet.js +4 -4
  48. package/dist/types/index.d.ts +1 -0
  49. package/dist/ui/AlertDialog/AlertDialog.d.ts +55 -55
  50. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +5 -5
  51. package/dist/ui/Carousel/Carousel.d.ts +72 -72
  52. package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
  53. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  54. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  55. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  56. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  57. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  58. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  59. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  60. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  61. package/dist/ui/Menu/Menu.d.ts +252 -252
  62. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  63. package/dist/ui/Progress/Progress.d.ts +27 -27
  64. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  65. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  66. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  67. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  68. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  69. package/dist/ui/Select/Select.d.ts +45 -45
  70. package/dist/ui/Select/select.recipe.d.ts +3 -3
  71. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import { type CreateGCashWebpayDepositInput } from '../../services/wallet';
3
+ import type { Deposit, Mutation } from '../../types';
4
+ export declare const useCreateGCashWebpayDepositMutation: Mutation<Deposit, SetOptional<CreateGCashWebpayDepositInput, 'id'>>;
@@ -0,0 +1,73 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import { clamp } from 'lodash-es';
4
+ import invariant from 'tiny-invariant';
5
+ import { ObjectType } from '../../services/ObjectType.js';
6
+ import { createGCashWebpayDeposit, getDeposit, } from '../../services/wallet.js';
7
+ import { createPoll } from '../../utils/createPoll.js';
8
+ import { getQueryClient } from '../../utils/getQueryClient.js';
9
+ import { getCreateGCashDepositMutationKey } from '../../utils/mutationKeys.js';
10
+ import { parseDecimal } from '../../utils/parseDecimal.js';
11
+ import { getAvailableQuestsQueryKey, getDepositsCountQueryKey, } from '../../utils/queryKeys.js';
12
+ import { getSession } from '../services/getSession.js';
13
+ export const useCreateGCashWebpayDepositMutation = (config) => {
14
+ const queryClient = getQueryClient();
15
+ const mutation = useMutation({
16
+ ...config,
17
+ mutationKey: getCreateGCashDepositMutationKey(),
18
+ mutationFn: async (input) => {
19
+ const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
20
+ const session = await getSession();
21
+ invariant(session.status === 'authenticated');
22
+ await createGCashWebpayDeposit({ ...input, id }, {
23
+ headers: {
24
+ Authorization: `Bearer ${session.token}`,
25
+ ...(session.domain && {
26
+ Domain: session.domain,
27
+ }),
28
+ },
29
+ });
30
+ const poll = createPoll(async () => {
31
+ const session = await getSession();
32
+ invariant(session.status === 'authenticated');
33
+ return await getDeposit(id, {
34
+ headers: {
35
+ Authorization: `Bearer ${session.token}`,
36
+ },
37
+ });
38
+ }, {
39
+ until(res) {
40
+ return !!res?.checkoutUrl;
41
+ },
42
+ interval: 1000,
43
+ maxAttempt: 5,
44
+ });
45
+ const res = await poll();
46
+ if (!res?.checkoutUrl) {
47
+ const error = new Error();
48
+ error.name = 'GCashDepositError';
49
+ error.message = 'Failed to process GCash deposit';
50
+ throw error;
51
+ }
52
+ const depositsCount = queryClient.getQueryData(getDepositsCountQueryKey()) ?? 0;
53
+ if (depositsCount <= 0) {
54
+ queryClient.setQueryData(getAvailableQuestsQueryKey(), (prev) => {
55
+ return prev?.map((quest) => {
56
+ const progressPercentage = clamp(parseDecimal(quest.progressPercentage, 0) + 50, 100);
57
+ if (quest.type === 'ONBOARDING') {
58
+ return {
59
+ ...quest,
60
+ status: progressPercentage >= 100 ? 'COMPLETED' : quest.status,
61
+ progressPercentage: progressPercentage.toFixed(2),
62
+ };
63
+ }
64
+ return quest;
65
+ });
66
+ });
67
+ }
68
+ queryClient.setQueryData(getDepositsCountQueryKey(), (prev) => prev ? prev + 1 : 1);
69
+ return res;
70
+ },
71
+ });
72
+ return mutation;
73
+ };
@@ -0,0 +1,7 @@
1
+ import { type UseDisclosureReturn } from '../../client/hooks/useDisclosure';
2
+ interface GoogleDisconnectProps {
3
+ onConfirmAction?: (ctx: UseDisclosureReturn) => React.ReactNode;
4
+ children?: (ctx: UseDisclosureReturn) => React.ReactNode;
5
+ }
6
+ export declare function GoogleDisconnect(props: GoogleDisconnectProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useDisclosure, } from '../../client/hooks/useDisclosure.js';
4
+ import { LinkBrokenIcon } from '../../icons/LinkBrokenIcon.js';
5
+ import { XIcon } from '../../icons/XIcon.js';
6
+ import { Dialog } from '../../ui/Dialog/index.js';
7
+ import { Portal } from '../../ui/Portal/index.js';
8
+ export function GoogleDisconnect(props) {
9
+ const disclosure = useDisclosure();
10
+ return (_jsxs(_Fragment, { children: [props.children?.(disclosure), _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: disclosure.open, onOpenChange: (details) => disclosure.setOpen(details.open), 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: "mx-auto min-h-auto max-w-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBrokenIcon, {}) }), _jsx("h2", { className: "mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx("p", { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx("div", { className: "pt-6", children: props.onConfirmAction?.(disclosure) })] }) })] }) })] }));
11
+ }
@@ -13,6 +13,7 @@ import { AiOGrabPayDeposit } from './AiOGrabPayDeposit/AiOGrabPayDeposit.js';
13
13
  import { AiOPalawanPayDeposit } from './AiOPalawanPayDeposit/AiOPalawanPayDeposit.js';
14
14
  import { AiOPayMayaDeposit } from './AiOPayMayaDeposit/AiOPayMayaDeposit.js';
15
15
  import { GCashDeposit } from './GCashDeposit/GCashDeposit.js';
16
+ import { GCashWebpayDeposit } from './GCashWebpayDeposit /GCashWebpayDeposit .js';
16
17
  import { LibanganDeposit } from './LibanganDeposit/LibanganDeposit.js';
17
18
  import { MayaAppDeposit } from './MayaAppDeposit/MayaAppDeposit.js';
18
19
  import { MayaDeposit } from './MayaDeposit/MayaDeposit.js';
@@ -35,50 +36,57 @@ export function Deposit() {
35
36
  const paymentMethods = [
36
37
  {
37
38
  method: 'GCASH',
38
- condition: () => paymentSettings?.gcashDepositGatewaySettings?.[enabledKey] || false,
39
+ enabled: paymentSettings?.gcashDepositGatewaySettings?.[enabledKey],
39
40
  },
40
41
  {
41
42
  method: 'MAYA',
42
- condition: () => paymentSettings?.mayaDepositGatewaySettings?.[enabledKey] || false,
43
+ enabled: paymentSettings?.mayaDepositGatewaySettings?.[enabledKey],
43
44
  },
44
45
  {
45
46
  method: 'QRPH',
46
- condition: () => paymentSettings?.qrphDepositGatewaySettings?.[enabledKey] || false,
47
+ enabled: paymentSettings?.qrphDepositGatewaySettings?.[enabledKey],
47
48
  },
48
49
  {
49
50
  method: 'ONLINE_BANK',
50
- condition: () => paymentSettings?.onlineBankDepositGatewaySettings?.[enabledKey] ||
51
- false,
51
+ enabled: paymentSettings?.onlineBankDepositGatewaySettings?.[enabledKey],
52
52
  },
53
53
  {
54
54
  method: 'LIBANGAN_PAY_IN',
55
- condition: () => paymentSettings?.libanganDepositGatewaySettings?.[enabledKey] ||
56
- false,
55
+ enabled: paymentSettings?.libanganDepositGatewaySettings?.[enabledKey],
57
56
  },
58
57
  {
59
58
  method: 'PISO_PAY',
60
- condition: () => paymentSettings?.pisoPayDepositGatewaySettings?.[enabledKey] || false,
59
+ enabled: paymentSettings?.pisoPayDepositGatewaySettings?.[enabledKey],
61
60
  },
62
61
  {
63
62
  method: 'AIO_GCASH',
64
- condition: () => (paymentSettings?.aioGCashDepositGatewaySettings?.[enabledKey] && featureFlag.enabled) || false,
63
+ enabled: paymentSettings?.aioGCashDepositGatewaySettings?.[enabledKey] &&
64
+ featureFlag.enabled,
65
65
  },
66
66
  {
67
67
  method: 'AIO_PAY_MAYA',
68
- condition: () => (paymentSettings?.aioPayMayaDepositGatewaySettings?.[enabledKey] && featureFlag.enabled) || false,
68
+ enabled: paymentSettings?.aioPayMayaDepositGatewaySettings?.[enabledKey] &&
69
+ featureFlag.enabled,
69
70
  },
70
71
  {
71
72
  method: 'AIO_GRAB_PAY',
72
- condition: () => (paymentSettings?.aioGrabPayDepositGatewaySettings?.[enabledKey] && featureFlag.enabled) || false,
73
+ enabled: paymentSettings?.aioGrabPayDepositGatewaySettings?.[enabledKey] &&
74
+ featureFlag.enabled,
73
75
  },
74
76
  {
75
77
  method: 'AIO_PALAWAN_PAY',
76
- condition: () => (paymentSettings?.aioPalawanPayDepositGatewaySettings?.[enabledKey] && featureFlag.enabled) || false,
78
+ enabled: paymentSettings?.aioPalawanPayDepositGatewaySettings?.[enabledKey] &&
79
+ featureFlag.enabled,
80
+ },
81
+ {
82
+ method: 'GCASH_WEBPAY',
83
+ enabled: paymentSettings?.gcashWebpayDepositGatewaySettings?.[enabledKey] &&
84
+ featureFlag.enabled,
77
85
  },
78
86
  ];
79
- paymentMethods.forEach(({ method, condition }) => {
80
- if (condition()) {
81
- l.push(method);
87
+ paymentMethods.forEach((o) => {
88
+ if (o.enabled) {
89
+ l.push(o.method);
82
90
  }
83
91
  });
84
92
  return l;
@@ -100,7 +108,7 @@ export function Deposit() {
100
108
  if (enabledPaymentMethods.length <= 0) {
101
109
  return _jsx(NoAvailablePaymentMethods, {});
102
110
  }
103
- return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN_PAY_IN' && _jsx(LibanganDeposit, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayDeposit, {}), paymentMethod === 'AIO_GCASH' && _jsx(AiOGCashDeposit, {}), paymentMethod === 'AIO_PAY_MAYA' && _jsx(AiOPayMayaDeposit, {}), paymentMethod === 'AIO_GRAB_PAY' && _jsx(AiOGrabPayDeposit, {}), paymentMethod === 'AIO_PALAWAN_PAY' && _jsx(AiOPalawanPayDeposit, {})] }));
111
+ return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN_PAY_IN' && _jsx(LibanganDeposit, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayDeposit, {}), paymentMethod === 'AIO_GCASH' && _jsx(AiOGCashDeposit, {}), paymentMethod === 'AIO_PAY_MAYA' && _jsx(AiOPayMayaDeposit, {}), paymentMethod === 'AIO_GRAB_PAY' && _jsx(AiOGrabPayDeposit, {}), paymentMethod === 'AIO_PALAWAN_PAY' && _jsx(AiOPalawanPayDeposit, {}), paymentMethod === 'GCASH_WEBPAY' && _jsx(GCashWebpayDeposit, {})] }));
104
112
  }
105
113
  function MayaSessionSessionExpired() {
106
114
  return (_jsxs("div", { className: "py-xl", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-warning-secondary", children: _jsx(AlertCircleIcon, { className: "size-6 text-text-featured-icon-light-warning" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg", children: "Session Expired" }), _jsx("p", { className: "mx-auto mt-xs max-w-[25rem] text-center text-sm text-text-tertiary-600", children: "Your session has timed out. To continue with deposits or withdrawals, Please try reloading the app." })] }));
@@ -0,0 +1 @@
1
+ export declare function GCashWebpayDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,191 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import Link from 'next/link';
4
+ import { useEffect, useState } from 'react';
5
+ import { Controller, useForm } from 'react-hook-form';
6
+ import invariant from 'tiny-invariant';
7
+ import { z } from 'zod';
8
+ import { useShallow } from 'zustand/shallow';
9
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
10
+ import { useCreateGCashWebpayDepositMutation } from '../../../../client/hooks/useCreateGCashWebpayDepositMutation.js';
11
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
12
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
13
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
14
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
15
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
16
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
17
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
18
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
19
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
20
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
21
+ import { XIcon } from '../../../../icons/XIcon.js';
22
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
23
+ import { Button } from '../../../../ui/Button/index.js';
24
+ import { Field } from '../../../../ui/Field/index.js';
25
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
26
+ import { Portal } from '../../../../ui/Portal/index.js';
27
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
28
+ import { AmountChoices } from '../../AmountChoices.js';
29
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
30
+ import { AvailablePromos } from '../AvailablePromos.js';
31
+ export function GCashWebpayDeposit() {
32
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
33
+ const disclosure = useDisclosure();
34
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
35
+ depositWithdrawal: ctx.depositWithdrawal,
36
+ kycVerificationStatus: ctx.kycVerificationStatus,
37
+ })));
38
+ const verificationQuery = useMemberVerificationQuery();
39
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
40
+ const [status, setStatus] = useState('waiting');
41
+ const createDepositMutation = useCreateGCashWebpayDepositMutation({
42
+ onMutate() {
43
+ disclosure.setOpen(true);
44
+ setStatus('processing');
45
+ },
46
+ onSuccess(data) {
47
+ invariant(data.checkoutUrl);
48
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
49
+ form.reset();
50
+ disclosure.setOpen(false);
51
+ },
52
+ onError() {
53
+ disclosure.setOpen(true);
54
+ setStatus('failed');
55
+ },
56
+ });
57
+ const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
58
+ enabled: createDepositMutation.data != null,
59
+ refetchInterval(ctx) {
60
+ if (ctx.state.data?.status === 'CANCELLED' ||
61
+ ctx.state.data?.status === 'CONFIRMED') {
62
+ return false;
63
+ }
64
+ else {
65
+ return 2500;
66
+ }
67
+ },
68
+ });
69
+ useEffect(() => {
70
+ if (depositQuery.data?.status === 'CANCELLED') {
71
+ disclosure.setOpen(true);
72
+ setStatus('failed');
73
+ }
74
+ else if (depositQuery.data?.status === 'CONFIRMED') {
75
+ disclosure.setOpen(true);
76
+ setStatus('success');
77
+ }
78
+ }, [depositQuery.data?.status, disclosure]);
79
+ const depositsCountQuery = useDepositsCountQuery();
80
+ const depositsCount = depositsCountQuery.data ?? 0;
81
+ const paymentSettingsQuery = usePaymentSettingsQuery();
82
+ const paymentSettings = paymentSettingsQuery.data;
83
+ const gatewaySettings = paymentSettings?.gcashWebpayDepositGatewaySettings;
84
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
85
+ const minimumAmount = depositsCount <= 0
86
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
87
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
88
+ const promosQuery = useAvailablePromosQuery();
89
+ const promos = promosQuery.data ?? [];
90
+ const definition = z
91
+ .object({
92
+ amount: z.string().superRefine((val, ctx) => {
93
+ const n = parseDecimal(val, 0);
94
+ if (n < minimumAmount) {
95
+ ctx.addIssue({
96
+ type: 'number',
97
+ code: z.ZodIssueCode.too_small,
98
+ inclusive: true,
99
+ minimum: minimumAmount,
100
+ message: `Minimum amount is ${minimumAmount.toLocaleString()}`,
101
+ });
102
+ }
103
+ if (n > maximumAmount) {
104
+ ctx.addIssue({
105
+ type: 'number',
106
+ code: z.ZodIssueCode.too_big,
107
+ inclusive: true,
108
+ maximum: maximumAmount,
109
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
110
+ });
111
+ }
112
+ }),
113
+ promo: z.string().optional().nullable(),
114
+ })
115
+ .superRefine((value, ctx) => {
116
+ const promo = promos.find((o) => o.id === value.promo);
117
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
118
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
119
+ const amount = parseDecimal(value.amount, 0);
120
+ if (promo && amount < promoMinAmount) {
121
+ ctx.addIssue({
122
+ path: ['amount'],
123
+ code: z.ZodIssueCode.custom,
124
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
125
+ });
126
+ }
127
+ if (promo && amount > promoMaxAmount) {
128
+ ctx.addIssue({
129
+ path: ['amount'],
130
+ code: z.ZodIssueCode.custom,
131
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
132
+ });
133
+ }
134
+ });
135
+ const form = useForm({
136
+ mode: 'all',
137
+ resolver: zodResolver(definition),
138
+ defaultValues: {
139
+ amount: '0',
140
+ promo: globalStore.depositWithdrawal.promo ?? null,
141
+ },
142
+ });
143
+ useEffect(() => {
144
+ if (minimumAmount) {
145
+ form.reset({
146
+ amount: minimumAmount.toString(),
147
+ promo: form.getValues('promo') ?? null,
148
+ });
149
+ }
150
+ }, [form, minimumAmount]);
151
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
152
+ //handle new kyc process
153
+ if (verificationStatus === 'PENDING' ||
154
+ verificationStatus === 'UNVERIFIED' ||
155
+ verificationStatus === 'REJECTED' ||
156
+ verificationStatus === 'CREATED') {
157
+ globalStore.kycVerificationStatus.setOpen(true);
158
+ return;
159
+ }
160
+ else {
161
+ createDepositMutation.reset();
162
+ createDepositMutation.mutate({
163
+ amount: data.amount.toString(),
164
+ promo: data.promo ?? undefined,
165
+ successRedirectionUrl: window.location.origin,
166
+ cancelRedirectionUrl: window.location.origin,
167
+ });
168
+ }
169
+ }), 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) => {
170
+ o.field.onChange(details.value);
171
+ }, formatOptions: {
172
+ maximumFractionDigits: 2,
173
+ minimumFractionDigits: 0,
174
+ }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to deposit" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
175
+ form.setValue('amount', value.toString(), {
176
+ shouldTouch: true,
177
+ shouldDirty: true,
178
+ shouldValidate: true,
179
+ });
180
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
181
+ o.field.onChange(value);
182
+ globalStore.depositWithdrawal.setPromo(null);
183
+ }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: disclosure.open, onOpenChange: (details) => {
184
+ disclosure.setOpen(details.open);
185
+ }, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
186
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
187
+ 'Your deposit has been successfully processed.', status === 'failed' &&
188
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
189
+ api.setOpen(false);
190
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
191
+ }
@@ -4,14 +4,14 @@ import { twMerge } from 'tailwind-merge';
4
4
  import { useControllableState } from '../../client/hooks/useControllableState.js';
5
5
  import { CheckIcon } from '../../icons/CheckIcon.js';
6
6
  import gcash from '../../images/gcash.png';
7
+ import grabPay from '../../images/grabpay.png';
7
8
  import instapay from '../../images/instapay.png';
8
9
  import libangan from '../../images/libangan.png';
9
10
  import maya from '../../images/maya.png';
10
11
  import onlineBank from '../../images/online-bank.png';
12
+ import palawanPay from '../../images/palawanpay.png';
11
13
  import pisoPay from '../../images/piso-pay.png';
12
14
  import qrph from '../../images/QRPH.png';
13
- import palawanPay from '../../images/palawanpay.png';
14
- import grabPay from '../../images/grabpay.png';
15
15
  import { Checkbox } from '../../ui/Checkbox/index.js';
16
16
  import { Field } from '../../ui/Field/index.js';
17
17
  import { PaymentMethodDefinition } from './utils.js';
@@ -81,6 +81,11 @@ const OPTIONS = [
81
81
  label: 'Palawan Pay',
82
82
  image: palawanPay,
83
83
  },
84
+ {
85
+ value: 'GCASH_WEBPAY',
86
+ label: 'GCash Webpay',
87
+ image: gcash,
88
+ },
84
89
  ];
85
90
  export function PaymentMethods(props) {
86
91
  const options = props.options?.length
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { KnownDepositError, KnownWithdrawalError, WithdrawalError } from '../../types';
3
- export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN_PAY_IN", "VENTAJA_DISBURSEMENT", "PISO_PAY", "AIO_GCASH", "AIO_PAY_MAYA", "AIO_GRAB_PAY", "AIO_PALAWAN_PAY"]>;
3
+ export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN_PAY_IN", "VENTAJA_DISBURSEMENT", "PISO_PAY", "AIO_GCASH", "AIO_PAY_MAYA", "AIO_GRAB_PAY", "AIO_PALAWAN_PAY", "GCASH_WEBPAY"]>;
4
4
  export type PaymentMethod = z.infer<typeof PaymentMethodDefinition>;
5
5
  export type DepositWithdrawalErrors = KnownDepositError | KnownWithdrawalError | WithdrawalError | string;
6
6
  export declare function explainError(error?: DepositWithdrawalErrors): string;
@@ -13,6 +13,7 @@ export const PaymentMethodDefinition = z.enum([
13
13
  'AIO_PAY_MAYA',
14
14
  'AIO_GRAB_PAY',
15
15
  'AIO_PALAWAN_PAY',
16
+ 'GCASH_WEBPAY',
16
17
  ]);
17
18
  const errorMap = {
18
19
  DAILY_PURCHASE_OR_DEPOSIT_LIMIT_EXCEEDED: 'You have exceeded your daily purchase or deposit limit. Please try again tomorrow.',
@@ -0,0 +1 @@
1
+ export declare function Loading(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function Loading() {
4
+ return (_jsx("div", { className: "flex h-[calc(100vh-400px)] w-full items-center justify-center px-4", children: _jsxs("div", { className: "flex flex-col items-center space-y-4", children: [_jsx("div", { className: "h-10 w-10 animate-spin rounded-full border-4 border-blue-500 border-t-transparent" }), _jsx("p", { className: "font-medium text-gray-700 text-lg", children: "Loading Sports Book\u2026" })] }) }));
5
+ }
@@ -1,3 +1,4 @@
1
+ import type { ImageProps } from 'next/image';
1
2
  import { type CSSProperties, type ReactNode } from 'react';
2
3
  export interface ClassNameEntries {
3
4
  root?: string;
@@ -39,6 +40,28 @@ export interface JackpotsCarouselProps {
39
40
  image?: string;
40
41
  };
41
42
  };
43
+ chestImagesByTier?: {
44
+ grand?: {
45
+ open: ImageProps['src'];
46
+ closed: ImageProps['src'];
47
+ };
48
+ major?: {
49
+ open: ImageProps['src'];
50
+ closed: ImageProps['src'];
51
+ };
52
+ minor?: {
53
+ open: ImageProps['src'];
54
+ closed: ImageProps['src'];
55
+ };
56
+ default?: {
57
+ open: ImageProps['src'];
58
+ closed: ImageProps['src'];
59
+ };
60
+ style?: {
61
+ wrapper?: string;
62
+ image?: string;
63
+ };
64
+ };
42
65
  jackpotProfileShape?: 'oval' | 'star';
43
66
  }
44
67
  export declare function JackpotsCarousel({ style, className, ...props }: JackpotsCarouselProps): import("react/jsx-runtime").JSX.Element | null;
@@ -67,5 +67,5 @@ export function JackpotsCarousel({ style, className, ...props }) {
67
67
  const classNames = isString(className)
68
68
  ? { root: className }
69
69
  : (className ?? {});
70
- return (_jsxs("div", { ref: ref, style: styles.root, className: classNames.root, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "font-semibold text-lg", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/jackpots', className: "flex gap-sm font-semibold text-button-tertiary-fg text-sm", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: "rounded-l-none", "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] })] }), _jsx("div", { className: "relative mt-lg overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-2.5", children: jackpots.map((jackpot) => (_jsx(JackpotsCarouselItemContext, { value: jackpot, children: _jsx(JackpotsCarouselItem, { style: styles.itemRoot, className: classNames, viewAllUrl: props.viewAllUrl, animate: props.animate, customJackpotChestImage: props.customJackpotChestImage, jackpotProfileShape: props.jackpotProfileShape }) }, jackpot.id))) }) })] }));
70
+ return (_jsxs("div", { ref: ref, style: styles.root, className: classNames.root, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "font-semibold text-lg", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "flex items-center md:gap-3xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/jackpots', className: "flex gap-sm font-semibold text-button-tertiary-fg text-sm", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: "rounded-l-none", "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] })] }), _jsx("div", { className: "relative mt-lg overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-2.5", children: jackpots.map((jackpot) => (_jsx(JackpotsCarouselItemContext, { value: jackpot, children: _jsx(JackpotsCarouselItem, { style: styles.itemRoot, className: classNames, viewAllUrl: props.viewAllUrl, animate: props.animate, customJackpotChestImage: props.customJackpotChestImage, jackpotProfileShape: props.jackpotProfileShape, chestImagesByTier: props.chestImagesByTier }) }, jackpot.id))) }) })] }));
71
71
  }
@@ -1,3 +1,4 @@
1
+ import { type ImageProps } from 'next/image';
1
2
  import { type CSSProperties } from 'react';
2
3
  import type { ClassNameEntries } from './JackpotsCarousel';
3
4
  export interface JackpotsCarouselItemProps {
@@ -16,6 +17,28 @@ export interface JackpotsCarouselItemProps {
16
17
  };
17
18
  };
18
19
  animate?: boolean;
20
+ chestImagesByTier?: {
21
+ grand?: {
22
+ open: ImageProps['src'];
23
+ closed: ImageProps['src'];
24
+ };
25
+ major?: {
26
+ open: ImageProps['src'];
27
+ closed: ImageProps['src'];
28
+ };
29
+ minor?: {
30
+ open: ImageProps['src'];
31
+ closed: ImageProps['src'];
32
+ };
33
+ default?: {
34
+ open: ImageProps['src'];
35
+ closed: ImageProps['src'];
36
+ };
37
+ style?: {
38
+ wrapper?: string;
39
+ image?: string;
40
+ };
41
+ };
19
42
  jackpotProfileShape?: 'oval' | 'star';
20
43
  }
21
- export declare function JackpotsCarouselItem({ style, className, viewAllUrl, animate, customJackpotChestImage, jackpotProfileShape, }: JackpotsCarouselItemProps): import("react/jsx-runtime").JSX.Element | null;
44
+ export declare function JackpotsCarouselItem({ style, className, viewAllUrl, animate, customJackpotChestImage, chestImagesByTier, jackpotProfileShape, }: JackpotsCarouselItemProps): import("react/jsx-runtime").JSX.Element | null;
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { Progress } from '@ark-ui/react/progress';
4
4
  import { format } from 'date-fns';
5
5
  import isMobile from 'is-mobile';
6
- import Image from 'next/image';
6
+ import Image, {} from 'next/image';
7
7
  import Link from 'next/link';
8
8
  import { useCallback, useEffect, useId, useMemo, useState, } from 'react';
9
9
  import { twMerge } from 'tailwind-merge';
@@ -27,11 +27,49 @@ import { mask } from '../../../utils/mask.js';
27
27
  import { parseDecimal } from '../../../utils/parseDecimal.js';
28
28
  import styles from '../Jackpots.module.css';
29
29
  import { useJackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
30
- export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = true, customJackpotChestImage, jackpotProfileShape = 'oval', }) {
30
+ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = true, customJackpotChestImage, chestImagesByTier, jackpotProfileShape = 'oval', }) {
31
31
  const [ref, inView] = useIntersectionObserver({
32
32
  threshold: 0.75,
33
33
  });
34
34
  const jackpot = useJackpotsCarouselItemContext();
35
+ const getTierFromName = (name) => {
36
+ const lowerName = name.toLowerCase();
37
+ if (lowerName.includes('grand'))
38
+ return 'grand';
39
+ if (lowerName.includes('major'))
40
+ return 'major';
41
+ if (lowerName.includes('minor'))
42
+ return 'minor';
43
+ return 'default';
44
+ };
45
+ const getChestImages = () => {
46
+ // Priority: chestImagesByTier > customJackpotChestImage > default
47
+ if (chestImagesByTier) {
48
+ const tier = getTierFromName(jackpot.name);
49
+ const tierImages = chestImagesByTier[tier] || chestImagesByTier.default;
50
+ if (tierImages) {
51
+ return {
52
+ open: tierImages.open,
53
+ closed: tierImages.closed,
54
+ style: chestImagesByTier.style,
55
+ };
56
+ }
57
+ }
58
+ if (customJackpotChestImage?.image) {
59
+ return {
60
+ open: customJackpotChestImage.image.open,
61
+ closed: customJackpotChestImage.image.closed,
62
+ style: customJackpotChestImage.style,
63
+ };
64
+ }
65
+ // Default fallback
66
+ return {
67
+ open: openChest,
68
+ closed: closeChest,
69
+ style: undefined,
70
+ };
71
+ };
72
+ const chestImages = getChestImages();
35
73
  const jackpotPayoutsQuery = useJackpotPayoutsQuery({
36
74
  first: 30,
37
75
  filter: {
@@ -97,13 +135,7 @@ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = t
97
135
  currency: localeInfo.currency.code,
98
136
  minDecimalPlaces: 2,
99
137
  maxDecimalPlaces: 2,
100
- }) })] }), _jsx("div", { className: "hidden min-w-25 lg:block" }), _jsx("div", { className: twMerge('right-0 bottom-[-60] z-1 min-w-25 lg:absolute', customJackpotChestImage?.style?.wrapper), children: _jsx(Image, { width: 150, height: 150, src: customJackpotChestImage?.image
101
- ? isPayingOut
102
- ? customJackpotChestImage.image.open
103
- : customJackpotChestImage.image.closed
104
- : isPayingOut
105
- ? openChest
106
- : closeChest, alt: "closeChest", className: twMerge('size-full h-25 w-25 p-2 lg:h-37.5 lg:w-37.5', customJackpotChestImage?.style?.image) }) })] }), _jsx("div", { className: twMerge('relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex', className?.latestPayoutRoot), children: latestJackpotPayout?.amount ? (_jsxs(_Fragment, { children: [_jsx(ProfileIcon, {}), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: mask(latestJackpotPayout.member.name, {
138
+ }) })] }), _jsx("div", { className: "hidden min-w-25 lg:block" }), _jsx("div", { className: twMerge('right-0 bottom-[-60] z-1 min-w-25 lg:absolute', chestImages?.style?.wrapper), children: _jsx(Image, { width: 150, height: 150, src: isPayingOut ? chestImages.open : chestImages.closed, alt: "closeChest", className: twMerge('size-full h-25 w-25 p-2 lg:h-37.5 lg:w-37.5', chestImages?.style?.image) }) })] }), _jsx("div", { className: twMerge('relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex', className?.latestPayoutRoot), children: latestJackpotPayout?.amount ? (_jsxs(_Fragment, { children: [_jsx(ProfileIcon, {}), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsx(PayoutBadge, {}), _jsx("div", { className: "font-semibold", children: mask(latestJackpotPayout.member.name, {
107
139
  totalCharsCount: 6,
108
140
  }) }), _jsx("div", { className: twMerge('text-2xl text-brand-400', className?.latestPayoutAmount), children: formatNumber(latestJackpotPayout.amount, {
109
141
  currency: localeInfo.currency.code,