@opexa/portal-components 0.1.25 → 0.1.27
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/TransactionRecords/DepositRecordsTable.js +8 -6
- package/dist/components/TransactionRecords/TransactionRecordsTable.js +5 -5
- package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +8 -6
- package/dist/components/UpdateMobilePhoneNumber/UpdateMobilePhoneNumber.js +1 -1
- package/dist/components/UpdateMobilePhoneNumber/hooks/useUpdateMobileFlow.d.ts +2 -1
- package/dist/components/UpdateMobilePhoneNumber/hooks/useUpdateMobileFlow.js +26 -2
- package/dist/services/httpRequest.js +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,8 @@ export function DepositRecordsTable(props) {
|
|
|
31
31
|
...next,
|
|
32
32
|
}), {
|
|
33
33
|
type: enabledDepositTypes?.length === 1 ? enabledDepositTypes[0] : null,
|
|
34
|
+
status: null,
|
|
35
|
+
timestamp: null,
|
|
34
36
|
});
|
|
35
37
|
const localeInfo = useLocaleInfo();
|
|
36
38
|
const { page, hasNextPage, hasPrevPage, next, prev, rows, totalPages, loading, firstPage, } = useInfiniteQueryHelper(useDepositRecordsQuery, {
|
|
@@ -73,14 +75,14 @@ export function DepositRecordsTable(props) {
|
|
|
73
75
|
? { scrollbarThumb: props.className }
|
|
74
76
|
: (props.className ?? {});
|
|
75
77
|
return (_jsxs(_Fragment, { children: [_jsx(TableFilters, { value: {
|
|
76
|
-
timestamp: state.timestamp,
|
|
77
|
-
depositType: state.type,
|
|
78
|
-
depositStatus: state.status,
|
|
78
|
+
timestamp: state.timestamp ?? null,
|
|
79
|
+
depositType: state.type ?? null,
|
|
80
|
+
depositStatus: state.status ?? null,
|
|
79
81
|
}, onChange: (value) => {
|
|
80
82
|
setState({
|
|
81
|
-
type: value.depositType,
|
|
82
|
-
status: value.depositStatus,
|
|
83
|
-
timestamp: value.timestamp,
|
|
83
|
+
type: value.depositType ?? null,
|
|
84
|
+
status: value.depositStatus ?? null,
|
|
85
|
+
timestamp: value.timestamp ?? null,
|
|
84
86
|
});
|
|
85
87
|
firstPage();
|
|
86
88
|
if (searchParams.has('id')) {
|
|
@@ -22,7 +22,7 @@ export function TransactionRecordsTable(props) {
|
|
|
22
22
|
const [state, setState] = useReducer((prev, next) => ({
|
|
23
23
|
...prev,
|
|
24
24
|
...next,
|
|
25
|
-
}), {});
|
|
25
|
+
}), { type: null, timestamp: null });
|
|
26
26
|
const localeInfo = useLocaleInfo();
|
|
27
27
|
const { page, hasNextPage, hasPrevPage, next, prev, rows, totalPages, loading, firstPage, } = useInfiniteQueryHelper(useTransactionRecordsQuery, {
|
|
28
28
|
filter: {
|
|
@@ -47,12 +47,12 @@ export function TransactionRecordsTable(props) {
|
|
|
47
47
|
? { scrollbarThumb: props.className }
|
|
48
48
|
: (props.className ?? {});
|
|
49
49
|
return (_jsxs(_Fragment, { children: [_jsx(TableFilters, { value: {
|
|
50
|
-
timestamp: state.timestamp,
|
|
51
|
-
transactionType: state.type,
|
|
50
|
+
timestamp: state.timestamp ?? null,
|
|
51
|
+
transactionType: state.type ?? null,
|
|
52
52
|
}, onChange: (value) => {
|
|
53
53
|
setState({
|
|
54
|
-
type: value.transactionType,
|
|
55
|
-
timestamp: value.timestamp,
|
|
54
|
+
type: value.transactionType ?? null,
|
|
55
|
+
timestamp: value.timestamp ?? null,
|
|
56
56
|
});
|
|
57
57
|
firstPage();
|
|
58
58
|
}, enabledFilters: {
|
|
@@ -31,6 +31,8 @@ export function WithdrawalRecordsTable(props) {
|
|
|
31
31
|
...next,
|
|
32
32
|
}), {
|
|
33
33
|
type: enabledWithdrawalTypes?.length === 1 ? enabledWithdrawalTypes[0] : null,
|
|
34
|
+
status: null,
|
|
35
|
+
timestamp: null,
|
|
34
36
|
});
|
|
35
37
|
const localeInfo = useLocaleInfo();
|
|
36
38
|
const { page, hasNextPage, hasPrevPage, next, prev, rows, totalPages, loading, firstPage, } = useInfiniteQueryHelper(useWithdrawalRecordsQuery, {
|
|
@@ -73,14 +75,14 @@ export function WithdrawalRecordsTable(props) {
|
|
|
73
75
|
? { scrollbarThumb: props.className }
|
|
74
76
|
: (props.className ?? {});
|
|
75
77
|
return (_jsxs(_Fragment, { children: [_jsx(TableFilters, { value: {
|
|
76
|
-
timestamp: state.timestamp,
|
|
77
|
-
withdrawalType: state.type,
|
|
78
|
-
withdrawalStatus: state.status,
|
|
78
|
+
timestamp: state.timestamp ?? null,
|
|
79
|
+
withdrawalType: state.type ?? null,
|
|
80
|
+
withdrawalStatus: state.status ?? null,
|
|
79
81
|
}, onChange: (value) => {
|
|
80
82
|
setState({
|
|
81
|
-
type: value.withdrawalType,
|
|
82
|
-
status: value.withdrawalStatus,
|
|
83
|
-
timestamp: value.timestamp,
|
|
83
|
+
type: value.withdrawalType ?? null,
|
|
84
|
+
status: value.withdrawalStatus ?? null,
|
|
85
|
+
timestamp: value.timestamp ?? null,
|
|
84
86
|
});
|
|
85
87
|
firstPage();
|
|
86
88
|
if (searchParams.has('id')) {
|
|
@@ -17,7 +17,7 @@ export function UpdateMobilePhoneNumber({ shouldOnlyShow = 'MobileVerified', } =
|
|
|
17
17
|
updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
|
|
18
18
|
kyc: ctx.kyc,
|
|
19
19
|
})));
|
|
20
|
-
const { step, step1Form, step2Form, cooldown, formRef, mobileNumberParser, submitStep1, submitStep2, resend, goBackToStep1, } = useUpdateMobileFlow();
|
|
20
|
+
const { step, step1Form, step2Form, cooldown, formRef, mobileNumberParser, submitStep1, submitStep2, resend, goBackToStep1, } = useUpdateMobileFlow(shouldOnlyShow);
|
|
21
21
|
const isOpen = globalStore.updateMobilePhoneNumber.open && !globalStore.kyc.open;
|
|
22
22
|
return (_jsx(Dialog.Root, { open: isOpen, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center", children: _jsxs(Dialog.Content, { className: "flex w-[375px] flex-col items-center space-y-4 rounded-xl bg-[#111827] p-6 text-center", style: {
|
|
23
23
|
backgroundImage: `url(${lightBg.src})`,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { UpdateMobilePhoneNumberShouldOnlyShow } from './useAutoOpen';
|
|
1
2
|
/**
|
|
2
3
|
* Encapsulates the entire two-step mobile number update flow:
|
|
3
4
|
* - step state
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
* - resend cooldown
|
|
9
10
|
* - helpers used by the two step components
|
|
10
11
|
*/
|
|
11
|
-
export declare function useUpdateMobileFlow(): {
|
|
12
|
+
export declare function useUpdateMobileFlow(shouldOnlyShow?: UpdateMobilePhoneNumberShouldOnlyShow): {
|
|
12
13
|
step: number;
|
|
13
14
|
step1Form: import("react-hook-form").UseFormReturn<{
|
|
14
15
|
mobileNumber: string;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
3
|
import { useRef, useState } from 'react';
|
|
4
4
|
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { useTimeout } from 'usehooks-ts';
|
|
5
6
|
import { useShallow } from 'zustand/shallow';
|
|
6
7
|
import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
|
|
7
8
|
import { useCooldown } from '../../../client/hooks/useCooldown.js';
|
|
8
9
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
10
|
+
import { useSessionQuery } from '../../../client/hooks/useSessionQuery.js';
|
|
9
11
|
import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberParser.js';
|
|
10
12
|
import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
|
|
11
13
|
import { useUpdateMobileNumber } from '../../../client/hooks/useUpdateMobileNumber.js';
|
|
@@ -22,12 +24,34 @@ import { useMobileNumberSchemas } from './useMobileNumberSchemas.js';
|
|
|
22
24
|
* - resend cooldown
|
|
23
25
|
* - helpers used by the two step components
|
|
24
26
|
*/
|
|
25
|
-
export function useUpdateMobileFlow() {
|
|
27
|
+
export function useUpdateMobileFlow(shouldOnlyShow = 'MobileVerified') {
|
|
26
28
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
27
29
|
updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
|
|
28
30
|
kyc: ctx.kyc,
|
|
29
31
|
})));
|
|
30
|
-
const
|
|
32
|
+
const pollForMobileVerified = shouldOnlyShow === 'MobileVerified';
|
|
33
|
+
const sessionQuery = useSessionQuery();
|
|
34
|
+
const accountQuery = useAccountQuery(pollForMobileVerified
|
|
35
|
+
? {
|
|
36
|
+
enabled: sessionQuery.data?.status === 'authenticated' &&
|
|
37
|
+
globalStore.updateMobilePhoneNumber.open,
|
|
38
|
+
refetchInterval: (ctx) => {
|
|
39
|
+
if (ctx.state.data?.mobileNumberVerified === true) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
if (ctx.state.dataUpdateCount > 5) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return 1000;
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
: undefined);
|
|
49
|
+
useTimeout(() => {
|
|
50
|
+
globalStore.updateMobilePhoneNumber.setOpen(false);
|
|
51
|
+
}, pollForMobileVerified &&
|
|
52
|
+
accountQuery.data?.mobileNumberVerified === true
|
|
53
|
+
? 1
|
|
54
|
+
: null);
|
|
31
55
|
const mobileNumberParser = useMobileNumberParser();
|
|
32
56
|
const { Step1Definition, Step2Definition } = useMobileNumberSchemas();
|
|
33
57
|
const [step, setStep] = useState(1);
|
|
@@ -150,7 +150,7 @@ function getErrorMessage(code) {
|
|
|
150
150
|
case 'MEMBER_ACCOUNT_SUSPENDED':
|
|
151
151
|
return 'Your account has been temporarily suspended. Please reach out to the Chat Support team to learn more and get help with resolving the issue.';
|
|
152
152
|
case 'MEMBER_ACCOUNT_DISABLED':
|
|
153
|
-
return 'Your account is being created. Please try again later.';
|
|
153
|
+
return 'Your account is being created. It may take a few minutes to complete. Please try again later.';
|
|
154
154
|
case 'INVALID_RECAPTCHA_RESPONSE':
|
|
155
155
|
return 'Invalid reCAPTCHA response';
|
|
156
156
|
case 'MEMBER_NOT_FOUND':
|