@pisell/pisellos 2.2.181 → 2.2.183

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/modules/BookingContext/index.d.ts +37 -0
  2. package/dist/modules/BookingContext/index.js +436 -0
  3. package/dist/modules/BookingContext/types.d.ts +102 -0
  4. package/dist/modules/BookingContext/types.js +51 -0
  5. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  6. package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +276 -0
  7. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  8. package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +137 -0
  9. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  10. package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +215 -0
  11. package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
  12. package/dist/modules/BookingContext/utils/flexible.js +56 -0
  13. package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  14. package/dist/modules/BookingContext/utils/formatResourceList.js +38 -0
  15. package/dist/modules/BookingContext/utils/index.d.ts +11 -0
  16. package/dist/modules/BookingContext/utils/index.js +11 -0
  17. package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
  18. package/dist/modules/BookingContext/utils/noResource.js +77 -0
  19. package/dist/modules/BookingContext/utils/productExtend.d.ts +72 -0
  20. package/dist/modules/BookingContext/utils/productExtend.js +339 -0
  21. package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  22. package/dist/modules/BookingContext/utils/resourceErrors.js +74 -0
  23. package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  24. package/dist/modules/BookingContext/utils/resourceSelection.js +24 -0
  25. package/dist/modules/BookingContext/utils/resources.d.ts +80 -0
  26. package/dist/modules/BookingContext/utils/resources.js +486 -0
  27. package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  28. package/dist/modules/BookingContext/utils/serviceTimes.js +151 -0
  29. package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  30. package/dist/modules/BookingContext/utils/timeSlices.js +100 -0
  31. package/dist/modules/Customer/index.d.ts +6 -0
  32. package/dist/modules/Customer/index.js +129 -83
  33. package/dist/modules/Customer/types.d.ts +2 -0
  34. package/dist/modules/Discount/index.js +4 -3
  35. package/dist/modules/Discount/types.d.ts +1 -0
  36. package/dist/modules/Order/index.d.ts +100 -9
  37. package/dist/modules/Order/index.js +1447 -499
  38. package/dist/modules/Order/types.d.ts +201 -18
  39. package/dist/modules/Order/types.js +31 -0
  40. package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  41. package/dist/modules/Order/utils/manualProductDiscount.js +210 -0
  42. package/dist/modules/Order/utils.d.ts +83 -1
  43. package/dist/modules/Order/utils.js +405 -61
  44. package/dist/modules/Product/index.d.ts +1 -1
  45. package/dist/modules/Quotation/index.d.ts +0 -1
  46. package/dist/modules/Quotation/index.js +23 -21
  47. package/dist/modules/Rules/index.d.ts +4 -0
  48. package/dist/modules/Rules/index.js +43 -39
  49. package/dist/modules/Rules/types.d.ts +1 -0
  50. package/dist/modules/SalesSummary/index.js +4 -2
  51. package/dist/modules/SalesSummary/utils.js +21 -7
  52. package/dist/modules/Schedule/index.js +6 -2
  53. package/dist/modules/index.d.ts +1 -0
  54. package/dist/modules/index.js +2 -1
  55. package/dist/server/index.js +87 -29
  56. package/dist/server/modules/order/index.d.ts +23 -0
  57. package/dist/server/modules/order/index.js +123 -46
  58. package/dist/server/modules/order/utils/filterOrders.js +20 -6
  59. package/dist/server/modules/products/index.d.ts +1 -1
  60. package/dist/server/modules/products/index.js +130 -113
  61. package/dist/server/modules/schedule/index.js +13 -6
  62. package/dist/solution/BaseSales/index.d.ts +89 -7
  63. package/dist/solution/BaseSales/index.js +1504 -380
  64. package/dist/solution/BaseSales/types.d.ts +67 -1
  65. package/dist/solution/BaseSales/types.js +3 -1
  66. package/dist/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
  67. package/dist/solution/BaseSales/utils/cartPromotion.js +1258 -0
  68. package/dist/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  69. package/dist/solution/BaseSales/utils/quotationPrice.js +237 -0
  70. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +68 -16
  71. package/dist/solution/BaseSales/utils.js +46 -8
  72. package/dist/solution/BookingByStep/index.d.ts +1 -1
  73. package/dist/solution/BookingTicket/index.d.ts +151 -1
  74. package/dist/solution/BookingTicket/index.js +848 -184
  75. package/dist/solution/BookingTicket/types.d.ts +2 -0
  76. package/dist/solution/BookingTicket/types.js +3 -0
  77. package/dist/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  78. package/dist/solution/BookingTicket/utils/addProductDecision.js +346 -0
  79. package/dist/solution/BookingTicket/utils/cartView.js +4 -2
  80. package/dist/solution/ScanOrder/index.d.ts +9 -3
  81. package/dist/solution/ScanOrder/index.js +231 -128
  82. package/dist/solution/ScanOrder/utils.js +46 -8
  83. package/dist/solution/VenueBooking/index.d.ts +5 -2
  84. package/dist/solution/VenueBooking/index.js +103 -55
  85. package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  86. package/dist/solution/VenueBooking/utils/slotMerge.js +10 -0
  87. package/lib/modules/BookingContext/index.d.ts +37 -0
  88. package/lib/modules/BookingContext/index.js +297 -0
  89. package/lib/modules/BookingContext/types.d.ts +102 -0
  90. package/lib/modules/BookingContext/types.js +34 -0
  91. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.d.ts +16 -0
  92. package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +271 -0
  93. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.d.ts +8 -0
  94. package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +141 -0
  95. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +75 -0
  96. package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +198 -0
  97. package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
  98. package/lib/modules/BookingContext/utils/flexible.js +80 -0
  99. package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
  100. package/lib/modules/BookingContext/utils/formatResourceList.js +50 -0
  101. package/lib/modules/BookingContext/utils/index.d.ts +11 -0
  102. package/lib/modules/BookingContext/utils/index.js +43 -0
  103. package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
  104. package/lib/modules/BookingContext/utils/noResource.js +90 -0
  105. package/lib/modules/BookingContext/utils/productExtend.d.ts +72 -0
  106. package/lib/modules/BookingContext/utils/productExtend.js +283 -0
  107. package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
  108. package/lib/modules/BookingContext/utils/resourceErrors.js +80 -0
  109. package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
  110. package/lib/modules/BookingContext/utils/resourceSelection.js +46 -0
  111. package/lib/modules/BookingContext/utils/resources.d.ts +80 -0
  112. package/lib/modules/BookingContext/utils/resources.js +377 -0
  113. package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
  114. package/lib/modules/BookingContext/utils/serviceTimes.js +162 -0
  115. package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
  116. package/lib/modules/BookingContext/utils/timeSlices.js +124 -0
  117. package/lib/modules/Customer/index.d.ts +6 -0
  118. package/lib/modules/Customer/index.js +26 -11
  119. package/lib/modules/Customer/types.d.ts +2 -0
  120. package/lib/modules/Discount/index.js +5 -1
  121. package/lib/modules/Discount/types.d.ts +1 -0
  122. package/lib/modules/Order/index.d.ts +100 -9
  123. package/lib/modules/Order/index.js +751 -160
  124. package/lib/modules/Order/types.d.ts +201 -18
  125. package/lib/modules/Order/types.js +1 -0
  126. package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
  127. package/lib/modules/Order/utils/manualProductDiscount.js +206 -0
  128. package/lib/modules/Order/utils.d.ts +83 -1
  129. package/lib/modules/Order/utils.js +340 -22
  130. package/lib/modules/Product/index.d.ts +1 -1
  131. package/lib/modules/Quotation/index.d.ts +0 -1
  132. package/lib/modules/Quotation/index.js +18 -15
  133. package/lib/modules/Rules/index.d.ts +4 -0
  134. package/lib/modules/Rules/index.js +26 -27
  135. package/lib/modules/Rules/types.d.ts +1 -0
  136. package/lib/modules/SalesSummary/index.js +4 -2
  137. package/lib/modules/SalesSummary/utils.js +21 -7
  138. package/lib/modules/Schedule/index.js +3 -1
  139. package/lib/modules/index.d.ts +1 -0
  140. package/lib/modules/index.js +3 -1
  141. package/lib/server/index.js +41 -4
  142. package/lib/server/modules/order/index.d.ts +23 -0
  143. package/lib/server/modules/order/index.js +46 -14
  144. package/lib/server/modules/order/utils/filterOrders.js +12 -4
  145. package/lib/server/modules/products/index.d.ts +1 -1
  146. package/lib/server/modules/products/index.js +30 -20
  147. package/lib/server/modules/schedule/index.js +2 -1
  148. package/lib/solution/BaseSales/index.d.ts +89 -7
  149. package/lib/solution/BaseSales/index.js +743 -23
  150. package/lib/solution/BaseSales/types.d.ts +67 -1
  151. package/lib/solution/BaseSales/types.js +3 -1
  152. package/lib/solution/BaseSales/utils/cartPromotion.d.ts +275 -0
  153. package/lib/solution/BaseSales/utils/cartPromotion.js +836 -0
  154. package/lib/solution/BaseSales/utils/quotationPrice.d.ts +7 -0
  155. package/lib/solution/BaseSales/utils/quotationPrice.js +277 -0
  156. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +71 -12
  157. package/lib/solution/BaseSales/utils.js +46 -6
  158. package/lib/solution/BookingByStep/index.d.ts +1 -1
  159. package/lib/solution/BookingTicket/index.d.ts +151 -1
  160. package/lib/solution/BookingTicket/index.js +389 -9
  161. package/lib/solution/BookingTicket/types.d.ts +2 -0
  162. package/lib/solution/BookingTicket/types.js +6 -0
  163. package/lib/solution/BookingTicket/utils/addProductDecision.d.ts +113 -0
  164. package/lib/solution/BookingTicket/utils/addProductDecision.js +318 -0
  165. package/lib/solution/BookingTicket/utils/cartView.js +4 -2
  166. package/lib/solution/ScanOrder/index.d.ts +9 -3
  167. package/lib/solution/ScanOrder/index.js +147 -66
  168. package/lib/solution/ScanOrder/utils.js +46 -6
  169. package/lib/solution/VenueBooking/index.d.ts +5 -2
  170. package/lib/solution/VenueBooking/index.js +50 -14
  171. package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -0
  172. package/lib/solution/VenueBooking/utils/slotMerge.js +10 -0
  173. package/package.json +1 -1
