sodexo-deposits-template
The sodexo-deposits-template component displays a list of all deposits for a specific user badge. This template includes built-in API integration and i18n support.
Authentication Required
This template requires a valid authentication token to access deposit data.
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 |
token | token | string | - | Authentication token for Sodexo API |
badgeId | badge-id | string | - | Badge identifier to display deposits for |
Events
| Event | Type | Description |
|---|---|---|
sodexoDepositsTemplateLineClicked | CustomEvent<DepositSelected> | Emitted when a deposit line is clicked. Returns badgeId and depositId. Recommended action: Navigate to deposit detail page |
Event Details
DepositSelected
interface DepositSelected {
badgeId: string;
depositId: string;
}
Usage
- HTML
<!DOCTYPE html>
<html>
<body>
<sodexo-deposits-template
api-key="your-api-key"
token="user-auth-token"
badge-id="badge-123"
></sodexo-deposits-template>
<script>
const element = document.querySelector('sodexo-deposits-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',
};
// Handle deposit line click
element.addEventListener('sodexoDepositsTemplateLineClicked', (event) => {
const { badgeId, depositId } = event.detail;
console.log('Deposit clicked:', { badgeId, depositId });
// Redirect to deposit detail
window.location.href = `/deposits/${badgeId}/${depositId}`;
});
</script>
</body>
</html>
Property Naming Convention
Naming Syntax
When using properties:
- In HTML: Use kebab-case (e.g.,
api-key,badge-id) - In JavaScript: Use camelCase (e.g.,
apiKey,badgeId) - Events: Can only be handled in JavaScript, not in HTML attributes
Navigation Flow
This diagram shows the recommended navigation flow for the deposits template:
Recommended Actions
On sodexoDepositsTemplateLineClicked: Navigate to deposit detail page
const { badgeId, depositId } = event.detail;
navigate(`badges/${badgeId}/deposits/${depositId}`);