@topconsultnpm/sdkui-react-beta 6.15.110 → 6.15.112

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.
@@ -117,7 +117,7 @@ const TMArchive = ({ inputTID, inputFile = null, connectorFileSave = undefined,
117
117
  ]
118
118
  },
119
119
  ], [tmTreeSelectorElement, tmRecentsManagerElement, tmFormElement, currentTID, mruTIDs]);
120
- return (_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: 'tmRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }));
120
+ return (_jsx(TMPanelManagerProvider, { panels: initialPanels, initialVisibility: allInitialPanelVisibility, defaultDimensions: initialPanelDimensions, initialDimensions: initialPanelDimensions, initialMobilePanelId: inputTID ? 'tmDcmtForm' : 'tmRecentsManager', children: _jsx(TMPanelManagerContainer, { panels: initialPanels, direction: "horizontal", showToolbar: true }) }));
121
121
  };
122
122
  export default TMArchive;
123
123
  const TMTreeSelectorWrapper = ({ isMobile, onSelectedTIDChanged }) => {
@@ -48,7 +48,7 @@ export * from './choosers/TMInvoiceRetrieveFormats';
48
48
  export * from './choosers/TMMetadataChooser';
49
49
  export * from './choosers/TMOrderRetrieveFormats';
50
50
  export * from './choosers/TMUserChooser';
51
- export * from './connectors';
51
+ export * from './connectors/connectors.styles';
52
52
  export { default as TMValidationItemsList } from './grids/TMValidationItemsList';
53
53
  export { default as TMBlogs } from './grids/TMBlogs';
54
54
  export { default as TMBlogCommentForm } from './features/blog/TMBlogCommentForm';
@@ -52,7 +52,7 @@ export * from './choosers/TMMetadataChooser';
52
52
  export * from './choosers/TMOrderRetrieveFormats';
53
53
  export * from './choosers/TMUserChooser';
54
54
  // connectors
55
- export * from './connectors';
55
+ export * from './connectors/connectors.styles';
56
56
  //grids
57
57
  export { default as TMValidationItemsList } from './grids/TMValidationItemsList';
58
58
  // blogs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.15.110",
3
+ "version": "6.15.112",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { ConnectorConfig } from '../types/ConnectorTypes';
3
- interface BaseConnectorAppProps {
4
- config: ConnectorConfig;
5
- }
6
- export declare const BaseConnectorApp: React.FC<BaseConnectorAppProps>;
7
- export {};
@@ -1,291 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // Base connector component for Office add-ins (designed for sdkui package)
3
- import { useState, useEffect, useRef } from 'react';
4
- import { CultureIDs, DcmtTypeListCacheService, SDK_Globals, SessionDescriptor } from '@topconsultnpm/sdk-ts-beta';
5
- import { OfficeAppType } from '../types/ConnectorTypes';
6
- import { SharedSearchDocument } from './SharedSearchDocument';
7
- import { createFileFromBase64 } from '../utils/ConnectorUtils';
8
- import toppy from '@topconsultnpm/sdkui-react-beta/lib/assets/Toppy-generico.png';
9
- import { TMChangePassword } from '../..';
10
- import { SDKUI_Localizator, SDKUI_Globals, UserSettings, IconDcmtType, IconSearch, IconArchiveDoc, IconRefresh, calcResponsiveSizes } from '../../../helper';
11
- import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
12
- import { DcmtOperationTypes } from '../../../ts';
13
- import { useDeviceType, DeviceType } from '../../base/TMDeviceProvider';
14
- import TMModal from '../../base/TMModal';
15
- import { TMExceptionBoxManager } from '../../base/TMPopUp';
16
- import TMSpinner from '../../base/TMSpinner';
17
- import TMArchive from '../../features/archive/TMArchive';
18
- import TMLoginForm, { useCultureID } from '../../forms/Login/TMLoginForm';
19
- import TMHeader from '../../sidebar/TMHeader';
20
- import { StyledConnectorButton, StyledConnectorContentArea, StyledConnectorFirstPageContent, StyledConnectorCard, StyledConnectorToppyImage } from '../connectors.styles';
21
- // Inline styles
22
- const rootStyle = {
23
- minHeight: "100vh",
24
- };
25
- export const BaseConnectorApp = ({ config }) => {
26
- const { adapter, appConfig, appPackage } = config;
27
- const isCompactModeThreshold = config.isCompactModeThreshold || 700;
28
- // Initialize state with adapter-specific defaults
29
- const initialState = {
30
- tmSession: undefined,
31
- currentCultureID: CultureIDs.It_IT,
32
- initialSd: undefined,
33
- endpoints: [],
34
- showChangePassword: false,
35
- showArchive: false,
36
- showSearch: false,
37
- windowWidth: window.innerWidth,
38
- fileFromConnector: null,
39
- currentDID: undefined,
40
- currentTID: undefined,
41
- isDocumentArchived: false,
42
- dcmtType: undefined,
43
- // Merge adapter-specific initial state
44
- ...adapter.getInitialState?.()
45
- };
46
- const [state, setState] = useState(initialState);
47
- const deviceType = useDeviceType();
48
- const cultureID = useCultureID({ cultureID: state.currentCultureID ?? CultureIDs.It_IT });
49
- const { runOperationAsync } = useDcmtOperations();
50
- const isUpdatingRef = useRef(false);
51
- const lastUpdateTimeRef = useRef(0);
52
- const isCompactMode = state.windowWidth < isCompactModeThreshold;
53
- // Helper function to update state
54
- const updateState = (updates) => {
55
- setState(prev => ({ ...prev, ...updates }));
56
- };
57
- useEffect(() => {
58
- const sd = new SessionDescriptor();
59
- sd.userName = "SysAdmin";
60
- updateState({
61
- initialSd: sd,
62
- endpoints: Object.values(appConfig.endpoints)
63
- });
64
- // Set SDK globals based on adapter and provided packages
65
- SDK_Globals.appModule = adapter.appModule;
66
- SDK_Globals.sdkName = '@topconsultnpm/sdk-ts-beta'; // Default SDK name
67
- SDK_Globals.sdkuiName = '@topconsultnpm/sdkui-react-beta'; // Default SDKUI name
68
- SDK_Globals.sdkVersion = '1.0.0'; // Default SDK version
69
- SDK_Globals.appVersion = appPackage.version;
70
- SDK_Globals.sdkuiVersion = '1.0.0'; // Default SDKUI version
71
- // Get initial document info
72
- adapter.operations.getCurrentDocumentInfo().catch(error => {
73
- console.error("Error getting initial document info:", error);
74
- });
75
- }, [adapter, appConfig, appPackage]);
76
- useEffect(() => {
77
- const handleResize = () => {
78
- updateState({ windowWidth: window.innerWidth });
79
- };
80
- window.addEventListener('resize', handleResize);
81
- return () => window.removeEventListener('resize', handleResize);
82
- }, []);
83
- useEffect(() => {
84
- if (state.currentDID && state.isDocumentArchived) {
85
- updateState({
86
- showSearch: false,
87
- showArchive: false
88
- });
89
- }
90
- }, [state.currentDID, state.isDocumentArchived]);
91
- // Word-specific effects
92
- useEffect(() => {
93
- if (adapter.appType === OfficeAppType.WORD && state.currentTID !== undefined) {
94
- if (adapter.operations.updateBookmarksFromDocument && state.currentMids) {
95
- adapter.operations.updateBookmarksFromDocument(state.currentTID, state.currentMids);
96
- }
97
- }
98
- }, [state.currentTID, state.currentMids, adapter]);
99
- useEffect(() => {
100
- if (adapter.appType === OfficeAppType.WORD && state.dcmtType) {
101
- const metadata = state.dcmtType.metadata;
102
- if (metadata) {
103
- const mids = metadata.map(md => md.id).filter((id) => id !== undefined && id > 99);
104
- updateState({ currentMids: mids });
105
- }
106
- }
107
- }, [state.dcmtType, adapter.appType]);
108
- useEffect(() => {
109
- if (adapter.appType === OfficeAppType.WORD && state.allTIDs && state.allTIDs.length > 0) {
110
- if (adapter.operations.searchAndSetBookmarks) {
111
- adapter.operations.searchAndSetBookmarks(state.allTIDs);
112
- }
113
- }
114
- }, [state.allTIDs, adapter]);
115
- const updateFileFromConnector = async () => {
116
- if (isUpdatingRef.current) {
117
- return;
118
- }
119
- try {
120
- isUpdatingRef.current = true;
121
- lastUpdateTimeRef.current = Date.now();
122
- const base64 = await adapter.operations.getCurrentDocumentBase64();
123
- const file = createFileFromBase64(base64, adapter.operations.getDefaultFileName(), adapter.operations.getMimeType());
124
- if (!state.fileFromConnector || file.size !== state.fileFromConnector.size) {
125
- updateState({ fileFromConnector: file });
126
- console.log("File from connector updated");
127
- }
128
- else {
129
- console.log("File from connector unchanged");
130
- }
131
- }
132
- catch (error) {
133
- TMExceptionBoxManager.show({
134
- exception: error
135
- });
136
- }
137
- finally {
138
- isUpdatingRef.current = false;
139
- }
140
- };
141
- const logoutHandler = async () => {
142
- try {
143
- TMSpinner.show();
144
- if (state.tmSession) {
145
- await state.tmSession.LogoutAsync();
146
- }
147
- updateState({
148
- tmSession: undefined,
149
- currentDID: undefined,
150
- currentTID: undefined,
151
- isDocumentArchived: false,
152
- fileFromConnector: null,
153
- showArchive: false,
154
- showSearch: false
155
- });
156
- }
157
- catch (e) {
158
- const err = e;
159
- TMExceptionBoxManager.show({ exception: err });
160
- }
161
- finally {
162
- TMSpinner.hide();
163
- }
164
- };
165
- const saveDocumentBeforeArchive = async () => {
166
- try {
167
- isUpdatingRef.current = false;
168
- const base64 = await adapter.operations.getCurrentDocumentBase64();
169
- const latestFile = createFileFromBase64(base64, adapter.operations.getDefaultFileName(), adapter.operations.getMimeType());
170
- updateState({ fileFromConnector: latestFile });
171
- return latestFile;
172
- }
173
- catch (error) {
174
- TMExceptionBoxManager.show({
175
- exception: error
176
- });
177
- return null;
178
- }
179
- finally {
180
- TMSpinner.hide();
181
- }
182
- };
183
- const getDctmTypeAsync = async (TID) => {
184
- const fetchedDcmtType = await DcmtTypeListCacheService.GetAsync(TID);
185
- if (fetchedDcmtType) {
186
- updateState({ dcmtType: fetchedDcmtType });
187
- }
188
- };
189
- const handleSearchCompleted = async (did, tid) => {
190
- if (did !== undefined && tid !== undefined) {
191
- await getDctmTypeAsync(tid);
192
- // Call adapter-specific handler
193
- if (adapter.onDocumentSelected) {
194
- await adapter.onDocumentSelected(did, tid, updateState);
195
- }
196
- }
197
- };
198
- const handleFileOpen = () => {
199
- updateState({
200
- showSearch: false,
201
- showArchive: false,
202
- isDocumentArchived: false
203
- });
204
- };
205
- const handleArchiveClick = async () => {
206
- updateState({
207
- showArchive: true,
208
- showSearch: false,
209
- isDocumentArchived: false
210
- });
211
- TMSpinner.show({ description: SDKUI_Localizator.Loading });
212
- try {
213
- await updateFileFromConnector();
214
- }
215
- catch (error) {
216
- console.error("Failed to update document:", error);
217
- }
218
- finally {
219
- TMSpinner.hide();
220
- }
221
- };
222
- const handleReplaceDocument = async () => {
223
- const latestFile = await saveDocumentBeforeArchive();
224
- if (latestFile && state.currentDID && state.currentTID) {
225
- await runOperationAsync([{ DID: state.currentDID, TID: state.currentTID, FILE: latestFile }], DcmtOperationTypes.SubstituteFile);
226
- }
227
- else {
228
- console.error("Cannot replace document: missing file or document IDs");
229
- }
230
- };
231
- const getArchiveProps = () => {
232
- // Create a wrapper function that ensures File is returned (not null)
233
- const wrappedConnectorFileSave = async () => {
234
- const file = await saveDocumentBeforeArchive();
235
- if (!file) {
236
- throw new Error('Failed to save document before archiving');
237
- }
238
- return file;
239
- };
240
- const baseProps = {
241
- inputFile: state.fileFromConnector,
242
- connectorFileSave: wrappedConnectorFileSave,
243
- onSavedAsyncCallback: async (tid, did) => {
244
- updateState({
245
- currentTID: tid,
246
- currentDID: did,
247
- isDocumentArchived: true
248
- });
249
- await getDctmTypeAsync(tid);
250
- }
251
- };
252
- // Add Word-specific props
253
- if (adapter.appType === OfficeAppType.WORD) {
254
- return {
255
- ...baseProps,
256
- inputMids: state.bookmarks,
257
- inputTID: state.currentTID,
258
- onCurrentTIDChanged: (tid) => updateState({ currentTID: tid })
259
- };
260
- }
261
- return baseProps;
262
- };
263
- if (!state.tmSession) {
264
- return (_jsx("div", { style: rootStyle, children: state.endpoints && (_jsx(TMLoginForm, { isConnector: true, appModule: adapter.appModule, endpoints: state.endpoints, onLogged: async (tms) => {
265
- TMSpinner.show({ description: SDKUI_Localizator.Loading });
266
- SDK_Globals.useLocalizedName = true;
267
- SDK_Globals.tmSession = tms;
268
- SDKUI_Globals.userSettings.archiveID = tms.SessionDescr?.archiveID;
269
- UserSettings.LoadSettings(tms.SessionDescr?.userID, tms.SessionDescr?.archiveID);
270
- // Call adapter-specific login handler
271
- if (adapter.onSessionLogin) {
272
- await adapter.onSessionLogin(tms, updateState);
273
- }
274
- updateState({ tmSession: tms });
275
- TMSpinner.hide();
276
- }, cultureID: cultureID, onChangeLanguage: (cid) => updateState({ currentCultureID: cid }), sdInput: state.initialSd })) }));
277
- }
278
- return (_jsxs("div", { style: rootStyle, children: [_jsx(TMHeader, { showSettingsMenu: false, showSearchBar: false, onChangePassword: () => updateState({ showChangePassword: true }), onLogout: logoutHandler, customButtons: _jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', gap: 10, justifyContent: 'center' }, children: [state.currentDID !== undefined && (_jsxs(StyledConnectorButton, { "$isActive": true, "$isCurrentDocument": true, "$isCompact": isCompactMode, title: isCompactMode ? "Documento aperto" : undefined, onClick: () => {
279
- updateState({
280
- showSearch: false,
281
- showArchive: false,
282
- isDocumentArchived: false
283
- });
284
- }, children: [_jsx(IconDcmtType, { fontSize: 16 }), _jsx("span", { children: adapter.appType === OfficeAppType.WORD ? "Documento aperto" : "" })] })), _jsxs(StyledConnectorButton, { "$isActive": state.showSearch, "$isCompact": isCompactMode, title: isCompactMode ? "Ricerca" : undefined, onClick: () => {
285
- updateState({
286
- showSearch: true,
287
- showArchive: false,
288
- isDocumentArchived: false
289
- });
290
- }, children: [_jsx(IconSearch, { fontSize: 16 }), _jsx("span", { children: "Ricerca" })] }), _jsxs(StyledConnectorButton, { "$isActive": state.showArchive, "$isCompact": isCompactMode, title: isCompactMode ? SDKUI_Localizator.Archive : undefined, onClick: handleArchiveClick, children: [_jsx(IconArchiveDoc, { fontSize: 16 }), _jsx("span", { children: SDKUI_Localizator.Archive })] }), _jsxs(StyledConnectorButton, { disabled: !state.currentDID, "$isCompact": isCompactMode, title: isCompactMode ? "Sostituisci Documento" : undefined, onClick: handleReplaceDocument, children: [_jsx(IconRefresh, { fontSize: 16 }), _jsx("span", { children: "Sostituisci Documento" })] })] }) }), state.showChangePassword && (_jsx(TMModal, { title: SDK_Globals.appModule, width: calcResponsiveSizes(deviceType, '500px', '500px', '95%'), height: deviceType === DeviceType.MOBILE ? '100%' : '600px', onClose: () => updateState({ showChangePassword: false }), children: _jsx(TMChangePassword, { tmSession: state.tmSession, onClose: () => updateState({ showChangePassword: false }), hasBack: false }) })), _jsx(StyledConnectorContentArea, { style: { display: state.showSearch ? 'block' : 'none' }, children: _jsx(SharedSearchDocument, { onSearchCompleted: handleSearchCompleted, onFileOpen: handleFileOpen, operations: adapter.operations }) }), _jsx(StyledConnectorContentArea, { style: { display: state.showArchive ? 'block' : 'none' }, children: _jsx(TMArchive, { ...getArchiveProps() }) }), _jsx(StyledConnectorFirstPageContent, { style: { display: (!state.showSearch && !state.showArchive) ? 'flex' : 'none' }, children: _jsxs(StyledConnectorCard, { children: [_jsx(StyledConnectorToppyImage, { src: toppy, alt: "Toppy" }), state.currentDID ? (_jsxs("div", { children: ["Document loaded: DID ", state.currentDID] })) : (_jsx("div", { children: "No document selected" }))] }) })] }));
291
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { SearchDocumentProps } from '../types/ConnectorTypes';
3
- export declare const SharedSearchDocument: React.FC<SearchDocumentProps>;
@@ -1,58 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // Shared search component for all Office connectors (designed for sdkui package)
3
- import { useMemo } from 'react';
4
- import { DcmtOpers, GeneralRetrieveFormats, RetrieveFileOptions } from '@topconsultnpm/sdk-ts-beta';
5
- import { convertBlobToBase64 } from '../utils/ConnectorUtils';
6
- import { SDKUI_Localizator, IconFileOpenOutline } from '../../../helper';
7
- import { useDcmtOperations } from '../../../hooks/useDcmtOperations';
8
- import { TMExceptionBoxManager } from '../../base/TMPopUp';
9
- import TMSpinner from '../../base/TMSpinner';
10
- import TMSearch from '../../features/search/TMSearch';
11
- export const SharedSearchDocument = ({ onSearchCompleted, onFileOpen, operations }) => {
12
- const { getDcmtFileAsync } = useDcmtOperations();
13
- const handleClick = async (file) => {
14
- try {
15
- const base64 = await convertBlobToBase64(file);
16
- await operations.insertDocumentFromBase64(base64);
17
- onFileOpen?.();
18
- }
19
- catch (error) {
20
- console.error("Failed to open document:", error);
21
- TMExceptionBoxManager.show({
22
- exception: error,
23
- });
24
- }
25
- };
26
- const openDcmtFile = async (selectedDcmtsOrFocused) => {
27
- try {
28
- TMSpinner.show({ description: SDKUI_Localizator.Loading });
29
- onSearchCompleted?.(Number(selectedDcmtsOrFocused[0].DID), Number(selectedDcmtsOrFocused[0].TID));
30
- const rfo = new RetrieveFileOptions();
31
- rfo.retrieveReason = DcmtOpers.None;
32
- rfo.generalRetrieveFormat = GeneralRetrieveFormats.OriginalUnsigned;
33
- const dcmtFile = await getDcmtFileAsync({ DID: Number(selectedDcmtsOrFocused[0].DID), TID: Number(selectedDcmtsOrFocused[0].TID) }, rfo, 'Anteprima', false, true);
34
- if (dcmtFile?.file) {
35
- await handleClick(dcmtFile.file);
36
- }
37
- else {
38
- throw new Error('Failed to retrieve document file');
39
- }
40
- }
41
- catch (error) {
42
- TMExceptionBoxManager.show({
43
- exception: error,
44
- });
45
- }
46
- finally {
47
- TMSpinner.hide();
48
- }
49
- };
50
- const floatingActionConfig = useMemo(() => ({
51
- isVisible: true,
52
- type: 'single',
53
- onClick: (selected) => { void openDcmtFile(selected); },
54
- iconElement: _jsx(IconFileOpenOutline, { fontSize: 26 }),
55
- tooltip: 'Apri il documento'
56
- }), []);
57
- return (_jsx("div", { style: { width: '100%', height: '100%', position: 'relative' }, children: _jsx(TMSearch, { floatingActionConfig: floatingActionConfig, onFileOpened: handleClick }) }));
58
- };
@@ -1,5 +0,0 @@
1
- export { BaseConnectorApp } from './components/BaseConnectorApp';
2
- export { SharedSearchDocument } from './components/SharedSearchDocument';
3
- export * from './types/ConnectorTypes';
4
- export * from './utils/ConnectorUtils';
5
- export * from './connectors.styles';
@@ -1,9 +0,0 @@
1
- // Shared components and adapters index (designed for sdkui package)
2
- export { BaseConnectorApp } from './components/BaseConnectorApp';
3
- export { SharedSearchDocument } from './components/SharedSearchDocument';
4
- // Types
5
- export * from './types/ConnectorTypes';
6
- // Utils
7
- export * from './utils/ConnectorUtils';
8
- //styles
9
- export * from './connectors.styles';
@@ -1,66 +0,0 @@
1
- import { AppModules, CultureIDs, DcmtTypeDescriptor, ITopMediaSession, SessionDescriptor } from '@topconsultnpm/sdk-ts-beta';
2
- import { DcmtInfo } from '../../../ts';
3
- import { TMEndpointsType } from '../../forms/Login/TMLoginForm';
4
- export declare enum OfficeAppType {
5
- EXCEL = "EXCEL",
6
- WORD = "WORD",
7
- POWERPOINT = "POWERPOINT"
8
- }
9
- export type BookMarkMetadata = {
10
- mid: number;
11
- value: string;
12
- };
13
- export interface DocumentInfo {
14
- name?: string;
15
- title?: string;
16
- itemCount?: number;
17
- additionalInfo?: any;
18
- }
19
- export interface ConnectorState {
20
- tmSession?: ITopMediaSession;
21
- currentCultureID?: CultureIDs;
22
- initialSd?: SessionDescriptor;
23
- endpoints: Object[];
24
- showChangePassword: boolean;
25
- showArchive: boolean;
26
- showSearch: boolean;
27
- windowWidth: number;
28
- fileFromConnector: File | null;
29
- currentDID?: number;
30
- currentTID?: number;
31
- isDocumentArchived: boolean;
32
- dcmtType?: DcmtTypeDescriptor;
33
- currentMids?: number[];
34
- bookmarks?: BookMarkMetadata[];
35
- allTIDs?: number[];
36
- }
37
- export interface OfficeOperations {
38
- getCurrentDocumentInfo: () => Promise<DocumentInfo>;
39
- getCurrentDocumentBase64: () => Promise<string>;
40
- insertDocumentFromBase64: (base64: string) => Promise<void>;
41
- getMimeType: () => string;
42
- getDefaultFileName: () => string;
43
- getBookmarksInfo?: () => Promise<BookMarkMetadata[]>;
44
- searchAndSetBookmarks?: (allTIDs: number[]) => Promise<void>;
45
- updateBookmarksFromDocument?: (currentTID?: number, currentMids?: number[]) => Promise<void>;
46
- }
47
- export interface ConnectorAdapter {
48
- appType: OfficeAppType;
49
- appModule: AppModules;
50
- operations: OfficeOperations;
51
- getInitialState?: () => Partial<ConnectorState>;
52
- onSessionLogin?: (tms: ITopMediaSession, setState: (updates: Partial<ConnectorState>) => void) => Promise<void>;
53
- onDocumentSelected?: (did: number, tid: number, setState: (updates: Partial<ConnectorState>) => void) => Promise<void>;
54
- }
55
- export interface SearchDocumentProps {
56
- onSearchCompleted?: (did?: number, tid?: number) => void;
57
- onFileOpen?: () => void;
58
- operations: OfficeOperations;
59
- }
60
- export interface ConnectorConfig {
61
- adapter: ConnectorAdapter;
62
- appConfig: any;
63
- appPackage: any;
64
- isCompactModeThreshold?: number;
65
- }
66
- export type { ITopMediaSession, CultureIDs, SessionDescriptor, DcmtTypeDescriptor, AppModules, DcmtInfo, TMEndpointsType };
@@ -1,6 +0,0 @@
1
- export var OfficeAppType;
2
- (function (OfficeAppType) {
3
- OfficeAppType["EXCEL"] = "EXCEL";
4
- OfficeAppType["WORD"] = "WORD";
5
- OfficeAppType["POWERPOINT"] = "POWERPOINT";
6
- })(OfficeAppType || (OfficeAppType = {}));
@@ -1,32 +0,0 @@
1
- /**
2
- * Converts base64 string to Blob with specified MIME type
3
- */
4
- export declare function base64ToBlob(base64: string, mimeType: string): Blob;
5
- /**
6
- * Converts Blob to base64 string
7
- */
8
- export declare function convertBlobToBase64(blob: Blob): Promise<string>;
9
- /**
10
- * Triggers download of a file from base64 data
11
- */
12
- export declare function downloadFileFromBase64(base64: string, filename: string, mimeType: string): void;
13
- /**
14
- * Creates a File object from base64 data
15
- */
16
- export declare function createFileFromBase64(base64: string, filename: string, mimeType: string): File;
17
- /**
18
- * MIME type constants for Office documents
19
- */
20
- export declare const MIME_TYPES: {
21
- readonly EXCEL: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
22
- readonly WORD: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
23
- readonly POWERPOINT: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
24
- };
25
- /**
26
- * Default file names for Office documents
27
- */
28
- export declare const DEFAULT_FILENAMES: {
29
- readonly EXCEL: "CurrentExcelWorkbook.xlsx";
30
- readonly WORD: "CurrentWordDoc.docx";
31
- readonly POWERPOINT: "CurrentPowerPointPresentation.pptx";
32
- };
@@ -1,76 +0,0 @@
1
- // Utility functions for Office Connector components (designed for sdkui package)
2
- // Note: Office-specific implementations will be provided by consuming projects
3
- /**
4
- * Converts base64 string to Blob with specified MIME type
5
- */
6
- export function base64ToBlob(base64, mimeType) {
7
- const cleanedBase64 = base64.replace(/[^A-Za-z0-9+/=]/g, '');
8
- const byteCharacters = atob(cleanedBase64);
9
- const byteArrays = [];
10
- for (let offset = 0; offset < byteCharacters.length; offset += 512) {
11
- const slice = byteCharacters.slice(offset, offset + 512);
12
- const byteNumbers = Array.from(slice).map(char => char.charCodeAt(0));
13
- byteArrays.push(new Uint8Array(byteNumbers));
14
- }
15
- return new Blob(byteArrays, { type: mimeType });
16
- }
17
- /**
18
- * Converts Blob to base64 string
19
- */
20
- export function convertBlobToBase64(blob) {
21
- return new Promise((resolve, reject) => {
22
- const reader = new FileReader();
23
- reader.onloadend = () => {
24
- const result = reader.result;
25
- resolve(result.split(',')[1]);
26
- };
27
- reader.onerror = reject;
28
- reader.readAsDataURL(blob);
29
- });
30
- }
31
- /**
32
- * Triggers download of a file from base64 data
33
- */
34
- export function downloadFileFromBase64(base64, filename, mimeType) {
35
- try {
36
- const blob = base64ToBlob(base64, mimeType);
37
- const url = URL.createObjectURL(blob);
38
- const link = document.createElement('a');
39
- link.href = url;
40
- link.download = filename;
41
- link.style.display = 'none';
42
- document.body.appendChild(link);
43
- link.click();
44
- document.body.removeChild(link);
45
- URL.revokeObjectURL(url);
46
- }
47
- catch (error) {
48
- console.error('Failed to trigger download:', error);
49
- }
50
- }
51
- /**
52
- * Creates a File object from base64 data
53
- */
54
- export function createFileFromBase64(base64, filename, mimeType) {
55
- const blob = base64ToBlob(base64, mimeType);
56
- return new File([blob], filename, {
57
- type: blob.type,
58
- lastModified: Date.now()
59
- });
60
- }
61
- /**
62
- * MIME type constants for Office documents
63
- */
64
- export const MIME_TYPES = {
65
- EXCEL: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
66
- WORD: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
67
- POWERPOINT: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
68
- };
69
- /**
70
- * Default file names for Office documents
71
- */
72
- export const DEFAULT_FILENAMES = {
73
- EXCEL: 'CurrentExcelWorkbook.xlsx',
74
- WORD: 'CurrentWordDoc.docx',
75
- POWERPOINT: 'CurrentPowerPointPresentation.pptx'
76
- };