@opexa/portal-components 0.0.130 → 0.0.131

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,12 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import invariant from 'tiny-invariant';
3
3
  import { getAvailableQuests } from '../../services/trigger.js';
4
- import { getAvailableQuestsQueryKey } from '../../utils/queryKeys.js';
4
+ import { getQueryClient } from '../../utils/getQueryClient.js';
5
+ import { getAvailableQuestsCountQueryKey, getAvailableQuestsQueryKey, } from '../../utils/queryKeys.js';
5
6
  import { getSession } from '../services/getSession.js';
6
7
  import { useSessionQuery } from './useSessionQuery.js';
7
8
  export const useAvailableQuestsQuery = (config) => {
9
+ const queryClient = getQueryClient();
8
10
  const sessionQuery = useSessionQuery();
9
11
  const query = useQuery({
10
12
  ...config,
@@ -15,12 +17,14 @@ export const useAvailableQuestsQuery = (config) => {
15
17
  queryFn: async ({ signal }) => {
16
18
  const session = await getSession();
17
19
  invariant(session.status === 'authenticated');
18
- return await getAvailableQuests({
20
+ const quests = await getAvailableQuests({
19
21
  signal,
20
22
  headers: {
21
23
  Authorization: `Bearer ${session.token}`,
22
24
  },
23
25
  });
26
+ queryClient.setQueryData(getAvailableQuestsCountQueryKey(), quests.length);
27
+ return quests;
24
28
  },
25
29
  });
26
30
  return query;
@@ -1,13 +1,15 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import invariant from 'tiny-invariant';
3
3
  import { getBonuses } from '../../services/wallet.js';
4
- import { getBonusesQueryKey } from '../../utils/queryKeys.js';
4
+ import { getQueryClient } from '../../utils/getQueryClient.js';
5
+ import { getBonusesCountQueryKey, getBonusesQueryKey, } from '../../utils/queryKeys.js';
5
6
  import { getSession } from '../services/getSession.js';
6
7
  import { useSessionQuery } from './useSessionQuery.js';
7
8
  export const useBonusesQuery = (config) => {
9
+ const queryClient = getQueryClient();
8
10
  const sessionQuery = useSessionQuery();
9
11
  const query = useQuery({
10
- staleTime: 1000 * 2,
12
+ staleTime: 1000 * 5,
11
13
  ...config,
12
14
  enabled: config?.enabled === false
13
15
  ? false
@@ -16,12 +18,14 @@ export const useBonusesQuery = (config) => {
16
18
  queryFn: async ({ signal }) => {
17
19
  const session = await getSession();
18
20
  invariant(session.status === 'authenticated');
19
- return await getBonuses({
21
+ const bonuses = await getBonuses({
20
22
  signal,
21
23
  headers: {
22
24
  Authorization: `Bearer ${session.token}`,
23
25
  },
24
26
  });
27
+ queryClient.setQueryData(getBonusesCountQueryKey(), bonuses.length);
28
+ return bonuses;
25
29
  },
26
30
  });
27
31
  return query;
@@ -1,13 +1,15 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import invariant from 'tiny-invariant';
3
3
  import { getCashbackBonuses } from '../../services/wallet.js';
4
- import { getCashbackBonusesQueryKey } from '../../utils/queryKeys.js';
4
+ import { getQueryClient } from '../../utils/getQueryClient.js';
5
+ import { getCashbackBonusesCountQueryKey, getCashbackBonusesQueryKey, } from '../../utils/queryKeys.js';
5
6
  import { getSession } from '../services/getSession.js';
6
7
  import { useSessionQuery } from './useSessionQuery.js';
7
8
  export const useCashbackBonusesQuery = (config) => {
9
+ const queryClient = getQueryClient();
8
10
  const sessionQuery = useSessionQuery();
9
11
  return useQuery({
10
- staleTime: 1000 * 2,
12
+ staleTime: 1000 * 5,
11
13
  ...config,
12
14
  enabled: config?.enabled === false
13
15
  ? false
@@ -16,12 +18,14 @@ export const useCashbackBonusesQuery = (config) => {
16
18
  queryFn: async ({ signal }) => {
17
19
  const session = await getSession();
18
20
  invariant(session.status === 'authenticated');
19
- return await getCashbackBonuses({
21
+ const cashbackBonuses = await getCashbackBonuses({
20
22
  signal,
21
23
  headers: {
22
24
  Authorization: `Bearer ${session.token}`,
23
25
  },
24
26
  });
27
+ queryClient.setQueryData(getCashbackBonusesCountQueryKey(), cashbackBonuses.length);
28
+ return cashbackBonuses;
25
29
  },
26
30
  });
27
31
  };
@@ -28,8 +28,12 @@ import { ClaimSpotBonus } from './ClaimSpotBonus.js';
28
28
  const TABS = ['ALL', 'ACTIVE', 'CASHBACKS'];
29
29
  export function Bonuses__client(props) {
30
30
  const [tab, setTab] = useState(TABS[0]);
31
- const bonusesQuery = useBonusesQuery();
32
- const cashbackBonusesQuery = useCashbackBonusesQuery();
31
+ const bonusesQuery = useBonusesQuery({
32
+ refetchInterval: 5000,
33
+ });
34
+ const cashbackBonusesQuery = useCashbackBonusesQuery({
35
+ refetchInterval: 5000,
36
+ });
33
37
  const bonuses = tab === 'CASHBACKS'
34
38
  ? []
35
39
  : (bonusesQuery.data ?? []).filter((bonus) => {
@@ -1,6 +1,6 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
- view: "form" | "vca";
3
+ view: "vca" | "form";
4
4
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
- view: "form" | "vca";
16
+ view: "vca" | "form";
17
17
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
@@ -1,6 +1,6 @@
1
1
  export declare const QRPHDepositContext: (props: {
2
2
  value: {
3
- view: "form" | "qrCode";
3
+ view: "qrCode" | "form";
4
4
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useQRPHDepositContext: () => {
16
- view: "form" | "qrCode";
16
+ view: "qrCode" | "form";
17
17
  status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.130",
3
+ "version": "0.0.131",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",
@@ -77,9 +77,9 @@
77
77
  "release": "release-it"
78
78
  },
79
79
  "dependencies": {
80
- "@ark-ui/react": "^5.14.0",
80
+ "@ark-ui/react": "^5.14.1",
81
81
  "@date-fns/tz": "^1.2.0",
82
- "@next/third-parties": "^15.3.3",
82
+ "@next/third-parties": "^15.3.4",
83
83
  "@tailwindcss/typography": "^0.5.16",
84
84
  "date-fns": "^4.1.0",
85
85
  "embla-carousel-autoplay": "^8.6.0",
@@ -101,8 +101,8 @@
101
101
  "@hookform/resolvers": "5.1.1",
102
102
  "@opexa/object-id": "0.1.6",
103
103
  "@tailwindcss/postcss": "4",
104
- "@tanstack/react-query": "5.80.7",
105
- "@tanstack/react-query-devtools": "5.80.7",
104
+ "@tanstack/react-query": "5.80.10",
105
+ "@tanstack/react-query-devtools": "5.80.10",
106
106
  "@total-typescript/ts-reset": "0.6.1",
107
107
  "@types/lodash-es": "4.17.12",
108
108
  "@types/node": "24",
@@ -110,16 +110,16 @@
110
110
  "@types/react-dom": "19",
111
111
  "copy-files-from-to": "3.12.1",
112
112
  "eslint": "9",
113
- "eslint-config-next": "15.3.3",
113
+ "eslint-config-next": "15.3.4",
114
114
  "next": "15.4.0-canary.61",
115
115
  "react": "19.1.0",
116
116
  "react-dom": "19.1.0",
117
- "react-hook-form": "7.57.0",
117
+ "react-hook-form": "7.58.1",
118
118
  "release-it": "19.0.3",
119
119
  "tailwindcss": "4.1.10",
120
120
  "tsc-alias": "1.8.16",
121
121
  "typescript": "5",
122
- "zod": "3.25.63"
122
+ "zod": "3.25.67"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "@hookform/resolvers": "^4.0.0 || ^5.0.0",