Skip to content

Commit

Permalink
Expand Cloud.Announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Sep 15, 2023
1 parent 0a8d1de commit e3b2df5
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 42 deletions.
28 changes: 28 additions & 0 deletions packages/core-typings/src/cloud/Announcement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable @typescript-eslint/naming-convention */

import type { IRocketChatRecord } from '../IRocketChatRecord';
import { type UiKitPayload } from '../UIKit';

type TargetPlatform = 'web' | 'mobile';

type Dictionary = {
[lng: string]: {
[key: string]: string;
};
};

type Creator = 'cloud' | 'system';

export interface Announcement extends IRocketChatRecord {
selector?: {
roles?: string[];
};
platform: TargetPlatform[];
expireAt: Date;
startAt: Date;
createdBy: Creator;
createdAt: Date;
dictionary?: Dictionary;
view: UiKitPayload;
surface: 'banner' | 'modal';
}
7 changes: 7 additions & 0 deletions packages/core-typings/src/cloud/NpsSurveyAnnouncement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */

export interface NpsSurveyAnnouncement {
id: string;
startAt: Date;
expireAt: Date;
}
33 changes: 33 additions & 0 deletions packages/core-typings/src/cloud/SyncPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable @typescript-eslint/naming-convention */

import type { IBanner } from '../IBanner';
import type { Announcement } from './Announcement';
import type { NpsSurveyAnnouncement } from './NpsSurveyAnnouncement';

export interface SyncPayload {
workspaceId: string;
publicKey?: string;
announcements?: {
create: Announcement[];
delete: Announcement['id'][];
};
trial?: {
trialing: boolean;
trialId: string;
endDate: Date;
marketing: {
utmContent: string;
utmMedium: string;
utmSource: string;
utmCampaign: string;
};
DowngradesToPlan: {
id: string;
};
trialRequested: boolean;
};
/** @deprecated */
nps?: NpsSurveyAnnouncement;
/** @deprecated */
banners?: IBanner[];
}
45 changes: 3 additions & 42 deletions packages/core-typings/src/cloud/index.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-interface */
/* eslint-disable @typescript-eslint/naming-convention */

import type { IBanner } from '../IBanner';

export interface Announcement {
id: string;
}

export interface NpsSurveyAnnouncement {
id: string;
startAt: Date;
expireAt: Date;
}

export interface SyncPayload {
workspaceId: string;
publicKey?: string;
announcements?: {
create: Announcement[];
delete: Announcement['id'][];
};
trial?: {
trialing: boolean;
trialId: string;
endDate: Date;
marketing: {
utmContent: string;
utmMedium: string;
utmSource: string;
utmCampaign: string;
};
DowngradesToPlan: {
id: string;
};
trialRequested: boolean;
};
/** @deprecated */
nps?: NpsSurveyAnnouncement;
/** @deprecated */
banners?: IBanner[];
}
export { Announcement } from './Announcement';
export { NpsSurveyAnnouncement } from './NpsSurveyAnnouncement';
export { SyncPayload } from './SyncPayload';

0 comments on commit e3b2df5

Please sign in to comment.