refactor: share onboarding account id resolution prelude

This commit is contained in:
Peter Steinberger
2026-03-07 20:54:47 +00:00
parent 168e4159ad
commit f0b05869fc
18 changed files with 105 additions and 117 deletions

View File

@@ -10,8 +10,8 @@ import {
formatResolvedUnresolvedNote,
mergeAllowFromEntries,
normalizeAccountId,
promptAccountId,
promptChannelAccessConfig,
resolveAccountIdForConfigure,
} from "openclaw/plugin-sdk/zalouser";
import {
listZalouserAccountIds,
@@ -226,20 +226,16 @@ export const zalouserOnboardingAdapter: ChannelOnboardingAdapter = {
shouldPromptAccountIds,
forceAllowFrom,
}) => {
const zalouserOverride = accountOverrides.zalouser?.trim();
const defaultAccountId = resolveDefaultZalouserAccountId(cfg);
let accountId = zalouserOverride ? normalizeAccountId(zalouserOverride) : defaultAccountId;
if (shouldPromptAccountIds && !zalouserOverride) {
accountId = await promptAccountId({
cfg,
prompter,
label: "Zalo Personal",
currentId: accountId,
listAccountIds: listZalouserAccountIds,
defaultAccountId,
});
}
const accountId = await resolveAccountIdForConfigure({
cfg,
prompter,
label: "Zalo Personal",
accountOverride: accountOverrides.zalouser,
shouldPromptAccountIds,
listAccountIds: listZalouserAccountIds,
defaultAccountId,
});
let next = cfg;
const account = resolveZalouserAccountSync({ cfg: next, accountId });