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:
| Property | Type | Description |
|---|---|---|
shop | object | Shop configuration (name, colors, logo, countries, languages) |
cart | object | Cart configuration (token) |
scripts | array | Script settings (id, src, data) |
affiliate | object | Affiliate info (name, email, image_url, username, share_guid, external_id, fluid_rep_id) |
attribution | object | Attribution 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);
Related
- Settings — Settings section overview
- getSettings — Get cached only
- fetchSettings — Force fetch from API