@opexa/portal-components 0.1.46 → 0.1.48

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 (52) hide show
  1. package/dist/client/hooks/useCreateAiOGrabPayDepositMutation.js +10 -0
  2. package/dist/client/hooks/useTopGamesQuery.js +3 -1
  3. package/dist/components/DepositWithdrawal/Deposit/AiOGrabPayDeposit/AiOGrabPayDeposit.js +7 -3
  4. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.d.ts +2 -2
  5. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts +1 -1
  6. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +4 -4
  7. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +2 -2
  8. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  9. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  10. package/dist/components/DepositWithdrawal/utils.js +1 -0
  11. package/dist/server/utils/prefetchTopGamesQuery.js +3 -1
  12. package/dist/types/index.d.ts +2 -1
  13. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  14. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  15. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  16. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  17. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  18. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  19. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  20. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  21. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  22. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  23. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  24. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  25. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  26. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  27. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  28. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  29. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  30. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  31. package/dist/ui/Field/Field.d.ts +21 -21
  32. package/dist/ui/Field/field.recipe.d.ts +3 -3
  33. package/dist/ui/Menu/Menu.d.ts +144 -144
  34. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  35. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  36. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  37. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  38. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  39. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  40. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  41. package/dist/ui/Progress/Progress.d.ts +27 -27
  42. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  43. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  44. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  45. package/dist/ui/Select/Select.d.ts +45 -45
  46. package/dist/ui/Select/select.recipe.d.ts +3 -3
  47. package/dist/ui/Table/Table.d.ts +21 -21
  48. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  49. package/dist/ui/Table/table.recipe.d.ts +3 -3
  50. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  51. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  52. package/package.json +1 -1
@@ -2,9 +2,11 @@ import { ObjectId } from '@opexa/object-id';
2
2
  import { useMutation } from '@tanstack/react-query';
3
3
  import { clamp } from 'lodash-es';
4
4
  import invariant from 'tiny-invariant';
5
+ import { explainError } from '../../components/DepositWithdrawal/utils.js';
5
6
  import { OPEXAPAY_ENDPOINT } from '../../constants/index.js';
6
7
  import { ObjectType } from '../../services/ObjectType.js';
7
8
  import { createAiOGrabPayDeposit, getDeposit, } from '../../services/wallet.js';
9
+ import { capitalize } from '../../utils/capitalize.js';
8
10
  import { createPoll } from '../../utils/createPoll.js';
9
11
  import { getQueryClient } from '../../utils/getQueryClient.js';
10
12
  import { getCreateAiOGrabPayDepositMutationKey } from '../../utils/mutationKeys.js';
@@ -51,6 +53,14 @@ export const useCreateAiOGrabPayDepositMutation = (config) => {
51
53
  maxAttempt: 20,
52
54
  });
53
55
  const res = await poll();
56
+ if (res?.error) {
57
+ const error = new Error();
58
+ error.name = capitalize(res.error, {
59
+ delimiter: capitalize.delimiters.UNDERSCORE,
60
+ });
61
+ error.message = explainError(res.error);
62
+ throw error;
63
+ }
54
64
  if (!res?.checkoutUrl) {
55
65
  const error = new Error();
56
66
  error.name = 'AiOGrabPayDepositError';
@@ -9,7 +9,9 @@ export const useTopGamesQuery = (topGames, config) => {
9
9
  if (!ids || ids.length === 0)
10
10
  return [];
11
11
  const results = await Promise.all(ids.map((id) => getGamesv2__next(id, { signal })));
12
- return results.flatMap((res) => res.edges.map((edge) => edge.node));
12
+ return results
13
+ .flatMap((res) => res.edges.map((edge) => edge.node))
14
+ .filter((game) => game.status === 'ACTIVE' && game.hidden !== true);
13
15
  },
14
16
  enabled: (ids?.length ?? 0) > 0 && (config?.enabled ?? true),
15
17
  });
