@opexa/portal-components 0.0.1081 → 0.0.1083

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,8 @@ export interface GlobalStore {
94
94
  bankInformationDetails: PopupStore;
95
95
  isNonRegulated: boolean;
96
96
  setIsNonRegulated: (isNonRegulated: boolean) => void;
97
+ firstTimeSignUp: boolean;
98
+ setFirstTimeSignUp: (firstTimeSignUp: boolean) => void;
97
99
  reset: () => void;
98
100
  }
99
101
  export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<GlobalStore>, "setState" | "devtools"> & {
@@ -509,6 +509,11 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
509
509
  ...state,
510
510
  isNonRegulated,
511
511
  })),
512
+ firstTimeSignUp: false,
513
+ setFirstTimeSignUp: (firstTimeSignUp) => set((state) => ({
514
+ ...state,
515
+ firstTimeSignUp,
516
+ })),
512
517
  reset: () => {
513
518
  set((state) => ({
514
519
  ...state,
@@ -608,6 +613,7 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
608
613
  open: false,
609
614
  '~touched': false,
610
615
  },
616
+ firstTimeSignUp: false,
611
617
  }));
612
618
  },
613
619
  }))));
@@ -111,6 +111,9 @@ export function PersonalInformation() {
111
111
  kyc: ctx.kyc,
112
112
  kycReminder: ctx.kycReminder,
113
113
  kycAccountVerificationRequired: ctx.kycAccountVerificationRequired,
114
+ disclaimer: ctx.disclaimer,
115
+ firstTimeSignUp: ctx.firstTimeSignUp,
116
+ setFirstTimeSignUp: ctx.setFirstTimeSignUp,
114
117
  })));
115
118
  const memberVerificationQuery = useMemberVerificationQuery();
116
119
  const memberVerificationId = memberVerificationQuery.data?.id;
@@ -158,6 +161,10 @@ export function PersonalInformation() {
158
161
  if (accountQuery.data?.status === 'VERIFICATION_LOCKED') {
159
162
  globalStore.kycReminder.setOpen(true);
160
163
  }
164
+ if (globalStore.firstTimeSignUp) {
165
+ globalStore.disclaimer.setOpen(true);
166
+ globalStore.setFirstTimeSignUp(false);
167
+ }
161
168
  toaster.success({
162
169
  title: 'Success',
163
170
  description: 'Personal information has been set successfully.',
@@ -38,6 +38,7 @@ export function MessagesPopup() {
38
38
  responsibleGamingReminder: ctx.responsibleGamingReminder,
39
39
  signIn: ctx.signIn,
40
40
  signUp: ctx.signUp,
41
+ disclaimer: ctx.disclaimer,
41
42
  })));
42
43
  const markMessageAsReadMutation = useMarkMessageAsReadMutation();
43
44
  const accountQuery = useAccountQuery();
@@ -86,8 +87,9 @@ export function MessagesPopup() {
86
87
  !globalStore.account__mobile.open &&
87
88
  !globalStore.kyc.open &&
88
89
  !globalStore.kycReminder.open &&
89
- !globalStore.responsibleGamingReminder.open,
90
- refetchInterval: disclosure.open ? undefined : 1000 * 10,
90
+ !globalStore.responsibleGamingReminder.open &&
91
+ !globalStore.disclaimer.open,
92
+ refetchInterval: disclosure.open ? undefined : 2000 * 10,
91
93
  });
92
94
  const messages = messagesQuery.data?.pages.flatMap((page) => page.edges
93
95
  .filter((edge) => globalStore.gameLaunch.details.status === 'PLAYING'
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { endOfDay as getEndOfDay } from 'date-fns';
2
3
  import { isString } from 'lodash-es';
3
4
  import dynamic from 'next/dynamic';
4
5
  import Link from 'next/link';
@@ -10,6 +11,7 @@ import { useDisclosure } from '../../client/hooks/useDisclosure.js';
10
11
  import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
11
12
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
12
13
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
14
+ import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
13
15
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
14
16
  import { CheckIcon } from '../../icons/CheckIcon.js';
15
17
  import { CoinsHandIcon } from '../../icons/CoinsHandIcon.js';
@@ -132,13 +134,16 @@ function Rules(props) {
132
134
  return false;
133
135
  return milestones.every((milestone) => milestone.isCompleted);
134
136
  }, [milestones]);
135
- const isExpired = useMemo(() => {
136
- if (!quest?.daysToClear || !quest?.dateTimeCreated)
137
- return false;
138
- const targetDateTime = new Date(quest.dateTimeCreated);
139
- targetDateTime.setDate(targetDateTime.getDate() + Number(quest.daysToClear));
140
- return new Date() > targetDateTime;
137
+ //prevent members to perform actions after the quest has expired
138
+ const targetDateTime = useMemo(() => {
139
+ if (!quest?.dateTimeCreated)
140
+ return null;
141
+ const date = new Date(quest.dateTimeCreated);
142
+ date.setDate(date.getDate() + Number(quest?.daysToClear ?? 0));
143
+ return getEndOfDay(date);
141
144
  }, [quest?.dateTimeCreated, quest?.daysToClear]);
145
+ const remainingTime = useRemainingTime(targetDateTime ?? new Date());
146
+ const isExpired = quest?.status === 'FAILED' || remainingTime.expired;
142
147
  const sessionQuery = useSessionQuery();
143
148
  const session = sessionQuery.data;
144
149
  return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center p-4", children: _jsxs(Dialog.Content, { className: twMerge('mx-auto max-h-[80vh] min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-10 md:scrollbar:h-2 md:scrollbar:w-2 md:scrollbar-thumb:rounded-full md:scrollbar-thumb:bg-bg-quaternary md:scrollbar-track:bg-transparent', props.className?.root), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: twMerge('font-semibold text-lg text-text-primary-900', props.className?.title), children: quest?.name || 'Quest' }), _jsx("div", { className: "relative", children: _jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
@@ -61,6 +61,7 @@ export function SignUpDefaultForm() {
61
61
  responsibleGaming: ctx.responsibleGaming,
62
62
  kyc: ctx.kyc,
63
63
  termsOfUse: ctx.termsOfUse,
64
+ setFirstTimeSignUp: ctx.setFirstTimeSignUp,
64
65
  })));
65
66
  const search = useSearchParams();
66
67
  const signUpMutation = useSignUpMutation();
@@ -338,6 +339,7 @@ export function SignUpDefaultForm() {
338
339
  return;
339
340
  }
340
341
  globalStore.signUp.setOpen(false);
342
+ globalStore.setFirstTimeSignUp(true);
341
343
  step1Form.reset();
342
344
  step2Form.reset();
343
345
  setStep(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1081",
3
+ "version": "0.0.1083",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",