diff --git a/packages/stage-ui/src/components/scenarios/dialogs/onboarding/onboarding.vue b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/onboarding.vue index 7d189bbfd..e1a89d940 100644 --- a/packages/stage-ui/src/components/scenarios/dialogs/onboarding/onboarding.vue +++ b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/onboarding.vue @@ -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(() => { { id: 'welcome', component: StepWelcome, + props: () => ({ + customProviderSetupEnabled: !isCustomProvidersDisabled(), + }), }, { id: 'provider-selection', diff --git a/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.browser.test.ts b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.browser.test.ts new file mode 100644 index 000000000..a9ee1bc24 --- /dev/null +++ b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.browser.test.ts @@ -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') + }) +}) diff --git a/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.vue b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.vue index 162501419..31b7fafd0 100644 --- a/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.vue +++ b/packages/stage-ui/src/components/scenarios/dialogs/onboarding/step-welcome.vue @@ -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" />