@vulog/aima-user
Version:
252 lines (233 loc) • 11.2 kB
TypeScript
import { Client } from '@vulog/aima-client';
import { Service } from '@vulog/aima-config';
import { z } from 'zod';
import { PatchAction } from '@vulog/aima-core';
declare const acceptTAndC: (client: Client, userId: string, cityId: string) => Promise<void>;
declare const assignBillingGroup: (client: Client, entityId: string, billingGroupId: string) => Promise<void>;
type Address = {
streetName?: string;
city?: string;
postalCode?: string;
region?: string;
country?: string;
number?: string;
addressAdditionalInformation?: string;
};
type IndividualBusiness = Address & {
companyName: string;
vat?: string;
};
type UserAgreement = {
cityId: string;
date: string;
hasAcceptedLatest: boolean;
};
type ProfileType = 'Single' | 'Business';
type ProfileStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'SUSPENDED' | 'INACTIVE' | 'ARCHIVED' | 'PENDING_REGISTRATION';
type UserProfile = {
id: string;
rfid?: string;
creationDate: string;
updateDate?: string;
entityId: string;
entityName: string;
status: ProfileStatus;
type: ProfileType;
emailConsent: boolean;
};
type ServicesRegistrationList = {
approved: string[];
incomplete: string[];
pending: string[];
rejected: string[];
suspended: string[];
unregistered: string[];
};
type ServiceRegistrationWithReason = {
serviceId: string;
reason: string;
status: string;
};
type ProfileServiceRegistration = {
profileId: string;
profileType: ProfileType;
profileStatus: ProfileStatus;
services: ServicesRegistrationList;
reasonsForChange: ServiceRegistrationWithReason[];
};
type UserServiceRegistration = {
catalog: Service[];
profiles: ProfileServiceRegistration[];
};
declare const accountStatus: readonly ["INCOMPLETE", "PENDING", "APPROVED", "REJECTED", "SUSPENDED", "ARCHIVED"];
type AccountStatus = (typeof accountStatus)[number];
type User = {
fleetId: string;
id: string;
accountStatus?: AccountStatus;
locale: string;
agreements: UserAgreement[];
profiles: UserProfile[];
dataPrivacyConsent: boolean;
marketingConsent: boolean;
surveyConsent: boolean;
shareDataConsent: boolean;
surveyConsentUpdateDate: string;
shareDataConsentUpdateDate: string;
profilingConsent: boolean;
profilingConsentUpdateDate: string;
membershipNumber: string;
};
type UserUpdateBody = Partial<Omit<User, 'id' | 'fleetId' | 'agreements' | 'profiles' | 'surveyConsentUpdateDate' | 'shareDataConsentUpdateDate' | 'profilingConsentUpdateDate'>>;
declare const personalInformationUserTypes: readonly ["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"];
declare const personalInformationUserPaths: readonly ["/identity/firstName", "/identity/lastName", "/identity/middleName", "/identity/preferredName", "/birth/birthDate", "/birth/countryBirth", "/birth/provinceBirth", "/birth/cityBirth", "/nationality", "/notes", "/gender", "/personalCompany/companyName", "/personalCompany/companyVat", "/personalCompany/companyAddress/streetName", "/personalCompany/companyAddress/city", "/personalCompany/companyAddress/postalCode", "/personalCompany/companyAddress/region", "/personalCompany/companyAddress/country", "/personalCompany/companyAddress/number", "/personalCompany/companyAddress/addressAdditionalInformation", "/fiscalInformation/fiscal", "/fiscalInformation/personalVatNumber", "/fiscalInformation/sdi", "/fiscalInformation/pecAddress", "/fiscalInformation/marketReference", "/address/streetName", "/address/city", "/address/postalCode", "/address/region", "/address/country", "/address/number", "/address/addressAdditionalInformation", "/membership"];
type PersonalInformationUserType = (typeof personalInformationUserTypes)[number];
declare const personalInformationUserTypeSchema: z.ZodEnum<["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"]>;
declare const personalInformationProfileTypes: readonly ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
type PersonalInformationProfileType = (typeof personalInformationProfileTypes)[number];
declare const personalInformationProfileTypeSchema: z.ZodEnum<["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"]>;
type PersonalInformationIdentity = {
firstName?: string;
lastName?: string;
middleName?: string;
preferredName?: string;
};
type PersonalInformationBirth = {
birthDate?: string;
countryBirth?: string;
provinceBirth?: string;
cityBirth?: string;
};
type PersonalCompany = {
companyName?: string;
companyVat?: string;
companyAddress?: Address;
};
type FiscalInformation = {
fiscal?: string;
personalVatNumber?: string;
sdi?: string;
pecAddress?: string;
marketReference?: string;
};
type PersonalInformationUser = {
fleetId: string;
userId: string;
userName?: string;
identity?: PersonalInformationIdentity;
birth?: PersonalInformationBirth;
nationality?: string;
notes?: string;
gender?: 'MALE' | 'FEMALE' | 'UNDEFINED';
personalCompany?: PersonalCompany;
fiscalInformation?: FiscalInformation;
address?: Address;
membership?: string;
};
type PersonalInformationProfile = {
fleetId: string;
userId: string;
profileId: string;
idNumber?: string;
phoneNumber?: string;
email?: string;
billingAddress?: Address;
};
type Label = {
id: number;
name: string;
createDate: string;
};
type Entity = {
id: string;
fleetId: string;
name: string;
entityName: string;
type: 'Personal' | 'Business';
status: 'APPROVED' | 'PENDING' | 'REJECTED' | 'SUSPENDED' | 'INACTIVE' | 'ARCHIVED';
isMasterEntity: boolean;
billingGroupId: string | null;
billingGroup: string | null;
billingAddress: Address | null;
fiscalCode: string | null;
services: Service[];
};
type CreateBusinessProfile = {
emailConsent: boolean;
email: string;
requestId: string;
costCenterId: string;
};
declare const createBusinessProfile: (client: Client, userId: string, businessId: string, data: CreateBusinessProfile) => Promise<UserProfile>;
type CreateUser = {
userName: string;
password: string;
locale: string;
email: string;
dataPrivacyConsent?: boolean;
profilingConsent?: boolean;
marketingConsent?: boolean;
phoneNumber?: string;
};
type CreateUserOptions = {
tcApproval?: boolean;
skipUserNotification?: boolean;
};
declare const createUser: (client: Client, user: CreateUser, option?: CreateUserOptions) => Promise<User>;
declare const searchTypes: readonly ["email", "username", "phoneNumber"];
type SearchType = (typeof searchTypes)[number];
type ResponseFind = {
content: PersonalInformationUser[];
};
declare const findUser: (client: Client, searchType: SearchType, searchQuery: string, types: PersonalInformationUserType[]) => Promise<ResponseFind>;
declare const getProfilePersonalInfoById: (client: Client, userId: string, profileId: string, types: PersonalInformationProfileType[]) => Promise<PersonalInformationProfile>;
declare const getRegistrationOverview: (client: Client, userId: string) => Promise<UserServiceRegistration>;
declare const getUserById: (client: Client, id: string, addAccountStatus?: boolean) => Promise<User>;
declare const getUserPersonalInfoById: (client: Client, id: string, types: PersonalInformationUserType[]) => Promise<PersonalInformationUser>;
declare const getUsersPIByIds: (client: Client, ids: string[], types: PersonalInformationUserType[]) => Promise<PersonalInformationUser[]>;
declare const getLabelsForUser: (client: Client, userId: string) => Promise<Label[]>;
declare const addLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
declare const removeLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
declare const schema: z.ZodObject<{
disableEmailNotification: z.ZodBoolean;
operatorProfileId: z.ZodString;
actions: z.ZodArray<z.ZodObject<{
reasonForChange: z.ZodString;
serviceId: z.ZodString;
status: z.ZodEnum<["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"]>;
}, "strip", z.ZodTypeAny, {
status: "PENDING" | "APPROVED" | "REJECTED" | "SUSPENDED" | "INCOMPLETE" | "UNREGISTERED";
reasonForChange: string;
serviceId: string;
}, {
status: "PENDING" | "APPROVED" | "REJECTED" | "SUSPENDED" | "INCOMPLETE" | "UNREGISTERED";
reasonForChange: string;
serviceId: string;
}>, "many">;
}, "strip", z.ZodTypeAny, {
disableEmailNotification: boolean;
operatorProfileId: string;
actions: {
status: "PENDING" | "APPROVED" | "REJECTED" | "SUSPENDED" | "INCOMPLETE" | "UNREGISTERED";
reasonForChange: string;
serviceId: string;
}[];
}, {
disableEmailNotification: boolean;
operatorProfileId: string;
actions: {
status: "PENDING" | "APPROVED" | "REJECTED" | "SUSPENDED" | "INCOMPLETE" | "UNREGISTERED";
reasonForChange: string;
serviceId: string;
}[];
}>;
type ServicesUpdate = z.infer<typeof schema>;
declare const setServicesStatus: (client: Client, profileId: string, servicesUpdate: ServicesUpdate) => Promise<void>;
declare const paths: readonly ["/phoneNumber", "/email"];
type Paths$1 = (typeof paths)[number];
declare const updateProfilePersonalInfo: (client: Client, userId: string, profileId: string, actions: PatchAction<Paths$1>[]) => Promise<void>;
declare const updateUser: (client: Client, id: string, user: UserUpdateBody) => Promise<User>;
type Paths = (typeof personalInformationUserPaths)[number];
declare const updateUserPersonalInfo: (client: Client, userId: string, actions: PatchAction<Paths>[]) => Promise<void>;
declare const getEntity: (client: Client, entityId: string) => Promise<Entity>;
export { type AccountStatus, type Address, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type Entity, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getEntity, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };