@opexa/portal-components 0.0.610 → 0.0.612
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.
- package/dist/client/hooks/useGlobalStore.d.ts +1 -0
- package/dist/client/hooks/useGlobalStore.js +13 -0
- package/dist/components/Account/Account.lazy.js +2 -39
- package/dist/components/Account/Wallet.d.ts +17 -0
- package/dist/components/Account/Wallet.example.d.ts +33 -0
- package/dist/components/Account/Wallet.example.js +36 -0
- package/dist/components/Account/Wallet.js +44 -0
- package/dist/components/Account/index.d.ts +1 -0
- package/dist/components/Account/index.js +1 -0
- package/dist/components/Promo/Promo.client.d.ts +12 -1
- package/dist/components/Promo/Promo.client.js +23 -4
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +4 -1
- package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +4 -1
- package/dist/components/SignUp/SignUpNameAndPassword/SignUpNameAndPasswordForm.js +4 -1
- package/dist/ui/AlertDialog/AlertDialog.d.ts +154 -154
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +14 -14
- package/dist/ui/Avatar/Avatar.d.ts +9 -9
- package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +99 -99
- package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +252 -252
- package/dist/ui/Menu/menu.recipe.d.ts +14 -14
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/PinInput/PinInput.d.ts +12 -12
- package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +55 -55
- package/dist/ui/Popover/popover.recipe.d.ts +5 -5
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/package.json +1 -1
- package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
- package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
- package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +0 -1
- package/dist/components/KYC/KYCDefault/BasicInformation.js +0 -101
- package/dist/components/KYCNotRequired/KYCNotRequired.d.ts +0 -0
- package/dist/components/KYCNotRequired/KYCNotRequired.js +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
- package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
- package/dist/components/Quests/MultiWageringQuest.d.ts +0 -1
- package/dist/components/Quests/MultiWageringQuest.js +0 -111
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
- package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
- package/dist/components/SessionWatcher/index.d.ts +0 -1
- package/dist/components/SessionWatcher/index.js +0 -1
|
@@ -88,6 +88,7 @@ export interface GlobalStore {
|
|
|
88
88
|
responsibleGamingReminder: ResponsibleGamingReminderStore;
|
|
89
89
|
pendingBonus: HasPendingBonusStore;
|
|
90
90
|
kycVerificationStatus: PopupStore;
|
|
91
|
+
bankInformationDetails: PopupStore;
|
|
91
92
|
}
|
|
92
93
|
export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<Omit<import("zustand").StoreApi<GlobalStore>, "setState" | "devtools"> & {
|
|
93
94
|
setState(partial: GlobalStore | Partial<GlobalStore> | ((state: GlobalStore) => GlobalStore | Partial<GlobalStore>), replace?: false | undefined, action?: (string | {
|
|
@@ -431,6 +431,19 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
|
|
|
431
431
|
},
|
|
432
432
|
'~touched': false,
|
|
433
433
|
},
|
|
434
|
+
bankInformationDetails: {
|
|
435
|
+
open: false,
|
|
436
|
+
setOpen(open) {
|
|
437
|
+
set((prev) => ({
|
|
438
|
+
bankInformationDetails: {
|
|
439
|
+
...prev.bankInformationDetails,
|
|
440
|
+
open,
|
|
441
|
+
'~touched': true,
|
|
442
|
+
},
|
|
443
|
+
}));
|
|
444
|
+
},
|
|
445
|
+
'~touched': false,
|
|
446
|
+
},
|
|
434
447
|
pendingBonus: {
|
|
435
448
|
open: false,
|
|
436
449
|
setOpen(open) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isString } from 'lodash-es';
|
|
4
4
|
import Image from 'next/image';
|
|
5
5
|
import Link from 'next/link';
|
|
@@ -10,12 +10,10 @@ import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
|
10
10
|
import { useBonusesCountQuery } from '../../client/hooks/useBonusesCountQuery.js';
|
|
11
11
|
import { useCashbackBonusesCountQuery } from '../../client/hooks/useCashbackBonusesCountQuery.js';
|
|
12
12
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
13
|
-
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
14
13
|
import { useMayaAuth } from '../../client/hooks/useMayaAuth.js';
|
|
15
14
|
import { useProfileCompletionQuery } from '../../client/hooks/useProfileCompletionQuery.js';
|
|
16
15
|
import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
|
|
17
16
|
import { useUnreadMessagesCountQuery } from '../../client/hooks/useUnreadMessagesCountQuery.js';
|
|
18
|
-
import { useWalletQuery } from '../../client/hooks/useWalletQuery.js';
|
|
19
17
|
import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
|
|
20
18
|
import { Bell01Icon } from '../../icons/Bell01Icon.js';
|
|
21
19
|
import { ChevronRightIcon } from '../../icons/ChevronRightIcon.js';
|
|
@@ -26,15 +24,14 @@ import { Logout01Icon } from '../../icons/Logout01Icon.js';
|
|
|
26
24
|
import { Settings02Icon } from '../../icons/Settings02Icon.js';
|
|
27
25
|
import avatarPlaceholder from '../../images/placeholder-avatar.png';
|
|
28
26
|
import { Badge } from '../../ui/Badge/index.js';
|
|
29
|
-
import { Button } from '../../ui/Button/index.js';
|
|
30
27
|
import { Drawer } from '../../ui/Drawer/index.js';
|
|
31
28
|
import { Popover } from '../../ui/Popover/index.js';
|
|
32
29
|
import { Portal } from '../../ui/Portal/index.js';
|
|
33
30
|
import { capitalize } from '../../utils/capitalize.js';
|
|
34
|
-
import { formatNumber } from '../../utils/formatNumber.js';
|
|
35
31
|
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
36
32
|
import { AccountPropsContext, useAccountPropsContext } from './AccountContext.js';
|
|
37
33
|
import { accountRecipe } from './account.recipe.js';
|
|
34
|
+
import { Wallet } from './Wallet.js';
|
|
38
35
|
const defaultAccountProps = {
|
|
39
36
|
offsetTop: '0px',
|
|
40
37
|
rewardsUrl: '/rewards',
|
|
@@ -96,40 +93,6 @@ function Profile() {
|
|
|
96
93
|
};
|
|
97
94
|
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: "font-semibold text-text-secondary-700 leading-tight", children: account?.name }), _jsxs("div", { className: "flex", children: [_jsxs("p", { className: "grow items-center text-text-tertiary-600 leading-tight", children: ["ID: ", account?.id] }), accountProps.shouldShowAccountStatus && (_jsxs(Badge.Root, { colorScheme: getVerificationColorScheme(account?.verificationStatus), className: "self-start", children: [_jsx(Badge.Indicator, {}), _jsx(Badge.Label, { children: capitalize(account?.verificationStatus || '') })] }))] })] })] }));
|
|
98
95
|
}
|
|
99
|
-
function Wallet({ classNames }) {
|
|
100
|
-
const localeInfo = useLocaleInfo();
|
|
101
|
-
const walletQuery = useWalletQuery({
|
|
102
|
-
refetchInterval: 1000,
|
|
103
|
-
});
|
|
104
|
-
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
105
|
-
profile: ctx.account,
|
|
106
|
-
mobileProfile: ctx.account__mobile,
|
|
107
|
-
depositWithdrawal: ctx.depositWithdrawal,
|
|
108
|
-
})));
|
|
109
|
-
const depositBalance = parseDecimal(walletQuery.data?.balance, 0);
|
|
110
|
-
const bonusBalance = parseDecimal(walletQuery.data?.bonus, 0);
|
|
111
|
-
const totalBalance = depositBalance + bonusBalance;
|
|
112
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('mt-3 rounded-xl border border-border-primary bg-bg-tertiary p-xl', classNames.walletBalanceContainer), children: [_jsx("div", { className: twMerge('text-sm text-text-secondary-700', classNames.totalBalanceLabel), children: "Total Balance" }), _jsx("div", { className: twMerge('font-bold text-3xl', classNames.totalBalanceAmount), children: formatNumber(totalBalance, {
|
|
113
|
-
currency: localeInfo?.currency.code,
|
|
114
|
-
minDecimalPlaces: 2,
|
|
115
|
-
}) }), _jsxs("div", { className: twMerge('mt-1.5 flex gap-7xl', classNames.balanceDetailsContainer), children: [_jsxs("div", { children: [_jsx("p", { className: twMerge('text-2xs text-text-secondary-700', classNames.depositBalanceLabel), children: "Deposit Balance" }), _jsx("p", { className: twMerge('text-medium text-text-primary-brand', classNames.depositBalanceAmount), children: formatNumber(depositBalance, {
|
|
116
|
-
currency: localeInfo?.currency.code,
|
|
117
|
-
minDecimalPlaces: 2,
|
|
118
|
-
}) })] }), _jsxs("div", { children: [_jsx("p", { className: twMerge('text-2xs text-text-secondary-700', classNames.bonusBalanceLabel), children: "Bonus Balance" }), _jsx("p", { className: twMerge('text-medium text-text-primary-brand', classNames.bonusBalanceAmount), children: formatNumber(bonusBalance, {
|
|
119
|
-
currency: localeInfo?.currency.code,
|
|
120
|
-
minDecimalPlaces: 2,
|
|
121
|
-
}) })] })] })] }), ' ', _jsxs("div", { className: twMerge('mt-3 flex gap-lg', classNames.walletActions), children: [_jsx(Button, { size: "xs", variant: "outline", className: classNames.withdrawButton, onClick: () => {
|
|
122
|
-
globalStore.depositWithdrawal.setOpen(true);
|
|
123
|
-
globalStore.depositWithdrawal.setTab('WITHDRAWAL');
|
|
124
|
-
globalStore.profile.setOpen(false);
|
|
125
|
-
globalStore.mobileProfile.setOpen(false);
|
|
126
|
-
}, children: "Withdraw" }), _jsx(Button, { size: "xs", className: classNames.depositButton, onClick: () => {
|
|
127
|
-
globalStore.depositWithdrawal.setOpen(true);
|
|
128
|
-
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
129
|
-
globalStore.profile.setOpen(false);
|
|
130
|
-
globalStore.mobileProfile.setOpen(false);
|
|
131
|
-
}, children: "Deposit" })] })] }));
|
|
132
|
-
}
|
|
133
96
|
function Links({ router, classNames, }) {
|
|
134
97
|
const accountProps = useAccountPropsContext();
|
|
135
98
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface WalletClassNames {
|
|
2
|
+
walletActions?: string;
|
|
3
|
+
withdrawButton?: string;
|
|
4
|
+
depositButton?: string;
|
|
5
|
+
walletBalanceContainer?: string;
|
|
6
|
+
totalBalanceLabel?: string;
|
|
7
|
+
totalBalanceAmount?: string;
|
|
8
|
+
balanceDetailsContainer?: string;
|
|
9
|
+
depositBalanceLabel?: string;
|
|
10
|
+
depositBalanceAmount?: string;
|
|
11
|
+
bonusBalanceLabel?: string;
|
|
12
|
+
bonusBalanceAmount?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WalletProps {
|
|
15
|
+
classNames?: WalletClassNames;
|
|
16
|
+
}
|
|
17
|
+
export declare function Wallet({ classNames }: WalletProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example usage of the Wallet component
|
|
3
|
+
*
|
|
4
|
+
* Import the Wallet component:
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { Wallet } from '@opexa/portal-components/Account/Wallet';
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Basic usage:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Wallet />
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* With custom class names:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Wallet
|
|
17
|
+
* classNames={{
|
|
18
|
+
* walletBalanceContainer: "custom-balance-container",
|
|
19
|
+
* totalBalanceAmount: "custom-total-amount",
|
|
20
|
+
* depositButton: "custom-deposit-btn",
|
|
21
|
+
* withdrawButton: "custom-withdraw-btn"
|
|
22
|
+
* }}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The Wallet component includes:
|
|
27
|
+
* - Total balance display
|
|
28
|
+
* - Deposit and bonus balance breakdown
|
|
29
|
+
* - Deposit and Withdraw buttons
|
|
30
|
+
* - Automatic wallet data fetching with 1-second refresh interval
|
|
31
|
+
* - Integration with global store for deposit/withdrawal modals
|
|
32
|
+
*/
|
|
33
|
+
export declare const WalletExample: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Example usage of the Wallet component
|
|
4
|
+
*
|
|
5
|
+
* Import the Wallet component:
|
|
6
|
+
* ```tsx
|
|
7
|
+
* import { Wallet } from '@opexa/portal-components/Account/Wallet';
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* Basic usage:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Wallet />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* With custom class names:
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Wallet
|
|
18
|
+
* classNames={{
|
|
19
|
+
* walletBalanceContainer: "custom-balance-container",
|
|
20
|
+
* totalBalanceAmount: "custom-total-amount",
|
|
21
|
+
* depositButton: "custom-deposit-btn",
|
|
22
|
+
* withdrawButton: "custom-withdraw-btn"
|
|
23
|
+
* }}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* The Wallet component includes:
|
|
28
|
+
* - Total balance display
|
|
29
|
+
* - Deposit and bonus balance breakdown
|
|
30
|
+
* - Deposit and Withdraw buttons
|
|
31
|
+
* - Automatic wallet data fetching with 1-second refresh interval
|
|
32
|
+
* - Integration with global store for deposit/withdrawal modals
|
|
33
|
+
*/
|
|
34
|
+
export const WalletExample = () => {
|
|
35
|
+
return (_jsxs("div", { className: "p-4", children: [_jsx("h2", { className: 'mb-4 font-bold text-xl', children: "Wallet Component Example" }), _jsx("p", { className: 'mb-4 text-gray-600', children: "The Wallet component is now available as a standalone component that you can use anywhere in your application." }), _jsxs("div", { className: 'rounded-lg bg-gray-100 p-4', children: [_jsx("h3", { className: 'mb-2 font-semibold', children: "Import:" }), _jsxs("code", { className: 'block rounded bg-white p-2 text-sm', children: ["import ", `{ Wallet }`, " from '@opexa/portal-components/Account/Wallet';"] })] }), _jsxs("div", { className: 'mt-4 rounded-lg bg-gray-100 p-4', children: [_jsx("h3", { className: 'mb-2 font-semibold', children: "Usage:" }), _jsx("code", { className: 'block rounded bg-white p-2 text-sm', children: `<Wallet classNames={{ walletActions: "custom-actions" }} />` })] })] }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
6
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
7
|
+
import { useWalletQuery } from '../../client/hooks/useWalletQuery.js';
|
|
8
|
+
import { Button } from '../../ui/Button/index.js';
|
|
9
|
+
import { formatNumber } from '../../utils/formatNumber.js';
|
|
10
|
+
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
11
|
+
export function Wallet({ classNames = {} }) {
|
|
12
|
+
const localeInfo = useLocaleInfo();
|
|
13
|
+
const walletQuery = useWalletQuery({
|
|
14
|
+
refetchInterval: 1000,
|
|
15
|
+
});
|
|
16
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
17
|
+
profile: ctx.account,
|
|
18
|
+
mobileProfile: ctx.account__mobile,
|
|
19
|
+
depositWithdrawal: ctx.depositWithdrawal,
|
|
20
|
+
})));
|
|
21
|
+
const depositBalance = parseDecimal(walletQuery.data?.balance, 0);
|
|
22
|
+
const bonusBalance = parseDecimal(walletQuery.data?.bonus, 0);
|
|
23
|
+
const totalBalance = depositBalance + bonusBalance;
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('mt-3 rounded-xl border border-border-primary bg-bg-tertiary p-xl', classNames.walletBalanceContainer), children: [_jsx("div", { className: twMerge('text-sm text-text-secondary-700', classNames.totalBalanceLabel), children: "Total Balance" }), _jsx("div", { className: twMerge('font-bold text-3xl', classNames.totalBalanceAmount), children: formatNumber(totalBalance, {
|
|
25
|
+
currency: localeInfo?.currency.code,
|
|
26
|
+
minDecimalPlaces: 2,
|
|
27
|
+
}) }), _jsxs("div", { className: twMerge('mt-1.5 flex gap-7xl', classNames.balanceDetailsContainer), children: [_jsxs("div", { children: [_jsx("p", { className: twMerge('text-2xs text-text-secondary-700', classNames.depositBalanceLabel), children: "Deposit Balance" }), _jsx("p", { className: twMerge('text-medium text-text-primary-brand', classNames.depositBalanceAmount), children: formatNumber(depositBalance, {
|
|
28
|
+
currency: localeInfo?.currency.code,
|
|
29
|
+
minDecimalPlaces: 2,
|
|
30
|
+
}) })] }), _jsxs("div", { children: [_jsx("p", { className: twMerge('text-2xs text-text-secondary-700', classNames.bonusBalanceLabel), children: "Bonus Balance" }), _jsx("p", { className: twMerge('text-medium text-text-primary-brand', classNames.bonusBalanceAmount), children: formatNumber(bonusBalance, {
|
|
31
|
+
currency: localeInfo?.currency.code,
|
|
32
|
+
minDecimalPlaces: 2,
|
|
33
|
+
}) })] })] })] }), _jsxs("div", { className: twMerge('mt-3 flex gap-lg', classNames.walletActions), children: [_jsx(Button, { size: "xs", variant: "outline", className: classNames.withdrawButton, onClick: () => {
|
|
34
|
+
globalStore.depositWithdrawal.setOpen(true);
|
|
35
|
+
globalStore.depositWithdrawal.setTab('WITHDRAWAL');
|
|
36
|
+
globalStore.profile.setOpen(false);
|
|
37
|
+
globalStore.mobileProfile.setOpen(false);
|
|
38
|
+
}, children: "Withdraw" }), _jsx(Button, { size: "xs", className: classNames.depositButton, onClick: () => {
|
|
39
|
+
globalStore.depositWithdrawal.setOpen(true);
|
|
40
|
+
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
41
|
+
globalStore.profile.setOpen(false);
|
|
42
|
+
globalStore.mobileProfile.setOpen(false);
|
|
43
|
+
}, children: "Deposit" })] })] }));
|
|
44
|
+
}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
export interface ClassNameEntries {
|
|
2
|
+
root?: string;
|
|
3
|
+
promoDescription?: string;
|
|
4
|
+
}
|
|
1
5
|
export interface PromoProps {
|
|
2
6
|
id: string;
|
|
3
7
|
/** @default '/promos' */
|
|
4
8
|
viewAllPromosUrl?: string;
|
|
5
|
-
className?: string;
|
|
9
|
+
className?: string | ClassNameEntries;
|
|
10
|
+
transformDescription?: {
|
|
11
|
+
replacements: {
|
|
12
|
+
pattern: string;
|
|
13
|
+
replace: string;
|
|
14
|
+
flags?: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
6
17
|
}
|
|
7
18
|
export declare function Promo__client(props: PromoProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { tz } from '@date-fns/tz';
|
|
4
4
|
import { format } from 'date-fns';
|
|
5
|
+
import { isString } from 'lodash-es';
|
|
5
6
|
import Image from 'next/image';
|
|
6
7
|
import Link from 'next/link';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
9
|
import { useShallow } from 'zustand/shallow';
|
|
8
10
|
import { useAvailablePromosQuery } from '../../client/hooks/useAvailablePromosQuery.js';
|
|
9
11
|
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
@@ -24,12 +26,29 @@ export function Promo__client(props) {
|
|
|
24
26
|
})));
|
|
25
27
|
if (!promo)
|
|
26
28
|
return null;
|
|
27
|
-
|
|
29
|
+
const classNames = isString(props.className)
|
|
30
|
+
? { root: props.className }
|
|
31
|
+
: (props.className ?? {});
|
|
32
|
+
const descriptionHtml = (() => {
|
|
33
|
+
let html = promo.description ?? '';
|
|
34
|
+
const cfg = props.transformDescription;
|
|
35
|
+
if (cfg?.replacements?.length) {
|
|
36
|
+
for (const r of cfg.replacements) {
|
|
37
|
+
try {
|
|
38
|
+
const re = new RegExp(r.pattern, r.flags ?? 'g');
|
|
39
|
+
html = html.replace(re, r.replace);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// ignore invalid regex
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return html;
|
|
47
|
+
})();
|
|
48
|
+
return (_jsxs("div", { className: classNames.root, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "flex w-fit items-center gap-lg font-semibold text-button-tertiary-fg text-lg", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), promo.banner.url && (_jsx(Image, { src: promo.banner.url, alt: "", width: 1024, height: 600, priority: true, unoptimized: true, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" })), claimable && (_jsx(Button, { className: "mt-xl lg:mt-6", onClick: () => {
|
|
28
49
|
globalStore.depositWithdrawal.setOpen(true);
|
|
29
50
|
globalStore.depositWithdrawal.setPromo(promo.id);
|
|
30
51
|
}, children: "Deposit Now" })), _jsx("h1", { className: "mt-xl font-semibold text-2xl lg:mt-6 lg:text-3xl", children: promo.name }), _jsxs("p", { className: "mt-xl text-text-secondary-700 lg:mt-6", children: ["Ends", ' ', format(promo.activationEndDateTime, 'MM/dd/yyy hh:mm:ss', {
|
|
31
52
|
in: tz(localeInfo.timezone),
|
|
32
|
-
})] }), _jsx(Prose, { className:
|
|
33
|
-
__html: promo.description,
|
|
34
|
-
} })] }));
|
|
53
|
+
})] }), _jsx(Prose, { className: twMerge('mt-2xl lg:mt-6', classNames.promoDescription), dangerouslySetInnerHTML: { __html: descriptionHtml } })] }));
|
|
35
54
|
}
|
|
@@ -44,7 +44,10 @@ export function SignUpDefaultForm() {
|
|
|
44
44
|
const branchCollection = createListCollection({
|
|
45
45
|
items: signUpProps.branches ?? [],
|
|
46
46
|
itemToValue: (item) => item.code,
|
|
47
|
-
itemToString: (item) =>
|
|
47
|
+
itemToString: (item) => {
|
|
48
|
+
const name = (item.name ?? '').trim();
|
|
49
|
+
return name ? `${item.code} - ${name}` : item.code;
|
|
50
|
+
},
|
|
48
51
|
});
|
|
49
52
|
const [step, setStep] = useState(1);
|
|
50
53
|
const router = useRouter();
|
|
@@ -55,7 +55,10 @@ export function SignUpKYCForm() {
|
|
|
55
55
|
const branchCollection = createListCollection({
|
|
56
56
|
items: props.branches ?? [],
|
|
57
57
|
itemToValue: (item) => item.code,
|
|
58
|
-
itemToString: (item) =>
|
|
58
|
+
itemToString: (item) => {
|
|
59
|
+
const name = (item.name ?? '').trim();
|
|
60
|
+
return name ? `${item.code} - ${name}` : item.code;
|
|
61
|
+
},
|
|
59
62
|
});
|
|
60
63
|
const router = useRouter();
|
|
61
64
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
@@ -42,7 +42,10 @@ export function SignUpNameAndPasswordForm() {
|
|
|
42
42
|
const branchCollection = createListCollection({
|
|
43
43
|
items: signUpProps.branches ?? [],
|
|
44
44
|
itemToValue: (item) => item.code,
|
|
45
|
-
itemToString: (item) =>
|
|
45
|
+
itemToString: (item) => {
|
|
46
|
+
const name = (item.name ?? '').trim();
|
|
47
|
+
return name ? `${item.code} - ${name}` : item.code;
|
|
48
|
+
},
|
|
46
49
|
});
|
|
47
50
|
const router = useRouter();
|
|
48
51
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|