@opexa/portal-components 0.0.40 → 0.0.41

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 (42) hide show
  1. package/dist/client/hooks/useGlobalStore.d.ts +1 -2
  2. package/dist/client/hooks/useGlobalStore.js +19 -36
  3. package/dist/components/Account/Account.d.ts +1 -7
  4. package/dist/components/Account/Account.js +15 -40
  5. package/dist/components/AccountInfo/AccountInfo.js +20 -3
  6. package/dist/components/AccountSecurity/AccountSecurity.js +14 -6
  7. package/dist/components/AccountVerification/VerificationDetails.js +6 -6
  8. package/dist/components/DepositWithdrawal/AmountChoices.js +1 -1
  9. package/dist/components/DepositWithdrawal/Deposit/AvailablePromos.js +21 -16
  10. package/dist/components/DepositWithdrawal/Deposit/GCashDeposit/GCashDeposit.js +4 -23
  11. package/dist/components/DepositWithdrawal/Deposit/MayaAppDeposit/MayaAppDeposit.js +4 -23
  12. package/dist/components/DepositWithdrawal/Deposit/MayaDeposit/MayaDeposit.js +4 -23
  13. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositForm.js +5 -24
  14. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositForm.js +4 -23
  15. package/dist/components/DepositWithdrawal/DepositWithdrawal.js +3 -3
  16. package/dist/components/DepositWithdrawal/PaymentMethods.js +2 -2
  17. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +27 -20
  18. package/dist/components/GameLaunch/GameLaunch.js +33 -57
  19. package/dist/components/KYC/KYC.d.ts +1 -0
  20. package/dist/components/KYC/KYC.js +3 -0
  21. package/dist/components/KYC/index.d.ts +1 -0
  22. package/dist/components/KYC/index.js +1 -0
  23. package/dist/components/Messages/MessageItem.js +12 -7
  24. package/dist/components/Messages/MessagePopup.js +8 -7
  25. package/dist/components/PortalProvider/PortalProvider.d.ts +2 -2
  26. package/dist/components/PortalProvider/PortalProvider.js +8 -5
  27. package/dist/components/PortalProvider/Providers.d.ts +4 -0
  28. package/dist/components/PortalProvider/Providers.js +12 -0
  29. package/dist/components/PortalProvider/Snackbar.d.ts +1 -0
  30. package/dist/components/PortalProvider/Snackbar.js +21 -0
  31. package/dist/components/PortalProvider/WebVitals.d.ts +1 -0
  32. package/dist/components/PortalProvider/WebVitals.js +8 -0
  33. package/dist/components/index.d.ts +1 -0
  34. package/dist/components/index.js +1 -0
  35. package/dist/images/gift.png +0 -0
  36. package/dist/tsconfig.build.tsbuildinfo +1 -1
  37. package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
  38. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
  39. package/dist/ui/AlertDialog/alertDialog.recipe.js +4 -4
  40. package/dist/ui/Button/button.recipe.js +1 -1
  41. package/dist/ui/Checkbox/checkbox.recipe.js +2 -2
  42. package/package.json +2 -1
@@ -39,7 +39,6 @@ interface MessageStore extends PopupStore {
39
39
  interface MessagesStore extends PopupStore {
40
40
  tab: MessagesTab;
41
41
  setTab: (tab: MessagesTab) => void;
42
- message: MessageStore;
43
42
  }
44
43
  interface DepositWithdrawalStore extends PopupStore {
45
44
  tab: DepositWithdrawalTab;
@@ -54,8 +53,8 @@ interface GlobalStore {
54
53
  gamesSearch: GamesSearchStore;
55
54
  account: PopupStore;
56
55
  account__mobile: PopupStore;
57
- accountSettings: CollapsibleStore;
58
56
  messages: MessagesStore;
57
+ message: MessageStore;
59
58
  sidebar: CollapsibleStore;
60
59
  kyc: PopupStore;
61
60
  }
@@ -86,17 +86,6 @@ export const useGlobalStore = create((set) => ({
86
86
  }));
87
87
  },
88
88
  },
89
- accountSettings: {
90
- collapsed: true,
91
- setCollapsed(collapsed) {
92
- set((prev) => ({
93
- accountSettings: {
94
- ...prev.accountSettings,
95
- collapsed,
96
- },
97
- }));
98
- },
99
- },
100
89
  messages: {
101
90
  open: false,
102
91
  setOpen(open) {
@@ -116,31 +105,25 @@ export const useGlobalStore = create((set) => ({
116
105
  },
117
106
  }));
118
107
  },
119
- message: {
120
- data: null,
121
- open: false,
122
- setOpen(open) {
123
- set((prev) => ({
124
- messages: {
125
- ...prev.messages,
126
- message: {
127
- ...prev.messages.message,
128
- open,
129
- },
130
- },
131
- }));
132
- },
133
- setData(content) {
134
- set((prev) => ({
135
- messages: {
136
- ...prev.messages,
137
- message: {
138
- ...prev.messages.message,
139
- data: content,
140
- },
141
- },
142
- }));
143
- },
108
+ },
109
+ message: {
110
+ data: null,
111
+ open: false,
112
+ setOpen(open) {
113
+ set((prev) => ({
114
+ message: {
115
+ ...prev.message,
116
+ open,
117
+ },
118
+ }));
119
+ },
120
+ setData(content) {
121
+ set((prev) => ({
122
+ message: {
123
+ ...prev.message,
124
+ data: content,
125
+ },
126
+ }));
144
127
  },
145
128
  },
