2026-02-18 21:23:15 +00:00
|
|
|
defmodule Berrypod.Setup do
|
2026-02-11 22:58:58 +00:00
|
|
|
@moduledoc """
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
Aggregates setup status checks for the setup flow and launch checklist.
|
2026-02-11 22:58:58 +00:00
|
|
|
"""
|
|
|
|
|
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
alias Berrypod.{Accounts, Orders, Products, Settings}
|
2026-02-11 22:58:58 +00:00
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
|
Returns a map describing the current setup status.
|
|
|
|
|
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
Used by the setup page, dashboard launch checklist, and ThemeHook gate.
|
|
|
|
|
|
|
|
|
|
## Setup phase (connections)
|
|
|
|
|
|
|
|
|
|
* `admin_created` — at least one user exists
|
|
|
|
|
* `provider_connected` — a provider connection with an API key exists
|
|
|
|
|
* `provider_type` — the connected provider's type (e.g. "printify"), or nil
|
|
|
|
|
* `stripe_connected` — Stripe API key is stored
|
|
|
|
|
* `setup_complete` — all three connections made
|
|
|
|
|
|
|
|
|
|
## Launch checklist phase
|
|
|
|
|
|
|
|
|
|
* `products_synced` / `product_count` — products imported
|
|
|
|
|
* `theme_customised` — theme settings have been saved at least once
|
|
|
|
|
* `has_orders` — at least one paid order exists
|
|
|
|
|
* `site_live` — shop is open to the public
|
|
|
|
|
* `can_go_live` — minimum requirements met to go live
|
|
|
|
|
* `checklist_dismissed` — admin has dismissed the launch checklist
|
2026-02-11 22:58:58 +00:00
|
|
|
"""
|
|
|
|
|
def setup_status do
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
conn = Products.get_first_provider_connection()
|
|
|
|
|
product_count = Products.count_products()
|
2026-02-11 22:58:58 +00:00
|
|
|
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
provider_connected = conn != nil
|
2026-02-11 22:58:58 +00:00
|
|
|
products_synced = product_count > 0
|
|
|
|
|
stripe_connected = Settings.has_secret?("stripe_api_key")
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
admin_created = Accounts.has_admin?()
|
2026-02-11 22:58:58 +00:00
|
|
|
site_live = Settings.site_live?()
|
|
|
|
|
|
|
|
|
|
%{
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
# Setup phase
|
|
|
|
|
admin_created: admin_created,
|
|
|
|
|
provider_connected: provider_connected,
|
|
|
|
|
provider_type: conn && conn.provider_type,
|
|
|
|
|
stripe_connected: stripe_connected,
|
|
|
|
|
setup_complete: admin_created and provider_connected and stripe_connected,
|
|
|
|
|
|
|
|
|
|
# Launch checklist
|
2026-02-11 22:58:58 +00:00
|
|
|
products_synced: products_synced,
|
|
|
|
|
product_count: product_count,
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
theme_customised: Settings.get_setting("theme_customised", false) == true,
|
|
|
|
|
has_orders: Orders.has_paid_orders?(),
|
2026-02-11 22:58:58 +00:00
|
|
|
site_live: site_live,
|
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>
2026-02-20 00:34:06 +00:00
|
|
|
can_go_live: provider_connected and products_synced and stripe_connected,
|
|
|
|
|
checklist_dismissed: Settings.get_setting("checklist_dismissed", false) == true
|
2026-02-11 22:58:58 +00:00
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|