@pisell/pisellos 2.2.181 → 2.2.182

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.
Files changed (175) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +9 -0
  2. package/dist/modules/BookingContext/index.d.ts +37 -0
  3. package/dist/modules/BookingContext/index.js +436 -0
  4. package/dist/modules/BookingContext/types.d.ts +102 -0
  5. package/dist/modules/BookingContext/types.js +51 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  7. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  9. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  11. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
  12. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  13. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  15. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  16. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  17. package/dist/modules/BookingContext/utils/index.js +11 -0
  18. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  19. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  20. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  21. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  23. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  25. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  26. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  27. package/dist/modules/BookingContext/utils/resources.js +486 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  29. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  31. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  32. package/dist/modules/Customer/index.d.ts +6 -0
  33. package/dist/modules/Customer/index.js +129 -83
  34. package/dist/modules/Customer/types.d.ts +2 -0
  35. package/dist/modules/Discount/index.js +4 -3
  36. package/dist/modules/Discount/types.d.ts +1 -0
  37. package/dist/modules/Order/index.d.ts +101 -10
  38. package/dist/modules/Order/index.js +1444 -490
  39. package/dist/modules/Order/types.d.ts +201 -18
  40. package/dist/modules/Order/types.js +31 -0
  41. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  42. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  43. package/dist/modules/Order/utils.d.ts +83 -1
  44. package/dist/modules/Order/utils.js +405 -61
  45. package/dist/modules/Product/index.d.ts +1 -1
  46. package/dist/modules/Quotation/index.d.ts +0 -1
  47. package/dist/modules/Quotation/index.js +23 -21
  48. package/dist/modules/Rules/index.d.ts +4 -0
  49. package/dist/modules/Rules/index.js +43 -39
  50. package/dist/modules/Rules/types.d.ts +1 -0
  51. package/dist/modules/SalesSummary/index.js +4 -2
  52. package/dist/modules/SalesSummary/utils.js +21 -7
  53. package/dist/modules/Schedule/index.js +6 -2
  54. package/dist/modules/index.d.ts +1 -0
  55. package/dist/modules/index.js +2 -1
  56. package/dist/server/index.js +87 -29
  57. package/dist/server/modules/order/index.d.ts +23 -0
  58. package/dist/server/modules/order/index.js +123 -46
  59. package/dist/server/modules/order/utils/filterOrders.js +20 -6
  60. package/dist/server/modules/products/index.d.ts +1 -1
  61. package/dist/server/modules/products/index.js +130 -113
  62. package/dist/server/modules/schedule/index.js +13 -6
  63. package/dist/solution/BaseSales/index.d.ts +89 -7
  64. package/dist/solution/BaseSales/index.js +1489 -366
  65. package/dist/solution/BaseSales/types.d.ts +67 -1
  66. package/dist/solution/BaseSales/types.js +3 -1
  67. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
  68. package/dist/solution/BaseSales/utils/cartPromotion.js +1258 -0
  69. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  70. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  71. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +68 -16
  72. package/dist/solution/BaseSales/utils.js +46 -8
  73. package/dist/solution/BookingByStep/index.d.ts +1 -1
  74. package/dist/solution/BookingTicket/index.d.ts +152 -2
  75. package/dist/solution/BookingTicket/index.js +848 -184
  76. package/dist/solution/BookingTicket/types.d.ts +2 -0
  77. package/dist/solution/BookingTicket/types.js +3 -0
  78. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  79. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  80. package/dist/solution/BookingTicket/utils/cartView.js +4 -2
  81. package/dist/solution/ScanOrder/index.d.ts +9 -3
  82. package/dist/solution/ScanOrder/index.js +231 -128
  83. package/dist/solution/ScanOrder/utils.js +46 -8
  84. package/dist/solution/VenueBooking/index.d.ts +5 -2
  85. package/dist/solution/VenueBooking/index.js +103 -55
  86. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  87. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  88. package/lib/model/strategy/adapter/promotion/index.js +49 -0
  89. package/lib/modules/BookingContext/index.d.ts +37 -0
  90. package/lib/modules/BookingContext/index.js +297 -0
  91. package/lib/modules/BookingContext/types.d.ts +102 -0
  92. package/lib/modules/BookingContext/types.js +34 -0
  93. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  94. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +271 -0
  95. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  96. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
  97. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  98. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
  99. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  100. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  101. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  102. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  103. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  104. package/lib/modules/BookingContext/utils/index.js +43 -0
  105. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  106. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  107. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  108. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  109. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  110. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  111. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  112. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  113. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  114. package/lib/modules/BookingContext/utils/resources.js +377 -0
  115. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  116. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  117. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  118. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  119. package/lib/modules/Customer/index.d.ts +6 -0
  120. package/lib/modules/Customer/index.js +26 -11
  121. package/lib/modules/Customer/types.d.ts +2 -0
  122. package/lib/modules/Discount/index.js +5 -1
  123. package/lib/modules/Discount/types.d.ts +1 -0
  124. package/lib/modules/Order/index.d.ts +101 -10
  125. package/lib/modules/Order/index.js +751 -114
  126. package/lib/modules/Order/types.d.ts +201 -18
  127. package/lib/modules/Order/types.js +1 -0
  128. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  129. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  130. package/lib/modules/Order/utils.d.ts +83 -1
  131. package/lib/modules/Order/utils.js +340 -22
  132. package/lib/modules/Product/index.d.ts +1 -1
  133. package/lib/modules/Quotation/index.d.ts +0 -1
  134. package/lib/modules/Quotation/index.js +18 -15
  135. package/lib/modules/Rules/index.d.ts +4 -0
  136. package/lib/modules/Rules/index.js +26 -27
  137. package/lib/modules/Rules/types.d.ts +1 -0
  138. package/lib/modules/SalesSummary/index.js +4 -2
  139. package/lib/modules/SalesSummary/utils.js +21 -7
  140. package/lib/modules/Schedule/index.js +3 -1
  141. package/lib/modules/index.d.ts +1 -0
  142. package/lib/modules/index.js +3 -1
  143. package/lib/server/index.js +41 -4
  144. package/lib/server/modules/order/index.d.ts +23 -0
  145. package/lib/server/modules/order/index.js +46 -14
  146. package/lib/server/modules/order/utils/filterOrders.js +12 -4
  147. package/lib/server/modules/products/index.d.ts +1 -1
  148. package/lib/server/modules/products/index.js +30 -20
  149. package/lib/server/modules/schedule/index.js +2 -1
  150. package/lib/solution/BaseSales/index.d.ts +89 -7
  151. package/lib/solution/BaseSales/index.js +742 -23
  152. package/lib/solution/BaseSales/types.d.ts +67 -1
  153. package/lib/solution/BaseSales/types.js +3 -1
  154. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
  155. package/lib/solution/BaseSales/utils/cartPromotion.js +836 -0
  156. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  157. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  158. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +71 -12
  159. package/lib/solution/BaseSales/utils.js +46 -6
  160. package/lib/solution/BookingByStep/index.d.ts +1 -1
  161. package/lib/solution/BookingTicket/index.d.ts +152 -2
  162. package/lib/solution/BookingTicket/index.js +389 -9
  163. package/lib/solution/BookingTicket/types.d.ts +2 -0
  164. package/lib/solution/BookingTicket/types.js +6 -0
  165. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  166. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  167. package/lib/solution/BookingTicket/utils/cartView.js +4 -2
  168. package/lib/solution/ScanOrder/index.d.ts +9 -3
  169. package/lib/solution/ScanOrder/index.js +147 -66
  170. package/lib/solution/ScanOrder/utils.js +46 -6
  171. package/lib/solution/VenueBooking/index.d.ts +5 -2
  172. package/lib/solution/VenueBooking/index.js +50 -14
  173. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  174. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  175. package/package.json +1 -1
