@fileverse-dev/dsheet 1.0.87-patch-1 → 1.0.88

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.
@@ -1,9 +1,11 @@
1
1
  import { default as React } from 'react';
2
+ import { SmartContractQueryHandler } from '../utils/after-update-cell';
2
3
  import { OnboardingHandlerType, DataBlockApiKeyHandlerType } from '../types';
3
4
 
4
5
  type OnboardingHandler = OnboardingHandlerType;
5
6
  type DataBlockApiKeyHandler = DataBlockApiKeyHandlerType;
6
7
  interface EditorWorkbookProps {
8
+ setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
7
9
  setShowFetchURLModal?: React.Dispatch<React.SetStateAction<boolean>>;
8
10
  setFetchingURLData?: (fetching: boolean) => void;
9
11
  setInputFetchURLDataBlock?: React.Dispatch<React.SetStateAction<string>>;
@@ -22,6 +24,7 @@ interface EditorWorkbookProps {
22
24
  onDataBlockApiResponse?: (dataBlockName: string) => void;
23
25
  onDuneChartEmbed?: () => void;
24
26
  onSheetCountChange?: (sheetCount: number) => void;
27
+ handleSmartContractQuery?: SmartContractQueryHandler;
25
28
  }
26
29
  /**
27
30
  * EditorWorkbook component handles rendering the Fortune Workbook with proper configuration
@@ -0,0 +1,5 @@
1
+
2
+ export declare const SmartContractButton: ({ handleImportSmartContract, handleViewSmartContract, }: {
3
+ handleImportSmartContract: () => void;
4
+ handleViewSmartContract: () => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,7 @@ import { SheetUpdateData } from '../types';
5
5
 
6
6
  import * as Y from 'yjs';
7
7
  export interface EditorContextType {
8
+ setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
8
9
  getDocumentTitle?: () => string;
9
10
  updateDocumentTitle?: (title: string) => void;
10
11
  isAuthorized: boolean;
@@ -36,6 +37,7 @@ export interface EditorContextType {
36
37
  isCollaborative?: boolean;
37
38
  }
38
39
  interface EditorProviderProps {
40
+ setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
39
41
  getDocumentTitle?: () => string;
40
42
  updateDocumentTitle?: (title: string) => void;
41
43
  isAuthorized: boolean;
@@ -7,5 +7,5 @@ import { DsheetProps } from './types';
7
7
  * @param props - Component properties
8
8
  * @returns The SpreadsheetEditor component
9
9
  */
10
- declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, editorStateRef, }: DsheetProps) => JSX.Element;
10
+ declare const SpreadsheetEditor: ({ isCollaborative, isReadOnly, allowComments, renderNavbar, enableIndexeddbSync, dsheetId, portalContent, onChange, username, selectedTemplate, toggleTemplateSidebar, isTemplateOpen, enableWebrtc, onboardingComplete, onboardingHandler, commentData, getCommentCellUI, dataBlockApiKeyHandler, setFetchingURLData, setShowFetchURLModal, setInputFetchURLDataBlock, sheetEditorRef: externalSheetEditorRef, storeApiKey, onDuneChartEmbed, onSheetCountChange, onDataBlockApiResponse, isAuthorized, getDocumentTitle, updateDocumentTitle, setShowSmartContractModal, editorStateRef, handleSmartContractQuery, }: DsheetProps) => JSX.Element;
11
11
  export default SpreadsheetEditor;
@@ -1,6 +1,7 @@
1
1
  import { Sheet, WorkbookInstance, Cell } from '@fileverse-dev/fortune-react';
2
2
  import { RefObject } from 'react';
3
3
  import { ERROR_MESSAGES_FLAG } from './constants/shared-constants';
4
+ import { SmartContractQueryHandler } from './utils/after-update-cell';
4
5
 
5
6
  import * as Y from 'yjs';
6
7
  export interface SheetUpdateData {
@@ -35,6 +36,7 @@ export type DataBlockApiKeyHandlerType = (params: {
35
36
  }) => void;
36
37
  }) => void;
