Class: RevieveSDK

RevieveSDK(partnerID, testingopt, environmentopt)

Revieve SDK class.

Constructor

new RevieveSDK(partnerID, testingopt, environmentopt)

Creates an instance of RevieveSDK. You can access to CV, AR or PR modules throught CV, AR, PR properties.
Parameters:
Name Type Attributes Default Description
partnerID String PartnerID assigned to your organization by Revieve
testing Boolean <optional>
true true if you want to work in test enviroment
environment String <optional>
test if you set testing to false, you can specify the environment you want to connect (test, prod or cn)

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

(static) stateConfigurationSchema

JSON schema to validate state's configuration object

Methods

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() → {Object}

Returns current configuration object in SDK
Returns:
JSON with all configuration values
Type
Object

getEnvironment() → {String}

Returns the environment value in SDK
Returns:
Type
String

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 trakcers 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 setted succesfully.
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)

Sets categories in configuration object
Parameters:
Name Type Description
categories Array.<String> array of strings with the list of categories to filter in PR

setConfiguration(configuration) → {Object}

Sets the configuration object to current state. The configuration object passed must acomplish the JSON schema defined in property RevieveSDK.stateConfigurationSchema
Parameters:
Name Type Description
configuration Object JSON object with the configuration to set in state
Returns:
state configuration object after sets configuration. Note that if there is any problem with configuration object passed to the method, it will return the current state configuration object without changes applied.
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

setDarkSpots(darkSpots)

Sets darkSpots value to filter products in PR module.
Parameters:
Name Type Description
darkSpots float How prominent darkSpots user has in their opinion between 0.0 - 1.0.

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)

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'

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

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

setLon(lat)

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

setMatchToSkintoneCategories(categories)

Method to configure categories that will match the color skintone parameter during the product matching process
Parameters:
Name Type Description
categories Array.<String> array of strings with the list of categories

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)

Sets redness value to filter products in PR module.
Parameters:
Name Type Description
redness float How prominent redness user has in their opinion between 0.0 - 1.0.

setRequiredTags(requiredTags)

Method to set the active required tags in configuration
Parameters:
Name Type Description
requiredTags Array array with required tags to set in configuration

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)

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

setSkintype(skintype)

Sets the skin type in configuration object
Parameters:
Name Type Description
skintype String valid skin type from RevieveSDK.skinTypes list

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)

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'