@opexa/portal-components 0.0.404 → 0.0.406
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/useCellxpertCxd.d.ts +7 -0
- package/dist/client/hooks/useCellxpertCxd.js +4 -0
- package/dist/client/hooks/useSignUpMutation.js +3 -2
- package/dist/client/hooks/useUpdateSessionMutation.js +0 -2
- package/dist/client/services/updateSession.d.ts +0 -1
- package/dist/components/Account/Account.lazy.d.ts +14 -0
- package/dist/components/Account/Account.lazy.js +13 -13
- package/dist/components/PortalProvider/PortalProvider.js +1 -1
- package/dist/components/PortalProvider/Providers.js +2 -7
- package/dist/components/PortalProvider/SetupCellxpertCxd.js +27 -12
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +1 -7
- package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +1 -3
- package/dist/constants/StorageKey.d.ts +1 -0
- package/dist/constants/StorageKey.js +1 -0
- package/dist/handlers/patchSession.js +0 -1
- package/dist/services/queries.d.ts +1 -1
- package/dist/services/queries.js +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
- 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 +45 -45
- package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
- 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/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- 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 +121 -121
- package/dist/ui/Dialog/dialog.recipe.d.ts +11 -11
- 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 +360 -360
- package/dist/ui/Menu/menu.recipe.d.ts +20 -20
- 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 +121 -121
- package/dist/ui/Popover/popover.recipe.d.ts +11 -11
- 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/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tooltip/Tooltip.d.ts +48 -48
- package/dist/ui/Tooltip/tooltip.recipe.d.ts +8 -8
- package/package.json +1 -1
|
@@ -2,8 +2,9 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import { registerMemberAccountViaMobile, } from '../../services/account.js';
|
|
3
3
|
import { getSignUpMutationKey } from '../../utils/mutationKeys.js';
|
|
4
4
|
import { getSession } from '../services/getSession.js';
|
|
5
|
+
import { useCellxpertCxd } from './useCellxpertCxd.js';
|
|
5
6
|
export const useSignUpMutation = (config) => {
|
|
6
|
-
const cellxpertCxd =
|
|
7
|
+
const [cellxpertCxd] = useCellxpertCxd();
|
|
7
8
|
return useMutation({
|
|
8
9
|
...config,
|
|
9
10
|
mutationKey: getSignUpMutationKey(),
|
|
@@ -15,7 +16,7 @@ export const useSignUpMutation = (config) => {
|
|
|
15
16
|
btag: session.btag,
|
|
16
17
|
}),
|
|
17
18
|
...(cellxpertCxd && {
|
|
18
|
-
cellxpertCxd,
|
|
19
|
+
cellxpertCxd: cellxpertCxd.value,
|
|
19
20
|
}),
|
|
20
21
|
}, {
|
|
21
22
|
headers: {
|
|
@@ -15,13 +15,11 @@ export const useUpdateSessionMutation = (config) => {
|
|
|
15
15
|
return prev;
|
|
16
16
|
const domain = input.domain ?? prev.domain;
|
|
17
17
|
const btag = input.btag ?? prev.btag;
|
|
18
|
-
const cellxpertCxd = input.cellxpertCxd ?? prev.cellxpertCxd;
|
|
19
18
|
if (prev.status === 'unauthenticated') {
|
|
20
19
|
return {
|
|
21
20
|
status: 'unauthenticated',
|
|
22
21
|
domain,
|
|
23
22
|
btag,
|
|
24
|
-
cellxpertCxd,
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
return {
|
|
@@ -2,6 +2,5 @@ import { type HttpRequestOptions } from '../../services/httpRequest';
|
|
|
2
2
|
export interface UpdateSessionInput {
|
|
3
3
|
domain?: string;
|
|
4
4
|
btag?: string;
|
|
5
|
-
cellxpertCxd?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare const updateSession: (input: UpdateSessionInput, options?: HttpRequestOptions) => Promise<boolean>;
|
|
@@ -3,6 +3,20 @@ export interface ClassNameEntries {
|
|
|
3
3
|
walletActions?: string;
|
|
4
4
|
withdrawButton?: string;
|
|
5
5
|
depositButton?: string;
|
|
6
|
+
walletBalanceContainer?: string;
|
|
7
|
+
totalBalanceLabel?: string;
|
|
8
|
+
totalBalanceAmount?: string;
|
|
9
|
+
balanceDetailsContainer?: string;
|
|
10
|
+
depositBalanceLabel?: string;
|
|
11
|
+
depositBalanceAmount?: string;
|
|
12
|
+
bonusBalanceLabel?: string;
|
|
13
|
+
bonusBalanceAmount?: string;
|
|
14
|
+
navItemRoot?: string;
|
|
15
|
+
navItemLink?: string;
|
|
16
|
+
navItemIcon?: string;
|
|
17
|
+
navItemLabel?: string;
|
|
18
|
+
navItemBadge?: string;
|
|
19
|
+
navItemIndicator?: string;
|
|
6
20
|
}
|
|
7
21
|
export interface AccountProps {
|
|
8
22
|
className?: string | ClassNameEntries;
|
|
@@ -68,14 +68,14 @@ export function Account(props) {
|
|
|
68
68
|
}, lazyMount: true, unmountOnExit: true, children: _jsx(Portal, { children: _jsx(Drawer.Positioner, { children: _jsxs(Drawer.Content, { className: twMerge('relative', 'flex', 'flex-col', 'top-[var(--offset-top-mobile)]', 'h-[calc(100%-var(--offset-top-mobile))]', 'w-full', 'px-xl', 'py-6', 'lg:top-[var(--offset-top-desktop)]', 'lg:h-[calc(100%-var(--offset-top-desktop))]', 'overflow-auto', classNames.root), style: {
|
|
69
69
|
['--offset-top-mobile']: mobileOffsetTop,
|
|
70
70
|
['--offset-top-desktop']: desktopOffsetTop,
|
|
71
|
-
}, children: [_jsx(Profile, {}), _jsx(Wallet, { classNames: classNames }), _jsx(Links, { router: router })] }) }) }) }), _jsx(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
71
|
+
}, children: [_jsx(Profile, {}), _jsx(Wallet, { classNames: classNames }), _jsx(Links, { router: router, classNames: classNames })] }) }) }) }), _jsx(Popover.Root, { open: globalStore.account.open, onOpenChange: (details) => {
|
|
72
72
|
globalStore.account.setOpen(details.open);
|
|
73
73
|
}, lazyMount: true, unmountOnExit: true, positioning: {
|
|
74
74
|
placement: 'bottom',
|
|
75
75
|
strategy: 'fixed',
|
|
76
76
|
}, ids: {
|
|
77
77
|
trigger: 'opexa-portal-components:account-trigger',
|
|
78
|
-
}, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "relative z-popover w-[23.438rem] ui-closed:animate-fade-out ui-open:animate-fade-in overflow-hidden rounded-xl border border-border-primary bg-bg-primary p-xl", children: [_jsx(Profile, {}), _jsx(Wallet, { classNames: classNames }), _jsx(Links, { router: router })] }) }) }) })] }));
|
|
78
|
+
}, children: _jsx(Portal, { children: _jsx(Popover.Positioner, { children: _jsxs(Popover.Content, { className: "relative z-popover w-[23.438rem] ui-closed:animate-fade-out ui-open:animate-fade-in overflow-hidden rounded-xl border border-border-primary bg-bg-primary p-xl", children: [_jsx(Profile, {}), _jsx(Wallet, { classNames: classNames }), _jsx(Links, { router: router, classNames: classNames })] }) }) }) })] }));
|
|
79
79
|
}
|
|
80
80
|
function Profile() {
|
|
81
81
|
const accountQuery = useAccountQuery();
|
|
@@ -95,13 +95,13 @@ function Wallet({ classNames }) {
|
|
|
95
95
|
const depositBalance = parseDecimal(walletQuery.data?.balance, 0);
|
|
96
96
|
const bonusBalance = parseDecimal(walletQuery.data?.bonus, 0);
|
|
97
97
|
const totalBalance = depositBalance + bonusBalance;
|
|
98
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className:
|
|
98
|
+
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, {
|
|
99
99
|
currency: localeInfo?.currency.code,
|
|
100
100
|
minDecimalPlaces: 2,
|
|
101
|
-
}) }), _jsxs("div", { className:
|
|
101
|
+
}) }), _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, {
|
|
102
102
|
currency: localeInfo?.currency.code,
|
|
103
103
|
minDecimalPlaces: 2,
|
|
104
|
-
}) })] }), _jsxs("div", { children: [_jsx("p", { className:
|
|
104
|
+
}) })] }), _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, {
|
|
105
105
|
currency: localeInfo?.currency.code,
|
|
106
106
|
minDecimalPlaces: 2,
|
|
107
107
|
}) })] })] })] }), ' ', _jsxs("div", { className: twMerge('mt-3 flex gap-lg', classNames.walletActions), children: [_jsx(Button, { size: "xs", variant: "outline", className: classNames.withdrawButton, onClick: () => {
|
|
@@ -116,7 +116,7 @@ function Wallet({ classNames }) {
|
|
|
116
116
|
globalStore.mobileProfile.setOpen(false);
|
|
117
117
|
}, children: "Deposit" })] })] }));
|
|
118
118
|
}
|
|
119
|
-
function Links({ router }) {
|
|
119
|
+
function Links({ router, classNames }) {
|
|
120
120
|
const accountProps = useAccountPropsContext();
|
|
121
121
|
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
122
122
|
account: ctx.account,
|
|
@@ -140,26 +140,26 @@ function Links({ router }) {
|
|
|
140
140
|
const cashbackBonusesCountQuery = useCashbackBonusesCountQuery();
|
|
141
141
|
const cashbackBonusesCount = cashbackBonusesCountQuery.data ?? 0;
|
|
142
142
|
const rewardsCount = bonusesCount + cashbackBonusesCount;
|
|
143
|
-
return (_jsxs("nav", { className: recipe.nav({ className: 'mt-xl' }), children: [_jsxs("ul", { hidden: !accountProps.notificationsEnabled && !accountProps.rewardsEnabled, children: [_jsx("li", { className: recipe.navItemRoot(), hidden: !accountProps.notificationsEnabled, children: _jsxs("button", { type: "button", className: recipe.navItemLink(), onClick: () => {
|
|
143
|
+
return (_jsxs("nav", { className: recipe.nav({ className: 'mt-xl' }), children: [_jsxs("ul", { hidden: !accountProps.notificationsEnabled && !accountProps.rewardsEnabled, children: [_jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), hidden: !accountProps.notificationsEnabled, children: _jsxs("button", { type: "button", className: twMerge(recipe.navItemLink(), classNames.navItemLink), onClick: () => {
|
|
144
144
|
globalStore.account.setOpen(false);
|
|
145
145
|
globalStore.account__mobile.setOpen(false);
|
|
146
146
|
globalStore.messages.setOpen(true);
|
|
147
|
-
}, children: [_jsx(Bell01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Notifications" }), unreadMessagesCount > 0 && (_jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: unreadMessagesCount })), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), hidden: !accountProps.rewardsEnabled, children: _jsxs(Link, { href: accountProps.rewardsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
147
|
+
}, children: [_jsx(Bell01Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Notifications" }), unreadMessagesCount > 0 && (_jsx("span", { className: twMerge(recipe.navItemBadge(), classNames.navItemBadge), "data-type": "warning", children: unreadMessagesCount })), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) }), _jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), hidden: !accountProps.rewardsEnabled, children: _jsxs(Link, { href: accountProps.rewardsUrl, className: twMerge(recipe.navItemLink(), classNames.navItemLink), onClick: () => {
|
|
148
148
|
globalStore.account.setOpen(false);
|
|
149
149
|
globalStore.account__mobile.setOpen(false);
|
|
150
|
-
}, children: [_jsx(Gift01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Rewards" }), rewardsCount > 0 && (_jsx("span", { className: recipe.navItemBadge(), "data-type": "warning", children: rewardsCount })), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) })] }), _jsx("ul", { hidden: !accountProps.accountSettingsEnabled, children: _jsx("li", { className: recipe.navItemRoot(), hidden: !accountProps.accountSettingsEnabled, children: _jsxs(Link, { href: accountProps.accountSettingsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
150
|
+
}, children: [_jsx(Gift01Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Rewards" }), rewardsCount > 0 && (_jsx("span", { className: twMerge(recipe.navItemBadge(), classNames.navItemBadge), "data-type": "warning", children: rewardsCount })), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) })] }), _jsx("ul", { hidden: !accountProps.accountSettingsEnabled, children: _jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), hidden: !accountProps.accountSettingsEnabled, children: _jsxs(Link, { href: accountProps.accountSettingsUrl, className: twMerge(recipe.navItemLink(), classNames.navItemLink), onClick: () => {
|
|
151
151
|
globalStore.account.setOpen(false);
|
|
152
152
|
globalStore.account__mobile.setOpen(false);
|
|
153
|
-
}, children: [_jsx(Settings02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Settings" }), profileCompletionPercentage < 100 && (_jsx("span", { className: recipe.navItemBadge(), "data-type": "error", children: _jsx(AlertCircleIcon, {}) })), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) }), _jsxs("ul", { hidden: !accountProps.betRecordsEnabled && !accountProps.transactionsEnabled, children: [_jsx("li", { className: recipe.navItemRoot(), hidden: !accountProps.betRecordsEnabled, children: _jsxs(Link, { href: accountProps.betRecordsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
153
|
+
}, children: [_jsx(Settings02Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Settings" }), profileCompletionPercentage < 100 && (_jsx("span", { className: twMerge(recipe.navItemBadge(), classNames.navItemBadge), "data-type": "error", children: _jsx(AlertCircleIcon, {}) })), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) }) }), _jsxs("ul", { hidden: !accountProps.betRecordsEnabled && !accountProps.transactionsEnabled, children: [_jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), hidden: !accountProps.betRecordsEnabled, children: _jsxs(Link, { href: accountProps.betRecordsUrl, className: twMerge(recipe.navItemLink(), classNames.navItemLink), onClick: () => {
|
|
154
154
|
globalStore.account.setOpen(false);
|
|
155
155
|
globalStore.account__mobile.setOpen(false);
|
|
156
|
-
}, children: [_jsx(CoinsStacked02Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }), _jsx("li", { className: recipe.navItemRoot(), hidden: !accountProps.transactionsEnabled, children: _jsxs(Link, { href: accountProps.transactionsUrl, className: recipe.navItemLink(), onClick: () => {
|
|
156
|
+
}, children: [_jsx(CoinsStacked02Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Bet Records" }), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) }), _jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), hidden: !accountProps.transactionsEnabled, children: _jsxs(Link, { href: accountProps.transactionsUrl, className: twMerge(recipe.navItemLink(), classNames.navItemLink), onClick: () => {
|
|
157
157
|
globalStore.account.setOpen(false);
|
|
158
158
|
globalStore.account__mobile.setOpen(false);
|
|
159
|
-
}, 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: () => {
|
|
159
|
+
}, children: [_jsx(CoinsSwap02Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Transactions" }), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) })] }), _jsx("ul", { children: _jsx("li", { className: twMerge(recipe.navItemRoot(), classNames.navItemRoot), children: _jsxs("button", { type: "button", className: twMerge(recipe.navItemLink(), classNames.navItemLink), disabled: signOutMutation.isPending, onClick: () => {
|
|
160
160
|
signOutMutation.mutate();
|
|
161
161
|
globalStore.account.setOpen(false);
|
|
162
162
|
globalStore.account__mobile.setOpen(false);
|
|
163
163
|
router.push('/');
|
|
164
|
-
}, children: [_jsx(Logout01Icon, { className: recipe.navItemIcon() }), _jsx("span", { className: recipe.navItemLabel(), children: "Log Out" }), _jsx(ChevronRightIcon, { className: recipe.navItemIndicator() })] }) }) })] }));
|
|
164
|
+
}, children: [_jsx(Logout01Icon, { className: twMerge(recipe.navItemIcon(), classNames.navItemIcon) }), _jsx("span", { className: twMerge(recipe.navItemLabel(), classNames.navItemLabel), children: "Log Out" }), _jsx(ChevronRightIcon, { className: twMerge(recipe.navItemIndicator(), classNames.navItemIndicator) })] }) }) })] }));
|
|
165
165
|
}
|
|
@@ -7,13 +7,13 @@ import { prefetchSessionQuery } from '../../server/utils/prefetchSessionQuery.js
|
|
|
7
7
|
import { prefetchWalletQuery } from '../../server/utils/prefetchWalletQuery.js';
|
|
8
8
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
9
9
|
import { FeatureFlag } from './FeatureFlag.js';
|
|
10
|
-
import { SocialAccountLinkObserver } from './SocialAccountLinkObserver.js';
|
|
11
10
|
import { Providers } from './Providers.js';
|
|
12
11
|
import { SessionWatcher } from './SessionWatcher.js';
|
|
13
12
|
import { SetupBtag } from './SetupBtag.js';
|
|
14
13
|
import { SetupCellxpertCxd } from './SetupCellxpertCxd.js';
|
|
15
14
|
import { SetupDomain } from './SetupDomain.js';
|
|
16
15
|
import { Snackbar } from './Snackbar.js';
|
|
16
|
+
import { SocialAccountLinkObserver } from './SocialAccountLinkObserver.js';
|
|
17
17
|
export async function PortalProvider({ recaptchaSiteKey, children, }) {
|
|
18
18
|
const queryClient = getQueryClient();
|
|
19
19
|
await Promise.allSettled([
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
4
4
|
import { ReCaptchaProvider } from 'next-recaptcha-v3';
|
|
5
|
-
import dynamic from 'next/dynamic';
|
|
6
5
|
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
7
|
-
const CXDTokenObserver = dynamic(() => import('./CXDTokenObserver.js').then((m) => m.CXDTokenObserver), {
|
|
8
|
-
ssr: false,
|
|
9
|
-
loading: () => null,
|
|
10
|
-
});
|
|
11
6
|
export function Providers({ recaptchaSiteKey, children, }) {
|
|
12
7
|
const queryClient = getQueryClient();
|
|
13
|
-
return (
|
|
8
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(ReCaptchaProvider, { reCaptchaKey: recaptchaSiteKey, children: children }) }));
|
|
14
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { addHours, isAfter, subMinutes } from 'date-fns';
|
|
2
3
|
import { useSearchParams } from 'next/navigation';
|
|
3
4
|
import { useTimeout } from 'usehooks-ts';
|
|
4
5
|
import { z } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
import { useUpdateSessionMutation } from '../../client/hooks/useUpdateSessionMutation.js';
|
|
6
|
+
import { useCellxpertCxd } from '../../client/hooks/useCellxpertCxd.js';
|
|
7
7
|
const CellxpertCxdSchema = z
|
|
8
8
|
.string()
|
|
9
9
|
.min(200)
|
|
@@ -12,17 +12,32 @@ const CellxpertCxdSchema = z
|
|
|
12
12
|
.nullable()
|
|
13
13
|
.catch(null);
|
|
14
14
|
export function SetupCellxpertCxd() {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
15
|
+
const searchParams = useSearchParams();
|
|
16
|
+
const value = CellxpertCxdSchema.parse(searchParams.get('cxd'));
|
|
17
|
+
const [cellxpertCxd, setCellxpertCxd] = useCellxpertCxd();
|
|
18
18
|
useTimeout(() => {
|
|
19
|
-
|
|
20
|
-
const newValue = CellxpertCxdSchema.parse(params.get('cxd'));
|
|
21
|
-
if (oldValue === newValue)
|
|
19
|
+
if (!value)
|
|
22
20
|
return;
|
|
23
|
-
if (!
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
if (!cellxpertCxd) {
|
|
22
|
+
return setCellxpertCxd({
|
|
23
|
+
value,
|
|
24
|
+
expires: subMinutes(addHours(new Date(), 6), 1).getTime(),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/* If previous value is expired, override */
|
|
28
|
+
if (isAfter(new Date(), new Date(cellxpertCxd.expires))) {
|
|
29
|
+
return setCellxpertCxd({
|
|
30
|
+
value,
|
|
31
|
+
expires: addHours(new Date(), 6).getTime(),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/* If previous value is not the same as new value, override */
|
|
35
|
+
if (value !== cellxpertCxd.value) {
|
|
36
|
+
return setCellxpertCxd({
|
|
37
|
+
value,
|
|
38
|
+
expires: addHours(new Date(), 6).getTime(),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}, 250);
|
|
27
42
|
return null;
|
|
28
43
|
}
|
|
@@ -13,14 +13,12 @@ import { z } from 'zod';
|
|
|
13
13
|
import { useShallow } from 'zustand/shallow';
|
|
14
14
|
import { useControllableState } from '../../../client/hooks/useControllableState.js';
|
|
15
15
|
import { useCooldown } from '../../../client/hooks/useCooldown.js';
|
|
16
|
-
import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
|
|
17
16
|
import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
|
|
18
17
|
import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
|
|
19
18
|
import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberParser.js';
|
|
20
19
|
import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
|
|
21
20
|
import { useSignInMutation } from '../../../client/hooks/useSignInMutation.js';
|
|
22
21
|
import { useSignUpMutation } from '../../../client/hooks/useSignUpMutation.js';
|
|
23
|
-
import { useUpdateAccountMutation } from '../../../client/hooks/useUpdateAccountMutation.js';
|
|
24
22
|
import { toaster } from '../../../client/utils/toaster.js';
|
|
25
23
|
import { ArrowLeftIcon } from '../../../icons/ArrowLeftIcon.js';
|
|
26
24
|
import { CalendarIcon } from '../../../icons/CalendarIcon.js';
|
|
@@ -43,7 +41,6 @@ import { createPoll } from '../../../utils/createPoll.js';
|
|
|
43
41
|
import { useSignUpDefaultPropsContext } from './SignUpDefaultContext.js';
|
|
44
42
|
export function SignUpDefaultForm() {
|
|
45
43
|
const signUpProps = useSignUpDefaultPropsContext();
|
|
46
|
-
const { enabled } = useFeatureFlag();
|
|
47
44
|
const branchCollection = createListCollection({
|
|
48
45
|
items: signUpProps.branches ?? [],
|
|
49
46
|
itemToValue: (item) => item.code,
|
|
@@ -59,11 +56,8 @@ export function SignUpDefaultForm() {
|
|
|
59
56
|
responsibleGaming: ctx.responsibleGaming,
|
|
60
57
|
})));
|
|
61
58
|
const search = useSearchParams();
|
|
62
|
-
const signUpMutation = useSignUpMutation(
|
|
63
|
-
meta: { cellxpertCxd: search.get('cxd') },
|
|
64
|
-
});
|
|
59
|
+
const signUpMutation = useSignUpMutation();
|
|
65
60
|
const signInMutation = useSignInMutation();
|
|
66
|
-
const updateAccountMutation = useUpdateAccountMutation();
|
|
67
61
|
const sendVerificationCodeMutation = useSendVerificationCodeMutation();
|
|
68
62
|
const localeInfo = useLocaleInfo();
|
|
69
63
|
const mobileNumberParser = useMobileNumberParser();
|
|
@@ -67,9 +67,7 @@ export function SignUpKYCForm() {
|
|
|
67
67
|
})));
|
|
68
68
|
const dialog = useDialogContext();
|
|
69
69
|
const search = useSearchParams();
|
|
70
|
-
const signUpMutation = useSignUpMutation(
|
|
71
|
-
meta: { cellxpertCxd: search.get('cxd') },
|
|
72
|
-
});
|
|
70
|
+
const signUpMutation = useSignUpMutation();
|
|
73
71
|
const signInMutation = useSignInMutation();
|
|
74
72
|
const updateAccountMutation = useUpdateAccountMutation();
|
|
75
73
|
const sendVerificationCodeMutation = useSendVerificationCodeMutation();
|
|
@@ -3,3 +3,4 @@ export const REFRESH_TOKEN_COOKIE_NAME = 'WebPortalAuthRefreshToken';
|
|
|
3
3
|
export const DOMAIN_COOKIE_NAME = 'WebPortalDomain';
|
|
4
4
|
export const BTAG_COOKIE_NAME = 'WebPortalBtag';
|
|
5
5
|
export const FEATURE_FLAG_LOCAL_STORAGE_KEY = 'WebPortalFeatureFlag';
|
|
6
|
+
export const CXD_STORAGE_KEY = 'WebPortalCellxpertCxd';
|
|
@@ -5,7 +5,6 @@ import { BTAG_COOKIE_NAME, DOMAIN_COOKIE_NAME } from '../constants/index.js';
|
|
|
5
5
|
const UpdateSessionDefinition = z.object({
|
|
6
6
|
domain: z.string().optional().nullable(),
|
|
7
7
|
btag: z.string().optional().nullable(),
|
|
8
|
-
cellxpertCxd: z.string().optional().nullable(),
|
|
9
8
|
});
|
|
10
9
|
export async function patchSession(request) {
|
|
11
10
|
const body = await request.json();
|
|
@@ -67,7 +67,7 @@ export declare const MEMBER = "\n query Member {\n member {\n dateTimeL
|
|
|
67
67
|
/**
|
|
68
68
|
* _aka_ `Query.self`
|
|
69
69
|
*/
|
|
70
|
-
export declare const MEMBER_ACCOUNT = "\n query MemberAccount {\n memberAccount: self {\n ... on MemberAccount {\n id\n name\n status\n realName\n emailAddress\n mobileNumber\n birthDay\n verified\n verificationStatus\n nickName\n validId\n mobileNumberVerified\n mobileNumberVerificationRequired\n transactionPassword\n secretAnswerSubmitted\n dateTimeCreated\n dateTimeLastUpdated\n googleId\n facebookId\n cellxpertDetails {\n cxd\n dateTimeLastUpdated \n
|
|
70
|
+
export declare const MEMBER_ACCOUNT = "\n query MemberAccount {\n memberAccount: self {\n ... on MemberAccount {\n id\n name\n status\n realName\n emailAddress\n mobileNumber\n birthDay\n verified\n verificationStatus\n nickName\n validId\n mobileNumberVerified\n mobileNumberVerificationRequired\n transactionPassword\n secretAnswerSubmitted\n dateTimeCreated\n dateTimeLastUpdated\n googleId\n facebookId\n cellxpertDetails {\n cxd\n dateTimeLastUpdated \n }\n }\n }\n }\n";
|
|
71
71
|
export declare const MEMBER_VERIFICATION = "\n \n fragment FileFragment on File {\n id\n url\n status\n }\n\n\n query MemberVerification {\n memberAccount: self {\n ... on MemberAccount {\n verification {\n id\n status\n address\n permanentAddress\n sourceOfIncome\n natureOfWork\n nationality\n placeOfBirth\n idFrontImage {\n ...FileFragment\n }\n selfieImage {\n ...FileFragment\n }\n }\n }\n }\n }\n";
|
|
72
72
|
export declare const REGISTER_MEMBER_ACCOUNT = "\n mutation RegisterMemberAccount(\n $input: RegisterMemberAccountInput!\n $referralCode: String\n $verificationCode: String\n $reCAPTCHAResponse: String\n ) {\n registerMemberAccount(\n input: $input\n referralCode: $referralCode\n verificationCode: $verificationCode\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MinimumAgeRequirementError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n }\n }\n";
|
|
73
73
|
export declare const REGISTER_MEMBER_ACCOUNT_BY_NAME = "\n mutation RegisterMemberAccountByName(\n $input: RegisterMemberAccountByNameInput!\n $reCAPTCHAResponse: String!\n ) {\n registerMemberAccountByName(\n input: $input\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -10,13 +10,11 @@ export type Session = {
|
|
|
10
10
|
token: string;
|
|
11
11
|
domain?: string;
|
|
12
12
|
btag?: never;
|
|
13
|
-
cellxpertCxd?: never;
|
|
14
13
|
} | {
|
|
15
14
|
status: 'unauthenticated';
|
|
16
15
|
token?: never;
|
|
17
16
|
domain?: string;
|
|
18
17
|
btag?: string;
|
|
19
|
-
cellxpertCxd?: string;
|
|
20
18
|
};
|
|
21
19
|
/**
|
|
22
20
|
* ------------------------------------------------------------
|