@opexa/portal-components 0.0.111 → 0.0.113
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/useCashbackQuery.js +3 -0
- package/dist/client/hooks/useCashbacksQuery.js +3 -0
- package/dist/client/hooks/useChunk.js +3 -2
- package/dist/client/hooks/useFavoriteGamesQuery.js +3 -0
- package/dist/client/hooks/useInstapayBankListQuery.js +3 -0
- package/dist/client/hooks/useJackpotPayoutsQuery.js +3 -0
- package/dist/client/hooks/useJackpotsCountQuery.js +3 -0
- package/dist/client/hooks/useJackpotsQuery.js +3 -0
- package/dist/client/hooks/usePlatformQuery.js +3 -0
- package/dist/client/hooks/usePromoQuery.js +3 -0
- package/dist/client/hooks/usePromosQuery.js +3 -0
- package/dist/client/hooks/useRecommendedGamesQuery.js +5 -2
- package/dist/client/hooks/useRemainingTime.d.ts +2 -2
- package/dist/client/hooks/useRemainingTime.js +35 -24
- package/dist/client/hooks/useSiteQuery.js +4 -2
- package/dist/client/hooks/useTopWinsQuery.js +3 -0
- package/dist/components/NewsFeed/NewsFeedCarousel.js +1 -1
- package/dist/components/NewsFeed/NewsFeedList.js +1 -1
- package/dist/server/utils/prefetchSiteQuery.js +1 -4
- package/dist/services/cmsPortal.d.ts +1 -1
- package/dist/services/cmsPortal.js +31 -5
- package/dist/services/portal.js +27 -3
- package/dist/services/report.js +45 -5
- package/dist/services/wallet.js +26 -3
- package/package.json +1 -1
|
@@ -3,6 +3,9 @@ import { getCashback } from '../../services/wallet.js';
|
|
|
3
3
|
import { getCashbackQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useCashbackQuery = (id, config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
enabled: !id ? false : config?.enabled,
|
|
8
11
|
queryKey: getCashbackQueryKey(id),
|
|
@@ -3,6 +3,9 @@ import { getCashbacks } from '../../services/wallet.js';
|
|
|
3
3
|
import { getCashbacksQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useCashbacksQuery = (config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getCashbacksQueryKey(),
|
|
8
11
|
queryFn: async ({ signal }) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { chunk } from 'lodash-es';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { cache, useState } from 'react';
|
|
3
|
+
const fn = cache(chunk);
|
|
3
4
|
export function useChunk(items, size) {
|
|
4
|
-
const chunks =
|
|
5
|
+
const chunks = fn(items, size);
|
|
5
6
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
6
7
|
const currentItems = chunks.at(currentIndex) ?? [];
|
|
7
8
|
const loadedItems = (() => {
|
|
@@ -7,6 +7,9 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useFavoriteGamesQuery = (config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
return useQuery({
|
|
10
|
+
refetchOnMount: false,
|
|
11
|
+
refetchOnReconnect: false,
|
|
12
|
+
refetchOnWindowFocus: false,
|
|
10
13
|
...config,
|
|
11
14
|
enabled: config?.enabled === false
|
|
12
15
|
? false
|
|
@@ -7,6 +7,9 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useInstapayBankListQuery = (config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useQuery({
|
|
10
|
+
refetchOnMount: false,
|
|
11
|
+
refetchOnReconnect: false,
|
|
12
|
+
refetchOnWindowFocus: false,
|
|
10
13
|
...config,
|
|
11
14
|
enabled: config?.enabled === false
|
|
12
15
|
? false
|
|
@@ -3,6 +3,9 @@ import { getJackpotPayouts, } from '../../services/report.js';
|
|
|
3
3
|
import { getJackpotPayoutsQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useJackpotPayoutsQuery = (input, config) => {
|
|
5
5
|
const query = useInfiniteQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getJackpotPayoutsQueryKey(input),
|
|
8
11
|
queryFn: ({ pageParam, signal }) => {
|
|
@@ -3,6 +3,9 @@ import { getJackpotsCount, } from '../../services/report.js';
|
|
|
3
3
|
import { getJackpotsCountQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useJackpotsCountQuery = (input, config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getJackpotsCountQueryKey(input),
|
|
8
11
|
queryFn: async ({ signal }) => {
|
|
@@ -3,6 +3,9 @@ import { getJackpots } from '../../services/report.js';
|
|
|
3
3
|
import { getJackpotsQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useJackpotsQuery = (input, config) => {
|
|
5
5
|
const query = useInfiniteQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getJackpotsQueryKey(input),
|
|
8
11
|
queryFn: ({ pageParam, signal }) => {
|
|
@@ -3,6 +3,9 @@ import { getPlatform } from '../../services/portal.js';
|
|
|
3
3
|
import { getPlatformQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const usePlatformQuery = (config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getPlatformQueryKey(),
|
|
8
11
|
queryFn: async ({ signal }) => {
|
|
@@ -3,6 +3,9 @@ import { getPromo } from '../../services/wallet.js';
|
|
|
3
3
|
import { getPromoQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const usePromoQuery = (id, config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
enabled: !id ? false : config?.enabled,
|
|
8
11
|
queryKey: getPromoQueryKey(id),
|
|
@@ -3,6 +3,9 @@ import { getPromos } from '../../services/wallet.js';
|
|
|
3
3
|
import { getPromosQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const usePromosQuery = (config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getPromosQueryKey(),
|
|
8
11
|
queryFn: async ({ signal }) => {
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getRecommendedGames } from '../../services/portal.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getRecommendedGamesQueryKey } from '../../utils/queryKeys.js';
|
|
5
5
|
import { getSession } from '../services/getSession.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useRecommendedGamesQuery = (config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useQuery({
|
|
10
|
+
refetchOnMount: false,
|
|
11
|
+
refetchOnReconnect: false,
|
|
12
|
+
refetchOnWindowFocus: false,
|
|
10
13
|
...config,
|
|
11
14
|
enabled: config?.enabled === false
|
|
12
15
|
? false
|
|
13
16
|
: sessionQuery.data?.status === 'authenticated',
|
|
14
|
-
queryKey:
|
|
17
|
+
queryKey: getRecommendedGamesQueryKey(),
|
|
15
18
|
queryFn: async ({ signal }) => {
|
|
16
19
|
const session = await getSession();
|
|
17
20
|
invariant(session.status === 'authenticated');
|
|
@@ -7,12 +7,12 @@ interface UseRemainingTimeOptions {
|
|
|
7
7
|
onExpired?: () => void;
|
|
8
8
|
}
|
|
9
9
|
export declare function useRemainingTime(value: Date | string | number, options?: UseRemainingTimeOptions): {
|
|
10
|
+
subscribe: (subscriber: Subscriber) => () => void;
|
|
10
11
|
days: number;
|
|
11
12
|
hours: number;
|
|
12
13
|
minutes: number;
|
|
13
|
-
expired: boolean;
|
|
14
14
|
seconds: number;
|
|
15
|
+
expired: boolean;
|
|
15
16
|
toString(): string;
|
|
16
|
-
subscribe: (subscriber: Subscriber) => () => void;
|
|
17
17
|
};
|
|
18
18
|
export {};
|
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import { differenceInDays, differenceInHours, differenceInMinutes, differenceInSeconds, isAfter, } from 'date-fns';
|
|
2
2
|
import { isNumber, isString, noop } from 'lodash-es';
|
|
3
|
-
import { useRef, useState } from 'react';
|
|
3
|
+
import { cache, useRef, useState } from 'react';
|
|
4
4
|
import { useInterval } from 'usehooks-ts';
|
|
5
|
+
const getRemainingTime = cache((value, compareValue) => {
|
|
6
|
+
const expiration = isString(value) || isNumber(value) ? new Date(value) : value;
|
|
7
|
+
const expired = isAfter(compareValue, expiration);
|
|
8
|
+
const days = expired ? 0 : differenceInDays(expiration, compareValue);
|
|
9
|
+
const hours = expired
|
|
10
|
+
? 0
|
|
11
|
+
: differenceInHours(expiration, compareValue) - days * 24;
|
|
12
|
+
const minutes = expired
|
|
13
|
+
? 0
|
|
14
|
+
: differenceInMinutes(expiration, compareValue) -
|
|
15
|
+
days * 24 * 60 -
|
|
16
|
+
hours * 60;
|
|
17
|
+
const seconds = expired
|
|
18
|
+
? 0
|
|
19
|
+
: differenceInSeconds(expiration, compareValue) -
|
|
20
|
+
days * 24 * 60 * 60 -
|
|
21
|
+
hours * 60 * 60 -
|
|
22
|
+
minutes * 60;
|
|
23
|
+
return {
|
|
24
|
+
days,
|
|
25
|
+
hours,
|
|
26
|
+
minutes,
|
|
27
|
+
seconds,
|
|
28
|
+
expired,
|
|
29
|
+
toString() {
|
|
30
|
+
return `${days}d:${hours}h:${minutes}m:${seconds}s`;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
});
|
|
5
34
|
export function useRemainingTime(value, options = {}) {
|
|
6
35
|
const subscribers = useRef([
|
|
7
36
|
() => {
|
|
@@ -21,35 +50,17 @@ export function useRemainingTime(value, options = {}) {
|
|
|
21
50
|
});
|
|
22
51
|
};
|
|
23
52
|
const [now, setNow] = useState(new Date());
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const days = expired ? 0 : differenceInDays(expiration, now);
|
|
27
|
-
const hours = expired ? 0 : differenceInHours(expiration, now) - days * 24;
|
|
28
|
-
const minutes = expired
|
|
29
|
-
? 0
|
|
30
|
-
: differenceInMinutes(expiration, now) - days * 24 * 60 - hours * 60;
|
|
31
|
-
const seconds = expired
|
|
32
|
-
? 0
|
|
33
|
-
: differenceInSeconds(expiration, now) -
|
|
34
|
-
days * 24 * 60 * 60 -
|
|
35
|
-
hours * 60 * 60 -
|
|
36
|
-
minutes * 60;
|
|
53
|
+
const exp = isString(value) || isNumber(value) ? new Date(value) : value;
|
|
54
|
+
const res = getRemainingTime(exp, now);
|
|
37
55
|
useInterval(() => {
|
|
38
56
|
const d = new Date();
|
|
39
57
|
setNow(d);
|
|
40
|
-
if (isAfter(d,
|
|
58
|
+
if (isAfter(d, exp)) {
|
|
41
59
|
triggerEvent({ type: 'EXPIRED' });
|
|
42
60
|
}
|
|
43
|
-
}, expired ? null : 1000);
|
|
61
|
+
}, res.expired ? null : 1000);
|
|
44
62
|
return {
|
|
45
|
-
|
|
46
|
-
hours,
|
|
47
|
-
minutes,
|
|
48
|
-
expired,
|
|
49
|
-
seconds,
|
|
50
|
-
toString() {
|
|
51
|
-
return `${days}d:${hours}h:${minutes}m:${seconds}s`;
|
|
52
|
-
},
|
|
63
|
+
...res,
|
|
53
64
|
subscribe,
|
|
54
65
|
};
|
|
55
66
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
|
-
import { SITE_ID } from '../../constants/index.js';
|
|
4
3
|
import { getSite } from '../../services/cmsPortal.js';
|
|
5
4
|
import { getSiteQueryKey } from '../../utils/queryKeys.js';
|
|
6
5
|
export const useSiteQuery = (config) => {
|
|
7
6
|
return useQuery({
|
|
7
|
+
refetchOnMount: false,
|
|
8
|
+
refetchOnReconnect: false,
|
|
9
|
+
refetchOnWindowFocus: false,
|
|
8
10
|
...config,
|
|
9
11
|
queryKey: getSiteQueryKey(),
|
|
10
12
|
queryFn: async ({ signal }) => {
|
|
11
|
-
const site = await getSite(
|
|
13
|
+
const site = await getSite({ signal });
|
|
12
14
|
invariant(site);
|
|
13
15
|
return site;
|
|
14
16
|
},
|
|
@@ -3,6 +3,9 @@ import { getTopWins } from '../../services/portal.js';
|
|
|
3
3
|
import { getTopWinsQueryKey } from '../../utils/queryKeys.js';
|
|
4
4
|
export const useTopWinsQuery = (config) => {
|
|
5
5
|
return useQuery({
|
|
6
|
+
refetchOnMount: false,
|
|
7
|
+
refetchOnReconnect: false,
|
|
8
|
+
refetchOnWindowFocus: false,
|
|
6
9
|
...config,
|
|
7
10
|
queryKey: getTopWinsQueryKey(),
|
|
8
11
|
queryFn: async ({ signal }) => {
|
|
@@ -41,7 +41,7 @@ export function NewsFeedCarousel(props) {
|
|
|
41
41
|
onSelect(emblaApi);
|
|
42
42
|
emblaApi.on('reInit', onSelect).on('select', onSelect);
|
|
43
43
|
}, [emblaApi, onSelect]);
|
|
44
|
-
return (_jsxs("div", { style: props.style, className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "text-lg font-semibold", children: heading }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [_jsxs(Link, { href: viewAllUrl, className: "text-button-tertiary-fg flex gap-sm text-sm font-semibold", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", onClick: onPrevButtonClick, disabled: prevBtnDisabled, "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-l-none", onClick: onNextButtonClick, disabled: nextBtnDisabled, "aria-label": "Next", children: _jsx(ArrowRightIcon, { className: "size-5" }) })] })] })] }), empty && (_jsx(Empty, { icon: Tv03Icon, title: "No News", message: "No news is currently available.", className: "mt-8" })), !empty && (_jsx(_Fragment, { children: _jsx("div", { ref: emblaRef, className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: twMerge('grid auto-cols-[100%] grid-flow-col gap-1.5 lg:auto-cols-[calc((100%-(1.25rem*2))/3)] lg:gap-2xl'), children: props.newsFeed.map((news) => (_jsxs("div", { className: "bg-bg-primary-alt border-border-primary flex flex-col overflow-hidden rounded-2xl border shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 356, height: 244, className: "block h-auto w-full" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-brand-400 text-sm font-semibold", children: news.category }), _jsx("h2", { className: "mt-2 text-lg font-semibold", children: news.title }), _jsx("p", { className: "text-text-tertiary-600 mt-xs line-clamp-3", dangerouslySetInnerHTML: {
|
|
44
|
+
return (_jsxs("div", { style: props.style, className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "text-lg font-semibold", children: heading }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [_jsxs(Link, { href: viewAllUrl, className: "text-button-tertiary-fg flex gap-sm text-sm font-semibold", children: ["See All", _jsx(ChevronRightIcon, { className: "size-5 lg:hidden" })] }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", onClick: onPrevButtonClick, disabled: prevBtnDisabled, "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-l-none", onClick: onNextButtonClick, disabled: nextBtnDisabled, "aria-label": "Next", children: _jsx(ArrowRightIcon, { className: "size-5" }) })] })] })] }), empty && (_jsx(Empty, { icon: Tv03Icon, title: "No News", message: "No news is currently available.", className: "mt-8" })), !empty && (_jsx(_Fragment, { children: _jsx("div", { ref: emblaRef, className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: twMerge('grid auto-cols-[100%] grid-flow-col gap-1.5 lg:auto-cols-[calc((100%-(1.25rem*2))/3)] lg:gap-2xl'), children: props.newsFeed.map((news) => (_jsxs("div", { className: "bg-bg-primary-alt border-border-primary flex flex-col overflow-hidden rounded-2xl border shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 356, height: 244, className: "block h-auto w-full" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-brand-400 text-sm font-semibold", children: news.category }), _jsx("h2", { className: "mt-2 line-clamp-1 text-lg font-semibold", children: news.title }), _jsx("p", { className: "text-text-tertiary-600 mt-xs line-clamp-3", dangerouslySetInnerHTML: {
|
|
45
45
|
__html: news.content,
|
|
46
46
|
} })] }), _jsx(Button, { asChild: true, className: "mt-2xl", children: _jsx(Link, { href: `${viewDetailsUrl}/${news.id}`, children: "Read More" }) })] })] }, news.id))) }) }) }))] }));
|
|
47
47
|
}
|
|
@@ -8,7 +8,7 @@ export function NewsFeedList(props) {
|
|
|
8
8
|
const empty = props.newsFeed.length <= 0;
|
|
9
9
|
const heading = props.heading ?? 'News';
|
|
10
10
|
const viewDetailsUrl = props.viewDetailsUrl ?? '/news';
|
|
11
|
-
return (_jsxs("div", { style: props.style, className: props.className, children: [_jsx("h2", { className: "text-lg font-semibold", children: heading }), empty && (_jsx(Empty, { icon: Tv03Icon, title: "No News", message: "No news is currently available.", className: "mt-8" })), !empty && (_jsx("div", { className: "mt-lg grid gap-3xl lg:grid-cols-3 lg:gap-2xl", children: props.newsFeed.map((news) => (_jsxs("div", { className: "bg-bg-primary-alt border-border-primary flex flex-col overflow-hidden rounded-2xl border shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 356, height: 244, className: "block h-auto w-full" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-brand-400 text-sm font-semibold", children: news.category }), _jsx("h2", { className: "mt-2 text-lg font-semibold", children: news.title }), _jsx("p", { className: "text-text-tertiary-600 mt-xs line-clamp-3", dangerouslySetInnerHTML: {
|
|
11
|
+
return (_jsxs("div", { style: props.style, className: props.className, children: [_jsx("h2", { className: "text-lg font-semibold", children: heading }), empty && (_jsx(Empty, { icon: Tv03Icon, title: "No News", message: "No news is currently available.", className: "mt-8" })), !empty && (_jsx("div", { className: "mt-lg grid gap-3xl lg:grid-cols-3 lg:gap-2xl", children: props.newsFeed.map((news) => (_jsxs("div", { className: "bg-bg-primary-alt border-border-primary flex flex-col overflow-hidden rounded-2xl border shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 356, height: 244, className: "block h-auto w-full" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-brand-400 text-sm font-semibold", children: news.category }), _jsx("h2", { className: "mt-2 line-clamp-1 text-lg font-semibold", children: news.title }), _jsx("p", { className: "text-text-tertiary-600 mt-xs line-clamp-3", dangerouslySetInnerHTML: {
|
|
12
12
|
__html: news.content,
|
|
13
13
|
} })] }), _jsx(Button, { asChild: true, className: "mt-2xl", children: _jsx(Link, { href: `${viewDetailsUrl}/${news.id}`, children: "Read More" }) })] })] }, news.id))) }))] }));
|
|
14
14
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SITE_ID } from '../../constants/index.js';
|
|
2
1
|
import { getSite } from '../../services/cmsPortal.js';
|
|
3
2
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
4
3
|
import { log } from '../../utils/log.js';
|
|
@@ -8,9 +7,7 @@ export const prefetchSiteQuery = async () => {
|
|
|
8
7
|
.prefetchQuery({
|
|
9
8
|
queryKey: getSiteQueryKey(),
|
|
10
9
|
queryFn: async ({ signal }) => {
|
|
11
|
-
return await getSite(
|
|
12
|
-
signal,
|
|
13
|
-
});
|
|
10
|
+
return await getSite({ signal });
|
|
14
11
|
},
|
|
15
12
|
})
|
|
16
13
|
.catch(() => log.text("'prefetchSiteQuery' failed", 'error'));
|
|
@@ -4,7 +4,7 @@ import { type HttpRequestOptions } from './httpRequest';
|
|
|
4
4
|
export interface SiteQuery {
|
|
5
5
|
data: Site;
|
|
6
6
|
}
|
|
7
|
-
export declare const getSite: (
|
|
7
|
+
export declare const getSite: (options?: HttpRequestOptions) => Promise<Site | null>;
|
|
8
8
|
export interface GamesQueryVariables {
|
|
9
9
|
after?: string;
|
|
10
10
|
first?: number;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { cache } from 'react';
|
|
2
|
-
import { CMS_PORTAL_ENDPOINT } from '../constants/index.js';
|
|
2
|
+
import { CMS_PORTAL_ENDPOINT, SITE_ID } from '../constants/index.js';
|
|
3
3
|
import { httpRequest } from './httpRequest.js';
|
|
4
|
-
export const getSite = cache(async (
|
|
4
|
+
export const getSite = cache(async (options) => {
|
|
5
5
|
try {
|
|
6
|
-
const { data } = await httpRequest.json(`${CMS_PORTAL_ENDPOINT}/v1/sites/${
|
|
6
|
+
const { data } = await httpRequest.json(`${CMS_PORTAL_ENDPOINT}/v1/sites/${SITE_ID}`, {
|
|
7
|
+
cache: 'force-cache',
|
|
8
|
+
...options,
|
|
9
|
+
next: {
|
|
10
|
+
revalidate: 60 * 5,
|
|
11
|
+
tags: ['site', SITE_ID],
|
|
12
|
+
...options?.next,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
7
15
|
return data ?? null;
|
|
8
16
|
}
|
|
9
17
|
catch {
|
|
@@ -53,7 +61,16 @@ export async function getGames(input, options) {
|
|
|
53
61
|
if (input?.sort)
|
|
54
62
|
search.set('sort[order]', input.sort);
|
|
55
63
|
try {
|
|
56
|
-
const
|
|
64
|
+
const qs = search.toString();
|
|
65
|
+
const res = await httpRequest.json(`${CMS_PORTAL_ENDPOINT}/v1/games?${qs}`, {
|
|
66
|
+
cache: 'force-cache',
|
|
67
|
+
...options,
|
|
68
|
+
next: {
|
|
69
|
+
revalidate: 60 * 5,
|
|
70
|
+
tags: ['games', qs],
|
|
71
|
+
...options?.next,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
57
74
|
return {
|
|
58
75
|
edges: res.data.map((node) => ({
|
|
59
76
|
node,
|
|
@@ -122,7 +139,16 @@ export const getGames__next = cache(async (input, options) => {
|
|
|
122
139
|
search.set('sort[context]', input.sort.context.toLowerCase());
|
|
123
140
|
}
|
|
124
141
|
try {
|
|
125
|
-
const
|
|
142
|
+
const qs = search.toString();
|
|
143
|
+
const res = await httpRequest.json(`${CMS_PORTAL_ENDPOINT}/v2/games?${qs}`, {
|
|
144
|
+
cache: 'force-cache',
|
|
145
|
+
...options,
|
|
146
|
+
next: {
|
|
147
|
+
revalidate: 60 * 5,
|
|
148
|
+
tags: ['games', qs],
|
|
149
|
+
...options?.next,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
126
152
|
return {
|
|
127
153
|
edges: res.data.map((node) => ({
|
|
128
154
|
node,
|
package/dist/services/portal.js
CHANGED
|
@@ -7,11 +7,27 @@ export const getLatestBetRecords = cache(async (options) => {
|
|
|
7
7
|
return res.latestBetRecords;
|
|
8
8
|
});
|
|
9
9
|
export const getPlatform = cache(async (options) => {
|
|
10
|
-
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, PLATFORM, undefined,
|
|
10
|
+
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, PLATFORM, undefined, {
|
|
11
|
+
cache: 'force-cache',
|
|
12
|
+
...options,
|
|
13
|
+
next: {
|
|
14
|
+
revalidate: 60,
|
|
15
|
+
tags: ['platform'],
|
|
16
|
+
...options?.next,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
11
19
|
return res;
|
|
12
20
|
});
|
|
13
21
|
export const getRecommendedGames = cache(async (options) => {
|
|
14
|
-
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, RECOMMENDED_GAMES, undefined,
|
|
22
|
+
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, RECOMMENDED_GAMES, undefined, {
|
|
23
|
+
cache: 'force-cache',
|
|
24
|
+
...options,
|
|
25
|
+
next: {
|
|
26
|
+
revalidate: 60,
|
|
27
|
+
tags: ['recommendedGames'],
|
|
28
|
+
...options?.next,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
15
31
|
return res.recommendedGames;
|
|
16
32
|
});
|
|
17
33
|
export const getOnboardingStatus = cache(async (options) => {
|
|
@@ -39,6 +55,14 @@ export const skipOnboarding = async (options) => {
|
|
|
39
55
|
}
|
|
40
56
|
};
|
|
41
57
|
export const getTopWins = cache(async (options) => {
|
|
42
|
-
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, TOP_WINS, undefined,
|
|
58
|
+
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, TOP_WINS, undefined, {
|
|
59
|
+
cache: 'force-cache',
|
|
60
|
+
...options,
|
|
61
|
+
next: {
|
|
62
|
+
revalidate: 60 * 5,
|
|
63
|
+
tags: ['topWins'],
|
|
64
|
+
...options?.next,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
43
67
|
return res.topWins;
|
|
44
68
|
});
|
package/dist/services/report.js
CHANGED
|
@@ -51,22 +51,62 @@ export const getPromoByCode = cache(async (code, options) => {
|
|
|
51
51
|
return res.promoByCode;
|
|
52
52
|
});
|
|
53
53
|
export const getJackpots = cache(async (input, options) => {
|
|
54
|
-
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOTS, input,
|
|
54
|
+
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOTS, input, {
|
|
55
|
+
cache: 'force-cache',
|
|
56
|
+
...options,
|
|
57
|
+
next: {
|
|
58
|
+
tags: ['jackpots', JSON.stringify(input)],
|
|
59
|
+
revalidate: 60,
|
|
60
|
+
...options?.next,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
55
63
|
return res.jackpots;
|
|
56
64
|
});
|
|
57
65
|
export const getJackpotsCount = cache(async (input, options) => {
|
|
58
|
-
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOTS_COUNT, input,
|
|
66
|
+
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOTS_COUNT, input, {
|
|
67
|
+
cache: 'force-cache',
|
|
68
|
+
...options,
|
|
69
|
+
next: {
|
|
70
|
+
tags: ['jackpotsCount', JSON.stringify(input)],
|
|
71
|
+
revalidate: 60,
|
|
72
|
+
...options?.next,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
59
75
|
return res.jackpots.totalCount ?? 0;
|
|
60
76
|
});
|
|
61
77
|
export const getJackpotPayouts = cache(async (input, options) => {
|
|
62
|
-
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOT_PAYOUTS, input,
|
|
78
|
+
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, JACKPOT_PAYOUTS, input, {
|
|
79
|
+
cache: 'force-cache',
|
|
80
|
+
...options,
|
|
81
|
+
next: {
|
|
82
|
+
tags: ['jackpotPayouts', JSON.stringify(input)],
|
|
83
|
+
revalidate: 60,
|
|
84
|
+
...options?.next,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
63
87
|
return res.jackpotPayouts;
|
|
64
88
|
});
|
|
65
89
|
export const getTournaments = cache(async (input, options) => {
|
|
66
|
-
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, TOURNAMENTS, input,
|
|
90
|
+
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, TOURNAMENTS, input, {
|
|
91
|
+
cache: 'force-cache',
|
|
92
|
+
...options,
|
|
93
|
+
next: {
|
|
94
|
+
tags: ['tournaments', JSON.stringify(input)],
|
|
95
|
+
revalidate: 60,
|
|
96
|
+
...options?.next,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
67
99
|
return res.tournaments;
|
|
68
100
|
});
|
|
69
101
|
export const getTournamentsCount = cache(async (input, options) => {
|
|
70
|
-
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, TOURNAMENTS_COUNT, input,
|
|
102
|
+
const res = await graphqlRequest(REPORT_GRAPHQL_ENDPOINT, TOURNAMENTS_COUNT, input, {
|
|
103
|
+
cache: 'force-cache',
|
|
104
|
+
...options,
|
|
105
|
+
next: {
|
|
106
|
+
tags: ['tournamentsCount', JSON.stringify(input)],
|
|
107
|
+
revalidate: 60,
|
|
108
|
+
...options?.next,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
71
111
|
return res.tournaments.totalCount ?? 0;
|
|
72
112
|
});
|
package/dist/services/wallet.js
CHANGED
|
@@ -4,11 +4,27 @@ import { graphqlRequest } from './graphqlRequest.js';
|
|
|
4
4
|
import { AVAILABLE_PROMOS, BONUS, BONUSES, BONUSES_IDS, CASHBACK, CASHBACK_BONUS, CASHBACK_BONUSES, CASHBACK_BONUSES_IDS, CASHBACKS, CLAIM_CASHBACK_BONUS, CLAIM_SPOT_BONUS, CREATE_AIO_INSTAPAY_WITHDRAWAL, CREATE_AIO_ONLINE_BANK_DEPOSIT, CREATE_AIO_QRPH_DEPOSIT, CREATE_BANK_WITHDRAWAL, CREATE_GAME_SESSION, CREATE_GCASH_DEPOSIT, CREATE_GCASH_DIRECT_WEBPAY_DEPOSIT, CREATE_GCASH_WITHDRAWAL, CREATE_MANUAL_BANK_DEPOSIT, CREATE_MANUAL_BANK_WITHDRAWAL, CREATE_MANUAL_UPI_DEPOSIT, CREATE_MANUAL_UPI_WITHDRAWAL, CREATE_MAYA_APP_DEPOSIT, CREATE_MAYA_APP_WITHDRAWAL, CREATE_MAYA_DEPOSIT, CREATE_MAYA_WITHDRAWAL, CURRENT_BONUS, DEPOSIT, END_GAME_SESSION, FAVORITE_GAMES, GAME_SESSION, INSTAPAY_BANK_LIST, MARK_GAME_AS_FAVORITE, MAYA_SESSION, POINTS_WALLET, PROMO, PROMOS, REDEEM_POINTS_TO_CASH, REMAINING_DAILY_WITHDRAWALS_COUNT, TOUCH_GCASH_DEPOSIT, TOUCH_QRPH_DEPOSIT, UNMARK_GAME_AS_FAVORITE, VALIDATE_MAYA_SESSION, WALLET, } from './queries.js';
|
|
5
5
|
import { sha256 } from './sha256.js';
|
|
6
6
|
export const getPromos = cache(async (options) => {
|
|
7
|
-
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, PROMOS, undefined,
|
|
7
|
+
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, PROMOS, undefined, {
|
|
8
|
+
cache: 'force-cache',
|
|
9
|
+
...options,
|
|
10
|
+
next: {
|
|
11
|
+
tags: ['promos'],
|
|
12
|
+
revalidate: 60,
|
|
13
|
+
...options?.next,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
8
16
|
return res.promos;
|
|
9
17
|
});
|
|
10
18
|
export const getCashbacks = cache(async (options) => {
|
|
11
|
-
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, CASHBACKS, undefined,
|
|
19
|
+
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, CASHBACKS, undefined, {
|
|
20
|
+
cache: 'force-cache',
|
|
21
|
+
...options,
|
|
22
|
+
next: {
|
|
23
|
+
tags: ['cashbacks'],
|
|
24
|
+
revalidate: 60,
|
|
25
|
+
...options?.next,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
12
28
|
return res.cashbacks;
|
|
13
29
|
});
|
|
14
30
|
export const getPromo = cache(async (id, options) => {
|
|
@@ -242,7 +258,14 @@ export const createManualBankWithdrawal = async (input, options) => {
|
|
|
242
258
|
}
|
|
243
259
|
};
|
|
244
260
|
export const getInstapayBankList = cache(async (options) => {
|
|
245
|
-
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, INSTAPAY_BANK_LIST, undefined,
|
|
261
|
+
const res = await graphqlRequest(WALLET_GRAPHQL_ENDPOINT, INSTAPAY_BANK_LIST, undefined, {
|
|
262
|
+
cache: 'force-cache',
|
|
263
|
+
...options,
|
|
264
|
+
next: {
|
|
265
|
+
revalidate: 60 * 60 * 4,
|
|
266
|
+
tags: ['instapayBankList'],
|
|
267
|
+
},
|
|
268
|
+
});
|
|
246
269
|
return res.instapayBankList;
|
|
247
270
|
});
|
|
248
271
|
export const getRemainingDailyWithdrawalsCount = cache(async (options) => {
|