@opexa/portal-components 0.0.84 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useAccountQuery.js +2 -6
- package/dist/client/hooks/useAvailablePromosQuery.js +2 -6
- package/dist/client/hooks/useAvailableQuestsQuery.js +2 -6
- package/dist/client/hooks/useBetRecordsQuery.js +2 -6
- package/dist/client/hooks/useBonusQuery.js +2 -6
- package/dist/client/hooks/useBonusesQuery.js +2 -6
- package/dist/client/hooks/useCashbackBonusQuery.js +2 -6
- package/dist/client/hooks/useCashbackBonusesQuery.js +2 -6
- package/dist/client/hooks/useCashbacksQuery.js +1 -3
- package/dist/client/hooks/useCheckInDailyCheckInQuestMutation.js +2 -6
- package/dist/client/hooks/useClaimCashbackBonusMutation.js +2 -5
- package/dist/client/hooks/useClaimSpotBonusMutation.js +2 -5
- package/dist/client/hooks/useCreateGCashDepositMutation.js +5 -10
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +4 -7
- package/dist/client/hooks/useCreateGameSessionMutation.js +6 -15
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +4 -7
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +5 -10
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +4 -7
- package/dist/client/hooks/useCreateMayaDepositMutation.js +5 -10
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +4 -7
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +5 -10
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +5 -10
- package/dist/client/hooks/useDepositQuery.js +2 -6
- package/dist/client/hooks/useDepositRecordsQuery.js +2 -6
- package/dist/client/hooks/useDepositsCountQuery.js +2 -6
- package/dist/client/hooks/useEndGameSessionMutation.js +2 -6
- package/dist/client/hooks/useFavoriteGamesQuery.js +2 -6
- package/dist/client/hooks/useInstapayBankListQuery.js +2 -6
- package/dist/client/hooks/useIsMayaSessionValidQuery.js +2 -6
- package/dist/client/hooks/useMarkGameAsFavoriteMutation.js +2 -5
- package/dist/client/hooks/useMarkMessageAsReadMutation.js +2 -5
- package/dist/client/hooks/useMemberVerificationQuery.js +2 -6
- package/dist/client/hooks/useMessagesQuery.js +2 -6
- package/dist/client/hooks/usePaymentSettingsQuery.js +2 -6
- package/dist/client/hooks/useProfileCompletionQuery.js +2 -6
- package/dist/client/hooks/useTransactionRecordsQuery.js +2 -6
- package/dist/client/hooks/useUnmarkGameAsFavoriteMutation.js +2 -5
- package/dist/client/hooks/useUnreadMessagesCountQuery.js +2 -6
- package/dist/client/hooks/useUpdateAccountMutation.js +2 -5
- package/dist/client/hooks/useWalletQuery.js +8 -7
- package/dist/client/hooks/useWithdrawalRecordsQuery.js +2 -6
- package/dist/components/Account/Account.d.ts +0 -2
- package/dist/components/Account/Account.js +10 -8
- package/dist/components/Account/AccountTrigger.d.ts +1 -2
- package/dist/components/Account/AccountTrigger.js +18 -6
- package/dist/components/Bonuses/BonusesTrigger.d.ts +1 -1
- package/dist/components/Bonuses/BonusesTrigger.js +3 -3
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawal.d.ts +1 -6
- package/dist/components/DepositWithdrawal/DepositWithdrawal.js +8 -19
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawalTrigger.js +12 -4
- package/dist/components/Messages/Message.d.ts +1 -4
- package/dist/components/Messages/Message.js +8 -9
- package/dist/components/Messages/MessageContext.d.ts +2 -0
- package/dist/components/Messages/MessageContext.js +2 -0
- package/dist/components/Messages/Messages.d.ts +0 -1
- package/dist/components/Messages/Messages.js +9 -8
- package/dist/components/Messages/MessagesTrigger.d.ts +1 -1
- package/dist/components/Messages/MessagesTrigger.js +8 -4
- package/dist/components/PortalProvider/Providers.js +1 -5
- package/dist/components/SignUp/SignUpForm.js +2 -1
- package/dist/handlers.js +1 -0
- package/dist/services/ObjectId.d.ts +0 -14
- package/dist/services/ObjectId.js +62 -76
- package/dist/services/ObjectType.d.ts +10 -0
- package/dist/services/ObjectType.js +10 -0
- package/dist/services/index.d.ts +4 -3
- package/dist/services/index.js +4 -3
- package/dist/styles/theme.css +2 -2
- package/dist/ui/AlertDialog/AlertDialog.d.ts +122 -122
- package/dist/ui/AlertDialog/AlertDialog.js +2 -1
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
- package/dist/ui/AlertDialog/alertDialog.recipe.js +1 -1
- package/dist/ui/Avatar/Avatar.d.ts +1 -1
- package/dist/ui/Avatar/Avatar.js +1 -1
- package/dist/ui/Avatar/avatar.recipe.js +1 -1
- package/dist/ui/Badge/Badge.js +1 -1
- package/dist/ui/Button/Button.js +1 -1
- package/dist/ui/Checkbox/Checkbox.d.ts +24 -24
- package/dist/ui/Checkbox/Checkbox.js +1 -1
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/checkbox.recipe.js +1 -1
- package/dist/ui/Clipboard/Clipboard.d.ts +19 -19
- package/dist/ui/Clipboard/Clipboard.js +1 -1
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/clipboard.recipe.js +1 -1
- package/dist/ui/Collapsible/Collapsible.d.ts +1 -1
- package/dist/ui/Collapsible/Collapsible.js +1 -1
- package/dist/ui/Collapsible/collapsible.recipe.js +1 -1
- package/dist/ui/Combobox/Combobox.d.ts +43 -43
- package/dist/ui/Combobox/Combobox.js +1 -1
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/Combobox/combobox.recipe.js +1 -1
- package/dist/ui/DatePicker/DatePicker.d.ts +337 -337
- package/dist/ui/DatePicker/DatePicker.js +1 -1
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +14 -14
- package/dist/ui/DatePicker/datePicker.recipe.js +1 -1
- package/dist/ui/Dialog/Dialog.d.ts +122 -122
- package/dist/ui/Dialog/Dialog.js +2 -1
- package/dist/ui/Dialog/dialog.recipe.d.ts +11 -11
- package/dist/ui/Dialog/dialog.recipe.js +1 -1
- package/dist/ui/Drawer/Drawer.d.ts +34 -34
- package/dist/ui/Drawer/Drawer.js +2 -1
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Drawer/drawer.recipe.js +1 -1
- package/dist/ui/Field/Field.d.ts +22 -22
- package/dist/ui/Field/Field.js +1 -1
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Field/field.recipe.js +1 -1
- package/dist/ui/IconButton/IconButton.js +1 -1
- package/dist/ui/NumberInput/NumberInput.d.ts +1 -1
- package/dist/ui/NumberInput/NumberInput.js +1 -1
- package/dist/ui/NumberInput/numberInput.recipe.js +1 -1
- package/dist/ui/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/ui/PasswordInput/PasswordInput.js +1 -1
- package/dist/ui/PasswordInput/passwordInput.recipe.js +1 -1
- package/dist/ui/PinInput/PinInput.d.ts +1 -1
- package/dist/ui/PinInput/PinInput.js +1 -1
- package/dist/ui/PinInput/pinInput.recipe.js +1 -1
- package/dist/ui/Popover/Popover.d.ts +89 -89
- package/dist/ui/Popover/Popover.js +1 -1
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/Popover/popover.recipe.js +1 -1
- package/dist/ui/Progress/Progress.d.ts +1 -1
- package/dist/ui/Progress/Progress.js +1 -1
- package/dist/ui/Progress/progress.recipe.js +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +1 -1
- package/dist/ui/SegmentGroup/SegmentGroup.js +1 -1
- package/dist/ui/SegmentGroup/segmentGroup.recipe.js +1 -1
- package/dist/ui/Select/Select.d.ts +46 -46
- package/dist/ui/Select/Select.js +1 -1
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Select/select.recipe.js +1 -1
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/Table.js +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +16 -16
- package/dist/ui/Tabs/Tabs.js +1 -1
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tabs/tabs.recipe.js +1 -1
- package/package.json +27 -30
- package/dist/utils/graphqlRequest.d.ts +0 -4
- package/dist/utils/graphqlRequest.js +0 -255
- package/dist/utils/httpRequest.d.ts +0 -6
- package/dist/utils/httpRequest.js +0 -87
- package/dist/utils/sha256.d.ts +0 -4
- package/dist/utils/sha256.js +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: import("react").Context<{
|
|
2
|
-
view: "
|
|
2
|
+
view: "qrCode" | "form";
|
|
3
3
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
4
4
|
verify: () => void;
|
|
5
5
|
reset: () => void;
|
|
@@ -9,7 +9,7 @@ export declare const QRPHDepositContext: import("react").Context<{
|
|
|
9
9
|
promo?: string | null;
|
|
10
10
|
}) => void;
|
|
11
11
|
}>, useQRPHDepositContext: () => {
|
|
12
|
-
view: "
|
|
12
|
+
view: "qrCode" | "form";
|
|
13
13
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
14
14
|
verify: () => void;
|
|
15
15
|
reset: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "qrCode" | "form";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface DepositWithdrawalProps {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
export declare function DepositWithdrawal(props: DepositWithdrawalProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
export declare function DepositWithdrawal(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Portal } from '@ark-ui/react';
|
|
4
|
-
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
import { useShallow } from 'zustand/shallow';
|
|
7
6
|
import { useGlobalStore, useLocaleInfo, useWalletQuery, } from '../../client/hooks/index.js';
|
|
@@ -10,7 +9,7 @@ import { Dialog, IconButton, Tabs } from '../../ui/index.js';
|
|
|
10
9
|
import { formatNumber } from '../../utils/index.js';
|
|
11
10
|
import { Deposit } from './Deposit/Deposit.js';
|
|
12
11
|
import { Withdrawal } from './Withdrawal/Withdrawal.js';
|
|
13
|
-
export function DepositWithdrawal(
|
|
12
|
+
export function DepositWithdrawal() {
|
|
14
13
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
15
14
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
16
15
|
})));
|
|
@@ -18,22 +17,12 @@ export function DepositWithdrawal(props) {
|
|
|
18
17
|
const walletQuery = useWalletQuery({
|
|
19
18
|
refetchInterval: 5000,
|
|
20
19
|
});
|
|
21
|
-
return (
|
|
20
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
|
|
22
21
|
globalStore.depositWithdrawal.setOpen(details.open);
|
|
23
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, children:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function DefaulTrigger(props) {
|
|
31
|
-
const localeInfo = useLocaleInfo();
|
|
32
|
-
const walletQuery = useWalletQuery({
|
|
33
|
-
refetchInterval: 5000,
|
|
34
|
-
});
|
|
35
|
-
return (_jsxs("button", { type: "button", ...props, className: twMerge('flex', props.className), children: [_jsx("div", { className: "border-border-primary flex h-10 items-center rounded-l-md border border-r-0 px-3.5", children: formatNumber(walletQuery.data?.balance, {
|
|
36
|
-
currency: localeInfo.currency.code,
|
|
37
|
-
minDecimalPlaces: 2,
|
|
38
|
-
}) }), _jsx("div", { className: "bg-button-primary-bg text-button-primary-fg flex h-10 items-center gap-1.5 rounded-r-md px-3.5 text-sm font-semibold", children: "Deposit" })] }));
|
|
22
|
+
}, 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)]", children: _jsxs(Dialog.Content, { className: "lg:min-h-auto mx-auto min-h-full w-full px-4 py-3xl lg:w-[480px] lg:rounded-xl", children: [_jsxs(Dialog.Header, { className: "flex items-center gap-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs text-gray-700 text-text-secondary-700 flex size-10 items-center justify-center rounded-md border", children: _jsx(Wallet02Icon, { className: "size-5" }) }), _jsx(Dialog.Title, { className: "grow text-lg font-semibold", children: "Wallet" }), _jsx(Dialog.Context, { children: (api) => (_jsx(IconButton, { size: "sm", variant: "outline", colorScheme: "gray", onClick: () => api.setOpen(false), children: _jsx(XIcon, {}) })) })] }), _jsxs(Dialog.Body, { className: "mt-3xl", children: [_jsx("p", { className: "text-text-secondary-700 text-center text-sm", children: "Deposit Balance" }), _jsx("p", { className: "text-center text-3xl font-bold leading-tight tracking-tight", children: formatNumber(walletQuery.data?.balance, {
|
|
23
|
+
currency: localeInfo.currency.code,
|
|
24
|
+
minDecimalPlaces: 2,
|
|
25
|
+
}) }), _jsxs(Tabs.Root, { value: globalStore.depositWithdrawal.tab, onValueChange: (details) => {
|
|
26
|
+
globalStore.depositWithdrawal.setTab(z.enum(['DEPOSIT', 'WITHDRAWAL']).parse(details.value));
|
|
27
|
+
}, lazyMount: true, unmountOnExit: true, className: "mt-3xl space-y-4xl", children: [_jsxs(Tabs.List, { className: "w-full", children: [_jsx(Tabs.Trigger, { value: "DEPOSIT", className: "grow", children: "Deposit" }), _jsx(Tabs.Trigger, { value: "WITHDRAWAL", className: "grow", children: "Withdrawal" }), _jsx(Tabs.Indicator, {})] }), _jsx(Tabs.Content, { value: "DEPOSIT", className: "space-y-3xl", children: _jsx(Deposit, {}) }), _jsx(Tabs.Content, { value: "WITHDRAWAL", className: "space-y-3xl", children: _jsx(Withdrawal, {}) })] })] })] }) })] }) }));
|
|
39
28
|
}
|
|
@@ -2,4 +2,4 @@ import type { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
export interface DepositWithdrawalTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function DepositWithdrawalTrigger(props: DepositWithdrawalTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function DepositWithdrawalTrigger({ asChild, children, ...props }: DepositWithdrawalTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
4
|
import { useShallow } from 'zustand/shallow';
|
|
5
|
-
import { useGlobalStore, useSessionQuery } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
5
|
+
import { useGlobalStore, useLocaleInfo, useSessionQuery, useWalletQuery, } from '../../client/hooks/index.js';
|
|
6
|
+
import { formatNumber } from '../../utils/index.js';
|
|
7
|
+
export function DepositWithdrawalTrigger({ asChild, children, ...props }) {
|
|
7
8
|
const sessionQuery = useSessionQuery();
|
|
8
9
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
9
10
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
10
11
|
})));
|
|
12
|
+
const localeInfo = useLocaleInfo();
|
|
13
|
+
const walletQuery = useWalletQuery({
|
|
14
|
+
refetchInterval: 5000,
|
|
15
|
+
});
|
|
11
16
|
const disabled = sessionQuery.data?.status === 'unauthenticated'
|
|
12
17
|
? true
|
|
13
18
|
: globalStore.depositWithdrawal.open
|
|
@@ -17,5 +22,8 @@ export function DepositWithdrawalTrigger(props) {
|
|
|
17
22
|
props.onClick?.(e);
|
|
18
23
|
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
19
24
|
globalStore.depositWithdrawal.setOpen(true);
|
|
20
|
-
}
|
|
25
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsxs("button", { type: "button", ...props, className: "flex", children: [_jsx("div", { className: "border-border-primary flex h-10 items-center rounded-l-md border border-r-0 px-3.5", children: formatNumber(walletQuery.data?.balance, {
|
|
26
|
+
currency: localeInfo.currency.code,
|
|
27
|
+
minDecimalPlaces: 2,
|
|
28
|
+
}) }), _jsx("div", { className: "bg-button-primary-bg text-button-primary-fg flex h-10 items-center gap-1.5 rounded-r-md px-3.5 text-sm font-semibold", children: "Deposit" })] })) }));
|
|
21
29
|
}
|
|
@@ -4,31 +4,30 @@ import { format } from 'date-fns';
|
|
|
4
4
|
import Link from 'next/link';
|
|
5
5
|
import { useShallow } from 'zustand/shallow';
|
|
6
6
|
import { useGlobalStore, useLocaleInfo, useMarkMessageAsReadMutation, } from '../../client/hooks/index.js';
|
|
7
|
+
import { useMessageContext } from './MessageContext.js';
|
|
7
8
|
import { getMessageIcon } from './utils.js';
|
|
8
|
-
export function Message(
|
|
9
|
-
const
|
|
10
|
-
/**/
|
|
11
|
-
id, icon, title, content, actions, markedAsRead, dateTimeCreated, } = message;
|
|
9
|
+
export function Message() {
|
|
10
|
+
const message = useMessageContext();
|
|
12
11
|
const localeInfo = useLocaleInfo();
|
|
13
12
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
14
13
|
message: ctx.message,
|
|
15
14
|
messages: ctx.messages,
|
|
16
15
|
})));
|
|
17
16
|
const markMessageAsReadMutation = useMarkMessageAsReadMutation();
|
|
18
|
-
const Icon = getMessageIcon(icon);
|
|
17
|
+
const Icon = getMessageIcon(message.icon);
|
|
19
18
|
const handleViewMessage = async () => {
|
|
20
19
|
globalStore.message.setData(message);
|
|
21
20
|
globalStore.message.setOpen(true);
|
|
22
21
|
globalStore.messages.setOpen(false);
|
|
23
|
-
if (!markedAsRead)
|
|
24
|
-
markMessageAsReadMutation.mutate(id);
|
|
22
|
+
if (!message.markedAsRead)
|
|
23
|
+
markMessageAsReadMutation.mutate(message.id);
|
|
25
24
|
};
|
|
26
25
|
const handleActionClick = (e) => {
|
|
27
26
|
e.stopPropagation();
|
|
28
27
|
globalStore.messages.setOpen(false);
|
|
29
28
|
globalStore.messages.setTab('ALL');
|
|
30
29
|
};
|
|
31
|
-
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', {
|
|
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(message.dateTimeCreated), 'M/d/yyyy - h:mma', {
|
|
32
31
|
in: tz(localeInfo.timezone),
|
|
33
|
-
}) }), !markedAsRead && (_jsx("div", { className: "bg-utility-success-500 h-2.5 w-2.5 rounded-full" }))] }), _jsxs("div", { className: "mb-2 flex items-center space-x-2", children: [_jsx(Icon, { className: "text-brand-400" }), _jsx("p", { className: "text-text-primary-brand text-sm font-semibold", children: title })] }), _jsx("p", { className: "line-clamp-3 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: content } }), actions.length > 0 && (_jsx("div", { className: "mt-2 flex flex-wrap items-center justify-end gap-2", children: actions.map((action, index) => (_jsx(Link, { className: "border-button-secondary-border text-button-secondary-fg rounded-md border px-3 py-2 text-sm", href: action.url, onClick: handleActionClick, children: action.name }, index))) }))] }));
|
|
32
|
+
}) }), !message.markedAsRead && (_jsx("div", { className: "bg-utility-success-500 h-2.5 w-2.5 rounded-full" }))] }), _jsxs("div", { className: "mb-2 flex items-center space-x-2", children: [_jsx(Icon, { className: "text-brand-400" }), _jsx("p", { className: "text-text-primary-brand text-sm font-semibold", children: message.title })] }), _jsx("p", { className: "line-clamp-3 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: message.content } }), message.actions.length > 0 && (_jsx("div", { className: "mt-2 flex flex-wrap items-center justify-end gap-2", children: message.actions.map((action, index) => (_jsx(Link, { className: "border-button-secondary-border text-button-secondary-fg rounded-md border px-3 py-2 text-sm", href: action.url, onClick: handleActionClick, children: action.name }, index))) }))] }));
|
|
34
33
|
}
|
|
@@ -5,10 +5,11 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { useShallow } from 'zustand/shallow';
|
|
7
7
|
import { useGlobalStore, useMessagesQuery, useUnreadMessagesCountQuery, } from '../../client/hooks/index.js';
|
|
8
|
-
import {
|
|
9
|
-
import { Drawer,
|
|
8
|
+
import { SpinnerIcon, XIcon } from '../../icons/index.js';
|
|
9
|
+
import { Drawer, Tabs } from '../../ui/index.js';
|
|
10
10
|
import { InfiniteScroll } from '../InfiniteScroll.js';
|
|
11
11
|
import { Message } from './Message.js';
|
|
12
|
+
import { MessageContext } from './MessageContext.js';
|
|
12
13
|
import { MessagePopup } from './MessagePopup.js';
|
|
13
14
|
const TABS = ['ALL', 'UNREAD'];
|
|
14
15
|
export function Messages(props) {
|
|
@@ -29,10 +30,10 @@ export function Messages(props) {
|
|
|
29
30
|
const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
|
|
30
31
|
? props.offsetTop
|
|
31
32
|
: [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
|
|
32
|
-
return (_jsxs(_Fragment, { children: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx(Drawer.Root, { open: globalStore.messages.open, onOpenChange: ({ open }) => globalStore.messages.setOpen(open), lazyMount: true, unmountOnExit: true, children: _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsx(Drawer.Content, { className: twMerge('flex', 'flex-col', 'border-border-secondary', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'lg:border-l', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]'), style: {
|
|
34
|
+
['--offset-top-mobile']: mobileOffsetTop,
|
|
35
|
+
['--offset-top-desktop']: desktopOffsetTop,
|
|
36
|
+
}, children: _jsxs("div", { className: "flex flex-col space-y-6", children: [_jsxs("div", { className: "flex items-end justify-between px-4 pt-6", children: [_jsx("p", { className: "text-text-primary-brand text-xl font-semibold", children: "Notifications" }), _jsx(Drawer.CloseTrigger, { className: "p-2", children: _jsx(XIcon, {}) })] }), _jsxs(Tabs.Root, { value: globalStore.messages.tab, onValueChange: (details) => globalStore.messages.setTab(z.enum(TABS).parse(details.value)), lazyMount: true, unmountOnExit: true, children: [_jsx("div", { className: "mb-4 w-full px-4", children: _jsxs(Tabs.List, { className: "border-border-secondary w-full border", children: [_jsx(Tabs.Trigger, { value: "ALL", className: "flex-1/5 ui-selected:text-text-primary-brand text-text-tertiary-600", children: "All" }), _jsxs(Tabs.Trigger, { value: "UNREAD", className: "flex-1/5 ui-selected:text-text-primary-brand text-text-tertiary-600 flex items-center justify-center space-x-2", children: [_jsx("div", { children: "Unread" }), !!unreadMessagesCount && (_jsx("div", { className: "border-border-primary bg-bg-secondary rounded-full border px-2 py-0.5", children: unreadMessagesCount }))] }), _jsx(Tabs.Indicator, { className: "bg-bg-active" })] }) }), _jsx("div", { className: "border-border-secondary w-full border-t" }), TABS.map((tab) => (_jsxs(Tabs.Content, { value: tab, className: "scrollbar:w-2 scrollbar-track:bg-bg-primary-alt scrollbar-track:rounded-full scrollbar-thumb:bg-bg-quaternary scrollbar-thumb:rounded-full max-h-[calc(100vh-197px)] overflow-y-auto p-xl", style: { scrollbarGutter: 'stable' }, children: [messages.length > 0 && (_jsx("div", { className: "flex flex-col space-y-4", children: messages.map((message) => (_jsx(MessageContext, { value: message, children: _jsx(Message, {}) }, message.id))) })), _jsx(InfiniteScroll, { loader: _jsx(SpinnerIcon, { className: "mx-auto size-5" }), hasMore: !!messagesQuery.hasNextPage, loadMore: async () => {
|
|
37
|
+
await messagesQuery.fetchNextPage();
|
|
38
|
+
}, className: "mt-4" })] }, tab)))] })] }) }) }) }) }), _jsx(MessagePopup, {})] }));
|
|
38
39
|
}
|
|
@@ -2,5 +2,5 @@ import type { ComponentPropsWithRef } from 'react';
|
|
|
2
2
|
interface MessagesTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function MessagesTrigger(props: MessagesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function MessagesTrigger({ asChild, children, ...props }: MessagesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
4
|
import { useShallow } from 'zustand/shallow';
|
|
5
|
-
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
5
|
+
import { useGlobalStore, useUnreadMessagesCountQuery, } from '../../client/hooks/index.js';
|
|
6
|
+
import { Bell01Icon } from '../../icons/index.js';
|
|
7
|
+
import { IconButton } from '../../ui/index.js';
|
|
8
|
+
export function MessagesTrigger({ asChild, children, ...props }) {
|
|
7
9
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
10
|
messages: ctx.messages,
|
|
9
11
|
})));
|
|
12
|
+
const unreadMessagesCountQuery = useUnreadMessagesCountQuery({}, { refetchInterval: 5000 });
|
|
13
|
+
const unreadMessagesCount = unreadMessagesCountQuery.data ?? 0;
|
|
10
14
|
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle messages panel", "data-state": globalStore.messages.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
15
|
globalStore.messages.setOpen(!globalStore.messages.open);
|
|
12
16
|
return props.onClick?.(e);
|
|
13
|
-
} }));
|
|
17
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsxs(IconButton, { size: "sm", colorScheme: "gray", className: "relative", children: [!!unreadMessagesCount && (_jsx("div", { className: "bg-brand-500 leading-4.5 text-button-primary-fg absolute -right-1.5 -top-1.5 rounded-full border px-1.5 text-2xs font-semibold", children: unreadMessagesCount })), _jsx(Bell01Icon, {})] })) }));
|
|
14
18
|
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
-
import dynamic from 'next/dynamic';
|
|
5
4
|
import { getQueryClient } from '../../utils/index.js';
|
|
6
|
-
const ThemeProvider = dynamic(() => import('next-themes').then((mod) => mod.ThemeProvider), {
|
|
7
|
-
ssr: false,
|
|
8
|
-
});
|
|
9
5
|
export function Providers({ children }) {
|
|
10
6
|
const queryClient = getQueryClient();
|
|
11
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children:
|
|
7
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: children }));
|
|
12
8
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useDialogContext } from '@ark-ui/react';
|
|
4
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
|
+
import { ObjectId } from '@opexa/object-id';
|
|
5
6
|
import { useSearchParams } from 'next/navigation';
|
|
6
7
|
import { useState } from 'react';
|
|
7
8
|
import { Controller, useForm } from 'react-hook-form';
|
|
@@ -10,7 +11,7 @@ import { useShallow } from 'zustand/shallow';
|
|
|
10
11
|
import { useCooldown, useGlobalStore, useLocaleInfo, useMobileNumberParser, useSendVerificationCodeMutation, useSignInMutation, useSignUpMutation, } from '../../client/hooks/index.js';
|
|
11
12
|
import { toaster } from '../../client/utils/index.js';
|
|
12
13
|
import { ArrowLeftIcon, CheckIcon } from '../../icons/index.js';
|
|
13
|
-
import {
|
|
14
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
14
15
|
import { Button, Checkbox, Field, PinInput } from '../../ui/index.js';
|
|
15
16
|
export function SignUpForm() {
|
|
16
17
|
const [step, setStep] = useState(1);
|
package/dist/handlers.js
CHANGED
|
@@ -159,6 +159,7 @@ export const POST = async (request, { params }) => {
|
|
|
159
159
|
const body = await request.json();
|
|
160
160
|
const parsed = CreateSessionDefinition.safeParse(body);
|
|
161
161
|
const recaptcha = request.headers.get(RECAPTCHA_HEADER_KEY);
|
|
162
|
+
console.log(body);
|
|
162
163
|
if (!parsed.success) {
|
|
163
164
|
return NextResponse.json({
|
|
164
165
|
ok: false,
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
export declare class ObjectId {
|
|
2
|
-
private _buffer;
|
|
3
|
-
constructor(buffer: Buffer);
|
|
4
|
-
static translate(id: ObjectId, type: number): ObjectId;
|
|
5
|
-
static generate(type?: number): ObjectId;
|
|
6
|
-
static generateFromKey(type: number, key: string): Promise<ObjectId>;
|
|
7
|
-
static from(value: string | Buffer): ObjectId;
|
|
8
|
-
get type(): number;
|
|
9
|
-
get buffer(): Buffer<ArrayBufferLike>;
|
|
10
|
-
compare(other: ObjectId): 0 | 1 | -1;
|
|
11
|
-
equals(other: ObjectId): boolean;
|
|
12
|
-
clone(): ObjectId;
|
|
13
|
-
toString(encoding?: 'bs58' | 'hex' | 'base64'): string;
|
|
14
|
-
}
|
|
15
1
|
export declare const ObjectType: {
|
|
16
2
|
MemberAccount: number;
|
|
17
3
|
MemberVerification: number;
|
|
@@ -1,79 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return this._buffer.equals(other._buffer);
|
|
64
|
-
}
|
|
65
|
-
clone() {
|
|
66
|
-
const buffer = Buffer.alloc(13);
|
|
67
|
-
this.buffer.copy(buffer);
|
|
68
|
-
return ObjectId.from(buffer);
|
|
69
|
-
}
|
|
70
|
-
toString(encoding) {
|
|
71
|
-
if (!encoding || encoding === 'bs58') {
|
|
72
|
-
return bs58.encode(this._buffer);
|
|
73
|
-
}
|
|
74
|
-
return this._buffer.toString(encoding);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
1
|
+
/* ref: https://github.com/HighOutputVentures/opexa/blob/main/packages/object-id/src/libs/object-id.ts */
|
|
2
|
+
// import bs58 from 'bs58';
|
|
3
|
+
// import { sha256 } from 'crypto-hash';
|
|
4
|
+
// import randomBytes from 'randombytes';
|
|
5
|
+
// const MACHINE_ID = randomBytes(5);
|
|
6
|
+
// let counter = randomBytes(4).readUInt32BE(0) & 0xffffff;
|
|
7
|
+
// export class ObjectId {
|
|
8
|
+
// constructor(private readonly _buffer: Buffer) {}
|
|
9
|
+
// /**
|
|
10
|
+
// * @param type The type of the object, e.g. `ObjectType.MemberAccount`
|
|
11
|
+
// * @example
|
|
12
|
+
// * ```ts
|
|
13
|
+
// * import { ObjectId, ObjectType } from '@opexa/portal-components';
|
|
14
|
+
// *
|
|
15
|
+
// * const id = ObjectId.generate(ObjectType.MemberAccount).toString();
|
|
16
|
+
// * ```
|
|
17
|
+
// */
|
|
18
|
+
// static generate(type: number) {
|
|
19
|
+
// const buffer = Buffer.alloc(13);
|
|
20
|
+
// const time = Math.floor(Date.now() / 1000) & 0xffffffff;
|
|
21
|
+
// counter = (counter + 1) & 0xffffff;
|
|
22
|
+
// buffer[0] = type & 0xff;
|
|
23
|
+
// buffer[1] = (time >> 24) & 0xff;
|
|
24
|
+
// buffer[2] = (time >> 16) & 0xff;
|
|
25
|
+
// buffer[3] = (time >> 8) & 0xff;
|
|
26
|
+
// buffer[4] = time & 0xff;
|
|
27
|
+
// buffer[5] = MACHINE_ID[0];
|
|
28
|
+
// buffer[6] = MACHINE_ID[1];
|
|
29
|
+
// buffer[7] = MACHINE_ID[2];
|
|
30
|
+
// buffer[8] = MACHINE_ID[3];
|
|
31
|
+
// buffer[9] = MACHINE_ID[4];
|
|
32
|
+
// buffer[10] = (counter >> 16) & 0xff;
|
|
33
|
+
// buffer[11] = (counter >> 8) & 0xff;
|
|
34
|
+
// buffer[12] = counter & 0xff;
|
|
35
|
+
// return new ObjectId(buffer);
|
|
36
|
+
// }
|
|
37
|
+
// /**
|
|
38
|
+
// *
|
|
39
|
+
// * @param type The type of the object, e.g. `ObjectType.Game`
|
|
40
|
+
// * @param key The key to generate the object ID from, e.g. `Game.id`
|
|
41
|
+
// * @example
|
|
42
|
+
// * ```ts
|
|
43
|
+
// * import { ObjectId, ObjectType } from '@opexa/portal-components';
|
|
44
|
+
// *
|
|
45
|
+
// * const id = (await ObjectId.generateFromKey(ObjectType.Game, gameId)).toString();
|
|
46
|
+
// * ```
|
|
47
|
+
// */
|
|
48
|
+
// static async generateFromKey(type: number, key: string) {
|
|
49
|
+
// const buffer = Buffer.alloc(13);
|
|
50
|
+
// buffer[0] = type & 0xff;
|
|
51
|
+
// Buffer.from(await sha256(key, { outputFormat: 'buffer' })).copy(
|
|
52
|
+
// <Uint8Array>buffer,
|
|
53
|
+
// 1,
|
|
54
|
+
// 0,
|
|
55
|
+
// 12,
|
|
56
|
+
// );
|
|
57
|
+
// return new ObjectId(buffer);
|
|
58
|
+
// }
|
|
59
|
+
// toString() {
|
|
60
|
+
// return bs58.encode(<Uint8Array>this._buffer);
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
77
63
|
export const ObjectType = {
|
|
78
64
|
MemberAccount: 8,
|
|
79
65
|
MemberVerification: 15,
|
package/dist/services/index.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ export * from './auth.service';
|
|
|
3
3
|
export * from './cmsPortal.service';
|
|
4
4
|
export * from './file.service';
|
|
5
5
|
export * from './game.service';
|
|
6
|
-
export * from './graphqlRequest';
|
|
7
|
-
export * from './httpRequest';
|
|
8
6
|
export * from './portal.service';
|
|
9
7
|
export * from './report.service';
|
|
10
|
-
export * from './sha256';
|
|
11
8
|
export * from './trigger.service';
|
|
12
9
|
export * from './wallet.service';
|
|
10
|
+
export * from './graphqlRequest';
|
|
11
|
+
export * from './httpRequest';
|
|
12
|
+
export * from './ObjectType';
|
|
13
|
+
export * from './sha256';
|
package/dist/services/index.js
CHANGED
|
@@ -3,10 +3,11 @@ export * from './auth.service.js';
|
|
|
3
3
|
export * from './cmsPortal.service.js';
|
|
4
4
|
export * from './file.service.js';
|
|
5
5
|
export * from './game.service.js';
|
|
6
|
-
export * from './graphqlRequest.js';
|
|
7
|
-
export * from './httpRequest.js';
|
|
8
6
|
export * from './portal.service.js';
|
|
9
7
|
export * from './report.service.js';
|
|
10
|
-
export * from './sha256.js';
|
|
11
8
|
export * from './trigger.service.js';
|
|
12
9
|
export * from './wallet.service.js';
|
|
10
|
+
export * from './graphqlRequest.js';
|
|
11
|
+
export * from './httpRequest.js';
|
|
12
|
+
export * from './ObjectType.js';
|
|
13
|
+
export * from './sha256.js';
|
package/dist/styles/theme.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@plugin '@tailwindcss/typography';
|
|
2
|
-
@plugin '
|
|
2
|
+
@plugin 'tailwind-zag';
|
|
3
3
|
|
|
4
4
|
@layer base {
|
|
5
5
|
html {
|
|
@@ -694,4 +694,4 @@
|
|
|
694
694
|
@custom-variant scrollbar (&::-webkit-scrollbar);
|
|
695
695
|
@custom-variant scrollbar-thumb (&::-webkit-scrollbar-thumb);
|
|
696
696
|
@custom-variant scrollbar-track (&::-webkit-scrollbar-track);
|
|
697
|
-
@custom-variant dark (&:where(.dark, .dark *));
|
|
697
|
+
@custom-variant dark (&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
|