ordering-ui-external 10.4.1 → 10.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/{0.ordering-ui.62d46eec3c210c5257aa.js → 0.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{1.ordering-ui.62d46eec3c210c5257aa.js → 1.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{2.ordering-ui.62d46eec3c210c5257aa.js → 2.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{4.ordering-ui.62d46eec3c210c5257aa.js → 4.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{5.ordering-ui.62d46eec3c210c5257aa.js → 5.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{6.ordering-ui.62d46eec3c210c5257aa.js → 6.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{7.ordering-ui.62d46eec3c210c5257aa.js → 7.ordering-ui.cc1d13aa04732fde3671.js} +2 -2
- package/_bundles/{8.ordering-ui.62d46eec3c210c5257aa.js → 8.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{9.ordering-ui.62d46eec3c210c5257aa.js → 9.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/ordering-ui.cc1d13aa04732fde3671.js +2 -0
- package/_modules/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +4 -2
- package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +3 -1
- package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
- package/_modules/themes/five/src/components/BusinessBasicInformation/index.js +8 -7
- package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -2
- package/_modules/themes/five/src/components/BusinessItemAccordion/styles.js +25 -19
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -0
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +133 -31
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +37 -3
- package/_modules/themes/five/src/components/Cart/index.js +10 -6
- package/_modules/themes/five/src/components/Checkout/index.js +67 -22
- package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +53 -0
- package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +16 -0
- package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +69 -0
- package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +16 -0
- package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/index.js +90 -0
- package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +43 -0
- package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +75 -0
- package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +19 -0
- package/_modules/themes/five/src/components/MyOrders/index.js +6 -1
- package/_modules/themes/five/src/components/OrderProgress/index.js +1 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +1 -0
- package/_modules/themes/five/src/components/PhoneAutocomplete/index.js +165 -31
- package/_modules/themes/five/src/components/PhoneAutocomplete/styles.js +53 -9
- package/_modules/themes/five/src/components/ProductForm/index.js +1 -0
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/_modules/themes/five/src/components/UserFormDetails/index.js +5 -17
- package/_modules/themes/five/src/components/UserFormDetails/styles.js +3 -7
- package/index-template.js +9 -1
- package/package.json +2 -2
- package/src/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +3 -1
- package/src/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +5 -1
- package/src/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
- package/src/themes/five/src/components/BusinessBasicInformation/index.js +6 -3
- package/src/themes/five/src/components/BusinessItemAccordion/index.js +2 -2
- package/src/themes/five/src/components/BusinessItemAccordion/styles.js +8 -7
- package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +156 -36
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +66 -0
- package/src/themes/five/src/components/Cart/index.js +7 -4
- package/src/themes/five/src/components/Checkout/index.js +61 -35
- package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +50 -0
- package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +34 -0
- package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +75 -0
- package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +29 -0
- package/src/themes/five/src/components/GiftCard/SingleGiftCard/index.js +79 -0
- package/src/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +79 -0
- package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +72 -0
- package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +31 -0
- package/src/themes/five/src/components/MyOrders/index.js +6 -1
- package/src/themes/five/src/components/OrderProgress/index.js +1 -1
- package/src/themes/five/src/components/OrdersOption/index.js +1 -0
- package/src/themes/five/src/components/PhoneAutocomplete/index.js +195 -46
- package/src/themes/five/src/components/PhoneAutocomplete/styles.js +106 -10
- package/src/themes/five/src/components/ProductForm/index.js +1 -0
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/src/themes/five/src/components/UserFormDetails/index.js +6 -27
- package/src/themes/five/src/components/UserFormDetails/styles.js +0 -16
- package/template/assets/images/delivery.svg +11 -0
- package/template/assets/images/phone-hero-callcenter.png +0 -0
- package/template/assets/images/phone.svg +11 -0
- package/template/assets/images/pickup.svg +17 -0
- package/_bundles/ordering-ui.62d46eec3c210c5257aa.js +0 -2
- /package/_bundles/{7.ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt → 7.ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
- /package/_bundles/{ordering-ui.62d46eec3c210c5257aa.js.LICENSE.txt → ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
|
@@ -4,10 +4,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.WrapperSearch = exports.SearchContainer = exports.PreviousOrders = exports.HightestRatedWrapper = exports.HeaderSearchMode = exports.ErrorMessage = exports.Divider = exports.BusinessesTitle = exports.BusinessSearch = exports.BusinessLogosWrapper = exports.BusinessLogosContainer = exports.BusinessLogo = exports.BusinessList = exports.BusinessHeroImgStyled = exports.BusinessHeroImg = exports.BusinessContainer = exports.BusinessBanner = exports.AddressFormWrapper = void 0;
|
|
7
|
+
exports.WrapperSearch = exports.TypesWrapper = exports.TypesContainer = exports.TypeButton = exports.Title = exports.SearchContainer = exports.PreviousOrders = exports.IconTypeButton = exports.HightestRatedWrapper = exports.HeaderSearchMode = exports.ErrorMessage = exports.Divider = exports.BusinessesTitle = exports.BusinessSearch = exports.BusinessLogosWrapper = exports.BusinessLogosContainer = exports.BusinessLogo = exports.BusinessList = exports.BusinessHeroImgStyled = exports.BusinessHeroImg = exports.BusinessContainer = exports.BusinessBanner = exports.AddressFormWrapper = exports.AdditionalTypesContainer = void 0;
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24;
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31;
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
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); }
|
|
13
13
|
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; }
|
|
@@ -88,4 +88,38 @@ exports.BusinessLogosContainer = BusinessLogosContainer;
|
|
|
88
88
|
var HeaderSearchMode = _styledComponents.default.div(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n position: absolute;\n width: 200px;\n"])));
|
|
89
89
|
exports.HeaderSearchMode = HeaderSearchMode;
|
|
90
90
|
var AddressFormWrapper = _styledComponents.default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n @media (min-width: 450px) {\n margin-top: 20px;\n }\n"])));
|
|
91
|
-
exports.AddressFormWrapper = AddressFormWrapper;
|
|
91
|
+
exports.AddressFormWrapper = AddressFormWrapper;
|
|
92
|
+
var IconTypeButton = _styledComponents.default.div(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n width: 44px;\n height: 44px;\n background: ", ";\n border-radius: 44px;\n"])), function (_ref5) {
|
|
93
|
+
var _theme$colors;
|
|
94
|
+
var activated = _ref5.activated,
|
|
95
|
+
theme = _ref5.theme;
|
|
96
|
+
return activated ? theme === null || theme === void 0 || (_theme$colors = theme.colors) === null || _theme$colors === void 0 ? void 0 : _theme$colors.white : '#F3F9FF';
|
|
97
|
+
});
|
|
98
|
+
exports.IconTypeButton = IconTypeButton;
|
|
99
|
+
var TypesContainer = _styledComponents.default.div(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n display: flex;\n margin: 42px 20px 0px 20px;\n"])));
|
|
100
|
+
exports.TypesContainer = TypesContainer;
|
|
101
|
+
var AdditionalTypesContainer = _styledComponents.default.div(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n width: 60%;\n display: flex;\n margin-bottom: 20px;\n margin-left: 20px;\n button {\n padding: 4px 10px;\n border-radius: 50px;\n font-size: 10px;\n line-height: 0;\n height: 25px;\n margin-right: 20px;\n }\n .activated {\n color: ", "\n }\n"])), function (_ref6) {
|
|
102
|
+
var _theme$colors2;
|
|
103
|
+
var theme = _ref6.theme;
|
|
104
|
+
return theme === null || theme === void 0 || (_theme$colors2 = theme.colors) === null || _theme$colors2 === void 0 ? void 0 : _theme$colors2.darkTextColor;
|
|
105
|
+
});
|
|
106
|
+
exports.AdditionalTypesContainer = AdditionalTypesContainer;
|
|
107
|
+
var TypeButton = _styledComponents.default.div(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n width: 215px;\n height: 75px;\n border-radius: 7.6px;\n padding: 16px;\n box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.10);\n margin-right: 32px;\n margin-bottom: 32px;\n cursor: pointer;\n background: ", ";\n p{\n margin: 0;\n margin-left: 33px;\n ", "\n }\n"])), function (_ref7) {
|
|
108
|
+
var _theme$colors3, _theme$colors4;
|
|
109
|
+
var activated = _ref7.activated,
|
|
110
|
+
theme = _ref7.theme;
|
|
111
|
+
return activated ? theme === null || theme === void 0 || (_theme$colors3 = theme.colors) === null || _theme$colors3 === void 0 ? void 0 : _theme$colors3.primary : theme === null || theme === void 0 || (_theme$colors4 = theme.colors) === null || _theme$colors4 === void 0 ? void 0 : _theme$colors4.white;
|
|
112
|
+
}, function (_ref8) {
|
|
113
|
+
var _theme$colors5;
|
|
114
|
+
var activated = _ref8.activated,
|
|
115
|
+
theme = _ref8.theme;
|
|
116
|
+
return activated && (0, _styledComponents.css)(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n color: ", ";\n "])), theme === null || theme === void 0 || (_theme$colors5 = theme.colors) === null || _theme$colors5 === void 0 ? void 0 : _theme$colors5.white);
|
|
117
|
+
});
|
|
118
|
+
exports.TypeButton = TypeButton;
|
|
119
|
+
var Title = _styledComponents.default.h2(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n font-weight: 600;\n font-size: 24px;\n color: ", ";\n margin: 0px 20px 5px 20px;\n"])), function (props) {
|
|
120
|
+
var _props$theme3;
|
|
121
|
+
return (_props$theme3 = props.theme) === null || _props$theme3 === void 0 ? void 0 : _props$theme3.colors.headingColor;
|
|
122
|
+
});
|
|
123
|
+
exports.Title = Title;
|
|
124
|
+
var TypesWrapper = _styledComponents.default.div(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n margin-left: 20px;\n width: 600px;\n"])));
|
|
125
|
+
exports.TypesWrapper = TypesWrapper;
|
|
@@ -44,7 +44,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
44
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; } }
|
|
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, _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$offers7, _cart$offers8, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options4, _validationFields$
|
|
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$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,
|
|
@@ -72,7 +72,9 @@ var CartUI = function CartUI(props) {
|
|
|
72
72
|
hideCouponInput = props.hideCouponInput,
|
|
73
73
|
businessConfigs = props.businessConfigs,
|
|
74
74
|
loyaltyRewardRate = props.loyaltyRewardRate,
|
|
75
|
-
isCustomerMode = props.isCustomerMode
|
|
75
|
+
isCustomerMode = props.isCustomerMode,
|
|
76
|
+
guestCheckoutComment = props.guestCheckoutComment,
|
|
77
|
+
guestCheckoutCupon = props.guestCheckoutCupon;
|
|
76
78
|
var theme = (0, _styledComponents.useTheme)();
|
|
77
79
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
78
80
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -83,6 +85,9 @@ var CartUI = function CartUI(props) {
|
|
|
83
85
|
var _useEvent = (0, _orderingComponentsExternal.useEvent)(),
|
|
84
86
|
_useEvent2 = _slicedToArray(_useEvent, 1),
|
|
85
87
|
events = _useEvent2[0];
|
|
88
|
+
var _useSession = (0, _orderingComponentsExternal.useSession)(),
|
|
89
|
+
_useSession2 = _slicedToArray(_useSession, 1),
|
|
90
|
+
loginUser = _useSession2[0].user;
|
|
86
91
|
var _useUtils = (0, _orderingComponentsExternal.useUtils)(),
|
|
87
92
|
_useUtils2 = _slicedToArray(_useUtils, 1),
|
|
88
93
|
_useUtils2$ = _useUtils2[0],
|
|
@@ -148,8 +153,8 @@ var CartUI = function CartUI(props) {
|
|
|
148
153
|
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';
|
|
149
154
|
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)]);
|
|
150
155
|
var viewString = isStore ? 'business_view' : 'header';
|
|
151
|
-
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) || !(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);
|
|
152
|
-
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;
|
|
156
|
+
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));
|
|
157
|
+
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));
|
|
153
158
|
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;
|
|
154
159
|
var cateringValues = businessConfigs && (0, _utils.getCateringValues)(cateringTypeString, businessConfigs);
|
|
155
160
|
var walletName = {
|
|
@@ -177,7 +182,6 @@ var CartUI = function CartUI(props) {
|
|
|
177
182
|
}
|
|
178
183
|
return acc = acc;
|
|
179
184
|
}, cart === null || cart === void 0 ? void 0 : cart.subtotal);
|
|
180
|
-
console.log('cart', cart);
|
|
181
185
|
var clearAmount = function clearAmount(value) {
|
|
182
186
|
var _configs$format_numbe, _configs$format_numbe2;
|
|
183
187
|
return parseFloat((Math.trunc(value * 100) / 100).toFixed((_configs$format_numbe = (_configs$format_numbe2 = configs.format_number_decimal_length) === null || _configs$format_numbe2 === void 0 ? void 0 : _configs$format_numbe2.value) !== null && _configs$format_numbe !== void 0 ? _configs$format_numbe : 2));
|
|
@@ -501,7 +505,7 @@ var CartUI = function CartUI(props) {
|
|
|
501
505
|
})), (cart === null || cart === void 0 ? void 0 : cart.driver_tip) > 0 && !hideDriverTip && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", null, t('DRIVER_TIP', 'Driver tip'), ' ', (cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate) > 0 && parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t = configs.driver_tip_type) === null || _configs$driver_tip_t === void 0 ? void 0 : _configs$driver_tip_t.value, 10) === 2 && !parseInt(configs === null || configs === void 0 || (_configs$driver_tip_u = configs.driver_tip_use_custom) === null || _configs$driver_tip_u === void 0 ? void 0 : _configs$driver_tip_u.value, 10) && /*#__PURE__*/_react.default.createElement("span", null, "(".concat((0, _utils.verifyDecimals)(cart === null || cart === void 0 ? void 0 : cart.driver_tip_rate, parseNumber), "%)"))), /*#__PURE__*/_react.default.createElement("td", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.driver_tip))))), isCouponEnabled && !isCartPending && (isCheckout || isCartPopover || isMultiCheckout) && !(isCheckout && isCartPopover) && !hideCartDiscount && !hideCouponInput && /*#__PURE__*/_react.default.createElement(_styles.CouponContainer, null, /*#__PURE__*/_react.default.createElement(_CouponControl.CouponControl, {
|
|
502
506
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
503
507
|
price: cart === null || cart === void 0 ? void 0 : cart.total
|
|
504
|
-
})), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === 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.status) !== 2 && (validationFields === null || validationFields === void 0 || (_validationFields$
|
|
508
|
+
})), !isStore && !isMultiCheckout && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && (orderState === null || orderState === 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.status) !== 2 && (validationFields === null || validationFields === void 0 || (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.checkout) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.driver_tip) === null || _validationFields$fie4 === void 0 ? void 0 : _validationFields$fie4.enabled) && driverTipsOptions.length > 0 && !useKioskApp && !isCheckout && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
505
509
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
506
510
|
driverTipsOptions: driverTipsOptions,
|
|
507
511
|
isFixedPrice: parseInt(configs === null || configs === void 0 || (_configs$driver_tip_t2 = configs.driver_tip_type) === null || _configs$driver_tip_t2 === void 0 ? void 0 : _configs$driver_tip_t2.value, 10) === 1,
|
|
@@ -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, _validationFields$fie, _validationFields$fie2, _cart$comment, _validationFields$fie3, _validationFields$fie4, _paymethodSelected$da, _paymethodSelected$da2, _cardList$cards, _cartState$cart,
|
|
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;
|
|
66
66
|
var cart = props.cart,
|
|
67
67
|
errors = props.errors,
|
|
68
68
|
placing = props.placing,
|
|
@@ -83,7 +83,8 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
83
83
|
handleStoreRedirect = props.handleStoreRedirect,
|
|
84
84
|
onPlaceOrderClick = props.onPlaceOrderClick,
|
|
85
85
|
setPlaceSpotNumber = props.setPlaceSpotNumber,
|
|
86
|
-
placeSpotNumber = props.placeSpotNumber
|
|
86
|
+
placeSpotNumber = props.placeSpotNumber,
|
|
87
|
+
checkoutFieldsState = props.checkoutFieldsState;
|
|
87
88
|
var theme = (0, _styledComponents.useTheme)();
|
|
88
89
|
var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
|
|
89
90
|
_useValidationFields2 = _slicedToArray(_useValidationFields, 1),
|
|
@@ -183,16 +184,36 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
183
184
|
})) === null || _businessConfigs$find2 === void 0 ? void 0 : _businessConfigs$find2.value) === '1';
|
|
184
185
|
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;
|
|
185
186
|
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';
|
|
187
|
+
var notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments'];
|
|
186
188
|
var placeSpotTypes = [3, 4, 5];
|
|
187
189
|
var placeSpotsEnabled = placeSpotTypes.includes(options === null || options === void 0 ? void 0 : options.type) && !useKioskApp;
|
|
188
190
|
var isGiftCardCart = !(cart !== null && cart !== void 0 && cart.business_id);
|
|
191
|
+
var guestCheckoutDriveTip = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$ = checkoutFieldsState.fields) === null || _checkoutFieldsState$ === void 0 ? void 0 : _checkoutFieldsState$.find(function (field) {
|
|
192
|
+
var _field$validation_fie;
|
|
193
|
+
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';
|
|
194
|
+
});
|
|
195
|
+
var guestCheckoutComment = (0, _react.useMemo)(function () {
|
|
196
|
+
var _checkoutFieldsState$2;
|
|
197
|
+
return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$2 = checkoutFieldsState.fields) === null || _checkoutFieldsState$2 === void 0 ? void 0 : _checkoutFieldsState$2.find(function (field) {
|
|
198
|
+
var _field$validation_fie2;
|
|
199
|
+
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';
|
|
200
|
+
});
|
|
201
|
+
}, [checkoutFieldsState, options]);
|
|
202
|
+
var guestCheckoutCupon = (0, _react.useMemo)(function () {
|
|
203
|
+
var _checkoutFieldsState$3;
|
|
204
|
+
return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$3 = checkoutFieldsState.fields) === null || _checkoutFieldsState$3 === void 0 ? void 0 : _checkoutFieldsState$3.find(function (field) {
|
|
205
|
+
var _field$validation_fie3;
|
|
206
|
+
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';
|
|
207
|
+
});
|
|
208
|
+
}, [checkoutFieldsState, options]);
|
|
189
209
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
190
210
|
|
|
191
|
-
var validateCommentsCartField = (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) && ((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);
|
|
192
|
-
var
|
|
211
|
+
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);
|
|
212
|
+
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;
|
|
213
|
+
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);
|
|
193
214
|
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) ||
|
|
194
215
|
// (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
|
|
195
|
-
|
|
216
|
+
validateDriverTipField && !isGiftCardCart || validateCommentsCartField || validateZipcodeCard;
|
|
196
217
|
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) || [];
|
|
197
218
|
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) {
|
|
198
219
|
return option === null || option === void 0 ? void 0 : option.enabled;
|
|
@@ -207,7 +228,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
207
228
|
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;
|
|
208
229
|
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;
|
|
209
230
|
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;
|
|
210
|
-
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 && (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) && driverTipsOptions.length > 0 && !useKioskApp;
|
|
231
|
+
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;
|
|
211
232
|
var creditPointPlan = loyaltyPlansState === null || loyaltyPlansState === void 0 || (_loyaltyPlansState$re = loyaltyPlansState.result) === null || _loyaltyPlansState$re === void 0 ? void 0 : _loyaltyPlansState$re.find(function (loyal) {
|
|
212
233
|
return loyal.type === 'credit_point';
|
|
213
234
|
});
|
|
@@ -223,7 +244,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
223
244
|
}));
|
|
224
245
|
return;
|
|
225
246
|
}
|
|
226
|
-
if (!userErrors.length &&
|
|
247
|
+
if (!userErrors.length && !(requiredFields !== null && requiredFields !== void 0 && requiredFields.length)) {
|
|
227
248
|
var body = {};
|
|
228
249
|
if (behalfName) {
|
|
229
250
|
body.on_behalf_of = behalfName;
|
|
@@ -258,11 +279,29 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
258
279
|
});
|
|
259
280
|
setIsUserDetailsEdit(false);
|
|
260
281
|
};
|
|
282
|
+
var checkGuestValidationFields = function checkGuestValidationFields() {
|
|
283
|
+
var _checkoutFieldsState$4, _configs$verification;
|
|
284
|
+
var userSelected = isCustomerMode ? customerState.user : user;
|
|
285
|
+
var _requiredFields = checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields.filter(function (field) {
|
|
286
|
+
var _field$validation_fie4, _field$validation_fie5;
|
|
287
|
+
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];
|
|
288
|
+
}).map(function (item) {
|
|
289
|
+
var _item$validation_fiel;
|
|
290
|
+
return item === null || item === void 0 || (_item$validation_fiel = item.validation_field) === null || _item$validation_fiel === void 0 ? void 0 : _item$validation_fiel.code;
|
|
291
|
+
});
|
|
292
|
+
var guestCheckoutCellPhone = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$4 = checkoutFieldsState.fields) === null || _checkoutFieldsState$4 === void 0 ? void 0 : _checkoutFieldsState$4.find(function (field) {
|
|
293
|
+
var _field$validation_fie6;
|
|
294
|
+
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';
|
|
295
|
+
});
|
|
296
|
+
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')) {
|
|
297
|
+
_requiredFields.push('cellphone');
|
|
298
|
+
}
|
|
299
|
+
setRequiredFields(_requiredFields);
|
|
300
|
+
};
|
|
261
301
|
var checkValidationFields = function checkValidationFields() {
|
|
262
|
-
var _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$
|
|
302
|
+
var _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$verification2;
|
|
263
303
|
setUserErrors([]);
|
|
264
304
|
var errors = [];
|
|
265
|
-
var notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments'];
|
|
266
305
|
var userSelected = isCustomerMode ? customerState.user : user;
|
|
267
306
|
var _requiredFields = [];
|
|
268
307
|
Object.values(validationFields === null || validationFields === void 0 || (_validationFields$fie8 = validationFields.fields) === null || _validationFields$fie8 === void 0 ? void 0 : _validationFields$fie8.checkout).map(function (field) {
|
|
@@ -272,7 +311,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
272
311
|
}
|
|
273
312
|
}
|
|
274
313
|
});
|
|
275
|
-
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$
|
|
314
|
+
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')) {
|
|
276
315
|
_requiredFields.push('cellphone');
|
|
277
316
|
}
|
|
278
317
|
setRequiredFields(_requiredFields);
|
|
@@ -318,6 +357,10 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
318
357
|
checkValidationFields();
|
|
319
358
|
}
|
|
320
359
|
}, [validationFields, user, customerState]);
|
|
360
|
+
(0, _react.useEffect)(function () {
|
|
361
|
+
if (checkoutFieldsState !== null && checkoutFieldsState !== void 0 && checkoutFieldsState.loading || !(user !== null && user !== void 0 && user.guest_id) || customerState.loading || userLoading) return;
|
|
362
|
+
checkGuestValidationFields();
|
|
363
|
+
}, [user, checkoutFieldsState, customerState]);
|
|
321
364
|
(0, _react.useEffect)(function () {
|
|
322
365
|
if (errors) {
|
|
323
366
|
setAlertState({
|
|
@@ -334,17 +377,17 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
334
377
|
}
|
|
335
378
|
}, [isResetPaymethod]);
|
|
336
379
|
(0, _react.useEffect)(function () {
|
|
337
|
-
var _cart$products
|
|
380
|
+
var _cart$products;
|
|
338
381
|
if (cart !== null && cart !== void 0 && (_cart$products = cart.products) !== null && _cart$products !== void 0 && _cart$products.length) return;
|
|
339
|
-
if (cart
|
|
340
|
-
var _cart$
|
|
341
|
-
handleStoreRedirect(cart === null || cart === void 0 || (_cart$
|
|
382
|
+
if ((cart === null || cart === void 0 ? void 0 : cart.business_id) !== null) {
|
|
383
|
+
var _cart$business;
|
|
384
|
+
handleStoreRedirect(cart === null || cart === void 0 || (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.slug);
|
|
342
385
|
} else {
|
|
343
386
|
events.emit('go_to_page', {
|
|
344
387
|
page: 'wallets'
|
|
345
388
|
});
|
|
346
389
|
}
|
|
347
|
-
}, [cart === null || cart === void 0 ? void 0 : cart.products]);
|
|
390
|
+
}, [JSON.stringify(cart === null || cart === void 0 ? void 0 : cart.products)]);
|
|
348
391
|
(0, _react.useEffect)(function () {
|
|
349
392
|
window.scrollTo(0, 0);
|
|
350
393
|
}, []);
|
|
@@ -531,10 +574,10 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
531
574
|
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,
|
|
532
575
|
vehicleDefault: cart === null || cart === void 0 ? void 0 : cart.vehicle,
|
|
533
576
|
setPlaceSpotNumber: setPlaceSpotNumber
|
|
534
|
-
})), !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$
|
|
577
|
+
})), !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", {
|
|
535
578
|
onClick: function onClick() {
|
|
536
|
-
var _cart$
|
|
537
|
-
return (cart === null || cart === void 0 || (_cart$
|
|
579
|
+
var _cart$business3, _cart$business4;
|
|
580
|
+
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);
|
|
538
581
|
}
|
|
539
582
|
}, t('ADD_PRODUCTS', 'Add products'))), /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
|
|
540
583
|
isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
|
|
@@ -544,7 +587,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
544
587
|
isProducts: (cart === null || cart === void 0 || (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
|
|
545
588
|
viewString: "checkout",
|
|
546
589
|
businessConfigs: businessConfigs,
|
|
547
|
-
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
|
|
590
|
+
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,
|
|
591
|
+
guestCheckoutComment: guestCheckoutComment,
|
|
592
|
+
guestCheckoutCupon: guestCheckoutCupon
|
|
548
593
|
})), !!(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, {
|
|
549
594
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
550
595
|
driverTipsOptions: driverTipsOptions,
|
|
@@ -559,7 +604,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
559
604
|
onClick: function onClick() {
|
|
560
605
|
return handlePlaceOrder();
|
|
561
606
|
}
|
|
562
|
-
}, !(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.')),
|
|
607
|
+
}, !(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, {
|
|
563
608
|
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',
|
|
564
609
|
disabled: isDisablePlaceOrderButton,
|
|
565
610
|
onClick: function onClick() {
|
|
@@ -702,8 +747,8 @@ var Checkout = function Checkout(props) {
|
|
|
702
747
|
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);
|
|
703
748
|
})) || null);
|
|
704
749
|
var carts = businessSlug ? cartsWithProducts.filter(function (cart) {
|
|
705
|
-
var _cart$
|
|
706
|
-
return (cart === null || cart === void 0 || (_cart$
|
|
750
|
+
var _cart$business5;
|
|
751
|
+
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);
|
|
707
752
|
}) : cartsWithProducts;
|
|
708
753
|
var closeAlert = function closeAlert() {
|
|
709
754
|
setAlertState({
|
|
@@ -0,0 +1,53 @@
|
|
|
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.GiftCardOrdersList = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
10
|
+
var _HorizontalGiftCardOrdersLayout = require("../HorizontalGiftCardOrdersLayout");
|
|
11
|
+
var _styles = require("./styles");
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
var GiftCardOrdersList = function GiftCardOrdersList(props) {
|
|
21
|
+
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
22
|
+
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
23
|
+
t = _useLanguage2[1];
|
|
24
|
+
var _useState = (0, _react.useState)(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
isEmptyPending = _useState2[0],
|
|
27
|
+
setIsEmptyPending = _useState2[1];
|
|
28
|
+
var _useState3 = (0, _react.useState)(false),
|
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
+
isEmptySent = _useState4[0],
|
|
31
|
+
setIsEmptySent = _useState4[1];
|
|
32
|
+
var _useState5 = (0, _react.useState)(false),
|
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
+
isEmptyRedeemed = _useState6[0],
|
|
35
|
+
setIsEmptyRedeemed = _useState6[1];
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_styles.Container, null, /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
37
|
+
title: t('PENDING', 'Pending'),
|
|
38
|
+
defaultStatus: "pending",
|
|
39
|
+
setIsEmpty: setIsEmptyPending,
|
|
40
|
+
scrollId: "pendingGifts"
|
|
41
|
+
}), isEmptyPending && isEmptySent && isEmptyRedeemed && /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
42
|
+
title: t('SENT', 'Sent'),
|
|
43
|
+
defaultStatus: "sent",
|
|
44
|
+
setIsEmpty: setIsEmptySent,
|
|
45
|
+
scrollId: "sentGifts"
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
47
|
+
title: t('REDEEMED', 'Redeemed'),
|
|
48
|
+
defaultStatus: "activated",
|
|
49
|
+
setIsEmpty: setIsEmptyRedeemed,
|
|
50
|
+
scrollId: "redeemedgGifts"
|
|
51
|
+
}), isEmptyPending && isEmptySent && isEmptyRedeemed && /*#__PURE__*/_react.default.createElement(_styles.NoOrdersWrapper, null, /*#__PURE__*/_react.default.createElement("p", null, t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards'))));
|
|
52
|
+
};
|
|
53
|
+
exports.GiftCardOrdersList = GiftCardOrdersList;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NoOrdersWrapper = exports.Divider = exports.Container = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n h2 {\n font-size: 24px;\n font-weight: 600;\n margin: 40px 0 20px 0;\n }\n"])));
|
|
12
|
+
exports.Container = Container;
|
|
13
|
+
var Divider = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-top: 25px;\n background: #F8F9FA;\n height: 8px;\n width: 100%;\n"])));
|
|
14
|
+
exports.Divider = Divider;
|
|
15
|
+
var NoOrdersWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 50px 0px;\n box-sizing: border-box;\n min-height: calc(100% - 120px);\n width: 100%;\n\n > p {\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n margin-top: 0px;\n margin-bottom: 25px;\n }\n"])));
|
|
16
|
+
exports.NoOrdersWrapper = NoOrdersWrapper;
|
|
@@ -0,0 +1,69 @@
|
|
|
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.HorizontalGiftCardOrdersLayout = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
10
|
+
var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
|
|
11
|
+
var _AutoScroll = require("../../AutoScroll");
|
|
12
|
+
var _SingleGiftCard = require("../SingleGiftCard");
|
|
13
|
+
var _Pagination = require("../../Pagination");
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
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); }
|
|
26
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
28
|
+
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; }
|
|
29
|
+
var HorizontalGiftCardOrdersLayoutUI = function HorizontalGiftCardOrdersLayoutUI(props) {
|
|
30
|
+
var _giftCards$list2, _giftCards$list3;
|
|
31
|
+
var giftCards = props.giftCards,
|
|
32
|
+
paginationProps = props.paginationProps,
|
|
33
|
+
goToPage = props.goToPage,
|
|
34
|
+
title = props.title,
|
|
35
|
+
setIsEmpty = props.setIsEmpty,
|
|
36
|
+
scrollId = props.scrollId;
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
var _giftCards$list;
|
|
39
|
+
if (giftCards.loading) return;
|
|
40
|
+
if (((_giftCards$list = giftCards.list) === null || _giftCards$list === void 0 ? void 0 : _giftCards$list.length) === 0) setIsEmpty(true);
|
|
41
|
+
}, [giftCards]);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, giftCards.loading ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
43
|
+
width: 100,
|
|
44
|
+
height: 24
|
|
45
|
+
}) : ((_giftCards$list2 = giftCards.list) === null || _giftCards$list2 === void 0 ? void 0 : _giftCards$list2.length) > 0 && /*#__PURE__*/_react.default.createElement("h2", null, title), /*#__PURE__*/_react.default.createElement(_styles.ProductsListContainer, null, /*#__PURE__*/_react.default.createElement(_styles.ProductsList, null, /*#__PURE__*/_react.default.createElement(_AutoScroll.AutoScroll, {
|
|
46
|
+
scrollId: scrollId
|
|
47
|
+
}, giftCards.loading ? _toConsumableArray(Array(10).keys()).map(function (i) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_SingleGiftCard.SingleGiftCard, {
|
|
49
|
+
isSkeleton: true,
|
|
50
|
+
key: i
|
|
51
|
+
});
|
|
52
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, giftCards.list.map(function (card) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_SingleGiftCard.SingleGiftCard, {
|
|
54
|
+
key: card.id,
|
|
55
|
+
card: card
|
|
56
|
+
});
|
|
57
|
+
}))))), ((_giftCards$list3 = giftCards.list) === null || _giftCards$list3 === void 0 ? void 0 : _giftCards$list3.length) > 0 && Math.ceil(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.totalPages) > 1 && /*#__PURE__*/_react.default.createElement(_styles.PaginationWrapper, null, /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
|
|
58
|
+
currentPage: paginationProps.currentPage,
|
|
59
|
+
totalPages: Math.ceil(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.totalPages),
|
|
60
|
+
handleChangePage: goToPage
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
var HorizontalGiftCardOrdersLayout = function HorizontalGiftCardOrdersLayout(props) {
|
|
64
|
+
var giftCardsProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
65
|
+
UIComponent: HorizontalGiftCardOrdersLayoutUI
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.GiftCardOrdersList, giftCardsProps);
|
|
68
|
+
};
|
|
69
|
+
exports.HorizontalGiftCardOrdersLayout = HorizontalGiftCardOrdersLayout;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ProductsListContainer = exports.ProductsList = exports.PaginationWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var ProductsListContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 10px;\n display: flex;\n overflow: scroll hidden;\n"])));
|
|
12
|
+
exports.ProductsListContainer = ProductsListContainer;
|
|
13
|
+
var ProductsList = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n box-sizing: border-box;\n\n .product-card {\n width: 270px;\n max-width: 270px;\n margin: 10px;\n border: 1px solid #E9ECEF;\n }\n\n @media(min-width: 480px){\n .product-card {\n width: 400px;\n max-width: 400px;\n }\n }\n"])));
|
|
14
|
+
exports.ProductsList = ProductsList;
|
|
15
|
+
var PaginationWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 20px 0;\n"])));
|
|
16
|
+
exports.PaginationWrapper = PaginationWrapper;
|