@pisell/pisellos 2.2.292 → 2.2.293

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 (173) hide show
  1. package/dist/core/index.d.ts +7 -0
  2. package/dist/core/index.js +108 -65
  3. package/dist/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  4. package/dist/model/strategy/adapter/itemRule/adapter.js +135 -35
  5. package/dist/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  6. package/dist/model/strategy/adapter/itemRule/evaluator.js +25 -1
  7. package/dist/model/strategy/adapter/itemRule/type.d.ts +44 -0
  8. package/dist/model/strategy/adapter/itemRule/type.js +19 -1
  9. package/dist/modules/BookingContext/index.d.ts +3 -0
  10. package/dist/modules/BookingContext/index.js +42 -13
  11. package/dist/modules/BookingContext/types.d.ts +4 -4
  12. package/dist/modules/BookingContext/types.js +3 -3
  13. package/dist/modules/OpenData/types.d.ts +1 -0
  14. package/dist/modules/Order/index.d.ts +19 -4
  15. package/dist/modules/Order/index.js +885 -485
  16. package/dist/modules/Order/salesNotes.d.ts +31 -0
  17. package/dist/modules/Order/salesNotes.js +492 -0
  18. package/dist/modules/Order/types.d.ts +93 -5
  19. package/dist/modules/Order/types.js +5 -0
  20. package/dist/modules/Order/utils.d.ts +12 -0
  21. package/dist/modules/Order/utils.js +96 -31
  22. package/dist/modules/Product/types.d.ts +2 -0
  23. package/dist/modules/ProductList/clientDataVariants.d.ts +50 -0
  24. package/dist/modules/ProductList/clientDataVariants.js +216 -0
  25. package/dist/modules/ProductList/index.d.ts +18 -3
  26. package/dist/modules/ProductList/index.js +220 -38
  27. package/dist/modules/ProductList/types.d.ts +10 -0
  28. package/dist/modules/Quotation/index.d.ts +22 -0
  29. package/dist/modules/Quotation/index.js +293 -28
  30. package/dist/modules/ResourcePlanner/index.d.ts +0 -22
  31. package/dist/modules/ResourcePlanner/index.js +1 -180
  32. package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
  33. package/dist/modules/ResourcePlanner/localClock.js +183 -0
  34. package/dist/modules/ResourcePlanner/planner.d.ts +5 -14
  35. package/dist/modules/ResourcePlanner/planner.js +2111 -958
  36. package/dist/modules/ResourcePlanner/types.d.ts +359 -187
  37. package/dist/modules/ResourcePlanner/types.js +33 -1
  38. package/dist/plugins/request.d.ts +1 -0
  39. package/dist/server/index.d.ts +17 -2
  40. package/dist/server/index.js +1134 -932
  41. package/dist/server/modules/floor-plan/index.d.ts +4 -0
  42. package/dist/server/modules/floor-plan/index.js +240 -98
  43. package/dist/server/modules/menu/index.js +48 -23
  44. package/dist/server/modules/order/index.d.ts +17 -7
  45. package/dist/server/modules/order/index.js +419 -207
  46. package/dist/server/modules/products/index.d.ts +10 -4
  47. package/dist/server/modules/products/index.js +177 -84
  48. package/dist/server/modules/resource/index.js +21 -13
  49. package/dist/server/utils/product.d.ts +1 -1
  50. package/dist/server/utils/product.js +186 -22
  51. package/dist/server/utils/small-ticket.d.ts +9 -1
  52. package/dist/server/utils/small-ticket.js +136 -41
  53. package/dist/solution/BaseSales/index.d.ts +26 -3
  54. package/dist/solution/BaseSales/index.js +1384 -905
  55. package/dist/solution/BaseSales/types.d.ts +2 -0
  56. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  57. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +10 -3
  58. package/dist/solution/BaseSales/utils.js +6 -3
  59. package/dist/solution/BookingByStep/index.d.ts +4 -4
  60. package/dist/solution/BookingTicket/index.d.ts +1 -1
  61. package/dist/solution/BookingTicket/index.js +4 -2
  62. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  63. package/dist/solution/BookingTicket/utils/addProductDecision.js +6 -3
  64. package/dist/solution/BookingTicket/utils/orderCustomer.js +3 -2
  65. package/dist/solution/RegisterAndLogin/config.d.ts +9 -3
  66. package/dist/solution/RegisterAndLogin/config.js +95 -40
  67. package/dist/solution/RegisterAndLogin/index.js +4 -1
  68. package/dist/solution/ScanOrder/index.d.ts +1 -0
  69. package/dist/solution/ScanOrder/index.js +31 -27
  70. package/dist/solution/ScanOrder/types.d.ts +2 -0
  71. package/dist/solution/ScanOrder/utils.d.ts +1 -0
  72. package/dist/solution/ScanOrder/utils.js +8 -3
  73. package/dist/solution/UnifiedBookingSales/index.d.ts +128 -74
  74. package/dist/solution/UnifiedBookingSales/index.js +3877 -963
  75. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  76. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +430 -0
  77. package/dist/solution/UnifiedBookingSales/types.d.ts +161 -77
  78. package/dist/solution/UnifiedBookingSales/types.js +4 -9
  79. package/dist/solution/VenueBooking/index.d.ts +3 -0
  80. package/dist/solution/VenueBooking/index.js +549 -497
  81. package/dist/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  82. package/dist/solution/VenueBooking/utils/dateSummary.js +3 -1
  83. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  84. package/dist/solution/VenueBooking/utils/slotMerge.js +3 -1
  85. package/dist/utils/platform.d.ts +8 -0
  86. package/dist/utils/platform.js +15 -0
  87. package/lib/core/index.d.ts +7 -0
  88. package/lib/core/index.js +20 -2
  89. package/lib/model/strategy/adapter/itemRule/adapter.d.ts +4 -1
  90. package/lib/model/strategy/adapter/itemRule/adapter.js +73 -4
  91. package/lib/model/strategy/adapter/itemRule/evaluator.d.ts +8 -1
  92. package/lib/model/strategy/adapter/itemRule/evaluator.js +23 -1
  93. package/lib/model/strategy/adapter/itemRule/type.d.ts +44 -0
  94. package/lib/model/strategy/adapter/itemRule/type.js +19 -1
  95. package/lib/modules/BookingContext/index.d.ts +3 -0
  96. package/lib/modules/BookingContext/index.js +35 -8
  97. package/lib/modules/BookingContext/types.d.ts +4 -4
  98. package/lib/modules/BookingContext/types.js +3 -3
  99. package/lib/modules/OpenData/types.d.ts +1 -0
  100. package/lib/modules/Order/index.d.ts +19 -4
  101. package/lib/modules/Order/index.js +325 -28
  102. package/lib/modules/Order/salesNotes.d.ts +31 -0
  103. package/lib/modules/Order/salesNotes.js +382 -0
  104. package/lib/modules/Order/types.d.ts +93 -5
  105. package/lib/modules/Order/types.js +4 -0
  106. package/lib/modules/Order/utils.d.ts +12 -0
  107. package/lib/modules/Order/utils.js +85 -16
  108. package/lib/modules/Product/types.d.ts +2 -0
  109. package/lib/modules/ProductList/clientDataVariants.d.ts +50 -0
  110. package/lib/modules/ProductList/clientDataVariants.js +204 -0
  111. package/lib/modules/ProductList/index.d.ts +18 -3
  112. package/lib/modules/ProductList/index.js +137 -8
  113. package/lib/modules/ProductList/types.d.ts +10 -0
  114. package/lib/modules/Quotation/index.d.ts +22 -0
  115. package/lib/modules/Quotation/index.js +158 -11
  116. package/lib/modules/ResourcePlanner/index.d.ts +0 -22
  117. package/lib/modules/ResourcePlanner/index.js +9 -129
  118. package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
  119. package/lib/modules/ResourcePlanner/localClock.js +205 -0
  120. package/lib/modules/ResourcePlanner/planner.d.ts +5 -14
  121. package/lib/modules/ResourcePlanner/planner.js +1807 -783
  122. package/lib/modules/ResourcePlanner/types.d.ts +359 -187
  123. package/lib/modules/ResourcePlanner/types.js +13 -1
  124. package/lib/plugins/request.d.ts +1 -0
  125. package/lib/server/index.d.ts +17 -2
  126. package/lib/server/index.js +149 -21
  127. package/lib/server/modules/floor-plan/index.d.ts +4 -0
  128. package/lib/server/modules/floor-plan/index.js +60 -7
  129. package/lib/server/modules/menu/index.js +26 -4
  130. package/lib/server/modules/order/index.d.ts +17 -7
  131. package/lib/server/modules/order/index.js +194 -57
  132. package/lib/server/modules/products/index.d.ts +10 -4
  133. package/lib/server/modules/products/index.js +93 -23
  134. package/lib/server/modules/resource/index.js +12 -2
  135. package/lib/server/utils/product.d.ts +1 -1
  136. package/lib/server/utils/product.js +163 -3
  137. package/lib/server/utils/small-ticket.d.ts +9 -1
  138. package/lib/server/utils/small-ticket.js +126 -33
  139. package/lib/solution/BaseSales/index.d.ts +26 -3
  140. package/lib/solution/BaseSales/index.js +396 -70
  141. package/lib/solution/BaseSales/types.d.ts +2 -0
  142. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +3 -0
  143. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +9 -2
  144. package/lib/solution/BaseSales/utils.js +3 -0
  145. package/lib/solution/BookingByStep/index.d.ts +4 -4
  146. package/lib/solution/BookingTicket/index.d.ts +1 -1
  147. package/lib/solution/BookingTicket/index.js +2 -1
  148. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +2 -1
  149. package/lib/solution/BookingTicket/utils/addProductDecision.js +5 -2
  150. package/lib/solution/BookingTicket/utils/orderCustomer.js +2 -1
  151. package/lib/solution/RegisterAndLogin/config.d.ts +9 -3
  152. package/lib/solution/RegisterAndLogin/config.js +49 -8
  153. package/lib/solution/RegisterAndLogin/index.js +4 -1
  154. package/lib/solution/ScanOrder/index.d.ts +1 -0
  155. package/lib/solution/ScanOrder/index.js +5 -1
  156. package/lib/solution/ScanOrder/types.d.ts +2 -0
  157. package/lib/solution/ScanOrder/utils.d.ts +1 -0
  158. package/lib/solution/ScanOrder/utils.js +4 -0
  159. package/lib/solution/UnifiedBookingSales/index.d.ts +128 -74
  160. package/lib/solution/UnifiedBookingSales/index.js +2592 -424
  161. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +49 -0
  162. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +316 -0
  163. package/lib/solution/UnifiedBookingSales/types.d.ts +161 -77
  164. package/lib/solution/UnifiedBookingSales/types.js +4 -6
  165. package/lib/solution/VenueBooking/index.d.ts +3 -0
  166. package/lib/solution/VenueBooking/index.js +33 -9
  167. package/lib/solution/VenueBooking/utils/dateSummary.d.ts +1 -0
  168. package/lib/solution/VenueBooking/utils/dateSummary.js +3 -1
  169. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +2 -0
  170. package/lib/solution/VenueBooking/utils/slotMerge.js +3 -1
  171. package/lib/utils/platform.d.ts +8 -0
  172. package/lib/utils/platform.js +22 -0
  173. package/package.json +1 -1
