@opexa/portal-components 0.0.470 → 0.0.472

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 (69) hide show
  1. package/dist/client/hooks/useMayaAuth.d.ts +0 -1
  2. package/dist/client/hooks/useMayaAuth.js +5 -26
  3. package/dist/components/AccountInfo/GoogleDisconnect.d.ts +7 -0
  4. package/dist/components/AccountInfo/GoogleDisconnect.js +11 -0
  5. package/dist/components/Maya/Maya.js +6 -3
  6. package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
  7. package/dist/icons/LinkBrokenIcon.d.ts +2 -0
  8. package/dist/icons/LinkBrokenIcon.js +4 -0
  9. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  10. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  11. package/dist/ui/Badge/Badge.d.ts +12 -12
  12. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  13. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  14. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  15. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  16. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  17. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  18. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  19. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  20. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  21. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  22. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  23. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  24. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  25. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  26. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  27. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  28. package/dist/ui/Field/Field.d.ts +21 -21
  29. package/dist/ui/Field/field.recipe.d.ts +3 -3
  30. package/dist/ui/Menu/Menu.d.ts +252 -252
  31. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  32. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  33. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  34. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  35. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  36. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  37. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  38. package/dist/ui/Popover/Popover.d.ts +55 -55
  39. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  40. package/dist/ui/Progress/Progress.d.ts +27 -27
  41. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  42. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  43. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  44. package/dist/ui/Select/Select.d.ts +45 -45
  45. package/dist/ui/Select/select.recipe.d.ts +3 -3
  46. package/dist/ui/Table/Table.d.ts +21 -21
  47. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  48. package/dist/ui/Table/table.recipe.d.ts +3 -3
  49. package/package.json +1 -1
  50. package/dist/components/Banner/Banner.client.d.ts +0 -12
  51. package/dist/components/Banner/Banner.client.js +0 -49
  52. package/dist/components/SignIn/utils.d.ts +0 -8
  53. package/dist/components/SignIn/utils.js +0 -26
  54. package/dist/constants/Branches.d.ts +0 -2
  55. package/dist/constants/Branches.js +0 -42
  56. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
  57. package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
  58. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  59. package/dist/third-parties/FacebookPixel/api.js +0 -1
  60. package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
  61. package/dist/third-parties/FacebookPixel/index.js +0 -1
  62. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
  63. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
  64. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  65. package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
  66. package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
  67. package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
  68. package/dist/third-parties/index.d.ts +0 -2
  69. package/dist/third-parties/index.js +0 -2
@@ -1,6 +1,5 @@
1
1
  export declare function useMayaAuth(): {
2
2
  onMaya: boolean;
3
3
  setOnMaya: (value: boolean) => void;
4
- mayaKey: string;
5
4
  mayaSessIdKey: string;
6
5
  };
@@ -1,35 +1,15 @@
1
1
  import { useCallback, useEffect, useState } from 'react';
2
- const mayaKey = 'maya';
3
2
  const mayaSessIdKey = 'mayaSessionId';
