@opexa/portal-components 0.0.68 → 0.0.69

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 (33) 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/Bonus/Bonus.client.d.ts +1 -1
  5. package/dist/components/Bonus/Bonus.client.js +27 -1
  6. package/dist/components/Bonus/Bonus.js +7 -0
  7. package/dist/components/Bonuses/Bonuses.client.js +5 -6
  8. package/dist/components/Bonuses/Bonuses.d.ts +1 -6
  9. package/dist/components/Bonuses/BonusesTrigger.js +6 -2
  10. package/dist/components/Cashback/Cashback.client.js +11 -7
  11. package/dist/components/Cashback/Cashback.js +4 -7
  12. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  13. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  14. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  15. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  16. package/dist/components/JackpotCounter/JackpotCounterItem.module.css +184 -184
  17. package/dist/components/Promo/Promo.client.js +7 -3
  18. package/dist/components/Promo/Promo.js +2 -5
  19. package/dist/components/index.d.ts +0 -1
  20. package/dist/components/index.js +0 -1
  21. package/dist/server/utils/prefetchBonusQuery.js +5 -2
  22. package/dist/server/utils/prefetchCashbackQuery.js +5 -2
  23. package/dist/server/utils/prefetchPromoQuery.js +5 -2
  24. package/dist/styles/theme.css +696 -696
  25. package/package.json +157 -157
  26. package/dist/components/Promo/PromoContent.d.ts +0 -2
  27. package/dist/components/Promo/PromoContent.js +0 -9
  28. package/dist/components/Promos/PromoCarousel.d.ts +0 -2
  29. package/dist/components/Promos/PromoCarousel.js +0 -41
  30. package/dist/components/Promos/PromoGrid.d.ts +0 -2
  31. package/dist/components/Promos/PromoGrid.js +0 -12
  32. package/dist/components/Promos/PromoItem.d.ts +0 -7
  33. 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
  };
@@ -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;