fix(infra): restore approval account binding compatibility

feature/PAZ-358-fe-credit-error-display
Peter Steinberger 8 months ago
parent af7c6f4c68
commit 21ca006eca
No known key found for this signature in database

@ -80,7 +80,13 @@ export function resolveApprovalRequestChannelAccountId(params: {
if (!expectedChannel) {
return null;
}
return resolveApprovalRequestAccountId(params);
const turnSourceChannel = normalizeOptionalChannel(params.request.request.turnSourceChannel);
if (!turnSourceChannel || turnSourceChannel === expectedChannel) {
return resolveApprovalRequestAccountId(params);
}
const sessionBinding = resolvePersistedApprovalRequestSessionBinding(params);
return sessionBinding?.channel === expectedChannel ? (sessionBinding.accountId ?? null) : null;
}
export function doesApprovalRequestMatchChannelAccount(params: {

@ -8,6 +8,12 @@ import type { ExecApprovalRequest } from "./exec-approvals.js";
import { resolveSessionDeliveryTarget } from "./outbound/targets.js";
import type { PluginApprovalRequest } from "./plugin-approvals.js";
export {
doesApprovalRequestMatchChannelAccount,
resolveApprovalRequestAccountId,
resolveApprovalRequestChannelAccountId,
} from "./approval-request-account-binding.js";
export type ExecApprovalSessionTarget = {
channel?: string;
to: string;

Loading…
Cancel
Save