@@ -43,8 +43,6 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
43
43
  const query = {};
44
44
  if (params == null ? void 0 : params.channel)
45
45
  query.channel = params.channel;
46
- if (params == null ? void 0 : params.customer_id)
47
- query.customer_id = String(params.customer_id);
48
46
  if ((params == null ? void 0 : params.channel) === "online_store") {
49
47
  query.channel = "online-store";
50
48
  }
@@ -53,10 +51,7 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
53
51
  query,
54
52
  { useCache: false }
55
53
  );
56
- const list = this.filterQuotationsByCustomer(
57
- ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [],
58
- params == null ? void 0 : params.customer_id
59
- );
54
+ const list = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || (res == null ? void 0 : res.list) || [];
60
55
  list.sort((a, b) => a.sort - b.sort);
61
56
  this.store.list = list;
62
57
  }
@@ -74,9 +69,11 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
74
69
  getPriceForProduct(params) {
75
70
  const { productId, variantId, datetime, customer_id } = params;
76
71
  for (const quotation of this.store.list) {
77
- if (!this.isQuotationVisibleForCustomer(quotation, customer_id))
72
+ const visible = this.isQuotationVisibleForCustomer(quotation, customer_id);
73
+ if (!visible)
78
74
  continue;
79
- if (!this.isQuotationActiveAt(quotation, datetime))
75
+ const active = this.isQuotationActiveAt(quotation, datetime);
76
+ if (!active)
80
77
  continue;
81
78
  const match = this.findProductData(quotation.product_data, productId, variantId);
82
79
  if (!match)
@@ -128,9 +125,6 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
128
125
  setScheduleResolver(resolver) {
129
126
  this.scheduleResolver = resolver;
130
127
  }
131
- filterQuotationsByCustomer(list, customerId) {
132
- return list.filter((quotation) => this.isQuotationVisibleForCustomer(quotation, customerId));
133
- }
134
128
  isQuotationVisibleForCustomer(quotation, customerId) {
135
129
  const customers = quotation.customer || [];
136
130
  if (customers.length === 0)
@@ -148,18 +142,27 @@ var QuotationModule = class extends import_BaseModule.BaseModule {
148
142
  var _a;
149
143
  if (!((_a = quotation.schedule) == null ? void 0 : _a.length))
150
144
  return false;
151
- const scheduleItems = quotation.schedule.map((s) => {
145
+ const scheduleItems = [];
146
+ quotation.schedule.forEach((s) => {
152
147
  var _a2;
153
148
  const full = (_a2 = this.scheduleResolver) == null ? void 0 : _a2.call(this, s.id);
154
- if (full)
155
- return full;
156
- return {
149
+ if (full) {
150
+ scheduleItems.push(full);
151
+ return;
152
+ }
153
+ if (this.scheduleResolver) {
154
+ return;
155
+ }
156
+ const fallbackSchedule = {
157
157
  ...s,
158
158
  repeat_type: s.repeat_type || "none",
159
159
  repeat_rule: s.repeat_rule || null,
160
160
  time_slot: s.time_slot || []
161
161
  };
162
+ scheduleItems.push(fallbackSchedule);
162
163
  });
164
+ if (!scheduleItems.length)
165
+ return false;
163
166
  return (0, import_getDateIsInSchedule.getDateIsInSchedule)(datetime, scheduleItems);
164
167
  }
165
168
  findProductData(productData, productId, variantId) {
@@ -32,6 +32,10 @@ export declare class RulesModule extends BaseModule implements Module, RulesModu
32
32
  unavailableReason?: UnavailableReason;
33
33
  };
34
34
  filterDiscountListByType(discountList: Discount[], type: string): Discount[];
35
+ /** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
36
+ excludeDiscountListByType(discountList: Discount[], type: string): Discount[];
37
+ /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
38
+ resolveDiscountListForManualOverride(discountList: Discount[]): Discount[];
35
39
  private getUnavailableReason;
36
40
  calcDiscount({ discountList, productList, holders, isFormSubject, orderTotalAmount }: {
37
41
  discountList: Discount[];
@@ -159,6 +159,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
159
159
  filterDiscountListByType(discountList, type) {
160
160
  return (discountList || []).filter((item) => item.type === type || item.tag === type);
161
161
  }
162
+ /** 剔除指定 type/tag 的折扣项,保留手动改价(type=product) / 券等 */
163
+ excludeDiscountListByType(discountList, type) {
164
+ return (discountList || []).filter((item) => item.type !== type && item.tag !== type);
165
+ }
166
+ /** 手动改价场景:去掉 promotion,保留 type=product 等行内折扣 */
167
+ resolveDiscountListForManualOverride(discountList) {
168
+ return this.excludeDiscountListByType(discountList, "promotion");
169
+ }
162
170
  // 获取券不可用的原因
163
171
  getUnavailableReason(discountList, productList) {
164
172
  var _a;
@@ -507,7 +515,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
507
515
  }
508
516
  }
509
517
  });
510
- console.log("occupiedItems", occupiedItems, "orderLevelDiscountApplicableItems", orderLevelDiscountApplicableItems);
511
518
  sortedDiscountList.forEach((discount) => {
512
519
  if (!(0, import_utils3.isOrderLevelFixedAmountDiscount)(discount)) {
513
520
  return;
@@ -673,7 +680,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
673
680
  }, 0);
674
681
  };
675
682
  sortedFlattenedList.forEach((flatItem, index) => {
676
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
683
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G;
677
684
  let product, originProduct;
678
685
  if (flatItem.type === "main") {
679
686
  product = flatItem.product;
@@ -896,7 +903,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
896
903
  price: product.price,
897
904
  options: restoredOptions
898
905
  },
899
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
906
+ discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(product.discount_list) : this.filterDiscountListByType(product.discount_list, "promotion")
900
907
  })
901
908
  ]);
902
909
  } else {
@@ -918,14 +925,14 @@ var RulesModule = class extends import_BaseModule.BaseModule {
918
925
  main_product_selling_price,
919
926
  options: restoredOptions
920
927
  },
921
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion")
928
+ discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(product.discount_list) : this.filterDiscountListByType(product.discount_list, "promotion")
922
929
  })
