@open-tender/utils 0.4.48 → 0.4.50
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.
|
@@ -83,7 +83,7 @@ const useSignUpGuestForm = (email, guest, loading, error, guestErrors, signUp, s
|
|
|
83
83
|
if (!disabled) {
|
|
84
84
|
setErrors({});
|
|
85
85
|
setSubmitting(true);
|
|
86
|
-
const values = Object.assign(Object.assign({}, data), { email });
|
|
86
|
+
const values = Object.assign(Object.assign({}, data), { email, communications: comms });
|
|
87
87
|
if (values.birth_date) {
|
|
88
88
|
values.birth_date = (0, utils_1.slashesToDashes)(values.birth_date);
|
|
89
89
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OrderChannel, OrderCounts, PosCart, PrepStatus, Store, TenderType, Ticket } from '@open-tender/types';
|
|
1
|
+
import { ConfirmationSections, Order, OrderChannel, OrderCounts, PosCart, PrepStatus, Store, TenderType, Ticket } from '@open-tender/types';
|
|
2
2
|
export declare const makeChannelName: (channel: OrderChannel) => string | null | undefined;
|
|
3
3
|
export declare const makeTenderTypeName: (tenderType: TenderType) => string;
|
|
4
4
|
export declare const notDone: (prep_status: PrepStatus) => boolean;
|
|
@@ -19,3 +19,4 @@ export declare const makeTicketGroups: (tickets: Array<Ticket>, cart: PosCart, i
|
|
|
19
19
|
export declare const makeDisplayCounts: (counts: OrderCounts) => any[] | "";
|
|
20
20
|
export declare const displayCounts: (counts: OrderCounts) => string;
|
|
21
21
|
export declare const makeColor: (settings: Store, minutes: number) => string;
|
|
22
|
+
export declare const makeConfirmationOrderType: (order: Order) => keyof ConfirmationSections | null;
|
package/dist/cjs/utils/orders.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeColor = exports.displayCounts = exports.makeDisplayCounts = exports.makeTicketGroups = exports.makeItemTypesMap = exports.makeItemTypeSettings = exports.makeCartLookup = exports.makeTicketCounts = exports.isCompleted = exports.notCompleted = exports.isDone = exports.notDone = exports.makeTenderTypeName = exports.makeChannelName = void 0;
|
|
3
|
+
exports.makeConfirmationOrderType = exports.makeColor = exports.displayCounts = exports.makeDisplayCounts = exports.makeTicketGroups = exports.makeItemTypesMap = exports.makeItemTypeSettings = exports.makeCartLookup = exports.makeTicketCounts = exports.isCompleted = exports.notCompleted = exports.isDone = exports.notDone = exports.makeTenderTypeName = exports.makeChannelName = void 0;
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const helpers_1 = require("./helpers");
|
|
6
6
|
const makeChannelName = (channel) => {
|
|
@@ -200,3 +200,27 @@ const makeColor = (settings, minutes) => {
|
|
|
200
200
|
: 'text';
|
|
201
201
|
};
|
|
202
202
|
exports.makeColor = makeColor;
|
|
203
|
+
const makeConfirmationOrderType = (order) => {
|
|
204
|
+
if (!order)
|
|
205
|
+
return null;
|
|
206
|
+
const { order_type, service_type, order_fulfillment, revenue_center, details } = order;
|
|
207
|
+
const { notes_internal } = details || {};
|
|
208
|
+
const isWalkIn = service_type === 'WALKIN';
|
|
209
|
+
if (isWalkIn) {
|
|
210
|
+
if (notes_internal && notes_internal.includes('TAKE OUT')) {
|
|
211
|
+
return 'takeOut';
|
|
212
|
+
}
|
|
213
|
+
return 'dineIn';
|
|
214
|
+
}
|
|
215
|
+
if (order_type === 'CATERING')
|
|
216
|
+
return 'catering';
|
|
217
|
+
if (revenue_center.is_outpost)
|
|
218
|
+
return 'outpost';
|
|
219
|
+
if (service_type === 'DELIVERY')
|
|
220
|
+
return 'delivery';
|
|
221
|
+
if (service_type === 'PICKUP' && order_fulfillment) {
|
|
222
|
+
return 'curbside';
|
|
223
|
+
}
|
|
224
|
+
return 'pickup';
|
|
225
|
+
};
|
|
226
|
+
exports.makeConfirmationOrderType = makeConfirmationOrderType;
|
|
@@ -80,7 +80,7 @@ export const useSignUpGuestForm = (email, guest, loading, error, guestErrors, si
|
|
|
80
80
|
if (!disabled) {
|
|
81
81
|
setErrors({});
|
|
82
82
|
setSubmitting(true);
|
|
83
|
-
const values = Object.assign(Object.assign({}, data), { email });
|
|
83
|
+
const values = Object.assign(Object.assign({}, data), { email, communications: comms });
|
|
84
84
|
if (values.birth_date) {
|
|
85
85
|
values.birth_date = slashesToDashes(values.birth_date);
|
|
86
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OrderChannel, OrderCounts, PosCart, PrepStatus, Store, TenderType, Ticket } from '@open-tender/types';
|
|
1
|
+
import { ConfirmationSections, Order, OrderChannel, OrderCounts, PosCart, PrepStatus, Store, TenderType, Ticket } from '@open-tender/types';
|
|
2
2
|
export declare const makeChannelName: (channel: OrderChannel) => string | null | undefined;
|
|
3
3
|
export declare const makeTenderTypeName: (tenderType: TenderType) => string;
|
|
4
4
|
export declare const notDone: (prep_status: PrepStatus) => boolean;
|
|
@@ -19,3 +19,4 @@ export declare const makeTicketGroups: (tickets: Array<Ticket>, cart: PosCart, i
|
|
|
19
19
|
export declare const makeDisplayCounts: (counts: OrderCounts) => any[] | "";
|
|
20
20
|
export declare const displayCounts: (counts: OrderCounts) => string;
|
|
21
21
|
export declare const makeColor: (settings: Store, minutes: number) => string;
|
|
22
|
+
export declare const makeConfirmationOrderType: (order: Order) => keyof ConfirmationSections | null;
|
package/dist/esm/utils/orders.js
CHANGED
|
@@ -183,3 +183,26 @@ export const makeColor = (settings, minutes) => {
|
|
|
183
183
|
? 'alert'
|
|
184
184
|
: 'text';
|
|
185
185
|
};
|
|
186
|
+
export const makeConfirmationOrderType = (order) => {
|
|
187
|
+
if (!order)
|
|
188
|
+
return null;
|
|
189
|
+
const { order_type, service_type, order_fulfillment, revenue_center, details } = order;
|
|
190
|
+
const { notes_internal } = details || {};
|
|
191
|
+
const isWalkIn = service_type === 'WALKIN';
|
|
192
|
+
if (isWalkIn) {
|
|
193
|
+
if (notes_internal && notes_internal.includes('TAKE OUT')) {
|
|
194
|
+
return 'takeOut';
|
|
195
|
+
}
|
|
196
|
+
return 'dineIn';
|
|
197
|
+
}
|
|
198
|
+
if (order_type === 'CATERING')
|
|
199
|
+
return 'catering';
|
|
200
|
+
if (revenue_center.is_outpost)
|
|
201
|
+
return 'outpost';
|
|
202
|
+
if (service_type === 'DELIVERY')
|
|
203
|
+
return 'delivery';
|
|
204
|
+
if (service_type === 'PICKUP' && order_fulfillment) {
|
|
205
|
+
return 'curbside';
|
|
206
|
+
}
|
|
207
|
+
return 'pickup';
|
|
208
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.50",
|
|
4
4
|
"description": "A library of utils for use with Open Tender applications that utilize our cloud-based Order API.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"typescript": "^4.8.2"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@open-tender/types": "^0.4.
|
|
60
|
+
"@open-tender/types": "^0.4.77",
|
|
61
61
|
"@reduxjs/toolkit": "^1.8.5",
|
|
62
62
|
"react": "^18.2.0"
|
|
63
63
|
},
|