@pisell/pisellos 0.10.51 → 0.10.52
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/dist/modules/Schedule/index.d.ts +8 -0
- package/dist/modules/Schedule/index.js +134 -37
- package/dist/solution/BaseSales/index.d.ts +1 -0
- package/dist/solution/BaseSales/index.js +22 -11
- package/dist/solution/BaseSales/pickupTiming.d.ts +8 -2
- package/dist/solution/BaseSales/pickupTiming.js +266 -159
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.d.ts +2 -2
- package/dist/solution/UnifiedBookingSales/index.d.ts +12 -5
- package/dist/solution/UnifiedBookingSales/index.js +854 -741
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/Schedule/index.d.ts +8 -0
- package/lib/modules/Schedule/index.js +64 -11
- package/lib/solution/BaseSales/index.d.ts +1 -0
- package/lib/solution/BaseSales/index.js +7 -0
- package/lib/solution/BaseSales/pickupTiming.d.ts +8 -2
- package/lib/solution/BaseSales/pickupTiming.js +89 -42
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.d.ts +2 -2
- package/lib/solution/UnifiedBookingSales/index.d.ts +12 -5
- package/lib/solution/UnifiedBookingSales/index.js +121 -57
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
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 new 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 new 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 new 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; }
|
|
5
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
7
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
8
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
9
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
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 new 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 new 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 new 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; }
|
|
11
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
12
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -21,31 +21,31 @@ import { computePickupTimingAvailability, getAsapPickupTiming, normalizePickupTi
|
|
|
21
21
|
function withTimeout(_x) {
|
|
22
22
|
return _withTimeout.apply(this, arguments);
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/** Reuses runtime configuration and schedules; every calculation still uses the live clock. */
|
|
25
25
|
function _withTimeout() {
|
|
26
|
-
_withTimeout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
26
|
+
_withTimeout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(request) {
|
|
27
27
|
var timer;
|
|
28
|
-
return _regeneratorRuntime().wrap(function
|
|
29
|
-
while (1) switch (
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
29
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
30
30
|
case 0:
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
_context11.prev = 0;
|
|
32
|
+
_context11.next = 3;
|
|
33
33
|
return Promise.race([request, new Promise(function (_, reject) {
|
|
34
34
|
timer = setTimeout(function () {
|
|
35
35
|
return reject(new Error('Unable to load pickup times. Please try again.'));
|
|
36
36
|
}, 30000);
|
|
37
37
|
})]);
|
|
38
38
|
case 3:
|
|
39
|
-
return
|
|
39
|
+
return _context11.abrupt("return", _context11.sent);
|
|
40
40
|
case 4:
|
|
41
|
-
|
|
41
|
+
_context11.prev = 4;
|
|
42
42
|
if (timer !== undefined) clearTimeout(timer);
|
|
43
|
-
return
|
|
43
|
+
return _context11.finish(4);
|
|
44
44
|
case 7:
|
|
45
45
|
case "end":
|
|
46
|
-
return
|
|
46
|
+
return _context11.stop();
|
|
47
47
|
}
|
|
48
|
-
},
|
|
48
|
+
}, _callee11, null, [[0,, 4, 7]]);
|
|
49
49
|
}));
|
|
50
50
|
return _withTimeout.apply(this, arguments);
|
|
51
51
|
}
|
|
@@ -53,7 +53,7 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
53
53
|
function PickupTimingController(host) {
|
|
54
54
|
_classCallCheck(this, PickupTimingController);
|
|
55
55
|
_defineProperty(this, "latest", void 0);
|
|
56
|
-
_defineProperty(this, "
|
|
56
|
+
_defineProperty(this, "runtime", void 0);
|
|
57
57
|
_defineProperty(this, "writeSequence", 0);
|
|
58
58
|
this.host = host;
|
|
59
59
|
}
|
|
@@ -63,115 +63,222 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
63
63
|
var _this$host$now, _this$host$now2, _this$host;
|
|
64
64
|
return (_this$host$now = (_this$host$now2 = (_this$host = this.host).now) === null || _this$host$now2 === void 0 ? void 0 : _this$host$now2.call(_this$host)) !== null && _this$host$now !== void 0 ? _this$host$now : new Date();
|
|
65
65
|
}
|
|
66
|
+
|
|
67
|
+
/** A new solution context or an explicit settings refresh invalidates pending work too. */
|
|
66
68
|
}, {
|
|
67
|
-
key: "
|
|
69
|
+
key: "invalidate",
|
|
70
|
+
value: function invalidate() {
|
|
71
|
+
this.runtime = undefined;
|
|
72
|
+
this.latest = undefined;
|
|
73
|
+
this.writeSequence += 1;
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "assertCurrentRuntime",
|
|
77
|
+
value: function assertCurrentRuntime(runtime) {
|
|
78
|
+
if (this.runtime !== runtime || runtime.scope !== this.host.getScope()) {
|
|
79
|
+
throw new Error('Store settings changed. Please try again.');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "getRuntime",
|
|
84
|
+
value: function getRuntime() {
|
|
85
|
+
var _this$runtime;
|
|
86
|
+
var scope = this.host.getScope();
|
|
87
|
+
if (((_this$runtime = this.runtime) === null || _this$runtime === void 0 ? void 0 : _this$runtime.scope) !== scope) {
|
|
88
|
+
this.latest = undefined;
|
|
89
|
+
this.runtime = {
|
|
90
|
+
scope: scope
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return this.runtime;
|
|
94
|
+
}
|
|
95
|
+
}, {
|
|
96
|
+
key: "loadConfig",
|
|
68
97
|
value: function () {
|
|
69
|
-
var
|
|
98
|
+
var _loadConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(runtime) {
|
|
70
99
|
var _this = this;
|
|
71
|
-
var
|
|
72
|
-
scope,
|
|
73
|
-
key,
|
|
74
|
-
request,
|
|
75
|
-
result,
|
|
76
|
-
_args2 = arguments;
|
|
100
|
+
var _request, request;
|
|
77
101
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
102
|
while (1) switch (_context2.prev = _context2.next) {
|
|
79
103
|
case 0:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
104
|
+
if (!runtime.config) {
|
|
105
|
+
_context2.next = 2;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
return _context2.abrupt("return", runtime.config);
|
|
109
|
+
case 2:
|
|
110
|
+
if (!runtime.configRequest) {
|
|
111
|
+
_request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
112
|
+
var config;
|
|
87
113
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
88
114
|
while (1) switch (_context.prev = _context.next) {
|
|
89
115
|
case 0:
|
|
90
116
|
_context.t0 = normalizePickupTimingConfig;
|
|
91
117
|
_context.next = 3;
|
|
92
|
-
return withTimeout(_this.host.loadOpenData(
|
|
118
|
+
return withTimeout(_this.host.loadOpenData(false));
|
|
93
119
|
case 3:
|
|
94
120
|
_context.t1 = _context.sent;
|
|
95
121
|
config = (0, _context.t0)(_context.t1);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
122
|
+
_this.assertCurrentRuntime(runtime);
|
|
123
|
+
runtime.config = config;
|
|
124
|
+
return _context.abrupt("return", config);
|
|
125
|
+
case 8:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee);
|
|
130
|
+
}))();
|
|
131
|
+
runtime.configRequest = _request;
|
|
132
|
+
}
|
|
133
|
+
request = runtime.configRequest;
|
|
134
|
+
_context2.prev = 4;
|
|
135
|
+
_context2.next = 7;
|
|
136
|
+
return request;
|
|
137
|
+
case 7:
|
|
138
|
+
return _context2.abrupt("return", _context2.sent);
|
|
139
|
+
case 8:
|
|
140
|
+
_context2.prev = 8;
|
|
141
|
+
if (runtime.configRequest === request) runtime.configRequest = undefined;
|
|
142
|
+
return _context2.finish(8);
|
|
143
|
+
case 11:
|
|
144
|
+
case "end":
|
|
145
|
+
return _context2.stop();
|
|
146
|
+
}
|
|
147
|
+
}, _callee2, null, [[4,, 8, 11]]);
|
|
148
|
+
}));
|
|
149
|
+
function loadConfig(_x2) {
|
|
150
|
+
return _loadConfig.apply(this, arguments);
|
|
151
|
+
}
|
|
152
|
+
return loadConfig;
|
|
153
|
+
}()
|
|
154
|
+
}, {
|
|
155
|
+
key: "loadSchedules",
|
|
156
|
+
value: function () {
|
|
157
|
+
var _loadSchedules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(runtime, config) {
|
|
158
|
+
var _this2 = this;
|
|
159
|
+
var _request2, request;
|
|
160
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
161
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
if (!runtime.schedules) {
|
|
164
|
+
_context4.next = 2;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
return _context4.abrupt("return", runtime.schedules);
|
|
168
|
+
case 2:
|
|
169
|
+
if (!runtime.scheduleRequest) {
|
|
170
|
+
_request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
171
|
+
var schedule, ids, schedules;
|
|
172
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
173
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
schedule = _this2.host.getSchedule();
|
|
104
176
|
if (schedule) {
|
|
105
|
-
|
|
177
|
+
_context3.next = 3;
|
|
106
178
|
break;
|
|
107
179
|
}
|
|
108
180
|
throw new Error('Pickup schedule is unavailable. Please try again.');
|
|
109
|
-
case
|
|
110
|
-
|
|
181
|
+
case 3:
|
|
182
|
+
_context3.next = 5;
|
|
111
183
|
return withTimeout(schedule.loadAllSchedule({
|
|
112
|
-
useCache:
|
|
184
|
+
useCache: true
|
|
113
185
|
}));
|
|
114
|
-
case
|
|
186
|
+
case 5:
|
|
187
|
+
_this2.assertCurrentRuntime(runtime);
|
|
115
188
|
ids = _toConsumableArray(new Set([].concat(_toConsumableArray(config.scheduleIds), _toConsumableArray(config.operatingHoursScheduleIds || []))));
|
|
116
189
|
schedules = cloneDeep(schedule.getScheduleListByIds(ids) || []);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
case
|
|
120
|
-
_context.prev = 18;
|
|
121
|
-
_context.t2 = _context["catch"](8);
|
|
122
|
-
if (tolerateScheduleError) {
|
|
123
|
-
_context.next = 22;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
throw _context.t2;
|
|
127
|
-
case 22:
|
|
128
|
-
error = _context.t2 instanceof Error ? _context.t2.message : 'Pickup schedule is unavailable. Please try again.';
|
|
129
|
-
case 23:
|
|
130
|
-
if (!(scope !== _this.host.getScope())) {
|
|
131
|
-
_context.next = 25;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
throw new Error('Store settings changed. Please try again.');
|
|
135
|
-
case 25:
|
|
136
|
-
return _context.abrupt("return", {
|
|
137
|
-
config: config,
|
|
138
|
-
timezone: timezone,
|
|
139
|
-
schedules: schedules,
|
|
140
|
-
scope: scope,
|
|
141
|
-
error: error
|
|
142
|
-
});
|
|
143
|
-
case 26:
|
|
190
|
+
runtime.schedules = schedules;
|
|
191
|
+
return _context3.abrupt("return", schedules);
|
|
192
|
+
case 10:
|
|
144
193
|
case "end":
|
|
145
|
-
return
|
|
194
|
+
return _context3.stop();
|
|
146
195
|
}
|
|
147
|
-
},
|
|
196
|
+
}, _callee3);
|
|
148
197
|
}))();
|
|
149
|
-
|
|
198
|
+
runtime.scheduleRequest = _request2;
|
|
150
199
|
}
|
|
151
|
-
|
|
152
|
-
|
|
200
|
+
request = runtime.scheduleRequest;
|
|
201
|
+
_context4.prev = 4;
|
|
202
|
+
_context4.next = 7;
|
|
153
203
|
return request;
|
|
204
|
+
case 7:
|
|
205
|
+
return _context4.abrupt("return", _context4.sent);
|
|
154
206
|
case 8:
|
|
155
|
-
|
|
156
|
-
if (
|
|
157
|
-
|
|
207
|
+
_context4.prev = 8;
|
|
208
|
+
if (runtime.scheduleRequest === request) runtime.scheduleRequest = undefined;
|
|
209
|
+
return _context4.finish(8);
|
|
210
|
+
case 11:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context4.stop();
|
|
213
|
+
}
|
|
214
|
+
}, _callee4, null, [[4,, 8, 11]]);
|
|
215
|
+
}));
|
|
216
|
+
function loadSchedules(_x3, _x4) {
|
|
217
|
+
return _loadSchedules.apply(this, arguments);
|
|
218
|
+
}
|
|
219
|
+
return loadSchedules;
|
|
220
|
+
}()
|
|
221
|
+
}, {
|
|
222
|
+
key: "snapshot",
|
|
223
|
+
value: function () {
|
|
224
|
+
var _snapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(includeSchedule) {
|
|
225
|
+
var tolerateScheduleError,
|
|
226
|
+
runtime,
|
|
227
|
+
config,
|
|
228
|
+
schedules,
|
|
229
|
+
error,
|
|
230
|
+
result,
|
|
231
|
+
_args5 = arguments;
|
|
232
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
233
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
tolerateScheduleError = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : false;
|
|
236
|
+
runtime = this.getRuntime();
|
|
237
|
+
_context5.next = 4;
|
|
238
|
+
return this.loadConfig(runtime);
|
|
239
|
+
case 4:
|
|
240
|
+
config = _context5.sent;
|
|
241
|
+
this.assertCurrentRuntime(runtime);
|
|
242
|
+
schedules = [];
|
|
243
|
+
if (!(includeSchedule && config.handoverModes.includes('pick_up') && config.timingMode !== 'asap_only' && config.scheduleIds.length)) {
|
|
244
|
+
_context5.next = 19;
|
|
158
245
|
break;
|
|
159
246
|
}
|
|
160
|
-
|
|
247
|
+
_context5.prev = 8;
|
|
248
|
+
_context5.next = 11;
|
|
249
|
+
return this.loadSchedules(runtime, config);
|
|
161
250
|
case 11:
|
|
251
|
+
schedules = _context5.sent;
|
|
252
|
+
_context5.next = 19;
|
|
253
|
+
break;
|
|
254
|
+
case 14:
|
|
255
|
+
_context5.prev = 14;
|
|
256
|
+
_context5.t0 = _context5["catch"](8);
|
|
257
|
+
if (tolerateScheduleError) {
|
|
258
|
+
_context5.next = 18;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
throw _context5.t0;
|
|
262
|
+
case 18:
|
|
263
|
+
error = _context5.t0 instanceof Error ? _context5.t0.message : 'Pickup schedule is unavailable. Please try again.';
|
|
264
|
+
case 19:
|
|
265
|
+
this.assertCurrentRuntime(runtime);
|
|
266
|
+
result = {
|
|
267
|
+
config: config,
|
|
268
|
+
timezone: this.host.getTimezone(),
|
|
269
|
+
schedules: schedules,
|
|
270
|
+
scope: runtime.scope,
|
|
271
|
+
error: error
|
|
272
|
+
};
|
|
162
273
|
this.latest = result;
|
|
163
|
-
return
|
|
164
|
-
case
|
|
165
|
-
_context2.prev = 13;
|
|
166
|
-
if (this.requests.get(key) === request) this.requests.delete(key);
|
|
167
|
-
return _context2.finish(13);
|
|
168
|
-
case 16:
|
|
274
|
+
return _context5.abrupt("return", result);
|
|
275
|
+
case 23:
|
|
169
276
|
case "end":
|
|
170
|
-
return
|
|
277
|
+
return _context5.stop();
|
|
171
278
|
}
|
|
172
|
-
},
|
|
279
|
+
}, _callee5, this, [[8, 14]]);
|
|
173
280
|
}));
|
|
174
|
-
function snapshot(
|
|
281
|
+
function snapshot(_x5) {
|
|
175
282
|
return _snapshot.apply(this, arguments);
|
|
176
283
|
}
|
|
177
284
|
return snapshot;
|
|
@@ -179,31 +286,31 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
179
286
|
}, {
|
|
180
287
|
key: "getAvailability",
|
|
181
288
|
value: function () {
|
|
182
|
-
var _getAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
289
|
+
var _getAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
183
290
|
var params,
|
|
184
291
|
snapshot,
|
|
185
292
|
now,
|
|
186
|
-
|
|
187
|
-
return _regeneratorRuntime().wrap(function
|
|
188
|
-
while (1) switch (
|
|
293
|
+
_args6 = arguments;
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
295
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
189
296
|
case 0:
|
|
190
|
-
params =
|
|
191
|
-
|
|
192
|
-
return this.snapshot(
|
|
297
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
298
|
+
_context6.next = 3;
|
|
299
|
+
return this.snapshot(true, true);
|
|
193
300
|
case 3:
|
|
194
|
-
snapshot =
|
|
301
|
+
snapshot = _context6.sent;
|
|
195
302
|
now = this.now();
|
|
196
|
-
|
|
197
|
-
return
|
|
303
|
+
_context6.prev = 5;
|
|
304
|
+
return _context6.abrupt("return", _objectSpread(_objectSpread({}, computePickupTimingAvailability(_objectSpread(_objectSpread({}, snapshot), {}, {
|
|
198
305
|
date: params.date,
|
|
199
306
|
now: now
|
|
200
307
|
}))), {}, {
|
|
201
308
|
error: snapshot.error
|
|
202
309
|
}));
|
|
203
310
|
case 9:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return
|
|
311
|
+
_context6.prev = 9;
|
|
312
|
+
_context6.t0 = _context6["catch"](5);
|
|
313
|
+
return _context6.abrupt("return", {
|
|
207
314
|
config: snapshot.config,
|
|
208
315
|
timezone: snapshot.timezone,
|
|
209
316
|
now: now.toISOString(),
|
|
@@ -212,13 +319,13 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
212
319
|
date: params.date || '',
|
|
213
320
|
dates: [],
|
|
214
321
|
slots: [],
|
|
215
|
-
error:
|
|
322
|
+
error: _context6.t0 instanceof Error ? _context6.t0.message : 'Pickup times are unavailable. Please try again.'
|
|
216
323
|
});
|
|
217
324
|
case 12:
|
|
218
325
|
case "end":
|
|
219
|
-
return
|
|
326
|
+
return _context6.stop();
|
|
220
327
|
}
|
|
221
|
-
},
|
|
328
|
+
}, _callee6, this, [[5, 9]]);
|
|
222
329
|
}));
|
|
223
330
|
function getAvailability() {
|
|
224
331
|
return _getAvailability.apply(this, arguments);
|
|
@@ -251,32 +358,32 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
251
358
|
}, {
|
|
252
359
|
key: "validateSnapshot",
|
|
253
360
|
value: function () {
|
|
254
|
-
var _validateSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
361
|
+
var _validateSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(selection) {
|
|
255
362
|
var snapshot, now, result;
|
|
256
|
-
return _regeneratorRuntime().wrap(function
|
|
257
|
-
while (1) switch (
|
|
363
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
364
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
258
365
|
case 0:
|
|
259
|
-
|
|
260
|
-
return this.snapshot(
|
|
366
|
+
_context7.next = 2;
|
|
367
|
+
return this.snapshot(selection.serviceType === 'pick_up' && selection.mode === 'scheduled' && selection.source !== 'pos_manual');
|
|
261
368
|
case 2:
|
|
262
|
-
snapshot =
|
|
369
|
+
snapshot = _context7.sent;
|
|
263
370
|
now = this.now();
|
|
264
371
|
result = validatePickupTimingSelection(selection, _objectSpread(_objectSpread({}, snapshot), {}, {
|
|
265
372
|
now: now,
|
|
266
373
|
allowManualOverride: this.host.isPos()
|
|
267
374
|
}));
|
|
268
|
-
return
|
|
375
|
+
return _context7.abrupt("return", {
|
|
269
376
|
snapshot: snapshot,
|
|
270
377
|
now: now,
|
|
271
378
|
result: result
|
|
272
379
|
});
|
|
273
380
|
case 6:
|
|
274
381
|
case "end":
|
|
275
|
-
return
|
|
382
|
+
return _context7.stop();
|
|
276
383
|
}
|
|
277
|
-
},
|
|
384
|
+
}, _callee7, this);
|
|
278
385
|
}));
|
|
279
|
-
function validateSnapshot(
|
|
386
|
+
function validateSnapshot(_x6) {
|
|
280
387
|
return _validateSnapshot.apply(this, arguments);
|
|
281
388
|
}
|
|
282
389
|
return validateSnapshot;
|
|
@@ -284,21 +391,21 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
284
391
|
}, {
|
|
285
392
|
key: "validate",
|
|
286
393
|
value: function () {
|
|
287
|
-
var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
288
|
-
return _regeneratorRuntime().wrap(function
|
|
289
|
-
while (1) switch (
|
|
394
|
+
var _validate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(selection) {
|
|
395
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
396
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
290
397
|
case 0:
|
|
291
|
-
|
|
398
|
+
_context8.next = 2;
|
|
292
399
|
return this.validateSnapshot(selection);
|
|
293
400
|
case 2:
|
|
294
|
-
return
|
|
401
|
+
return _context8.abrupt("return", _context8.sent.result);
|
|
295
402
|
case 3:
|
|
296
403
|
case "end":
|
|
297
|
-
return
|
|
404
|
+
return _context8.stop();
|
|
298
405
|
}
|
|
299
|
-
},
|
|
406
|
+
}, _callee8, this);
|
|
300
407
|
}));
|
|
301
|
-
function validate(
|
|
408
|
+
function validate(_x7) {
|
|
302
409
|
return _validate.apply(this, arguments);
|
|
303
410
|
}
|
|
304
411
|
return validate;
|
|
@@ -306,7 +413,7 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
306
413
|
}, {
|
|
307
414
|
key: "setSelection",
|
|
308
415
|
value: function () {
|
|
309
|
-
var _setSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
416
|
+
var _setSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(selection) {
|
|
310
417
|
var _tempOrder$metadata2, _options$frozen;
|
|
311
418
|
var options,
|
|
312
419
|
order,
|
|
@@ -317,52 +424,52 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
317
424
|
now,
|
|
318
425
|
result,
|
|
319
426
|
slot,
|
|
320
|
-
|
|
321
|
-
return _regeneratorRuntime().wrap(function
|
|
322
|
-
while (1) switch (
|
|
427
|
+
_args9 = arguments;
|
|
428
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
429
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
323
430
|
case 0:
|
|
324
|
-
options =
|
|
431
|
+
options = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : {};
|
|
325
432
|
order = this.host.getOrder();
|
|
326
433
|
tempOrder = order.ensureTempOrder();
|
|
327
434
|
sequence = ++this.writeSequence;
|
|
328
|
-
|
|
435
|
+
_context9.next = 6;
|
|
329
436
|
return this.validateSnapshot(selection);
|
|
330
437
|
case 6:
|
|
331
|
-
_yield$this$validateS =
|
|
438
|
+
_yield$this$validateS = _context9.sent;
|
|
332
439
|
snapshot = _yield$this$validateS.snapshot;
|
|
333
440
|
now = _yield$this$validateS.now;
|
|
334
441
|
result = _yield$this$validateS.result;
|
|
335
442
|
if (!(sequence !== this.writeSequence || order.getTempOrder() !== tempOrder || snapshot.scope !== this.host.getScope())) {
|
|
336
|
-
|
|
443
|
+
_context9.next = 12;
|
|
337
444
|
break;
|
|
338
445
|
}
|
|
339
446
|
throw new Error('The order changed. Please choose the pickup time again.');
|
|
340
447
|
case 12:
|
|
341
448
|
if (result.valid) {
|
|
342
|
-
|
|
449
|
+
_context9.next = 14;
|
|
343
450
|
break;
|
|
344
451
|
}
|
|
345
452
|
throw new Error(result.message || 'Please choose a valid pickup time.');
|
|
346
453
|
case 14:
|
|
347
454
|
if (snapshot.config.handoverModes.length) {
|
|
348
|
-
|
|
455
|
+
_context9.next = 17;
|
|
349
456
|
break;
|
|
350
457
|
}
|
|
351
458
|
order.clearPickupTimingBooking();
|
|
352
|
-
return
|
|
459
|
+
return _context9.abrupt("return", this.getSelection());
|
|
353
460
|
case 17:
|
|
354
461
|
if (!(selection.serviceType !== 'pick_up')) {
|
|
355
|
-
|
|
462
|
+
_context9.next = 20;
|
|
356
463
|
break;
|
|
357
464
|
}
|
|
358
465
|
order.updateTempOrderServiceType(selection.serviceType);
|
|
359
|
-
return
|
|
466
|
+
return _context9.abrupt("return", this.getSelection());
|
|
360
467
|
case 20:
|
|
361
468
|
slot = selection.mode === 'asap' ? getAsapPickupTiming(_objectSpread(_objectSpread({}, snapshot), {}, {
|
|
362
469
|
now: now
|
|
363
470
|
})) : result.slot;
|
|
364
471
|
if (slot) {
|
|
365
|
-
|
|
472
|
+
_context9.next = 23;
|
|
366
473
|
break;
|
|
367
474
|
}
|
|
368
475
|
throw new Error('Please choose a pickup time.');
|
|
@@ -382,14 +489,14 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
382
489
|
timezone: snapshot.timezone,
|
|
383
490
|
frozen: (_options$frozen = options.frozen) !== null && _options$frozen !== void 0 ? _options$frozen : false
|
|
384
491
|
});
|
|
385
|
-
return
|
|
492
|
+
return _context9.abrupt("return", this.getSelection());
|
|
386
493
|
case 26:
|
|
387
494
|
case "end":
|
|
388
|
-
return
|
|
495
|
+
return _context9.stop();
|
|
389
496
|
}
|
|
390
|
-
},
|
|
497
|
+
}, _callee9, this);
|
|
391
498
|
}));
|
|
392
|
-
function setSelection(
|
|
499
|
+
function setSelection(_x8) {
|
|
393
500
|
return _setSelection.apply(this, arguments);
|
|
394
501
|
}
|
|
395
502
|
return setSelection;
|
|
@@ -397,7 +504,7 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
397
504
|
}, {
|
|
398
505
|
key: "prepare",
|
|
399
506
|
value: (function () {
|
|
400
|
-
var _prepare = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
507
|
+
var _prepare = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
401
508
|
var _order$getOrderIdenti, _booking$metadata$ful, _order$getTempOrder, _options$freeze;
|
|
402
509
|
var options,
|
|
403
510
|
order,
|
|
@@ -408,31 +515,31 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
408
515
|
detail,
|
|
409
516
|
snapshot,
|
|
410
517
|
selection,
|
|
411
|
-
|
|
412
|
-
return _regeneratorRuntime().wrap(function
|
|
413
|
-
while (1) switch (
|
|
518
|
+
_args10 = arguments;
|
|
519
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
520
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
414
521
|
case 0:
|
|
415
|
-
options =
|
|
522
|
+
options = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
|
416
523
|
order = this.host.getOrder();
|
|
417
524
|
tempOrder = order.getTempOrder();
|
|
418
525
|
sequence = this.writeSequence;
|
|
419
526
|
if (!((_order$getOrderIdenti = order.getOrderIdentity()) !== null && _order$getOrderIdenti !== void 0 && _order$getOrderIdenti.isSubmitted)) {
|
|
420
|
-
|
|
527
|
+
_context10.next = 6;
|
|
421
528
|
break;
|
|
422
529
|
}
|
|
423
|
-
return
|
|
530
|
+
return _context10.abrupt("return", this.getSelection());
|
|
424
531
|
case 6:
|
|
425
532
|
booking = order.getPickupTimingBooking();
|
|
426
533
|
if (!(booking !== null && booking !== void 0 && (_booking$metadata$ful = booking.metadata.fulfillment_timing) !== null && _booking$metadata$ful !== void 0 && _booking$metadata$ful.frozen)) {
|
|
427
|
-
|
|
534
|
+
_context10.next = 9;
|
|
428
535
|
break;
|
|
429
536
|
}
|
|
430
|
-
return
|
|
537
|
+
return _context10.abrupt("return", this.getSelection());
|
|
431
538
|
case 9:
|
|
432
539
|
// An actual payment callback must never revalidate or move the time after funds have been taken.
|
|
433
540
|
paymentStatus = (_order$getTempOrder = order.getTempOrder()) === null || _order$getTempOrder === void 0 ? void 0 : _order$getTempOrder.payment_status;
|
|
434
541
|
if (!(paymentStatus === 'paid' || paymentStatus === 'partially_paid')) {
|
|
435
|
-
|
|
542
|
+
_context10.next = 13;
|
|
436
543
|
break;
|
|
437
544
|
}
|
|
438
545
|
if (booking !== null && booking !== void 0 && booking.metadata.fulfillment_timing) {
|
|
@@ -443,34 +550,34 @@ export var PickupTimingController = /*#__PURE__*/function () {
|
|
|
443
550
|
frozen: true
|
|
444
551
|
}));
|
|
445
552
|
}
|
|
446
|
-
return
|
|
553
|
+
return _context10.abrupt("return", this.getSelection());
|
|
447
554
|
case 13:
|
|
448
|
-
|
|
449
|
-
return this.snapshot(
|
|
555
|
+
_context10.next = 15;
|
|
556
|
+
return this.snapshot(false);
|
|
450
557
|
case 15:
|
|
451
|
-
snapshot =
|
|
558
|
+
snapshot = _context10.sent;
|
|
452
559
|
if (!(order !== this.host.getOrder() || order.getTempOrder() !== tempOrder || sequence !== this.writeSequence)) {
|
|
453
|
-
|
|
560
|
+
_context10.next = 18;
|
|
454
561
|
break;
|
|
455
562
|
}
|
|
456
563
|
throw new Error('The order changed. Please choose the pickup time again.');
|
|
457
564
|
case 18:
|
|
458
565
|
selection = this.getSelection();
|
|
459
566
|
if (snapshot.config.handoverModes.length) {
|
|
460
|
-
|
|
567
|
+
_context10.next = 22;
|
|
461
568
|
break;
|
|
462
569
|
}
|
|
463
570
|
order.clearPickupTimingBooking();
|
|
464
|
-
return
|
|
571
|
+
return _context10.abrupt("return", selection);
|
|
465
572
|
case 22:
|
|
466
|
-
return
|
|
573
|
+
return _context10.abrupt("return", this.setSelection(selection, {
|
|
467
574
|
frozen: (_options$freeze = options.freeze) !== null && _options$freeze !== void 0 ? _options$freeze : false
|
|
468
575
|
}));
|
|
469
576
|
case 23:
|
|
470
577
|
case "end":
|
|
471
|
-
return
|
|
578
|
+
return _context10.stop();
|
|
472
579
|
}
|
|
473
|
-
},
|
|
580
|
+
}, _callee10, this);
|
|
474
581
|
}));
|
|
475
582
|
function prepare() {
|
|
476
583
|
return _prepare.apply(this, arguments);
|