klaviyo-react-native-sdk
Version:
Official Klaviyo React Native SDK
221 lines • 5.85 kB
TypeScript
/**
* Interface for the Klaviyo Profile API
*/
export interface KlaviyoProfileApi {
/**
* Create and update properties about a profile without tracking an associated event.
* @param profile - The profile object to set
*/
setProfile(profile: Profile): void;
/**
* Update a profile's external ID.
* @param externalId - The external ID to set
*/
setExternalId(externalId: string): void;
/**
* Retrieve a profile's external ID.
* @param callback - The callback function to handle the response
*/
getExternalId(callback: Function | undefined): string | null;
/**
* Update a profile's email address.
* @param email - The email address to set
*/
setEmail(email: string): void;
/**
* Retrieve a profile's email address.
* @param callback - The callback function to handle the response
*/
getEmail(callback: Function | undefined): string | null;
/**
* Update a profile's phone number.
* @param phoneNumber - The phone number to set
*/
setPhoneNumber(phoneNumber: string): void;
/**
* Retrieve a profile's phone number.
* @param callback - The callback function to handle the response
*/
getPhoneNumber(callback: Function | undefined): string | null;
/**
* Update a profile's properties.
* @param propertyKey - The property key to set
* @param value - The property value to set
*/
setProfileAttribute(propertyKey: ProfilePropertyKey, value: string): void;
/**
* Clear the current profile and set it to a new anonymous profile
*/
resetProfile(): void;
}
/**
* Enum for various profile properties that can be set on a user
*/
export declare enum ProfileProperty {
/**
* Individual's first name
*/
FIRST_NAME,
/**
* Individual's last name
*/
LAST_NAME,
/**
* Individual's job title
*/
TITLE,
/**
* Name of the company or organization within the company for whom the individual works
*/
ORGANIZATION,
/**
* URL pointing to the location of a profile image
*/
IMAGE,
/**
* First line of street address
*/
ADDRESS1,
/**
* Second line of street address
*/
ADDRESS2,
/**
* City name
*/
CITY,
/**
* Country name
*/
COUNTRY,
/**
* Zip code
*/
ZIP,
/**
* Region within a country, such as state or province
*/
REGION,
/**
* Latitude coordinate. We recommend providing a precision of four decimal places.
*/
LATITUDE,
/**
* Longitude coordinate. We recommend providing a precision of four decimal places.
*/
LONGITUDE,
/**
* Time zone name. We recommend using time zones from the IANA Time Zone Database.
*/
TIMEZONE,
/**
* An object containing location information for this profile
*/
LOCATION,
/**
* An object containing key/value pairs for any custom properties assigned to this profile
*/
PROPERTIES
}
/**
* Interface for location information of a profile
*/
export interface Location {
/**
* First line of street address
*/
readonly address1?: string;
/**
* Second line of street address
*/
readonly address2?: string;
/**
* City name
*/
readonly city?: string;
/**
* Country name
*/
readonly country?: string;
/**
* Zip code
*/
readonly zip?: string;
/**
* Region within a country, such as state or province
*/
readonly region?: string;
/**
* Latitude coordinate. We recommend providing a precision of four decimal places.
*/
readonly latitude?: number;
/**
* Longitude coordinate. We recommend providing a precision of four decimal places.
*/
readonly longitude?: number;
/**
* Time zone name. We recommend using time zones from the IANA Time Zone Database.
*/
readonly timezone?: string;
}
/**
* Interface for a profile
*/
export interface Profile {
/**
* A unique identifier used by customers to associate Klaviyo profiles with profiles in an external system, such as a point-of-sale system. Format varies based on the external system.
*/
readonly externalId?: string;
/**
* Individual's email address
*/
readonly email?: string;
/**
* Individual's phone number in E.164 format
*/
readonly phoneNumber?: string;
/**
* Individual's first name
*/
readonly firstName?: string;
/**
* Individual's last name
*/
readonly lastName?: string;
/**
* Individual's job title
*/
readonly title?: string;
/**
* Name of the company or organization within the company for whom the individual works
*/
readonly organization?: string;
/**
* URL pointing to the location of a profile image
*/
readonly image?: string;
/**
* An object containing location information for this profile
*/
readonly location?: Location;
/**
* An object containing key/value pairs for any custom properties assigned to this profile
*/
readonly properties?: ProfileProperties;
}
/**
* Convert a Profile object to a Record<ProfileProperty, Object> object
* where the keys are the ProfileProperty enum values mapped to the native module's constants
*
* @param profile {@link Profile} - The profile object to convert
*/
export declare function formatProfile(profile: Profile): Record<ProfileProperty, Object>;
/**
* Type for a profile property key
*/
export type ProfilePropertyKey = ProfileProperty | string;
/**
* Type for profile properties
*/
export type ProfileProperties = Record<ProfilePropertyKey, Object>;
//# sourceMappingURL=Profile.d.ts.map