@opexa/portal-components 0.0.1113 → 0.0.1114

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.
@@ -18,6 +18,8 @@ export function DigitainContainer(props) {
18
18
  paramsRef.current = props.params;
19
19
  const bootedRef = useRef(false);
20
20
  const waitingForScriptRef = useRef(true);
21
+ const hasRefreshedRef = useRef(false);
22
+ const failTimeoutRef = useRef(undefined);
21
23
  const [isBooting, setIsBooting] = useState(true);
22
24
  const [progress, setProgress] = useState(0);
23
25
  const [stepIndex, setStepIndex] = useState(0);
@@ -53,7 +55,8 @@ export function DigitainContainer(props) {
53
55
  return true;
54
56
  }, []);
55
57
  useEffect(() => {
56
- if (session.data?.status === 'authenticated') {
58
+ if (session.data?.status === 'authenticated' && !hasRefreshedRef.current) {
59
+ hasRefreshedRef.current = true;
57
60
  router.refresh();
58
61
  }
59
62
  }, [session.data?.status, router]);
@@ -97,12 +100,17 @@ export function DigitainContainer(props) {
97
100
  }, [runBoot]);
98
101
  // Fails if the script never becomes bootable
99
102
  useEffect(() => {
100
- const t = window.setTimeout(() => {
103
+ if (failTimeoutRef.current)
104
+ clearTimeout(failTimeoutRef.current);
105
+ failTimeoutRef.current = setTimeout(() => {
101
106
  if (bootedRef.current)
102
107
  return;
103
108
  failLoad('Sportsbook failed to load in time. Please refresh or try again later.');
104
109
  }, SCRIPT_FAIL_TIMEOUT_MS);
105
- return () => clearTimeout(t);
110
+ return () => {
111
+ if (failTimeoutRef.current)
112
+ clearTimeout(failTimeoutRef.current);
113
+ };
106
114
  }, [failLoad]);
107
115
  return (_jsxs("div", { className: "w-full min-h-[calc(100dvh-4rem)]", children: [isBooting ? (_jsx(DigitainLoadingView, { fallbackBackgroundImage: props.fallbackBackgroundImage, loadingProgress: progress, loadingActiveStepIndex: stepIndex })) : null, _jsx("div", { id: "digitain-container", className: isBooting ? 'hidden' : 'w-full min-h-[calc(100dvh-4rem)]' })] }));
108
116
  }
@@ -2,7 +2,11 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { twMerge } from 'tailwind-merge';
4
4
  import { Progress } from '../../ui/Progress/index.js';
5
- const STEPS = ['Initializing', 'Loading', 'Opening Sportsbook'];
5
+ const STEPS = [
6
+ 'Connecting to server',
7
+ 'Setting up your session',
8
+ 'Launching Sportsbook',
9
+ ];
6
10
  /** Centered copy + progress only—no card shell; meant to sit on a dark overlay. */
7
11
  export function DigitainLoadingPanel({ progress, activeStepIndex, }) {
8
12
  const clamped = Math.min(100, Math.max(0, progress));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1113",
3
+ "version": "0.0.1114",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",