@opexa/portal-components 0.0.1109 → 0.0.1111

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.
Files changed (64) hide show
  1. package/dist/client/hooks/useTopGamesQuery.d.ts +2 -0
  2. package/dist/client/hooks/useTopGamesQuery.js +16 -0
  3. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  4. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  5. package/dist/components/Games/GamesCarousel.client.d.ts +2 -1
  6. package/dist/components/Games/GamesCarousel.client.js +23 -2
  7. package/dist/components/Games/GamesCarousel.js +10 -6
  8. package/dist/components/Games/GamesList.client.d.ts +2 -1
  9. package/dist/components/Games/GamesList.client.js +18 -8
  10. package/dist/components/Games/GamesList.js +10 -6
  11. package/dist/constants/top-games.d.ts +8 -0
  12. package/dist/constants/top-games.js +7 -0
  13. package/dist/server/utils/prefetchTopGamesQuery.d.ts +2 -0
  14. package/dist/server/utils/prefetchTopGamesQuery.js +18 -0
  15. package/dist/services/cmsPortal.d.ts +1 -0
  16. package/dist/services/cmsPortal.js +40 -0
  17. package/dist/types/index.d.ts +5 -0
  18. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  19. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  20. package/dist/ui/Badge/Badge.d.ts +12 -12
  21. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  22. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  23. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  24. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  25. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  26. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  27. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  28. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  29. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  30. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  31. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  32. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  33. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  34. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  35. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  36. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  37. package/dist/ui/Field/Field.d.ts +21 -21
  38. package/dist/ui/Field/field.recipe.d.ts +3 -3
  39. package/dist/ui/Menu/Menu.d.ts +198 -198
  40. package/dist/ui/Menu/menu.recipe.d.ts +11 -11
  41. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  42. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  43. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  44. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  45. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  46. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  47. package/dist/ui/Popover/Popover.d.ts +121 -121
  48. package/dist/ui/Popover/popover.recipe.d.ts +11 -11
  49. package/dist/ui/Progress/Progress.d.ts +27 -27
  50. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  51. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  52. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  53. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  54. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  55. package/dist/ui/Select/Select.d.ts +45 -45
  56. package/dist/ui/Select/select.recipe.d.ts +3 -3
  57. package/dist/ui/Table/Table.d.ts +21 -21
  58. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  59. package/dist/ui/Table/table.recipe.d.ts +3 -3
  60. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  61. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  62. package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
  63. package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
  64. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import type { Game, QueryConfig, TopGame } from '../../types';
2
+ export declare const useTopGamesQuery: (topGames: TopGame[], config?: QueryConfig<Game[]>) => import("@tanstack/react-query").UseQueryResult<Game[], Error>;
@@ -0,0 +1,16 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { getGamesv2__next } from '../../services/cmsPortal.js';
3
+ export const useTopGamesQuery = (topGames, config) => {
4
+ const ids = topGames.map((tg) => tg.id);
5
+ return useQuery({
6
+ ...config,
7
+ queryKey: ['top-games', ids],
8
+ queryFn: async ({ signal }) => {
9
+ if (!ids || ids.length === 0)
10
+ return [];
11
+ const results = await Promise.all(ids.map((id) => getGamesv2__next(id, { signal })));
12
+ return results.flatMap((res) => res.edges.map((edge) => edge.node));
13
+ },
14
+ enabled: (ids?.length ?? 0) > 0 && (config?.enabled ?? true),
15
+ });
16
+ };
@@ -1,6 +1,6 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
- view: "vca" | "form";
3
+ view: "form" | "vca";
4
4
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
- view: "vca" | "form";
16
+ view: "form" | "vca";
17
17
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
- view: "vca" | "form";
4
+ view: "form" | "vca";
5
5
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -2,7 +2,7 @@ import type { ImageProps } from 'next/image';
2
2
  import { type ReactNode } from 'react';
3
3
  import { type BypassDomainConfig } from '../../client/hooks/useBypassKycChecker';
4
4
  import type { GamesInput__Next } from '../../services/cmsPortal';
