@opexa/portal-components 0.0.1018 → 0.0.1019

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.
@@ -94,6 +94,7 @@ export interface GlobalStore {
94
94
  bankInformationDetails: PopupStore;
95
95
  isNonRegulated: boolean;
96
96
  setIsNonRegulated: (isNonRegulated: boolean) => void;
97
+ reset: () => void;
97
98
  }
98
99
  export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<GlobalStore>, "setState" | "devtools"> & {
99
100
  setState(partial: GlobalStore | Partial<GlobalStore> | ((state: GlobalStore) => GlobalStore | Partial<GlobalStore>), replace?: false | undefined, action?: (string | {
@@ -509,4 +509,105 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
509
509
  ...state,
510
510
  isNonRegulated,
511
511
  })),
512
+ reset: () => {
513
+ set((state) => ({
514
+ ...state,
515
+ signUp: { ...state.signUp, open: false, '~touched': false },
516
+ signIn: { ...state.signIn, open: false, '~touched': false },
517
+ forgotPassword: {
518
+ ...state.forgotPassword,
519
+ open: false,
520
+ '~touched': false,
521
+ },
522
+ disclaimer: { ...state.disclaimer, open: false, '~touched': false },
523
+ depositWithdrawal: {
524
+ ...state.depositWithdrawal,
525
+ open: false,
526
+ '~touched': false,
527
+ },
528
+ gameLaunch: { ...state.gameLaunch, details: { status: 'WAITING' } },
529
+ search: { ...state.search, open: false, '~touched': false },
530
+ account: { ...state.account, open: false, '~touched': false },
531
+ account__mobile: {
532
+ ...state.account__mobile,
533
+ open: false,
534
+ '~touched': false,
535
+ },
536
+ messages: { ...state.messages, open: false, '~touched': false },
537
+ message: { ...state.message, open: false, '~touched': false },
538
+ sidebar: { ...state.sidebar, open: true, '~touched': false },
539
+ sidebar__mobile: {
540
+ ...state.sidebar__mobile,
541
+ open: false,
542
+ '~touched': false,
543
+ },
544
+ kyc: { ...state.kyc, open: false, '~touched': false },
545
+ kycReminder: { ...state.kycReminder, open: false, '~touched': false },
546
+ updateMobilePhoneNumber: {
547
+ ...state.updateMobilePhoneNumber,
548
+ open: false,
549
+ '~touched': false,
550
+ },
551
+ spotBonus: { ...state.spotBonus, open: false, '~touched': false },
552
+ registerBiometrics: {
553
+ ...state.registerBiometrics,
554
+ open: false,
555
+ '~touched': false,
556
+ },
557
+ termsAndConditions: {
558
+ ...state.termsAndConditions,
559
+ open: false,
560
+ accepted: false,
561
+ next: null,
562
+ '~touched': false,
563
+ },
564
+ termsOfUse: {
565
+ ...state.termsOfUse,
566
+ open: false,
567
+ accepted: false,
568
+ next: null,
569
+ '~touched': false,
570
+ },
571
+ responsibleGaming: {
572
+ ...state.responsibleGaming,
573
+ open: false,
574
+ accepted: false,
575
+ next: null,
576
+ '~touched': false,
577
+ },
578
+ onboarding: {
579
+ ...state.onboarding,
580
+ open: false,
581
+ accepted: false,
582
+ next: null,
583
+ '~touched': false,
584
+ },
585
+ responsibleGamingReminder: {
586
+ ...state.responsibleGamingReminder,
587
+ open: false,
588
+ '~touched': false,
589
+ },
590
+ pendingBonus: {
591
+ ...state.pendingBonus,
592
+ open: false,
593
+ '~touched': false,
594
+ shouldShowWarning: false,
595
+ },
596
+ kycVerificationStatus: {
597
+ ...state.kycVerificationStatus,
598
+ open: false,
599
+ '~touched': false,
600
+ },
601
+ kycAccountVerificationRequired: {
602
+ ...state.kycAccountVerificationRequired,
603
+ open: false,
604
+ '~touched': false,
605
+ },
606
+ bankInformationDetails: {
607
+ ...state.bankInformationDetails,
608
+ open: false,
609
+ '~touched': false,
610
+ },
611
+ }));
612
+ },
512
613
  }))));
@@ -3,14 +3,17 @@ import { getQueryClient } from '../../utils/getQueryClient.js';
3
3
  import { getSignOutMutationKey } from '../../utils/mutationKeys.js';
4
4
  import { getSessionQueryKey } from '../../utils/queryKeys.js';
