PhoenixKitCRM.StaffLink (PhoenixKitCRM v0.2.4)

Copy Markdown View Source

Optional, soft integration with phoenix_kit_staff. Everything here is guarded — the CRM module works whether or not the staff module is present or enabled. Used by the interaction "involved parties" picker (a staff person can be selected) and by the party snapshot.

Summary

Functions

Whether the staff module is loaded AND enabled. Always safe to call.

Path to a staff person's profile page, or nil when staff is unavailable.

Searches staff people by name (case-insensitive) when staff is enabled. Returns a list of %{uuid, name, job_title} maps. Empty when staff is off.

Builds an as-of-now profile snapshot for a staff person, for freezing onto an interaction party. Returns %{} if staff is unavailable or unknown.

Functions

enabled?()

@spec enabled?() :: boolean()

Whether the staff module is loaded AND enabled. Always safe to call.

person_path(staff_person_uuid)

@spec person_path(binary()) :: String.t() | nil

Path to a staff person's profile page, or nil when staff is unavailable.

search(query, limit \\ 8)

@spec search(String.t(), pos_integer()) :: [map()]

Searches staff people by name (case-insensitive) when staff is enabled. Returns a list of %{uuid, name, job_title} maps. Empty when staff is off.

snapshot(staff_person_uuid)

@spec snapshot(UUIDv7.t() | String.t()) :: map()

Builds an as-of-now profile snapshot for a staff person, for freezing onto an interaction party. Returns %{} if staff is unavailable or unknown.