@opexa/portal-components 0.0.808 → 0.0.810
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/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/AiOGCashDeposit/AiOGCashDeposit.js +54 -10
- package/dist/components/DepositWithdrawal/Deposit/AiOGrabPayDeposit/AiOGrabPayDeposit.js +54 -10
- package/dist/components/DepositWithdrawal/Deposit/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +54 -10
- package/dist/components/DepositWithdrawal/Deposit/AiOPayMayaDeposit/AiOPayMayaDeposit.js +54 -10
- package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +54 -9
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit/GCashWebpayDeposit.js +54 -9
- package/dist/components/DepositWithdrawal/Deposit/LibanganDeposit/LibanganDeposit.js +49 -25
- package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +54 -9
- package/dist/components/DepositWithdrawal/Deposit/MayaWebpayDeposit/MayaWebpayDeposit.js +54 -9
- package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.js +54 -10
- package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.js +2 -5
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOGCashDeposit/AiOGCashDeposit.js +10 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOGrabPayDeposit/AiOGrabPayDeposit.js +10 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +10 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOPayMayaDeposit/AiOPayMayaDeposit.js +10 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/GCashDeposit/GCashDeposit.js +9 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/GCashWebpayDeposit/GCashWebpayDeposit.js +9 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/LibanganDeposit/LibanganDeposit.js +25 -49
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaDeposit/MayaDeposit.js +9 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaWebpayDeposit/MayaWebpayDeposit.js +9 -54
- package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/PisoPayDeposit/PisoPayDeposit.js +10 -54
- package/dist/components/DepositWithdrawal/HasPendingBonuses.d.ts +2 -2
- package/dist/components/DepositWithdrawal/HasPendingBonuses.js +1 -2
- package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
- package/dist/components/DigitainLauncher/Loading.js +5 -0
- package/dist/components/DigitainLauncher/utils.js +1 -1
- 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/constants/Branches.d.ts +2 -0
- package/dist/constants/Branches.js +42 -0
- 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/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Avatar/Avatar.d.ts +9 -9
- package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +144 -144
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +154 -154
- package/dist/ui/Popover/popover.recipe.d.ts +14 -14
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
- package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
- package/package.json +1 -1
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOGCashDeposit/AiOGCashDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOGrabPayDeposit/AiOGrabPayDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOPalawanPayDeposit/AiOPalawanPayDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AiOPayMayaDeposit/AiOPayMayaDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AvailablePromos.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/AvailablePromos.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/Deposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/Deposit.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/GCashDeposit/GCashDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/GCashWebpayDeposit/GCashWebpayDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/LibanganDeposit/LibanganDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaAppDeposit/MayaAppDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaAppDeposit/MayaAppDeposit.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaDeposit/MayaDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/MayaWebpayDeposit/MayaWebpayDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDeposit.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositAlert.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositContext.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositContext.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositDetails.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositForm.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/OnlineBankDepositForm.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/useOnlineBankDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/OnlineBankDeposit/useOnlineBankDeposit.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/PisoPayDeposit/PisoPayDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDeposit.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositAlert.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositAlert.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositContext.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositContext.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositDetails.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositDetails.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositForm.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHDepositForm.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHQRCode.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/QRPHQRCode.js +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/useQRPHDeposit.d.ts +0 -0
- /package/dist/components/DepositWithdrawal/{Deposit__next → Deposit__legacy}/QRPHDeposit/useQRPHDeposit.js +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ImageProps } from 'next/image';
|
|
2
|
+
export interface BannerEntry {
|
|
3
|
+
src: ImageProps['src'];
|
|
4
|
+
redirectUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BannerProps {
|
|
7
|
+
banners: BannerEntry[];
|
|
8
|
+
imageWidth?: number | [mobile: number, desktop: number];
|
|
9
|
+
imageHeight?: number | [mobile: number, desktop: number];
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function Banner__client(props: BannerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import emblaCarouselAutoplay from 'embla-carousel-autoplay';
|
|
4
|
+
import useEmblaCarousel, {} from 'embla-carousel-react';
|
|
5
|
+
import isMobile from 'is-mobile';
|
|
6
|
+
import Image from 'next/image';
|
|
7
|
+
import Link from 'next/link';
|
|
8
|
+
import { Fragment, useEffect, useState } from 'react';
|
|
9
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import { dataAttr } from '../../utils/dataAttr.js';
|
|
11
|
+
export function Banner__client(props) {
|
|
12
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
13
|
+
loop: true,
|
|
14
|
+
align: 'start',
|
|
15
|
+
}, [
|
|
16
|
+
emblaCarouselAutoplay({
|
|
17
|
+
playOnInit: true,
|
|
18
|
+
delay: 5000,
|
|
19
|
+
}),
|
|
20
|
+
]);
|
|
21
|
+
const [currentIndex, setCurrentIndex] = useState(0);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
function handler(detail) {
|
|
24
|
+
setCurrentIndex(detail?.selectedScrollSnap() ?? 0);
|
|
25
|
+
}
|
|
26
|
+
emblaApi?.on('scroll', handler);
|
|
27
|
+
emblaApi?.on('init', handler);
|
|
28
|
+
return () => {
|
|
29
|
+
emblaApi?.on('init', handler);
|
|
30
|
+
emblaApi?.off('scroll', handler);
|
|
31
|
+
};
|
|
32
|
+
}, [emblaApi]);
|
|
33
|
+
const imageWidth = !props.imageWidth
|
|
34
|
+
? [400, 1200]
|
|
35
|
+
: Array.isArray(props.imageWidth)
|
|
36
|
+
? props.imageWidth
|
|
37
|
+
: [props.imageWidth, props.imageWidth];
|
|
38
|
+
const imageHeight = !props.imageHeight
|
|
39
|
+
? [225, 300]
|
|
40
|
+
: Array.isArray(props.imageHeight)
|
|
41
|
+
? props.imageHeight
|
|
42
|
+
: [props.imageHeight, props.imageHeight];
|
|
43
|
+
return (_jsxs("div", { className: twMerge('relative', props.className), children: [_jsx("div", { ref: emblaRef, className: "overflow-hidden", children: _jsx("div", { className: "flex gap-2", children: props.banners.map((banner, index) => {
|
|
44
|
+
const img = (_jsx(Image, { src: banner.src, alt: "", width: isMobile() ? imageWidth[0] : imageWidth[1], height: isMobile() ? imageHeight[0] : imageHeight[1], className: "block h-auto w-full", priority: index === 0 }));
|
|
45
|
+
return (_jsx(Fragment, { children: !banner.redirectUrl ? (_jsx("div", { className: "w-full shrink-0", children: img })) : (_jsx(Link, { href: banner.redirectUrl, className: "block w-full shrink-0", "aria-label": `Open ${banner.redirectUrl}`, children: img })) }, index));
|
|
46
|
+
}) }) }), _jsx("div", { className: "absolute bottom-lg left-1/2 flex w-fit -translate-x-1/2 gap-2", children: props.banners.map((_, index) => (_jsx("button", { type: "button", className: "ui-active:bg-brand-500 bg-gray-300 size-3 shrink-0 rounded-full border border-white transition-all duration-300 ui-active:w-9", onClick: () => {
|
|
47
|
+
emblaApi?.scrollTo(index);
|
|
48
|
+
}, "aria-label": `Go to slide ${index + 1}`, "data-active": dataAttr(index === currentIndex) }, index))) })] }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AiOeWalletPaymentMethod } from './utils';
|
|
2
|
+
interface AiOPaymentMethodsProps {
|
|
3
|
+
value?: AiOeWalletPaymentMethod;
|
|
4
|
+
onChange?: (value: AiOeWalletPaymentMethod) => void;
|
|
5
|
+
defaultValue?: AiOeWalletPaymentMethod;
|
|
6
|
+
options?: AiOeWalletPaymentMethod[];
|
|
7
|
+
className?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function AiOPaymentMethods(props: AiOPaymentMethodsProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Image from 'next/image';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { useControllableState } from '../../client/hooks/useControllableState.js';
|
|
5
|
+
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
6
|
+
import gcash from '../../images/gcash.png';
|
|
7
|
+
import grabPay from '../../images/grabpay.png';
|
|
8
|
+
import maya from '../../images/maya.png';
|
|
9
|
+
import palawanPay from '../../images/palawanpay.png';
|
|
10
|
+
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
11
|
+
import { Field } from '../../ui/Field/index.js';
|
|
12
|
+
import { AiOeWalletPaymentMethodDefinition, } from './utils.js';
|
|
13
|
+
const AIO_EWALLET_OPTIONS = [
|
|
14
|
+
{
|
|
15
|
+
value: 'AIO_GCASH',
|
|
16
|
+
label: 'GCash',
|
|
17
|
+
image: gcash,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
value: 'AIO_PAY_MAYA',
|
|
21
|
+
label: 'Maya',
|
|
22
|
+
image: maya,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: 'AIO_GRAB_PAY',
|
|
26
|
+
label: 'GrabPay',
|
|
27
|
+
image: grabPay,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'AIO_PALAWAN_PAY',
|
|
31
|
+
label: 'Palawan Pay',
|
|
32
|
+
image: palawanPay,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
export function AiOPaymentMethods(props) {
|
|
36
|
+
const options = props.options && props.options.length > 0
|
|
37
|
+
? AIO_EWALLET_OPTIONS.filter((option) => props.options?.includes(option.value))
|
|
38
|
+
: AIO_EWALLET_OPTIONS;
|
|
39
|
+
const [value, setValue] = useControllableState({
|
|
40
|
+
value: props.value,
|
|
41
|
+
defaultValue: props.defaultValue ?? options[0]?.value,
|
|
42
|
+
onChange: props.onChange,
|
|
43
|
+
});
|
|
44
|
+
const parseValue = (val) => {
|
|
45
|
+
return AiOeWalletPaymentMethodDefinition.parse(val);
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs("div", { className: props.className, children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: props.label || 'AIO eWallet payment methods' }) }), _jsx(Checkbox.Group, { value: [value], onValueChange: (newValue) => {
|
|
48
|
+
const lastValue = newValue.at(-1);
|
|
49
|
+
if (!lastValue)
|
|
50
|
+
return;
|
|
51
|
+
setValue(parseValue(lastValue));
|
|
52
|
+
}, className: "grid grid-cols-2 gap-x-4 gap-y-3", children: options.map((option) => (_jsxs(Checkbox.Root, { value: option.value, className: "flex cursor-pointer items-center justify-between rounded-xl border border-border-secondary ui-checked:border-border-brand-solid p-lg", children: [_jsx("div", { className: twMerge('rounded-xs', option.value === 'AIO_GRAB_PAY'
|
|
53
|
+
? 'bg-transparent px-0 py-0'
|
|
54
|
+
: 'bg-white px-sm py-[0.688rem]', option.value === 'AIO_GCASH' && 'bg-[#017EFF]', option.value === 'AIO_PALAWAN_PAY' && 'bg-[#026308]', option.value === 'AIO_PAY_MAYA' && 'bg-black'), children: _jsx(Image, { src: option.image, alt: "", width: 200, height: 40, className: twMerge('h-[1.063rem] w-auto', option.value === 'AIO_GRAB_PAY' && 'h-[3rem] rounded-[4px]', option.value === 'AIO_PALAWAN_PAY' && 'h-[2rem]'), draggable: false }) }), _jsx(Checkbox.Control, { className: "shrink-0", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }, option.value))) })] }));
|
|
55
|
+
}
|
|
@@ -4,10 +4,12 @@ import Link from 'next/link';
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
+
import { useBoolean } from 'usehooks-ts';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
import { useShallow } from 'zustand/shallow';
|
|
9
10
|
import { useCreateAiOGCashDepositMutation } from '../../../../client/hooks/useAiOGCashDepositMutation.js';
|
|
10
11
|
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
12
|
+
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
11
13
|
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
12
14
|
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
13
15
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
@@ -16,6 +18,7 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
|
|
|
16
18
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
17
19
|
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
18
20
|
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
21
|
+
import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
|
|
19
22
|
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
20
23
|
import { XIcon } from '../../../../icons/XIcon.js';
|
|
21
24
|
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
@@ -28,11 +31,16 @@ import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
|
28
31
|
import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
|
|
29
32
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
30
33
|
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
31
|
-
import { explainError } from '../../utils.js';
|
|
32
34
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
33
35
|
export function AiOGCashDeposit() {
|
|
34
36
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
35
|
-
const disclosure = useDisclosure(
|
|
37
|
+
const disclosure = useDisclosure({
|
|
38
|
+
onOpenChange(open) {
|
|
39
|
+
if (!open) {
|
|
40
|
+
form.reset();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
36
44
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
37
45
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
38
46
|
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
@@ -58,6 +66,26 @@ export function AiOGCashDeposit() {
|
|
|
58
66
|
setStatus('failed');
|
|
59
67
|
},
|
|
60
68
|
});
|
|
69
|
+
const warn = useBoolean();
|
|
70
|
+
const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
|
|
71
|
+
enabled: !warn.value && status === 'success',
|
|
72
|
+
refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
|
|
73
|
+
ctx.state.data?.status === 'REJECTED' ||
|
|
74
|
+
ctx.state.data?.status === 'CANCELLED'
|
|
75
|
+
? false
|
|
76
|
+
: 1000,
|
|
77
|
+
});
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (depositQuery.data?.status === 'CONFIRMED') {
|
|
80
|
+
setStatus('confirmed');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (depositQuery.data?.status === 'REJECTED' ||
|
|
84
|
+
depositQuery.data?.status === 'CANCELLED') {
|
|
85
|
+
setStatus('failed');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
}, [depositQuery.data?.status]);
|
|
61
89
|
const depositsCountQuery = useDepositsCountQuery();
|
|
62
90
|
const depositsCount = depositsCountQuery.data ?? 0;
|
|
63
91
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
@@ -161,13 +189,29 @@ export function AiOGCashDeposit() {
|
|
|
161
189
|
globalStore.depositWithdrawal.setPromo(null);
|
|
162
190
|
}, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _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) => {
|
|
163
191
|
disclosure.setOpen(details.open);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
|
|
170
|
-
|
|
192
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
193
|
+
setStatus('waiting');
|
|
194
|
+
form.reset();
|
|
195
|
+
warn.setFalse();
|
|
196
|
+
}, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
|
|
197
|
+
if (status === 'success' && !warn.value) {
|
|
198
|
+
warn.setTrue();
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
171
201
|
api.setOpen(false);
|
|
172
|
-
}
|
|
202
|
+
}
|
|
203
|
+
}, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_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, {}) })), status === 'confirmed' && (_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' &&
|
|
204
|
+
!warn.value &&
|
|
205
|
+
'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
206
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
207
|
+
!warn.value &&
|
|
208
|
+
'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
|
|
209
|
+
warn.value &&
|
|
210
|
+
'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
|
|
211
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
212
|
+
'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
|
|
213
|
+
status === 'success' ||
|
|
214
|
+
status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
|
|
215
|
+
warn.setFalse();
|
|
216
|
+
}, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
|
|
173
217
|
}
|
|
@@ -4,10 +4,12 @@ import Link from 'next/link';
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
+
import { useBoolean } from 'usehooks-ts';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
import { useShallow } from 'zustand/shallow';
|
|
9
10
|
import { useCreateAiOGrabPayDepositMutation } from '../../../../client/hooks/useAiOGrabPayDepositMutation.js';
|
|
10
11
|
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
12
|
+
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
11
13
|
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
12
14
|
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
13
15
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
@@ -16,6 +18,7 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
|
|
|
16
18
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
17
19
|
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
18
20
|
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
21
|
+
import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
|
|
19
22
|
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
20
23
|
import { XIcon } from '../../../../icons/XIcon.js';
|
|
21
24
|
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
@@ -28,11 +31,16 @@ import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
|
28
31
|
import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
|
|
29
32
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
30
33
|
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
31
|
-
import { explainError } from '../../utils.js';
|
|
32
34
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
33
35
|
export function AiOGrabPayDeposit() {
|
|
34
36
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
35
|
-
const disclosure = useDisclosure(
|
|
37
|
+
const disclosure = useDisclosure({
|
|
38
|
+
onOpenChange(open) {
|
|
39
|
+
if (!open) {
|
|
40
|
+
form.reset();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
36
44
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
37
45
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
38
46
|
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
@@ -56,6 +64,26 @@ export function AiOGrabPayDeposit() {
|
|
|
56
64
|
setStatus('failed');
|
|
57
65
|
},
|
|
58
66
|
});
|
|
67
|
+
const warn = useBoolean();
|
|
68
|
+
const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
|
|
69
|
+
enabled: !warn.value && status === 'success',
|
|
70
|
+
refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
|
|
71
|
+
ctx.state.data?.status === 'REJECTED' ||
|
|
72
|
+
ctx.state.data?.status === 'CANCELLED'
|
|
73
|
+
? false
|
|
74
|
+
: 1000,
|
|
75
|
+
});
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (depositQuery.data?.status === 'CONFIRMED') {
|
|
78
|
+
setStatus('confirmed');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (depositQuery.data?.status === 'REJECTED' ||
|
|
82
|
+
depositQuery.data?.status === 'CANCELLED') {
|
|
83
|
+
setStatus('failed');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}, [depositQuery.data?.status]);
|
|
59
87
|
const depositsCountQuery = useDepositsCountQuery();
|
|
60
88
|
const depositsCount = depositsCountQuery.data ?? 0;
|
|
61
89
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
@@ -159,13 +187,29 @@ export function AiOGrabPayDeposit() {
|
|
|
159
187
|
globalStore.depositWithdrawal.setPromo(null);
|
|
160
188
|
}, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _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) => {
|
|
161
189
|
disclosure.setOpen(details.open);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
|
|
190
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
191
|
+
setStatus('waiting');
|
|
192
|
+
form.reset();
|
|
193
|
+
warn.setFalse();
|
|
194
|
+
}, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
|
|
195
|
+
if (status === 'success' && !warn.value) {
|
|
196
|
+
warn.setTrue();
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
169
199
|
api.setOpen(false);
|
|
170
|
-
}
|
|
200
|
+
}
|
|
201
|
+
}, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_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, {}) })), status === 'confirmed' && (_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' &&
|
|
202
|
+
!warn.value &&
|
|
203
|
+
'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
204
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
205
|
+
!warn.value &&
|
|
206
|
+
'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
|
|
207
|
+
warn.value &&
|
|
208
|
+
'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
|
|
209
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
210
|
+
'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
|
|
211
|
+
status === 'success' ||
|
|
212
|
+
status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
|
|
213
|
+
warn.setFalse();
|
|
214
|
+
}, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
|
|
171
215
|
}
|
package/dist/components/DepositWithdrawal/Deposit/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js
CHANGED
|
@@ -4,10 +4,12 @@ import Link from 'next/link';
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { Controller, useForm } from 'react-hook-form';
|
|
6
6
|
import invariant from 'tiny-invariant';
|
|
7
|
+
import { useBoolean } from 'usehooks-ts';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
import { useShallow } from 'zustand/shallow';
|
|
9
10
|
import { useCreateAiOPalawanPayDepositMutation } from '../../../../client/hooks/useAiOPalawanPayDepositMutation.js';
|
|
10
11
|
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
12
|
+
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
11
13
|
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
12
14
|
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
13
15
|
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
@@ -16,6 +18,7 @@ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSett
|
|
|
16
18
|
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
17
19
|
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
18
20
|
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
21
|
+
import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
|
|
19
22
|
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
20
23
|
import { XIcon } from '../../../../icons/XIcon.js';
|
|
21
24
|
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
@@ -28,11 +31,16 @@ import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
|
28
31
|
import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
|
|
29
32
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
30
33
|
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
31
|
-
import { explainError } from '../../utils.js';
|
|
32
34
|
import { AvailablePromos } from '../AvailablePromos.js';
|
|
33
35
|
export function AiOPalawanPayDeposit() {
|
|
34
36
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
35
|
-
const disclosure = useDisclosure(
|
|
37
|
+
const disclosure = useDisclosure({
|
|
38
|
+
onOpenChange(open) {
|
|
39
|
+
if (!open) {
|
|
40
|
+
form.reset();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
36
44
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
37
45
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
38
46
|
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
@@ -56,6 +64,26 @@ export function AiOPalawanPayDeposit() {
|
|
|
56
64
|
setStatus('failed');
|
|
57
65
|
},
|
|
58
66
|
});
|
|
67
|
+
const warn = useBoolean();
|
|
68
|
+
const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
|
|
69
|
+
enabled: !warn.value && status === 'success',
|
|
70
|
+
refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
|
|
71
|
+
ctx.state.data?.status === 'REJECTED' ||
|
|
72
|
+
ctx.state.data?.status === 'CANCELLED'
|
|
73
|
+
? false
|
|
74
|
+
: 1000,
|
|
75
|
+
});
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (depositQuery.data?.status === 'CONFIRMED') {
|
|
78
|
+
setStatus('confirmed');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (depositQuery.data?.status === 'REJECTED' ||
|
|
82
|
+
depositQuery.data?.status === 'CANCELLED') {
|
|
83
|
+
setStatus('failed');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}, [depositQuery.data?.status]);
|
|
59
87
|
const depositsCountQuery = useDepositsCountQuery();
|
|
60
88
|
const depositsCount = depositsCountQuery.data ?? 0;
|
|
61
89
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
@@ -159,13 +187,29 @@ export function AiOPalawanPayDeposit() {
|
|
|
159
187
|
globalStore.depositWithdrawal.setPromo(null);
|
|
160
188
|
}, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _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) => {
|
|
161
189
|
disclosure.setOpen(details.open);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
|
|
190
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
191
|
+
setStatus('waiting');
|
|
192
|
+
form.reset();
|
|
193
|
+
warn.setFalse();
|
|
194
|
+
}, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
|
|
195
|
+
if (status === 'success' && !warn.value) {
|
|
196
|
+
warn.setTrue();
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
169
199
|
api.setOpen(false);
|
|
170
|
-
}
|
|
200
|
+
}
|
|
201
|
+
}, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_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, {}) })), status === 'confirmed' && (_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' &&
|
|
202
|
+
!warn.value &&
|
|
203
|
+
'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
204
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
205
|
+
!warn.value &&
|
|
206
|
+
'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
|
|
207
|
+
warn.value &&
|
|
208
|
+
'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
|
|
209
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
210
|
+
'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
|
|
211
|
+
status === 'success' ||
|
|
212
|
+
status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
|
|
213
|
+
warn.setFalse();
|
|
214
|
+
}, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
|
|
171
215
|
}
|