@opexa/portal-components 0.0.64 → 0.0.66

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.
@@ -9,11 +9,11 @@ import { useInterval } from 'usehooks-ts';
9
9
  import { z } from 'zod';
10
10
  import { useBonusesQuery, useCashbackBonusesQuery, useClaimCashbackBonusMutation, useLocaleInfo, } from '../../client/hooks/index.js';
11
11
  import { Gift01Icon, StopWatchIcon } from '../../icons/index.js';
12
+ import moneyOnHand from '../../images/money-on-hand.png';
13
+ import piggyBank from '../../images/piggy-bank.png';
12
14
  import { Badge, Button, Progress, SegmentGroup } from '../../ui/index.js';
13
15
  import { capitalize, formatNumber, parseDecimal } from '../../utils/index.js';
14
16
  import { Empty } from '../Empty.js';
15
- import moneyOnHand from './money-on-hand.png';
16
- import piggyBank from './piggy-bank.png';
17
17
  const TABS = ['ALL', 'ACTIVE', 'CASHBACKS'];
18
18
  export function Bonuses__client(props) {
19
19
  const [tab, setTab] = useState(TABS[0]);
@@ -83,5 +83,5 @@ function CashbackBonus(props) {
83
83
  function DefaultImage({ type }) {
84
84
  return (_jsxs("div", { style: {
85
85
  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)',
86
- }, children: [type === 'bonus' && (_jsx(Image, { src: piggyBank, alt: "", className: "mx-auto h-auto w-[50%] shrink-0", draggable: false, width: 600 })), type === 'cashback' && (_jsx(Image, { src: moneyOnHand, alt: "", className: "mx-auto h-auto w-[50%] shrink-0", draggable: false, width: 600 }))] }));
86
+ }, children: [type === 'bonus' && (_jsx(Image, { src: piggyBank, alt: "", className: "mx-auto h-auto w-[50%] shrink-0", draggable: false, width: 600, height: 600 })), type === 'cashback' && (_jsx(Image, { src: moneyOnHand, alt: "", className: "mx-auto h-auto w-[50%] shrink-0", draggable: false, width: 600, height: 600 }))] }));
87
87
  }
@@ -0,0 +1,5 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ interface BonusesTriggerProps extends ComponentPropsWithRef<'a'> {
3
+ }
4
+ export declare function BonusesTrigger(props: BonusesTriggerProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import Link from 'next/link';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { useBonusesQuery, useCashbackBonusesQuery } from '../../client/hooks/index.js';
6
+ import { Gift01Icon } from '../../icons/index.js';
7
+ import { iconButtonRecipe } from '../../ui/IconButton/iconButton.recipe.js';
8
+ export function BonusesTrigger(props) {
9
+ const bonusesQuery = useBonusesQuery();
10
+ const bonusesCount = bonusesQuery.data?.length ?? 0;
11
+ const cashbackBonusesQuery = useCashbackBonusesQuery();
12
+ const cashbackBonusesCount = cashbackBonusesQuery.data?.length ?? 0;
13
+ const totalCount = bonusesCount + cashbackBonusesCount;
14
+ return (_jsx(Link, { "aria-label": "View Rewards", "data-count": totalCount, ...props, href: props.href ?? '/rewards', className: iconButtonRecipe({
15
+ size: 'sm',
16
+ colorScheme: 'gray',
17
+ className: twMerge('relative', props.className),
18
+ }), children: props.children ?? (_jsxs(_Fragment, { children: [totalCount > 0 && (_jsx("div", { className: "bg-brand-500 leading-4.5 text-button-primary-fg absolute -right-1.5 -top-1.5 min-w-5 rounded-full border px-1.5 text-2xs font-semibold", children: totalCount })), _jsx(Gift01Icon, {})] })) }));
19
+ }
@@ -1 +1,2 @@
1
1
  export * from './Bonuses';
2
+ export * from './BonusesTrigger';
@@ -1 +1,2 @@
1
1
  export * from './Bonuses.js';
2
+ export * from './BonusesTrigger.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/components/index.d.ts",