UNPKG

@transact-open-ux/core

Version:

Provides utility methods to integrate with the Transact Platform

139 lines (138 loc) 3.99 kB
/** * @private * @param buf * @returns {String|string|*} */ export declare const bufferToBinaryString: (buf: any) => string; /** * @private * @param binstr * @returns {*} */ export declare const binaryStringToBuffer: (binstr: any) => Uint8Array; /** * functions below are from unibabel v2.1.3 (Nov 18, 2015) * Base64, TypedArrays, and UTF-8 / Unicode conversions in Browser * https://github.com/coolaj86/unibabel-js * @private */ export declare const utf8ToBinaryString: (str: any) => string; /** * @private * @param str */ export declare const utf8ToBuffer: (str: any) => Uint8Array; /** * @private * @param str * @returns {*} */ export declare const utf8ToBase64: (str: any) => string; /** * @private * @param binstr * @returns {string} */ export declare const binaryStringToUtf8: (binstr: any) => string; /** * @private * @param buf * @returns {string} */ export declare const bufferToUtf8: (buf: any) => string; /** * @private * @param b64 * @returns {string} */ export declare const base64ToUtf8: (b64: any) => string; /** * @private * @param arr * @returns {*} */ export declare const bufferToBase64: (arr: any) => string; /** * @private * @param base64 * @returns {*} */ export declare const base64ToBuffer: (base64: any) => Uint8Array; /** * @private * @param key */ export declare const getCookie: (key: any) => string | null | undefined; /** * Gets the value from a data object via the part parameter. * * #### Example * * ```js * import { getDataFromPath } from "transact-open-ux/core"; * * const formState = { * Applicant: { * FirstName: "David" * } * }; * * // FirstName === "David * const FirstName = getDataFromPath("Applicant.FirstName", formState); * ``` * @param path The path to get the data from * @param data The object to lookup the path * @returns Returns the value found at the path location within the data object. */ export declare const getDataFromPath: (path: string | undefined, data: object) => object; /** * Sets the data path to the value. * #### Example * * ```js * import { setDataFromPath } from "transact-open-ux/core"; * * const formState = { * Applicant: { * FirstName: "David" * } * }; * * // formState.Applicant.FirstName === "Joe" * ``` * setDataFromPath("Applicant.FirstName", formState, "Joe"); * @param path The path to set the data * @param data The object to find and set the data path in * @param value The value to set the data to * @returns The modified object. */ export declare const setDataFromPath: (path: string | undefined, data: object, value: any) => object; /** * Redirects the app to another target url * @param redirectTarget The url to redirect to. */ export declare const redirect: (redirectTarget: string) => void; /** * Returns an object of the current URL parameters. The keys are the parameter names * @returns An object of the current URL parameters. The keys are the parameter names. */ export declare const getUrlQueryParams: () => {}; /** * Returns the value of the URL parameter. Or null if it does not exist. * @param key The URL Parameter name. * @returns The value of the URL parameter. Or null if it does not exist. */ export declare const getUrlQueryParam: (key: string) => any; /** * returns a json string from an object, stripping out any keys that start with a dollar sign * @param object The object to transform to a JSON string * @param prettify A boolean value indicating whether to prettify the output * @returns A JSON string representation of an object, stripping out any keys that start with a dollar sign. */ export declare const jsonify: (object: object, prettify?: boolean | undefined) => any; /** * @private * Removes null and undefined properties from the object * @param object */ export declare const cleanObjProps: (object?: object) => void;