@opexa/portal-components 0.0.736 → 0.0.738

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 (110) hide show
  1. package/dist/client/hooks/useSignOutMutation.js +0 -15
  2. package/dist/components/Account/Account.lazy.js +30 -12
  3. package/dist/components/Banner/Banner.client.d.ts +12 -0
  4. package/dist/components/Banner/Banner.client.js +49 -0
  5. package/dist/components/DepositWithdrawal/AiOPaymentMethods.d.ts +11 -0
  6. package/dist/components/DepositWithdrawal/AiOPaymentMethods.js +55 -0
  7. package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
  8. package/dist/components/DigitainLauncher/Loading.js +5 -0
  9. package/dist/components/Disclaimer/DisclaimerV2.js +21 -1
  10. package/dist/components/GameLaunch/GameLaunchTrigger.js +8 -50
  11. package/dist/components/Games/GamesList.client.js +1 -1
  12. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -0
  13. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -0
  14. package/dist/components/KYC/BasicInformation.d.ts +1 -0
  15. package/dist/components/KYC/BasicInformation.js +101 -0
  16. package/dist/components/KYC/IdentityVerification.d.ts +1 -0
  17. package/dist/components/KYC/IdentityVerification.js +120 -0
  18. package/dist/components/KYC/Indicator.d.ts +1 -0
  19. package/dist/components/KYC/Indicator.js +8 -0
  20. package/dist/components/KYC/KYC.lazy.d.ts +6 -0
  21. package/dist/components/KYC/KYC.lazy.js +45 -0
  22. package/dist/components/KYC/KYCContext.d.ts +6 -0
  23. package/dist/components/KYC/KYCContext.js +2 -0
  24. package/dist/components/KYC/KYCDefault/IdentityVerification.js +20 -2
  25. package/dist/components/KYC/KYCDefault/PersonalInformation.js +20 -2
  26. package/dist/components/KYC/KYCReminder.lazy.js +21 -1
  27. package/dist/components/KYC/KYCVerificationStatus.lazy.js +7 -4
  28. package/dist/components/KYC/PersonalInformation.d.ts +1 -0
  29. package/dist/components/KYC/PersonalInformation.js +122 -0
  30. package/dist/components/KYC/useKYC.d.ts +25 -0
  31. package/dist/components/KYC/useKYC.js +38 -0
  32. package/dist/components/PortalProvider/CXDTokenObserver.d.ts +1 -0
  33. package/dist/components/PortalProvider/CXDTokenObserver.js +30 -0
  34. package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +1 -0
  35. package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +29 -0
  36. package/dist/components/SessionWatcher/SessionWatcher.d.ts +1 -0
  37. package/dist/components/SessionWatcher/SessionWatcher.js +20 -0
  38. package/dist/components/SessionWatcher/index.d.ts +1 -0
  39. package/dist/components/SessionWatcher/index.js +1 -0
  40. package/dist/components/SignIn/MobileNumberSignIn.js +36 -4
  41. package/dist/components/SignIn/NameAndPasswordSignIn.js +70 -5
  42. package/dist/components/SignIn/SignInTrigger.d.ts +1 -1
  43. package/dist/components/SignIn/SignInTrigger.js +1 -43
  44. package/dist/components/SignIn/utils.d.ts +8 -0
  45. package/dist/components/SignIn/utils.js +26 -0
  46. package/dist/constants/Branches.d.ts +2 -0
  47. package/dist/constants/Branches.js +42 -0
  48. package/dist/images/responsible-gaming-yellow.png +0 -0
  49. package/dist/services/auth.js +1 -1
  50. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
  51. package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
  52. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  53. package/dist/third-parties/FacebookPixel/api.js +1 -0
  54. package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
  55. package/dist/third-parties/FacebookPixel/index.js +1 -0
  56. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
  57. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
  58. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  59. package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
  60. package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
  61. package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
  62. package/dist/third-parties/index.d.ts +2 -0
  63. package/dist/third-parties/index.js +2 -0
  64. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  65. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  66. package/dist/ui/Badge/Badge.d.ts +12 -12
  67. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  68. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  69. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  70. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  71. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  72. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  73. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  74. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  75. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  76. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  77. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  78. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  79. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  80. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  81. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  82. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  83. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  84. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  85. package/dist/ui/Field/Field.d.ts +21 -21
  86. package/dist/ui/Field/field.recipe.d.ts +3 -3
  87. package/dist/ui/Menu/Menu.d.ts +360 -360
  88. package/dist/ui/Menu/menu.recipe.d.ts +20 -20
  89. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  90. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  91. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  92. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  93. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  94. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  95. package/dist/ui/Popover/Popover.d.ts +88 -88
  96. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  97. package/dist/ui/Progress/Progress.d.ts +27 -27
  98. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  99. package/dist/ui/QrCode/QrCode.d.ts +40 -40
  100. package/dist/ui/QrCode/qrCode.recipe.d.ts +8 -8
  101. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  102. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  103. package/dist/ui/Select/Select.d.ts +45 -45
  104. package/dist/ui/Select/select.recipe.d.ts +3 -3
  105. package/dist/ui/Table/Table.d.ts +21 -21
  106. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  107. package/dist/ui/Table/table.recipe.d.ts +3 -3
  108. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  109. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  110. package/package.json +1 -1
