@pisell/pisellos 2.2.277 → 2.2.279

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 (191) hide show
  1. package/dist/model/strategy/adapter/promotion/index.js +0 -9
  2. package/dist/modules/BaseModule.d.ts +1 -0
  3. package/dist/modules/BaseModule.js +24 -28
  4. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +7 -3
  5. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  6. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  7. package/dist/modules/Customer/index.d.ts +4 -0
  8. package/dist/modules/Customer/index.js +91 -59
  9. package/dist/modules/Customer/types.d.ts +2 -0
  10. package/dist/modules/Discount/index.d.ts +1 -0
  11. package/dist/modules/Discount/index.js +40 -11
  12. package/dist/modules/Discount/types.d.ts +1 -0
  13. package/dist/modules/Holder/index.d.ts +48 -0
  14. package/dist/modules/Holder/index.js +640 -0
  15. package/dist/modules/Holder/types.d.ts +123 -0
  16. package/dist/modules/Holder/types.js +1 -0
  17. package/dist/modules/Holder/utils.d.ts +13 -0
  18. package/dist/modules/Holder/utils.js +34 -0
  19. package/dist/modules/OpenData/index.js +2 -2
  20. package/dist/modules/Order/index.d.ts +32 -4
  21. package/dist/modules/Order/index.js +868 -675
  22. package/dist/modules/Order/types.d.ts +22 -1
  23. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  24. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  25. package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  26. package/dist/modules/Order/utils/orderCollectionIdentity.js +75 -0
  27. package/dist/modules/Order/utils.d.ts +10 -0
  28. package/dist/modules/Order/utils.js +71 -34
  29. package/dist/modules/Payment/index.d.ts +4 -0
  30. package/dist/modules/Payment/index.js +14 -4
  31. package/dist/modules/Payment/walletpass.js +48 -13
  32. package/dist/modules/Product/types.d.ts +1 -0
  33. package/dist/modules/ProductList/index.js +33 -13
  34. package/dist/modules/Quotation/index.d.ts +1 -1
  35. package/dist/modules/Quotation/index.js +2 -2
  36. package/dist/modules/ResourcePlanner/index.d.ts +24 -0
  37. package/dist/modules/ResourcePlanner/index.js +181 -0
  38. package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
  39. package/dist/modules/ResourcePlanner/planner.js +1069 -0
  40. package/dist/modules/ResourcePlanner/types.d.ts +227 -0
  41. package/dist/modules/ResourcePlanner/types.js +1 -0
  42. package/dist/modules/Rules/index.js +153 -56
  43. package/dist/modules/SalesSummary/index.js +12 -13
  44. package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
  45. package/dist/modules/ScanOrderLogger/index.js +15 -2
  46. package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
  47. package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
  48. package/dist/modules/Schedule/index.d.ts +3 -1
  49. package/dist/modules/Schedule/index.js +21 -16
  50. package/dist/modules/Summary/utils.js +38 -13
  51. package/dist/modules/index.d.ts +2 -0
  52. package/dist/modules/index.js +3 -1
  53. package/dist/plugins/window.d.ts +1 -0
  54. package/dist/server/index.d.ts +20 -0
  55. package/dist/server/index.js +1101 -909
  56. package/dist/server/modules/order/index.d.ts +2 -0
  57. package/dist/server/modules/order/index.js +261 -96
  58. package/dist/server/modules/order/types.d.ts +1 -1
  59. package/dist/server/utils/small-ticket.js +2 -1
  60. package/dist/solution/BaseSales/index.d.ts +10 -1
  61. package/dist/solution/BaseSales/index.js +201 -148
  62. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
  63. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +6 -3
  64. package/dist/solution/BaseSales/utils.js +31 -20
  65. package/dist/solution/BookingByStep/index.d.ts +16 -1
  66. package/dist/solution/BookingByStep/index.js +294 -215
  67. package/dist/solution/BookingByStep/types.d.ts +2 -1
  68. package/dist/solution/BookingByStep/types.js +3 -1
  69. package/dist/solution/BookingByStep/utils/capacity.js +17 -1
  70. package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  71. package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
  72. package/dist/solution/BookingTicket/index.d.ts +6 -2
  73. package/dist/solution/BookingTicket/index.js +125 -77
  74. package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  75. package/dist/solution/BookingTicket/utils/scan/handleScan.js +10 -2
  76. package/dist/solution/ScanOrder/index.d.ts +26 -14
  77. package/dist/solution/ScanOrder/index.js +1142 -739
  78. package/dist/solution/ScanOrder/types.d.ts +21 -1
  79. package/dist/solution/ScanOrder/utils.d.ts +8 -0
  80. package/dist/solution/ScanOrder/utils.js +97 -45
  81. package/dist/solution/ShopDiscount/index.d.ts +1 -0
  82. package/dist/solution/ShopDiscount/index.js +125 -87
  83. package/dist/solution/UnifiedBookingSales/index.d.ts +204 -0
  84. package/dist/solution/UnifiedBookingSales/index.js +2211 -0
  85. package/dist/solution/UnifiedBookingSales/types.d.ts +150 -0
  86. package/dist/solution/UnifiedBookingSales/types.js +11 -0
  87. package/dist/solution/VenueBooking/index.d.ts +39 -11
  88. package/dist/solution/VenueBooking/index.js +1167 -841
  89. package/dist/solution/VenueBooking/types.d.ts +3 -0
  90. package/dist/solution/VenueBooking/utils/resource.js +1 -0
  91. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  92. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
  93. package/dist/solution/index.d.ts +1 -0
  94. package/dist/solution/index.js +2 -1
  95. package/dist/types/index.d.ts +1 -0
  96. package/lib/model/strategy/adapter/promotion/index.js +51 -0
  97. package/lib/modules/BaseModule.d.ts +1 -0
  98. package/lib/modules/BaseModule.js +24 -37
  99. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -0
  100. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  101. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  102. package/lib/modules/Customer/index.d.ts +4 -0
  103. package/lib/modules/Customer/index.js +11 -0
  104. package/lib/modules/Customer/types.d.ts +2 -0
  105. package/lib/modules/Discount/index.d.ts +1 -0
  106. package/lib/modules/Discount/index.js +9 -0
  107. package/lib/modules/Discount/types.d.ts +1 -0
  108. package/lib/modules/Holder/index.d.ts +48 -0
  109. package/lib/modules/Holder/index.js +402 -0
  110. package/lib/modules/Holder/types.d.ts +123 -0
  111. package/lib/modules/Holder/types.js +17 -0
  112. package/lib/modules/Holder/utils.d.ts +13 -0
  113. package/lib/modules/Holder/utils.js +71 -0
  114. package/lib/modules/OpenData/index.js +1 -1
  115. package/lib/modules/Order/index.d.ts +32 -4
  116. package/lib/modules/Order/index.js +372 -156
  117. package/lib/modules/Order/types.d.ts +22 -1
  118. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  119. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  120. package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +15 -0
  121. package/lib/modules/Order/utils/orderCollectionIdentity.js +70 -0
  122. package/lib/modules/Order/utils.d.ts +10 -0
  123. package/lib/modules/Order/utils.js +39 -6
  124. package/lib/modules/Payment/index.d.ts +4 -0
  125. package/lib/modules/Payment/index.js +7 -0
  126. package/lib/modules/Payment/walletpass.js +27 -1
  127. package/lib/modules/Product/types.d.ts +1 -0
  128. package/lib/modules/ProductList/index.js +49 -31
  129. package/lib/modules/Quotation/index.d.ts +1 -1
  130. package/lib/modules/Quotation/index.js +2 -2
  131. package/lib/modules/ResourcePlanner/index.d.ts +24 -0
  132. package/lib/modules/ResourcePlanner/index.js +148 -0
  133. package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
  134. package/lib/modules/ResourcePlanner/planner.js +933 -0
  135. package/lib/modules/ResourcePlanner/types.d.ts +227 -0
  136. package/lib/modules/ResourcePlanner/types.js +17 -0
  137. package/lib/modules/Rules/index.js +117 -25
  138. package/lib/modules/SalesSummary/index.js +6 -7
  139. package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
  140. package/lib/modules/ScanOrderLogger/index.js +13 -1
  141. package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
  142. package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
  143. package/lib/modules/Schedule/index.d.ts +3 -1
  144. package/lib/modules/Schedule/index.js +10 -8
  145. package/lib/modules/Summary/utils.js +21 -1
  146. package/lib/modules/index.d.ts +2 -0
  147. package/lib/modules/index.js +5 -1
  148. package/lib/plugins/window.d.ts +1 -0
  149. package/lib/server/index.d.ts +20 -0
  150. package/lib/server/index.js +124 -19
  151. package/lib/server/modules/order/index.d.ts +2 -0
  152. package/lib/server/modules/order/index.js +75 -5
  153. package/lib/server/modules/order/types.d.ts +1 -1
  154. package/lib/server/utils/small-ticket.js +1 -1
  155. package/lib/solution/BaseSales/index.d.ts +10 -1
  156. package/lib/solution/BaseSales/index.js +73 -29
  157. package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
  158. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -0
  159. package/lib/solution/BaseSales/utils.js +29 -18
  160. package/lib/solution/BookingByStep/index.d.ts +16 -1
  161. package/lib/solution/BookingByStep/index.js +60 -18
  162. package/lib/solution/BookingByStep/types.d.ts +2 -1
  163. package/lib/solution/BookingByStep/types.js +5 -0
  164. package/lib/solution/BookingByStep/utils/capacity.js +20 -1
  165. package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
  166. package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
  167. package/lib/solution/BookingTicket/index.d.ts +6 -2
  168. package/lib/solution/BookingTicket/index.js +63 -16
  169. package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +3 -1
  170. package/lib/solution/BookingTicket/utils/scan/handleScan.js +2 -2
  171. package/lib/solution/ScanOrder/index.d.ts +26 -14
  172. package/lib/solution/ScanOrder/index.js +449 -182
  173. package/lib/solution/ScanOrder/types.d.ts +21 -1
  174. package/lib/solution/ScanOrder/utils.d.ts +8 -0
  175. package/lib/solution/ScanOrder/utils.js +60 -18
  176. package/lib/solution/ShopDiscount/index.d.ts +1 -0
  177. package/lib/solution/ShopDiscount/index.js +14 -0
  178. package/lib/solution/UnifiedBookingSales/index.d.ts +204 -0
  179. package/lib/solution/UnifiedBookingSales/index.js +1273 -0
  180. package/lib/solution/UnifiedBookingSales/types.d.ts +150 -0
  181. package/lib/solution/UnifiedBookingSales/types.js +33 -0
  182. package/lib/solution/VenueBooking/index.d.ts +39 -11
  183. package/lib/solution/VenueBooking/index.js +322 -110
  184. package/lib/solution/VenueBooking/types.d.ts +3 -0
  185. package/lib/solution/VenueBooking/utils/resource.js +1 -0
  186. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
  187. package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
  188. package/lib/solution/index.d.ts +1 -0
  189. package/lib/solution/index.js +3 -1
  190. package/lib/types/index.d.ts +1 -0
  191. package/package.json +1 -1
