@opexa/portal-components 0.0.56 → 0.0.57

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.
@@ -27,6 +27,8 @@ export function JackpotCounterItem({ jackpot, className, viewAllUrl, }) {
27
27
  cursor: 'AMOUNT',
28
28
  order: 'DESC',
29
29
  },
30
+ }, {
31
+ enabled: typeof window !== 'undefined',
30
32
  });
31
33
  const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
32
34
  const topJackpotPayout = jackpotPayouts[0] ?? [];
@@ -0,0 +1,2 @@
1
+ import type { JackpotsProps } from './Jackpots';
2
+ export declare function Jackpots__client(props: JackpotsProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image from 'next/image';
4
+ import { useJackpotsQuery } from '../../client/hooks/index.js';
5
+ import closeChest from '../../images/close-chest.png';
6
+ import { JackpotItemDesktop } from './JackpotItemDesktop.js';
7
+ import { JackpotItemMobile } from './JackpotItemMobile.js';
8
+ export function Jackpots__client(props) {
9
+ const jackpotsQuery = useJackpotsQuery({
10
+ first: 100,
11
+ filter: {
12
+ status: {
13
+ equal: 'ACTIVE',
14
+ },
15
+ deleted: {
16
+ equal: false,
17
+ },
18
+ },
19
+ sort: {
20
+ cursor: 'POOL',
21
+ order: 'DESC',
22
+ },
23
+ });
24
+ const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
25
+ if (jackpots.length <= 0)
26
+ return null;
27
+ return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotItemDesktop, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotItemMobile, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
28
+ }
@@ -7,4 +7,4 @@ export interface JackpotsProps {
7
7
  className?: string;
8
8
  gameProviders: GameProviderData[];
9
9
  }
10
- export declare function Jackpots(props: JackpotsProps): import("react/jsx-runtime").JSX.Element | null;
10
+ export declare function Jackpots(props: JackpotsProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,12 +1,8 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Image from 'next/image';
4
- import { useJackpotsQuery } from '../../client/hooks/index.js';
5
- import closeChest from '../../images/close-chest.png';
6
- import { JackpotItemDesktop } from './JackpotItemDesktop.js';
7
- import { JackpotItemMobile } from './JackpotItemMobile.js';
8
- export function Jackpots(props) {
9
- const jackpotsQuery = useJackpotsQuery({
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { prefetchJackpotsQuery } from '../../server/utils/index.js';
3
+ import { Jackpots__client } from './Jackpots.client.js';
4
+ export async function Jackpots(props) {
5
+ await prefetchJackpotsQuery({
10
6
  first: 100,
11
7
  filter: {
12
8
  status: {
@@ -21,8 +17,5 @@ export function Jackpots(props) {
21
17
  order: 'DESC',
22
18
  },
23
19
  });
24
- const jackpots = jackpotsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
25
- if (jackpots.length <= 0)
26
- return null;
27
- return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotItemDesktop, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotItemMobile, { gameProviders: props.gameProviders, jackpot: jackpot, viewAllUrl: props.viewAllUrl }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
20
+ return _jsx(Jackpots__client, { ...props });
28
21
  }
@@ -17,6 +17,8 @@ export function useJackpotItemData({ jackpot, gameProviders, }) {
17
17
  cursor: 'AMOUNT',
18
18
  order: 'DESC',
19
19
  },
20
+ }, {
21
+ enabled: typeof window !== 'undefined',
20
22
  });
21
23
  const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
22
24
  const topJackpotPayout = jackpotPayouts[0] ?? [];
@@ -0,0 +1,2 @@
1
+ import type { QuestsProps } from './Quests';
2
+ export declare function Quests__client(props: QuestsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image from 'next/image';
4
+ import { useAvailableQuestsQuery } from '../../client/hooks/index.js';
5
+ import { SpinnerIcon } from '../../icons/index.js';
6
+ import closeChest from '../../images/close-chest.png';
7
+ import { DailyCheckInQuest } from './DailyCheckInQuest/DailyCheckInQuest.js';
8
+ import { OnboardingQuest } from './OnboardingQuest/OnboardingQuest.js';
9
+ import { WageringQuest } from './WageringQuest/WageringQuest.js';
10
+ const QUEST_COMPONENT_MAP = {
11
+ DAILY_CHECKIN: DailyCheckInQuest,
12
+ ONBOARDING: OnboardingQuest,
13
+ WAGERING: WageringQuest,
14
+ };
15
+ export function Quests__client(props) {
16
+ const query = useAvailableQuestsQuery();
17
+ if (query.isLoading) {
18
+ return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsx(SpinnerIcon, { className: "mx-auto size-5 h-[50vh]" })] }));
19
+ }
20
+ if (!query.data?.length) {
21
+ return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { src: closeChest, width: 100, height: 100, alt: "No Quests Available", className: "mix-blend-luminosity", quality: 100 }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Quests' }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: "No available quests. Please check back later!" })] })] }));
22
+ }
23
+ return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsx("div", { className: "grid grid-cols-1 gap-3xl lg:grid-cols-3", children: query.data.map((quest, index) => {
24
+ const QuestComponent = QUEST_COMPONENT_MAP[quest.type];
25
+ return _jsx(QuestComponent, { quest: quest }, index);
26
+ }) })] }));
27
+ }
@@ -3,4 +3,4 @@ export interface QuestsProps {
3
3
  heading?: string;
4
4
  className?: string;
5
5
  }