146
129
  gamesSearch: {
@@ -18,12 +18,6 @@ export interface AccountProps {
18
18
  /** @default '/transactions' */
19
19
  transactionsUrl?: string;
20
20
  /** @default '/account' */
21
- accountInfoUrl?: string;
22
- /** @default '/account/security' */
23
- accountSecurityUrl?: string;
24
- /** @default '/account/verification' */
25
- accountVerificationUrl?: string;
26
- /** @default '/account/payment-methods' */
27
- accountPaymentMethodsUrl?: string;
21
+ accountSettingsUrl?: string;
28
22
  }
29
23
  export declare function Account(props: AccountProps): import("react/jsx-runtime").JSX.Element;
@@ -5,9 +5,9 @@ import Image from 'next/image';
5
5
  import Link from 'next/link';
6
6
  import { useShallow } from 'zustand/shallow';
7
7
  import { useAccountQuery, useGlobalStore, useLocaleInfo, useSignOutMutation, useUnreadMessagesCountQuery, useWalletQuery, } from '../../client/hooks/index.js';
8
- import { AlertCircleIcon, ChevronLeftIcon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, CreditCard02Icon, FileCheck02Icon, Gift01Icon, Lock01Icon, Logout01Icon, Settings02Icon, User01Icon, XIcon, } from '../../icons/index.js';
8
+ import { AlertCircleIcon, ChevronRightIcon, CoinsStacked02Icon, CoinsSwap02Icon, Gift01Icon, Logout01Icon, Settings02Icon, XIcon, } from '../../icons/index.js';
9
9
  import avatarPlaceholder from '../../images/placeholder-avatar.png';
10
- import { Badge, Button, Drawer, IconButton, Popover, Presence } from '../../ui/index.js';
10
+ import { Badge, Button, Drawer, IconButton, Popover } from '../../ui/index.js';
11
11
  import { formatNumber, parseDecimal } from '../../utils/index.js';
12
12
  import { accountRecipe } from './account.recipe.js';
13
13
  const recipe = accountRecipe();
@@ -15,25 +15,26 @@ export function Account(props) {
15
15
  const globalStore = useGlobalStore(useShallow((ctx) => ({
16
16
  account: ctx.account,
17
17
  account__mobile: ctx.account__mobile,
18
- accountSettings: ctx.accountSettings,
19
18
  })));
19
+ const rewardsUrl = props.rewardsUrl ?? '/rewards';
20
+ const betRecordsUrl = props.betRecordsUrl ?? '/bet-records';
21
+ const transactionsUrl = props.transactionsUrl ?? '/transactions';
22
+ const accountSettingsUrl = props.accountSettingsUrl ?? '/account';
20
23
  return (_jsxs(_Fragment, { children: [_jsxs(Drawer.Root, { open: globalStore.account__mobile.open, onOpenChange: (details) => {
21
24
  globalStore.account__mobile.setOpen(details.open);
22
- globalStore.accountSettings.setCollapsed(true);
23
25
  }, lazyMount: true, unmountOnExit: true, children: [_jsx(Drawer.Trigger, { asChild: true, className: "lg:hidden", children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: globalStore.account__mobile.open ? (_jsx(XIcon, {})) : (_jsx(Image, { src: avatarPlaceholder, alt: "", width: 100, height: 100, className: "size-10" })) })) }), _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsxs(Drawer.Content, { className: "relative top-[var(--top,0px)] flex h-[calc(100%-var(--top,0px))] w-full flex-col px-xl py-6", style: {
24
26
  ['--top']: props.offsetTop ?? '0px',
25
- }, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: props.rewardsUrl, betRecordsUrl: props.betRecordsUrl, transactionsUrl: props.transactionsUrl }), _jsx(AccountSettingsMenu, { accountInfoUrl: props.accountInfoUrl, accountSecurityUrl: props.accountSecurityUrl, accountVerificationUrl: props.accountVerificationUrl, accountPaymentMethodsUrl: props.accountPaymentMethodsUrl })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
27
+ }, children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl })] }) }) })] }), _jsxs(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
26
28
  globalStore.account.setOpen(details.open);
27
- globalStore.accountSettings.setCollapsed(true);
28
29
  }, lazyMount: true, unmountOnExit: true, positioning: {
29
30
  placement: 'bottom',
30
31
  strategy: 'fixed',
31
- }, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: props.rewardsUrl, betRecordsUrl: props.betRecordsUrl, transactionsUrl: props.transactionsUrl }), _jsx(AccountSettingsMenu, { accountInfoUrl: props.accountInfoUrl, accountSecurityUrl: props.accountSecurityUrl, accountVerificationUrl: props.accountVerificationUrl, accountPaymentMethodsUrl: props.accountPaymentMethodsUrl })] }) }) })] })] }));
32
+ }, children: [_jsx(Popover.Trigger, { className: "hidden lg:flex", asChild: true, children: props.children ?? (_jsx(IconButton, { size: "sm", colorScheme: "gray", children: _jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-10" }) })) }), _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "border-border-primary bg-bg-primary relative z-popover w-[23.438rem] overflow-hidden rounded-xl border p-xl ui-open:animate-fade-in ui-closed:animate-fade-out", children: [_jsx(Profile, {}), _jsx(Wallet, {}), _jsx(Links, { rewardsUrl: rewardsUrl, betRecordsUrl: betRecordsUrl, transactionsUrl: transactionsUrl, accountSettingsUrl: accountSettingsUrl })] }) }) })] })] }));
32
33
  }
33
34
  function Profile() {
34
35
  const accountQuery = useAccountQuery();
35
36
  const account = accountQuery.data;
36
- return (_jsxs("div", { className: "flex shrink-0 items-center gap-lg", children: [_jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-12" }), _jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-text-secondary-700 font-semibold leading-tight", children: account?.name }), _jsx("p", { className: "text-text-tertiary-600 leading-tight", children: account?.nickName ?? account?.emailAddress ?? account?.realName })] }), _jsxs(Badge.Root, { colorScheme: account?.verified ? 'success' : 'danger', className: "self-start", children: [_jsx(Badge.Indicator, {}), _jsx(Badge.Label, { children: account?.verified ? 'Verified' : 'Unverified' })] })] }));
37
+ return (_jsxs("div", { className: "flex shrink-0 items-center gap-lg", children: [_jsx(Image, { src: avatarPlaceholder, alt: "", width: 48, height: 48, className: "size-12" }), _jsxs("div", { className: "grow", children: [_jsx("p", { className: "text-text-secondary-700 font-semibold leading-tight", children: account?.name }), _jsxs("div", { className: "flex", children: [_jsx("p", { className: "text-text-tertiary-600 grow items-center leading-tight", children: account?.id }), _jsxs(Badge.Root, { colorScheme: account?.verified ? 'success' : 'danger', className: "self-start", children: [_jsx(Badge.Indicator, {}), _jsx(Badge.Label, { children: account?.verified ? 'Verified' : 'Unverified' })] })] })] })] }));
37
38
  }
