ordering-ui-external 2.0.3 → 2.1.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 (99) hide show
  1. package/_bundles/{0.ordering-ui.a228aa8797d9d0fc5a6c.js → 0.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  2. package/_bundles/{1.ordering-ui.a228aa8797d9d0fc5a6c.js → 1.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  3. package/_bundles/{2.ordering-ui.a228aa8797d9d0fc5a6c.js → 2.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  4. package/_bundles/{4.ordering-ui.a228aa8797d9d0fc5a6c.js → 4.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  5. package/_bundles/{5.ordering-ui.a228aa8797d9d0fc5a6c.js → 5.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  6. package/_bundles/{6.ordering-ui.a228aa8797d9d0fc5a6c.js → 6.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  7. package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js → 7.ordering-ui.3861d1cf52cf041c74c5.js} +1 -1
  8. package/_bundles/{7.ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → 7.ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
  9. package/_bundles/{8.ordering-ui.a228aa8797d9d0fc5a6c.js → 8.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  10. package/_bundles/{9.ordering-ui.a228aa8797d9d0fc5a6c.js → 9.ordering-ui.3861d1cf52cf041c74c5.js} +0 -0
  11. package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js → ordering-ui.3861d1cf52cf041c74c5.js} +2 -2
  12. package/_bundles/{ordering-ui.a228aa8797d9d0fc5a6c.js.LICENSE.txt → ordering-ui.3861d1cf52cf041c74c5.js.LICENSE.txt} +0 -0
  13. package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +36 -28
  14. package/_modules/themes/five/src/components/BusinessBasicInformation/styles.js +48 -34
  15. package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +3 -1
  16. package/_modules/themes/five/src/components/BusinessProductsCategories/index.js +9 -2
  17. package/_modules/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +1 -1
  18. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -1
  19. package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  20. package/_modules/themes/five/src/components/Cart/index.js +73 -25
  21. package/_modules/themes/five/src/components/CartContent/index.js +3 -1
  22. package/_modules/themes/five/src/components/Checkout/index.js +25 -15
  23. package/_modules/themes/five/src/components/DriverTips/index.js +26 -15
  24. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/index.js +63 -0
  25. package/_modules/themes/five/src/components/GiftCard/GiftCardUI/styles.js +27 -0
  26. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +69 -0
  27. package/_modules/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +29 -0
  28. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +123 -0
  29. package/_modules/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +20 -0
  30. package/_modules/themes/five/src/components/GiftCard/SendGiftCard/index.js +114 -0
  31. package/_modules/themes/five/src/components/GiftCard/SendGiftCard/styles.js +14 -0
  32. package/_modules/themes/five/src/components/HorizontalOrdersLayout/index.js +3 -1
  33. package/_modules/themes/five/src/components/HorizontalOrdersLayout/styles.js +1 -1
  34. package/_modules/themes/five/src/components/LoginForm/index.js +6 -0
  35. package/_modules/themes/five/src/components/OrderDetails/OrderEta.js +69 -0
  36. package/_modules/themes/five/src/components/OrderDetails/index.js +84 -76
  37. package/_modules/themes/five/src/components/OrderDetails/styles.js +1 -1
  38. package/_modules/themes/five/src/components/OrderItAgain/styles.js +3 -3
  39. package/_modules/themes/five/src/components/OrderProgress/index.js +5 -14
  40. package/_modules/themes/five/src/components/PaymentOptions/index.js +22 -8
  41. package/_modules/themes/five/src/components/PaymentOptions/styles.js +9 -7
  42. package/_modules/themes/five/src/components/ProductOptionSubOption/styles.js +20 -14
  43. package/_modules/themes/five/src/components/ProfessionalFilter/index.js +23 -25
  44. package/_modules/themes/five/src/components/ProfessionalFilter/styles.js +6 -32
  45. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +38 -22
  46. package/_modules/themes/five/src/components/RenderProductsLayout/styles.js +3 -9
  47. package/_modules/themes/five/src/components/ServiceForm/index.js +10 -4
  48. package/_modules/themes/five/src/components/ServiceForm/styles.js +23 -25
  49. package/_modules/themes/five/src/components/SignUpForm/index.js +6 -0
  50. package/_modules/themes/five/src/components/SingleOrderCard/index.js +22 -16
  51. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/index.js +13 -2
  52. package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +73 -51
  53. package/_modules/themes/five/src/components/SingleProfessionalCard/index.js +23 -7
  54. package/_modules/themes/five/src/components/SingleProfessionalCard/styles.js +29 -10
  55. package/_modules/themes/five/src/components/Wallets/index.js +2 -1
  56. package/package.json +2 -2
  57. package/src/themes/five/src/components/BusinessBasicInformation/index.js +49 -35
  58. package/src/themes/five/src/components/BusinessBasicInformation/styles.js +26 -4
  59. package/src/themes/five/src/components/BusinessItemAccordion/index.js +1 -1
  60. package/src/themes/five/src/components/BusinessProductsCategories/index.js +8 -2
  61. package/src/themes/five/src/components/BusinessProductsCategories/layouts/groceries/styles.js +2 -2
  62. package/src/themes/five/src/components/BusinessProductsListing/index.js +1 -0
  63. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +1 -1
  64. package/src/themes/five/src/components/Cart/index.js +44 -14
  65. package/src/themes/five/src/components/CartContent/index.js +1 -0
  66. package/src/themes/five/src/components/Checkout/index.js +67 -51
  67. package/src/themes/five/src/components/DriverTips/index.js +52 -40
  68. package/src/themes/five/src/components/GiftCard/GiftCardUI/index.js +59 -0
  69. package/src/themes/five/src/components/GiftCard/GiftCardUI/styles.js +41 -0
  70. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/index.js +70 -0
  71. package/src/themes/five/src/components/GiftCard/PurchaseGiftCard/styles.js +52 -0
  72. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/index.js +122 -0
  73. package/src/themes/five/src/components/GiftCard/RedeemGiftCard/styles.js +41 -0
  74. package/src/themes/five/src/components/GiftCard/SendGiftCard/index.js +103 -0
  75. package/src/themes/five/src/components/GiftCard/SendGiftCard/styles.js +27 -0
  76. package/src/themes/five/src/components/HorizontalOrdersLayout/index.js +7 -4
  77. package/src/themes/five/src/components/HorizontalOrdersLayout/styles.js +0 -1
  78. package/src/themes/five/src/components/LoginForm/index.js +7 -0
  79. package/src/themes/five/src/components/OrderDetails/OrderEta.js +59 -0
  80. package/src/themes/five/src/components/OrderDetails/index.js +141 -133
  81. package/src/themes/five/src/components/OrderDetails/styles.js +0 -1
  82. package/src/themes/five/src/components/OrderItAgain/styles.js +6 -6
  83. package/src/themes/five/src/components/OrderProgress/index.js +3 -12
  84. package/src/themes/five/src/components/PaymentOptions/index.js +26 -5
  85. package/src/themes/five/src/components/PaymentOptions/styles.js +4 -0
  86. package/src/themes/five/src/components/ProductOptionSubOption/styles.js +24 -4
  87. package/src/themes/five/src/components/ProfessionalFilter/index.js +18 -30
  88. package/src/themes/five/src/components/ProfessionalFilter/styles.js +1 -57
  89. package/src/themes/five/src/components/RenderProductsLayout/index.js +33 -17
  90. package/src/themes/five/src/components/RenderProductsLayout/styles.js +0 -18
  91. package/src/themes/five/src/components/ServiceForm/index.js +11 -5
  92. package/src/themes/five/src/components/ServiceForm/styles.js +1 -9
  93. package/src/themes/five/src/components/SignUpForm/index.js +7 -0
  94. package/src/themes/five/src/components/SingleOrderCard/index.js +43 -26
  95. package/src/themes/five/src/components/SingleProductCard/layouts/original/index.js +12 -2
  96. package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +51 -4
  97. package/src/themes/five/src/components/SingleProfessionalCard/index.js +17 -6
  98. package/src/themes/five/src/components/SingleProfessionalCard/styles.js +33 -6
  99. package/src/themes/five/src/components/Wallets/index.js +2 -1
@@ -16,6 +16,7 @@ var _Modal = require("../Modal");
16
16
  var _CouponControl = require("../../../../../components/CouponControl");
17
17
  var _ProductForm = require("../ProductForm");
18
18
  var _UpsellingPage = require("../UpsellingPage");
19
+ var _CartStoresListing = require("../../../../franchise/src/components/CartStoresListing");
19
20
  var _useWindowSize = require("../../../../../hooks/useWindowSize");
20
21
  var _TaxInformation = require("../TaxInformation");
21
22
  var _Inputs = require("../../styles/Inputs");
@@ -26,6 +27,7 @@ var _styles = require("./styles");
26
27
  var _utils = require("../../../../../utils");
27
28
  var _BsInfoCircle = _interopRequireDefault(require("@meronex/icons/bs/BsInfoCircle"));
28
29
  var _MdCloseCircle = _interopRequireDefault(require("@meronex/icons/ios/MdCloseCircle"));
30
+ var _MomentContent = require("../MomentContent");
29
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
32
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
33
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -42,7 +44,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
42
44
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
43
45
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
44
46
  var CartUI = function CartUI(props) {
45
- var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _theme$viewString$com, _theme$viewString$com2, _theme$viewString$com3, _theme$viewString$com4, _theme$viewString2, _theme$viewString2$co, _theme$viewString2$co2, _theme$viewString2$co3, _theme$viewString2$co4, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options, _cart$offers7, _cart$offers8, _cart$offers8$filter, _orderState$options2, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _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, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _orderState$carts, _props$cart, _theme$viewString, _theme$viewString$com, _theme$viewString$com2, _theme$viewString$com3, _theme$viewString$com4, _theme$viewString2, _theme$viewString2$co, _theme$viewString2$co2, _theme$viewString2$co3, _theme$viewString2$co4, _orderState$options, _orderState$options2, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options3, _cart$offers7, _cart$offers8, _cart$offers8$filter, _orderState$options4, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options5, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _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;
46
48
  var currentCartUuid = props.currentCartUuid,
47
49
  clearCart = props.clearCart,
48
50
  isProducts = props.isProducts,
@@ -66,7 +68,8 @@ var CartUI = function CartUI(props) {
66
68
  setPreorderBusiness = props.setPreorderBusiness,
67
69
  cartMulticart = props.cart,
68
70
  hideDeliveryFee = props.hideDeliveryFee,
69
- hideDriverTip = props.hideDriverTip;
71
+ hideDriverTip = props.hideDriverTip,
72
+ businessConfigs = props.businessConfigs;
70
73
  var theme = (0, _styledComponents.useTheme)();
71
74
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
72
75
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -132,15 +135,32 @@ var CartUI = function CartUI(props) {
132
135
  _useState14 = _slicedToArray(_useState13, 2),
133
136
  isUpselling = _useState14[0],
134
137
  setIsUpselling = _useState14[1];
135
- // const [openChangeStore, setOpenChangeStore] = useState(false)
136
-
138
+ var _useState15 = (0, _react.useState)(false),
139
+ _useState16 = _slicedToArray(_useState15, 2),
140
+ openChangeStore = _useState16[0],
141
+ setOpenChangeStore = _useState16[1];
137
142
  var businessUrlTemplate = (site === null || site === void 0 ? void 0 : site.business_url_template) || '/store/:business_slug';
138
143
  var isCouponEnabled = validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 ? void 0 : (_validationFields$fie2 = _validationFields$fie.checkout) === null || _validationFields$fie2 === void 0 ? void 0 : (_validationFields$fie3 = _validationFields$fie2.coupon) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled;
144
+ var cateringTypes = [7, 8];
139
145
  var isMultiCheckout = (configs === null || configs === void 0 ? void 0 : (_configs$checkout_mul = configs.checkout_multi_business_enabled) === null || _configs$checkout_mul === void 0 ? void 0 : _configs$checkout_mul.value) === '1';
140
146
  var cart = cartMulticart || (orderState === null || orderState === void 0 ? 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)]);
141
147
  var viewString = isStore ? 'business_view' : 'header';
142
148
  var hideCartComments = theme === null || theme === void 0 ? void 0 : (_theme$viewString = theme[viewString]) === null || _theme$viewString === void 0 ? void 0 : (_theme$viewString$com = _theme$viewString.components) === null || _theme$viewString$com === void 0 ? void 0 : (_theme$viewString$com2 = _theme$viewString$com.cart) === null || _theme$viewString$com2 === void 0 ? void 0 : (_theme$viewString$com3 = _theme$viewString$com2.components) === null || _theme$viewString$com3 === void 0 ? void 0 : (_theme$viewString$com4 = _theme$viewString$com3.comments) === null || _theme$viewString$com4 === void 0 ? void 0 : _theme$viewString$com4.hidden;
143
149
  var hideCartDiscount = theme === null || theme === void 0 ? void 0 : (_theme$viewString2 = theme[viewString]) === null || _theme$viewString2 === void 0 ? void 0 : (_theme$viewString2$co = _theme$viewString2.components) === null || _theme$viewString2$co === void 0 ? void 0 : (_theme$viewString2$co2 = _theme$viewString2$co.cart) === null || _theme$viewString2$co2 === void 0 ? void 0 : (_theme$viewString2$co3 = _theme$viewString2$co2.components) === null || _theme$viewString2$co3 === void 0 ? void 0 : (_theme$viewString2$co4 = _theme$viewString2$co3.discount) === null || _theme$viewString2$co4 === void 0 ? void 0 : _theme$viewString2$co4.hidden;
150
+ var cateringTypeString = (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 7 ? 'catering_delivery' : (orderState === null || orderState === void 0 ? void 0 : (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 8 ? 'catering_pickup' : null;
151
+ var splitCateringValue = function splitCateringValue(configName) {
152
+ var _businessConfigs$find, _businessConfigs$find2, _businessConfigs$find3, _businessConfigs$find4;
153
+ return (_businessConfigs$find = businessConfigs.find(function (config) {
154
+ return config.key === configName;
155
+ })) === null || _businessConfigs$find === void 0 ? void 0 : (_businessConfigs$find2 = _businessConfigs$find.value) === null || _businessConfigs$find2 === void 0 ? void 0 : (_businessConfigs$find3 = _businessConfigs$find2.split('|')) === null || _businessConfigs$find3 === void 0 ? void 0 : (_businessConfigs$find4 = _businessConfigs$find3.find(function (val) {
156
+ return val.includes(cateringTypeString);
157
+ })) === null || _businessConfigs$find4 === void 0 ? void 0 : _businessConfigs$find4.split(',')[1];
158
+ };
159
+ var preorderSlotInterval = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_slot_interval'));
160
+ var preorderLeadTime = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_lead_time'));
161
+ var preorderTimeRange = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_time_range'));
162
+ var preorderMaximumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_maximum_days'));
163
+ var preorderMinimumDays = businessConfigs && cateringTypeString && parseInt(splitCateringValue('preorder_minimum_days'));
144
164
  var walletName = {
145
165
  cash: {
146
166
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet')
@@ -168,17 +188,16 @@ var CartUI = function CartUI(props) {
168
188
  setCurProduct(product);
169
189
  setModalIsOpen(true);
170
190
  };
171
- var handleClickCheckout = function handleClickCheckout() {
191
+ var handleClickCheckout = function handleClickCheckout(uuid) {
172
192
  var _Object$values;
173
193
  var cartsAvailable = (_Object$values = Object.values(orderState === null || orderState === void 0 ? void 0 : orderState.carts)) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (cart) {
174
194
  return (cart === null || cart === void 0 ? void 0 : cart.valid) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2;
175
195
  });
176
- if (cartsAvailable.length === 1) {
177
- var _cartsAvailable$;
196
+ if (cartsAvailable.length === 1 || !isMultiCheckout) {
178
197
  events.emit('go_to_page', {
179
198
  page: 'checkout',
180
199
  params: {
181
- cartUuid: (_cartsAvailable$ = cartsAvailable[0]) === null || _cartsAvailable$ === void 0 ? void 0 : _cartsAvailable$.uuid
200
+ cartUuid: uuid
182
201
  }
183
202
  });
184
203
  } else {
@@ -192,11 +211,11 @@ var CartUI = function CartUI(props) {
192
211
  page: 'multi_cart'
193
212
  });
194
213
  } else {
195
- var _cartsAvailable$2, _cartsAvailable$2$gro;
214
+ var _cartsAvailable$, _cartsAvailable$$grou;
196
215
  events.emit('go_to_page', {
197
216
  page: 'multi_checkout',
198
217
  params: {
199
- cartUuid: (_cartsAvailable$2 = cartsAvailable[0]) === null || _cartsAvailable$2 === void 0 ? void 0 : (_cartsAvailable$2$gro = _cartsAvailable$2.group) === null || _cartsAvailable$2$gro === void 0 ? void 0 : _cartsAvailable$2$gro.uuid
218
+ cartUuid: (_cartsAvailable$ = cartsAvailable[0]) === null || _cartsAvailable$ === void 0 ? void 0 : (_cartsAvailable$$grou = _cartsAvailable$.group) === null || _cartsAvailable$$grou === void 0 ? void 0 : _cartsAvailable$$grou.uuid
200
219
  }
201
220
  });
202
221
  }
@@ -252,8 +271,8 @@ var CartUI = function CartUI(props) {
252
271
  setCanOpenUpselling(false);
253
272
  handleClickCheckout();
254
273
  };
255
- var checkOutBtnClick = function checkOutBtnClick() {
256
- handleClickCheckout();
274
+ var checkOutBtnClick = function checkOutBtnClick(uuid) {
275
+ handleClickCheckout(uuid);
257
276
  };
258
277
  var getIncludedTaxes = function getIncludedTaxes() {
259
278
  if ((cart === null || cart === void 0 ? void 0 : cart.taxes) === null) {
@@ -287,11 +306,9 @@ var CartUI = function CartUI(props) {
287
306
  }
288
307
  });
289
308
  };
290
-
291
- // const handleChangeStore = () => {
292
- // setOpenChangeStore(true)
293
- // }
294
-
309
+ var handleChangeStore = function handleChangeStore() {
310
+ setOpenChangeStore(true);
311
+ };
295
312
  (0, _react.useEffect)(function () {
296
313
  if (isCustomMode) setIsUpselling(true);
297
314
  }, [isCustomMode]);
@@ -327,9 +344,8 @@ var CartUI = function CartUI(props) {
327
344
  total: cart === null || cart === void 0 ? void 0 : cart.total,
328
345
  handleClickCheckout: handleClickCheckout,
329
346
  checkoutButtonDisabled: openUpselling && !canOpenUpselling || !(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) || !(cart !== null && cart !== void 0 && cart.valid_address),
330
- setPreorderBusiness: setPreorderBusiness
331
- // handleChangeStore={!useKioskApp && handleChangeStore}
332
- ,
347
+ setPreorderBusiness: setPreorderBusiness,
348
+ handleChangeStore: !useKioskApp && handleChangeStore,
333
349
  isMultiCheckout: isMultiCheckout
334
350
  }, (cart === null || cart === void 0 ? void 0 : (_cart$products = cart.products) === null || _cart$products === void 0 ? void 0 : _cart$products.length) > 0 && (cart === null || cart === void 0 ? void 0 : cart.products.map(function (product) {
335
351
  return /*#__PURE__*/_react.default.createElement(_ProductItemAccordion.ProductItemAccordion, {
@@ -443,7 +459,7 @@ var CartUI = function CartUI(props) {
443
459
  return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
444
460
  }
445
461
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary2 = offer.summary) === null || _offer$summary2 === void 0 ? void 0 : _offer$summary2.discount)));
446
- })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options = orderState.options) === null || _orderState$options === void 0 ? void 0 : _orderState$options.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && !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))), !hideCartDiscount && (cart === null || cart === void 0 ? void 0 : (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 ? void 0 : (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 ? void 0 : (_cart$offers8$filter = _cart$offers8.filter(function (offer) {
462
+ })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && !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))), !hideCartDiscount && (cart === null || cart === void 0 ? void 0 : (_cart$offers7 = cart.offers) === null || _cart$offers7 === void 0 ? void 0 : _cart$offers7.length) > 0 && (cart === null || cart === void 0 ? void 0 : (_cart$offers8 = cart.offers) === null || _cart$offers8 === void 0 ? void 0 : (_cart$offers8$filter = _cart$offers8.filter(function (offer) {
447
463
  return (offer === null || offer === void 0 ? void 0 : offer.target) === 2;
448
464
  })) === null || _cart$offers8$filter === void 0 ? void 0 : _cart$offers8$filter.map(function (offer) {
449
465
  var _offer$summary3;
@@ -468,10 +484,10 @@ var CartUI = function CartUI(props) {
468
484
  return onRemoveOffer(offer === null || offer === void 0 ? void 0 : offer.id);
469
485
  }
470
486
  }))), /*#__PURE__*/_react.default.createElement("td", null, "- ", parsePrice(offer === null || offer === void 0 ? void 0 : (_offer$summary3 = offer.summary) === null || _offer$summary3 === void 0 ? void 0 : _offer$summary3.discount)));
471
- })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options2 = orderState.options) === null || _orderState$options2 === void 0 ? void 0 : _orderState$options2.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) >= 0 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount))), (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 ? 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 ? 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))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
487
+ })), (orderState === null || orderState === void 0 ? void 0 : (_orderState$options4 = orderState.options) === null || _orderState$options4 === void 0 ? void 0 : _orderState$options4.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price) > 0 && (cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount) >= 0 && !hideDeliveryFee && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DELIVERY_FEE_AFTER_DISCOUNT', 'Delivery Fee After Discount')), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.delivery_price_with_discount))), (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 ? 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 ? 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))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
472
488
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
473
489
  price: cart === null || cart === void 0 ? void 0 : cart.total
