Integrate role asset studio into custom world agent flow
This commit is contained in:
@@ -16,6 +16,7 @@ import type {
|
||||
AuthRiskBlockSummary,
|
||||
AuthSessionsResponse,
|
||||
AuthSessionSummary,
|
||||
AuthUser,
|
||||
AuthWechatBindPhoneResponse,
|
||||
AuthWechatStartResponse,
|
||||
LogoutResponse,
|
||||
@@ -53,6 +54,11 @@ export type ConsumedAuthCallback = {
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
let pendingAutoAuthUser: Promise<{
|
||||
user: AuthUser;
|
||||
credentials: AutoAuthCredentials;
|
||||
}> | null = null;
|
||||
|
||||
export function normalizePhoneInput(phoneInput: string) {
|
||||
return phoneInput.replace(/[^\d+]/gu, '').trim();
|
||||
}
|
||||
@@ -248,14 +254,22 @@ export async function authEntryWithStoredCredentials(
|
||||
}
|
||||
|
||||
export async function ensureAutoAuthUser() {
|
||||
const credentials =
|
||||
getStoredAutoAuthCredentials() ?? createAutoAuthCredentials();
|
||||
const user = await authEntryWithStoredCredentials(credentials);
|
||||
pendingAutoAuthUser ??= (async () => {
|
||||
const credentials =
|
||||
getStoredAutoAuthCredentials() ?? createAutoAuthCredentials();
|
||||
const user = await authEntryWithStoredCredentials(credentials);
|
||||
|
||||
return {
|
||||
user,
|
||||
credentials,
|
||||
};
|
||||
return {
|
||||
user,
|
||||
credentials,
|
||||
};
|
||||
})();
|
||||
|
||||
try {
|
||||
return await pendingAutoAuthUser;
|
||||
} finally {
|
||||
pendingAutoAuthUser = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function consumeAuthCallbackResult(): ConsumedAuthCallback | null {
|
||||
|
||||
Reference in New Issue
Block a user