Skip to content

Dynamic Configuration

The Content Delivery module acts as a Headless CMS and Configuration hub. It uses a schema-less, Key-Value architecture, meaning operators can configure anything in the back-office without requiring SDK updates.

Fetching Configurations (Namespaces)

Configurations are grouped by "namespaces" (e.g., theme, home_page, casino_lobby). You fetch a namespace, and the SDK returns a dynamic JSON object containing whatever keys the operator configured.

javascript
const homeConfig = await sdk.content.getConfig('home_page');

// The structure is fully dynamic. It might contain:
// {
//   showLiveCasino: true,
//   welcomeText: 'Welcome to our Casino!',
//   heroSliderId: 'cnt_hero_123',
//   layoutConfig: { columns: 3, rows: 2 }
// }

if (homeConfig.showLiveCasino) {
  renderLiveCasinoSection();
}

Fetching Content Blobs

For larger data payloads (like arrays of banner images, HTML blocks, or file metadata), the namespace config usually contains a reference ID. You use this ID to fetch the specific ContentBlob.

javascript
const homeConfig = await sdk.content.getConfig('home_page');
const sliderId = homeConfig.heroSliderId;

// Fetch the actual slider data using the ID
const sliderData = await sdk.content.getContent(sliderId);

sliderData.data.forEach(banner => {
  console.log(`Banner URL: ${banner.imageUrl}, Link: ${banner.link}`);
});

ContentBlob Interface

Content Blobs are format-agnostic and include metadata for file size and type validation.

typescript
interface ContentBlob {
  id: string;
  type: 'TEXT' | 'JSON' | 'HTML' | 'CSS' | 'FILE_METADATA';
  data: any; // The actual payload (string, object, array, etc.)
  metadata?: {
    fileSize?: number; // in bytes
    fileType?: string;
    fileUrl?: string;
  };
}