<.header> {if @live_action == :new, do: "Connect to #{@provider.name}", else: "#{@provider.name} settings"}
<%= if @live_action == :new do %>

{@provider.name} is a print-on-demand service that prints and ships products for you. Connect your account to automatically import your products into your shop.

Get your API key from {@provider.name}:

  1. <.external_link href={@provider.login_url} class="admin-link"> Log in to {@provider.name} (or <.external_link href={@provider.signup_url} class="admin-link">create a free account)
  2. {raw(step)}
<% end %> <.form for={@form} id="provider-form" phx-change="validate" phx-submit="save"> <.input field={@form[:api_key]} type="password" label={"#{@provider.name} API key"} placeholder={ if @live_action == :edit, do: "Leave blank to keep current key", else: "Paste your key here" } autocomplete="off" />
<%= if @test_result do %> <%= case @test_result do %> <% {:ok, _info} -> %> <.icon name="hero-check-circle" class="size-4" /> Connected to {connection_name(@test_result) || @provider.name} <% {:error, reason} -> %> <.icon name="hero-x-circle" class="size-4" /> {format_error(reason)} <% end %> <% end %>
<%= if @live_action == :edit do %> <.input field={@form[:enabled]} type="checkbox" label="Connection enabled" /> <% end %>
<.button type="submit" disabled={@testing}> {if @live_action == :new, do: "Connect to #{@provider.name}", else: "Save changes"} <.link navigate={~p"/admin/providers"} class="admin-btn admin-btn-ghost"> Cancel