docviewhelper 0.0.2 → 0.1.0
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.
- package/index.d.mts +54 -0
- package/index.d.ts +54 -0
- package/index.js +149 -3082
- package/index.js.map +1 -0
- package/index.mjs +242 -0
- package/index.mjs.map +1 -0
- package/package.json +11 -5
- package/README.md +0 -3
- package/src/index.d.ts +0 -2
- package/src/lib/helper.d.ts +0 -25
- package/src/lib/helper.test.d.ts +0 -1
- package/src/lib/model.d.ts +0 -17
package/index.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type ViewerType = 'google' | 'office' | 'mammoth' | 'pdf' | 'url';
|
|
2
|
+
type ViewerRenderPhase = 'idle' | 'loading' | 'ready' | 'error';
|
|
3
|
+
type ViewerRecoveryMode = 'google-probe' | 'google-final-retry' | 'office-auto-retry';
|
|
4
|
+
interface ViewerRecoveryPlan {
|
|
5
|
+
modes: ViewerRecoveryMode[];
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
loaded?: () => void;
|
|
9
|
+
url: string;
|
|
10
|
+
queryParams?: string;
|
|
11
|
+
viewerUrl?: string;
|
|
12
|
+
googleCheckInterval?: number;
|
|
13
|
+
disableContent?: 'none' | 'all' | 'poput' | 'popout-hide';
|
|
14
|
+
googleCheckContentLoaded?: boolean;
|
|
15
|
+
viewer?: ViewerType;
|
|
16
|
+
}
|
|
17
|
+
interface IFrameReloader {
|
|
18
|
+
subscribe: (iframe: HTMLIFrameElement, interval?: number, maxChecks?: number) => any;
|
|
19
|
+
unsubscribe: () => void;
|
|
20
|
+
}
|
|
21
|
+
declare const defaultProps: Props;
|
|
22
|
+
|
|
23
|
+
declare const fileToArray: (url: string) => Promise<ArrayBuffer>;
|
|
24
|
+
declare const timeout: (ms: number) => Promise<unknown>;
|
|
25
|
+
declare const handleFileUpload: (fileInput: any) => Promise<string>;
|
|
26
|
+
declare const getbaseUrl: () => string;
|
|
27
|
+
declare const getLocation: (href: string) => {
|
|
28
|
+
href: string;
|
|
29
|
+
protocol: string;
|
|
30
|
+
host: string;
|
|
31
|
+
hostname: string;
|
|
32
|
+
port: string;
|
|
33
|
+
pathname: string;
|
|
34
|
+
search: string;
|
|
35
|
+
hash: string;
|
|
36
|
+
} | null;
|
|
37
|
+
declare const getDocxToHtml: (url: string) => Promise<any>;
|
|
38
|
+
declare const googleCheckSubscription: () => IFrameReloader;
|
|
39
|
+
declare const iframeIsLoaded: (iframe: HTMLIFrameElement) => boolean;
|
|
40
|
+
declare const getViewerDetails: (url: string, configuredViewer?: ViewerType, queryParams?: string, viewerUrl?: string) => {
|
|
41
|
+
url: string;
|
|
42
|
+
externalViewer: boolean;
|
|
43
|
+
};
|
|
44
|
+
declare const getViewerRecoveryPlan: ({ viewer, googleCheckContentLoaded, googleFinalRetryDelay, officeAutoRetry, }: {
|
|
45
|
+
viewer: ViewerType;
|
|
46
|
+
googleCheckContentLoaded?: boolean;
|
|
47
|
+
googleFinalRetryDelay?: number;
|
|
48
|
+
officeAutoRetry?: boolean;
|
|
49
|
+
}) => ViewerRecoveryPlan;
|
|
50
|
+
declare const replaceLocalUrl: (url: string, overrideLocalhost: string) => string;
|
|
51
|
+
declare const uploadToCloud: (fileUrl: string, api: string) => Promise<unknown>;
|
|
52
|
+
declare const isLocalFile: (file: string) => boolean;
|
|
53
|
+
|
|
54
|
+
export { type IFrameReloader, type ViewerRecoveryMode, type ViewerRecoveryPlan, type ViewerRenderPhase, type ViewerType, defaultProps, fileToArray, getDocxToHtml, getLocation, getViewerDetails, getViewerRecoveryPlan, getbaseUrl, googleCheckSubscription, handleFileUpload, iframeIsLoaded, isLocalFile, replaceLocalUrl, timeout, uploadToCloud };
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type ViewerType = 'google' | 'office' | 'mammoth' | 'pdf' | 'url';
|
|
2
|
+
type ViewerRenderPhase = 'idle' | 'loading' | 'ready' | 'error';
|
|
3
|
+
type ViewerRecoveryMode = 'google-probe' | 'google-final-retry' | 'office-auto-retry';
|
|
4
|
+
interface ViewerRecoveryPlan {
|
|
5
|
+
modes: ViewerRecoveryMode[];
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
loaded?: () => void;
|
|
9
|
+
url: string;
|
|
10
|
+
queryParams?: string;
|
|
11
|
+
viewerUrl?: string;
|
|
12
|
+
googleCheckInterval?: number;
|
|
13
|
+
disableContent?: 'none' | 'all' | 'poput' | 'popout-hide';
|
|
14
|
+
googleCheckContentLoaded?: boolean;
|
|
15
|
+
viewer?: ViewerType;
|
|
16
|
+
}
|
|
17
|
+
interface IFrameReloader {
|
|
18
|
+
subscribe: (iframe: HTMLIFrameElement, interval?: number, maxChecks?: number) => any;
|
|
19
|
+
unsubscribe: () => void;
|
|
20
|
+
}
|
|
21
|
+
declare const defaultProps: Props;
|
|
22
|
+
|
|
23
|
+
declare const fileToArray: (url: string) => Promise<ArrayBuffer>;
|
|
24
|
+
declare const timeout: (ms: number) => Promise<unknown>;
|
|
25
|
+
declare const handleFileUpload: (fileInput: any) => Promise<string>;
|
|
26
|
+
declare const getbaseUrl: () => string;
|
|
27
|
+
declare const getLocation: (href: string) => {
|
|
28
|
+
href: string;
|
|
29
|
+
protocol: string;
|
|
30
|
+
host: string;
|
|
31
|
+
hostname: string;
|
|
32
|
+
port: string;
|
|
33
|
+
pathname: string;
|
|
34
|
+
search: string;
|
|
35
|
+
hash: string;
|
|
36
|
+
} | null;
|
|
37
|
+
declare const getDocxToHtml: (url: string) => Promise<any>;
|
|
38
|
+
declare const googleCheckSubscription: () => IFrameReloader;
|
|
39
|
+
declare const iframeIsLoaded: (iframe: HTMLIFrameElement) => boolean;
|
|
40
|
+
declare const getViewerDetails: (url: string, configuredViewer?: ViewerType, queryParams?: string, viewerUrl?: string) => {
|
|
41
|
+
url: string;
|
|
42
|
+
externalViewer: boolean;
|
|
43
|
+
};
|
|
44
|
+
declare const getViewerRecoveryPlan: ({ viewer, googleCheckContentLoaded, googleFinalRetryDelay, officeAutoRetry, }: {
|
|
45
|
+
viewer: ViewerType;
|
|
46
|
+
googleCheckContentLoaded?: boolean;
|
|
47
|
+
googleFinalRetryDelay?: number;
|
|
48
|
+
officeAutoRetry?: boolean;
|
|
49
|
+
}) => ViewerRecoveryPlan;
|
|
50
|
+
declare const replaceLocalUrl: (url: string, overrideLocalhost: string) => string;
|
|
51
|
+
declare const uploadToCloud: (fileUrl: string, api: string) => Promise<unknown>;
|
|
52
|
+
declare const isLocalFile: (file: string) => boolean;
|
|
53
|
+
|
|
54
|
+
export { type IFrameReloader, type ViewerRecoveryMode, type ViewerRecoveryPlan, type ViewerRenderPhase, type ViewerType, defaultProps, fileToArray, getDocxToHtml, getLocation, getViewerDetails, getViewerRecoveryPlan, getbaseUrl, googleCheckSubscription, handleFileUpload, iframeIsLoaded, isLocalFile, replaceLocalUrl, timeout, uploadToCloud };
|