@opexa/portal-components 0.0.713 → 0.0.715
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/AccountInfo/GoogleDisconnect.d.ts +7 -0
- package/dist/components/AccountInfo/GoogleDisconnect.js +11 -0
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .d.ts +1 -0
- package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .js +191 -0
- package/dist/components/KYC/KYCVerificationStatus.lazy.js +4 -7
- package/dist/components/PortalProvider/AndroidRoutingHandler.js +3 -0
- package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
- package/dist/components/PortalProvider/PushNotifications.js +16 -8
- package/dist/components/Quests/JourneyQuest.js +14 -1
- package/dist/constants/EnvVar.d.ts +1 -1
- package/dist/icons/Link01Icon.d.ts +2 -0
- package/dist/icons/Link01Icon.js +4 -0
- package/dist/icons/LinkBrokenIcon.d.ts +2 -0
- package/dist/icons/LinkBrokenIcon.js +4 -0
- package/dist/types/index.d.ts +1 -1
- 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/Menu/Menu.d.ts +144 -144
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.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/package.json +174 -174
- package/dist/components/Banner/Banner.client.d.ts +0 -12
- package/dist/components/Banner/Banner.client.js +0 -49
- package/dist/components/PortalProvider/AndroidOnlyComponents.d.ts +0 -1
- package/dist/components/PortalProvider/AndroidOnlyComponents.js +0 -12
- 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/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,7 @@
|
|
|
1
|
+
import { type UseDisclosureReturn } from '../../client/hooks/useDisclosure';
|
|
2
|
+
interface GoogleDisconnectProps {
|
|
3
|
+
onConfirmAction?: (ctx: UseDisclosureReturn) => React.ReactNode;
|
|
4
|
+
children?: (ctx: UseDisclosureReturn) => React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function GoogleDisconnect(props: GoogleDisconnectProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useDisclosure, } from '../../client/hooks/useDisclosure.js';
|
|
4
|
+
import { LinkBrokenIcon } from '../../icons/LinkBrokenIcon.js';
|
|
5
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
6
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
7
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
8
|
+
export function GoogleDisconnect(props) {
|
|
9
|
+
const disclosure = useDisclosure();
|
|
10
|
+
return (_jsxs(_Fragment, { children: [props.children?.(disclosure), _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: disclosure.open, onOpenChange: (details) => disclosure.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 max-w-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBrokenIcon, {}) }), _jsx("h2", { className: "mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx("p", { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx("div", { className: "pt-6", children: props.onConfirmAction?.(disclosure) })] }) })] }) })] }));
|
|
11
|
+
}
|
package/dist/components/DepositWithdrawal/Deposit/GCashWebpayDeposit /GCashWebpayDeposit .d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function GCashWebpayDeposit(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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 invariant from 'tiny-invariant';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { useShallow } from 'zustand/shallow';
|
|
9
|
+
import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
|
|
10
|
+
import { useCreateGCashWebpayDepositMutation } from '../../../../client/hooks/useCreateGCashWebpayDepositMutation.js';
|
|
11
|
+
import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
|
|
12
|
+
import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
|
|
13
|
+
import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
|
|
14
|
+
import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
|
|
15
|
+
import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
|
|
16
|
+
import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
|
|
17
|
+
import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
|
|
18
|
+
import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
|
|
19
|
+
import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
|
|
20
|
+
import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
|
|
21
|
+
import { XIcon } from '../../../../icons/XIcon.js';
|
|
22
|
+
import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
|
|
23
|
+
import { Button } from '../../../../ui/Button/index.js';
|
|
24
|
+
import { Field } from '../../../../ui/Field/index.js';
|
|
25
|
+
import { NumberInput } from '../../../../ui/NumberInput/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 { AvailablePromos } from '../AvailablePromos.js';
|
|
31
|
+
export function GCashWebpayDeposit() {
|
|
32
|
+
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
33
|
+
const disclosure = useDisclosure();
|
|
34
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
35
|
+
depositWithdrawal: ctx.depositWithdrawal,
|
|
36
|
+
kycVerificationStatus: ctx.kycVerificationStatus,
|
|
37
|
+
})));
|
|
38
|
+
const verificationQuery = useMemberVerificationQuery();
|
|
39
|
+
const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
|
|
40
|
+
const [status, setStatus] = useState('waiting');
|
|
41
|
+
const createDepositMutation = useCreateGCashWebpayDepositMutation({
|
|
42
|
+
onMutate() {
|
|
43
|
+
disclosure.setOpen(true);
|
|
44
|
+
setStatus('processing');
|
|
45
|
+
},
|
|
46
|
+
onSuccess(data) {
|
|
47
|
+
invariant(data.checkoutUrl);
|
|
48
|
+
window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
|
|
49
|
+
form.reset();
|
|
50
|
+
disclosure.setOpen(false);
|
|
51
|
+
},
|
|
52
|
+
onError() {
|
|
53
|
+
disclosure.setOpen(true);
|
|
54
|
+
setStatus('failed');
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
|
|
58
|
+
enabled: createDepositMutation.data != null,
|
|
59
|
+
refetchInterval(ctx) {
|
|
60
|
+
if (ctx.state.data?.status === 'CANCELLED' ||
|
|
61
|
+
ctx.state.data?.status === 'CONFIRMED') {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return 2500;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (depositQuery.data?.status === 'CANCELLED') {
|
|
71
|
+
disclosure.setOpen(true);
|
|
72
|
+
setStatus('failed');
|
|
73
|
+
}
|
|
74
|
+
else if (depositQuery.data?.status === 'CONFIRMED') {
|
|
75
|
+
disclosure.setOpen(true);
|
|
76
|
+
setStatus('success');
|
|
77
|
+
}
|
|
78
|
+
}, [depositQuery.data?.status, disclosure]);
|
|
79
|
+
const depositsCountQuery = useDepositsCountQuery();
|
|
80
|
+
const depositsCount = depositsCountQuery.data ?? 0;
|
|
81
|
+
const paymentSettingsQuery = usePaymentSettingsQuery();
|
|
82
|
+
const paymentSettings = paymentSettingsQuery.data;
|
|
83
|
+
const gatewaySettings = paymentSettings?.gcashWebpayDepositGatewaySettings;
|
|
84
|
+
const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
|
|
85
|
+
const minimumAmount = depositsCount <= 0
|
|
86
|
+
? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
|
|
87
|
+
: parseDecimal(gatewaySettings?.minimumAmount, 0);
|
|
88
|
+
const promosQuery = useAvailablePromosQuery();
|
|
89
|
+
const promos = promosQuery.data ?? [];
|
|
90
|
+
const definition = z
|
|
91
|
+
.object({
|
|
92
|
+
amount: z.string().superRefine((val, ctx) => {
|
|
93
|
+
const n = parseDecimal(val, 0);
|
|
94
|
+
if (n < minimumAmount) {
|
|
95
|
+
ctx.addIssue({
|
|
96
|
+
type: 'number',
|
|
97
|
+
code: z.ZodIssueCode.too_small,
|
|
98
|
+
inclusive: true,
|
|
99
|
+
minimum: minimumAmount,
|
|
100
|
+
message: `Minimum amount is ${minimumAmount.toLocaleString()}`,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (n > maximumAmount) {
|
|
104
|
+
ctx.addIssue({
|
|
105
|
+
type: 'number',
|
|
106
|
+
code: z.ZodIssueCode.too_big,
|
|
107
|
+
inclusive: true,
|
|
108
|
+
maximum: maximumAmount,
|
|
109
|
+
message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
promo: z.string().optional().nullable(),
|
|
114
|
+
})
|
|
115
|
+
.superRefine((value, ctx) => {
|
|
116
|
+
const promo = promos.find((o) => o.id === value.promo);
|
|
117
|
+
const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
|
|
118
|
+
const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
|
|
119
|
+
const amount = parseDecimal(value.amount, 0);
|
|
120
|
+
if (promo && amount < promoMinAmount) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
path: ['amount'],
|
|
123
|
+
code: z.ZodIssueCode.custom,
|
|
124
|
+
message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (promo && amount > promoMaxAmount) {
|
|
128
|
+
ctx.addIssue({
|
|
129
|
+
path: ['amount'],
|
|
130
|
+
code: z.ZodIssueCode.custom,
|
|
131
|
+
message: `Maximum amount for this promo is ${promoMaxAmount}`,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const form = useForm({
|
|
136
|
+
mode: 'all',
|
|
137
|
+
resolver: zodResolver(definition),
|
|
138
|
+
defaultValues: {
|
|
139
|
+
amount: '0',
|
|
140
|
+
promo: globalStore.depositWithdrawal.promo ?? null,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (minimumAmount) {
|
|
145
|
+
form.reset({
|
|
146
|
+
amount: minimumAmount.toString(),
|
|
147
|
+
promo: form.getValues('promo') ?? null,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}, [form, minimumAmount]);
|
|
151
|
+
return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
|
|
152
|
+
//handle new kyc process
|
|
153
|
+
if (verificationStatus === 'PENDING' ||
|
|
154
|
+
verificationStatus === 'UNVERIFIED' ||
|
|
155
|
+
verificationStatus === 'REJECTED' ||
|
|
156
|
+
verificationStatus === 'CREATED') {
|
|
157
|
+
globalStore.kycVerificationStatus.setOpen(true);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
createDepositMutation.reset();
|
|
162
|
+
createDepositMutation.mutate({
|
|
163
|
+
amount: data.amount.toString(),
|
|
164
|
+
promo: data.promo ?? undefined,
|
|
165
|
+
successRedirectionUrl: window.location.origin,
|
|
166
|
+
cancelRedirectionUrl: window.location.origin,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}), noValidate: true, children: [_jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
|
|
170
|
+
o.field.onChange(details.value);
|
|
171
|
+
}, formatOptions: {
|
|
172
|
+
maximumFractionDigits: 2,
|
|
173
|
+
minimumFractionDigits: 0,
|
|
174
|
+
}, 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) => {
|
|
175
|
+
form.setValue('amount', value.toString(), {
|
|
176
|
+
shouldTouch: true,
|
|
177
|
+
shouldDirty: true,
|
|
178
|
+
shouldValidate: true,
|
|
179
|
+
});
|
|
180
|
+
}, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
|
|
181
|
+
o.field.onChange(value);
|
|
182
|
+
globalStore.depositWithdrawal.setPromo(null);
|
|
183
|
+
}, 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) => {
|
|
184
|
+
disclosure.setOpen(details.open);
|
|
185
|
+
}, 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, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
|
|
186
|
+
"We're verifying your account and amount. Please hold a moment.", status === 'success' &&
|
|
187
|
+
'Your deposit has been successfully processed.', status === 'failed' &&
|
|
188
|
+
'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
|
|
189
|
+
api.setOpen(false);
|
|
190
|
+
}, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
|
|
191
|
+
}
|
|
@@ -19,18 +19,15 @@ export function KYCVerificationStatus() {
|
|
|
19
19
|
const icons = status === 'PENDING' ? bellIcon : alertIcon;
|
|
20
20
|
return (_jsx(Dialog.Root, { open: globalStore.kycVerificationStatus.open, onOpenChange: (details) => {
|
|
21
21
|
globalStore.kycVerificationStatus.setOpen(details.open);
|
|
22
|
-
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED'
|
|
23
|
-
(status === 'CREATED' && 'Verification Required')] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
22
|
+
}, closeOnEscape: false, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsx(Dialog.Content, { className: "mx-auto h-fit w-[450px] overflow-y-auto rounded-lg bg-bg-primary", children: _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mb-3xl grid h-[200px] w-full place-items-center rounded-xl bg-radial from-40% from-button-primary-bg to-bg-brand-solid", children: _jsx(Image, { src: icons, alt: "icon", className: "w-60 object-contain", draggable: false, width: 120, height: 120 }) }), _jsxs("h1", { className: "font-semibold text-lg text-white", children: [status === 'PENDING' && 'Verification in Progress', status === 'REJECTED' && 'Verification Rejected', status === 'UNVERIFIED' && 'Verification Required'] }), _jsxs("p", { className: "mb-4xl text-[#94969C] text-base", children: [status === 'PENDING' &&
|
|
24
23
|
`Your account verification is still under review. Please wait
|
|
25
24
|
until it's approved before you can continue playing or
|
|
26
25
|
depositing.`, status === 'REJECTED' &&
|
|
27
|
-
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED'
|
|
28
|
-
(status === '
|
|
29
|
-
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.')] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
26
|
+
'Your account verification was not approved. Please resubmit your verification to regain full access.', status === 'UNVERIFIED' &&
|
|
27
|
+
'Your account is not yet verified. Please complete the verification process to continue playing or depositing.'] }), _jsxs(Button, { variant: "solid", className: twMerge('mb-2 w-full', status === 'PENDING' && 'hidden'), onClick: () => {
|
|
30
28
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
31
29
|
globalStore.kyc.setOpen(true);
|
|
32
|
-
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED'
|
|
33
|
-
(status === 'CREATED' && 'Verify Now')] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
30
|
+
}, children: [status === 'REJECTED' && 'Resubmit Verification', status === 'UNVERIFIED' && 'Verify Now'] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
34
31
|
globalStore.kycVerificationStatus.setOpen(false);
|
|
35
32
|
}, children: "Close" })] }) }) })] }) }));
|
|
36
33
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { addHours } from 'date-fns';
|
|
3
3
|
import { clamp } from 'lodash-es';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
4
5
|
import { useLocalStorage, useTimeout } from 'usehooks-ts';
|
|
5
6
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
6
7
|
export function CXDTokenObserver() {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const [cxd, setCxd, removeCxd] = useLocalStorage('
|
|
8
|
+
const searchParams = useSearchParams();
|
|
9
|
+
const cxdToken = searchParams.get('cxd');
|
|
10
|
+
const accountQuery = useAccountQuery();
|
|
11
|
+
const account = accountQuery.data;
|
|
12
|
+
const [cxd, setCxd, removeCxd] = useLocalStorage('WebPortalCellxpertCxd', null);
|
|
12
13
|
const now = new Date();
|
|
14
|
+
const shouldTimeoutRun = cxdToken && account;
|
|
13
15
|
const removeCxdUntilInMs = cxd?.timestamp
|
|
14
16
|
? clamp(cxd.timestamp - now.getTime(), 0, Infinity)
|
|
15
17
|
: 0;
|
|
16
18
|
useTimeout(() => {
|
|
17
|
-
const isSame = cxd?.cxd ===
|
|
19
|
+
const isSame = cxd?.cxd === cxdToken;
|
|
18
20
|
if (!isSame) {
|
|
19
21
|
const extendedTimestamp = addHours(new Date(), 6).getTime();
|
|
20
22
|
setCxd({
|
|
21
|
-
cxd:
|
|
23
|
+
cxd: cxdToken,
|
|
22
24
|
timestamp: extendedTimestamp,
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
|
-
},
|
|
26
|
-
useTimeout(() =>
|
|
27
|
-
removeCxd();
|
|
28
|
-
}, account ? removeCxdUntilInMs : null);
|
|
27
|
+
}, shouldTimeoutRun ? 100 : null);
|
|
28
|
+
useTimeout(() => removeCxd(), shouldTimeoutRun ? removeCxdUntilInMs : null);
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { App } from '@capacitor/app';
|
|
2
3
|
import { Capacitor } from '@capacitor/core';
|
|
3
4
|
import { PushNotifications } from '@capacitor/push-notifications';
|
|
4
5
|
import { useEffect } from 'react';
|
|
@@ -11,14 +12,21 @@ export const PushNotification = () => {
|
|
|
11
12
|
const platform = Capacitor.getPlatform();
|
|
12
13
|
if (platform === 'web')
|
|
13
14
|
return;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
const checkAndRegister = async () => {
|
|
16
|
+
PushNotifications.requestPermissions().then((permission) => {
|
|
17
|
+
if (permission.receive === 'granted') {
|
|
18
|
+
PushNotifications.register();
|
|
19
|
+
console.info('✅ Push permission granted');
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.warn('⚠️ Push permission denied');
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
checkAndRegister();
|
|
27
|
+
App.addListener('resume', () => {
|
|
28
|
+
checkAndRegister();
|
|
29
|
+
console.log('App resumed - checking push notification permissions');
|
|
22
30
|
});
|
|
23
31
|
PushNotifications.addListener('registration', async ({ value }) => {
|
|
24
32
|
console.info('✅ Push registration success');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { isString } from 'lodash-es';
|
|
3
3
|
import dynamic from 'next/dynamic';
|
|
4
|
+
import Link from 'next/link';
|
|
4
5
|
import { useCallback, useMemo } from 'react';
|
|
5
6
|
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
import { useShallow } from 'zustand/react/shallow';
|
|
@@ -9,9 +10,11 @@ import { useDisclosure } from '../../client/hooks/useDisclosure.js';
|
|
|
9
10
|
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
10
11
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
11
12
|
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
13
|
+
import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
12
14
|
import { CheckIcon } from '../../icons/CheckIcon.js';
|
|
13
15
|
import { CoinsHandIcon } from '../../icons/CoinsHandIcon.js';
|
|
14
16
|
import { FileCheck02Icon } from '../../icons/FileCheck02Icon.js';
|
|
17
|
+
import { Link01Icon } from '../../icons/Link01Icon.js';
|
|
15
18
|
import { XIcon } from '../../icons/XIcon.js';
|
|
16
19
|
import { Badge } from '../../ui/Badge/index.js';
|
|
17
20
|
import { Button } from '../../ui/Button/index.js';
|
|
@@ -115,6 +118,8 @@ function Rules(props) {
|
|
|
115
118
|
return false;
|
|
116
119
|
return milestones.every((milestone) => milestone.isCompleted);
|
|
117
120
|
}, [milestones]);
|
|
121
|
+
const sessionQuery = useSessionQuery();
|
|
122
|
+
const session = sessionQuery.data;
|
|
118
123
|
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 p-4", children: _jsxs(Dialog.Content, { className: twMerge('mx-auto max-h-[80vh] min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-10 md:scrollbar:h-2 md:scrollbar:w-2 md:scrollbar-thumb:rounded-full md:scrollbar-thumb:bg-bg-quaternary md:scrollbar-track:bg-transparent', props.className?.root), 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' }), _jsxs("div", { className: "relative", children: [_jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
|
|
119
124
|
__html: quest.description,
|
|
120
125
|
} })) : (_jsx("p", { children: "Ready for a challenge? Complete them all and get amazing rewards!" })) }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-safe-area-inset-bottom h-8 bg-gradient-to-t from-bg-primary to-transparent" })] }), milestones.map((milestone) => (_jsxs("div", { className: twMerge('flex flex-col space-y-2.5 rounded-xl bg-bg-tertiary p-3', props.className?.milestone), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: twMerge('font-medium text-base text-text-primary-900', props.className?.milestoneName), children: milestone.label }), milestone.isCompleted && (_jsx("div", { className: twMerge('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', props.className?.completeBadge), children: "Complete" }))] }), milestone.description ? (_jsx(Prose, { className: props.className?.milestoneDescription, dangerouslySetInnerHTML: {
|
|
@@ -140,7 +145,15 @@ function Rules(props) {
|
|
|
140
145
|
? 'Deposit'
|
|
141
146
|
: 'Verify Account'] })), !milestone.isCompleted &&
|
|
142
147
|
milestone.key === 'LINK_FACEBOOK_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Facebook Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(FacebookSignInTrigger, { text: "Link Facebook Account", className: "!mt-0 flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] })), !milestone.isCompleted &&
|
|
143
|
-
milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Google Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(GoogleSignInButton, { text: "Link Google Account", className: "flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] }))
|
|
148
|
+
milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Google Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(GoogleSignInButton, { text: "Link Google Account", className: "flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] })), !milestone.isCompleted &&
|
|
149
|
+
milestone.key === 'CUSTOM_LINK' &&
|
|
150
|
+
(() => {
|
|
151
|
+
const baseUrl = process.env.NEXT_PUBLIC_ENVIRONMENT === 'development'
|
|
152
|
+
? 'https://api.trigger.development.opexa.io'
|
|
153
|
+
: 'https://api.trigger.opexa.io';
|
|
154
|
+
const linkUrl = `${baseUrl}/v1/quests/${quest?.id}/milestones/${milestone.id}/link?token=${session?.token}`;
|
|
155
|
+
return (_jsx(Button, { size: "sm", "aria-label": `Complete ${milestone.label}`, asChild: true, children: _jsxs(Link, { href: linkUrl, target: "_blank", rel: "noopener noreferrer", children: ["Click Here", _jsx(Link01Icon, { className: "size-5" })] }) }));
|
|
156
|
+
})()] }, 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: twMerge('w-full rounded-md border border-bg-primary-hover bg-button-secondary-bg px-3.5 py-2.5 text-center text-white', props.className?.uncompleteButton), children: _jsxs("p", { children: ["Complete target to", ' ', _jsxs("span", { className: "text-brand-400", children: ["\u20B1", quest?.bonus] }), ' ', "bonus!"] }) })) }))] })] }) })] }) }));
|
|
144
157
|
}
|
|
145
158
|
function QuestMilestone({ label, bonus, isCompleted = false, checkboxControlStyle, className, }) {
|
|
146
159
|
const localeInfo = useLocaleInfo();
|
|
@@ -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: "development" | "production";
|
|
5
5
|
export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function Link01Icon(props) {
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: _jsx("path", { d: "m12.708 18.364-1.415 1.414a5 5 0 1 1-7.07-7.07l1.413-1.415m12.728 1.414 1.415-1.414a5 5 0 0 0-7.071-7.071l-1.415 1.414M8.5 15.5l7-7" }) }));
|
|
4
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function LinkBrokenIcon(props) {
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", ...props, children: _jsx("path", { d: "M8.5 15.5L15.5 8.49998M9 4V2M15 20V22M4 9H2M20 15H22M4.91421 4.91421L3.5 3.5M19.0858 19.0857L20.5 20.4999M12 17.6568L9.87871 19.7781C8.31662 21.3402 5.78396 21.3402 4.22186 19.7781C2.65976 18.216 2.65976 15.6833 4.22186 14.1212L6.34318 11.9999M17.6569 11.9999L19.7782 9.87859C21.3403 8.31649 21.3403 5.78383 19.7782 4.22174C18.2161 2.65964 15.6835 2.65964 14.1214 4.22174L12 6.34306", stroke: "#FEDF89", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
4
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -722,7 +722,7 @@ export interface QuestProgram {
|
|
|
722
722
|
description: string;
|
|
723
723
|
}
|
|
724
724
|
export type MemberStatus = 'ACTIVE' | 'BLACKLISTED' | 'SUSPENDED';
|
|
725
|
-
export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'LINK_FACEBOOK_ACCOUNT' | 'LINK_GOOGLE_ACCOUNT' | 'CUSTOM';
|
|
725
|
+
export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'LINK_FACEBOOK_ACCOUNT' | 'LINK_GOOGLE_ACCOUNT' | 'CUSTOM_LINK' | 'CUSTOM';
|
|
726
726
|
export interface JourneyQuestMilestone {
|
|
727
727
|
id: string;
|
|
728
728
|
type: JourneyQuestMilestoneType;
|