@rhc-office/sdk 6.6.266 → 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.
Files changed (40) hide show
  1. package/dist/browser/document-viewer.js +1 -1
  2. package/dist/browser/document-viewer.js.map +1 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +666 -523
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.cjs +1 -1
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/dist/tools/AnnotationToolImpl.d.ts +47 -0
  10. package/dist/tools/AnnotationToolImpl.d.ts.map +1 -0
  11. package/dist/tools/CryptoToolImpl.d.ts +9 -0
  12. package/dist/tools/CryptoToolImpl.d.ts.map +1 -0
  13. package/dist/tools/DigitalSignToolImpl.d.ts +27 -0
  14. package/dist/tools/DigitalSignToolImpl.d.ts.map +1 -0
  15. package/dist/tools/DocumentToolImpl.d.ts +1 -0
  16. package/dist/tools/DocumentToolImpl.d.ts.map +1 -1
  17. package/dist/tools/SignServerToolImpl.d.ts +19 -0
  18. package/dist/tools/SignServerToolImpl.d.ts.map +1 -0
  19. package/dist/tools/SymbologyToolImpl.d.ts +8 -0
  20. package/dist/tools/SymbologyToolImpl.d.ts.map +1 -0
  21. package/dist/tools/TemplateSignToolImpl.d.ts +13 -0
  22. package/dist/tools/TemplateSignToolImpl.d.ts.map +1 -0
  23. package/dist/tools/index.d.ts +6 -0
  24. package/dist/tools/index.d.ts.map +1 -1
  25. package/dist/viewer/DocumentSDK.d.ts +0 -1
  26. package/dist/viewer/DocumentSDK.d.ts.map +1 -1
  27. package/dist/viewer/SdkCallbackRegistry.d.ts +3 -0
  28. package/dist/viewer/SdkCallbackRegistry.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/index.ts +1 -0
  31. package/src/tools/AnnotationToolImpl.ts +263 -0
  32. package/src/tools/CryptoToolImpl.ts +27 -0
  33. package/src/tools/DigitalSignToolImpl.ts +155 -0
  34. package/src/tools/DocumentToolImpl.ts +24 -2
  35. package/src/tools/SignServerToolImpl.ts +92 -0
  36. package/src/tools/SymbologyToolImpl.ts +34 -0
  37. package/src/tools/TemplateSignToolImpl.ts +51 -0
  38. package/src/tools/index.ts +6 -0
  39. package/src/viewer/DocumentSDK.ts +13 -114
  40. package/src/viewer/SdkCallbackRegistry.ts +9 -0
@@ -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
+ }
@@ -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';
@@ -1,11 +1,6 @@
1
1
  import type { AnnotationTool } from '../api/annotation-tool';
2
- import type { IDigitalAnnotationInfo } from '../api/annotation-tool';
3
2
  import type { CryptoTool } from '../api/crypto-tool';
4
- import type {
5
- AnnotationEventCallback,
6
- ReaderReadyCallback,
7
- ReaderUnloadCallback,
8
- } from '../api/callbacks';
3
+ import type { ReaderReadyCallback, ReaderUnloadCallback } from '../api/callbacks';
9
4
  import type { IDocumentSDK, IReaderEmbedOptions } from '../api/document-sdk';
10
5
  import type { DocumentTool } from '../api/document-tool';
11
6
  import type { FindTool } from '../api/find-tool';
@@ -17,12 +12,18 @@ import type { DigitalSignTool } from '../api/sign-tool';
17
12
  import type { SymbologyTool } from '../api/symbology-tool';
18
13
  import type { TemplateSignTool } from '../api/template-sign';
19
14
  import type { UITool } from '../api/ui-tool';
15
+ import { AnnotationToolImpl } from '../tools/AnnotationToolImpl';
16
+ import { CryptoToolImpl } from '../tools/CryptoToolImpl';
17
+ import { DigitalSignToolImpl } from '../tools/DigitalSignToolImpl';
20
18
  import { DocumentToolImpl } from '../tools/DocumentToolImpl';
21
19
  import { FindToolImpl } from '../tools/FindToolImpl';
22
20
  import { NetworkingToolImpl } from '../tools/NetworkingToolImpl';
23
21
  import { PageToolImpl } from '../tools/PageToolImpl';
24
22
  import { PdfFormFillerImpl } from '../tools/PdfFormFillerImpl';
25
23
  import { DigitalSignOptions, KVField } from '../tools/SDKValueObjects';
24
+ import { SignServerToolImpl } from '../tools/SignServerToolImpl';
25
+ import { SymbologyToolImpl } from '../tools/SymbologyToolImpl';
26
+ import { TemplateSignToolImpl } from '../tools/TemplateSignToolImpl';
26
27
  import { UIToolImpl } from '../tools/UIToolImpl';
27
28
  import type { NormalizedReaderEmbedOptions } from './ReaderConfiguration';
