add setup onboarding page, dashboard launch checklist, provider registry

- new /setup page with three-section onboarding (account, provider, payments)
- dashboard launch checklist with progress bar, go-live, dismiss
- provider registry on Provider module (single source of truth for metadata)
- payments registry for Stripe
- setup context made provider-agnostic (provider_connected, theme_customised, etc.)
- admin provider pages now fully registry-driven (no hardcoded provider names)
- auth flow: fresh installs redirect to /setup, signed_in_path respects setup state
- removed old /admin/setup wizard
- 840 tests, 0 failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-20 00:34:06 +00:00
parent 989c5cd4df
commit c2caeed64d
33 changed files with 1927 additions and 1053 deletions

View File

@@ -4,8 +4,9 @@ defmodule BerrypodWeb.Admin.Providers.Form do
alias Berrypod.Products
alias Berrypod.Products.ProviderConnection
alias Berrypod.Providers
alias Berrypod.Providers.Provider
@supported_types ~w(printify printful)
@supported_types Enum.map(Provider.available(), & &1.type)
@impl true
def mount(params, _session, socket) do
@@ -14,10 +15,12 @@ defmodule BerrypodWeb.Admin.Providers.Form do
defp apply_action(socket, :new, params) do
provider_type = validated_type(params["type"])
provider = Provider.get(provider_type)
socket
|> assign(:page_title, "Connect to #{provider_label(provider_type)}")
|> assign(:page_title, "Connect to #{provider.name}")
|> assign(:provider_type, provider_type)
|> assign(:provider, provider)
|> assign(:connection, %ProviderConnection{provider_type: provider_type})
|> assign(:form, to_form(ProviderConnection.changeset(%ProviderConnection{}, %{})))
|> assign(:testing, false)
@@ -27,10 +30,12 @@ defmodule BerrypodWeb.Admin.Providers.Form do
defp apply_action(socket, :edit, %{"id" => id}) do
connection = Products.get_provider_connection!(id)
provider = Provider.get(connection.provider_type)
socket
|> assign(:page_title, "#{provider_label(connection.provider_type)} settings")
|> assign(:page_title, "#{provider.name} settings")
|> assign(:provider_type, connection.provider_type)
|> assign(:provider, provider)
|> assign(:connection, connection)
|> assign(:form, to_form(ProviderConnection.changeset(connection, %{})))
|> assign(:testing, false)
@@ -89,7 +94,7 @@ defmodule BerrypodWeb.Admin.Providers.Form do
{:ok, _connection} ->
{:noreply,
socket
|> put_flash(:info, "Connected to #{provider_label(provider_type)}!")
|> put_flash(:info, "Connected to #{socket.assigns.provider.name}!")
|> push_navigate(to: ~p"/admin/settings")}
{:error, %Ecto.Changeset{} = changeset} ->
@@ -132,7 +137,8 @@ defmodule BerrypodWeb.Admin.Providers.Form do
end
defp maybe_add_name(params, type, _result) do
Map.put_new(params, "name", provider_label(type))
provider = Provider.get(type)
Map.put_new(params, "name", provider && provider.name || type)
end
defp encrypt_api_key(api_key) do
@@ -147,9 +153,6 @@ defmodule BerrypodWeb.Admin.Providers.Form do
# Shared helpers used by the template
defp provider_label("printful"), do: "Printful"
defp provider_label(_), do: "Printify"
defp connection_name({:ok, %{shop_name: name}}), do: name
defp connection_name({:ok, %{store_name: name}}), do: name
defp connection_name(_), do: nil