38
39
  function Wallet() {
39
40
  const localeInfo = useLocaleInfo();
@@ -74,7 +75,6 @@ function Links(props) {
74
75
  const globalStore = useGlobalStore(useShallow((ctx) => ({
75
76
  account: ctx.account,
76
77
  account__mobile: ctx.account__mobile,
77
- accountSettings: ctx.accountSettings,
78
78
  messages: ctx.messages,
79
79
  })));
80
80
  const unreadMessagesCountQuery = useUnreadMessagesCountQuery({}, { refetchInterval: 5000 });
@@ -82,15 +82,16 @@ function Links(props) {
82
82
  globalStore.account.setOpen(false);
83
83
  globalStore.account__mobile.setOpen(false);
84
84
  globalStore.messages.setOpen(true);
85
- }, children: [_jsx(Logout01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCountQuery.data ?? 0 }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.rewardsUrl ?? '/rewards', className: recipe.navItemLink(), onClick: () => {
85
+ }, children: [_jsx(Logout01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCountQuery.data ?? 0 }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.rewardsUrl, className: recipe.navItemLink(), onClick: () => {
86
86
  globalStore.account.setOpen(false);
87
87
  globalStore.account__mobile.setOpen(false);
88
- }, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs("button", { type: "button", className: recipe.navItemLink(), onClick: () => {
89
- globalStore.accountSettings.setCollapsed(false);
90
- }, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) }), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl ?? '/bet-records', className: recipe.navItemLink(), onClick: () => {
88
+ }, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: "0" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
89
+ globalStore.account.setOpen(false);
90
+ globalStore.account__mobile.setOpen(false);
91
+ }, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), _jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) }), _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
91
92
  globalStore.account.setOpen(false);
92
93
  globalStore.account__mobile.setOpen(false);
