@opexa/portal-components 0.0.514 → 0.0.516
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/components/AccountInfo/GoogleDisconnect.d.ts +7 -0
- package/dist/components/AccountInfo/GoogleDisconnect.js +11 -0
- package/dist/components/AccountVerification/AccountVerification.js +1 -1
- package/dist/components/Bonuses/Bonuses.client.js +2 -2
- package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
- package/dist/components/DigitainLauncher/Loading.js +5 -0
- package/dist/components/KYC/BasicInformation.d.ts +1 -0
- package/dist/components/KYC/BasicInformation.js +101 -0
- package/dist/components/KYC/IdentityVerification.d.ts +1 -0
- package/dist/components/KYC/IdentityVerification.js +120 -0
- package/dist/components/KYC/Indicator.d.ts +1 -0
- package/dist/components/KYC/Indicator.js +8 -0
- package/dist/components/KYC/KYC.lazy.d.ts +6 -0
- package/dist/components/KYC/KYC.lazy.js +45 -0
- package/dist/components/KYC/KYCContext.d.ts +6 -0
- package/dist/components/KYC/KYCContext.js +2 -0
- package/dist/components/KYC/KYCDefault/IdentityVerification.js +0 -3
- package/dist/components/KYC/KYCDefault/PersonalInformation.js +0 -3
- package/dist/components/KYC/KYCReminder.lazy.js +8 -3
- package/dist/components/KYC/KycOpenOnHomeMount.js +1 -0
- package/dist/components/KYC/PersonalInformation.d.ts +1 -0
- package/dist/components/KYC/PersonalInformation.js +122 -0
- package/dist/components/KYC/useKYC.d.ts +25 -0
- package/dist/components/KYC/useKYC.js +38 -0
- package/dist/components/PortalProvider/CXDTokenObserver.js +11 -11
- package/dist/components/Quests/JourneyQuest.js +3 -3
- package/dist/components/Quests/MultiWageringQuest.js +3 -3
- package/dist/components/Quests/Quests.client.js +1 -1
- package/dist/components/SessionWatcher/SessionWatcher.d.ts +1 -0
- package/dist/components/SessionWatcher/SessionWatcher.js +20 -0
- package/dist/components/SessionWatcher/index.d.ts +1 -0
- package/dist/components/SessionWatcher/index.js +1 -0
- package/dist/components/SignIn/MobileNumberSignIn.js +1 -1
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +18 -2
- package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +17 -1
- package/dist/components/shared/IdFrontImageField/useIdFrontImageField.js +2 -3
- package/dist/components/shared/SelfieImageField/useSelfieImageField.js +3 -0
- package/dist/constants/EnvVar.d.ts +1 -1
- package/dist/handlers/index.d.ts +7 -7
- package/dist/icons/LinkBrokenIcon.d.ts +2 -0
- package/dist/icons/LinkBrokenIcon.js +4 -0
- package/dist/images/responsible-gaming-yellow.png +0 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
- 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/Dialog/dialog.recipe.js +1 -1
- 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 +307 -307
- package/dist/ui/Menu/menu.recipe.d.ts +17 -17
- 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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
export function useKYC() {
|
|
3
|
+
const [step, setStep] = useState(2);
|
|
4
|
+
const [done, setDone] = useState(false);
|
|
5
|
+
const [idFrontImageId, setFrontImageId] = useState(null);
|
|
6
|
+
const [selfieImageId, setSelfieImageId] = useState(null);
|
|
7
|
+
const subscribers = useRef([]);
|
|
8
|
+
const subscribe = (subscriber) => {
|
|
9
|
+
subscribers.current.push(subscriber);
|
|
10
|
+
return () => {
|
|
11
|
+
subscribers.current = subscribers.current.filter((item) => item !== subscriber);
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const triggerEvent = (detail) => {
|
|
15
|
+
subscribers.current.forEach((subscriber) => {
|
|
16
|
+
subscriber(detail);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const reset = () => {
|
|
20
|
+
setStep(1);
|
|
21
|
+
setDone(false);
|
|
22
|
+
setFrontImageId(null);
|
|
23
|
+
setSelfieImageId(null);
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
step,
|
|
27
|
+
setStep,
|
|
28
|
+
done,
|
|
29
|
+
setDone,
|
|
30
|
+
idFrontImageId,
|
|
31
|
+
setFrontImageId,
|
|
32
|
+
selfieImageId,
|
|
33
|
+
setSelfieImageId,
|
|
34
|
+
subscribe,
|
|
35
|
+
triggerEvent,
|
|
36
|
+
reset,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { addHours } from 'date-fns';
|
|
3
3
|
import { clamp } from 'lodash-es';
|
|
4
|
+
import { useSearchParams } from 'next/navigation';
|
|
4
5
|
import { useLocalStorage, useTimeout } from 'usehooks-ts';
|
|
5
6
|
import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
|
|
6
7
|
export function CXDTokenObserver() {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const [cxd, setCxd, removeCxd] = useLocalStorage('
|
|
8
|
+
const searchParams = useSearchParams();
|
|
9
|
+
const cxdToken = searchParams.get('cxd');
|
|
10
|
+
const accountQuery = useAccountQuery();
|
|
11
|
+
const account = accountQuery.data;
|
|
12
|
+
const [cxd, setCxd, removeCxd] = useLocalStorage('WebPortalCellxpertCxd', null);
|
|
12
13
|
const now = new Date();
|
|
14
|
+
const shouldTimeoutRun = cxdToken && account;
|
|
13
15
|
const removeCxdUntilInMs = cxd?.timestamp
|
|
14
16
|
? clamp(cxd.timestamp - now.getTime(), 0, Infinity)
|
|
15
17
|
: 0;
|
|
16
18
|
useTimeout(() => {
|
|
17
|
-
const isSame = cxd?.cxd ===
|
|
19
|
+
const isSame = cxd?.cxd === cxdToken;
|
|
18
20
|
if (!isSame) {
|
|
19
21
|
const extendedTimestamp = addHours(new Date(), 6).getTime();
|
|
20
22
|
setCxd({
|
|
21
|
-
cxd:
|
|
23
|
+
cxd: cxdToken,
|
|
22
24
|
timestamp: extendedTimestamp,
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
|
-
},
|
|
26
|
-
useTimeout(() =>
|
|
27
|
-
removeCxd();
|
|
28
|
-
}, account ? removeCxdUntilInMs : null);
|
|
27
|
+
}, shouldTimeoutRun ? 100 : null);
|
|
28
|
+
useTimeout(() => removeCxd(), shouldTimeoutRun ? removeCxdUntilInMs : null);
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
@@ -41,7 +41,7 @@ export function JourneyQuest(props) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
const filteredMilestones = quest.milestones.filter((milestone) => {
|
|
44
|
-
if (!featureFlag.enabled) {
|
|
44
|
+
if (!featureFlag.enabled && !window.location.href.includes('blucky')) {
|
|
45
45
|
return (milestone.type !== 'LINK_FACEBOOK_ACCOUNT' &&
|
|
46
46
|
milestone.type !== 'LINK_GOOGLE_ACCOUNT');
|
|
47
47
|
}
|
|
@@ -124,8 +124,8 @@ function Rules(props) {
|
|
|
124
124
|
}, "aria-label": `Complete ${milestone.label}`, children: [milestone.key === 'ACCOUNT_VERIFICATION' ? (_jsx(FileCheck02Icon, { className: "size-5" })) : (_jsx(CoinsHandIcon, { className: "size-5" })), milestone.key === 'FIRST_DEPOSIT'
|
|
125
125
|
? 'Deposit'
|
|
126
126
|
: 'Verify Account'] })), !milestone.isCompleted &&
|
|
127
|
-
milestone.key === 'LINK_FACEBOOK_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className:
|
|
128
|
-
milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className:
|
|
127
|
+
milestone.key === 'LINK_FACEBOOK_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Facebook Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(FacebookSignInTrigger, { text: "Link Facebook Account", className: "!mt-0 flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] })), !milestone.isCompleted &&
|
|
128
|
+
milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Google Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(GoogleSignInButton, { text: "Link Google Account", className: "flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] }))] }, milestone.key))), quest?.bonus && (_jsx("div", { className: "flex h-full items-end", children: allMilestonesCompleted ? (_jsx(Button, { size: "sm", onClick: () => setOpen(false), "aria-label": "Close", className: "w-full", children: "Close" })) : (_jsx("div", { className: "w-full rounded-md border border-bg-primary-hover bg-button-secondary-bg px-3.5 py-2.5 text-center text-white", children: _jsxs("p", { children: ["Complete target to", ' ', _jsxs("span", { className: "text-brand-400", children: ["\u20B1", quest?.bonus] }), ' ', "bonus!"] }) })) }))] })] }) })] }) }));
|
|
129
129
|
}
|
|
130
130
|
function QuestMilestone({ label, bonus, isCompleted = false, checkboxControlStyle, }) {
|
|
131
131
|
const localeInfo = useLocaleInfo();
|
|
@@ -11,6 +11,7 @@ import { Button } from '../../ui/Button/index.js';
|
|
|
11
11
|
import { Dialog } from '../../ui/Dialog/index.js';
|
|
12
12
|
import { Portal } from '../../ui/Portal/index.js';
|
|
13
13
|
import { Progress } from '../../ui/Progress/index.js';
|
|
14
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
14
15
|
import { formatNumber } from '../../utils/formatNumber.js';
|
|
15
16
|
import { useQuestContext } from './QuestsContext.js';
|
|
16
17
|
import { RemainingTime } from './RemainingTime.js';
|
|
@@ -88,9 +89,8 @@ function Stages(props) {
|
|
|
88
89
|
const stage = props?.stages?.findLastIndex((stage) => stage.cleared) ?? 0;
|
|
89
90
|
return stage !== -1 ? stage + 1 : 1;
|
|
90
91
|
}, [props.stages]);
|
|
91
|
-
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto mt-40 min-h-auto min-w-[23rem] max-w-[25rem] overflow-y-auto rounded-xl border border-border-wagering-popup px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: props.quest?.name || 'Quest' }), _jsx(
|
|
92
|
-
__html: props.quest?.description
|
|
93
|
-
'Ready for a challenge? Complete them all and get amazing rewards!',
|
|
92
|
+
return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "mx-auto mt-40 min-h-auto min-w-[23rem] max-w-[25rem] overflow-y-auto rounded-xl border border-border-wagering-popup px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: props.quest?.name || 'Quest' }), _jsx(Prose, { dangerouslySetInnerHTML: {
|
|
93
|
+
__html: props.quest?.description ?? '',
|
|
94
94
|
} }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: props.stages.map((stage, idx) => {
|
|
95
95
|
if (currentStage >= idx + 1) {
|
|
96
96
|
return (_jsx(QuestWageringStageUnlocked, { data: stage, progressValue: stage.progressValue, bonus: stage.bonusAmount, stage: idx, isCompleted: stage.cleared }, idx));
|
|
@@ -60,7 +60,7 @@ export function Quests__client(props) {
|
|
|
60
60
|
setTab(TabDefinition.catch('AVAILABLE').parse(details.value));
|
|
61
61
|
}, className: "mt-3 w-full overflow-x-auto lg:mt-4.5 lg:w-fit", children: [_jsxs(SegmentGroup.Item, { value: "AVAILABLE", className: "w-full lg:w-fit", children: [_jsx(SegmentGroup.ItemText, { children: "Available" }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }), _jsxs(SegmentGroup.Item, { value: "COMPLETED", className: "w-full lg:w-fit", children: [_jsx(SegmentGroup.ItemText, { children: "Completed" }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }), _jsxs(SegmentGroup.Item, { value: "FAILED", className: "w-full lg:w-fit", children: [_jsx(SegmentGroup.ItemText, { children: "Failed" }), _jsx(SegmentGroup.ItemControl, {}), _jsx(SegmentGroup.ItemHiddenInput, {})] }), _jsx(SegmentGroup.Indicator, {})] }), _jsx("div", { className: "mt-3xl grid gap-3xl lg:mt-lg lg:grid-cols-3", children: quests.length > 0 ? (quests.map((quest) => {
|
|
62
62
|
const Quest = quest.stages?.length && featureFlag.enabled
|
|
63
|
-
? QUEST_COMPONENT_MAP
|
|
63
|
+
? QUEST_COMPONENT_MAP.MULTI_WAGERING
|
|
64
64
|
: QUEST_COMPONENT_MAP[quest.type];
|
|
65
65
|
return (_jsx(QuestContext, { value: quest, children: _jsx(Suspense, { children: _jsx(Quest, { className: quest.type === 'WAGERING'
|
|
66
66
|
? classNames?.wageringQuest
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SessionWatcher(): null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useRouter } from 'next/navigation';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
|
+
import { useSessionHealthQuery } from '../../client/hooks/useSessionHealthQuery.js';
|
|
5
|
+
import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
|
|
6
|
+
export function SessionWatcher() {
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
const query = useSessionHealthQuery({ refetchInterval: 1000 * 5 });
|
|
9
|
+
const healthy = query.data ?? true;
|
|
10
|
+
const mutation = useSignOutMutation();
|
|
11
|
+
const signOut = useCallback(async () => {
|
|
12
|
+
await mutation.mutateAsync();
|
|
13
|
+
router.refresh();
|
|
14
|
+
}, [mutation, router]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!healthy)
|
|
17
|
+
signOut();
|
|
18
|
+
}, [healthy, signOut]);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SessionWatcher';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SessionWatcher.js';
|
|
@@ -48,7 +48,7 @@ export function MobileNumberSignIn() {
|
|
|
48
48
|
context.setStep(1);
|
|
49
49
|
globalStore.signIn.setOpen(false);
|
|
50
50
|
},
|
|
51
|
-
onError: (
|
|
51
|
+
onError: () => {
|
|
52
52
|
toaster.error({
|
|
53
53
|
title: 'Invalid Verification Code',
|
|
54
54
|
description: 'Please enter the correct verification code',
|
|
@@ -199,7 +199,7 @@ export function SignUpDefaultForm() {
|
|
|
199
199
|
placement: 'bottom',
|
|
200
200
|
}, lazyMount: true, unmountOnExit: true, children: [_jsxs(Select.Label, { className: "flex items-center gap-1", children: ["Branch", _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: {
|
|
201
201
|
placement: 'top',
|
|
202
|
-
}, children: [_jsx(Tooltip.Trigger, { children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item) => {
|
|
202
|
+
}, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx(HelpCircleIcon, { className: "size-4 text-text-nav-item-button-icon" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) }), "Choose branch closest to your residence."] }) })] })] }), _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: branchCollection.items.map((item) => {
|
|
203
203
|
const label = branchCollection.stringifyItem(item) ?? '';
|
|
204
204
|
return (_jsx(Select.Item, { item: item, "aria-disabled": item.disabled, className: twMerge(item.disabled && 'text-border-disabled'), children: _jsx("div", { title: label, className: "line-clamp-1", children: label }) }, item.code));
|
|
205
205
|
}) }) })] }), _jsx(Field.ErrorText, { children: step1Form.formState.errors.branchCode?.message })] })), _jsx(Controller, { control: step1Form.control, name: "termsAccepted", render: (o) => (_jsxs(Field.Root, { className: "mt-2xl", invalid: o.fieldState.invalid, children: [_jsxs(Checkbox.Root, { checked: o.field.value, onCheckedChange: (details) => {
|
|
@@ -313,10 +313,26 @@ function DateOfBirthField(props) {
|
|
|
313
313
|
defaultValue: props.defaultValue ?? null,
|
|
314
314
|
onChange: props.onChange,
|
|
315
315
|
});
|
|
316
|
+
// Custom input handler to automatically add slashes
|
|
317
|
+
const handleInput = (e) => {
|
|
318
|
+
const input = e.currentTarget;
|
|
319
|
+
let value = input.value.replace(/\D/g, ''); // Remove all non-digits
|
|
320
|
+
// Add slashes at appropriate positions
|
|
321
|
+
if (value.length >= 2) {
|
|
322
|
+
value = value.slice(0, 2) + '/' + value.slice(2);
|
|
323
|
+
}
|
|
324
|
+
if (value.length >= 5) {
|
|
325
|
+
value = value.slice(0, 5) + '/' + value.slice(5);
|
|
326
|
+
}
|
|
327
|
+
// Limit to MM/DD/YYYY format (8 characters + 2 slashes = 10 total)
|
|
328
|
+
value = value.slice(0, 10);
|
|
329
|
+
// Update the input value
|
|
330
|
+
input.value = value;
|
|
331
|
+
};
|
|
316
332
|
return (_jsxs(DatePicker.Root, { size: "md", variant: "outline", placeholder: "MM/DD/YYYY", lazyMount: true, unmountOnExit: true, fixedWeeks: true, selectionMode: "single", value: value ? [parseDate(value)] : [], onValueChange: (details) => {
|
|
317
333
|
const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
|
|
318
334
|
setValue(value ?? null);
|
|
319
|
-
}, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
335
|
+
}, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus, onInput: handleInput }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
320
336
|
.getMonthsGrid({ columns: 4, format: 'short' })
|
|
321
337
|
.map((months, id) => (_jsx(DatePicker.TableRow, { children: months.map((month, id) => (_jsx(DatePicker.TableCell, { value: month.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: month.label }) }, id))) }, id))) }) })] })) }) }), _jsx(DatePicker.View, { view: "year", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
322
338
|
.getYearsGrid({ columns: 4 })
|
|
@@ -462,10 +462,26 @@ function DateOfBirthField(props) {
|
|
|
462
462
|
defaultValue: props.defaultValue ?? null,
|
|
463
463
|
onChange: props.onChange,
|
|
464
464
|
});
|
|
465
|
+
// Custom input handler to automatically add slashes
|
|
466
|
+
const handleInput = (e) => {
|
|
467
|
+
const input = e.currentTarget;
|
|
468
|
+
let value = input.value.replace(/\D/g, ''); // Remove all non-digits
|
|
469
|
+
// Add slashes at appropriate positions
|
|
470
|
+
if (value.length >= 2) {
|
|
471
|
+
value = value.slice(0, 2) + '/' + value.slice(2);
|
|
472
|
+
}
|
|
473
|
+
if (value.length >= 5) {
|
|
474
|
+
value = value.slice(0, 5) + '/' + value.slice(5);
|
|
475
|
+
}
|
|
476
|
+
// Limit to MM/DD/YYYY format (8 characters + 2 slashes = 10 total)
|
|
477
|
+
value = value.slice(0, 10);
|
|
478
|
+
// Update the input value
|
|
479
|
+
input.value = value;
|
|
480
|
+
};
|
|
465
481
|
return (_jsxs(DatePicker.Root, { size: "md", variant: "outline", placeholder: "MM/DD/YYYY", lazyMount: true, unmountOnExit: true, fixedWeeks: true, selectionMode: "single", value: value ? [parseDate(value)] : [], onValueChange: (details) => {
|
|
466
482
|
const value = details.value.at(0)?.toDate(DEVICE_TIMEZONE);
|
|
467
483
|
setValue(value ?? null);
|
|
468
|
-
}, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
484
|
+
}, children: [_jsx(DatePicker.Label, { children: "Date of Birth" }), _jsxs(DatePicker.Control, { children: [_jsx(DatePicker.Input, { onBlur: props.onBlur, onFocus: props.onFocus, onInput: handleInput }), _jsx(DatePicker.Trigger, { children: _jsx(CalendarIcon, {}) })] }), _jsx(DatePicker.Positioner, { children: _jsxs(DatePicker.Content, { children: [_jsx(DatePicker.View, { view: "day", children: _jsx(DatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsxs(DatePicker.Table, { children: [_jsx(DatePicker.TableHead, { children: _jsx(DatePicker.TableRow, { children: api.weekDays.map((weekDay, id) => (_jsx(DatePicker.TableHeader, { children: weekDay.short.substring(0, 2) }, id))) }) }), _jsx(DatePicker.TableBody, { children: api.weeks.map((week, id) => (_jsx(DatePicker.TableRow, { children: week.map((day, id) => (_jsx(DatePicker.TableCell, { value: day, children: _jsx(DatePicker.TableCellTrigger, { children: day.day }) }, id))) }, id))) })] })] })) }) }), _jsx(DatePicker.View, { view: "month", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
469
485
|
.getMonthsGrid({ columns: 4, format: 'short' })
|
|
470
486
|
.map((months, id) => (_jsx(DatePicker.TableRow, { children: months.map((month, id) => (_jsx(DatePicker.TableCell, { value: month.value, children: _jsx(DatePicker.TableCellTrigger, { className: "w-[4.425rem]", children: month.label }) }, id))) }, id))) }) })] })) }) }), _jsx(DatePicker.View, { view: "year", children: _jsx(DatePicker.Context, { children: (datePicker) => (_jsxs(_Fragment, { children: [_jsxs(DatePicker.ViewControl, { children: [_jsx(DatePicker.PrevTrigger, { children: _jsx(ChevronLeftIcon, {}) }), _jsx(DatePicker.ViewTrigger, { children: _jsx(DatePicker.RangeText, {}) }), _jsx(DatePicker.NextTrigger, { children: _jsx(ChevronRightIcon, {}) })] }), _jsx(DatePicker.Table, { children: _jsx(DatePicker.TableBody, { children: datePicker
|
|
471
487
|
.getYearsGrid({ columns: 4 })
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useFieldContext } from '@ark-ui/react';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import invariant from 'tiny-invariant';
|
|
4
|
-
import { useMediaQuery } from 'usehooks-ts';
|
|
5
4
|
import { useCamera } from '../../../client/hooks/useCamera.js';
|
|
6
5
|
import { useControllableState } from '../../../client/hooks/useControllableState.js';
|
|
7
6
|
import { useDisclosure } from '../../../client/hooks/useDisclosure.js';
|
|
@@ -42,10 +41,10 @@ export function useIdFrontImageField(props) {
|
|
|
42
41
|
const inputRef = useRef(null);
|
|
43
42
|
const maskRef = useRef(null);
|
|
44
43
|
const guideRef = useRef(null);
|
|
45
|
-
const desktop = useMediaQuery('(min-width: 1024px)');
|
|
44
|
+
// const desktop = useMediaQuery('(min-width: 1024px)');
|
|
46
45
|
const camera = useCamera({
|
|
47
46
|
video: {
|
|
48
|
-
facingMode:
|
|
47
|
+
facingMode: 'user',
|
|
49
48
|
},
|
|
50
49
|
async transform(data) {
|
|
51
50
|
const guideRect = guideRef.current?.getBoundingClientRect();
|
|
@@ -45,6 +45,9 @@ export function useSelfieImageField(props) {
|
|
|
45
45
|
const guideRef = useRef(null);
|
|
46
46
|
const [validatingFace, setValidatingFace] = useState(false);
|
|
47
47
|
const camera = useCamera({
|
|
48
|
+
video: {
|
|
49
|
+
facingMode: 'environment',
|
|
50
|
+
},
|
|
48
51
|
async transform(data) {
|
|
49
52
|
if (validatingFace)
|
|
50
53
|
return { ok: true, data };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SITE_ID: string;
|
|
2
2
|
export declare const PLATFORM_ID: string;
|
|
3
3
|
export declare const PLATFORM_CODE: string;
|
|
4
|
-
export declare const ENVIRONMENT: "
|
|
4
|
+
export declare const ENVIRONMENT: "development" | "production";
|
|
5
5
|
export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -6,13 +6,6 @@ interface Context {
|
|
|
6
6
|
params: Promise<Params>;
|
|
7
7
|
}
|
|
8
8
|
export declare const GET: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
|
|
9
|
-
ok: false;
|
|
10
|
-
message: string;
|
|
11
|
-
__error?: unknown;
|
|
12
|
-
} | {
|
|
13
|
-
ok: true;
|
|
14
|
-
data: import("../types").Session;
|
|
15
|
-
}> | NextResponse<{
|
|
16
9
|
ok: true;
|
|
17
10
|
data?: never;
|
|
18
11
|
} | {
|
|
@@ -26,6 +19,13 @@ export declare const GET: (req: NextRequest, { params }: Context) => Promise<Nex
|
|
|
26
19
|
} | {
|
|
27
20
|
ok: true;
|
|
28
21
|
data: Record<string, unknown>;
|
|
22
|
+
}> | NextResponse<{
|
|
23
|
+
ok: false;
|
|
24
|
+
message: string;
|
|
25
|
+
__error?: unknown;
|
|
26
|
+
} | {
|
|
27
|
+
ok: true;
|
|
28
|
+
data: import("../types").Session;
|
|
29
29
|
}>>;
|
|
30
30
|
export declare const DELETE: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
|
|
31
31
|
ok: true;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function LinkBrokenIcon(props) {
|
|
3
|
+
return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", ...props, children: _jsx("path", { d: "M8.5 15.5L15.5 8.49998M9 4V2M15 20V22M4 9H2M20 15H22M4.91421 4.91421L3.5 3.5M19.0858 19.0857L20.5 20.4999M12 17.6568L9.87871 19.7781C8.31662 21.3402 5.78396 21.3402 4.22186 19.7781C2.65976 18.216 2.65976 15.6833 4.22186 14.1212L6.34318 11.9999M17.6569 11.9999L19.7782 9.87859C21.3403 8.31649 21.3403 5.78383 19.7782 4.22174C18.2161 2.65964 15.6835 2.65964 14.1214 4.22174L12 6.34306", stroke: "#FEDF89", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }) }));
|
|
4
|
+
}
|
|
Binary file
|