meemup-library 1.1.77 → 1.1.79

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.
@@ -0,0 +1,34 @@
1
+ /**
2
+ * کلاس ColorController برای مدیریت رنگ‌ها و تولید رنگ متن بر اساس رنگ پس زمینه استفاده می‌شود.
3
+ */
4
+ declare class ColorController {
5
+ /**
6
+ * متد generateContrastColorForHex برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت hex استفاده می‌شود.
7
+ * @param background_color رنگ پس زمینه به صورت hex (#RRGGBB).
8
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
9
+ */
10
+ generateContrastColorForHex(background_color: string): string;
11
+ /**
12
+ * متد generateContrastColorForRgba برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت RGBA استفاده می‌شود.
13
+ * @param rgba_color رنگ پس زمینه به صورت RGBA (رنگ، سبز، آبی، شفافیت).
14
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
15
+ */
16
+ generateContrastColorForRgba(rgba_color: string): string;
17
+ /**
18
+ * متد generateContrastColorForRgb برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت RGB استفاده می‌شود.
19
+ * @param rgb_color رنگ پس زمینه به صورت RGB (رنگ، سبز، آبی).
20
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
21
+ */
22
+ generateContrastColorForRgb(rgb_color: string): string;
23
+ /**
24
+ * متد generateContrastColorForBackground برای تولید رنگ متن بر اساس رنگ پس زمینه مورد نظر استفاده می‌شود.
25
+ * اگر رنگ پس زمینه null یا "transparent" باشد، رنگ متن #000000 (سیاه) برگردانده می‌شود.
26
+ * در غیر این صورت، از سه متد generateContrastColorForRgb و generateContrastColorForRgba و generateContrastColorForHex برای تولید رنگ متن استفاده می‌شود.
27
+ * اگر در هیچکدام از سه متد مورد نظر نگنجید، رنگ متن #000000 (سیاه) برگردانده می‌شود.
28
+ * @param background_color رنگ پس زمینه به هر فرمتی که می‌تواند string یا null باشد.
29
+ * @returns رنگ متن متناظر (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
30
+ */
31
+ generateContrastColorForBackground(background_color: string | null, default_text_color?: string): string;
32
+ }
33
+ declare const _default: ColorController;
34
+ export default _default;
@@ -0,0 +1,87 @@
1
+ /**
2
+ * کلاس ColorController برای مدیریت رنگ‌ها و تولید رنگ متن بر اساس رنگ پس زمینه استفاده می‌شود.
3
+ */
4
+ class ColorController {
5
+ /**
6
+ * متد generateContrastColorForHex برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت hex استفاده می‌شود.
7
+ * @param background_color رنگ پس زمینه به صورت hex (#RRGGBB).
8
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
9
+ */
10
+ generateContrastColorForHex(background_color) {
11
+ // تبدیل رنگ پس زمینه به عددی
12
+ background_color = background_color.replace("#", "");
13
+ const r = parseInt(background_color.substring(0, 2), 16);
14
+ const g = parseInt(background_color.substring(2, 4), 16);
15
+ const b = parseInt(background_color.substring(4, 6), 16);
16
+ // محاسبه میانگین مقادیر RGB
17
+ const avg_color = (r + g + b) / 3;
18
+ // انتخاب رنگ متن بر اساس میانگین رنگ پس زمینه
19
+ const text_color = avg_color > 127 ? "#000000" : "#FFFFFF"; // اگر میانگین بیشتر از نیمه‌ی راه بین 0 و 255 باشد، متن رنگ سیاه خواهد بود
20
+ return text_color;
21
+ }
22
+ /**
23
+ * متد generateContrastColorForRgba برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت RGBA استفاده می‌شود.
24
+ * @param rgba_color رنگ پس زمینه به صورت RGBA (رنگ، سبز، آبی، شفافیت).
25
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
26
+ */
27
+ generateContrastColorForRgba(rgba_color) {
28
+ var _a;
29
+ // استخراج مقادیر R، G، B از RGBA
30
+ const rgba_values = ((_a = rgba_color.match(/\d+(\.\d+)?/g)) === null || _a === void 0 ? void 0 : _a.map(Number)) || [];
31
+ const r = rgba_values[0] || 0;
32
+ const g = rgba_values[1] || 0;
33
+ const b = rgba_values[2] || 0;
34
+ // محاسبه میانگین مقادیر RGB
35
+ const avg_color = (r + g + b) / 3;
36
+ // انتخاب رنگ متن بر اساس میانگین رنگ پس زمینه
37
+ const text_color = avg_color > 127 ? "#000000" : "#FFFFFF"; // اگر میانگین بیشتر از نیمه‌ی راه بین 0 و 255 باشد، متن رنگ سیاه خواهد بود
38
+ return text_color;
39
+ }
40
+ /**
41
+ * متد generateContrastColorForRgb برای تولید رنگ متن بر اساس رنگ پس زمینه به صورت RGB استفاده می‌شود.
42
+ * @param rgb_color رنگ پس زمینه به صورت RGB (رنگ، سبز، آبی).
43
+ * @returns رنگ متن متناسب (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
44
+ */
45
+ generateContrastColorForRgb(rgb_color) {
46
+ var _a;
47
+ // استخراج مقادیر R، G، B از رشته RGB
48
+ const rgb_values = ((_a = rgb_color.match(/\d+(\.\d+)?/g)) === null || _a === void 0 ? void 0 : _a.map(Number)) || [];
49
+ const r = rgb_values[0] || 0;
50
+ const g = rgb_values[1] || 0;
51
+ const b = rgb_values[2] || 0;
52
+ // محاسبه میانگین مقادیر RGB
53
+ const avg_color = (r + g + b) / 3;
54
+ // انتخاب رنگ متن بر اساس میانگین رنگ پس زمینه
55
+ const text_color = avg_color > 127 ? "#000000" : "#FFFFFF"; // اگر میانگین بیشتر از نیمه‌ی راه بین 0 و 255 باشد، متن رنگ سیاه خواهد بود
56
+ return text_color;
57
+ }
58
+ /**
59
+ * متد generateContrastColorForBackground برای تولید رنگ متن بر اساس رنگ پس زمینه مورد نظر استفاده می‌شود.
60
+ * اگر رنگ پس زمینه null یا "transparent" باشد، رنگ متن #000000 (سیاه) برگردانده می‌شود.
61
+ * در غیر این صورت، از سه متد generateContrastColorForRgb و generateContrastColorForRgba و generateContrastColorForHex برای تولید رنگ متن استفاده می‌شود.
62
+ * اگر در هیچکدام از سه متد مورد نظر نگنجید، رنگ متن #000000 (سیاه) برگردانده می‌شود.
63
+ * @param background_color رنگ پس زمینه به هر فرمتی که می‌تواند string یا null باشد.
64
+ * @returns رنگ متن متناظر (به صورت hex) که برای نمایش بر روی رنگ پس زمینه انتخاب شده است.
65
+ */
66
+ generateContrastColorForBackground(background_color, default_text_color = "#000") {
67
+ // اگر رنگ پس زمینه null یا "transparent" باشد، رنگ سیاه را برگردانید
68
+ if (background_color === null || background_color.trim().toLowerCase() === "transparent") {
69
+ return default_text_color;
70
+ }
71
+ // استفاده از متد generateContrastColorForHex برای رنگ‌های HEX
72
+ if (/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(background_color.trim())) {
73
+ return this.generateContrastColorForHex(background_color);
74
+ }
75
+ // استفاده از متد generateContrastColorForRgb برای رنگ‌های RGB
76
+ if (/^rgb\(/i.test(background_color)) {
77
+ return this.generateContrastColorForRgb(background_color);
78
+ }
79
+ // استفاده از متد generateContrastColorForRgba برای رنگ‌های RGBA
80
+ if (/^rgba\(/i.test(background_color)) {
81
+ return this.generateContrastColorForRgba(background_color);
82
+ }
83
+ // اگر هیچکدام از فرمت‌های بالا نبود، رنگ سیاه را برگردانید
84
+ return default_text_color;
85
+ }
86
+ }
87
+ export default new ColorController();
@@ -0,0 +1,6 @@
1
+ declare enum EnumPickupInstruction {
2
+ None = 0,
3
+ Packed = 1,
4
+ Serving = 2
5
+ }
6
+ export default EnumPickupInstruction;
@@ -0,0 +1,7 @@
1
+ var EnumPickupInstruction;
2
+ (function (EnumPickupInstruction) {
3
+ EnumPickupInstruction[EnumPickupInstruction["None"] = 0] = "None";
4
+ EnumPickupInstruction[EnumPickupInstruction["Packed"] = 1] = "Packed";
5
+ EnumPickupInstruction[EnumPickupInstruction["Serving"] = 2] = "Serving";
6
+ })(EnumPickupInstruction || (EnumPickupInstruction = {}));
7
+ export default EnumPickupInstruction;
@@ -26,6 +26,7 @@ interface ICategory {
26
26
  spiciness: number;
27
27
  priority: number;
28
28
  allergicStuffs: number[];
29
+ color: string;
29
30
  }
30
31
  export declare const initCategory: ICategory;
31
32
  export default ICategory;
@@ -24,5 +24,6 @@ export const initCategory = {
24
24
  halal: false,
25
25
  spiciness: 0,
26
26
  priority: 0,
27
- allergicStuffs: []
27
+ allergicStuffs: [],
28
+ color: "transparent"
28
29
  };
@@ -37,5 +37,8 @@ export default interface IPointOfSaleSetting {
37
37
  availablePaymentTypes: number[];
38
38
  customerMandatoryType: number;
39
39
  startingOrderNumberFrom: number;
40
+ additionalPickupInstructions: boolean;
41
+ coloredTiles: boolean;
42
+ displayImages: boolean;
40
43
  }
41
44
  export declare const initPointOfSaleSetting: IPointOfSaleSetting;
@@ -38,4 +38,7 @@ export const initPointOfSaleSetting = {
38
38
  availablePaymentTypes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
39
39
  customerMandatoryType: 1,
40
40
  startingOrderNumberFrom: 1000,
41
+ additionalPickupInstructions: false,
42
+ coloredTiles: false,
43
+ displayImages: false,
41
44
  };
@@ -51,6 +51,7 @@ export default interface IProduct {
51
51
  menuId: number;
52
52
  packagingCosts: number;
53
53
  depositCost: number;
54
+ thumbnailImage: string;
54
55
  weight: number;
55
56
  size: number;
56
57
  dimensions: {
@@ -37,6 +37,9 @@ interface ISetting {
37
37
  availablePaymentTypes: number[];
38
38
  customerMandatoryType: number;
39
39
  startingOrderNumberFrom: number;
40
+ additionalPickupInstructions: boolean;
41
+ coloredTiles: boolean;
42
+ displayImages: boolean;
40
43
  }
41
44
  export default ISetting;
42
45
  export declare const initSetting: ISetting;
@@ -37,5 +37,8 @@ export const initSetting = {
37
37
  reportsAccess: true,
38
38
  availablePaymentTypes: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
39
39
  customerMandatoryType: 1,
40
- startingOrderNumberFrom: 1000
40
+ startingOrderNumberFrom: 1000,
41
+ additionalPickupInstructions: false,
42
+ coloredTiles: false,
43
+ displayImages: false,
41
44
  };
@@ -8,6 +8,7 @@ import TOrderPayStatus from "../../types/TOrderPayStatus";
8
8
  import EnumPaymentState from "../../enums/EnumPaymentState";
9
9
  import ICalculateFeeResult from "../ICalculateFeeResult";
10
10
  import IOrderDetails from "../print/IOrderDetails";
11
+ import EnumPickupInstruction from "../../enums/EnumPickupInstruction";
11
12
  interface IOrder {
12
13
  id: number;
13
14
  number: number;
@@ -74,6 +75,7 @@ interface IOrder {
74
75
  freeze: boolean;
75
76
  numberOfAttempts: number;
76
77
  referenceId: string;
78
+ additionalPickupInstructions: EnumPickupInstruction;
77
79
  }
78
80
  export default IOrder;
79
81
  export declare const initOrder: IOrder;
@@ -5,6 +5,7 @@ import EnumTipType from "../../enums/EnumTipType";
5
5
  import EnumPaymentType from "../../enums/EnumPaymentType";
6
6
  import { INIT_TERMINAL } from "../../statics";
7
7
  import EnumPaymentState from "../../enums/EnumPaymentState";
8
+ import EnumPickupInstruction from "../../enums/EnumPickupInstruction";
8
9
  export const initOrder = {
9
10
  id: -1,
10
11
  number: 0,
@@ -79,7 +80,8 @@ export const initOrder = {
79
80
  showCashCalculatorWindow: true,
80
81
  freeze: false,
81
82
  numberOfAttempts: 0,
82
- referenceId: ""
83
+ referenceId: "",
84
+ additionalPickupInstructions: EnumPickupInstruction.Packed
83
85
  // previousTotalAmount: 0,
84
86
  // previousOrderAmount : 0,
85
87
  // previousPaymentState: EnumPaymentState.NOT_PAID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.1.77",
3
+ "version": "1.1.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",