ordering-ui-external 11.0.11 → 12.0.0

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.
Files changed (29) hide show
  1. package/_bundles/{0.ordering-ui.f6ab4fd53f85792a6e5f.js → 0.ordering-ui.6487547c80bb5fd2fdee.js} +1 -1
  2. package/_bundles/{7.ordering-ui.f6ab4fd53f85792a6e5f.js → 7.ordering-ui.6487547c80bb5fd2fdee.js} +1 -1
  3. package/_bundles/{ordering-ui.f6ab4fd53f85792a6e5f.js → ordering-ui.6487547c80bb5fd2fdee.js} +2 -2
  4. package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersTable/styles.js +1 -1
  5. package/_modules/themes/five/src/components/BusinessController/styles.js +2 -2
  6. package/_modules/themes/five/src/components/Cart/index.js +7 -7
  7. package/_modules/themes/five/src/components/Checkout/index.js +108 -87
  8. package/_modules/themes/five/src/components/MultiCheckout/index.js +65 -20
  9. package/_modules/themes/five/src/components/UserDetails/index.js +2 -2
  10. package/_modules/themes/five/src/components/UserFormDetails/index.js +59 -49
  11. package/_modules/utils/index.js +4 -3
  12. package/package.json +2 -2
  13. package/src/themes/callcenterOriginal/src/components/Orders/OrdersTable/styles.js +1 -1
  14. package/src/themes/five/src/components/BusinessController/styles.js +4 -4
  15. package/src/themes/five/src/components/Cart/index.js +6 -6
  16. package/src/themes/five/src/components/Checkout/index.js +75 -66
  17. package/src/themes/five/src/components/MultiCheckout/index.js +53 -21
  18. package/src/themes/five/src/components/UserDetails/index.js +2 -2
  19. package/src/themes/five/src/components/UserFormDetails/index.js +75 -66
  20. package/src/utils/index.js +3 -3
  21. /package/_bundles/{1.ordering-ui.f6ab4fd53f85792a6e5f.js → 1.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  22. /package/_bundles/{2.ordering-ui.f6ab4fd53f85792a6e5f.js → 2.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  23. /package/_bundles/{4.ordering-ui.f6ab4fd53f85792a6e5f.js → 4.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  24. /package/_bundles/{5.ordering-ui.f6ab4fd53f85792a6e5f.js → 5.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  25. /package/_bundles/{6.ordering-ui.f6ab4fd53f85792a6e5f.js → 6.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  26. /package/_bundles/{7.ordering-ui.f6ab4fd53f85792a6e5f.js.LICENSE.txt → 7.ordering-ui.6487547c80bb5fd2fdee.js.LICENSE.txt} +0 -0
  27. /package/_bundles/{8.ordering-ui.f6ab4fd53f85792a6e5f.js → 8.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  28. /package/_bundles/{9.ordering-ui.f6ab4fd53f85792a6e5f.js → 9.ordering-ui.6487547c80bb5fd2fdee.js} +0 -0
  29. /package/_bundles/{ordering-ui.f6ab4fd53f85792a6e5f.js.LICENSE.txt → ordering-ui.6487547c80bb5fd2fdee.js.LICENSE.txt} +0 -0
@@ -168,7 +168,7 @@ var Timestatus = exports.Timestatus = _styledComponents.default.div(_templateObj
168
168
  var timeState = _ref18.timeState;
169
169
  return timeState === 'delayed' && (0, _styledComponents.css)(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n background-color: #E63757;\n "])));
170
170
  });
171
- var Timer = exports.Timer = _styledComponents.default.div(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n min-width: 65px;\n p {\n margin: 0px;\n color: ", ";\n font-size: 12px;\n }\n\n .bold {\n font-size: 14px;\n font-weight: 600;\n color: ", ";\n }\n\n .in_time{\n color: #00D27A;\n }\n\n .at_risk {\n color: #FFC700;\n }\n\n .delayed {\n color: #E63757;\n }\n"])), function (props) {
171
+ var Timer = exports.Timer = _styledComponents.default.div(_templateObject49 || (_templateObject49 = _taggedTemplateLiteral(["\n min-width: 65px;\n p {\n margin: 0px;\n color: ", ";\n font-size: 12px;\n }\n\n .bold {\n font-size: 14px;\n font-weight: 600;\n color: ", ";\n }\n\n .in_time{\n color: #00D27A;\n }\n\n .at_risk {\n color: #FFC700;\n }\n \n .delayed {\n color: #E63757;\n }\n"])), function (props) {
172
172
  var _props$theme$colors8;
173
173
  return (_props$theme$colors8 = props.theme.colors) === null || _props$theme$colors8 === void 0 ? void 0 : _props$theme$colors8.lightGray;
174
174
  }, function (props) {
@@ -13,7 +13,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
15
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
16
- var ContainerCard = exports.ContainerCard = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid #E9ECEF;\n box-sizing: border-box;\n border-radius: 7.6px;\n max-height: 300px;\n height: ", ";\n border-radius: 10px;\n margin: 30px 20px;\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n"])), function (_ref) {
16
+ var ContainerCard = exports.ContainerCard = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid #E9ECEF;\n box-sizing: border-box;\n border-radius: 7.6px;\n max-height: 300px;\n height: ", ";\n border-radius: 10px;\n margin: 30px 20px;\n\n ", "\n\n ", "\n\n ", "\n \n ", "\n\n ", "\n \n ", "\n \n"])), function (_ref) {
17
17
  var isSkeleton = _ref.isSkeleton;
18
18
  return isSkeleton ? 'auto' : '320px';
19
19
  }, function (_ref2) {
@@ -110,7 +110,7 @@ var BusinessName = exports.BusinessName = _styledComponents.default.h6(_template
110
110
  return props.theme.colors.darkTextColor;
111
111
  });
112
112
  var Categories = exports.Categories = _styledComponents.default.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n font-size: 14px;\n font-weight: 300;\n color: #6C6C6C;\n\n @media (min-width: 481px) {\n font-size: 16px;\n }\n"])));
113
- var Medadata = exports.Medadata = _styledComponents.default.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n margin-top: 5px;\n display: flex;\n font-weight: 300;\n font-size: 12px;\n color: #909BA9;\n flex-wrap: wrap;\n\n\n ", "\n ", "\n p {\n color: #909BA9;\n svg {\n font-size: 7px;\n min-width: 6px;\n margin: 0 3px;\n }\n\n span {\n margin-right: 10px;\n ", "\n }\n }\n\n @media (min-width: 481px) {\n font-size: 14px;\n }\n"])), function (_ref18) {
113
+ var Medadata = exports.Medadata = _styledComponents.default.div(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n margin-top: 5px;\n display: flex;\n font-weight: 300;\n font-size: 12px;\n color: #909BA9;\n flex-wrap: wrap;\n \n\n ", "\n ", "\n p {\n color: #909BA9;\n svg {\n font-size: 7px;\n min-width: 6px;\n margin: 0 3px;\n }\n\n span {\n margin-right: 10px;\n ", "\n }\n }\n\n @media (min-width: 481px) {\n font-size: 14px;\n }\n"])), function (_ref18) {
114
114
  var isCustomerMode = _ref18.isCustomerMode;
115
115
  return isCustomerMode && (0, _styledComponents.css)(_templateObject33 || (_templateObject33 = _taggedTemplateLiteral(["\n > div {\n flex-direction: column;\n }\n "])));
116
116
  }, function (_ref19) {
@@ -44,7 +44,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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(arr) { if (Array.isArray(arr)) return arr; }
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, _theme$viewString, _validationFields$fie2, _theme$viewString2, _validationFields$fie3, _orderState$options, _orderState$options2, _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$options3, _cart$taxes5, _cart$taxes6, _cart$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie4, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _orderState$options5, _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;
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$options, _orderState$options2, _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$options3, _cart$taxes5, _cart$taxes6, _cart$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$fie4, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _orderState$options5, _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,
@@ -73,10 +73,10 @@ var CartUI = function CartUI(props) {
73
73
  businessConfigs = props.businessConfigs,
74
74
  loyaltyRewardRate = props.loyaltyRewardRate,
75
75
  isCustomerMode = props.isCustomerMode,
76
- guestCheckoutComment = props.guestCheckoutComment,
77
- guestCheckoutCupon = props.guestCheckoutCupon,
78
76
  productLoading = props.productLoading,
79
- setProductLoading = props.setProductLoading;
77
+ setProductLoading = props.setProductLoading,
78
+ hideCommentsByValidationCheckout = props.hideCommentsByValidationCheckout,
79
+ hideCouponByValidationCheckout = props.hideCouponByValidationCheckout;
80
80
  var theme = (0, _styledComponents.useTheme)();
81
81
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
82
82
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -155,8 +155,8 @@ var CartUI = function CartUI(props) {
155
155
  var isMultiCheckout = (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';
156
156
  var cart = cartMulticart || (orderState === null || orderState === void 0 || (_orderState$carts = orderState.carts) === null || _orderState$carts === void 0 ? void 0 : _orderState$carts["businessId:".concat((_props$cart = props.cart) === null || _props$cart === void 0 ? void 0 : _props$cart.business_id)]);
157
157
  var viewString = isStore ? 'business_view' : 'header';
158
- var hideCartComments = (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) || (loginUser !== null && loginUser !== void 0 && loginUser.guest_id && guestCheckoutComment ? !(guestCheckoutComment !== null && guestCheckoutComment !== void 0 && guestCheckoutComment.enabled) : !(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));
159
- var hideCartDiscount = (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) || (loginUser !== null && loginUser !== void 0 && loginUser.guest_id && guestCheckoutCupon ? !(guestCheckoutCupon !== null && guestCheckoutCupon !== void 0 && guestCheckoutCupon.enabled) : !(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.comments) !== null && _validationFields$fie3 !== void 0 && _validationFields$fie3.enabled));
158
+ 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
+ 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
160
  var cateringTypeString = (orderState === null || orderState === void 0 || (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 7 ? 'catering_delivery' : (orderState === null || orderState === void 0 || (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 8 ? 'catering_pickup' : null;
161
161
  var cateringValues = businessConfigs && (0, _utils.getCateringValues)(cateringTypeString, businessConfigs);
162
162
  var walletName = {
@@ -543,7 +543,7 @@ var CartUI = function CartUI(props) {
543
543
  className: "total"
544
544
  }, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('TOTAL', 'Total')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice((cart === null || cart === void 0 ? void 0 : cart.total) >= 0 ? cart === null || cart === void 0 ? void 0 : cart.total : 0))), !!loyaltyRewardValue && isFinite(loyaltyRewardValue) && isCheckout && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, "\xA0"), /*#__PURE__*/_react.default.createElement("td", {
545
545
  id: "loyalty"
546
- }, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))))), (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && !hideCartComments && /*#__PURE__*/_react.default.createElement("table", {
546
+ }, t('REWARD_LOYALTY_POINT', 'Reward :amount: on loyalty points').replace(':amount:', loyaltyRewardValue))))), (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && !hideCartComments && !hideCommentsByValidationCheckout && /*#__PURE__*/_react.default.createElement("table", {
547
547
  className: "comments"
548
548
  }, /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('COMMENTS', 'Comments'))), /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement(_styles.CommentContainer, null, /*#__PURE__*/_react.default.createElement(_Inputs.TextArea, {
549
549
  defaultValue: cart === null || cart === void 0 ? void 0 : cart.comment,
@@ -62,7 +62,7 @@ var mapConfigs = {
62
62
  }
63
63
  };
64
64
  var CheckoutUI = function CheckoutUI(props) {
65
- var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _theme$header, _checkoutFieldsState$, _validationFields$fie, _validationFields$fie2, _cart$comment, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _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, _validationFields$fie7, _loyaltyPlansState$re, _creditPointPlan$busi, _options$address, _businessDetails$busi3, _theme$images, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _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$business2, _cart$products2, _ref, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _customerState$user3;
65
+ 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, _ref, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _customerState$user3;
66
66
  var cart = props.cart,
67
67
  errors = props.errors,
68
68
  placing = props.placing,
@@ -86,9 +86,6 @@ var CheckoutUI = function CheckoutUI(props) {
86
86
  placeSpotNumber = props.placeSpotNumber,
87
87
  checkoutFieldsState = props.checkoutFieldsState;
88
88
  var theme = (0, _styledComponents.useTheme)();
89
- var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
90
- _useValidationFields2 = _slicedToArray(_useValidationFields, 1),
91
- validationFields = _useValidationFields2[0];
92
89
  var _useOrder = (0, _orderingComponentsExternal.useOrder)(),
93
90
  _useOrder2 = _slicedToArray(_useOrder, 1),
94
91
  _useOrder2$ = _useOrder2[0],
@@ -172,14 +169,10 @@ var CheckoutUI = function CheckoutUI(props) {
172
169
  _useState24 = _slicedToArray(_useState23, 2),
173
170
  paymethodClicked = _useState24[0],
174
171
  setPaymethodClicked = _useState24[1];
175
- var _useState25 = (0, _react.useState)([]),
172
+ var _useState25 = (0, _react.useState)(false),
176
173
  _useState26 = _slicedToArray(_useState25, 2),
177
- orderTypeValidationFields = _useState26[0],
178
- setOrderTypeValidationFields = _useState26[1];
179
- var _useState27 = (0, _react.useState)(false),
180
- _useState28 = _slicedToArray(_useState27, 2),
181
- productLoading = _useState28[0],
182
- setProductLoading = _useState28[1];
174
+ productLoading = _useState26[0],
175
+ setProductLoading = _useState26[1];
183
176
  var cardsMethods = ['stripe', 'credomatic'];
184
177
  var stripePaymethods = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect'];
185
178
  var businessConfigs = (_businessDetails$busi = businessDetails === null || businessDetails === void 0 || (_businessDetails$busi2 = businessDetails.business) === null || _businessDetails$busi2 === void 0 ? void 0 : _businessDetails$busi2.configs) !== null && _businessDetails$busi !== void 0 ? _businessDetails$busi : [];
@@ -193,35 +186,52 @@ var CheckoutUI = function CheckoutUI(props) {
193
186
  var isWalletEnabled = (configs === null || configs === void 0 || (_configs$cash_wallet = configs.cash_wallet) === null || _configs$cash_wallet === void 0 ? void 0 : _configs$cash_wallet.value) && (configs === null || configs === void 0 || (_configs$wallet_enabl = configs.wallet_enabled) === null || _configs$wallet_enabl === void 0 ? void 0 : _configs$wallet_enabl.value) === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled) && !useKioskApp && !isCustomerMode;
194
187
  var isMultiDriverTips = (theme === null || theme === void 0 || (_theme$header = theme.header) === null || _theme$header === void 0 || (_theme$header = _theme$header.components) === null || _theme$header === void 0 || (_theme$header = _theme$header.layout) === null || _theme$header === void 0 || (_theme$header = _theme$header.type) === null || _theme$header === void 0 ? void 0 : _theme$header.toLowerCase()) === 'chew';
195
188
  var notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments'];
189
+ var hexTest = /[0-9A-Fa-f]{6}/g;
190
+ var primaryColor = theme === null || theme === void 0 || (_theme$colors = theme.colors) === null || _theme$colors === void 0 || (_theme$colors = _theme$colors.primary) === null || _theme$colors === void 0 || (_theme$colors$split = _theme$colors.split) === null || _theme$colors$split === void 0 || (_theme$colors$split = _theme$colors$split.call(_theme$colors, '#')) === null || _theme$colors$split === void 0 ? void 0 : _theme$colors$split[1];
196
191
  var placeSpotTypes = [3, 4, 5];
197
192
  var placeSpotsEnabled = placeSpotTypes.includes(options === null || options === void 0 ? void 0 : options.type) && !useKioskApp;
198
193
  var isGiftCardCart = !(cart !== null && cart !== void 0 && cart.business_id);
199
- var guestCheckoutDriveTip = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$ = checkoutFieldsState.fields) === null || _checkoutFieldsState$ === void 0 ? void 0 : _checkoutFieldsState$.find(function (field) {
200
- var _field$validation_fie;
201
- return field.order_type_id === 1 && (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';
202
- });
194
+ var checkoutFields = (0, _react.useMemo)(function () {
195
+ var _checkoutFieldsState$;
196
+ return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$ = checkoutFieldsState.fields) === null || _checkoutFieldsState$ === void 0 ? void 0 : _checkoutFieldsState$.filter(function (field) {
197
+ return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type);
198
+ });
199
+ }, [checkoutFieldsState, options]);
200
+ var guestCheckoutDriveTip = (0, _react.useMemo)(function () {
201
+ return checkoutFields === null || checkoutFields === void 0 ? void 0 : checkoutFields.find(function (field) {
202
+ var _field$validation_fie;
203
+ return field.order_type_id === 1 && (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';
204
+ });
205
+ }, [JSON.stringify(checkoutFields), options]);
203
206
  var guestCheckoutComment = (0, _react.useMemo)(function () {
204
- var _checkoutFieldsState$2;
205
- return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$2 = checkoutFieldsState.fields) === null || _checkoutFieldsState$2 === void 0 ? void 0 : _checkoutFieldsState$2.find(function (field) {
207
+ return checkoutFields === null || checkoutFields === void 0 ? void 0 : checkoutFields.find(function (field) {
206
208
  var _field$validation_fie2;
207
209
  return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie2 = field.validation_field) === null || _field$validation_fie2 === void 0 ? void 0 : _field$validation_fie2.code) === 'comments';
208
210
  });
209
- }, [checkoutFieldsState, options]);
210
- var guestCheckoutCupon = (0, _react.useMemo)(function () {
211
- var _checkoutFieldsState$3;
212
- return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$3 = checkoutFieldsState.fields) === null || _checkoutFieldsState$3 === void 0 ? void 0 : _checkoutFieldsState$3.find(function (field) {
211
+ }, [JSON.stringify(checkoutFields), options]);
212
+ var guestCheckoutCoupon = (0, _react.useMemo)(function () {
213
+ return checkoutFields === null || checkoutFields === void 0 ? void 0 : checkoutFields.find(function (field) {
213
214
  var _field$validation_fie3;
214
215
  return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie3 = field.validation_field) === null || _field$validation_fie3 === void 0 ? void 0 : _field$validation_fie3.code) === 'coupon';
215
216
  });
216
- }, [checkoutFieldsState, options]);
217
- // const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
217
+ }, [JSON.stringify(checkoutFields), options]);
218
+ var guestCheckoutZipcode = (0, _react.useMemo)(function () {
219
+ return checkoutFields === null || checkoutFields === void 0 ? void 0 : checkoutFields.find(function (field) {
220
+ var _field$validation_fie4;
221
+ return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie4 = field.validation_field) === null || _field$validation_fie4 === void 0 ? void 0 : _field$validation_fie4.code) === 'zipcode';
222
+ });
223
+ }, [JSON.stringify(checkoutFields), options]);
218
224
 
219
- var validateCommentsCartField = (!(user !== null && user !== void 0 && user.guest_id) ? (validationFields === null || validationFields === void 0 || (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.checkout) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.comments) === null || _validationFields$fie === void 0 ? void 0 : _validationFields$fie.enabled) && (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 ? void 0 : _validationFields$fie2.required) : (guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.enabled) && (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);
220
- var validateDriverTipField = options.type === 1 && (!(user !== null && user !== void 0 && user.guest_id) ? (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.driver_tip) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled) && (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.required) : (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled) && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required)) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0;
221
- var validateZipcodeCard = (validationFields === null || validationFields === void 0 || (_validationFields$fie5 = validationFields.fields) === null || _validationFields$fie5 === void 0 || (_validationFields$fie5 = _validationFields$fie5.card) === null || _validationFields$fie5 === void 0 || (_validationFields$fie5 = _validationFields$fie5.zipcode) === null || _validationFields$fie5 === void 0 ? void 0 : _validationFields$fie5.enabled) && (validationFields === null || validationFields === void 0 || (_validationFields$fie6 = validationFields.fields) === null || _validationFields$fie6 === void 0 || (_validationFields$fie6 = _validationFields$fie6.card) === null || _validationFields$fie6 === void 0 || (_validationFields$fie6 = _validationFields$fie6.zipcode) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.required) && (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'stripe' && (paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$da = paymethodSelected.data) === null || _paymethodSelected$da === void 0 ? void 0 : _paymethodSelected$da.card) && !(paymethodSelected !== null && paymethodSelected !== void 0 && (_paymethodSelected$da2 = paymethodSelected.data) !== null && _paymethodSelected$da2 !== void 0 && (_paymethodSelected$da2 = _paymethodSelected$da2.card) !== null && _paymethodSelected$da2 !== void 0 && _paymethodSelected$da2.zipcode);
225
+ // const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
226
+ 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);
227
+ 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;
228
+ 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) {
229
+ return (offer === null || offer === void 0 ? void 0 : offer.type) === 2;
230
+ }));
231
+ var validateZipcodeCard = (guestCheckoutZipcode === null || guestCheckoutZipcode === void 0 ? void 0 : guestCheckoutZipcode.enabled) && (user !== null && user !== void 0 && user.guest_id ? guestCheckoutZipcode === null || guestCheckoutZipcode === void 0 ? void 0 : guestCheckoutZipcode.required_with_guest : guestCheckoutZipcode === null || guestCheckoutZipcode === void 0 ? void 0 : guestCheckoutZipcode.required) && (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'stripe' && (paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$da = paymethodSelected.data) === null || _paymethodSelected$da === void 0 ? void 0 : _paymethodSelected$da.card) && !(paymethodSelected !== null && paymethodSelected !== void 0 && (_paymethodSelected$da2 = paymethodSelected.data) !== null && _paymethodSelected$da2 !== void 0 && (_paymethodSelected$da2 = _paymethodSelected$da2.card) !== null && _paymethodSelected$da2 !== void 0 && _paymethodSelected$da2.zipcode);
222
232
  var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 || cardsMethods.includes(paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) && (cardList === null || cardList === void 0 || (_cardList$cards = cardList.cards) === null || _cardList$cards === void 0 ? void 0 : _cardList$cards.length) === 0 || placing || errorCash || loading || isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cartState !== null && cartState !== void 0 && (_cartState$cart = cartState.cart) !== null && _cartState$cart !== void 0 && _cartState$cart.spot_number || cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) || !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ||
