@opexa/portal-components 0.0.164 → 0.0.166

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.
@@ -107,12 +107,17 @@ function Wallet() {
107
107
  }
108
108
  function Links() {
109
109
  const accountProps = useAccountPropsContext();
110
- const signOutMutation = useSignOutMutation();
111
110
  const globalStore = useGlobalStore(useShallow((ctx) => ({
112
111
  account: ctx.account,
113
112
  account__mobile: ctx.account__mobile,
114
113
  messages: ctx.messages,
115
114
  })));
115
+ const signOutMutation = useSignOutMutation({
116
+ onSuccess() {
117
+ localStorage.clear();
118
+ sessionStorage.clear();
119
+ },
120
+ });
116
121
  const unreadMessagesCountQuery = useUnreadMessagesCountQuery({}, { refetchInterval: 5000 });
117
122
  const unreadMessagesCount = unreadMessagesCountQuery.data ?? 0;
118
123
  const profileCompletionQuery = useProfileCompletionQuery();
@@ -13,7 +13,6 @@ import { FaceIdIcon } from '../../icons/FaceIdIcon.js';
13
13
  import { FileCheck02Icon } from '../../icons/FileCheck02Icon.js';
14
14
  import { FileSearch02Icon } from '../../icons/FileSearch02Icon.js';
15
15
  import { FileX02Icon } from '../../icons/FileX02Icon.js';
16
- import { Globe05Icon } from '../../icons/Globe05Icon.js';
17
16
  import { Button } from '../../ui/Button/index.js';
18
17
  export function AccountVerification(props) {
19
18
  const globalStore = useGlobalStore(useShallow((ctx) => ({
@@ -30,7 +29,7 @@ export function AccountVerification(props) {
30
29
  verification?.status === 'UNVERIFIED';
31
30
  return (_jsxs("div", { className: props.className, children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Verify your identity" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "Complete personal verification to unlock all features and enhance account security." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountVerification
32
31
  ? 'text-text-success-primary'
33
- : 'text-text-warning-primary'), children: profileCompletion?.accountVerification ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("div", { className: "shadow-xs border-border-secondary bg-bg-primary-alt mt-5 rounded-xl border", children: [_jsx("div", { className: "px-4 py-5", children: _jsxs("ul", { className: "space-y-lg", children: [_jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FileCheck02Icon, {}), "Basic Information"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(Globe05Icon, {}), "Proof of address"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(CreditCard02Icon, {}), "Government ID"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FaceIdIcon, {}), "Facial Verification"] })] }) }), _jsx("div", { className: "border-border-secondary flex justify-end border-t px-4 py-3 lg:py-xl", children: (!verification || verification?.status === 'REJECTED') && (_jsx(Button, { size: "sm", className: "w-full lg:w-fit", onClick: () => globalStore.kyc.setOpen(true), children: "Verify Now" })) })] }), success && _jsx(VerificationSuccess, {}), pending && _jsx(VerificationInProgress, {}), failed && _jsx(VerificationFailed, {}), empty && _jsx(VerificationNotSubmitted, {})] }));
32
+ : 'text-text-warning-primary'), children: profileCompletion?.accountVerification ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("div", { className: "shadow-xs border-border-secondary bg-bg-primary-alt mt-5 rounded-xl border", children: [_jsx("div", { className: "px-4 py-5", children: _jsxs("ul", { className: "space-y-lg", children: [_jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FileCheck02Icon, {}), "Basic Information"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(CreditCard02Icon, {}), "Government ID"] }), _jsxs("li", { className: "text-text-secondary-700 icon:size-6 icon:text-text-nav-item-button-icon flex items-center gap-lg", children: [_jsx(FaceIdIcon, {}), "Facial Verification"] })] }) }), _jsx("div", { className: "border-border-secondary flex justify-end border-t px-4 py-3 lg:py-xl", children: (!verification || verification?.status === 'REJECTED') && (_jsx(Button, { size: "sm", className: "w-full lg:w-fit", onClick: () => globalStore.kyc.setOpen(true), children: "Verify Now" })) })] }), success && _jsx(VerificationSuccess, {}), pending && _jsx(VerificationInProgress, {}), failed && _jsx(VerificationFailed, {}), empty && _jsx(VerificationNotSubmitted, {})] }));
34
33
  }
35
34
  function VerificationNotSubmitted() {
36
35
  return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 flex flex-col gap-2 rounded-xl border p-xl lg:flex-row", children: [_jsx("div", { className: "border-text-warning-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-warning-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(AlertCircleIcon, { className: "text-text-warning-primary size-5" }) }) }), _jsx("p", { className: "text-text-tertiary-600 max-w-[800px] text-sm", children: "To serve you better and unlock all features, please provide valid identification documents. This helps protect your account and makes recovery easier if ever needed." })] }));
