@opexa/portal-components 0.1.23 → 0.1.24

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.
@@ -64,6 +64,19 @@ export interface HasPendingBonusStore {
64
64
  shouldShowWarning: boolean;
65
65
  setShouldShowWarning: (shouldShow: boolean) => void;
66
66
  }
67
+ export type LimitType = 'bet' | 'deposit';
68
+ export type LimitPeriod = 'daily' | 'monthly';
69
+ export interface BetDepositLimitStore extends PopupStore {
70
+ type: LimitType;
71
+ setType: (type: LimitType) => void;
72
+ period: LimitPeriod;
73
+ setPeriod: (period: LimitPeriod) => void;
74
+ currentLimit: number;
75
+ setCurrentLimit: (limit: number) => void;
76
+ requestedLimit: number;
77
+ setRequestedLimit: (limit: number) => void;
78
+ openModal: (type: LimitType, period: LimitPeriod, currentLimit: number, requestedLimit: number) => void;
79
+ }
67
80
  export interface GlobalStore {
68
81
  signUp: PopupStore;
69
82
  signIn: PopupStore;
@@ -89,6 +102,7 @@ export interface GlobalStore {
89
102
  onboarding: OnboardingStore;
90
103
  responsibleGamingReminder: ResponsibleGamingReminderStore;
91
104
  pendingBonus: HasPendingBonusStore;
105
+ betDepositLimit: BetDepositLimitStore;
92
106
  kycVerificationStatus: PopupStore;
93
107
  kycAccountVerificationRequired: PopupStore;
94
108
  bankInformationDetails: PopupStore;
@@ -123,4 +137,12 @@ export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<Omit<i
123
137
  } | undefined): () => void;
124
138
  };
125
139
  }>;
140
+ export declare const betDepositLimitStore: {
141
+ isOpen: boolean;
142
+ type: LimitType;
143
+ period: LimitPeriod;
144
+ currentLimit: number;
145
+ requestedLimit: number;
146
+ openModal(newType: LimitType, newPeriod: LimitPeriod, currentLimit: number, requestedLimit: number): void;
147
+ };
126
148
  export {};
@@ -504,6 +504,68 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
504
504
  })),
505
505
  '~touched': false,
506
506
  },
507
+ betDepositLimit: {
508
+ open: false,
509
+ setOpen(open) {
510
+ set((prev) => ({
511
+ betDepositLimit: {
512
+ ...prev.betDepositLimit,
513
+ open,
514
+ '~touched': true,
515
+ },
516
+ }));
517
+ },
518
+ '~touched': false,
519
+ type: 'bet',
520
+ setType(type) {
521
+ set((prev) => ({
522
+ betDepositLimit: {
523
+ ...prev.betDepositLimit,
524
+ type,
525
+ },
526
+ }));
527
+ },
528
+ period: 'daily',
529
+ setPeriod(period) {
530
+ set((prev) => ({
531
+ betDepositLimit: {
532
+ ...prev.betDepositLimit,
533
+ period,
534
+ },
535
+ }));
536
+ },
537
+ currentLimit: 0,
538
+ setCurrentLimit(currentLimit) {
539
+ set((prev) => ({
540
+ betDepositLimit: {
541
+ ...prev.betDepositLimit,
542
+ currentLimit,
543
+ },
544
+ }));
545
+ },
546
+ requestedLimit: 0,
547
+ setRequestedLimit(requestedLimit) {
548
+ set((prev) => ({
549
+ betDepositLimit: {
550
+ ...prev.betDepositLimit,
551
+ requestedLimit,
552
+ },
553
+ }));
554
+ },
555
+ openModal(type, period, currentLimit, requestedLimit) {
556
+ set((prev) => ({
557
+ betDepositLimit: {
558
+ ...prev.betDepositLimit,
559
+ type,
560
+ period,
561
+ currentLimit,
562
+ requestedLimit,
563
+ open: true,
564
+ '~touched': true,
565
+ },
566
+ }));
567
+ },
568
+ },
507
569
  isNonRegulated: false,
508
570
  setIsNonRegulated: (isNonRegulated) => set((state) => ({
509
571
  ...state,
@@ -598,6 +660,15 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
598
660
  '~touched': false,
599
661
  shouldShowWarning: false,
600
662
  },
663
+ betDepositLimit: {
664
+ ...state.betDepositLimit,
665
+ open: false,
666
+ '~touched': false,
667
+ type: 'bet',
668
+ period: 'daily',
669
+ currentLimit: 0,
670
+ requestedLimit: 0,
671
+ },
601
672
  kycVerificationStatus: {
602
673
  ...state.kycVerificationStatus,
603
674
  open: false,
@@ -617,3 +688,40 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
617
688
  }));
618
689
  },
619
690
  }))));
691
+ export const betDepositLimitStore = {
692
+ get isOpen() {
693
+ return useGlobalStore.getState().betDepositLimit.open;
694
+ },
695
+ set isOpen(value) {
696
+ useGlobalStore.getState().betDepositLimit.setOpen(value);
697
+ },
698
+ get type() {
699
+ return useGlobalStore.getState().betDepositLimit.type;
700
+ },
701
+ set type(value) {
702
+ useGlobalStore.getState().betDepositLimit.setType(value);
703
+ },
704
+ get period() {
705
+ return useGlobalStore.getState().betDepositLimit.period;
706
+ },
707
+ set period(value) {
708
+ useGlobalStore.getState().betDepositLimit.setPeriod(value);
709
+ },
710
+ get currentLimit() {
711
+ return useGlobalStore.getState().betDepositLimit.currentLimit;
712
+ },
713
+ set currentLimit(value) {
714
+ useGlobalStore.getState().betDepositLimit.setCurrentLimit(value);
715
+ },
716
+ get requestedLimit() {
717
+ return useGlobalStore.getState().betDepositLimit.requestedLimit;
718
+ },
719
+ set requestedLimit(value) {
720
+ useGlobalStore.getState().betDepositLimit.setRequestedLimit(value);
721
+ },
722
+ openModal(newType, newPeriod, currentLimit, requestedLimit) {
723
+ useGlobalStore
724
+ .getState()
725
+ .betDepositLimit.openModal(newType, newPeriod, currentLimit, requestedLimit);
726
+ },
727
+ };
@@ -7,16 +7,16 @@ import { XIcon } from '../../icons/XIcon.js';
7
7
  import { Button } from '../../ui/Button/index.js';
