@opexa/portal-components 0.0.448 → 0.0.450
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.d.ts +4 -0
- package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.js +28 -0
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.d.ts +4 -4
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +8 -8
- package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +79 -63
- package/dist/components/Quests/JourneyQuest.js +21 -5
- package/dist/components/SignIn/FacebookSignInTrigger.d.ts +6 -1
- package/dist/components/SignIn/FacebookSignInTrigger.js +2 -2
- package/dist/components/SignIn/GoogleSignInTrigger.d.ts +2 -0
- package/dist/components/SignIn/GoogleSignInTrigger.js +2 -2
- package/dist/constants/EnvVar.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
- 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 +99 -99
- package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
- 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/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.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/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/PinInput/PinInput.d.ts +12 -12
- package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- 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/utils/mutationKeys.d.ts +2 -1
- package/dist/utils/mutationKeys.js +44 -43
- package/package.json +1 -1
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- 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/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/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
- 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/constants/Branches.d.ts +0 -2
- package/dist/constants/Branches.js +0 -42
- 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
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SetOptional } from "type-fest";
|
|
2
|
+
import { type CreateGCashWithdrawalInput } from "../../services/wallet";
|
|
3
|
+
import type { Mutation } from "../../types";
|
|
4
|
+
export declare const useCreateGCashStandardCashInWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput, "id">>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ObjectId } from "@opexa/object-id";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import invariant from "tiny-invariant";
|
|
4
|
+
import { ObjectType } from "../../services/ObjectType.js";
|
|
5
|
+
import { createGCashWithdrawal, } from "../../services/wallet.js";
|
|
6
|
+
import { getCreateGCashStandardCashInWithdrawalMutationKey } from "../../utils/mutationKeys.js";
|
|
7
|
+
import { getSession } from "../services/getSession.js";
|
|
8
|
+
export const useCreateGCashStandardCashInWithdrawalMutation = (config) => {
|
|
9
|
+
const mutation = useMutation({
|
|
10
|
+
...config,
|
|
11
|
+
mutationKey: getCreateGCashStandardCashInWithdrawalMutationKey(),
|
|
12
|
+
mutationFn: async (input) => {
|
|
13
|
+
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
|
+
const session = await getSession();
|
|
15
|
+
invariant(session.status === "authenticated");
|
|
16
|
+
await createGCashWithdrawal({ ...input, id }, {
|
|
17
|
+
headers: {
|
|
18
|
+
Authorization: `Bearer ${session.token}`,
|
|
19
|
+
...(session.domain && {
|
|
20
|
+
Domain: session.domain,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
return id;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return mutation;
|
|
28
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SetOptional } from
|
|
2
|
-
import { type CreateGCashWithdrawalInput } from
|
|
3
|
-
import type { Mutation } from
|
|
4
|
-
export declare const useCreateGCashWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput,
|
|
1
|
+
import type { SetOptional } from "type-fest";
|
|
2
|
+
import { type CreateGCashWithdrawalInput } from "../../services/wallet";
|
|
3
|
+
import type { Mutation } from "../../types";
|
|
4
|
+
export declare const useCreateGCashWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput, "id">>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ObjectId } from
|
|
2
|
-
import { useMutation } from
|
|
3
|
-
import invariant from
|
|
4
|
-
import { ObjectType } from
|
|
5
|
-
import { createGCashWithdrawal, } from
|
|
6
|
-
import { getCreateGCashWithdrawalMutationKey } from
|
|
7
|
-
import { getSession } from
|
|
1
|
+
import { ObjectId } from "@opexa/object-id";
|
|
2
|
+
import { useMutation } from "@tanstack/react-query";
|
|
3
|
+
import invariant from "tiny-invariant";
|
|
4
|
+
import { ObjectType } from "../../services/ObjectType.js";
|
|
5
|
+
import { createGCashWithdrawal, } from "../../services/wallet.js";
|
|
6
|
+
import { getCreateGCashWithdrawalMutationKey } from "../../utils/mutationKeys.js";
|
|
7
|
+
import { getSession } from "../services/getSession.js";
|
|
8
8
|
export const useCreateGCashWithdrawalMutation = (config) => {
|
|
9
9
|
const mutation = useMutation({
|
|
10
10
|
...config,
|
|
@@ -12,7 +12,7 @@ export const useCreateGCashWithdrawalMutation = (config) => {
|
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
14
|
const session = await getSession();
|
|
15
|
-
invariant(session.status ===
|
|
15
|
+
invariant(session.status === "authenticated");
|
|
16
16
|
await createGCashWithdrawal({ ...input, id }, {
|
|
17
17
|
headers: {
|
|
18
18
|
Authorization: `Bearer ${session.token}`,
|
|
@@ -1,54 +1,70 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { zodResolver } from
|
|
3
|
-
import Link from
|
|
4
|
-
import { useEffect, useState } from
|
|
5
|
-
import { Controller, useForm } from
|
|
6
|
-
import { z } from
|
|
7
|
-
import { useShallow } from
|
|
8
|
-
import { useCreateGCashWithdrawalMutation } from
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
2
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { Controller, useForm } from "react-hook-form";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { useShallow } from "zustand/shallow";
|
|
8
|
+
import { useCreateGCashWithdrawalMutation } from "../../../../client/hooks/useCreateGCashWithdrawalMutation.js";
|
|
9
|
+
import { useCreateGCashStandardCashInWithdrawalMutation } from "../../../../client/hooks/useCreateGCashStandardCashInWithdrawal.js";
|
|
10
|
+
import { useGlobalStore } from "../../../../client/hooks/useGlobalStore.js";
|
|
11
|
+
import { useLocaleInfo } from "../../../../client/hooks/useLocaleInfo.js";
|
|
12
|
+
import { useMobileNumberParser } from "../../../../client/hooks/useMobileNumberParser.js";
|
|
13
|
+
import { usePaymentSettingsQuery } from "../../../../client/hooks/usePaymentSettingsQuery.js";
|
|
14
|
+
import { AlertCircleIcon } from "../../../../icons/AlertCircleIcon.js";
|
|
15
|
+
import { ChevronDownIcon } from "../../../../icons/ChevronDownIcon.js";
|
|
16
|
+
import { ChevronUpIcon } from "../../../../icons/ChevronUpIcon.js";
|
|
17
|
+
import { EyeIcon } from "../../../../icons/EyeIcon.js";
|
|
18
|
+
import { EyeOffIcon } from "../../../../icons/EyeOffIcon.js";
|
|
19
|
+
import { SpinnerIcon } from "../../../../icons/SpinnerIcon.js";
|
|
20
|
+
import { XIcon } from "../../../../icons/XIcon.js";
|
|
21
|
+
import { AlertDialog } from "../../../../ui/AlertDialog/index.js";
|
|
22
|
+
import { Button } from "../../../../ui/Button/index.js";
|
|
23
|
+
import { Field } from "../../../../ui/Field/index.js";
|
|
24
|
+
import { NumberInput } from "../../../../ui/NumberInput/index.js";
|
|
25
|
+
import { PasswordInput } from "../../../../ui/PasswordInput/index.js";
|
|
26
|
+
import { Portal } from "../../../../ui/Portal/index.js";
|
|
27
|
+
import { parseDecimal } from "../../../../utils/parseDecimal.js";
|
|
28
|
+
import { AmountChoices } from "../../AmountChoices.js";
|
|
29
|
+
import { useDepositWithdrawalPropsContext } from "../../DepositWithdrawalContext.js";
|
|
30
|
+
import { explainError } from "../../utils.js";
|
|
31
|
+
import { TransactionPasswordNotSet } from "../TransactionPasswordNotSet.js";
|
|
32
|
+
import { useFeatureFlag } from "../../../../client/hooks/useFeatureFlag.js";
|
|
31
33
|
export function GCashWithdrawal() {
|
|
32
34
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
35
|
+
const featureFlag = useFeatureFlag();
|
|
33
36
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
34
37
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
35
38
|
hasPendingBonus: ctx.pendingBonus,
|
|
36
39
|
})));
|
|
37
|
-
const [status, setStatus] = useState(
|
|
40
|
+
const [status, setStatus] = useState("waiting");
|
|
38
41
|
const localeInfo = useLocaleInfo();
|
|
39
42
|
const mobileNumberParser = useMobileNumberParser();
|
|
40
|
-
const createWithdrawalMutation =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
const createWithdrawalMutation = featureFlag.enabled
|
|
44
|
+
? useCreateGCashStandardCashInWithdrawalMutation({
|
|
45
|
+
onMutate() {
|
|
46
|
+
setStatus("processing");
|
|
47
|
+
},
|
|
48
|
+
onSuccess() {
|
|
49
|
+
setStatus("success");
|
|
50
|
+
form.reset();
|
|
51
|
+
},
|
|
52
|
+
onError() {
|
|
53
|
+
setStatus("failed");
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
: useCreateGCashWithdrawalMutation({
|
|
57
|
+
onMutate() {
|
|
58
|
+
setStatus("processing");
|
|
59
|
+
},
|
|
60
|
+
onSuccess() {
|
|
61
|
+
setStatus("success");
|
|
62
|
+
form.reset();
|
|
63
|
+
},
|
|
64
|
+
onError() {
|
|
65
|
+
setStatus("failed");
|
|
66
|
+
},
|
|
67
|
+
});
|
|
52
68
|
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
53
69
|
const paymentSettings = paymentSettingsQuery.data;
|
|
54
70
|
const gatewaySettings = paymentSettings?.gcashWithdrawalGatewaySettings;
|
|
@@ -59,7 +75,7 @@ export function GCashWithdrawal() {
|
|
|
59
75
|
const n = parseDecimal(val, 0);
|
|
60
76
|
if (n < minimumAmount) {
|
|
61
77
|
ctx.addIssue({
|
|
62
|
-
type:
|
|
78
|
+
type: "number",
|
|
63
79
|
code: z.ZodIssueCode.too_small,
|
|
64
80
|
inclusive: true,
|
|
65
81
|
minimum: minimumAmount,
|
|
@@ -68,7 +84,7 @@ export function GCashWithdrawal() {
|
|
|
68
84
|
}
|
|
69
85
|
if (n > maximumAmount) {
|
|
70
86
|
ctx.addIssue({
|
|
71
|
-
type:
|
|
87
|
+
type: "number",
|
|
72
88
|
code: z.ZodIssueCode.too_big,
|
|
73
89
|
inclusive: true,
|
|
74
90
|
maximum: maximumAmount,
|
|
@@ -78,27 +94,27 @@ export function GCashWithdrawal() {
|
|
|
78
94
|
}),
|
|
79
95
|
password: z
|
|
80
96
|
.string()
|
|
81
|
-
.min(8,
|
|
82
|
-
.max(64,
|
|
97
|
+
.min(8, "Password must be 8 or more characters")
|
|
98
|
+
.max(64, "Password must be not be more than 64 characters"),
|
|
83
99
|
mobileNumber: z
|
|
84
100
|
.string()
|
|
85
|
-
.regex(localeInfo.mobileNumber.pattern,
|
|
101
|
+
.regex(localeInfo.mobileNumber.pattern, "Invalid mobile number"),
|
|
86
102
|
});
|
|
87
103
|
const form = useForm({
|
|
88
|
-
mode:
|
|
104
|
+
mode: "all",
|
|
89
105
|
resolver: zodResolver(definition),
|
|
90
106
|
defaultValues: {
|
|
91
|
-
amount:
|
|
92
|
-
password:
|
|
93
|
-
mobileNumber:
|
|
107
|
+
amount: "0",
|
|
108
|
+
password: "",
|
|
109
|
+
mobileNumber: "",
|
|
94
110
|
},
|
|
95
111
|
});
|
|
96
112
|
useEffect(() => {
|
|
97
113
|
if (minimumAmount) {
|
|
98
114
|
form.reset({
|
|
99
115
|
amount: minimumAmount.toString(),
|
|
100
|
-
password:
|
|
101
|
-
mobileNumber:
|
|
116
|
+
password: "",
|
|
117
|
+
mobileNumber: "",
|
|
102
118
|
});
|
|
103
119
|
}
|
|
104
120
|
}, [form, minimumAmount]);
|
|
@@ -113,25 +129,25 @@ export function GCashWithdrawal() {
|
|
|
113
129
|
transactionPassword: data.password,
|
|
114
130
|
});
|
|
115
131
|
});
|
|
116
|
-
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", ...form.register(
|
|
132
|
+
return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", ...form.register("mobileNumber") })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
117
133
|
o.field.onChange(details.value);
|
|
118
134
|
}, formatOptions: {
|
|
119
135
|
maximumFractionDigits: 2,
|
|
120
136
|
minimumFractionDigits: 0,
|
|
121
|
-
}, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _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(
|
|
122
|
-
form.setValue(
|
|
137
|
+
}, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _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) => {
|
|
138
|
+
form.setValue("amount", value.toString(), {
|
|
123
139
|
shouldTouch: true,
|
|
124
140
|
shouldDirty: true,
|
|
125
141
|
shouldValidate: true,
|
|
126
142
|
});
|
|
127
|
-
}, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register(
|
|
143
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register("password") }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsx(TransactionPasswordNotSet, {}), _jsx(Button, { type: "submit", className: "mt-6", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["Upon withdrawing, 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: status !== "waiting", onOpenChange: (details) => {
|
|
128
144
|
if (!details.open) {
|
|
129
|
-
setStatus(
|
|
145
|
+
setStatus("waiting");
|
|
130
146
|
}
|
|
131
|
-
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status ===
|
|
132
|
-
"We're verifying your account and amount. Please hold a moment.", status ===
|
|
133
|
-
|
|
134
|
-
explainError(createWithdrawalMutation.error?.name)] })] }), (status ===
|
|
147
|
+
}, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === "processing", children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === "processing" && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === "success" && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === "failed" && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === "processing" && "Processing Withdraw", status === "success" && "Withdrawal Submitted", status === "failed" && "Withdraw Failed"] }), _jsxs(AlertDialog.Description, { children: [status === "processing" &&
|
|
148
|
+
"We're verifying your account and amount. Please hold a moment.", status === "success" &&
|
|
149
|
+
"Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.", status === "failed" &&
|
|
150
|
+
explainError(createWithdrawalMutation.error?.name)] })] }), (status === "failed" || status === "success") && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
135
151
|
api.setOpen(false);
|
|
136
|
-
}, children: status ===
|
|
152
|
+
}, children: status === "failed" ? "Try Again" : "Ok" })) }) }))] }) })] }) })] }));
|
|
137
153
|
}
|
|
@@ -20,9 +20,17 @@ import { formatNumber } from '../../utils/formatNumber.js';
|
|
|
20
20
|
import { getPercentage } from '../../utils/getPercentage.js';
|
|
21
21
|
import { useQuestContext } from './QuestsContext.js';
|
|
22
22
|
import { RemainingTime } from './RemainingTime.js';
|
|
23
|
+
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
24
|
+
import { FacebookSignInTrigger } from '../SignIn/FacebookSignInTrigger.js';
|
|
25
|
+
import dynamic from 'next/dynamic';
|
|
26
|
+
const GoogleSignInButton = dynamic(() => import('../SignIn/GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
|
|
27
|
+
ssr: false,
|
|
28
|
+
loading: () => null,
|
|
29
|
+
});
|
|
23
30
|
export function JourneyQuest() {
|
|
24
31
|
const disclosure = useDisclosure();
|
|
25
32
|
const quest = useQuestContext();
|
|
33
|
+
const featureFlag = useFeatureFlag();
|
|
26
34
|
const { milestones, totalMilestones, currentMilestone, progressPercentage } = useMemo(() => {
|
|
27
35
|
if (!quest?.milestones) {
|
|
28
36
|
return {
|
|
@@ -32,7 +40,13 @@ export function JourneyQuest() {
|
|
|
32
40
|
progressPercentage: 0,
|
|
33
41
|
};
|
|
34
42
|
}
|
|
35
|
-
const
|
|
43
|
+
const filteredMilestones = quest.milestones.filter((milestone) => {
|
|
44
|
+
if (!featureFlag.enabled) {
|
|
45
|
+
return milestone.type !== 'LINK_FACEBOOK_ACCOUNT' && milestone.type !== 'LINK_GOOGLE_ACCOUNT';
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
});
|
|
49
|
+
const transformedMilestones = filteredMilestones.map((milestone) => ({
|
|
36
50
|
key: milestone.type,
|
|
37
51
|
label: milestone.name,
|
|
38
52
|
bonus: milestone.bonusAmount
|
|
@@ -42,8 +56,8 @@ export function JourneyQuest() {
|
|
|
42
56
|
id: milestone.id,
|
|
43
57
|
description: milestone.description,
|
|
44
58
|
}));
|
|
45
|
-
const completedCount =
|
|
46
|
-
const total =
|
|
59
|
+
const completedCount = filteredMilestones.filter((m) => m.cleared).length;
|
|
60
|
+
const total = filteredMilestones.length;
|
|
47
61
|
return {
|
|
48
62
|
milestones: transformedMilestones,
|
|
49
63
|
totalMilestones: total,
|
|
@@ -85,7 +99,7 @@ function Rules(props) {
|
|
|
85
99
|
return false;
|
|
86
100
|
return milestones.every((milestone) => milestone.isCompleted);
|
|
87
101
|
}, [milestones]);
|
|
88
|
-
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: quest?.name || 'Quest' }), _jsx("p", { children: quest?.description ||
|
|
102
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-5 mt-40", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: quest?.name || 'Quest' }), _jsx("p", { children: quest?.description ||
|
|
89
103
|
'Ready for a challenge? Complete them all and get amazing rewards!' }), milestones.map((milestone) => (_jsxs("div", { className: "flex flex-col space-y-2.5 rounded-xl bg-bg-tertiary p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "font-medium text-base text-white", children: milestone.label }), milestone.isCompleted && (_jsx("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: "Complete" }))] }), milestone.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
|
|
90
104
|
__html: milestone.description,
|
|
91
105
|
} })) : milestone.bonus ? (_jsxs("p", { className: "ml-1", children: [milestone.key === 'REGISTRATION' &&
|
|
@@ -107,7 +121,9 @@ function Rules(props) {
|
|
|
107
121
|
}
|
|
108
122
|
}, "aria-label": `Complete ${milestone.label}`, children: [milestone.key === 'ACCOUNT_VERIFICATION' ? (_jsx(FileCheck02Icon, { className: "size-5" })) : (_jsx(CoinsHandIcon, { className: "size-5" })), milestone.key === 'FIRST_DEPOSIT'
|
|
109
123
|
? 'Deposit'
|
|
110
|
-
: 'Verify Account'] }))
|
|
124
|
+
: 'Verify Account'] })), !milestone.isCompleted &&
|
|
125
|
+
milestone.key === 'LINK_FACEBOOK_ACCOUNT' && (_jsx(FacebookSignInTrigger, { text: 'Link Facebook Account', className: 'items-center justify-center rounded-md font-semibold shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none h-10 gap-md px-3 text-sm flex w-full bg-button-primary-bg text-button-primary-fg' })), !milestone.isCompleted &&
|
|
126
|
+
milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsx(GoogleSignInButton, { text: 'Link Google Account', className: 'items-center justify-center rounded-md font-semibold shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none h-10 gap-md px-3 text-sm flex w-full bg-button-primary-bg text-button-primary-fg' }))] }, milestone.key))), quest?.bonus && (_jsx("div", { className: "flex h-full items-end", children: allMilestonesCompleted ? (_jsx(Button, { size: "sm", onClick: () => setOpen(false), "aria-label": "Close", className: "w-full", children: "Close" })) : (_jsx("div", { className: "w-full rounded-md border border-bg-primary-hover bg-button-secondary-bg px-3.5 py-2.5 text-center text-white", children: _jsxs("p", { children: ["Complete target to", ' ', _jsxs("span", { className: "text-brand-400", children: ["\u20B1", quest?.bonus] }), ' ', "bonus!"] }) })) }))] })] }) })] }) }));
|
|
111
127
|
}
|
|
112
128
|
function QuestMilestone({ label, bonus, isCompleted = false, }) {
|
|
113
129
|
const localeInfo = useLocaleInfo();
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
interface FacebookSignInTriggerProps {
|
|
2
|
+
text?: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const FacebookSignInTrigger: (props: FacebookSignInTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export {};
|
|
@@ -9,7 +9,7 @@ import { AUTH_ENDPOINT, PLATFORM_CODE } from '../../constants/index.js';
|
|
|
9
9
|
import { FacebookIcon } from '../../icons/FacebookIcon.js';
|
|
10
10
|
import { httpRequest } from '../../services/httpRequest.js';
|
|
11
11
|
import { Button } from '../../ui/Button/index.js';
|
|
12
|
-
export const FacebookSignInTrigger = () => {
|
|
12
|
+
export const FacebookSignInTrigger = (props) => {
|
|
13
13
|
const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
|
|
14
14
|
const signIn = useSignInMutation({
|
|
15
15
|
onError: () => {
|
|
@@ -46,6 +46,6 @@ export const FacebookSignInTrigger = () => {
|
|
|
46
46
|
description: 'Failed to sign in with Facebook. Please try again.',
|
|
47
47
|
});
|
|
48
48
|
}, render: ({ onClick }) => {
|
|
49
|
-
return (_jsxs(Button, { variant: "outline", onClick: onClick, colorScheme: "gray", className:
|
|
49
|
+
return (_jsxs(Button, { variant: "outline", onClick: onClick, colorScheme: "gray", className: `mt-lg border-border-primary bg-bg-primary text-text-secondary-700 ${props.className}`, children: [_jsx(FacebookIcon, { className: "size-6" }), props.text ?? 'Continue with Facebook'] }));
|
|
50
50
|
} }));
|
|
51
51
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
2
|
export interface GoogleSignInTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
3
|
asChild?: boolean;
|
|
4
|
+
text?: string;
|
|
5
|
+
className?: string;
|
|
4
6
|
}
|
|
5
7
|
export declare const GoogleSignInTrigger: (props: GoogleSignInTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -18,7 +18,7 @@ export const GoogleSignInTrigger = (props) => {
|
|
|
18
18
|
return null;
|
|
19
19
|
return (_jsx(GoogleOAuthProvider, { clientId: googleClientId, children: _jsx(Trigger, { ...props }) }));
|
|
20
20
|
};
|
|
21
|
-
const Trigger = ({ children, disabled, asChild, onClick, ...props }) => {
|
|
21
|
+
const Trigger = ({ children, disabled, asChild, onClick, text, className, ...props }) => {
|
|
22
22
|
const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
|
|
23
23
|
const signIn = useSignInMutation({
|
|
24
24
|
onError: () => {
|
|
@@ -56,5 +56,5 @@ const Trigger = ({ children, disabled, asChild, onClick, ...props }) => {
|
|
|
56
56
|
return (_jsx(ark.button, { type: "button", onClick: (e) => {
|
|
57
57
|
onClick?.(e);
|
|
58
58
|
signInGoogle();
|
|
59
|
-
}, asChild: !children ? true : asChild, disabled: signIn.isPending || disabled, ...props, children: children ?? (_jsxs(Button, { variant: "outline", colorScheme: "gray", className:
|
|
59
|
+
}, asChild: !children ? true : asChild, disabled: signIn.isPending || disabled, ...props, children: children ?? (_jsxs(Button, { variant: "outline", colorScheme: "gray", className: `bg-bg-primary ${className}`, children: [_jsx(GoogleIcon, { className: "size-6" }), text ?? 'Continue with Google'] })) }));
|
|
60
60
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SITE_ID: string;
|
|
2
2
|
export declare const PLATFORM_ID: string;
|
|
3
3
|
export declare const PLATFORM_CODE: string;
|
|
4
|
-
export declare const ENVIRONMENT: "
|
|
4
|
+
export declare const ENVIRONMENT: "production" | "development";
|
|
5
5
|
export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -703,7 +703,7 @@ export interface QuestProgram {
|
|
|
703
703
|
description: string;
|
|
704
704
|
}
|
|
705
705
|
export type MemberStatus = 'ACTIVE' | 'BLACKLISTED' | 'SUSPENDED';
|
|
706
|
-
export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'CUSTOM';
|
|
706
|
+
export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'LINK_FACEBOOK_ACCOUNT' | 'LINK_GOOGLE_ACCOUNT' | 'CUSTOM';
|
|
707
707
|
export interface JourneyQuestMilestone {
|
|
708
708
|
id: string;
|
|
709
709
|
type: JourneyQuestMilestoneType;
|
|
@@ -735,6 +735,7 @@ export interface Quest {
|
|
|
735
735
|
bonusAmount?: string;
|
|
736
736
|
firstDepositCompleted?: boolean;
|
|
737
737
|
accountVerificationCompleted?: boolean;
|
|
738
|
+
milestones?: JourneyQuestMilestone[];
|
|
738
739
|
}
|
|
739
740
|
interface TopWinGame {
|
|
740
741
|
id: string;
|