meemup-library 1.2.47 → 1.2.50

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.
@@ -1,12 +1,11 @@
1
- import IOrderScreenState from "../interfaces/IOrderScreenState";
2
1
  import EnumOrderType from "../enums/EnumOrderType";
3
2
  import IOrderItem from "../interfaces/order/IOrderItem";
4
3
  import ICategory from "../interfaces/ICategory";
5
4
  import IProduct from "../interfaces/IProduct";
6
5
  declare const _default: {
7
6
  checkDayWeek: (index: number, weekDays: number) => boolean;
8
- fetchCategories(categories: ICategory[]): ICategory[];
9
- fetchProducts(arg: IOrderScreenState, products: IProduct[], categories: ICategory[]): IProduct[];
7
+ fetchCategories(categories: ICategory[], word?: string): ICategory[];
8
+ fetchProducts(products: IProduct[], categories: ICategory[], categoryId: number, word?: string): IProduct[];
10
9
  searchProduct(products: IProduct[], word: string): IProduct[];
11
10
  productPrice(product: IProduct, orderType: EnumOrderType): number;
12
11
  productCountInOrder(product: IProduct, items: IOrderItem[]): number;
@@ -15,8 +15,11 @@ export default new class OrderScreenController {
15
15
  return false;
16
16
  };
17
17
  }
