UNPKG

@selldone/sdk-storefront

Version:

A TypeScript SDK to connect to your shop and build a fully functional storefront and website by simply developing a frontend web application. All backend operations are seamlessly managed by the serverless Selldone solution.

34 lines (33 loc) 1.59 kB
type IAugmentItem = { key: string; value: any; type: "text" | "image"; group?: string; group_index?: number; }; /** * Helper class for augmenting arrays. */ export declare class AugmentHelper { /** * Merges two arrays by updating or adding items from the second array to the first. * * @param augment The primary array to be augmented. If not provided or invalid, it's initialized as an empty array. * @param otherArray The array containing items to update or add to the primary array. * @returns The augmented array. */ static MixAugments(augment: IAugmentItem[] | null, otherArray: IAugmentItem[]): IAugmentItem[]; /** * Converts a nested object into a flat array of objects, where each object represents * a key-value pair from the original object. The key represents the path to the value in the original object. * * @param obj - The object to be flattened into an array. * @param parentKey - The parent key to be prefixed to the keys in the object. This is used for recursion and should be left empty when called initially. * @returns An array of AugmentItemI objects, each containing the key (path), value, and type ('text' or 'image'). * * The function supports detecting if the value is a text or an image based on the file extension (e.g., '.jpg', '.png', '.gif'). * It also handles nested objects recursively, building the full key path for each value in the object. */ static ConvertToAugmentArray(obj: any, parentKey?: string): IAugmentItem[]; } export {};