@opexa/portal-components 0.0.952 → 0.0.953

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.
@@ -75,7 +75,6 @@ export function Deposit() {
75
75
  }
76
76
  const isMobile = onMobileDevice();
77
77
  const enabledKey = isMobile ? 'mobileWebEnabled' : 'webEnabled';
78
- const isOfWinSiteDepositEnabled = isOfWinSite && featureFlag.enabled;
79
78
  const paymentMethods = [
80
79
  {
81
80
  method: 'GCASH',
@@ -8,10 +8,18 @@ export interface ClassNameEntries {
8
8
  thumbnailContainer?: string;
9
9
  thumbnailRootContainer?: string;
10
10
  }
11
+ export interface ActiveProvider {
12
+ activeProvider?: GameProvider | string;
13
+ jump?: boolean;
14
+ }
11
15
  export interface GameProvidersCarouselProps {
12
16
  layout: 'carousel';
13
17
  gameProviders: GameProvider[];
14
18
  heading?: string | ReactNode;
19
+ /**
20
+ * Scrolls the carousel to the matching provider id or slug on load.
21
+ */
22
+ scrollProvider?: ActiveProvider;
15
23
  /**
16
24
  * @default '/providers'
17
25
  */
@@ -56,9 +56,41 @@ export function GameProvidersCarousel({ hasSeeAll = true, ...props }) {
56
56
  ? [...props.gameProviders, ...(props.futureGameProviders ?? [])]
57
57
  : props.gameProviders, [enabled, props.gameProviders, props.futureGameProviders]);
58
58
  const gameProviders = useMemo(() => combinedProviders.map((provider) => GAME_PROVIDER_DATA[provider]), [combinedProviders]);
59
+ const resolvedActiveProvider = props.scrollProvider?.activeProvider;
60
+ const shouldJump = props.scrollProvider?.jump ?? false;
61
+ const activeProviderIndex = useMemo(() => {
62
+ if (!resolvedActiveProvider)
63
+ return -1;
64
+ return gameProviders.findIndex((provider) => provider.id === resolvedActiveProvider ||
65
+ provider.slug === resolvedActiveProvider);
66
+ }, [gameProviders, resolvedActiveProvider]);
59
67
  const classNames = useMemo(() => isString(props.className)
60
68
  ? { root: props.className }
61
69
  : (props.className ?? {}), [props.className]);
70
+ const getSlidesToScroll = useCallback(() => {
71
+ const desktopSlidesToScroll = props.carouselOptions?.breakpoints[1024]?.slidesToScroll ?? 6;
72
+ if (typeof window === 'undefined')
73
+ return 3;
74
+ return window.matchMedia('(min-width: 1024px)').matches
75
+ ? desktopSlidesToScroll
76
+ : 3;
77
+ }, [props.carouselOptions?.breakpoints]);
78
+ const scrollToActiveProvider = useCallback(() => {
79
+ if (!emblaApi || activeProviderIndex < 0)
80
+ return;
81
+ const slidesToScroll = Math.max(1, getSlidesToScroll());
82
+ const snapIndex = Math.floor(activeProviderIndex / slidesToScroll);
83
+ emblaApi.scrollTo(snapIndex, shouldJump);
84
+ }, [emblaApi, activeProviderIndex, getSlidesToScroll, shouldJump]);
85
+ useEffect(() => {
86
+ if (!emblaApi || activeProviderIndex < 0)
87
+ return;
88
+ scrollToActiveProvider();
89
+ emblaApi.on('reInit', scrollToActiveProvider);
90
+ return () => {
91
+ emblaApi.off('reInit', scrollToActiveProvider);
92
+ };
93
+ }, [emblaApi, activeProviderIndex, scrollToActiveProvider]);
62
94
  return (_jsxs("div", { className: classNames.root, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: props.heading ?? 'Providers' }), _jsx("div", { className: "grow" }), _jsxs("div", { className: "flex items-center justify-center gap-xl", children: [hasSeeAll && (_jsxs(Link, { href: viewAllUrl, 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" }) })] })] })] }), _jsx("div", { ref: emblaRef, className: twMerge('relative mt-lg overflow-hidden', classNames.thumbnailRootContainer), 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', classNames.thumbnailContainer), children: gameProviders.map((provider) => {
63
95
  const url = props.providerUrlMappings
64
96
  ? (props.providerUrlMappings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.952",
3
+ "version": "0.0.953",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",