fetchSettings()
Fetches settings from the API.
Signature
const settings = await window.FairShareSDK.fetchSettings();
Returns
Promise<Settings> — Settings object from the API.
Settings Object:
| Property | Type | Description |
|---|---|---|
shop | object | Shop configuration |
cart | object | Cart configuration |
scripts | array | Script settings |
affiliate | object | Affiliate information |
attribution | object | Attribution data (union type) |
Shop Object:
| Property | Type | Description |
|---|---|---|
name | string | Shop name |
primary_color | string | null | Primary brand color (e.g., "#000000") |
secondary_color | string | null | Secondary brand color |
logo_url | string | null | URL to shop logo |
icon_url | string | null | URL to shop icon |
countries | string[] | null | Available country codes |
languages | string[] | null | Available language codes |
Cart Object:
| Property | Type | Description |
|---|---|---|
token | string | null | Cart token |
Scripts Array:
| Property | Type | Description |
|---|---|---|
id | string | Script identifier |
src | string | Script source URL |
data | object | Script data attributes |
Affiliate Object:
| Property | Type | Description |
|---|---|---|
name | string | null | Affiliate name |
email | string | null | Affiliate email |
image_url | string | null | Affiliate image URL |
username | string | null | Affiliate username |
share_guid | string | null | Share GUID |
external_id | string | null | External ID |
fluid_rep_id | number | null | Fluid Rep ID |
Attribution Object (union type - one of):
| Property | Type | Description |
|---|---|---|
email | string | Affiliate email |
username | string | Affiliate username |
share_guid | string | Share GUID |
fluid_rep_id | number | Fluid Rep ID |
external_id | string | External 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);
Related
- Settings — Settings section overview
- getSettings — Get cached settings
- getOrFetchSettings — Get or fetch settings