@opexa/portal-components 0.0.321 → 0.0.323

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.
@@ -2,6 +2,6 @@ import type { ImageProps } from 'next/image';
2
2
  export interface DisclaimerV1Props {
3
3
  version: '1';
4
4
  logo: ImageProps['src'];
5
- termsAndConditionsUrl?: string;
5
+ termsOfUseUrl?: string;
6
6
  }
7
7
  export declare function DisclaimerV1(props: DisclaimerV1Props): import("react/jsx-runtime").JSX.Element;
@@ -2,15 +2,56 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import Image from 'next/image';
4
4
  import Link from 'next/link';
5
- import { useRef } from 'react';
5
+ import { useRef, useState } from 'react';
6
+ import { useTimeout } from 'usehooks-ts';
7
+ import { useShallow } from 'zustand/shallow';
8
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
9
+ import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
10
+ import { CheckIcon } from '../../icons/CheckIcon.js';
11
+ import { XIcon } from '../../icons/XIcon.js';
6
12
  import pagcorLogo from '../../images/pagcor.png';
7
- import responsibleGamingLogo from '../../images/responsible-gaming.png';
13
+ import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
8
14
  import { Button } from '../../ui/Button/index.js';
15
+ import { Checkbox } from '../../ui/Checkbox/index.js';
9
16
  import { Dialog } from '../../ui/Dialog/index.js';
17
+ import { Field } from '../../ui/Field/index.js';
10
18
  import { Portal } from '../../ui/Portal/index.js';
11
19
  import { useDisclaimer } from './useDisclaimer.js';
12
20
  export function DisclaimerV1(props) {
13
21
  const disclaimer = useDisclaimer();
14
22
  const acceptTriggerRef = useRef(null);
15
- return (_jsx(Dialog.Root, { open: disclaimer.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, initialFocusEl: () => acceptTriggerRef.current, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "mt-3xl text-center font-semibold text-lg", children: "Age Verification" }), _jsxs(Dialog.Description, { className: "mt-xs text-center text-sm text-text-tertiary-600", children: ["By entering this website I acknowledge and confirm I am 21 years of age and I agree with the", ' ', _jsx(Link, { href: props.termsAndConditionsUrl ?? '/terms-and-conditions', target: "_blank", rel: "noopener noreferrer", className: "whitespace-nowrap text-brand-400 underline underline-offset-2", prefetch: false, children: "Terms and Conditions." })] }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, children: "Accept" })] }) })] }) }));
23
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
24
+ termsOfUse: ctx.termsOfUse,
25
+ })));
26
+ const checked = globalStore.termsOfUse.accepted;
27
+ const [warn, setWarn] = useState(false);
28
+ useTimeout(() => setWarn(false), warn ? 5000 : null);
29
+ return (_jsx(Dialog.Root, { open: disclaimer.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, initialFocusEl: () => acceptTriggerRef.current, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx("button", { type: "button", onClick: () => {
30
+ if (!checked) {
31
+ setWarn(true);
32
+ }
33
+ else {
34
+ disclaimer.close();
35
+ }
36
+ }, className: "absolute top-6.5 right-6.5", "aria-label": "Close", children: _jsx(XIcon, { className: "size-6 text-text-quinary" }) }), _jsx(Image, { src: props.logo, alt: "", width: 142, height: 30, className: "mx-auto h-auto w-[8.875rem]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 74, width: 88, className: "h-[5.5rem] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 185, className: "h-[3.875rem] w-auto shrink-0", draggable: false })] }), _jsx("p", { className: "mt-4 text-center text-sm", children: "The following individuals are prohibited from registering or participating in this online gaming platform." }), _jsx("div", { className: "mt-5", children: _jsx("ul", { className: "space-y-1", children: items.map((item, index) => (_jsxs("li", { className: "flex items-start gap-md text-sm text-text-secondary-700", children: [_jsx("div", { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full bg-bg-brand-solid", children: _jsx("div", { className: "size-1.5 rounded-full bg-cyan-950" }) }), item] }, index))) }) }), _jsx(Field.Root, { invalid: warn, className: "mt-2xl", children: _jsxs(Checkbox.Root, { checked: checked, onCheckedChange: (e) => {
37
+ if (e.checked === 'indeterminate')
38
+ return;
39
+ globalStore.termsOfUse.setAccepted(e.checked);
40
+ }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs("div", { className: "!text-sm !leading-tight", children: [_jsxs(Checkbox.Label, { className: "text-sm leading-tight", children: ["I am at least 21 years of age, I accept the", ' ', _jsx(Link, { href: props.termsOfUseUrl ?? '/terms-of-use', className: "text-brand-400 underline underline-offset-2", onClick: () => {
41
+ globalStore.termsOfUse.setOpen(false);
42
+ }, children: "Terms of Use" }), ' ', "and I am not playing in open or public space."] }), _jsxs(Field.ErrorText, { className: "mt-0 flex items-center gap-1 text-xs leading-none", children: [_jsx(AlertCircleIcon, { className: "size-3.5 text-error-400" }), "You must accept the Terms of Use to continue."] })] }), _jsx(Checkbox.HiddenInput, {})] }) }), _jsx("p", { className: "mt-2xl text-center text-sm", children: "Funds or credits in the account of any individual found ineligible to participate will be forfeited and turned over to the government as required by law." })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, disabled: !checked, children: "Accept" }), _jsx(Button, { variant: "outline", type: "button", className: "mt-lg", onClick: () => {
43
+ if (!checked) {
44
+ setWarn(true);
45
+ }
46
+ else {
47
+ disclaimer.close();
48
+ }
49
+ }, children: "Exit" })] }) })] }) }));
16
50
  }