5
- import type { GameProvider } from '../../types';
5
+ import type { GameProvider, TopGame } from '../../types';
6
6
  interface ClassNameEntries {
7
7
  root?: string;
8
8
  thumbnailRoot?: string;
@@ -26,6 +26,7 @@ export interface GamesCarouselProps {
26
26
  className?: string | ClassNameEntries;
27
27
  fallbackThumbnails?: Partial<Record<GameProvider, ImageProps['src']>>;
28
28
  bypassDomains?: BypassDomainConfig[];
29
+ topGames?: TopGame[];
29
30
  }
30
31
  export declare function GamesCarousel__client(props: GamesCarouselProps): import("react/jsx-runtime").JSX.Element;
31
32
  export {};
@@ -3,10 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import useEmblaCarousel, {} from 'embla-carousel-react';
4
4
  import { isString } from 'lodash-es';
5
5
  import Link from 'next/link';
6
- import { useCallback, useEffect, useState } from 'react';
6
+ import { useCallback, useEffect, useMemo, useState, } from 'react';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import { useBypassKycChecker, } from '../../client/hooks/useBypassKycChecker.js';
9
9
  import { useGamesQuery } from '../../client/hooks/useGamesQuery.js';
10
+ import { useTopGamesQuery } from '../../client/hooks/useTopGamesQuery.js';
10
11
  import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
11
12
  import { ArrowRightIcon } from '../../icons/ArrowRightIcon.js';
12
13
  import { ChevronRightIcon } from '../../icons/ChevronRightIcon.js';
@@ -27,7 +28,27 @@ export function GamesCarousel__client(props) {
27
28
  }, {
28
29
  staleTime: 5 * 60 * 1000,
29
30
  });
