Last updated

getSettings()

Gets cached settings without making an API call.

Signature

const settings = window.FairShareSDK.getSettings();

Returns

Settings | null — Cached settings object, or null if not yet fetched.

Settings Object:

PropertyTypeDescription
shopobjectShop configuration (name, colors, logo, countries, languages)
cartobjectCart configuration (token)
scriptsarrayScript settings (id, src, data)
affiliateobjectAffiliate info (name, email, image_url, username, share_guid, external_id, fluid_rep_id)
attributionobjectAttribution data (union type: email, username, share_guid, fluid_rep_id, or external_id)

See fetchSettings for full type details.

Example

// Check cached settings
const settings = window.FairShareSDK.getSettings();

if (settings) {
  console.log('Shop:', settings.shop);
  console.log('Affiliate:', settings.affiliate);
} else {
  console.log('No cached settings, need to fetch');
}