@opexa/portal-components 0.0.311 → 0.0.313

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 (121) hide show
  1. package/dist/client/hooks/useFileQuery.js +5 -5
  2. package/dist/client/hooks/useGenerateSumsubVerificationTokenMutation.d.ts +2 -0
  3. package/dist/client/hooks/useGenerateSumsubVerificationTokenMutation.js +19 -0
  4. package/dist/client/hooks/useGlobalStore.d.ts +25 -1
  5. package/dist/client/hooks/useGlobalStore.js +3 -2
  6. package/dist/client/utils/recaptcha.d.ts +14 -0
  7. package/dist/client/utils/recaptcha.js +18 -0
  8. package/dist/components/AccountVerification/AccountVerification.js +33 -21
  9. package/dist/components/Banner/Banner.client.d.ts +12 -0
  10. package/dist/components/Banner/Banner.client.js +49 -0
  11. package/dist/components/Banner/Banner.d.ts +5 -0
  12. package/dist/components/Banner/Banner.js +3 -0
  13. package/dist/components/Disclaimer/ResponsibleGaming.d.ts +10 -0
  14. package/dist/components/Disclaimer/ResponsibleGaming.js +13 -0
  15. package/dist/components/Disclaimer/TermsOfUse.d.ts +11 -0
  16. package/dist/components/Disclaimer/TermsOfUse.js +13 -0
  17. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  18. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  19. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  20. package/dist/components/KYC/CaptureIdDocument.js +219 -0
  21. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  22. package/dist/components/KYC/CaptureSelfie.js +285 -0
  23. package/dist/components/KYC/DisplayImage.d.ts +5 -0
  24. package/dist/components/KYC/DisplayImage.js +8 -0
  25. package/dist/components/KYC/FileUpload.d.ts +10 -0
  26. package/dist/components/KYC/FileUpload.js +72 -0
  27. package/dist/components/KYC/KYC.d.ts +4 -3
  28. package/dist/components/KYC/KYC.js +10 -3
  29. package/dist/components/KYC/KYCDefault/BasicInformation.d.ts +1 -0
  30. package/dist/components/KYC/KYCDefault/BasicInformation.js +101 -0
  31. package/dist/components/KYC/KYCDefault/IdentityVerification.d.ts +1 -0
  32. package/dist/components/KYC/KYCDefault/IdentityVerification.js +120 -0
  33. package/dist/components/KYC/KYCDefault/Indicator.d.ts +1 -0
  34. package/dist/components/KYC/KYCDefault/Indicator.js +8 -0
  35. package/dist/components/KYC/KYCDefault/KYCDefault.d.ts +7 -0
  36. package/dist/components/KYC/KYCDefault/KYCDefault.js +45 -0
  37. package/dist/components/KYC/KYCDefault/KYCDefaultContext.d.ts +6 -0
  38. package/dist/components/KYC/KYCDefault/KYCDefaultContext.js +2 -0
  39. package/dist/components/KYC/KYCDefault/PersonalInformation.d.ts +1 -0
  40. package/dist/components/KYC/KYCDefault/PersonalInformation.js +122 -0
  41. package/dist/components/KYC/KYCDefault/index.d.ts +1 -0
  42. package/dist/components/KYC/KYCDefault/index.js +1 -0
  43. package/dist/components/KYC/KYCDefault/useKYCDefault.d.ts +25 -0
  44. package/dist/components/KYC/KYCDefault/useKYCDefault.js +38 -0
  45. package/dist/components/KYC/KYCReminder.d.ts +1 -0
  46. package/dist/components/KYC/KYCReminder.lazy.js +3 -3
  47. package/dist/components/KYC/KYCSumsub.d.ts +5 -0
  48. package/dist/components/KYC/KYCSumsub.js +54 -0
  49. package/dist/components/KYC/NoCameraError.d.ts +7 -0
  50. package/dist/components/KYC/NoCameraError.js +6 -0
  51. package/dist/components/KYC/PersonOverlayDesktop.d.ts +7 -0
  52. package/dist/components/KYC/PersonOverlayDesktop.js +9 -0
  53. package/dist/components/KYC/index.d.ts +0 -1
  54. package/dist/components/KYC/index.js +0 -1
  55. package/dist/components/KYC/utils.d.ts +9 -0
  56. package/dist/components/KYC/utils.js +79 -0
  57. package/dist/components/Quests/JourneyQuest.js +1 -1
  58. package/dist/components/Quests/RemainingTime.d.ts +5 -1
  59. package/dist/components/Quests/RemainingTime.js +6 -2
  60. package/dist/components/SignIn/utils.d.ts +8 -0
  61. package/dist/components/SignIn/utils.js +26 -0
  62. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.d.ts +17 -0
  63. package/dist/components/SignUp/SignUpDefault/SignUp.lazy.js +18 -0
  64. package/dist/components/SignUp/SignUpDefault/SignUpContext.d.ts +6 -0
  65. package/dist/components/SignUp/SignUpDefault/SignUpContext.js +2 -0
  66. package/dist/components/SignUp/SignUpDefault/SignUpForm.d.ts +1 -0
  67. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +310 -0
  68. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.d.ts +1 -0
  69. package/dist/components/SignUp/SignUpKYC/CaptureIdDocument.js +198 -0
  70. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.d.ts +1 -0
  71. package/dist/components/SignUp/SignUpKYC/CaptureSelfie.js +251 -0
  72. package/dist/components/SignUp/SignUpKYC/ImageUploader.d.ts +10 -0
  73. package/dist/components/SignUp/SignUpKYC/ImageUploader.js +42 -0
  74. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.d.ts +7 -0
  75. package/dist/components/SignUp/SignUpKYC/PersonOverlayDesktop.js +9 -0
  76. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.d.ts +1 -0
  77. package/dist/components/SignUp/SignUpKYC/SignUpFormKYC.js +464 -0
  78. package/dist/components/SignUp/SignUpKYC/useImageUploader.d.ts +11 -0
  79. package/dist/components/SignUp/SignUpKYC/useImageUploader.js +20 -0
  80. package/dist/components/SignUp/SignUpKYC/utils.d.ts +9 -0
  81. package/dist/components/SignUp/SignUpKYC/utils.js +79 -0
  82. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  83. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  84. package/dist/constants/Branches.d.ts +2 -0
  85. package/dist/constants/Branches.js +42 -0
  86. package/dist/handlers/postTransformIdFrontImage.d.ts +3 -0
  87. package/dist/handlers/postTransformIdFrontImage.js +82 -0
  88. package/dist/handlers/postTransformSelfieImage.d.ts +3 -0
  89. package/dist/handlers/postTransformSelfieImage.js +82 -0
  90. package/dist/next.config.js +1 -0
  91. package/dist/services/account.d.ts +4 -0
  92. package/dist/services/account.js +5 -1
  93. package/dist/services/queries.d.ts +1 -0
  94. package/dist/services/queries.js +2644 -2639
  95. package/dist/styles/theme.css +706 -706
  96. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +4 -0
  97. package/dist/third-parties/FacebookPixel/FacebookPixel.js +4 -0
  98. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  99. package/dist/third-parties/FacebookPixel/api.js +1 -0
  100. package/dist/third-parties/FacebookPixel/index.d.ts +1 -0
  101. package/dist/third-parties/FacebookPixel/index.js +1 -0
  102. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +4 -0
  103. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +4 -0
  104. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  105. package/dist/third-parties/GoogleRecaptcha/api.js +1 -0
  106. package/dist/third-parties/GoogleRecaptcha/index.d.ts +1 -0
  107. package/dist/third-parties/GoogleRecaptcha/index.js +1 -0
  108. package/dist/third-parties/index.d.ts +2 -0
  109. package/dist/third-parties/index.js +2 -0
  110. package/dist/ui/Dialog/Dialog.d.ts +88 -88
  111. package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
  112. package/dist/ui/Dialog/dialog.recipe.js +1 -1
  113. package/dist/utils/gamesAvailable3pmTo3am.d.ts +1 -0
  114. package/dist/utils/gamesAvailable3pmTo3am.js +1 -0
  115. package/dist/utils/getGameName.d.ts +1 -0
  116. package/dist/utils/getGameName.js +6 -0
  117. package/dist/utils/isBetween3amAnd3pm.d.ts +1 -0
  118. package/dist/utils/isBetween3amAnd3pm.js +5 -0
  119. package/dist/utils/mutationKeys.d.ts +1 -0
  120. package/dist/utils/mutationKeys.js +1 -0
  121. package/package.json +160 -158