30
- const games = gamesQuery.data?.pages.flatMap((page) => page.edges.map((edge) => edge.node)) ?? [];
31
+ const availableRows = gamesQuery.data?.pages.flatMap((page) => page.edges.map((edge) => edge.node)) ?? [];
32
+ const topGamesToDisplay = useMemo(() => (props.topGames ?? []).slice(0, 5), [props.topGames]);
33
+ const { data: topGameRows = [] } = useTopGamesQuery(topGamesToDisplay);
34
+ const sortedRows = useMemo(() => {
35
+ if (!topGamesToDisplay.length)
36
+ return availableRows;
37
+ const orderedTopRows = topGamesToDisplay
38
+ .map((tg) => {
39
+ const match = topGameRows.find((g) => g.id === tg.id);
40
+ if (!match)
41
+ return null;
42
+ if (tg.provider && tg.provider !== match.provider)
43
+ return null;
44
+ return match;
45
+ })
46
+ .filter((g) => g != null);
47
+ const orderedTopIds = new Set(orderedTopRows.map((g) => g.id));
48
+ const rest = availableRows.filter((g) => !orderedTopIds.has(g.id));
49
+ return [...orderedTopRows, ...rest];
50
+ }, [topGameRows, availableRows, topGamesToDisplay]);
51
+ const games = sortedRows;
31
52
  const [emblaRef, emblaApi] = useEmblaCarousel({
32
53
  align: 'start',
33
54
  slidesToScroll: 3,
@@ -1,13 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { prefetchGamesQuery } from '../../server/utils/prefetchGamesQuery.js';
3
+ import { prefetchTopGamesQuery } from '../../server/utils/prefetchTopGamesQuery.js';
3
4
  import { GamesCarousel__client, } from './GamesCarousel.client.js';
4
5
  export async function GamesCarousel(props) {
5
6
  const numOfRows = props.numOfRows ?? 1;
6
- await prefetchGamesQuery({
7
- first: (numOfRows + 1) * 6,
8
- filter: props.filter,
9
- search: props.search,
10
- sort: props.sort,
11
- });
7
+ await Promise.all([
8
+ prefetchGamesQuery({
9
+ first: (numOfRows + 1) * 6,
10
+ filter: props.filter,
11
+ search: props.search,
12
+ sort: props.sort,
13
+ }),
14
+ prefetchTopGamesQuery(props.topGames),
15
+ ]);
12
16
  return _jsx(GamesCarousel__client, { ...props });
13
17
  }
@@ -2,7 +2,7 @@ import type { ImageProps } from 'next/image';
2
2
  import type { ReactNode } from 'react';
3
3
  import { type BypassDomainConfig } from '../../client/hooks/useBypassKycChecker';
4
4
  import type { GamesInput__Next } from '../../services/cmsPortal';
5
- import type { GameProvider } from '../../types';
5
+ import type { GameProvider, TopGame } from '../../types';
6
6
  interface ClassNameEntries {
7
7
  root?: string;
8
8
  thumbnailRoot?: string;
@@ -26,6 +26,7 @@ export interface GamesListProps {
26
26
  pagination?: 'lazy-load' | 'paginated';
27
27
  fallbackThumbnails?: Partial<Record<GameProvider, ImageProps['src']>>;
28
28
  bypassDomains?: BypassDomainConfig[];
29
+ topGames?: TopGame[];
29
30
  }
30
31
  export declare function GamesList__client(props: GamesListProps): import("react/jsx-runtime").JSX.Element;
31
32
  export {};
@@ -2,11 +2,12 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { isString, noop } from 'lodash-es';
4
4
  import Link from 'next/link';
5
- import { useEffect, useState } from 'react';
5
+ import { useEffect, useMemo, useState } from 'react';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { useBypassKycChecker, } from '../../client/hooks/useBypassKycChecker.js';
8
8
  import { useGamesQuery } from '../../client/hooks/useGamesQuery.js';
9
9
  import { useInfiniteQueryHelper } from '../../client/hooks/useInfiniteQueryHelper.js';
10
+ import { useTopGamesQuery } from '../../client/hooks/useTopGamesQuery.js';
10
11
  import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
11
12
  import { GamingPad01Icon } from '../../icons/GamingPad01Icon.js';
12
13
  import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
@@ -20,14 +21,23 @@ export function GamesList__client(props) {
20
21
  const isBypass = useBypassKycChecker(props.bypassDomains);
21
22
  const { pagination = 'lazy-load' } = props;
22
23
  const perPage = props.first ?? 24;
23
- const { loading, availableRows, totalRows, totalAvailableRows, hasNextPage, next, } = useInfiniteQueryHelper(useGamesQuery, {
24
+ const { loading, availableRows, totalRows, hasNextPage, next } = useInfiniteQueryHelper(useGamesQuery, {
24
25
  first: perPage,
25
26
  filter: props.filter,
26
27
  search: props.search,
27
28
  sort: props.sort,
28
29
  });
30
+ const topGamesToDisplay = useMemo(() => (props.topGames ?? []).slice(0, 5), [props.topGames]);
31
+ const { data: topGameRows = [] } = useTopGamesQuery(topGamesToDisplay);
32
+ const sortedRows = useMemo(() => {
33
+ if (!topGamesToDisplay.length)
34
+ return availableRows;
35
+ const topGameKeys = new Set(topGameRows.map((g) => g.game));
36
+ const rest = availableRows.filter((g) => !topGameKeys.has(g.game));
37
+ return [...topGameRows, ...rest];
38
+ }, [topGamesToDisplay, topGameRows, availableRows]);
29
39
  const [currentPage, setCurrentPage] = useState(1);
30
- const totalPages = Math.ceil(totalRows / perPage);
40
+ const totalPages = Math.ceil(Math.max(totalRows, sortedRows.length) / perPage);
31
41
  useEffect(() => {
32
42
  if (pagination === 'paginated') {
33
43
  const requiredRows = currentPage * perPage;
@@ -44,20 +54,20 @@ export function GamesList__client(props) {
44
54
  loading,
45
55
  next,
46
56
  ]);
47
- const paginatedRows = availableRows.slice((currentPage - 1) * perPage, currentPage * perPage);
57
+ const paginatedRows = sortedRows.slice((currentPage - 1) * perPage, currentPage * perPage);
48
58
  const classNames = isString(props.className)
49
59
  ? { root: props.className }
50
60
  : (props.className ?? {});
51
61
  return (_jsx(GamesPropsContext, { value: props, children: _jsxs("div", { className: classNames.root, id: "games-list", children: [_jsxs("div", { className: "flex flex-col lg:flex-row lg:items-center lg:justify-between", children: [_jsx("h2", { className: "order-2 mt-md font-semibold text-lg lg:order-none lg:mt-0", children: typeof props.heading === 'string'
52
62
  ? props.heading.replaceAll('OneAPI', '')
53
- : (props.heading ?? 'Games') }), props.viewGameProvidersUrl && (_jsxs(Link, { href: props.viewGameProvidersUrl, className: "order-1 flex items-center gap-sm font-semibold text-button-tertiary-fg text-lg lg:order-none lg:text-sm", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back to all Providers"] }))] }), totalRows <= 0 && (_jsx(Empty, { icon: loading ? SpinnerIcon : GamingPad01Icon, title: loading ? 'Just a moment' : 'No games', message: loading
63
+ : (props.heading ?? 'Games') }), props.viewGameProvidersUrl && (_jsxs(Link, { href: props.viewGameProvidersUrl, className: "order-1 flex items-center gap-sm font-semibold text-button-tertiary-fg text-lg lg:order-none lg:text-sm", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back to all Providers"] }))] }), sortedRows.length <= 0 && (_jsx(Empty, { icon: loading ? SpinnerIcon : GamingPad01Icon, title: loading ? 'Just a moment' : 'No games', message: loading
54
64
  ? 'Fetching latest games...'
55
- : 'No game is currently available. Please check back later', className: "mt-lg" })), totalRows >= 1 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-lg grid grid-cols-3 gap-1.5 lg:grid-cols-6 lg:gap-2.5", children: (pagination === 'paginated' ? paginatedRows : availableRows).map((game) => {
65
+ : 'No game is currently available. Please check back later', className: "mt-lg" })), sortedRows.length >= 1 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-lg grid grid-cols-3 gap-1.5 lg:grid-cols-6 lg:gap-2.5", children: (pagination === 'paginated' ? paginatedRows : sortedRows).map((game) => {
56
66
  return (_jsx(GameContext, { value: game, children: _jsx(Game, { bypassKycCheck: isBypass, badge: props.badge, priority: true, className: {
57
67
  root: classNames.thumbnailRoot,
58
68
  title: classNames.thumbnailTitle,
59
69
  } }) }, game.id));
60
- }) }), _jsx("div", { className: "mt-2xl flex flex-col items-center lg:mt-3xl", children: pagination === 'paginated' && totalRows > 0 ? (_jsx(GamesPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (page) => {
70
+ }) }), _jsx("div", { className: "mt-2xl flex flex-col items-center lg:mt-3xl", children: pagination === 'paginated' && sortedRows.length > 0 ? (_jsx(GamesPagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (page) => {
61
71
  setCurrentPage(page);
62
- } })) : (_jsxs(_Fragment, { children: [_jsx(Progress.Root, { min: 0, max: totalRows, value: totalAvailableRows, onValueChange: noop, className: twMerge('w-[12.5rem]', classNames.progressRoot), children: _jsx(Progress.Track, { className: twMerge('bg-bg-tertiary', classNames.progressTrack), children: _jsx(Progress.Range, {}) }) }), _jsx("p", { className: "mt-md text-button-tertiary-fg text-sm", children: `Displaying ${totalAvailableRows} of ${totalRows}` }), hasNextPage && (_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, onClick: next, className: twMerge('mt-lg', classNames.loadMoreButton), children: "Load More" }))] })) })] }))] }) }));
72
+ } })) : (_jsxs(_Fragment, { children: [_jsx(Progress.Root, { min: 0, max: Math.max(totalRows, sortedRows.length), value: sortedRows.length, onValueChange: noop, className: twMerge('w-[12.5rem]', classNames.progressRoot), children: _jsx(Progress.Track, { className: twMerge('bg-bg-tertiary', classNames.progressTrack), children: _jsx(Progress.Range, {}) }) }), _jsx("p", { className: "mt-md text-button-tertiary-fg text-sm", children: `Displaying ${sortedRows.length} of ${Math.max(totalRows, sortedRows.length)}` }), hasNextPage && (_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, onClick: next, className: twMerge('mt-lg', classNames.loadMoreButton), children: "Load More" }))] })) })] }))] }) }));
63
73
  }
