# Module: web

# Enumerations

# Interfaces

# Type aliases

# CustomerDTO

Ƭ CustomerDTO: { email: string ; fields: TenantFieldValuesDTO ; id: string ; roles: string[] } & Pick<VYouAuthDTO, "tenant_compliant">

The customer DTO


# PrivacyChecksDTO

Ƭ PrivacyChecksDTO: Object

# Type declaration

Name Type Description
info_accepted boolean -
privacy_accepted boolean Privacy accepted
terms_conditions_accepted boolean -

# RememberPasswordParams

Ƭ RememberPasswordParams: Object

# Type declaration

Name Type
email string

# SetPasswordParams

Ƭ SetPasswordParams: Object

# Type declaration

Name Type
matchingPassword string
password string
token string
username string

# SignInBody

Ƭ SignInBody: Object

# Type declaration

Name Type
password string
username string

# SignUpBody

Ƭ SignUpBody: { email: string ; roles?: string[] } & PrivacyChecksDTO


# TenantDTO

Ƭ TenantDTO: Object

# Type declaration

Name Type
admin string
allowed_roles string[]
contact string
created_at string
fields TenantFieldDTO[]
id string
imageUrl? string | null
name string

# TenantFieldDTO

Ƭ TenantFieldDTO: Object

# Type declaration

Name Type
name string
order number
readonly boolean
required boolean
type "string" | "number" | "email" | "date"

# TenantFieldValuesDTO

Ƭ TenantFieldValuesDTO: Record<string, string | number>


# UpdateMyProfileBody

Ƭ UpdateMyProfileBody: Record<keyof CustomerDTO["fields"], any>


# VYouAuthDTO

Ƭ VYouAuthDTO: Object

# Type declaration

Name Type Description
access_token string -
email string -
expires_in number -
id_token string -
refresh_token string -
scope string -
tenant_compliant boolean When false, needs complete profile
tenant_consent_compliant boolean When false, missing legal checkboxes
tenant_role string[] -
token_type string -

# VYouConfiguration

Ƭ VYouConfiguration: Object

# Type declaration

Name Type Description
baseUrl string -
clientId string -
customerFields Record<string, Omit<TenantFieldDTO, "name" | "order">> -
facebook? VYouFacebookConfiguration Facebook auth related information.
google? VYouGoogleConfiguration Google auth related information.
stripe? VYouStripeConfiguration Stripe related information.

# VYouErrorWithValidation

Ƭ VYouErrorWithValidation<T>: VYouError & { validation?: VYouValidationSpec<T> }

# Type parameters

Name Type
T extends object

# VYouFacebookConfiguration

Ƭ VYouFacebookConfiguration: Object

# Type declaration

Name Type
appId string

# VYouGoogleConfiguration

Ƭ VYouGoogleConfiguration: Object

# Type declaration

Name Type
clientId string

# VYouResponse

Ƭ VYouResponse<Response>: Object

# Type parameters

Name
Response

# Type declaration

Name Type
data Response
error false

# VYouServiceFetchRequestOptions

Ƭ VYouServiceFetchRequestOptions: Object

# Type declaration

Name Type Description
addVYouTenantUrl? boolean If false, you can use absolute URLs. true by default, so the base URL is added automatically on your behalf.
body? object -
headers? { [key: string]: string; } -
method? "get" | "GET" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "purge" | "PURGE" | "link" | "LINK" | "unlink" | "UNLINK" -
url string -

# VYouSession

Ƭ VYouSession<T>: { signedIn: false } | { signedIn: null } | VYouSignedSession<T>

# Type parameters

Name Type
T any

# VYouSignedSession

Ƭ VYouSignedSession<T>: { data?: T ; signedIn: true } & Pick<VYouAuthDTO, "tenant_compliant" | "tenant_role">

# Type parameters

Name Type
T any

# VYouStripeConfiguration

Ƭ VYouStripeConfiguration: Object

# Type declaration

Name Type
publishableKey string

# VYouValidationRules

Ƭ VYouValidationRules: Partial<Record<VYouValidationType, boolean>>


# VYouValidationSpec

Ƭ VYouValidationSpec<T>: Partial<Record<keyof T, VYouValidationRules>>