@@ -1,10 +1,7 @@
1
1
  import { useMutation } from '@tanstack/react-query';
2
- import invariant from 'tiny-invariant';
3
- import { unregisterFCMDevice } from '../../services/trigger.js';
4
2
  import { getQueryClient } from '../../utils/getQueryClient.js';
5
3
  import { getSignOutMutationKey } from '../../utils/mutationKeys.js';
6
4
  import { getSessionQueryKey } from '../../utils/queryKeys.js';
7
- import { getSession } from '../services/getSession.js';
8
5
  import { signOut } from '../services/signOut.js';
9
6
  const IDLE_TIMESTAMP_KEY = 'idle-logout-timestamp';
10
7
  export const useSignOutMutation = (config) => {
@@ -13,18 +10,6 @@ export const useSignOutMutation = (config) => {
13
10
  ...config,
14
11
  mutationKey: getSignOutMutationKey(),
15
12
  mutationFn: async () => {
16
- const session = await getQueryClient().fetchQuery({
17
- queryKey: getSessionQueryKey(),
18
- queryFn: async () => getSession(),
19
- });
20
- invariant(session.status === 'authenticated');
21
- await unregisterFCMDevice({
22
- type: ['IOS', 'ANDROID'],
23
- }, {
24
- headers: {
25
- Authorization: `Bearer ${session.token}`,
26
- },
27
- });
28
13
  await signOut();
29
14
  await queryClient.invalidateQueries({ queryKey: getSessionQueryKey() });
30
15
  queryClient.removeQueries();
@@ -1,10 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Capacitor } from '@capacitor/core';
3
4
  import { isString } from 'lodash-es';
4
5
  import Image from 'next/image';
5
6
  import Link from 'next/link';
6
7
  import { useRouter } from 'next/navigation';
7
8
  import { twMerge } from 'tailwind-merge';
9
+ import invariant from 'tiny-invariant';
8
10
  import { useShallow } from 'zustand/shallow';
9
11
  import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
10
12
  import { useBonusesCountQuery } from '../../client/hooks/useBonusesCountQuery.js';
@@ -14,6 +16,7 @@ import { useMayaAuth } from '../../client/hooks/useMayaAuth.js';
14
16
  import { useProfileCompletionQuery } from '../../client/hooks/useProfileCompletionQuery.js';
15
17
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
16
18
  import { useUnreadMessagesCountQuery } from '../../client/hooks/useUnreadMessagesCountQuery.js';
19
+ import { getSession } from '../../client/services/getSession.js';
17
20
  import { BIOMETRIC_STORAGE_KEY } from '../../client/utils/biometric.js';
18
21
  import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
19
22
  import { Bell01Icon } from '../../icons/Bell01Icon.js';
@@ -24,12 +27,15 @@ import { Gift01Icon } from '../../icons/Gift01Icon.js';
24
27
  import { Logout01Icon } from '../../icons/Logout01Icon.js';
25
28
  import { Settings02Icon } from '../../icons/Settings02Icon.js';
26
29
  import avatarPlaceholder from '../../images/placeholder-avatar.png';
30
+ import { unregisterFCMDevice } from '../../services/trigger.js';
27
31
  import { Badge } from '../../ui/Badge/index.js';
28
32
  import { Drawer } from '../../ui/Drawer/index.js';
29
33
  import { Popover } from '../../ui/Popover/index.js';
30
34
  import { Portal } from '../../ui/Portal/index.js';
31
35
  import { capitalize } from '../../utils/capitalize.js';
36
+ import { getQueryClient } from '../../utils/getQueryClient.js';
32
37
  import { parseDecimal } from '../../utils/parseDecimal.js';
38
+ import { getSessionQueryKey } from '../../utils/queryKeys.js';
33
39
  import { AccountPropsContext, useAccountPropsContext } from './AccountContext.js';
34
40
  import { accountRecipe } from './account.recipe.js';
35
41
  import { Wallet } from './Wallet.js';
@@ -76,7 +82,7 @@ export function Account(props) {
76
82
  strategy: 'fixed',
77
83
  }, ids: {
78
84
  trigger: 'opexa-powerplay:account-trigger',
79
- }, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: 'relative z-popover max-h-[80vh] w-[23.438rem] ui-closed:animate-fade-out ui-open:animate-fade-in overflow-y-auto overscroll-contain rounded-xl border border-border-primary bg-bg-primary p-xl', style: {
85
+ }, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "relative z-popover max-h-[80vh] w-[23.438rem] ui-closed:animate-fade-out ui-open:animate-fade-in overflow-y-auto overscroll-contain rounded-xl border border-border-primary bg-bg-primary p-xl", style: {
80
86
  WebkitOverflowScrolling: 'touch',
81
87
  }, children: [_jsx(Profile, {}), _jsx(Wallet, { classNames: classNames }), _jsx(Links, { router: router, classNames: classNames })] }) }) }) })] }));