@@ -20,6 +20,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
20
20
  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; }
21
21
  import dayjs from "dayjs";
22
22
  import Decimal from 'decimal.js';
23
+ import { getProductHolderConfig } from "../Holder/utils";
23
24
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
24
25
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
25
26
  /**
@@ -744,10 +745,41 @@ export var mergeRelationForms = function mergeRelationForms(relationForms) {
744
745
  return item.form_record_ids.length > 0;
745
746
  }); // 过滤掉没有有效记录的表单
746
747
  };
748
+ function getCustomerIdFromStorage(window) {
749
+ try {
750
+ var _window$getLocalStora;
751
+ var customer = JSON.parse((window === null || window === void 0 || (_window$getLocalStora = window.getLocalStorage) === null || _window$getLocalStora === void 0 ? void 0 : _window$getLocalStora.call(window, 'customer')) || '{}');
752
+ var customerId = Number(customer === null || customer === void 0 ? void 0 : customer.id);
753
+ return Number.isFinite(customerId) && customerId > 0 ? customerId : undefined;
754
+ } catch (_unused) {
755
+ return undefined;
756
+ }
757
+ }
758
+
759
+ /**
760
+ * 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
761
+ */
762
+ export function ensureCartItemOriginHolder(cartItem, window) {
763
+ var _cartItem$_origin, _cartItem$_productIni;
764
+ if (cartItem !== null && cartItem !== void 0 && (_cartItem$_origin = cartItem._origin) !== null && _cartItem$_origin !== void 0 && _cartItem$_origin.holder) {
765
+ return;
766
+ }
767
+ var holderConfig = getProductHolderConfig((_cartItem$_productIni = cartItem === null || cartItem === void 0 ? void 0 : cartItem._productInit) !== null && _cartItem$_productIni !== void 0 ? _cartItem$_productIni : cartItem === null || cartItem === void 0 ? void 0 : cartItem._productOrigin);
768
+ var formRecordId = cartItem === null || cartItem === void 0 ? void 0 : cartItem.holder_id;
769
+ if (!(holderConfig !== null && holderConfig !== void 0 && holderConfig.resource_id) || formRecordId == null) {
770
+ return;
771
+ }
772
+ cartItem._origin.holder = {
773
+ customer_id: getCustomerIdFromStorage(window),
774
+ form_id: holderConfig.resource_id,
775
+ form_record: [formRecordId]
776
+ };
777
+ }
778
+ ;
747
779
  export var getAllDiscountList = function getAllDiscountList(cartItem) {
748
- var _cartItem$_origin, _cartItem$_origin2;
749
- var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin = cartItem._origin) === null || _cartItem$_origin === void 0 || (_cartItem$_origin = _cartItem$_origin.product) === null || _cartItem$_origin === void 0 ? void 0 : _cartItem$_origin.discount_list) || [];
750
- ((cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.product_bundle) || []).forEach(function (item) {
780
+ var _cartItem$_origin2, _cartItem$_origin3;
781
+ var discountList = (cartItem === null || cartItem === void 0 || (_cartItem$_origin2 = cartItem._origin) === null || _cartItem$_origin2 === void 0 || (_cartItem$_origin2 = _cartItem$_origin2.product) === null || _cartItem$_origin2 === void 0 ? void 0 : _cartItem$_origin2.discount_list) || [];
782
+ ((cartItem === null || cartItem === void 0 || (_cartItem$_origin3 = cartItem._origin) === null || _cartItem$_origin3 === void 0 || (_cartItem$_origin3 = _cartItem$_origin3.product) === null || _cartItem$_origin3 === void 0 ? void 0 : _cartItem$_origin3.product_bundle) || []).forEach(function (item) {
751
783
  discountList = [].concat(_toConsumableArray(discountList), _toConsumableArray((item === null || item === void 0 ? void 0 : item.discount_list) || []));
752
784
  item.discount_list = undefined;
753
785
  });
@@ -878,7 +910,7 @@ function formatSubmitBundleItems(bundle) {
878
910
  * 本函数不再改造价格字段形状,仅做字段/metadata 裁剪。
879
911
  */
880
912
  function normalizeSubmitProduct(product) {
881
- var _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
913
+ var _ref29, _submitProduct$bundle, _rawMetadata$product_, _submitProduct$produc, _submitProduct$paymen;
882
914
  var _ref28 = product,
883
915
  _runtimeUid = _ref28.unique_identification_number,
884
916
  submitProduct = _objectWithoutProperties(_ref28, _excluded2);
@@ -893,6 +925,10 @@ function normalizeSubmitProduct(product) {
893
925
  delete productRest["product_".concat('option', "_item")];
894
926
  var rawMetadata = submitProduct.metadata || {};
895
927
  var bookingUid = rawMetadata.booking_uid;
928
+ // 兼容历史 BigSale 编辑链路:bundle_edit 曾被写入 metadata,
929
+ // 出站时需提升到商品顶层;套餐未编辑时也必须显式提交 0。
930
+ var hasProductBundle = Array.isArray(submitProduct.product_bundle) && submitProduct.product_bundle.length > 0;
931
+ var bundleEdit = (_ref29 = (_submitProduct$bundle = submitProduct.bundle_edit) !== null && _submitProduct$bundle !== void 0 ? _submitProduct$bundle : rawMetadata.bundle_edit) !== null && _ref29 !== void 0 ? _ref29 : hasProductBundle ? 0 : undefined;
896
932
  var cleanMetadata = {};
897
933
  if (rawMetadata.unique_identification_number) {
898
934
  cleanMetadata.unique_identification_number = rawMetadata.unique_identification_number;
@@ -917,8 +953,10 @@ function normalizeSubmitProduct(product) {
917
953
  var productSku = _objectSpread(_objectSpread({}, submitProduct.product_sku && _typeof(submitProduct.product_sku) === 'object' ? submitProduct.product_sku : {}), {}, {
918
954
  option: formatSubmitOptionItems((_submitProduct$produc = submitProduct.product_sku) === null || _submitProduct$produc === void 0 ? void 0 : _submitProduct$produc.option)
919
955
  });
920
- return _objectSpread(_objectSpread(_objectSpread({}, productRest), bookingUid ? {
956
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, productRest), bookingUid ? {
921
957
  booking_uid: bookingUid
958
+ } : {}), bundleEdit !== undefined ? {
959
+ bundle_edit: bundleEdit
922
960
  } : {}), {}, {
923
961
  product_quantity: toBundleNumber(num !== null && num !== void 0 ? num : submitProduct.product_quantity, 1),
924
962
  product_sku: productSku,
@@ -1048,7 +1086,7 @@ export function createDefaultTempOrder(params) {
1048
1086
  };
1049
1087
  }
1050
1088
  export function buildSubmitPayload(params) {
1051
- var _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref30, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1089
+ var _tempOrder$customer_i, _tempOrder$country_ca, _tempOrder$phone, _tempOrder$email, _tempOrder$order_numb, _tempOrder$shop_order, _tempOrder$shop_full_, _ref31, _tempOrder$is_price_i, _tempOrder$is_deposit, _enhancedPayload$summ;
1052
1090
  var tempOrder = params.tempOrder,
1053
1091
  cacheId = params.cacheId,
1054
1092
  _params$now = params.now,
@@ -1061,26 +1099,26 @@ export function buildSubmitPayload(params) {
1061
1099
  enhance = params.enhance;
1062
1100
  var scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
1063
1101
  var bookingUuid = createUuidV4();
1064
- var _ref29 = tempOrder,
1065
- _extend = _ref29._extend,
1066
- _relationId = _ref29.relation_id,
1067
- _tableFormId = _ref29.table_form_id,
1068
- _resourceId = _ref29.resource_id,
1069
- _summary = _ref29.summary,
1070
- _lastOrderInfo = _ref29.lastOrderInfo,
1071
- _paidAmount = _ref29.paid_amount,
1072
- _shopId = _ref29.shop_id,
1073
- _shopNote = _ref29.shop_note,
1074
- _shopServiceType = _ref29.shop_service_type,
1075
- _startTime = _ref29.start_time,
1076
- _customer = _ref29.customer,
1077
- _discountList = _ref29.discount_list,
1078
- _rootTaxFee = _ref29.tax_fee,
1079
- _totalAmount = _ref29.total_amount,
1080
- _totalRefundAmount = _ref29.total_refund_amount,
1081
- _createDate = _ref29.create_date,
1082
- _holderId = _ref29.holder_id,
1083
- tempOrderRest = _objectWithoutProperties(_ref29, _excluded4);
1102
+ var _ref30 = tempOrder,
1103
+ _extend = _ref30._extend,
1104
+ _relationId = _ref30.relation_id,
1105
+ _tableFormId = _ref30.table_form_id,
1106
+ _resourceId = _ref30.resource_id,
1107
+ _summary = _ref30.summary,
1108
+ _lastOrderInfo = _ref30.lastOrderInfo,
1109
+ _paidAmount = _ref30.paid_amount,
1110
+ _shopId = _ref30.shop_id,
1111
+ _shopNote = _ref30.shop_note,
1112
+ _shopServiceType = _ref30.shop_service_type,
1113
+ _startTime = _ref30.start_time,
1114
+ _customer = _ref30.customer,
1115
+ _discountList = _ref30.discount_list,
1116
+ _rootTaxFee = _ref30.tax_fee,
1117
+ _totalAmount = _ref30.total_amount,
1118
+ _totalRefundAmount = _ref30.total_refund_amount,
1119
+ _createDate = _ref30.create_date,
1120
+ _holderId = _ref30.holder_id,
1121
+ tempOrderRest = _objectWithoutProperties(_ref30, _excluded4);
1084
1122
  var submitType = type !== null && type !== void 0 ? type : tempOrder.type;
1085
1123
  if (!submitType) {
1086
1124
  var _tempOrder$bookings;
@@ -1105,7 +1143,7 @@ export function buildSubmitPayload(params) {
1105
1143
  type: submitType,
1106
1144
  business_code: businessCode !== null && businessCode !== void 0 ? businessCode : tempOrder.business_code,
1107
1145
  sales_channel: tempOrder.sales_channel || 'my_pisel',
1108
- order_sales_channel: (_ref30 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref30 !== void 0 ? _ref30 : 'online_store',
1146
+ order_sales_channel: (_ref31 = channel !== null && channel !== void 0 ? channel : tempOrder.order_sales_channel) !== null && _ref31 !== void 0 ? _ref31 : 'online_store',
1109
1147
  status: tempOrder.status || 'normal',
1110
1148
  payment_status: tempOrder.payment_status || 'payment_processing',
1111
1149
  // shipping_status: tempOrder.shipping_status || 'unfulfilled',
@@ -1131,10 +1169,10 @@ export function buildSubmitPayload(params) {
1131
1169
  // holder: tempOrder.holder || null,
1132
1170
  summary: summary || tempOrder.summary || createEmptySummary(),
1133
1171
  metadata: function () {
1134
- var _ref31 = tempOrder.metadata || {},
1135
- _collectPax = _ref31.collect_pax,
1136
- _tableOccupancyDuration = _ref31.table_occupancy_duration,
1137
- rest = _objectWithoutProperties(_ref31, _excluded5);
1172
+ var _ref32 = tempOrder.metadata || {},
1173
+ _collectPax = _ref32.collect_pax,
1174
+ _tableOccupancyDuration = _ref32.table_occupancy_duration,
1175
+ rest = _objectWithoutProperties(_ref32, _excluded5);
1138
1176
  return _objectSpread({}, rest);
1139
1177
  }(),
1140
1178
  products: (tempOrder.products || []).map(function (product) {
@@ -1342,8 +1380,8 @@ export function getRuntimeProductOrigin(tempOrder, product) {
1342
1380
  return tempOrder._extend.productsByUid[uid].origin;
1343
1381
  }
1344
1382
  var matchedProduct = ((tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.products) || []).find(function (item) {
1345
- var _ref32, _item$product_id, _ref33, _product$product_id;
1346
- return item === product || getOrderProductLineUid(item) === uid || String((_ref32 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref32 !== void 0 ? _ref32 : '') === String((_ref33 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref33 !== void 0 ? _ref33 : '');
1383
+ var _ref33, _item$product_id, _ref34, _product$product_id;
1384
+ return item === product || getOrderProductLineUid(item) === uid || String((_ref33 = (_item$product_id = item === null || item === void 0 ? void 0 : item.product_id) !== null && _item$product_id !== void 0 ? _item$product_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref33 !== void 0 ? _ref33 : '') === String((_ref34 = (_product$product_id = product === null || product === void 0 ? void 0 : product.product_id) !== null && _product$product_id !== void 0 ? _product$product_id : product === null || product === void 0 ? void 0 : product.id) !== null && _ref34 !== void 0 ? _ref34 : '');
1347
1385
  });
1348
1386
  var matchedUid = matchedProduct ? getOrderProductLineUid(matchedProduct) : '';
1349
1387
  return matchedUid ? (tempOrder === null || tempOrder === void 0 || (_tempOrder$_extend3 = tempOrder._extend) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3.productsByUid) === null || _tempOrder$_extend3 === void 0 || (_tempOrder$_extend3 = _tempOrder$_extend3[matchedUid]) === null || _tempOrder$_extend3 === void 0 ? void 0 : _tempOrder$_extend3.origin) || null : null;
@@ -1363,7 +1401,6 @@ export function productRequiresFormSubject(tempOrder, product) {
1363
1401
  }
1364
1402
  export function resolveIsFormSubject(tempOrder, product) {
1365
1403
  var _tempOrder$holder;
1366
- debugger;
1367
1404
  // 旧版预约维度的 holder 类型仍然生效;新版则从当前商品 holder_config 判断。
1368
1405
  if ((tempOrder === null || tempOrder === void 0 || (_tempOrder$holder = tempOrder.holder) === null || _tempOrder$holder === void 0 ? void 0 : _tempOrder$holder.type) === 'form') return true;
1369
1406
  if (product) return productRequiresFormSubject(tempOrder, product);
@@ -41,6 +41,10 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
41
41
  * paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
42
42
  */
43
43
  updateOtherParams(params: Record<string, any>): void;
44
+ /**
45
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
46
+ */
47
+ getPlatform(): string;
44
48
  private getPaymentNumberAppData;
45
49
  /**
46
50
  * 记录信息日志
@@ -231,6 +231,16 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
231
231
  value: function updateOtherParams(params) {
232
232
  this.otherParams = params || {};
233
233
  }
234
+
235
+ /**
236
+ * 获取标准化后的宿主平台标识,供支付子能力做平台边界判断。
237
+ */
238
+ }, {
239
+ key: "getPlatform",
240
+ value: function getPlatform() {
241
+ var _this$otherParams;
242
+ return String(((_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.platform) || '').trim().toLowerCase();
243
+ }
234
244
  }, {
235
245
  key: "getPaymentNumberAppData",
236
246
  value: function getPaymentNumberAppData(key) {
@@ -247,10 +257,10 @@ export var PaymentModule = /*#__PURE__*/function (_BaseModule) {
247
257
  }, {
248
258
  key: "logInfo",
249
259
  value: function logInfo(title, metadata) {
250
- var _this$otherParams;
251
- if ((_this$otherParams = this.otherParams) !== null && _this$otherParams !== void 0 && _this$otherParams.fatherModule) {
252
- var _this$otherParams2;
253
- var fatherModule = this.core.getModule((_this$otherParams2 = this.otherParams) === null || _this$otherParams2 === void 0 ? void 0 : _this$otherParams2.fatherModule);
260
+ var _this$otherParams2;
261
+ if ((_this$otherParams2 = this.otherParams) !== null && _this$otherParams2 !== void 0 && _this$otherParams2.fatherModule) {
262
+ var _this$otherParams3;
263
+ var fatherModule = this.core.getModule((_this$otherParams3 = this.otherParams) === null || _this$otherParams3 === void 0 ? void 0 : _this$otherParams3.fatherModule);
254
264
  if (fatherModule) {
255
265
  fatherModule.logInfo("".concat(title), metadata);
256
266
  return;
@@ -5,15 +5,15 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
5
5
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
11
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
12
  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."); }
10
13
  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); }
11
14
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
15
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
16
  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; }
14
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
17
  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; }
18
18
  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; }
19
19
  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; }
@@ -104,6 +104,26 @@ function mergeWalletAssets() {
104
104
  });
105
105
  return merged;
106
106
  }
107
+
108
+ /**
109
+ * 聚合接口不保证 recalculate_list 顺序;派生抵扣额依赖选择顺序,
110
+ * 因此已选资产必须先恢复为 selectedIds 的顺序再进入策略计算。
111
+ */
112
+ function orderWalletAssetsByIds(assets, orderedIds) {
113
+ var assetByKey = new Map(assets.map(function (asset) {
114
+ return [getWalletAssetKey(asset), asset];
115
+ }));
116
+ var orderedKeys = new Set(orderedIds.map(function (id) {
117
+ return String(id);
118
+ }));
119
+ return [].concat(_toConsumableArray(orderedIds.map(function (id) {
120
+ return assetByKey.get(String(id));
121
+ }).filter(function (asset) {
122
+ return asset !== undefined;
123
+ })), _toConsumableArray(assets.filter(function (asset) {
124
+ return !orderedKeys.has(getWalletAssetKey(asset));
125
+ })));
126
+ }
107
127
  function createInitialWalletAssetsState() {
108
128
  return {
109
129
  status: 'idle',
@@ -668,7 +688,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
668
688
  value: (function () {
669
689
  var _aggregateRecalculateWalletAssetsAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(businessData, selectedIds) {
670
690
  var _this$paymentModule$w7, _this$paymentModule$w8;
671
- var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
691
+ var walletParams, customerId, requestParams, response, responseData, hasAggregateLists, recalculateList, customerWalletPassList, orderedRecalculateList, allList, walletPassEvaluator, evaluated, returnedSelectedKeys, authoritativeSelectedIds;
672
692
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
673
693
  while (1) switch (_context4.prev = _context4.next) {
674
694
  case 0:
@@ -704,7 +724,8 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
704
724
  case 11:
705
725
  recalculateList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.recalculate_list) ? responseData.recalculate_list : [];
706
726
  customerWalletPassList = Array.isArray(responseData === null || responseData === void 0 ? void 0 : responseData.customer_wallet_pass_list) ? responseData.customer_wallet_pass_list : [];
707
- allList = mergeWalletAssets(recalculateList, customerWalletPassList);
727
+ orderedRecalculateList = orderWalletAssetsByIds(recalculateList, selectedIds);
728
+ allList = mergeWalletAssets(orderedRecalculateList, customerWalletPassList);
708
729
  walletPassEvaluator = (_this$paymentModule$w7 = this.paymentModule.window) === null || _this$paymentModule$w7 === void 0 || (_this$paymentModule$w8 = _this$paymentModule$w7.getWalletPassEvaluator) === null || _this$paymentModule$w8 === void 0 ? void 0 : _this$paymentModule$w8.call(_this$paymentModule$w7);
709
730
  evaluated = walletPassEvaluator !== null && walletPassEvaluator !== void 0 && walletPassEvaluator.getRecommendedVouchers ? walletPassEvaluator.getRecommendedVouchers({
710
731
  orderTotalAmount: walletParams.order_wait_pay_amount,
@@ -748,7 +769,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
748
769
  products: walletParams.products || [],
749
770
  authoritativeSelectedIds: authoritativeSelectedIds
750
771
  });
751
- case 24:
772
+ case 25:
752
773
  case "end":
753
774
  return _context4.stop();
754
775
  }
@@ -830,7 +851,7 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
830
851
  key: "getUserIdentificationCodeListAsync",
831
852
  value: function () {
832
853
  var _getUserIdentificationCodeListAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(params) {
833
- var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, response, sortedData;
854
+ var _newParams$products, _newParams$prepare_pa, _this$walletParams4, newParams, platform, response, sortedData;
834
855
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
835
856
  while (1) switch (_context6.prev = _context6.next) {
836
857
  case 0:
@@ -843,6 +864,20 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
843
864
  this.paymentModule.logInfo('[WalletPass] 商品列表为空,跳过获取用户识别码列表');
844
865
  return _context6.abrupt("return", []);
845
866
  case 5:
867
+ platform = this.paymentModule.getPlatform();
868
+ if (!(platform === 'pc' || platform === 'h5')) {
869
+ _context6.next = 11;
870
+ break;
871
+ }
872
+ this.userIdentificationCodes = [];
873
+ this.emitEvent(WalletPassHooks.OnUserIdentificationCodesUpdated, {
874
+ userIdentificationCodes: []
875
+ });
876
+ this.paymentModule.logInfo('[WalletPass] 用户端平台跳过获取用户识别码列表', {
877
+ platform: platform
878
+ });
879
+ return _context6.abrupt("return", []);
880
+ case 11:
846
881
  if (typeof newParams.payment_order_id === 'string' && newParams.payment_order_id.startsWith('LOCAL_')) {
847
882
  newParams.payment_order_id = undefined;
848
883
  }
@@ -853,9 +888,9 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
853
888
  filter_prepare_wallet_pass: newParams.filter_prepare_wallet_pass,
854
889
  payment_order_id: (_this$walletParams4 = this.walletParams) === null || _this$walletParams4 === void 0 ? void 0 : _this$walletParams4.payment_order_id
855
890
  });
856
- _context6.next = 9;
891
+ _context6.next = 15;
857
892
  return this.paymentModule.request.post('/machinecode/prepare/deduction', newParams);
858
- case 9:
893
+ case 15:
859
894
  response = _context6.sent;
860
895
  // 对获取到的数据进行排序,将错误码为 500100、500200、500300 的项目排到最后
861
896
  sortedData = sortUserIdentificationCodeList((response === null || response === void 0 ? void 0 : response.data) || []);
@@ -876,19 +911,19 @@ export var WalletPassPaymentImpl = /*#__PURE__*/function () {
876
911
  })
877
912
  });
878
913
  return _context6.abrupt("return", this.userIdentificationCodes);
879
- case 17:
880
- _context6.prev = 17;
914
+ case 23:
915
+ _context6.prev = 23;
881
916
  _context6.t0 = _context6["catch"](0);
882
917
  this.paymentModule.logError('[WalletPass] 获取用户识别码列表失败', _context6.t0, {
883
918
  customer_id: params.customer_id,
884
919
  available: params.available
885
920
  });
886
921
  return _context6.abrupt("return", []);
887
- case 21:
922
+ case 27:
888
923
  case "end":
889
924
  return _context6.stop();
890
925
  }
891
- }, _callee6, this, [[0, 17]]);
926
+ }, _callee6, this, [[0, 23]]);
892
927
  }));
893
928
  function getUserIdentificationCodeListAsync(_x7) {
894
929
  return _getUserIdentificationCodeListAsync.apply(this, arguments);
@@ -193,6 +193,7 @@ export interface ProductData {
193
193
  status?: string;
194
194
  required?: number | string | boolean;
195
195
  resource_id?: number | string | null;
196
+ [key: string]: any;
196
197
  };
197
198
  /** 组合商品id,动态附加 */
198
199
  product_variant_id?: number;
@@ -157,6 +157,10 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
157
157
  userPlugin,
158
158
  customer_id,
159
159
  _userPlugin$get,
160
+ channelMap,
161
+ rawApplicationCode,
162
+ mappedApplicationCode,
163
+ queryPayload,
160
164
  productsData,
161
165
  sortedList,
162
166
  _args4 = arguments;
@@ -185,37 +189,53 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
185
189
  console.error(error);
186
190
  }
187
191
  // 如果没传schedule_date,则从
188
- _context4.next = 7;
189
- return this.request.post("/product/query", {
192
+ channelMap = {
193
+ online_store: 'online-store',
194
+ scan_to_order: 'online-store',
195
+ 'scan-to-order': 'online-store',
196
+ scan_to_order_2: 'mobile_order',
197
+ scan_to_order_3: 'scantoorder3'
198
+ };
199
+ rawApplicationCode = (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel;
200
+ mappedApplicationCode = typeof rawApplicationCode === 'string' ? channelMap[rawApplicationCode] || rawApplicationCode : rawApplicationCode;
201
+ queryPayload = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
190
202
  open_quotation: 1,
191
203
  open_bundle: 0,
192
204
  exclude_extension_type: ['product_party', 'product_event', 'product_series_event', 'product_package_ticket', 'ticket', 'event_item'],
193
- with: ['category', 'collection', 'resourceRelation'],
205
+ with: ['category', 'collection', 'resourceRelation', 'bundleGroup.bundleItem', 'optionGroup.optionItem', 'variantGroup.variantItem', 'dataVariants'],
194
206
  status: status,
195
207
  num: 500,
196
208
  skip: 1,
197
- customer_id: customer_id,
198
- category_ids: category_ids,
199
- ids: product_ids,
200
- collection: collection,
201
- front_end_cache_id: cacheId,
202
- menu_list_ids: menu_list_ids,
209
+ customer_id: customer_id
210
+ }, Array.isArray(category_ids) && category_ids.length ? {
211
+ category_ids: category_ids
212
+ } : {}), Array.isArray(product_ids) && product_ids.length ? {
213
+ ids: product_ids
214
+ } : {}), Array.isArray(collection) && collection.length ? {
215
+ collection: collection
216
+ } : {}), {}, {
217
+ front_end_cache_id: cacheId
218
+ }, Array.isArray(menu_list_ids) && menu_list_ids.length ? {
219
+ menu_list_ids: menu_list_ids
220
+ } : {}), {}, {
203
221
  with_count: with_count,
204
222
  // client_schedule_ids: schedule_ids,
205
223
  schedule_date: schedule_date,
206
- application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
224
+ application_code: mappedApplicationCode,
207
225
  is_eject: 1,
208
226
  with_schedule: with_schedule,
209
227
  schedule_datetime: schedule_datetime,
210
228
  extension_type: extension_type,
211
229
  strategy_context: strategy_context
212
- }, {
230
+ });
231
+ _context4.next = 11;
232
+ return this.request.post("/product/query", queryPayload, {
213
233
  osServer: true,
214
234
  callback: options === null || options === void 0 ? void 0 : options.callback,
215
235
  subscriberId: options === null || options === void 0 ? void 0 : options.subscriberId,
216
236
  customToast: function customToast() {}
217
237
  });
218
- case 7:
238
+ case 11:
219
239
  productsData = _context4.sent;
220
240
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
221
241
  return Number(b.sort) - Number(a.sort);
@@ -228,7 +248,7 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
228
248
  // }
229
249
  this.addProduct(sortedList);
230
250
  return _context4.abrupt("return", sortedList);
231
- case 11:
251
+ case 15:
232
252
  case "end":
233
253
  return _context4.stop();
234
254
  }
@@ -21,7 +21,7 @@ export declare class QuotationModule extends BaseModule implements Module {
21
21
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
22
22
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
23
23
  *
24
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
24
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
25
25
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
26
26
  * the requested productId wins.
27
27
  */
@@ -90,7 +90,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
90
90
  res = _context2.sent;
91
91
  list = (res === null || res === void 0 || (_data = res.data) === null || _data === void 0 ? void 0 : _data.list) || (res === null || res === void 0 ? void 0 : res.list) || [];
92
92
  list.sort(function (a, b) {
93
- return a.sort - b.sort;
93
+ return b.sort - a.sort;
94
94
  });
95
95
  this.store.list = list;
96
96
  case 9:
@@ -151,7 +151,7 @@ export var QuotationModule = /*#__PURE__*/function (_BaseModule) {
151
151
  * Look up the quotation price for a specific product (+ optional variant) at a given datetime.
152
152
  * Returns the price as a string (e.g. "300.00"), or null if no quotation applies.
153
153
  *
154
- * Priority: iterates quotations already sorted by `sort` ascending (lowest = highest priority).
154
+ * Priority: iterates quotations already sorted by `sort` descending (highest = highest priority).
155
155
  * First matching quotation whose schedule covers `datetime` and whose product_data contains
156
156
  * the requested productId wins.
157
157
  */
@@ -0,0 +1,24 @@
1
+ import { BaseModule } from '../BaseModule';
2
+ import type { Module, ModuleOptions, PisellCore } from '../../types';
3
+ import type { ResourcePlannerAssignmentResult, ResourcePlannerAssignableSlotResult, ResourcePlannerContextInput, ResourcePlannerProjection, ResourcePlannerQuery, ResourcePlannerSelectionPatch, ResourcePlannerSnapshot, ResourcePlannerValidationResult } from './types';
4
+ export * from './types';
5
+ export * from './planner';
6
+ export declare enum ResourcePlannerHooks {
7
+ onContextChanged = "resourcePlanner:onContextChanged",
8
+ onSelectionChanged = "resourcePlanner:onSelectionChanged",
9
+ onProjectionChanged = "resourcePlanner:onProjectionChanged"
10
+ }
11
+ export declare class ResourcePlannerModule extends BaseModule implements Module {
12
+ protected defaultName: string;
13
+ protected defaultVersion: string;
14
+ private store;
15
+ initialize(core: PisellCore, options: ModuleOptions): Promise<void>;
16
+ setContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
17
+ mergeContext(input: ResourcePlannerContextInput): ResourcePlannerSnapshot;
18
+ setSelectionPatch(patch: ResourcePlannerSelectionPatch): ResourcePlannerSnapshot;
19
+ queryAvailability(query?: ResourcePlannerQuery): ResourcePlannerProjection;
20
+ autoAssign(query?: ResourcePlannerQuery): ResourcePlannerAssignmentResult;
21
+ resolveAssignableSlots(query?: ResourcePlannerQuery): ResourcePlannerAssignableSlotResult;
22
+ validateSelection(): ResourcePlannerValidationResult;
23
+ getSnapshot(): ResourcePlannerSnapshot;
24
+ }