6
- export declare function Quests(props: QuestsProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Quests(props: QuestsProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,27 +1,7 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Image from 'next/image';
4
- import { useAvailableQuestsQuery } from '../../client/hooks/index.js';
5
- import { SpinnerIcon } from '../../icons/index.js';
6
- import closeChest from '../../images/close-chest.png';
7
- import { DailyCheckInQuest } from './DailyCheckInQuest/DailyCheckInQuest.js';
8
- import { OnboardingQuest } from './OnboardingQuest/OnboardingQuest.js';
9
- import { WageringQuest } from './WageringQuest/WageringQuest.js';
10
- const QUEST_COMPONENT_MAP = {
11
- DAILY_CHECKIN: DailyCheckInQuest,
12
- ONBOARDING: OnboardingQuest,
13
- WAGERING: WageringQuest,
14
- };
15
- export function Quests(props) {
16
- const query = useAvailableQuestsQuery();
17
- if (query.isLoading) {
18
- return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsx(SpinnerIcon, { className: "mx-auto size-5 h-[50vh]" })] }));
19
- }
20
- if (!query.data?.length) {
21
- return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { src: closeChest, width: 100, height: 100, alt: "No Quests Available", className: "mix-blend-luminosity", quality: 100 }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Quests' }), _jsx("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: "No available quests. Please check back later!" })] })] }));
22
- }
23
- return (_jsxs("div", { className: props.className, children: [_jsx("h3", { className: "mb-3 text-lg font-semibold", children: props.heading ?? 'Quests' }), _jsx("div", { className: "grid grid-cols-1 gap-3xl lg:grid-cols-3", children: query.data.map((quest, index) => {
24
- const QuestComponent = QUEST_COMPONENT_MAP[quest.type];
25
- return _jsx(QuestComponent, { quest: quest }, index);
26
- }) })] }));
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { prefetchAvailableQuestsQuery } from '../../server/utils/index.js';
3
+ import { Quests__client } from './Quests.client.js';
4
+ export async function Quests(props) {
5
+ await prefetchAvailableQuestsQuery();
6
+ return _jsx(Quests__client, { ...props });
27
7
  }
