@pisell/pisellos 2.3.51 → 2.3.53
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/BookingContext/utils/buildCacheItemFromOrderLine.js +12 -10
- package/dist/modules/Discount/index.d.ts +0 -1
- package/dist/modules/Discount/index.js +11 -40
- package/dist/modules/Discount/types.d.ts +0 -1
- package/dist/modules/OpenData/index.js +2 -2
- package/dist/modules/Order/index.d.ts +7 -9
- package/dist/modules/Order/index.js +165 -140
- package/dist/modules/Order/types.d.ts +21 -12
- package/dist/modules/Order/types.js +11 -0
- package/dist/modules/Order/utils.d.ts +0 -10
- package/dist/modules/Order/utils.js +3 -35
- package/dist/modules/Product/types.d.ts +0 -1
- package/dist/modules/ProductList/index.js +14 -33
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/Rules/index.js +32 -56
- package/dist/modules/SalesSummary/index.js +13 -12
- package/dist/modules/SalesSummary/utils.js +7 -1
- package/dist/modules/ScanOrderLogger/index.d.ts +0 -2
- package/dist/modules/ScanOrderLogger/index.js +2 -15
- package/dist/modules/ScanOrderLogger/providers/feishu.js +27 -45
- package/dist/modules/ScanOrderLogger/types.d.ts +0 -1
- package/dist/modules/Schedule/index.d.ts +1 -3
- package/dist/modules/Schedule/index.js +16 -21
- package/dist/modules/Summary/utils.js +13 -38
- package/dist/modules/index.d.ts +0 -2
- package/dist/modules/index.js +1 -3
- package/dist/plugins/window.d.ts +0 -1
- package/dist/server/index.d.ts +0 -14
- package/dist/server/index.js +793 -907
- package/dist/solution/BaseSales/index.d.ts +15 -12
- package/dist/solution/BaseSales/index.js +194 -178
- package/dist/solution/BaseSales/utils/cartPromotion.js +5 -3
- package/dist/solution/BookingByStep/index.d.ts +1 -16
- package/dist/solution/BookingByStep/index.js +215 -294
- package/dist/solution/BookingByStep/types.d.ts +1 -2
- package/dist/solution/BookingByStep/types.js +1 -3
- package/dist/solution/BookingByStep/utils/capacity.js +1 -17
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/dist/solution/BookingByStep/utils/timeslots.js +12 -19
- package/dist/solution/BookingTicket/index.d.ts +2 -14
- package/dist/solution/BookingTicket/index.js +2 -2
- package/dist/solution/BookingTicket/types.d.ts +3 -0
- package/dist/solution/BookingTicket/utils/cartView.js +44 -32
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -10
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +16 -2
- package/dist/solution/ScanOrder/index.d.ts +14 -26
- package/dist/solution/ScanOrder/index.js +739 -1142
- package/dist/solution/ScanOrder/types.d.ts +1 -21
- package/dist/solution/ScanOrder/utils.d.ts +0 -8
- package/dist/solution/ScanOrder/utils.js +25 -66
- package/dist/solution/ShopDiscount/index.d.ts +0 -1
- package/dist/solution/ShopDiscount/index.js +87 -125
- package/dist/solution/VenueBooking/index.d.ts +11 -39
- package/dist/solution/VenueBooking/index.js +841 -1167
- package/dist/solution/VenueBooking/types.d.ts +0 -3
- package/dist/solution/VenueBooking/utils/resource.js +0 -1
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +5 -10
- package/dist/solution/index.d.ts +0 -1
- package/dist/solution/index.js +1 -2
- package/dist/types/index.d.ts +0 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -51
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -1
- package/lib/modules/Discount/index.d.ts +0 -1
- package/lib/modules/Discount/index.js +0 -9
- package/lib/modules/Discount/types.d.ts +0 -1
- package/lib/modules/OpenData/index.js +1 -1
- package/lib/modules/Order/index.d.ts +7 -9
- package/lib/modules/Order/index.js +89 -38
- package/lib/modules/Order/types.d.ts +21 -12
- package/lib/modules/Order/utils.d.ts +0 -10
- package/lib/modules/Order/utils.js +5 -36
- package/lib/modules/Product/types.d.ts +0 -1
- package/lib/modules/ProductList/index.js +31 -40
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/Rules/index.js +32 -44
- package/lib/modules/SalesSummary/index.js +7 -6
- package/lib/modules/SalesSummary/utils.js +5 -1
- package/lib/modules/ScanOrderLogger/index.d.ts +0 -2
- package/lib/modules/ScanOrderLogger/index.js +1 -13
- package/lib/modules/ScanOrderLogger/providers/feishu.js +6 -15
- package/lib/modules/ScanOrderLogger/types.d.ts +0 -1
- package/lib/modules/Schedule/index.d.ts +1 -3
- package/lib/modules/Schedule/index.js +8 -10
- package/lib/modules/Summary/utils.js +1 -21
- package/lib/modules/index.d.ts +0 -2
- package/lib/modules/index.js +1 -5
- package/lib/plugins/window.d.ts +0 -1
- package/lib/server/index.d.ts +0 -14
- package/lib/server/index.js +15 -72
- package/lib/solution/BaseSales/index.d.ts +15 -12
- package/lib/solution/BaseSales/index.js +52 -35
- package/lib/solution/BaseSales/utils/cartPromotion.js +5 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -16
- package/lib/solution/BookingByStep/index.js +18 -60
- package/lib/solution/BookingByStep/types.d.ts +1 -2
- package/lib/solution/BookingByStep/types.js +0 -5
- package/lib/solution/BookingByStep/utils/capacity.js +1 -20
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +1 -3
- package/lib/solution/BookingByStep/utils/timeslots.js +11 -19
- package/lib/solution/BookingTicket/index.d.ts +2 -14
- package/lib/solution/BookingTicket/index.js +2 -10
- package/lib/solution/BookingTicket/types.d.ts +3 -0
- package/lib/solution/BookingTicket/utils/cartView.js +43 -30
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +1 -3
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +15 -3
- package/lib/solution/ScanOrder/index.d.ts +14 -26
- package/lib/solution/ScanOrder/index.js +182 -449
- package/lib/solution/ScanOrder/types.d.ts +1 -21
- package/lib/solution/ScanOrder/utils.d.ts +0 -8
- package/lib/solution/ScanOrder/utils.js +0 -31
- package/lib/solution/ShopDiscount/index.d.ts +0 -1
- package/lib/solution/ShopDiscount/index.js +0 -14
- package/lib/solution/VenueBooking/index.d.ts +11 -39
- package/lib/solution/VenueBooking/index.js +110 -322
- package/lib/solution/VenueBooking/types.d.ts +0 -3
- package/lib/solution/VenueBooking/utils/resource.js +0 -1
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +4 -6
- package/lib/solution/index.d.ts +0 -1
- package/lib/solution/index.js +1 -3
- package/lib/types/index.d.ts +0 -1
- package/package.json +1 -1
- package/dist/modules/Holder/index.d.ts +0 -48
- package/dist/modules/Holder/index.js +0 -640
- package/dist/modules/Holder/types.d.ts +0 -123
- package/dist/modules/Holder/types.js +0 -1
- package/dist/modules/Holder/utils.d.ts +0 -13
- package/dist/modules/Holder/utils.js +0 -34
- package/dist/modules/ResourcePlanner/index.d.ts +0 -24
- package/dist/modules/ResourcePlanner/index.js +0 -181
- package/dist/modules/ResourcePlanner/planner.d.ts +0 -14
- package/dist/modules/ResourcePlanner/planner.js +0 -1069
- package/dist/modules/ResourcePlanner/types.d.ts +0 -227
- package/dist/modules/ResourcePlanner/types.js +0 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/dist/solution/UnifiedBookingSales/index.js +0 -1891
- package/dist/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/dist/solution/UnifiedBookingSales/types.js +0 -11
- package/lib/modules/Holder/index.d.ts +0 -48
- package/lib/modules/Holder/index.js +0 -402
- package/lib/modules/Holder/types.d.ts +0 -123
- package/lib/modules/Holder/types.js +0 -17
- package/lib/modules/Holder/utils.d.ts +0 -13
- package/lib/modules/Holder/utils.js +0 -71
- package/lib/modules/ResourcePlanner/index.d.ts +0 -24
- package/lib/modules/ResourcePlanner/index.js +0 -148
- package/lib/modules/ResourcePlanner/planner.d.ts +0 -14
- package/lib/modules/ResourcePlanner/planner.js +0 -933
- package/lib/modules/ResourcePlanner/types.d.ts +0 -227
- package/lib/modules/ResourcePlanner/types.js +0 -17
- package/lib/solution/UnifiedBookingSales/index.d.ts +0 -183
- package/lib/solution/UnifiedBookingSales/index.js +0 -1084
- package/lib/solution/UnifiedBookingSales/types.d.ts +0 -143
- package/lib/solution/UnifiedBookingSales/types.js +0 -33
|
@@ -1,1891 +0,0 @@
|
|
|
1
|
-
var _excluded = ["date", "custom_page_id", "channel", "product_ids"];
|
|
2
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
|
-
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; }
|
|
6
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
7
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
-
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); } }
|
|
10
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
12
|
-
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
13
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
14
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
26
|
-
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."); }
|
|
27
|
-
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); }
|
|
28
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
|
-
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; }
|
|
31
|
-
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); }
|
|
32
|
-
import dayjs from 'dayjs';
|
|
33
|
-
import { OpenDataModule, ResourcePlannerModule } from "../../modules";
|
|
34
|
-
import { getScheduleStartEndTimePoints } from "../../modules/Schedule/getDateIsInSchedule";
|
|
35
|
-
|
|
36
|
-
// import { BaseSalesImpl } from '../BaseSales';
|
|
37
|
-
|
|
38
|
-
import { UnifiedBookingSalesHooks } from "./types";
|
|
39
|
-
import { BookingTicket } from "../BookingTicket";
|
|
40
|
-
export * from "./types";
|
|
41
|
-
var OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow'];
|
|
42
|
-
var OPEN_DATA_CACHE_TTL = 5 * 60 * 1000;
|
|
43
|
-
function pickLocalizedText(value) {
|
|
44
|
-
if (!value) return undefined;
|
|
45
|
-
if (typeof value === 'string') return value;
|
|
46
|
-
if (_typeof(value) === 'object') {
|
|
47
|
-
return value.en || value.zh || value.default || Object.values(value)[0];
|
|
48
|
-
}
|
|
49
|
-
return String(value);
|
|
50
|
-
}
|
|
51
|
-
function resolvePlannerDiscountId(discount) {
|
|
52
|
-
var _ref, _discount$discount$re, _discount$discount;
|
|
53
|
-
return (_ref = (_discount$discount$re = (_discount$discount = discount.discount) === null || _discount$discount === void 0 ? void 0 : _discount$discount.resource_id) !== null && _discount$discount$re !== void 0 ? _discount$discount$re : discount.resource_id) !== null && _ref !== void 0 ? _ref : discount.id;
|
|
54
|
-
}
|
|
55
|
-
function resolvePlannerDiscountTitle(discount) {
|
|
56
|
-
var _discount$discount2;
|
|
57
|
-
return pickLocalizedText(discount.name || discount.format_title || ((_discount$discount2 = discount.discount) === null || _discount$discount2 === void 0 ? void 0 : _discount$discount2.title) || discount.title);
|
|
58
|
-
}
|
|
59
|
-
function isPlannerDiscountAvailable(discount) {
|
|
60
|
-
var _discount$config;
|
|
61
|
-
return discount.isDisabled !== true && discount.isAvailable !== false && ((_discount$config = discount.config) === null || _discount$config === void 0 ? void 0 : _discount$config.isAvailable) !== false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Converts Rules/Order discount internals into a small UI-facing diagnostic. The result keeps
|
|
66
|
-
* candidate-card state separate from line-level applications: a selected card is not proof that
|
|
67
|
-
* it actually discounted a planner product.
|
|
68
|
-
*/
|
|
69
|
-
export function buildPlannerDiscountResult(params) {
|
|
70
|
-
var customerId = params.customerId,
|
|
71
|
-
discountList = params.discountList,
|
|
72
|
-
products = params.products,
|
|
73
|
-
summaryBefore = params.summaryBefore,
|
|
74
|
-
summaryAfter = params.summaryAfter,
|
|
75
|
-
status = params.status,
|
|
76
|
-
preferredDiscountId = params.preferredDiscountId,
|
|
77
|
-
preferredDiscountFound = params.preferredDiscountFound;
|
|
78
|
-
var items = (discountList || []).reduce(function (result, discount) {
|
|
79
|
-
var id = resolvePlannerDiscountId(discount);
|
|
80
|
-
if (id !== undefined && id !== null) {
|
|
81
|
-
result.push({
|
|
82
|
-
id: id,
|
|
83
|
-
name: resolvePlannerDiscountTitle(discount),
|
|
84
|
-
type: discount.tag || discount.type,
|
|
85
|
-
available: isPlannerDiscountAvailable(discount),
|
|
86
|
-
selected: discount.isSelected === true,
|
|
87
|
-
savedAmount: Number(discount.savedAmount || 0) || undefined,
|
|
88
|
-
unavailableReason: discount.unavailableReason || discount.reason
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return result;
|
|
92
|
-
}, []);
|
|
93
|
-
var discountNameById = new Map(items.map(function (item) {
|
|
94
|
-
return [String(item.id), item.name];
|
|
95
|
-
}));
|
|
96
|
-
var applications = [];
|
|
97
|
-
(products || []).forEach(function (product) {
|
|
98
|
-
var productDiscounts = [].concat(_toConsumableArray(Array.isArray(product.discount_list) ? product.discount_list : []), _toConsumableArray(Array.isArray(product.product_bundle) ? product.product_bundle.flatMap(function (bundle) {
|
|
99
|
-
return (bundle === null || bundle === void 0 ? void 0 : bundle.discount_list) || [];
|
|
100
|
-
}) : []));
|
|
101
|
-
productDiscounts.forEach(function (discount) {
|
|
102
|
-
var _product$product_id, _product$metadata;
|
|
103
|
-
var type = discount.tag || discount.type;
|
|
104
|
-
if (!['good_pass', 'discount_card', 'product_discount_card'].includes(type)) return;
|
|
105
|
-
var discountId = resolvePlannerDiscountId(discount);
|
|
106
|
-
applications.push({
|
|
107
|
-
discountId: discountId,
|
|
108
|
-
discountName: discountId === undefined ? undefined : discountNameById.get(String(discountId)),
|
|
109
|
-
discountType: type,
|
|
110
|
-
productId: (_product$product_id = product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product.id,
|
|
111
|
-
productTitle: pickLocalizedText(product.title || product.name || product.product_title),
|
|
112
|
-
productUid: ((_product$metadata = product.metadata) === null || _product$metadata === void 0 ? void 0 : _product$metadata.unique_identification_number) || product.unique_identification_number,
|
|
113
|
-
amount: Number(discount.amount || 0)
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
return {
|
|
118
|
-
status: status,
|
|
119
|
-
customerId: customerId,
|
|
120
|
-
preferredDiscountFound: preferredDiscountFound,
|
|
121
|
-
preferredDiscountApplied: preferredDiscountId === undefined || preferredDiscountId === null ? undefined : items.some(function (item) {
|
|
122
|
-
return String(item.id) === String(preferredDiscountId) && item.selected;
|
|
123
|
-
}) && applications.some(function (item) {
|
|
124
|
-
return String(item.discountId) === String(preferredDiscountId);
|
|
125
|
-
}),
|
|
126
|
-
availableDiscounts: items.filter(function (item) {
|
|
127
|
-
return item.available;
|
|
128
|
-
}),
|
|
129
|
-
selectedDiscounts: items.filter(function (item) {
|
|
130
|
-
return item.selected;
|
|
131
|
-
}),
|
|
132
|
-
applications: applications,
|
|
133
|
-
summaryBefore: summaryBefore,
|
|
134
|
-
summaryAfter: summaryAfter
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function toNumberId(value) {
|
|
138
|
-
if (value === undefined || value === null || value === '') return undefined;
|
|
139
|
-
var parsed = Number(value);
|
|
140
|
-
return Number.isFinite(parsed) ? parsed : String(value);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** Maps several legacy product shapes into the Planner's small, stable vocabulary. */
|
|
144
|
-
function resolveProductKind(product) {
|
|
145
|
-
var _product$cartDetailVa, _product$_extend;
|
|
146
|
-
if (product.duration) return 'duration';
|
|
147
|
-
if (['session_product', 'session_ticket'].includes(product.extension_type)) return 'session';
|
|
148
|
-
if ((_product$cartDetailVa = product.cartDetailValue) !== null && _product$cartDetailVa !== void 0 && _product$cartDetailVa.session || (_product$_extend = product._extend) !== null && _product$_extend !== void 0 && (_product$_extend = _product$_extend.other) !== null && _product$_extend !== void 0 && _product$_extend.session) return 'session';
|
|
149
|
-
if (Array.isArray(product['schedule.ids']) && product['schedule.ids'].length > 0) return 'session';
|
|
150
|
-
return 'normal';
|
|
151
|
-
}
|
|
152
|
-
function normalizeSchedule(product) {
|
|
153
|
-
var _product$cartDetailVa2, _product$_extend2;
|
|
154
|
-
var session = ((_product$cartDetailVa2 = product.cartDetailValue) === null || _product$cartDetailVa2 === void 0 ? void 0 : _product$cartDetailVa2.session) || ((_product$_extend2 = product._extend) === null || _product$_extend2 === void 0 || (_product$_extend2 = _product$_extend2.other) === null || _product$_extend2 === void 0 ? void 0 : _product$_extend2.session) || product.session;
|
|
155
|
-
if (session !== null && session !== void 0 && session.start_at && session !== null && session !== void 0 && session.end_at) {
|
|
156
|
-
return [{
|
|
157
|
-
start_at: session.start_at,
|
|
158
|
-
end_at: session.end_at
|
|
159
|
-
}];
|
|
160
|
-
}
|
|
161
|
-
var schedules = product.schedules || product.schedule || product._schedule;
|
|
162
|
-
if (Array.isArray(schedules)) {
|
|
163
|
-
return schedules.map(function (item) {
|
|
164
|
-
return {
|
|
165
|
-
start_at: item.start_at || item.start || item.start_time,
|
|
166
|
-
end_at: item.end_at || item.end || item.end_time
|
|
167
|
-
};
|
|
168
|
-
}).filter(function (item) {
|
|
169
|
-
return item.start_at && item.end_at;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return [];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Preserves form ownership while flattening default/optional resource ids.
|
|
177
|
-
* `formId` must survive because the order API requires it under booking.resources[].
|
|
178
|
-
*/
|
|
179
|
-
function normalizeRequirements(product) {
|
|
180
|
-
var _product$product_reso;
|
|
181
|
-
var resources = (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
|
|
182
|
-
if (!Array.isArray(resources)) return [];
|
|
183
|
-
return resources.filter(function (resource) {
|
|
184
|
-
return (resource === null || resource === void 0 ? void 0 : resource.status) !== 0;
|
|
185
|
-
}).map(function (resource) {
|
|
186
|
-
var _resource$select_type, _product$capacity;
|
|
187
|
-
return {
|
|
188
|
-
formId: toNumberId(resource.id),
|
|
189
|
-
resourceIds: [].concat(_toConsumableArray(Array.isArray(resource.default_resource) ? resource.default_resource : []), _toConsumableArray(Array.isArray(resource.optional_resource) ? resource.optional_resource : [])).map(function (id) {
|
|
190
|
-
return toNumberId(id);
|
|
191
|
-
}).filter(function (id) {
|
|
192
|
-
return id !== undefined;
|
|
193
|
-
}),
|
|
194
|
-
resourceType: resource.type || ((_resource$select_type = resource.select_type) === null || _resource$select_type === void 0 ? void 0 : _resource$select_type.type) || 'single',
|
|
195
|
-
required: resource.status === 1,
|
|
196
|
-
capacityRequired: Number(((_product$capacity = product.capacity) === null || _product$capacity === void 0 ? void 0 : _product$capacity.default) || product.capacity || 1) || 1
|
|
197
|
-
};
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/** Converts a ProductList record into the pure input shape consumed by ResourcePlanner. */
|
|
202
|
-
export function normalizeProductForPlanner(product) {
|
|
203
|
-
var _raw$id, _raw$duration, _raw$capacity, _ref2, _raw$price;
|
|
204
|
-
var raw = product;
|
|
205
|
-
var kind = resolveProductKind(raw);
|
|
206
|
-
return {
|
|
207
|
-
id: (_raw$id = raw.id) !== null && _raw$id !== void 0 ? _raw$id : raw.product_id,
|
|
208
|
-
title: pickLocalizedText(raw.title || raw.name || raw.product_title),
|
|
209
|
-
kind: kind,
|
|
210
|
-
durationMinutes: Number(((_raw$duration = raw.duration) === null || _raw$duration === void 0 ? void 0 : _raw$duration.value) || raw.duration || raw.service_duration || 30) || 30,
|
|
211
|
-
schedule: normalizeSchedule(raw),
|
|
212
|
-
resourceRequirements: normalizeRequirements(raw),
|
|
213
|
-
capacityRequired: Number(((_raw$capacity = raw.capacity) === null || _raw$capacity === void 0 ? void 0 : _raw$capacity.default) || raw.capacity || 1) || 1,
|
|
214
|
-
quantity: Number(raw.num || raw.quantity || 1) || 1,
|
|
215
|
-
price: (_ref2 = (_raw$price = raw.price) !== null && _raw$price !== void 0 ? _raw$price : raw.selling_price) !== null && _ref2 !== void 0 ? _ref2 : raw.base_price,
|
|
216
|
-
raw: raw
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
function normalizeResourceType(value) {
|
|
220
|
-
if (value === 'multiple' || value === 'capacity') return value;
|
|
221
|
-
return 'single';
|
|
222
|
-
}
|
|
223
|
-
function normalizeResource(raw) {
|
|
224
|
-
var _ref3, _raw$resourceId, _raw$combined_resourc, _ref4, _raw$formId, _raw$select_type;
|
|
225
|
-
var id = (_ref3 = (_raw$resourceId = raw.resourceId) !== null && _raw$resourceId !== void 0 ? _raw$resourceId : raw.resource_id) !== null && _ref3 !== void 0 ? _ref3 : raw.id;
|
|
226
|
-
if (id === undefined || id === null || id === '') return null;
|
|
227
|
-
var combinedResourceIds = (_raw$combined_resourc = raw.combined_resource) === null || _raw$combined_resourc === void 0 ? void 0 : _raw$combined_resourc.resource_ids;
|
|
228
|
-
return {
|
|
229
|
-
id: id,
|
|
230
|
-
formId: (_ref4 = (_raw$formId = raw.formId) !== null && _raw$formId !== void 0 ? _raw$formId : raw.form_id) !== null && _ref4 !== void 0 ? _ref4 : raw.resource_form_id,
|
|
231
|
-
name: raw.resourceName || raw.main_field || raw.name || raw.title,
|
|
232
|
-
resourceType: normalizeResourceType(raw.type || raw.resourceType || ((_raw$select_type = raw.select_type) === null || _raw$select_type === void 0 ? void 0 : _raw$select_type.type)),
|
|
233
|
-
capacity: Number(raw.capacity || raw.max_capacity || 1) || 1,
|
|
234
|
-
times: Array.isArray(raw.times) ? raw.times : [],
|
|
235
|
-
childResourceIds: Array.isArray(combinedResourceIds) ? combinedResourceIds : undefined,
|
|
236
|
-
raw: raw
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function normalizeScheduleIds(raw) {
|
|
240
|
-
var _ref5, _ref6, _raw$schedule;
|
|
241
|
-
var ids = (_ref5 = (_ref6 = (_raw$schedule = raw.schedule) !== null && _raw$schedule !== void 0 ? _raw$schedule : raw.schedule_ids) !== null && _ref6 !== void 0 ? _ref6 : raw.scheduleIds) !== null && _ref5 !== void 0 ? _ref5 : [];
|
|
242
|
-
return (Array.isArray(ids) ? ids : [ids]).map(function (id) {
|
|
243
|
-
return toNumberId(id);
|
|
244
|
-
}).filter(function (id) {
|
|
245
|
-
return id !== undefined;
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
function collectRawScheduleIds(rawResources) {
|
|
249
|
-
var ids = new Map();
|
|
250
|
-
(rawResources || []).forEach(function (resource) {
|
|
251
|
-
normalizeScheduleIds(resource).forEach(function (id) {
|
|
252
|
-
ids.set(String(id), id);
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
return Array.from(ids.values());
|
|
256
|
-
}
|
|
257
|
-
function scheduleListHasIds(scheduleList, scheduleIds) {
|
|
258
|
-
if (!scheduleIds.length) return true;
|
|
259
|
-
var existingIds = new Set((scheduleList || []).map(function (schedule) {
|
|
260
|
-
return String(schedule.id);
|
|
261
|
-
}));
|
|
262
|
-
return scheduleIds.every(function (id) {
|
|
263
|
-
return existingIds.has(String(id));
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
function dateRangeDays(dateRange) {
|
|
267
|
-
if (!(dateRange !== null && dateRange !== void 0 && dateRange.start) || !(dateRange !== null && dateRange !== void 0 && dateRange.end)) return [];
|
|
268
|
-
var dates = [];
|
|
269
|
-
var cursor = dayjs(dateRange.start);
|
|
270
|
-
var end = dayjs(dateRange.end);
|
|
271
|
-
if (!cursor.isValid() || !end.isValid() || end.isBefore(cursor, 'day')) return dates;
|
|
272
|
-
while (cursor.isSame(end, 'day') || cursor.isBefore(end, 'day')) {
|
|
273
|
-
dates.push(cursor.format('YYYY-MM-DD'));
|
|
274
|
-
cursor = cursor.add(1, 'day');
|
|
275
|
-
}
|
|
276
|
-
return dates;
|
|
277
|
-
}
|
|
278
|
-
function normalizePlannerEvent(rawEvent, resourceId) {
|
|
279
|
-
var _ref7, _ref8, _rawEvent$start_at, _ref9, _ref10, _rawEvent$end_at, _ref11, _rawEvent$resource_id, _ref12, _ref13, _rawEvent$pax;
|
|
280
|
-
var startAt = (_ref7 = (_ref8 = (_rawEvent$start_at = rawEvent.start_at) !== null && _rawEvent$start_at !== void 0 ? _rawEvent$start_at : rawEvent.startAt) !== null && _ref8 !== void 0 ? _ref8 : rawEvent.start_time) !== null && _ref7 !== void 0 ? _ref7 : rawEvent.startTime;
|
|
281
|
-
var endAt = (_ref9 = (_ref10 = (_rawEvent$end_at = rawEvent.end_at) !== null && _rawEvent$end_at !== void 0 ? _rawEvent$end_at : rawEvent.endAt) !== null && _ref10 !== void 0 ? _ref10 : rawEvent.end_time) !== null && _ref9 !== void 0 ? _ref9 : rawEvent.endTime;
|
|
282
|
-
if (!startAt || !endAt) return null;
|
|
283
|
-
var rawSource = rawEvent.source;
|
|
284
|
-
var source = rawSource === 'remote' || rawSource === 'cart' || rawSource === 'selection' ? rawSource : 'remote';
|
|
285
|
-
return _objectSpread(_objectSpread({}, rawEvent), {}, {
|
|
286
|
-
resourceId: resourceId,
|
|
287
|
-
resource_id: (_ref11 = (_rawEvent$resource_id = rawEvent.resource_id) !== null && _rawEvent$resource_id !== void 0 ? _rawEvent$resource_id : rawEvent.resourceId) !== null && _ref11 !== void 0 ? _ref11 : resourceId,
|
|
288
|
-
start_at: startAt,
|
|
289
|
-
end_at: endAt,
|
|
290
|
-
pax: Number((_ref12 = (_ref13 = (_rawEvent$pax = rawEvent.pax) !== null && _rawEvent$pax !== void 0 ? _rawEvent$pax : rawEvent.number) !== null && _ref13 !== void 0 ? _ref13 : rawEvent.capacity) !== null && _ref12 !== void 0 ? _ref12 : 1) || 1,
|
|
291
|
-
source: source
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
function normalizeResourceV2(raw) {
|
|
295
|
-
var normalized = normalizeResource(_objectSpread(_objectSpread({}, raw), {}, {
|
|
296
|
-
times: []
|
|
297
|
-
}));
|
|
298
|
-
if (!normalized) return null;
|
|
299
|
-
return normalized;
|
|
300
|
-
}
|
|
301
|
-
function buildResourceWindowFallbackTimes(params) {
|
|
302
|
-
var raw = params.raw,
|
|
303
|
-
dates = params.dates,
|
|
304
|
-
scheduleIds = params.scheduleIds;
|
|
305
|
-
var rawStart = raw.start_time || raw.start_at || raw.startTime;
|
|
306
|
-
var rawEnd = raw.end_time || raw.end_at || raw.endTime;
|
|
307
|
-
if (!rawStart || !rawEnd) return [];
|
|
308
|
-
var startBoundary = dayjs(rawStart);
|
|
309
|
-
var endBoundary = dayjs(rawEnd);
|
|
310
|
-
if (!startBoundary.isValid() || !endBoundary.isValid() || !endBoundary.isAfter(startBoundary)) {
|
|
311
|
-
return [];
|
|
312
|
-
}
|
|
313
|
-
return dates.flatMap(function (date) {
|
|
314
|
-
var dayStart = dayjs("".concat(date, " 00:00:00"));
|
|
315
|
-
var dayEnd = dayjs("".concat(date, " 23:59:59"));
|
|
316
|
-
var start = startBoundary.isAfter(dayStart) ? startBoundary : dayStart;
|
|
317
|
-
var end = endBoundary.isBefore(dayEnd) ? endBoundary : dayEnd;
|
|
318
|
-
if (!end.isAfter(start)) return [];
|
|
319
|
-
return [{
|
|
320
|
-
start_at: start.format('YYYY-MM-DD HH:mm:ss'),
|
|
321
|
-
end_at: end.format('YYYY-MM-DD HH:mm:ss'),
|
|
322
|
-
schedule_ids: scheduleIds,
|
|
323
|
-
source: 'resource_window_fallback'
|
|
324
|
-
}];
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Materializes resource work windows locally from v2's schedule ids, then keeps its flat
|
|
330
|
-
* event_list as planner events. This deliberately avoids the older API's times -> event_list
|
|
331
|
-
* response nesting and lets one resource response serve any requested date range.
|
|
332
|
-
*/
|
|
333
|
-
export function buildPlannerResourcesFromV2(params) {
|
|
334
|
-
var scheduleMap = new Map((params.scheduleList || []).map(function (schedule) {
|
|
335
|
-
return [String(schedule.id), schedule];
|
|
336
|
-
}));
|
|
337
|
-
var dates = dateRangeDays(params.dateRange);
|
|
338
|
-
var externalEvents = [];
|
|
339
|
-
var resources = (params.rawResources || []).map(function (raw) {
|
|
340
|
-
var resource = normalizeResourceV2(raw);
|
|
341
|
-
if (!resource) return null;
|
|
342
|
-
var scheduleIds = normalizeScheduleIds(raw);
|
|
343
|
-
var schedules = scheduleIds.map(function (id) {
|
|
344
|
-
return scheduleMap.get(String(id));
|
|
345
|
-
}).filter(Boolean);
|
|
346
|
-
var matchedScheduleIds = new Set(schedules.map(function (schedule) {
|
|
347
|
-
return String(schedule.id);
|
|
348
|
-
}));
|
|
349
|
-
var missingScheduleIds = scheduleIds.filter(function (id) {
|
|
350
|
-
return !matchedScheduleIds.has(String(id));
|
|
351
|
-
});
|
|
352
|
-
if (missingScheduleIds.length > 0) {
|
|
353
|
-
resource.raw = _objectSpread(_objectSpread({}, resource.raw || raw), {}, {
|
|
354
|
-
_plannerMissingScheduleIds: missingScheduleIds
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
resource.times = dates.flatMap(function (date) {
|
|
358
|
-
return getScheduleStartEndTimePoints(date, schedules).map(function (slot) {
|
|
359
|
-
return {
|
|
360
|
-
start_at: dayjs(slot.start_at).format('YYYY-MM-DD HH:mm:ss'),
|
|
361
|
-
end_at: dayjs(slot.end_at).format('YYYY-MM-DD HH:mm:ss'),
|
|
362
|
-
schedule_ids: scheduleIds
|
|
363
|
-
};
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
if (resource.times.length === 0 && missingScheduleIds.length > 0) {
|
|
367
|
-
resource.times = buildResourceWindowFallbackTimes({
|
|
368
|
-
raw: raw,
|
|
369
|
-
dates: dates,
|
|
370
|
-
scheduleIds: scheduleIds
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
var eventList = Array.isArray(raw.event_list) ? raw.event_list : [];
|
|
374
|
-
eventList.forEach(function (event) {
|
|
375
|
-
var normalizedEvent = normalizePlannerEvent(event, resource.id);
|
|
376
|
-
if (normalizedEvent) externalEvents.push(normalizedEvent);
|
|
377
|
-
});
|
|
378
|
-
return resource;
|
|
379
|
-
}).filter(function (resource) {
|
|
380
|
-
return resource !== null;
|
|
381
|
-
});
|
|
382
|
-
return {
|
|
383
|
-
resources: resources,
|
|
384
|
-
externalEvents: externalEvents
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/** Combines URL-locked resources with every resource referenced by the selected products. */
|
|
389
|
-
export function collectPlannerResourceIds(products) {
|
|
390
|
-
var explicitResourceIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
391
|
-
var ids = new Map();
|
|
392
|
-
var add = function add(value) {
|
|
393
|
-
if (value === undefined || value === null || value === '') return;
|
|
394
|
-
ids.set(String(value), value);
|
|
395
|
-
};
|
|
396
|
-
explicitResourceIds.forEach(add);
|
|
397
|
-
products.forEach(function (product) {
|
|
398
|
-
var _product$resourceRequ;
|
|
399
|
-
(_product$resourceRequ = product.resourceRequirements) === null || _product$resourceRequ === void 0 || _product$resourceRequ.forEach(function (requirement) {
|
|
400
|
-
var _requirement$resource;
|
|
401
|
-
(_requirement$resource = requirement.resourceIds) === null || _requirement$resource === void 0 || _requirement$resource.forEach(add);
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
return Array.from(ids.values());
|
|
405
|
-
}
|
|
406
|
-
function samePlannerId(left, right) {
|
|
407
|
-
if (left === undefined || right === undefined) return false;
|
|
408
|
-
return String(left) === String(right);
|
|
409
|
-
}
|
|
410
|
-
function findRequirementForAssignment(product, assignment) {
|
|
411
|
-
var requirements = product.resourceRequirements || [];
|
|
412
|
-
return requirements.find(function (requirement) {
|
|
413
|
-
return (requirement.resourceIds || []).some(function (id) {
|
|
414
|
-
return samePlannerId(id, assignment.resourceId);
|
|
415
|
-
});
|
|
416
|
-
}) || (requirements.length === 1 ? requirements[0] : undefined) || requirements.find(function (requirement) {
|
|
417
|
-
return requirement.required;
|
|
418
|
-
}) || requirements[0];
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/** Convenience wrapper for the usual one-resource booking case. */
|
|
422
|
-
export function buildBookingFromAssignment(params) {
|
|
423
|
-
return buildBookingFromAssignments({
|
|
424
|
-
assignments: [params.assignment],
|
|
425
|
-
product: params.product
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Converts all resources needed by one product/time interval into the one booking expected by
|
|
431
|
-
* OrderModule. Callers must group assignments before this function so a multi-form booking does
|
|
432
|
-
* not become several competing bookings.
|
|
433
|
-
*/
|
|
434
|
-
export function buildBookingFromAssignments(params) {
|
|
435
|
-
var assignments = params.assignments,
|
|
436
|
-
product = params.product;
|
|
437
|
-
var firstAssignment = assignments[0];
|
|
438
|
-
var start = dayjs(firstAssignment.start_at);
|
|
439
|
-
var end = dayjs(firstAssignment.end_at);
|
|
440
|
-
return {
|
|
441
|
-
start_date: start.format('YYYY-MM-DD'),
|
|
442
|
-
start_time: start.format('HH:mm'),
|
|
443
|
-
end_date: end.format('YYYY-MM-DD'),
|
|
444
|
-
end_time: end.format('HH:mm'),
|
|
445
|
-
duration: Math.max(1, end.diff(start, 'minute')),
|
|
446
|
-
like_status: 'common',
|
|
447
|
-
schedule_id: 0,
|
|
448
|
-
resources: assignments.map(function (assignment) {
|
|
449
|
-
var requirement = findRequirementForAssignment(product, assignment);
|
|
450
|
-
return {
|
|
451
|
-
id: assignment.resourceId,
|
|
452
|
-
resource_id: assignment.resourceId,
|
|
453
|
-
form_id: requirement === null || requirement === void 0 ? void 0 : requirement.formId,
|
|
454
|
-
relation_type: 'form',
|
|
455
|
-
relation_id: assignment.resourceId,
|
|
456
|
-
like_status: 'common',
|
|
457
|
-
capacity: assignment.capacityRequired || product.capacityRequired || 1
|
|
458
|
-
};
|
|
459
|
-
}),
|
|
460
|
-
metadata: {
|
|
461
|
-
unified_booking_sales: true,
|
|
462
|
-
planner_source: product.kind
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
function buildAssignmentGroupKey(assignment) {
|
|
467
|
-
return [assignment.productId, assignment.start_at, assignment.end_at].join(':');
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/** Builds the exact identity BaseSales needs to remove only this solution's order lines. */
|
|
471
|
-
export function buildPlannerLineIdentity(product) {
|
|
472
|
-
var _product$product_vari, _product$metadata2;
|
|
473
|
-
return {
|
|
474
|
-
product_id: product.product_id,
|
|
475
|
-
product_variant_id: (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : 0,
|
|
476
|
-
unique_identification_number: ((_product$metadata2 = product.metadata) === null || _product$metadata2 === void 0 ? void 0 : _product$metadata2.unique_identification_number) || product.unique_identification_number,
|
|
477
|
-
product_sku: product.product_sku,
|
|
478
|
-
product_bundle: product.product_bundle
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
482
|
-
_inherits(UnifiedBookingSalesImpl, _BookingTicket);
|
|
483
|
-
var _super = _createSuper(UnifiedBookingSalesImpl);
|
|
484
|
-
function UnifiedBookingSalesImpl() {
|
|
485
|
-
var _this;
|
|
486
|
-
_classCallCheck(this, UnifiedBookingSalesImpl);
|
|
487
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
488
|
-
args[_key] = arguments[_key];
|
|
489
|
-
}
|
|
490
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
491
|
-
_defineProperty(_assertThisInitialized(_this), "defaultName", 'unifiedBookingSales');
|
|
492
|
-
_defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
|
|
493
|
-
_defineProperty(_assertThisInitialized(_this), "store", {});
|
|
494
|
-
_defineProperty(_assertThisInitialized(_this), "unifiedProductCatalog", []);
|
|
495
|
-
_defineProperty(_assertThisInitialized(_this), "openDataTarget", null);
|
|
496
|
-
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlight", null);
|
|
497
|
-
_defineProperty(_assertThisInitialized(_this), "loadOpenDataInFlightTarget", null);
|
|
498
|
-
return _this;
|
|
499
|
-
}
|
|
500
|
-
_createClass(UnifiedBookingSalesImpl, [{
|
|
501
|
-
key: "shouldUseCheckoutSyncTask",
|
|
502
|
-
value:
|
|
503
|
-
/**
|
|
504
|
-
* Kiosk 不能把已收款订单留在本地等待重试:默认直接等待云端 checkout。
|
|
505
|
-
* 兼容仍需要 WebPOS 待同步模式的入口可显式传 checkoutSyncTaskEnabled: true。
|
|
506
|
-
*/
|
|
507
|
-
function shouldUseCheckoutSyncTask() {
|
|
508
|
-
var _this$otherParams;
|
|
509
|
-
var configured = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.checkoutSyncTaskEnabled;
|
|
510
|
-
return typeof configured === 'boolean' ? configured : false;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
/** UnifiedBookingSales 的真实结账默认请求收据数据,供云端确认后再本地打印。 */
|
|
514
|
-
}, {
|
|
515
|
-
key: "getDefaultCheckoutSmallTicketDataFlag",
|
|
516
|
-
value: function getDefaultCheckoutSmallTicketDataFlag() {
|
|
517
|
-
return 1;
|
|
518
|
-
}
|
|
519
|
-
}, {
|
|
520
|
-
key: "getRegisteredModuleNames",
|
|
521
|
-
value: function getRegisteredModuleNames() {
|
|
522
|
-
return [].concat(_toConsumableArray(_get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "getRegisteredModuleNames", this).call(this)), ['resourcePlanner', 'openData']);
|
|
523
|
-
}
|
|
524
|
-
}, {
|
|
525
|
-
key: "createSubModule",
|
|
526
|
-
value: function createSubModule(moduleName) {
|
|
527
|
-
if (moduleName === 'resourcePlanner') {
|
|
528
|
-
return new ResourcePlannerModule("".concat(this.name, "_resourcePlanner"));
|
|
529
|
-
}
|
|
530
|
-
if (moduleName === 'openData') {
|
|
531
|
-
return new OpenDataModule("".concat(this.name, "_openData"));
|
|
532
|
-
}
|
|
533
|
-
return _get(_getPrototypeOf(UnifiedBookingSalesImpl.prototype), "createSubModule", this).call(this, moduleName);
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* Loads OpenData without borrowing BookingTicket. Cache ownership is tied to the exact
|
|
538
|
-
* business/channel target so a reused solution instance cannot leak another entry's menus.
|
|
539
|
-
*/
|
|
540
|
-
}, {
|
|
541
|
-
key: "loadOpenData",
|
|
542
|
-
value: (function () {
|
|
543
|
-
var _loadOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
544
|
-
var businessCode, channel, target, cachedData, lastFetchedAt, openData;
|
|
545
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
546
|
-
while (1) switch (_context.prev = _context.next) {
|
|
547
|
-
case 0:
|
|
548
|
-
if (this.store.openData) {
|
|
549
|
-
_context.next = 2;
|
|
550
|
-
break;
|
|
551
|
-
}
|
|
552
|
-
throw new Error('[UnifiedBookingSales] openData 模块未初始化');
|
|
553
|
-
case 2:
|
|
554
|
-
businessCode = String(params.businessCode || '').trim();
|
|
555
|
-
channel = String(params.channel || '').trim();
|
|
556
|
-
if (!(!businessCode || !channel)) {
|
|
557
|
-
_context.next = 6;
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
throw new Error('[UnifiedBookingSales] OpenData 需要 businessCode 与 channel');
|
|
561
|
-
case 6:
|
|
562
|
-
target = "".concat(businessCode, "+").concat(channel);
|
|
563
|
-
cachedData = this.store.openData.getOpenData();
|
|
564
|
-
lastFetchedAt = this.store.openData.getLastFetchedAt();
|
|
565
|
-
if (!(!params.force && this.openDataTarget === target && cachedData && lastFetchedAt && Date.now() - lastFetchedAt < OPEN_DATA_CACHE_TTL)) {
|
|
566
|
-
_context.next = 11;
|
|
567
|
-
break;
|
|
568
|
-
}
|
|
569
|
-
return _context.abrupt("return", cachedData);
|
|
570
|
-
case 11:
|
|
571
|
-
if (!this.loadOpenDataInFlight) {
|
|
572
|
-
_context.next = 19;
|
|
573
|
-
break;
|
|
574
|
-
}
|
|
575
|
-
if (!(this.loadOpenDataInFlightTarget === target)) {
|
|
576
|
-
_context.next = 16;
|
|
577
|
-
break;
|
|
578
|
-
}
|
|
579
|
-
_context.next = 15;
|
|
580
|
-
return this.loadOpenDataInFlight;
|
|
581
|
-
case 15:
|
|
582
|
-
return _context.abrupt("return", _context.sent);
|
|
583
|
-
case 16:
|
|
584
|
-
_context.next = 18;
|
|
585
|
-
return this.loadOpenDataInFlight;
|
|
586
|
-
case 18:
|
|
587
|
-
return _context.abrupt("return", this.loadOpenData(params));
|
|
588
|
-
case 19:
|
|
589
|
-
this.loadOpenDataInFlightTarget = target;
|
|
590
|
-
this.loadOpenDataInFlight = this.store.openData.fetchOpenData({
|
|
591
|
-
scope: 'board',
|
|
592
|
-
target: target,
|
|
593
|
-
section_code: [].concat(OPEN_DATA_SECTION_CODES)
|
|
594
|
-
});
|
|
595
|
-
_context.prev = 21;
|
|
596
|
-
_context.next = 24;
|
|
597
|
-
return this.loadOpenDataInFlight;
|
|
598
|
-
case 24:
|
|
599
|
-
openData = _context.sent;
|
|
600
|
-
this.openDataTarget = target;
|
|
601
|
-
this.otherParams.openData = openData;
|
|
602
|
-
this.otherParams.businessCode = businessCode;
|
|
603
|
-
this.otherParams.channel = channel;
|
|
604
|
-
return _context.abrupt("return", openData);
|
|
605
|
-
case 30:
|
|
606
|
-
_context.prev = 30;
|
|
607
|
-
this.loadOpenDataInFlight = null;
|
|
608
|
-
this.loadOpenDataInFlightTarget = null;
|
|
609
|
-
return _context.finish(30);
|
|
610
|
-
case 34:
|
|
611
|
-
case "end":
|
|
612
|
-
return _context.stop();
|
|
613
|
-
}
|
|
614
|
-
}, _callee, this, [[21,, 30, 34]]);
|
|
615
|
-
}));
|
|
616
|
-
function loadOpenData(_x) {
|
|
617
|
-
return _loadOpenData.apply(this, arguments);
|
|
618
|
-
}
|
|
619
|
-
return loadOpenData;
|
|
620
|
-
}())
|
|
621
|
-
}, {
|
|
622
|
-
key: "getOpenData",
|
|
623
|
-
value: function () {
|
|
624
|
-
var _getOpenData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
625
|
-
var _this$otherParams2, _this$otherParams3, _this$store$openData;
|
|
626
|
-
var businessCode, channel, target, cachedData;
|
|
627
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
628
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
629
|
-
case 0:
|
|
630
|
-
businessCode = String(((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.businessCode) || '').trim();
|
|
631
|
-
channel = String(((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.channel) || '').trim();
|
|
632
|
-
if (!(!businessCode || !channel)) {
|
|
633
|
-
_context2.next = 4;
|
|
634
|
-
break;
|
|
635
|
-
}
|
|
636
|
-
return _context2.abrupt("return", null);
|
|
637
|
-
case 4:
|
|
638
|
-
target = "".concat(businessCode, "+").concat(channel);
|
|
639
|
-
cachedData = ((_this$store$openData = this.store.openData) === null || _this$store$openData === void 0 ? void 0 : _this$store$openData.getOpenData()) || null;
|
|
640
|
-
if (!(cachedData && this.openDataTarget === target)) {
|
|
641
|
-
_context2.next = 8;
|
|
642
|
-
break;
|
|
643
|
-
}
|
|
644
|
-
return _context2.abrupt("return", cachedData);
|
|
645
|
-
case 8:
|
|
646
|
-
return _context2.abrupt("return", this.loadOpenData({
|
|
647
|
-
businessCode: businessCode,
|
|
648
|
-
channel: channel
|
|
649
|
-
}));
|
|
650
|
-
case 9:
|
|
651
|
-
case "end":
|
|
652
|
-
return _context2.stop();
|
|
653
|
-
}
|
|
654
|
-
}, _callee2, this);
|
|
655
|
-
}));
|
|
656
|
-
function getOpenData() {
|
|
657
|
-
return _getOpenData.apply(this, arguments);
|
|
658
|
-
}
|
|
659
|
-
return getOpenData;
|
|
660
|
-
}()
|
|
661
|
-
/**
|
|
662
|
-
* Loads the product catalog used by both UI and Planner. Schedule data is requested with each
|
|
663
|
-
* product because session products carry their fixed intervals there.
|
|
664
|
-
*/
|
|
665
|
-
}, {
|
|
666
|
-
key: "loadProducts",
|
|
667
|
-
value: (function () {
|
|
668
|
-
var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
669
|
-
var params,
|
|
670
|
-
options,
|
|
671
|
-
schedule_date,
|
|
672
|
-
schedule_datetime,
|
|
673
|
-
result,
|
|
674
|
-
_args3 = arguments;
|
|
675
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
676
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
677
|
-
case 0:
|
|
678
|
-
params = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
679
|
-
options = _args3.length > 1 ? _args3[1] : undefined;
|
|
680
|
-
if (this.store.products) {
|
|
681
|
-
_context3.next = 4;
|
|
682
|
-
break;
|
|
683
|
-
}
|
|
684
|
-
throw new Error('[UnifiedBookingSales] products 模块未初始化');
|
|
685
|
-
case 4:
|
|
686
|
-
schedule_date = params.schedule_date || dayjs().format('YYYY-MM-DD');
|
|
687
|
-
schedule_datetime = params.schedule_datetime || "".concat(schedule_date, " ").concat(dayjs().format('HH:mm:ss'));
|
|
688
|
-
_context3.next = 8;
|
|
689
|
-
return this.store.products.loadProducts(_objectSpread(_objectSpread({
|
|
690
|
-
with_count: ['bundleGroup', 'optionGroup'],
|
|
691
|
-
with_schedule: 1
|
|
692
|
-
}, params), {}, {
|
|
693
|
-
schedule_date: schedule_date,
|
|
694
|
-
schedule_datetime: schedule_datetime,
|
|
695
|
-
cacheId: this.cacheId
|
|
696
|
-
}), options);
|
|
697
|
-
case 8:
|
|
698
|
-
result = _context3.sent;
|
|
699
|
-
this.unifiedProductCatalog = Array.isArray(result) ? _toConsumableArray(result) : [];
|
|
700
|
-
_context3.next = 12;
|
|
701
|
-
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), result);
|
|
702
|
-
case 12:
|
|
703
|
-
return _context3.abrupt("return", result);
|
|
704
|
-
case 13:
|
|
705
|
-
case "end":
|
|
706
|
-
return _context3.stop();
|
|
707
|
-
}
|
|
708
|
-
}, _callee3, this);
|
|
709
|
-
}));
|
|
710
|
-
function loadProducts() {
|
|
711
|
-
return _loadProducts.apply(this, arguments);
|
|
712
|
-
}
|
|
713
|
-
return loadProducts;
|
|
714
|
-
}() /** Date-first entry point. It delegates protocol details and cache ownership to ScheduleModule. */)
|
|
715
|
-
}, {
|
|
716
|
-
key: "loadScheduleAvailableDate",
|
|
717
|
-
value: (function () {
|
|
718
|
-
var _loadScheduleAvailableDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(params) {
|
|
719
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
720
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
721
|
-
case 0:
|
|
722
|
-
if (this.store.schedule) {
|
|
723
|
-
_context4.next = 2;
|
|
724
|
-
break;
|
|
725
|
-
}
|
|
726
|
-
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
727
|
-
case 2:
|
|
728
|
-
return _context4.abrupt("return", this.store.schedule.loadScheduleAvailableDate(params));
|
|
729
|
-
case 3:
|
|
730
|
-
case "end":
|
|
731
|
-
return _context4.stop();
|
|
732
|
-
}
|
|
733
|
-
}, _callee4, this);
|
|
734
|
-
}));
|
|
735
|
-
function loadScheduleAvailableDate(_x2) {
|
|
736
|
-
return _loadScheduleAvailableDate.apply(this, arguments);
|
|
737
|
-
}
|
|
738
|
-
return loadScheduleAvailableDate;
|
|
739
|
-
}()
|
|
740
|
-
/**
|
|
741
|
-
* Implements the date-first product pool: the chosen date's product ids plus globally sellable
|
|
742
|
-
* other_product_ids. If a batch product query is unexpectedly empty, retry one id at a time so
|
|
743
|
-
* a partial backend incompatibility does not hide the entire date's catalog.
|
|
744
|
-
*/
|
|
745
|
-
)
|
|
746
|
-
}, {
|
|
747
|
-
key: "loadProductsByScheduleDate",
|
|
748
|
-
value: (function () {
|
|
749
|
-
var _loadProductsByScheduleDate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(params) {
|
|
750
|
-
var _this$store$schedule$, _this$store$schedule, _this$store$schedule$2, _this$store$schedule2, _this$store$schedule$3, _this$store$schedule3, _this$store$schedule$4, _this$store$schedule4;
|
|
751
|
-
var date, custom_page_id, channel, product_ids, productLoadParams, cachedDates, hasCachedDate, hasOtherProducts, scheduleDate, productIdFilter, availableProductIds, products, fallbackProducts, _iterator, _step, productId, result;
|
|
752
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
753
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
754
|
-
case 0:
|
|
755
|
-
date = params.date, custom_page_id = params.custom_page_id, channel = params.channel, product_ids = params.product_ids, productLoadParams = _objectWithoutProperties(params, _excluded);
|
|
756
|
-
if (this.store.schedule) {
|
|
757
|
-
_context5.next = 3;
|
|
758
|
-
break;
|
|
759
|
-
}
|
|
760
|
-
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
761
|
-
case 3:
|
|
762
|
-
cachedDates = ((_this$store$schedule$ = (_this$store$schedule = this.store.schedule).getAvailabilityScheduleDateList) === null || _this$store$schedule$ === void 0 ? void 0 : _this$store$schedule$.call(_this$store$schedule)) || [];
|
|
763
|
-
hasCachedDate = cachedDates.some(function (item) {
|
|
764
|
-
return item.date === date;
|
|
765
|
-
});
|
|
766
|
-
hasOtherProducts = (((_this$store$schedule$2 = (_this$store$schedule2 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$2 === void 0 ? void 0 : _this$store$schedule$2.call(_this$store$schedule2)) || []).length > 0;
|
|
767
|
-
if (!(!hasCachedDate && !hasOtherProducts)) {
|
|
768
|
-
_context5.next = 9;
|
|
769
|
-
break;
|
|
770
|
-
}
|
|
771
|
-
_context5.next = 9;
|
|
772
|
-
return this.loadScheduleAvailableDate({
|
|
773
|
-
startDate: date,
|
|
774
|
-
endDate: date,
|
|
775
|
-
custom_page_id: custom_page_id,
|
|
776
|
-
channel: channel
|
|
777
|
-
});
|
|
778
|
-
case 9:
|
|
779
|
-
scheduleDate = (_this$store$schedule$3 = (_this$store$schedule3 = this.store.schedule).getAvailabilityScheduleDateList) === null || _this$store$schedule$3 === void 0 || (_this$store$schedule$3 = _this$store$schedule$3.call(_this$store$schedule3)) === null || _this$store$schedule$3 === void 0 ? void 0 : _this$store$schedule$3.find(function (item) {
|
|
780
|
-
return item.date === date;
|
|
781
|
-
});
|
|
782
|
-
productIdFilter = product_ids !== null && product_ids !== void 0 && product_ids.length ? new Set(product_ids.map(function (id) {
|
|
783
|
-
return String(id);
|
|
784
|
-
})) : null;
|
|
785
|
-
availableProductIds = [].concat(_toConsumableArray((scheduleDate === null || scheduleDate === void 0 ? void 0 : scheduleDate.product_ids) || []), _toConsumableArray(((_this$store$schedule$4 = (_this$store$schedule4 = this.store.schedule).getOtherProductsIds) === null || _this$store$schedule$4 === void 0 ? void 0 : _this$store$schedule$4.call(_this$store$schedule4)) || [])).filter(function (id, index, self) {
|
|
786
|
-
return self.indexOf(id) === index;
|
|
787
|
-
}).filter(function (id) {
|
|
788
|
-
return !productIdFilter || productIdFilter.has(String(id));
|
|
789
|
-
});
|
|
790
|
-
if (availableProductIds.length) {
|
|
791
|
-
_context5.next = 17;
|
|
792
|
-
break;
|
|
793
|
-
}
|
|
794
|
-
this.unifiedProductCatalog = [];
|
|
795
|
-
_context5.next = 16;
|
|
796
|
-
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), []);
|
|
797
|
-
case 16:
|
|
798
|
-
return _context5.abrupt("return", []);
|
|
799
|
-
case 17:
|
|
800
|
-
_context5.next = 19;
|
|
801
|
-
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
802
|
-
product_ids: availableProductIds,
|
|
803
|
-
schedule_date: date
|
|
804
|
-
}));
|
|
805
|
-
case 19:
|
|
806
|
-
products = _context5.sent;
|
|
807
|
-
if (!(products.length || availableProductIds.length <= 1)) {
|
|
808
|
-
_context5.next = 22;
|
|
809
|
-
break;
|
|
810
|
-
}
|
|
811
|
-
return _context5.abrupt("return", products);
|
|
812
|
-
case 22:
|
|
813
|
-
fallbackProducts = [];
|
|
814
|
-
_iterator = _createForOfIteratorHelper(availableProductIds);
|
|
815
|
-
_context5.prev = 24;
|
|
816
|
-
_iterator.s();
|
|
817
|
-
case 26:
|
|
818
|
-
if ((_step = _iterator.n()).done) {
|
|
819
|
-
_context5.next = 34;
|
|
820
|
-
break;
|
|
821
|
-
}
|
|
822
|
-
productId = _step.value;
|
|
823
|
-
_context5.next = 30;
|
|
824
|
-
return this.loadProducts(_objectSpread(_objectSpread({}, productLoadParams), {}, {
|
|
825
|
-
product_ids: [productId],
|
|
826
|
-
schedule_date: date
|
|
827
|
-
}));
|
|
828
|
-
case 30:
|
|
829
|
-
result = _context5.sent;
|
|
830
|
-
result.forEach(function (product) {
|
|
831
|
-
var _id;
|
|
832
|
-
var id = (_id = product === null || product === void 0 ? void 0 : product.id) !== null && _id !== void 0 ? _id : product === null || product === void 0 ? void 0 : product.product_id;
|
|
833
|
-
if (!fallbackProducts.some(function (item) {
|
|
834
|
-
var _id2;
|
|
835
|
-
return String((_id2 = item === null || item === void 0 ? void 0 : item.id) !== null && _id2 !== void 0 ? _id2 : item === null || item === void 0 ? void 0 : item.product_id) === String(id);
|
|
836
|
-
})) {
|
|
837
|
-
fallbackProducts.push(product);
|
|
838
|
-
}
|
|
839
|
-
});
|
|
840
|
-
case 32:
|
|
841
|
-
_context5.next = 26;
|
|
842
|
-
break;
|
|
843
|
-
case 34:
|
|
844
|
-
_context5.next = 39;
|
|
845
|
-
break;
|
|
846
|
-
case 36:
|
|
847
|
-
_context5.prev = 36;
|
|
848
|
-
_context5.t0 = _context5["catch"](24);
|
|
849
|
-
_iterator.e(_context5.t0);
|
|
850
|
-
case 39:
|
|
851
|
-
_context5.prev = 39;
|
|
852
|
-
_iterator.f();
|
|
853
|
-
return _context5.finish(39);
|
|
854
|
-
case 42:
|
|
855
|
-
this.unifiedProductCatalog = [].concat(fallbackProducts);
|
|
856
|
-
_context5.next = 45;
|
|
857
|
-
return this.core.effects.emit("".concat(this.name, ":onProductsLoaded"), fallbackProducts);
|
|
858
|
-
case 45:
|
|
859
|
-
return _context5.abrupt("return", fallbackProducts);
|
|
860
|
-
case 46:
|
|
861
|
-
case "end":
|
|
862
|
-
return _context5.stop();
|
|
863
|
-
}
|
|
864
|
-
}, _callee5, this, [[24, 36, 39, 42]]);
|
|
865
|
-
}));
|
|
866
|
-
function loadProductsByScheduleDate(_x3) {
|
|
867
|
-
return _loadProductsByScheduleDate.apply(this, arguments);
|
|
868
|
-
}
|
|
869
|
-
return loadProductsByScheduleDate;
|
|
870
|
-
}() /** Returns a copy so UI consumers cannot accidentally mutate the solution's product cache. */)
|
|
871
|
-
}, {
|
|
872
|
-
key: "getProductCatalog",
|
|
873
|
-
value: function getProductCatalog() {
|
|
874
|
-
return {
|
|
875
|
-
products: _toConsumableArray(this.unifiedProductCatalog)
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* Read-only compatibility view for salesSdk skins. It reconnects a booking to its product but
|
|
881
|
-
* must not be used to mutate tempOrder; all writes go through BaseSales / planner APIs.
|
|
882
|
-
*/
|
|
883
|
-
}, {
|
|
884
|
-
key: "getCart",
|
|
885
|
-
value: function getCart() {
|
|
886
|
-
var tempOrder = this.getTempOrder();
|
|
887
|
-
var salesDetail = this.getSalesOrder();
|
|
888
|
-
var items = (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [];
|
|
889
|
-
var bookings = (salesDetail === null || salesDetail === void 0 ? void 0 : salesDetail.bookings) || (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) || [];
|
|
890
|
-
return {
|
|
891
|
-
items: items,
|
|
892
|
-
bookings: bookings.map(function (booking) {
|
|
893
|
-
var productUid = booking === null || booking === void 0 ? void 0 : booking.product_uid;
|
|
894
|
-
var product = productUid ? items.find(function (item) {
|
|
895
|
-
var _item$metadata;
|
|
896
|
-
var uid = (item === null || item === void 0 || (_item$metadata = item.metadata) === null || _item$metadata === void 0 ? void 0 : _item$metadata.unique_identification_number) || (item === null || item === void 0 ? void 0 : item.unique_identification_number);
|
|
897
|
-
return String(uid || '') === String(productUid);
|
|
898
|
-
}) || null : null;
|
|
899
|
-
return _objectSpread(_objectSpread({}, booking), {}, {
|
|
900
|
-
_extend: _objectSpread(_objectSpread({}, (booking === null || booking === void 0 ? void 0 : booking._extend) || {}), {}, {
|
|
901
|
-
product: product,
|
|
902
|
-
addTimeProduct: [],
|
|
903
|
-
canAddTime: false
|
|
904
|
-
})
|
|
905
|
-
});
|
|
906
|
-
})
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Loads the current customer's product coupons and discount cards after planner lines exist,
|
|
912
|
-
* then optionally lets the existing Rules engine select the best valid combination. This is a
|
|
913
|
-
* diagnostic boundary for new booking skins: no pricing logic is duplicated in the planner.
|
|
914
|
-
*/
|
|
915
|
-
}, {
|
|
916
|
-
key: "applyPlannerDiscounts",
|
|
917
|
-
value: (function () {
|
|
918
|
-
var _applyPlannerDiscounts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
919
|
-
var _params$customerId;
|
|
920
|
-
var params,
|
|
921
|
-
tempOrder,
|
|
922
|
-
requestedCustomerId,
|
|
923
|
-
parsedCustomerId,
|
|
924
|
-
customerId,
|
|
925
|
-
summaryBefore,
|
|
926
|
-
preferredDiscountId,
|
|
927
|
-
preferredDiscount,
|
|
928
|
-
preferredId,
|
|
929
|
-
selectedOtherDiscounts,
|
|
930
|
-
_iterator2,
|
|
931
|
-
_step2,
|
|
932
|
-
discount,
|
|
933
|
-
discountId,
|
|
934
|
-
nextTempOrder,
|
|
935
|
-
_args6 = arguments;
|
|
936
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
937
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
938
|
-
case 0:
|
|
939
|
-
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
940
|
-
tempOrder = this.getTempOrder();
|
|
941
|
-
requestedCustomerId = (_params$customerId = params.customerId) !== null && _params$customerId !== void 0 ? _params$customerId : tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.customer_id;
|
|
942
|
-
parsedCustomerId = Number(requestedCustomerId);
|
|
943
|
-
customerId = Number.isFinite(parsedCustomerId) && parsedCustomerId > 1 ? parsedCustomerId : null;
|
|
944
|
-
_context6.next = 7;
|
|
945
|
-
return this.getSummary();
|
|
946
|
-
case 7:
|
|
947
|
-
summaryBefore = _context6.sent;
|
|
948
|
-
if (customerId) {
|
|
949
|
-
_context6.next = 10;
|
|
950
|
-
break;
|
|
951
|
-
}
|
|
952
|
-
return _context6.abrupt("return", buildPlannerDiscountResult({
|
|
953
|
-
customerId: null,
|
|
954
|
-
discountList: this.getDiscountList(),
|
|
955
|
-
products: (tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || [],
|
|
956
|
-
summaryBefore: summaryBefore,
|
|
957
|
-
summaryAfter: summaryBefore,
|
|
958
|
-
status: 'no_customer'
|
|
959
|
-
}));
|
|
960
|
-
case 10:
|
|
961
|
-
_context6.next = 12;
|
|
962
|
-
return this.loadDiscountConfig({
|
|
963
|
-
customerId: customerId,
|
|
964
|
-
action: 'create'
|
|
965
|
-
});
|
|
966
|
-
case 12:
|
|
967
|
-
preferredDiscountId = params.preferredDiscountId;
|
|
968
|
-
preferredDiscount = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : this.getDiscountList().find(function (discount) {
|
|
969
|
-
var _resolvePlannerDiscou;
|
|
970
|
-
return String((_resolvePlannerDiscou = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou !== void 0 ? _resolvePlannerDiscou : '') === String(preferredDiscountId);
|
|
971
|
-
});
|
|
972
|
-
if (!preferredDiscount) {
|
|
973
|
-
_context6.next = 40;
|
|
974
|
-
break;
|
|
975
|
-
}
|
|
976
|
-
// A requested card is an explicit UI choice, not a best-effort preference. Clear prior
|
|
977
|
-
// automatic selections first; otherwise Rules may keep the old selected card and silently
|
|
978
|
-
// apply it instead of the card the customer clicked.
|
|
979
|
-
preferredId = resolvePlannerDiscountId(preferredDiscount);
|
|
980
|
-
selectedOtherDiscounts = this.getDiscountList().filter(function (discount) {
|
|
981
|
-
var _resolvePlannerDiscou2;
|
|
982
|
-
return discount.isSelected === true && String((_resolvePlannerDiscou2 = resolvePlannerDiscountId(discount)) !== null && _resolvePlannerDiscou2 !== void 0 ? _resolvePlannerDiscou2 : '') !== String(preferredId);
|
|
983
|
-
});
|
|
984
|
-
_iterator2 = _createForOfIteratorHelper(selectedOtherDiscounts);
|
|
985
|
-
_context6.prev = 18;
|
|
986
|
-
_iterator2.s();
|
|
987
|
-
case 20:
|
|
988
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
989
|
-
_context6.next = 28;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
discount = _step2.value;
|
|
993
|
-
discountId = Number(resolvePlannerDiscountId(discount));
|
|
994
|
-
if (!Number.isFinite(discountId)) {
|
|
995
|
-
_context6.next = 26;
|
|
996
|
-
break;
|
|
997
|
-
}
|
|
998
|
-
_context6.next = 26;
|
|
999
|
-
return this.setDiscountSelected({
|
|
1000
|
-
discountId: discountId,
|
|
1001
|
-
isSelected: false
|
|
1002
|
-
});
|
|
1003
|
-
case 26:
|
|
1004
|
-
_context6.next = 20;
|
|
1005
|
-
break;
|
|
1006
|
-
case 28:
|
|
1007
|
-
_context6.next = 33;
|
|
1008
|
-
break;
|
|
1009
|
-
case 30:
|
|
1010
|
-
_context6.prev = 30;
|
|
1011
|
-
_context6.t0 = _context6["catch"](18);
|
|
1012
|
-
_iterator2.e(_context6.t0);
|
|
1013
|
-
case 33:
|
|
1014
|
-
_context6.prev = 33;
|
|
1015
|
-
_iterator2.f();
|
|
1016
|
-
return _context6.finish(33);
|
|
1017
|
-
case 36:
|
|
1018
|
-
_context6.next = 38;
|
|
1019
|
-
return this.setDiscountSelected({
|
|
1020
|
-
discountId: Number(preferredId),
|
|
1021
|
-
isSelected: true
|
|
1022
|
-
});
|
|
1023
|
-
case 38:
|
|
1024
|
-
_context6.next = 49;
|
|
1025
|
-
break;
|
|
1026
|
-
case 40:
|
|
1027
|
-
if (!(preferredDiscountId === undefined || preferredDiscountId === null)) {
|
|
1028
|
-
_context6.next = 46;
|
|
1029
|
-
break;
|
|
1030
|
-
}
|
|
1031
|
-
if (!(params.applyBestDiscount !== false)) {
|
|
1032
|
-
_context6.next = 44;
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
_context6.next = 44;
|
|
1036
|
-
return this.bestDiscount();
|
|
1037
|
-
case 44:
|
|
1038
|
-
_context6.next = 49;
|
|
1039
|
-
break;
|
|
1040
|
-
case 46:
|
|
1041
|
-
if (!(params.applyBestDiscount !== false)) {
|
|
1042
|
-
_context6.next = 49;
|
|
1043
|
-
break;
|
|
1044
|
-
}
|
|
1045
|
-
_context6.next = 49;
|
|
1046
|
-
return this.bestDiscount();
|
|
1047
|
-
case 49:
|
|
1048
|
-
nextTempOrder = this.getTempOrder();
|
|
1049
|
-
_context6.t1 = buildPlannerDiscountResult;
|
|
1050
|
-
_context6.t2 = customerId;
|
|
1051
|
-
_context6.t3 = this.getDiscountList();
|
|
1052
|
-
_context6.t4 = (nextTempOrder === null || nextTempOrder === void 0 ? void 0 : nextTempOrder.products) || [];
|
|
1053
|
-
_context6.t5 = summaryBefore;
|
|
1054
|
-
_context6.next = 57;
|
|
1055
|
-
return this.getSummary();
|
|
1056
|
-
case 57:
|
|
1057
|
-
_context6.t6 = _context6.sent;
|
|
1058
|
-
_context6.t7 = params.applyBestDiscount === false && !preferredDiscount ? 'loaded' : 'applied';
|
|
1059
|
-
_context6.t8 = preferredDiscountId;
|
|
1060
|
-
_context6.t9 = preferredDiscountId === undefined || preferredDiscountId === null ? undefined : Boolean(preferredDiscount);
|
|
1061
|
-
_context6.t10 = {
|
|
1062
|
-
customerId: _context6.t2,
|
|
1063
|
-
discountList: _context6.t3,
|
|
1064
|
-
products: _context6.t4,
|
|
1065
|
-
summaryBefore: _context6.t5,
|
|
1066
|
-
summaryAfter: _context6.t6,
|
|
1067
|
-
status: _context6.t7,
|
|
1068
|
-
preferredDiscountId: _context6.t8,
|
|
1069
|
-
preferredDiscountFound: _context6.t9
|
|
1070
|
-
};
|
|
1071
|
-
return _context6.abrupt("return", (0, _context6.t1)(_context6.t10));
|
|
1072
|
-
case 63:
|
|
1073
|
-
case "end":
|
|
1074
|
-
return _context6.stop();
|
|
1075
|
-
}
|
|
1076
|
-
}, _callee6, this, [[18, 30, 33, 36]]);
|
|
1077
|
-
}));
|
|
1078
|
-
function applyPlannerDiscounts() {
|
|
1079
|
-
return _applyPlannerDiscounts.apply(this, arguments);
|
|
1080
|
-
}
|
|
1081
|
-
return applyPlannerDiscounts;
|
|
1082
|
-
}() /** ResourcePlanner is a required child module; fail early instead of producing partial availability. */)
|
|
1083
|
-
}, {
|
|
1084
|
-
key: "getPlanner",
|
|
1085
|
-
value: function getPlanner() {
|
|
1086
|
-
if (!this.store.resourcePlanner) {
|
|
1087
|
-
throw new Error('[UnifiedBookingSales] resourcePlanner 模块未初始化');
|
|
1088
|
-
}
|
|
1089
|
-
return this.store.resourcePlanner;
|
|
1090
|
-
}
|
|
1091
|
-
}, {
|
|
1092
|
-
key: "buildUnifiedOrderProduct",
|
|
1093
|
-
value: function buildUnifiedOrderProduct(sourceProduct, ownershipKey, product) {
|
|
1094
|
-
var _sourceProduct$id, _ref14, _sourceProduct$produc, _ref15, _ref16, _sourceProduct$quanti, _sourceProduct$price, _ref17, _sourceProduct$sellin;
|
|
1095
|
-
var orderProduct = this.transformBaseProductToOrderProduct({
|
|
1096
|
-
payload: _objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
1097
|
-
id: (_sourceProduct$id = sourceProduct.id) !== null && _sourceProduct$id !== void 0 ? _sourceProduct$id : product === null || product === void 0 ? void 0 : product.id,
|
|
1098
|
-
product_id: (_ref14 = (_sourceProduct$produc = sourceProduct.product_id) !== null && _sourceProduct$produc !== void 0 ? _sourceProduct$produc : sourceProduct.id) !== null && _ref14 !== void 0 ? _ref14 : product === null || product === void 0 ? void 0 : product.id,
|
|
1099
|
-
quantity: (_ref15 = (_ref16 = (_sourceProduct$quanti = sourceProduct.quantity) !== null && _sourceProduct$quanti !== void 0 ? _sourceProduct$quanti : sourceProduct.num) !== null && _ref16 !== void 0 ? _ref16 : product === null || product === void 0 ? void 0 : product.quantity) !== null && _ref15 !== void 0 ? _ref15 : 1,
|
|
1100
|
-
price: (_sourceProduct$price = sourceProduct.price) !== null && _sourceProduct$price !== void 0 ? _sourceProduct$price : product === null || product === void 0 ? void 0 : product.price,
|
|
1101
|
-
selling_price: (_ref17 = (_sourceProduct$sellin = sourceProduct.selling_price) !== null && _sourceProduct$sellin !== void 0 ? _sourceProduct$sellin : sourceProduct.price) !== null && _ref17 !== void 0 ? _ref17 : product === null || product === void 0 ? void 0 : product.price,
|
|
1102
|
-
metadata: _objectSpread(_objectSpread({}, sourceProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true))
|
|
1103
|
-
}),
|
|
1104
|
-
sourceProduct: sourceProduct
|
|
1105
|
-
});
|
|
1106
|
-
if (orderProduct && _typeof(orderProduct) === 'object') {
|
|
1107
|
-
// BaseSales may rebuild metadata from its price source. Stamp ownership after that transform
|
|
1108
|
-
// so each UnifiedBookingSales entry point can replace only its own temporary lines.
|
|
1109
|
-
orderProduct.metadata = _objectSpread(_objectSpread({}, orderProduct.metadata || {}), {}, _defineProperty({}, ownershipKey, true));
|
|
1110
|
-
}
|
|
1111
|
-
return orderProduct;
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
/** Replacing a staged selection is idempotent and never removes unrelated cart lines. */
|
|
1115
|
-
}, {
|
|
1116
|
-
key: "removeExistingStagedLines",
|
|
1117
|
-
value: (function () {
|
|
1118
|
-
var _removeExistingStagedLines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ownershipKey) {
|
|
1119
|
-
var _this$getTempOrder;
|
|
1120
|
-
var existingLines;
|
|
1121
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1122
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
1123
|
-
case 0:
|
|
1124
|
-
existingLines = (((_this$getTempOrder = this.getTempOrder()) === null || _this$getTempOrder === void 0 ? void 0 : _this$getTempOrder.products) || []).filter(function (product) {
|
|
1125
|
-
var _product$metadata3;
|
|
1126
|
-
return (product === null || product === void 0 || (_product$metadata3 = product.metadata) === null || _product$metadata3 === void 0 ? void 0 : _product$metadata3[ownershipKey]) === true;
|
|
1127
|
-
});
|
|
1128
|
-
if (!(existingLines.length > 0)) {
|
|
1129
|
-
_context7.next = 4;
|
|
1130
|
-
break;
|
|
1131
|
-
}
|
|
1132
|
-
_context7.next = 4;
|
|
1133
|
-
return this.removeProductsFromOrder(existingLines.map(buildPlannerLineIdentity));
|
|
1134
|
-
case 4:
|
|
1135
|
-
case "end":
|
|
1136
|
-
return _context7.stop();
|
|
1137
|
-
}
|
|
1138
|
-
}, _callee7, this);
|
|
1139
|
-
}));
|
|
1140
|
-
function removeExistingStagedLines(_x4) {
|
|
1141
|
-
return _removeExistingStagedLines.apply(this, arguments);
|
|
1142
|
-
}
|
|
1143
|
-
return removeExistingStagedLines;
|
|
1144
|
-
}())
|
|
1145
|
-
}, {
|
|
1146
|
-
key: "stageProducts",
|
|
1147
|
-
value: function () {
|
|
1148
|
-
var _stageProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, ownershipKey) {
|
|
1149
|
-
var _params$rawProducts;
|
|
1150
|
-
var productIds, existingIds, missingIds, productIdSet, selectedProducts, _i, _arr, sourceProduct, productInput;
|
|
1151
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1152
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
1153
|
-
case 0:
|
|
1154
|
-
productIds = params.productIds || [];
|
|
1155
|
-
if (productIds.length) {
|
|
1156
|
-
_context8.next = 3;
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
return _context8.abrupt("return", this.getTempOrder());
|
|
1160
|
-
case 3:
|
|
1161
|
-
if (!((_params$rawProducts = params.rawProducts) !== null && _params$rawProducts !== void 0 && _params$rawProducts.length)) {
|
|
1162
|
-
_context8.next = 7;
|
|
1163
|
-
break;
|
|
1164
|
-
}
|
|
1165
|
-
this.unifiedProductCatalog = params.rawProducts;
|
|
1166
|
-
_context8.next = 12;
|
|
1167
|
-
break;
|
|
1168
|
-
case 7:
|
|
1169
|
-
existingIds = new Set((this.unifiedProductCatalog || []).map(function (product) {
|
|
1170
|
-
var _product$id;
|
|
1171
|
-
return String((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : product.product_id);
|
|
1172
|
-
}));
|
|
1173
|
-
missingIds = productIds.filter(function (id) {
|
|
1174
|
-
return !existingIds.has(String(id));
|
|
1175
|
-
});
|
|
1176
|
-
if (!(missingIds.length || params.productLoadParams)) {
|
|
1177
|
-
_context8.next = 12;
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
_context8.next = 12;
|
|
1181
|
-
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
1182
|
-
product_ids: productIds.map(Number).filter(Number.isFinite)
|
|
1183
|
-
}));
|
|
1184
|
-
case 12:
|
|
1185
|
-
_context8.next = 14;
|
|
1186
|
-
return this.removeExistingStagedLines(ownershipKey);
|
|
1187
|
-
case 14:
|
|
1188
|
-
productIdSet = new Set(productIds.map(function (id) {
|
|
1189
|
-
return String(id);
|
|
1190
|
-
}));
|
|
1191
|
-
selectedProducts = (this.unifiedProductCatalog || []).filter(function (product) {
|
|
1192
|
-
var _product$id2;
|
|
1193
|
-
return productIdSet.has(String((_product$id2 = product.id) !== null && _product$id2 !== void 0 ? _product$id2 : product.product_id));
|
|
1194
|
-
});
|
|
1195
|
-
_i = 0, _arr = selectedProducts;
|
|
1196
|
-
case 17:
|
|
1197
|
-
if (!(_i < _arr.length)) {
|
|
1198
|
-
_context8.next = 26;
|
|
1199
|
-
break;
|
|
1200
|
-
}
|
|
1201
|
-
sourceProduct = _arr[_i];
|
|
1202
|
-
productInput = this.buildUnifiedOrderProduct(sourceProduct, ownershipKey);
|
|
1203
|
-
if (!productInput) {
|
|
1204
|
-
_context8.next = 23;
|
|
1205
|
-
break;
|
|
1206
|
-
}
|
|
1207
|
-
_context8.next = 23;
|
|
1208
|
-
return this.addProductToOrder(productInput);
|
|
1209
|
-
case 23:
|
|
1210
|
-
_i++;
|
|
1211
|
-
_context8.next = 17;
|
|
1212
|
-
break;
|
|
1213
|
-
case 26:
|
|
1214
|
-
return _context8.abrupt("return", this.getTempOrder());
|
|
1215
|
-
case 27:
|
|
1216
|
-
case "end":
|
|
1217
|
-
return _context8.stop();
|
|
1218
|
-
}
|
|
1219
|
-
}, _callee8, this);
|
|
1220
|
-
}));
|
|
1221
|
-
function stageProducts(_x5, _x6) {
|
|
1222
|
-
return _stageProducts.apply(this, arguments);
|
|
1223
|
-
}
|
|
1224
|
-
return stageProducts;
|
|
1225
|
-
}()
|
|
1226
|
-
/**
|
|
1227
|
-
* Adds the current product choice to an otherwise clean planner cart without creating bookings.
|
|
1228
|
-
* This separates "what the customer wants" from the later time/resource confirmation step.
|
|
1229
|
-
*/
|
|
1230
|
-
}, {
|
|
1231
|
-
key: "stagePlannerProducts",
|
|
1232
|
-
value: (function () {
|
|
1233
|
-
var _stagePlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params) {
|
|
1234
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1235
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
1236
|
-
case 0:
|
|
1237
|
-
return _context9.abrupt("return", this.stageProducts(params, 'unified_booking_sales'));
|
|
1238
|
-
case 1:
|
|
1239
|
-
case "end":
|
|
1240
|
-
return _context9.stop();
|
|
1241
|
-
}
|
|
1242
|
-
}, _callee9, this);
|
|
1243
|
-
}));
|
|
1244
|
-
function stagePlannerProducts(_x7) {
|
|
1245
|
-
return _stagePlannerProducts.apply(this, arguments);
|
|
1246
|
-
}
|
|
1247
|
-
return stagePlannerProducts;
|
|
1248
|
-
}()
|
|
1249
|
-
/**
|
|
1250
|
-
* Adds ordinary retail products without asking ResourcePlanner for booking facts.
|
|
1251
|
-
* Its staged lines have separate ownership so planner and retail skins can coexist safely.
|
|
1252
|
-
*/
|
|
1253
|
-
)
|
|
1254
|
-
}, {
|
|
1255
|
-
key: "stageRetailProducts",
|
|
1256
|
-
value: (function () {
|
|
1257
|
-
var _stageRetailProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(params) {
|
|
1258
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1259
|
-
while (1) switch (_context10.prev = _context10.next) {
|
|
1260
|
-
case 0:
|
|
1261
|
-
return _context10.abrupt("return", this.stageProducts(params, 'unified_booking_sales_retail'));
|
|
1262
|
-
case 1:
|
|
1263
|
-
case "end":
|
|
1264
|
-
return _context10.stop();
|
|
1265
|
-
}
|
|
1266
|
-
}, _callee10, this);
|
|
1267
|
-
}));
|
|
1268
|
-
function stageRetailProducts(_x8) {
|
|
1269
|
-
return _stageRetailProducts.apply(this, arguments);
|
|
1270
|
-
}
|
|
1271
|
-
return stageRetailProducts;
|
|
1272
|
-
}()
|
|
1273
|
-
/**
|
|
1274
|
-
* Adds one retail line without replacing the cart's existing retail selection.
|
|
1275
|
-
* This is intentionally separate from stageRetailProducts(), whose contract is
|
|
1276
|
-
* "replace the staged selection" for demo and wizard-like callers.
|
|
1277
|
-
*/
|
|
1278
|
-
)
|
|
1279
|
-
}, {
|
|
1280
|
-
key: "addRetailProduct",
|
|
1281
|
-
value: (function () {
|
|
1282
|
-
var _addRetailProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(params) {
|
|
1283
|
-
var _params$quantity, _ref18, _params$productId, _params$product, _params$product2;
|
|
1284
|
-
var quantity, productId, sourceProduct, products, orderProduct;
|
|
1285
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1286
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
1287
|
-
case 0:
|
|
1288
|
-
quantity = Math.floor(Number((_params$quantity = params.quantity) !== null && _params$quantity !== void 0 ? _params$quantity : 1));
|
|
1289
|
-
if (!(!Number.isFinite(quantity) || quantity <= 0)) {
|
|
1290
|
-
_context11.next = 3;
|
|
1291
|
-
break;
|
|
1292
|
-
}
|
|
1293
|
-
throw new Error('[UnifiedBookingSales] retail 商品数量必须大于 0');
|
|
1294
|
-
case 3:
|
|
1295
|
-
productId = (_ref18 = (_params$productId = params.productId) !== null && _params$productId !== void 0 ? _params$productId : (_params$product = params.product) === null || _params$product === void 0 ? void 0 : _params$product.id) !== null && _ref18 !== void 0 ? _ref18 : (_params$product2 = params.product) === null || _params$product2 === void 0 ? void 0 : _params$product2.product_id;
|
|
1296
|
-
sourceProduct = params.product;
|
|
1297
|
-
if (!sourceProduct && productId !== undefined && productId !== null) {
|
|
1298
|
-
sourceProduct = this.unifiedProductCatalog.find(function (product) {
|
|
1299
|
-
var _product$id3;
|
|
1300
|
-
return String((_product$id3 = product.id) !== null && _product$id3 !== void 0 ? _product$id3 : product.product_id) === String(productId);
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
if (!(!sourceProduct && productId !== undefined && productId !== null)) {
|
|
1304
|
-
_context11.next = 11;
|
|
1305
|
-
break;
|
|
1306
|
-
}
|
|
1307
|
-
_context11.next = 9;
|
|
1308
|
-
return this.loadProducts(_objectSpread(_objectSpread({}, params.productLoadParams || {}), {}, {
|
|
1309
|
-
product_ids: [Number(productId)].filter(Number.isFinite)
|
|
1310
|
-
}));
|
|
1311
|
-
case 9:
|
|
1312
|
-
products = _context11.sent;
|
|
1313
|
-
sourceProduct = products.find(function (product) {
|
|
1314
|
-
var _product$id4;
|
|
1315
|
-
return String((_product$id4 = product.id) !== null && _product$id4 !== void 0 ? _product$id4 : product.product_id) === String(productId);
|
|
1316
|
-
});
|
|
1317
|
-
case 11:
|
|
1318
|
-
if (sourceProduct) {
|
|
1319
|
-
_context11.next = 13;
|
|
1320
|
-
break;
|
|
1321
|
-
}
|
|
1322
|
-
throw new Error("[UnifiedBookingSales] \u672A\u627E\u5230\u96F6\u552E\u5546\u54C1 ".concat(String(productId !== null && productId !== void 0 ? productId : '')).trim());
|
|
1323
|
-
case 13:
|
|
1324
|
-
orderProduct = this.buildUnifiedOrderProduct(_objectSpread(_objectSpread({}, sourceProduct), {}, {
|
|
1325
|
-
quantity: quantity
|
|
1326
|
-
}), 'unified_booking_sales_retail');
|
|
1327
|
-
if (orderProduct) {
|
|
1328
|
-
_context11.next = 16;
|
|
1329
|
-
break;
|
|
1330
|
-
}
|
|
1331
|
-
throw new Error('[UnifiedBookingSales] 无法生成零售商品订单行');
|
|
1332
|
-
case 16:
|
|
1333
|
-
return _context11.abrupt("return", this.addProductToOrder(orderProduct));
|
|
1334
|
-
case 17:
|
|
1335
|
-
case "end":
|
|
1336
|
-
return _context11.stop();
|
|
1337
|
-
}
|
|
1338
|
-
}, _callee11, this);
|
|
1339
|
-
}));
|
|
1340
|
-
function addRetailProduct(_x9) {
|
|
1341
|
-
return _addRetailProduct.apply(this, arguments);
|
|
1342
|
-
}
|
|
1343
|
-
return addRetailProduct;
|
|
1344
|
-
}() /** Normalizes caller-provided products or loads the catalog before any resource request is made. */)
|
|
1345
|
-
}, {
|
|
1346
|
-
key: "loadPlannerProducts",
|
|
1347
|
-
value: (function () {
|
|
1348
|
-
var _loadPlannerProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(params) {
|
|
1349
|
-
var _params$context, _params$rawProducts2, _params$productLoadPa, _this$getProductCatal;
|
|
1350
|
-
var productIds, _params$productLoadPa2;
|
|
1351
|
-
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1352
|
-
while (1) switch (_context12.prev = _context12.next) {
|
|
1353
|
-
case 0:
|
|
1354
|
-
if (!((_params$context = params.context) !== null && _params$context !== void 0 && (_params$context = _params$context.products) !== null && _params$context !== void 0 && _params$context.length)) {
|
|
1355
|
-
_context12.next = 2;
|
|
1356
|
-
break;
|
|
1357
|
-
}
|
|
1358
|
-
return _context12.abrupt("return", params.context.products);
|
|
1359
|
-
case 2:
|
|
1360
|
-
if (!((_params$rawProducts2 = params.rawProducts) !== null && _params$rawProducts2 !== void 0 && _params$rawProducts2.length)) {
|
|
1361
|
-
_context12.next = 4;
|
|
1362
|
-
break;
|
|
1363
|
-
}
|
|
1364
|
-
return _context12.abrupt("return", params.rawProducts.map(normalizeProductForPlanner));
|
|
1365
|
-
case 4:
|
|
1366
|
-
productIds = params.productIds || ((_params$productLoadPa = params.productLoadParams) === null || _params$productLoadPa === void 0 ? void 0 : _params$productLoadPa.product_ids) || [];
|
|
1367
|
-
if (!(productIds.length > 0 || params.productLoadParams)) {
|
|
1368
|
-
_context12.next = 8;
|
|
1369
|
-
break;
|
|
1370
|
-
}
|
|
1371
|
-
_context12.next = 8;
|
|
1372
|
-
return this.loadProducts(_objectSpread(_objectSpread(_objectSpread({}, params.date ? {
|
|
1373
|
-
schedule_date: params.date
|
|
1374
|
-
} : {}), params.productLoadParams || {}), {}, {
|
|
1375
|
-
product_ids: productIds.length ? productIds.map(Number).filter(Number.isFinite) : (_params$productLoadPa2 = params.productLoadParams) === null || _params$productLoadPa2 === void 0 ? void 0 : _params$productLoadPa2.product_ids
|
|
1376
|
-
}));
|
|
1377
|
-
case 8:
|
|
1378
|
-
return _context12.abrupt("return", (((_this$getProductCatal = this.getProductCatalog) === null || _this$getProductCatal === void 0 ? void 0 : _this$getProductCatal.call(this).products) || []).map(normalizeProductForPlanner));
|
|
1379
|
-
case 9:
|
|
1380
|
-
case "end":
|
|
1381
|
-
return _context12.stop();
|
|
1382
|
-
}
|
|
1383
|
-
}, _callee12, this);
|
|
1384
|
-
}));
|
|
1385
|
-
function loadPlannerProducts(_x10) {
|
|
1386
|
-
return _loadPlannerProducts.apply(this, arguments);
|
|
1387
|
-
}
|
|
1388
|
-
return loadPlannerProducts;
|
|
1389
|
-
}() /** Loads the reusable store-level schedule catalog on demand. */)
|
|
1390
|
-
}, {
|
|
1391
|
-
key: "ensurePlannerSchedulesLoaded",
|
|
1392
|
-
value: (function () {
|
|
1393
|
-
var _ensurePlannerSchedulesLoaded = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1394
|
-
var _this$store$schedule$5, _this$store$schedule5, _this$store$schedule$6, _this$store$schedule6, _this$store$schedule$7, _this$store$schedule7;
|
|
1395
|
-
var scheduleList;
|
|
1396
|
-
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1397
|
-
while (1) switch (_context13.prev = _context13.next) {
|
|
1398
|
-
case 0:
|
|
1399
|
-
if (this.store.schedule) {
|
|
1400
|
-
_context13.next = 2;
|
|
1401
|
-
break;
|
|
1402
|
-
}
|
|
1403
|
-
throw new Error('[UnifiedBookingSales] schedule 模块未初始化');
|
|
1404
|
-
case 2:
|
|
1405
|
-
scheduleList = ((_this$store$schedule$5 = (_this$store$schedule5 = this.store.schedule).getScheduleList) === null || _this$store$schedule$5 === void 0 ? void 0 : _this$store$schedule$5.call(_this$store$schedule5)) || [];
|
|
1406
|
-
if (!(!((_this$store$schedule$6 = (_this$store$schedule6 = this.store.schedule).isScheduleListLoaded) !== null && _this$store$schedule$6 !== void 0 && _this$store$schedule$6.call(_this$store$schedule6)) || scheduleList.length === 0)) {
|
|
1407
|
-
_context13.next = 6;
|
|
1408
|
-
break;
|
|
1409
|
-
}
|
|
1410
|
-
_context13.next = 6;
|
|
1411
|
-
return this.store.schedule.loadAllSchedule();
|
|
1412
|
-
case 6:
|
|
1413
|
-
return _context13.abrupt("return", ((_this$store$schedule$7 = (_this$store$schedule7 = this.store.schedule).getScheduleList) === null || _this$store$schedule$7 === void 0 ? void 0 : _this$store$schedule$7.call(_this$store$schedule7)) || []);
|
|
1414
|
-
case 7:
|
|
1415
|
-
case "end":
|
|
1416
|
-
return _context13.stop();
|
|
1417
|
-
}
|
|
1418
|
-
}, _callee13, this);
|
|
1419
|
-
}));
|
|
1420
|
-
function ensurePlannerSchedulesLoaded() {
|
|
1421
|
-
return _ensurePlannerSchedulesLoaded.apply(this, arguments);
|
|
1422
|
-
}
|
|
1423
|
-
return ensurePlannerSchedulesLoaded;
|
|
1424
|
-
}()
|
|
1425
|
-
/**
|
|
1426
|
-
* v2 resources reference schedule ids rather than expanded work times. Refresh once when the
|
|
1427
|
-
* cached schedule catalog cannot materialize all referenced ids.
|
|
1428
|
-
*/
|
|
1429
|
-
)
|
|
1430
|
-
}, {
|
|
1431
|
-
key: "ensurePlannerSchedulesForResources",
|
|
1432
|
-
value: (function () {
|
|
1433
|
-
var _ensurePlannerSchedulesForResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(rawResources) {
|
|
1434
|
-
var scheduleList, scheduleIds, _this$store$schedule$8, _this$store$schedule8;
|
|
1435
|
-
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1436
|
-
while (1) switch (_context14.prev = _context14.next) {
|
|
1437
|
-
case 0:
|
|
1438
|
-
_context14.next = 2;
|
|
1439
|
-
return this.ensurePlannerSchedulesLoaded();
|
|
1440
|
-
case 2:
|
|
1441
|
-
scheduleList = _context14.sent;
|
|
1442
|
-
scheduleIds = collectRawScheduleIds(rawResources);
|
|
1443
|
-
if (scheduleListHasIds(scheduleList, scheduleIds)) {
|
|
1444
|
-
_context14.next = 8;
|
|
1445
|
-
break;
|
|
1446
|
-
}
|
|
1447
|
-
_context14.next = 7;
|
|
1448
|
-
return this.store.schedule.loadAllSchedule({
|
|
1449
|
-
useCache: false
|
|
1450
|
-
});
|
|
1451
|
-
case 7:
|
|
1452
|
-
scheduleList = ((_this$store$schedule$8 = (_this$store$schedule8 = this.store.schedule).getScheduleList) === null || _this$store$schedule$8 === void 0 ? void 0 : _this$store$schedule$8.call(_this$store$schedule8)) || [];
|
|
1453
|
-
case 8:
|
|
1454
|
-
return _context14.abrupt("return", scheduleList);
|
|
1455
|
-
case 9:
|
|
1456
|
-
case "end":
|
|
1457
|
-
return _context14.stop();
|
|
1458
|
-
}
|
|
1459
|
-
}, _callee14, this);
|
|
1460
|
-
}));
|
|
1461
|
-
function ensurePlannerSchedulesForResources(_x11) {
|
|
1462
|
-
return _ensurePlannerSchedulesForResources.apply(this, arguments);
|
|
1463
|
-
}
|
|
1464
|
-
return ensurePlannerSchedulesForResources;
|
|
1465
|
-
}()
|
|
1466
|
-
/**
|
|
1467
|
-
* Fetches resource metadata plus flat occupied events. Work windows are intentionally derived
|
|
1468
|
-
* locally in buildPlannerResourcesFromV2 from /schedule, rather than requested from the legacy
|
|
1469
|
-
* resource dates endpoint.
|
|
1470
|
-
*/
|
|
1471
|
-
)
|
|
1472
|
-
}, {
|
|
1473
|
-
key: "fetchPlannerResourcesV2",
|
|
1474
|
-
value: (function () {
|
|
1475
|
-
var _fetchPlannerResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(params) {
|
|
1476
|
-
var response, data;
|
|
1477
|
-
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1478
|
-
while (1) switch (_context15.prev = _context15.next) {
|
|
1479
|
-
case 0:
|
|
1480
|
-
_context15.next = 2;
|
|
1481
|
-
return this.request.get('/schedule/resource/list/v2', {
|
|
1482
|
-
start_date: params.dateRange.start,
|
|
1483
|
-
end_date: params.dateRange.end,
|
|
1484
|
-
resource_ids: params.resourceIds,
|
|
1485
|
-
front_end_cache_id: false
|
|
1486
|
-
}, {
|
|
1487
|
-
useCache: false
|
|
1488
|
-
});
|
|
1489
|
-
case 2:
|
|
1490
|
-
response = _context15.sent;
|
|
1491
|
-
data = response === null || response === void 0 ? void 0 : response.data;
|
|
1492
|
-
if (!Array.isArray(data)) {
|
|
1493
|
-
_context15.next = 6;
|
|
1494
|
-
break;
|
|
1495
|
-
}
|
|
1496
|
-
return _context15.abrupt("return", data);
|
|
1497
|
-
case 6:
|
|
1498
|
-
if (!Array.isArray(data === null || data === void 0 ? void 0 : data.list)) {
|
|
1499
|
-
_context15.next = 8;
|
|
1500
|
-
break;
|
|
1501
|
-
}
|
|
1502
|
-
return _context15.abrupt("return", data.list);
|
|
1503
|
-
case 8:
|
|
1504
|
-
return _context15.abrupt("return", []);
|
|
1505
|
-
case 9:
|
|
1506
|
-
case "end":
|
|
1507
|
-
return _context15.stop();
|
|
1508
|
-
}
|
|
1509
|
-
}, _callee15, this);
|
|
1510
|
-
}));
|
|
1511
|
-
function fetchPlannerResourcesV2(_x12) {
|
|
1512
|
-
return _fetchPlannerResourcesV.apply(this, arguments);
|
|
1513
|
-
}
|
|
1514
|
-
return fetchPlannerResourcesV2;
|
|
1515
|
-
}()
|
|
1516
|
-
/**
|
|
1517
|
-
* Resolves the Planner context in precedence order: explicit normalized context, test raw data,
|
|
1518
|
-
* then the v2 resource API inferred from selected product requirements and any URL lock.
|
|
1519
|
-
*/
|
|
1520
|
-
)
|
|
1521
|
-
}, {
|
|
1522
|
-
key: "loadPlannerResources",
|
|
1523
|
-
value: (function () {
|
|
1524
|
-
var _loadPlannerResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(params) {
|
|
1525
|
-
var _params$context2, _params$rawResources, _params$context5;
|
|
1526
|
-
var products,
|
|
1527
|
-
_params$context3,
|
|
1528
|
-
resourceIds,
|
|
1529
|
-
_params$context4,
|
|
1530
|
-
rawResources,
|
|
1531
|
-
scheduleList,
|
|
1532
|
-
materialized,
|
|
1533
|
-
_args16 = arguments;
|
|
1534
|
-
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1535
|
-
while (1) switch (_context16.prev = _context16.next) {
|
|
1536
|
-
case 0:
|
|
1537
|
-
products = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : [];
|
|
1538
|
-
if (!((_params$context2 = params.context) !== null && _params$context2 !== void 0 && (_params$context2 = _params$context2.resources) !== null && _params$context2 !== void 0 && _params$context2.length)) {
|
|
1539
|
-
_context16.next = 3;
|
|
1540
|
-
break;
|
|
1541
|
-
}
|
|
1542
|
-
return _context16.abrupt("return", {
|
|
1543
|
-
resources: params.context.resources,
|
|
1544
|
-
externalEvents: params.context.externalEvents || []
|
|
1545
|
-
});
|
|
1546
|
-
case 3:
|
|
1547
|
-
if (!((_params$rawResources = params.rawResources) !== null && _params$rawResources !== void 0 && _params$rawResources.length)) {
|
|
1548
|
-
_context16.next = 5;
|
|
1549
|
-
break;
|
|
1550
|
-
}
|
|
1551
|
-
return _context16.abrupt("return", {
|
|
1552
|
-
resources: params.rawResources.map(normalizeResource).filter(function (resource) {
|
|
1553
|
-
return resource !== null;
|
|
1554
|
-
}),
|
|
1555
|
-
externalEvents: ((_params$context3 = params.context) === null || _params$context3 === void 0 ? void 0 : _params$context3.externalEvents) || []
|
|
1556
|
-
});
|
|
1557
|
-
case 5:
|
|
1558
|
-
resourceIds = collectPlannerResourceIds(products, params.resourceIds || []);
|
|
1559
|
-
if (!(!params.useResourceDateApi || !params.dateRange || resourceIds.length === 0)) {
|
|
1560
|
-
_context16.next = 8;
|
|
1561
|
-
break;
|
|
1562
|
-
}
|
|
1563
|
-
return _context16.abrupt("return", {
|
|
1564
|
-
resources: [],
|
|
1565
|
-
externalEvents: ((_params$context4 = params.context) === null || _params$context4 === void 0 ? void 0 : _params$context4.externalEvents) || []
|
|
1566
|
-
});
|
|
1567
|
-
case 8:
|
|
1568
|
-
_context16.next = 10;
|
|
1569
|
-
return this.fetchPlannerResourcesV2({
|
|
1570
|
-
dateRange: params.dateRange,
|
|
1571
|
-
resourceIds: resourceIds
|
|
1572
|
-
});
|
|
1573
|
-
case 10:
|
|
1574
|
-
rawResources = _context16.sent;
|
|
1575
|
-
_context16.next = 13;
|
|
1576
|
-
return this.ensurePlannerSchedulesForResources(rawResources);
|
|
1577
|
-
case 13:
|
|
1578
|
-
scheduleList = _context16.sent;
|
|
1579
|
-
materialized = buildPlannerResourcesFromV2({
|
|
1580
|
-
rawResources: rawResources,
|
|
1581
|
-
scheduleList: scheduleList,
|
|
1582
|
-
dateRange: params.dateRange
|
|
1583
|
-
});
|
|
1584
|
-
return _context16.abrupt("return", {
|
|
1585
|
-
resources: materialized.resources,
|
|
1586
|
-
externalEvents: [].concat(_toConsumableArray(((_params$context5 = params.context) === null || _params$context5 === void 0 ? void 0 : _params$context5.externalEvents) || []), _toConsumableArray(materialized.externalEvents))
|
|
1587
|
-
});
|
|
1588
|
-
case 16:
|
|
1589
|
-
case "end":
|
|
1590
|
-
return _context16.stop();
|
|
1591
|
-
}
|
|
1592
|
-
}, _callee16, this);
|
|
1593
|
-
}));
|
|
1594
|
-
function loadPlannerResources(_x13) {
|
|
1595
|
-
return _loadPlannerResources.apply(this, arguments);
|
|
1596
|
-
}
|
|
1597
|
-
return loadPlannerResources;
|
|
1598
|
-
}()
|
|
1599
|
-
/**
|
|
1600
|
-
* Boundary between IO and pure planning. Once this returns, all later availability/slot calls
|
|
1601
|
-
* operate on the ResourcePlanner snapshot and do not issue resource requests themselves.
|
|
1602
|
-
*/
|
|
1603
|
-
)
|
|
1604
|
-
}, {
|
|
1605
|
-
key: "loadPlannerContext",
|
|
1606
|
-
value: (function () {
|
|
1607
|
-
var _loadPlannerContext = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1608
|
-
var params,
|
|
1609
|
-
products,
|
|
1610
|
-
plannerResources,
|
|
1611
|
-
context,
|
|
1612
|
-
snapshot,
|
|
1613
|
-
_args17 = arguments;
|
|
1614
|
-
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1615
|
-
while (1) switch (_context17.prev = _context17.next) {
|
|
1616
|
-
case 0:
|
|
1617
|
-
params = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
|
|
1618
|
-
_context17.next = 3;
|
|
1619
|
-
return this.loadPlannerProducts(params);
|
|
1620
|
-
case 3:
|
|
1621
|
-
products = _context17.sent;
|
|
1622
|
-
_context17.next = 6;
|
|
1623
|
-
return this.loadPlannerResources(params, products);
|
|
1624
|
-
case 6:
|
|
1625
|
-
plannerResources = _context17.sent;
|
|
1626
|
-
context = _objectSpread(_objectSpread({}, params.context || {}), {}, {
|
|
1627
|
-
products: products,
|
|
1628
|
-
resources: plannerResources.resources,
|
|
1629
|
-
externalEvents: plannerResources.externalEvents
|
|
1630
|
-
});
|
|
1631
|
-
snapshot = this.getPlanner().setContext(context);
|
|
1632
|
-
this.getPlanner().setSelectionPatch({
|
|
1633
|
-
mode: params.mode,
|
|
1634
|
-
productIds: params.productIds || [],
|
|
1635
|
-
date: params.date,
|
|
1636
|
-
startTime: params.startTime,
|
|
1637
|
-
endTime: params.endTime,
|
|
1638
|
-
resourceIds: params.resourceIds || []
|
|
1639
|
-
});
|
|
1640
|
-
_context17.next = 12;
|
|
1641
|
-
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onPlannerContextLoaded), snapshot);
|
|
1642
|
-
case 12:
|
|
1643
|
-
return _context17.abrupt("return", this.getPlanner().getSnapshot());
|
|
1644
|
-
case 13:
|
|
1645
|
-
case "end":
|
|
1646
|
-
return _context17.stop();
|
|
1647
|
-
}
|
|
1648
|
-
}, _callee17, this);
|
|
1649
|
-
}));
|
|
1650
|
-
function loadPlannerContext() {
|
|
1651
|
-
return _loadPlannerContext.apply(this, arguments);
|
|
1652
|
-
}
|
|
1653
|
-
return loadPlannerContext;
|
|
1654
|
-
}() /** Returns cells, date summaries and a derived grid; cells are continuous ranges, not UI slots. */)
|
|
1655
|
-
}, {
|
|
1656
|
-
key: "queryPlannerAvailability",
|
|
1657
|
-
value: (function () {
|
|
1658
|
-
var _queryPlannerAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1659
|
-
var query,
|
|
1660
|
-
_args18 = arguments;
|
|
1661
|
-
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1662
|
-
while (1) switch (_context18.prev = _context18.next) {
|
|
1663
|
-
case 0:
|
|
1664
|
-
query = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
|
|
1665
|
-
return _context18.abrupt("return", this.getPlanner().queryAvailability(query));
|
|
1666
|
-
case 2:
|
|
1667
|
-
case "end":
|
|
1668
|
-
return _context18.stop();
|
|
1669
|
-
}
|
|
1670
|
-
}, _callee18, this);
|
|
1671
|
-
}));
|
|
1672
|
-
function queryPlannerAvailability() {
|
|
1673
|
-
return _queryPlannerAvailability.apply(this, arguments);
|
|
1674
|
-
}
|
|
1675
|
-
return queryPlannerAvailability;
|
|
1676
|
-
}() /** Turns compatible availability ranges into user-selectable intervals and ready-to-commit assignments. */)
|
|
1677
|
-
}, {
|
|
1678
|
-
key: "resolveAssignableSlots",
|
|
1679
|
-
value: function resolveAssignableSlots() {
|
|
1680
|
-
var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1681
|
-
return this.getPlanner().resolveAssignableSlots(query);
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
/** Stores a UI choice only. It is deliberately side-effect free with respect to tempOrder. */
|
|
1685
|
-
}, {
|
|
1686
|
-
key: "setPlannerSelection",
|
|
1687
|
-
value: function setPlannerSelection(patch) {
|
|
1688
|
-
return this.getPlanner().setSelectionPatch(patch);
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
/**
|
|
1692
|
-
* Legacy-friendly automatic assignment for already fixed intervals. Duration products without a
|
|
1693
|
-
* start time intentionally remain unresolved; callers offering a picker should use slots.
|
|
1694
|
-
*/
|
|
1695
|
-
}, {
|
|
1696
|
-
key: "autoAssignPlanner",
|
|
1697
|
-
value: (function () {
|
|
1698
|
-
var _autoAssignPlanner = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
1699
|
-
var query,
|
|
1700
|
-
result,
|
|
1701
|
-
_args19 = arguments;
|
|
1702
|
-
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
1703
|
-
while (1) switch (_context19.prev = _context19.next) {
|
|
1704
|
-
case 0:
|
|
1705
|
-
query = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
|
|
1706
|
-
result = this.getPlanner().autoAssign(query);
|
|
1707
|
-
if (result.conflicts.length) {
|
|
1708
|
-
console.warn('[UnifiedBookingSales] autoAssignPlanner 存在未分配项', result.conflicts);
|
|
1709
|
-
}
|
|
1710
|
-
return _context19.abrupt("return", this.getPlanner().getSnapshot());
|
|
1711
|
-
case 4:
|
|
1712
|
-
case "end":
|
|
1713
|
-
return _context19.stop();
|
|
1714
|
-
}
|
|
1715
|
-
}, _callee19, this);
|
|
1716
|
-
}));
|
|
1717
|
-
function autoAssignPlanner() {
|
|
1718
|
-
return _autoAssignPlanner.apply(this, arguments);
|
|
1719
|
-
}
|
|
1720
|
-
return autoAssignPlanner;
|
|
1721
|
-
}() /** Rechecks remote events, capacity and conflicts among the current selection before committing. */)
|
|
1722
|
-
}, {
|
|
1723
|
-
key: "validatePlannerSelection",
|
|
1724
|
-
value: function validatePlannerSelection() {
|
|
1725
|
-
return this.getPlanner().validateSelection();
|
|
1726
|
-
}
|
|
1727
|
-
|
|
1728
|
-
/** Read-only snapshot for UI diagnostics and progressive flow steps. */
|
|
1729
|
-
}, {
|
|
1730
|
-
key: "getPlannerSnapshot",
|
|
1731
|
-
value: function getPlannerSnapshot() {
|
|
1732
|
-
return this.getPlanner().getSnapshot();
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
/**
|
|
1736
|
-
* Validates then writes assignments to tempOrder. Real order submission is opt-in so UI callers
|
|
1737
|
-
* can safely preview the cart; pass submitAfterCommit only after an explicit confirmation.
|
|
1738
|
-
*/
|
|
1739
|
-
}, {
|
|
1740
|
-
key: "commitPlannerSelection",
|
|
1741
|
-
value: (function () {
|
|
1742
|
-
var _commitPlannerSelection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
1743
|
-
var params,
|
|
1744
|
-
snapshot,
|
|
1745
|
-
assignments,
|
|
1746
|
-
validation,
|
|
1747
|
-
productsById,
|
|
1748
|
-
assignmentGroups,
|
|
1749
|
-
_iterator3,
|
|
1750
|
-
_step3,
|
|
1751
|
-
groupAssignments,
|
|
1752
|
-
product,
|
|
1753
|
-
sourceProduct,
|
|
1754
|
-
productInput,
|
|
1755
|
-
submitResult,
|
|
1756
|
-
result,
|
|
1757
|
-
_args20 = arguments;
|
|
1758
|
-
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
1759
|
-
while (1) switch (_context20.prev = _context20.next) {
|
|
1760
|
-
case 0:
|
|
1761
|
-
params = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
|
|
1762
|
-
if (params.selection) {
|
|
1763
|
-
this.setPlannerSelection(params.selection);
|
|
1764
|
-
}
|
|
1765
|
-
if (params.assignments) {
|
|
1766
|
-
this.setPlannerSelection({
|
|
1767
|
-
assignments: params.assignments
|
|
1768
|
-
});
|
|
1769
|
-
}
|
|
1770
|
-
snapshot = this.getPlannerSnapshot();
|
|
1771
|
-
assignments = snapshot.selection.assignments || [];
|
|
1772
|
-
if (!(assignments.length === 0)) {
|
|
1773
|
-
_context20.next = 7;
|
|
1774
|
-
break;
|
|
1775
|
-
}
|
|
1776
|
-
return _context20.abrupt("return", {
|
|
1777
|
-
tempOrder: this.getTempOrder(),
|
|
1778
|
-
assignments: assignments,
|
|
1779
|
-
validation: {
|
|
1780
|
-
ok: false,
|
|
1781
|
-
conflicts: [{
|
|
1782
|
-
type: 'missing_assignment',
|
|
1783
|
-
message: '没有可提交的 planner assignment,请先执行 autoAssignPlanner 或传入 assignments'
|
|
1784
|
-
}]
|
|
1785
|
-
}
|
|
1786
|
-
});
|
|
1787
|
-
case 7:
|
|
1788
|
-
validation = this.validatePlannerSelection();
|
|
1789
|
-
if (validation.ok) {
|
|
1790
|
-
_context20.next = 10;
|
|
1791
|
-
break;
|
|
1792
|
-
}
|
|
1793
|
-
return _context20.abrupt("return", {
|
|
1794
|
-
tempOrder: this.getTempOrder(),
|
|
1795
|
-
assignments: assignments,
|
|
1796
|
-
validation: validation
|
|
1797
|
-
});
|
|
1798
|
-
case 10:
|
|
1799
|
-
productsById = new Map(snapshot.context.products.map(function (product) {
|
|
1800
|
-
return [String(product.id), product];
|
|
1801
|
-
}));
|
|
1802
|
-
_context20.next = 13;
|
|
1803
|
-
return this.removeExistingStagedLines('unified_booking_sales');
|
|
1804
|
-
case 13:
|
|
1805
|
-
assignmentGroups = new Map();
|
|
1806
|
-
assignments.forEach(function (assignment) {
|
|
1807
|
-
var key = buildAssignmentGroupKey(assignment);
|
|
1808
|
-
assignmentGroups.set(key, [].concat(_toConsumableArray(assignmentGroups.get(key) || []), [assignment]));
|
|
1809
|
-
});
|
|
1810
|
-
_iterator3 = _createForOfIteratorHelper(assignmentGroups.values());
|
|
1811
|
-
_context20.prev = 16;
|
|
1812
|
-
_iterator3.s();
|
|
1813
|
-
case 18:
|
|
1814
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
1815
|
-
_context20.next = 31;
|
|
1816
|
-
break;
|
|
1817
|
-
}
|
|
1818
|
-
groupAssignments = _step3.value;
|
|
1819
|
-
product = productsById.get(String(groupAssignments[0].productId));
|
|
1820
|
-
if (product) {
|
|
1821
|
-
_context20.next = 23;
|
|
1822
|
-
break;
|
|
1823
|
-
}
|
|
1824
|
-
return _context20.abrupt("continue", 29);
|
|
1825
|
-
case 23:
|
|
1826
|
-
sourceProduct = product.raw || {
|
|
1827
|
-
id: product.id,
|
|
1828
|
-
title: product.title,
|
|
1829
|
-
price: product.price
|
|
1830
|
-
};
|
|
1831
|
-
productInput = this.buildUnifiedOrderProduct(sourceProduct, 'unified_booking_sales', product);
|
|
1832
|
-
if (productInput) {
|
|
1833
|
-
_context20.next = 27;
|
|
1834
|
-
break;
|
|
1835
|
-
}
|
|
1836
|
-
return _context20.abrupt("continue", 29);
|
|
1837
|
-
case 27:
|
|
1838
|
-
_context20.next = 29;
|
|
1839
|
-
return this.addProductToOrder(productInput, buildBookingFromAssignments({
|
|
1840
|
-
assignments: groupAssignments,
|
|
1841
|
-
product: product
|
|
1842
|
-
}));
|
|
1843
|
-
case 29:
|
|
1844
|
-
_context20.next = 18;
|
|
1845
|
-
break;
|
|
1846
|
-
case 31:
|
|
1847
|
-
_context20.next = 36;
|
|
1848
|
-
break;
|
|
1849
|
-
case 33:
|
|
1850
|
-
_context20.prev = 33;
|
|
1851
|
-
_context20.t0 = _context20["catch"](16);
|
|
1852
|
-
_iterator3.e(_context20.t0);
|
|
1853
|
-
case 36:
|
|
1854
|
-
_context20.prev = 36;
|
|
1855
|
-
_iterator3.f();
|
|
1856
|
-
return _context20.finish(36);
|
|
1857
|
-
case 39:
|
|
1858
|
-
if (!params.submitAfterCommit) {
|
|
1859
|
-
_context20.next = 43;
|
|
1860
|
-
break;
|
|
1861
|
-
}
|
|
1862
|
-
_context20.next = 42;
|
|
1863
|
-
return this.submitSalesOrder();
|
|
1864
|
-
case 42:
|
|
1865
|
-
submitResult = _context20.sent;
|
|
1866
|
-
case 43:
|
|
1867
|
-
result = {
|
|
1868
|
-
tempOrder: this.getTempOrder(),
|
|
1869
|
-
assignments: assignments,
|
|
1870
|
-
validation: validation,
|
|
1871
|
-
submitResult: submitResult
|
|
1872
|
-
};
|
|
1873
|
-
_context20.next = 46;
|
|
1874
|
-
return this.core.effects.emit("".concat(this.name, ":").concat(UnifiedBookingSalesHooks.onPlannerCommitted), result);
|
|
1875
|
-
case 46:
|
|
1876
|
-
return _context20.abrupt("return", result);
|
|
1877
|
-
case 47:
|
|
1878
|
-
case "end":
|
|
1879
|
-
return _context20.stop();
|
|
1880
|
-
}
|
|
1881
|
-
}, _callee20, this, [[16, 33, 36, 39]]);
|
|
1882
|
-
}));
|
|
1883
|
-
function commitPlannerSelection() {
|
|
1884
|
-
return _commitPlannerSelection.apply(this, arguments);
|
|
1885
|
-
}
|
|
1886
|
-
return commitPlannerSelection;
|
|
1887
|
-
}())
|
|
1888
|
-
}]);
|
|
1889
|
-
return UnifiedBookingSalesImpl;
|
|
1890
|
-
}(BookingTicket);
|
|
1891
|
-
export var UnifiedBookingSales = UnifiedBookingSalesImpl;
|