Class: RevieveSDK

RevieveSDK(partnerID, testing, environment, disableUsageAnalytics, avoidCookies-)

Revieve SDK class.

Constructor

new RevieveSDK(partnerID, testing, environment, disableUsageAnalytics, avoidCookies-)

Creates an instance of RevieveSDK. You can access to CV, AR or PR modules throught CV, AR, PR properties.
Parameters:
Name Type Default Description
partnerID String PartnerID assigned to your organization by Revieve
testing Boolean true true if you want to work in test enviroment
environment String test if you set testing to false, you can specify the environment you want to connect (test, prod or cn)
disableUsageAnalytics Boolean false flag for disable telemetry. Defaults to false
avoidCookies- Boolean flag for disable cookies for analytics. Defaults to false

Members

(static) analyticsProvidersAvailable

Analytics providers available

(static) defaultStrength

Default strenght value applied in AR effects.

(static) effectsCatalog

Catalog of effects available in AR module

(static) eyeColor

List of eye colors accepted by SDK

(static) gender

List of gender strings accepted by SDK

(static) hairColor

List of hair colors accepted by SDK

(static) makeupMeasures

Values of different Makeup possible measures

(static) masks

List of available masks for the API version selected

(static) skinTypes

List of skin types accepted by SDK

Methods

addParameter(parameter, value, variantName)

Adds a parameter to the configuration state. If a variant name is provided, adds the parameter to the variation with that name. Otherwise, adds the parameter to the base configuration.
Parameters:
Name Type Description
parameter string The name of the parameter to add.
value * The value of the parameter to add.
variantName string The name of the variant to modify.

addRequiredTag(tagName, value, variantName)

Adds a required tag to the configuration If a variant name is provided, adds the tag to the variation with that name. Otherwise, adds the tag to the base configuration.
Parameters:
Name Type Description
tagName string The name of the tag to add.
value * The value of the tag to add.
variantName string The name of the variant to modify (optional).

clearUIConfiguration()

Method to clear the values of all ui variables in configuration object

getApiVersion() → {String}

Returns the API version configured to be used by the SDK
Returns:
Current API version
Type
String

getConfiguration(worstMetricsOptionsopt) → {Object}

Returns the current configuration object in SDK. If worstMetricsOptions is provided, it will return only the worst metrics that are below the minThreshold.
Parameters:
Name Type Attributes Description
worstMetricsOptions Object <optional>
Object with minThreshold and limit to filter the worst metrics
Properties
Name Type Description
minThreshold number Minimum threshold for the worst metrics.
limit number Limit of metrics to consider.
Returns:
JSON with all configuration values
Type
Object

getEnvironment() → {String}

Returns the environment value in SDK
Returns:
Type
String

getNewCV() → {Object}

Gets a new CV module instance
Returns:
Type
Object

getPartnerId() → {String}

Returns the partnerID value in SDK
Returns:
Type
String

getRequiredTags()

Method to get active required tags in configuration

getSeralizableState() → {Object}

Returns a copy of the current configuration object in SDK
Returns:
JSON with all configuration values
Type
Object

getSkintone() → {float}

Method to get the skintone value configured
Returns:
skintone value in Fitzpatrick scale.
Type
float

getState() → {Object}

Gets the current state of the CORE
Returns:
Type
Object

getUserId() → {String}

Returns the userID value in SDK
Returns:
Type
String

getVariationByName(variantName)

Get an active variation by variationName parameter
Parameters:
Name Type Description
variantName String name of variation

getVariations()

Method to get active variations in configuration

hydrateState(state)

Change the configuration with the provided one
Parameters:
Name Type Description
state Object JSON with all configuration values

isCorrectInEnumeration(enumeration, value) → {Boolean}

Method to validate if a string is a valid in an enumeration
Parameters:
Name Type Description
enumeration String
value String
Returns:
true if it's a correct
Type
Boolean

isTesting() → {Boolean}

Returns the testing value in SDK
Returns:
Type
Boolean

setAcne(acne, requiredTagopt, variantNameopt)

Sets acne value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
acne boolean If the user has skin cornern "acne", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setAge(age)

Sets age in configuration object
Parameters:
Name Type Description
age integer Year of birth