@@ -2,15 +2,15 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
2
2
  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."); }
3
3
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
4
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
- 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); }
6
5
  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; } } }; }
7
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
7
  function _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; }
9
8
  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; }
10
- 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; }
11
- 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; }
12
9
  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); } }
13
10
  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); }); }; }
11
+ 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; }
12
+ 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; }
13
+ 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); }
14
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
15
  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); } }
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -94,15 +94,50 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
94
94
  moduleName: 'scanOrder'
95
95
  };
96
96
  }
97
+ }, {
98
+ key: "safeStringify",
99
+ value: function safeStringify(value) {
100
+ try {
101
+ return JSON.stringify(value);
102
+ } catch (_unused) {
103
+ return undefined;
104
+ }
105
+ }
106
+ }, {
107
+ key: "pickErrorMessage",
108
+ value: function pickErrorMessage(error) {
109
+ var _error$data, _error$response, _error$error;
110
+ var candidates = [error.message, (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message, (_error$response = error.response) === null || _error$response === void 0 || (_error$response = _error$response.data) === null || _error$response === void 0 ? void 0 : _error$response.message, (_error$error = error.error) === null || _error$error === void 0 ? void 0 : _error$error.message];
111
+ for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
112
+ var candidate = _candidates[_i];
113
+ if (typeof candidate === 'string' && candidate.trim()) return candidate;
114
+ }
115
+ return undefined;
116
+ }
97
117
  }, {
98
118
  key: "serializeError",
99
119
  value: function serializeError(error) {
100
120
  if (error instanceof Error) {
101
- return JSON.stringify({
121
+ return {
102
122
  name: error.name,
103
123
  message: error.message,
104
124
  stack: error.stack
105
- });
125
+ };
126
+ }
127
+ if (error && _typeof(error) === 'object') {
128
+ var raw = error;
129
+ var message = this.pickErrorMessage(raw) || this.safeStringify(raw) || String(error);
130
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, typeof raw.name === 'string' ? {
131
+ name: raw.name
132
+ } : {}), {}, {
133
+ message: message
134
+ }, 'code' in raw ? {
135
+ code: raw.code
136
+ } : {}), 'status' in raw ? {
137
+ status: raw.status
138
+ } : {}), this.safeStringify(raw) ? {
139
+ raw: this.safeStringify(raw)
140
+ } : {});
106
141
  }
107
142
  return {
108
143
  message: String(error)
@@ -192,6 +227,16 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
192
227
  })
193
228
  });
194
229
  }
