Skip to content

Commit

Permalink
chore: isolates CloudSyncAnnouncement to be reused as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-a-pelegrino committed Oct 22, 2024
1 parent f0e5b95 commit 2367bf6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
11 changes: 11 additions & 0 deletions packages/core-typings/src/cloud/CloudSyncAnnouncement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { CalloutBlock, ContextBlock, DividerBlock, ImageBlock, SectionBlock } from '@rocket.chat/ui-kit';

type CloudSyncAnnouncementLayoutBlock = ContextBlock | DividerBlock | ImageBlock | SectionBlock | CalloutBlock;
type CloudSyncAnnouncementLayout = CloudSyncAnnouncementLayoutBlock[];

export interface CloudSyncAnnouncement {
viewId: string;
appId: string;
blocks: CloudSyncAnnouncementLayout;
}
1 change: 1 addition & 0 deletions packages/core-typings/src/cloud/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export {
WorkspaceCommsResponsePayload,
WorkspaceInteractionResponsePayload,
} from './WorkspaceSyncPayload';
export { CloudSyncAnnouncement } from './CloudSyncAnnouncement';
3 changes: 2 additions & 1 deletion packages/core-typings/src/license/LicenseInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { CloudSyncAnnouncement } from '../cloud/CloudSyncAnnouncement';
import type { ILicenseTag } from './ILicenseTag';
import type { ExternalModule, ILicenseV3, LicenseLimitKind } from './ILicenseV3';
import type { LicenseModule } from './LicenseModule';
Expand All @@ -10,5 +11,5 @@ export type LicenseInfo = {
limits: Record<LicenseLimitKind, { value?: number; max: number }>;
tags: ILicenseTag[];
trial: boolean;
cloudSyncAnnouncement?: unknown;
cloudSyncAnnouncement?: CloudSyncAnnouncement;
};
11 changes: 2 additions & 9 deletions packages/rest-typings/src/v1/licenses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LicenseInfo } from '@rocket.chat/core-typings';
import type { CalloutBlock, ContextBlock, DividerBlock, ImageBlock, SectionBlock } from '@rocket.chat/ui-kit';
import type { CloudSyncAnnouncement } from '@rocket.chat/core-typings/dist/cloud';
import Ajv from 'ajv';

const ajv = new Ajv({
Expand Down Expand Up @@ -40,18 +40,11 @@ const licensesInfoPropsSchema = {

export const isLicensesInfoProps = ajv.compile<licensesInfoProps>(licensesInfoPropsSchema);

type CloudSyncAnnouncementLayoutBlock = ContextBlock | DividerBlock | ImageBlock | SectionBlock | CalloutBlock;
type CloudSyncAnnouncementLayout = CloudSyncAnnouncementLayoutBlock[];

export type LicensesEndpoints = {
'/v1/licenses.info': {
GET: (params: licensesInfoProps) => {
license: LicenseInfo;
cloudSyncAnnouncement?: {
viewId: string;
appId: string;
blocks: CloudSyncAnnouncementLayout;
};
cloudSyncAnnouncement?: CloudSyncAnnouncement;
};
};
'/v1/licenses.add': {
Expand Down

0 comments on commit 2367bf6

Please sign in to comment.