@opexa/portal-components 0.1.17 → 0.1.18
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/BetDepositLimit/BetDepositLimitModal.d.ts +4 -0
- package/dist/components/BetDepositLimit/BetDepositLimitModal.js +49 -0
- package/dist/components/BetDepositLimit/DepositLimitReached.d.ts +8 -0
- package/dist/components/BetDepositLimit/DepositLimitReached.js +12 -0
- package/dist/components/BetDepositLimit/betDepositLimitStore.d.ts +24 -0
- package/dist/components/BetDepositLimit/betDepositLimitStore.js +51 -0
- package/dist/components/BetDepositLimit/index.d.ts +2 -0
- package/dist/components/BetDepositLimit/index.js +2 -0
- package/dist/components/KYC/KYCDefault/PersonalInformation.js +12 -0
- package/dist/components/KYC/KYCReminder.lazy.js +4 -1
- package/dist/components/KYC/KycOpenOnHomeMount.js +11 -1
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useShallow } from 'zustand/shallow';
|
|
4
|
+
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
5
|
+
import { AlertTriangleIcon } from '../../icons/AlertTriangle.js';
|
|
6
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
7
|
+
import { Button } from '../../ui/Button/index.js';
|
|
8
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
9
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
10
|
+
import { useBetDepositLimitStore } from './betDepositLimitStore.js';
|
|
11
|
+
export function BetDepositLimitModal({ onConfirm }) {
|
|
12
|
+
const { enabled } = useFeatureFlag();
|
|
13
|
+
const { isOpen, type, period, currentLimit, requestedLimit, setIsOpen } = useBetDepositLimitStore(useShallow((state) => ({
|
|
14
|
+
isOpen: state.isOpen,
|
|
15
|
+
type: state.type,
|
|
16
|
+
period: state.period,
|
|
17
|
+
currentLimit: state.currentLimit,
|
|
18
|
+
requestedLimit: state.requestedLimit,
|
|
19
|
+
setIsOpen: state.setIsOpen,
|
|
20
|
+
})));
|
|
21
|
+
const isIncrease = requestedLimit > currentLimit;
|
|
22
|
+
const changeAmount = Math.abs(requestedLimit - currentLimit);
|
|
23
|
+
const formatPeso = (value) => {
|
|
24
|
+
return `₱${value.toLocaleString('en-PH')}`;
|
|
25
|
+
};
|
|
26
|
+
const capPeriod = period.charAt(0).toUpperCase() + period.slice(1);
|
|
27
|
+
const capType = type.charAt(0).toUpperCase() + type.slice(1);
|
|
28
|
+
const title = isIncrease
|
|
29
|
+
? `${capPeriod} ${capType} Limit Increase Requested`
|
|
30
|
+
: `${capPeriod} ${capType} Limit Decrease Applied`;
|
|
31
|
+
const getDescription = () => {
|
|
32
|
+
if (isIncrease) {
|
|
33
|
+
if (type === 'bet') {
|
|
34
|
+
return `Your ${period} bet limit increase request has been submitted. Once approved, your new limit will take effect immediately.`;
|
|
35
|
+
}
|
|
36
|
+
return `Your request to increase your ${period} deposit limit has been submitted. The new limit will take effect once the request is approved.`;
|
|
37
|
+
}
|
|
38
|
+
return `Your ${period} ${type} limit has been lowered and is now active.`;
|
|
39
|
+
};
|
|
40
|
+
const handleConfirm = () => {
|
|
41
|
+
setIsOpen(false);
|
|
42
|
+
if (onConfirm) {
|
|
43
|
+
onConfirm();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return (_jsx(Dialog.Root, { open: isOpen && enabled, onOpenChange: (details) => {
|
|
47
|
+
setIsOpen(details.open);
|
|
48
|
+
}, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto max-h-[90vh] min-w-[21.438rem] max-w-[21.438rem] overflow-y-auto rounded-xl p-3xl lg:min-w-[25rem] lg:max-w-[25rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary", children: _jsx(AlertTriangleIcon, { className: "size-6 text-text-brand-700" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg text-text-primary-900 xl:mt-xl", children: title }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700 leading-relaxed", children: getDescription() }), _jsxs("div", { className: "mt-lg flex w-full select-none flex-col gap-y-2 rounded-xl border border-border-primary bg-bg-secondary px-5 py-4 text-sm", children: [_jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Current limit:' : 'Previous limit:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(currentLimit) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Requested limit:' : 'New limit:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(requestedLimit) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Increase amount:' : 'Decrease amount:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(changeAmount) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Status:' : 'Effective:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: isIncrease ? 'Pending Approval' : 'Immediately' })] })] }), _jsx("div", { className: "mt-3xl flex w-full flex-col gap-2 text-center lg:mt-4xl", children: _jsx(Button, { className: "w-full", onClick: handleConfirm, type: "button", children: "Confirm" }) })] })] }) })] }) }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LimitPeriod, LimitType } from './betDepositLimitStore';
|
|
2
|
+
export interface DepositLimitReachedProps {
|
|
3
|
+
type: LimitType;
|
|
4
|
+
period: LimitPeriod;
|
|
5
|
+
/** URL to the responsible gaming / limits page. Defaults to "/responsible-gaming" */
|
|
6
|
+
responsibleGamingUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function DepositLimitReached({ type, period, responsibleGamingUrl, }: DepositLimitReachedProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertTriangleIcon } from '../../icons/AlertTriangle.js';
|
|
4
|
+
export function DepositLimitReached({ type, period, responsibleGamingUrl = '/responsible-gaming', }) {
|
|
5
|
+
const capPeriod = period.charAt(0).toUpperCase() + period.slice(1);
|
|
6
|
+
const capType = type.charAt(0).toUpperCase() + type.slice(1);
|
|
7
|
+
const title = `${capPeriod} ${capType} Limit Reached`;
|
|
8
|
+
const resetMessage = period === 'daily'
|
|
9
|
+
? "You've reached your daily deposit limit, so you can't deposit right now. Your limit will reset tomorrow at midnight."
|
|
10
|
+
: "You've reached your monthly deposit limit, so you can't deposit right now. Your limit will reset on the 1st day of next month.";
|
|
11
|
+
return (_jsxs("div", { role: "alert", className: "flex items-start gap-md rounded-lg border border-utility-warning-200 bg-utility-warning-50 p-md", children: [_jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-full bg-bg-warning-secondary", children: _jsx(AlertTriangleIcon, { className: "size-4 text-text-featured-icon-light-warning" }) }), _jsxs("div", { className: "flex flex-col gap-xs", children: [_jsx("p", { className: "font-semibold text-sm text-text-primary-900", children: title }), _jsx("p", { className: "text-sm text-text-secondary-700 leading-relaxed", children: resetMessage }), _jsx("a", { href: `${responsibleGamingUrl}?from=limits`, className: "mt-xs w-fit text-sm font-medium text-text-warning-primary-600 hover:underline", children: "View Limits" })] })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type LimitType = 'bet' | 'deposit';
|
|
2
|
+
export type LimitPeriod = 'daily' | 'monthly';
|
|
3
|
+
export interface BetDepositLimitState {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
type: LimitType;
|
|
6
|
+
period: LimitPeriod;
|
|
7
|
+
currentLimit: number;
|
|
8
|
+
requestedLimit: number;
|
|
9
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
10
|
+
setType: (type: LimitType) => void;
|
|
11
|
+
setPeriod: (period: LimitPeriod) => void;
|
|
12
|
+
setCurrentLimit: (limit: number) => void;
|
|
13
|
+
setRequestedLimit: (limit: number) => void;
|
|
14
|
+
openModal: (type: LimitType, period: LimitPeriod, currentLimit: number, requestedLimit: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useBetDepositLimitStore: import("zustand").UseBoundStore<import("zustand").StoreApi<BetDepositLimitState>>;
|
|
17
|
+
export declare const betDepositLimitStore: {
|
|
18
|
+
isOpen: boolean;
|
|
19
|
+
type: LimitType;
|
|
20
|
+
period: LimitPeriod;
|
|
21
|
+
currentLimit: number;
|
|
22
|
+
requestedLimit: number;
|
|
23
|
+
openModal(newType: LimitType, newPeriod: LimitPeriod, currentLimit: number, requestedLimit: number): void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
export const useBetDepositLimitStore = create((set) => ({
|
|
3
|
+
isOpen: false,
|
|
4
|
+
type: 'bet',
|
|
5
|
+
period: 'daily',
|
|
6
|
+
currentLimit: 0,
|
|
7
|
+
requestedLimit: 0,
|
|
8
|
+
setIsOpen: (isOpen) => set({ isOpen }),
|
|
9
|
+
setType: (type) => set({ type }),
|
|
10
|
+
setPeriod: (period) => set({ period }),
|
|
11
|
+
setCurrentLimit: (currentLimit) => set({ currentLimit }),
|
|
12
|
+
setRequestedLimit: (requestedLimit) => set({ requestedLimit }),
|
|
13
|
+
openModal: (type, period, currentLimit, requestedLimit) => set({ type, period, currentLimit, requestedLimit, isOpen: true }),
|
|
14
|
+
}));
|
|
15
|
+
export const betDepositLimitStore = {
|
|
16
|
+
get isOpen() {
|
|
17
|
+
return useBetDepositLimitStore.getState().isOpen;
|
|
18
|
+
},
|
|
19
|
+
set isOpen(value) {
|
|
20
|
+
useBetDepositLimitStore.setState({ isOpen: value });
|
|
21
|
+
},
|
|
22
|
+
get type() {
|
|
23
|
+
return useBetDepositLimitStore.getState().type;
|
|
24
|
+
},
|
|
25
|
+
set type(value) {
|
|
26
|
+
useBetDepositLimitStore.setState({ type: value });
|
|
27
|
+
},
|
|
28
|
+
get period() {
|
|
29
|
+
return useBetDepositLimitStore.getState().period;
|
|
30
|
+
},
|
|
31
|
+
set period(value) {
|
|
32
|
+
useBetDepositLimitStore.setState({ period: value });
|
|
33
|
+
},
|
|
34
|
+
get currentLimit() {
|
|
35
|
+
return useBetDepositLimitStore.getState().currentLimit;
|
|
36
|
+
},
|
|
37
|
+
set currentLimit(value) {
|
|
38
|
+
useBetDepositLimitStore.setState({ currentLimit: value });
|
|
39
|
+
},
|
|
40
|
+
get requestedLimit() {
|
|
41
|
+
return useBetDepositLimitStore.getState().requestedLimit;
|
|
42
|
+
},
|
|
43
|
+
set requestedLimit(value) {
|
|
44
|
+
useBetDepositLimitStore.setState({ requestedLimit: value });
|
|
45
|
+
},
|
|
46
|
+
openModal(newType, newPeriod, currentLimit, requestedLimit) {
|
|
47
|
+
useBetDepositLimitStore
|
|
48
|
+
.getState()
|
|
49
|
+
.openModal(newType, newPeriod, currentLimit, requestedLimit);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -161,6 +161,7 @@ export function PersonalInformation() {
|
|
|
161
161
|
verification: {
|
|
162
162
|
status: 'PENDING',
|
|
163
163
|
},
|
|
164
|
+
verificationStatus: 'PENDING',
|
|
164
165
|
};
|
|
165
166
|
});
|
|
166
167
|
kyc.setDone(true);
|
|
@@ -193,6 +194,17 @@ export function PersonalInformation() {
|
|
|
193
194
|
status: 'PENDING',
|
|
194
195
|
};
|
|
195
196
|
});
|
|
197
|
+
queryClient.setQueryData(getAccountQueryKey(), (prev) => {
|
|
198
|
+
if (!prev)
|
|
199
|
+
return prev;
|
|
200
|
+
return {
|
|
201
|
+
...prev,
|
|
202
|
+
verification: {
|
|
203
|
+
status: 'PENDING',
|
|
204
|
+
},
|
|
205
|
+
verificationStatus: 'PENDING',
|
|
206
|
+
};
|
|
207
|
+
});
|
|
196
208
|
kyc.setDone(true);
|
|
197
209
|
globalStore.kyc.setOpen(false);
|
|
198
210
|
globalStore.kycAccountVerificationRequired.setOpen(false);
|
|
@@ -55,8 +55,9 @@ export function KYCReminder({ enablePendingKycReminder = false, ...props }) {
|
|
|
55
55
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
56
56
|
const isPending = account?.verification?.status === 'PENDING' ||
|
|
57
57
|
account?.verificationStatus === 'PENDING';
|
|
58
|
-
const isRejected = account?.verification?.status === 'REJECTED';
|
|
58
|
+
const isRejected = account?.verification?.status === 'REJECTED' && !isPending;
|
|
59
59
|
const isNotVerified = !!account &&
|
|
60
|
+
!isPending &&
|
|
60
61
|
(!account.verification ||
|
|
61
62
|
account.verification === null ||
|
|
62
63
|
account.verification.status === 'UNVERIFIED' ||
|
|
@@ -118,6 +119,7 @@ export function KYCReminder({ enablePendingKycReminder = false, ...props }) {
|
|
|
118
119
|
globalStore.account__mobile.setOpen(false);
|
|
119
120
|
router.push('/');
|
|
120
121
|
}, children: "Log Out" })] })) })] })), isNotVerified &&
|
|
122
|
+
!isPending &&
|
|
121
123
|
daysFromCreationToNow <= 3 &&
|
|
122
124
|
daysFromCreationToNow > 1 &&
|
|
123
125
|
!isVerificationLocked && (_jsxs(_Fragment, { children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto mb-4 w-fit rounded-full bg-bg-primary p-2", children: _jsx(Image, { src: props.logo, alt: `${props.siteName} logo`, width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "JUST A FRIENDLY REMINDER" }), _jsxs("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: ["Please complete your KYC information within", ' ', _jsx("span", { className: "font-semibold text-[#FF0000]", children: "3 days" }), ' ', "to avoid temporary lock on your account."] }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: props.pagcorLogo?.logo ?? pagcorLogo, alt: "PAGCOR logo", height: 88, width: 88, className: `h-[88px] w-auto shrink-0 ${props.pagcorLogo?.styles ?? ''}`, draggable: false, unoptimized: true }), _jsx(Image, { src: props.responsibleGamingLogo?.logo ??
|
|
@@ -145,6 +147,7 @@ export function KYCReminder({ enablePendingKycReminder = false, ...props }) {
|
|
|
145
147
|
globalStore.account__mobile.setOpen(false);
|
|
146
148
|
router.push('/');
|
|
147
149
|
}, children: "Log Out" })] })) })] })] })), (isNotVerified || isRejected) &&
|
|
150
|
+
!isPending &&
|
|
148
151
|
!isVerificationLocked &&
|
|
149
152
|
!(daysFromCreationToNow <= 3 && daysFromCreationToNow > 1) && (_jsxs(_Fragment, { children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto w-fit rounded-full bg-bg-primary p-2", children: _jsx(FileCheck02Icon, { className: "text-[#FEDF89]" }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "Personal Verification" }), _jsxs("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: ["All new users are required to complete identity verification to access the full range of ", props.siteName, ' ', "services, including withdrawals."] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "mt-3xl space-y-lg", children: [_jsx(Button, { onClick: () => {
|
|
150
153
|
api.setOpen(false);
|
|
@@ -8,6 +8,8 @@ export function KycOpenOnHomeMount({ isSkippable, bypassKycCheck, enablePendingK
|
|
|
8
8
|
const setkycOpen = useGlobalStore((s) => s.kyc.setOpen);
|
|
9
9
|
const setkycAccountVerificationRequired = useGlobalStore((s) => s.kycAccountVerificationRequired.setOpen);
|
|
10
10
|
const isSignUpOpen = useGlobalStore((s) => s.signUp.open);
|
|
11
|
+
const isKycOpen = useGlobalStore((s) => s.kyc.open);
|
|
12
|
+
const isKycReminderOpen = useGlobalStore((s) => s.kycReminder.open);
|
|
11
13
|
const { data: verification, isLoading: verificationLoading } = useMemberVerificationQuery();
|
|
12
14
|
const { data: account, isLoading: accountLoading } = useAccountQuery();
|
|
13
15
|
const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
|
|
@@ -46,7 +48,13 @@ export function KycOpenOnHomeMount({ isSkippable, bypassKycCheck, enablePendingK
|
|
|
46
48
|
if (isPending) {
|
|
47
49
|
setkycOpen(false);
|
|
48
50
|
setkycAccountVerificationRequired(false);
|
|
49
|
-
setkycReminderOpen(isVerificationLocked ||
|
|
51
|
+
setkycReminderOpen(isVerificationLocked ||
|
|
52
|
+
enablePendingKycReminder ||
|
|
53
|
+
useGlobalStore.getState().kycReminder.open);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// User opened the KYC flow explicitly — don't override with the reminder.
|
|
57
|
+
if (isKycOpen && !isKycReminderOpen) {
|
|
50
58
|
return;
|
|
51
59
|
}
|
|
52
60
|
// Handle rejected verification status
|
|
@@ -94,6 +102,8 @@ export function KycOpenOnHomeMount({ isSkippable, bypassKycCheck, enablePendingK
|
|
|
94
102
|
verificationLoading,
|
|
95
103
|
accountLoading,
|
|
96
104
|
isSignUpOpen,
|
|
105
|
+
isKycOpen,
|
|
106
|
+
isKycReminderOpen,
|
|
97
107
|
isVerificationLocked,
|
|
98
108
|
isPending,
|
|
99
109
|
isRejected,
|