474
- })), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 ? void 0 : (_orderState$options3 = orderState.options) === null || _orderState$options3 === void 0 ? void 0 : _orderState$options3.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 ? void 0 : (_validationFields$fie5 = _validationFields$fie4.checkout) === null || _validationFields$fie5 === void 0 ? void 0 : (_validationFields$fie6 = _validationFields$fie5.driver_tip) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.enabled) && driverTipsOptions.length > 0 && !useKioskApp && /*#__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, {
490
+ })), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === void 0 ? void 0 : (_orderState$options5 = orderState.options) === null || _orderState$options5 === void 0 ? void 0 : _orderState$options5.type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 ? void 0 : (_validationFields$fie5 = _validationFields$fie4.checkout) === null || _validationFields$fie5 === void 0 ? void 0 : (_validationFields$fie6 = _validationFields$fie5.driver_tip) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.enabled) && driverTipsOptions.length > 0 && !useKioskApp && /*#__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, {
475
491
  businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
476
492
  driverTipsOptions: driverTipsOptions,
477
493
  isFixedPrice: parseInt(configs === null || configs === void 0 ? 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,
@@ -528,9 +544,20 @@ var CartUI = function CartUI(props) {
528
544
  style: {
529
545
  fontWeight: 'bold'
530
546
  }
531
- }, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (!isMultiCheckout || isStore) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
547
+ }, parsePrice(cart === null || cart === void 0 ? void 0 : cart.balance))))), cateringTypes.includes(orderState === null || orderState === void 0 ? 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, {
548
+ cateringPreorder: true,
549
+ isCart: true,
550
+ preorderSlotInterval: preorderSlotInterval,
551
+ preorderLeadTime: preorderLeadTime,
552
+ preorderTimeRange: preorderTimeRange,
553
+ preorderMaximumDays: preorderMaximumDays,
554
+ business: cart === null || cart === void 0 ? void 0 : cart.business,
555
+ preorderMinimumDays: preorderMinimumDays
556
+ })), (onClickCheckout || isForceOpenCart) && !isCheckout && (cart === null || cart === void 0 ? void 0 : cart.valid_products) && (!isMultiCheckout || isStore) && /*#__PURE__*/_react.default.createElement(_styles.CheckoutAction, null, /*#__PURE__*/_react.default.createElement("p", null, (cart === null || cart === void 0 ? void 0 : cart.total) >= 1 && parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
532
557
  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) || !(cart !== null && cart !== void 0 && cart.valid_address) ? 'secundary' : 'primary',
533
- onClick: checkOutBtnClick,
558
+ onClick: function onClick() {
559
+ return checkOutBtnClick(cart === null || cart === void 0 ? void 0 : cart.uuid);
560
+ },
534
561
  disabled: openUpselling && !canOpenUpselling || !(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) || !(cart !== null && cart !== void 0 && cart.valid_address)
535
562
  }, !(cart !== null && cart !== void 0 && cart.valid_address) ? t('OUT_OF_COVERAGE', 'Out of Coverage') : !(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)) : !openUpselling ^ canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')))), !isStore && /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_Confirm.Confirm, {
