@opexa/portal-components 0.0.1034 → 0.0.1036

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 (48) hide show
  1. package/dist/components/DigitainLauncher/DigitianContainter.js +12 -83
  2. package/dist/components/Quests/Quests.client.js +1 -1
  3. package/dist/types/index.d.ts +1 -1
  4. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  5. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  6. package/dist/ui/Badge/Badge.d.ts +12 -12
  7. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  8. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  9. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  10. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  11. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  12. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  13. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  14. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  15. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  16. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  17. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  18. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  19. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  20. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  21. package/dist/ui/Field/Field.d.ts +21 -21
  22. package/dist/ui/Field/field.recipe.d.ts +3 -3
  23. package/dist/ui/Menu/Menu.d.ts +144 -144
  24. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  25. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  26. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  27. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  28. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  29. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  30. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  31. package/dist/ui/Popover/Popover.d.ts +121 -121
  32. package/dist/ui/Popover/popover.recipe.d.ts +11 -11
  33. package/dist/ui/Progress/Progress.d.ts +27 -27
  34. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  35. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  36. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  37. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  38. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  39. package/dist/ui/Select/Select.d.ts +45 -45
  40. package/dist/ui/Select/select.recipe.d.ts +3 -3
  41. package/dist/ui/Table/Table.d.ts +21 -21
  42. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  43. package/dist/ui/Table/table.recipe.d.ts +3 -3
  44. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  45. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  46. package/dist/ui/Tooltip/Tooltip.d.ts +48 -48
  47. package/dist/ui/Tooltip/tooltip.recipe.d.ts +8 -8
  48. package/package.json +1 -1
@@ -1,119 +1,48 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import isMobile from 'is-mobile';
4
4
  import { useRouter } from 'next/navigation';
5
- import { useEffect, useRef, useState } from 'react';
5
+ import { useEffect, useState } from 'react';
6
6
  import { twJoin } from 'tailwind-merge';
7
7
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
8
8
  import { toaster } from '../../client/utils/toaster.js';
9
9
  import { Fallback } from './Fallback.js';
