@opexa/portal-components 0.0.897 → 0.0.899
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/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/PaymentMethods.d.ts +10 -0
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/PaymentMethods.js +47 -0
- package/dist/components/DepositWithdrawal/Withdrawal/VentajaWithdrawal/VentajaWithdrawal.js +1 -1
- package/dist/components/DepositWithdrawal/utils.d.ts +2 -0
- package/dist/components/DepositWithdrawal/utils.js +11 -0
- package/dist/components/KYC/KYCNonPagCor/IdentityVerification.js +6 -0
- package/dist/components/Quests/JourneyQuest.d.ts +10 -0
- package/dist/components/Quests/JourneyQuest.js +12 -5
- package/dist/components/Quests/RemainingTime.d.ts +7 -1
- package/dist/components/Quests/RemainingTime.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const AurixPayQRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
status: "
|
|
3
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
4
4
|
deposit: import("../../../../types").Deposit | null;
|
|
5
5
|
errorMessage: {
|
|
6
6
|
name: string;
|
|
@@ -13,7 +13,7 @@ export declare const AurixPayQRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useAurixPayQRPHDepositContext: () => {
|
|
16
|
-
status: "
|
|
16
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
17
17
|
deposit: import("../../../../types").Deposit | null;
|
|
18
18
|
errorMessage: {
|
|
19
19
|
name: string;
|
package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
|
|
|
5
5
|
promo?: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function useAurixPayQRPHDeposit(): {
|
|
8
|
-
status: "
|
|
8
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
9
9
|
deposit: Deposit | null;
|
|
10
10
|
errorMessage: {
|
|
11
11
|
name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
status: "
|
|
3
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
4
4
|
deposit: import("../../../../types").Deposit | null;
|
|
5
5
|
errorMessage: {
|
|
6
6
|
name: string;
|
|
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
status: "
|
|
16
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
17
17
|
deposit: import("../../../../types").Deposit | null;
|
|
18
18
|
errorMessage: {
|
|
19
19
|
name: string;
|
|
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
|
|
|
5
5
|
promo?: string | null;
|
|
6
6
|
}
|
|
7
7
|
export declare function useQRPHDeposit(): {
|
|
8
|
-
status: "
|
|
8
|
+
status: "failed" | "idle" | "generating-qr-code" | "qr-code-generated" | "confirmed";
|
|
9
9
|
deposit: Deposit | null;
|
|
10
10
|
errorMessage: {
|
|
11
11
|
name: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PaymentMethodCrazywin } from '../../utils';
|
|
2
|
+
interface PaymentMethodsProps {
|
|
3
|
+
value?: PaymentMethodCrazywin;
|
|
4
|
+
onChange?: (value: PaymentMethodCrazywin) => void;
|
|
5
|
+
defaultValue?: PaymentMethodCrazywin;
|
|
6
|
+
options?: PaymentMethodCrazywin[];
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function PaymentMethods(props: PaymentMethodsProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
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 instapay from '../../../../images/instapay.png';
|
|
8
|
+
import maya from '../../../../images/maya.png';
|
|
9
|
+
import { Checkbox } from '../../../../ui/Checkbox/index.js';
|
|
10
|
+
import { Field } from '../../../../ui/Field/index.js';
|
|
11
|
+
import { PaymentMethodDefinitionCrazywin, } from '../../utils.js';
|
|
12
|
+
const OPTIONS = [
|
|
13
|
+
{
|
|
14
|
+
value: 'INSTAPAY',
|
|
15
|
+
label: 'Instapay',
|
|
16
|
+
image: instapay,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
value: 'GCASH',
|
|
20
|
+
label: 'GCash',
|
|
21
|
+
image: gcash,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
value: 'MAYA',
|
|
25
|
+
label: 'Maya',
|
|
26
|
+
image: maya,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
export function PaymentMethods(props) {
|
|
30
|
+
const options = props.options?.length
|
|
31
|
+
? OPTIONS.filter((option) => props.options?.includes(option.value))
|
|
32
|
+
: OPTIONS;
|
|
33
|
+
const [value, setValue] = useControllableState({
|
|
34
|
+
value: props.value,
|
|
35
|
+
defaultValue: options[0].value,
|
|
36
|
+
onChange: props.onChange,
|
|
37
|
+
});
|
|
38
|
+
return (_jsxs("div", { className: "mb-6", children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: "Available payment methods" }) }), _jsx(Checkbox.Group, { value: [value], onValueChange: (newValue) => {
|
|
39
|
+
const lastValue = newValue.at(-1);
|
|
40
|
+
if (!lastValue)
|
|
41
|
+
return;
|
|
42
|
+
setValue(PaymentMethodDefinitionCrazywin.parse(lastValue));
|
|
43
|
+
}, 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 bg-white px-sm py-[0.688rem]', option.value === 'GCASH' && 'bg-[#017EFF]'), children: _jsx(Image, { src: option.image, alt: "", width: 200, height: 40, className: twMerge('w-auto', option.value === 'LIBANGAN_PAY_IN' ||
|
|
44
|
+
option.value === 'VENTAJA_DISBURSEMENT'
|
|
45
|
+
? 'h-[2.5rem]'
|
|
46
|
+
: 'h-[1.063rem]'), draggable: false }) }), _jsx(Checkbox.Control, { className: "shrink-0", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }, option.value))) })] }));
|
|
47
|
+
}
|
|
@@ -29,10 +29,10 @@ import { Select } from '../../../../ui/Select/index.js';
|
|
|
29
29
|
import { parseDecimal } from '../../../../utils/parseDecimal.js';
|
|
30
30
|
import { AmountChoices } from '../../AmountChoices.js';
|
|
31
31
|
import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
|
|
32
|
-
import { PaymentMethods } from '../../PaymentMethods.js';
|
|
33
32
|
import { ActiveTurnoverRequirement } from '../ActiveTurnoverRequirement.js';
|
|
34
33
|
import { RequireFirstDeposit } from '../RequireFirstDeposit.js';
|
|
35
34
|
import { TransactionPasswordNotSet } from '../TransactionPasswordNotSet.js';
|
|
35
|
+
import { PaymentMethods } from './PaymentMethods.js';
|
|
36
36
|
export function VentajaWithdrawal() {
|
|
37
37
|
const depositWithdrawalProps = useDepositWithdrawalPropsContext();
|
|
38
38
|
const [paymentMethod, setPaymentMethod] = useState('INSTAPAY');
|
|
@@ -2,5 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import type { KnownDepositError, KnownWithdrawalError, WithdrawalError } from '../../types';
|
|
3
3
|
export declare const PaymentMethodDefinition: z.ZodEnum<["GCASH", "GCASH_STANDARD_CASH_IN", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN_PAY_IN", "VENTAJA_DISBURSEMENT", "PISO_PAY", "AIO_GCASH", "AIO_PAY_MAYA", "AIO_GRAB_PAY", "AIO_PALAWAN_PAY", "GCASH_WEBPAY", "MAYA_WEBPAY", "INSTAPAY_GCASH", "INSTAPAY_PAYMAYA", "AURIX_PAY_GCASH", "AURIX_PAY_PAYMAYA", "AURIX_PAY_GRAB_PAY", "AURIX_PAY_QRPH"]>;
|
|
4
4
|
export type PaymentMethod = z.infer<typeof PaymentMethodDefinition>;
|
|
5
|
+
export declare const PaymentMethodDefinitionCrazywin: z.ZodEnum<["GCASH", "MAYA_APP", "MAYA", "ONLINE_BANK", "QRPH", "INSTAPAY", "LIBANGAN_PAY_IN", "VENTAJA_DISBURSEMENT", "PISO_PAY"]>;
|
|
6
|
+
export type PaymentMethodCrazywin = z.infer<typeof PaymentMethodDefinitionCrazywin>;
|
|
5
7
|
export type DepositWithdrawalErrors = KnownDepositError | KnownWithdrawalError | WithdrawalError | string;
|
|
6
8
|
export declare function explainError(error?: DepositWithdrawalErrors): string;
|
|
@@ -23,6 +23,17 @@ export const PaymentMethodDefinition = z.enum([
|
|
|
23
23
|
'AURIX_PAY_GRAB_PAY',
|
|
24
24
|
'AURIX_PAY_QRPH',
|
|
25
25
|
]);
|
|
26
|
+
export const PaymentMethodDefinitionCrazywin = z.enum([
|
|
27
|
+
'GCASH',
|
|
28
|
+
'MAYA_APP',
|
|
29
|
+
'MAYA',
|
|
30
|
+
'ONLINE_BANK',
|
|
31
|
+
'QRPH',
|
|
32
|
+
'INSTAPAY',
|
|
33
|
+
'LIBANGAN_PAY_IN',
|
|
34
|
+
'VENTAJA_DISBURSEMENT',
|
|
35
|
+
'PISO_PAY',
|
|
36
|
+
]);
|
|
26
37
|
const errorMap = {
|
|
27
38
|
DAILY_PURCHASE_OR_DEPOSIT_LIMIT_EXCEEDED: 'You have exceeded your daily purchase or deposit limit. Please try again tomorrow.',
|
|
28
39
|
INSUFFICIENT_BALANCE: 'You have insufficient balance for this transaction.',
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Capacitor } from '@capacitor/core';
|
|
4
4
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
5
|
+
import { ObjectId } from '@opexa/object-id';
|
|
5
6
|
import { useRouter } from 'next/navigation';
|
|
6
7
|
import { useEffect } from 'react';
|
|
7
8
|
import { Controller, useForm } from 'react-hook-form';
|
|
@@ -16,6 +17,7 @@ import { useSignOutMutation } from '../../../client/hooks/useSignOutMutation.js'
|
|
|
16
17
|
import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
|
|
17
18
|
import { getSession } from '../../../client/services/getSession.js';
|
|
18
19
|
import { toaster } from '../../../client/utils/toaster.js';
|
|
20
|
+
import { ObjectType } from '../../../services/ObjectType.js';
|
|
19
21
|
import { unregisterFCMDevice } from '../../../services/trigger.js';
|
|
20
22
|
import { Button } from '../../../ui/Button/index.js';
|
|
21
23
|
import { Dialog } from '../../../ui/Dialog/index.js';
|
|
@@ -106,6 +108,7 @@ export function IdentityVerification() {
|
|
|
106
108
|
},
|
|
107
109
|
});
|
|
108
110
|
async function onSubmit(values) {
|
|
111
|
+
//if member verification id is not available (first time doing kyc to trigger notifications)
|
|
109
112
|
if (!memberId) {
|
|
110
113
|
createMemberVerification({
|
|
111
114
|
selfieImage: values.selfieImage,
|
|
@@ -117,7 +120,10 @@ export function IdentityVerification() {
|
|
|
117
120
|
placeOfBirth: '',
|
|
118
121
|
sourceOfIncome: '',
|
|
119
122
|
});
|
|
123
|
+
const id = ObjectId.generate(ObjectType.MemberVerification).toString();
|
|
124
|
+
await approveMemberVerificationMutation.mutateAsync(id);
|
|
120
125
|
}
|
|
126
|
+
//if member verification id is available (updating kyc)
|
|
121
127
|
else {
|
|
122
128
|
updateMemberVerification({
|
|
123
129
|
id: memberId,
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { type CSSProperties } from 'react';
|
|
2
2
|
export interface ClassNameEntries {
|
|
3
3
|
root?: string;
|
|
4
|
+
completedBadgeRoot?: string;
|
|
5
|
+
completedBadgeLabel?: string;
|
|
6
|
+
failedBadgeRoot?: string;
|
|
7
|
+
failedBadgeLabel?: string;
|
|
8
|
+
progressRoot?: string;
|
|
9
|
+
progressTrack?: string;
|
|
10
|
+
progressRange?: string;
|
|
11
|
+
progressLabel?: string;
|
|
4
12
|
checkboxName?: string;
|
|
5
13
|
checkboxBonus?: string;
|
|
6
14
|
dialogRoot?: string;
|
|
15
|
+
dialogTitle?: string;
|
|
16
|
+
dialogDescription?: string;
|
|
7
17
|
dialogMilestone?: string;
|
|
8
18
|
dialogMilestoneName?: string;
|
|
9
19
|
dialogMilestoneDescription?: string;
|
|
@@ -85,13 +85,20 @@ export function JourneyQuest(props) {
|
|
|
85
85
|
disclosure.setOpen(true);
|
|
86
86
|
}, [disclosure]);
|
|
87
87
|
const localeInfo = useLocaleInfo();
|
|
88
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-center justify-between", children: [_jsx(RemainingTime, { endOfDay: true
|
|
88
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-center justify-between", children: [_jsx(RemainingTime, { endOfDay: true, className: {
|
|
89
|
+
completedBadgeRoot: classNames?.completedBadgeRoot,
|
|
90
|
+
completedBadgeLabel: classNames?.completedBadgeLabel,
|
|
91
|
+
failedBadgeRoot: classNames?.failedBadgeRoot,
|
|
92
|
+
failedBadgeLabel: classNames?.failedBadgeLabel,
|
|
93
|
+
} }), quest.status === 'COMPLETED' && (_jsx(Badge.Root, { colorScheme: "success", size: "lg", round: false, children: _jsxs(Badge.Label, { children: ["Final Bonus:", ' ', formatNumber(quest.bonus, {
|
|
89
94
|
currency: localeInfo.currency.code,
|
|
90
|
-
})] }) }))] }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className:
|
|
95
|
+
})] }) }))] }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: twMerge('h-2 rounded-full bg-bg-primary', classNames?.progressRoot), value: progressValue, children: _jsx(Progress.Track, { className: classNames?.progressTrack, children: _jsx(Progress.Range, { className: classNames?.progressRange }) }) }), _jsxs("p", { className: twMerge('text-text-quarterary-brand text-xs', classNames?.progressLabel), children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone, index) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted, checkboxControlStyle: props.checkboxControlStyle, className: {
|
|
91
96
|
name: classNames?.checkboxName,
|
|
92
97
|
bonus: classNames?.checkboxBonus,
|
|
93
98
|
} }, index))) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "aria-label": "View Details", disabled: false, className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) })] }), _jsx(Rules, { open: disclosure.open, onOpenChange: disclosure.setOpen, quest: quest, milestones: milestones, className: {
|
|
94
99
|
root: classNames?.dialogRoot,
|
|
100
|
+
title: classNames?.dialogTitle,
|
|
101
|
+
description: classNames?.dialogDescription,
|
|
95
102
|
milestone: classNames?.dialogMilestone,
|
|
96
103
|
milestoneName: classNames?.dialogMilestoneName,
|
|
97
104
|
milestoneDescription: classNames?.dialogMilestoneDescription,
|
|
@@ -124,9 +131,9 @@ function Rules(props) {
|
|
|
124
131
|
}, [milestones]);
|
|
125
132
|
const sessionQuery = useSessionQuery();
|
|
126
133
|
const session = sessionQuery.data;
|
|
127
|
-
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:
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
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: twMerge('font-semibold text-lg text-text-primary-900', props.className?.title), children: quest?.name || 'Quest' }), _jsx("div", { className: "relative", children: _jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
|
|
135
|
+
__html: quest.description,
|
|
136
|
+
}, className: twMerge('mb-3', props.className?.description) })) : (_jsx("p", { className: twMerge(props.className?.description), children: "Ready for a challenge? Complete them all and get amazing rewards!" })) }) }), milestones.map((milestone) => {
|
|
130
137
|
const milestoneType = quest?.milestones?.find((m) => m.id === milestone.id)?.type;
|
|
131
138
|
const accountVerificationMessage = milestoneType === 'ACCOUNT_VERIFICATION'
|
|
132
139
|
? verificationStatus === 'PENDING'
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
interface RemainingTimeProps {
|
|
2
2
|
endOfDay?: boolean;
|
|
3
|
+
className?: {
|
|
4
|
+
completedBadgeRoot?: string;
|
|
5
|
+
completedBadgeLabel?: string;
|
|
6
|
+
failedBadgeRoot?: string;
|
|
7
|
+
failedBadgeLabel?: string;
|
|
8
|
+
};
|
|
3
9
|
}
|
|
4
|
-
export declare function RemainingTime({ endOfDay: useEndOfDay, }: RemainingTimeProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function RemainingTime({ endOfDay: useEndOfDay, className, }: RemainingTimeProps): import("react/jsx-runtime").JSX.Element;
|
|
5
11
|
export {};
|
|
@@ -4,17 +4,17 @@ import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
|
|
|
4
4
|
import { ClockStopWatchIcon } from '../../icons/ClockStopWatchIcon.js';
|
|
5
5
|
import { Badge } from '../../ui/Badge/index.js';
|
|
6
6
|
import { useQuestContext } from './QuestsContext.js';
|
|
7
|
-
export function RemainingTime({ endOfDay: useEndOfDay = false, }) {
|
|
7
|
+
export function RemainingTime({ endOfDay: useEndOfDay = false, className, }) {
|
|
8
8
|
const quest = useQuestContext();
|
|
9
9
|
const targetDateTime = useEndOfDay
|
|
10
10
|
? endOfDay(new Date(quest.endDateTime)).toISOString()
|
|
11
11
|
: quest.endDateTime;
|
|
12
12
|
const remainingTime = useRemainingTime(targetDateTime);
|
|
13
13
|
if (quest.status === 'COMPLETED') {
|
|
14
|
-
return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, children: _jsx(Badge.Label, { children: "Completed" }) }));
|
|
14
|
+
return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, className: className?.completedBadgeRoot, children: _jsx(Badge.Label, { className: className?.completedBadgeLabel, children: "Completed" }) }));
|
|
15
15
|
}
|
|
16
16
|
if (quest.status === 'FAILED' || remainingTime.expired) {
|
|
17
|
-
return (_jsx(Badge.Root, { size: "lg", colorScheme: "danger", round: false, children: _jsx(Badge.Label, { children: "Failed" }) }));
|
|
17
|
+
return (_jsx(Badge.Root, { size: "lg", colorScheme: "danger", round: false, className: className?.failedBadgeRoot, children: _jsx(Badge.Label, { className: className?.failedBadgeLabel, children: "Failed" }) }));
|
|
18
18
|
}
|
|
19
19
|
return (_jsxs(Badge.Root, { size: "lg", colorScheme: "brand", round: false, children: [_jsx(Badge.Icon, { children: _jsx(ClockStopWatchIcon, {}) }), _jsx(Badge.Label, { children: remainingTime.toString() })] }));
|
|
20
20
|
}
|