93
- }, children: [_jsx(CoinsStacked02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.transactionsUrl ?? '/transactions', className: recipe.navItemLink(), onClick: () => {
94
+ }, children: [_jsx(CoinsStacked02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.transactionsUrl, className: recipe.navItemLink(), onClick: () => {
94
95
  globalStore.account.setOpen(false);
95
96
  globalStore.account__mobile.setOpen(false);
96
97
  }, children: [_jsx(CoinsSwap02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Transactions" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { children: _jsx("li", { className: recipe.navItemRoot(), children: _jsxs("button", { type: "button", className: recipe.navItemLink(), disabled: signOutMutation.isPending, onClick: () => {
@@ -99,29 +100,3 @@ function Links(props) {
99
100
  globalStore.account__mobile.setOpen(false);
100
101
  }, children: [_jsx(Logout01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Log Out" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) })] }));
101
102
  }
102
- function AccountSettingsMenu(props) {
103
- const globalStore = useGlobalStore(useShallow((ctx) => ({
104
- account: ctx.account,
105
- account__mobile: ctx.account__mobile,
106
- accountSettings: ctx.accountSettings,
107
- })));
108
- return (_jsxs(Presence, { present: !globalStore.accountSettings.collapsed, lazyMount: true, className: "bg-bg-primary ui-open:animate-slide-in-right ui-closed:animate-slide-out-right absolute left-0 top-0 size-full overflow-y-auto", children: [_jsxs("div", { className: "bg-bg-primary-alt flex items-center gap-xl px-xl py-md", children: [_jsx(IconButton, { size: "2xs", variant: "outline", colorScheme: "gray", onClick: () => {
109
- globalStore.accountSettings.setCollapsed(true);
110
- }, children: _jsx(ChevronLeftIcon, {}) }), _jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: "Settings" })] }), _jsx("nav", { className: recipe.nav({ className: 'p-4' }), children: _jsxs("ul", { children: [_jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountInfoUrl ?? '/account', className: recipe.navItemLink(), onClick: () => {
111
- globalStore.account.setOpen(false);
112
- globalStore.account__mobile.setOpen(false);
113
- globalStore.accountSettings.setCollapsed(true);
114
- }, children: [_jsx(User01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Account Info" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountSecurityUrl ?? '/account/security', className: recipe.navItemLink(), onClick: () => {
115
- globalStore.account.setOpen(false);
116
- globalStore.account__mobile.setOpen(false);
117
- globalStore.accountSettings.setCollapsed(true);
118
- }, children: [_jsx(Lock01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Security" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountVerificationUrl ?? '/account/verification', className: recipe.navItemLink(), onClick: () => {
119
- globalStore.account.setOpen(false);
120
- globalStore.account__mobile.setOpen(false);
121
- globalStore.accountSettings.setCollapsed(true);
122
- }, children: [_jsx(FileCheck02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Personal Verification" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), children: _jsxs(Link, { href: props.accountPaymentMethodsUrl ?? '/account/payment-methods', className: recipe.navItemLink(), onClick: () => {
123
- globalStore.account.setOpen(false);
124
- globalStore.account__mobile.setOpen(false);
125
- globalStore.accountSettings.setCollapsed(true);
126
- }, children: [_jsx(CreditCard02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Payment Methods" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }) })] }));
127
- }
@@ -3,16 +3,33 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { format } from 'date-fns';
4
4
  import { noop } from 'lodash-es';
5
5
  import Image from 'next/image';
6
+ import { twMerge } from 'tailwind-merge';
6
7
  import { useAccountQuery, useLocaleInfo, useMobileNumberParser, } from '../../client/hooks/index.js';
7
8
  import { FacebookIcon, GoogleIcon } from '../../icons/index.js';
8
9
  import avatar from '../../images/placeholder-avatar.png';
9
10
  import { Button, Field, IconButton } from '../../ui/index.js';
10
11
  export function AccountInfo(props) {
12
+ return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(ProfileInfo, {}), _jsx(ContactInfo, {}), _jsx(PersonalInfo, {}), _jsx(SSO, {})] }));
13
+ }
14
+ function ProfileInfo() {
15
+ const accountQuery = useAccountQuery();
16
+ const account = accountQuery.data;
17
+ return (_jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Profile Info" }), _jsxs("div", { className: "bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsx("div", { className: "border-border-secondary border-b px-4 py-5", children: _jsxs("div", { className: "flex items-center gap-xl", children: [_jsx(Image, { src: avatar, alt: "", width: 80, height: 80, className: "size-14 shrink-0 rounded-md object-cover" }), _jsxs("div", { children: [_jsx("h3", { className: "text-text-secondary-700 text-lg font-semibold leading-tight", children: account?.name }), _jsx("p", { className: "text-text-tertiary-600 leading-tight", children: account?.id })] })] }) }), _jsx("div", { className: "flex justify-end px-xl py-lg", children: _jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Upload New Avatar" }) })] })] }));
18
+ }
19
+ function PersonalInfo() {
20
+ const accountQuery = useAccountQuery();
21
+ const account = accountQuery.data;
22
+ return (_jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Personal Data" }), _jsxs("form", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Real name" }), _jsx(Field.Input, { value: account?.realName ?? '', onChange: noop, readOnly: true })] }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", value: account?.birthDay ? format(account.birthDay, 'yyyy-MM-dd') : '', readOnly: true })] })] }), _jsxs("div", { className: "border-border-secondary flex justify-end gap-lg border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Cancel" }), _jsx(Button, { size: "sm", fullWidth: false, children: "Save Changes" })] })] })] }));
23
+ }
24
+ function ContactInfo() {
11
25
  const localeInfo = useLocaleInfo();
12
26
  const accountQuery = useAccountQuery();
13
27
  const account = accountQuery.data;
14
28
  const mobileNumberParser = useMobileNumberParser();
15
- return (_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Profile Info" }), _jsxs("div", { className: "bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsx("div", { className: "border-border-secondary border-b px-4 py-5", children: _jsxs("div", { className: "flex items-center gap-xl", children: [_jsx(Image, { src: avatar, alt: "", width: 80, height: 80, className: "size-14 shrink-0 rounded-md object-cover" }), _jsxs("div", { children: [_jsx("h3", { className: "text-text-secondary-700 text-lg font-semibold leading-tight", children: account?.name }), _jsx("p", { className: "text-text-tertiary-600 leading-tight", children: account?.emailAddress ?? account?.nickName })] })] }) }), _jsx("div", { className: "flex justify-end px-xl py-lg", children: _jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Upload New Avatar" }) })] }), _jsx("h2", { className: "text-text-secondary-700 mt-6 text-sm font-semibold", children: "Contact Info" }), _jsxs("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "pointer-events-none absolute left-3.5 top-1/2 size-5 -translate-y-1/2" }), _jsx(Field.Input, { className: "pl-10.5", value: account?.mobileNumber
16
- ? mobileNumberParser.format(account?.mobileNumber)
17
- : '', readOnly: true, onChange: noop })] })] }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { defaultValue: account?.emailAddress ?? '' })] })] }), _jsx("h2", { className: "text-text-secondary-700 mt-6 text-sm font-semibold", children: "Personal Data" }), _jsxs("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Real name" }), _jsx(Field.Input, { value: account?.realName ?? '', onChange: noop, readOnly: true })] }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", value: account?.birthDay ? format(account.birthDay, 'yyyy-MM-dd') : '', readOnly: true })] })] }), _jsx("h2", { className: "text-text-secondary-700 mt-6 text-sm font-semibold", children: "Account Connections" }), _jsxs("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: [_jsxs("div", { className: "flex items-center", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(GoogleIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium leading-tight", children: "Google" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-xs leading-tight", children: "Not Connected" })] })] }), _jsx(Button, { fullWidth: false, children: "Connect" })] }), _jsxs("div", { className: "mt-6 flex items-center", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(FacebookIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium leading-tight", children: "Facebook" }), _jsx("p", { className: "text-text-success-primary-600 mt-xs text-xs leading-tight", children: "Connected" })] })] }), _jsx("button", { className: "text-button-tertiary-error-fg text-sm font-semibold", children: "Disconnect" })] })] })] }));
29
+ return (_jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Contact Info" }), _jsxs("form", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "pointer-events-none absolute left-3.5 top-1/2 size-5 -translate-y-1/2" }), _jsx(Field.Input, { className: "pl-10.5", value: account?.mobileNumber
30
+ ? mobileNumberParser.format(account?.mobileNumber)
31
+ : '', readOnly: true, onChange: noop })] })] }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Email address" }), _jsx(Field.Input, { defaultValue: account?.emailAddress ?? '' })] })] }), _jsxs("div", { className: "border-border-secondary flex justify-end gap-lg border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Cancel" }), _jsx(Button, { size: "sm", fullWidth: false, children: "Save Changes" })] })] })] }));
32
+ }
33
+ function SSO() {
34
+ return (_jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Account Connections" }), _jsxs("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: [_jsxs("div", { className: "flex items-center", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(GoogleIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium leading-tight", children: "Google" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-xs leading-tight", children: "Not Connected" })] })] }), _jsx(Button, { fullWidth: false, children: "Connect" })] }), _jsxs("div", { className: "mt-6 flex items-center", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(FacebookIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-medium leading-tight", children: "Facebook" }), _jsx("p", { className: "text-text-success-primary-600 mt-xs text-xs leading-tight", children: "Connected" })] })] }), _jsx("button", { className: "text-button-tertiary-error-fg text-sm font-semibold", children: "Disconnect" })] })] })] }));
18
35
  }
@@ -4,17 +4,25 @@ import { ark, createListCollection, Portal } from '@ark-ui/react';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { useProfileCompletionQuery } from '../../client/hooks/index.js';
6
6
  import { AlertCircleIcon, CheckIcon, CheckVerified02Icon, ChevronDownIcon, EyeIcon, EyeOffIcon, } from '../../icons/index.js';
7
- import { Field, PasswordInput, Select } from '../../ui/index.js';
7
+ import { Button, Field, PasswordInput, Select } from '../../ui/index.js';
8
8
  export function AccountSecurity(props) {
9
+ return (_jsxs("div", { className: twMerge('space-y-3xl', props.className), children: [_jsx(LoginPassword, {}), _jsx(TransactionPassword, {})] }));
10
+ }
11
+ function LoginPassword() {
9
12
  const profileCompletionQuery = useProfileCompletionQuery();
10
13
  const profileCompletion = profileCompletionQuery.data;
11
- 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: "Log in password" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "Access your account by logging in with your name and password." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountPassword
14
+ return (_jsxs("div", { 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: "Log in password" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "Access your account by logging in with your name and password." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountPassword
12
15
  ? 'text-text-success-primary'
13
- : 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: [_jsx(Field.Root, { children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, {}), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }) }), _jsx(Field.Root, { className: "mt-6", children: _jsxs(Select.Root, { collection: secretQuestionCollection, lazyMount: true, positioning: {
14
- sameWidth: true,
15
- }, children: [_jsx(Select.Label, { children: "Security Question" }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, { placeholder: "Game Vendor" }), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: secretQuestionCollection.items.map((provider) => (_jsxs(Select.Item, { item: provider, children: [_jsx(Select.ItemText, { children: secretQuestionCollection.stringifyItem(provider) }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, provider))) }) }) }) })] }) }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Answer" }), _jsx(Field.Input, {})] })] }), _jsxs("div", { className: "mt-6 flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Transaction password" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "The transaction password secures and confirms your wallet withdrawals." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountPassword
16
+ : 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsx(Field.Root, { children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, {}), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }) }), _jsx(Field.Root, { className: "mt-6", children: _jsxs(Select.Root, { collection: secretQuestionCollection, lazyMount: true, positioning: {
17
+ sameWidth: true,
18
+ }, children: [_jsx(Select.Label, { children: "Security Question" }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, { placeholder: "Game Vendor" }), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Portal, { children: _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: secretQuestionCollection.items.map((provider) => (_jsxs(Select.Item, { item: provider, children: [_jsx(Select.ItemText, { children: secretQuestionCollection.stringifyItem(provider) }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, provider))) }) }) }) })] }) }), _jsxs(Field.Root, { className: "mt-6", children: [_jsx(Field.Label, { children: "Answer" }), _jsx(Field.Input, {})] })] }), _jsxs("div", { className: "border-border-secondary flex justify-end gap-lg border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Cancel" }), _jsx(Button, { size: "sm", fullWidth: false, children: "Save Changes" })] })] })] }));
19
+ }
20
+ function TransactionPassword() {
21
+ const profileCompletionQuery = useProfileCompletionQuery();
22
+ const profileCompletion = profileCompletionQuery.data;
23
+ return (_jsxs("div", { 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: "Transaction password" }), _jsx("p", { className: "text-text-tertiary-600 text-sm", children: "The transaction password secures and confirms your wallet withdrawals." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountPassword
16
24
  ? 'text-text-success-primary'
17
- : 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsx("div", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border px-4 py-5", children: _jsx(Field.Root, { children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, {}), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }) }) })] }));
25
+ : 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "shadow-xs bg-bg-primary-alt border-border-secondary mt-5 rounded-xl border", children: [_jsxs("div", { className: "px-xl py-5 lg:px-3xl lg:py-5", children: [_jsx(Field.Root, { children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, {}), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }) }), _jsx(Field.Root, { className: "mt-6", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Confirm Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, {}), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }) })] }), _jsxs("div", { className: "border-border-secondary flex justify-end gap-lg border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Cancel" }), _jsx(Button, { size: "sm", fullWidth: false, children: "Save Changes" })] })] })] }));
18
26
  }