28
29
  import { normalizeAppUrl, normalizeReaderEmbedOptions } from './ReaderConfiguration';
@@ -36,7 +37,6 @@ import {
36
37
  RHC_OFFICE_READER_ID_ATTRIBUTE,
37
38
  type AdapterEvent,
38
39
  } from './AdapterProtocol';
39
- import { createBridgeToolAdapter, createNotImplementedBridgeTool } from './BridgeToolAdapter';
40
40
  import { ReaderBridgeClient } from './ReaderBridgeClient';
41
41
  import { ReaderStateStore } from './ReaderStateStore';
42
42
  import { SdkCallbackRegistry } from './SdkCallbackRegistry';
@@ -231,29 +231,14 @@ export class DocumentSDK implements IDocumentSDK {
231
231
  private readonly uiTool = new UIToolImpl(this.bridgeToolContext);
232
232
  private readonly pageTool = new PageToolImpl(this.bridgeToolContext);
233
233
  private readonly findTool = new FindToolImpl(this.bridgeToolContext);
234
- private readonly signServerTool = createNotImplementedBridgeTool<SignServerTool>(
235
- 'signServer',
236
- this.bridgeToolContext,
237
- );
238
- private readonly digitalSignTool = createNotImplementedBridgeTool<DigitalSignTool>(
239
- 'digitalSign',
240
- this.bridgeToolContext,
241
- );
242
- private readonly symbologyTool = createNotImplementedBridgeTool<SymbologyTool>(
243
- 'symbology',
244
- this.bridgeToolContext,
245
- );
246
- private readonly annotationTool = this.createAnnotationTool();
247
- private readonly templateSignTool = createNotImplementedBridgeTool<TemplateSignTool>(
248
- 'templateSign',
249
- this.bridgeToolContext,
250
- );
234
+ private readonly signServerTool = new SignServerToolImpl(this.bridgeToolContext);
235
+ private readonly digitalSignTool = new DigitalSignToolImpl(this.bridgeToolContext);
236
+ private readonly symbologyTool = new SymbologyToolImpl(this.bridgeToolContext);
237
+ private readonly annotationTool = new AnnotationToolImpl(this.bridgeToolContext);
238
+ private readonly templateSignTool = new TemplateSignToolImpl(this.bridgeToolContext);
251
239
  private readonly pdfFormFiller = new PdfFormFillerImpl(this.bridgeToolContext);
252
240
  private readonly networkingTool = new NetworkingToolImpl(this.bridgeToolContext);
253
- private readonly cryptoTool = createNotImplementedBridgeTool<CryptoTool>(
254
- 'crypto',
255
- this.bridgeToolContext,
256
- );
241
+ private readonly cryptoTool = new CryptoToolImpl(this.bridgeToolContext);
257
242
 
258
243
  private readonly readyCallbacks: ReaderReadyCallback[] = [];
259
244
  private readonly unloadCallbacks: ReaderUnloadCallback[] = [];
@@ -439,92 +424,6 @@ export class DocumentSDK implements IDocumentSDK {
439
424
  return new KVField(key, value, description);
440
425
  };
441
426
 
442
- private createAnnotationTool(): AnnotationTool {
443
- return createBridgeToolAdapter<AnnotationTool>(
444
- 'annotation',
445
- {
446
- addAnnotationEventCallback: {
447
- kind: 'callbackRegister',
448
- callback: (callbacks, args) => {
449
- const callback = args[0];
450
- if (typeof callback === 'function') {
451
- callbacks.annotationEvents.push(callback as AnnotationEventCallback);
452
- }
453
- },
454
- },
455
- addAnnotationPersistCallback: {
456
- kind: 'callbackRegister',
457
- callback: (callbacks, args) => {
458
- const callback = args[0];
459
- if (typeof callback === 'function') {
460
- callbacks.annotationPersist.push(callback as (event: unknown) => void);
461
- }
462
- },
463
- },
464
- addAnnotationRetrieveCallback: {
465
- kind: 'callbackRegister',
466
- callback: (callbacks, args) => {
467
- const callback = args[0];
468
- if (typeof callback === 'function') {
469
- callbacks.annotationRetrieve.push(callback as (event: unknown) => void);
470
- }
471
- },
472
- },
473
- addDigitalAnnotationRetrieveCallback: {
474
- kind: 'callbackRegister',
475
- callback: (callbacks, args) => {
476
- const callback = args[0];
477
- if (typeof callback === 'function') {
478
- callbacks.digitalAnnotationRetrieve.push(
479
- callback as (annotations: IDigitalAnnotationInfo[]) => void,
480
- );
481
- }
482
- },
483
- },
484
- isInAnnotationMode: {
485
- kind: 'stateGetter',
486
- state: (state) => state.annotationEnabled,
487
- },
488
- getAnnotations: { kind: 'stateGetter', state: () => [] },
489
- getAnnotationsCount: { kind: 'stateGetter', state: () => 0 },
490
- queryAnnotationsBy: { kind: 'stateGetter', state: () => [] },
491
- setToolSource: { kind: 'command' },
492
- openAnnotationView: { kind: 'command' },
493
- closeAnnotationView: { kind: 'command' },
494
- openTextAnnotationView: { kind: 'command' },
495
- setTextAnnotationFontColor: { kind: 'command' },
496
- setTextAnnotationFontSize: { kind: 'command' },
497
- closeTextAnnotationView: { kind: 'command' },
498
- createTextAnnotation: { kind: 'command' },
499
- setPersistToDocument: { kind: 'command' },
500
- saveAnnotations: { kind: 'callbackQuery' },
501
- saveTextAnnotations: { kind: 'command' },
502
- clearAnnotations: { kind: 'command' },
503
- clearTextAnnotations: { kind: 'command' },
504
- undoAnnotation: { kind: 'command' },
505
- redoAnnotation: { kind: 'command' },
506
- selectAnnotationTool: { kind: 'command' },
507
- showAnnotationColorPicker: { kind: 'command' },
508
- setAnnotationPenType: { kind: 'command' },
509
- appendAnnotations: { kind: 'callbackQuery' },
510
- batchAppendAnnotations: { kind: 'callbackQuery' },
511
- setAnnotationPenColor: { kind: 'command' },
512
- setAnnotationPenWidth: { kind: 'command' },
513
- setAnnotationPenThickness: { kind: 'command' },
514
- enableAnnotationsInfoView: { kind: 'command' },
515
- enableAnnotationsDeletion: { kind: 'command' },
516
- enableAnnotationsDeletionOnlyByAuthor: { kind: 'command' },
517
- listDigitalStamps: { kind: 'command' },
518
- listAnnotations: { kind: 'command' },
519
- deleteAnnotationsBy: { kind: 'command' },
520
- deleteAnnotationsById: { kind: 'command' },
521
- addDigitalAnnotation: { kind: 'command' },
522
- addInkAnnotationCallback: { kind: 'callbackRegister' },
523
- },
524
- this.bridgeToolContext,
525
- );
526
- }
527
-
528
427
  private readonly mountReader = async (
529
428
  hostContainer: HTMLDivElement,
530
429
  configuration: NormalizedReaderEmbedOptions,
@@ -7,12 +7,14 @@ import type {
7
7
  PageModeChangeCallback,
8
8
  } from '../api/callbacks';
9
9
  import type { IDigitalAnnotationInfo } from '../api/annotation-tool';
10
+ import type { ISignServerAuthorization, SignServerAuthCallback } from '../api/sign-server';
10
11
 
11
12
  export class SdkCallbackRegistry {
12
13
  readonly annotationEvents: AnnotationEventCallback[] = [];
13
14
  readonly annotationPersist: Array<(event: unknown) => void> = [];
14
15
  readonly annotationRetrieve: Array<(event: unknown) => void> = [];
15
16
  readonly digitalAnnotationRetrieve: Array<(annotations: IDigitalAnnotationInfo[]) => void> = [];
17
+ readonly digitalSign: Array<(response: unknown) => void> = [];
16
18
  readonly digitalSignatureParse: DigitalSignatureRetrieveCallback[] = [];
17
19
  readonly digitalSignatureRetrieve: DigitalSignatureRetrieveCallback[] = [];
18
20
  readonly documentClosed: DocumentClosedCallback[] = [];
@@ -20,6 +22,7 @@ export class SdkCallbackRegistry {
20
22
  readonly documentSaved: DocumentSavedCallback[] = [];
21
23
  readonly pageChange: PageChangeCallback[] = [];
22
24
  readonly pageModeChange: PageModeChangeCallback[] = [];
25
+ readonly signServerAuth: SignServerAuthCallback[] = [];
23
26
 
24
27
  emit(event: string, payload: unknown): void {
25
28
  switch (event) {
@@ -63,6 +66,9 @@ export class SdkCallbackRegistry {
63
66
  callback(Array.isArray(payload) ? (payload as IDigitalAnnotationInfo[]) : []),
64
67
  );
65
68
  return;
69
+ case 'digitalSign':
70
+ this.digitalSign.forEach((callback) => callback(payload));
71
+ return;
66
72
  case 'digitalSignatureRetrieve':
67
73
  this.digitalSignatureRetrieve.forEach((callback) =>
68
74
  callback(Array.isArray(payload) ? payload : []),
@@ -73,6 +79,9 @@ export class SdkCallbackRegistry {
73
79
  callback(Array.isArray(payload) ? payload : []),
74
80
  );
75
81
  return;
82
+ case 'signServerAuth':
83
+ this.signServerAuth.forEach((callback) => callback(payload as ISignServerAuthorization));
84
+ return;
76
85
  default:
77
86
  return;
78
87
  }