230
+ }, {
231
+ key: "assertProductListLoaded",
232
+ value: function assertProductListLoaded(method, result) {
233
+ var payload = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
234
+ if (Array.isArray(result)) return result;
235
+ var error = result instanceof Error ? result : new Error('商品列表接口返回异常');
236
+ this.logMethodError(method, error, payload);
237
+ error.__scanOrderLogged = true;
238
+ throw error;
239
+ }
195
240
  }, {
196
241
  key: "addLog",
197
242
  value: function () {
@@ -228,8 +273,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
228
273
  value: function resolveCustomerIdFromLoginPayload(payload) {
229
274
  var _payload$user, _payload$user2, _payload$user3, _payload$user4, _payload$account, _payload$account2, _payload$account3, _payload$_origin;
230
275
  var candidates = [payload === null || payload === void 0 ? void 0 : payload.customerId, payload === null || payload === void 0 ? void 0 : payload.customer_id, payload === null || payload === void 0 ? void 0 : payload.id, payload === null || payload === void 0 || (_payload$user = payload.user) === null || _payload$user === void 0 ? void 0 : _payload$user.customerId, payload === null || payload === void 0 || (_payload$user2 = payload.user) === null || _payload$user2 === void 0 ? void 0 : _payload$user2.customer_id, payload === null || payload === void 0 || (_payload$user3 = payload.user) === null || _payload$user3 === void 0 ? void 0 : _payload$user3.id, payload === null || payload === void 0 || (_payload$user4 = payload.user) === null || _payload$user4 === void 0 || (_payload$user4 = _payload$user4._origin) === null || _payload$user4 === void 0 ? void 0 : _payload$user4.customer_id, payload === null || payload === void 0 || (_payload$account = payload.account) === null || _payload$account === void 0 ? void 0 : _payload$account.customerId, payload === null || payload === void 0 || (_payload$account2 = payload.account) === null || _payload$account2 === void 0 ? void 0 : _payload$account2.customer_id, payload === null || payload === void 0 || (_payload$account3 = payload.account) === null || _payload$account3 === void 0 ? void 0 : _payload$account3.id, payload === null || payload === void 0 || (_payload$_origin = payload._origin) === null || _payload$_origin === void 0 ? void 0 : _payload$_origin.customer_id];
231
- for (var _i = 0, _candidates = candidates; _i < _candidates.length; _i++) {
232
- var candidate = _candidates[_i];
276
+ for (var _i2 = 0, _candidates2 = candidates; _i2 < _candidates2.length; _i2++) {
277
+ var candidate = _candidates2[_i2];
233
278
  var customerId = this.normalizeCustomerId(candidate);
234
279
  if (customerId) return customerId;
235
280
  }
@@ -399,18 +444,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
399
444
  key: "destroyRegisteredChildModules",
400
445
  value: function () {
401
446
  var _destroyRegisteredChildModules = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
402
- var modules, _i2, _modules, mod;
447
+ var modules, _i3, _modules, mod;
403
448
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
404
449
  while (1) switch (_context6.prev = _context6.next) {
405
450
  case 0:
406
451
  modules = [this.store.schedule, this.store.salesSummary, this.store.order, this.store.products, this.store.scanOrderLogger];
407
- _i2 = 0, _modules = modules;
452
+ _i3 = 0, _modules = modules;
408
453
  case 2:
409
- if (!(_i2 < _modules.length)) {
454
+ if (!(_i3 < _modules.length)) {
410
455
  _context6.next = 10;
411
456
  break;
412
457
  }
413
- mod = _modules[_i2];
458
+ mod = _modules[_i3];
414
459
  if (!(mod && typeof mod.destroy === 'function')) {
415
460
  _context6.next = 7;
416
461
  break;
@@ -418,7 +463,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
418
463
  _context6.next = 7;
419
464
  return Promise.resolve(mod.destroy());
420
465
  case 7:
421
- _i2++;
466
+ _i3++;
422
467
  _context6.next = 2;
423
468
  break;
424
469
  case 10:
@@ -492,13 +537,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
492
537
  var _this4$store$order, _this4$otherParams, _this4$otherParams2, _this4$otherParams3, _this4$otherParams4;
493
538
  _this4.store[step] = targetModule;
494
539
  var initialState = step === 'salesSummary' ? {
495
- // TODO(Order types): ScanOrder runtime should read OrderState.summary instead of tempOrder.summary.
496
540
  summary: ((_this4$store$order = _this4.store.order) === null || _this4$store$order === void 0 || (_this4$store$order = _this4$store$order.getTempOrder()) === null || _this4$store$order === void 0 ? void 0 : _this4$store$order.summary) || createEmptySummary()
497
541
  } : {};
498
542
  var loggerProvider = ((_this4$otherParams = _this4.otherParams) === null || _this4$otherParams === void 0 ? void 0 : _this4$otherParams.scanOrderLoggerProvider) || 'feishu';
499
543
  var loggerConfig = ((_this4$otherParams2 = _this4.otherParams) === null || _this4$otherParams2 === void 0 ? void 0 : _this4$otherParams2.scanOrderLoggerConfig) || {
500
544
  feishu: {
501
- webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed'
545
+ webhook: 'https://open.feishu.cn/open-apis/bot/v2/hook/216b3fe6-af98-424e-8706-f0471241a7ed',
546
+ errorHook: 'https://open.feishu.cn/open-apis/bot/v2/hook/015b7c2a-dd3c-4c30-9898-ef0f5253111f'
502
547
  }
503
548
  };
504
549
  _this4.core.registerModule(targetModule, {
@@ -1248,7 +1293,50 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1248
1293
  return _onCustomerLogin.apply(this, arguments);
1249
1294
  }
1250
1295
  return onCustomerLogin;
1251
- }() // ScanOrder 提交 payload enhancer:
1296
+ }()
1297
+ }, {
1298
+ key: "findReservationRuleResource",
1299
+ value: function findReservationRuleResource(formId) {
1300
+ if (formId == null) return undefined;
1301
+ var numericFormId = Number(formId);
1302
+ if (!Number.isFinite(numericFormId) || numericFormId <= 0) return undefined;
1303
+ var _iterator4 = _createForOfIteratorHelper(this.enabledReservationRuleProducts),
1304
+ _step4;
1305
+ try {
1306
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1307
+ var _product$product_reso;
1308
+ var product = _step4.value;
1309
+ var resources = product === null || product === void 0 || (_product$product_reso = product.product_resource) === null || _product$product_reso === void 0 ? void 0 : _product$product_reso.resources;
1310
+ if (!Array.isArray(resources)) continue;
1311
+ var matched = resources.find(function (resource) {
1312
+ return Number(resource === null || resource === void 0 ? void 0 : resource.id) === numericFormId;
1313
+ });
1314
+ if (matched) return matched;
1315
+ }
1316
+ } catch (err) {
1317
+ _iterator4.e(err);
1318
+ } finally {
1319
+ _iterator4.f();
1320
+ }
1321
+ return undefined;
1322
+ }
1323
+ }, {
1324
+ key: "buildScanOrderResourceMetadata",
1325
+ value: function buildScanOrderResourceMetadata(params) {
1326
+ var _ruleResource$title;
1327
+ var resourceState = params.resourceState,
1328
+ resourceName = params.resourceName;
1329
+ var ruleResource = this.findReservationRuleResource(resourceState.tableFormId);
1330
+ var combined = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.combined_resource;
1331
+ var isCombined = !!(combined && combined.status === 1 && Array.isArray(combined.resource_ids));
1332
+ return {
1333
+ form_name: (_ruleResource$title = ruleResource === null || ruleResource === void 0 ? void 0 : ruleResource.title) !== null && _ruleResource$title !== void 0 ? _ruleResource$title : '',
1334
+ resource_name: resourceName,
1335
+ combined_resource: isCombined ? combined : null
1336
+ };
1337
+ }
1338
+
1339
+ // ScanOrder 提交 payload enhancer:
1252
1340
  // - 给所有 booking 注入 appointment_status: 'started'(扫码点餐语义)
1253
1341
  // - 给所有 booking 的 metadata 注入 resource_select_type(来自预约规则商品的 resource.type)
1254
1342
  // - 给第一条 booking 补 resources 与 product_uid(仅当存在 resource / rule product)
@@ -1261,7 +1349,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1261
1349
  var resourceState = this.store.resource;
1262
1350
  var resourceSelectType = resourceState === null || resourceState === void 0 ? void 0 : resourceState.resourceSelectType;
1263
1351
 
1264
- // single 预约独占整张桌台,capacity form_record.capacity;其他情况(multiple / capacity / undefined)占 1 个容量位
1352
+ // collect_pax 时的资源占用兜底:single 独占整张桌台,其余模式占 1 个容量位。
1265
1353
  var resolveResourceCapacity = function resolveResourceCapacity() {
1266
1354
  if (resourceSelectType === 'single') {
1267
1355
  var _resourceState$table_;
@@ -1273,11 +1361,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1273
1361
  return 1;
1274
1362
  };
1275
1363
  return function (payload, _ref3) {
1276
- var _resource_id, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _tempOrder$metadata, _pickFirstCustomCapac;
1364
+ var _resource_id, _tempOrder$metadata, _ref4, _pickOriginal, _resourceState$table_2, _resourceState$relati, _pickFirstCustomCapac;
1277
1365
  var bookingUuid = _ref3.bookingUuid,
1278
1366
  tempOrder = _ref3.tempOrder;
1279
- // TODO(Order types): ScanOrder resource runtime should come from ScanOrder store only.
1280
1367
  var resourceId = (_resource_id = tempOrder.resource_id) !== null && _resource_id !== void 0 ? _resource_id : resourceState === null || resourceState === void 0 ? void 0 : resourceState.relationId;
1368
+ var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1369
+ var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1370
+ var resourceCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1281
1371
  var pickOriginal = function pickOriginal(value) {
1282
1372
  if (value && _typeof(value) === 'object' && !Array.isArray(value)) {
1283
1373
  var original = value.original;
@@ -1293,22 +1383,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1293
1383
  main_field: mainField,
1294
1384
  form_id: resourceState.tableFormId,
1295
1385
  relation_id: (_resourceState$relati = resourceState.relationId) !== null && _resourceState$relati !== void 0 ? _resourceState$relati : resourceId,
1296
- capacity: resolveResourceCapacity(),
1297
- metadata: {}
1386
+ capacity: resourceCapacityValue,
1387
+ metadata: _this5.buildScanOrderResourceMetadata({
1388
+ resourceState: resourceState,
1389
+ resourceName: mainField
1390
+ })
1298
1391
  } : undefined;
1299
1392
  var ruleProductUid = ruleProduct ? createUuidV4() : undefined;
1300
- // 默认 resolveResourceCapacity(single 为桌台容量,其余多为 1);有 collect_pax value 优先用人数
1301
- var rawCollectPax = (_tempOrder$metadata = tempOrder.metadata) === null || _tempOrder$metadata === void 0 ? void 0 : _tempOrder$metadata.collect_pax;
1302
- var hasCollectPaxForCapacity = rawCollectPax !== null && rawCollectPax !== undefined && rawCollectPax !== '';
1303
- var bookingCapacityValue = hasCollectPaxForCapacity ? normalizeSubmitCollectPaxValue(rawCollectPax) : resolveResourceCapacity();
1393
+ // collect_pax booking/resource capacity number 都代表本次 pax;否则使用资源占用兜底值。
1394
+ var bookingCapacityValue = resourceCapacityValue;
1304
1395
  var bookingCapacityDimensionId = (_pickFirstCustomCapac = pickFirstCustomCapacityDimensionId(_this5.enabledReservationRuleProducts)) !== null && _pickFirstCustomCapac !== void 0 ? _pickFirstCustomCapac : 0;
1305
1396
  var nextBookings = (payload.bookings || []).map(function (booking, idx) {
1306
- var _booking$metadata$hol, _booking$metadata;
1307
1397
  return _objectSpread(_objectSpread(_objectSpread({}, booking), {}, {
1398
+ number: bookingCapacityValue,
1308
1399
  appointment_status: 'started',
1309
- metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), {}, {
1310
- holder_id: (_booking$metadata$hol = (_booking$metadata = booking.metadata) === null || _booking$metadata === void 0 ? void 0 : _booking$metadata.holder_id) !== null && _booking$metadata$hol !== void 0 ? _booking$metadata$hol : null
1311
- }, resourceSelectType ? {
1400
+ metadata: _objectSpread(_objectSpread(_objectSpread({}, booking.metadata || {}), resourceSelectType ? {
1312
1401
  resource_select_type: resourceSelectType
1313
1402
  } : {}), resourceSelectType ? {
1314
1403
  capacity: [{
@@ -1324,7 +1413,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1324
1413
  } : {});
1325
1414
  });
1326
1415
  var nextProducts = _toConsumableArray(payload.products || []);
1327
- // 编辑已有订单时,后端会通过 order_id 判断更新;原单已含 booking 规则行,勿再追加虚拟规则商品
1416
+ // 加餐(已有 order_id)走 scanOrderMore,原单已含 booking 规则行,勿再追加虚拟规则商品
1328
1417
  if (ruleProduct && ruleProductUid && !tempOrder.order_id) {
1329
1418
  var _ruleProduct$price, _ref5, _ruleProduct$original, _ruleProduct$is_gst;
1330
1419
  var sellingPrice = String((_ruleProduct$price = ruleProduct.price) !== null && _ruleProduct$price !== void 0 ? _ruleProduct$price : '0.00');
@@ -1470,14 +1559,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1470
1559
  return addProductToOrder;
1471
1560
  }()
1472
1561
  }, {
1473
- key: "updateProductInOrder",
1562
+ key: "updateOrderProduct",
1474
1563
  value: function () {
1475
- var _updateProductInOrder = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1564
+ var _updateOrderProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(params) {
1476
1565
  var products;
1477
1566
  return _regeneratorRuntime().wrap(function _callee19$(_context19) {
1478
1567
  while (1) switch (_context19.prev = _context19.next) {
1479
1568
  case 0:
1480
- this.logMethodStart('updateProductInOrder', {
1569
+ this.logMethodStart('updateOrderProduct', {
1481
1570
  product_id: params.product_id,
1482
1571
  product_variant_id: params.product_variant_id
1483
1572
  });
@@ -1489,7 +1578,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1489
1578
  throw new Error('order 模块未初始化');
1490
1579
  case 4:
1491
1580
  _context19.next = 6;
1492
- return this.store.order.updateProductInOrder(params);
1581
+ return this.store.order.updateOrderProduct(params);
1493
1582
  case 6:
1494
1583
  products = _context19.sent;
1495
1584
  _context19.next = 9;
@@ -1498,14 +1587,14 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1498
1587
  _context19.next = 11;
1499
1588
  return this.refreshCartValidationPassed();
1500
1589
  case 11:
1501
- this.logMethodSuccess('updateProductInOrder', {
1590
+ this.logMethodSuccess('updateOrderProduct', {
1502
1591
  productCount: products.length
1503
1592
  });
1504
1593
  return _context19.abrupt("return", products);
1505
1594
  case 15:
1506
1595
  _context19.prev = 15;
1507
1596
  _context19.t0 = _context19["catch"](1);
1508
- this.logMethodError('updateProductInOrder', _context19.t0);
1597
+ this.logMethodError('updateOrderProduct', _context19.t0);
1509
1598
  throw _context19.t0;
1510
1599
  case 19:
1511
1600
  case "end":
@@ -1513,10 +1602,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1513
1602
  }
1514
1603
  }, _callee19, this, [[1, 15]]);
1515
1604
  }));
1516
- function updateProductInOrder(_x11) {
1517
- return _updateProductInOrder.apply(this, arguments);
1605
+ function updateOrderProduct(_x11) {
1606
+ return _updateOrderProduct.apply(this, arguments);
1518
1607
  }
1519
- return updateProductInOrder;
1608
+ return updateOrderProduct;
1520
1609
  }()
1521
1610
  /**
1522
1611
  * 设置单行商品备注(与整单 `updateTempOrderNote` 区分)。
@@ -1542,16 +1631,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1542
1631
  note: String(note || '')
1543
1632
  }
1544
1633
  };
1545
- if (identity.identity_key !== undefined) {
1546
- // TODO(Order types): ScanOrder identity callers should pass unique_identification_number.
1547
- params.identity_key = identity.identity_key;
1548
- }
1634
+ if (identity.identity_key !== undefined) params.identity_key = identity.identity_key;
1549
1635
  if (identity.product_option_item !== undefined) {
1550
1636
  params.product_option_item = identity.product_option_item;
1551
1637
  }
1552
1638
  if (identity.product_bundle !== undefined) params.product_bundle = identity.product_bundle;
1553
1639
  _context20.next = 8;
1554
- return this.updateProductInOrder(params);
1640
+ return this.updateOrderProduct(params);
1555
1641
  case 8:
1556
1642
  products = _context20.sent;
1557
1643
  this.logMethodSuccess('setOrderProductLineNote', {
@@ -1784,17 +1870,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1784
1870
  if (visited.has(value)) return;
1785
1871
  visited.add(value);
1786
1872
  if (Array.isArray(value)) {
1787
- var _iterator4 = _createForOfIteratorHelper(value),
1788
- _step4;
1873
+ var _iterator5 = _createForOfIteratorHelper(value),
1874
+ _step5;
1789
1875
  try {
1790
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1791
- var item = _step4.value;
1876
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1877
+ var item = _step5.value;
1792
1878
  collectFromValue(item);
1793
1879
  }
1794
1880
  } catch (err) {
1795
- _iterator4.e(err);
1881
+ _iterator5.e(err);
1796
1882
  } finally {
1797
- _iterator4.f();
1883
+ _iterator5.f();
1798
1884
  }
1799
1885
  return;
1800
1886
  }
@@ -1810,8 +1896,8 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1810
1896
  sourceMap.set(key, node);
1811
1897
  }
1812
1898
  }
1813
- for (var _i3 = 0, _Object$values = Object.values(node); _i3 < _Object$values.length; _i3++) {
1814
- var childValue = _Object$values[_i3];
1899
+ for (var _i4 = 0, _Object$values = Object.values(node); _i4 < _Object$values.length; _i4++) {
1900
+ var childValue = _Object$values[_i4];
1815
1901
  if (childValue && _typeof(childValue) === 'object') {
1816
1902
  collectFromValue(childValue);
1817
1903
  }
@@ -1955,7 +2041,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
1955
2041
  key: "applyPrefillByItemRule",
1956
2042
  value: function () {
1957
2043
  var _applyPrefillByItemRule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
1958
- var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator5, _step5, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
2044
+ var strategyConfigs, businessData, prefillItems, productSourceMap, tempOrder, hasChanges, _iterator6, _step6, _prefillItem$product_, _origin2, _origin3, _origin4, prefillItem, productId, productVariantId, targetQuantity, sourceItem, productIndex, _sourceItem$price, sellingPrice, targetProduct, existedQuantity, delta, nextProduct, hasQuantityChanged, hasOriginChanged;
1959
2045
  return _regeneratorRuntime().wrap(function _callee29$(_context29) {
1960
2046
  while (1) switch (_context29.prev = _context29.next) {
1961
2047
  case 0:
@@ -2000,15 +2086,15 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2000
2086
  productSourceMap = _context29.sent;
2001
2087
  tempOrder = this.ensureTempOrder();
2002
2088
  hasChanges = false;
2003
- _iterator5 = _createForOfIteratorHelper(prefillItems);
2089
+ _iterator6 = _createForOfIteratorHelper(prefillItems);
2004
2090
  _context29.prev = 20;
2005
- _iterator5.s();
2091
+ _iterator6.s();
2006
2092
  case 22:
2007
- if ((_step5 = _iterator5.n()).done) {
2093
+ if ((_step6 = _iterator6.n()).done) {
2008
2094
  _context29.next = 47;
2009
2095
  break;
2010
2096
  }
2011
- prefillItem = _step5.value;
2097
+ prefillItem = _step6.value;
2012
2098
  productId = Number(prefillItem.product_id);
2013
2099
  productVariantId = Number((_prefillItem$product_ = prefillItem.product_variant_id) !== null && _prefillItem$product_ !== void 0 ? _prefillItem$product_ : 0);
2014
2100
  targetQuantity = toNonNegativeInt(prefillItem.quantity);
@@ -2062,7 +2148,6 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2062
2148
  item_rule_prefill: true,
2063
2149
  item_rule_id: prefillItem.ruleId
2064
2150
  }),
2065
- // TODO(Order types): migrate ScanOrder prefill origin runtime into tempOrder._extend.
2066
2151
  _origin: sourceItem ? _objectSpread(_objectSpread({}, targetProduct._origin || {}), sourceItem) : targetProduct._origin
2067
2152
  });
2068
2153
  hasQuantityChanged = delta > 0;
@@ -2080,10 +2165,10 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2080
2165
  case 49:
2081
2166
  _context29.prev = 49;
2082
2167
  _context29.t0 = _context29["catch"](20);
2083
- _iterator5.e(_context29.t0);
2168
+ _iterator6.e(_context29.t0);
2084
2169
  case 52:
2085
2170
  _context29.prev = 52;
2086
- _iterator5.f();
2171
+ _iterator6.f();
2087
2172
  return _context29.finish(52);
2088
2173
  case 55:
2089
2174
  if (!hasChanges) {
@@ -2471,7 +2556,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2471
2556
  key: "checkResourceAvailable",
2472
2557
  value: function () {
2473
2558
  var _checkResourceAvailable = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(resourceId, hasOrderId) {
2474
- var _this$otherParams10, _this$otherParams10$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams11, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams12, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
2559
+ var _this$otherParams$bus, _this$otherParams10, _this$otherParams$cha, _this$otherParams11, _this$otherParams12, _this$otherParams12$g, _occupyDetail$form_re, _occupyDetail$form_re2, _this$otherParams13, _this$store$order5, _this$store$order7, _this$store$order7$ge, _this$otherParams14, businessCode, channel, openDataTarget, openData, dineInConfig, closedBehaviorValue, closedMessage, basicUnavailableMessage, pauseMessage, makeShopClosed, operatingHourIds, outsideOperatingHours, scheduleList, now, tempOrder, reservationLinkIds, pendingRequestEntryPax, pendingRequestPaxMin, pendingRequestPaxMax, reservationProductList, scheduleDate, scheduleDatetime, loaded, occupancyMinutes, paxBounds, error, occupyDetail, resourceSelectType, resourceState, availabilityInfo, _this$store$order6, _res$data, res, entryPaxNumber, lastOrderInfo, historicalItems;
2475
2560
  return _regeneratorRuntime().wrap(function _callee36$(_context36) {
2476
2561
  while (1) switch (_context36.prev = _context36.next) {
2477
2562
  case 0:
@@ -2479,25 +2564,28 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2479
2564
  resourceId: resourceId
2480
2565
  });
2481
2566
  _context36.prev = 1;
2482
- _context36.next = 4;
2483
- return (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 || (_this$otherParams10$g = _this$otherParams10.getOpenData) === null || _this$otherParams10$g === void 0 ? void 0 : _this$otherParams10$g.call(_this$otherParams10, {
2567
+ businessCode = String((_this$otherParams$bus = (_this$otherParams10 = this.otherParams) === null || _this$otherParams10 === void 0 ? void 0 : _this$otherParams10.businessCode) !== null && _this$otherParams$bus !== void 0 ? _this$otherParams$bus : '').trim();
2568
+ channel = String((_this$otherParams$cha = (_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.channel) !== null && _this$otherParams$cha !== void 0 ? _this$otherParams$cha : '').trim();
2569
+ openDataTarget = businessCode && channel ? "".concat(businessCode, "+").concat(channel) : 'dine_in+scan_to_order';
2570
+ _context36.next = 7;
2571
+ return (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 || (_this$otherParams12$g = _this$otherParams12.getOpenData) === null || _this$otherParams12$g === void 0 ? void 0 : _this$otherParams12$g.call(_this$otherParams12, {
2484
2572
  scope: 'board',
2485
- target: 'dine_in+scan_to_order',
2573
+ target: openDataTarget,
2486
2574
  section_code: ['basic', 'fulfillment', 'reservation', 'sale', 'menu', 'availability', 'workflow']
2487
2575
  });
2488
- case 4:
2576
+ case 7:
2489
2577
  openData = _context36.sent;
2490
2578
  if (!((openData === null || openData === void 0 ? void 0 : openData.status) === false)) {
2491
- _context36.next = 7;
2579
+ _context36.next = 10;
2492
2580
  break;
2493
2581
  }
2494
2582
  throw new Error((openData === null || openData === void 0 ? void 0 : openData.message) || '获取店铺配置失败');
2495
- case 7:
2583
+ case 10:
2496
2584
  dineInConfig = (openData === null || openData === void 0 ? void 0 : openData.data) || {};
2497
2585
  this.otherParams.dineInConfig = dineInConfig;
2498
- _context36.next = 11;
2586
+ _context36.next = 14;
2499
2587
  return this.syncItemRuleConfigsFromDineInConfig(dineInConfig);
2500
- case 11:
2588
+ case 14:
2501
2589
  closedBehaviorValue = dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_behavior'];
2502
2590
  closedMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.closed_message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.message']) || (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.closed_message']);
2503
2591
  basicUnavailableMessage = (dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.unavailable_message']) || closedMessage;
@@ -2514,21 +2602,21 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2514
2602
  };
2515
2603
  }; // 1. 基础开关 basic.enable 关闭
2516
2604
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['basic.enable']) === false)) {
2517
- _context36.next = 18;
2605
+ _context36.next = 21;
2518
2606
  break;
2519
2607
  }
2520
2608
  return _context36.abrupt("return", makeShopClosed(basicUnavailableMessage));
2521
- case 18:
2609
+ case 21:
2522
2610
  if (!toBoolean(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.paused'])) {
2523
- _context36.next = 21;
2611
+ _context36.next = 24;
2524
2612
  break;
2525
2613
  }
2526
2614
  if (!((dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.pause_behavior']) === 'hide_all')) {
2527
- _context36.next = 21;
2615
+ _context36.next = 24;
2528
2616
  break;
2529
2617
  }
2530
2618
  return _context36.abrupt("return", makeShopClosed(pauseMessage));
2531
- case 21:
2619
+ case 24:
2532
2620
  // 3. 营业时间 operating_hours 闸门
2533
2621
  operatingHourIds = Array.isArray(dineInConfig === null || dineInConfig === void 0 ? void 0 : dineInConfig['availability.operating_hours']) ? dineInConfig['availability.operating_hours'].map(function (id) {
2534
2622
  return Number(id);
@@ -2544,27 +2632,27 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2544
2632
  }
2545
2633
  }
2546
2634
  if (!(outsideOperatingHours && closedBehaviorValue !== 'show_menu_disabled')) {
2547
- _context36.next = 26;
2635
+ _context36.next = 29;
2548
2636
  break;
2549
2637
  }
2550
2638
  return _context36.abrupt("return", makeShopClosed(closedMessage, closedBehaviorValue));
2551
- case 26:
2639
+ case 29:
2552
2640
  // Step1: 先加载预约规则商品,拿到 enabledReservationRuleProducts 与容量附加信息
2553
2641
  // (resourceSelectType 需要基于这些商品 + 占用接口的 form_id 计算,故必须前置)
2554
2642
  tempOrder = this.ensureTempOrder();
2555
2643
  reservationLinkIds = collectLinkProductIdsFromReservationRules(dineInConfig['fulfillment.enabled_resource_rules']);
2556
2644
  if (!(reservationLinkIds.length === 0)) {
2557
- _context36.next = 32;
2645
+ _context36.next = 35;
2558
2646
  break;
2559
2647
  }
2560
2648
  this.enabledReservationRuleProducts = [];
2561
- _context36.next = 43;
2649
+ _context36.next = 46;
2562
2650
  break;
2563
- case 32:
2651
+ case 35:
2564
2652
  tempOrder.metadata = _objectSpread({}, tempOrder.metadata || {});
2565
2653
  delete tempOrder.metadata.table_occupancy_duration;
2566
2654
  reservationProductList = new ProductList("".concat(this.name, "_reservationEnabledRules"), this.defaultVersion);
2567
- _context36.next = 37;
2655
+ _context36.next = 40;
2568
2656
  return reservationProductList.initialize(this.core, {
2569
2657
  store: {
2570
2658
  list: [],
@@ -2576,17 +2664,17 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2576
2664
  cacheId: this.cacheId
2577
2665
  })
2578
2666
  });
2579
- case 37:
2667
+ case 40:
2580
2668
  scheduleDate = dayjs().format('YYYY-MM-DD');
2581
2669
  scheduleDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
2582
- _context36.next = 41;
2670
+ _context36.next = 44;
2583
2671
  return reservationProductList.loadProducts({
2584
2672
  product_ids: reservationLinkIds,
2585
2673
  schedule_date: scheduleDate,
2586
2674
  schedule_datetime: scheduleDatetime,
2587
2675
  cacheId: this.cacheId
2588
2676
  });
2589
- case 41:
2677
+ case 44:
2590
2678
  loaded = _context36.sent;
2591
2679
  if (Array.isArray(loaded)) {
2592
2680
  this.enabledReservationRuleProducts = loaded;
@@ -2602,19 +2690,19 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2602
2690
  }
2603
2691
  } else {
2604
2692
  this.enabledReservationRuleProducts = [];
2605
- void this.addScanOrderLog({
2606
- level: 'error',
2607
- title: '[ScanOrder] enabled_reservation_rules product query failed',
2608
- payload: {
2609
- linkIds: reservationLinkIds,
2610
- error: this.serializeError(loaded)
2611
- }
2693
+ error = loaded instanceof Error ? loaded : new Error('预约规则商品列表接口返回异常');
2694
+ this.logMethodError('loadReservationRuleProducts', error, {
2695
+ resourceId: resourceId,
2696
+ reservationLinkIds: reservationLinkIds,
2697
+ scheduleDate: scheduleDate,
2698
+ scheduleDatetime: scheduleDatetime,
2699
+ cacheId: this.cacheId
2612
2700
  });
2613
2701
  }
2614
- case 43:
2615
- _context36.next = 45;
2702
+ case 46:
2703
+ _context36.next = 48;
2616
2704
  return this.fetchResourceOccupyDetailByResourceId(resourceId);
2617
- case 45:
2705
+ case 48:
2618
2706
  occupyDetail = _context36.sent;
2619
2707
  // Step3: 结合预约规则商品的 product_resource.resources 与占用接口返回的 form_id,
2620
2708
  // 计算当前桌台的 resourceSelectType(single/multiple/capacity)
@@ -2647,31 +2735,31 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2647
2735
  requestPaxMin: this.store.resource.requestPaxMin
2648
2736
  } : {}), this.store.resource.requestPaxMax !== undefined ? {
2649
2737
  requestPaxMax: this.store.resource.requestPaxMax
2650
- } : {}); // TODO(Order types): keep ScanOrder resource runtime out of OrderTempOrder root.
2651
- tempOrder.relation_id = resourceId || ((_this$otherParams11 = this.otherParams) === null || _this$otherParams11 === void 0 ? void 0 : _this$otherParams11.relation_id);
2738
+ } : {});
2739
+ tempOrder.relation_id = resourceId || ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13.relation_id);
2652
2740
  tempOrder.table_form_id = resourceState.tableFormId;
2653
2741
  tempOrder.resource_id = resourceId;
2654
2742
  (_this$store$order5 = this.store.order) === null || _this$store$order5 === void 0 || _this$store$order5.persistTempOrder();
2655
2743
 
2656
2744
  // 空闲状态下自动准备本地临时订单,供后续“购物车式”商品操作使用
2657
2745
  if (!(availabilityInfo.mode === 'idle')) {
2658
- _context36.next = 60;
2746
+ _context36.next = 63;
2659
2747
  break;
2660
2748
  }
2661
- _context36.next = 60;
2749
+ _context36.next = 63;
2662
2750
  return this.addNewOrder();
2663
- case 60:
2664
- // 如果是加单模式,tempOrder 里需要记录 lastOrderId;提交仍走统一 sales checkout 接口
2751
+ case 63:
2752
+ // 如果是加单模式,tempOrder 需要记录 lastOrderId,提交的时候走加单接口
2665
2753
  if (availabilityInfo.mode === 'additional_order' || availabilityInfo.mode === 'additional_order_with_code') {
2666
2754
  tempOrder.order_id = resourceState.lastOrderId;
2667
2755
  }
2668
2756
  if (!tempOrder.order_id) {
2669
- _context36.next = 69;
2757
+ _context36.next = 72;
2670
2758
  break;
2671
2759
  }
2672
- _context36.next = 64;
2760
+ _context36.next = 67;
2673
2761
  return (_this$store$order6 = this.store.order) === null || _this$store$order6 === void 0 ? void 0 : _this$store$order6.getOrderInfoByRemote(tempOrder.order_id);
2674
- case 64:
2762
+ case 67:
2675
2763
  res = _context36.sent;
2676
2764
  // 找到下单的时候输入的 entryPaxNumber
2677
2765
  entryPaxNumber = res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.bookings) === null || _res$data === void 0 || (_res$data = _res$data.find(function (p) {
@@ -2679,12 +2767,12 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2679
2767
  return (_p$metadata = p.metadata) === null || _p$metadata === void 0 ? void 0 : _p$metadata.collect_pax;
2680
2768
  })) === null || _res$data === void 0 || (_res$data = _res$data.metadata) === null || _res$data === void 0 ? void 0 : _res$data.collect_pax;
2681
2769
  if (!entryPaxNumber) {
2682
- _context36.next = 69;
2770
+ _context36.next = 72;
2683
2771
  break;
2684
2772
  }
2685
- _context36.next = 69;
2773
+ _context36.next = 72;
2686
2774
  return this.setEntryPaxNumber(entryPaxNumber);
2687
- case 69:
2775
+ case 72:
2688
2776
  lastOrderInfo = (_this$store$order7 = this.store.order) === null || _this$store$order7 === void 0 || (_this$store$order7$ge = _this$store$order7.getLastOrderInfo) === null || _this$store$order7$ge === void 0 ? void 0 : _this$store$order7$ge.call(_this$store$order7);
2689
2777
  historicalItems = hasOrderId && Array.isArray(lastOrderInfo === null || lastOrderInfo === void 0 ? void 0 : lastOrderInfo.products) ? lastOrderInfo.products.reduce(function (acc, p) {
2690
2778
  if (typeof (p === null || p === void 0 ? void 0 : p.product_id) !== 'number') return acc;
@@ -2696,13 +2784,13 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2696
2784
  } : {}));
2697
2785
  return acc;
2698
2786
  }, []) : []; // pax 由 setEntryPaxNumber 负责写入 itemRuleRuntimeConfig.pax
2699
- _context36.next = 73;
2787
+ _context36.next = 76;
2700
2788
  return this.setItemRuleRuntimeConfig({
2701
- serviceType: (_this$otherParams12 = this.otherParams) === null || _this$otherParams12 === void 0 ? void 0 : _this$otherParams12.businessCode,
2789
+ serviceType: (_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.businessCode,
2702
2790
  submissionIndex: hasOrderId ? 1 : 0,
2703
2791
  historicalItems: historicalItems
2704
2792
  });
2705
- case 73:
2793
+ case 76:
2706
2794
  // operating_hours 超出营业时段 + closed_behavior=show_menu_disabled:
2707
2795
  // 允许浏览商品但 UI 层需拦截“下一步”,这里覆盖最终 mode 并回传错误提示
2708
2796
  if (outsideOperatingHours && closedBehaviorValue === 'show_menu_disabled') {
@@ -2724,18 +2812,18 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2724
2812
  isFull: resourceState.isFull
2725
2813
  });
2726
2814
  return _context36.abrupt("return", availabilityInfo);
2727
- case 78:
2728
- _context36.prev = 78;
2815
+ case 81:
2816
+ _context36.prev = 81;
2729
2817
  _context36.t0 = _context36["catch"](1);
2730
2818
  this.logMethodError('checkResourceAvailable', _context36.t0.message, {
2731
2819
  resourceId: resourceId
2732
2820
  });
2733
2821
  throw _context36.t0;
2734
- case 82:
2822
+ case 85:
2735
2823
  case "end":
2736
2824
  return _context36.stop();
2737
2825
  }
2738
- }, _callee36, this, [[1, 78]]);
2826
+ }, _callee36, this, [[1, 81]]);
2739
2827
  }));
2740
2828
  function checkResourceAvailable(_x18, _x19) {
2741
2829
  return _checkResourceAvailable.apply(this, arguments);
@@ -2778,41 +2866,56 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2778
2866
  key: "getProductList",
2779
2867
  value: function () {
2780
2868
  var _getProductList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
2781
- var _this$otherParams13;
2782
- var menu_list_ids, _this$store$products, res, formattedRes;
2869
+ var _this$otherParams15;
2870
+ var menu_list_ids, res, productList, formattedRes;
2783
2871
  return _regeneratorRuntime().wrap(function _callee38$(_context38) {
2784
2872
  while (1) switch (_context38.prev = _context38.next) {
2785
2873
  case 0:
2786
2874
  this.logMethodStart('getProductList');
2787
2875
  // 可以直接通过配置里的 menu 读取
2788
- menu_list_ids = ((_this$otherParams13 = this.otherParams) === null || _this$otherParams13 === void 0 || (_this$otherParams13 = _this$otherParams13.dineInConfig) === null || _this$otherParams13 === void 0 ? void 0 : _this$otherParams13['menu.associated_menus'].map(function (n) {
2876
+ menu_list_ids = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 || (_this$otherParams15 = _this$otherParams15.dineInConfig) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15['menu.associated_menus'].map(function (n) {
2789
2877
  return Number(n.value);
2790
2878
  })) || [];
2791
2879
  _context38.prev = 2;
2792
- _context38.next = 5;
2793
- return (_this$store$products = this.store.products) === null || _this$store$products === void 0 ? void 0 : _this$store$products.loadProducts({
2880
+ if (this.store.products) {
2881
+ _context38.next = 5;
2882
+ break;
2883
+ }
2884
+ throw new Error('products 模块未初始化');
2885
+ case 5:
2886
+ _context38.next = 7;
2887
+ return this.store.products.loadProducts({
2794
2888
  menu_list_ids: menu_list_ids,
2795
2889
  cacheId: this.cacheId,
2796
2890
  schedule_date: dayjs().format('YYYY-MM-DD'),
2797
2891
  schedule_datetime: dayjs().format('YYYY-MM-DD HH:mm:ss')
2798
2892
  });
2799
- case 5:
2893
+ case 7:
2800
2894
  res = _context38.sent;
2801
- formattedRes = attachItemRuleLimitsToTopLevelProducts(res, this.store.itemRuleQuantityLimits || []);
2895
+ productList = this.assertProductListLoaded('getProductList', res, {
2896
+ menu_list_ids: menu_list_ids,
2897
+ cacheId: this.cacheId
2898
+ });
2899
+ formattedRes = attachItemRuleLimitsToTopLevelProducts(productList, this.store.itemRuleQuantityLimits || []);
2802
2900
  this.logMethodSuccess('getProductList', {
2803
2901
  menuCount: menu_list_ids.length
2804
2902
  });
2805
2903
  return _context38.abrupt("return", formattedRes);
2806
- case 11:
2807
- _context38.prev = 11;
2904
+ case 14:
2905
+ _context38.prev = 14;
2808
2906
  _context38.t0 = _context38["catch"](2);
2809
- this.logMethodError('getProductList', _context38.t0.message);
2907
+ if (!(_context38.t0 !== null && _context38.t0 !== void 0 && _context38.t0.__scanOrderLogged)) {
2908
+ this.logMethodError('getProductList', _context38.t0, {
2909
+ menu_list_ids: menu_list_ids,
2910
+ cacheId: this.cacheId
2911
+ });
2912
+ }
2810
2913
  throw _context38.t0;
2811
- case 15:
2914
+ case 18:
2812
2915
  case "end":
2813
2916
  return _context38.stop();
2814
2917
  }
2815
- }, _callee38, this, [[2, 11]]);
2918
+ }, _callee38, this, [[2, 14]]);
2816
2919
  }));
2817
2920
  function getProductList() {
2818
2921
  return _getProductList.apply(this, arguments);
@@ -2879,7 +2982,7 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2879
2982
  var raw = this.window.localStorage.getItem(key) || '{}';
2880
2983
  var parsed = JSON.parse(raw);
2881
2984
  return parsed && _typeof(parsed) === 'object' ? parsed : {};
2882
- } catch (_unused) {
2985
+ } catch (_unused2) {
2883
2986
  return {};
2884
2987
  }
2885
2988
  }
@@ -2988,9 +3091,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
2988
3091
  }, {
2989
3092
  key: "getFulfillmentModes",
2990
3093
  value: function getFulfillmentModes() {
2991
- var _this$otherParams14;
3094
+ var _this$otherParams16;
2992
3095
  this.logMethodStart('getFulfillmentModes');
2993
- var dineInConfig = ((_this$otherParams14 = this.otherParams) === null || _this$otherParams14 === void 0 ? void 0 : _this$otherParams14.dineInConfig) || {};
3096
+ var dineInConfig = ((_this$otherParams16 = this.otherParams) === null || _this$otherParams16 === void 0 ? void 0 : _this$otherParams16.dineInConfig) || {};
2994
3097
  var result = {
2995
3098
  enablePickup: Boolean(dineInConfig['fulfillment.enable_pickup']),
2996
3099
  enableTableService: Boolean(dineInConfig['fulfillment.enable_table_service'])
@@ -3004,9 +3107,9 @@ export var ScanOrderImpl = /*#__PURE__*/function (_BaseModule) {
3004
3107
  }, {
3005
3108
  key: "checkManualPickupRef",
3006
3109
  value: function checkManualPickupRef() {
3007
- var _this$otherParams15;
3110
+ var _this$otherParams17;
3008
3111
  this.logMethodStart('checkManualPickupRef');
3009
- var dineInConfig = ((_this$otherParams15 = this.otherParams) === null || _this$otherParams15 === void 0 ? void 0 : _this$otherParams15.dineInConfig) || {};
3112
+ var dineInConfig = ((_this$otherParams17 = this.otherParams) === null || _this$otherParams17 === void 0 ? void 0 : _this$otherParams17.dineInConfig) || {};
3010
3113
  var refMode = dineInConfig['fulfillment.fulfillment_ref_mode'];
3011
3114
  var manualInputType = dineInConfig['fulfillment.manual_input_type'];
3012
3115
  var enabled = refMode === 'manual_input';