@@ -1,4 +1,10 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ 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."); }
4
+ 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); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
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; }
2
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
10
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
@@ -20,7 +26,22 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
20
26
  import { BaseModule } from "../BaseModule";
21
27
  import { cloneDeep } from 'lodash-es';
22
28
  import dayjs from 'dayjs';
29
+ import { isProductQueryHandledByOsServer, PRODUCT_QUERY_DATA_VARIANT_RELATIONS, resolveClientDataVariants } from "./clientDataVariants";
30
+ import { isCustomerUserPlatform } from "../../utils/platform";
23
31
  export * from "./types";
32
+ function normalizeQuerySet(values) {
33
+ if (!Array.isArray(values) || values.length === 0) return null;
34
+ var normalized = values.map(function (value) {
35
+ return String(value !== null && value !== void 0 ? value : '').trim();
36
+ }).filter(Boolean);
37
+ return normalized.length ? new Set(normalized) : null;
38
+ }
39
+ function matchesAny(values, querySet) {
40
+ if (!querySet) return true;
41
+ return values.some(function (value) {
42
+ return querySet.has(String(value !== null && value !== void 0 ? value : '').trim());
43
+ });
44
+ }
24
45
  export var ProductList = /*#__PURE__*/function (_BaseModule) {
25
46
  _inherits(ProductList, _BaseModule);
26
47
  var _super = _createSuper(ProductList);
@@ -33,6 +54,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
33
54
  _defineProperty(_assertThisInitialized(_this), "store", void 0);
34
55
  _defineProperty(_assertThisInitialized(_this), "request", void 0);
35
56
  _defineProperty(_assertThisInitialized(_this), "otherParams", {});
57
+ _defineProperty(_assertThisInitialized(_this), "rawProductPriceSources", new Map());
36
58
  return _this;
37
59
  }