536
563
  title: t('PRODUCT', 'Product'),
@@ -608,6 +635,27 @@ var CartUI = function CartUI(props) {
608
635
  openUpselling: openUpselling,
609
636
  canOpenUpselling: canOpenUpselling,
610
637
  setCanOpenUpselling: setCanOpenUpselling
638
+ })), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
639
+ width: "70%",
640
+ title: t('CHANGE_STORE', 'Change store'),
641
+ open: openChangeStore,
642
+ padding: "20px",
643
+ closeOnBackdrop: true,
644
+ modalTitleStyle: {
645
+ display: 'flex',
646
+ justifyContent: 'center'
647
+ },
648
+ onClose: function onClose() {
649
+ return setOpenChangeStore(false);
650
+ }
651
+ }, /*#__PURE__*/_react.default.createElement(_CartStoresListing.CartStoresListing, {
652
+ isStore: isStore,
653
+ pageChangeStore: "business",
654
+ cartuuid: cart === null || cart === void 0 ? void 0 : cart.uuid,
655
+ onClose: function onClose() {
656
+ return setOpenChangeStore(false);
657
+ },
658
+ handleCustomStoreRedirect: handleStoreRedirect
611
659
  }))), (_props$afterComponent = props.afterComponents) === null || _props$afterComponent === void 0 ? void 0 : _props$afterComponent.map(function (AfterComponent, i) {
612
660
  return /*#__PURE__*/_react.default.createElement(AfterComponent, _extends({
613
661
  key: i
@@ -101,6 +101,7 @@ var CartContent = function CartContent(props) {
101
101
  onClick: handleClickCheckout,
102
102
  color: "primary"
103
103
  }, t('CHECKOUT', 'Checkout'))), isOrderStateCarts && (carts === null || carts === void 0 ? void 0 : carts.length) > 0 && carts.map(function (cart) {
104
+ var _cart$business;
104
105
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
105
106
  key: cart.uuid
106
107
  }, cart.products.length > 0 && /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
@@ -113,7 +114,8 @@ var CartContent = function CartContent(props) {
113
114
  isProducts: cart.products.length,
114
115
  onClickCheckout: props.onClose,
115
116
  setPreorderBusiness: setPreorderBusiness,
116
- isOpenCart: isOpenCart
117
+ isOpenCart: isOpenCart,
118
+ businessConfigs: cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.configs
117
119
  }));
118
120
  }), (!carts || (carts === null || carts === void 0 ? void 0 : carts.length) === 0) && /*#__PURE__*/_react.default.createElement(_styles.NotCarts, null, /*#__PURE__*/_react.default.createElement("img", {
119
121
  src: (_theme$images = theme.images) === null || _theme$images === void 0 ? void 0 : (_theme$images$general = _theme$images.general) === null || _theme$images$general === void 0 ? void 0 : _theme$images$general.notFound,
@@ -60,7 +60,7 @@ var mapConfigs = {
60
60
  }
61
61
  };
62
62
  var CheckoutUI = function CheckoutUI(props) {
63
- var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _businessDetails$busi3, _businessDetails$busi4, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi9, _businessDetails$busi10, _businessDetails$busi11, _validationFields$fie15, _validationFields$fie16, _validationFields$fie17, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _cart$products2, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _validationFields$fie24, _validationFields$fie25, _validationFields$fie26, _customerState$user3;
63
+ var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _cartState$cart, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _instructionsOptions$2, _businessDetails$busi3, _businessDetails$busi4, _theme$images, _theme$images$dummies, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi9, _businessDetails$busi10, _businessDetails$busi11, _validationFields$fie15, _validationFields$fie16, _validationFields$fie17, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _validationFields$fie18, _validationFields$fie19, _validationFields$fie20, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _cart$business3, _cart$products2, _validationFields$fie21, _validationFields$fie22, _validationFields$fie23, _validationFields$fie24, _validationFields$fie25, _validationFields$fie26, _customerState$user3;
64
64
  var cart = props.cart,
65
65
  errors = props.errors,
66
66
  placing = props.placing,
@@ -108,6 +108,9 @@ var CheckoutUI = function CheckoutUI(props) {
108
108
  var _useCustomer = (0, _orderingComponentsExternal.useCustomer)(),
109
109
  _useCustomer2 = _slicedToArray(_useCustomer, 1),
110
110
  customerState = _useCustomer2[0];
111
+ var _useEvent = (0, _orderingComponentsExternal.useEvent)(),
112
+ _useEvent2 = _slicedToArray(_useEvent, 1),
113
+ events = _useEvent2[0];
111
114
  var history = (0, _reactRouterDom.useHistory)();
112
115
  var windowSize = (0, _useWindowSize.useWindowSize)();
113
116
  var _useState = (0, _react.useState)(false),
@@ -157,6 +160,7 @@ var CheckoutUI = function CheckoutUI(props) {
157
160
  var isMultiDriverTips = (orderingTheme === null || orderingTheme === void 0 ? void 0 : (_orderingTheme$theme = orderingTheme.theme) === null || _orderingTheme$theme === void 0 ? void 0 : (_orderingTheme$theme$ = _orderingTheme$theme.header) === null || _orderingTheme$theme$ === void 0 ? void 0 : (_orderingTheme$theme$2 = _orderingTheme$theme$.components) === null || _orderingTheme$theme$2 === void 0 ? void 0 : (_orderingTheme$theme$3 = _orderingTheme$theme$2.layout) === null || _orderingTheme$theme$3 === void 0 ? void 0 : (_orderingTheme$theme$4 = _orderingTheme$theme$3.type) === null || _orderingTheme$theme$4 === void 0 ? void 0 : _orderingTheme$theme$4.toLowerCase()) === 'chew';
158
161
  var placeSpotTypes = [3, 4, 5];
159
162
  var placeSpotsEnabled = placeSpotTypes.includes(options === null || options === void 0 ? void 0 : options.type) && !useKioskApp;
163
+ var isGiftCardCart = !(cart !== null && cart !== void 0 && cart.business_id);
160
164
  // const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
161
165
 
162
166
  var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 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) ||
@@ -261,7 +265,14 @@ var CheckoutUI = function CheckoutUI(props) {
261
265
  (0, _react.useEffect)(function () {
262
266
  var _cart$products, _cart$business;
263
267
  if (cart !== null && cart !== void 0 && (_cart$products = cart.products) !== null && _cart$products !== void 0 && _cart$products.length) return;
264
- handleStoreRedirect(cart === null || cart === void 0 ? void 0 : (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.slug);
268
+ if (cart !== null && cart !== void 0 && (_cart$business = cart.business) !== null && _cart$business !== void 0 && _cart$business.slug) {
269
+ var _cart$business2;
270
+ handleStoreRedirect(cart === null || cart === void 0 ? void 0 : (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.slug);
271
+ } else {
272
+ events.emit('go_to_page', {
273
+ page: 'wallets'
274
+ });
275
+ }
265
276
  }, [cart === null || cart === void 0 ? void 0 : cart.products]);
266
277
  (0, _react.useEffect)(function () {
267
278
  window.scrollTo(0, 0);
@@ -275,7 +286,7 @@ var CheckoutUI = function CheckoutUI(props) {
275
286
  isCheckOut: true
276
287
  }))), !cartState.loading && (cart === null || cart === void 0 ? void 0 : cart.status) === 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningMessage, null, /*#__PURE__*/_react.default.createElement(_VscWarning.default, null), /*#__PURE__*/_react.default.createElement("h1", null, t('CART_STATUS_PENDING_MESSAGE', 'Your order is being processed, please wait a little more. if you\'ve been waiting too long, please reload the page'))), /*#__PURE__*/_react.default.createElement("h2", {
277
288
  className: "checkout-title"
278
- }, t('CHECK_OUT', 'Checkout')), !useKioskApp ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, businessDetails !== null && businessDetails !== void 0 && businessDetails.loading || cartState.loading ? /*#__PURE__*/_react.default.createElement("div", {
289
+ }, t('CHECK_OUT', 'Checkout')), !useKioskApp ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, businessDetails !== null && businessDetails !== void 0 && businessDetails.loading || cartState.loading ? /*#__PURE__*/_react.default.createElement("div", {
279
290
  style: {
280
291
  width: '100%',
281
292
  marginBottom: '20px'
@@ -295,7 +306,7 @@ var CheckoutUI = function CheckoutUI(props) {
295
306
  apiKey: configs === null || configs === void 0 ? void 0 : (_configs$google_maps_ = configs.google_maps_api_key) === null || _configs$google_maps_ === void 0 ? void 0 : _configs$google_maps_.value,
296
307
  mapConfigs: mapConfigs,
297
308
  isCustomerMode: isCustomerMode
298
- }), /*#__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, {
309
+ })), /*#__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, {
299
310
  height: 35,
300
311
  style: {
301
312
  marginBottom: '10px'
@@ -332,7 +343,7 @@ var CheckoutUI = function CheckoutUI(props) {
332
343
  userId: isCustomerMode && (customerState === null || customerState === void 0 ? void 0 : (_customerState$user2 = customerState.user) === null || _customerState$user2 === void 0 ? void 0 : _customerState$user2.id),
333
344
  isSuccess: isSuccess,
334
345
  isCheckout: true
335
- }))), /*#__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, {
346
+ }))), (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__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, {
336
347
  height: 35,
337
348
  style: {
338
349
  marginBottom: '10px'
@@ -376,7 +387,7 @@ var CheckoutUI = function CheckoutUI(props) {
376
387
  style: {
377
388
  marginBottom: '10px'
378
389
  }
379
- }))), !useKioskApp && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !cartState.loading && deliveryOptionSelected !== undefined && (options === null || options === void 0 ? void 0 : options.type) === 1 && /*#__PURE__*/_react.default.createElement(_styles.DeliveryOptionsContainer, null, /*#__PURE__*/_react.default.createElement("h2", null, t('DELIVERY_DETAILS', 'Delivery Details')), /*#__PURE__*/_react.default.createElement(_Select.Select, {
390
+ }))), !useKioskApp && (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !cartState.loading && deliveryOptionSelected !== undefined && (options === null || options === void 0 ? void 0 : options.type) === 1 && /*#__PURE__*/_react.default.createElement(_styles.DeliveryOptionsContainer, null, /*#__PURE__*/_react.default.createElement("h2", null, t('DELIVERY_DETAILS', 'Delivery Details')), /*#__PURE__*/_react.default.createElement(_Select.Select, {
380
391
  defaultValue: deliveryOptionSelected,
381
392
  options: deliveryOptions,
382
393
  onChange: function onChange(val) {
@@ -392,8 +403,8 @@ var CheckoutUI = function CheckoutUI(props) {
392
403
  cart: cart,
393
404
  useKioskApp: useKioskApp,
394
405
  isDisabled: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
395
- businessId: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.id,
396
- isLoading: businessDetails.loading,
406
+ businessId: !isGiftCardCart ? businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi9 = businessDetails.business) === null || _businessDetails$busi9 === void 0 ? void 0 : _businessDetails$busi9.id : -1,
407
+ isLoading: !isGiftCardCart ? businessDetails.loading : false,
397
408
  paymethods: businessDetails === null || businessDetails === void 0 ? void 0 : (_businessDetails$busi10 = businessDetails.business) === null || _businessDetails$busi10 === void 0 ? void 0 : _businessDetails$busi10.paymethods,
398
409
  onPaymentChange: handlePaymethodChange,
399
410
  errorCash: errorCash,
@@ -414,7 +425,7 @@ var CheckoutUI = function CheckoutUI(props) {
414
425
  driverTip: parseInt(configs === null || configs === void 0 ? 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 ? cart === null || cart === void 0 ? void 0 : cart.driver_tip : cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate,
415
426
  cart: cart,
416
427
  useOrderContext: true
417
- })))), /*#__PURE__*/_react.default.createElement(_styles.WrapperRightContainer, null, !cartState.loading && placeSpotsEnabled && /*#__PURE__*/_react.default.createElement(_styles.SelectSpotContainer, null, /*#__PURE__*/_react.default.createElement(_PlaceSpot.PlaceSpot, {
428
+ })))), /*#__PURE__*/_react.default.createElement(_styles.WrapperRightContainer, null, !cartState.loading && placeSpotsEnabled && (cart === null || cart === void 0 ? void 0 : cart.business_id) && /*#__PURE__*/_react.default.createElement(_styles.SelectSpotContainer, null, /*#__PURE__*/_react.default.createElement(_PlaceSpot.PlaceSpot, {
418
429
  isCheckout: true,
419
430
  isInputMode: true,
420
431
  isHomeStyle: true,
@@ -430,10 +441,10 @@ var CheckoutUI = function CheckoutUI(props) {
430
441
  driverTip: parseInt(configs === null || configs === void 0 ? void 0 : (_configs$driver_tip_t4 = configs.driver_tip_type) === null || _configs$driver_tip_t4 === void 0 ? void 0 : _configs$driver_tip_t4.value, 10) === 1 ? cart === null || cart === void 0 ? void 0 : cart.driver_tip : cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate,
431
442
  cart: cart,
432
443
  useOrderContext: true
433
- })), /*#__PURE__*/_react.default.createElement(_styles.DriverTipDivider, null)), !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')), /*#__PURE__*/_react.default.createElement("span", {
444
+ })), /*#__PURE__*/_react.default.createElement(_styles.DriverTipDivider, null)), !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 ? void 0 : (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug) && /*#__PURE__*/_react.default.createElement("span", {
434
445
  onClick: function onClick() {
435
- var _cart$business2, _cart$business3;
436
- return (cart === null || cart === void 0 ? void 0 : (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.slug) && handleStoreRedirect && handleStoreRedirect(cart === null || cart === void 0 ? void 0 : (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug);
446
+ var _cart$business4, _cart$business5;
447
+ return (cart === null || cart === void 0 ? void 0 : (_cart$business4 = cart.business) === null || _cart$business4 === void 0 ? void 0 : _cart$business4.slug) && handleStoreRedirect && handleStoreRedirect(cart === null || cart === void 0 ? void 0 : (_cart$business5 = cart.business) === null || _cart$business5 === void 0 ? void 0 : _cart$business5.slug);
437
448
  }
438
449
  }, t('ADD_PRODUCTS', 'Add products'))), /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
439
450
  isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
@@ -448,9 +459,8 @@ var CheckoutUI = function CheckoutUI(props) {
448
459
  return handlePlaceOrder();
449
460
  }
450
461
  }, !(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.')), options.type === 1 && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie21 = validationFields.fields) === null || _validationFields$fie21 === void 0 ? void 0 : (_validationFields$fie22 = _validationFields$fie21.checkout) === null || _validationFields$fie22 === void 0 ? void 0 : (_validationFields$fie23 = _validationFields$fie22.driver_tip) === null || _validationFields$fie23 === void 0 ? void 0 : _validationFields$fie23.enabled) && (validationFields === null || validationFields === void 0 ? void 0 : (_validationFields$fie24 = validationFields.fields) === null || _validationFields$fie24 === void 0 ? void 0 : (_validationFields$fie25 = _validationFields$fie24.checkout) === null || _validationFields$fie25 === void 0 ? void 0 : (_validationFields$fie26 = _validationFields$fie25.driver_tip) === null || _validationFields$fie26 === void 0 ? void 0 : _validationFields$fie26.required) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.'))), 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, {
451
- 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'
452
- // disabled={isDisablePlaceOrderButton}
453
- ,
462
+ 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',
463
+ disabled: isDisablePlaceOrderButton,
454
464
  onClick: function onClick() {
455
465
  return isDisablePlaceOrderButton ? handleScrollTo('.paymentsContainer') : handlePlaceOrder();
456
466
  }
@@ -24,7 +24,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
24
24
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
  var DriverTipsUI = function DriverTipsUI(props) {
27
- var _configs$driver_tip_t, _configs$currency_pos, _configs$format_numbe, _configs$format_numbe2;
27
+ var _ref, _configs$driver_tip_t, _configs$currency_pos, _configs$format_numbe, _configs$format_numbe2;
28
28
  var isMulti = props.isMulti,
29
29
  driverTip = props.driverTip,
30
30
  driverTipsOptions = props.driverTipsOptions,
@@ -40,21 +40,40 @@ var DriverTipsUI = function DriverTipsUI(props) {
40
40
  var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
41
41
  _useConfig2 = _slicedToArray(_useConfig, 1),
42
42
  configs = _useConfig2[0].configs;
43
- var _useState = (0, _react.useState)(''),
43
+ var _useState = (0, _react.useState)((_ref = isDriverTipUseCustom && !driverTipsOptions.includes(driverTip)) !== null && _ref !== void 0 ? _ref : false),
44
44
  _useState2 = _slicedToArray(_useState, 2),
45
- value = _useState2[0],
46
- setvalue = _useState2[1];
45
+ customTip = _useState2[0],
46
+ setCustomTip = _useState2[1];
47
+ var _useState3 = (0, _react.useState)(''),
48
+ _useState4 = _slicedToArray(_useState3, 2),
49
+ value = _useState4[0],
50
+ setvalue = _useState4[1];
47
51
  var isFixedPriceType = parseInt(configs === null || configs === void 0 ? 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) === 1;
52
+ var currentTip = customTip ? parseFloat(driverTip || 0) > 0 : (!customTip && !driverTipsOptions.includes(driverTip) && parseFloat(driverTip || 0)) > 0;
48
53
  var handleChangeDriverTip = function handleChangeDriverTip(e) {
49
54
  var _e$target, _e$target2;
50
55
  var tip = Number(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
51
56
  if (isNaN(tip) || tip < 0) return;
52
57
  setvalue(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value);
53
58
  };
54
- var placeholderCurrency = ((configs === null || configs === void 0 ? void 0 : (_configs$currency_pos = configs.currency_position) === null || _configs$currency_pos === void 0 ? void 0 : _configs$currency_pos.value) || 'left') === 'left' ? "".concat(configs === null || configs === void 0 ? void 0 : (_configs$format_numbe = configs.format_number_currency) === null || _configs$format_numbe === void 0 ? void 0 : _configs$format_numbe.value, "0") : "0".concat(configs === null || configs === void 0 ? void 0 : (_configs$format_numbe2 = configs.format_number_currency) === null || _configs$format_numbe2 === void 0 ? void 0 : _configs$format_numbe2.value);
59
+ var placeholderCurrency = !isFixedPriceType ? "0%" : ((configs === null || configs === void 0 ? void 0 : (_configs$currency_pos = configs.currency_position) === null || _configs$currency_pos === void 0 ? void 0 : _configs$currency_pos.value) || 'left') === 'left' ? "".concat(configs === null || configs === void 0 ? void 0 : (_configs$format_numbe = configs.format_number_currency) === null || _configs$format_numbe === void 0 ? void 0 : _configs$format_numbe.value, "0") : "0".concat(configs === null || configs === void 0 ? void 0 : (_configs$format_numbe2 = configs.format_number_currency) === null || _configs$format_numbe2 === void 0 ? void 0 : _configs$format_numbe2.value);
55
60
  return /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, {
56
61
  id: "driver-tip-container"
57
- }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isDriverTipUseCustom && !isMulti ? /*#__PURE__*/_react.default.createElement(_styles.FormDriverTip, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperInput, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
62
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperTips, null, driverTipsOptions.map(function (option, i) {
63
+ return /*#__PURE__*/_react.default.createElement(_styles.TipCard, {
64
+ key: i,
65
+ className: "".concat(option === driverTip && !customTip ? 'active' : ''),
66
+ onClick: function onClick() {
67
+ handlerChangeOption(option);
68
+ setCustomTip(false);
69
+ }
70
+ }, "".concat(isFixedPriceType ? parsePrice(option) : "".concat(option, "%")));
71
+ }), isDriverTipUseCustom && !isMulti && /*#__PURE__*/_react.default.createElement(_styles.TipCard, {
72
+ className: "".concat(customTip ? 'active' : ''),
73
+ onClick: function onClick() {
74
+ return setCustomTip(true);
75
+ }
76
+ }, t('CUSTOM_TIP', 'Custom')), /*#__PURE__*/_react.default.createElement(_styles.FormDriverTip, null, customTip && /*#__PURE__*/_react.default.createElement(_styles.WrapperInput, null, /*#__PURE__*/_react.default.createElement(_Inputs.Input, {
58
77
  name: "drivertip",
59
78
  type: "text",
60
79
  value: value,
@@ -67,15 +86,7 @@ var DriverTipsUI = function DriverTipsUI(props) {
67
86
  handlerChangeOption(value);
68
87
  setvalue('');
69
88
  }
70
- }, t('APPLY_TIP', 'Apply Tip'))), parseFloat(driverTip || 0) > 0 && /*#__PURE__*/_react.default.createElement(_styles.DriverTipMessage, null, t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount'), !isFixedPriceType && " (".concat(driverTip, "%)"), ": ", isFixedPriceType ? parsePrice(driverTip) : parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))) : /*#__PURE__*/_react.default.createElement(_styles.WrapperTips, null, driverTipsOptions.map(function (option, i) {
71
- return /*#__PURE__*/_react.default.createElement(_styles.TipCard, {
72
- key: i,
73
- className: "".concat(option === driverTip ? 'active' : ''),
74
- onClick: function onClick() {
75
- return handlerChangeOption(option);
76
- }
77
- }, "".concat(isFixedPriceType ? parsePrice(option) : "".concat(option, "%")));
78
- }))));
89
+ }, t('APPLY_TIP', 'Apply Tip')))), currentTip && /*#__PURE__*/_react.default.createElement(_styles.DriverTipMessage, null, t('CURRENT_DRIVER_TIP_AMOUNT', 'Current driver tip amount'), !isFixedPriceType && " (".concat(driverTip, "%)"), ": ", isFixedPriceType ? parsePrice(driverTip) : parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip)))));
79
90
  };
