ordering-ui-external 14.1.2 → 14.1.4
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/_modules/themes/five/src/components/BusinessPreorder/index.js +17 -11
- package/_modules/themes/five/src/components/BusinessProductsList/index.js +11 -7
- package/_modules/themes/five/src/components/MomentControl/index.js +2 -2
- package/package.json +1 -1
- package/src/themes/five/src/components/BusinessPreorder/index.js +21 -11
- package/src/themes/five/src/components/BusinessProductsList/index.js +2 -2
- package/src/themes/five/src/components/MomentControl/index.js +1 -1
|
@@ -134,16 +134,21 @@ var BusinessPreorderUI = function BusinessPreorderUI(props) {
|
|
|
134
134
|
};
|
|
135
135
|
(0, _react.useEffect)(function () {
|
|
136
136
|
if (cateringPreorder) {
|
|
137
|
-
var
|
|
137
|
+
var _timeLists2;
|
|
138
|
+
var _timeLists = [];
|
|
138
139
|
var schedule = business && getActualSchedule();
|
|
139
|
-
if (!schedule &&
|
|
140
|
-
|
|
140
|
+
if (!schedule && business) {
|
|
141
|
+
setTimeList([]);
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
|
-
|
|
144
|
-
var _Object$
|
|
145
|
-
return (((_Object$
|
|
146
|
-
|
|
144
|
+
_timeLists = hoursList.filter(function (hour) {
|
|
145
|
+
var _Object$keys, _schedule$lapses;
|
|
146
|
+
return (((_Object$keys = Object.keys(business || {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) === 0 || (schedule === null || schedule === void 0 || (_schedule$lapses = schedule.lapses) === null || _schedule$lapses === void 0 ? void 0 : _schedule$lapses.some(function (lapse) {
|
|
147
|
+
var openHour = lapse.open.hour < 10 ? "0".concat(lapse.open.hour) : lapse.open.hour;
|
|
148
|
+
var openMinute = lapse.open.minute < 10 ? "0".concat(lapse.open.minute) : lapse.open.minute;
|
|
149
|
+
var closeHour = lapse.close.hour < 10 ? "0".concat(lapse.close.hour) : lapse.close.hour;
|
|
150
|
+
var closeMinute = lapse.close.minute < 10 ? "0".concat(lapse.close.minute) : lapse.close.minute;
|
|
151
|
+
return (0, _moment2.default)(dateSelected + " ".concat(hour.startTime)) >= (0, _moment2.default)(dateSelected + " ".concat(openHour, ":").concat(openMinute)).add(preorderLeadTime, 'minutes') && (0, _moment2.default)(dateSelected + " ".concat(hour.endTime)) <= (0, _moment2.default)(dateSelected + " ".concat(closeHour, ":").concat(closeMinute));
|
|
147
152
|
}))) && (0, _moment2.default)(dateSelected + " ".concat(hour.startTime)) < (0, _moment2.default)(dateSelected + " ".concat(hour.endTime)) && ((0, _moment2.default)().add(preorderLeadTime, 'minutes') < (0, _moment2.default)(dateSelected + " ".concat(hour.startTime)) || !cateringPreorder);
|
|
148
153
|
}).map(function (hour) {
|
|
149
154
|
return {
|
|
@@ -160,14 +165,15 @@ var BusinessPreorderUI = function BusinessPreorderUI(props) {
|
|
|
160
165
|
})
|
|
161
166
|
};
|
|
162
167
|
});
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
if (((_timeLists2 = _timeLists) === null || _timeLists2 === void 0 ? void 0 : _timeLists2.length) > 0) {
|
|
169
|
+
setTimeList(_timeLists);
|
|
170
|
+
}
|
|
165
171
|
} else {
|
|
166
172
|
var selectedMenu = menu ? menu !== null && menu !== void 0 && menu.use_business_schedule ? business : menu : business;
|
|
167
173
|
var _times = getTimeList(dateSelected, selectedMenu);
|
|
168
174
|
setTimeList(_times);
|
|
169
175
|
}
|
|
170
|
-
}, [dateSelected, menu, business, cateringPreorder, hoursList]);
|
|
176
|
+
}, [dateSelected, menu, JSON.stringify(business), cateringPreorder, JSON.stringify(hoursList), dateSelected]);
|
|
171
177
|
(0, _react.useEffect)(function () {
|
|
172
178
|
if (type === 'business_hours') setMenu(null);
|
|
173
179
|
}, [type]);
|
|
@@ -227,7 +233,7 @@ var BusinessPreorderUI = function BusinessPreorderUI(props) {
|
|
|
227
233
|
return handleChangeDate(date);
|
|
228
234
|
}
|
|
229
235
|
}, /*#__PURE__*/_react.default.createElement(_styles.DayName, null, dayName), /*#__PURE__*/_react.default.createElement(_styles.DayNumber, null, dayNumber)));
|
|
230
|
-
})))), /*#__PURE__*/_react.default.createElement(_styles.TimeListWrapper, null, isEnabled && (timeList === null || timeList === void 0 ? void 0 : timeList.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, timeList.map(function (time, i) {
|
|
236
|
+
})))), /*#__PURE__*/_react.default.createElement(_styles.TimeListWrapper, null, (isEnabled || cateringPreorder) && (timeList === null || timeList === void 0 ? void 0 : timeList.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, timeList.map(function (time, i) {
|
|
231
237
|
return /*#__PURE__*/_react.default.createElement(_styles.TimeItem, {
|
|
232
238
|
key: i,
|
|
233
239
|
active: timeSelected === time.value,
|
|
@@ -200,7 +200,7 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
|
|
|
200
200
|
})))), !(category !== null && category !== void 0 && category.id) && categories.filter(function (category) {
|
|
201
201
|
return (category === null || category === void 0 ? void 0 : category.id) !== null;
|
|
202
202
|
}).map(function (category, i, _categories) {
|
|
203
|
-
var _categoryState$produc5, _categoryState$produc6, _categoryState$produc7, _categoryState$produc8, _category$description, _category$description2, _category$subcategori4, _category$subcategori5, _category$ribbon, _category$ribbon2, _category$ribbon3, _category$ribbon4, _category$ribbon5, _headerRef$current2, _category$description3, _category$subcategori6, _category$subcategori7, _products$filter, _category$subcategori8, _category$subcategori9;
|
|
203
|
+
var _categoryState$produc5, _categoryState$produc6, _categoryState$produc7, _categoryState$produc8, _category$description, _category$description2, _category$subcategori4, _category$subcategori5, _category$ribbon, _category$ribbon2, _category$ribbon3, _category$ribbon4, _category$ribbon5, _headerRef$current2, _category$description3, _category$subcategori6, _category$subcategori7, _products$sort$filter, _category$subcategori8, _category$subcategori9;
|
|
204
204
|
var _products = !isUseParentCategory ? (_categoryState$produc5 = categoryState === null || categoryState === void 0 || (_categoryState$produc6 = categoryState.products) === null || _categoryState$produc6 === void 0 ? void 0 : _categoryState$produc6.filter(function (product) {
|
|
205
205
|
return (product === null || product === void 0 ? void 0 : product.category_id) === (category === null || category === void 0 ? void 0 : category.id);
|
|
206
206
|
})) !== null && _categoryState$produc5 !== void 0 ? _categoryState$produc5 : [] : (_categoryState$produc7 = categoryState === null || categoryState === void 0 || (_categoryState$produc8 = categoryState.products) === null || _categoryState$produc8 === void 0 ? void 0 : _categoryState$produc8.filter(function (product) {
|
|
@@ -251,9 +251,11 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
|
|
|
251
251
|
onClickSubcategory: onClickSubcategory
|
|
252
252
|
})), /*#__PURE__*/_react.default.createElement(_styles.ProductsListing, {
|
|
253
253
|
isSubcategorySearch: isSubcategorySearch
|
|
254
|
-
}, isSearchMode && (category === null || category === void 0 || (_category$subcategori7 = category.subcategories) === null || _category$subcategori7 === void 0 ? void 0 : _category$subcategori7.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 || (_products$filter = products.
|
|
254
|
+
}, isSearchMode && (category === null || category === void 0 || (_category$subcategori7 = category.subcategories) === null || _category$subcategori7 === void 0 ? void 0 : _category$subcategori7.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 || (_products$sort$filter = products.sort(function (a, b) {
|
|
255
|
+
return (a.rank || 0) - (b.rank || 0);
|
|
256
|
+
}).filter(function (product, i) {
|
|
255
257
|
return i < 9 && (product === null || product === void 0 ? void 0 : product.category_id) === (category === null || category === void 0 ? void 0 : category.id) || (business === null || business === void 0 ? void 0 : business.food);
|
|
256
|
-
})) === null || _products$filter === void 0 ? void 0 : _products$filter.map(function (product, i) {
|
|
258
|
+
})) === null || _products$sort$filter === void 0 ? void 0 : _products$sort$filter.map(function (product, i) {
|
|
257
259
|
var _currentCart$products5;
|
|
258
260
|
return /*#__PURE__*/_react.default.createElement(_SingleProductCard.SingleProductCard, {
|
|
259
261
|
key: i,
|
|
@@ -280,7 +282,9 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
|
|
|
280
282
|
display: 'flex',
|
|
281
283
|
justifyContent: 'center'
|
|
282
284
|
}
|
|
283
|
-
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products.
|
|
285
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, products === null || products === void 0 ? void 0 : products.sort(function (a, b) {
|
|
286
|
+
return (a.rank || 0) - (b.rank || 0);
|
|
287
|
+
}).filter(function (_, i) {
|
|
284
288
|
return i < 9 || (business === null || business === void 0 ? void 0 : business.food);
|
|
285
289
|
}).map(function (product, i) {
|
|
286
290
|
var _currentCart$products6;
|
|
@@ -319,14 +323,14 @@ var BusinessProductsListUI = function BusinessProductsListUI(props) {
|
|
|
319
323
|
return (product === null || product === void 0 ? void 0 : product.category_id) === (subcategory === null || subcategory === void 0 ? void 0 : subcategory.id);
|
|
320
324
|
});
|
|
321
325
|
})) === null || _category$subcategori9 === void 0 ? void 0 : _category$subcategori9.map(function (subcategory) {
|
|
322
|
-
var _products$
|
|
326
|
+
var _products$filter;
|
|
323
327
|
return /*#__PURE__*/_react.default.createElement(_styles.SubcategorySearchContainer, {
|
|
324
328
|
key: subcategory === null || subcategory === void 0 ? void 0 : subcategory.id
|
|
325
329
|
}, /*#__PURE__*/_react.default.createElement("h4", null, subcategory === null || subcategory === void 0 ? void 0 : subcategory.name), /*#__PURE__*/_react.default.createElement(_styles.ProductsListing, {
|
|
326
330
|
isSubcategorySearch: isSubcategorySearch
|
|
327
|
-
}, products === null || products === void 0 || (_products$
|
|
331
|
+
}, products === null || products === void 0 || (_products$filter = products.filter(function (product) {
|
|
328
332
|
return (product === null || product === void 0 ? void 0 : product.category_id) === (subcategory === null || subcategory === void 0 ? void 0 : subcategory.id);
|
|
329
|
-
})) === null || _products$
|
|
333
|
+
})) === null || _products$filter === void 0 ? void 0 : _products$filter.map(function (product, i) {
|
|
330
334
|
var _currentCart$products7;
|
|
331
335
|
return /*#__PURE__*/_react.default.createElement(_SingleProductCard.SingleProductCard, {
|
|
332
336
|
key: i,
|
|
@@ -37,7 +37,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
37
37
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
38
|
_swiper.default.use([_swiper.Navigation]);
|
|
39
39
|
var MomentControlUI = function MomentControlUI(props) {
|
|
40
|
-
var _configs$general_hour, _datesList$slice, _configs$max_days_pre, _configs$max_days_pre2, _configs$max_days_pre3, _configs$max_days_pre4, _configs$max_days_pre5, _configs$max_days_pre6;
|
|
40
|
+
var _configs$general_hour, _configs$general_hour2, _datesList$slice, _configs$max_days_pre, _configs$max_days_pre2, _configs$max_days_pre3, _configs$max_days_pre4, _configs$max_days_pre5, _configs$max_days_pre6;
|
|
41
41
|
var isAsap = props.isAsap,
|
|
42
42
|
datesList = props.datesList,
|
|
43
43
|
hoursList = props.hoursList,
|
|
@@ -209,7 +209,7 @@ var MomentControlUI = function MomentControlUI(props) {
|
|
|
209
209
|
return handleCheckBoxChange(true);
|
|
210
210
|
},
|
|
211
211
|
isLoading: orderState === null || orderState === void 0 ? void 0 : orderState.loading
|
|
212
|
-
}, isASP ? /*#__PURE__*/_react.default.createElement(_styles.CheckedIcon, null) : /*#__PURE__*/_react.default.createElement(_CgRadioCheck.default, null), /*#__PURE__*/_react.default.createElement("span", null, t('CHECKOUT_ASAP', 'ASAP'), " (", (0, _moment.default)(new Date()).format(
|
|
212
|
+
}, isASP ? /*#__PURE__*/_react.default.createElement(_styles.CheckedIcon, null) : /*#__PURE__*/_react.default.createElement(_CgRadioCheck.default, null), /*#__PURE__*/_react.default.createElement("span", null, t('CHECKOUT_ASAP', 'ASAP'), " (", (0, _moment.default)(new Date()).format("dddd, MMMM DD, YYYY ".concat(configs === null || configs === void 0 || (_configs$general_hour2 = configs.general_hour_format) === null || _configs$general_hour2 === void 0 ? void 0 : _configs$general_hour2.value)), " + ", t('DELIVERY_TIME', 'delivery time'), ")")), /*#__PURE__*/_react.default.createElement(_styles.CheckBoxWrapper, {
|
|
213
213
|
highlight: !isASP,
|
|
214
214
|
onClick: function onClick() {
|
|
215
215
|
return handleCheckBoxChange(null);
|
package/package.json
CHANGED
|
@@ -132,16 +132,25 @@ const BusinessPreorderUI = (props) => {
|
|
|
132
132
|
|
|
133
133
|
useEffect(() => {
|
|
134
134
|
if (cateringPreorder) {
|
|
135
|
+
let _timeLists = []
|
|
135
136
|
const schedule = business && getActualSchedule()
|
|
136
|
-
if (!schedule &&
|
|
137
|
-
|
|
137
|
+
if (!schedule && business) {
|
|
138
|
+
setTimeList([])
|
|
138
139
|
return
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
|
|
142
|
+
_timeLists = hoursList
|
|
143
|
+
.filter(hour => {
|
|
144
|
+
return (Object.keys(business || {})?.length === 0 || schedule?.lapses?.some((lapse) => {
|
|
145
|
+
const openHour = lapse.open.hour < 10 ? `0${lapse.open.hour}` : lapse.open.hour
|
|
146
|
+
const openMinute = lapse.open.minute < 10 ? `0${lapse.open.minute}` : lapse.open.minute
|
|
147
|
+
const closeHour = lapse.close.hour < 10 ? `0${lapse.close.hour}` : lapse.close.hour
|
|
148
|
+
const closeMinute = lapse.close.minute < 10 ? `0${lapse.close.minute}` : lapse.close.minute
|
|
149
|
+
return moment(dateSelected + ` ${hour.startTime}`) >= moment(dateSelected + ` ${openHour}:${openMinute}`).add(preorderLeadTime, 'minutes') && moment(dateSelected + ` ${hour.endTime}`) <= moment(dateSelected + ` ${closeHour}:${closeMinute}`)
|
|
150
|
+
})) &&
|
|
151
|
+
(moment(dateSelected + ` ${hour.startTime}`) < moment(dateSelected + ` ${hour.endTime}`)) &&
|
|
152
|
+
(moment().add(preorderLeadTime, 'minutes') < moment(dateSelected + ` ${hour.startTime}`) || !cateringPreorder)
|
|
153
|
+
})
|
|
145
154
|
.map(hour => {
|
|
146
155
|
return {
|
|
147
156
|
value: hour.startTime,
|
|
@@ -161,14 +170,15 @@ const BusinessPreorderUI = (props) => {
|
|
|
161
170
|
)
|
|
162
171
|
}
|
|
163
172
|
})
|
|
164
|
-
|
|
165
|
-
|
|
173
|
+
if (_timeLists?.length > 0) {
|
|
174
|
+
setTimeList(_timeLists)
|
|
175
|
+
}
|
|
166
176
|
} else {
|
|
167
177
|
const selectedMenu = menu ? (menu?.use_business_schedule ? business : menu) : business
|
|
168
178
|
const _times = getTimeList(dateSelected, selectedMenu)
|
|
169
179
|
setTimeList(_times)
|
|
170
180
|
}
|
|
171
|
-
}, [dateSelected, menu, business, cateringPreorder, hoursList])
|
|
181
|
+
}, [dateSelected, menu, JSON.stringify(business), cateringPreorder, JSON.stringify(hoursList), dateSelected])
|
|
172
182
|
|
|
173
183
|
useEffect(() => {
|
|
174
184
|
if (type === 'business_hours') setMenu(null)
|
|
@@ -263,7 +273,7 @@ const BusinessPreorderUI = (props) => {
|
|
|
263
273
|
</DateWrapper>
|
|
264
274
|
|
|
265
275
|
<TimeListWrapper>
|
|
266
|
-
{(isEnabled && timeList?.length > 0) ? (
|
|
276
|
+
{((isEnabled || cateringPreorder) && timeList?.length > 0) ? (
|
|
267
277
|
<>
|
|
268
278
|
{timeList.map((time, i) => (
|
|
269
279
|
<TimeItem
|
|
@@ -258,7 +258,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
258
258
|
<ProductsListing isSubcategorySearch={isSubcategorySearch}>
|
|
259
259
|
{isSearchMode && category?.subcategories?.length > 0 ? (
|
|
260
260
|
<>
|
|
261
|
-
{products?.filter((product, i) => (i < 9 && product?.category_id === category?.id) || business?.food)?.map((product, i) => (
|
|
261
|
+
{products?.sort((a, b) => (a.rank || 0) - (b.rank || 0)).filter((product, i) => (i < 9 && product?.category_id === category?.id) || business?.food)?.map((product, i) => (
|
|
262
262
|
<SingleProductCard
|
|
263
263
|
key={i}
|
|
264
264
|
isSoldOut={product.inventoried && !product.quantity}
|
|
@@ -288,7 +288,7 @@ const BusinessProductsListUI = (props) => {
|
|
|
288
288
|
) : (
|
|
289
289
|
<>
|
|
290
290
|
{
|
|
291
|
-
products.filter((_, i) => i < 9 || business?.food).map((product, i) => (
|
|
291
|
+
products?.sort((a, b) => (a.rank || 0) - (b.rank || 0)).filter((_, i) => i < 9 || business?.food).map((product, i) => (
|
|
292
292
|
<SingleProductCard
|
|
293
293
|
key={i}
|
|
294
294
|
isSoldOut={product.inventoried && !product.quantity}
|
|
@@ -256,7 +256,7 @@ const MomentControlUI = (props) => {
|
|
|
256
256
|
isLoading={orderState?.loading}
|
|
257
257
|
>
|
|
258
258
|
{isASP ? <CheckedIcon /> : <CgRadioCheck />}
|
|
259
|
-
<span>{t('CHECKOUT_ASAP', 'ASAP')} ({moment(new Date()).format(
|
|
259
|
+
<span>{t('CHECKOUT_ASAP', 'ASAP')} ({moment(new Date()).format(`dddd, MMMM DD, YYYY ${configs?.general_hour_format?.value}`)} + {t('DELIVERY_TIME', 'delivery time')})</span>
|
|
260
260
|
</CheckBoxWrapper>
|
|
261
261
|
)}
|
|
262
262
|
<CheckBoxWrapper
|