@opexa/portal-components 0.0.719 → 0.0.720

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.
@@ -1,6 +1,6 @@
1
1
  import { type ImageProps } from 'next/image';
2
2
  import type { CSSProperties, ReactNode } from 'react';
3
- import type { GameProvider, GameProviderData } from '../../../types';
3
+ import type { GameProvider } from '../../../types';
4
4
  export interface ClassNameEntries {
5
5
  root?: string;
6
6
  itemRoot?: string;
@@ -35,19 +35,10 @@ export interface JackpotsListProps {
35
35
  heading?: string | ReactNode;
36
36
  className?: string | ClassNameEntries;
37
37
  style?: CSSProperties | StyleEntries;
38
- gameProviders: GameProvider[];
39
- gameProviderImages?: Partial<Record<GameProvider, ImageProps['src']>>;
40
- /**
41
- * @default '/providers/<slug>'
42
- * @example
43
- * ```ts
44
- * '/bingo/:slug' // '/bingo/jili'
45
- * '/bingo/:id' // '/bingo/JILI'
46
- * // or using a function
47
- * ({slug}) => `/bingo/${slug}`
48
- * ```
49
- */
50
- viewGamesUrl?: string | ((gameProvider: GameProviderData) => string);
38
+ gameProviders?: Partial<Record<GameProvider, {
39
+ redirectUrl: string;
40
+ image?: ImageProps['src'];
41
+ }>>;
51
42
  animate?: boolean;
52
43
  customJackpotChestImage?: {
53
44
  image: {
@@ -1,5 +1,11 @@
1
+ import { type ImageProps } from 'next/image';
1
2
  import type { GameProviderData } from '../../../types';
3
+ interface JackpotGameProvider extends GameProviderData {
4
+ redirectUrl: string;
5
+ providedLogo?: ImageProps['src'];
6
+ }
2
7
  export interface JackpotsListItemGameProvidersProps {
3
- gameProviders: GameProviderData[];
8
+ gameProviders: JackpotGameProvider[];
4
9
  }
5
10
  export declare function JackpotsListItemGameProviders({ gameProviders, }: JackpotsListItemGameProvidersProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -1,24 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import useEmblaCarousel from 'embla-carousel-react';
3
3
  import { isString } from 'lodash-es';
4
- import Image from 'next/image';
4
+ import Image, {} from 'next/image';
5
5
  import Link from 'next/link';
6
6
  import { useCallback, useEffect, useState } from 'react';
7
7
  import { twMerge } from 'tailwind-merge';
8
8
  import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
9
9
  import { ArrowRightIcon } from '../../../icons/ArrowRightIcon.js';
10
10
  import { Button } from '../../../ui/Button/index.js';
11
- import { callIfFn } from '../../../utils/callIfFn.js';
12
11
  import { useJackpotsListPropsContext } from './JackpotsListContext.js';
13
12
  export function JackpotsListItemGameProviders({ gameProviders, }) {
14
13
  const jackpotsProps = useJackpotsListPropsContext();
15
- const viewGamesUrl = (data) => {
16
- return jackpotsProps.viewGamesUrl
17
- ? callIfFn(jackpotsProps.viewGamesUrl, data)
18
- .replace(':id', data.id)
19
- .replace(':slug', data.slug)
20
- : `/providers/${data.slug}`;
21
- };
22
14
  const classNames = isString(jackpotsProps.className)
23
15
  ? { root: jackpotsProps.className }
24
16
  : (jackpotsProps.className ?? {});
@@ -49,6 +41,5 @@ export function JackpotsListItemGameProviders({ gameProviders, }) {
49
41
  emblaApi.on('select', onSelect);
50
42
  emblaApi.on('reInit', onSelect);
51
43
  }, [emblaApi, onSelect]);
52
- return (_jsxs("div", { className: twMerge('p-4 pb-8', classNames.providerRoot), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: twMerge('font-semibold text-lg text-text-primary-900', classNames.providerHeading), children: "Jackpot Game Providers" }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: twMerge('rounded-r-none border-r-0', classNames.providerNavigationButton), "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: twMerge('rounded-l-none', classNames.providerNavigationButton), "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] }), _jsx("div", { className: "relative mt-3 overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-3.5", children: gameProviders.map((provider) => (_jsx(Link, { href: viewGamesUrl(provider), className: twMerge('min-w-27.5 rounded-md bg-brand-800 lg:bg-bg-primary-900', classNames.providerThumbnailRoot), children: _jsx(Image, { src: jackpotsProps.gameProviderImages?.[provider.id] ??
53
- provider.logo, alt: "provider", className: twMerge('size-full', classNames.providerThumbnailImage), width: 300, height: 150 }) }, provider.slug))) }) })] }));
44
+ return (_jsxs("div", { className: twMerge('p-4 pb-8', classNames.providerRoot), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: twMerge('font-semibold text-lg text-text-primary-900', classNames.providerHeading), children: "Jackpot Game Providers" }), _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { disabled: !canScrollPrev, onClick: scrollPrev, variant: "outline", colorScheme: "gray", className: twMerge('rounded-r-none border-r-0', classNames.providerNavigationButton), "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsxs(Button, { disabled: !canScrollNext, onClick: scrollNext, variant: "outline", colorScheme: "gray", className: twMerge('rounded-l-none', classNames.providerNavigationButton), "aria-label": "Next", children: [_jsx("span", { className: "sr-only", children: "Next" }), _jsx(ArrowRightIcon, { className: "size-5" })] })] })] }), _jsx("div", { className: "relative mt-3 overflow-hidden", ref: emblaRef, children: _jsx("div", { className: "flex gap-3.5", children: gameProviders.map((provider) => (_jsx(Link, { href: provider.redirectUrl, className: twMerge('min-w-27.5 rounded-md bg-brand-800 lg:bg-bg-primary-900', classNames.providerThumbnailRoot), children: _jsx(Image, { src: provider.providedLogo ?? provider.logo, alt: "provider", className: twMerge('size-full', classNames.providerThumbnailImage), width: 300, height: 150 }) }, provider.slug))) }) })] }));
54
45
  }
@@ -1,8 +1,16 @@
1
+ import type { GameProvider } from '../../../types';
1
2
  export declare function useJackpotsListItemData(): {
2
3
  rootRef: (node?: Element | null) => void;
3
4
  jackpotPayouts: import("../../../types").JackpotPayout[];
4
5
  topJackpotPayout: import("../../../types").JackpotPayout;
5
- filteredGameProviders: import("../../../types").GameProviderData[];
6
+ filteredGameProviders: {
7
+ redirectUrl: string;
8
+ providedLogo: string | import("next/dist/shared/lib/get-img-props").StaticImport | undefined;
9
+ id: GameProvider;
10
+ slug: string;
11
+ logo: import("next/image").ImageProps["src"];
12
+ name: string;
13
+ }[];
6
14
  localeInfo: import("../../../utils/getLocaleInfo").LocaleInfo;
7
15
  isPayingOut: boolean;
8
16
  jackpotAmount: string;
@@ -12,7 +12,15 @@ import { useJackpotsListItemContext, useJackpotsListPropsContext, } from './Jack
12
12
  export function useJackpotsListItemData() {
13
13
  const jackpotsListProps = useJackpotsListPropsContext();
14
14
  const jackpot = useJackpotsListItemContext();
15
- const gameProviders = jackpotsListProps.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
15
+ const gameProviders = Object.entries(jackpotsListProps.gameProviders ?? {}).map(([key, cfg]) => {
16
+ const id = key;
17
+ const base = GAME_PROVIDER_DATA[id];
18
+ return {
19
+ ...base,
20
+ redirectUrl: cfg.redirectUrl,
21
+ providedLogo: cfg.image,
22
+ };
23
+ });
16
24
  const [rootRef, inView] = useIntersectionObserver({
17
25
  threshold: 0.25,
18
26
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.719",
3
+ "version": "0.0.720",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",