@open-tender/cloud 0.5.19 → 0.5.20
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.
|
@@ -46,6 +46,7 @@ const assembleOrder = (orderData, save = false) => {
|
|
|
46
46
|
const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip, token, kount_device_session_id } = form;
|
|
47
47
|
const { deposit = null } = check || {};
|
|
48
48
|
// const defaultTip = check ? getDefaultTip(check.config) : null
|
|
49
|
+
const hasTip = check === null || check === void 0 ? void 0 : check.config.gratuity.has_tip;
|
|
49
50
|
const fullAddress = Object.assign(Object.assign({}, order.address), address);
|
|
50
51
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
52
|
const { customer_id } = customer, customerWithoutId = tslib_1.__rest(customer, ["customer_id"]);
|
|
@@ -68,7 +69,7 @@ const assembleOrder = (orderData, save = false) => {
|
|
|
68
69
|
surcharges,
|
|
69
70
|
table,
|
|
70
71
|
tenders,
|
|
71
|
-
tip,
|
|
72
|
+
tip: hasTip ? tip : null,
|
|
72
73
|
save,
|
|
73
74
|
token,
|
|
74
75
|
kount_device_session_id
|
|
@@ -180,12 +181,14 @@ exports.submitOrder = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.SubmitO
|
|
|
180
181
|
}
|
|
181
182
|
}));
|
|
182
183
|
exports.updateForm = (0, toolkit_1.createAsyncThunk)(CheckoutActionType.UpdateForm, (payload, { getState }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
184
|
+
var _b;
|
|
183
185
|
const { checkout } = getState();
|
|
184
186
|
const errors = Object.assign({}, checkout.errors);
|
|
185
187
|
const { tenders } = payload;
|
|
188
|
+
const hasTip = (_b = checkout.check) === null || _b === void 0 ? void 0 : _b.config.gratuity.has_tip;
|
|
186
189
|
if (tenders)
|
|
187
190
|
delete errors.tenders;
|
|
188
|
-
const form = Object.assign(Object.assign({}, checkout.form), payload);
|
|
191
|
+
const form = Object.assign(Object.assign(Object.assign({}, checkout.form), payload), (!hasTip && { tip: null }));
|
|
189
192
|
return {
|
|
190
193
|
form,
|
|
191
194
|
errors
|
|
@@ -42,6 +42,7 @@ const assembleOrder = (orderData, save = false) => {
|
|
|
42
42
|
const { customer, address, details, surcharges, discounts, promoCodes, points, tenders, tip, token, kount_device_session_id } = form;
|
|
43
43
|
const { deposit = null } = check || {};
|
|
44
44
|
// const defaultTip = check ? getDefaultTip(check.config) : null
|
|
45
|
+
const hasTip = check === null || check === void 0 ? void 0 : check.config.gratuity.has_tip;
|
|
45
46
|
const fullAddress = Object.assign(Object.assign({}, order.address), address);
|
|
46
47
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
48
|
const { customer_id } = customer, customerWithoutId = __rest(customer, ["customer_id"]);
|
|
@@ -64,7 +65,7 @@ const assembleOrder = (orderData, save = false) => {
|
|
|
64
65
|
surcharges,
|
|
65
66
|
table,
|
|
66
67
|
tenders,
|
|
67
|
-
tip,
|
|
68
|
+
tip: hasTip ? tip : null,
|
|
68
69
|
save,
|
|
69
70
|
token,
|
|
70
71
|
kount_device_session_id
|
|
@@ -176,12 +177,14 @@ export const submitOrder = createAsyncThunk(CheckoutActionType.SubmitOrder, (arg
|
|
|
176
177
|
}
|
|
177
178
|
}));
|
|
178
179
|
export const updateForm = createAsyncThunk(CheckoutActionType.UpdateForm, (payload, { getState }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
+
var _a;
|
|
179
181
|
const { checkout } = getState();
|
|
180
182
|
const errors = Object.assign({}, checkout.errors);
|
|
181
183
|
const { tenders } = payload;
|
|
184
|
+
const hasTip = (_a = checkout.check) === null || _a === void 0 ? void 0 : _a.config.gratuity.has_tip;
|
|
182
185
|
if (tenders)
|
|
183
186
|
delete errors.tenders;
|
|
184
|
-
const form = Object.assign(Object.assign({}, checkout.form), payload);
|
|
187
|
+
const form = Object.assign(Object.assign(Object.assign({}, checkout.form), payload), (!hasTip && { tip: null }));
|
|
185
188
|
return {
|
|
186
189
|
form,
|
|
187
190
|
errors
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-tender/cloud",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.20",
|
|
4
4
|
"description": "A library of hooks, reducers, utility functions, and types 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",
|