10
10
  export function DigitainContainer(props) {
11
11
  const session = useSessionQuery();
12
- const [isLoading, setLoading] = useState(true);
13
- const [hasBooted, setHasBooted] = useState(false);
12
+ const [isLoading, setLoading] = useState(false);
14
13
  const router = useRouter();
15
- const hasBootedRef = useRef(false);
16
- const containerRef = useRef(null);
17
14
  useEffect(() => {
18
15
  if (session.data?.status === 'authenticated') {
19
16
  router.refresh();
20
17
  }
21
18
  }, [session.data?.status, router]);
22
19
  useEffect(() => {
23
- if (hasBootedRef.current || typeof window === 'undefined') {
24
- return;
25
- }
20
+ setLoading(true);
26
21
  let attempts = 0;
27
- const maxAttempts = 5;
28
- const intervalId = setInterval(() => {
29
- if (window.Bootstrapper) {
22
+ const maxAttempts = 5; // e.g. wait up to ~10 seconds
23
+ function checkAndBoot() {
24
+ if (typeof window !== 'undefined' && window.Bootstrapper) {
30
25
  console.log('Bootstrapper found, booting with params:', props.params);
31
- hasBootedRef.current = true;
32
26
  window.Bootstrapper.boot(props.params, {
33
27
  name: isMobile() ? 'Mobile' : 'AsianView',
34
28
  }).then(() => {
35
29
  console.log('Sportsbook booted!');
36
- setHasBooted(true);
37
- }).catch((error) => {
38
- console.error('Sportsbook boot failed:', error);
39
- setLoading(false);
40
- toaster.error({
41
- title: 'Error',
42
- description: 'Failed to initialize sportsbook.',
43
- });
44
30
  });
31
+ setTimeout(() => setLoading(false), 1000); // Give some time for the UI to update
45
32
  clearInterval(intervalId);
46
33
  }
47
34
  else if (++attempts >= maxAttempts) {
48
- console.warn('Bootstrapper did not load in time.');
49
35
  setLoading(false);
50
36
  toaster.error({
51
37
  title: 'Error',
52
38
  description: 'Sportsbook failed to load. Please try again later.',
53
39
  });
40
+ console.warn('Bootstrapper did not load in time.');
54
41
  clearInterval(intervalId);
55
42
  }
56
- }, 500);
43
+ }
44
+ const intervalId = setInterval(checkAndBoot, 500);
57
45
  return () => clearInterval(intervalId);
58
46
  }, [props.params]);
59
- useEffect(() => {
60
- if (!hasBooted || !containerRef.current) {
61
- return;
62
- }
63
- const container = containerRef.current;
64
- const handleIframeReady = (iframe) => {
65
- const onLoad = () => {
66
- console.log('Digitain iframe loaded successfully!');
67
- setTimeout(() => setLoading(false), 300);
68
- };
69
- const onError = () => {
70
- console.error('Digitain iframe failed to load');
71
- setLoading(false);
72
- toaster.error({
73
- title: 'Error',
74
- description: 'Failed to load sportsbook. Please try again.',
75
- });
76
- };
77
- if (iframe.contentDocument?.readyState === 'complete') {
78
- console.log('Iframe already loaded!');
79
- setTimeout(() => setLoading(false), 300);
80
- }
81
- else {
82
- iframe.addEventListener('load', onLoad, { once: true });
83
- iframe.addEventListener('error', onError, { once: true });
84
- }
85
- };
86
- const existingIframe = container.querySelector('iframe');
87
- if (existingIframe) {
88
- handleIframeReady(existingIframe);
89
- return;
90
- }
91
- let iframeDetected = false;
92
- const observer = new MutationObserver((mutations) => {
93
- for (const mutation of mutations) {
94
- for (const node of mutation.addedNodes) {
95
- if (node.nodeName === 'IFRAME') {
96
- console.log('Digitain iframe detected');
97
- iframeDetected = true;
98
- handleIframeReady(node);
99
- observer.disconnect();
100
- return;
101
- }
102
- }
103
- }
104
- });
105
- observer.observe(container, { childList: true, subtree: true });
106
- const fallbackTimeout = setTimeout(() => {
107
- if (!iframeDetected) {
108
- console.warn('No iframe detected after 10 seconds. Hiding loader.');
109
- setLoading(false);
110
- observer.disconnect();
111
- }
112
- }, 10000);
113
- return () => {
114
- observer.disconnect();
115
- clearTimeout(fallbackTimeout);
116
- };
117
- }, [hasBooted]);
118
- return (_jsxs("div", { className: "relative h-full min-h-screen w-full", children: [_jsx("div", { className: twJoin('absolute inset-0 transition-opacity duration-300', isLoading ? 'z-10 opacity-100' : 'pointer-events-none opacity-0'), children: _jsx(Fallback, { type: "loading", fallbackBackgroundImage: props.fallbackBackgroundImage }) }), _jsx("div", { ref: containerRef, id: "digitain-container", className: twJoin('absolute inset-0 transition-opacity duration-300', isLoading ? 'opacity-0' : 'opacity-100') })] }));
47
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: twJoin(!isLoading && 'hidden'), children: _jsx(Fallback, { type: "loading", fallbackBackgroundImage: props.fallbackBackgroundImage }) }), _jsx("div", { id: "digitain-container", className: twJoin(isLoading && 'hidden') })] }));
119
48
  }
@@ -56,7 +56,7 @@ export function Quests__client(props) {
56
56
  ? []
57
57
  : questsQuery.data.filter((quest) => {
58
58
  if (tab === 'AVAILABLE') {
59
- return quest.status === 'IN_PROGRESS';
59
+ return quest.status === 'IN_PROGRESS' || quest.status === 'ACTIVE';
60
60
  }
61
61
  else if (tab === 'COMPLETED') {
62
62
  return quest.status === 'COMPLETED';
@@ -721,7 +721,7 @@ export interface Message {
721
721
  export type OnboardingStatus = 'PENDING' | 'SKIPPED' | 'COMPLETED';
722
722
  export type OnboardingPlayerExperience = 'ROOKIE' | 'VETERAN';
723
723
  export type QuestType = 'WAGERING' | 'DAILY_CHECKIN' | 'ONBOARDING' | 'JOURNEY';
724
- export type QuestStatus = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
724
+ export type QuestStatus = 'IN_PROGRESS' | 'ACTIVE' | 'COMPLETED' | 'FAILED';
725
725
  export type QuestProgramStatus = 'ACTIVE' | 'INACTIVE' | 'DELETED';
726
726
  export interface WageringQuestStageSettings {
727
727
  targetTurnover: number;