# Type parameters

Name Type
T extends object

# VYouValidationType

Ƭ VYouValidationType: "isRequired" | "isNumber" | "isEmail" | "isDate" | "isTrue" | "isLongEnoughPassword" | "isFairEnoughPassword" | "isMatchingPassword"


# VerifyPasswordTokenParams

Ƭ VerifyPasswordTokenParams: Object

# Type declaration

Name Type
token string

# VerifyPasswordTokenResponse

Ƭ VerifyPasswordTokenResponse: Object

# Type declaration

Name Type
email string

# Functions

# fetchRequest

fetchRequest<Response>(options): Promise<VYouResponse<Response> | VYouError>

Makes an API request without all the security overhead (tokens, XSRF, etc.), which is handled by this method.

# Type parameters

Name
Response

# Parameters

Name Type Description
options VYouServiceFetchRequestOptions Request options.

# Returns

Promise<VYouResponse<Response> | VYouError>


# getConfiguration

getConfiguration(): VYouConfiguration

# Returns

VYouConfiguration


# getMyProfile

getMyProfile(): Promise<VYouError | VYouResponse<CustomerDTO>>

Fetches current signed customer data.

# Returns

Promise<VYouError | VYouResponse<CustomerDTO>>


# getSession

getSession(): VYouSession<any>

# Returns

VYouSession<any>


# getSessionData

getSessionData<T>(): undefined | T

# Type parameters

Name Type
T any

# Returns

undefined | T


# getTenantInfo

getTenantInfo(): Promise<VYouError | VYouResponse<TenantDTO>>

Fetches the tenant data.

# Returns

Promise<VYouError | VYouResponse<TenantDTO>>


# rememberPassword

rememberPassword(params): Promise<VYouResponse<void> | VYouErrorWithValidation<RememberPasswordParams>>

# Parameters

Name Type
params RememberPasswordParams

# Returns

Promise<VYouResponse<void> | VYouErrorWithValidation<RememberPasswordParams>>


# setConfiguration

setConfiguration(configuration): void

# Parameters

Name Type
configuration VYouConfiguration

# Returns

void


# setPassword

setPassword(params): Promise<VYouResponse<void> | VYouErrorWithValidation<SetPasswordParams>>

# Parameters

Name Type
params SetPasswordParams

# Returns

Promise<VYouResponse<void> | VYouErrorWithValidation<SetPasswordParams>>


# setSession

setSession(session): void

# Parameters

Name Type
session VYouSession<any>

# Returns

void


# setSessionData

setSessionData<T>(data): void

# Type parameters

Name Type
T extends object = {}

# Parameters

Name Type
data T

# Returns

void


# signIn

signIn(params): Promise<VYouResponse<VYouAuthDTO> | VYouErrorWithValidation<SignInBody>>

# Parameters

Name Type
params SignInBody

# Returns

Promise<VYouResponse<VYouAuthDTO> | VYouErrorWithValidation<SignInBody>>


# signOut

signOut(force?): Promise<VYouError | VYouResponse<void>>

# Parameters

Name Type
force? boolean

# Returns

Promise<VYouError | VYouResponse<void>>


# signUp

signUp(body): Promise<VYouResponse<void> | VYouErrorWithValidation<SignUpBody>>

# Parameters

Name Type
body SignUpBody

# Returns

Promise<VYouResponse<void> | VYouErrorWithValidation<SignUpBody>>


# updateMyProfile

updateMyProfile(body): Promise<VYouResponse<CustomerDTO> | VYouErrorWithValidation<UpdateMyProfileBody>>

Updates current signed customer data.

# Parameters

Name Type
body UpdateMyProfileBody

# Returns

Promise<VYouResponse<CustomerDTO> | VYouErrorWithValidation<UpdateMyProfileBody>>


# validatePasswordStrength

validatePasswordStrength(password): number

# Parameters

Name Type
password any

# Returns

number


# verifyPasswordToken

verifyPasswordToken(params): Promise<VYouError | VYouResponse<VerifyPasswordTokenResponse>>

# Parameters

Name Type
params VerifyPasswordTokenParams

# Returns

Promise<VYouError | VYouResponse<VerifyPasswordTokenResponse>>