223
233
  // (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
224
- validateDriverTipField && !isGiftCardCart || validateCommentsCartField || validateZipcodeCard;
234
+ validateCommentsCartField || validateDriverTipField || validateCouponField || validateZipcodeCard;
225
235
  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) || [];
226
236
  var deliveryOptions = (instructionsOptions === null || instructionsOptions === void 0 ? void 0 : instructionsOptions.result) && Array.isArray(instructionsOptions === null || instructionsOptions === void 0 ? void 0 : instructionsOptions.result) && (instructionsOptions === null || instructionsOptions === void 0 || (_instructionsOptions$ = instructionsOptions.result) === null || _instructionsOptions$ === void 0 || (_instructionsOptions$ = _instructionsOptions$.filter(function (option) {
227
237
  return option === null || option === void 0 ? void 0 : option.enabled;
@@ -236,7 +246,7 @@ var CheckoutUI = function CheckoutUI(props) {
236
246
  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;
237
247
  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;
238
248
  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;
239
- 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 && (!(user !== null && user !== void 0 && user.guest_id) && (validationFields === null || validationFields === void 0 || (_validationFields$fie7 = validationFields.fields) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.checkout) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.driver_tip) === null || _validationFields$fie7 === void 0 ? void 0 : _validationFields$fie7.enabled) || (user === null || user === void 0 ? void 0 : user.guest_id) && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled)) && driverTipsOptions.length > 0 && !useKioskApp;
249
+ 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 && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled) && driverTipsOptions.length > 0 && !useKioskApp;
240
250
  var creditPointPlan = loyaltyPlansState === null || loyaltyPlansState === void 0 || (_loyaltyPlansState$re = loyaltyPlansState.result) === null || _loyaltyPlansState$re === void 0 ? void 0 : _loyaltyPlansState$re.find(function (loyal) {
241
251
  return loyal.type === 'credit_point';
242
252
  });
@@ -288,38 +298,46 @@ var CheckoutUI = function CheckoutUI(props) {
288
298
  setIsUserDetailsEdit(false);
289
299
  };
290
300
  var checkGuestValidationFields = function checkGuestValidationFields() {
291
- var _checkoutFieldsState$4, _configs$verification;
301
+ var _checkoutFieldsState$2, _configs$verification;
292
302
  var userSelected = isCustomerMode ? customerState.user : user;
293
303
  var _requiredFields = checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields.filter(function (field) {
294
- var _field$validation_fie4, _field$validation_fie5;
295
- return (field === null || field === void 0 ? void 0 : field.order_type_id) === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 ? void 0 : field.enabled) && (field === null || field === void 0 ? 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) && 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];
296
- }).map(function (item) {
304
+ var _field$validation_fie5, _field$validation_fie6;
305
+ return (field === null || field === void 0 ? void 0 : field.order_type_id) === (options === null || options === void 0 ? void 0 : options.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_fie5 = field.validation_field) === null || _field$validation_fie5 === void 0 ? void 0 : _field$validation_fie5.code) && userSelected && !userSelected[field === null || field === void 0 || (_field$validation_fie6 = field.validation_field) === null || _field$validation_fie6 === void 0 ? void 0 : _field$validation_fie6.code];
306
+ });
307
+ var requiredFieldsCode = _requiredFields.map(function (item) {
297
308
  var _item$validation_fiel;
298
309
  return item === null || item === void 0 || (_item$validation_fiel = item.validation_field) === null || _item$validation_fiel === void 0 ? void 0 : _item$validation_fiel.code;
299
310
  });