38
60
  _createClass(ProductList, [{
@@ -46,6 +68,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
46
68
  this.core = core;
47
69
  this.store = options.store;
48
70
  this.otherParams = options.otherParams || {};
71
+ this.rawProductPriceSources.clear();
49
72
  if (Array.isArray((_options$initialState = options.initialState) === null || _options$initialState === void 0 ? void 0 : _options$initialState.list)) {
50
73
  this.store.list = options.initialState.list.slice().sort(function (a, b) {
51
74
  return Number(b.sort) - Number(a.sort);
@@ -56,7 +79,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
56
79
  this.store.selectProducts = [];
57
80
  }
58
81
  this.request = core.getPlugin('request');
59
- case 5:
82
+ case 6:
60
83
  case "end":
61
84
  return _context.stop();
62
85
  }
@@ -133,6 +156,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
133
156
  value: function () {
134
157
  var _loadProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
135
158
  var _this$otherParams,
159
+ _this$otherParams2,
136
160
  _this2 = this;
137
161
  var _ref,
138
162
  _ref$category_ids,
@@ -162,9 +186,11 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
162
186
  rawApplicationCode,
163
187
  mappedApplicationCode,
164
188
  queryPayload,
189
+ handledByOsServer,
165
190
  originalCallback,
166
191
  subscriptionCallback,
167
192
  productsData,
193
+ resolvedList,
168
194
  sortedList,
169
195
  _args5 = arguments;
170
196
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
@@ -201,11 +227,12 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
201
227
  };
202
228
  rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
203
229
  mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
204
- queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
205
- open_quotation: 1,
230
+ queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, isCustomerUserPlatform((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.platform) ? {} : {
231
+ open_quotation: 1
232
+ }), {}, {
206
233
  open_bundle: 0,
207
234
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
208
- with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
235
+ with: _toConsumableArray(PRODUCT_QUERY_DATA_VARIANT_RELATIONS),
209
236
  status: status,
210
237
  num: 500,
211
238
  skip: 1,
@@ -231,20 +258,44 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
231
258
  extension_type: extension_type,
232
259
  strategy_context: strategy_context
233
260
  });
261
+ handledByOsServer = isProductQueryHandledByOsServer(this.core, this.request);
234
262
  originalCallback = options === null || options === void 0 ? void 0 : options.callback;
235
- subscriptionCallback = originalCallback ? ( /*#__PURE__*/function () {
263
+ subscriptionCallback = typeof originalCallback === 'function' ? ( /*#__PURE__*/function () {
236
264
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(result) {
237
265
  var _result$data;
238
- var products;
266
+ var callbackList, products;
239
267
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
240
268
  while (1) switch (_context4.prev = _context4.next) {
241
269
  case 0:
242
- products = Array.isArray(result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list) ? result.data.list : [];
243
- _context4.next = 3;
244
- return _this2.addProduct(products);
245
- case 3:
270
+ callbackList = result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.list;
271
+ if (Array.isArray(callbackList)) {
272
+ _context4.next = 4;
273
+ break;
274
+ }
246
275
  originalCallback(result);
276
+ return _context4.abrupt("return");
247
277
  case 4:
278
+ if (!handledByOsServer) {
279
+ // Subscription callbacks may contain only changed products. Upsert
280
+ // their raw records without evicting other IDs from the scope.
281
+ _this2.rememberRawProductQueryResult(callbackList);
282
+ }
283
+ products = resolveClientDataVariants({
284
+ core: _this2.core,
285
+ otherParams: _this2.otherParams,
286
+ products: callbackList,
287
+ queryPayload: queryPayload,
288
+ handledByOsServer: handledByOsServer
289
+ });
290
+ _context4.next = 8;
291
+ return _this2.addProduct(products);
292
+ case 8:
293
+ originalCallback(handledByOsServer ? result : _objectSpread(_objectSpread({}, result), {}, {
294
+ data: _objectSpread(_objectSpread({}, result.data), {}, {
295
+ list: products
296
+ })
297
+ }));
298
+ case 9:
248
299
  case "end":
249
300
  return _context4.stop();
250
301
  }
@@ -254,16 +305,26 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
254
305
  return _ref2.apply(this, arguments);
255
306
  };
256
307
  }()) : undefined;
257
- _context5.next = 13;
308
+ _context5.next = 14;
258
309
  return this.request.post("/product/query", queryPayload, {
259
310
  osServer: true,
260
311
  callback: subscriptionCallback,
261
312
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
262
313
  customToast: function customToast() {}
263
314
  });
264
- case 13:
315
+ case 14:
265
316
  productsData = _context5.sent;
266
- sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
317
+ if (!handledByOsServer && Array.isArray(productsData.data.list)) {
318
+ this.replaceRawProductQueryResult(productsData.data.list, product_ids);
319
+ }
320
+ resolvedList = resolveClientDataVariants({
321
+ core: this.core,
322
+ otherParams: this.otherParams,
323
+ products: productsData.data.list || [],
324
+ queryPayload: queryPayload,
325
+ handledByOsServer: handledByOsServer
326
+ });
327
+ sortedList = resolvedList.slice().sort(function (a, b) {
267
328
  return Number(b.sort) - Number(a.sort);
268
329
  }); // if (sortedList.length) {
269
330
  // sortedList.forEach((n: any) => {
@@ -274,7 +335,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
274
335
  // }
275
336
  this.addProduct(sortedList);
276
337
  return _context5.abrupt("return", sortedList);
277
- case 17:
338
+ case 20:
278
339
  case "end":
279
340
  return _context5.stop();
280
341
  }
@@ -317,6 +378,60 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
317
378
  }
318
379
  return loadProductsPrice;
319
380
  }()
381
+ /**
382
+ * Remember raw remote product records before client-side Data Variant
383
+ * evaluation. Quote-only reads can then always start from a clean baseline.
384
+ */
385
+ }, {
386
+ key: "rememberRawProductQueryResult",
387
+ value: function rememberRawProductQueryResult(products) {
388
+ var _this3 = this;
389
+ if (!Array.isArray(products)) return;
390
+ products.forEach(function (product) {
391
+ var _source$id;
392
+ var source = product;
393
+ var id = Number((_source$id = source === null || source === void 0 ? void 0 : source.id) !== null && _source$id !== void 0 ? _source$id : source === null || source === void 0 ? void 0 : source.product_id);
394
+ if (!Number.isFinite(id)) return;
395
+ _this3.rawProductPriceSources.set(id, cloneDeep(product));
396
+ });
397
+ }
398
+ }, {
399
+ key: "replaceRawProductQueryResult",
400
+ value: function replaceRawProductQueryResult(products, requestedIds) {
401
+ var _this4 = this;
402
+ if (Array.isArray(requestedIds) && requestedIds.length > 0) {
403
+ requestedIds.forEach(function (rawId) {
404
+ var id = Number(rawId);
405
+ if (Number.isFinite(id)) _this4.rawProductPriceSources.delete(id);
406
+ });
407
+ } else {
408
+ // A non-ID query represents the latest catalog scope. Clearing before
409
+ // replacing prevents removed products from surviving indefinitely.
410
+ this.rawProductPriceSources.clear();
411
+ }
412
+ this.rememberRawProductQueryResult(products);
413
+ }
414
+
415
+ /**
416
+ * Return isolated raw price sources for the requested products.
417
+ *
418
+ * Missing IDs are intentionally omitted so callers can remotely fetch only
419
+ * the incomplete part of a batch quote.
420
+ */
421
+ }, {
422
+ key: "getRawProductPriceSources",
423
+ value: function getRawProductPriceSources(ids) {
424
+ var _this5 = this;
425
+ var products = new Map();
426
+ if (!Array.isArray(ids)) return products;
427
+ ids.forEach(function (rawId) {
428
+ var id = Number(rawId);
429
+ if (!Number.isFinite(id) || products.has(id)) return;
430
+ var product = _this5.rawProductPriceSources.get(id);
431
+ if (product) products.set(id, cloneDeep(product));
432
+ });
433
+ return products;
434
+ }
320
435
  }, {
321
436
  key: "getProducts",
322
437
  value: function () {
@@ -366,26 +481,93 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
366
481
  return getProduct;
367
482
  }()
368
483
  }, {
369
- key: "getProductByIds",
484
+ key: "queryProducts",
370
485
  value: function () {
371
- var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(ids) {
372
- var products;
486
+ var _queryProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
487
+ var params,
488
+ includeIds,
489
+ excludeIds,
490
+ categoryIds,
491
+ collectionIds,
492
+ extensionTypes,
493
+ statuses,
494
+ channelApplications,
495
+ codeOrBarcode,
496
+ products,
497
+ _args9 = arguments;
373
498
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
374
499
  while (1) switch (_context9.prev = _context9.next) {
375
500
  case 0:
376
- _context9.next = 2;
377
- return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
378
- case 2:
379
- products = this.store.list.filter(function (product) {
380
- return ids.includes(product.id);
501
+ params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
502
+ includeIds = normalizeQuerySet(params.includeIds);
503
+ excludeIds = normalizeQuerySet(params.excludeIds);
504
+ categoryIds = normalizeQuerySet(params.categoryIds);
505
+ collectionIds = normalizeQuerySet(params.collectionIds);
506
+ extensionTypes = normalizeQuerySet(params.extensionTypes);
507
+ statuses = normalizeQuerySet(params.statuses);
508
+ channelApplications = normalizeQuerySet(params.channelApplications);
509
+ codeOrBarcode = typeof params.codeOrBarcode === 'string' ? params.codeOrBarcode.trim() : '';
510
+ products = (this.store.list || []).filter(function (product) {
511
+ var _product$id, _product$extension_ty, _product$status;
512
+ var productId = String((_product$id = product.id) !== null && _product$id !== void 0 ? _product$id : '').trim();
513
+ if (includeIds && !includeIds.has(productId)) return false;
514
+ if (excludeIds && excludeIds.has(productId)) return false;
515
+ if (categoryIds) {
516
+ var productCategoryIds = (product.categories || []).flatMap(function (category) {
517
+ var _category$pivot;
518
+ return [category === null || category === void 0 ? void 0 : category.id, category === null || category === void 0 || (_category$pivot = category.pivot) === null || _category$pivot === void 0 ? void 0 : _category$pivot.product_category_id];
519
+ });
520
+ if (!matchesAny(productCategoryIds, categoryIds)) return false;
521
+ }
522
+ if (collectionIds) {
523
+ var productCollectionIds = (product.collection || []).map(function (collection) {
524
+ return collection === null || collection === void 0 ? void 0 : collection.id;
525
+ });
526
+ if (!matchesAny(productCollectionIds, collectionIds)) return false;
527
+ }
528
+ if (extensionTypes && !extensionTypes.has(String((_product$extension_ty = product.extension_type) !== null && _product$extension_ty !== void 0 ? _product$extension_ty : '').trim())) return false;
529
+ if (statuses && !statuses.has(String((_product$status = product.status) !== null && _product$status !== void 0 ? _product$status : '').trim())) return false;
530
+ if (channelApplications) {
531
+ if (!matchesAny(product.channel_application || [], channelApplications)) return false;
532
+ }
533
+ if (codeOrBarcode) {
534
+ var code = typeof product.code === 'string' ? product.code.trim() : '';
535
+ var barcode = typeof product.barcode === 'string' ? product.barcode.trim() : '';
536
+ if (code !== codeOrBarcode && barcode !== codeOrBarcode) return false;
537
+ }
538
+ return true;
381
539
  });
382
- return _context9.abrupt("return", products);
383
- case 4:
540
+ return _context9.abrupt("return", cloneDeep(products));
541
+ case 11:
384
542
  case "end":
385
543
  return _context9.stop();
386
544
  }
387
545
  }, _callee9, this);
388
546
  }));
547
+ function queryProducts() {
548
+ return _queryProducts.apply(this, arguments);
549
+ }
550
+ return queryProducts;
551
+ }()
552
+ }, {
553
+ key: "getProductByIds",
554
+ value: function () {
555
+ var _getProductByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(ids) {
556
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
557
+ while (1) switch (_context10.prev = _context10.next) {
558
+ case 0:
559
+ _context10.next = 2;
560
+ return this.core.effects.emit("".concat(this.name, ":onGetProductByIds"), this.store.list);
561
+ case 2:
562
+ return _context10.abrupt("return", this.queryProducts({
563
+ includeIds: ids
564
+ }));
565
+ case 3:
566
+ case "end":
567
+ return _context10.stop();
568
+ }
569
+ }, _callee10, this);
570
+ }));
389
571
  function getProductByIds(_x8) {
390
572
  return _getProductByIds.apply(this, arguments);
391
573
  }