@@ -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 { useKYCDefaultContext } from './KYCDefaultContext.js';
5
+ export function Indicator() {
6
+ const kyc = useKYCDefaultContext();
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,7 @@
1
+ import type { ImageProps } from 'next/image';
2
+ import { type KYCReminderProps } from '../KYCReminder';
3
+ export interface KYCDefaultProps extends KYCReminderProps {
4
+ provider?: 'opexa';
5
+ logo: ImageProps['src'];
6
+ }
7
+ export declare function KYCDefault(props: KYCDefaultProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import { useEffect } from 'react';
4
+ import { useShallow } from 'zustand/shallow';
5
+ import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
6
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
7
+ import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.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 { KYCReminder } from '../KYCReminder.js';
12
+ import { BasicInformation } from './BasicInformation.js';
13
+ import { IdentityVerification } from './IdentityVerification.js';
14
+ import { Indicator } from './Indicator.js';
15
+ import { KYCDefaultContext } from './KYCDefaultContext.js';
16
+ import { PersonalInformation } from './PersonalInformation.js';
17
+ import { useKYCDefault } from './useKYCDefault.js';
18
+ export function KYCDefault(props) {
19
+ const globalStore = useGlobalStore(useShallow((ctx) => ({ kyc: ctx.kyc })));
20
+ const kyc = useKYCDefault();
21
+ const { data: account } = useAccountQuery();
22
+ const { data: verification } = useMemberVerificationQuery();
23
+ const isBasicInfoCompleted = account?.realName !== null && account?.birthDay !== null;
24
+ const isUploadCompleted = verification?.idFrontImage && verification?.selfieImage;
25
+ const isVerified = verification?.status === 'VERIFIED' ||
26
+ verification?.status === 'PENDING' ||
27
+ verification?.status === 'APPROVED';
28
+ const isRejected = verification?.status === 'REJECTED';
29
+ const hasMissingData = !isBasicInfoCompleted || !isUploadCompleted || !isVerified;
30
+ const steps = !isBasicInfoCompleted
31
+ ? 1
32
+ : !isUploadCompleted
33
+ ? 2
34
+ : isRejected
35
+ ? 2
36
+ : 3;
37
+ useEffect(() => {
38
+ if (steps) {
39
+ kyc.setStep(steps);
40
+ }
41
+ }, [steps, kyc]);
42
+ return (_jsxs(_Fragment, { children: [_jsx(KYCDefaultContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open && hasMissingData, onOpenChange: (details) => {
43
+ globalStore.kyc.setOpen(details.open);
44
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "mx-auto min-h-full w-full overflow-y-auto bg-bg-primary-alt lg:min-h-auto lg:w-fit", children: _jsxs("div", { className: "flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit sm:overflow-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props })] }));
45
+ }
@@ -0,0 +1,6 @@
1
+ import type { UseKYCDefaultReturn } from './useKYCDefault';
2
+ export declare const KYCDefaultContext: (props: {
3
+ value: UseKYCDefaultReturn;
4
+ } & {
5
+ children?: import("react").ReactNode | undefined;
6
+ }) => React.ReactNode, useKYCDefaultContext: () => UseKYCDefaultReturn;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../../../client/utils/createContext.js';
2
+ export const [KYCDefaultContext, useKYCDefaultContext] = createContext();
@@ -0,0 +1 @@
1
+ export declare function PersonalInformation(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,122 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { useForm } from 'react-hook-form';
4
+ import { z } from 'zod';
5
+ import { useShallow } from 'zustand/shallow';
6
+ import { useApproveMemberVerification } from '../../../client/hooks/useApproveMemberVerification.js';
7
+ import { useCreateMemberVerificationMutation } from '../../../client/hooks/useCreateMemberVerificationMutation.js';
8
+ import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
9
+ import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
10
+ import { useUpdateMemberVerificationMutation } from '../../../client/hooks/useUpdateMemberVerificationMutation.js';
11
+ import { toaster } from '../../../client/utils/toaster.js';
12
+ import { CheckIcon } from '../../../icons/CheckIcon.js';
13
+ import { Button } from '../../../ui/Button/index.js';
14
+ import { Checkbox } from '../../../ui/Checkbox/index.js';
15
+ import { Dialog } from '../../../ui/Dialog/index.js';
16
+ import { Field } from '../../../ui/Field/index.js';
17
+ import { getQueryClient } from '../../../utils/getQueryClient.js';
18
+ import { getMemberVerificationQueryKey } from '../../../utils/queryKeys.js';
19
+ import { useKYCDefaultContext } from './KYCDefaultContext.js';
20
+ const definition = z.object({
21
+ address: z.string().trim().min(1, 'Current address is required'),
22
+ permanentAddress: z.string().trim().min(1, 'Permanent address is required'),
23
+ sourceOfIncome: z.string().trim().min(1, 'Source of Income is required'),
24
+ natureOfWork: z.string().trim().min(1, 'Nature of Work is required'),
25
+ placeOfBirth: z.string().trim().min(1, 'Place of Birth is required'),
26
+ nationality: z.string().trim().min(1, 'Nationality is required'),
27
+ });
28
+ export function PersonalInformation() {
29
+ const kyc = useKYCDefaultContext();
30
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
31
+ kyc: ctx.kyc,
32
+ })));
33
+ const memberVerificationQuery = useMemberVerificationQuery();
34
+ const memberVerificationId = memberVerificationQuery.data?.id;
35
+ const approveMemberVerificationMutation = useApproveMemberVerification();
36
+ const updateMemberVerificationMutation = useUpdateMemberVerificationMutation({
37
+ onError(error) {
38
+ toaster.error({
39
+ description: error.message,
40
+ });
41
+ },
42
+ onSuccess() {
43
+ const queryClient = getQueryClient();
44
+ queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
45
+ if (!prev)
46
+ return prev;
47
+ return {
48
+ ...prev,
49
+ status: 'PENDING',
50
+ };
51
+ });
52
+ kyc.setDone(true);
53
+ globalStore.kyc.setOpen(false);
54
+ toaster.success({
55
+ title: 'Success',
56
+ description: 'Personal information has been set successfully.',
57
+ });
58
+ },
59
+ });
60
+ const createMemberVerificationMutation = useCreateMemberVerificationMutation({
61
+ onError(error) {
62
+ toaster.error({
63
+ description: error.message,
64
+ });
65
+ },
66
+ onSuccess() {
67
+ kyc.setDone(true);
68
+ globalStore.kyc.setOpen(false);
69
+ toaster.success({
70
+ title: 'Success',
71
+ description: 'Personal information has been set successfully.',
72
+ });
73
+ },
74
+ });
75
+ const form = useForm({
76
+ resolver: zodResolver(definition),
77
+ defaultValues: {
78
+ address: '',
79
+ nationality: '',
80
+ natureOfWork: '',
81
+ placeOfBirth: '',
82
+ permanentAddress: '',
83
+ },
84
+ mode: 'all',
85
+ });
86
+ async function onSubmit(values) {
87
+ if (!memberVerificationId) {
88
+ createMemberVerificationMutation.mutate({
89
+ ...values,
90
+ });
91
+ }
92
+ else {
93
+ await updateMemberVerificationMutation.mutateAsync({
94
+ id: memberVerificationId,
95
+ data: {
96
+ ...values,
97
+ },
98
+ });
99
+ //approve status of member to be pending
100
+ await approveMemberVerificationMutation.mutateAsync({
101
+ id: memberVerificationId,
102
+ });
103
+ }
104
+ }
105
+ const address = form.watch('address');
106
+ const permanentAddress = form.watch('permanentAddress');
107
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center font-semibold text-lg", children: "Personal Information" }), _jsx(Dialog.Description, { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Provide your basic details and work info." }), _jsxs("form", { className: "mt-7", onSubmit: form.handleSubmit(onSubmit), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.permanentAddress, children: [_jsx(Field.Label, { children: "Permanent address" }), _jsx(Field.Input, { placeholder: "Enter your permanent address", ...form.register('permanentAddress') }), _jsx(Field.ErrorText, { children: form.formState.errors.permanentAddress?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.address, children: [_jsx(Field.Label, { children: "Current address" }), _jsx(Field.Input, { placeholder: "Enter your current address", ...form.register('address') }), _jsx(Field.ErrorText, { children: form.formState.errors.address?.message })] }), _jsxs(Checkbox.Root, { className: "mt-md", checked: address !== '' &&
108
+ permanentAddress !== '' &&
109
+ address === permanentAddress, onCheckedChange: (details) => {
110
+ if (details.checked === true) {
111
+ form.setValue('address', form.getValues('permanentAddress'), {
112
+ shouldDirty: true,
113
+ shouldTouch: true,
114
+ shouldValidate: true,
115
+ });
116
+ }
117
+ }, disabled: !permanentAddress, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { children: "Use permanent address as current address" }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.sourceOfIncome, children: [_jsx(Field.Label, { children: "Source of income" }), _jsx(Field.Input, { placeholder: "Enter your source of income", ...form.register('sourceOfIncome') }), _jsx(Field.ErrorText, { children: form.formState.errors.sourceOfIncome?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.natureOfWork, children: [_jsx(Field.Label, { children: "Work Description" }), _jsx(Field.Input, { placeholder: "Enter your work description", ...form.register('natureOfWork') }), _jsx(Field.ErrorText, { children: form.formState.errors.natureOfWork?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.placeOfBirth, children: [_jsx(Field.Label, { children: "Place of birth" }), _jsx(Field.Input, { placeholder: "Enter your place of birth", ...form.register('placeOfBirth') }), _jsx(Field.ErrorText, { children: form.formState.errors.placeOfBirth?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.nationality, children: [_jsx(Field.Label, { children: "Nationality" }), _jsx(Field.Input, { placeholder: "Enter your nationality", ...form.register('nationality') }), _jsx(Field.ErrorText, { children: form.formState.errors.nationality?.message })] }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: updateMemberVerificationMutation.isPending ||
118
+ createMemberVerificationMutation.isPending, children: "Continue" }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", onClick: () => {
119
+ globalStore.kyc.setOpen(false);
120
+ }, disabled: updateMemberVerificationMutation.isPending ||
121
+ createMemberVerificationMutation.isPending, children: "Skip for now" })] })] }));
122
+ }
@@ -0,0 +1 @@
1
+ export * from './KYCDefault';
@@ -0,0 +1 @@
1
+ export * from './KYCDefault.js';
@@ -0,0 +1,25 @@
1
+ type EventDetail = {
2
+ type: 'SELFIE_CAPTURED';
3
+ data: string;
4
+ } | {
5
+ type: 'ID_DOCUMENT_CAPTURED';
6
+ data: string;
7
+ };
8
+ type UnsubscribeFn = () => void;
9
+ type Subscriber = (detail: EventDetail) => UnsubscribeFn;
10
+ export type CaptureSubject = 'SELFIE' | 'ID_DOCUMENT';
11
+ export interface UseKYCDefaultReturn {
12
+ step: number;
13
+ setStep: (step: number) => void;
14
+ done: boolean;
15
+ setDone: (done: boolean) => void;
16
+ subscribe: (subscriber: Subscriber) => UnsubscribeFn;
17
+ triggerEvent: (detail: EventDetail) => void;
18
+ idFrontImageId: string | null;
19
+ setFrontImageId: (id: string | null) => void;
20
+ selfieImageId: string | null;
21
+ setSelfieImageId: (id: string | null) => void;
22
+ reset: () => void;
23
+ }
24
+ export declare function useKYCDefault(): UseKYCDefaultReturn;
25
+ export {};
@@ -0,0 +1,38 @@
1
+ import { useRef, useState } from 'react';
2
+ export function useKYCDefault() {
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,2 +1,3 @@
1
1
  import type { KYCReminderProps } from './KYCReminder.lazy';
2
2
  export declare function KYCReminder(props: KYCReminderProps): import("react/jsx-runtime").JSX.Element | undefined;
3
+ export type { KYCReminderProps };
@@ -21,9 +21,9 @@ export function KYCReminder(props) {
21
21
  const isUploadCompleted = verification &&
22
22
  verification.idFrontImage !== null &&
23
23
  verification.selfieImage !== null;
24
- const isVerified = Boolean(verification?.status === 'VERIFIED') ||
25
- Boolean(verification?.status === 'PENDING') ||
26
- Boolean(verification?.status === 'APPROVED');
24
+ const isVerified = verification?.status === 'VERIFIED' ||
25
+ verification?.status === 'PENDING' ||
26
+ verification?.status === 'APPROVED';
27
27
  const hasMissingData = !isBasicInfoCompleted || !isUploadCompleted || !isVerified;
28
28
  return (_jsx(Dialog.Root, { open: globalStore.kycReminder.open &&
29
29
  !sessionLoading &&
@@ -0,0 +1,5 @@
1
+ import { type KYCReminderProps } from './KYCReminder';
2
+ export interface KYCSumsubProps extends KYCReminderProps {
3
+ provider: 'sumsub';
4
+ }
5
+ export declare function KYCSumsub(props: KYCSumsubProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import Sumsub from '@sumsub/websdk-react';
3
+ import { useEffect, useState } from 'react';
4
+ import { useShallow } from 'zustand/shallow';
5
+ import { useGenerateSumsubVerificationTokenMutation } from '../../client/hooks/useGenerateSumsubVerificationTokenMutation.js';
6
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
7
+ import { Spinner02Icon } from '../../icons/Spinner02Icon.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 { KYCReminder } from './KYCReminder.js';
12
+ export function KYCSumsub(props) {
13
+ const [open, setOpen] = useGlobalStore(useShallow((ctx) => [ctx.kyc.open, ctx.kyc.setOpen]));
14
+ const { mutate, mutateAsync, reset, isPending, isIdle } = useGenerateSumsubVerificationTokenMutation();
15
+ const [token, setToken] = useState('');
16
+ useEffect(() => {
17
+ if (open === true && isIdle && !token) {
18
+ mutate(undefined, {
19
+ onSuccess(token) {
20
+ setToken(token);
21
+ },
22
+ });
23
+ }
24
+ }, [
25
+ /**/
26
+ open,
27
+ token,
28
+ isIdle,
29
+ mutate,
30
+ ]);
31
+ return (_jsxs(_Fragment, { children: [_jsx(Dialog.Root, { open: open, onOpenChange: (details) => {
32
+ setOpen(details.open);
33
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
34
+ reset();
35
+ setToken('');
36
+ }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center justify-center lg:block", children: _jsxs(Dialog.Content, { className: "mx-auto flex h-full w-[calc(100%-2rem)] flex-col items-center justify-center overflow-y-auto rounded-md bg-transparent p-0 lg:mt-3 lg:block lg:h-auto lg:w-[600px]", children: [_jsx(Dialog.Context, { children: (api) => (_jsx("div", { className: "mb-3 flex w-full justify-end", children: _jsxs("button", { type: "button", className: "rounded-full bg-white/10 p-1 text-white backdrop-blur-md", onClick: () => {
37
+ api.setOpen(false);
38
+ }, children: [_jsx(XIcon, { className: "!size-5" }), _jsx("span", { className: "sr-only", children: "Close" })] }) })) }), isPending ? (_jsx("div", { className: "w-full rounded-md bg-[#20252c] px-4 py-12", children: _jsx(Spinner02Icon, { className: "mx-auto size-8" }) })) : (_jsx("div", { className: "max-h-[calc(96dvh-2rem)] w-full overflow-y-auto lg:h-auto lg:max-h-[unset]", children: _jsx(Sumsub, { accessToken: token, expirationHandler: async () => {
39
+ const token = await mutateAsync();
40
+ return token;
41
+ }, config: {
42
+ lang: 'en',
43
+ theme: 'dark',
44
+ }, options: {
45
+ debug: process.env.NODE_ENV === 'development',
46
+ addViewportTag: false,
47
+ adaptIframeHeight: true,
48
+ enableScrollIntoView: true,
49
+ }, onMessage: (type, payload) => {
50
+ console.log({ type, payload });
51
+ }, onError: (error) => {
52
+ console.warn(error);
53
+ }, className: "block max-h-full w-full overflow-y-auto rounded-md", force: true }) }))] }) })] }) }), _jsx(KYCReminder, { ...props })] }));
54
+ }
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ onRetry: () => void;
3
+ title: string;
4
+ description: string;
5
+ }
6
+ declare function NoCameraError({ onRetry, title, description }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default NoCameraError;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '../../ui/Button/index.js';
3
+ function NoCameraError({ onRetry, title, description }) {
4
+ return (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-2 p-4", children: [_jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-red-500 mb-2", children: title }), _jsx("p", { className: "mb-2 text-sm", children: description })] }), _jsx(Button, { className: "mx-auto px-xl lg:w-fit", onClick: onRetry, size: "sm", children: "Try Again" })] }));
5
+ }
6
+ export default NoCameraError;
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ isFaceCentered: boolean;
3
+ width: number;
4
+ height: number;
5
+ }
6
+ declare function PersonOverlayDesktop({ isFaceCentered, height, width }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default PersonOverlayDesktop;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ function PersonOverlayDesktop({ isFaceCentered, height, width }) {
3
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "pointer-events-none absolute inset-0 hidden md:block", children: _jsxs("svg", { width: `${width}px`, height: `${height}px`, viewBox: `0 0 ${width} ${height}`, preserveAspectRatio: "xMidYMid meet", className: "max-h-full w-full", children: [_jsxs("defs", { children: [_jsx("path", { id: "head-shoulder-path", d: "M 389.605 124.529 C 390.221 129.441 390.638 134.433 390.846 139.492 L 390.932 151.978 C 390.841 155.321 390.658 158.636 390.388 161.919 C 388.294 162.987 388.18 164.214 389 168 L 390.277 171.709 L 395 181 C 395.61 182.222 396.985 183.052 398.459 183.693 L 399.097 183.956 C 401.81 185.016 404.425 186.275 406.923 187.715 L 420.473 198.503 C 424.405 202.729 427.713 207.542 430.252 212.795 L 435.357 229.337 C 435.78 232.162 436 235.055 436 238 V 244.833 V 258.5 H 436 V 272.167 V 285.833 H 436 V 299.5 V 313.167 H 436 V 320 C 436 321.36 435.73 322.651 435.242 323.827 L 429.827 329.242 C 428.651 329.73 427.36 330 426 330 H 418.275 H 402.825 V 330 H 387.375 H 371.925 V 330 H 356.475 H 341.025 V 330 H 325.575 H 310.125 V 330 H 294.675 H 279.225 V 330 H 263.775 H 248.325 V 330 H 232.875 H 217.425 V 330 H 201.975 H 186.525 V 330 H 171.075 H 155.625 V 330 H 140.175 H 124.725 V 330 H 117 C 115.641 330 114.349 329.73 113.173 329.242 L 107.758 323.827 C 107.27 322.651 107 321.36 107 320 V 313.167 V 299.5 H 107 V 285.833 V 272.167 H 107 V 258.5 V 244.833 H 107 V 238 C 107 235.088 107.214 232.227 107.628 229.433 L 112.622 213.056 C 115.107 207.848 118.347 203.067 122.2 198.856 L 135.494 188.055 C 137.641 186.783 139.877 185.647 142.19 184.656 L 143.186 184.241 C 144.876 183.555 146.441 182.623 147.83 181.498 L 153.722 172.52 C 154.177 170.759 154.329 168.902 154.116 167.011 L 153.981 165.769 C 153.85 164.525 153.732 163.276 153.627 162.022 C 151.354 158.847 151.164 155.472 151.069 152.068 L 151.153 139.492 C 151.36 134.462 151.773 129.498 152.383 124.613 L 152.394 124.529 L 154.894 109.723 C 155.95 104.771 157.212 99.9212 158.668 95.1875 L 163.727 81.0498 C 165.649 76.3661 167.77 71.8259 170.076 67.4453 L 177.715 54.5254 C 180.508 50.3027 183.489 46.274 186.641 42.457 L 196.832 31.4316 C 200.471 27.9227 204.28 24.6674 208.24 21.6846 L 220.789 13.4502 C 225.168 10.9758 229.688 8.8149 234.332 6.9912 L 248.66 2.544 C 253.508 1.4258 258.458 0.6639 263.493 0.2832 L 278.506 0.2832 C 283.541 0.6638 288.491 1.4259 293.339 2.544 L 307.667 6.9912 C 312.311 8.8149 316.831 10.9758 321.21 13.4502 L 333.759 21.6846 C 337.719 24.6673 341.528 27.9227 345.167 31.4316 L 355.359 42.458 C 358.511 46.2749 361.491 50.3038 364.284 54.5264 L 371.923 67.4453 C 374.229 71.826 376.35 76.3661 378.272 81.0498 L 383.331 95.1875 C 384.787 99.9212 386.049 104.771 387.105 109.723 L 389.605 124.529 Z" }), _jsxs("mask", { id: "outline-mask", children: [_jsx("rect", { width: "100%", height: "100%", fill: "white" }), _jsx("use", { href: "#head-shoulder-path", fill: "black" })] })] }), _jsx("rect", { width: "100%", height: "100%", fill: !isFaceCentered
4
+ ? 'rgba(156, 156, 156, 0.40)'
5
+ : 'rgba(34, 139, 87, 0.75)', mask: "url(#outline-mask)" }), _jsx("use", { href: "#head-shoulder-path", fill: "none", stroke: !isFaceCentered ? '#B54708' : '#34D399', strokeWidth: "3", strokeDasharray: "10 5" })] }) }), _jsx("div", { className: "pointer-events-none absolute inset-0 block md:hidden", children: _jsxs("svg", { className: "block md:hidden", width: "100%", height: "100%", viewBox: "0 0 400 400", preserveAspectRatio: "xMidYMid slice", children: [_jsxs("defs", { children: [_jsx("path", { id: "fill-path", d: "M 300.85 220.1 C 301.15 223.9 302.705 227.284 305.171 230.096 V 230.097 L 311.15 234.9 L 316.351 238.504 C 320.778 242.037 324.741 246.126 328.135 250.665 L 336.459 265.409 C 338.554 270.577 340.015 276.069 340.746 281.79 V 320.036 V 359.74 V 369.667 L 340.28 374.731 C 338.938 377.967 336.351 380.555 333.115 381.896 H 300.872 H 264.633 H 228.396 H 192.158 H 155.921 H 119.682 H 83.4439 H 74.3844 L 69.319 381.896 C 66.0834 380.554 63.4953 377.967 62.1539 374.731 V 339.888 V 320.036 V 300.184 L 62.15 281.9 C 62.459 275.847 63.967 270.273 66.127 265.038 L 74.702 250.13 C 78.005 245.806 81.828 241.899 86.08 238.506 L 86.819 237.925 L 98.284 229.572 L 104.15 223.9 C 105.146 217.607 104.959 215.459 104.343 213.349 L 102.15 210.9 L 98.15 202.9 C 97.985 196.059 96.943 188.701 96.423 181.159 L 96.31 160.744 C 96.641 154.989 97.273 149.337 98.193 143.813 L 98.454 142.294 L 102.789 124.231 C 104.631 118.212 106.825 112.406 109.34 106.849 L 118.126 90.483 C 121.479 85.154 125.161 80.154 129.135 75.528 L 142.322 62.463 C 147.129 58.431 152.22 54.874 157.55 51.845 L 174.504 44.306 C 180.364 42.381 186.424 41.058 192.638 40.394 L 211.201 40.394 C 217.414 41.057 223.474 42.381 229.334 44.306 L 246.288 51.845 C 251.619 54.874 256.709 58.431 261.516 62.463 L 274.703 75.528 C 278.677 80.154 282.359 85.154 285.712 90.483 L 294.499 106.849 C 297.014 112.406 299.208 118.212 301.049 124.231 L 305.385 142.294 V 142.293 C 306.447 148.299 307.168 154.46 307.529 160.744 L 307.403 181.33 C 306.867 188.989 305.792 196.459 304.224 203.681 C 301.374 206.417 300.58 209.572 300.15 212.9 L 300.15 214.9 L 300.85 220.1 Z" }), _jsx("path", { id: "border-path", d: "M 300.85 220.1 C 301.15 223.9 302.705 227.284 305.171 230.096 V 230.097 L 311.15 234.9 L 316.351 238.504 C 320.778 242.037 324.741 246.126 328.135 250.665 L 336.459 265.409 C 338.554 270.577 340.015 276.069 340.746 281.79 V 320.036 V 359.74 V 369.667 L 340.28 374.731 C 338.938 377.967 336.351 380.555 333.115 381.896 H 300.872 H 264.633 H 228.396 H 192.158 H 155.921 H 119.682 H 83.4439 H 74.3844 L 69.319 381.896 C 66.0834 380.554 63.4953 377.967 62.1539 374.731 V 339.888 V 320.036 V 300.184 L 62.15 281.9 C 62.459 275.847 63.967 270.273 66.127 265.038 L 74.702 250.13 C 78.005 245.806 81.828 241.899 86.08 238.506 L 86.819 237.925 L 98.284 229.572 L 104.15 223.9 C 105.146 217.607 104.959 215.459 104.343 213.349 L 102.15 210.9 L 98.15 202.9 C 97.985 196.059 96.943 188.701 96.423 181.159 L 96.31 160.744 C 96.641 154.989 97.273 149.337 98.193 143.813 L 98.454 142.294 L 102.789 124.231 C 104.631 118.212 106.825 112.406 109.34 106.849 L 118.126 90.483 C 121.479 85.154 125.161 80.154 129.135 75.528 L 142.322 62.463 C 147.129 58.431 152.22 54.874 157.55 51.845 L 174.504 44.306 C 180.364 42.381 186.424 41.058 192.638 40.394 L 211.201 40.394 C 217.414 41.057 223.474 42.381 229.334 44.306 L 246.288 51.845 C 251.619 54.874 256.709 58.431 261.516 62.463 L 274.703 75.528 C 278.677 80.154 282.359 85.154 285.712 90.483 L 294.499 106.849 C 297.014 112.406 299.208 118.212 301.049 124.231 L 305.385 142.294 V 142.293 C 306.447 148.299 307.168 154.46 307.529 160.744 L 307.403 181.33 C 306.867 188.989 305.792 196.459 304.224 203.681 C 301.374 206.417 300.58 209.572 300.15 212.9 L 300.15 214.9 L 300.85 220.1 Z" }), _jsx("clipPath", { id: "face-cutout", children: _jsx("use", { href: "#fill-path" }) }), _jsxs("mask", { id: "face-mask", children: [_jsx("rect", { x: "0", y: "0", width: "400", height: "400", fill: "white" }), _jsx("use", { href: "#fill-path", fill: "black" })] })] }), _jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: !isFaceCentered
6
+ ? 'rgba(156, 156, 156, 0.40)'
7
+ : 'rgba(34, 139, 87, 0.75)', mask: "url(#face-mask)" }), _jsx("use", { href: "#border-path", fill: "none", stroke: !isFaceCentered ? '#B54708' : '#34D399', strokeWidth: "3", strokeDasharray: "12 8", strokeLinecap: "round", id: "border-element" })] }) })] }));
8
+ }
9
+ export default PersonOverlayDesktop;
@@ -1,3 +1,2 @@
1
1
  export * from './KYC';
