sodexo-public-shop-menu-template
The sodexo-public-shop-menu-template component contains the menu feature with built-in API and i18n support. This template is public and does not require authentication.
Properties
| Property | HTML Attribute | Type | Default | Description |
|---|---|---|---|---|
theme | theme | Theme | Default Sodexo theme | Customization variables for Sodexo components theme |
apiKey | api-key | string | - | X-API-key for Sodexo API |
siteExternalId | site-external-id | string | - | Site external identifier. Use with shopExternalId instead of shopId. Provided by Sodexo |
shopExternalId | shop-external-id | string | - | Shop external identifier. Use with siteExternalId instead of siteId. Provided by Sodexo |
shopId | shop-id | string | - | Internal shop identifier. Use only if obtained from sodexo-public-shop-list-template |
Property Usage
- External IDs: Use
siteExternalId+shopExternalIdtogether (provided by Sodexo) - Internal ID: Use
shopIdalone (only if retrieved from shop list template) - Do not mix both approaches
Usage
- HTML
<!DOCTYPE html>
<html>
<body>
<sodexo-public-shop-menu-template
api-key="your-api-key"
shop-id="your-shop-id"
></sodexo-public-shop-menu-template>
<script>
const element = document.querySelector('sodexo-public-shop-menu-template');
// Apply custom theme
element.theme = {
'--sodexo-primary-color': '#283897',
'--sodexo-primary-text-color': '#283897',
'--sodexo-primary-background-color': '#f7f8ff',
'--sodexo-font-family': 'Open Sans',
};
</script>
</body>
</html>
Property Naming Convention
Naming Syntax
When using properties:
- In HTML: Use kebab-case (e.g.,
api-key,shop-id) - In JavaScript: Use camelCase (e.g.,
apiKey,shopId) - Events: Can only be handled in JavaScript, not in HTML attributes
Examples
Using External IDs
<sodexo-public-shop-menu-template
api-key="your-api-key"
site-external-id="site-123"
shop-external-id="shop-456"
></sodexo-public-shop-menu-template>
Using Internal Shop ID
<sodexo-public-shop-menu-template
api-key="your-api-key"
shop-id="internal-shop-id"
></sodexo-public-shop-menu-template>