ordering-components-external 13.2.24 → 13.2.26
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/{7.ordering-component.0599c79450fa3a01dd9f.js → 7.ordering-component.9b055f2425a125b458fe.js} +1 -1
- package/_bundles/ordering-component.9b055f2425a125b458fe.js +2 -0
- package/_bundles/{ordering-component.0599c79450fa3a01dd9f.js.LICENSE.txt → ordering-component.9b055f2425a125b458fe.js.LICENSE.txt} +2 -2
- package/_modules/components/OrdersDashboardComponents/UserFormDetails/index.js +2 -2
- package/_modules/components/ProductOptionSuboption/index.js +37 -4
- package/_modules/components/UserFormDetails/index.js +2 -2
- package/_modules/contexts/OrderContext/index.js +2 -2
- package/_modules/contexts/UtilsContext/index.js +15 -15
- package/package.json +1 -1
- package/src/components/ProductOptionSuboption/index.js +48 -4
- package/src/contexts/UtilsContext/index.js +1 -1
- package/_bundles/ordering-component.0599c79450fa3a01dd9f.js +0 -2
- /package/_bundles/{0.ordering-component.0599c79450fa3a01dd9f.js → 0.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{1.ordering-component.0599c79450fa3a01dd9f.js → 1.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{2.ordering-component.0599c79450fa3a01dd9f.js → 2.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{4.ordering-component.0599c79450fa3a01dd9f.js → 4.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{5.ordering-component.0599c79450fa3a01dd9f.js → 5.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{6.ordering-component.0599c79450fa3a01dd9f.js → 6.ordering-component.9b055f2425a125b458fe.js} +0 -0
- /package/_bundles/{7.ordering-component.0599c79450fa3a01dd9f.js.LICENSE.txt → 7.ordering-component.9b055f2425a125b458fe.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-component.0599c79450fa3a01dd9f.js → 8.ordering-component.9b055f2425a125b458fe.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* decimal.js v10.
|
|
2
|
+
* decimal.js v10.5.0
|
|
3
3
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
4
4
|
* https://github.com/MikeMcl/decimal.js
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
6
6
|
* MIT Licence
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -20,8 +20,8 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
20
20
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
21
21
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
22
22
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
23
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
24
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
23
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
25
25
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
26
26
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -73,13 +73,16 @@ var ProductOptionSuboption = exports.ProductOptionSuboption = function ProductOp
|
|
|
73
73
|
var selectStatus = isOrigin ? !state.selected : state.selected;
|
|
74
74
|
var minMaxValidation = option.with_half_option ? usePizzaValidation : balance === option.max && !((option === null || option === void 0 ? void 0 : option.max) === 1 && (option === null || option === void 0 ? void 0 : option.min) === 1);
|
|
75
75
|
var canBeSelectedByHalf = (pizzaState === null || pizzaState === void 0 || (_pizzaState2 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState2 === void 0 ? void 0 : _pizzaState2.value) === option.max - 0.5 && option.with_half_option;
|
|
76
|
+
var shouldApplyHalfLogic = (option === null || option === void 0 ? void 0 : option.with_half_option) && (option === null || option === void 0 ? void 0 : option.allow_suboption_quantity) && (option === null || option === void 0 ? void 0 : option.limit_suboptions_by_max);
|
|
77
|
+
var remainingBalance = option.max - balance;
|
|
78
|
+
var canOnlySelectHalf = shouldApplyHalfLogic && remainingBalance < 1 && remainingBalance > 0;
|
|
76
79
|
if (selectStatus && (option.limit_suboptions_by_max || isAlsea) && minMaxValidation && !canBeSelectedByHalf) {
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
changeState(_objectSpread(_objectSpread({}, state), {}, {
|
|
80
83
|
quantity: state.selected ? 0 : 1,
|
|
81
84
|
selected: !state.selected,
|
|
82
|
-
position: canBeSelectedByHalf ? 'left' : 'whole'
|
|
85
|
+
position: canBeSelectedByHalf || canOnlySelectHalf ? 'left' : 'whole'
|
|
83
86
|
}));
|
|
84
87
|
};
|
|
85
88
|
|
|
@@ -87,12 +90,27 @@ var ProductOptionSuboption = exports.ProductOptionSuboption = function ProductOp
|
|
|
87
90
|
* Increment suboption quantity
|
|
88
91
|
*/
|
|
89
92
|
var increment = function increment() {
|
|
93
|
+
var shouldApplyHalfLogic = (option === null || option === void 0 ? void 0 : option.with_half_option) && (option === null || option === void 0 ? void 0 : option.allow_suboption_quantity) && (option === null || option === void 0 ? void 0 : option.limit_suboptions_by_max);
|
|
94
|
+
var maxByPosition = shouldApplyHalfLogic && state.position !== 'whole' ? suboption.max * 2 : suboption.max;
|
|
95
|
+
|
|
96
|
+
// Validar si incrementar excedería el máximo de la opción cuando está en 'whole'
|
|
97
|
+
if (shouldApplyHalfLogic && state.position === 'whole') {
|
|
98
|
+
var _pizzaState3;
|
|
99
|
+
var otherOptionsValue = pizzaState === null || pizzaState === void 0 || (_pizzaState3 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState3 === void 0 ? void 0 : _pizzaState3.value;
|
|
100
|
+
var wouldExceedMax = otherOptionsValue + 1 > option.max;
|
|
101
|
+
if (wouldExceedMax) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
90
105
|
if (!(option !== null && option !== void 0 && option.with_half_option) && option.limit_suboptions_by_max && (balance === option.max || state.quantity === suboption.max)) {
|
|
91
106
|
return;
|
|
92
107
|
}
|
|
93
108
|
if (!(option !== null && option !== void 0 && option.with_half_option) && !option.limit_suboptions_by_max && state.quantity === suboption.max) {
|
|
94
109
|
return;
|
|
95
110
|
}
|
|
111
|
+
if (shouldApplyHalfLogic && state.quantity === maxByPosition) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
96
114
|
if (option !== null && option !== void 0 && option.with_half_option && usePizzaValidation) {
|
|
97
115
|
return;
|
|
98
116
|
}
|
|
@@ -123,16 +141,31 @@ var ProductOptionSuboption = exports.ProductOptionSuboption = function ProductOp
|
|
|
123
141
|
*/
|
|
124
142
|
var changePosition = function changePosition(position) {
|
|
125
143
|
var price = option.with_half_option && suboption.half_price && position !== 'whole' ? suboption.half_price : suboption.price;
|
|
144
|
+
var shouldApplyHalfLogic = (option === null || option === void 0 ? void 0 : option.with_half_option) && (option === null || option === void 0 ? void 0 : option.allow_suboption_quantity) && (option === null || option === void 0 ? void 0 : option.limit_suboptions_by_max);
|
|
145
|
+
if (shouldApplyHalfLogic && position === 'whole') {
|
|
146
|
+
var _pizzaState4;
|
|
147
|
+
var otherOptionsValue = pizzaState === null || pizzaState === void 0 || (_pizzaState4 = pizzaState["option:".concat(option === null || option === void 0 ? void 0 : option.id)]) === null || _pizzaState4 === void 0 ? void 0 : _pizzaState4.value;
|
|
148
|
+
var additionalValue = position === 'whole' ? state.quantity / 2 : 0;
|
|
149
|
+
var wouldExceedMax = otherOptionsValue + additionalValue > option.max;
|
|
150
|
+
if (wouldExceedMax) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
var newQuantity = state.quantity;
|
|
155
|
+
if (shouldApplyHalfLogic && position === 'whole' && state.quantity > suboption.max) {
|
|
156
|
+
newQuantity = suboption.max;
|
|
157
|
+
}
|
|
126
158
|
changeState(_objectSpread(_objectSpread({}, state), {}, {
|
|
127
159
|
position: position,
|
|
128
160
|
price: price,
|
|
129
|
-
|
|
161
|
+
quantity: newQuantity,
|
|
162
|
+
total: price * newQuantity
|
|
130
163
|
}));
|
|
131
164
|
};
|
|
132
165
|
|
|
133
166
|
/**
|
|
134
|
-
* Change
|
|
135
|
-
* @param {
|
|
167
|
+
* Change quantity of the suboption
|
|
168
|
+
* @param {number} quantity Quantity of the suboption
|
|
136
169
|
*/
|
|
137
170
|
var changeQuantity = function changeQuantity(quantity) {
|
|
138
171
|
changeState(_objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -20,8 +20,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
20
20
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
21
21
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
22
22
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
23
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
24
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
23
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
25
25
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
26
26
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
27
27
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -23,8 +23,8 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
24
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
25
25
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
26
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
27
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
26
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
27
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
28
28
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
29
29
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
30
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -98,7 +98,7 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
98
98
|
_dayjs.default.updateLocale('auto', localeObject);
|
|
99
99
|
};
|
|
100
100
|
var parsePrice = function parsePrice(value) {
|
|
101
|
-
var _configState$configs$, _configState$configs$2, _configState$configs$3, _configState$configs$4, _configState$configs$5, _formatNumber$currenc;
|
|
101
|
+
var _configState$configs$, _configState$configs$2, _configState$configs$3, _configState$configs$4, _configState$configs$5, _configState$configs$6, _configState$configs$7, _formatNumber$currenc;
|
|
102
102
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
103
103
|
var formatNumber = {
|
|
104
104
|
decimal: (options === null || options === void 0 ? void 0 : options.decimal) || ((_configState$configs$ = configState.configs.format_number_decimal_length) === null || _configState$configs$ === void 0 ? void 0 : _configState$configs$.value) || 2,
|
|
@@ -106,7 +106,7 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
106
106
|
thousand: (options === null || options === void 0 ? void 0 : options.thousand) || ((_configState$configs$3 = configState.configs.format_number_thousand_separator) === null || _configState$configs$3 === void 0 ? void 0 : _configState$configs$3.value) || '.',
|
|
107
107
|
currency: (options === null || options === void 0 ? void 0 : options.currency) || ((_configState$configs$4 = configState.configs.format_number_currency) === null || _configState$configs$4 === void 0 ? void 0 : _configState$configs$4.value) || '$',
|
|
108
108
|
currencyPosition: (options === null || options === void 0 ? void 0 : options.currencyPosition) || ((_configState$configs$5 = configState.configs.currency_position) === null || _configState$configs$5 === void 0 ? void 0 : _configState$configs$5.value) || 'left',
|
|
109
|
-
isTruncable: options === null || options === void 0 ? void 0 : options.isTruncable
|
|
109
|
+
isTruncable: (options === null || options === void 0 ? void 0 : options.isTruncable) || ((_configState$configs$6 = configState.configs.format_number_thousand_separator) === null || _configState$configs$6 === void 0 ? void 0 : _configState$configs$6.value) === '.' && ((_configState$configs$7 = configState.configs.format_number_decimal_separator) === null || _configState$configs$7 === void 0 ? void 0 : _configState$configs$7.value) === ','
|
|
110
110
|
};
|
|
111
111
|
var number = parseNumber(value, formatNumber);
|
|
112
112
|
if (((_formatNumber$currenc = formatNumber.currencyPosition) === null || _formatNumber$currenc === void 0 ? void 0 : _formatNumber$currenc.toLowerCase()) === 'left') {
|
|
@@ -117,13 +117,13 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
117
117
|
return number;
|
|
118
118
|
};
|
|
119
119
|
var parseNumber = function parseNumber(value) {
|
|
120
|
-
var _configState$configs$
|
|
120
|
+
var _configState$configs$8, _configState$configs$9, _configState$configs$10;
|
|
121
121
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
122
122
|
value = parseFloat(value) || 0;
|
|
123
123
|
var formatNumber = {
|
|
124
|
-
decimal: (options === null || options === void 0 ? void 0 : options.decimal) || ((_configState$configs$
|
|
125
|
-
separator: (options === null || options === void 0 ? void 0 : options.separator) || ((_configState$configs$
|
|
126
|
-
thousand: (options === null || options === void 0 ? void 0 : options.thousand) || ((_configState$configs$
|
|
124
|
+
decimal: (options === null || options === void 0 ? void 0 : options.decimal) || ((_configState$configs$8 = configState.configs.format_number_decimal_length) === null || _configState$configs$8 === void 0 ? void 0 : _configState$configs$8.value) || 2,
|
|
125
|
+
separator: (options === null || options === void 0 ? void 0 : options.separator) || ((_configState$configs$9 = configState.configs.format_number_decimal_separator) === null || _configState$configs$9 === void 0 ? void 0 : _configState$configs$9.value) || ',',
|
|
126
|
+
thousand: (options === null || options === void 0 ? void 0 : options.thousand) || ((_configState$configs$10 = configState.configs.format_number_thousand_separator) === null || _configState$configs$10 === void 0 ? void 0 : _configState$configs$10.value) || '.'
|
|
127
127
|
};
|
|
128
128
|
var number = value;
|
|
129
129
|
if (options !== null && options !== void 0 && options.isTruncable) {
|
|
@@ -148,9 +148,9 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
148
148
|
return number;
|
|
149
149
|
};
|
|
150
150
|
var parseDate = function parseDate(date) {
|
|
151
|
-
var _configState$configs$
|
|
151
|
+
var _configState$configs$11, _configState$configs;
|
|
152
152
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
153
|
-
var formatTime = (options === null || options === void 0 ? void 0 : options.formatTime) || ((_configState$configs$
|
|
153
|
+
var formatTime = (options === null || options === void 0 ? void 0 : options.formatTime) || ((_configState$configs$11 = configState.configs.format_time) === null || _configState$configs$11 === void 0 ? void 0 : _configState$configs$11.value) || '24';
|
|
154
154
|
var formatDate = {
|
|
155
155
|
inputFormat: (options === null || options === void 0 ? void 0 : options.inputFormat) || ['YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD hh:mm:ss A', 'YYYY-MM-DD hh:mm:ss'],
|
|
156
156
|
outputFormat: (options === null || options === void 0 ? void 0 : options.outputFormat) || ((_configState$configs = configState.configs) === null || _configState$configs === void 0 || (_configState$configs = _configState$configs.dates_general_format) === null || _configState$configs === void 0 ? void 0 : _configState$configs.value) || (formatTime === '24' ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD hh:mm:ss A'),
|
|
@@ -163,10 +163,10 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
163
163
|
return _date.format(formatDate.outputFormat);
|
|
164
164
|
};
|
|
165
165
|
var parseTime = function parseTime(time) {
|
|
166
|
-
var _configState$configs$
|
|
166
|
+
var _configState$configs$12;
|
|
167
167
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
168
168
|
if (!time) return '00:00';
|
|
169
|
-
var _formatTime = (options === null || options === void 0 ? void 0 : options.formatTime) || ((_configState$configs$
|
|
169
|
+
var _formatTime = (options === null || options === void 0 ? void 0 : options.formatTime) || ((_configState$configs$12 = configState.configs.format_time) === null || _configState$configs$12 === void 0 ? void 0 : _configState$configs$12.value) || '24';
|
|
170
170
|
var formatTime = {
|
|
171
171
|
inputFormat: (options === null || options === void 0 ? void 0 : options.inputFormat) || ['HH:mm', 'hh:mm A', 'hh:mm'],
|
|
172
172
|
outputFormat: (options === null || options === void 0 ? void 0 : options.outputFormat) || (_formatTime === '24' ? 'HH:mm' : 'hh:mm A'),
|
|
@@ -191,16 +191,16 @@ var UtilsProviders = exports.UtilsProviders = function UtilsProviders(_ref) {
|
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
var parseDistance = function parseDistance(distance) {
|
|
194
|
-
var _configState$configs$
|
|
194
|
+
var _configState$configs$13, _configState$configs$14;
|
|
195
195
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
196
196
|
distance = parseFloat(distance) || 0;
|
|
197
197
|
var unit = (options === null || options === void 0 ? void 0 : options.unit) || 'KM';
|
|
198
|
-
if (((_configState$configs$
|
|
198
|
+
if (((_configState$configs$13 = configState.configs.distance_unit_km) === null || _configState$configs$13 === void 0 ? void 0 : _configState$configs$13.value) === '1') {
|
|
199
199
|
unit = 'KM';
|
|
200
200
|
}
|
|
201
|
-
if ((_configState$configs$
|
|
202
|
-
var _configState$configs$
|
|
203
|
-
unit = (_configState$configs$
|
|
201
|
+
if ((_configState$configs$14 = configState.configs.distance_unit) !== null && _configState$configs$14 !== void 0 && _configState$configs$14.value) {
|
|
202
|
+
var _configState$configs$15;
|
|
203
|
+
unit = (_configState$configs$15 = configState.configs.distance_unit) === null || _configState$configs$15 === void 0 ? void 0 : _configState$configs$15.value;
|
|
204
204
|
}
|
|
205
205
|
if (unit.toUpperCase() === 'MI') {
|
|
206
206
|
var dist = distance * 0.621371;
|
package/package.json
CHANGED
|
@@ -51,14 +51,20 @@ export const ProductOptionSuboption = (props) => {
|
|
|
51
51
|
const selectStatus = isOrigin ? !state.selected : state.selected
|
|
52
52
|
const minMaxValidation = option.with_half_option ? usePizzaValidation : (balance === option.max && !(option?.max === 1 && option?.min === 1))
|
|
53
53
|
const canBeSelectedByHalf = (pizzaState?.[`option:${option?.id}`]?.value === (option.max - 0.5)) && option.with_half_option
|
|
54
|
+
|
|
55
|
+
const shouldApplyHalfLogic = option?.with_half_option && option?.allow_suboption_quantity && option?.limit_suboptions_by_max
|
|
56
|
+
const remainingBalance = option.max - balance
|
|
57
|
+
const canOnlySelectHalf = shouldApplyHalfLogic && remainingBalance < 1 && remainingBalance > 0
|
|
58
|
+
|
|
54
59
|
if (selectStatus && (option.limit_suboptions_by_max || isAlsea) && minMaxValidation && !canBeSelectedByHalf) {
|
|
55
60
|
return
|
|
56
61
|
}
|
|
62
|
+
|
|
57
63
|
changeState({
|
|
58
64
|
...state,
|
|
59
65
|
quantity: state.selected ? 0 : 1,
|
|
60
66
|
selected: !state.selected,
|
|
61
|
-
position: canBeSelectedByHalf ? 'left' : 'whole'
|
|
67
|
+
position: (canBeSelectedByHalf || canOnlySelectHalf) ? 'left' : 'whole'
|
|
62
68
|
})
|
|
63
69
|
}
|
|
64
70
|
|
|
@@ -66,15 +72,34 @@ export const ProductOptionSuboption = (props) => {
|
|
|
66
72
|
* Increment suboption quantity
|
|
67
73
|
*/
|
|
68
74
|
const increment = () => {
|
|
75
|
+
const shouldApplyHalfLogic = option?.with_half_option && option?.allow_suboption_quantity && option?.limit_suboptions_by_max
|
|
76
|
+
const maxByPosition = shouldApplyHalfLogic && state.position !== 'whole'
|
|
77
|
+
? suboption.max * 2
|
|
78
|
+
: suboption.max
|
|
79
|
+
|
|
80
|
+
// Validar si incrementar excedería el máximo de la opción cuando está en 'whole'
|
|
81
|
+
if (shouldApplyHalfLogic && state.position === 'whole') {
|
|
82
|
+
const otherOptionsValue = pizzaState?.[`option:${option?.id}`]?.value
|
|
83
|
+
const wouldExceedMax = (otherOptionsValue + 1) > option.max
|
|
84
|
+
|
|
85
|
+
if (wouldExceedMax) {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
69
90
|
if (!option?.with_half_option && option.limit_suboptions_by_max && (balance === option.max || state.quantity === suboption.max)) {
|
|
70
91
|
return
|
|
71
92
|
}
|
|
72
93
|
if (!option?.with_half_option && !option.limit_suboptions_by_max && state.quantity === suboption.max) {
|
|
73
94
|
return
|
|
74
95
|
}
|
|
96
|
+
if (shouldApplyHalfLogic && state.quantity === maxByPosition) {
|
|
97
|
+
return
|
|
98
|
+
}
|
|
75
99
|
if (option?.with_half_option && usePizzaValidation) {
|
|
76
100
|
return
|
|
77
101
|
}
|
|
102
|
+
|
|
78
103
|
changeState({
|
|
79
104
|
...state,
|
|
80
105
|
selected: state.quantity === 0 ? true : state.selected,
|
|
@@ -104,17 +129,36 @@ export const ProductOptionSuboption = (props) => {
|
|
|
104
129
|
*/
|
|
105
130
|
const changePosition = (position) => {
|
|
106
131
|
const price = option.with_half_option && suboption.half_price && position !== 'whole' ? suboption.half_price : suboption.price
|
|
132
|
+
|
|
133
|
+
const shouldApplyHalfLogic = option?.with_half_option && option?.allow_suboption_quantity && option?.limit_suboptions_by_max
|
|
134
|
+
|
|
135
|
+
if (shouldApplyHalfLogic && position === 'whole') {
|
|
136
|
+
const otherOptionsValue = pizzaState?.[`option:${option?.id}`]?.value
|
|
137
|
+
const additionalValue = position === 'whole' ? state.quantity / 2 : 0
|
|
138
|
+
const wouldExceedMax = (otherOptionsValue + additionalValue) > option.max
|
|
139
|
+
|
|
140
|
+
if (wouldExceedMax) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let newQuantity = state.quantity
|
|
146
|
+
if (shouldApplyHalfLogic && position === 'whole' && state.quantity > suboption.max) {
|
|
147
|
+
newQuantity = suboption.max
|
|
148
|
+
}
|
|
149
|
+
|
|
107
150
|
changeState({
|
|
108
151
|
...state,
|
|
109
152
|
position,
|
|
110
153
|
price,
|
|
111
|
-
|
|
154
|
+
quantity: newQuantity,
|
|
155
|
+
total: price * newQuantity
|
|
112
156
|
})
|
|
113
157
|
}
|
|
114
158
|
|
|
115
159
|
/**
|
|
116
|
-
* Change
|
|
117
|
-
* @param {
|
|
160
|
+
* Change quantity of the suboption
|
|
161
|
+
* @param {number} quantity Quantity of the suboption
|
|
118
162
|
*/
|
|
119
163
|
const changeQuantity = (quantity) => {
|
|
120
164
|
changeState({
|
|
@@ -122,7 +122,7 @@ export const UtilsProviders = ({ children }) => {
|
|
|
122
122
|
thousand: options?.thousand || configState.configs.format_number_thousand_separator?.value || '.',
|
|
123
123
|
currency: options?.currency || configState.configs.format_number_currency?.value || '$',
|
|
124
124
|
currencyPosition: options?.currencyPosition || configState.configs.currency_position?.value || 'left',
|
|
125
|
-
isTruncable: options?.isTruncable
|
|
125
|
+
isTruncable: options?.isTruncable || (configState.configs.format_number_thousand_separator?.value === '.' && configState.configs.format_number_decimal_separator?.value === ',')
|
|
126
126
|
}
|
|
127
127
|
let number = parseNumber(value, formatNumber)
|
|
128
128
|
if (formatNumber.currencyPosition?.toLowerCase() === 'left') {
|