18
- fetchCategories(categories) {
18
+ fetchCategories(categories, word = "") {
19
19
  let list = categories.filter(i => i.availableIn === EnumCategoryAvailableIn.EVERY_WHERE || i.availableIn === EnumCategoryAvailableIn.POS_ONLY);
20
+ if (word !== null && word !== undefined && word.trim() !== "") {
21
+ list = list.filter(i => i.title.toLocaleLowerCase().includes(word) || i.posTitle.toLocaleLowerCase().includes(word));
22
+ }
20
23
  list = list.filter(i => {
21
24
  if (!i.informationTransmitter)
22
25
  return true;
@@ -32,16 +35,22 @@ export default new class OrderScreenController {
32
35
  });
33
36
  return list;
34
37
  }
35
- fetchProducts(arg, products, categories) {
38
+ fetchProducts(products, categories, categoryId, word = "") {
36
39
  var _a;
37
- let productIdList = (_a = categories.find(i => i.id === arg.category)) === null || _a === void 0 ? void 0 : _a.products;
38
- if (productIdList === undefined) {
39
- return this.searchProduct(products, arg.word.toLowerCase());
40
+ try {
41
+ let productIdList = (_a = categories.find(i => i.id === categoryId)) === null || _a === void 0 ? void 0 : _a.products;
42
+ if (productIdList === undefined) {
43
+ return this.searchProduct(products, word.toLowerCase());
44
+ }
45
+ else {
46
+ productIdList = [...productIdList];
47
+ return this.searchProduct(products.filter(i => productIdList === null || productIdList === void 0 ? void 0 : productIdList.includes(i.id)), word.toLowerCase());
48
+ }
40
49
  }
41
- else {
42
- productIdList = [...productIdList];
43
- return this.searchProduct(products.filter(i => productIdList === null || productIdList === void 0 ? void 0 : productIdList.includes(i.id)), arg.word.toLowerCase());
50
+ catch (e) {
51
+ console.log("fetchProducts : ", e.message);
44
52
  }
53
+ return [];
45
54
  }
46
55
  searchProduct(products, word) {
47
56
  if (word.trim().length === 0)
package/dist/index.d.ts CHANGED
@@ -67,7 +67,6 @@ export * from "./interfaces/ILog";
67
67
  export * from "./interfaces/ILogin";
68
68
  export * from "./interfaces/IOnlineOrderItem";
69
69
  export * from "./interfaces/IOrderDetailOrderItem";
70
- export * from "./interfaces/IOrderScreenState";
71
70
  export * from "./interfaces/IOrderState";
72
71
  export * from "./interfaces/IOrderTypeModal";
73
72
  export * from "./interfaces/IPaymentStatusChanged";
@@ -76,7 +75,6 @@ export * from "./interfaces/IPrintTemplate";
76
75
  export * from "./interfaces/IPrinterAndPrintCount";
77
76
  export * from "./interfaces/IProduct";
78
77
  export * from "./interfaces/IProductExtra";
79
- export * from "./interfaces/IProductModalState";
80
78
  export * from "./interfaces/ISaveOrder";
81
79
  export * from "./interfaces/ISearchAddressDetail";
82
80
  export * from "./interfaces/ISelectedExtraItem";
package/dist/index.js CHANGED
@@ -67,7 +67,6 @@ export * from "./interfaces/ILog";
67
67
  export * from "./interfaces/ILogin";
68
68
  export * from "./interfaces/IOnlineOrderItem";
69
69
  export * from "./interfaces/IOrderDetailOrderItem";
70
- export * from "./interfaces/IOrderScreenState";
71
70
  export * from "./interfaces/IOrderState";
72
71
  export * from "./interfaces/IOrderTypeModal";
73
72
  export * from "./interfaces/IPaymentStatusChanged";
@@ -76,7 +75,6 @@ export * from "./interfaces/IPrintTemplate";
76
75
  export * from "./interfaces/IPrinterAndPrintCount";
77
76
  export * from "./interfaces/IProduct";
78
77
  export * from "./interfaces/IProductExtra";
79
- export * from "./interfaces/IProductModalState";
80
78
  export * from "./interfaces/ISaveOrder";
81
79
  export * from "./interfaces/ISearchAddressDetail";
82
80
  export * from "./interfaces/ISelectedExtraItem";
@@ -1,25 +1,23 @@
1
1
  import IAccount from "./IAccount";
2
2
  import IPointOfSaleLocalSetting from "./IPointOfSaleLocalSetting";
3
- import IOrderScreenState from "./IOrderScreenState";
4
3
  import IPaymentStatusChanged from "./IPaymentStatusChanged";
5
- import IProductModalState from "./IProductModalState";
6
4
  import IStarMicronicPrintTask from "./IStarMicronicPrintTask";
7
5
  import IWorkScreen from "./IWorkScreen";
8
6
  import IOrder from "./order/IOrder";
9
7
  import ICancelRequest from "./ICancelRequest";
10
8
  import IPointOfSaleOrderSummary from "./pos/IPointOfSaleOrderSummary";
11
9
  import IPointOfSaleTask from "./pos/IPointOfSaleTask";
10
+ import IPointOfSaleSetting from "./IPointOfSaleSetting";
12
11
  interface IPointOfSaleStore {
13
12
  account: IAccount;
14
- orderScreen: IOrderScreenState;
15
13
  order: IOrder;
16
14
  onlineOrders: IPointOfSaleOrderSummary[];
17
15
  cancelRequests: ICancelRequest[];
18
16
  localOrders: IOrder[];
19
17
  isConnected: boolean;
20
- productModals: IProductModalState[];
21
18
  starMicronicTasks: IStarMicronicPrintTask[];
22
19
  localSetting: IPointOfSaleLocalSetting;
20
+ setting: IPointOfSaleSetting;
23
21
  customPayment: IPaymentStatusChanged;
24
22
  workScreen: IWorkScreen;
25
23
  tasks: IPointOfSaleTask[];
@@ -7,5 +7,6 @@ interface IStarMicronicPrintTask {
7
7
  customPrint: boolean;
8
8
  type: "order" | "daily_report" | "open_cash_drawer";
9
9
  data: any;
10
+ note?: string;
10
11
  }
11
12
  export default IStarMicronicPrintTask;
@@ -1,4 +1,3 @@
1
- import IOrderScreenState from "./IOrderScreenState";
2
1
  import IAccount from "./IAccount";
3
2
  import IGeneralInformation from "./IGeneralInformation";
4
3
  import ISystem from "./ISystem";
@@ -10,7 +9,6 @@ import ICustomer from "./ICustomer";
10
9
  import ITextValue from "./ITextValue";
11
10
  import ICheckoutOption from "./ICheckoutOption";
12
11
  import IGeneralItems from "./IGeneralItems";
13
- import IProductModalState from "./IProductModalState";
14
12
  import IPrintTemplate from "./IPrintTemplate";
15
13
  import IStarMicronicPrintTask from "./IStarMicronicPrintTask";
16
14
  import IPointOfSaleLocalSetting from "./IPointOfSaleLocalSetting";
@@ -23,7 +21,6 @@ import IExtra from "./IExtra";
23
21
  import IProduct from "./IProduct";
24
22
  interface IStore {
25
23
  account: IAccount;
26
- orderScreen: IOrderScreenState;
27
24
  order: IOrder;
28
25
  general: IGeneralInformation;
29
26
  system: ISystem;
@@ -41,7 +38,6 @@ interface IStore {
41
38
  checkoutOption: ICheckoutOption;
42
39
  generalItems: IGeneralItems;
43
40
  localPrinter: any;
44
- productModals: IProductModalState[];
45
41
  starMicronicPrinters: IStarMicronicPrinter[];
46
42
  starMicronicTasks: IStarMicronicPrintTask[];
47
43
  localSetting: IPointOfSaleLocalSetting;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.2.47",
3
+ "version": "1.2.50",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,11 +0,0 @@
1
- import EnumOrderScreenTab from "../enums/EnumOrderScreenTab";
2
- import EnumBasketStep from "../enums/EnumBasketStep";
3
- interface IOrderScreenState {
4
- category: number;
5
- word: string;
6
- mode: EnumOrderScreenTab;
7
- afterProductDetail: EnumOrderScreenTab;
8
- orderStep: EnumBasketStep;
9
- }
10
- export default IOrderScreenState;
11
- export declare const initOrderScreenState: IOrderScreenState;
@@ -1,9 +0,0 @@
1
- import EnumOrderScreenTab from "../enums/EnumOrderScreenTab";
2
- import EnumBasketStep from "../enums/EnumBasketStep";
3
- export const initOrderScreenState = {
4
- category: -1,
5
- word: "",
6
- mode: EnumOrderScreenTab.categories,
7
- afterProductDetail: EnumOrderScreenTab.products,
8
- orderStep: EnumBasketStep.item
9
- };
@@ -1,15 +0,0 @@
1
- import ISelectedProductExtra from "./ISelectedProductExtra";
2
- import TBaseExtra from "../types/TBaseExtra";
3
- interface IProductModalState {
4
- id: number;
5
- count: number;
6
- selected: ISelectedProductExtra[];
7
- note: string;
8
- price: number;
9
- wait: boolean;
10
- problems: number[];
11
- check: boolean;
12
- base: TBaseExtra;
13
- }
14
- export declare const initProductModalState: IProductModalState;
15
- export default IProductModalState;
@@ -1,11 +0,0 @@
1
- export const initProductModalState = {
2
- id: -1,
3
- selected: [],
4
- base: [undefined, undefined],
5
- problems: [],
6
- check: false,
7
- wait: false,
8
- note: "",
9
- count: 1,
10
- price: 0
11
- };