@opexa/portal-components 0.0.948 → 0.0.949
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DepositWithdrawal/Deposit/Deposit.js +9 -6
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.d.ts +1 -0
- package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.js +2 -1
- package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
- package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +72 -72
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- 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 +198 -198
- package/dist/ui/Menu/menu.recipe.d.ts +11 -11
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- 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/package.json +1 -1
- 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 +0 -4
- package/dist/client/hooks/useAiOGCashDepositMutation.js +0 -90
- package/dist/client/hooks/useAiOGrabPayDepositMutation.d.ts +0 -4
- package/dist/client/hooks/useAiOGrabPayDepositMutation.js +0 -80
- package/dist/client/hooks/useAiOPalawanPayDepositMutation.d.ts +0 -4
- package/dist/client/hooks/useAiOPalawanPayDepositMutation.js +0 -80
- package/dist/client/hooks/useAiOPayMayaDepositMutation.d.ts +0 -4
- package/dist/client/hooks/useAiOPayMayaDepositMutation.js +0 -80
- package/dist/client/hooks/useVerifyMobileNumber.d.ts +0 -3
- package/dist/client/hooks/useVerifyMobileNumber.js +0 -20
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +0 -11
- package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +0 -55
- package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js +0 -260
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositAlert.js +0 -99
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositDetails.js +0 -17
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +0 -116
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.d.ts +0 -3
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHQRCode.js +0 -69
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDeposit.js +0 -10
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositAlert.js +0 -99
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.d.ts +0 -25
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositContext.js +0 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositDetails.js +0 -17
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHDepositForm.js +0 -116
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.d.ts +0 -3
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/QRPHQRCode.js +0 -69
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.d.ts +0 -13
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit__legacy/useQRPHDeposit.js +0 -85
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGCashDeposit/AiOGCashDeposit.js +0 -173
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOGrabPayDeposit/AiOGrabPayDeposit.js +0 -171
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPalawanPayDeposit/AiOPalawanPayDeposit.js +0 -171
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/AiOPayMayaDeposit/AiOPayMayaDeposit.js +0 -171
- package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.d.ts +0 -8
- package/dist/components/DepositWithdrawal/Deposit__legacy/AvailablePromos.js +0 -33
- package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/Deposit.js +0 -120
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashDeposit/GCashDeposit.js +0 -163
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/GCashWebpayDeposit/GCashWebpayDeposit.js +0 -165
- package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/LibanganDeposit/LibanganDeposit.js +0 -186
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaAppDeposit/MayaAppDeposit.js +0 -157
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaDeposit/MayaDeposit.js +0 -163
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/MayaWebpayDeposit/MayaWebpayDeposit.js +0 -166
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDeposit.js +0 -10
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositAlert.js +0 -99
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.d.ts +0 -25
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositContext.js +0 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositDetails.js +0 -19
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/OnlineBankDepositForm.js +0 -115
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.d.ts +0 -13
- package/dist/components/DepositWithdrawal/Deposit__legacy/OnlineBankDeposit/useOnlineBankDeposit.js +0 -81
- package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/PisoPayDeposit/PisoPayDeposit.js +0 -180
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDeposit.js +0 -10
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositAlert.js +0 -99
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.d.ts +0 -25
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositContext.js +0 -2
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositDetails.js +0 -17
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.d.ts +0 -1
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHDepositForm.js +0 -116
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.d.ts +0 -3
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/QRPHQRCode.js +0 -69
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.d.ts +0 -13
- package/dist/components/DepositWithdrawal/Deposit__legacy/QRPHDeposit/useQRPHDeposit.js +0 -85
- package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
- package/dist/components/DigitainLauncher/Loading.js +0 -5
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
- package/dist/components/KYC/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/BasicInformation.js +0 -101
- package/dist/components/KYC/IdentityVerification.d.ts +0 -1
- package/dist/components/KYC/IdentityVerification.js +0 -120
- package/dist/components/KYC/Indicator.d.ts +0 -1
- package/dist/components/KYC/Indicator.js +0 -8
- package/dist/components/KYC/KYC.lazy.d.ts +0 -6
- package/dist/components/KYC/KYC.lazy.js +0 -45
- package/dist/components/KYC/KYCContext.d.ts +0 -6
- package/dist/components/KYC/KYCContext.js +0 -2
- package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/KYCDefault/BasicInformation.js +0 -101
- package/dist/components/KYC/KYCVerificationStatus.d.ts +0 -1
- package/dist/components/KYC/KYCVerificationStatus.js +0 -10
- package/dist/components/KYC/KYCVerificationStatus.lazy.d.ts +0 -1
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +0 -36
- package/dist/components/KYC/PersonalInformation.d.ts +0 -1
- package/dist/components/KYC/PersonalInformation.js +0 -122
- package/dist/components/KYC/useKYC.d.ts +0 -25
- package/dist/components/KYC/useKYC.js +0 -38
- package/dist/components/KYCNotRequired/KYCNotRequired.d.ts +0 -0
- package/dist/components/KYCNotRequired/KYCNotRequired.js +0 -1
- package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
- package/dist/components/PortalProvider/CXDTokenObserver.d.ts +0 -1
- package/dist/components/PortalProvider/CXDTokenObserver.js +0 -30
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
- package/dist/components/Quests/MultiWageringQuest.d.ts +0 -1
- package/dist/components/Quests/MultiWageringQuest.js +0 -111
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
- package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
- package/dist/components/SessionWatcher/index.d.ts +0 -1
- package/dist/components/SessionWatcher/index.js +0 -1
- package/dist/components/SignIn/utils.d.ts +0 -8
- package/dist/components/SignIn/utils.js +0 -26
- package/dist/components/SingleSignOn/SingleSignOn.d.ts +0 -4
- package/dist/components/SingleSignOn/SingleSignOn.js +0 -177
- package/dist/components/SingleSignOn/index.d.ts +0 -1
- package/dist/components/SingleSignOn/index.js +0 -1
- package/dist/constants/Branches.d.ts +0 -2
- package/dist/constants/Branches.js +0 -42
- 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 +0 -4
- package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
- package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
- package/dist/third-parties/FacebookPixel/api.js +0 -1
- package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
- package/dist/third-parties/FacebookPixel/index.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
- package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
- package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
- package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
- package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
- package/dist/third-parties/index.d.ts +0 -2
- package/dist/third-parties/index.js +0 -2
- package/dist/utils/getLocaleInfo.d.ts +0 -79
- package/dist/utils/getLocaleInfo.js +0 -175
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SetOptional } from 'type-fest';
|
|
2
|
-
import { type CreateAiOPalawanPayDepositInput } from '../../services/wallet';
|
|
3
|
-
import type { Deposit, Mutation } from '../../types';
|
|
4
|
-
export declare const useCreateAiOPalawanPayDepositMutation: Mutation<Deposit, SetOptional<CreateAiOPalawanPayDepositInput, 'id'>>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ObjectId } from '@opexa/object-id';
|
|
2
|
-
import { useMutation } from '@tanstack/react-query';
|
|
3
|
-
import { clamp } from 'lodash-es';
|
|
4
|
-
import invariant from 'tiny-invariant';
|
|
5
|
-
import { OPEXAPAY_ENDPOINT } from '../../constants/index.js';
|
|
6
|
-
import { ObjectType } from '../../services/ObjectType.js';
|
|
7
|
-
import { createAiOPalawanPayDeposit, getDeposit, } from '../../services/wallet.js';
|
|
8
|
-
import { createPoll } from '../../utils/createPoll.js';
|
|
9
|
-
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
10
|
-
import { getCreateAiOPalawanPayDepositMutationKey } from '../../utils/mutationKeys.js';
|
|
11
|
-
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
12
|
-
import { getAvailableQuestsQueryKey, getDepositsCountQueryKey, } from '../../utils/queryKeys.js';
|
|
13
|
-
import { getSession } from '../services/getSession.js';
|
|
14
|
-
export const useCreateAiOPalawanPayDepositMutation = (config) => {
|
|
15
|
-
const queryClient = getQueryClient();
|
|
16
|
-
const mutation = useMutation({
|
|
17
|
-
...config,
|
|
18
|
-
mutationKey: getCreateAiOPalawanPayDepositMutationKey(),
|
|
19
|
-
mutationFn: async (input) => {
|
|
20
|
-
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
21
|
-
const session = await getSession();
|
|
22
|
-
invariant(session.status === 'authenticated');
|
|
23
|
-
const successRedirectUrl = new URL('/transactions', input.redirectUrl);
|
|
24
|
-
successRedirectUrl.searchParams.set('tab', 'deposits');
|
|
25
|
-
successRedirectUrl.searchParams.set('id', id);
|
|
26
|
-
await createAiOPalawanPayDeposit({
|
|
27
|
-
...input,
|
|
28
|
-
id,
|
|
29
|
-
redirectUrl: `${OPEXAPAY_ENDPOINT}/aio/success?redirectUrl=${encodeURIComponent(successRedirectUrl.toString())}`,
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${session.token}`,
|
|
33
|
-
...(session.domain && {
|
|
34
|
-
Domain: session.domain,
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
const poll = createPoll(async () => {
|
|
39
|
-
const session = await getSession();
|
|
40
|
-
invariant(session.status === 'authenticated');
|
|
41
|
-
return await getDeposit(id, {
|
|
42
|
-
headers: {
|
|
43
|
-
Authorization: `Bearer ${session.token}`,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}, {
|
|
47
|
-
until(res) {
|
|
48
|
-
return (!!res?.checkoutUrl || !!res?.error || res?.status === 'FAILED');
|
|
49
|
-
},
|
|
50
|
-
interval: 1000,
|
|
51
|
-
maxAttempt: 20,
|
|
52
|
-
});
|
|
53
|
-
const res = await poll();
|
|
54
|
-
if (!res?.checkoutUrl) {
|
|
55
|
-
const error = new Error();
|
|
56
|
-
error.name = 'AiOPalawanPayDepositError';
|
|
57
|
-
error.message = 'Failed to process Palawan Pay deposit';
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
const depositsCount = queryClient.getQueryData(getDepositsCountQueryKey()) ?? 0;
|
|
61
|
-
if (depositsCount <= 0) {
|
|
62
|
-
queryClient.setQueryData(getAvailableQuestsQueryKey(), (prev) => {
|
|
63
|
-
return prev?.map((quest) => {
|
|
64
|
-
const progressPercentage = clamp(parseDecimal(quest.progressPercentage, 0) + 50, 100);
|
|
65
|
-
if (quest.type === 'ONBOARDING') {
|
|
66
|
-
return {
|
|
67
|
-
...quest,
|
|
68
|
-
status: progressPercentage >= 100 ? 'COMPLETED' : quest.status,
|
|
69
|
-
progressPercentage: progressPercentage.toFixed(2),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return quest;
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
return mutation;
|
|
80
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SetOptional } from 'type-fest';
|
|
2
|
-
import { type CreateAiOPayMayaDepositInput } from '../../services/wallet';
|
|
3
|
-
import type { Deposit, Mutation } from '../../types';
|
|
4
|
-
export declare const useCreateAiOPayMayaDepositMutation: Mutation<Deposit, SetOptional<CreateAiOPayMayaDepositInput, 'id'>>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ObjectId } from '@opexa/object-id';
|
|
2
|
-
import { useMutation } from '@tanstack/react-query';
|
|
3
|
-
import { clamp } from 'lodash-es';
|
|
4
|
-
import invariant from 'tiny-invariant';
|
|
5
|
-
import { OPEXAPAY_ENDPOINT } from '../../constants/index.js';
|
|
6
|
-
import { ObjectType } from '../../services/ObjectType.js';
|
|
7
|
-
import { createAiOPayMayaDeposit, getDeposit, } from '../../services/wallet.js';
|
|
8
|
-
import { createPoll } from '../../utils/createPoll.js';
|
|
9
|
-
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
10
|
-
import { getCreateAiOPayMayaDepositMutationKey } from '../../utils/mutationKeys.js';
|
|
11
|
-
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
12
|
-
import { getAvailableQuestsQueryKey, getDepositsCountQueryKey, } from '../../utils/queryKeys.js';
|
|
13
|
-
import { getSession } from '../services/getSession.js';
|
|
14
|
-
export const useCreateAiOPayMayaDepositMutation = (config) => {
|
|
15
|
-
const queryClient = getQueryClient();
|
|
16
|
-
const mutation = useMutation({
|
|
17
|
-
...config,
|
|
18
|
-
mutationKey: getCreateAiOPayMayaDepositMutationKey(),
|
|
19
|
-
mutationFn: async (input) => {
|
|
20
|
-
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
21
|
-
const session = await getSession();
|
|
22
|
-
invariant(session.status === 'authenticated');
|
|
23
|
-
const successRedirectUrl = new URL('/transactions', input.redirectUrl);
|
|
24
|
-
successRedirectUrl.searchParams.set('tab', 'deposits');
|
|
25
|
-
successRedirectUrl.searchParams.set('id', id);
|
|
26
|
-
await createAiOPayMayaDeposit({
|
|
27
|
-
...input,
|
|
28
|
-
id,
|
|
29
|
-
redirectUrl: `${OPEXAPAY_ENDPOINT}/aio/success?redirectUrl=${encodeURIComponent(successRedirectUrl.toString())}`,
|
|
30
|
-
}, {
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${session.token}`,
|
|
33
|
-
...(session.domain && {
|
|
34
|
-
Domain: session.domain,
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
const poll = createPoll(async () => {
|
|
39
|
-
const session = await getSession();
|
|
40
|
-
invariant(session.status === 'authenticated');
|
|
41
|
-
return await getDeposit(id, {
|
|
42
|
-
headers: {
|
|
43
|
-
Authorization: `Bearer ${session.token}`,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}, {
|
|
47
|
-
until(res) {
|
|
48
|
-
return (!!res?.checkoutUrl || !!res?.error || res?.status === 'FAILED');
|
|
49
|
-
},
|
|
50
|
-
interval: 1000,
|
|
51
|
-
maxAttempt: 20,
|
|
52
|
-
});
|
|
53
|
-
const res = await poll();
|
|
54
|
-
if (!res?.checkoutUrl) {
|
|
55
|
-
const error = new Error();
|
|
56
|
-
error.name = 'AiOPayMayaDepositError';
|
|
57
|
-
error.message = 'Failed to process Pay Maya deposit';
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
const depositsCount = queryClient.getQueryData(getDepositsCountQueryKey()) ?? 0;
|
|
61
|
-
if (depositsCount <= 0) {
|
|
62
|
-
queryClient.setQueryData(getAvailableQuestsQueryKey(), (prev) => {
|
|
63
|
-
return prev?.map((quest) => {
|
|
64
|
-
const progressPercentage = clamp(parseDecimal(quest.progressPercentage, 0) + 50, 100);
|
|
65
|
-
if (quest.type === 'ONBOARDING') {
|
|
66
|
-
return {
|
|
67
|
-
...quest,
|
|
68
|
-
status: progressPercentage >= 100 ? 'COMPLETED' : quest.status,
|
|
69
|
-
progressPercentage: progressPercentage.toFixed(2),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return quest;
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
return mutation;
|
|
80
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useMutation } from '@tanstack/react-query';
|
|
2
|
-
import invariant from 'tiny-invariant';
|
|
3
|
-
import { verifyMobileNumber, } from '../../services/account.js';
|
|
4
|
-
import { getVerifyMobileNumberMutationKey } from '../../utils/mutationKeys.js';
|
|
5
|
-
import { getSession } from '../services/getSession.js';
|
|
6
|
-
export const useVerifyMobileNumber = (config) => {
|
|
7
|
-
return useMutation({
|
|
8
|
-
...config,
|
|
9
|
-
mutationKey: getVerifyMobileNumberMutationKey(),
|
|
10
|
-
mutationFn: async (input) => {
|
|
11
|
-
const session = await getSession();
|
|
12
|
-
invariant(session.status === 'authenticated');
|
|
13
|
-
await verifyMobileNumber(input.verificationCode, {
|
|
14
|
-
headers: {
|
|
15
|
-
Authorization: `Bearer ${session.token}`,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
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;
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
}
|
package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function AurixPayGrabPayDeposit(): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
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 { useBoolean } from 'usehooks-ts';
|
|
9
|
-
import { z } from 'zod';
|
|
10
|
-
import { useShallow } from 'zustand/shallow';
|
|
11
|
-
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
12
|
-
import { useCreateAurixPayGrabPayDepositMutation } from '../../../../client/hooks/useCreateAurixPayGrabPayDepositMutation.js';
|
|
13
|
-
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
14
|
-
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
15
|
-
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
16
|
-
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
17
|
-
import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
|
|
18
|
-
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
19
|
-
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
20
|
-
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
21
|
-
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
22
|
-
import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
|
|
23
|
-
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
24
|
-
import { XIcon } from '../../../../icons/XIcon.js';
|
|
25
|
-
import { ObjectType } from '../../../../services/ObjectType.js';
|
|
26
|
-
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
27
|
-
import { Button } from '../../../../ui/Button/index.js';
|
|
28
|
-
import { Field } from '../../../../ui/Field/index.js';
|
|
29
|
-
import { NumberInput } from '../../../../ui/NumberInput/index.js';
|
|
30
|
-
import { Portal } from '../../../../ui/Portal/index.js';
|
|
31
|
-
import { getQueryClient } from '../../../../utils/getQueryClient.js';
|
|
32
|
-
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
33
|
-
import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
|
|
34
|
-
import { AmountChoices } from '../../AmountChoices.js';
|
|
35
|
-
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
36
|
-
import { AvailablePromos } from '../AvailablePromos.js';
|
|
37
|
-
export function AurixPayGrabPayDeposit() {
|
|
38
|
-
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
39
|
-
const disclosure = useDisclosure({
|
|
40
|
-
onOpenChange(open) {
|
|
41
|
-
if (!open) {
|
|
42
|
-
form.reset();
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
47
|
-
depositWithdrawal: ctx.depositWithdrawal,
|
|
48
|
-
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
49
|
-
})));
|
|
50
|
-
const verificationQuery = useMemberVerificationQuery();
|
|
51
|
-
const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
|
|
52
|
-
const [status, setStatus] = useState('waiting');
|
|
53
|
-
const [errorMessage, setErrorMessage] = useState(null);
|
|
54
|
-
const createDepositMutation = useCreateAurixPayGrabPayDepositMutation({
|
|
55
|
-
onMutate() {
|
|
56
|
-
disclosure.setOpen(true);
|
|
57
|
-
setStatus('processing');
|
|
58
|
-
},
|
|
59
|
-
onSuccess(data) {
|
|
60
|
-
const queryClient = getQueryClient();
|
|
61
|
-
invariant(data.checkoutUrl);
|
|
62
|
-
window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
|
|
63
|
-
queryClient.invalidateQueries({
|
|
64
|
-
queryKey: getDepositsCountQueryKey(),
|
|
65
|
-
});
|
|
66
|
-
setStatus('success');
|
|
67
|
-
},
|
|
68
|
-
onError(data) {
|
|
69
|
-
setStatus('failed');
|
|
70
|
-
setErrorMessage({
|
|
71
|
-
name: data.name,
|
|
72
|
-
message: data.message,
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
const warn = useBoolean();
|
|
77
|
-
const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
|
|
78
|
-
enabled: !warn.value && status === 'success',
|
|
79
|
-
refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
|
|
80
|
-
ctx.state.data?.status === 'REJECTED' ||
|
|
81
|
-
ctx.state.data?.status === 'CANCELLED'
|
|
82
|
-
? false
|
|
83
|
-
: 1000,
|
|
84
|
-
});
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
if (depositQuery.data?.status === 'CONFIRMED') {
|
|
87
|
-
setStatus('confirmed');
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (depositQuery.data?.status === 'REJECTED' ||
|
|
91
|
-
depositQuery.data?.status === 'CANCELLED') {
|
|
92
|
-
setStatus('failed');
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
}, [depositQuery.data?.status]);
|
|
96
|
-
const depositsCountQuery = useDepositsCountQuery();
|
|
97
|
-
const depositsCount = depositsCountQuery.data ?? 0;
|
|
98
|
-
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
99
|
-
const paymentSettings = paymentSettingsQuery.data;
|
|
100
|
-
const gatewaySettings = paymentSettings?.aurixPayGrabPayDepositGatewaySettings;
|
|
101
|
-
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
102
|
-
const minimumAmount = depositsCount <= 0
|
|
103
|
-
? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
|
|
104
|
-
: parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
105
|
-
const promosQuery = useAvailablePromosQuery();
|
|
106
|
-
const promos = promosQuery.data ?? [];
|
|
107
|
-
const definition = z
|
|
108
|
-
.object({
|
|
109
|
-
amount: z.string().superRefine((val, ctx) => {
|
|
110
|
-
const n = parseDecimal(val, 0);
|
|
111
|
-
if (n < minimumAmount) {
|
|
112
|
-
ctx.addIssue({
|
|
113
|
-
type: 'number',
|
|
114
|
-
code: z.ZodIssueCode.too_small,
|
|
115
|
-
inclusive: true,
|
|
116
|
-
minimum: minimumAmount,
|
|
117
|
-
message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (n > maximumAmount) {
|
|
121
|
-
ctx.addIssue({
|
|
122
|
-
type: 'number',
|
|
123
|
-
code: z.ZodIssueCode.too_big,
|
|
124
|
-
inclusive: true,
|
|
125
|
-
maximum: maximumAmount,
|
|
126
|
-
message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}),
|
|
130
|
-
promo: z.string().optional().nullable(),
|
|
131
|
-
accountNumber: z
|
|
132
|
-
.string()
|
|
133
|
-
.min(1, 'Account number is required')
|
|
134
|
-
.min(8, 'Account number must be 8 or more characters')
|
|
135
|
-
.max(32, 'Account number must not be more than 32 characters'),
|
|
136
|
-
})
|
|
137
|
-
.superRefine((value, ctx) => {
|
|
138
|
-
const promo = promos.find((o) => o.id === value.promo);
|
|
139
|
-
const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
|
|
140
|
-
const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
|
|
141
|
-
const amount = parseDecimal(value.amount, 0);
|
|
142
|
-
if (promo && amount < promoMinAmount) {
|
|
143
|
-
ctx.addIssue({
|
|
144
|
-
path: ['amount'],
|
|
145
|
-
code: z.ZodIssueCode.custom,
|
|
146
|
-
message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
if (promo && amount > promoMaxAmount) {
|
|
150
|
-
ctx.addIssue({
|
|
151
|
-
path: ['amount'],
|
|
152
|
-
code: z.ZodIssueCode.custom,
|
|
153
|
-
message: `Maximum amount for this promo is ${promoMaxAmount}`,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
const form = useForm({
|
|
158
|
-
mode: 'all',
|
|
159
|
-
resolver: zodResolver(definition),
|
|
160
|
-
defaultValues: {
|
|
161
|
-
amount: '0',
|
|
162
|
-
promo: globalStore.depositWithdrawal.promo ?? null,
|
|
163
|
-
accountNumber: '',
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
useEffect(() => {
|
|
167
|
-
if (minimumAmount) {
|
|
168
|
-
form.reset({
|
|
169
|
-
amount: minimumAmount.toString(),
|
|
170
|
-
promo: form.getValues('promo') ?? null,
|
|
171
|
-
accountNumber: form.getValues('accountNumber') ?? '',
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}, [form, minimumAmount]);
|
|
175
|
-
const redirectUrl = (() => {
|
|
176
|
-
const path = depositWithdrawalProps.depositSuccessPageUrl ?? '/deposits/:id/status';
|
|
177
|
-
const origin = window.location.origin.includes('localhost')
|
|
178
|
-
? 'https://uat.powerplay.ph' +
|
|
179
|
-
depositWithdrawalProps.depositSuccessPageUrl
|
|
180
|
-
: window.location.origin;
|
|
181
|
-
return `${origin}${path}`;
|
|
182
|
-
})();
|
|
183
|
-
return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
|
|
184
|
-
if (!depositWithdrawalProps.bypassDepositKycCheck &&
|
|
185
|
-
(verificationStatus === 'PENDING' ||
|
|
186
|
-
verificationStatus === 'UNVERIFIED' ||
|
|
187
|
-
verificationStatus === 'REJECTED' ||
|
|
188
|
-
verificationStatus === 'CREATED')) {
|
|
189
|
-
globalStore.kycVerificationStatus.setOpen(true);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
const id = ObjectId.generate(ObjectType.Deposit).toString();
|
|
194
|
-
createDepositMutation.reset();
|
|
195
|
-
createDepositMutation.mutate({
|
|
196
|
-
id,
|
|
197
|
-
amount: data.amount.toString(),
|
|
198
|
-
promo: data.promo ?? undefined,
|
|
199
|
-
redirectUrl: redirectUrl.replace(':id', id),
|
|
200
|
-
accountNumber: data.accountNumber,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
}), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, children: [_jsx(Field.Label, { children: "Account number" }), _jsx(Field.Input, { ...form.register('accountNumber', {
|
|
204
|
-
onChange: (e) => {
|
|
205
|
-
// Allow only digits and leading +
|
|
206
|
-
let value = e.target.value;
|
|
207
|
-
// Remove all non-digit except leading +
|
|
208
|
-
value = value.replace(/(?!^)\D/g, '');
|
|
209
|
-
if (value.startsWith('+')) {
|
|
210
|
-
// keep leading +
|
|
211
|
-
value = '+' + value.slice(1).replace(/\D/g, '');
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
// remove all non-digits
|
|
215
|
-
value = value.replace(/\D/g, '');
|
|
216
|
-
}
|
|
217
|
-
e.target.value = value;
|
|
218
|
-
form.setValue('accountNumber', value, {
|
|
219
|
-
shouldValidate: true,
|
|
220
|
-
});
|
|
221
|
-
},
|
|
222
|
-
}), inputMode: "tel", pattern: "^\\+?[0-9]*$", autoComplete: "tel" }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-lg", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
223
|
-
o.field.onChange(details.value);
|
|
224
|
-
}, 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) => {
|
|
225
|
-
form.setValue('amount', value.toString(), {
|
|
226
|
-
shouldTouch: true,
|
|
227
|
-
shouldDirty: true,
|
|
228
|
-
shouldValidate: true,
|
|
229
|
-
});
|
|
230
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
|
|
231
|
-
o.field.onChange(value);
|
|
232
|
-
globalStore.depositWithdrawal.setPromo(null);
|
|
233
|
-
}, 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) => {
|
|
234
|
-
disclosure.setOpen(details.open);
|
|
235
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
236
|
-
setStatus('waiting');
|
|
237
|
-
setErrorMessage(null);
|
|
238
|
-
form.reset();
|
|
239
|
-
warn.setFalse();
|
|
240
|
-
}, 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: () => {
|
|
241
|
-
if (status === 'success' && !warn.value) {
|
|
242
|
-
warn.setTrue();
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
api.setOpen(false);
|
|
246
|
-
}
|
|
247
|
-
}, 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' &&
|
|
248
|
-
!warn.value &&
|
|
249
|
-
'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' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
250
|
-
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
251
|
-
!warn.value &&
|
|
252
|
-
'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' &&
|
|
253
|
-
warn.value &&
|
|
254
|
-
'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
|
|
255
|
-
'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
|
|
256
|
-
status === 'success' ||
|
|
257
|
-
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: () => {
|
|
258
|
-
warn.setFalse();
|
|
259
|
-
}, 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" })) }))] }))] }) })] }) })] }));
|
|
260
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function QRPHDepositAlert(): import("react/jsx-runtime").JSX.Element;
|