ordering-ui-external 10.6.2 → 10.7.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.
Files changed (47) hide show
  1. package/_bundles/{0.ordering-ui.fd929d6879c63ef1ff62.js → 0.ordering-ui.8670629bfc482a9fb0a3.js} +1 -1
  2. package/_bundles/{4.ordering-ui.fd929d6879c63ef1ff62.js → 4.ordering-ui.8670629bfc482a9fb0a3.js} +1 -1
  3. package/_bundles/{7.ordering-ui.fd929d6879c63ef1ff62.js → 7.ordering-ui.8670629bfc482a9fb0a3.js} +1 -1
  4. package/_bundles/ordering-ui.8670629bfc482a9fb0a3.js +2 -0
  5. package/_modules/themes/callcenterOriginal/src/components/AddressForm/index.js +31 -17
  6. package/_modules/themes/callcenterOriginal/src/components/AddressForm/styles.js +8 -5
  7. package/_modules/themes/callcenterOriginal/src/components/AddressList/index.js +21 -11
  8. package/_modules/themes/callcenterOriginal/src/components/AddressList/styles.js +15 -5
  9. package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +183 -59
  10. package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +55 -9
  11. package/_modules/themes/five/src/components/BusinessProductsListing/index.js +25 -3
  12. package/_modules/themes/five/src/components/MyOrders/index.js +11 -2
  13. package/_modules/themes/five/src/components/OrderDetails/index.js +4 -2
  14. package/_modules/themes/five/src/components/OrdersOption/index.js +21 -18
  15. package/_modules/themes/five/src/components/PageBanner/index.js +23 -9
  16. package/_modules/themes/five/src/components/PhoneAutocomplete/index.js +1 -1
  17. package/_modules/themes/five/src/components/ProductItemAccordion/index.js +5 -2
  18. package/_modules/themes/five/src/components/RenderProductsLayout/index.js +5 -2
  19. package/_modules/themes/five/src/components/UserDetails/styles.js +2 -2
  20. package/_modules/themes/five/src/components/WebsocketStatus/index.js +6 -3
  21. package/package.json +2 -2
  22. package/src/themes/callcenterOriginal/src/components/AddressForm/index.js +22 -13
  23. package/src/themes/callcenterOriginal/src/components/AddressForm/styles.js +20 -7
  24. package/src/themes/callcenterOriginal/src/components/AddressList/index.js +26 -14
  25. package/src/themes/callcenterOriginal/src/components/AddressList/styles.js +13 -5
  26. package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +210 -68
  27. package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/styles.js +127 -11
  28. package/src/themes/five/src/components/BusinessProductsListing/index.js +21 -0
  29. package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
  30. package/src/themes/five/src/components/MyOrders/index.js +5 -1
  31. package/src/themes/five/src/components/OrderDetails/index.js +2 -0
  32. package/src/themes/five/src/components/OrdersOption/index.js +5 -3
  33. package/src/themes/five/src/components/PageBanner/index.js +14 -4
  34. package/src/themes/five/src/components/PhoneAutocomplete/index.js +1 -2
  35. package/src/themes/five/src/components/ProductItemAccordion/index.js +4 -0
  36. package/src/themes/five/src/components/RenderProductsLayout/index.js +4 -1
  37. package/src/themes/five/src/components/UserDetails/styles.js +2 -2
  38. package/src/themes/five/src/components/WebsocketStatus/index.js +4 -4
  39. package/_bundles/ordering-ui.fd929d6879c63ef1ff62.js +0 -2
  40. /package/_bundles/{1.ordering-ui.fd929d6879c63ef1ff62.js → 1.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  41. /package/_bundles/{2.ordering-ui.fd929d6879c63ef1ff62.js → 2.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  42. /package/_bundles/{5.ordering-ui.fd929d6879c63ef1ff62.js → 5.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  43. /package/_bundles/{6.ordering-ui.fd929d6879c63ef1ff62.js → 6.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  44. /package/_bundles/{7.ordering-ui.fd929d6879c63ef1ff62.js.LICENSE.txt → 7.ordering-ui.8670629bfc482a9fb0a3.js.LICENSE.txt} +0 -0
  45. /package/_bundles/{8.ordering-ui.fd929d6879c63ef1ff62.js → 8.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  46. /package/_bundles/{9.ordering-ui.fd929d6879c63ef1ff62.js → 9.ordering-ui.8670629bfc482a9fb0a3.js} +0 -0
  47. /package/_bundles/{ordering-ui.fd929d6879c63ef1ff62.js.LICENSE.txt → ordering-ui.8670629bfc482a9fb0a3.js.LICENSE.txt} +0 -0
@@ -416,7 +416,8 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
416
416
  }).map(function (product) {
417
417
  return /*#__PURE__*/_react.default.createElement(_ProductItemAccordion.ProductItemAccordion, {
418
418
  key: product.id,
419
- product: product
419
+ product: product,
420
+ showArrowIcon: true
420
421
  });
421
422
  }));
422
423
  }), order === null || order === void 0 ? void 0 : order.products.filter(function (product) {
@@ -424,7 +425,8 @@ var OrderDetailsUI = function OrderDetailsUI(props) {
424
425
  }).map(function (product) {
425
426
  return /*#__PURE__*/_react.default.createElement(_ProductItemAccordion.ProductItemAccordion, {
426
427
  key: product.id,
427
- product: product
428
+ product: product,
429
+ showArrowIcon: true
428
430
  });
429
431
  }));