@@ -43,6 +43,7 @@ export function AiOGrabPayDeposit() {
43
43
  const globalStore = useGlobalStore(useShallow((ctx) => ({
44
44
  depositWithdrawal: ctx.depositWithdrawal,
45
45
  })));
46
+ const [errorMessage, setErrorMessage] = useState(null);
46
47
  const [status, setStatus] = useState('waiting');
47
48
  const createDepositMutation = useCreateAiOGrabPayDepositMutation({
48
49
  onMutate() {
@@ -56,8 +57,12 @@ export function AiOGrabPayDeposit() {
56
57
  queryClient.invalidateQueries({ queryKey: getDepositsCountQueryKey() });
57
58
  setStatus('success');
58
59
  },
59
- onError() {
60
+ onError(data) {
60
61
  setStatus('failed');
62
+ setErrorMessage({
63
+ name: data.name,
64
+ message: data.message,
65
+ });
61
66
  },
62
67
  });
63
68
  const warn = useBoolean();
@@ -198,8 +203,7 @@ export function AiOGrabPayDeposit() {
198
203
  'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
199
204
  warn.value &&
200
205
  'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
201
- 'Your deposit has been successfully processed.', status === 'failed' &&
202
- 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' ||
206
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
203
207
  status === 'success' ||
204
208
  status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
205
209
  warn.setFalse();
@@ -1,6 +1,6 @@
1
1
  export declare const AurixPayQRPHDepositContext: (props: {
2
2
  value: {
3
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
3
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
4
4
  deposit: import("../../../../types").Deposit | null;
5
5
  errorMessage: {
6
6
  name: string;
@@ -13,7 +13,7 @@ export declare const AurixPayQRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useAurixPayQRPHDepositContext: () => {
16
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
16
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
17
17
  deposit: import("../../../../types").Deposit | null;
18
18
  errorMessage: {
19
19
  name: string;
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
5
5
  promo?: string | null;
6
6
  }
7
7
  export declare function useAurixPayQRPHDeposit(): {
8
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
8
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
9
9
  deposit: Deposit | null;
10
10
  errorMessage: {
11
11
  name: string;
@@ -1,7 +1,7 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
- view: "vca" | "form";
4
- status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
3
+ view: "form" | "vca";
4
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
7
7
  deposit: import("../../../../types").Deposit | null;
@@ -13,8 +13,8 @@ export declare const OnlineBankDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
- view: "vca" | "form";
17
- status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
16
+ view: "form" | "vca";
17
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
20
20
  deposit: import("../../../../types").Deposit | null;
@@ -1,8 +1,8 @@
1
1
  import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
- view: "vca" | "form";
5
- status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
+ view: "form" | "vca";
5
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
8
8
  deposit: Deposit | null;
@@ -1,6 +1,6 @@
1
1
  export declare const QRPHDepositContext: (props: {
2
2
  value: {
3
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
3
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
4
4
  deposit: import("../../../../types").Deposit | null;
5
5
  errorMessage: {
6
6
  name: string;
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useQRPHDepositContext: () => {
16
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
16
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
17
17
  deposit: import("../../../../types").Deposit | null;
18
18
  errorMessage: {
19
19
  name: string;
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
5
5
  promo?: string | null;
6
6
  }
7
7
  export declare function useQRPHDeposit(): {
8
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
8
+ status: "idle" | "confirmed" | "failed" | "generating-qr-code" | "qr-code-generated";
9
9
  deposit: Deposit | null;
10
10
  errorMessage: {
11
11
  name: string;
@@ -61,6 +61,7 @@ const errorMap = {
61
61
  WithdrawalDailyLimitExceededError: 'You have exceeded your daily withdrawal limit. Please try again tomorrow.',
62
62
  MinimumFirstDepositAmountNotMetError: 'The minimum first deposit amount is not met. Please enter a valid amount.',
63
63
  FirstDepositRequiredError: 'First deposit is required before making a withdrawal.',
64
+ InsufficientAgentBalanceError: 'Insufficient agent balance. Please add funds to your account.',
64
65
  SYSTEM_ERROR: 'A system error occurred. Please try again.',
65
66
  };
66
67
  export function explainError(error) {
@@ -11,7 +11,9 @@ export const prefetchTopGamesQuery = cache(async (topGames) => {
11
11
  queryKey: ['top-games', ids],
12
12
  queryFn: async ({ signal }) => {
13
13
  const results = await Promise.all(ids.map((id) => getGamesv2__next(id, { signal })));
14
- return results.flatMap((res) => res.edges.map((edge) => edge.node));
14
+ return results
15
+ .flatMap((res) => res.edges.map((edge) => edge.node))
16
+ .filter((game) => game.status === 'ACTIVE' && game.hidden !== true);
15
17
  },
16
18
  })
17
19
  .catch(() => log.text("'prefetchTopGamesQuery' failed", 'error'));
@@ -158,7 +158,7 @@ export interface Announcement {
158
158
  }
159
159
  export type GameType = 'SLOTS' | 'SPORTS' | 'FISHING' | 'BINGO' | 'LIVE' | 'GAMES' | 'TABLE' | 'SPECIALTY' | 'NUMERICAL' | 'NUMERIC' | 'ARCADE';
160
160
  export type GameProvider = 'JILI' | 'JILI_BINGO' | 'PGSOFT' | 'FACHAI' | 'BTI' | 'DG' | 'PLAYTECH' | 'E2E' | 'ONEAPI_EVOLUTION' | 'EVOLUTION' | 'EVOLUTION_NETENT' | 'EVOLUTION_REDTIGER' | 'EVOLUTION_TAP_A_ROO' | 'MEGABALL' | 'MEGA2SPIN' | 'DARWIN' | 'RTG' | 'DRBINGO' | 'HOLLYWOODTV' | 'CQ9' | 'JDB' | 'HABANERO' | 'SPINIX' | 'JOKER' | 'HACKSAW' | 'JDBGTF' | 'JDBSPRIBE' | 'MICROGAMING' | 'RELAXGAMING' | 'EVOPLAY' | 'BOOONGO' | 'BGAMING' | 'KINGMAKER' | 'KINGMIDAS' | 'YELLOWBAT' | 'ETENGJUE' | 'SABA' | 'PRAGMATICPLAY' | 'SPRIBE' | 'EZUGI' | 'ALIZE' | 'DIGITAIN' | 'BNG' | 'NO_LIMIT_CITY' | 'BIG_TIME_GAMING' | 'SAGAMING' | 'ONEAPI_SPADEGAMING' | 'JK8' | 'RUBYPLAY' | 'EVOLUTIONNETENT' | 'TEST';
161
- export type GameStatus = 'ACTIVE' | 'INACTIVE';
161
+ export type GameStatus = 'ACTIVE' | 'INACTIVE' | 'HIDDEN';
162
162
  export type GameTag = 'HOT' | 'hot' | 'NEW' | 'new' | 'TOP' | 'top' | 'POPULAR' | 'popular' | (string & {});
163
163
  export interface Game {
164
164
  id: string;
@@ -178,6 +178,7 @@ export interface Game {
178
178
  dateTimeCreated: string;
179
179
  dateTimeLastUpdated: string;
180
180
  favorite: boolean;
181
+ hidden?: boolean;
181
182
  }
182
183
  export interface PlatformGame {
183
184
  id: string;