setAnalytics(analyticsInfo) → {Boolean}

Method to enable analytics trackers into SDK.
Parameters:
Name Type Description
analyticsInfo Array array with trackers' information that you want to enable in SDK. Each element of the array must have a valid JSON object with the schema specified in Analytics.trackerInfoSchema
Returns:
true if trackers are set successfully.
Type
Boolean

setAntiAge(antiAge, requiredTagopt, variantNameopt)

Sets antiAge value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
antiAge boolean If user prefers antiaging products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setApiVersion(apiVersion)

Method to set the API version that will use the SDK
Parameters:
Name Type Description
apiVersion String Api version to use in SDK

setCategories(categories, variantNameopt)

Sets categories in configuration object
Parameters:
Name Type Attributes Default Description
categories Array.<String> array of strings with the list of categories to filter in PR
variantName String <optional>
null name of the variation to add this parameter

setConfiguration(configuration) → {Object}

Sets the configuration object to current state.
Parameters:
Name Type Description
configuration Object JSON object with the configuration to set in state
Returns:
state configuration object after sets configuration.
Type
Object

setCuperose(cuperose, requiredTagopt, variantNameopt)

Sets cuperose value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
cuperose boolean If the user has skin cornern "cuperose", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setCustomAttribute(customAttribute, value, requiredTagopt, variantNameopt)

Sets custom attribute value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
customAttribute String Name of the custom attribute
value String | number | boolean | object If you want to filter by this custom attribute, set a value.
requiredTag Boolean <optional>
false Set true if you want only products with this attribute
variantName String <optional>
null name of the variation to add this parameter

setCVEnumValue(metric, value)

Sets cv metric from allowed options to filter products in PR module.
Parameters:
Name Type Description
metric string Metric name
value number | string Metric value

setCVFloatValue(metric, value, minopt, maxopt)

Sets numeric cv metric between a range to filter products in PR module.
Parameters:
Name Type Attributes Default Description
metric string Metric name
value number Metric value
min number <optional>
0 Minimum allowed value
max number <optional>
1 Maximum allowed value

setDarkSpots(darkSpots, variantNameopt)

Sets darkSpots value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
darkSpots float How prominent darkSpots user has in their opinion between 0.0 - 1.0.
variantName String <optional>
null name of the variation to add this parameter

setDullTired(dullTired, requiredTagopt, variantNameopt)

Sets dullTired value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
dullTired boolean If the user has skin cornern "dull and tired", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setEczema(eczema, requiredTagopt, variantNameopt)

Sets eczema value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
eczema boolean If the user has skin cornern "eczema", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setEyebags(eyebags, originopt, variantNameopt)

Sets eyebags value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
eyebags float How prominent eyebags user has in their opinion between 0.0 - 1.0.
origin String <optional>
ui you can specify the origin of the value, 'ui' to user opinion or 'cv' to computer vision value. Default is 'ui'
variantName String <optional>
null name of the variation to add this parameter

setEyeColor(eyeColor, requiredTagopt, variantNameopt)

Sets the eye color in configuration object
Parameters:
Name Type Attributes Default Description
eyeColor String valid eye color from RevieveSDK.eyeColor list
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setFragranceFree(fragranceFree, requiredTagopt, variantNameopt)

Sets fragranceFree value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
fragranceFree boolean If user prefers fragrance free products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setGender(gender)

Sets the gender in configuration object
Parameters:
Name Type Description
gender String valid gender from RevieveSDK.gender list

setHairColor(hairColor, requiredTagopt, variantNameopt)

Sets the hair color in configuration object
Parameters:
Name Type Attributes Default Description
hairColor String valid hair color from RevieveSDK.hairColor list
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setHairtype(hairtype, requiredTagopt, variantNameopt)

Sets the hair type in configuration object
Parameters:
Name Type Attributes Default Description
hairtype String valid hair type from RevieveSDK.hairtype list
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setHyperpigmentation(hyperpigmentation, requiredTagopt, variantNameopt)

Sets hyperpigmentation value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
hyperpigmentation boolean If the user has skin cornern "hyperpigmentation", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setLat(lat)