@@ -4,6 +4,7 @@ import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
4
4
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
5
5
  import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
6
6
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
7
+ import { KYC_PROMPT_LOCALSTORAGE_KEY } from '../../constants/index.js';
7
8
  export function AutoOpen() {
8
9
  const kycStore = useGlobalStore(useShallow((ctx) => ctx.kyc));
9
10
  const { data: session } = useSessionQuery();
@@ -12,11 +13,13 @@ export function AutoOpen() {
12
13
  const shouldOpen = !account?.realName ||
13
14
  !account?.birthDay ||
14
15
  !verification ||
15
- verification.status === 'REJECTED';
16
+ verification.status === 'REJECTED' ||
17
+ verification.status === 'UNVERIFIED';
16
18
  useEffect(() => {
17
19
  if (session?.status == 'authenticated' &&
18
20
  !kycStore['~touched'] &&
19
- shouldOpen) {
21
+ shouldOpen &&
22
+ localStorage.getItem(KYC_PROMPT_LOCALSTORAGE_KEY) == null) {
20
23
  kycStore.setOpen(true);
21
24
  return;
22
25
  }
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Image from 'next/image';
3
3
  import { useShallow } from 'zustand/shallow';
4
4
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
5
+ import { KYC_PROMPT_LOCALSTORAGE_KEY } from '../../constants/index.js';
5
6
  import { XIcon } from '../../icons/XIcon.js';
6
7
  import { Dialog } from '../../ui/Dialog/index.js';
7
8
  import { Portal } from '../../ui/Portal/index.js';
@@ -20,5 +21,8 @@ export function KYC(props) {
20
21
  const kyc = useKYC();
21
22
  return (_jsx(KYCContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open, onOpenChange: (details) => {
22
23
  globalStore.kyc.setOpen(details.open);
24
+ if (!details.open) {
25
+ localStorage.setItem(KYC_PROMPT_LOCALSTORAGE_KEY, '');
26
+ }
23
27
  }, lazyMount: true, unmountOnExit: true, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt lg:min-h-auto mx-auto min-h-full w-full lg:w-fit", children: [kyc.capturing === 'SELFIE' && _jsx(CaptureSelfie, {}), kyc.capturing === 'ID_DOCUMENT' && _jsx(CaptureIdDocument, {}), !kyc.capturing && (_jsxs("div", { className: "w-full p-3xl lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }))] }) })] }) }) }));
24
28
  }
@@ -5,5 +5,5 @@ import { Button } from '../../ui/Button/index.js';
5
5
  export function News({ news, viewDetailsUrl }) {
6
6
  return (_jsxs("div", { className: "bg-bg-primary-alt border-border-primary flex flex-col overflow-hidden rounded-2xl border shadow-md", children: [_jsx(Image, { src: news.image, alt: "", width: 400, height: 274, loading: "lazy", unoptimized: true, className: "block h-[15.25rem] w-full object-cover" }), _jsxs("div", { className: "flex grow flex-col p-3xl", children: [_jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-brand-400 text-sm font-semibold", children: news.category }), _jsx("h2", { className: "mt-2 line-clamp-1 text-lg font-semibold", children: news.title }), _jsx("p", { className: "text-text-tertiary-600 mt-xs line-clamp-3", dangerouslySetInnerHTML: {
7
7
  __html: news.content,
8
- } })] }), _jsx(Button, { asChild: true, className: "mt-2xl", children: _jsx(Link, { href: `${viewDetailsUrl}/${news.id}`, "aria-label": `Read more about ${news.title}`, children: "Read More" }) })] })] }, news.id));
8
+ } })] }), _jsx(Button, { asChild: true, className: "mt-2xl", children: _jsxs(Link, { href: `${viewDetailsUrl}/${news.id}`, children: ["Read More", _jsxs("span", { className: "sr-only", children: [" about ", news.title] })] }) })] })] }, news.id));
9
9
  }
@@ -14,5 +14,5 @@ export function Cashback({ data, viewDetailsUrl }) {
14
14
  return (_jsxs("div", { className: "border-border-secondary bg-accent-50 bg-bg-primary-alt relative flex h-full flex-col overflow-hidden rounded-2xl border", children: [data.banner.url && (_jsx(Image, { src: data.banner.url, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: "block aspect-[365/180] w-full object-cover" })), _jsxs("div", { className: "flex flex-grow flex-col px-4 pb-3xl pt-2xl", children: [_jsx("div", { className: "w-full grow text-center text-xl font-semibold", children: data.name }), _jsxs("div", { className: "mt-auto flex flex-col gap-3 pt-4 lg:flex-row", children: [claimable && (_jsx(Button, { size: "sm", onClick: () => {
15
15
  globalStore.depositWithdrawal.setOpen(true);
16
16
  globalStore.depositWithdrawal.setPromo(data.id);
17
- }, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { href: `${viewDetailsUrl}/${data.id}`, "aria-label": `Read more about ${data.name}`, children: "Read more" }) })] })] })] }));
17
+ }, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
18
18
  }
