Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tough-students-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/desktop-api': major
---

Adds a new package (`@rocket.chat/desktop-api`) to interface the desktop app's injected context
2 changes: 1 addition & 1 deletion apps/meteor/client/definitions/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRocketChatDesktop } from './IRocketChatDesktop';
import type { IRocketChatDesktop } from '@rocket.chat/desktop-api';

declare global {
// eslint-disable-next-line @typescript-eslint/naming-convention
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@babel/register": "~7.25.9",
"@faker-js/faker": "~8.0.2",
"@playwright/test": "^1.52.0",
"@rocket.chat/desktop-api": "workspace:~",
"@rocket.chat/eslint-config": "workspace:^",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/livechat": "workspace:^",
Expand Down
4 changes: 4 additions & 0 deletions packages/desktop-api/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["@rocket.chat/eslint-config"],
"ignorePatterns": ["**/dist"]
}
27 changes: 27 additions & 0 deletions packages/desktop-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://www.schemastore.org/package",
"name": "@rocket.chat/desktop-api",
"version": "0.0.1",
"type": "module",
"exports": {
".": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"types": "./dist/index.d.ts",
"scripts": {
"build": "rimraf dist && tsc -p tsconfig.json",
"lint": "eslint",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"devDependencies": {
"@rocket.chat/eslint-config": "workspace:~",
"eslint": "~8.45.0",
"rimraf": "~6.0.1",
"typescript": "~5.9.2"
},
"volta": {
"extends": "../../package.json"
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
type ServerInfo = {
export type ServerInfo = {
version: string;
};

type Badge = '•' | number;
export type Badge = '•' | number;

type ThemeAppearance = 'dark' | 'light' | 'auto' | 'high-contrast' | undefined;
export type ThemeAppearance = 'dark' | 'light' | 'auto' | 'high-contrast' | undefined;

type VideoCallWindowOptions = {
export type VideoChatWindowOptions = {
providerName?: string | undefined;
};

type OutlookEventsResponse = { status: 'success' | 'canceled' };
export type OutlookEventsResponse = {
status: 'success' | 'canceled';
};

export interface IRocketChatDesktop {
onReady: (cb: (serverInfo: ServerInfo) => void) => void;
Expand All @@ -37,7 +39,7 @@ export interface IRocketChatDesktop {
) => Promise<unknown>;
destroyNotification: (id: unknown) => void;
getInternalVideoChatWindowEnabled: () => boolean;
openInternalVideoChatWindow: (url: string, options: VideoCallWindowOptions) => void;
openInternalVideoChatWindow: (url: string, options: VideoChatWindowOptions) => void;
setGitCommitHash: (gitCommitHash: string) => void;
writeTextToClipboard: (text: string) => void;
getOutlookEvents: (date: Date) => Promise<OutlookEventsResponse>;
Expand Down
13 changes: 13 additions & 0 deletions packages/desktop-api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "@rocket.chat/tsconfig/client.json",
"compilerOptions": {
"target": "es2024",
"module": "node20",
"moduleResolution": "node16",
"rootDir": "./src",
"outDir": "./dist",
"declarationMap": false,
"sourceMap": false
},
"include": ["src"]
}
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7250,6 +7250,17 @@ __metadata:
languageName: unknown
linkType: soft

"@rocket.chat/desktop-api@workspace:packages/desktop-api, @rocket.chat/desktop-api@workspace:~":
version: 0.0.0-use.local
resolution: "@rocket.chat/desktop-api@workspace:packages/desktop-api"
dependencies:
"@rocket.chat/eslint-config": "workspace:~"
eslint: "npm:~8.45.0"
rimraf: "npm:~6.0.1"
typescript: "npm:~5.9.2"
languageName: unknown
linkType: soft

"@rocket.chat/emitter@npm:~0.31.25":
version: 0.31.25
resolution: "@rocket.chat/emitter@npm:0.31.25"
Expand Down Expand Up @@ -7885,6 +7896,7 @@ __metadata:
"@rocket.chat/core-typings": "workspace:^"
"@rocket.chat/cron": "workspace:^"
"@rocket.chat/css-in-js": "npm:~0.31.25"
"@rocket.chat/desktop-api": "workspace:~"
"@rocket.chat/emitter": "npm:~0.31.25"
"@rocket.chat/eslint-config": "workspace:^"
"@rocket.chat/favicon": "workspace:^"
Expand Down
Loading