meemup-library 1.0.20 → 1.0.22

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,9 @@
1
+ import ILocalSetting from "../interfaces/ILocalSetting";
2
+ import ISetting from "../interfaces/ISetting";
3
+ import ICustomerFacingDisplayPacket from "../interfaces/cfds/ICustomerFacingDisplayPacket";
4
+ import IOrder from "../interfaces/order/IOrder";
5
+ declare const _default: {
6
+ code(order: IOrder, setting: ISetting, localSetting: ILocalSetting): ICustomerFacingDisplayPacket;
7
+ decode(data: string): ICustomerFacingDisplayPacket;
8
+ };
9
+ export default _default;
@@ -0,0 +1,39 @@
1
+ export default new class CustomerFacingDisplayPacketController {
2
+ code(order, setting, localSetting) {
3
+ let packet = {
4
+ r: localSetting.udpClientName,
5
+ c: setting.currencySymbol,
6
+ d: []
7
+ };
8
+ order.products.forEach(product => {
9
+ let extPro = [];
10
+ product.extras.forEach(ext => {
11
+ extPro.push({
12
+ q: ext.quantity,
13
+ t: ext.text,
14
+ p: ext.totalAmount
15
+ });
16
+ });
17
+ let pro = {
18
+ q: product.quantity,
19
+ t: product.title,
20
+ e: extPro
21
+ };
22
+ packet.d.push(pro);
23
+ });
24
+ return packet;
25
+ }
26
+ decode(data) {
27
+ let packet = {
28
+ r: "",
29
+ c: "",
30
+ d: []
31
+ };
32
+ try {
33
+ return JSON.parse(data);
34
+ }
35
+ catch (e) {
36
+ }
37
+ return packet;
38
+ }
39
+ }();
@@ -0,0 +1,7 @@
1
+ interface ICustomerFacingDisplayPacket {
2
+ r: string;
3
+ c: string;
4
+ d: any[];
5
+ }
6
+ export default ICustomerFacingDisplayPacket;
7
+ export declare const initCustomerFacingDisplaySetting: ICustomerFacingDisplayPacket;
@@ -0,0 +1,5 @@
1
+ export const initCustomerFacingDisplaySetting = {
2
+ r: "",
3
+ c: "",
4
+ d: []
5
+ };
@@ -0,0 +1,8 @@
1
+ interface ICustomerFacingDisplaySetting {
2
+ company: string;
3
+ port: number;
4
+ clientName: string;
5
+ currency: string;
6
+ }
7
+ export default ICustomerFacingDisplaySetting;
8
+ export declare const initCustomerFacingDisplaySetting: ICustomerFacingDisplaySetting;
@@ -0,0 +1,7 @@
1
+ import { UDP_CUSTOMER_MONITOR_PRE_NAME } from "../../statics";
2
+ export const initCustomerFacingDisplaySetting = {
3
+ company: "",
4
+ port: 8000,
5
+ clientName: UDP_CUSTOMER_MONITOR_PRE_NAME + "1",
6
+ currency: "$"
7
+ };
@@ -0,0 +1,5 @@
1
+ import ICustomerFacingDisplaySetting from "./ICustomerFacingDisplaySetting";
2
+ interface ICustomerFacingDisplayStore {
3
+ setting: ICustomerFacingDisplaySetting;
4
+ }
5
+ export default ICustomerFacingDisplayStore;
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",