@medipha/feed 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- export declare const FEED_ERROR_CODES: readonly ["FEED_UNAUTHORIZED", "FEED_ERP_UNAVAILABLE", "FEED_POST_NOT_FOUND", "FEED_COMMENT_NOT_FOUND", "FEED_POST_FORBIDDEN", "FEED_FORBIDDEN", "FEED_POST_STATUS_INVALID", "FEED_POST_LOCKED", "FEED_POST_ALREADY_SHARED", "FEED_COMMENTS_LOCKED", "FEED_CATEGORY_NOT_FOUND", "FEED_CATEGORY_INVALID", "FEED_CATEGORY_IN_USE", "FEED_POST_EMPTY", "FEED_COMMENT_EMPTY", "FEED_MENTION_INVALID", "FEED_MEDIA_LIMIT_EXCEEDED", "FEED_MEDIA_INVALID", "FEED_MEDIA_KIND_INVALID", "FEED_MEDIA_UPLOAD_FAILED", "FEED_LINK_PREVIEW_URL_INVALID"];
1
+ export declare const FEED_ERROR_CODES: readonly ["FEED_UNAUTHORIZED", "FEED_ERP_UNAVAILABLE", "FEED_POST_NOT_FOUND", "FEED_COMMENT_NOT_FOUND", "FEED_POST_FORBIDDEN", "FEED_FORBIDDEN", "FEED_POST_STATUS_INVALID", "FEED_POST_LOCKED", "FEED_POST_ALREADY_SHARED", "FEED_COMMENTS_LOCKED", "FEED_CATEGORY_NOT_FOUND", "FEED_CATEGORY_INVALID", "FEED_CATEGORY_IN_USE", "FEED_EVENT_NOT_FOUND", "FEED_EVENT_INVALID", "FEED_BANNER_INVALID", "FEED_POST_EMPTY", "FEED_COMMENT_EMPTY", "FEED_MENTION_INVALID", "FEED_MEDIA_LIMIT_EXCEEDED", "FEED_MEDIA_INVALID", "FEED_MEDIA_KIND_INVALID", "FEED_MEDIA_UPLOAD_FAILED", "FEED_LINK_PREVIEW_URL_INVALID"];
2
2
  export type FeedErrorCode = (typeof FEED_ERROR_CODES)[number];
