Last updated

fetchSettings()

Fetches settings from the API.

Signature

const settings = await window.FairShareSDK.fetchSettings();

Returns

Promise<Settings> — Settings object from the API.

Settings Object:

PropertyTypeDescription
shopobjectShop configuration
cartobjectCart configuration
scriptsarrayScript settings
affiliateobjectAffiliate information
attributionobjectAttribution data (union type)

Shop Object:

PropertyTypeDescription
namestringShop name
primary_colorstring | nullPrimary brand color (e.g., "#000000")
secondary_colorstring | nullSecondary brand color
logo_urlstring | nullURL to shop logo
icon_urlstring | nullURL to shop icon
countriesstring[] | nullAvailable country codes
languagesstring[] | nullAvailable language codes

Cart Object:

PropertyTypeDescription
tokenstring | nullCart token

Scripts Array:

PropertyTypeDescription
idstringScript identifier
srcstringScript source URL
dataobjectScript data attributes

Affiliate Object:

PropertyTypeDescription
namestring | nullAffiliate name
emailstring | nullAffiliate email
image_urlstring | nullAffiliate image URL
usernamestring | nullAffiliate username
share_guidstring | nullShare GUID
external_idstring | nullExternal ID
fluid_rep_idnumber | nullFluid Rep ID

Attribution Object (union type - one of):

PropertyTypeDescription
emailstringAffiliate email
usernamestringAffiliate username
share_guidstringShare GUID
fluid_rep_idnumberFluid Rep ID
external_idstringExternal ID

Example

// Fetch fresh settings from API
const settings = await window.FairShareSDK.fetchSettings();

console.log('Shop:', settings.shop);
console.log('Affiliate:', settings.affiliate);
console.log('Attribution:', settings.attribution);