8
8
  import { Dialog } from '../../ui/Dialog/index.js';
9
9
  import { Portal } from '../../ui/Portal/index.js';
10
- import { useBetDepositLimitStore } from './betDepositLimitStore.js';
10
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
11
11
  export function BetDepositLimitModal({ onConfirm }) {
12
12
  const { enabled } = useFeatureFlag();
13
- const { isOpen, type, period, currentLimit, requestedLimit, setIsOpen } = useBetDepositLimitStore(useShallow((state) => ({
14
- isOpen: state.isOpen,
15
- type: state.type,
16
- period: state.period,
17
- currentLimit: state.currentLimit,
18
- requestedLimit: state.requestedLimit,
19
- setIsOpen: state.setIsOpen,
13
+ const { open, type, period, currentLimit, requestedLimit, setOpen } = useGlobalStore(useShallow((state) => ({
14
+ open: state.betDepositLimit.open,
15
+ type: state.betDepositLimit.type,
16
+ period: state.betDepositLimit.period,
17
+ currentLimit: state.betDepositLimit.currentLimit,
18
+ requestedLimit: state.betDepositLimit.requestedLimit,
19
+ setOpen: state.betDepositLimit.setOpen,
20
20
  })));
21
21
  const isIncrease = requestedLimit > currentLimit;
22
22
  const changeAmount = Math.abs(requestedLimit - currentLimit);
@@ -38,12 +38,12 @@ export function BetDepositLimitModal({ onConfirm }) {
38
38
  return `Your ${period} ${type} limit has been lowered and is now active.`;
39
39
  };
40
40
  const handleConfirm = () => {
41
- setIsOpen(false);
41
+ setOpen(false);
42
42
  if (onConfirm) {
43
43
  onConfirm();
44
44
  }
45
45
  };
46
- return (_jsx(Dialog.Root, { open: isOpen && enabled, onOpenChange: (details) => {
47
- setIsOpen(details.open);
46
+ return (_jsx(Dialog.Root, { open: open && enabled, onOpenChange: (details) => {
47
+ setOpen(details.open);
48
48
  }, closeOnInteractOutside: false, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+3)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+4)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto max-h-[90vh] min-w-[21.438rem] max-w-[21.438rem] overflow-y-auto rounded-xl p-3xl lg:min-w-[25rem] lg:max-w-[25rem]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary", children: _jsx(AlertTriangleIcon, { className: "size-6 text-text-brand-700" }) }), _jsx("h2", { className: "mt-lg text-center font-semibold text-lg text-text-primary-900 xl:mt-xl", children: title }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700 leading-relaxed", children: getDescription() }), _jsxs("div", { className: "mt-lg flex w-full select-none flex-col gap-y-2 rounded-xl border border-border-primary bg-bg-secondary px-5 py-4 text-sm", children: [_jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Current limit:' : 'Previous limit:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(currentLimit) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Requested limit:' : 'New limit:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(requestedLimit) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Increase amount:' : 'Decrease amount:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: formatPeso(changeAmount) })] }), _jsxs("div", { className: "flex justify-between py-0.5", children: [_jsx("span", { className: "text-text-tertiary-600", children: isIncrease ? 'Status:' : 'Effective:' }), _jsx("span", { className: "font-semibold text-text-primary-900", children: isIncrease ? 'Pending Approval' : 'Immediately' })] })] }), _jsx("div", { className: "mt-3xl flex w-full flex-col gap-2 text-center lg:mt-4xl", children: _jsx(Button, { className: "w-full", onClick: handleConfirm, type: "button", children: "Confirm" }) })] })] }) })] }) }));
49
49
  }
@@ -1,4 +1,4 @@
1
- import type { LimitPeriod, LimitType } from './betDepositLimitStore';
1
+ import type { LimitPeriod, LimitType } from '../../client/hooks/useGlobalStore';
2
2
  export interface DepositLimitReachedProps {
3
3
  type: LimitType;
4
4
  period: LimitPeriod;
@@ -1,3 +1,3 @@
1
1
  export * from './BetDepositLimitModal';
2
- export * from './betDepositLimitStore';
3
2
  export * from './DepositLimitReached';
3
+ export { betDepositLimitStore, type BetDepositLimitStore, type LimitPeriod, type LimitType, } from '../../client/hooks/useGlobalStore';
@@ -1,3 +1,3 @@
1
1
  export * from './BetDepositLimitModal.js';
2
- export * from './betDepositLimitStore.js';
3
2
  export * from './DepositLimitReached.js';
3
+ export { betDepositLimitStore, } from '../../client/hooks/useGlobalStore.js';
@@ -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,4 +1,4 @@
1
- import type { LimitPeriod, LimitType } from '../BetDepositLimit/betDepositLimitStore';
1
+ import type { LimitPeriod, LimitType } from '../../client/hooks/useGlobalStore';
2
2
  import type { DepositWithdrawalProps } from './DepositWithdrawal.lazy';
3
3
  export interface DepositWithdrawalContextType extends DepositWithdrawalProps {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",