430
432
  };
@@ -151,15 +151,18 @@ var OrdersOptionUI = function OrdersOptionUI(props) {
151
151
  var closeOrderModal = function closeOrderModal(e) {
152
152
  var outsideModal = !window.document.getElementById('app-modals') || !window.document.getElementById('app-modals').contains(e.target);
153
153
  if (outsideModal) {
154
- var _reorderState$result, _reorderState$result2;
155
- var _businessId = 'businessId:' + (reorderState === null || reorderState === void 0 || (_reorderState$result = reorderState.result) === null || _reorderState$result === void 0 ? void 0 : _reorderState$result.business_id);
156
- sessionStorage.setItem('adjust-cart-products', _businessId);
157
- onRedirectPage && onRedirectPage({
158
- page: 'business',
159
- params: {
160
- store: reorderState === null || reorderState === void 0 || (_reorderState$result2 = reorderState.result) === null || _reorderState$result2 === void 0 || (_reorderState$result2 = _reorderState$result2.business) === null || _reorderState$result2 === void 0 ? void 0 : _reorderState$result2.slug
161
- }
162
- });
154
+ var _reorderState$result;
155
+ if (reorderState !== null && reorderState !== void 0 && (_reorderState$result = reorderState.result) !== null && _reorderState$result !== void 0 && (_reorderState$result = _reorderState$result.business) !== null && _reorderState$result !== void 0 && _reorderState$result.slug) {
156
+ var _reorderState$result2, _reorderState$result3;
157
+ var _businessId = 'businessId:' + (reorderState === null || reorderState === void 0 || (_reorderState$result2 = reorderState.result) === null || _reorderState$result2 === void 0 ? void 0 : _reorderState$result2.business_id);
158
+ sessionStorage.setItem('adjust-cart-products', _businessId);
159
+ onRedirectPage && onRedirectPage({
160
+ page: 'business',
161
+ params: {
162
+ store: reorderState === null || reorderState === void 0 || (_reorderState$result3 = reorderState.result) === null || _reorderState$result3 === void 0 || (_reorderState$result3 = _reorderState$result3.business) === null || _reorderState$result3 === void 0 ? void 0 : _reorderState$result3.slug
163
+ }
164
+ });
165
+ }
163
166
  }
164
167
  };
165
168
  var handleChangePage = function handleChangePage(page) {
@@ -190,25 +193,25 @@ var OrdersOptionUI = function OrdersOptionUI(props) {
190
193
  }
191
194
  }, [orders, activeOrders, pastOrders, preOrders]);