19
27
  const SECRET_QUESTIONS = [
20
28
  'BEST_CHILDHOOD_FRIEND',
@@ -20,19 +20,19 @@ export function VerificationDetails() {
20
20
  return null;
21
21
  return (_jsxs(_Fragment, { 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
22
22
  ? 'text-text-success-primary'
23
- : '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 border-t px-4 py-3", children: _jsx(Button, { size: "sm", onClick: () => {
23
+ : '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: _jsx(Button, { size: "sm", onClick: () => {
24
24
  context.setStarted(true);
25
- }, children: "Verify Now" }) })] }), success && _jsx(VerificationSuccess, {}), pending && _jsx(VerificationInProgress, {}), failed && _jsx(VerificationFailed, {}), empty && _jsx(VerificationNotSubmitted, {})] }));
25
+ }, className: "w-full lg:w-fit", children: "Verify Now" }) })] }), success && _jsx(VerificationSuccess, {}), pending && _jsx(VerificationInProgress, {}), failed && _jsx(VerificationFailed, {}), empty && _jsx(VerificationNotSubmitted, {})] }));
26
26
  }
27
27
  function VerificationNotSubmitted() {
28
- return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 rounded-xl border p-xl", 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 mt-2 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." })] }));
28
+ 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." })] }));
29
29
  }
