Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/nuxt/src/runtime/plugins/thunderid.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2025 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

import {getRedirectBasedSignUpUrl} from '@thunderid/browser';
import {VendorConstants} from '@thunderid/node';
import {getRedirectBasedSignUpUrl, getVendorPrefix} from '@thunderid/browser';
import type {AttributeSchema, UserProfile} from '@thunderid/node';
import {ThunderIDPlugin, THUNDERID_KEY} from '@thunderid/vue';
import type {H3Event} from 'h3';
Expand Down Expand Up @@ -58,7 +57,7 @@ export default defineNuxtPlugin((nuxtApp: NuxtApp) => {
vendor?: string;
};

const vendor: string = publicConfig.vendor ?? VendorConstants.VENDOR_PREFIX;
const vendor: string = getVendorPrefix(publicConfig.vendor);

// Surface misconfiguration in the browser dev console only. The server
// counterpart is handled by the thunderid-ssr Nitro plugin; doing both
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/runtime/utils/stateKeys.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2025 The ThunderID Authors
// SPDX-License-Identifier: Apache-2.0

import {getVendorPrefix} from '@thunderid/node';
import {getVendorPrefix} from '@thunderid/browser';

/**
* Shared `useState` key for the ThunderID auth state (`ThunderIDAuthState`).
Expand Down
13 changes: 10 additions & 3 deletions packages/nuxt/tests/unit/thunderid-root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ vi.mock('@thunderid/vue', () => ({
I18nProvider: {name: 'I18nProvider'},
}));

vi.mock('@thunderid/browser', () => ({
generateFlattenedUserProfile: vi.fn((_user: any, _schemas: any) => ({email: 'updated@example.com'})),
}));
// Only `generateFlattenedUserProfile` is stubbed; `getVendorPrefix` delegates to the real
// implementation so the mock cannot drift from the shared vendor default in VendorConstants.
vi.mock('@thunderid/browser', async () => {
const {getVendorPrefix} = await vi.importActual<typeof import('@thunderid/browser')>('@thunderid/browser');

return {
generateFlattenedUserProfile: vi.fn((_user: any, _schemas: any) => ({email: 'updated@example.com'})),
getVendorPrefix,
};
});

// Stub Nuxt composables so the component's setup() can run in pure Node.
const mockStateStore: Map<string, {value: any}> = new Map();
Expand Down
Loading