Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -0,0 +1,28 @@
|
||||
export type ChatMessageDeepLinkInput = Readonly<{
|
||||
tenantSlug: string;
|
||||
chatId: string;
|
||||
messageId: string;
|
||||
parentMessageId?: string | null;
|
||||
}>;
|
||||
|
||||
/** Canonical exact-message target used by notifications, pins, and search. */
|
||||
export function buildChatMessageDeepLink(input: ChatMessageDeepLinkInput): string {
|
||||
const tenantSlug = encodeURIComponent(requiredSegment(input.tenantSlug, "tenantSlug"));
|
||||
const chatId = encodeURIComponent(requiredSegment(input.chatId, "chatId"));
|
||||
const messageId = encodeURIComponent(requiredSegment(input.messageId, "messageId"));
|
||||
const parentMessageId = optionalSegment(input.parentMessageId);
|
||||
const threadPath = parentMessageId ? `/thread/${encodeURIComponent(parentMessageId)}` : "";
|
||||
|
||||
return `/${tenantSlug}/chat/${chatId}${threadPath}?message=${messageId}#message-${messageId}`;
|
||||
}
|
||||
|
||||
function requiredSegment(value: string, name: string): string {
|
||||
const normalized = value.trim();
|
||||
if (!normalized) throw new Error(`chat deep-link ${name} is required`);
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function optionalSegment(value: string | null | undefined): string | null {
|
||||
if (value === null || value === undefined) return null;
|
||||
return requiredSegment(value, "parentMessageId");
|
||||
}
|
||||
Reference in new issue
Block a user