npm run dev- Build in development mode with watchnpm run buildornpm run prod- Production build (outputs to dist/)npm run create-widget- CLI to scaffold a new widget
No automated tests are configured in this project.
- Core Library: JavaScript library built with Webpack that enables custom widgets for MinistryPlatform
- Entry Point: src/index.js (builds to dist/js/customWidgetV1.js)
- Structure: src/ contains Modules/ and Services/ for core functionality
- Widgets: Individual widgets in Widgets/ directory (GroupFinder, MilestoneGamification, etc.)
- Templating: Uses LiquidJS for widget templates
- Data Source: Widgets connect to MinistryPlatform via stored procedures (prefixed with api_Custom_)
- JavaScript (ES6+) with Babel transpilation
- No TypeScript except CLI (cli/create-widget.ts)
- Use existing service modules (TemplateService, APIService) found in src/Services/
- Widget HTML uses data attributes (data-component, data-sp, data-template, data-host, etc.)
- Follow existing widget patterns in Widgets/ directory when creating new widgets
- Console logs are preserved (drop_console: false in webpack config)
- Source maps enabled for debugging
- Custom CSS Framework: Lightweight, Bootstrap-like framework with
mp-prefix for all classes - CSS Variables: Customizable color scheme and spacing defined in
:root(--mp-primary, --mp-secondary, etc.) - Components: Includes badges, buttons, alerts, forms, tables, avatars, and sacrament-specific styling
- Utility Classes: Spacing (mp-m-, mp-p-), flexbox (mp-d-flex, mp-align-items-), typography (mp-text-)
- Layout: Responsive container system (.mp-container) with breakpoints at 576px, 768px, 992px, 1200px
- Special Features: Sacrament badges/icons, day-of-week badges forced to cobalt blue
- Responsive Design: Mobile-first with media queries for responsive adjustments
- Initialization: WidgetModule.Init() finds all
[data-component="CustomWidget"]elements and initializes them - Authentication: Checks localStorage for
mpp-widgets_AuthTokenandmpp-widgets_ExpiresAfter - Data Attributes:
- Required:
data-component,data-host,data-sp(ordata-useCalendar) - Optional:
data-template,data-templateId,data-params,data-cache,data-requireUser,data-debug,data-authOverride
- Required:
- Host Configuration:
data-hostmust be church prefix ONLY (no http/https or domain) - Parameters:
data-paramsmust include@character for stored procedure parameters (unless using calendar) - Calendar Mode: Set
data-useCalendar="true"to use MinistryPlatform Events API instead of stored procedure - JSON Stored Procedures: If stored procedure name ends with
_json, automatically parses JsonResult column - Events: Dispatches
widgetLoadedCustomEvent on both element and window with widgetId and data - Reinit Methods:
ReinitWidget(elementId)andReinitAllWidgets()for dynamic reloading