Referrals 0.1.0: Referral codes as a separate PhoenixKit module
Referrals 0.1.0 is the first release of the PhoenixKit referral codes module. It takes the referral codes feature out of PhoenixKit core into its own package: admins create codes, set limits, and can ask or require new users to enter one when they sign up.
Codes in the admin
The module adds a Referrals tab under Users. It lists every code with four counters at the top (Total Referrals, Active Referrals, Total Uses and Used Referrals), and each code can be switched on or off, edited or deleted.
A new code has a Code (typed in or made with Generate), a Description, an optional Beneficiary User picked by searching users, Maximum Uses and an Expiration Date. Leaving the date empty means the code never expires.
Settings and sign-up
Referrals Settings has a Require Referrals switch that makes a code mandatory at registration, plus two site-wide limits: Maximum Uses Per Referral (1 to 10,000, default 100) and Maximum Referrals Per User (1 to 1,000, default 10). When the module is on, registration, magic-link registration and social sign-in offer a code field and record each use. PhoenixKit core calls the module at run time, so without the package the field does not appear.
Upgrading
Add {:phoenix_kit_referrals, "~> 0.1"} next to phoenix_kit 1.7 and run mix deps.get, then turn the module on in Admin → Modules. No migration: the referral tables are still created by PhoenixKit core, and existing codes keep working.
Referrals 0.1.0. Install or update: {:phoenix_kit_referrals, "~> 0.1"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.