/************************************************************************** * IMPORTS ***************************************************************************/ import { CrispClass as Crisp } from "./index"; /************************************************************************** * TYPES ***************************************************************************/ export type CompanyData = { url?: string; description?: string; employment?: CompanyDataEmployment; geolocation?: CompanyDataGeolocation; }; export type CompanyDataEmployment = { title: string; role: string; }; export type CompanyDataGeolocation = { country: string; city?: string; }; /************************************************************************** * CLASS ***************************************************************************/ /** * Crisp user management */ export default class CrispUser { private parent; /** * Constructor */ constructor(crisp: Crisp); /** * Sets the user nickname */ setNickname(nickname: string): void; /** * Sets the user email */ setEmail(email: string, hmac?: string): void; /** * Sets the user phone */ setPhone(phone: string): void; /** * Sets the user avatar */ setAvatar(avatar: string): void; /** * Sets the user company */ setCompany(name: string, data?: CompanyData): void; /** * Gets the user email */ getEmail(): string | null; /** * Gets the user phone */ getPhone(): string | null; /** * Gets the user nickname */ getNickname(): string | null; /** * Gets the user avatar */ getAvatar(): string | null; /** * Gets the user company */ getCompany(): object | null; /** * Registers a callback for email changed event */ onEmailChanged(callback: Function): void; /** * Unregisters the email changed callback */ offEmailChanged(): void; /** * Registers a callback for phone changed event */ onPhoneChanged(callback: Function): void; /** * Unregisters the phone changed callback */ offPhoneChanged(): void; /** * Registers a callback for nickname changed event */ onNicknameChanged(callback: Function): void; /** * Unregisters the nickname changed callback */ offNicknameChanged(): void; /** * Registers a callback for avatar changed event */ onAvatarChanged(callback: Function): void; /** * Unregisters the avatar changed callback */ offAvatarChanged(): void; }