@pisell/pisellos 2.2.322 → 2.2.324

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 (209) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/inventory/index.d.ts +92 -0
  4. package/dist/inventory/index.js +509 -0
  5. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  6. package/dist/modules/BookingContext/index.d.ts +2 -2
  7. package/dist/modules/BookingContext/index.js +55 -25
  8. package/dist/modules/BookingContext/types.d.ts +2 -0
  9. package/dist/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  10. package/dist/modules/BookingContext/utils/calendarBooking.js +207 -0
  11. package/dist/modules/BookingContext/utils/index.d.ts +1 -0
  12. package/dist/modules/BookingContext/utils/index.js +1 -0
  13. package/dist/modules/BookingContext/utils/productExtend.d.ts +20 -1
  14. package/dist/modules/BookingContext/utils/productExtend.js +122 -29
  15. package/dist/modules/Date/index.d.ts +1 -1
  16. package/dist/modules/Date/index.js +60 -14
  17. package/dist/modules/Date/types.d.ts +5 -0
  18. package/dist/modules/Discount/index.js +1 -0
  19. package/dist/modules/OpenData/index.d.ts +1 -0
  20. package/dist/modules/OpenData/index.js +1 -0
  21. package/dist/modules/OpenData/salesSettings.d.ts +32 -0
  22. package/dist/modules/OpenData/salesSettings.js +80 -0
  23. package/dist/modules/OpenData/types.d.ts +16 -0
  24. package/dist/modules/OpenData/utils.d.ts +1 -1
  25. package/dist/modules/OpenData/utils.js +3 -2
  26. package/dist/modules/Order/index.d.ts +54 -11
  27. package/dist/modules/Order/index.js +2699 -1411
  28. package/dist/modules/Order/types.d.ts +43 -5
  29. package/dist/modules/Order/types.js +4 -0
  30. package/dist/modules/Order/unpaidAmountGap.d.ts +6 -0
  31. package/dist/modules/Order/unpaidAmountGap.js +72 -0
  32. package/dist/modules/Order/utils/discountProductLineIdentity.js +2 -2
  33. package/dist/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  34. package/dist/modules/Order/utils/productVoucherGroups.js +115 -0
  35. package/dist/modules/Order/utils.d.ts +3 -1
  36. package/dist/modules/Order/utils.js +18 -3
  37. package/dist/modules/Product/index.d.ts +1 -1
  38. package/dist/modules/Product/types.d.ts +5 -0
  39. package/dist/modules/ProductList/clientDataVariants.js +6 -2
  40. package/dist/modules/ProductList/index.d.ts +2 -0
  41. package/dist/modules/ProductList/index.js +161 -51
  42. package/dist/modules/ResourcePlanner/planner.js +58 -2
  43. package/dist/modules/ResourcePlanner/types.d.ts +13 -0
  44. package/dist/modules/Rules/index.d.ts +2 -0
  45. package/dist/modules/Rules/index.js +58 -39
  46. package/dist/modules/Schedule/index.d.ts +7 -1
  47. package/dist/modules/Schedule/index.js +155 -39
  48. package/dist/modules/Schedule/types.d.ts +2 -0
  49. package/dist/modules/bookingReadValidation.d.ts +6 -0
  50. package/dist/modules/bookingReadValidation.js +72 -0
  51. package/dist/plugins/request.d.ts +2 -0
  52. package/dist/server/index.d.ts +5 -0
  53. package/dist/server/index.js +1312 -1154
  54. package/dist/server/modules/order/index.js +2 -1
  55. package/dist/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  56. package/dist/shared/receipt/customerInvoiceLanguages.js +5 -3
  57. package/dist/shared/receipt/small-ticket.d.ts +4 -0
  58. package/dist/shared/receipt/small-ticket.js +70 -12
  59. package/dist/solution/BaseSales/index.d.ts +40 -5
  60. package/dist/solution/BaseSales/index.js +1939 -1484
  61. package/dist/solution/BaseSales/types.d.ts +4 -0
  62. package/dist/solution/BaseSales/types.js +1 -0
  63. package/dist/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
  64. package/dist/solution/BaseSales/utils/posDurationPricing.js +174 -0
  65. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
  66. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -8
  67. package/dist/solution/BookingByStep/index.d.ts +16 -2
  68. package/dist/solution/BookingByStep/index.js +676 -361
  69. package/dist/solution/BookingByStep/utils/resources.d.ts +10 -0
  70. package/dist/solution/BookingByStep/utils/resources.js +117 -76
  71. package/dist/solution/BookingTicket/index.d.ts +2 -2
  72. package/dist/solution/BookingTicket/index.js +249 -135
  73. package/dist/solution/BookingTicket/types.d.ts +14 -2
  74. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  75. package/dist/solution/BookingTicket/utils/addProductDecision.js +39 -11
  76. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  77. package/dist/solution/BookingTicket/utils/resolveUniqueCartDetail.js +188 -0
  78. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  79. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +88 -0
  80. package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  81. package/dist/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  82. package/dist/solution/OrderInvoicePreview/index.js +14 -8
  83. package/dist/solution/ScanOrder/index.d.ts +2 -0
  84. package/dist/solution/ScanOrder/index.js +166 -67
  85. package/dist/solution/ScanOrder/menuAvailability.d.ts +24 -0
  86. package/dist/solution/ScanOrder/menuAvailability.js +363 -0
  87. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  88. package/dist/solution/UnifiedBookingSales/catalogQueryBatch.js +202 -0
  89. package/dist/solution/UnifiedBookingSales/index.d.ts +96 -4
  90. package/dist/solution/UnifiedBookingSales/index.js +3391 -1176
  91. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  92. package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
  93. package/dist/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  94. package/dist/solution/UnifiedBookingSales/salesSettings.js +81 -0
  95. package/dist/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  96. package/dist/solution/UnifiedBookingSales/sessionResourceCache.js +271 -0
  97. package/dist/solution/UnifiedBookingSales/types.d.ts +71 -2
  98. package/dist/solution/UnifiedBookingSales/types.js +7 -1
  99. package/dist/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  100. package/dist/solution/UnifiedBookingSales/venueCatalogSession.js +283 -0
  101. package/dist/utils/platform.d.ts +2 -0
  102. package/dist/utils/platform.js +6 -0
  103. package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
  104. package/dist/utils/pos-receipt-auto-print.js +14 -0
  105. package/lib/index.d.ts +1 -0
  106. package/lib/index.js +12 -0
  107. package/lib/inventory/index.d.ts +92 -0
  108. package/lib/inventory/index.js +287 -0
  109. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  110. package/lib/modules/BookingContext/index.d.ts +2 -2
  111. package/lib/modules/BookingContext/index.js +42 -10
  112. package/lib/modules/BookingContext/types.d.ts +2 -0
  113. package/lib/modules/BookingContext/utils/calendarBooking.d.ts +15 -0
  114. package/lib/modules/BookingContext/utils/calendarBooking.js +156 -0
  115. package/lib/modules/BookingContext/utils/index.d.ts +1 -0
  116. package/lib/modules/BookingContext/utils/index.js +11 -0
  117. package/lib/modules/BookingContext/utils/productExtend.d.ts +20 -1
  118. package/lib/modules/BookingContext/utils/productExtend.js +96 -7
  119. package/lib/modules/Date/index.d.ts +1 -1
  120. package/lib/modules/Date/index.js +28 -5
  121. package/lib/modules/Date/types.d.ts +5 -0
  122. package/lib/modules/Discount/index.js +1 -0
  123. package/lib/modules/OpenData/index.d.ts +1 -0
  124. package/lib/modules/OpenData/index.js +12 -0
  125. package/lib/modules/OpenData/salesSettings.d.ts +32 -0
  126. package/lib/modules/OpenData/salesSettings.js +70 -0
  127. package/lib/modules/OpenData/types.d.ts +16 -0
  128. package/lib/modules/OpenData/utils.d.ts +1 -1
  129. package/lib/modules/OpenData/utils.js +3 -2
  130. package/lib/modules/Order/index.d.ts +54 -11
  131. package/lib/modules/Order/index.js +659 -80
  132. package/lib/modules/Order/types.d.ts +43 -5
  133. package/lib/modules/Order/types.js +2 -0
  134. package/lib/modules/Order/unpaidAmountGap.d.ts +6 -0
  135. package/lib/modules/Order/unpaidAmountGap.js +60 -0
  136. package/lib/modules/Order/utils/discountProductLineIdentity.js +1 -1
  137. package/lib/modules/Order/utils/productVoucherGroups.d.ts +15 -0
  138. package/lib/modules/Order/utils/productVoucherGroups.js +64 -0
  139. package/lib/modules/Order/utils.d.ts +3 -1
  140. package/lib/modules/Order/utils.js +19 -2
  141. package/lib/modules/Product/index.d.ts +1 -1
  142. package/lib/modules/Product/types.d.ts +5 -0
  143. package/lib/modules/ProductList/clientDataVariants.js +6 -2
  144. package/lib/modules/ProductList/index.d.ts +2 -0
  145. package/lib/modules/ProductList/index.js +74 -0
  146. package/lib/modules/ResourcePlanner/planner.js +52 -1
  147. package/lib/modules/ResourcePlanner/types.d.ts +13 -0
  148. package/lib/modules/Rules/index.d.ts +2 -0
  149. package/lib/modules/Rules/index.js +25 -9
  150. package/lib/modules/Schedule/index.d.ts +7 -1
  151. package/lib/modules/Schedule/index.js +68 -4
  152. package/lib/modules/Schedule/types.d.ts +2 -0
  153. package/lib/modules/bookingReadValidation.d.ts +6 -0
  154. package/lib/modules/bookingReadValidation.js +56 -0
  155. package/lib/plugins/request.d.ts +2 -0
  156. package/lib/server/index.d.ts +5 -0
  157. package/lib/server/index.js +124 -16
  158. package/lib/server/modules/order/index.js +2 -1
  159. package/lib/shared/receipt/customerInvoiceLanguages.d.ts +1 -1
  160. package/lib/shared/receipt/customerInvoiceLanguages.js +5 -3
  161. package/lib/shared/receipt/small-ticket.d.ts +4 -0
  162. package/lib/shared/receipt/small-ticket.js +63 -8
  163. package/lib/solution/BaseSales/index.d.ts +40 -5
  164. package/lib/solution/BaseSales/index.js +296 -43
  165. package/lib/solution/BaseSales/types.d.ts +4 -0
  166. package/lib/solution/BaseSales/types.js +1 -0
  167. package/lib/solution/BaseSales/utils/posDurationPricing.d.ts +21 -0
  168. package/lib/solution/BaseSales/utils/posDurationPricing.js +133 -0
  169. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.d.ts +2 -0
  170. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
  171. package/lib/solution/BookingByStep/index.d.ts +16 -2
  172. package/lib/solution/BookingByStep/index.js +222 -14
  173. package/lib/solution/BookingByStep/utils/resources.d.ts +10 -0
  174. package/lib/solution/BookingByStep/utils/resources.js +25 -15
  175. package/lib/solution/BookingTicket/index.d.ts +2 -2
  176. package/lib/solution/BookingTicket/index.js +47 -4
  177. package/lib/solution/BookingTicket/types.d.ts +14 -2
  178. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +3 -1
  179. package/lib/solution/BookingTicket/utils/addProductDecision.js +37 -6
  180. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.d.ts +8 -0
  181. package/lib/solution/BookingTicket/utils/resolveUniqueCartDetail.js +136 -0
  182. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +8 -0
  183. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +54 -0
  184. package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +1 -0
  185. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -1
  186. package/lib/solution/OrderInvoicePreview/index.js +7 -1
  187. package/lib/solution/ScanOrder/index.d.ts +2 -0
  188. package/lib/solution/ScanOrder/index.js +72 -2
  189. package/lib/solution/ScanOrder/menuAvailability.d.ts +24 -0
  190. package/lib/solution/ScanOrder/menuAvailability.js +203 -0
  191. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.d.ts +21 -0
  192. package/lib/solution/UnifiedBookingSales/catalogQueryBatch.js +109 -0
  193. package/lib/solution/UnifiedBookingSales/index.d.ts +96 -4
  194. package/lib/solution/UnifiedBookingSales/index.js +1339 -74
  195. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
  196. package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
  197. package/lib/solution/UnifiedBookingSales/salesSettings.d.ts +16 -0
  198. package/lib/solution/UnifiedBookingSales/salesSettings.js +72 -0
  199. package/lib/solution/UnifiedBookingSales/sessionResourceCache.d.ts +27 -0
  200. package/lib/solution/UnifiedBookingSales/sessionResourceCache.js +199 -0
  201. package/lib/solution/UnifiedBookingSales/types.d.ts +71 -2
  202. package/lib/solution/UnifiedBookingSales/types.js +4 -1
  203. package/lib/solution/UnifiedBookingSales/venueCatalogSession.d.ts +32 -0
  204. package/lib/solution/UnifiedBookingSales/venueCatalogSession.js +155 -0
  205. package/lib/utils/platform.d.ts +2 -0
  206. package/lib/utils/platform.js +7 -0
  207. package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
  208. package/lib/utils/pos-receipt-auto-print.js +13 -0
  209. package/package.json +1 -1
