@open-tender/store 1.1.131 → 1.1.133
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/dist/cjs/components/CartItem.js +3 -1
- package/dist/cjs/components/CartUpsellItem.js +9 -1
- package/dist/cjs/components/UpsellItem.js +9 -1
- package/dist/cjs/slices/checkout.d.ts +1 -5
- package/dist/cjs/slices/checkout.js +6 -17
- package/dist/esm/components/CartItem.js +4 -2
- package/dist/esm/components/CartUpsellItem.js +10 -2
- package/dist/esm/components/UpsellItem.js +10 -2
- package/dist/esm/slices/checkout.d.ts +1 -5
- package/dist/esm/slices/checkout.js +6 -17
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@ var CartItem = function (_a) {
|
|
|
10
10
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
11
11
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
12
12
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).cartItem;
|
|
13
|
+
var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
|
|
13
14
|
var increment = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.incrementItemInCart)(item)); }, [item, dispatch]);
|
|
14
15
|
var decrement = (0, react_1.useCallback)(function () { return dispatch((0, slices_1.decrementItemInCart)(item)); }, [dispatch, item]);
|
|
15
16
|
var remove = function () { return dispatch((0, slices_1.removeItemFromCart)(item)); };
|
|
@@ -26,7 +27,8 @@ var CartItem = function (_a) {
|
|
|
26
27
|
isLast: isLast,
|
|
27
28
|
isEditable: isEditable,
|
|
28
29
|
renderQuantity: renderQuantity,
|
|
29
|
-
apiUrl: apiUrl
|
|
30
|
+
apiUrl: apiUrl,
|
|
31
|
+
displayCals: display_cals
|
|
30
32
|
});
|
|
31
33
|
};
|
|
32
34
|
exports.default = CartItem;
|
|
@@ -8,6 +8,7 @@ var CartUpsellItem = function (_a) {
|
|
|
8
8
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
9
9
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
10
10
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).cartUpsellItem;
|
|
11
|
+
var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
|
|
11
12
|
var builtItem = (0, utils_1.useBuilder)(item).item;
|
|
12
13
|
var quantity = builtItem.quantity, groups = builtItem.groups;
|
|
13
14
|
var groupsBelowMin = (0, utils_1.hasGroupsBelowMin)(null, groups);
|
|
@@ -20,6 +21,13 @@ var CartUpsellItem = function (_a) {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
var handlers = { add: add };
|
|
23
|
-
return children({
|
|
24
|
+
return children({
|
|
25
|
+
config: config,
|
|
26
|
+
handlers: handlers,
|
|
27
|
+
item: item,
|
|
28
|
+
isLast: isLast,
|
|
29
|
+
apiUrl: apiUrl,
|
|
30
|
+
displayCals: display_cals
|
|
31
|
+
});
|
|
24
32
|
};
|
|
25
33
|
exports.default = CartUpsellItem;
|
|
@@ -8,6 +8,7 @@ var UpsellItem = function (_a) {
|
|
|
8
8
|
var dispatch = (0, hooks_1.useAppDispatch)();
|
|
9
9
|
var apiUrl = (0, hooks_1.useAppSelector)(slices_1.selectKioskApi);
|
|
10
10
|
var config = (0, hooks_1.useAppSelector)(slices_1.selectKioskConfig).upsellItem;
|
|
11
|
+
var display_cals = (0, hooks_1.useAppSelector)(slices_1.selectStoreSettings).display_cals;
|
|
11
12
|
var builtItem = (0, utils_1.useBuilder)(item).item;
|
|
12
13
|
var quantity = builtItem.quantity, groups = builtItem.groups;
|
|
13
14
|
var groupsBelowMin = (0, utils_1.hasGroupsBelowMin)(null, groups);
|
|
@@ -20,6 +21,13 @@ var UpsellItem = function (_a) {
|
|
|
20
21
|
}
|
|
21
22
|
};
|
|
22
23
|
var handlers = { add: add };
|
|
23
|
-
return children({
|
|
24
|
+
return children({
|
|
25
|
+
config: config,
|
|
26
|
+
handlers: handlers,
|
|
27
|
+
item: item,
|
|
28
|
+
isLast: isLast,
|
|
29
|
+
apiUrl: apiUrl,
|
|
30
|
+
displayCals: display_cals
|
|
31
|
+
});
|
|
24
32
|
};
|
|
25
33
|
exports.default = UpsellItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CheckoutTenderPos, CustomerIdentifier, CustomerIdentify, Discount, Money, Order,
|
|
1
|
+
import { CheckoutTenderPos, CustomerIdentifier, CustomerIdentify, Discount, Money, Order, OrderCreateDiscount, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreatePos, OrderCreateSurcharge, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
import { OrderState } from './order';
|
|
4
4
|
export interface CheckoutState {
|
|
@@ -24,9 +24,6 @@ export interface CheckoutState {
|
|
|
24
24
|
tip: Money | null;
|
|
25
25
|
validating: RequestStatus;
|
|
26
26
|
}
|
|
27
|
-
interface OrderCreatePos extends Omit<OrderCreate, 'customer'> {
|
|
28
|
-
customer: CustomerIdentify | null;
|
|
29
|
-
}
|
|
30
27
|
export declare const prepareOrder: (order: OrderState, checkout: CheckoutState) => OrderCreatePos | null;
|
|
31
28
|
export declare enum CheckoutActionType {
|
|
32
29
|
AddPromoCode = "checkout/addPromoCode",
|
|
@@ -168,4 +165,3 @@ export declare const selectPosCheckSubtotal: (state: AppState) => `${number}.${n
|
|
|
168
165
|
export declare const selectPosCheckTotal: (state: AppState) => `${number}.${number}`;
|
|
169
166
|
export declare const selectPosCheckTenders: (state: AppState) => import("@open-tender/types").OrderTenders;
|
|
170
167
|
export declare const checkoutReducer: import("redux").Reducer<CheckoutState>;
|
|
171
|
-
export {};
|
|
@@ -38,7 +38,7 @@ var getAmountDue = function (check) {
|
|
|
38
38
|
return check && check.totals ? check.totals.amount_due : null;
|
|
39
39
|
};
|
|
40
40
|
var prepareOrder = function (order, checkout) {
|
|
41
|
-
var order_uuid = order.orderId, requested_at = order.requestedAt, service_type = order.serviceType, order_type = order.orderType, revenue_center_id = order.revenueCenterId;
|
|
41
|
+
var order_uuid = order.orderId, requested_at = order.requestedAt, service_type = order.serviceType, order_type = order.orderType, revenue_center_id = order.revenueCenterId, prep_type = order.prepType;
|
|
42
42
|
if (!order_uuid)
|
|
43
43
|
return null;
|
|
44
44
|
var simpleCart = (0, utils_1.makeSimpleCart)(order.cart);
|
|
@@ -46,33 +46,22 @@ var prepareOrder = function (order, checkout) {
|
|
|
46
46
|
if (!revenue_center_id || !order_type || !service_type) {
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
|
-
var customer = checkout.customer,
|
|
50
|
-
// giftCards: gift_cards,
|
|
51
|
-
surcharges = checkout.surcharges, discounts = checkout.discounts, taxes = checkout.taxes, tip = checkout.tip,
|
|
52
|
-
// isTaxExempt,
|
|
53
|
-
points = checkout.points;
|
|
54
|
-
// const is_tax_exempt = isTaxExempt ? true : false
|
|
55
|
-
// const { customer_id, first_name, last_name, email, phone } =
|
|
56
|
-
// customer?.customer || {}
|
|
57
|
-
// const customerCreate = customer
|
|
58
|
-
// ? { customer_id, first_name, last_name, email, phone }
|
|
59
|
-
// : null
|
|
49
|
+
var customer = checkout.customer, surcharges = checkout.surcharges, discounts = checkout.discounts, taxes = checkout.taxes, tip = checkout.tip, points = checkout.points, made_for = checkout.madeFor, phone = checkout.phone;
|
|
60
50
|
return {
|
|
61
51
|
order_uuid: order_uuid,
|
|
62
52
|
revenue_center_id: revenue_center_id,
|
|
63
|
-
// order_type,
|
|
64
53
|
service_type: service_type,
|
|
65
54
|
requested_at: requested_at,
|
|
66
|
-
// customer: customerCreate,
|
|
67
55
|
customer: customer,
|
|
68
56
|
cart: cart,
|
|
69
|
-
// gift_cards,
|
|
70
57
|
surcharges: surcharges,
|
|
71
58
|
discounts: discounts,
|
|
72
59
|
taxes: taxes,
|
|
73
|
-
// is_tax_exempt,
|
|
74
60
|
tip: tip || '0.00',
|
|
75
|
-
points: points
|
|
61
|
+
points: points,
|
|
62
|
+
made_for: made_for,
|
|
63
|
+
phone: phone,
|
|
64
|
+
prep_type: prep_type
|
|
76
65
|
};
|
|
77
66
|
};
|
|
78
67
|
exports.prepareOrder = prepareOrder;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
-
import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskApi, selectKioskConfig, setCurrentItem } from '../slices';
|
|
3
|
+
import { decrementItemInCart, incrementItemInCart, removeItemFromCart, selectKioskApi, selectKioskConfig, selectStoreSettings, setCurrentItem } from '../slices';
|
|
4
4
|
import { default as QuantityContainer } from './Quantity';
|
|
5
5
|
var CartItem = function (_a) {
|
|
6
6
|
var item = _a.item, _b = _a.isLast, isLast = _b === void 0 ? false : _b, _c = _a.isEditable, isEditable = _c === void 0 ? true : _c, navigate = _a.navigate, children = _a.children, QuantityView = _a.QuantityView;
|
|
7
7
|
var dispatch = useAppDispatch();
|
|
8
8
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
9
9
|
var config = useAppSelector(selectKioskConfig).cartItem;
|
|
10
|
+
var display_cals = useAppSelector(selectStoreSettings).display_cals;
|
|
10
11
|
var increment = useCallback(function () { return dispatch(incrementItemInCart(item)); }, [item, dispatch]);
|
|
11
12
|
var decrement = useCallback(function () { return dispatch(decrementItemInCart(item)); }, [dispatch, item]);
|
|
12
13
|
var remove = function () { return dispatch(removeItemFromCart(item)); };
|
|
@@ -23,7 +24,8 @@ var CartItem = function (_a) {
|
|
|
23
24
|
isLast: isLast,
|
|
24
25
|
isEditable: isEditable,
|
|
25
26
|
renderQuantity: renderQuantity,
|
|
26
|
-
apiUrl: apiUrl
|
|
27
|
+
apiUrl: apiUrl,
|
|
28
|
+
displayCals: display_cals
|
|
27
29
|
});
|
|
28
30
|
};
|
|
29
31
|
export default CartItem;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { hasGroupsBelowMin, useBuilder } from '@open-tender/utils';
|
|
2
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
-
import { addItemToCart, selectKioskApi, selectKioskConfig } from '../slices';
|
|
3
|
+
import { addItemToCart, selectKioskApi, selectKioskConfig, selectStoreSettings } from '../slices';
|
|
4
4
|
var CartUpsellItem = function (_a) {
|
|
5
5
|
var item = _a.item, callback = _a.callback, isLast = _a.isLast, children = _a.children;
|
|
6
6
|
var dispatch = useAppDispatch();
|
|
7
7
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
8
8
|
var config = useAppSelector(selectKioskConfig).cartUpsellItem;
|
|
9
|
+
var display_cals = useAppSelector(selectStoreSettings).display_cals;
|
|
9
10
|
var builtItem = useBuilder(item).item;
|
|
10
11
|
var quantity = builtItem.quantity, groups = builtItem.groups;
|
|
11
12
|
var groupsBelowMin = hasGroupsBelowMin(null, groups);
|
|
@@ -18,6 +19,13 @@ var CartUpsellItem = function (_a) {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
var handlers = { add: add };
|
|
21
|
-
return children({
|
|
22
|
+
return children({
|
|
23
|
+
config: config,
|
|
24
|
+
handlers: handlers,
|
|
25
|
+
item: item,
|
|
26
|
+
isLast: isLast,
|
|
27
|
+
apiUrl: apiUrl,
|
|
28
|
+
displayCals: display_cals
|
|
29
|
+
});
|
|
22
30
|
};
|
|
23
31
|
export default CartUpsellItem;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { hasGroupsBelowMin, useBuilder } from '@open-tender/utils';
|
|
2
2
|
import { useAppDispatch, useAppSelector } from '../app/hooks';
|
|
3
|
-
import { addItemToCart, selectKioskApi, selectKioskConfig } from '../slices';
|
|
3
|
+
import { addItemToCart, selectKioskApi, selectKioskConfig, selectStoreSettings } from '../slices';
|
|
4
4
|
var UpsellItem = function (_a) {
|
|
5
5
|
var item = _a.item, callback = _a.callback, isLast = _a.isLast, children = _a.children;
|
|
6
6
|
var dispatch = useAppDispatch();
|
|
7
7
|
var apiUrl = useAppSelector(selectKioskApi);
|
|
8
8
|
var config = useAppSelector(selectKioskConfig).upsellItem;
|
|
9
|
+
var display_cals = useAppSelector(selectStoreSettings).display_cals;
|
|
9
10
|
var builtItem = useBuilder(item).item;
|
|
10
11
|
var quantity = builtItem.quantity, groups = builtItem.groups;
|
|
11
12
|
var groupsBelowMin = hasGroupsBelowMin(null, groups);
|
|
@@ -18,6 +19,13 @@ var UpsellItem = function (_a) {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
var handlers = { add: add };
|
|
21
|
-
return children({
|
|
22
|
+
return children({
|
|
23
|
+
config: config,
|
|
24
|
+
handlers: handlers,
|
|
25
|
+
item: item,
|
|
26
|
+
isLast: isLast,
|
|
27
|
+
apiUrl: apiUrl,
|
|
28
|
+
displayCals: display_cals
|
|
29
|
+
});
|
|
22
30
|
};
|
|
23
31
|
export default UpsellItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CheckoutTenderPos, CustomerIdentifier, CustomerIdentify, Discount, Money, Order,
|
|
1
|
+
import { CheckoutTenderPos, CustomerIdentifier, CustomerIdentify, Discount, Money, Order, OrderCreateDiscount, OrderCreateDiscounts, OrderCreateGiftCards, OrderCreatePoints, OrderCreatePos, OrderCreateSurcharge, OrderCreateSurcharges, OrderTender, RequestError, RequestStatus, Taxes } from '@open-tender/types';
|
|
2
2
|
import { AppState } from '../app';
|
|
3
3
|
import { OrderState } from './order';
|
|
4
4
|
export interface CheckoutState {
|
|
@@ -24,9 +24,6 @@ export interface CheckoutState {
|
|
|
24
24
|
tip: Money | null;
|
|
25
25
|
validating: RequestStatus;
|
|
26
26
|
}
|
|
27
|
-
interface OrderCreatePos extends Omit<OrderCreate, 'customer'> {
|
|
28
|
-
customer: CustomerIdentify | null;
|
|
29
|
-
}
|
|
30
27
|
export declare const prepareOrder: (order: OrderState, checkout: CheckoutState) => OrderCreatePos | null;
|
|
31
28
|
export declare enum CheckoutActionType {
|
|
32
29
|
AddPromoCode = "checkout/addPromoCode",
|
|
@@ -168,4 +165,3 @@ export declare const selectPosCheckSubtotal: (state: AppState) => `${number}.${n
|
|
|
168
165
|
export declare const selectPosCheckTotal: (state: AppState) => `${number}.${number}`;
|
|
169
166
|
export declare const selectPosCheckTenders: (state: AppState) => import("@open-tender/types").OrderTenders;
|
|
170
167
|
export declare const checkoutReducer: import("redux").Reducer<CheckoutState>;
|
|
171
|
-
export {};
|
|
@@ -35,7 +35,7 @@ var getAmountDue = function (check) {
|
|
|
35
35
|
return check && check.totals ? check.totals.amount_due : null;
|
|
36
36
|
};
|
|
37
37
|
export var prepareOrder = function (order, checkout) {
|
|
38
|
-
var order_uuid = order.orderId, requested_at = order.requestedAt, service_type = order.serviceType, order_type = order.orderType, revenue_center_id = order.revenueCenterId;
|
|
38
|
+
var order_uuid = order.orderId, requested_at = order.requestedAt, service_type = order.serviceType, order_type = order.orderType, revenue_center_id = order.revenueCenterId, prep_type = order.prepType;
|
|
39
39
|
if (!order_uuid)
|
|
40
40
|
return null;
|
|
41
41
|
var simpleCart = makeSimpleCart(order.cart);
|
|
@@ -43,33 +43,22 @@ export var prepareOrder = function (order, checkout) {
|
|
|
43
43
|
if (!revenue_center_id || !order_type || !service_type) {
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
|
-
var customer = checkout.customer,
|
|
47
|
-
// giftCards: gift_cards,
|
|
48
|
-
surcharges = checkout.surcharges, discounts = checkout.discounts, taxes = checkout.taxes, tip = checkout.tip,
|
|
49
|
-
// isTaxExempt,
|
|
50
|
-
points = checkout.points;
|
|
51
|
-
// const is_tax_exempt = isTaxExempt ? true : false
|
|
52
|
-
// const { customer_id, first_name, last_name, email, phone } =
|
|
53
|
-
// customer?.customer || {}
|
|
54
|
-
// const customerCreate = customer
|
|
55
|
-
// ? { customer_id, first_name, last_name, email, phone }
|
|
56
|
-
// : null
|
|
46
|
+
var customer = checkout.customer, surcharges = checkout.surcharges, discounts = checkout.discounts, taxes = checkout.taxes, tip = checkout.tip, points = checkout.points, made_for = checkout.madeFor, phone = checkout.phone;
|
|
57
47
|
return {
|
|
58
48
|
order_uuid: order_uuid,
|
|
59
49
|
revenue_center_id: revenue_center_id,
|
|
60
|
-
// order_type,
|
|
61
50
|
service_type: service_type,
|
|
62
51
|
requested_at: requested_at,
|
|
63
|
-
// customer: customerCreate,
|
|
64
52
|
customer: customer,
|
|
65
53
|
cart: cart,
|
|
66
|
-
// gift_cards,
|
|
67
54
|
surcharges: surcharges,
|
|
68
55
|
discounts: discounts,
|
|
69
56
|
taxes: taxes,
|
|
70
|
-
// is_tax_exempt,
|
|
71
57
|
tip: tip || '0.00',
|
|
72
|
-
points: points
|
|
58
|
+
points: points,
|
|
59
|
+
made_for: made_for,
|
|
60
|
+
phone: phone,
|
|
61
|
+
prep_type: prep_type
|
|
73
62
|
};
|
|
74
63
|
};
|
|
75
64
|
export var CheckoutActionType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.133",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types for use with Open Tender applications that utilize our in-store POS API",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@emotion/react": "^11.11.1",
|
|
64
|
-
"@open-tender/types": "^0.4.
|
|
65
|
-
"@open-tender/ui": "^0.3.
|
|
64
|
+
"@open-tender/types": "^0.4.65",
|
|
65
|
+
"@open-tender/ui": "^0.3.96",
|
|
66
66
|
"@open-tender/utils": "^0.4.39",
|
|
67
67
|
"@reduxjs/toolkit": "^2.0.1",
|
|
68
68
|
"date-fns": "2.30.0",
|