@opexa/portal-components 0.1.54 → 0.1.56
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/useRecentGamesQuery.d.ts +2 -0
- package/dist/client/hooks/useRecentGamesQuery.js +49 -0
- package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +1 -1
- package/dist/components/Disclaimer/DisclaimerV2.js +0 -8
- package/dist/components/Migrate/MigrateInitializing.js +1 -1
- package/dist/components/Promos/Cashback.d.ts +3 -1
- package/dist/components/Promos/Cashback.js +4 -4
- package/dist/components/Promos/CustomPromo.d.ts +3 -1
- package/dist/components/Promos/CustomPromo.js +3 -2
- package/dist/components/Promos/Promo.d.ts +3 -1
- package/dist/components/Promos/Promo.js +4 -4
- package/dist/components/Promos/PromosCarousel.d.ts +2 -0
- package/dist/components/Promos/PromosCarousel.js +1 -1
- package/dist/components/Promos/PromosGrid.d.ts +13 -0
- package/dist/components/Promos/PromosGrid.js +1 -1
- package/dist/components/Promos/index.d.ts +1 -0
- package/dist/components/Promos/utils.d.ts +1 -0
- package/dist/components/Promos/utils.js +10 -0
- package/dist/components/RecentGames/RecentGames.client.d.ts +15 -0
- package/dist/components/RecentGames/RecentGames.client.js +60 -0
- package/dist/components/RecentGames/RecentGames.d.ts +3 -0
- package/dist/components/RecentGames/RecentGames.js +7 -0
- package/dist/components/RecentGames/index.d.ts +1 -0
- package/dist/components/RecentGames/index.js +1 -0
- package/dist/handlers/index.d.ts +2 -2
- package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
- package/dist/server/utils/prefetchRecentGamesQuery.d.ts +1 -0
- package/dist/server/utils/prefetchRecentGamesQuery.js +40 -0
- package/dist/services/portal.d.ts +5 -1
- package/dist/services/portal.js +5 -1
- package/dist/services/queries.d.ts +1 -0
- package/dist/services/queries.js +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/utils/queryKeys.d.ts +1 -0
- package/dist/utils/queryKeys.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
import { getGames__next } from '../../services/cmsPortal.js';
|
|
4
|
+
import { getRecentGames } from '../../services/portal.js';
|
|
5
|
+
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
6
|
+
import { getRecentGamesQueryKey, getSessionQueryKey, } from '../../utils/queryKeys.js';
|
|
7
|
+
import { getSession } from '../services/getSession.js';
|
|
8
|
+
import { useSessionQuery } from './useSessionQuery.js';
|
|
9
|
+
export const useRecentGamesQuery = (config) => {
|
|
10
|
+
const sessionQuery = useSessionQuery();
|
|
11
|
+
return useQuery({
|
|
12
|
+
refetchOnMount: false,
|
|
13
|
+
refetchOnReconnect: false,
|
|
14
|
+
refetchOnWindowFocus: false,
|
|
15
|
+
...config,
|
|
16
|
+
enabled: config?.enabled === false
|
|
17
|
+
? false
|
|
18
|
+
: sessionQuery.data?.status === 'authenticated',
|
|
19
|
+
queryKey: getRecentGamesQueryKey(),
|
|
20
|
+
queryFn: async ({ signal }) => {
|
|
21
|
+
const session = await getQueryClient().fetchQuery({
|
|
22
|
+
queryKey: getSessionQueryKey(),
|
|
23
|
+
queryFn: async () => getSession(),
|
|
24
|
+
});
|
|
25
|
+
invariant(session.status === 'authenticated');
|
|
26
|
+
const recentGames = await getRecentGames({
|
|
27
|
+
signal,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${session.token}`,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const ids = recentGames?.length
|
|
33
|
+
? [...new Set(recentGames.map((g) => g.id))]
|
|
34
|
+
: [];
|
|
35
|
+
if (ids.length <= 0)
|
|
36
|
+
return [];
|
|
37
|
+
const res = await getGames__next({
|
|
38
|
+
filter: {
|
|
39
|
+
reference: {
|
|
40
|
+
in: ids,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}, { signal });
|
|
44
|
+
return ids
|
|
45
|
+
.map((id) => res.edges.find((e) => id === e.node.reference)?.node ?? null)
|
|
46
|
+
.filter((g) => g !== null);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -50,7 +50,7 @@ const VentajaWithdrawal = lazy(() => import('./VentajaWithdrawal/VentajaWithdraw
|
|
|
50
50
|
})));
|
|
51
51
|
export function Withdrawal() {
|
|
52
52
|
const { onMaya } = useMayaAuth();
|
|
53
|
-
const {
|
|
53
|
+
const { enabledWithdrawalProviders } = useDepositWithdrawalPropsContext();
|
|
54
54
|
const walletQuery = useWalletQuery();
|
|
55
55
|
const featureFlag = useFeatureFlag();
|
|
56
56
|
const wallet = walletQuery.data;
|
|
@@ -9,7 +9,6 @@ import { twMerge } from 'tailwind-merge';
|
|
|
9
9
|
import { useShallow } from 'zustand/shallow';
|
|
10
10
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
11
11
|
import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
|
|
12
|
-
import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
|
|
13
12
|
import { getSession } from '../../client/services/getSession.js';
|
|
14
13
|
import { TERMS_OF_USE_PENDING_STORAGE_KEY } from '../../constants/index.js';
|
|
15
14
|
import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
|
|
@@ -21,7 +20,6 @@ import { Button } from '../../ui/Button/index.js';
|
|
|
21
20
|
import { Checkbox } from '../../ui/Checkbox/index.js';
|
|
22
21
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
23
22
|
import { Portal } from '../../ui/Portal/index.js';
|
|
24
|
-
import { clearLocalStorageOnLogout } from '../../utils/clear-local-storage-on-logout.js';
|
|
25
23
|
import { setDisclaimerAccepted } from '../../utils/disclaimer-cooldown.js';
|
|
26
24
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
27
25
|
import { getSessionQueryKey } from '../../utils/queryKeys.js';
|
|
@@ -55,12 +53,6 @@ export function DisclaimerV2(props) {
|
|
|
55
53
|
globalStore.termsOfUse.accepted,
|
|
56
54
|
globalStore.termsOfUse.setAccepted,
|
|
57
55
|
]);
|
|
58
|
-
const signOutMutation = useSignOutMutation({
|
|
59
|
-
async onSuccess() {
|
|
60
|
-
clearLocalStorageOnLogout();
|
|
61
|
-
sessionStorage.clear();
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
56
|
const handleExit = async () => {
|
|
65
57
|
if (props.redirectUrlOnNoConsent) {
|
|
66
58
|
if (Capacitor.isNativePlatform()) {
|
|
@@ -10,5 +10,5 @@ export const MIGRATE_LOADER_TITLE = 'Account migration';
|
|
|
10
10
|
export const SIGN_IN_LOADER_TITLE = 'Signing in';
|
|
11
11
|
export function MigrateInitializing(props) {
|
|
12
12
|
const footerText = props.footerText ?? LOADER_FOOTER;
|
|
13
|
-
return (_jsx("div", { className: mergeMigrateCardClassName(props.className), children: _jsxs("div", { className: "flex flex-col items-stretch gap-5 px-0.5 py-1 sm:px-1", children: [_jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "relative h-20 w-20 shrink-0", "aria-hidden": true, children: [_jsx("div", { className: "absolute inset-0 animate-spin rounded-full border-4 border-bg-tertiary border-t-button-tertiary-fg [animation-duration:1s]" }), _jsx("div", { className: "absolute inset-0 flex items-center justify-center text-button-tertiary-fg", children: props.logo ? (_jsx(Image, { src: props.logo, alt: "", width: 20, height: 20, className: "h-12 w-12 object-contain" })) : (_jsx(User01Icon, { className: "h-7 w-7", "aria-hidden": true })) })] }) }), _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-1.5", children: [_jsx("h1", { className: "font-semibold text-text-primary-900
|
|
13
|
+
return (_jsx("div", { className: mergeMigrateCardClassName(props.className), children: _jsxs("div", { className: "flex flex-col items-stretch gap-5 px-0.5 py-1 sm:px-1", children: [_jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "relative h-20 w-20 shrink-0", "aria-hidden": true, children: [_jsx("div", { className: "absolute inset-0 animate-spin rounded-full border-4 border-bg-tertiary border-t-button-tertiary-fg [animation-duration:1s]" }), _jsx("div", { className: "absolute inset-0 flex items-center justify-center text-button-tertiary-fg", children: props.logo ? (_jsx(Image, { src: props.logo, alt: "", width: 20, height: 20, className: "h-12 w-12 object-contain" })) : (_jsx(User01Icon, { className: "h-7 w-7", "aria-hidden": true })) })] }) }), _jsxs("div", { className: "flex w-full min-w-0 flex-col gap-1.5", children: [_jsx("h1", { className: "font-semibold text-lg text-text-primary-900 tracking-tight", children: props.title }), _jsx("p", { className: "min-w-0 max-w-full text-balance text-center text-sm text-text-secondary-700 leading-relaxed", children: LOADER_HEADLINE })] }), _jsxs("div", { className: "w-full min-w-0 space-y-1.5", children: [_jsxs("div", { className: "flex w-full min-w-0 items-center justify-between gap-3 text-text-tertiary-600 text-xs", children: [_jsx("span", { className: "min-w-0 truncate text-left", children: props.phaseLabel }), _jsxs("span", { className: "shrink-0 text-text-tertiary-600/90 tabular-nums", children: [props.pctShown, "%"] })] }), _jsx("div", { className: "h-2 w-full min-w-0 overflow-hidden rounded-full bg-bg-tertiary", children: _jsx("div", { className: "h-full rounded-full bg-button-primary-bg transition-[width] duration-1000 ease-[cubic-bezier(0.33,1,0.68,1)]", style: { width: `${props.barPct}%` } }) })] }), _jsx("p", { className: "min-w-0 max-w-full text-balance text-center text-text-tertiary-600/80 text-xs leading-relaxed", children: footerText })] }) }));
|
|
14
14
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Cashback as TCashback } from '../../types';
|
|
2
|
+
import type { PromoCardClassNames } from './PromosGrid';
|
|
2
3
|
interface CashbackProps {
|
|
3
4
|
data: TCashback;
|
|
4
5
|
viewDetailsUrl: string;
|
|
5
6
|
hasPromotionPeriod?: boolean;
|
|
6
7
|
roundedButtons?: boolean;
|
|
7
8
|
textOrientation?: 'left' | 'center';
|
|
9
|
+
cardClassNames?: PromoCardClassNames;
|
|
8
10
|
}
|
|
9
|
-
export declare function Cashback({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation, }: CashbackProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Cashback({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation, cardClassNames, }: CashbackProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -6,16 +6,16 @@ import { useShallow } from 'zustand/shallow';
|
|
|
6
6
|
import { useAvailablePromosQuery } from '../../client/hooks/useAvailablePromosQuery.js';
|
|
7
7
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
8
8
|
import { Button } from '../../ui/Button/index.js';
|
|
9
|
-
import { formatPromotionPeriod } from './utils.js';
|
|
10
|
-
export function Cashback({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation = 'center', }) {
|
|
9
|
+
import { formatPromotionPeriod, mergePromoCardClassName } from './utils.js';
|
|
10
|
+
export function Cashback({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation = 'center', cardClassNames, }) {
|
|
11
11
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
12
12
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
13
13
|
})));
|
|
14
14
|
const claimablePromos = useAvailablePromosQuery().data ?? [];
|
|
15
15
|
const claimable = claimablePromos.find((availablePromo) => availablePromo.id === data.id);
|
|
16
16
|
const promotionPeriod = formatPromotionPeriod(data.activationStartDateTime, data.activationEndDateTime);
|
|
17
|
-
return (_jsxs("div", { className:
|
|
17
|
+
return (_jsxs("div", { className: mergePromoCardClassName('relative flex h-full flex-col overflow-hidden rounded-2xl border border-border-secondary bg-accent-50 bg-bg-primary-alt', cardClassNames?.container), children: [data.banner?.url && (_jsx(Image, { src: data.banner.url, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: mergePromoCardClassName('block aspect-[365/180] w-full object-cover', cardClassNames?.image) })), hasPromotionPeriod && (_jsxs("div", { className: mergePromoCardClassName('bg-black py-1.5 text-center font-bold text-3xs uppercase', cardClassNames?.promotionPeriod), children: ["PROMOTION PERIOD: ", promotionPeriod] })), _jsxs("div", { className: mergePromoCardClassName('flex flex-grow flex-col px-4 pt-2xl pb-3xl', cardClassNames?.body), children: [_jsx("div", { className: mergePromoCardClassName(twMerge('w-full grow font-semibold text-xl', textOrientation === 'center' ? 'text-center' : 'text-left'), cardClassNames?.title), children: data.name }), _jsxs("div", { className: mergePromoCardClassName('mt-auto flex flex-col gap-3 pt-4 lg:flex-row', cardClassNames?.actions), children: [claimable && (_jsx(Button, { size: "sm", className: cardClassNames?.claimButton, onClick: () => {
|
|
18
18
|
globalStore.depositWithdrawal.setOpen(true);
|
|
19
19
|
globalStore.depositWithdrawal.setPromo(data.id);
|
|
20
|
-
}, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, className: roundedButtons ? 'rounded-full' : '', children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
|
|
20
|
+
}, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, className: mergePromoCardClassName(roundedButtons ? 'rounded-full' : '', cardClassNames?.detailsButton), children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
|
|
21
21
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { CustomPromo as TCustomPromo } from '../../types';
|
|
2
|
+
import type { PromoCardClassNames } from './PromosGrid';
|
|
2
3
|
interface CustomPromoProps {
|
|
3
4
|
data: TCustomPromo;
|
|
4
5
|
viewDetailsUrl: string;
|
|
5
6
|
roundedButtons?: boolean;
|
|
6
7
|
textOrientation?: 'left' | 'center';
|
|
8
|
+
cardClassNames?: PromoCardClassNames;
|
|
7
9
|
}
|
|
8
|
-
export declare function CustomPromo({ data, viewDetailsUrl, roundedButtons, textOrientation, }: CustomPromoProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function CustomPromo({ data, viewDetailsUrl, roundedButtons, textOrientation, cardClassNames, }: CustomPromoProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -3,6 +3,7 @@ import Image from 'next/image';
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { Button } from '../../ui/Button/index.js';
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { mergePromoCardClassName } from './utils.js';
|
|
7
|
+
export function CustomPromo({ data, viewDetailsUrl, roundedButtons, textOrientation = 'center', cardClassNames, }) {
|
|
8
|
+
return (_jsxs("div", { className: mergePromoCardClassName('relative flex h-full flex-col overflow-hidden rounded-2xl border border-border-secondary bg-accent-50 bg-bg-primary-alt', cardClassNames?.container), children: [_jsx(Image, { src: data.banner, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: mergePromoCardClassName('block aspect-[365/180] w-full object-cover', cardClassNames?.image) }), _jsxs("div", { className: mergePromoCardClassName('flex flex-grow flex-col px-4 pt-2xl pb-3xl', cardClassNames?.body), children: [_jsx("div", { className: mergePromoCardClassName(twMerge('w-full grow font-semibold text-xl', textOrientation === 'center' ? 'text-center' : 'text-left'), cardClassNames?.title), children: data.name }), _jsx("div", { className: mergePromoCardClassName('mt-auto flex flex-col gap-3 pt-4 lg:flex-row', cardClassNames?.actions), children: _jsx(Button, { size: "sm", variant: "outline", asChild: true, className: mergePromoCardClassName(roundedButtons ? 'rounded-full' : '', cardClassNames?.detailsButton), children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) }) })] })] }));
|
|
8
9
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Promo as TPromo } from '../../types';
|
|
2
|
+
import type { PromoCardClassNames } from './PromosGrid';
|
|
2
3
|
interface PromoProps {
|
|
3
4
|
data: TPromo;
|
|
4
5
|
viewDetailsUrl: string;
|
|
5
6
|
hasPromotionPeriod?: boolean;
|
|
6
7
|
roundedButtons?: boolean;
|
|
7
8
|
textOrientation?: 'left' | 'center';
|
|
9
|
+
cardClassNames?: PromoCardClassNames;
|
|
8
10
|
}
|
|
9
|
-
export declare function Promo({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation, }: PromoProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function Promo({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation, cardClassNames, }: PromoProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -6,16 +6,16 @@ import { useShallow } from 'zustand/shallow';
|
|
|
6
6
|
import { useAvailablePromosQuery } from '../../client/hooks/useAvailablePromosQuery.js';
|
|
7
7
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
8
8
|
import { Button } from '../../ui/Button/index.js';
|
|
9
|
-
import { formatPromotionPeriod } from './utils.js';
|
|
10
|
-
export function Promo({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation = 'center', }) {
|
|
9
|
+
import { formatPromotionPeriod, mergePromoCardClassName } from './utils.js';
|
|
10
|
+
export function Promo({ data, viewDetailsUrl, hasPromotionPeriod, roundedButtons, textOrientation = 'center', cardClassNames, }) {
|
|
11
11
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
12
12
|
depositWithdrawal: ctx.depositWithdrawal,
|
|
13
13
|
})));
|
|
14
14
|
const claimablePromos = useAvailablePromosQuery().data ?? [];
|
|
15
15
|
const claimable = claimablePromos.find((availablePromo) => availablePromo.id === data.id);
|
|
16
16
|
const promotionPeriod = formatPromotionPeriod(data.activationStartDateTime, data.activationEndDateTime);
|
|
17
|
-
return (_jsxs("div", { className:
|
|
17
|
+
return (_jsxs("div", { className: mergePromoCardClassName('relative flex h-full flex-col overflow-hidden rounded-2xl border border-border-secondary bg-accent-50 bg-bg-primary-alt', cardClassNames?.container), children: [data.banner?.url && (_jsx(Image, { src: data.banner.url, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: mergePromoCardClassName('block aspect-[365/180] w-full object-cover', cardClassNames?.image) })), hasPromotionPeriod && (_jsxs("div", { className: mergePromoCardClassName('bg-black py-1.5 text-center font-bold text-3xs uppercase', cardClassNames?.promotionPeriod), children: ["PROMOTION PERIOD: ", promotionPeriod] })), _jsxs("div", { className: mergePromoCardClassName('flex flex-grow flex-col px-4 pt-2xl pb-3xl', cardClassNames?.body), children: [_jsx("div", { className: mergePromoCardClassName(twMerge('w-full grow font-semibold text-xl', textOrientation === 'center' ? 'text-center' : 'text-left'), cardClassNames?.title), children: data.name }), _jsxs("div", { className: mergePromoCardClassName('mt-auto flex flex-col gap-3 pt-4 lg:flex-row', cardClassNames?.actions), children: [claimable && (_jsx(Button, { size: "sm", className: cardClassNames?.claimButton, onClick: () => {
|
|
18
18
|
globalStore.depositWithdrawal.setOpen(true);
|
|
19
19
|
globalStore.depositWithdrawal.setPromo(data.id);
|
|
20
|
-
}, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, className: roundedButtons ? 'rounded-full' : '', children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
|
|
20
|
+
}, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, className: mergePromoCardClassName(roundedButtons ? 'rounded-full' : '', cardClassNames?.detailsButton), children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
|
|
21
21
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { CustomPromo as TCustomPromo } from '../../types';
|
|
3
|
+
import type { PromoCardClassNames } from './PromosGrid';
|
|
3
4
|
export interface PromosCarouselProps {
|
|
4
5
|
layout: 'carousel';
|
|
5
6
|
/** @default "Promotions" */
|
|
@@ -13,6 +14,7 @@ export interface PromosCarouselProps {
|
|
|
13
14
|
/** @default "/promos/custom" */
|
|
14
15
|
viewCustomPromoDetailsUrl?: string;
|
|
15
16
|
customPromos?: TCustomPromo[];
|
|
17
|
+
cardClassNames?: PromoCardClassNames;
|
|
16
18
|
/**
|
|
17
19
|
* @description List of promo IDs to be excluded from the list.
|
|
18
20
|
* @example
|
|
@@ -48,5 +48,5 @@ export function PromosCarousel(props) {
|
|
|
48
48
|
onSelect(emblaApi);
|
|
49
49
|
emblaApi.on('reInit', onSelect).on('select', onSelect);
|
|
50
50
|
}, [emblaApi, onSelect]);
|
|
51
|
-
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Promotions' }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/promos', className: "flex gap-sm font-semibold text-button-tertiary-fg text-sm", 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: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-8" })), !empty && (_jsx("div", { ref: emblaRef, className: "relative mt-lg overflow-hidden", children: _jsxs("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: [promos.map((promo) => (_jsx(Promo, { data: promo, viewDetailsUrl: props.viewPromoDetailsUrl ?? '/promos' }, promo.id))), cashbacks.map((cashback) => (_jsx(Cashback, { data: cashback, viewDetailsUrl: props.viewCashbackDetailsUrl ?? '/promos/cashback' }, cashback.id))), customPromos.map((customPromo) => (_jsx(CustomPromo, { data: customPromo, viewDetailsUrl: props.
|
|
51
|
+
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Promotions' }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [_jsxs(Link, { href: props.viewAllUrl ?? '/promos', className: "flex gap-sm font-semibold text-button-tertiary-fg text-sm", 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: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-8" })), !empty && (_jsx("div", { ref: emblaRef, className: "relative mt-lg overflow-hidden", children: _jsxs("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: [promos.map((promo) => (_jsx(Promo, { data: promo, viewDetailsUrl: props.viewPromoDetailsUrl ?? '/promos', cardClassNames: props.cardClassNames }, promo.id))), cashbacks.map((cashback) => (_jsx(Cashback, { data: cashback, viewDetailsUrl: props.viewCashbackDetailsUrl ?? '/promos/cashback', cardClassNames: props.cardClassNames }, cashback.id))), customPromos.map((customPromo) => (_jsx(CustomPromo, { data: customPromo, viewDetailsUrl: props.viewCustomPromoDetailsUrl ?? '/promos/custom', cardClassNames: props.cardClassNames }, customPromo.id)))] }) }))] }));
|
|
52
52
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { CustomPromo as TCustomPromo } from '../../types';
|
|
3
|
+
export interface PromoCardClassNames {
|
|
4
|
+
container?: string;
|
|
5
|
+
image?: string;
|
|
6
|
+
promotionPeriod?: string;
|
|
7
|
+
body?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
actions?: string;
|
|
10
|
+
claimButton?: string;
|
|
11
|
+
detailsButton?: string;
|
|
12
|
+
}
|
|
3
13
|
export interface PromosGridProps {
|
|
4
14
|
layout: 'grid';
|
|
5
15
|
/** @default "Promotions" */
|
|
@@ -8,10 +18,13 @@ export interface PromosGridProps {
|
|
|
8
18
|
viewPromoDetailsUrl?: string;
|
|
9
19
|
/** @default "/promos/cashback" */
|
|
10
20
|
viewCashbackDetailsUrl?: string;
|
|
21
|
+
/** @default "/promos/custom" */
|
|
22
|
+
viewCustomPromoDetailsUrl?: string;
|
|
11
23
|
customPromos?: TCustomPromo[];
|
|
12
24
|
hasPromotionPeriod?: boolean;
|
|
13
25
|
roundedButtons?: boolean;
|
|
14
26
|
textOrientation?: 'left' | 'center';
|
|
27
|
+
cardClassNames?: PromoCardClassNames;
|
|
15
28
|
exclude?: string[];
|
|
16
29
|
className?: string;
|
|
17
30
|
}
|
|
@@ -15,5 +15,5 @@ export function PromosGrid(props) {
|
|
|
15
15
|
const cashbacks = cashbacksQuery.data?.filter((item) => !blacklist.includes(item.id)) ?? [];
|
|
16
16
|
const customPromos = props.customPromos?.filter((item) => !blacklist.includes(item.id)) ?? [];
|
|
17
17
|
const empty = promos.length <= 0 && cashbacks.length <= 0 && customPromos.length <= 0;
|
|
18
|
-
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Promos' }), _jsx("div", { className: "grow" })] }), empty && (_jsx(Empty, { icon: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-8" })), !empty && (_jsx("div", { className: "relative mt-lg lg:overflow-hidden", children: _jsxs("div", { className: "grid gap-3xl lg:grid-cols-3 lg:gap-2xl", children: [promos.map((promo) => (_jsx(Promo, { data: promo, viewDetailsUrl: props.viewPromoDetailsUrl ?? '/promos', hasPromotionPeriod: props.hasPromotionPeriod, roundedButtons: props.roundedButtons, textOrientation: props.textOrientation }, promo.id))), cashbacks.map((cashback) => (_jsx(Cashback, { data: cashback, viewDetailsUrl: props.viewCashbackDetailsUrl ?? '/promos/cashback', hasPromotionPeriod: props.hasPromotionPeriod, roundedButtons: props.roundedButtons, textOrientation: props.textOrientation }, cashback.id))), customPromos.map((customPromo) => (_jsx(CustomPromo, { data: customPromo, viewDetailsUrl: props.
|
|
18
|
+
return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Promos' }), _jsx("div", { className: "grow" })] }), empty && (_jsx(Empty, { icon: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-8" })), !empty && (_jsx("div", { className: "relative mt-lg lg:overflow-hidden", children: _jsxs("div", { className: "grid gap-3xl lg:grid-cols-3 lg:gap-2xl", children: [promos.map((promo) => (_jsx(Promo, { data: promo, viewDetailsUrl: props.viewPromoDetailsUrl ?? '/promos', hasPromotionPeriod: props.hasPromotionPeriod, roundedButtons: props.roundedButtons, textOrientation: props.textOrientation, cardClassNames: props.cardClassNames }, promo.id))), cashbacks.map((cashback) => (_jsx(Cashback, { data: cashback, viewDetailsUrl: props.viewCashbackDetailsUrl ?? '/promos/cashback', hasPromotionPeriod: props.hasPromotionPeriod, roundedButtons: props.roundedButtons, textOrientation: props.textOrientation, cardClassNames: props.cardClassNames }, cashback.id))), customPromos.map((customPromo) => (_jsx(CustomPromo, { data: customPromo, viewDetailsUrl: props.viewCustomPromoDetailsUrl ?? '/promos/custom', roundedButtons: props.roundedButtons, textOrientation: props.textOrientation, cardClassNames: props.cardClassNames }, customPromo.id)))] }) }))] }));
|
|
19
19
|
}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { format } from 'date-fns';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
export function mergePromoCardClassName(defaultClassName, customClassName) {
|
|
4
|
+
if (!customClassName)
|
|
5
|
+
return defaultClassName;
|
|
6
|
+
const mergedCustomClassName = twMerge(customClassName);
|
|
7
|
+
const preservedDefaultClasses = defaultClassName
|
|
8
|
+
.split(/\s+/)
|
|
9
|
+
.filter((defaultClass) => twMerge(defaultClass, mergedCustomClassName) !== mergedCustomClassName);
|
|
10
|
+
return [...preservedDefaultClasses, mergedCustomClassName].join(' ');
|
|
11
|
+
}
|
|
2
12
|
export function formatPromotionPeriod(start, until) {
|
|
3
13
|
if (!start)
|
|
4
14
|
return null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BypassDomainConfig } from '../../client/hooks/useBypassKycChecker';
|
|
3
|
+
interface ClassNameEntries {
|
|
4
|
+
root?: string;
|
|
5
|
+
thumbnailRoot?: string;
|
|
6
|
+
thumbnailTitle?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface RecentGamesProps {
|
|
9
|
+
className?: string | ClassNameEntries;
|
|
10
|
+
/** @default 'Recent Games' */
|
|
11
|
+
heading?: string | ReactNode;
|
|
12
|
+
bypassDomains?: BypassDomainConfig[];
|
|
13
|
+
}
|
|
14
|
+
export declare function RecentGames__client(props: RecentGamesProps): import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
+
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { useBypassKycChecker, } from '../../client/hooks/useBypassKycChecker.js';
|
|
9
|
+
import { useRecentGamesQuery } from '../../client/hooks/useRecentGamesQuery.js';
|
|
10
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
11
|
+
import { ArrowRightIcon } from '../../icons/ArrowRightIcon.js';
|
|
12
|
+
import { Button } from '../../ui/Button/index.js';
|
|
13
|
+
import { getGameImageUrl } from '../../utils/getGameImageUrl.js';
|
|
14
|
+
import { GameLaunchTrigger } from '../GameLaunch/index.js';
|
|
15
|
+
export function RecentGames__client(props) {
|
|
16
|
+
const isBypass = useBypassKycChecker(props.bypassDomains);
|
|
17
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
18
|
+
align: 'start',
|
|
19
|
+
slidesToScroll: 3,
|
|
20
|
+
breakpoints: {
|
|
21
|
+
'(min-width: 1024px)': {
|
|
22
|
+
slidesToScroll: 6,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
|
|
27
|
+
const [nextBtnDisabled, setNextBtnDisabled] = useState(true);
|
|
28
|
+
const onPrevButtonClick = useCallback(() => emblaApi?.scrollPrev(), [emblaApi]);
|
|
29
|
+
const onNextButtonClick = useCallback(async () => {
|
|
30
|
+
emblaApi?.scrollNext();
|
|
31
|
+
}, [emblaApi]);
|
|
32
|
+
const onSelect = useCallback((emblaApi) => {
|
|
33
|
+
setPrevBtnDisabled(!emblaApi?.canScrollPrev());
|
|
34
|
+
setNextBtnDisabled(!emblaApi?.canScrollNext());
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!emblaApi)
|
|
38
|
+
return;
|
|
39
|
+
onSelect(emblaApi);
|
|
40
|
+
emblaApi.on('reInit', onSelect).on('select', onSelect);
|
|
41
|
+
}, [emblaApi, onSelect]);
|
|
42
|
+
const gamesQuery = useRecentGamesQuery();
|
|
43
|
+
const games = gamesQuery.data ?? [];
|
|
44
|
+
if (games.length <= 0)
|
|
45
|
+
return null;
|
|
46
|
+
const classNames = isString(props.className)
|
|
47
|
+
? { root: props.className }
|
|
48
|
+
: (props.className ?? {});
|
|
49
|
+
return (_jsxs("div", { className: classNames.root, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Recent Games' }), _jsx("div", { className: "grow" }), _jsx("div", { className: "flex items-center justify-center gap-xl", children: _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" }) })] }) })] }), _jsx("div", { ref: emblaRef, className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: twMerge('grid auto-cols-[calc((100%-(0.375rem*2))/3)] grid-flow-col grid-rows-1 gap-sm lg:auto-cols-[calc((100%-(0.5rem*5))/6)] lg:gap-md'), children: games.map((game) => (_jsx(Item, { bypassKycCheck: isBypass, game: game, className: {
|
|
50
|
+
thumbnailRoot: classNames.thumbnailRoot,
|
|
51
|
+
thumbnailTitle: classNames.thumbnailTitle,
|
|
52
|
+
} }, game.id))) }) })] }));
|
|
53
|
+
}
|
|
54
|
+
function Item({ game, bypassKycCheck, className, }) {
|
|
55
|
+
return (_jsxs(GameLaunchTrigger, { bypassKycCheck: bypassKycCheck, game: game, className: twMerge('hover:-translate-y-1 relative block w-full animate-scale-in shadow-sm transition-transform duration-200', className?.thumbnailRoot), children: [_jsx(Image, { src: getGameImageUrl({
|
|
56
|
+
reference: game.reference,
|
|
57
|
+
provider: game.provider,
|
|
58
|
+
image: game.image,
|
|
59
|
+
}), alt: "", width: 200, height: 200, loading: "lazy", unoptimized: true, className: "aspect-square w-full rounded-t-md object-cover" }), _jsx("span", { className: twMerge('block w-full truncate rounded-b-md bg-bg-tertiary px-2 py-3.5 text-center font-semibold text-text-primary-brand text-xs', className?.thumbnailTitle), children: game.name })] }));
|
|
60
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { prefetchRecentGamesQuery } from '../../server/utils/prefetchRecentGamesQuery.js';
|
|
3
|
+
import { RecentGames__client, } from './RecentGames.client.js';
|
|
4
|
+
export async function RecentGames(props) {
|
|
5
|
+
await prefetchRecentGamesQuery();
|
|
6
|
+
return _jsx(RecentGames__client, { ...props });
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RecentGames';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RecentGames.js';
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -18,14 +18,14 @@ export declare const GET: (req: NextRequest, { params }: Context) => Promise<Nex
|
|
|
18
18
|
__error?: unknown;
|
|
19
19
|
} | {
|
|
20
20
|
ok: true;
|
|
21
|
-
data:
|
|
21
|
+
data: Record<string, unknown>;
|
|
22
22
|
}> | NextResponse<{
|
|
23
23
|
ok: false;
|
|
24
24
|
message: string;
|
|
25
25
|
__error?: unknown;
|
|
26
26
|
} | {
|
|
27
27
|
ok: true;
|
|
28
|
-
data:
|
|
28
|
+
data: import("../types").Session;
|
|
29
29
|
}>>;
|
|
30
30
|
export declare const DELETE: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
|
|
31
31
|
ok: true;
|
|
@@ -8,23 +8,23 @@ export declare const createForgotPasswordSchema: (mobileNumberParser: MobileNumb
|
|
|
8
8
|
mobileNumber: z.ZodEffects<z.ZodString, string, string>;
|
|
9
9
|
verificationCode: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
verificationCode: string;
|
|
12
11
|
password: string;
|
|
12
|
+
verificationCode: string;
|
|
13
13
|
mobileNumber: string;
|
|
14
14
|
confirmPassword: string;
|
|
15
15
|
}, {
|
|
16
|
-
verificationCode: string;
|
|
17
16
|
password: string;
|
|
17
|
+
verificationCode: string;
|
|
18
18
|
mobileNumber: string;
|
|
19
19
|
confirmPassword: string;
|
|
20
20
|
}>, {
|
|
21
|
-
verificationCode: string;
|
|
22
21
|
password: string;
|
|
22
|
+
verificationCode: string;
|
|
23
23
|
mobileNumber: string;
|
|
24
24
|
confirmPassword: string;
|
|
25
25
|
}, {
|
|
26
|
-
verificationCode: string;
|
|
27
26
|
password: string;
|
|
27
|
+
verificationCode: string;
|
|
28
28
|
mobileNumber: string;
|
|
29
29
|
confirmPassword: string;
|
|
30
30
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const prefetchRecentGamesQuery: () => Promise<void>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cache } from 'react';
|
|
2
|
+
import { getGames__next } from '../../services/cmsPortal.js';
|
|
3
|
+
import { getRecentGames } from '../../services/portal.js';
|
|
4
|
+
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
5
|
+
import { log } from '../../utils/log.js';
|
|
6
|
+
import { getRecentGamesQueryKey } from '../../utils/queryKeys.js';
|
|
7
|
+
import { getSession } from '../services/getSession.js';
|
|
8
|
+
export const prefetchRecentGamesQuery = cache(async () => {
|
|
9
|
+
const session = await getSession();
|
|
10
|
+
if (session.status === 'unauthenticated')
|
|
11
|
+
return;
|
|
12
|
+
await getQueryClient()
|
|
13
|
+
.prefetchQuery({
|
|
14
|
+
queryKey: getRecentGamesQueryKey(),
|
|
15
|
+
queryFn: async ({ signal }) => {
|
|
16
|
+
const recentGames = await getRecentGames({
|
|
17
|
+
signal,
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${session.token}`,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const ids = recentGames?.length
|
|
23
|
+
? [...new Set(recentGames.map((g) => g.id))]
|
|
24
|
+
: [];
|
|
25
|
+
if (ids.length <= 0)
|
|
26
|
+
return [];
|
|
27
|
+
const res = await getGames__next({
|
|
28
|
+
filter: {
|
|
29
|
+
reference: {
|
|
30
|
+
in: ids,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}, { signal });
|
|
34
|
+
return ids
|
|
35
|
+
.map((id) => res.edges.find((e) => id === e.node.reference)?.node ?? null)
|
|
36
|
+
.filter((g) => g !== null);
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
.catch(() => log.text("'prefetchRecentGamesQuery' failed", 'error'));
|
|
40
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Simplify } from 'type-fest';
|
|
2
|
-
import type { GameType, OnboardingPlayerExperience, OnboardingStatus, Platform, RecommendedGame, TopWin } from '../types';
|
|
2
|
+
import type { GameType, OnboardingPlayerExperience, OnboardingStatus, Platform, RecentGame, RecommendedGame, TopWin } from '../types';
|
|
3
3
|
import { type GraphQLRequestOptions } from './graphqlRequest';
|
|
4
4
|
export interface PlatformQuery extends Platform {
|
|
5
5
|
}
|
|
@@ -8,6 +8,10 @@ export interface RecommendedGamesQuery {
|
|
|
8
8
|
recommendedGames: RecommendedGame[];
|
|
9
9
|
}
|
|
10
10
|
export declare const getRecommendedGames: (options?: GraphQLRequestOptions) => Promise<RecommendedGame[]>;
|
|
11
|
+
export interface RecentGamesQuery {
|
|
12
|
+
recentGames: RecentGame[];
|
|
13
|
+
}
|
|
14
|
+
export declare const getRecentGames: (options?: GraphQLRequestOptions) => Promise<RecentGame[]>;
|
|
11
15
|
export interface OnboardingStatusQuery {
|
|
12
16
|
onboardingStatus?: OnboardingStatus | null;
|
|
13
17
|
}
|
package/dist/services/portal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cache } from 'react';
|
|
2
2
|
import { PORTAL_GRAPHQL_ENDPOINT } from '../constants/index.js';
|
|
3
3
|
import { graphqlRequest } from './graphqlRequest.js';
|
|
4
|
-
import { COMPLETE_ONBOARDING, ONBOARDING_STATUS, PLATFORM, RECOMMENDED_GAMES, SKIP_ONBOARDING, TOP_WINS, } from './queries.js';
|
|
4
|
+
import { COMPLETE_ONBOARDING, ONBOARDING_STATUS, PLATFORM, RECENT_GAMES, RECOMMENDED_GAMES, SKIP_ONBOARDING, TOP_WINS, } from './queries.js';
|
|
5
5
|
export const getPlatform = cache(async (options) => {
|
|
6
6
|
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, PLATFORM, undefined, {
|
|
7
7
|
cache: 'force-cache',
|
|
@@ -18,6 +18,10 @@ export const getRecommendedGames = cache(async (options) => {
|
|
|
18
18
|
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, RECOMMENDED_GAMES, undefined, options);
|
|
19
19
|
return res.recommendedGames;
|
|
20
20
|
});
|
|
21
|
+
export const getRecentGames = cache(async (options) => {
|
|
22
|
+
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, RECENT_GAMES, undefined, options);
|
|
23
|
+
return res.recentGames;
|
|
24
|
+
});
|
|
21
25
|
export const getOnboardingStatus = cache(async (options) => {
|
|
22
26
|
const res = await graphqlRequest(PORTAL_GRAPHQL_ENDPOINT, ONBOARDING_STATUS, undefined, options);
|
|
23
27
|
return res.onboardingStatus ?? null;
|
|
@@ -14,6 +14,7 @@ export declare const CREATE_GAME_SESSION = "\n mutation CreateGameSession($inpu
|
|
|
14
14
|
export declare const END_GAME_SESSION = "\n mutation EndGameSession($input: EndGameSessionInput!) {\n endGameSession(input: $input)\n }\n";
|
|
15
15
|
export declare const END_GAME_SESSION__LEGACY = "\n mutation EndGameSession($input: EndGameSessionInput!) {\n endGameSession(input: $input) {\n ... on GameSessionDoesNotExistError {\n name: __typename\n message\n }\n ... on GameSessionAlreadyClosedError {\n name: __typename\n message\n }\n ... on GameProviderError {\n name: __typename\n message\n }\n }\n }\n";
|
|
16
16
|
export declare const RECOMMENDED_GAMES = "\n query RecommendedGames {\n recommendedGames {\n id\n name\n type\n provider\n }\n }\n";
|
|
17
|
+
export declare const RECENT_GAMES = "\n query RecentGames {\n recentGames {\n id\n }\n }\n";
|
|
17
18
|
export declare const ANNOUNCEMENTS = "\n query Announcements(\n $first: Int\n $after: Cursor\n $filter: AnnouncementFilterInput\n ) {\n announcements(first: $first, after: $after, filter: $filter) {\n edges {\n cursor\n node {\n ... on Announcement {\n id\n type\n title\n status\n message\n activationStartDateTime\n activationEndDateTime\n dateTimeCreated\n dateTimeLastUpdated\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n";
|
|
18
19
|
export declare const WITHDRAWAL_RECORDS = "\n query WithdrawalRecords(\n $first: Int\n $after: Cursor\n $filter: WithdrawalRecordFilterInput\n ) {\n member {\n withdrawalRecords(first: $first, after: $after, filter: $filter) {\n edges {\n cursor\n node {\n ... on BankWithdrawalRecord {\n id\n type\n bank\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on GCashWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n recipientMobileNumber\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on ManualWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on MayaAppWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on InstapayWithdrawalRecord {\n id\n type\n fee\n netAmount\n bankName\n reference\n accountName\n accountNumber\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on ManualUPIWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on ManualBankWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on VentajaDisbursementWithdrawalRecord {\n bankName\n id\n type\n fee\n accountName\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on PisoPayRemittanceWithdrawalRecord {\n bankName\n id\n type\n fee\n accountName\n accountNumber\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n dateTimeCreated\n dateTimeLastUpdated\n }\n ... on GCashStandardCashInWithdrawalRecord {\n id\n type\n fee\n netAmount\n reference\n amount\n status\n error\n withdrawalNumber\n serialCode\n recipientMobileNumber\n dateTimeCreated\n dateTimeLastUpdated\n }\n }\n }\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\n }\n";
|
|
19
20
|
export declare const CREATE_GCASH_WITHDRAWAL = "\n mutation CreateGCashWithdrawal($input: CreateGCashWithdrawalInput!) {\n createGCashWithdrawal(input: $input) {\n ... on AccountNotVerifiedError {\n name: __typename\n message\n }\n ... on InvalidTransactionPasswordError {\n name: __typename\n message\n }\n ... on InvalidWithdrawalAmountError {\n name: __typename\n message\n }\n ... on MobileNumberNotVerifiedError {\n name: __typename\n message\n }\n ... on NotEnoughBalanceError {\n name: __typename\n message\n }\n ... on WithdrawalDailyLimitExceededError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n ... on WalletDoesNotExistError {\n name: __typename\n message\n }\n ... on TransactionPasswordNotSetError {\n name: __typename\n message\n }\n ... on TurnoverRequirementNotYetFulfilledError {\n name: __typename\n message\n }\n ... on FirstDepositRequiredError {\n name: __typename\n message\n }\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -229,6 +229,13 @@ export const RECOMMENDED_GAMES = /* GraphQL */ `
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
`;
|
|
232
|
+
export const RECENT_GAMES = /* GraphQL */ `
|
|
233
|
+
query RecentGames {
|
|
234
|
+
recentGames {
|
|
235
|
+
id
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
`;
|
|
232
239
|
export const ANNOUNCEMENTS = /* GraphQL */ `
|
|
233
240
|
query Announcements(
|
|
234
241
|
$first: Int
|
package/dist/types/index.d.ts
CHANGED
|
@@ -908,6 +908,9 @@ export interface FavoriteGame {
|
|
|
908
908
|
type: GameType;
|
|
909
909
|
provider: GameProvider;
|
|
910
910
|
}
|
|
911
|
+
export interface RecentGame {
|
|
912
|
+
id: string;
|
|
913
|
+
}
|
|
911
914
|
export type TournamentStatus = 'ACTIVE' | 'INACTIVE' | 'DELETED';
|
|
912
915
|
export type TournamentType = 'MULTIPLIER';
|
|
913
916
|
export type TournamentFrequency = 'DAILY' | 'WEEKLY' | 'MONTHLY';
|