PhoenixKitCRM (PhoenixKitCRM v0.2.4)

Copy Markdown View Source

CRM module for PhoenixKit.

Implements the PhoenixKit.Module behaviour — discovered automatically at startup via the @phoenix_kit_module attribute. No explicit config is needed in the host application beyond adding this package to deps.

Summary

Functions

Refreshes the CRM role tabs in the Dashboard Registry.

phoenix_kit_comments back-link resolver. Turns commented contact/company uuids into %{uuid => %{title, path}} chips for the central Comments admin, so each comment links back to the record it was made on (with the contact/company name as the label).

Functions

refresh_sidebar()

@spec refresh_sidebar() :: :ok

Refreshes the CRM role tabs in the Dashboard Registry.

Called after enabling or disabling a role in RoleSettings.set_enabled/2.

Known limitation

Role subtabs live in the runtime-only namespace :phoenix_kit_crm_roles. If PhoenixKit.Dashboard.Registry.load_admin_defaults/0 is ever invoked at runtime, this namespace is wiped; role tabs will reappear after the next RoleSettings.set_enabled/2 call or an application restart.

resolve_comment_resources(uuids)

@spec resolve_comment_resources([binary()]) :: %{required(binary()) => map()}

phoenix_kit_comments back-link resolver. Turns commented contact/company uuids into %{uuid => %{title, path}} chips for the central Comments admin, so each comment links back to the record it was made on (with the contact/company name as the label).

Paths are RAW (no URL prefix) — the comments module applies the prefix/locale itself. Registered via the host's config (see hello_world for the pattern):

config :phoenix_kit, :comment_resource_handlers, %{
  "crm_contact" => PhoenixKitCRM,
  "crm_company" => PhoenixKitCRM
}

Dispatched per resource_type, so each call's uuids are all one kind; we resolve against both tables and merge, which is harmless for the empty side.