@opexa/portal-components 0.0.325 → 0.0.327

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
  2. package/dist/components/DigitainLauncher/Loading.js +5 -0
  3. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.d.ts +1 -1
  4. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.js +81 -46
  5. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +37 -2
  6. package/dist/components/KYC/BasicInformation.d.ts +1 -0
  7. package/dist/components/KYC/BasicInformation.js +101 -0
  8. package/dist/components/KYC/IdentityVerification.d.ts +1 -0
  9. package/dist/components/KYC/IdentityVerification.js +120 -0
  10. package/dist/components/KYC/Indicator.d.ts +1 -0
  11. package/dist/components/KYC/Indicator.js +8 -0
  12. package/dist/components/KYC/KYC.lazy.d.ts +6 -0
  13. package/dist/components/KYC/KYC.lazy.js +45 -0
  14. package/dist/components/KYC/KYCContext.d.ts +6 -0
  15. package/dist/components/KYC/KYCContext.js +2 -0
  16. package/dist/components/KYC/PersonalInformation.d.ts +1 -0
  17. package/dist/components/KYC/PersonalInformation.js +122 -0
  18. package/dist/components/KYC/useKYC.d.ts +25 -0
  19. package/dist/components/KYC/useKYC.js +38 -0
  20. package/dist/handlers/postAuthenticate.js +3 -1
  21. package/dist/handlers/postSession.js +3 -1
  22. package/dist/images/responsible-gaming-yellow.png +0 -0
  23. package/dist/middleware.d.ts +1 -1
  24. package/dist/middleware.js +4 -0
  25. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  26. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  27. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  28. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  29. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  30. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  31. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  32. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  33. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  34. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  35. package/dist/ui/Dialog/Dialog.d.ts +88 -88
  36. package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
  37. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  38. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  39. package/dist/ui/Menu/Menu.d.ts +90 -90
  40. package/dist/ui/Menu/menu.recipe.d.ts +5 -5
  41. package/dist/ui/Progress/Progress.d.ts +27 -27
  42. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  43. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  44. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  45. package/dist/ui/Select/Select.d.ts +45 -45
  46. package/dist/ui/Select/select.recipe.d.ts +3 -3
  47. package/dist/ui/Table/Table.d.ts +21 -21
  48. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  49. package/dist/ui/Table/table.recipe.d.ts +3 -3
  50. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  51. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  52. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export declare function Loading(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function Loading() {
4
+ return (_jsx("div", { className: "flex h-[calc(100vh-400px)] w-full items-center justify-center px-4", children: _jsxs("div", { className: "flex flex-col items-center space-y-4", children: [_jsx("div", { className: "h-10 w-10 animate-spin rounded-full border-4 border-blue-500 border-t-transparent" }), _jsx("p", { className: "font-medium text-gray-700 text-lg", children: "Loading Sports Book\u2026" })] }) }));
5
+ }
@@ -1,4 +1,4 @@
1
- import { type CSSProperties } from "react";
1
+ import { type CSSProperties } from 'react';
2
2
  export interface JackpotsCarouselItemProps {
3
3
  style?: CSSProperties;
4
4
  className?: string;
@@ -1,29 +1,30 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Progress } from "@ark-ui/react/progress";
4
- import { format } from "date-fns";
5
- import Image from "next/image";
6
- import Link from "next/link";
7
- import { useCallback, useMemo } from "react";
8
- import { twMerge } from "tailwind-merge";
9
- import { useJackpotPayoutsQuery } from "../../../client/hooks/useJackpotPayoutsQuery.js";
10
- import { useLocaleInfo } from "../../../client/hooks/useLocaleInfo.js";
11
- import { ArrowNarrowUpRightIcon } from "../../../icons/ArrowNarrowUpRightIcon.js";
12
- import { ChevronLeftIcon } from "../../../icons/ChevronLeftIcon.js";
13
- import { ChevronRightIcon } from "../../../icons/ChevronRightIcon.js";
14
- import { Trophy01Icon } from "../../../icons/Trophy01Icon.js";
15
- import { User01Icon } from "../../../icons/User01Icon.js";
16
- import closeChest from "../../../images/close-chest.png";
17
- import firstPlace from "../../../images/first-place.png";
18
- import leaderboard from "../../../images/leaderboard.png";
19
- import openChest from "../../../images/open-chest.png";
20
- import * as Tooltip from "../../../ui/Tooltip/Tooltip.js";
21
- import { capitalize } from "../../../utils/capitalize.js";
22
- import { formatNumber } from "../../../utils/formatNumber.js";
23
- import { mask } from "../../../utils/mask.js";
24
- import { parseDecimal } from "../../../utils/parseDecimal.js";
25
- import { useJackpotsCarouselItemContext } from "./JackpotsCarouselContext.js";
26
- import styles from "./JackpotsCarouselItem.module.css";
3
+ import { Progress } from '@ark-ui/react/progress';
4
+ import { format } from 'date-fns';
5
+ import isMobile from 'is-mobile';
6
+ import Image from 'next/image';
7
+ import Link from 'next/link';
8
+ import { useCallback, useEffect, useId, useMemo, useState, } from 'react';
9
+ import { twMerge } from 'tailwind-merge';
10
+ import { useJackpotPayoutsQuery } from '../../../client/hooks/useJackpotPayoutsQuery.js';
11
+ import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
12
+ import { ArrowNarrowUpRightIcon } from '../../../icons/ArrowNarrowUpRightIcon.js';
13
+ import { ChevronLeftIcon } from '../../../icons/ChevronLeftIcon.js';
14
+ import { ChevronRightIcon } from '../../../icons/ChevronRightIcon.js';
15
+ import { Trophy01Icon } from '../../../icons/Trophy01Icon.js';
16
+ import { User01Icon } from '../../../icons/User01Icon.js';
17
+ import closeChest from '../../../images/close-chest.png';
18
+ import firstPlace from '../../../images/first-place.png';
19
+ import leaderboard from '../../../images/leaderboard.png';
20
+ import openChest from '../../../images/open-chest.png';
21
+ import * as Tooltip from '../../../ui/Tooltip/Tooltip.js';
22
+ import { capitalize } from '../../../utils/capitalize.js';
23
+ import { formatNumber } from '../../../utils/formatNumber.js';
24
+ import { mask } from '../../../utils/mask.js';
25
+ import { parseDecimal } from '../../../utils/parseDecimal.js';
26
+ import { useJackpotsCarouselItemContext } from './JackpotsCarouselContext.js';
27
+ import styles from './JackpotsCarouselItem.module.css';
27
28
  export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = true, }) {
28
29
  const jackpot = useJackpotsCarouselItemContext();
29
30
  const jackpotPayoutsQuery = useJackpotPayoutsQuery({
@@ -34,7 +35,7 @@ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = t
34
35
  },
35
36
  },
36
37
  }, {
37
- enabled: typeof window !== "undefined",
38
+ enabled: typeof window !== 'undefined',
38
39
  });
