meemup-library 1.5.82 → 1.5.83

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,10 +1,11 @@
1
1
  import EnumLogType from "../enums/EnumLogType";
2
2
  import ILog from "../interfaces/ILog";
3
- declare const _default: {
3
+ declare class LogScreenController {
4
4
  filterModeText(mode: EnumLogType): string;
5
5
  getIcon(type: EnumLogType): "info" | "warning" | "assignment" | undefined;
6
6
  getIconColor(type: EnumLogType): "info.300" | "danger.500" | "light.500" | "text.500";
7
7
  filter(logs: ILog[], filterMode: EnumLogType): ILog[];
8
8
  count(logs: ILog[], filterMode: EnumLogType): number;
9
- };
10
- export default _default;
9
+ }
10
+ declare const controller: LogScreenController;
11
+ export default controller;
@@ -1,5 +1,5 @@
1
1
  import EnumLogType from "../enums/EnumLogType";
2
- export default new class LogScreenController {
2
+ class LogScreenController {
3
3
  filterModeText(mode) {
4
4
  switch (mode) {
5
5
  case EnumLogType.all:
@@ -38,18 +38,6 @@ export default new class LogScreenController {
38
38
  return "text.500";
39
39
  }
40
40
  }
41
- // getDataBgColor(type: EnumLogType) {
42
- // switch (type) {
43
- // case EnumLogType.info:
44
- // return "lightBlue.100";
45
- // case EnumLogType.error:
46
- // return "red.100";
47
- // case EnumLogType.description:
48
- // return "light.100";
49
- // default:
50
- // return ThemeConfigs.isDark ? "light.700" : "light.300";
51
- // }
52
- // }
53
41
  filter(logs, filterMode) {
54
42
  if (filterMode === EnumLogType.all)
55
43
  return logs;
@@ -60,4 +48,6 @@ export default new class LogScreenController {
60
48
  return logs.length;
61
49
  return logs.filter(i => i.type === filterMode).length;
62
50
  }
63
- }();
51
+ }
52
+ const controller = new LogScreenController();
53
+ export default controller;
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ declare class MoneyController {
2
2
  round: (money: number | string, dec?: number) => number;
3
3
  format(money: number | string, currency?: string, preText?: string): string;
4
4
  sum(values: number[]): number;
@@ -10,5 +10,6 @@ declare const _default: {
10
10
  };
11
11
  sumFieldFormat(values: any[], fieldName: string, currency?: string, preText?: string): string;
12
12
  toBraces(value: any): string;
13
- };
14
- export default _default;
13
+ }
14
+ declare const controller: MoneyController;
15
+ export default controller;
@@ -1,4 +1,4 @@
1
- export default new class MoneyController {
1
+ class MoneyController {
2
2
  constructor() {
3
3
  this.round = (money, dec = 2) => {
4
4
  try {
@@ -53,4 +53,6 @@ export default new class MoneyController {
53
53
  toBraces(value) {
54
54
  return `(${value})`;
55
55
  }
56
- }();
56
+ }
57
+ const controller = new MoneyController();
58
+ export default controller;
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ declare class PhoneController {
2
2
  unFormatPhoneNumber(phone?: string | null): string;
3
3
  formatPhoneNumber(phone?: string): string;
4
4
  formatAccordingToLength(phone?: string): string;
@@ -7,5 +7,6 @@ declare const _default: {
7
7
  toForm(phone?: string | null): string;
8
8
  toCanadianPhoneForm(phone: string | null): string;
9
9
  toCanadianPhoneSave(phone: string | null, countryCode?: string): string;
10
- };
11
- export default _default;
10
+ }
11
+ declare const controller: PhoneController;
12
+ export default controller;
@@ -1,4 +1,4 @@
1
- export default new class {
1
+ class PhoneController {
2
2
  unFormatPhoneNumber(phone = "(000) 000-0000") {
3
3
  if (!phone)
4
4
  return "";
@@ -81,4 +81,6 @@ export default new class {
81
81
  return `${countryCode}${data}`;
82
82
  return data;
83
83
  }
84
- }();
84
+ }
85
+ const controller = new PhoneController();
86
+ export default controller;
@@ -1,7 +1,7 @@
1
1
  import IOrderDetailProductsExtra from '../interfaces/print/IOrderDetailProductsExtra';
2
2
  import IOrderDetailProduct from '../interfaces/print/IOrderDetailProduct';
3
3
  declare class _PrintToolController {
4
- extraItemToText(item: IOrderDetailProductsExtra, ignoreWholeText?: boolean): string;
4
+ extraItemToText(item: IOrderDetailProductsExtra, ignoreWholeText?: boolean, showPrices?: boolean): string;
5
5
  productNote(item: IOrderDetailProduct): string;
6
6
  orderItemCountText: (products: IOrderDetailProduct[], catList: number[], onlyListCategory: boolean, productList: number[], onlyListProduct: boolean) => string;
7
7
  filterProductsByCategoryList: (products: IOrderDetailProduct[], catList: number[], onlyListCategory: boolean, productList: number[], onlyListProduct: boolean) => IOrderDetailProduct[];
@@ -35,7 +35,7 @@ class _PrintToolController {
35
35
  return new_product;
36
36
  };
37
37
  }
38
- extraItemToText(item, ignoreWholeText = false) {
38
+ extraItemToText(item, ignoreWholeText = false, showPrices = true) {
39
39
  let parts = [];
40
40
  switch (item.pizzaSide) {
41
41
  case EnumPizzaSide.all:
@@ -57,7 +57,7 @@ class _PrintToolController {
57
57
  if (item.extraItemOptionId !== null && item.extraItemOptionId !== -1) {
58
58
  parts.push(`[${item.extraItemOptionTitle.trim()}] `);
59
59
  }
60
- if (item.totalAmount !== 0) {
60
+ if (showPrices && item.totalAmount !== 0) {
61
61
  parts.push(`(${MoneyController.format(item.totalAmount, '')})`);
62
62
  }
63
63
  return parts.join(' ').trim();
@@ -294,7 +294,7 @@ class SimplePreviewController {
294
294
  if (row.extrasNames) {
295
295
  const extList = row.extras
296
296
  .filter(item => !item.doNotPrintOnReceipt)
297
- .map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText))
297
+ .map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText, template.showPrices))
298
298
  .filter(i => i.length > 0);
299
299
  for (let ind = 0; ind < extList.length; ind++) {
300
300
  content += `<tr>
@@ -437,8 +437,9 @@ class SimplePreviewController {
437
437
  }
438
438
  }
439
439
  content += `</tbody></table>`;
440
- //total amount
441
- content += `<div style="display: flex; flex-direction: row; align-items: center; background-color: black; padding: 4px;">
440
+ if (template.showPrices) {
441
+ //total amount
442
+ content += `<div style="display: flex; flex-direction: row; align-items: center; background-color: black; padding: 4px;">
442
443
  <div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px; background-color: transparent; color: white;">
443
444
  ${detail.order.paymentState !== EnumPaymentState.Paid ? "Total & NOT PAID" : "Total"}:
444
445
  </div>
@@ -446,7 +447,7 @@ class SimplePreviewController {
446
447
  ${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)}
447
448
  </div>
448
449
  </div>`;
449
- // content += this.printSolidLine();
450
+ }
450
451
  content += `</div>`;
451
452
  return content;
452
453
  }
@@ -509,10 +510,6 @@ class SimplePreviewController {
509
510
  const sharp = `${row.quantity}× `;
510
511
  let product = (template.showProductKitchenName && row.kitchenReceiptName !== '' && row.kitchenReceiptName !== null) ? row.kitchenReceiptName : row.title;
511
512
  product = sharp + ((_c = product === null || product === void 0 ? void 0 : product.replace(sharp, '')) === null || _c === void 0 ? void 0 : _c.trim()) + "";
512
- // content += `<tr>
513
- // <td style="font-size:${template.fontSize}px; min-width:40px; width: 40px; text-align: left;"></td>
514
- // <td style="font-size:${template.fontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2;">${product}</td>
515
- // </tr>`;
516
513
  content += `<tr>
517
514
  <td style="font-size:${largeFontSize}px; min-width:40px; width: 40px; text-align: left;">&ensp;</td>
518
515
  <td style="font-size:${largeFontSize}px; flex: 1; width: 100%; text-align: left; column-span: 2;">${product}</td>
@@ -520,7 +517,7 @@ class SimplePreviewController {
520
517
  if (row.extrasNames) {
521
518
  const extList = row.extras
522
519
  .filter(item => !item.doNotPrintOnReceipt)
523
- .map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText))
520
+ .map(item => PrintToolController.extraItemToText(item, template.skipWholePizzaToppingText, template.showPrices))
524
521
  .filter(i => i.length > 0);
525
522
  for (let ind = 0; ind < extList.length; ind++) {
526
523
  content += `<tr>
@@ -651,8 +648,9 @@ class SimplePreviewController {
651
648
  }
652
649
  }
653
650
  content += `</tbody></table>`;
654
- //total amount
655
- content += `<div style="display: flex; flex-direction: row; align-items: center; border-top: 1px dashed #000000; margin: 4px 0;">
651
+ if (template.showPrices) {
652
+ //total amount
653
+ content += `<div style="display: flex; flex-direction: row; align-items: center; border-top: 1px dashed #000000; margin: 4px 0;">
656
654
  <div style="font-size:${template.fontSize + 6}px; flex: 1; text-align: right; padding-right: 8px;">
657
655
  ${detail.order.paymentState !== EnumPaymentState.Paid ? "Total & Still to pay" : "Total"}:
658
656
  </div>
@@ -660,6 +658,7 @@ class SimplePreviewController {
660
658
  ${MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol)}
661
659
  </div>
662
660
  </div>`;
661
+ }
663
662
  content += this.printSolidLine();
664
663
  content += `</div>`;
665
664
  return content;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export * from "./controllers/DateTimeController";
4
4
  export * from "./controllers/LogController";
5
5
  export * from "./controllers/LogScreenController";
6
6
  export * from "./controllers/MoneyController";
7
- export * from "./controllers/OrderScreenController";
8
7
  export * from "./controllers/PhoneController";
9
8
  export * from "./controllers/PrintContentController";
10
9
  export * from "./controllers/ToolController";
package/dist/index.js CHANGED
@@ -4,7 +4,6 @@ export * from "./controllers/DateTimeController";
4
4
  export * from "./controllers/LogController";
5
5
  export * from "./controllers/LogScreenController";
6
6
  export * from "./controllers/MoneyController";
7
- export * from "./controllers/OrderScreenController";
8
7
  export * from "./controllers/PhoneController";
9
8
  export * from "./controllers/PrintContentController";
10
9
  export * from "./controllers/ToolController";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.5.82",
3
+ "version": "1.5.83",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "remove:one": "rimraf dist",
12
12
  "remove:two": "rimraf ./src/dist",
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "commit": "git add . && git commit -m \"version.1.5.82\" && git push origin "
14
+ "commit": "git add . && git commit -m \"version.1.5.83\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"
@@ -26,4 +26,4 @@
26
26
  "dependencies": {
27
27
  "dayjs": "^1.11.13"
28
28
  }
29
- }
29
+ }
@@ -1,13 +0,0 @@
1
- import EnumOrderType from "../enums/EnumOrderType";
2
- import IPointOfSaleOrderItem from "../interfaces/pos/IPointOfSaleOrderItem";
3
- import ICategory from "../interfaces/ICategory";
4
- import IProduct from "../interfaces/IProduct";
5
- declare const _default: {
6
- checkDayWeek: (index: number, weekDays: number) => boolean;
7
- fetchCategories(categories: ICategory[], word?: string): ICategory[];
8
- fetchProducts(products: IProduct[], categories: ICategory[], categoryId: number, word?: string): IProduct[];
9
- searchProduct(products: IProduct[], word: string): IProduct[];
10
- productPrice(product: IProduct, orderType: EnumOrderType): number;
11
- productCountInOrder(product: IProduct, items: IPointOfSaleOrderItem[]): number;
12
- };
13
- export default _default;
@@ -1,76 +0,0 @@
1
- import EnumOrderType from "../enums/EnumOrderType";
2
- import EnumCategoryAvailableIn from "../enums/EnumCategoryAvailableIn";
3
- export default new class OrderScreenController {
4
- constructor() {
5
- this.checkDayWeek = (index, weekDays) => {
6
- let val = 0;
7
- while (val < weekDays)
8
- val += 1;
9
- const arr = [64, 32, 16, 8, 4, 2, 1];
10
- for (let i = 0; i < arr.length; i++)
11
- if (val >= arr[i] && arr[i] === Math.pow(2, index))
12
- return true;
13
- else
14
- val -= arr[i];
15
- return false;
16
- };
17
- }
18
- fetchCategories(categories, word = "") {
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
- }
23
- list = list.filter(i => {
24
- if (!i.informationTransmitter)
25
- return true;
26
- if (i.products.length === 0)
27
- return false;
28
- const { showToTime, showFromTime, showFromDate, showToDate, onlyOnWeekDays } = i;
29
- let date = new Date().toISOString().split("T")[0];
30
- let time = new Date().toISOString().split("T")[1];
31
- let dateIsOk = (showFromDate !== null && showToDate !== null) ? date >= showFromDate && date <= showToDate : true;
32
- let timeIsOk = (showFromTime !== null && showToTime !== null) ? time >= showFromTime && time <= showToTime : true;
33
- let dayOfWeekIsOk = (onlyOnWeekDays === null || onlyOnWeekDays === undefined) ? true : this.checkDayWeek(new Date().getDay(), onlyOnWeekDays);
34
- return dateIsOk && timeIsOk && dayOfWeekIsOk;
35
- });
36
- return list;
37
- }
38
- fetchProducts(products, categories, categoryId, word = "") {
39
- var _a;
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
- }
49
- }
50
- catch (e) {
51
- console.log("fetchProducts : ", e.message);
52
- }
53
- return [];
54
- }
55
- searchProduct(products, word) {
56
- if (word.trim().length === 0)
57
- return products;
58
- return [...products].filter(i => i.posName.toLowerCase().search(word) !== -1 || i.name.toLowerCase().search(word) !== -1);
59
- }
60
- productPrice(product, orderType) {
61
- switch (orderType) {
62
- case EnumOrderType.delivery:
63
- return product.deliveryPrice;
64
- case EnumOrderType.pickup:
65
- return product.pickupPrice;
66
- default:
67
- return product.diningPrice;
68
- }
69
- }
70
- productCountInOrder(product, items) {
71
- let quantities = items.filter(i => i.productId === product.id).map(i => +i.quantity);
72
- if (quantities.length === 0)
73
- return 0;
74
- return quantities.reduce((previousValue, currentValue) => previousValue + currentValue);
75
- }
76
- }();
@@ -1,6 +0,0 @@
1
- import EnumCoreRequest from "../enums/EnumCoreRequest";
2
- import ISignalAction from "../interfaces/ISignalAction";
3
- export default class PosSoftwareController {
4
- createAction(action: EnumCoreRequest, referenceId: string, data: any): ISignalAction;
5
- decodeAction(strAction: string): ISignalAction;
6
- }
@@ -1,32 +0,0 @@
1
- import EnumCoreRequest from "../enums/EnumCoreRequest";
2
- export default class PosSoftwareController {
3
- // constructor(private account: IAccount) {
4
- // }
5
- createAction(action, referenceId, data) {
6
- return {
7
- referenceId: referenceId,
8
- type: action,
9
- data: data
10
- };
11
- }
12
- decodeAction(strAction) {
13
- try {
14
- const action = JSON.parse(strAction);
15
- if (action && !isNaN(action.type) && action.referenceId)
16
- return action;
17
- }
18
- catch (e) {
19
- return {
20
- type: EnumCoreRequest.NONE,
21
- referenceId: "",
22
- data: e
23
- };
24
- }
25
- return {
26
- type: EnumCoreRequest.NONE,
27
- referenceId: "",
28
- data: strAction
29
- };
30
- }
31
- }
32
- ;