@opexa/portal-components 0.0.237 → 0.0.239
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/useCamera.d.ts +4 -3
- package/dist/client/hooks/useCamera.js +16 -3
- package/dist/components/AccountVerification/AccountVerification.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/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js +0 -1
- package/dist/components/Disclaimer/DisclaimerV2.js +1 -1
- package/dist/components/Disclaimer/ResponsibleGaming.d.ts +2 -1
- package/dist/components/Disclaimer/ResponsibleGaming.js +2 -2
- package/dist/components/Disclaimer/TermsOfUse.d.ts +2 -1
- package/dist/components/Disclaimer/TermsOfUse.js +2 -2
- package/dist/components/KYC/KYC.lazy.js +13 -6
- package/dist/components/PortalProvider/PortalProvider.js +2 -1
- package/dist/components/shared/SelfieField.d.ts +1 -1
- package/dist/components/shared/SelfieField.js +20 -4
- package/dist/constants/EnvVar.d.ts +1 -0
- package/dist/constants/EnvVar.js +5 -0
- package/dist/utils/validateFile.d.ts +6 -5
- package/dist/utils/validateFile.js +8 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type KnownCameraErrorName = 'CameraError' | 'PermissionDeniedError' | 'DeviceNotFoundError';
|
|
2
3
|
export interface CameraError<T extends string = never> {
|
|
3
|
-
name:
|
|
4
|
+
name: KnownCameraErrorName | T;
|
|
4
5
|
message: string;
|
|
5
6
|
}
|
|
6
7
|
export interface CameraData {
|
|
@@ -32,7 +33,7 @@ export interface UseCameraReturn<T extends string = never> {
|
|
|
32
33
|
videoProps: ComponentPropsWithRef<'video'>;
|
|
33
34
|
}
|
|
34
35
|
export interface UseCameraOptions<T extends string = never> extends MediaStreamConstraints {
|
|
35
|
-
transform
|
|
36
|
-
validate
|
|
36
|
+
transform?(data: CameraData): CameraData | Promise<CameraData>;
|
|
37
|
+
validate?(data: CameraData): CameraError<T> | void | null | undefined | Promise<CameraError<T> | void | null | undefined>;
|
|
37
38
|
}
|
|
38
39
|
export declare function useCamera<T extends string = never>(options?: UseCameraOptions<T>): UseCameraReturn<T>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBoolean, isFunction } from 'lodash-es';
|
|
1
|
+
import { isBoolean, isFunction, isObject } from 'lodash-es';
|
|
2
2
|
import { useCallback, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
4
|
export function useCamera(options = {}) {
|
|
@@ -8,6 +8,7 @@ export function useCamera(options = {}) {
|
|
|
8
8
|
const [data, setData] = useState(null);
|
|
9
9
|
const [error, setError] = useState(null);
|
|
10
10
|
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [mirror, setMirror] = useState(false);
|
|
11
12
|
const open = useCallback(async () => {
|
|
12
13
|
setData(null);
|
|
13
14
|
setError(null);
|
|
@@ -40,6 +41,11 @@ export function useCamera(options = {}) {
|
|
|
40
41
|
});
|
|
41
42
|
node.srcObject = result;
|
|
42
43
|
stream.current = result;
|
|
44
|
+
setMirror(!isObject(constraints.video)
|
|
45
|
+
? true
|
|
46
|
+
: constraints.video.facingMode === 'environment'
|
|
47
|
+
? false
|
|
48
|
+
: true);
|
|
43
49
|
}
|
|
44
50
|
catch (e) {
|
|
45
51
|
if (e instanceof Error) {
|
|
@@ -114,6 +120,10 @@ export function useCamera(options = {}) {
|
|
|
114
120
|
canvas.height = h * scaleFactor;
|
|
115
121
|
context.imageSmoothingEnabled = true;
|
|
116
122
|
context.imageSmoothingQuality = 'high';
|
|
123
|
+
if (mirror) {
|
|
124
|
+
context.translate(canvas.width, 0);
|
|
125
|
+
context.scale(-1, 1);
|
|
126
|
+
}
|
|
117
127
|
context.drawImage(video, x, y, w, h, 0, 0, w * scaleFactor, h * scaleFactor);
|
|
118
128
|
canvas.toBlob(async (blob) => {
|
|
119
129
|
if (!blob) {
|
|
@@ -135,7 +145,7 @@ export function useCamera(options = {}) {
|
|
|
135
145
|
else
|
|
136
146
|
setData(isFunction(transform) ? await transform(data) : data);
|
|
137
147
|
}, 'image/jpeg', 1);
|
|
138
|
-
}, [transform, validate]);
|
|
148
|
+
}, [mirror, transform, validate]);
|
|
139
149
|
const reset = useCallback(() => {
|
|
140
150
|
setData(null);
|
|
141
151
|
setError(null);
|
|
@@ -161,8 +171,11 @@ export function useCamera(options = {}) {
|
|
|
161
171
|
position: 'relative',
|
|
162
172
|
boxSizing: 'border-box',
|
|
163
173
|
background: 'transparent',
|
|
174
|
+
objectFit: 'cover',
|
|
175
|
+
objectPosition: 'center',
|
|
176
|
+
transform: mirror ? 'scaleX(-1)' : 'none',
|
|
164
177
|
},
|
|
165
|
-
}), []);
|
|
178
|
+
}), [mirror]);
|
|
166
179
|
return {
|
|
167
180
|
snap,
|
|
168
181
|
open,
|
|
@@ -22,9 +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 = verification
|
|
26
|
-
verification
|
|
27
|
-
verification
|
|
25
|
+
const isKycCompleted = Boolean(verification?.status === 'VERIFIED') ||
|
|
26
|
+
Boolean(verification?.status === 'PENDING') ||
|
|
27
|
+
Boolean(verification?.status === 'APPROVED');
|
|
28
28
|
const empty = verification == null;
|
|
29
29
|
const pending = verification?.status === 'PENDING';
|
|
30
30
|
const success = verification?.status === 'VERIFIED' || verification?.status === 'APPROVED';
|
package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const OnlineBankDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
3
|
+
view: "form" | "vca";
|
|
4
4
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
|
-
view: "
|
|
16
|
+
view: "form" | "vca";
|
|
17
17
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
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: "form" | "vca";
|
|
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,6 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
3
|
+
view: "form" | "qrCode";
|
|
4
4
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
view: "
|
|
16
|
+
view: "form" | "qrCode";
|
|
17
17
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
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: "form" | "qrCode";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
package/dist/components/DepositWithdrawal/Withdrawal/InstapayWithdrawal/InstapayWithdrawal.js
CHANGED
|
@@ -126,7 +126,6 @@ export function InstapayWithdrawal() {
|
|
|
126
126
|
itemToValue: (item) => item.code,
|
|
127
127
|
itemToString: (item) => item.name,
|
|
128
128
|
}), [instapayBankList]);
|
|
129
|
-
console.log(bankCollection.items);
|
|
130
129
|
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsx(Controller, { control: form.control, name: "bankCode", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.bankCode, children: [_jsxs(Select.Root, { collection: bankCollection, positioning: {
|
|
131
130
|
sameWidth: true,
|
|
132
131
|
}, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
|
|
@@ -18,7 +18,7 @@ export function DisclaimerV2(props) {
|
|
|
18
18
|
const [isResponsibleGamingOpen, setResponsibleGamingOpen] = useState(false);
|
|
19
19
|
const [isTermsOfUseOpen, setTermsOfUseOpen] = useState(false);
|
|
20
20
|
const [isChecked, setIsChecked] = useState(true);
|
|
21
|
-
return (_jsxs(_Fragment, { children: [_jsx(ResponsibleGaming, { responsibleGamingContent: props.responsibleGamingContent, logo: props.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false) }), _jsx(TermsOfUse, { termsOfUseContent: props.termsOfUseContent, siteName: props.siteName, logo: props.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false) }), _jsx(Dialog.Root, { open: disclaimer.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, initialFocusEl: () => acceptTriggerRef.current, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start gap-y-4 overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 43, width: 88, className: "h-[43px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 50, width: 186, className: "h-[50px] w-auto shrink-0", draggable: false })] }), _jsx("div", { className: "text-sm", children: "The following individuals are prohibited from registering or participating in this online gaming platform." }), _jsx("div", { className: "w-full grow", children: _jsxs(Dialog.Description, { className: "space-y-4 text-sm", children: [_jsxs("ul", { className: "space-y-1.5 text-left", children: [_jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Persons below the legal gambling age of 21."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Any government official or employee directly involved in the operations of the government or its agencies."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Member of the Armed Forces of the Philippines, including the Army, Navy, Air Force and the Philippine National Police."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Individuals listed in PAGCOR's National Database of Restricted Persons (NDRP)"] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Holders of a valid Gaming Employment License (GEL)"] })] }), !props.hasNoCheckbox ? (_jsxs(Checkbox.Root, { checked: isChecked, onCheckedChange: (e) => {
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsx(ResponsibleGaming, { responsibleGamingContent: props.responsibleGamingContent, logo: props.logo, open: isResponsibleGamingOpen, onCloseAction: () => setResponsibleGamingOpen(false), responsibleGamingLogo: props.responsibleGamingLogo }), _jsx(TermsOfUse, { termsOfUseContent: props.termsOfUseContent, siteName: props.siteName, logo: props.logo, open: isTermsOfUseOpen, onCloseAction: () => setTermsOfUseOpen(false), responsibleGamingLogo: props.responsibleGamingLogo }), _jsx(Dialog.Root, { open: disclaimer.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, initialFocusEl: () => acceptTriggerRef.current, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start gap-y-4 overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 43, width: 88, className: "h-[43px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 50, width: 186, className: "h-[50px] w-auto shrink-0", draggable: false })] }), _jsx("div", { className: "text-sm", children: "The following individuals are prohibited from registering or participating in this online gaming platform." }), _jsx("div", { className: "w-full grow", children: _jsxs(Dialog.Description, { className: "space-y-4 text-sm", children: [_jsxs("ul", { className: "space-y-1.5 text-left", children: [_jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Persons below the legal gambling age of 21."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Any government official or employee directly involved in the operations of the government or its agencies."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Member of the Armed Forces of the Philippines, including the Army, Navy, Air Force and the Philippine National Police."] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Individuals listed in PAGCOR's National Database of Restricted Persons (NDRP)"] }), _jsxs("li", { className: "flex gap-4", children: [_jsx(Circle, {}), "Holders of a valid Gaming Employment License (GEL)"] })] }), !props.hasNoCheckbox ? (_jsxs(Checkbox.Root, { checked: isChecked, onCheckedChange: (e) => {
|
|
22
22
|
setIsChecked(!!e.checked);
|
|
23
23
|
}, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { children: ["I have read and agreed to ", props.siteName, ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", onClick: () => {
|
|
24
24
|
setTermsOfUseOpen(true);
|
|
@@ -5,5 +5,6 @@ export interface ResponsibleGamingProps {
|
|
|
5
5
|
logo: ImageProps['src'];
|
|
6
6
|
open: boolean;
|
|
7
7
|
onCloseAction: () => void;
|
|
8
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
8
9
|
}
|
|
9
|
-
export declare function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, }: ResponsibleGamingProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, ...props }: ResponsibleGamingProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,8 +6,8 @@ import responsibleGamingLogo from '../../images/responsible-gaming.png';
|
|
|
6
6
|
import { Button } from '../../ui/Button/index.js';
|
|
7
7
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
8
8
|
import { Portal } from '../../ui/Portal/index.js';
|
|
9
|
-
export function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, }) {
|
|
10
|
-
return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: "Responsible Gaming" }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: responsibleGamingContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className:
|
|
9
|
+
export function ResponsibleGaming({ logo, open, responsibleGamingContent, onCloseAction, ...props }) {
|
|
10
|
+
return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: "Responsible Gaming" }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: responsibleGamingContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className: "w-full", children: _jsx(Button, { type: "button", className: "mt-3", onClick: () => {
|
|
11
11
|
onCloseAction();
|
|
12
12
|
}, children: "I Agree" }) })] }) })] }) }));
|
|
13
13
|
}
|
|
@@ -6,5 +6,6 @@ export interface TermsOfUseProps {
|
|
|
6
6
|
onCloseAction: () => void;
|
|
7
7
|
termsOfUseContent: string | ReactNode;
|
|
8
8
|
siteName: string;
|
|
9
|
+
responsibleGamingLogo?: ImageProps['src'];
|
|
9
10
|
}
|
|
10
|
-
export declare function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, }: TermsOfUseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, ...props }: TermsOfUseProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,9 +8,9 @@ import responsibleGamingLogo from '../../images/responsible-gaming.png';
|
|
|
8
8
|
import { Button } from '../../ui/Button/index.js';
|
|
9
9
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
10
10
|
import { Portal } from '../../ui/Portal/index.js';
|
|
11
|
-
export function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, }) {
|
|
11
|
+
export function TermsOfUse({ logo, open, onCloseAction, siteName, termsOfUseContent, ...props }) {
|
|
12
12
|
const disclaimerStore = useGlobalStore(useShallow((state) => state.disclaimer));
|
|
13
|
-
return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: [siteName, " Terms of Use"] }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: termsOfUseContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className: "w-full", children: _jsx(Button, { type: "button", className: "mt-3", onClick: () => {
|
|
13
|
+
return (_jsx(Dialog.Root, { open: open, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "z-popover" }), _jsx(Dialog.Positioner, { className: "z-popover", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs(Dialog.Title, { className: "text-brand-400 mt-3xl text-center text-lg font-semibold", children: [siteName, " Terms of Use"] }), _jsx(Dialog.Description, { className: "leading-2xl mt-xs text-sm", children: termsOfUseContent }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: props.responsibleGamingLogo ?? responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx("div", { className: "w-full", children: _jsx(Button, { type: "button", className: "mt-3", onClick: () => {
|
|
14
14
|
onCloseAction();
|
|
15
15
|
disclaimerStore.setOpen(true);
|
|
16
16
|
}, children: "I Agree" }) })] }) })] }) }));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import Image from 'next/image';
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { useShallow } from 'zustand/shallow';
|
|
4
5
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
5
6
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
@@ -22,12 +23,18 @@ export function KYC(props) {
|
|
|
22
23
|
const { data: account } = useAccountQuery();
|
|
23
24
|
const { data: verification } = useMemberVerificationQuery();
|
|
24
25
|
const isBasicInfoCompleted = account?.realName !== null && account?.birthDay !== null;
|
|
25
|
-
const isUploadCompleted = verification &&
|
|
26
|
-
|
|
27
|
-
verification
|
|
28
|
-
|
|
29
|
-
const hasMissingData = !isBasicInfoCompleted || !isUploadCompleted ||
|
|
26
|
+
const isUploadCompleted = Boolean(verification?.idFrontImage) && Boolean(verification?.selfieImage);
|
|
27
|
+
const isVerified = Boolean(verification?.status === 'VERIFIED') ||
|
|
28
|
+
Boolean(verification?.status === 'PENDING') ||
|
|
29
|
+
Boolean(verification?.status === 'APPROVED');
|
|
30
|
+
const hasMissingData = !isBasicInfoCompleted || !isUploadCompleted || !isVerified;
|
|
31
|
+
const steps = !isBasicInfoCompleted ? 1 : !isUploadCompleted ? 2 : 3;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (steps) {
|
|
34
|
+
kyc.setStep(steps);
|
|
35
|
+
}
|
|
36
|
+
}, [steps, kyc]);
|
|
30
37
|
return (_jsxs(_Fragment, { children: [_jsx(KYCContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open && hasMissingData, onOpenChange: (details) => {
|
|
31
38
|
globalStore.kyc.setOpen(details.open);
|
|
32
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt lg:min-h-auto mx-auto min-h-full w-full lg:w-fit
|
|
39
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt lg:min-h-auto mx-auto min-h-full w-full overflow-y-auto lg:w-fit", children: [kyc.capturing === 'SELFIE' && _jsx(CaptureSelfie, {}), kyc.capturing === 'ID_DOCUMENT' && _jsx(CaptureIdDocument, {}), !kyc.capturing && (_jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }))] }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
|
|
33
40
|
}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { GoogleAnalytics, GoogleTagManager } from '@next/third-parties/google';
|
|
3
3
|
import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
|
|
4
4
|
import { Suspense } from 'react';
|
|
5
|
+
import { INTERNALS__REPORT_WEB_VITALS } from '../../constants/index.js';
|
|
5
6
|
import { prefetchAccountQuery } from '../../server/utils/prefetchAccountQuery.js';
|
|
6
7
|
import { prefetchPlatformQuery } from '../../server/utils/prefetchPlatformQuery.js';
|
|
7
8
|
import { prefetchSessionQuery } from '../../server/utils/prefetchSessionQuery.js';
|
|
@@ -20,5 +21,5 @@ export async function PortalProvider({ children, facebookPixelId, googleAnalytic
|
|
|
20
21
|
prefetchAccountQuery(),
|
|
21
22
|
prefetchWalletQuery(),
|
|
22
23
|
]);
|
|
23
|
-
return (_jsxs(_Fragment, { children: [_jsx(WebVitals, {}), _jsx(Providers, { children: _jsxs(HydrationBoundary, { state: dehydrate(queryClient), children: [children, _jsx(Suspense, { fallback: null, children: _jsx(SetupDomain, {}) })] }) }), _jsx(Snackbar, {}), facebookPixelId && _jsx(FacebookPixel, { fbId: facebookPixelId }), googleAnalyticsId && _jsx(GoogleAnalytics, { gaId: googleAnalyticsId }), googleTagManagerId && _jsx(GoogleTagManager, { gtmId: googleTagManagerId }), googleRecaptchaSiteKey && (_jsx(GoogleRecaptcha, { siteKey: googleRecaptchaSiteKey }))] }));
|
|
24
|
+
return (_jsxs(_Fragment, { children: [INTERNALS__REPORT_WEB_VITALS && _jsx(WebVitals, {}), _jsx(Providers, { children: _jsxs(HydrationBoundary, { state: dehydrate(queryClient), children: [children, _jsx(Suspense, { fallback: null, children: _jsx(SetupDomain, {}) })] }) }), _jsx(Snackbar, {}), facebookPixelId && _jsx(FacebookPixel, { fbId: facebookPixelId }), googleAnalyticsId && _jsx(GoogleAnalytics, { gaId: googleAnalyticsId }), googleTagManagerId && _jsx(GoogleTagManager, { gtmId: googleTagManagerId }), googleRecaptchaSiteKey && (_jsx(GoogleRecaptcha, { siteKey: googleRecaptchaSiteKey }))] }));
|
|
24
25
|
}
|
|
@@ -12,7 +12,7 @@ export interface SelfieFieldProps extends UseSelfieFieldProps {
|
|
|
12
12
|
readOnly?: boolean;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
required?: boolean;
|
|
15
|
-
onError?: (error: ValidateFileError) => void;
|
|
15
|
+
onError?: (error: ValidateFileError<'FaceNotFoundError'>) => void;
|
|
16
16
|
}
|
|
17
17
|
export declare function SelfieField(props: SelfieFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
interface UseSelfieFieldProps {
|
|
@@ -29,22 +29,39 @@ import { Portal } from '../../ui/Portal/index.js';
|
|
|
29
29
|
import { validateFile } from '../../utils/validateFile.js';
|
|
30
30
|
export function SelfieField(props) {
|
|
31
31
|
const context = useSelfieField(props);
|
|
32
|
-
return (_jsxs(SelfieFieldProvider, { value: context, children: [_jsxs("div", { ref: props.ref, id: props.id, style: props.style, className: twMerge('group', 'border', 'border-border-primary', 'bg-bg-primary', 'relative', 'w-full', 'aspect-[352/180]', 'shrink-0', 'rounded-xl', 'p-xl', props.className), onDragOver: (e) => e.preventDefault(), onDragEnter: (e) => e.preventDefault(), onDragLeave: (e) => e.preventDefault(), onDrop: (e) => {
|
|
32
|
+
return (_jsxs(SelfieFieldProvider, { value: context, children: [_jsxs("div", { ref: props.ref, id: props.id, style: props.style, className: twMerge('group', 'border', 'border-border-primary', 'bg-bg-primary', 'relative', 'w-full', 'aspect-[352/180]', 'shrink-0', 'rounded-xl', 'p-xl', props.className), onDragOver: (e) => e.preventDefault(), onDragEnter: (e) => e.preventDefault(), onDragLeave: (e) => e.preventDefault(), onDrop: async (e) => {
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
const file = e.dataTransfer.files?.[0];
|
|
35
35
|
if (!file)
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
37
|
+
const face = await getFaceFromFile(file);
|
|
38
|
+
const error = validateFile(file, {
|
|
39
|
+
customValidator() {
|
|
40
|
+
if (!face) {
|
|
41
|
+
return {
|
|
42
|
+
name: 'FaceNotFoundError',
|
|
43
|
+
message: 'Please ensure your face is clearly visible in the photo.',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
38
48
|
if (error)
|
|
39
49
|
return props.onError?.(error);
|
|
40
50
|
context.mutation.mutate({ file });
|
|
41
|
-
}, "aria-describedby": context.field?.ariaDescribedby, children: [_jsx("input", { id: context.field?.ids?.control, ref: context.inputRef, type: "file", accept: "image/png, image/jpeg", onChange: (e) => {
|
|
51
|
+
}, "aria-describedby": context.field?.ariaDescribedby, children: [_jsx("input", { id: context.field?.ids?.control, ref: context.inputRef, type: "file", accept: "image/png, image/jpeg", onChange: async (e) => {
|
|
42
52
|
const file = e.target.files?.[0];
|
|
43
53
|
if (!file)
|
|
44
54
|
return;
|
|
45
55
|
const error = validateFile(file);
|
|
46
56
|
if (error)
|
|
47
57
|
return props.onError?.(error);
|
|
58
|
+
const face = await getFaceFromFile(file);
|
|
59
|
+
if (!face) {
|
|
60
|
+
return props.onError?.({
|
|
61
|
+
name: 'FaceNotFoundError',
|
|
62
|
+
message: 'Please ensure your face is clearly visible in the photo.',
|
|
63
|
+
});
|
|
64
|
+
}
|
|
48
65
|
context.mutation.mutate({ file });
|
|
49
66
|
}, disabled: context.field?.disabled ||
|
|
50
67
|
context.query.isLoading ||
|
|
@@ -202,7 +219,6 @@ function useSelfieField(props) {
|
|
|
202
219
|
};
|
|
203
220
|
}
|
|
204
221
|
*/
|
|
205
|
-
return null;
|
|
206
222
|
},
|
|
207
223
|
});
|
|
208
224
|
const disclosure = useDisclosure({
|
package/dist/constants/EnvVar.js
CHANGED
|
@@ -23,3 +23,8 @@ export const BYPASS_RECAPTCHA = z
|
|
|
23
23
|
.transform(Boolean)
|
|
24
24
|
.catch(false)
|
|
25
25
|
.parse(process.env.NEXT_PUBLIC_BYPASS_RECAPTCHA);
|
|
26
|
+
export const INTERNALS__REPORT_WEB_VITALS = z
|
|
27
|
+
.any()
|
|
28
|
+
.transform(Boolean)
|
|
29
|
+
.catch(false)
|
|
30
|
+
.parse(process.env.NEXT_PUBLIC_REPORT_WEB_VITALS);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface ValidateFileOptions {
|
|
1
|
+
export interface ValidateFileOptions<T extends string = never> {
|
|
2
2
|
/**
|
|
3
3
|
* @description Maximum file size in MB.
|
|
4
4
|
* @default 10
|
|
@@ -19,10 +19,11 @@ export interface ValidateFileOptions {
|
|
|
19
19
|
* ]
|
|
20
20
|
*/
|
|
21
21
|
supportedFiles?: string[];
|
|
22
|
+
customValidator?(file: File): ValidateFileError<T> | null | undefined | void;
|
|
22
23
|
}
|
|
23
|
-
export type
|
|
24
|
-
export interface ValidateFileError {
|
|
25
|
-
name:
|
|
24
|
+
export type KnownValidateFileErrorName = 'FileNameTooLongError' | 'FileSizeTooLargeError' | 'FileTypeNotSupportedError';
|
|
25
|
+
export interface ValidateFileError<T extends string = never> {
|
|
26
|
+
name: KnownValidateFileErrorName | T;
|
|
26
27
|
message: string;
|
|
27
28
|
}
|
|
28
|
-
export declare function validateFile(file: File, options?: ValidateFileOptions): ValidateFileError | null;
|
|
29
|
+
export declare function validateFile<T extends string = never>(file: File, options?: ValidateFileOptions<T>): ValidateFileError<T> | null;
|
|
@@ -11,22 +11,27 @@ export function validateFile(file, options) {
|
|
|
11
11
|
];
|
|
12
12
|
if (!supportedFiles.includes(file.type)) {
|
|
13
13
|
return {
|
|
14
|
-
name: '
|
|
14
|
+
name: 'FileTypeNotSupportedError',
|
|
15
15
|
message: 'File type not supported.',
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
if (mb(file.size) > maxFileSize) {
|
|
19
19
|
return {
|
|
20
|
-
name: '
|
|
20
|
+
name: 'FileSizeTooLargeError',
|
|
21
21
|
message: 'File size too large.',
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
if (basename(file.name).length > maxFileName) {
|
|
25
25
|
return {
|
|
26
|
-
name: '
|
|
26
|
+
name: 'FileNameTooLongError',
|
|
27
27
|
message: 'File name is too long.',
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
if (options?.customValidator) {
|
|
31
|
+
const err = options.customValidator(file);
|
|
32
|
+
if (err)
|
|
33
|
+
return err;
|
|
34
|
+
}
|
|
30
35
|
return null;
|
|
31
36
|
}
|
|
32
37
|
function mb(bytes) {
|