Skip to main content
When designing user interfaces for your app or website, it’s crucial that the UI adapts seamlessly to the changing configurations set within Gameball. Whether it’s temporarily disabling a feature like the cashback program during the financial year-end or adjusting to new business rules, having an adaptive UI ensures a smooth user experience without the need for frequent code updates or redeployments. With the Widget Configurations API, you can dynamically update your UI elements based on real-time changes within the Gameball platform. This eliminates the need for manual updates each time there is a configuration change, offering a more efficient and responsive way to reflect business decisions.

Widget Configurations API Response

The Configurations API returns a set of configuration flags, which control the visibility and status of various Gameball programs:
{
  "gameballEnabled": true,
  "redemptionEnabled": true,
  "cashbackEnabled": true,
  "visitorProfileEnabled": true,
  "userProfileEnabled": true,
  "leaderboardEnabled": true,
  "notificationsEnabled": true,
  "currency": "EGP",
  "programName": "Loyalty Program",
  "rankPointsName": "Score",
  "walletPointsName": "Points",
  "botMainColor": "#E7633F"
}

Adaptive UI Based on Flags

In this response, there are several flags that determine whether different Gameball features should be enabled or disabled in your app/webpage:
  • gameballEnabled: If false, all Gameball-related UI elements should be disabled or hidden
  • cashbackEnabled: If false, elements related to the Cashback program (like cashback balance, cashback offers, etc.) should be hidden
  • notificationsEnabled: If false, notifications should not be displayed

Example Implementation

// Fetch widget configurations
const response = await fetch(
  'https://api.gameball.co/api/v4.0/integrations/configurations/widget',
  {
    headers: {
      'apikey': 'YOUR_API_KEY',
      'secretkey': 'YOUR_SECRET_KEY'
    }
  }
);

const config = await response.json();

// Conditionally render UI elements based on configuration
if (config.gameballEnabled) {
  // Show Gameball features
  if (config.cashbackEnabled) {
    // Show cashback UI elements
  }
  if (config.notificationsEnabled) {
    // Show notifications UI elements
  }
} else {
  // Hide all Gameball-related UI elements
}
Dynamic Business Decisions: The configurations API ensures your UI remains consistent with any business decisions made through the Gameball dashboard without needing to redeploy your application.