39
40
  const jackpotPayouts = jackpotPayoutsQuery.data?.pages[0].edges.map((edge) => edge.node) ?? [];
40
41
  const latestJackpotPayout = jackpotPayouts[0] ?? [];
@@ -43,16 +44,45 @@ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = t
43
44
  const jackpotAmount = jackpot.pool;
44
45
  const Arrow = useCallback(({ index }) => {
45
46
  const Icon = isPayingOut ? ChevronLeftIcon : ChevronRightIcon;
46
- return (_jsx(Icon, { className: twMerge("min-w-2.5 scale-400 text-brand-300 lg:min-w-4 lg:scale-250", isPayingOut
47
- ? styles["animate-wave-color-error"]
48
- : styles["animate-wave-color-success"]), style: {
47
+ return (_jsx(Icon, { className: twMerge('min-w-2.5 scale-400 text-brand-300 lg:min-w-4 lg:scale-250', isPayingOut
48
+ ? styles['animate-wave-color-error']
49
+ : styles['animate-wave-color-success']), style: {
49
50
  animationDelay: isPayingOut
50
51
  ? `${(40 - index - 1) * 0.1}s`
51
52
  : `${index * 0.1}s`,
52
53
  } }));
53
54
  }, [isPayingOut]);
54
55
  const arrowImages = useMemo(() => Array.from({ length: 40 }, (_, i) => (_jsx(Arrow, { isFirst: i === 0, index: i }, i))), [Arrow]);
55
- return (_jsxs("div", { className: twMerge("relative flex w-full shrink-0 rounded-2xl border border-border-primary bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5", className), style: style, children: [_jsxs("div", { className: "relative z-1 flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: [_jsx("span", { className: "full size-1.5 animate-pulse rounded bg-utility-success-500" }), "Paying Out"] })) : (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-blue-200 bg-utility-blue-50 px-2 py-0.5 font-medium text-utility-blue-700 text-xs", children: [_jsx(ArrowNarrowUpRightIcon, { className: "size-3.5 text-utility-blue-500" }), "Accumulating"] })), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
56
+ const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
57
+ const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
58
+ const isMobileDevice = useMemo(() => isMobile(), []);
59
+ const mainTooltipId = useId();
60
+ const minLimitTooltipId = useId();
61
+ const handleMainTooltipClick = useCallback((e) => {
62
+ if (isMobileDevice) {
63
+ e.stopPropagation();
64
+ setMainTooltipOpen((prev) => !prev);
65
+ }
66
+ }, [isMobileDevice]);
67
+ const handleMinLimitTooltipClick = useCallback((e) => {
68
+ if (isMobileDevice) {
69
+ e.stopPropagation();
70
+ setMinLimitTooltipOpen((prev) => !prev);
71
+ }
72
+ }, [isMobileDevice]);
73
+ useEffect(() => {
74
+ if (isMobile() && mainTooltipOpen) {
75
+ const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);
76
+ return () => clearTimeout(timeout);
77
+ }
78
+ }, [mainTooltipOpen]);
79
+ useEffect(() => {
80
+ if (isMobile() && minLimitTooltipOpen) {
81
+ const timeout = setTimeout(() => setMinLimitTooltipOpen(false), 3000);
82
+ return () => clearTimeout(timeout);
83
+ }
84
+ }, [minLimitTooltipOpen]);
85
+ return (_jsxs("div", { className: twMerge('relative flex w-full shrink-0 rounded-2xl border border-border-primary bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5', className), style: style, children: [_jsxs("div", { className: "relative z-1 flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: [_jsx("span", { className: "full size-1.5 animate-pulse rounded bg-utility-success-500" }), "Paying Out"] })) : (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-blue-200 bg-utility-blue-50 px-2 py-0.5 font-medium text-utility-blue-700 text-xs", children: [_jsx(ArrowNarrowUpRightIcon, { className: "size-3.5 text-utility-blue-500" }), "Accumulating"] })), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
56
86
  currency: localeInfo.currency.code,
57
87
  minDecimalPlaces: 2,
58
88
  maxDecimalPlaces: 2,
@@ -62,19 +92,24 @@ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = t
62
92
  currency: localeInfo.currency.code,
63
93
  minDecimalPlaces: 2,
64
94
  maxDecimalPlaces: 2,
65
- }) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "firstPlace", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Recent Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] }))] }) }) }), _jsxs("div", { className: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(0, {
95
+ }) })] })] }) })) : (_jsxs("div", { className: "relative mt-4 hidden w-full gap-4 rounded-lg bg-bg-primary p-4 lg:flex", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "firstPlace", className: "size-full h-auto w-[4.125rem] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "flex h-fit w-fit items-center gap-1 rounded-sm border border-utility-brand-200 bg-utility-brand-50 px-2 py-0.5 font-medium text-utility-brand-700 text-xs", children: [_jsx(Trophy01Icon, { className: "size-3.5 text-utility-brand-600" }), "Recent Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] }))] }) }) }), _jsxs("div", { className: "mt-3 lg:mt-4", children: [_jsxs("div", { className: "mb-1 flex justify-between", children: [_jsx("div", { className: "font-semibold text-text-primary-900 text-xs", "aria-live": "polite", children: formatNumber(0, {
66
96
  currency: localeInfo.currency.code,
67
97
  compact: true,
68
- }) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge("absolute left-0", styles["animate-arrow-red-flash-1"]), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge("absolute left-1.5", styles["animate-arrow-red-flash-2"]), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge("absolute left-3", styles["animate-arrow-red-flash-3"]), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge("absolute left-0", styles["animate-arrow-green-flash-1"]), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge("absolute left-1.5", styles["animate-arrow-green-flash-2"]), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge("absolute left-3", styles["animate-arrow-green-flash-3"]), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
98
+ }) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-red-flash-1']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-red-flash-2']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-red-flash-3']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-green-flash-1']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-green-flash-2']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-green-flash-3']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
69
99
  currency: localeInfo.currency.code,
70
100
  compact: true,
71
- }) })] })] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), children: _jsx(Progress.Track, { className: "h-full overflow-hidden rounded-full bg-bg-primary", children: _jsxs(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: [_jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: "fixed", placement: "top" }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { className: "absolute inset-0 h-full w-full" }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsxs("div", { className: "text-xs", children: ["Current\uD83D\uDCB0:", " ", formatNumber(jackpot.pool, {
101
+ }) })] })] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuenow": getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuemax": 100, "aria-label": "Jackpot progress", children: _jsx(Progress.Track, { className: "h-full overflow-hidden rounded-full bg-bg-primary", children: _jsxs(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: [_jsxs(Tooltip.Root, { ...(isMobileDevice
102
+ ? {
103
+ open: mainTooltipOpen,
104
+ onOpenChange: (details) => setMainTooltipOpen(details.open),
105
+ }
106
+ : {}), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { className: "absolute inset-0 h-full w-full", onClick: handleMainTooltipClick, role: "button", tabIndex: 0, "aria-label": "Show current jackpot tooltip", "aria-describedby": mainTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: mainTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Current\uD83D\uDCB0:", ' ', formatNumber(jackpot.pool, {
72
107
  currency: localeInfo.currency.code,
73
108
  minDecimalPlaces: 2,
74
109
  maxDecimalPlaces: 2,
75
- })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] }), _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }), _jsxs(Tooltip.Root, { openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: "fixed", placement: "top" }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { className: "absolute inset-0 h-full bg-black opacity-30", style: {
110
+ })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] }), _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }), _jsxs(Tooltip.Root, { open: isMobile() ? minLimitTooltipOpen : undefined, onOpenChange: (details) => isMobile() && setMinLimitTooltipOpen(details.open), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { onClick: handleMinLimitTooltipClick, className: "absolute inset-0 h-full bg-black opacity-30", style: {
76
111
  width: `${getPercentage(jackpot.minimumJackpotPoolDrawingLimit, jackpot.pool)}%`,
77
- } }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { children: [_jsxs("div", { className: "text-xs", children: ["Minimum Payout Limit:", " ", formatNumber(jackpot.minimumJackpotPoolDrawingLimit, {
112
+ }, role: "button", tabIndex: 0, "aria-label": "Show minimum payout limit tooltip", "aria-describedby": minLimitTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: minLimitTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Minimum Payout Limit:", ' ', formatNumber(jackpot.minimumJackpotPoolDrawingLimit, {
78
113
  currency: localeInfo.currency.code,
79
114
  minDecimalPlaces: 2,
80
115
  maxDecimalPlaces: 2,
@@ -83,29 +118,29 @@ export function JackpotsCarouselItem({ style, className, viewAllUrl, animate = t
83
118
  currency: localeInfo.currency.code,
84
119
  compact: true,
85
120
  })} Play now for your chance to win big! 🔥`
86
- : getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: jackpotPayouts.length ? "Recent payouts" : "Starting soon!" })] }), _jsxs(Link, { className: "flex font-semibold text-button-tertiary-fg text-sm", href: viewAllUrl ?? "/jackpots", children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx("div", { className: twMerge("max-h-[17rem] overflow-y-scroll", styles.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { className: "h-8 whitespace-nowrap bg-bg-secondary text-left font-medium text-text-tertiary-600 text-xs", children: [
87
- "Player",
88
- "Game Provider",
89
- "Multiplier",
90
- "Prize",
91
- "Timestamp",
121
+ : getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "font-semibold text-lg text-text-primary-900", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' })] }), _jsxs(Link, { className: "flex font-semibold text-button-tertiary-fg text-sm", href: viewAllUrl ?? '/jackpots', children: ["See details", _jsx(ChevronRightIcon, { className: "size-5" })] })] }), _jsx("div", { className: twMerge('max-h-[17rem] overflow-y-scroll', styles.scrollArea), children: _jsx("div", { className: "overflow-hidden rounded-xl border-gray-200", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { className: "h-8 whitespace-nowrap bg-bg-secondary text-left font-medium text-text-tertiary-600 text-xs", children: [
122
+ 'Player',
123
+ 'Game Provider',
124
+ 'Multiplier',
125
+ 'Prize',
126
+ 'Timestamp',
92
127
  ].map((header) => (_jsx("th", { className: "px-4", children: header }, header))) }) }), _jsx("tbody", { children: jackpotPayouts.length
93
128
  ? jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "whitespace-nowrap bg-bg-primary text-left text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: mask(jackpotPayout.member.name, {
94
129
  totalCharsCount: 6,
95
- }) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: capitalize(jackpotPayout.game?.provider ?? "-", {
130
+ }) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: capitalize(jackpotPayout.game?.provider ?? '-', {
96
131
  delimiter: capitalize.delimiters.UNDERSCORE,
97
132
  }) }), _jsxs("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4 text-brand-400", children: formatNumber(jackpotPayout.amount, {
98
133
  currency: localeInfo.currency.code,
99
134
  minDecimalPlaces: 2,
100
135
  maxDecimalPlaces: 2,
101
- }) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: format(new Date(jackpotPayout.dateTimeCreated), "dd MMM yyyy h:mm a") })] }, i)))
102
- : Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" })] }, i))) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles["light-rays"], "absolute top-0 right-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:9.375rem]") }))] }));
136
+ }) }), _jsx("td", { className: "h-12 border-border-secondary border-t-2 px-4", children: format(new Date(jackpotPayout.dateTimeCreated), 'dd MMM yyyy h:mm a') })] }, i)))
137
+ : Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-sm text-text-secondary-700", children: [_jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" }), _jsx("td", { className: "h-12 border-border-secondary border-t-2", children: "-" })] }, i))) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute top-0 right-0 rounded-2xl [--light-rays-top:25%] lg:[--light-rays-top:9.375rem]') }))] }));
103
138
  }
104
139
  const getAccumulatingJackpotDescription = (part, total) => {
105
140
  const percentage = total === 0 ? 0 : (part / total) * 100;
106
141
  return percentage <= 90
107
- ? "The jackpot is heating up! Keep playing to stay in the action and watch it grow!"
108
- : "🔥 It’s about to pop! Stay in the game for your shot at the prize!";
142
+ ? 'The jackpot is heating up! Keep playing to stay in the action and watch it grow!'
143
+ : '🔥 It’s about to pop! Stay in the game for your shot at the prize!';
109
144
  };
110
145
  function getPercentage(value, total) {
111
146
  const v = parseDecimal(value, 0);
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Progress } from '@ark-ui/react/progress';
3
3
  import { format } from 'date-fns';
4
4
  import Image from 'next/image';
5
- import { useState } from 'react';
5
+ import { useCallback, useEffect, useId, useState, } from 'react';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { ArrowNarrowDownIcon } from '../../../icons/ArrowNarrowDownIcon.js';
8
8
  import { ArrowNarrowUpIcon } from '../../../icons/ArrowNarrowUpIcon.js';
@@ -15,6 +15,7 @@ import closeChest from '../../../images/close-chest.png';
15
15
  import firstPlace from '../../../images/first-place.png';
16
16
  import openChest from '../../../images/open-chest.png';
17
17
  import { Button } from '../../../ui/Button/index.js';
18
+ import { Tooltip } from '../../../ui/Tooltip/index.js';
18
19
  import { capitalize } from '../../../utils/capitalize.js';
19
20
  import { formatNumber } from '../../../utils/formatNumber.js';
20
21
  import { mask } from '../../../utils/mask.js';
@@ -28,6 +29,30 @@ export function JackpotsListItemMobile({ animate = true, ...props }) {
28
29
  const jackpot = useJackpotsListItemContext();
29
30
  const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, } = useJackpotsListItemData();
30
31
  const [isDetailsVisible, setIsDetailsVisible] = useState(false);
32
+ const [mainTooltipOpen, setMainTooltipOpen] = useState(false);
33
+ const [minLimitTooltipOpen, setMinLimitTooltipOpen] = useState(false);
34
+ const mainTooltipId = useId();
35
+ const minLimitTooltipId = useId();
36
+ const handleMainTooltipClick = useCallback((e) => {
37
+ e.stopPropagation();
38
+ setMainTooltipOpen((prev) => !prev);
39
+ }, []);
40
+ const handleMinLimitTooltipClick = useCallback((e) => {
41
+ e.stopPropagation();
42
+ setMinLimitTooltipOpen((prev) => !prev);
43
+ }, []);
44
+ useEffect(() => {
45
+ if (mainTooltipOpen) {
46
+ const timeout = setTimeout(() => setMainTooltipOpen(false), 3000);
47
+ return () => clearTimeout(timeout);
48
+ }
49
+ }, [mainTooltipOpen]);
50
+ useEffect(() => {
51
+ if (minLimitTooltipOpen) {
52
+ const timeout = setTimeout(() => setMinLimitTooltipOpen(false), 3000);
53
+ return () => clearTimeout(timeout);
54
+ }
55
+ }, [minLimitTooltipOpen]);
31
56
  return (_jsxs("div", { style: props.style, className: twMerge('rounded-2xl border border-border-primary bg-bg-primary', props.className), children: [_jsxs("div", { className: "relative flex shrink-0 rounded-2xl bg-bg-tertiary p-3 text-center lg:gap-4 lg:p-5", children: [_jsxs("div", { className: "relative z-1 flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsx("div", { className: "flex w-full flex-col", children: _jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs", children: [_jsx("span", { className: "full size-1.5 animate-pulse rounded bg-utility-success-500" }), "Paying Out"] })) : (_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-full border border-utility-blue-200 bg-utility-blue-50 px-2 py-0.5 font-medium text-utility-blue-700 text-xs", children: [_jsx(ArrowNarrowUpRightIcon, { className: "size-3.5 text-utility-blue-500" }), "Accumulating"] })), _jsx("div", { className: "mt-1 text-left font-medium text-lg text-text-primary-900 lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "mt-1.5 w-fit rounded-md bg-bg-primary px-2 py-1 font-bold text-2xl text-brand-400 lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
32
57
  currency: localeInfo.currency.code,
33
58
  minDecimalPlaces: 2,
@@ -38,7 +63,17 @@ export function JackpotsListItemMobile({ animate = true, ...props }) {
38
63
  }) }), _jsxs("div", { className: "relative flex items-center justify-end gap-1.5", children: [isPayingOut ? (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-red-flash-1']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-red-flash-2']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-red-flash-3']), children: _jsx(ChevronLeftIcon, { className: "size-4.5" }) })] })) : (_jsxs("div", { className: "flex w-6 items-center", children: [_jsx("div", { className: twMerge('absolute left-0', styles['animate-arrow-green-flash-1']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-1.5', styles['animate-arrow-green-flash-2']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) }), _jsx("div", { className: twMerge('absolute left-3', styles['animate-arrow-green-flash-3']), children: _jsx(ChevronRightIcon, { className: "size-4.5" }) })] })), _jsx("div", { className: "font-semibold text-text-primary-900 text-xs", children: formatNumber(jackpot?.maximumJackpotPoolLimit, {
39
64
  currency: localeInfo.currency.code,
40
65
  compact: true,
41
- }) })] })] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), children: _jsx(Progress.Track, { className: "h-full overflow-hidden rounded-full bg-bg-primary", children: _jsx(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }) }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
66
+ }) })] })] }), _jsx(Progress.Root, { className: "h-2 w-full rounded-full bg-bg-primary lg:h-4", max: 100, value: getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuenow": getPercentage(jackpot.pool, jackpot.maximumJackpotPoolLimit), "aria-valuemax": 100, "aria-label": "Jackpot progress", children: _jsx(Progress.Track, { className: "h-full overflow-hidden rounded-full bg-bg-primary", children: _jsxs(Progress.Range, { className: "relative h-full overflow-hidden rounded-full bg-brand-500 pl-1.5", children: [_jsxs(Tooltip.Root, { open: mainTooltipOpen, onOpenChange: (details) => setMainTooltipOpen(details.open), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { className: "absolute inset-0 h-full w-full", onClick: handleMainTooltipClick, role: "button", tabIndex: 0, "aria-label": "Show current jackpot tooltip", "aria-describedby": mainTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: mainTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Current\uD83D\uDCB0:", ' ', formatNumber(jackpot.pool, {
67
+ currency: localeInfo.currency.code,
68
+ minDecimalPlaces: 2,
69
+ maxDecimalPlaces: 2,
70
+ })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] }), _jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-start pl-1.5", "aria-hidden": "true", children: arrowImages }), _jsxs(Tooltip.Root, { open: minLimitTooltipOpen, onOpenChange: (details) => setMinLimitTooltipOpen(details.open), openDelay: 0, closeDelay: 100, lazyMount: true, unmountOnExit: true, positioning: { strategy: 'fixed', placement: 'top' }, children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("div", { onClick: handleMinLimitTooltipClick, className: "absolute inset-0 h-full bg-black opacity-30", style: {
71
+ width: `${getPercentage(jackpot.minimumJackpotPoolDrawingLimit, jackpot.pool)}%`,
72
+ }, role: "button", tabIndex: 0, "aria-label": "Show minimum payout limit tooltip", "aria-describedby": minLimitTooltipId }) }), _jsx(Tooltip.Positioner, { children: _jsxs(Tooltip.Content, { id: minLimitTooltipId, children: [_jsxs("div", { className: "text-xs", children: ["Minimum Payout Limit:", ' ', formatNumber(jackpot.minimumJackpotPoolDrawingLimit, {
73
+ currency: localeInfo.currency.code,
74
+ minDecimalPlaces: 2,
75
+ maxDecimalPlaces: 2,
76
+ })] }), _jsx(Tooltip.Arrow, { children: _jsx(Tooltip.ArrowTip, {}) })] }) })] })] }) }) }), _jsx("div", { className: "mt-1 block text-start text-2xs lg:hidden", children: isPayingOut
42
77
  ? `The pot has hit ${formatNumber(jackpot?.maximumJackpotPoolLimit, {
43
78
  currency: localeInfo.currency.code,
44
79
  compact: true,
@@ -0,0 +1 @@
1
+ export declare function BasicInformation(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,101 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { differenceInYears, format, isSameDay, isValid, parse } from 'date-fns';
4
+ import { isNil, omitBy, size } from 'lodash-es';
5
+ import { useEffect } from 'react';
6
+ import { useForm } from 'react-hook-form';
7
+ import invariant from 'tiny-invariant';
8
+ import { z } from 'zod';
9
+ import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
10
+ import { useUpdateAccountMutation } from '../../client/hooks/useUpdateAccountMutation.js';
11
+ import { toaster } from '../../client/utils/toaster.js';
12
+ import { Button } from '../../ui/Button/index.js';
13
+ import { Dialog } from '../../ui/Dialog/index.js';
14
+ import { Field } from '../../ui/Field/index.js';
15
+ import { useKYCContext } from './KYCContext.js';
16
+ const definition = z.object({
17
+ realName: z
18
+ .string()
19
+ .min(3, 'Name must be 3 or more characters')
20
+ .max(50, 'Name must not be more than 50 characters')
21
+ .regex(/^[a-z0-9 ]+$/gi, 'Name must not contain special characters')
22
+ .trim(),
23
+ birthDay: z
24
+ .string()
25
+ .min(1, 'Date of birth is required')
26
+ .superRefine((value, ctx) => {
27
+ const dob = parse(value, 'yyyy-MM-dd', new Date());
28
+ if (!isValid(dob)) {
29
+ return ctx.addIssue({
30
+ code: z.ZodIssueCode.invalid_date,
31
+ });
32
+ }
33
+ const now = new Date();
34
+ const age = differenceInYears(now, dob);
35
+ if (age < 21) {
36
+ return ctx.addIssue({
37
+ code: z.ZodIssueCode.custom,
38
+ message: 'You must be at least 21 years old',
39
+ });
40
+ }
41
+ }),
42
+ branchCode: z.string().min(4).max(10).optional().or(z.literal('')),
43
+ });
44
+ export function BasicInformation() {
45
+ const kyc = useKYCContext();
46
+ const form = useForm({
47
+ resolver: zodResolver(definition),
48
+ mode: 'all',
49
+ defaultValues: {
50
+ birthDay: '',
51
+ branchCode: '',
52
+ realName: '',
53
+ },
54
+ });
55
+ const accountQuery = useAccountQuery();
56
+ const account = accountQuery.data;
57
+ const stepCompleted = account != null && account.realName != null && account.birthDay != null;
58
+ useEffect(() => {
59
+ if (stepCompleted)
60
+ kyc.setStep(2);
61
+ }, [stepCompleted, kyc]);
62
+ useEffect(() => {
63
+ if (account) {
64
+ form.reset({
65
+ realName: account.realName ?? '',
66
+ birthDay: account.birthDay
67
+ ? format(account.birthDay, 'yyyy-MM-dd')
68
+ : '',
69
+ });
70
+ }
71
+ }, [account, form]);
72
+ const updateAccountMutation = useUpdateAccountMutation({
73
+ onError(error) {
74
+ toaster.error({
75
+ title: 'Error',
76
+ description: error.message,
77
+ });
78
+ },
79
+ onSuccess() {
80
+ kyc.setStep(2);
81
+ toaster.success({
82
+ title: 'Success',
83
+ description: 'Basic information has been set successfully.',
84
+ });
85
+ },
86
+ });
87
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Basic Information" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Enter your basic details for identification and communication." }), _jsxs("form", { className: "mt-3", onSubmit: form.handleSubmit((data) => {
88
+ invariant(account);
89
+ const input = omitBy({
90
+ realName: account.realName === data.realName ? undefined : data.realName,
91
+ birthDay: account.birthDay && isSameDay(data.birthDay, account.birthDay)
92
+ ? undefined
93
+ : format(data.birthDay, 'yyyy-MM-dd'),
94
+ }, isNil);
95
+ if (size(input) === 0)
96
+ return kyc.setStep(2);
97
+ updateAccountMutation.mutate(input);
98
+ }), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!accountQuery.data?.realName, children: [_jsx(Field.Label, { children: "Real Name" }), _jsx(Field.Input, { placeholder: "Enter your real name", ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-3", invalid: !!form.formState.errors.branchCode, readOnly: !!accountQuery.data?.birthDay, children: [_jsx(Field.Label, { children: "Date of Birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), _jsx(Button, { type: "submit", className: "mt-8", disabled: accountQuery.isLoading ||
99
+ updateAccountMutation.isPending ||
100
+ stepCompleted, children: "Continue" })] })] }));
101
+ }
@@ -0,0 +1 @@
1
+ export declare function IdentityVerification(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,120 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { zodResolver } from '@hookform/resolvers/zod';
4
+ import { useEffect } from 'react';
5
+ import { Controller, useForm } from 'react-hook-form';
6
+ import { z } from 'zod';
7
+ import { useShallow } from 'zustand/shallow';
8
+ import { useCreateMemberVerificationMutation } from '../../client/hooks/useCreateMemberVerificationMutation.js';
9
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
10
+ import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
11
+ import { useUpdateMemberVerificationMutation } from '../../client/hooks/useUpdateMemberVerificationMutation.js';
12
+ import { toaster } from '../../client/utils/toaster.js';
13
+ import { Button } from '../../ui/Button/index.js';
14
+ import { Dialog } from '../../ui/Dialog/index.js';
15
+ import { Field } from '../../ui/Field/index.js';
16
+ import { getQueryClient } from '../../utils/getQueryClient.js';
17
+ import { getMemberVerificationQueryKey } from '../../utils/queryKeys.js';
18
+ import { IdFrontImageField } from '../shared/IdFrontImageField/index.js';
19
+ import { SelfieImageField } from '../shared/SelfieImageField/index.js';
20
+ import { useKYCContext } from './KYCContext.js';
21
+ const formSchema = z.object({
22
+ selfieImage: z.string().min(1, 'Selfie image is required.'),
23
+ idFrontImage: z.string().min(1, 'Front image of ID is required.'),
24
+ });
25
+ export function IdentityVerification() {
26
+ const kyc = useKYCContext();
27
+ const { mutate: createMemberVerification, isPending: createPending } = useCreateMemberVerificationMutation({
28
+ onSuccess: () => {
29
+ toaster.success({
30
+ title: 'ID Front Image & Selfie Image uploaded successfully',
31
+ });
32
+ },
33
+ onError: (error) => {
34
+ toaster.error({
35
+ title: 'Failed to upload ID Front Image & Selfie Image',
36
+ description: error.message,
37
+ });
38
+ },
39
+ });
40
+ const { mutate: updateMemberVerification, isPending: updatePending } = useUpdateMemberVerificationMutation({
41
+ onSuccess: () => {
42
+ const queryClient = getQueryClient();
43
+ toaster.success({
44
+ title: 'ID Front Image & Selfie Image updated successfully',
45
+ });
46
+ queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
47
+ if (!prev)
48
+ return prev;
49
+ return {
50
+ ...prev,
51
+ status: 'CREATED',
52
+ };
53
+ });
54
+ },
55
+ onError: (error) => {
56
+ toaster.error({
57
+ title: 'Failed to upload ID Front Image & Selfie Image',
58
+ description: error.message,
59
+ });
60
+ },
61
+ });
62
+ const memberVerification = useMemberVerificationQuery();
63
+ const memberId = memberVerification.data?.id;
64
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
65
+ kyc: ctx.kyc,
66
+ })));
67
+ const form = useForm({
68
+ resolver: zodResolver(formSchema),
69
+ defaultValues: {
70
+ idFrontImage: '',
71
+ selfieImage: '',
72
+ },
73
+ });
74
+ function onSubmit(values) {
75
+ if (!memberId) {
76
+ createMemberVerification({
77
+ selfieImage: values.selfieImage,
78
+ idFrontImage: values.idFrontImage,
79
+ address: '',
80
+ nationality: '',
81
+ natureOfWork: '',
82
+ permanentAddress: '',
83
+ placeOfBirth: '',
84
+ sourceOfIncome: '',
85
+ });
86
+ kyc.setStep(3);
87
+ }
88
+ else {
89
+ updateMemberVerification({
90
+ id: memberId,
91
+ data: {
92
+ selfieImage: values.selfieImage,
93
+ idFrontImage: values.idFrontImage,
94
+ },
95
+ });
96
+ kyc.setStep(3);
97
+ }
98
+ }
99
+ useEffect(() => {
100
+ if (kyc.selfieImageId)
101
+ form.setValue('selfieImage', kyc.selfieImageId);
102
+ if (kyc.idFrontImageId)
103
+ form.setValue('idFrontImage', kyc.idFrontImageId);
104
+ }, [form, kyc.idFrontImageId, kyc.selfieImageId]);
105
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Verify your identity" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Verify your details to confirm your identity and secure your access." }), _jsxs("div", { className: "mt-7 rounded-xl border border-border-primary bg-bg-primary p-lg text-text-placeholder text-xs leading-tight", children: [_jsx("h3", { className: "font-semibold", children: "Instructions" }), _jsxs("ol", { className: "mt-2 list-inside list-decimal", children: [_jsx("li", { children: "Upload a full photo of your ID." }), _jsx("li", { children: "Please ensure that all details in the uploaded image are legible." }), _jsx("li", { children: "Please ensure that the ID uploaded is within the validity period." })] })] }), _jsxs("form", { className: "mt-xl", onSubmit: form.handleSubmit(onSubmit), children: [_jsx(Controller, { control: form.control, name: "idFrontImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, children: [_jsx(Field.Label, { children: "Front of your ID" }), _jsx(IdFrontImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
106
+ form.setValue('idFrontImage', '');
107
+ form.setError('idFrontImage', {
108
+ type: 'validate',
109
+ message: error.message,
110
+ });
111
+ } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Controller, { control: form.control, name: "selfieImage", render: (o) => (_jsxs(Field.Root, { invalid: o.fieldState.invalid, className: "mt-3", children: [_jsx(Field.Label, { children: "Selfie holding your ID" }), _jsx(SelfieImageField, { value: o.field.value, onChange: o.field.onChange, onError: (error) => {
112
+ form.setValue('selfieImage', '');
113
+ form.setError('selfieImage', {
114
+ type: 'validate',
115
+ message: error.message,
116
+ });
117
+ } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-6", disabled: createPending || updatePending, children: "Continue" }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", type: "button", onClick: () => {
118
+ globalStore.kyc.setOpen(false);
119
+ }, children: "Skip for now" })] })] }));
120
+ }
@@ -0,0 +1 @@
1
+ export declare function Indicator(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { noop } from 'lodash-es';
3
+ import { Progress } from '../../ui/Progress/index.js';
4
+ import { useKYCContext } from './KYCContext.js';
5
+ export function Indicator() {
6
+ const kyc = useKYCContext();
7
+ return (_jsxs("div", { className: "flex items-center justify-center gap-1.5 py-3", children: [_jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 1 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 2 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step === 3 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) })] }));
8
+ }
@@ -0,0 +1,6 @@
1
+ import type { ImageProps } from 'next/image';
2
+ import { type KYCReminderProps } from './KYCReminder.lazy';
3
+ export interface KYCProps extends KYCReminderProps {
4
+ logo: ImageProps['src'];
5
+ }
6
+ export declare function KYC(props: KYCProps): import("react/jsx-runtime").JSX.Element;