@@ -1,12 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { prefetchGamesQuery } from '../../server/utils/prefetchGamesQuery.js';
3
+ import { prefetchTopGamesQuery } from '../../server/utils/prefetchTopGamesQuery.js';
3
4
  import { GamesList__client } from './GamesList.client.js';
4
5
  export async function GamesList(props) {
5
- await prefetchGamesQuery({
6
- first: props.first ?? 24,
7
- filter: props.filter,
8
- search: props.search,
9
- sort: props.sort,
10
- });
6
+ await Promise.all([
7
+ prefetchGamesQuery({
8
+ first: props.first ?? 24,
9
+ filter: props.filter,
10
+ search: props.search,
11
+ sort: props.sort,
12
+ }),
13
+ prefetchTopGamesQuery(props.topGames),
14
+ ]);
11
15
  return _jsx(GamesList__client, { ...props });
12
16
  }
@@ -0,0 +1,8 @@
1
+ import type { GameProvider } from '../types';
2
+ interface TopGame {
3
+ id: string;
4
+ name: string;
5
+ provider?: GameProvider;
6
+ }
7
+ export declare const topGamesPerGameProvider: TopGame[];
8
+ export {};
@@ -0,0 +1,7 @@
1
+ export const topGamesPerGameProvider = [
2
+ { id: '22wPzivJmc8NeUKy9o', name: 'Super Ace', provider: 'JILI' },
3
+ { id: '22wPzhwTgWn2hKXro5', name: 'Golden Empire', provider: 'JILI' },
4
+ { id: '22wPzhoLfnaqZSZZL9', name: 'Fortune gems', provider: 'JILI' },
5
+ { id: '22wPziMpihMc6xSmEm', name: 'Money Coming', provider: 'JILI' },
6
+ { id: '22wPzhCeAKDP53sMvV', name: 'Boxing King', provider: 'JILI' },
7
+ ];
@@ -0,0 +1,2 @@
1
+ import type { TopGame } from '../../types';
2
+ export declare const prefetchTopGamesQuery: (topGames?: TopGame[]) => Promise<void>;
@@ -0,0 +1,18 @@
1
+ import { cache } from 'react';
2
+ import { getGamesv2__next } from '../../services/cmsPortal.js';
3
+ import { getQueryClient } from '../../utils/getQueryClient.js';
4
+ import { log } from '../../utils/log.js';
5
+ export const prefetchTopGamesQuery = cache(async (topGames) => {
6
+ const ids = (topGames ?? []).map((tg) => tg.id);
7
+ if (ids.length === 0)
8
+ return;
9
+ await getQueryClient()
10
+ .prefetchQuery({
11
+ queryKey: ['top-games', ids],
12
+ queryFn: async ({ signal }) => {
13
+ const results = await Promise.all(ids.map((id) => getGamesv2__next(id, { signal })));
14
+ return results.flatMap((res) => res.edges.map((edge) => edge.node));
15
+ },
16
+ })
17
+ .catch(() => log.text("'prefetchTopGamesQuery' failed", 'error'));
18
+ });
@@ -41,3 +41,4 @@ export interface GamesQueryVariables__Next {
41
41
  }
