ordering-ui-external 1.5.4 → 1.5.5
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.cb87b9b647114f245c57.js +1 -0
- package/_bundles/{1.ordering-ui.5de718771fdf8a9bc402.js → 1.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/{2.ordering-ui.5de718771fdf8a9bc402.js → 2.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/{4.ordering-ui.5de718771fdf8a9bc402.js → 4.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/{5.ordering-ui.5de718771fdf8a9bc402.js → 5.ordering-ui.cb87b9b647114f245c57.js} +1 -1
- package/_bundles/{6.ordering-ui.5de718771fdf8a9bc402.js → 6.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/{7.ordering-ui.5de718771fdf8a9bc402.js → 7.ordering-ui.cb87b9b647114f245c57.js} +2 -2
- package/_bundles/{7.ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt → 7.ordering-ui.cb87b9b647114f245c57.js.LICENSE.txt} +0 -0
- package/_bundles/{8.ordering-ui.5de718771fdf8a9bc402.js → 8.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/{9.ordering-ui.5de718771fdf8a9bc402.js → 9.ordering-ui.cb87b9b647114f245c57.js} +0 -0
- package/_bundles/ordering-ui.cb87b9b647114f245c57.js +2 -0
- package/_bundles/{ordering-ui.5de718771fdf8a9bc402.js.LICENSE.txt → ordering-ui.cb87b9b647114f245c57.js.LICENSE.txt} +0 -0
- package/_modules/themes/five/src/components/Cart/index.js +13 -2
- package/_modules/themes/five/src/components/ServiceForm/index.js +33 -7
- package/_modules/themes/five/src/components/ServiceForm/styles.js +8 -3
- package/package.json +2 -2
- package/src/themes/five/src/components/Cart/index.js +24 -9
- package/src/themes/five/src/components/ServiceForm/index.js +162 -139
- package/src/themes/five/src/components/ServiceForm/styles.js +10 -0
- package/_bundles/0.ordering-ui.5de718771fdf8a9bc402.js +0 -1
- package/_bundles/ordering-ui.5de718771fdf8a9bc402.js +0 -2
|
File without changes
|
|
@@ -22,6 +22,7 @@ var _Inputs = require("../../styles/Inputs");
|
|
|
22
22
|
var _SpinnerLoader = require("../../../../../components/SpinnerLoader");
|
|
23
23
|
var _CartStoresListing = require("../../../../franchise/src/components/CartStoresListing");
|
|
24
24
|
var _DriverTips = require("../DriverTips");
|
|
25
|
+
var _ServiceForm = require("../ServiceForm");
|
|
25
26
|
var _styles = require("./styles");
|
|
26
27
|
var _utils = require("../../../../../utils");
|
|
27
28
|
var _BsInfoCircle = _interopRequireDefault(require("@meronex/icons/bs/BsInfoCircle"));
|
|
@@ -40,7 +41,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
40
41
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
42
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
42
43
|
var CartUI = function CartUI(props) {
|
|
43
|
-
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _Object$values, _orderState$carts, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _orderingTheme$theme$5, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products2, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options, _cart$offers7, _cart$offers8, _cart$offers8$filter, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options2, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _cart$business2, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
|
|
44
|
+
var _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _validationFields$fie, _validationFields$fie2, _validationFields$fie3, _configs$checkout_mul, _Object$values, _orderState$carts, _orderingTheme$theme, _orderingTheme$theme$, _orderingTheme$theme$2, _orderingTheme$theme$3, _orderingTheme$theme$4, _orderingTheme$theme$5, _orderState$option, _orderState$option2, _props$beforeElements, _props$beforeComponen, _cart$products2, _cart$offers, _cart$offers2, _cart$offers3, _cart$offers3$filter, _cart$offers4, _cart$offers4$filter, _cart$business, _ref, _cart$subtotal_with_d, _cart$taxes2, _cart$taxes3, _cart$fees, _cart$fees2, _cart$offers5, _cart$offers6, _cart$offers6$filter, _orderState$options, _cart$offers7, _cart$offers8, _cart$offers8$filter, _configs$driver_tip_t, _configs$driver_tip_u, _orderState$options2, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _configs$driver_tip_t2, _configs$driver_tip_u2, _configs$driver_tip_t3, _cart$payment_events, _cart$payment_events2, _cart$business2, _cart$business3, _curProduct$calendar_, _openTaxModal$data, _openTaxModal$data2, _openTaxModal$data3, _openTaxModal$data4, _openTaxModal$data$fi, _openTaxModal$data5, _openTaxModal$data6, _props$afterComponent, _props$afterElements;
|
|
44
45
|
var currentCartUuid = props.currentCartUuid,
|
|
45
46
|
clearCart = props.clearCart,
|
|
46
47
|
isProducts = props.isProducts,
|
|
@@ -534,7 +535,7 @@ var CartUI = function CartUI(props) {
|
|
|
534
535
|
return setModalIsOpen(false);
|
|
535
536
|
},
|
|
536
537
|
disableOverflowX: true
|
|
537
|
-
}, /*#__PURE__*/_react.default.createElement(_ProductForm.ProductForm, {
|
|
538
|
+
}, !(curProduct !== null && curProduct !== void 0 && curProduct.calendar_event) ? /*#__PURE__*/_react.default.createElement(_ProductForm.ProductForm, {
|
|
538
539
|
isCartProduct: true,
|
|
539
540
|
productCart: curProduct,
|
|
540
541
|
businessSlug: cart === null || cart === void 0 ? void 0 : (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.slug,
|
|
@@ -542,6 +543,16 @@ var CartUI = function CartUI(props) {
|
|
|
542
543
|
categoryId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.category_id,
|
|
543
544
|
productId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.id,
|
|
544
545
|
onSave: handlerProductAction
|
|
546
|
+
}) : /*#__PURE__*/_react.default.createElement(_ServiceForm.ServiceForm, {
|
|
547
|
+
isCartProduct: true,
|
|
548
|
+
isService: true,
|
|
549
|
+
productCart: curProduct,
|
|
550
|
+
businessSlug: cart === null || cart === void 0 ? void 0 : (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug,
|
|
551
|
+
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
552
|
+
categoryId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.category_id,
|
|
553
|
+
productId: curProduct === null || curProduct === void 0 ? void 0 : curProduct.id,
|
|
554
|
+
onSave: handlerProductAction,
|
|
555
|
+
professionalSelected: curProduct === null || curProduct === void 0 ? void 0 : (_curProduct$calendar_ = curProduct.calendar_event) === null || _curProduct$calendar_ === void 0 ? void 0 : _curProduct$calendar_.professional
|
|
545
556
|
})), /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
546
557
|
width: "70%",
|
|
547
558
|
open: openTaxModal.open,
|
|
@@ -8,6 +8,7 @@ exports.ServiceForm = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _react2 = require("swiper/react");
|
|
10
10
|
var _orderingComponentsExternal = require("ordering-components-external");
|
|
11
|
+
var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
|
|
11
12
|
var _Confirm = require("../Confirm");
|
|
12
13
|
var _Modal = require("../Modal");
|
|
13
14
|
var _LoginForm = require("../LoginForm");
|
|
@@ -38,14 +39,18 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
38
39
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
40
|
_swiper.default.use([_swiper.Navigation]);
|
|
40
41
|
var ServiceFormUI = function ServiceFormUI(props) {
|
|
41
|
-
var _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6;
|
|
42
|
-
var
|
|
42
|
+
var _professionalListStat3, _theme$defaultLanguag, _theme$defaultLanguag2, _theme$defaultLanguag3, _theme$defaultLanguag4, _theme$defaultLanguag5, _theme$defaultLanguag6;
|
|
43
|
+
var productObject = props.productObject,
|
|
43
44
|
professionalSelected = props.professionalSelected,
|
|
44
45
|
handleSave = props.handleSave,
|
|
45
46
|
isSoldOut = props.isSoldOut,
|
|
46
47
|
maxProductQuantity = props.maxProductQuantity,
|
|
47
48
|
productCart = props.productCart,
|
|
48
|
-
|
|
49
|
+
isCartProduct = props.isCartProduct,
|
|
50
|
+
professionalListState = props.professionalListState;
|
|
51
|
+
var product = productObject.product,
|
|
52
|
+
loading = productObject.loading,
|
|
53
|
+
error = productObject.error;
|
|
49
54
|
var theme = (0, _styledComponents.useTheme)();
|
|
50
55
|
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
51
56
|
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
@@ -179,10 +184,31 @@ var ServiceFormUI = function ServiceFormUI(props) {
|
|
|
179
184
|
};
|
|
180
185
|
}, [isDropDown]);
|
|
181
186
|
(0, _react.useEffect)(function () {
|
|
182
|
-
if (!professionalSelected) return;
|
|
187
|
+
if (!(professionalSelected !== null && professionalSelected !== void 0 && professionalSelected.schedule)) return;
|
|
183
188
|
setCurrentProfessional(professionalSelected);
|
|
184
189
|
}, [professionalSelected]);
|
|
185
|
-
|
|
190
|
+
(0, _react.useEffect)(function () {
|
|
191
|
+
var _professionalListStat;
|
|
192
|
+
if (isCartProduct && (professionalListState === null || professionalListState === void 0 ? void 0 : (_professionalListStat = professionalListState.professionals) === null || _professionalListStat === void 0 ? void 0 : _professionalListStat.length) > 0) {
|
|
193
|
+
var _professionalListStat2;
|
|
194
|
+
var professional = professionalListState === null || professionalListState === void 0 ? void 0 : (_professionalListStat2 = professionalListState.professionals) === null || _professionalListStat2 === void 0 ? void 0 : _professionalListStat2.find(function (item) {
|
|
195
|
+
return item.id === (professionalSelected === null || professionalSelected === void 0 ? void 0 : professionalSelected.id);
|
|
196
|
+
});
|
|
197
|
+
setCurrentProfessional(professional);
|
|
198
|
+
}
|
|
199
|
+
}, [isCartProduct, professionalListState === null || professionalListState === void 0 ? void 0 : professionalListState.professionals]);
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.Container, null, loading && !error && /*#__PURE__*/_react.default.createElement(_styles.SkeletonBlock, {
|
|
201
|
+
width: 90
|
|
202
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
203
|
+
variant: "rect",
|
|
204
|
+
height: 50
|
|
205
|
+
}), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
206
|
+
variant: "rect",
|
|
207
|
+
height: 50
|
|
208
|
+
}), /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
209
|
+
variant: "rect",
|
|
210
|
+
height: 200
|
|
211
|
+
})), product && !loading && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_styles.ImageWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.SwiperWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.ArrowButtonWrapper, {
|
|
186
212
|
className: "button-prev"
|
|
187
213
|
}, /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ChevronLeft, null)), /*#__PURE__*/_react.default.createElement(_react2.Swiper, {
|
|
188
214
|
spaceBetween: 0,
|
|
@@ -221,7 +247,7 @@ var ServiceFormUI = function ServiceFormUI(props) {
|
|
|
221
247
|
className: "status"
|
|
222
248
|
}, t('BUSY_ON_SELECTED_TIME', 'Busy on selected time'))) : /*#__PURE__*/_react.default.createElement("span", {
|
|
223
249
|
className: "status"
|
|
224
|
-
}, t('AVAILABLE', 'Available'))))) : /*#__PURE__*/_react.default.createElement("p", null, t('SELECT_PROFESSIONAL', 'Select professional')), /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ChevronDown, null)), isDropDown && /*#__PURE__*/_react.default.createElement(_styles.DropDownWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.DropDownTitle, null, t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')),
|
|
250
|
+
}, t('AVAILABLE', 'Available'))))) : /*#__PURE__*/_react.default.createElement("p", null, t('SELECT_PROFESSIONAL', 'Select professional')), /*#__PURE__*/_react.default.createElement(_reactBootstrapIcons.ChevronDown, null)), isDropDown && /*#__PURE__*/_react.default.createElement(_styles.DropDownWrapper, null, /*#__PURE__*/_react.default.createElement(_styles.DropDownTitle, null, t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')), professionalListState === null || professionalListState === void 0 ? void 0 : (_professionalListStat3 = professionalListState.professionals) === null || _professionalListStat3 === void 0 ? void 0 : _professionalListStat3.map(function (professional) {
|
|
225
251
|
return /*#__PURE__*/_react.default.createElement(_styles.SelectedItem, {
|
|
226
252
|
key: professional === null || professional === void 0 ? void 0 : professional.id,
|
|
227
253
|
isDropDown: true,
|
|
@@ -260,7 +286,7 @@ var ServiceFormUI = function ServiceFormUI(props) {
|
|
|
260
286
|
onClick: function onClick() {
|
|
261
287
|
return setModalIsOpen(true);
|
|
262
288
|
}
|
|
263
|
-
}, isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag = theme.defaultLanguages) === null || _theme$defaultLanguag === void 0 ? void 0 : _theme$defaultLanguag.SOLD_OUT) || 'Sold out') : t('LOGIN_SIGNUP', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag2 = theme.defaultLanguages) === null || _theme$defaultLanguag2 === void 0 ? void 0 : _theme$defaultLanguag2.LOGIN_SIGNUP) || 'Login / Sign Up'))), modalIsOpen && !auth && /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
289
|
+
}, isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag = theme.defaultLanguages) === null || _theme$defaultLanguag === void 0 ? void 0 : _theme$defaultLanguag.SOLD_OUT) || 'Sold out') : t('LOGIN_SIGNUP', (theme === null || theme === void 0 ? void 0 : (_theme$defaultLanguag2 = theme.defaultLanguages) === null || _theme$defaultLanguag2 === void 0 ? void 0 : _theme$defaultLanguag2.LOGIN_SIGNUP) || 'Login / Sign Up')))), modalIsOpen && !auth && /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
264
290
|
open: modalIsOpen,
|
|
265
291
|
onClose: function onClose() {
|
|
266
292
|
return closeModal();
|
|
@@ -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.SwiperWrapper = exports.StatusInfo = exports.SelectedItem = exports.SectionHeader = exports.ScheduleWrapper = exports.ProfessionalSelectWrapper = exports.ProfessionalPhoto = exports.ProfessionalInfoWrapper = exports.PriceAndDuration = exports.NameWrapper = exports.InfoWrapper = exports.ImageWrapper = exports.HeaderInfoWrapper = exports.EmptyProfessional = exports.DropDownWrapper = exports.DropDownTitle = exports.Divider = exports.Container = exports.ButtonWrapper = exports.ArrowButtonWrapper = void 0;
|
|
7
|
+
exports.SwiperWrapper = exports.StatusInfo = exports.SkeletonBlock = exports.SelectedItem = exports.SectionHeader = exports.ScheduleWrapper = exports.ProfessionalSelectWrapper = exports.ProfessionalPhoto = exports.ProfessionalInfoWrapper = exports.PriceAndDuration = exports.NameWrapper = exports.InfoWrapper = exports.ImageWrapper = exports.HeaderInfoWrapper = exports.EmptyProfessional = exports.DropDownWrapper = exports.DropDownTitle = exports.Divider = exports.Container = exports.ButtonWrapper = exports.ArrowButtonWrapper = 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;
|
|
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; }
|
|
@@ -100,4 +100,9 @@ var StatusInfo = _styledComponents.default.div(_templateObject22 || (_templateOb
|
|
|
100
100
|
});
|
|
101
101
|
exports.StatusInfo = StatusInfo;
|
|
102
102
|
var EmptyProfessional = _styledComponents.default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n min-height: 100px;\n margin-bottom: 100px;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
103
|
-
exports.EmptyProfessional = EmptyProfessional;
|
|
103
|
+
exports.EmptyProfessional = EmptyProfessional;
|
|
104
|
+
var SkeletonBlock = _styledComponents.default.div(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n width: ", ";\n border-radius: 16px;\n margin: 50px auto 20px auto;\n\n span {\n margin-bottom: 10px;\n }\n"])), function (_ref4) {
|
|
105
|
+
var width = _ref4.width;
|
|
106
|
+
return width && "".concat(width, "%");
|
|
107
|
+
});
|
|
108
|
+
exports.SkeletonBlock = SkeletonBlock;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ordering-ui-external",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "Ordering UI Components",
|
|
5
5
|
"main": "./_modules/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"libphonenumber-js": "^1.9.4",
|
|
86
86
|
"lodash": "^4.17.19",
|
|
87
87
|
"moment": "^2.29.4",
|
|
88
|
-
"ordering-components-external": "1.4.
|
|
88
|
+
"ordering-components-external": "1.4.1",
|
|
89
89
|
"polished": "^3.6.6",
|
|
90
90
|
"react-bootstrap-icons": "^1.7.2",
|
|
91
91
|
"react-calendar": "^3.3.1",
|
|
@@ -15,6 +15,7 @@ import { TextArea } from '../../styles/Inputs'
|
|
|
15
15
|
import { SpinnerLoader } from '../../../../../components/SpinnerLoader'
|
|
16
16
|
import { CartStoresListing } from '../../../../franchise/src/components/CartStoresListing'
|
|
17
17
|
import { DriverTips } from '../DriverTips'
|
|
18
|
+
import { ServiceForm } from '../ServiceForm'
|
|
18
19
|
import {
|
|
19
20
|
CartContainer,
|
|
20
21
|
OrderBill,
|
|
@@ -565,15 +566,29 @@ const CartUI = (props) => {
|
|
|
565
566
|
onClose={() => setModalIsOpen(false)}
|
|
566
567
|
disableOverflowX
|
|
567
568
|
>
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
569
|
+
{!curProduct?.calendar_event ? (
|
|
570
|
+
<ProductForm
|
|
571
|
+
isCartProduct
|
|
572
|
+
productCart={curProduct}
|
|
573
|
+
businessSlug={cart?.business?.slug}
|
|
574
|
+
businessId={cart?.business_id}
|
|
575
|
+
categoryId={curProduct?.category_id}
|
|
576
|
+
productId={curProduct?.id}
|
|
577
|
+
onSave={handlerProductAction}
|
|
578
|
+
/>
|
|
579
|
+
) : (
|
|
580
|
+
<ServiceForm
|
|
581
|
+
isCartProduct
|
|
582
|
+
isService
|
|
583
|
+
productCart={curProduct}
|
|
584
|
+
businessSlug={cart?.business?.slug}
|
|
585
|
+
businessId={cart?.business_id}
|
|
586
|
+
categoryId={curProduct?.category_id}
|
|
587
|
+
productId={curProduct?.id}
|
|
588
|
+
onSave={handlerProductAction}
|
|
589
|
+
professionalSelected={curProduct?.calendar_event?.professional}
|
|
590
|
+
/>
|
|
591
|
+
)}
|
|
577
592
|
</Modal>
|
|
578
593
|
<Modal
|
|
579
594
|
width='70%'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
|
3
3
|
import { useUtils, useLanguage, useSession, ProductForm as ProductFormController } from 'ordering-components-external'
|
|
4
|
+
import Skeleton from 'react-loading-skeleton'
|
|
4
5
|
import { Alert } from '../Confirm'
|
|
5
6
|
import { Modal } from '../Modal'
|
|
6
7
|
import { LoginForm } from '../LoginForm'
|
|
@@ -34,22 +35,25 @@ import {
|
|
|
34
35
|
StatusInfo,
|
|
35
36
|
DropDownWrapper,
|
|
36
37
|
DropDownTitle,
|
|
37
|
-
EmptyProfessional
|
|
38
|
+
EmptyProfessional,
|
|
39
|
+
SkeletonBlock
|
|
38
40
|
} from './styles'
|
|
39
41
|
import moment from 'moment'
|
|
40
42
|
SwiperCore.use([Navigation])
|
|
41
43
|
|
|
42
44
|
const ServiceFormUI = (props) => {
|
|
43
45
|
const {
|
|
44
|
-
|
|
46
|
+
productObject,
|
|
45
47
|
professionalSelected,
|
|
46
48
|
handleSave,
|
|
47
49
|
isSoldOut,
|
|
48
50
|
maxProductQuantity,
|
|
49
51
|
productCart,
|
|
50
|
-
|
|
52
|
+
isCartProduct,
|
|
53
|
+
professionalListState
|
|
51
54
|
} = props
|
|
52
55
|
|
|
56
|
+
const { product, loading, error } = productObject
|
|
53
57
|
const theme = useTheme()
|
|
54
58
|
const [, t] = useLanguage()
|
|
55
59
|
const [{ parsePrice, parseDate }] = useUtils()
|
|
@@ -151,102 +155,84 @@ const ServiceFormUI = (props) => {
|
|
|
151
155
|
}, [isDropDown])
|
|
152
156
|
|
|
153
157
|
useEffect(() => {
|
|
154
|
-
if (!professionalSelected) return
|
|
158
|
+
if (!professionalSelected?.schedule) return
|
|
155
159
|
setCurrentProfessional(professionalSelected)
|
|
156
160
|
}, [professionalSelected])
|
|
157
161
|
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (isCartProduct && professionalListState?.professionals?.length > 0) {
|
|
164
|
+
const professional = professionalListState?.professionals?.find(item => item.id === professionalSelected?.id)
|
|
165
|
+
setCurrentProfessional(professional)
|
|
166
|
+
}
|
|
167
|
+
}, [isCartProduct, professionalListState?.professionals])
|
|
168
|
+
|
|
158
169
|
return (
|
|
159
170
|
<>
|
|
160
171
|
<Container>
|
|
161
|
-
|
|
162
|
-
<
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
{isBusyTime(currentProfessional) ? (
|
|
216
|
-
<>
|
|
217
|
-
<span className='status'>{t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')}</span>
|
|
218
|
-
</>
|
|
219
|
-
) : (
|
|
220
|
-
<span className='status'>{t('AVAILABLE', 'Available')}</span>
|
|
221
|
-
)}
|
|
222
|
-
</StatusInfo>
|
|
223
|
-
</NameWrapper>
|
|
224
|
-
</InfoWrapper>
|
|
225
|
-
) : (
|
|
226
|
-
<p>{t('SELECT_PROFESSIONAL', 'Select professional')}</p>
|
|
227
|
-
)}
|
|
228
|
-
<ChevronDown />
|
|
229
|
-
</SelectedItem>
|
|
230
|
-
{isDropDown && (
|
|
231
|
-
<DropDownWrapper>
|
|
232
|
-
<DropDownTitle>{t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')}</DropDownTitle>
|
|
233
|
-
{professionalList?.map((professional) => (
|
|
234
|
-
<SelectedItem
|
|
235
|
-
key={professional?.id}
|
|
236
|
-
isDropDown
|
|
237
|
-
active={professional?.id === currentProfessional?.id}
|
|
238
|
-
onClick={() => handleChangeProfessional(professional)}
|
|
239
|
-
>
|
|
172
|
+
{loading && !error && (
|
|
173
|
+
<SkeletonBlock width={90}>
|
|
174
|
+
<Skeleton variant='rect' height={50} />
|
|
175
|
+
<Skeleton variant='rect' height={50} />
|
|
176
|
+
<Skeleton variant='rect' height={200} />
|
|
177
|
+
</SkeletonBlock>
|
|
178
|
+
)}
|
|
179
|
+
{product && !loading && (
|
|
180
|
+
<>
|
|
181
|
+
<ImageWrapper>
|
|
182
|
+
<SwiperWrapper>
|
|
183
|
+
<ArrowButtonWrapper className='button-prev'>
|
|
184
|
+
<ChevronLeft />
|
|
185
|
+
</ArrowButtonWrapper>
|
|
186
|
+
<Swiper
|
|
187
|
+
spaceBetween={0}
|
|
188
|
+
slidesPerView={1}
|
|
189
|
+
watchSlidesProgress
|
|
190
|
+
className='mySwiper2'
|
|
191
|
+
preventClicksPropagation={false}
|
|
192
|
+
navigation={{
|
|
193
|
+
nextEl: '.button-next',
|
|
194
|
+
prevEl: '.button-prev'
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
{gallery?.map((photo, i) => (
|
|
198
|
+
<SwiperSlide key={i}>
|
|
199
|
+
<img src={photo} alt='' />
|
|
200
|
+
</SwiperSlide>
|
|
201
|
+
))}
|
|
202
|
+
</Swiper>
|
|
203
|
+
<ArrowButtonWrapper className='button-next'>
|
|
204
|
+
<ChevronRight />
|
|
205
|
+
</ArrowButtonWrapper>
|
|
206
|
+
</SwiperWrapper>
|
|
207
|
+
</ImageWrapper>
|
|
208
|
+
<HeaderInfoWrapper>
|
|
209
|
+
<h2>{product?.name}</h2>
|
|
210
|
+
<PriceAndDuration>
|
|
211
|
+
<span>{parsePrice(product?.price)}</span>
|
|
212
|
+
<span className='dot'>•</span>
|
|
213
|
+
<span>{product?.duration}min</span>
|
|
214
|
+
</PriceAndDuration>
|
|
215
|
+
<p>{product?.description}</p>
|
|
216
|
+
</HeaderInfoWrapper>
|
|
217
|
+
<Divider />
|
|
218
|
+
<ProfessionalInfoWrapper>
|
|
219
|
+
<SectionHeader>
|
|
220
|
+
<h2>{t('PROFESSIONALS', 'Professionals')}</h2>
|
|
221
|
+
<span>{t('REQUIRED', 'Required')}</span>
|
|
222
|
+
</SectionHeader>
|
|
223
|
+
<ProfessionalSelectWrapper ref={dropDownRef}>
|
|
224
|
+
<SelectedItem onClick={() => setIsDropDown(prev => !prev)}>
|
|
225
|
+
{currentProfessional ? (
|
|
240
226
|
<InfoWrapper>
|
|
241
|
-
{
|
|
227
|
+
{currentProfessional?.photo ? (
|
|
242
228
|
<ProfessionalPhoto
|
|
243
|
-
bgimage={
|
|
229
|
+
bgimage={currentProfessional?.photo}
|
|
244
230
|
/>
|
|
245
231
|
) : <FaUserAlt />}
|
|
246
232
|
<NameWrapper>
|
|
247
|
-
<p>{
|
|
248
|
-
<StatusInfo available={!isBusyTime(
|
|
249
|
-
{isBusyTime(
|
|
233
|
+
<p>{currentProfessional?.name} {currentProfessional?.lastname}</p>
|
|
234
|
+
<StatusInfo available={!isBusyTime()}>
|
|
235
|
+
{isBusyTime(currentProfessional) ? (
|
|
250
236
|
<>
|
|
251
237
|
<span className='status'>{t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')}</span>
|
|
252
238
|
</>
|
|
@@ -256,58 +242,95 @@ const ServiceFormUI = (props) => {
|
|
|
256
242
|
</StatusInfo>
|
|
257
243
|
</NameWrapper>
|
|
258
244
|
</InfoWrapper>
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
245
|
+
) : (
|
|
246
|
+
<p>{t('SELECT_PROFESSIONAL', 'Select professional')}</p>
|
|
247
|
+
)}
|
|
248
|
+
<ChevronDown />
|
|
249
|
+
</SelectedItem>
|
|
250
|
+
{isDropDown && (
|
|
251
|
+
<DropDownWrapper>
|
|
252
|
+
<DropDownTitle>{t('ANY_PROFESSIONAL_MEMBER', 'Any professional member')}</DropDownTitle>
|
|
253
|
+
{professionalListState?.professionals?.map((professional) => (
|
|
254
|
+
<SelectedItem
|
|
255
|
+
key={professional?.id}
|
|
256
|
+
isDropDown
|
|
257
|
+
active={professional?.id === currentProfessional?.id}
|
|
258
|
+
onClick={() => handleChangeProfessional(professional)}
|
|
259
|
+
>
|
|
260
|
+
<InfoWrapper>
|
|
261
|
+
{professional?.photo ? (
|
|
262
|
+
<ProfessionalPhoto
|
|
263
|
+
bgimage={professional?.photo}
|
|
264
|
+
/>
|
|
265
|
+
) : <FaUserAlt />}
|
|
266
|
+
<NameWrapper>
|
|
267
|
+
<p>{professional?.name} {professional?.lastname}</p>
|
|
268
|
+
<StatusInfo available={!isBusyTime(professional)}>
|
|
269
|
+
{isBusyTime(professional) ? (
|
|
270
|
+
<>
|
|
271
|
+
<span className='status'>{t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')}</span>
|
|
272
|
+
</>
|
|
273
|
+
) : (
|
|
274
|
+
<span className='status'>{t('AVAILABLE', 'Available')}</span>
|
|
275
|
+
)}
|
|
276
|
+
</StatusInfo>
|
|
277
|
+
</NameWrapper>
|
|
278
|
+
</InfoWrapper>
|
|
279
|
+
</SelectedItem>
|
|
280
|
+
))}
|
|
281
|
+
</DropDownWrapper>
|
|
282
|
+
)}
|
|
283
|
+
|
|
284
|
+
</ProfessionalSelectWrapper>
|
|
285
|
+
</ProfessionalInfoWrapper>
|
|
286
|
+
<ScheduleWrapper>
|
|
287
|
+
<SectionHeader>
|
|
288
|
+
<h2>{t('SCHEDULE', 'Schedule')}</h2>
|
|
289
|
+
<span>{t('REQUIRED', 'Required')}</span>
|
|
290
|
+
</SectionHeader>
|
|
291
|
+
{currentProfessional ? (
|
|
292
|
+
<BusinessPreorder
|
|
293
|
+
business={currentProfessional}
|
|
294
|
+
isProfessional
|
|
295
|
+
maxDays={50}
|
|
296
|
+
onChangeMoment={setDateSelected}
|
|
297
|
+
useOrderContext={false}
|
|
298
|
+
/>
|
|
299
|
+
) : (
|
|
300
|
+
<EmptyProfessional>
|
|
301
|
+
{t('NO_SCHEDULE', 'No schedule')}
|
|
302
|
+
</EmptyProfessional>
|
|
303
|
+
)}
|
|
304
|
+
</ScheduleWrapper>
|
|
305
|
+
<ButtonWrapper>
|
|
306
|
+
<span>{dateSelected
|
|
307
|
+
? parseDate(dateSelected, { outputFormat: 'hh:mm a' })
|
|
308
|
+
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
309
|
+
</span>
|
|
310
|
+
{!isSoldOut && maxProductQuantity > 0 && auth && (
|
|
311
|
+
<Button
|
|
312
|
+
onClick={() => handleAddProduct()}
|
|
313
|
+
color='primary'
|
|
314
|
+
disabled={isBusyTime(currentProfessional)}
|
|
315
|
+
>
|
|
316
|
+
{t('BOOK', 'Book')}
|
|
317
|
+
</Button>
|
|
318
|
+
)}
|
|
319
|
+
{(!auth || isSoldOut || maxProductQuantity <= 0) && (
|
|
320
|
+
<Button
|
|
321
|
+
className={`add ${!(productCart && !isSoldOut && maxProductQuantity > 0) ? 'soldout' : ''}`}
|
|
322
|
+
color='primary'
|
|
323
|
+
outline
|
|
324
|
+
disabled={isSoldOut || maxProductQuantity <= 0}
|
|
325
|
+
onClick={() => setModalIsOpen(true)}
|
|
326
|
+
>
|
|
327
|
+
{isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
|
|
328
|
+
</Button>
|
|
329
|
+
)}
|
|
330
|
+
</ButtonWrapper>
|
|
331
|
+
</>
|
|
332
|
+
)}
|
|
263
333
|
|
|
264
|
-
</ProfessionalSelectWrapper>
|
|
265
|
-
</ProfessionalInfoWrapper>
|
|
266
|
-
<ScheduleWrapper>
|
|
267
|
-
<SectionHeader>
|
|
268
|
-
<h2>{t('SCHEDULE', 'Schedule')}</h2>
|
|
269
|
-
<span>{t('REQUIRED', 'Required')}</span>
|
|
270
|
-
</SectionHeader>
|
|
271
|
-
{currentProfessional ? (
|
|
272
|
-
<BusinessPreorder
|
|
273
|
-
business={currentProfessional}
|
|
274
|
-
isProfessional
|
|
275
|
-
maxDays={50}
|
|
276
|
-
onChangeMoment={setDateSelected}
|
|
277
|
-
useOrderContext={false}
|
|
278
|
-
/>
|
|
279
|
-
) : (
|
|
280
|
-
<EmptyProfessional>
|
|
281
|
-
{t('NO_SCHEDULE', 'No schedule')}
|
|
282
|
-
</EmptyProfessional>
|
|
283
|
-
)}
|
|
284
|
-
</ScheduleWrapper>
|
|
285
|
-
<ButtonWrapper>
|
|
286
|
-
<span>{dateSelected
|
|
287
|
-
? parseDate(dateSelected, { outputFormat: 'hh:mm a' })
|
|
288
|
-
: t('ASAP_ABBREVIATION', 'ASAP')}
|
|
289
|
-
</span>
|
|
290
|
-
{!isSoldOut && maxProductQuantity > 0 && auth && (
|
|
291
|
-
<Button
|
|
292
|
-
onClick={() => handleAddProduct()}
|
|
293
|
-
color='primary'
|
|
294
|
-
disabled={isBusyTime(currentProfessional)}
|
|
295
|
-
>
|
|
296
|
-
{t('BOOK', 'Book')}
|
|
297
|
-
</Button>
|
|
298
|
-
)}
|
|
299
|
-
{(!auth || isSoldOut || maxProductQuantity <= 0) && (
|
|
300
|
-
<Button
|
|
301
|
-
className={`add ${!(productCart && !isSoldOut && maxProductQuantity > 0) ? 'soldout' : ''}`}
|
|
302
|
-
color='primary'
|
|
303
|
-
outline
|
|
304
|
-
disabled={isSoldOut || maxProductQuantity <= 0}
|
|
305
|
-
onClick={() => setModalIsOpen(true)}
|
|
306
|
-
>
|
|
307
|
-
{isSoldOut || maxProductQuantity <= 0 ? t('SOLD_OUT', theme?.defaultLanguages?.SOLD_OUT || 'Sold out') : t('LOGIN_SIGNUP', theme?.defaultLanguages?.LOGIN_SIGNUP || 'Login / Sign Up')}
|
|
308
|
-
</Button>
|
|
309
|
-
)}
|
|
310
|
-
</ButtonWrapper>
|
|
311
334
|
{modalIsOpen && !auth && (
|
|
312
335
|
<Modal
|
|
313
336
|
open={modalIsOpen}
|
|
@@ -311,3 +311,13 @@ export const EmptyProfessional = styled.div`
|
|
|
311
311
|
align-items: center;
|
|
312
312
|
justify-content: center;
|
|
313
313
|
`
|
|
314
|
+
|
|
315
|
+
export const SkeletonBlock = styled.div`
|
|
316
|
+
width: ${({ width }) => width && `${width}%`};
|
|
317
|
+
border-radius: 16px;
|
|
318
|
+
margin: 50px auto 20px auto;
|
|
319
|
+
|
|
320
|
+
span {
|
|
321
|
+
margin-bottom: 10px;
|
|
322
|
+
}
|
|
323
|
+
`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(window.webpackJsonpOrderingUI=window.webpackJsonpOrderingUI||[]).push([[0],{596:function(t,n,e){"use strict";function i(t,n){var e,i;return"boolean"==typeof(null==n?void 0:n.enabled)?n.enabled:null===(i=null===(e=null==t?void 0:t.__default)||void 0===e?void 0:e.enabled)||void 0===i||i}e.d(n,"a",(function(){return i}))},698:function(t,n,e){"use strict";e.r(n),e.d(n,"LegacyDestination",(function(){return O})),e.d(n,"ajsDestinations",(function(){return _}));var i=e(3),r=e(55),o=e(46),a=e(18),s=e(101),c=e(64),u=e(63),d=e(596),l=e(189),h=e(193),v=e(47),f=e(69),b=e(335),p=e(85),g=e(106);function y(t){return t.toLowerCase().replace(".","").replace(/\s+/g,"-")}function j(t,n){return void 0===n&&(n=!1),n?btoa(t).replace(/=/g,""):void 0}function m(t,n,e,r,o,a){return Object(i.b)(this,void 0,void 0,(function(){var s,c,u,d,l,h,v,f;return Object(i.d)(this,(function(b){switch(b.label){case 0:s=y(e),c=j(s,a),u=Object(p.b)(),d="".concat(u,"/integrations/").concat(null!=c?c:s,"/").concat(r,"/").concat(null!=c?c:s,".dynamic.js.gz"),b.label=1;case 1:return b.trys.push([1,3,,4]),[4,Object(g.a)(d)];case 2:return b.sent(),function(t,n,e){var r,o;try{var a=(null!==(o=null===(r=null===window||void 0===window?void 0:window.performance)||void 0===r?void 0:r.getEntriesByName(t,"resource"))&&void 0!==o?o:[])[0];a&&n.stats.gauge("legacy_destination_time",Math.round(a.duration),Object(i.f)([e],a.duration<100?["cached"]:[],!0))}catch(t){}}(d,t,e),[3,4];case 3:throw l=b.sent(),t.stats.gauge("legacy_destination_time",-1,["plugin:".concat(e),"failed"]),l;case 4:return h=window["".concat(s,"Deps")],[4,Promise.all(h.map((function(t){return Object(g.a)(u+t+".gz")})))];case 5:return b.sent(),window["".concat(s,"Loader")](),(v=window["".concat(s,"Integration")]).Integration&&(v({user:function(){return n.user()},addIntegration:function(){}}),v=v.Integration),(f=new v(o)).analytics=n,[2,f]}}))}))}function w(t,n){return Object(i.b)(this,void 0,void 0,(function(){var e,r=this;return Object(i.d)(this,(function(s){switch(s.label){case 0:return e=[],Object(o.a)()?[2,n]:[4,Object(h.a)((function(){return n.length>0&&Object(o.b)()}),(function(){return Object(i.b)(r,void 0,void 0,(function(){var r,o;return Object(i.d)(this,(function(i){switch(i.label){case 0:return(r=n.pop())?[4,Object(c.a)(r,t)]:[2];case 1:return o=i.sent(),o instanceof a.a||e.push(r),[2]}}))}))}))];case 1:return s.sent(),e.map((function(t){return n.pushWithBackoff(t)})),[2,n]}}))}))}var O=function(){function t(t,n,e,r){void 0===e&&(e={}),this.options={},this.type="destination",this.middleware=[],this._ready=!1,this._initialized=!1,this.flushing=!1,this.name=t,this.version=n,this.settings=Object(i.a)({},e),this.settings.type&&"browser"===this.settings.type&&delete this.settings.type,this.options=r,this.buffer=r.disableClientPersistence?new v.b(4,[]):new f.a(4,"dest-".concat(t)),this.scheduleFlush()}return t.prototype.isLoaded=function(){return this._ready},t.prototype.ready=function(){var t;return null!==(t=this.onReady)&&void 0!==t?t:Promise.resolve()},t.prototype.load=function(t,n){return Object(i.b)(this,void 0,void 0,(function(){var e,r=this;return Object(i.d)(this,(function(i){switch(i.label){case 0:return this._ready||void 0!==this.onReady?[2]:(e=this,[4,m(t,n,this.name,this.version,this.settings,this.options.obfuscate)]);case 1:e.integration=i.sent(),this.onReady=new Promise((function(t){r.integration.once("ready",(function(){r._ready=!0,t(!0)}))})),this.onInitialize=new Promise((function(t){r.integration.on("initialize",(function(){r._initialized=!0,t(!0)}))}));try{t.stats.increment("analytics_js.integration.invoke",1,["method:initialize","integration_name:".concat(this.name)]),this.integration.initialize()}catch(n){throw t.stats.increment("analytics_js.integration.invoke.error",1,["method:initialize","integration_name:".concat(this.name)]),n}return[2]}}))}))},t.prototype.unload=function(t,n){return function(t,n,e){return Object(i.b)(this,void 0,void 0,(function(){var r,o,a,s;return Object(i.d)(this,(function(i){return r=Object(p.b)(),o=y(t),a=j(t,e),s="".concat(r,"/integrations/").concat(null!=a?a:o,"/").concat(n,"/").concat(null!=a?a:o,".dynamic.js.gz"),[2,Object(g.b)(s)]}))}))}(this.name,this.version,this.options.obfuscate)},t.prototype.addMiddleware=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];this.middleware=(t=this.middleware).concat.apply(t,n)},t.prototype.shouldBuffer=function(t){return"page"!==t.event.type&&(Object(o.a)()||!1===this._ready||!1===this._initialized)},t.prototype.send=function(t,n,e){var r,o;return Object(i.b)(this,void 0,void 0,(function(){var s,c,l,h,v,f;return Object(i.d)(this,(function(p){switch(p.label){case 0:if(this.shouldBuffer(t))return this.buffer.push(t),this.scheduleFlush(),[2,t];if(s=null===(o=null===(r=this.options)||void 0===r?void 0:r.plan)||void 0===o?void 0:o.track,c=t.event.event,s&&c&&"Segment.io"!==this.name){if(l=s[c],!Object(d.a)(s,l))return t.updateEvent("integrations",Object(i.a)(Object(i.a)({},t.event.integrations),{All:!1,"Segment.io":!0})),t.cancel(new a.b({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t];if(t.updateEvent("integrations",Object(i.a)(Object(i.a)({},t.event.integrations),null==l?void 0:l.integrations)),(null==l?void 0:l.enabled)&&!1===(null==l?void 0:l.integrations[this.name]))return t.cancel(new a.b({retry:!1,reason:"Event ".concat(c," disabled for integration ").concat(this.name," in tracking plan"),type:"Dropped by plan"})),[2,t]}return[4,Object(b.applyDestinationMiddleware)(this.name,t.event,this.middleware)];case 1:if(null===(h=p.sent()))return[2,t];v=new n(h,{}),t.stats.increment("analytics_js.integration.invoke",1,["method:".concat(e),"integration_name:".concat(this.name)]),p.label=2;case 2:return p.trys.push([2,5,,6]),this.integration?[4,Object(u.a)(this.integration.invoke.call(this.integration,e,v))]:[3,4];case 3:p.sent(),p.label=4;case 4:return[3,6];case 5:throw f=p.sent(),t.stats.increment("analytics_js.integration.invoke.error",1,["method:".concat(e),"integration_name:".concat(this.name)]),f;case 6:return[2,t]}}))}))},t.prototype.track=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Track,"track")]}))}))},t.prototype.page=function(t){var n;return Object(i.b)(this,void 0,void 0,(function(){var e=this;return Object(i.d)(this,(function(i){return(null===(n=this.integration)||void 0===n?void 0:n._assumesPageview)&&!this._initialized&&this.integration.initialize(),[2,this.onInitialize.then((function(){return e.send(t,r.Page,"page")}))]}))}))},t.prototype.identify=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Identify,"identify")]}))}))},t.prototype.alias=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Alias,"alias")]}))}))},t.prototype.group=function(t){return Object(i.b)(this,void 0,void 0,(function(){return Object(i.d)(this,(function(n){return[2,this.send(t,r.Group,"group")]}))}))},t.prototype.scheduleFlush=function(){var t=this;this.flushing||setTimeout((function(){return Object(i.b)(t,void 0,void 0,(function(){var t;return Object(i.d)(this,(function(n){switch(n.label){case 0:return this.flushing=!0,t=this,[4,w(this,this.buffer)];case 1:return t.buffer=n.sent(),this.flushing=!1,this.buffer.todo>0&&this.scheduleFlush(),[2]}}))}))}),5e3*Math.random())},t}();function _(t,n,e,i){var r,o;if(void 0===n&&(n={}),void 0===e&&(e={}),Object(s.b)())return[];t.plan&&((e=null!=e?e:{}).plan=t.plan);var a=null!==(o=null===(r=t.middlewareSettings)||void 0===r?void 0:r.routingRules)&&void 0!==o?o:[],c=Object(l.a)(t,null!=e?e:{});return Object.entries(t.integrations).map((function(t){var r,o=t[0],s=t[1];if(!o.startsWith("Segment")){var u=!1===n.All&&void 0===n[o];if(!1!==n[o]&&!u){var d=s.type,l=s.bundlingStatus,h=s.versionSettings;if(("unbundled"!==l&&("browser"===d||(null===(r=null==h?void 0:h.componentTypes)||void 0===r?void 0:r.includes("browser")))||"Segment.io"===o)&&"Iterable"!==o){var v=function(t){var n,e,i,r;return null!==(r=null!==(e=null===(n=t.versionSettings)||void 0===n?void 0:n.override)&&void 0!==e?e:null===(i=t.versionSettings)||void 0===i?void 0:i.version)&&void 0!==r?r:"latest"}(s),f=new O(o,v,c[o],e);return a.filter((function(t){return t.destinationName===o})).length>0&&i&&f.addMiddleware(i),f}}}})).filter((function(t){return void 0!==t}))}}}]);
|