300
- var guestCheckoutCellPhone = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$4 = checkoutFieldsState.fields) === null || _checkoutFieldsState$4 === void 0 ? void 0 : _checkoutFieldsState$4.find(function (field) {
301
- var _field$validation_fie6;
302
- return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie6 = field.validation_field) === null || _field$validation_fie6 === void 0 ? void 0 : _field$validation_fie6.code) === 'mobile_phone';
311
+ var guestCheckoutCellPhone = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$2 = checkoutFieldsState.fields) === null || _checkoutFieldsState$2 === void 0 ? void 0 : _checkoutFieldsState$2.find(function (field) {
312
+ var _field$validation_fie7;
313
+ return field.order_type_id === (options === null || options === void 0 ? void 0 : options.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';
303
314
  });
304
- if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.enabled && guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.required || (configs === null || configs === void 0 || (_configs$verification = configs.verification_phone_required) === null || _configs$verification === void 0 ? void 0 : _configs$verification.value) === '1')) {
305
- _requiredFields.push('cellphone');
315
+ 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')) {
316
+ requiredFieldsCode.push('cellphone');
306
317
  }
307
- setRequiredFields(_requiredFields);
318
+ setRequiredFields(requiredFieldsCode);
308
319
  };
309
320
  var checkValidationFields = function checkValidationFields() {
310
- var _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$verification2;
321
+ var _Object$values, _configs$verification2;
311
322
  setUserErrors([]);
312
323
  var errors = [];
313
324
  var userSelected = isCustomerMode ? customerState.user : user;
314
325
  var _requiredFields = [];
315
- Object.values(validationFields === null || validationFields === void 0 || (_validationFields$fie8 = validationFields.fields) === null || _validationFields$fie8 === void 0 ? void 0 : _validationFields$fie8.checkout).map(function (field) {
316
- if (field !== null && field !== void 0 && field.enabled && field !== null && field !== void 0 && field.required && !notFields.includes(field.code)) {
317
- if (userSelected && !userSelected[field === null || field === void 0 ? void 0 : field.code]) {
318
- _requiredFields.push(field === null || field === void 0 ? void 0 : field.code);
326
+ Object.values(checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields).map(function (field) {
327
+ var _field$validation_fie8;
328
+ if ((options === null || options === void 0 ? void 0 : options.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_fie8 = field.validation_field) === null || _field$validation_fie8 === void 0 ? void 0 : _field$validation_fie8.code)) {
329
+ var _field$validation_fie9;
330
+ if (userSelected && !userSelected[field === null || field === void 0 || (_field$validation_fie9 = field.validation_field) === null || _field$validation_fie9 === void 0 ? void 0 : _field$validation_fie9.code]) {
331
+ var _field$validation_fie10;
332
+ _requiredFields.push(field === null || field === void 0 || (_field$validation_fie10 = field.validation_field) === null || _field$validation_fie10 === void 0 ? void 0 : _field$validation_fie10.code);
319
333
  }
320
334
  }
321
335
  });
322
- if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (validationFields !== null && validationFields !== void 0 && (_validationFields$fie9 = validationFields.fields) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.checkout) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.cellphone) !== null && _validationFields$fie9 !== void 0 && _validationFields$fie9.enabled && validationFields !== null && validationFields !== void 0 && (_validationFields$fie10 = validationFields.fields) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.checkout) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.cellphone) !== null && _validationFields$fie10 !== void 0 && _validationFields$fie10.required || (configs === null || configs === void 0 || (_configs$verification2 = configs.verification_phone_required) === null || _configs$verification2 === void 0 ? void 0 : _configs$verification2.value) === '1')) {
336
+ var mobilePhoneField = (_Object$values = Object.values(checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields)) === null || _Object$values === void 0 ? void 0 : _Object$values.find(function (field) {
337
+ var _field$validation_fie11;
338
+ return (field === null || field === void 0 ? void 0 : field.order_type_id) === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie11 = field.validation_field) === null || _field$validation_fie11 === void 0 ? void 0 : _field$validation_fie11.code) === 'mobile_phone';
339
+ });
340
+ 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')) {
323
341
  _requiredFields.push('cellphone');
