UNPKG

react-js-plugins

Version:

A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.

78 lines (77 loc) 4.44 kB
import { MenuItem, ReducerActionHandler, UseStorageParams } from "../typesdts/types"; export declare const isWindowReady: () => boolean; export declare const isBrowser: boolean; export declare const _alert: ({ title, text, icon, confirmButtonText, cancelButtonText, showCancelButton, showConfirmButton, confirmButtonColor, cancelButtonColor, input, inputPlaceholder, inputValidator, customClass, timer, allowOutsideClick, html, toast, position, ...rest }: any) => Promise<any>; export declare const _confirm: ({ title, text, icon, confirmButtonText, cancelButtonText, showCancelButton, confirmButtonColor, cancelButtonColor, reverseButtons, focusCancel, allowOutsideClick, customClass, html, ...rest }: any) => Promise<any>; export declare const _encodeURI: (str: string) => string; export declare const _decodeURI: (str: string) => string; export declare const _encryptJson: (decrypted: any, secretKey: string) => string | null; export declare const _decryptJson: (encrypted: string, secretKey: string) => any; export declare const _encryptString: (text: string, secretKey: string, isRandom?: boolean) => { ciphertext: string; iv: string; }; export declare const _decryptString: (ciphertext: string, ivBase64: string, secretKey: string) => string; export declare const _encryptPayload: (jsonData: any, secretKey: string) => { data: string; header: string; iv: string; } | undefined; export declare const _generatePassword: (length?: number) => string; export declare const _getStartStopTime: (sdate: Date, format?: string) => "Invalid Date" | { startTime: string; stopTime: string; }; export declare const _getUTCTimestamp: ({ year, month, day, hour, minute, second }: any) => number; export declare const _isEmptyArray: (value: unknown) => boolean; export declare const _isEmptyObject: (obj: object) => boolean; export declare const _isValueInArray: <T>(array: unknown, value: T) => boolean; interface ExportExcelParams { data: any[]; filename: string; extension?: string; } interface FileUploadResult { result?: string | ArrayBuffer | Uint8Array | File; fileName?: string; fileSize?: string; fileExtension?: string; error?: Error; } export declare const _importFile: (file: File, resultType: "base64" | "buffer" | "file" | "unitarray") => Promise<FileUploadResult>; export declare const _exportExcel: ({ data, filename, extension }: ExportExcelParams) => Promise<string>; interface FileUploadResult { data?: any[]; error?: Error; } export declare const _importExcel: (file: any) => Promise<FileUploadResult>; export declare const _promise: (time: number) => Promise<unknown>; export declare const _sleep: (time: number) => Promise<unknown>; export declare const _hasItem: (menuItems: MenuItem[], path: string, key?: string) => any | null; export declare const _hasElement: (arr: MenuItem[], key: string, value: any) => any | null; export declare const _flattenArray: (arr: any[]) => any[]; export declare const _dynamicReducer: (initialState: any) => (state: any, action: any) => any; export declare const _genericReducer: <State, Action extends { type: string; }>(initialState: State, actions: Record<string, ReducerActionHandler<State, Action>>) => (state: State | undefined, action: Action) => State; export declare const _thousandSeparator: (num: number) => { allDecimal: string; twoDecimal: string; }; export declare const _getFinancialYear: () => string; export declare const _getStorage: ({ action, type, key, value }: UseStorageParams) => any | null; export declare const _deepClone: <T>(obj: T) => T; export declare const _getCookie: (name: string) => string | null; export declare const _setCookie: (name: string, value: string, days: number) => void; export declare const _mergeObjects: <T extends Record<string, any>>(obj1: T, obj2: T) => T; export declare const _mapObject: <T>(obj: { [key: string]: any; }, callback: (key: string, value: any) => T) => T[]; export declare const _isEqual: <T>(value1: T, value2: T) => boolean; export declare const _capitalize: (str: string | null | undefined) => string; export declare const _convertToCurrency: (amount: number, currency?: string) => string; export declare const _getBrowserInfo: () => string; export declare const _isMobile: () => boolean; export declare const _parseJSON: <T>(json: string) => T | null; export declare const _stringifyJSON: <T>(value: T) => string | null; export {};