Sets lattitude in configuration object
Parameters:
Name Type Description
lat float lattitude of user location

setLocale(locale)

Sets the locale in configuration object
Parameters:
Name Type Description
locale String selected locale of the user

setLon(lat)

Sets longitude in configuration object
Parameters:
Name Type Description
lat float longitude of user location

setMatchToSkintoneCategories(categories, variantNameopt)

Method to configure categories that will match the color skintone parameter during the product matching process
Parameters:
Name Type Attributes Default Description
categories Array.<String> array of strings with the list of categories
variantName String <optional>
null name of the variation to add this parameter

setOilyness(oilyness, requiredTagopt, variantNameopt)

Sets oilyness value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
oilyness boolean If the user has skin cornern "oilyness", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setOrganic(organic, requiredTagopt, variantNameopt)

Sets organic value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
organic boolean If user prefers organic products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setParabenFree(parabenFree, requiredTagopt, variantNameopt)

Sets parabenFree value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
parabenFree boolean If user prefers paraben free products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setPsoriasis(psoriasis, requiredTagopt, variantNameopt)

Sets psoriasis value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
psoriasis boolean If the user has skin cornern "psoriasis", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setRedness(redness, variantNameopt)

Sets redness value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
redness float How prominent redness user has in their opinion between 0.0 - 1.0.
variantName String <optional>
null name of the variation to add this parameter

setRequiredTags(requiredTags, variantName)

Method to set the active required tags in configuration
Parameters:
Name Type Default Description
requiredTags Array array with required tags to set in configuration
variantName string null The name of the variant to modify.

setRocasea(rocasea, requiredTagopt, variantNameopt)

Sets rocasea value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
rocasea boolean If the user has skin cornern "rocasea", set this to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setSkinBrightening(skinBrightening, requiredTagopt, variantNameopt)

Sets skinBrightening value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
skinBrightening boolean If user prefers skin brightening products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setSkinFirming(skinFirming, requiredTagopt, variantNameopt)

Sets skinFirming value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
skinFirming boolean If user prefers skin firming products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setSkintone(skintone, requiredTagopt, variantNameopt, withAnalyzeImageopt) → {Promise}

Sets skintone value.
Parameters:
Name Type Attributes Default Description
skintone float Skintone value between 1 and 6 in Fitzpatrick scale. If you want to set an undefined value to force the autodetection by CV module, you must set this value to 0.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter
withAnalyzeImage Boolean <optional>
true You can set to false if you wish to set skintone without CV analyze image.
Returns:
promise that will be resolve or rejected by analyze image process
Type
Promise

setSkintoneColor(color, origin, requiredTag, variantName)

Sets skintone color value to filter products in PR module. Also detects and sets the skintone value in Fitzpatrick scale derived from this skintone color.
Parameters:
Name Type Description
color String skintone hexadecimal color
origin String you can specify the origin of the value, 'ui' to user opinion 'cv' to computer vision value. Default is 'cv'
requiredTag String Set true if you want only products with this feature
variantName String name of the variation to add this parameter

setSkintype(skintype, variantNameopt)

Sets the skin type in configuration object
Parameters:
Name Type Attributes Default Description
skintype String valid skin type from RevieveSDK.skinTypes list
variantName String <optional>
null name of the variation to add this parameter

setSunProtection(sunProtection, requiredTagopt, variantNameopt)

Sets sunProtection value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
sunProtection boolean If user prefers sun protection products, set to true.
requiredTag Boolean <optional>
false Set true if you want only products with this feature
variantName String <optional>
null name of the variation to add this parameter

setUserId()

Sets the userID value in SDK

setVariations(variations)

Metod to set the active variations in confifuration
Parameters:
Name Type Description
variations Array array with variations that you want to set

setWrinkles(wrinkles, originopt, variantNameopt)

Sets wrinkles value to filter products in PR module.
Parameters:
Name Type Attributes Default Description
wrinkles float How prominent wrinkles user has in their opinion between 0.0 - 1.0.
origin String <optional>
ui you can specify the origin of the value, 'ui' to user opinion or 'cv' to computer vision value. Default is 'ui'
variantName String <optional>
null name of the variation to add this parameter