@rhc-office/sdk 6.6.256 → 6.6.264
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/README.md +63 -3
- package/dist/api/document-sdk.d.ts +0 -4
- package/dist/api/document-sdk.d.ts.map +1 -1
- package/dist/browser/document-viewer.js +2 -0
- package/dist/browser/document-viewer.js.map +1 -0
- package/dist/browser.d.ts +33 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/viewer/ReaderConfiguration.d.ts +1 -1
- package/dist/viewer/ReaderConfiguration.d.ts.map +1 -1
- package/package.json +12 -2
- package/src/api/document-sdk.ts +0 -4
- package/src/browser.ts +85 -0
- package/src/viewer/DocumentSDK.ts +2 -2
- package/src/viewer/ReaderConfiguration.ts +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IReaderEmbedOptions } from '../api/document-sdk';
|
|
2
2
|
export type SupportedReaderTheme = 'light' | 'dark' | 'high-contrast' | 'auto';
|
|
3
3
|
export interface NormalizedReaderEmbedOptions extends IReaderEmbedOptions {
|
|
4
|
-
|
|
4
|
+
appUrl: string;
|
|
5
5
|
scrollIntoView: boolean;
|
|
6
6
|
theme?: SupportedReaderTheme;
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReaderConfiguration.d.ts","sourceRoot":"","sources":["../../src/viewer/ReaderConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC;AAE/E,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB;IACvE,
|
|
1
|
+
{"version":3,"file":"ReaderConfiguration.d.ts","sourceRoot":"","sources":["../../src/viewer/ReaderConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC;AAE/E,MAAM,WAAW,4BAA6B,SAAQ,mBAAmB;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAwBD,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAQhD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,KAAG,MAEnD,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,QAAQ,MAAM,EACd,eAAe,mBAAmB,KACjC,4BASF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhc-office/sdk",
|
|
3
|
-
"version": "6.6.
|
|
3
|
+
"version": "6.6.264",
|
|
4
4
|
"description": "SDK for third-party integration with RHC Office Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
|
+
"browser": "dist/browser/document-viewer.js",
|
|
9
|
+
"unpkg": "dist/browser/document-viewer.js",
|
|
10
|
+
"jsdelivr": "dist/browser/document-viewer.js",
|
|
8
11
|
"types": "dist/index.d.ts",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"import": "./dist/index.js",
|
|
12
15
|
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./browser": {
|
|
18
|
+
"types": "./dist/browser.d.ts",
|
|
19
|
+
"default": "./dist/browser/document-viewer.js"
|
|
13
20
|
}
|
|
14
21
|
},
|
|
15
22
|
"files": [
|
|
@@ -21,7 +28,10 @@
|
|
|
21
28
|
"registry": "https://registry.npmjs.org/"
|
|
22
29
|
},
|
|
23
30
|
"scripts": {
|
|
24
|
-
"build": "npm run clean &&
|
|
31
|
+
"build": "npm run clean && npm run build:module && npm run build:browser && npm run build:types",
|
|
32
|
+
"build:module": "vite build",
|
|
33
|
+
"build:browser": "vite build --config vite.browser.config.ts && node scripts/copy-browser-bundle.cjs",
|
|
34
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
25
35
|
"dev": "vite build --watch",
|
|
26
36
|
"clean": "rm -rf dist",
|
|
27
37
|
"prepublishOnly": "npm run build && npm pack --dry-run",
|
package/src/api/document-sdk.ts
CHANGED
package/src/browser.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DIGITAL_SIGN_DEFAULTS,
|
|
3
|
+
DocumentSDK,
|
|
4
|
+
WatermarkDisplay,
|
|
5
|
+
createNewDocumentSdk,
|
|
6
|
+
getDigitalSignEnvironment,
|
|
7
|
+
initializeDigitalSignEnvironment,
|
|
8
|
+
patchDigitalSignEnvironment,
|
|
9
|
+
resetDigitalSignEnvironment,
|
|
10
|
+
setDigitalSignEnvironment,
|
|
11
|
+
} from './index';
|
|
12
|
+
import type { IDocumentSDK } from './api/document-sdk';
|
|
13
|
+
|
|
14
|
+
export interface RHCOfficeSDKBrowserNamespace {
|
|
15
|
+
DocumentSDK: typeof DocumentSDK;
|
|
16
|
+
WatermarkDisplay: typeof WatermarkDisplay;
|
|
17
|
+
DIGITAL_SIGN_DEFAULTS: typeof DIGITAL_SIGN_DEFAULTS;
|
|
18
|
+
createNewDocumentSdk: typeof createNewDocumentSdk;
|
|
19
|
+
newDocumentSDK: typeof createNewDocumentSdk;
|
|
20
|
+
getDigitalSignEnvironment: typeof getDigitalSignEnvironment;
|
|
21
|
+
initializeDigitalSignEnvironment: typeof initializeDigitalSignEnvironment;
|
|
22
|
+
patchDigitalSignEnvironment: typeof patchDigitalSignEnvironment;
|
|
23
|
+
resetDigitalSignEnvironment: typeof resetDigitalSignEnvironment;
|
|
24
|
+
setDigitalSignEnvironment: typeof setDigitalSignEnvironment;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const RHCOfficeSDK: RHCOfficeSDKBrowserNamespace = {
|
|
28
|
+
DocumentSDK,
|
|
29
|
+
WatermarkDisplay,
|
|
30
|
+
DIGITAL_SIGN_DEFAULTS,
|
|
31
|
+
createNewDocumentSdk,
|
|
32
|
+
newDocumentSDK: createNewDocumentSdk,
|
|
33
|
+
getDigitalSignEnvironment,
|
|
34
|
+
initializeDigitalSignEnvironment,
|
|
35
|
+
patchDigitalSignEnvironment,
|
|
36
|
+
resetDigitalSignEnvironment,
|
|
37
|
+
setDigitalSignEnvironment,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const installBrowserDocumentAPI = (targetDocument: Document): void => {
|
|
41
|
+
Object.entries(RHCOfficeSDK).forEach(([property, value]) => {
|
|
42
|
+
Object.defineProperty(targetDocument, property, {
|
|
43
|
+
configurable: true,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
value,
|
|
46
|
+
writable: true,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
targetDocument.RHCOfficeSDK = RHCOfficeSDK;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
if (typeof document !== 'undefined') {
|
|
54
|
+
installBrowserDocumentAPI(document);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare global {
|
|
58
|
+
interface Document {
|
|
59
|
+
DocumentSDK: typeof DocumentSDK;
|
|
60
|
+
WatermarkDisplay: typeof WatermarkDisplay;
|
|
61
|
+
DIGITAL_SIGN_DEFAULTS: typeof DIGITAL_SIGN_DEFAULTS;
|
|
62
|
+
createNewDocumentSdk: typeof createNewDocumentSdk;
|
|
63
|
+
newDocumentSDK(options?: ConstructorParameters<typeof DocumentSDK>[0]): IDocumentSDK;
|
|
64
|
+
getDigitalSignEnvironment: typeof getDigitalSignEnvironment;
|
|
65
|
+
initializeDigitalSignEnvironment: typeof initializeDigitalSignEnvironment;
|
|
66
|
+
patchDigitalSignEnvironment: typeof patchDigitalSignEnvironment;
|
|
67
|
+
resetDigitalSignEnvironment: typeof resetDigitalSignEnvironment;
|
|
68
|
+
setDigitalSignEnvironment: typeof setDigitalSignEnvironment;
|
|
69
|
+
RHCOfficeSDK: RHCOfficeSDKBrowserNamespace;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
DIGITAL_SIGN_DEFAULTS,
|
|
75
|
+
DocumentSDK,
|
|
76
|
+
WatermarkDisplay,
|
|
77
|
+
createNewDocumentSdk,
|
|
78
|
+
getDigitalSignEnvironment,
|
|
79
|
+
initializeDigitalSignEnvironment,
|
|
80
|
+
patchDigitalSignEnvironment,
|
|
81
|
+
resetDigitalSignEnvironment,
|
|
82
|
+
setDigitalSignEnvironment,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export * from './index';
|
|
@@ -83,7 +83,7 @@ const createReaderPayload = (
|
|
|
83
83
|
configuration: NormalizedReaderEmbedOptions | null,
|
|
84
84
|
): Record<string, unknown> => {
|
|
85
85
|
return {
|
|
86
|
-
appUrl: configuration?.
|
|
86
|
+
appUrl: configuration?.appUrl ?? null,
|
|
87
87
|
configuration,
|
|
88
88
|
element: readerElement,
|
|
89
89
|
};
|
|
@@ -574,7 +574,7 @@ export class DocumentSDK implements IDocumentSDK {
|
|
|
574
574
|
mountToken: number,
|
|
575
575
|
): Promise<void> => {
|
|
576
576
|
try {
|
|
577
|
-
await ensureReaderScriptLoaded(configuration.
|
|
577
|
+
await ensureReaderScriptLoaded(configuration.appUrl);
|
|
578
578
|
if (this.mountToken !== mountToken) {
|
|
579
579
|
return;
|
|
580
580
|
}
|
|
@@ -3,7 +3,7 @@ import type { IReaderEmbedOptions } from '../api/document-sdk';
|
|
|
3
3
|
export type SupportedReaderTheme = 'light' | 'dark' | 'high-contrast' | 'auto';
|
|
4
4
|
|
|
5
5
|
export interface NormalizedReaderEmbedOptions extends IReaderEmbedOptions {
|
|
6
|
-
|
|
6
|
+
appUrl: string;
|
|
7
7
|
scrollIntoView: boolean;
|
|
8
8
|
theme?: SupportedReaderTheme;
|
|
9
9
|
}
|
|
@@ -52,7 +52,7 @@ export const normalizeReaderEmbedOptions = (
|
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
54
|
...configuration,
|
|
55
|
-
|
|
55
|
+
appUrl: normalizedAppUrl,
|
|
56
56
|
scrollIntoView: configuration.scrollIntoView ?? true,
|
|
57
57
|
theme: normalizeTheme(configuration.theme),
|
|
58
58
|
};
|