openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
30 lines (29 loc) • 1.48 kB
JavaScript
import { a as normalizeLowercaseStringOrEmpty } from "./string-coerce-DW4mBlAt.js";
import "./string-coerce-runtime-BtLK_KtO.js";
import { t as resolveApprovalApprovers } from "./approval-approvers-Rslf6S0G.js";
import { t as createResolvedApproverActionAuthAdapter } from "./approval-auth-helpers-Xdjt6p1L.js";
import { i as resolveGoogleChatAccount } from "./accounts-98Qf2wh-.js";
import { n as isGoogleChatUserTarget, r as normalizeGoogleChatTarget } from "./targets-VjbV0vy6.js";
//#region extensions/googlechat/src/approval-auth.ts
function normalizeGoogleChatApproverId(value) {
const normalized = normalizeGoogleChatTarget(String(value));
if (!normalized || !isGoogleChatUserTarget(normalized)) return;
const suffix = normalizeLowercaseStringOrEmpty(normalized.slice(6));
if (!suffix || suffix.includes("@")) return;
return `users/${suffix}`;
}
function getGoogleChatApprovalApprovers(params) {
const account = resolveGoogleChatAccount(params).config;
return resolveApprovalApprovers({
allowFrom: account.dm?.allowFrom,
defaultTo: account.defaultTo,
normalizeApprover: normalizeGoogleChatApproverId
});
}
const googleChatApprovalAuth = createResolvedApproverActionAuthAdapter({
channelLabel: "Google Chat",
resolveApprovers: getGoogleChatApprovalApprovers,
normalizeSenderId: (value) => normalizeGoogleChatApproverId(value)
});
//#endregion
export { googleChatApprovalAuth as n, normalizeGoogleChatApproverId as r, getGoogleChatApprovalApprovers as t };