From 74349b80a5f84ce1599934235cada8c6d28957ec Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 10:42:59 +0300 Subject: [PATCH 01/14] Update user service --- packages/wallet/frontend/src/lib/api/user.ts | 164 +++---------------- 1 file changed, 26 insertions(+), 138 deletions(-) diff --git a/packages/wallet/frontend/src/lib/api/user.ts b/packages/wallet/frontend/src/lib/api/user.ts index 6b96826bc..eb50b2467 100644 --- a/packages/wallet/frontend/src/lib/api/user.ts +++ b/packages/wallet/frontend/src/lib/api/user.ts @@ -5,8 +5,6 @@ import { type ErrorResponse, type SuccessResponse } from '../httpClient' -import { ACCEPTED_IMAGE_TYPES } from '@/utils/constants' -import { SelectOption } from '@/ui/forms/Select' import { UserResponse, ValidTokenResponse } from '@wallet/shared' import { emailSchema } from '@wallet/shared/src' @@ -76,66 +74,14 @@ export const loginSchema = z.object({ password: z.string().min(1, { message: 'Password is required' }) }) -export const personalDetailsSchema = z.object({ - firstName: z.string().min(1, { message: 'First name is required' }), - lastName: z.string().min(1, { message: 'Last name is required' }), - country: z.object({ - value: z.string().length(2), - label: z.string().min(1) - }), - city: z.string().min(1, { message: 'City is required' }), - address: z.string().min(1, { message: 'Address is required' }), - zip: z.string().min(1, { message: 'ZIP code is required' }) -}) - export const profileSchema = z.object({ firstName: z.string().min(1, { message: 'First name is required' }), lastName: z.string().min(1, { message: 'Last name is required' }) }) -export const verifyIdentitySchema = z - .object({ - documentType: z.string({ - invalid_type_error: 'Please select an ID Type' - }), - frontSideImage: z - .string() - .min(1, { message: 'Front side of ID is required' }), - frontSideImageType: z.string(), - backSideImage: z.string().optional(), - backSideImageType: z.string().optional(), - faceImage: z.string().min(1, { message: 'A selfie image is required' }), - faceImageType: z.string() - }) - .superRefine( - ({ frontSideImageType, faceImageType, backSideImageType }, ctx) => { - if (!ACCEPTED_IMAGE_TYPES.includes(frontSideImageType)) { - ctx.addIssue({ - code: 'custom', - message: `Image must be 'jpeg' or 'png'`, - path: ['frontSideImage'] - }) - } - if (!ACCEPTED_IMAGE_TYPES.includes(faceImageType)) { - ctx.addIssue({ - code: 'custom', - message: `Image must be 'jpeg' or 'png'`, - path: ['faceImage'] - }) - } - if ( - backSideImageType && - backSideImageType?.length > 0 && - !ACCEPTED_IMAGE_TYPES.includes(backSideImageType) - ) { - ctx.addIssue({ - code: 'custom', - message: `Image must be 'jpeg' or 'png'`, - path: ['backSideImage'] - }) - } - } - ) +export const forgotPasswordSchema = z.object({ + email: z.string().email({ message: 'Email is required' }) +}) export const resetPasswordSchema = z .object({ @@ -197,11 +143,9 @@ export const changePasswordSchema = z } }) -export type Document = { - type: string - name: string - isBackRequired: boolean -} +const getBearerTokenSchema = z.object({ + type: z.enum(['onboarding', 'ramp']) +}) type SignUpArgs = z.infer type SignUpError = ErrorResponse @@ -239,14 +183,6 @@ type VerifyEmailResponse = SuccessResponse | VerifyEmailError type MeResult = SuccessResponse type MeResponse = MeResult | ErrorResponse -type CreateWalletArgs = z.infer -type CreateWalletError = ErrorResponse -type CreateWalletResponse = SuccessResponse | CreateWalletError - -type VerifyIdentityArgs = z.infer -type VerifyIdentityError = ErrorResponse -type VerifyIdentityResponse = SuccessResponse | VerifyIdentityError - type ProfileArgs = z.infer type ProfileError = ErrorResponse type ProfileResponse = SuccessResponse | ProfileError @@ -255,6 +191,11 @@ type ChangePasswordArgs = z.infer type ChangePasswordError = ErrorResponse type ChangePasswordResponse = SuccessResponse | ChangePasswordError +type GetBearerTokenArgs = z.infer +type GetBearerTokenResult = SuccessResponse<{ url: string }> +type GetBearerTokenError = ErrorResponse +type GetBearerTokenResponse = GetBearerTokenResult | GetBearerTokenError + interface UserService { signUp: (args: SignUpArgs) => Promise login: (args: LoginArgs) => Promise @@ -264,15 +205,12 @@ interface UserService { checkToken: (token: string, cookies?: string) => Promise verifyEmail: (args: VerifyEmailArgs) => Promise me: (cookies?: string) => Promise - createWallet: (args: CreateWalletArgs) => Promise - verifyIdentity: (args: VerifyIdentityArgs) => Promise updateProfile: (args: ProfileArgs) => Promise - getDocuments: (cookies?: string) => Promise - getCountries: (cookies?: string) => Promise changePassword: (args: ChangePasswordArgs) => Promise resendVerifyEmail: ( args: ResendVerificationEmailArgs ) => Promise + getBearerToken: (args: GetBearerTokenArgs) => Promise } const createUserService = (): UserService => ({ @@ -415,99 +353,49 @@ const createUserService = (): UserService => ({ } }, - async createWallet(args) { - try { - const response = await httpClient - .post('wallet', { - json: { - ...args, - country: args.country.value - } - }) - .json() - return response - } catch (error) { - return getError( - error, - 'Something went wrong while trying to create your wallet. Please try again.' - ) - } - }, - - async verifyIdentity(args) { + async updateProfile(args) { try { const response = await httpClient - .post('verify', { + .post('updateProfile', { json: args }) .json() return response } catch (error) { - return getError( + return getError( error, - 'Something went wrong while verifying your ID. Please try again.' + 'Something went wrong while updating your profile. Please try again.' ) } }, - async updateProfile(args) { + async changePassword(args) { try { const response = await httpClient - .post('updateProfile', { + .patch('change-password', { json: args }) .json() return response } catch (error) { - return getError( + return getError( error, - 'Something went wrong while updating your profile. Please try again.' + 'Something went wrong while changing your password. Please try again.' ) } }, - async getDocuments(cookies) { - try { - const response = await httpClient - .get('documents', { - headers: { - ...(cookies ? { Cookie: cookies } : {}) - } - }) - .json>() - return response?.result ?? [] - } catch (error) { - return [] - } - }, - - async getCountries(cookies) { - try { - const response = await httpClient - .get('countries', { - headers: { - ...(cookies ? { Cookie: cookies } : {}) - } - }) - .json>() - return response?.result ?? [] - } catch (error) { - return [] - } - }, - - async changePassword(args) { + async getBearerToken(args) { try { const response = await httpClient - .patch('change-password', { - json: args - }) - .json() + .get(`gatehub/token/${args.type}`) + .json() return response } catch (error) { - return getError( + return getError( error, - 'Something went wrong while changing your password. Please try again.' + // TODO: Better error message + 'Something went wrong. Please try again.' ) } } From af6c5e53770dd4177fb4b911dea5a0ff2bf3198c Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 10:43:15 +0300 Subject: [PATCH 02/14] Add standalone KYC page --- packages/wallet/frontend/src/pages/kyc.tsx | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/wallet/frontend/src/pages/kyc.tsx diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx new file mode 100644 index 000000000..28f2b5488 --- /dev/null +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -0,0 +1,48 @@ +import { HeaderLogo } from '@/components/HeaderLogo' +import AuthLayout from '@/components/layouts/AuthLayout' +import { userService } from '@/lib/api/user' +import { useDialog } from '@/lib/hooks/useDialog' +import { NextPageWithLayout } from '@/lib/types/app' +import { useRouter } from 'next/router' +import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' + +type KYCPageProps = InferGetServerSidePropsType< + typeof getServerSideProps +> + +const KYCPage: NextPageWithLayout = ({ + countries +}) => { + const [openDialog, closeDialog] = useDialog() + const router = useRouter() + + return ( + <> +

+ Personal Details +

+ + ) +} + +export const getServerSideProps: GetServerSideProps<{ + token: string +}> = async (ctx) => { + const countries = await userService.getCountries(ctx.req.headers.cookie) + return { + props: { + countries + } + } +} + +PersonalDetailsPage.getLayout = function (page) { + return ( + + + {page} + + ) +} + +export default PersonalDetailsPage From dad6d0106efb07a856d2387d086bced2d4c47143 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 10:43:28 +0300 Subject: [PATCH 03/14] Add TODO comment for settings page --- .../frontend/src/components/settings/PersonalSettingsForm.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/wallet/frontend/src/components/settings/PersonalSettingsForm.tsx b/packages/wallet/frontend/src/components/settings/PersonalSettingsForm.tsx index 2a5dd2612..3ebfe2936 100644 --- a/packages/wallet/frontend/src/components/settings/PersonalSettingsForm.tsx +++ b/packages/wallet/frontend/src/components/settings/PersonalSettingsForm.tsx @@ -15,6 +15,7 @@ type PersonalSettingsFormProps = { user: UserResponse } +// TODO: Can these details be updated by the user when switching to GateHub? export const PersonalSettingsForm = ({ user }: PersonalSettingsFormProps) => { const [isReadOnly, setIsReadOnly] = useState(true) const { isChangePassword, setIsChangePassword } = usePasswordContext() From 9e82fe1f357e7bc48d177fcfad4cfb080ba13857 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 10:58:30 +0300 Subject: [PATCH 04/14] Format; Update KYC Page; fix `getBearerToken` method --- packages/wallet/frontend/src/lib/api/user.ts | 13 ++++- .../src/pages/grant-interactions/index.tsx | 2 +- packages/wallet/frontend/src/pages/kyc.tsx | 56 ++++++++++++++----- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/packages/wallet/frontend/src/lib/api/user.ts b/packages/wallet/frontend/src/lib/api/user.ts index eb50b2467..c9d623910 100644 --- a/packages/wallet/frontend/src/lib/api/user.ts +++ b/packages/wallet/frontend/src/lib/api/user.ts @@ -210,7 +210,10 @@ interface UserService { resendVerifyEmail: ( args: ResendVerificationEmailArgs ) => Promise - getBearerToken: (args: GetBearerTokenArgs) => Promise + getBearerToken: ( + args: GetBearerTokenArgs, + cookies?: string + ) => Promise } const createUserService = (): UserService => ({ @@ -385,10 +388,14 @@ const createUserService = (): UserService => ({ } }, - async getBearerToken(args) { + async getBearerToken(args, cookies) { try { const response = await httpClient - .get(`gatehub/token/${args.type}`) + .get(`gatehub/token/${args.type}`, { + headers: { + ...(cookies ? { Cookie: cookies } : {}) + } + }) .json() return response } catch (error) { diff --git a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx index d54fe2b8f..f5cfc25d6 100644 --- a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx +++ b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx @@ -179,7 +179,7 @@ export const getServerSideProps: GetServerSideProps<{ if (access.limits) { access.limits.receiver = access.limits.receiver ? replaceWalletAddressProtocol(access.limits.receiver) - : (access.limits.receiver ?? null) + : access.limits.receiver ?? null if (access.limits.debitAmount) { access.limits.debitAmount.formattedAmount = formatAmount({ diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 28f2b5488..74745515b 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -1,42 +1,68 @@ import { HeaderLogo } from '@/components/HeaderLogo' import AuthLayout from '@/components/layouts/AuthLayout' import { userService } from '@/lib/api/user' -import { useDialog } from '@/lib/hooks/useDialog' import { NextPageWithLayout } from '@/lib/types/app' -import { useRouter } from 'next/router' import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' +import { useEffect } from 'react' -type KYCPageProps = InferGetServerSidePropsType< - typeof getServerSideProps -> +type KYCPageProps = InferGetServerSidePropsType -const KYCPage: NextPageWithLayout = ({ - countries -}) => { - const [openDialog, closeDialog] = useDialog() - const router = useRouter() +const KYCPage: NextPageWithLayout = ({ url }) => { + // const [openDialog, closeDialog] = useDialog() + // const router = useRouter() + + useEffect(() => { + const onKYCComplete = (e: MessageEvent) => { + // TODO: Handle the received message from iframe + // https://docs.gatehub.net/api-documentation/c3OPAp5dM191CDAdwyYS/gatehub-products/gatehub-onboarding#message-events + console.log('received message from iframe', { e }) + } + window.addEventListener('message', onKYCComplete, false) + + return () => { + window.removeEventListener('message', onKYCComplete) + } + }, []) return ( <>

Personal Details

+ {/* TODO: Styling */} + ) } export const getServerSideProps: GetServerSideProps<{ - token: string + url: string }> = async (ctx) => { - const countries = await userService.getCountries(ctx.req.headers.cookie) + const response = await userService.getBearerToken( + { type: 'onboarding' }, + ctx.req.headers.cookie + ) + + if (!response.success || !response.result) { + return { + notFound: true + } + } + return { props: { - countries + url: response.result.url } } } -PersonalDetailsPage.getLayout = function (page) { +KYCPage.getLayout = function (page) { return ( @@ -45,4 +71,4 @@ PersonalDetailsPage.getLayout = function (page) { ) } -export default PersonalDetailsPage +export default KYCPage From a7e19977f07351ce778d594bd25cad66348da8ae Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 10:59:16 +0300 Subject: [PATCH 05/14] Remove old KYC pages --- .../frontend/src/pages/kyc/personal.tsx | 170 ---------- .../wallet/frontend/src/pages/kyc/proof.tsx | 299 ------------------ 2 files changed, 469 deletions(-) delete mode 100644 packages/wallet/frontend/src/pages/kyc/personal.tsx delete mode 100644 packages/wallet/frontend/src/pages/kyc/proof.tsx diff --git a/packages/wallet/frontend/src/pages/kyc/personal.tsx b/packages/wallet/frontend/src/pages/kyc/personal.tsx deleted file mode 100644 index f7b0c09a6..000000000 --- a/packages/wallet/frontend/src/pages/kyc/personal.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import { HeaderLogo } from '@/components/HeaderLogo' -import { SuccessDialog } from '@/components/dialogs/SuccessDialog' -import AuthLayout from '@/components/layouts/AuthLayout' -import { personalDetailsSchema, userService } from '@/lib/api/user' -import { useDialog } from '@/lib/hooks/useDialog' -import { useZodForm } from '@/lib/hooks/useZodForm' -import { NextPageWithLayout } from '@/lib/types/app' -import { Button } from '@/ui/Button' -import { Form } from '@/ui/forms/Form' -import { Input } from '@/ui/forms/Input' -import { Select, SelectOption } from '@/ui/forms/Select' -import { USE_TEST_DATA_KYC } from '@/utils/constants' -import { getObjectKeys } from '@/utils/helpers' -import { useRouter } from 'next/router' -import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' -import { Controller } from 'react-hook-form' - -type PersonalDetailsProps = InferGetServerSidePropsType< - typeof getServerSideProps -> - -const PersonalDetailsPage: NextPageWithLayout = ({ - countries -}) => { - const [openDialog, closeDialog] = useDialog() - const router = useRouter() - - const defaultTestValues = { - city: 'Copenhagen', - address: 'Den Lille Havfrue', - zip: '2100', - country: { - value: 'DK', - label: 'Denmark' - } - } - - const personalDetailsForm = useZodForm({ - schema: personalDetailsSchema, - defaultValues: { ...(USE_TEST_DATA_KYC ? defaultTestValues : {}) } - }) - - return ( - <> -

- Personal Details -

- {USE_TEST_DATA_KYC && ( - - Denmark is selected by default for testing purposes! - - )} -
{ - const response = await userService.createWallet(data) - - if (response.success) { - openDialog( - { - router.push('/kyc/proof') - closeDialog() - }} - content="Your wallet was created." - redirect="/kyc/proof" - redirectText="Verify your identity" - /> - ) - } else { - const { errors, message } = response - personalDetailsForm.setError('root', { message }) - - if (errors) { - getObjectKeys(errors).map((field) => - personalDetailsForm.setError(field, { message: errors[field] }) - ) - } - } - }} - > -
- - -
- ( - - required - label="Country" - placeholder="Select country..." - options={countries} - value={value} - isDisabled={USE_TEST_DATA_KYC} - error={personalDetailsForm.formState.errors.country?.message} - onChange={(option) => { - if (option) { - personalDetailsForm.setValue('country', { ...option }) - } - }} - /> - )} - /> - - - - - - - ) -} - -export const getServerSideProps: GetServerSideProps<{ - countries: SelectOption[] -}> = async (ctx) => { - const countries = await userService.getCountries(ctx.req.headers.cookie) - return { - props: { - countries - } - } -} - -PersonalDetailsPage.getLayout = function (page) { - return ( - - - {page} - - ) -} - -export default PersonalDetailsPage diff --git a/packages/wallet/frontend/src/pages/kyc/proof.tsx b/packages/wallet/frontend/src/pages/kyc/proof.tsx deleted file mode 100644 index dd2a4c492..000000000 --- a/packages/wallet/frontend/src/pages/kyc/proof.tsx +++ /dev/null @@ -1,299 +0,0 @@ -import { HeaderLogo } from '@/components/HeaderLogo' -import { SuccessDialog } from '@/components/dialogs/SuccessDialog' -import AuthLayout from '@/components/layouts/AuthLayout' -import { - userService, - verifyIdentitySchema, - type Document -} from '@/lib/api/user' -import { useDialog } from '@/lib/hooks/useDialog' -import { useZodForm } from '@/lib/hooks/useZodForm' -import { NextPageWithLayout } from '@/lib/types/app' -import { Button } from '@/ui/Button' -import { FieldError } from '@/ui/forms/FieldError' -import { FileUpload } from '@/ui/forms/FileUpload' -import { Form } from '@/ui/forms/Form' -import { USE_TEST_DATA_KYC } from '@/utils/constants' -import { getObjectKeys } from '@/utils/helpers' -import { testImageVerifyIdentity, testImageType } from '@/utils/mocks' -import { cx } from 'class-variance-authority' -import { useRouter } from 'next/router' -import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' -import { useState, SyntheticEvent } from 'react' - -type IDVerificationPage = InferGetServerSidePropsType - -const IDVerificationPage: NextPageWithLayout = ({ - documents -}) => { - const [openDialog, closeDialog] = useDialog() - const [isBackRequired, setIsBackRequired] = useState(false) - const router = useRouter() - - const handleFileOnChange = (event: SyntheticEvent) => { - const reader = new FileReader() - const target = event.currentTarget - if (target.files && target.files.length > 0) { - const file = target.files[0] - reader.readAsDataURL(file) - reader.onloadend = () => { - let fileBase64 = reader.result?.toString() || '' - fileBase64 = fileBase64.slice(fileBase64.indexOf('base64') + 7) - if (target.name === 'faceImageUpload') { - verifyIdentityForm.setValue('faceImage', fileBase64) - verifyIdentityForm.setValue('faceImageType', file.type) - verifyIdentityForm.trigger('faceImage') - } else if (target.name === 'frontSideIDUpload') { - verifyIdentityForm.setValue('frontSideImage', fileBase64) - verifyIdentityForm.setValue('frontSideImageType', file.type) - verifyIdentityForm.trigger('frontSideImage') - } else { - verifyIdentityForm.setValue('backSideImage', fileBase64) - verifyIdentityForm.setValue('backSideImageType', file.type) - verifyIdentityForm.trigger('backSideImage') - } - } - } - } - - const handleDocumentChange = (event: SyntheticEvent) => { - const target = event.currentTarget - setIsBackRequired(target.getAttribute('data-back-id') === 'true') - if (!isBackRequired) { - verifyIdentityForm.setValue('backSideImage', '') - verifyIdentityForm.setValue('backSideImageType', '') - verifyIdentityForm.trigger('backSideImage') - } - } - - const verifyIdentityForm = useZodForm({ - schema: verifyIdentitySchema, - defaultValues: { - ...(USE_TEST_DATA_KYC ? { documentType: 'PA' } : {}) - } - }) - - return ( - <> - {USE_TEST_DATA_KYC && ( -

- For testing purposes Passport is selected, and images uploaded by - default! -

- )} - -
{ - const response = await userService.verifyIdentity(data) - - if (response.success) { - openDialog( - { - router.reload() - closeDialog() - }} - onSuccess={() => { - window.localStorage.setItem( - 'isUserFirstTimeOnTestnet', - 'true' - ) - router.reload() - }} - content="Your identity has been verified." - redirectText="Go to your account overview" - /> - ) - } else { - const { errors, message } = response - verifyIdentityForm.setError('root', { message }) - - if (errors) { - getObjectKeys(errors).map((field) => - verifyIdentityForm.setError(field, { message: errors[field] }) - ) - } - } - }} - > -
-
- {documents.map((document) => ( -
- Use Passport as default value - value={USE_TEST_DATA_KYC ? 'PA' : document.type} - data-back-id={document.isBackRequired} - {...verifyIdentityForm.register('documentType', { - onChange: handleDocumentChange - })} - /> - -
- ))} -
- -
-
-
- <> - - - - -
-
- <> - - - - -
-
- {isBackRequired && ( - <> - - - - - )} -
-
- - - - ) -} - -export const getServerSideProps: GetServerSideProps<{ - documents: Document[] -}> = async (ctx) => { - const documents = await userService.getDocuments(ctx.req.headers.cookie) - return { - props: { - documents - } - } -} - -IDVerificationPage.getLayout = function (page) { - return ( - - - {page} - - ) -} - -export default IDVerificationPage From 1b42827957d00165d97ed103ac8aacfaaeceb2b7 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 11:00:27 +0300 Subject: [PATCH 06/14] Format with latest prettier --- packages/wallet/frontend/src/pages/grant-interactions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx index f5cfc25d6..d54fe2b8f 100644 --- a/packages/wallet/frontend/src/pages/grant-interactions/index.tsx +++ b/packages/wallet/frontend/src/pages/grant-interactions/index.tsx @@ -179,7 +179,7 @@ export const getServerSideProps: GetServerSideProps<{ if (access.limits) { access.limits.receiver = access.limits.receiver ? replaceWalletAddressProtocol(access.limits.receiver) - : access.limits.receiver ?? null + : (access.limits.receiver ?? null) if (access.limits.debitAmount) { access.limits.debitAmount.formattedAmount = formatAmount({ From d8b2bb3b484df9556ba62ae284fc846e086ce0f4 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 14:14:12 +0300 Subject: [PATCH 07/14] Remove Rapyd env/constants --- docker/prod/docker-compose.yml | 1 - packages/wallet/frontend/src/utils/constants.ts | 7 ------- 2 files changed, 8 deletions(-) diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index e1f76bc27..1bd2814eb 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -27,7 +27,6 @@ services: args: PORT: ${WALLET_FRONTEND_PORT} COOKIE_NAME: ${WALLET_BACKEND_COOKIE_NAME} - NEXT_PUBLIC_USE_TEST_KYC_DATA: ${WALLET_FRONTEND_USE_TEST_KYC_DATA} NEXT_PUBLIC_BACKEND_URL: ${WALLET_FRONTEND_BACKEND_URL} NEXT_PUBLIC_OPEN_PAYMENTS_HOST: ${WALLET_FRONTEND_OPEN_PAYMENTS_HOST} NEXT_PUBLIC_AUTH_HOST: ${WALLET_FRONTEND_AUTH_HOST} diff --git a/packages/wallet/frontend/src/utils/constants.ts b/packages/wallet/frontend/src/utils/constants.ts index f04c58c8e..dd3e9d1e8 100644 --- a/packages/wallet/frontend/src/utils/constants.ts +++ b/packages/wallet/frontend/src/utils/constants.ts @@ -1,10 +1,3 @@ -/** - * Default values for countries and documents - */ -export const USE_TEST_DATA_KYC = - process.env.NEXT_PUBLIC_USE_TEST_KYC_DATA === 'true' -export const ACCEPTED_IMAGE_TYPES = ['image/jpeg', 'image/png'] - export const OPEN_PAYMENTS_HOST = process.env.NEXT_PUBLIC_OPEN_PAYMENTS_HOST /** From fbaf6dc2bf638f15c0a69d8b1625cf07411ee926 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 15:12:55 +0300 Subject: [PATCH 08/14] Remove Rapyd mocks --- packages/wallet/frontend/src/utils/mocks.ts | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 packages/wallet/frontend/src/utils/mocks.ts diff --git a/packages/wallet/frontend/src/utils/mocks.ts b/packages/wallet/frontend/src/utils/mocks.ts deleted file mode 100644 index 3c03a5341..000000000 --- a/packages/wallet/frontend/src/utils/mocks.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const testImageType = 'image/jpeg' -export const testImageVerifyIdentity = - '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMSEhUSEhIVFhUXGBoVGRgYGBcXFxcYFxcWFxcXFxgYHSggGB0lGxcYITEhJSkrLi4uGB81ODMtNygtLi0BCgoKDg0OGxAQGy0lHyUtLS0tLS0tLS0tKy0tLi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLf/AABEIALIBGwMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAAGAAECBAUDBwj/xABGEAACAQIDBgMECAMFBwQDAAABAgMAEQQSIQUGEyIxQVFhcSMygZEUM0JScqGxwaLR8AcVFmKCJJKTwtLh8UNTc+I0RGP/xAAaAQACAwEBAAAAAAAAAAAAAAABAgADBAUG/8QAMhEAAgIBAwICCQQBBQAAAAAAAAECEQMSITEEQVFxBRMyYYGRodHwFCKxweEjM1JTov/aAAwDAQACEQMRAD8A9UpqbNVbaONEUZkIuAVza2yqzqrN/pBLfCriktUxoZffBVTO8WWxUEFwCLmVmHTqIow9u/EVepvW5jp2VC0ahyBcLmy5vQ2PagpJgssUqB/8dkxNKMOSqsEI4guLi4JGXodR6irMO97tGJBh7hpBClpPfY3uV5egINz5HwoLJF8AUkwvvSoc/wAToMWuFI1K6tfo5GbIRb7ve/cV02zvBwZY4I04ksmoBbIoGurNY2906AHpR1olo36VC2K3nkiieV8OQY5OG4z9yEKshy86nMNbCoT71smGTEmDkc9OILgH3T7vfX0oPJEmpBZSvQbjt82iiimfD8sq5ltICbWBF+XwIqe0N8Th5VjngK3AYlXzWBJHTKL2IOnlUeSKA5IMKasGXbxE8cSxhkkUyLIHFsi5cxtb/MO+tVMNvO+IdlwkHEVPekd+GnkFsrE/L9qOtBtBTelQzJvBN7MLhXLszqyk5QnDtds9iCDcWPftVDC75ySoXjwpIV0Q897ZyBewW9tetTWiakGtKhjD7zNPI8eGhEgj952fhrfXRbKxbofAael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ZD4dmZ5eJmihj90rYwhwSNToQw08je5N63KYrSAqA7jmlpSpiaIR8tPlplNOxtQJQI4XdOWMkRYto7mR+VcoLvGiIzgMA4Vkza6kGxPcvtjdEzTCTjsLQpDZhnJMbh+IWJ97rY/eObqAQTFyb26jt41QbGXcaEW0NIxzI2xsEySpLxiGDxsSyhmJi4moGiA2ew5bDU2uaxdqbmtO7OZwCTMTaMANxI1TnFwL8t2a2tyNBpRlJPfr0veuUpUi51NtD+3hVbHRg7C2V9GzjiZ82U3tbVVC3bxJ8fAKOgArQaRr6Hz0uOuvjTAC/9f0KRnt978qUdG24974/vVRjpf0pUqpXIg0nQ+h/WtDZppUqeBFyaNNSpVeMMDTU1KmQjIjvUaVKmQrE1JaVKoAZqQpUqIBjUlpUqgR36CkKVKgF8jUx/r86alRAMhpUqVQAqcf186VKoERNPTUqCAM1RvSpUxCa0iaalSDHHCn9P3qhj+h9T+gpUqR8DooX0v6ftXRhyn0/elSpBjko5b+v7U4NKlSsh/9k=' From f4db23a46028834088a410db575f2c8147f55685 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Wed, 4 Sep 2024 15:28:05 +0300 Subject: [PATCH 09/14] Better naming --- packages/wallet/frontend/src/lib/api/user.ts | 26 +++++++++++--------- packages/wallet/frontend/src/pages/kyc.tsx | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/wallet/frontend/src/lib/api/user.ts b/packages/wallet/frontend/src/lib/api/user.ts index c9d623910..4cb2d2828 100644 --- a/packages/wallet/frontend/src/lib/api/user.ts +++ b/packages/wallet/frontend/src/lib/api/user.ts @@ -143,7 +143,7 @@ export const changePasswordSchema = z } }) -const getBearerTokenSchema = z.object({ +const getIframeSrcSchema = z.object({ type: z.enum(['onboarding', 'ramp']) }) @@ -191,10 +191,14 @@ type ChangePasswordArgs = z.infer type ChangePasswordError = ErrorResponse type ChangePasswordResponse = SuccessResponse | ChangePasswordError -type GetBearerTokenArgs = z.infer -type GetBearerTokenResult = SuccessResponse<{ url: string }> -type GetBearerTokenError = ErrorResponse -type GetBearerTokenResponse = GetBearerTokenResult | GetBearerTokenError +type GetGateHubIframeSrcArgs = z.infer +type GetGateHubIframeSrcResult = SuccessResponse<{ url: string }> +type GetGateHubIframeSrcError = ErrorResponse< + GetGateHubIframeSrcArgs | undefined +> +type GetGateHubIframeSrcResponse = + | GetGateHubIframeSrcResult + | GetGateHubIframeSrcError interface UserService { signUp: (args: SignUpArgs) => Promise @@ -210,10 +214,10 @@ interface UserService { resendVerifyEmail: ( args: ResendVerificationEmailArgs ) => Promise - getBearerToken: ( - args: GetBearerTokenArgs, + getGateHubIframeSrc: ( + args: GetGateHubIframeSrcArgs, cookies?: string - ) => Promise + ) => Promise } const createUserService = (): UserService => ({ @@ -388,7 +392,7 @@ const createUserService = (): UserService => ({ } }, - async getBearerToken(args, cookies) { + async getGateHubIframeSrc(args, cookies) { try { const response = await httpClient .get(`gatehub/token/${args.type}`, { @@ -396,10 +400,10 @@ const createUserService = (): UserService => ({ ...(cookies ? { Cookie: cookies } : {}) } }) - .json() + .json() return response } catch (error) { - return getError( + return getError( error, // TODO: Better error message 'Something went wrong. Please try again.' diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 74745515b..1d5909f43 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -44,7 +44,7 @@ const KYCPage: NextPageWithLayout = ({ url }) => { export const getServerSideProps: GetServerSideProps<{ url: string }> = async (ctx) => { - const response = await userService.getBearerToken( + const response = await userService.getGateHubIframeSrc( { type: 'onboarding' }, ctx.req.headers.cookie ) From 42f8a86f3a2e784fd469f8ac3a37504a03396062 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Mon, 16 Sep 2024 08:29:40 +0300 Subject: [PATCH 10/14] Progress --- packages/wallet/backend/src/app.ts | 8 +++++++ packages/wallet/frontend/src/lib/api/user.ts | 23 ++++++-------------- packages/wallet/frontend/src/middleware.ts | 15 +++++++------ packages/wallet/frontend/src/pages/kyc.tsx | 3 ++- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/wallet/backend/src/app.ts b/packages/wallet/backend/src/app.ts index 8477cfc44..944b7c7f9 100644 --- a/packages/wallet/backend/src/app.ts +++ b/packages/wallet/backend/src/app.ts @@ -95,6 +95,14 @@ export class App { const knex = await this.container.resolve('knex') const socketService = await this.container.resolve('socketService') + logger.debug( + JSON.stringify( + { gh0: env.GATEHUB_ACCESS_KEY, gh1: env.GATEHUB_SECRET_KEY }, + null, + 2 + ) + ) + await knex.migrate.latest({ directory: __dirname + '/../migrations' }) diff --git a/packages/wallet/frontend/src/lib/api/user.ts b/packages/wallet/frontend/src/lib/api/user.ts index 4cb2d2828..bc6c3198f 100644 --- a/packages/wallet/frontend/src/lib/api/user.ts +++ b/packages/wallet/frontend/src/lib/api/user.ts @@ -7,6 +7,7 @@ import { } from '../httpClient' import { UserResponse, ValidTokenResponse } from '@wallet/shared' import { emailSchema } from '@wallet/shared/src' +import { IFRAME_TYPE, IframeResponse } from '@wallet/shared' const isValidPassword = (password: string): boolean => { if (typeof password !== 'string') return false @@ -143,10 +144,6 @@ export const changePasswordSchema = z } }) -const getIframeSrcSchema = z.object({ - type: z.enum(['onboarding', 'ramp']) -}) - type SignUpArgs = z.infer type SignUpError = ErrorResponse type SignUpResponse = SuccessResponse | SignUpError @@ -191,14 +188,8 @@ type ChangePasswordArgs = z.infer type ChangePasswordError = ErrorResponse type ChangePasswordResponse = SuccessResponse | ChangePasswordError -type GetGateHubIframeSrcArgs = z.infer -type GetGateHubIframeSrcResult = SuccessResponse<{ url: string }> -type GetGateHubIframeSrcError = ErrorResponse< - GetGateHubIframeSrcArgs | undefined -> -type GetGateHubIframeSrcResponse = - | GetGateHubIframeSrcResult - | GetGateHubIframeSrcError +type GetGateHubIframeSrcResult = SuccessResponse +type GetGateHubIframeSrcResponse = GetGateHubIframeSrcResult | ErrorResponse interface UserService { signUp: (args: SignUpArgs) => Promise @@ -215,7 +206,7 @@ interface UserService { args: ResendVerificationEmailArgs ) => Promise getGateHubIframeSrc: ( - args: GetGateHubIframeSrcArgs, + type: IFRAME_TYPE, cookies?: string ) => Promise } @@ -392,10 +383,10 @@ const createUserService = (): UserService => ({ } }, - async getGateHubIframeSrc(args, cookies) { + async getGateHubIframeSrc(type, cookies) { try { const response = await httpClient - .get(`gatehub/token/${args.type}`, { + .get(`iframe-urls/${type}`, { headers: { ...(cookies ? { Cookie: cookies } : {}) } @@ -403,7 +394,7 @@ const createUserService = (): UserService => ({ .json() return response } catch (error) { - return getError( + return getError( error, // TODO: Better error message 'Something went wrong. Please try again.' diff --git a/packages/wallet/frontend/src/middleware.ts b/packages/wallet/frontend/src/middleware.ts index 0dca53418..76c5e6839 100644 --- a/packages/wallet/frontend/src/middleware.ts +++ b/packages/wallet/frontend/src/middleware.ts @@ -19,6 +19,7 @@ export async function middleware(req: NextRequest) { `${cookieName}=${req.cookies.get(cookieName)?.value}` ) + // TODO: Update middleware as well // Success TRUE - the user is logged in if (response.success) { // If the user is logged in and has not completed KYC, redirect to KYC page. @@ -41,13 +42,13 @@ export async function middleware(req: NextRequest) { // If KYC is completed and the user tries to navigate to the page, redirect // to homepage. - if ( - !response.result?.needsIDProof && - !response.result?.needsWallet && - req.nextUrl.pathname.startsWith('/kyc') - ) { - return NextResponse.redirect(new URL('/', req.url)) - } + // if ( + // !response.result?.needsIDProof && + // !response.result?.needsWallet && + // req.nextUrl.pathname.startsWith('/kyc') + // ) { + // return NextResponse.redirect(new URL('/', req.url)) + // } if (isPublic) { return NextResponse.redirect(new URL('/', req.url)) diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 1d5909f43..642887d4e 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -45,9 +45,10 @@ export const getServerSideProps: GetServerSideProps<{ url: string }> = async (ctx) => { const response = await userService.getGateHubIframeSrc( - { type: 'onboarding' }, + 'onboarding', ctx.req.headers.cookie ) + console.log(response) if (!response.success || !response.result) { return { From 260badf7f3ff4d3e2db05c9a041a719cf76dfee2 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Mon, 16 Sep 2024 11:13:34 +0300 Subject: [PATCH 11/14] Remove debug log --- packages/wallet/backend/src/app.ts | 8 -------- packages/wallet/frontend/src/pages/kyc.tsx | 1 - 2 files changed, 9 deletions(-) diff --git a/packages/wallet/backend/src/app.ts b/packages/wallet/backend/src/app.ts index 944b7c7f9..8477cfc44 100644 --- a/packages/wallet/backend/src/app.ts +++ b/packages/wallet/backend/src/app.ts @@ -95,14 +95,6 @@ export class App { const knex = await this.container.resolve('knex') const socketService = await this.container.resolve('socketService') - logger.debug( - JSON.stringify( - { gh0: env.GATEHUB_ACCESS_KEY, gh1: env.GATEHUB_SECRET_KEY }, - null, - 2 - ) - ) - await knex.migrate.latest({ directory: __dirname + '/../migrations' }) diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 642887d4e..027889e00 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -48,7 +48,6 @@ export const getServerSideProps: GetServerSideProps<{ 'onboarding', ctx.req.headers.cookie ) - console.log(response) if (!response.success || !response.result) { return { From 5ed5aee83522d973fe574406d1c1e5525853b8cf Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Mon, 16 Sep 2024 11:16:56 +0300 Subject: [PATCH 12/14] Undo middleware changes --- packages/wallet/frontend/src/middleware.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/wallet/frontend/src/middleware.ts b/packages/wallet/frontend/src/middleware.ts index 76c5e6839..8ec1785fc 100644 --- a/packages/wallet/frontend/src/middleware.ts +++ b/packages/wallet/frontend/src/middleware.ts @@ -10,6 +10,9 @@ const isPublicPath = (path: string) => { const publicPaths = ['/auth*'] +// TODO: Update middleware for the new KYC +// We might want to showcase the users that the identity verification is in +// progress and probably do not let them perform any action (sending money, etc). export async function middleware(req: NextRequest) { const isPublic = isPublicPath(req.nextUrl.pathname) const nextPage = req.nextUrl.searchParams.get('next') @@ -19,7 +22,6 @@ export async function middleware(req: NextRequest) { `${cookieName}=${req.cookies.get(cookieName)?.value}` ) - // TODO: Update middleware as well // Success TRUE - the user is logged in if (response.success) { // If the user is logged in and has not completed KYC, redirect to KYC page. From 2798e65aae60a9087c105d084cb3d6f8be0a2c81 Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Mon, 16 Sep 2024 11:24:07 +0300 Subject: [PATCH 13/14] Add window message types --- packages/wallet/frontend/src/pages/kyc.tsx | 42 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 027889e00..38a3562ff 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -2,25 +2,57 @@ import { HeaderLogo } from '@/components/HeaderLogo' import AuthLayout from '@/components/layouts/AuthLayout' import { userService } from '@/lib/api/user' import { NextPageWithLayout } from '@/lib/types/app' +import { GateHubMessageType, MessageError } from '@/lib/types/windowMessages' import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' import { useEffect } from 'react' type KYCPageProps = InferGetServerSidePropsType +type MessageData = + | { + type: GateHubMessageType.OnboardingCompleted + value: 'submitted' | 'resubmitted' + } + | { type: GateHubMessageType.OnboardingError; value: MessageError } + | { type: GateHubMessageType.OnboardingInitialized } + const KYCPage: NextPageWithLayout = ({ url }) => { // const [openDialog, closeDialog] = useDialog() // const router = useRouter() useEffect(() => { - const onKYCComplete = (e: MessageEvent) => { - // TODO: Handle the received message from iframe - // https://docs.gatehub.net/api-documentation/c3OPAp5dM191CDAdwyYS/gatehub-products/gatehub-onboarding#message-events + // TODO: Handle the received message from iframe + // https://docs.gatehub.net/api-documentation/c3OPAp5dM191CDAdwyYS/gatehub-products/gatehub-onboarding#message-events + const onMessage = (e: MessageEvent) => { console.log('received message from iframe', { e }) + switch (e.data.type) { + case GateHubMessageType.OnboardingCompleted: + console.log( + 'received message from iframe', + GateHubMessageType.OnboardingCompleted, + JSON.stringify(e.data, null, 2) + ) + break + case GateHubMessageType.OnboardingError: + console.log( + 'received message from iframe', + GateHubMessageType.OnboardingError, + JSON.stringify(e.data, null, 2) + ) + break + case GateHubMessageType.OnboardingInitialized: + console.log( + 'received message from iframe', + GateHubMessageType.OnboardingInitialized, + JSON.stringify(e.data, null, 2) + ) + break + } } - window.addEventListener('message', onKYCComplete, false) + window.addEventListener('message', onMessage, false) return () => { - window.removeEventListener('message', onKYCComplete) + window.removeEventListener('message', onMessage) } }, []) From 9c4c0222c51236aea785eb02d7418da8673bfd9e Mon Sep 17 00:00:00 2001 From: Radu-Cristian Popa Date: Mon, 16 Sep 2024 12:34:47 +0300 Subject: [PATCH 14/14] Fix import --- packages/wallet/frontend/src/pages/kyc.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/wallet/frontend/src/pages/kyc.tsx b/packages/wallet/frontend/src/pages/kyc.tsx index 38a3562ff..55e0952fc 100644 --- a/packages/wallet/frontend/src/pages/kyc.tsx +++ b/packages/wallet/frontend/src/pages/kyc.tsx @@ -2,7 +2,10 @@ import { HeaderLogo } from '@/components/HeaderLogo' import AuthLayout from '@/components/layouts/AuthLayout' import { userService } from '@/lib/api/user' import { NextPageWithLayout } from '@/lib/types/app' -import { GateHubMessageType, MessageError } from '@/lib/types/windowMessages' +import { + GateHubMessageType, + type GateHubMessageError +} from '@/lib/types/windowMessages' import { GetServerSideProps, InferGetServerSidePropsType } from 'next/types' import { useEffect } from 'react' @@ -13,7 +16,7 @@ type MessageData = type: GateHubMessageType.OnboardingCompleted value: 'submitted' | 'resubmitted' } - | { type: GateHubMessageType.OnboardingError; value: MessageError } + | { type: GateHubMessageType.OnboardingError; value: GateHubMessageError } | { type: GateHubMessageType.OnboardingInitialized } const KYCPage: NextPageWithLayout = ({ url }) => {