@@ -13,6 +13,7 @@ import type { SubmitPayloadEnhancer } from '../../modules/Order/utils';
13
13
  export declare const BaseSalesHookNames: {
14
14
  readonly onInited: "onInited";
15
15
  readonly onDestroy: "onDestroy";
16
+ readonly onOrderSessionChanged: "onOrderSessionChanged";
16
17
  readonly onRetryInit: "onRetryInit";
17
18
  readonly onRefresh: "onRefresh";
18
19
  readonly onCartValidationChanged: "onCartValidationChanged";
@@ -348,6 +349,9 @@ export interface BaseSalesProductBookingPriceResult {
348
349
  unit_price: string;
349
350
  total_price: string;
350
351
  quantity: number;
352
+ pricing_method?: {
353
+ type: 'fixed_price' | 'duration_based';
354
+ };
351
355
  duration?: BaseSalesQuotationDurationConfig;
352
356
  quotation_shelf_id: number;
353
357
  segments: BaseSalesProductBookingPriceSegment[];
@@ -5,6 +5,7 @@
5
5
  export var BaseSalesHookNames = {
6
6
  onInited: 'onInited',
7
7
  onDestroy: 'onDestroy',
8
+ onOrderSessionChanged: 'onOrderSessionChanged',
8
9
  onRetryInit: 'onRetryInit',
9
10
  onRefresh: 'onRefresh',
10
11
  onCartValidationChanged: 'onCartValidationChanged',
@@ -0,0 +1,21 @@
1
+ import type { BaseSalesCalculateProductBookingPriceParams, BaseSalesProductBookingPriceResult, BaseSalesQuotationDurationConfig } from '../types';
2
+ export interface PosDurationPricingPlan {
3
+ duration: BaseSalesQuotationDurationConfig;
4
+ segments: Array<{
5
+ start: string;
6
+ end: string;
7
+ }>;
8
+ }
9
+ export declare function durationPricingUnavailable(message: string): Error & {
10
+ code: string;
11
+ };
12
+ export declare function hasDurationBasedPricing(product: Record<string, any> | null | undefined): boolean;
13
+ /** Days/Flexible retain their existing quotation behavior. */
14
+ export declare function usesPosDurationPricing(product: Record<string, any> | null | undefined): boolean;
15
+ /** A hydrated catalog can already be fixed while its order/quote still contains an applied duration price. */
16
+ export declare function hasAppliedPosDurationPricing(product: Record<string, any> | null | undefined): boolean;
17
+ export declare function buildPosDurationPricingPlan(params: BaseSalesCalculateProductBookingPriceParams, product: Record<string, any>): PosDurationPricingPlan;
18
+ /** Never use a previously accumulated order price as one unit's fallback. */
19
+ export declare function resolveDurationPricingProduct(product: Record<string, any>, selected: Record<string, any>): Record<string, any>;
20
+ export declare function combinePosDurationPrices(plan: PosDurationPricingPlan, prices: BaseSalesProductBookingPriceResult[]): BaseSalesProductBookingPriceResult;
21
+ export declare function forEachPriceQueryGroup<T>(groups: T[], resolve: (group: T) => Promise<void>, concurrency: number): Promise<void>;
@@ -0,0 +1,174 @@
1
+ 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; }
2
+ 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); }
3
+ 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); } }
4
+ 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); }); }; }
5
+ 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; }
6
+ 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; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ import dayjs from 'dayjs';
11
+ import Decimal from 'decimal.js';
12
+ export function durationPricingUnavailable(message) {
13
+ return Object.assign(new Error(message), {
14
+ code: 'DURATION_PRICING_UNAVAILABLE'
15
+ });
16
+ }
17
+ export function hasDurationBasedPricing(product) {
18
+ var _product$pricing_meth;
19
+ return (product === null || product === void 0 || (_product$pricing_meth = product.pricing_method) === null || _product$pricing_meth === void 0 ? void 0 : _product$pricing_meth.type) === 'duration_based';
20
+ }
21
+
22
+ /** Days/Flexible retain their existing quotation behavior. */
23
+ export function usesPosDurationPricing(product) {
24
+ var _product$duration;
25
+ var type = String((product === null || product === void 0 || (_product$duration = product.duration) === null || _product$duration === void 0 ? void 0 : _product$duration.type) || '').trim().toLowerCase();
26
+ return hasDurationBasedPricing(product) && !['day', 'days', 'flexible'].includes(type);
27
+ }
28
+
29
+ /** A hydrated catalog can already be fixed while its order/quote still contains an applied duration price. */
30
+ export function hasAppliedPosDurationPricing(product) {
31
+ var _product$_extend, _product$_extend2;
32
+ return usesPosDurationPricing(product === null || product === void 0 || (_product$_extend = product._extend) === null || _product$_extend === void 0 ? void 0 : _product$_extend.bookingPriceQuote) || usesPosDurationPricing(product === null || product === void 0 || (_product$_extend2 = product._extend) === null || _product$_extend2 === void 0 || (_product$_extend2 = _product$_extend2.bookingPrice) === null || _product$_extend2 === void 0 ? void 0 : _product$_extend2.quote) || usesPosDurationPricing(product === null || product === void 0 ? void 0 : product.metadata);
33
+ }
34
+ function bookingDateTime(date, time) {
35
+ var dateText = typeof date === 'string' ? date.trim() : '';
36
+ var timeText = typeof time === 'string' ? time.trim() : '';
37
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(dateText) || !/^\d{2}:\d{2}(?::\d{2})?$/.test(timeText)) {
38
+ throw durationPricingUnavailable('A valid booking start and end are required for duration pricing.');
39
+ }
40
+ var text = "".concat(dateText, " ").concat(timeText.length === 5 ? "".concat(timeText, ":00") : timeText);
41
+ var value = dayjs(text);
42
+ if (!value.isValid() || value.format('YYYY-MM-DD HH:mm:ss') !== text) {
43
+ throw durationPricingUnavailable('The booking time is invalid for duration pricing.');
44
+ }
45
+ return value;
46
+ }
47
+ export function buildPosDurationPricingPlan(params, product) {
48
+ var _product$duration2, _product$duration3, _params$booking, _params$booking2, _params$booking3, _params$booking4;
49
+ var type = String(((_product$duration2 = product.duration) === null || _product$duration2 === void 0 ? void 0 : _product$duration2.type) || '').trim().toLowerCase();
50
+ var value = Number((_product$duration3 = product.duration) === null || _product$duration3 === void 0 ? void 0 : _product$duration3.value);
51
+ var minutes = ['hour', 'hours'].includes(type) ? value * 60 : value;
52
+ if (!['minute', 'minutes', 'hour', 'hours'].includes(type) || !Number.isFinite(minutes) || minutes <= 0) {
53
+ throw durationPricingUnavailable('A positive fixed billing duration is required.');
54
+ }
55
+ var start = bookingDateTime((_params$booking = params.booking) === null || _params$booking === void 0 ? void 0 : _params$booking.start_date, (_params$booking2 = params.booking) === null || _params$booking2 === void 0 ? void 0 : _params$booking2.start_time);
56
+ var end = bookingDateTime((_params$booking3 = params.booking) === null || _params$booking3 === void 0 ? void 0 : _params$booking3.end_date, (_params$booking4 = params.booking) === null || _params$booking4 === void 0 ? void 0 : _params$booking4.end_time);
57
+ var count = end.diff(start) / (minutes * 60000);
58
+ if (!Number.isInteger(count) || count < 1 || count > 10000) {
59
+ throw durationPricingUnavailable('The booking duration must be a whole multiple of its billing duration.');
60
+ }
61
+ return {
62
+ duration: {
63
+ type: 'minutes',
64
+ value: minutes
65
+ },
66
+ segments: Array.from({
67
+ length: count
68
+ }, function (_, index) {
69
+ return {
70
+ start: start.add(index * minutes, 'minute').format('YYYY-MM-DD HH:mm:ss'),
71
+ end: start.add((index + 1) * minutes, 'minute').format('YYYY-MM-DD HH:mm:ss')
72
+ };
73
+ })
74
+ };
75
+ }
76
+
77
+ /** Never use a previously accumulated order price as one unit's fallback. */
78
+ export function resolveDurationPricingProduct(product, selected) {
79
+ var _ref, _selected$product_var, _ref2, _product$product_vari, _product$_dataVariant, _ref3, _ref4, _priceSource$price;
80
+ var variantId = Number((_ref = (_selected$product_var = selected.product_variant_id) !== null && _selected$product_var !== void 0 ? _selected$product_var : selected.variant_id) !== null && _ref !== void 0 ? _ref : 0);
81
+ var authoritativeVariantId = Number((_ref2 = (_product$product_vari = product.product_variant_id) !== null && _product$product_vari !== void 0 ? _product$product_vari : product.variant_id) !== null && _ref2 !== void 0 ? _ref2 : 0);
82
+ var variant = variantId > 0 && Array.isArray(product.variant) ? product.variant.find(function (item) {
83
+ return Number(item === null || item === void 0 ? void 0 : item.id) === variantId;
84
+ }) : undefined;
85
+ if (variantId > 0 && !variant && authoritativeVariantId !== variantId) {
86
+ throw durationPricingUnavailable('The selected SKU is missing from the authoritative price response.');
87
+ }
88
+ var appliedFields = (_product$_dataVariant = product._dataVariant) === null || _product$_dataVariant === void 0 ? void 0 : _product$_dataVariant.appliedFields;
89
+ var hasAppliedPrice = Array.isArray(appliedFields) && ['price', 'selling_price', 'original_price', 'base_price'].some(function (field) {
90
+ return appliedFields.includes(field);
91
+ });
92
+ var priceSource = variantId > 0 && authoritativeVariantId !== variantId && !hasAppliedPrice ? variant : product;
93
+ var price = (_ref3 = (_ref4 = (_priceSource$price = priceSource === null || priceSource === void 0 ? void 0 : priceSource.price) !== null && _priceSource$price !== void 0 ? _priceSource$price : priceSource === null || priceSource === void 0 ? void 0 : priceSource.selling_price) !== null && _ref4 !== void 0 ? _ref4 : priceSource === null || priceSource === void 0 ? void 0 : priceSource.base_price) !== null && _ref3 !== void 0 ? _ref3 : priceSource === null || priceSource === void 0 ? void 0 : priceSource.original_price;
94
+ if (!(typeof price === 'number' || typeof price === 'string' && price.trim() !== '') || !Number.isFinite(Number(price)) || Number(price) < 0) {
95
+ throw durationPricingUnavailable('An authoritative price is required for every billing unit.');
96
+ }
97
+ return _objectSpread(_objectSpread({}, product), {}, {
98
+ price: price
99
+ });
100
+ }
101
+ export function combinePosDurationPrices(plan, prices) {
102
+ var _prices$find;
103
+ if (prices.length !== plan.segments.length || prices.length === 0) {
104
+ throw durationPricingUnavailable('The duration price is incomplete.');
105
+ }
106
+ var unitPrice = prices.reduce(function (sum, price) {
107
+ return sum.plus(price.unit_price);
108
+ }, new Decimal(0));
109
+ return _objectSpread(_objectSpread({}, prices[0]), {}, {
110
+ pricing_method: {
111
+ type: 'duration_based'
112
+ },
113
+ duration: plan.duration,
114
+ unit_price: unitPrice.toFixed(2),
115
+ total_price: unitPrice.times(prices[0].quantity).toFixed(2),
116
+ quotation_shelf_id: ((_prices$find = prices.find(function (price) {
117
+ return price.quotation_shelf_id;
118
+ })) === null || _prices$find === void 0 ? void 0 : _prices$find.quotation_shelf_id) || 0,
119
+ segments: prices.map(function (price, index) {
120
+ return _objectSpread(_objectSpread({}, price.segments[0]), {}, {
121
+ start_datetime: plan.segments[index].start,
122
+ end_datetime: plan.segments[index].end,
123
+ time_point: plan.segments[index].start,
124
+ unit_price: price.unit_price,
125
+ total_price: price.unit_price,
126
+ quantity: 1
127
+ });
128
+ }),
129
+ // Options are composed by the caller; bundle pricing belongs to the first unit only.
130
+ product_bundle: prices[0].product_bundle
131
+ });
132
+ }
133
+ export function forEachPriceQueryGroup(_x, _x2, _x3) {
134
+ return _forEachPriceQueryGroup.apply(this, arguments);
135
+ }
136
+ function _forEachPriceQueryGroup() {
137
+ _forEachPriceQueryGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(groups, resolve, concurrency) {
138
+ var next;
139
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
140
+ while (1) switch (_context2.prev = _context2.next) {
141
+ case 0:
142
+ next = 0;
143
+ _context2.next = 3;
144
+ return Promise.all(Array.from({
145
+ length: Math.min(groups.length, concurrency)
146
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
147
+ var _group;
148
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
149
+ while (1) switch (_context.prev = _context.next) {
150
+ case 0:
151
+ if (!(next < groups.length)) {
152
+ _context.next = 6;
153
+ break;
154
+ }
155
+ _group = groups[next++];
156
+ _context.next = 4;
157
+ return resolve(_group);
158
+ case 4:
159
+ _context.next = 0;
160
+ break;
161
+ case 6:
162
+ case "end":
163
+ return _context.stop();
164
+ }
165
+ }, _callee);
166
+ }))));
167
+ case 3:
168
+ case "end":
169
+ return _context2.stop();
170
+ }
171
+ }, _callee2);
172
+ }));
173
+ return _forEachPriceQueryGroup.apply(this, arguments);
174
+ }
@@ -55,6 +55,8 @@ export interface TransformBaseProductToOrderProductParams {
55
55
  fallbackProductId?: number | string | null;
56
56
  sourceProduct?: ProductData | Record<string, any> | null;
57
57
  sourceItem?: ProductData | Record<string, any> | null;
58
+ /** Validated booking quote's pre-discount main price, excluding options/bundles. */
59
+ quotedSourceProductPrice?: number | string;
58
60
  }