51
+ const items = [
52
+ 'Persons below the legal gambling age of 21.',
53
+ 'Any government official or employee directly involved in the operations of the government or its agencies.',
54
+ 'Member of the Armed Forces of the Philippines, including the Army, Navy, Air Force and the Philippine National Police.',
55
+ "Individuals listed in PAGCOR's National Database of Restricted Persons (NDRP).",
56
+ 'Holders of a valid Gaming Employment License (GEL).',
57
+ ];
@@ -16,7 +16,7 @@ import { toaster } from '../../client/utils/toaster.js';
16
16
  import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
17
17
  import { CheckIcon } from '../../icons/CheckIcon.js';
18
18
  import pagcorLogo from '../../images/pagcor.png';
19
- import responsibleGamingLogo from '../../images/responsible-gaming-yellow.png';
19
+ import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
20
20
  import { Button } from '../../ui/Button/index.js';
21
21
  import { Checkbox } from '../../ui/Checkbox/index.js';
22
22
  import { Field } from '../../ui/Field/index.js';
@@ -15,7 +15,7 @@ import { CheckIcon } from '../../icons/CheckIcon.js';
15
15
  import { EyeIcon } from '../../icons/EyeIcon.js';
16
16
  import { EyeOffIcon } from '../../icons/EyeOffIcon.js';
17
17
  import pagcorLogo from '../../images/pagcor.png';
18
- import responsibleGamingLogo from '../../images/responsible-gaming-yellow.png';
18
+ import responsibleGamingLogo from '../../images/responsible-gaming-gold.png';
19
19
  import { Button } from '../../ui/Button/index.js';
20
20
  import { Checkbox } from '../../ui/Checkbox/index.js';
21
21
  import { Field } from '../../ui/Field/index.js';
@@ -29,7 +29,7 @@ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
29
29
  import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
30
30
  import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
31
31
  import pagcorLogo from '../../../images/pagcor.png';
32
- import responsibleGamingLogo from '../../../images/responsible-gaming-yellow.png';
32
+ import responsibleGamingLogo from '../../../images/responsible-gaming-gold.png';
33
33
  import { ObjectType } from '../../../services/ObjectType.js';
34
34
  import { Button } from '../../../ui/Button/index.js';
35
35
  import { Checkbox } from '../../../ui/Checkbox/index.js';
@@ -35,7 +35,7 @@ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
35
35
  import { EyeIcon } from '../../../icons/EyeIcon.js';
36
36
  import { EyeOffIcon } from '../../../icons/EyeOffIcon.js';
37
37
  import pagcorLogo from '../../../images/pagcor.png';
38
- import responsibleGamingLogo from '../../../images/responsible-gaming-yellow.png';
38
+ import responsibleGamingLogo from '../../../images/responsible-gaming-gold.png';
39
39
  import { ObjectType } from '../../../services/ObjectType.js';
40
40
  import { Button } from '../../../ui/Button/index.js';
41
41
  import { Checkbox } from '../../../ui/Checkbox/index.js';
@@ -12,6 +12,7 @@ export async function postAuthenticate(request) {
12
12
  const body = await request.json();
13
13
  const parsed = AuthenticateDefinition.safeParse(body);
14
14
  const userAgent = request.headers.get('user-agent');
15
+ const ipaddress = request.headers.get('x-forwarded-for');
15
16
  if (!parsed.success) {
16
17
  return NextResponse.json({
17
18
  ok: false,
@@ -32,6 +33,9 @@ export async function postAuthenticate(request) {
32
33
  ...(userAgent && {
33
34
  'User-Agent': userAgent,
34
35
  }),
36
+ ...(ipaddress && {
37
+ 'X-Forwarded-For': ipaddress,
38
+ }),
35
39
  },
36
40
  });
37
41
  const response = NextResponse.json({ ok: true }, { status: 201 });
@@ -31,6 +31,7 @@ export async function postSession(request) {
31
31
  const body = await request.json();
32
32
  const parsed = CreateSessionDefinition.safeParse(body);
33
33
  const userAgent = request.headers.get('user-agent');
34
+ const ipaddress = request.headers.get('x-forwarded-for');
34
35
  if (!parsed.success) {
35
36
  return NextResponse.json({
36
37
  ok: false,
@@ -51,6 +52,9 @@ export async function postSession(request) {
51
52
  ...(userAgent && {
52
53
  'User-Agent': userAgent,
53
54
  }),
55
+ ...(ipaddress && {
56
+ 'X-Forwarded-For': ipaddress,
57
+ }),
54
58
  },
55
59
  });
56
60
  if (res.authenticator) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.321",
3
+ "version": "0.0.323",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",