@freedom_sky/feige-lib 5.5.2 → 5.7.0

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.
@@ -37,7 +37,7 @@ export declare function dishShowPriceWithBuffet({ dishPrice, dishId, buffet, ord
37
37
  /**
38
38
  *
39
39
  */
40
- export declare function getRoundCoundAndSecondsToNextTurn({ order }: {
40
+ export declare function getRoundCoundAndSecondsToNextTurn({ order, }: {
41
41
  order: Order;
42
42
  }): {
43
43
  roundCount?: number;
@@ -63,7 +63,6 @@ function getRoundCoundAndSecondsToNextTurn(_a) {
63
63
  if (!((_c = buffetCombosItems.orderingByTurns) === null || _c === void 0 ? void 0 : _c.enable)) {
64
64
  throw 'Buffet ordering by turns is not enabled';
65
65
  }
66
- ;
67
66
  var _d = buffetCombosItems.orderingByTurns, interval = _d.interval, maxRounds = _d.maxRounds;
68
67
  var previousBuffetSubmitTasks = order.tasks.filter(function (task) {
69
68
  return (task.type === index_1.CONST.TASK_TYPE.CHECK || task.type === index_1.CONST.TASK_TYPE.APPEND) &&
@@ -82,10 +81,14 @@ function getRoundCoundAndSecondsToNextTurn(_a) {
82
81
  return {
83
82
  roundCount: previousBuffetSubmitTasks.length,
84
83
  secondsToNextTurn: secondsToNextTurn,
85
- maxRounds: maxRounds
84
+ maxRounds: maxRounds,
86
85
  };
87
86
  }
88
87
  exports.getRoundCoundAndSecondsToNextTurn = getRoundCoundAndSecondsToNextTurn;
88
+ /**
89
+ * @param arr1
90
+ * @param arr2
91
+ */
89
92
  function _haveAtLeastOneSameItem(arr1, arr2) {
90
93
  var set1 = new Set(arr1);
91
94
  return arr2.some(function (item) { return set1.has(item); });
@@ -492,6 +492,170 @@ var Const = /** @class */ (function () {
492
492
  codepage: 'cp1253',
493
493
  defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
494
494
  },
495
+ {
496
+ name: 'العربية',
497
+ img: '',
498
+ code: 'ar',
499
+ speechCode: 'ar-AE',
500
+ speechLang: 'ar',
501
+ dateFormat: common_enum_1.DateFormat.YEAR_MONTH_DAY,
502
+ defaultAreaCode: '971',
503
+ rtl: true,
504
+ codepage: 'utf-8',
505
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
506
+ },
507
+ {
508
+ name: 'Українська',
509
+ img: '',
510
+ code: 'uk',
511
+ speechCode: 'uk-UA',
512
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
513
+ defaultAreaCode: '380',
514
+ codepage: 'cp1251',
515
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
516
+ },
517
+ {
518
+ name: 'Български',
519
+ img: '',
520
+ code: 'bg',
521
+ speechCode: 'bg-BG',
522
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
523
+ defaultAreaCode: '359',
524
+ codepage: 'cp1251',
525
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
526
+ },
527
+ {
528
+ name: 'Hrvatski',
529
+ img: '',
530
+ code: 'hr',
531
+ speechCode: 'hr-HR',
532
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
533
+ defaultAreaCode: '385',
534
+ codepage: 'cp1250',
535
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
536
+ },
537
+ {
538
+ name: 'Slovenščina',
539
+ img: '',
540
+ code: 'sl',
541
+ speechCode: 'sl-SI',
542
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
543
+ defaultAreaCode: '386',
544
+ codepage: 'cp1250',
545
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
546
+ },
547
+ {
548
+ name: 'Slovenský',
549
+ img: '',
550
+ code: 'sk',
551
+ speechCode: 'sk-SK',
552
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
553
+ defaultAreaCode: '421',
554
+ codepage: 'cp1250',
555
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
556
+ },
557
+ {
558
+ name: 'Lietuvių',
559
+ img: '',
560
+ code: 'lt',
561
+ speechCode: 'lt-LT',
562
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
563
+ defaultAreaCode: '370',
564
+ codepage: 'cp1257',
565
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
566
+ },
567
+ {
568
+ name: 'Türkçe',
569
+ img: '',
570
+ code: 'tr',
571
+ speechCode: 'tr-TR',
572
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
573
+ defaultAreaCode: '90',
574
+ codepage: 'cp1254',
575
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
576
+ },
577
+ {
578
+ name: 'Svenska',
579
+ img: '',
580
+ code: 'sv',
581
+ speechCode: 'sv-SE',
582
+ dateFormat: common_enum_1.DateFormat.YEAR_MONTH_DAY,
583
+ defaultAreaCode: '46',
584
+ codepage: 'cp1252',
585
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
586
+ },
587
+ {
588
+ name: 'Русский',
589
+ img: '',
590
+ code: 'ru',
591
+ speechCode: 'ru-RU',
592
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
593
+ defaultAreaCode: '7',
594
+ codepage: 'cp1251',
595
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
596
+ },
597
+ {
598
+ name: 'עברית',
599
+ img: '',
600
+ code: 'he',
601
+ speechCode: 'he-IL',
602
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
603
+ defaultAreaCode: '972',
604
+ codepage: 'cp1255',
605
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
606
+ rtl: true,
607
+ },
608
+ {
609
+ name: 'فارسی',
610
+ img: '',
611
+ code: 'fa',
612
+ speechCode: 'fa-IR',
613
+ dateFormat: common_enum_1.DateFormat.YEAR_MONTH_DAY,
614
+ defaultAreaCode: '98',
615
+ codepage: 'cp1256',
616
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
617
+ rtl: true,
618
+ },
619
+ {
620
+ name: 'Latviešu',
621
+ img: '',
622
+ code: 'lv',
623
+ speechCode: 'lv-LV',
624
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
625
+ defaultAreaCode: '371',
626
+ codepage: 'cp1257',
627
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
628
+ },
629
+ {
630
+ name: 'Eesti',
631
+ img: '',
632
+ code: 'et',
633
+ speechCode: 'et-EE',
634
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
635
+ defaultAreaCode: '372',
636
+ codepage: 'cp1257',
637
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
638
+ },
639
+ {
640
+ name: 'ትግርኛ',
641
+ img: '',
642
+ code: 'ti',
643
+ speechCode: 'ti-ER',
644
+ dateFormat: common_enum_1.DateFormat.DAY_MONTH_YEAR,
645
+ defaultAreaCode: '291',
646
+ codepage: 'utf-8',
647
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
648
+ },
649
+ {
650
+ name: 'Монгол',
651
+ img: '',
652
+ code: 'mn',
653
+ speechCode: 'mn-MN',
654
+ dateFormat: common_enum_1.DateFormat.YEAR_MONTH_DAY,
655
+ defaultAreaCode: '976',
656
+ codepage: 'utf-8',
657
+ defaultPrintEncodeType: printer_enum_1.EncodeTypeEnum.IMG,
658
+ },
495
659
  ];
496
660
  this.DATE_FORMAT = {
497
661
  YEAR_MONTH_DAY: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freedom_sky/feige-lib",
3
- "version": "5.5.2",
3
+ "version": "5.7.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -76,40 +76,48 @@ export function dishShowPriceWithBuffet({
76
76
  *
77
77
  */
78
78
  export function getRoundCoundAndSecondsToNextTurn({
79
- order
79
+ order,
80
80
  }: {
81
- order: Order
81
+ order: Order;
82
82
  }): {
83
- roundCount?: number,
84
- maxRounds?: number,
85
- secondsToNextTurn: number
83
+ roundCount?: number;
84
+ maxRounds?: number;
85
+ secondsToNextTurn: number;
86
86
  } {
87
87
  let secondsToNextTurn = 0;
88
88
  const buffetCombosItems = order.buffet?.snapshot;
89
89
  if (!buffetCombosItems.orderingByTurns?.enable) {
90
90
  throw 'Buffet ordering by turns is not enabled';
91
- };
91
+ }
92
92
  const { interval, maxRounds } = buffetCombosItems.orderingByTurns;
93
- const previousBuffetSubmitTasks = order.tasks.filter(task =>
94
- (task.type === CONST.TASK_TYPE.CHECK || task.type === CONST.TASK_TYPE.APPEND) &&
95
- _haveAtLeastOneSameItem(task.content.map(content => String(content.dishSnapshot._id)), buffetCombosItems.dishes.map(dish => String(dish.dishId)))
93
+ const previousBuffetSubmitTasks = order.tasks.filter(
94
+ (task) =>
95
+ (task.type === CONST.TASK_TYPE.CHECK || task.type === CONST.TASK_TYPE.APPEND) &&
96
+ _haveAtLeastOneSameItem(
97
+ task.content.map((content) => String(content.dishSnapshot._id)),
98
+ buffetCombosItems.dishes.map((dish) => String(dish.dishId)),
99
+ ),
96
100
  );
97
- if(previousBuffetSubmitTasks.length === 0) {
98
- secondsToNextTurn = 0
99
- }else if(previousBuffetSubmitTasks.length >= maxRounds) {
100
- secondsToNextTurn = Infinity
101
- }else {
102
- const lastBuffetSubmitTime = previousBuffetSubmitTasks[previousBuffetSubmitTasks.length -1].date;
101
+ if (previousBuffetSubmitTasks.length === 0) {
102
+ secondsToNextTurn = 0;
103
+ } else if (previousBuffetSubmitTasks.length >= maxRounds) {
104
+ secondsToNextTurn = Infinity;
105
+ } else {
106
+ const lastBuffetSubmitTime = previousBuffetSubmitTasks[previousBuffetSubmitTasks.length - 1].date;
103
107
  secondsToNextTurn = interval * 60 - Math.floor((Date.now() - new Date(lastBuffetSubmitTime).getTime()) / 1000);
104
108
  }
105
109
  return {
106
110
  roundCount: previousBuffetSubmitTasks.length,
107
111
  secondsToNextTurn,
108
- maxRounds
109
- }
112
+ maxRounds,
113
+ };
110
114
  }
111
115
 
116
+ /**
117
+ * @param arr1
118
+ * @param arr2
119
+ */
112
120
  function _haveAtLeastOneSameItem<T>(arr1: T[], arr2: T[]): boolean {
113
121
  const set1 = new Set(arr1);
114
- return arr2.some(item => set1.has(item));
115
- }
122
+ return arr2.some((item) => set1.has(item));
123
+ }
@@ -490,6 +490,170 @@ class Const {
490
490
  codepage: 'cp1253',
491
491
  defaultPrintEncodeType: EncodeTypeEnum.IMG,
492
492
  },
493
+ {
494
+ name: 'العربية',
495
+ img: '',
496
+ code: 'ar',
497
+ speechCode: 'ar-AE',
498
+ speechLang: 'ar',
499
+ dateFormat: DateFormat.YEAR_MONTH_DAY,
500
+ defaultAreaCode: '971',
501
+ rtl: true,
502
+ codepage: 'utf-8',
503
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
504
+ },
505
+ {
506
+ name: 'Українська', // Ukrainian
507
+ img: '',
508
+ code: 'uk',
509
+ speechCode: 'uk-UA',
510
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
511
+ defaultAreaCode: '380',
512
+ codepage: 'cp1251',
513
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
514
+ },
515
+ {
516
+ name: 'Български', // Bulgarian
517
+ img: '',
518
+ code: 'bg',
519
+ speechCode: 'bg-BG',
520
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
521
+ defaultAreaCode: '359',
522
+ codepage: 'cp1251',
523
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
524
+ },
525
+ {
526
+ name: 'Hrvatski', // Croatian
527
+ img: '',
528
+ code: 'hr',
529
+ speechCode: 'hr-HR',
530
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
531
+ defaultAreaCode: '385',
532
+ codepage: 'cp1250',
533
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
534
+ },
535
+ {
536
+ name: 'Slovenščina', // Slovenian
537
+ img: '',
538
+ code: 'sl',
539
+ speechCode: 'sl-SI',
540
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
541
+ defaultAreaCode: '386',
542
+ codepage: 'cp1250',
543
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
544
+ },
545
+ {
546
+ name: 'Slovenský', // Slovak
547
+ img: '',
548
+ code: 'sk',
549
+ speechCode: 'sk-SK',
550
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
551
+ defaultAreaCode: '421',
552
+ codepage: 'cp1250',
553
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
554
+ },
555
+ {
556
+ name: 'Lietuvių', // Lithuanian
557
+ img: '',
558
+ code: 'lt',
559
+ speechCode: 'lt-LT',
560
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
561
+ defaultAreaCode: '370',
562
+ codepage: 'cp1257',
563
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
564
+ },
565
+ {
566
+ name: 'Türkçe', // Turkish
567
+ img: '',
568
+ code: 'tr',
569
+ speechCode: 'tr-TR',
570
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
571
+ defaultAreaCode: '90',
572
+ codepage: 'cp1254',
573
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
574
+ },
575
+ {
576
+ name: 'Svenska', // Swedish
577
+ img: '',
578
+ code: 'sv',
579
+ speechCode: 'sv-SE',
580
+ dateFormat: DateFormat.YEAR_MONTH_DAY,
581
+ defaultAreaCode: '46',
582
+ codepage: 'cp1252',
583
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
584
+ },
585
+ {
586
+ name: 'Русский', // Russian
587
+ img: '',
588
+ code: 'ru',
589
+ speechCode: 'ru-RU',
590
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
591
+ defaultAreaCode: '7',
592
+ codepage: 'cp1251',
593
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
594
+ },
595
+ {
596
+ name: 'עברית', // Hebrew
597
+ img: '',
598
+ code: 'he',
599
+ speechCode: 'he-IL',
600
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
601
+ defaultAreaCode: '972',
602
+ codepage: 'cp1255',
603
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
604
+ rtl: true,
605
+ },
606
+ {
607
+ name: 'فارسی', // Persian
608
+ img: '',
609
+ code: 'fa',
610
+ speechCode: 'fa-IR',
611
+ dateFormat: DateFormat.YEAR_MONTH_DAY,
612
+ defaultAreaCode: '98',
613
+ codepage: 'cp1256',
614
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
615
+ rtl: true,
616
+ },
617
+ {
618
+ name: 'Latviešu', // Latvian
619
+ img: '',
620
+ code: 'lv',
621
+ speechCode: 'lv-LV',
622
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
623
+ defaultAreaCode: '371',
624
+ codepage: 'cp1257',
625
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
626
+ },
627
+ {
628
+ name: 'Eesti', // Estonian
629
+ img: '',
630
+ code: 'et',
631
+ speechCode: 'et-EE',
632
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
633
+ defaultAreaCode: '372',
634
+ codepage: 'cp1257',
635
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
636
+ },
637
+ {
638
+ name: 'ትግርኛ', // Tigrinya
639
+ img: '',
640
+ code: 'ti',
641
+ speechCode: 'ti-ER',
642
+ dateFormat: DateFormat.DAY_MONTH_YEAR,
643
+ defaultAreaCode: '291',
644
+ codepage: 'utf-8',
645
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
646
+ },
647
+ {
648
+ name: 'Монгол', // Mongolian
649
+ img: '',
650
+ code: 'mn',
651
+ speechCode: 'mn-MN',
652
+ dateFormat: DateFormat.YEAR_MONTH_DAY,
653
+ defaultAreaCode: '976',
654
+ codepage: 'utf-8',
655
+ defaultPrintEncodeType: EncodeTypeEnum.IMG,
656
+ },
493
657
  ];
494
658
  DATE_FORMAT = {
495
659
  YEAR_MONTH_DAY: {