192
195
  (0, _react.useEffect)(function () {
193
- var _reorderState$result3;
196
+ var _reorderState$result4;
194
197
  if (reorderState !== null && reorderState !== void 0 && reorderState.error) {
195
198
  window.addEventListener('click', closeOrderModal);
196
199
  return function () {
197
200
  window.removeEventListener('click', closeOrderModal);
198
201
  };
199
202
  }
200
- if (!(reorderState !== null && reorderState !== void 0 && reorderState.error) && reorderState.loading === false && reorderState !== null && reorderState !== void 0 && (_reorderState$result3 = reorderState.result) !== null && _reorderState$result3 !== void 0 && _reorderState$result3.business_id) {
201
- var _reorderState$result4, _carts$_businessId, _orders$find, _reorderState$result6;
202
- var _businessId = 'businessId:' + (reorderState === null || reorderState === void 0 || (_reorderState$result4 = reorderState.result) === null || _reorderState$result4 === void 0 ? void 0 : _reorderState$result4.business_id);
203
+ if (!(reorderState !== null && reorderState !== void 0 && reorderState.error) && reorderState.loading === false && reorderState !== null && reorderState !== void 0 && (_reorderState$result4 = reorderState.result) !== null && _reorderState$result4 !== void 0 && _reorderState$result4.business_id) {
204
+ var _reorderState$result5, _carts$_businessId, _orders$find, _reorderState$result7;
205
+ var _businessId = 'businessId:' + (reorderState === null || reorderState === void 0 || (_reorderState$result5 = reorderState.result) === null || _reorderState$result5 === void 0 ? void 0 : _reorderState$result5.business_id);
203
206
  var cartProducts = carts === null || carts === void 0 || (_carts$_businessId = carts[_businessId]) === null || _carts$_businessId === void 0 ? void 0 : _carts$_businessId.products;
204
207
  var available = cartProducts.every(function (product) {
205
208
  return product.valid === true;
206
209
  });
207
210
  var orderProducts = (_orders$find = orders.find(function (order) {
208
- var _reorderState$result5;
209
- return (order === null || order === void 0 ? void 0 : order.id) === (reorderState === null || reorderState === void 0 || (_reorderState$result5 = reorderState.result) === null || _reorderState$result5 === void 0 ? void 0 : _reorderState$result5.orderId);
211
+ var _reorderState$result6;
212
+ return (order === null || order === void 0 ? void 0 : order.id) === (reorderState === null || reorderState === void 0 || (_reorderState$result6 = reorderState.result) === null || _reorderState$result6 === void 0 ? void 0 : _reorderState$result6.orderId);
210
213
  })) === null || _orders$find === void 0 ? void 0 : _orders$find.products;
211
- if (available && reorderState !== null && reorderState !== void 0 && (_reorderState$result6 = reorderState.result) !== null && _reorderState$result6 !== void 0 && _reorderState$result6.uuid && (cartProducts === null || cartProducts === void 0 ? void 0 : cartProducts.length) === (orderProducts === null || orderProducts === void 0 ? void 0 : orderProducts.length)) {
214
+ if (available && reorderState !== null && reorderState !== void 0 && (_reorderState$result7 = reorderState.result) !== null && _reorderState$result7 !== void 0 && _reorderState$result7.uuid && (cartProducts === null || cartProducts === void 0 ? void 0 : cartProducts.length) === (orderProducts === null || orderProducts === void 0 ? void 0 : orderProducts.length)) {
212
215
  onRedirectPage && onRedirectPage({
213
216
  page: 'checkout',
214
217
  params: {
@@ -216,13 +219,13 @@ var OrdersOptionUI = function OrdersOptionUI(props) {
216
219
  }
217
220
  });
218
221
  } else {
219
- var _reorderState$result7;
222
+ var _reorderState$result8;
220
223
  sessionStorage.setItem('adjust-cart-products', _businessId);
221
224
  (cartProducts === null || cartProducts === void 0 ? void 0 : cartProducts.length) !== (orderProducts === null || orderProducts === void 0 ? void 0 : orderProducts.length) && sessionStorage.setItem('already-removed', 'removed');
222
225
  onRedirectPage && onRedirectPage({
223
226
  page: 'business',
224
227
  params: {
225
- store: reorderState === null || reorderState === void 0 || (_reorderState$result7 = reorderState.result) === null || _reorderState$result7 === void 0 || (_reorderState$result7 = _reorderState$result7.business) === null || _reorderState$result7 === void 0 ? void 0 : _reorderState$result7.slug
228
+ store: reorderState === null || reorderState === void 0 || (_reorderState$result8 = reorderState.result) === null || _reorderState$result8 === void 0 || (_reorderState$result8 = _reorderState$result8.business) === null || _reorderState$result8 === void 0 ? void 0 : _reorderState$result8.slug
226
229
  }
227
230
  });
228
231
  }
@@ -32,7 +32,9 @@ _swiper.default.use([_swiper.Navigation]);
32
32
  var PageBannerUI = function PageBannerUI(props) {
33
33
  var _pageBannerState$bann, _pageBannerState$bann2, _pageBannerState$bann3, _pageBannerState$bann4;
34
34
  var pageBannerState = props.pageBannerState,
35
- isCustomerMode = props.isCustomerMode;
35
+ isCustomerMode = props.isCustomerMode,
36
+ handleCustomProductBannerClick = props.handleCustomProductBannerClick,
37
+ business = props.business;
36
38
  var _useSite = (0, _orderingComponentsExternal.useSite)(),
37
39
  _useSite2 = _slicedToArray(_useSite, 1),
38
40
  site = _useSite2[0].site;
@@ -143,17 +145,27 @@ var PageBannerUI = function PageBannerUI(props) {
143
145
  });
144
146
  }
145
147
  if (action.type === 'product') {
146
- var _action$url$split$;
148
+ var _action$url$split$, _business$categories, _foundCategory$produc;
147
149
  slug = (_action$url$split$ = action.url.split('store/')[1]) === null || _action$url$split$ === void 0 ? void 0 : _action$url$split$.split('?')[0];
148
150
  var paramString = action.url.split('?')[1];
149
151
  var urlParams = new URLSearchParams(paramString);
150
- var product = urlParams.get('product');
151
- var category = urlParams.get('category');
152
- onProductRedirect({
153
- slug: slug,
154
- category: category,
155
- product: product
152
+ var productId = urlParams.get('product');
153
+ var categoryId = urlParams.get('category');
154
+ var foundCategory = business === null || business === void 0 || (_business$categories = business.categories) === null || _business$categories === void 0 ? void 0 : _business$categories.find(function (category) {
155
+ return category.id === Number(categoryId);
156
+ });
157
+ var foundProduct = foundCategory === null || foundCategory === void 0 || (_foundCategory$produc = foundCategory.products) === null || _foundCategory$produc === void 0 ? void 0 : _foundCategory$produc.find(function (product) {
158
+ return product.id === Number(productId);
156
159
  });
160
+ if ((business === null || business === void 0 ? void 0 : business.slug) === slug && foundProduct) {
161
+ handleCustomProductBannerClick(foundProduct);
162
+ } else {
163
+ onProductRedirect({
164
+ slug: slug,
165
+ category: categoryId,
166
+ product: productId
167
+ });
168
+ }
157
169
  }
158
170
  };
159
171
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, pageBannerState.loading ? /*#__PURE__*/_react.default.createElement(_styles.BannerContainer, null, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
@@ -162,7 +174,9 @@ var PageBannerUI = function PageBannerUI(props) {
162
174
  navigation: ((_pageBannerState$bann2 = pageBannerState.banner) === null || _pageBannerState$bann2 === void 0 || (_pageBannerState$bann2 = _pageBannerState$bann2.items) === null || _pageBannerState$bann2 === void 0 ? void 0 : _pageBannerState$bann2.length) > 1,
163
175
  spaceBetween: 0,
164
176
  shortSwipes: false,
165
- loop: ((_pageBannerState$bann3 = pageBannerState.banner) === null || _pageBannerState$bann3 === void 0 ? void 0 : _pageBannerState$bann3.items.length) > 1
177
+ loop: ((_pageBannerState$bann3 = pageBannerState.banner) === null || _pageBannerState$bann3 === void 0 ? void 0 : _pageBannerState$bann3.items.length) > 1,
178
+ touchStartPreventDefault: false,
179
+ slidesPerView: 1
166
180
  }, (_pageBannerState$bann4 = pageBannerState.banner) === null || _pageBannerState$bann4 === void 0 ? void 0 : _pageBannerState$bann4.items.map(function (img, i) {
167
181
  return /*#__PURE__*/_react.default.createElement(_react2.SwiperSlide, {
168
182
  key: i,
@@ -13,8 +13,8 @@ var _Modal = require("../Modal");
13
13
  var _SignUpForm = require("../SignUpForm");
14
14
  var _Buttons = require("../../styles/Buttons");
15
15
  var _Confirm = require("../Confirm");
16
- var _UserDetails = require("../UserDetails");
17
16
  var _AddressList = require("../AddressList");
17
+ var _UserDetails = require("../UserDetails");
18
18
  var _styles = require("./styles");
19
19
  var _MdcCellphoneAndroid = _interopRequireDefault(require("@meronex/icons/mdc/MdcCellphoneAndroid"));
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -32,7 +32,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
32
32
  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; } }
33
33
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
34
  var ProductItemAccordion = function ProductItemAccordion(props) {
35
- var _theme$viewString, _props$beforeElements, _props$beforeComponen, _product$valid, _theme$images, _theme$images2, _product$calendar_eve, _configs$format_time, _product$calendar_eve2, _configs$format_time2, _props$afterComponent, _props$afterElements;
35
+ var _theme$viewString, _productInfo, _productInfo2, _props$beforeElements, _props$beforeComponen, _product$valid, _theme$images, _theme$images2, _product$calendar_eve, _configs$format_time, _product$calendar_eve2, _configs$format_time2, _props$afterComponent, _props$afterElements;
36
36
  var isDisabledEdit = props.isDisabledEdit,
37
37
  isCartPending = props.isCartPending,
38
38
  isCartProduct = props.isCartProduct,
@@ -96,6 +96,7 @@ var ProductItemAccordion = function ProductItemAccordion(props) {
96
96
  }
97
97
  return product;
98
98
  };
99
+ var showArrowIcon = props.showArrowIcon && (((_productInfo = productInfo()) === null || _productInfo === void 0 || (_productInfo = _productInfo.ingredients) === null || _productInfo === void 0 ? void 0 : _productInfo.length) > 0 || ((_productInfo2 = productInfo()) === null || _productInfo2 === void 0 || (_productInfo2 = _productInfo2.options) === null || _productInfo2 === void 0 ? void 0 : _productInfo2.length) > 0 || (product === null || product === void 0 ? void 0 : product.comment));
99
100
  var toggleAccordion = function toggleAccordion(e) {
100
101
  var _productSelect$curren, _productActionsEdit$c, _productActionsDelete;
101
102
  var isActionsClick = ((_productSelect$curren = productSelect.current) === null || _productSelect$curren === void 0 ? void 0 : _productSelect$curren.contains(e.target)) || ((_productActionsEdit$c = productActionsEdit.current) === null || _productActionsEdit$c === void 0 ? void 0 : _productActionsEdit$c.contains(e.target)) || ((_productActionsDelete = productActionsDelete.current) === null || _productActionsDelete === void 0 ? void 0 : _productActionsDelete.contains(e.target));
@@ -175,7 +176,9 @@ var ProductItemAccordion = function ProductItemAccordion(props) {
175
176
  onClick: function onClick() {
176
177
  return onDeleteProduct(product);
177
178
  }
178
- }))))))), product.valid && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ((product === null || product === void 0 ? void 0 : product.valid) || !isCartProduct) && windowSize.width > 410 && /*#__PURE__*/_react.default.createElement(_styles.ProductPriceSection, null, /*#__PURE__*/_react.default.createElement(_styles.ProductPrice, {
179
+ }))))))), showArrowIcon && /*#__PURE__*/_react.default.createElement(_IosArrowDown.default, {
180
+ className: "".concat(setRotate)
181
+ }), product.valid && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ((product === null || product === void 0 ? void 0 : product.valid) || !isCartProduct) && windowSize.width > 410 && /*#__PURE__*/_react.default.createElement(_styles.ProductPriceSection, null, /*#__PURE__*/_react.default.createElement(_styles.ProductPrice, {
179
182
  className: "prod-price"
180
183
  }, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(product.total || product.price)), (productInfo().ingredients.length > 0 || productInfo().options.length > 0 || product.comment) && /*#__PURE__*/_react.default.createElement("p", null, /*#__PURE__*/_react.default.createElement(_IosArrowDown.default, {
181
184
  className: "".concat(setRotate)
@@ -87,7 +87,8 @@ var RenderProductsLayout = function RenderProductsLayout(props) {
87
87
  handleChangePriceFilterValues = props.handleChangePriceFilterValues,
88
88
  priceFilterValues = props.priceFilterValues,
89
89
  handleUpdateProfessionals = props.handleUpdateProfessionals,
90
- isCustomerMode = props.isCustomerMode;
90
+ isCustomerMode = props.isCustomerMode,
91
+ handleCustomProductBannerClick = props.handleCustomProductBannerClick;
91
92
  var theme = (0, _styledComponents.useTheme)();
92
93
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
93
94
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
@@ -172,7 +173,9 @@ var RenderProductsLayout = function RenderProductsLayout(props) {
172
173
  })), (businessState === null || businessState === void 0 || (_businessState$busine3 = businessState.business) === null || _businessState$busine3 === void 0 ? void 0 : _businessState$busine3.id) && /*#__PURE__*/_react.default.createElement(_styles.PageBannerWrapper, null, /*#__PURE__*/_react.default.createElement(_PageBanner.PageBanner, {
173
174
  position: "web_business_page",
174
175
  businessId: businessState === null || businessState === void 0 || (_businessState$busine4 = businessState.business) === null || _businessState$busine4 === void 0 ? void 0 : _businessState$busine4.id,
175
- isCustomerMode: isCustomerMode
176
+ isCustomerMode: isCustomerMode,
177
+ handleCustomProductBannerClick: handleCustomProductBannerClick,
178
+ business: businessState === null || businessState === void 0 ? void 0 : businessState.business
176
179
  })), !errorQuantityProducts && SearchProductsComponent && !useKioskApp && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.WrapperSearch, null, /*#__PURE__*/_react.default.createElement(SearchProductsComponent, {
177
180
  handleChangeSearch: handleChangeSearch,
178
181
  searchValue: searchValue,
@@ -12,7 +12,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
12
12
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
13
13
  var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
14
14
  exports.Container = Container;
15
- var Header = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 5px;\n\n h1 {\n font-weight: 500;\n font-size: 20px;\n color: ", ";\n margin: 0px 10px 0px 0px;\n ", "\n }\n\n svg {\n font-size: 24px;\n }\n\n svg.cancel {\n color: #D81212;\n cursor: pointer;\n }\n\n span {\n font-size: 13px;\n color: ", ";\n cursor: pointer;\n user-select: none;\n &:hover {\n text-decoration: underline;\n }\n }\n"])), function (props) {
15
+ var Header = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 5px;\n\n h1 {\n font-weight: 500;\n font-size: 20px;\n color: ", "; \n margin: 0px 10px 0px 0px;\n ", "\n }\n\n svg {\n font-size: 24px;\n }\n\n svg.cancel {\n color: #D81212;\n cursor: pointer;\n }\n\n span {\n font-size: 13px;\n color: ", ";\n cursor: pointer;\n user-select: none;\n &:hover {\n text-decoration: underline;\n }\n }\n"])), function (props) {
16
16
  return props.theme.colors.darkTextColor;
17
17
  }, function (props) {
18
18
  var _props$theme;
@@ -37,7 +37,7 @@ var ModalIcon = _styledComponents.default.span(_templateObject8 || (_templateObj
37
37
  exports.ModalIcon = ModalIcon;
38
38
  var TitleContainer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n margin-top: 0;\n h1 {\n margin: auto;\n font-size: 24px;\n }\n ", "\n"])), function (_ref) {
39
39
  var isAddressFormOpen = _ref.isAddressFormOpen;
40
- return isAddressFormOpen && (0, _styledComponents.css)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n h1{\n width: 75%;\n }\n "])));
40
+ return isAddressFormOpen && (0, _styledComponents.css)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n h1{ \n width: 75%;\n }\n "])));
41
41
  });
42
42
  exports.TitleContainer = TitleContainer;
43
43
  var CountryFlag = _styledComponents.default.div(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-right: 5px;\n .PhoneInputCountryIcon {\n width: 25px;\n }\n .PhoneInputInput {\n display: none;\n }\n .PhoneInputCountrySelect {\n display: none;\n }\n"])));
@@ -12,7 +12,6 @@ var _Confirm = require("../../../src/components/Confirm");
12
12
  var _Modal = require("../Modal");
13
13
  var _Buttons = require("../../styles/Buttons");
14
14
  var _styles = require("./styles");
15
- var _useWindowSize = require("../../../../../hooks/useWindowSize");
16
15
  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
16
  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
17
  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; }
@@ -27,6 +26,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
27
26
  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; } }
28
27
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
28
  var SocketStatusUI = function SocketStatusUI(props) {
29
+ var _configs$white_label_;
30
30
  var socketStatus = props.socketStatus,
31
31
  reconnectAttemptCount = props.reconnectAttemptCount,
32
32
  connectedDate = props.connectedDate;
@@ -47,7 +47,10 @@ var SocketStatusUI = function SocketStatusUI(props) {
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
48
  openModal = _useState4[0],
49
49
  setOpenModal = _useState4[1];
50
- var windowSize = (0, _useWindowSize.useWindowSize)();
50
+ var _useConfig = (0, _orderingComponentsExternal.useConfig)(),
51
+ _useConfig2 = _slicedToArray(_useConfig, 1),
52
+ configs = _useConfig2[0].configs;
53
+ var isEnabledBtn = configs === null || configs === void 0 || (_configs$white_label_ = configs.white_label_module) === null || _configs$white_label_ === void 0 ? void 0 : _configs$white_label_.value;
51
54
  var closeAlert = function closeAlert() {
52
55
  setAlertState({
53
56
  open: false,
@@ -65,7 +68,7 @@ var SocketStatusUI = function SocketStatusUI(props) {
65
68
  }, [reconnectAttemptCount]);
66
69
  return /*#__PURE__*/_react.default.createElement(_styles.Contatiner, null, /*#__PURE__*/_react.default.createElement(_styles.InfoWrapper, null, /*#__PURE__*/_react.default.createElement(_Buttons.IconButton, {
67
70
  color: "primary"
68
- }, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.InfoCircle, null)), /*#__PURE__*/_react.default.createElement(_styles.InfoContent, null, t('WEBSOCKET_STATUS_APP_INFO', 'Verify the server connection by date and time using the Connection status button. Press update to refresh your app and update the status as well. Need help? Contact our Customer support team here:'), /*#__PURE__*/_react.default.createElement("a", {
71
+ }, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.InfoCircle, null)), /*#__PURE__*/_react.default.createElement(_styles.InfoContent, null, t('WEBSOCKET_STATUS_APP_INFO', 'Verify the server connection by date and time using the Connection status button. Press update to refresh your app and update the status as well. Need help? Contact our Customer support team here:'), !isEnabledBtn && /*#__PURE__*/_react.default.createElement("a", {
69
72
  href: "https://www.ordering.co/contact-ordering",
70
73
  target: "_blank",
71
74
  rel: "noopener noreferrer"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "10.6.2",
3
+ "version": "10.7.1",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -88,7 +88,7 @@
88
88
  "lodash": "^4.17.19",
89
89
  "moment": "^2.29.4",
90
90
  "nanoid": "^4.0.0",
91
- "ordering-components-external": "9.6.2",
91
+ "ordering-components-external": "9.7.1",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -20,7 +20,6 @@ import {
20
20
  } from 'ordering-components-external'
21
21
  import { Alert } from '../Confirm'
22
22
  import { GoogleGpsButton } from '../../../../../components/GoogleGpsButton'
23
-
24
23
  import {
25
24
  FormControl,
26
25
  FormActions,
@@ -34,13 +33,6 @@ import {
34
33
  import { Button } from '../../styles/Buttons'
35
34
  import { Input, TextArea } from '../../styles/Inputs'
36
35
 
37
- const inputNames = [
38
- { name: 'address', code: 'Address' },
39
- { name: 'internal_number', code: 'Internal number' },
40
- { name: 'zipcode', code: 'Zipcode' },
41
- { name: 'address_notes', code: 'Address notes' }
42
- ]
43
-
44
36
  const AddressFormUI = (props) => {
45
37
  const {
46
38
  addressesList,
@@ -54,7 +46,10 @@ const AddressFormUI = (props) => {
54
46
  handleChangeInput,
55
47
  saveAddress,
56
48
  setIsEdit,
57
- userCustomerSetup
49
+ userCustomerSetup,
50
+ businessesList,
51
+ getBusinessDeliveryZones,
52
+ isEnableContinueButton
58
53
  } = props
59
54
 
60
55
  const [configState] = useConfig()
@@ -79,13 +74,20 @@ const AddressFormUI = (props) => {
79
74
  const maxLimitLocation = configState?.configs?.meters_to_change_address?.value
80
75
  const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
81
76
  const isLocationRequired = configState.configs?.google_autocomplete_selection_required?.value === '1' ||
82
- configState.configs?.google_autocomplete_selection_required?.value === 'true'
77
+ configState.configs?.google_autocomplete_selection_required?.value === 'true'
83
78
 
84
79
  const mapErrors = {
85
80
  ERROR_NOT_FOUND_ADDRESS: 'Sorry, we couldn\'t find an address',
86
81
  ERROR_MAX_LIMIT_LOCATION: `Sorry, You can only set the position to ${maxLimitLocation}m`
87
82
  }
88
83
 
84
+ const inputNames = [
85
+ { name: 'address', code: 'Address' },
86
+ { name: 'internal_number', code: 'Internal number' },
87
+ { name: 'zipcode', code: 'Zipcode' },
88
+ { name: 'address_notes', code: 'Address notes' }
89
+ ]
90
+
89
91
  const closeAlert = () => {
90
92
  setAlertState({
91
93
  open: false,
@@ -231,6 +233,9 @@ const AddressFormUI = (props) => {
231
233
  }
232
234
 
233
235
  const handleChangeAddress = (address) => {
236
+ if (address?.address) {
237
+ getBusinessDeliveryZones(address?.location)
238
+ }
234
239
  setState({
235
240
  ...state,
236
241
  selectedFromAutocomplete: true
@@ -255,8 +260,8 @@ const AddressFormUI = (props) => {
255
260
  formMethods.setValue(
256
261
  field.name,
257
262
  formState?.changes[field.name] ||
258
- (orderState?.options?.address && orderState?.options?.address[field.name]) ||
259
- ''
263
+ (orderState?.options?.address && orderState?.options?.address[field.name]) ||
264
+ ''
260
265
  )
261
266
  )
262
267
  return
@@ -407,15 +412,19 @@ const AddressFormUI = (props) => {
407
412
  </AddressWrap>
408
413
 
409
414
  {locationChange && (addressState?.address?.location || formState?.changes?.location) && (
410
- <WrapperMap>
415
+ <WrapperMap isEnableContinueButton={isEnableContinueButton}>
411
416
  <GoogleMapsMap
417
+ useLocationPin
418
+ deactiveAlerts
412
419
  apiKey={googleMapsApiKey}
413
420
  location={locationChange}
421
+ locations={businessesList?.businesses}
414
422
  fixedLocation={!isEditing ? firstLocationNoEdit.value : null}
415
423
  mapControls={googleMapsControls}
416
424
  handleChangeAddressMap={handleChangeAddress}
417
425
  setErrors={setMapErrors}
418
426
  maxLimitLocation={maxLimitLocation}
427
+ businessZones={businessesList?.businesses?.map(business => business?.zones)}
419
428
  />
420
429
  </WrapperMap>
421
430
  )}
@@ -101,19 +101,24 @@ export const FormControl = styled.form`
101
101
  `
102
102
 
103
103
  export const AddressWrap = styled.div`
104
- width: 100%;
104
+ width: 50%;
105
105
  display: flex;
106
106
  justify-content: space-between;
107
107
  align-items: center;
108
- position: relative;
109
-
108
+ position: absolute;
109
+ bottom: 75%;
110
+ right: 0px;
111
+ padding-right: 20px;
110
112
  button {
111
113
  height: 41px;
112
- right: 1px;
114
+ right: 25px;
113
115
  border: none;
116
+ width: 25px;
117
+ position: absolute;
118
+ z-index: 1000;
114
119
 
115
120
  ${props => props.theme?.rtl && css`
116
- left: 1px;
121
+ left: 25px;
117
122
  right: initial;
118
123
  `}
119
124
 
@@ -191,8 +196,16 @@ export const AddressTagSection = styled.div`
191
196
  `
192
197
 
193
198
  export const WrapperMap = styled.div`
194
- width: 100%;
195
- height: 250px;
199
+ width: 50%;
200
+ position: absolute;
201
+ bottom: 2%;
202
+ right: 0;
203
+ padding-right: 20px;
204
+ ${({ isEnableContinueButton }) => isEnableContinueButton ? css`
205
+ height: 460px;
206
+ ` : css`
207
+ height: 480px;
208
+ `}
196
209
  > div {
197
210
  position: relative !important;
198
211
  width: 100% !important;
@@ -183,6 +183,12 @@ const AddressListUI = (props) => {
183
183
  }
184
184
  }, [])
185
185
 
186
+ useEffect(() => {
187
+ if (isOpenUserData) {
188
+ handleCloseAddressForm()
189
+ }
190
+ }, [isOpenUserData])
191
+
186
192
  return (
187
193
  <>
188
194
  {props.beforeElements?.map((BeforeElement, i) => (
@@ -193,9 +199,9 @@ const AddressListUI = (props) => {
193
199
  <BeforeComponent key={i} {...props} />))}
194
200
  <AddressListContainer id='address_control' isLoading={actionStatus?.loading || orderState?.loading}>
195
201
  <AddressHalfContainer>
196
- <List halfWidth={addressOpen} isOpenUserData={isOpenUserData} isHeader={isHeader}>
202
+ <List halfWidth={addressOpen} isOpenUserData={isOpenUserData} isHeader={isHeader} isEnableContinueButton={isEnableContinueButton}>
197
203
  {
198
- (!isPopover || !addressOpen) && (
204
+ (!isPopover || !addressOpen) && !isOpenUserData && (
199
205
  <Button
200
206
  className='add'
201
207
  outline
@@ -228,6 +234,7 @@ const AddressListUI = (props) => {
228
234
  !addressList.error &&
229
235
  addressList?.addresses?.length > 0 &&
230
236
  typeof orderState.options?.address === 'object' &&
237
+ !addressOpen &&
231
238
  ((!addressOpen && isPopover) || isModal) && (
232
239
  <AddressListUl id='list'>
233
240
  <AddressTitle>{t('SELECT_ONE_OF_SAVED_PLACES', 'Select one of your saved places')}</AddressTitle>
@@ -249,7 +256,7 @@ const AddressListUI = (props) => {
249
256
  </div>
250
257
  </div>
251
258
  <AddressItemActions className='form'>
252
- <a className={actionStatus.loading ? 'disabled' : ''} onClick={() => openAddress(address)}>
259
+ <a className={actionStatus.loading || isOpenUserData ? 'disabled' : ''} onClick={() => openAddress(address)}>
253
260
  <Pencil />
254
261
  </a>
255
262
  <a className={actionStatus.loading || address.default ? 'disabled' : ''} onClick={() => handleDeleteClick(address)}>
@@ -292,24 +299,29 @@ const AddressListUI = (props) => {
292
299
  content={t('NETWORK_ERROR', 'Network error, please reload the page')}
293
300
  />
294
301
  )}
302
+ {!isPopover && addressOpen && (
303
+ <AddressFormContainer>
304
+ <AddressForm
305
+ userId={userId}
306
+ addressesList={addressList?.addresses}
307
+ useValidationFileds
308
+ address={curAddress}
309
+ onCancel={() => handleCloseAddressForm()}
310
+ onSaveAddress={handleSaveAddress}
311
+ userCustomerSetup={userCustomerSetup}
312
+ isEnableContinueButton={isEnableContinueButton}
313
+ />
314
+ </AddressFormContainer>
315
+ )}
295
316
  </List>
296
- {!isPopover && addressOpen && (
297
- <AddressFormContainer>
317
+ {addressOpen && (
318
+ <AddressFormContainer width='50%' isEnableContinueButton={isEnableContinueButton}>
298
319
  <TitleFormContainer>
299
320
  <CloseIcon>
300
321
  <MdClose onClick={() => handleCloseAddressForm()} />
301
322
  </CloseIcon>
302
323
  <h1>{t('ADD_NEW_ADDRESS', 'Add new address')}</h1>
303
324
  </TitleFormContainer>
304
- <AddressForm
305
- userId={userId}
306
- addressesList={addressList?.addresses}
307
- useValidationFileds
308
- address={curAddress}
309
- onCancel={() => handleCloseAddressForm()}
310
- onSaveAddress={handleSaveAddress}
311
- userCustomerSetup={userCustomerSetup}
312
- />
313
325
  </AddressFormContainer>
314
326
  )}
315
327
  </AddressHalfContainer>
@@ -196,20 +196,27 @@ export const AddressHalfContainer = styled.div`
196
196
  export const List = styled.div`
197
197
  width: ${({ halfWidth }) => halfWidth ? '50%' : '100%'};
198
198
  padding-right: 10px;
199
- position: sticky;
200
- right: 0;
201
- top: 0;
202
- margin-top: 222px;
199
+ ${({ isEnableContinueButton, isOpenUserData }) => isEnableContinueButton || isOpenUserData ? css`
200
+ margin-top: 0px;
201
+ ` : css`
202
+ margin-top: 222px;
203
+ `}
203
204
  button {
204
205
  width: 100%;
205
206
  }
206
207
  `
207
208
 
208
209
  export const AddressFormContainer = styled.div`
209
- width: 50%;
210
210
  z-index: 10;
211
211
  height: 100%;
212
212
  padding-left: 10px;
213
+ ${({ width }) => css`
214
+ width: ${width};
215
+ `}
216
+ ${({ isEnableContinueButton }) => isEnableContinueButton && css`
217
+ position: relative;
218
+ bottom: 190px;
219
+ `}
213
220
  `
214
221
 
215
222
  export const CloseIcon = styled.div`
@@ -223,6 +230,7 @@ export const CloseIcon = styled.div`
223
230
  export const TitleFormContainer = styled.div`
224
231
  display: flex;
225
232
  align-items: center;
233
+ margin-top: 7px;
226
234
  h1 {
227
235
  margin: auto;
228
236
  font-size: 24px;