2
- export * from './KYCReminder';
3
2
  export * from './KYCTrigger';
@@ -1,3 +1,2 @@
1
1
  export * from './KYC.js';
2
- export * from './KYCReminder.js';
3
2
  export * from './KYCTrigger.js';
@@ -0,0 +1,9 @@
1
+ export declare function loadFaceApiModels(): Promise<void>;
2
+ export declare function dataURLtoBlob(dataURL: string): Blob;
3
+ export declare const resizeFile: (file: File) => Promise<unknown>;
4
+ export declare const MAX_FILE_SIZE = 10;
5
+ export declare const MAX_NAME_LENGTH = 52;
6
+ export declare const SUPPORTED_FILES: string[];
7
+ export declare function validateFile(file: File): "File too large" | "File name too long" | "Unsupported file" | undefined;
8
+ export declare function showPermissionInstructions(): void;
9
+ export declare const cameraErrorDescriptions: Record<string, string>;
@@ -0,0 +1,79 @@
1
+ import * as faceapi from 'face-api.js';
2
+ import Resizer from 'react-image-file-resizer';
3
+ export async function loadFaceApiModels() {
4
+ // const url = `${STATIC_ENDPOINT}/models`;
5
+ const url = '/models';
6
+ await Promise.all([
7
+ faceapi.nets.tinyFaceDetector.loadFromUri(url),
8
+ faceapi.nets.faceLandmark68Net.loadFromUri(url),
9
+ faceapi.nets.faceRecognitionNet.loadFromUri(url),
10
+ ]);
11
+ }
12
+ export function dataURLtoBlob(dataURL) {
13
+ const parts = dataURL.split(';base64,');
14
+ const contentType = parts[0].split(':')[1];
15
+ const raw = window.atob(parts[1]);
16
+ const rawLength = raw.length;
17
+ const uInt8Array = new Uint8Array(rawLength);
18
+ for (let i = 0; i < rawLength; ++i) {
19
+ uInt8Array[i] = raw.charCodeAt(i);
20
+ }
21
+ return new Blob([uInt8Array], { type: contentType });
22
+ }
23
+ export const resizeFile = (file) => new Promise((resolve) => {
24
+ Resizer.imageFileResizer(file, 300, 300, 'jpeg', 100, 0, (uri) => {
25
+ resolve(uri);
26
+ }, 'file');
27
+ });
28
+ export const MAX_FILE_SIZE = 10; /* in MB */
29
+ export const MAX_NAME_LENGTH = 52;
30
+ export const SUPPORTED_FILES = [
31
+ /* add more supported ext */
32
+ 'image/png',
33
+ 'image/jpg',
34
+ 'image/jpeg',
35
+ ];
36
+ function removeFilenameExt(subject) {
37
+ const l = subject.split('.');
38
+ l.pop();
39
+ return l.join('.');
40
+ }
41
+ export function validateFile(file) {
42
+ const fileType = file.type;
43
+ const fileSize = file.size / (1024 * 1024);
44
+ const nameLength = removeFilenameExt(file.name).length;
45
+ if (fileSize > MAX_FILE_SIZE)
46
+ return 'File too large';
47
+ if (nameLength > MAX_NAME_LENGTH)
48
+ return 'File name too long';
49
+ if (!SUPPORTED_FILES.includes(fileType))
50
+ return 'Unsupported file';
51
+ }
52
+ export function showPermissionInstructions() {
53
+ const instructions = `
54
+ Camera access is blocked. To enable camera access:
55
+
56
+ Chrome/Edge:
57
+ 1. Click the camera icon in the address bar
58
+ 2. Select "Always allow" and click "Done"
59
+ 3. Or go to Settings > Privacy and security > Site settings > Camera
60
+
61
+ Firefox:
62
+ 1. Click the shield icon in the address bar
63
+ 2. Click on "Camera blocked"
64
+ 3. Select "Allow" and refresh the page
65
+
66
+ Safari:
67
+ 1. Go to Safari > Settings > Websites > Camera
68
+ 2. Find this website and change to "Allow"
69
+
70
+ After changing permissions, please refresh the page and try again.
71
+ `;
72
+ alert(instructions);
73
+ }
74
+ export const cameraErrorDescriptions = {
75
+ NotAllowedError: 'We were unable to detect a camera on your device. Please ensure it is properly connected and accessible to this application.',
76
+ NotReadableError: 'We were unable to access your camera. Please check if another application is using it or try reconnecting your device.',
77
+ NotFoundError: 'No camera was found. Please connect a camera and try again.',
78
+ NoIdDetectedError: 'No ID document was detected in the frame. Please ensure your ID is clearly visible and try again.',
79
+ };
@@ -58,7 +58,7 @@ export function JourneyQuest() {
58
58
  const handleViewDetails = useCallback(() => {
59
59
  disclosure.setOpen(true);
60
60
  }, [disclosure]);
61
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx("div", { className: "flex max-h-7.5 items-start justify-between", children: _jsx(RemainingTime, {}) }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: "h-2 rounded-full bg-bg-primary", value: progressValue, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) }), _jsxs("p", { className: "text-text-quarterary-brand text-xs", children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted }, milestone.key))) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "aria-label": "View Details", disabled: false, className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) })] }), _jsx(Rules, { open: disclosure.open, onOpenChange: disclosure.setOpen, quest: quest, milestones: milestones })] }));
61
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsx("div", { className: "flex max-h-7.5 items-start justify-between", children: _jsx(RemainingTime, { endOfDay: true }) }), _jsx("p", { className: "font-semibold text-xl", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: "h-2 rounded-full bg-bg-primary", value: progressValue, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) }), _jsxs("p", { className: "text-text-quarterary-brand text-xs", children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted }, milestone.key))) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "aria-label": "View Details", disabled: false, className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) })] }), _jsx(Rules, { open: disclosure.open, onOpenChange: disclosure.setOpen, quest: quest, milestones: milestones })] }));
62
62
  }