59
61
  export type BaseProductOrderProductInput = Partial<OrderProduct> & OrderProductIdentity & {
60
62
  _origin?: Record<string, any>;
@@ -170,7 +170,7 @@ function findVariantById(origin, variantId) {
170
170
  * 注意:这里不生成 identity,缺省时由 OrderModule 自动补齐。
171
171
  */
172
172
  export function transformBaseProductToOrderProduct(params) {
173
- var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _ref24, _payload$price, _ref25, _payload$line_total, _payload$_extend3, _ref26, _ref27, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref28, _ref29, _origin$base_price, _ref30, _ref31, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _find, _resolveProductHolder, _ref32, _ref33, _payload$tax_fee, _ref34, _ref35, _payload$is_charge_ta;
173
+ var _ref12, _ref13, _ref14, _payload$product_id, _ref15, _ref16, _payload$product_vari, _payload$_origin, _payload$_origin2, _payload$metadata, _sourceProduct$metada, _callbackOrigin$metad, _origin$metadata, _payload$metadata2, _payload$_extend, _sourceProduct$metada2, _sourceProduct$_exten, _callbackOrigin$metad2, _callbackOrigin$_exte, _payload$_dataVariant, _sourceProduct$_dataV, _callbackOrigin$_data, _origin$_dataVariant, _ref17, _findVariantById, _origin$production_co, _ref18, _ref19, _ref20, _ref21, _ref22, _matchedVariant$price, _payload$product_sku, _payload$_extend$weig, _payload$_extend2, _origin$_extend, _ref23, _params$quotedSourceP, _ref24, _ref25, _payload$price, _ref26, _payload$line_total, _payload$_extend3, _ref27, _ref28, _payload$product_sku$, _payload$product_sku2, _payload$bundle, _payload$quantity, _payload$_extend4, _extend, _extend2, _ref29, _ref30, _origin$base_price, _ref31, _ref32, _payload$line_total2, _payload$_extend5, _payload$_extend6, _extend3, _payload$_extend7, _payload$_extend8, _find, _resolveProductHolder, _ref33, _ref34, _payload$tax_fee, _ref35, _ref36, _payload$is_charge_ta;
174
174
  var payload = params.payload,
175
175
  _params$fallbackProdu = params.fallbackProductId,
176
176
  fallbackProductId = _params$fallbackProdu === void 0 ? null : _params$fallbackProdu;
@@ -193,11 +193,11 @@ export function transformBaseProductToOrderProduct(params) {
193
193
  // 售价仍由 line_total - bundle 推导。
194
194
  var catalogSourcePrice = (_ref18 = (_ref19 = (_ref20 = (_ref21 = (_ref22 = (_matchedVariant$price = matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.price) !== null && _matchedVariant$price !== void 0 ? _matchedVariant$price : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.base_price) !== null && _ref22 !== void 0 ? _ref22 : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref21 !== void 0 ? _ref21 : origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _ref20 !== void 0 ? _ref20 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price) !== null && _ref19 !== void 0 ? _ref19 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.selling_price) !== null && _ref18 !== void 0 ? _ref18 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price;
195
195
  var weighedSourcePrice = resolveWeighedSourcePrice((_payload$product_sku = payload.product_sku) !== null && _payload$product_sku !== void 0 ? _payload$product_sku : origin.product_sku, (_payload$_extend$weig = (_payload$_extend2 = payload._extend) === null || _payload$_extend2 === void 0 ? void 0 : _payload$_extend2.weighing) !== null && _payload$_extend$weig !== void 0 ? _payload$_extend$weig : (_origin$_extend = origin._extend) === null || _origin$_extend === void 0 ? void 0 : _origin$_extend.weighing);
196
- var sourceProductPrice = toPriceString(weighedSourcePrice !== null && weighedSourcePrice !== void 0 ? weighedSourcePrice : hasPriceOverride ? (_ref23 = catalogSourcePrice !== null && catalogSourcePrice !== void 0 ? catalogSourcePrice : payload.price) !== null && _ref23 !== void 0 ? _ref23 : payload.selling_price : (_ref24 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref24 !== void 0 ? _ref24 : catalogSourcePrice, '0.00');
197
- var explicitLineTotal = (_ref25 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref25 !== void 0 ? _ref25 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total;
196
+ var sourceProductPrice = toPriceString((_ref23 = (_params$quotedSourceP = params.quotedSourceProductPrice) !== null && _params$quotedSourceP !== void 0 ? _params$quotedSourceP : weighedSourcePrice) !== null && _ref23 !== void 0 ? _ref23 : hasPriceOverride ? (_ref24 = catalogSourcePrice !== null && catalogSourcePrice !== void 0 ? catalogSourcePrice : payload.price) !== null && _ref24 !== void 0 ? _ref24 : payload.selling_price : (_ref25 = (_payload$price = payload.price) !== null && _payload$price !== void 0 ? _payload$price : payload.selling_price) !== null && _ref25 !== void 0 ? _ref25 : catalogSourcePrice, '0.00');
197
+ var explicitLineTotal = (_ref26 = (_payload$line_total = payload.line_total) !== null && _payload$line_total !== void 0 ? _payload$line_total : payload.total) !== null && _ref26 !== void 0 ? _ref26 : (_payload$_extend3 = payload._extend) === null || _payload$_extend3 === void 0 ? void 0 : _payload$_extend3.total;
198
198
  var hasExplicitLineTotal = Number.isFinite(Number(explicitLineTotal));
199
199
  var lineCompositeTotal = toPriceString(explicitLineTotal, sourceProductPrice);
200
- var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref26 = (_ref27 = (_payload$product_sku$ = (_payload$product_sku2 = payload.product_sku) === null || _payload$product_sku2 === void 0 ? void 0 : _payload$product_sku2.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref27 !== void 0 ? _ref27 : payload.options) !== null && _ref26 !== void 0 ? _ref26 : payload.product_option_item, hasPriceOverride || weighedSourcePrice !== undefined));
200
+ var productOptionItem = normalizeProductSkuOptions(normalizeOptionItems((_ref27 = (_ref28 = (_payload$product_sku$ = (_payload$product_sku2 = payload.product_sku) === null || _payload$product_sku2 === void 0 ? void 0 : _payload$product_sku2.option) !== null && _payload$product_sku$ !== void 0 ? _payload$product_sku$ : payload.option) !== null && _ref28 !== void 0 ? _ref28 : payload.options) !== null && _ref27 !== void 0 ? _ref27 : payload.product_option_item, hasPriceOverride || weighedSourcePrice !== undefined));
201
201
  var productBundle = normalizeBundleItems((_payload$bundle = payload.bundle) !== null && _payload$bundle !== void 0 ? _payload$bundle : payload.product_bundle, hasPriceOverride, hasPriceOverride && weighedSourcePrice !== undefined);
202
202
  // `payload.unique` 是业务侧商品/票务标识,可能在连续加同一商品时重复;
203
203
  // 行级唯一值只接受显式协议字段,缺省交给 OrderModule 生成。
@@ -212,10 +212,10 @@ export function transformBaseProductToOrderProduct(params) {
212
212
  extendOriginTotal: (_payload$_extend4 = payload._extend) === null || _payload$_extend4 === void 0 ? void 0 : _payload$_extend4.origin_total,
213
213
  originExtendOriginTotal: origin === null || origin === void 0 || (_extend = origin._extend) === null || _extend === void 0 ? void 0 : _extend.origin_total,
214
214
  sourceExtendOriginTotal: sourceProduct === null || sourceProduct === void 0 || (_extend2 = sourceProduct._extend) === null || _extend2 === void 0 ? void 0 : _extend2.origin_total,
215
- catalogUnitPrice: (_ref28 = (_ref29 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref29 !== void 0 ? _ref29 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref28 !== void 0 ? _ref28 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
215
+ catalogUnitPrice: (_ref29 = (_ref30 = (_origin$base_price = origin === null || origin === void 0 ? void 0 : origin.base_price) !== null && _origin$base_price !== void 0 ? _origin$base_price : origin === null || origin === void 0 ? void 0 : origin.price) !== null && _ref30 !== void 0 ? _ref30 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.base_price) !== null && _ref29 !== void 0 ? _ref29 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.price,
216
216
  quantity: resolvedQuantity
217
217
  });
218
- var sellingTotal = Number((_ref30 = (_ref31 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref31 !== void 0 ? _ref31 : (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.total) !== null && _ref30 !== void 0 ? _ref30 : lineCompositeTotal);
218
+ var sellingTotal = Number((_ref31 = (_ref32 = (_payload$line_total2 = payload.line_total) !== null && _payload$line_total2 !== void 0 ? _payload$line_total2 : payload.total) !== null && _ref32 !== void 0 ? _ref32 : (_payload$_extend5 = payload._extend) === null || _payload$_extend5 === void 0 ? void 0 : _payload$_extend5.total) !== null && _ref31 !== void 0 ? _ref31 : lineCompositeTotal);
219
219
  var discountReason = resolveManualDiscountReasonFromSources({
220
220
  discountReason: payload.discount_reason,
221
221
  extendDiscountReason: (_payload$_extend6 = payload._extend) === null || _payload$_extend6 === void 0 ? void 0 : _payload$_extend6.discount_reason,
@@ -297,8 +297,8 @@ export function transformBaseProductToOrderProduct(params) {
297
297
  // 折后行价由 normalizeOrderProduct 按 main + bundle 合成;手动改价时 bundle 已为分摊后单价
298
298
  selling_price: lineCompositeTotal,
299
299
  original_price: lineOriginalPrice,
300
- tax_fee: toPriceString((_ref32 = (_ref33 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref33 !== void 0 ? _ref33 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref32 !== void 0 ? _ref32 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
301
- is_charge_tax: toNumber((_ref34 = (_ref35 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref35 !== void 0 ? _ref35 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref34 !== void 0 ? _ref34 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
300
+ tax_fee: toPriceString((_ref33 = (_ref34 = (_payload$tax_fee = payload.tax_fee) !== null && _payload$tax_fee !== void 0 ? _payload$tax_fee : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.tax_fee) !== null && _ref34 !== void 0 ? _ref34 : origin === null || origin === void 0 ? void 0 : origin.tax_fee) !== null && _ref33 !== void 0 ? _ref33 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.tax_fee, '0.00'),
301
+ is_charge_tax: toNumber((_ref35 = (_ref36 = (_payload$is_charge_ta = payload.is_charge_tax) !== null && _payload$is_charge_ta !== void 0 ? _payload$is_charge_ta : matchedVariant === null || matchedVariant === void 0 ? void 0 : matchedVariant.is_charge_tax) !== null && _ref36 !== void 0 ? _ref36 : origin === null || origin === void 0 ? void 0 : origin.is_charge_tax) !== null && _ref35 !== void 0 ? _ref35 : sourceProduct === null || sourceProduct === void 0 ? void 0 : sourceProduct.is_charge_tax, 0),
302
302
  metadata: metadata
303
303
  }, holderRelations !== undefined && !isBookingProduct(origin) && !isBookingProduct(payload) ? {
304
304
  _extend: {
@@ -20,9 +20,20 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
20
20
  private shopStore;
21
21
  private store;
22
22
  private otherParams;
23
+ private scheduleRuntimeParams;
23
24
  private cacheId;
24
25
  private otherData;
25
26
  private platform;
27
+ private productDetailGeneration;
28
+ private sessionAvailabilityRequestVersion;
29
+ private lifecycleGeneration;
30
+ private disposed;
31
+ private resourcePreparation?;
32
+ private staleSelection;
33
+ private resourceSelectionKey;
34
+ /** Semantic selection token for async UI transitions. */
35
+ getBookingSelectionKey(): string;
36
+ private refreshCurrentProductSchedule;
26
37
  initialize(core: PisellCore, options: any): Promise<void>;
27
38
  initStep(stepList: (keyof BookingByStepState)[]): void;
28
39
  getCurrentStep(): {
@@ -108,7 +119,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
108
119
  * }
109
120
  * @memberof BookingByStepImpl
110
121
  */
111
- loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, }: LoadScheduleAvailableDateParams): Promise<ITime[]>;
122
+ loadScheduleAvailableDate({ startDate, endDate, custom_page_id, channel, assertCurrent, }: LoadScheduleAvailableDateParams): Promise<ITime[]>;
112
123
  addAccount(account: Account | IHolder, extra?: {
113
124
  type: 'account' | 'holder';
114
125
  customerId: number;
@@ -152,7 +163,10 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
152
163
  startDate?: string;
153
164
  endDate?: string;
154
165
  type?: 'month' | 'day';
166
+ assertCurrent?: () => void;
155
167
  }): Promise<ITime[]>;
168
+ /** Prepare the exact cart/date selection before synchronous resource checks. */
169
+ prepareResourcesForCurrentSelection(): Promise<void>;
156
170
  /**
157
171
  * 获取购物车汇总信息
158
172
  */
@@ -328,7 +342,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
328
342
  date: string;
329
343
  status: string;
330
344
  week: string;
331
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
345
+ weekNum: 0 | 2 | 1 | 3 | 5 | 4 | 6;
332
346
  }[]>;
333
347
  submitTimeSlot(timeSlots: TimeSliceItem): void;
334
348
  private getScheduleDataByIds;