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:
| 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
// 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'); }
Related
- Settings — Settings section overview
- fetchSettings — Fetch from API
- getOrFetchSettings — Get or fetch