@opexa/portal-components 0.0.414 → 0.0.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Banner/Banner.client.d.ts +12 -0
- package/dist/components/Banner/Banner.client.js +49 -0
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +0 -1
- package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
- package/dist/components/DigitainLauncher/Loading.js +5 -0
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
- package/dist/components/KYC/BasicInformation.d.ts +1 -0
- package/dist/components/KYC/BasicInformation.js +101 -0
- package/dist/components/KYC/IdentityVerification.d.ts +1 -0
- package/dist/components/KYC/IdentityVerification.js +120 -0
- package/dist/components/KYC/Indicator.d.ts +1 -0
- package/dist/components/KYC/Indicator.js +8 -0
- package/dist/components/KYC/KYC.lazy.d.ts +6 -0
- package/dist/components/KYC/KYC.lazy.js +45 -0
- package/dist/components/KYC/KYCContext.d.ts +6 -0
- package/dist/components/KYC/KYCContext.js +2 -0
- package/dist/components/KYC/PersonalInformation.d.ts +1 -0
- package/dist/components/KYC/PersonalInformation.js +122 -0
- package/dist/components/KYC/useKYC.d.ts +25 -0
- package/dist/components/KYC/useKYC.js +38 -0
- package/dist/components/News/News.d.ts +1 -1
- package/dist/components/News/News.js +1 -1
- package/dist/components/NewsFeed/News.d.ts +1 -1
- package/dist/components/NewsFeed/News.js +1 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +1 -0
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +29 -0
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +1 -0
- package/dist/components/SessionWatcher/SessionWatcher.js +20 -0
- package/dist/components/SessionWatcher/index.d.ts +1 -0
- package/dist/components/SessionWatcher/index.js +1 -0
- package/dist/components/SignIn/utils.d.ts +8 -0
- package/dist/components/SignIn/utils.js +26 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +3 -1
- package/dist/components/TransactionRecords/DepositRecordsTable.js +3 -1
- package/dist/components/TransactionRecords/TableFilters.js +36 -21
- package/dist/components/TransactionRecords/TransactionContext.d.ts +6 -0
- package/dist/components/TransactionRecords/TransactionContext.js +2 -0
- package/dist/components/TransactionRecords/TransactionRecords.suspense.d.ts +3 -0
- package/dist/components/TransactionRecords/TransactionRecords.suspense.js +2 -1
- package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +5 -1
- package/dist/constants/Branches.d.ts +2 -0
- package/dist/constants/Branches.js +42 -0
- package/dist/constants/EnvVar.d.ts +1 -1
- package/dist/handlers/index.d.ts +7 -7
- package/dist/images/responsible-gaming-yellow.png +0 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +1 -0
- package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
- package/dist/third-parties/FacebookPixel/index.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
- package/dist/third-parties/index.d.ts +2 -0
- package/dist/third-parties/index.js +2 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +121 -121
- package/dist/ui/Dialog/dialog.recipe.d.ts +11 -11
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +252 -252
- package/dist/ui/Menu/menu.recipe.d.ts +14 -14
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/PinInput/PinInput.d.ts +12 -12
- package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { noop } from 'lodash-es';
|
|
3
|
+
import { Progress } from '../../ui/Progress/index.js';
|
|
4
|
+
import { useKYCContext } from './KYCContext.js';
|
|
5
|
+
export function Indicator() {
|
|
6
|
+
const kyc = useKYCContext();
|
|
7
|
+
return (_jsxs("div", { className: "flex items-center justify-center gap-1.5 py-3", children: [_jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 1 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 2 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step === 3 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ImageProps } from 'next/image';
|
|
2
|
+
import { type KYCReminderProps } from './KYCReminder.lazy';
|
|
3
|
+
export interface KYCProps extends KYCReminderProps {
|
|
4
|
+
logo: ImageProps['src'];
|
|
5
|
+
}
|
|
6
|
+
export declare function KYC(props: KYCProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
6
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
7
|
+
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
8
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
9
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
10
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
11
|
+
import { BasicInformation } from './BasicInformation.js';
|
|
12
|
+
import { IdentityVerification } from './IdentityVerification.js';
|
|
13
|
+
import { Indicator } from './Indicator.js';
|
|
14
|
+
import { KYCContext } from './KYCContext.js';
|
|
15
|
+
import { KYCReminder } from './KYCReminder.lazy.js';
|
|
16
|
+
import { PersonalInformation } from './PersonalInformation.js';
|
|
17
|
+
import { useKYC } from './useKYC.js';
|
|
18
|
+
export function KYC(props) {
|
|
19
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({ kyc: ctx.kyc })));
|
|
20
|
+
const kyc = useKYC();
|
|
21
|
+
const { data: account } = useAccountQuery();
|
|
22
|
+
const { data: verification } = useMemberVerificationQuery();
|
|
23
|
+
const isBasicInfoCompleted = account?.realName !== null && account?.birthDay !== null;
|
|
24
|
+
const isUploadCompleted = Boolean(verification?.idFrontImage) && Boolean(verification?.selfieImage);
|
|
25
|
+
const isVerified = Boolean(verification?.status === 'VERIFIED') ||
|
|
26
|
+
Boolean(verification?.status === 'PENDING') ||
|
|
27
|
+
Boolean(verification?.status === 'APPROVED');
|
|
28
|
+
const isRejected = Boolean(verification?.status === 'REJECTED');
|
|
29
|
+
const hasMissingData = !isBasicInfoCompleted || !isUploadCompleted || !isVerified;
|
|
30
|
+
const steps = !isBasicInfoCompleted
|
|
31
|
+
? 1
|
|
32
|
+
: !isUploadCompleted
|
|
33
|
+
? 2
|
|
34
|
+
: isRejected
|
|
35
|
+
? 2
|
|
36
|
+
: 3;
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (steps) {
|
|
39
|
+
kyc.setStep(steps);
|
|
40
|
+
}
|
|
41
|
+
}, [steps, kyc]);
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsx(KYCContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open && hasMissingData, onOpenChange: (details) => {
|
|
43
|
+
globalStore.kyc.setOpen(details.open);
|
|
44
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "mx-auto min-h-full w-full overflow-y-auto bg-bg-primary-alt lg:min-h-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PersonalInformation(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
+
import { useForm } from 'react-hook-form';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { useShallow } from 'zustand/shallow';
|
|
6
|
+
import { useApproveMemberVerification } from '../../client/hooks/useApproveMemberVerification.js';
|
|
7
|
+
import { useCreateMemberVerificationMutation } from '../../client/hooks/useCreateMemberVerificationMutation.js';
|
|
8
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
9
|
+
import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
|
|
10
|
+
import { useUpdateMemberVerificationMutation } from '../../client/hooks/useUpdateMemberVerificationMutation.js';
|
|
11
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
12
|
+
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
13
|
+
import { Button } from '../../ui/Button/index.js';
|
|
14
|
+
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
15
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
16
|
+
import { Field } from '../../ui/Field/index.js';
|
|
17
|
+
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
18
|
+
import { getMemberVerificationQueryKey } from '../../utils/queryKeys.js';
|
|
19
|
+
import { useKYCContext } from './KYCContext.js';
|
|
20
|
+
const definition = z.object({
|
|
21
|
+
address: z.string().trim().min(1, 'Current address is required'),
|
|
22
|
+
permanentAddress: z.string().trim().min(1, 'Permanent address is required'),
|
|
23
|
+
sourceOfIncome: z.string().trim().min(1, 'Source of Income is required'),
|
|
24
|
+
natureOfWork: z.string().trim().min(1, 'Nature of Work is required'),
|
|
25
|
+
placeOfBirth: z.string().trim().min(1, 'Place of Birth is required'),
|
|
26
|
+
nationality: z.string().trim().min(1, 'Nationality is required'),
|
|
27
|
+
});
|
|
28
|
+
export function PersonalInformation() {
|
|
29
|
+
const kyc = useKYCContext();
|
|
30
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
31
|
+
kyc: ctx.kyc,
|
|
32
|
+
})));
|
|
33
|
+
const memberVerificationQuery = useMemberVerificationQuery();
|
|
34
|
+
const memberVerificationId = memberVerificationQuery.data?.id;
|
|
35
|
+
const approveMemberVerificationMutation = useApproveMemberVerification();
|
|
36
|
+
const updateMemberVerificationMutation = useUpdateMemberVerificationMutation({
|
|
37
|
+
onError(error) {
|
|
38
|
+
toaster.error({
|
|
39
|
+
description: error.message,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
onSuccess() {
|
|
43
|
+
const queryClient = getQueryClient();
|
|
44
|
+
queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
|
|
45
|
+
if (!prev)
|
|
46
|
+
return prev;
|
|
47
|
+
return {
|
|
48
|
+
...prev,
|
|
49
|
+
status: 'PENDING',
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
kyc.setDone(true);
|
|
53
|
+
globalStore.kyc.setOpen(false);
|
|
54
|
+
toaster.success({
|
|
55
|
+
title: 'Success',
|
|
56
|
+
description: 'Personal information has been set successfully.',
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
const createMemberVerificationMutation = useCreateMemberVerificationMutation({
|
|
61
|
+
onError(error) {
|
|
62
|
+
toaster.error({
|
|
63
|
+
description: error.message,
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
onSuccess() {
|
|
67
|
+
kyc.setDone(true);
|
|
68
|
+
globalStore.kyc.setOpen(false);
|
|
69
|
+
toaster.success({
|
|
70
|
+
title: 'Success',
|
|
71
|
+
description: 'Personal information has been set successfully.',
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const form = useForm({
|
|
76
|
+
resolver: zodResolver(definition),
|
|
77
|
+
defaultValues: {
|
|
78
|
+
address: '',
|
|
79
|
+
nationality: '',
|
|
80
|
+
natureOfWork: '',
|
|
81
|
+
placeOfBirth: '',
|
|
82
|
+
permanentAddress: '',
|
|
83
|
+
},
|
|
84
|
+
mode: 'all',
|
|
85
|
+
});
|
|
86
|
+
async function onSubmit(values) {
|
|
87
|
+
if (!memberVerificationId) {
|
|
88
|
+
createMemberVerificationMutation.mutate({
|
|
89
|
+
...values,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
await updateMemberVerificationMutation.mutateAsync({
|
|
94
|
+
id: memberVerificationId,
|
|
95
|
+
data: {
|
|
96
|
+
...values,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
//approve status of member to be pending
|
|
100
|
+
await approveMemberVerificationMutation.mutateAsync({
|
|
101
|
+
id: memberVerificationId,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const address = form.watch('address');
|
|
106
|
+
const permanentAddress = form.watch('permanentAddress');
|
|
107
|
+
return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Personal Information" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Provide your basic details and work info." }), _jsxs("form", { className: "mt-7", onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.permanentAddress, children: [_jsx(Field.Label, { children: "Permanent address" }), _jsx(Field.Input, { placeholder: "Enter your permanent address", ...form.register('permanentAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.permanentAddress?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.address, children: [_jsx(Field.Label, { children: "Current address" }), _jsx(Field.Input, { placeholder: "Enter your current address", ...form.register('address') }), _jsx(Field.ErrorText, { children: form.formState.errors.address?.message })] }), _jsxs(Checkbox.Root, { className: "mt-md", checked: address !== '' &&
|
|
108
|
+
permanentAddress !== '' &&
|
|
109
|
+
address === permanentAddress, onCheckedChange: (details) => {
|
|
110
|
+
if (details.checked === true) {
|
|
111
|
+
form.setValue('address', form.getValues('permanentAddress'), {
|
|
112
|
+
shouldDirty: true,
|
|
113
|
+
shouldTouch: true,
|
|
114
|
+
shouldValidate: true,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}, disabled: !permanentAddress, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { children: "Use permanent address as current address" }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.sourceOfIncome, children: [_jsx(Field.Label, { children: "Source of income" }), _jsx(Field.Input, { placeholder: "Enter your source of income", ...form.register('sourceOfIncome') }), _jsx(Field.ErrorText, { children: form.formState.errors.sourceOfIncome?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.natureOfWork, children: [_jsx(Field.Label, { children: "Work Description" }), _jsx(Field.Input, { placeholder: "Enter your work description", ...form.register('natureOfWork') }), _jsx(Field.ErrorText, { children: form.formState.errors.natureOfWork?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.placeOfBirth, children: [_jsx(Field.Label, { children: "Place of birth" }), _jsx(Field.Input, { placeholder: "Enter your place of birth", ...form.register('placeOfBirth') }), _jsx(Field.ErrorText, { children: form.formState.errors.placeOfBirth?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.nationality, children: [_jsx(Field.Label, { children: "Nationality" }), _jsx(Field.Input, { placeholder: "Enter your nationality", ...form.register('nationality') }), _jsx(Field.ErrorText, { children: form.formState.errors.nationality?.message })] }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: updateMemberVerificationMutation.isPending ||
|
|
118
|
+
createMemberVerificationMutation.isPending, children: "Continue" }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", onClick: () => {
|
|
119
|
+
globalStore.kyc.setOpen(false);
|
|
120
|
+
}, disabled: updateMemberVerificationMutation.isPending ||
|
|
121
|
+
createMemberVerificationMutation.isPending, children: "Skip for now" })] })] }));
|
|
122
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type EventDetail = {
|
|
2
|
+
type: 'SELFIE_CAPTURED';
|
|
3
|
+
data: string;
|
|
4
|
+
} | {
|
|
5
|
+
type: 'ID_DOCUMENT_CAPTURED';
|
|
6
|
+
data: string;
|
|
7
|
+
};
|
|
8
|
+
type UnsubscribeFn = () => void;
|
|
9
|
+
type Subscriber = (detail: EventDetail) => UnsubscribeFn;
|
|
10
|
+
export type CaptureSubject = 'SELFIE' | 'ID_DOCUMENT';
|
|
11
|
+
export interface UseKYCReturn {
|
|
12
|
+
step: number;
|
|
13
|
+
setStep: (step: number) => void;
|
|
14
|
+
done: boolean;
|
|
15
|
+
setDone: (done: boolean) => void;
|
|
16
|
+
subscribe: (subscriber: Subscriber) => UnsubscribeFn;
|
|
17
|
+
triggerEvent: (detail: EventDetail) => void;
|
|
18
|
+
idFrontImageId: string | null;
|
|
19
|
+
setFrontImageId: (id: string | null) => void;
|
|
20
|
+
selfieImageId: string | null;
|
|
21
|
+
setSelfieImageId: (id: string | null) => void;
|
|
22
|
+
reset: () => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function useKYC(): UseKYCReturn;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
export function useKYC() {
|
|
3
|
+
const [step, setStep] = useState(2);
|
|
4
|
+
const [done, setDone] = useState(false);
|
|
5
|
+
const [idFrontImageId, setFrontImageId] = useState(null);
|
|
6
|
+
const [selfieImageId, setSelfieImageId] = useState(null);
|
|
7
|
+
const subscribers = useRef([]);
|
|
8
|
+
const subscribe = (subscriber) => {
|
|
9
|
+
subscribers.current.push(subscriber);
|
|
10
|
+
return () => {
|
|
11
|
+
subscribers.current = subscribers.current.filter((item) => item !== subscriber);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const triggerEvent = (detail) => {
|
|
15
|
+
subscribers.current.forEach((subscriber) => {
|
|
16
|
+
subscriber(detail);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const reset = () => {
|
|
20
|
+
setStep(1);
|
|
21
|
+
setDone(false);
|
|
22
|
+
setFrontImageId(null);
|
|
23
|
+
setSelfieImageId(null);
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
step,
|
|
27
|
+
setStep,
|
|
28
|
+
done,
|
|
29
|
+
setDone,
|
|
30
|
+
idFrontImageId,
|
|
31
|
+
setFrontImageId,
|
|
32
|
+
selfieImageId,
|
|
33
|
+
setSelfieImageId,
|
|
34
|
+
subscribe,
|
|
35
|
+
triggerEvent,
|
|
36
|
+
reset,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -4,7 +4,7 @@ import Link from 'next/link';
|
|
|
4
4
|
import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
|
|
5
5
|
import { Prose } from '../../ui/Prose/index.js';
|
|
6
6
|
import { stripTags } from '../../utils/stripTags.js';
|
|
7
|
-
export
|
|
7
|
+
export function News(props) {
|
|
8
8
|
return (_jsxs(_Fragment, { children: [_jsx("meta", { name: "description", content: stripTags(props.news.content) }), _jsx("meta", { name: "og:title", content: props.news.title }), _jsx("meta", { name: "og:description", content: stripTags(props.news.content) }), _jsx("meta", { name: "og:image", content: props.news.image }), _jsx("meta", { name: "twitter:title", content: props.news.title }), _jsx("meta", { name: "twitter:description", content: stripTags(props.news.content) }), _jsx("meta", { name: "twitter:image", content: props.news.image }), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }), _jsxs("div", { style: props.style, className: props.className, children: [_jsxs(Link, { href: props.viewAllUrl ?? '/news', className: "flex items-center gap-lg font-semibold text-button-secondary-fg text-lg", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all News"] }), _jsx(Image, { src: props.news.image, alt: "", width: 1024, height: 600, priority: true, unoptimized: true, className: "mt-3xl block h-auto w-full rounded-xl lg:mt-6" }), _jsx("p", { className: "mt-xl font-semibold text-brand-400 text-sm lg:mt-6", children: props.news.category }), _jsx("h2", { className: "mt-xl font-semibold text-2xl lg:mt-6", children: props.news.title }), _jsx(Prose, { className: "mt-xl lg:mt-6", dangerouslySetInnerHTML: {
|
|
9
9
|
__html: props.news.content,
|
|
10
10
|
} })] })] }));
|
|
@@ -3,4 +3,4 @@ export interface NewsProps {
|
|
|
3
3
|
news: TNews;
|
|
4
4
|
viewDetailsUrl: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function News({ news, viewDetailsUrl }: NewsProps):
|
|
6
|
+
export declare function News({ news, viewDetailsUrl }: NewsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import Image from 'next/image';
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { Button } from '../../ui/Button/index.js';
|
|
5
|
-
export
|
|
5
|
+
export function News({ news, viewDetailsUrl }) {
|
|
6
6
|
return (_jsxs("div", { className: "flex flex-col overflow-hidden rounded-2xl border border-border-primary bg-bg-primary-alt shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 400, height: 274, loading: "lazy", unoptimized: true, className: "block h-[15.25rem] w-full object-cover" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "font-semibold text-brand-400 text-sm", children: news.category }), _jsx("h2", { className: "mt-2 line-clamp-1 font-semibold text-lg", children: news.title }), _jsx("p", { className: "mt-xs line-clamp-3 text-text-tertiary-600", dangerouslySetInnerHTML: {
|
|
7
7
|
__html: news.content,
|
|
8
8
|
} })] }), _jsx(Button, { asChild: true, className: "mt-2xl", children: _jsxs(Link, { href: `${viewDetailsUrl}/${news.id}`, children: ["Read More", _jsxs("span", { className: "sr-only", children: [" about ", news.title] })] }) })] })] }, news.id));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function LinkGoogleAccountObserver(): null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useSearchParams } from 'next/navigation';
|
|
3
|
+
import { useTimeout } from 'usehooks-ts';
|
|
4
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
5
|
+
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
6
|
+
import { getSessionQueryKey } from '../../utils/queryKeys.js';
|
|
7
|
+
export function LinkGoogleAccountObserver() {
|
|
8
|
+
const searchParams = useSearchParams();
|
|
9
|
+
const code = searchParams.get('message') ?? searchParams.get('status');
|
|
10
|
+
const queryClient = getQueryClient();
|
|
11
|
+
useTimeout(() => {
|
|
12
|
+
if (code === 'duplicate') {
|
|
13
|
+
return toaster.error({
|
|
14
|
+
title: 'Duplicate Account',
|
|
15
|
+
description: 'An account with this email already exists. Please try signing in instead.',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (code === 'linked') {
|
|
19
|
+
queryClient.invalidateQueries({
|
|
20
|
+
queryKey: getSessionQueryKey(),
|
|
21
|
+
});
|
|
22
|
+
return toaster.success({
|
|
23
|
+
title: 'Google Account Linked Successfully',
|
|
24
|
+
description: 'Your Google account has been successfully connected.',
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}, code ? 100 : null);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SessionWatcher(): null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRouter } from 'next/navigation';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { useSessionHealthQuery } from '../../client/hooks/useSessionHealthQuery.js';
|
|
5
|
+
import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
|
|
6
|
+
export function SessionWatcher() {
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
const query = useSessionHealthQuery({ refetchInterval: 1000 * 5 });
|
|
9
|
+
const healthy = query.data ?? true;
|
|
10
|
+
const mutation = useSignOutMutation();
|
|
11
|
+
const signOut = useCallback(async () => {
|
|
12
|
+
await mutation.mutateAsync();
|
|
13
|
+
router.refresh();
|
|
14
|
+
}, [mutation, router]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!healthy)
|
|
17
|
+
signOut();
|
|
18
|
+
}, [healthy, signOut]);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SessionWatcher';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SessionWatcher.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Options = {
|
|
2
|
+
accountName?: string;
|
|
3
|
+
siteName?: string;
|
|
4
|
+
signInOptions?: 'MOBILE_NUMBER' | 'NAME_AND_PASSWORD';
|
|
5
|
+
};
|
|
6
|
+
export type ErrorCode = 'MEMBER_ACCOUNT_BLACKLISTED' | 'MEMBER_ACCOUNT_SUSPENDED' | 'INVALID_RECAPTCHA_RESPONSE' | 'MEMBER_NOT_FOUND' | 'RATE_LIMIT_REACH' | 'NOT_READY_TO_SEND_VERIFICATION_ERROR' | 'Forbidden';
|
|
7
|
+
export declare function getFriendlyErrorMessage(code: ErrorCode, options?: Options): string;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function getFriendlyErrorMessage(code, options) {
|
|
2
|
+
const accountName = options?.accountName ?? '';
|
|
3
|
+
const siteName = options?.siteName ?? '';
|
|
4
|
+
const signInOptions = options?.signInOptions ?? 'NAME_AND_PASSWORD';
|
|
5
|
+
switch (code) {
|
|
6
|
+
case 'MEMBER_ACCOUNT_BLACKLISTED':
|
|
7
|
+
return `Your account ${accountName} has been blacklisted due to a serious violation of our policies. For more information or to appeal, please contact the ${siteName} Chat Support team.`;
|
|
8
|
+
case 'MEMBER_ACCOUNT_SUSPENDED':
|
|
9
|
+
return `Your account ${accountName} has been temporarily suspended. Please reach out to the ${siteName} Chat Support team to learn more and get help with resolving the issue.`;
|
|
10
|
+
case 'INVALID_RECAPTCHA_RESPONSE':
|
|
11
|
+
return 'Invalid reCAPTCHA response';
|
|
12
|
+
case 'MEMBER_NOT_FOUND':
|
|
13
|
+
return 'Account not found. Please check your username and try again.';
|
|
14
|
+
case 'RATE_LIMIT_REACH':
|
|
15
|
+
return 'Rate limit exceeded';
|
|
16
|
+
case 'NOT_READY_TO_SEND_VERIFICATION_ERROR':
|
|
17
|
+
return 'Your account is not ready to send verification requests. Please try again later.';
|
|
18
|
+
case 'Forbidden':
|
|
19
|
+
if (signInOptions === 'MOBILE_NUMBER') {
|
|
20
|
+
return 'Invalid verification code. Please check the code and try again.';
|
|
21
|
+
}
|
|
22
|
+
return 'Invalid username or password, please try again.';
|
|
23
|
+
default:
|
|
24
|
+
return 'Something went wrong. Please try again later.';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -83,6 +83,7 @@ export function SignUpDefaultForm() {
|
|
|
83
83
|
}),
|
|
84
84
|
firstName: z
|
|
85
85
|
.string()
|
|
86
|
+
.regex(/^[a-z0-9 ]+$/gi, 'First name must contain only letters')
|
|
86
87
|
.transform((val) => val.trim())
|
|
87
88
|
.refine((val) => val.length >= 2, {
|
|
88
89
|
message: 'First name must be 2 or more characters',
|
|
@@ -92,6 +93,7 @@ export function SignUpDefaultForm() {
|
|
|
92
93
|
}),
|
|
93
94
|
lastName: z
|
|
94
95
|
.string()
|
|
96
|
+
.regex(/^[a-z0-9 ]+$/gi, 'Last name must contain only letters')
|
|
95
97
|
.transform((val) => val.trim())
|
|
96
98
|
.refine((val) => val.length >= 2, {
|
|
97
99
|
message: 'Last name must be 2 or more characters',
|
|
@@ -175,7 +177,7 @@ export function SignUpDefaultForm() {
|
|
|
175
177
|
}
|
|
176
178
|
}), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "-translate-y-1/2 absolute top-1/2 left-3.5 flex shrink-0 items-center gap-md", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
|
|
177
179
|
paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
178
|
-
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your
|
|
180
|
+
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.firstName, className: "mt-xl", children: [_jsx(Field.Label, { children: "First Name" }), _jsx(Field.Input, { placeholder: "Enter your first name", ...step1Form.register('firstName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.firstName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.lastName, className: "mt-xl", children: [_jsx(Field.Label, { children: "Last Name" }), _jsx(Field.Input, { placeholder: "Enter your last name", ...step1Form.register('lastName') }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.lastName?.message })] }), _jsxs(Field.Root, { invalid: !!step1Form.formState.errors.birthDay, className: "mt-xl", children: [_jsx(DateOfBirthField, { value: birthDay, onChange: (value) => {
|
|
179
181
|
if (!value)
|
|
180
182
|
return;
|
|
181
183
|
step1Form.setValue('birthDay', value, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { TZDateMini, tz } from '@date-fns/tz';
|
|
4
4
|
import { endOfDay, format, startOfDay } from 'date-fns';
|
|
5
5
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
|
6
6
|
import { useReducer } from 'react';
|
|
@@ -19,10 +19,12 @@ import { capitalize } from '../../utils/capitalize.js';
|
|
|
19
19
|
import { formatNumber } from '../../utils/formatNumber.js';
|
|
20
20
|
import { Empty } from '../shared/Empty.js';
|
|
21
21
|
import { TableFilters } from './TableFilters.js';
|
|
22
|
+
import { useTransactionPropsContext } from './TransactionContext.js';
|
|
22
23
|
export function DepositRecordsTable() {
|
|
23
24
|
const router = useRouter();
|
|
24
25
|
const pathname = usePathname();
|
|
25
26
|
const searchParams = useSearchParams();
|
|
27
|
+
const { enabledDepositTypes } = useTransactionPropsContext();
|
|
26
28
|
const [state, setState] = useReducer((prev, next) => ({
|
|
27
29
|
...prev,
|
|
28
30
|
...next,
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { createListCollection } from '@ark-ui/react/collection';
|
|
3
3
|
import { parseDate, useDatePickerContext } from '@ark-ui/react/date-picker';
|
|
4
4
|
import { endOfDay, startOfDay } from 'date-fns';
|
|
5
|
-
import { useState } from 'react';
|
|
5
|
+
import { useMemo, useState } from 'react';
|
|
6
6
|
import { useMediaQuery } from 'usehooks-ts';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { useControllableState } from '../../client/hooks/useControllableState.js';
|
|
@@ -16,8 +16,9 @@ import { Portal } from '../../ui/Portal/index.js';
|
|
|
16
16
|
import { SegmentGroup } from '../../ui/SegmentGroup/index.js';
|
|
17
17
|
import { Select } from '../../ui/Select/index.js';
|
|
18
18
|
import { capitalize } from '../../utils/capitalize.js';
|
|
19
|
+
import { useTransactionPropsContext } from './TransactionContext.js';
|
|
19
20
|
const TabDefinition = z.enum(['all', 'today', 'custom']).catch('all');
|
|
20
|
-
const
|
|
21
|
+
const DEFAULT_DEPOSIT_TYPES = [
|
|
21
22
|
'BANK',
|
|
22
23
|
'GCASH',
|
|
23
24
|
'MAYA',
|
|
@@ -30,8 +31,13 @@ const DEPOSIT_TYPES_MAP = {
|
|
|
30
31
|
GCASH: 'GCash',
|
|
31
32
|
MAYA: 'Maya',
|
|
32
33
|
MANUAL: 'Manual',
|
|
33
|
-
|
|
34
|
+
MAYA_APP: 'Maya App',
|
|
34
35
|
QR_PH: 'QR PH',
|
|
36
|
+
ONLINE_BANK: 'Online Bank',
|
|
37
|
+
MANUAL_BANK: 'Manual Bank',
|
|
38
|
+
MANUAL_UPI: 'Manual UPI',
|
|
39
|
+
PISO_PAY_CHECKOUT: 'Piso Pay Checkout',
|
|
40
|
+
LIBANGAN_PAY_IN: 'Libangan Pay In',
|
|
35
41
|
};
|
|
36
42
|
const DEPOSIT_STATUSES = [
|
|
37
43
|
'ACCEPTED',
|
|
@@ -55,6 +61,10 @@ const WITHDRAWAL_TYPES_MAP = {
|
|
|
55
61
|
INSTAPAY: 'Instapay',
|
|
56
62
|
MAYA_APP: 'Maya App',
|
|
57
63
|
MANUAL: 'Manual',
|
|
64
|
+
MANUAL_UPI: 'Manual UPI',
|
|
65
|
+
VENTAJA_DISBURSEMENT: 'Ventaja Disbursement',
|
|
66
|
+
PISO_PAY_REMITTANCE: 'Piso Pay Remittance',
|
|
67
|
+
MANUAL_BANK: 'Manual Bank',
|
|
58
68
|
};
|
|
59
69
|
const WITHDRAWAL_STATUSES = [
|
|
60
70
|
'ACCEPTED',
|
|
@@ -104,11 +114,6 @@ const TRANSACTION_TYPES_MAP = {
|
|
|
104
114
|
TOURNAMENT_PAYOUT: 'Tournament Payout',
|
|
105
115
|
};
|
|
106
116
|
const deviceTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
107
|
-
const depositTypeCollection = createListCollection({
|
|
108
|
-
items: DEPOSIT_TYPES,
|
|
109
|
-
itemToValue: (item) => item,
|
|
110
|
-
itemToString: (item) => DEPOSIT_TYPES_MAP[item],
|
|
111
|
-
});
|
|
112
117
|
const depositStatusCollection = createListCollection({
|
|
113
118
|
items: DEPOSIT_STATUSES,
|
|
114
119
|
itemToValue: (item) => item,
|
|
@@ -116,11 +121,6 @@ const depositStatusCollection = createListCollection({
|
|
|
116
121
|
delimiter: capitalize.delimiters.UNDERSCORE,
|
|
117
122
|
}),
|
|
118
123
|
});
|
|
119
|
-
const withdrawalTypeCollection = createListCollection({
|
|
120
|
-
items: WITHDRAWAL_TYPES,
|
|
121
|
-
itemToValue: (item) => item,
|
|
122
|
-
itemToString: (item) => WITHDRAWAL_TYPES_MAP[item],
|
|
123
|
-
});
|
|
124
124
|
const withdrawalStatusCollection = createListCollection({
|
|
125
125
|
items: WITHDRAWAL_STATUSES,
|
|
126
126
|
itemToValue: (item) => item,
|
|
@@ -135,6 +135,21 @@ const transactionTypeCollection = createListCollection({
|
|
|
135
135
|
});
|
|
136
136
|
export function TableFilters(props) {
|
|
137
137
|
const [tab, setTab] = useState('all');
|
|
138
|
+
const { enabledDepositTypes, enabledWithdrawalTypes } = useTransactionPropsContext();
|
|
139
|
+
const depositTypes = useMemo(() => enabledDepositTypes?.length ? enabledDepositTypes : DEFAULT_DEPOSIT_TYPES, [enabledDepositTypes]);
|
|
140
|
+
const withdrawalTypes = useMemo(() => enabledWithdrawalTypes?.length
|
|
141
|
+
? enabledWithdrawalTypes
|
|
142
|
+
: WITHDRAWAL_TYPES, [enabledWithdrawalTypes]);
|
|
143
|
+
const depositTypeCollection = useMemo(() => createListCollection({
|
|
144
|
+
items: depositTypes,
|
|
145
|
+
itemToValue: (item) => item,
|
|
146
|
+
itemToString: (item) => DEPOSIT_TYPES_MAP[item],
|
|
147
|
+
}), [depositTypes]);
|
|
148
|
+
const withdrawalTypeCollection = createListCollection({
|
|
149
|
+
items: withdrawalTypes,
|
|
150
|
+
itemToValue: (item) => item,
|
|
151
|
+
itemToString: (item) => WITHDRAWAL_TYPES_MAP[item],
|
|
152
|
+
});
|
|
138
153
|
const handleChange = (next) => {
|
|
139
154
|
const prev = {
|
|
140
155
|
timestamp,
|
|
@@ -219,10 +234,10 @@ export function TableFilters(props) {
|
|
|
219
234
|
}, children: [_jsx(SegmentGroup.ItemText, { children: "Custom" }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }), _jsx(SegmentGroup.Indicator, {})] }), _jsx(RangeDatePicker, { value: {
|
|
220
235
|
start: timestamp?.start,
|
|
221
236
|
end: timestamp?.end,
|
|
222
|
-
}, onValueChange: setTimestamp, open: disclosure.open, onOpenChange: disclosure.setOpen }), _jsx("div", { className: "hidden grow lg:block" }), props.enabledFilters?.depositType &&
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
237
|
+
}, onValueChange: setTimestamp, open: disclosure.open, onOpenChange: disclosure.setOpen }), _jsx("div", { className: "hidden grow lg:block" }), props.enabledFilters?.depositType &&
|
|
238
|
+
(!enabledDepositTypes || enabledDepositTypes.length > 1) && (_jsxs(Select.Root, { collection: depositTypeCollection, value: depositType ? [depositType] : [], onValueChange: (details) => {
|
|
239
|
+
const DepositTypeSchema = z.custom((val) => depositTypes.includes(val));
|
|
240
|
+
const value = DepositTypeSchema.safeParse(details.value.at(0)).data;
|
|
226
241
|
setdepositType(value ?? null);
|
|
227
242
|
}, lazyMount: true, deselectable: true, positioning: {
|
|
228
243
|
sameWidth: true,
|
|
@@ -237,10 +252,10 @@ export function TableFilters(props) {
|
|
|
237
252
|
sameWidth: true,
|
|
238
253
|
}, children: [_jsxs(Select.Trigger, { className: "w-full lg:w-[14rem]", children: [_jsx(Select.ValueText, { placeholder: "Status" }), _jsx(Select.Context, { children: (api) => (_jsx(_Fragment, { children: api.value.length ? (_jsx(Select.ClearTrigger, { asChild: true, children: _jsx("span", { onClick: (e) => {
|
|
239
254
|
e.stopPropagation();
|
|
240
|
-
}, children: "Clear" }) })) : (_jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })) })) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: depositStatusCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: depositStatusCollection.stringifyItem(item) }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item))) }) }) }) })] })), props.enabledFilters?.withdrawalType &&
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
255
|
+
}, children: "Clear" }) })) : (_jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })) })) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: depositStatusCollection.items.map((item) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: depositStatusCollection.stringifyItem(item) }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, item))) }) }) }) })] })), props.enabledFilters?.withdrawalType &&
|
|
256
|
+
(!enabledWithdrawalTypes || enabledWithdrawalTypes.length > 1) && (_jsxs(Select.Root, { collection: withdrawalTypeCollection, value: withdrawalType ? [withdrawalType] : [], onValueChange: (details) => {
|
|
257
|
+
const WithdrawalTypeSchema = z.custom((val) => withdrawalTypes.includes(val));
|
|
258
|
+
const value = WithdrawalTypeSchema.safeParse(details.value.at(0)).data;
|
|
244
259
|
setWithdrawalType(value ?? null);
|
|
245
260
|
}, lazyMount: true, deselectable: true, positioning: {
|
|
246
261
|
sameWidth: true,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TransactionRecordsProps } from './TransactionRecords.suspense';
|
|
2
|
+
export declare const TransactionPropsContext: (props: {
|
|
3
|
+
value: TransactionRecordsProps;
|
|
4
|
+
} & {
|
|
5
|
+
children?: import("react").ReactNode | undefined;
|
|
6
|
+
}) => React.ReactNode, useTransactionPropsContext: () => TransactionRecordsProps;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { DepositType, WithdrawalType } from '../../types';
|
|
1
2
|
export interface TransactionRecordsProps {
|
|
2
3
|
className?: string;
|
|
4
|
+
enabledDepositTypes?: DepositType[];
|
|
5
|
+
enabledWithdrawalTypes?: WithdrawalType[];
|
|
3
6
|
}
|
|
4
7
|
export declare function TransactionRecords__suspense(props: TransactionRecordsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ import { Suspense } from 'react';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { Tabs } from '../../ui/Tabs/index.js';
|
|
7
7
|
import { DepositRecordsTable } from './DepositRecordsTable.js';
|
|
8
|
+
import { TransactionPropsContext } from './TransactionContext.js';
|
|
8
9
|
import { TransactionRecordsTable } from './TransactionRecordsTable.js';
|
|
9
10
|
import { WithdrawalRecordsTable } from './WithdrawalRecordsTable.js';
|
|
10
11
|
const TabSchema = z
|
|
@@ -24,5 +25,5 @@ export function TransactionRecords__suspense(props) {
|
|
|
24
25
|
newSearchParams.delete('id');
|
|
25
26
|
router.push(`${pathname}?${newSearchParams.toString()}`);
|
|
26
27
|
};
|
|
27
|
-
return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "font-semibold text-sm leading-tight lg:text-lg", children: "Transactions" }), _jsx("p", { className: "mt-xs text-sm text-text-tertiary-600 leading-tight", children: "View your transaction records" }), _jsxs(Tabs.Root, { className: "mt-lg lg:mt-2xl", value: tab, onValueChange: (details) => setTab(TabSchema.parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Trigger, { value: "transactions", children: "All Transactions" }), _jsx(Tabs.Trigger, { value: "deposits", children: "Deposits" }), _jsx(Tabs.Trigger, { value: "withdrawals", children: "Withdrawals" }), _jsx(Tabs.Indicator, {})] }), _jsx("div", { className: "mt-2xl hidden border-[1.5px] border-border-secondary border-t lg:block" }), _jsx("h3", { className: "mt-3xl font-semibold text-sm text-text-secondary-700", children: "Table" }), _jsx(Tabs.Content, { value: "transactions", className: "mt-xl", children: _jsx(TransactionRecordsTable, {}) }), _jsx(Tabs.Content, { value: "deposits", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(DepositRecordsTable, {}) }) }), _jsx(Tabs.Content, { value: "withdrawals", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(WithdrawalRecordsTable, {}) }) })] })] }));
|
|
28
|
+
return (_jsx(TransactionPropsContext, { value: props, children: _jsxs("div", { className: props.className, children: [_jsx("h2", { className: "font-semibold text-sm leading-tight lg:text-lg", children: "Transactions" }), _jsx("p", { className: "mt-xs text-sm text-text-tertiary-600 leading-tight", children: "View your transaction records" }), _jsxs(Tabs.Root, { className: "mt-lg lg:mt-2xl", value: tab, onValueChange: (details) => setTab(TabSchema.parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Trigger, { value: "transactions", children: "All Transactions" }), _jsx(Tabs.Trigger, { value: "deposits", children: "Deposits" }), _jsx(Tabs.Trigger, { value: "withdrawals", children: "Withdrawals" }), _jsx(Tabs.Indicator, {})] }), _jsx("div", { className: "mt-2xl hidden border-[1.5px] border-border-secondary border-t lg:block" }), _jsx("h3", { className: "mt-3xl font-semibold text-sm text-text-secondary-700", children: "Table" }), _jsx(Tabs.Content, { value: "transactions", className: "mt-xl", children: _jsx(TransactionRecordsTable, {}) }), _jsx(Tabs.Content, { value: "deposits", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(DepositRecordsTable, {}) }) }), _jsx(Tabs.Content, { value: "withdrawals", className: "mt-xl", children: _jsx(Suspense, { fallback: null, children: _jsx(WithdrawalRecordsTable, {}) }) })] })] }) }));
|
|
28
29
|
}
|