923
930
  ]);
924
931
  }
925
932
  } else {
926
933
  processedFlatItemsMap.set(flatItem._id, [{
927
934
  ...flatItem,
928
- discount_list: this.filterDiscountListByType(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || [], "promotion"),
935
+ discount_list: isManualDiscount ? this.resolveDiscountListForManualOverride(((_v = flatItem.bundleItem) == null ? void 0 : _v.discount_list) || []) : this.filterDiscountListByType(((_w = flatItem.bundleItem) == null ? void 0 : _w.discount_list) || [], "promotion"),
929
936
  price: isManualDiscount ? flatItem.bundleItem.price : flatItem.bundleItem.original_price,
930
937
  processed: true
931
938
  }]);
@@ -976,13 +983,13 @@ var RulesModule = class extends import_BaseModule.BaseModule {
976
983
  if (this.filterDiscountListByType(product.discount_list, "promotion").length && product.origin_total) {
977
984
  productOriginTotal = product.origin_total;
978
985
  }
979
- if (Number(((_w = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _w.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
986
+ if (Number(((_x = originProduct == null ? void 0 : originProduct._productInit) == null ? void 0 : _x.original_price) || 0) > 0 && product.origin_total && product.total && product.origin_total !== product.total) {
980
987
  productOriginTotal = product.total;
981
988
  }
982
989
  const isOrderLevel = (0, import_utils3.isOrderLevelFixedAmountDiscount)(selectedDiscount2);
983
990
  const orderLevelAllocation = isOrderLevel ? orderLevelDiscountAllocations.get(selectedDiscount2.id) : null;
984
991
  const productAllocation = orderLevelAllocation == null ? void 0 : orderLevelAllocation.get(flatItem._id);
985
- const isDeductOptionPrice = !!((_x = selectedDiscount2.config) == null ? void 0 : _x.deductOptionPrice);
992
+ const isDeductOptionPrice = !!((_y = selectedDiscount2.config) == null ? void 0 : _y.deductOptionPrice);
986
993
  let mainProductSellingPrice;
987
994
  let amount;
988
995
  let productDiscountDifference;
@@ -1000,7 +1007,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1000
1007
  );
1001
1008
  amount = new import_decimal.default(product.price).minus(new import_decimal.default(mainProductSellingPrice)).toNumber();
1002
1009
  }
1003
- if (isDeductOptionPrice && ((_y = product.options) == null ? void 0 : _y.length)) {
1010
+ if (isDeductOptionPrice && ((_z = product.options) == null ? void 0 : _z.length)) {
1004
1011
  const optionResult = applyDiscountToOptions(
1005
1012
  product.options,
1006
1013
  selectedDiscount2
@@ -1008,7 +1015,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1008
1015
  discountedOptions = optionResult.discountedOptions;
1009
1016
  optionDiscountAmount = optionResult.optionDiscountAmount;
1010
1017
  }
1011
- const optionsForLineTotal = isDeductOptionPrice && ((_z = product.options) == null ? void 0 : _z.length) ? discountedOptions : product.options;
1018
+ const optionsForLineTotal = isDeductOptionPrice && ((_A = product.options) == null ? void 0 : _A.length) ? discountedOptions : product.options;
1012
1019
  const optionsLineTotal = getOptionTotal(optionsForLineTotal || []);
1013
1020
  const total = new import_decimal.default(mainProductSellingPrice).plus(optionsLineTotal).toNumber();
1014
1021
  const mainProductDiscountAmount = amount;
@@ -1019,9 +1026,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1019
1026
  amount: lineDiscountAmount,
1020
1027
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : discountType,
1021
1028
  discount: {
1022
- discount_card_type: (_A = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _A.discount_card_type,
1029
+ discount_card_type: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_card_type,
1023
1030
  fixed_amount: lineDiscountAmount,
1024
- discount_calculation_mode: (_B = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _B.discount_calculation_mode,
1031
+ discount_calculation_mode: (_C = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _C.discount_calculation_mode,
1025
1032
  resource_id: selectedDiscount2.id,
1026
1033
  title: selectedDiscount2.format_title,
1027
1034
  original_amount: product.price,
@@ -1103,7 +1110,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1103
1110
  type: "good_pass",
1104
1111
  discount: {
1105
1112
  fixed_amount: product.origin_total,
1106
- discount_calculation_mode: (_C = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _C.discount_calculation_mode,
1113
+ discount_calculation_mode: (_D = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _D.discount_calculation_mode,
1107
1114
  resource_id: selectedDiscount2.id,
1108
1115
  title: selectedDiscount2.format_title,
1109
1116
  original_amount: product.origin_total,
@@ -1177,9 +1184,9 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1177
1184
  amount: fixedAmountPerItem * (product.num || 1),
1178
1185
  type: selectedDiscount2.tag === "product_discount_card" ? "discount_card" : selectedDiscount2.tag,
1179
1186
  discount: {
1180
- discount_card_type: (_D = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _D.discount_card_type,
1187
+ discount_card_type: (_E = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _E.discount_card_type,
1181
1188
  fixed_amount: fixedAmountPerItem,
1182
- discount_calculation_mode: (_E = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _E.discount_calculation_mode,
1189
+ discount_calculation_mode: (_F = selectedDiscount2 == null ? void 0 : selectedDiscount2.metadata) == null ? void 0 : _F.discount_calculation_mode,
1183
1190
  resource_id: selectedDiscount2.id,
1184
1191
  title: selectedDiscount2.format_title,
1185
1192
  original_amount: product.original_price,
@@ -1195,7 +1202,7 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1195
1202
  ...productDiscountDifference !== void 0 && { product_discount_difference: productDiscountDifference }
1196
1203
  },
1197
1204
  config: selectedDiscount2 == null ? void 0 : selectedDiscount2.config,
1198
- _num: (product.num || 1) * (((_F = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _F.num) || 1)
1205
+ _num: (product.num || 1) * (((_G = flatItem == null ? void 0 : flatItem.parentProduct) == null ? void 0 : _G.num) || 1)
1199
1206
  };
1200
1207
  const appliedProducts = appliedDiscountProducts.get(selectedDiscount2.id) || [];
1201
1208
  appliedProducts.push(discountDetail);
@@ -1509,25 +1516,18 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1509
1516
  }
1510
1517
  });
1511
1518
  }
1512
- let newTotal = Number(mainProductData.price || 0);
1519
+ const mainSellingPrice = mainProductData.main_product_selling_price ?? mainProductData.price ?? 0;
1520
+ let newTotal = Number(mainSellingPrice || 0);
1513
1521
  let newOriginTotal = Number(mainProductData.original_price || mainProductData.price || 0);
1514
1522
  const isManualDiscount = typeof mainProductData.isManualDiscount === "boolean" ? mainProductData.isManualDiscount : mainProductData.total != mainProductData.origin_total && (!((_a = mainProductData.discount_list) == null ? void 0 : _a.length) || ((_c = (_b = mainProductData == null ? void 0 : mainProductData.discount_list) == null ? void 0 : _b.every) == null ? void 0 : _c.call(_b, (item) => item.type === "product")));
1515
1523
  if (isManualDiscount) {
1516
1524
  newTotal = mainProductData.total ?? newTotal;
1517
1525
  newOriginTotal = mainProductData.origin_total ?? newOriginTotal;
1518
1526
  } else {
1519
- const mainDiscountList = mainProductData.discount_list.filter((item) => {
1520
- var _a2;
1521
- return !((_a2 = item == null ? void 0 : item.metadata) == null ? void 0 : _a2.custom_product_bundle_map_id);
1522
- });
1523
- if (mainDiscountList && mainDiscountList.length > 0) {
1524
- const allDiscountAmount = (0, import_utils.getDiscountListAmount)(mainDiscountList);
1525
- newTotal = new import_decimal.default(mainProductData.price || 0).minus(allDiscountAmount).toNumber() ?? newTotal;
1526
- newOriginTotal = mainProductData.origin_total ?? newOriginTotal;
1527
- }
1528
1527
  if (newBundle.length > 0) {
1529
1528
  newBundle.forEach((item) => {
1530
- newTotal += Number(item.price) * Number(item.num);
1529
+ const bundleSellingPrice = item.bundle_selling_price ?? item.price;
1530
+ newTotal += Number(bundleSellingPrice) * Number(item.num);
1531
1531
  });
1532
1532
  newBundle.forEach((item) => {
1533
1533
  var _a2, _b2, _c2;
@@ -1618,7 +1618,6 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1618
1618
  appliedProductDetails: []
1619
1619
  };
1620
1620
  });
1621
- console.log(processedProductList, "processedProductList");
1622
1621
  return {
1623
1622
  productList: processedProductList,
1624
1623
  discountList: [...editModeDiscount, ...updatedDiscountList]
@@ -53,6 +53,7 @@ type ProductDetail = {
53
53
  vouchersApplicable?: boolean;
54
54
  holder_id?: number;
55
55
  startDate?: any;
56
+ main_product_selling_price?: number | string;
56
57
  };
57
58
  export interface RulesParamsHooks {
58
59
  getProduct: (product: Record<string, any>) => ProductDetail;
@@ -30,7 +30,8 @@ __reExport(SalesSummary_exports, require("./types"), module.exports);
30
30
  var salesSummaryDataKeys = {
31
31
  isPriceIncludeTax: "is_price_include_tax",
32
32
  taxRate: "tax_rate",
33
- taxTitle: "tax_title"
33
+ taxTitle: "tax_title",
34
+ taxCountryCode: "tax_country_code"
34
35
  };
35
36
  var SalesSummaryModule = class extends import_BaseModule.BaseModule {
36
37
  constructor(name, version) {
@@ -84,7 +85,8 @@ var SalesSummaryModule = class extends import_BaseModule.BaseModule {
84
85
  return {
85
86
  isPriceIncludeTax: this.getAppData(salesSummaryDataKeys.isPriceIncludeTax),
86
87
  taxRate: this.getAppData(salesSummaryDataKeys.taxRate),
87
- taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle)
88
+ taxTitle: this.getAppData(salesSummaryDataKeys.taxTitle),
89
+ taxCountryCode: this.getAppData(salesSummaryDataKeys.taxCountryCode)
88
90
  };
89
91
  }
90
92
  async getSummary(params) {
@@ -236,6 +236,7 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
236
236
  isChargeTax: product.is_charge_tax ?? 0
237
237
  });
238
238
  const mainTaxRounded = mainTaxPrecise.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
239
+ product.main_product_attached_bundle_tax_fee = mainTaxRounded.toFixed(2);
239
240
  if (mainTaxPrecise.gt(0)) {
240
241
  lastTaxableItem = { type: "main", item: product };
241
242
  }
@@ -258,15 +259,16 @@ function calculateProductsTax(products, taxRate, isPriceIncludeTax) {
258
259
  const bundleQuantity = new import_decimal.default(getSafeNum(bundleItem.num ?? bundleItem.quantity));
259
260
  const bundlePrice = toDecimal(bundleItem.bundle_selling_price ?? bundleItem.price ?? 0);
260
261
  const bundleOriginalPrice = toDecimal(bundleItem.original_price ?? bundleItem.product_price ?? bundleItem.price ?? 0);
262
+ const bundleSurchargeFee = toDecimal(bundleItem.surcharge_fee);
261
263
  const bundleTaxPrecise = calculateSingleItemTax({
262
- price: bundlePrice,
264
+ price: bundlePrice.plus(bundleSurchargeFee),
263
265
  taxRate: rate,
264
266
  isPriceIncludeTax,
265
267
  isChargeTax: bundleItem.is_charge_tax ?? product.is_charge_tax ?? 0
266
268
  });
267
269
  const bundleTaxRounded = bundleTaxPrecise.toDecimalPlaces(2, import_decimal.default.ROUND_HALF_UP);
268
270
  const bundleOrigTaxPrecise = calculateSingleItemTax({
269
- price: bundleOriginalPrice,
271
+ price: bundleOriginalPrice.plus(bundleSurchargeFee),
270
272
  taxRate: rate,
271
273
  isPriceIncludeTax,
272
274
  isChargeTax: bundleItem.is_charge_tax ?? product.is_charge_tax ?? 0
@@ -332,7 +334,6 @@ function createEmptySalesSummary() {
332
334
  };
333
335
  }
334
336
  function calculateSalesSummary(params) {
335
- var _a;
336
337
  const {
337
338
  products,
338
339
  isPriceIncludeTax,
@@ -379,7 +380,20 @@ function calculateSalesSummary(params) {
379
380
  ) || 0
380
381
  );
381
382
  for (let i = 0; i < products.length; i++) {
382
- products[i].surcharge_fee = ((_a = surchargeServiceItems[i]) == null ? void 0 : _a.surcharge_fee) || 0;
383
+ const sourceItem = surchargeServiceItems[i] || {};
384
+ const product = products[i];
385
+ product.surcharge_fee = sourceItem.surcharge_fee || 0;
386
+ const relationSurchargeIds = Array.isArray(sourceItem.relation_surcharge_ids) ? sourceItem.relation_surcharge_ids : [];
387
+ const hasSurcharge = new import_decimal.default(product.surcharge_fee || 0).gt(0) || relationSurchargeIds.length > 0;
388
+ if (hasSurcharge) {
389
+ product.main_product_attached_bundle_surcharge_fee = toFixed2(product.surcharge_fee);
390
+ }
391
+ if (relationSurchargeIds.length > 0) {
392
+ product.relation_surcharge_ids = sourceItem.relation_surcharge_ids;
393
+ }
394
+ if (hasSurcharge && sourceItem.surcharge_rounding_remainder !== void 0) {
395
+ product.surcharge_rounding_remainder = sourceItem.surcharge_rounding_remainder;
396
+ }
383
397
  }
384
398
  const hasTaxRate = taxRate !== void 0 && taxRate !== null && taxRate > 0;
385
399
  let productTaxFee;
@@ -393,8 +407,8 @@ function calculateSalesSummary(params) {
393
407
  );
394
408
  }
395
409
  const shopDiscountAmount = import_decimal.default.max(new import_decimal.default(Number(shopDiscount) || 0), 0);
396
- const expectAmount = import_decimal.default.max(0, productAmount.plus(surchargeAmount).minus(shopDiscountAmount));
397
- const totalAmount = isPriceIncludeTax === 1 ? expectAmount : expectAmount.plus(productTaxFee);
410
+ const preTaxExpectAmount = import_decimal.default.max(0, productAmount.plus(surchargeAmount).minus(shopDiscountAmount));
411
+ const totalAmount = isPriceIncludeTax === 1 ? preTaxExpectAmount : preTaxExpectAmount.plus(productTaxFee);
398
412
  const deposit = calculateProductsDeposit(products);
399
413
  return {
400
414
  product_quantity: productQuantity,
@@ -412,7 +426,7 @@ function calculateSalesSummary(params) {
412
426
  ),
413
427
  deposit_amount: deposit ? deposit.total : "0.00",
414
428
  deposit,
415
- expect_amount: toFixed2(expectAmount),
429
+ expect_amount: toFixed2(totalAmount),
416
430
  total_amount: toFixed2(totalAmount),
417
431
  total_refund_amount: "0.00",
418
432
  customer_paid_amount: "0.00",
@@ -135,7 +135,9 @@ var ScheduleModule = class extends import_BaseModule.BaseModule {
135
135
  return dates;
136
136
  }
137
137
  getScheduleListByIds(ids) {
138
- return this.store.scheduleList.filter((n) => ids.includes(n.id));
138
+ const idSet = new Set(ids.map((id) => String(id)));
139
+ const list = this.store.scheduleList.filter((n) => idSet.has(String(n.id)));
140
+ return list;
139
141
  }
140
142
  setAvailabilityScheduleDateList(list) {
141
143
  this.store.availabilityDateList = list;
@@ -16,3 +16,4 @@ export * from './Schedule';
16
16
  export * from './Quotation';
17
17
  export * from './ScanOrderLogger';
18
18
  export * from './OpenData';
19
+ export * from './BookingContext';
@@ -34,6 +34,7 @@ __reExport(modules_exports, require("./Schedule"), module.exports);
34
34
  __reExport(modules_exports, require("./Quotation"), module.exports);
35
35
  __reExport(modules_exports, require("./ScanOrderLogger"), module.exports);
36
36
  __reExport(modules_exports, require("./OpenData"), module.exports);
37
+ __reExport(modules_exports, require("./BookingContext"), module.exports);
37
38
  // Annotate the CommonJS export names for ESM import in node:
38
39
  0 && (module.exports = {
39
40
  ...require("./Product"),
@@ -53,5 +54,6 @@ __reExport(modules_exports, require("./OpenData"), module.exports);
53
54
  ...require("./Schedule"),
54
55
  ...require("./Quotation"),
55
56
  ...require("./ScanOrderLogger"),
56
- ...require("./OpenData")
57
+ ...require("./OpenData"),
58
+ ...require("./BookingContext")
57
59
  });
@@ -149,10 +149,11 @@ var Server = class {
149
149
  */
150
150
  this.handleProductQuery = async ({ url, method, data, config }) => {
151
151
  console.log("[Server] handleProductQuery:", url, method, data, config);
152
- const { menu_list_ids, schedule_datetime, schedule_date, customer_id } = data;
152
+ const { menu_list_ids, schedule_datetime, schedule_date, customer_id, ids } = data;
153
153
  const { callback, subscriberId } = config || {};
154
154
  this.logInfo("handleProductQuery: 开始处理商品查询请求", {
155
155
  menu_list_ids,
156
+ ids,
156
157
  schedule_datetime,
157
158
  schedule_date,
158
159
  customer_id
@@ -160,14 +161,14 @@ var Server = class {
160
161
  if (subscriberId && typeof callback === "function") {
161
162
  this.productQuerySubscribers.set(subscriberId, {
162
163
  callback,
163
- context: { menu_list_ids, schedule_date, schedule_datetime, customer_id }
164
+ context: { menu_list_ids, ids, schedule_date, schedule_datetime, customer_id }
164
165
  });
165
166
  this.logInfo("handleProductQuery: 已注册订阅者", {
166
167
  subscriberId,
167
168
  totalSubscribers: this.productQuerySubscribers.size
168
169
  });
169
170
  }
170
- return this.computeProductQueryResult({ menu_list_ids, schedule_date, schedule_datetime, customer_id });
171
+ return this.computeProductQueryResult({ menu_list_ids, ids, schedule_date, schedule_datetime, customer_id });
171
172
  };
172
173
  /**
173
174
  * 按商品 id 查询单条(GET /shop/product/query/:productId)
@@ -931,6 +932,8 @@ var Server = class {
931
932
  return;
932
933
  }
933
934
  try {
935
+ await this.schedule.loadAllSchedule();
936
+ this.products.clearPriceCache();
934
937
  await this.products.setupQuotationPriceBridge({
935
938
  scheduleModule: this.schedule,
936
939
  channel: (_a = this.core.context) == null ? void 0 : _a.channel
@@ -2049,9 +2052,11 @@ var Server = class {
2049
2052
  */
2050
2053
  async computeProductQueryResult(context, options) {
2051
2054
  const tTotal = performance.now();
2052
- const { menu_list_ids, schedule_date, schedule_datetime, customer_id, product_id } = context;
2055
+ const { menu_list_ids, ids, schedule_date, schedule_datetime, customer_id, product_id } = context;
2056
+ const queryIds = Array.isArray(ids) ? ids.map((id) => Number(id)).filter((id) => Number.isFinite(id)) : [];
2053
2057
  this.logInfo("computeProductQueryResult 开始", {
2054
2058
  menuListIdsCount: (menu_list_ids == null ? void 0 : menu_list_ids.length) ?? 0,
2059
+ ids: queryIds,
2055
2060
  schedule_datetime,
2056
2061
  schedule_date,
2057
2062
  customer_id,
@@ -2062,6 +2067,38 @@ var Server = class {
2062
2067
  this.logError("computeProductQueryResult: Products 模块未注册");
2063
2068
  return { message: "Products 模块未注册", data: { list: [], count: 0 } };
2064
2069
  }
2070
+ if (queryIds.length > 0) {
2071
+ const uniqueIds = Array.from(new Set(queryIds));
2072
+ const tPrice2 = performance.now();
2073
+ const productsWithPrice = await this.products.getProductsWithPrice(schedule_date, {
2074
+ scheduleModule: this.getSchedule(),
2075
+ schedule_datetime,
2076
+ customer_id
2077
+ }, {
2078
+ changedIds: options == null ? void 0 : options.changedIds,
2079
+ productIds: uniqueIds
2080
+ });
2081
+ (0, import_product.perfMark)("computeQuery.getProductsWithPrice(ids)", performance.now() - tPrice2, {
2082
+ count: productsWithPrice.length,
2083
+ ids: uniqueIds
2084
+ });
2085
+ const filteredProducts2 = productsWithPrice.filter((p) => uniqueIds.includes(Number(p == null ? void 0 : p.id))).filter((p) => ((p == null ? void 0 : p.status) || "published") === "published");
2086
+ (0, import_product.perfMark)("computeProductQueryResult", performance.now() - tTotal, {
2087
+ mode: "ids",
2088
+ ids: uniqueIds,
2089
+ count: filteredProducts2.length
2090
+ });
2091
+ this.logInfo("computeProductQueryResult 完成(ids)", {
2092
+ ids: uniqueIds,
2093
+ count: filteredProducts2.length
2094
+ });
2095
+ return {
2096
+ code: 200,
2097
+ data: { list: filteredProducts2, count: filteredProducts2.length },
2098
+ message: "",
2099
+ status: true
2100
+ };
2101
+ }
2065
2102
  if (product_id != null && Number.isFinite(Number(product_id))) {
2066
2103
  const pid = Number(product_id);
2067
2104
  const tPrice2 = performance.now();
@@ -18,6 +18,7 @@ export declare class OrderModule extends BaseModule implements Module {
18
18
  private resourceIdIndex;
19
19
  private logger;
20
20
  private storage;
21
+ private orderSQLiteSaveQueue;
21
22
  constructor(name?: string, version?: string);
22
23
  initialize(core: PisellCore, options?: ModuleOptions): Promise<void>;
23
24
  /**
@@ -130,6 +131,28 @@ export declare class OrderModule extends BaseModule implements Module {
130
131
  private getStorageItem;
131
132
  private setStorageItem;
132
133
  private loadOrdersFromSQLite;
134
+ /**
135
+ * 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
136
+ *
137
+ * @example
138
+ * await this.runInOrderSQLiteSaveQueue(async () => {
139
+ * await this.dbManager.clear(INDEXDB_STORE_NAME)
140
+ * await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
141
+ * })
142
+ */
143
+ private runInOrderSQLiteSaveQueue;
144
+ /**
145
+ * 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
146
+ *
147
+ * @example
148
+ * await this.saveOrdersToSQLite(this.store.list)
149
+ */
133
150
  private saveOrdersToSQLite;
151
+ /**
152
+ * 清空订单模块的内存数据和本地 SQLite 订单表。
153
+ *
154
+ * @example
155
+ * await orderModule.clear()
156
+ */
134
157
  clear(): Promise<void>;
135
158
  }
@@ -50,6 +50,7 @@ var OrderModule = class extends import_BaseModule.BaseModule {
50
50
  this.isIdlePhase = true;
51
51
  // Map<resource_id, OrderId[]> 资源到订单的倒排索引
52
52
  this.resourceIdIndex = /* @__PURE__ */ new Map();
53
+ this.orderSQLiteSaveQueue = Promise.resolve();
53
54
  }
54
55
  async initialize(core, options) {
55
56
  var _a, _b;
@@ -743,36 +744,67 @@ var OrderModule = class extends import_BaseModule.BaseModule {
743
744
  return [];
744
745
  }
745
746
  }
747
+ /**
748
+ * 串行执行订单 SQLite 保存任务,保证 clear + bulkAdd 组合不会被其它订单保存插入。
749
+ *
750
+ * @example
751
+ * await this.runInOrderSQLiteSaveQueue(async () => {
752
+ * await this.dbManager.clear(INDEXDB_STORE_NAME)
753
+ * await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orders)
754
+ * })
755
+ */
756
+ async runInOrderSQLiteSaveQueue(task) {
757
+ const queuedTask = this.orderSQLiteSaveQueue.then(task, task);
758
+ this.orderSQLiteSaveQueue = queuedTask.then(() => void 0, () => void 0);
759
+ return queuedTask;
760
+ }
761
+ /**
762
+ * 保存订单列表到 SQLite,内部会先清空 orders 表再批量写入当前快照。
763
+ *
764
+ * @example
765
+ * await this.saveOrdersToSQLite(this.store.list)
766
+ */
746
767
  async saveOrdersToSQLite(orderList) {
747
768
  if (!this.dbManager)
748
769
  return;
770
+ const orderListSnapshot = (0, import_lodash_es.cloneDeep)(orderList);
749
771
  try {
750
- this.logInfo("saveOrdersToSQLite-开始", {
751
- count: orderList.length
752
- });
753
- await this.dbManager.clear(INDEXDB_STORE_NAME);
754
- this.logInfo("saveOrdersToSQLite-clear完成", {
755
- count: orderList.length
756
- });
757
- if (orderList.length === 0)
758
- return;
759
- await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderList);
760
- this.logInfo("saveOrdersToSQLite-bulkAdd完成", {
761
- count: orderList.length
772
+ await this.runInOrderSQLiteSaveQueue(async () => {
773
+ this.logInfo("saveOrdersToSQLite-开始", {
774
+ count: orderListSnapshot.length
775
+ });
776
+ await this.dbManager.clear(INDEXDB_STORE_NAME);
777
+ this.logInfo("saveOrdersToSQLite-clear完成", {
778
+ count: orderListSnapshot.length
779
+ });
780
+ if (orderListSnapshot.length === 0)
781
+ return;
782
+ await this.dbManager.bulkAdd(INDEXDB_STORE_NAME, orderListSnapshot);
783
+ this.logInfo("saveOrdersToSQLite-bulkAdd完成", {
784
+ count: orderListSnapshot.length
785
+ });
762
786
  });
763
787
  } catch (error) {
764
788
  this.logError("保存订单到 SQLite 失败", {
765
789
  error: error instanceof Error ? error.message : String(error),
766
- orderList: orderList.length
790
+ orderList: orderListSnapshot.length
767
791
  });
768
792
  }
769
793
  }
794
+ /**
795
+ * 清空订单模块的内存数据和本地 SQLite 订单表。
796
+ *
797
+ * @example
798
+ * await orderModule.clear()
799
+ */
770
800
  async clear() {
771
801
  this.store.list = [];
772
802
  this.store.map = /* @__PURE__ */ new Map();
773
803
  this.resourceIdIndex.clear();
774
804
  if (this.dbManager) {
775
- await this.dbManager.clear(INDEXDB_STORE_NAME);
805
+ await this.runInOrderSQLiteSaveQueue(async () => {
806
+ await this.dbManager.clear(INDEXDB_STORE_NAME);
807
+ });
776
808
  }
777
809
  this.setStorageItem(ORDER_LAST_FULL_FETCH_AT_STORAGE_KEY, "");
778
810
  this.core.effects.emit(import_types.OrderHooks.onOrdersChanged, this.store.list);