@managesome/eposmatic-toolkit 0.2.743 → 0.2.745
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.
- package/lib/constants/WEBVIEW.d.ts +1 -1
- package/lib/constants/WEBVIEW.js +2 -2
- package/lib/constants/types.d.ts +3 -0
- package/lib/helpers/utils/halfhalf-setup-helpers.js +8 -6
- package/lib/schemas/models/halfhalf_setup.d.ts +3 -0
- package/lib/schemas/models/halfhalf_setup.js +4 -0
- package/lib/schemas/types/halfhalf_setup.d.ts +1 -0
- package/lib/tests/choose-expensive-edge-cases.test.js +3 -0
- package/lib/tests/choose-expensive-flow-verification.test.js +1 -0
- package/lib/tests/simplified-halfhalf.test.js +1 -0
- package/lib/tests/specials-halfhalf-options.test.js +1 -0
- package/lib/tests/specials-halfhalf-pricing.test.js +1 -0
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ export declare const WEBVIEW_LOGOUT = "WEBVIEW_LOGOUT";
|
|
|
10
10
|
export declare const WEBVIEW_GET_PRINTERS = "WEBVIEW_GET_PRINTERS";
|
|
11
11
|
export declare const WEBVIEW_PRINT_IMAGE = "WEBVIEW_PRINT_IMAGE";
|
|
12
12
|
export declare const WEBVIEW_PRINT_IMAGE_FROM_ALL_PRINTERS = "WEBVIEW_PRINT_IMAGE_FROM_ALL_PRINTERS";
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const WEBVIEW_ATTACH_PRINTERS = "WEBVIEW_ATTACH_PRINTERS";
|
|
14
14
|
export declare const WEBVIEW_SET_PRINTER_SETTINGS = "WEBVIEW_SET_PRINTER_SETTINGS";
|
|
15
15
|
export declare const WEBVIEW_SET_ALL_PRINTER_SETTINGS = "WEBVIEW_SET_ALL_PRINTER_SETTINGS";
|
|
16
16
|
export declare const WEBVIEW_SYNC_PRINTERS_SETTINGS = "WEBVIEW_SYNC_PRINTERS_SETTINGS";
|
package/lib/constants/WEBVIEW.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBVIEW_OO_PLACED_REVIEW = exports.WEBVIEW_OO_PLACED_ORDER = exports.WEBVIEW_OO_ADD_TO_CART = exports.WEBVIEW_OO_VIEWED_ITEM = exports.WEBVIEW_OO_SENT_CATALOG = exports.WEBVIEW_OO_SET_STORE_SETTINGS = exports.WEBVIEW_OO_SET_LOADING = exports.WEBVIEW_REGISTER_USER_DETAILS = exports.WEBVIEW_GET_IMAGE_DATA_LOGO_FROM_BASE64 = exports.WEBVIEW_GET_IMAGE_DATA_FROM_BASE64 = exports.WEBVIEW_GET_BINARY_LOGO_FROM_BASE64 = exports.WEBVIEW_GET_BINARY_IMAGE_FROM_BASE64 = exports.WEBVIEW_UPDATE_PRINTER_SETTINGS = exports.WEBVIEW_PRINTER_EVENT = exports.WEBVIEW_SET_PRINTERS = exports.WEBVIEW_RENDER_BACK_PRESS = exports.WEBVIEW_RETRY_PRINT = exports.WEBVIEW_SET_IMAGE_DATA_LOGO = exports.WEBVIEW_PRINT_IMAGE_DATA = exports.WEBVIEW_SET_BINARY_LOGO = exports.WEBVIEW_PRINT_BINARY_IMAGE = exports.WEBVIEW_PRINT_TEXT = exports.WEBVIEW_DOWNLOAD_FILE = exports.WEBVIEW_COMMIT_SYNC_PRINTERS_SETTINGS = exports.WEBVIEW_SYNC_PRINTERS_SETTINGS = exports.WEBVIEW_SET_ALL_PRINTER_SETTINGS = exports.WEBVIEW_SET_PRINTER_SETTINGS = exports.
|
|
3
|
+
exports.WEBVIEW_OO_PLACED_REVIEW = exports.WEBVIEW_OO_PLACED_ORDER = exports.WEBVIEW_OO_ADD_TO_CART = exports.WEBVIEW_OO_VIEWED_ITEM = exports.WEBVIEW_OO_SENT_CATALOG = exports.WEBVIEW_OO_SET_STORE_SETTINGS = exports.WEBVIEW_OO_SET_LOADING = exports.WEBVIEW_REGISTER_USER_DETAILS = exports.WEBVIEW_GET_IMAGE_DATA_LOGO_FROM_BASE64 = exports.WEBVIEW_GET_IMAGE_DATA_FROM_BASE64 = exports.WEBVIEW_GET_BINARY_LOGO_FROM_BASE64 = exports.WEBVIEW_GET_BINARY_IMAGE_FROM_BASE64 = exports.WEBVIEW_UPDATE_PRINTER_SETTINGS = exports.WEBVIEW_PRINTER_EVENT = exports.WEBVIEW_SET_PRINTERS = exports.WEBVIEW_RENDER_BACK_PRESS = exports.WEBVIEW_RETRY_PRINT = exports.WEBVIEW_SET_IMAGE_DATA_LOGO = exports.WEBVIEW_PRINT_IMAGE_DATA = exports.WEBVIEW_SET_BINARY_LOGO = exports.WEBVIEW_PRINT_BINARY_IMAGE = exports.WEBVIEW_PRINT_TEXT = exports.WEBVIEW_DOWNLOAD_FILE = exports.WEBVIEW_COMMIT_SYNC_PRINTERS_SETTINGS = exports.WEBVIEW_SYNC_PRINTERS_SETTINGS = exports.WEBVIEW_SET_ALL_PRINTER_SETTINGS = exports.WEBVIEW_SET_PRINTER_SETTINGS = exports.WEBVIEW_ATTACH_PRINTERS = exports.WEBVIEW_PRINT_IMAGE_FROM_ALL_PRINTERS = exports.WEBVIEW_PRINT_IMAGE = exports.WEBVIEW_GET_PRINTERS = exports.WEBVIEW_LOGOUT = exports.WEBVIEW_UPDATE_SETTINGS = exports.WEBVIEW_SET_INITIATE_STATE = exports.WEBVIEW_SET_SETTINGS = exports.WEBVIEW_OPEN_CASH_DRAWER = exports.WEBVIEW_PRINT_ORDER = exports.WEBVIEW_PRINT_ORDER_FROM_ALL_PRINTERS = exports.WEBVIEW_SET_ROUTE_TO_PRINTER_SETTINGS = exports.WEBVIEW_OPEN_LINK = void 0;
|
|
4
4
|
exports.WEBVIEW_OPEN_LINK = 'WEBVIEW_OPEN_LINK';
|
|
5
5
|
exports.WEBVIEW_SET_ROUTE_TO_PRINTER_SETTINGS = 'WEBVIEW_SET_ROUTE_TO_PRINTER_SETTINGS';
|
|
6
6
|
exports.WEBVIEW_PRINT_ORDER_FROM_ALL_PRINTERS = 'WEBVIEW_PRINT_ORDER_FROM_ALL_PRINTERS';
|
|
@@ -13,7 +13,7 @@ exports.WEBVIEW_LOGOUT = 'WEBVIEW_LOGOUT';
|
|
|
13
13
|
exports.WEBVIEW_GET_PRINTERS = 'WEBVIEW_GET_PRINTERS';
|
|
14
14
|
exports.WEBVIEW_PRINT_IMAGE = 'WEBVIEW_PRINT_IMAGE';
|
|
15
15
|
exports.WEBVIEW_PRINT_IMAGE_FROM_ALL_PRINTERS = 'WEBVIEW_PRINT_IMAGE_FROM_ALL_PRINTERS';
|
|
16
|
-
exports.
|
|
16
|
+
exports.WEBVIEW_ATTACH_PRINTERS = 'WEBVIEW_ATTACH_PRINTERS';
|
|
17
17
|
exports.WEBVIEW_SET_PRINTER_SETTINGS = 'WEBVIEW_SET_PRINTER_SETTINGS';
|
|
18
18
|
exports.WEBVIEW_SET_ALL_PRINTER_SETTINGS = 'WEBVIEW_SET_ALL_PRINTER_SETTINGS';
|
|
19
19
|
exports.WEBVIEW_SYNC_PRINTERS_SETTINGS = 'WEBVIEW_SYNC_PRINTERS_SETTINGS';
|
package/lib/constants/types.d.ts
CHANGED
|
@@ -194,7 +194,10 @@ export interface IWebviewPatchPrinters {
|
|
|
194
194
|
export interface IWebviewAttachPrinterToAccount {
|
|
195
195
|
target: string;
|
|
196
196
|
pos_id: string | null;
|
|
197
|
+
}
|
|
198
|
+
export interface IWebviewAttachPrinters {
|
|
197
199
|
request_id: string;
|
|
200
|
+
printers: IWebviewAttachPrinterToAccount[];
|
|
198
201
|
}
|
|
199
202
|
export interface IWebviewPrinterEvent {
|
|
200
203
|
type: PRINTER_EVENT_TYPE_ENUM;
|
|
@@ -25,7 +25,7 @@ const specials_helpers_1 = require("./specials-helpers");
|
|
|
25
25
|
function getHalfHalfPostedData(data, payload) {
|
|
26
26
|
return data.some((half) => half._id === payload._id)
|
|
27
27
|
? data
|
|
28
|
-
: data.concat(getHalfhalfSetupWithPrice(payload)).sort(
|
|
28
|
+
: data.concat(getHalfhalfSetupWithPrice(payload)).sort((a, b) => (a.sort_id ?? 0) - (b.sort_id ?? 0));
|
|
29
29
|
}
|
|
30
30
|
function renderBulkHalfHalfUpdate(data, payload) {
|
|
31
31
|
return data
|
|
@@ -35,7 +35,7 @@ function renderBulkHalfHalfUpdate(data, payload) {
|
|
|
35
35
|
? { ...halfHalf, ...(updatedHalfHalf != null ? getHalfhalfSetupWithPrice(updatedHalfHalf) : {}) }
|
|
36
36
|
: halfHalf;
|
|
37
37
|
})
|
|
38
|
-
.sort(
|
|
38
|
+
.sort((a, b) => (a.sort_id ?? 0) - (b.sort_id ?? 0));
|
|
39
39
|
}
|
|
40
40
|
function getHalfHalfUpdatedData(data, payload) {
|
|
41
41
|
return data
|
|
@@ -45,10 +45,10 @@ function getHalfHalfUpdatedData(data, payload) {
|
|
|
45
45
|
...getHalfhalfSetupWithPrice(payload),
|
|
46
46
|
}
|
|
47
47
|
: halfHalf)
|
|
48
|
-
.sort(
|
|
48
|
+
.sort((a, b) => (a.sort_id ?? 0) - (b.sort_id ?? 0));
|
|
49
49
|
}
|
|
50
50
|
function getHalfHalfDeletedData(data, payload) {
|
|
51
|
-
return data.filter((halfHalf) => halfHalf._id !== payload).sort(
|
|
51
|
+
return data.filter((halfHalf) => halfHalf._id !== payload).sort((a, b) => (a.sort_id ?? 0) - (b.sort_id ?? 0));
|
|
52
52
|
}
|
|
53
53
|
// ====================================================================================================
|
|
54
54
|
function getHalfhalfSetupWithPrice(halfhalfSetup, writeable) {
|
|
@@ -144,9 +144,11 @@ function convertHalfHalfSetupToWorkableHalfHalfSetup(halfhalfSetups, itemsMap, p
|
|
|
144
144
|
if (!platform || !tenant_id)
|
|
145
145
|
return [];
|
|
146
146
|
const isSimple = typeof itemsMap[Object.keys(itemsMap)[0]]?.sold_out === 'boolean';
|
|
147
|
+
// Order the menu by the setup's sort_id (same as specials).
|
|
148
|
+
const sortedHalfhalfSetups = [...halfhalfSetups].sort((a, b) => (a.sort_id ?? 0) - (b.sort_id ?? 0));
|
|
147
149
|
const halfhalfMenu = [];
|
|
148
|
-
for (let i = 0; i <
|
|
149
|
-
const halfhalfSetup =
|
|
150
|
+
for (let i = 0; i < sortedHalfhalfSetups.length; i++) {
|
|
151
|
+
const halfhalfSetup = sortedHalfhalfSetups[i];
|
|
150
152
|
if (!halfhalfSetup.active ||
|
|
151
153
|
!halfhalfSetup.tenants.includes(tenant_id) ||
|
|
152
154
|
!halfhalfSetup.included_platforms.includes(platform))
|
|
@@ -77,6 +77,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
|
|
|
77
77
|
image_url: string;
|
|
78
78
|
brand_id: string;
|
|
79
79
|
active: boolean;
|
|
80
|
+
sort_id: number;
|
|
80
81
|
category_id: import("mongoose").Types.ObjectId;
|
|
81
82
|
items: import("mongoose").Types.DocumentArray<{
|
|
82
83
|
sort_id: number;
|
|
@@ -621,6 +622,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
|
|
|
621
622
|
image_url: string;
|
|
622
623
|
brand_id: string;
|
|
623
624
|
active: boolean;
|
|
625
|
+
sort_id: number;
|
|
624
626
|
category_id: import("mongoose").Types.ObjectId;
|
|
625
627
|
items: import("mongoose").Types.DocumentArray<{
|
|
626
628
|
sort_id: number;
|
|
@@ -1165,6 +1167,7 @@ export declare const HalfHalfSetupSchema: Schema<any, import("mongoose").Model<a
|
|
|
1165
1167
|
image_url: string;
|
|
1166
1168
|
brand_id: string;
|
|
1167
1169
|
active: boolean;
|
|
1170
|
+
sort_id: number;
|
|
1168
1171
|
category_id: import("mongoose").Types.ObjectId;
|
|
1169
1172
|
items: import("mongoose").Types.DocumentArray<{
|
|
1170
1173
|
sort_id: number;
|
|
@@ -21,6 +21,7 @@ export interface IHalfHalfSetup {
|
|
|
21
21
|
upsell_price: IPrice | null;
|
|
22
22
|
discount_amount: IPrice | null;
|
|
23
23
|
is_discount_percentage: boolean;
|
|
24
|
+
sort_id: number;
|
|
24
25
|
choose_expensive_segment_price: boolean;
|
|
25
26
|
item_special_hours: IItemSpecialHour[] | null;
|
|
26
27
|
items: ISpecialItem[];
|
|
@@ -442,6 +442,7 @@ describe('choose_expensive_segment_price — classic edge cases', () => {
|
|
|
442
442
|
upsell_price: null,
|
|
443
443
|
discount_amount: null,
|
|
444
444
|
is_discount_percentage: false,
|
|
445
|
+
sort_id: 1,
|
|
445
446
|
choose_expensive_segment_price: true,
|
|
446
447
|
segments: [
|
|
447
448
|
{ _id: 'seg-1', name: 'First Half', sort_id: 1 },
|
|
@@ -765,6 +766,7 @@ function makeWorkableHalfHalf() {
|
|
|
765
766
|
upsell_price: null,
|
|
766
767
|
discount_amount: null,
|
|
767
768
|
is_discount_percentage: false,
|
|
769
|
+
sort_id: 1,
|
|
768
770
|
choose_expensive_segment_price: true,
|
|
769
771
|
segments: [
|
|
770
772
|
{ _id: 'seg-1', name: 'First Half', sort_id: 1 },
|
|
@@ -900,6 +902,7 @@ describe('classic vs modern parity (same setup + same halves -> same charge)', (
|
|
|
900
902
|
upsell_price: null,
|
|
901
903
|
discount_amount: null,
|
|
902
904
|
is_discount_percentage: false,
|
|
905
|
+
sort_id: 1,
|
|
903
906
|
choose_expensive_segment_price: true,
|
|
904
907
|
segments: [
|
|
905
908
|
{ _id: 'seg-1', name: 'First Half', sort_id: 1 },
|
|
@@ -22,6 +22,7 @@ function makeHalfHalfSetup(overrides = {}) {
|
|
|
22
22
|
upsell_price: { BASE_PRICE: 1000 },
|
|
23
23
|
discount_amount: null,
|
|
24
24
|
is_discount_percentage: false,
|
|
25
|
+
sort_id: 1,
|
|
25
26
|
choose_expensive_segment_price: true,
|
|
26
27
|
item_special_hours: null,
|
|
27
28
|
items: [{ item_id: 'item-1', sort_id: 1, upsell_price: { BASE_PRICE: 500 } }],
|
|
@@ -97,6 +97,7 @@ function makeHalfHalfSetup(overrides = {}) {
|
|
|
97
97
|
upsell_price: { BASE_PRICE: 300 },
|
|
98
98
|
discount_amount: null,
|
|
99
99
|
is_discount_percentage: false,
|
|
100
|
+
sort_id: 1,
|
|
100
101
|
choose_expensive_segment_price: true,
|
|
101
102
|
segments: [
|
|
102
103
|
{ _id: 'seg-1', name: 'First Half', sort_id: 1 },
|