30
30
  function VerificationInProgress() {
31
- return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 rounded-xl border p-xl", 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(FileSearch02Icon, { className: "text-text-warning-primary size-5" }) }) }), _jsx("h2", { className: "text-text-secondary-700 mt-2 text-sm font-semibold", children: "Under review" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs 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." })] }));
31
+ 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(FileSearch02Icon, { className: "text-text-warning-primary size-5" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Under review" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs 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." })] })] }));
32
32
  }
33
33
  function VerificationSuccess() {
34
- return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 rounded-xl border p-xl", children: [_jsx("div", { className: "border-text-success-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-success-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(FileCheck02Icon, { className: "text-text-success-primary size-5" }) }) }), _jsx("h2", { className: "text-text-secondary-700 mt-2 text-sm font-semibold", children: "Verification successful" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm", children: "Your account has been successfully verified. You now have full access to all features and improved account security." })] }));
34
+ 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-success-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-success-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(FileCheck02Icon, { className: "text-text-success-primary size-5" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Verification successful" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm", children: "Your account has been successfully verified. You now have full access to all features and improved account security." })] })] }));
35
35
  }
36
36
  function VerificationFailed() {
37
- return (_jsxs("div", { className: "shadow-xs border-border-primary bg-bg-primary-alt mt-6 rounded-xl border p-xl", children: [_jsx("div", { className: "border-text-error-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-error-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(FileX02Icon, { className: "text-text-error-primary size-5" }) }) }), _jsx("h2", { className: "text-text-secondary-700 mt-2 text-sm font-semibold", children: "Verification failed" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm", children: "There was an issue with the verification process. Please try again or contact support for assistance." })] }));
37
+ 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-error-primary/10 flex size-[2.1875rem] items-center justify-center rounded-full border-2", children: _jsx("div", { className: "border-text-error-primary/30 flex size-[1.666625rem] items-center justify-center rounded-full border-2", children: _jsx(FileX02Icon, { className: "text-text-error-primary size-5" }) }) }), _jsxs("div", { children: [_jsx("h2", { className: "text-text-secondary-700 text-sm font-semibold", children: "Verification failed" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-sm", children: "There was an issue with the verification process. Please try again or contact support for assistance." })] })] }));
38
38
  }
@@ -17,7 +17,7 @@ export function AmountChoices(props) {
17
17
  });