@@ -394,23 +576,23 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
394
576
  }, {
395
577
  key: "addProduct",
396
578
  value: function () {
397
- var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(products) {
398
- var _this3 = this;
399
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
400
- while (1) switch (_context10.prev = _context10.next) {
579
+ var _addProduct = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(products) {
580
+ var _this6 = this;
581
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
582
+ while (1) switch (_context11.prev = _context11.next) {
401
583
  case 0:
402
584
  // list 需要根据 id 去重
403
585
  if (!this.store.list) {
404
586
  this.store.list = [];
405
587
  }
406
588
  products.forEach(function (n) {
407
- var index = _this3.store.list.findIndex(function (m) {
589
+ var index = _this6.store.list.findIndex(function (m) {
408
590
  return m.id === n.id;
409
591
  });
410
592
  if (index === -1) {
411
- _this3.store.list.push(n);
593
+ _this6.store.list.push(n);
412
594
  } else {
413
- _this3.store.list[index] = n;
595
+ _this6.store.list[index] = n;
414
596
  }
415
597
  });
416
598
  // 根据 sort 值做降序排序(数字越大越靠前)
@@ -420,9 +602,9 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
420
602
  this.core.effects.emit("".concat(this.name, ":changed"), this.store.list);
421
603
  case 4:
422
604
  case "end":
423
- return _context10.stop();
605
+ return _context11.stop();
424
606
  }
425
- }, _callee10, this);
607
+ }, _callee11, this);
426
608
  }));