42
42
  export type GamesInput__Next = SimplifyDeep<GamesQueryVariables__Next>;
43
43
  export declare const getGames__next: (input?: GamesInput__Next, options?: HttpRequestOptions) => Promise<PaginatedQueryResult<Game>>;
44
+ export declare const getGamesv2__next: (ids: string, options?: HttpRequestOptions) => Promise<PaginatedQueryResult<Game>>;
@@ -172,3 +172,43 @@ export const getGames__next = cache(async (input, options) => {
172
172
  };
173
173
  }
174
174
  });
175
+ export const getGamesv2__next = cache(async (ids, options) => {
176
+ try {
177
+ const res = await httpRequest.json(`${CMS_PORTAL_ENDPOINT}/v2/games/${ids}`, {
178
+ cache: 'force-cache',
179
+ ...options,
180
+ next: {
181
+ revalidate: 60 * 60 * 4 /* 4hr */,
182
+ tags: ['games', ids],
183
+ ...options?.next,
184
+ },
185
+ });
186
+ const data = Array.isArray(res.data)
187
+ ? res.data
188
+ : res.data
189
+ ? [res.data]
190
+ : [];
191
+ return {
192
+ edges: data.map((node) => ({
193
+ node: node,
194
+ cursor: node.cursor,
195
+ })),
196
+ pageInfo: {
197
+ endCursor: res.next,
198
+ hasNextPage: Boolean(res.next),
199
+ },
200
+ totalCount: res.totalCount ?? data.length,
201
+ // ...
202
+ };
203
+ }
204
+ catch {
205
+ return {
206
+ edges: [],
207
+ totalCount: 0,
208
+ pageInfo: {
209
+ hasNextPage: false,
210
+ endCursor: null,
211
+ },
212
+ };
213
+ }
214
+ });
@@ -185,6 +185,11 @@ export interface RecommendedGame {
185
185
  type: GameType;
186
186
  provider: GameProvider;
187
187
  }
188
+ export interface TopGame {
189
+ id: string;
190
+ name: string;
191
+ provider?: GameProvider;
192
+ }
188
193
  export type GameSessionStatus = 'PENDING' | 'STARTING' | 'READY' | 'ENDED' | 'CANCELLED';
189
194
  export interface GameSessionLaunchOptions {
190
195
  token: string;