Architecture: Bootstrap Notes
{/* AUTO-GENERATED from ../docs/architecture-bootstrap-notes.md by scripts/sync-dev-docs.mjs — do not edit by hand. */}
This short guide explains how the plugin boots, where core responsibilities live, and where integrators should add new behavior.
Bootstrap flow
Section titled “Bootstrap flow”dino-discounts.phpwires activation/deactivation hooks, compatibility flags, and the main plugin bootstrap.includes/Plugin.phpregisters core services (REST, storefront hooks, migrations, assets, admin wiring).- REST controllers are registered under
dino-discounts/v1and gate access throughAbstractController::check_permission(). - Rule evaluation happens through
RulesEngine, with targeting logic delegated toTargetingEvaluator.
Core domains
Section titled “Core domains”includes/Engine/: rule matching, targeting, reward strategy selection, and runtime guards.includes/Cart/: campaign and coupon-code lifecycle, linking, export, and redemption state.includes/API/: admin and debug endpoints used by the React UI.includes/Storefront/: cart/checkout rendering and runtime storefront behavior.src/components/: admin application UI, wizard, campaigns, preview, and shared controls.
Integrator guardrails
Section titled “Integrator guardrails”- Prefer extending existing services/controllers over introducing new static utilities.
- Add tests for behavior-heavy changes in
tests/Unitbefore moving UI or endpoint wiring. - When changing UI request flows, use
apiFetchand expose explicit user-facing error states. - For complex rule/campaign edits, keep pure transformation helpers small and isolated so they are testable.