<.header> {if @live_action == :new, do: "Connect to #{provider_label(@provider_type)}", else: "#{provider_label(@provider_type)} settings"}
<%= if @live_action == :new do %>

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

<%= if @provider_type == "printify" do %>

Get your API key from Printify:

  1. Log in to Printify (or create a free account)
  2. Click Account (top right)
  3. Select Connections from the dropdown
  4. Find API tokens and click Generate
  5. Enter a name (e.g. "My Shop"), keep all scopes selected, and click Generate token
  6. Click Copy to clipboard and paste it below
<% else %>

Get your API key from Printful:

  1. Log in to Printful (or create a free account)
  2. Go to SettingsAPI access
  3. Click Create API key
  4. Give it a name and select all scopes
  5. Copy the token and paste it below
<% end %> <% end %> <.form for={@form} id="provider-form" phx-change="validate" phx-submit="save"> <.input field={@form[:api_key]} type="password" label={"#{provider_label(@provider_type)} API key"} placeholder={ if @live_action == :edit, do: "Leave blank to keep current key", else: "Paste your key here" } autocomplete="off" />
<%= case @test_result do %> <% {:ok, _info} -> %> <.icon name="hero-check-circle" class="size-4" /> Connected to {connection_name(@test_result) || provider_label(@provider_type)} <% {:error, reason} -> %> <.icon name="hero-x-circle" class="size-4" /> {format_error(reason)} <% 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_label(@provider_type)}", else: "Save changes"} <.link navigate={~p"/admin/providers"} class="admin-btn admin-btn-ghost"> Cancel