Skip to content

Extract Emails module to standalone package - #447

Merged
ddon merged 12 commits into
BeamLabEU:devfrom
timujinne:dev
Mar 23, 2026
Merged

Extract Emails module to standalone package#447
ddon merged 12 commits into
BeamLabEU:devfrom
timujinne:dev

Conversation

@timujinne

Copy link
Copy Markdown
Contributor

Summary

  • Extract PhoenixKit.Modules.Emails from core into standalone phoenix_kit_emails package
  • Add unified PhoenixKit.Email.Provider behaviour + DefaultProvider (no-op fallback)
  • Refactor Mailer and UserNotifier to use email_provider() instead of hard aliases
  • Enrich external module cards on Modules page with full config/stats/settings
  • Fix external_plugin_view? to recognize PhoenixKit.Modules.*.Web as external plugins
  • Fix module_card component to render hero-* icons

Changes

Core behaviour refactor

  • PhoenixKit.Email.Provider — unified behaviour (14 callbacks)
  • PhoenixKit.Email.DefaultProvider — no-op implementation
  • PhoenixKit.Mailer — uses email_provider(), removed send_test_tracking_email
  • PhoenixKit.Users.Auth.UserNotifier — uses email_provider(), text-only fallbacks

Module infrastructure

  • ModuleRegistry — Emails added to known_external_packages
  • ObanConfig — removed email queues from core install, added add_oban_queue/3
  • Modules page — removed hardcoded Emails card, enriched external module cards
  • external_plugin_view? — recognizes PhoenixKit.Modules.*.Web namespace

Removed from core

  • lib/modules/emails/ — 35+ source files
  • lib/phoenix_kit_web/routes/emails.ex
  • 15 email-related mix tasks

Test Plan

  • mix precommit passes
  • Core compiles without Emails module
  • Hydroforce runs with phoenix_kit_emails as path dep
  • Decor 3D Print runs with phoenix_kit_emails as path dep
  • Module auto-discovered, provider registered
  • Admin routes auto-generated from tabs with live_view:

Group listing pages (/news, /legal) now use the most recent published
post date as lastmod. Homepage (/) uses the latest date across all
publishing entries. Other static pages use the sitemap generation date.
- Add PhoenixKit.Email.Provider behaviour and DefaultProvider (no-op)
- Refactor Mailer to use email_provider() instead of hard Emails aliases
- Remove send_test_tracking_email from core (moves to emails package)
- Refactor UserNotifier to use email_provider(), strip HTML fallbacks
- Add Emails to ModuleRegistry known_external_packages
- Remove email/sqs_polling queues from core Oban config, add add_oban_queue/3
- Fix pre-existing dialyzer ignore for Sync MapSet opaque types
- Fix pre-existing credo alias ordering in shop catalog modules
- New PhoenixKitWeb.AdminEditHelper module (supports both Plug.Conn and LiveView.Socket)
- Fix Shop catalog: admin edit URL now only assigned for admin users (was assigned to all visitors)
- Add admin edit links to Publishing controller (blog listing, post show, date URL)
- Add conditional Edit button in Publishing templates (index + show)
- Delete lib/modules/emails/ (35 source files + web LiveViews/controllers)
- Delete PhoenixKitWeb.Routes.EmailsRoutes and all email mix tasks (15 files)
- Remove PhoenixKit.Modules.Emails from module_registry internal_modules
- Add to known_external_packages for admin Modules page
- Remove EmailsRoutes alias and safe_route_call references from integration.ex
- Update billing.ex to use PhoenixKit.Mailer.send_from_template instead of Templates.send_email
- Guard dashboard.html.heex Emails.enabled?() with Code.ensure_loaded? + apply
- Update v15.ex and v31.ex migrations to use dynamic module dispatch
- Clean up .dialyzer_ignore.exs entries for removed files

Also: Add legal_links to cookie consent widget config for dynamic legal page links
…I toggle

- Replace hardcoded cookie/privacy URLs with Routes.path() to fix double-slash bug
- Add dynamic legal_links from published pages + single /legal index link
- Use bg-base-100/70 backdrop instead of bg-black for light/dark theme compatibility
- Improve glass opacity (0.95→0.98), card bg (50→80%), text contrast
- Replace custom toggle with standard daisyUI toggle toggle-primary
# Conflicts:
#	lib/phoenix_kit/install/oban_config.ex
#	lib/phoenix_kit/module_registry.ex
@ddon
ddon merged commit 6b0df80 into BeamLabEU:dev Mar 23, 2026
6 checks passed
ddon added a commit that referenced this pull request Mar 24, 2026
- Remove Emails from internal_modules, add to known_external_packages
- Remove email/sqs_polling queues and ensure_sqs_polling_queue from ObanConfig
- Eliminate double get_active_template_by_name calls in Mailer and UserNotifier
- Centralize email_provider() as Provider.current/0
- Update test counts for Emails+Posts extractions (20→18, 19→17, 24→22)
- Add PR review docs for #447

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants