@opexa/portal-components 0.0.68 → 0.0.70

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 (39) hide show
  1. package/dist/client/hooks/useBonusQuery.js +5 -2
  2. package/dist/client/hooks/useCashbackQuery.js +5 -2
  3. package/dist/client/hooks/usePromoQuery.js +5 -2
  4. package/dist/components/Account/Account.d.ts +2 -0
  5. package/dist/components/Account/Account.js +17 -16
  6. package/dist/components/Bonus/Bonus.client.d.ts +1 -1
  7. package/dist/components/Bonus/Bonus.client.js +27 -1
  8. package/dist/components/Bonus/Bonus.js +7 -0
  9. package/dist/components/Bonuses/Bonuses.client.js +5 -6
  10. package/dist/components/Bonuses/Bonuses.d.ts +1 -6
  11. package/dist/components/Bonuses/BonusesTrigger.js +6 -2
  12. package/dist/components/Cashback/Cashback.client.js +11 -7
  13. package/dist/components/Cashback/Cashback.js +4 -7
  14. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  15. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  16. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  17. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  18. package/dist/components/Promo/Promo.client.js +7 -3
  19. package/dist/components/Promo/Promo.js +2 -5
  20. package/dist/components/index.d.ts +0 -1
  21. package/dist/components/index.js +0 -1
  22. package/dist/server/utils/prefetchBonusQuery.js +5 -2
  23. package/dist/server/utils/prefetchCashbackQuery.js +5 -2
  24. package/dist/server/utils/prefetchPromoQuery.js +5 -2
  25. package/package.json +1 -1
  26. package/dist/components/CashbackBonus/CashbackBonus.client.d.ts +0 -2
  27. package/dist/components/CashbackBonus/CashbackBonus.client.js +0 -9
  28. package/dist/components/CashbackBonus/CashbackBonus.d.ts +0 -10
  29. package/dist/components/CashbackBonus/CashbackBonus.js +0 -5
  30. package/dist/components/CashbackBonus/index.d.ts +0 -1
  31. package/dist/components/CashbackBonus/index.js +0 -1
  32. package/dist/components/Promo/PromoContent.d.ts +0 -2
  33. package/dist/components/Promo/PromoContent.js +0 -9
  34. package/dist/components/Promos/PromoCarousel.d.ts +0 -2
  35. package/dist/components/Promos/PromoCarousel.js +0 -41
  36. package/dist/components/Promos/PromoGrid.d.ts +0 -2
  37. package/dist/components/Promos/PromoGrid.js +0 -12
  38. package/dist/components/Promos/PromoItem.d.ts +0 -7
  39. package/dist/components/Promos/PromoItem.js +0 -10
@@ -1,4 +1,4 @@
1
- import { getBonus } from '@opexa/portal-sdk-core';
1
+ import { getBonuses } from '@opexa/portal-sdk-core';
2
2
  import { useQuery } from '@tanstack/react-query';
3
3
  import invariant from 'tiny-invariant';
4
4
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
@@ -20,7 +20,8 @@ export const useBonusQuery = (id, config) => {
20
20
  queryFn: () => getSession(),
21
21
  });
22
22
  invariant(session.status === 'authenticated');
23
- return await getBonus(id, {
23
+ /* FIXME: use getBonus query once api is fixed */
24
+ const bonuses = await getBonuses({
24
25
  signal,
25
26
  environment: ENVIRONMENT,
26
27
  headers: {
@@ -28,6 +29,8 @@ export const useBonusQuery = (id, config) => {
28
29
  Authorization: `Bearer ${session.token}`,
29
30
  },
30
31
  });
32
+ const bonus = bonuses.find((b) => b.id === id) ?? null;
33
+ return bonus;
31
34
  },
32
35
  });
33
36
  return query;
@@ -1,4 +1,4 @@
1
- import { getCashback } from '@opexa/portal-sdk-core';
1
+ import { getCashbacks } from '@opexa/portal-sdk-core';
2
2
  import { useQuery } from '@tanstack/react-query';
3
3
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
4
4
  import { getCashbackQueryKey } from '../../utils/index.js';
@@ -8,13 +8,16 @@ export const useCashbackQuery = (id, config) => {
8
8
  enabled: !id ? false : config?.enabled,
9
9
  queryKey: getCashbackQueryKey(id),
10
10
  queryFn: async ({ signal }) => {
11
- return await getCashback(id, {
11
+ /* FIXME: use getCashback query once api if fixed */
12
+ const cashbacks = await getCashbacks({
12
13
  signal,
13
14
  environment: ENVIRONMENT,
14
15
  headers: {
15
16
  'Platform-Code': PLATFORM_CODE,
16
17
  },
17
18
  });
19
+ const cashback = cashbacks.find((c) => c.id === id) ?? null;
20
+ return cashback;
18
21
  },
19
22
  });
20
23
  };
@@ -1,4 +1,4 @@
1
- import { getPromo } from '@opexa/portal-sdk-core';
1
+ import { getPromos } from '@opexa/portal-sdk-core';
2
2
  import { useQuery } from '@tanstack/react-query';
3
3
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
4
4
  import { getPromoQueryKey } from '../../utils/index.js';
@@ -8,13 +8,16 @@ export const usePromoQuery = (id, config) => {
8
8
  enabled: !id ? false : config?.enabled,
9
9
  queryKey: getPromoQueryKey(id),
10
10
  queryFn: async ({ signal }) => {
11
- return await getPromo(id, {
11
+ /* FIXME: use getPromo query once api is fixed */
12
+ const promos = await getPromos({
12
13
  signal,
13
14
  environment: ENVIRONMENT,
14
15
  headers: {
15
16
  'Platform-Code': PLATFORM_CODE,
16
17
  },
17
18
  });
19
+ const promo = promos.find((p) => p.id === id) ?? null;
20
+ return promo;
18
21
  },
19
22
  });
20
23
  };