427
609
  function addProduct(_x9) {
428
610
  return _addProduct.apply(this, arguments);
@@ -432,16 +614,16 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
432
614
  }, {
433
615
  key: "selectProducts",
434
616
  value: function () {
435
- var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(products) {
436
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
437
- while (1) switch (_context11.prev = _context11.next) {
617
+ var _selectProducts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(products) {
618
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
619
+ while (1) switch (_context12.prev = _context12.next) {
438
620
  case 0:
439
621
  this.store.selectProducts = products;
440
622
  case 1:
441
623
  case "end":
442
- return _context11.stop();
624
+ return _context12.stop();
443
625
  }
444
- }, _callee11, this);
626
+ }, _callee12, this);
445
627
  }));
446
628
  function selectProducts(_x10) {
447
629
  return _selectProducts.apply(this, arguments);
@@ -15,6 +15,16 @@ export interface ProductListLoadProductsParams {
15
15
  /** 智能定价条件上下文,仅影响策略命中,不参与商品集合筛选 */
16
16
  strategy_context?: Record<string, any>;
17
17
  }
18
+ export interface ProductListStoreQueryParams {
19
+ includeIds?: Array<number | string>;
20
+ excludeIds?: Array<number | string>;
21
+ categoryIds?: Array<number | string>;
22
+ collectionIds?: Array<number | string>;
23
+ extensionTypes?: string[];
24
+ statuses?: ProductData['status'][];
25
+ channelApplications?: string[];
26
+ codeOrBarcode?: string;
27
+ }
18
28
  export interface ProductListData {
19
29
  list: ProductData[];
20
30
  selectProducts: ProductData[];
@@ -9,13 +9,27 @@ export declare class QuotationModule extends BaseModule implements Module {
9
9
  private request;
10
10
  private store;
11
11
  private scheduleResolver?;
12
+ private app;
13
+ private quotationListUpdatedListener?;
14
+ private quotationCache;
15
+ private quotationLoadPromises;
16
+ private quotationCacheVersions;
17
+ private lifecycleGeneration;
18
+ private activeChannelKey;
12
19
  constructor(name?: string, version?: string);
13
20
  initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
14
21
  loadQuotations(params?: {
15
22
  channel?: string;
16
23
  customer_id?: number | string;
17
24
  }): Promise<void>;
25
+ ensureQuotations(params?: {
26
+ channel?: string;
27
+ customer_id?: number | string;
28
+ }): Promise<void>;
29
+ invalidateQuotationCache(channel?: string): void;
30
+ private fetchQuotations;
18
31
  getQuotationList(): QuotationItem[];
32
+ setQuotationListUpdatedListener(listener?: () => void): void;
19
33
  getQuotationCustomerScopeInfo(): QuotationCustomerScopeInfo;
20
34
  /**
21
35
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
@@ -57,9 +71,17 @@ export declare class QuotationModule extends BaseModule implements Module {
57
71
  buildProductPriceMap(params: {
58
72
  productIds: number[];
59
73
  timePoints: string[];
74
+ channel?: string;
60
75
  customer_id?: number | string;
61
76
  }): Map<string, string | null>;
62
77
  setScheduleResolver(resolver: (id: number) => ScheduleItem | undefined): void;
78
+ private applyQuotationResponse;
79
+ private notifyQuotationListUpdated;
80
+ private getQuotationCacheKeyData;
81
+ private normalizeChannel;
82
+ private activateChannel;
83
+ private getQuotationCacheVersion;
84
+ private bumpQuotationCacheVersion;
63
85
  private isQuotationVisibleForCustomer;
64
86
  private hasValidCustomerId;
65
87
  private normalizeCustomerId;