37
38
  export interface DsheetProps {
39
+ setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
38
40
  getDocumentTitle?: () => string;
39
41
  updateDocumentTitle?: (title: string) => void;
40
42
  isAuthorized: boolean;
@@ -70,6 +72,7 @@ export interface DsheetProps {
70
72
  editorStateRef?: React.MutableRefObject<{
71
73
  refreshIndexedDB: () => Promise<void>;
72
74
  } | null>;
75
+ handleSmartContractQuery?: SmartContractQueryHandler;
73
76
  }
74
77
  export type BaseError = {
75
78
  message: string;
@@ -1,6 +1,17 @@
1
1
  import { Cell, WorkbookInstance } from '@fileverse-dev/fortune-react';
2
2
  import { OnboardingHandlerType, DataBlockApiKeyHandlerType } from '../types';
3
3
 
4
+ export type SmartContractResponse = {
5
+ callSignature: unknown[];
6
+ };
7
+ export type SheetSmartContractApi = {
8
+ sheetEditorRef: React.RefObject<WorkbookInstance | null>;
9
+ formulaResponseUiSync: Function;
10
+ row: number;
11
+ column: number;
12
+ newValue: Cell;
13
+ };
14
+ export type SmartContractQueryHandler = (sheetApi: SheetSmartContractApi) => (callSignature: unknown[]) => Promise<void>;
4
15
  /**
5
16
  * Parameters for the afterUpdateCell function
6
17
  */
@@ -14,6 +25,7 @@ interface AfterUpdateCellParams {
14
25
  setFetchingURLData: (fetching: boolean) => void;
15
26
  onboardingHandler: OnboardingHandlerType | undefined;
16
27
  dataBlockApiKeyHandler: DataBlockApiKeyHandlerType | undefined;
28
+ handleSmartContractQuery: SmartContractQueryHandler | undefined;
17
29
  setInputFetchURLDataBlock: React.Dispatch<React.SetStateAction<string>> | undefined;
18
30
  storeApiKey?: (apiKeyName: string) => void;
19
31
  onDataBlockApiResponse?: (dataBlockName: string) => void;
@@ -2,7 +2,8 @@ import { default as React, ChangeEvent } from 'react';
2
2
  import { WorkbookInstance } from '@fileverse-dev/fortune-react';
3
3
 
4
4
  import * as Y from 'yjs';
5
- export declare const getCustomToolbarItems: ({ setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, getDocumentTitle, updateDocumentTitle, }: {
5
+ export declare const getCustomToolbarItems: ({ setShowSmartContractModal, setExportDropdownOpen, handleCSVUpload, handleXLSXUpload, handleExportToXLSX, handleExportToCSV, handleExportToJSON, sheetEditorRef, ydocRef, dsheetId, currentDataRef, setForceSheetRender, toggleTemplateSidebar, getDocumentTitle, updateDocumentTitle, }: {
6
+ setShowSmartContractModal?: React.Dispatch<React.SetStateAction<boolean>>;
6
7
  getDocumentTitle?: () => string;
7
8
  updateDocumentTitle?: (title: string) => void;
8
9
  setExportDropdownOpen: React.Dispatch<React.SetStateAction<boolean>>;
@@ -18,9 +19,14 @@ export declare const getCustomToolbarItems: ({ setExportDropdownOpen, handleCSVU
18
19
  setForceSheetRender: React.Dispatch<React.SetStateAction<number>>;
19
20
  toggleTemplateSidebar: (() => void) | undefined;
20
21
  setShowFetchURLModal: React.Dispatch<React.SetStateAction<boolean>> | undefined;
21
- }) => {
22
+ }) => ({
23
+ key: string;
24
+ tooltip: string;
25
+ icon: import("react/jsx-runtime").JSX.Element;
26
+ onClick?: undefined;
27
+ } | {
22
28
  key: string;
23
29
  tooltip: string;
24
30
  icon: import("react/jsx-runtime").JSX.Element;
25
31
  onClick: (() => void) | undefined;
26
- }[];
32
+ })[];