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: 1 addition & 4 deletions packages/javascript/src/api/getUsersMe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import ThunderIDAPIError from '../errors/ThunderIDAPIError';
import {User} from '../models/user';
import processUserUsername from '../utils/processUsername';

/**
* Configuration for the getUsersMe request
Expand Down Expand Up @@ -120,12 +119,10 @@ const getUsersMe = async ({url, baseUrl, fetcher, ...requestConfig}: GetUsersMeC

const user: User = (await response.json()) as User;
const attributes: Record<string, unknown> = (user['attributes'] as Record<string, unknown>) ?? {};
const processedUser: User = {
return {
...user,
...attributes,
};

return processUserUsername(processedUser);
} catch (error) {
if (error instanceof ThunderIDAPIError) {
throw error;
Expand Down
8 changes: 1 addition & 7 deletions packages/javascript/src/api/updateMeProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import ThunderIDAPIError from '../errors/ThunderIDAPIError';
import {User} from '../models/user';
import processUserUsername from '../utils/processUsername';

/**
* Configuration for the updateMeProfile request
Expand Down Expand Up @@ -122,17 +121,12 @@ const updateMeProfile = async ({
);
}

// Match the read path (`getUsersMe`) — strip the userstore prefix
// (e.g. "DEFAULT/") so consumers receive a clean `userName`. Without
// this, the optimistic-update path would put the prefixed value into
// local state and the UI would flip to "DEFAULT/<email>" after a save.
const user: User = (await response.json()) as User;
const attributes: Record<string, unknown> = (user['attributes'] as Record<string, unknown>) ?? {};
const processedUser: User = {
return {
...user,
...attributes,
};
return processUserUsername(processedUser);
} catch (error) {
if (error instanceof ThunderIDAPIError) {
throw error;
Expand Down
1 change: 0 additions & 1 deletion packages/javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ export {default as arrayBufferToBase64url} from './utils/arrayBufferToBase64url'
export {default as base64urlToArrayBuffer} from './utils/base64urlToArrayBuffer';
export {default as bem} from './utils/bem';
export {default as formatDate} from './utils/formatDate';
export {default as processUsername} from './utils/processUsername';
export {default as deepMerge} from './utils/deepMerge';
export {default as extractUserClaimsFromIdToken} from './utils/extractUserClaimsFromIdToken';
export {default as isRecognizedBaseUrlPattern} from './utils/isRecognizedBaseUrlPattern';
Expand Down
163 changes: 0 additions & 163 deletions packages/javascript/src/utils/__tests__/processUsername.test.ts

This file was deleted.

93 changes: 0 additions & 93 deletions packages/javascript/src/utils/processUsername.ts

This file was deleted.

Loading