@tabres/react 1.0.55 → 1.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,12 @@ import { LocalizedText } from "src/modules/localization/models";
2
2
  export interface Category {
3
3
  id: number;
4
4
  businessId: number;
5
+ /**
6
+ * Parent category id, or null when the category sits at the top level. The
7
+ * tree is two levels deep at most: a parent holds subcategories, every other
8
+ * category holds products
9
+ */
10
+ parentId?: number | null;
5
11
  /**
6
12
  * Category name keyed by language code, e.g. { en: "Drinks", az: "İçkilər" }.
7
13
  * Mirrors the `name` JSONB column returned by the API
@@ -1,3 +1,24 @@
1
1
  import { Category } from "./models";
2
2
  export declare const getCategoryName: (category: Pick<Category, "name">, language: string) => string;
3
3
  export declare const getCategoryNameById: (categoryId: number, categories: Category[], language: string) => string;
4
+ /**
5
+ * A child category is nested under a parent. The public menu keeps it out of the
6
+ * category strip and renders it inside its parent's product block instead.
7
+ */
8
+ export declare const getIsChildCategory: (category: Pick<Category, "parentId">) => boolean;
9
+ /**
10
+ * The category `category` nests under, or undefined when it stays top level.
11
+ *
12
+ * The tree is two levels deep at most, so a category only nests under a parent
13
+ * that exists in `categories`, is not the category itself and is not nested
14
+ * itself. A child that fails any of these keeps a place of its own rather than
15
+ * dropping out of the menu. Every caller that decides where a category sits
16
+ * goes through here, so the strip, the product blocks and deep links agree.
17
+ */
18
+ export declare const getParentCategory: <T extends Pick<Category, "id" | "parentId">>(category: T, categories: T[]) => T | undefined;
19
+ /**
20
+ * Resolves a category id to the one the category strip shows: a child answers
21
+ * with its parent, every other category with itself. Menus without
22
+ * subcategories always get the id back untouched.
23
+ */
24
+ export declare const getTopLevelCategoryId: (categoryId: number, categories: Category[]) => number;
@@ -7,6 +7,13 @@ import * as videoModels from "src/modules/video/models";
7
7
  import { LocalizedText } from "src/modules/localization/models";
8
8
  export interface CategoryProductMap extends categoryModels.Category {
9
9
  products: productModels.Product[];
10
+ /**
11
+ * Child categories nested under this one, each carrying its own products.
12
+ * `prepareCategoryAndProductMap` always sets it — empty unless the business
13
+ * groups its menu with parent categories. Optional so a map built by hand
14
+ * stays valid.
15
+ */
16
+ subcategories?: CategoryProductMap[];
10
17
  }
11
18
  export interface MenuDesign {
12
19
  id?: number;
@@ -1,4 +1,14 @@
1
1
  import * as categoryModels from "src/modules/category/models";
2
2
  import * as productModels from "src/modules/product/models";
3
3
  import { CategoryProductMap } from "./models";
4
+ /**
5
+ * Groups visible products under their categories and nests child categories
6
+ * under their parents, keeping the order the categories were given in.
7
+ *
8
+ * Every entry in the result is a top-level category, so the category strip
9
+ * gives each one a chip. Its `parentId` is cleared to say so, which also covers
10
+ * a child whose parent is missing and therefore stays top level. Categories
11
+ * with nothing to show — no visible products and no subcategory with any — are
12
+ * left out.
13
+ */
4
14
  export declare const prepareCategoryAndProductMap: (categories: categoryModels.Category[], products: productModels.Product[]) => CategoryProductMap[];
@@ -5,7 +5,16 @@ export declare enum EmployeePermission {
5
5
  VIEW_ORDERS = "VIEW_ORDERS",
6
6
  UPDATE_ORDER = "UPDATE_ORDER",
7
7
  CREATE_ORDER = "CREATE_ORDER",
8
+ /**
9
+ * The KDS's only verb: advancing a line PENDING -> PREPARING -> READY -> SERVED.
10
+ * Deliberately separate from UPDATE_ORDER, which also carries close-the-bill,
11
+ * void-a-line, add-items and change-table. Kitchen and runner roles hold this
12
+ * INSTEAD of UPDATE_ORDER; floor and management roles hold both.
13
+ */
14
+ UPDATE_ORDER_ITEM_STATUS = "UPDATE_ORDER_ITEM_STATUS",
8
15
  APPLY_DISCOUNT = "APPLY_DISCOUNT",
16
+ /** Sending a paid order's receipt PDF to a customer over email/WhatsApp. */
17
+ SEND_RECEIPT = "SEND_RECEIPT",
9
18
  VIEW_QR_MENU = "VIEW_QR_MENU",
10
19
  UPDATE_QR_MENU = "UPDATE_QR_MENU",
11
20
  VIEW_MENU = "VIEW_MENU",
@@ -30,6 +39,13 @@ export declare enum EmployeePermission {
30
39
  UPDATE_BRANCH = "UPDATE_BRANCH",
31
40
  CREATE_BRANCH = "CREATE_BRANCH",
32
41
  DELETE_BRANCH = "DELETE_BRANCH",
42
+ VIEW_STATIONS = "VIEW_STATIONS",
43
+ UPDATE_STATION = "UPDATE_STATION",
44
+ CREATE_STATION = "CREATE_STATION",
45
+ DELETE_STATION = "DELETE_STATION",
46
+ VIEW_DEVICES = "VIEW_DEVICES",
47
+ ENROLL_DEVICE = "ENROLL_DEVICE",
48
+ REVOKE_DEVICE = "REVOKE_DEVICE",
33
49
  VIEW_EMPLOYEES = "VIEW_EMPLOYEES",
34
50
  UPDATE_EMPLOYEE = "UPDATE_EMPLOYEE",
35
51
  CREATE_EMPLOYEE = "CREATE_EMPLOYEE",
@@ -64,8 +80,10 @@ export declare enum EmployeePermission {
64
80
  }
65
81
  export declare enum UserRole {
66
82
  OWNER = "OWNER",
83
+ SUPER_ADMIN = "SUPER_ADMIN",
67
84
  BRANCH_MANAGER = "BRANCH_MANAGER",
68
85
  GENERAL_MANAGER = "GENERAL_MANAGER",
86
+ BUSINESS_MANAGER = "BUSINESS_MANAGER",
69
87
  CHEF = "CHEF",
70
88
  SOUS_CHEF = "SOUS_CHEF",
71
89
  PASTRY_CHEF = "PASTRY_CHEF",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tabres/react",
3
- "version": "1.0.55",
3
+ "version": "1.0.58",
4
4
  "description": "React Library by tabres.com",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",