@rhc-office/sdk 6.6.264 → 6.6.268
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 +3 -4
- package/dist/api/callbacks.d.ts +0 -1
- package/dist/api/callbacks.d.ts.map +1 -1
- package/dist/api/crypto-tool.d.ts +12 -1
- package/dist/api/crypto-tool.d.ts.map +1 -1
- package/dist/api/document-sdk.d.ts +0 -6
- package/dist/api/document-sdk.d.ts.map +1 -1
- package/dist/api/sign-tool.d.ts +43 -1
- package/dist/api/sign-tool.d.ts.map +1 -1
- package/dist/browser/document-viewer.js +1 -1
- package/dist/browser/document-viewer.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +670 -556
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/tools/AnnotationToolImpl.d.ts +47 -0
- package/dist/tools/AnnotationToolImpl.d.ts.map +1 -0
- package/dist/tools/CryptoToolImpl.d.ts +9 -0
- package/dist/tools/CryptoToolImpl.d.ts.map +1 -0
- package/dist/tools/DigitalSignToolImpl.d.ts +27 -0
- package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -0
- package/dist/tools/DocumentToolImpl.d.ts +1 -0
- package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
- package/dist/tools/SignServerToolImpl.d.ts +19 -0
- package/dist/tools/SignServerToolImpl.d.ts.map +1 -0
- package/dist/tools/SymbologyToolImpl.d.ts +8 -0
- package/dist/tools/SymbologyToolImpl.d.ts.map +1 -0
- package/dist/tools/TemplateSignToolImpl.d.ts +13 -0
- package/dist/tools/TemplateSignToolImpl.d.ts.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/viewer/DocumentSDK.d.ts +0 -8
- package/dist/viewer/DocumentSDK.d.ts.map +1 -1
- package/dist/viewer/ReaderStateStore.d.ts +0 -1
- package/dist/viewer/ReaderStateStore.d.ts.map +1 -1
- package/dist/viewer/SdkCallbackRegistry.d.ts +4 -2
- package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api/callbacks.ts +4 -17
- package/src/api/crypto-tool.ts +13 -1
- package/src/api/document-sdk.ts +0 -9
- package/src/api/sign-tool.ts +62 -1
- package/src/index.ts +1 -3
- package/src/tools/AnnotationToolImpl.ts +263 -0
- package/src/tools/CryptoToolImpl.ts +27 -0
- package/src/tools/DigitalSignToolImpl.ts +155 -0
- package/src/tools/DocumentToolImpl.ts +24 -2
- package/src/tools/SignServerToolImpl.ts +92 -0
- package/src/tools/SymbologyToolImpl.ts +34 -0
- package/src/tools/TemplateSignToolImpl.ts +51 -0
- package/src/tools/index.ts +6 -0
- package/src/viewer/DocumentSDK.ts +13 -157
- package/src/viewer/ReaderBridgeClient.ts +1 -1
- package/src/viewer/ReaderStateStore.ts +0 -2
- package/src/viewer/SdkCallbackRegistry.ts +8 -8
- package/dist/api/ekey-tool.d.ts +0 -8
- package/dist/api/ekey-tool.d.ts.map +0 -1
- package/dist/api/extension-tool.d.ts +0 -5
- package/dist/api/extension-tool.d.ts.map +0 -1
- package/dist/api/review-tool.d.ts +0 -71
- package/dist/api/review-tool.d.ts.map +0 -1
- package/src/api/ekey-tool.ts +0 -11
- package/src/api/extension-tool.ts +0 -5
- package/src/api/review-tool.ts +0 -105
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import type { AnnotationTool, IDigitalAnnotationInfo } from '../api/annotation-tool';
|
|
2
|
+
import type { AnnotationEventCallback } from '../api/callbacks';
|
|
3
|
+
import {
|
|
4
|
+
createBridgeToolAdapter,
|
|
5
|
+
type BridgeToolAdapterContext,
|
|
6
|
+
type BridgeToolDescriptor,
|
|
7
|
+
} from '../viewer/BridgeToolAdapter';
|
|
8
|
+
|
|
9
|
+
const ANNOTATION_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
10
|
+
addAnnotationEventCallback: {
|
|
11
|
+
kind: 'callbackRegister',
|
|
12
|
+
callback: (callbacks, args) => {
|
|
13
|
+
const callback = args[0];
|
|
14
|
+
if (typeof callback === 'function') {
|
|
15
|
+
callbacks.annotationEvents.push(callback as AnnotationEventCallback);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
addAnnotationPersistCallback: {
|
|
20
|
+
kind: 'callbackRegister',
|
|
21
|
+
callback: (callbacks, args) => {
|
|
22
|
+
const callback = args[0];
|
|
23
|
+
if (typeof callback === 'function') {
|
|
24
|
+
callbacks.annotationPersist.push(callback as (event: unknown) => void);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
addAnnotationRetrieveCallback: {
|
|
29
|
+
kind: 'callbackRegister',
|
|
30
|
+
callback: (callbacks, args) => {
|
|
31
|
+
const callback = args[0];
|
|
32
|
+
if (typeof callback === 'function') {
|
|
33
|
+
callbacks.annotationRetrieve.push(callback as (event: unknown) => void);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
addDigitalAnnotationRetrieveCallback: {
|
|
38
|
+
kind: 'callbackRegister',
|
|
39
|
+
callback: (callbacks, args) => {
|
|
40
|
+
const callback = args[0];
|
|
41
|
+
if (typeof callback === 'function') {
|
|
42
|
+
callbacks.digitalAnnotationRetrieve.push(
|
|
43
|
+
callback as (annotations: IDigitalAnnotationInfo[]) => void,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
isInAnnotationMode: {
|
|
49
|
+
kind: 'stateGetter',
|
|
50
|
+
state: (state) => state.annotationEnabled,
|
|
51
|
+
},
|
|
52
|
+
getAnnotations: { kind: 'stateGetter', state: () => [] },
|
|
53
|
+
getAnnotationsCount: { kind: 'stateGetter', state: () => 0 },
|
|
54
|
+
queryAnnotationsBy: { kind: 'stateGetter', state: () => [] },
|
|
55
|
+
setToolSource: { kind: 'command' },
|
|
56
|
+
openAnnotationView: { kind: 'command' },
|
|
57
|
+
closeAnnotationView: { kind: 'command' },
|
|
58
|
+
openTextAnnotationView: { kind: 'command' },
|
|
59
|
+
setTextAnnotationFontColor: { kind: 'command' },
|
|
60
|
+
setTextAnnotationFontSize: { kind: 'command' },
|
|
61
|
+
closeTextAnnotationView: { kind: 'command' },
|
|
62
|
+
createTextAnnotation: { kind: 'command' },
|
|
63
|
+
setPersistToDocument: { kind: 'command' },
|
|
64
|
+
saveAnnotations: { kind: 'callbackQuery' },
|
|
65
|
+
saveTextAnnotations: { kind: 'command' },
|
|
66
|
+
clearAnnotations: { kind: 'command' },
|
|
67
|
+
clearTextAnnotations: { kind: 'command' },
|
|
68
|
+
undoAnnotation: { kind: 'command' },
|
|
69
|
+
redoAnnotation: { kind: 'command' },
|
|
70
|
+
selectAnnotationTool: { kind: 'command' },
|
|
71
|
+
showAnnotationColorPicker: { kind: 'command' },
|
|
72
|
+
setAnnotationPenType: { kind: 'command' },
|
|
73
|
+
appendAnnotations: { kind: 'callbackQuery' },
|
|
74
|
+
batchAppendAnnotations: { kind: 'callbackQuery' },
|
|
75
|
+
setAnnotationPenColor: { kind: 'command' },
|
|
76
|
+
setAnnotationPenWidth: { kind: 'command' },
|
|
77
|
+
setAnnotationPenThickness: { kind: 'command' },
|
|
78
|
+
enableAnnotationsInfoView: { kind: 'command' },
|
|
79
|
+
enableAnnotationsDeletion: { kind: 'command' },
|
|
80
|
+
enableAnnotationsDeletionOnlyByAuthor: { kind: 'command' },
|
|
81
|
+
listDigitalStamps: { kind: 'command' },
|
|
82
|
+
listAnnotations: { kind: 'command' },
|
|
83
|
+
deleteAnnotationsBy: { kind: 'command' },
|
|
84
|
+
deleteAnnotationsById: { kind: 'command' },
|
|
85
|
+
addDigitalAnnotation: { kind: 'command' },
|
|
86
|
+
addInkAnnotationCallback: { kind: 'callbackRegister' },
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export class AnnotationToolImpl implements AnnotationTool {
|
|
90
|
+
private readonly adapter: AnnotationTool;
|
|
91
|
+
|
|
92
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
93
|
+
this.adapter = createBridgeToolAdapter<AnnotationTool>(
|
|
94
|
+
'annotation',
|
|
95
|
+
ANNOTATION_TOOL_DESCRIPTOR,
|
|
96
|
+
context,
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
setToolSource: AnnotationTool['setToolSource'] = (source) => {
|
|
101
|
+
return this.adapter.setToolSource(source);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
openAnnotationView: AnnotationTool['openAnnotationView'] = (options) => {
|
|
105
|
+
return this.adapter.openAnnotationView(options);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
closeAnnotationView: AnnotationTool['closeAnnotationView'] = (saveModifications) => {
|
|
109
|
+
return this.adapter.closeAnnotationView(saveModifications);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
openTextAnnotationView: AnnotationTool['openTextAnnotationView'] = () => {
|
|
113
|
+
return this.adapter.openTextAnnotationView();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
setTextAnnotationFontColor: AnnotationTool['setTextAnnotationFontColor'] = (color) => {
|
|
117
|
+
return this.adapter.setTextAnnotationFontColor(color);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
setTextAnnotationFontSize: AnnotationTool['setTextAnnotationFontSize'] = (size) => {
|
|
121
|
+
return this.adapter.setTextAnnotationFontSize(size);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
closeTextAnnotationView: AnnotationTool['closeTextAnnotationView'] = (saveModifications) => {
|
|
125
|
+
return this.adapter.closeTextAnnotationView(saveModifications);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
createTextAnnotation: AnnotationTool['createTextAnnotation'] = (options) => {
|
|
129
|
+
return this.adapter.createTextAnnotation(options);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
setPersistToDocument: AnnotationTool['setPersistToDocument'] = (persist) => {
|
|
133
|
+
return this.adapter.setPersistToDocument(persist);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
saveAnnotations: AnnotationTool['saveAnnotations'] = (saveCallback) => {
|
|
137
|
+
return this.adapter.saveAnnotations(saveCallback);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
saveTextAnnotations: AnnotationTool['saveTextAnnotations'] = () => {
|
|
141
|
+
return this.adapter.saveTextAnnotations();
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
clearAnnotations: AnnotationTool['clearAnnotations'] = () => {
|
|
145
|
+
return this.adapter.clearAnnotations();
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
clearTextAnnotations: AnnotationTool['clearTextAnnotations'] = () => {
|
|
149
|
+
return this.adapter.clearTextAnnotations();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
undoAnnotation: AnnotationTool['undoAnnotation'] = () => {
|
|
153
|
+
return this.adapter.undoAnnotation();
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
redoAnnotation: AnnotationTool['redoAnnotation'] = () => {
|
|
157
|
+
return this.adapter.redoAnnotation();
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
selectAnnotationTool: AnnotationTool['selectAnnotationTool'] = (tool) => {
|
|
161
|
+
return this.adapter.selectAnnotationTool(tool);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
showAnnotationColorPicker: AnnotationTool['showAnnotationColorPicker'] = () => {
|
|
165
|
+
return this.adapter.showAnnotationColorPicker();
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
setAnnotationPenType: AnnotationTool['setAnnotationPenType'] = (penType) => {
|
|
169
|
+
return this.adapter.setAnnotationPenType(penType);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
appendAnnotations: AnnotationTool['appendAnnotations'] = (inkData, callback) => {
|
|
173
|
+
return this.adapter.appendAnnotations(inkData, callback);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
batchAppendAnnotations: AnnotationTool['batchAppendAnnotations'] = (inkData, callback) => {
|
|
177
|
+
return this.adapter.batchAppendAnnotations(inkData, callback);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
setAnnotationPenColor: AnnotationTool['setAnnotationPenColor'] = (hexColor) => {
|
|
181
|
+
return this.adapter.setAnnotationPenColor(hexColor);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
setAnnotationPenWidth: AnnotationTool['setAnnotationPenWidth'] = (penWidth) => {
|
|
185
|
+
return this.adapter.setAnnotationPenWidth(penWidth);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
setAnnotationPenThickness: AnnotationTool['setAnnotationPenThickness'] = (thickness) => {
|
|
189
|
+
return this.adapter.setAnnotationPenThickness(thickness);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
enableAnnotationsInfoView: AnnotationTool['enableAnnotationsInfoView'] = (enabled) => {
|
|
193
|
+
return this.adapter.enableAnnotationsInfoView(enabled);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
enableAnnotationsDeletion: AnnotationTool['enableAnnotationsDeletion'] = (enabled) => {
|
|
197
|
+
return this.adapter.enableAnnotationsDeletion(enabled);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
enableAnnotationsDeletionOnlyByAuthor: AnnotationTool['enableAnnotationsDeletionOnlyByAuthor'] = (
|
|
201
|
+
onlyByAuthor,
|
|
202
|
+
) => {
|
|
203
|
+
return this.adapter.enableAnnotationsDeletionOnlyByAuthor(onlyByAuthor);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
listDigitalStamps: AnnotationTool['listDigitalStamps'] = () => {
|
|
207
|
+
return this.adapter.listDigitalStamps();
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
isInAnnotationMode: AnnotationTool['isInAnnotationMode'] = () => {
|
|
211
|
+
return this.adapter.isInAnnotationMode();
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
listAnnotations: AnnotationTool['listAnnotations'] = (options) => {
|
|
215
|
+
return this.adapter.listAnnotations(options);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
getAnnotations: AnnotationTool['getAnnotations'] = () => {
|
|
219
|
+
return this.adapter.getAnnotations();
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
getAnnotationsCount: AnnotationTool['getAnnotationsCount'] = () => {
|
|
223
|
+
return this.adapter.getAnnotationsCount();
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
queryAnnotationsBy: AnnotationTool['queryAnnotationsBy'] = (query) => {
|
|
227
|
+
return this.adapter.queryAnnotationsBy(query);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
deleteAnnotationsBy: AnnotationTool['deleteAnnotationsBy'] = (query, prompt) => {
|
|
231
|
+
return this.adapter.deleteAnnotationsBy(query, prompt);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
deleteAnnotationsById: AnnotationTool['deleteAnnotationsById'] = (annotationIds, prompt) => {
|
|
235
|
+
return this.adapter.deleteAnnotationsById(annotationIds, prompt);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
addDigitalAnnotation: AnnotationTool['addDigitalAnnotation'] = (options) => {
|
|
239
|
+
return this.adapter.addDigitalAnnotation(options);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
addInkAnnotationCallback: AnnotationTool['addInkAnnotationCallback'] = (callback) => {
|
|
243
|
+
return this.adapter.addInkAnnotationCallback(callback);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
addAnnotationEventCallback: AnnotationTool['addAnnotationEventCallback'] = (callback) => {
|
|
247
|
+
return this.adapter.addAnnotationEventCallback(callback);
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
addAnnotationPersistCallback: AnnotationTool['addAnnotationPersistCallback'] = (callback) => {
|
|
251
|
+
return this.adapter.addAnnotationPersistCallback(callback);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
addAnnotationRetrieveCallback: AnnotationTool['addAnnotationRetrieveCallback'] = (callback) => {
|
|
255
|
+
return this.adapter.addAnnotationRetrieveCallback(callback);
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
addDigitalAnnotationRetrieveCallback: AnnotationTool['addDigitalAnnotationRetrieveCallback'] = (
|
|
259
|
+
callback,
|
|
260
|
+
) => {
|
|
261
|
+
return this.adapter.addDigitalAnnotationRetrieveCallback(callback);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CryptoTool } from '../api/crypto-tool';
|
|
2
|
+
import {
|
|
3
|
+
createBridgeToolAdapter,
|
|
4
|
+
type BridgeToolAdapterContext,
|
|
5
|
+
type BridgeToolDescriptor,
|
|
6
|
+
} from '../viewer/BridgeToolAdapter';
|
|
7
|
+
|
|
8
|
+
const CRYPTO_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
9
|
+
configSecurityProvider: { kind: 'command' },
|
|
10
|
+
getSecurityProviders: { kind: 'query' },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class CryptoToolImpl implements CryptoTool {
|
|
14
|
+
private readonly adapter: CryptoTool;
|
|
15
|
+
|
|
16
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
17
|
+
this.adapter = createBridgeToolAdapter<CryptoTool>('crypto', CRYPTO_TOOL_DESCRIPTOR, context);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
configSecurityProvider: CryptoTool['configSecurityProvider'] = (providers) => {
|
|
21
|
+
return this.adapter.configSecurityProvider(providers);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
getSecurityProviders: CryptoTool['getSecurityProviders'] = () => {
|
|
25
|
+
return this.adapter.getSecurityProviders();
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { DigitalSignatureRetrieveCallback, DigitalSignCallback } from '../api/callbacks';
|
|
2
|
+
import type { DigitalSignTool } from '../api/sign-tool';
|
|
3
|
+
import {
|
|
4
|
+
createBridgeToolAdapter,
|
|
5
|
+
type BridgeToolAdapterContext,
|
|
6
|
+
type BridgeToolDescriptor,
|
|
7
|
+
} from '../viewer/BridgeToolAdapter';
|
|
8
|
+
|
|
9
|
+
const DIGITAL_SIGN_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
10
|
+
addDigitalSignatureRetrieveCallback: {
|
|
11
|
+
kind: 'callbackRegister',
|
|
12
|
+
callback: (callbacks, args) => {
|
|
13
|
+
const callback = args[0];
|
|
14
|
+
if (typeof callback === 'function') {
|
|
15
|
+
callbacks.digitalSignatureRetrieve.push(callback as DigitalSignatureRetrieveCallback);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
addDigitalSignatureParseCallback: {
|
|
20
|
+
kind: 'callbackRegister',
|
|
21
|
+
callback: (callbacks, args) => {
|
|
22
|
+
const callback = args[0];
|
|
23
|
+
if (typeof callback === 'function') {
|
|
24
|
+
callbacks.digitalSignatureParse.push(callback as DigitalSignatureRetrieveCallback);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
addDigitalSignCallback: {
|
|
29
|
+
kind: 'callbackRegister',
|
|
30
|
+
callback: (callbacks, args) => {
|
|
31
|
+
const callback = args[0];
|
|
32
|
+
if (typeof callback === 'function') {
|
|
33
|
+
callbacks.digitalSign.push(callback as DigitalSignCallback);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
setCryptoProvider: { kind: 'command' },
|
|
38
|
+
setSealSource: { kind: 'command' },
|
|
39
|
+
setDefaultStampPassword: { kind: 'command' },
|
|
40
|
+
setDefaultSealPassword: { kind: 'command' },
|
|
41
|
+
setDefaultKeystorePassword: { kind: 'command' },
|
|
42
|
+
setDefaultUSBKeyPassword: { kind: 'command' },
|
|
43
|
+
setupExternalSealServer: { kind: 'command' },
|
|
44
|
+
setDigitalSignOptions: { kind: 'command' },
|
|
45
|
+
setExternalDigitalSignOptions: { kind: 'command' },
|
|
46
|
+
setPDFDigitalSignCaptionOptions: { kind: 'command' },
|
|
47
|
+
addDigitalSignature: { kind: 'callbackQuery' },
|
|
48
|
+
addDigitalSignatureBySelectedSearchHighlight: { kind: 'command' },
|
|
49
|
+
listDigitalSignatures: { kind: 'callbackQuery' },
|
|
50
|
+
getDigitalSignatures: { kind: 'stateGetter', state: () => [] },
|
|
51
|
+
getDigitalSignaturesCount: { kind: 'stateGetter', state: () => 0 },
|
|
52
|
+
enableDigitalSignatureInfoView: { kind: 'command' },
|
|
53
|
+
enableDigitalSignatureRevocation: { kind: 'command' },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class DigitalSignToolImpl implements DigitalSignTool {
|
|
57
|
+
private readonly adapter: DigitalSignTool;
|
|
58
|
+
|
|
59
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
60
|
+
this.adapter = createBridgeToolAdapter<DigitalSignTool>(
|
|
61
|
+
'digitalSign',
|
|
62
|
+
DIGITAL_SIGN_TOOL_DESCRIPTOR,
|
|
63
|
+
context,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
addDigitalSignatureRetrieveCallback: DigitalSignTool['addDigitalSignatureRetrieveCallback'] = (
|
|
68
|
+
callback,
|
|
69
|
+
) => {
|
|
70
|
+
return this.adapter.addDigitalSignatureRetrieveCallback(callback);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
addDigitalSignatureParseCallback: DigitalSignTool['addDigitalSignatureParseCallback'] = (
|
|
74
|
+
callback,
|
|
75
|
+
) => {
|
|
76
|
+
return this.adapter.addDigitalSignatureParseCallback(callback);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
setCryptoProvider: DigitalSignTool['setCryptoProvider'] = (usage, provider, configuration) => {
|
|
80
|
+
return this.adapter.setCryptoProvider(usage, provider, configuration);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
setSealSource: DigitalSignTool['setSealSource'] = (source) => {
|
|
84
|
+
return this.adapter.setSealSource(source);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
setDefaultStampPassword: DigitalSignTool['setDefaultStampPassword'] = (stampPassword) => {
|
|
88
|
+
return this.adapter.setDefaultStampPassword(stampPassword);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
setDefaultSealPassword: DigitalSignTool['setDefaultSealPassword'] = (sealPassword) => {
|
|
92
|
+
return this.adapter.setDefaultSealPassword(sealPassword);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
setDefaultKeystorePassword: DigitalSignTool['setDefaultKeystorePassword'] = (pkPassword) => {
|
|
96
|
+
return this.adapter.setDefaultKeystorePassword(pkPassword);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
setDefaultUSBKeyPassword: DigitalSignTool['setDefaultUSBKeyPassword'] = (pkPassword) => {
|
|
100
|
+
return this.adapter.setDefaultUSBKeyPassword(pkPassword);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
addDigitalSignCallback: DigitalSignTool['addDigitalSignCallback'] = (callback) => {
|
|
104
|
+
return this.adapter.addDigitalSignCallback(callback);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
setupExternalSealServer: DigitalSignTool['setupExternalSealServer'] = (options) => {
|
|
108
|
+
return this.adapter.setupExternalSealServer(options);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
setDigitalSignOptions: DigitalSignTool['setDigitalSignOptions'] = (options) => {
|
|
112
|
+
return this.adapter.setDigitalSignOptions(options);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
setExternalDigitalSignOptions: DigitalSignTool['setExternalDigitalSignOptions'] = (options) => {
|
|
116
|
+
return this.adapter.setExternalDigitalSignOptions(options);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
setPDFDigitalSignCaptionOptions: DigitalSignTool['setPDFDigitalSignCaptionOptions'] = (
|
|
120
|
+
options,
|
|
121
|
+
) => {
|
|
122
|
+
return this.adapter.setPDFDigitalSignCaptionOptions(options);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
addDigitalSignature: DigitalSignTool['addDigitalSignature'] = (options, callback) => {
|
|
126
|
+
return this.adapter.addDigitalSignature(options, callback);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
addDigitalSignatureBySelectedSearchHighlight: DigitalSignTool['addDigitalSignatureBySelectedSearchHighlight'] =
|
|
130
|
+
(options) => {
|
|
131
|
+
return this.adapter.addDigitalSignatureBySelectedSearchHighlight(options);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
listDigitalSignatures: DigitalSignTool['listDigitalSignatures'] = (callback) => {
|
|
135
|
+
return this.adapter.listDigitalSignatures(callback);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
getDigitalSignatures: DigitalSignTool['getDigitalSignatures'] = () => {
|
|
139
|
+
return this.adapter.getDigitalSignatures();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
getDigitalSignaturesCount: DigitalSignTool['getDigitalSignaturesCount'] = () => {
|
|
143
|
+
return this.adapter.getDigitalSignaturesCount();
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
enableDigitalSignatureInfoView: DigitalSignTool['enableDigitalSignatureInfoView'] = (enabled) => {
|
|
147
|
+
return this.adapter.enableDigitalSignatureInfoView(enabled);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
enableDigitalSignatureRevocation: DigitalSignTool['enableDigitalSignatureRevocation'] = (
|
|
151
|
+
enabled,
|
|
152
|
+
) => {
|
|
153
|
+
return this.adapter.enableDigitalSignatureRevocation(enabled);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { DocumentClosedCallback, DocumentSavedCallback } from '../api/callbacks';
|
|
2
|
-
import type { DocumentTool } from '../api/document-tool';
|
|
2
|
+
import type { DocumentTool, IFileSaveOptions, IFileSaveResult } from '../api/document-tool';
|
|
3
|
+
import { RHC_OFFICE_READER_ID_ATTRIBUTE } from '../viewer/AdapterProtocol';
|
|
3
4
|
import {
|
|
4
5
|
createBridgeToolAdapter,
|
|
5
6
|
type BridgeToolAdapterContext,
|
|
6
7
|
type BridgeToolDescriptor,
|
|
7
8
|
} from '../viewer/BridgeToolAdapter';
|
|
8
9
|
|
|
10
|
+
type ReaderElementWithSaveAs = HTMLElement & {
|
|
11
|
+
saveAs?: (options?: IFileSaveOptions) => Promise<IFileSaveResult>;
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
const DOCUMENT_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
10
15
|
addDocumentOpenedCallback: {
|
|
11
16
|
kind: 'callbackRegister',
|
|
@@ -68,7 +73,7 @@ const DOCUMENT_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
|
68
73
|
export class DocumentToolImpl implements DocumentTool {
|
|
69
74
|
private readonly adapter: DocumentTool;
|
|
70
75
|
|
|
71
|
-
constructor(context: BridgeToolAdapterContext) {
|
|
76
|
+
constructor(private readonly context: BridgeToolAdapterContext) {
|
|
72
77
|
this.adapter = createBridgeToolAdapter<DocumentTool>(
|
|
73
78
|
'document',
|
|
74
79
|
DOCUMENT_TOOL_DESCRIPTOR,
|
|
@@ -129,6 +134,23 @@ export class DocumentToolImpl implements DocumentTool {
|
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
saveAs: DocumentTool['saveAs'] = (options) => {
|
|
137
|
+
const readerId = this.context.bridge.getReaderId();
|
|
138
|
+
if (!readerId) {
|
|
139
|
+
return Promise.resolve({
|
|
140
|
+
success: false,
|
|
141
|
+
action: 'save-as',
|
|
142
|
+
filename: options?.filename,
|
|
143
|
+
error: 'Reader is not mounted or does not expose saveAs.',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const readerElement = document.querySelector(
|
|
148
|
+
`[${RHC_OFFICE_READER_ID_ATTRIBUTE}="${readerId}"]`,
|
|
149
|
+
) as ReaderElementWithSaveAs | null;
|
|
150
|
+
if (typeof readerElement?.saveAs === 'function') {
|
|
151
|
+
return readerElement.saveAs(options);
|
|
152
|
+
}
|
|
153
|
+
|
|
132
154
|
return this.adapter.saveAs(options);
|
|
133
155
|
};
|
|
134
156
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { SignServerAuthCallback, SignServerTool } from '../api/sign-server';
|
|
2
|
+
import {
|
|
3
|
+
createBridgeToolAdapter,
|
|
4
|
+
type BridgeToolAdapterContext,
|
|
5
|
+
type BridgeToolDescriptor,
|
|
6
|
+
} from '../viewer/BridgeToolAdapter';
|
|
7
|
+
|
|
8
|
+
const SIGN_SERVER_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
9
|
+
setSignServer: { kind: 'command' },
|
|
10
|
+
addSignServerAuthCallback: {
|
|
11
|
+
kind: 'callbackRegister',
|
|
12
|
+
callback: (callbacks, args) => {
|
|
13
|
+
const callback = args[0];
|
|
14
|
+
if (typeof callback === 'function') {
|
|
15
|
+
callbacks.signServerAuth.push(callback as SignServerAuthCallback);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
setSignServerDefaultLogin: { kind: 'command' },
|
|
20
|
+
setDefaultSignServerLogin: { kind: 'command' },
|
|
21
|
+
setSignServerDefaultPassword: { kind: 'command' },
|
|
22
|
+
setDefaultSignServerPassword: { kind: 'command' },
|
|
23
|
+
loginNTKOSignServer: { kind: 'command' },
|
|
24
|
+
loginSignServer: { kind: 'callbackQuery' },
|
|
25
|
+
signOutSignServer: { kind: 'command' },
|
|
26
|
+
isAuthenticatedOnSignServer: { kind: 'stateGetter', state: () => false },
|
|
27
|
+
setSignServerLoginFromUSBKey: { kind: 'command' },
|
|
28
|
+
setUserAuthSource: { kind: 'command' },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export class SignServerToolImpl implements SignServerTool {
|
|
32
|
+
private readonly adapter: SignServerTool;
|
|
33
|
+
|
|
34
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
35
|
+
this.adapter = createBridgeToolAdapter<SignServerTool>(
|
|
36
|
+
'signServer',
|
|
37
|
+
SIGN_SERVER_TOOL_DESCRIPTOR,
|
|
38
|
+
context,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
setSignServer: SignServerTool['setSignServer'] = (signServer) => {
|
|
43
|
+
return this.adapter.setSignServer(signServer);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
addSignServerAuthCallback: SignServerTool['addSignServerAuthCallback'] = (callback) => {
|
|
47
|
+
return this.adapter.addSignServerAuthCallback(callback);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
setSignServerDefaultLogin: SignServerTool['setSignServerDefaultLogin'] = (login) => {
|
|
51
|
+
return this.adapter.setSignServerDefaultLogin(login);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
setDefaultSignServerLogin: SignServerTool['setDefaultSignServerLogin'] = (login) => {
|
|
55
|
+
return this.adapter.setDefaultSignServerLogin(login);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
setSignServerDefaultPassword: SignServerTool['setSignServerDefaultPassword'] = (password) => {
|
|
59
|
+
return this.adapter.setSignServerDefaultPassword(password);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
setDefaultSignServerPassword: SignServerTool['setDefaultSignServerPassword'] = (password) => {
|
|
63
|
+
return this.adapter.setDefaultSignServerPassword(password);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
loginNTKOSignServer: SignServerTool['loginNTKOSignServer'] = (serverAddress, login, password) => {
|
|
67
|
+
return this.adapter.loginNTKOSignServer(serverAddress, login, password);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
loginSignServer: SignServerTool['loginSignServer'] = (server, login, password, onSuccess) => {
|
|
71
|
+
return this.adapter.loginSignServer(server, login, password, onSuccess);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
signOutSignServer: SignServerTool['signOutSignServer'] = () => {
|
|
75
|
+
return this.adapter.signOutSignServer();
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
isAuthenticatedOnSignServer: SignServerTool['isAuthenticatedOnSignServer'] = () => {
|
|
79
|
+
return this.adapter.isAuthenticatedOnSignServer();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
setSignServerLoginFromUSBKey: SignServerTool['setSignServerLoginFromUSBKey'] = (
|
|
83
|
+
enabled,
|
|
84
|
+
options,
|
|
85
|
+
) => {
|
|
86
|
+
return this.adapter.setSignServerLoginFromUSBKey(enabled, options);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
setUserAuthSource: SignServerTool['setUserAuthSource'] = (source) => {
|
|
90
|
+
return this.adapter.setUserAuthSource(source);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SymbologyTool } from '../api/symbology-tool';
|
|
2
|
+
import {
|
|
3
|
+
createBridgeToolAdapter,
|
|
4
|
+
type BridgeToolAdapterContext,
|
|
5
|
+
type BridgeToolDescriptor,
|
|
6
|
+
} from '../viewer/BridgeToolAdapter';
|
|
7
|
+
|
|
8
|
+
const SYMBOLOGY_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
9
|
+
createPDF417Barcode: { kind: 'command' },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export class SymbologyToolImpl implements SymbologyTool {
|
|
13
|
+
private readonly adapter: SymbologyTool;
|
|
14
|
+
|
|
15
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
16
|
+
this.adapter = createBridgeToolAdapter<SymbologyTool>(
|
|
17
|
+
'symbology',
|
|
18
|
+
SYMBOLOGY_TOOL_DESCRIPTOR,
|
|
19
|
+
context,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
createPDF417Barcode: SymbologyTool['createPDF417Barcode'] = (
|
|
24
|
+
content,
|
|
25
|
+
pageIndex,
|
|
26
|
+
x,
|
|
27
|
+
y,
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
margin,
|
|
31
|
+
) => {
|
|
32
|
+
return this.adapter.createPDF417Barcode(content, pageIndex, x, y, width, height, margin);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TemplateSignTool } from '../api/template-sign';
|
|
2
|
+
import {
|
|
3
|
+
createBridgeToolAdapter,
|
|
4
|
+
type BridgeToolAdapterContext,
|
|
5
|
+
type BridgeToolDescriptor,
|
|
6
|
+
} from '../viewer/BridgeToolAdapter';
|
|
7
|
+
|
|
8
|
+
const TEMPLATE_SIGN_TOOL_DESCRIPTOR: BridgeToolDescriptor = {
|
|
9
|
+
setup: { kind: 'command' },
|
|
10
|
+
create: { kind: 'command' },
|
|
11
|
+
getMarkups: { kind: 'callbackQuery' },
|
|
12
|
+
removeMarkup: { kind: 'command' },
|
|
13
|
+
removeAllMarkups: { kind: 'command' },
|
|
14
|
+
sign: { kind: 'callbackQuery' },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export class TemplateSignToolImpl implements TemplateSignTool {
|
|
18
|
+
private readonly adapter: TemplateSignTool;
|
|
19
|
+
|
|
20
|
+
constructor(context: BridgeToolAdapterContext) {
|
|
21
|
+
this.adapter = createBridgeToolAdapter<TemplateSignTool>(
|
|
22
|
+
'templateSign',
|
|
23
|
+
TEMPLATE_SIGN_TOOL_DESCRIPTOR,
|
|
24
|
+
context,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
setup: TemplateSignTool['setup'] = (option) => {
|
|
29
|
+
return this.adapter.setup(option);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
create: TemplateSignTool['create'] = (signType) => {
|
|
33
|
+
return this.adapter.create(signType);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
getMarkups: TemplateSignTool['getMarkups'] = (callback) => {
|
|
37
|
+
return this.adapter.getMarkups(callback);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
removeMarkup: TemplateSignTool['removeMarkup'] = (markupId, prompt) => {
|
|
41
|
+
return this.adapter.removeMarkup(markupId, prompt);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
removeAllMarkups: TemplateSignTool['removeAllMarkups'] = (prompt) => {
|
|
45
|
+
return this.adapter.removeAllMarkups(prompt);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
sign: TemplateSignTool['sign'] = (callback) => {
|
|
49
|
+
return this.adapter.sign(callback);
|
|
50
|
+
};
|
|
51
|
+
}
|
package/src/tools/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export * from './AnnotationToolImpl';
|
|
2
|
+
export * from './CryptoToolImpl';
|
|
3
|
+
export * from './DigitalSignToolImpl';
|
|
1
4
|
export * from './DocumentToolImpl';
|
|
2
5
|
export * from './FindToolImpl';
|
|
3
6
|
export * from './NetworkingToolImpl';
|
|
@@ -5,4 +8,7 @@ export * from './PageToolImpl';
|
|
|
5
8
|
export * from './PdfFormFillerImpl';
|
|
6
9
|
export * from './Phase1ToolPlaceholder';
|
|
7
10
|
export * from './SDKValueObjects';
|
|
11
|
+
export * from './SignServerToolImpl';
|
|
12
|
+
export * from './SymbologyToolImpl';
|
|
13
|
+
export * from './TemplateSignToolImpl';
|
|
8
14
|
export * from './UIToolImpl';
|