@@ -0,0 +1,2 @@
1
+ import type { TournamentsProps } from './Tournaments';
2
+ export declare function Tournaments__client(props: TournamentsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Image from 'next/image';
4
+ import { useTournamentsQuery } from '../../client/hooks/index.js';
5
+ import closeChest from '../../images/close-chest.png';
6
+ import { TournamentItemDesktop } from './TournamentItemDesktop.js';
7
+ import { TournamentItemMobile } from './TournamentItemMobile.js';
8
+ export function Tournaments__client(props) {
9
+ const tournamentsQuery = useTournamentsQuery({
10
+ first: 100,
11
+ filter: {
12
+ status: {
13
+ equal: 'ACTIVE',
14
+ },
15
+ },
16
+ });
17
+ const tournaments = tournamentsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
18
+ return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Tournaments' }), tournaments.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: tournaments.map((tournament, i) => (_jsx(TournamentItemDesktop, { tournament: tournament, gameProviders: props.gameProviders }, i))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: tournaments.map((tournament, i) => (_jsx(TournamentItemMobile, { tournament: tournament, gameProviders: props.gameProviders }, i))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'tournaments', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
19
+ }
@@ -7,4 +7,4 @@ export interface TournamentsProps {
7
7
  className?: string;
8
8
  gameProviders: GameProviderData[];
9
9
  }
10
- export declare function Tournaments(props: TournamentsProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function Tournaments(props: TournamentsProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,12 +1,8 @@
1
- 'use client';
2
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Image from 'next/image';
4
- import { useTournamentsQuery } from '../../client/hooks/index.js';
5
- import closeChest from '../../images/close-chest.png';
6
- import { TournamentItemDesktop } from './TournamentItemDesktop.js';
7
- import { TournamentItemMobile } from './TournamentItemMobile.js';
8
- export function Tournaments(props) {
9
- const tournamentsQuery = useTournamentsQuery({
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { prefetchTournamentsQuery } from '../../server/utils/index.js';
3
+ import { Tournaments__client } from './Tournaments.client.js';
4
+ export async function Tournaments(props) {
5
+ await prefetchTournamentsQuery({
10
6
  first: 100,
11
7
  filter: {
12
8
  status: {
@@ -14,6 +10,5 @@ export function Tournaments(props) {
14
10
  },
15
11
  },
16
12
  });
17
- const tournaments = tournamentsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
18
- return (_jsxs("div", { className: props.className, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Tournaments' }), tournaments.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: tournaments.map((tournament, i) => (_jsx(TournamentItemDesktop, { tournament: tournament, gameProviders: props.gameProviders }, i))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: tournaments.map((tournament, i) => (_jsx(TournamentItemMobile, { tournament: tournament, gameProviders: props.gameProviders }, i))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Tournaments' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'tournaments', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }));
13
+ return _jsx(Tournaments__client, { ...props });
19
14
  }
@@ -1,5 +1,6 @@
1
1
  export * from './prefetchAccountQuery';
2
2
  export * from './prefetchAvailablePromosQuery';
3
+ export * from './prefetchAvailableQuestsQuery';
3
4
  export * from './prefetchBetRecordsQuery';
4
5
  export * from './prefetchBonusesQuery';
5
6
  export * from './prefetchCashbacksQuery';
@@ -1,5 +1,6 @@
1
1
  export * from './prefetchAccountQuery.js';
2
2
  export * from './prefetchAvailablePromosQuery.js';
3
+ export * from './prefetchAvailableQuestsQuery.js';
3
4
  export * from './prefetchBetRecordsQuery.js';
4
5
  export * from './prefetchBonusesQuery.js';
5
6
  export * from './prefetchCashbacksQuery.js';
@@ -0,0 +1 @@
1
+ export declare const prefetchAvailableQuestsQuery: () => Promise<void>;
@@ -0,0 +1,22 @@
1
+ import { getAvailableQuests } from '@opexa/portal-sdk-core';
2
+ import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
3
+ import { getAvailableQuestsQueryKey, getQueryClient } from '../../utils/index.js';
4
+ import { getSession } from '../services/getSession.js';
5
+ export const prefetchAvailableQuestsQuery = async () => {
6
+ const session = await getSession();
7
+ if (session.status === 'unauthenticated')
8
+ return;
9
+ await getQueryClient().prefetchQuery({
10
+ queryKey: getAvailableQuestsQueryKey(),
11
+ queryFn: async ({ signal }) => {
12
+ return await getAvailableQuests({
13
+ signal,
14
+ environment: ENVIRONMENT,
15
+ headers: {
16
+ 'Platform-Code': PLATFORM_CODE,
17
+ Authorization: `Bearer ${session.token}`,
18
+ },
19
+ });
20
+ },
21
+ });
22
+ };