@open-tender/utils
Version:
A library of utils for use with Open Tender applications that utilize our cloud-based Order API.
131 lines (130 loc) • 5 kB
TypeScript
import { MenuCategories, MenuDisplayedSections, ThemeImagePosition, Timezone } from '@open-tender/types';
export declare const getBinaryArr: <T>(arr: T[]) => T[][];
export declare const makeItemChunks: <T extends {
id: number;
}>(items: T[], chunkSize: number) => {
key: string;
items: T[];
}[];
export declare const makeOtherMenuSections: (displayedSections: MenuDisplayedSections, length?: number) => {
name: string;
id: string;
key: string;
data: {
key: string;
allergens: string | null;
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
app_image_url: string | null;
calories: number | null;
description: string | null;
dimensions: number[] | null;
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
featured_position: number | null;
id: number;
increment: number;
ingredients: string | null;
is_alcohol: boolean;
item_id: number;
large_image_url: string | null;
max_quantity: number;
menu_position: number;
min_quantity: number;
name: string;
nutritional_info: import("@open-tender/types").NutritionalInfo | null;
option_groups: import("@open-tender/types").MenuItemGroups;
plu: string | null;
points: number | null;
pos_display_color: string | null;
pos_ext_id: string | null;
price: string;
sales_tax_override: `${number}.${number}` | null;
short_description: string | null;
short_name: string;
shorthand: string | null;
similar_items: number[];
slug: string;
small_image_url: string | null;
suspend_until: number | null;
tags: string | null;
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
taxes: import("@open-tender/types").MenuItemTaxes;
temperature: import("@open-tender/types").Temperature;
upsell_items: number[];
item_shape: import("@open-tender/types").PizzaShape | null;
exclude_from_builder: boolean;
list_name: string | null;
list_id: string | null;
index?: number | undefined;
}[];
}[];
export declare const makeFlatCategories: (categories: MenuCategories) => {
key: string;
data: {
key: string;
allergens: string | null;
allergens_list?: import("@open-tender/types").MenuItemAllergens | undefined;
app_image_url: string | null;
calories: number | null;
description: string | null;
dimensions: number[] | null;
favorite?: import("@open-tender/types").MenuItemFavorite | undefined;
featured_position: number | null;
id: number;
increment: number;
ingredients: string | null;
is_alcohol: boolean;
item_id: number;
large_image_url: string | null;
max_quantity: number;
menu_position: number;
min_quantity: number;
name: string;
nutritional_info: import("@open-tender/types").NutritionalInfo | null;
option_groups: import("@open-tender/types").MenuItemGroups;
plu: string | null;
points: number | null;
pos_display_color: string | null;
pos_ext_id: string | null;
price: string;
sales_tax_override: `${number}.${number}` | null;
short_description: string | null;
short_name: string;
shorthand: string | null;
similar_items: number[];
slug: string;
small_image_url: string | null;
suspend_until: number | null;
tags: string | null;
tags_list?: import("@open-tender/types").MenuItemTags | undefined;
taxes: import("@open-tender/types").MenuItemTaxes;
temperature: import("@open-tender/types").Temperature;
upsell_items: number[];
item_shape: import("@open-tender/types").PizzaShape | null;
exclude_from_builder: boolean;
list_name: string | null;
list_id: string | null;
index?: number | undefined;
}[];
app_image_url: string | null;
appearance: import("@open-tender/types").MenuCategoryAppearance;
children: MenuCategories;
description: string | null;
id: number;
items: import("@open-tender/types").MenuItems;
large_image_url: string | null;
menu_name: string;
menu_name_id: number;
menu_position: number;
name: string;
pos: import("@open-tender/types").MenuCategoryPos | null;
revenue_center_id: number | null;
short_name: string;
slug: string;
small_image_url: string | null;
}[];
export declare const makeMenuItemLayout: (position: ThemeImagePosition) => {
hideImage: boolean;
flexDirection: string;
alignItems: string;
};
export declare const makeSuspendUnitlMsg: (suspendedUntil: number | null | undefined, tz: Timezone, soldOutMessage: string | undefined, withTime?: boolean) => string;