@@ -11,6 +11,8 @@ export interface AccountProps {
11
11
  * ```
12
12
  */
13
13
  offsetTop?: string;
14
+ /** @default true */
15
+ shouldShowSettings?: boolean;
14
16
  /** @default '/rewards' */
15
17
  rewardsUrl?: string;
16
18
  /** @default '/bet-records' */
@@ -6,7 +6,7 @@ import Link from 'next/link';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { useShallow } from 'zustand/shallow';
8
8
  import { useAccountQuery, useGlobalStore, useLocaleInfo, useSignOutMutation, useUnreadMessagesCountQuery, useWalletQuery, } from '../../client/hooks/index.js';
9
- import { AlertCircleIcon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, XIcon, } from '../../icons/index.js';
9
+ import { AlertCircleIcon, Bell01Icon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, XIcon, } from '../../icons/index.js';
10
10
  import avatarPlaceholder from '../../images/placeholder-avatar.png';
11
11
  import { Badge, Button, Drawer, IconButton, Popover } from '../../ui/index.js';
12
12
  import { formatNumber, parseDecimal } from '../../utils/index.js';
@@ -21,6 +21,7 @@ export function Account(props) {
21
21
  const betRecordsUrl = props.betRecordsUrl ?? '/bet-records';
22
22
  const transactionsUrl = props.transactionsUrl ?? '/transactions';
23
23
  const accountSettingsUrl = props.accountSettingsUrl ?? '/account';
24
+ const shouldShowSettings = props.shouldShowSettings ?? true;
24
25
  const [mobileOffsetTop, desktopOffsetTop] = Array.isArray(props.offsetTop)
25
26
  ? props.offsetTop
26
27
  : [props.offsetTop ?? '0px', props.offsetTop ?? '0px'];
@@ -29,12 +30,12 @@ export function Account(props) {
29
30
  }, lazyMount: true, unmountOnExit: true, children: [_jsx(Drawer.Trigger, { asChild: true, className: "lg:hidden", children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: globalStore.account__mobile.open ? (_jsx(XIcon, {})) : (_jsx(Image, { src: avatarPlaceholder, alt: "", width: 100, height: 100, className: "size-10" })) })) }), _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsxs(Drawer.Content, { className: twMerge('relative', 'flex', 'flex-col', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'w-full', 'px-xl', 'py-6', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]'), style: {
30
31
  ['--offset-top-mobile']: mobileOffsetTop,
31
32
  ['--offset-top-desktop']: desktopOffsetTop,
32
- }, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
33
+ }, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
33
34
  globalStore.account.setOpen(details.open);
34
35
  }, lazyMount: true, unmountOnExit: true, positioning: {
35
36
  placement: 'bottom',
36
37
  strategy: 'fixed',
37
- }, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl })] }) }) })] })] }));
38
+ }, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl, shouldShowSettings: shouldShowSettings })] }) }) })] })] }));
38
39
  }
39
40
  function Profile() {
40
41
  const accountQuery = useAccountQuery();
@@ -54,16 +55,16 @@ function Wallet() {
54
55
  const depositBalance = parseDecimal(walletQuery.data?.balance, 0);
55
56
  const bonusBalance = parseDecimal(walletQuery.data?.bonus, 0);
56
57
  const totalBalance = depositBalance + bonusBalance;
57
- return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary mt-3 rounded-xl border p-xl", children: [_jsx("div", { className: "text-text-secondary-700 text-sm", children: "Total Balance" }), _jsx("div", { className: "text-3xl font-bold", children: formatNumber(totalBalance, {
58
- currency: localeInfo?.currency.code,
59
- minDecimalPlaces: 2,
60
- }) }), _jsxs("div", { className: "mt-1.5 flex gap-7xl", children: [_jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Deposit Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(depositBalance, {
61
- currency: localeInfo?.currency.code,
62
- minDecimalPlaces: 2,
63
- }) })] }), _jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Bonus Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(bonusBalance, {
64
- currency: localeInfo?.currency.code,
65
- minDecimalPlaces: 2,
66
- }) })] })] }), _jsxs("div", { className: "mt-3 flex gap-lg", children: [_jsx(Button, { size: "xs", variant: "outline", onClick: () => {
58
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-primary bg-bg-tertiary mt-3 rounded-xl border p-xl", children: [_jsx("div", { className: "text-text-secondary-700 text-sm", children: "Total Balance" }), _jsx("div", { className: "text-3xl font-bold", children: formatNumber(totalBalance, {
59
+ currency: localeInfo?.currency.code,
60
+ minDecimalPlaces: 2,
61
+ }) }), _jsxs("div", { className: "mt-1.5 flex gap-7xl", children: [_jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Deposit Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(depositBalance, {
62
+ currency: localeInfo?.currency.code,
63
+ minDecimalPlaces: 2,
64
+ }) })] }), _jsxs("div", { children: [_jsx("p", { className: "text-text-secondary-700 text-2xs", children: "Bonus Balance" }), _jsx("p", { className: "text-medium text-text-primary-brand", children: formatNumber(bonusBalance, {
65
+ currency: localeInfo?.currency.code,
66
+ minDecimalPlaces: 2,
67
+ }) })] })] })] }), ' ', _jsxs("div", { className: "mt-3 flex gap-lg", children: [_jsx(Button, { size: "xs", variant: "outline", onClick: () => {
67
68
  globalStore.depositWithdrawal.setOpen(true);
68
69
  globalStore.depositWithdrawal.setTab('WITHDRAWAL');
69
70
  globalStore.profile.setOpen(false);
@@ -87,13 +88,13 @@ function Links(props) {
87
88
  globalStore.account.setOpen(false);
88
89
  globalStore.account__mobile.setOpen(false);
89
90
  globalStore.messages.setOpen(true);
90
- }, children: [_jsx(Logout01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCountQuery.data ?? 0 }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.rewardsUrl, className: recipe.navItemLink(), onClick: () => {
91
+ }, children: [_jsx(Bell01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCountQuery.data ?? 0 }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.rewardsUrl, className: recipe.navItemLink(), onClick: () => {
91
92
  globalStore.account.setOpen(false);
92
93
  globalStore.account__mobile.setOpen(false);
93
- }, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
94
+ }, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), props.shouldShowSettings && (_jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
94
95
  globalStore.account.setOpen(false);
95
96
  globalStore.account__mobile.setOpen(false);
96
- }, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) }), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
97
+ }, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) })), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
97
98
  globalStore.account.setOpen(false);
98
99
  globalStore.account__mobile.setOpen(false);
99
100
  }, children: [_jsx(CoinsStacked02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.transactionsUrl, className: recipe.navItemLink(), onClick: () => {
@@ -1,2 +1,2 @@
1
1
  import type { BonusProps } from './Bonus';
2
- export declare function Bonus__client(props: BonusProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Bonus__client(props: BonusProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,9 +1,35 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { clamp } from 'lodash-es';
3
4
  import Image from 'next/image';
4
5
  import Link from 'next/link';
6
+ import { useBonusQuery, useLocaleInfo, useRemainingTime, } from '../../client/hooks/index.js';
5
7
  import { ChevronLeftIcon, ChevronRightIcon, StopWatchIcon } from '../../icons/index.js';
8
+ import piggyBank from '../../images/piggy-bank.png';
6
9
  import { Badge, Collapsible, Progress, Prose } from '../../ui/index.js';
10
+ import { capitalize, formatNumber, parseDecimal } from '../../utils/index.js';
7
11
  export function Bonus__client(props) {
8
- return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllUrl ?? '/rewards', className: "text-button-tertiary-fg flex items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to Rewards"] }), _jsx(Image, { src: "https://s3.ap-east-1.amazonaws.com/opexa-assets.opexasystem.com/assets/BSxIXEsa59_zzMAR27-ALLDAYREBATE06-STATIC-WEB-HB-1920x1080.png", alt: "", width: 1024, height: 600, className: "mt-3xl h-auto w-full rounded-xl" }), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: "brand", className: "mt-xl lg:mt-6", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: "9d:10h:11m" })] }), _jsx("h1", { className: "text-text-primary-900 mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: "50 PHP First Deposit Bonus" }), _jsx("p", { className: "text-text-primary-brand mt-xl text-base lg:mt-6 lg:text-lg", children: "Complete the wagering before time runs out to convert your bonus balance into real money!" }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Your bonus" }), _jsxs("p", { children: [_jsx("span", { className: "text-text-primary-900", children: "20.00" }), " / 50.00 PHP"] })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Required Turnover" }), _jsx("p", { children: "5x" })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { children: "Wagering" }), _jsx("p", { children: "400/1000" })] }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) })] }), _jsxs(Collapsible.Root, { className: "mt-xl lg:mt-6", children: [_jsxs(Collapsible.Trigger, { className: "text-button-tertiary-fg flex w-fit items-center justify-center gap-sm text-sm font-semibold lg:mx-auto", children: ["Game Provider Contribution", _jsx(Collapsible.Indicator, { asChild: true, children: _jsx(ChevronRightIcon, { className: "size-5" }) })] }), _jsxs(Collapsible.Content, { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl space-y-1.5 rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Playson" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "25%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Betsoft Gaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "13%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Microgaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "50%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Realtime Gaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "10%" })] })] })] }), _jsxs(Prose, { className: "mt-xl lg:mt-6", children: [_jsx("h3", { children: "How to get bonus" }), _jsxs("ol", { children: [_jsx("li", { children: "All OFWin members are eligible for this program." }), _jsx("li", { children: "50 PHP of game credit will be automatically credited to the new member account upon completion of first deposit Auctor vel in vitae placerat." }), _jsx("li", { children: "Member must reach a 5x turnover requirement before a withdrawal can be made. Attempting to make a withdrawal before this turnover requirement is completed could cause your bonus to be voided." }), _jsx("li", { children: "Players will have 10 days from the date the bonus is awarded to complete the rollover requirement." }), _jsx("li", { children: "Bets used to meet other bonus rollover requirements will not count toward this promotion." })] }), _jsx("h3", { children: "Terms and Conditions" }), _jsxs("ul", { children: [_jsx("li", { children: "Only one account per player is allowed. No same IP address/bank account name allowed. Players who have multiple or fraudulent accounts will not be qualified for the promotion." }), _jsx("li", { children: "Players that are found to have any duplicate accounts or those who participate in fraudulent activities may have their funds forfeited and their accounts closed." }), _jsx("li", { children: "OFWin reserves the right to amend or cancel this Referral Program at any time. OFWin General Terms and Conditions apply." })] })] })] }));
12
+ const bonusQuery = useBonusQuery(props.id);
13
+ const bonus = bonusQuery.data;
14
+ const localeInfo = useLocaleInfo();
15
+ const remainingTime = useRemainingTime(bonus?.expiration ?? new Date());
16
+ if (!bonus)
17
+ return null;
18
+ const turnoverRequirement = parseDecimal(bonus.turnoverRequirement, 0);
19
+ const currentTurnoverRequirementContribution = parseDecimal(bonus.currentTurnoverRequirementContribution, 0);
20
+ return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllUrl ?? '/rewards', className: "text-button-tertiary-fg flex items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to Rewards"] }), _jsx("div", { className: "mt-3xl", children: bonus.promo.banner?.url ? (_jsx(Image, { src: "https://s3.ap-east-1.amazonaws.com/opexa-assets.opexasystem.com/assets/BSxIXEsa59_zzMAR27-ALLDAYREBATE06-STATIC-WEB-HB-1920x1080.png", alt: "", width: 1024, height: 600, className: "h-auto w-full" })) : (_jsx(DefaultImage, {})) }), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: remainingTime.expired ? 'danger' : 'gray', className: "mt-xl lg:mt-6", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: remainingTime.expired ? 'Expired' : remainingTime.toString() })] }), _jsx("h1", { className: "text-text-primary-900 mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: bonus.promo.name }), _jsx("p", { className: "text-text-primary-brand mt-xl text-base lg:mt-6 lg:text-lg", children: "Complete the wagering before time runs out to convert your bonus balance into real money!" }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Your bonus" }), _jsxs("p", { children: [_jsx("span", { className: "text-text-primary-900", children: formatNumber(bonus.balance) }), ' ', "/ ", formatNumber(bonus.amount), " ", localeInfo.currency.code] })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Required Turnover" }), _jsxs("p", { children: [turnoverRequirement, "x"] })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { children: "Wagering" }), _jsxs("p", { children: [currentTurnoverRequirementContribution, "/", turnoverRequirement] })] }), _jsx(Progress.Root, { className: "mt-2", min: 0, max: turnoverRequirement, value: clamp(currentTurnoverRequirementContribution, 0, turnoverRequirement), children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) })] }), _jsxs(Collapsible.Root, { className: "mt-xl lg:mt-6", children: [_jsxs(Collapsible.Trigger, { className: "text-button-tertiary-fg flex w-fit items-center justify-center gap-sm text-sm font-semibold lg:mx-auto", children: ["Game Provider Contribution", _jsx(Collapsible.Indicator, { asChild: true, children: _jsx(ChevronRightIcon, { className: "size-5" }) })] }), _jsx(Collapsible.Content, { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl space-y-1.5 rounded-md border px-3.5 py-xl lg:mt-6", children: Object.entries(bonus.promo
21
+ .turnoverRequirementContributionPercentagePerGameProvider ?? {}).map(([provider, valueAsString]) => {
22
+ const value = parseDecimal(valueAsString, 0);
23
+ return (_jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: capitalize(provider, {
24
+ delimiter: capitalize.delimiters.UNDERSCORE,
25
+ }) }), _jsx(Progress.Root, { min: 0, max: 100, value: clamp(value, 0, 100), className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsxs("p", { className: "shrink-0 lg:w-14 lg:text-right", children: [formatNumber(value, {
26
+ maxDecimalPlaces: 1,
27
+ minDecimalPlaces: 0,
28
+ }), "%"] })] }, provider));
29
+ }) })] }), _jsx(Prose, { className: "mt-xl lg:mt-6", dangerouslySetInnerHTML: { __html: bonus.promo.description } })] }));
30
+ }
31
+ function DefaultImage() {
32
+ return (_jsx("div", { style: {
33
+ background: 'radial-gradient(75.21% 75.21% at 50% 50%, rgba(249, 163, 8, 0.3) 0%, rgba(0, 0, 0, 0) 100%), var(--color-bg-primary-alt)',
34
+ }, className: "overflow-hidden rounded-xl", children: _jsx(Image, { src: piggyBank, alt: "", className: "mx-auto h-auto w-[50%] shrink-0", draggable: false, width: 1024, height: 1024, priority: true }) }));
9
35
  }
@@ -1,5 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { notFound } from 'next/navigation';
3
+ import { prefetchBonusQuery } from '../../server/utils/index.js';
4
+ import { getBonusQueryKey, getQueryClient } from '../../utils/index.js';
2
5
  import { Bonus__client } from './Bonus.client.js';
3
6
  export async function Bonus(props) {
7
+ await prefetchBonusQuery(props.id);
8
+ const bonus = getQueryClient().getQueryData(getBonusQueryKey(props.id));
9
+ if (!bonus)
10
+ return notFound();
4
11
  return _jsx(Bonus__client, { ...props });
5
12
  }
@@ -31,21 +31,20 @@ export function Bonuses__client(props) {
31
31
  const empty = bonuses.length === 0 && cashbackBonuses.length === 0;
32
32
  return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Rewards' }), _jsxs(SegmentGroup.Root, { value: tab, onValueChange: (details) => {
33
33
  setTab(z.enum(TABS).parse(details.value));
34
- }, className: "mt-3", children: [TABS.map((value) => (_jsxs(SegmentGroup.Item, { value: value, children: [_jsxs(SegmentGroup.ItemText, { children: [" ", capitalize(value)] }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, value))), _jsx(SegmentGroup.Indicator, {})] }), empty && (_jsx(Empty, { className: "mt-8", icon: Gift01Icon, title: "No Rewards", message: "No reward is currently available." })), !empty && (_jsxs("div", { className: "mt-3xl grid gap-3xl lg:mt-lg lg:grid-cols-3", children: [tab !== 'CASHBACKS' && (_jsx(_Fragment, { children: bonuses.map((bonus) => (_jsx(Bonus, { data: bonus, viewDetailsUrl: props.viewBonusDetailsUrl ?? '/rewards/bonus' }, bonus.id))) })), cashbackBonuses.map((cashbackBonus) => (_jsx(CashbackBonus, { data: cashbackBonus, viewDetailsUrl: props.viewCashbackDetailsUrl ?? '/rewards/cashback' }, cashbackBonus.id)))] }))] }));
34
+ }, className: "mt-3", children: [TABS.map((value) => (_jsxs(SegmentGroup.Item, { value: value, children: [_jsxs(SegmentGroup.ItemText, { children: [" ", capitalize(value)] }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, value))), _jsx(SegmentGroup.Indicator, {})] }), empty && (_jsx(Empty, { className: "mt-8", icon: Gift01Icon, title: "No Rewards", message: "No reward is currently available." })), !empty && (_jsxs("div", { className: "mt-3xl grid gap-3xl lg:mt-lg lg:grid-cols-3", children: [tab !== 'CASHBACKS' && (_jsx(_Fragment, { children: bonuses.map((bonus) => (_jsx(Bonus, { data: bonus, viewDetailsUrl: props.viewBonusDetailsUrl ?? '/rewards' }, bonus.id))) })), cashbackBonuses.map((cashbackBonus) => (_jsx(CashbackBonus, { data: cashbackBonus }, cashbackBonus.id)))] }))] }));
35
35
  }
36
36
  function Bonus(props) {
37
37
  const bonus = props.data;
38
38
  const promo = bonus.promo;
39
39
  const localeInfo = useLocaleInfo();
40
- const expirationCounter = useRemainingTime(bonus.expiration);
40
+ const remainingTime = useRemainingTime(bonus.expiration);
41
41
  const currentTurnoverRequirementContributionPercentage = parseDecimal(bonus.currentTurnoverRequirementContributionPercentage, 0);
42
- return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [_jsxs("div", { className: "relative", children: [promo.banner?.url ? (_jsx(Image, { src: promo.banner.url, alt: "", width: 400, height: 200, className: "h-auto w-full" })) : (_jsx(DefaultImage, { type: "bonus" })), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: expirationCounter.expired ? 'danger' : 'gray', className: "absolute right-4 top-4", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: expirationCounter.expired
43
- ? 'Expired'
44
- : expirationCounter.toString() })] })] }), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("h2", { className: "text-center text-xl font-semibold text-white", children: promo.name }), _jsxs("div", { className: "mt-2 flex items-baseline justify-center gap-2", children: [_jsx("p", { className: "text-3xl font-semibold leading-none", children: formatNumber(bonus.balance, {
42
+ const turnoverRequirement = parseDecimal(bonus.turnoverRequirement, 0);
43
+ return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [_jsxs("div", { className: "relative", children: [promo.banner?.url ? (_jsx(Image, { src: promo.banner.url, alt: "", width: 400, height: 200, className: "h-auto w-full" })) : (_jsx(DefaultImage, { type: "bonus" })), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: remainingTime.expired ? 'danger' : 'gray', className: "absolute right-4 top-4", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: remainingTime.expired ? 'Expired' : remainingTime.toString() })] })] }), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("h2", { className: "text-center text-xl font-semibold text-white", children: promo.name }), _jsxs("div", { className: "mt-2 flex items-baseline justify-center gap-2", children: [_jsx("p", { className: "text-3xl font-semibold leading-none", children: formatNumber(bonus.balance, {
45
44
  currency: localeInfo.currency.code,
46
45
  }) }), _jsxs("p", { className: "text-text-secondary-700 text-xl font-semibold leading-none", children: ["/\u00A0", formatNumber(bonus.amount, {
47
46
  currency: localeInfo.currency.code,
48
- })] })] }), _jsxs("div", { className: "text-text-primary-brand mt-md flex justify-between", children: [_jsxs("p", { children: ["Wagering ", currentTurnoverRequirementContributionPercentage, "%"] }), _jsxs("p", { children: [currentTurnoverRequirementContributionPercentage, "/100"] })] }), _jsx(Progress.Root, { min: 0, max: 100, value: clamp(currentTurnoverRequirementContributionPercentage, 0, 100), className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("div", { className: "grow" }), _jsx(Button, { variant: "outline", className: "mt-6", asChild: true, children: _jsx(Link, { href: `${props.viewDetailsUrl}/${bonus.id}`, children: "See More" }) })] })] }));
47
+ })] })] }), _jsxs("div", { className: "text-text-primary-brand mt-md flex justify-between", children: [_jsxs("p", { children: ["Wagering ", currentTurnoverRequirementContributionPercentage, "%"] }), _jsxs("p", { children: [currentTurnoverRequirementContributionPercentage, "/", turnoverRequirement] })] }), _jsx(Progress.Root, { min: 0, max: 100, value: clamp(currentTurnoverRequirementContributionPercentage, 0, 100), className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("div", { className: "grow" }), _jsx(Button, { variant: "outline", className: "mt-6", asChild: true, children: _jsx(Link, { href: `${props.viewDetailsUrl}/${bonus.id}`, children: "See More" }) })] })] }));
49
48
  }
50
49
  function CashbackBonus(props) {
51
50
  const bonus = props.data;
@@ -3,13 +3,8 @@ export interface BonusesProps {
3
3
  className?: string;
4
4
  /**
5
5
  * @description base URL for the bonus details page
6
- * @default "/rewards/bonus"
6
+ * @default "/rewards"
7
7
  */
8
8
  viewBonusDetailsUrl?: string;
9
- /**
10
- * @description base URL for the cashback details page
11
- * @default "/rewards/cashback"
12
- */
13
- viewCashbackDetailsUrl?: string;
14
9
  }
15
10
  export declare function Bonuses(props: BonusesProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -6,9 +6,13 @@ import { useBonusesQuery, useCashbackBonusesQuery } from '../../client/hooks/ind
6
6
  import { Gift01Icon } from '../../icons/index.js';
7
7
  import { iconButtonRecipe } from '../../ui/IconButton/iconButton.recipe.js';
8
8
  export function BonusesTrigger(props) {
9
- const bonusesQuery = useBonusesQuery();
9
+ const bonusesQuery = useBonusesQuery({
10
+ refetchInterval: 10000,
11
+ });
12
+ const cashbackBonusesQuery = useCashbackBonusesQuery({
13
+ refetchInterval: 10000,
14
+ });
10
15
  const bonusesCount = bonusesQuery.data?.length ?? 0;
11
- const cashbackBonusesQuery = useCashbackBonusesQuery();
12
16
  const cashbackBonusesCount = cashbackBonusesQuery.data?.length ?? 0;
13
17
  const totalCount = bonusesCount + cashbackBonusesCount;
14
18
  return (_jsx(Link, { "aria-label": "View Rewards", "data-count": totalCount, ...props, href: props.href ?? '/rewards', className: iconButtonRecipe({
@@ -5,23 +5,27 @@ import { format } from 'date-fns';
5
5
  import Image from 'next/image';
6
6
  import Link from 'next/link';
7
7
  import { useShallow } from 'zustand/shallow';
8
- import { useGlobalStore, useLocaleInfo, usePromoQuery, } from '../../client/hooks/index.js';
8
+ import { useAvailablePromosQuery, useCashbackQuery, useGlobalStore, useLocaleInfo, } from '../../client/hooks/index.js';
9
9
  import { ChevronLeftIcon } from '../../icons/index.js';
10
10
  import { Button, Prose } from '../../ui/index.js';
11
11
  export function Cashback__client(props) {
12
+ const availablePromosQuery = useAvailablePromosQuery();
13
+ const cashbackQuery = useCashbackQuery(props.id);
14
+ const availablePromos = availablePromosQuery.data ?? [];
15
+ const cashback = cashbackQuery.data;
16
+ const claimable = availablePromos.some(({ id }) => id === props.id);
12
17
  const localeInfo = useLocaleInfo();
13
- const promoQuery = usePromoQuery(props.id);
14
- const promo = promoQuery.data;
15
18
  const globalStore = useGlobalStore(useShallow((ctx) => ({
16
19
  depositWithdrawal: ctx.depositWithdrawal,
17
20
  })));
18
- if (!promo)
21
+ if (!cashback)
19
22
  return null;
20
- return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: "", width: 1024, height: 600, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" })), _jsx(Button, { className: "mt-xl lg:mt-6", onClick: () => {
23
+ return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), cashback.banner.url && (_jsx(Image, { src: cashback.banner.url, alt: "", width: 1024, height: 600, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" })), claimable && (_jsx(Button, { className: "mt-xl lg:mt-6", onClick: () => {
21
24
  globalStore.depositWithdrawal.setOpen(true);
22
- }, children: "Deposit Now" }), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: promo.name }), _jsxs("p", { className: "text-text-secondary-700 mt-xl lg:mt-6", children: ["Ends", ' ', format(promo.activationEndDateTime, 'MM/dd/yyy hh:mm:ss A', {
25
+ globalStore.depositWithdrawal.setPromo(cashback.id);
26
+ }, children: "Deposit Now" })), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: cashback.name }), _jsxs("p", { className: "text-text-secondary-700 mt-xl lg:mt-6", children: ["Ends", ' ', format(cashback.activationEndDateTime, 'MM/dd/yyy hh:mm:ss a', {
23
27
  in: tz(localeInfo.timezone),
24
28
  })] }), _jsx(Prose, { className: "mt-2xl lg:mt-6", dangerouslySetInnerHTML: {
25
- __html: promo.description,
29
+ __html: cashback.description,
26
30
  } }), _jsxs(Prose, { className: "bg-bg-secondary mt-xl rounded-2xl p-2xl lg:mt-16 lg:p-4xl", children: [_jsx("h2", { children: "Conclusion" }), _jsx("p", { children: "Morbi sed imperdiet in ipsum, adipiscing elit dui lectus. Tellus id scelerisque est ultricies ultricies. Duis est sit sed leo nisl, blandit elit sagittis. Quisque tristique consequat quam sed. Nisl at scelerisque amet nulla purus habitasse." }), _jsx("p", { children: "Nunc sed faucibus bibendum feugiat sed interdum. Ipsum egestas condimentum mi massa. In tincidunt pharetra consectetur sed duis facilisis metus. Etiam egestas in nec sed et. Quis lobortis at sit dictum eget nibh tortor commodo cursus." }), _jsx("p", { children: "Odio felis sagittis, morbi feugiat tortor vitae feugiat fusce aliquet. Nam elementum urna nisi aliquet erat dolor enim. Ornare id morbi eget ipsum. Aliquam senectus neque ut id eget consectetur dictum. Donec posuere pharetra odio consequat scelerisque et, nunc tortor." })] })] }));
27
31
  }
@@ -1,15 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { notFound } from 'next/navigation';
3
3
  import { prefetchCashbackQuery } from '../../server/utils/index.js';
4
- import { getPromoQueryKey, getQueryClient } from '../../utils/index.js';
4
+ import { getCashbackQueryKey, getQueryClient } from '../../utils/index.js';
5
5
  import { Cashback__client } from './Cashback.client.js';
6
6
  export async function Cashback(props) {
7
7
  await prefetchCashbackQuery(props.id);
8
- const promo = getQueryClient().getQueryData(getPromoQueryKey(props.id));
9
- if (promo) {
10
- return _jsx(Cashback__client, { ...props });
11
- }
12
- else {
8
+ const cashback = getQueryClient().getQueryData(getCashbackQueryKey(props.id));
9
+ if (!cashback)
13
10
  return notFound();
14
- }
11
+ return _jsx(Cashback__client, { ...props });
15
12
  }
@@ -1,5 +1,5 @@
1
1
  export declare const OnlineBankDepositContext: import("react").Context<{
2
- view: "vca" | "form";
2
+ view: "form" | "vca";
3
3
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
4
  verify: () => void;
5
5
  reset: () => void;
@@ -9,7 +9,7 @@ export declare const OnlineBankDepositContext: import("react").Context<{
9
9
  promo?: string | null;
10
10
  }) => void;
11
11
  }>, useOnlineBankDepositContext: () => {
12
- view: "vca" | "form";
12
+ view: "form" | "vca";
13
13
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
14
14
  verify: () => void;
15
15
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '@opexa/portal-sdk-core';
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" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -1,5 +1,5 @@
1
1
  export declare const QRPHDepositContext: import("react").Context<{
2
- view: "qrCode" | "form";
2
+ view: "form" | "qrCode";
3
3
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
4
  verify: () => void;
5
5
  reset: () => void;
@@ -9,7 +9,7 @@ export declare const QRPHDepositContext: import("react").Context<{
9
9
  promo?: string | null;
10
10
  }) => void;
11
11
  }>, useQRPHDepositContext: () => {
12
- view: "qrCode" | "form";
12
+ view: "form" | "qrCode";
13
13
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
14
14
  verify: () => void;
15
15
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '@opexa/portal-sdk-core';
2
2
  export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
3
3
  export declare function useQRPHDeposit(): {
4
- view: "qrCode" | "form";
4
+ view: "form" | "qrCode";
5
5
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -5,21 +5,25 @@ import { format } from 'date-fns';
5
5
  import Image from 'next/image';
6
6
  import Link from 'next/link';
7
7
  import { useShallow } from 'zustand/shallow';
8
- import { useGlobalStore, useLocaleInfo, usePromoQuery, } from '../../client/hooks/index.js';
8
+ import { useAvailablePromosQuery, useGlobalStore, useLocaleInfo, usePromoQuery, } from '../../client/hooks/index.js';
9
9
  import { ChevronLeftIcon } from '../../icons/index.js';
10
10
  import { Button, Prose } from '../../ui/index.js';
11
11
  export function Promo__client(props) {
12
12
  const localeInfo = useLocaleInfo();
13
+ const availablePromosQuery = useAvailablePromosQuery();
14
+ const availablePromos = availablePromosQuery.data ?? [];
13
15
  const promoQuery = usePromoQuery(props.id);
14
16
  const promo = promoQuery.data;
17
+ const claimable = availablePromos.some(({ id }) => id === promo?.id);
15
18
  const globalStore = useGlobalStore(useShallow((ctx) => ({
16
19
  depositWithdrawal: ctx.depositWithdrawal,
17
20
  })));
18
21
  if (!promo)
19
22
  return null;
20
- return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: "", width: 1024, height: 600, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" })), _jsx(Button, { className: "mt-xl lg:mt-6", onClick: () => {
23
+ return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: "", width: 1024, height: 600, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" })), claimable && (_jsx(Button, { className: "mt-xl lg:mt-6", onClick: () => {
21
24
  globalStore.depositWithdrawal.setOpen(true);
22
- }, children: "Deposit Now" }), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: promo.name }), _jsxs("p", { className: "text-text-secondary-700 mt-xl lg:mt-6", children: ["Ends", ' ', format(promo.activationEndDateTime, 'MM/dd/yyy hh:mm:ss', {
25
+ globalStore.depositWithdrawal.setPromo(promo.id);
26
+ }, children: "Deposit Now" })), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: promo.name }), _jsxs("p", { className: "text-text-secondary-700 mt-xl lg:mt-6", children: ["Ends", ' ', format(promo.activationEndDateTime, 'MM/dd/yyy hh:mm:ss', {
23
27
  in: tz(localeInfo.timezone),
24
28
  })] }), _jsx(Prose, { className: "mt-2xl lg:mt-6", dangerouslySetInnerHTML: {
25
29
  __html: promo.description,
@@ -6,10 +6,7 @@ import { Promo__client } from './Promo.client.js';
6
6
  export async function Promo(props) {
7
7
  await prefetchPromoQuery(props.id);
8
8
  const promo = getQueryClient().getQueryData(getPromoQueryKey(props.id));
9
- if (promo) {
10
- return _jsx(Promo__client, { ...props });
11
- }
12
- else {
9
+ if (!promo)
13
10
  return notFound();
14
- }
11
+ return _jsx(Promo__client, { ...props });
15
12
  }
@@ -7,7 +7,6 @@ export * from './BetRecords';
7
7
  export * from './Bonus';
8
8
  export * from './Bonuses';
9
9
  export * from './Cashback';
10
- export * from './CashbackBonus';
11
10
  export * from './DepositWithdrawal';
12
11
  export * from './Disclaimer';
13
12
  export * from './FavoriteGames';
@@ -7,7 +7,6 @@ export * from './BetRecords/index.js';
7
7
  export * from './Bonus/index.js';
8
8
  export * from './Bonuses/index.js';
9
9
  export * from './Cashback/index.js';
10
- export * from './CashbackBonus/index.js';
11
10
  export * from './DepositWithdrawal/index.js';
12
11
  export * from './Disclaimer/index.js';
13
12
  export * from './FavoriteGames/index.js';
@@ -1,4 +1,4 @@
1
- import { getBonus } from '@opexa/portal-sdk-core';
1
+ import { getBonuses } from '@opexa/portal-sdk-core';
2
2
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
3
3
  import { getBonusQueryKey, getQueryClient } from '../../utils/index.js';
4
4
  import { getSession } from '../services/getSession.js';
@@ -9,7 +9,8 @@ export const prefetchBonusQuery = async (id) => {
9
9
  await getQueryClient().prefetchQuery({
10
10
  queryKey: getBonusQueryKey(id),
11
11
  queryFn: async ({ signal }) => {
12
- return await getBonus(id, {
12
+ /* FIXME: use getBonus query once api is fixed */
13
+ const bonuses = await getBonuses({
13
14
  signal,
14
15
  environment: ENVIRONMENT,
15
16
  headers: {
@@ -17,6 +18,8 @@ export const prefetchBonusQuery = async (id) => {
17
18
  Authorization: `Bearer ${session.token}`,
18
19
  },
19
20
  });
21
+ const bonus = bonuses.find((b) => b.id === id) ?? null;
22
+ return bonus;
20
23
  },
21
24
  });
22
25
  };
@@ -1,17 +1,20 @@
1
- import { getCashback } from '@opexa/portal-sdk-core';
1
+ import { getCashbacks } from '@opexa/portal-sdk-core';
2
2
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
3
3
  import { getCashbackQueryKey, getQueryClient } from '../../utils/index.js';
4
4
  export const prefetchCashbackQuery = async (id) => {
5
5
  await getQueryClient().prefetchQuery({
6
6
  queryKey: getCashbackQueryKey(id),
7
7
  queryFn: async ({ signal }) => {
8
- return await getCashback(id, {
8
+ /* FIXME: use getCashback query once api if fixed */
9
+ const cashbacks = await getCashbacks({
9
10
  signal,
10
11
  environment: ENVIRONMENT,
11
12
  headers: {
12
13
  'Platform-Code': PLATFORM_CODE,
13
14
  },
14
15
  });
16
+ const cashback = cashbacks.find((c) => c.id === id) ?? null;
17
+ return cashback;
15
18
  },
16
19
  });
17
20
  };
@@ -1,17 +1,20 @@
1
- import { getPromo } from '@opexa/portal-sdk-core';
1
+ import { getPromos } from '@opexa/portal-sdk-core';
2
2
  import { ENVIRONMENT, PLATFORM_CODE } from '../../constants/index.js';
3
3
  import { getPromoQueryKey, getQueryClient } from '../../utils/index.js';
4
4
  export const prefetchPromoQuery = async (id) => {
5
5
  await getQueryClient().prefetchQuery({
6
6
  queryKey: getPromoQueryKey(id),
7
7
  queryFn: async ({ signal }) => {
8
- return await getPromo(id, {
8
+ /* FIXME: use getPromo query once api is fixed */
9
+ const promos = await getPromos({
9
10
  signal,
10
11
  environment: ENVIRONMENT,
11
12
  headers: {
12
13
  'Platform-Code': PLATFORM_CODE,
13
14
  },
14
15
  });
16
+ const promo = promos.find((p) => p.id === id) ?? null;
17
+ return promo;
15
18
  },
16
19
  });
17
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/components/index.d.ts",
@@ -1,2 +0,0 @@
1
- import type { CashbackBonusProps } from './CashbackBonus';
2
- export declare function CashbackBonus__client(props: CashbackBonusProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Image from 'next/image';
4
- import Link from 'next/link';
5
- import { ChevronLeftIcon, ChevronRightIcon, StopWatchIcon } from '../../icons/index.js';
6
- import { Badge, Collapsible, Progress, Prose } from '../../ui/index.js';
7
- export function CashbackBonus__client(props) {
8
- return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllUrl ?? '/rewards', className: "text-button-tertiary-fg flex items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to Rewards"] }), _jsx(Image, { src: "https://s3.ap-east-1.amazonaws.com/opexa-assets.opexasystem.com/assets/BSxIXEsa59_zzMAR27-ALLDAYREBATE06-STATIC-WEB-HB-1920x1080.png", alt: "", width: 1024, height: 600, className: "mt-3xl h-auto w-full rounded-xl" }), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: "brand", className: "mt-xl lg:mt-6", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: "9d:10h:11m" })] }), _jsx("h1", { className: "text-text-primary-900 mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: "50 PHP First Deposit Bonus" }), _jsx("p", { className: "text-text-primary-brand mt-xl text-base lg:mt-6 lg:text-lg", children: "Complete the wagering before time runs out to convert your bonus balance into real money!" }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Your bonus" }), _jsxs("p", { children: [_jsx("span", { className: "text-text-primary-900", children: "20.00" }), " / 50.00 PHP"] })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl flex items-center justify-between rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsx("p", { children: "Required Turnover" }), _jsx("p", { children: "5x" })] }), _jsxs("div", { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { children: "Wagering" }), _jsx("p", { children: "400/1000" })] }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) })] }), _jsxs(Collapsible.Root, { className: "mt-xl lg:mt-6", children: [_jsxs(Collapsible.Trigger, { className: "text-button-tertiary-fg flex w-fit items-center justify-center gap-sm text-sm font-semibold lg:mx-auto", children: ["Game Provider Contribution", _jsx(Collapsible.Indicator, { asChild: true, children: _jsx(ChevronRightIcon, { className: "size-5" }) })] }), _jsxs(Collapsible.Content, { className: "border-border-primary bg-bg-tertiary text-text-secondary-700 mt-xl space-y-1.5 rounded-md border px-3.5 py-xl lg:mt-6", children: [_jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Playson" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "25%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Betsoft Gaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "13%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Microgaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "50%" })] }), _jsxs("div", { className: "flex items-center justify-between gap-md", children: [_jsx("p", { className: "w-[11.25rem] shrink-0", children: "Realtime Gaming" }), _jsx(Progress.Root, { defaultValue: 42, className: "mt-2 grow", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("p", { children: "10%" })] })] })] }), _jsxs(Prose, { className: "mt-xl lg:mt-6", children: [_jsx("h3", { children: "How to get bonus" }), _jsxs("ol", { children: [_jsx("li", { children: "All OFWin members are eligible for this program." }), _jsx("li", { children: "50 PHP of game credit will be automatically credited to the new member account upon completion of first deposit Auctor vel in vitae placerat." }), _jsx("li", { children: "Member must reach a 5x turnover requirement before a withdrawal can be made. Attempting to make a withdrawal before this turnover requirement is completed could cause your bonus to be voided." }), _jsx("li", { children: "Players will have 10 days from the date the bonus is awarded to complete the rollover requirement." }), _jsx("li", { children: "Bets used to meet other bonus rollover requirements will not count toward this promotion." })] }), _jsx("h3", { children: "Terms and Conditions" }), _jsxs("ul", { children: [_jsx("li", { children: "Only one account per player is allowed. No same IP address/bank account name allowed. Players who have multiple or fraudulent accounts will not be qualified for the promotion." }), _jsx("li", { children: "Players that are found to have any duplicate accounts or those who participate in fraudulent activities may have their funds forfeited and their accounts closed." }), _jsx("li", { children: "OFWin reserves the right to amend or cancel this Referral Program at any time. OFWin General Terms and Conditions apply." })] })] })] }));
9
- }
@@ -1,10 +0,0 @@
1
- export interface CashbackBonusProps {
2
- id: string;
3
- className?: string;
4
- /**
5
- * @description URL for the bonuses details page
6
- * @default "/rewards"
7
- */
8
- viewAllUrl?: string;
9
- }
10
- export declare function CashbackBonus(props: CashbackBonusProps): Promise<import("react/jsx-runtime").JSX.Element>;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CashbackBonus__client } from './CashbackBonus.client.js';
3
- export async function CashbackBonus(props) {
4
- return _jsx(CashbackBonus__client, { ...props });
5
- }
@@ -1 +0,0 @@
1
- export * from './CashbackBonus';
@@ -1 +0,0 @@
1
- export * from './CashbackBonus.js';
@@ -1,2 +0,0 @@
1
- import type { PromoProps } from './Promo';
2
- export declare function PromoContent(props: PromoProps): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Image from 'next/image';
4
- import Link from 'next/link';
5
- import { ChevronLeftIcon } from '../../icons/index.js';
6
- import { Button, Prose } from '../../ui/index.js';
7
- export function PromoContent(props) {
8
- return (_jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), _jsx(Image, { src: "https://s3.ap-east-1.amazonaws.com/opexa-assets.opexasystem.com/assets/BSxIXEsa59_zzMAR27-ALLDAYREBATE06-STATIC-WEB-HB-1920x1080.png", alt: "", width: 1024, height: 600, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" }), _jsx(Button, { className: "mt-xl lg:mt-6", children: "Deposit Now" }), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: "Welcome Bonus 100% up to $500 + 10 Free Spins" }), _jsx("p", { className: "text-text-secondary-700 mt-xl lg:mt-6", children: "Ends 5/26/2025, 1:59:59 AM" }), _jsxs(Prose, { className: "mt-2xl lg:mt-6", children: [_jsx("p", { children: "Mi tincidunt elit, id quisque ligula ac diam, amet. Vel etiam suspendisse morbi eleifend faucibus eget vestibulum felis. Dictum quis montes, sit sit. Tellus aliquam enim urna, etiam. Mauris posuere vulputate arcu amet, vitae nisi, tellus tincidunt. At feugiat sapien varius id." }), _jsx("p", { children: "Eget quis mi enim, leo lacinia pharetra, semper. Eget in volutpat mollis at volutpat lectus velit, sed auctor. Porttitor fames arcu quis fusce augue enim. Quis at habitant diam at. Suscipit tristique risus, at donec. In turpis vel et quam imperdiet. Ipsum molestie aliquet sodales id est ac volutpat." }), _jsx("p", { children: "Ipsum sit mattis nulla quam nulla. Gravida id gravida ac enim mauris id. Non pellentesque congue eget consectetur turpis. Sapien, dictum molestie sem tempor. Diam elit, orci, tincidunt aenean tempus. Quis velit eget ut tortor tellus. Sed vel, congue felis elit erat nam nibh orci." }), _jsx("p", { children: "Dolor enim eu tortor urna sed duis nulla. Aliquam vestibulum, nulla odio nisl vitae. In aliquet pellentesque aenean hac vestibulum turpis mi bibendum diam. Tempor integer aliquam in vitae malesuada fringilla." }), _jsx("p", { children: "Elit nisi in eleifend sed nisi. Pulvinar at orci, proin imperdiet commodo consectetur convallis risus. Sed condimentum enim dignissim adipiscing faucibus consequat, urna. Viverra purus et erat auctor aliquam. Risus, volutpat vulputate posuere purus sit congue convallis aliquet. Arcu id augue ut feugiat donec porttitor neque. Mauris, neque ultricies eu vestibulum, bibendum quam lorem id. Dolor lacus, eget nunc lectus in tellus, pharetra, porttitor." }), _jsx("p", { children: "Ipsum sit mattis nulla quam nulla. Gravida id gravida ac enim mauris id. Non pellentesque congue eget consectetur turpis. Sapien, dictum molestie sem tempor. Diam elit, orci, tincidunt aenean tempus. Quis velit eget ut tortor tellus. Sed vel, congue felis elit erat nam nibh orci." }), _jsx("h5", { children: "General Conditions:" }), _jsx("p", { children: "Mi tincidunt elit, id quisque ligula ac diam, amet. Vel etiam suspendisse morbi eleifend faucibus eget vestibulum felis. Dictum quis montes, sit sit. Tellus aliquam enim urna, etiam. Mauris posuere vulputate arcu amet, vitae nisi, tellus tincidunt. At feugiat sapien varius id." }), _jsx("p", { children: "Eget quis mi enim, leo lacinia pharetra, semper. Eget in volutpat mollis at volutpat lectus velit, sed auctor. Porttitor fames arcu quis fusce augue enim. Quis at habitant diam at. Suscipit tristique risus, at donec. In turpis vel et quam imperdiet. Ipsum molestie aliquet sodales id est ac volutpat." })] }), _jsxs(Prose, { className: "bg-bg-secondary mt-xl rounded-2xl p-2xl lg:mt-16 lg:p-4xl", children: [_jsx("h2", { children: "Conclusion" }), _jsx("p", { children: "Morbi sed imperdiet in ipsum, adipiscing elit dui lectus. Tellus id scelerisque est ultricies ultricies. Duis est sit sed leo nisl, blandit elit sagittis. Quisque tristique consequat quam sed. Nisl at scelerisque amet nulla purus habitasse." }), _jsx("p", { children: "Nunc sed faucibus bibendum feugiat sed interdum. Ipsum egestas condimentum mi massa. In tincidunt pharetra consectetur sed duis facilisis metus. Etiam egestas in nec sed et. Quis lobortis at sit dictum eget nibh tortor commodo cursus." }), _jsx("p", { children: "Odio felis sagittis, morbi feugiat tortor vitae feugiat fusce aliquet. Nam elementum urna nisi aliquet erat dolor enim. Ornare id morbi eget ipsum. Aliquam senectus neque ut id eget consectetur dictum. Donec posuere pharetra odio consequat scelerisque et, nunc tortor." })] })] }));
9
- }
@@ -1,2 +0,0 @@
1
- import type { PromosProps } from './Promos';
2
- export declare function PromoCarousel(props: PromosProps): import("react/jsx-runtime").JSX.Element;
@@ -1,41 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import useEmblaCarousel, {} from 'embla-carousel-react';
4
- import Link from 'next/link';
5
- import { useCallback, useEffect, useState } from 'react';
6
- import { twMerge } from 'tailwind-merge';
7
- import { usePromosQuery } from '../../client/hooks/index.js';
8
- import { ArrowLeftIcon, ArrowRightIcon, ChevronRightIcon, Gift01Icon, } from '../../icons/index.js';
9
- import { Button } from '../../ui/index.js';
10
- import { Empty } from '../Empty.js';
11
- import { PromosItem } from './PromoItem.js';
12
- export function PromoCarousel(props) {
13
- const promosQuery = usePromosQuery({});
14
- const promos = promosQuery.data || [];
15
- const [emblaRef, emblaApi] = useEmblaCarousel({
16
- align: 'start',
17
- slidesToScroll: 1,
18
- breakpoints: {
19
- '(min-width: 1024px)': {
20
- slidesToScroll: 3,
21
- },
22
- },
23
- });
24
- const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
25
- const [nextBtnDisabled, setNextBtnDisabled] = useState(true);
26
- const onPrevButtonClick = useCallback(() => emblaApi?.scrollPrev(), [emblaApi]);
27
- const onNextButtonClick = useCallback(async () => {
28
- emblaApi?.scrollNext();
29
- }, [emblaApi]);
30
- const onSelect = useCallback((emblaApi) => {
31
- setPrevBtnDisabled(!emblaApi?.canScrollPrev());
32
- setNextBtnDisabled(!emblaApi?.canScrollNext());
33
- }, []);
34
- useEffect(() => {
35
- if (!emblaApi)
36
- return;
37
- onSelect(emblaApi);
38
- emblaApi.on('reInit', onSelect).on('select', onSelect);
39
- }, [emblaApi, onSelect]);
40
- return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "text-lg font-semibold", 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: "text-button-tertiary-fg flex gap-sm text-sm font-semibold", 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" }) })] })] })] }), promos.length <= 0 && (_jsx(Empty, { icon: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-8" })), promos.length >= 1 && (_jsx("div", { ref: emblaRef, className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: twMerge('grid auto-cols-[calc((100%-(0.375rem*2))/1)] grid-flow-col gap-sm lg:auto-cols-[calc((100%-(0.5rem*5))/3)] lg:gap-md'), children: promos.map((promo) => (_jsx(PromosItem, { promo: promo, shouldShowDescription: props.shouldShowDescription }, promo.id))) }) }))] }));
41
- }
@@ -1,2 +0,0 @@
1
- import type { PromosProps } from './Promos';
2
- export declare function PromoGrid(props: PromosProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { twMerge } from 'tailwind-merge';
4
- import { usePromosQuery } from '../../client/hooks/index.js';
5
- import { Gift01Icon } from '../../icons/index.js';
6
- import { Empty } from '../Empty.js';
7
- import { PromosItem } from './PromoItem.js';
8
- export function PromoGrid(props) {
9
- const promosQuery = usePromosQuery({});
10
- const promos = promosQuery.data || [];
11
- return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Promos' }), _jsx("div", { className: "grow" })] }), promos.length <= 0 && (_jsx(Empty, { icon: Gift01Icon, title: "No Promos", message: "No promo is currently available.", className: "mt-lg" })), promos.length >= 1 && (_jsx("div", { className: "relative mt-lg lg:overflow-hidden", children: _jsx("div", { className: twMerge('grid grid-cols-1 gap-sm lg:grid-cols-3 lg:gap-md'), children: promos.map((promo) => (_jsx(PromosItem, { promo: promo, shouldShowDescription: props.shouldShowDescription }, promo.id))) }) }))] }));
12
- }
@@ -1,7 +0,0 @@
1
- import type { Promo } from '@opexa/portal-sdk-core';
2
- interface PromosItemProps {
3
- promo: Promo;
4
- shouldShowDescription?: boolean;
5
- }
6
- export declare function PromosItem(props: PromosItemProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import Image from 'next/image';
3
- import { useRouter } from 'next/navigation';
4
- import { twJoin } from 'tailwind-merge';
5
- import { Button } from '../../ui/index.js';
6
- export function PromosItem(props) {
7
- const { promo } = props;
8
- const router = useRouter();
9
- return (_jsxs("div", { className: "border-border-primary bg-accent-50 relative flex h-full flex-col rounded-md border", children: [promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: promo.name, width: 1200, height: 500, priority: true, className: "aspect-[1200/500] w-full rounded-t-md object-cover" })), _jsxs("div", { className: "flex flex-grow flex-col p-4", children: [_jsx("p", { className: twJoin('w-full text-xl font-bold', props.shouldShowDescription ? 'text-start' : 'text-center'), children: promo.name }), props.shouldShowDescription && promo.description && (_jsx("p", { className: "text-gray-600 mb-2 line-clamp-2 w-full overflow-hidden text-start text-sm", dangerouslySetInnerHTML: { __html: promo.description } })), _jsx("div", { className: "mt-auto pt-4", children: _jsx(Button, { className: "w-full text-sm font-semibold", onClick: () => router.push(`/promos/${promo.id}`), children: "Get Bonus" }) })] })] }, promo.id));
10
- }