80
91
  var DriverTips = function DriverTips(props) {
81
92
  var driverTipsProps = _objectSpread(_objectSpread({}, props), {}, {
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.GiftCardUI = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _orderingComponentsExternal = require("ordering-components-external");
10
+ var _Modal = require("../../Modal");
11
+ var _Buttons = require("../../../styles/Buttons");
12
+ var _BsGift = _interopRequireDefault(require("@meronex/icons/bs/BsGift"));
13
+ var _PurchaseGiftCard = require("../PurchaseGiftCard");
14
+ var _RedeemGiftCard = require("../RedeemGiftCard");
15
+ var _styles = require("./styles");
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
23
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+ var GiftCardUI = function GiftCardUI(props) {
26
+ var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
27
+ _useLanguage2 = _slicedToArray(_useLanguage, 2),
28
+ t = _useLanguage2[1];
29
+ var _useState = (0, _react.useState)(null),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ openModal = _useState2[0],
32
+ setOpenModal = _useState2[1];
33
+ return /*#__PURE__*/_react.default.createElement(_styles.Container, null, /*#__PURE__*/_react.default.createElement(_styles.TitleWrapper, null, /*#__PURE__*/_react.default.createElement("h1", null, t('GIFT_CARD', 'Gift card')), /*#__PURE__*/_react.default.createElement(_BsGift.default, null)), /*#__PURE__*/_react.default.createElement(_styles.ActionWrapper, null, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
34
+ color: "primary",
35
+ onClick: function onClick() {
36
+ return setOpenModal('purchase');
37
+ }
38
+ }, t('PURCHASE_GIFT_CARD', 'Purchase gift card')), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
39
+ outline: true,
40
+ color: "primary",
41
+ className: "light",
42
+ onClick: function onClick() {
43
+ return setOpenModal('redeem');
44
+ }
45
+ }, t('REDEEM_GIFT_CARD', 'Redeem gift card'))), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
46
+ width: "700px",
47
+ open: openModal === 'purchase',
48
+ onClose: function onClose() {
49
+ return setOpenModal(null);
50
+ }
51
+ }, /*#__PURE__*/_react.default.createElement(_PurchaseGiftCard.PurchaseGiftCard, null)), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
52
+ width: "700px",
53
+ open: openModal === 'redeem',
54
+ onClose: function onClose() {
55
+ return setOpenModal(null);
56
+ }
57
+ }, /*#__PURE__*/_react.default.createElement(_RedeemGiftCard.RedeemGiftCard, {
58
+ onClose: function onClose() {
59
+ return setOpenModal(null);
60
+ }
61
+ })));
62
+ };
63
+ exports.GiftCardUI = GiftCardUI;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TitleWrapper = exports.Container = exports.ActionWrapper = void 0;
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 50px;\n margin-bottom: 60px;\n"])));
14
+ exports.Container = Container;
15
+ var TitleWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-bottom: 20px;\n\n h1 {\n margin: 0;\n font-size: 20px;\n font-weight: 600;\n }\n svg {\n margin: 0 10px;\n }\n"])));
16
+ exports.TitleWrapper = TitleWrapper;
17
+ var ActionWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n > button {\n height: 44px;\n &:first-child {\n ", "\n }\n &.light {\n border: 1px solid ", ";\n background: ", ";\n margin: 0 20px;\n &:hover {\n background: ", ";\n }\n }\n }\n"])), function (props) {
18
+ var _props$theme;
19
+ return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-left: 20px;\n "]))) : (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-right: 20px;\n "])));
20
+ }, function (props) {
21
+ return props.theme.colors.primaryContrast;
22
+ }, function (props) {
23
+ return props.theme.colors.primaryContrast;
24
+ }, function (props) {
25
+ return props.theme.colors.primary;
26
+ });
27
+ exports.ActionWrapper = ActionWrapper;