@@ -3,5 +3,5 @@ import Image from 'next/image';
3
3
  import Link from 'next/link';
4
4
  import { Button } from '../../ui/Button/index.js';
5
5
  export function CustomPromo({ data, viewDetailsUrl }) {
6
- return (_jsxs("div", { className: "border-border-secondary bg-accent-50 bg-bg-primary-alt relative flex h-full flex-col overflow-hidden rounded-2xl border", children: [_jsx(Image, { src: data.banner, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: "block aspect-[365/180] w-full object-cover" }), _jsxs("div", { className: "flex flex-grow flex-col px-4 pb-3xl pt-2xl", children: [_jsx("div", { className: "w-full grow text-center text-xl font-semibold", children: data.name }), _jsx("div", { className: "mt-auto flex flex-col gap-3 pt-4 lg:flex-row", children: _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { href: `${viewDetailsUrl}/${data.id}`, "aria-label": `Read more about ${data.name}`, children: "Read more" }) }) })] })] }));
6
+ return (_jsxs("div", { className: "border-border-secondary bg-accent-50 bg-bg-primary-alt relative flex h-full flex-col overflow-hidden rounded-2xl border", children: [_jsx(Image, { src: data.banner, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: "block aspect-[365/180] w-full object-cover" }), _jsxs("div", { className: "flex flex-grow flex-col px-4 pb-3xl pt-2xl", children: [_jsx("div", { className: "w-full grow text-center text-xl font-semibold", children: data.name }), _jsx("div", { className: "mt-auto flex flex-col gap-3 pt-4 lg:flex-row", children: _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) }) })] })] }));
7
7
  }
@@ -14,5 +14,5 @@ export function Promo({ data, viewDetailsUrl }) {
14
14
  return (_jsxs("div", { className: "border-border-secondary bg-accent-50 bg-bg-primary-alt relative flex h-full flex-col overflow-hidden rounded-2xl border", children: [data.banner.url && (_jsx(Image, { src: data.banner.url, alt: data.name, width: 400, height: 202, loading: "lazy", unoptimized: true, className: "block aspect-[365/180] w-full object-cover" })), _jsxs("div", { className: "flex flex-grow flex-col px-4 pb-3xl pt-2xl", children: [_jsx("div", { className: "w-full grow text-center text-xl font-semibold", children: data.name }), _jsxs("div", { className: "mt-auto flex flex-col gap-3 pt-4 lg:flex-row", children: [claimable && (_jsx(Button, { size: "sm", onClick: () => {
15
15
  globalStore.depositWithdrawal.setOpen(true);
16
16
  globalStore.depositWithdrawal.setPromo(data.id);
17
- }, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsx(Link, { href: `${viewDetailsUrl}/${data.id}`, "aria-label": `Read more about ${data.name}`, children: "Read more" }) })] })] })] }));
17
+ }, children: "Get bonus" })), _jsx(Button, { size: "sm", variant: "outline", asChild: true, children: _jsxs(Link, { href: `${viewDetailsUrl}/${data.id}`, children: ["Read more", _jsxs("span", { className: "sr-only", children: [" about ", data.name] })] }) })] })] })] }));
18
18
  }
@@ -131,7 +131,6 @@ export function SignUpForm() {
131
131
  const form2Ref = useRef(null);
132
132
  const birthDay = step1Form.watch('birthDay');
133
133
  const branchCode = step1Form.watch('branchCode', '');
134
- console.log(new URL(window.location.href).hostname);
135
134
  return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Create an account" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
136
135
  try {
137
136
  await sendVerificationCodeMutation.mutateAsync({
@@ -1,2 +1,3 @@
1
1
  export declare const ACCESS_TOKEN_COOKIE_NAME: string;
2
2
  export declare const REFRESH_TOKEN_COOKIE_NAME: string;
3
+ export declare const KYC_PROMPT_LOCALSTORAGE_KEY: string;
@@ -1,2 +1,3 @@
1
1
  export const ACCESS_TOKEN_COOKIE_NAME = 'WebPortalAuthAccessToken';
2
2
  export const REFRESH_TOKEN_COOKIE_NAME = 'WebPortalAuthRefreshToken';
3
+ export const KYC_PROMPT_LOCALSTORAGE_KEY = 'WebPortalKYCPrompted';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.164",
3
+ "version": "0.0.166",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",