fix(stage-ui): hide provider setup in Steam onboarding (#2052)

This commit is contained in:
Lovehsigure_520
2026-08-04 09:02:19 +00:00
committed by GitHub
parent 9164ca1bab
commit f66a18956b
3 changed files with 74 additions and 0 deletions
@@ -9,6 +9,7 @@ import type {
ProviderConfigData,
} from './types'
import { isCustomProvidersDisabled } from '@proj-airi/stage-shared'
import { storeToRefs } from 'pinia'
import { computed, nextTick, onMounted, ref } from 'vue'
@@ -121,6 +122,9 @@ const allSteps = computed<OnboardingStep[]>(() => {
{
id: 'welcome',
component: StepWelcome,
props: () => ({
customProviderSetupEnabled: !isCustomProvidersDisabled(),
}),
},
{
id: 'provider-selection',
@@ -0,0 +1,68 @@
import en from '@proj-airi/i18n/locales/en'
import { createPinia } from 'pinia'
import { describe, expect, it, vi } from 'vitest'
import { render } from 'vitest-browser-vue'
import { createI18n } from 'vue-i18n'
import StepWelcome from './step-welcome.vue'
/** Creates the production English localization surface used by onboarding stores. */
function createTestI18n() {
return createI18n({
legacy: false,
locale: 'en',
messages: {
en,
},
})
}
/** Renders the welcome step with real Pinia and i18n plugins. */
async function renderWelcomeStep(customProviderSetupEnabled: boolean) {
return render(StepWelcome, {
props: {
customProviderSetupEnabled,
onNext: vi.fn(),
},
global: {
directives: {
motion: {},
},
plugins: [createPinia(), createTestI18n()],
},
})
}
/**
* @example
* describe('Steam onboarding provider restrictions', () => {})
*/
describe('steam onboarding provider restrictions', () => {
/**
* @example
* it('keeps login without custom provider setup in Steam builds', async () => {})
*/
it('keeps login without custom provider setup in Steam builds', async () => {
// ROOT CAUSE:
//
// The welcome step rendered its local-provider action without consulting
// the distribution restriction already used by settings and provider stores.
// A clean Steam install therefore exposed BYOK during onboarding even though
// the same provider paths were hidden after setup.
await renderWelcomeStep(false)
expect(document.body.textContent).toContain('Sign in')
expect(document.body.textContent).not.toContain('Setup with your provider')
})
/**
* @example
* it('keeps custom provider setup in direct builds', async () => {})
*/
it('keeps custom provider setup in direct builds', async () => {
await renderWelcomeStep(true)
expect(document.body.textContent).toContain('Setup with your provider')
})
})
@@ -21,6 +21,7 @@ import { useOnboardingStore } from '../../../../stores/onboarding'
import { useSettingsGeneral } from '../../../../stores/settings'
interface Props {
customProviderSetupEnabled: boolean
onNext: OnboardingStepNextHandler
}
@@ -133,6 +134,7 @@ function handleLocalSetup() {
@click="handleLogin"
/>
<Button
v-if="props.customProviderSetupEnabled"
v-motion
:initial="{ opacity: 0 }"
:enter="{ opacity: 1 }"