ordering-ui-external 14.1.79 → 14.1.80
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/_bundles/{7.ordering-ui.a224863ef92737fa8b7e.js → 7.ordering-ui.d155a03b9a727f188284.js} +1 -1
- package/_bundles/ordering-ui.d155a03b9a727f188284.js +2 -0
- package/_modules/themes/five/src/components/Cart/index.js +6 -5
- package/_modules/themes/five/src/components/Checkout/index.js +13 -8
- package/_modules/themes/five/src/components/MultiCheckout/index.js +14 -13
- package/package.json +1 -1
- package/src/themes/five/src/components/Cart/index.js +2 -1
- package/src/themes/five/src/components/Checkout/index.js +8 -5
- package/src/themes/five/src/components/MultiCheckout/index.js +2 -1
- package/_bundles/ordering-ui.a224863ef92737fa8b7e.js +0 -2
- /package/_bundles/{0.ordering-ui.a224863ef92737fa8b7e.js → 0.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{1.ordering-ui.a224863ef92737fa8b7e.js → 1.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{2.ordering-ui.a224863ef92737fa8b7e.js → 2.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{4.ordering-ui.a224863ef92737fa8b7e.js → 4.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{5.ordering-ui.a224863ef92737fa8b7e.js → 5.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{6.ordering-ui.a224863ef92737fa8b7e.js → 6.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{7.ordering-ui.a224863ef92737fa8b7e.js.LICENSE.txt → 7.ordering-ui.d155a03b9a727f188284.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.a224863ef92737fa8b7e.js → 8.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{9.ordering-ui.a224863ef92737fa8b7e.js → 9.ordering-ui.d155a03b9a727f188284.js} +0 -0
- /package/_bundles/{ordering-ui.a224863ef92737fa8b7e.js.LICENSE.txt → ordering-ui.d155a03b9a727f188284.js.LICENSE.txt} +0 -0
|
@@ -44,7 +44,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
44
44
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
45
45
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
46
46
|
var CartUI = function CartUI(props) {
|
|
47
|
-
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _configs$checkout_mul, _orderState$carts, _props$cart, _validationFields$fie2, _theme$viewString, _validationFields$fie3, _theme$viewString2, _orderState$
|
|
47
|
+
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$driver_tip_a, _orderState$options, _validationFields$fie, _configs$checkout_mul, _orderState$carts, _props$cart, _validationFields$fie2, _theme$viewString, _validationFields$fie3, _theme$viewString2, _orderState$options2, _orderState$options3, _cart$metafields, _cart$metafields$find, _cart$metafields2, _cart$metafields2$fin, _cart$taxes, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers4, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes3, _cart$taxes4, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _orderState$options4, _cart$taxes5, _cart$taxes6, _cart$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _extraValueAdjustment, _orderState$options5, _validationFields$fie4, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _orderState$options6, _cart$business2, _cart$business3, _curProduct$calendar_, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
|
|
48
48
|
var currentCartUuid = props.currentCartUuid,
|
|
49
49
|
clearCart = props.clearCart,
|
|
50
50
|
isProducts = props.isProducts,
|
|
@@ -110,6 +110,7 @@ var CartUI = function CartUI(props) {
|
|
|
110
110
|
_useCustomer2 = _slicedToArray(_useCustomer, 1),
|
|
111
111
|
user = _useCustomer2[0].user;
|
|
112
112
|
var driverTipsOptions = typeof (configs === null || configs === void 0 || (_configs$driver_tip_o = configs.driver_tip_options) === null || _configs$driver_tip_o === void 0 ? void 0 : _configs$driver_tip_o.value) === 'string' ? JSON.parse(configs === null || configs === void 0 || (_configs$driver_tip_o2 = configs.driver_tip_options) === null || _configs$driver_tip_o2 === void 0 ? void 0 : _configs$driver_tip_o2.value) || [] : (configs === null || configs === void 0 || (_configs$driver_tip_o3 = configs.driver_tip_options) === null || _configs$driver_tip_o3 === void 0 ? void 0 : _configs$driver_tip_o3.value) || [];
|
|
113
|
+
var allowDriverTipPickup = (configs === null || configs === void 0 || (_configs$driver_tip_a = configs.driver_tip_allowed_at_pickup) === null || _configs$driver_tip_a === void 0 ? void 0 : _configs$driver_tip_a.value) === '1' && (orderState === null || orderState === void 0 || (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 2;
|
|
113
114
|
var _useState = (0, _react.useState)({
|
|
114
115
|
open: false,
|
|
115
116
|
content: null,
|
|
@@ -157,7 +158,7 @@ var CartUI = function CartUI(props) {
|
|
|
157
158
|
var viewString = isStore ? 'business_view' : 'header';
|
|
158
159
|
var hideCartComments = isCheckout ? hideCommentsByValidationCheckout : !(validationFields !== null && validationFields !== void 0 && (_validationFields$fie2 = validationFields.fields) !== null && _validationFields$fie2 !== void 0 && (_validationFields$fie2 = _validationFields$fie2.checkout) !== null && _validationFields$fie2 !== void 0 && (_validationFields$fie2 = _validationFields$fie2.comments) !== null && _validationFields$fie2 !== void 0 && _validationFields$fie2.enabled) || (theme === null || theme === void 0 || (_theme$viewString = theme[viewString]) === null || _theme$viewString === void 0 || (_theme$viewString = _theme$viewString.components) === null || _theme$viewString === void 0 || (_theme$viewString = _theme$viewString.cart) === null || _theme$viewString === void 0 || (_theme$viewString = _theme$viewString.components) === null || _theme$viewString === void 0 || (_theme$viewString = _theme$viewString.comments) === null || _theme$viewString === void 0 ? void 0 : _theme$viewString.hidden);
|
|
159
160
|
var hideCartDiscount = isCheckout ? hideCouponByValidationCheckout : !(validationFields !== null && validationFields !== void 0 && (_validationFields$fie3 = validationFields.fields) !== null && _validationFields$fie3 !== void 0 && (_validationFields$fie3 = _validationFields$fie3.checkout) !== null && _validationFields$fie3 !== void 0 && (_validationFields$fie3 = _validationFields$fie3.coupon) !== null && _validationFields$fie3 !== void 0 && _validationFields$fie3.enabled) || (theme === null || theme === void 0 || (_theme$viewString2 = theme[viewString]) === null || _theme$viewString2 === void 0 || (_theme$viewString2 = _theme$viewString2.components) === null || _theme$viewString2 === void 0 || (_theme$viewString2 = _theme$viewString2.cart) === null || _theme$viewString2 === void 0 || (_theme$viewString2 = _theme$viewString2.components) === null || _theme$viewString2 === void 0 || (_theme$viewString2 = _theme$viewString2.discount_coupon) === null || _theme$viewString2 === void 0 ? void 0 : _theme$viewString2.hidden);
|
|
160
|
-
var cateringTypeString = (orderState === null || orderState === void 0 || (_orderState$
|
|
161
|
+
var cateringTypeString = (orderState === null || orderState === void 0 || (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 7 ? 'catering_delivery' : (orderState === null || orderState === void 0 || (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 8 ? 'catering_pickup' : null;
|
|
161
162
|
var cateringValues = businessConfigs && (0, _utils.getCateringValues)(cateringTypeString, businessConfigs);
|
|
162
163
|
var extraValueAdjustment = cart === null || cart === void 0 || (_cart$metafields = cart.metafields) === null || _cart$metafields === void 0 || (_cart$metafields$find = _cart$metafields.find) === null || _cart$metafields$find === void 0 ? void 0 : _cart$metafields$find.call(_cart$metafields, function (meta) {
|
|
163
164
|
return (meta === null || meta === void 0 ? void 0 : meta.key) === 'extra_value_adjustment_amount';
|
|
@@ -491,7 +492,7 @@ var CartUI = function CartUI(props) {
|
|
|
491
492
|
return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
|
|
492
493
|
}
|
|
493
494
|
}))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 || (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
|
|
494
|
-
})), (orderState === null || orderState === void 0 || (_orderState$
|
|
495
|
+
})), (orderState === null || orderState === void 0 || (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : _orderState$options4.type) === 1 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE', 'Delivery Fee')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) + getIncludedTaxes(true)))), (cart === null || cart === void 0 ? void 0 : cart.extra_value_checkprice) && (cart === null || cart === void 0 ? void 0 : cart.extra_value_checkprice) > 0 && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('EXTRA_VALUE_CHECKPRICE', 'Extra value checkprice')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.extra_value_checkprice))), (cart === null || cart === void 0 || (_cart$taxes5 = cart.taxes) === null || _cart$taxes5 === void 0 ? void 0 : _cart$taxes5.length) > 0 && (cart === null || cart === void 0 || (_cart$taxes6 = cart.taxes) === null || _cart$taxes6 === void 0 ? void 0 : _cart$taxes6.filter(function (tax) {
|
|
495
496
|
return (tax === null || tax === void 0 ? void 0 : tax.type) === 2 && (tax === null || tax === void 0 ? void 0 : tax.rate) !== 0 && (tax === null || tax === void 0 ? void 0 : tax.target) === 'delivery_fee';
|
|
496
497
|
}).map(function (tax) {
|
|
497
498
|
var _ref4, _tax$summary$tax_afte3, _tax$summary6, _tax$summary7;
|
|
@@ -539,7 +540,7 @@ var CartUI = function CartUI(props) {
|
|
|
539
540
|
})), (cart === null || cart === void 0 ? void 0 : cart.driver_tip) > 0 && !hideDriverTip && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DRIVER_TIP', 'Driver tip'), ' ', (cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate) > 0 && parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 || (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate, parseNumber), "%)"))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))), extraValueAdjustment && !!parseFloat(extraValueAdjustment === null || extraValueAdjustment === void 0 ? void 0 : extraValueAdjustment.value) && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, pulseCouponName ? pulseCouponName === null || pulseCouponName === void 0 ? void 0 : pulseCouponName.value : t(extraValueAdjustment === null || extraValueAdjustment === void 0 || (_extraValueAdjustment = extraValueAdjustment.key) === null || _extraValueAdjustment === void 0 ? void 0 : _extraValueAdjustment.toUpperCase(), extraValueAdjustment === null || extraValueAdjustment === void 0 ? void 0 : extraValueAdjustment.key), ' '), /*#__PURE__*/_react.default.createElement("td", null, parseFloat(extraValueAdjustment === null || extraValueAdjustment === void 0 ? void 0 : extraValueAdjustment.value) > 0 ? parsePrice(parseFloat(extraValueAdjustment === null || extraValueAdjustment === void 0 ? void 0 : extraValueAdjustment.value)) : "- ".concat(parsePrice(parseFloat(extraValueAdjustment === null || extraValueAdjustment === void 0 ? void 0 : extraValueAdjustment.value) * -1)))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && !hideCouponInput && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
|
|
540
541
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
541
542
|
price: cart === null || cart === void 0 ? void 0 : cart.total
|
|
542
|
-
})), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 || (_orderState$
|
|
543
|
+
})), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && ((orderState === null || orderState === void 0 || (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) === 1 || allowDriverTipPickup) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 || (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.checkout) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.driver_tip) === null || _validationFields$fie4 === void 0 ? void 0 : _validationFields$fie4.enabled) && driverTipsOptions.length > 0 && !useKioskApp && !isCheckout && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
543
544
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
544
545
|
driverTipsOptions: driverTipsOptions,
|
|
545
546
|
isFixedPrice: parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t2 = configs.driver_tip_type) === null || _configs$driver_tip_t2 === void 0 ? void 0 : _configs$driver_tip_t2.value, 10) === 1,
|
|
@@ -598,7 +599,7 @@ var CartUI = function CartUI(props) {
|
|
|
598
599
|
style: {
|
|
599
600
|
fontWeight: 'bold'
|
|
600
601
|
}
|
|
601
|
-
}, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 || (_orderState$
|
|
602
|
+
}, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 || (_orderState$options6 = orderState.options) === null || _orderState$options6 === void 0 ? void 0 : _orderState$options6.type) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_MomentContent.MomentContent, _extends({
|
|
602
603
|
cateringPreorder: true,
|
|
603
604
|
isCart: true,
|
|
604
605
|
business: cart === null || cart === void 0 ? void 0 : cart.business
|
|
@@ -64,8 +64,9 @@ var mapConfigs = {
|
|
|
64
64
|
height: 190
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
+
var driverTipsTypes = [1, 2];
|
|
67
68
|
var CheckoutUI = function CheckoutUI(props) {
|
|
68
|
-
var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _theme$header, _theme$colors, _theme$colors$split, _cart$comment, _cart$offers, _paymethodSelected$da, _paymethodSelected$da2, _cardList$cards, _cartState$cart, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _theme$checkout, _theme$checkout2, _theme$checkout3, _theme$checkout4, _loyaltyPlansState$re, _creditPointPlan$busi, _cart$business2, _businessDetails$busi3, _theme$images, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values2, _businessDetails$busi4, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$busi9, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi10, _businessDetails$busi11, _businessDetails$busi12, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _ref2, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _customerState$user3, _theme$colors2, _options$address;
|
|
69
|
+
var _ordering$project, _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _theme$header, _theme$colors, _theme$colors$split, _configs$driver_tip_a, _cart$comment, _cart$offers, _paymethodSelected$da, _paymethodSelected$da2, _cardList$cards, _cartState$cart, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _theme$checkout, _theme$checkout2, _theme$checkout3, _theme$checkout4, _loyaltyPlansState$re, _creditPointPlan$busi, _cart$business2, _businessDetails$busi3, _theme$images, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values2, _businessDetails$busi4, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$busi9, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi10, _businessDetails$busi11, _businessDetails$busi12, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business3, _cart$products2, _ref2, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _customerState$user3, _theme$colors2, _options$address;
|
|
69
70
|
var cart = props.cart,
|
|
70
71
|
errors = props.errors,
|
|
71
72
|
placing = props.placing,
|
|
@@ -91,6 +92,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
91
92
|
alseaCheckPriceError = props.alseaCheckPriceError,
|
|
92
93
|
isLoadingCheckprice = props.isLoadingCheckprice;
|
|
93
94
|
var theme = (0, _styledComponents.useTheme)();
|
|
95
|
+
var _useApi = (0, _orderingComponentsExternal.useApi)(),
|
|
96
|
+
_useApi2 = _slicedToArray(_useApi, 1),
|
|
97
|
+
ordering = _useApi2[0];
|
|
94
98
|
var _useOrder = (0, _orderingComponentsExternal.useOrder)(),
|
|
95
99
|
_useOrder2 = _slicedToArray(_useOrder, 1),
|
|
96
100
|
_useOrder2$ = _useOrder2[0],
|
|
@@ -178,7 +182,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
178
182
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
179
183
|
productLoading = _useState26[0],
|
|
180
184
|
setProductLoading = _useState26[1];
|
|
181
|
-
var shouldActivateOrderDetailModal =
|
|
185
|
+
var shouldActivateOrderDetailModal = ordering === null || ordering === void 0 || (_ordering$project = ordering.project) === null || _ordering$project === void 0 ? void 0 : _ordering$project.includes('alsea');
|
|
182
186
|
var orderTypeList = [t('DELIVERY', 'Delivery'), t('PICKUP', 'Pickup'), t('EAT_IN', 'Eat in'), t('CURBSIDE', 'Curbside'), t('DRIVE_THRU', 'Drive thru')];
|
|
183
187
|
var cardsMethods = ['stripe', 'credomatic'];
|
|
184
188
|
var stripePaymethods = ['stripe', 'stripe_connect', 'stripe_redirect'];
|
|
@@ -207,7 +211,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
207
211
|
var guestCheckoutDriveTip = (0, _react.useMemo)(function () {
|
|
208
212
|
return checkoutFields === null || checkoutFields === void 0 ? void 0 : checkoutFields.find(function (field) {
|
|
209
213
|
var _field$validation_fie;
|
|
210
|
-
return field.order_type_id
|
|
214
|
+
return driverTipsTypes.includes(field.order_type_id) && (field === null || field === void 0 || (_field$validation_fie = field.validation_field) === null || _field$validation_fie === void 0 ? void 0 : _field$validation_fie.code) === 'driver_tip';
|
|
211
215
|
});
|
|
212
216
|
}, [JSON.stringify(checkoutFields), options]);
|
|
213
217
|
var guestCheckoutComment = (0, _react.useMemo)(function () {
|
|
@@ -230,8 +234,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
230
234
|
}, [JSON.stringify(checkoutFields), options]);
|
|
231
235
|
|
|
232
236
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
237
|
+
var allowDriverTipPickup = (configs === null || configs === void 0 || (_configs$driver_tip_a = configs.driver_tip_allowed_at_pickup) === null || _configs$driver_tip_a === void 0 ? void 0 : _configs$driver_tip_a.value) === '1' && (options === null || options === void 0 ? void 0 : options.type) === 2;
|
|
233
238
|
var validateCommentsCartField = (guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.enabled) && (user !== null && user !== void 0 && user.guest_id ? guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.required_with_guest : guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.required) && ((cart === null || cart === void 0 ? void 0 : cart.comment) === null || (cart === null || cart === void 0 || (_cart$comment = cart.comment) === null || _cart$comment === void 0 ? void 0 : _cart$comment.trim().length) === 0);
|
|
234
|
-
var validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled) && (user !== null && user !== void 0 && user.guest_id ? guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required_with_guest : guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0;
|
|
239
|
+
var validateDriverTipField = (options.type === 1 || allowDriverTipPickup) && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled) && (user !== null && user !== void 0 && user.guest_id ? guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required_with_guest : guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0;
|
|
235
240
|
var validateCouponField = (guestCheckoutCoupon === null || guestCheckoutCoupon === void 0 ? void 0 : guestCheckoutCoupon.enabled) && (user !== null && user !== void 0 && user.guest_id ? guestCheckoutCoupon === null || guestCheckoutCoupon === void 0 ? void 0 : guestCheckoutCoupon.required_with_guest : guestCheckoutCoupon === null || guestCheckoutCoupon === void 0 ? void 0 : guestCheckoutCoupon.required) && !(cart !== null && cart !== void 0 && (_cart$offers = cart.offers) !== null && _cart$offers !== void 0 && _cart$offers.some(function (offer) {
|
|
236
241
|
return (offer === null || offer === void 0 ? void 0 : offer.type) === 2;
|
|
237
242
|
}));
|
|
@@ -253,7 +258,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
253
258
|
var hideBusinessDetails = theme === null || theme === void 0 || (_theme$checkout2 = theme.checkout) === null || _theme$checkout2 === void 0 || (_theme$checkout2 = _theme$checkout2.components) === null || _theme$checkout2 === void 0 || (_theme$checkout2 = _theme$checkout2.business) === null || _theme$checkout2 === void 0 ? void 0 : _theme$checkout2.hidden;
|
|
254
259
|
var hideBusinessMap = theme === null || theme === void 0 || (_theme$checkout3 = theme.checkout) === null || _theme$checkout3 === void 0 || (_theme$checkout3 = _theme$checkout3.components) === null || _theme$checkout3 === void 0 || (_theme$checkout3 = _theme$checkout3.map) === null || _theme$checkout3 === void 0 ? void 0 : _theme$checkout3.hidden;
|
|
255
260
|
var hideCustomerDetails = theme === null || theme === void 0 || (_theme$checkout4 = theme.checkout) === null || _theme$checkout4 === void 0 || (_theme$checkout4 = _theme$checkout4.components) === null || _theme$checkout4 === void 0 || (_theme$checkout4 = _theme$checkout4.customer) === null || _theme$checkout4 === void 0 ? void 0 : _theme$checkout4.hidden;
|
|
256
|
-
var driverTipsField = !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && options.type === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 &&
|
|
261
|
+
var driverTipsField = !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (options.type === 1 || allowDriverTipPickup) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && driverTipsOptions.length > 0 && !useKioskApp;
|
|
257
262
|
var creditPointPlan = loyaltyPlansState === null || loyaltyPlansState === void 0 || (_loyaltyPlansState$re = loyaltyPlansState.result) === null || _loyaltyPlansState$re === void 0 ? void 0 : _loyaltyPlansState$re.find(function (loyal) {
|
|
258
263
|
return loyal.type === 'credit_point';
|
|
259
264
|
});
|
|
@@ -805,9 +810,9 @@ var Checkout = exports.Checkout = function Checkout(props) {
|
|
|
805
810
|
var _useSession3 = (0, _orderingComponentsExternal.useSession)(),
|
|
806
811
|
_useSession4 = _slicedToArray(_useSession3, 1),
|
|
807
812
|
token = _useSession4[0].token;
|
|
808
|
-
var
|
|
809
|
-
|
|
810
|
-
ordering =
|
|
813
|
+
var _useApi3 = (0, _orderingComponentsExternal.useApi)(),
|
|
814
|
+
_useApi4 = _slicedToArray(_useApi3, 1),
|
|
815
|
+
ordering = _useApi4[0];
|
|
811
816
|
var _useLanguage3 = (0, _orderingComponentsExternal.useLanguage)(),
|
|
812
817
|
_useLanguage4 = _slicedToArray(_useLanguage3, 2),
|
|
813
818
|
t = _useLanguage4[1];
|
|
@@ -46,7 +46,7 @@ var mapConfigs = {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
49
|
-
var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _cartGroup$result2, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _loyaltyPlansState$re2, _creditPointGeneralPl, _creditPointGeneralPl2, _configs$cash_wallet, _configs$wallet_enabl, _configs$wallet_cash_, _configs$wallet_credi, _theme$colors, _theme$colors$split, _orderState$
|
|
49
|
+
var _Object$values, _cartGroup$result, _paymethodSelected$pa, _cardList$cards, _configs$checkout_mul, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _configs$multi_busine, _configs$driver_tip_o4, _configs$driver_tip_o5, _configs$driver_tip_a, _orderState$options, _cartGroup$result2, _loyaltyPlansState$re, _creditPointPlan$busi, _creditPointPlan$busi2, _loyaltyPlansState$re2, _creditPointGeneralPl, _creditPointGeneralPl2, _configs$cash_wallet, _configs$wallet_enabl, _configs$wallet_cash_, _configs$wallet_credi, _theme$colors, _theme$colors$split, _orderState$options7, _configs$google_maps_, _customerState$user, _cartGroup$result3, _cartGroup$result4, _validationFields$fie, _configs$multi_busine2, _orderState$options8, _validationFields$fie2, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _openCarts$, _configs$multi_busine6, _configs$multi_busine7, _customerState$user2;
|
|
50
50
|
var placing = props.placing,
|
|
51
51
|
isCustomerMode = props.isCustomerMode,
|
|
52
52
|
openCarts = props.openCarts,
|
|
@@ -148,6 +148,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
148
148
|
var isMultiDriverTips = (configs === null || configs === void 0 || (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
|
|
149
149
|
var driverTipsOptions = typeof (configs === null || configs === void 0 || (_configs$driver_tip_o = configs.driver_tip_options) === null || _configs$driver_tip_o === void 0 ? void 0 : _configs$driver_tip_o.value) === 'string' ? JSON.parse(configs === null || configs === void 0 || (_configs$driver_tip_o2 = configs.driver_tip_options) === null || _configs$driver_tip_o2 === void 0 ? void 0 : _configs$driver_tip_o2.value) || [] : (configs === null || configs === void 0 || (_configs$driver_tip_o3 = configs.driver_tip_options) === null || _configs$driver_tip_o3 === void 0 ? void 0 : _configs$driver_tip_o3.value) || [];
|
|
150
150
|
var totalFeeEnabled = (configs === null || configs === void 0 || (_configs$multi_busine = configs.multi_business_checkout_show_combined_delivery_fee) === null || _configs$multi_busine === void 0 ? void 0 : _configs$multi_busine.value) === '1' ? JSON.parse(configs === null || configs === void 0 || (_configs$driver_tip_o4 = configs.driver_tip_options) === null || _configs$driver_tip_o4 === void 0 ? void 0 : _configs$driver_tip_o4.value) || [] : (configs === null || configs === void 0 || (_configs$driver_tip_o5 = configs.driver_tip_options) === null || _configs$driver_tip_o5 === void 0 ? void 0 : _configs$driver_tip_o5.value) || [];
|
|
151
|
+
var allowDriverTipPickup = (configs === null || configs === void 0 || (_configs$driver_tip_a = configs.driver_tip_allowed_at_pickup) === null || _configs$driver_tip_a === void 0 ? void 0 : _configs$driver_tip_a.value) === '1' && (orderState === null || orderState === void 0 || (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 2;
|
|
151
152
|
var totalCartsPrice = cartGroup === null || cartGroup === void 0 || (_cartGroup$result2 = cartGroup.result) === null || _cartGroup$result2 === void 0 ? void 0 : _cartGroup$result2.balance;
|
|
152
153
|
var methodsPay = ['global_google_pay', 'global_apple_pay'];
|
|
153
154
|
var stripePaymethods = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect'];
|
|
@@ -175,8 +176,8 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
175
176
|
var checkoutFields = (0, _react.useMemo)(function () {
|
|
176
177
|
var _checkoutFieldsState$;
|
|
177
178
|
return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$ = checkoutFieldsState.fields) === null || _checkoutFieldsState$ === void 0 ? void 0 : _checkoutFieldsState$.filter(function (field) {
|
|
178
|
-
var _orderState$
|
|
179
|
-
return field.order_type_id === (orderState === null || orderState === void 0 || (_orderState$
|
|
179
|
+
var _orderState$options2;
|
|
180
|
+
return field.order_type_id === (orderState === null || orderState === void 0 || (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type);
|
|
180
181
|
});
|
|
181
182
|
}, [checkoutFieldsState, orderState === null || orderState === void 0 ? void 0 : orderState.options]);
|
|
182
183
|
var hexTest = /[0-9A-Fa-f]{6}/g;
|
|
@@ -245,16 +246,16 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
245
246
|
var _checkoutFieldsState$2, _configs$verification;
|
|
246
247
|
var userSelected = isCustomerMode ? customerState.user : user;
|
|
247
248
|
var _requiredFields = checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields.filter(function (field) {
|
|
248
|
-
var _orderState$
|
|
249
|
-
return (field === null || field === void 0 ? void 0 : field.order_type_id) === (orderState === null || orderState === void 0 || (_orderState$
|
|
249
|
+
var _orderState$options3, _field$validation_fie, _field$validation_fie2;
|
|
250
|
+
return (field === null || field === void 0 ? void 0 : field.order_type_id) === (orderState === null || orderState === void 0 || (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) && (field === null || field === void 0 ? void 0 : field.enabled) && (field === null || field === void 0 ? void 0 : field.required_with_guest) && !notFields.includes(field === null || field === void 0 || (_field$validation_fie = field.validation_field) === null || _field$validation_fie === void 0 ? void 0 : _field$validation_fie.code) && userSelected && !userSelected[field === null || field === void 0 || (_field$validation_fie2 = field.validation_field) === null || _field$validation_fie2 === void 0 ? void 0 : _field$validation_fie2.code];
|
|
250
251
|
});
|
|
251
252
|
var requiredFieldsCode = _requiredFields.map(function (item) {
|
|
252
253
|
var _item$validation_fiel;
|
|
253
254
|
return item === null || item === void 0 || (_item$validation_fiel = item.validation_field) === null || _item$validation_fiel === void 0 ? void 0 : _item$validation_fiel.code;
|
|
254
255
|
});
|
|
255
256
|
var guestCheckoutCellPhone = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$2 = checkoutFieldsState.fields) === null || _checkoutFieldsState$2 === void 0 ? void 0 : _checkoutFieldsState$2.find(function (field) {
|
|
256
|
-
var _orderState$
|
|
257
|
-
return field.order_type_id === (orderState === null || orderState === void 0 || (_orderState$
|
|
257
|
+
var _orderState$options4, _field$validation_fie3;
|
|
258
|
+
return field.order_type_id === (orderState === null || orderState === void 0 || (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : _orderState$options4.type) && (field === null || field === void 0 || (_field$validation_fie3 = field.validation_field) === null || _field$validation_fie3 === void 0 ? void 0 : _field$validation_fie3.code) === 'mobile_phone';
|
|
258
259
|
});
|
|
259
260
|
if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.enabled && guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.required_with_guest || (configs === null || configs === void 0 || (_configs$verification = configs.verification_phone_required) === null || _configs$verification === void 0 ? void 0 : _configs$verification.value) === '1')) {
|
|
260
261
|
requiredFieldsCode.push('cellphone');
|
|
@@ -268,8 +269,8 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
268
269
|
var userSelected = isCustomerMode ? customerState.user : user;
|
|
269
270
|
var _requiredFields = [];
|
|
270
271
|
Object.values(checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields).map(function (field) {
|
|
271
|
-
var _orderState$
|
|
272
|
-
if (((_orderState$
|
|
272
|
+
var _orderState$options5, _field$validation_fie4;
|
|
273
|
+
if (((_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) === (field === null || field === void 0 ? void 0 : field.order_type_id) && field !== null && field !== void 0 && field.enabled && field !== null && field !== void 0 && field.required && !notFields.includes(field === null || field === void 0 || (_field$validation_fie4 = field.validation_field) === null || _field$validation_fie4 === void 0 ? void 0 : _field$validation_fie4.code)) {
|
|
273
274
|
var _field$validation_fie5;
|
|
274
275
|
if (userSelected && !userSelected[field === null || field === void 0 || (_field$validation_fie5 = field.validation_field) === null || _field$validation_fie5 === void 0 ? void 0 : _field$validation_fie5.code]) {
|
|
275
276
|
var _field$validation_fie6;
|
|
@@ -278,8 +279,8 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
278
279
|
}
|
|
279
280
|
});
|
|
280
281
|
var mobilePhoneField = (_Object$values2 = Object.values(checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.find(function (field) {
|
|
281
|
-
var _orderState$
|
|
282
|
-
return (field === null || field === void 0 ? void 0 : field.order_type_id) === (orderState === null || orderState === void 0 || (_orderState$
|
|
282
|
+
var _orderState$options6, _field$validation_fie7;
|
|
283
|
+
return (field === null || field === void 0 ? void 0 : field.order_type_id) === (orderState === null || orderState === void 0 || (_orderState$options6 = orderState.options) === null || _orderState$options6 === void 0 ? void 0 : _orderState$options6.type) && (field === null || field === void 0 || (_field$validation_fie7 = field.validation_field) === null || _field$validation_fie7 === void 0 ? void 0 : _field$validation_fie7.code) === 'mobile_phone';
|
|
283
284
|
});
|
|
284
285
|
if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (mobilePhoneField !== null && mobilePhoneField !== void 0 && mobilePhoneField.enabled && mobilePhoneField !== null && mobilePhoneField !== void 0 && mobilePhoneField.required || (configs === null || configs === void 0 || (_configs$verification2 = configs.verification_phone_required) === null || _configs$verification2 === void 0 ? void 0 : _configs$verification2.value) === '1')) {
|
|
285
286
|
_requiredFields.push('cellphone');
|
|
@@ -323,7 +324,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
323
324
|
} else {
|
|
324
325
|
checkValidationFields();
|
|
325
326
|
}
|
|
326
|
-
}, [checkoutFieldsState, user, customerState, orderState === null || orderState === void 0 || (_orderState$
|
|
327
|
+
}, [checkoutFieldsState, user, customerState, orderState === null || orderState === void 0 || (_orderState$options7 = orderState.options) === null || _orderState$options7 === void 0 ? void 0 : _orderState$options7.type]);
|
|
327
328
|
(0, _react.useEffect)(function () {
|
|
328
329
|
if (openCarts.length || cartGroup.loading) {
|
|
329
330
|
if (openCarts.length === 1) {
|
|
@@ -431,7 +432,7 @@ var MultiCheckoutUI = function MultiCheckoutUI(props) {
|
|
|
431
432
|
price: openCarts.reduce(function (total, cart) {
|
|
432
433
|
return total + cart.total;
|
|
433
434
|
}, 0)
|
|
434
|
-
}))), isMultiDriverTips && (orderState === null || orderState === void 0 ? void 0 :
|
|
435
|
+
}))), isMultiDriverTips && ((orderState === null || orderState === void 0 || (_orderState$options8 = orderState.options) === null || _orderState$options8 === void 0 ? void 0 : _orderState$options8.type) === 1 || allowDriverTipPickup) && (validationFields === null || validationFields === void 0 || (_validationFields$fie2 = validationFields.fields) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.checkout) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.driver_tip) === null || _validationFields$fie2 === void 0 ? void 0 : _validationFields$fie2.enabled) && openCarts.every(function (cart) {
|
|
435
436
|
return cart.business_id && cart.status !== 2;
|
|
436
437
|
}) && driverTipsOptions.length > 0 && /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
437
438
|
isMulti: true,
|
package/package.json
CHANGED
|
@@ -98,6 +98,7 @@ const CartUI = (props) => {
|
|
|
98
98
|
const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
|
|
99
99
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
100
100
|
: configs?.driver_tip_options?.value || []
|
|
101
|
+
const allowDriverTipPickup = configs?.driver_tip_allowed_at_pickup?.value === '1' && orderState?.options?.type === 2
|
|
101
102
|
|
|
102
103
|
const [confirm, setConfirm] = useState({ open: false, content: null, handleOnAccept: null })
|
|
103
104
|
const [openProduct, setModalIsOpen] = useState(false)
|
|
@@ -538,7 +539,7 @@ const CartUI = (props) => {
|
|
|
538
539
|
!isMultiCheckout &&
|
|
539
540
|
cart &&
|
|
540
541
|
cart?.business_id &&
|
|
541
|
-
orderState?.options?.type === 1 &&
|
|
542
|
+
(orderState?.options?.type === 1 || allowDriverTipPickup) &&
|
|
542
543
|
cart?.status !== 2 &&
|
|
543
544
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
544
545
|
driverTipsOptions.length > 0 &&
|
|
@@ -80,6 +80,8 @@ const mapConfigs = {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
const driverTipsTypes = [1, 2]
|
|
84
|
+
|
|
83
85
|
const CheckoutUI = (props) => {
|
|
84
86
|
const {
|
|
85
87
|
cart,
|
|
@@ -109,6 +111,7 @@ const CheckoutUI = (props) => {
|
|
|
109
111
|
} = props
|
|
110
112
|
|
|
111
113
|
const theme = useTheme()
|
|
114
|
+
const [ordering] = useApi()
|
|
112
115
|
const [{ options, loading }] = useOrder()
|
|
113
116
|
const [, t] = useLanguage()
|
|
114
117
|
const [{ parsePrice }] = useUtils()
|
|
@@ -134,7 +137,7 @@ const CheckoutUI = (props) => {
|
|
|
134
137
|
const [paymethodClicked, setPaymethodClicked] = useState(null)
|
|
135
138
|
const [productLoading, setProductLoading] = useState(false)
|
|
136
139
|
|
|
137
|
-
const shouldActivateOrderDetailModal =
|
|
140
|
+
const shouldActivateOrderDetailModal = ordering?.project?.includes('alsea')
|
|
138
141
|
const orderTypeList = [t('DELIVERY', 'Delivery'), t('PICKUP', 'Pickup'), t('EAT_IN', 'Eat in'), t('CURBSIDE', 'Curbside'), t('DRIVE_THRU', 'Drive thru')]
|
|
139
142
|
const cardsMethods = ['stripe', 'credomatic']
|
|
140
143
|
const stripePaymethods = ['stripe', 'stripe_connect', 'stripe_redirect']
|
|
@@ -152,14 +155,15 @@ const CheckoutUI = (props) => {
|
|
|
152
155
|
const placeSpotsEnabled = placeSpotTypes.includes(options?.type) && !useKioskApp
|
|
153
156
|
const isGiftCardCart = !cart?.business_id
|
|
154
157
|
const checkoutFields = useMemo(() => checkoutFieldsState?.fields?.filter(field => field.order_type_id === options?.type), [checkoutFieldsState, options])
|
|
155
|
-
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find(field => field.order_type_id
|
|
158
|
+
const guestCheckoutDriveTip = useMemo(() => checkoutFields?.find(field => driverTipsTypes.includes(field.order_type_id) && field?.validation_field?.code === 'driver_tip'), [JSON.stringify(checkoutFields), options])
|
|
156
159
|
const guestCheckoutComment = useMemo(() => checkoutFields?.find(field => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [JSON.stringify(checkoutFields), options])
|
|
157
160
|
const guestCheckoutCoupon = useMemo(() => checkoutFields?.find(field => field.order_type_id === options?.type && field?.validation_field?.code === 'coupon'), [JSON.stringify(checkoutFields), options])
|
|
158
161
|
const guestCheckoutZipcode = useMemo(() => checkoutFields?.find(field => field.order_type_id === options?.type && field?.validation_field?.code === 'zipcode'), [JSON.stringify(checkoutFields), options])
|
|
159
162
|
|
|
160
163
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
164
|
+
const allowDriverTipPickup = configs?.driver_tip_allowed_at_pickup?.value === '1' && options?.type === 2
|
|
161
165
|
const validateCommentsCartField = (guestCheckoutComment?.enabled && (user?.guest_id ? guestCheckoutComment?.required_with_guest : guestCheckoutComment?.required)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
|
|
162
|
-
const validateDriverTipField = options.type === 1 && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
166
|
+
const validateDriverTipField = (options.type === 1 || allowDriverTipPickup) && (guestCheckoutDriveTip?.enabled && (user?.guest_id ? guestCheckoutDriveTip?.required_with_guest : guestCheckoutDriveTip?.required)) && (Number(cart?.driver_tip) <= 0)
|
|
163
167
|
const validateCouponField = (guestCheckoutCoupon?.enabled && (user?.guest_id ? guestCheckoutCoupon?.required_with_guest : guestCheckoutCoupon?.required)) && !cart?.offers?.some(offer => offer?.type === 2)
|
|
164
168
|
const validateZipcodeCard = (guestCheckoutZipcode?.enabled && (user?.guest_id ? guestCheckoutZipcode?.required_with_guest : guestCheckoutZipcode?.required)) && paymethodSelected?.gateway === 'stripe' && paymethodSelected?.data?.card && !paymethodSelected?.data?.card?.zipcode
|
|
165
169
|
|
|
@@ -194,8 +198,7 @@ const CheckoutUI = (props) => {
|
|
|
194
198
|
const hideBusinessDetails = theme?.checkout?.components?.business?.hidden
|
|
195
199
|
const hideBusinessMap = theme?.checkout?.components?.map?.hidden
|
|
196
200
|
const hideCustomerDetails = theme?.checkout?.components?.customer?.hidden
|
|
197
|
-
const driverTipsField = !cartState.loading && cart && cart?.business_id && options.type === 1 && cart?.status !== 2 &&
|
|
198
|
-
|
|
201
|
+
const driverTipsField = !cartState.loading && cart && cart?.business_id && (options.type === 1 || allowDriverTipPickup) && cart?.status !== 2 && driverTipsOptions.length > 0 && !useKioskApp
|
|
199
202
|
const creditPointPlan = loyaltyPlansState?.result?.find(loyal => loyal.type === 'credit_point')
|
|
200
203
|
const creditPointPlanOnBusiness = creditPointPlan?.businesses?.find(b => b.business_id === cart?.business_id && b.accumulates)
|
|
201
204
|
|
|
@@ -112,6 +112,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
112
112
|
const totalFeeEnabled = configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'
|
|
113
113
|
? JSON.parse(configs?.driver_tip_options?.value) || []
|
|
114
114
|
: configs?.driver_tip_options?.value || []
|
|
115
|
+
const allowDriverTipPickup = configs?.driver_tip_allowed_at_pickup?.value === '1' && orderState?.options?.type === 2
|
|
115
116
|
|
|
116
117
|
const totalCartsPrice = cartGroup?.result?.balance
|
|
117
118
|
const methodsPay = ['global_google_pay', 'global_apple_pay']
|
|
@@ -391,7 +392,7 @@ const MultiCheckoutUI = (props) => {
|
|
|
391
392
|
|
|
392
393
|
{
|
|
393
394
|
isMultiDriverTips &&
|
|
394
|
-
orderState?.options
|
|
395
|
+
(orderState?.options?.type === 1 || allowDriverTipPickup) &&
|
|
395
396
|
validationFields?.fields?.checkout?.driver_tip?.enabled &&
|
|
396
397
|
openCarts.every(cart => cart.business_id && cart.status !== 2) &&
|
|
397
398
|
driverTipsOptions.length > 0 &&
|