@opexa/portal-components 0.0.947 → 0.0.948
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/assets/providers/alize.png +0 -0
- package/dist/assets/providers/bigtime-gaming.png +0 -0
- package/dist/assets/providers/bng.png +0 -0
- package/dist/assets/providers/boongo.png +0 -0
- package/dist/assets/providers/btg.png +0 -0
- package/dist/assets/providers/cq9.png +0 -0
- package/dist/assets/providers/darwin.png +0 -0
- package/dist/assets/providers/digitain.png +0 -0
- package/dist/assets/providers/evolution.png +0 -0
- package/dist/assets/providers/fantasma-games.png +0 -0
- package/dist/assets/providers/fc.png +0 -0
- package/dist/assets/providers/fp.png +0 -0
- package/dist/assets/providers/habanero.png +0 -0
- package/dist/assets/providers/hacksaw.png +0 -0
- package/dist/assets/providers/jdb.png +0 -0
- package/dist/assets/providers/jili.png +0 -0
- package/dist/assets/providers/leap.png +0 -0
- package/dist/assets/providers/live-22-metaverse.png +0 -0
- package/dist/assets/providers/netent.png +0 -0
- package/dist/assets/providers/no-limit.png +0 -0
- package/dist/assets/providers/pg.png +0 -0
- package/dist/assets/providers/pgsoft.png +0 -0
- package/dist/assets/providers/pragmatic-play.png +0 -0
- package/dist/assets/providers/realtime-gaming.png +0 -0
- package/dist/assets/providers/redtiger.png +0 -0
- package/dist/assets/providers/rtg.png +0 -0
- package/dist/assets/providers/sagaming.png +0 -0
- package/dist/client/hooks/useAiOGCashDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useAiOGCashDepositMutation.js +90 -0
- package/dist/client/hooks/useAiOGrabPayDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useAiOGrabPayDepositMutation.js +80 -0
- package/dist/client/hooks/useAiOPalawanPayDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useAiOPalawanPayDepositMutation.js +80 -0
- package/dist/client/hooks/useAiOPayMayaDepositMutation.d.ts +4 -0
- package/dist/client/hooks/useAiOPayMayaDepositMutation.js +80 -0
- package/dist/components/Banner/Banner.client.d.ts +12 -0
- package/dist/components/Banner/Banner.client.js +49 -0
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +11 -0
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +55 -0
- package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js +21 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +99 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +17 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +116 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.d.ts +3 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.js +69 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.js +10 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.js +99 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +25 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.js +2 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.js +17 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.js +116 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.d.ts +3 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.js +69 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +13 -0
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.js +85 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.js +173 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.js +171 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +171 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.js +171 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.d.ts +8 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.js +33 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.js +120 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.js +163 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.js +165 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.js +186 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.js +157 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.js +163 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.js +166 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.js +10 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.js +99 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +25 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.js +2 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.js +19 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.js +115 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +13 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.js +81 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.js +180 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.js +10 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.js +99 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +25 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.js +2 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.js +17 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.js +116 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.d.ts +3 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.js +69 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +13 -0
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.js +85 -0
- package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
- package/dist/components/DigitainLauncher/Loading.js +5 -0
- package/dist/components/Disclaimer/DisclaimerV3.js +2 -2
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
- package/dist/components/KYC/BasicInformation.d.ts +1 -0
- package/dist/components/KYC/BasicInformation.js +101 -0
- package/dist/components/KYC/IdentityVerification.d.ts +1 -0
- package/dist/components/KYC/IdentityVerification.js +120 -0
- package/dist/components/KYC/Indicator.d.ts +1 -0
- package/dist/components/KYC/Indicator.js +8 -0
- package/dist/components/KYC/KYC.lazy.d.ts +6 -0
- package/dist/components/KYC/KYC.lazy.js +45 -0
- package/dist/components/KYC/KYCContext.d.ts +6 -0
- package/dist/components/KYC/KYCContext.js +2 -0
- package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +1 -0
- package/dist/components/KYC/KYCDefault/BasicInformation.js +101 -0
- package/dist/components/KYC/KYCVerificationStatus.d.ts +1 -0
- package/dist/components/KYC/KYCVerificationStatus.js +10 -0
- package/dist/components/KYC/KYCVerificationStatus.lazy.d.ts +1 -0
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +36 -0
- package/dist/components/KYC/PersonalInformation.d.ts +1 -0
- package/dist/components/KYC/PersonalInformation.js +122 -0
- package/dist/components/KYC/useKYC.d.ts +25 -0
- package/dist/components/KYC/useKYC.js +38 -0
- package/dist/components/KYCNotRequired/KYCNotRequired.d.ts +0 -0
- package/dist/components/KYCNotRequired/KYCNotRequired.js +1 -0
- package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +1 -0
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +12 -0
- package/dist/components/PortalProvider/CXDTokenObserver.d.ts +1 -0
- package/dist/components/PortalProvider/CXDTokenObserver.js +30 -0
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +1 -0
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +29 -0
- package/dist/components/Quests/MultiWageringQuest.d.ts +1 -0
- package/dist/components/Quests/MultiWageringQuest.js +111 -0
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +1 -0
- package/dist/components/SessionWatcher/SessionWatcher.js +20 -0
- package/dist/components/SessionWatcher/index.d.ts +1 -0
- package/dist/components/SessionWatcher/index.js +1 -0
- package/dist/components/SignIn/utils.d.ts +8 -0
- package/dist/components/SignIn/utils.js +26 -0
- package/dist/components/SingleSignOn/SingleSignOn.d.ts +1 -1
- package/dist/components/SingleSignOn/SingleSignOn.js +7 -15
- package/dist/constants/Branches.d.ts +2 -0
- package/dist/constants/Branches.js +42 -0
- package/dist/handlers/index.d.ts +2 -2
- package/dist/images/game-providers/ALPHACHINKO.png +0 -0
- package/dist/images/responsible-gaming-yellow.png +0 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +1 -0
- package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
- package/dist/third-parties/FacebookPixel/index.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
- package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
- package/dist/third-parties/index.d.ts +2 -0
- package/dist/third-parties/index.js +2 -0
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/utils/getLocaleInfo.d.ts +79 -0
- package/dist/utils/getLocaleInfo.js +175 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const OnlineBankDepositContext: (props: {
|
|
2
|
+
value: {
|
|
3
|
+
view: "form" | "vca";
|
|
4
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
|
+
verify: () => void;
|
|
6
|
+
reset: () => void;
|
|
7
|
+
deposit: import("../../../../types").Deposit | null;
|
|
8
|
+
generateVCA: (input: {
|
|
9
|
+
amount: string;
|
|
10
|
+
promo?: string | null;
|
|
11
|
+
}) => void;
|
|
12
|
+
};
|
|
13
|
+
} & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
}) => React.ReactNode, useOnlineBankDepositContext: () => {
|
|
16
|
+
view: "form" | "vca";
|
|
17
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
|
+
verify: () => void;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
deposit: import("../../../../types").Deposit | null;
|
|
21
|
+
generateVCA: (input: {
|
|
22
|
+
amount: string;
|
|
23
|
+
promo?: string | null;
|
|
24
|
+
}) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnlineBankDepositDetails(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { BankIcon } from '../../../../icons/BankIcon.js';
|
|
4
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
5
|
+
import bankIcon from '../../../../images/bank-icon.png';
|
|
6
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
7
|
+
import { Clipboard } from '../../../../ui/Clipboard/index.js';
|
|
8
|
+
import { Dialog } from '../../../../ui/Dialog/index.js';
|
|
9
|
+
import { Portal } from '../../../../ui/Portal/index.js';
|
|
10
|
+
import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
11
|
+
export function OnlineBankDepositDetails() {
|
|
12
|
+
const context = useOnlineBankDepositContext();
|
|
13
|
+
if (context.view !== 'vca')
|
|
14
|
+
return null;
|
|
15
|
+
return (_jsxs("div", { className: "rounded-lg bg-bg-primary-alt p-2xl", children: [_jsx(Image, { src: bankIcon, alt: "", width: 52, height: 44.2, className: "mx-auto h-auto w-[3.25rem]" }), _jsx("p", { className: "mt-8 text-center font-semibold", children: "Your unique Virtual Collection Account (VCA) is:" }), _jsx(Clipboard.Root, { value: context.deposit?.vca ?? '', className: "mx-auto mt-6 max-w-[22.5rem]", children: _jsxs(Clipboard.Control, { className: "flex flex-col gap-4 lg:flex-row", children: [_jsx(Clipboard.Input, { className: "lg:grow" }), _jsx(Clipboard.Context, { children: (ctx) => (_jsx(Clipboard.Trigger, { asChild: true, children: _jsx(Button, { fullWidth: false, className: "w-full shrink-0 lg:w-28", children: ctx.copied ? 'Copied' : 'Copy VCA' }) })) })] }) }), _jsx(Instruction, {})] }));
|
|
16
|
+
}
|
|
17
|
+
function Instruction() {
|
|
18
|
+
return (_jsxs("p", { className: "mt-6 text-center text-text-tertiary-600 text-xs", children: ["Need help using the online bank for payment?", ' ', _jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(Dialog.Trigger, { className: "text-text-warning-primary-600", children: "See instructions" }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto w-[calc(100%-2rem)] overflow-y-auto rounded-lg p-4xl lg:w-[33.625rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(Dialog.Body, { children: [_jsxs("div", { className: "flex items-center gap-xl", children: [_jsx("div", { className: "flex size-11 items-center justify-center rounded-lg border border-border-primary text-gray-700 text-text-secondary-700 shadow-xs", children: _jsx(BankIcon, { className: "size-6" }) }), _jsx(Dialog.Title, { className: "font-semibold text-lg", children: "How to Use Online Bank for Payment" })] }), _jsx(Dialog.Description, { className: "mt-5", children: "Follow these simple steps to complete your transaction:" }), _jsxs("ol", { className: "mt-3 list-inside list-decimal space-y-3", children: [_jsx("li", { children: "Click the 'Copy VCA' button to save your unique account number." }), _jsx("li", { children: "Log in to your Online Banking: Open your bank's app or website." }), _jsx("li", { children: "Initiate a Deposit: Choose the option to make a deposit." }), _jsx("li", { children: "Enter VCA: Paste your VCA in the designated field." }), _jsx("li", { children: "Complete Transaction: Follow your bank's prompts to finalize the deposit." })] }), _jsx("p", { className: "mt-3", children: "Note: Please ensure that the deposit amount you enter matches exactly." })] })] }) })] })] })] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function OnlineBankDepositForm(): import("react/jsx-runtime").JSX.Element | null;
|
package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
+
import { noop } from 'lodash-es';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { useShallow } from 'zustand/shallow';
|
|
9
|
+
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
10
|
+
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
11
|
+
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
12
|
+
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
13
|
+
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
14
|
+
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
15
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
16
|
+
import { Field } from '../../../../ui/Field/index.js';
|
|
17
|
+
import { NumberInput } from '../../../../ui/NumberInput/index.js';
|
|
18
|
+
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
19
|
+
import { AmountChoices } from '../../AmountChoices.js';
|
|
20
|
+
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
21
|
+
import { AvailablePromos } from '../AvailablePromos.js';
|
|
22
|
+
import { useOnlineBankDepositContext } from './OnlineBankDepositContext.js';
|
|
23
|
+
export function OnlineBankDepositForm() {
|
|
24
|
+
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
25
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
26
|
+
depositWithdrawal: ctx.depositWithdrawal,
|
|
27
|
+
})));
|
|
28
|
+
const context = useOnlineBankDepositContext();
|
|
29
|
+
const depositsCountQuery = useDepositsCountQuery();
|
|
30
|
+
const depositsCount = depositsCountQuery.data ?? 0;
|
|
31
|
+
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
32
|
+
const paymentSettings = paymentSettingsQuery.data;
|
|
33
|
+
const gatewaySettings = paymentSettings?.onlineBankDepositGatewaySettings;
|
|
34
|
+
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
35
|
+
const minimumAmount = depositsCount <= 0
|
|
36
|
+
? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
|
|
37
|
+
: parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
38
|
+
const promosQuery = useAvailablePromosQuery();
|
|
39
|
+
const promos = promosQuery.data ?? [];
|
|
40
|
+
const definition = z
|
|
41
|
+
.object({
|
|
42
|
+
amount: z.string().superRefine((val, ctx) => {
|
|
43
|
+
const n = parseDecimal(val, 0);
|
|
44
|
+
if (n < minimumAmount) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
type: 'number',
|
|
47
|
+
code: z.ZodIssueCode.too_small,
|
|
48
|
+
inclusive: true,
|
|
49
|
+
minimum: minimumAmount,
|
|
50
|
+
message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (n > maximumAmount) {
|
|
54
|
+
ctx.addIssue({
|
|
55
|
+
type: 'number',
|
|
56
|
+
code: z.ZodIssueCode.too_big,
|
|
57
|
+
inclusive: true,
|
|
58
|
+
maximum: maximumAmount,
|
|
59
|
+
message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
promo: z.string().optional().nullable(),
|
|
64
|
+
})
|
|
65
|
+
.superRefine((value, ctx) => {
|
|
66
|
+
const promo = promos.find((o) => o.id === value.promo);
|
|
67
|
+
const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
|
|
68
|
+
const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
|
|
69
|
+
const amount = parseDecimal(value.amount, 0);
|
|
70
|
+
if (promo && amount < promoMinAmount) {
|
|
71
|
+
ctx.addIssue({
|
|
72
|
+
path: ['amount'],
|
|
73
|
+
code: z.ZodIssueCode.custom,
|
|
74
|
+
message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (promo && amount > promoMaxAmount) {
|
|
78
|
+
ctx.addIssue({
|
|
79
|
+
path: ['amount'],
|
|
80
|
+
code: z.ZodIssueCode.custom,
|
|
81
|
+
message: `Maximum amount for this promo is ${promoMaxAmount}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const form = useForm({
|
|
86
|
+
mode: 'all',
|
|
87
|
+
resolver: zodResolver(definition),
|
|
88
|
+
defaultValues: {
|
|
89
|
+
amount: '0',
|
|
90
|
+
promo: globalStore.depositWithdrawal.promo ?? null,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (minimumAmount) {
|
|
95
|
+
form.reset({
|
|
96
|
+
amount: minimumAmount.toString(),
|
|
97
|
+
promo: form.getValues('promo') ?? null,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}, [form, minimumAmount]);
|
|
101
|
+
if (context.view !== 'form')
|
|
102
|
+
return null;
|
|
103
|
+
return (_jsxs("form", { onSubmit: form.handleSubmit(context.generateVCA), noValidate: true, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Bank" }), _jsx(Field.Input, { value: "BANKNET", onChange: noop, readOnly: true })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
104
|
+
o.field.onChange(details.value);
|
|
105
|
+
}, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to deposit" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
|
|
106
|
+
form.setValue('amount', value.toString(), {
|
|
107
|
+
shouldTouch: true,
|
|
108
|
+
shouldDirty: true,
|
|
109
|
+
shouldValidate: true,
|
|
110
|
+
});
|
|
111
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-3xl", value: o.field.value, onChange: (value) => {
|
|
112
|
+
o.field.onChange(value);
|
|
113
|
+
globalStore.depositWithdrawal.setPromo(null);
|
|
114
|
+
} })) }), _jsx(Button, { type: "submit", className: "mt-3xl", children: "Deposit" }), depositWithdrawalProps.hasPrivacyPolicyAndTermsOfUse && (_jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }))] }));
|
|
115
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Deposit } from '../../../../types';
|
|
2
|
+
export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
|
|
3
|
+
export declare function useOnlineBankDeposit(): {
|
|
4
|
+
view: "form" | "vca";
|
|
5
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
|
+
verify: () => void;
|
|
7
|
+
reset: () => void;
|
|
8
|
+
deposit: Deposit | null;
|
|
9
|
+
generateVCA: (input: {
|
|
10
|
+
amount: string;
|
|
11
|
+
promo?: string | null;
|
|
12
|
+
}) => void;
|
|
13
|
+
};
|
package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
import { useShallow } from 'zustand/shallow';
|
|
4
|
+
import { useCreateOnlineBankDepositMutation } from '../../../../client/hooks/useCreateOnlineBankDepositMutation.js';
|
|
5
|
+
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
6
|
+
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
7
|
+
import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
|
|
8
|
+
export function useOnlineBankDeposit() {
|
|
9
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
10
|
+
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
11
|
+
})));
|
|
12
|
+
const verificationQuery = useMemberVerificationQuery();
|
|
13
|
+
const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
|
|
14
|
+
const [deposit, setDeposit] = useState(null);
|
|
15
|
+
const [status, setStatus] = useState('waiting');
|
|
16
|
+
const view = status === 'verification-failed' ||
|
|
17
|
+
status === 'verification-waiting' ||
|
|
18
|
+
status === 'verification-success' ||
|
|
19
|
+
status === 'verification-processing'
|
|
20
|
+
? 'vca'
|
|
21
|
+
: 'form';
|
|
22
|
+
const mutation = useCreateOnlineBankDepositMutation({
|
|
23
|
+
onMutate() {
|
|
24
|
+
setStatus('processing');
|
|
25
|
+
},
|
|
26
|
+
onSuccess(data) {
|
|
27
|
+
invariant(data.vca);
|
|
28
|
+
setStatus('verification-waiting');
|
|
29
|
+
setDeposit(data);
|
|
30
|
+
},
|
|
31
|
+
onError() {
|
|
32
|
+
setStatus('failed');
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
const generateVCA = (input) => {
|
|
36
|
+
//handle new kyc process
|
|
37
|
+
if (verificationStatus === 'PENDING' ||
|
|
38
|
+
verificationStatus === 'UNVERIFIED' ||
|
|
39
|
+
verificationStatus === 'REJECTED' ||
|
|
40
|
+
verificationStatus === 'CREATED') {
|
|
41
|
+
globalStore.kycVerificationStatus.setOpen(true);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
mutation.mutate({
|
|
46
|
+
amount: input.amount,
|
|
47
|
+
promo: input.promo ?? undefined,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const query = useDepositQuery(deposit?.id, {
|
|
52
|
+
enabled: !!deposit,
|
|
53
|
+
refetchInterval: 5000,
|
|
54
|
+
});
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (query.data?.status === 'APPROVED' ||
|
|
57
|
+
query.data?.status === 'CONFIRMED') {
|
|
58
|
+
setStatus('verification-success');
|
|
59
|
+
}
|
|
60
|
+
if (query.data?.status === 'CANCELLED' ||
|
|
61
|
+
query.data?.status === 'REJECTED' ||
|
|
62
|
+
query.data?.status === 'FAILED') {
|
|
63
|
+
setStatus('verification-failed');
|
|
64
|
+
}
|
|
65
|
+
}, [query.data?.status]);
|
|
66
|
+
const reset = () => {
|
|
67
|
+
setDeposit(null);
|
|
68
|
+
setStatus('waiting');
|
|
69
|
+
};
|
|
70
|
+
const verify = () => {
|
|
71
|
+
setStatus('verification-processing');
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
view,
|
|
75
|
+
status,
|
|
76
|
+
verify,
|
|
77
|
+
reset,
|
|
78
|
+
deposit,
|
|
79
|
+
generateVCA,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function PisoPayDeposit(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
+
import { ObjectId } from '@opexa/object-id';
|
|
4
|
+
import Link from 'next/link';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
7
|
+
import invariant from 'tiny-invariant';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { useShallow } from 'zustand/shallow';
|
|
10
|
+
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
11
|
+
import { useCreatePisoPayDepositMutation } from '../../../../client/hooks/useCreatePisoPayDepositMutation.js';
|
|
12
|
+
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
13
|
+
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
14
|
+
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
15
|
+
import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
|
|
16
|
+
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
17
|
+
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
18
|
+
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
19
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
20
|
+
import { ObjectType } from '../../../../services/ObjectType.js';
|
|
21
|
+
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
22
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
23
|
+
import { Field } from '../../../../ui/Field/index.js';
|
|
24
|
+
import { Portal } from '../../../../ui/Portal/index.js';
|
|
25
|
+
import { getQueryClient } from '../../../../utils/getQueryClient.js';
|
|
26
|
+
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
27
|
+
import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
|
|
28
|
+
import { AmountChoices } from '../../AmountChoices.js';
|
|
29
|
+
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
30
|
+
import { explainError } from '../../utils.js';
|
|
31
|
+
import { AvailablePromos } from '../AvailablePromos.js';
|
|
32
|
+
export function PisoPayDeposit() {
|
|
33
|
+
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
34
|
+
const disclosure = useDisclosure();
|
|
35
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
36
|
+
depositWithdrawal: ctx.depositWithdrawal,
|
|
37
|
+
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
38
|
+
})));
|
|
39
|
+
const verificationQuery = useMemberVerificationQuery();
|
|
40
|
+
const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
|
|
41
|
+
const [status, setStatus] = useState('waiting');
|
|
42
|
+
const createDepositMutation = useCreatePisoPayDepositMutation({
|
|
43
|
+
onMutate() {
|
|
44
|
+
disclosure.setOpen(true);
|
|
45
|
+
setStatus('processing');
|
|
46
|
+
},
|
|
47
|
+
onSuccess(data) {
|
|
48
|
+
const queryClient = getQueryClient();
|
|
49
|
+
invariant(data.checkoutUrl);
|
|
50
|
+
window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
|
|
51
|
+
queryClient.invalidateQueries({ queryKey: getDepositsCountQueryKey() });
|
|
52
|
+
setStatus('success');
|
|
53
|
+
},
|
|
54
|
+
onError() {
|
|
55
|
+
setStatus('failed');
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const depositsCountQuery = useDepositsCountQuery();
|
|
59
|
+
const depositsCount = depositsCountQuery.data ?? 0;
|
|
60
|
+
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
61
|
+
const paymentSettings = paymentSettingsQuery.data;
|
|
62
|
+
const gatewaySettings = paymentSettings?.pisoPayDepositGatewaySettings;
|
|
63
|
+
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
64
|
+
const minimumAmount = depositsCount <= 0
|
|
65
|
+
? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
|
|
66
|
+
: parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
67
|
+
const promosQuery = useAvailablePromosQuery();
|
|
68
|
+
const promos = promosQuery.data ?? [];
|
|
69
|
+
const definition = z
|
|
70
|
+
.object({
|
|
71
|
+
amount: z.string().superRefine((val, ctx) => {
|
|
72
|
+
const n = parseDecimal(val, 0);
|
|
73
|
+
if (val.includes('.')) {
|
|
74
|
+
ctx.addIssue({
|
|
75
|
+
code: z.ZodIssueCode.custom,
|
|
76
|
+
message: 'Amount must be a whole number',
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (n < minimumAmount) {
|
|
81
|
+
ctx.addIssue({
|
|
82
|
+
type: 'number',
|
|
83
|
+
code: z.ZodIssueCode.too_small,
|
|
84
|
+
inclusive: true,
|
|
85
|
+
minimum: minimumAmount,
|
|
86
|
+
message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (n > maximumAmount) {
|
|
90
|
+
ctx.addIssue({
|
|
91
|
+
type: 'number',
|
|
92
|
+
code: z.ZodIssueCode.too_big,
|
|
93
|
+
inclusive: true,
|
|
94
|
+
maximum: maximumAmount,
|
|
95
|
+
message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
promo: z.string().optional().nullable(),
|
|
100
|
+
})
|
|
101
|
+
.superRefine((value, ctx) => {
|
|
102
|
+
const promo = promos.find((o) => o.id === value.promo);
|
|
103
|
+
const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
|
|
104
|
+
const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
|
|
105
|
+
const amount = parseDecimal(value.amount, 0);
|
|
106
|
+
if (promo && amount < promoMinAmount) {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
path: ['amount'],
|
|
109
|
+
code: z.ZodIssueCode.custom,
|
|
110
|
+
message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (promo && amount > promoMaxAmount) {
|
|
114
|
+
ctx.addIssue({
|
|
115
|
+
path: ['amount'],
|
|
116
|
+
code: z.ZodIssueCode.custom,
|
|
117
|
+
message: `Maximum amount for this promo is ${promoMaxAmount}`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const form = useForm({
|
|
122
|
+
mode: 'all',
|
|
123
|
+
resolver: zodResolver(definition),
|
|
124
|
+
defaultValues: {
|
|
125
|
+
amount: '0',
|
|
126
|
+
promo: globalStore.depositWithdrawal.promo ?? null,
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (minimumAmount) {
|
|
131
|
+
form.reset({
|
|
132
|
+
amount: minimumAmount.toString(),
|
|
133
|
+
promo: form.getValues('promo') ?? null,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, [form, minimumAmount]);
|
|
137
|
+
return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
|
|
138
|
+
if (verificationStatus === 'PENDING' ||
|
|
139
|
+
verificationStatus === 'UNVERIFIED' ||
|
|
140
|
+
verificationStatus === 'REJECTED' ||
|
|
141
|
+
verificationStatus === 'CREATED') {
|
|
142
|
+
globalStore.kycVerificationStatus.setOpen(true);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
const id = ObjectId.generate(ObjectType.Deposit).toString();
|
|
147
|
+
const domain = window.location.hostname === 'localhost'
|
|
148
|
+
? 'https://opexa.io'
|
|
149
|
+
: window.location.origin;
|
|
150
|
+
createDepositMutation.reset();
|
|
151
|
+
createDepositMutation.mutate({
|
|
152
|
+
id,
|
|
153
|
+
amount: data.amount.toString(),
|
|
154
|
+
redirectionUrl: `${domain}`,
|
|
155
|
+
...(data.promo && {
|
|
156
|
+
promo: data.promo,
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Enter the amount you want to deposit" }), _jsx(Field.Input, { type: "number", ...form.register('amount') }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount').trim().replace(/,/g, ''), 0), onChange: (value) => {
|
|
161
|
+
form.setValue('amount', value.toString(), {
|
|
162
|
+
shouldTouch: true,
|
|
163
|
+
shouldDirty: true,
|
|
164
|
+
shouldValidate: true,
|
|
165
|
+
});
|
|
166
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
|
|
167
|
+
o.field.onChange(value);
|
|
168
|
+
globalStore.depositWithdrawal.setPromo(null);
|
|
169
|
+
}, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), depositWithdrawalProps.hasPrivacyPolicyAndTermsOfUse && (_jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["By depositing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] })), _jsx(AlertDialog.Root, { open: disclosure.open, onOpenChange: (details) => {
|
|
170
|
+
disclosure.setOpen(details.open);
|
|
171
|
+
if (!details.open) {
|
|
172
|
+
setStatus('waiting');
|
|
173
|
+
form.reset();
|
|
174
|
+
}
|
|
175
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
176
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' && (_jsxs(_Fragment, { children: ["Your deposit has been successfully processed. ", _jsx("br", {}), " If you are not redirected automatically, click", ' ', !!createDepositMutation.data?.checkoutUrl && (_jsx("a", { href: createDepositMutation.data?.checkoutUrl, target: "_blank", rel: "noopener noreferrer", className: "text-text-brand underline underline-offset-2", children: "here" })), "."] })), status === 'failed' &&
|
|
177
|
+
explainError(createDepositMutation?.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
178
|
+
api.setOpen(false);
|
|
179
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QRPHDeposit(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QRPHDepositAlert } from './QRPHDepositAlert.js';
|
|
3
|
+
import { QRPHDepositContext } from './QRPHDepositContext.js';
|
|
4
|
+
import { QRPHDepositDetails } from './QRPHDepositDetails.js';
|
|
5
|
+
import { QRPHDepositForm } from './QRPHDepositForm.js';
|
|
6
|
+
import { useQRPHDeposit } from './useQRPHDeposit.js';
|
|
7
|
+
export function QRPHDeposit() {
|
|
8
|
+
const context = useQRPHDeposit();
|
|
9
|
+
return (_jsxs(QRPHDepositContext, { value: context, children: [_jsx(QRPHDepositForm, {}), _jsx(QRPHDepositDetails, {}), _jsx(QRPHDepositAlert, {})] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QRPHDepositAlert(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
3
|
+
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
4
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
5
|
+
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
6
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
7
|
+
import { Portal } from '../../../../ui/Portal/index.js';
|
|
8
|
+
import { useQRPHDepositContext } from './QRPHDepositContext.js';
|
|
9
|
+
export function QRPHDepositAlert() {
|
|
10
|
+
const context = useQRPHDepositContext();
|
|
11
|
+
const details = useDetails();
|
|
12
|
+
return (_jsx(AlertDialog.Root, { open: context.status !== 'waiting' &&
|
|
13
|
+
context.status !== 'verification-waiting', onOpenChange: (details) => {
|
|
14
|
+
if (!details.open) {
|
|
15
|
+
context.reset();
|
|
16
|
+
}
|
|
17
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: details.type === 'loading', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [details.type === 'loading' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), details.type === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), details.type === 'erorr' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: details.title }), _jsx(AlertDialog.Description, { children: details.description })] }), (details.type === 'erorr' || details.type === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
18
|
+
api.setOpen(false);
|
|
19
|
+
}, children: details.type === 'success' ? 'Ok' : 'Try Again' })) }) }))] }) })] }) }));
|
|
20
|
+
}
|
|
21
|
+
function useDetails() {
|
|
22
|
+
const context = useQRPHDepositContext();
|
|
23
|
+
const title = (() => {
|
|
24
|
+
let s = '';
|
|
25
|
+
if (context.status === 'processing') {
|
|
26
|
+
s = 'Processing Deposit';
|
|
27
|
+
}
|
|
28
|
+
else if (context.status === 'failed') {
|
|
29
|
+
s = 'Deposit Failed';
|
|
30
|
+
}
|
|
31
|
+
else if (context.status === 'verification-success') {
|
|
32
|
+
s = 'Deposit Successful';
|
|
33
|
+
}
|
|
34
|
+
else if (context.status === 'verification-processing') {
|
|
35
|
+
s = 'Verifying Deposit';
|
|
36
|
+
}
|
|
37
|
+
else if (context.status === 'verification-failed') {
|
|
38
|
+
if (context.deposit?.status === 'CANCELLED') {
|
|
39
|
+
s = 'Deposit Cancelled';
|
|
40
|
+
}
|
|
41
|
+
else if (context.deposit?.status === 'REJECTED') {
|
|
42
|
+
s = 'Deposit Rejected';
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
s = 'Deposit Failed';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return s;
|
|
49
|
+
})();
|
|
50
|
+
const description = (() => {
|
|
51
|
+
let d = '';
|
|
52
|
+
if (context.status === 'processing') {
|
|
53
|
+
d = "We're verifying your account and amount. Please hold a moment.";
|
|
54
|
+
}
|
|
55
|
+
else if (context.status === 'failed') {
|
|
56
|
+
d =
|
|
57
|
+
'Something went wrong while processing your deposit. ' +
|
|
58
|
+
'Please try again or contact support.';
|
|
59
|
+
}
|
|
60
|
+
else if (context.status === 'verification-success') {
|
|
61
|
+
d = 'Your deposit has been successfully processed.';
|
|
62
|
+
}
|
|
63
|
+
else if (context.status === 'verification-processing') {
|
|
64
|
+
d = 'Your deposit is being processed.';
|
|
65
|
+
}
|
|
66
|
+
else if (context.status === 'verification-failed') {
|
|
67
|
+
if (context.deposit?.status === 'CANCELLED') {
|
|
68
|
+
d = 'Your deposit has been cancelled.';
|
|
69
|
+
}
|
|
70
|
+
else if (context.deposit?.status === 'REJECTED') {
|
|
71
|
+
d = 'Your deposit has been rejected.';
|
|
72
|
+
}
|
|
73
|
+
else if (context.deposit?.status === 'FAILED') {
|
|
74
|
+
d = context.deposit.error ?? 'Your deposit has failed.';
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
d =
|
|
78
|
+
'Something went wrong while processing your deposit. ' +
|
|
79
|
+
'Please try again or contact support.';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return d;
|
|
83
|
+
})();
|
|
84
|
+
const type = (() => {
|
|
85
|
+
if (context.status === 'failed' ||
|
|
86
|
+
context.status === 'verification-failed') {
|
|
87
|
+
return 'erorr';
|
|
88
|
+
}
|
|
89
|
+
if (context.status === 'verification-success') {
|
|
90
|
+
return 'success';
|
|
91
|
+
}
|
|
92
|
+
return 'loading';
|
|
93
|
+
})();
|
|
94
|
+
return {
|
|
95
|
+
type,
|
|
96
|
+
title,
|
|
97
|
+
description,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const QRPHDepositContext: (props: {
|
|
2
|
+
value: {
|
|
3
|
+
view: "form" | "qrCode";
|
|
4
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
|
+
verify: () => void;
|
|
6
|
+
reset: () => void;
|
|
7
|
+
deposit: import("../../../../types").Deposit | null;
|
|
8
|
+
generateQRCode: (input: {
|
|
9
|
+
amount: string;
|
|
10
|
+
promo?: string | null;
|
|
11
|
+
}) => void;
|
|
12
|
+
};
|
|
13
|
+
} & {
|
|
14
|
+
children?: import("react").ReactNode | undefined;
|
|
15
|
+
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
+
view: "form" | "qrCode";
|
|
17
|
+
status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
|
+
verify: () => void;
|
|
19
|
+
reset: () => void;
|
|
20
|
+
deposit: import("../../../../types").Deposit | null;
|
|
21
|
+
generateQRCode: (input: {
|
|
22
|
+
amount: string;
|
|
23
|
+
promo?: string | null;
|
|
24
|
+
}) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QRPHDepositDetails(): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QrCode02Icon } from '../../../../icons/QrCode02Icon.js';
|
|
3
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
4
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
5
|
+
import { Dialog } from '../../../../ui/Dialog/index.js';
|
|
6
|
+
import { Portal } from '../../../../ui/Portal/index.js';
|
|
7
|
+
import { useQRPHDepositContext } from './QRPHDepositContext.js';
|
|
8
|
+
import { QRPHQRCode } from './QRPHQRCode.js';
|
|
9
|
+
export function QRPHDepositDetails() {
|
|
10
|
+
const context = useQRPHDepositContext();
|
|
11
|
+
if (context.view !== 'qrCode')
|
|
12
|
+
return null;
|
|
13
|
+
return (_jsxs("div", { className: "rounded-lg bg-bg-primary-alt p-2xl", children: [_jsx("p", { className: "text-center font-semibold text-lg lg:text-xl", children: "QR Code" }), _jsx("p", { className: "mt-3 text-center text-sm text-text-secondary-700 lg:text-base", children: "Scan the QR code below with your banking app, or upload it to complete your deposit." }), _jsx(QRPHQRCode, { qrCodeString: context.deposit?.qrCode ?? '' }), _jsx("div", { className: "mt-6 flex flex-col gap-4 lg:flex-row", children: _jsx(Button, { size: "sm", variant: "outline", colorScheme: "gray", onClick: context.reset, children: "Generate New QR Code" }) }), _jsx(Instruction, {})] }));
|
|
14
|
+
}
|
|
15
|
+
function Instruction() {
|
|
16
|
+
return (_jsxs("p", { className: "mt-6 text-center text-text-tertiary-600 text-xs", children: ["Need help using the QR Code?", ' ', _jsxs(Dialog.Root, { lazyMount: true, unmountOnExit: true, children: [_jsx(Dialog.Trigger, { className: "text-text-warning-primary-600", children: "See instructions" }), _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto w-[calc(100%-2rem)] overflow-y-auto rounded-lg p-4xl lg:w-[33.625rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(Dialog.Body, { children: [_jsxs("div", { className: "flex items-center gap-xl", children: [_jsx("div", { className: "flex size-11 items-center justify-center rounded-lg border border-border-primary text-gray-700 text-text-secondary-700 shadow-xs", children: _jsx(QrCode02Icon, { className: "size-6" }) }), _jsx(Dialog.Title, { className: "font-semibold text-lg", children: "How to Use the QR Code for Payment" })] }), _jsx(Dialog.Description, { className: "mt-5", children: "Follow these simple steps to complete your transaction:" }), _jsxs("ol", { className: "mt-3 list-inside list-decimal space-y-3", children: [_jsx("li", { children: "Open your preferred banking or EMI mobile app and select 'Transfer Money' or 'Pay via QR'" }), _jsx("li", { children: "Scan or upload the generated QR Ph code. If prompted by the app, enter the amount to be sent." }), _jsx("li", { children: "Proceed with the transfer or payment." })] })] })] }) })] })] })] }));
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function QRPHDepositForm(): import("react/jsx-runtime").JSX.Element | null;
|