3
3
  export declare class FeedApiError extends Error {
4
4
  readonly status: number;
@@ -1,5 +1,5 @@
1
1
  import { FeedApiConfig } from './http';
2
- import { CursorPage, DepartmentEngagement, FeedBirthday, FeedCategory, FeedComment, FeedBranch, FeedDepartment, UserSearchFilter, FeedMe, FeedMedia, FeedMention, FeedPost, FeedUser, LinkPreview, ManageCounts, OffsetPage, PostStatus, ReactionSummary, ReactorPage, ReactionType, ReportGroupBy, ReportsOverview, ReportsTimeseriesPoint, ShareChannel, ShareResult, TopPostSort, TopUser, TrendingHashtag } from './types';
2
+ import { CursorPage, DepartmentEngagement, FeedBirthday, FeedEvent, FeedBanner, BannerInput, EventInput, FeedCategory, FeedComment, FeedBranch, FeedDepartment, UserSearchFilter, FeedMe, FeedMedia, FeedMention, FeedPost, FeedUser, LinkPreview, ManageCounts, OffsetPage, PostStatus, ReactionSummary, ReactorPage, ReactionType, ReportGroupBy, ReportsOverview, ReportsTimeseriesPoint, ShareChannel, ShareResult, TopPostSort, TopUser, TrendingHashtag } from './types';
3
3
  export interface CursorParams {
4
4
  cursor?: string | null;
5
5
  limit?: number;
@@ -75,6 +75,8 @@ export declare function createFeedApi(config: FeedApiConfig): {
75
75
  listCategories: (signal?: AbortSignal) => Promise<FeedCategory[]>;
76
76
  listMentions: (params?: CursorParams, signal?: AbortSignal) => Promise<CursorPage<FeedMention>>;
77
77
  listTodayBirthdays: (signal?: AbortSignal) => Promise<FeedBirthday[]>;
78
+ getRightBanner: (signal?: AbortSignal) => Promise<FeedBanner>;
79
+ listLatestEvents: (signal?: AbortSignal) => Promise<FeedEvent[]>;
78
80
  listTrendingHashtags: (signal?: AbortSignal) => Promise<TrendingHashtag[]>;
79
81
  getPost: (postId: string, signal?: AbortSignal) => Promise<FeedPost>;
80
82
  listMyPosts: (params?: ListMyPostsParams, signal?: AbortSignal) => Promise<CursorPage<FeedPost>>;
@@ -95,6 +97,13 @@ export declare function createFeedApi(config: FeedApiConfig): {
95
97
  deleteCategory: (categoryId: string) => Promise<void>;
96
98
  createCategory: (input: CategoryInput) => Promise<FeedCategory>;
97
99
  updateCategory: (categoryId: string, input: Partial<CategoryInput>) => Promise<FeedCategory>;
100
+ setRightBanner: (input: BannerInput) => Promise<FeedBanner>;
101
+ clearRightBanner: () => Promise<void>;
102
+ /** Every event, newest first; managers only. */
103
+ listManageEvents: (signal?: AbortSignal) => Promise<FeedEvent[]>;
104
+ createEvent: (input: EventInput) => Promise<FeedEvent>;
105
+ updateEvent: (eventId: string, input: Partial<EventInput>) => Promise<FeedEvent>;
106
+ deleteEvent: (eventId: string) => Promise<void>;
98
107
  approvePost: (postId: string) => Promise<FeedPost>;
99
108
  /** APPROVED → PUBLISHED: the post goes live on the feed. */
100
109
  publishPost: (postId: string) => Promise<FeedPost>;
@@ -13,4 +13,4 @@ export type { RichSegment } from './content';
13
13
  export { serializeQuery } from './query-string';
14
14
  export type { QueryParams, QueryValue } from './query-string';
15
15
  export { REACTION_TYPES } from './types';
16
- export type { CursorPage, DepartmentEngagement, FeedBirthday, FeedCategory, FeedComment, FeedBranch, FeedDepartment, UserSearchFilter, FeedMe, FeedMedia, FeedMention, FeedPost, FeedUser, LinkPreview, LinkPreviewKind, ManageCounts, MediaKind, OffsetPage, PostStatus, ReactionSummary, FeedReactor, ReactorPage, ReactionType, ReportGroupBy, ReportsOverview, ReportsTimeseriesPoint, ShareChannel, ShareResult, TopPostSort, TopUser, TrendingHashtag, } from './types';
16
+ export type { CursorPage, DepartmentEngagement, FeedBirthday, FeedEvent, FeedBanner, BannerInput, EventInput, FeedCategory, FeedComment, FeedBranch, FeedDepartment, UserSearchFilter, FeedMe, FeedMedia, FeedMention, FeedPost, FeedUser, LinkPreview, LinkPreviewKind, ManageCounts, MediaKind, OffsetPage, PostStatus, ReactionSummary, FeedReactor, ReactorPage, ReactionType, ReportGroupBy, ReportsOverview, ReportsTimeseriesPoint, ShareChannel, ShareResult, TopPostSort, TopUser, TrendingHashtag, } from './types';
@@ -206,3 +206,30 @@ export interface TopUser {
206
206
  shares: number;
207
207
  total: number;
208
208
  }
209
+ export interface FeedEvent {
210
+ id: string;
211
+ title: string;
212
+ startsAt: string;
213
+ endsAt: string | null;
214
+ location: string | null;
215
+ description: string | null;
216
+ imageUrl: string;
217
+ createdAt: string;
218
+ }
219
+ export interface EventInput {
220
+ title: string;
221
+ startsAt: string;
222
+ endsAt?: string | null;
223
+ location?: string | null;
224
+ description?: string | null;
225
+ imageUrl: string;
226
+ }
227
+ /** Both fields are null while no banner is set. */
228
+ export interface FeedBanner {
229
+ imageUrl: string | null;
230
+ linkUrl: string | null;
231
+ }
232
+ export interface BannerInput {
233
+ imageUrl: string;
234
+ linkUrl?: string | null;
235
+ }
@@ -0,0 +1,2 @@
1
+ /** The advertising banner under the events; nothing renders until a manager sets one. */
2
+ export declare function BannerWidget(): import('react/jsx-runtime').JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Right-column event in the "sponsored" card style: a square thumbnail beside the title and
3
+ * time, for the newest event only. Clicking the card opens its details.
4
+ */
5
+ export declare function EventsWidget(): import('react/jsx-runtime').JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ export declare function formatEventTime(startsAt: string, endsAt: string | null): string;
2
+ export type EventPhase = 'upcoming' | 'ongoing' | 'ended';
3
+ /** An event without an end is taken to last through the end of its start day. */
4
+ export declare function eventPhase(startsAt: string, endsAt: string | null, now?: number): EventPhase;
@@ -0,0 +1,2 @@
1
+ /** Admin settings: upload, replace or remove the banner under the events in the right column. */
2
+ export declare function BannerSettingsPage(): import('react/jsx-runtime').JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** Admin: create, edit and delete the events shown in the newsfeed right column. */
2
+ export declare function EventsAdminPage(): import('react/jsx-runtime').JSX.Element;