18
18
  return (_jsx("div", { className: twMerge('grid grid-cols-4 gap-2', props.className), children: options.map((option) => (_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
19
19
  setValue(option);
20
- }, disabled: min > option || max < option, "data-selected": dataAttr(value === option), children: formatNumber(option, {
20
+ }, disabled: min > option || max < option, className: "ui-selected:border-button-primary-border ui-selected:bg-button-primary-bg ui-selected:text-button-primary-fg", "data-selected": dataAttr(value === option), children: formatNumber(option, {
21
21
  currency: localeInfo.currency.code,
22
22
  minDecimalPlaces: 0,
23
23
  maxDecimalPlaces: 0,
@@ -1,16 +1,11 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Carousel } from '@ark-ui/react';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createListCollection } from '@ark-ui/react';
3
3
  import Image from 'next/image';
4
- import Link from 'next/link';
5
- import { twMerge } from 'tailwind-merge';
6
- import { useShallow } from 'zustand/shallow';
7
- import { useAvailablePromosQuery, useControllableState, useGlobalStore, } from '../../../client/hooks/index.js';
8
- import { CheckIcon, ChevronLeftIcon, ChevronRightIcon } from '../../../icons/index.js';
9
- import { Checkbox, IconButton } from '../../../ui/index.js';
4
+ import { useAvailablePromosQuery, useControllableState, } from '../../../client/hooks/index.js';
5
+ import { CheckIcon, ChevronDownIcon } from '../../../icons/index.js';
6
+ import gift from '../../../images/gift.png';
7
+ import { Select } from '../../../ui/index.js';
10
8
  export function AvailablePromos(props) {
11
- const globalStore = useGlobalStore(useShallow((ctx) => ({
12
- depositWithdrawal: ctx.depositWithdrawal,
13
- })));
14
9
  const query = useAvailablePromosQuery();
15
10
  const promos = query.data ?? [];
16
11
  const [value, setValue] = useControllableState({
@@ -18,9 +13,19 @@ export function AvailablePromos(props) {
18
13
  defaultValue: props.defaultValue ?? null,
19
14
  onChange: props.onChange,
20
15
  });
21
- return (_jsxs(Carousel.Root, { slideCount: promos.length, className: props.className, spacing: "16px", slidesPerPage: 2, children: [_jsxs("div", { className: "flex items-center gap-xl", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "text-lg font-semibold leading-tight", children: "Available Promotions" }), _jsx("p", { className: "text-gray-500 mt-1 text-sm leading-tight", children: "Select a promotion with your deposit. Only one can be active at a time." })] }), _jsxs(Carousel.Control, { children: [_jsx(Carousel.PrevTrigger, { asChild: true, children: _jsx(IconButton, { variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", children: _jsx(ChevronLeftIcon, {}) }) }), _jsx(Carousel.NextTrigger, { asChild: true, children: _jsx(IconButton, { variant: "outline", colorScheme: "gray", className: "rounded-l-none", children: _jsx(ChevronRightIcon, {}) }) })] })] }), _jsx(Carousel.ItemGroup, { className: "mt-3xl", children: promos.map((promo, index) => (_jsx(Carousel.Item, { index: index, children: _jsxs("div", { className: "relative select-none p-0.5", children: [_jsx("div", { className: twMerge('block rounded-lg', promo.id === value && 'ring-gray-500/25 ring-2'), children: promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: "", width: 288, height: 184, className: "rounded-lg" })) }), _jsxs(Checkbox.Root, { checked: promo.id === value, onCheckedChange: (details) => {
22
- setValue(details.checked ? promo.id : null);
23
- }, className: "absolute right-3 top-3 rounded-md border border-white/50 bg-white/60 p-lg backdrop-blur-sm", children: [_jsx(Checkbox.Control, { className: "bg-white", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Link, { href: `/promos/${promo.id}`, className: "absolute bottom-3 right-3 rounded-md border border-white/50 bg-white/60 px-lg py-md text-sm font-semibold backdrop-blur-sm", onClick: () => {
24
- globalStore.depositWithdrawal.setOpen(false);
25
- }, children: "Promo Details" })] }) }, promo.id))) })] }));
16
+ const collection = createListCollection({
17
+ items: promos,
18
+ itemToValue: (item) => item.id,
19
+ itemToString: (item) => item.name,
20
+ });
21
+ return (_jsxs(Select.Root, { collection: collection, lazyMount: true, positioning: {
22
+ sameWidth: true,
23
+ }, value: value ? [value] : [], onValueChange: (details) => {
24
+ const value = details.value.at(0);
25
+ setValue(value ?? null);
26
+ }, className: props.className, children: [_jsx(Select.Label, { children: "Choose a bonus" }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, { placeholder: "Pay without bonus" }), _jsx(Select.Context, { children: (api) => (_jsx(_Fragment, { children: api.value.length ? (_jsx(Select.ClearTrigger, { asChild: true, children: _jsx("span", { onClick: (e) => {
27
+ e.stopPropagation();
28
+ }, children: "Clear" }) })) : (_jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })) })) })] }), _jsx(Select.Positioner, { children: _jsxs(Select.Content, { children: [collection.items.length <= 0 && (_jsxs("div", { className: "p-2", children: [_jsx(Image, { src: gift, alt: "", width: 160, height: 160, className: "mx-auto size-[8.313rem] grayscale" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-1 max-w-[20rem] text-center text-sm", children: "No Bonuses are available at the moment. Please check back later!" })] })), collection.items.length > 0 && (_jsx(Select.ItemGroup, { children: collection.items.map((promo) => (_jsxs(Select.Item, { item: promo, children: [_jsxs(Select.ItemText, { children: [_jsx("span", { className: "block font-medium", children: promo.name }), _jsx("span", { className: "text-text-warning-primary-600 line-clamp-1 block", dangerouslySetInnerHTML: {
29
+ __html: promo.description,
30
+ } })] }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, promo.id))) }))] }) })] }));
26
31
  }
@@ -1,20 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Portal } from '@ark-ui/react';
3
2
  import { zodResolver } from '@hookform/resolvers/zod';
4
3
  import { useEffect } from 'react';
5
4
  import { Controller, useForm } from 'react-hook-form';
6
5
  import invariant from 'tiny-invariant';
7
6
  import { z } from 'zod';
8
7
  import { useShallow } from 'zustand/shallow';
