UNPKG

bc-node-sdk

Version:

BetterCommerce's NodeJS SDK encapsulates the base framework for all the Next.js applications.

38 lines (37 loc) 1.74 kB
/** * Class {@link UIUtil} encapsulates the utility methods related to User Interface. */ export default abstract class UIUtil { /** * Returns a class string consisting of the given class names. Ignores falsy values. * Example: classNames('foo', 0, 'bar', null, 'baz') => 'foo bar baz' * * @function * @param {...any} classes The class names to be combined. * @returns {string} The combined class string. */ static classNames(...classes: any): string; /** * Generates a flat array from a tree structured data. * * @param {any[]} treeData - The tree structured data to be flattened. * @param {boolean} [isChild=false] - Whether the current element is a child or not. * @param {string} [suffix=''] - The suffix to be used for the parent id. * @returns {any[]} - The flattened array. */ static generateFlatArrayFromTree(treeData: any[], isChild?: boolean, suffix?: string): any; /** * Converts a file to a base64 string. If onlyBinary is true, the method will return only the binary part of the base64 string. * @param file the file to convert * @param onlyBinary if true, the method will return only the binary part of the base64 string * @returns a promise resolved with the base64 string */ static convertToBase64(file: any, onlyBinary?: boolean): Promise<unknown>; /** * Converts a base64 string to a blob. * @param {string} base64File The base64 string to convert. * @returns {Blob} The blob from the base64 string. */ static convertBase64ToBlob(base64File: string, options?: any): Blob; static copyToClipboard(text: any): Promise<boolean>; }