Plugin Context API
Use API, storage, and event helpers from plugins.
Each plugin receives a ctx object through slots and bootstrap.
API helper
ctx.api sends requests to /api/proxy, adds the current auth token as a Token header, and includes credentials.
Use ctx.api to call backend endpoints through the proxy.
Use localStorage, sessionStorage, and cookies safely.
ctx.storage.set('myKey', 'value');
ctx.storage.setCookie('myCookie', 'value', { maxAge: 3600 });Plugins can communicate using a simple event bus.
const unsubscribe = ctx.events.on('route:change', (route) => {
ctx.logger.info('route changed', route);
});const { pathname, search } = ctx.route.get();ctx.checkout.registerGuard(async (context) => {
return true;
});