feat: integrate Microsoft Power Apps SDK and enhance email handling
- Added dependency for @microsoft/power-apps to package.json. - Updated power.config.json to include appId, environmentId, and connection references. - Implemented sanitisation function for HTML content in App.tsx to prevent XSS. - Enhanced error handling in email loading and marking as read functionalities. - Updated email display logic to handle HTML content and previews. - Refactored OutlookService to use auto-generated service from @microsoft/power-apps. - Added new methods for sending, marking as read, and deleting emails in OutlookService. - Updated types for Email to include bodyPreview, isHtml, hasAttachments, and importance. - Configured Vite to exclude @microsoft/power-apps/data from the build. - Created .gitignore to exclude build artifacts and environment files. - Added local development shim for @microsoft/power-apps/data to support local testing. - Defined type stubs for @microsoft/power-apps/data to facilitate local development.
This commit is contained in:
@@ -5,8 +5,12 @@ export interface Email {
|
||||
to: string;
|
||||
subject: string;
|
||||
body: string;
|
||||
bodyPreview: string;
|
||||
receivedAt: string;
|
||||
isRead: boolean;
|
||||
isHtml: boolean;
|
||||
hasAttachments: boolean;
|
||||
importance: 'Low' | 'Normal' | 'High';
|
||||
folder: 'inbox' | 'sent' | 'drafts' | 'trash';
|
||||
}
|
||||
|
||||
@@ -17,8 +21,10 @@ export interface Folder {
|
||||
unreadCount: number;
|
||||
}
|
||||
|
||||
export interface UserProfile {
|
||||
displayName: string;
|
||||
email: string;
|
||||
avatar?: string;
|
||||
}
|
||||
/** Maps UI folder ids to Outlook folderPath values */
|
||||
export const FOLDER_PATH_MAP: Record<string, string> = {
|
||||
inbox: 'Inbox',
|
||||
sent: 'SentItems',
|
||||
drafts: 'Drafts',
|
||||
trash: 'DeletedItems',
|
||||
};
|
||||
|
||||
29
src/types/power-apps.d.ts
vendored
Normal file
29
src/types/power-apps.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Type stub for @microsoft/power-apps/data.
|
||||
*
|
||||
* This module is provided by the Power Platform runtime at execution time.
|
||||
* During local development / tsc type-checking it is not installed,
|
||||
* so we declare just enough types for the generated service to compile.
|
||||
*/
|
||||
declare module '@microsoft/power-apps/data' {
|
||||
export interface IOperationResult<T> {
|
||||
data?: T;
|
||||
error?: { message: string; code?: string };
|
||||
}
|
||||
|
||||
export interface ConnectorOperation {
|
||||
tableName: string;
|
||||
operationName: string;
|
||||
parameters?: unknown;
|
||||
}
|
||||
|
||||
export interface ExecuteRequest {
|
||||
connectorOperation: ConnectorOperation;
|
||||
}
|
||||
|
||||
export interface IClient {
|
||||
executeAsync<TParams, TResult>(request: ExecuteRequest): Promise<IOperationResult<TResult>>;
|
||||
}
|
||||
|
||||
export function getClient(dataSourcesInfo: unknown): IClient;
|
||||
}
|
||||
Reference in New Issue
Block a user