9
- import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
8
+ import { useAvailablePromosQuery, useCreateGCashDepositMutation, useDepositsCountQuery, useGlobalStore, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
10
9
  import { toaster } from '../../../../client/utils/index.js';
11
- import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
12
- import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
10
+ import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
11
+ import { Button, Field, NumberInput } from '../../../../ui/index.js';
13
12
  import { parseDecimal } from '../../../../utils/index.js';
14
13
  import { AmountChoices } from '../../AmountChoices.js';
15
14
  import { AvailablePromos } from '../AvailablePromos.js';
16
15
  export function GCashDeposit() {
17
- const disclosure = useDisclosure();
18
16
  const globalStore = useGlobalStore(useShallow((ctx) => ({
19
17
  depositWithdrawal: ctx.depositWithdrawal,
20
18
  })));
@@ -120,22 +118,5 @@ export function GCashDeposit() {
120
118
  shouldDirty: true,
121
119
  shouldValidate: true,
122
120
  });
123
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-4xl", value: o.field.value, onChange: o.field.onChange })) }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createDepositMutation.isPending, onClick: async (e) => {
124
- const ok = await form.trigger('amount');
125
- if (!ok)
126
- return;
127
- if (promos.length <= 0)
128
- return;
129
- if (form.getValues('promo'))
130
- return;
131
- e.preventDefault();
132
- disclosure.setOpen(true);
133
- }, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
134
- disclosure.setOpen(details.open);
135
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
136
- disclosure.setOpen(false);
137
- }, children: "Cancel" }), _jsx(Button, { onClick: () => {
138
- handleSubmit();
139
- disclosure.setOpen(false);
140
- }, children: "Proceed" })] })] }) })] }) })] }));
121
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
141
122
  }
@@ -1,20 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Portal } from '@ark-ui/react';
3
2
  import { zodResolver } from '@hookform/resolvers/zod';
4
3
  import { useEffect } from 'react';
5
4
  import { Controller, useForm } from 'react-hook-form';
6
5
  import { z } from 'zod';
7
6
  import { useShallow } from 'zustand/shallow';
8
- import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, useDisclosure, useGlobalStore, useIsMayaSessionValidQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
7
+ import { useAvailablePromosQuery, useCreateMayaAppDepositMutation, useDepositsCountQuery, useGlobalStore, useIsMayaSessionValidQuery, usePaymentSettingsQuery, } from '../../../../client/hooks/index.js';
9
8
  import { toaster } from '../../../../client/utils/index.js';
10
- import { AlertCircleIcon, ChevronDownIcon, ChevronUpIcon, SpinnerIcon, XIcon, } from '../../../../icons/index.js';
11
- import { AlertDialog, Button, Field, NumberInput } from '../../../../ui/index.js';
9
+ import { ChevronDownIcon, ChevronUpIcon, SpinnerIcon } from '../../../../icons/index.js';
10
+ import { Button, Field, NumberInput } from '../../../../ui/index.js';
12
11
  import { parseDecimal } from '../../../../utils/index.js';
13
12
  import { AmountChoices } from '../../AmountChoices.js';
14
13
  import { MayaSessionExpired } from '../../MayaSessionExpired.js';
15
14
  import { AvailablePromos } from '../AvailablePromos.js';
16
15
  export function MayaAppDeposit() {
17
- const disclosure = useDisclosure();
18
16
  const globalStore = useGlobalStore(useShallow((ctx) => ({
19
17
  depositWithdrawal: ctx.depositWithdrawal,
20
18
  })));
@@ -126,22 +124,5 @@ export function MayaAppDeposit() {
126
124
  shouldDirty: true,
127
125
  shouldValidate: true,
128
126
  });
129
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { className: "mt-4xl", value: o.field.value, onChange: o.field.onChange })) }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx("button", { type: "button", className: "underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createDepositMutation.isPending, onClick: async (e) => {
130
- const ok = await form.trigger('amount');
131
- if (!ok)
132
- return;
133
- if (promos.length <= 0)
134
- return;
135
- if (form.getValues('promo'))
136
- return;
137
- e.preventDefault();
138
- disclosure.setOpen(true);
139
- }, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsx(AlertDialog.Root, { role: "alertdialog", open: disclosure.open, onOpenChange: (details) => {
140
- disclosure.setOpen(details.open);
141
- }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+10)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+25)]", children: _jsxs(AlertDialog.Content, { children: [_jsxs(AlertDialog.Header, { children: [_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-[#FEE4E2] text-[#D92D20]", children: _jsx(AlertCircleIcon, {}) }), _jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) })] }), _jsxs(AlertDialog.Body, { children: [_jsx(AlertDialog.Title, { children: "Submit deposit request without promo?" }), _jsx(AlertDialog.Description, { children: "You haven\u2019t selected a promo. Are you sure you want to proceed without one?" })] }), _jsxs(AlertDialog.Footer, { children: [_jsx(Button, { variant: "outline", colorScheme: "gray", onClick: () => {
142
- disclosure.setOpen(false);
143
- }, children: "Cancel" }), _jsx(Button, { onClick: () => {
144
- handleSubmit();
145
- disclosure.setOpen(false);
146
- }, children: "Proceed" })] })] }) })] }) })] }));
127
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: o.field.onChange, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: createDepositMutation.isPending ? (_jsxs(_Fragment, { children: [_jsx(SpinnerIcon, {}), "Processing..."] })) : ('Deposit') }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx("button", { type: "button", className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use and Privacy Policy" }), "."] })] }));
147
128
  }