324
342
  }
325
343
  setRequiredFields(_requiredFields);
@@ -360,15 +378,13 @@ var CheckoutUI = function CheckoutUI(props) {
360
378
  window.scrollTo(0, scrollElement.offsetTop - 20);
361
379
  };
362
380
  (0, _react.useEffect)(function () {
363
- var _validationFields$fie11;
364
- if (validationFields && validationFields !== null && validationFields !== void 0 && (_validationFields$fie11 = validationFields.fields) !== null && _validationFields$fie11 !== void 0 && _validationFields$fie11.checkout && !customerState.loading && !userLoading) {
381
+ if (checkoutFieldsState !== null && checkoutFieldsState !== void 0 && checkoutFieldsState.loading || customerState.loading || userLoading) return;
382
+ if (user !== null && user !== void 0 && user.guest_id) {
383
+ checkGuestValidationFields();
384
+ } else {
365
385
  checkValidationFields();
366
386
  }
367
- }, [validationFields, user, customerState]);
368
- (0, _react.useEffect)(function () {
369
- if (checkoutFieldsState !== null && checkoutFieldsState !== void 0 && checkoutFieldsState.loading || !(user !== null && user !== void 0 && user.guest_id) || customerState.loading || userLoading) return;
370
- checkGuestValidationFields();
371
- }, [user, checkoutFieldsState, customerState]);
387
+ }, [checkoutFieldsState, user, customerState, options === null || options === void 0 ? void 0 : options.type]);
372
388
  (0, _react.useEffect)(function () {
373
389
  if (errors) {
374
390
  setAlertState({
@@ -421,13 +437,15 @@ var CheckoutUI = function CheckoutUI(props) {
421
437
  }), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
422
438
  height: 150
423
439
  })) : /*#__PURE__*/_react.default.createElement(_AddressDetails.AddressDetails, {
424
- location: options === null || options === void 0 || (_options$address = options.address) === null || _options$address === void 0 ? void 0 : _options$address.location,
440
+ location: cart === null || cart === void 0 || (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.location,
425
441
  businessLogo: (businessDetails === null || businessDetails === void 0 || (_businessDetails$busi3 = businessDetails.business) === null || _businessDetails$busi3 === void 0 ? void 0 : _businessDetails$busi3.logo) || ((_theme$images = theme.images) === null || _theme$images === void 0 || (_theme$images = _theme$images.dummies) === null || _theme$images === void 0 ? void 0 : _theme$images.businessLogo),
426
442
  isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
427
443
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
428
444
  apiKey: configs === null || configs === void 0 || (_configs$google_maps_ = configs.google_maps_api_key) === null || _configs$google_maps_ === void 0 ? void 0 : _configs$google_maps_.value,
429
445
  mapConfigs: mapConfigs,
430
- isCustomerMode: isCustomerMode
446
+ isCustomerMode: isCustomerMode,
447
+ cart: cart,
448
+ primaryColor: hexTest.test(primaryColor || '') ? "0x".concat(primaryColor) : 'red'
431
449
  })), !hideCustomerDetails && /*#__PURE__*/_react.default.createElement(_styles.UserDetailsContainer, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperUserDetails, null, cartState.loading || isCustomerMode && !(customerState !== null && customerState !== void 0 && (_customerState$user = customerState.user) !== null && _customerState$user !== void 0 && _customerState$user.id) ? /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
432
450
  height: 35,
433
451
  style: {
@@ -478,12 +496,14 @@ var CheckoutUI = function CheckoutUI(props) {
478
496
  isUserDetailsEdit: isUserDetailsEdit,
479
497
  cartStatus: cart === null || cart === void 0 ? void 0 : cart.status,
480
498
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
481
- useValidationFields: true,
482
499
  useDefualtSessionManager: true,
483
500
  useSessionUser: !isCustomerMode,
484
501
  isCustomerMode: isCustomerMode,
485
502
  userData: isCustomerMode && customerState.user,
486
503
  userId: isCustomerMode && (customerState === null || customerState === void 0 || (_customerState$user2 = customerState.user) === null || _customerState$user2 === void 0 ? void 0 : _customerState$user2.id),
504
+ isOrderTypeValidationField: true,
505
+ requiredFields: requiredFields,
506
+ checkoutFields: checkoutFields,
487
507
  isSuccess: isSuccess,
488
508
  isCheckout: true
489
509
  }))), (cart === null || cart === void 0 ? void 0 : cart.business_id) && !hideBusinessDetails && /*#__PURE__*/_react.default.createElement(_styles.BusinessDetailsContainer, null, ((businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.loading) || cartState.loading) && !(businessDetails !== null && businessDetails !== void 0 && businessDetails.error) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
@@ -511,7 +531,7 @@ var CheckoutUI = function CheckoutUI(props) {
511
531
  style: {
512
532
  marginBottom: '10px'
513
533
  }
514
- }))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values === void 0 ? void 0 : _Object$values.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, !hideBusinessAddress && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi4 = businessDetails.business) === null || _businessDetails$busi4 === void 0 ? void 0 : _businessDetails$busi4.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.cellphone), (businessDetails === null || businessDetails === void 0 || (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.address_notes) && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.address_notes))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 || (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
534
+ }))), !cartState.loading && (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business) && ((_Object$values2 = Object.values(businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.business)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement("div", null, !hideBusinessAddress && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi4 = businessDetails.business) === null || _businessDetails$busi4 === void 0 ? void 0 : _businessDetails$busi4.address), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi5 = businessDetails.business) === null || _businessDetails$busi5 === void 0 ? void 0 : _businessDetails$busi5.name), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi6 = businessDetails.business) === null || _businessDetails$busi6 === void 0 ? void 0 : _businessDetails$busi6.email), /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi7 = businessDetails.business) === null || _businessDetails$busi7 === void 0 ? void 0 : _businessDetails$busi7.cellphone), (businessDetails === null || businessDetails === void 0 || (_businessDetails$busi8 = businessDetails.business) === null || _businessDetails$busi8 === void 0 ? void 0 : _businessDetails$busi8.address_notes) && /*#__PURE__*/_react.default.createElement("p", null, businessDetails === null || businessDetails === void 0 || (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.address_notes))), (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error) && (businessDetails === null || businessDetails === void 0 || (_businessDetails$erro = businessDetails.error) === null || _businessDetails$erro === void 0 ? void 0 : _businessDetails$erro.length) > 0 && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("h1", null, t('BUSINESS_DETAILS', 'Business Details')), /*#__PURE__*/_react.default.createElement(_NotFoundSource.NotFoundSource, {
515
535
  content: (businessDetails === null || businessDetails === void 0 || (_businessDetails$erro2 = businessDetails.error[0]) === null || _businessDetails$erro2 === void 0 ? void 0 : _businessDetails$erro2.message) || (businessDetails === null || businessDetails === void 0 ? void 0 : businessDetails.error[0])
516
536
  }))), /*#__PURE__*/_react.default.createElement(_styles.CheckOutDivider, null)) : /*#__PURE__*/_react.default.createElement(_styles.WrapperActionsInput, null, /*#__PURE__*/_react.default.createElement("h1", null, t('WHATS_YOUR_NAME', "What's your name?")), /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
517
537
  placeholder: t('WRITE_YOUR_NAME', 'Write your name'),
@@ -582,10 +602,10 @@ var CheckoutUI = function CheckoutUI(props) {
582
602
  spotNumberDefault: (_cartState$cart$spot_ = cartState === null || cartState === void 0 || (_cartState$cart2 = cartState.cart) === null || _cartState$cart2 === void 0 ? void 0 : _cartState$cart2.spot_number) !== null && _cartState$cart$spot_ !== void 0 ? _cartState$cart$spot_ : cart === null || cart === void 0 ? void 0 : cart.spot_number,
583
603
  vehicleDefault: cart === null || cart === void 0 ? void 0 : cart.vehicle,
584
604
  setPlaceSpotNumber: setPlaceSpotNumber
585
- })), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.CartContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartHeader, null, /*#__PURE__*/_react.default.createElement("h1", null, t('MOBILE_FRONT_YOUR_ORDER', 'Your order')), (cart === null || cart === void 0 || (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.slug) && /*#__PURE__*/_react.default.createElement("span", {
605
+ })), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.CartContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartHeader, null, /*#__PURE__*/_react.default.createElement("h1", null, t('MOBILE_FRONT_YOUR_ORDER', 'Your order')), (cart === null || cart === void 0 || (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug) && /*#__PURE__*/_react.default.createElement("span", {
586
606
  onClick: function onClick() {
587
- var _cart$business3, _cart$business4;
588
- return (cart === null || cart === void 0 || (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug) && handleStoreRedirect && handleStoreRedirect(cart === null || cart === void 0 || (_cart$business4 = cart.business) === null || _cart$business4 === void 0 ? void 0 : _cart$business4.slug);
607
+ var _cart$business4, _cart$business5;
608
+ return (cart === null || cart === void 0 || (_cart$business4 = cart.business) === null || _cart$business4 === void 0 ? void 0 : _cart$business4.slug) && handleStoreRedirect && handleStoreRedirect(cart === null || cart === void 0 || (_cart$business5 = cart.business) === null || _cart$business5 === void 0 ? void 0 : _cart$business5.slug);
589
609
  }
590
610
  }, t('ADD_PRODUCTS', 'Add products'))), /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
591
611
  isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
@@ -596,8 +616,8 @@ var CheckoutUI = function CheckoutUI(props) {
596
616
  viewString: "checkout",
597
617
  businessConfigs: businessConfigs,
598
618
  loyaltyRewardRate: (_ref = (_creditPointPlanOnBus = creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate) !== null && _creditPointPlanOnBus !== void 0 ? _creditPointPlanOnBus : !!creditPointPlanOnBusiness && (creditPointPlan === null || creditPointPlan === void 0 ? void 0 : creditPointPlan.accumulation_rate)) !== null && _ref !== void 0 ? _ref : 0,
599
- guestCheckoutComment: guestCheckoutComment,
600
- guestCheckoutCupon: guestCheckoutCupon,
619
+ hideCommentsByValidationCheckout: !(guestCheckoutComment !== null && guestCheckoutComment !== void 0 && guestCheckoutComment.enabled),
620
+ hideCouponByValidationCheckout: !(guestCheckoutCoupon !== null && guestCheckoutCoupon !== void 0 && guestCheckoutCoupon.enabled),
601
621
  productLoading: productLoading,
602
622
  setProductLoading: setProductLoading
603
623
  })), !!(isMultiDriverTips && driverTipsField) && /*#__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, {
@@ -614,7 +634,7 @@ var CheckoutUI = function CheckoutUI(props) {
614
634
  onClick: function onClick() {
615
635
  return handlePlaceOrder();
616
636
  }
617
- }, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), validateDriverTipField && !isGiftCardCart && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')), validateCommentsCartField && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')), validateZipcodeCard && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')), (cart === null || cart === void 0 ? void 0 : cart.valid_preorder) !== undefined && !(cart !== null && cart !== void 0 && cart.valid_preorder) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
637
+ }, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), validateDriverTipField && !isGiftCardCart && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')), validateCouponField && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_COUPON_FIELD', 'Coupon is required.')), validateCommentsCartField && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')), validateZipcodeCard && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')), (cart === null || cart === void 0 ? void 0 : cart.valid_preorder) !== undefined && !(cart !== null && cart !== void 0 && cart.valid_preorder) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
618
638
  color: !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? 'secundary' : 'primary',
619
639
  disabled: isDisablePlaceOrderButton,
620
640
  onClick: function onClick() {
@@ -643,7 +663,6 @@ var CheckoutUI = function CheckoutUI(props) {
643
663
  isUserDetailsEdit: isUserDetailsEdit,
644
664
  cartStatus: cart === null || cart === void 0 ? void 0 : cart.status,
645
665
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
646
- useValidationFields: true,
647
666
  useDefualtSessionManager: true,
648
667
  useSessionUser: !isCustomerMode,
649
668
  isCustomerMode: isCustomerMode,
@@ -656,6 +675,8 @@ var CheckoutUI = function CheckoutUI(props) {
656
675
  isEdit: true,
657
676
  isModal: true,
658
677
  handlePlaceOrderAsGuest: handlePlaceOrderAsGuest,
678
+ isOrderTypeValidationField: true,
679
+ checkoutFields: checkoutFields,
659
680
  isAllowGuest: (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'cash' || (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'card_delivery',
660
681
  onClose: function onClose() {
661
682
  setIsOpen(false);
@@ -699,7 +720,7 @@ var CheckoutUI = function CheckoutUI(props) {
699
720
  })));
700
721
  };
701
722
  var Checkout = exports.Checkout = function Checkout(props) {
702
- var _Object$values2, _cartState$error, _cartState$cart3;
723
+ var _Object$values3, _cartState$error, _cartState$cart3;
703
724
  var errors = props.errors,
704
725
  clearErrors = props.clearErrors,
705
726
  cartUuid = props.cartUuid,
@@ -721,44 +742,44 @@ var Checkout = exports.Checkout = function Checkout(props) {
721
742
  var _useLanguage3 = (0, _orderingComponentsExternal.useLanguage)(),
722
743
  _useLanguage4 = _slicedToArray(_useLanguage3, 2),
723
744
  t = _useLanguage4[1];
724
- var _useState29 = (0, _react.useState)({
745
+ var _useState27 = (0, _react.useState)({
725
746
  loading: true,
726
747
  error: null,
727
748
  cart: null
728
749
  }),
750
+ _useState28 = _slicedToArray(_useState27, 2),
751
+ cartState = _useState28[0],
752
+ setCartState = _useState28[1];
753
+ var _useState29 = (0, _react.useState)(false),
729
754
  _useState30 = _slicedToArray(_useState29, 2),
730
- cartState = _useState30[0],
731
- setCartState = _useState30[1];
755
+ openUpselling = _useState30[0],
756
+ setOpenUpselling = _useState30[1];
732
757
  var _useState31 = (0, _react.useState)(false),
733
758
  _useState32 = _slicedToArray(_useState31, 2),
734
- openUpselling = _useState32[0],
735
- setOpenUpselling = _useState32[1];
736
- var _useState33 = (0, _react.useState)(false),
759
+ canOpenUpselling = _useState32[0],
760
+ setCanOpenUpselling = _useState32[1];
761
+ var _useState33 = (0, _react.useState)(null),
737
762
  _useState34 = _slicedToArray(_useState33, 2),
738
- canOpenUpselling = _useState34[0],
739
- setCanOpenUpselling = _useState34[1];
740
- var _useState35 = (0, _react.useState)(null),
741
- _useState36 = _slicedToArray(_useState35, 2),
742
- currentCart = _useState36[0],
743
- setCurrentCart = _useState36[1];
744
- var _useState37 = (0, _react.useState)({
763
+ currentCart = _useState34[0],
764
+ setCurrentCart = _useState34[1];
765
+ var _useState35 = (0, _react.useState)({
745
766
  open: false,
746
767
  content: []
747
768
  }),
769
+ _useState36 = _slicedToArray(_useState35, 2),
770
+ alertState = _useState36[0],
771
+ setAlertState = _useState36[1];
772
+ var _useState37 = (0, _react.useState)(false),
748
773
  _useState38 = _slicedToArray(_useState37, 2),
749
- alertState = _useState38[0],
750
- setAlertState = _useState38[1];
751
- var _useState39 = (0, _react.useState)(false),
752
- _useState40 = _slicedToArray(_useState39, 2),
753
- isResetPaymethod = _useState40[0],
754
- setIsResetPaymethod = _useState40[1];
755
- var cartsWithProducts = (orderState === null || orderState === void 0 ? void 0 : orderState.carts) && (((_Object$values2 = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.filter(function (cart) {
774
+ isResetPaymethod = _useState38[0],
775
+ setIsResetPaymethod = _useState38[1];
776
+ var cartsWithProducts = (orderState === null || orderState === void 0 ? void 0 : orderState.carts) && (((_Object$values3 = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.filter(function (cart) {
756
777
  var _cart$products3;
757
778
  return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 || (_cart$products3 = cart.products) === null || _cart$products3 === void 0 ? void 0 : _cart$products3.length);
758
779
  })) || null);
759
780
  var carts = businessSlug ? cartsWithProducts.filter(function (cart) {
760
- var _cart$business5;
761
- return (cart === null || cart === void 0 || (_cart$business5 = cart.business) === null || _cart$business5 === void 0 ? void 0 : _cart$business5.slug) === businessSlug || businessSlug === (cart === null || cart === void 0 ? void 0 : cart.business_id);
781
+ var _cart$business6;
782
+ return (cart === null || cart === void 0 || (_cart$business6 = cart.business) === null || _cart$business6 === void 0 ? void 0 : _cart$business6.slug) === businessSlug || businessSlug === (cart === null || cart === void 0 ? void 0 : cart.business_id);
762
783
  }) : cartsWithProducts;
763
784
  var closeAlert = function closeAlert() {
764
785
  setAlertState({
@@ -775,8 +796,8 @@ var Checkout = exports.Checkout = function Checkout(props) {
775
796
  };
776
797
  (0, _react.useEffect)(function () {
777
798
  if (!orderState.loading && currentCart !== null && currentCart !== void 0 && currentCart.business_id) {
778
- var _Object$values3;
779
- setCurrentCart.apply(void 0, _toConsumableArray((_Object$values3 = Object.values(orderState.carts)) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.filter(function (cart) {
799
+ var _Object$values4;
800
+ setCurrentCart.apply(void 0, _toConsumableArray((_Object$values4 = Object.values(orderState.carts)) === null || _Object$values4 === void 0 ? void 0 : _Object$values4.filter(function (cart) {
780
801
  return (cart === null || cart === void 0 ? void 0 : cart.business_id) === (currentCart === null || currentCart === void 0 ? void 0 : currentCart.business_id);
781
802
  })));
782
803
  }