Events and Extensions
Events and extensions add behavior without rewriting base templates and scenarios. Use them for analytics, additional blocks, notifications, and external integrations.
Common Extension Points
| Point | Example |
|---|---|
| Page | Add a block to the home page or player cabinet |
| Form | Add an extra field or hint |
| API result | Show a notification after a successful operation |
| Module | Extend shop, warehouse, support, or marketplace |
| Analytics | Send a safe event after a user action |
Principles
- Avoid changing base templates unless necessary.
- Put the extension into a separate partial or component.
- Do not block the main scenario if an external integration is unavailable.
- Do not store secrets in JavaScript or templates.
- Log only technical identifiers and safe context.
User Events
For interface events, pass only safe data:
window.dispatchEvent(new CustomEvent('mmoweb:payment:created', {
detail: {
paymentId: 'public-id',
amount: 100,
currency: 'USD'
}
}));
Do not pass private keys, tokens, PIN codes, payment details, or internal payment provider responses to the browser.
Extending Modules
If an extension belongs to a module, keep these files together:
- block template;
- block styles;
- translation keys;
- setup notes;
- verification scenario.
This makes module updates easier and clarifies which files participate in the change.
Errors
An extension should not hide system API errors. Show a clear message to the user, and log the technical error category and request id.