@opexa/portal-components 0.0.1093 → 0.0.1095

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.
@@ -55,9 +55,11 @@ export function KYCReminder(props) {
55
55
  const { data: account, isLoading: accountLoading } = useAccountQuery();
56
56
  const isPending = account?.verification?.status === 'PENDING';
57
57
  const isRejected = account?.verification?.status === 'REJECTED';
58
- const isNotVerified = !account?.verification ||
59
- account?.verification?.status === 'UNVERIFIED' ||
60
- account?.verification?.status === 'CREATED';
58
+ const isNotVerified = !!account &&
59
+ (!account.verification ||
60
+ account.verification === null ||
61
+ account.verification.status === 'UNVERIFIED' ||
62
+ account.verification.status === 'CREATED');
61
63
  const isVerificationLocked = account?.status === 'VERIFICATION_LOCKED';
62
64
  const daysFromCreationToNow = useMemo(() => {
63
65
  if (!account?.dateTimeCreated)
@@ -134,17 +136,16 @@ export function KYCReminder(props) {
134
136
  globalStore.account.setOpen(false);
135
137
  globalStore.account__mobile.setOpen(false);
136
138
  router.push('/');
137
- }, children: "Log Out" })] })) })] })] })), isNotVerified ||
138
- (isRejected &&
139
- !isVerificationLocked &&
140
- !(daysFromCreationToNow <= 3 && daysFromCreationToNow > 1) && (_jsxs(_Fragment, { children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto w-fit rounded-full bg-bg-primary p-2", children: _jsx(FileCheck02Icon, { className: "text-[#FEDF89]" }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "Personal Verification" }), _jsxs("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: ["All new users are required to complete identity verification to access the full range of", ' ', props.siteName, " services, including withdrawals."] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "mt-3xl space-y-lg", children: [_jsx(Button, { onClick: () => {
141
- api.setOpen(false);
142
- globalStore.kyc.setOpen(true);
143
- globalStore.kycReminder.setOpen(false);
144
- }, children: "Verify Now" }), _jsx(Button, { type: "button", variant: "outline", fullWidth: true, onClick: () => {
145
- api.setOpen(false);
146
- globalStore.responsibleGamingReminder.setOpen(true);
147
- }, children: "Do it later" })] })) })] })] }))), isPending && isVerificationLocked && (_jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto mb-4 w-fit rounded-full bg-bg-primary p-2", children: _jsx(Image, { src: props.logo, alt: `${props.siteName} logo`, width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "VERIFICATION IN PROGRESS" }), _jsx("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: "Your account is verification-locked. Please wait for approval to regain full access to this platform." }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: props.pagcorLogo?.logo ?? pagcorLogo, alt: "PAGCOR logo", height: 88, width: 88, className: `h-[88px] w-auto shrink-0 ${props.pagcorLogo?.styles ?? ''}`, draggable: false, unoptimized: true }), _jsx(Image, { src: props.responsibleGamingLogo?.logo ?? responsibleGamingLogo, alt: "Responsible Gaming logo", height: 50, width: 186, className: `h-[50px] w-auto shrink-0 ${props.responsibleGamingLogo?.styles ?? ''}`, draggable: false, unoptimized: true })] }), _jsx("div", { className: "mt-6 space-y-lg", children: _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: async () => {
139
+ }, children: "Log Out" })] })) })] })] })), (isNotVerified || isRejected) &&
140
+ !isVerificationLocked &&
141
+ !(daysFromCreationToNow <= 3 && daysFromCreationToNow > 1) && (_jsxs(_Fragment, { children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto w-fit rounded-full bg-bg-primary p-2", children: _jsx(FileCheck02Icon, { className: "text-[#FEDF89]" }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "Personal Verification" }), _jsxs("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: ["All new users are required to complete identity verification to access the full range of ", props.siteName, ' ', "services, including withdrawals."] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "mt-3xl space-y-lg", children: [_jsx(Button, { onClick: () => {
142
+ api.setOpen(false);
143
+ globalStore.kyc.setOpen(true);
144
+ globalStore.kycReminder.setOpen(false);
145
+ }, children: "Verify Now" }), _jsx(Button, { type: "button", variant: "outline", fullWidth: true, onClick: () => {
146
+ api.setOpen(false);
147
+ globalStore.responsibleGamingReminder.setOpen(true);
148
+ }, children: "Do it later" })] })) })] })] })), isPending && isVerificationLocked && (_jsxs("div", { className: "p-3xl text-center", children: [_jsx("div", { className: "mx-auto mb-4 w-fit rounded-full bg-bg-primary p-2", children: _jsx(Image, { src: props.logo, alt: `${props.siteName} logo`, width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }) }), _jsx("h2", { className: `mt-4 font-semibold text-lg ${props.titleBgColor}`, children: "VERIFICATION IN PROGRESS" }), _jsx("p", { className: `mt-xs text-sm text-text-tertiary-600 ${props.descriptionBgColor}`, children: "Your account is verification-locked. Please wait for approval to regain full access to this platform." }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-3xl", children: [_jsx(Image, { src: props.pagcorLogo?.logo ?? pagcorLogo, alt: "PAGCOR logo", height: 88, width: 88, className: `h-[88px] w-auto shrink-0 ${props.pagcorLogo?.styles ?? ''}`, draggable: false, unoptimized: true }), _jsx(Image, { src: props.responsibleGamingLogo?.logo ?? responsibleGamingLogo, alt: "Responsible Gaming logo", height: 50, width: 186, className: `h-[50px] w-auto shrink-0 ${props.responsibleGamingLogo?.styles ?? ''}`, draggable: false, unoptimized: true })] }), _jsx("div", { className: "mt-6 space-y-lg", children: _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: async () => {
148
149
  if (Capacitor.isNativePlatform()) {
149
150
  const session = await getQueryClient().fetchQuery({
150
151
  queryKey: getSessionQueryKey(),
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { endOfDay as getEndOfDay } from 'date-fns';
3
2
  import { isString } from 'lodash-es';
4
3
  import dynamic from 'next/dynamic';
5
4
  import Link from 'next/link';
@@ -87,7 +86,7 @@ export function JourneyQuest(props) {
87
86
  disclosure.setOpen(true);
88
87
  }, [disclosure]);
89
88
  const localeInfo = useLocaleInfo();
90
- 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
+ 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, { className: {
91
90
  timeBadgeRoot: classNames?.timeBadgeRoot,
92
91
  timeBadgeIcon: classNames?.timeBadgeIcon,
93
92
  timeBadgeLabel: classNames?.timeBadgeLabel,
@@ -135,14 +134,7 @@ function Rules(props) {
135
134
  return milestones.every((milestone) => milestone.isCompleted);
136
135
  }, [milestones]);
137
136
  //prevent members to perform actions after the quest has expired
138
- const targetDateTime = useMemo(() => {
139
- if (!quest?.dateTimeCreated)
140
- return null;
141
- const date = new Date(quest.dateTimeCreated);
142
- date.setDate(date.getDate() + Number(quest?.daysToClear ?? 0));
143
- return getEndOfDay(date);
144
- }, [quest?.dateTimeCreated, quest?.daysToClear]);
145
- const remainingTime = useRemainingTime(targetDateTime ?? new Date());
137
+ const remainingTime = useRemainingTime(quest?.endDateTime ?? '');
146
138
  const isExpired = quest?.status === 'FAILED' || remainingTime.expired;
147
139
  const sessionQuery = useSessionQuery();
148
140
  const session = sessionQuery.data;
@@ -1,21 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { endOfDay } from 'date-fns';
3
- import { useMemo } from 'react';
4
3
  import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
5
4
  import { ClockStopWatchIcon } from '../../icons/ClockStopWatchIcon.js';
6
5
  import { Badge } from '../../ui/Badge/index.js';
7
6
  import { useQuestContext } from './QuestsContext.js';
8
7
  export function RemainingTime({ endOfDay: useEndOfDay = false, className, }) {
9
8
  const quest = useQuestContext();
10
- const targetDateTime = useMemo(() => {
11
- const daysToClear = Number(quest.daysToClear);
12
- if (Number.isInteger(daysToClear) && daysToClear > 0) {
13
- const now = new Date();
14
- now.setDate(now.getDate() + daysToClear);
15
- return useEndOfDay ? endOfDay(now) : now;
16
- }
17
- return 0;
18
- }, [quest.daysToClear, useEndOfDay]);
9
+ const targetDateTime = useEndOfDay
10
+ ? endOfDay(new Date(quest.endDateTime)).toISOString()
11
+ : quest.endDateTime;
19
12
  const remainingTime = useRemainingTime(targetDateTime);
20
13
  if (quest.status === 'COMPLETED') {
21
14
  return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, className: className?.completedBadgeRoot, children: _jsx(Badge.Label, { className: className?.completedBadgeLabel, children: "Completed" }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1093",
3
+ "version": "0.0.1095",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",