@opexa/portal-components 0.0.120 → 0.0.122
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/useBetRecordsQuery.js +4 -1
- package/dist/client/hooks/useClaimSpotBonusMutation.js +2 -6
- package/dist/client/hooks/useDepositRecordsQuery.js +1 -0
- package/dist/client/hooks/useGlobalStore.d.ts +2 -0
- package/dist/client/hooks/useGlobalStore.js +26 -0
- package/dist/client/hooks/useResetPasswordMutation.d.ts +3 -0
- package/dist/client/hooks/useResetPasswordMutation.js +12 -0
- package/dist/client/hooks/useTransactionRecordsQuery.js +1 -0
- package/dist/client/hooks/useWithdrawalRecordsQuery.js +1 -0
- package/dist/components/Bonuses/Bonuses.client.js +24 -14
- package/dist/components/Bonuses/ClaimSpotBonus.d.ts +1 -0
- package/dist/components/Bonuses/ClaimSpotBonus.js +13 -0
- package/dist/components/Bonuses/ClaimSpotBonus.lazy.d.ts +1 -0
- package/dist/components/Bonuses/ClaimSpotBonus.lazy.js +50 -0
- package/dist/components/ForgotPassword/ForgotPassword.d.ts +3 -0
- package/dist/components/ForgotPassword/ForgotPassword.js +14 -0
- package/dist/components/ForgotPassword/ForgotPassword.lazy.d.ts +8 -0
- package/dist/components/ForgotPassword/ForgotPassword.lazy.js +19 -0
- package/dist/components/ForgotPassword/ForgotPasswordForm.d.ts +1 -0
- package/dist/components/ForgotPassword/ForgotPasswordForm.js +136 -0
- package/dist/components/ForgotPassword/ForgotPasswordTrigger.d.ts +6 -0
- package/dist/components/ForgotPassword/ForgotPasswordTrigger.js +14 -0
- package/dist/components/ForgotPassword/index.d.ts +2 -0
- package/dist/components/ForgotPassword/index.js +2 -0
- package/dist/components/KYC/CaptureIdDocument.js +1 -2
- package/dist/components/KYC/CaptureSelfie.js +226 -1
- package/dist/components/KYC/DisplayImage.d.ts +4 -1
- package/dist/components/KYC/DisplayImage.js +2 -4
- package/dist/components/KYC/IdentityVerification.js +2 -2
- package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
- package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
- package/dist/components/KYC/loadModels.d.ts +1 -0
- package/dist/components/KYC/loadModels.js +9 -0
- package/dist/components/KYC/useKYC.d.ts +2 -0
- package/dist/components/KYC/useKYC.js +3 -0
- package/dist/components/KYC/utils.d.ts +2 -0
- package/dist/components/KYC/utils.js +17 -0
- package/dist/components/SignIn/MobileNumberSignIn.js +4 -2
- package/dist/components/SignIn/NameAndPasswordSignIn.js +6 -1
- package/dist/images/ribbon-envelope.png +0 -0
- 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/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +32 -32
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +8 -8
- 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 +154 -154
- package/dist/ui/Dialog/dialog.recipe.d.ts +14 -14
- 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 +105 -0
- package/dist/ui/Field/field.recipe.d.ts +15 -0
- package/dist/ui/Field/field.recipe.js +5 -0
- 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/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/utils/createErrorFromCode.d.ts +2 -0
- package/dist/utils/createErrorFromCode.js +11 -0
- package/dist/utils/getQueryClient.js +1 -1
- package/dist/utils/mutationKeys.d.ts +1 -0
- package/dist/utils/mutationKeys.js +4 -0
- package/package.json +2 -1
|
@@ -7,8 +7,11 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useBetRecordsQuery = (input, config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useInfiniteQuery({
|
|
10
|
-
|
|
10
|
+
staleTime: 1000 * 2,
|
|
11
11
|
...config,
|
|
12
|
+
enabled: config?.enabled === false
|
|
13
|
+
? false
|
|
14
|
+
: sessionQuery.data?.status === 'authenticated',
|
|
12
15
|
queryKey: getBetRecordsQueryKey(input),
|
|
13
16
|
queryFn: async ({ pageParam, signal }) => {
|
|
14
17
|
const session = await getSession();
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { claimSpotBonus } from '../../services/wallet.js';
|
|
4
|
-
import { getQueryClient } from '../../utils/getQueryClient.js';
|
|
5
4
|
import { getClaimSpotBonusMutationKey } from '../../utils/mutationKeys.js';
|
|
6
|
-
import { getBonusesQueryKey } from '../../utils/queryKeys.js';
|
|
7
5
|
import { getSession } from '../services/getSession.js';
|
|
8
6
|
export const useClaimSpotBonusMutation = (config) => {
|
|
9
|
-
const queryClient = getQueryClient();
|
|
10
7
|
return useMutation({
|
|
11
8
|
...config,
|
|
12
9
|
mutationKey: getClaimSpotBonusMutationKey(),
|
|
13
|
-
mutationFn: async (
|
|
10
|
+
mutationFn: async (code) => {
|
|
14
11
|
const session = await getSession();
|
|
15
12
|
invariant(session.status === 'authenticated');
|
|
16
|
-
await claimSpotBonus(
|
|
13
|
+
await claimSpotBonus(code, {
|
|
17
14
|
headers: {
|
|
18
15
|
Authorization: `Bearer ${session.token}`,
|
|
19
16
|
},
|
|
20
17
|
});
|
|
21
|
-
queryClient.setQueryData(getBonusesQueryKey(), (prev) => prev?.filter((bonus) => bonus.id !== id));
|
|
22
18
|
},
|
|
23
19
|
});
|
|
24
20
|
};
|
|
@@ -7,6 +7,7 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useDepositRecordsQuery = (input, config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useInfiniteQuery({
|
|
10
|
+
staleTime: 1000 * 2,
|
|
10
11
|
...config,
|
|
11
12
|
enabled: config?.enabled === false
|
|
12
13
|
? false
|
|
@@ -52,6 +52,7 @@ interface DepositWithdrawalStore extends PopupStore {
|
|
|
52
52
|
interface GlobalStore {
|
|
53
53
|
signUp: PopupStore;
|
|
54
54
|
signIn: PopupStore;
|
|
55
|
+
forgotPassword: PopupStore;
|
|
55
56
|
disclaimer: PopupStore;
|
|
56
57
|
depositWithdrawal: DepositWithdrawalStore;
|
|
57
58
|
gameLaunch: GameLaunchStore;
|
|
@@ -62,6 +63,7 @@ interface GlobalStore {
|
|
|
62
63
|
message: MessageStore;
|
|
63
64
|
sidebar: CollapsibleStore;
|
|
64
65
|
kyc: PopupStore;
|
|
66
|
+
spotBonus: PopupStore;
|
|
65
67
|
}
|
|
66
68
|
export declare const useGlobalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<GlobalStore>>;
|
|
67
69
|
export {};
|
|
@@ -208,4 +208,30 @@ export const useGlobalStore = create((set) => ({
|
|
|
208
208
|
},
|
|
209
209
|
'~touched': false,
|
|
210
210
|
},
|
|
211
|
+
spotBonus: {
|
|
212
|
+
open: false,
|
|
213
|
+
setOpen(open) {
|
|
214
|
+
set((prev) => ({
|
|
215
|
+
spotBonus: {
|
|
216
|
+
...prev.spotBonus,
|
|
217
|
+
open,
|
|
218
|
+
'~touched': true,
|
|
219
|
+
},
|
|
220
|
+
}));
|
|
221
|
+
},
|
|
222
|
+
'~touched': false,
|
|
223
|
+
},
|
|
224
|
+
forgotPassword: {
|
|
225
|
+
open: false,
|
|
226
|
+
setOpen(open) {
|
|
227
|
+
set((prev) => ({
|
|
228
|
+
forgotPassword: {
|
|
229
|
+
...prev.forgotPassword,
|
|
230
|
+
open,
|
|
231
|
+
'~touched': true,
|
|
232
|
+
},
|
|
233
|
+
}));
|
|
234
|
+
},
|
|
235
|
+
'~touched': false,
|
|
236
|
+
},
|
|
211
237
|
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { resetPassword } from '../../services/account.js';
|
|
3
|
+
import { getResetPasswordMutationKey } from '../../utils/mutationKeys.js';
|
|
4
|
+
export const useResetPasswordMutation = (config) => {
|
|
5
|
+
return useMutation({
|
|
6
|
+
...config,
|
|
7
|
+
mutationKey: getResetPasswordMutationKey(),
|
|
8
|
+
mutationFn: async (input) => {
|
|
9
|
+
await resetPassword(input);
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -7,6 +7,7 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useTransactionRecordsQuery = (input, config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useInfiniteQuery({
|
|
10
|
+
staleTime: 1000 * 2,
|
|
10
11
|
...config,
|
|
11
12
|
enabled: config?.enabled === false
|
|
12
13
|
? false
|
|
@@ -7,6 +7,7 @@ import { useSessionQuery } from './useSessionQuery.js';
|
|
|
7
7
|
export const useWithdrawalRecordsQuery = (input, config) => {
|
|
8
8
|
const sessionQuery = useSessionQuery();
|
|
9
9
|
const query = useInfiniteQuery({
|
|
10
|
+
staleTime: 1000 * 2,
|
|
10
11
|
...config,
|
|
11
12
|
enabled: config?.enabled === false
|
|
12
13
|
? false
|
|
@@ -6,15 +6,17 @@ import Image from 'next/image';
|
|
|
6
6
|
import Link from 'next/link';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
import { useShallow } from 'zustand/shallow';
|
|
9
10
|
import { useBonusesQuery } from '../../client/hooks/useBonusesQuery.js';
|
|
10
11
|
import { useCashbackBonusesQuery } from '../../client/hooks/useCashbackBonusesQuery.js';
|
|
11
12
|
import { useClaimCashbackBonusMutation } from '../../client/hooks/useClaimCashbackBonusMutation.js';
|
|
13
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
12
14
|
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
13
15
|
import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
|
|
14
|
-
import { Gift01Icon } from '../../icons/Gift01Icon.js';
|
|
15
16
|
import { StopWatchIcon } from '../../icons/StopWatchIcon.js';
|
|
16
17
|
import moneyOnHand from '../../images/money-on-hand.png';
|
|
17
18
|
import piggyBank from '../../images/piggy-bank.png';
|
|
19
|
+
import ribbonEnvelope from '../../images/ribbon-envelope.png';
|
|
18
20
|
import { Badge } from '../../ui/Badge/index.js';
|
|
19
21
|
import { Button } from '../../ui/Button/index.js';
|
|
20
22
|
import { Progress } from '../../ui/Progress/index.js';
|
|
@@ -22,7 +24,7 @@ import { SegmentGroup } from '../../ui/SegmentGroup/index.js';
|
|
|
22
24
|
import { capitalize } from '../../utils/capitalize.js';
|
|
23
25
|
import { formatNumber } from '../../utils/formatNumber.js';
|
|
24
26
|
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
25
|
-
import {
|
|
27
|
+
import { ClaimSpotBonus } from './ClaimSpotBonus.js';
|
|
26
28
|
const TABS = ['ALL', 'ACTIVE', 'CASHBACKS'];
|
|
27
29
|
export function Bonuses__client(props) {
|
|
28
30
|
const [tab, setTab] = useState(TABS[0]);
|
|
@@ -38,10 +40,9 @@ export function Bonuses__client(props) {
|
|
|
38
40
|
? isAfter(new Date(), bonus.cashback.activationEndDateTime)
|
|
39
41
|
: true;
|
|
40
42
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, className: "mt-3", children: [TABS.map((value) => (_jsxs(SegmentGroup.Item, { value: value, children: [_jsxs(SegmentGroup.ItemText, { children: [" ", capitalize(value)] }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, value))), _jsx(SegmentGroup.Indicator, {})] }), empty && (_jsx(Empty, { className: "mt-8", icon: Gift01Icon, title: "No Rewards", message: "No reward is currently available." })), !empty && (_jsxs("div", { className: "mt-3xl grid gap-3xl lg:mt-lg lg:grid-cols-3", children: [tab !== 'CASHBACKS' && (_jsx(_Fragment, { children: bonuses.map((bonus) => (_jsx(Bonus, { data: bonus, viewDetailsUrl: props.viewBonusDetailsUrl ?? '/rewards' }, bonus.id))) })), cashbackBonuses.map((cashbackBonus) => (_jsx(CashbackBonus, { data: cashbackBonus }, cashbackBonus.id)))] }))] }));
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: props.className, children: [_jsx("h2", { className: "text-lg font-semibold", children: props.heading ?? 'Rewards' }), _jsxs(SegmentGroup.Root, { value: tab, onValueChange: (details) => {
|
|
44
|
+
setTab(z.enum(TABS).parse(details.value));
|
|
45
|
+
}, className: "mt-3", children: [TABS.map((value) => (_jsxs(SegmentGroup.Item, { value: value, children: [_jsx(SegmentGroup.ItemText, { children: capitalize(value) }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }, value))), _jsx(SegmentGroup.Indicator, {})] }), _jsxs("div", { className: "mt-3xl grid gap-3xl lg:mt-lg lg:grid-cols-3", children: [tab === 'ALL' && _jsx(SpotBonus, {}), tab !== 'CASHBACKS' && (_jsx(_Fragment, { children: bonuses.map((bonus) => (_jsx(Bonus, { data: bonus, viewDetailsUrl: props.viewBonusDetailsUrl ?? '/rewards' }, bonus.id))) })), cashbackBonuses.map((cashbackBonus) => (_jsx(CashbackBonus, { data: cashbackBonus }, cashbackBonus.id)))] })] }), _jsx(ClaimSpotBonus, {})] }));
|
|
45
46
|
}
|
|
46
47
|
function Bonus(props) {
|
|
47
48
|
const bonus = props.data;
|
|
@@ -50,27 +51,36 @@ function Bonus(props) {
|
|
|
50
51
|
const remainingTime = useRemainingTime(bonus.expiration);
|
|
51
52
|
const currentTurnoverRequirementContributionPercentage = parseDecimal(bonus.currentTurnoverRequirementContributionPercentage, 0);
|
|
52
53
|
const turnoverRequirement = parseDecimal(bonus.turnoverRequirement, 0);
|
|
53
|
-
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [_jsxs("div", { className: "relative", children: [promo.banner?.url ? (_jsx(Image, { src: promo.banner.url, alt: "", width: 400, height: 200, className: "h-
|
|
54
|
+
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [_jsxs("div", { className: "relative", children: [promo.banner?.url ? (_jsx(Image, { src: promo.banner.url, alt: "", width: 400, height: 200, className: "h-[11.25rem] w-full object-cover" })) : (_jsx("div", { style: {
|
|
55
|
+
background: 'radial-gradient(75.21% 75.21% at 50% 50%, rgba(249, 163, 8, 0.3) 0%, rgba(0, 0, 0, 0) 100%), var(--color-bg-primary-alt)',
|
|
56
|
+
}, children: _jsx(Image, { src: piggyBank, alt: "", className: "mx-auto h-[11.25rem] w-auto shrink-0 object-cover", draggable: false, width: 600, height: 600 }) })), _jsxs(Badge.Root, { size: "lg", round: false, colorScheme: remainingTime.expired ? 'danger' : 'gray', className: "absolute right-4 top-4", children: [_jsx(Badge.Icon, { children: _jsx(StopWatchIcon, {}) }), _jsx(Badge.Label, { children: remainingTime.expired ? 'Expired' : remainingTime.toString() })] })] }), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("h2", { className: "line-clamp-1 text-center text-xl font-semibold text-white", children: promo.name }), _jsxs("div", { className: "mt-2 flex items-baseline justify-center gap-2", children: [_jsx("p", { className: "text-3xl font-semibold leading-none", children: formatNumber(bonus.balance, {
|
|
54
57
|
currency: localeInfo.currency.code,
|
|
55
58
|
}) }), _jsxs("p", { className: "text-text-secondary-700 text-xl font-semibold leading-none", children: ["/\u00A0", formatNumber(bonus.amount, {
|
|
56
59
|
currency: localeInfo.currency.code,
|
|
57
|
-
})] })] }), _jsxs("div", { className: "text-text-primary-brand mt-md flex justify-between", children: [_jsxs("p", { children: ["Wagering ", currentTurnoverRequirementContributionPercentage, "%"] }), _jsxs("p", { children: [currentTurnoverRequirementContributionPercentage, "/", turnoverRequirement] })] }), _jsx(Progress.Root, { min: 0, max: 100, value: clamp(currentTurnoverRequirementContributionPercentage, 0, 100), className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("div", { className: "grow" }), _jsx(Button, { variant: "outline", className: "mt-6", asChild: true, children: _jsx(Link, { href: `${props.viewDetailsUrl}/${bonus.id}`, children: "See More" }) })] })] }));
|
|
60
|
+
})] })] }), _jsxs("div", { className: "text-text-primary-brand mt-md flex justify-between", children: [_jsxs("p", { children: ["Wagering ", currentTurnoverRequirementContributionPercentage, "%"] }), _jsxs("p", { children: [currentTurnoverRequirementContributionPercentage, "/", turnoverRequirement] })] }), _jsx(Progress.Root, { min: 0, max: 100, value: clamp(currentTurnoverRequirementContributionPercentage, 0, 100), className: "mt-2", children: _jsx(Progress.Track, { children: _jsx(Progress.Range, {}) }) }), _jsx("div", { className: "grow" }), _jsx(Button, { size: "sm", variant: "outline", className: "mt-6", asChild: true, children: _jsx(Link, { href: `${props.viewDetailsUrl}/${bonus.id}`, children: "See More" }) })] })] }));
|
|
58
61
|
}
|
|
59
62
|
function CashbackBonus(props) {
|
|
60
63
|
const bonus = props.data;
|
|
61
64
|
const cashback = bonus.cashback;
|
|
62
65
|
const localeInfo = useLocaleInfo();
|
|
63
66
|
const claimCashbackBonusMutation = useClaimCashbackBonusMutation();
|
|
64
|
-
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [cashback.banner?.url ? (_jsx(Image, { src: cashback.banner.url, alt: "", width: 400, height: 200, className: "h-
|
|
67
|
+
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [cashback.banner?.url ? (_jsx(Image, { src: cashback.banner.url, alt: "", width: 400, height: 200, className: "h-[11.25rem] w-full object-cover" })) : (_jsx("div", { style: {
|
|
68
|
+
background: 'radial-gradient(75.21% 75.21% at 50% 50%, rgba(249, 163, 8, 0.3) 0%, rgba(0, 0, 0, 0) 100%), var(--color-bg-primary-alt)',
|
|
69
|
+
}, children: _jsx(Image, { src: moneyOnHand, alt: "", className: "mx-auto h-[11.25rem] w-auto shrink-0 object-cover", draggable: false, width: 600, height: 600 }) })), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("p", { className: "line-clamp-1 text-center text-xl font-semibold text-white", children: cashback.name }), _jsx("h2", { className: "mt-2 text-center text-3xl font-semibold text-white", children: formatNumber(bonus.balance, {
|
|
65
70
|
currency: localeInfo.currency.code,
|
|
66
71
|
}) }), _jsx("div", { className: "text-text-secondary-700 mt-2 line-clamp-1 text-center text-sm", dangerouslySetInnerHTML: {
|
|
67
72
|
__html: cashback.description,
|
|
68
|
-
} }), _jsx("div", { className: "grow" }), _jsx(Button, { className: "mt-6", disabled: claimCashbackBonusMutation.isPending, onClick: () => {
|
|
73
|
+
} }), _jsx("div", { className: "grow" }), _jsx(Button, { size: "sm", className: "mt-6", disabled: claimCashbackBonusMutation.isPending, onClick: () => {
|
|
69
74
|
claimCashbackBonusMutation.mutate(bonus.id);
|
|
70
75
|
}, children: "Claim" })] })] }));
|
|
71
76
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
function SpotBonus() {
|
|
78
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
79
|
+
spotBonus: ctx.spotBonus,
|
|
80
|
+
})));
|
|
81
|
+
return (_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex flex-col overflow-hidden rounded-2xl border", children: [_jsx("div", { style: {
|
|
82
|
+
background: 'radial-gradient(75.21% 75.21% at 50% 50%, rgba(249, 163, 8, 0.3) 0%, rgba(0, 0, 0, 0) 100%), var(--color-bg-primary-alt)',
|
|
83
|
+
}, children: _jsx(Image, { src: ribbonEnvelope, alt: "", className: "mx-auto h-[11.25rem] w-[80%] object-cover", draggable: false, width: 600, height: 341 }) }), _jsxs("div", { className: "flex grow flex-col px-xl py-3xl", children: [_jsx("p", { className: "text-center text-xl font-semibold text-white", children: "Special Rewards" }), _jsx("p", { className: "mt-2 text-center text-3xl font-semibold text-white", children: "Promo Code" }), _jsx("p", { className: "text-text-secondary-700 mt-2 text-center text-sm", children: "Have a promo code? Don\u2019t miss out, redeem it now\u00A0and\u00A0enjoy exclusive rewards!" }), _jsx("div", { className: "grow" }), _jsx(Button, { size: "sm", onClick: () => {
|
|
84
|
+
globalStore.spotBonus.setOpen(true);
|
|
85
|
+
}, className: "mt-6", children: "Enter Promo Code" })] })] }));
|
|
76
86
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ClaimSpotBonus(): import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import dynamic from 'next/dynamic';
|
|
3
|
+
import { useShallow } from 'zustand/shallow';
|
|
4
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
5
|
+
const Component = dynamic(() => import('./ClaimSpotBonus.lazy.js').then((m) => m.ClaimSpotBonus), {
|
|
6
|
+
ssr: false,
|
|
7
|
+
loading: () => null,
|
|
8
|
+
});
|
|
9
|
+
export function ClaimSpotBonus() {
|
|
10
|
+
const touched = useGlobalStore(useShallow((ctx) => ctx.spotBonus['~touched']));
|
|
11
|
+
if (touched)
|
|
12
|
+
return _jsx(Component, {});
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ClaimSpotBonus(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { useForm } from 'react-hook-form';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { useShallow } from 'zustand/shallow';
|
|
7
|
+
import { useClaimSpotBonusMutation } from '../../client/hooks/useClaimSpotBonusMutation.js';
|
|
8
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
9
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
10
|
+
import ribbonEnvelope from '../../images/ribbon-envelope.png';
|
|
11
|
+
import { Button } from '../../ui/Button/index.js';
|
|
12
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
13
|
+
import { Field } from '../../ui/Field/index.js';
|
|
14
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
15
|
+
const definition = z.object({
|
|
16
|
+
code: z.string().min(1, 'Code is required').trim(),
|
|
17
|
+
});
|
|
18
|
+
export function ClaimSpotBonus() {
|
|
19
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
20
|
+
spotBonus: ctx.spotBonus,
|
|
21
|
+
})));
|
|
22
|
+
const claimSpotBonusMutation = useClaimSpotBonusMutation({
|
|
23
|
+
onSuccess() {
|
|
24
|
+
form.reset();
|
|
25
|
+
globalStore.spotBonus.setOpen(false);
|
|
26
|
+
toaster.success({
|
|
27
|
+
description: 'You have successfully redeemed your bonus!!',
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
onError(error) {
|
|
31
|
+
toaster.error({
|
|
32
|
+
description: error.message,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const form = useForm({
|
|
37
|
+
resolver: zodResolver(definition),
|
|
38
|
+
defaultValues: {
|
|
39
|
+
code: '',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return (_jsx(Dialog.Root, { open: globalStore.spotBonus.open, onOpenChange: (details) => globalStore.spotBonus.setOpen(details.open), lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center lg:items-start", children: _jsxs(Dialog.Content, { className: "mx-auto w-[25rem] max-w-full rounded-xl p-3xl", children: [_jsx("div", { className: "overflow-hidden rounded-md", style: {
|
|
43
|
+
background: 'radial-gradient(75.21% 75.21% at 50% 50%, rgba(249, 163, 8, 0.3) 0%, rgba(0, 0, 0, 0) 100%), var(--color-bg-primary-alt)',
|
|
44
|
+
}, children: _jsx(Image, { src: ribbonEnvelope, alt: "", className: "mx-auto h-[12.5rem] w-[80%] object-cover", draggable: false, width: 600, height: 341 }) }), _jsxs("form", { className: "mt-3xl", onSubmit: form.handleSubmit((data) => {
|
|
45
|
+
claimSpotBonusMutation.mutate(data.code);
|
|
46
|
+
}), children: [_jsx("h2", { className: "text-center text-lg font-semibold", children: "Enter Promo Code" }), _jsx("p", { className: "text-text-tertiary-600 mt-xs text-center text-sm", children: "Claim your reward by entering a promo or gift code!" }), _jsxs(Field.Root, { invalid: !!form.formState.errors.code, className: "mt-2xl", children: [_jsx(Field.Input, { size: "sm", placeholder: "Enter promo code", ...form.register('code') }), _jsx(Field.ErrorText, { children: form.formState.errors.code?.message })] }), _jsxs("div", { className: "mt-4xl flex gap-lg", children: [_jsx(Button, { variant: "outline", onClick: () => {
|
|
47
|
+
globalStore.spotBonus.setOpen(false);
|
|
48
|
+
form.reset();
|
|
49
|
+
}, disabled: claimSpotBonusMutation.isPending, children: "Cancel" }), _jsx(Button, { type: "submit", disabled: claimSpotBonusMutation.isPending, children: "Claim" })] })] })] }) })] }) }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import dynamic from 'next/dynamic';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
6
|
+
const Component = dynamic(() => import('./ForgotPassword.lazy.js').then((m) => m.ForgotPassword), {
|
|
7
|
+
ssr: false,
|
|
8
|
+
loading: () => null,
|
|
9
|
+
});
|
|
10
|
+
export function ForgotPassword(props) {
|
|
11
|
+
const touched = useGlobalStore(useShallow((ctx) => ctx.forgotPassword['~touched']));
|
|
12
|
+
if (touched)
|
|
13
|
+
return _jsx(Component, { ...props });
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ImageProps } from 'next/image';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export interface ForgotPasswordProps {
|
|
4
|
+
logo: ImageProps['src'];
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ForgotPassword(props: ForgotPasswordProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Image, {} from 'next/image';
|
|
4
|
+
import { Suspense } from 'react';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { useShallow } from 'zustand/shallow';
|
|
7
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
8
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
9
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
10
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
11
|
+
import { ForgotPasswordForm } from './ForgotPasswordForm.js';
|
|
12
|
+
export function ForgotPassword(props) {
|
|
13
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
14
|
+
forgotPassword: ctx.forgotPassword,
|
|
15
|
+
})));
|
|
16
|
+
return (_jsx(Dialog.Root, { open: globalStore.forgotPassword.open, onOpenChange: (details) => {
|
|
17
|
+
globalStore.forgotPassword.setOpen(details.open);
|
|
18
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: twMerge('bg-bg-primary-alt mx-auto h-full w-full items-start p-3xl pb-4xl lg:h-auto lg:w-[400px] lg:rounded-xl', props.className), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsx(Suspense, { children: _jsx(ForgotPasswordForm, {}) })] }) })] }) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ForgotPasswordForm(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
4
|
+
import { useRef, useState } from 'react';
|
|
5
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { useShallow } from 'zustand/shallow';
|
|
8
|
+
import { useCooldown } from '../../client/hooks/useCooldown.js';
|
|
9
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
10
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
11
|
+
import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
|
|
12
|
+
import { useResetPasswordMutation } from '../../client/hooks/useResetPasswordMutation.js';
|
|
13
|
+
import { useSendVerificationCodeMutation } from '../../client/hooks/useSendVerificationCodeMutation.js';
|
|
14
|
+
import { toaster } from '../../client/utils/toaster.js';
|
|
15
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
16
|
+
import { EyeIcon } from '../../icons/EyeIcon.js';
|
|
17
|
+
import { EyeOffIcon } from '../../icons/EyeOffIcon.js';
|
|
18
|
+
import { Button } from '../../ui/Button/index.js';
|
|
19
|
+
import { Field } from '../../ui/Field/index.js';
|
|
20
|
+
import { PasswordInput } from '../../ui/PasswordInput/index.js';
|
|
21
|
+
import { PinInput } from '../../ui/PinInput/index.js';
|
|
22
|
+
export function ForgotPasswordForm() {
|
|
23
|
+
const [step, setStep] = useState(1);
|
|
24
|
+
const mobileNumberParser = useMobileNumberParser();
|
|
25
|
+
const localeInfo = useLocaleInfo();
|
|
26
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
27
|
+
signIn: ctx.signIn,
|
|
28
|
+
forgotPassword: ctx.forgotPassword,
|
|
29
|
+
})));
|
|
30
|
+
const sendVerificationCodeMutation = useSendVerificationCodeMutation();
|
|
31
|
+
const resetPasswordMutation = useResetPasswordMutation({
|
|
32
|
+
onSuccess() {
|
|
33
|
+
globalStore.forgotPassword.setOpen(false);
|
|
34
|
+
globalStore.signIn.setOpen(true);
|
|
35
|
+
step1Form.reset();
|
|
36
|
+
step2Form.reset();
|
|
37
|
+
toaster.success({
|
|
38
|
+
description: 'Your password has been updated.',
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
onError(error) {
|
|
42
|
+
toaster.error({
|
|
43
|
+
description: error.message,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
const Step1Definition = z
|
|
48
|
+
.object({
|
|
49
|
+
mobileNumber: z.string().superRefine((v, ctx) => {
|
|
50
|
+
if (!mobileNumberParser.validate(v)) {
|
|
51
|
+
ctx.addIssue({
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
53
|
+
message: 'Invalid mobile number',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
newPassword: z
|
|
58
|
+
.string()
|
|
59
|
+
.min(8, 'Password must be 8 or more characters')
|
|
60
|
+
.max(100, 'Password must not be more than 100 characters'),
|
|
61
|
+
confirmPassword: z.string().min(1, 'Confirm your password'),
|
|
62
|
+
})
|
|
63
|
+
.superRefine((val, ctx) => {
|
|
64
|
+
if (val.newPassword !== val.confirmPassword) {
|
|
65
|
+
ctx.addIssue({
|
|
66
|
+
path: ['confirmPassword'],
|
|
67
|
+
code: z.ZodIssueCode.custom,
|
|
68
|
+
message: 'Passwords do not match',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const Step2Definition = z.object({
|
|
73
|
+
verificationCode: z.array(z.string().min(1).max(1).trim()).min(6).max(6),
|
|
74
|
+
});
|
|
75
|
+
const step1Form = useForm({
|
|
76
|
+
mode: 'all',
|
|
77
|
+
resolver: zodResolver(Step1Definition),
|
|
78
|
+
defaultValues: {
|
|
79
|
+
mobileNumber: '',
|
|
80
|
+
confirmPassword: '',
|
|
81
|
+
newPassword: '',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const step2Form = useForm({
|
|
85
|
+
resolver: zodResolver(Step2Definition),
|
|
86
|
+
defaultValues: {
|
|
87
|
+
verificationCode: Array.from({ length: 6 }).fill(''),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
const cooldown = useCooldown({
|
|
91
|
+
max: 60,
|
|
92
|
+
duration: 1000 * 60,
|
|
93
|
+
});
|
|
94
|
+
const form2Ref = useRef(null);
|
|
95
|
+
return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Forgot Password" }), _jsx("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Your new password will be used to sign in." }), _jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
|
|
96
|
+
try {
|
|
97
|
+
await sendVerificationCodeMutation.mutateAsync({
|
|
98
|
+
channel: 'SMS',
|
|
99
|
+
recipient: mobileNumberParser.format(data.mobileNumber),
|
|
100
|
+
});
|
|
101
|
+
setStep(2);
|
|
102
|
+
cooldown.start();
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
toaster.error({
|
|
106
|
+
description: e instanceof Error
|
|
107
|
+
? e.message
|
|
108
|
+
: 'Failed to send verification code',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}), children: [_jsxs(Field.Root, { invalid: !!step1Form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsxs("div", { className: "absolute left-3.5 top-1/2 flex shrink-0 -translate-y-1/2 items-center gap-md", children: [_jsx(localeInfo.country.flag, { className: "size-5" }), _jsx("span", { className: "text-text-placeholder", children: localeInfo.mobileNumber.areaCode })] }), _jsx(Field.Input, { style: {
|
|
112
|
+
paddingLeft: `calc(2.75rem + ${localeInfo.mobileNumber.areaCode.length}ch)`,
|
|
113
|
+
}, ...step1Form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.mobileNumber?.message })] }), _jsx(Field.Root, { invalid: !!step1Form.formState.errors.newPassword, className: "mt-xl", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "New Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter your new password", ...step1Form.register('newPassword') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.newPassword?.message })] }) }), _jsx(Field.Root, { invalid: !!step1Form.formState.errors.confirmPassword, className: "mt-xl", children: _jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Confirm Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Confirm new password", ...step1Form.register('confirmPassword') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.confirmPassword?.message })] }) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: step1Form.formState.isSubmitting, children: "Continue" })] })] })), step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center text-lg font-semibold", children: "Check your Phone" }), _jsxs("p", { className: "text-text-secondary-700 mt-xs text-center text-sm", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
|
|
114
|
+
resetPasswordMutation.mutate({
|
|
115
|
+
mobileNumber: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
116
|
+
newPassword: step1Form.getValues('newPassword'),
|
|
117
|
+
verificationCode: verificationCode.join(''),
|
|
118
|
+
});
|
|
119
|
+
}), children: [_jsx(Controller, { name: "verificationCode", control: step2Form.control, render: (o) => (_jsxs(PinInput.Root, { placeholder: "0", invalid: o.fieldState.invalid, value: o.field.value, onValueChange: (details) => {
|
|
120
|
+
o.field.onChange(details.value);
|
|
121
|
+
}, onValueComplete: () => {
|
|
122
|
+
form2Ref.current?.requestSubmit();
|
|
123
|
+
}, children: [_jsxs(PinInput.Control, { className: "grid-cols-[1fr_1fr_1fr_auto_1fr_1fr_1fr] items-center gap-md", children: [_jsx(PinInput.Input, { index: 0 }), _jsx(PinInput.Input, { index: 1 }), _jsx(PinInput.Input, { index: 2 }), _jsx("span", { className: "text-text-placeholder-subtle text-2xl font-medium", children: "\u2013" }), _jsx(PinInput.Input, { index: 3 }), _jsx(PinInput.Input, { index: 4 }), _jsx(PinInput.Input, { index: 5 })] }), _jsx(PinInput.HiddenInput, {})] })) }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: resetPasswordMutation.isPending, children: "Verify" }), _jsxs("div", { className: "mt-3 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-secondary-700", children: "Didn't recieve the code?" }), _jsx("button", { type: "button", className: "text-button-secondary-fg font-semibold disabled:cursor-not-allowed disabled:opacity-75", disabled: cooldown.cooling, onClick: async () => {
|
|
124
|
+
await sendVerificationCodeMutation.mutateAsync({
|
|
125
|
+
channel: 'SMS',
|
|
126
|
+
recipient: mobileNumberParser.format(step1Form.getValues('mobileNumber')),
|
|
127
|
+
});
|
|
128
|
+
cooldown.start();
|
|
129
|
+
}, children: cooldown.cooling
|
|
130
|
+
? `Resend in ${cooldown.countdown}s`
|
|
131
|
+
: 'Resend' })] }), _jsxs("button", { type: "button", className: "text-text-tertiary-600 mx-auto mt-3xl flex w-fit items-center gap-1 text-sm font-semibold", onClick: () => {
|
|
132
|
+
setStep(1);
|
|
133
|
+
step2Form.reset();
|
|
134
|
+
cooldown.stop();
|
|
135
|
+
}, children: [_jsx(ArrowLeftIcon, { className: "size-5" }), "Back"] })] })] }))] }));
|
|
136
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
interface ForgotPasswordTriggerProps extends ComponentPropsWithRef<'button'> {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function ForgotPasswordTrigger(props: ForgotPasswordTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ark } from '@ark-ui/react/factory';
|
|
4
|
+
import { useShallow } from 'zustand/shallow';
|
|
5
|
+
import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
|
|
6
|
+
export function ForgotPasswordTrigger(props) {
|
|
7
|
+
const globalStore = useGlobalStore(useShallow((ctx) => ({
|
|
8
|
+
forgotPassword: ctx.forgotPassword,
|
|
9
|
+
})));
|
|
10
|
+
return (_jsx(ark.button, { type: "button", "aria-label": "Reset Password", "data-state": globalStore.forgotPassword.open ? 'open' : 'closed', ...props, onClick: (e) => {
|
|
11
|
+
globalStore.forgotPassword.setOpen(!globalStore.forgotPassword.open);
|
|
12
|
+
return props.onClick?.(e);
|
|
13
|
+
} }));
|
|
14
|
+
}
|
|
@@ -9,9 +9,8 @@ import { CheckCircleIcon } from '../../icons/CheckCircleIcon.js';
|
|
|
9
9
|
import { XIcon } from '../../icons/XIcon.js';
|
|
10
10
|
import { Button } from '../../ui/Button/index.js';
|
|
11
11
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
12
|
-
import { dataURLtoBlob } from '../../utils/dataUrlToBlob.js';
|
|
13
|
-
import { resizeFile } from '../../utils/resizeImageSize.js';
|
|
14
12
|
import { useKYCContext } from './KYCContext.js';
|
|
13
|
+
import { dataURLtoBlob, resizeFile } from './utils.js';
|
|
15
14
|
export function CaptureIdDocument() {
|
|
16
15
|
const kyc = useKYCContext();
|
|
17
16
|
const { mutate, isPending } = useUploadImageFileMutation();
|