@opexa/portal-components 0.0.85 → 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/useCreateGCashDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateGameSessionMutation.js +2 -1
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +2 -1
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +2 -1
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +2 -1
- 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,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createGCashDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateGCashDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateGCashDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createGCashWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateGCashWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateGCashWithdrawalMutation = (config) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { LEGACY_GAME_PROVIDERS } from '../../constants/index.js';
|
|
4
5
|
import { createGameSession, createGameSession__legacy, getGameSession, getGameSession__legacy, } from '../../services/index.js';
|
|
5
|
-
import {
|
|
6
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
6
7
|
import { createPoll, getCreateGameSessionMutationKey } from '../../utils/index.js';
|
|
7
8
|
import { getSession } from '../services/index.js';
|
|
8
9
|
export const useCreateGameSessionMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOInstapayWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateInstapayWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateInstapayWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaAppDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateMayaAppDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaAppDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaAppWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateMayaAppWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaAppWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateMayaDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createMayaWithdrawal, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { getCreateMayaWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateMayaWithdrawalMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOOnlineBankDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateOnlineBankDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateOnlineBankDepositMutation = (config) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ObjectId } from '@opexa/object-id';
|
|
1
2
|
import { useMutation } from '@tanstack/react-query';
|
|
2
3
|
import invariant from 'tiny-invariant';
|
|
3
4
|
import { createAIOQRPHDeposit, getDeposit, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
5
|
+
import { ObjectType } from '../../services/ObjectType.js';
|
|
5
6
|
import { createPoll, getCreateQRPHDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
7
|
import { getSession } from '../services/index.js';
|
|
7
8
|
export const useCreateQRPHDepositMutation = (config) => {
|
|
@@ -6,9 +6,9 @@ import Link from 'next/link';
|
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { useShallow } from 'zustand/shallow';
|
|
8
8
|
import { useAccountQuery, useGlobalStore, useLocaleInfo, useSignOutMutation, useUnreadMessagesCountQuery, useWalletQuery, } from '../../client/hooks/index.js';
|
|
9
|
-
import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon,
|
|
9
|
+
import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, } from '../../icons/index.js';
|
|
10
10
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
11
|
-
import { Badge, Button, Drawer,
|
|
11
|
+
import { Badge, Button, Drawer, Popover } from '../../ui/index.js';
|
|
12
12
|
import { formatNumber, parseDecimal } from '../../utils/index.js';
|
|
13
13
|
import { accountRecipe } from './account.recipe.js';
|
|
14
14
|
const recipe = accountRecipe();
|
|
@@ -25,17 +25,19 @@ export function Account(props) {
|
|
|
25
25
|
const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
|
|
26
26
|
? props.offsetTop
|
|
27
27
|
: [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
|
|
28
|
-
return (_jsxs(_Fragment, { children: [
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(Drawer.Root, { open: globalStore.account__mobile.open, onOpenChange: (details) => {
|
|
29
29
|
globalStore.account__mobile.setOpen(details.open);
|
|
30
|
-
}, lazyMount: true, unmountOnExit: true, children:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsxs(Drawer.Content, { className: twMerge('relative', 'flex', 'flex-col', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'w-full', 'px-xl', 'py-6', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]'), style: {
|
|
31
|
+
['--offset-top-mobile']: mobileOffsetTop,
|
|
32
|
+
['--offset-top-desktop']: desktopOffsetTop,
|
|
33
|
+
}, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) }) }), _jsx(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
34
34
|
globalStore.account.setOpen(details.open);
|
|
35
35
|
}, lazyMount: true, unmountOnExit: true, positioning: {
|
|
36
36
|
placement: 'bottom',
|
|
37
37
|
strategy: 'fixed',
|
|
38
|
-
},
|
|
38
|
+
}, ids: {
|
|
39
|
+
trigger: 'opexa-portal-components:account-trigger',
|
|
40
|
+
}, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) }) })] }));
|
|
39
41
|
}
|
|
40
42
|
function Profile() {
|
|
41
43
|
const accountQuery = useAccountQuery();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export interface AccountTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
|
-
mobile?: boolean;
|
|
4
3
|
asChild?: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare function AccountTrigger(props: AccountTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function AccountTrigger({ asChild, children, ...props }: AccountTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
|
+
import Image from 'next/image';
|
|
5
|
+
import { useMediaQuery } from 'usehooks-ts';
|
|
4
6
|
import { useShallow } from 'zustand/shallow';
|
|
5
7
|
import { useGlobalStore } from '../../client/hooks/index.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
9
|
+
import { IconButton } from '../../ui/index.js';
|
|
10
|
+
export function AccountTrigger({ asChild, children, ...props }) {
|
|
11
|
+
const desktop = useMediaQuery('(min-width: 1024px)', {
|
|
12
|
+
defaultValue: true,
|
|
13
|
+
});
|
|
14
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
15
|
+
account: ctx.account,
|
|
16
|
+
account__mobile: ctx.account__mobile,
|
|
17
|
+
})));
|
|
18
|
+
const disclosure = desktop
|
|
19
|
+
? globalStore.account
|
|
20
|
+
: globalStore.account__mobile;
|
|
21
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle account menu", "data-open": disclosure.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
22
|
+
disclosure.setOpen(!disclosure.open);
|
|
11
23
|
return props.onClick?.(e);
|
|
12
|
-
} }));
|
|
24
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsx(IconButton, { id: "opexa-portal-components:account-trigger", size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 64, height: 64, className: "size-10" }) })) }));
|
|
13
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
interface BonusesTriggerProps extends ComponentPropsWithRef<'a'> {
|
|
3
3
|
}
|
|
4
|
-
export declare function BonusesTrigger(props: BonusesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function BonusesTrigger({ children, className, ...props }: BonusesTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export {};
|
|
@@ -5,7 +5,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { useBonusesQuery, useCashbackBonusesQuery } from '../../client/hooks/index.js';
|
|
6
6
|
import { Gift01Icon } from '../../icons/index.js';
|
|
7
7
|
import { iconButtonRecipe } from '../../ui/IconButton/iconButton.recipe.js';
|
|
8
|
-
export function BonusesTrigger(props) {
|
|
8
|
+
export function BonusesTrigger({ children, className, ...props }) {
|
|
9
9
|
const bonusesQuery = useBonusesQuery({
|
|
10
10
|
refetchInterval: 10000,
|
|
11
11
|
});
|
|
@@ -18,6 +18,6 @@ export function BonusesTrigger(props) {
|
|
|
18
18
|
return (_jsx(Link, { "aria-label": "View Rewards", "data-count": totalCount, ...props, href: props.href ?? '/rewards', className: iconButtonRecipe({
|
|
19
19
|
size: 'sm',
|
|
20
20
|
colorScheme: 'gray',
|
|
21
|
-
className: twMerge('relative',
|
|
22
|
-
}), children:
|
|
21
|
+
className: twMerge('relative', className),
|
|
22
|
+
}), children: children ?? (_jsxs(_Fragment, { children: [totalCount > 0 && (_jsx("div", { className: "bg-brand-500 leading-4.5 text-button-primary-fg absolute -right-1.5 -top-1.5 min-w-5 rounded-full border px-1.5 text-2xs font-semibold", children: totalCount })), _jsx(Gift01Icon, {})] })) }));
|
|
23
23
|
}
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: import("react").Context<{
|
|
2
|
-
view: "
|
|
2
|
+
view: "vca" | "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 OnlineBankDepositContext: import("react").Context<{
|
|
|
9
9
|
promo?: string | null;
|
|
10
10
|
}) => void;
|
|
11
11
|
}>, useOnlineBankDepositContext: () => {
|
|
12
|
-
view: "
|
|
12
|
+
view: "vca" | "form";
|
|
13
13
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
14
14
|
verify: () => void;
|
|
15
15
|
reset: () => void;
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
3
|
export declare function useOnlineBankDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "vca" | "form";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -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;
|