5
5
  import { signOut } from '../services/signOut.js';
6
+ import { useGlobalStore } from './useGlobalStore.js';
6
7
  const IDLE_TIMESTAMP_KEY = 'idle-logout-timestamp';
7
8
  export const useSignOutMutation = (config) => {
8
9
  const queryClient = getQueryClient();
10
+ const reset = useGlobalStore((state) => state.reset);
9
11
  return useMutation({
10
12
  ...config,
11
13
  mutationKey: getSignOutMutationKey(),
12
14
  mutationFn: async () => {
13
15
  await signOut();
16
+ reset();
14
17
  await queryClient.invalidateQueries({ queryKey: getSessionQueryKey() });
15
18
  queryClient.removeQueries();
16
19
  localStorage.removeItem(IDLE_TIMESTAMP_KEY);
@@ -14,11 +14,13 @@ export function SessionWatcher() {
14
14
  enabled: sessionQuery.data?.status === 'authenticated',
15
15
  refetchInterval: 1000 * 5,
16
16
  });
17
- const { gameLaunch } = useGlobalStore(useShallow((ctx) => ({
17
+ const { gameLaunch, reset } = useGlobalStore(useShallow((ctx) => ({
18
18
  gameLaunch: ctx.gameLaunch,
19
+ reset: ctx.reset,
19
20
  })));
20
21
  const signOutMutation = useSignOutMutation({
21
22
  onSuccess() {
23
+ reset();
22
24
  if (gameLaunch.details.status === 'PLAYING') {
23
25
  gameLaunch.setDetails({
24
26
  status: 'WAITING',
@@ -21,8 +21,9 @@ export function TermsOfUseV2({ logo, content }) {
21
21
  responsibleGaming: ctx.responsibleGaming,
22
22
  kycVerificationRequired: ctx.kyc,
23
23
  })));
24
+ const isOpen = globalStore.termsOfUse.open;
24
25
  useEffect(() => {
25
- if (scrollableContentRef.current) {
26
+ if (isOpen && scrollableContentRef.current) {
26
27
  const { scrollHeight, clientHeight } = scrollableContentRef.current;
27
28
  const isScrollable = scrollHeight > clientHeight;
28
29
  const atBottom = scrollHeight - scrollableContentRef.current.scrollTop <=
@@ -30,8 +31,12 @@ export function TermsOfUseV2({ logo, content }) {
30
31
  setIsAtBottom(!isScrollable || atBottom);
31
32
  setHasReachedBottom(!isScrollable || atBottom);
32
33
  }
33
- }, []);
34
- return (_jsx(Dialog.Root, { open: globalStore.termsOfUse.open, onOpenChange: (details) => {
34
+ if (!isOpen) {
35
+ setIsAtBottom(false);
36
+ setHasReachedBottom(false);
37
+ }
38
+ }, [isOpen]);
39
+ return (_jsx(Dialog.Root, { open: isOpen, onOpenChange: (details) => {
35
40
  globalStore.termsOfUse.setOpen(details.open);
36
41
  if (!details.open) {
37
42
  globalStore.termsOfUse.setAccepted(true);
@@ -21,8 +21,9 @@ export function TermsOfUseV3({ logo, content }) {
21
21
  termsOfUse: ctx.termsOfUse,
22
22
  responsibleGaming: ctx.responsibleGaming,
23
23
  })));
24
+ const isOpen = globalStore.termsOfUse.open;
24
25
  useEffect(() => {
25
- if (scrollableContentRef.current) {
26
+ if (isOpen && scrollableContentRef.current) {
26
27
  const { scrollHeight, clientHeight } = scrollableContentRef.current;
27
28
  const isScrollable = scrollHeight > clientHeight;
28
29
  const atBottom = scrollHeight - scrollableContentRef.current.scrollTop <=
@@ -30,7 +31,11 @@ export function TermsOfUseV3({ logo, content }) {
30
31
  setIsAtBottom(!isScrollable || atBottom);
31
32
  setHasReachedBottom(!isScrollable || atBottom);
32
33
  }
33
- }, []);
34
+ if (!isOpen) {
35
+ setIsAtBottom(false);
36
+ setHasReachedBottom(false);
37
+ }
38
+ }, [isOpen]);
34
39
  return (_jsx(Dialog.Root, { open: globalStore.termsOfUse.open, onOpenChange: (details) => {
35
40
  globalStore.termsOfUse.setOpen(details.open);
36
41
  if (!details.open) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1018",
3
+ "version": "0.0.1019",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",