export interface UserInfo { name: string; email: string; picture: string; } export interface DriveFile { id: string; name: string; size: string; modifiedTime: string; mimeType: string; driveId: string; /** Picker `@sharePoint.endpoint` — needed to resolve consumer download URLs. */ sharePointEndpoint?: string; /** Short-lived preauthenticated URL, if already known. */ downloadUrl?: string; } type DriveKind = 'personal' | 'business'; /** Options for constructing {@link OneDriveClient}. */ export interface OneDriveClientOptions { /** Azure AD SPA application (client) ID. */ clientId: string; /** Tenant id or `common` / `organizations` / `consumers`. Defaults to `common`. */ tenantId?: string; /** * MSAL redirect URI. Defaults to the current page URL (origin + path, no * query/hash) so GitHub Pages subpaths such as `/cad-viewer/cad-viewer/` * match the Azure SPA registration. */ redirectUri?: string; } /** * Builds the default MSAL redirect URI from a page href. * Query and hash are stripped. `index.html` is normalized to the directory URL. */ export declare function resolveDefaultRedirectUri(href: string): string; /** Command payload used to choose File Picker v8 token scopes. */ export interface OneDrivePickerAuthCommand { type: string; resource: string; } /** * Returns MSAL scopes for a File Picker `authenticate` command. * * Personal / consumer hosts use Live `OneDrive.ReadOnly`. Work accounts that * send `type: 'Graph'` must use Graph scopes, not consumer OneDrive scopes. */ export declare function resolveOneDrivePickerScopes(driveKind: DriveKind | null, command: OneDrivePickerAuthCommand): string[]; /** * Whether a URL is a Microsoft Graph / OneDrive / SharePoint resource that may * receive a bearer token from this client. */ export declare function isAllowedMicrosoftResourceUrl(url: string): boolean; /** * Whether a `postMessage` origin is the expected OneDrive / SharePoint picker. */ export declare function isAllowedPickerMessageOrigin(origin: string, driveKind: DriveKind | null, driveWebUrl: string): boolean; export declare class OneDriveClient { private readonly clientId; private readonly tenantId; private readonly redirectUri; private msal; private account; private driveKind; private driveWebUrl; private ready; isAuthenticated: boolean; userInfo: UserInfo; constructor(options: OneDriveClientOptions); /** Azure SPA client ID must be set. */ isConfigured(): boolean; private buildMsalConfig; initialize(): Promise; private setAccount; private ensureMsal; private acquireToken; private pickerScopes; private getTokenForCommand; private graphGet; private loadProfileAndDrive; authenticate(options?: { loginHint?: string; }): Promise; signOut(): Promise; /** * Resolve a File Handler activation URL * (`https://graph.microsoft.com/v1.0/.../items/{id}`) to a drive file. */ getFileFromGraphItemUrl(itemUrl: string): Promise; graphItemUrl(driveId: string, itemId: string): string; /** * Find a DWG/DXF in the signed-in user's drive for the local File Handler demo. */ findCadPreviewItemUrl(): Promise; private cadItemUrl; private searchCadItem; private firstRecentCadItem; getFileDetails(driveId: string, itemId: string): Promise; getFileContent(file: DriveFile): Promise; private itemApiUrl; private scopesForEndpoint; private fetchDriveItem; /** * Graph `$select=@microsoft.graph.downloadUrl` often returns only `id` (the `@` * annotation is dropped). Personal picks need the picker SharePoint endpoint and * `@content.downloadUrl` with an OneDrive.ReadOnly token. */ private resolveDownloadUrl; private driveFileFromPickedItem; /** * Opens Microsoft’s OneDrive / SharePoint File Picker v8 and resolves with the chosen CAD file. */ openFilePicker(win: Window): Promise; private launchPickerWindow; /** Deep-link helper: ?driveId=&itemId= (optional open from another host). */ parseOpenActionFromUrl(): { driveId: string; itemId: string; } | null; } export {}; //# sourceMappingURL=oneDriveClient.d.ts.map