4
3
  export function useMayaAuth() {
5
- const [onMaya, setOnMayaState] = useState(() => {
6
- // Initialize from localStorage on mount
7
- if (typeof window !== 'undefined') {
8
- return !!localStorage.getItem(mayaKey);
9
- }
10
- return false;
11
- });
12
- // Handle onMaya with localStorage sync
4
+ const [onMaya, setOnMayaState] = useState(false);
13
5
  const setOnMaya = useCallback((value) => {
14
- if (value) {
15
- setOnMayaState(true);
16
- if (typeof window !== 'undefined') {
17
- localStorage.setItem(mayaKey, '');
18
- }
19
- }
20
- else {
21
- setOnMayaState(false);
22
- if (typeof window !== 'undefined') {
23
- localStorage.removeItem(mayaKey);
24
- }
25
- }
6
+ setOnMayaState(value);
26
7
  }, []);
27
- // Listen for localStorage changes (multi-tab support)
28
8
  useEffect(() => {
29
- if (typeof window === 'undefined')
30
- return;
9
+ const initialValue = !!localStorage.getItem(mayaSessIdKey);
10
+ setOnMayaState(initialValue);
31
11
  const handleStorageChange = () => {
32
- setOnMayaState(!!localStorage.getItem(mayaKey));
12
+ setOnMayaState(!!localStorage.getItem(mayaSessIdKey));
33
13
  };
34
14
  window.addEventListener('storage', handleStorageChange);
35
15
  return () => window.removeEventListener('storage', handleStorageChange);
@@ -37,7 +17,6 @@ export function useMayaAuth() {
37
17
  return {
38
18
  onMaya,
39
19
  setOnMaya,
40
- mayaKey,
41
20
  mayaSessIdKey,
42
21
  };
43
22
  }
@@ -0,0 +1,7 @@
1
+ import { type UseDisclosureReturn } from '../../client/hooks/useDisclosure';
2
+ interface GoogleDisconnectProps {
3
+ onConfirmAction?: (ctx: UseDisclosureReturn) => React.ReactNode;
4
+ children?: (ctx: UseDisclosureReturn) => React.ReactNode;
5
+ }
6
+ export declare function GoogleDisconnect(props: GoogleDisconnectProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useDisclosure, } from '../../client/hooks/useDisclosure.js';
4
+ import { LinkBrokenIcon } from '../../icons/LinkBrokenIcon.js';
5
+ import { XIcon } from '../../icons/XIcon.js';
6
+ import { Dialog } from '../../ui/Dialog/index.js';
7
+ import { Portal } from '../../ui/Portal/index.js';
8
+ export function GoogleDisconnect(props) {
9
+ const disclosure = useDisclosure();
10
+ return (_jsxs(_Fragment, { children: [props.children?.(disclosure), _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: disclosure.open, onOpenChange: (details) => disclosure.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", children: _jsxs(Dialog.Content, { className: "mx-auto min-h-auto max-w-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBrokenIcon, {}) }), _jsx("h2", { className: "mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx("p", { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx("div", { className: "pt-6", children: props.onConfirmAction?.(disclosure) })] }) })] }) })] }));
11
+ }
@@ -18,7 +18,7 @@ export function Maya({ logo, responsibleGamingLogo, pagcorLogo, banner, classNam
18
18
  const searchParams = useSearchParams();
19
19
  const [progress, setProgress] = useState(0);
20
20
  const [complete, setComplete] = useState(false);
21
- const { setOnMaya, mayaSessIdKey } = useMayaAuth();
21
+ const { mayaSessIdKey } = useMayaAuth();
22
22
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
23
23
  const session = useSessionQuery();
24
24
  const mayaSessionId = searchParams.get('sessionId');
@@ -70,7 +70,8 @@ export function Maya({ logo, responsibleGamingLogo, pagcorLogo, banner, classNam
70
70
  if (mayaSessionId) {
71
71
  localStorage.setItem(mayaSessIdKey, mayaSessionId);
72
72
  }
73
- setOnMaya(true);
73
+ // Wait briefly to ensure localStorage is flushed before navigation.
74
+ await new Promise((resolve) => setTimeout(resolve, 50));
74
75
  router.replace('/');
75
76
  }
76
77
  catch (error) {
@@ -83,5 +84,7 @@ export function Maya({ logo, responsibleGamingLogo, pagcorLogo, banner, classNam
83
84
  };
84
85
  runInit();
85
86
  }, []);
86
- return (_jsxs("div", { className: twMerge('relative flex min-h-screen flex-col bg-[#1F1F1F]', classNames.root), children: [banner && (_jsx(Image, { src: banner, alt: "brand logo", fill: true, className: twMerge('w-full grow object-contain object-top', classNames.banner) })), _jsxs("div", { className: twMerge('absolute bottom-0 w-full shrink-0 bg-[#1F1F1F] p-6', classNames.progressRoot), children: [_jsxs("div", { children: [_jsx(Image, { src: logo, alt: "brand logo", height: 50, width: 120, className: twMerge('mx-auto mb-5 h-12.5 w-auto', classNames.logo) }), _jsx("div", { className: twMerge('overflow-hidden rounded-full p-px', !complete && (classNames.progressTrackIncompleteBG ?? 'bg-[#373A41]'), complete && (classNames.progressTrackCompleteBG ?? 'bg-[#ffb300]'), classNames.progressTrack), id: "progress:root", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": progress, "aria-labelledby": "progress:label", children: _jsx("div", { className: twMerge('rounded-full bg-[#1F1F1F] p-px', classNames.progressTrackOuter), children: _jsx("div", { className: twMerge('relative h-4 w-full overflow-hidden rounded-full bg-[#22262e]', classNames.progressTrackInner), children: _jsx("div", { className: twMerge('absolute left-0 h-full rounded-full bg-[#ffb300] transition-all duration-150', classNames.progressBar), style: { width: `${progress}%` } }) }) }) }), _jsxs("span", { id: "progress:label", className: twMerge('mt-3 block text-center text-[#CECFD2] text-sm', classNames.progressLabel), children: [progress, "% Loading..."] })] }), _jsxs("div", { className: twMerge('mt-7 flex items-center justify-center gap-2 text-[#94969C] text-xs', classNames.licensedBy), children: [_jsx("span", { children: "Officially Licensed by" }), _jsx(Image, { src: pagcorLogo ?? pagcorLogoDefault, alt: "PAGCOR logo", height: 43, width: 88, className: twMerge('h-[43px] w-auto shrink-0', classNames.pagcorLogo), draggable: false, unoptimized: true }), _jsx(Image, { src: responsibleGamingLogo ?? responsibleGamingLogoDefault, alt: "Responsible Gaming logo", height: 50, width: 186, className: twMerge('h-[50px] w-auto shrink-0', classNames.responsibleGamingLogo), draggable: false, unoptimized: true })] })] })] }));
87
+ return (_jsxs("div", { className: twMerge('relative flex min-h-screen flex-col bg-[#1F1F1F]', classNames.root), children: [banner && (_jsx(Image, { src: banner, alt: "brand logo", fill: true, className: twMerge('w-full grow object-contain object-top', classNames.banner) })), _jsxs("div", { className: twMerge('absolute bottom-0 w-full shrink-0 bg-[#1F1F1F] p-6', classNames.progressRoot), children: [_jsxs("div", { children: [_jsx(Image, { src: logo, alt: "brand logo", height: 50, width: 120, className: twMerge('mx-auto mb-5 h-12.5 w-auto', classNames.logo) }), _jsx("div", { className: twMerge('overflow-hidden rounded-full p-px', !complete &&
88
+ (classNames.progressTrackIncompleteBG ?? 'bg-[#373A41]'), complete &&
89
+ (classNames.progressTrackCompleteBG ?? 'bg-[#ffb300]'), classNames.progressTrack), id: "progress:root", role: "progressbar", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": progress, "aria-labelledby": "progress:label", children: _jsx("div", { className: twMerge('rounded-full bg-[#1F1F1F] p-px', classNames.progressTrackOuter), children: _jsx("div", { className: twMerge('relative h-4 w-full overflow-hidden rounded-full bg-[#22262e]', classNames.progressTrackInner), children: _jsx("div", { className: twMerge('absolute left-0 h-full rounded-full bg-[#ffb300] transition-all duration-150', classNames.progressBar), style: { width: `${progress}%` } }) }) }) }), _jsxs("span", { id: "progress:label", className: twMerge('mt-3 block text-center text-[#CECFD2] text-sm', classNames.progressLabel), children: [progress, "% Loading..."] })] }), _jsxs("div", { className: twMerge('mt-7 flex items-center justify-center gap-2 text-[#94969C] text-xs', classNames.licensedBy), children: [_jsx("span", { children: "Officially Licensed by" }), _jsx(Image, { src: pagcorLogo ?? pagcorLogoDefault, alt: "PAGCOR logo", height: 43, width: 88, className: twMerge('h-[43px] w-auto shrink-0', classNames.pagcorLogo), draggable: false, unoptimized: true }), _jsx(Image, { src: responsibleGamingLogo ?? responsibleGamingLogoDefault, alt: "Responsible Gaming logo", height: 50, width: 186, className: twMerge('h-[50px] w-auto shrink-0', classNames.responsibleGamingLogo), draggable: false, unoptimized: true })] })] })] }));
87
90
  }
@@ -1,30 +1,30 @@
1
1
  'use client';
2
2
  import { addHours } from 'date-fns';
3
3
  import { clamp } from 'lodash-es';
4
+ import { useSearchParams } from 'next/navigation';
4
5
  import { useLocalStorage, useTimeout } from 'usehooks-ts';
5
6
  import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
6
7
  export function CXDTokenObserver() {
7
- const { data: account } = useAccountQuery();
8
- const accountCxd = {
9
- cxd: account?.cellxpertDetails?.cxd,
10
- };
11
- const [cxd, setCxd, removeCxd] = useLocalStorage('cxd', null);
8
+ const searchParams = useSearchParams();
9
+ const cxdToken = searchParams.get('cxd');
10
+ const accountQuery = useAccountQuery();
11
+ const account = accountQuery.data;
12
+ const [cxd, setCxd, removeCxd] = useLocalStorage('WebPortalCellxpertCxd', null);
12
13
  const now = new Date();
14
+ const shouldTimeoutRun = cxdToken && account;
13
15
  const removeCxdUntilInMs = cxd?.timestamp
14
16
  ? clamp(cxd.timestamp - now.getTime(), 0, Infinity)
15
17
  : 0;
16
18
  useTimeout(() => {
17
- const isSame = cxd?.cxd === accountCxd.cxd;
19
+ const isSame = cxd?.cxd === cxdToken;
18
20
  if (!isSame) {
19
21
  const extendedTimestamp = addHours(new Date(), 6).getTime();
20
22
  setCxd({
21
- cxd: accountCxd.cxd,
23
+ cxd: cxdToken,
22
24
  timestamp: extendedTimestamp,
23
25
  });
24
26
  }
25
- }, account ? 100 : null);
26
- useTimeout(() => {
27
- removeCxd();
28
- }, account ? removeCxdUntilInMs : null);
27
+ }, shouldTimeoutRun ? 100 : null);
28
+ useTimeout(() => removeCxd(), shouldTimeoutRun ? removeCxdUntilInMs : null);
29
29
  return null;
30
30
  }
@@ -0,0 +1,2 @@
1
+ import type { ComponentPropsWithRef } from 'react';
2
+ export declare function LinkBrokenIcon(props: ComponentPropsWithRef<'svg'>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function LinkBrokenIcon(props) {
3
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", ...props, children: _jsx("path", { d: "M8.5 15.5L15.5 8.49998M9 4V2M15 20V22M4 9H2M20 15H22M4.91421 4.91421L3.5 3.5M19.0858 19.0857L20.5 20.4999M12 17.6568L9.87871 19.7781C8.31662 21.3402 5.78396 21.3402 4.22186 19.7781C2.65976 18.216 2.65976 15.6833 4.22186 14.1212L6.34318 11.9999M17.6569 11.9999L19.7782 9.87859C21.3403 8.31649 21.3403 5.78383 19.7782 4.22174C18.2161 2.65964 15.6835 2.65964 14.1214 4.22174L12 6.34306", stroke: "#FEDF89", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
4
+ }