The personal finance app for everyone (by everyone)
Ruby
Replace onboarding's Goals step with Tools/AI (#5808)
Luis Ibanezff3c883ccc1b
diff --git a/app/controllers/onboardings_controller.rb b/app/controllers/onboardings_controller.rbindex 0f616ce44c..4690106dc7 100644--- a/app/controllers/onboardings_controller.rb+++ b/app/controllers/onboardings_controller.rb@@ -10,10 +10,29 @@ class OnboardingsController < ApplicationControllerdef preferencesend+ def tools+ end++ def update_tools+ @user.save_onboarding_tools_and_ai(+ tools: tools_params[:onboarding_tools],+ other_tool: tools_params[:onboarding_other_tool],+ ai_mode: tools_params[:onboarding_ai_mode],+ rendered_ai_mode: tools_params[:rendered_ai_mode]+ )+ redirect_to self_hosted? ? root_path : trial_onboarding_path+ rescue ActiveRecord::RecordInvalid+ redirect_to tools_onboarding_path, alert: @user.errors.full_messages.to_sentence+ end+def trialendprivate+ def tools_params+ params.fetch(:user, {}).permit(:onboarding_other_tool, :onboarding_ai_mode, :rendered_ai_mode, onboarding_tools: [])+ end+def set_user@user = Current.userenddiff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 3a3b0db162..0039ee9f44 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -88,8 +88,8 @@ class UsersController < ApplicationControllerredirect_to root_pathwhen "preferences"redirect_to settings_preferences_path, notice: notice- when "goals"- redirect_to goals_onboarding_path+ when "tools", "goals"+ redirect_to tools_onboarding_pathwhen "trial"redirect_to trial_onboarding_pathwhen "appearance"diff --git a/app/models/user.rb b/app/models/user.rbindex f120a5defa..aeb321678e 100644--- a/app/models/user.rb+++ b/app/models/user.rb@@ -705,6 +705,60 @@ class User < ApplicationRecordAccountOrder.find(default_account_order) || AccountOrder.defaultend+ # Answers to onboarding's Tools/AI step: where the user is coming from and+ # how they want AI. They don't import anything or configure a provider.+ ONBOARDING_TOOLS = %w[+ actual_budget banktivity copilot_money firefly_iii gnucash lunch_money maybe+ monarch_money money_manager_ex moneywiz pocketsmith quicken_classic quicken_simplifi ynab other+ ].freeze+ ONBOARDING_NO_TOOLS = "nothing_yet".freeze+ ONBOARDING_AI_MODES = %w[none builtin external].freeze+ ONBOARDING_OTHER_TOOL_MAX_LENGTH = 80++ def onboarding_tools+ tools = preferences&.dig("onboarding_tools")+ tools.is_a?(Array) ? tools : []+ end++ def onboarding_other_tool+ preferences&.dig("onboarding_other_tool").presence+ end++ # The saved answer, unless the AI switch has changed since: then the switch wins, so+ # resubmitting the step without touching it never turns AI (or household consent) on or off.+ def onboarding_ai_mode+ mode = preferences&.dig("onboarding_ai_mode")+ current = ai_enabled ? "builtin" : "none"+ return current unless ONBOARDING_AI_MODES.include?(mode)++ (mode != "none") == ai_enabled ? mode : current+ end++ # "Nothing yet" excludes every other tool and unknown values are dropped.+ # Built-in and external AI enable this user's AI features; only no AI turns them off.+ # The household's assistant settings still select the conversation backend.+ # For an admin that switch is also the household's AI consent (Family#ai_consented?).+ # Guests always have AI on, so they aren't asked.+ # rendered_ai_mode is the choice the page showed: when the user left it as it was,+ # the AI switch stays as it is now, even if it changed after the page rendered.+ def save_onboarding_tools_and_ai(tools:, other_tool:, ai_mode:, rendered_ai_mode: nil)+ chosen = Array(tools).map(&:to_s)+ chosen = chosen.include?(ONBOARDING_NO_TOOLS) ? [ ONBOARDING_NO_TOOLS ] : chosen & ONBOARDING_TOOLS+ other = other_tool.to_s.strip.first(ONBOARDING_OTHER_TOOL_MAX_LENGTH).presence if chosen.include?("other")+ mode = ONBOARDING_AI_MODES.include?(ai_mode.to_s) ? ai_mode.to_s : "none"++ transaction do+ with_locked_preferences do |prefs|+ prefs["onboarding_tools"] = chosen+ prefs["onboarding_ai_mode"] = mode unless guest?+ other ? prefs["onboarding_other_tool"] = other : prefs.delete("onboarding_other_tool")+ end+ attributes = { set_onboarding_goals_at: Time.current, onboarded_at: Time.current }+ attributes[:ai_enabled] = mode != "none" unless guest? || mode == rendered_ai_mode.to_s+ update!(attributes)+ end+ end+# Whether the activity feed of a linked account always lists the balance# updates its syncs leave behind (see Account#hides_balance_updates_by_default?).# Off until turned on in Settings > Preferences. The activity Filter menu candiff --git a/app/views/onboardings/_onboarding_nav.html.erb b/app/views/onboardings/_onboarding_nav.html.erbindex 4259bd5052..f75c9a266d 100644--- a/app/views/onboardings/_onboarding_nav.html.erb+++ b/app/views/onboardings/_onboarding_nav.html.erb@@ -3,7 +3,7 @@<% steps = [{ name: t("onboardings.header.setup"), path: onboarding_path, is_complete: user.first_name.present?, step_number: 1 },{ name: t("onboardings.header.preferences"), path: preferences_onboarding_path, is_complete: user.set_onboarding_preferences_at.present?, step_number: 2 },- { name: t("onboardings.header.goals"), path: goals_onboarding_path, is_complete: user.set_onboarding_goals_at.present?, step_number: 3 },+ { name: t("onboardings.header.tools"), path: tools_onboarding_path, is_complete: user.set_onboarding_goals_at.present?, step_number: 3 },{ name: t("onboardings.header.start"), path: trial_onboarding_path, is_complete: user.onboarded?, step_number: 4 },] %>diff --git a/app/views/onboardings/goals.html.erb b/app/views/onboardings/goals.html.erbdeleted file mode 100644index 8cb36cd999..0000000000--- a/app/views/onboardings/goals.html.erb+++ /dev/null@@ -1,55 +0,0 @@-<%= content_for :previous_path, preferences_onboarding_path %>--<%= content_for :header_nav do %>- <%= render "onboardings/onboarding_nav", user: @user %>-<% end %>--<%= content_for :cancel_action do %>- <%= render "onboardings/logout" %>-<% end %>--<%= content_for :footer do %>- <%= render "layouts/shared/footer" %>-<% end %>--<div class="grow max-w-lg w-full mx-auto bg-surface flex flex-col justify-center md:py-0 py-6 px-4 md:px-0">- <div>- <div class="space-y-1 mb-6 text-center">- <h1 class="text-2xl font-medium md:text-2xl"><%= t("onboardings.goals.title") %></h1>- <p class="text-secondary text-sm"><%= t("onboardings.goals.subtitle", product_name: product_name) %></p>- </div>-- <%= form_with model: @user do |form| %>- <%= form.hidden_field :redirect_to, value: self_hosted? ? "home" : "trial" %>- <%= form.hidden_field :set_onboarding_goals_at, value: Time.current %>- <%= form.hidden_field :onboarded_at, value: Time.current %>-- <div class="space-y-3">- <% [- { icon: "layers", label: t("onboardings.goals.unified_accounts"), value: "unified_accounts" },- { icon: "banknote", label: t("onboardings.goals.cashflow"), value: "cashflow" },- { icon: "pie-chart", label: t("onboardings.goals.budgeting"), value: "budgeting" },- { icon: "users", label: t("onboardings.goals.partner"), value: "partner" },- { icon: "area-chart", label: t("onboardings.goals.investments"), value: "investments" },- { icon: "bot", label: t("onboardings.goals.ai_insights"), value: "ai_insights" },- { icon: "settings-2", label: t("onboardings.goals.optimization"), value: "optimization" },- { icon: "frown", label: t("onboardings.goals.reduce_stress"), value: "reduce_stress" }- ].each do |goal| %>- <label class="flex items-center gap-2.5 p-4 rounded-lg border border-tertiary cursor-pointer hover:bg-container transition-colors [&:has(input:checked)]:border-solid [&:has(input:checked)]:bg-container">- <%= form.check_box :goals, { multiple: true, class: "sr-only" }, goal[:value], nil %>- <%= icon goal[:icon] %>- <span class="text-primary text-sm"><%= goal[:label] %></span>- </label>- <% end %>- </div>-- <div class="mt-6">- <%= render DS::Button.new(- text: t("onboardings.goals.submit"),- type: :submit,- full_width: true- ) %>- </div>- <% end %>- </div>-</div>diff --git a/app/views/onboardings/preferences.html.erb b/app/views/onboardings/preferences.html.erbindex e804979c1e..033a9d33a7 100644--- a/app/views/onboardings/preferences.html.erb+++ b/app/views/onboardings/preferences.html.erb@@ -73,7 +73,7 @@<%= styled_form_with model: @user, data: { turbo: false } do |form| %><%= form.hidden_field :set_onboarding_preferences_at, value: Time.current %>- <%= form.hidden_field :redirect_to, value: "goals" %>+ <%= form.hidden_field :redirect_to, value: "tools" %><div class="mb-4"><%= form.select :theme, [[t(".theme_system"), "system"], [t(".theme_light"), "light"], [t(".theme_dark"), "dark"]], { label: t(".color_theme") }, data: { action: "onboarding#setTheme" } %>diff --git a/app/views/onboardings/tools.html.erb b/app/views/onboardings/tools.html.erbnew file mode 100644index 0000000000..7fa35a0948--- /dev/null+++ b/app/views/onboardings/tools.html.erb@@ -0,0 +1,118 @@+<%= content_for :previous_path, preferences_onboarding_path %>++<%= content_for :header_nav do %>+ <%= render "onboardings/onboarding_nav", user: @user %>+<% end %>++<%= content_for :cancel_action do %>+ <%= render "onboardings/logout" %>+<% end %>++<%= content_for :footer do %>+ <%= render "layouts/shared/footer" %>+<% end %>++<% selected_tools = @user.onboarding_tools %>+<% ai_mode = @user.onboarding_ai_mode %>++<div class="grow max-w-lg w-full mx-auto bg-surface flex flex-col justify-center md:py-0 py-6 px-4 md:px-0">+ <div class="space-y-1 mb-6 text-center">+ <h1 class="text-2xl font-medium"><%= t(".title") %></h1>+ <p class="text-secondary text-sm"><%= t(".subtitle", product_name: product_name) %></p>+ </div>++ <%= form_with model: @user, url: tools_onboarding_path, method: :patch, class: "space-y-6" do |form| %>+ <%= form.hidden_field :rendered_ai_mode, value: ai_mode %>+ <section class="space-y-3" aria-labelledby="onboarding-starting-point">+ <div class="space-y-1">+ <p class="text-xs uppercase text-secondary"><%= t(".starting_point.eyebrow") %></p>+ <h2 id="onboarding-starting-point" class="font-medium text-primary"><%= t(".starting_point.title") %></h2>+ <p class="text-sm text-secondary"><%= t(".starting_point.description") %></p>+ </div>++ <%= render DS::Disclosure.new(title: t(".starting_point.select"), align: :left, variant: :card, open: selected_tools.any?) do %>+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-x-2">+ <% ([ User::ONBOARDING_NO_TOOLS ] + User::ONBOARDING_TOOLS).each do |tool| %>+ <label class="flex items-center gap-2.5 px-3 py-2 rounded-lg cursor-pointer hover:bg-container-inset-hover text-sm text-primary">+ <%= form.check_box :onboarding_tools, { multiple: true, checked: selected_tools.include?(tool), include_hidden: false }, tool, nil %>+ <span><%= t(".starting_point.tools.#{tool}") %></span>+ </label>+ <% end %>+ </div>+ <div class="form-field mt-2">+ <div class="form-field__body">+ <%= form.text_field :onboarding_other_tool,+ value: @user.onboarding_other_tool,+ maxlength: User::ONBOARDING_OTHER_TOOL_MAX_LENGTH,+ placeholder: t(".starting_point.other_placeholder"),+ aria: { label: t(".starting_point.other_placeholder") },+ class: "form-field__input" %>+ </div>+ </div>+ <% end %>++ <p class="text-xs text-secondary"><%= t(".starting_point.hint") %></p>+ </section>++ <% unless @user.guest? %>+ <section class="group space-y-3" aria-labelledby="onboarding-ai-preference">+ <div class="space-y-1">+ <p class="text-xs uppercase text-secondary"><%= t(".ai.eyebrow") %></p>+ <h2 id="onboarding-ai-preference" class="font-medium text-primary"><%= t(".ai.title", product_name: product_name) %></h2>+ <p class="text-sm text-secondary"><%= t(".ai.description") %></p>+ </div>++ <% User::ONBOARDING_AI_MODES.each do |mode| %>+ <label class="flex items-start gap-3 p-4 rounded-lg border border-tertiary cursor-pointer hover:bg-container transition-colors [&:has(input:checked)]:border-primary [&:has(input:checked)]:bg-container">+ <%= form.radio_button :onboarding_ai_mode, mode, checked: ai_mode == mode, id: "ai-mode-#{mode}", class: "mt-0.5" %>+ <span class="space-y-0.5">+ <span class="flex items-center gap-2 text-sm font-medium text-primary">+ <%= t(".ai.modes.#{mode}.title") %>+ <% if mode == "none" %>+ <%= render DS::Pill.new(label: t(".ai.default"), tone: :gray, marker: false) %>+ <% end %>+ </span>+ <span class="block text-sm text-secondary"><%= t(".ai.modes.#{mode}.description") %></span>+ </span>+ </label>+ <% end %>++ <div class="hidden group-has-[#ai-mode-none:checked]:block" data-ai-panel="none">+ <%= render DS::Note.new(title: t(".ai.panels.none.title")) do %>+ <p><%= t(".ai.panels.none.body") %></p>+ <% if @user.admin? %>+ <p class="mt-2"><%= t(".ai.panels.admin_off") %></p>+ <% end %>+ <% end %>+ </div>++ <div class="hidden group-has-[#ai-mode-builtin:checked]:block" data-ai-panel="builtin">+ <%= render DS::Note.new(title: t(".ai.panels.builtin.title")) do %>+ <p><%= t(".ai.panels.builtin.body") %></p>+ <% if @user.admin? %>+ <p class="mt-2"><%= t(".ai.panels.admin_on") %></p>+ <% end %>+ <% unless @user.ai_available? %>+ <% if self_hosted? && @user.family.effective_assistant_type == "builtin" %>+ <p class="mt-2"><%= t(".ai.panels.builtin.not_configured") %></p>+ <% else %>+ <p class="mt-2"><%= t(".ai.panels.builtin.unavailable") %></p>+ <% end %>+ <% end %>+ <% end %>+ </div>++ <div class="hidden group-has-[#ai-mode-external:checked]:block" data-ai-panel="external">+ <%= render DS::Note.new(title: t(".ai.panels.external.title")) do %>+ <p><%= t(".ai.panels.external.body", product_name: product_name) %></p>+ <% if @user.admin? %>+ <p class="mt-2"><%= t(".ai.panels.admin_on") %></p>+ <% end %>+ <% end %>+ </div>+ </section>+ <% end %>++ <%= render DS::Button.new(text: t(".submit"), type: :submit, full_width: true) %>+ <% end %>+</div>diff --git a/app/views/onboardings/trial.html.erb b/app/views/onboardings/trial.html.erbindex 2793b14168..2b1d2f3dfd 100644--- a/app/views/onboardings/trial.html.erb+++ b/app/views/onboardings/trial.html.erb@@ -1,4 +1,4 @@-<%= content_for :previous_path, goals_onboarding_path %>+<%= content_for :previous_path, tools_onboarding_path %><%= content_for :header_nav do %><%= render "onboardings/onboarding_nav", user: @user %>diff --git a/config/locales/views/onboardings/ca.yml b/config/locales/views/onboardings/ca.ymlindex 6c5ce7a230..b2ec9169b6 100644--- a/config/locales/views/onboardings/ca.yml+++ b/config/locales/views/onboardings/ca.yml@@ -1,21 +1,8 @@---ca:onboardings:- goals:- ai_insights: Deixar que la IA m'ajudi a entendre les meves finances- budgeting: Gestionar plans financers i pressupostos- cashflow: Entendre el flux de caixa i les despeses- investments: Fer el seguiment d'inversions- optimization: Analitzar i optimitzar comptes- partner: Gestionar les finances amb la parella- reduce_stress: Reduir l'estrès o l'ansietat financera- submit: Següent- subtitle: Selecciona un o més objectius que tens amb %{product_name} com a eina- de finances personals.- title: Què t'ha portat aquí?- unified_accounts: Veure tots els meus comptes en un sol llocheader:- goals: Objectius+ tools: Eines/IApreferences: Preferènciessetup: Configuraciósign_out: Tanca la sessió@@ -53,6 +40,8 @@ ca:submit: Continuasubtitle: Primer de tot, completem el teu perfil.title: Configurem el teu compte+ tools:+ submit: Següenttrial:continue_trial: Continua la provadata_deletion: Les dades s'eliminaran desprésdiff --git a/config/locales/views/onboardings/de.yml b/config/locales/views/onboardings/de.ymlindex 179a20bb51..95f2105e00 100644--- a/config/locales/views/onboardings/de.yml+++ b/config/locales/views/onboardings/de.yml@@ -5,7 +5,7 @@ de:sign_out: Abmeldensetup: Setuppreferences: Einstellungen- goals: Ziele+ tools: Tools/KIstart: Startlogout:sign_out: Abmelden@@ -38,17 +38,7 @@ de:currency: Währungdate_format: Datumsformatsubmit: Abschließen- goals:- title: Was sind deine Ziele?- subtitle: Wähle ein oder mehrere Ziele aus, die du mit %{product_name} als dein persönliches Finanztool erreichen möchtest.- unified_accounts: Alle meine Konten an einem Ort sehen- cashflow: Cashflow und Ausgaben verstehen- budgeting: Finanzpläne und Budgets verwalten- partner: Finanzen gemeinsam mit Partner verwalten- investments: Investments verfolgen- ai_insights: KI nutzen um Einblicke zu erhalten- optimization: Konten analysieren und optimieren- reduce_stress: Finanziellen Stress reduzieren+ tools:submit: Weitertrial:title: Sure 45 Tage kostenlos testendiff --git a/config/locales/views/onboardings/en.yml b/config/locales/views/onboardings/en.ymlindex c265f8c644..d8728b506c 100644--- a/config/locales/views/onboardings/en.yml+++ b/config/locales/views/onboardings/en.yml@@ -5,7 +5,7 @@ en:sign_out: Sign outsetup: Setuppreferences: Preferences- goals: Goals+ tools: Tools/AIstart: Startlogout:sign_out: Sign out@@ -38,17 +38,62 @@ en:currency: Currencydate_format: Date formatsubmit: Complete- goals:- title: What brings you here?- subtitle: Select one or more goals that you have with using %{product_name} as your personal finance tool.- unified_accounts: See all my accounts in one place- cashflow: Understand cashflow and expenses- budgeting: Manage financial plans and budgeting- partner: Manage finances with a partner- investments: Track investments- ai_insights: Let AI help me understand my finances- optimization: Analyze and optimize accounts- reduce_stress: Reduce financial stress or anxiety+ tools:+ title: Make yourself at home.+ subtitle: A couple of choices to make %{product_name} yours.+ starting_point:+ eyebrow: Your starting point+ title: What have you been using?+ description: Choose the tools you use to manage your household finances.+ select: Select your tools+ other_placeholder: Other tool (optional)+ hint: Choose all that apply. This helps us suggest a starting point, not assume import compatibility.+ tools:+ nothing_yet: Nothing yet+ actual_budget: Actual Budget+ banktivity: Banktivity+ copilot_money: Copilot Money+ firefly_iii: Firefly III+ gnucash: GnuCash+ lunch_money: Lunch Money+ maybe: Maybe+ monarch_money: Monarch Money+ money_manager_ex: Money Manager Ex+ moneywiz: MoneyWiz+ pocketsmith: PocketSmith+ quicken_classic: Quicken Classic+ quicken_simplifi: Quicken Simplifi+ ynab: YNAB+ other: Other+ ai:+ eyebrow: Your AI preference+ title: How would you like to use %{product_name}?+ description: You're in control. Choose what feels right for you.+ default: Default+ modes:+ none:+ title: No AI+ description: Manage your finances without the in-app assistant.+ builtin:+ title: Built-in AI+ description: Turn on the in-app assistant, using this instance's AI provider.+ external:+ title: Bring your own AI agent+ description: Use your own assistant, connected with your permission.+ panels:+ admin_on: As an admin, this is also your household's consent for AI features that run in the background, like categorization.+ admin_off: As an admin, this also withdraws your consent for AI features that run in the background, like categorization. They stay on only if another admin has AI turned on.+ none:+ title: Your assistant stays off.+ body: This turns off the in-app assistant for your account.+ builtin:+ title: Your assistant turns on.+ body: This turns on the in-app assistant for your account. Which AI provider it uses, and whether it's available, still depends on this instance's AI settings.+ not_configured: No AI provider is set up on this instance yet. An admin can add one in Settings → Self-Hosting.+ unavailable: Your household's current AI settings don't run the in-app assistant, so it won't answer until an admin changes them.+ external:+ title: Connect your agent when you're ready.+ body: This keeps AI enabled for your account. When your household is configured for external chat, conversations use your configured external assistant instead of %{product_name}'s built-in assistant, in the same chat interface. %{product_name} still handles imports, categorization, and other system-of-record processes. Your agent can interact with it through MCP or sure-cli; see Settings → MCP to connect. This choice does not configure the chat backend or create, change, or remove any connection.submit: Nexttrial:title: Try Sure for 45 daysdiff --git a/config/locales/views/onboardings/es.yml b/config/locales/views/onboardings/es.ymlindex d32b480cf8..f62b92f066 100644--- a/config/locales/views/onboardings/es.yml+++ b/config/locales/views/onboardings/es.yml@@ -5,7 +5,7 @@ es:sign_out: Cerrar sesiónsetup: Configuraciónpreferences: Preferencias- goals: Objetivos+ tools: Herramientas/IAstart: Iniciologout:sign_out: Cerrar sesión@@ -38,17 +38,7 @@ es:currency: Monedadate_format: Formato de fechasubmit: Completar- goals:- title: ¿Qué te trae por aquí?- subtitle: Selecciona uno o más objetivos que tienes con %{product_name} como tu herramienta de finanzas personales.- unified_accounts: Ver todas mis cuentas en un solo lugar- cashflow: Entender el flujo de caja y los gastos- budgeting: Gestionar planes financieros y presupuestos- partner: Gestionar finanzas con mi pareja- investments: Seguir las inversiones- ai_insights: Dejar que la IA me ayude a entender mis finanzas- optimization: Analizar y optimizar cuentas- reduce_stress: Reducir el estrés financiero o la ansiedad+ tools:submit: Siguientetrial:title: Prueba Sure durante 45 díasdiff --git a/config/locales/views/onboardings/fr.yml b/config/locales/views/onboardings/fr.ymlindex f147940bab..b815b6e395 100644--- a/config/locales/views/onboardings/fr.yml+++ b/config/locales/views/onboardings/fr.yml@@ -1,21 +1,8 @@---fr:onboardings:- goals:- ai_insights: Laisser l'IA m'aider à comprendre mes finances- budgeting: Gérer les plans financiers et les budgets- cashflow: Comprendre les flux de trésorerie et les dépenses- investments: Suivre les investissements- optimization: Analyser et optimiser les comptes- partner: Gérer les finances avec un partenaire- reduce_stress: Réduire le stress financier ou l'anxiété- submit: Suivant- subtitle: Sélectionnez un ou plusieurs objectifs que vous souhaitez atteindre- avec %{product_name} comme outil de finances personnelles.- title: Qu'est-ce qui vous amène ici ?- unified_accounts: Voir tous mes comptes en un seul endroitheader:- goals: Objectifs+ tools: Outils/IApreferences: Préférencessetup: Configurationsign_out: Se déconnecter@@ -53,6 +40,8 @@ fr:submit: Continuersubtitle: Commençons par compléter votre profil.title: Configurons votre compte+ tools:+ submit: Suivanttrial:continue_trial: Continuer l'essaidata_deletion: Les données seront supprimées ensuitediff --git a/config/locales/views/onboardings/hu.yml b/config/locales/views/onboardings/hu.ymlindex da81b485fb..39483a6f9c 100644--- a/config/locales/views/onboardings/hu.yml+++ b/config/locales/views/onboardings/hu.yml@@ -5,7 +5,7 @@ hu:sign_out: Kijelentkezéssetup: Beállításpreferences: Beállítások- goals: Célok+ tools: Eszközök/MIstart: Kezdéslogout:sign_out: Kijelentkezés@@ -38,17 +38,7 @@ hu:currency: Pénznemdate_format: Dátumformátumsubmit: Befejezés- goals:- title: Mi hozott ide?- subtitle: Válassz ki egy vagy több célt, amelyet el szeretnél érni a %{product_name} személyes pénzügyi eszközzel.- unified_accounts: Lássam az összes számlámat egy helyen- cashflow: Megértsem a pénzforgalmat és a kiadásokat- budgeting: Pénzügyi tervek és költségvetés kezelése- partner: Pénzügyek kezelése partnerrel együtt- investments: Befektetések nyomon követése- ai_insights: Hadd segítsen az AI a pénzügyeim megértésében- optimization: Számlák elemzése és optimalizálása- reduce_stress: Pénzügyi stressz vagy szorongás csökkentése+ tools:submit: Továbbtrial:title: Próbáld ki a Sure-t 45 napigdiff --git a/config/locales/views/onboardings/id.yml b/config/locales/views/onboardings/id.ymlindex 78c1c177ec..72e7ddc018 100644--- a/config/locales/views/onboardings/id.yml+++ b/config/locales/views/onboardings/id.yml@@ -5,7 +5,7 @@ id:sign_out: Keluarsetup: Penyiapanpreferences: Preferensi- goals: Tujuan+ tools: Alat/AIstart: Mulailogout:sign_out: Keluar@@ -38,17 +38,7 @@ id:currency: Mata uangdate_format: Format tanggalsubmit: Selesai- goals:- title: Apa tujuan utama Anda?- subtitle: Pilih satu atau lebih tujuan Anda dalam menggunakan %{product_name} sebagai alat keuangan pribadi Anda.- unified_accounts: Melihat semua rekening saya di satu tempat- cashflow: Memahami arus kas dan pengeluaran- budgeting: Mengelola rencana keuangan dan anggaran- partner: Mengelola keuangan bersama pasangan- investments: Memantau investasi- ai_insights: Memanfaatkan AI untuk membantu memahami keuangan saya- optimization: Menganalisis dan mengoptimalkan rekening- reduce_stress: Mengurangi stres atau kecemasan finansial+ tools:submit: Berikutnyatrial:title: Coba Sure selama 45 haridiff --git a/config/locales/views/onboardings/it.yml b/config/locales/views/onboardings/it.ymlindex 5a20dca488..742cecbee7 100644--- a/config/locales/views/onboardings/it.yml+++ b/config/locales/views/onboardings/it.yml@@ -5,7 +5,7 @@ it:sign_out: Disconnettisetup: Configurazionepreferences: Preferenze- goals: Obiettivi+ tools: Strumenti/IAstart: Inizialogout:sign_out: Disconnetti@@ -38,17 +38,7 @@ it:currency: Valutadate_format: Formato datasubmit: Completa- goals:- title: Cosa ti porta qui?- subtitle: Seleziona uno o più obiettivi che hai nell'utilizzare %{product_name} come strumento di finanza personale.- unified_accounts: Vedere tutti i miei conti in un unico posto- cashflow: Capire i flussi di cassa e le spese- budgeting: Gestire piani finanziari e budget- partner: Gestire le finanze con un partner- investments: Monitorare gli investimenti- ai_insights: Usare l'AI per capire meglio le mie finanze- optimization: Analizzare e ottimizzare i conti- reduce_stress: Ridurre lo stress o l'ansia finanziaria+ tools:submit: Avantitrial:title: Prova Sure per 45 giornidiff --git a/config/locales/views/onboardings/nb.yml b/config/locales/views/onboardings/nb.ymlindex 3c3db72ef7..e07b3032bd 100644--- a/config/locales/views/onboardings/nb.yml+++ b/config/locales/views/onboardings/nb.yml@@ -5,7 +5,7 @@ nb:sign_out: Logg utsetup: Oppsettpreferences: Innstillinger- goals: Mål+ tools: Verktøy/KIstart: Startlogout:sign_out: Logg ut@@ -38,17 +38,7 @@ nb:currency: Valutadate_format: Datoformatsubmit: Fullfør- goals:- title: Hva bringer deg hit?- subtitle: Velg ett eller flere mål du har med %{product_name} som ditt personlige økonomiverktøy.- unified_accounts: Se alle kontoene mine på ett sted- cashflow: Forstå kontantstrøm og utgifter- budgeting: Administrere økonomiplaner og budsjetter- partner: Administrere økonomi med en partner- investments: Følge investeringer- ai_insights: La AI hjelpe meg å forstå økonomien min- optimization: Analysere og optimalisere kontoer- reduce_stress: Redusere økonomisk stress eller angst+ tools:submit: Nestetrial:title: Prøv Sure i 45 dagerdiff --git a/config/locales/views/onboardings/nl.yml b/config/locales/views/onboardings/nl.ymlindex 8f6d4e7553..51f8ad28e5 100644--- a/config/locales/views/onboardings/nl.yml+++ b/config/locales/views/onboardings/nl.yml@@ -5,7 +5,7 @@ nl:sign_out: "Uitloggen"setup: "Instellen"preferences: "Voorkeuren"- goals: "Doelen"+ tools: Tools/AIstart: "Start"logout:sign_out: "Uitloggen"@@ -38,18 +38,8 @@ nl:currency: "Valuta"date_format: "Datumformaat"submit: "Voltooien"- goals:- title: "Wat brengt u hier?"- subtitle: "Selecteer een of meer doelen die u hebt met %{product_name} als uw persoonlijke financiële tool."- unified_accounts: "Al mijn rekeningen op één plek zien"- cashflow: "Cashflow en uitgaven begrijpen"- budgeting: "Financiële plannen en budgetten beheren"- partner: "Financiën samen met een partner beheren"- investments: "Beleggingen volgen"- ai_insights: "AI laten helpen om mijn financiën te begrijpen"- optimization: "Rekeningen analyseren en optimaliseren"- reduce_stress: "Financiële stress of angst verminderen"- submit: "Volgende"+ tools:+ submit: Volgendetrial:title: "Probeer Sure 45 dagen"data_deletion: "Gegevens worden daarna verwijderd"diff --git a/config/locales/views/onboardings/pl.yml b/config/locales/views/onboardings/pl.ymlindex eabcae8540..82018fecc6 100644--- a/config/locales/views/onboardings/pl.yml+++ b/config/locales/views/onboardings/pl.yml@@ -1,21 +1,8 @@---pl:onboardings:- goals:- ai_insights: Korzystać z AI do lepszego zrozumienia moich finansów- budgeting: Zarządzać planami finansowymi i budżetem- cashflow: Lepiej rozumieć przepływy pieniężne i wydatki- investments: Śledzić inwestycje- optimization: Analizować i optymalizować konta- partner: Zarządzać finansami z partnerem- reduce_stress: Zmniejszyć stres lub niepokój związany z finansami- submit: Dalej- subtitle: Wybierz jeden lub więcej celów, które chcesz osiągnąć, używając %{product_name}- do zarządzania finansami osobistymi.- title: Co Cię tutaj sprowadza?- unified_accounts: Widzieć wszystkie moje konta w jednym miejscuheader:- goals: Cele+ tools: Narzędzia/AIpreferences: Preferencjesetup: Konfiguracjasign_out: Wyloguj się@@ -52,6 +39,8 @@ pl:submit: Dalejsubtitle: Na początek skonfigurujmy Twój profil.title: Skonfigurujmy Twoje konto+ tools:+ submit: Dalejtrial:continue_trial: Kontynuuj okres próbnydata_deletion: Dane zostaną wtedy usuniętediff --git a/config/locales/views/onboardings/pt-BR.yml b/config/locales/views/onboardings/pt-BR.ymlindex 8b25f6a18a..a1505affb9 100644--- a/config/locales/views/onboardings/pt-BR.yml+++ b/config/locales/views/onboardings/pt-BR.yml@@ -5,7 +5,7 @@ pt-BR:sign_out: Sairsetup: Configuraçãopreferences: Preferências- goals: Objetivos+ tools: Ferramentas/IAstart: Iniciarlogout:sign_out: Sair@@ -33,17 +33,7 @@ pt-BR:currency: Moedadate_format: Formato de datasubmit: Concluir- goals:- title: O que te traz aqui?- subtitle: Selecione um ou mais objetivos que você tem com o %{product_name} como sua ferramenta de finanças pessoais.- unified_accounts: Ver todas as minhas contas em um só lugar- cashflow: Entender fluxo de caixa e despesas- budgeting: Gerenciar planos financeiros e orçamentos- partner: Gerenciar finanças com um parceiro- investments: Acompanhar investimentos- ai_insights: Deixar a IA me ajudar a entender minhas finanças- optimization: Analisar e otimizar contas- reduce_stress: Reduzir estresse financeiro ou ansiedade+ tools:submit: Próximotrial:title: Experimente o Sure por 45 diasdiff --git a/config/locales/views/onboardings/pt-PT.yml b/config/locales/views/onboardings/pt-PT.ymlindex a9dbf9cade..b212592583 100644--- a/config/locales/views/onboardings/pt-PT.yml+++ b/config/locales/views/onboardings/pt-PT.yml@@ -5,7 +5,7 @@ pt-PT:sign_out: Terminar sessãosetup: Configuraçãopreferences: Preferências- goals: Objetivos+ tools: Ferramentas/IAstart: Iniciarlogout:sign_out: Terminar sessão@@ -38,17 +38,7 @@ pt-PT:currency: Moedadate_format: Formato de datasubmit: Concluir- goals:- title: O que o traz aqui?- subtitle: Selecione um ou mais objetivos que tem com a utilização do %{product_name} como a sua ferramenta de finanças pessoais.- unified_accounts: Ver todas as minhas contas num só lugar- cashflow: Compreender o fluxo de caixa e as despesas- budgeting: Gerir planos financeiros e orçamentos- partner: Gerir as finanças com um parceiro- investments: Acompanhar investimentos- ai_insights: Deixar a IA ajudar-me a compreender as minhas finanças- optimization: Analisar e otimizar contas- reduce_stress: Reduzir o stresse ou a ansiedade financeiros+ tools:submit: Seguintetrial:title: Experimente o Sure durante 45 diasdiff --git a/config/locales/views/onboardings/ro.yml b/config/locales/views/onboardings/ro.ymlindex d799840122..a9aa86a7d7 100644--- a/config/locales/views/onboardings/ro.yml+++ b/config/locales/views/onboardings/ro.yml@@ -5,7 +5,7 @@ ro:sign_out: Deconectaresetup: Configurarepreferences: Preferințe- goals: Obiective+ tools: Instrumente/AIstart: Startlogout:sign_out: Deconectare@@ -33,17 +33,7 @@ ro:currency: Monedădate_format: Format datăsubmit: Finalizare- goals:- title: Ce te aduce aici?- subtitle: Selectează unul sau mai multe obiective pe care le ai cu %{product_name} ca instrument de finanțe personale.- unified_accounts: Să-mi văd toate conturile într-un singur loc- cashflow: Să înțeleg fluxul de numerar și cheltuielile- budgeting: Să gestionez planuri financiare și bugete- partner: Să gestionez finanțele împreună cu partenerul- investments: Să urmăresc investițiile- ai_insights: Să las AI să mă ajute să-mi înțeleg finanțele- optimization: Să analizez și să optimizez conturile- reduce_stress: Să reduc stresul financiar sau anxietatea+ tools:submit: Următorultrial:title: Încearcă Sure timp de 45 de zilediff --git a/config/locales/views/onboardings/ru.yml b/config/locales/views/onboardings/ru.ymlindex 244884897a..2546c1d55f 100644--- a/config/locales/views/onboardings/ru.yml+++ b/config/locales/views/onboardings/ru.yml@@ -1,21 +1,8 @@---ru:onboardings:- goals:- ai_insights: Пусть ИИ поможет мне понять мои финансы- budgeting: Управление финансовыми планами и бюджетом- cashflow: Понимание денежного потока и расходов- investments: Отслеживание инвестиций- optimization: Анализ и оптимизация счетов- partner: Управление финансами с партнёром- reduce_stress: Снижение финансового стресса или тревоги- submit: Далее- subtitle: Выберите одну или несколько целей, которые вы преследуете, используя- %{product_name} как инструмент управления личными финансами.- title: Что привело вас сюда?- unified_accounts: Просмотр всех моих счетов в одном местеheader:- goals: Цели+ tools: Инструменты/ИИpreferences: Предпочтенияsetup: Настройкаsign_out: Выйти@@ -51,6 +38,8 @@ ru:submit: Продолжитьsubtitle: Сначала давайте настроим ваш профиль.title: Давайте настроим ваш аккаунт+ tools:+ submit: Далееtrial:continue_trial: Продолжить пробный периодdata_deletion: Данные будут удалены после этогоdiff --git a/config/locales/views/onboardings/tr.yml b/config/locales/views/onboardings/tr.ymlindex b4a911eb0a..eae68143b2 100644--- a/config/locales/views/onboardings/tr.yml+++ b/config/locales/views/onboardings/tr.yml@@ -1,21 +1,8 @@---tr:onboardings:- goals:- ai_insights: AI'ın finanslarımı anlamama yardım etmesini sağlamak- budgeting: Finansal planları ve bütçeleri yönetmek- cashflow: Nakit akışını ve harcamaları anlamak- investments: Yatırımları takip etmek- optimization: Hesapları analiz etmek ve optimize etmek- partner: Bir partnerle birlikte finansları yönetmek- reduce_stress: Finansal stresi veya kaygıyı azaltmak- submit: Sonraki- subtitle: "%{product_name}'i kişisel finans aracınız olarak kullanmak için bir- veya daha fazla hedef seçin."- title: Sizi buraya ne getirdi?- unified_accounts: Tüm hesaplarımı tek bir yerde görmekheader:- goals: Hedefler+ tools: Araçlar/YZpreferences: Tercihlersetup: Kurulumsign_out: Çıkış yap@@ -53,6 +40,8 @@ tr:submit: Devam etsubtitle: Önce profilinizi tamamlayalım.title: Hesabınızı kuralım+ tools:+ submit: Sonrakitrial:continue_trial: Denemeye devam etdata_deletion: Veriler daha sonra silinecekdiff --git a/config/locales/views/onboardings/uk.yml b/config/locales/views/onboardings/uk.ymlindex 52074e09e2..3d4841a86a 100644--- a/config/locales/views/onboardings/uk.yml+++ b/config/locales/views/onboardings/uk.yml@@ -1,21 +1,8 @@---uk:onboardings:- goals:- ai_insights: Нехай ШІ допоможе мені зрозуміти мої фінанси- budgeting: Управління фінансовими планами та бюджетом- cashflow: Розуміння грошового потоку та витрат- investments: Відстеження інвестицій- optimization: Аналіз та оптимізація рахунків- partner: Управління фінансами з партнером- reduce_stress: Зменшення фінансового стресу чи тривоги- submit: Далі- subtitle: Виберіть одну або кілька цілей, які ви переслідуєте, використовуючи- %{product_name} як інструмент для управління особистими фінансами.- title: Що привело вас сюди?- unified_accounts: Перегляд усіх моїх рахунків в одному місціheader:- goals: Цілі+ tools: Інструменти/ШІpreferences: Уподобанняsetup: Налаштуванняsign_out: Вийти@@ -68,6 +55,8 @@ uk:title: Давайте налаштуємо ваш обліковий записwelcome: Ласкаво просимо до Sure!add_account_manually: Додати рахунок вручну+ tools:+ submit: Даліtrial:continue_trial: Продовжити пробний періодdata_deletion: Дані будуть видалені після цьогоdiff --git a/config/locales/views/onboardings/vi.yml b/config/locales/views/onboardings/vi.ymlindex b11bd6a43a..a576c5b999 100644--- a/config/locales/views/onboardings/vi.yml+++ b/config/locales/views/onboardings/vi.yml@@ -5,7 +5,7 @@ vi:sign_out: Đăng xuấtsetup: Thiết lậppreferences: Tùy chọn- goals: Mục tiêu+ tools: Công cụ/AIstart: Bắt đầulogout:sign_out: Đăng xuất@@ -38,17 +38,7 @@ vi:currency: Tiền tệdate_format: Định dạng ngàysubmit: Hoàn tất- goals:- title: Điều gì đưa bạn đến đây?- subtitle: Chọn một hoặc nhiều mục tiêu bạn muốn đạt được khi sử dụng %{product_name} làm công cụ tài chính cá nhân.- unified_accounts: Xem tất cả tài khoản ở một nơi- cashflow: Hiểu dòng tiền và chi tiêu- budgeting: Quản lý kế hoạch tài chính và ngân sách- partner: Quản lý tài chính cùng người thân- investments: Theo dõi đầu tư- ai_insights: Để AI giúp tôi hiểu tài chính- optimization: Phân tích và tối ưu hóa tài khoản- reduce_stress: Giảm căng thẳng hoặc lo lắng về tài chính+ tools:submit: Tiếp theotrial:title: Dùng thử Sure trong 45 ngàydiff --git a/config/locales/views/onboardings/zh-CN.yml b/config/locales/views/onboardings/zh-CN.ymlindex 02a29228db..9bac069a3a 100644--- a/config/locales/views/onboardings/zh-CN.yml+++ b/config/locales/views/onboardings/zh-CN.yml@@ -5,7 +5,7 @@ zh-CN:sign_out: 退出登录setup: 设置preferences: 偏好设置- goals: 目标+ tools: 工具/AIstart: 开始logout:sign_out: 退出登录@@ -38,17 +38,7 @@ zh-CN:currency: 货币date_format: 日期格式submit: 完成- goals:- title: 您使用这里的目的是什么?- subtitle: 请选择一个或多个您希望使用 %{product_name} 作为个人财务工具实现的目标。- unified_accounts: 在一个地方查看我的所有账户- cashflow: 理解现金流和支出- budgeting: 管理财务计划和预算- partner: 与伴侣一起管理财务- investments: 跟踪投资- ai_insights: 让 AI 帮我理解财务状况- optimization: 分析并优化账户- reduce_stress: 减轻财务压力或焦虑+ tools:submit: 下一步trial:title: 试用 Sure 45 天diff --git a/config/locales/views/onboardings/zh-TW.yml b/config/locales/views/onboardings/zh-TW.ymlindex 83f8b98663..a49632af52 100644--- a/config/locales/views/onboardings/zh-TW.yml+++ b/config/locales/views/onboardings/zh-TW.yml@@ -5,7 +5,7 @@ zh-TW:sign_out: 登出setup: 設定preferences: 偏好設定- goals: 目標+ tools: 工具/AIstart: 開始logout:sign_out: 登出@@ -38,17 +38,7 @@ zh-TW:currency: 幣別date_format: 日期格式submit: 完成- goals:- title: 是什麼讓您來到這裡?- subtitle: 請選擇一個或多個您想用 %{product_name} 達成的理財目標。- unified_accounts: 在一個地方查看所有帳戶- cashflow: 了解現金流和支出- budgeting: 管理財務計畫和預算- partner: 與伴侶共同管理財務- investments: 追蹤投資- ai_insights: 讓 AI 幫助我了解我的財務狀況- optimization: 分析和最佳化帳戶- reduce_stress: 減輕財務壓力或焦慮+ tools:submit: 下一步trial:title: 試用 Sure 45 天diff --git a/config/routes.rb b/config/routes.rbindex 283935c993..2b8b15a71f 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -417,7 +417,9 @@ Rails.application.routes.draw doresource :onboarding, only: :show docollection doget :preferences- get :goals+ get :tools+ patch :tools, action: :update_tools+ get :goals, to: redirect("/onboarding/tools")get :trialendenddiff --git a/test/controllers/onboardings_controller_test.rb b/test/controllers/onboardings_controller_test.rbindex 43e72da673..520bbb07ec 100644--- a/test/controllers/onboardings_controller_test.rb+++ b/test/controllers/onboardings_controller_test.rb@@ -89,10 +89,108 @@ class OnboardingsControllerTest < ActionDispatch::IntegrationTestendend- test "should get goals" do- get goals_onboarding_url+ test "should get tools, with no AI selected for a user without AI" do+ @user.update!(ai_enabled: false)+ get tools_onboarding_urlassert_response :success- assert_select "h1", text: /What brings you here/i+ assert_select "h1", text: I18n.t("onboardings.tools.title")+ assert_select "input[type=radio][name='user[onboarding_ai_mode]'][value=none][checked]"+ end++ test "admins are told their AI choice is also the household's consent" do+ get tools_onboarding_url+ assert_select "[data-ai-panel=builtin]", text: /#{Regexp.escape(I18n.t("onboardings.tools.ai.panels.admin_on"))}/+ end++ test "members don't see the household consent note" do+ sign_in users(:family_member)+ get tools_onboarding_url+ assert_select "[data-ai-panel=builtin]"+ assert_select "[data-ai-panel=builtin]", text: /#{Regexp.escape(I18n.t("onboardings.tools.ai.panels.admin_on"))}/, count: 0+ end++ test "resubmitting after turning AI off in settings keeps it off" do+ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "builtin" } }+ @user.reload.update!(ai_enabled: false)++ get tools_onboarding_url+ assert_select "input[type=radio][value=none][checked]"+ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "none" } }+ assert_not @user.reload.ai_enabled+ end++ test "revisiting the step keeps an enabled assistant selected" do+ @user.update!(ai_enabled: true)+ get tools_onboarding_url+ assert_select "input[type=radio][value=builtin][checked]"+ end++ test "the old goals step redirects to tools" do+ get "/onboarding/goals"+ assert_redirected_to "/onboarding/tools"+ end++ test "saving tools and built-in AI turns the assistant on and goes to the trial" do+ @user.update!(ai_enabled: false)++ patch tools_onboarding_url, params: { user: {+ onboarding_tools: %w[ynab other], onboarding_other_tool: "Spreadsheet", onboarding_ai_mode: "builtin"+ } }++ assert_redirected_to trial_onboarding_url+ @user.reload+ assert_equal %w[ynab other], @user.onboarding_tools+ assert_equal "Spreadsheet", @user.onboarding_other_tool+ assert_equal "builtin", @user.onboarding_ai_mode+ assert @user.ai_enabled+ assert_not_nil @user.set_onboarding_goals_at+ assert_not_nil @user.onboarded_at+ end++ test "no AI turns the assistant off" do+ @user.update!(ai_enabled: true)+ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "none", rendered_ai_mode: "builtin" } }+ assert_not @user.reload.ai_enabled+ assert_equal "none", @user.onboarding_ai_mode+ end++ test "external AI stays enabled and selected when revisiting onboarding" do+ @user.update!(ai_enabled: false)+ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "external", rendered_ai_mode: "none" } }+ assert @user.reload.ai_enabled+ assert_equal "external", @user.onboarding_ai_mode++ get tools_onboarding_url+ assert_select "input[type=radio][value=external][checked]"+ assert_select "[data-ai-panel=external]", text: /#{Regexp.escape(I18n.t("onboardings.tools.ai.panels.admin_on"))}/+ assert_select "[data-ai-panel=external]", text: /#{Regexp.escape(I18n.t("onboardings.tools.ai.panels.admin_off"))}/, count: 0++ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "external", rendered_ai_mode: "external" } }+ assert @user.reload.ai_enabled+ assert_equal "external", @user.onboarding_ai_mode+ end++ test "built-in AI warns about a missing provider only when the assistant can't run" do+ with_self_hosting do+ Provider::Openai.stubs(:configured?).returns(false)+ Provider::Anthropic.stubs(:configured?).returns(false)+ not_configured = Regexp.escape(I18n.t("onboardings.tools.ai.panels.builtin.not_configured"))++ User.any_instance.stubs(:ai_available?).returns(true)+ get tools_onboarding_url+ assert_select "[data-ai-panel=builtin]", text: /#{not_configured}/, count: 0++ User.any_instance.stubs(:ai_available?).returns(false)+ get tools_onboarding_url+ assert_select "[data-ai-panel=builtin]", text: /#{not_configured}/+ end+ end++ test "self-hosted onboarding finishes on the dashboard" do+ with_self_hosting do+ patch tools_onboarding_url, params: { user: { onboarding_ai_mode: "none" } }+ assert_redirected_to root_url+ endendtest "should get trial" do@@ -184,7 +282,7 @@ endget preferences_onboarding_urlassert_response :success- get goals_onboarding_url+ get tools_onboarding_urlassert_response :successget trial_onboarding_url@@ -200,7 +298,7 @@ endget preferences_onboarding_urlassert_redirected_to new_session_url- get goals_onboarding_url+ get tools_onboarding_urlassert_redirected_to new_session_urlget trial_onboarding_urldiff --git a/test/models/user_test.rb b/test/models/user_test.rbindex a06d4e1d35..a4bec3b921 100644--- a/test/models/user_test.rb+++ b/test/models/user_test.rb@@ -16,6 +16,118 @@ class UserTest < ActiveSupport::TestCaseclear_performed_jobsend+ test "onboarding answers keep only known tools and make nothing yet exclusive" do+ user = users(:family_admin)++ user.save_onboarding_tools_and_ai(tools: %w[ynab made_up], other_tool: "Ignored", ai_mode: "builtin")+ assert_equal [ "ynab" ], user.onboarding_tools+ assert_nil user.onboarding_other_tool++ user.save_onboarding_tools_and_ai(tools: %w[nothing_yet ynab other], other_tool: "Sheets", ai_mode: "none")+ assert_equal [ "nothing_yet" ], user.reload.onboarding_tools+ assert_nil user.onboarding_other_tool+ end++ test "onboarding keeps the other tool only when other is chosen, trimmed and capped" do+ user = users(:family_admin)++ user.save_onboarding_tools_and_ai(tools: %w[other], other_tool: " #{"x" * 100} ", ai_mode: "none")+ assert_equal "x" * User::ONBOARDING_OTHER_TOOL_MAX_LENGTH, user.reload.onboarding_other_tool+ end++ test "onboarding AI mode drives ai_enabled and falls back to no AI" do+ user = users(:family_admin)++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "builtin")+ assert user.reload.ai_enabled++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "made_up")+ assert_equal "none", user.reload.onboarding_ai_mode+ assert_not user.ai_enabled+ end++ test "without a saved answer the AI choice reflects the current switch" do+ user = users(:family_admin)++ user.update!(ai_enabled: true)+ assert_equal "builtin", user.onboarding_ai_mode++ user.update!(ai_enabled: false)+ assert_equal "none", user.onboarding_ai_mode+ end++ test "a saved AI answer gives way when the switch changed since" do+ user = users(:family_admin)+ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "builtin")++ user.update!(ai_enabled: false)+ assert_equal "none", user.onboarding_ai_mode++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "external")+ assert user.reload.ai_enabled+ assert_equal "external", user.onboarding_ai_mode++ user.update!(ai_enabled: false)+ assert_equal "none", user.onboarding_ai_mode+ end++ test "an untouched AI choice leaves a switch changed after the page rendered" do+ user = users(:family_admin)+ user.update!(ai_enabled: false)++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "builtin", rendered_ai_mode: "builtin")+ assert_not user.reload.ai_enabled++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "builtin", rendered_ai_mode: "none")+ assert user.reload.ai_enabled+ end++ test "external onboarding enables admin consent without changing the household backend" do+ user = users(:family_admin)+ user.family.users.where(role: %w[admin super_admin]).update_all(ai_enabled: false)+ user.reload+ original_type = user.family.assistant_type+ assert_not user.family.ai_consented?++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "external", rendered_ai_mode: "none")++ assert user.reload.ai_enabled+ assert_equal "external", user.onboarding_ai_mode+ assert user.family.ai_consented?+ assert_equal original_type, user.family.reload.assistant_type+ end++ test "untouched external onboarding preserves a later opt out and explicit selection enables AI" do+ user = users(:family_admin)+ user.update!(ai_enabled: false)++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "external", rendered_ai_mode: "external")+ assert_not user.reload.ai_enabled+ assert_equal "none", user.onboarding_ai_mode++ user.save_onboarding_tools_and_ai(tools: [], other_tool: nil, ai_mode: "external", rendered_ai_mode: "none")+ assert user.reload.ai_enabled+ assert_equal "external", user.onboarding_ai_mode+ end++ test "guests keep AI on and aren't asked about it" do+ guest = users(:intro_user)++ guest.save_onboarding_tools_and_ai(tools: %w[ynab], other_tool: nil, ai_mode: "none")+ guest.reload+ assert guest.ai_enabled+ assert_nil guest.preferences["onboarding_ai_mode"]+ assert_equal [ "ynab" ], guest.onboarding_tools+ end++ test "onboarding answers don't touch other preferences" do+ user = users(:family_admin)+ user.update_show_balance_updates(false)++ user.save_onboarding_tools_and_ai(tools: %w[ynab], other_tool: nil, ai_mode: "none")+ assert_not user.reload.show_balance_updates?+ end+test "should be valid" doassert @user.valid?, @user.errors.full_messages.to_sentenceenddiff --git a/test/system/onboardings_test.rb b/test/system/onboardings_test.rbindex 76fc3e5f59..98e3ad50d8 100644--- a/test/system/onboardings_test.rb+++ b/test/system/onboardings_test.rb@@ -43,9 +43,8 @@ class OnboardingsTest < ApplicationSystemTestCase# Submit preferencesclick_button I18n.t("onboardings.preferences.submit")- # Should redirect to goals page- assert_current_path goals_onboarding_path- assert_text I18n.t("onboardings.goals.title")+ assert_current_path tools_onboarding_path+ assert_text I18n.t("onboardings.tools.title")endtest "browser locale defaults onboarding country and currency" do@@ -62,7 +61,7 @@ class OnboardingsTest < ApplicationSystemTestCaseassert_equal "CAD", find("#user_family_attributes_currency").valueclick_button I18n.t("onboardings.preferences.submit")- assert_current_path goals_onboarding_path+ assert_current_path tools_onboarding_path@family.reloadassert_equal "CA", @family.country@@ -157,8 +156,8 @@ class OnboardingsTest < ApplicationSystemTestCase# Button text is in Spanish due to locale previewclick_button I18n.t("onboardings.preferences.submit", locale: :es)- # Wait for redirect to goals page to ensure form was submitted- assert_current_path goals_onboarding_path+ # Wait for redirect to the tools step to ensure form was submitted+ assert_current_path tools_onboarding_path# Verify data was saved@family.reload@@ -171,14 +170,44 @@ class OnboardingsTest < ApplicationSystemTestCaseassert_not_nil @user.set_onboarding_preferences_atend- test "goals page renders correctly" do- # Complete preferences first- @user.update!(set_onboarding_preferences_at: Time.current)+ test "tools step saves the starting point and AI preference" do+ @user.update!(set_onboarding_preferences_at: Time.current, ai_enabled: false)++ visit tools_onboarding_path+ assert_text I18n.t("onboardings.tools.title")+ assert_text I18n.t("onboardings.tools.ai.panels.none.title")++ find("summary", text: I18n.t("onboardings.tools.starting_point.select")).click+ check I18n.t("onboardings.tools.starting_point.tools.ynab")+ choose I18n.t("onboardings.tools.ai.modes.builtin.title")+ assert_text I18n.t("onboardings.tools.ai.panels.builtin.title")+ assert_no_text I18n.t("onboardings.tools.ai.panels.none.title")- visit goals_onboarding_path+ click_button I18n.t("onboardings.tools.submit")+ assert_current_path trial_onboarding_path++ @user.reload+ assert_equal [ "ynab" ], @user.onboarding_tools+ assert @user.ai_enabled+ end- assert_text I18n.t("onboardings.goals.title")- assert_button I18n.t("onboardings.goals.submit")+ test "external AI keeps the assistant enabled and remains selected on revisit" do+ @user.update!(set_onboarding_preferences_at: Time.current, ai_enabled: false)+ visit tools_onboarding_path++ choose I18n.t("onboardings.tools.ai.modes.external.title")+ assert_text I18n.t("onboardings.tools.ai.panels.external.title")+ assert_no_text I18n.t("onboardings.tools.ai.panels.none.title")+ click_button I18n.t("onboardings.tools.submit")+ assert_current_path trial_onboarding_path+ assert @user.reload.ai_enabled++ visit tools_onboarding_path+ assert_checked_field I18n.t("onboardings.tools.ai.modes.external.title")+ click_button I18n.t("onboardings.tools.submit")+ assert_current_path trial_onboarding_path+ assert @user.reload.ai_enabled+ assert_equal "external", @user.onboarding_ai_modeendtest "trial page renders correctly" do@@ -201,8 +230,7 @@ class OnboardingsTest < ApplicationSystemTestCaseselect "MM/DD/YYYY", from: "user_family_attributes_date_format"click_button I18n.t("onboardings.preferences.submit")- # Should be at goals- assert_current_path goals_onboarding_path+ assert_current_path tools_onboarding_pathendtest "onboarding nav shows correct steps" do