@opexa/portal-components 0.0.182 → 0.0.184
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/Account/AccountTrigger.js +2 -1
- package/dist/components/AccountSecurity/AccountSecurity.js +1 -1
- package/dist/components/AccountVerification/AccountVerification.js +4 -3
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +14 -3
- package/dist/components/Quests/Quests.client.js +3 -1
- package/dist/services/account.js +4 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import Image from 'next/image';
|
|
|
5
5
|
import { useMediaQuery } from 'usehooks-ts';
|
|
6
6
|
import { useShallow } from 'zustand/shallow';
|
|
7
7
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
8
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
8
9
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
9
10
|
import { IconButton } from '../../ui/IconButton/index.js';
|
|
10
11
|
export function AccountTrigger({ asChild, children, ...props }) {
|
|
@@ -21,5 +22,5 @@ export function AccountTrigger({ asChild, children, ...props }) {
|
|
|
21
22
|
return (_jsx(ark.button, { type: "button", "aria-label": "Toggle account menu", "data-open": disclosure.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
22
23
|
disclosure.setOpen(!disclosure.open);
|
|
23
24
|
return props.onClick?.(e);
|
|
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" }) })) }));
|
|
25
|
+
}, asChild: !children ? true : asChild, children: children ?? (_jsx(IconButton, { id: "opexa-portal-components:account-trigger", size: "sm", colorScheme: "gray", children: !desktop && disclosure.open ? (_jsx(XIcon, {})) : (_jsx(Image, { src: avatarPlaceholder, alt: "", width: 64, height: 64, className: "size-10" })) })) }));
|
|
25
26
|
}
|
|
@@ -148,7 +148,7 @@ function TransactionPassword() {
|
|
|
148
148
|
? 'text-text-success-primary'
|
|
149
149
|
: 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", onSubmit: form.handleSubmit((data) => {
|
|
150
150
|
updateAccountMutation.mutate({
|
|
151
|
-
|
|
151
|
+
transactionPassword: data.password ? data.password : undefined,
|
|
152
152
|
});
|
|
153
153
|
}), children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.confirmPassword, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Confirm Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('confirmPassword') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.confirmPassword?.message })] })] }), form.formState.isDirty && (_jsxs("div", { className: "border-border-secondary flex justify-end gap-lg border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
|
|
154
154
|
}
|
|
@@ -22,8 +22,9 @@ export function AccountVerification(props) {
|
|
|
22
22
|
const profileCompletion = profileCompletionQuery.data;
|
|
23
23
|
const verificationQuery = useMemberVerificationQuery();
|
|
24
24
|
const verification = verificationQuery.data;
|
|
25
|
-
const isKycCompleted =
|
|
26
|
-
verification
|
|
25
|
+
const isKycCompleted = verification &&
|
|
26
|
+
verification.status !== 'UNVERIFIED' &&
|
|
27
|
+
verification.status !== 'REJECTED';
|
|
27
28
|
const empty = verification == null;
|
|
28
29
|
const pending = verification?.status === 'PENDING';
|
|
29
30
|
const success = verification?.status === 'VERIFIED' || verification?.status === 'APPROVED';
|
|
@@ -31,7 +32,7 @@ export function AccountVerification(props) {
|
|
|
31
32
|
verification?.status === 'UNVERIFIED';
|
|
32
33
|
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Verify your identity" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "Complete personal verification to unlock all features and enhance account security." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountVerification
|
|
33
34
|
? 'text-text-success-primary'
|
|
34
|
-
: 'text-text-warning-primary'), children: profileCompletion?.accountVerification ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("div", { className: "shadow-xs border-border-secondary bg-bg-primary-alt mt-5 rounded-xl border", children: [_jsx("div", { className: "px-4 py-5", children: _jsxs("ul", { className: "space-y-lg", children: [_jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FileCheck02Icon, {}), "Basic Information"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(CreditCard02Icon, {}), "Government ID"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FaceIdIcon, {}), "Facial Verification"] })] }) }), _jsx("div", { className: "border-border-secondary flex justify-end border-t px-4 py-3 lg:py-xl", children:
|
|
35
|
+
: 'text-text-warning-primary'), children: profileCompletion?.accountVerification ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("div", { className: "shadow-xs border-border-secondary bg-bg-primary-alt mt-5 rounded-xl border", children: [_jsx("div", { className: "px-4 py-5", children: _jsxs("ul", { className: "space-y-lg", children: [_jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FileCheck02Icon, {}), "Basic Information"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(CreditCard02Icon, {}), "Government ID"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FaceIdIcon, {}), "Facial Verification"] })] }) }), !isKycCompleted && (_jsx("div", { className: "border-border-secondary flex justify-end border-t px-4 py-3 lg:py-xl", children: _jsx(Button, { size: "sm", className: "w-full lg:w-fit", onClick: () => globalStore.kyc.setOpen(true), children: "Verify Now" }) }))] }), success && _jsx(VerificationSuccess, {}), pending && _jsx(VerificationInProgress, {}), failed && _jsx(VerificationFailed, {}), empty && _jsx(VerificationNotSubmitted, {})] }));
|
|
35
36
|
}
|
|
36
37
|
function VerificationNotSubmitted() {
|
|
37
38
|
return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 flex flex-col gap-2 rounded-xl border p-xl lg:flex-row", children: [_jsx("div", { className: "border-text-warning-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-warning-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(AlertCircleIcon, { className: "text-text-warning-primary size-5" }) }) }), _jsx("p", { className: "text-text-tertiary-600 max-w-[800px] text-sm", children: "To serve you better and unlock all features, please provide valid identification documents. This helps protect your account and makes recovery easier if ever needed." })] }));
|
|
@@ -4,6 +4,7 @@ import { useShallow } from 'zustand/shallow';
|
|
|
4
4
|
import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
|
|
5
5
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
6
6
|
import { useIsMayaSessionValidQuery } from '../../../client/hooks/useIsMayaSessionValidQuery.js';
|
|
7
|
+
import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
|
|
7
8
|
import { useOnMMA } from '../../../client/hooks/useOnMMA.js';
|
|
8
9
|
import { usePaymentSettingsQuery } from '../../../client/hooks/usePaymentSettingsQuery.js';
|
|
9
10
|
import { useWalletQuery } from '../../../client/hooks/useWalletQuery.js';
|
|
@@ -27,6 +28,8 @@ export function Withdrawal() {
|
|
|
27
28
|
const paymentSettings = paymentSettingsQuery.data;
|
|
28
29
|
const isMayaSessionValidQuery = useIsMayaSessionValidQuery();
|
|
29
30
|
const isMayaSessionValid = isMayaSessionValidQuery.data ?? true;
|
|
31
|
+
const memberVerificationQuery = useMemberVerificationQuery();
|
|
32
|
+
const memberVerification = memberVerificationQuery.data;
|
|
30
33
|
const enabledPaymentMethods = (() => {
|
|
31
34
|
const l = [];
|
|
32
35
|
if (onMMA) {
|
|
@@ -65,7 +68,8 @@ export function Withdrawal() {
|
|
|
65
68
|
if (accountQuery.isLoading ||
|
|
66
69
|
walletQuery.isLoading ||
|
|
67
70
|
paymentSettingsQuery.isLoading ||
|
|
68
|
-
isMayaSessionValidQuery.isLoading
|
|
71
|
+
isMayaSessionValidQuery.isLoading ||
|
|
72
|
+
memberVerificationQuery.isLoading) {
|
|
69
73
|
return _jsx(SpinnerIcon, { className: "mx-auto size-6" });
|
|
70
74
|
}
|
|
71
75
|
if (!isMayaSessionValid) {
|
|
@@ -74,8 +78,12 @@ export function Withdrawal() {
|
|
|
74
78
|
if (parseDecimal(wallet?.balance, 0) < 1) {
|
|
75
79
|
return _jsx(InsufficientBalance, {});
|
|
76
80
|
}
|
|
77
|
-
if (!account?.transactionPassword
|
|
78
|
-
|
|
81
|
+
if (!account?.transactionPassword) {
|
|
82
|
+
return _jsx(TransactionPasswordNotSet, {});
|
|
83
|
+
}
|
|
84
|
+
if (!memberVerification ||
|
|
85
|
+
memberVerification.status === 'REJECTED' ||
|
|
86
|
+
memberVerification.status === 'UNVERIFIED') {
|
|
79
87
|
return _jsx(AccountVerificationRequired, {});
|
|
80
88
|
}
|
|
81
89
|
if (enabledPaymentMethods.length <= 0) {
|
|
@@ -83,6 +91,9 @@ export function Withdrawal() {
|
|
|
83
91
|
}
|
|
84
92
|
return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {})] }));
|
|
85
93
|
}
|
|
94
|
+
function TransactionPasswordNotSet() {
|
|
95
|
+
return (_jsxs("div", { className: "pt-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Transaction Password Not Set" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "To proceed with withdrawals, you must first set up a transaction password. This ensures the security of your account and transactions." })] }));
|
|
96
|
+
}
|
|
86
97
|
function AccountVerificationRequired() {
|
|
87
98
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
88
99
|
kyc: ctx.kyc,
|
|
@@ -19,7 +19,9 @@ const QUEST_COMPONENT_MAP = {
|
|
|
19
19
|
const TabDefinition = z.enum(['AVAILABLE', 'COMPLETED']);
|
|
20
20
|
export function Quests__client(props) {
|
|
21
21
|
const [tab, setTab] = useState('AVAILABLE');
|
|
22
|
-
const questsQuery = useAvailableQuestsQuery(
|
|
22
|
+
const questsQuery = useAvailableQuestsQuery({
|
|
23
|
+
refetchInterval: 10000,
|
|
24
|
+
});
|
|
23
25
|
const quests = !questsQuery.data?.length
|
|
24
26
|
? []
|
|
25
27
|
: questsQuery.data.filter((quest) => {
|
package/dist/services/account.js
CHANGED
|
@@ -95,13 +95,16 @@ export const registerMemberAccountByName = async (input, options) => {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
export const updateMemberAccount = async (id, data, options) => {
|
|
98
|
-
const { password, secretAnswer, ...rest } = data;
|
|
98
|
+
const { password, secretAnswer, transactionPassword, ...rest } = data;
|
|
99
99
|
const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, UPDATE_MEMBER_ACCOUNT, {
|
|
100
100
|
input: {
|
|
101
101
|
id,
|
|
102
102
|
data: {
|
|
103
103
|
password: password ? await sha256(password) : undefined,
|
|
104
104
|
secretAnswer: secretAnswer ? await sha256(secretAnswer) : undefined,
|
|
105
|
+
transactionPassword: transactionPassword
|
|
106
|
+
? await sha256(transactionPassword)
|
|
107
|
+
: undefined,
|
|
105
108
|
...rest,
|
|
106
109
|
},
|
|
107
110
|
},
|