Last updated

getOrFetchSettings()

Gets settings from cache, or fetches from API if not cached.

Signature

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

Returns

Promise<Settings> — Settings object.

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

// Get settings (from cache if available, otherwise fetch)
const settings = await window.FairShareSDK.getOrFetchSettings();

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