feat: expand live chat and work server tools

This commit is contained in:
2026-04-30 11:40:02 +09:00
parent 42ae640470
commit 2df0ba30cb
112 changed files with 15241 additions and 996 deletions

View File

@@ -77,6 +77,9 @@ export type ClientNotificationPayload = {
body: string;
data?: Record<string, string>;
threadId?: string;
targetClientIds?: string[];
targetAppOrigins?: string[];
targetAppDomains?: string[];
};
export type ClientNotificationSendResult = {
@@ -100,8 +103,26 @@ export type ClientNotificationSendResult = {
export type PwaNotificationTokenPayload = {
token: string;
deviceId?: string;
appOrigin?: string;
appDomain?: string;
};
function getCurrentAppOrigin() {
if (typeof window === 'undefined') {
return '';
}
return window.location.origin;
}
function getCurrentAppDomain() {
if (typeof window === 'undefined') {
return '';
}
return window.location.hostname;
}
export type NotificationMessagePriority = 'low' | 'normal' | 'high' | 'urgent';
export type NotificationMessageListStatus = 'all' | 'unread';
export const NOTIFICATION_MESSAGES_UPDATED_EVENT = 'work-server.notification-messages-updated';
@@ -724,6 +745,8 @@ export async function registerWebPushSubscription(
subscription,
deviceId,
userAgent: typeof navigator !== 'undefined' ? navigator.userAgent : '',
appOrigin: getCurrentAppOrigin(),
appDomain: getCurrentAppDomain(),
enabled: true,
}),
});
@@ -744,6 +767,8 @@ export async function registerPwaNotificationToken(payload: PwaNotificationToken
body: JSON.stringify({
token: payload.token,
deviceId: payload.deviceId,
appOrigin: payload.appOrigin || getCurrentAppOrigin(),
appDomain: payload.appDomain || getCurrentAppDomain(),
enabled: true,
}),
});