82
88
  }
@@ -104,19 +110,31 @@ function Links({ router, classNames, }) {
104
110
  messages: ctx.messages,
105
111
  })));
106
112
  const signOutMutation = useSignOutMutation({
107
- onSuccess() {
113
+ onSuccess: async () => {
108
114
  // Clear everything except the 'biometric' entry
109
- {
110
- const keep = new Set([BIOMETRIC_STORAGE_KEY]);
111
- for (let i = 0; i < localStorage.length;) {
112
- const key = localStorage.key(i);
113
- if (key && !keep.has(key)) {
114
- localStorage.removeItem(key);
115
- }
116
- else {
117
- i++;
118
- }
115
+ const keep = new Set([BIOMETRIC_STORAGE_KEY]);
116
+ for (let i = 0; i < localStorage.length;) {
117
+ const key = localStorage.key(i);
118
+ if (key && !keep.has(key)) {
119
+ localStorage.removeItem(key);
119
120
  }
121
+ else {
122
+ i++;
123
+ }
124
+ }
125
+ if (Capacitor.isNativePlatform()) {
126
+ const session = await getQueryClient().fetchQuery({
127
+ queryKey: getSessionQueryKey(),
128
+ queryFn: async () => getSession(),
129
+ });
130
+ invariant(session.status === 'authenticated');
131
+ await unregisterFCMDevice({
132
+ type: ['IOS', 'ANDROID'],
133
+ }, {
134
+ headers: {
135
+ Authorization: `Bearer ${session.token}`,
136
+ },
137
+ });
120
138
  }
121
139
  sessionStorage.clear();
122
140
  router.replace('/');
@@ -0,0 +1,12 @@
1
+ import type { ImageProps } from 'next/image';
2
+ export interface BannerEntry {
3
+ src: ImageProps['src'];
4
+ redirectUrl?: string;
5
+ }
6
+ export interface BannerProps {
7
+ banners: BannerEntry[];
8
+ imageWidth?: number | [mobile: number, desktop: number];
9
+ imageHeight?: number | [mobile: number, desktop: number];
10
+ className?: string;
11
+ }
12
+ export declare function Banner__client(props: BannerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import emblaCarouselAutoplay from 'embla-carousel-autoplay';
4
+ import useEmblaCarousel, {} from 'embla-carousel-react';
5
+ import isMobile from 'is-mobile';
6
+ import Image from 'next/image';
7
+ import Link from 'next/link';
8
+ import { Fragment, useEffect, useState } from 'react';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import { dataAttr } from '../../utils/dataAttr.js';
11
+ export function Banner__client(props) {
12
+ const [emblaRef, emblaApi] = useEmblaCarousel({
13
+ loop: true,
14
+ align: 'start',
15
+ }, [
16
+ emblaCarouselAutoplay({
17
+ playOnInit: true,
18
+ delay: 5000,
19
+ }),
20
+ ]);
21
+ const [currentIndex, setCurrentIndex] = useState(0);
22
+ useEffect(() => {
23
+ function handler(detail) {
24
+ setCurrentIndex(detail?.selectedScrollSnap() ?? 0);
25
+ }
26
+ emblaApi?.on('scroll', handler);
27
+ emblaApi?.on('init', handler);
28
+ return () => {
29
+ emblaApi?.on('init', handler);
30
+ emblaApi?.off('scroll', handler);
31
+ };
32
+ }, [emblaApi]);
33
+ const imageWidth = !props.imageWidth
34
+ ? [400, 1200]
35
+ : Array.isArray(props.imageWidth)
36
+ ? props.imageWidth
37
+ : [props.imageWidth, props.imageWidth];
38
+ const imageHeight = !props.imageHeight
39
+ ? [225, 300]
40
+ : Array.isArray(props.imageHeight)
41
+ ? props.imageHeight
42
+ : [props.imageHeight, props.imageHeight];
43
+ return (_jsxs("div", { className: twMerge('relative', props.className), children: [_jsx("div", { ref: emblaRef, className: "overflow-hidden", children: _jsx("div", { className: "flex gap-2", children: props.banners.map((banner, index) => {
44
+ const img = (_jsx(Image, { src: banner.src, alt: "", width: isMobile() ? imageWidth[0] : imageWidth[1], height: isMobile() ? imageHeight[0] : imageHeight[1], className: "block h-auto w-full", priority: index === 0 }));
45
+ return (_jsx(Fragment, { children: !banner.redirectUrl ? (_jsx("div", { className: "w-full shrink-0", children: img })) : (_jsx(Link, { href: banner.redirectUrl, className: "block w-full shrink-0", "aria-label": `Open ${banner.redirectUrl}`, children: img })) }, index));
46
+ }) }) }), _jsx("div", { className: "absolute bottom-lg left-1/2 flex w-fit -translate-x-1/2 gap-2", children: props.banners.map((_, index) => (_jsx("button", { type: "button", className: "ui-active:bg-brand-500 bg-gray-300 size-3 shrink-0 rounded-full border border-white transition-all duration-300 ui-active:w-9", onClick: () => {
47
+ emblaApi?.scrollTo(index);
48
+ }, "aria-label": `Go to slide ${index + 1}`, "data-active": dataAttr(index === currentIndex) }, index))) })] }));
49
+ }
@@ -0,0 +1,11 @@
1
+ import { type AiOeWalletPaymentMethod } from './utils';
2
+ interface AiOPaymentMethodsProps {
3
+ value?: AiOeWalletPaymentMethod;
4
+ onChange?: (value: AiOeWalletPaymentMethod) => void;
5
+ defaultValue?: AiOeWalletPaymentMethod;
6
+ options?: AiOeWalletPaymentMethod[];
7
+ className?: string;
8
+ label?: string;
9
+ }
10
+ export declare function AiOPaymentMethods(props: AiOPaymentMethodsProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { useControllableState } from '../../client/hooks/useControllableState.js';
5
+ import { CheckIcon } from '../../icons/CheckIcon.js';
6
+ import gcash from '../../images/gcash.png';
7
+ import grabPay from '../../images/grabpay.png';
8
+ import maya from '../../images/maya.png';
9
+ import palawanPay from '../../images/palawanpay.png';
10
+ import { Checkbox } from '../../ui/Checkbox/index.js';
11
+ import { Field } from '../../ui/Field/index.js';
12
+ import { AiOeWalletPaymentMethodDefinition, } from './utils.js';
13
+ const AIO_EWALLET_OPTIONS = [
14
+ {
15
+ value: 'AIO_GCASH',
16
+ label: 'GCash',
17
+ image: gcash,
18
+ },
19
+ {
20
+ value: 'AIO_PAY_MAYA',
21
+ label: 'Maya',
22
+ image: maya,
23
+ },
24
+ {
25
+ value: 'AIO_GRAB_PAY',
26
+ label: 'GrabPay',
27
+ image: grabPay,
28
+ },
29
+ {
30
+ value: 'AIO_PALAWAN_PAY',
31
+ label: 'Palawan Pay',
32
+ image: palawanPay,
33
+ },
34
+ ];
35
+ export function AiOPaymentMethods(props) {
36
+ const options = props.options && props.options.length > 0
37
+ ? AIO_EWALLET_OPTIONS.filter((option) => props.options?.includes(option.value))
38
+ : AIO_EWALLET_OPTIONS;
39
+ const [value, setValue] = useControllableState({
40
+ value: props.value,
41
+ defaultValue: props.defaultValue ?? options[0]?.value,
42
+ onChange: props.onChange,
43
+ });
44
+ const parseValue = (val) => {
45
+ return AiOeWalletPaymentMethodDefinition.parse(val);
46
+ };
47
+ return (_jsxs("div", { className: props.className, children: [_jsx(Field.Label, { asChild: true, children: _jsx("div", { children: props.label || 'AIO eWallet payment methods' }) }), _jsx(Checkbox.Group, { value: [value], onValueChange: (newValue) => {
48
+ const lastValue = newValue.at(-1);
49
+ if (!lastValue)
50
+ return;
51
+ setValue(parseValue(lastValue));
52
+ }, className: "grid grid-cols-2 gap-x-4 gap-y-3", children: options.map((option) => (_jsxs(Checkbox.Root, { value: option.value, className: "flex cursor-pointer items-center justify-between rounded-xl border border-border-secondary ui-checked:border-border-brand-solid p-lg", children: [_jsx("div", { className: twMerge('rounded-xs', option.value === 'AIO_GRAB_PAY'
53
+ ? 'bg-transparent px-0 py-0'
54
+ : 'bg-white px-sm py-[0.688rem]', option.value === 'AIO_GCASH' && 'bg-[#017EFF]', option.value === 'AIO_PALAWAN_PAY' && 'bg-[#026308]', option.value === 'AIO_PAY_MAYA' && 'bg-black'), children: _jsx(Image, { src: option.image, alt: "", width: 200, height: 40, className: twMerge('h-[1.063rem] w-auto', option.value === 'AIO_GRAB_PAY' && 'h-[3rem] rounded-[4px]', option.value === 'AIO_PALAWAN_PAY' && 'h-[2rem]'), draggable: false }) }), _jsx(Checkbox.Control, { className: "shrink-0", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }, option.value))) })] }));
55
+ }
@@ -0,0 +1 @@
1
+ export declare function Loading(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function Loading() {
4
+ return (_jsx("div", { className: "flex h-[calc(100vh-400px)] w-full items-center justify-center px-4", children: _jsxs("div", { className: "flex flex-col items-center space-y-4", children: [_jsx("div", { className: "h-10 w-10 animate-spin rounded-full border-4 border-blue-500 border-t-transparent" }), _jsx("p", { className: "font-medium text-gray-700 text-lg", children: "Loading Sports Book\u2026" })] }) }));
5
+ }
@@ -1,20 +1,26 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Capacitor } from '@capacitor/core';
3
4
  import Image from 'next/image';
4
5
  import { useState } from 'react';
5
6
  import { twMerge } from 'tailwind-merge';
7
+ import invariant from 'tiny-invariant';
6
8
  import { useShallow } from 'zustand/shallow';
7
9
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
8
10
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
11
+ import { getSession } from '../../client/services/getSession.js';
9
12
  import { BIOMETRIC_STORAGE_KEY } from '../../client/utils/biometric.js';
10
13
  import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
11
14
  import { CheckIcon } from '../../icons/CheckIcon.js';
12
15
  import pagcorLogo from '../../images/pagcor2.png';
13
16
  import responsibleGamingLogo from '../../images/responsible-gaming.png';
17
+ import { unregisterFCMDevice } from '../../services/trigger.js';
14
18
  import { Button } from '../../ui/Button/index.js';
15
19
  import { Checkbox } from '../../ui/Checkbox/index.js';
16
20
  import { Dialog } from '../../ui/Dialog/index.js';
17
21
  import { Portal } from '../../ui/Portal/index.js';
22
+ import { getQueryClient } from '../../utils/getQueryClient.js';
23
+ import { getSessionQueryKey } from '../../utils/queryKeys.js';
18
24
  import { useDisclaimer } from './useDisclaimer.js';
19
25
  export function DisclaimerV2(props) {
20
26
  const disclaimer = useDisclaimer({
@@ -27,7 +33,7 @@ export function DisclaimerV2(props) {
27
33
  const checked = globalStore.termsOfUse.accepted && globalStore.responsibleGaming.accepted;
28
34
  const [showWarning, setShowWarning] = useState(false);
29
35
  const signOutMutation = useSignOutMutation({
30
- onSuccess() {
36
+ async onSuccess() {
31
37
  // Clear everything except the 'biometric' entry
32
38
  const keep = new Set([BIOMETRIC_STORAGE_KEY]);
33
39
  for (let i = 0; i < localStorage.length;) {
@@ -39,6 +45,20 @@ export function DisclaimerV2(props) {
39
45
  i++;
40
46
  }
41
47
  }
48
+ if (Capacitor.isNativePlatform()) {
49
+ const session = await getQueryClient().fetchQuery({
50
+ queryKey: getSessionQueryKey(),
51
+ queryFn: async () => getSession(),
52
+ });
53
+ invariant(session.status === 'authenticated');
54
+ await unregisterFCMDevice({
55
+ type: ['IOS', 'ANDROID'],
56
+ }, {
57
+ headers: {
58
+ Authorization: `Bearer ${session.token}`,
59
+ },
60
+ });
61
+ }
42
62
  sessionStorage.clear();
43
63
  },
44
64
  });
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ark } from '@ark-ui/react/factory';
4
4
  import { Capacitor } from '@capacitor/core';
5
5
  import { BiometricAuthError } from 'capacitor-native-biometric';
6
- import { useState } from 'react';
7
6
  import { useShallow } from 'zustand/shallow';
8
7
  import { useCreateGameSessionMutation } from '../../client/hooks/useCreateGameSessionMutation.js';
9
8
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
@@ -27,7 +26,6 @@ export function GameLaunchTrigger(props) {
27
26
  gameLaunch: ctx.gameLaunch,
28
27
  kycVerificationStatus: ctx.kycVerificationStatus,
29
28
  })));
30
- const [hasCancelledBiometric, setHasCancelledBiometric] = useState(false);
31
29
  const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
32
30
  const currentHour = new Date().getHours();
33
31
  const between3amAnd3pm = currentHour >= 15 || currentHour < 3;
@@ -49,7 +47,7 @@ export function GameLaunchTrigger(props) {
49
47
  : 'open', ...props, disabled: disabled, onClick: async (e) => {
50
48
  props.onClick?.(e);
51
49
  if (sessionQuery.data?.status === 'unauthenticated') {
52
- if (hasSavedBiometry() && !hasCancelledBiometric) {
50
+ if (hasSavedBiometry()) {
53
51
  const ok = await performBiometricVerification({
54
52
  reason: 'Login to your account',
55
53
  title: 'Login',
@@ -64,7 +62,6 @@ export function GameLaunchTrigger(props) {
64
62
  info.errorCode === BiometricAuthError.SYSTEM_CANCEL ||
65
63
  info.errorCode === undefined ||
66
64
  info.errorCode === null) {
67
- setHasCancelledBiometric(true);
68
65
  console.log('Biometric verification cancelled');
69
66
  }
70
67
  else {
@@ -80,25 +77,22 @@ export function GameLaunchTrigger(props) {
80
77
  return;
81
78
  }
82
79
  try {
83
- console.log('Signing in using biometric credentials');
84
80
  await signIn({
85
81
  type: 'SINGLE_USE_TOKEN',
86
82
  token: credentials.password,
87
83
  });
88
84
  }
89
- catch {
85
+ catch (err) {
86
+ console.log(err);
90
87
  toaster.error({
91
- title: 'Biometric sign-in token has expired.',
88
+ title: 'Biometric removed or token expired.',
92
89
  description: 'Please sign in with your mobile number or username to re-enable biometric login.',
93
90
  });
94
91
  deleteBiometricCredentials();
95
92
  globalStore.signIn.setOpen(!globalStore.signIn.open);
96
93
  }
97
- getQueryClient().invalidateQueries({
98
- queryKey: getSessionQueryKey(),
99
- });
100
- const session = await getSession();
101
94
  const pushToken = localStorage.getItem(LOCALSTORAGE_PUSH_NOTIFICATION_TOKEN_KEY);
95
+ const session = await getSession();
102
96
  await unregisterFCMDevice({
103
97
  type: ['IOS', 'ANDROID'],
104
98
  }, {
@@ -116,6 +110,9 @@ export function GameLaunchTrigger(props) {
116
110
  },
117
111
  });
118
112
  }
113
+ getQueryClient().invalidateQueries({
114
+ queryKey: getSessionQueryKey(),
115
+ });
119
116
  const r = await createSingleUseToken({
120
117
  headers: {
121
118
  Authorization: `Bearer ${session.token}`,
@@ -140,45 +137,6 @@ export function GameLaunchTrigger(props) {
140
137
  }
141
138
  }
142
139
  else {
143
- // still update biometric credentials if user has cancelled biometric once
144
- if (hasCancelledBiometric) {
145
- const credentials = await getBiometricCredentials();
146
- if (!credentials) {
147
- toaster.error({ description: 'Biometric verification failed' });
148
- globalStore.signIn.setOpen(!globalStore.signIn.open);
149
- return;
150
- }
151
- await signIn({
152
- type: 'SINGLE_USE_TOKEN',
153
- token: credentials.password,
154
- });
155
- getQueryClient().invalidateQueries({
156
- queryKey: getSessionQueryKey(),
157
- });
158
- const session = await getSession();
159
- const r = await createSingleUseToken({
160
- headers: {
161
- Authorization: `Bearer ${session.token}`,
162
- },
163
- });
164
- if (r.token) {
165
- const saved = await saveBiometricCredentials({
166
- username: credentials.username,
167
- password: r.token,
168
- });
169
- if (saved) {
170
- console.info('Biometric credentials has been updated');
171
- }
172
- else {
173
- console.warn('Failed to updated biometric credentials');
174
- globalStore.signIn.setOpen(!globalStore.signIn.open);
175
- }
176
- }
177
- else {
178
- console.error('Failed to create token');
179
- globalStore.signIn.setOpen(!globalStore.signIn.open);
180
- }
181
- }
182
140
  globalStore.signIn.setOpen(!globalStore.signIn.open);
183
141
  }
184
142
  return props.onClick?.(e);
@@ -46,7 +46,7 @@ export function GamesList__client(props) {
46
46
  const classNames = isString(props.className)
47
47
  ? { root: props.className }
48
48
  : (props.className ?? {});
49
- return (_jsx(GamesPropsContext, { value: props, children: _jsxs("div", { className: classNames.root, id: "games-list", children: [_jsxs("div", { className: "flex flex-col lg:flex-row lg:items-center lg:justify-between", children: [_jsx("h2", { className: "order-2 mt-4xl font-semibold text-lg lg:order-none lg:mt-0", children: props.heading ?? 'Games' }), props.viewGameProvidersUrl && (_jsxs(Link, { href: props.viewGameProvidersUrl, className: "order-1 flex items-center gap-sm font-semibold text-button-tertiary-fg text-lg lg:order-none lg:text-sm", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back to all Providers"] }))] }), totalRows <= 0 && (_jsx(Empty, { icon: loading ? SpinnerIcon : GamingPad01Icon, title: loading ? 'Just a moment' : 'No games', message: loading
49
+ return (_jsx(GamesPropsContext, { value: props, children: _jsxs("div", { className: classNames.root, id: "games-list", children: [_jsxs("div", { className: "flex flex-col lg:flex-row lg:items-center lg:justify-between", children: [_jsx("h2", { className: "order-2 mt-md font-semibold text-lg lg:order-none lg:mt-0", children: props.heading ?? 'Games' }), props.viewGameProvidersUrl && (_jsxs(Link, { href: props.viewGameProvidersUrl, className: "order-1 flex items-center gap-sm font-semibold text-button-tertiary-fg text-lg lg:order-none lg:text-sm", children: [_jsx(ChevronLeftIcon, { className: "size-5" }), "Back to all Providers"] }))] }), totalRows <= 0 && (_jsx(Empty, { icon: loading ? SpinnerIcon : GamingPad01Icon, title: loading ? 'Just a moment' : 'No games', message: loading
50
50
  ? 'Fetching latest games...'
51
51
  : 'No game is currently available. Please check back later', className: "mt-lg" })), totalRows >= 1 && (_jsxs(_Fragment, { children: [_jsx("div", { className: "mt-lg grid grid-cols-3 gap-1.5 lg:grid-cols-6 lg:gap-2.5", children: (pagination === 'paginated' ? paginatedRows : availableRows).map((game) => (_jsx(GameContext, { value: game, children: _jsx(Game, { badge: props.badge, className: {
52
52
  root: classNames.thumbnailRoot,
@@ -0,0 +1,184 @@
1
+ @keyframes arrow-green-flash {
2
+ 0% {
3
+ color: #abefc6;
4
+ }
5
+ 100% {
6
+ color: #079455;
7
+ }
8
+ }
9
+
10
+ .animate-arrow-green-flash-1 {
11
+ animation: arrow-green-flash 0.4s infinite;
12
+ animation-delay: -0.2s;
13
+ }
14
+
15
+ .animate-arrow-green-flash-2 {
16
+ animation: arrow-green-flash 0.4s infinite;
17
+ animation-delay: -0.1s;
18
+ }
19
+
20
+ .animate-arrow-green-flash-3 {
21
+ animation: arrow-green-flash 0.4s infinite;
22
+ }
23
+
24
+ @keyframes arrow-red-flash {
25
+ 0%,
26
+ 100% {
27
+ color: #f97066;
28
+ }
29
+ 50% {
30
+ color: #fecdca;
31
+ }
32
+ }
33
+
34
+ .animate-arrow-red-flash-1 {
35
+ animation: arrow-red-flash 0.4s infinite;
36
+ }
37
+
38
+ .animate-arrow-red-flash-2 {
39
+ animation: arrow-red-flash 0.4s infinite;
40
+ animation-delay: -0.1s;
41
+ }
42
+
43
+ .animate-arrow-red-flash-3 {
44
+ animation: arrow-red-flash 0.4s infinite;
45
+ animation-delay: -0.2s;
46
+ }
47
+
48
+ /* Animated BG */
49
+ @keyframes rotate {
50
+ to {
51
+ transform: rotate(1turn);
52
+ }
53
+ }
54
+
55
+ .light-rays {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ right: 0;
60
+ bottom: 0;
61
+ overflow: hidden;
62
+
63
+ --first: var(--color-bg-tertiary);
64
+ --second: var(--color-bg-quaternary);
65
+ }
66
+
67
+ .light-rays::before,
68
+ .light-rays::after {
69
+ content: '';
70
+ position: absolute;
71
+ top: var(--light-rays-top, 150px);
72
+ left: calc(50% - 90px);
73
+ margin: -100vmax;
74
+ width: 200vmax;
75
+ height: 200vmax;
76
+ opacity: 0.6;
77
+ transform-origin: center;
78
+ }
79
+
80
+ .light-rays::before {
81
+ background: conic-gradient(
82
+ var(--first) 0deg 7.2deg,
83
+ var(--second) 7.2deg 14.4deg,
84
+ var(--first) 14.4deg 21.6deg,
85
+ var(--second) 21.6deg 28.8deg,
86
+ var(--first) 28.8deg 36deg,
87
+ var(--second) 36deg 43.2deg,
88
+ var(--first) 43.2deg 50.4deg,
89
+ var(--second) 50.4deg 57.6deg,
90
+ var(--first) 57.6deg 64.8deg,
91
+ var(--second) 64.8deg 72deg,
92
+ var(--first) 72deg 79.2deg,
93
+ var(--second) 79.2deg 86.4deg,
94
+ var(--first) 86.4deg 93.6deg,
95
+ var(--second) 93.6deg 100.8deg,
96
+ var(--first) 100.8deg 108deg,
97
+ var(--second) 108deg 115.2deg,
98
+ var(--first) 115.2deg 122.4deg,
99
+ var(--second) 122.4deg 129.6deg,
100
+ var(--first) 129.6deg 136.8deg,
101
+ var(--second) 136.8deg 144deg,
102
+ var(--first) 144deg 151.2deg,
103
+ var(--second) 151.2deg 158.4deg,
104
+ var(--first) 158.4deg 165.6deg,
105
+ var(--second) 165.6deg 172.8deg,
106
+ var(--first) 172.8deg 180deg,
107
+ var(--second) 180deg 187.2deg,
108
+ var(--first) 187.2deg 194.4deg,
109
+ var(--second) 194.4deg 201.6deg,
110
+ var(--first) 201.6deg 208.8deg,
111
+ var(--second) 208.8deg 216deg,
112
+ var(--first) 216deg 223.2deg,
113
+ var(--second) 223.2deg 230.4deg,
114
+ var(--first) 230.4deg 237.6deg,
115
+ var(--second) 237.6deg 244.8deg,
116
+ var(--first) 244.8deg 252deg,
117
+ var(--second) 252deg 259.2deg,
118
+ var(--first) 259.2deg 266.4deg,
119
+ var(--second) 266.4deg 273.6deg,
120
+ var(--first) 273.6deg 280.8deg,
121
+ var(--second) 280.8deg 288deg,
122
+ var(--first) 288deg 295.2deg,
123
+ var(--second) 295.2deg 302.4deg,
124
+ var(--first) 302.4deg 309.6deg,
125
+ var(--second) 309.6deg 316.8deg,
126
+ var(--first) 316.8deg 324deg,
127
+ var(--second) 324deg 331.2deg,
128
+ var(--first) 331.2deg 338.4deg,
129
+ var(--second) 338.4deg 345.6deg,
130
+ var(--first) 345.6deg 352.8deg,
131
+ var(--second) 352.8deg 360deg
132
+ );
133
+ animation: rotate 20s linear infinite;
134
+ }
135
+
136
+ @media (max-width: 1024px) {
137
+ .light-rays::before,
138
+ .light-rays::after {
139
+ left: auto;
140
+ right: 11%;
141
+ }
142
+ }
143
+
144
+ /* ScrollArea.module.css */
145
+ .scrollArea {
146
+ overflow-y: scroll;
147
+ padding-right: 4px;
148
+ }
149
+
150
+ /* WebKit-based browsers */
151
+ .scrollArea::-webkit-scrollbar {
152
+ width: 8px;
153
+ }
154
+
155
+ .scrollArea::-webkit-scrollbar-track {
156
+ background: var(--color-bg-primary-alt);
157
+ border-radius: 9999px;
158
+ }
159
+
160
+ .scrollArea::-webkit-scrollbar-thumb {
161
+ background-color: var(--color-bg-quaternary);
162
+ border-radius: 9999px;
163
+ }
164
+
165
+ @keyframes waveColor {
166
+ 0%,
167
+ 2.5% {
168
+ color: var(--wave-highlight-color);
169
+ }
170
+ 2.51%,
171
+ 100% {
172
+ color: var(--color-brand-300);
173
+ }
174
+ }
175
+
176
+ .animate-wave-color-success {
177
+ --wave-highlight-color: var(--color-success-800);
178
+ animation: waveColor 4s ease-in-out infinite;
179
+ }
180
+
181
+ .animate-wave-color-error {
182
+ --wave-highlight-color: var(--color-error-600);
183
+ animation: waveColor 4s ease-in-out infinite;
184
+ }