63
63
  function Rules(props) {
64
64
  const [open, setOpen] = useControllableState({
@@ -1 +1,5 @@
1
- export declare function RemainingTime(): import("react/jsx-runtime").JSX.Element;
1
+ interface RemainingTimeProps {
2
+ endOfDay?: boolean;
3
+ }
4
+ export declare function RemainingTime({ endOfDay: useEndOfDay }: RemainingTimeProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -1,11 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { endOfDay } from 'date-fns';
2
3
  import { useRemainingTime } from '../../client/hooks/useRemainingTime.js';
3
4
  import { ClockStopWatchIcon } from '../../icons/ClockStopWatchIcon.js';
4
5
  import { Badge } from '../../ui/Badge/index.js';
5
6
  import { useQuestContext } from './QuestsContext.js';
6
- export function RemainingTime() {
7
+ export function RemainingTime({ endOfDay: useEndOfDay = false }) {
7
8
  const quest = useQuestContext();
8
- const remainingTime = useRemainingTime(quest.endDateTime);
9
+ const targetDateTime = useEndOfDay
10
+ ? endOfDay(new Date(quest.endDateTime)).toISOString()
11
+ : quest.endDateTime;
12
+ const remainingTime = useRemainingTime(targetDateTime);
9
13
  if (quest.status === 'COMPLETED') {
10
14
  return (_jsx(Badge.Root, { size: "lg", colorScheme: "success", round: false, children: _jsx(Badge.Label, { children: "Completed" }) }));
11
15
  }
@@ -0,0 +1,8 @@
1
+ type Options = {
2
+ accountName?: string;
3
+ siteName?: string;
4
+ signInOptions?: 'MOBILE_NUMBER' | 'NAME_AND_PASSWORD';
5
+ };
6
+ export type ErrorCode = 'MEMBER_ACCOUNT_BLACKLISTED' | 'MEMBER_ACCOUNT_SUSPENDED' | 'INVALID_RECAPTCHA_RESPONSE' | 'MEMBER_NOT_FOUND' | 'RATE_LIMIT_REACH' | 'NOT_READY_TO_SEND_VERIFICATION_ERROR' | 'Forbidden';
7
+ export declare function getFriendlyErrorMessage(code: ErrorCode, options?: Options): string;
8
+ export {};
@@ -0,0 +1,26 @@
1
+ export function getFriendlyErrorMessage(code, options) {
2
+ const accountName = options?.accountName ?? '';
3
+ const siteName = options?.siteName ?? '';
4
+ const signInOptions = options?.signInOptions ?? 'NAME_AND_PASSWORD';
5
+ switch (code) {
6
+ case 'MEMBER_ACCOUNT_BLACKLISTED':
7
+ return `Your account ${accountName} has been blacklisted due to a serious violation of our policies. For more information or to appeal, please contact the ${siteName} Chat Support team.`;
8
+ case 'MEMBER_ACCOUNT_SUSPENDED':
9
+ return `Your account ${accountName} has been temporarily suspended. Please reach out to the ${siteName} Chat Support team to learn more and get help with resolving the issue.`;
10
+ case 'INVALID_RECAPTCHA_RESPONSE':
11
+ return 'Invalid reCAPTCHA response';
12
+ case 'MEMBER_NOT_FOUND':
13
+ return 'Account not found. Please check your username and try again.';
14
+ case 'RATE_LIMIT_REACH':
15
+ return 'Rate limit exceeded';
16
+ case 'NOT_READY_TO_SEND_VERIFICATION_ERROR':
17
+ return 'Your account is not ready to send verification requests. Please try again later.';
18
+ case 'Forbidden':
19
+ if (signInOptions === 'MOBILE_NUMBER') {
20
+ return 'Invalid verification code. Please check the code and try again.';
21
+ }
22
+ return 'Invalid username or password, please try again.';
23
+ default:
24
+ return 'Something went wrong. Please try again later.';
25
+ }
26
+ }
@@ -0,0 +1,17 @@
1
+ import { type ImageProps } from 'next/image';
2
+ import { type ReactNode } from 'react';
3
+ import type { Branch } from '../../../types';
4
+ export interface SignUpProps {
5
+ logo: ImageProps['src'];
6
+ children?: ReactNode;
7
+ /** @default "/terms-and-conditions" */
8
+ termsAndConditionsUrl?: string;
9
+ termsOfUseContent?: ReactNode;
10
+ responsibleGamingContent?: ReactNode;
11
+ responsibleGamingLogo?: ImageProps['src'];
12
+ siteName?: string;
13
+ className?: string;
14
+ branches?: Branch[];
15
+ layout: 'default';
16
+ }
17
+ export declare function SignUp(props: SignUpProps): import("react/jsx-runtime").JSX.Element;